Notice: Function is_post_type_archive was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_tax was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_post_type_archive was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_tax was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_post_type_archive was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_tax was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_post_type_archive was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_tax was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_post_type_archive was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Notice: Function is_tax was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php on line 6131

Warning: Cannot modify header information - headers already sent by (output started at /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php:6131) in /home/u550658761/domains/x-stem.com.br/public_html/wp-content/mu-plugins/eos-deactivate-plugins.php on line 2940

Warning: Cannot modify header information - headers already sent by (output started at /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php:6131) in /home/u550658761/domains/x-stem.com.br/public_html/wp-content/plugins/jetpack-boost/app/lib/minify/functions-service.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php:6131) in /home/u550658761/domains/x-stem.com.br/public_html/wp-content/plugins/jetpack-boost/app/lib/minify/functions-service.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php:6131) in /home/u550658761/domains/x-stem.com.br/public_html/wp-content/plugins/jetpack-boost/app/lib/minify/functions-service.php on line 32

Warning: Cannot modify header information - headers already sent by (output started at /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php:6131) in /home/u550658761/domains/x-stem.com.br/public_html/wp-content/plugins/jetpack-boost/app/lib/minify/functions-service.php on line 33

Warning: Cannot modify header information - headers already sent by (output started at /home/u550658761/domains/x-stem.com.br/public_html/wp-includes/functions.php:6131) in /home/u550658761/domains/x-stem.com.br/public_html/wp-content/plugins/jetpack-boost/app/lib/minify/functions-service.php on line 34
(()=>{"use strict";var e={n:i=>{var t=i&&i.__esModule?()=>i.default:()=>i;return e.d(t,{a:t}),t},d:(i,t)=>{for(var s in t)e.o(t,s)&&!e.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:t[s]})},o:(e,i)=>Object.prototype.hasOwnProperty.call(e,i),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},i={};e.r(i),e.d(i,{default:()=>d});const t=window.jQuery;var s=e.n(t);const l=window.wcStripe.utils,n=window.lodash,d=class{constructor(e,i){this.context=e,this.controller=i}populate(e,i={}){(this.context.isCheckout()||this.context.isExpressCheckout())&&this.syncDOMToMap(i),e?.billing&&!i?.skipBilling&&this.populateBilling(e.billing,i),e?.shipping&&!i.skipShipping&&i.needsShipping&&this.populateShipping(e.shipping,i)}syncDOMToMap(e={}){["first_name","last_name","company","address_1","address_2","city","state","postcode","country","email","phone"].forEach(e=>{const i=s()(`[name="billing_${e}"]`);i.length&&(0,l.setFieldValue)(e,i.val(),"billing")}),e.needsShipping&&["first_name","last_name","company","address_1","address_2","city","state","postcode","country","phone"].forEach(e=>{const i=s()(`[name="shipping_${e}"]`);i.length&&(0,l.setFieldValue)(e,i.val(),"shipping")})}populateBilling(e,i){const{email:t,phone:d,...a}=e;(0,n.isEmpty)(a)||(this.context.isCheckout()||this.context.isExpressCheckout()?(0,n.isEqual)(this.getCartFullAddress("billing"),a)||(this.controller._updateRequired=!0,this.populateAddressFields(a,"billing"),s()(document.body).one("updated_checkout",()=>{this.populateAddressFields(a,"billing")})):this.populateAddressFields(a,"billing")),t&&(this.context.isCheckout()&&(0,l.isFieldValid)("billing_email")||(0,l.setFieldValue)("billing_email",t)),d&&((0,l.setFieldValue)("billing_phone",d),i.needsShipping&&(0,l.setFieldValue)("shipping_phone",d))}populateShipping(e,i){const{phone:t,...d}=e;if(!(0,n.isEmpty)(d))if(this.context.isCheckout()||this.context.isExpressCheckout()){const e=this.getCartFullAddress("shipping");(0,n.isEqual)(e,d)||(this.controller._updateRequired=!0,this.populateAddressFields(d,"shipping"),s()(document.body).one("updated_checkout",()=>{this.populateAddressFields(d,"shipping")})),(0,n.isEmpty)(this.getCartFullAddress("billing").address_1)&&(d.first_name&&d.last_name&&!(0,l.isFieldValid)("billing_first_name")&&!(0,l.isFieldValid)("billing_last_name")&&((0,l.setFieldValue)("first_name",d.first_name,"billing"),(0,l.setFieldValue)("last_name",d.last_name,"billing")),this.populateAddressFields(d,"billing"))}else this.populateAddressFields(d,"shipping");t&&(0,l.setFieldValue)("shipping_phone",t),(this.context.isCheckout()||this.context.isExpressCheckout())&&this.maybeShipToDifferentAddress()}maybeShipToDifferentAddress(){if(s()('[name="ship_to_different_address"]')?.length){const e=this.getCartFullAddress("billing"),i=this.getCartFullAddress("shipping"),t=!(0,n.isEqual)(e,i);s()('[name="ship_to_different_address"]').prop("checked",t).trigger("change")}}populateAddressFields(e,i){for(let t in e)(0,l.setFieldValue)(t,e[t],i)}getCartFullAddress(e){return{first_name:(0,l.getFieldValue)("first_name",e),last_name:(0,l.getFieldValue)("last_name",e),address_1:(0,l.getFieldValue)("address_1",e),address_2:(0,l.getFieldValue)("address_2",e),state:(0,l.getFieldValue)("state",e),city:(0,l.getFieldValue)("city",e),postcode:(0,l.getFieldValue)("postcode",e),country:(0,l.getFieldValue)("country",e)}}};(this.wcStripe=this.wcStripe||{}).checkoutFields=i})(); (()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)},e={};t.d(e,{default:()=>d});const r=window.wcStripe.utils,a=window.wp.apiFetch;var i=t.n(a);const n=window.wcStripe.actions;var s=t.n(n);const d=new class{constructor(t){this.data=t,this.actions=s()}async processPayment(t,e={}){return i()({method:"POST",url:(0,r.getRestRoute)("order/pay"),data:{payment_method:t,order_id:this.getId(),order_key:this.getOrderKey(),...e}}).then(t=>t)}needsShipping(){return this.actions.applyFilters("order_needs_shipping",!1,this)}getCurrency(){return this.data.currency}getTotal(){return this.data.total||0}getTotalCents(){return parseInt(this.data.totalCents||0)}needsPayment(){return this.actions.applyFilters("order_needs_payment",this.data?.needsPayment,this)}getLineItems(){return this.data.lineItems||[]}getId(){return this.data.order_id}getOrderKey(){return this.data.order_key}getBillingName(){return this.data.billing_address.name}getBillingEmail(){return this.data.billing_address.email}getBillingPhone(){return this.data.billing_address.phone}getBillingAddress(){return this.data.billing_address}}((0,r.getSetting)("order"));(this.wcStripe=this.wcStripe||{}).order=e.default})(); (()=>{"use strict";var t={n:i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return t.d(a,{a}),a},d:(i,a)=>{for(var e in a)t.o(a,e)&&!t.o(i,e)&&Object.defineProperty(i,e,{enumerable:!0,get:a[e]})},o:(t,i)=>Object.prototype.hasOwnProperty.call(t,i)},i={};t.d(i,{default:()=>o});const a=window.jQuery;var e=t.n(a);const s=window.wcStripe.utils,n=window.wcStripe.actions;var r=t.n(n);const o=new class{variation=null;_excludedKeys=["add-to-cart","quantity","variation_id"];constructor(t={}){this.actions=r(),this.data=this.default_data=t||{},this.data.variation_id&&this.data.attributes&&(this.variation={variation_id:this.data.variation_id,attributes:this.data.attributes}),0!==Object.keys(this.data).length&&(e()(document.body).on("change",'[name="quantity"]',this.onQuantityChange.bind(this)),e()("form.cart").on("found_variation",this.foundVariation.bind(this)).on("reset_data",this.resetVariationData.bind(this)),this.actions.addFilter("cart_calculation_data",this.addCartCalculationData.bind(this)),this.actions.addAction("after_cart_calculation",this.onAfterCartCalculation.bind(this)),this.actions.addAction("single_product_variation_changed",this.onBlockVariationChanged.bind(this)),this.actions.addAction("single_product_variation_reset",this.resetVariationData.bind(this)))}needsShipping(){return this.actions.applyFilters("product_needs_shipping",this.data?.needsShipping)}needsCartCalculation(){let t=!0;return this.isInStock()?this.isVariableProduct()&&!this.isVariationSelected()?t=!1:this._prevData&&(t=this.data.qty!==this._prevData.qty||this.data.variation_id!==this._prevData.variation_id||this.data.attributesHash!==this._prevData.attributesHash):t=!1,this.actions.applyFilters("product_needs_cart_calculation",t,this)}getLineItems(){return this.data.lineItems||[]}getLineItem(){var t;const i=this.isVariationSelected()?parseInt(this.getVariationId()):this.getId();return null!==(t=this.getLineItems().find(t=>t.id===i))&&void 0!==t?t:null}update(t={},i=!1){Object.keys(t).some(i=>t[i]!==this.data[i])&&(this._prevData={...this.data},this.data={...this.data,...t},i||this.actions.doAction("product_updated",this,this._prevData))}onQuantityChange(t){const i=this.getQuantity();this.update({qty:i,total:this.getPrice()*i})}foundVariation(t,i){this.variation={...i};const a=this.getVariationData(),e=Object.keys(a).sort().map(t=>`${t}:${a[t]}`).join("|");this.update({price:i.display_price,priceCents:(0,s.toCents)(i.display_price),total:i.display_price*this.getQuantity(),isInStock:i.is_in_stock,variation_id:i.variation_id,needsShipping:!i.is_virtual,attributesHash:e}),this.actions.doAction("found_variation",this.needsCartCalculation(),this,this._prevData)}onBlockVariationChanged(t,i){var a,e,n;if(!i)return;const{price:r,currency_minor_unit:o}=null!==(a=i.prices)&&void 0!==a?a:{},d=r?parseInt(r,10)/Math.pow(10,null!=o?o:2):0;this.variation={variation_id:t,attributes:i.attributes},this.update({price:d,priceCents:(0,s.toCents)(d),total:d*this.getQuantity(),isInStock:null===(e=null!==(n=i.is_in_stock)&&void 0!==n?n:i.is_purchasable)||void 0===e||e,variation_id:t}),this.actions.doAction("found_variation",this.needsCartCalculation(),this,this._prevData)}resetVariationData(){this.variation=null,this.isVariableProduct()&&(this.update({variation_id:null,price:this.default_data.price,priceCents:(0,s.toCents)(this.default_data.price),total:this.default_data.total,isInStock:this.default_data.isInStock,needsShipping:this.default_data.needsShipping,attributesHash:""}),this.actions.doAction("reset_variation",this))}onAfterCartCalculation(t){const i=t.getLineItems().filter(t=>"product"===t.type);i.length>0&&this.update({lineItems:i})}addCartCalculationData(t){return{...t,product_id:this.getId(),variation_id:this.isVariableProduct()?this.getVariationId():0,qty:this.getQuantity(),...this.getVariationData(),...(0,s.convertFormToFields)(e()("form.cart"),this._excludedKeys)}}isInStock(){return!!this.data.isInStock}getQuantity(){return parseInt(e()('[name="quantity"]').val())||0}getPrice(){return this.actions.applyFilters("product_price",parseFloat(this.data?.price||0),this)}getPriceCents(){var t;return this.actions.applyFilters("product_price_cents",null!==(t=this.data?.priceCents)&&void 0!==t?t:(0,s.toCents)(this.getPrice()),this)}getTotal(){var t;const i=null!==(t=this.data.total)&&void 0!==t?t:parseFloat(this.getPrice()*this.getQuantity());return this.actions.applyFilters("product_total",parseFloat(i),this)}getTotalCents(){return this.actions.applyFilters("product_total_cents",(0,s.toCents)(this.getTotal()),this)}isVariableProduct(){return this.data.type?.indexOf("variable")>-1}isVariationSelected(){if(this.variation?.variation_id)return!0;const t=e()('input[name="variation_id"]').val();return!!t&&"0"!==t}getVariationData(){if(this.isVariableProduct()){const t=this.variation?{...this.variation.attributes}:{},i=document.querySelectorAll('.variations [name^="attribute_"]');return i&&i.forEach(i=>{i.name in t&&""!==t[i.name]||(t[i.name]=i.value||"")}),t}return{}}getId(){return parseInt(this.data?.id)}getVariationId(){return this.variation?this.variation.variation_id:e()('[name="variation_id"]').val()}}((0,s.getSetting)("product"));(this.wcStripe=this.wcStripe||{}).product=i.default})(); (()=>{"use strict";var e,r={16(e,r,t){t.r(r),t.d(r,{loadStripeSDK:()=>c});var o=t(37);const i=window.wcStripe.utils;let n=null,l=null,a=null;const s=e=>new Promise(r=>setTimeout(r,e)),c=async()=>{const e=(0,i.getSetting)("publicKey"),r=(0,i.getSetting)("sdkParams"),t=l!==e||JSON.stringify(a)!==JSON.stringify(r);return n&&!t||(l=e,a=r,n=(async(e,r)=>{let t;for(let i=1;i<=3;i++)try{const t=await(0,o.c)(e,r);if(!t)throw new Error("Stripe.js failed to load.");return t}catch(e){t=e,i<3&&await s(500)}throw t})(e,r).catch(e=>{throw n=null,e})),n}}},t={};function o(e){var i=t[e];if(void 0!==i)return i.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(r,t,i,n)=>{if(!t){var l=1/0;for(u=0;u=n)&&Object.keys(o.O).every(e=>o.O[e](t[s]))?t.splice(s--,1):(a=!1,n0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[t,i,n]},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={224:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var i,n,[l,a,s]=t,c=0;if(l.some(r=>0!==e[r])){for(i in a)o.o(a,i)&&(o.m[i]=a[i]);if(s)var u=s(o)}for(r&&r(t);co(16));i=o.O(i),(this.wcStripe=this.wcStripe||{}).stripeSDK=i})(); (()=>{"use strict";var t={574(t,e,i){i.d(e,{convertFormToFields:()=>n}),i(428),new Map;const n=(t,e=[])=>t.serializeArray().reduce((t,i)=>{if(e.includes(i.name))return t;const n=[];i.name.replace(/([^\[\]]*)/g,(t,e)=>{""!==e&&n.push(e)});const a=i.name.endsWith("[]");return n.reduce((t,e,s)=>{var o,r;return s===n.length-1?a?(t[e]=null!==(o=t[e])&&void 0!==o?o:[],t[e].push(i.value)):t[e]=i.value:t[e]=null!==(r=t[e])&&void 0!==r?r:{},t[e]},t),t},{})},428(t){t.exports=window.jQuery}},e={};function i(n){var a=e[n];if(void 0!==a)return a.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};i.r(n),i.d(n,{AddPaymentMethodController:()=>$,BaseController:()=>_,CartController:()=>v,CheckoutController:()=>M,CheckoutSessionController:()=>A,ExpressCheckoutController:()=>I,MiniCartController:()=>S,ProductController:()=>C});var a=i(428),s=i.n(a);const o=window.wp.apiFetch;var r=i.n(o);const d=window.wcStripe.actions;var h=i.n(d);const c=window.wcStripe.cart;var l=i.n(c);const m=window.wcStripe.stripeSDK,u=window.wcStripe.checkoutFields;var y=i.n(u);const p=window.wcStripe.utils;class g{stripe;promises=[];_isPaymentMethodAvailable=!0;static attributionDataStored=!1;constructor({context:t,gateway:e,selector:i=null}){this.cart=l(),this.gateway=e,this.context=t,this.selector=i,this.actions=h(),this.fields=new(y())(t,this),this.gateway.setController(this),this.initActions(),this.gateway.initialize()}initActions(){}initialize(){this.loadStripeSDK().then(async()=>{await this.createPaymentElement()}).catch(t=>{console.log(t)})}async loadStripeSDK(){try{const t=await(0,m.loadStripeSDK)();this.stripe=t,this.actions.doAction("stripe_sdk_loaded",t,this)}catch(t){throw console.log(`Error loading Stripe SDK. ${t}`),t}}async createPaymentElement(){if(!this.isPaymentMethodAvailable())return this._isPaymentMethodAvailable=!1,void this.onPaymentUnavailable();this.gateway.onPaymentMethodAvailable();let t=!1;try{t=await this.gateway.canMakePayment()}catch(e){t=!1,console.error("Payment method availability check failed:",e)}if(!t)return this._isPaymentMethodAvailable=!1,void this.onPaymentUnavailable();this._isPaymentMethodAvailable=!0;const e=this.getElementContainer();if(e)if(this.gateway.shouldMountElement(e)){if(e instanceof NodeList)for(let t=0;tt).catch(t=>{throw t})}submitError(t){this.displayErrorMessage(t,"div.woocommerce-notices-wrapper")}displayErrorMessage(t,e=""){let i;if(t=(0,p.getErrorMessage)(t),i=(e=this.actions.applyFilters("get_error_message_selector",e,this,this.gateway.id))?s()(e).first():s()(this.selector).closest("form").first(),i.length){s()(".woocommerce-NoticeGroup-checkout, .woocommerce-error, .woocommerce-message, .is-error, .is-success").remove();const e=Array.isArray(t)?t.map(t=>`
  • ${t}
  • `).join(""):`
  • ${t}
  • `;i.prepend(`
    \n \n
    `),s().scroll_to_notices?.(i)}}getShippingPrefix(){return"shipping"}onClick(){this.storeAttributionValues()}async validate(){return!0}async submit(t=null){t&&this.populateCheckoutFields(t),this.showProcessing();try{const t=await r()({method:"POST",url:(0,p.getRestRoute)("cart/checkout"),data:this.getCartCheckoutData()});if(t.result&&"success"===t.result){const e=(0,p.isNextActionRequired)(t.redirect);if(e){const t=await this.handleIntentConfirmation(e);window.location.href=this.getPostAuthenticationRedirectUrl(e,t)}else window.location=t.redirect}else t.messages&&this.submitError(t.messages)}catch(t){this.submitError(t)}finally{this.hideProcessing()}}async handleIntentConfirmation(t,e={}){if("checkout_session"===t.type)return await this.gateway.confirmCheckoutSession(t);const i={skipElements:"requires_payment_method"!==t.status,...e};let n;if("payment_intent"===t.type?n=await this.gateway.confirmPayment(t,i):"setup_intent"===t.type&&(n=await this.gateway.confirmSetup(t,i)),n.error)throw n.error;if("payment_intent"===t.type){const t=n.paymentIntent?.status;if("requires_action"===t&&this.gateway.isPaymentCancelled(n))throw{code:"payment_cancelled"};if("requires_payment_method"===t)throw{code:n.paymentIntent?.last_payment_error?.code,message:n.paymentIntent?.last_payment_error?.message}}else if("setup_intent"===t.type){const t=n.setupIntent?.status;if("requires_action"===t)throw{code:"payment_cancelled"};if("requires_payment_method"===t)throw{code:n.setupIntent?.last_setup_error?.code,message:n.setupIntent?.last_setup_error?.message}}return n}getPostAuthenticationRedirectUrl(t,e){if("payment_intent"===t.type){const t=e.paymentIntent?.next_action;if("requires_action"===e.paymentIntent?.status&&"redirect_to_url"===t?.type&&t.redirect_to_url?.url)return t.redirect_to_url.url}const i=new URL(decodeURI(t.return_url));return"payment_intent"===t.type?(i.searchParams.set("payment_intent",e.paymentIntent.id),i.searchParams.set("payment_intent_client_secret",e.paymentIntent.client_secret)):(i.searchParams.set("setup_intent",e.setupIntent.id),i.searchParams.set("setup_intent_client_secret",e.setupIntent.client_secret)),i.toString()}getCartCheckoutData(){return{payment_method:this.gateway.id,context:this.context.getPage(),...(0,p.fieldsToJson)()}}getProcessingSelector(){return"body"}showProcessing(){s()(this.getProcessingSelector())?.block({message:null,overlayCSS:{background:"#fff",opacity:.6}})}hideProcessing(){s()(this.getProcessingSelector())?.unblock()}getProcessingMessage(){return'
    \n
    \n
    \n
    \n
    '}isOrderAttributionEnabled(){return"undefined"!=typeof wc_order_attribution&&null!==document.querySelector("wc-order-attribution-inputs")}storeAttributionValues(){if(g.attributionDataStored)return;if(this.context.isCheckout()||!this.isOrderAttributionEnabled())return;const t=wc_order_attribution.params.prefix;s()('input[type="hidden"][name^="'+t+'"]').each((t,e)=>{const i=s()(e),n=i.attr("name");(0,p.setFieldValue)(n,i.val())}),g.attributionDataStored=!0}getLineItems(){return this.cart.getLineItems()}getShippingOptions(){return this.cart.getShippingOptions()}getSelectedShippingMethod(){return this.cart.getSelectedShippingMethod()}getCurrency(){return this.cart.getCurrency()}getTotal(t="string"){return this.cart.getTotal()}getTotalCents(){return this.cart.getTotalCents()}getSubtotalCents(){return this.cart.getSubtotalCents()}needsPayment(){return this.cart.needsPayment()}populateCheckoutFields(t,e={}){e=this.actions.applyFilters("field_population_options",{skipShipping:!1,needsShipping:this.needsShipping(),...e},this),this.fields.populate(t,e),this.actions.doAction("after_populate_checkout_fields",this)}onPaymentRequiresAction(t){}}const _=g,w=window.wcStripe.product;var P=i.n(w),b=i(574);const C=class extends _{_cartItemKey;_excludedKeys=["add-to-cart","quantity","variation_id"];constructor(t){super(t),this.product=P()}initialize(){this.actions.addAction("product_updated",this.onProductUpdated.bind(this)),this.actions.addAction("cart_updated",this.onCartUpdated.bind(this)),this.actions.addAction("before_cart_calculation",this.onBeforeCartCalculation.bind(this)),this.actions.addAction("after_cart_calculation",this.onAfterCartCalculation.bind(this)),this.actions.addAction("removed_from_cart",this.onRemovedFromCart.bind(this),20),this.actions.addAction("before_remove_cart_item",this.onBeforeRemoveCartItem.bind(this)),this.actions.addAction("after_remove_cart_item",this.onAfterRemoveCartItem.bind(this)),this.actions.addFilter("cart_calculation_enabled",this.onCartCalculationEnabled.bind(this)),super.initialize()}onCartCalculationEnabled(t){return t||this._isPaymentMethodAvailable}onPaymentElementReady(){super.onPaymentElementReady(),this.product.isVariableProduct()&&(!this.product.isVariationSelected()||!this.product.isInStock()||this.product.getTotalCents()<=0?this.disablePaymentElement(!0):this.enablePaymentElement()),s()(`li.payment_method_${this.gateway.id}`).show(),s()(".wc-stripe-product-checkout-container").addClass("active")}onPaymentUnavailable(){super.onPaymentUnavailable(),s()(`li.payment_method_${this.gateway.id}`).hide()}needsShipping(){return this.cart.isEmpty()||!this.cart.needsShipping()?this.product.needsShipping():this.cart.needsShipping()}getElementContainer(){let t=document.querySelector(this.selector);if(!t){const e=this.gateway.id,i=e.replace(/_/g,"-"),n=[`#wc-${e}-product-button`,`#wc-${i}-product-button`,`#wc-${e}-product`,`#wc-${e}-container`,`#wc-${i}-container`];for(const e of n)if(t=document.querySelector(e),t)return t}return super.getElementContainer()}submitError(t){this.hideProcessing(),this.displayErrorMessage(t,"div.woocommerce-notices-wrapper")}onClick(){super.onClick(),this.promises.push(this.addToCart())}addToCart(){return this.cart.addToCart({payment_method:this.gateway.id,product_id:this.product.getId(),variation_id:this.product.getVariationId(),qty:this.product.getQuantity(),variation:this.product.getVariationData(),...this.actions.applyFilters("add_to_cart_data",(0,b.convertFormToFields)(s()("form.cart"),this._excludedKeys),this)}).then(t=>{if(!t.code)return this._cartItemKey=t.cart_item_key,t.order_id;this.currentError=t}).catch(async t=>(this.currentError=t,this.gateway.supports("payment_sheet")&&(this.gateway.closePaymentSheet(),await this.createPaymentElement()),this.submitError(t.message)))}async removeCartItem(){this._cartItemKey&&await this.cart.removeCartItem(this._cartItemKey)}async onProductUpdated(t,e){this._destroyPaymentElement||(this._destroyPaymentElement=t.needsShipping()!==e?.needsShipping),!t.isInStock()||t.getTotalCents()<=0?this.disablePaymentElement(!0):!t.isVariableProduct()||t.isVariationSelected()?t.needsCartCalculation()||(this._destroyPaymentElement?(await this.destroyPaymentElement(),this._destroyPaymentElement=null,await this.createPaymentElement()):this._doingCartCalculation||(this.gateway.updateElements(),this.enablePaymentElement())):this.disablePaymentElement(!0)}onBeforeCartCalculation(){this._doingCartCalculation=!0,this.needsShipping()||this.disablePaymentElement(!0)}async onAfterCartCalculation(){this._doingCartCalculation=!1,this.enablePaymentElement(!0),this.product.isVariableProduct()&&this._destroyPaymentElement&&(await this.destroyPaymentElement(),this._destroyPaymentElement=null),await this.createPaymentElement()}onBeforeRemoveCartItem(){this.disablePaymentElement(!0)}onAfterRemoveCartItem(){this.enablePaymentElement(!0)}async onRemovedFromCart(){await this.destroyPaymentElement(),await this.createPaymentElement()}onCartUpdated(){this.gateway.supports("elements")&&this.gateway.updateElements()}onCancel(){s()(".single_add_to_cart_button").prop("disabled",!0),this.removeCartItem().finally(()=>{s()(".single_add_to_cart_button").prop("disabled",!1),super.onCancel()})}getTotal(){return this.cart.isEmpty()?this.product.getTotal():super.getTotal()}getTotalCents(){return this.cart.isEmpty()?this.product.getTotalCents():super.getTotalCents()}getLineItems(){return this.cart.isEmpty()?this.product.getLineItems():super.getLineItems()}},v=class extends _{initActions(){super.initActions(),this.actions.addAction("cart_updated",this.onCartUpdated.bind(this),20),this.actions.addAction("shipping_method_changed",this.onShippingSelected.bind(this))}async onCartUpdated(t){try{if(this.gateway.isPaymentSheetOpen())return;t.hasChanged("needsShipping")&&this.gateway.destroyPaymentElement(),await this.loadStripeSDK(),await this.createPaymentElement()}catch(t){console.error("Error reloading payment elements:",t)}}onPaymentElementReady(){super.onPaymentElementReady(),s()(`li.payment_method_${this.gateway.id}`).show(),s()(".wc_stripe_cart_payment_methods").addClass("active")}onPaymentUnavailable(){super.onPaymentUnavailable(),s()(`li.payment_method_${this.gateway.id}`).hide()}onShippingSelected(){this.storeAttributionValues()}getElementContainer(){let t=document.querySelector(this.selector);if(!t){const e=this.gateway.id,i=e.replace(/_/g,"-"),n=[`#wc-${e}-cart-button`,`#wc-${i}-cart-button`,`#wc-${i}-container`];for(const e of n)if(t=document.querySelector(e),t)return this.selector=e,super.getElementContainer()}return super.getElementContainer()}},S=class extends _{initialize(){super.initialize(),this.actions.addAction("mini_cart_ready",()=>{super.initialize()}),this.actions.addAction("cart_updated",this.onCartUpdated.bind(this))}onCartUpdated(t){if(!this.cart.isEmpty()){if(this.gateway.isPaymentSheetOpen())return;t.hasChanged("needsShipping")&&this.gateway.destroyPaymentElement(),super.initialize()}}onPaymentElementReady(){s()(this.selector).show(),super.onPaymentElementReady()}getElementContainer(){let t=document.querySelector(this.selector);const e=this.gateway.id,i=[`.wc-${e.replace(/_/g,"-")}-mini-cart`,`.wc-${e}-mini-cart`,`.wc-${e}-minicart`];if(!t){for(const e of i)if(t=document.querySelector(e),t)return this.selector=e,super.getElementContainer();t||s()(".woocommerce-mini-cart__buttons").prepend(``)}return super.getElementContainer()}},f=window.wcStripe.order;var E=i.n(f);const k=class extends _{async createPaymentMethod(){try{this.disablePlaceOrderButton(),await this.gateway.createPaymentMethod(),await this.submit(null)}catch(t){this.submitError(t)}finally{this.enablePlaceOrderButton()}}async createSetupIntent(t={}){try{this.disablePlaceOrderButton();const e=await r()({method:"POST",url:(0,p.getRestRoute)("setup-intent"),data:{payment_method:this.gateway.id,context:this.context.getPage(),payment_method_id:this.gateway.getPaymentMethodId(),...this.context.isOrderPay()&&{order_id:this.order.getId(),order_key:this.order.getOrderKey()},...t}});if(["requires_confirmation","requires_payment_method","requires_action"].includes(e.status)){const t=await this.handleIntentConfirmation(e);this.gateway.setPaymentMethodId(t.setupIntent.payment_method)}this.gateway.setSetupIntentId(e.id),this.submitForm()}catch(t){this.gateway.setPaymentMethodId(""),this.submitError(t)}finally{this.enablePlaceOrderButton()}}onPaymentMethodSelected(t){if(this.gateway.id===t)if(this.gateway.supports("place_order_button"))this.displayPlaceOrderButton();else{if(!this.isPaymentMethodAvailable())return this.displayPlaceOrderButton();this.isSavedPaymentMethodSelected()||this.gateway.hasPaymentMethodId()?(this.hidePaymentElement(),this.displayPlaceOrderButton()):(this.displayPaymentElement(),this.hidePlaceOrderButton())}else t?.indexOf("stripe_")<0&&this.displayPlaceOrderButton(),this.gateway.supports("place_order_button")||this.hidePaymentElement()}onPaymentUnavailable(){super.onPaymentUnavailable(),s()(`li.payment_method_${this.gateway.id}`).hide()}submitError(t){this.context.isOrderPay()?this.displayErrorMessage(t,"#order_review"):this.context.isCheckout()?this.displayErrorMessage(t,"form.checkout"):this.context.isAddPaymentMethod()&&this.displayErrorMessage(t,"#add_payment_method")}getElementContainer(){return document.querySelector(this.selector)||s()("#place_order").after(`
    `),super.getElementContainer()}getForm(){return this.context.isCheckout()?s()("form.checkout"):s()(this.selector).closest("form")}triggerPaymentMethodSelected(){this.onPaymentMethodSelected(s()('[name="payment_method"]:checked').val())}isPaymentGatewaySelected(){return s()('[name="payment_method"]:checked')?.val()===this.gateway.id}isSavedPaymentMethodSelected(){const t=`[name="wc-${this.gateway.id}-payment-token"]`;return s()(t).length>0&&"new"!==s()(`${t}:checked`).val()}disablePlaceOrderButton(){s()("#place_order").prop("disabled",!0)}enablePlaceOrderButton(){s()("#place_order").prop("disabled",!1)}displayPlaceOrderButton(){s()("#place_order").removeClass("wc-stripe-hide")}hidePlaceOrderButton(){s()("#place_order").addClass("wc-stripe-hide")}},M=class extends k{wcCheckoutForm=null;constructor(t){super(t),this.order=E(),(0,p.registerPaymentMethod)(this.gateway)}initActions(){this.actions.addAction("updated_checkout",this.onUpdatedCheckout.bind(this)),this.actions.addAction("payment_method_selected",this.onPaymentMethodSelected.bind(this)),this.actions.addAction("payment_intent_requires_actions",this.onPaymentRequiresAction.bind(this)),this.actions.addAction("setup_intent_requires_actions",this.onPaymentRequiresAction.bind(this)),this.actions.addAction("checkout_order_review",this.onCheckoutOrderReview.bind(this)),s()(document.body).on("change",`[name="wc-${this.gateway.id}-payment-token"]`,this.onPaymentTokenChange.bind(this)),s()(document.body).on("change",`[name="wc-${this.gateway.id}-new-payment-method"]`,this.onSavePaymentMethodChange.bind(this)),s()(document.body).on("click",`li.payment_method_${this.gateway.id} .wc-stripe-saved-method, li.payment_method_${this.gateway.id} .woocommerce-SavedPaymentMethods-new`,this.onSavedTokenChanged.bind(this)),s()(document.body).on("click",`li.payment_method_${this.gateway.id} .wc-stripe-saved-method__see-more`,this.onSeeMoreClick.bind(this)),this.context.isCheckout()?(s()("form.checkout").on(`checkout_place_order_${this.gateway.id}`,this.onCheckoutPlaceOrder.bind(this)),this.actions.addAction(`checkout_error_${this.gateway.id}`,this.onCheckoutError.bind(this))):(s()(document.body).on("click","#place_order",this.onPlaceOrderClick.bind(this)),s()(window).on("load",()=>{s()(document.body).trigger("wc-credit-card-form-init")}))}isPaymentMethodAvailable(){if(this.context.isCheckout()){const t=this.gateway.getOption("paymentSections",[]);if(Array.isArray(t)&&t.length>0&&!t.includes("checkout"))return!1}return super.isPaymentMethodAvailable()}onUpdatedCheckout(t,e){super.initialize(),this.triggerPaymentMethodSelected(),this.initSavedMethods()}initSavedMethods(){const t=this.getSavedMethodsList();if(!t.length)return;const e=this.getSelectedToken(t);e.length&&t.prepend(e),this.hideSavedMethods(t)}onPaymentElementReady(){super.onPaymentElementReady(),this.triggerPaymentMethodSelected(),s()(`li.payment_method_${this.gateway.id}`).show().addClass("active"),this.gateway.supports("payment_sheet")&&(this.gateway.settings.hasPaymentTokens||this.gateway.settings.description?s()(`.payment_method_${this.gateway.id} .payment_box`).removeClass("hide-payment-box"):s()(`.payment_method_${this.gateway.id} .payment_box`).addClass("hide-payment-box"))}onCheckoutPlaceOrder(t,e=null){return this.wcCheckoutForm=e,!((!this.isSavedPaymentMethodSelected()||this.context.isOrderPay()&&this.gateway.supports("checkout_session"))&&!this.gateway.hasPaymentMethodId()&&!this.gateway.hasSetupIntentId()&&(this.gateway.supports("form_validation")||this.isTermsAndConditionsValid()?(this.processCheckout(),1):(this.submitError({code:"terms"}),1)))}onPlaceOrderClick(t){this.isPaymentGatewaySelected()&&(t.preventDefault(),this.onCheckoutPlaceOrder(null)&&this.submitForm())}onCheckoutError(t){this.gateway.supports("checkout_error")&&this.gateway.setPaymentMethodId("")}onClick(){if(!this.isTermsAndConditionsValid())throw this.submitError({code:"terms"}),new Error;if(this.context.isCheckout()&&this.gateway.supports("form_validation")&&!this.isCheckoutFormValid())throw this.validateCheckoutForm().then(t=>{if(!t.success)return this.submitError(t.messages)}),new Error}onPaymentTokenChange(t){this.isPaymentGatewaySelected()&&(this.isSavedPaymentMethodSelected()?(this.gateway.supports("place_order_button")||(this.hidePaymentElement(),this.displayPlaceOrderButton()),this.collapseSavedMethods()):(this.gateway.supports("place_order_button")||(this.displayPaymentElement(),this.hidePlaceOrderButton()),this.collapseSavedMethods()))}onSavedTokenChanged(t){const e=s()(t.currentTarget);e.closest(".woocommerce-SavedPaymentMethods").children("li").removeClass("selected"),e.addClass("selected"),e.find('input[type="radio"]').prop("checked",!0).trigger("change")}onSeeMoreClick(t){t.preventDefault(),t.stopPropagation();const e=s()(t.currentTarget).closest(".woocommerce-SavedPaymentMethods");e.find(".wc-stripe-saved-method:hidden").length>0?this.showSavedMethods(e):this.hideSavedMethods(e)}collapseSavedMethods(){const t=this.getSavedMethodsList(),e=this.getSelectedToken(t);e.length&&t.prepend(e),this.hideSavedMethods(t);const i=t.find(".wc-stripe-see-more a");i.text(i.data("showMore"))}hideSavedMethods(t){t.removeClass("wc-saved-payment-methods__expanded"),t.find(".wc-stripe-saved-method").not(":first").hide()}showSavedMethods(t){t.addClass("wc-saved-payment-methods__expanded"),t.find(".wc-stripe-saved-method").show()}getSelectedToken(t){return t.find('input[type="radio"]:checked').closest(".wc-stripe-saved-method")}getSavedMethodsList(){return s()(`li.payment_method_${this.gateway.id} .woocommerce-SavedPaymentMethods`)}async onPaymentRequiresAction(t){if(this.isPaymentGatewaySelected()&&(!this.gateway.supports("payment_sheet")||this.isSavedPaymentMethodSelected()||this.gateway.isPaymentSheetOpen()))try{const e=await this.handleIntentConfirmation(t,{skipElements:this.isSavedPaymentMethodSelected()});window.location.href=this.getPostAuthenticationRedirectUrl(t,e)}catch(t){return this.gateway.clearElementSubmitted(),this.gateway.setPaymentMethodId(""),this.gateway.setSetupIntentId(""),this.getForm().removeClass("processing").unblock?.(),this.submitError(t)}}onCheckoutOrderReview(t){this.isPaymentGatewaySelected()&&(this.gateway.setPaymentMethodId(t.payment_method_id),s()(`[name="wc-${this.gateway.id}-payment-token"][value="new"]`).trigger("click"))}onSavePaymentMethodChange(t){const e=s()(t.currentTarget);this.gateway.setSavePaymentMethod(e.is(":checked")),this.gateway.updateElements()}async processCheckout(){try{this.isSavedPaymentMethodSelected()||await this.gateway.validatePaymentElement(),this.actions.applyFilters("wc_stripe_should_create_payment_method",this.gateway.shouldCreatePaymentMethod())?await this.createPaymentMethod():await this.submit(null)}catch(t){this.submitError(t)}}async submit(t=null){if(t&&this.populateCheckoutFields(t,{skipBilling:!0}),this.gateway.supports("payment_sheet")&&(this.hidePaymentElement(),this.displayPlaceOrderButton()),this.context.isOrderPay())return this.gateway.isSetupMode()?await this.createSetupIntent():await this.processOrderPay();this.submitForm()}async processOrderPay(){try{this.showProcessing();const t=await this.order.processPayment(this.gateway.id,(0,p.convertFormToFields)(this.getForm()));if(t.complete)this.submitForm();else{const e=(0,p.isNextActionRequired)(t.redirect);e&&(await this.handleIntentConfirmation(e),"checkout_session"===e.type?window.location.href=e.return_url:this.submitForm())}}catch(t){return this.gateway.setPaymentMethodId(""),this.submitError(t)}finally{this.hideProcessing()}}populateCheckoutFields(t,e={}){if(super.populateCheckoutFields(t,e),t.paymentMethodId){const e=`${this.gateway.id}_payment_method_id`;s()(`[name="${e}"]`).length||s()("form.checkout").append(``),this.gateway.setPaymentMethodId(t.paymentMethodId)}}submitForm(){this.actions.applyFilters("checkout_submit_form",!0)&&this.getForm().trigger("submit")}isCheckoutFormValid(){const t=[];return s()("form.checkout .validate-required:visible").each((e,i)=>{const n=s()(i),a=n.find("input, select, textarea").first();if(a.length&&a.is(":visible")){const e=a.attr("name");"checkbox"===a.attr("type")?a.is(":checked")||t.push(e):"radio"===a.attr("type")?n.find('input[type="radio"]:checked').length||t.push(e):a.val()||t.push(e)}}),this.actions.applyFilters("checkout_form_valid",0===t.length,this)}isTermsAndConditionsValid(){return!s()('[name="terms"]').filter(":visible").length||s()('[name="terms"]').is(":checked")}async validateCheckoutForm(){try{return this.disablePaymentElement(),this.showProcessing(),await r()({method:"POST",url:(0,p.getRestRoute)("checkout/form-validation"),data:(0,p.convertFormToFields)(s()("form.checkout"))})}catch(t){return{success:!0}}finally{this.enablePaymentElement(),this.hideProcessing()}}getProcessingSelector(){return this.context.isOrderPay()?"form#order_review":"form.checkout"}needsShipping(){return!1}getCurrency(){return this.context.isOrderPay()?this.order.getCurrency():this.cart.getCurrency()}getTotalCents(){return this.context.isOrderPay()?this.order.getTotalCents():this.cart.getTotalCents()}needsPayment(){return this.context.isOrderPay()?this.order.needsPayment():this.cart.needsPayment()}getLineItems(){return this.context.isOrderPay()?this.order.getLineItems():super.getLineItems()}},A=class extends M{initActions(){this.actions.addAction("updated_checkout",this.onUpdatedCheckout.bind(this)),this.actions.addAction("payment_method_selected",this.onPaymentMethodSelected.bind(this)),this.actions.addAction("payment_intent_requires_actions",this.onPaymentRequiresAction.bind(this)),this.actions.addAction("setup_intent_requires_actions",this.onPaymentRequiresAction.bind(this)),this.actions.addAction("checkout_order_review",this.onCheckoutOrderReview.bind(this)),Object.entries((0,p.getSetting)("paymentMethods",{})).filter(([,t])=>t.enabled).forEach(([t])=>this.bindGatewayEvents(t))}bindGatewayEvents(t){s()(document.body).on("change",`[name="wc-${t}-payment-token"]`,this.onPaymentTokenChange.bind(this)),s()(document.body).on("change",`[name="wc-${t}-new-payment-method"]`,this.onSavePaymentMethodChange.bind(this)),s()(document.body).on("click",`li.payment_method_${t} .wc-stripe-saved-method, li.payment_method_${t} .woocommerce-SavedPaymentMethods-new`,this.onSavedTokenChanged.bind(this)),s()(document.body).on("click",`li.payment_method_${t} .wc-stripe-saved-method__see-more`,this.onSeeMoreClick.bind(this)),this.context.isCheckout()&&(s()("form.checkout").on(`checkout_place_order_${t}`,this.onCheckoutPlaceOrder.bind(this)),this.actions.addAction(`checkout_error_${t}`,this.onCheckoutError.bind(this)))}onPaymentMethodSelected(t){this.gateway.onPaymentMethodSelected(t),super.onPaymentMethodSelected(t)}getElementContainer(){const t=this.gateway.getGatewayTarget(this.gateway.id);if(!t)return null;const e=document.querySelector(t.selector);return this.actions.applyFilters("get_element_container",e,this)}},I=class extends _{initActions(){this.actions.addAction("updated_checkout",this.onUpdatedCheckout.bind(this)),this.actions.addAction("payment_intent_requires_actions",this.onPaymentRequiresAction.bind(this)),this.actions.addAction("setup_intent_requires_actions",this.onPaymentRequiresAction.bind(this))}onUpdatedCheckout(){super.initialize()}onPaymentElementReady(){s()(this.selector).show().addClass("active"),s()(this.selector).closest(".wc-stripe-banner-checkout").addClass("active"),super.onPaymentElementReady()}onPaymentUnavailable(){super.onPaymentUnavailable(),s()(`li.banner_payment_method_${this.gateway.id}`).hide()}onClick(){s()('[name="terms"]').prop("checked",!0).trigger("change");const t=s()(`[name="payment_method"][value="${this.gateway.id}"]`);t.prop("checked",!0).trigger("click"),t.trigger("change"),s()(`[name="wc-${this.gateway.id}-payment-token"][value="new"]`).trigger("click")}async onShippingChange(t){if(t?.shipping_method){const e=(0,p.extractShippingMethod)(t.shipping_method);for(const t in e){const i=e[t],n=s()(`[name="shipping_method[${t}]"][value="${i}"]`);n.length?n.prop("checked",!0):this._updateRequired=!0}}return super.onShippingChange(t)}async onPaymentRequiresAction(t){if(t.gateway_id===this.gateway.id&&this.gateway.isPaymentSheetOpen())try{const e=await this.handleIntentConfirmation(t);window.location.href=this.getPostAuthenticationRedirectUrl(t,e)}catch(t){return this.gateway.clearElementSubmitted(),this.gateway.setPaymentMethodId(""),this.gateway.setSetupIntentId(""),this.getForm().removeClass("processing").unblock?.(),this.submitError(t)}}async submit(t=null){t&&this.populateCheckoutFields(t),this._updateRequired&&await this.triggerUpdatedCheckout(),s()('[name="payment_method"]').val(this.gateway.id),this.actions.doAction("before_form_submit",this),this.getForm().trigger("submit")}populateCheckoutFields(t,e={}){if(super.populateCheckoutFields(t,e),t.paymentMethodId){const e=`${this.gateway.id}_payment_method_id`;s()(`[name="${e}"]`).length||s()("form.checkout").append(``)}}triggerUpdatedCheckout(){return new Promise(t=>{s()(document.body).one("updated_checkout",t),s()('[name="billing_country"], [name="shipping_country"]').trigger("change"),s()(document.body).trigger("update_checkout",{update_shipping_method:!1})})}needsShipping(){return this.cart.needsShipping()}getForm(){return s()(this.selector).closest("form")}},$=class extends k{initActions(){this.actions.addAction("payment_method_selected",this.onPaymentMethodSelected.bind(this)),s()(document.body).on("click","#place_order",this.onPlaceOrderClick.bind(this))}onPaymentElementReady(){super.onPaymentElementReady(),this.triggerPaymentMethodSelected()}async onPlaceOrderClick(t){if(this.isPaymentGatewaySelected()){t.preventDefault();try{await this.gateway.validatePaymentElement()}catch(t){return this.submitError(t)}await this.createPaymentMethod()}}async submit(t=null){this.gateway.supports("payment_sheet")&&(this.hidePaymentElement(),this.displayPlaceOrderButton()),await this.createSetupIntent()}submitError(t){super.submitError(t),this.gateway.supports("payment_sheet")&&(this.displayPaymentElement(),this.hidePlaceOrderButton())}submitForm(){this.getForm().trigger("submit")}isPaymentMethodAvailable(){var t;const e=(0,p.getSetting)("paymentMethods");return null!==(t=e?.[this.gateway.id]?.supports?.includes("add_payment_method"))&&void 0!==t&&t}needsShipping(){return!1}};(this.wcStripe=this.wcStripe||{}).controllers=n})(); (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ApplePayGateway:()=>_,BaseGateway:()=>l,CheckoutSessionGateway:()=>y,GooglePayGateway:()=>b,LinkCheckoutGateway:()=>v,LocalPaymentGateway:()=>o,UPMCheckoutSessionGateway:()=>E,UniversalPaymentGateway:()=>h,createCreditCardGateway:()=>u});const n=window.jQuery;var i=e.n(n);const s=window.wcStripe.actions;var a=e.n(s);const r=window.wcStripe.utils,l=class{id;stripe=null;elements=null;elementType="";paymentElement=null;_styles={};controller=null;capabilities=[];_elementsSubmitted=!1;_terms=["applePay","auBecsDebit","bancontact","card","cashapp","googlePay","ideal","paypal","sepaDebit","sofort","usBankAccount"];constructor({id:e,settings:t,context:n}){this.id=e,this.actions=a(),this.settings=t,this.context=n,"payment_method"===this.settings.button_placement&&this.capabilities.push("place_order_button")}initialize(){this.actions.addAction("stripe_sdk_loaded",this.onStripeSDKLoaded.bind(this)),this.actions.addAction("checkout_field_changed",this.onCheckoutFieldChanged.bind(this))}onCheckoutFieldChanged(e){"expressCheckout"!==this.elementType&&this.updatePaymentElement()}onStripeSDKLoaded(e){this.setStripe(e)}createPaymentElement(){const e=this.actions.applyFilters("payment_element_options",this.buildPaymentElementOptions(),this,!1);this.paymentElement=this.elements.create(this.elementType,e)}createElements(){if(this.stripe){const e=this.actions.applyFilters("stripe_element_options",this.getElementOptions(),this,!1);this.elements=this.stripe.elements(e)}}updateElements(){if(this.elements){const e=this.actions.applyFilters("stripe_element_options",this.getElementOptions(!0),this,!0);this.elements.update(e)}}updatePaymentElement(){if(this.paymentElement){const e=this.actions.applyFilters("payment_element_options",this.buildPaymentElementOptions(!0),this,!0);this.paymentElement.update(e)}}getOption(e,t=null){var n;return null!==(n=this.settings[e])&&void 0!==n?n:t}getElementOptions(e=!1){let t={locale:"auto",currency:this.controller.getCurrency().toLowerCase(),...this.settings.elementOptions},n=this.controller.getTotalCents(),i=this.controller.getSubtotalCents();return n<=0&&"subscription"!==t.mode&&(this.context.isProduct()||this.context.isCart()||this.context.isMinicart()?t.mode="setup":n=i>0?i:100),["payment","subscription"].includes(t.mode)&&(t.amount=n),t}setController(e){this.controller=e}setStripe(e){this.stripe=e}onPaymentMethodAvailable(){this.elements?this.updateElements():this.createElements(),this.paymentElement||this.createPaymentElement()}async canMakePayment(){return this.actions.applyFilters("can_make_payment",this.isSetupMode()||this.isSubscriptionMode()||this.controller.getTotalCents()>0||this.controller.needsPayment(),this)}shouldMountElement(e){return!e?.querySelector("iframe")}shouldCreatePaymentMethod(){return!1}async createPaymentMethod(){try{const e=await this.stripe.createPaymentMethod({elements:this.elements,params:{billing_details:{...this.context.isCheckout()&&{address:this.getBillingAddress()},...this.hasDOMNameValue()&&{name:this.getBillingName()},...this.getBillingEmail()?{email:this.getBillingEmail()}:"never"===this._paymentElementOptions?.fields?.billingDetails?.email&&{email:""},...this.getBillingPhone()?{phone:this.getBillingPhone()}:"never"===this._paymentElementOptions?.fields?.billingDetails?.phone&&{phone:""}}}});if(e.error)throw e.error;this.setPaymentMethodId(e.paymentMethod.id)}catch(e){throw e}}async mountPaymentElement(e){throw new Error("Must implement mountPaymentElement()")}async validatePaymentElement(){try{let e=await this.elements.submit();if(e.error)throw e.error;return this._elementsSubmitted=!0,e}catch(e){throw e}}getPaymentIntentFieldKey(){return`${this.id}_payment_intent_id`}setPaymentMethodId(e){const t=`${this.id}_payment_method_id`;(0,r.setFieldValue)(t,e),(0,r.setFieldValue)(`${this.id}_token_key`,e)}getPaymentMethodId(){return(0,r.getFieldValue)(`${this.id}_payment_method_id`)}hasPaymentMethodId(){return!!this.getPaymentMethodId()}setSetupIntentId(e){(0,r.setFieldValue)(`${this.id}_setup_intent_id`,e)}hasSetupIntentId(){return!!(0,r.getFieldValue)(`${this.id}_setup_intent_id`)}clearElementSubmitted(){this._elementsSubmitted=!1}enablePaymentElement(){}disablePaymentElement(){}destroyPaymentElement(){}supports(e){return this.capabilities.includes(e)}isPaymentCancelled(e){const t=e.paymentIntent?.next_action;return!("verify_with_microdeposits"===t?.type||"redirect_to_url"===t?.type||this.settings.isVoucher&&t?.type?.endsWith("_display_details"))}isPaymentMode(){return"payment"===this.settings.elementOptions.mode}isSubscriptionMode(){return"subscription"===this.settings.elementOptions.mode}isSetupMode(){return"setup"===this.settings.elementOptions.mode}getPaymentElementStyles(){return Object.entries(this._styles).map(([e,t])=>`${e.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}: ${t}`).join("; ")}setSavePaymentMethod(e){"subscription"!==this.settings.elementOptions.mode&&(this.settings.elementOptions.mode=e?"setup":"payment")}buildPaymentElementOptions(e=!1){return this._paymentElementOptions={fields:{billingDetails:this.context.isCheckout()?{address:"never",name:this.hasDOMNameValue()?"never":"auto",email:this.getBillingEmail()||(0,r.isFieldRequired)("billing_email")?"never":"auto",phone:this.getBillingPhone()||(0,r.isFieldRequired)("billing_phone")?"never":"auto"}:"auto"},...!e&&{wallets:{applePay:"never",googlePay:"never",link:this.getPaymentMethodTypes().includes("link")?"auto":"never"}},defaultValues:{billingDetails:{name:this.getBillingName(),email:this.getBillingEmail(),phone:this.getBillingPhone()}},terms:this.getTerms(),...this.settings.paymentElementOptions},this._paymentElementOptions}getPaymentMethodType(){return this.settings.paymentMethodType}getPaymentMethodTypes(){return this.settings.elementOptions?.paymentMethodTypes?this.settings.elementOptions.paymentMethodTypes:[this.getPaymentMethodType()]}getTerms(){const e=this.settings.termsDisplayRule;return this._terms.reduce((t,n)=>(t[n]=e,t),{})}async confirmPayment(e,t={}){return await this.stripe.confirmPayment({...!t.skipElements&&{elements:this.elements},clientSecret:e.client_secret,redirect:"if_required",confirmParams:{return_url:e.return_url,payment_method_data:{billing_details:e.billing_details},...e.confirmation_args&&e.confirmation_args}})}async confirmSetup(e,t={}){return await this.stripe.confirmSetup({...!t.skipElements&&{elements:this.elements},clientSecret:e.client_secret,redirect:"if_required",confirmParams:{...e.return_url&&{return_url:e.return_url},payment_method_data:{...e.billing_details&&{billing_details:e.billing_details}},...e.confirmation_args&&e.confirmation_args}})}getBillingName(){if(this.context.isAddPaymentMethod())return(0,r.getSetting)("customer").billing_address.name;if(this.context.isOrderPay())return this.controller.order.getBillingName();const e=i()('[name="billing_first_name"]'),t=i()('[name="billing_last_name"]'),n=i()('[name="shipping_first_name"]'),s=i()('[name="shipping_last_name"]');return e.is(":visible")?[e.val()||"",t.val()||""].filter(Boolean).join(" "):n.is(":visible")?[n.val()||"",s.val()||""].filter(Boolean).join(" "):e.val()?[e.val()||"",t.val()||""].filter(Boolean).join(" "):n.val()?[n.val()||"",s.val()||""].filter(Boolean).join(" "):""}getBillingEmail(){if(this.context.isAddPaymentMethod()){const e=(0,r.getSetting)("customer");return e?.billing_address?.email||""}if(this.context.isOrderPay())return this.controller.order.getBillingEmail();const e=i()('[name="billing_email"]');return e.is(":visible")?e.val()||"":e.val()?e.val():""}getBillingPhone(){if(this.context.isAddPaymentMethod()){const e=(0,r.getSetting)("customer");return e?.billing_address?.phone||""}if(this.context.isOrderPay())return this.controller.order.getBillingPhone();const e=i()('[name="billing_phone"]'),t=i()('[name="shipping_phone"]');return e.is(":visible")?e.val()||"":t.is(":visible")?t.val()||"":e.val()?e.val():t.val()?t.val():""}getBillingAddress(){if(this.context.isAddPaymentMethod()){const e=(0,r.getSetting)("customer");return this.transformAddress(e?.billing_address)}if(this.context.isOrderPay())return this.transformAddress(this.controller.order.getBillingAddress());const e=i()('[name="billing_country"]'),t=i()('[name="shipping_country"]');return e.is(":visible")?{line1:i()('[name="billing_address_1"]').val()||"",line2:i()('[name="billing_address_2"]').val()||"",postal_code:i()('[name="billing_postcode"]').val()||"",city:i()('[name="billing_city"]').val()||"",state:i()('[name="billing_state"]').val()||"",country:e.val()||null}:t.is(":visible")?{line1:i()('[name="shipping_address_1"]').val()||"",line2:i()('[name="shipping_address_2"]').val()||"",postal_code:i()('[name="shipping_postcode"]').val()||"",city:i()('[name="shipping_city"]').val()||"",state:i()('[name="shipping_state"]').val()||"",country:t.val()||null}:e.val()?{line1:i()('[name="billing_address_1"]').val()||"",line2:i()('[name="billing_address_2"]').val()||"",postal_code:i()('[name="billing_postcode"]').val()||"",city:i()('[name="billing_city"]').val()||"",state:i()('[name="billing_state"]').val()||"",country:e.val()}:t.val()?{line1:i()('[name="shipping_address_1"]').val()||"",line2:i()('[name="shipping_address_2"]').val()||"",postal_code:i()('[name="shipping_postcode"]').val()||"",city:i()('[name="shipping_city"]').val()||"",state:i()('[name="shipping_state"]').val()||"",country:t.val()}:{line1:null,line2:null,postal_code:null,city:null,state:null,country:null}}getBillingDetails(){return{name:this.getBillingName(),phone:this.getBillingPhone(),email:this.getBillingEmail(),address:this.getBillingAddress()}}hasDOMNameValue(){return!!i()('[name="billing_first_name"]').is(":visible")||!!i()('[name="shipping_first_name"]').is(":visible")||!!this.getBillingName()}hasDOMEmailValue(){return!!i()('[name="billing_email"]').is(":visible")||!!this.getBillingEmail()}hasDOMPhoneValue(){return!!i()('[name="billing_phone"]').is(":visible")||!!i()('[name="shipping_phone"]').is(":visible")||!!this.getBillingPhone()}transformAddress(e){return{line1:e.address_1||"",line2:e.address_2||"",city:e.city||"",state:e.state||"",postal_code:e.postcode||"",country:e.country||""}}},o=class extends l{elementType="payment";constructor(e){super(e),this.capabilities.push("place_order_button","checkout_error")}async mountPaymentElement(e){this._elementsSubmitted=!1,this.paymentElement.removeAllListeners(),this.paymentElement.on("change",this.onPaymentElementChange.bind(this)),this.paymentElement.on("loaderror",this.onPaymentElementLoadError.bind(this,e)),this.paymentElement.mount(e)}async validatePaymentElement(){try{let e=await this.elements.submit();if(e.error)throw e.error;this._elementsSubmitted=!0}catch(e){throw e}}onPaymentElementChange(e){e?.value?.type&&(this.paymentMethodType=e.value.type)}onPaymentElementLoadError(e,t){const{error:n}=t;this.elements=null,this.paymentElement=null,i()(e).append(n.message)}hasPaymentMethodId(){return this._elementsSubmitted}},h=class extends l{elementType="payment";paymentMethodType="";constructor(e){super(e),this.capabilities.push("place_order_button","checkout_error")}async mountPaymentElement(e){this._elementsSubmitted=!1,this.paymentElement.removeAllListeners(),this.paymentElement.on("change",this.onPaymentElementChange.bind(this)),this.paymentElement.on("loaderror",this.onLoadError.bind(this)),this.paymentElement.mount(e)}onPaymentElementChange(e){e?.value?.type&&this.setPaymentMethodType(e.value.type)}setPaymentMethodType(e){this.paymentMethodType=e,i()("#_stripe_payment_method_type").val(e)}onLoadError(){}async validatePaymentElement(){const e=await super.validatePaymentElement();e?.selectedPaymentMethod&&this.setPaymentMethodType(e.selectedPaymentMethod)}hasPaymentMethodId(){return["card","link","apple_pay","google_pay"].includes(this.paymentMethodType)?super.hasPaymentMethodId():this._elementsSubmitted}shouldCreatePaymentMethod(){return["card","link","apple_pay","google_pay"].includes(this.paymentMethodType)}buildPaymentElementOptions(e=!1){return super.buildPaymentElementOptions(),e||(this._paymentElementOptions.wallets={applePay:"auto",googlePay:"auto"}),this._paymentElementOptions}},m=class extends l{constructor(e){super(e),this.capabilities.push("place_order_button","checkout_error")}initialize(){super.initialize(),this.actions.addFilter("get_error_message_selector",this.getErrorMessageSelector.bind(this))}shouldCreatePaymentMethod(){return!0}getErrorMessageSelector(e,t,n){return this.id!==n||(t.context.isCheckout()||t.context.isOrderPay())&&(e=this.settings.noticeSelector,"bcf"===this.settings.noticeLocation&&(i()(".wc-stripe-card-notice").remove(),i()(".wc-stripe_cc-container").append('
    '))),e}},c=class extends m{selector="#wc-stripe-card-element";elementType="payment";_paymentElementOptions={};async mountPaymentElement(e){this._elementsSubmitted=!1,this.paymentElement.removeAllListeners(),this.paymentElement.on("change",this.onPaymentElementChange.bind(this)),this.paymentElement.on("loaderror",this.onLoadError.bind(this)),this.paymentElement.mount(e)}onPaymentElementChange(e){}onLoadError(e){console.log(`Error loading payment element: ${e}`)}shouldCreatePaymentMethod(){return!this.isInstallmentsEnabled()}hasPaymentMethodId(){return this.isInstallmentsEnabled()?this._elementsSubmitted:super.hasPaymentMethodId()}isInstallmentsEnabled(){return!!this.settings.installments?.clientSecret}getElementOptions(e=!1){const t=super.getElementOptions();return this.isInstallmentsEnabled()&&(delete t.mode,delete t.amount,delete t.currency,delete t.paymentMethodTypes,delete t.paymentMethodCreation,e||(t.clientSecret=this.settings.installments.clientSecret)),t}},d=class extends m{selector="#wc-stripe-card-element";elementType="card";async mountPaymentElement(e){this.paymentElement.mount(e),this.paymentElement.update({value:{postalCode:i()("#billing_postcode").val()||""},hidePostalCode:i()("#billing_postcode").is(":visible")})}buildPaymentElementOptions(e=!1){const t={...this.settings.inlineFormOptions,value:{postalCode:i()("#billing_postcode").val()||""},hidePostalCode:i()("#billing_postcode").is(":visible")};return e&&delete t.disableLink,t}async createPaymentMethod(){try{const e=await this.stripe.createPaymentMethod({type:"card",card:this.paymentElement,billing_details:this.getBillingDetails()});if(e.error)throw e.error;this.setPaymentMethodId(e.paymentMethod.id)}catch(e){throw e}}async confirmPayment(e,t={}){return this.stripe.confirmCardPayment(e.client_secret)}async confirmSetup(e,t={}){return this.stripe.confirmCardSetup(e.client_secret)}},p=class extends m{selector="#wc-stripe-cc-custom-form";_elementClasses={focus:"focused",empty:"empty",invalid:"invalid"};shouldMountElement(e){return 0===i()("#wc-stripe-cc-custom-form").find("iframe").length}createPaymentElement(){const e={classes:this._elementClasses,...this.settings.cardFormOptions};this.cardNumber=this.elements.create("cardNumber",{...this.settings.customFieldOptions.cardNumber,...e}),this.cardExpiry=this.elements.create("cardExpiry",{...this.settings.customFieldOptions.cardExpiry,...e}),this.cardCvc=this.elements.create("cardCvc",{...this.settings.customFieldOptions.cardCvc,...e}),this.cardNumber.on("change",this.onCardNumberChange.bind(this)),this.paymentElement=!0}async mountPaymentElement(e){this.cardNumber.mount("#stripe-card-number"),this.cardExpiry.mount("#stripe-exp"),this.cardCvc.mount("#stripe-cvv"),i()("#stripe-card-number").prepend(this.settings.html.card_brand),i()("#stripe-postal-code").length&&(i()("#stripe-postal-code").on("focus",e=>{i()("#stripe-postal-code").addClass("focused")}),i()("#stripe-postal-code").on("blur",e=>{i()("#stripe-postal-code").removeClass("focused").trigger("keyup")}),i()("#stripe-postal-code").on("keyup",e=>{""===i()("#stripe-postal-code").val()?i()("#stripe-postal-code").addClass("empty"):i()("#stripe-postal-code").removeClass("empty")}))}onCardNumberChange(e){"unknown"===e.brand?i()("#wc-stripe-card").removeClass("active"):i()("#wc-stripe-card").addClass("active"),i()("#wc-stripe-card").attr("src",this.settings.cardIcons[e.brand])}async createPaymentMethod(){try{const e=this.getBillingDetails(),t=await this.stripe.createPaymentMethod({type:"card",card:this.cardNumber,billing_details:this.context.isCheckout()?{...e,...i()("#stripe-postal-code").length&&{address:{...e.address,postal_code:i()("#stripe-postal-code").val()}}}:{...e,address:{...i()("#stripe-postal-code").length&&{postal_code:i()("#stripe-postal-code").val()}}}});if(t.error)throw t.error;this.setPaymentMethodId(t.paymentMethod.id)}catch(e){throw e}}async confirmPayment(e,t={}){return this.stripe.confirmCardPayment(e.client_secret)}async confirmSetup(e,t={}){return this.stripe.confirmCardSetup(e.client_secret)}},u=(e,t)=>{switch(e){case"inline":return new d(t);case"custom":return new p(t);default:return new c(t)}},y=class extends l{checkout=null;activeGatewayId=null;activeContainer=null;gatewayInstances=new Map;get id(){var e;return null!==(e=document.querySelector('input[name="payment_method"]:checked')?.value)&&void 0!==e?e:this._id}set id(e){this._id=e}get settings(){var e,t;return null!==(e=null!==(t=this.getGatewayInstance(this.id)?.settings)&&void 0!==t?t:this._settings)&&void 0!==e?e:{}}set settings(e){this._settings=e}isActive(){return!!this._settings?.client_secret}onStripeSDKLoaded(e){super.onStripeSDKLoaded(e),this.isActive()&&this.setup()}onPaymentMethodAvailable(){}setup(){this.checkout=this.stripe.initCheckoutElementsSdk({clientSecret:this._settings.client_secret}),this.paymentElement=this.checkout.createPaymentElement(this.buildPaymentElementOptions())}buildPaymentElementOptions(e=!1){var t;const n=this.getGatewayTarget(this.id),{defaultValues:i,...s}=null!==(t=this.getGatewayInstance(this.id)?.buildPaymentElementOptions(e))&&void 0!==t?t:{};return{...s,...n&&{visiblePaymentMethods:[n.paymentMethodType]}}}onPaymentMethodSelected(e){this.id=e,this.paymentElement&&this.mountActiveGateway(e)}mountActiveGateway(e=this.id){const t=this.getGatewayTarget(e);t&&(e!==this.activeGatewayId?this.performMount(e,t):this.paymentElement.update(this.buildPaymentElementOptions(!0)))}performMount(e,t){this.activeContainer&&this.paymentElement.unmount();const n=()=>{this.paymentElement.off("ready",n),this.paymentElement.update(this.buildPaymentElementOptions(!0))};this.paymentElement.on("ready",n),this.paymentElement.mount(t.selector),this.activeGatewayId=e,this.activeContainer=t.selector}getGatewayTarget(e){const t=this.getGatewayInstance(e);if(!t)return null;const n=(0,r.getSetting)(`${e}_data`),i=t.getPaymentMethodType();return n?.selector&&i?{selector:n.selector,paymentMethodType:i}:null}getGatewayInstance(e){if(this.gatewayInstances||(this.gatewayInstances=new Map),this.gatewayInstances.has(e))return this.gatewayInstances.get(e);const t=(0,r.getSetting)("paymentMethods",{})[e],n=(0,r.getSetting)(`${e}_data`);let i=null;return t?.isLocal?i=new o({id:e,settings:n,context:this.context}):"stripe_upm"===e?i=new h({id:e,settings:n,context:this.context}):"stripe_cc"===e&&"payment"===n?.cardFormType&&(i=u("payment",{id:e,settings:n,context:this.context})),this.gatewayInstances.set(e,i),i}async mountPaymentElement(e){const t=this.id,n=this.getGatewayTarget(t);n&&this.performMount(t,n)}async validatePaymentElement(){try{const{actions:e}=await this.checkout.loadActions(),t=await e.validateElements();if(t.error)throw t.error;this._elementsSubmitted=!0}catch(e){throw e}}async confirmPayment(e,t={}){return this.confirmCheckoutSession(t)}async confirmSetup(e,t={}){return this.confirmCheckoutSession(t)}async confirmCheckoutSession(e={}){const{actions:t}=await this.checkout.loadActions();return t.confirm(e)}},g=class extends l{type;_isEligible=null;_isDisabled=!1;elementType="expressCheckout";_isOpen=!1;_styles={clear:"both",minHeight:"40px"};constructor(e){super(e),this.capabilities=[...this.capabilities,"elements","payment_sheet"]}async mountPaymentElement(e){this.paymentElement.removeAllListeners(),this.paymentElement.on("ready",this.onReady.bind(this)),this.paymentElement.on("loaderror",this.onLoadError.bind(this)),this.paymentElement.on("click",this.onClickElement.bind(this)),this.paymentElement.on("confirm",this.onConfirm.bind(this)),this.paymentElement.on("cancel",this.onCancel.bind(this)),this.paymentElement.on("shippingaddresschange",this.onShippingDataChange.bind(this,"shippingaddresschange")),this.paymentElement.on("shippingratechange",this.onShippingDataChange.bind(this,"shippingratechange")),this.paymentElement.mount(e)}async canMakePayment(){try{return!!(this.context.isProduct()||this.isSetupMode()||this.isSubscriptionMode()||0!==this.controller.getTotalCents()||this.controller.needsPayment())&&this.isEligible()}catch(e){return console.log("Payment method is not available. ",e),!1}}isEligible(){return null===this._isEligible&&(this._isEligible=new Promise((e,t)=>{const n=document.createElement("div");n.style.display="none",document.querySelector("body").appendChild(n),this.paymentElement.on("ready",({availablePaymentMethods:t={}})=>{e(!!t[this.type]),n.remove(),this.paymentElement.removeAllListeners()}),this.paymentElement.on("loaderror",e=>{t(e),n.remove()}),this.paymentElement.mount(n)})),this._isEligible}onReady({availablePaymentMethods:e={}}){this.actions.doAction("express_element_ready",e,this)}onLoadError(e){console.error("Express checkout element load error:",e),this.controller.submitError(e.error)}async onClickElement(e){if(this._isDisabled)return e.reject();try{this.controller.onClick()}catch(t){return e.reject()}this._isOpen=!0;const t={},n=this.controller.getTotalCents(),i=this.controller.getLineItems();if(i&&i.length>0&&i.reduce((e,t)=>e+t.amountCents,0)===n&&(t.lineItems=this.transformLineItems(i)),this.controller.needsShipping()){const e=this.controller.getShippingOptions();e&&e.length>0&&(t.shippingRates=this.transformShippingRates(e,this.controller.getSelectedShippingMethod()))}!this.isSetupMode()&&n>0&&this.elements.update({amount:this.controller.getTotalCents()});const s=await this.actions.applyFilters("express_click_data",t,this,e);e.resolve(s)}async onConfirm(e){try{await this.elements.submit();const t=await this.stripe.createPaymentMethod({elements:this.elements,...this.context.isCheckout()&&{params:{billing_details:{address:this.getBillingAddress(),...this.hasDOMNameValue()&&{name:this.getBillingName()},...this.getBillingEmail()&&{email:this.getBillingEmail()},...this.getBillingPhone()&&{phone:this.getBillingPhone()}}}}});if(t.error)return void this.controller.submitError(t.error);this.setPaymentMethodId(t.paymentMethod.id);const n=this.extractStandardizedCheckoutData(e,t.paymentMethod);this.controller.submit(n)}catch(t){e.paymentFailed({reason:"fail",message:t.message})}}extractStandardizedCheckoutData(e,t){const n={paymentMethodId:t.id};if(e.billingDetails){const t={},{name:i,email:s,phone:a,address:r}=e.billingDetails;if(i){const e=i.split(" ");t.first_name=e[0]||"",t.last_name=e.slice(1).join(" ")||""}s&&(t.email=s),a&&(t.phone=a),r&&(t.address_1=r.line1||"",t.address_2=r.line2||"",t.city=r.city||"",t.state=r.state||"",t.postcode=r.postal_code||"",t.country=r.country||""),n.billing=t}if(e.shippingAddress){const t={},{name:i,address:s}=e.shippingAddress;if(i){const e=i.split(" ");t.first_name=e[0]||"",t.last_name=e.slice(1).join(" ")||""}s&&(t.address_1=s.line1||"",t.address_2=s.line2||"",t.city=s.city||"",t.state=s.state||"",t.postcode=s.postal_code||"",t.country=s.country||""),n.shipping=t}return n}onCancel(e){this._isOpen=!1,this.controller.onCancel()}async onShippingDataChange(e,t){const{resolve:n,reject:i,address:s=null,shippingRate:a=null}=t;try{const t={};s?t.address=this.transformIntermediateAddress(s):t.shipping_method=a.id,await this.controller.onShippingChange(t);const r=this.controller.getShippingOptions();if("shippingaddresschange"===e&&0===r.length)return console.log("No shipping options available for address, rejecting shippingaddresschange.",s),i();this.controller.getTotalCents()>0&&this.elements.update({amount:this.controller.getTotalCents()});const l={shippingRates:this.transformShippingRates(r,this.controller.getSelectedShippingMethod())},o=this.controller.getLineItems();o&&o.length>0&&o.reduce((e,t)=>e+t.amountCents,0)===this.controller.getTotalCents()&&(l.lineItems=this.transformLineItems(o)),n(l)}catch(e){i()}}transformIntermediateAddress(e){return{city:e.city||"",state:e.state||"",postcode:e.postal_code||"",country:e.country||""}}transformShippingRates(e=[],t=null){let n=e.map(e=>({id:e.id,displayName:e.label,amount:e.amountCents}));if(t){const e=n.findIndex(e=>e.id===t);if(e>0){const[t]=n.splice(e,1);n.unshift(t)}}return n}transformLineItems(e=[]){return e.map(e=>({name:e.label,amount:e.amountCents}))}buildPaymentElementOptions(e=!1){return{emailRequired:this.isEmailRequired(),phoneNumberRequired:this.isPhoneRequired(),billingAddressRequired:this.isBillingAddressRequired(),shippingAddressRequired:this.controller.needsShipping(),buttonHeight:Math.max(40,Math.min(55,parseInt(this.settings.button?.height||50))),...this.supports("button_theme")&&{buttonTheme:{[this.type]:this.settings.button?.theme||"black"}},...this.supports("button_type")&&{buttonType:{[this.type]:this.getButtonType()}},paymentMethods:{applePay:"applePay"===this.type?this.settings.display_rule:"never",googlePay:"googlePay"===this.type?this.settings.display_rule:"never",amazonPay:"never",paypal:"never",link:"link"===this.type?"auto":"never"},layout:{maxColumns:1,maxRows:1}}}async destroyPaymentElement(){this.paymentElement&&(null!==this._isEligible&&await this.isEligible(),this.paymentElement.destroy(),this.paymentElement=null,this.createElements(),this.createPaymentElement())}disablePaymentElement(){this.paymentElement&&(this._isDisabled=!0)}enablePaymentElement(){this.paymentElement&&(this._isDisabled=!1)}closePaymentSheet(){this.paymentElement?.unmount()}getElementOptions(e=!1){const t=super.getElementOptions(e);return delete t.paymentMethodTypes,this.settings?.button?.radius&&(t.appearance={...t.appearance,variables:{...t.appearance?.variables,borderRadius:this.settings.button.radius}}),t}isEmailRequired(){return(0,r.isFieldRequired)("billing_email")&&!this.context.isCheckout()&&!this.context.isOrderPay()&&!this.context.isAddPaymentMethod()}isPhoneRequired(){return((0,r.isFieldRequired)("billing_phone")||this.controller.needsShipping()&&(0,r.isFieldRequired)("shipping_phone"))&&!this.context.isCheckout()&&!this.context.isOrderPay()&&!this.context.isAddPaymentMethod()}isBillingAddressRequired(){return!this.context.isCheckout()}isPaymentSheetOpen(){return this._isOpen}getButtonType(){if(this.settings?.buttonTypes){const e=this.context.getPage();if(this.settings.buttonTypes[e])return this.settings.buttonTypes[e]}return this.settings.button?.type||"buy"}},_=class extends g{type="applePay";constructor(e){super(e),this.capabilities=[...this.capabilities,"button_theme","button_type","form_validation"]}},b=class extends g{type="googlePay";constructor(e){super(e),this.capabilities=[...this.capabilities,"button_theme","button_type","form_validation"]}},v=class extends g{type="link";constructor(e){super(e),this.capabilities=[...this.capabilities,"form_validation"]}},E=class extends l{checkout=null;currencyElement=null;paymentMethodType="";_mounted=!1;_lastSyncedSignature=null;_savePaymentMethod=!1;constructor(e){var t;super(e),this.session=null!==(t=e.session)&&void 0!==t?t:{},this.capabilities.push("place_order_button","checkout_error","checkout_session")}initialize(){super.initialize(),this.actions.addAction("updated_checkout",this.onUpdatedCheckout.bind(this)),this.actions.addAction("checkout_session_requires_confirmation",this.onRequiresConfirmation.bind(this))}hasPaymentMethodId(){return this._elementsSubmitted}async onRequiresConfirmation(e){if(this.controller.isPaymentGatewaySelected())try{await this.confirmCheckoutSession(e),window.location.href=e.return_url}catch(e){this._elementsSubmitted=!1,this.controller.getForm().removeClass("processing").unblock?.(),this.controller.submitError(e)}}onStripeSDKLoaded(e){super.onStripeSDKLoaded(e),this.setup()}setup(){!this.checkout&&this.session.client_secret&&(this.checkout=this.stripe.initCheckoutElementsSdk({clientSecret:this.session.client_secret,adaptivePricing:{allowed:!0}}),this.paymentElement=this.checkout.createPaymentElement(this.buildPaymentElementOptions()),this.currencyElement=this.checkout.createCurrencySelectorElement(),this.currencyElement.on("change",(...e)=>{console.log("currency change")}),this._savePaymentMethod=i()(`[name="wc-${this.id}-new-payment-method"]`).is(":checked"),this._lastSyncedSignature=this.getCartSignature())}onPaymentMethodAvailable(){}async mountPaymentElement(e){this._elementsSubmitted=!1,this.paymentElement.removeAllListeners(),this.paymentElement.on("change",this.onPaymentElementChange.bind(this)),this.paymentElement.on("loaderror",this.onLoadError.bind(this)),this.paymentElement.on("availablepaymentmethodschange",this.onAvailablePaymentMethodsChange.bind(this)),this.paymentElement.mount(e),this._mounted=!0,this.mountCurrencyElement()}mountCurrencyElement(){const e=this.getCurrencySelectorContainer();this.currencyElement&&e&&!e.querySelector("iframe")&&this.currencyElement.mount(e)}getCurrencySelectorContainer(){let e=document.getElementById("wc-stripe-currency-selector-element");if(e)return e;const t=document.querySelector(`.payment_box.payment_method_${this.id}`);return t?(e=document.createElement("div"),e.id="wc-stripe-currency-selector-element","below_payment_methods"===this.settings?.currencySelectorPosition?(e.classList.add("wc-stripe-currency-selector-below"),t.appendChild(e)):(e.classList.add("wc-stripe-currency-selector-above"),t.insertBefore(e,t.firstChild)),e):null}onPaymentElementChange(e){e?.value?.type&&this.setPaymentMethodType(e.value.type)}setPaymentMethodType(e){this.paymentMethodType=e,i()("#_stripe_payment_method_type").val(e)}onLoadError(){}onAvailablePaymentMethodsChange(e){const t=e?.paymentMethods||{},n=i()(`li.payment_method_${this.id} .woocommerce-SavedPaymentMethods`);if(!n.length)return;let s=null;n.find(".wc-stripe-saved-method[data-payment-method-type]").each((e,n)=>{const a=i()(n),r=this.toEventPaymentMethodKey(a.data("paymentMethodType")),l=!0===t[r]?.available;a.toggleClass("wc-stripe-saved-method--unavailable",!l),a.find(".wc-stripe-saved-method__input").prop("disabled",!l),!l&&a.hasClass("selected")&&(s=a)}),s&&this.reselectSavedMethod(n)}toEventPaymentMethodKey(e){return e.replace(/_([a-z])/g,(e,t)=>t.toUpperCase())}reselectSavedMethod(e){const t=e.find(".wc-stripe-saved-method:not(.wc-stripe-saved-method--unavailable)").first(),n=t.length?t:e.find(".woocommerce-SavedPaymentMethods-new");n.length&&(n.show(),n.trigger("click"))}setSavePaymentMethod(e){e!==this._savePaymentMethod&&(this._savePaymentMethod=e,i()(document.body).trigger("update_checkout"))}async onUpdatedCheckout(){if(!this.checkout)return;const e=this.getCartSignature();if(e!==this._lastSyncedSignature){this._lastSyncedSignature=e;try{const{actions:e}=await this.checkout.loadActions(),t=await e.runServerUpdate(()=>Promise.resolve());"error"===t?.type&&console.error("Adaptive Pricing runServerUpdate error:",t.error)}catch(e){console.error("Adaptive Pricing runServerUpdate failed:",e)}}}getCartSignature(){const e=this._savePaymentMethod?1:0;return`${this.controller.getCurrency()}:${this.controller.getTotalCents()}:${e}`}buildPaymentElementOptions(e=!1){const{defaultValues:t,...n}=super.buildPaymentElementOptions(e);return e||(n.wallets={...n.wallets,applePay:"auto",googlePay:"auto"}),this._paymentElementOptions=n,n}async validatePaymentElement(){const{actions:e}=await this.checkout.loadActions(),t=await e.validateElements();if(t.error)throw t.error;t.selectedPaymentMethod&&this.setPaymentMethodType(t.selectedPaymentMethod),this._elementsSubmitted=!0}async confirmPayment(e={},t={}){return this.confirmCheckoutSession(e)}async confirmSetup(e={},t={}){return this.confirmCheckoutSession(e)}async confirmCheckoutSession(e={}){const{actions:t}=await this.checkout.loadActions(),n=e.billing_details||{},i=this._paymentElementOptions?.fields?.billingDetails,s=e=>"never"===i||!(!i||"auto"===i)&&"never"===i[e],a=s("address")&&n.address?.country?{address:n.address,...s("name")&&n.name&&{name:n.name}}:null,r=await t.confirm({redirect:"if_required",...e.return_url&&{returnUrl:e.return_url},...e.payment_method&&{paymentMethod:e.payment_method},...s("email")&&n.email&&{email:n.email},...n.phone&&{phoneNumber:n.phone},...!e.payment_method&&a&&{billingAddress:a}});if("error"===r.type)throw r.error;return r}};(this.wcStripe=this.wcStripe||{}).gateways=t})(); (()=>{"use strict";var t={n:e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},d:(e,r)=>{for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.wcStripe.controllers,r=window.wcStripe.utils,a=window.wcStripe.context;var n=t.n(a);const o=window.wcStripe.gateways,i=(0,r.getSetting)("stripe_applepay_data"),p=new(n())("cart"),w=new o.ApplePayGateway({id:"stripe_applepay",settings:i,context:p});new e.CartController({context:p,gateway:w,selector:"#wc-stripe_applepay-cart-button"}).initialize()})(); (()=>{"use strict";var t={n:e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},d:(e,o)=>{for(var r in o)t.o(o,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.wcStripe.controllers,o=window.wcStripe.utils,r=window.wcStripe.context;var a=t.n(r);const n=window.wcStripe.gateways,i=(0,o.getSetting)("stripe_googlepay_data"),w=new(a())("cart"),c=new n.GooglePayGateway({id:"stripe_googlepay",settings:i,context:w});new e.CartController({context:w,gateway:c,selector:"#wc-stripe_googlepay-cart-button"}).initialize()})(); (()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var s in n)e.o(n,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:n[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wcStripe.actions;var n=e.n(t);const s=".wc-stripe-express-skeleton",o={express_checkout:{container:".wc-stripe-banner-checkout",slot:e=>`.banner_payment_method_${e}`},product:{container:".wc-stripe-product-checkout-container",slot:e=>`.payment_method_${e}`},cart:{container:".wc-stripe-cart-checkout-container",slot:e=>`.payment_method_${e}`}};class r{constructor(e,t){this._page=e,this._config=t,this._resolved=new Set,this._total=0,this._settled=!1,this._scan(),n().addAction("express_element_ready",this._onReady.bind(this)),n().addAction("payment_unavailable",this._onUnavailable.bind(this)),n().addAction("cart_dom_updated",this._scan.bind(this),5),n().addAction("updated_checkout",this._scan.bind(this),5)}_getContainer(){return document.querySelector(this._config.container)}_scan(){const e=this._getContainer();if(!e)return;const t=e.querySelectorAll(s);t.length&&(this._resolved=new Set,this._total=t.length,this._settled=!1)}_onReady(e,t){this._resolve(t&&t.context,t&&t.id)}_onUnavailable(e){this._resolve(e&&e.context,e&&e.gateway&&e.gateway.id)}_resolve(e,t){if(this._settled||!e||e.getPage()!==this._page||!t||this._resolved.has(t))return;this._resolved.add(t);const n=this._getContainer();n&&this._removeSkeleton(n.querySelector(this._config.slot(t))),this._resolved.size>=this._total&&this._settle()}_removeSkeleton(e){if(!e)return;const t=e.querySelector(s);t&&t.remove()}_settle(){if(this._settled)return;this._settled=!0;const e=this._getContainer();e&&e.classList.remove("wc-stripe-express-loading")}}const i=()=>{Object.keys(o).forEach(e=>{const t=o[e],n=document.querySelector(t.container);n&&n.querySelector(s)&&new r(e,t)})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",i):i()})();