(()=>{"use strict";var e,t={780(e,t,n){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)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(705),a=l(n(428)),o=n(619),s=l(n(334));function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function c(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var l=r&&r.prototype instanceof s?r:s,u=Object.create(l.prototype);return d(u,"_invoke",function(n,r,i){var a,s,l,u=0,c=i||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return a=t,s=0,l=e,p.n=n,o}};function f(n,r){for(s=n,l=r,t=0;!d&&u&&!i&&t<c.length;t++){var i,a=c[t],f=p.p,m=a[2];n>3?(i=m===r)&&(l=a[(s=a[4])?5:(s=3,3)],a[4]=a[5]=e):a[0]<=f&&((i=n<2&&f<a[1])?(s=0,p.v=r,p.n=a[1]):f<m&&(i=n<3||a[0]>r||r>m)&&(a[4]=n,a[5]=r,p.n=m,s=0))}if(i||n>1)return o;throw d=!0,r}return function(i,c,m){if(u>1)throw TypeError("Generator is already running");for(d&&1===c&&f(c,m),s=c,l=m;(t=s<2?e:l)||!d;){a||(s?s<3?(s>1&&(p.n=-1),f(s,l)):p.n=l:p.v=l);try{if(u=2,a){if(s||(i="next"),t=a[i]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,s<2&&(s=0)}else 1===s&&(t=a.return)&&t.call(a),s<2&&(l=TypeError("The iterator does not provide a '"+i+"' method"),s=1);a=e}else if((t=(d=p.n<0)?l:n.call(r,p))!==o)break}catch(t){a=e,s=1,l=t}finally{u=1}}return{value:t,done:d}}}(n,i,a),!0),u}var o={};function s(){}function l(){}function u(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(d(t={},r,function(){return this}),t),f=u.prototype=s.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,d(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return l.prototype=u,d(f,"constructor",u),d(u,"constructor",l),l.displayName="GeneratorFunction",d(u,i,"GeneratorFunction"),d(f),d(f,i,"Generator"),d(f,r,function(){return this}),d(f,"toString",function(){return"[object Generator]"}),(c=function(){return{w:a,m}})()}function d(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}d=function(e,t,n,r){function a(t,n){d(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:(a("next",0),a("throw",1),a("return",2))},d(e,t,n,r)}function p(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){p(a,r,i,o,s,"next",e)}function s(e){p(a,r,i,o,s,"throw",e)}o(void 0)})}}function m(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 h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?m(Object(n),!0).forEach(function(t){y(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):m(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function y(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 _(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 v(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 b(e,t,n){return t=k(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,g()?Reflect.construct(t,n||[],k(e).constructor):t.apply(e,n))}function g(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(g=function(){return!!e})()}function w(){return w="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=k(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}},w.apply(null,arguments)}function k(e){return k=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},k(e)}function O(e,t){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},O(e,t)}function P(e,t){this.elementSelector=t,i.BaseGateway.call(this,e),i.CheckoutGateway.call(this)}P.prototype=Object.assign(P.prototype,i.BaseGateway.prototype,i.CheckoutGateway.prototype);var I=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=b(this,t,[e,n])).setupIntent=null,r.paymentMethodType=null,r.paymentElementComplete=!1,r}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&&O(e,t)}(t,e),n=t,r=[{key:"initialize",value:function(){window.addEventListener("hashchange",this.handleHashChange.bind(this)),(0,a.default)(document.body).on("click","#place_order",this.handlePlaceOrder.bind(this)),(0,a.default)(document.body).on("change",'[name="'.concat(this.gateway_id,'_saved_method_key"]'),(0,s.default)(this.maybeInitializeInstallments.bind(this),250)),(0,a.default)(document.body).on("wc_stripe_saved_method_".concat(this.gateway_id),(0,s.default)(this.maybeInitializeInstallments.bind(this),250)),(0,a.default)(document.body).on("change",'[name="billing_email"], [name="billing_phone"], [name="billing_first_name"], [name="billing_last_name"]',this.onFieldChange.bind(this)),(0,a.default)(document.body).on("change","#createaccount",this.onCreateAccountChange.bind(this)),(0,a.default)(document.body).on("change",'[name="'.concat(this.gateway_id,'_save_source_key"]'),this.onChangeSavePayment.bind(this)),this.createPaymentElement(),this.mountPaymentElement(),this.initializeSetupIntent(),this.onCreateAccountChange()}},{key:"disable_payment_button",value:function(){(0,a.default)("#place_order").prop("disabled",!0)}},{key:"enable_payment_button",value:function(){(0,a.default)("#place_order").prop("disabled",!1)}},{key:"createPaymentElement",value:function(){var e;this.elements&&!this.paymentElement&&(this.paymentElement=this.elements.create("payment",h({fields:{billingDetails:this.is_current_page("checkout")?{address:"never",name:(0,a.default)("#billing_first_name").length?"never":"auto",email:(0,a.default)("#billing_email").length?"never":"auto",phone:(0,a.default)("#billing_phone").length?"never":"auto"}:"auto"},wallets:h({applePay:"never",googlePay:"never"},(null===(e=this.params.elementOptions)||void 0===e?void 0:e.paymentMethodTypes)&&{link:this.params.elementOptions.paymentMethodTypes.includes("link")?"auto":"never"}),defaultValues:{billingDetails:{name:this.fields.get("billing_first_name")+" "+this.fields.get("billing_last_name"),email:this.fields.get("billing_email"),phone:this.fields.get("billing_phone")}}},this.params.paymentElementOptions)),this.paymentElement.on("change",this.onPaymentElementChange.bind(this)),this.paymentElement.on("loaderror",this.onPaymentElementLoadError.bind(this)))}},{key:"mountPaymentElement",value:function(){try{this.paymentElement&&(0,a.default)(this.elementSelector).length&&0===(0,a.default)(this.elementSelector).find("iframe").length&&(this.paymentElement.unmount(),this.paymentElement.mount(this.elementSelector))}catch(e){}}},{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:"shouldCreatePaymentMethod",value:function(){return(0,o.applyFilters)("wc_stripe_should_create_payment_method",["card","link"].includes(this.paymentMethodType),this)}},{key:"get_element_options",value:function(){var e=h(h({},(this.isPaymentMode()||this.isSubscriptionMode())&&{amount:100}),{},{currency:this.params.currency.toLowerCase()},this.params.elementOptions),t={};return this.has_gateway_data()&&(t.currency=this.get_currency().toLowerCase(),(this.isPaymentMode()||this.isSubscriptionMode())&&(t.amount=this.get_total_price_cents(),t.amount<=0&&(t.amount=100))),h(h({},e),t)}},{key:"updated_checkout",value:function(e,t){this.updatePaymentElement(t),this.mountPaymentElement(),this.handleInstallments(),this.initializeSetupIntent()}},{key:"onPaymentElementChange",value:function(e){var t=e.value,n=void 0===t?null:t,r=e.complete,i=void 0!==r&&r;this.paymentElementComplete=i,null!=n&&n.type&&(this.paymentMethodType=n.type,this.setPaymentMethodType(n.type)),this.handleInstallments(),this.onCreateAccountChange()}},{key:"isPaymentElementComplete",value:function(){return this.paymentElementComplete}},{key:"updatePaymentElement",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(t&&null!=t&&null!==(e=t.fragments)&&void 0!==e&&e[".wc-stripe-element-options"])try{var n=JSON.parse(window.atob(decodeURIComponent(t.fragments[".wc-stripe-element-options"])));this.params.elementOptions.mode!==n.mode&&(this.params.elementOptions=h(h({},this.params.elementOptions),n)),this.elements&&this.elements.update(this.get_element_options())}catch(e){}}},{key:"getHashParameterArgs",value:function(){var e=window.location.hash.match(/#response=(.+)/),t=null;return e&&(t=JSON.parse(window.atob(decodeURIComponent(e[1])))),t}},{key:"handleHashChange",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")&&this.is_gateway_selected()&&(history.pushState({},"",window.location.pathname),"payment_intent"===n.type?this.processPaymentIntent(n):this.processSetupIntent(n))}catch(e){}return!0}},{key:"handlePlaceOrder",value:function(e){var t=this;this.is_gateway_selected()&&(this.is_saved_method_selected()||(e.preventDefault(),this.disable_payment_button(),this.fields.syncCheckoutFieldsWithDOM(),this.elements.submit().then(function(){var e=f(c().m(function e(n){return c().w(function(e){for(;;)switch(e.n){case 0:if(!n.error){e.n=1;break}return e.a(2,t.submit_error(n.error));case 1:if(!t.isPaymentMode()&&!t.isSubscriptionMode()||!t.shouldCreatePaymentMethod()){e.n=3;break}if(t.validateCheckoutFields()){e.n=2;break}return e.a(2,t.submit_error(t.validationErrors));case 2:return e.a(2,t.stripe.createPaymentMethod({elements:t.elements,params:{billing_details:h({name:"",phone:"",email:""},t.get_billing_details())}}).then(function(e){if(e.error)return t.submit_error(e.error);t.is_current_page("order_pay")?(t.set_nonce(e.paymentMethod.id),t.process_order_pay()):t.on_token_received(e.paymentMethod)}).catch(function(e){return null!=e&&e.message&&e.message.indexOf("fields.billing_details")>-1?e.message.indexOf("fields.billing_details.phone")>-1?t.submit_error({code:"billing_details.phone.required"}):t.submit_error({code:"required_fields"}):t.submit_error(e)}));case 3:if(!t.isSetupMode()){e.n=6;break}if(!t.shouldCreatePaymentMethod()||t.validateCheckoutFields()){e.n=4;break}return e.a(2,t.submit_error(t.validationErrors));case 4:if(t.setupIntent||!t.shouldCreatePaymentMethod()){e.n=5;break}return e.n=5,t.initializeSetupIntent(!0,"place_order");case 5:if(!t.setupIntent||"succeeded"===t.setupIntent.status){e.n=6;break}return e.a(2,t.processSetupIntent({client_secret:t.setupIntent.client_secret,confirmParams:t.params.confirmParams}));case 6:if(!t.is_current_page("order_pay")){e.n=7;break}return e.a(2,t.process_order_pay());case 7:t.payment_token_received=!0,t.get_form().trigger("submit");case 8:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}()).catch(function(e){return t.enable_payment_button(),t.submit_error(e)}).finally(function(){t.enable_payment_button()})))}},{key:"on_token_received",value:function(e){this.payment_token_received=!0,this.set_nonce(e.id),this.setPaymentMethodType(e.type),this.get_form().trigger("submit")}},{key:"setPaymentMethodType",value:function(e){(0,a.default)("#_stripe_payment_method_type").val(e)}},{key:"handle_next_action",value:function(e){"payment_intent"===e.type?this.processPaymentIntent(e):this.processSetupIntent(e)}},{key:"processPaymentIntent",value:function(e){var t=this;this.stripe.confirmPayment(h(h({},!this.is_saved_method_selected()&&{elements:this.elements}),{},{clientSecret:e.client_secret,redirect:"if_required",confirmParams:h({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);return r+="&"+a.default.param({_stripe_local_payment:t.gateway_id,payment_intent:n.paymentIntent.id,payment_intent_client_secret:n.paymentIntent.client_secret}),"requires_action"===n.paymentIntent.status?t.get_form().unblock().removeClass("processing"):"requires_payment_method"===n.paymentIntent.status?(t.get_form().unblock().removeClass("processing"),t.submit_error({code:n.paymentIntent.last_payment_error.code})):void(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(h({elements:this.elements,clientSecret:t.client_secret,redirect:"if_required"},t&&{confirmParams:h(h({},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);if(e.setupIntent=t.setupIntent,"requires_action"===t.setupIntent.status)throw{code:"payment_cancelled"};var n,r;if("requires_payment_method"===t.setupIntent.status)throw{code:null===(n=t.setupIntent)||void 0===n||null===(n=n.last_setup_error)||void 0===n?void 0:n.code,message:null===(r=t.setupIntent)||void 0===r||null===(r=r.last_setup_error)||void 0===r?void 0:r.message};e.payment_token_received=!0,e.set_nonce(t.setupIntent.payment_method),e.set_intent(t.setupIntent.id),e.get_form().unblock().removeClass("processing"),e.get_form().trigger("submit")}).catch(function(t){return e.get_form().unblock().removeClass("processing"),null!=t&&t.message&&t.message.indexOf("fields.billing_details")>-1?t.message.indexOf("fields.billing_details.phone")>-1?e.submit_error({code:"billing_details.phone.required"}):e.submit_error({code:"required_fields"}):e.submit_error(t)})}},{key:"handleInstallments",value:function(){this.installmentsEnabled()&&(this.maybeShowInstallments(),this.paymentElementComplete&&this.isCardPaymentType()&&this.initializeInstallments())}},{key:"isCardPaymentType",value:function(){return"card"===this.paymentMethodType}},{key:"maybeShowInstallments",value:function(){this.is_saved_method_selected()?"stripe_cc"===this.savedPaymentTokenGatewayId?this.showInstallments():this.hideInstallments():this.isCardPaymentType()?this.showInstallments():this.hideInstallments()}},{key:"showInstallments",value:function(){(0,a.default)(this.container).find(".wc-stripe-installment-container").show()}},{key:"hideInstallments",value:function(){(0,a.default)(this.container).find(".wc-stripe-installment-container").hide()}},{key:"installmentsEnabled",value:function(){if(this.has_gateway_data()){var e,t=this.get_gateway_data();return!(null==t||null===(e=t.installments)||void 0===e||!e.enabled)}return!1}},{key:"maybeInitializeInstallments",value:function(){this.installmentsEnabled()&&this.is_saved_method_selected()&&(this.savedPaymentTokenGatewayId=(0,a.default)("".concat(this.saved_method_selector," option:selected")).data("gateway"),"stripe_cc"===this.savedPaymentTokenGatewayId&&this.initializeInstallments(this.get_selected_payment_method()),this.maybeShowInstallments())}},{key:"initializeInstallments",value:(l=f(c().m(function e(){var t,n,r,i=arguments;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(t=i.length>0&&void 0!==i[0]?i[0]:null)){e.n=6;break}return this.showInstallmentLoader(),e.p=1,e.n=2,this.fetchInstallmentPlans(t);case 2:e.n=4;break;case 3:e.p=3,r=e.v,console.log(r);case 4:return e.p=4,this.hideInstallmentLoader(),e.f(4);case 5:e.n=12;break;case 6:return e.p=6,e.n=7,this.elements.submit();case 7:return e.n=8,this.stripe.createPaymentMethod({elements:this.elements,params:{billing_details:this.get_billing_details()}});case 8:if((n=e.v).error){e.n=9;break}return e.n=9,this.initializeInstallments(n.paymentMethod.id);case 9:e.n=11;break;case 10:e.p=10,e.v,this.hideInstallmentLoader();case 11:return e.p=11,e.f(11);case 12:return e.a(2)}},e,this,[[6,10,11,12],[1,3,4,5]])})),function(){return l.apply(this,arguments)})},{key:"fetchPaymentIntent",value:function(e){var t=this;return new Promise(function(n,r){var i=t.params.routes.create_payment_intent,o=!1;t.is_current_page("order_pay")&&(i=t.params.routes.order_create_payment_intent,o=!0),a.default.ajax({url:i,method:"POST",dataType:"json",data:o?{payment_method_id:e,payment_method:"stripe_cc",order_id:t.get_gateway_data().order.id,order_key:t.get_gateway_data().order.key}:h(h({},t.serialize_fields()),{},{payment_method_id:e,payment_method:"stripe_cc",page_id:t.get_page()}),beforeSend:t.ajax_before_send.bind(t)}).done(function(e){e.code?r(e):n(e)}).fail(function(e){r()})})}},{key:"fetchInstallmentPlans",value:(i=f(c().m(function e(t){var n,r;return c().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,e.n=1,this.fetchPaymentIntent(t);case 1:(n=e.v).installments_html&&(0,a.default)(".wc-stripe-installment-container").replaceWith(n.installments_html),e.n=3;break;case 2:return e.p=2,r=e.v,e.a(2,this.submit_error(r));case 3:return e.a(2)}},e,this,[[0,2]])})),function(e){return i.apply(this,arguments)})},{key:"showInstallmentLoader",value:function(){(0,a.default)(".wc-stripe-installment-options").addClass("loading-installments"),(0,a.default)('[name="_stripe_installment_plan"] option:selected').eq(0).text(this.params.installments.loading),(0,a.default)(".wc-stripe-installment-loader").show()}},{key:"hideInstallmentLoader",value:function(){(0,a.default)(".wc-stripe-installment-options").removeClass("loading-installments"),(0,a.default)(".wc-stripe-installment-loader").hide()}},{key:"initializeSetupIntent",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isSetupMode()&&!this.setupIntent)return this.create_setup_intent({context:this.get_page()}).then(function(t){t.intent&&(e.setupIntent=t.intent)}).catch(function(e){if(t)throw e})}},{key:"show_payment_button",value:function(){this.show_place_order()}},{key:"hide_place_order",value:function(){}},{key:"onFieldChange",value:function(e){this.paymentElement&&this.paymentElement.update({defaultValues:{billingDetails:{name:(0,a.default)("#billing_first_name").val()+" "+(0,a.default)("#billing_last_name").val(),email:(0,a.default)("#billing_email").val(),phone:(0,a.default)("#billing_phone").val()}}})}},{key:"validateCheckoutFields",value:function(){return this.validationErrors=[],0===this.validationErrors.length&&(0,a.default)('[name="terms"]').length&&(0,a.default)('[name="terms"]').is(":visible")&&((0,a.default)('[name="terms"]').is(":checked")||this.validationErrors.push(this.params.messages.terms)),0===this.validationErrors.length}},{key:"validateAddressFields",value:function(){var e,t=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return u(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw a}}}}((0,a.default)("form.checkout .validate-required").filter(":visible"));try{for(t.s();!(e=t.n()).done;){var n=e.value,r=(0,a.default)(n).find("input.input-text");"terms"!==r.attr("name")&&("checkbox"===r.attr("type")?r.is(":checked")||this.validationErrors.push(this.getRequiredFieldError(r)):""===r.val()&&this.validationErrors.push(this.getRequiredFieldError(r)))}}catch(e){t.e(e)}finally{t.f()}}},{key:"getRequiredFieldError",value:function(e){var t=e.attr("name");if(t in wc_stripe_checkout_fields&&wc_stripe_checkout_fields[t].label){var n=wc_stripe_checkout_fields[t].label,r=t.match(/^(billing)|^(shipping)/);if(r&&r[0]){var i="".concat(r[0],"_label");n=wc_stripe_messages[i].replace("%s",n)}return wc_stripe_messages.required_field.replace("%s","<strong>".concat(n,"</strong>"))}}},{key:"onCreateAccountChange",value:function(){(0,a.default)("#createaccount").length&&((0,a.default)("#createaccount").is(":checked")&&["card","link","sepa","us_bank_account","ideal"].includes(this.paymentMethodType)?this.show_save_card():this.hide_save_card())}},{key:"onChangeSavePayment",value:function(e){var t=(0,a.default)(e.currentTarget),n=this.params.elementOptions.mode;n=t.is(":checked")?"subscription":"payment",this.elements&&n!==this.params.elementOptions.mode&&(this.params.elementOptions.mode=n,this.elements.update({mode:n}))}},{key:"process_order_pay",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this.is_gateway_selected()&&!this.is_saved_method_selected())return e&&e.preventDefault(),function(e,t,n){var r=w(k(e.prototype),"process_order_pay",n);return"function"==typeof r?function(e){return r.apply(n,e)}:r}(t,0,this)([e])}},{key:"onPaymentElementLoadError",value:function(e){var t=e.error,n=void 0===t?null:t;n&&console.log("".concat(this.gateway_id," could not load: Reason: "),n.message)}}],r&&_(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,i,l}(P);t.default=I},327(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r={CheckoutGateway:!0,LocalCheckoutGateway:!0};Object.defineProperty(t,"CheckoutGateway",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"LocalCheckoutGateway",{enumerable:!0,get:function(){return a.default}});var i=s(n(780)),a=s(n(330)),o=n(914);function s(e){return e&&e.__esModule?e:{default:e}}Object.keys(o).forEach(function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))})},330(e,t,n){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)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=a(n(428));function a(e){return e&&e.__esModule?e:{default:e}}function o(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function a(n,r,i,a){var o=r&&r.prototype instanceof u?r:u,c=Object.create(o.prototype);return s(c,"_invoke",function(n,r,i){var a,o,s,u=0,c=i||[],d=!1,p={p:0,n:0,v:e,a:f,f:f.bind(e,4),d:function(t,n){return a=t,o=0,s=e,p.n=n,l}};function f(n,r){for(o=n,s=r,t=0;!d&&u&&!i&&t<c.length;t++){var i,a=c[t],f=p.p,m=a[2];n>3?(i=m===r)&&(s=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=f&&((i=n<2&&f<a[1])?(o=0,p.v=r,p.n=a[1]):f<m&&(i=n<3||a[0]>r||r>m)&&(a[4]=n,a[5]=r,p.n=m,o=0))}if(i||n>1)return l;throw d=!0,r}return function(i,c,m){if(u>1)throw TypeError("Generator is already running");for(d&&1===c&&f(c,m),o=c,s=m;(t=o<2?e:s)||!d;){a||(o?o<3?(o>1&&(p.n=-1),f(o,s)):p.n=s:p.v=s);try{if(u=2,a){if(o||(i="next"),t=a[i]){if(!(t=t.call(a,s)))throw TypeError("iterator result is not an object");if(!t.done)return t;s=t.value,o<2&&(o=0)}else 1===o&&(t=a.return)&&t.call(a),o<2&&(s=TypeError("The iterator does not provide a '"+i+"' method"),o=1);a=e}else if((t=(d=p.n<0)?s:n.call(r,p))!==l)break}catch(t){a=e,o=1,s=t}finally{u=1}}return{value:t,done:d}}}(n,i,a),!0),c}var l={};function u(){}function c(){}function d(){}t=Object.getPrototypeOf;var p=[][r]?t(t([][r]())):(s(t={},r,function(){return this}),t),f=d.prototype=u.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,s(e,i,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=d,s(f,"constructor",d),s(d,"constructor",c),c.displayName="GeneratorFunction",s(d,i,"GeneratorFunction"),s(f),s(f,i,"Generator"),s(f,r,function(){return this}),s(f,"toString",function(){return"[object Generator]"}),(o=function(){return{w:a,m}})()}function s(e,t,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}s=function(e,t,n,r){function a(t,n){s(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:(a("next",0),a("throw",1),a("return",2))},s(e,t,n,r)}function l(e,t,n,r,i,a,o){try{var s=e[a](o),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(r,i)}function u(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,c(r.key),r)}}function c(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 d(e,t,n){return t=h(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,p()?Reflect.construct(t,n||[],h(e).constructor):t.apply(e,n))}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}function f(e,t,n,r){var i=m(h(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof i?function(e){return i.apply(n,e)}:i}function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=h(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}},m.apply(null,arguments)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function y(e,t){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},y(e,t)}var _=function(e){function t(){var e;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(e=d(this,t,[].concat(r))).maybeHideGateway(),e.processRedirectParams(),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&&y(e,t)}(t,e),n=t,r=[{key:"create_stripe_elements",value:function(){if(!this.elements){if(!this.isActive())return null;this.elements=f(t,"create_stripe_elements",this,3)([])}return this.elements}},{key:"maybeHideGateway",value:function(){this.isActive()?(0,i.default)(this.container).show():((0,i.default)(this.container).hide(),this.is_gateway_selected()&&(0,i.default)('li[class*="payment_method_stripe_"]').filter(":visible").eq(0).find('[name="payment_method"]').prop("checked",!0).trigger("click"))}},{key:"isActive",value:function(){return(0,i.default)("#wc_stripe_local_payment_"+this.gateway_id).data("active")}},{key:"updated_checkout",value:function(e,n){this.create_stripe_elements(),this.createPaymentElement(),f(t,"updated_checkout",this,3)([e,n]),this.maybeHideGateway()}},{key:"onPaymentElementLoadError",value:function(e){var t=e.error;(0,i.default)(this.elementSelector).append(t.message),this.paymentElement=null}},{key:"processRedirectParams",value:(a=o().m(function e(){var t,n,r,i,a,s;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!(t=this.getHashParameterArgs())){e.n=5;break}if(n=t.client_secret,r=t.gateway_id,e.p=1,this.gateway_id!==r&&!this.is_gateway_selected()){e.n=3;break}return e.n=2,this.stripe.retrievePaymentIntent(n);case 2:(i=e.v).paymentIntent&&"requires_action"===i.paymentIntent.status&&"redirect_to_url"===(null===(a=i.paymentIntent.next_action)||void 0===a?void 0:a.type)&&(window.location=i.paymentIntent.next_action.redirect_to_url.url);case 3:e.n=5;break;case 4:e.p=4,s=e.v,console.log(s);case 5:return e.a(2)}},e,this,[[1,4]])}),s=function(){var e=this,t=arguments;return new Promise(function(n,r){var i=a.apply(e,t);function o(e){l(i,n,r,o,s,"next",e)}function s(e){l(i,n,r,o,s,"throw",e)}o(void 0)})},function(){return s.apply(this,arguments)})},{key:"initializeSetupIntent",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.is_current_page("add_payment_method"))return f(t,"initializeSetupIntent",this,3)([e])}}],r&&u(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r,a,s}(a(n(780)).default);t.default=_},914(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.registerPaymentMethod=t.getPaymentMethods=t.getPaymentMethod=void 0;var n={};t.registerPaymentMethod=function(e){n[e.gateway_id]=e},t.getPaymentMethods=function(){return n},t.getPaymentMethod=function(e){return n[e]?n[e]:null}},428(e){e.exports=window.jQuery},705(e){e.exports=window.wc_stripe},619(e){e.exports=window.wp.hooks}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.m=t,e=[],r.O=(t,n,i,a)=>{if(!n){var o=1/0;for(c=0;c<e.length;c++){for(var[n,i,a]=e[c],s=!0,l=0;l<n.length;l++)(!1&a||o>=a)&&Object.keys(r.O).every(e=>r.O[e](n[l]))?n.splice(l--,1):(s=!1,a<o&&(o=a));if(s){e.splice(c--,1);var u=i();void 0!==u&&(t=u)}}return t}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[n,i,a]},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={682:0};r.O.j=t=>0===e[t];var t=(t,n)=>{var i,a,[o,s,l]=n,u=0;if(o.some(t=>0!==e[t])){for(i in s)r.o(s,i)&&(r.m[i]=s[i]);if(l)var c=l(r)}for(t&&t(n);u<o.length;u++)a=o[u],r.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return r.O(c)},n=self.webpackChunkwcStripeModules=self.webpackChunkwcStripeModules||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var i=r.O(void 0,[96],()=>r(327));i=r.O(i),(this.wcStripeModules=this.wcStripeModules||{}).checkoutModules=i})();