1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["75f3a0c7.DI1EiYrm.js","2c1ab0fe.GMbxnz74.js","efa0389a.Cyj781OI.js","164ad2e3.BbIvMjRY.js","4c290a1e.C6TDJ9Fn.js","app.CepNJbvh.js","assets/app.BuSMBobh.css","assets/previous.Cyrg41An.css","9f047e05.CCJUgz_L.js","0a7dffce.DfUtZWCu.js","5fda1420.KYpufQ--.js","60a453ce.CkhHeRBc.js","21cc90a2.DAzJmttM.js","bb728e1c.iawBHR84.js","assets/helpers.CWAfD7H_.css","assets/Choice.CIaVEvsx.css","31cc568e.eY_zQ4dB.js","assets/index.CiYh36Pk.css","50130ded.D6F2mjeI.js","f692f62f.DHgy7Fzw.js","assets/RedirectionNotice.B8v_QGNW.css","f3fe2775.BSk1ex1h.js","ac5a19ff.CRrh5Bdw.js","598fef4e.Bhe6r8fJ.js","assets/PaymentIcon.DUuFvlux.css","e77f7fe0.xbyxUO7Z.js","assets/PaymentLine.B_vs66ws.css","a422df8c.BXxALpKm.js","assets/EmptyState.CZwDb_Yh.css","cc6ff67d.CUDxlVK0.js","08a3b809.BxtDOfoo.js","bff2ff9b.Wb1R3ZbF.js","87bfafec.B2XXZnjV.js","e39bc11c.BPwkTsU-.js","cf29e63b.ByW6Fn7D.js","assets/hasViolationsIgnoringCodes.CQ_TUsw-.css","dfca5da5.BFrL439g.js","assets/Section.CU18S7Ap.css","55098bf1.CKQdNNxq.js","0e67bd3b.rrDC0LWO.js","74835653.CRP9zX7D.js","29034f35.BtTRppF-.js","47b970b2.hK1atmf1.js","0727407f.CsUvC--9.js","assets/PhoneField.-WW1pYgW.css","064f6ac1.B1U3VPaO.js","assets/Popover.Bi1nHaU-.css","53bbdad9.CGJC_1cv.js","assets/BillingAddressForm.2HXntA0X.css","7a8217fd.CuaDs8we.js","assets/useShopPayProgressIntercepts.DIc3vsmn.css","e477f96c.BxtSUGa4.js","7114e006.Dn0MarCB.js","b684bff6.BpL4wH2U.js","assets/MissingFields.BbxB_6wt.css","6720fa5f.Dt8m7rOm.js","assets/Rollup.DH9hPBhl.css","58314944.1jO_vh_4.js","4a3d8599.CGwv06ae.js","8536083a.BLo7Yz4V.js","3a819064.Dx-RF2LD.js","assets/WalletSandbox.DOuxlppk.css","assets/lazyBankPaymentMethod.Bunr75uw.css","04164916.BoudB34k.js","assets/lazyPaymentMethods.J240_loH.css","assets/payment-selector-transitions.Wfh8Woqf.css"])))=>i.map(i=>d[i]); 2import{t as e,T as t,s as n,x as a,m as r,a as s,u as i,S as l,q as d,l as o,C as c,n as u,X as m,E as p,w as y,D as h,v,W as b,Q as g,_ as f,z as _,o as C,p as S,aA as A}from"./2c1ab0fe.GMbxnz74.js";import{W as P,S as w,c3 as k,bh as M,y as x,cl as E,bp as I,V as
2L,co as B,cO as D,jv as N,jw as T,fR as F,bi as O,jx as V,jy as z,bO as R,f3 as H,aZ as j,b7 as $,jz as U,ax as q,X as Y,_ as W,T as G,aQ as K,aP as X,jA as J,jB as Q,b6 as Z,gs as ee,c6 as te,jC as ne,jD as ae,a1 as re,bg as se,al as ie,aS as le,x as de,h4 as oe,jE as ce,ac as ue,jF as me,eE as pe,Q as ye,jG as he,jH as ve,df as be,Y as ge,d9 as fe,jI as _e,c4 as Ce,b1 as Se,dJ as Ae,dL as Pe,jJ as we,K as ke,i0 as Me,U as xe,cQ as Ee,jK as Ie,J as Le,jL as Be,ak as De,eX as Ne,eY as Te,be as Fe,aL as Oe,jM as Ve,jN as ze,b2 as Re,aa as He,bH as je,jO as $e,h6 as Ue,c5 as qe,dz as Ye,c9 as We,bf as Ge}from"./4c290a1e.C6TDJ9Fn.js";import{bX as Ke,i as Xe,a1 as Je,e6 as Qe,c as Ze,ay as et,J as tt,o as nt,gO as at,h as rt,B as st,bp as it,bq as lt,dB as dt,ds as ot,gS as ct,_ as ut,aH as mt,aJ as pt,aK as yt,cx as ht,aF as vt,b as bt,a3 as gt,H as ft,I as _t,P as Ct,l as St,a as At,eN as Pt,aA as wt,bd as kt,hy as Mt,hz as xt,C as Et,E as It,c$ as Lt,ca as Bt,d as Dt,W as Nt,F as Tt,fl as Ft,eo as Ot,fo as Vt,L as zt,N as Rt,bT as Ht,bU as jt,hA as $t,e as Ut,dJ as qt,a4 as Yt,hB as Wt,hC as Gt,c0 as Kt,hD as Xt,hE as Jt,hF as Qt,hG as Zt,hH as en,a7 as tn,t as nn,cv as an,cw as rn,aa as sn,a9 as ln,ax as dn,gZ as on,bc as cn,eb as un,ec as mn,a5 as pn,bz as yn,g_ as hn,ee as vn,ai as bn,y as gn,R as fn,eV as _n,bk as Cn,ah as Sn,eU as An,bF as Pn,hI as wn,hJ as kn,ex as Mn,c_ as xn,eX as En,hK as In,cX as Ln,bv as Bn,hj as Dn,hk as Nn,hL as Tn,ed as Fn,ef as On}from"./164ad2e3.BbIvMjRY.js";import{u as Vn,s as zn}from"./bff2ff9b.Wb1R3ZbF.js";import{a as Rn}from"./dfca5da5.BFrL439g.js";import{j as Hn,_ as jn}from"./app.CepNJbvh.js";import{b as $n,a as Un,_ as qn,C as Yn}from"./efa0389a.Cyj781OI.js";import{I as Wn}from"./55098bf1.CKQdNNxq.js";import{S as Gn,A as Kn,a as Xn}from"./0e67bd3b.rrDC0LWO.js";import{B as Jn,C as Qn,l as Zn,E as ea,j as ta,m as na,F as aa,H as ra,I as sa,J as ia,P as la,M as da,K as oa,L as ca,O as ua,Q as ma,R as pa,D as ya,U as ha,W as va,X as ba,N as ga,f as fa,k as _a}from"./f3fe2775.BSk1ex1h.js";import{a as Ca,i as Sa}from"./87bfafec.B2XXZnjV.js";import{b as Aa,u as Pa,A as wa,B as ka,c as Ma}from"./74835653.CRP9zX7D.js";import{d as xa,F as Ea,b as Ia,W as La,a as Ba}from"./31cc568e.eY_zQ4dB.js";import{u as Da,O as Na,M as Ta}from"./7a8217fd.CuaDs8we.js";import{v as Fa}from"./e477f96c.BxtSUGa4.js";import{c as Oa,C as Va,M as za,A as Ra,d as Ha}from"./7114e006.Dn0MarCB.js";import{R as ja}from"./6720fa5f.Dt8m7rOm.js";import{b as $a,u as Ua,a as qa}from"./b684bff6.BpL4wH2U.js";import{c as Ya,t as Wa,e as Ga}from"./bb728e1c.iawBHR84.js";import{a as Ka}from"./a422df8c.BXxALpKm.js";import{d as Xa,a as Ja,c as Qa,b as Za}from"./58314944.1jO_vh_4.js";import{P as er,w as tr}from"./598fef4e.Bhe6r8fJ.js";import{S as nr,O as ar,s as rr}from"./cf29e63b.ByW6Fn7D.js";import{P as sr}from"./064f6ac1.B1U3VPaO.js";import{g as ir}from"./e77f7fe0.xbyxUO7Z.js";import{a as lr,u as dr,b as or}from"./cc6ff67d.CUDxlVK0.js";import{f as cr,a as ur}from"./08a3b809.BxtDOfoo.js";function mr(){const{paymentLines:t}=P();return e(()=>{const e=t.value.find(e=>Boolean("direct"===e.method?.type&&e.method?.creditCardLastFourDigits&&e.method?.brand));if(e)return e.method})}class pr extends Error{constructor(){super(...arguments),this.name="EmptyPaymentLinesError"}}function yr(){const{observability:e,shop:{paymentMethodAutoSelectionDisabled:a,paymentGateways:r}}=w(),s=Ke(),i=mr(),l=!a,d=k(),o=M("paymentMethods"),c=t(()=>r?.map(e=>e.name)??[],[r]);return n(t=>{const n=void 0!==r&&r.length>0,u=!o.value&&d.value.length>0;if(!n||!u)return;const m={hasSessionCard:Boolean(i.value),paymentGateways:c,paymentMethodAutoSelectionDisabled:a,paymentRequired:s.value,stage:t};l&&e.error(new pr(`Payment lines are unexpectedly empty during "${t}" stage. Negotiation was blocked.`),{severity:"error",metadata:{app:m}})},[l,d,i,o,e,c,r,a,s])}function hr(){const{i18n:e,observability:t}=w(),i=Ke(),l=P().paymentLines.value,[d,o]=a(!1),[c,u]=a(!1),{negotiate:m}=Xe(),p=yr(),y=n(async()=>{c||(u(!0),await m({legacyFiltering:{include:["paymentLines"]},force:!1,fieldsToResolve:["taxes","paymentMethods"],silenceViolations:x(["paymentLines"]),onComplete(){o(!0),u(!1)}}))},[m,c]);r(()=>{const e=l.find(e=>["paymentOnDelivery","manualPayment","customManualPayment"].includes(e.method.type));(l.find(e=>"offsite"===e.method.type)||e)&&!d&&y()}
2,[l,y,d]),Je({active:c}),E(({parts:n,reason:a})=>{if("progression"!==a&&"completion"!==a||!i.value)return{behavior:"allow"};const r=n.paymentLines.peek()[0];if(void 0===r)return p(a),{behavior:"block",reason:I.EmptyPaymentLines,errors:[{message:e.translate("field_errors.payment_gateway_missing"),target:Qe}],perform:()=>{}};switch(r.method.type){case"giftCard":case"local":case"customOnsite":case"direct":case"offsite":case"redeemable":return{behavior:"allow"};case"deferred":{const e={method:{type:"deferred"}};return{behavior:"allow",perform(){Vn(n,e)}}}case"paymentOnDelivery":{const{additionalDetails:e,paymentInstructions:t,paymentMethodIdentifier:a,availablePresentmentCurrencies:s}=r.method,i={method:{type:"paymentOnDelivery",additionalDetails:e,paymentInstructions:t,paymentMethodIdentifier:a,availablePresentmentCurrencies:s}};return{behavior:"allow",perform(){Vn(n,i)}}}case"manualPayment":{const{id:e,name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}=r.method,d={method:{id:e,type:"manualPayment",name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}};return{behavior:"allow",perform(){Vn(n,d)}}}case"customManualPayment":{const{id:e,name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}=r.method,d={method:{id:e,type:"customManualPayment",name:t,additionalDetails:a,paymentInstructions:s,paymentMethodIdentifier:i,availablePresentmentCurrencies:l}};return{behavior:"allow",perform(){Vn(n,d)}}}case"wallet":{if("PAYPAL_EXPRESS"!==r.method.name)return{behavior:"allow"};const{walletContent:e}=r.method;return{behavior:"allow",async perform({behavior:t}){"allow"===t&&Vn(n,{method:{type:"wallet",name:"PAYPAL_EXPRESS",walletContent:e}})}}}case"walletsPlatformPaymentMethod":{const{name:e,walletParams:t}=r.method;return{behavior:"allow",perform(){Vn(n,{method:{type:"walletsPlatformPaymentMethod",name:e,walletParams:t}})}}}case L.CreditCard:case L.PayPal:case"bank":case"shopWallet":return{behavior:"allow"};case"noop":case"other":return t.log("payment_unexpected_payment_line_detected","Unexpected payment line",{type:r.method.type}),{behavior:"allow"};default:s(r.method)}})}function vr({selectableBrands:e=[],activeBrand:t,onSelectBrand:n,viewTransitionKey:a,size:r}){const{i18n:s}=w();return i("div",{className:"o0Dix",role:"radiogroup","aria-label":s.translate("payment.network_card_payment_options"),children:i(Ze,{direction:"inline",gap:"small-400",children:e.map((s,l)=>{const d=t===s,o=t?d:void 0,c=t?!o:void 0,u=d||!t&&0===l?0:-1,m={viewTransitionName:`vt-${a}-${s}`},p=function(e){return`network-selector-${e.toLowerCase()}`}(s);return i("button",{id:p,"aria-label":B(s),"aria-checked":d,role:"radio",className:"fmZaX",style:m,onClick:e=>((e,t)=>{e.preventDefault(),n(t)})(e,s),onKeyDown:t=>((t,a)=>{const r=e.length-1;let s;switch(t.key){case"ArrowRight":case"ArrowDown":s=a===r?0:a+1;break;case"ArrowLeft":case"ArrowUp":s=0===a?r:a-1;break;case"Home":s=0;break;case"End":s=r;break;default:return}if(s<0)return;t.preventDefault();const i=t.currentTarget.parentElement?.children[s];i&&(i.focus(),n(e[s]))})(t,l),tabIndex:u,type:"button",children:i(er,{type:s,size:r,disabled:c,active:o,accessibilityVisibility:"hidden"})},s)})})})}function br({paymentBrands:e,activeIconDisplayed:t,activePaymentBrand:n,viewTransitionKey:a,size:r}){const{i18n:s}=w();return i(l,{children:e.map(e=>{const d=i(er,{type:e,size:r,disabled:t&&n!==e,active:n===e}),o=a?`vt-${a}-${e}`:void 0,c=o?i("span",{id:o,style:{viewTransitionName:o,display:"flex"},className:"_6f3AR",children:d},e):i(l,{children:d},e);return"BOGUS"===e?i(et,{accessibilityLabel:s.translate("payment_gateway.bogus_label"),overlay:i(at,{children:s.translate("payment_gateway.bogus_label")}),children:c},e):c})})}function gr({paymentBrands:e,activePaymentBrand:t,viewTransitionKey:n,brandCountOverride:a,size:r,maxVisibleBrands:s,overflowIndicatorRef:l}){const d=e.filter(e=>D(e)),o=N(d.length,s),{visiblePaymentBrands:c,hiddenPaymentBrands:u}=T(d,o),m=!!t&&Boolean(c.includes(t)),p=u.length>0||a,y=a?`+${a}`:`+${u.length}`;return i("div",{className:"mpn0m",children:i(Ze,{direction:"inline",gap:"small-400",alignItems:"center",children:[i(br,{paymentBrands:c,activeIconDisplayed:m,activePaymentBrand:t,viewTransitionKey:n,size:r}),p&&i(et,{ref:l,accessibilityVisibility:"hidden",overlay:a?null:i(at,{id:"additional-payment-brand-icons",children:i(Ze,{direction:"inline",gap:"small-400",alignItems:"center",children:i(br,{paymentBrands:u,activeIconDisplayed:m,activePaymentBrand:t,viewTransitionKey:n,size:r})})}),className:"KOEBK",children:i(tt,{justifyItems:"center",justifyContent:"center",alignItems:"center",alignContent:"center",children:i(nt,{size:"extraSmall",tone:"accent",children:y})})})]})})}function fr({animate:e,announceNetworkSelector:t,announceOverflowBrands:n,size:a,maxVisibleBrands:r,overflowIndicatorRef:s}){const{activePaymentBrand:l,binLength:d,paymentMethod:o,selectableBrands:c,selectedSavedCreditCardBrand:u,setSelectedNetwork:m}=Jn(),p=Boolean(o?.supportsNetworkSelection);return o?i(_r,{animate:e,announceNetworkSelector:t,announceOverflowBrands:n,size:a,maxVisibleBrands:r,overflowIndicatorRef:s,activeBrand:l,availableBrands:o.paymentBrands,networkSelectionEnabled:p,onSelectBrand:m,s
2avedCardBrand:u,selectableBrands:c,viewTransitionKey:o.paymentMethodIdentifier,binLength:d}):null}function _r({animate:e=!0,availableBrands:t,selectableBrands:a=[],activeBrand:s,savedCardBrand:o,onSelectBrand:c,viewTransitionKey:u,networkSelectionEnabled:m=!1,binLength:p,announceNetworkSelector:y=!1,announceOverflowBrands:h=!1,size:v,maxVisibleBrands:b,overflowIndicatorRef:g}){const{i18n:f}=w(),_=rt(),C=p>=6||Boolean(o),S=d([]),A=e&&!_,P=n(e=>{A?Hn(()=>S.value=e,["payment-icons"]):S.value=e},[S,A]);r(()=>{let e=[];C&&(o?e=[o]:a.length?e=a:s&&t.includes(s)&&(e=[s])),F(S.value,e)||P(e)},[C,s,t,o,a,S,P]);const k=t.filter(e=>!S.value.length||S.value.includes(e)),M=!s||A&&!S.value.includes(s)?void 0:s,x=m&&S.value.length>1,E=S.value.length>0&&k[0]?[k[0]]:k;let I=E;x?I=[]:m&&(I=k);const L=h?O(f,I,void 0,b):"",B=L?`${f.translate("tooltip.additional_payment_methods")}: ${L}`:"",D=y&&x?f.translate("payment.network_card_payment_options"):B;return i(l,{children:[(y||h)&&i(st,{accessibilityRole:"status",accessibilityVisibility:"exclusive",children:D}),m?i(l,{children:x?i(vr,{selectableBrands:a,activeBrand:s,onSelectBrand:c,viewTransitionKey:u,size:v}):i(gr,{activePaymentBrand:M,viewTransitionKey:u,paymentBrands:k,size:v,maxVisibleBrands:b,overflowIndicatorRef:g})}):i(gr,{activePaymentBrand:M,viewTransitionKey:u,paymentBrands:E,size:v,maxVisibleBrands:b,overflowIndicatorRef:g})]})}function Cr(e){const t=d(Math.min(e,1)),a=o(null),r=o(null),s=o(null),i=o(null),l=o(null),c=o(null),u=o(null),m=n(()=>{const n=a.current,l=r.current,d=s.current,o=i.current;null!==n&&null!==l&&null!==d&&null!==o&&(t.value=function(e,t,n,a,r){return t*a+(t-1)*n<=e?t:Math.max(1,Math.floor((e-r)/(a+n)))}(n,e,l,d,o))},[t,e]),p=n(e=>{const t=l.current;t&&u.current?.unobserve(t),l.current=e;const n=e?.parentElement;if(n){const t=getComputedStyle(n),a=parseFloat(t.fontSize)||14;r.current=parseFloat(t.columnGap)||0,s.current=tr.base.inlineSize/14*a,i.current=e.getBoundingClientRect().width,u.current?.observe(e)}m()},[m]);return{ref:n(n=>{if(u.current?.disconnect(),u.current=null,c.current=n,!n)return;if("undefined"==typeof ResizeObserver)return void(t.value=e);const r=new ResizeObserver(e=>{for(const t of e){const e=t.target===l.current?t.target.getBoundingClientRect().width:t.contentBoxSize?.[0]?.inlineSize??t.contentRect.width;e<=0||(t.target===l.current?i.current=e:t.target===c.current&&(a.current=e))}m()});r.observe(n),l.current&&r.observe(l.current),u.current=r},[t,e,m]),overflowIndicatorRef:p,maxVisibleBrands:t}}const Sr=()=>{const t=Ke(),n=V(),a=z("STORE_CREDIT"),r=R(),s=M("deliveryNext"),i=o(null),l=e(()=>({giftCard:n.value,storeCredit:a.value,redeemables:r.value,freeOrder:!t.value}));return c(()=>{s.value||(i.current=l.value)}),e(()=>{const e=l.value;return s.value?i.current??e:e})};function Ar(e,t){return"shopPay"===e.current.value?t:null}function Pr({addressErrors:e,billingAddressOption:t,billingAddressValue:n}){const{shopPay:a,checkout:r}=w(),{configuration:s}=r,i=xa(),l=s.addressSettings.billingAddressSettings.value,d=it(n?.countryCode,void 0,l),o=r.addressManager.billing.value,c=r.addressManager.shipping.value,m=a.session.selectedShippingAddress.value,p=lt().value,y=dt();return Da("billingAddress",async()=>{if("shipping"===t.value&&m?.id===o.selectedAddress.value?.id&&!p)return{success:!0};if("shipping"!==t.value&&m?.id!==o.selectedAddress.value?.id)return{success:!0};if("authenticated_user"!==a.user.flow.peek())return Fa({addressType:"billing",validate:()=>d(n,"billing"),setErrors:t=>{u(()=>{for(const[n,a]of t)e[n].value=a})}});!p&&"custom"===t.value&&a.session.unstable_updateSelectedBillingAddress({address:n,valid:!0,lastUsedAt:(new Date).toISOString(),requiresVerification:!0,userPreferred:!1,id:"",uuid:""});const s=p||r.isShippingRequired.value&&!y.value?null:await o.createAddress({address:n,addressErrorsOverride:e});return!m?.id&&p&&await c.createAddress({address:n,addressErrorsOverride:e}),void 0===s?{success:!1,location:"intercept_billing_address_add_new",errors:Object.values(e).some(e=>void 0!==e.value)?[]:[i({offerGuestCheckout:!0})]}:{success:!0}}),null}const wr=m({});function kr({settings:e,children:t,additionalFieldGroups:n,addressSettings:a}){const{checkout:s,shopPay:l}=w(),{configuration:d}=s,o=p(wr),c=o?.addressErrors??s.validation.billingAddressErrors;Aa(c);const{billingAddress:u,billingAddressOption:m,paymentLines:y}=P(),h=H(),v=ot(),b="wallet"===y.value[0]?.method?.type,g=s.installments.isSupported.value,f=l.session.isInstallmentsSelected.value,_=g&&f&&s.installments.supportedCountryOptions.value.length>0?s.installments.supportedCountryOptions.value:h,C=ct(s),S=u.value,{updateCountryCodeForSPIBillingAddress:A}=Pa(u.fields.countryCode,_);r(()=>{g&&f&&A()},[g,f,A]);const k=d.defaultPhoneNumber.value;return k&&C.isRequired("phone",{useMerchantSettings:!0})&&!S.phone&&(u.value={...S,phone:k}),i(ut,{onSubmit:()=>{if(!v)return;const e=document.getElementById(v.id);e?.dispatchEvent(new Event("submit"))},children:[i(wa,{id:"billingAddressForm",addressType:"billing",addressErrors:c,address:u,countries:_,settings:e,additionalFieldGroups:n,addressSettings:a??C,shouldSkipAddressValidation:b,children:t}),Mr({identity:s.identity})&&i(Pr,{addressErrors:c,billingAddressOption:m,billingAddressValue:S})]})}function Mr({identity:e}){return"shopPay"===e.current.value}function xr(){const{i18n:e}=w(),t=mt(),{billingAddressOption:a,billingAddress:s,shippingAddress:l}=P(),d=l.value,o=pt(),{billing:c}=j();yt(),r(()=>()=>{c.value=!1},[c]);const u=n(({billing:e})=>{e.value=!0},[]),m=n(({billing:e})=>{e.value=!1},[]);return i(st,{children:[i(y,{when:()=>"selector"===t.value,children:i(ht,{id:"billingAddressCheckbox",name:"billingAddress",checked:"shipping"===a.value,onChange:e=>{e?(a.value="shipping",o()):(a.value="custom",function(){const e=$({zoneCode:void 0,countryCode:d.countryCode});s.value=e}())},label:e.translate("payment.same_billing_address_checkbox_label")})}
2),i(vt,{id:"billingAddressDetails",open:"shipping"!==a.value,children:[i(bt,{blockSize:"large-300"}),i(gt,{accessibilityRole:"group",accessibilityLabelledBy:"billingAddress",children:[i(ft,{id:"billingAddress",level:2,children:e.translate("payment.billing_address_title")}),i(bt,{blockSize:"base"}),i(Gn,{onValid:u,onInvalid:m,children:i(kr,{})})]})]})]})}function Er(){const{shopPay:t,checkout:n}=w(),a=t.user.addresses,r=n.installments.config,s=t.session.isInstallmentsSelected;return e(()=>{const e=a.value,t=r.value,n=void 0!==t&&s.value,i=n&&t?e.filter(e=>!Ya(e.address,t)):e,l=n&&t?e.filter(e=>Ya(e.address,t)):[],d=[...i.map(e=>Wa({address:e})),...l.map(e=>Wa({address:e,isDisabled:()=>!0}))];return{validAddresses:i,disabledAddresses:l,addresses:d}})}function Ir({addressType:e,addressCount:t,onPress:n}){const a="shipping"===e,{i18n:r}=w(),s=t>=U;return i(St,{variant:"plain",inlineSize:"fill",inlineAlignment:"start",onClick:n,disabled:s,children:i(Ze,{direction:"inline",gap:"small-100",alignItems:"center",children:[i(_t,{type:"plus",size:"base"}),i(Ze,{alignItems:"start",gap:"small-400",children:[i(Ct,{textAlign:"start",color:s?"subdued":void 0,children:a?r.translate("shipping.add_address"):r.translate("billing.add_address")}),s&&i(Ct,{textAlign:"start",type:"small",children:i(nt,{type:"strong",children:r.translate("address_management.address_form.max_address",{max_addresses:U})})})]})]})})}function Lr({id:e,label:t,addressType:s,onAddAction:l}){const{i18n:d,userEvents:c,source:u,checkout:m,shop:p,shopPay:y}=w(),h=y.user.addresses.value,{selectAddress:v}=$a(s),b=m.addressManager[s].value.selectedAddress,g=o(b.peek()),[f,_]=a(!b.peek()),C=m.installments.isSupported.value&&y.session.isInstallmentsSelected.value,S=Er(),{addresses:A,validAddresses:P}=S.value,{setFirstSpiSupportedAddress:k}=function({selectedAddress:e,setSelectedAddress:t}){const{checkout:a}=w(),r=Er(),s=a.installments.config.value??null;return{setFirstSpiSupportedAddress:n(()=>{const{validAddresses:n}=r.value,[a]=n;e&&s&&a&&Ya(e,s)&&t(a.id)},[r,s,e,t])}}({selectedAddress:b.value?.address,setSelectedAddress:v});r(()=>{C&&"billing"===s&&k()},[C,s,k,P]),r(()=>{const e=b.value,t="billing"===s&&g.current&&!e;e||_(!0),g.current=e,t&&At({content:d.translate("general.choose_billing_address"),role:"status"})},[s,d,b.value]);const M=n(()=>{const e="shipping"===s?"shipping_addresses":"billing_addresses";c.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...q(u,m,p),action:f?`${e}_collapse`:`${e}_expand`}}),_(e=>!e)},[c,u,m,p,s,f]),{nameLine:x,primary:E,secondary:I}=Pt({address:b.value?.address??{},nameLinePosition:"block"}),L=b.value?x:void 0,B=b.value?i(Ze,{children:[E&&i(nt,{children:E}),I&&i(nt,{children:I})]}):i(Ct,{children:d.translate("address_management.address_form.add_address")});return i(wt,{theme:{rollup:{inlinePadding:"none"}},children:i(ja,{open:f,id:e,label:t,onToggle:M,primaryContent:L,secondaryContent:B,children:i(Ze,{gap:"small-200",children:[i(Oa,{id:"billing_address_credit_card",addresses:A,addressType:"billing",onChange:e=>v(e,{source:"shop-pay-address-review-item"}),selectedId:b.value?.id}),i(st,{padding:"none small-100",children:i(Ir,{addressType:s,addressCount:h.length,onPress:l})})]})})})}function Br({billingAddressInContext:e}){const{i18n:r,checkout:s}=w(),[d,o]=a(!1),c=Qn(),u=s.configuration.addressSettings.billingAddressSettings.value,m=t(()=>({addressErrors:s.validation.billingAddressErrors,addressSettings:u}),[u,s.validation.billingAddressErrors]),p=m.addressErrors,{createAddress:y}=$a("billing"),h=n(e=>y({address:e,addressErrorsOverride:p}),[p,y]);return i(l,{children:[e?i(wr.Provider,{value:m,children:i(xr,{})}):i(st,{border:"base",borderRadius:"base",padding:"none base",children:i(Lr,{id:"payment_selector_billing_address",addressType:"billing",label:r.translate("payment_ux.bill_to"),onAddAction:()=>o(!0)})}),i(Na,{open:d,heading:r.translate("address_management.address_form.add"),onHide:()=>o(!1),children:i(Va,{addressType:"billing",addressErrorsSignal:p,editableAddress:c,onCancel:()=>o(!1),onSuccess:()=>o(!1),onSave:h,cancelText:r.translate("credit_card_form.go_back"),saveText:r.translate("edit_credit_card_modal.save_billing_address")})})]})}function Dr({identity:e,billingAddressInContext:t,billingAddressVariant:n,customerAccountBillingAddressSection:a,businessCustomerBillingAddressSection:r}){return"shopPay"===e.current.value&&"footer"===n?i(Br,{billingAddressInContext:t}
2):"inlineDirectMethod"!==n?null:"customerAccount"===e.current.value?a??null:"businessCustomer"===e.current.value?r??null:null}function Nr({experienceType:e}){const{managedByMarketsPro:n}=G(),{value:a}=k({deferClientOnlyWalletsUntilHydrated:!0}),r="bareCreditCardOnly"===e,{paymentLines:s,billingAddress:i,shippingAddress:l,billingAddressOption:d}=P(),{shop:o,shopPay:c,checkout:u}=w(),m=K({managedByMarketsPro:n.value}),p=lr(),y=u.installments.isSupported.value,h=!lt().value&&"shipping"===d.value&&u.isShippingRequired.value?l.value:i.value,v=function({identity:e,paymentLines:t,shop:n,isBareCardOnly:a}){return"shopPay"!==e.current.value||a?"inlineDirectMethod":!n.hasFlagEnabled(Y)&&W(t,"APPLE_PAY")?"none":"footer"}({identity:u.identity,paymentLines:s.value,shop:o,isBareCardOnly:r}),b=X(c.app.config),g=c.session.isInstallmentsSelected.value;return{displayedPaymentMethods:t(()=>cr(a??[],{identity:u.identity,installmentsSelected:y&&g,isApplePayAvailable:p.value,idealEnabled:m,isBareCardOnly:r,isShopAppLayout:b,shopAppVersion:c.app.config.version}),[a,u.identity,y,g,c.app.config.version,p.value,m,r,b]),renderAsBareCard:r,billingAddressVariant:v,selectedBillingAddress:h,isApplePayAvailable:p.value}}const Tr={2:28,3:17,4:11},Fr={2:18,3:13,4:18};function Or(e,t){const{renderFeatures:n}=e,a=n.tiles&&n.singleCreditCard?t:Vr({...e,renderFeatures:{...n,tiles:!0,singleCreditCard:!0}});return{tileEligible:"tiles"===a.mode,fallbackReason:a.fallbackReason,tileIneligibility:a.metadata.tileIneligibility}}function Vr({renderFeatures:e,displayedPaymentMethods:t,tileContainerSize:n,getTileMetadata:a}){const r=t.length,{choiceListPresentation:s}=e,i={displayedPaymentMethodCount:r,tileEligibilityChecked:!1,tileIneligibility:[]};if(0===r)return{mode:"choiceList",choiceListPresentation:s,fallbackReason:"no_displayed_payment_methods",metadata:i};if(e.knownBuyerSharedSelector)return{mode:"knownBuyerShared",choiceListPresentation:s,metadata:i};const[l]=t;if(1===r&&void 0!==l&&e.singleCreditCard&&ee(l))return d=l,Boolean(d.displayName?.trim())?{mode:"choiceList",choiceListPresentation:s,fallbackReason:"custom_payment_method_label",metadata:i}:{mode:"singlePaymentMethodCreditCard",choiceListPresentation:s,metadata:i};var d,o;if(e.tiles&&(2===(o=r)||3===o||4===o)){if(3===r&&(void 0===n||"compact-narrow"===n))return{mode:"choiceList",choiceListPresentation:s,fallbackReason:void 0===n?"tile_container_unmeasured":"tile_container_too_narrow",metadata:i};const e=function(e,t,n,a){const r=function(e,t){const n=Tr[e],a=Fr[e];return"compact-narrow"===t||"compact"===t?a:"wide"===t?n:Math.min(n,a)}(t,n);return e.flatMap(e=>{const t=te(e),n=ne(e),s=a(e);if(!s)return[{key:t,methodName:n,reasons:["missing_tile_metadata"]}];const i=function(e,t){const n=[];return 0===e.label.trim().length&&n.push("missing_label"),e.hasSubtitle&&n.push("subtitle_present"),e.label.length>t&&n.push("label_may_wrap"),e.iconCount<1&&n.push("missing_icon"),e.iconCount>1&&n.push("multiple_icons"),e.hasIncentiveBadge&&n.push("incentive_badge_present"),n}(s,r);return i.length>0?[{key:t,methodName:n,reasons:i}]:[]})}(t,r,n,a),l={displayedPaymentMethodCount:r,tileEligibilityChecked:!0,tileIneligibility:e};return 0===e.length?{mode:"tiles",choiceListPresentation:s,metadata:l}:{mode:"choiceList",choiceListPresentation:s,fallbackReason:"tile_ineligible_methods",metadata:l}}return{mode:"choiceList",choiceListPresentation:s,metadata:i}}function zr(e,{i18n:t,identitySource:n,isOnePageCheckout:a,isVenmoCheckout:r=!1,forceDebitCardLabel:s=!1,tileSupportedCustomOnsitePaymentMethods:i}){switch(e.type){case"direct":return{label:ae({identitySource:n,i18n:t},e,{forceDebitCardLabel:s}),iconBrand:"generic",iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1};case"wallet":return function(e,t,n){switch(e.name){case"PAYPAL_EXPRESS":return Rr(t,n);case"APPLE_PAY":return Hr(t.translate("brand.apple_pay"),"apple_pay");case"SHOP_PAY":case"SHOPIFY_INSTALLMENTS":return{...Hr(t.translate("payment_gateway.shop_pay.name"),"shop_pay"),hasSubtitle:"SHOPIFY_INSTALLMENTS"===e.name};default:return}}(e,t,r);case L.PayPal:return Rr(t,r);case"walletsPlatform":return function(e,t,n){if(e.name===re.AmazonPay)return n?void 0:Hr(t.translate("brand.amazon_pay"),"amazon_pay")}(e,t,a);case"local":return function(e,t){const n=D(t);return{label:e,iconBrand:n?t:null,iconCount:n?1:0,hasSubtitle:!1,hasIncentiveBadge:!1}}(e.displayName??"",e.name);case"offsite":return jr(e.name,e.paymentBrands);case"customOnsite":if(kt(e)||!i.has(e.paymentMethodIdentifier))return;return function(e,t){const n=jr(e,t);if(!n.iconBrand)return n;const a=n.iconBrand.replace(/[-_]/g," "),r=n.iconBrand.toUpperCase(),s=B(r),i=s===r?a:s;return{...n,accessibilityLabel:`${e}, ${i}`}}(e.name,e.paymentBrands);case"bank":return function(e){const t=e.availableInstruments[0]?.bankName;return t?{label:e.displayName??"",iconBrand:ir(t),iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1}:{label:e.displayName??"",iconBrand:null,iconCount:3,hasSubtitle:!1,hasIncentiveBadge:!1}}(e);case"paymentOnDelivery":case"manualPayment":case"customManualPayment":return $r(e.name);case"deferred":return $r(e.displayName??t.translate("payment_gateway.deferred_payment_label"));default:return}}function Rr(e,t){return t?Hr(e.translate("brand.venmo"),"venmo"):Hr(e.translate("brand.paypal"),"paypal")}function Hr(e,t){return{label:e,iconBrand:t,iconCount:1,hasSubtitle:!1,hasIncentiveBadge:!1}}function jr(e,t){const n=(t??[]).filter(D);return{label:e,iconBrand:n[0]??null,iconCount:n.length,hasSubtitle:!1,hasIncentiveBadge:!1}}function $r(e){return{label:e,iconBrand:null,iconCount:0,hasSubtitle:!1,hasIncentiveBadge:!1}}const Ur=new Set;function qr(e,t=Ur){const{showPaymentTiles:a,showSingleCreditCard:r}=Mt(),s=xt(),i=w(),{i18n:l,checkout:d}=i,o=function({shop:e,source:t,checkout:n},a){return!n.configuration.layout.isOnePage.value&&J({identitySource:n.identity.current.value,isOrderSession:Z(t),storeVaultEnabled:e.storeVaultEnabled,customerProfile:a.buyerIdentity.value?.customerProfile,hasCustomerStoredPaymentMethod:Q({availablePaymentMethods:a.paymentMethods.value??[],paymentMethodHistory:a.paymentMethodHistory?.value??[]})})}(i,G()),c=Et(),u=It(c),m=function({identity:e}){return e.current.value}({identity:d.identity});return n((n,i,d)=>function(e){const t=Vr(e);return{...t,eligibility:Or(e,t)}}({renderFeatures:{tiles:a,singleCreditCard:r,choiceListPresentation:s,knownBuyerSharedSelector:o},displayedPaymentMethods:e,tileContainerSize:n,getTileMetadata:e=>function(e,t){const n=zr(e,t);if(n)return{label:n.label,hasSubtitle:n.hasSubtitle,iconCount:n.iconCount,hasIncentiveBadge:n.hasIncentiveBadge}}(e,{i18n:l,identitySource:m,isOnePageCheckout:i,isVenmoCheckout:u,forceDebitC
2ardLabel:d,tileSupportedCustomOnsitePaymentMethods:t})}),[e,a,r,s,o,l,m,u,t])}function Yr(e,n,a=Ur){const r=qr(e,a),{checkout:s}=w(),i=s.configuration.layout.isOnePage,l=s.installments.paymentMethodMustSupportDebitCardOnly.value;return t(()=>r(n,i.value,l),[r,n,i.value,l])}function Wr({showHeading:e=!0}){const{i18n:t,checkout:{validation:n}}=w(),{purchaseOrderNumber:a}=P(),{poNumberError:r}=n,s=t.translate("payment.purchase_order_number.title");return i(Rn,{condition:e,accessibilityLabel:t.translate("payment.purchase_order_number.title"),padding:"none",children:i(Ze,{gap:"small-200",children:[e&&i(ft,{children:s}),i(Lt,{name:"poNumber",label:t.translate("payment.purchase_order_number.label"),value:a.value,onChange:e=>{a.value=e.trim()},prefix:"#",autocomplete:"off",maxLength:50,error:r.value})]})})}function Gr({forceVaultingEligible:t=!1,blockNegotiations:n=!1,borderless:a=!1}={}){const r=G(),s=se(),o=Bt(),c=d(void 0),{acceptPaymentVaulting:u,paymentLines:m}=P(),{i18n:p,shop:h}=w(),v=Dt(),b=e(()=>v.value||t);E(({reason:e})=>(n&&"negotiation"===e||"negotiation"!==e)&&b.value&&(r.paymentFlexibilityPaymentTermsTemplate.value&&!o.value||s.value)&&!u.value?{behavior:"block",reason:I.BlankVaultingAgreement,perform(){c.value=p.translate("field_errors.vaulting_agreement_blank")}}:"completion"!==e||b.value?{behavior:"allow"}:{behavior:"allow",perform(){c.value=""}});const g=e(()=>m.value.some(e=>"bank"===e.method.type)?p.translate("payment.business_customer_with_bank_account_vaulting_payment_label",{company:h.name}):r.buyerIdentity.value?.purchasingCompany?p.translate("payment.business_customer_vaulting_payment_label",{company:h.name}):p.translate("payment.vaulting_agreement_label",{company:h.name})),f=e(()=>b.value?u.value:void 0);return i(l,{children:i(Ze,{gap:"base",border:a?void 0:"base",borderRadius:a?void 0:"base",padding:a?void 0:"small-100",children:[i(y,{when:c,children:i(Nt,{tone:"critical",errorType:Tt.PaymentError,children:c})}),i(ht,{name:"vaulting_and_subscription_agreement",checked:f.value,onChange:e=>{!function(e){b.value&&(u.value=e),c.value=""}(e)},error:c.value?" ":void 0,label:g.value})]})})}function Kr(e){switch(e){case"singlePaymentMethodCreditCard":return"bare_card";case"tiles":return"tiles";case"choiceList":return"list";case"knownBuyerShared":return"known_buyer_shared";default:return s(e)}}function Xr(e){switch(e){case void 0:return"none";case"tile_ineligible_methods":return"ineligible_methods";case"tile_container_unmeasured":return"container_unmeasured";case"tile_container_too_narrow":return"container_too_narrow";case"no_displayed_payment_methods":return"no_methods";case"custom_payment_method_label":return"custom_label";default:return s(e)}}function Jr(e){const t=new Set,n=[];for(const{methodName:a,reasons:r}of e)for(const e of r)t.add(e),n.push(`tile_ineligible:${e}:${a}`);return[...Array.from(t,e=>`tile_ineligible_reason:${e}`),...n]}function Qr(e,t){return[...e,`selector_mode:${Kr(t.mode)}`,`fallback_reason:${Xr(t.eligibility.fallbackReason)}`,`tile_eligible:${t.eligibility.tileEligible}`,`method_count:${t.metadata.displayedPaymentMethodCount}`,...Jr(t.eligibility.tileIneligibility)]}function Zr({error:e}){const{i18n:n}=w(),a=t(()=>{switch(e){case"configuration":return n.translate("payment.not_configured_error");case"technical":return n.translate("payment.technical_error");case"no_methods":return n.translate("payment.no_method_error");case"script":return n.translate("payment.no_working_method_error")}},[e,n]);return i(st,{background:"subdued",borderRadius:"base",padding:"large-100",accessibilityRole:"script"===e?"alert":void 0,children:i(Ze,{gap:"small-200",alignItems:"center",children:[i(Ka,{children:i("img",{src:"/cdn/shopifycloud/checkout-web/assets/c1/assets/payment.BidoBI-H.svg",alt:""})}),i(Ct,{color:"subdued",textAlign:"center",children:a})]})})}const es=ie("PaymentMethodsContext");function ts({children:e,billingAddressInContext:n,errorBannerInContext:a,isInModal:r,selectedPaymentMethod:s,billingAddressVariant:l,cardNickname:d,onCardNicknameChange:o}){const c=t(()=>({billingAddressInContext:n,errorBannerInContext:a,isInModal:r,selectedPaymentMethod:s,billingAddressVariant:l??"inlineDirectMethod",cardNickname:d,onCardNicknameChange:o}),[n,a,r,s,l,d,o]);return i(es.Provider,{value:c,children:e})}function ns(){const{shop:t}=w(),{paymentMethods:n}=G(),{paymentLines:a}=P(),r=e(()=>Zn(n.value)),s=e(()=>ea({paymentLines:a.value,storeVaultGuestCvvVerificationEnabled:t.storeVaultGuestCvvVerificationEnabled}));return e(()=>ta({hasBogusGateway:r.value,hasAmexCvvOnlyField:s.value}))}function as({handle:e}){const{validate:t,sdk:a,errors:s,loading:i}=na(),{vaultCardWithSelectedNetwork:l,setSelectedNetwork:d,detectedNetworks:o,selectedNetwork:c}=Jn(),u=n(e=>a.setErrors(e),[a]);return r(()=>(e.value={validate:t,vaultCardWithSelectedNetwork:l,setSelectedNetwork:d,setFieldErrors:u,hasSDKError:Boolean(s.sdk),isSDKLoading:i,detectedNetworks:o,selectedNetwork:c},()=>{e.value=null}),[e,t,l,d,u,s.sdk,i,o,c]),null}const rs=new Set(["name","number","verification_value","expiry","expiry_month","expiry_year","issue_date","issue_number"]);function ss(e){return rs.has(e)}const is=["number","expiry","verification_value","name"];const ls={rollup:{blockPadding:"base",inlinePadding:"none"}};function ds({open:e,onClose:t,heading:n,cardForm:a,sdkAvailable:r=!0,billingAddressSection:s,afterBillingAddress:d,beforeCardForm:o,error:c,onSave:u,loading:m,disabled:p,blocking:y,externalContent:h,createAddressForm:v,size:b,accessibilityLabel:g,dataTestIdForScrollableContent:f,submitText:_}){const{i18n:C,shop:S}=w(),A=y?{blocking:!0,onHide:void 0}:{blocking:!1,onHide:t},P=v?.open??!1,k=i(Ft,{submitText:_??C.translate("payment.card_form.save"),cancelText:C.translate("payment.card_form.cancel"),loading:!!r&&m,disabled:!r||p||m,handleSubmit:u,handleCancel:t}),M=i(ut,{onSubmit:u,children:i(Ze,{gap:"base",children:[c&&i(st,{padding:"none none base none",children:i(Nt,{tone:"critical",errorType:Tt.PaymentError,children:c})}),o,a,r&&s,d]})}),x=S.hasFlagEnabled(ue)?i(wt,{theme:ls,children:M}):M;return i(l,{children:[h,i(Na,{dataTestIdForScrollableContent:f,open:e,accessibilityLabel:g,heading:n,size:b,primaryAction:P?void 0:k,...A,children:[i(st,{display:P?"none":"block",children:x}),P&&v?.content]}
2)]})}function os({hideAddressModal:e}){const{checkout:t}=w(),a=t.addressManager.billing.value,r=$a("billing"),{isMissingPhone:s}=Ua({addressType:"billing"}),{isMissingFirstName:l}=qa({addressType:"billing"}),d=s||l,o=n(e=>r.selectAddress(e.id),[r]);return i(Ra,{addressType:"billing",addresses:a.addresses.value,immutableAddresses:a.immutableAddresses.value,immutableAddressSections:a.immutableAddressSections.value,addressesTitle:a.addressesTitle,selectedAddress:a.selectedAddress.value,onSelectAddress:o,onCreateAddress:r.createAddress,onUpdateAddress:r.updateAddress,onDeleteAddress:r.deleteAddress,getAddressDisplayName:a.getAddressDisplayName,addressErrorsSignal:a.errors.fields,canCreateAddress:a.canCreateAddress.value,canUpdateAddress:a.canUpdateAddress.value,canDeleteAddress:a.canDeleteAddress.value,canSetDefaultAddress:a.canSetDefaultAddress.value,onSetDefault:a.setDefaultAddress,errorBannerMessage:a.errors.banner,hideAddressModal:e,selectedAddressDetails:d?i(za,{addressType:"billing"}):void 0})}function cs({hideAddressModal:e}){const{checkout:t}=w(),{isLoading:n,isValid:a}=t.addressManager.billing.value.suggestedAddress.value;return a||n?i(os,{hideAddressModal:e}):i(ka,{})}function us({hideAddressModal:e=!1}={}){const{checkout:t}=w();return"shopPay"!==(n=t.identity.current.value)&&"businessCustomer"!==n||t.addressManager.billing.value.isMissingValidSuggestedAddress.value?i(ka,{}):"shopPay"===t.identity.current.value?i(os,{hideAddressModal:e}):i(cs,{hideAddressModal:e});var n}async function ms({validateCardFields:e,vaultCard:t,paymentMethodIdentifier:n,getDue:a,parts:r,newCard:s,buyerHasActedSignal:i,negotiate:l,setLoading:d,beforeSubmit:o,openBilling:c,close:u,onAddressError:m,fixSubscriptionRedeemablePaymentAmount:p=!1}){i.value=!0,d(!0),await(o?.());const{isValid:y}=e();if(!y)return void d(!1);let h;try{h=await t()}catch{return void d(!1)}const v=r.paymentLines.value;if(h){const e={type:"direct",sessionId:h,paymentMethodIdentifier:n},t=v.filter(e=>"giftCard"===e.method.type||p&&"redeemable"===e.method.type),s=a();r.paymentLines.value=[{method:e},...s?[{method:e,due:s}]:[],...t]}const b=()=>{r.paymentLines.value=v};l({fieldsToResolve:["paymentMethods"],onComplete(e){switch(d(!1),e.status){case"success":case"error":{const t=function(e){if("success"===e.status||"error"===e.status){if(e.violations.some(e=>me.has(e.code)))return"address";if(0!==e.errors.length){for(const t of e.errors){if(me.has(t.code))return"address";if(pe.has(t.code))return"card"}return"other"}}}(e);if("address"===t)return b(),c(),void m(e.violations);if("card"===t)return void b();if("other"===t)return void u();if("success"===e.status){const t=function(e){return e.negotiated.paymentLines?.lines?.find(e=>"direct"===e.method.type)}(e);t&&(s.value=t.method),u()}break}case"invalid":if(e.reasons.includes(I.BlankVaultingAgreement))return void b();u();break;default:u()}}})}function ps({open:e,onToggle:t}){const{i18n:n,checkout:a}=w(),{billingAddress:r}=P(),s=Ot(r.value),l=a.addressManager.billing.value.isMissingValidSuggestedAddress.value;return i(ja,{id:"billingAddress",label:n.translate("payment.billing_address_title"),open:e||l,onToggle:l?void 0:t,primaryContent:l?void 0:s,children:i(Ze,{gap:"base",children:[i(Vt,{section:"payment"}),i(us,{hideAddressModal:!0})]})})}const ys={rollup:{inlinePadding:"none"}};function hs({addresses:e,selectedAddress:t,onSelectAddress:n,onAddAddress:a,canCreateAddress:r,canUpdateAddress:s,onUpdateAddress:l,open:d,onToggle:o,id:c,label:u,summary:m,errorAddress:p,onEditErrorAddress:y}){const{i18n:h}=w(),{nameLine:v,primary:b,secondary:g}=Pt({address:t?.address??{},nameLinePosition:"block"}),f=t?v:void 0,_=t?i(Ze,{children:[b&&i(nt,{children:b}),g&&i(nt,{children:g})]}):i(Ct,{children:h.translate("billing.address_form.add_address")}),C=p?.value,S=d||Boolean(C);return i(wt,{theme:ys,children:i(ja,{id:c??"billingAddress",label:u??h.translate("payment.billing_address_title"),open:S,onToggle:()=>o(S),primaryContent:m??f,secondaryContent:m?void 0:_,children:[C&&y&&i(st,{padding:"none none base none",children:i(vs,{onEdit:y})}),i(Ra,{addressType:"billing",noticesSection:"payment",addresses:e,selectedAddress:t,onSelectAddress:n,canUpdateAddress:s,onUpdateAddress:l,showNotices:!1,hideAddressModal:!0}),r&&i(et,{className:"H5k1u",inlineSize:"100%",padding:"base",onClick:a,children:i(Ze,{direction:"inline",gap:"small-100",alignItems:"center",children:[i(_t,{type:"plus",size:"base"}),i(nt,{children:h.translate("billing.add_address")})]})})]})})}function vs({onEdit:e}){const{i18n:t}=w();return i(Nt,{errorType:Tt.PaymentError,tone:"critical",children:i(nt,{children:t.translate("address_management.invali
2d_billing_address_selected_with_update_link",{update_address_link:i(zt,{tone:"monochrome",onClick:e,children:t.translate("address_management.billing_address_update")})})})})}function bs({open:e,onToggle:t,onAddAddress:a,errorAddress:r,onEditErrorAddress:s}){const{checkout:l}=w(),d=l.addressManager.billing,o=d.value,c=n(e=>{r.value=void 0,d.value.selectAddress(e.id)},[d,r]);return i(hs,{addresses:o.addresses.value,selectedAddress:o.selectedAddress.value,onSelectAddress:c,onAddAddress:a,canCreateAddress:o.canCreateAddress.value,canUpdateAddress:o.canUpdateAddress.value,onUpdateAddress:e=>o.updateAddress(e),open:e,onToggle:t,errorAddress:r,onEditErrorAddress:s})}const gs={CardFieldWrapper:"cRSsz",isDisabled:"WUohw","CardFieldWrapper-borderNone":"cssC4",isFocused:"bl714",hasError:"GLY0v","CardFieldWrapper-borderFull":"J1Wf0","CardFieldWrapper-borderBlockEnd":"_7rHVa"},fs=h(({hidden:e,border:t,error:n,focused:a,loading:r,children:s},l)=>{const d=Rt();return i("div",{"data-protected-input":!0,ref:l,hidden:e,className:v(gs.CardFieldWrapper,ye({focusRing:"resting",colorLayer:n?"controlInvalid":"control"}),t&&gs[b("CardFieldWrapper-border",t)],{[gs.hasError]:Boolean(n),[gs.isFocused]:a&&!d,[gs.isDisabled]:d}),"aria-busy":r||void 0,"aria-disabled":d||void 0,children:s})}),_s="kyKRO";function Cs({ready:e}){const[t,n]=a(!0);return r(()=>{e||n(!0)},[e]),t?i("div",{className:v("NM5yz",{[_s]:e}),onTransitionEnd:()=>n(!1),children:i("div",{className:"GcTEr"})}):null}function Ss({placeholder:e,label:t,name:n,initialValue:s,onChange:i,themeStyles:l,themeStylesVersion:d,onBlur:o=()=>{},empty:c}){const{filled:u,focusedField:m,sdk:p,loading:y}=na(),h=Ht(),v=jt(),b=$t(),[g,f]=a(m===n),_="string"==typeof s&&s.trim().length>0,C=Ut(),S=e??t;return r(function(){if(m===n){b("payment"),f(!0);const e=C.value.currentFocus.value;C.value.currentFocus.value="payment","payment"!==e&&(h("sectionInteraction",{section:"payment",timestamp:new Date}),v({type:"section_interaction",section:"payment"}))}else g&&(o(),b("payment"),h("change",{element:{tagName:"INPUT",type:"text",label:n},section:"payment",timestamp:new Date}),f(!1))},[h,b,C,m,g,t,n,o,p,v]),r(function(){u[n]?(i(!1),p.setPlaceholderContent(n,""),b("payment")):i(!0)},[u,n,i,p,b]),r(function(){p.setTranslation(n,t)},[n,t,p]),r(function(){c?(p.setPlaceholderContent(n,S),p.setStyles({field:n,styles:{padding:l.padding.default}})):(p.setPlaceholderContent(n,""),p.setStyles({field:n,styles:{padding:l.padding.floating}}))},[c,S,n,l,d,p,y]),{hasInitialValue:_,isFilled:u[n]}}const As="--accessory-width",Ps="_211UF";function ws({accessory:e,border:t,error:n,focused:a,hidden:s,label:l,loading:d,name:c,placeholder:u,onChange:m,empty:p,themeStyles:y,themeStylesVersion:h}){const{i18n:b}=w(),{sdk:g}=na(),f=u??l,_=qt({active:Boolean(n)}),{wrapperRef:C,accessoryRef:S}=function(e){const t=o(null),n=o(null);return r(()=>{const a=t.current,r=n.current,s=()=>{a?.style.removeProperty(As)};if(!e||!a||!r)return void s();const i=()=>{a.style.setProperty(As,`${r.offsetWidth+26}px`)};if(i(),"undefined"==typeof ResizeObserver)return s;const l=new ResizeObserver(i);return l.observe(r),()=>{l.disconnect(),s()}},[e]),{wrapperRef:t,accessoryRef:n}}(Boolean(e));return Ss({placeholder:u,label:l,name:c,themeStyles:y,themeStylesVersion:h,onChange:m,empty:p}),i(fs,{ref:C,hidden:s,border:t,loading:d,error:n,focused:a,children:[i("div",{ref:_,className:v("DCpNs",{[Ps]:Boolean(e)}),id:c,"data-card-fields":c,"data-card-field-placeholder":f,"data-card-field-prefix":b.translate("payment.card_fields_container_prefix"),tabIndex:-1,onFocus:()=>{g.setFocus(c)}}),e&&i("div",{ref:S,className:"_4VRZE",children:e}),i(Cs,{ready:!d})]})}const ks="_3fIVg";function Ms(e){const{error:t,label:r,name:s,initialValue:l}=e,{control:{border:d,labelPosition:o="inside"},textField:{border:c}}=Yt(),u=c||d||"full",[m,p]=a(!l),y=n(e=>p(e),[]),h={...e,border:u,onChange:y,empty:m};return i("div",{className:v("Uq6Ln",Xt["outside"===o?"labelOutside":"labelInside"],"inside"===o&&ye({colorLayer:t?"controlInvalid":"control"})),children:["outside"===o&&i(Wt,{variant:"outside",htmlFor:s,label:r}),i("div",{className:v("W16eS","inside"===o&&!m&&Gt.floating),children:["inside"===o&&i(Wt,{variant:"inside",htmlFor:s,label:r}),"name"===s?i(xs,{...h,initialValue:l}):i(ws,{...h})]}),t&&i(Kt,{controlID:s,children:t})]})}function xs({name:e,label:t,placeholder:r,error:s,loading:l,focused:d,hidden:o,border:c,initialValue:u,allowClear:m,onChange:p,empty:y,themeStyles:h,themeStylesVersion:b}){const{i18n:f}=w(),{setFilled:_,filled:C,sdk:S,touched:A}=na(),P=r??t,[k,M]=g(()=>!0,!1),[x,E]=g((t,n)=>{switch(n.type){case"buyerModifiedField":return!k&&A.name&&M(),{status:"modified"};case"setInitialValue":return"modified"===t.status?t:n.value&&n.value.trim().length>0?(T(),{status:"prefilled",value:n.value}):{status:"empty"};case"prefillValueChanged":return"modified"===t.status?t:n.value&&n.value.trim().length>0?(F(n.value),{status:"prefilled",value:n.value}):(O(),{status:"empty"});case"clearField":return M(),O(),S.setFocus(e),{status:"modified"}}},{status:"empty"}),I=n(()=>{E({type:"buyerModifiedField"})},[]),L=qt({active:Boolean(s)}),B=n(e=>{d&&!e&&E({type:"buyerModifiedField"}),p(e)},[p,d]),{hasInitialValue:D,isFilled:N}=Ss({placeholder:r,label:t,name:e,initialValue:u,themeStyles:h,themeStylesVersion:b,onChange:B,onBlur:I,empty:y}),T=n(()=>{_("name"),p(!1),S.setPlaceholderContent(e,""),S.setStyles({field:e,styles:{padding:h.padding.floating}})},[e,S,h,_,p]),F=n(e=>{S.setValue("name",e),S.setErrors({name:null}),T()},[S,T]),O=n(()=>{p(!0),S.clearField(e),S.setPlaceholderContent(e,P),S.setStyles({field:e,styles:{padding:h.padding.default}})},[p,S,P,e,h]),[V,z]=a(u);u!==V&&(E({type:"prefillValueChanged",value:u}),z(u)),"empty"===x.status&&D&&!C[e]&&E({type:"setInitialValue",value:u});const R=n(()=>{E({type:"clearField"})},[]),H=N&&m&&!k;return i(fs,{hidden:o,border:c,loading:l,error:s,focused:d,children:[i("div",{className:v("KAqU2",{[ks]:H}),id:e,"data-card-fields":e,"data-card-field-placeholder":P,"data-card-field-prefix":f.translate("payment.card_fields_container_prefix"),"data-card-field-name-initial-value":u,ref:L,tabIndex:-1,onFocus:()=>{S.setFocus(e)}}),H&&i(Es,{onPress:R}),i(Cs,{ready:!l})]})}function Es({onPress:e}){const{i18n:t}=w();return i("div",{className:"lxxqW",children:i("div",{className:"z8T28",children:i(zt,{accessibilityLabel:t.translate("payment.clear"),onClick:e,children:i(_t,{type:"x"})})})})}function Is({icon:e,children:t,controlLabel:n}){return i(et,{overlay:i(at,{children:t}),accessibilityLabel:n,children:i(_t,{type:e||"question"})})}const Ls="1.1rem",Bs={padding:{default:ra(`1.35rem ${Ls}`),floating:ra(`2.05rem ${Ls} 0.55rem`)}};function Ds({errorMessageRef:e,fieldName:t,errorMessage:n,targetPath:a,shouldLog:s=!1}){const i=o(Jt()),{observability:l}=w();r(()=>{if(n&&n!==e&&(i.current({errorType:Tt.InputInvalid,value:"<redacted>",target:a,message:n,timestamp:new Date}
2),s)){const e={[t]:n};l.log("hosted_fields_payment_blocked","[Hosted Fields] Payment blocked due to validation errors",{cardFieldErrorLogs:e,origin:"inline"})}},[n,e,t,s,a,l])}function Ns(e){return e.replace(/^var\(|\)$/g,"")}const Ts={background:Ns(be.color.default.control.background),text:Ns(be.color.default.control.text),textSubdued:Ns(be.color.default.control.textSubdued)},Fs={base:"base",loose:"loose",xloose:"xLoose"},Os=new Map([["title","capitalize"],["upper","uppercase"],["lower","lowercase"],["none","none"]]);function Vs({cardBrands:e,prefillCardholderName:s=!1,customHostedFields:d,cvvOnly:c=!1,isSelected:u,paymentMethodIdentifier:m,cardNumberAccessory:p}){const y=Qt(),{client:h,i18n:b,checkout:g,observability:_,shop:C,webMcp:S}=w(),A=h.enableAgenticCardEntry.value&&Boolean(S)&&C.hasFlagEnabled(he),k=p??i(_t,{type:"lock"}),M=g.latestReceipt.value,x=M?.id;let E=!1;if(M&&Zt(M)){const e=M.failure;en(e)&&(E=!0)}const I=["ja","ja-jp"].includes(b.locale.toLowerCase()),L=s&&!I?y.value:void 0,B=o(null),{themeStyles:D,themeStylesVersion:N,updateThemeStyles:T}=function(){const{control:{labelPosition:e="inside"},textField:s}=Yt(),i=o(),l=o(Bs),d=o(!1),[c,u]=a(0),m=t(()=>({padding:{get default(){return l.current.padding.default},get floating(){return l.current.padding.floating}}}),[]),p=n(e=>{if(null===e)return;e&&(i.current=e);const t=i.current;if(!t)return;const n=getComputedStyle(t),a=n.getPropertyValue("--empty-padding-block").trim(),r=n.getPropertyValue("--filled-padding-block-start").trim(),s=n.getPropertyValue("--filled-padding-block-end").trim(),o=n.getPropertyValue("--padding-inline").trim();if(!(a&&r&&s&&o))return;const c={padding:{default:ra(`${a} ${o}`),floating:ra(`${r} ${o} ${s}`)}},m=c.padding.default!==l.current.padding.default||c.padding.floating!==l.current.padding.floating,p=d.current;d.current=!0,m&&(l.current=c,p&&u(e=>e+1))},[]);return r(()=>{const e=setTimeout(()=>p(),0);return()=>clearTimeout(e)},[e,s.typography?.size,p]),{themeStyles:m,themeStylesVersion:c,updateThemeStyles:p}}(),F=e.includes("MAESTRO"),{loading:O,focusedField:V,cardBrand:z,sdk:R,errors:H,subscribe:j,unsubscribe:$,emptyFields:U,resetTouched:q}=na(),Y=z?aa(z):void 0,W=F&&"MAESTRO"===Y,G=Xa(),K=o({}),{negotiated:X}=g.proposal,J=h.unstable_getSerialization("shopifyIdentificationSignature"),Q=X.fields.checkoutCardsinkCallerIdentificationSignature?.value??J,{control:{labelPosition:Z="inside"},global:ee,textField:{typography:te},typographyPrimary:ne,typographySecondary:ae}=Yt(),re=tn().customProperties.value,se={extraSmall:re.fontSize?.extraSmall??nn.fontSize.extraSmall,small:re.fontSize?.small??nn.fontSize.small,base:re.fontSize?.base??nn.fontSize.base,medium:re.fontSize?.medium??nn.fontSize.medium,large:re.fontSize?.large??nn.fontSize.large,extraLarge:re.fontSize?.extraLarge??nn.fontSize.extraLarge,extraExtraLarge:re.fontSize?.extraExtraLarge??nn.fontSize.extraExtraLarge},ie=P().paymentLines.value,le=te?.fonts,de=le?{primary:ne.fonts,secondary:ae.fonts}[le]:ne.fonts,oe=ve(de)??nn.fontFamily.base,ce=B.current&&getComputedStyle(B.current),ue=ce?.getPropertyValue(Ts.text),me=ce?.getPropertyValue(Ts.textSubdued),pe=ce?.getPropertyValue(Ts.background),ye=pe??nn.color.global.controlBackground,be=ue??nn.color.global.controlText,ge=me??nn.color.global.controlTextSubdued,fe=ra(se[te?.size??"base"]),_e=nn.lineHeight.base,Ce=nn.letterSpacing[Fs[te?.kerning??"base"]],Se=te?.decoration??"none",Ae=te?.letterCase??ee.typographyLetterCase,Pe=Ae?Os.get(Ae):Os.get("none"),we=t(()=>({"background-color":ye,"placeholder-lightness":"22","placeholder-color":ge,"font-family":oe,"font-size":fe,"letter-spacing":Ce,"line-height":_e,color:be,"text-decoration":Se,"text-transform":Pe}),[ye,oe,fe,Ce,_e,be,ge,Se,Pe]),ke=t(()=>({transition:"padding .2s ease-out"}),[]),Me=v("CsSsR",Xt["outside"===Z?"labelOutside":"labelInside"]),xe=n(e=>{B.current=e,T(e)},[T]),Ee=t(()=>{const e=[];return ne?.sourceBase&&ne?.fonts&&e.push({name:ne.fonts,source:ne.sourceBase}),ae?.sourceBase&&ae?.fonts&&e.push({name:ae.fonts,source:ae.sourceBase}),e},[ne,ae]),Ie=t(()=>["name","number","expiry","verification_value","issue_date","issue_number"],[]),Le=n(()=>
2{q(),Ie.forEach(e=>{R.clearField(e)}),R.setErrors({})},[q,R,Ie]);r(()=>{x&&E&&Le()},[x,E,Le]),f(()=>{let e,t=!1;function n(n){!t&&e&&(t=!0,_.histogram({name:"hosted_fields_loading_duration",value:performance.now()-e,attributes:{isTimeout:n}}))}let a,r=!1;function s(){r=!0}return window.addEventListener("blur",s,{once:!0}),async function(){B.current&&(j(),await R.setup(B.current,{agenticCardEntry:A,callerIdentificationSignature:Q,locale:b.locale,styles:{...we},translations:{name:b.translate("payment.name_on_card_placeholder"),number:b.translate("payment.card_number_placeholder"),expiry:b.translate("payment.card_expiry_placeholder"),verification_value:b.translate("payment.card_verification_value_placeholder"),issue_date:b.translate("payment.card_start_placeholder"),issue_number:b.translate("payment.card_issue_number_placeholder")},fonts:{local:Ee},errorMessages:{name:b.translate("field_errors.credit_card_name_invalid"),number:b.translate("field_errors.credit_card_number_invalid"),number_blank:b.translate("field_errors.credit_card_number_blank"),expiry:b.translate("field_errors.credit_card_expiry_invalid"),verification_value:b.translate("field_errors.credit_card_verification_value_blank"),issue_date:b.translate("payment.card_fields.errors.required.issue_date"),issue_number:b.translate("payment.card_fields.errors.required.issue_number")},validationSetting:"mixed"},()=>{e=performance.now(),a=setTimeout(()=>{n(!0),_.counter({name:"hosted_fields_timeout",value:1,attributes:{buyerLeftBrowsingContext:r}}),_.log("hosted_fields_loading_timed_out","[HostedFields] Hosted fields timed out while loading.")},25e3)}),clearTimeout(a),n(!1))}(),()=>{window.removeEventListener("blur",s),clearTimeout(a)}},[B,j,R,A,Q,we,b,Ee,_]),r(()=>()=>{$(),U(),R.teardown()},[$,U,R]),r(()=>{O||(R.setStyles({styles:{...ke,...we}}),Ee.length&&R.loadFonts({local:Ee}))},[O,ke,we,R,Ee]),r(()=>{const e=G?.paymentMethodIdentifier;if(e!==m)return;const t={name:!G.name||d&&!d.includes("name")?null:b.translate("field_errors.credit_card_name_invalid"),number:(n=G,n?.number?"server"===n.number.origin?b.translate("field_errors.credit_card_number_invalid"):n.number.message:null),expiry:!G.expiry||d&&!d.includes("expiry")?null:b.translate("field_errors.credit_card_expiry_invalid"),verification_value:!G.verificationValue||d&&!d.includes("verification_value")?null:b.translate("field_errors.credit_card_verification_value_blank"),issue_date:!G.issueDate||d&&!d.includes("issue_date")?null:b.translate("payment.card_fields.errors.required.issue_date"),issue_number:!G.issueNumber||d&&!d.includes("issue_number")?null:b.translate("payment.card_fields.errors.required.issue_number")};var n;R.setErrors(t)},[R,b,G,m,d]),r(()=>{const{number:e,name:t,expiry:n,verificationValue:a}=G;if(G?.number||G?.name||G?.expiry||G?.verificationValue){const r={number:e?.message,name:t?.message,expiry:n?.message,verification_value:a?.message};_.log("hosted_fields_payment_blocked","[Hosted Fields] Payment blocked due to validation errors",{cardFieldErrorLogs:r,origin:"progression"})}},[G,_]),Ds({errorMessageRef:K.current.number,fieldName:"number",errorMessage:H.number,targetPath:"cart.paymentLines[0].card.number",shouldLog:!0}),Ds({errorMessageRef:K.current.expiry,fieldName:"expiry",errorMessage:H.expiry,targetPath:"cart.paymentLines[0].card.expiry",shouldLog:!0}),Ds({errorMessageRef:K.current.verification_value,fieldName:"verification_value",errorMessage:H.verification_value,targetPath:"cart.paymentLines[0].card.verificationValue",shouldLog:!0}),Ds({errorMessageRef:K.current.name,fieldName:"name",errorMessage:H.name,targetPath:"cart.paymentLines[0].card.name",shouldLog:!0}),Ds({errorMessageRef:K.current.issue_number,fieldName:"issue_number",errorMessage:H.issue_number,targetPath:"cart.paymentLines[0].card.issueNumber"}),Ds({errorMessageRef:K.current.issue_date,fieldName:"issue_date",errorMessage:H.issue_date,targetPath:"cart.paymentLines[0].card.issueDate"});const Be=ie.some(e=>"direct"===e.method.type);Je({active:(null==u?Be:u)&&(O||Boolean(H.sdk))});const De=e=>!!d&&!d.includes(e),Ne=i("div",{hidden:De("expiry"),children:i(Ms,{name:"expiry",label:b.translate("payment.card_expiry_label"),placeholder:b.translate("payment.card_expiry_placeholder"),loading:O,focused:"expiry"===V,error:H.expiry,hidden:De("expiry"),themeStyles:D,themeStylesVersion:N})}),Te=i("div",{hidden:De("issue_date"),children:i(Ms,{name:"issue_date",label:b.translate("payment.card_start_label"),placeholder:b.translate("payment.card_start_placeholder"),hidden:!W||De("issue_date"),error:H.issue_date,themeStyles:D,themeStylesVersion:N})}),Fe=i("div",{hidden:De("issue_number"),children:i(Ms,{name:"issue_number",label:b.translate("payment.card_issue_number_label"),placeholder:b.translate("payment.card_issue_number_placeholder"),hidden:!W||De("issue_number"),error:H.issue_number,themeStyles:D,themeStylesVersion:N})}),Oe=i("div",{hidden:De("verification_value"),children:i(Ms,{name:"verification_value",label:b.translate("payment.card_verification_value_label"),placeholder:b.translate("payment.card_verification_value_placeholder"),loading:O,focused:"verification_value"===V,error:H.verification_value,accessory:i(Is,{control
2Label:b.translate("tooltip.accessibility_label_context",{context:b.translate("payment.card_verification_value_label")}),children:Y?"AMEX"===Y?b.translate("payment.card_verification_value_explanation_amex"):b.translate("payment.card_verification_value_explanation_other"):b.translate("payment.card_verification_value_explanation")}),hidden:De("verification_value"),themeStyles:D,themeStylesVersion:N})});if(c)return i("div",{ref:xe,className:Me,children:[Oe,i(Ms,{name:"name",hidden:!0,label:b.translate("payment.name_on_card_label"),themeStyles:D,themeStylesVersion:N}),i(Ms,{name:"number",hidden:!0,label:b.translate("payment.card_number_label"),themeStyles:D,themeStylesVersion:N}),i(Ms,{name:"expiry",hidden:!0,label:b.translate("payment.card_expiry_label"),themeStyles:D,themeStylesVersion:N}),i(Ms,{name:"issue_date",hidden:!0,label:b.translate("payment.card_start_label"),themeStyles:D,themeStylesVersion:N}),i(Ms,{name:"issue_number",hidden:!0,label:b.translate("payment.card_issue_number_label"),themeStyles:D,themeStylesVersion:N})]});const Ve=d&&d.filter(e=>"expiry"===e||"verification_value"===e).length<=1,ze=d&&d.filter(e=>"issue_date"===e||"issue_number"===e).length<=1;return i("div",{ref:xe,className:Me,children:i(Ea,{children:[i(Ms,{name:"number",label:b.translate("payment.card_number_label"),placeholder:b.translate("payment.card_number_placeholder"),loading:O,focused:"number"===V,error:H.number,accessory:k,themeStyles:D,themeStylesVersion:N}),i(Ve?l:Ia,{children:[Ne,Oe]}),i("div",{hidden:!W,children:i(ze?l:Ia,{children:[Te,Fe]})}),i("div",{hidden:De("name"),children:i(Ms,{name:"name",label:b.translate("payment.name_on_card_label"),placeholder:b.translate("payment.name_on_card_placeholder"),loading:O,focused:"name"===V,error:H.name,initialValue:L,allowClear:s,hidden:De("name"),themeStyles:D,themeStylesVersion:N})})]})})}function zs({open:e}={}){const{i18n:t}=w(),{selectedNetwork:n}=Jn();return i(vt,{id:"network-selection-info-banner",duration:"fast",open:e??Boolean(n),children:i(nt,{size:"small",color:"subdued",children:t.translate("payment.network_card_persistence_description")})})}function Rs(){const{i18n:e}=w();return i(sn,{children:i(Ze,{gap:"small-300",children:[i(ft,{level:3,children:e.translate("payment.bogus_test_checkout.title")}),i(Ze,{gap:"small-400",children:[i(Ct,{children:e.translate("payment.bogus_test_checkout.intro")}),i(an,{gap:"small-400",children:[i(rn,{children:e.translate("payment.bogus_test_checkout.approved_transaction",{card_number:i(nt,{type:"strong",children:"1"})})}),i(rn,{children:e.translate("payment.bogus_test_checkout.declined_transaction",{card_number:i(nt,{type:"strong",children:"2"})})}),i(rn,{children:e.translate("payment.bogus_test_checkout.gateway_failure",{card_number:i(nt,{type:"strong",children:"3"})})})]}),i(Ct,{children:e.translate("payment.bogus_test_checkout.additional_instructions")})]}),i(nt,{color:"subdued",children:i(zt,{href:"https://help.shopify.com/en/manual/checkout-settings/test-orders/payments-test-mode#test-payment-gateway",target:"_blank",tone:"monochrome",children:e.translate("payment.bogus_test_checkout.support_link")})})]})})}function Hs(){const{i18n:t,checkout:n}=w(),a=function(){const{checkout:t}=w(),{buyerIdentity:n,paymentMethods:a}=G(),{paymentLines:r}=P();return e(()=>{const e=t.addressManager.billing.value.suggestedAddress,s=n.value?.purchasingCompany,i=Boolean(ge(a.value).length),l=e.value.type,d=r.value.some(({method:e})=>"direct"===e.type);return s?i||!d?null:l?"selector":"form":null})}(),r=n.addressManager.billing.value,s=r.suggestedAddress.value,d=s.address,o=s.type,c=P().shippingAddress.value;yt();const u=r.selectedAddress.value?.id===nr,m=Ot(d),p="billing-fact"===o?t.translate("payment.use_order_billing_address_label"):"billing"===o?t.translate("payment.use_location_billing_address_label"):"shipping"===o?t.translate("payment.use_location_shipping_address_label"):void 0;return i(st,{children:[i(y,{when:()=>"selector"===a.value,children:i(ht,{id:"billingAddress",name:"billingAddress",checked:u,onChange:e=>{e&&d&&o?r.selectAddress(nr):function(){const e=$({countryCode:c.countryCode});r.addresses.value.some(e=>e.id===ar)?r.updateAddress({id:ar,address:e}):r.createAddress({address:e})}()},label:i(l,{children:[p,i(Ct,{color:"subdued",children:m})]})})}
2),i(y,{when:a,children:i(vt,{id:"billingAddressDetails",open:null===o||!u,children:[i(bt,{blockSize:"large-300"}),i(ft,{level:2,children:t.translate("payment.billing_address_title")}),i(bt,{blockSize:"base"}),i(ka,{})]})})]})}const js=e=>i("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",...e,children:i("g",{fillRule:"evenodd",children:[i("path",{d:"M30 60C13.43 60 0 46.57 0 30S13.43 0 30 0s30 13.43 30 30-13.43 30-30 30m0-2c15.464 0 28-12.536 28-28S45.464 2 30 2 2 14.536 2 30s12.536 28 28 28"}),i("path",{fillRule:"nonzero",d:"M30.134 48.856a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 0 0 5"}),i("rect",{width:2,height:27,x:29,y:11,rx:1})]})});function $s(){const{errors:e,sdkLoadDiagnostics:t}=na(),{router:n,i18n:a,observability:s}=w();return r(()=>{if(e.sdk){const n=t?.errorCause;s.counter({name:"card_fields_sdk_load_error",value:1,attributes:{error:e.sdk,..."string"==typeof n?{error_cause:n}:{}}}),s.log("card_fields_sdk_load_failed","[CardFieldsSDKLoadError] An error occurred when attempting to load the Card Fields SDK.",{cause:e.sdk,...t?{diagnostics:t}:{}})}},[e.sdk,s,t]),i("div",{className:"e3sCv",children:[i(js,{className:"hevoz"}),i(Ze,{gap:"small-200",children:i(Ct,{children:i(ln,{children:a.translate("payment.card_fields_unavailable_html",{count:1,current_url:n.currentUrl.value.toString()})})})})]})}const Us=e=>i("svg",{xmlns:"http://www.w3.org/2000/svg",width:102,height:52,viewBox:"-270.8 371 102 52",...e,children:[i("path",{fill:"none",stroke:"inherit",strokeMiterlimit:10,strokeWidth:2,d:"M-182 404v16.8c0 .7-.4 1.2-1 1.2h-75.7c-.7 0-1.2-.6-1.2-1.2v-47.6c0-.7.6-1.2 1.2-1.2h75.7c.7 0 1 .6 1 1.2V395m-78-14h78m-17 18h27m-3.9-4.6 4.5 4.6-4.5 4.6"}),i("circle",{cx:-255.5,cy:376.5,r:1.5,fill:"inherit"}),i("circle",{cx:-250.5,cy:376.5,r:1.5,fill:"inherit"}),i("circle",{cx:-245.5,cy:376.5,r:1.5,fill:"inherit"})]});function qs(){const{i18n:e}=w();return i("div",{className:"_2wkMu",children:i(Ze,{gap:"large-200",children:[i(Us,{className:"H55oQ"}),i(Ct,{children:e.translate("payment.no_js_credit_card_fields_redirect_hint")})]})})}function Ys({id:e,brand:t,displayLastDigits:n,details:a,onEdit:r,onDelete:s,requiresVerification:l}){const{i18n:d}=w(),{closeOverlay:o}=dn(),c=B(t),u=`${d.translate("payment.masked_digits_label",{last_digits:n})}`,m=`⢠${n}`,p=()=>{s&&s(e),o("actions-overlay")};return i(Ze,{gap:"small-500",children:[i(tt,{gridAutoFlow:"column",gridTemplateColumns:"minmax(auto, max-content) minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"small-300",alignItems:"center",alignContent:"center",children:[i(er,{type:t}),i(Ct,{children:i(nt,{type:"strong",children:[c," ",i("span",{className:"_1yB1O",children:l?m:u})]})}),i(tt,{gridAutoFlow:"column",gridAutoColumns:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",children:[!r&&s?i(et,{onClick:p,accessibilityLabel:d.translate("payment.delete_credit_card_modal.title"),children:i(_t,{type:"delete",size:"small"})}):null,l?i(_t,{type:"alert-triangle",size:"small"}):null,r?i(et,{overlay:i(sr,{connector:"none",offset:10,id:"actions-overlay",children:i(tt,{gridAutoRows:"minmax(0, 1fr)",gridAutoColumns:"minmax(0, 1fr)",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",justifyContent:"start",justifyItems:"start",children:[r&&i(zt,{textDecoration:"none",onClick:()=>{r(),o("actions-overlay")},children:d.translate("payment.saved_credit_card_actions.edit")}),s&&i(St,{variant:"plain",textDecoration:"none",tone:"critical",onClick:p,children:d.translate("payment.saved_credit_card_actions.delete")})]})}),children:i(_t,{type:"menu-vertical"})}):null]})]}),i(Ct,{children:i("bdi",{children:a})})]})}function Ws(e){const t=w(),{details:n,onEdit:a,onDelete:r}=function(e,{checkout:t}){return"businessCustomer"===t.identity.current.value?{details:e.displayCardholderName,onEdit:void 0,onDelete:e.isVaultedCard?void 0:e.onDelete}:{details:e.displayAddress,onEdit:e.onEdit,onDelete:e.onDelete}}(e,t);return i(Ys,{id:e.id,brand:e.brand,displayLastDigits:e.displayLastDigits,details:n,onEdit:a,onDelete:r,requiresVerification:e.requiresVerification})}const Gs=["session_card"],Ks=()=>{};
2function Xs({cardDetails:e}){const{shippingAddress:t,billingAddress:n,billingAddressOption:a}=P(),r=fe(),{getAccessibilityLabel:s}=sa(),l=s(e),d="shipping"===a.value?t.value.address1:n.value.address1;return i(Un,{values:Gs,onChange:Ks,variant:"grid",children:i($n,{id:"session_card",value:"session_card",accessibilityLabel:l,children:i(Ws,{id:"session",isVaultedCard:!1,displayLastDigits:e.creditCardLastFourDigits,brand:e.brand,displayCardholderName:e.cardholderName,displayAddress:d,onDelete:()=>r()})},"session_card")})}function Js({offsite:e,paymentMethod:n,sessionCard:s,isSelected:l,cardNumberAccessory:d}){const{errors:o}=na(),{i18n:c,shop:u,shopPay:m,checkout:p}=w(),y=n.paymentBrands?.includes("BOGUS")??!1,h=on(n),{bankIdNumberSignal:v}=j(),b=p.configuration.layout.isOnePage.value,g=function(){const{sdk:e}=na(),[t,n]=a(0),[s,i]=a();return r(()=>{(async()=>{const t=await e.getCardField("number");i(t?._iFrame)})()},[e,t]),r(()=>{const e=()=>{n(e=>e+1)};return s?.addEventListener("load",e),()=>{s?.removeEventListener("load",e)}},[s]),t}(),f=G().buyerIdentity.value?.purchasingCompany,_=ia().value,C=P(),S=Ja(C.directPaymentErrors),{errorBannerInContext:A,billingAddressInContext:k,billingAddressVariant:M,isInModal:x,cardNickname:E,onCardNicknameChange:I}=le(es);r(()=>{let e;return s?.creditCardFirstDigits&&(v.value?.replace(/\s/g,"")??"").length<s.creditCardFirstDigits.length&&(e=s.creditCardFirstDigits,v.value=e),()=>{void 0!==e&&v.value===e&&(v.value=void 0)}},[s?.creditCardFirstDigits,v]);const L=!_&&k&&"inlineDirectMethod"===M,B=cn("Checkout::PaymentMethod::HostedFields::RenderAfter",void 0===n?.uiExtension?[]:[n.uiExtension]),D=C.shippingAddress.value,N=t(()=>({paymentMethodIdentifier:n.paymentMethodIdentifier}),[n.paymentMethodIdentifier]);if(o.sdk)return i($s,{});if(e)return i(qs,{});const T=A&&S?i(Nt,{errorType:Tt.PaymentError,tone:"critical",children:c.translate("payment.generic_incorrect_card_info")}):null,F=s&&i(Xs,{cardDetails:s}),O=Boolean(f)&&b?i(Hs,{}):i(xr,{}),V=function({checkout:e,shop:t,shopPay:n},a){return"shopPay"!==e.identity.current.value?t.sameBillingAndShippingAddress:!(!a?.firstName||!a?.lastName)&&n.user.addresses.value.some(({address:e})=>e.firstName===a.firstName&&e.lastName===a.lastName)}({checkout:p,shop:u,shopPay:m},D),z=function({checkout:e},t){if("shopPay"!==e.identity.current.value)return t.paymentMethodIdentifier}({checkout:p},n),R=i("div",{hidden:Boolean(s),children:[i(Vs,{cardBrands:n.paymentBrands??[],prefillCardholderName:V,isSelected:l,paymentMethodIdentifier:z,cardNumberAccessory:d},g),Qs({identity:p.identity})&&i(zs,{})]});return i(Ze,{gap:"base",children:[T,y&&!s&&i(Rs,{}),x&&I?i(Ea,{children:[R,i(Lt,{name:"cardNickname",label:c.translate("payment.card_nickname_label"),value:E??"",onChange:I,maxLength:_e})]}):R,F,B.length>0&&l&&n.paymentMethodIdentifier&&i(la,{options:N,paymentMethodExtension:B}),h&&!x?i(da,{paymentMethod:n,isSelected:l,canEditBin:!s}):null,L&&O]})}function Qs({identity:e}){return"shopPay"===e.current.value}function Zs({children:e,addCardModalOpen:t}){return r(()=>()=>{t.value=!1},[t]),i(l,{children:e})}function ei({paymentMethod:t,addCardModalOpen:r}){const{createAddressParts:s,buyerHasActedSignal:o}=j(),{i18n:c,checkout:u,shop:m}=w(),[p,h]=a(!1),v=Qa(),[b,g]=a(!1),f=d(void 0),C=P(),S=C.billingAddress.value,A=C.acceptPaymentVaulting,k=Ot(S),M=Ce(),x=Se(),E=G(),{value:I}=E.paymentFlexibilityPaymentTermsTemplate,{sdk:L,loading:B,validate:D,resetTouched:N}=na(),[T,F]=a(!1),O=un().value,{negotiate:V}=Xe(),z=oa(),R=e(()=>!z.value),{rollup:{action:{tone:H}={}}={}}=Yt(),$=u.addressManager.billing,U=$.value,q=G().buyerIdentity,Y=q.value?.purchasingCompany,W=!Y&&"CustomerProfile"===q.value?.customerProfile?.__typename,K=U.errors.fields,X=mn(S?.countryCode),J=n(e=>{X("billing_address",e).forEach((e,t)=>{K[t].value=e})},[K,X]),{value:Q}=E.deferredTotal,Z=s.addressModalState.value,ee=d(void 0),te=d(!1),ne="billing"===Z.addressType&&("editing"===Z.status||"adding"===Z.status),ae=null!=ee.value||ne,re=ne&&"editing"===Z.status,se=te.value||re?c.translate("edit_credit_card_modal.edit_address_title"):c.translate("billing.address_form.add_address"),ie=d(void 0),le=n(async e=>$.value.createAddress({address:e}),[$]),oe=n(async e=>{const t=ie.value??("editing"===s.addressModalState.value.status?s.addressModalState.value.addressId:void 0);if(t)return await $.value.updateAddress({id:t,address:e})},[$,ie,s.addressModalState]),ce=re||te.value&&W?oe:le,ue=n(async e=>{const t=await ce(e);return t&&W&&await V({fieldsToResolve:["paymentMethods"]}),t},[ce,V,W]),me=n(()=>{p&&ae?(ee.value=void 0,te.value=!1,ie.value=void 0,f.value=void 0,ne&&(s.addressModalState.value={status:"idle",addressType:"billing",setAsDefault:"default"})):T||(v(),N(),A.value=!1,h(!1),g(!1),s.addressModalState.value={status:"idle",addressType:"shipping",setAsDefault:"default"})},[p,ae,ne,T,s.addressModalState,A,v,N,f,ee,te,ie]),pe=()=>{Y||(C.billingAddressOption.value="custom"),g(e=>!e)},ye=n(()=>{const e=U.addresses.value[0],t=u.configuration.addressSettings.billingAddressSettings.value.defaultShippingDetails.country.code,n=Ae({firstName:e?.address.firstName,lastName:e?.address.lastName,countryCode:t??e?.address.countryCode},{extendedAddressMode:u.address.extendedAddressMode});ee.value=n}
2,[U.addresses,u,ee]),he=de(m),ve=n(async()=>{await ms({validateCardFields:D,vaultCard:()=>L.vaultCard(),paymentMethodIdentifier:t.paymentMethodIdentifier,getDue:()=>Pe(Q,Boolean(M.value),x.value,I?.type),parts:C,newCard:z,buyerHasActedSignal:o,negotiate:V,setLoading:F,fixSubscriptionRedeemablePaymentAmount:he,openBilling:()=>g(!0),close:()=>{h(!1),g(!1)},onAddressError:e=>{if(W){const t=$.value.selectedAddress.value;t&&(f.value=t,J(e))}else J&&J(e)}})},[z,o,D,t,V,L,Q,M,x,C,J,I?.type,W,$,f,he]),be=_(Z),ge=e(()=>"billing"===be.value.addressType?u.configuration.addressSettings.billingAddressSettings.value:u.configuration.addressSettings.nonBillingAddressSettings.value),fe="shipping"===Z.addressType,_e=()=>{ee.value=void 0,te.value=!1,ie.value=void 0,f.value=void 0,g(!1),ne&&(s.addressModalState.value={status:"idle",addressType:Z.addressType,setAsDefault:"default"})},we=fe?c.translate("address_management.address_form.save"):c.translate("billing.address_form.save"),ke=fe?c.translate("address_management.address_form.cancel"):c.translate("billing.address_form.cancel"),Me=Boolean(Y)&&"shipping"===Z.addressType?c.translate("shipping.address_form.one_time_address_subtitle"):"",xe=ae?se:c.translate("payment.add_credit_card_modal.title"),Ee=U.isMissingValidSuggestedAddress.value,Ie="businessCustomer"===u.identity.current.value,Le=W?i(bs,{open:b,onToggle:pe,onAddAddress:ye,errorAddress:f,onEditErrorAddress:()=>{const e=U.selectedAddress.value;e&&(te.value=!0,ie.value=e.id,ee.value=Ae(e.address,{extendedAddressMode:u.address.extendedAddressMode}))}}):Ie?i(ps,{open:b,onToggle:pe}):i(ja,{id:"billingAddress",label:c.translate("payment.billing_address_title"),open:b||Ee,onToggle:Ee?void 0:pe,primaryContent:Ee?void 0:k,children:i(Ze,{gap:"base",children:i(us,{hideAddressModal:!0})})}),Be=p&&ae?{open:!0,content:i(l,{children:[Me&&i(st,{padding:"base",children:i(Ct,{color:"subdued",children:Me})}),i(Ze,{gap:"base",children:i(Va,{editableAddress:ee.value??Z.address,addressType:ee.value?"billing":Z.addressType,saveText:we,cancelText:ke,onSave:ue,onSuccess:_e,onCancel:_e,showSavedAddressSelector:null!=ee.value&&!te.value||U.canCreateAddress.value,addressErrorsSignal:K,combineViolationAndValidationErrors:re,addressSettings:ge.value})})]})}:void 0;return i(Ze,{gap:"base",children:[i(y,{when:R,children:i(St,{tone:"custom"===H?"custom":void 0,onClick:()=>{h(!0),r.value=!0,v(),N(),ee.value=void 0;const e=U.selectedAddress.value;W&&e&&(C.billingAddress.value=e.address,C.billingAddressOption.value="custom")},variant:"plain",textDecoration:"none",children:i(Ze,{direction:"inline",gap:"small-400",alignItems:"center",justifyContent:"center",children:[i(_t,{type:"plus",size:"small"}),i(nt,{children:c.translate("payment.use_different_credit_card_label")})]})})}),i(ds,{size:"large",open:p,onClose:me,heading:xe,cardForm:i(Zs,{addCardModalOpen:r,children:i(Js,{paymentMethod:t})}),billingAddressSection:Le,afterBillingAddress:O?i(Gr,{forceVaultingEligible:!0,blockNegotiations:!0}):void 0,onSave:ve,loading:T||B,createAddressForm:Be})]})}const ti={rollup:{blockPadding:"base",inlinePadding:"none"}};function ni({open:e,onCancel:t,onSave:n,card:s,billingAddress:o,isDefaultCard:c,onDefaultCardChange:u,error:m,addressErrorsSignal:p,initialShowAddressForm:h=!1}){const{i18n:v,checkout:b,shop:g}=w(),f=Ma(),_=b.configuration.addressSettings.billingAddressSettings.value,{nickname:C}=s,[S,A]=a(!1),P=d(!1),k=d(C);r(()=>{e&&(P.value=h,k.value=C)},[e,C,P,k,h]);const M=async()=>{A(!0),await n(o,k.value)&&t(),A(!1)},x=void 0!==C,E=void 0!==u,I=i(Ft,{submitText:v.translate("payment.card_form.save"),cancelText:v.translate("payment.card_form.cancel"),loading:S,disabled:S,handleSubmit:M,handleCancel:t});return i(Na,{open:e,heading:P.value?v.translate("edit_credit_card_modal.edit_address_title"):v.translate("edit_credit_card_modal.edit_card_title"),onHide:t,primaryAction:P.value?void 0:I,children:i(y,{when:P,fallback:(()=>{const e=i(st,{border:"base",borderRadius:"base",padding:"none base",children:i(ja,{label:v.translate("payment_ux.bill_to"),primaryAction:i(St,{variant:"plain",onClick:()=>{P.value=!0},children:i(nt,{children:v.translate("edit_credit_card_modal.edit_button")})}),primaryContent:i(Ha,{address:o,nameLinePosition:"block"})})});return i(l,{children:[m&&i(Ze,{gap:"base",padding:"base none",children:i(Nt,{tone:"critical",errorType:Tt.PaymentError,children:m})}),E&&i(l,{children:[i(ht,{id:"default",name:"default",checked:c??!1,onChange:u,label:v.translate("payment.edit_credit_card_modal.fields.default")}),i(bt,{blockSize:"small-200"})]}),i(nt,{children:v.translate("edit_credit_card_modal.edit_address_only_note")}),i(bt,{blockSize:"small-200"}),i(ut,{disabled:!1,onSubmit:M,children:i(Ea,{children:[i(Lt,{name:"cardNumber",label:v.translate("payment.card_number_label"),readOnly:!0,value:`···· ···· ···· ${s.lastDigits}`,disabled:!0}),i(Ia,{children:[i(Lt,{name:"expiryLabel",label:v.translate("payment.card_expiry_label"),readOnly:!0,value:we(s.expiryMonth,s.expiryYear),disabled:!0}),i(Lt,{name:"cardVerification",label:v.translate("payment.card_verification_value_label"),readOnly:!0,value:"···",disabled:!0})]}),i(Lt,{name:"cardHolderName",label:v.translate("payment.name_on_card_label"),readOnly:!0,value:s.cardholderName||"············",disabled:!0}),x&&i(Lt,{name:"cardNickname",label:v.translate("payment.card_nickname_label"),value:k.value||"",onChange:e=>{k.value=e},maxLength:_e})]})}),i(bt,{blockSize:"base"}),g.hasFlagEnabled(ue)?i(wt,{theme:ti,children:e}):e]})})(),children:i(Va,{onCancel:()=>{P.value=!1},onSuccess:t,onSave:async e=>await n(e,k.value)?{id:"edit-card-billing",address:e}:void 0,cancelText:v.translate("credit_card_form.go_back"),saveText:v.translate("edit_credit_card_modal.save_billing_address"),editableAddress:Ae(o,{extendedAddressMode:b.address.extendedAddressMode}),addressType:"billing",countriesOverride:f.value,addressErrorsSignal:p,addressSettings:_})})})}function ai({paymentMethodId:e,cvvError:t}={}){const{i18n:n}=w(),{sdk:a,validate:s,loading:l}=na(),d=P(),o="INCORRECT_CVC"===t?n.translate("payment_errors.incorrect_cvc"):null;return r(()=>(l||a.setErrors({verification_value:o}),()=>{a.setErrors({verification_value:null})}),[a,o,l]),E(async({reason:t})=>{if("completion"!==t)return{behavior:"allow"};const{isValid:n}=s(!0);if(!n)return{behavior:"block",reason:I.CvvFieldIsInvalid};const r=await a.vaultCard(),i=d.paymentLines.peek();return d.paymentLines.value=i.map(t=>t.method.type!==L.CreditCard||e&&t.method.token!==e?t:{...t,method:{...t.method,cvvSessionId:r}}),{behavior:"allow"}}
2),i(st,{children:[i(bt,{blockSize:"base"}),i(pn,{}),i(bt,{blockSize:"base"}),i(Ze,{gap:"small-300",children:[i(Ct,{color:"subdued",children:n.translate("payment.saved_credit_card_cvv_verification")}),i(tt,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1.5fr) minmax(0, 1fr)",gridAutoColumns:"1fr",gridTemplateRows:"minmax(0, 1fr)",gap:"none",alignItems:"center",alignContent:"center",children:i(Vs,{cardBrands:[],prefillCardholderName:!1,cvvOnly:!0})})]})]})}function ri(e){if(e.immutableAddresses.value.find(e=>e.id===nr))return void e.selectAddress(nr);const t=e.suggestedAddress.value;t.address&&e.createAddress({address:t.address})}function si({billingAddress:e,billingAddressOption:t,shippingAddress:n}){const{countryCode:a,zoneCode:r}=e.value??{};e.value={...ke(void 0,a,r),...n.value},t.value="shipping"}class ii extends Error{constructor(){super(...arguments),this.name="DeleteCardModalError"}}function li({paymentToDelete:e,onClose:t,setSelected:n}){const{checkout:r,i18n:s,observability:l}=w(),d=r.addressManager.billing.value,{negotiate:o}=Xe(),{paymentMethods:c,shippingAddress:u,buyerIdentity:m}=G(),p=ge(c.value),y=oa(),{acceptPaymentVaulting:h,billingAddress:v,billingAddressOption:b,paymentLines:g}=P(),[f,_]=a(!1),C=m.value?.purchasingCompany,{onSubmit:S,error:A,resetError:k}=function(){const{i18n:e,graphql:{coreGraphql:t}}=w(),[n,r]=a("");return{onSubmit:async n=>{if(!n)return{token:void 0};r("");const a=await ua({graphql:t,token:n,genericError:e.translate("customer_payment_methods.delete_customer_mandate.generic_error")});return a.error&&r(a.error),{token:a.token}},error:n,resetError:()=>r("")}}(),M=A?i(Ze,{gap:"base",children:i(Nt,{tone:"critical",errorType:Tt.PaymentError,children:A})}):null;return i(yn,{size:"base",open:Boolean(e),heading:s.translate("payment.delete_credit_card_modal.title"),onHide:()=>{t(),k()},children:[i(Ze,{gap:"base",padding:"base none large-300 none",children:[M,i(Ct,{children:i(nt,{color:"subdued",children:s.translate("payment.delete_credit_card_modal.confirmation",{brandName:e?.brandLabel??"",lastDigits:e?.lastDigits??""})})})]}),i(Ft,{submitText:s.translate("payment.delete_credit_card_modal.delete"),cancelText:s.translate("payment.delete_credit_card_modal.cancel"),submitButtonAppearance:"critical",handleSubmit:async()=>{_(!0);try{e?.token?await async function({token:e,savedCreditCards:t,newCardValue:n,setSelected:a,deleteVaultedCreditCard:r,negotiate:s,onComplete:i}){if(1===t.length)a("direct");else{const r=t.find(t=>t.token!==e);r&&a(n?"direct":Me(r))}const{token:l}=await r(e);l&&await s({fieldsToResolve:["paymentMethods"],force:!0,onComplete(e){"success"===e.status&&i()}})}({token:e.token,savedCreditCards:p,newCardValue:y.value,setSelected:n,deleteVaultedCreditCard:S,negotiate:o,onComplete:t}):e?.id===xe?function({newCardSignal:e,savedCreditCards:t,setSelected:n,paymentLines:a,acceptPaymentVaulting:r,isBusinessCustomer:s,billingManager:i,billingAddress:l,billingAddressOption:d,shippingAddress:o,onComplete:c}){if(!e.value)return c?.(),!1;e.value=void 0,r.value=!1;const u=t[0];u?(n(Me(u)),i&&ri(i)):a.value=a.value.filter(e=>"direct"!==e.method.type),s||si({billingAddress:l,billingAddressOption:d,shippingAddress:o}),c?.()}({newCardSignal:y,savedCreditCards:p,setSelected:n,paymentLines:g,acceptPaymentVaulting:h,isBusinessCustomer:Boolean(C),billingManager:d,billingAddress:v,billingAddressOption:b,shippingAddress:u,onComplete:t}
2):l.error(new ii("Delete pressed with no actionable paymentToDelete"))}finally{_(!1)}},handleCancel:t,loading:f,disabled:f})]})}function di({savedCreditCards:e,selected:s,setSelected:d,isSelected:c,isInModal:u,setSelectedSavedCreditCardBrand:m,addCardModalOpen:p,msiAvailable:h=!1}){const{userEvents:v,shop:{id:b,storeVaultEnabled:g,storeVaultGuestCvvVerificationEnabled:f},source:{checkoutSessionIdentifier:_}}=w(),C=oa(),{bankIdNumberSignal:S,lastNegotiatedBinSignal:A}=j(),[k,M]=a(null),[x,E]=a(!1),{onSubmit:I,error:L,resetError:D}=function(){const{i18n:e,checkout:{address:{extendedAddressMode:t}},graphql:{coreGraphql:n}}=w(),[r,s]=a("");return{onSubmit:async({address:a,defaultPaymentMethod:r,token:i})=>{if(!i)return{token:void 0};s("");const l=await ca({graphql:n,address:a,extendedAddressMode:t,defaultPaymentMethod:r,token:i,genericError:e.translate("shipping.address_form.generic_error")});return l.error&&s(l.error),{token:l.token}},error:r,resetError:()=>s("")}}(),[N,T]=a(!1),F=t(()=>Ee(),[]),[O,V]=a(null),z=ia().value,R=p?.value??!1,H=P(),$=H.billingAddress.value,{getAccessibilityLabel:U}=sa(),q=t=>e.find(e=>{const n=t.split("-")[1];return e.token===n}),Y=q(s),W=C.value,G=c&&Y?.requiresCvvConfirmation&&f&&!R&&!u,K=o(s);r(()=>{const e=K.current;if(K.current=s,m?.(Y?.brand),s===xe){if(z){const e=W?.creditCardFirstDigits;return void(h&&zn(S.value,e)||(S.value=e))}e!==xe&&(S.value=void 0)}else S.value=Y?.firstDigits},[S,m,Y,s,W,z,h]),r(()=>{k&&T(k.defaultPaymentMethod)},[k]);const X=e=>{e===xe&&V({id:e,lastDigits:C.value?.creditCardLastFourDigits??"",brandLabel:C.value?.brand?B(C.value?.brand):""})},{negotiate:J}=Xe(),Q=n(e=>async function({address:e,defaultPaymentMethod:t,token:n,onEditCardSubmit:a,negotiate:r}){const{token:s}=await a({defaultPaymentMethod:t,address:e,token:n});return!!s&&new Promise(e=>{r({fieldsToResolve:["paymentMethods"],force:!0,onComplete(t){e("success"===t.status)}})})}({address:e,defaultPaymentMethod:N,token:k?.token,onEditCardSubmit:I,negotiate:J}),[N,k,J,I]),Z=n(()=>{E(!1),D()},[D]),ee={lastDigits:k?.displayLastDigits??"",expiryMonth:k?.expiryMonth??0,expiryYear:k?.expiryYear??0,cardholderName:k?.cardholderName??""};return i(Un,{values:[s],onChange:e=>(e=>{const t=q(e),n=S.peek();let a;a=e===xe?z?W?.creditCardFirstDigits:void 0:t?.firstDigits,h&&e===xe&&z&&zn(n,a)||(S.value=a);const r=S.peek();h&&(H.paymentLines.value=hn(H.paymentLines.value),A.value=r),J({force:!0,negotiationStage:"negotiation"}).catch(()=>{h&&A.peek()===r&&(A.value=void 0)}),d(e),t&&ma({userEvents:v,shopId:b,checkoutSessionIdentifier:_,card:t})})(e[0]??""),variant:"grid",children:[z&&i(y,{when:C,children:e=>i($n,{id:"direct",value:"direct",accessibilityLabel:U(e),children:e.brand&&e.creditCardLastFourDigits&&i(Ws,{id:"direct",isVaultedCard:!1,brand:e.brand,displayLastDigits:e.creditCardLastFourDigits,displayCardholderName:e.cardholderName,displayAddress:$.address1,onDelete:X})},"direct")}),e.map(e=>i($n,{id:Me(e),value:Me(e),accessibilityLabel:U(e),children:i(Ws,{id:Me(e),isVaultedCard:!0,brand:e.brand,displayLastDigits:e.displayLastDigits,displayCardholderName:e.cardholderName||void 0,displayAddress:e.billingAddress.address1,requiresVerification:f&&e?.requiresCvvConfirmation,onEdit:g?()=>{M(e),E(!0)}:void 0,onDelete:g&&e.deletable?()=>V({token:e?.token,lastDigits:e.displayLastDigits,brandLabel:e?.brand?B(e?.brand):""}):void 0})},Me(e))),(z||g)&&i(l,{children:[i(li,{setSelected:d,paymentToDelete:O,onClose:()=>{V(null)}}),k&&i(ni,{open:x,onCancel:Z,onSave:Q,card:ee,billingAddress:k.billingAddress,isDefaultCard:N,onDefaultCardChange:T,error:L,addressErrorsSignal:F})]}),G&&i(ai,{})]})}function oi({numExpired:e}){const{i18n:t}=w();return i(Ct,{type:"small",color:"subdued",children:t.translate("payment.expired_cards_info",{count:e})})}function ci({savedCreditCards:e,selected:t,setSelected:n,isSelected:s,isModalOpen:l,onModalClose:d}){const{i18n:o}=w(),c=pa(),[u,m]=a(t);r(()=>{m(t)},[t]);const p="@media (inline-size >= small) fit-content, fill",h=i(St,{variant:"primary",inlineSize:p,onClick:()=>{d(),u&&n(u)},children:o.translate("payment.saved_credit_cards_modal.done")}),v=i(St,{variant:"plain",inlineSize:p,onClick:d,children:o.translate("payment.saved_credit_cards_modal.cancel")});return i(yn,{open:l,heading:o.translate("payment.saved_credit_cards_modal.view_all_label"),onHide:d,primaryAction:h,secondaryActions:v,children:i(Ze,{gap:"small-300",children:[i(di,{savedCreditCards:e,selected:u,setSelected:e=>m(e),isSelected:s,isInModal:!0}),i(bt,{blockSize:"small-500"}),i(y,{when:c,children:e=>i(oi,{numExpired:e})})]})})}function ui({offsite:e=!1,paymentMethod:t,setSelected:n,isSelected:s,showExistingCreditCards:o=!0,setSelectedSavedCreditCardBrand:c,cardNumberAccessory:u}){const{i18n:m,checkout:{identity:p},userEvents:y,shop:{id:h},source:{checkoutSessionIdentifier:v}}=w(),b=on(t),{paymentMethods:g}=G(),f=o?function({identity:e},t){return"shopPay"===e.current.value?[]:ge(t)}({identity:p},g.value):[],_=f.length>0,C=oa(),[S,A]=a(f),k=S?.length>4,[M,x]=a(!1),E=Ie().value,I=E.length,B=I>0,{paymentLines:D}=P(),N=D.value,T=_?function(e,t){const n=t.find(e=>e.defaultPaymentMethod),a=e.find(e=>[L.CreditCard,"direct"].includes(e.method.type))?.method;return a?a.type===L.CreditCard?Me(a):a.type:Me(n||t[0])}(N,S):xe,F=T===xe,O=mr(),V=o?O.value:void 0,z=ia().value,R=d(!1),{resetTouched:H}=na(),j=Qa(),$=()=>{j(),H()},U=(e,t)=>{const{isHidden:n,hiddenReason:a}=e.expired?{isHidden:!0,hiddenReason:"expired"}:t>=4?{isHidden:!0,hiddenReason:"pagination"}:{isHidden:!1,hiddenReason:""};y.monorailEvent({schemaId:"checkout_vaulted_payment_method_rendered/1.0",payload:{shopId:parseInt(Le(h),10),checkoutSessionIdentifier:v||"",paymentMethodId:parseInt(Le(e.id),10),paymentInstrumentAccessorId:-1,isSelectedByDefault:T===Me(e),order:t,cvvRequired:e.requiresCvvConfirmation||!1,isHidden:n,hiddenReason:a}})};return r(()=>{V?c(V.brand):C.value||_||c(void 0)},[c,V,C.value,_]),r(()=>
2{A(f),[...f,...E].forEach(U)},[JSON.stringify(f)]),i(Ze,{gap:"base",children:[_&&i(l,{children:[i(di,{savedCreditCards:mi(S),selected:T,setSelected:e=>{n(e),$()},isSelected:s,setSelectedSavedCreditCardBrand:c,addCardModalOpen:R,msiAvailable:b}),b&&(!F||C.value?.creditCardFirstDigits)&&i(da,{paymentMethod:t,isSelected:s,canEditBin:!1}),i(Ze,{gap:"base",alignItems:"start",children:[k&&i(l,{children:[i(zt,{onClick:()=>x(!0),children:i(Ze,{direction:"inline",gap:"small-200",alignItems:"center",children:[i(_t,{type:"arrow-up-right",size:"small"}),m.translate("payment.saved_credit_cards_modal.view_all_label")]})}),i(ci,{savedCreditCards:S,selected:T,setSelected:e=>{n(e),A(t=>function(e,t){const[n,a]=e.split("-");let r;const s=t.filter(e=>(e.token===a&&(r=e),e.token!==a));return[r,...s]}(e,t))},isSelected:s,isModalOpen:M,onModalClose:()=>x(!1)})]}),z?i(ei,{paymentMethod:t,addCardModalOpen:R}):i(ht,{id:"selectDirectPaymentMethod",name:"selectDirectPaymentMethod",checked:F,onChange:e=>{$(),n(e?xe:Me(S[0]))},label:m.translate("payment.use_different_credit_card_label")})]})]}),z&&_?null:i(vt,{id:"directPaymentMethodDetails",open:F,children:i(Js,{offsite:e,paymentMethod:t,sessionCard:V,isSelected:s,cardNumberAccessory:u},T)}),B&&!k&&i(oi,{numExpired:I})]})}function mi(e){return e.slice(0,4)}function pi({setSelected:e,isSelected:t,paymentMethod:n,bare:a,iconPlacement:s="end",showExistingCreditCards:d=!0,disabled:o,details:c,selectedContentFooter:u}){const{i18n:m,checkout:p}=w(),{identity:y}=p,{bankIdNumber:h,filled:v,touched:b}=na(),{setSelectedSavedCreditCardBrand:g}=Jn(),{bankIdNumberSignal:f,directPaymentFieldsFilled:_}=j(),{variant:C}=Mt(),{paymentLines:S}=P(),A=on(n)&&S.value.length>0&&S.value.every(e=>e.method.type===L.CreditCard);r(()=>{A||(h||b.number)&&(f.value=h)},[h,f,b.number,A]),r(()=>{const e=(n.checkoutHostedFields??is).filter(ss);return _.value=e.every(e=>v[e]),()=>{_.value=!1}},[_,v,n.checkoutHostedFields]);const k=p.installments.paymentMethodMustSupportDebitCardOnly.value,M="cardNumber"===s,x="inline"===s,E="end"===s,I=!0===a&&M,B=C!==Be.Control,{ref:N,overflowIndicatorRef:T,maxVisibleBrands:F}=Cr(n.paymentBrands.filter(D).length),V=i(fr,{animate:B,announceNetworkSelector:E,announceOverflowBrands:I,size:M||x?"small":void 0,maxVisibleBrands:E?F.value:void 0,overflowIndicatorRef:E?T:void 0}),z=i(l,{children:[i(yi,{isSelected:t,customHostedFields:n.checkoutHostedFields}),i(ui,{offsite:!1,paymentMethod:n,setSelected:e,isSelected:t,showExistingCreditCards:d,setSelectedSavedCreditCardBrand:g,cardNumberAccessory:M?V:void 0})]}),R=u?i(Ze,{gap:"base",children:[z,u]}):z;if(a)return R;const H=function({identity:e,i18n:t},n,a){return ae({identitySource:e.current.value,i18n:t},a,{forceDebitCardLabel:n})}({identity:y,i18n:m},k,n),$=O(m,n.paymentBrands,void 0,E?F.value:void 0),U=$?`${H}, ${$}`:H,q=i(er,{type:"generic",accessibilityVisibility:"hidden"}),Y={end:i("div",{ref:N,className:"YuaRt",children:i(Ze,{direction:"inline",gap:"none",alignItems:"center",justifyContent:"end",className:"BqUj3",children:V})}),cardNumber:q,inline:void 0}[s];return i(l,{children:i($n,{value:te(n),disabled:o,details:c,secondaryContent:Y,renderSelectedContentWhenCollapsed:!0,selectedContent:R,accessibilityLabel:U,children:x?i(Ze,{direction:"inline",gap:"small-200",alignItems:"center",children:[i(nt,{type:"strong",children:H}),V]}):i(nt,{type:"strong",children:H})})})}function yi({isSelected:e,customHostedFields:t}){return function(e,t){const{observability:n,shop:a,webMcp:r,checkout:{wallets:s}}=w(),{id:i}=a,l=de(a),d=Ke(),o=mr(),{validate:c,cardBrand:u}=na(),{vaultCardWithSelectedNetwork:m,vaultCardMultipleTimesWithSelectedNetwork:p}=Jn(),y=yr(),h=oe(),v=P();E(({parts:a,reason:b})=>{const g=v.remotePaymentDetails.value,f=a.paymentLines.peek(),_=f[0],C=s.activeSession.value;if("progression"!==b&&"completion"!==b||!d.value||!e||C)return"completion"===b&&C&&1===f.length&&"direct"===_?.method.type&&(n.leaveErrorBreadcrumb("[useDirectPaymentMethodCustomizations] activeSession is set and the first payment line is direct",{activeSession:C}),n.error(new ce("activeSession is set and the first payment line is direct. This will block checkout",{metadata:{conflictType:"DirectPaymentConflict",wallet:{active:C}}}))),{behavior:"allow"};if(void 0===_)return y(b),{behavior:"block",reason:I.EmptyPaymentLines,perform:()=>{}};if("direct"!==_.method.type)return{behavior:"allow"};const{acceptedSubscriptionTerms:S,paymentMethodIdentifier:A,paymentAttributes:P,alternative:w}=_.method,k=r?.getSubmittingAgenticToken();return o.value&&!k?{behavior:"allow",perform:()=>{}}:k||c(!1,t).isValid?{behavior:"allow",async perform({behavior:e}){if("allow"!==e)return;let t;if(k)t=k;else if(g&&0!==g.size){const e=[...h.value.length>0?[i]:[],...g.keys()],n=await async function(e,t){const n=await t(e.length);return new Map(e.map((e,t)=>{const a=n[t];if(void 0===a)throw new TypeError(`Missing payment session for shop ${e} at index ${t}`);return[e,a]}))}(e,p);t=n.get(i)??null;const a=new Map(g);for(const[t,r]of a)a.set(t,{...r,sessionId:n.get(t)});v.remotePaymentDetails.value=a}else t=await m();if(t){const e=a.paymentLines.peek().find(e=>"direct"===e.method.type),n=e?.method?.creditCardInstallments,r={method:{type:"direct",sessionId:t,acceptedSubscriptionTerms:S,paymentMethodIdentifier:A,paymentAttributes:P,alternative:w,...u&&{brand:aa(u)},...null!=n&&{creditCardInstallments:n}}};Vn(a,r,l)}}}:{behavior:"block",reason:I.CardFieldInputIsInvalid,perform:()=>{}}})}(e,t),null}function hi({method:e,onSelect:t,vaultHandle:n,blockFooter:a,selectedContentFooter:r}){const s=Za(),l=ns(),d=te(e);return i(Ze,{gap:"base",children:[i(ya,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:l.value,onSetFieldErrors:s,children:[i(as,{handle:n}),i(pi,{id:d,paymentMethod:e,setSelected:t,isSelected:!0,bare:!0,selectedContentFooter:r})]}),a]})}function vi({inlinePaymentMethod:e=!1}){const{i18n:t}=w(),n=vn({clearPii:!1});return i(st,{padding:e?"none":"base",children:i(et,{onClick:n,inlineSize:"100%",children:i(Ze,{direction:"inline",gap:"small-200",alignItems:"center",children:[i(nt,{tone:"accent",children:t.translate("credit_card_form.more_payment_options")}),i(_t,{type:"arrow-up-right",size:"small",tone:"accent"})]})})})}
2function bi({id:e,displayName:t}){const{i18n:n}=w(),a=t??n.translate("payment_gateway.deferred_payment_label");return i($n,{value:e,accessibilityLabel:a,children:i(nt,{type:"strong",children:a})})}const gi=["BANCONTACT","IDEAL"];function fi(e){return gi.includes(e)}function _i({name:e}){return fi(e)?null:i(gr,{paymentBrands:[e]})}function Ci({name:e,displayName:t}){return i(l,{children:fi(e)?i(er,{type:e}):i(nt,{type:"strong",children:t})})}function Si({name:e,displayName:t}){return i($n,{value:e,secondaryContent:i(_i,{name:e}),accessibilityLabel:t,children:i(Ci,{name:e,displayName:t})})}function Ai({manualPaymentMethod:t}){const n=G().alternativePaymentCurrency,a=M("alternativePaymentCurrency"),{i18n:r}=w(),s=e(()=>{if(!a.value)return n.value});return i(Ze,{gap:"base",children:i(ln,{children:i(y,{when:s,fallback:i(bn,{inlineSize:"base"}),children:e=>{const n={amount_due:i(nt,{type:"strong",children:r.formatCurrency(e.totalWithoutGiftCards.amount,{currency:e.totalWithoutGiftCards.currencyCode,form:"explicit"})})};return t?r.translate("payment.alternative_payment_currency_total_manual_payment_notice",n):r.translate("payment.alternative_payment_currency_total_notice",n)}})})})}function Pi({additionalDetails:t,alignItems:n}){const a=G().alternativePaymentCurrency,{hasNegotiatedAlternativePaymentCurrencySignal:r}=j(),s=De(),l=e(()=>s.value&&r.value||Boolean(a.value)),d=t?.trim();return d||l.value?i(Ze,{alignItems:n,gap:"large-100",children:[d?i(Ct,{children:i(ln,{children:t})}):null,i(y,{when:l,children:i(Ai,{manualPaymentMethod:!0})})]}):null}function wi({id:e,label:t,additionalDetails:n,showSelectedContent:a=!0}){return i($n,{value:e,selectedContent:a?i(Pi,{additionalDetails:n}):void 0,accessibilityLabel:t,children:i(nt,{type:"strong",children:t})})}function ki({id:e,additionalDetails:t,name:n,showSelectedContent:a=!0}){const r=gn();return i($n,{value:e,selectedContent:a?i(Pi,{additionalDetails:t,alignItems:r?void 0:"center"}):void 0,accessibilityLabel:n,children:i(nt,{type:"strong",children:n})})}const Mi=C({displayName:"PayPalExpressPaymentMethod",load:()=>S(()=>jn(()=>import("./75f3a0c7.DI1EiYrm.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57]))),renderLoading:function({bare:e}){return e?null:i($n,{value:"PAYPAL_EXPRESS"})}});function xi(){const{i18n:e}=w(),t=e.translate("brand.apple_pay");return i($n,{value:"APPLE_PAY",secondaryContent:i(La,{wallet:"APPLE_PAY",size:"xxxsmall"}),accessibilityLabel:t,children:i(nt,{type:"strong",children:t})})}function Ei(){const{checkout:e,router:t}=w(),{validation:{contactErrors:{emailInputError:n,phoneInputError:a}}}=e,{origin:r,prefix:s,searchParams:i}=t.currentUrl.value,{deliveryMethodsAddressErrors:l}=j(),{nextPage:d}=fn(),{resetAddressErrors:o}=_n(l),c=e.negotiator.throttleState.peek().token,u=e.configuration.renderContextToken.token.value;E(async({parts:e,reason:t})=>{if("completion"===t||"progression"===t&&"review"===d.id){const t=e.paymentLines.peek(),l=t[0]?.method,d=i.get("channel");if("wallet"===l?.type&&"SHOPIFY_INSTALLMENTS"===l.name){const e=new URLSearchParams;e.set("payment","shop_pay"),e.set(Ne,Te.ShopPayInstallmentsAsPaymentMethod),c&&e.set(Cn,c),d&&e.set("channel",d),u?e.set("rctx",u):e.delete("rctx");const t=`${r}${s}?${e.toString()}`;return{behavior:"block",reason:I.RedirectingToShopPay,perform(){n.value=void 0,a.value=void 0,o(),window.location.assign(t)}}}}return{behavior:"allow"}})}function Ii({label:e,installmentsLabel:t,installments:n}){return Ei(),i($n,{value:"SHOPIFY_INSTALLMENTS",secondaryContent:i(La,{wallet:"SHOP_PAY",size:"xxxsmall"}),accessibilityLabel:e,children:i(Ze,{direction:"@media (inline-size >= extraSmall) inline, block",gap:"small-400",children:[i(nt,{type:"strong",children:e}),n&&i(l,{children:[i(st,{display:"@media (inline-size >= extraSmall) auto, none",children:i(nt,{color:"subdued",children:"â¢"})}),i(nt,{color:"subdued",children:t})]})]})})}function Li({method:e,showSelectedContent:t=!0,bare:n=!1}){const{i18n:a}=w();switch(e.name){case"PAYPAL_EXPRESS":return i(Mi,{method:e,showSelectedContent:t,bare:n});case"APPLE_PAY":return n?null:i(xi,{});case"SHOPIFY_INSTALLMENTS":{if(n)return null;const e=a.translate("payment_gateway.shop_pay.name"),t=a.translate("payment_gateway.shop_pay.installments_label");return i(Ii,{label:e,installmentsLabel:t,installments:!0})}case"SHOP_PAY":{if(n)return null;const e=a.translate("payment_gateway.shop_pay.name");return i(Ii,{label:e})}case"GOOGLE_PAY":case"VENMO":return null;default:s(e)}}function Bi({children:e}){const t=gn();return i("div",{className:v("H3Xuw",t&&"ldo89"),children:e})}function Di({label:e,bare:t=!1}){const{descriptor:n,brand:a}=ha().value,r=gn()||t,s=i(Bi,{children:i(Ze,{gap:"base",alignItems:r?"start":"center",children:i(Ze,{direction:"inline",gap:"base",children:[i(va,{brand:a,descriptor:n}),i(ba,{})]})})});return i(l,t?{children:[i(Kn,{isSdkOnly:!0}),s]}:{children:[i(Kn,{isSdkOnly:!0}),i($n,{value:re.AmazonPay,selectedContent:s,secondaryContent:i(st,{blockAlignment:"center",children:i(La,{wallet:re.AmazonPay,size:"small"})}),accessibilityLabel:e,children:i(nt,{type:"strong",children:e})})]})}function Ni({method:e,bare:t=!1}){const{i18n:n,checkout:a}=w(),r=a.configuration.layout.isOnePage.value;switch(e.name){case re.AmazonPay:{const e=n.translate("brand.amazon_pay");return r?null:i(Di,{label:e,bare:t})}case re.BuyWithPrime:return null;default:return s(e.name)}}const Ti={PAYPAL_EXPRESS:"paypal",APPLE_PAY:"apple_pay",GOOGLE_PAY:"google_pay",SHOP_PAY:"shop_pay",amazon_pay:"amazon_pay"};function Fi(e){if("paymentBrands"in e&&Array.isArray(e.paymentBrands))return e.paymentBrands;if("name"in e&&e.name){const t=Ti[e.name];return t?[t]:[]}return[]}function Oi(e){return"name"in e?e.name:e.type}function Vi(e,t){return!(!e||!t||e.length!==t.length)&&(e===t||t.every((t,n)=>{return(a=t)===(r=e[n])||!!a&&!!r&&F(zi(a),zi(r));var a,r}))}function zi(e){const t=Oi(e),{type:n,orderingIndex:a}=e;return{type:n,name:t,orderingIndex:a}}function Ri({identity:e,methodCount:t}){return 1===t&&("shopPay"!==e.current.value||qn)}function Hi({value:e,label:t,accessibilityLabel:n=t,showIconPlaceholder:a=!1}){const{i18n:r}=w();return i($n,{value:e,accessibilityLabel:n,secondaryContent:i(l,{children:[a?i(Sn,{inlineSize:Fe(tr.base.inlineSize),blockSize:Fe(tr.base.blockSize),contentDisplay:"block"}):null,i(nt,{accessibilityVisibility:"exclusive",children:r.translate("general.loading")})]}),children:i(nt,{type:"strong",children:t})})}function ji({id:e,method:t}){const{i18n:n}=w();return i(Hi,{value:e,label:t.displayName??n.translate("payment.bank_payment_method_label"),showIconPlaceholder:!0})}
2const $i=C({displayName:"BankPaymentMethod",useError:An("BankPaymentMethod"),load:()=>S(async()=>({default:(await jn(async()=>{const{BankPaymentMethod:e}=await(import("./4a3d8599.CGwv06ae.js"));return{BankPaymentMethod:e}},__vite__mapDeps([58,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,23,24,25,26,59,60,22,61,31,36,37,38,39,40,16,17,41,42,43,44,45,46,47,48,21,27,28,29,30,32,33,34,35,49,50,51,52,19,20,53,54,55,56,57,62]))).BankPaymentMethod})),renderLoading:({id:e,method:t,bare:n})=>n?null:i(ji,{id:e,method:t})});function Ui({id:e,method:t,bare:n}){const{i18n:a}=w();if(!cn("Checkout::PaymentMethod::Render",void 0===t.uiExtension?[]:[t.uiExtension]).length)return null;if(n)return null;const r=O(a,t.paymentBrands),s=r?`${t.name}, ${r}`:t.name;return i(Hi,{value:e,label:t.name,accessibilityLabel:s,showIconPlaceholder:!0})}const qi=C({displayName:"CustomOnsitePaymentMethod",useError:An("CustomOnsitePaymentMethod"),load:()=>S(async()=>({default:(await jn(async()=>{const{CustomOnsitePaymentMethod:e}=await(import("./04164916.BoudB34k.js"));return{CustomOnsitePaymentMethod:e}},__vite__mapDeps([63,1,3,4,5,6,7,8,9,10,11,12,13,14,2,15,49,50,21,22,23,24,25,26,27,16,17,28,29,30,31,32,33,34,35,19,20,36,37,38,39,40,41,42,43,44,45,46,47,48,51,52,53,54,55,56,57,64]))).CustomOnsitePaymentMethod})),renderLoading:e=>i(Ui,{...e})});function Yi({name:e,paymentBrands:t}){const{i18n:n}=w(),a=O(n,t);return i(Hi,{value:e,label:e,accessibilityLabel:a?`${e}, ${a}`:e,showIconPlaceholder:!0})}const Wi=C({displayName:"OffsitePaymentMethod",useError:An("OffsitePaymentMethod"),load:()=>S(async()=>({default:(await jn(async()=>{const{OffsitePaymentMethod:e}=await(import("./04164916.BoudB34k.js"));return{OffsitePaymentMethod:e}},__vite__mapDeps([63,1,3,4,5,6,7,8,9,10,11,12,13,14,2,15,49,50,21,22,23,24,25,26,27,16,17,28,29,30,31,32,33,34,35,19,20,36,37,38,39,40,41,42,43,44,45,46,47,48,51,52,53,54,55,56,57,64]))).OffsitePaymentMethod})),renderLoading:({name:e,paymentBrands:t,bare:n})=>n?null:i(Yi,{name:e,paymentBrands:t})}),Gi={offsite:Wi,customOnsite:qi,bank:$i};function Ki(){const e=Wi.useLoadState(),t=qi.useLoadState(),a=$i.useLoadState();return n(n=>{switch(n.type){case"offsite":return e;case"customOnsite":return t;case"bank":return a;default:return}},[e,t,a])}const{offsite:Xi,customOnsite:Ji,bank:Qi}=Gi;function Zi({methods:e,selected:a,onSelect:r,renderAsBareCard:s,vaultHandle:l,blockFooter:d,choiceListName:o="basic",showSelectedContent:c=!0,showExistingCreditCards:u=!0,radioControlMethodCount:m,directMethodDisabled:p=!1,directMethodDetails:y,directMethodSelectedContentFooter:h}){const v=Za(),{checkout:{identity:b}}=w(),g=ns(),f=t(()=>a?[a]:[],[a]),_=n(([e])=>{e&&r(e)},[r]);return i(Un,{name:o,values:f,hideRadioControl:Ri({identity:b,methodCount:m??e.length}),onChange:_,variant:s?"list":"block",blockFooter:d,children:e.map(e=>{const t=te(e),n=a===t;return"direct"===e.type?i(ya,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:g.value,onSetFieldErrors:v,children:[n&&i(as,{handle:l}),i(pi,{id:t,paymentMethod:e,setSelected:r,isSelected:n,bare:s,showExistingCreditCards:u,disabled:p,details:y,selectedContentFooter:n?h:void 0})]},t):"wallet"===e.type?i(ya,{blurValidationFieldDenylist:g.value,onSetFieldErrors:v,children:i(Li,{method:e,showSelectedContent:c})},t):"walletsPlatform"===e.type?i(Ni,{method:e},t):e.type===L.PayPal?i(Mi,{method:e,showSelectedContent:c},t):"local"===e.type?i(Si,{name:e.name,displayName:e.displayName},t):"paymentOnDelivery"===e.type?i(ki,{id:e.type,additionalDetails:e.additionalDetails,name:e.name,showSelectedContent:c},t):"manualPayment"===e.type||"customManualPayment"===e.type?i(wi,{id:`${e.type}-${e.id}`,label:e.name,additionalDetails:e.additionalDetails,showSelectedContent:c},t):"offsite"===e.type?i(Xi,{name:e.name,paymentBrands:e.paymentBrands,showRedirectionNotice:e.showRedirectionNotice,showSelectedContent:c},t):"deferred"===e.type?i(bi,{id:e.type,displayName:e.displayName},t):"customOnsite"===e.type?i(Ji,{id:e.name,selected:c&&n,method:e,showSelectedContent:c},t):"bank"===e.type?i(Qi,{id:t,method:e,setSelected:r,showSelectedContent:c},t):null})})}function el(){const{i18n:e}=w();return i(Pn,{tone:"warning",children:e.translate("payment_errors.test_mode_enabled_only_test_cards")})}function tl(){const[e,t]=a(!0),n=function(){const{client:e}=w();return e.unstable_getSerialization("invoiceLoginType")}(),r=G().buyerIdentity.value?.purchasingCompany,{client:s,i18n:l}=w(),d=(()=>{const e=s.unstable_getSerialization("loginUrl")||"";switch(n){case kn:return l.translate("payment_gateway.login_prompt.no_access.message",{logIn:i(zt,{tone:"monochrome",href:e,children:l.translate("payment_gateway.login_prompt.no_access.link")})});case wn:case void 0:return null}return null})();return e&&n&&r&&d?i(Pn,{onDismiss:function(){t(!1)}
2,tone:n===wn?"success":"info",children:d}):null}function nl({selectedPaymentMethod:t}){const{i18n:n}=w(),a=Mn(),r=_(t),s=se(),l=G(),d=M("paymentFlexibilityPaymentTermsTemplate"),o=Bt(),c=n.numberFormatter({style:"percent",minimumFractionDigits:0,maximumFractionDigits:2}),u=e(()=>{const e=l.paymentFlexibilityPaymentTermsTemplate.value,t=l.depositConfiguration.value,i="deferred"===r.value,d="creditCards"===r.value,u="FIXED"===e?.type,m="FULFILLMENT"===e?.type,p="RECEIPT"===e?.type,y=t?.percentage?c.format(t?.percentage/100):null;if(s.value)return u?n.translate("payment_gateway.draft_order_payment_due_later_terms",{translatedName:e.translatedName.toLocaleLowerCase()}):m?y?n.translate("payment_gateway.draft_order_deposit_due_on_fulfillment",{depositAmount:y}):n.translate("payment_gateway.draft_order_payment_due_on_fulfillment"):null==e?i?n.translate("payment_gateway.draft_order_payment_due_later_no_terms"):n.translate("payment_gateway.draft_order_payment_due_later_no_terms_payment_selected"):y?n.translate("payment_gateway.draft_order_deposit_due_later",{depositAmount:y,translatedName:e.translatedName}):n.translate("payment_gateway.draft_order_payment_due_later_terms",{translatedName:e.translatedName});if(null==e||o.value)return;if(m){if(y)return n.translate("payment_gateway.order_deposit_due_on_fulfillment",{depositAmount:y});if(d)return n.translate("payment_gateway.order_due_on_fulfillment_payment");if(i)return n.translate("payment_gateway.order_due_on_fulfillment_choose_later")}if(p)return y?n.translate("payment_gateway.order_deposit_due_on_receipt",{depositAmount:y}):n.translate("payment_gateway.order_due_on_receipt_choose_later");if(!e.dueDate)return;const h={translatedName:e.translatedName,dueDate:a(e.dueDate)};return d&&!y?u?n.translate("payment_gateway.fixed_direct_payment_terms",{dueDate:h.dueDate}):n.translate("payment_gateway.direct_payment_terms",h):u?y?n.translate("payment_gateway.order_deposit_due_on_fixed_date",{depositAmount:y,dueDate:h.dueDate}):n.translate("payment_gateway.fixed_payment_label",{dueDate:h.dueDate}):y?n.translate("payment_gateway.order_deposit_due_now",{depositAmount:y,...h}):n.translate("payment_gateway.generic_payment_terms",h)});return i(y,{when:u,children:i(Pn,{tone:"info",children:i(y,{when:()=>!d.value,fallback:i(bn,{inlineSize:"large"}),children:u})})})}function al(){const{paymentErrors:e}=xn().value,t=i(En,{errors:e,errorType:Tt.PaymentError});return e.length>0&&t}function rl({selectedPaymentMethod:e}){const{shopPay:t,source:n}=w(),a=t.user.hasFlag(Ga);return i(l,{children:[i(al,{}),In(n.type)&&i(tl,{}),a&&i(el,{}),i(nl,{selectedPaymentMethod:e})]})}tl.displayName="OrderInvoiceLoginBanner";const{inlineSize:sl,blockSize:il}=tr.base;function ll(e,t){return e?i(Sn,{inlineSize:Fe(sl),blockSize:Fe(il),contentDisplay:"block"}):t?i(er,{type:t}):void 0}function dl({identity:e}){return e.current.value}function ol({methods:e,selected:a,onSelect:r,selectorShowsTiles:s,tileSupportedCustomOnsitePaymentMethods:l}){f(()=>{if(s)return s.value=!0,()=>{s.value=!1}},[s]);const{i18n:d,checkout:o}=w(),c=o.configuration.layout.isOnePage.value,u=Ki(),m=Et(),p=It(m),y=o.installments.paymentMethodMustSupportDebitCardOnly.value,h=t(()=>a?[a]:[],[a]),v=n(([e])=>{e&&r(e)},[r]);return i(Un,{name:"payment-tiles",label:d.translate("payment.payment_method"),labelAccessibilityVisibility:"exclusive",variant:"grid-compact",values:h,onChange:v,children:e.flatMap(e=>{const t=te(e),n=zr(e,{i18n:d,identitySource:dl({identity:o.identity}),isOnePageCheckout:c,isVenmoCheckout:p,forceDebitCardLabel:y,tileSupportedCustomOnsitePaymentMethods:l});if(!n)return[];const a="loading"===u(e),r=a?d.translate("general.loading"):void 0,s=n.accessibilityLabel&&r?`${n.accessibilityLabel}, ${r}`:n.accessibilityLabel;return i($n,{value:t,icon:ll(a,n.iconBrand),accessibilityLabel:s,children:[i(nt,{type:"strong",children:n.label}),r&&!s?i(nt,{accessibilityVisibility:"exclusive",children:r}):null]},t)})})}const cl={loaded:!1},ul={start:"payment-transition-extensions-enter-start",end:"payment-transition-extensions-enter-end"},ml="payment-transition-extensions-clip";function pl(){return A(async()=>{"undefined"!=typeof window&&(await jn(()=>Promise.resolve({}),__vite__mapDeps([65])),cl.loaded=!0)}),cl}const yl={PaymentSelector:"Yqd2o",PaymentDetails:"_9Jwvk"};function hl({children:e,variant:t}){return pl(),i("div",{className:`${yl[b("Payment",t)]} payment-transition-${t}`,children:e})}const{offsite:vl,bank:bl,customOnsite:gl}=Gi;function fl({methods:e,selected:t,onSelect:n,vaultHandle:a,directMethodSelectedContentFooter:r}){return i(l,{children:e.map(e=>{const s=te(e),l=s===t,d=!l&&"direct"===e.type;return i("div",{className:v("fMWDI",d&&"_6d3Zy"),hidden:!l&&!d,"data-collapsed":!l,"aria-hidden":d||void 0,children:i(st,{paddingBlockEnd:"large-100",children:i(_l,{method:e,isSelected:l,onSelect:n,vaultHandle:a,directMethodSelectedContentFooter:r})})},s)})})}function _l({method:e,isSelected:t,onSelect:n,vaultHandle:a,directMethodSelectedContentFooter:r}){const s=Za(),l=ns(),d=te(e);switch(e.type){case"direct":return i(ya,{publishesCardNetworkDetection:!0,directPaymentMethodConfig:e,blurValidationEnabled:!0,blurValidationFieldDenylist:l.value,onSetFieldErrors:s,children:[t&&i(as,{handle:a}),i(pi,{id:d,paymentMethod:e,setSelected:n,isSelected:t,bare:!0,selectedContentFooter:t?r:void 0,iconPlacement:"cardNumber"})]});case"offsite":return i(vl,{name:e.name,paymentBrands:e.paymentBrands,showRedirectionNotice:e.showRedirectionNotice,bare:!0});case"bank":return i(bl,{id:d,method:e,setSelected:n,bare:!0});case"customOnsite":return i(gl,{id:d,method:e,selected:t,bare:!0});case"wallet":return"PAYPAL_EXPRESS"!==e.name?null:i(ya,{blurValidationFieldDenylist:l.value,onSetFieldErrors:s,children:i(Li,{method:e,bare:!0})});case"walletsPlatform":return i(Ni,{method:e,bare:!0});case L.PayPal:return i(Mi,{method:e,bare:!0});default:return null}}const Cl=new Set(["direct","offsite","customOnsite","manualPayment","customManualPayment","paymentOnDelivery","local","wallet","walletsPlatform","deferred","bank"]);function Sl({identity:e}){switch(e.current.value){case"guest":return"guest_checkout";case"shopPay":return"shop_pay_payment_options";default:return e.current.value}}function Al(e){return e.type===L.CreditCard?Me(e):te(e)}function Pl(e){return"displayName"in e&&e.displayName?e.displayName:"name"in e&&e.name?e.name:e.type}function wl({displayedPaymentMethods:e,selectedPaymentMethod:t,buyerHasActed:a}){const s=function(){const{userEvents:e,shop:t,source:a}=w(),{buyerIdentity:r,shippingAddress:s}=G(),{id:i}=t,{checkoutSessionIdentifier:l}=a,d=s.value?.countryCode||r.value?.countryCode,c=o(0),u=o(""),m=o([]),p=o(!1);return n(({displayedPaymentMethods:t,selectedPaymentMethod:n,buyerHasActed:a})=>{const r=n?Al(n):"",s=!Vi(m.current,t);let o;s&&c.current++,!p.current&&t.length>0?(o="initialRender",p.current=!0):s?o="paymentMethodsChanged":u.current!==r&&(o=a?"buyerSelectedPaymentMethod":"autoSelectedPaymentMethod"),o&&function(e,t,n,a,r,s,i,l,d){s.forEac
2h((o,c)=>{const u=Al(o),m=!l&&u===r,p=l&&u===r;e.monorailEvent({schemaId:"checkout_payment_method_rendered/1.1",payload:{shopId:parseInt(Le(t),10),checkoutSessionIdentifier:i||"",paymentMethodIdentifier:"paymentMethodIdentifier"in o?o.paymentMethodIdentifier:void 0,buyerCountryCode:d,eventTriggerReason:a,iterationNumber:n,orderInTheList:c,displayName:Oi(o)||"",isAutoSelected:m,isBuyerSelected:p,isOrderedFirst:0===c,isOrderedLast:c===s.length-1}})})}(e,i,c.current,o,r,t,l,a,d),m.current=t,u.current=r},[d,l,e,i])}();r(()=>{s({displayedPaymentMethods:e,selectedPaymentMethod:t,buyerHasActed:a})},[a,e,s,t])}function kl({displayedPaymentMethods:e,selected:t,setSelected:n,buyerHasActed:a}){const{shop:s,shopPay:i,userEvents:l,source:d,checkout:c,router:u}=w(),m=u.currentUrl.value,{paymentMethodAutoSelectionDisabled:p}=s,y=lr(),h=De(),v=Boolean(Re(c.proposal.proposed.paymentLines.value)),b=e.find(e=>te(e)===t);wl({displayedPaymentMethods:e,selectedPaymentMethod:b,buyerHasActed:a});const g=o([]),f=o(),_=o(new Set),C=o(function(e){const t=new URLSearchParams(e),n=t.get(Ve);var a;if(n&&(a=n,Cl.has(a)))return{paymentMethod:n,paymentMethodIdentifier:t.get(ze)||void 0}}(m.search)),S=o(!1);r(()=>{!function({availableMethods:e,seen:t,userEvents:n,source:a,checkout:r,shop:s}){"shopPay"===r.identity.current.value&&e?.forEach(e=>{const i=te(e);t.has(i)||(t.add(i),n.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...q(a,r,s),action:"payment_method_rendered",paymentMethodName:Pl(e)}}))})}({availableMethods:e,seen:_.current,userEvents:l,source:d,checkout:c,shop:s})},[e,l,d,c,s]),r(()=>{const[a]=e;v||"shopPay"!==c.identity.current.value||"SHOP_PAY"!==t||void 0===a||n(te(a))},[t,n,e,c.identity,v]),r(()=>{if(v)return g.current=e,void(f.current=e);const[r]=e,s=!Vi(g.current,e);if(!p&&void 0!==r){const l=a||S.current||!C.current?void 0:function(e,t){if(t.paymentMethodIdentifier){const n=e.find(e=>e.type===t.paymentMethod&&"paymentMethodIdentifier"in e&&e.paymentMethodIdentifier===t.paymentMethodIdentifier);if(n)return n}return e.find(e=>e.type===t.paymentMethod)}(e,C.current);if(l){const e=te(l);S.current=!0,t!==e&&n(e,void 0,{rebuild:!0})}else if(C.current&&!S.current&&h.value&&(S.current=!0),i.user.paymentMethodHistory.value.length>0&&function(e,t){const n=e.map(e=>te(e)),a=t?.map(e=>te(e));return!n.every(e=>a?.includes(e))}(e,f.current)){const t=function({availablePaymentMethods:e,previousAvailablePaymentMethods:t,identity:n,shopPay:a,isApplePayAvailable:r}){if("shopPay"!==n.current.value)return;const s=e.map(e=>te(e)),i=t?.map(e=>te(e));if(s.every(e=>i?.includes(e)))return;const l=a.user.paymentMethodHistory.value;if(0!==l.length)for(const d of l){if(!d.lastUsedAt)continue;const t=e.find(e=>!(!r||"APPLE_PAY"!==d.paymentMethod||!Oe(e))||!("customOnsite"!==e.type||"CUSTOM_ONSITE"!==d.paymentMethod||!("paymentBrand"in d)||!(e.paymentBrands?.map(e=>e.toLowerCase())??[]).includes(d.paymentBrand.toLowerCase())));if(t)return te(t)}}({availablePaymentMethods:e,previousAvailablePaymentMethods:f.current,identity:c.identity,shopPay:i,isApplePayAvailable:y.value});f.current=e,t?n(t):s&&!b&&n(te(r))}else s&&!b&&n(te(r))}g.current=e},[t,b,n,a,e,i,y.value,p,v,c.identity,i.user.paymentMethodHistory.value,h.value])}function Ml(e,t){return e?[...e.querySelectorAll('input[type="radio"]')].filter(e=>e.name===t):[]}const xl=new Set(["bank","customOnsite"]);function El({displayedPaymentMethods:e,selected:t,loadStateForMethod:n}){const{checkout:a,i18n:r,observability:s}=w(),{wallets:i}=a,l=Ca();E(({reason:a})=>{if("progression"!==a&&"completion"!==a)return{behavior:"allow"};if(Sa(l.value))return{behavior:"allow"};if(null!==i.activeSession.value)return{behavior:"allow"};const d=e.find(e=>te(e)===t);if(!d)return{behavior:"allow"};const o=n(d);return"failed"===o?(s.log("lazy_payment_method_submission_blocked",`Blocked ${a}: selected ${d.type} method's chunk failed to load`,{methodType:d.type,loadState:o}),{behavior:"block",reason:I.PaymentMethodUnavailable,errors:[{message:r.translate("payment.payment_method_unavailable_error"),target:Qe}]}):"loading"===o&&xl.has(d.type)?(s.log("lazy_payment_method_submission_blocked",`Blocked ${a}: selected ${d.type} method's chunk is still loading`,{methodType:d.type,loadState:o}),{behavior:"block",reason:I.PaymentMethodLoading,errors:[{message:r.translate("payment.payment_method_loading_error"),target:Qe}]}):{behavior:"allow"}}
2)}function Il(e){return"choiceList"===e||"tiles"===e}function Ll({displayedPaymentMethods:e,selectedBillingAddress:t,allowPreselect:a=!0}){const{observability:r,userEvents:s,source:i,checkout:l,shop:d}=w(),{buyerHasActedSignal:o}=j(),[c,u]=dr({allowPreselect:a,displayedPaymentMethods:e}),{paymentErrors:m}=xn().value,p=He(),{updateCheckoutAddress:y}=or(),h=n(async(n,a)=>{o.value=!0,u(n,a,{buyerInitiated:!0});const c=e.find(e=>te(e)===n);if(c){const e=c.type,a=Oi(c)||c.type,o="paymentBrands"in c&&c.paymentBrands?c.paymentBrands.slice().sort().join(","):"";r.counter({name:"payment_method_selected",value:1,attributes:{payment_method_type:e,payment_method_name:a,payment_brands:o,location:Sl({identity:l.identity}),is_mobile:je()}}),"shopPay"===l.identity.current.value&&(s.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...q(i,l,d),action:"payment_method_selected",paymentMethodName:Pl(c)}}),t&&$e(n.toUpperCase())&&y({billingAddress:t},!0))}m.length>0&&await p.negotiate({silenceViolations:["all"],negotiationStage:"negotiation"})},[o,u,m.length,p,e,r,s,t,y,i,l,d]);return{selected:c,setSelected:u,setSelectedByBuyer:h,buyerHasActed:o.value}}function Bl(e,t,n){const a=te(e).toLowerCase(),r="name"in e?e.name.toLowerCase():"";if(n.has(a))return!0;if(Ue(e)&&n.has("ideal"))return!0;if(Oe(e)&&n.has("wallet-apple-pay"))return!0;if("customOnsite"===e.type&&e.paymentBrands.some(e=>n.has(e.toLowerCase())))return!0;for(const s of t){const t=s.id.toLowerCase();if(t===a||t===r)return!0;if(null!=s.name&&s.name.toLowerCase()===a)return!0;if("IDEAL"===s.paymentMethod&&Ue(e))return!0;if("APPLE_PAY"===s.paymentMethod&&Oe(e))return!0;if("customOnsite"===e.type&&"paymentBrands"in s&&Array.isArray(s.paymentBrands)){const t=e.paymentBrands.map(e=>e.toLowerCase());if(s.paymentBrands.some(e=>t.includes(e.toLowerCase())))return!0}}return!1}function Dl({errorBannerInContext:e,billingAddressInContext:a,vaultHandle:s,selectorShowsTiles:l,afterPaymentSelector:c,experienceType:u="list",renderVaultingAgreementInline:m}){const p=Sr().value,y=Ca(),{checkout:h,i18n:v}=w(),b=h.configuration.layout.isOnePage.value,g=h.installments.paymentMethodMustSupportDebitCardOnly.value,{displayedPaymentMethods:_,renderAsBareCard:C,billingAddressVariant:S,selectedBillingAddress:A}=Nr({experienceType:u}),M=Xn(),{guestCheckoutPaymentMethods:x}=function(){const{shopPay:e}=w(),{showGuestCheckoutPaymentMethods:n}=e.visibility,{value:a}=k({deferClientOnlyWalletsUntilHydrated:!0}),{displayedPaymentMethods:r,renderAsBareCard:s,billingAddressVariant:i,selectedBillingAddress:l}=Nr({experienceType:"list"}),d=e.session.promotedPaymentMethods.value,o=t(()=>function(e,t){const n=new Set;for(const a of e)a.lastUsedAt&&"id"in a&&n.add(a.id.toLowerCase());for(const a of t)a.lastUsedAt&&(null!=a.paymentBrand&&n.add(a.paymentBrand.toLowerCase()),null!=a.name&&n.add(a.name.toLowerCase()));return n}(e.user.paymentMethods.value??[],e.user.paymentMethodHistory.value??[]),[e.user.paymentMethods.value,e.user.paymentMethodHistory.value]),c=t(()=>r.filter(e=>!Bl(e,d,o)),[r,d,o]),u=t(()=>{if(!n)return[];const e=new Set(c);return(a??[]).filter(e=>!Bl(e,d,o)).filter(t=>!e.has(t)).filter(e=>!qe(e))},[a,d,o,n,c]),m=t(()=>[...c,...u],[u,c]),p=d.some(e=>"CREDIT_CARD"!==e.paymentMethod),y=s||Boolean(c.length>0&&0===u.length&&!p&&c.every(e=>"direct"===e.type));return{shopPayPaymentMethods:c,guestCheckoutPaymentMethods:u,combinedPaymentMethods:m,renderAsBareCard:y,billingAddressVariant:i,selectedBillingAddress:l}}(),E=Ki(),I=t(()=>_.filter(e=>"failed"!==E(e)),[_,E]),{selected:L,setSelected:B,setSelectedByBuyer:D,buyerHasActed:N}=Ll({displayedPaymentMethods:I,selectedBillingAddress:A}),T=Dt().value,F=ia().value,O=P().paymentLines,V=b&&!m&&T&&O.value.some(e=>"direct"===e.method.type)?void 0:"large-100",[z=""]=We(O.value);El({displayedPaymentMethods:_,selected:z,loadStateForMethod:E}),kl({displayedPaymentMethods:I,selected:L,setSelected:B,buyerHasActed:N});const R=o(null);!function(e,t,n){const a=o(t),r=o(null);if(a.current!==t){const s=a.current.some(e=>!t.includes(e));r.current=s?function(e,t){const n=document.activeElement;if(!(n instanceof HTMLInputElement))return null;const a=Ml(e,t).indexOf(n);return-1===a?null:a}(e.current,n):null,a.current=t}f(()=>{const t=r.current;if(r.current=null,null===t)return;if(document.activeElement!==document.body)return;const a=Ml(e.current,n);
20!==a.length&&a[Math.min(t,a.length-1)]?.focus({preventScroll:!0})},[n,e,t])}(R,t(()=>I.map(te),[I]),"basic");const H=d(null),j=s??H,{showPaymentTiles:$}=Mt(),U=function(e){const n=t(()=>e.filter(e=>"customOnsite"===e.type),[e]),a=t(()=>n.flatMap(({uiExtension:e})=>e?[e]:[]),[n]),r=cn("Checkout::PaymentMethod::Render",a),s=t(()=>r.map(Ye),[r]);return t(()=>{const e=s.some(e=>"local"===e.type);return new Set(n.flatMap(t=>e||void 0!==t.uiExtension&&s.includes(t.uiExtension)?[t.paymentMethodIdentifier]:[]))},[n,s])}(I),q=qr(I,U),{containerSize:Y,registerContainer:W}=function(e){const t=d(void 0),a=o(null),s=o(e);s.current=e,r(()=>()=>{a.current?.disconnect(),a.current=null},[]);const i=n(e=>{const n=function(e){return e>=498?"wide":e>=380?"compact":"compact-narrow"}(e),a=t.value;if(a===n)return;const r=()=>{t.value=n};void 0!==a&&s.current?.(a,n)?Hn(r,["payment-selector-change"]):r()},[t]),l=n(e=>{if(a.current?.disconnect(),a.current=null,t.value=void 0,!e)return;if("undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(([e])=>{e&&i(e.contentRect.width)});n.observe(e),a.current=n},[t,i]);return{containerSize:t,registerContainer:l}}((e,t)=>q(e,b,g).mode!==q(t,b,g).mode),G=n((e,t)=>{const n=I.map(te),a=n.indexOf(e),r=n.indexOf(L);-1!==a&&a!==r?Hn(()=>{D(e,t)},[-1===r||a>r?"payment-details-slide-end":"payment-details-slide-start"]):D(e,t)},[I,L,D]),K=t(()=>q(Y.value,b,g),[q,Y.value,b,g]);!function({containerSize:e,enabled:t,methodCount:n,mode:a}){const{observability:s}=w(),i=o(t&&Il(a)?{containerSize:e,methodCount:n,mode:a}:void 0);r(()=>{if(!t||!Il(a))return void(i.current=void 0);const r={containerSize:e,methodCount:n,mode:a},l=i.current;if(i.current=r,!l||l.methodCount!==n)return;if(l.mode===a)return;const d=void 0===l.containerSize&&void 0!==e,o=void 0!==l.containerSize&&void 0!==e&&l.containerSize!==e;(d||o)&&s.counter({name:"payment_selector_mode_changed",value:1,attributes:{from_container_size:l.containerSize??"unmeasured",from_mode:l.mode,method_count:n,to_container_size:e,to_mode:a,transition_source:d?"initial_measurement":"resize"}})},[e,t,n,a,s])}({containerSize:Y.value,enabled:$,methodCount:I.length,mode:K.mode});const[X]=I,J="singlePaymentMethodCreditCard"===K.mode&&void 0!==X&&ee(X)?X:void 0,Q=function({identity:e,guestCheckoutPaymentMethodCount:t,inlinePaymentMethod:n=!1}){return"shopPay"!==e.current.value||0===t?null:i(vi,{inlinePaymentMethod:n})}({identity:h.identity,guestCheckoutPaymentMethodCount:x.length,inlinePaymentMethod:Boolean(J)})??void 0,Z=m&&!F&&T?i(Gr,{borderless:!0}):void 0,ne=t(()=>I.map(e=>"name"in e?e.name:e.type),[I]),ae="deferred"===L||"creditCards"===L?L:void 0,re=Ar(h.identity,y.value);if(re)return i(Wn,{impressionType:"payment",impressionFeatures:[re],children:i(ga,{reason:re,minimal:b})});if(p.freeOrder)return i(Wn,{impressionType:"payment",impressionFeatures:["freeOrder"],children:i(ga,{reason:"freeOrder",minimal:b})});if(p.giftCard)return i(Wn,{impressionType:"payment",impressionFeatures:["giftCard"],children:i(ga,{reason:"giftCard",minimal:b})});if(p.storeCredit)return i(Wn,{impressionType:"payment",impressionFeatures:["storeCredit"],children:i(ga,{reason:"storeCredit",minimal:b})});if(p.redeemables)return i(Wn,{impressionType:"payment",impressionFeatures:["redeemables"],children:i(ga,{reason:"redeemables",minimal:b})});if(M.value)return i(tt,{background:"subdued",borderRadius:"base",paddingBlock:"large-500",placeItems:"center",children:i(Ct,{color:"subdued",textAlign:"center",children:v.translate("payment.loading")})});if(0===I.length)return i(Wn,{impressionType:"payment",impressionFeatures:Qr(ne,K),children:i(Zr,{error:_.length>0?"script":"no_methods"})});const se=Dr({identity:h.identity,billingAddressInContext:a,billingAddressVariant:S});let ie;if(J)ie=i(st,{paddingBlockEnd:V,children:i(hi,{method:J,onSelect:D,vaultHandle:j,blockFooter:Q,selectedContentFooter:Z})});else if("tiles"===K.mode){const e=i(ol,{methods:I,selected:L,onSelect:G,selectorShowsTiles:l,tileSupportedCustomOnsitePaymentMethods:U});ie=i(Ze,{gap:"large-100",children:["redesigned"===K.choiceListPresentation?i(Yn,{borderSelected:"large100",children:e}):e,i(hl,{variant:"details",children:i(fl,{methods:I,selected:L,onSelect:G,vaultHandle:j,directMethodSelectedContentFooter:Z})}),Q]})}else ie=i(st,{paddingBlockEnd:V,ref:R,children:i(Zi,{methods:I,selected:L,onSelect:D,renderAsBareCard:C,vaultHandle:j,blockFooter:Q,directMethodSelectedContentFooter:Z})});return i(Ln,{target:"cart.paymentLines[0]",children:i(Wn,{impressionType:"payment",impressionFeatures:Qr(ne,K),children:i(ts,{errorBannerInContext:e,billingAddressInContext:a,selectedPaymentMethod:L,billingAddressVariant:S,children:i(Ze,{ref:W,gap:"base",children:[!C&&i(rl,{selectedPaymentMethod:ae}),i(hl,{variant:"selector",children:ie}),c,se]})})})})}function Nl(){const{i18n:e,environment:t,shopPay:n}=w(),a=Bn(),{surface:r,version:s}=n.app.config,d="web"!==r;if(d&&!ur(s,"3.7.0"))return i(l,{children:e.translate("payment_errors.duplicate_autopay_card_without_link")});const o=i(l,{children:[e.translate("payment_errors.duplicate_autopay_card_link")," ",i(_t,{type:"external",size:"small",display:"inline"})]});return i(l,{children:e.translate("payment_errors.duplicate_autopay_card",{update_payment_details_link:i(zt,d?{onClick:()=>a.notify({open_upcoming_payments:!0}),children:o}:{href:(c=t.services.shopServer.url,new URL("/pay/account/installments",c).href),target:"_blank",children:o})})});var c}const Tl="Timed out while processing the 3DS challenge modal.",Fl=()=>{const e=o(!1),[t,s]=a(void 0),{observability:i}=w();return r(()=>{if(t)return window.addEventListener("message",t.messageListener),t.telemetryAttributes&&i.log("shop_pay_three_ds_listener_started","[ShopPay] 3DS postMessage listener started",t.telemetryAttributes),()=>window.removeEventListener("message",t.messageListener)},[t,i]),{listen:n(({onComplete:t,telemetryContext:n})=>{e.current=!1;const a=Date.now(),r=n?function(e){return{listenerType:"shop_pay_three_ds_listener",modalSourceType:e.modalSourceType,sourceHostCategory:T
2n(e.source),selectedPaymentMethod:e.selectedPaymentMethod,isInstallmentsSelected:e.isInstallmentsSelected,...e.buyerCountryCode?{buyerCountryCode:e.buyerCountryCode}:{},surface:e.surface}}(n):void 0,l=(n,a)=>{if(!e.current){e.current=!0;try{a?.()}catch{}try{t(...n)}catch(r){i.error(new Ge(`Error in 3DS onComplete handler: ${r}`,{groupingHash:"ShopPayError::ThreeDSecureOnComplete"}))}}},d=setTimeout(()=>{s(void 0),l([{errors:[{message:Tl}]}],()=>{i.log("use_three_ds_listener_timed_out",Tl),r&&i.log("shop_pay_three_ds_listener_timed_out",Tl,{...r,elapsedTimeMs:Date.now()-a})})},Dn);s({messageListener:async function({data:t,origin:n}){t.type===Nn&&(e.current||(s(void 0),clearTimeout(d),l([],()=>{r&&i.log("shop_pay_three_ds_listener_completed","[ShopPay] 3DS postMessage received",{...r,dataType:Nn,originHostCategory:Tn(n),elapsedTimeMs:Date.now()-a})})))},telemetryAttributes:r})},[i])}};class Ol extends Error{constructor(){super("Card fields functions are unavailable"),this.name="CardFieldsFunctionsUnavailableError"}}function Vl({vaultHandle:e}){const{checkout:{validation:s},i18n:d}=w(),{creditCardErrors:o,setCreditCardErrors:c,blockDuplicateAutopayCard:u}=_a(),[m,p]=function(e){const{i18n:n,observability:a,userEvents:r,source:s,checkout:{configuration:i},shop:l}=w(),d=t(()=>Ee(),[]),o=e||d;return[o,function(e,t){rr({addressErrors:o,shopPayErrors:e,i18n:n,observability:a,userEvents:r,source:s,configuration:i,shop:l,addressContext:"billing",submittedAddress:t})}]}(s.billingAddressErrors),[y,h]=function(){const[e,t]=a(null),r=Bn(),{checkoutProtocolModalEventSignal:s}=j();return[e,n(e=>{const n=null===e?"modal_close":"modal_open";s.value="modal_open"===n?"redesign":"none",r.notify({checkout_ui:{type:n,payload:{duration:Ta}}}),t(e)},[r,s])]}(),v=Fn({source:y,logMessage:"[ShopPayPaymentMethodProgressionHost] Action required modal iframe loaded; this does not prove issuer challenge rendered",telemetryContext:{modalSourceType:"shop_pay_interceptor_three_ds_modal_url"}}),b=n(()=>{const t=e.value;if(!t)throw new Ol;return t.validate()},[e]),g=n(async()=>{const t=e.value;if(!t)throw new Ol;return t.vaultCardWithSelectedNetwork()},[e]);r(()=>{const t=e.value;t&&t.setFieldErrors(o.fieldErrors)},[o,e]);const f=function({onAddressValidationErrors:e,onSaveCardErrors:t,onDuplicateAutopayCard:a,onSaveCardBillingAddressErrors:r,onThreeDSUrlChange:s,validateCardFields:i,vaultCardWithSelectedNetwork:l}){const{shopPay:d,checkout:o,observability:c}=w(),u=Ca(),{paymentLines:m,billingAddressOption:p,shippingAddress:y,billingAddress:h}=P(),v=o.installments.paymentMethodMustSupportDebitCardOnly,b=lt(),g=o.isShippingRequired.value&&"shipping"===p.value&&!b.value?y.value:h.value,f=o.configuration.addressSettings.billingAddressSettings.value,_=it(g?.countryCode,void 0,f),C=fa(),{listen:S}=Fl(),{creditCardDisabled:A}=Ba(),k="authenticated_user"===d.user.flow.peek(),M=n(e=>A(e)?{success:!1,location:"intercept_card_not_good_for_installments"}:{success:!0},[A]),x=n(async({errors:e}={},n,r)=>{if(e||!g)return t(),s(null),void r({success:!1,location:"intercept_3ds_challenge_complete_error"});let i=null;try{const e=await C.completeCreditCardVerificationAndVault({verificationId:n,billingAddress:g,nickname:null,debitOnly:v.value});"success"===e.status?i=d.session.isInstallmentsSelected.value?M(e.creditCard):{success:!0}:"blocked_by_autopay"===e.status?(a(),i={success:!1,location:"intercept_credit_card_blocked_by_autopay"}):(t(e.errors),i={success:!1,location:"intercept_complete_credit_card_verification_failed"})}catch{t(),i={success:!1,location:"intercept_complete_credit_card_verification_error_caught"}}s(null),r(i)},[g,C,v,d.session.isInstallmentsSelected,M,a,t,s]),E=n(async(e,t)=>new Promise(n=>{S({onComplete:t=>x(t??{},e,n),telemetryContext:{buyerCountryCode:g?.countryCode,isInstallmentsSelected:d.session.isInstallmentsSelected.value,modalSourceType:"shop_pay_interceptor_three_ds_modal_url",selectedPaymentMethod:d.session.isInstallmentsSelected.value?"shop_pay_installments":"shop_pay",source:t,surface:"checkout-web"}})}),[x,S,g?.countryCode,d.session.isInstallmentsSelected]);return n(async()=>{try{if(u.value)return{success:!0};const[n]=m.value;if(!n)return{success:!1,location:"intercept_no_payment_lines"};if("direct"!==n.method.type)return{success:!0};if(!g)return{success:!1,location:"intercept_no_selected_billing_address"};const{isValid:y}=i(),h=_(g,"billing");if("shipping"===p.value&&o.isShippingRequired.value||e(h),!y)return{success:!1,location:"intercept_credit_card_not_valid"};if(0!==h.size)return{success:!1,location:"intercept_billing_address_has_errors"};if(!k)return{success:!0};const b=await l(),f=await C.addCreditCard({sessionId:b,billingAddress:g,nickname:null,debitOnly:v.value,isBlocking:!0});if("success"===f.status)return d.session.isInstallmentsSelected.value?M(f.credit
2Card):{success:!0};if("requires_redirect"===f.status){const{redirectUrl:e,verificationId:t}=f.threeDSecureAuthenticationRequest;return d.session.isInstallmentsSelected.value&&c.log("shop_pay_installments_3ds_modal_url_set","[ShopPayPaymentMethodInterceptor] Shop Pay Installments 3DS modal URL set",{buyerCountryCode:g?.countryCode,isInstallmentsSelected:!0,modalSourceType:"shop_pay_interceptor_three_ds_modal_url",selectedPaymentMethod:"shop_pay_installments",sourceHostCategory:Tn(e),surface:"checkout-web"}),s(e),E(t,e)}return"blocked_by_autopay"===f.status?(a(),{success:!1,location:"intercept_credit_card_blocked_by_autopay"}):(t(f.errors),r(f.errors?.filter(e=>"billingAddress"===e.field[0]),g),{success:!1,location:"intercept_credit_card_not_saved"})}catch(n){if(n instanceof Ol)return t(),{success:!1,location:"intercept_vault_handle_unavailable"};throw n}},[u,m,g,i,_,p,o.isShippingRequired,k,l,C,v,d.session.isInstallmentsSelected,E,M,c,a,t,r,e,s])}({onAddressValidationErrors:e=>{for(const[t,n]of Array.from(e))m[t].value=n},onSaveCardErrors:c,onDuplicateAutopayCard:u,onSaveCardBillingAddressErrors:p,onThreeDSUrlChange:h,validateCardFields:b,vaultCardWithSelectedNetwork:g});return Da("paymentMethod",f),i(l,{children:[i(On,{source:y,title:d.translate("processing.action_required"),onIframeLoad:v}),o.baseMessage&&i(Nt,{tone:"critical",children:o.baseMessage}
2),o.blockedByDuplicateAutopayCard&&i(Nt,{tone:"critical",children:i(Nl,{})})]})}function zl({vaultHandle:e}){const{checkout:{identity:{current:t}}}=w();return"shopPay"===t.value?i(Vl,{vaultHandle:e}):null}export{Ai as A,us as B,Bi as C,Nl as D,ml as E,Fi as F,as as G,pi as H,Vs as I,Ll as J,El as K,Ei as L,Hi as M,vr as N,Pi as O,gr as P,ai as Q,ni as R,ri as S,si as T,Gr as V,Yr as a,Sr as b,Cr as c,_r as d,Wr as e,Qr as f,Ar as g,Dl as h,hr as i,zl as j,kr as k,Fl as l,fr as m,zs as n,Dr as o,ts as p,rl as q,Zi as r,ms as s,ds as t,Nr as u,bs as v,ps as w,wl as x,pl as y,ul as z};
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.