1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="213c8d1a-e421-4ec1-8934-cb080fa1ec55",e._sentryDebugIdIdentifier="sentry-dbid-213c8d1a-e421-4ec1-8934-cb080fa1ec55")}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[38535],{62963:(e,t,r)=>{let o;r.d(t,{C:()=>tx,D:()=>at,E:()=>nG,F:()=>n1,L:()=>n3,M:()=>n9,P:()=>n,R:()=>n0,T:()=>nz,U:()=>ae,a:()=>n5,b:()=>nq,c:()=>nv,d:()=>nU,f:()=>nj,g:()=>tT,h:()=>tN,i:()=>cl,j:()=>ao,k:()=>nA,l:()=>nw,m:()=>f,o:()=>nY,t:()=>nx,u:()=>nb,y:()=>nT});var n,a,i=r(28505),s=r(54879),l=r(43364),c=r(2724),u=r(95155),d=r(12115),p=function(){var e=function(t,r){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();!function(e){p(function(t,r){var o,n,a,i,s=this.constructor,l=e.call(this,t,r)||this;return Object.defineProperty(l,"name",{value:s.name,enumerable:!1,configurable:!0}),o=s.prototype,(n=Object.setPrototypeOf)?n(l,o):l.__proto__=o,void 0===a&&(a=l.constructor),(i=Error.captureStackTrace)&&i(l,a),l},e)}(Error);let m=s.Yj().trim().min(1,{message:"Please fill in this field"}),h=s.Yj().trim().optional(),_=e=>s.me(e.optional());var f=(e=>(e.FIRST_NAME="firstName",e.LAST_NAME="lastName",e.PHONE="phone",e.EMAIL="email",e.LINE1="line1",e.LINE2="line2",e.LINE3="line3",e.CITY="city",e.STATE="state",e.COUNTRY="country",e.ZIP_CODE="zipCode",e.SHIPPING_LINE1="shippingAddressLine1",e.SHIPPING_LINE2="shippingAddressLine2",e.SHIPPING_LINE3="shippingAddressLine3",e.SHIPPING_CITY="shippingAddressCity",e.SHIPPING_STATE="shippingAddressState",e.SHIPPING_COUNTRY="shippingAddressCountry",e.SHIPPING_ZIP_CODE="shippingAddressZipCode",e.IS_SHIPPING_SAME_AS_BILLING="isShippingSameAsBilling",e.PROMOTION_CODE="promotionCode",e.IS_BUSINESS_PURCHASE="isBusinessPurchase",e.BUSINESS_NAME="businessName",e.TAX_ID="taxId",e.TAX_ID_TYPE="taxIdType",e))(f||{});let y=s.fc(f);var g=(e=>(e.CARD_NUMBER="cardNumber",e.CARD_EXPIRY="cardExpiry",e.CARD_CVC="cardCvc",e))(g||{});let w=s.fc(g),v=s.KC([y,w]);var b=(e=>(e.CARD="card",e.CARD_NUMBER="card-number",e.CARD_EXPIRY="card-expiry",e.CARD_CVC="card-cvc",e.CDE_BRIDGE="cde-bridge",e))(b||{});s.k5(["card","card-number","card-expiry","card-cvc","cde-bridge"]);let k=s.Ik({provider:s.Yj(),processor_name:_(s.Yj()),metadata:_(s.g1(s.Yj(),s.bz()))}),P=s.Ik({id:s.Yj()}),I=s.Ik({backgroundColor:h,color:h,fontFamily:h,fontSize:h,fontWeight:h,margin:h,padding:h,letterSpacing:h,lineHeight:h,hideIcon:h,placeholderStyle:s.Ik({color:h,fontSize:h,fontWeight:h,fontFamily:h,letterSpacing:h,lineHeight:h}).optional()});I.extend({disableAutoFill:h,placeholder:s.Ik({cardNumber:h,expiry:h,cvc:h}).optional()}),I.extend({disableAutoFill:h,placeholder:s.Yj().optional(),icon:s.Ik({color:s.Yj().optional()}).optional()}),I.extend({disableAutoFill:h,placeholder:s.Yj().optional()}),I.extend({disableAutoFill:h,placeholder:s.Yj().optional()});let E=s.k5(["LAYOUT","LOADED","BLUR","FOCUS","CHANGE","TOKENIZE_STARTED","CHECKOUT_STARTED","PAYMENT_FLOW_STARTED","TOKENIZE_SUCCESS","CHECKOUT_SUCCESS","LOAD_ERROR","VALIDATION_ERROR","TOKENIZE_ERROR","CHECKOUT_ERROR","SETUP_PAYMENT_METHOD_SUCCESS","TOKENIZE","CHECKOUT","START_PAYMENT_FLOW"]),C=E.extract(["TOKENIZE_STARTED","CHECKOUT_STARTED"]),S=s.Ik({type:C}),A=E.extract(["BLUR","FOCUS","CHANGE"]),j=s.Ik({type:A,elementType:w,errors:s.YO(s.Yj()).optional(),obfuscatedValue:s.Yj().optional()}),Y=E.extract(["LOAD_ERROR","TOKENIZE_ERROR","CHECKOUT_ERROR"]),x=s.Ik({type:Y,message:m,headers:s.g1(s.Yj(),s.Yj()).optional()}),T=E.extract(["VALIDATION_ERROR"]),N=s.Ik({type:T,elementType:v,errors:s.YO(s.Yj())}),R=s.Ik({type:s.eu(E.enum.LAYOUT),height:m}),L=s.Ik({type:s.eu(E.enum.LOADED),sessionId:m,totalAmountAtoms:s.ai(),currency:h,checkoutPaymentMethods:s.YO(k)}),M=s.Ik({type:s.eu(E.enum.PAYMENT_FLOW_STARTED),nextActionMetadata:s.g1(s.Yj(),s.bz()),paymentFlowMetadata:s.bz().optional(),startPFMetadata:s.lq(s.g1(s.Yj(),s.bz()))}),O=s.Ik({type:s.eu(E.enum.SETUP_PAYMENT_METHOD_SUCCESS),paymentMethodId:s.Yj()}),F=s.Ik({email:m.email({message:"Please enter a valid email address"}
1),firstName:m,lastName:m,phone:h,promotionCode:h,line1:h,line2:h,line3:h,city:h,state:h,country:m,zipCode:h,isShippingSameAsBilling:s.Ie().optional().default(!0),shippingAddressLine1:h,shippingAddressLine2:h,shippingAddressLine3:h,shippingAddressCity:h,shippingAddressState:h,shippingAddressCountry:h,shippingAddressZipCode:h,businessName:h,taxId:h,taxIdType:h}),D=s.Ik({email:m.email({message:"Please enter a valid email address"}),firstName:h,lastName:h,phone:h,promotionCode:h,line1:h,line2:h,line3:h,city:h,state:h,country:m,zipCode:h,isShippingSameAsBilling:s.Ie().optional().default(!0),shippingAddressLine1:h,shippingAddressLine2:h,shippingAddressLine3:h,shippingAddressCity:h,shippingAddressState:h,shippingAddressCountry:h,shippingAddressZipCode:h,businessName:h,taxId:h,taxIdType:h});s.Ik({line1:m,city:m,state:m,country:m}),s.Ik({shippingAddressCountry:m,shippingAddressZipCode:m}),s.Ik({shippingAddressLine1:m,shippingAddressCity:m,shippingAddressState:m,shippingAddressCountry:m,shippingAddressZipCode:m});let U=E.extract(["TOKENIZE","CHECKOUT","START_PAYMENT_FLOW"]),q=s.Ik({type:U,sessionId:m,checkoutPaymentMethod:k,paymentFlowMetadata:s.bz().optional(),doNotUseLegacyCCFlow:s.zM().optional(),existingCCPMId:h,paymentRouteId:h}).extend(F.shape),z=s.Ik({type:s.eu(E.enum.TOKENIZE_SUCCESS),isReadyForCheckout:s.zM()}),G=s.Ik({type:s.eu(E.enum.CHECKOUT_SUCCESS),invoiceUrls:s.YO(s.Yj()),subscriptionIds:s.YO(s.Yj()),customerId:s.Yj(),paymentMethodId:h}),V=s.gM("type",[S,j,x,N,R,L,q,z,G,M,O]);s.Ik({payload:V,nonce:m,formId:m,elementId:m}),s.Ik({amountAtom:s.ai(),currency:m}),s.k5(["apple_pay","google_pay"]),s.Ik({secure_token:s.Yj(),promotion_code:s.Yj().optional()}),s.Ik({secure_token:s.Yj(),existing_cc_pm_id:_(s.Yj()),their_pm_id:_(s.Yj()),checkout_attempt_id:_(s.Yj()),processor_specific_metadata:_(s.g1(s.Yj(),s.bz()))});let $=s.Ik({invoice_urls:s.YO(s.Yj()),subscription_ids:s.YO(s.Yj()),customer_id:s.Yj(),payment_method_id:_(s.Yj()),processors_used:_(s.YO(s.Yj()))}),H=s.Ik({elementType:s.Yj(),errors:s.YO(s.Yj())});s.Ik({session_id:s.Yj()});let B=s.Ik({success:s.eu(!1),error_type:s.eu("validation_error"),errors:s.YO(H)});s.gM("success",[s.Ik({success:s.eu(!0)}),B]),s.Ik({session_id:s.Yj(),checkout_payment_method:k,non_cde_form_fields:F,do_not_use_legacy_cc_flow:s.zM().optional(),existing_cc_pm_id:_(s.Yj()),extra_metadata:s.g1(s.Yj(),s.bz()),payment_route_id:_(s.Yj()),customer_language:_(s.Yj())}),s.Ik({session_id:s.Yj(),checkout_payment_method:k,non_cde_form_fields:F,extra_metadata:s.g1(s.Yj(),s.bz()).optional(),payment_route_id:_(s.Yj()),customer_language:_(s.Yj())}),s.Ik({status:s.k5(["success","failure","cancelled"]),href:s.Yj().optional().nullable()}),s.Ik({href:s.Yj().optional().nullable()}),s.Ik({type:s.Yj(),redirect_url:s.Yj(),initial_intent_id:s.Yj(),consent_id:s.Yj(),their_pm_id:s.Yj().optional()});let K=s.Ik({bank_name:s.Yj(),display_name:s.Yj(),resources:s.Ik({logo_url:s.Yj().optional()})}),Z=s.Ik({type:s.Yj(),redirect_url:_(s.Yj()),initial_intent_id:_(s.Yj()),consent_id:_(s.Yj()),their_pm_id:_(s.Yj()),payment_session:_(s.g1(s.Yj(),s.bz())),available_banks:_(s.YO(K))});s.gM("present",[s.Ik({present:s.eu(!0),href:s.Yj()}),s.Ik({present:s.eu(!1)})]),s.Ik({payment_methods:s.YO(P),pay_first_success_response:_($),required_user_actions:_(s.YO(Z)),post_checkout_redirect_to:_(s.Yj()),checkout_success_response:_($)});let J=s.Ik({institutionNumber:s.Yj(),transitNumber:s.Yj(),accountNumber:s.Yj(),accountType:s.k5(["personal","business"])});s.Ik({status:s.k5(["success","failure"]),payload:J.optional()});let W=s.Ik({sortCode:s.Yj(),accountNumber:s.Yj(),accountType:s.k5(["personal","business"])});s.Ik({status:s.k5(["success","failure"]),payload:W.optional()});let Q=s.Ik({iban:s.Yj(),accountType:s.k5(["personal","business"])});s.Ik({status:s.k5(["success","failure"]),payload:Q.optional()});let X=s.Ik({account_number:s.Yj(),aba_routing_number:s.Yj()}),ee=s.Ik({institution_number:s.Yj(),transit_number:s.Yj(),account_number:s.Yj()}),et=s.Ik({account_number:s.Yj(),sort_code:s.Yj()}),er=s.Ik({iban:s.Yj()});s.Ik({status:s.k5(["success","failure"]),payload:s.KC([X,ee,et,er,s.Ik({error:s.Yj()})]).optional()});let eo=e=>s.me(e.optional());s.Yj().trim().min(1,{message:"Cannot be blank"}),s.Ik({cde_response_type:s.eu("error"),message:s.Yj(),headers:s.g1(s.Yj(),s.Yj()).optional()}),s.k5(["usd","brl"]);let en=s.Ik({name:s.Yj(),amount_atom_off:eo(s.ai()),percent_off:eo(s.ai()),currency:eo(s.Yj()),duration:s.Yj(),duration_in_months:eo(s.ai())}),ea=s.Ik({amount_subtotal_atom:s.ai().int(),amount_total_atom:s.ai().int(),currency:s.Yj(),description:eo(s.Yj()),price_id:s.Yj(),billing_interval:eo(s.Yj()),billing_interval_count:eo(s.ai().int()),quantity:s.ai().int()}),ei=s.g1(s.Yj(),s.bz()),es=s.Ik({name:s.Yj(),settings:eo(ei)}),el=s.Ik({provider:s.Yj(),processor_name:eo(s.Yj()),metadata:eo(s.g1(s.Yj(),s.bz()))}),ec=s.Ik({quantity:s.ai()}),eu=s.Ik({id:eo(s.Yj()),billing_interval:eo(s.Yj()),billing_interval_count:eo(s.ai().int()),subscription_items:s.YO(ec),trial_start:eo(s.Yj()),trial_end:eo(s.Yj())}),ed=s.Ik({amount_atom:s.ai()}),ep=s.Ik({amount_atom:s.ai(),amount_atom_considering_discount_applied:s.ai(),currency:s.Yj(),discount_amount_atoms:s.YO(ed),subscription_item_id:s.Yj()}),em=s.Ik({coupon:en}),eh=s.Ik({currency:s.Yj(),discounts:s.YO(em),hosted_invoice_url:eo(s.Yj()),lines:s.YO(ep),remaining_amount_atom:s.ai(),tax_amount_atom:s.ai(),total_amount_atom:s.ai(),total_discount_amount_atoms:s.YO(ed)}),e_=s.Ik({created:s.YO(eu),invoices:s.YO(eh),processors_used:eo(s.YO(s.Yj())),payment_method_id:eo(s.Yj())}),ef=s.Ik({preview:e_,preview_post_trial:eo(e_),coupons:s.YO(en)}),ey=s.Ik({status:s.eu("open"),locale:eo(s.Yj()),token:s.Yj(),email:eo(s.Yj()),checkout_settings:s.g1(s.Yj(),s.bz()),line_items:s.YO(ea),amount_subtotal_atom:s.ai().int(),amount_total_atom:s.ai().int(),brand:es,subs_preview:eo(ef),methods_available:s.YO(el),return_url:eo(s.Yj()),success_url:eo(s.Yj()),final_feature_rollout_settings:eo(s.g1(s.Yj(),s.bz()))}
1),eg=s.gM("mode",[s.Ik({mode:s.eu("setup"),currency:s.me(s.Vx())}).extend(ey.shape),s.Ik({mode:s.k5(["payment","subscription"]),currency:s.Yj()}).extend(ey.shape)]),ew=s.Ik({status:s.eu("complete")}),ev=s.Ik({status:s.eu("expired")});s.KC([eg,ew,ev]),s.Ik({logo:s.Yj(),icon:s.Yj(),primary_color:s.Yj(),secondary_color:s.Yj()}),s.Ik({secure_token:s.Yj(),pm_id:s.Yj()});let eb=s.Ik({line1:s.Yj().optional(),line2:s.Yj().optional(),line3:s.Yj().optional(),city:s.Yj().optional(),state:s.Yj().optional(),country:s.Yj(),zip_code:s.Yj().optional()});s.Ik({secure_token:s.Yj(),payment_input:s.bz(),customer_email:s.Yj(),customer_last_name:s.Yj().optional(),customer_first_name:s.Yj().optional(),customer_address:eb,customer_shipping_address:eb.optional(),line_items:s.YO(ea),total_amount_atom:s.ai().int(),cancel_at_end:s.zM(),checkout_payment_method:el,promotion_code:s.Yj().optional(),do_not_use_legacy_cc_flow:s.zM().optional(),use_confirmed_pm_id:eo(s.Yj()),payment_route_id:eo(s.Yj())}),s.Ik({payment_method_id:s.Yj()}),s.Ik({id:s.Yj(),return_url:s.Yj()});let ek=s.Ik({type:s.Yj(),loc:s.YO(s.Yj()),msg:s.Yj(),url:s.Yj()});s.YO(ek);let eP=s.Ik({new_customer_email:s.Yj().optional(),new_customer_last_name:s.Yj().optional(),new_customer_first_name:s.Yj().optional(),customer_business_name:s.Yj().optional(),customer_tax_id:s.Yj().optional(),customer_tax_id_type:s.Yj().optional(),new_customer_address:eb,new_customer_shipping_address:eb.optional(),customer_language:s.Yj().optional(),new_customer_phone:s.Yj().optional()}),eI=s.Ik({price_id:s.Yj(),quantity:s.ai().int()}),eE=s.Ik({line_items:s.YO(eI),promotion_code:s.Yj().optional(),displayed_total_amount_atom:s.ai().int()}),eC=s.Ik({processor_specific_metadata:eo(s.g1(s.Yj(),s.bz()))});s.Ik({payment_provider:s.Yj(),checkout_payment_method:el,existing_cc_pm_id:s.Yj().optional(),their_existing_pm_id:s.Yj().optional(),use_pay_first_flow:s.zM().optional(),pay_first_flow_cart_info:eE.optional(),customer_language:s.Yj().optional()}).extend(eP.shape).extend(eC.shape),s.Ik({required_user_actions:s.YO(s.g1(s.Yj(),s.bz())),checkout_attempt_id:eo(s.Yj())}),s.Ik({fields:D,checkoutPaymentMethod:el,payment_route_id:eo(s.Yj())}),s.Ik({session_id:s.Yj(),non_cde_form_fields:F,checkout_payment_method:el,extra_metadata:s.g1(s.Yj(),s.bz()),use_unified_cc_flow:eo(s.zM()),pay_first_flow_cart_info:eE.optional(),payment_route_id:eo(s.Yj()),customer_language:s.Yj().optional(),existing_cc_pm_id:eo(s.Yj())}),s.Ik({required_user_actions:s.YO(s.g1(s.Yj(),s.bz())),cc_pm_id:s.Yj(),checkout_success_response:eo($),checkout_attempt_id:eo(s.Yj())}),s.g1(s.bz()),s.Ik({first_name:eo(s.Yj()),last_name:eo(s.Yj()),line1:eo(s.Yj()),line2:eo(s.Yj()),line3:eo(s.Yj()),city:eo(s.Yj()),state:eo(s.Yj()),country:eo(s.Yj()),zip_code:eo(s.Yj()),email:eo(s.Yj()),billing_email:eo(s.Yj()),phone_number:eo(s.Yj()),business_name:eo(s.Yj()),tax_id:eo(s.Yj()),tax_id_type:eo(s.Yj()),update_processor_customer:eo(s.zM())}),s.Ik({id:s.Yj(),email:eo(s.Yj()),first_name:eo(s.Yj()),last_name:eo(s.Yj()),phone_number:eo(s.Yj()),billing_email:eo(s.Yj()),address:eo(s.g1(s.Yj(),s.bz()))}),s.Ik({message:s.Yj()}),s.Ik({error_code:s.Yj()}),s.Ik({checkout_payment_method:el,processor_specific_metadata:s.g1(s.bz()).optional(),payment_route_id:eo(s.Yj())}),s.Ik({next_action_metadata:eo(s.g1(s.bz()))}),s.Ik({events:s.YO(s.Ik({event_name:s.Yj(),device_token:s.Yj(),properties:s.g1(s.bz()).optional(),context_properties:s.g1(s.bz()).optional()}))}),s.bz().optional(),s.Ik({device_token:s.Yj()}),s.Ik({}),s.Ik({_unified_cc_action_name:s.Yj(),_unified_cc_pccs_id:s.Yj()}).catchall(s.bz());let eS=s.Ik({type:s.Yj(),loc:s.YO(s.Yj()),msg:s.Yj(),url:s.Yj()});s.YO(eS);let eA=s.Ik({code:s.Yj(),message:s.Yj(),path:s.YO(s.Yj())});s.YO(eA);let ej=e=>{let t=(...t)=>{window.console.log(`${l.Ay.green.bold("ojs/")}${l.Ay.bold.gray(`${e}`)} `,...t)}
1,r=(...t)=>{window.console.warn(`${l.Ay.red.bold("ojs/")}${l.Ay.bold.gray(`${e}`)} `,...t)};return{log:t,err:r,log__:t,err__:r}};var eY=function(e,t){return(eY=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function ex(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}eY(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function eT(e,t){var r,o,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&c[0]?o.return:c[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,c[1])).done)return n;switch(o=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,o=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){a.label=c[1];break}if(6===c[0]&&a.label<n[1]){a.label=n[1],n=c;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(c);break}n[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],o=0}finally{r=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function eN(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function eR(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function eL(e,t,r){if(r||2==arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function eM(e){return this instanceof eM?(this.v=e,this):new eM(e)}function eO(e){return"function"==typeof e}function eF(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var eD=eF(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription: 2`+t.map(function(e,t){return t+1+") "+e.toString()}).join(` 3 `):"",this.name="UnsubscriptionError",this.errors=t}});function eU(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var eq=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,t,r,o,n;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var i=eN(a),s=i.next();!s.done;s=i.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(eO(l))try{l()}catch(e){n=e instanceof eD?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=eN(c),d=u.next();!d.done;d=u.next()){var p=d.value;try{eV(p)}catch(e){n=n??[],e instanceof eD?n=eL(eL([],eR(n)),eR(e.errors)):n.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}if(n)throw new eD(n)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)eV(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!=(r=this._finalizers)?r:[]).push(e)}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&eU(t,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&eU(r,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),ez=eq.EMPTY;function eG(e){return e instanceof eq||e&&"closed"in e&&eO(e.remove)&&eO(e.add)&&eO(e.unsubscribe)}function eV(e){eO(e)?e():e.unsubscribe()}var e$={Promise:void 0},eH={setTimeout:function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];return setTimeout.apply(void 0,eL([e,t],eR(r)))}};function eB(e){eH.setTimeout(function(){throw e})}function eK(){}var eZ=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,eG(t)&&t.add(r)):r.destination=eQ,r}return ex(t,e),t.create=function(e,t,r){return new eW(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(eq),eJ=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){eB(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){eB(e)}else eB(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){eB(e)}},e}(),eW=function(e){function t(t,r,o){var n=e.call(this)||this;return n.destination=new eJ(eO(t)||!t?{next:t??void 0,error:r??void 0,complete:o??void 0}:t),n}return ex(t,e),t}(eZ),eQ={closed:!0,next:eK,error:function(e){throw e},complete:eK},eX="function"==typeof Symbol&&Symbol.observable||"@@observable",e0=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var o,n,a=this,i=!function(e){return e&&e instanceof eZ||e&&eO(e.next)&&eO(e.error)&&eO(e.complete)&&eG(e)}(e)?new eW(e,t,r):e;return o=a.operator,n=a.source,i.add(o?o.call(i,n):n?a._subscribe(i):a._trySubscribe(i)),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=e1(t))(function(t,o){var n=new eW({next:function(t){try{e(t)}catch(e){o(e),n.unsubscribe()}},error:o,complete:t});r.subscribe(n)})},e.prototype._subscribe=function(e){var t;return null==(t=this.source)?void 0:t.subscribe(e)},e.prototype[eX]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===e.length?function(e){return e}:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=e1(e))(function(e,r){var o;t.subscribe(function(e){return o=e},function(e){return r(e)},function(){return e(o)})})},e.create=function(t){return new e(t)},e}();function e1(e){var t;return null!=(t=e??e$.Promise)?t:Promise}var e3=function(e){function t(t,r,o,n,a,i){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=i,s._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=n?function(e){try{n(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=o?function(){try{o()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return ex(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),r||null==(t=this.onFinalize)||t.call(this)}},t}(eZ),e2=eF(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),e5=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return ex(t,e),t.prototype.lift=function(e){var t=new e4(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new e2},t.prototype.next=function(e){var t,r;if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));try{for(var o=eN(this.currentObservers),n=o.next();!n.done;n=o.next())n.value.next(e)}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}},t.prototype.error=function(e){if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;for(var t=this.observers;t.length;)t.shift().error(e)}},t.prototype.complete=function(){if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;for(var e=this.observers;e.length;)e.shift().complete()}},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null==(e=this.observers)?void 0:e.length)>0}
3,enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this.hasError,o=this.isStopped,n=this.observers;return r||o?ez:(this.currentObservers=null,n.push(e),new eq(function(){t.currentObservers=null,eU(n,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,r=this.thrownError,o=this.isStopped;t?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new e0;return e.source=this,e},t.create=function(e,t){return new e4(e,t)},t}(e0),e4=function(e){function t(t,r){var o=e.call(this)||this;return o.destination=t,o.source=r,o}return ex(t,e),t.prototype.next=function(e){var t,r;null==(r=null==(t=this.destination)?void 0:t.next)||r.call(t,e)},t.prototype.error=function(e){var t,r;null==(r=null==(t=this.destination)?void 0:t.error)||r.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=null==(e=this.destination)?void 0:e.complete)||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!=(r=null==(t=this.source)?void 0:t.subscribe(e))?r:ez},t}(e5),e6={now:function(){return Date.now()}},e8=function(e){function t(t,r){return e.call(this)||this}return ex(t,e),t.prototype.schedule=function(e,t){return this},t}(eq),e9={setInterval:function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];return setInterval.apply(void 0,eL([e,t],eR(r)))},clearInterval:function(e){return clearInterval(e)}},e7=function(e){function t(t,r){var o=e.call(this,t,r)||this;return o.scheduler=t,o.work=r,o.pending=!1,o}return ex(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r,o=this.id,n=this.scheduler;return null!=o&&(this.id=this.recycleAsyncId(n,o,t)),this.pending=!0,this.delay=t,this.id=null!=(r=this.id)?r:this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),e9.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&e9.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,o=!1;try{this.work(e)}catch(e){o=!0,r=e||Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,o=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,eU(o,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(e8),te=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=e6.now,e}(),tt=new(function(e){function t(t,r){void 0===r&&(r=te.now);var o=e.call(this,t,r)||this;return o.actions=[],o._active=!1,o}return ex(t,e),t.prototype.flush=function(e){var t,r=this.actions;if(this._active)return void r.push(e);this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,t){for(;e=r.shift();)e.unsubscribe();throw t}},t}(te))(e7),tr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function to(e){return new e0(function(t){(function(e,t){var r,o,n,a,i,s,l,c;return i=this,s=void 0,l=void 0,c=function(){var i;return eT(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),r=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=eN(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(r){t[r]=e[r]&&function(t){return new Promise(function(o,n){var a,i,s;a=o,i=n,s=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){a({value:e,done:s})},i)})}}}(e),s.label=1;case 1:return[4,r.next()];case 2:if((o=s.sent()).done)return[3,4];if(i=o.value,t.next(i),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return n={error:s.sent()},[3,11];case 6:return s.trys.push([6,,9,10]),o&&!o.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];
3case 10:return[7];case 11:return t.complete(),[2]}})},new(l||(l=Promise))(function(e,t){function r(e){try{n(c.next(e))}catch(e){t(e)}}function o(e){try{n(c.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):((n=t.value)instanceof l?n:new l(function(e){e(n)})).then(r,o)}n((c=c.apply(i,s||[])).next())})})(e,t).catch(function(e){return t.error(e)})})}var tn=eF(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}),ta=eF(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function ti(e){throw new ta(e)}class ts{constructor(){this.set=e=>{if("success"===this._current.status)throw Error("LoadedOnce is already in success state");this._current={status:"success",isSuccess:!0,loadedValue:e},this._subject.next(e),this._subject.complete()},this.throw=(e,t)=>{if("success"===this._current.status)throw Error("LoadedOnce is already in success state");this._current={status:"error",isSuccess:!1,error:e,errMsg:t},this._subject.error(e)},this.getValueIfLoadedElse=e=>"success"===this._current.status?this._current.loadedValue:e,this.subscribe=e=>{if("success"===this._current.status)return void e(this._current);"error"===this._current.status&&e(this._current);let t=this._subject.subscribe({next:()=>{if("success"!==this._current.status)throw Error("Invalid state (next): please make sure to update _current before the subject");e(this._current),t.unsubscribe()},error:()=>{if("error"!==this._current.status)throw Error("Invalid state (error): please make sure to update _current before the subject");e(this._current)}})},this.waitForLoad=e=>{var t;if("success"===this._current.status)return Promise.resolve(this._current.loadedValue);if("error"===this._current.status)return Promise.reject(this._current.error);"initial"!==this._current.status&&function(e){throw Error(`Unhandled case: ${e}`)}(this._current);let r={first:1e3*e.timeoutSec,with:()=>(function(e,t){var r=eO(e)?e:function(){return e};return new e0(function(e){return e.error(r())})})(()=>Error(e.timeoutErrMsg))};return t=this._subject.pipe(function(e,t){var r,o=e instanceof Date&&!isNaN(e)?{first:e}:"number"==typeof e?{each:e}:e,n=o.first,a=o.each,i=o.with,s=void 0===i?ti:i,l=o.scheduler,c=void 0===l?tt:l,u=o.meta,d=void 0===u?null:u;if(null==n&&null==a)throw TypeError("No timeout provided.");return r=function(e,t){var r,o,i=null,l=0,u=function(e){o=function(e,t,r,o,n){void 0===o&&(o=0),void 0===n&&(n=!1);var a=t.schedule(function(){r(),n?e.add(this.schedule(null,o)):this.unsubscribe()},o);if(e.add(a),!n)return a}(t,c,function(){try{r.unsubscribe(),(function(e){if(e instanceof e0)return e;if(null!=e){var t,r,o,n,a;if(eO(e[eX])){return t=e,new e0(function(e){var r=t[eX]();if(eO(r.subscribe))return r.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")})}if(e&&"number"==typeof e.length&&"function"!=typeof e){return r=e,new e0(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}if(eO(e?.then)){return o=e,new e0(function(e){o.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,eB)})}if(Symbol.asyncIterator&&eO(e?.[Symbol.asyncIterator]))return to(e);if(eO(e?.[tr])){return n=e,new e0(function(e){var t,r;try{for(var o=eN(n),a=o.next();!a.done;a=o.next()){var i=a.value;if(e.next(i),e.closed)return}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}e.complete()})}if(eO(e?.getReader)){return a=e,to(function(e){return function(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var o,n=r.apply(e,t||[]),a=[];return o=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(e,t){n[e]&&(o[e]=function(t){return new Promise(function(r,o){a.push([e,t,r,o])>1||s(e,t)})},t&&(o[e]=t(o[e])))}function s(e,t){try{var r;(r=n[e](t)).value instanceof eM?Promise.resolve(r.value.v).then(l,c):u(a[0][2],r)}catch(e){u(a[0][3],e)}}function l(e){s("next",e)}function c(e){s("throw",e)}function u(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}(this,arguments,function(){var t,r,o;return eT(this,function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,eM(t.read())];case 3:return o=(r=n.sent()).value,r.done?[4,eM(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,eM(o)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}
3(a))}}throw TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")})(s({meta:d,lastValue:i,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};r=e.subscribe(new e3(t,function(e){o?.unsubscribe(),l++,t.next(i=e),a>0&&u(a)},void 0,void 0,function(){o?.closed||o?.unsubscribe(),i=null})),l||u(null!=n?"number"==typeof n?n:n-c.now():a)},function(e){if(eO(e?.lift))return e.lift(function(e){try{return r(e,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}(r)),new Promise(function(e,r){var o,n=!1;t.subscribe({next:function(e){o=e,n=!0},error:r,complete:function(){n?e(o):r(new tn)}})})},this._current={status:"initial",isSuccess:!1},this._subject=new e5}get current(){return this._current}}s.k5(["dev","stg","prod"]);let tl={prod:"https://connto.getopenpay.com",stg:"https://connto.openpaystaging.com",dev:"http://localhost:8000"},tc=()=>{if(!(typeof window>"u"))return window},tu=new ts,td="op_metrics_queue",{log__:tp}=ej("op-metrics");class tm{constructor(){this.queue=[],this.processingQueue=!1,this.batchTimeout=null,this.lastEventTimestamp=0,this.offlineListener=()=>{tp("Network offline, metrics will be queued"),this.cancelBatchProcessing()},this.onlineListener=()=>{tp("Network online, processing metrics queue"),this.processQueue()},this.loadQueueFromStorage(),tc()?.addEventListener("offline",this.offlineListener),tc()?.addEventListener("online",this.onlineListener)}addEvent(e,t,r){let o={eventName:e,properties:t||{},contextProperties:r||{},nonce:(0,c.A)(),timestamp:Date.now(),datetime:new Date().toISOString(),attemptCount:0,timeDiffFromPreviousEvent:this.lastEventTimestamp?Date.now()-this.lastEventTimestamp:0};this.lastEventTimestamp=o.timestamp,this.queue.push(o),this.saveQueueToStorage(),this.scheduleBatchProcessing()}loadQueueFromStorage(){try{let e=tc()?.localStorage?.getItem(td);e&&(this.queue=JSON.parse(e))}catch{this.queue=[],this.saveQueueToStorage()}}saveQueueToStorage(){tc()?.localStorage.setItem(td,JSON.stringify(this.queue))}scheduleBatchProcessing(){let e=tc();e&&navigator.onLine&&!this.processingQueue&&this.queue.length>0&&!this.batchTimeout&&(this.batchTimeout=e.setTimeout(()=>{this.batchTimeout=null,this.processQueue()},1e3))}cancelBatchProcessing(){this.batchTimeout&&(tc()?.clearTimeout(this.batchTimeout),this.batchTimeout=null),this.processingQueue=!1}processQueue(){!navigator.onLine||this.processingQueue||0===this.queue.length||(this.processingQueue=!0,this.sendBatch().finally(()=>{this.processingQueue=!1,this.queue.length>0&&this.scheduleBatchProcessing()}))}async sendBatch(){if(0===this.queue.length)return;let e=tu.getValueIfLoadedElse(void 0);if(!e)return void tp("Metrics context not available, will retry later");let t=this.queue.slice(0,3);try{let r={events:t.map(t=>({event_name:t.eventName,device_token:e.deviceToken,context_properties:{...e,...t.contextProperties},properties:{nonce:t.nonce,datetime:t.datetime,timestamp:t.timestamp,time_diff_from_previous_event:t.timeDiffFromPreviousEvent,checkout_secure_token:e.checkoutSecureToken,...t.properties}}))},o=tl[e.environment],n=new URL("/metrics/public/capture",o);(await fetch(n.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),keepalive:!0})).ok?(this.queue=this.queue.slice(t.length),this.saveQueueToStorage()):this.handleFailedBatch(t)}catch(e){tp("Error sending metrics batch:",e),this.handleFailedBatch(t)}}handleFailedBatch(e){e.forEach(e=>{e.attemptCount++});let t=e.filter(e=>e.attemptCount<3);this.queue=this.queue.slice(e.length),this.queue=[...t,...this.queue],this.saveQueueToStorage()}cleanup(){tc()?.removeEventListener("offline",this.offlineListener),tc()?.removeEventListener("online",this.onlineListener),this.cancelBatchProcessing()}}new tm,s.Ik({stripe_pk:s.Yj(),client_secret:s.Yj(),stripe_pm_id:s.Yj()}),s.Ik({type:s.Yj(),client_secret:s.Yj(),stripe_pk:s.Yj()});let{log__:th,err__:t_}=ej("common-cc"),tf=s.k5(["stripe","airwallex","authorize_net","adyen","paypal","pockyt","loop"]);tf.Enum.stripe,s.Ik({"op-airwallex-3ds-url":s.Yj(),"op-airwallex-initial-intent-id":s.Yj(),"op-airwallex-consent-id":s.Yj()}),s.Ik({provider:s.eu("apple_pay"),processor_name:s.eu("airwallex"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj()})}),s.Ik({provider:s.eu("google_pay"),processor_name:s.eu("airwallex"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj(),google_pay_merchant_id:s.Yj().nullish()})});let ty={isAvailable:!1,isLoading:!0,startFlow:async()=>{}};s.Ik({data:s.Ik({messageHeaders:s.g1(s.Yj(),s.bz()),errors:s.YO(s.bz()),messageType:s.Yj(),messageBody:s.g1(s.Yj(),s.bz())}),origin:s.eu("https://applepay.cdn-apple.com")});let tg=s.k5(["test","live","live-us","live-in","live-apse","live-au"]);
3s.k5(["ar","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","el-GR","en-US","es-ES","et-EE","fi-FI","fr-FR","hr-HR","hu-HU","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nl-NL","no-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","zh-CN","zh-TW"]),s.Ik({"op-account-id":s.Yj(),"op-adyen-client-key":s.Yj(),"op-adyen-environment":tg,"op-adyen-action":s.Yj()}),s.Ik({provider:s.eu("apple_pay"),processor_name:s.eu("adyen"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj()})}),s.Ik({provider:s.eu("google_pay"),processor_name:s.eu("adyen"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj(),google_pay_merchant_id:s.Yj().nullish()})}),s.Ik({provider:s.eu("klarna"),metadata:s.Ik({}).nullish(),processor_name:s.eu("airwallex")}),s.Ik({provider:s.eu("apple_pay"),processor_name:s.eu("authorize_net"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj()})}),s.Ik({provider:s.eu("google_pay"),processor_name:s.eu("authorize_net"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj(),google_pay_merchant_id:s.Yj().nullish()})}),s.Ik({step_up_url:s.Yj(),access_token:s.Yj(),dd_url:_(s.Yj()),dd_token:_(s.Yj()),merchant_data:s.Yj()}
3),s.Ik({"op-pockyt-3ds-url":s.Yj(),"op-pockyt-txn-no":s.Yj(),"op-pockyt-ref-no":s.Yj()}),s.Ik({stripe_pk:s.Yj(),client_secret:s.Yj(),stripe_pm_id:s.Yj()}),s.YO(s.Ik({our_existing_pm_id:s.Yj()})).length(1),s.Ik({processor_name:s.eu("loop"),provider:s.eu("crypto"),metadata:s.Ik({merchant_id:s.Yj(),entity_id:s.Yj(),api_token:s.Yj(),supported_currencies:s.YO(s.Yj()),environment:s.Yj()})});var tw=(e=>(e.Local="local",e.Development="development",e.Staging="staging",e.Demo="demo",e.Production="production",e))(tw||{}),tv=(e=>(e.METHOD_CREATION_FAILED="methodCreationFailed",e.INSUFFICIENT_BALANCE="insufficientBalance",e.INSUFFICIENT_AUTHORIZATION="insufficientAuthorization",e.SIGNED_MESSAGE_REQUIRED="signedMessageRequired",e.CUSTOMER_CREATION_FAILED="customerCreationFailed",e.PAYMENT_FAILED="paymentFailed",e.TRANSACTION_FAILED="transactionFailed",e))(tv||{}),tb=(e=>(e.IDLE="idle",e.CONFIRMING_BALANCE="confirmingBalance",e.CONFIRMING_AUTHORIZATION="confirmingAuthorization",e.UPDATING_AUTHORIZATION="updatingAuthorization",e.SIGNING_MESSAGE="signingMessage",e.CREATING_CUSTOMER="creatingCustomer",e.CREATING_PAYMENT_METHOD="creatingPaymentMethod",e.PROCESSING_PAYMENT="processingPayment",e.CREATING_PAYMENT="creatingPayment",e.CONFIRMING_PAYMENT="confirmingPayment",e.COMPLETE="complete",e.AUTHORIZED="authorized",e))(tb||{});let tk={isAvailable:!1,isLoading:!0,config:null,widget:null};s.Ik({provider:s.eu("paypal"),metadata:s.Ik({client_id:s.Yj()}),processor_name:s.eu("paypal")}),s.Ik({processor_name:s.eu("pockyt"),provider:s.eu("paypal")}),s.YO(s.Ik({paypal_iframe_url:s.Yj(),verify_token:s.Yj()})).length(1),s.Ik({provider:s.eu("affirm"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),s.YO(s.Ik({our_existing_pm_id:s.Yj().nullish(),client_secret:s.Yj()})).length(1),s.Ik({provider:s.eu("afterpay"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),s.YO(s.Ik({our_existing_pm_id:s.Yj().nullish(),client_secret:s.Yj()})).length(1),s.Ik({provider:s.eu("klarna"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),s.YO(s.Ik({our_existing_pm_id:s.Yj().nullish(),client_secret:s.Yj()})).length(1),s.Ik({provider:s.eu("stripe_link"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),s.YO(s.Ik({our_existing_pm_id:s.Yj()})).length(1),s.Ik({provider:s.KC([s.eu("apple_pay"),s.eu("google_pay")]),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})});let{err__:tP}=ej("form-callbacks"),tI=s.fH().optional(),tE=s.Ik({onFocus:tI,onBlur:tI,onChange:tI,onLoad:tI,onLoadError:tI,onValidationError:tI,onCheckoutStarted:tI,onCheckoutSuccess:tI,onSetupPaymentMethodSuccess:tI,onCheckoutError:tI,onPaymentRequestLoad:tI}),tC=class e{constructor(){this.setCallbacks=t=>{this._callbacks=e.createEmptyCallbacks(),Object.entries(t).forEach(([t,r])=>{let o,n=(o=r??e.NOOP,(...e)=>{try{return o(...e)}catch(e){tP(`[form] Error running callback (${t}):`,e);return}});this._callbacks[t]=n})},this._callbacks=e.createEmptyCallbacks()}get get(){return{...this._callbacks}}};tC.NOOP=()=>{},tC.createEmptyCallbacks=()=>{let e={};return Object.keys(tE.keyof().enum).forEach(t=>{e[t]=tC.NOOP}),e},tC.fromObject=e=>{let t=new tC;return t.setCallbacks(tE.parse(e)),t};var tS=(e=>(e.card="card",e.pockytPaypal="pockyt-paypal",e.applePay="apple-pay",e.googlePay="google-pay",e.loopCrypto="loop-crypto",e.paypal="paypal",e.klarna="klarna",e.affirm="affirm",e.afterpay="afterpay",e.stripeLink="stripe-link",e.airwallexGooglePay="airwallex-google-pay",e.airwallexApplePay="airwallex-apple-pay",e.authorizenetGooglePay="authorizenet-google-pay",e.authorizenetApplePay="authorizenet-apple-pay",e.adyenGooglePay="adyen-google-pay",e.adyenApplePay="adyen-apple-pay",e.airwallexACH="airwallex-ach",e.airwallexEFT="airwallex-eft",e.airwallexBACS="airwallex-bacs",e.airwallexSEPA="airwallex-sepa",e))(tS||{});s.fc(tS);let tA={isLoading:!0,isAvailable:!1,processors:[],startFlow:async()=>{console.warn(`startFlow triggered while payment request is still not ready. 4 You can check the ".isLoading" param to know when a payment request is still loading, 5 and ".isAvailable" to know if a payment request is available.`)}},tj=(0,d.createContext)({formId:"",formHeight:"",referrer:void 0,checkoutSecureToken:void 0,registerIframe:()=>{},baseUrl:""}),tY=e=>{let{elementType:t,styles:r}=e,{formId:o,referrer:n,formHeight:a,checkoutSecureToken:i,registerIframe:s,baseUrl:l}=(()=>{let e=(0,d.useContext)(tj);if(!e)throw Error("useOpenPayElements must be used within an OpenPayElementsProvider");return e})(),c=t.toLowerCase(),[p,m]=(0,d.useState)(!1),h=(0,d.useRef)(null),_=(0,d.useMemo)(()=>r?JSON.stringify(r):"",[r]),f=(0,d.useMemo)(()=>({border:"none",width:"100%",height:a}),[a]),y=(0,d.useMemo)(()=>
5{if(!i||!n)return"";let e=new URLSearchParams;return e.append("referer",n),e.append("styles",_),e.append("formId",o),e.append("secureToken",i),e.toString()},[_,o,n,i]);if((0,d.useEffect)(()=>m(!0),[]),(0,d.useEffect)(()=>{h.current&&p&&s(t,h.current)},[p]),!i)return console.error("[form] Cannot render partially initialized frame"),(0,u.jsx)("div",{});let g=new URL(`/app/v1/${c}-element/`,l);return g.search=y,(0,u.jsx)("iframe",{id:`ojs-${c}-element`,name:`${c}-element`,className:"ojs-iframe",src:g.toString(),style:f,ref:h})},tx=({styles:e})=>(0,u.jsx)(tY,{styles:e,elementType:b.CARD_CVC}),tT=({styles:e})=>(0,u.jsx)(tY,{styles:e,elementType:b.CARD_EXPIRY}),tN=({styles:e})=>(0,u.jsx)(tY,{styles:e,elementType:b.CARD_NUMBER});var tR=function(){var e=function(t,r){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),tL=function(e){function t(t,r){var o,n,a,i,s=this.constructor,l=e.call(this,t,r)||this;return Object.defineProperty(l,"name",{value:s.name,enumerable:!1,configurable:!0}),o=s.prototype,(n=Object.setPrototypeOf)?n(l,o):l.__proto__=o,void 0===a&&(a=l.constructor),(i=Error.captureStackTrace)&&i(l,a),l}return tR(t,e),t}(Error);let tM=s.Yj().trim().min(1,{message:"Please fill in this field"}),tO=s.Yj().trim().optional(),tF=e=>s.me(e.optional());var tD=(e=>(e.FIRST_NAME="firstName",e.LAST_NAME="lastName",e.PHONE="phone",e.EMAIL="email",e.LINE1="line1",e.LINE2="line2",e.LINE3="line3",e.CITY="city",e.STATE="state",e.COUNTRY="country",e.ZIP_CODE="zipCode",e.SHIPPING_LINE1="shippingAddressLine1",e.SHIPPING_LINE2="shippingAddressLine2",e.SHIPPING_LINE3="shippingAddressLine3",e.SHIPPING_CITY="shippingAddressCity",e.SHIPPING_STATE="shippingAddressState",e.SHIPPING_COUNTRY="shippingAddressCountry",e.SHIPPING_ZIP_CODE="shippingAddressZipCode",e.IS_SHIPPING_SAME_AS_BILLING="isShippingSameAsBilling",e.PROMOTION_CODE="promotionCode",e.IS_BUSINESS_PURCHASE="isBusinessPurchase",e.BUSINESS_NAME="businessName",e.TAX_ID="taxId",e.TAX_ID_TYPE="taxIdType",e))(tD||{});let tU=s.fc(tD);var tq=(e=>(e.CARD_NUMBER="cardNumber",e.CARD_EXPIRY="cardExpiry",e.CARD_CVC="cardCvc",e))(tq||{});let tz=s.fc(tq),tG=s.KC([tU,tz]);var tV=(e=>(e.CARD="card",e.CARD_NUMBER="card-number",e.CARD_EXPIRY="card-expiry",e.CARD_CVC="card-cvc",e.CDE_BRIDGE="cde-bridge",e))(tV||{});let t$=s.k5(["card","card-number","card-expiry","card-cvc","cde-bridge"]),tH=s.Ik({provider:s.Yj(),processor_name:tF(s.Yj()),metadata:tF(s.g1(s.Yj(),s.bz()))}),tB=s.Ik({id:s.Yj()}),tK=s.Ik({backgroundColor:tO,color:tO,fontFamily:tO,fontSize:tO,fontWeight:tO,margin:tO,padding:tO,letterSpacing:tO,lineHeight:tO,hideIcon:tO,placeholderStyle:s.Ik({color:tO,fontSize:tO,fontWeight:tO,fontFamily:tO,letterSpacing:tO,lineHeight:tO}).optional()});tK.extend({disableAutoFill:tO,placeholder:s.Ik({cardNumber:tO,expiry:tO,cvc:tO}).optional()}),tK.extend({disableAutoFill:tO,placeholder:s.Yj().optional(),icon:s.Ik({color:s.Yj().optional()}).optional()}),tK.extend({disableAutoFill:tO,placeholder:s.Yj().optional()}),tK.extend({disableAutoFill:tO,placeholder:s.Yj().optional()});let tZ=s.k5(["LAYOUT","LOADED","BLUR","FOCUS","CHANGE","TOKENIZE_STARTED","CHECKOUT_STARTED","PAYMENT_FLOW_STARTED","TOKENIZE_SUCCESS","CHECKOUT_SUCCESS","LOAD_ERROR","VALIDATION_ERROR","TOKENIZE_ERROR","CHECKOUT_ERROR","SETUP_PAYMENT_METHOD_SUCCESS","TOKENIZE","CHECKOUT","START_PAYMENT_FLOW"]),tJ=tZ.extract(["TOKENIZE_STARTED","CHECKOUT_STARTED"]),tW=s.Ik({type:tJ}),tQ=tZ.extract(["BLUR","FOCUS","CHANGE"]),tX=s.Ik({type:tQ,elementType:tz,errors:s.YO(s.Yj()).optional(),obfuscatedValue:s.Yj().optional()}),t0=tZ.extract(["LOAD_ERROR","TOKENIZE_ERROR","CHECKOUT_ERROR"]),t1=s.Ik({type:t0,message:tM,headers:s.g1(s.Yj(),s.Yj()).optional()}),t3=tZ.extract(["VALIDATION_ERROR"]),t2=s.Ik({type:t3,elementType:tG,errors:s.YO(s.Yj())}),t5=s.Ik({type:s.eu(tZ.enum.LAYOUT),height:tM}),t4=s.Ik({type:s.eu(tZ.enum.LOADED),sessionId:tM,totalAmountAtoms:s.ai(),currency:tO,checkoutPaymentMethods:s.YO(tH)}),t6=s.Ik({type:s.eu(tZ.enum.PAYMENT_FLOW_STARTED),nextActionMetadata:s.g1(s.Yj(),s.bz()),paymentFlowMetadata:s.bz().optional(),startPFMetadata:s.lq(s.g1(s.Yj(),s.bz()))}),t8=s.Ik({type:s.eu(tZ.enum.SETUP_PAYMENT_METHOD_SUCCESS),paymentMethodId:s.Yj()}),t9=s.Ik({email:tM.email({message:"Please enter a valid email address"}),firstName:tM,lastName:tM,phone:tO,promotionCode:tO,line1:tO,line2:tO,line3:tO,city:tO,state:tO,country:tM,zipCode:tO,isShippingSameAsBilling:s.Ie().optional().default(!0),shippingAddressLine1:tO,shippingAddressLine2:tO,shippingAddressLine3:tO,shippingAddressCity:tO,shippingAddressState:tO,shippingAddressCountry:tO,shippingAddressZipCode:tO,businessName:tO,taxId:tO,taxIdType:tO}),t7=s.Ik({email:tM.email({message:"Please enter a valid email address"}),firstName:tO,lastName:tO,phone:tO,promotionCode:tO,line1:tO,line2:tO,line3:tO,city:tO,state:tO,country:tM,zipCode:tO,isShippingSameAsBilling:s.Ie().optional().default(!0),shippingAddressLine1:tO,shippingAddressLine2:tO,shippingAddressLine3:tO,shippingAddressCity:tO,shippingAddressState:tO,shippingAddressCountry:tO,shippingAddressZipCode:tO,businessName:tO,taxId:tO,taxIdType:tO});s.Ik({line1:tM,city:tM,state:tM,country:tM}),s.Ik({shippingAddressCountry:tM,shippingAddressZipCode:tM}),s.Ik({shippingAddressLine1:tM,shippingAddressCity:tM,shippingAddressState:tM,shippingAddressCountry:tM,shippingAddressZipCode:tM});let re=tZ.extract(["TOKENIZE","CHECKOUT","START_PAYMENT_FLOW"]),rt=s.Ik({type:re,sessionId:tM,checkoutPaymentMethod:tH,paymentFlowMetadata:s.bz().optional(),doNotUseLegacyCCFlow:s.zM().optional(),existingCCPMId:tO,paymentRouteId:tO}).extend(t9.shape),rr=s.Ik({type:s.eu(tZ.enum.TOKENIZE_SUCCESS),isReadyForCheckout:s.zM()}),ro=s.Ik({type:s.eu(tZ.enum.CHECKOUT_SUCCESS),invoiceUrls:s.YO(s.Yj()),subscriptionIds:s.YO(s.Yj()),customerId:s.Yj(),paymentMethodId:tO}),rn=s.gM("type",[tW,tX,t1,t2,t5,t4,rt,rr,ro,t6,t8]),ra=s.Ik({payload:rn,nonce:tM,formId:tM,elementId:tM});s.Ik({amountAtom:s.ai(),currency:tM}),s.k5(["apple_pay","google_pay"]),s.Ik({secure_token:s.Yj(),promotion_code:s.Yj().optional()}),s.Ik({secure_token:s.Yj(),existing_cc_pm_id:tF(s.Yj()),their_pm_id:tF(s.Yj()),checkout_attempt_id:tF(s.Yj()),processor_specific_metadata:tF(s.g1(s.Yj(),s.bz()))});let ri=s.Ik({invoice_urls:s.YO(s.Yj()),subscription_ids:s.YO(s.Yj()),customer_id:s.Yj(),payment_method_id:tF(s.Yj()),processors_used:tF(s.YO(s.Yj()))}),rs=s.Ik({elementType:s.Yj(),errors:s.YO(s.Yj())});s.Ik({session_id:s.Yj()});let rl=s.Ik({success:s.eu(!1),error_type:s.eu("validation_error"),errors:s.YO(rs)}),rc=s.gM("success",[s.Ik({success:s.eu(!0)}),rl]);s.Ik({session_id:s.Yj(),checkout_payment_method:tH,non_cde_form_fields:t9,do_not_use_legacy_cc_flow:s.zM().optional(),existing_cc_pm_id:tF(s.Yj()),extra_metadata:s.g1(s.Yj(),s.bz()),payment_route_id:tF(s.Yj()),customer_language:tF(s.Yj())}),s.Ik({session_id:s.Yj(),checkout_payment_method:tH,non_cde_form_fields:t9,extra_metadata:s.g1(s.Yj(),s.bz()).optional(),payment_route_id:tF(s.Yj()),customer_language:tF(s.Yj())});var ru=(e=>(e.SUCCESS="success",e.FAILURE="failure",e.CANCELLED="cancelled",e))(ru||{});let rd=s.Ik({status:s.k5(["success","failure","cancelled"]),href:s.Yj().optional().nullable()});s.Ik({href:s.Yj().optional().nullable()});let rp=s.Ik({type:s.Yj(),redirect_url:s.Yj(),initial_intent_id:s.Yj(),consent_id:s.Yj(),their_pm_id:s.Yj().optional()}),rm=s.Ik({bank_name:s.Yj(),display_name:s.Yj(),resources:s.Ik({logo_url:s.Yj().optional()})}),rh=s.Ik({type:s.Yj(),redirect_url:tF(s.Yj()),initial_intent_id:tF(s.Yj()),consent_id:tF(s.Yj()),their_pm_id:tF(s.Yj()),payment_session:tF(s.g1(s.Yj(),s.bz())),available_banks:tF(s.YO(rm))}),r_=s.gM("present",[s.Ik({present:s.eu(!0),href:s.Yj()}),s.Ik({present:s.eu(!1)})]),rf=s.Ik({payment_methods:s.YO(tB),pay_first_success_response:tF(ri),required_user_actions:tF(s.YO(rh)),post_checkout_redirect_to:tF(s.Yj()),checkout_success_response:tF(ri)}),ry=s.Ik({institutionNumber:s.Yj(),transitNumber:s.Yj(),accountNumber:s.Yj(),accountType:s.k5(["personal","business"])});s.Ik({status:s.k5(["success","failure"]),payload:ry.optional()});let rg=s.Ik({sortCode:s.Yj(),accountNumber:s.Yj(),accountType:s.k5(["personal","business"])});s.Ik({status:s.k5(["success","failure"]),payload:rg.optional()});let rw=s.Ik({iban:s.Yj(),accountType:s.k5(["personal","business"])});s.Ik({status:s.k5(["success","failure"]),payload:rw.optional()});
5let rv=s.Ik({account_number:s.Yj(),aba_routing_number:s.Yj()}),rb=s.Ik({institution_number:s.Yj(),transit_number:s.Yj(),account_number:s.Yj()}),rk=s.Ik({account_number:s.Yj(),sort_code:s.Yj()}),rP=s.Ik({iban:s.Yj()}),rI=s.Ik({status:s.k5(["success","failure"]),payload:s.KC([rv,rb,rk,rP,s.Ik({error:s.Yj()})]).optional()}),rE=e=>s.me(e.optional());s.Yj().trim().min(1,{message:"Cannot be blank"});let rC=s.Ik({cde_response_type:s.eu("error"),message:s.Yj(),headers:s.g1(s.Yj(),s.Yj()).optional()});s.k5(["usd","brl"]);let rS=s.Ik({name:s.Yj(),amount_atom_off:rE(s.ai()),percent_off:rE(s.ai()),currency:rE(s.Yj()),duration:s.Yj(),duration_in_months:rE(s.ai())}),rA=s.Ik({amount_subtotal_atom:s.ai().int(),amount_total_atom:s.ai().int(),currency:s.Yj(),description:rE(s.Yj()),price_id:s.Yj(),billing_interval:rE(s.Yj()),billing_interval_count:rE(s.ai().int()),quantity:s.ai().int()}),rj=s.g1(s.Yj(),s.bz()),rY=s.Ik({name:s.Yj(),settings:rE(rj)}),rx=s.Ik({provider:s.Yj(),processor_name:rE(s.Yj()),metadata:rE(s.g1(s.Yj(),s.bz()))}),rT=s.Ik({quantity:s.ai()}),rN=s.Ik({id:rE(s.Yj()),billing_interval:rE(s.Yj()),billing_interval_count:rE(s.ai().int()),subscription_items:s.YO(rT),trial_start:rE(s.Yj()),trial_end:rE(s.Yj())}),rR=s.Ik({amount_atom:s.ai()}),rL=s.Ik({amount_atom:s.ai(),amount_atom_considering_discount_applied:s.ai(),currency:s.Yj(),discount_amount_atoms:s.YO(rR),subscription_item_id:s.Yj()}),rM=s.Ik({coupon:rS}),rO=s.Ik({currency:s.Yj(),discounts:s.YO(rM),hosted_invoice_url:rE(s.Yj()),lines:s.YO(rL),remaining_amount_atom:s.ai(),tax_amount_atom:s.ai(),total_amount_atom:s.ai(),total_discount_amount_atoms:s.YO(rR)}),rF=s.Ik({created:s.YO(rN),invoices:s.YO(rO),processors_used:rE(s.YO(s.Yj())),payment_method_id:rE(s.Yj())}),rD=s.Ik({preview:rF,preview_post_trial:rE(rF),coupons:s.YO(rS)}),rU=s.Ik({status:s.eu("open"),locale:rE(s.Yj()),token:s.Yj(),email:rE(s.Yj()),checkout_settings:s.g1(s.Yj(),s.bz()),line_items:s.YO(rA),amount_subtotal_atom:s.ai().int(),amount_total_atom:s.ai().int(),brand:rY,subs_preview:rE(rD),methods_available:s.YO(rx),return_url:rE(s.Yj()),success_url:rE(s.Yj()),final_feature_rollout_settings:rE(s.g1(s.Yj(),s.bz()))}),rq=s.gM("mode",[s.Ik({mode:s.eu("setup"),currency:s.me(s.Vx())}).extend(rU.shape),s.Ik({mode:s.k5(["payment","subscription"]),currency:s.Yj()}).extend(rU.shape)]),rz=s.Ik({status:s.eu("complete")}),rG=s.Ik({status:s.eu("expired")});s.KC([rq,rz,rG]),s.Ik({logo:s.Yj(),icon:s.Yj(),primary_color:s.Yj(),secondary_color:s.Yj()}),s.Ik({secure_token:s.Yj(),pm_id:s.Yj()});let rV=s.Ik({line1:s.Yj().optional(),line2:s.Yj().optional(),line3:s.Yj().optional(),city:s.Yj().optional(),state:s.Yj().optional(),country:s.Yj(),zip_code:s.Yj().optional()});s.Ik({secure_token:s.Yj(),payment_input:s.bz(),customer_email:s.Yj(),customer_last_name:s.Yj().optional(),customer_first_name:s.Yj().optional(),customer_address:rV,customer_shipping_address:rV.optional(),line_items:s.YO(rA),total_amount_atom:s.ai().int(),cancel_at_end:s.zM(),checkout_payment_method:rx,promotion_code:s.Yj().optional(),do_not_use_legacy_cc_flow:s.zM().optional(),use_confirmed_pm_id:rE(s.Yj()),payment_route_id:rE(s.Yj())});let r$=s.Ik({payment_method_id:s.Yj()});s.Ik({id:s.Yj(),return_url:s.Yj()});let rH=s.Ik({type:s.Yj(),loc:s.YO(s.Yj()),msg:s.Yj(),url:s.Yj()});s.YO(rH);let rB=s.Ik({new_customer_email:s.Yj().optional(),new_customer_last_name:s.Yj().optional(),new_customer_first_name:s.Yj().optional(),customer_business_name:s.Yj().optional(),customer_tax_id:s.Yj().optional(),customer_tax_id_type:s.Yj().optional(),new_customer_address:rV,new_customer_shipping_address:rV.optional(),customer_language:s.Yj().optional(),new_customer_phone:s.Yj().optional()}),rK=s.Ik({price_id:s.Yj(),quantity:s.ai().int()}),rZ=s.Ik({line_items:s.YO(rK),promotion_code:s.Yj().optional(),displayed_total_amount_atom:s.ai().int()}),rJ=s.Ik({processor_specific_metadata:rE(s.g1(s.Yj(),s.bz()))});s.Ik({payment_provider:s.Yj(),checkout_payment_method:rx,existing_cc_pm_id:s.Yj().optional(),their_existing_pm_id:s.Yj().optional(),use_pay_first_flow:s.zM().optional(),pay_first_flow_cart_info:rZ.optional(),customer_language:s.Yj().optional()}).extend(rB.shape).extend(rJ.shape);let rW=s.Ik({required_user_actions:s.YO(s.g1(s.Yj(),s.bz())),checkout_attempt_id:rE(s.Yj())});s.Ik({fields:t7,checkoutPaymentMethod:rx,payment_route_id:rE(s.Yj())}),s.Ik({session_id:s.Yj(),non_cde_form_fields:t9,checkout_payment_method:rx,extra_metadata:s.g1(s.Yj(),s.bz()),use_unified_cc_flow:rE(s.zM()),pay_first_flow_cart_info:rZ.optional(),payment_route_id:rE(s.Yj()),customer_language:s.Yj().optional(),existing_cc_pm_id:rE(s.Yj())});let rQ=s.Ik({required_user_actions:s.YO(s.g1(s.Yj(),s.bz())),cc_pm_id:s.Yj(),checkout_success_response:rE(ri),checkout_attempt_id:rE(s.Yj())});s.g1(s.bz()),s.Ik({first_name:rE(s.Yj()),last_name:rE(s.Yj()),line1:rE(s.Yj()),line2:rE(s.Yj()),line3:rE(s.Yj()),city:rE(s.Yj()),state:rE(s.Yj()),country:rE(s.Yj()),zip_code:rE(s.Yj()),email:rE(s.Yj()),billing_email:rE(s.Yj()),phone_number:rE(s.Yj()),business_name:rE(s.Yj()),tax_id:rE(s.Yj()),tax_id_type:rE(s.Yj()),update_processor_customer:rE(s.zM())}),s.Ik({id:s.Yj(),email:rE(s.Yj()),first_name:rE(s.Yj()),last_name:rE(s.Yj()),phone_number:rE(s.Yj()),billing_email:rE(s.Yj()),address:rE(s.g1(s.Yj(),s.bz()))}),s.Ik({message:s.Yj()});let rX=s.Ik({error_code:s.Yj()});s.Ik({checkout_payment_method:rx,processor_specific_metadata:s.g1(s.bz()).optional(),payment_route_id:rE(s.Yj())});let r0=s.Ik({next_action_metadata:rE(s.g1(s.bz()))});s.Ik({events:s.YO(s.Ik({event_name:s.Yj(),device_token:s.Yj(),properties:s.g1(s.bz()).optional(),context_properties:s.g1(s.bz()).optional()}))}),s.bz().optional(),s.Ik({device_token:s.Yj()});let r1=s.Ik({}),r3=s.Ik({_unified_cc_action_name:s.Yj(),_unified_cc_pccs_id:s.Yj()}).catchall(s.bz()),r2=s.Ik({type:s.Yj(),loc:s.YO(s.Yj()),msg:s.Yj(),url:s.Yj()}),r5=s.YO(r2),r4=s.Ik({code:s.Yj(),message:s.Yj(),path:s.YO(s.Yj())}),r6=s.YO(r4),r8={"failed to fetch":"Connection error: please double check if you are connected to the internet, then try again"},r9=e=>r8[e.toLowerCase().trim()]??e,r7=e=>{if(e instanceof Error)if(!(e=>{try{return"object"==typeof JSON.parse(e)}catch{return!1}})(e.message))return r9(e.message);else{let t=JSON.parse(e.message);return r5.safeParse(t).success?(e=>1===e.length?r9(e[0].msg):`Please fix the following errors: 6${e.map(e=>`⢠${r9(e.msg)}`).join(` 7`)}`)(t):r6.safeParse(t).success?`Encountered the following errors: 8${t.map(e=>`- ${e.path.join("/")}: ${e.message}`).join(` 9`)}`:(console.warn(`Encountered unknown stringified JSON object: 10${e.message}`),e.message)}if("object"!=typeof e)return e+"";try{return JSON.stringify(e)}catch(e){return e+""}},oe=e=>{e.preventDefault(),e.returnValue=!0},ot=e=>{let t=!1;return async r=>{if(t)return void console.warn("Skipping submission because it is already in progress");t=!0;try{r.context.preventNavigationDuringSubmission&&window.addEventListener("beforeunload",oe),r.formCallbacks.get.onCheckoutStarted?.(),o5("checkout_started",{cpm:r.checkoutPaymentMethod});let t=await e(r);if(o5("checkout_success",{cpm:r.checkoutPaymentMethod,...t}),o4(),"setup"===t.mode)r.formCallbacks.get.onSetupPaymentMethodSuccess(t.result.payment_method_id);else if("checkout"===t.mode)r.formCallbacks.get.onCheckoutSuccess(t.result.invoice_urls,t.result.subscription_ids,t.result.customer_id,t.result.processors_used??[],t.result.payment_method_id??"");else throw Error(`Unhandled mode: ${t}`)}catch(n){t=!1;let e=r7(n),o=await aC(r.context.anyCdeConnection,e);r.formCallbacks.get.onCheckoutError(e,o),o5("checkout_error",{cpm:r.checkoutPaymentMethod,errorMessage:e,errorCode:o,error:n})}finally{t=!1,r.context.preventNavigationDuringSubmission&&window.removeEventListener("beforeunload",oe)}}},or=e=>async t=>{try{return await e(t)}catch(n){let{err__:e}=oo("init-error-catcher"),r=r7(n),o=await aC(t.context.anyCdeConnection,r);return e(o,r,n),o5("init_flow_error",{errorMessage:r,errorCode:o,error:n}),{isAvailable:!1,reason:r,errorCode:o,isLoading:!1}}},oo=e=>{let t=(...t)=>{window.console.log(`${l.Ay.green.bold("ojs/")}${l.Ay.bold.gray(`${e}`)} `,...t)}
10,r=(...t)=>{window.console.warn(`${l.Ay.red.bold("ojs/")}${l.Ay.bold.gray(`${e}`)} `,...t)};return{log:t,err:r,log__:t,err__:r}};var on=function(e,t){return(on=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function oa(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}on(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function oi(e,t){var r,o,n,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=s(0),i.throw=s(1),i.return=s(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(l){var c=[s,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(r=1,o&&(n=2&c[0]?o.return:c[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,c[1])).done)return n;switch(o=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,o=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){a.label=c[1];break}if(6===c[0]&&a.label<n[1]){a.label=n[1],n=c;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(c);break}n[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],o=0}finally{r=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}function os(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ol(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function oc(e,t,r){if(2==arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function ou(e){return this instanceof ou?(this.v=e,this):new ou(e)}function od(e){return"function"==typeof e}function op(e){var t=e(function(e){Error.call(e),e.stack=Error().stack});return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var om=op(function(e){return function(t){e(this),this.message=t?t.length+` errors occurred during unsubscription: 11`+t.map(function(e,t){return t+1+") "+e.toString()}).join(` 12 `):"",this.name="UnsubscriptionError",this.errors=t}});function oh(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var o_=function(){var e;function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,t,r,o,n;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var i=os(a),s=i.next();!s.done;s=i.next())s.value.remove(this)}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}else a.remove(this);var l=this.initialTeardown;if(od(l))try{l()}catch(e){n=e instanceof om?e.errors:[e]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var u=os(c),d=u.next();!d.done;d=u.next()){var p=d.value;try{og(p)}catch(e){n=n??[],e instanceof om?n=oc(oc([],ol(n)),ol(e.errors)):n.push(e)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}}if(n)throw new om(n)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)og(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!=(r=this._finalizers)?r:[]).push(e)}},t.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},t.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},t.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&oh(t,e)},t.prototype.remove=function(e){var r=this._finalizers;r&&oh(r,e),e instanceof t&&e._removeParent(this)},(e=new t).closed=!0,t.EMPTY=e,t}(),of=o_.EMPTY;function oy(e){return e instanceof o_||e&&"closed"in e&&od(e.remove)&&od(e.add)&&od(e.unsubscribe)}function og(e){od(e)?e():e.unsubscribe()}var ow={Promise:void 0},ov={setTimeout:function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];return setTimeout.apply(void 0,oc([e,t],ol(r)))}};function ob(e){ov.setTimeout(function(){throw e})}function ok(){}var oP=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,oy(t)&&t.add(r)):r.destination=oC,r}return oa(t,e),t.create=function(e,t,r){return new oE(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(o_),oI=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){ob(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ob(e)}else ob(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ob(e)}},e}(),oE=function(e){function t(t,r,o){var n=e.call(this)||this;return n.destination=new oI(od(t)||!t?{next:t??void 0,error:r??void 0,complete:o??void 0}:t),n}return oa(t,e),t}(oP),oC={closed:!0,next:ok,error:function(e){throw e},complete:ok},oS="function"==typeof Symbol&&Symbol.observable||"@@observable",oA=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var o,n,a=this,i=!function(e){return e&&e instanceof oP||e&&od(e.next)&&od(e.error)&&od(e.complete)&&oy(e)}(e)?new oE(e,t,r):e;return o=a.operator,n=a.source,i.add(o?o.call(i,n):n?a._subscribe(i):a._trySubscribe(i)),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=oj(t))(function(t,o){var n=new oE({next:function(t){try{e(t)}catch(e){o(e),n.unsubscribe()}},error:o,complete:t});r.subscribe(n)})},e.prototype._subscribe=function(e){var t;return null==(t=this.source)?void 0:t.subscribe(e)},e.prototype[oS]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return(0===e.length?function(e){return e}:1===e.length?e[0]:function(t){return e.reduce(function(e,t){return t(e)},t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=oj(e))(function(e,r){var o;t.subscribe(function(e){return o=e},function(e){return r(e)},function(){return e(o)})})},e.create=function(t){return new e(t)},e}();function oj(e){var t;return null!=(t=e??ow.Promise)?t:Promise}var oY=function(e){function t(t,r,o,n,a,i){var s=e.call(this,t)||this;return s.onFinalize=a,s.shouldUnsubscribe=i,s._next=r?function(e){try{r(e)}catch(e){t.error(e)}}:e.prototype._next,s._error=n?function(e){try{n(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,s._complete=o?function(){try{o()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,s}return oa(t,e),t.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;e.prototype.unsubscribe.call(this),r||null==(t=this.onFinalize)||t.call(this)}},t}(oP),ox=op(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),oT=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return oa(t,e),t.prototype.lift=function(e){var t=new oN(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new ox},t.prototype.next=function(e){var t,r;if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));try{for(var o=os(this.currentObservers),n=o.next();!n.done;n=o.next())n.value.next(e)}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}},t.prototype.error=function(e){if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=e;for(var t=this.observers;t.length;)t.shift().error(e)}},t.prototype.complete=function(){if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;for(var e=this.observers;e.length;)e.shift().complete()}},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null==(e=this.observers)?void 0:e.length)>0}
12,enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this.hasError,o=this.isStopped,n=this.observers;return r||o?of:(this.currentObservers=null,n.push(e),new o_(function(){t.currentObservers=null,oh(n,e)}))},t.prototype._checkFinalizedStatuses=function(e){var t=this.hasError,r=this.thrownError,o=this.isStopped;t?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new oA;return e.source=this,e},t.create=function(e,t){return new oN(e,t)},t}(oA),oN=function(e){function t(t,r){var o=e.call(this)||this;return o.destination=t,o.source=r,o}return oa(t,e),t.prototype.next=function(e){var t,r;null==(r=null==(t=this.destination)?void 0:t.next)||r.call(t,e)},t.prototype.error=function(e){var t,r;null==(r=null==(t=this.destination)?void 0:t.error)||r.call(t,e)},t.prototype.complete=function(){var e,t;null==(t=null==(e=this.destination)?void 0:e.complete)||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!=(r=null==(t=this.source)?void 0:t.subscribe(e))?r:of},t}(oT),oR={now:function(){return Date.now()}},oL=function(e){function t(t,r){return e.call(this)||this}return oa(t,e),t.prototype.schedule=function(e,t){return this},t}(o_),oM={setInterval:function(e,t){for(var r=[],o=2;o<arguments.length;o++)r[o-2]=arguments[o];return setInterval.apply(void 0,oc([e,t],ol(r)))},clearInterval:function(e){return clearInterval(e)}},oO=function(e){function t(t,r){var o=e.call(this,t,r)||this;return o.scheduler=t,o.work=r,o.pending=!1,o}return oa(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r,o=this.id,n=this.scheduler;return null!=o&&(this.id=this.recycleAsyncId(n,o,t)),this.pending=!0,this.delay=t,this.id=null!=(r=this.id)?r:this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),oM.setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!=r&&this.delay===r&&!1===this.pending)return t;null!=t&&oM.clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r,o=!1;try{this.work(e)}catch(e){o=!0,r=e||Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),r},t.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,r=this.scheduler,o=r.actions;this.work=this.state=this.scheduler=null,this.pending=!1,oh(o,this),null!=t&&(this.id=this.recycleAsyncId(r,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(oL),oF=function(){function e(t,r){void 0===r&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(r,t)},e.now=oR.now,e}(),oD=new(function(e){function t(t,r){void 0===r&&(r=oF.now);var o=e.call(this,t,r)||this;return o.actions=[],o._active=!1,o}return oa(t,e),t.prototype.flush=function(e){var t,r=this.actions;if(this._active)return void r.push(e);this._active=!0;do if(t=e.execute(e.state,e.delay))break;while(e=r.shift());if(this._active=!1,t){for(;e=r.shift();)e.unsubscribe();throw t}},t}(oF))(oO),oU="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function oq(e){return new oA(function(t){(function(e,t){var r,o,n,a,i,s,l;return i=this,s=void 0,l=function(){var i;return oi(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),r=function(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=os(e),t={},o("next"),o("throw"),o("return"),t[Symbol.asyncIterator]=function(){return this},t);function o(r){t[r]=e[r]&&function(t){return new Promise(function(o,n){var a,i,s;a=o,i=n,s=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){a({value:e,done:s})},i)})}}}(e),s.label=1;case 1:return[4,r.next()];case 2:if((o=s.sent()).done)return[3,4];if(i=o.value,t.next(i),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return n={error:s.sent()},[3,11];case 6:return s.trys.push([6,,9,10]),o&&!o.done&&(a=r.return)?[4,a.call(r)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];
12case 10:return[7];case 11:return t.complete(),[2]}})},new(s||(s=Promise))(function(e,t){function r(e){try{n(l.next(e))}catch(e){t(e)}}function o(e){try{n(l.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):((n=t.value)instanceof s?n:new s(function(e){e(n)})).then(r,o)}n((l=l.apply(i,[])).next())})})(e,t).catch(function(e){return t.error(e)})})}var oz=op(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}}),oG=op(function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}});function oV(e){throw new oG(e)}class o${constructor(){this.set=e=>{if("success"===this._current.status)throw Error("LoadedOnce is already in success state");this._current={status:"success",isSuccess:!0,loadedValue:e},this._subject.next(e),this._subject.complete()},this.throw=(e,t)=>{if("success"===this._current.status)throw Error("LoadedOnce is already in success state");this._current={status:"error",isSuccess:!1,error:e,errMsg:t},this._subject.error(e)},this.getValueIfLoadedElse=e=>"success"===this._current.status?this._current.loadedValue:e,this.subscribe=e=>{if("success"===this._current.status)return void e(this._current);"error"===this._current.status&&e(this._current);let t=this._subject.subscribe({next:()=>{if("success"!==this._current.status)throw Error("Invalid state (next): please make sure to update _current before the subject");e(this._current),t.unsubscribe()},error:()=>{if("error"!==this._current.status)throw Error("Invalid state (error): please make sure to update _current before the subject");e(this._current)}})},this.waitForLoad=e=>{var t;if("success"===this._current.status)return Promise.resolve(this._current.loadedValue);if("error"===this._current.status)return Promise.reject(this._current.error);"initial"!==this._current.status&&oJ(this._current);let r={first:1e3*e.timeoutSec,with:()=>(function(e,t){var r=od(e)?e:function(){return e};return new oA(function(e){return e.error(r())})})(()=>Error(e.timeoutErrMsg))};return t=this._subject.pipe(function(e,t){var r,o=e instanceof Date&&!isNaN(e)?{first:e}:"number"==typeof e?{each:e}:e,n=o.first,a=o.each,i=o.with,s=void 0===i?oV:i,l=o.scheduler,c=void 0===l?oD:l,u=o.meta,d=void 0===u?null:u;if(null==n&&null==a)throw TypeError("No timeout provided.");return r=function(e,t){var r,o,i=null,l=0,u=function(e){o=function(e,t,r,o,n){void 0===o&&(o=0),void 0===n&&(n=!1);var a=t.schedule(function(){r(),n?e.add(this.schedule(null,o)):this.unsubscribe()},o);if(e.add(a),!n)return a}(t,c,function(){try{r.unsubscribe(),(function(e){if(e instanceof oA)return e;if(null!=e){var t,r,o,n,a;if(od(e[oS])){return t=e,new oA(function(e){var r=t[oS]();if(od(r.subscribe))return r.subscribe(e);throw TypeError("Provided object does not correctly implement Symbol.observable")})}if(e&&"number"==typeof e.length&&"function"!=typeof e){return r=e,new oA(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}if(od(e?.then)){return o=e,new oA(function(e){o.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,ob)})}if(Symbol.asyncIterator&&od(e?.[Symbol.asyncIterator]))return oq(e);if(od(e?.[oU])){return n=e,new oA(function(e){var t,r;try{for(var o=os(n),a=o.next();!a.done;a=o.next()){var i=a.value;if(e.next(i),e.closed)return}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}e.complete()})}if(od(e?.getReader)){return a=e,oq(function(e){return function(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var o,n=r.apply(e,t||[]),a=[];return o=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,c)}}),o[Symbol.asyncIterator]=function(){return this},o;function i(e,t){n[e]&&(o[e]=function(t){return new Promise(function(r,o){a.push([e,t,r,o])>1||s(e,t)})},t&&(o[e]=t(o[e])))}function s(e,t){try{var r;(r=n[e](t)).value instanceof ou?Promise.resolve(r.value.v).then(l,c):u(a[0][2],r)}catch(e){u(a[0][3],e)}}function l(e){s("next",e)}function c(e){s("throw",e)}function u(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}(this,arguments,function(){var t,r,o;return oi(this,function(n){switch(n.label){case 0:t=e.getReader(),n.label=1;case 1:n.trys.push([1,,9,10]),n.label=2;case 2:return[4,ou(t.read())];case 3:return o=(r=n.sent()).value,r.done?[4,ou(void 0)]:[3,5];case 4:return[2,n.sent()];case 5:return[4,ou(o)];case 6:return[4,n.sent()];case 7:return n.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}
12(a))}}throw TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")})(s({meta:d,lastValue:i,seen:l})).subscribe(t)}catch(e){t.error(e)}},e)};r=e.subscribe(new oY(t,function(e){o?.unsubscribe(),l++,t.next(i=e),a>0&&u(a)},void 0,void 0,function(){o?.closed||o?.unsubscribe(),i=null})),l||u(null!=n?"number"==typeof n?n:n-c.now():a)},function(e){if(od(e?.lift))return e.lift(function(e){try{return r(e,this)}catch(e){this.error(e)}});throw TypeError("Unable to lift unknown Observable type")}}(r)),new Promise(function(e,r){var o,n=!1;t.subscribe({next:function(e){o=e,n=!0},error:r,complete:function(){n?e(o):r(new oz)}})})},this._current={status:"initial",isSuccess:!1},this._subject=new oT}get current(){return this._current}}let oH=s.k5(["dev","stg","prod"]),oB={prod:"https://connto.getopenpay.com",stg:"https://connto.openpaystaging.com",dev:"http://localhost:8000"},oK={},oZ=async e=>{if(oK[e])return oK[e];try{let t=await fetch(new URL("/health/environment",e)).then(e=>e.json()),r=oH.parse(t.environment);return oK[e]=r,r}catch{return oH.Values.prod}};function oJ(e){throw Error(`Unhandled case: ${e}`)}let oW=(e,t)=>Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e))),oQ=()=>{if(!(typeof window>"u"))return window},oX=new o$,o0="op_metrics_queue",{log__:o1}=oo("op-metrics");class o3{constructor(){this.queue=[],this.processingQueue=!1,this.batchTimeout=null,this.lastEventTimestamp=0,this.offlineListener=()=>{o1("Network offline, metrics will be queued"),this.cancelBatchProcessing()},this.onlineListener=()=>{o1("Network online, processing metrics queue"),this.processQueue()},this.loadQueueFromStorage(),oQ()?.addEventListener("offline",this.offlineListener),oQ()?.addEventListener("online",this.onlineListener)}addEvent(e,t,r){let o={eventName:e,properties:t||{},contextProperties:r||{},nonce:(0,c.A)(),timestamp:Date.now(),datetime:new Date().toISOString(),attemptCount:0,timeDiffFromPreviousEvent:this.lastEventTimestamp?Date.now()-this.lastEventTimestamp:0};this.lastEventTimestamp=o.timestamp,this.queue.push(o),this.saveQueueToStorage(),this.scheduleBatchProcessing()}loadQueueFromStorage(){try{let e=oQ()?.localStorage?.getItem(o0);e&&(this.queue=JSON.parse(e))}catch{this.queue=[],this.saveQueueToStorage()}}saveQueueToStorage(){oQ()?.localStorage.setItem(o0,JSON.stringify(this.queue))}scheduleBatchProcessing(){let e=oQ();e&&navigator.onLine&&!this.processingQueue&&this.queue.length>0&&!this.batchTimeout&&(this.batchTimeout=e.setTimeout(()=>{this.batchTimeout=null,this.processQueue()},1e3))}cancelBatchProcessing(){this.batchTimeout&&(oQ()?.clearTimeout(this.batchTimeout),this.batchTimeout=null),this.processingQueue=!1}processQueue(){!navigator.onLine||this.processingQueue||0===this.queue.length||(this.processingQueue=!0,this.sendBatch().finally(()=>{this.processingQueue=!1,this.queue.length>0&&this.scheduleBatchProcessing()}))}async sendBatch(){if(0===this.queue.length)return;let e=oX.getValueIfLoadedElse(void 0);if(!e)return void o1("Metrics context not available, will retry later");let t=this.queue.slice(0,3);try{let r={events:t.map(t=>({event_name:t.eventName,device_token:e.deviceToken,context_properties:{...e,...t.contextProperties},properties:{nonce:t.nonce,datetime:t.datetime,timestamp:t.timestamp,time_diff_from_previous_event:t.timeDiffFromPreviousEvent,checkout_secure_token:e.checkoutSecureToken,...t.properties}}))},o=oB[e.environment],n=new URL("/metrics/public/capture",o);(await fetch(n.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r),keepalive:!0})).ok?(this.queue=this.queue.slice(t.length),this.saveQueueToStorage()):this.handleFailedBatch(t)}catch(e){o1("Error sending metrics batch:",e),this.handleFailedBatch(t)}}handleFailedBatch(e){e.forEach(e=>{e.attemptCount++});let t=e.filter(e=>e.attemptCount<3);this.queue=this.queue.slice(e.length),this.queue=[...t,...this.queue],this.saveQueueToStorage()}cleanup(){oQ()?.removeEventListener("offline",this.offlineListener),oQ()?.removeEventListener("online",this.onlineListener),this.cancelBatchProcessing()}}let o2=new o3,o5=(e,t,r)=>{o2.addEvent(e,t,r)},o4=()=>{o2.processQueue()},o6=e=>{o5("unhandled_rejection_error",{error_message:r7(e.reason),error_name:e.reason})},o8=e=>{o5("uncaught_error",{error_message:r7(e.error),error_name:e.error?.name,error_stack:e.error?.stack,file_name:e.filename,line_number:e.lineno,column_number:e.colno})},o9=null,o7=async()=>
12{if(typeof window>"u")return null;try{return o9=(await r.e(9143).then(r.bind(r,9143))).default}catch(e){return console.warn("Failed to load page-lifecycle:",e),null}},ne=e=>{o5("page_lifecycle_state_change",{old_state:e.oldState,new_state:e.newState}),("hidden"===e.newState||"passive"===e.newState)&&o2.processQueue()},nt=async()=>{oQ()?.addEventListener("error",o8),oQ()?.addEventListener("unhandledrejection",o6);let e=await o7();e&&e.addEventListener("statechange",ne)},nr=async()=>{oQ()?.removeEventListener("error",o8),oQ()?.removeEventListener("unhandledrejection",o6),oQ()&&o9&&o9.removeEventListener("statechange",ne)},no=s.Ik({stripe_pk:s.Yj(),client_secret:s.Yj(),stripe_pm_id:s.Yj()}),nn=s.Ik({type:s.Yj(),client_secret:s.Yj(),stripe_pk:s.Yj()}),na={usd:"usd",brl:"brl"},ni=async e=>{for(let e=0;e<10;e++)nu()||await nc(500);if(!nu())throw console.log("Stripe JS not found."),Error("Stripe JS not found.");return new Stripe(e)},ns=async(e,t)=>{let r=await ni(e);return{elements:r.elements(t),stripe:r}},nl=async(e,t,r,o,n)=>{let a=await ni(e),i=na[r.toLowerCase().trim()];return a.paymentRequest({country:"US",currency:i,total:{label:"Total",amount:t,pending:o},requestPayerName:!0,requestPayerEmail:!0,disableWallets:[]})},nc=e=>new Promise(t=>{setTimeout(t,e)}),nu=()=>"Stripe"in window,nd=async e=>new Promise((t,r)=>{try{e.on("paymentmethod",async e=>{console.log("paymentmethod EVT:: ",e),t(e)}),e.on("token",async e=>{console.log("token EVT:: ",e)}),e.on("cancel",()=>{r(Error("Payment cancelled, please click Submit again to pay"))})}catch(e){r(e)}}),np=async(e,t)=>{if(!e.stripe_pk||!e.client_secret)throw Error(`Invalid next action metadata format: ${JSON.stringify(e)}`);let r=await (await ni(e.stripe_pk)).confirmCardSetup(e.client_secret,{payment_method:t.paymentMethod.id});if(r.error)throw t.complete("fail"),Error(`Payment failed: ${r.error.message??"unknown"}`);return t.complete("success"),r},nm=async e=>{let t=await (await ni(e.stripe_pk)).confirmCardSetup(e.client_secret,{payment_method:e.stripe_pm_id}),r=t.setupIntent?.status;if("succeeded"===r)console.log("[3DS] CONFIRMING PM:",e.stripe_pm_id),console.log("[3DS] Setup intent created:",t.setupIntent);else throw"canceled"===r?Error("Payment cancelled, please click Submit again to pay"):Error(`${t.error?.message??t.setupIntent?.last_setup_error?.message??"Payment failed, please click submit again to pay."}`)};var nh="object"==typeof globalThis?globalThis:"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:{},n_="1.9.0",nf=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,ny=function(e){var t=new Set([e]),r=new Set,o=e.match(nf);if(!o)return function(){return!1};var n={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};if(null!=n.prerelease)return function(t){return t===e};function a(e){return r.add(e),!1}return function(e){if(t.has(e))return!0;if(r.has(e))return!1;var o=e.match(nf);if(!o)return a(e);var i={major:+o[1],minor:+o[2],patch:+o[3],prerelease:o[4]};return null!=i.prerelease||n.major!==i.major?a(e):0===n.major?n.minor===i.minor&&n.patch<=i.patch?(t.add(e),!0):a(e):n.minor<=i.minor?(t.add(e),!0):a(e)}}(n_),ng=Symbol.for("opentelemetry.js.api."+n_.split(".")[0]);function nw(e,t,r,o){void 0===o&&(o=!1);var n,a=nh[ng]=null!=(n=nh[ng])?n:{version:n_};if(!o&&a[e]){var i=Error("@opentelemetry/api: Attempted duplicate registration of API: "+e);return r.error(i.stack||i.message),!1}if(a.version!==n_){var i=Error("@opentelemetry/api: Registration of version v"+a.version+" for "+e+" does not match previously registered API v"+n_);return r.error(i.stack||i.message),!1}return a[e]=t,r.debug("@opentelemetry/api: Registered a global for "+e+" v"+n_+"."),!0}function nv(e){var t,r,o=null==(t=nh[ng])?void 0:t.version;if(!(!o||!ny(o)))return null==(r=nh[ng])?void 0:r[e]}function nb(e,t){t.debug("@opentelemetry/api: Unregistering a global for "+e+" v"+n_+".");var r=nh[ng];r&&delete r[e]}var nk=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},nP=function(e,t,r){if(2==arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},nI=function(){function e(e){this._namespace=e.namespace||"DiagComponentLogger"}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nE("debug",this._namespace,e)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nE("error",this._namespace,e)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nE("info",this._namespace,e)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nE("warn",this._namespace,e)},e.prototype.verbose=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return nE("verbose",this._namespace,e)},e}();function nE(e,t,r){var o=nv("diag");if(o)return r.unshift(t),o[e].apply(o,nP([],nk(r),!1))}
12!function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"}(nY||(nY={}));var nC=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},nS=function(e,t,r){if(2==arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},nA=function(){function e(){function e(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var o=nv("diag");if(o)return o[e].apply(o,nS([],nC(t),!1))}}var t=this;t.setLogger=function(e,r){if(void 0===r&&(r={logLevel:nY.INFO}),e===t){var o,n,a,i=Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return t.error(null!=(o=i.stack)?o:i.message),!1}"number"==typeof r&&(r={logLevel:r});var s=nv("diag"),l=function(e,t){function r(r,o){var n=t[r];return"function"==typeof n&&e>=o?n.bind(t):function(){}}return e<nY.NONE?e=nY.NONE:e>nY.ALL&&(e=nY.ALL),t=t||{},{error:r("error",nY.ERROR),warn:r("warn",nY.WARN),info:r("info",nY.INFO),debug:r("debug",nY.DEBUG),verbose:r("verbose",nY.VERBOSE)}}(null!=(n=r.logLevel)?n:nY.INFO,e);if(s&&!r.suppressOverrideMessage){var c=null!=(a=Error().stack)?a:"<failed to generate stacktrace>";s.warn("Current logger will be overwritten from "+c),l.warn("Current logger will over
12write one already registered from "+c)}return nw("diag",l,t,!0)},t.disable=function(){nb("diag",t)},t.createComponentLogger=function(e){return new nI(e)},t.verbose=e("verbose"),t.debug=e("debug"),t.info=e("info"),t.warn=e("warn"),t.error=e("error")}return e.instance=function(){return this._instance||(this._instance=new e),this._instance},e}();function nj(e){return Symbol.for(e)}var nY,nx,nT=new function e(t){var r=this;r._currentContext=t?new Map(t):new Map,r.getValue=function(e){return r._currentContext.get(e)},r.setValue=function(t,o){var n=new e(r._currentContext);return n._currentContext.set(t,o),n},r.deleteValue=function(t){var o=new e(r._currentContext);return o._currentContext.delete(t),o}},nN=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},nR=function(e,t,r){if(2==arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},nL=function(){function e(){}return e.prototype.active=function(){return nT},e.prototype.with=function(e,t,r){for(var o=[],n=3;n<arguments.length;n++)o[n-3]=arguments[n];return t.call.apply(t,nR([r],nN(o),!1))},e.prototype.bind=function(e,t){return t},e.prototype.enable=function(){return this},e.prototype.disable=function(){return this},e}(),nM=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)i.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i},nO=function(e,t,r){if(2==arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},nF="context",nD=new nL,nU=function(){function e(){}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalContextManager=function(e){return nw(nF,e,nA.instance())},e.prototype.active=function(){return this._getContextManager().active()},e.prototype.with=function(e,t,r){for(var o,n=[],a=3;a<arguments.length;a++)n[a-3]=arguments[a];return(o=this._getContextManager()).with.apply(o,nO([e,t,r],nM(n),!1))},e.prototype.bind=function(e,t){return this._getContextManager().bind(e,t)},e.prototype._getContextManager=function(){return nv(nF)||nD},e.prototype.disable=function(){this._getContextManager().disable(),nb(nF,nA.instance())},e}();!function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"}(nx||(nx={}));var nq="0000000000000000",nz="00000000000000000000000000000000",nG={traceId:nz,spanId:nq,traceFlags:nx.NONE},nV=function(){function e(e){void 0===e&&(e=nG),this._spanContext=e}return e.prototype.spanContext=function(){return this._spanContext},e.prototype.setAttribute=function(e,t){return this},e.prototype.setAttributes=function(e){return this},e.prototype.addEvent=function(e,t){return this},e.prototype.addLink=function(e){return this},e.prototype.addLinks=function(e){return this},e.prototype.setStatus=function(e){return this},e.prototype.updateName=function(e){return this},e.prototype.end=function(e){},e.prototype.isRecording=function(){return!1},e.prototype.recordException=function(e,t){},e}(),n$=nj("OpenTelemetry Context Key SPAN");function nH(e){return e.getValue(n$)||void 0}function nB(){return nH(nU.getInstance().active())}function nK(e,t){return e.setValue(n$,t)}function nZ(e){return e.deleteValue(n$)}function nJ(e,t){return nK(e,new nV(t))}function nW(e){var t;return null==(t=nH(e))?void 0:t.spanContext()}var nQ=/^([0-9a-f]{32})$/i,nX=/^[0-9a-f]{16}$/i;function n0(e){return nQ.test(e)&&e!==nz}function n1(e){return nX.test(e)&&e!==nq}function n3(e){return n0(e.traceId)&&n1(e.spanId)}function n2(e){return new nV(e)}var n5,n4=nU.getInstance(),n6=function(){function e(){}return e.prototype.startSpan=function(e,t,r){if(void 0===r&&(r=n4.active()),t?.root)return new nV;var o,n=r&&nW(r);return"object"==typeof(o=n)&&"string"==typeof o.spanId&&"string"==typeof o.traceId&&"number"==typeof o.traceFlags&&n3(n)?new nV(n):new nV},e.prototype.startActiveSpan=function(e,t,r,o){var n,a,i;if(!(arguments.length<2)){2==arguments.length?i=t:3==arguments.length?(n=t,i=r):(n=t,a=r,i=o);var s=a??n4.active(),l=this.startSpan(e,n,s),c=nK(s,l);return n4.with(c,i,void 0,l)}},e}(),n8=new n6,n9=function(){function e(e,t,r,o){this._provider=e,this.name=t,this.version=r,this.options=o}return e.prototype.startSpan=function(e,t,r){return this._getTracer().startSpan(e,t,r)},e.prototype.startActiveSpan=function(e,t,r,o){var n=this._getTracer();return Reflect.apply(n.startActiveSpan,n,arguments)},e.prototype._getTracer=function(){if(this._delegate)return this._delegate;var e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):n8},e}(),n7=new(function(){function e(){}return e.prototype.getTracer=function(e,t,r){return new n6},e}()),ae=function(){function e(){}return e.prototype.getTracer=function(e,t,r){var o;return null!=(o=this.getDelegateTracer(e,t,r))?o:new n9(this,e,t,r)},e.prototype.getDelegate=function(){var e;return null!=(e=this._delegate)?e:n7},e.prototype.setDelegate=function(e){this._delegate=e},e.prototype.getDelegateTracer=function(e,t,r){var o;return null==(o=this._delegate)?void 0:o.getTracer(e,t,r)},e}();!function(e){e[e.INTERNAL=0]="INTERNAL",e[e.SERVER=1]="SERVER",e[e.CLIENT=2]="CLIENT",e[e.PRODUCER=3]="PRODUCER",e[e.CONSUMER=4]="CONSUMER"}(n5||(n5={})),function(e){e[e.UNSET=0]="UNSET",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR"}(n||(n={}));var at=nU.getInstance(),ar="trace",ao=(function(){function e(){this._proxyTracerProvider=new ae,this.wrapSpanContext=n2,this.isSpanContextValid=n3,this.deleteSpan=nZ,this.get
12Span=nH,this.getActiveSpan=nB,this.getSpanContext=nW,this.setSpan=nK,this.setSpanContext=nJ}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalTracerProvider=function(e){var t=nw(ar,this._proxyTracerProvider,nA.instance());return t&&this._proxyTracerProvider.setDelegate(e),t},e.prototype.getTracerProvider=function(){return nv(ar)||this._proxyTracerProvider},e.prototype.getTracer=function(e,t){return this.getTracerProvider().getTracer(e,t)},e.prototype.disable=function(){nb(ar,nA.instance()),this._proxyTracerProvider=new ae},e})().getInstance();let an=async(e,t,r)=>{let o=ao.getTracer("openpay-js"),a=at.active(),i=o.startSpan(`cde.${t.type}`,{kind:n5.CLIENT,attributes:{"message.type":t.type,...e.tracingContext&&{"ojs.checkoutSecureToken":e.tracingContext.checkoutSecureToken,"ojs.deviceToken":e.tracingContext.deviceToken,"ojs.formId":e.tracingContext.formId,"ojs.version":e.tracingContext.version,"ojs.release_version":e.tracingContext.releaseVersion,"ojs.base_url":e.tracingContext.baseUrl,"ojs.referrer":e.tracingContext.referrer},"cde.message.type":t.type,"cde.message.payload":JSON.stringify(t.payload)}},a);return at.with(ao.setSpan(a,i),async()=>{try{let e=await r();return i.setStatus({code:n.OK}),e}catch(e){throw i.setStatus({code:n.ERROR,message:e instanceof Error?e.message:"Unknown error"}),e}finally{i.end()}})},aa=async(e,t)=>{let r=ao.getTracer("openpay-js"),o=at.active(),a=r.startSpan(`form.${e.spanName}`,{kind:n5.CLIENT,attributes:{"ojs.checkoutSecureToken":e.checkoutSecureToken,"ojs.deviceToken":e.deviceToken,"ojs.formId":e.formId,"ojs.version":e.version,"ojs.release_version":e.releaseVersion,"ojs.base_url":e.baseUrl,"ojs.referrer":e.referrer,...e.paymentRouteId&&{"payment.route_id":e.paymentRouteId}}},o);try{let e=await t();return a.setStatus({code:n.OK}),e}catch(t){let e=t instanceof Error?t.message:"Unknown error";throw a.setStatus({code:n.ERROR,message:e}),t}finally{a.end()}};class ai extends tL{constructor(e){super(`${e.message}`),this.response=e}get originalErrorMessage(){return this.response.message}}let as=async(e,t,r,o)=>an(e,t,async()=>{o&&o5(o,{...t});let n=await e.send(t);if(ac(n)){let e=navigator.connection;throw o5("cde_response_error",{error_message:n.message,message_type:t.type,user_agent:navigator.userAgent,online:navigator.onLine,has_focus:document.hasFocus(),href:window.location.href,document_visibility_state:document.visibilityState,connection_downlink:e?.downlink,connection_effective_type:e?.effectiveType,connection_rtt:e?.rtt,connection_save_data:e?.saveData}),new ai(n)}if(!al(n,r)){let e=r.safeParse(n);throw e.success?Error("Invalid state"):(console.error("OJS queryApi got a schema error. Expected schema:",r,"Actual:",n),e.error)}return o&&o5(o,{...n}),n}),al=(e,t)=>t.safeParse(e).success,ac=e=>rC.safeParse(e).success,au=async(e,t)=>await as(e,{type:"get_checkout_preview",payload:t},rD),ad=async e=>await as(e,{type:"get_prefill",payload:{}},rq),ap=async(e,t)=>await as(e,{type:"v2_start_payment_flow",payload:t},rW,"start_payment_flow"),am=async(e,t)=>await as(e,{type:"start_payment_flow_for_cc",payload:t},rQ,"start_payment_flow_for_cc"),ah=async(e,t)=>{o5("start_payment_flow_for_pr",{...t});let r=await as(e,{type:"start_payment_flow_for_pr",payload:t},rW);return o5("start_payment_flow_for_pr_result",{...r}),r},a_=async(e,t)=>await as(e,{type:"confirm_payment_flow",payload:t},rf,"confirm_payment_flow"),af=async(e,t)=>await as(e,{type:"finalize_setup_payment_method",payload:t},r$,"finalize_setup_payment_method"),ay=async(e,t)=>await as(e,{type:"check_if_popup_window_verified",payload:t},r_,"check_if_popup_window_verified"),ag=async(e,t,r)=>{let o=await au(e,{secure_token:t,promotion_code:r}),n=new Set(o.preview.invoices.map(e=>e.currency));if(1!==n.size)throw Error(`Expected exactly one currency, got ${n.size}`);return{currency:n.values().next().value??"usd",amountAtom:o.preview.invoices.map(e=>e.remaining_amount_atom).reduce((e,t)=>e+t,0)}},aw=async(e,t,r,o)=>{if(r)return{amountAtom:0,currency:"usd"};
12{o=o||void 0,sessionStorage.getItem("promoCode")&&!o&&(o=sessionStorage.getItem("promoCode"));let r=await ag(e,t,o);return{amountAtom:r.amountAtom,currency:r.currency}}},av=async(e,t)=>{if(0===e.size)throw Error("No CDE connections found");return await Promise.all(Array.from(e.values()).map(e=>as(e,{type:"tokenize_card",payload:t},rc)))},ab=async(e,t)=>await as(e,{type:"checkout_card_elements",payload:t},ri,"checkout_card_elements"),ak=async(e,t)=>await as(e,{type:"setup_payment_method",payload:t},r$,"setup_checkout"),aP=async(e,t)=>await as(e,{type:"checkout",payload:t},ri,"perform_checkout"),aI=async(e,t,r,o)=>{console.log(t);let n=await (0,i.iZ)({iframe:e,debug:!0,timeout:1e3,childOrigin:"*"}).promise,a=await as(n,{type:r},o);return console.log("\uD83D\uDFE2 CDE connection successful! Stopping polling... Result:",a),a},aE=async(e,t)=>await as(e,{type:"prepare_payment_flow",payload:t},r0,"prepare_payment_flow"),aC=async(e,t)=>{try{return(await as(e,{type:"get_standardized_error_code",payload:{message:t}},rX)).error_code}catch(e){return console.error("[cde-client] Error during getStandardizedErrorCode:",r7(e)),"PAYMENT_FAILED_GENERIC"}},aS=async(e,t)=>await as(e,{type:"set_user_device_token",payload:{device_token:t}},r1),aA=async e=>{if("object"!=typeof e||!e)return!1;try{let t=await e.send({type:"ping"});if(!0!==t)throw Error(`Expected 'true' after ping, got ${JSON.stringify(t)}`);return!0}catch(e){return console.error("Invalid CDE connection check:",e),!1}},aj="https://cde.getopenpay.com",aY="0123456789ABCDEFGHJKMNPQRSTVWXYZ";!function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"}(a||(a={}));class ax extends Error{constructor(e,t){super(`${t} (${e})`),this.name="ULIDError",this.code=e}}let aT="op_analytics_device_token",aN=()=>{let e=document.cookie.split(";").find(e=>e.includes(aT));if(e)return e.split("=")[1];let t=function(e,t){let r=function(e){let t="u">typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:"u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:null,r=t&&(t.crypto||t.msCrypto)||null;if("function"==typeof r?.getRandomValues)return()=>{let e=new Uint8Array(1);return r.getRandomValues(e),e[0]/255};if("function"==typeof r?.randomBytes)return()=>r.randomBytes(1).readUInt8()/255;throw new ax(a.PRNGDetectFailure,"Failed to find a reliable PRNG")}();return function(e,t=10){if(isNaN(e))throw new ax(a.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>0xffffffffffff)throw new ax(a.EncodeTimeSizeExceeded,`Cannot encode a time larger than 28
121474976710655: ${e}`);if(e<0)throw new ax(a.EncodeTimeNegative,`Time must be positive: ${e}`);if(!1===Number.isInteger(e))throw new ax(a.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let r,o="";for(let n=t;n>0;n--)r=e%32,o=aY.charAt(r)+o,e=(e-r)/32;return o}(Date.now(),10)+function(e,t){let r="";for(;e>0;e--)r=function(e){let t=Math.floor(32*e())%32;return aY.charAt(t)}(t)+r;return r}(16,r)}();return aR(t),t},aR=e=>{let t=new Date;t.setFullYear(t.getFullYear()+1),document.cookie=`${aT}=${e}; path=/; expires=${t.toUTCString()}`},aL=(e,t)=>Array.from(e.querySelectorAll("[data-opid]")??[]).reduce((e,t)=>{let r=t.getAttribute("data-opid");if(!r)return e;let o="checkbox"===t.type?t.checked:t.value;return{...e,[r]:o}},{}),aM=e=>({line1:e[tD.LINE1],line2:e[tD.LINE2],line3:e[tD.LINE3],city:e[tD.CITY],state:e[tD.STATE],country:e[tD.COUNTRY],zip_code:e[tD.ZIP_CODE]}),aO=(e,t)=>{if(t.require_full_shipping_address)return{line1:e[tD.SHIPPING_LINE1],line2:e[tD.SHIPPING_LINE2],line3:e[tD.SHIPPING_LINE3],city:e[tD.SHIPPING_CITY],state:e[tD.SHIPPING_STATE],country:e[tD.SHIPPING_COUNTRY],zip_code:e[tD.SHIPPING_ZIP_CODE]}},aF=(e,t)=>[e,t].filter(Boolean).join(" "),aD=(e,t)=>{let{id:r,title:o,width:n,height:a,name:i}=t??{},s=document.createElement("template");s.innerHTML=` 13 <style> 14 ${(({width:e,height:t})=>` 15@keyframes fadeIn { 16 from { 17 opacity: 0; 18 transform: scale(0.9); 19 } 20 to { 21 opacity: 1; 22 transform: scale(1); 23 } 24} 25 26.overlay { 27 position: fixed; 28 top: 0; 29 left: 0; 30 width: 100%; 31 height: 100%; 32 z-index: 2147483648 !important; 33 display: flex; 34 justify-content: center; 35 align-items: center; 36 background-color: rgba(0, 0, 0, 0.5); 37} 38.container { 39 max-width: ${e??"500px"}; 40 max-height: ${t??"600px"}; 41 width: 100%; 42 height: 100%; 43 background-color: white; 44 position: relative; 45 animation: fadeIn 0.3s ease-out; 46} 47.frame, #adyen-container, #adyen-container > * { 48 max-width: ${e??"500px"}; 49 max-height: ${t??"600px"}; 50 width: 100%; 51 height: 100%; 52 border: none; 53} 54.cancel-button { 55 position: absolute; 56 background: transparent; 57 border: none; 58 font-size: 1rem; 59 color: #fff; 60 cursor: pointer; 61 top: -1.5rem; 62 padding: 0; 63 right: 0; 64} 65`)({width:n,height:a})} 66 </style> 67 <div class="overlay"> 68 <div class="container"> 69 <button class="cancel-button">Cancel</button> 70 <iframe src="${e}" class="frame" id="${r??"three-ds-iframe"}" title="${o??"3D Secure verification"}" allow="payment" name="${i??"three-ds-iframe"}"></iframe> 71 </div> 72 </div> 73 `;let l=document.createElement("div"),c=l.attachShadow({mode:"open"});c.appendChild(s.content.cloneNode(!0));let u=c.querySelector("#three-ds-iframe"),d=c.querySelector(".cancel-button");return document.body.appendChild(l),{host:l,iframe:u,cancelButton:d}},aU=(e,t)=>{let{width:r,height:o,title:n}=t??{};return new Promise((t,a)=>{let i=document.createElement("template"),s=e.map((e,t)=>{let r=e.resources.logo_url?`<img src="${e.resources.logo_url}" alt="${e.display_name}" class="bank-logo" />`:`<div class="bank-logo-placeholder">${e.display_name.substring(0,2).toUpperCase()}</div>`;return` 74 <div class="bank-item" data-bank-index="${t}"> 75 ${r} 76 <div class="bank-info"> 77 <div class="bank-display-name">${e.display_name}</div> 78 <div class="bank-name">${e.bank_name}</div> 79 </div> 80 </div> 81 `}).join("");i.innerHTML=` 82 <style> 83 ${(({width:e,height:t})=>` 84@keyframes fadeIn { 85 from { 86 opacity: 0; 87 transform: scale(0.9); 88 } 89 to { 90 opacity: 1; 91 transform: scale(1); 92 } 93} 94 95.overlay { 96 position: fixed; 97 top: 0; 98 left: 0; 99 width: 100%; 100 height: 100%; 101 z-index: 2147483648 !important; 102 display: flex; 103 justify-content: center; 104 align-items: center; 105 background-color: rgba(0, 0, 0, 0.5); 106} 107.container { 108 max-width: ${e??"500px"}; 109 max-height: ${t??"600px"}; 110 width: 100%; 111 background-color: white; 112 position: relative; 113 animation: fadeIn 0.3s ease-out; 114 border-radius: 8px; 115 box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1); 116} 117.bank-selector-content { 118 padding: 24px; 119 max-height: calc(${t??"600px"} - 48px); 120 overflow-y: auto; 121} 122.bank-selector-header { 123 font-size: 1.25rem; 124 font-weight: 600; 125 margin-bottom: 20px; 126 color: #1a1a1a; 127 text-align: center; 128} 129.bank-list { 130 display: flex; 131 flex-direction: column; 132 gap: 12px; 133} 134.bank-item { 135 display: flex; 136 align-items: center; 137 padding: 16px; 138 border: 2px solid #e5e5e5; 139 border-radius: 8px; 140 cursor: pointer; 141 transition: all 0.2s ease; 142 background-color: #ffffff; 143} 144.bank-item:hover { 145 border-color: #3b82f6; 146 background-color: #f8fafc; 147 transform: translateY(-1px); 148 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); 149} 150.bank-item:active { 151 transform: translateY(0); 152} 153.bank-logo { 154 width: 40px; 155 height: 40px; 156 border-radius: 6px; 157 object-fit: contain; 158 margin-right: 16px; 159 background-color: #f8f9fa; 160 border: 1px solid #e9ecef; 161} 162.bank-logo-placeholder { 163 width: 40px; 164 height: 40px; 165 border-radius: 6px; 166 background-color: #e9ecef; 167 display: flex; 168 align-items: center; 169 justify-content: center; 170 margin-right: 16px; 171 color: #6c757d; 172 font-size: 0.875rem; 173 font-weight: 500; 174} 175.bank-info { 176 flex: 1; 177} 178.bank-display-name { 179 font-size: 1rem; 180 font-weight: 500; 181 color: #1a1a1a; 182 margin-bottom: 2px; 183} 184.bank-name { 185 font-size: 0.875rem; 186 color: #6c757d; 187} 188.cancel-button { 189 position: absolute; 190 background: transparent; 191 border: none; 192 font-size: 1rem; 193 color: #fff; 194 cursor: pointer; 195 top: -1.5rem; 196 padding: 0; 197 right: 0; 198} 199`)({width:r,height:o})} 200 </style> 201 <div class="overlay"> 202 <div class="container"> 203 <button class="cancel-button">Cancel</button> 204 <div class="bank-selector-content"> 205 <div class="bank-selector-header">${n??"Select your bank"}</div> 206 <div class="bank-list"> 207 ${s} 208 </div> 209 </div> 210 </div> 211 </div> 212 `;let l=document.createElement("div"),c=l.attachShadow({mode:"open"});c.appendChild(i.content.cloneNode(!0));let u=c.querySelector(".cancel-button"),d=c.querySelectorAll(".bank-item"),p=()=>{document.body.removeChild(l)};u.addEventListener("click",()=>{p(),a(Error("Bank selection cancelled"))}),d.forEach((r,o)=>{r.addEventListener("click",()=>{p(),t(e[o])})}),document.body.appendChild(l)})},aq=(e,t)=>{let{width:r,height:o,baseUrl:n}=t??{},a=new URL(`app/direct_debit/micro_deposit/?type=${e}`,n).toString();return new Promise((e,t)=>
212{let i=aD(a,{width:r,height:o,title:"Micro Deposit Form"}),s=()=>{i.host.remove()},l=()=>{s(),t(Error("Micro deposit form cancelled"))};i.cancelButton.addEventListener("click",l);let c=az(i.iframe,r=>{s(),"success"===r.status&&r.payload?"error"in r.payload?t(Error(r.payload.error)):e(r.payload):t(Error("Micro deposit form failed"))},new URL(n).origin,"micro-deposit-status",rI);i.cancelButton.removeEventListener("click",l),i.cancelButton.addEventListener("click",()=>{i.cancelButton.removeEventListener("click",l),clearInterval(c),l()})})};function az(e,t,r,o,n){let a=async()=>{try{let a=await aI(e,r,o,n);a&&(clearInterval(i),t(a))}catch{}};a();let i=setInterval(a,1e3);return i}function aG({elements:e,pollingInterval:t,resolve:r}){let o=()=>{clearInterval(t),e.host.remove(),r({status:ru.CANCELLED})};return e.cancelButton.addEventListener("click",o),()=>{e.cancelButton.removeEventListener("click",o)}}async function aV(e){let{url:t,baseUrl:r,frameWidth:o,frameHeight:n,frameTitle:a}=e,i=aD(t,{width:o,height:n,title:a});return new Promise(e=>{let t=az(i.iframe,t=>{setTimeout(()=>{i.host.remove()},1e3),e(t),o?.()},new URL(r).origin,"ping-3ds-status",rd),o=aG({elements:i,pollingInterval:t,resolve:e})})}let a$=async e=>{let t=await aV(e);if(t.status===ru.CANCELLED)throw Error("3DS verification cancelled");if(t.status===ru.FAILURE)throw Error("3DS verification failed");return t.status!==ru.SUCCESS&&oJ(t.status),{href:t.href}},aH=async(e,t,r,o)=>{let{err__:n}=oo("popup-verify");return new Promise((a,i)=>{let s=((e,t)=>{let r=window.open(t,"_blank");if(!r)throw Error(`${e} popup window blocked. Please allow popups for this site.`);return r})(e,o),l=setInterval(async()=>{try{let o=await ay(t,r);if(o.present)clearInterval(l),s.close(),a({href:o.href});else if(s.closed)throw Error(`${e} payment cancelled`)}catch(e){n(r7(e)),clearInterval(l),i(r7(e))}},1e3)})},aB=()=>{let e=(navigator.languages&&navigator.languages.length?navigator.languages:[navigator.language])?.[0];return e&&(e=e.split("-")[0]),e},{log__:aK,err__:aZ}=oo("common-cc"),{log__:aJ,err__:aW}=oo("common-cc"),aQ=(e,t,r={})=>{if(r){aK(`Received default field values: ${JSON.stringify(r)}`);let t=Object.keys(r);for(let o=0;o<t.length;o++){let n=t[o],a=r[n];e[n]||(e[n]=a)}}e[tD.IS_SHIPPING_SAME_AS_BILLING]=!!e[tD.IS_SHIPPING_SAME_AS_BILLING],e[tD.IS_SHIPPING_SAME_AS_BILLING]&&(e[tD.SHIPPING_LINE1]=e[tD.LINE1],e[tD.SHIPPING_LINE2]=e[tD.LINE2],e[tD.SHIPPING_LINE3]=e[tD.LINE3],e[tD.SHIPPING_CITY]=e[tD.CITY],e[tD.SHIPPING_STATE]=e[tD.STATE],e[tD.SHIPPING_COUNTRY]=e[tD.COUNTRY],e[tD.SHIPPING_ZIP_CODE]=e[tD.ZIP_CODE]);let o=(({require_zip_code:e,require_full_billing_address:t,require_full_shipping_address:r,payment_method:o,isBusinessPurchase:n},a)=>{let i={};return"ach"===o&&(i[tD.FIRST_NAME]=s.Yj().min(2,{message:"Minimum length is 2"}),i[tD.LAST_NAME]=s.Yj().min(2,{message:"Minimum length is 2"})),e&&(i[tD.ZIP_CODE]=tM),t&&(i[tD.LINE1]=tM,i[tD.CITY]=tM,i[tD.STATE]=tM,i[tD.COUNTRY]=tM,i[tD.ZIP_CODE]=tM),r&&(i[tD.SHIPPING_LINE1]=tM,i[tD.SHIPPING_CITY]=tM,i[tD.SHIPPING_STATE]=tM,i[tD.SHIPPING_COUNTRY]=tM,i[tD.SHIPPING_ZIP_CODE]=tM),(a[tD.IS_BUSINESS_PURCHASE]??n)&&(i[tD.BUSINESS_NAME]=tM),0===Object.keys(i).length?t9:t9.extend(i)})(r,e).safeParse(e);if(!o.success){let e=(e=>{let t={};return Object.entries(e).forEach(([e,r])=>{try{let o=tU.parse(e);Array.isArray(r)?t[o]=r:Array.isArray(r._errors)&&(t[o]=r._errors)}catch{return}}),t})(o.error.format()),r=Object.keys(e);for(let o=0;o<r.length;o++){let n=r[o],a=e[n];t(n,a,n)}throw aZ("Got validation errors in non-CDE form fields",e),Error("Almost there! Just a few things highlighted above to fix before you can submit.")}return o.data},aX=(e,t)=>{for(let r of e)if(!1===r.success)throw r.errors.forEach(e=>{let r=tG.safeParse(e.elementType);r.success?t(r.data,e.errors):aW(`Unknown field name in onValidationError: ${e.elementType}. Error object:`,e)}),aJ(`Error tokenizing card: got validation errors: ${JSON.stringify(r.errors)}`),Error("Got validation errors while tokenizing card")},{err__:a0}=oo("common"),a1=e=>{if(1!==e.payment_methods.length)throw Error(`Expected exactly one payment method, got ${e.payment_methods.length}`);return{payment_method_id:e.payment_methods[0].id}},a3=(e,t)=>{let r=e.find(e=>t.safeParse(e).success);
212if(!r)throw a0("No CPMs found for model. All models:",e),Error("No CPMs found for model");return t.parse(r)},a2=(e,t)=>({new_customer_email:e.email,new_customer_last_name:e.lastName,new_customer_first_name:e.firstName,customer_business_name:e.businessName,customer_tax_id:e.taxId,customer_tax_id_type:e.taxIdType,new_customer_address:aM(e),new_customer_shipping_address:aO(e,t),customer_language:aB(),new_customer_phone:e.phone}),a5=async e=>{let{log__:t}=oo(e.logPrefix),r=await ad(e.anyCdeConnection),o=a1(e.confirmResult);if("setup"===r.mode)return t("Setting up payment method..."),{mode:"setup",result:await af(e.anyCdeConnection,{secure_token:r.token,pm_id:o.payment_method_id})};{if(e.usePayFirstFlow){if(t("Using pay-first flow..."),!e.confirmResult.pay_first_success_response)throw a0("Checkout failed, no pay-first success response:",e.confirmResult),Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:e.confirmResult.pay_first_success_response}}let n={secure_token:r.token,payment_input:{provider_type:e.checkoutPaymentMethod.provider},customer_email:e.requiredFormFields[tD.EMAIL],customer_address:aM(e.requiredFormFields),customer_shipping_address:aO(e.requiredFormFields,r.checkout_settings),promotion_code:e.requiredFormFields[tD.PROMOTION_CODE],line_items:r.line_items,total_amount_atom:r.amount_total_atom,cancel_at_end:!1,use_confirmed_pm_id:o.payment_method_id,checkout_payment_method:e.checkoutPaymentMethod};return t("Doing checkout...",n),{mode:"checkout",result:await aP(e.anyCdeConnection,n)}}},a4=s.k5(["stripe","airwallex","authorize_net","adyen","paypal","pockyt","loop"]);a4.Enum.stripe;let a6=({scriptId:e,src:t,checkLoadedFn:r})=>{let o=new AbortController;return new Promise((n,a)=>{let i=document.createElement("script");i.src=t,i.id=e,i.async=!0;let s=document.getElementById(e);r()?n():s?i=s:document.body.appendChild(i),i.addEventListener("load",()=>{o.abort(),n()},{signal:o.signal}),i.addEventListener("error",()=>{o.abort(),a("Failed to load the script")},{signal:o.signal})})},a8=({gateway:e,gatewayMerchantId:t,merchantName:r,merchantId:o,initialPreview:n,overridePaymentRequest:a,prefill:i})=>{let s=Math.max((a?.amount?.amountAtom??n?.amountAtom??0)/100,0),l=(a?.amount?.currency??i?.currency??n.currency).toUpperCase(),c={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],allowedCardNetworks:["AMEX","DISCOVER","INTERAC","JCB","MASTERCARD","VISA"],billingAddressRequired:!0,billingAddressParameters:{format:"FULL"},allowCreditCards:!0,allowPrepaidCards:!0},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:e,gatewayMerchantId:t}}}],emailRequired:!0,shippingAddressRequired:i.checkout_settings.require_full_shipping_address,merchantInfo:{merchantId:o??"",merchantName:r},transactionInfo:{countryCode:"US",currencyCode:l,totalPriceStatus:a?.pending?"ESTIMATED":"FINAL",totalPrice:s.toFixed(2)}};return a?.googlePayPaymentRequest?"function"==typeof a.googlePayPaymentRequest?{...c,...a.googlePayPaymentRequest(c)}:{...c,...a.googlePayPaymentRequest}:c},a9=()=>a6({scriptId:"__op_internal_google_pay_sdk",src:"https://pay.google.com/gp/p/js/pay.js",checkLoadedFn:()=>!!window.google?.payments?.api}),a7=null,ie=async e=>await oZ(e)==="prod"?"PRODUCTION":"TEST",it=async(e,t)=>{let r=await ie(e);return null===a7&&(a7=new window.google.payments.api.PaymentsClient({environment:r,merchantInfo:t.merchantInfo})),a7},ir=e=>{let t=e.required_user_actions.find(e=>"airwallex_payment_consent"===e.type);return t?rh.parse(t):null},io=(e,t)=>{let r={...e},o=t.paymentMethodData?.info?.billingAddress,n=t.shippingAddress;if(o){let[e,...n]=o.name?.trim()?.split(/\s+/)??[],a=n.join(" ")||void 0;r[tD.EMAIL]=r[tD.EMAIL]||t.email||"[email protected]",r[tD.LINE1]=r[tD.LINE1]||o.address1||"",r[tD.LINE2]=r[tD.LINE2]||o.address2||"",r[tD.LINE3]=r[tD.LINE3]||o.address3||"",r[tD.CITY]=r[tD.CITY]||o.locality||"",r[tD.STATE]=r[tD.STATE]||o.administrativeArea||"",r[tD.COUNTRY]=r[tD.COUNTRY]||o.countryCode||"US",r[tD.ZIP_CODE]=r[tD.ZIP_CODE]||o.postalCode||"00000";let i=r[tD.FIRST_NAME]||e||"",s=r[tD.LAST_NAME]||a||"";i||s?(r[tD.FIRST_NAME]=i,r[tD.LAST_NAME]=s):(r[tD.FIRST_NAME]="_OP_UNKNOWN",r[tD.LAST_NAME]="")}
212return n&&(r[tD.SHIPPING_LINE1]=r[tD.SHIPPING_LINE1]||n.address1||"",r[tD.SHIPPING_LINE2]=r[tD.SHIPPING_LINE2]||n.address2||"",r[tD.SHIPPING_LINE3]=r[tD.SHIPPING_LINE3]||n.address3||"",r[tD.SHIPPING_CITY]=r[tD.SHIPPING_CITY]||n.locality||"",r[tD.SHIPPING_ZIP_CODE]=r[tD.SHIPPING_ZIP_CODE]||n.postalCode||"00000",r[tD.SHIPPING_STATE]=r[tD.SHIPPING_STATE]||n.administrativeArea||"",r[tD.SHIPPING_COUNTRY]=r[tD.SHIPPING_COUNTRY]||n.countryCode||"US"),r},{log__:ia,err__:ii}=oo("awx-bacs"),is=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{let a,i=aQ(r,o.get.onValidationError),s=e.anyCdeConnection,l=await ad(s),c=n.verificationMethod??"truelayer",u=null;if("micro_deposit"===c){ia("Micro deposit verification selected, showing form...");try{u=await aq("bacs_direct_debit",{width:"450px",height:"350px",baseUrl:e.baseUrl}),ia("Micro deposit data collected")}catch{throw ia("Micro deposit form cancelled"),Error("Micro deposit form cancelled")}}let d=ir(await ap(s,{payment_provider:t.provider,checkout_payment_method:t,...a2(i,l.checkout_settings),customer_language:aB()})),p=d?.consent_id,m=d?.available_banks;if("truelayer"===c&&m&&m.length>=1){ia("Multiple banks available, showing bank selector...");try{a=await aU(m,{width:"450px",height:"500px",title:"Select bank"}),ia(`Bank selected: ${a.display_name}`)}catch{throw ia("Bank selection cancelled"),Error("Bank selection cancelled")}}let h=aM(i),_={type:"bacs_direct_debit",bacs_direct_debit:{bank_name:a?.bank_name,owner_name:aF(i[tD.FIRST_NAME],i[tD.LAST_NAME]),owner_email:i[tD.EMAIL],country_code:i[tD.COUNTRY],account_number:u?.account_number,sort_code:u?.sort_code,address:{...h,town:h.city,postcode:h.zip_code}}},f=(await a_(s,{secure_token:l.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:p,verification_method:c,direct_debit_data:_}})).required_user_actions?.find(e=>"airwallex_payment_consent"===e.type)?.redirect_url;if(f){ia("BACS verification required, starting verification...");let{status:t}=await aV({url:f,baseUrl:e.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"BACS verification"});if(ia(`â° BACS verification completed [Status: ${t}]`),t===ru.CANCELLED)throw Error("BACS verification cancelled");if(t===ru.FAILURE)throw Error("BACS verification failed")}let y=await a_(s,{secure_token:l.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:p}});try{return a5({logPrefix:"awx-bacs",anyCdeConnection:s,checkoutPaymentMethod:t,requiredFormFields:i,confirmResult:y,usePayFirstFlow:!1})}catch(e){throw ii("BACS payment error",e),o5("checkout_error",{error:e}),Error(e?.message??"Unknown error")}}),{log__:il,err__:ic}=oo("awx-eft"),iu=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{let a=aQ(r,o.get.onValidationError),i=e.anyCdeConnection,s=await ad(i),l=n.verificationMethod??"plaid",c=null;if("micro_deposit"===l){il("Micro deposit verification selected, showing form...");try{c=await aq("eft_direct_debit",{width:"450px",height:"450px",baseUrl:e.baseUrl}),il("Micro deposit data collected")}catch{throw il("Micro deposit form cancelled"),Error("Micro deposit form cancelled")}}let u=await ap(i,{payment_provider:t.provider,checkout_payment_method:t,...a2(a,s.checkout_settings),customer_language:aB()}),d=ir(u)?.consent_id,p={type:"eft_direct_debit",eft_direct_debit:{business_account:n.isBusinessAccount??!1,owner_name:aF(a[tD.FIRST_NAME],a[tD.LAST_NAME]),owner_email:a[tD.EMAIL],institution_number:c?.institution_number,transit_number:c?.transit_number,account_number:c?.account_number}},m=(await a_(i,{secure_token:s.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:d,verification_method:l,direct_debit_data:p}})).required_user_actions?.find(e=>"airwallex_payment_consent"===e.type)?.redirect_url;if(m){il("EFT verification required, starting verification...");let{status:t}=await aV({url:m,baseUrl:e.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"EFT verification"});if(il(`â° EFT verification completed [Status: ${t}]`),t===ru.CANCELLED)throw Error("EFT verification cancelled");if(t===ru.FAILURE)throw Error("EFT verification failed")}let h=await a_(i,{secure_token:s.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:d}});try{return a5({logPrefix:"awx-eft",anyCdeConnection:i,checkoutPaymentMethod:t,requiredFormFields:a,confirmResult:h,usePayFirstFlow:!1})}catch(e){throw ic("EFT payment error",e),o5("checkout_error",{error:e}),Error(e?.message??"Unknown error")}}),{log__:id,err__:ip}=oo("awx-sepa"),im=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{let a,i=aQ(r,o.get.onValidationError),s=e.anyCdeConnection,l=await ad(s),c=n.verificationMethod??"truelayer",u=null;if("micro_deposit"===c){id("Micro deposit verification selected, showing form...");try{u=await aq("sepa_direct_debit",{width:"450px",height:"300px",baseUrl:e.baseUrl}),id("Micro deposit data collected")}catch{throw id("Micro deposit form cancelled"),Error("Micro deposit form cancelled")}}let d=ir(await ap(s,{payment_provider:t.provider,checkout_payment_method:t,...a2(i,l.checkout_settings),customer_language:aB()})),p=d?.consent_id,m=d?.available_banks;if("truelayer"===c&&m&&m.length>=1){id("Multiple banks available, showing bank selector...");
212try{a=await aU(m,{width:"450px",height:"500px",title:"Select bank"}),id(`Bank selected: ${a.display_name}`)}catch{throw id("Bank selection cancelled"),Error("Bank selection cancelled")}}let h=(await a_(s,{secure_token:l.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:p,verification_method:c,direct_debit_data:{type:"sepa_direct_debit",sepa_direct_debit:{bank_name:a?.bank_name,country_code:i[tD.COUNTRY],owner_name:aF(i[tD.FIRST_NAME],i[tD.LAST_NAME]),owner_email:i[tD.EMAIL],iban:u?.iban}}}})).required_user_actions?.find(e=>"airwallex_payment_consent"===e.type)?.redirect_url;if(h){id("SEPA verification required, starting verification...");let{status:t}=await aV({url:h,baseUrl:e.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"SEPA verification"});if(id(`â° SEPA verification completed [Status: ${t}]`),t===ru.CANCELLED)throw Error("SEPA verification cancelled");if(t===ru.FAILURE)throw Error("SEPA verification failed")}let _=await a_(s,{secure_token:l.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:p}});try{return a5({logPrefix:"awx-sepa",anyCdeConnection:s,checkoutPaymentMethod:t,requiredFormFields:i,confirmResult:_,usePayFirstFlow:!1})}catch(e){throw ip("SEPA payment error",e),o5("checkout_error",{error:e}),Error(e?.message??"Unknown error")}}),{log__:ih,err__:i_}=oo("airwallex-cc"),iy=s.Ik({"op-airwallex-3ds-url":s.Yj(),"op-airwallex-initial-intent-id":s.Yj(),"op-airwallex-consent-id":s.Yj()}),ig=e=>e?.["op-airwallex-3ds-url"]!==void 0,iw=async(e,t)=>{let r=(e=>{let t=iy.safeParse(e);if(!t.success)throw i_(`Airwallex 3DS is required but headers are malformed. Got: ${JSON.stringify(e)}`),Error("Unable to process your credit card. Please contact support for assistance.");return t.data})(t),o=(e=>{try{let t=new URL(e??"").searchParams.get("payment_intent_id");if(!t)throw Error("No intent ID found in Airwallex 3DS verification result");return ih(`Airwallex 3DS verification success. [Intent ID: ${t}]`),t}catch(r){let t="Error verifying Airwallex 3DS verification result.";throw i_(t,`Resulting URL: ${e}. 213Error: ${r7(r)}`),Error(t)}})((await a$({url:r["op-airwallex-3ds-url"],baseUrl:e})).href??""),n=r["op-airwallex-initial-intent-id"];if(n!==o)throw i_(`Intent ID from callback (${o}) does not match the initial intent ID (${n}).`),Error("Unable to process your credit card. Please contact support for assistance.");return{existing_cc:{initial_intent_id:o,consent_id:r["op-airwallex-consent-id"]}}},iv=s.Ik({provider:s.eu("apple_pay"),processor_name:s.eu("airwallex"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj()})}),ib=s.Ik({provider:s.eu("google_pay"),processor_name:s.eu("airwallex"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj(),google_pay_merchant_id:s.Yj().nullish()})}),ik=()=>a6({scriptId:"__op_internal_apple_pay_sdk",src:"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",checkLoadedFn:()=>!!window.ApplePaySession}),iP=(e,t)=>{let r=t.token.paymentMethod.billingContact,o=t.billingContact,n=t.shippingContact,a={...e};if(r||o||n){a[tD.EMAIL]=a[tD.EMAIL]||r?.emailAddress||o?.emailAddress||n?.emailAddress||"[email protected]",a[tD.COUNTRY]=a[tD.COUNTRY]||r?.countryCode||o?.countryCode||n?.countryCode||"US",a[tD.ZIP_CODE]=a[tD.ZIP_CODE]||r?.postalCode||o?.postalCode||n?.postalCode||"00000";let e=a[tD.FIRST_NAME]||r?.givenName||o?.givenName||n?.givenName||"",t=a[tD.LAST_NAME]||r?.familyName||o?.familyName||n?.familyName||"";e||t?(a[tD.FIRST_NAME]=e,a[tD.LAST_NAME]=t):(a[tD.FIRST_NAME]="_OP_UNKNOWN",a[tD.LAST_NAME]="")}return a};s.Ik({data:s.Ik({messageHeaders:s.g1(s.Yj(),s.bz()),errors:s.YO(s.bz()),messageType:s.Yj(),messageBody:s.g1(s.Yj(),s.bz())}),origin:s.eu("https://applepay.cdn-apple.com")});let iI=({overridePaymentRequest:e,initialPreview:t,prefill:r,defaultLabel:o="Total"})=>{let n=(e?.amount?.currency??r?.currency??t.currency).toUpperCase(),a=((e?.amount?.amountAtom??t?.amountAtom??0)/100).toFixed(2);return{currencyCode:n,total:{label:e?.label??o??"Total",type:e?.pending?"pending":"final",amount:a}}},iE=({overridePaymentRequest:e,initialPreview:t,prefill:r,defaultLabel:o})=>{let{currencyCode:n,total:a}=iI({overridePaymentRequest:e,initialPreview:t,prefill:r,defaultLabel:o}),i={countryCode:"US",currencyCode:n,requiredBillingContactFields:["email","postalAddress","name"],requiredShippingContactFields:["email",...r.checkout_settings.require_full_shipping_address?["postalAddress"]:[]],supportedNetworks:["visa","masterCard","amex","discover","jcb"],merchantCapabilities:["supports3DS","supportsCredit","supportsDebit"],total:a};return r.line_items.every(e=>e.billing_interval&&e.billing_interval_count)&&(i.recurringPaymentRequest=(({total:e,prefill:t})=>
213{if("setup"===t.mode)return{paymentDescription:"Setup recurring payment",regularBilling:{amount:e.amount,label:"Setup recurring payment",paymentTiming:"recurring",type:"final"},managementURL:new URL(`/pay/${t.token}`,aj).toString()};let r=t.line_items?.[0];if(!r)return;let o=r?.billing_interval==="week"?"day":r?.billing_interval,n=r?.billing_interval_count?r?.billing_interval==="week"?r?.billing_interval_count*7:r?.billing_interval_count:void 0;return{paymentDescription:r?.description??"",regularBilling:{amount:e.amount,label:r?.description??"",recurringPaymentIntervalUnit:o,recurringPaymentIntervalCount:n,paymentTiming:"recurring",type:"final"},managementURL:`https://cde.getopenpay.com/pay/${t.token}`}})({total:a,prefill:r})),e?.applePayPaymentRequest&&(i="function"==typeof e.applePayPaymentRequest?{...i,...e.applePayPaymentRequest(i)}:{...i,...e.applePayPaymentRequest}),i},iC=s.k5(["test","live","live-us","live-in","live-apse","live-au"]),iS=s.k5(["ar","bg-BG","ca-ES","cs-CZ","da-DK","de-DE","el-GR","en-US","es-ES","et-EE","fi-FI","fr-FR","hr-HR","hu-HU","is-IS","it-IT","ja-JP","ko-KR","lt-LT","lv-LV","nl-NL","no-NO","pl-PL","pt-BR","pt-PT","ro-RO","ru-RU","sk-SK","sl-SI","sv-SE","zh-CN","zh-TW"]),{log__:iA,err__:ij}=oo("adyen-cc"),iY=s.Ik({"op-account-id":s.Yj(),"op-adyen-client-key":s.Yj(),"op-adyen-environment":iC,"op-adyen-action":s.Yj()}),ix="Unable to process your credit card. Please contact support for assistance.",iT=()=>"AdyenWeb"in window&&"AdyenCheckout"in window.AdyenWeb,iN=async()=>{iA("Waiting for Adyen SDK to load...");for(let e=0;e<10;e++)iT()||await nc(500);if(!iT())throw ij("Adyen SDK not loaded properly"),Error(ix);return iA("Adyen SDK loaded successfully"),window.AdyenWeb.AdyenCheckout},iR=e=>e?.["op-adyen-action"]!==void 0,iL=async(e,t,r)=>{let o=(e=>{let t=iY.safeParse(e);if(!t.success)throw ij(`Adyen 3DS is required but headers are malformed. Got: ${JSON.stringify(e)}`),Error(ix);return t.data})(t),n=document.createElement("div");n.id="adyen-container";let{host:a,iframe:i,cancelButton:s}=aD("http://example.com");i.replaceWith(n);let l=await (e=>{let{headers:t,locale:r,countryCode:o,component:n,host:a,cancelButton:i}=e,s=JSON.parse(t["op-adyen-action"]);return iA(`Running Adyen 3DS flow for action type: ${s.type}`),new Promise(e=>{let l=()=>{iA("Cleaning up Adyen 3DS flow"),i.removeEventListener("click",d),a.remove()},c=t=>{ij("Authentication failed. Result:",t),e({status:ru.FAILURE,cleanup:l})},u=t=>{ij("Adyen error:",t),e({status:ru.FAILURE,cleanup:l})},d=()=>{e({status:ru.CANCELLED,cleanup:l})};i.addEventListener("click",d);let p=(t,r,o)=>{a.remove(),e({status:ru.SUCCESS,additionalDetails:t,cleanup:l})};iN().then(e=>e({clientKey:t["op-adyen-client-key"],environment:t["op-adyen-environment"],locale:r,countryCode:o,onAdditionalDetails:p,onPaymentFailed:c,onError:u})).then(e=>{e.createFromAction(s,{challengeWindowSize:"03"}).mount(n)})})})({headers:o,locale:(e=>{let t=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language,r=e??t,o=iS.safeParse(r);return o.success?(iA(`Resolved locale: ${o.data}`),o.data):(ij(`Resolved invalid locale: ${r}. Defaulting to en-US.`),"en-US")})(r),countryCode:e,component:n,host:a,cancelButton:s});if(l.cleanup(),l.status===ru.FAILURE)throw Error("3DS verification failed");if(l.status===ru.CANCELLED)throw Error("3DS verification cancelled");if(l.status===ru.SUCCESS){if(!l.additionalDetails)throw Error("3DS verification succeeded but no additional details were returned");return iA("3DS verification succeeded"),{existing_cc:{additional_details:l.additionalDetails.data}}}oJ(l.status)},iM=s.Ik({provider:s.eu("apple_pay"),processor_name:s.eu("adyen"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj()})}),iO=s.Ik({provider:s.eu("google_pay"),processor_name:s.eu("adyen"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj(),google_pay_merchant_id:s.Yj().nullish()})}),{log__:iF}=oo("awx-apple-pay");async function iD(e,t){try{let r=(await aE(t.connection,{checkout_payment_method:t.checkoutPaymentMethod,processor_specific_metadata:{apple_pay_session:{validation_url:e.validationURL,initiative_context:window.location.hostname,their_account_id:t.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!r)throw Error("No session data received from payment flow");t.session.completeMerchantValidation(r),o5("apple_pay_complete_merchant_validation",{...r})}catch(e){throw t.session.abort(),e}}async function iU(e,t){try{let r=e.payment,o=iP(t.nonCdeFormInputs,r),n=aQ(o,t.formCallbacks.get.onValidationError,t.defaultFieldValues);o5("billing_details_received",{...n}),await ap(t.connection,{payment_provider:t.checkoutPaymentMethod.provider,checkout_payment_method:t.checkoutPaymentMethod,...a2(n,t.prefill.checkout_settings)});let a=await a_(t.connection,{secure_token:t.prefill.token,processor_specific_metadata:{payment_provider:t.checkoutPaymentMethod.provider,browser_info:l$(),mobile_wallet_payment_data:{encrypted_payment_token:btoa(JSON.stringify(r.token.paymentData))}}});if(iF("[1st] Confirm payment flow response",a),!a.payment_methods?.[0]?.id)throw Error("No PM ID found");let i={status:ApplePaySession.STATUS_SUCCESS};return t.session.completePayment(i),a5({logPrefix:"adyen-applepay",anyCdeConnection:t.connection,checkoutPaymentMethod:t.checkoutPaymentMethod,requiredFormFields:n,confirmResult:a,usePayFirstFlow:!1})}catch(r){let e={status:ApplePaySession.STATUS_FAILURE};throw t.session.completePayment(e),r}}let{log__:iq,err__:iz}=oo("adyen-apple-pay"),iG=or(async({context:e,formCallbacks:t})=>{let r={processor:a4.Enum.adyen,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},o=a3(e.checkoutPaymentMethods,iM);if(!o)return r;if(iq("Loading Apple Pay script"),await ik(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return iq("Ap
213ple Pay is not available on this device/browser"),r;if(iq("Apple Pay Loaded"),!await ApplePaySession.canMakePayments())return iq("No active cards available for Apple Pay"),r;if(!o.metadata.processor_account_id)throw Error("No gateway merchant ID found in processor account");let n=e.anyCdeConnection,a=await ad(n),i="setup"===a.mode,s=await aw(n,a.token,i,void 0),l=async r=>{try{await lM.adyenApplePay.run({context:e,checkoutPaymentMethod:o,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:{...r,initialPreview:s},initResult:void 0})}catch(e){iz("Apple Pay payment error",e),t.get.onCheckoutError(e?.message??"Unknown error")}};return{processor:a4.Enum.adyen,isAvailable:!0,isLoading:!1,startFlow:l}}),iV=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,customParams:o,formCallbacks:n})=>{let a=a3(e.checkoutPaymentMethods,iM),{overridePaymentRequest:i,initialPreview:s}=o,l=e.anyCdeConnection,c=await ad(l),u="setup"===c.mode,d=new ApplePaySession(3,iE({overridePaymentRequest:i,initialPreview:s,prefill:{...c},defaultLabel:a?.metadata?.processor_account_name})),p={session:d,connection:e.anyCdeConnection,checkoutPaymentMethod:t,nonCdeFormInputs:r,processorAccount:a.metadata,prefill:c,isSetupMode:u,baseUrl:e.baseUrl,formCallbacks:n,defaultFieldValues:o?.defaultFieldValues};return o5("apple_pay_flow_started",{processor_name:t.processor_name,prefill:oW(c,["brand"]),overridePaymentRequest:i}),new Promise((e,t)=>{d.onvalidatemerchant=async e=>{try{await iD(e,p)}catch(e){t(e)}},d.onpaymentmethodselected=async()=>{let e=await aw(l,c.token,u,void 0),t={newTotal:iI({overridePaymentRequest:o.overridePaymentRequest,initialPreview:e,defaultLabel:a?.metadata?.processor_account_name,prefill:c}).total};d.completePaymentMethodSelection(t)},d.onpaymentauthorized=async r=>{o5("apple_pay_payment_authorized");try{let t=await iU(r,p);e(t)}catch(e){t(e)}},d.oncancel=()=>{iq("Payment cancelled by user"),t(Error("Payment cancelled by user"))},d.begin()}).catch(e=>{throw iz("Apple Pay payment error",e),o5("apple_pay_payment_error",{error:e}),e})}),{log__:i$,err__:iH}=oo("adyen-google-pay"),iB=or(async({context:e,formCallbacks:t})=>{let r={processor:a4.Enum.adyen,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},o=a3(e.checkoutPaymentMethods,iO);if(!o)return r;i$("Google Pay CPM",o);let n=o.metadata;if(!n.processor_account_id)return iH("No gateway merchant ID found in processor account"),r;if(i$("Loading Google Pay script"),await a9(),!window.google?.payments?.api)return iH("Google Pay SDK not loaded properly"),r;if(await ie(e.baseUrl)==="PRODUCTION"&&!n.google_pay_merchant_id)return iH("Google Pay merchant ID is required for production environment"),r;i$("Google Pay SDK loaded",window.google.payments);let a=e.anyCdeConnection,i=await ad(a),s="setup"===i.mode,l=await aw(a,i.token,s,void 0);try{let t=a8({prefill:i,gateway:"adyen",gatewayMerchantId:n.processor_account_id,merchantName:n.processor_account_name,merchantId:n.google_pay_merchant_id??"",initialPreview:l}),o=await it(e.baseUrl,t),{result:a}=await o.isReadyToPay(t);if(!a)return i$("Google Pay is not available for this user"),r}catch(e){return iH("Error checking Google Pay availability",e),r}let c=async r=>{try{lM.adyenGooglePay.run({context:e,checkoutPaymentMethod:o,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,initResult:void 0,customParams:{...r,initialPreview:l}})}catch(e){iH("Google Pay payment error",e),t.get.onCheckoutError(e?.message??"Unknown error")}};return{processor:a4.Enum.adyen,isAvailable:!0,isLoading:!1,startFlow:c}}),iK=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{i$("Starting Google Pay flow...");let a=a3(e.checkoutPaymentMethods,iO),{overridePaymentRequest:i}=n,s=a.metadata;if(!s.processor_account_id)throw Error("No gateway merchant ID found in processor account");let l=e.anyCdeConnection,c=await ad(l),u="setup"===c.mode,d=await aw(l,c.token,u,void 0),p=a8({prefill:c,gateway:"adyen",gatewayMerchantId:s.processor_account_id,merchantName:s.processor_account_name,merchantId:s.google_pay_merchant_id??"",initialPreview:d,overridePaymentRequest:i});o5("google_pay_flow_started",{processor_name:a.processor_name,prefill:oW(c,["brand"]),overridePaymentRequest:i});let m=await it(e.baseUrl,p);try{let a=await m.loadPaymentData(p);i$("Google Pay Payment data",a);let i=io(r,a),s=aQ(i,o.get.onValidationError,n?.defaultFieldValues);if(o5("billing_details_received",{...s}),!a.paymentMethodData?.tokenizationData?.token)throw Error("No payment token received from Google Pay");let u=await ap(l,{payment_provider:t.provider,checkout_payment_method:t,...a2(s,c.checkout_settings)}),d=ir(u);i$("Start flow next actions",d);let h=await a_(l,{secure_token:c.token,processor_specific_metadata:{payment_provider:t.provider,browser_info:l$(),mobile_wallet_payment_data:{encrypted_payment_token:a.paymentMethodData?.tokenizationData?.token}}});i$("[1st] Confirm payment flow response",h);let _=h.payment_methods?.[0]?.id,f=h.required_user_actions?.find(e=>"adyen-3ds"===e.type);if(f&&f.redirect_url){i$("Adyen 3DS Required, starting verification...",f);let{status:t}=await aV({url:f.redirect_url,baseUrl:e.baseUrl});if(i$(`â° Adyen 3DS verification completed [Status: ${t}]`),t===ru.CANCELLED)throw Error("3DS verification cancelled");if(t===ru.FAILURE)throw Error("3DS verification failed")}if(f&&!_&&(h=await a_(l,{secure_token:c.token,their_pm_id:f.their_pm_id,processor_specific_metadata:{payment_provider:t.provider}}),i$("[2nd] Confirm payment flow response after 3DS",h),_=h.payment_methods?.[0]?.id),!_)throw Error("No payment method ID found");return a5({logPrefix:"adyen-googlepay",anyCdeConnection:l,checkoutPaymentMethod:t,requiredFormFields:s,confirmResult:h,usePayFirstFlow:!1})}catch(e){throw iH("Google Pay payment error",e),o5("google_pay_payment_error",{error:e}),Error(e?.message??"Unknown error")}}),{log__:iZ,err__:iJ}=oo("awx-ach"),iW=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{let a=aQ(r,o.get.onValidationError),i=e.anyCdeConnection,s=await ad(i),l=n.verificationMethod??"plaid",c=null;if("micro_deposit"===l){iZ("Micro deposit verification selected, showing form...");try{c=await aq("ach_direct_debit",{width:"450px",height:"400px",baseUrl:e.baseUrl}),iZ("Micro deposit data collected")}catch{throw iZ("Micro deposit form cancelled"),Error("Micro deposit form cancelled")}}let u=await ap(i,{payment_provider:t.provider,checkout_payment_method:t,...a2(a,s.checkout_settings),customer_language:aB()}),d=ir(u)?.consent_id,p=(await a_(i,{secure_token:s.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:d,verification_method:l,direct_debit_data:{type:"ach_direct_debit",ach_direct_debit:{business_account:n.isBusinessAccount??!1,owner_name:aF(a[tD.FIRST_NAME],a[tD.LAST_NAME]),owner_email:a[tD.EMAIL],account_number:c?.account_number,aba_rout
213ing_number:c?.aba_routing_number}}}})).required_user_actions?.find(e=>"airwallex_payment_consent"===e.type)?.redirect_url;if(p){iZ("Plaid verification Required, starting verification...");let{status:t}=await aV({url:p,baseUrl:e.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"ACH verification"});if(iZ(`â° Plaid verification completed [Status: ${t}]`),t===ru.CANCELLED)throw Error("Plaid verification cancelled");if(t===ru.FAILURE)throw Error("Plaid verification failed")}let m=await a_(i,{secure_token:s.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:d}});try{return a5({logPrefix:"awx-ach",anyCdeConnection:i,checkoutPaymentMethod:t,requiredFormFields:a,confirmResult:m,usePayFirstFlow:!1})}catch(e){throw iJ("ACH payment error",e),o5("checkout_error",{error:e}),Error(e?.message??"Unknown error")}}),{log__:iQ}=oo("awx-apple-pay");async function iX(e,t){try{let r=(await aE(t.connection,{checkout_payment_method:t.checkoutPaymentMethod,processor_specific_metadata:{airwallex_payment_session:{validation_url:e.validationURL,initiative_context:window.location.hostname,their_account_id:t.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!r)throw Error("No session data received from payment flow");t.session.completeMerchantValidation(r),o5("apple_pay_complete_merchant_validation",{...r})}catch(e){throw t.session.abort(),e}}async function i0(e,t){if(!e.redirect_url)throw Error("No redirect URL found");iQ("3DS Required, starting verification...",e);let{status:r}=await aV({url:e.redirect_url,baseUrl:t.baseUrl});if(iQ(`â° 3DS verification completed [Status: ${r}]`),r===ru.CANCELLED)throw Error("3DS verification cancelled");if(r===ru.FAILURE)throw Error("3DS verification failed");let o=await a_(t.connection,{secure_token:t.prefill.token,processor_specific_metadata:{their_pm_id:e.their_pm_id,airwallex_consent_id:e.consent_id,payment_provider:t.checkoutPaymentMethod.provider}});return iQ("[2nd] Confirm payment flow response",o),o}async function i1(e,t){try{let r=e.payment,o=iP(t.nonCdeFormInputs,r),n=aQ(o,t.formCallbacks.get.onValidationError,t.defaultFieldValues);o5("billing_details_received",{...n});let a=(await ap(t.connection,{payment_provider:t.checkoutPaymentMethod.provider,checkout_payment_method:t.checkoutPaymentMethod,...a2(n,t.prefill.checkout_settings)})).required_user_actions[0].consent_id;if(!a)throw Error("No consent ID received from payment flow");let i=await a_(t.connection,{secure_token:t.prefill.token,processor_specific_metadata:{payment_provider:t.checkoutPaymentMethod.provider,airwallex_consent_id:a,airwallex_payment_method_data:{type:"applepay",applepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:JSON.stringify(r.token)}}}});iQ("[1st] Confirm payment flow response",i);let s=i.payment_methods?.[0]?.id,l=i.required_user_actions?.find(e=>"airwallex_payment_consent"===e.type);if(l?.redirect_url&&l.consent_id&&l.their_pm_id&&(i=await i0(l,t),s=i.payment_methods?.[0]?.id),!s)throw Error("No PM ID found");let c={status:ApplePaySession.STATUS_SUCCESS};return t.session.completePayment(c),a5({logPrefix:"awx-applepay",anyCdeConnection:t.connection,checkoutPaymentMethod:t.checkoutPaymentMethod,requiredFormFields:n,confirmResult:i,usePayFirstFlow:!1})}catch(r){let e={status:ApplePaySession.STATUS_FAILURE};throw t.session.completePayment(e),r}}let{log__:i3,err__:i2}=oo("awx-apple-pay"),i5=or(async({context:e,formCallbacks:t})=>{let r={processor:a4.Enum.airwallex,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},o=a3(e.checkoutPaymentMethods,iv);if(!o)return r;if(i3("Loading Apple Pay script"),await ik(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return i3("Apple Pay is not available on this device/browser"),r;if(i3("Apple Pay Loaded"),!await ApplePaySession.canMakePayments())return i3("No active cards available for Apple Pay"),r;if(!o.metadata.processor_account_id)throw Error("No gateway merchant ID found in processor account");let n=e.anyCdeConnection,a=await ad(n),i="setup"===a.mode,s=await aw(n,a.token,i,void 0),l=async r=>{try{await lM.airwallexApplePay.run({context:e,checkoutPaymentMethod:o,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:{...r,initialPreview:s},initResult:void 0})}catch(e){i2("Apple Pay payment error",e),t.get.onCheckoutError(e?.message??"Unknown error")}};return{processor:a4.Enum.airwallex,isAvailable:!0,isLoading:!1,startFlow:l}}),i4=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,customParams:o,formCallbacks:n})=>{let a=a3(e.checkoutPaymentMethods,iv),{overridePaymentRequest:i}=o,s=e.anyCdeConnection,l=await ad(s),c="setup"===l.mode,u=new ApplePaySession(3,iE({overridePaymentRequest:i,initialPreview:o.initialPreview,prefill:{...l},defaultLabel:a?.metadata?.processor_account_name})),d={session:u,connection:e.anyCdeConnection,checkoutPaymentMethod:t,nonCdeFormInputs:r,processorAccount:a.metadata,prefill:l,isSetupMode:c,baseUrl:e.baseUrl,formCallbacks:n,defaultFieldValues:o?.defaultFieldValues};return o5("apple_pay_flow_started",{processor_name:t.processor_name,prefill:oW(l,["brand"]),overridePaymentRequest:i}),new Promise((e,t)=>
213{u.oncancel=()=>{i3("Payment cancelled by user"),t(Error("Payment cancelled by user"))},u.onvalidatemerchant=async e=>{try{await iX(e,d)}catch(e){t(e)}},u.onpaymentmethodselected=async()=>{let e=await aw(s,l.token,c,void 0),t={newTotal:iI({overridePaymentRequest:o.overridePaymentRequest,initialPreview:e,defaultLabel:a?.metadata?.processor_account_name,prefill:l}).total};u.completePaymentMethodSelection(t)},u.onpaymentauthorized=async r=>{o5("apple_pay_payment_authorized");try{let t=await i1(r,d);e(t)}catch(e){t(e)}},u.begin()}).catch(e=>{throw i2("Apple Pay payment error",e),o5("apple_pay_payment_error",{error:e}),e})}),{log__:i6,err__:i8}=oo("awx-google-pay"),i9=or(async({context:e,formCallbacks:t})=>{let r={processor:a4.Enum.airwallex,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},o=a3(e.checkoutPaymentMethods,ib);if(!o)return r;i6("Google Pay CPM",o);let n=o.metadata;if(!n.processor_account_id)return i8("No gateway merchant ID found in processor account"),r;if(i6("Loading Google Pay script"),await a9(),!window.google?.payments?.api)return i8("Google Pay SDK not loaded properly"),r;if(await ie(e.baseUrl)==="PRODUCTION"&&!n.google_pay_merchant_id)return i8("Google Pay merchant ID is required for production environment"),r;i6("Google Pay SDK loaded",window.google.payments);let a=e.anyCdeConnection,i=await ad(a),s="setup"===i.mode,l=await aw(a,i.token,s,void 0);try{let t=a8({prefill:i,gateway:"airwallex",gatewayMerchantId:n.processor_account_id,merchantName:n.processor_account_name,merchantId:n.google_pay_merchant_id??"",initialPreview:l}),o=await it(e.baseUrl,t),{result:a}=await o.isReadyToPay(t);if(!a)return i6("Google Pay is not available for this user"),r}catch(e){return i8("Error checking Google Pay availability",e),r}let c=async r=>{try{lM.airwallexGooglePay.run({context:e,checkoutPaymentMethod:o,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,initResult:void 0,customParams:{...r,initialPreview:l}})}catch(e){i8("Google Pay payment error",e),t.get.onCheckoutError(e?.message??"Unknown error")}};return{processor:a4.Enum.airwallex,isAvailable:!0,isLoading:!1,startFlow:c}}),i7=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{i6("Starting Google Pay flow...");let a=a3(e.checkoutPaymentMethods,ib),{overridePaymentRequest:i}=n,s=a.metadata;if(!s.processor_account_id)throw Error("No gateway merchant ID found in processor account");let l=e.anyCdeConnection,c=await ad(l),u="setup"===c.mode,d=await aw(l,c.token,u,void 0),p=a8({prefill:c,gateway:"airwallex",gatewayMerchantId:s.processor_account_id,merchantName:s.processor_account_name,merchantId:s.google_pay_merchant_id??"",initialPreview:d,overridePaymentRequest:i});o5("google_pay_flow_started",{processor_name:a.processor_name,prefill:oW(c,["brand"]),overridePaymentRequest:i});let m=await it(e.baseUrl,p);try{let a=await m.loadPaymentData(p);i6("Google Pay Payment data",a);let i=io(r,a),s=aQ(i,o.get.onValidationError,n?.defaultFieldValues);i6("___",s),o5("billing_details_received",{...s});let u=a.paymentMethodData?.tokenizationData?.token;if(!u)throw Error("No payment token received from Google Pay");let d=await ap(l,{payment_provider:t.provider,checkout_payment_method:t,...a2(s,c.checkout_settings)}),h=ir(d);i6("Start flow next actions",h);let _=await a_(l,{secure_token:c.token,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:h?.consent_id,airwallex_payment_method_data:{type:"googlepay",googlepay:{payment_data_type:"encrypted_payment_token",encrypted_payment_token:u}}}});i6("[1st] Confirm payment flow response",_);let f=_.payment_methods?.[0]?.id,y=_.required_user_actions?.find(e=>"airwallex_payment_consent"===e.type);if(y&&y.redirect_url){i6("3DS Required, starting verification...",y);let{status:t}=await aV({url:y.redirect_url,baseUrl:e.baseUrl});if(i6(`â° 3DS verification completed [Status: ${t}]`),t===ru.CANCELLED)throw Error("3DS verification cancelled");if(t===ru.FAILURE)throw Error("3DS verification failed")}if(y&&!f&&(_=await a_(l,{secure_token:c.token,their_pm_id:y.their_pm_id,processor_specific_metadata:{payment_provider:t.provider,airwallex_consent_id:y.consent_id}}),i6("[2nd] Confirm payment flow response",_),f=_.payment_methods?.[0]?.id),!f)throw Error("No PM ID found");return a5({logPrefix:"awx-googlepay",anyCdeConnection:l,checkoutPaymentMethod:t,requiredFormFields:s,confirmResult:_,usePayFirstFlow:!1})}catch(e){throw i8("Google Pay payment error",e),o5("google_pay_payment_error",{error:e}),Error(e?.message??"Unknown error")}}),{log__:se,err__:st}=oo("klarna"),sr=s.Ik({provider:s.eu("klarna"),metadata:s.Ik({}).nullish(),processor_name:s.eu("airwallex")}),so=async({context:e,formCallbacks:t})=>{let r=a3(e.checkoutPaymentMethods,sr);if(!r)throw Error("Klarna CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:o=>lM.airwallexKlarna.run({context:e,checkoutPaymentMethod:r,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,initResult:void 0,customParams:o??{}})}},sn=ot(async({context:e,nonCdeFormInputs:t,checkoutPaymentMethod:r,formCallbacks:o,customParams:n})=>{try{se("Running Klarna flow...",n);let a=e.anyCdeConnection,i=await ad(a);se("Verifying CPM...");let s=sr.parse(r);se("â Validating non-CDE form fields");let l=aQ(t,o.get.onValidationError,{...void 0,...i.checkout_settings}),c=a2(l,i.checkout_settings);se("New customer fields",c);let u=await ap(a,{payment_provider:r.provider,checkout_payment_method:r,...a2(l,i.checkout_settings)});return console.log("startPaymentFlowResponse",u),a5({logPrefix:"klarna",anyCdeConnection:a,checkoutPaymentMethod:s,requiredFormFields:l,confirmResult:{payment_methods:[]},usePayFirstFlow:!1})}catch(e){throw st("Klarna payment error",e),o5("checkout_error",{payment_method:"klarna",error:e}),Error(e?.message??"Unknown error")}}),sa=s.Ik({provider:s.eu("apple_pay"),processor_name:s.eu("authorize_net"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj()})}),si=s.Ik({provider:s.eu("google_pay"),processor_name:s.eu("authorize_net"),metadata:s.Ik({processor_account_id:s.Yj(),processor_account_name:s.Yj(),google_pay_merchant_id:s.Yj().nullish()})});async function ss(e,t){try{let r=(await aE(t.connection,{checkout_payment_method:t.checkoutPaymentMethod,processor_specific_metadata:{apple_payment_session:{validation_url:e.validationURL,initiative_context:window.location.hostname,their_account_id:t.processorAccount.processor_account_id}}})).next_action_metadata?.apple_pay_session;if(!r)throw Error("No session data received from payment flow");t.session.completeMerchantValidation(r),o5("apple_pay_complete_merchant_validation",{...r})}catch(e){throw t.session.abort(),e}}async function sl(e,t){try{let r=e.payment,o=iP(t.nonCdeFormInputs,r),n=aQ(o,t.formCallbacks.get.onValidationError);o5("billing_details_received",{...n}),await ap(t.connection,{payment_provider:t.checkoutPaymentMethod.provider,checkout_payment_method:t.checkoutPaymentMethod,...a2(n,t.prefill.checkout_settings),customer_language:aB()});let a={dataDescriptor:"COMMON.APPLE.INAPP.PAYMENT",dataValue:window.btoa(JSON.stringify(r.token.paymentData))},i=await a_(t.connection,{secure_token:t.prefill.token,processor_specific_metadata:{payment_provider:t.checkoutPaymentMethod.provider,mobile_wallet_payment_data:a}});if(!i.payment_methods?.[0]?.id)throw Error("No PM ID found");let s={status:ApplePaySession.STATUS_SUCCESS};return t.session.completePayment(s),a5({logPrefix:"authnet-applepay",anyCdeConnection:t.connection,checkoutPaymentMethod:t.checkoutPaymentMethod,requiredFormFields:n,confirmResult:i,usePayFirstFlow:!1})}catch(r){let e={status:ApplePaySession.STATUS_FAILURE};throw t.session.completePayment(e),r}}let{log__:sc,err__:su}=oo("authnet-applepay"),sd=or(async({context:e,formCallbacks:t})=>{let r={processor:a4.Enum.authorize_net,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},o=a3(e.checkoutPaymentMethods,sa);if(!o)return r;if(sc("Loading Apple Pay script"),await ik(),!window.ApplePaySession||!ApplePaySession.canMakePayments())return sc("Apple Pay is not available on this device/browser"),r;if(!await ApplePaySession.canMakePayments())return sc("No active cards available for Apple Pay"),r;if(!o.metadata.processor_account_id)throw Error("No gateway merchant ID found in processor account");let n=e.anyCdeConnection,a=await ad(n),i="setup"===a.mode,s=await aw(n,a.token,i,void 0),l=async r=>{try{await lM.authorizeNetApplePay.run({context:e,checkoutPaymentMethod:o,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:{...r,initialPreview:s},initResult:void 0})}catch(e){su("Apple Pay payment error",e),o5("apple_pay_payment_error",{error:e}),t.get.onCheckoutError(e?.message??"Unknown error")}};return{processor:a4.Enum.authorize_net,isAvailable:!0,isLoading:!1,startFlow:l}}),sp=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,customParams:o,formCallbacks:n})=>{let{initialPreview:a,overridePaymentRequest:i}=o,s=a3(e.checkoutPaymentMethods,sa),l=e.anyCdeConnection,c=await ad(l),u="setup"===c.mode,d=iE({overridePaymentRequest:i,initialPreview:a,prefill:c,defaultLabel:s?.metadata?.processor_account_name});o5("apple_pay_flow_started",{processor_name:t.processor_name,prefill:c,overridePaymentRequest:i});let p=new ApplePaySession(3,d),m={session:p,connection:e.anyCdeConnection,checkoutPaymentMethod:t,nonCdeFormInputs:r,processorAccount:t.metadata,prefill:c,isSetupMode:u,baseUrl:e.baseUrl,formCallbacks:n};return new Promise((e,t)=>
213{p.oncancel=()=>{sc("Payment cancelled by user"),t(Error("Payment cancelled by user"))},p.onvalidatemerchant=async e=>{try{await ss(e,m)}catch(e){t(e)}},p.onpaymentmethodselected=async()=>{let e=await aw(l,c.token,u,void 0),t={newTotal:iI({overridePaymentRequest:o.overridePaymentRequest,initialPreview:e,defaultLabel:s?.metadata?.processor_account_name,prefill:c}).total};p.completePaymentMethodSelection(t)},p.onpaymentauthorized=async r=>{o5("apple_pay_payment_authorized");try{let t=await sl(r,m);e(t)}catch(e){t(e)}},p.begin()}).catch(e=>{throw su("Apple Pay payment error",e),o5("apple_pay_payment_error",{error:e}),e})}),{log__:sm,err__:sh}=oo("authnet-googlepay"),s_=or(async({context:e,formCallbacks:t})=>{sm("Initializing Authnet GooglePay flow");let r={processor:a4.Enum.authorize_net,isAvailable:!1,isLoading:!1,startFlow:async()=>{}},o=a3(e.checkoutPaymentMethods,si);if(!o)return r;sm("Google Pay CPM",o);let n=o.metadata;if(!n.processor_account_id)return sh("No gateway merchant ID found in processor account"),r;if(sm("Loading Google Pay script"),await a9(),!window.google?.payments?.api)return sh("Google Pay SDK not loaded properly"),r;sm("Google Pay SDK loaded",window.google.payments);let a=e.anyCdeConnection,i=await ad(a),s="setup"===i.mode,l=await aw(a,i.token,s,void 0);try{let t=a8({prefill:i,gateway:"authorizenet",gatewayMerchantId:n.processor_account_id,merchantName:n.processor_account_name,merchantId:n.google_pay_merchant_id??"",initialPreview:l}),o=await it(e.baseUrl,t),{result:a}=await o.isReadyToPay(t);if(!a)return sm("Google Pay is not available for this user"),r}catch(e){return sh("Error checking Google Pay availability",e),r}let c=async r=>{try{lM.authorizeNetGooglePay.run({context:e,checkoutPaymentMethod:o,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,initResult:void 0,customParams:{...r,initialPreview:l}})}catch(e){sh("Google Pay payment error",e),o5("google_pay_payment_error",{error:e}),t.get.onCheckoutError(e?.message??"Unknown error")}};return{processor:a4.Enum.authorize_net,isAvailable:!0,isLoading:!1,startFlow:c}}),sf=ot(async({context:e,nonCdeFormInputs:t,checkoutPaymentMethod:r,formCallbacks:o,customParams:n})=>{let{overridePaymentRequest:a}=n,i=a3(e.checkoutPaymentMethods,si).metadata,s=e.anyCdeConnection,l=await ad(s),c="setup"===l.mode,u=await aw(s,l.token,c,void 0),d=a8({prefill:l,gateway:"authorizenet",gatewayMerchantId:i.processor_account_id,merchantName:i.processor_account_name,merchantId:i.google_pay_merchant_id??"",initialPreview:u,overridePaymentRequest:a});o5("google_pay_flow_started",{processor_name:r.processor_name,prefill:l,overridePaymentRequest:a});let p=await it(e.baseUrl,d);try{let e=await p.loadPaymentData(d);sm("Google Pay Payment data",e);let n=io(t,e),a=aQ(n,o.get.onValidationError);o5("billing_details_received",{...a});let i=e.paymentMethodData?.tokenizationData?.token;if(!i)throw Error("No payment token received from Google Pay");let c=await ap(s,{payment_provider:r.provider,checkout_payment_method:r,...a2(a,l.checkout_settings),customer_language:aB()});sm("Start payment flow response",c);let u=await a_(s,{secure_token:l.token,processor_specific_metadata:{payment_provider:r.provider,mobile_wallet_payment_data:{dataDescriptor:"COMMON.GOOGLE.INAPP.PAYMENT",dataValue:window.btoa(i)}}});if(!u.payment_methods?.[0]?.id)throw Error("No PM ID found");return a5({logPrefix:"authnet-googlepay",anyCdeConnection:s,checkoutPaymentMethod:r,requiredFormFields:a,confirmResult:u,usePayFirstFlow:!1})}catch(e){throw sh("Google Pay payment error",e),o5("google_pay_payment_error",{error:e}),Error(e?.message??"Unknown error")}}),{log__:sy,err__:sg}=oo("cybs-frame"),sw=async e=>new Promise((t,r)=>{let{postUrl:o,accessToken:n}=e,a=new URL(o).origin,{form:i,detach:s}=((e,t)=>{let r=document.createElement("iframe");r.name="cardinal_collection_iframe",r.style.display="none",r.style.width="10px",r.style.height="10px";let o=document.createElement("form");o.action=e,o.method="POST",o.target=r.name;let n=document.createElement("input");return n.type="hidden",n.name="JWT",n.value=t,o.appendChild(n),document.body.appendChild(r),document.body.appendChild(o),{form:o,detach:()=>{document.body.removeChild(r),document.body.removeChild(o)}}})(o,n);sy("Attached device data collector");let l=e=>{if(e.origin!==a)return;let r=JSON.parse(e.data);if(sy("Received event from device data collector:",r),"profile.completed"===r.MessageType){t(r),c();return}},c=()=>{s(),window.removeEventListener("message",l)};try{window.addEventListener("message",l),sy("Attached listener to window"),i.submit(),sy("Submitted form")}catch(e){sg("Error submitting form:",e),c(),r(e)}}),{log__:sv,err__:sb}=oo("cybs"),sk=s.Ik({step_up_url:s.Yj(),access_token:s.Yj(),dd_url:tF(s.Yj()),dd_token:tF(s.Yj()),merchant_data:s.Yj()}),sP=async e=>{let{stepUpUrl:t,accessToken:r,merchantData:o,iframe:n,host:a,cancelButton:i}=e,s=new URL(t).origin;return new Promise(e=>{let l=()=>{sv("Cleaning up Cybersource 3DS flow"),i.removeEventListener("click",c),a.remove()},c=()=>{sv("Cybersource 3DS cancelled"),e({status:ru.CANCELLED,cleanup:l})},u=aG({elements:{host:a,cancelButton:i},pollingInterval:az(n,t=>{sv("Cybersource 3DS completed with status:",t),e({status:t.status,cleanup:l}),u()},s,"ping-3ds-status",rd),resolve:t=>{e({status:t.status,cleanup:l})}});i.addEventListener("click",c),(e=>{let{stepUpUrl:t,accessToken:r,merchantData:o,iframe:n,host:a}=e,i=document.createElement("form");i.action=t,i.method="POST",i.target=n.name;let s=document.createElement("input");s.type="hidden",s.name="JWT",s.value=r;let l=document.createElement("input");return l.type="hidden",l.name="MD",l.value=o,i.appendChild(s),i.appendChild(l),a.appendChild(i),i})({stepUpUrl:t,accessToken:r,merchantData:o,iframe:n,host:a}).submit()})},sI=async e=>{let{step_up_url:t,access_token:r,dd_url:o,dd_token:n,merchant_data:a}=(e=>{let t=sk.safeParse(e);if(!t.success)throw sb(`Cybersource 3DS is required but user action is malformed. Got: ${JSON.stringify(e)}`),Error("Unable to process your credit card. Please contact support for assistance.");return t.data})(e);o&&n?sv("Device data collection completed with status:",(await sw({postUrl:o,accessToken:n})).Status):sb("No device data collection URL or token provided");let{host:i,iframe:s,cancelButton:l}=aD("",{name:"cardinal_auth_iframe"});sv("Running Cybersource 3DS flow");let c=await sP({stepUpUrl:t,accessToken:r,merchantData:a,iframe:s,host:i,cancelButton:l});if(c.cleanup(),c.status===ru.FAILURE)throw Error("3DS verification failed");if(c.status===ru.CANCELLED)throw Error("3DS verification cancelled");if(c.status===ru.SUCCESS)return void sv("3DS verification succeeded");oJ(c.status)},{log__:sE,err__:sC}
213=oo("pockyt-cc"),sS=s.Ik({"op-pockyt-3ds-url":s.Yj(),"op-pockyt-txn-no":s.Yj(),"op-pockyt-ref-no":s.Yj()}),sA=e=>{try{let t=new URL(e??"").searchParams.get("vaultId");if(!t)throw Error("No vault ID found in 3DS verification result");return sE(`3DS verification success. [Vault ID: ${t}]`),t}catch(r){let t="Error verifying 3DS verification result.";throw sC(t,`Resulting URL: ${e}. 214Error: ${r7(r)}`),Error(t)}},sj=(e,t)=>new URL(e).searchParams.get(t),sY=async(e,t)=>{let r=(e=>{let t=sS.safeParse(e);if(!t.success)throw sC(`Pockyt 3DS is required but headers are malformed. Got: ${JSON.stringify(e)}`),Error("Unable to process your credit card. Please contact support for assistance.");return t.data})(t);return{existing_cc:{vault_id:sA((await a$({url:r["op-pockyt-3ds-url"],baseUrl:e})).href??""),transaction_no:r["op-pockyt-txn-no"],reference_no:r["op-pockyt-ref-no"]}}},{log__:sx}=oo("stripe-cc"),sT=s.Ik({stripe_pk:s.Yj(),client_secret:s.Yj(),stripe_pm_id:s.Yj()}),sN=async e=>{o5("3ds_stripe_redirect",{...e}),sx(`â Using stripe 3DS flow [Client Secret: ${e.client_secret.substring(0,8)}...]`),await nm(e),o5("3ds_stripe_complete"),sx("â° Stripe 3DS flow completed successfully")},{log__:sR,err__:sL}=oo("unified-cc"),sM=async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{sR("â Running unified CC flow...",{checkoutPaymentMethod:t});let a=e.anyCdeConnection,i=await ad(a);sR(`â Validating non-CDE form fields [Mode: ${i.mode}]`);let s=aQ(r,o.get.onValidationError),l={session_id:e.elementsSessionId,checkout_payment_method:t,non_cde_form_fields:s,extra_metadata:{origin:window.location.origin,deviceToken:aN()},use_unified_cc_flow:!0,pay_first_flow_cart_info:{line_items:i.line_items,displayed_total_amount_atom:i.amount_total_atom},payment_route_id:n.paymentRouteId};sL(n,l),sR(`â Tokenizing card info in Partial PMs [Session: ${e.elementsSessionId}]`),aX(await av(n.currentCdeConnections,{session_id:e.elementsSessionId}),o.get.onValidationError);let c=await am(a,l);if(sR("â startPf result",c),c.checkout_success_response)return sq(i.mode,c);if(!c.checkout_attempt_id)throw Error("Invalid state: no checkout attempt ID from PF result");return sO({context:e,prefill:i,nonCdeFormInputs:r,commonCheckoutParams:l,anyCdeConnection:a,startPfResult:c,checkoutAttemptId:c.checkout_attempt_id})},sO=async e=>{let{context:t,prefill:r,nonCdeFormInputs:o,commonCheckoutParams:n,anyCdeConnection:a,startPfResult:i,checkoutAttemptId:s}=e,l=i;for(let e=0;e<4;e++){sR(`â Running confirm loop iteration ${e}`),o5("unified_cc_confirm_loop_iteration",{iteration:e});let{userAction:i}=sU(l);try{let e=await sF(t.baseUrl,i,r,o);n.extra_metadata={...n.extra_metadata,...e.metadataForConfirmStep},sR("â New extra metadata",n.extra_metadata)}catch(r){let t=r7(r);sL(`â Error in running user action in iteration ${e}. Continuing to confirm step...`,t),o5("unified_cc_user_action_error",{error_message:t,iteration:e})}if(sR(`â confirmPf result (iteration ${e})`,l=await a_(a,{secure_token:r.token,checkout_attempt_id:s,processor_specific_metadata:n.extra_metadata})),l.checkout_success_response)return sq(r.mode,l)}throw o5("unified_cc_unexpected_branch",{secure_token:r.token,checkout_attempt_id:l.checkout_attempt_id,confirmPFResult:l}),Error("Checkout error, please try another payment method")},sF=async(e,t,r,o)=>{if("3DS_REQUIRED"===t._unified_cc_action_name){if("stripe_3ds"===t.type)return await sN((e=>{let t=sT.safeParse(e);if(!t.success)throw Error(`Stripe 3DS metadata has unexpected format: ${JSON.stringify(t.error.errors)}`);return{stripe_pk:t.data.stripe_pk,client_secret:t.data.client_secret,stripe_pm_id:t.data.stripe_pm_id}})(t)),{metadataForConfirmStep:{}};if(ig(t))return{metadataForConfirmStep:{airwallex:await iw(e,t)}};if(iR(t))return{metadataForConfirmStep:{adyen:await iL(o[tD.COUNTRY],t,r.locale)}};if("cybersource_payer_auth"===t.type)return await sI(t),{metadataForConfirmStep:{}};if(sD(t))return await sK({required_user_actions:[t]},e),{metadataForConfirmStep:{}};throw Error(`Unhandled 3DS user action: ${JSON.stringify(t)}`)}throw Error(`Unknown required user action: ${JSON.stringify(t)}`)},sD=e=>{try{return sB([e]),!0}catch{return!1}},sU=e=>{if(e.required_user_actions){if(0===e.required_user_actions.length)throw Error("Invalid state: no required user actions");
214if(e.required_user_actions.length>1)throw Error("Invalid state: multiple required user actions")}else throw Error("Invalid state: no required user actions");let t=r3.safeParse(e.required_user_actions[0]);if(!t.success)throw sL("User action raw payload",e.required_user_actions[0]),sL("Parsing error",t.error),Error("Invalid state: schema of user action payload is not valid");return{userAction:t.data}},sq=(e,t)=>{if("setup"===e){let e=t.cc_pm_id??t.payment_methods?.[0].id;if(!e)throw Error("Invalid state: no CC PM ID or payment_methods found in PF result");return{mode:"setup",result:{payment_method_id:e}}}if(!t.checkout_success_response)throw Error("Invalid state: no checkout success response from startPF");return{mode:"checkout",result:t.checkout_success_response}},{log__:sz,err__:sG}=oo("common-cc");s.YO(s.Ik({our_existing_pm_id:s.Yj()})).length(1);let sV=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{sz("â Running common CC flow...",{checkoutPaymentMethod:t});let a=e.anyCdeConnection,i=await ad(a);o5("common_cc_flow_started",{...t,prefill:i});let s=i.final_feature_rollout_settings?.unified_cc??0;sz(`â Unified CC rollout: ${Math.round(100*s)}%`);let l=Math.random(),c=l<s,u={roll:l,unifiedCCRolloutRatio:s,useUnifiedCCFlow:c};if(c)return sz(`â Picked unified CC flow (${l} vs ${s})`),o5("unified_cc_flow_picked",u),sM({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n,initResult:void 0});sz(`â Picked legacy CC flow (${l} vs ${s})`),o5("legacy_cc_flow_picked",u),sz(`â Validating non-CDE form fields [Mode: ${i.mode}]`);let d=aQ(r,o.get.onValidationError,i.checkout_settings);o5("billing_details_received",{...d});let p={session_id:e.elementsSessionId,checkout_payment_method:t,non_cde_form_fields:d,extra_metadata:{origin:window.location.origin},use_unified_cc_flow:!1,payment_route_id:n.paymentRouteId,customer_language:aB(),...a2(d,i.checkout_settings)};try{sz(`â Tokenizing card info in CDE [Session: ${e.elementsSessionId}]`);let t=await av(n.currentCdeConnections,{session_id:e.elementsSessionId});if(aX(t,o.get.onValidationError),"setup"===i.mode){sz(`â Setting up payment method in CDE [Token: ${i.token}]`);let e=await ak(a,p);return sz(`â° Setup completed successfully [PM ID: ${e.payment_method_id}]`),{mode:"setup",result:e}}{sz(`â Initial checkout flow. Checking out card info in CDE [Session: ${e.elementsSessionId}]`);let t=await ab(a,p);return sz("â° Checkout completed successfully."),{mode:"checkout",result:t}}}catch(o){if(o instanceof ai&&o.originalErrorMessage.includes("3DS_REQUIRED")){let n;sz("â Card requires 3DS, starting non-legacy payment flow"),sz("Received 3DS error response headers:",o.response.headers),o5("3ds_required",{...t,...o.response.headers});let s=o.response.headers??{};"op-existing-cc-pm-id"in s&&(p.existing_cc_pm_id=s["op-existing-cc-pm-id"],sz(`â Existing CC PM ID: ${p.existing_cc_pm_id}`));let l=(n=o.response.headers,n?.["op-pockyt-3ds-url"]!==void 0);if(l){sz("â Pockyt 3DS case detected. Going through Pockyt 3DS flow.");let t=await sY(e.baseUrl,o.response.headers);p.extra_metadata.pockyt=t}if(ig(o.response.headers)){sz("â Airwallex 3DS case detected. Going through Airwallex 3DS flow.");let t=await iw(e.baseUrl,o.response.headers);p.extra_metadata.airwallex=t}if(iR(o.response.headers)){sz("â Adyen 3DS case detected. Going through Adyen 3DS flow.");let e=await iL(r[tD.COUNTRY],o.response.headers,i.locale);p.extra_metadata.adyen=e}let c=await am(a,p);sz("â Start payment flow result:",c);let u=c.required_user_actions.find(e=>"cybersource_payer_auth"===e.type);if(u){sz("â Cybersource 3DS case detected. Going through Cybersource 3DS flow.");let e=sk.parse(u),t=await sI({...e,_unified_cc_action_name:"",_unified_cc_pccs_id:""});p.extra_metadata.cybersource=t}let d=o.response.headers?.["op-should-use-new-flow"]!=="true";l||u?sz("â Pre-start 3DS is successful, other 3DS flows will be skipped."):d?(sz("â Using stripe 3DS flow"),await sN(s$(c))):(sz("â Using common 3DS flow"),await sK(c,e.baseUrl));let m=c.cc_pm_id;if("setup"===i.mode){sz(`â Confirming payment flow [cc_pm_id: ${m}]`);let e=await a_(a,{secure_token:i.token,existing_cc_pm_id:m});sz("â Confirm payment flow result received Result:",e);let t=a1(e);return sz(`â° Setup completed successfully [PM ID: ${t.payment_method_id}]`),{mode:"setup",result:t}}{sz(`â Checking out after 3DS flow [Flow: ${d?"legacy":"new"}]`);let e=await ab(a,{...p,existing_cc_pm_id:m,do_not_use_legacy_cc_flow:d});return sz("â° Checkout completed successfully."),{mode:"checkout",result:e}}}throw sG("â° Error checking out card info in CDE"),sG(o),o}}),s$=e=>{let t=e.required_user_actions.find(e=>"stripe_3ds"===e.type);if(!t)throw Error("No stripe 3DS action found");return no.parse(t)},sH=["airwallex_payment_consent","adyen"],sB=e=>{let t=e.find(e=>sH.includes(e.type));if(!t)throw Error("No common 3DS action found");return rp.parse(t)},sK=async(e,t)=>{let r=sB(e.required_user_actions);if("3DS_COMPLETE"===r.redirect_url){sz("â 3DS flow completed successfully"),o5("3ds_complete");return}sz(`â Using common 3DS flow [URL: ${r.redirect_url}]`),o5("3ds_redirect",{...r});let{status:o}=await aV({url:r.redirect_url,baseUrl:t});if(sz(`â° 3DS verification completed [Status: ${o}]`),o===ru.CANCELLED)throw o5("3ds_cancelled"),Error("3DS verification cancelled");if(o===ru.FAILURE)throw o5("3ds_failure"),Error("3DS verification failed");o5("common_3ds_completed")},sZ=s.Ik({processor_name:s.eu("loop"),provider:s.eu("crypto"),metadata:s.Ik({merchant_id:s.Yj(),entity_id:s.Yj(),api_token:s.Yj(),supported_currencies:s.YO(s.Yj()),environment:s.Yj()})}),{log__:sJ,err__:sW}=oo("loop-crypto"),sQ=or(async({context:e})=>{let t;sJ("Checking if there are any CPMs for Loop Crypto...");let r=a3(e.checkoutPaymentMethods,sZ);sJ(`checkoutPaymentMethod: ${JSON.stringify(r)}`),sJ("Starting Loop Crypto flow...");let o=await ad(e.anyCdeConnection),n="setup"===o.mode,a=await aE(e.anyCdeConnection,{checkout_payment_method:r}),i=await aw(e.anyCdeConnection,o.token,n,void 0);if(!n&&!r.metadata.supported_currencies.includes(o.currency))throw Error(`Currency ${o.currency} not enabled for Loop. Enabled currencies: ${r.metadata.supported_currencies}`);if(!a||!a.next_action_metadata)throw Error("Failed to fetch necessary setup data for Loop");let s=a.next_action_metadata,l=s.authorization_amount,u=s.min_authorization_amount,d=s.allow_customer_to_choose_auth;return n?(t=0,l=Math.max(l,u)):l=Math.max(l,u=Math.max(u,t=(i?i.amountAtom:o.amount_total_atom)*s.token_price)),{isAvailable:!0,widgetProps:{paymentUsdAmount:t,suggestedAuthorizationUsdAmount:l,customerRefId:(0,c.A)(),minAuthorizationUsdAmount:u,allowCustomerToChooseAuth:d},initLoopConnectProps:{apiToken:r.metadata.api_token,entityId:r.metadata.entity_id,merchantId:r.metadata.merchant_id,environment:r.metadata.environment}}}),sX=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{sJ("Running Loop flow..."),sJ("context",e),sJ("checkoutPaymentMethod",t),sJ("nonCdeFormInputs",r),sJ("flowCallbacks",o),sJ("customParams",n);let a=await ad(e.anyCdeConnection);sJ(`â Validating non-CDE form fields [Mode: ${a.mode}]`);let i=aQ(r,o.get.onValidationError,a.checkout_settings),s=e.anyCdeConnection,l="setup"!==a.mode,c=a2(i,a.checkout_settings);if(!n)throw Error("Checkout failed. Failed to properly submit form data.");
214if(!n.success)throw o5("loop_pay_flow_failure",n),Error("Checkout failed. Success is not true.");let u=await ap(e.anyCdeConnection,{checkout_payment_method:t,payment_provider:t.provider,...c,use_pay_first_flow:l,pay_first_flow_cart_info:l?{line_items:a.line_items,displayed_total_amount_atom:a.amount_total_atom,promotion_code:i[tD.PROMOTION_CODE]}:void 0,customer_language:aB()}),d=await a_(s,{secure_token:a.token,their_pm_id:n.paymentMethod.paymentMethodId,checkout_attempt_id:l?u.checkout_attempt_id:void 0,processor_specific_metadata:{loop_customer:n.customer,loop_payment_method:n.paymentMethod,loop_success:n.success,loop_payin_id:n.payinId}});if(sJ(`Confirm result: ${d}`),"setup"===a.mode){sJ("Doing payment setup..."),sJ("â Confirm payment flow result received Result:",d);let e=a1(d);return sJ(`â° Setup completed successfully [PM ID: ${e.payment_method_id}]`),{mode:"setup",result:e}}if(sJ("Doing checkout..."),!d.pay_first_success_response)throw sW("Checkout failed, no pay-first success response:",d),Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:d.pay_first_success_response}}),{log__:s0,err__:s1}=oo("paypal"),s3=s.Ik({provider:s.eu("paypal"),metadata:s.Ik({client_id:s.Yj()}),processor_name:s.eu("paypal")}),s2=async({context:e,formCallbacks:t})=>{let r=a3(e.checkoutPaymentMethods,s3);if(!r)throw Error("PayPal CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:()=>lM.paypal.run({context:e,checkoutPaymentMethod:r,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,initResult:void 0,customParams:{settings:{}}})}},s5=ot(async({context:e,nonCdeFormInputs:t,checkoutPaymentMethod:r,formCallbacks:o,customParams:n})=>{try{s0("Running PayPal flow...");let a=e.anyCdeConnection,i=await ad(a),{isAnonymous:s,useRedirectFlow:l}=n.settings??{};s0("Verifying CPM...");let u=s3.parse(r);s0("â Validating non-CDE form fields");let d=aQ(t,o.get.onValidationError,{...s?(()=>{let e=(0,c.A)().split("-")[0];return{firstName:`xx_${e}`,lastName:`xx_${e}`,email:`xx_${e}@email.com`,zipCode:`xx_${e}`,country:"US"}})():void 0,...i.checkout_settings}),p=a2(d,i.checkout_settings);s0(`Starting payment flow... Mode: ${i.mode}`);let m=(0,c.A)(),h={payment_provider:u.provider,checkout_payment_method:u,use_pay_first_flow:!1,pay_first_flow_cart_info:void 0,processor_specific_metadata:{use_paypal_redirect_flow:l,frontend_token_for_redirect_flow:m},...p},_=new URL("/app/pre-action/start/",e.baseUrl).toString(),f=btoa(JSON.stringify(h)),y=new URLSearchParams({st:i.token,r:f}),g=`${_}?${y.toString()}`;if(l)throw s0("Starting redirect mode for PayPal..."),window.location.href=g,await nc(2e4),Error("Paypal flow timed out, please try again with another payment method.");let w=await aH("PayPal",a,m,g);s0("Paypal flow result",w),sj(w.href,"catt"),sj(w.href,"approval_session_id");let v=await a_(a,{secure_token:i.token,checkout_attempt_id:void 0,their_pm_id:void 0});return s0("Confirm payment flow result",v),a5({logPrefix:"paypal",anyCdeConnection:a,checkoutPaymentMethod:u,requiredFormFields:d,confirmResult:v,usePayFirstFlow:!1})}catch(e){throw s1("PayPal payment error",e),o5("checkout_error",{payment_method:"paypal",error:e}),Error(e?.message??"Unknown error")}}),{log__:s4,err__:s6}=oo("pockyt-paypal"),s8=s.Ik({processor_name:s.eu("pockyt"),provider:s.eu("paypal")});s.YO(s.Ik({paypal_iframe_url:s.Yj(),verify_token:s.Yj()})).length(1);let s9=async({context:e,formCallbacks:t})=>{let r=a3(e.checkoutPaymentMethods,s8);if(!r)throw Error("Pockyt PayPal CPM not found in available payment methods");return{isLoading:!1,isAvailable:!0,startFlow:()=>lM.pockytPaypal.run({context:e,checkoutPaymentMethod:r,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,initResult:void 0,customParams:{settings:{}}})}},s7=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{s4("Running Pockyt Paypal flow...");let a=e.anyCdeConnection,i=await ad(a);s4("Verifying CPM...");let s=s8.parse(t);s4("â Validating non-CDE form fields");let l=n?.settings,u=a2(aQ(r,o.get.onValidationError,l?.defaultFieldValues),i.checkout_settings);s4(`Starting payment flow... Mode: ${i.mode}`);let d=(0,c.A)(),p="setup"!==i.mode,m={payment_provider:s.provider,checkout_payment_method:s,use_pay_first_flow:p,pay_first_flow_cart_info:p?{line_items:i.line_items,displayed_total_amount_atom:i.amount_total_atom}:void 0,processor_specific_metadata:{use_paypal_redirect_flow:!!n?.settings?.useRedirectFlow,frontend_token_for_redirect_flow:d},...u},h=new URL("/app/pre-action/start/",e.baseUrl).toString(),_=btoa(JSON.stringify(m)),f=new URLSearchParams({st:i.token,r:_}),y=`${h}?${f.toString()}`;if(n?.settings?.useRedirectFlow)throw s4("Starting redirect mode for PayPal..."),window.location.href=y,await nc(2e4),Error("Paypal flow timed out, please try again with another payment method.");s4("Starting popup mode for PayPal..."),s4("Opening paypal iframe...");let g=await aH("PayPal",a,d,y);s4("Paypal flow result",g);let w=sA(g.href),v=sj(g.href,"catt");if(!v)throw s6("Checkout attempt ID not found in redirect URL:",g.href),Error("Checkout attempt ID not found in redirect URL");s4(`Confirming payment flow using vault ID ${w}`);let b=await a_(a,{secure_token:i.token,their_pm_id:w,checkout_attempt_id:p?v:void 0});if(s4("Confirm payment flow result",b),"setup"===i.mode)return{mode:"setup",result:{payment_method_id:b.payment_methods[0].id}};if(!b.pay_first_success_response)throw s6("Checkout failed, no pay-first success response:",b),Error("Checkout failed, please try again with another payment method.");return{mode:"checkout",result:b.pay_first_success_response}}),{log__:le,err__:lt}
214=oo("stripe-affirm"),lr=s.Ik({provider:s.eu("affirm"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),lo=s.YO(s.Ik({our_existing_pm_id:s.Yj().nullish(),client_secret:s.Yj()})).length(1),ln=or(async({context:e,formCallbacks:t})=>{le("Checking if there are any CPMs for Stripe Affirm...");let r=a3(e.checkoutPaymentMethods,lr);if(!r)return le("No Stripe Affirm CPM found"),{isAvailable:!1,startFlow:async()=>{}};le("Starting stripe affirm flow...");let o=e.anyCdeConnection;return"setup"===(await ad(o)).mode?(le("Setup mode is not supported for Stripe Affirm flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async o=>{try{return lM.stripeAffirm.run({context:e,checkoutPaymentMethod:r,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:o??{},initResult:{isAvailable:!0}})}catch(e){throw lt("Error starting Affirm flow:",e),e}}}}),la=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o})=>{le("Running Stripe Affirm pay-first flow...");let n=e.anyCdeConnection,a=await ad(n);le("Validating form fields...");let i=aQ(r,o.get.onValidationError);o5("billing_details_received",{...i}),le("Creating cart info for pay-first flow...");let s={line_items:a.line_items.map(e=>({price_id:e.price_id,quantity:e.quantity})),promotion_code:i[tD.PROMOTION_CODE]||void 0,displayed_total_amount_atom:a.amount_total_atom};le("Starting pay-first payment flow for Affirm...");let l=await ap(n,{payment_provider:t.provider,checkout_payment_method:t,use_pay_first_flow:!0,pay_first_flow_cart_info:s,...a2(i,a.checkout_settings),customer_language:aB()});le("Start payment flow response",l);let{client_secret:c}=lo.parse(l.required_user_actions)[0];le("Client secret for payment intent",c);let u=a3(e.checkoutPaymentMethods,lr);if(!u)throw Error("Stripe Affirm CPM not found");let{stripe:d}=await ns(u.metadata.stripe_pk,{mode:"payment",currency:a.currency??"usd",amount:a.amount_total_atom});le("Stripe instance created",d);let p=aM(i),m=`${i[tD.FIRST_NAME]} ${i[tD.LAST_NAME]}`,h={return_url:new URL("/app/3ds/success/",e.baseUrl).toString(),payment_method:{billing_details:{email:i[tD.EMAIL],name:m,address:{line1:p.line1,line2:p.line2||void 0,city:p.city,state:p.state,country:p.country,postal_code:p.zip_code}}}};le(`Confirming Affirm payment with client secret: ${c}`);try{let{error:r,paymentIntent:s}=await d.confirmAffirmPayment(c,h,{handleActions:!1});if(r)throw lt("Affirm payment confirmation error:",r),Error(`Affirm payment failed: ${r.message}`);le("Affirm payment confirmed successfully",s);let u=s?.next_action?.redirect_to_url?.url;if(!u)return lt("No redirect URL found in Klarna payment confirmation"),o.get.onCheckoutError("Klarna payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};le("Payment requires additional action, starting 3DS verification...");let{status:p}=await aV({url:u,baseUrl:e.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Affirm verification"});if(p===ru.FAILURE)throw Error("Verification failed");if(p===ru.CANCELLED)throw Error("Verification cancelled");le("3DS verification completed successfully");let m=s?.payment_method?.toString()??void 0,_=await a_(n,{secure_token:a.token,checkout_attempt_id:l.checkout_attempt_id,their_pm_id:m});return le("Payment flow confirmed",_),a5({logPrefix:"stripe-affirm",anyCdeConnection:n,checkoutPaymentMethod:t,requiredFormFields:i,confirmResult:_,usePayFirstFlow:!0})}catch(e){throw lt("Error in Affirm payment flow:",e),e}}),{log__:li,err__:ls}=oo("stripe-afterpay"),ll=s.Ik({provider:s.eu("afterpay"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),lc=s.YO(s.Ik({our_existing_pm_id:s.Yj().nullish(),client_secret:s.Yj()})).length(1),lu=or(async({context:e,formCallbacks:t})=>{li("Checking if there are any CPMs for Stripe Afterpay...");let r=a3(e.checkoutPaymentMethods,ll);if(!r)return li("No Stripe Afterpay CPM found"),{isAvailable:!1,startFlow:async()=>{}};li("Starting stripe afterpay flow...");let o=e.anyCdeConnection;return"setup"===(await ad(o)).mode?(li("Setup mode not supported for Stripe Afterpay flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async o=>{try{return lM.stripeAfterpay.run({context:e,checkoutPaymentMethod:r,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:o??{},initResult:{isAvailable:!0}})}catch(e){throw ls("Error starting Afterpay flow:",e),e}}}}),ld=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o})=>{li("Running Stripe Afterpay pay-first flow...");let n=e.anyCdeConnection,a=await ad(n);li("Validating form fields...");let i=aQ(r,o.get.onValidationError);o5("billing_details_received",{...i}),li("Creating cart info for pay-first flow...");let s={line_items:a.line_items.map(e=>({price_id:e.price_id,quantity:e.quantity})),promotion_code:i[tD.PROMOTION_CODE]||void 0,displayed_total_amount_atom:a.amount_total_atom};li("Starting pay-first payment flow for Afterpay...");let l=await ap(n,{payment_provider:t.provider,checkout_payment_method:t,use_pay_first_flow:!0,pay_first_flow_cart_info:s,...a2(i,a.checkout_settings),customer_language:aB()});li("Start payment flow response",l);let{client_secret:c}=lc.parse(l.required_user_actions)[0];li("Client secret for payment intent",c);let u=a3(e.checkoutPaymentMethods,ll);
214if(!u)throw Error("Stripe Afterpay CPM not found");let{stripe:d}=await ns(u.metadata.stripe_pk,{mode:"payment",currency:a.currency??"usd",amount:a.amount_total_atom});li("Stripe instance created",d);let p=aM(i),m=`${i[tD.FIRST_NAME]} ${i[tD.LAST_NAME]}`,h={return_url:new URL("/app/3ds/success/",e.baseUrl).toString(),payment_method:{billing_details:{email:i[tD.EMAIL],name:m,address:{line1:p.line1,line2:p.line2||void 0,city:p.city,state:p.state,country:p.country,postal_code:p.zip_code}}}};li(`Confirming Afterpay payment with client secret: ${c}`);try{let r=await d.confirmAfterpayClearpayPayment(c,h,{handleActions:!1});if(li("Afterpay payment confirmation result:",r),r.paymentIntent?.next_action?.type==="redirect_to_url"){let s=r.paymentIntent?.next_action?.redirect_to_url?.url;if(!s)return ls("No redirect URL found in Afterpay payment confirmation"),o.get.onCheckoutError("Afterpay payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};li("Afterpay verification Required, starting verification...");let{status:c}=await aV({url:s,baseUrl:e.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Afterpay verification"});if(li(`â° Afterpay verification completed [Status: ${c}]`),c===ru.CANCELLED)throw Error("Afterpay verification cancelled");if(c===ru.FAILURE)throw Error("Afterpay verification failed");li("Afterpay verification completed, confirming with backend...");let u=r.paymentIntent?.payment_method?.toString()??void 0,d=await a_(n,{secure_token:a.token,checkout_attempt_id:l.checkout_attempt_id,their_pm_id:u});return a5({logPrefix:"stripe-afterpay",anyCdeConnection:n,checkoutPaymentMethod:t,requiredFormFields:i,confirmResult:d,usePayFirstFlow:!0})}throw li("No redirect URL found in Afterpay payment confirmation"),Error("No redirect URL found in Afterpay payment confirmation")}catch(e){throw ls("Error in Afterpay checkout flow:",e),Error(e instanceof Error?e.message:"Afterpay payment failed")}}),{log__:lp,err__:lm}=oo("stripe-klarna"),lh=s.Ik({provider:s.eu("klarna"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),l_=s.YO(s.Ik({our_existing_pm_id:s.Yj().nullish(),client_secret:s.Yj()})).length(1),lf=or(async({context:e,formCallbacks:t})=>{lp("Checking if there are any CPMs for Stripe Klarna...");let r=a3(e.checkoutPaymentMethods,lh);if(!r)return lp("No Stripe Klarna CPM found"),{isAvailable:!1,startFlow:async()=>{}};lp("Starting stripe klarna flow...");let o=e.anyCdeConnection;return"setup"===(await ad(o)).mode?(lp("Setup mode is not supported for Stripe Klarna flow"),{isAvailable:!1,startFlow:async()=>{}}):{isAvailable:!0,startFlow:async o=>{try{return lM.stripeKlarna.run({context:e,checkoutPaymentMethod:r,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:o??{},initResult:{isAvailable:!0}})}catch(e){throw lm("Error starting Klarna flow:",e),e}}}}),ly=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o})=>{lp("Running Stripe Klarna pay-first flow...");let n=e.anyCdeConnection,a=await ad(n);lp("Validating form fields...");let i=aQ(r,o.get.onValidationError);o5("billing_details_received",{...i}),lp("Creating cart info for pay-first flow...");let s={line_items:a.line_items.map(e=>({price_id:e.price_id,quantity:e.quantity})),promotion_code:i[tD.PROMOTION_CODE]||void 0,displayed_total_amount_atom:a.amount_total_atom};lp("Starting pay-first payment flow for Klarna...");let l=await ap(n,{payment_provider:t.provider,checkout_payment_method:t,use_pay_first_flow:!0,pay_first_flow_cart_info:s,...a2(i,a.checkout_settings),customer_language:aB()});lp("Start payment flow response",l);let{client_secret:c}=l_.parse(l.required_user_actions)[0];lp("Client secret for payment intent",c);let u=a3(e.checkoutPaymentMethods,lh);if(!u)throw Error("Stripe Klarna CPM not found");let{stripe:d}=await ns(u.metadata.stripe_pk,{mode:"payment",currency:a.currency??"usd",amount:a.amount_total_atom});lp("Stripe instance created",d);let p=aM(i),m=`${i[tD.FIRST_NAME]} ${i[tD.LAST_NAME]}`,h={return_url:new URL("/app/3ds/success/",e.baseUrl).toString(),payment_method:{billing_details:{email:i[tD.EMAIL],name:m,address:{line1:p.line1,line2:p.line2||void 0,city:p.city,state:p.state,country:p.country,postal_code:p.zip_code}}}};lp(`Confirming Klarna payment with client secret: ${c}`);try{let r=await d.confirmKlarnaPayment(c,h,{handleActions:!1});if(lp("Klarna payment confirmation result:",r),r.paymentIntent?.next_action?.type==="redirect_to_url"){let s=r.paymentIntent?.next_action?.redirect_to_url?.url;if(!s)return lm("No redirect URL found in Klarna payment confirmation"),o.get.onCheckoutError("Klarna payment failed"),{mode:"checkout",result:{invoice_urls:[],subscription_ids:[],customer_id:"",payment_method_id:""}};lp("Klarna verification Required, starting verification...");let{status:c}=await aV({url:s,baseUrl:e.baseUrl,frameWidth:"500px",frameHeight:"700px",frameTitle:"Klarna verification"});if(lp(`â° Klarna verification completed [Status: ${c}]`),c===ru.CANCELLED)throw Error("Klarna verification cancelled");if(c===ru.FAILURE)throw Error("Klarna verification failed");lp("Klarna verification completed, confirming with backend...");let u=r.paymentIntent?.payment_method?.toString()??void 0,d=await a_(n,{secure_token:a.token,checkout_attempt_id:l.checkout_attempt_id,their_pm_id:u});return a5({logPrefix:"stripe-klarna",anyCdeConnection:n,checkoutPaymentMethod:t,requiredFormFields:i,confirmResult:d,usePayFirstFlow:!0})}throw lp("No redirect URL found in Klarna payment confirmation"),Error("No redirect URL found in Klarna payment confirmation")}catch(e){throw lm("Error in Klarna checkout flow:",e),Error(e instanceof Error?e.message:"Klarna payment failed")}}),lg="ojs-stripe-link-btn",{log__:lw,err__:lv}
214=oo("stripe-link"),lb=s.Ik({provider:s.eu("stripe_link"),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),lk=s.YO(s.Ik({our_existing_pm_id:s.Yj()})).length(1),lP=or(async({context:e,formCallbacks:t})=>{let r=e.customInitParams.stripeLink;lw("Checking if there are any CPMs for Stripe Link...");let o=a3(e.checkoutPaymentMethods,lb);lw("Starting stripe link flow...");let n=e.anyCdeConnection,a=await ad(n),i="setup"===a.mode;lw("Creating stripe elements...");let s=await aw(n,a.token,i,void 0),{elements:l,stripe:c}=await ns(o.metadata.stripe_pk,{mode:"setup",currency:s.currency,setup_future_usage:"off_session",paymentMethodCreation:"manual"}),u=l.create("linkAuthentication");lw("Creating express checkout...");let d=l.create("expressCheckout",{buttonHeight:r?.buttonHeight,paymentMethods:{amazonPay:"never",applePay:"never",googlePay:"never",paypal:"never"}}),p=(e,t)=>{let o=document.querySelector(e);o||(lv(`Recommanded to render a container with ${e} to avoid rendering in the body`),o=document.body);let n=document.createElement("div");o?.appendChild(n),u.mount(n);let a=!1,i=!1;if(u.once("ready",()=>{i=!0,r?.onAuthenticationElementReady?.()}),t){n.style.visibility="hidden",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.style.zIndex="-1",u.on("change",e=>{a=e.complete||!!e.value.email,i&&r?.onAuthenticationStatusChange?.(a)});let e=n.querySelector("iframe");e&&new MutationObserver(()=>{let t=e.offsetHeight>160;i&&r?.onAuthenticationStatusChange?.(a||t)}).observe(e,{attributes:!0,attributeFilter:["style"]})}return u},m=e=>{d.mount(e||`#${lg}`)};return r?.doNotMountOnInit?lw("NOT mounting stripe link button (doNotMountOnInit is true)"):(lw("Mounting stripe link button..."),m()),r?.silentlyCheckAuthentication&&(lw(`Silently mounting link authentication element at #${lg}...`),p(`#${lg}`,!0)),d.on("click",async e=>{if(lw("Stripe Link button clicked"),r?.overrideLinkSubmit&&!await r.overrideLinkSubmit())return void lw("Stripe Link submit aborted by overrideLinkSubmit");e.resolve()}),d.on("confirm",async r=>{lw("Stripe Link window confirmed",r);let n=await c.createPaymentMethod({elements:l,params:{billing_details:r.billingDetails}});n.error?(lv("error",n.error),t.get.onCheckoutError(n.error.message??"Stripe Link unknown error")):(lw("paymentMethod",n.paymentMethod),lM.stripeLink.run({context:e,checkoutPaymentMethod:o,nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:{stripePM:n.paymentMethod},initResult:{isAvailable:!0}}))}),{isAvailable:!0,controller:{mountButton:m,dismountButton:()=>{d.unmount()},mountLinkAuthenticationElement:e=>p(e,!1),waitForButtonToMount:async()=>await lC(lg)}}}),lI=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n})=>{lw("Running Stripe Link flow...");let a=e.anyCdeConnection,i=await ad(a);lw("Merging PM fields with form fields...");let s=aQ(lE(r,n.stripePM),o.get.onValidationError);o5("billing_details_received",{...s}),lw("Starting payment flow...");let l=await ap(a,{payment_provider:t.provider,checkout_payment_method:t,their_existing_pm_id:n.stripePM.id,...a2(s,i.checkout_settings),customer_language:aB()});lw("Start payment flow response",l);let c=lk.parse(l.required_user_actions)[0].our_existing_pm_id;if("setup"===i.mode)return lw("Doing payment setup..."),{mode:"setup",result:a1(await a_(a,{secure_token:i.token,existing_cc_pm_id:c}))};{lw("Doing checkout...");let e={secure_token:i.token,payment_input:{provider_type:t.provider},customer_email:s[tD.EMAIL],customer_first_name:s[tD.FIRST_NAME],customer_last_name:s[tD.LAST_NAME],customer_address:aM(s),customer_shipping_address:aO(s,i.checkout_settings),promotion_code:s[tD.PROMOTION_CODE],line_items:i.line_items,total_amount_atom:i.amount_total_atom,cancel_at_end:!1,checkout_payment_method:t};return{mode:"checkout",result:await aP(a,e)}}}),lE=(e,t)=>{let r={...e},[o,...n]=t.billing_details.name?.trim()?.split(/\s+/)??[],a=n.join(" ")||void 0;r[tD.EMAIL]=r[tD.EMAIL]||t.link?.email||t.billing_details.email||"[email protected]",r[tD.ZIP_CODE]=r[tD.ZIP_CODE]||t.billing_details.address?.postal_code||"00000",r[tD.COUNTRY]=r[tD.COUNTRY]||t.billing_details.address?.country||"US";let i=r[tD.FIRST_NAME]||o||"",s=r[tD.LAST_NAME]||a||"";return i||s?(r[tD.FIRST_NAME]=i,r[tD.LAST_NAME]=s):(r[tD.FIRST_NAME]="_OP_UNKNOWN",r[tD.LAST_NAME]=""),lw("Final form inputs:",r),r},lC=e=>
214new Promise(t=>{let r=()=>{let o=document.getElementById(e);o?t(o):requestAnimationFrame(r)};r()}),{log__:lS,err__:lA}=oo("stripe-pr"),lj=s.Ik({provider:s.KC([s.eu("apple_pay"),s.eu("google_pay")]),processor_name:s.eu("stripe"),metadata:s.Ik({stripe_pk:s.Yj()})}),lY=or(async({context:e,formCallbacks:t})=>{lS("Checking if there are any CPMs for Stripe PR...");let r=a3(e.checkoutPaymentMethods,lj);lS("Initializing Stripe PR flow...");let o=e.anyCdeConnection,n=await ad(o),a="setup"===n.mode;lS("Getting initial preview amount");let i=await aw(o,n.token,a,void 0),s=await nl(r.metadata.stripe_pk,i.amountAtom,i.currency,a);lS("Checking if can make payment");let l=await s.canMakePayment();if(null===l)return lA("canMakePayment returned null"),{isAvailable:!1,reason:"canMakePayment returned null"};lS("Stripe PR flow initialized successfully. Can make payment",l);let c=(r,o)=>lM.stripePR.run({context:e,checkoutPaymentMethod:lL(e.checkoutPaymentMethods,r),nonCdeFormInputs:aL(e.formDiv),formCallbacks:t,customParams:{provider:r,overridePaymentRequest:o?.overridePaymentRequest},initResult:{processor:a4.Enum.stripe,pr:s,isAvailable:!0,availableProviders:{applePay:l.applePay,googlePay:l.googlePay},startFlow:c}});return{processor:a4.Enum.stripe,isAvailable:!0,pr:s,availableProviders:{applePay:l.applePay,googlePay:l.googlePay},startFlow:c}}),lx=ot(async({context:e,checkoutPaymentMethod:t,nonCdeFormInputs:r,formCallbacks:o,customParams:n,initResult:a})=>{if(lS("Running Stripe PR flow..."),n.provider!==t.provider)throw Error(`Provider mismatch. Expected ${n.provider}, got ${t.provider}`);let i=e.anyCdeConnection,s=a.pr;if(n?.overridePaymentRequest){let e=n.overridePaymentRequest;lS("Overriding PR amount with",e);let t="function"==typeof e.applePayPaymentRequest?e.applePayPaymentRequest({}):e.applePayPaymentRequest;lN(s,e.amount,e.pending,t,e.label)}let l=await ad(i);if(!n.overridePaymentRequest){let e="setup"===l.mode;aw(i,l.token,e,void 0).then(e=>{s.isShowing()||lN(s,e,!1,void 0,"Total")})}lS("Showing PR dialog..."),s.show();let c=await nd(s);lS("Stripe PM added event:",c),lS("Merging PM fields with form fields...");let u=aQ(lT(r,c),o.get.onValidationError);o5("billing_details_received",{...u}),lS("PR dialog finished. Starting p ayment flow...",u);let d=lR(await ah(i,{fields:u,checkoutPaymentMethod:t}));if(lS("Confirming PR with Stripe..."),await np(d,c),"setup"===l.mode)return lS("Confirming payment flow for setup..."),{mode:"setup",result:a1(await a_(i,{secure_token:l.token}))};{lS("Performing checkout...");let e={secure_token:l.token,payment_input:{provider_type:t.provider},customer_first_name:u[tD.FIRST_NAME],customer_last_name:u[tD.LAST_NAME],customer_email:u[tD.EMAIL],customer_address:aM(u),customer_shipping_address:aO(u,l.checkout_settings),promotion_code:u[tD.PROMOTION_CODE],line_items:l.line_items,total_amount_atom:l.amount_total_atom,cancel_at_end:!1,checkout_payment_method:t};return{mode:"checkout",result:await aP(i,e)}}}),lT=(e,t)=>{let r={...e},[o,...n]=t.payerName?.trim()?.split(/\s+/)??[],a=n.join(" ")||void 0,i=t.paymentMethod?.billing_details?.address,s=t.shippingAddress;r[tD.EMAIL]=r[tD.EMAIL]||t.payerEmail||"[email protected]",r[tD.ZIP_CODE]=r[tD.ZIP_CODE]||i?.postal_code||s?.postalCode||"00000",r[tD.COUNTRY]=r[tD.COUNTRY]||i?.country||s?.country||"US";let l=r[tD.FIRST_NAME]||o||"",c=r[tD.LAST_NAME]||a||"";return l||c?(r[tD.FIRST_NAME]=l,r[tD.LAST_NAME]=c):(r[tD.FIRST_NAME]="_OP_UNKNOWN",r[tD.LAST_NAME]=""),lS("Final form inputs:",r),r},lN=(e,t,r,o,n)=>{e.update({total:t?{amount:t.amountAtom,label:n??"Total",pending:r}:void 0,currency:t?.currency,applePay:o})},lR=e=>{if(1!==e.required_user_actions.length)throw Error(`Error occurred. 215Details: got ${e.required_user_actions.length} required user actions`);return nn.parse(e.required_user_actions[0])},lL=(e,t,r)=>{let o=e.filter(e=>{let o=void 0===r||e.processor_name===r,n=e.provider===t;return o&&n});if(0===o.length)throw console.warn("CPMs list",e),Error(`No CPMs found with provider '${t}' and processor '${r}'`);return 1!==o.length&&(console.warn("CPMs list",e),console.warn(`More than one CPM found with provider '${t}' and processor '${r}'`),o5("more_than_one_cpm_found",{provider:t,processor:r,cpms:e})),o[0]},lM={commonCC:{init:async()=>{},run:sV},stripePR:{init:lY,run:lx},stripeLink:{init:lP,run:lI},stripeKlarna:{init:lf,run:ly},stripeAffirm:{init:ln,run:la},stripeAfterpay:{init:lu,run:ld},pockytPaypal:{init:s9,run:s7},paypal:{init:s2,run:s5},airwallexKlarna:{init:so,run:sn},airwallexGooglePay:{init:i9,run:i7},airwallexApplePay:{init:i5,run:i4},airwallexACH:{init:async()=>{},run:iW},airwallexEFT:{init:async()=>{},run:iu},airwallexBACS:{init:async()=>{},run:is},airwallexSEPA:{init:async()=>{},run:im},loopCrypto:{init:sQ,run:sX},authorizeNetApplePay:{init:sd,run:sp},authorizeNetGooglePay:{init:s_,run:sf},adyenGooglePay:{init:iB,run:iK},adyenApplePay:{init:iG,run:iV}},{log__:lO,err__:lF}=oo("init-flows"),lD=(e,t)=>{let r=new o$;return{publisher:r,initialize:async o=>{try{if(r.current.isSuccess)throw Error("This flow has already been initialized.");let n=await t(o);lO(`â ${e} flow initialized successfully. Result:`,n),r.set(n)}catch(t){lF(`ð ${e} flow initialization failed. Error:`,r7(t),"Details:",t),r.throw(t,r7(t))}}}},lU=async(e,t,r)=>{await Promise.all(Object.values(e).map(e=>e.initialize({context:t,formCallbacks:r})))},{err__:lq}=oo("form-callbacks"),lz=s.fH().optional(),lG=s.Ik({onFocus:lz,onBlur:lz,onChange:lz,onLoad:lz,onLoadError:lz,onValidationError:lz,onCheckoutStarted:lz,onCheckoutSuccess:lz,onSetupPaymentMethodSuccess:lz,onCheckoutError:lz,onPaymentRequestLoad:lz}),lV=class e{constructor(){this.setCallbacks=t=>{this._callbacks=e.createEmptyCallbacks(),Object.entries(t).forEach(([t,r])=>{let o,n=(o=r??e.NOOP,(...e)=>{try{return o(...e)}
215catch(e){lq(`[form] Error running callback (${t}):`,e);return}});this._callbacks[t]=n})},this._callbacks=e.createEmptyCallbacks()}get get(){return{...this._callbacks}}};lV.NOOP=()=>{},lV.createEmptyCallbacks=()=>{let e={};return Object.keys(lG.keyof().enum).forEach(t=>{e[t]=lV.NOOP}),e},lV.fromObject=e=>{let t=new lV;return t.setCallbacks(lG.parse(e)),t};let l$=()=>{let e=window&&window.screen?window.screen.height:null,t=window&&window.screen?window.screen.width:null,r=window&&window.screen?window.screen.colorDepth:null,o=!!window&&!!window.navigator&&window.navigator.javaEnabled(),n=window&&window.navigator?window.navigator.userAgent:null,a=null;return window&&window.navigator&&(a=window.navigator.language?window.navigator.language:window.navigator.browserLanguage),{color_depth:r,java_enabled:o,javascript_enabled:!0,language:a,screen_height:e,screen_width:t,time_zone_offset:new Date().getTimezoneOffset(),user_agent:n,accept_header:"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"}};var lH=(e=>(e.card="card",e.pockytPaypal="pockyt-paypal",e.applePay="apple-pay",e.googlePay="google-pay",e.loopCrypto="loop-crypto",e.paypal="paypal",e.klarna="klarna",e.affirm="affirm",e.afterpay="afterpay",e.stripeLink="stripe-link",e.airwallexGooglePay="airwallex-google-pay",e.airwallexApplePay="airwallex-apple-pay",e.authorizenetGooglePay="authorizenet-google-pay",e.authorizenetApplePay="authorizenet-apple-pay",e.adyenGooglePay="adyen-google-pay",e.adyenApplePay="adyen-apple-pay",e.airwallexACH="airwallex-ach",e.airwallexEFT="airwallex-eft",e.airwallexBACS="airwallex-bacs",e.airwallexSEPA="airwallex-sepa",e))(lH||{});s.fc(lH);var lB=(e=>(e.ACH="ach",e.EFT="eft",e.BACS="bacs",e.SEPA="sepa",e.APPLE_PAY="apple_pay",e.CREDIT_CARD="credit_card",e.GOOGLE_PAY="google_pay",e.STRIPE_LINK="stripe_link",e.CRYPTO="crypto",e.PAYPAL="paypal",e))(lB||{});let lK=e=>{let t=[e.airwallexApplePay,e.authorizeNetApplePay,e.adyenApplePay],r=[];t.forEach(e=>{let t=e.publisher.getValueIfLoadedElse(null);t?.isAvailable&&r.push(t)});let o=e.stripePR.publisher.getValueIfLoadedElse(null);return o?.isAvailable&&o.availableProviders.applePay&&r.push({isAvailable:!0,isLoading:!1,processor:a4.Enum.stripe,startFlow:e=>o.startFlow("apple_pay",{overridePaymentRequest:e?.overridePaymentRequest})}),{processors:r.map(e=>e.processor),isAvailable:r.length>0,isLoading:!1,startFlow:e=>lJ(r,e)}},lZ=e=>{let t=[e.airwallexGooglePay,e.authorizeNetGooglePay,e.adyenGooglePay],r=[];t.forEach(e=>{let t=e.publisher.getValueIfLoadedElse(null);t?.isAvailable&&r.push(t)});let o=e.stripePR.publisher.getValueIfLoadedElse(null);return o?.isAvailable&&o.availableProviders.googlePay&&r.push({isAvailable:!0,isLoading:!1,processor:a4.Enum.stripe,startFlow:e=>o.startFlow("google_pay",{overridePaymentRequest:e?.overridePaymentRequest})}),{processors:r.map(e=>e.processor),isAvailable:r.length>0,isLoading:!1,startFlow:e=>lW(r,e)}},lJ=(e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Apple Pay processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Apple Pay processor found")},lW=(e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Google Pay processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Google Pay processor found")},lQ=e=>{let t=[],r=e.airwallexKlarna.publisher.getValueIfLoadedElse(null);r?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:a4.Enum.airwallex,startFlow:e=>r.startFlow(e)});let o=e.stripeKlarna.publisher.getValueIfLoadedElse(null);return o?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:a4.Enum.stripe,startFlow:e=>o.startFlow(e)}),{processors:t.map(e=>e.processor),isAvailable:t.length>0,isLoading:!1,startFlow:e=>lX(t,e)}},lX=(e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Klarna processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Klarna processor found")},l0=e=>{let t=[],r=e.stripeAffirm.publisher.getValueIfLoadedElse(null);return r?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:a4.Enum.stripe,startFlow:e=>r.startFlow(e)}),{processors:t.map(e=>e.processor),isAvailable:t.length>0,isLoading:!1,startFlow:e=>l1(t,e)}},l1=(e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Affirm processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Affirm processor found")},l3=e=>{let t=[],r=e.stripeAfterpay.publisher.getValueIfLoadedElse(null);return r?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:a4.Enum.stripe,startFlow:e=>r.startFlow(e)}),{processors:t.map(e=>e.processor),isAvailable:t.length>0,isLoading:!1,startFlow:e=>l2(t,e)}},l2=(e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Afterpay processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Afterpay processor found")},{log__:l5,err__:l4}=oo("tracer"),l6=async(e,t)=>{if(typeof window>"u")return;let{ConsoleSpanExporter:n,SimpleSpanProcessor:a,WebTracerProvider:i}=await Promise.all([r.e(3906),r.e(5455),r.e(93671),r.e(85565),r.e(29358),r.e(34617)]).then(r.bind(r,34617)),{FetchInstrumentation:s}=await Promise.all([r.e(3906),r.e(46961),r.e(42082)]).then(r.bind(r,42082)),{ZoneContextManager:l}=await r.e(66795).then(r.bind(r,91395)),{registerInstrumentations:c}=await Promise.all([r.e(46961),r.e(47526)]).then(r.bind(r,94080)),{Resource:u}=await Promise.all([r.e(5455),r.e(85565),r.e(11563)]).then(r.bind(r,45425)),{detectResourcesSync:d}=await Promise.all([r.e(3906),r.e(5455),r.e(93671),r.e(75296)]).then(r.bind(r,75296)).then(e=>e.d),{OTLPTraceExporter:p}=await Promise.all([r.e(82345),r.e(62594)]).then(r.bind(r,69463)),{B3Propagator:m,B3InjectEncoding:h}=await r.e(86858).then(r.bind(r,86858)),{BatchSpanProcessor:_}=await Promise.all([r.e(3906),r.e(5455),r.e(93671),r.e(85565),r.e(29358),r.e(12183)]).then(r.bind(r,12183));l5(`Initializing tracer with version ${e} and baseUrl ${t}`);let f=l8(t);l5(`Using collector URL ${f}`);let y=new p({url:f});return new i({resource:new u({"service.version":e,"service.name":"ojs"}).merge(d()),spanProcessors:[new a(new n),new _(y,{scheduledDelayMillis:500})]}).register({contextManager:new l,propagator:new m({injectEncoding:h.MULTI_HEADER})}),c({instrumentations:[new s({propagateTraceHeaderCorsUrls:[/.*/],ignoreUrls:[/^https:\/\/(.*\.)?adyen\.com/,/^https:\/\/(.*\.)?loopcrypto\.xyz/]})]}),o=ao.getTracer("openpay-js"),l5("Tracer initialized"),o},l8=e=>{let t=new URL(e).hostname;return"cde.openpaystaging.com"===t?"https://otel.openpaysandbox.com/v1/traces":"cde.getopenpay.com"===t?"https://otel.getopenpay.com/v1/traces":"http://localhost:4319/v1/traces"};class l9{constructor(e,t,r,o){this.handleMessage=e=>{if(!e.source)return void console.warn("[OJS] No source found");if(l7(e.origin)!==l7(this.baseUrl)||"object"==typeof e.data&&e.data.penpal||"object"==typeof e.data&&e.data.source&&"react-devtools-bri
215dge"===e.data.source)return;let t=null;try{t=(e=>{try{return ra.parse(e)}catch(t){throw console.error("Error parsing event payload:",e,t),t}})(JSON.parse(e.data))}catch{return}if(!this.validateEvent(t))return;let{elementId:r,payload:o}=t,n=o.type;switch(n){case"LAYOUT":this.internalCallbacks.setFormHeight(o.height?`${o.height}px`:"100%");break;case"FOCUS":this.formCallbacks.get.onFocus(r,o.elementType);break;case"BLUR":this.formCallbacks.get.onBlur(r,o.elementType,{obfuscatedValue:o.obfuscatedValue});break;case"CHANGE":this.formCallbacks.get.onChange(r,o.elementType,o.errors);break;case"LOADED":this.eventTargets[r]=e.source,this.internalCallbacks.onCdeLoaded(o);break;case"LOAD_ERROR":this.internalCallbacks.onCdeLoadError(o.message);break;case"VALIDATION_ERROR":this.formCallbacks.get.onValidationError(o.elementType,o.errors,r);break;default:console.warn("[form] Unhandled event type:",n)}},this.validateEvent=e=>e.formId===this.formId&&e.elementId?this.nonces.has(e.nonce)?(console.warn("[form] Ignoring duplicate event:",e),!1):(this.nonces.add(e.nonce),!0):(console.log("[OJS] formId",this.formId,e.formId),console.warn("[form] Ignoring unknown event:",e),!1),this.eventTargets={},this.nonces=new Set,this.formId=e,this.baseUrl=t,this.formCallbacks=r,this.internalCallbacks=o}}let l7=e=>new URL(e).origin;async function ce(e,t){let r=await (0,i.iZ)({iframe:e,debug:!1,childOrigin:t}).promise,o=await aA(r);if(!r||!o)throw Error("Got invalid CDE connection object");return r}class ct{constructor(){this.connections=new Map}addConnection(e,t){this.connections.set(e,t)}getConnection(){let e=this.connections.values().next().value;if(!e)throw Error("Connection not found");return e}getAllConnections(){return this.connections}}let cr=(e,t,r,o,n)=>lM.stripePR.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,e),nonCdeFormInputs:aL(r.formDiv),formCallbacks:o,customParams:{provider:e,overridePaymentRequest:n?.overridePaymentRequest},initResult:t}),co="The secure form failed to load properly. Please check your internet connection, or try again later.",{log__:cn,err__:ca}=oo("op-form"),ci=class e{constructor(t){this.isDestroyed=!1,this.cdeLoadEvent=new o$,this.anyCdeConn=new o$,this.context=new o$,this.initFlows={stripePR:lD("Stripe PR",lM.stripePR.init),stripeLink:lD("Stripe Link",lM.stripeLink.init),stripeKlarna:lD("Stripe Klarna",lM.stripeKlarna.init),stripeAffirm:lD("Stripe Affirm",lM.stripeAffirm.init),stripeAfterpay:lD("Stripe Afterpay",lM.stripeAfterpay.init),airwallexGooglePay:lD("Airwallex GooglePay",lM.airwallexGooglePay.init),airwallexApplePay:lD("Airwallex ApplePay",lM.airwallexApplePay.init),loop:lD("Loop",lM.loopCrypto.init),paypal:lD("PayPal",lM.paypal.init),airwallexKlarna:lD("Klarna",lM.airwallexKlarna.init),pockytPaypal:lD("Pockyt PayPal",lM.pockytPaypal.init),authorizeNetGooglePay:lD("Authnet GooglePay",lM.authorizeNetGooglePay.init),authorizeNetApplePay:lD("Authnet ApplePay",lM.authorizeNetApplePay.init),adyenGooglePay:lD("Adyen GooglePay",lM.adyenGooglePay.init),adyenApplePay:lD("Adyen ApplePay",lM.adyenApplePay.init)},this.isSubmitting=!1,this.startFormInit=async()=>{let t=ao.getTracer("openpay-js"),r=t.startSpan("form.initialize",{kind:n5.CLIENT,attributes:{"ojs.checkoutSecureToken":this.config.checkoutSecureToken,"ojs.deviceToken":this.deviceToken,"ojs.formId":this.formId,"ojs.version":this.ojsVersion,"ojs.release_version":this.ojsReleaseVersion,"ojs.base_url":this.baseUrl,"ojs.referrer":this.referrer}});return at.with(ao.setSpan(at.active(),r),async()=>{try{let o=this.createElement(tV.CDE_BRIDGE);o.node.id="__op_internal_cde_bridge",o.node.ariaHidden="true",Object.assign(o.node.style,{border:"none",margin:"0px",padding:"0px",width:"1px",height:"1px",overflow:"hidden",visibility:"hidden",position:"fixed",pointerEvents:"none",userSelect:"none"}),o.mount("body"),cn("CDE bridge element mounted"),cn("Initializing OpenPay form:"),cn("â Waiting for CDE load event...");let a=await this.cdeLoadEvent.waitForLoad({timeoutSec:120,timeoutErrMsg:co});cn("â CDE load event received"),r?.addEvent("waiting_for_cde_connection"),cn("â Waiting for CDE connection...");let i=t?.startSpan("cde.connect",void 0,at.active()),s=await this.anyCdeConn.waitForLoad({timeoutSec:120,timeoutErrMsg:co});i?.end(),r?.addEvent("cde_connected"),cn("â CDE connection received"),await aS(s,this.deviceToken),cn("â Creating OJS context, setting up handlers...");let l=e.buildOjsFlowContext(this.config,a,s,this.getFormDiv());
215this.context.set(l),((e,t,r)=>{let{stripePR:o}=e;o.publisher.subscribe(e=>{if(e.isSuccess){let o=e.loadedValue,n=o.isAvailable&&o.availableProviders.applePay,a=o.isAvailable&&o.availableProviders.googlePay;r.get.onPaymentRequestLoad({apple_pay:{isLoading:!1,isAvailable:n,startFlow:async e=>{n&&cr("apple_pay",o,t,r,e)}},google_pay:{isLoading:!1,isAvailable:a,startFlow:async e=>{a&&cr("google_pay",o,t,r,e)}}})}})})(this.initFlows,l,this.formCallbacks),cn("â Starting OJS init flows..."),await lU(this.initFlows,l,this.formCallbacks),this.formCallbacks.get.onLoad(a.totalAmountAtoms,a.currency),cn("â° Done initializing OJS flows."),r?.setStatus({code:n.OK}),o5("form_loaded")}catch(t){let e=r7(t);r?.setStatus({code:n.ERROR,message:e}),ca("â° Error initializing OP form:",e),o5("form_init_error",{error:e}),this.formCallbacks.get.onLoadError(e)}finally{r?.end()}})},this.setFormHeight=e=>{this.formProperties.height=e,this.registeredElements&&Object.values(this.registeredElements).forEach(t=>{t&&t.type!==tV.CDE_BRIDGE&&(t.node.style.height=e)})},this.onCdeLoaded=e=>{this.cdeLoadEvent.current.isSuccess||(this.cdeLoadEvent.set(e),o5("cde_loaded"))},this.onCdeLoadError=e=>{this.cdeLoadEvent.current.isSuccess||(this.cdeLoadEvent.throw(Error(e),e),o5("cde_load_error",{error:e}))},this.createElement=(e,t={})=>{if(this.checkValidFormInstance("createElement"),!this.config)throw Error("OpenPay form not initialized");let r=t$.parse(e),o=document.createElement("iframe"),n=this.buildQueryString(t);o.name=`${r}-element`;let a=new URL(`/app/v1/${o.name}/`,this.config.baseUrl);return a.search=n.toString(),o.src=a.href,o.style.border="none",o.style.width="100%",this.registerIframe(r,o)},this.registerIframe=(e,t)=>{let r={type:e,node:t,mount:r=>{document.querySelector(r)?.appendChild(t),o5("element_mounted",{element_type:e})}};return this.connectToElement({type:r.type,node:r.node}),this.registeredElements||(this.registeredElements={[tV.CARD]:void 0,[tV.CARD_NUMBER]:void 0,[tV.CARD_EXPIRY]:void 0,[tV.CARD_CVC]:void 0,[tV.CDE_BRIDGE]:void 0}),this.registeredElements[e]=r,r},this.buildQueryString=e=>{let t=new URLSearchParams;return t.append("referer",this.referrer),t.append("formId",this.formId),e.styles&&t.append("styles",JSON.stringify(e.styles)),t.append("secureToken",this.config.checkoutSecureToken),t},this.connectToElement=e=>aa({spanName:"connect_to_element",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},async()=>{let t=await ce(e.node);t.tracingContext={checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},this.connectionManager.addConnection(e.type,t),this.anyCdeConn.current.isSuccess||e.type!==tV.CDE_BRIDGE||this.anyCdeConn.set(t)}).catch(e=>ca("[FORM] Error connecting to CDE iframe",e)),this.getFormDiv=()=>document.querySelector(this.formTarget)??document.body,this.submitCard=async e=>{if(this.isSubmitting)return void ca("Form is already submitting. Please wait for the submission to finish before submitting again.");this.isSubmitting=!0;try{let t=await aa({spanName:"submit_card",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer,paymentRouteId:e?.paymentRouteId},async()=>{o5("submit_card",{...e}),this.checkValidFormInstance("submitCard");let t=this.context.getValueIfLoadedElse(null);if(!t)throw Error("Please wait for the form to finish loading before submitting.");await lM.commonCC.run({context:t,checkoutPaymentMethod:lL(t.checkoutPaymentMethods,"credit_card"),nonCdeFormInputs:aL(t.formDiv),formCallbacks:this.formCallbacks,customParams:{currentCdeConnections:this.connectionManager.getAllConnections(),paymentRouteId:e?.paymentRouteId},initResult:void 0})});return this.isSubmitting=!1,t}catch(e){throw this.isSubmitting=!1,e}},this.getAvailablePaymentMethods=()=>aa({spanName:"get_available_payment_methods",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},()=>{this.checkValidFormInstance("getAvailablePaymentMethods");let e=this.context.getValueIfLoadedElse(null);if(!e)throw Error("Please wait for the form to finish loading before getting available payment methods.");let{processors:t,isAvailable:r}=lK(this.initFlows),{processors:o,isAvailable:n}=lZ(this.initFlows),a=this.initFlows.paypal.publisher.getValueIfLoadedElse(null)?.isAvailable??!1,{processors:i,isAvailable:s}=lQ(this.initFlows),{processors:l,isAvailable:c}=l0(this.initFlows),{processors:u,isAvailable:d}=l3(this.initFlows),p=e.checkoutPaymentMethods.some(e=>"pockyt"===e.processor_name&&"paypal"===e.provider),m=this.initFlows.loop.publisher.getValueIfLoadedElse(null)?.isAvailable??!1,h=this.initFlows.stripeLink.publisher.getValueIfLoadedElse(null),_=h?.isAvailable??!1,f=[{name:lH.card,processors:[],isAvailable:!0},{name:lH.applePay,processors:t,isAvailable:r},{name:lH.googlePay,processors:o,isAvailable:n},{name:lH.paypal,processors:a?[a4.Enum.paypal]:[],isAvailable:a},{name:lH.klarna,processors:i,isAvailable:s},{name:lH.affirm,processors:l,isAvailable:c},{name:lH.afterpay,processors:u,isAvailable:d},{name:lH.pockytPaypal,processors:p?[a4.Enum.pockyt]:[],isAvailable:p},{name:lH.loopCrypto,processors:m?[a4.Enum.loop]:[],isAvailable:m},{name:lH.stripeLink,processors:[a4.Enum.stripe],isAvailable:_,controller:h?.isAvailable?h.controller:void 0}],y={paypal:lH.paypal,airwallexGooglePay:lH.airwallexGooglePay,airwallexApplePay:lH.airwallexApplePay,authorizeNetGooglePay:lH.authorizenetGooglePay,authorizeNetApplePay:lH.authorizenetApplePay,adyenGooglePay:lH.adyenGooglePay,adyenApplePay:lH.adyenApplePay};return[...Object.entries(this.initFlows).map(([e,t])=>{let r=t.publisher.getValueIfLoadedElse(null);return{name:y[e]??e,processors:[],isAvailable:r?.isAvailable??!1}}),...f]}),this.generalSubmit=async(e,t)=>{if(this.isSubmitting)return void ca("Form is already submitting. Please wait for the submission to finish before submitting again.");this.isSubmitting=!0;try{let r=await aa({spanName:"general_form_submit",checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,formId:this.formId,version:this.ojsVersion,releaseVersion:this.ojsReleaseVersion,baseUrl:this.baseUrl,referrer:this.referrer},async()=>{o5("general_form_submit",{method:e,settings:t}),this.checkValidFormInstance("generalSubmit");let r=this.context.getValueIfLoadedElse(null);if(!r)throw Error("Please wait for the form to finish loading before submitting.");switch(e){case lH.card:return this.submitCard(t);case lH.pockytPaypal:return lM.pockytPaypal.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,lB.PAYPAL,"pockyt"),nonCdeFormInputs:aL(r.formDiv),formCallbacks:this.formCallbacks,customParams:{settings:t},initResult:void 0});case lH.paypal:return lM.paypal.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,lB.PAYPAL,"payp
215al"),nonCdeFormInputs:aL(r.formDiv),initResult:void 0,customParams:{settings:t},formCallbacks:this.formCallbacks});case lH.klarna:{let{startFlow:e}=lQ(this.initFlows);return e(t)}case lH.affirm:{let{startFlow:e}=l0(this.initFlows);return e(t)}case lH.afterpay:{let{startFlow:e}=l3(this.initFlows);return e(t)}case lH.loopCrypto:return lM.loopCrypto.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,"crypto","loop"),nonCdeFormInputs:aL(r.formDiv),formCallbacks:this.formCallbacks,customParams:t,initResult:void 0});case lH.applePay:{let{startFlow:e}=lK(this.initFlows);return e(t)}case lH.googlePay:{let{startFlow:e}=lZ(this.initFlows);return e(t)}case lH.airwallexGooglePay:{let e=this.initFlows.airwallexGooglePay.publisher.getValueIfLoadedElse(null);if(!e)return void ca("airwallex-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return e.startFlow(t)}case lH.airwallexApplePay:{let e=this.initFlows.airwallexApplePay.publisher.getValueIfLoadedElse(null);if(!e)return void ca("airwallex-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return e.startFlow(t)}case lH.authorizenetGooglePay:{let e=this.initFlows.authorizeNetGooglePay.publisher.getValueIfLoadedElse(null);if(!e)return void ca("authorize-net-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return e.startFlow(t)}case lH.authorizenetApplePay:{let e=this.initFlows.authorizeNetApplePay.publisher.getValueIfLoadedElse(null);if(!e)return void ca("authorize-net-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return e.startFlow(t)}case lH.adyenGooglePay:{let e=this.initFlows.adyenGooglePay.publisher.getValueIfLoadedElse(null);if(!e)return void ca("adyen-google-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return e.startFlow(t)}case lH.adyenApplePay:{let e=this.initFlows.adyenApplePay.publisher.getValueIfLoadedElse(null);if(!e)return void ca("adyen-apple-pay is not available. Please check the availability using 'getAvailablePaymentMethods()'");return e.startFlow(t)}case lH.airwallexACH:return lM.airwallexACH.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,lB.ACH,"airwallex"),nonCdeFormInputs:aL(r.formDiv),formCallbacks:this.formCallbacks,customParams:t,initResult:void 0});case lH.airwallexEFT:return lM.airwallexEFT.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,lB.EFT,"airwallex"),nonCdeFormInputs:aL(r.formDiv),formCallbacks:this.formCallbacks,customParams:t,initResult:void 0});case lH.airwallexBACS:return lM.airwallexBACS.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,lB.BACS,"airwallex"),nonCdeFormInputs:aL(r.formDiv),formCallbacks:this.formCallbacks,customParams:t,initResult:void 0});case lH.airwallexSEPA:return lM.airwallexSEPA.run({context:r,checkoutPaymentMethod:lL(r.checkoutPaymentMethods,lB.SEPA,"airwallex"),nonCdeFormInputs:aL(r.formDiv),formCallbacks:this.formCallbacks,customParams:t,initResult:void 0});case lH.stripeLink:return void ca("StripeLink cannot be submitted manually. Please mount the button properly and if user completed the payment flow via StripeLink button, the payment will be submitted automatically.");default:oJ(e)}});return this.isSubmitting=!1,r}catch(e){throw this.isSubmitting=!1,e}},this.submitWith=this.generalSubmit,this.submit=this.submitCard,this.destroy=()=>{for(let e of(cn("Destroying OpenPay form..."),this.checkValidFormInstance("destroy"),this.isDestroyed=!0,Object.values(this.registeredElements??{})))e&&e.node.remove();oQ()?.removeEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),nr(),this.registeredElements=null,delete window.ojs,o5("form_destroyed")},this.updateCallbacks=e=>{this.formCallbacks.setCallbacks(e)},e.assignAsSingleton(this),this.ojsVersion="0.5.24",this.ojsReleaseVersion="local_build",this.baseUrl=t.baseUrl??"https://cde.getopenpay.com",this.config={...t,baseUrl:this.baseUrl},this.formCallbacks=lV.fromObject(t),this.registeredElements=null,this.formId=`opjs-form-${
215(0,c.A)()}`,this.referrer=window.location.origin,this.formTarget=t.formTarget??"body",this.formProperties={height:"1px"},this.connectionManager=new ct,this.deviceToken=aN(),nt();let{framework:r,version:o}=function(){let e=function(){try{let e=oQ();if(e?.next||e?.__NEXT_DATA__||document.querySelector("#__next"))return"nextjs";if(e?.__NUXT__||document.querySelector("#__nuxt"))return"nuxt";if(Object.keys(document).find(e=>e.includes("react"))||Array.from(document.body.querySelectorAll("body > *")).find(e=>e._reactRootContainer))return"react";return e?.Vue||e?.__VUE__?"vue":document.querySelector("[ng-version]")?"angular":"vanilla"}catch{return"unknown"}}(),t=function(e){try{switch(e){case"react":case"nuxt":case"vue":default:return null;case"nextjs":{let e=oQ();return e?.next?.version||e?.__NEXT_DATA__?.buildId||null}case"angular":{let e=oQ()?.document?.querySelector("[ng-version]");return e?e.getAttribute("ng-version"):null}}}catch{return null}}(e);return{framework:e,version:t}}();oZ(this.baseUrl).then(e=>{if(!oX.current.isSuccess){let t={checkoutSecureToken:this.config.checkoutSecureToken,deviceToken:this.deviceToken,environment:e,framework:r,frameworkVersion:o,ojsVersion:this.ojsVersion,ojsReleaseVersion:this.ojsReleaseVersion,referrer:this.referrer,baseUrl:this.baseUrl};oX.set(t)}}),o5("form_init"),console.log("OJS VERSION",this.ojsVersion),!0===t.allowTracing&&((e,t)=>{try{l6(e,t)}catch(e){l4(`Error initializing tracer: ${e}`)}})(this.ojsVersion,this.baseUrl),this.eventHandler=new l9(this.formId,this.baseUrl,this.formCallbacks,{setFormHeight:this.setFormHeight,onCdeLoaded:this.onCdeLoaded,onCdeLoadError:this.onCdeLoadError}),oQ()?.addEventListener("message",this.eventHandler.handleMessage.bind(this.eventHandler)),this.startFormInit()}get checkoutSecureToken(){return this.config.checkoutSecureToken}checkValidFormInstance(t="unknown"){let r=e.getInstance(),o={thisFormId:this.formId,currentFormId:r?.formId||"no-current-instance",isDestroyed:this.isDestroyed,checkoutToken:this.config.checkoutSecureToken.substring(0,10)+"..."},n=` 216 [Warning] Invalid form instance detected. 217 It looks like you are still using an old instance that has been destroyed. 218 Please make sure you are using the latest instance of the form and cleanup event listeners. 219 âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ 220 Debug Info: 221 - caller: ${t} 222 - caller_form_id: ${o.thisFormId} 223 - current_active_form_id: ${o.currentFormId} 224 - is_destroyed: ${o.isDestroyed} 225 - checkout_token: ${o.checkoutToken} 226 `;return this.isDestroyed?(ca(n),o5("outdated_form_instance",{error:n}),!1):!!r&&r.formId===this.formId||(ca(n),o5("outdated_form_instance",{error:n}),!1)}};ci.ojsFlows=lM,ci.assignAsSingleton=e=>{if(ci.getInstance())throw Error("OpenPay instance already exists. Only one instance is allowed.");window.ojs=e},ci.getInstance=()=>window.ojs??null,ci.buildOjsFlowContext=(e,t,r,o)=>({checkoutSecureToken:e.checkoutSecureToken,baseUrl:new URL(e.baseUrl??aj).origin,formDiv:o,elementsSessionId:t.sessionId,checkoutPaymentMethods:t.checkoutPaymentMethods,anyCdeConnection:r,customInitParams:e.customInitParams??{},preventNavigationDuringSubmission:e.preventNavigationDuringSubmission});let cs="op_ojs_form",cl=e=>{let[t,r]=(0,d.useState)(),[o,n]=(0,d.useState)(null),[a,i]=(0,d.useState)(!1),[s,l]=(0,d.useState)(tA),[c,p]=(0,d.useState)(tA),[m,h]=(0,d.useState)(null),[_,f]=(0,d.useState)(null),[y,g]=(0,d.useState)(null),[w,v]=(0,d.useState)(null),[b,k]=(0,d.useState)(tk),[P,I]=(0,d.useState)({googlePay:ty,applePay:ty}),E=(e=>{let t=tC.fromObject({onFocus:e.onFocus,onBlur:e.onBlur,onChange:e.onChange,onLoad:e.onLoad,onLoadError:e.onLoadError,onValidationError:e.onValidationError,onCheckoutStarted:e.onCheckoutStarted,onCheckoutSuccess:e.onCheckoutSuccess,onSetupPaymentMethodSuccess:e.onSetupPaymentMethodSuccess,onCheckoutError:e.onCheckoutError,onPaymentRequestLoad:e.onPaymentRequestLoad});return ci.getInstance()&&ci.getInstance()?.updateCallbacks(t.get),t.get})({...e,onLoad:(r,o)=>{i(!0),e.onLoad?.(r,o),t&&(l((e=>{let t=[e.airwallexApplePay,e.authorizeNetApplePay,e.adyenApplePay],r=[];
226t.forEach(e=>{let t=e.publisher.getValueIfLoadedElse(null);t?.isAvailable&&r.push(t)});let o=e.stripePR.publisher.getValueIfLoadedElse(null);return o?.isAvailable&&o.availableProviders.applePay&&r.push({isAvailable:!0,isLoading:!1,processor:tf.Enum.stripe,startFlow:e=>o.startFlow("apple_pay",{overridePaymentRequest:e?.overridePaymentRequest})}),{processors:r.map(e=>e.processor),isAvailable:r.length>0,isLoading:!1,startFlow:e=>((e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Apple Pay processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Apple Pay processor found")})(r,e)}})(t.initFlows)),p((e=>{let t=[e.airwallexGooglePay,e.authorizeNetGooglePay,e.adyenGooglePay],r=[];t.forEach(e=>{let t=e.publisher.getValueIfLoadedElse(null);t?.isAvailable&&r.push(t)});let o=e.stripePR.publisher.getValueIfLoadedElse(null);return o?.isAvailable&&o.availableProviders.googlePay&&r.push({isAvailable:!0,isLoading:!1,processor:tf.Enum.stripe,startFlow:e=>o.startFlow("google_pay",{overridePaymentRequest:e?.overridePaymentRequest})}),{processors:r.map(e=>e.processor),isAvailable:r.length>0,isLoading:!1,startFlow:e=>((e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Google Pay processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Google Pay processor found")})(r,e)}})(t.initFlows)),f((e=>{let t=[],r=e.airwallexKlarna.publisher.getValueIfLoadedElse(null);r?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:tf.Enum.airwallex,startFlow:e=>r.startFlow(e)});let o=e.stripeKlarna.publisher.getValueIfLoadedElse(null);return o?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:tf.Enum.stripe,startFlow:e=>o.startFlow(e)}),{processors:t.map(e=>e.processor),isAvailable:t.length>0,isLoading:!1,startFlow:e=>((e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Klarna processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Klarna processor found")})(t,e)}})(t.initFlows)),g((e=>{let t=[],r=e.stripeAffirm.publisher.getValueIfLoadedElse(null);return r?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:tf.Enum.stripe,startFlow:e=>r.startFlow(e)}),{processors:t.map(e=>e.processor),isAvailable:t.length>0,isLoading:!1,startFlow:e=>((e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Affirm processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Affirm processor found")})(t,e)}})(t.initFlows)),v((e=>{let t=[],r=e.stripeAfterpay.publisher.getValueIfLoadedElse(null);return r?.isAvailable&&t.push({isAvailable:!0,isLoading:!1,processor:tf.Enum.stripe,startFlow:e=>r.startFlow(e)}),{processors:t.map(e=>e.processor),isAvailable:t.length>0,isLoading:!1,startFlow:e=>((e,t)=>{if(t?.processor){let r=e.find(e=>e.processor===t.processor);if(r?.isAvailable)return r.startFlow(t);throw Error(`Specified Afterpay processor ${t.processor} is not available`)}let r=e.find(e=>e.isAvailable);if(r)return r.startFlow(t);throw Error("No available Afterpay processor found")})(t,e)}})(t.initFlows)))}});if((0,d.useEffect)(()=>{if(t)return;let o=ci.getInstance()??new ci({checkoutSecureToken:e.checkoutSecureToken,formTarget:`#${cs}`,baseUrl:e.baseUrl,customInitParams:e.customInitParams,allowTracing:e.allowTracing??!1,preventNavigationDuringSubmission:e.preventNavigationDuringSubmission,...E});return r(o),n(cc(o)),o.initFlows.stripeLink.publisher.subscribe(e=>{e.isSuccess&&e.loadedValue.isAvailable&&h(e.loadedValue.controller)}),o.initFlows.loop.publisher.subscribe(e=>{e.isSuccess&&e.loadedValue.isAvailable?k({isAvailable:!0,isLoading:!1,widget:e.loadedValue.widgetProps,config:e.loadedValue.initLoopConnectProps}
226):e.isSuccess&&!e.loadedValue.isAvailable&&k({isAvailable:!1,isLoading:!1,widget:null,config:null})}),o.initFlows.airwallexGooglePay.publisher.subscribe(e=>{e.isSuccess&&e.loadedValue&&I(t=>({applePay:t.applePay,googlePay:e.loadedValue}))}),o.initFlows.airwallexApplePay.publisher.subscribe(e=>{e.isSuccess&&e.loadedValue&&I(t=>({googlePay:t.googlePay,applePay:e.loadedValue}))}),()=>{o.destroy()}},[]),!t)return(0,u.jsx)(u.Fragment,{});let C={submit:t.submitCard,submitWith:t.generalSubmit,applePay:s,googlePay:c,loaded:a,preview:{amount:null,isLoading:!1,error:null},stripeLink:m,klarna:_,airwallex:P,loop:b,affirm:y,afterpay:w};return(0,u.jsx)(u.Fragment,{children:o?(0,u.jsx)(tj.Provider,{value:o,children:(0,u.jsx)("div",{id:cs,className:e.className,children:e.children(C)})}):(0,u.jsx)(u.Fragment,{})})},cc=e=>({formId:e.formId,formHeight:e.formProperties.height,referrer:e.referrer,checkoutSecureToken:e.checkoutSecureToken,registerIframe:e.registerIframe,baseUrl:e.baseUrl})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.