(()=>{"use strict";var t={907:(t,e,r)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return function(t){function e(){var t,r,n,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var o=arguments.length,s=new Array(o),u=0;u<o;u++)s[u]=arguments[u];return r=this,n=e,i=[].concat(s),n=y(n),m(t=function(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(r,f()?Reflect.construct(n,i||[],y(r).constructor):n.apply(r,i)),"isEligible",!1),t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),r=e,n=[{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(t){var e;this.store_attribution_values();var r={};this.params.items.reduce((function(t,e){return t+e.amount}),0)===parseFloat(this.params.total_cents)&&(r.lineItems=this.params.items),null!==(e=this.expressElementOptions)&&void 0!==e&&e.shippingAddressRequired&&this.params.shipping_options.length&&(r.shippingRates=this.params.shipping_options),t.resolve(r),this.modalOpen=!0}},{key:"onReady",value:function(){}},{key:"onConfirm",value:(v=p(s().mark((function t(e){var r,n,i,a,u,l,p,h,f,y,d,m,v,g,_,b,w;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.billingDetails,(n=e.shippingAddress)&&(i=n.name,a=void 0===i?"":i,u=n.address,l=void 0===u?null:u,p=c(c({},!!a&&{name:a}),!!l&&{shipping_address_1:l.line1||"",shipping_address_2:l.line2||"",shipping_city:l.city||"",shipping_state:l.state||"",shipping_postcode:l.postal_code||"",shipping_country:l.country||""}),null!=r&&r.phone&&(p.shipping_phone=r.phone),this.populate_shipping_fields(p)),r&&(h=r.name,f=void 0===h?"":h,y=r.email,d=void 0===y?"":y,m=r.phone,v=void 0===m?"":m,g=r.address,_=void 0===g?null:g,b=c(c(c(c({},!!f&&{name:f}),!!_&&{billing_address_1:_.line1||"",billing_address_2:_.line2||"",billing_city:_.city||"",billing_state:_.state||"",billing_postcode:_.postal_code||"",billing_country:_.country||""}),(0,o.isEmail)(d)&&{billing_email:d}),(0,o.isPhoneNumber)(v)&&{billing_phone:v}),this.populate_billing_fields(b)),t.prev=3,t.next=6,this.elements.submit();case 6:return t.next=8,this.stripe.createPaymentMethod({elements:this.elements});case 8:if(!(w=t.sent).error){t.next=11;break}return t.abrupt("return",this.submit_error(w.error));case 11:this.on_token_received(w.paymentMethod),t.next=17;break;case 14:return t.prev=14,t.t0=t.catch(3),t.abrupt("return",this.submit_error(t.t0));case 17:case"end":return t.stop()}}),t,this,[[3,14]])}))),function(t){return v.apply(this,arguments)})},{key:"onShippingAddressChange",value:(l=p(s().mark((function t(e){var r,n,i,o,a,u,l,p;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.reject,n=e.resolve,i=e.address,t.prev=1,t.next=4,this.update_shipping_address({shippingAddress:i});case 4:o=t.sent,a=o.newData,u=a.total,l=a.displayItems,p=a.shippingOptions,this.params.total_cents=u.amount,this.params.items=l,this.params.shipping_options=p,this.elements.update({amount:u.amount}),n(c({shippingRates:p},l.reduce((function(t,e){return t+e.amount}),0)===u.amount&&{lineItems:l})),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(1),r();case 16:case"end":return t.stop()}}),t,this,[[1,13]])}))),function(t){return l.apply(this,arguments)})},{key:"onShippingRateChange",value:(u=p(s().mark((function t(e){var r,n,i,o,a,u,l,p;return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.reject,n=e.resolve,i=e.shippingRate,t.prev=1,t.next=4,this.update_shipping_method({shippingOption:i});case 4:o=t.sent,a=o.newData,u=a.total,l=a.displayItems,p=a.shippingOptions,this.params.total_cents=u.amount,this.params.items=l,p.length&&(this.params.shipping_options=p),this.elements.update({amount:u.amount}),n(c({shippingRates:this.params.shipping_options},l.reduce((function(t,e){return t+e.amount}),0)===u.amount&&{lineItems:l})),t.next=16;break;case 13:t.prev=13,t.t0=t.catch(1),r();case 16:case"end":return t.stop()}}),t,this,[[1,13]])}))),function(t){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(t){console.log("Error mounting expressCheckoutElement. ",t)}}},{key:"createElementSelectorHTML",value:function(){}},{key:"updatePaymentElement",value:function(){try{this.elements&&this.elements.update(this.get_element_options())}catch(t){console.log("Error updating expressCheckoutElement. ",t)}}},{key:"onLoadError",value:function(t){(0,i.default)(this.elementSelector).hide(),console.log("Error loading expressCheckout Element: ",t)}},{key:"get_element_options",value:function(){var t=c({currency:this.params.currency.toLowerCase(),appearance:{variables:{borderRadius:this.params.button_options.radius}}},this.params.elementOptions);return delete t.paymentMethodTypes,(this.isPaymentMode()||this.isSubscriptionMode())&&(t.amount=parseFloat(this.params.total_cents)>0?parseFloat(this.params.total_cents):100),t}},{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(t){return{city:t.city,postcode:t.postal_code,state:t.state,country:t.country}}},{key:"get_form",value:function(){return(0,i.default)(this.elementSelector).closest("form")}},{key:"set_nonce",value:function(t){(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(t),this.fields.set(this.gateway_id+"_token_key",t)}},{key:"onHashChange",value:function(t){var e=window.location.hash.match(/response=(.*)/);if(e)try{var r=JSON.parse(window.atob(decodeURIComponent(e[1])));r&&r.hasOwnProperty("client_secret")&&r.gateway_id===this.gateway_id&&this.modalOpen&&(history.pushState({},"",window.location.pathname),"payment_intent"===r.type?this.processPaymentIntent(r):this.processSetupIntent(r))}catch(t){}return!0}},{key:"processPaymentIntent",value:function(t){var e=this;this.stripe.confirmPayment({clientSecret:t.client_secret,redirect:"if_required",confirmParams:c({return_url:t.return_url,payment_method_data:{billing_details:t.billing_details||this.get_billing_details()}},t.confirmation_args&&t.confirmation_args)}).then((function(r){if(r.error)return e.payment_token_received=!1,e.submit_error(r.error);var n=decodeURI(t.return_url);if(n+="&"+i.default.param({_stripe_local_payment:e.gateway_id,payment_intent:r.paymentIntent.id,payment_intent_client_secret:r.paymentIntent.client_secret}),["promptpay","swish","paynow","cashapp"].includes(e.paymentMethodType)){if("requires_action"===r.paymentIntent.status)return e.get_form().unblock().removeClass("processing");if("requires_payment_method"===r.paymentIntent.status)return e.get_form().unblock().removeClass("processing"),e.submit_error({code:r.paymentIntent.last_payment_error.code})}window.location.href=n})).catch((function(t){return e.submit_error(t)}))}},{key:"processSetupIntent",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.stripe.confirmSetup(c({elements:this.elements,clientSecret:e.client_secret,redirect:"if_required"},e&&{confirmParams:c(c({},e.return_url&&{return_url:e.return_url}),{},{payment_method_data:{billing_details:this.get_billing_details()}},e.confirmParams&&e.confirmParams)})).then((function(e){if(e.error)return t.payment_token_received=!1,t.submit_error(e.error);t.setupIntent=e.setupIntent,t.payment_token_received=!0,t.set_nonce(e.setupIntent.payment_method),t.set_intent(e.setupIntent.id),t.get_form().removeClass("processing"),t.get_form().trigger("submit")})).catch((function(e){return t.submit_error(e)}))}},{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(t){(0,i.default)(document.body).one("updated_checkout",t),(0,i.default)(document.body).trigger("update_checkout",{update_shipping_method:!1})}))}},{key:"populateDomFields",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e in t){var r="#"+e;(0,i.default)(r).length&&(0,i.default)(r).val(t[e])}}}],n&&h(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,u,l,v}(t)};var n,i=(n=r(428))&&n.__esModule?n:{default:n},o=r(832);function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function s(){s=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof _?e:_,a=Object.create(o.prototype),s=new R(n||[]);return i(a,"_invoke",{value:L(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var y="suspendedStart",d="suspendedYield",m="executing",v="completed",g={};function _(){}function b(){}function w(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(T([])));O&&O!==r&&n.call(O,u)&&(k=O);var x=w.prototype=_.prototype=Object.create(k);function P(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function j(t,e){function r(i,o,s,u){var c=f(t[i],t,o);if("throw"!==c.type){var l=c.arg,p=l.value;return p&&"object"==a(p)&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,s,u)}),(function(t){r("throw",t,s,u)})):e.resolve(p).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,u)}))}u(c.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return o=o?o.then(i,i):i()}})}function L(e,r,n){var i=y;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:t,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=S(s,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=f(e,r,n);if("normal"===c.type){if(i=n.done?v:d,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=v,n.method="throw",n.arg=c.arg)}}}function S(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,S(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=f(i,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var a=o.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function T(e){if(e||""===e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,o=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}throw new TypeError(a(e)+" is not iterable")}return b.prototype=w,i(x,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:b,configurable:!0}),b.displayName=p(w,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,p(t,l,"GeneratorFunction")),t.prototype=Object.create(x),t},e.awrap=function(t){return{__await:t}},P(j.prototype),p(j.prototype,c,(function(){return this})),e.AsyncIterator=j,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new j(h(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(x),p(x,l,"Generator"),p(x,u,(function(){return this})),p(x,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=T,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:T(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function c(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?u(Object(r),!0).forEach((function(e){m(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function l(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function p(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var o=t.apply(e,r);function a(t){l(o,n,i,a,s,"next",t)}function s(t){l(o,n,i,a,s,"throw",t)}a(void 0)}))}}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,v(n.key),n)}}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(f=function(){return!!t})()}function y(t){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},y(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}function m(t,e,r){return(e=v(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(t){var e=function(t,e){if("object"!=a(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!=a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}},428:t=>{t.exports=window.jQuery},705:t=>{t.exports=window.wc_stripe},832:t=>{t.exports=window.wp.url}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n](o,o.exports,r),o.exports}(()=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}var e=r(705),n=o(r(428)),i=o(r(907));function o(t){return t&&t.__esModule?t:{default:t}}function a(){a=function(){return r};var e,r={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(e){p=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=e&&e.prototype instanceof _?e:_,a=Object.create(i.prototype),s=new R(n||[]);return o(a,"_invoke",{value:L(t,r,s)}),a}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var y="suspendedStart",d="suspendedYield",m="executing",v="completed",g={};function _(){}function b(){}function w(){}var k={};p(k,u,(function(){return this}));var E=Object.getPrototypeOf,O=E&&E(E(T([])));O&&O!==n&&i.call(O,u)&&(k=O);var x=w.prototype=_.prototype=Object.create(k);function P(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function j(e,r){function n(o,a,s,u){var c=f(e[o],e,a);if("throw"!==c.type){var l=c.arg,p=l.value;return p&&"object"==t(p)&&i.call(p,"__await")?r.resolve(p.__await).then((function(t){n("next",t,s,u)}),(function(t){n("throw",t,s,u)})):r.resolve(p).then((function(t){l.value=t,s(l)}),(function(t){return n("throw",t,s,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,e){function i(){return new r((function(r,i){n(t,e,r,i)}))}return a=a?a.then(i,i):i()}})}function L(t,r,n){var i=y;return function(o,a){if(i===m)throw Error("Generator is already running");if(i===v){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=S(s,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===y)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=m;var c=f(t,r,n);if("normal"===c.type){if(i=n.done?v:d,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=v,n.method="throw",n.arg=c.arg)}}}function S(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=f(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function T(r){if(r||""===r){var n=r[u];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function t(){for(;++o<r.length;)if(i.call(r,o))return t.value=r[o],t.done=!1,t;return t.value=e,t.done=!0,t};return a.next=a}}throw new TypeError(t(r)+" is not iterable")}return b.prototype=w,o(x,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:b,configurable:!0}),b.displayName=p(w,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,p(t,l,"GeneratorFunction")),t.prototype=Object.create(x),t},r.awrap=function(t){return{__await:t}},P(j.prototype),p(j.prototype,c,(function(){return this})),r.AsyncIterator=j,r.async=function(t,e,n,i,o){void 0===o&&(o=Promise);var a=new j(h(t,e,n,i),o);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},P(x),p(x,l,"Generator"),p(x,u,(function(){return this})),p(x,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(I),!t)for(var r in this)"t"===r.charAt(0)&&i.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:T(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},r}function s(t,e,r,n,i,o,a){try{var s=t[o](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,i)}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function c(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=t(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==t(r)?r:r+""}function l(e,r,n){return r=f(r),function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(e)}(e,p()?Reflect.construct(r,n||[],f(e).constructor):r.apply(e,n))}function p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function h(){return h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},h.apply(this,arguments)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}function d(t){this.type="applePay",this.container="li.payment_method_stripe_applepay",this.elementSelector="li.payment_method_stripe_applepay .wc-stripe-applepay-container",e.BaseGateway.call(this,t)}d.prototype=Object.assign(d.prototype,e.BaseGateway.prototype,e.ProductGateway.prototype);var m=function(t){function r(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,r),l(this,r,arguments)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}(r,t),i=r,o=[{key:"initialize",value:function(){this.modalOpen=!1,e.ProductGateway.call(this),this.createExpressElement(),this.mountPaymentElement(),window.addEventListener("hashchange",this.onHashChange.bind(this))}},{key:"onReady",value:function(t){var e=(t.availablePaymentMethods||{}).applePay,r=void 0!==e&&e;this.isEligible=r,this.isEligible?(this.addEvents(),(0,n.default)(this.container).show().addClass("active"),(0,n.default)(this.container).parent().parent().addClass("active")):(0,n.default)(this.container).hide()}},{key:"addEvents",value:function(){window.addEventListener("hashchange",this.onHashChange.bind(this)),(0,n.default)(document.body).on("change",'[name="quantity"]',this.onQuantityChange.bind(this))}},{key:"onClickElement",value:function(t){if((0,n.default)(this.elementSelector).is(".disabled"))return t.reject();this.needs_shipping()||this.add_to_cart(),h(f(r.prototype),"onClickElement",this).call(this,t)}},{key:"found_variation",value:function(t,e){var r=this.needs_shipping();this.params.product.price=e.display_price,this.params.product.price_cents=e.display_price_cents,this.params.needs_shipping=!e.is_virtual,this.params.product.variation=e,e.is_in_stock?this.calculateCart():this.disableButton(),this.expressCheckoutElement&&r!==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,n.default)(this.elementSelector).addClass("disabled")}},{key:"enableButton",value:function(){(0,n.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 t;if(!this.variable_product_selected())return;if(null===(t=this.params.product)||void 0===t||null===(t=t.variation)||void 0===t||!t.is_in_stock)return}this.calculateCart()}},{key:"calculateCart",value:(c=a().mark((function t(){var e,n,i,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,this.disableButton(),t.next=4,h(f(r.prototype),"cart_calculation",this).call(this);case 4:(e=t.sent)[this.gateway_id]&&(n=e[this.gateway_id],i=n.totalCents,o=n.displayItems,s=n.shippingOptions,this.params.total_cents=parseFloat(i),this.params.items=o,this.needs_shipping()?this.params.shipping_options=s:this.params.shipping_options=[],this.params.total_cents>0&&this.elements.update({amount:this.params.total_cents})),t.next=11;break;case 8:return t.prev=8,t.t0=t.catch(0),t.abrupt("return",this.submit_error(t.t0));case 11:return t.prev=11,this.enableButton(),t.finish(11);case 14:case"end":return t.stop()}}),t,this,[[0,8,11,14]])})),p=function(){var t=this,e=arguments;return new Promise((function(r,n){var i=c.apply(t,e);function o(t){s(i,r,n,o,a,"next",t)}function a(t){s(i,r,n,o,a,"throw",t)}o(void 0)}))},function(){return p.apply(this,arguments)})}],o&&u(i.prototype,o),Object.defineProperty(i,"prototype",{writable:!1}),i;var i,o,c,p}((0,i.default)(d));if("undefined"!=typeof wc_stripe_applepay_product_params){var v=new m(wc_stripe_applepay_product_params);wc_stripe.product_gateways.push(v)}})(),(this.wcStripeModules=this.wcStripeModules||{}).applepayProduct={}})();