!function(t,a){function i(){a.BaseGateway.call(this,wc_stripe_applepay_product_params),this.old_qty=this.get_quantity()}(i.prototype=t.extend({},a.BaseGateway.prototype,a.ProductGateway.prototype,a.ApplePay.prototype)).initialize=function(){t(".wc_stripe_product_payment_methods "+this.container).length?(this.container=".wc_stripe_product_payment_methods "+this.container,a.ProductGateway.call(this),a.ApplePay.prototype.initialize.call(this)):setTimeout(this.initialize.bind(this),1e3)},i.prototype.canMakePayment=function(){a.ApplePay.prototype.canMakePayment.call(this).then(function(){t(document.body).on("change",'[name="quantity"]',this.add_to_cart.bind(this)),t(this.container).parent().parent().addClass("active"),this.is_variable_product()?this.variable_product_selected()?this.cart_calculation(this.get_product_data().variation.variation_id):this.disable_payment_button():this.cart_calculation()}.bind(this))},i.prototype.start=function(t){0===this.get_quantity()?(t.preventDefault(),this.submit_error(this.params.messages.invalid_amount)):a.ApplePay.prototype.start.apply(this,arguments)},i.prototype.append_button=function(){t("#wc-stripe-applepay-container").append(this.$button)},i.prototype.add_to_cart=function(){this.disable_payment_button(),this.old_qty=this.get_quantity();var t=this.get_product_data().variation;this.processing_calculation||this.is_variable_product()&&!this.variable_product_selected()||this.cart_calculation(t.variation_id).then(function(){this.is_variable_product()?(this.createPaymentRequest(),a.ApplePay.prototype.canMakePayment.apply(this,arguments).then(function(){this.enable_payment_button()}.bind(this))):this.enable_payment_button()}.bind(this))},i.prototype.found_variation=function(t){a.ProductGateway.prototype.found_variation.apply(this,arguments),this.can_pay&&this.add_to_cart()},new i}(jQuery,wc_stripe);