(()=>{"use strict";var e={907(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return function(e){function t(){var e,n,r,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var o=arguments.length,s=new Array(o),u=0;u<o;u++)s[u]=arguments[u];return n=this,r=t,i=[].concat(s),r=y(r),e=function(e,t){if(t&&("object"==a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(n,d()?Reflect.construct(r,i||[],y(n).constructor):r.apply(n,i)),_(e,"isEligible",!1),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&m(e,t)}(t,e),n=t,r=[{key:"createExpressElement",value:function(){this.elements&&(this.expressCheckoutElement=this.elements.create("expressCheckout",this.getExpressElementOptions()),this.expressCheckoutElement.on("ready",this.onReady.bind(this)),this.expressCheckoutElement.on("loaderror",this.onLoadError.bind(this)),this.expressCheckoutElement.on("click",this.onClickElement.bind(this)),this.expressCheckoutElement.on("confirm",this.onConfirm.bind(this)),this.expressCheckoutElement.on("cancel",this.onCancel.bind(this)),this.expressCheckoutElement.on("shippingaddresschange",this.onShippingAddressChange.bind(this)),this.expressCheckoutElement.on("shippingratechange",this.onShippingRateChange.bind(this)))}},{key:"onClickElement",value:function(e){var t;this.store_attribution_values();var n={};this.params.items.reduce(function(e,t){return e+t.amount},0)===parseFloat(this.params.total_cents)&&(n.lineItems=this.params.items),null!==(t=this.expressElementOptions)&&void 0!==t&&t.shippingAddressRequired&&this.params.shipping_options.length&&(n.shippingRates=this.params.shipping_options),e.resolve(n),this.modalOpen=!0}},{key:"onReady",value:function(){}},{key:"onConfirm",value:(l=h(s().m(function e(t){var n,r,i,a,u,p,l,h,f,d,y,m,_,v,b,g,w,k;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.billingDetails,(r=t.shippingAddress)&&(i=r.name,a=void 0===i?"":i,u=r.address,p=void 0===u?null:u,l=c(c({},!!a&&{name:a}),!!p&&{shipping_address_1:p.line1||"",shipping_address_2:p.line2||"",shipping_city:p.city||"",shipping_state:p.state||"",shipping_postcode:p.postal_code||"",shipping_country:p.country||""}),null!=n&&n.phone&&(l.shipping_phone=n.phone),this.populate_shipping_fields(l)),n&&(h=n.name,f=void 0===h?"":h,d=n.email,y=void 0===d?"":d,m=n.phone,_=void 0===m?"":m,v=n.address,b=void 0===v?null:v,g=c(c(c(c({},!!f&&{name:f}),!!b&&{billing_address_1:b.line1||"",billing_address_2:b.line2||"",billing_city:b.city||"",billing_state:b.state||"",billing_postcode:b.postal_code||"",billing_country:b.country||""}),(0,o.isEmail)(y)&&{billing_email:y}),!!_&&{billing_phone:_}),this.populate_billing_fields(g)),e.p=1,e.n=2,this.elements.submit();case 2:return e.n=3,this.stripe.createPaymentMethod({elements:this.elements});case 3:if(!(w=e.v).error){e.n=4;break}return e.a(2,this.submit_error(w.error));case 4:this.on_token_received(w.paymentMethod),e.n=6;break;case 5:return e.p=5,k=e.v,e.a(2,this.submit_error(k));case 6:return e.a(2)}},e,this,[[1,5]])})),function(e){return l.apply(this,arguments)})},{key:"onShippingAddressChange",value:(p=h(s().m(function e(t){var n,r,i,o,a,u,p,l;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.reject,r=t.resolve,i=t.address,e.p=1,e.n=2,this.update_shipping_address({shippingAddress:i});case 2:o=e.v,a=o.newData,u=a.total,p=a.displayItems,l=a.shippingOptions,this.params.total_cents=u.amount,this.params.items=p,this.params.shipping_options=l,this.elements.update({amount:u.amount}),r(c({shippingRates:l},p.reduce(function(e,t){return e+t.amount},0)===u.amount&&{lineItems:p})),e.n=4;break;case 3:e.p=3,e.v,n();case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return p.apply(this,arguments)})},{key:"onShippingRateChange",value:(u=h(s().m(function e(t){var n,r,i,o,a,u,p,l;return s().w(function(e){for(;;)switch(e.p=e.n){case 0:return n=t.reject,r=t.resolve,i=t.shippingRate,e.p=1,e.n=2,this.update_shipping_method({shippingOption:i});case 2:o=e.v,a=o.newData,u=a.total,p=a.displayItems,l=a.shippingOptions,this.params.total_cents=u.amount,this.params.items=p,l.length&&(this.params.shipping_options=l),this.elements.update({amount:u.amount}),r(c({shippingRates:this.params.shipping_options},p.reduce(function(e,t){return e+t.amount},0)===u.amount&&{lineItems:p})),e.n=4;break;case 3:e.p=3,e.v,n();case 4:return e.a(2)}},e,this,[[1,3]])})),function(e){return u.apply(this,arguments)})},{key:"onCancel",value:function(){this.modalOpen=!1}},{key:"isModalOpen",value:function(){return!!this.modalOpen}},{key:"mountPaymentElement",value:function(){try{this.expressCheckoutElement&&(0===(0,i.default)(this.elementSelector).find("iframe").length?(this.expressCheckoutElement.unmount(),(0,i.default)(this.elementSelector).length||this.createElementSelectorHTML(),(0,i.default)(this.elementSelector).length&&this.expressCheckoutElement.mount(this.elementSelector)):this.onReady({availablePaymentMethods:{applePay:this.isEligible}}))}catch(e){console.log("Error mounting expressCheckoutElement. ",e)}}},{key:"createElementSelectorHTML",value:function(){}},{key:"updatePaymentElement",value:function(){try{this.elements&&this.elements.update(this.get_element_options())}catch(e){console.log("Error updating expressCheckoutElement. ",e)}}},{key:"onLoadError",value:function(e){(0,i.default)(this.elementSelector).hide(),console.log("Error loading expressCheckout Element: ",e)}},{key:"get_element_options",value:function(){var e=c({currency:this.params.currency.toLowerCase(),appearance:{variables:{borderRadius:this.params.button_options.radius}}},this.params.elementOptions);return delete e.paymentMethodTypes,(this.isPaymentMode()||this.isSubscriptionMode())&&(e.amount=parseFloat(this.params.total_cents)>0?parseFloat(this.params.total_cents):100),e}},{key:"get_gateway_data",value:function(){return this.params}},{key:"isPaymentMode",value:function(){return"payment"===this.params.elementOptions.mode}},{key:"isSubscriptionMode",value:function(){return"subscription"===this.params.elementOptions.mode}},{key:"isSetupMode",value:function(){return"setup"===this.params.elementOptions.mode}},{key:"needs_shipping",value:function(){return"1"===this.params.needs_shipping||!0===this.params.needs_shipping}},{key:"get_currency",value:function(){return this.params.currency}},{key:"map_address",value:function(e){return{city:e.city,postcode:e.postal_code,state:e.state,country:e.country}}},{key:"get_form",value:function(){return(0,i.default)(this.elementSelector).closest("form")}},{key:"set_nonce",value:function(e){(0,i.default)('[name="stripe_applepay_token_key"]').length||(0,i.default)(this.elementSelector).append('<input type="hidden" name="stripe_applepay_token_key"/>'),(0,i.default)('[name="stripe_applepay_token_key"]').val(e),this.fields.set(this.gateway_id+"_token_key",e)}},{key:"onHashChange",value:function(e){var t=window.location.hash.match(/response=(.*)/);if(t)try{var n=JSON.parse(window.atob(decodeURIComponent(t[1])));n&&n.hasOwnProperty("client_secret")&&n.gateway_id===this.gateway_id&&this.modalOpen&&(history.pushState({},"",window.location.pathname),"payment_intent"===n.type?this.processPaymentIntent(n):this.processSetupIntent(n))}catch(e){}return!0}},{key:"processPaymentIntent",value:function(e){var t=this;this.stripe.confirmPayment({clientSecret:e.client_secret,redirect:"if_required",confirmParams:c({return_url:e.return_url,payment_method_data:{billing_details:e.billing_details||this.get_billing_details()}},e.confirmation_args&&e.confirmation_args)}).then(function(n){if(n.error)return t.payment_token_received=!1,t.submit_error(n.error);var r=decodeURI(e.return_url);if(r+="&"+i.default.param({_stripe_local_payment:t.gateway_id,payment_intent:n.paymentIntent.id,payment_intent_client_secret:n.paymentIntent.client_secret}),["promptpay","swish","paynow","cashapp"].includes(t.paymentMethodType)){if("requires_action"===n.paymentIntent.status)return t.get_form().unblock().removeClass("processing");if("requires_payment_method"===n.paymentIntent.status)return t.get_form().unblock().removeClass("processing"),t.submit_error({code:n.paymentIntent.last_payment_error.code})}window.location.href=r}).catch(function(e){return t.submit_error(e)})}},{key:"processSetupIntent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.stripe.confirmSetup(c({elements:this.elements,clientSecret:t.client_secret,redirect:"if_required"},t&&{confirmParams:c(c({},t.return_url&&{return_url:t.return_url}),{},{payment_method_data:{billing_details:this.get_billing_details()}},t.confirmParams&&t.confirmParams)})).then(function(t){if(t.error)return e.payment_token_received=!1,e.submit_error(t.error);e.setupIntent=t.setupIntent,e.payment_token_received=!0,e.set_nonce(t.setupIntent.payment_method),e.set_intent(t.setupIntent.id),e.get_form().removeClass("processing"),e.get_form().trigger("submit")}).catch(function(t){return e.submit_error(t)})}},{key:"getExpressElementOptions",value:function(){return this.expressElementOptions={buttonHeight:Math.max(40,Math.min(55,parseInt(this.params.button_options.height))),buttonType:{applePay:this.params.button_options.type},buttonTheme:{applePay:this.params.button_options.theme},paymentMethods:{applePay:"applePay"===this.type?this.params.display_rule:"never",googlePay:"googlePay"===this.type?"always":"never",amazonPay:"amazonPay"===this.type?"auto":"never",paypal:"never",klarna:"klarna"===this.type?"auto":"never",link:"link"===this.type?"auto":"never"},emailRequired:!0,phoneNumberRequired:!0,billingAddressRequired:!0,shippingAddressRequired:this.needs_shipping()},this.expressElementOptions}},{key:"triggerUpdatedCheckout",value:function(){return new Promise(function(e){(0,i.default)(document.body).one("updated_checkout",e),(0,i.default)(document.body).trigger("update_checkout",{update_shipping_method:!1})})}},{key:"populateDomFields",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e){var n="#"+t;(0,i.default)(n).length&&(0,i.default)(n).val(e[t])}}}],r&&f(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,u,p,l}(e)};var r,i=(r=n(428))&&r.__esModule?r:{default:r},o=n(832);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function s(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var s=r&&r.prototype instanceof p?r:p,c=Object.create(s.prototype);return u(c,"_invoke",function(n,r,i){var o,s,u,p=0,c=i||[],l=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return o=t,s=0,u=e,h.n=n,a}};function f(n,r){for(s=n,u=r,t=0;!l&&p&&!i&&t<c.length;t++){var i,o=c[t],f=h.p,d=o[2];n>3?(i=d===r)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=n<2&&f<o[1])?(s=0,h.v=r,h.n=o[1]):f<d&&(i=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,h.n=d,s=0))}if(i||n>1)return a;throw l=!0,r}return function(i,c,d){if(p>1)throw TypeError("Generator is already running");for(l&&1===c&&f(c,d),s=c,u=d;(t=s<2?e:u)||!l;){o||(s?s<3?(s>1&&(h.n=-1),f(s,u)):h.n=u:h.v=u);try{if(p=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(l=h.n<0)?u:n.call(r,h))!==a)break}catch(t){o=e,s=1,u=t}finally{p=1}}return{value:t,done:l}}}(n,i,o),!0),c}var a={};function p(){}function c(){}function l(){}t=Object.getPrototypeOf;var h=[][r]?t(t([][r]())):(u(t={},r,function(){return this}),t),f=l.prototype=p.prototype=Object.create(h);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,u(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=l,u(f,"constructor",l),u(l,"constructor",c),c.displayName="GeneratorFunction",u(l,i,"GeneratorFunction"),u(f),u(f,i,"Generator"),u(f,r,function(){return this}),u(f,"toString",function(){return"[object Generator]"}),(s=function(){return{w:o,m:d}})()}function u(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}u=function(e,t,n,r){function o(t,n){u(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},u(e,t,n,r)}function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?p(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):p(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function h(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(e){l(o,r,i,a,s,"next",e)}function s(e){l(o,r,i,a,s,"throw",e)}a(void 0)})}}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(d=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function m(e,t){return m=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},m(e,t)}function _(e,t,n){return(t=v(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e){var t=function(e){if("object"!=a(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==a(t)?t:t+""}},428(e){e.exports=window.jQuery},705(e){e.exports=window.wc_stripe},832(e){e.exports=window.wp.url}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,n),o.exports}function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}var i=n(705),o=s(n(428)),a=s(n(907));function s(e){return e&&e.__esModule?e:{default:e}}function u(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var u=r&&r.prototype instanceof s?r:s,c=Object.create(u.prototype);return p(c,"_invoke",function(n,r,i){var o,s,u,p=0,c=i||[],l=!1,h={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return o=t,s=0,u=e,h.n=n,a}};function f(n,r){for(s=n,u=r,t=0;!l&&p&&!i&&t<c.length;t++){var i,o=c[t],f=h.p,d=o[2];n>3?(i=d===r)&&(u=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=e):o[0]<=f&&((i=n<2&&f<o[1])?(s=0,h.v=r,h.n=o[1]):f<d&&(i=n<3||o[0]>r||r>d)&&(o[4]=n,o[5]=r,h.n=d,s=0))}if(i||n>1)return a;throw l=!0,r}return function(i,c,d){if(p>1)throw TypeError("Generator is already running");for(l&&1===c&&f(c,d),s=c,u=d;(t=s<2?e:u)||!l;){o||(s?s<3?(s>1&&(h.n=-1),f(s,u)):h.n=u:h.v=u);try{if(p=2,o){if(s||(i="next"),t=o[i]){if(!(t=t.call(o,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,s<2&&(s=0)}else 1===s&&(t=o.return)&&t.call(o),s<2&&(u=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=e}else if((t=(l=h.n<0)?u:n.call(r,h))!==a)break}catch(t){o=e,s=1,u=t}finally{p=1}}return{value:t,done:l}}}(n,i,o),!0),c}var a={};function s(){}function c(){}function l(){}t=Object.getPrototypeOf;var h=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),f=l.prototype=s.prototype=Object.create(h);function d(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,p(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=l,p(f,"constructor",l),p(l,"constructor",c),c.displayName="GeneratorFunction",p(l,i,"GeneratorFunction"),p(f),p(f,i,"Generator"),p(f,r,function(){return this}),p(f,"toString",function(){return"[object Generator]"}),(u=function(){return{w:o,m:d}})()}function p(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}p=function(e,t,n,r){function o(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?i?i(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(o("next",0),o("throw",1),o("return",2))},p(e,t,n,r)}function c(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}function l(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function h(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}function f(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(f=function(){return!!e})()}function d(e,t,n,r){var i=y(m(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function y(){return y="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=m(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(arguments.length<3?e:n):i.value}},y.apply(null,arguments)}function m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function _(e,t){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_(e,t)}function v(e){this.type="applePay",this.container="li.payment_method_stripe_applepay",this.elementSelector="li.payment_method_stripe_applepay .wc-stripe-applepay-container",i.BaseGateway.call(this,e)}v.prototype=Object.assign(v.prototype,i.BaseGateway.prototype,i.ProductGateway.prototype);var b=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t,n){return t=m(t),function(e,t){if(t&&("object"==r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,f()?Reflect.construct(t,n||[],m(e).constructor):t.apply(e,n))}(this,t,arguments)}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_(e,t)}(t,e),n=t,a=[{key:"initialize",value:function(){this.modalOpen=!1,i.ProductGateway.call(this),this.createExpressElement(),this.mountPaymentElement(),window.addEventListener("hashchange",this.onHashChange.bind(this))}},{key:"onReady",value:function(e){var t=(e.availablePaymentMethods||{}).applePay,n=void 0!==t&&t;this.isEligible=n,this.isEligible?(this.addEvents(),(0,o.default)(this.container).show().addClass("active"),(0,o.default)(this.container).parent().parent().addClass("active")):(0,o.default)(this.container).hide()}},{key:"addEvents",value:function(){window.addEventListener("hashchange",this.onHashChange.bind(this)),(0,o.default)(document.body).on("change",'[name="quantity"]',this.onQuantityChange.bind(this))}},{key:"onClickElement",value:function(e){if((0,o.default)(this.elementSelector).is(".disabled"))return e.reject();this.needs_shipping()||this.add_to_cart(),d(t,"onClickElement",this,3)([e])}},{key:"found_variation",value:function(e,t){var n=this.needs_shipping();this.params.product.price=t.display_price,this.params.product.price_cents=t.display_price_cents,this.params.needs_shipping=!t.is_virtual,this.params.product.variation=t,t.is_in_stock?this.calculateCart():this.disableButton(),this.expressCheckoutElement&&n!==this.needs_shipping()&&(this.expressCheckoutElement&&this.expressCheckoutElement.unmount(),this.elements=this.create_stripe_elements(),this.createExpressElement(),this.mountPaymentElement())}},{key:"reset_variation_data",value:function(){this.params.product.variation=!1,this.disableButton()}},{key:"disableButton",value:function(){(0,o.default)(this.elementSelector).addClass("disabled")}},{key:"enableButton",value:function(){(0,o.default)(this.elementSelector).removeClass("disabled")}},{key:"get_product_data",value:function(){return this.params.product}},{key:"onQuantityChange",value:function(){if(this.is_variable_product()){var e;if(!this.variable_product_selected())return;if(null===(e=this.params.product)||void 0===e||null===(e=e.variation)||void 0===e||!e.is_in_stock)return}this.calculateCart()}},{key:"calculateCart",value:(s=u().m(function e(){var n,r,i,o,a,s;return u().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,this.disableButton(),e.n=1,d(t,"cart_calculation",this,3)([]);case 1:(n=e.v)[this.gateway_id]&&(r=n[this.gateway_id],i=r.totalCents,o=r.displayItems,a=r.shippingOptions,this.params.total_cents=parseFloat(i),this.params.items=o,this.needs_shipping()?this.params.shipping_options=a:this.params.shipping_options=[],this.params.total_cents>0&&this.elements.update({amount:this.params.total_cents})),e.n=3;break;case 2:return e.p=2,s=e.v,e.a(2,this.submit_error(s));case 3:return e.p=3,this.enableButton(),e.f(3);case 4:return e.a(2)}},e,this,[[0,2,3,4]])}),p=function(){var e=this,t=arguments;return new Promise(function(n,r){var i=s.apply(e,t);function o(e){c(i,n,r,o,a,"next",e)}function a(e){c(i,n,r,o,a,"throw",e)}o(void 0)})},function(){return p.apply(this,arguments)})}],a&&l(n.prototype,a),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,a,s,p}((0,a.default)(v));if("undefined"!=typeof wc_stripe_applepay_product_params){var g=new b(wc_stripe_applepay_product_params);wc_stripe.product_gateways.push(g)}(this.wcStripeModules=this.wcStripeModules||{}).applepayProduct={}})();