const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["4b77f49a.4HmIEZUf.js","60a453ce.B80X1bY8.js","4b4bc88f.z1yoAwwH.js","2c1ab0fe.Dbn2KvkT.js","app.CooG55fE.js","assets/app.CcGlIMpn.css","assets/wallet-prefilled-guest-return.BZwmSkmD.css","66338e00.Da1xn8CS.js","e77d135d.Dz0RetrO.js","e03065ab.CTM9K0Hk.js","24fcbaf6.B9Of6sC3.js","ca3e798e.BBho0lps.js","3d539943.CHiZMBrZ.js","b13c0af6.D4KDplwL.js","bfe75f31.CeEm_sIx.js","2bac2c53.CBL7jHzd.js","9dba8418.NidtnoQ4.js","cb38e5c2.BMWpCITo.js","2255f8fa.CYWjsjse.js","d25d1b95.DYvnxyL-.js","b8733b27.zcrWwlcv.js","e39bc11c.CPXDRKy_.js","08a3b809.Ce8w6gv6.js","2b0dcdd4.C-0LQ8Y0.js","1a6c2867.D8mTtJ_Z.js","assets/ShopPayVerificationTrigger.BnDF3H7t.css","7fc410e0.mP12JRDt.js","e477f96c.DtwGO4P4.js","ac5a19ff.la4o1mqh.js","69fae6d4.DwAzRqQZ.js","2689105d.C7bJWqBq.js","948fe603.B91g8n40.js","2210eadb.DF0gIp_2.js","a5d89e05.CcJuMH1P.js","41e85f1e.CGpBOiN4.js","f67abd2c.nPTvXZJz.js","9ce08e25.CVFGyfHb.js","cadec7c0.C_I0AZZC.js","c6b02d73.Ba1sudbg.js","9655ebc9.CX4pB1Ku.js","711bf263.Ymiv-Iw4.js","e12db40c.DF32J314.js","5c5c2e96.DrOQZbeh.js"])))=>i.map(i=>d[i]); import{S as e,_ as t,d as s,t as i,T as n,F as r,U as a,f as o,g as d,h as l,C as u,p as c,a as h}from"./app.CooG55fE.js";import{z as p,y as g,B as m,O as y,N as v,n as f,$ as b,k as S,x as A,l as _,aH as P,aI as C,aJ as k,aK as E,aL as w,aM as T,aN as M,aO as I,aP as D,aQ as R,aR as x,aS as L,aT as O,V as B,W as F,aU as N,aV as U,aE as q,aW as V,aq as z,aX as H,aY as j,aZ as W,a_ as $,a$ as G,b0 as Y,b1 as J,b2 as K,b3 as X,b4 as Q,ah as Z,ag as ee,b5 as te,b6 as se,ax as ie,at as ne,aw as re,b7 as ae}from"./2c1ab0fe.Dbn2KvkT.js";import{k6 as oe,fF as de,k7 as le,gx as ue,cI as ce,G as he,dv as pe,af as ge,h4 as me,F as ye,k8 as ve,k9 as fe,a8 as be,ka as Se,kb as Ae,kc as _e,kd as Pe,aF as Ce,gF as ke,a3 as Ee,j5 as we,ke as Te,aK as Me,fz as Ie,kf as De,w as Re,aW as xe,dU as Le,b0 as Oe,h$ as Be,hQ as Fe,gA as Ne,kg as Ue,kh as qe,ki as Ve,kj as ze,b7 as He,kk as je,kl as We,km as $e,kn as Ge,ko as Ye,kp as Je,kq as Ke,kr as Xe,t as Qe,aH as Ze,ao as et,ks as tt,kt as st,ku as it,kv as nt,H as rt,c8 as at,fc as ot,kw as dt,a7 as lt,kx as ut,ky as ct,C as ht,iM as pt,gd as gt,kz as mt,aX as yt,eU as vt,aB as ft,kA as bt,kB as St,ca as At,kC as _t,kD as Pt,kE as Ct,fY as kt,kF as Et,fZ as wt,kG as Tt,f$ as Mt,kH as It,kI as Dt,b4 as Rt,kJ as xt,kK as Lt,kL as Ot,kM as Bt,kN as Ft,kO as Nt,kP as Ut,d6 as qt,gC as Vt,kQ as zt,kR as Ht,q as jt,aw as Wt,bS as $t,kS as Gt,Z as Yt,kT as Jt,kU as Kt,kV as Xt,bE as Qt,ji as Zt,g5 as es,kW as ts,g_ as ss,kX as is,ct as ns,kY as rs,au as as,kZ as os,k_ as ds,k$ as ls,ey as us,ex as cs,l0 as hs,l1 as ps,l2 as gs,l3 as ms,l4 as ys,l5 as vs,l6 as fs,eg as bs,hM as Ss,l7 as As,l8 as _s,l9 as Ps,ih as Cs,hT as ks,ij as Es,la as ws,lb as Ts,eb as Ms,lc as Is,ld as Ds,le as Rs,lf as xs,e0 as Ls,ii as Os,lg as Bs,bC as Fs,h5 as Ns,eh as Us,lh as qs,li as Vs,lj as zs,lk as Hs,bI as js,ic as Ws,ll as $s,lm as Gs,hR as Ys,ln as Js,lo as Ks,hW as Xs,hX as Qs,et as Zs,lp as ei,hY as ti,hZ as si,hy as ii,h_ as ni,hU as ri,i0 as ai,i2 as oi,i3 as di,lq as li,i4 as ui,lr as ci,ls as hi,eu as pi,es as gi,lt as mi,lu as yi,i5 as vi,lv as fi,i1 as bi,hS as Si,x as Ai,lw as _i,J as Pi,lx as Ci,f6 as ki,c as Ei,ly as wi,R as Ti,W as Mi,jS as Ii,jT as Di,jW as Ri,jV as xi,jU as Li,gj as Oi,lz as Bi,lA as Fi,ak as Ni,eJ as Ui,gY as qi,lB as Vi,lC as zi,dV as Hi,lD as ji,lE as Wi,I as $i,j7 as Gi,dy as Yi,j6 as Ji,aV as Ki,fD as Xi,lF as Qi,lG as Zi,iz as en,lH as tn,cc as sn,f1 as nn,f2 as rn,O as an,lI as on,lJ as dn,f0 as ln,lK as un,N as cn,lL as hn,lM as pn,ja as gn,it as mn,lN as yn,lO as vn,lP as fn,lQ as bn,lR as Sn,lS as An,ia as _n,lT as Pn,o as Cn,r as kn,s as En,cj as wn,lU as Tn,lV as Mn,lW as In,lX as Dn,lY as Rn,fh as xn,lZ as Ln,l_ as On,fi as Bn,l$ as Fn,m0 as Nn,m1 as Un,fj as qn,m2 as Vn,m3 as zn,m4 as Hn,cb as jn,m5 as Wn,aD as $n,fX as Gn,aG as Yn,m6 as Jn,aI as Kn,eY as Xn,m7 as Qn,m8 as Zn,iL as er,dt as tr,fd as sr,bz as ir,m9 as nr,ma as rr,mb as ar,mc as or,md as dr,me as lr,mf as ur,l as cr,mg as hr,mh as pr,jj as gr,jk as mr,mi as yr,fl as vr,mj as fr,aC as br,mk as Sr,fH as Ar,fJ as _r,bM as Pr,ml as Cr,ez as kr,mm as Er,fA as wr,fB as Tr,fC as Mr,mn as Ir,mo as Dr,mp as Rr,mq as xr,mr as Lr,ms as Or,e9 as Br,mt as Fr,mu as Nr,fI as Ur,mv as qr,E as Vr,ff as zr,d8 as Hr,mw as jr,mx as Wr,my as $r,mz as Gr,mA as Yr,mB as Jr,mC as Kr,mD as Xr,fo as Qr,mE as Zr,mF as ea,mG as ta,mH as sa}from"./4b4bc88f.z1yoAwwH.js";import{S as ia,i as na,O as ra,C as aa,d as oa,e as da,t as la,s as ua,w as ca,b as ha,F as pa}from"./bfe75f31.CeEm_sIx.js";import{s as ga,d as ma,b as ya,c as va,i as fa,g as ba,e as Sa,f as Aa,p as _a}from"./2bac2c53.CBL7jHzd.js";import{f as Pa,S as Ca}from"./9dba8418.NidtnoQ4.js";import{g as ka}from"./cb38e5c2.BMWpCITo.js";import{g as Ea,q as wa,i as Ta}from"./3d539943.CHiZMBrZ.js";import{m as Ma,b as Ia,g as Da,a as Ra,n as xa,p as La,o as Oa,r as Ba,q as Fa,k as Na,s as Ua,u as qa,i as Va,j as za,t as Ha,f as ja,l as Wa,v as $a,h as Ga,e as Ya}from"./2255f8fa.CYWjsjse.js";import{c as Ja,d as Ka,b as Xa}from"./d25d1b95.DYvnxyL-.js";import{r as Qa}from"./b8733b27.zcrWwlcv.js";import{n as Za,s as eo}from"./e39bc11c.CPXDRKy_.js";import{s as to,b as so}from"./08a3b809.Ce8w6gv6.js";const io={id:"df45827feaff690c722f0e21468695296dab0db4f3280588c78404ff71c9e607",type:"query",name:"CheckoutContext",source:""},no={id:"d86c24ba847c0583a6cdd93ad932edcc9f527c9360b5a596103ab32aa1aef57e",type:"query",name:"FinancingPlans",source:""},ro={id:"3cd8163c889b25bc744486a9660d0301ebc80659eabdf66690c58dd37bbdb115",type:"query",name:"RequestInfo",source:""},ao={id:"6c8a3a5bcd1d2cbb245c334c21cef3b09ad7ce514c0eed061ceb713227f49b43",type:"query",name:"Theme",source:""},oo={id:"5638616fb05cb50fa18d4cba4335a74898a1bfebfdc79a784e07dacd23898e17",type:"query",name:"ShippingCountries",source:""};class lo extends e{constructor(){super(...arguments),this.name="BrandingMissingShopError"}}class uo{constructor({observability:e,errors:t}){this.selectedAddress=p(()=>this.findAddressById(this.selectedAddressId.value)),this.#e=g(!1),this.#t=g("ADDRESS_CHANGES_UNAVAILABLE"),this.#s=g([]),this.#i=g({type:null,isValid:!1,isLoading:!1}),this.#n=g(!1),this.getAddressDisplayName=e=>{},this.selectAddress=async e=>{const t=this.findAddressById(e);return t?this._selectAddress(t):(this.observability.error(new oe(`Address with id "${e}" not found`,{groupingHash:"AddressManager::selectAddress::InvalidSelectedAddressError"})),!1)},this.createAddress=async({address:e,setDefault:t=!1,selectAddress:s=!0,addressErrorsOverride:i})=>{if(this.canCreateAddress.value&&(!t||this.canSetDefaultAddress.value))return this._createAddress({address:e,setDefault:t,selectAddress:s,addressErrorsOverride:i})},this.updateAddress=async({id:e,address:t,setDefault:s=!1,addressErrorsOverride:i})=>{if(this.canUpdateAddress.value&&(!s||this.canSetDefaultAddress.value))return e===de?this._updateEphemeralAddress({address:t}):this._updateAddress({id:e,address:t,setDefault:s,addressErrorsOverride:i})},this.deleteAddress=async e=>!!this.canDeleteAddress.value&&this._deleteAddress(e),this.setDefaultAddress=async e=>{if(!this.canSetDefaultAddress.value)return!1;const t=this.addresses.value.find(t=>t.id===e);return t?this._setDefaultAddress({id:e,address:t.address}):(this.observability.error(new oe(`Address with id "${e}" not found in mutable addresses`,{groupingHash:"AddressManager::setDefaultAddress::InvalidSelectedAddressError"})),!1)},this.applyAddressChange=async({source:e,address:t})=>{const s=this.applyAddressChangeBlockReason(e).value;return s?{type:"failure",reason:s}:this._applyAddressChange({source:e,address:t})},this.observability=e,this.errors=t}#e;#t;#s;#i;#n;get canCreateAddress(){return this.#e}get canUpdateAddress(){return this.#e}get canDeleteAddress(){return this.#e}get canSetDefaultAddress(){return this.#e}applyAddressChangeBlockReason(e){return this.#t}get suggestedAddress(){return this.#i}get isMissingValidSuggestedAddress(){return this.#n}dispose(){}get immutableAddressSections(){return this.#s}get addressesTitle(){}_selectAddress(e){throw new le}_updateAddress(e){throw new le}_updateEphemeralAddress(e){throw new le}_createAddress(e){throw new le}_deleteAddress(e){throw new le}async _setDefaultAddress(e){throw new le}async _applyAddressChange(e){throw new le}findMatchingAddress(e,{ignoreFields:t=[],ignoreIds:s=[]}={}){return[...this.addresses.value,...this.immutableAddresses.value].find(i=>!s.includes(i.id)&&ue(i.address,e,t))}withCoordinates(e){return{...e,coordinates:e.coordinates}}findAddressById(e){if(!e)return;return this.addresses.value.find(t=>t.id===e)||this.immutableAddresses.value.find(t=>t.id===e)}}class co extends uo{constructor(e){super({observability:e,errors:{banner:g(void 0),fields:ce()}}),this.#r=g([]),this.selectedAddressId=g(void 0),this.addresses=this.#r,this.immutableAddresses=this.#r}#r}function ho(e,t,s){if(e===t&&s)return he(s)?s.location.name:s.company.name}class po extends uo{constructor({observability:e,buyerIdentity:t,billingAddressFact:s,address:i,billingCountries:n,billingAddressSettings:r,deliveryNext:a,additionalFieldsEnabled:o,i18n:d,isLoadingBilling:l,isValidShippingAddress:u,isLoadingShipping:c}){super({observability:e,errors:{banner:g(void 0),fields:ce()}}),this.selectedAddressId=g(ia),this.#a=g([]),this.getAddressDisplayName=e=>ho(e,ia,this.buyerIdentity.value?.purchasingCompany),this.buyerIdentity=t;const{countryDetails:h,extendedAddressMode:m}=i,y=p(()=>{const e=t.value?.purchasingCompany,s=e?.location.billingAddress,i=s?ge(s)?.countryCode:void 0;return na({purchasingCompany:e,billingCountries:n,addressSettings:r,countryDetails:i?h.get(i):void 0,editFormat:m.getFormat(i,null),deliveryNextValue:a.value,additionalFieldsEnabled:o,i18n:d})});this.suggestedAddressResult=function({buyerIdentity:e,billingAddressFact:t,isValidBillingAddress:s,isLoadingBilling:i,isValidShippingAddress:n,isLoadingShipping:r}){return p(()=>{const a=e.value?.purchasingCompany;if(!a)return{address:void 0,type:null,isValid:!1,isLoading:!1};const o=a.location.billingAddress,d=a.location.shippingAddress;return!t||o&&pe(t,o)?r.value||i.value?{address:void 0,type:null,isValid:!1,isLoading:!0}:o&&s.value?{address:o,type:"billing",isValid:!0,isLoading:!1}:d&&n.value?{address:d,type:"shipping",isValid:!0,isLoading:!1}:o&&!s.value?{address:o,type:null,isValid:!1,isLoading:!1}:d&&!n.value?{address:d,type:null,isValid:!1,isLoading:!1}:{address:void 0,type:null,isValid:!1,isLoading:!1}:{address:t,type:"billing-fact",isValid:!0,isLoading:!1}})}({buyerIdentity:t,billingAddressFact:s,isValidBillingAddress:y,isLoadingBilling:l,isValidShippingAddress:u,isLoadingShipping:c}),this.#o=p(()=>{const{isValid:e,isLoading:t}=this.suggestedAddressResult.value;return!e&&!t}),this.addresses=this.#a,this.immutableAddresses=p(()=>{const e=this.suggestedAddressResult.value;return e.isValid&&e.address?[{id:ia,address:e.address}]:[]})}#o;#a;get suggestedAddress(){return this.suggestedAddressResult}get isMissingValidSuggestedAddress(){return this.#o}}class go extends po{#a;#d;#l;#u;#c;#h=g(!0);#p;get canCreateAddress(){return this.#c}get canUpdateAddress(){return this.#h}constructor({proposalAddress:e,billingAddressOption:t,buyerIdentity:s,billingAddressFact:i,isValidShippingAddress:n,isLoadingShipping:r,observability:a,sourceType:o,address:d,billingCountries:l,billingAddressSettings:u,deliveryNext:c,additionalFieldsEnabled:h,isThrottled:y,i18n:v}){const{countryDetails:f}=d,b=p(()=>{const e=s.value?.purchasingCompany;return ge(e?.location.billingAddress)?.countryCode}),S=p(()=>{const e=b.value;return!!e&&(!(!y.value||void 0!==f.get(e))||f.isLoading(e))});super({observability:a,buyerIdentity:s,billingAddressFact:i,address:d,billingCountries:l,billingAddressSettings:u,deliveryNext:c,additionalFieldsEnabled:h,i18n:v,isLoadingBilling:S,isValidShippingAddress:n,isLoadingShipping:r});const A=m(()=>{const e=b.value;e&&!y.value&&f.fetch(e)}),_=g(void 0);"custom"===t.value&&e.value&&!_.value&&(_.value=e.value);const P=p(()=>{const e=_.value;return e?[{id:ra,address:e}]:[]});this.#a=P,this.addresses=this.#a,this.#c=p(()=>this.addresses.value.length+this.immutableAddresses.value.length<2),this.selectedAddressId=p(()=>"custom"===t.value?ra:ia),this.#d=e,this.#l=_,this.#u=t;let C=!1;const k=m(()=>{if(C)return;const i=function({suggested:e,purchasingCompany:t,billingAddressOption:s,proposedAddress:i,sourceType:n}){if(e.isLoading)return{settled:!1};if(!t||!e.address)return{settled:!0};const r="custom"===s&&me(i);if(null===e.type&&r)return{settled:!0};const a=null===e.type,o=null!=n&&ye(n)&&"billing-fact"===e.type;return e.type===s||a||o?{settled:!0,address:e.address}:{settled:!1}}({suggested:this.suggestedAddressResult.value,purchasingCompany:s.value?.purchasingCompany,billingAddressOption:t.value,proposedAddress:e.peek(),sourceType:o});i.settled&&(C=!0,!i.address||e.value&&ue(i.address,e.value)||(e.value=i.address))}),E=m(()=>{const e=this.suggestedAddressResult.value,i=s.value?.purchasingCompany;if(!i)return;const n="custom"!==t.value&&!e.type&&!e.isLoading,r="billing"===t.value&&"shipping"===e.type;n?t.value="custom":r&&(t.value="shipping")});this.#p=[A,k,E]}dispose(){for(const e of this.#p)e();super.dispose()}_selectAddress(e){if(this.#d.value=e.address,e.id===ia){const e=this.suggestedAddressResult.value.type;e&&(this.#u.value=e)}else this.#u.value="custom";return Promise.resolve(!0)}async _createAddress({address:e,selectAddress:t}){const s={id:ra,address:e};return this.#l.value=e,t?(this.#u.value="custom",this.#d.value=e,s):s}_updateAddress({id:e,address:t}){if(e!==ra)return Promise.resolve(void 0);const s={id:e,address:t};return this.#l.value=t,this.#u.value="custom",this.#d.value=t,Promise.resolve(s)}}class mo extends uo{constructor({observability:e,buyerIdentity:t,proposalAddress:s}){super({observability:e,errors:{banner:g(void 0),fields:ce()}}),this.getAddressDisplayName=e=>ho(e,aa,this.buyerIdentity.value?.purchasingCompany),this.buyerIdentity=t,this.companyLocationAddress=p(()=>t.value?.purchasingCompany?.location.shippingAddress??void 0),this.hasEditableShippingAddress=p(()=>{const e=t.value?.customerProfile;return Boolean("BusinessCustomerProfile"===e?.__typename&&e?.checkoutExperienceConfiguration?.editableShippingAddress)}),this.immutableAddresses=p(()=>{const e=this.companyLocationAddress.value;return e?[{id:aa,address:e}]:[]}),this.#a=p(()=>{const e=this.companyLocationAddress.value,t=s.value;return e&&t&&!ue(e,t)?[{id:oa,address:t}]:[]}),this.addresses=this.#a,this.#c=p(()=>this.hasEditableShippingAddress.value&&this.addresses.value.length+this.immutableAddresses.value.lengththis.addresses.value.length>0?oa:aa)}#a;#c;get canCreateAddress(){return this.#c}get canUpdateAddress(){return this.hasEditableShippingAddress}}class yo extends mo{#a;#d;#g;#m;#p;constructor({proposalAddress:e,buyerIdentity:t,mustSelectProvidedAddress:s,canUpdateDeliveryAddress:i,observability:n,address:r,shippingCountries:a,shippingAddressSettings:o,deliveryNext:d,additionalFieldsEnabled:l,isThrottled:u,i18n:c}){super({observability:n,buyerIdentity:t,proposalAddress:e});const{countryDetails:h,extendedAddressMode:y}=r,v=g(void 0);this.#a=p(()=>{const e=v.value;return e?[{id:oa,address:e}]:[]}),this.addresses=this.#a;const f=p(()=>{const e=t.value?.purchasingCompany;return ge(e?.location.shippingAddress)?.countryCode}),b=m(()=>{const e=f.value;e&&!u.value&&h.fetch(e)});this.isValidShippingAddress=p(()=>{const e=t.value?.purchasingCompany,s=f.value;return fe({purchasingCompany:e,shippingCountries:a,addressSettings:o,countryDetails:s?h.get(s):void 0,editFormat:y.getFormat(s,null),deliveryNextValue:d.value,additionalFieldsEnabled:l,i18n:c})}),this.isLoadingShippingAddress=p(()=>{const e=f.value;return!!e&&(!(!u.value||void 0!==h.get(e))||h.isLoading(e))}),this.#m=p(()=>!1===i.value?"DELIVERY_ADDRESS_NOT_EDITABLE":!this.hasEditableShippingAddress.value||s.value?"MUST_SELECT_PROVIDED_ADDRESS":void 0);const S=t.value?.purchasingCompany?.location.shippingAddress;S&&e.value&&!ue(S,e.value)&&(v.value=e.value),this.selectedAddressId=g(v.value?oa:aa),this.#d=e,this.#g=v;let A=!1,_=this.companyLocationAddress.peek();const P=m(()=>{const t=this.companyLocationAddress.value;A?t&&(_&&ue(t,_)||(_=t,this.selectedAddressId.peek()===aa&&(e.value=t))):A=!0});this.#p=[b,P]}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#m;default:return y(e)}}dispose(){for(const e of this.#p)e();super.dispose()}_selectAddress(e){return this.selectedAddressId.value=e.id,this.#d.value=e.address,Promise.resolve(!0)}async _createAddress({address:e,selectAddress:t}){const s={id:oa,address:e};return this.#g.value=e,t?(this.selectedAddressId.value=s.id,this.#d.value=e,s):s}async _updateAddress({id:e,address:t}){if(e!==oa)return Promise.resolve(void 0);const s={id:e,address:t};return this.#g.value=t,this.selectedAddressId.value=e,this.#d.value=t,Promise.resolve(s)}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[oa]});if(t)return await this._selectAddress(t),this.#g.value=void 0,{type:"success",address:t};const s={id:oa,address:e};return this.#g.value=e,await this._selectAddress(s),{type:"success",address:s}}}function vo(e){let t=e.value.map(e=>e.id);return p(()=>{const s=e.value,i=s.map(e=>e.id),n=t,r=i.filter(e=>!n.includes(e)),a=n.filter(e=>i.includes(e));return(r.length>0||a.length!==n.length)&&(t=[...a,...r]),[...s].sort((e,s)=>{const i=t.indexOf(e.id),n=t.indexOf(s.id);return-1===i?1:-1===n?-1:i-n})})}const fo={id:"07f9d37cebb26f74594ea5b6dc354ea01d222d8897f503e823e91a9aa33fef98",type:"mutation",name:"CreateCustomerAddress",source:""},bo={id:"4a72f72ab7d4a46e063c4caeafc6826b16e2521dfcbcf9a5d73bbd8c37f8d791",type:"mutation",name:"DeleteCustomerAddress",source:""},So={id:"61d3f70f7da3acacb12e8eab2c66260c3a97d79f6a9593fd21f23c464de341c7",type:"mutation",name:"ModifyCustomerAddress",source:""};function Ao(e,t){return{createAddressMutation:Co(e,t),updateAddressMutation:ko(e,t),deleteAddressMutation:Eo(e)}}const _o=new Set(["BUYER_IDENTITY_CUSTOMER_ACCOUNT_REQUIRED","BUYER_IDENTITY_CONTACT_INFO_DOES_NOT_MATCH_CUSTOMER_PROFILE","DESTINATION_ADDRESS_REQUIRED"]);function Po(e,t){return e||t.errors.some(e=>_o.has(e.code))}function Co(e,t){return async s=>{const{data:i,error:n}=await e.mutate(fo,{variables:{address:wo(s.address,t),setDefault:s.setDefault}});if(!i?.createCustomerAddress||Po(n,i.createCustomerAddress))return{status:"failed_unknown"};const{result:r,errors:a}=i.createCustomerAddress;return!r||a.length>0?{status:"failed",errors:Mo(a)}:{status:"success",address:To(r)}}}function ko(e,t){return async s=>{const{data:i,error:n}=await e.mutate(So,{variables:{address:wo(s.address,t),id:s.id,setDefault:s.setDefault}});if(!i?.modifyCustomerAddress||Po(n,i.modifyCustomerAddress))return{status:"failed_unknown"};const{result:r,errors:a}=i.modifyCustomerAddress;return!r||a.length>0?{status:"failed",errors:Mo(a)}:{status:"success",address:To(r)}}}function Eo(e){return async t=>{const{data:s,error:i}=await e.mutate(bo,{variables:{id:t.id}});if(i||null==s?.deleteCustomerAddress)return{status:"failed_unknown"};const{result:n,errors:r}=s.deleteCustomerAddress;return!n||r.length>0?{status:"failed",errors:Mo(r)}:{status:"success",address:To(n)}}}function wo(e,t){const{extendedFields:s,...i}=be({address1:e.address1,address2:e.address2,countryCode:e.countryCode,fields:{district:e.district,line2:e.line2,streetName:e.streetName,streetNumber:e.streetNumber,subdistrict:e.subdistrict},extendedAddressMode:t});return{firstName:e.firstName,lastName:e.lastName,company:e.company,...i,city:e.city,countryCode:e.countryCode,zoneCode:e.zoneCode,zip:e.postalCode,phone:e.phone,extendedFields:s}}function To(e){const{address:t}=e;return{id:e.id,address:{address1:t.address1??void 0,address2:t.address2??void 0,firstName:t.firstName??void 0,lastName:t.lastName??void 0,postalCode:t.postalCode??void 0,zoneCode:t.zoneCode??void 0,countryCode:t.countryCode??void 0,city:t.city??void 0,company:t.company??void 0,phone:t.phone??void 0,district:t.extendedFields?.district??void 0,line2:t.extendedFields?.line2??void 0,streetName:t.extendedFields?.streetName??void 0,streetNumber:t.extendedFields?.streetNumber??void 0,subdistrict:t.extendedFields?.subdistrict??void 0},default:e.default}}function Mo(e){return e.map(({__typename:e,code:t,target:s,nonLocalizedMessage:i,localizedMessage:n})=>({__typename:e,code:t,target:s??void 0,nonLocalizedMessage:i,localizedMessage:n??void 0}))}async function Io({mutate:e,getNewAddresses:t,getNewSelectedAddress:s,setAddressValidationErrors:i,onSuccess:n,addresses:r,errors:a,i18n:o}){const d=await e();if("success"===d.status){const e=t(d.address),i=s(d.address,e);return r.value=e,a.banner.value=void 0,n(i),i}"failed"===d.status?(i(d.errors),a.banner.value=void 0):"failed_unknown"===d.status&&(a.banner.value=o.translate("shipping.address_form.generic_error"))}function Do({addressType:e,violations:t,countryCode:s,addressErrorsOverride:i,errors:n,address:r,addressSettings:a}){const o=s?r.countryDetails.get(s):void 0,d=Se({addressType:e,violations:t,countryDetails:o,format:o?r.extendedAddressMode.getFormatFromCountry(o):void 0,addressSettings:a}),l=i??n.fields;d.forEach((e,t)=>{l[t].value=e})}class Ro extends uo{#a;#y;#v;#f;#b;#S=g(!0);#A;get canSetDefaultAddress(){return this.#S}constructor({negotiatedAddresses:e,observability:t,i18n:s,graphql:i,address:n,addressSettings:r}){const[a,o]=Ae(e);super({observability:t,errors:{banner:g(void 0),fields:ce()}}),this.#a=a,this.addresses=this.#a,this.#A=o,this.#y=s,this.#v=i,this.#f=n,this.#b=r}dispose(){super.dispose(),this.#A()}get customerAddressMutations(){return Ao(this.#v,this.#f.extendedAddressMode)}handleMutation(e){return Io({...e,addresses:this.#a,errors:this.errors,i18n:this.#y})}setFieldErrors(e,t,s,i){Do({addressType:e,violations:t,countryCode:s,addressErrorsOverride:i,errors:this.errors,address:this.#f,addressSettings:this.#b})}async _setDefaultAddress({id:e,address:t}){const s=await this._updateAddress({id:e,address:t,setDefault:!0});return Boolean(s)}}class xo extends Ro{constructor({billingAddress:e,billingAddressOption:t,buyerIdentity:s,observability:i,addressSettings:n,address:r,i18n:a,graphql:o}){super({negotiatedAddresses:vo(p(()=>"CustomerProfile"===s.value?.customerProfile?.__typename?s.value.customerProfile.billingAddresses:[])),observability:i,i18n:a,graphql:o,address:r,addressSettings:n}),this.immutableAddresses=g([]),this.#_=g(void 0),this.#c=g(!0),this.#P=e,this.#u=t,this.selectedAddressId=p(()=>this.#_.value?this.#_.value:this.addresses.value[0]?.id),this.#h=p(()=>null!=this.selectedAddress.value)}#_;#P;#u;#c;#h;get canCreateAddress(){return this.#c}setValidationErrors(e){const t=this.selectedAddress.value?.address.countryCode;this.setFieldErrors("billing_address",e,t)}get canUpdateAddress(){return this.#h}_updateAddress({id:e,address:t}){return this.handleMutation({mutate:()=>this.customerAddressMutations.updateAddressMutation({address:t,id:e,setDefault:!1}),getNewAddresses:e=>this.addresses.value.map(t=>t.id===e.id?e:t),getNewSelectedAddress:e=>e,setAddressValidationErrors:e=>this.setFieldErrors("billing_address",e,t.countryCode),onSuccess:e=>{e&&(this.#_.value=e.id,this.#C(e.address))}})}async _selectAddress(e){return this.#_.value=e.id,this.#C(e.address),this.errors.banner.value=void 0,!0}_createAddress({address:e,setDefault:t,selectAddress:s,addressErrorsOverride:i}){const n=Boolean(t);return this.handleMutation({mutate:()=>this.customerAddressMutations.createAddressMutation({address:e,setDefault:n}),getNewAddresses:e=>n?[...this.addresses.value.map(e=>({...e,default:!1})),{...e,default:!0}]:[...this.addresses.value,e],getNewSelectedAddress:e=>e,setAddressValidationErrors:t=>this.setFieldErrors("shipping",t,e.countryCode,i),onSuccess:e=>{s&&(e?(this.#_.value=e.id,this.#C(e.address)):this.#_.value=void 0)}})}#C(e){this.#P.value=e,this.#u.value="custom"}}class Lo extends uo{#k;#E;#w;constructor({observability:e,buyerIdentity:t,availableDeliveryAddresses:s,mustSelectProvidedAddress:i,proposalAddress:n,addressSettings:r,address:a,i18n:o}){super({observability:e,errors:{banner:g(void 0),fields:ce()}}),this.negotiatedShippingAddresses=p(()=>i.value||"CustomerProfile"!==t.value?.customerProfile?.__typename?[]:t.value.customerProfile.shippingAddresses),this.#k=p(()=>s.value??[]),this.#E=p(()=>!i.value),this.#w=o.translate("address_management.saved_addresses"),this.selectedAddressId=p(()=>{const e=[...this.addresses.value,...this.immutableAddresses.value],t=n.value,s=t.countryCode?a.countryDetails.get(t.countryCode):void 0,i=_e(t,e,r,s,s?a.extendedAddressMode.getFormatFromCountry(s):void 0);return i?.id})}get addresses(){return this.negotiatedShippingAddresses}get immutableAddresses(){return this.#k}get canCreateAddress(){return this.#E}get canUpdateAddress(){return this.#E}get canDeleteAddress(){return this.#E}get canSetDefaultAddress(){return this.#E}get addressesTitle(){return this.#w}}class Oo extends Lo{#a;#k;#A;#T;#d;#y;#v;#f;#b;#m;#M=g(void 0);constructor({proposalAddress:e,availableDeliveryAddresses:t,mustSelectProvidedAddress:s,canUpdateDeliveryAddress:i,buyerIdentity:n,observability:r,addressSettings:a,address:o,wallets:d,i18n:l,graphql:u}){super({observability:r,buyerIdentity:n,availableDeliveryAddresses:t,mustSelectProvidedAddress:s,proposalAddress:e,addressSettings:a,address:o,i18n:l});const[c,h]=Ae(vo(this.negotiatedShippingAddresses));this.#a=c,this.#A=h,this.#k=p(()=>{const e=t.value??[],s=this.#M.value;return s?[...e,{id:de,address:s}]:e}),this.#m=p(()=>!1===i.value?"DELIVERY_ADDRESS_NOT_EDITABLE":s.value?"MUST_SELECT_PROVIDED_ADDRESS":d.activeSession.value?"ADDRESS_CHANGES_UNAVAILABLE":void 0),this.#T=d,this.#d=e,this.#y=l,this.#v=u,this.#f=o,this.#b=a}get addresses(){return this.#a}get immutableAddresses(){return this.#k}dispose(){super.dispose(),this.#A()}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#m;default:return y(e)}}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[de]});if(t)return this.#I(t.address),this.#M.value=void 0,{type:"success",address:t};const s={id:de,address:e};return this.#M.value=e,this.#I(e),{type:"success",address:s}}async _selectAddress(e){return!this.#T.activeSession.value&&(this.#I(e.address),!0)}_createAddress({address:e,setDefault:t,selectAddress:s,addressErrorsOverride:i}){const n=Boolean(t);return this.#D({mutate:()=>this.#R.createAddressMutation({address:e,setDefault:n}),getNewAddresses:e=>n?[...this.addresses.value.map(e=>({...e,default:!1})),{...e,default:!0}]:[...this.addresses.value,e],getNewSelectedAddress:e=>e,setAddressValidationErrors:t=>this.#x(t,e.countryCode,i),onSuccess:e=>{e&&s&&this.#I(e.address)}})}_updateEphemeralAddress({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[de]});return t?(this.#M.value=void 0,this.#I(t.address),Promise.resolve(t)):(this.#M.value=e,this.#I(e),Promise.resolve({id:de,address:e}))}_updateAddress({id:e,address:t,setDefault:s,addressErrorsOverride:i}){return this.#D({mutate:()=>this.#R.updateAddressMutation({address:t,id:e,setDefault:Boolean(s)}),getNewAddresses:e=>{const t=Boolean(s);return this.addresses.value.map(s=>s.id===e.id?e:t?{...s,default:!1}:s)},getNewSelectedAddress:e=>e,setAddressValidationErrors:e=>this.#x(e,t.countryCode,i),onSuccess:e=>{e&&this.#I(e.address)}})}async _deleteAddress(e){const t=await this.#D({mutate:()=>this.#R.deleteAddressMutation({id:e}),getNewAddresses:e=>this.addresses.value.filter(t=>t.id!==e.id),getNewSelectedAddress:(e,t)=>this.selectedAddress.value&&this.selectedAddress.value.id!==e.id?this.selectedAddress.value:t[0],setAddressValidationErrors:()=>{},onSuccess:e=>{e&&this.#I(e.address)}});return Boolean(t)}async _setDefaultAddress({id:e,address:t}){const s=await this._updateAddress({id:e,address:t,setDefault:!0});return Boolean(s)}get#R(){return Ao(this.#v,this.#f.extendedAddressMode)}#D(e){return Io({...e,addresses:this.#a,errors:this.errors,i18n:this.#y})}#x(e,t,s){Do({addressType:"shipping",violations:e,countryCode:t,addressErrorsOverride:s,errors:this.errors,address:this.#f,addressSettings:this.#b})}#I(e){this.#d.value=this.withCoordinates(e)}}const Bo="guest_address";class Fo extends uo{#L;#c;#h=g(!0);#m;#O;#d;constructor({proposalAddress:e,immutableAddresses:t,mustSelectProvidedAddress:s,canUpdateDeliveryAddress:i,observability:n,wallets:r}){const a=e.value,o=t.value?.find(({address:e})=>ue(e,a,["phone"]));let d,l;o?l=o.id:(d={...a,oneTimeUse:!1},l=Bo),super({observability:n,errors:{banner:g(void 0),fields:ce()}}),this.selectedAddressId=g(l),this.#d=e,this.#L=g(d),this.#c=p(()=>!s.value&&!this.#L.value),this.#O=s,this.#m=p(()=>!1===i.value?"DELIVERY_ADDRESS_NOT_EDITABLE":this.#O.value?"MUST_SELECT_PROVIDED_ADDRESS":this.wallets.activeSession.value?"ADDRESS_CHANGES_UNAVAILABLE":void 0),this.immutableAddresses=p(()=>t.value??[]),this.addresses=p(()=>{const e=this.#L.value;return e?[{id:Bo,address:e}]:[]}),this.wallets=r}get canCreateAddress(){return this.#c}get canUpdateAddress(){return this.#h}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#m;default:return y(e)}}async _createAddress({address:e,selectAddress:t}){this.#L.value=e;const s={id:Bo,address:e};return t?(this.selectedAddressId.value=Bo,this.#d.value=e,s):s}_updateAddress({address:e}){return this.#L.value=e,this.selectedAddressId.value=Bo,this.#d.value=e,Promise.resolve({id:Bo,address:e})}_selectAddress(e){return this.wallets.activeSession.value?Promise.resolve(!1):(this.selectedAddressId.value=e.id,this.#d.value=e.address,Promise.resolve(!0))}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[Bo]});if(t)return this.selectedAddressId.value=t.id,this.#d.value=t.address,{type:"success",address:t};const s={id:Bo,address:e};return this.#L.value=e,this.selectedAddressId.value=Bo,this.#d.value=e,{type:"success",address:s}}}function No(e){return`${da}_${Pe(e)}`}class Uo extends uo{#h=g(!0);#m;#a;#k=g([]);#w;constructor({proposalAddress:e,buyerIdentityAddresses:t,mustSelectProvidedAddress:s,canUpdateDeliveryAddress:i,observability:n,i18n:r}){const a=e.value,o=No(a),d=[{id:o,address:a}],l=o,u=new Set([o]);t?.forEach(e=>{if(pe(e,a))return;const t=No(e);u.has(t)||(u.add(t),d.push({id:t,address:e}))}),super({observability:n,errors:{banner:g(void 0),fields:ce()}}),this.selectedAddressId=g(l),this.addressesSignal=g(d),this.#w=r.translate("address_management.saved_addresses"),this.#m=p(()=>!1===i.value?"DELIVERY_ADDRESS_NOT_EDITABLE":s.value?"MUST_SELECT_PROVIDED_ADDRESS":void 0),this.#a=p(()=>this.addressesSignal.value),this.addresses=this.#a,this.immutableAddresses=this.#k}get canUpdateAddress(){return this.#h}get addressesTitle(){return this.#w}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.#m;default:return y(e)}}}class qo extends Uo{#d;#M=g(void 0);#k;constructor({proposalAddress:e,buyerIdentityAddresses:t,mustSelectProvidedAddress:s,canUpdateDeliveryAddress:i,observability:n,i18n:r}){super({proposalAddress:e,buyerIdentityAddresses:t,mustSelectProvidedAddress:s,canUpdateDeliveryAddress:i,observability:n,i18n:r}),this.#d=e,this.#k=p(()=>{const e=this.#M.value;return e?[{id:de,address:e}]:[]}),this.immutableAddresses=this.#k}_selectAddress(e){return this.selectedAddressId.value=e.id,this.#d.value=e.address,Promise.resolve(!0)}_updateEphemeralAddress({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[de]});return t?(this.#M.value=void 0,this.selectedAddressId.value=t.id,this.#d.value=t.address,Promise.resolve(t)):(this.#M.value=e,this.#d.value=e,this.selectedAddressId.value=de,Promise.resolve({id:de,address:e}))}_updateAddress({id:e,address:t}){const s={id:e,address:t};return this.addressesSignal.value=this.addressesSignal.value.map(t=>t.id===e?s:t),this.#d.value=t,this.selectedAddressId.value=e,Promise.resolve(s)}async _applyAddressChange({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[de]});if(t)return this.selectedAddressId.value=t.id,this.#d.value=t.address,this.#M.value=void 0,{type:"success",address:t};const s={id:de,address:e};return this.#M.value=e,this.selectedAddressId.value=s.id,this.#d.value=s.address,{type:"success",address:s}}}const Vo={id:"cd2ca92b8773837d840d4819fb57b9286e98d1277df418da37846ce492d8f0f9",type:"mutation",name:"AddressCreate",source:"mutation AddressCreate($address:AddressInput!,$checkoutContext:CheckoutContextInput!,$origin:String!,$preferred:Boolean){addressCreate(address:$address origin:$origin checkoutContext:$checkoutContext preferred:$preferred){userErrors{message field __typename}userAddress{...ShippingAddressFragment __typename}userPhone __typename}}fragment ShippingAddressFragment on Address{addressLineComponents{additionalInformation district streetName streetNumber subdistrict __typename}fields{key value __typename}id uuid lastUsedAt valid userPreferred explicitlyPreferred __typename}"};function zo({observability:e,shopPayGraphql:t,source:s,extendedAddressMode:i}){const n=Ce({source:s});return async(s,r,a=n,o=!1)=>{const{data:d,error:l}=await t.mutate(Vo,{variables:{address:ke(s,i),origin:a,checkoutContext:r,preferred:o}});if(l||null==d||null==d.addressCreate)return e.leaveErrorBreadcrumb("Shop Pay add address mutation had an error"),{status:"failed"};const{addressCreate:u}=d;return u.userErrors.length>0?(e.leaveErrorBreadcrumb("Shop Pay add address mutation had a user error"),{status:"failed",errors:u.userErrors}):{status:"success",address:u.userAddress?Ee(u.userAddress):void 0,userPhone:u.userPhone}}}const Ho={id:"2025d9ea2f58381d478a6e61b0965f09d04deb9e44673115964b4fc848d099a4",type:"mutation",name:"AddressDelete",source:"mutation AddressDelete($id:ID!,$uuid:String!,$origin:String!,$checkoutContext:CheckoutContextInput!){addressDelete(id:$id uuid:$uuid origin:$origin checkoutContext:$checkoutContext){userErrors{field message __typename}__typename}}"};function jo({shopPayGraphql:e,source:t}){const s=Ce({source:t});return async(t,i,n)=>{const{data:r,error:a}=await e.mutate(Ho,{variables:{id:t,uuid:i,origin:s,checkoutContext:n}});if(a||null==r||null==r.addressDelete)return{status:"failed"};const{addressDelete:o}=r;return o.userErrors.length>0?{status:"failed",errors:o.userErrors}:{status:"success"}}}const Wo={id:"68b25a8a957a3ac32aec2304fb91db5a6c2ddfb4d77f11b2312dc4a76285ecf3",type:"mutation",name:"AddressUpdate",source:"mutation AddressUpdate($address:AddressInput!,$id:ID!,$uuid:String!,$origin:String!,$preferred:Boolean,$checkoutContext:CheckoutContextInput!){addressUpdate(address:$address id:$id uuid:$uuid origin:$origin preferred:$preferred checkoutContext:$checkoutContext){userErrors{field message __typename}userAddress{...ShippingAddressFragment __typename}userPhone __typename}}fragment ShippingAddressFragment on Address{addressLineComponents{additionalInformation district streetName streetNumber subdistrict __typename}fields{key value __typename}id uuid lastUsedAt valid userPreferred explicitlyPreferred __typename}"};function $o({observability:e,shopPayGraphql:t,source:s,extendedAddressMode:i}){const n=Ce({source:s});return async(s,r,a,o,d=!1)=>{const{data:l,error:u}=await t.mutate(Wo,{variables:{id:r,uuid:a,address:ke(s,i),origin:n,preferred:d,checkoutContext:o}});if(u||null==l||null==l.addressUpdate)return e.leaveErrorBreadcrumb("Shop Pay update address mutation had an error"),{status:"failed"};const{addressUpdate:c}=l;return c.userErrors.length>0?(e.leaveErrorBreadcrumb("Shop Pay update address mutation had a user error"),{status:"failed",errors:c.userErrors}):{status:"success",address:c.userAddress?Ee(c.userAddress):void 0,userPhone:c.userPhone}}}class Go extends uo{constructor({shopPay:e,observability:t,addressSettings:s}){super({observability:t,errors:{banner:g(void 0),fields:ce()}}),this.immutableAddresses=g([]),this.#h=g(!0),this.#B=g(!0),this.#S=g(!0),this.addresses=p(()=>e.user.addresses.value.map(t=>la({address:t,addressSettings:s,shopUserPhone:e.user.phoneNumber.value}))),this.#c=p(()=>this.addresses.value.lengthe.session.selectedBillingAddress.value?.id)}#c;#h;#B;#S;get canCreateAddress(){return this.#c}get canUpdateAddress(){return this.#h}get canDeleteAddress(){return this.#B}get canSetDefaultAddress(){return this.#S}}class Yo extends Go{#F;#N;#U;#q;#V;#z;#y;#H;#f;get#b(){return this.#H.addressSettings}get#j(){return this.#F.proposed.billingAddress}constructor({proposal:e,shopPay:t,observability:s,userEvents:i,shopPayGraphql:n,source:r,shop:a,i18n:o,checkoutConfiguration:d,address:l}){super({shopPay:t,observability:s,addressSettings:d.addressSettings.nonBillingAddressSettings.value}),this.#F=e,this.#N=i,this.#U=t,this.#q=n,this.#V=r,this.#z=a,this.#y=o,this.#H=d,this.#f=l}async _selectAddress(e){const t=this.#W(e.id)??Te(e.address,e.id);return this.#$(t),this.#j.value=this.withCoordinates(e.address),this.#G(),!0}async _createAddress({address:e,setDefault:t,selectAddress:s,addressErrorsOverride:i}){if("simulated"===this.#V.type)return;const n=await this.#Y({address:e,preferred:t});if(this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"billing_address_add_new"}}),"success"!==n.status)return void this.#J({shopPayErrors:n.errors,addressErrorsOverride:i,submittedAddress:e});const r=n.address;if(!r)return;const a=t?this.#U.user.addresses.value.map(e=>({...e,userPreferred:!1})):this.#U.user.addresses.value;this.#U.user.unstable_setAddresses([...a,r]),n.userPhone&&!this.#U.user.phoneNumber.value&&this.#U.user.unstable_setPhoneNumber(n.userPhone);const o=this.#K(r);return s&&(this.#$(r),this.#j.value=this.withCoordinates(o.address),this.#X(o.address,r),this.#G()),o}async _updateAddress({id:e,address:t,setDefault:s,addressErrorsOverride:i}){if("simulated"===this.#V.type)return;const n=this.#W(e);if(!n)return;const r=await this.#Q(t,e,n.uuid,s);if("success"!==r.status)return void this.#J({shopPayErrors:r.errors,addressErrorsOverride:i,submittedAddress:t});const a=r.address;if(!a)return;const o=this.#U.user.addresses.value.map(e=>e.uuid===n.uuid?a:s?{...e,userPreferred:!1}:e);this.#U.user.unstable_setAddresses(o),r.userPhone&&!this.#U.user.phoneNumber.value&&this.#U.user.unstable_setPhoneNumber(r.userPhone);const d=this.#K(a);return this.selectedAddressId.value===e&&(this.#$(a),this.#j.value=this.withCoordinates(d.address)),this.#Z(e,d.address,a),this.#G(),d}async _deleteAddress(e){if("simulated"===this.#V.type)return!1;const t=this.#W(e),s=this.selectedAddressId.value;if(!t)return!1;const i=await this.#ee(e,t.uuid);if(this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"billing_address_remove"}}),"success"!==i.status)return!1;const n=this.#U.user.addresses.value.filter(e=>e.uuid!==t.uuid),r=Ie(n)??void 0,a=r?this.#K(r).address:this.#te();if(t.userPreferred&&r){const e=n.findIndex(e=>e.id===r.id);n[e]={...r,userPreferred:!0},this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"set_default_address_auto"}})}return this.#U.user.unstable_setAddresses(n),s===e&&(this.#$(r),this.#j.value=this.withCoordinates(a)),this.#se(e,a,r),this.#G(),!0}async _setDefaultAddress({id:e,address:t}){if("simulated"===this.#V.type)return!1;this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"set_default_address"}});const s=await this._updateAddress({id:e,address:t,setDefault:!0});return Boolean(s)}#W(e){return this.#U.user.addresses.value.find(t=>t.id===e)}#K(e){return la({address:e,addressSettings:this.#b.nonBillingAddressSettings.value,shopUserPhone:this.#U.user.phoneNumber.value})}#$(e){this.#U.session.unstable_updateSelectedBillingAddress(e)}#X(e,t){De(this.#F)&&!this.#U.session.selectedShippingAddress.value&&(this.#U.session.unstable_updateSelectedShippingAddress(t),this.#F.proposed.shippingAddress.value=this.withCoordinates(e))}#Z(e,t,s){this.#U.session.selectedShippingAddress.value?.id===e&&(this.#U.session.unstable_updateSelectedShippingAddress(s),this.#F.proposed.shippingAddress.value=this.withCoordinates(t))}#se(e,t,s){this.#U.session.selectedShippingAddress.value?.id===e&&(this.#U.session.unstable_updateSelectedShippingAddress(s),this.#F.proposed.shippingAddress.value=this.withCoordinates(t))}#Y({address:e,preferred:t}){return zo({observability:this.observability,shopPayGraphql:this.#q,source:this.#V,extendedAddressMode:this.#f.extendedAddressMode})(e,this.#ie(),Ce({source:this.#V}),t)}#Q(e,t,s,i){return $o({observability:this.observability,shopPayGraphql:this.#q,source:this.#V,extendedAddressMode:this.#f.extendedAddressMode})(e,t,s,this.#ie(),i)}#ee(e,t){return jo({shopPayGraphql:this.#q,source:this.#V})(e,t,this.#ie())}#J({shopPayErrors:e,addressErrorsOverride:t,submittedAddress:s}){ua({addressErrors:t??this.errors.fields,shopPayErrors:e,i18n:this.#y,observability:this.observability,userEvents:this.#N,source:this.#V,configuration:this.#H,shop:this.#z,submittedAddress:s,addressContext:"billing"})}#ie(){return{checkoutIdentifier:this.#V.checkoutSessionIdentifier??"",checkoutVersion:Ce({source:this.#V}),shopId:Re(this.#z.id),shopifyDomain:this.#z.myshopifyDomain}}#te(){return xe({phone:this.#U.user.phoneNumber.value,countryCode:this.#b.nonBillingAddressSettings.value.defaultShippingDetails.country?.code})}#G(){const e=this.#F.proposed.billingAddress.value,t=this.#F.proposed.shippingAddress.value,s=ue(t,e);this.#U.user.hasCreditCards.value&&(this.#F.proposed.billingAddressOption.value=s?"shipping":"custom")}}function Jo(e,t){if(!e)return!1;const s=Le(t)?t.allowedShippingCountriesOverride.value:null;if(!s||0===s.length)return!0;const i=e.address.countryCode;return!i||s.includes(i)}function Ko(e,t){return e.some(e=>ue(e.address,t,["phone"]))}class Xo extends uo{constructor({proposal:e,shopPay:t,observability:s,initialNegotiationData:i,addressSettings:n,address:r,i18n:a}){super({observability:s,errors:{banner:g(void 0),fields:ce()}}),this.proposal=e,this.shopPay=t,this.i18n=a,this.address=r,this.signals=function({proposal:e,shopPay:t,initialNegotiationData:s,addressSettings:i,address:n,i18n:r}){const a=e.negotiated.fields.mustSelectProvidedAddress,o=e.negotiated.fields.canUpdateDeliveryAddress,d=e.negotiated.fields.availableDeliveryAddresses,l=p(()=>a.value?[]:t.user.addresses.value.map(e=>la({address:e,isDisabled:e=>!Jo(e,t),addressSettings:i,shopUserPhone:t.user.phoneNumber.value}))),u=p(()=>{if(a.value)return[];const s=e.negotiated.fields.buyerIdentity.value?.customerProfile;return"CustomerProfile"===s?.__typename&&s.shippingAddresses.length?s.shippingAddresses.map(e=>({...e,disabled:!Jo(e,t)})):[]}),c=p(()=>function({availableDeliveryAddresses:e,mustSelectProvidedAddress:t,initialNegotiationData:s,addresses:i,shopPay:n,addressSettings:r}){if(t.value)return e.value||[];const a=[],o=e=>{e&&(Ko(i.value,e.address)||Ko(a,e.address)||a.push({...e,address:ca({address:e.address,addressSettings:r,fallbackPhone:n.user.phoneNumber.value})}))};for(const u of e.value||[])o(u);const d=n.config.redirectSource===Oe.ShopPaySdk,l=function(e,t){const s=t===Oe.ShopPayInstallmentsAsPaymentMethod,i=t===Oe.ShopPaySdk;if(!s&&!i)return;if("NegotiationResultAvailable"!==e?.session?.negotiate.result.__typename)return;const{sellerProposal:n,buyerProposal:r}=e.session.negotiate.result,a=Be({delivery:n.delivery,buyerDelivery:r.delivery,remoteDelivery:Fe(n.remote).remoteDelivery});return a&&!Ne(a,Ue)?{id:qe,address:a}:void 0}(s,n.config.redirectSource);return l&&o(d?{...l,disabled:!Jo(l,n)}:l),a}({availableDeliveryAddresses:d,mustSelectProvidedAddress:a,initialNegotiationData:s,addresses:l,shopPay:t,addressSettings:i})),h=p(()=>{if(l.value.length>=we)return[];const e=[...l.value,...c.value];return u.value.filter(t=>{const s=t.address.countryCode,r=s?n.countryDetails.get(s):void 0,a=Ve(i,r,r?n.extendedAddressMode.getFormatFromCountry(r):void 0);return!e.some(e=>{const s=!t.address.firstName?.trim()||!e.address.firstName?.trim();return ue(t.address,e.address,["phone",...s?["firstName"]:[],...a?[]:["zoneCode"]])})})}),g=p(()=>h.value.length?[{title:r.translate("address_management.saved_with_store"),addressIds:new Set(h.value.map(({id:e})=>e))}]:[]),m=p(()=>[...c.value,...h.value]),y=p(()=>!a.value),v=p(()=>l.value.length!1===o.value?"DELIVERY_ADDRESS_NOT_EDITABLE":a.value?"MUST_SELECT_PROVIDED_ADDRESS":void 0),_=p(()=>t.session.selectedShippingAddress.value?.id),P=r.translate("address_management.saved_addresses");return{addresses:l,immutableAddresses:m,immutableAddressSections:g,selectedAddressId:_,canCreateAddress:v,canUpdateAddress:f,canDeleteAddress:b,canSetDefaultAddress:S,canApplyExternalAddress:A,addressesTitle:P}}({proposal:e,shopPay:t,initialNegotiationData:i,addressSettings:n,address:r,i18n:a}),this.addresses=this.signals.addresses,this.immutableAddresses=this.signals.immutableAddresses,this.selectedAddressId=this.signals.selectedAddressId}get canCreateAddress(){return this.signals.canCreateAddress}get canUpdateAddress(){return this.signals.canUpdateAddress}get canDeleteAddress(){return this.signals.canDeleteAddress}get canSetDefaultAddress(){return this.signals.canSetDefaultAddress}get immutableAddressSections(){return this.signals.immutableAddressSections}get addressesTitle(){return this.signals.addressesTitle}}class Qo extends Xo{#q;#N;#V;#z;#H;#k;#M=g(void 0);get#b(){return this.#H.addressSettings}get#j(){return this.proposal.proposed.shippingAddress}#ne(e){return{id:de,address:ca({address:e,addressSettings:this.#b.nonBillingAddressSettings.value,fallbackPhone:this.shopPay.user.phoneNumber.value})}}constructor({proposal:e,shopPay:t,observability:s,userEvents:i,initialNegotiationData:n,shopPayGraphql:r,source:a,shop:o,i18n:d,checkoutConfiguration:l,address:u}){super({proposal:e,shopPay:t,observability:s,initialNegotiationData:n,addressSettings:l.addressSettings.nonBillingAddressSettings.value,address:u,i18n:d}),this.#q=r,this.#N=i,this.#V=a,this.#z=o,this.#H=l,this.#k=p(()=>{const e=this.signals.immutableAddresses.value,t=this.#M.value;return t?[...e.filter(({id:e})=>e!==qe),this.#ne(t)]:e}),this.immutableAddresses=this.#k}applyAddressChangeBlockReason(e){switch(e){case"ui-extension":case"ucp":return this.signals.canApplyExternalAddress;default:return y(e)}}#re({source:e,address:t}){return"ucp"===e&&t.phone?.trim()?[]:["phone"]}async _applyAddressChange({source:e,address:t}){if("ucp"===e&&!Jo({address:t},this.shopPay))return this.#M.value=void 0,this.#$(void 0),{type:"failure",reason:"ADDRESS_COUNTRY_NOT_SUPPORTED"};const s=this.findMatchingAddress(t,{ignoreFields:this.#re({source:e,address:t}),ignoreIds:[de]});if(s){await this._selectAddress(s),this.#M.value=void 0;const e=this.selectedAddress.value;return e?{type:"success",address:e}:{type:"failure",reason:"ADDRESS_CHANGES_UNAVAILABLE"}}const i=this.#ne(t);return this.#M.value=t,await this._selectAddress(i),{type:"success",address:i}}async _selectAddress(e){const t=this.#W(e.id)??Te(e.address,e.id);return this.#$(t),this.#j.value=this.withCoordinates(e.address),this.#G(),!0}async _createAddress({address:e,setDefault:t,selectAddress:s,addressErrorsOverride:i}){if("simulated"===this.#V.type)return;this.errors.banner.value=void 0;const n=await this.#Y({address:e,preferred:t});if(this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"shipping_address_add_new"}}),"success"!==n.status)return void this.#J({shopPayErrors:n.errors,addressErrorsOverride:i,submittedAddress:e});const r=n.address;if(!r)return;const a=t?this.shopPay.user.addresses.value.map(e=>({...e,userPreferred:!1})):this.shopPay.user.addresses.value;this.shopPay.user.unstable_setAddresses([...a,r]),n.userPhone&&!this.shopPay.user.phoneNumber.value&&this.shopPay.user.unstable_setPhoneNumber(n.userPhone);const o=this.#K(r);return s&&(this.#$(r),this.#j.value=this.withCoordinates(o.address),this.#X(o.address,r),this.#G()),o}async _updateEphemeralAddress({address:e}){const t=this.findMatchingAddress(e,{ignoreIds:[de]});if(t)return this.#M.value=void 0,await this._selectAddress(t),this.selectedAddress.value??t;this.#M.value=e;const s=this.#ne(e);return await this._selectAddress(s),s}async _updateAddress({id:e,address:t,setDefault:s,addressErrorsOverride:i}){if("simulated"===this.#V.type)return;this.errors.banner.value=void 0;const n=this.#W(e);if(!n)return this.#ae({id:e,address:t,setDefault:s,addressErrorsOverride:i});const r=await this.#Q(t,e,n.uuid,s);if("success"!==r.status)return void this.#J({shopPayErrors:r.errors,addressErrorsOverride:i,submittedAddress:t});const a=r.address;if(!a)return;const o=this.shopPay.user.addresses.value.map(e=>e.uuid===n.uuid?a:s?{...e,userPreferred:!1}:e);this.shopPay.user.unstable_setAddresses(o),r.userPhone&&!this.shopPay.user.phoneNumber.value&&this.shopPay.user.unstable_setPhoneNumber(r.userPhone);const d=this.#K(a);return this.selectedAddressId.value===e&&(this.#$(a),this.#j.value=this.withCoordinates(d.address)),this.#Z(e,d.address,a),this.#G(),d}async#ae({id:e,address:t,setDefault:s,addressErrorsOverride:i}){if(e===qe&&!s)return this._updateEphemeralAddress({address:t});if(!this.#oe(e))return this.#de(e,"not a customer-account address");if(!s){const s=this.findMatchingAddress(t);if(s)return await this._selectAddress(s),this.#le(e,"selected_matching_address"),this.selectedAddress.value??s}if(!this.canCreateAddress.value)return this.#de(e,"address list full");const n=await this._createAddress({address:t,setDefault:s,selectAddress:!0,addressErrorsOverride:i});return n||this.#ue(i)||(this.errors.banner.value=this.i18n.translate("shipping.address_form.generic_error")),this.#le(e,n?"vaulted_edit":"vault_rejected"),n}#oe(e){const t=this.proposal.negotiated.fields.buyerIdentity.value?.customerProfile;return"CustomerProfile"===t?.__typename&&t.shippingAddresses.some(t=>t.id===e)}#ue(e){const t=e??this.errors.fields;return Object.values(t).some(e=>Boolean(e.value))}#de(e,t){this.observability.error(new oe(`Cannot update address "${e}": no Shop Pay vault record for it (${t})`,{groupingHash:"ShopPayShippingAddressManager::_updateAddress::MissingVaultRecord"})),this.errors.banner.value=this.i18n.translate("shipping.address_form.generic_error")}#le(e,t){this.observability.log("shop_pay_address_edit_without_vault_record","Buyer saved an edit to an address with no Shop Pay vault record",{addressId:e,outcome:t})}async _deleteAddress(e){if("simulated"===this.#V.type)return!1;const t=this.#W(e),s=this.selectedAddressId.value;if(!t)return!1;const i=await this.#ee(e,t.uuid);if(this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"shipping_address_remove"}}),"success"!==i.status)return!1;const n=this.shopPay.user.addresses.value.filter(e=>e.uuid!==t.uuid),r=Ie(n)??void 0,a=r?this.#K(r).address:this.#te();if(t.userPreferred&&r){const e=n.findIndex(e=>e.id===r.id);n[e]={...r,userPreferred:!0},this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"set_default_address_auto"}})}return this.shopPay.user.unstable_setAddresses(n),s===e&&(this.#$(r),this.#j.value=this.withCoordinates(a)),this.#se(e,a,r),this.#G(),!0}async _setDefaultAddress({id:e,address:t}){if("simulated"===this.#V.type)return!1;this.#N.monorailEvent({schemaId:"shopify_pay_payment_page_ui_interaction/1.2",payload:{...Me(this.#V,{configuration:this.#H},this.#z),action:"set_default_address"}});const s=await this._updateAddress({id:e,address:t,setDefault:!0});return Boolean(s)}#K(e){return la({address:e,isDisabled:e=>!Jo(e,this.shopPay),addressSettings:this.#b.nonBillingAddressSettings.value,shopUserPhone:this.shopPay.user.phoneNumber.value})}#$(e){this.shopPay.session.unstable_updateSelectedShippingAddress(e)}#X(e,t){this.shopPay.session.selectedBillingAddress.value||(this.shopPay.session.unstable_updateSelectedBillingAddress(t),this.proposal.proposed.billingAddress.value=this.withCoordinates(e))}#Z(e,t,s){this.shopPay.session.selectedBillingAddress.value?.id===e&&(this.shopPay.session.unstable_updateSelectedBillingAddress(s),this.proposal.proposed.billingAddress.value=this.withCoordinates(t))}#se(e,t,s){this.shopPay.session.selectedBillingAddress.value?.id===e&&(this.shopPay.session.unstable_updateSelectedBillingAddress(s),this.proposal.proposed.billingAddress.value=this.withCoordinates(t))}#W(e){return this.shopPay.user.addresses.value.find(t=>t.id===e)}#Y({address:e,preferred:t}){return zo({observability:this.observability,shopPayGraphql:this.#q,source:this.#V,extendedAddressMode:this.address.extendedAddressMode})(e,this.#ie(),Ce({source:this.#V}),t)}#Q(e,t,s,i){return $o({observability:this.observability,shopPayGraphql:this.#q,source:this.#V,extendedAddressMode:this.address.extendedAddressMode})(e,t,s,this.#ie(),i)}#ee(e,t){return jo({shopPayGraphql:this.#q,source:this.#V})(e,t,this.#ie())}#J({shopPayErrors:e,addressErrorsOverride:t,submittedAddress:s}){ua({addressErrors:t??this.errors.fields,shopPayErrors:e,i18n:this.i18n,observability:this.observability,userEvents:this.#N,source:this.#V,configuration:this.#H,shop:this.#z,submittedAddress:s,addressContext:"shipping"})}#ie(){return{checkoutIdentifier:this.#V.checkoutSessionIdentifier??"",checkoutVersion:Ce({source:this.#V}),shopId:Re(this.#z.id),shopifyDomain:this.#z.myshopifyDomain}}#te(){return xe({phone:this.shopPay.user.phoneNumber.value,countryCode:this.#b.nonBillingAddressSettings.value.defaultShippingDetails.country?.code})}#G(){const e=this.proposal.proposed.billingAddress.value,t=this.proposal.proposed.shippingAddress.value,s=ue(t,e);this.shopPay.user.hasCreditCards.value&&(this.proposal.proposed.billingAddressOption.value=s?"shipping":"custom")}}class Zo{#ce;#he;#pe;constructor({identity:e,observability:t,userEvents:s,proposal:i,wallets:n,i18n:r,address:a,configuration:o,shop:d,shopPay:l,graphql:{coreGraphql:u,shopPayGraphql:c},source:h,router:y,initialNegotiationData:f}){const b=p(()=>y.currentUrl.value.pathname.endsWith("/throttle")),S=new Fo({proposalAddress:i.proposed.shippingAddress,mustSelectProvidedAddress:i.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:i.negotiated.fields.canUpdateDeliveryAddress,immutableAddresses:i.negotiated.fields.availableDeliveryAddresses,observability:t,wallets:n}),A=new co(t);this.#ce=g(S),this.#he=g(A),this.shipping=this.#ce,this.billing=this.#he,this.#pe=m(()=>{const p=e.current.value;this.#ce.peek().dispose(),this.#he.peek().dispose(),v(()=>{if("customerAccount"===p)this.#ce.value=new Oo({proposalAddress:i.proposed.shippingAddress,availableDeliveryAddresses:i.negotiated.fields.availableDeliveryAddresses,mustSelectProvidedAddress:i.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:i.negotiated.fields.canUpdateDeliveryAddress,buyerIdentity:i.negotiated.fields.buyerIdentity,observability:t,addressSettings:o.addressSettings.nonBillingAddressSettings.value,address:a,wallets:n,i18n:r,graphql:u}),this.#he.value=new xo({billingAddress:i.proposed.billingAddress,billingAddressOption:i.proposed.billingAddressOption,buyerIdentity:i.negotiated.fields.buyerIdentity,observability:t,addressSettings:o.addressSettings.nonBillingAddressSettings.value,address:a,i18n:r,graphql:u});else if("shopPay"===p)this.#ce.value=new Qo({proposal:i,shopPay:l,observability:t,userEvents:s,initialNegotiationData:f,shopPayGraphql:c,source:h,shop:d,i18n:r,checkoutConfiguration:o,address:a}),this.#he.value=new Yo({proposal:i,shopPay:l,observability:t,userEvents:s,shopPayGraphql:c,source:h,shop:d,i18n:r,checkoutConfiguration:o,address:a});else if("sdkCartHints"===p)this.#ce.value=new qo({proposalAddress:i.proposed.shippingAddress,buyerIdentityAddresses:i.negotiated.fields.buyerIdentity.value?.shippingAddresses,mustSelectProvidedAddress:i.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:i.negotiated.fields.canUpdateDeliveryAddress,observability:t,i18n:r}),this.#he.value=new co(t);else if("businessCustomer"===p){const e=d.additionalAddressFieldsEnabled,s=new yo({proposalAddress:i.proposed.shippingAddress,buyerIdentity:i.negotiated.fields.buyerIdentity,mustSelectProvidedAddress:i.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:i.negotiated.fields.canUpdateDeliveryAddress,observability:t,address:a,shippingCountries:d.shippingCountries,shippingAddressSettings:o.addressSettings.nonBillingAddressSettings.value,deliveryNext:i.negotiated.fields.deliveryNext,additionalFieldsEnabled:e,isThrottled:b,i18n:r});this.#ce.value=s,this.#he.value=new go({proposalAddress:i.proposed.billingAddress,billingAddressOption:i.proposed.billingAddressOption,buyerIdentity:i.negotiated.fields.buyerIdentity,billingAddressFact:i.facts.billingAddress,isValidShippingAddress:s.isValidShippingAddress,isLoadingShipping:s.isLoadingShippingAddress,observability:t,sourceType:h.type,address:a,billingCountries:d.billingCountries,billingAddressSettings:o.addressSettings.billingAddressSettings.value,deliveryNext:i.negotiated.fields.deliveryNext,additionalFieldsEnabled:e,isThrottled:b,i18n:r})}else this.#ce.value=new Fo({proposalAddress:i.proposed.shippingAddress,mustSelectProvidedAddress:i.negotiated.fields.mustSelectProvidedAddress,canUpdateDeliveryAddress:i.negotiated.fields.canUpdateDeliveryAddress,immutableAddresses:i.negotiated.fields.availableDeliveryAddresses,observability:t,wallets:n}),this.#he.value=new co(t)})})}dispose(){this.#pe()}}const ed={id:"e80d5f5c1e60593716690e3575add0ef2588b89c7ea211e423658d746ee06ffa",type:"query",name:"CountryDetails",source:""};function td(e){return"string"==typeof e?""!==e.trim():null!=e}function sd(e){return Object.entries(e).filter(([e,t])=>$e(e)&&td(t)).map(([e])=>e)}function id(e){return td(e.address1)||td(e.streetName)}function nd(e){const t=Object.fromEntries(Object.entries(e).filter(([t,s])=>$e(t)&&td(s)&&!function(e,t,s){if("string"!=typeof s)return!1;if("address1"===t){const t=Ye({countryCode:e.countryCode,address1:void 0,address2:void 0,line2:void 0,streetName:e.streetName,streetNumber:e.streetNumber});return td(t)&&s.trim()===t?.trim()}if("address2"===t){const t=Je({countryCode:e.countryCode,address1:void 0,address2:void 0,line2:e.line2,neighborhood:e.neighborhood});return td(t)&&s.trim()===t?.trim()}return!1}(e,t,s)).map(([e,t])=>[e,"string"==typeof t?t.trim():t]).sort(([e],[t])=>e.localeCompare(t)));return Ge(JSON.stringify(t))}function rd(e,t,s,i,n,r,a){a.monorailEvent({schemaId:"checkout_address_completion/1.0",payload:{shopId:parseInt(Re(i),10),checkoutToken:n||"unknown",country:e||"unknown",section:s,completedFields:t,isBillingDefaultToShippingAddress:r}})}class ad{#ge;#me;constructor({countryDetails:e,policy:t}){this.#ge=e,this.#me=t}get(e){if(!e)return null;const t=this.#ge.get(e);return t?this.getFromCountry(t):null}getFormat(e,t){if(!e)return;const s=this.#ge.get(e);return s?this.getFormatFromCountry(s,t):void 0}getFromCountry(e){return this.#me.isConcatenatedEnabled(e)&&e.extendedFormatting?.edit?"concatenated":this.#me.isDedicatedEnabled(e)&&this.#me.getDedicatedFormat(e)?"dedicated":null}getFormatFromCountry(e,t=this.getFromCountry(e)){return"concatenated"===t?e.extendedFormatting?.edit||e.formatting.edit:"dedicated"===t&&this.#me.getDedicatedFormat(e)||e.formatting.edit}}class od{constructor({graphql:e,i18n:t,initialCountryDetails:s,extendedAddressModePolicy:i}){this.countryDetails=new dd({graphql:e,i18n:t,initialCountryDetails:s}),this.extendedAddressMode=new ad({countryDetails:this.countryDetails,policy:i})}trackCompletion(e){e.events.addEventListener("bootloader:hydrate-end",()=>{const t=Ke(e.client,e.initialNegotiationData)?.session?.negotiate;if(Xe(e.client.unstable_getSerialization("receipt"),t)||"CheckpointDenied"===t?.result?.__typename)return;const s=function({checkout:{negotiator:e},userEvents:t,shop:{id:s,sameBillingAndShippingAddress:i},source:{checkoutSessionIdentifier:n}}){const r=new Set;return({errors:a,reasons:o})=>{const d=e.current.fields.shippingAddress.value,l=e.current.fields.billingAddress.value,u=e.current.fields.localizationExtensions.value;if(d&&id(d)){const e=`shipping:${nd(d)}`;r.has(e)||a?.some(e=>ze.has(e.code))||o?.includes(He.InvalidAddress)||(rd(d.countryCode??"unknown",sd(d),"shipping_address",s,n,i,t),r.add(e))}if(l&&id(l)){const e=`billing:${nd(l)}`;r.has(e)||a?.some(e=>je.has(e.code))||o?.includes(He.InvalidAddress)||(rd(l.countryCode??"unknown",sd(l),"billing_address",s,n,i,t),r.add(e))}if(u&&u?.length>0){const{cacheKey:e,keysOnly:o}=function(e){const t=e.filter(e=>e.value&&"string"==typeof e.value&&""!==e.value.trim());return{cacheKey:t.map(e=>`${e.key}:${Ge(e.value.trim())}`).join("|"),keysOnly:t.map(e=>e.key)}}(u);if(o.length>0){const u=`localization:${e}`;r.has(u)||a?.some(e=>We.has(e.code))||(rd(d?.countryCode??l?.countryCode??"unknown",o,"localized_id",s,n,i,t),r.add(u))}}}}(e);e.checkout.negotiator.listen(e=>{"success"===e.type||"error"===e.type?s({errors:e.errors}):"invalid"===e.type&&s({reasons:e.reasons})})},{once:!0})}}class dd{constructor({graphql:e,i18n:t,initialCountryDetails:s}){this.#ye=g(new Map),this.#ve=new Map,this.#fe=g(new Set),this.#be=new Map,this.fetch=async e=>{if(!e)return;const t=this.#ye.value.get(e);if(t)return t;const s=this.#be.get(e);if(s)return s;const i=this.#Se(e);this.#be.set(e,i);try{return await i}finally{this.#be.delete(e)}},this.#v=e,this.#y=t;for(const i of s)this.#Ae(i)}#v;#y;#ye;#ve;#fe;#be;get(e){return this.#ye.value.get(e)??this.#ve.get(e)}isLoading(e){return this.#fe.value.has(e)}async#Se(e){this.#fe.value=new Set([...this.#fe.value,e]);const{data:t,error:s}=await this.#v.staticQuery(ed,{variables:{country:e},cache:!0}),i=s?this.#_e(e):this.#Ae(t?.country),n=new Set(this.#fe.value);return n.delete(e),this.#fe.value=n,i}#_e(e){const t={...Qe(void 0,this.#y),code:e,isFallback:!0};return this.#ve.set(e,t),t}#Ae(e){if(!e)return;const t=Qe(e,this.#y);return this.#ye.value=new Map([...this.#ye.value,[e.code,t]]),t}}function ld(e){return"undefined"!=typeof window&&"ReactNativeWebView"in window&&Boolean(window.ReactNativeWebView)||e.includes("wv")||/iPhone|iPod|iPad/i.test(e)&&e.includes("AppleWebKit")&&!e.includes("Safari")}class ud{constructor(){this.networkSelectionEnabled=g(!1),this.selectedNetwork=g(void 0),this.selectedSavedCreditCardBrand=g(void 0),this.bankIdNumberLength=g(0),this.#Pe=g([]),this.#Ce=g(void 0),this.selectableBrands=p(()=>this.selectedSavedCreditCardBrand.value?[]:this.#Pe.value),this.activeBrand=p(()=>{if(this.networkSelectionEnabled.value){const e=this.#Pe.value,t=1===e.length?e[0]:void 0;return this.selectedSavedCreditCardBrand.value??this.selectedNetwork.value??t}return this.selectedSavedCreditCardBrand.value??this.#Ce.value}),this.setSelectedNetwork=this.setSelectedNetwork.bind(this),this.setSelectedSavedCreditCardBrand=this.setSelectedSavedCreditCardBrand.bind(this),this.setDetectedState=this.setDetectedState.bind(this)}#Pe;#Ce;setSelectedNetwork(e){this.selectedNetwork.value=e||void 0}setSelectedSavedCreditCardBrand(e){this.selectedSavedCreditCardBrand.value=e}setDetectedState({networkSelectionEnabled:e,availableNetworks:t,cardBrand:s,numberFilled:i,bankIdNumberLength:n}){f(()=>{this.networkSelectionEnabled.value=e,this.#Pe.value=t,this.#Ce.value=s,this.bankIdNumberLength.value=n;const r=this.selectedNetwork.value;!r||e&&i&&t.includes(r)||(this.selectedNetwork.value=void 0)})}}class cd{#ke=new Map;constructor(){this.forMethod=this.forMethod.bind(this)}forMethod(e){let t=this.#ke.get(e);return t||(t=new ud,this.#ke.set(e,t)),t}}class hd{constructor({events:e}){this.#Ee=g(!1),this.#we=g("idle"),this.#Te=g(!1),this.isExiting=this.#Ee,this.progressPhase=this.#we,this.isClearingSession=this.#Te,e.addEventListener("bootloader:hydrate-end",()=>{window.addEventListener("pageshow",e=>{e.persisted&&this.#Te.peek()&&window.location.reload()})})}#Ee;#we;#Te;exit(){this.#Ee.value=!0}startRedirectProgress(){"idle"===this.#we.peek()&&(this.#we.value="visible")}cancelRedirectProgress(){this.#we.value="idle"}setClearingSession(e){this.#Te.value=e}}function pd(e){return{analytics:e.analyticsProcessingAllowed.value,marketing:e.marketingAllowed.value,preferences:e.preferencesProcessingAllowed.value,saleOfData:e.saleOfDataAllowed.value}}class gd{#Me;constructor({serializations:e,config:t}){this.#Me="one-page"===e.get("checkoutLayout");const s=(Boolean(t&&t.schema)||"STANDARD_RECOVERY"===t?.variant)&&t?t:{};this.config=s,this.variant=new md({variant:s.variant??void 0})}get enabled(){return function({config:e,isOnePageCheckout:t}){return t&&(Boolean(e?.schema&&e.version)||"STANDARD_RECOVERY"===e?.variant)}({config:this.config,isOnePageCheckout:this.#Me})}}class md{constructor({variant:e}){this.isStandard=()=>{return e={variant:this.#Ie},"STANDARD"===e?.variant||"STANDARD_RECOVERY"===e?.variant;var e},this.isPartner=()=>"PARTNER"===this.#Ie,this.#Ie=e}#Ie;get value(){return this.#Ie}get recovery(){return"STANDARD_RECOVERY"===this.#Ie}}const yd=["countryCode","address1","city","zoneCode","postalCode"],vd=["countryCode","firstName","lastName","company","address1","address2","city","zoneCode","postalCode","phone","streetName","streetNumber","neighborhood","line2","district","subdistrict"],fd=["countryCode","firstName","lastName","company","address1","address2","city","zoneCode","postalCode","streetName","streetNumber","neighborhood","line2","district","subdistrict"],bd=["firstName","lastName","address1","city","countryCode"],Sd=["phone"];class Ad{#De;#Re;constructor({shop:e,requestInfoData:t,identity:s,shopPay:i}){if(null==t)throw new tt("Request info data is missing",{groupingHash:"SettingsCreateError::RequestInfoDataMissing"});if(null==t.shop)throw new tt("Request info data shop details are missing",{groupingHash:"SettingsCreateError::RequestInfoDataShopDetailsMissing"});const n=st({country:e.country,countrySpecific:e.countrySpecific,addressFormSettings:e.addressFormSettings,requestInfoData:t}),r={autocompleteEnabled:e.billingAddressFormSettings.addressAutocompletion,validationEnabled:!1,defaultShippingDetails:n.defaultShippingDetails,isVisible:t=>{const s=e.billingAddressFormSettings[t]?.mode;return null==s||"IGNORED"!==s},isRequired:t=>{const s=e.billingAddressFormSettings[t]?.mode;return null==s||"REQUIRED"===s}},a=function({baseSettings:e,identity:t,shopPay:s}){return"businessCustomer"===t.current.value?function(e){return{...e,isRequired:e=>yd.includes(e),isVisible:e=>vd.includes(e)}}(e):"shopPay"===t.current.value?function({baseSettings:e,shopPay:t}){return{...e,isRequired:(s,i)=>i?.useMerchantSettings?e.isRequired(s,i):!("phone"!==s||!t.session.isUnverifiedEnrollment.value||t.user.phoneNumber.value.trim())||!!ga(s,t)||bd.includes(s),isVisible:(s,i)=>i?.useMerchantSettings?e.isVisible(s,i):!ga(s,t)&&(Sd.includes(s)||e.isVisible(s))}}({baseSettings:e,shopPay:s}):e}({baseSettings:n,identity:s,shopPay:i}),o=function({baseSettings:e,identity:t}){return"businessCustomer"===t.current.value?function(e){return{...e,isRequired:e=>yd.includes(e),isVisible:e=>fd.includes(e)}}(e):"shopPay"===t.current.value?function(e){return{...e,isRequired:(t,s)=>s?.useMerchantSettings?e.isRequired(t,s):bd.includes(t),isVisible:t=>Sd.includes(t)||e.isVisible(t)}}(e):e}({baseSettings:r,identity:s});this.#De=g(a),this.#Re=g(o),this.nonBillingAddressSettings=this.#De,this.billingAddressSettings=this.#Re}update(e){if("shopConfig"in e){if(null==e.shopConfig)throw new _d("Shop data is missing",{groupingHash:"AddressSettingsUpdateError::ShopConfigMissing"});const t=e.shopConfig.shopConfigurations.defaultConfiguration.addressFormSettings.addressAutocompletion,s=e.shopConfig.billingAddressFormSettings.addressAutocompletion;null!=t&&this.#De.peek().autocompleteEnabled!==t&&(this.#De.value={...this.#De.value,autocompleteEnabled:t}),null!=s&&this.#Re.peek().autocompleteEnabled!==s&&(this.#Re.value={...this.#Re.value,autocompleteEnabled:s})}else"autocompleteEnabled"in e&&this.#De.peek().autocompleteEnabled!==e.autocompleteEnabled&&(this.#De.value={...this.#De.value,autocompleteEnabled:e.autocompleteEnabled},this.#Re.value={...this.#Re.value,autocompleteEnabled:e.autocompleteEnabled})}}class _d extends e{constructor(){super(...arguments),this.name="AddressSettingsCreateError"}}const Pd={typographyScale:{base:14},link:{typographyDecoration:"none"},cornerRadius:{small:4,base:6,large:12},optionList:{border:"full"}},Cd={header:{banner:void 0}},kd={typographyScale:{base:14}},Ed=new rt(0,0,100),wd=Ed,Td=new rt(265.9,2.4,10.84),Md=new rt(247.3,99.1,60.1,1),Id=new rt(265.9,1.26,28.9),Dd=new rt(12.177050630061808,91.27499736580106,55.14831050892033),Rd={theme:{colors:{global:{},schemes:{scheme1:{base:{background:wd}}}}},shell:{}},xd={theme:{colors:{global:{info:Ed,brand:Md,accent:Md,critical:Dd},schemes:{scheme1:{base:{accent:Md,background:Td,border:Id,custom:Td,text:Ed},control:{accent:Md,background:Td,border:Id,custom:Td,text:Ed,selected:{background:Td,border:Md,accent:Md}},primaryButton:{background:Md,text:Ed}},scheme2:{base:{accent:Md,background:Td,border:Id,custom:Md,icon:Ed,text:Ed},control:{accent:Md,background:Td,border:Id,custom:Md,icon:Ed,text:Ed,selected:{background:Td,border:Md,accent:Md}},primaryButton:{background:Md,text:Ed}}}}},shell:{}},Ld={FIXED:"inline",INLINE:"inline",INLINE_SECONDARY:"inlineSecondary",START:"start"},Od={INLINE:"inline",END:"end"},Bd={START:"start",CENTER:"center",END:"end"},Fd={ICON:"icon",IMAGE:"image",TEXT:"text"},Nd={FULL:"full",NONE:"none"},Ud={...Nd,BLOCK_END:"blockEnd"},qd={BASE:"base",DASHED:"dashed",DOTTED:"dotted"},Vd={NONE:"none",BASE:"base",LARGE:"large100",LARGE_100:"large100",LARGE_200:"large200"},zd={NONE:"none",SMALL_200:"extraSmall",SMALL_100:"small",BASE:"base",LARGE_100:"large",LARGE_200:"extraLarge"},Hd={TRANSPARENT:"transparent",BASE:"base",SUBDUED:"subdued"},jd={BASE:"base",NONE:"none",SMALL:"small",LARGE:"large",ROUNDED:"fullyRounded"},Wd={BASE:"base",LOOSE:"loose",EXTRA_LOOSE:"xloose"},$d={NONE:"none",TITLE:"title",UPPER:"upper",LOWER:"lower"},Gd={AUTO:"auto",STABLE:"stable"},Yd={NONE:"none",SMALL_500:"small500",SMALL_400:"small400",SMALL_300:"small300",SMALL_200:"small200",SMALL_100:"small100",SMALL:"small100",BASE:"base",LARGE:"large100",LARGE_100:"large100",LARGE_200:"large200",LARGE_300:"large300",LARGE_400:"large400",LARGE_500:"large500"},Jd={NONE:"none",EXTRA_TIGHT:"small400",TIGHT:"small200",BASE:"base",LOOSE:"large200",EXTRA_LOOSE:"large500"},Kd={EXTRA_SMALL:"extraSmall",SMALL:"small",BASE:"base",MEDIUM:"medium",LARGE:"large",EXTRA_LARGE:"extraLarge",EXTRA_EXTRA_LARGE:"extraExtraLarge"},Xd={PRIMARY:"primary",SECONDARY:"secondary"},Qd={BASE:"base",BOLD:"bold"},Zd={BASE:"base",SUBDUED:"subdued"},el={BASE:"base",LARGE:void 0,SMALL:"small"},tl={INSIDE:"inside",OUTSIDE:"outside"},sl={VISIBLE:"visible",HIDDEN:"hidden"},il={VISIBLE:"visible",HIDDEN:"hidden",DYNAMIC:"dynamic"},nl={BASE:"base",SUBDUED:"subdued"},rl={BASE:"base",CUSTOM:"custom"},al={START:"start",CENTER:"center",BASELINE:"baseline"},ol={ACCENT:"accent",BASE:"base"},dl={COVER:"cover",CONTAIN:"contain"},ll={BASE:"base",HIGH:"high"},ul={INLINE:"inline",BLOCK:"block"},cl={BASE:"base",SUBDUED:"subdued"},hl={BLOCK:"block",INLINE:"inline"},pl={HIDDEN:"hidden",VISIBLE:"visible",VISIBLE_WHEN_MULTIPLE:"visibleWhenMultiple"},gl={FIXED:"fixed",COLLAPSIBLE:"collapsible"},ml={INLINE:"inline",INLINE_DESCRIPTION_LIST:"inlineDescriptionList",DESCRIPTION_LIST:"descriptionList"},yl={COMMA:"comma",MIDDOT:"middot"},vl={MONOCHROME:"monochrome",ACCENT:"accent",SUBDUED:"subdued"},fl={BASE:"base",LARGE_100:"large-100"},bl={AUTO:"auto",CUSTOM:"custom"},Sl={SMALL:"small",BASE:"base",LARGE:"large",LARGE_100:"large100",LARGE_200:"large200",LARGE_300:"large300"};function Al(e,t){return e.initialRequest.url.searchParams.get("extracted_reductions_exp")||t.get("experiments")?.find(({clientHandle:e})=>"e_53fd82dc1f9722eff524544be73e81c5"===e)?.variant||""}var _l=(e=>(e.Control="control",e.Treatment0A="treatment_0a",e.Treatment0B="treatment_0b",e.Treatment1="treatment_1",e.Treatment2="treatment_2",e.Treatment3="treatment_3",e))(_l||{});function Pl(e,t){return(e.initialRequest.url.searchParams.get("floating_summary_exp")||t.get("experiments")?.find(({clientHandle:e})=>"e_6d279941f0e9abf0f258b7dc3849503a"===e)?.variant)??""}class Cl{constructor(e){this.#xe=g({}),this.configurationSignal=this.#xe,this.#xe.value={...e},this.#Le={...e}}#xe;#Le;get configuration(){return v(()=>this.#xe.value)}get initialConfiguration(){return this.#Le}set(e,t){this.#xe.value={...this.#xe.value,[e]:t}}reset(){this.#xe.value={...this.#Le}}replace(e){this.#xe.value={...e}}}const kl="https://cdn.shopify.com/static/fonts/gt-standard/v1",El={name:"GT Standard",base:{weight:400,sources:`url(${kl}/GT-Standard-M-Standard-Regular-1790124696281.woff2) format('woff2')`},bold:{weight:600,sources:`url(${kl}/GT-Standard-M-Standard-Semibold-1790124696281.woff2) format('woff2')`}},wl={fonts:El.name,weightBase:`${El.base.weight}`,sourceBase:El.base.sources,weightBold:`${El.bold.weight}`,sourceBold:El.bold.sources};function Tl(e){return{main:{padding:e?["none","large200"]:"none",section:{padding:e?void 0:["none","large200"]}},footer:{padding:e?"none":["none","large200"]}}}function Ml(e){return t=>t?e[t]:void 0}function Il(e){return{size:Ml(Kd)(e?.size),letterCase:Ml($d)(e?.letterCase),fonts:Ml(Xd)(e?.fonts),weight:Ml(Qd)(e?.weight),kerning:Ml(Wd)(e?.kerning)}}function Dl(e){const{divider:t}=e??{};return{divider:{visibility:Ml(sl)(t?.visibility),borderStyle:Ml(qd)(t?.borderStyle),borderWidth:Ml(Vd)(t?.borderWidth)}}}function Rl(e){const{divided:t}=e??{};return{...xl(e),divided:t??void 0}}function xl(e){const{background:t,border:s,borderStyle:i,borderWidth:n,cornerRadius:r,padding:a,shadow:o}=e??{};return{background:Ml(Hd)(t),border:Ml(Nd)(s),borderStyle:Ml(qd)(i),borderWidth:Ml(Vd)(n),cornerRadius:Ml(jd)(r),padding:Ml(Yd)(a),shadow:Ml(zd)(o)}}function Ll(e,t){const s=ma(e,t);return s.rules=function(e,t){const s=t.filter(e=>null!=e&&null!=e.condition);return[...e.map(e=>{const t=s.find(t=>ot(t?.condition,e.condition));return t?ma(e,t):e}),...s.filter(t=>!e.some(e=>ot(e.condition,t?.condition)))]}(e.rules??[],(t.rules??[]).filter(e=>null!=e)),s}function Ol(e,{prefersDarkMode:t}){let s=e;for(const i of e.rules??[])if("dark"===i.condition?.prefersColorScheme&&t){const{condition:e,...t}=i;s=ma(s,t)}return s}function Bl(e,t,s,i=!1){const{blockPadding:n,inlinePadding:r}=e.rollup??{},a=e=>{const t=function(e){let t,s;Array.isArray(e)?4===e.length?[t,,,s]=e:[t,s]=e:(t=e,s=e);const i=e=>null==e||"none"===e?"base":e;return{blockPadding:i(t),inlinePadding:i(s)}}(e);return{blockPadding:n??t.blockPadding,inlinePadding:r??t.inlinePadding}};return{...e,rollup:{...e.rollup,inlinePadding:r??(s?void 0:"base"),cardPadding:a(t),...i&&{capPaddingOnMobile:i}},...null!=e.vaulted?.padding&&{vaulted:{...e.vaulted,rowPadding:a(e.vaulted.padding)}}}}const Fl={background:"#FFFFFF"};class Nl{constructor({themeData:e,shop:t,mobileCheckoutSdk:s,client:i,router:n,identity:r,shopPay:a,checkoutSheetProtocolConfig:o,embed:d,environment:l,serializations:u,observability:c,orderSummaryPlacement:h="afterDetails",isUniversalCheckoutFinalizer:p=!1}){this.#Oe={rollup:{},vaulted:{}},this.#Be=(e,t)=>{const s=this.#Fe[e];return void 0!==s&&t.includes(s)},this.previewRowPadding=(e,t=!1)=>{const s=this.shell.configuration.main.section?.padding,{rollup:i,vaulted:n}=Bl(ma(t?{rollup:{},vaulted:{}}:this.#Oe,e),s,null!=s&&"none"!==s);this.theme.set("rollup",{...this.theme.configuration.rollup,blockPadding:i.blockPadding,inlinePadding:i.inlinePadding,cardPadding:i.cardPadding}),this.theme.set("vaulted",{...this.theme.configuration.vaulted,rowPadding:n.rowPadding})},this.#Ne=h,this.#Ue=p,this.#Me="one-page"===u.get("checkoutLayout"),this.#qe=u.get("partnerBranding"),this.#Ve=s,this.#ze=i,this.#He=n,this.#je=r,this.#U=a,this.#We=o??void 0,this.#$e=d,this.#Fe=((e,t)=>({reductions:Al(e,t),floatingSummary:Pl(e,t)}))(i,u),this.#Ge=l,this.#Ye=e,this.#Je=t.hasFlagEnabled(dt),this.#Ke=Boolean(u.get("embed")?.interstitialBrandingEnabled),this.#Xe=t.hasFlagEnabled(lt),this.#Qe=function(e){const t=e?.find(({clientHandle:e})=>e===nt)?.variant;return Object.values(it).find(e=>e===t)??it.Control}(u.get("experiments"))===it.Treatment,this.#Ze=u.get("shop")?.enabledFlags.includes(ut)??!1,this.#et=d?.isCheckoutKit({includeLegacyCsk:!1})??!1;const{themeConfig:g,shellConfig:y}=this.#tt();if(this.shell=new Cl(y),this.theme=new ct(g),this.#Ue&&ht(d?.embedder)){let e="/thank-you"===n.currentUrl.peek().normalizedPath;m(()=>{const t="/thank-you"===n.currentUrl.value.normalizedPath;t!==e&&(e=t,v(()=>{const e=Tl(t),{main:s,footer:i}=this.shell.configuration;f(()=>{this.shell.set("main",{...s,...e.main,section:{...s.section,...e.main.section}}),this.shell.set("footer",{...i,...e.footer})})}))})}if(d?.embedder){const e=this.#qe,t=Boolean(e)&&!this.#st();c.log("branding_decision","[Branding] embedded partner session branding inputs",{embedder:d.embedder,embedPlatformCategory:d.platformCategory??"none",embedColorScheme:d.ui?.colorScheme??"none",shopPayIsActive:"shopPay"===r.current.value,shopPayIsShopServerOrigin:a.isShopServerOrigin,shopPayIsExternal:a.isExternal,shopPayUsingShopLayout:a.app.usingShopLayout.value,shouldForceEcpLightMode:this.#st(),interstitialBrandingEnabled:this.#Ke,partnerHasFrontendBranding:Boolean(e),partnerOverlayApplied:t,initialUrlOrigin:i.initialRequest.url.origin,prefersDarkMode:this.prefersDarkMode})}let b=this.prefersDarkMode;m(()=>{if(b!==this.prefersDarkMode){const{themeConfig:e,shellConfig:t}=this.#tt();this.theme.replace(e),this.#st()&&this.shell.replace(t),b=this.prefersDarkMode}})}#Me;#Ne;#Fe;#Ve;#ze;#He;#je;#U;#We;#Je;#Ke;#Xe;#Qe;#Ze;#et;#Ue;#$e;#Ge;#qe;#Ye;#Oe;#Be;#it(){const e=this.#Be("floatingSummary",[_l.Treatment0B]),t=this.#Be("floatingSummary",[_l.Treatment1,_l.Treatment2,_l.Treatment3]),s=this.#Be("floatingSummary",[_l.Treatment1,_l.Treatment3]);return{announcement:{colorScheme:"scheme6",visibility:"hidden"},canvas:{},header:{position:this.#Me?"start":"inline"},cartLink:{},disclosure:{style:t?"base":"legacy",visibility:s&&this.#Me?"hidden-only-checkout":void 0},reductions:{position:"inside_order_summary",applyButtonPosition:this.#Je?"base":"outside_field",discountTagsDisplay:"always_visible",automaticTagsDisplay:e?"visible":"hidden",spacing:"small100"},buyerJourney:{visibility:"visible",position:"inline"},content:{},expressCheckout:{},main:{},orderSummary:{colorScheme:"scheme2",mobile:{},collapsedSavingsDisplay:this.#Je?"base":"total_savings",priceReductionAnimation:this.#Je?"base":"none",floatingSummary:{visibility:s?"visible":"hidden"},thumbnailStyle:t?"base":"fan"},footer:{position:"inline",alignment:"start",content:{typography:this.#Me?void 0:{size:"small"}}},environment:this.#Ge,payButton:{position:this.#Je&&this.#Me?"sticky":"inline",embeddedTotal:this.#Je?"visible":"hidden"}}}#nt(e,t){const{shared:s,divider:i,control:n,headingLevel1:r,headingLevel2:a,headingLevel3:o,headingLevel4:d,main:l,orderSummary:u,header:c,footer:h,textField:p,select:g,choiceList:m,checkbox:y,primaryButton:v,secondaryButton:f,rollup:b,lineItems:S,merchandiseThumbnail:A,vaulted:_,vaultedItem:P,icons:C}=e??{},k=S,E=b?.chevronCustomizations,{typography:w,cornerRadius:T}=t??{},M=xl(l?.section),I=pt(M,["border","borderStyle","borderWidth","cornerRadius","background","shadow"]);return{icons:Object.fromEntries((C??[]).map(e=>[yt(e.name.toLowerCase()),e.url])),global:{cornerRadius:Ml(jd)(s?.cornerRadius),typographyLetterCase:Ml($d)(s?.typography?.letterCase),typographyKerning:Ml(Wd)(s?.typography?.kerning)},cornerRadius:{small:T?.small??void 0,base:T?.base??void 0,large:T?.large??void 0},spacing:{},typographySize:{},typographyLineHeight:{},colors:{global:{success:s?.colors?.success??void 0,warning:s?.colors?.warning??void 0,critical:s?.colors?.critical??void 0,info:s?.colors?.info??void 0,brand:s?.colors?.button??void 0,accent:s?.colors?.accent??void 0,custom:s?.colors?.decorative??void 0,control:s?.colors?.control??void 0},schemes:gt.reduce((e,t)=>({...e,[t]:mt(t,{scheme1:l?.colors,scheme2:u?.colors,scheme3:c?.colors,scheme4:h?.colors,scheme5:l?.section?.colors,scheme7:u?.section?.colors})}),{})},typographyScale:{base:w?.size?.base??void 0,ratio:w?.size?.ratio??void 0},typographyPrimary:Pa(w?.primary??{}),typographySecondary:Pa(w?.secondary??{}),headingLevel1:{typography:Il(r?.typography)},headingLevel2:{typography:Il(a?.typography)},headingLevel3:{typography:Il(o?.typography)},headingLevel4:{typography:Il(d?.typography)},divider:{borderStyle:Ml(qd)(i?.borderStyle),borderWidth:Ml(Vd)(i?.borderWidth)},link:{},control:{border:Ml(Nd)(n?.border),cornerRadius:Ml(jd)(n?.cornerRadius),labelPosition:Ml(tl)(n?.labelPosition)},textField:{typography:Il(p?.typography),border:Ml(Ud)(p?.border)},select:{typography:Il(g?.typography),border:Ml(Ud)(g?.border)},choiceList:{group:{spacing:Ml(Yd)(m?.group?.spacing)}},optionList:{},checkbox:{cornerRadius:Ml(jd)(y?.cornerRadius)},lineItems:{quantityVisibility:Ml(pl)(k?.quantityVisibility),priority:Ml(ll)(k?.priority),sectionLayout:Ml(gl)(k?.sectionLayout),priceLayout:Ml(ul)(k?.priceLayout),blockPadding:Ml(Yd)(k?.blockPadding),inlinePadding:Ml(Yd)(k?.inlinePadding),optionsColor:Ml(cl)(k?.optionsColor),optionsFormat:Ml(ml)(k?.optionsFormat),optionsSeparator:Ml(yl)(k?.optionsSeparator),titleTypography:Il(k?.titleTypography),priceTypography:Il(k?.priceTypography),optionsTypography:Il(k?.optionsTypography)},moneyLines:{},moneySummary:{},rollup:{chevronCustomizations:{color:Ml(vl)(E?.color),direction:Ml(hl)(E?.direction),size:Ml(fl)(E?.size)},background:Ml(Hd)(P?.background),blockPadding:Ml(Yd)(P?.blockPadding),blockAlignment:Ml(al)(P?.blockAlignment),inlinePadding:Ml(Yd)(P?.inlinePadding),border:Ml(Ud)(P?.border),borderStyle:Ml(qd)(P?.borderStyle),borderWidth:Ml(Vd)(P?.borderWidth),cornerRadius:Ml(jd)(P?.cornerRadius),icon:{visibility:Ml(sl)(P?.icon?.visibility),sizeClosed:Ml(Sl)(P?.icon?.sizeClosed),sizeOpen:Ml(Sl)(P?.icon?.sizeOpen)},label:{visibility:Ml(il)(P?.label?.visibility),size:Ml(Kd)(P?.label?.size),color:Ml(Zd)(b?.label?.color),weight:Ml(Qd)(b?.label?.weight)},children:{blockPaddingEnd:Ml(Yd)(b?.children?.blockPaddingEnd),blockPaddingStart:Ml(Yd)(b?.children?.blockPaddingStart)},primaryContent:{typography:{size:Ml(Kd)(P?.primaryContent?.typography?.size),weight:Ml(Qd)(P?.primaryContent?.typography?.weight),lineHeight:Ml(el)(P?.primaryContent?.typography?.lineSize)}},secondaryContent:{typography:{size:Ml(Kd)(P?.secondaryContent?.typography?.size),color:Ml(Zd)(P?.secondaryContent?.typography?.color),weight:Ml(Qd)(P?.secondaryContent?.typography?.weight),lineHeight:Ml(el)(P?.secondaryContent?.typography?.lineSize)}},action:{tone:Ml(bl)(P?.action?.tone)}},modal:{},primaryButton:{border:Ml(Ud)(v?.border),blockPadding:Ml(Jd)(v?.blockPadding2),inlinePadding:Ml(Jd)(v?.inlinePadding2),cornerRadius:Ml(jd)(v?.cornerRadius),typography:Il(v?.typography)},secondaryButton:{border:Ml(Ud)(v?.border),blockPadding:Ml(Jd)(f?.blockPadding2),inlinePadding:Ml(Jd)(f?.inlinePadding2),cornerRadius:Ml(jd)(f?.cornerRadius),typography:Il(f?.typography)},formLayout:{},popover:{},merchandiseThumbnail:{background:Ml(nl)(A?.background),border:Ml(Nd)(A?.border),cornerRadius:Ml(jd)(A?.cornerRadius),fit:Ml(dl)(A?.fit),borderColor:Ml(rl)(A?.borderColor),badge:{background:Ml(ol)(A?.badge?.background)}},vaulted:{spacing:Ml(Yd)(_?.spacing),background:Ml(Hd)(_?.background),padding:Ml(Yd)(_?.padding),...!this.#Xe&&!I&&{border:"full",borderStyle:"base",borderWidth:"base",cornerRadius:"large"},divider:{visibility:Ml(sl)(_?.divider?.visibility),borderStyle:Ml(qd)(_?.divider?.borderStyle),borderWidth:Ml(Vd)(_?.divider?.borderWidth)}}}}#rt(e,t){const{header:s,main:i,expressCheckout:n,orderSummary:r,rollup:a,cartLink:o,buyerJourney:d,footer:l,content:u}=e??{},c=a?.chevronCustomizations?.size;return{announcement:t.announcement,environment:this.#Ge,canvas:{...t.canvas,scrollbarGutter:Ml(Gd)(i?.scrollbarGutter)},header:{...Rl(s),colorScheme:"scheme3",position:s?.position?Ld[s.position]:t.header.position,alignment:Ml(Bd)(s?.alignment),banner:{image:s?.banner?.image?.main??void 0},logo:{visibility:Ml(sl)(s?.logo?.visibility),image:s?.logo?.image?.main??void 0,maxWidth:s?.logo?.maxWidth??void 0,aspectRatio:s?.logo?.image?.width&&s?.logo?.image?.height?s.logo.image.width/s.logo.image.height:void 0,altText:s?.logo?.image?.altText},cartLink:{contentType:Ml(Fd)(s?.cartLink?.contentType),image:{src:s?.cartLink?.image?.main??void 0}}},disclosure:t.disclosure,reductions:{position:this.#Me&&"EXPANDED"===r?.defaultState?"base":t.reductions.position,applyButtonPosition:t.reductions.applyButtonPosition,discountTagsDisplay:t.reductions.discountTagsDisplay,automaticTagsDisplay:t.reductions.automaticTagsDisplay,spacing:t.reductions.spacing},buyerJourney:{position:t.buyerJourney.position,visibility:Ml(sl)(d?.visibility)??t.buyerJourney.visibility,alignment:s?.position&&"inline"===Ld[s.position]||"inline"===t.header.position?Ml(Bd)(s?.alignment):void 0},content:{...Dl(u)},cartLink:{visibility:Ml(sl)(o?.visibility)},expressCheckout:{padding:Ml(Yd)(n?.padding),background:Ml(Hd)(n?.background),button:{cornerRadius:Ml(jd)(n?.button?.cornerRadius)}},main:{...Dl(i),backgroundImage:i?.backgroundImage?.main??void 0,spacing:Ml(Yd)(i?.spacing),colorScheme:"scheme1",section:{...xl(i?.section),colorScheme:"scheme5"}},orderSummary:{...Dl(r),backgroundImage:r?.backgroundImage?.main??void 0,colorScheme:"scheme2",section:{...xl(r?.section),colorScheme:"scheme7"},defaultState:this.#Me?void 0:r?.defaultState,headerPosition:r?.headerPosition??void 0,currencyBadgeVisibility:r?.currencyBadgeVisibility??void 0,totalDueTypography:r?.totalDueTypography,chevronSize:Ml(fl)(c),mobile:t.orderSummary.mobile,collapsedSavingsDisplay:t.orderSummary.collapsedSavingsDisplay,priceReductionAnimation:t.orderSummary.priceReductionAnimation,thumbnailStyle:t.orderSummary.thumbnailStyle,floatingSummary:t.orderSummary.floatingSummary},footer:{...Rl(l),colorScheme:"scheme4",position:Ml(Od)(l?.position)??t.footer.position,alignment:Ml(Bd)(l?.alignment)??t.footer.alignment,content:{visibility:Ml(sl)(l?.content?.visibility)}},payButton:t.payButton}}#at(e,t){let s;const i=this.#ot();switch(i){case"LIGHT":case"AUTOMATIC":default:s=Rd;break;case"DARK":s=xd;break;case"WEB_DEFAULT":s={theme:{},shell:{}}}const n="WEB_DEFAULT"===i,r=n?kd:Pd,a=n?{}:Cd,o="AUTOMATIC"===i&&this.prefersDarkMode?xd.shell:s.shell,d=ma(e,r,s.theme),l=ma(t,a,o);return"AUTOMATIC"!==i?{theme:d,shell:l}:{theme:Ll(d,{rules:[{condition:{prefersColorScheme:"dark"},...xd.theme}]}),shell:l}}#dt(){return this.#et&&"APP"===this.#$e?.ui?.branding}#ot(){return this.#dt()?this.#$e?.ui?.colorScheme??"AUTOMATIC":this.#Ve.config.colorScheme??void 0}#lt(){return vt(this.#U)}#st(){return"shopPay"===this.#je.current.value&&!ht(this.#$e?.embedder)&&(this.#lt()||Boolean(this.#$e))}#ut(){return this.#Ke||this.#st()}#ct(){return"shopPay"===this.#je.current.value&&!ht(this.#$e?.embedder)&&!this.#U.visibility.showCartLink}get prefersDarkMode(){if(this.#ut())return!1;if(ht(this.#$e?.embedder))return!!this.#U.app.usingShopLayout.value&&Boolean(this.#U.app.config.darkMode);let e;if(this.#Ve.config.colorScheme&&this.#Ve.variant.isStandard()&&this.#Ve.enabled&&(e=this.#Ve.config.colorScheme),!this.#$e?.ui?.colorScheme||this.#et&&!this.#dt()||(e=this.#$e.ui.colorScheme),e){if("DARK"===e)return!0;if("LIGHT"===e)return!1;if("AUTOMATIC"===e||"WEB_DEFAULT"===e)return this.#ze.prefersDarkMode.value}return this.#U.app.usingShopLayout.value?Boolean(this.#U.app.config.darkMode):this.#ze.prefersDarkMode.value}get isEmbeddedShopPayTheme(){return this.#st()}#tt(){const e=this.#ot(),t=this.#Ve.variant.isStandard()||this.#dt(),{customizations:s,designSystem:i}=function(e,t,s){return t?"WEB_DEFAULT"===s.colorScheme?e:{customizations:{},designSystem:{}}:e}(this.#Ye,t,{...this.#Ve.config,colorScheme:e}),n=this.#it(),r=this.#rt(s,n),a=this.#nt(s,i),o=!t||"WEB_DEFAULT"===e;for(const g of o?this.#Ye?.rules??[]:[]){const e=g.customizations?this.#rt(g.customizations,r):r;if(g.customizations&&(r.rules=[...r.rules??[],{condition:{prefersColorScheme:"DARK"===g.condition.prefersColorScheme?"dark":void 0},...e,reductions:void 0}]),g.designSystem||g.customizations){const e=this.#nt(g.customizations,g.designSystem);a.rules=[...a.rules??[],{condition:{prefersColorScheme:"DARK"===g.condition.prefersColorScheme?"dark":void 0},...e}]}}let d,l=a,u=r;if(t){const t={theme:a,shell:"WEB_DEFAULT"===e?r:n},s=this.#at(t.theme,t.shell);l=s.theme,u=s.shell}else if(this.#We)l=a;else if(ht(this.#$e?.embedder)){const{themeConfig:e,shellConfig:t}=function({defaultShellConfig:e,orderSummaryPlacement:t="afterDetails",isThankYouPage:s=!1,...i}){const n="beforeDetails"===t,r=ka(i),a={...r,typographyPrimary:wl,typographySecondary:wl,vaulted:{...r.vaulted,shadow:"none",padding:"none",cornerRadius:"none"},rollup:{...r.rollup,inlinePadding:"large200"},moneySummary:{...r.moneySummary,labelTypography:{size:"base",weight:"bold"}}},o=Tl(s);return{themeConfig:a,shellConfig:ma(e,{main:{...o.main,spacing:"base"},orderSummary:{...n?{headerPosition:"TOP",defaultState:"COLLAPSED",thumbnailStyle:"fan",totalLabel:"TOTAL"}:{},totalDueTypography:{size:"base",weight:"bold"}},...n?{reductions:{position:"inside_order_summary",disclosureVisibility:"hidden"}}:{},footer:{...o.footer}})}}({orderSummaryPlacement:this.#Ne,isThankYouPage:this.#Ue&&"/thank-you"===this.#He.currentUrl.value.normalizedPath,darkMode:this.prefersDarkMode,fontScale:this.#U.app.usingShopLayout.value?this.#U.app.config.fontScale:1,defaultShellConfig:n});l=e,u=t}else if(this.#U.app.usingShopLayout.value)l=ka({darkMode:this.prefersDarkMode,fontScale:this.#U.app.config.fontScale}),u={...n,environment:r.environment,...ft(this.#U.app.config)?{header:{...n.header,logo:{...n.header.logo,visibility:"hidden"}},cartLink:{...n.cartLink,visibility:"hidden"}}:{}};else if(Le(this.#U)){const{visibility:e}=this.#U;e.isOrderSummaryCollapsible||(u={...u,orderSummary:{...u.orderSummary,isCollapsible:!1,defaultState:"EXPANDED"}}),e.showDefaultShopTheme&&(l=ka({darkMode:!1,fontScale:this.#U.app.config.fontScale}))}else this.isEmbeddedShopPayTheme?(l=ka({darkMode:this.prefersDarkMode,fontScale:1,isEmbedded:!0}),d={cornerRadius:l.cornerRadius,primaryButton:l.primaryButton,secondaryButton:l.secondaryButton,merchandiseThumbnail:l.merchandiseThumbnail},u={...n,environment:r.environment}):l=a;const c=this.#$e?.embedder;if(c&&!this.#st()){const e=this.#qe;e&&(l=Ll(l,e.theme),u=Ll(u,e.shell))}d&&(l={...l,cornerRadius:d.cornerRadius,primaryButton:{...l.primaryButton,cornerRadius:d.primaryButton?.cornerRadius},secondaryButton:{...l.secondaryButton,cornerRadius:d.secondaryButton?.cornerRadius},merchandiseThumbnail:{...l.merchandiseThumbnail,cornerRadius:d.merchandiseThumbnail?.cornerRadius??"small"}}),l=Ol(l,{prefersDarkMode:this.prefersDarkMode}),u=Ol(u,{prefersDarkMode:this.prefersDarkMode});const h=l.colors?.schemes?.scheme2;if(this.#Ze&&null==h?.base?.background&&(l={...l,colors:{...l.colors,schemes:{...l.colors?.schemes,scheme2:{...h,base:{...h?.base,...Fl}}}}}),this.#ut()){const e=e=>e?.filter(e=>"dark"!==e.condition?.prefersColorScheme)??[];l={...l,rules:e(l.rules)},u={...u,rules:e(u.rules)}}this.#ct()&&(u={...u,cartLink:{...u.cartLink,visibility:"hidden"}}),this.#Qe&&(l={...l,formLayout:{...l.formLayout,spacing:"none"}}),this.#Oe={rollup:l.rollup,vaulted:l.vaulted};const p=s?.main?.section?.padding;return{themeConfig:Bl(l,u.main.section?.padding,null!=p&&"NONE"!==p,this.#Xe),shellConfig:u}}update(e){this.#Ye=e;const{themeConfig:t,shellConfig:s}=this.#tt();this.theme.replace(t),this.shell.replace(s)}}const Ul="fulfillment.address_change",ql="payment.instruments_change",Vl="payment.credential";function zl(e,t){return e.includes(t)||e.includes(`ec.${t}`)}class Hl{constructor({serializations:e,layout:t,proposal:s,source:i,themeData:n,shop:r,profile:a,appConfiguration:o,mobileCheckoutSdk:d,client:l,router:u,shopPay:c,checkoutSheetProtocolConfig:h,requestInfoData:m,renderContextToken:y,identity:v,embed:f,observability:b}){this.#ht=new Map,this.#pt=g(void 0),this.profileKey=p(()=>this.#pt.value?.key),this.profile=p(()=>this.#pt.value?.profile),this.profileId=p(()=>this.#pt.value?.key.id),this.allowEmptyCart=!1,this.layout=t,this.visibility=new jl({proposal:s,source:i,appConfiguration:o,shop:r,shopPay:c,identity:v,layout:this.layout});const S=function({allowedDelegations:e,requestedDelegations:t,isUcpFlavoured:s}){if(s){const s=(s,i)=>zl(e,s)&&Boolean(t?.includes(i));return{isAddressDelegationEnabled:s(Ul,"fulfillment.address_change"),isPaymentInstrumentsDelegationEnabled:s(ql,"payment.instruments_change"),isPaymentCredentialDelegationEnabled:s(Vl,"payment.credential"),isWindowOpenDelegationEnabled:s("window.open","window.open")}}const i=zl(e,Ul),n=function(e){return zl(e,ql)||zl(e,Vl)}(e);return{isAddressDelegationEnabled:i,isPaymentInstrumentsDelegationEnabled:n,isPaymentCredentialDelegationEnabled:n,isWindowOpenDelegationEnabled:!1}}({allowedDelegations:o?.allowedDelegations??[],requestedDelegations:f?.delegations.requested?Array.from(f.delegations.requested):void 0,isUcpFlavoured:f?.protocol?.isUcpEcp??!1});this.isAddressDelegationEnabled=S.isAddressDelegationEnabled,this.isPaymentInstrumentsDelegationEnabled=S.isPaymentInstrumentsDelegationEnabled,this.isPaymentCredentialDelegationEnabled=S.isPaymentCredentialDelegationEnabled,this.isWindowOpenDelegationEnabled=S.isWindowOpenDelegationEnabled,this.isCvvBypassEnabled=Boolean(o?.isCvvBypassEnabled);const A=ht(f?.embedder);this.payButton={stickyPayButtonEnabledInWeb:Boolean(o?.payButton?.stickyPayButtonEnabledInWeb),stickyPayButtonEnabledInMobile:Boolean(o?.payButton?.stickyPayButtonEnabledInMobile),visibility:A?"HIDDEN":"VISIBLE"},this.showPayButton=!A,this.showContactInformation=!A,this.showFooter=!A,this.#gt(a,!1),this.#mt=void 0;const _=function({serializations:e,source:t}){return{isCheckoutEditor:function({serializedIsCheckoutEditor:e,sourceType:t}){return"boolean"==typeof e?e:"simulated"===t&&"undefined"!=typeof window&&window!==window.parent&&!at()}({serializedIsCheckoutEditor:e.get("isCheckoutEditor"),sourceType:t.type}),isOnePageCheckout:"one-page"===e.get("checkoutLayout")}}({serializations:e,source:i});this.isUniversalCheckoutFinalizer=ht(f?.embedder)&&l.initialRequest.url.searchParams.get(bt)===St,this.deliveryMethodSelectorPlacement=this.isUniversalCheckoutFinalizer?"vaulted":"adjacent";const P=this.isUniversalCheckoutFinalizer?"beforeDetails":"afterDetails";this.branding=new Nl({orderSummaryPlacement:P,isUniversalCheckoutFinalizer:this.isUniversalCheckoutFinalizer,serializations:e,themeData:n,shop:r,mobileCheckoutSdk:d,client:l,router:u,identity:v,shopPay:c,checkoutSheetProtocolConfig:h,embed:f,environment:_,observability:b}),this.addressSettings=new Ad({shop:r,requestInfoData:m,identity:v,shopPay:c}),this.renderContextToken=y,this.orderSummary=o?.orderSummary||"beforeDetails"===P?{layoutStyle:o?.orderSummary?.layoutStyle??"COMPACT",placement:P}:void 0,this.headerText={visibility:o?.headerText?.visibility??"HIDDEN"},this.#yt=p(()=>"shopPay"===v.current.value?c.user.phoneNumber.value:void 0),this.defaultPhoneNumber=this.#yt,this.trackAddressAutoComplete="shopPay"===v.current.value,this.allowRedirectToStorefront=!f&&!d.enabled&&(r.hasStorefront||Boolean(r.externalDomain)),this.hasExternalReceiptHandling="shopPayExternal"===i.type,this.hasExternalOrderNotifications="shopPayExternal"===i.type}#ht;#pt;#mt;#yt;get deferredProfileChangeId(){return this.#mt}getProfile(e){return this.#ht.get(b(At,e))}update(e){const{profile:t,requireBusinessCriticalOnly:s=!1,deferredProfileChangeId:i,themeData:n,addressSettings:r}=e;"profile"in e&&this.#gt(t,s),"deferredProfileChangeId"in e&&(this.#mt=i),n&&this.branding.update(n),r&&this.addressSettings.update(r)}#gt(e,t){if(!e)return void(this.#pt.value=void 0);const s={id:e.id,requireBusinessCriticalOnly:t};this.#ht.set(b(At,s),e),this.#pt.value={key:s,profile:e}}}class jl{constructor({proposal:e,source:t,appConfiguration:s,shop:i,shopPay:n,identity:r,layout:a}){this.showAside=!0,this.showOrderSummaryMerchandiseLines=!0,this.showHeader="HIDDEN"!==s?.shopHeader?.visibility,this.showReductions=function(e){return!e.hideReductionsField}(i);const o=s?.features?.isExpressCheckoutEnabled??!0;this.showExpressCheckout=p(()=>!["shopPay","businessCustomer"].includes(r.current.value)&&!(a?.isOnePage.value&&!["guest","customerAccount","sdkCartHints"].includes(r.current.value))&&o&&!e.negotiated.fields.buyerIdentity.value?.purchasingCompany&&!ye(t)),this.showEmailMarketing=s?.features?.isEmailMarketingEnabled??!0,this.showSmsMarketing=s?.features?.isSmsMarketingEnabled??!0,this.showTips=s?.features?.isTipsEnabled??!0,this.showCashRedemption=p(()=>"shopPay"===r.current.value&&"HIDDEN"!==s?.shopCash?.visibility),this.showDataSharingOptOut=p(()=>"shopPay"===r.current.value),this.showDeliveryHeading=p(()=>"guest"===r.current.value),this.showPurchaseOrderNumberField=p(()=>"businessCustomer"===r.current.value),this.showStandalonePhoneField=p(()=>"shopPay"===r.current.value&&!n.user.isAuthenticatedUser.value),this.showShippingLines=p(()=>{const t=(e.facts.delivery?.some(({deliveryAddress:e,pickupAddress:t})=>null!==t||null!==e)??!0)||e.negotiated.fields.isShippingRequired.value,s=e.negotiated.fields.deliveryNext.value,i=Boolean(s&&"filled"===s.status&&s.lines.some(({status:e})=>"not_required"!==e));return Boolean(t||i)}),this.showSubtotal=p(()=>{const{discountLines:s,paymentLines:i,taxes:n,tipLines:r,dutiesIncluded:a,legacyRepresentProductsAsFees:o,legacyMerchandiseLinesAsFees:d}=e.negotiated.fields,l=Boolean(s.value?.lines.length),u=Boolean(i.value?.lines.some(e=>"giftCard"===e.method.type)),c=Boolean(i.value?.lines.some(e=>"redeemable"===e.method.type&&"CUSTOM"===e.method.redemptionSource&&e.cost&&e.cost.amount>0&&e.method.redemptionContent)),h=e.facts.tax?e.facts.tax:"available_total_included"===n.value?.status?n.value.totalIncludedInTarget:"available_total"===n.value?.status?n.value.totalTax:null,p=(()=>{const t=n.value?.status;if("pending"===t||"unavailable"===t){const t=Boolean(e.negotiated.fields.merchandiseLines.value?.taxesIncluded),s=e.facts.taxesIncluded??!1;return t||s}return"available_total_included"===t})(),g=!a.value&&!p&&Boolean(h&&0!==h.amount),m=ye(t),y=m?e.facts.tip:r.value?.[0]?.amount,v=y&&y.amount>0,f=Boolean(o.value&&d.value&&d.value.lines.length>0),b=Boolean(i.value?.lines.some(e=>"redeemable"===e.method.type&&("STORE_CREDIT"===e.method.redemptionSource||"SHOP_CASH"===e.method.redemptionSource)));return Boolean(this.showShippingLines.value||l||u||c||g||b||v||m||f)}),this.showStoreCreditRedemption=p(()=>"shopPay"===r.current.value||"customerAccount"===r.current.value||"businessCustomer"===r.current.value),this.showOwnedGiftCards=p(()=>"shopPay"===r.current.value||"customerAccount"===r.current.value),this.showShopCashRewardsBanner=p(()=>"shopPay"===r.current.value&&"HIDDEN"!==s?.shopCash?.visibility),this.showInvalidDeliveryAddressBanner=p(()=>"shopPay"===r.current.value||"customerAccount"===r.current.value)}}class Wl{#vt=g([]);constructor({proposal:e,isCheckoutEditor:t}){const s=t?this.#vt:e.negotiated.fields.customFields;this.search=_t({items:p(()=>Ct(s.value??[])),getTarget:Pt})}add(e){this.#vt.value=[...this.#vt.peek().filter(({key:t})=>t!==e.key),e]}remove(e){this.#vt.value=this.#vt.peek().filter(t=>t.key!==e)}}function $l({extensionPoint:e,placementReference:t}){return wt(e)?t:void 0}function Gl(e){return e?{desktop:e.desktop?{height:e.desktop.height}:null,mobile:e.mobile?{height:e.mobile.height}:null}:void 0}function Yl({activatedExtensions:e,source:t,observability:s}){return"simulated"===t?.type?[]:e.reduce((e,{extension:i,targets:n,id:r,settings:a,behaviors:o,publicIdentifier:d})=>{const l=n.flatMap(({target:e,placementReference:n,extensionSkeletons:l,position:u,publicIdentifier:c})=>{if(!Tt(e))return[];const h=i.preloads;s&&t&&Xl({extension:i,extensionPoint:e,placementReference:n,observability:s,source:t,type:"persisted"});const p={target:e,metafields:i.metafieldRequests??[]};if(h.length)try{const t=Mt({extension:i,extensionPoint:e});t&&(p.preloads=t)}catch{s&&t&&function({extension:e,extensionPoint:t,observability:s,source:i,type:n}){s.error(new Dt(`${n.charAt(0).toUpperCase()}${n.slice(1)} extension ${e.uuid} could not parse preload url`),{severity:"error",metadata:{extension:{apiVersion:e.apiVersion,appId:e.appId,appApiKey:e.apiKey??null,appName:e.appName,id:e.uuid,extensionPoint:t,name:e.name,placementReference:void 0,type:n,version:e.version},source:{type:i.type}}})}({extension:i,extensionPoint:e,observability:s,source:t,type:"persisted"})}return{id:c,activatedExtensionId:Re(r),configuration:g(JSON.parse(a??"{}")),behaviors:g({alwaysReveal:o.alwaysReveal,showInExpressCheckout:o.showInExpressCheckout,blockProgress:o.blockProgress}),type:"persisted",publicIdentifier:d,position:g(u),targetPublicIdentifier:c,extensionId:i.uuid,registrationId:i.registrationUuid,apiVersion:i.apiVersion,version:i.version??"unstable",scriptUrl:i.scriptUrl,translations:JSON.parse(i.translations),extensionPoint:p,name:i.name,extensionLocale:i.extensionLocale,appId:i.appId,appApiKey:i.apiKey??null,appName:i.appName,placementReference:$l({extensionPoint:e,placementReference:n}),approvalScopes:new Set(i.approvalScopes.map(({handle:e})=>e)),capabilities:{apiAccess:i.capabilities.apiAccess,networkAccess:i.capabilities.networkAccess,blockProgress:i.capabilities.blockProgress,collectBuyerConsent:{smsMarketing:Boolean(i.capabilities.collectBuyerConsent?.smsMarketing),customerPrivacy:Boolean(i.capabilities.collectBuyerConsent?.customerPrivacy)}},extensionSkeletons:Gl(l)}});return[...e,...l]},[])}function Jl({globalExtension:{extension:e,publicIdentifier:t,extensionSkeletons:s},extensionPoint:i,placementReference:n,observability:r,source:a}){return r&&a&&Xl({extension:e,extensionPoint:i,placementReference:n,observability:r,source:a,type:"global"}),{apiVersion:e.apiVersion,appId:e.appId,appApiKey:e.apiKey??null,appName:e.appName,approvalScopes:new Set(e.approvalScopes.map(({handle:e})=>e)),extensionId:e.uuid,extensionLocale:e.extensionLocale,extensionPoint:{target:i,metafields:e.metafieldRequests??[]},id:t,publicIdentifier:t,registrationId:e.registrationUuid,scriptUrl:e.scriptUrl,translations:JSON.parse(e.translations),placementReference:$l({extensionPoint:i,placementReference:n}),name:e.name,version:e.version,capabilities:{apiAccess:e.capabilities.apiAccess,networkAccess:e.capabilities.networkAccess,blockProgress:e.capabilities.blockProgress,collectBuyerConsent:{smsMarketing:Boolean(e.capabilities.collectBuyerConsent?.smsMarketing),customerPrivacy:Boolean(e.capabilities.collectBuyerConsent?.customerPrivacy)}},extensionSkeletons:Gl(s)}}function Kl({globalExtensions:e,observability:t,source:s}){return e.map(e=>{const{target:i,placementReference:n}=e;return{...Jl({globalExtension:e,extensionPoint:i,placementReference:n??void 0,observability:t,source:s}),type:"global",configuration:g({}),behaviors:g({alwaysReveal:e.behaviors.alwaysReveal,showInExpressCheckout:e.behaviors.showInExpressCheckout,blockProgress:e.behaviors.blockProgress})}})}function Xl({extension:e,extensionPoint:t,placementReference:s,observability:i,source:n,type:r}){wt(t)&&!s&&i.error(new It(`${r.charAt(0).toUpperCase()}${r.slice(1)} extension ${e.uuid} have no placement reference defined, this extension will not be rendered`),{severity:"error",metadata:{extension:{apiVersion:e.apiVersion,appId:e.appId,appApiKey:e.apiKey??null,appName:e.appName,id:e.uuid,extensionPoint:t,name:e.name,placementReference:void 0,type:r,version:e.version},source:{type:n.type}}})}function Ql({proposal:e,serializedReceipt:t,source:s}){const i=e.negotiated.fields.buyerIdentity.value,n=i?.purchasingCompany?.location.id,r=i?.customerProfile?.id??function(e){const t=e?.customer;if(null==t)return null;switch(t.__typename){case"GuestProfile":return null;case"BusinessCustomerProfile":case"DecodedCustomerProfile":return t.id??null;default:tu(t)}}(t?.purchaseOrder?.buyerIdentity),a=i?.countryCode??function(e){const t=e?.customer;if(null==t)return null;switch(t.__typename){case"GuestProfile":case"BusinessCustomerProfile":case"DecodedCustomerProfile":return t.countryCode??null;default:tu(t)}}(t?.purchaseOrder?.buyerIdentity)??void 0,o=!n||"draftOrder"!==s.type&&"orderEdit"!==s.type&&"paymentCollection"!==s.type?void 0:s.sourceVersion;return{id:s.sourceId,...n&&{companyLocationId:n},...void 0!==r&&{customerProfileId:r},...!n&&a&&{countryCode:a},...o&&{version:o}}}function Zl({metafields:e,persistence:t,proposal:s,serializedReceipt:i,source:n}){t&&e.subscribe(e=>{t.createUpdate(Rt.Metafields,{scope:Ql({proposal:s,serializedReceipt:i,source:n})})(e)})}class eu extends Error{constructor(){super(...arguments),this.name="TypescriptAssertionError"}}function tu(e){throw new eu(`Received unexpected value ${JSON.stringify(e)} in an exhaustive switch/conditional block`)}const su=new Set;class iu extends e{constructor(){super(...arguments),this.name="ExtensibilityEngineNotLoadedError"}}class nu extends e{constructor(){super(...arguments),this.name="ExtensibilityEngineLoadError"}}class ru{constructor(e){this.ui=new au(e),this.customFields=new Wl({proposal:e.proposal,isCheckoutEditor:e.isCheckoutEditor})}}class au{constructor(e){this.#ft=g(!1),this.#bt=xt(),this.#St=!1,this.#At=new Promise(e=>{this.#_t=e}),this.ensureEngineLoaded=()=>this.required.value?this.#Pt():Promise.resolve();const{events:t,activatedExtensions:s,source:i,observability:n,shop:r,identity:a,proposal:o,isCheckoutEditor:d}=e;this.#Ct=e,this.#kt=s,this.#je=a,this.#V=i,this.#Et=n,this.#wt=d;const l=[...Kl({globalExtensions:r.globalUIExtensions,source:i,observability:n}),...Yl({activatedExtensions:s,source:i,observability:n})];this.#Tt=g(l),this.#Mt=p(()=>Bt(this.#Tt.value,{identity:this.#je})),this.hasAtRiskPlacement=p(()=>this.#Mt.value.map(e=>({target:e.extensionPoint.target,placementReference:e.placementReference})).some(({target:e,placementReference:t})=>Boolean(e&&kt(e)===kt("purchase.checkout.block.render")&&t&&Et.includes(t)))),this.search=_t({items:this.#Mt,getTarget:Lt}),this.#It=g(function({persistence:e,proposal:t,serializedReceipt:s,source:i}){const n=e?.get(Rt.Metafields,{scope:Ql({proposal:t,serializedReceipt:s,source:i})});return n?n.map(({key:e,namespace:t,value:s,valueType:i,appId:n})=>({key:e,namespace:t,value:s,valueType:i,appId:n})):[]}({persistence:e.persistence,proposal:o,serializedReceipt:e.serializedReceipt,source:e.source})),this.metafields=this.#It,this.required=p(()=>Ft({isCheckoutEditor:d,filteredExtensions:this.#Mt.value,shop:r,proposal:o})),this.enabled=this.#ft,t.addEventListener("bootloader:hydrate-start",()=>{const e=m(()=>{this.required.value&&this.#Pt().then(()=>{this.#ft.value&&e()}).catch(()=>{})})}),t.addEventListener("bootloader:hydrate-end",()=>{this.#_t()}),this.#Dt(l)}#je;#V;#Et;#wt;#Tt;#Mt;#ft;#bt;#It;#Ct;#kt;#St;#Rt;#xt;#_t;#At;unstable_isTargetMatch(e,t){return this.#bt(Lt(e),t)}#Dt(e){const{configuration:t,graphql:s,proposal:i}=this.#Ct,n=new Set(e.filter(e=>e.extensionPoint.metafields?.length).map(e=>e.id));0!==n.size&&m(()=>{if(this.#St)return;const e=Ea(i.negotiated);0!==e.length&&this.#Mt.value.some(e=>n.has(e.id))&&(this.#St=!0,Promise.resolve(wa({coreGraphql:s,resourceIds:e,checkoutProfileId:t.profileId.value})).catch(()=>{}))})}#Pt(){if(this.#xt)return this.#xt;const e=(async()=>{try{const{UIExtensibilityBrowserEngine:e}=await S(()=>t(()=>import("./4b77f49a.4HmIEZUf.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])));this.#Rt=new e({options:this.#Ct,activatedExtensions:this.#kt,isCheckoutEditor:this.#wt,extensions:this.#Tt,metafields:this.#It,afterHydrate:this.#At}),this.#ft.value=!0}catch(e){this.#xt=void 0,this.#Lt(e)}})();return this.#xt=e,e}#Lt(e){const t=e instanceof Error?e:new nu(String(e));this.#Et.error(t,{severity:"error",metadata:{extensibility:{extensionCount:this.#Mt.value.length,isCheckoutEditor:this.#wt}}}),this.#Et.log("extensibility_engine_load_failed","The UI-extensibility engine chunk failed to load; no extension will render for this checkout",{extensionCount:this.#Mt.value.length,isCheckoutEditor:this.#wt})}unstable_registerExtensionsManager(e){if(!this.#Rt)throw new iu("extensions manager registered before the engine loaded");this.#Rt.registerExtensionsManager(e)}hasBlockingExtensionForFeatures({features:e,deactivatedExtensionIds:t=su,placementReferences:s,excludedExtensionTargets:i}){return Ot({features:e,extensions:this.search().value,deactivatedExtensionIds:t,placementReferences:s,sourceType:this.#V.type,excludedExtensionTargets:i})}add(e){this.#Tt.value.some(t=>t.id===e.id)||(this.#Rt?.syncPermissions([e]),this.#Tt.value=[...this.#Tt.value,e])}remove(e,t){const s=this.#Tt.value.filter(t=>e.includes(t.id));this.#Rt?.removePermissions(s),this.#Tt.value=this.#Tt.value.filter(e=>!s.includes(e)),t?.keepAlive||this.#Rt?.destroyExtensions(s,t.reason)}replace({activatedExtensions:e},t){const s=[],i=new Map(Yl({activatedExtensions:e,source:this.#V,observability:this.#Et}).map(e=>[e.targetPublicIdentifier,e])),n=[...this.#Tt.value.map(e=>{if("persisted"!==e.type)return e;const t=i.get(e.targetPublicIdentifier);return t?(e.configuration.value=t.configuration.peek(),t.configuration=e.configuration,e.behaviors.value=t.behaviors.peek(),t.behaviors=e.behaviors,e.position.value=t.position.peek(),t.position=e.position,i.delete(t.targetPublicIdentifier),t):(s.push(e),null)}).filter(e=>null!==e),...Array.from(i.values())];this.#Rt?.removePermissions(s),this.#Rt?.syncPermissions(n),this.#kt=e,this.#Tt.value=n,t?.keepAlive||this.#Rt?.destroyExtensions(s,t.reason),this.#Rt?.refreshStorefrontTokens(e)}get sandboxCache(){if(!this.#Rt)throw new iu("sandboxCache read before the engine loaded");return this.#Rt.sandboxCache}get storefrontTokens(){if(!this.#Rt)throw new iu("storefrontTokens read before the engine loaded");return this.#Rt.storefrontTokens}updateMetafields(e){this.#It.value=e}}class ou{#Ot;#Et;#Bt;#Ft;#Nt;#Ut;#qt;#Vt;#zt;constructor({observability:e,wallets:t,protocols:s,shop:i,proposal:n}){this.#Et=e,this.#Bt=n.negotiated.fields.buyerIdentity,this.#Ft=t.shopPayIsActive,this.#Vt=t.escalatedWalletSignal,this.#Nt=s.isEmbedded,this.#Ut=s.isEmbeddedPartner,this.#qt=s.mobileCheckoutSdk.enabled&&s.mobileCheckoutSdk.variant.isStandard();const r=i.contactInfoOptions.includes("PHONE");this.customerContactMethodPrefilled=Boolean(n.proposed.email.peek()||r&&n.proposed.phone.peek()),this.#Ot=p(()=>this.#Ht()),this.current=this.#Ot}initialize(){this.#zt?.(),this.#zt=m(()=>{this.#Et.addAttributesForLogs({identity:this.#Ot.value}),this.#Et.addErrorMetadata("identity",{value:this.#Ot.value})})}dispose(){this.#zt?.(),this.#zt=void 0}#Ht(){if(this.#Ft)return"shopPay";const e=this.#Vt.value;if(e)return Nt(e);if(this.#Ut)return"sdkCartHints";const t=this.#Bt.value?.customerProfile?.__typename;return"CustomerProfile"===t?"customerAccount":"BusinessCustomerProfile"===t?"businessCustomer":(this.#Nt||this.#qt)&&this.customerContactMethodPrefilled?"sdkCartHints":Ut}}function du(e){const t=e.negotiated.fields.paymentMethods.value;return t?.find(e=>"wallet"===e.type&&"SHOPIFY_INSTALLMENTS"===e.name)}const lu={CURRENCY:"currency",GIFT_CARDS:"gift_cards",SUBSCRIPTIONS:"subscriptions",ORDER_EDIT:"order_edit",TEST_MODE:"test_mode",INELIGIBLE_LINE_ITEM:"ineligible_line_item"};function uu(e){const t=e.session.selectedPaymentMethod.value;if(t)return $t(t)?t.paymentAttributes.billingAddress.address.countryCode:e.session.selectedBillingAddress.value?.address.countryCode}class cu{#jt=g(!1);constructor({proposal:e,shop:t,shopPay:s,identity:i}){this.isSupported=function({identity:e,proposal:t,shopPay:s}){return p(()=>{if("shopPay"!==e.current.value)return!1;const i=du(t);if(!i)return!1;if(!function(e){const t=e.negotiated.fields.paymentDue.value;return Boolean(t&&0!==t.amount)}(t))return!1;const n=function({creditCards:e,phoneCountryCode:t,vaultedAddresses:s,supportedCountries:i}){return[t,...s.map(e=>e.address.countryCode),...e.map(e=>e.billingAddress.address.countryCode)].filter(e=>Boolean(e)).some(e=>i.includes(e))}({creditCards:s.user.creditCards.value,phoneCountryCode:s.user.phoneCountryCode.value,vaultedAddresses:s.user.addresses.value,supportedCountries:i.supportedCountries??[]}),r=s.user.isNew.value,a=0===s.user.addresses.value.length,o=!s.user.hasCreditCards.value;return r||a||o||n})}({identity:i,proposal:e,shopPay:s}),this.supportedCountryOptions=p(()=>{if("shopPay"!==i.current.value)return[];const s=du(e);return s?function(e,t){const s=zt(t.popularBillingCountries,t.billingCountries)??[];return e.supportedCountries.flatMap(e=>s.find(({value:t})=>t===e)||[])}(s,t):[]}),this.ineligibilityReasons=function({isSupported:e,hasInvalidShippingAddress:t,proposal:s,shopPay:i}){return p(()=>{if(!e.value)return[];const n=du(s);if(!n)return[];const r=s.negotiated.fields.paymentDue.value;if(!r||0===r.amount)return[];const a=s.negotiated.fields,o=De(s),d=Ht(a.customAttributes.value),l=jt(a.deliveryNext.value,"ONE_TIME_PURCHASE",!0),u=Wt(l),c=!!u&&["PICK_UP","PICKUP_POINT","RETAIL"].includes(u.methodType),h=o&&c,p=o&&!d&&!c,g=u?.pickupLocation?.address,m=s.proposed.shippingAddress.value,y=i.session.selectedShippingAddress.value,v=t.value,f=[],b=h&&(!g||ha(g,n)),S=me(m)&&v,A=Boolean(m.countryCode)&&ha(m,n),_=p&&m&&!y&&(S||A),P=p&&y&&(v||ha(y.address,n));(b||_||P)&&f.push("shipping_address");const C=Number(r.amount);(Cn.maxPrice.amount||n.cbtEnabled&&0===n.availableLoanTypes.length)&&f.push("amount"),!n.cbtEnabled||n.minPrice.currencyCode===r.currencyCode&&n.maxPrice.currencyCode===r.currencyCode||n.ineligibilityReasons.includes("CURRENCY")||f.push("currency");for(const e of n.ineligibilityReasons)f.push(lu[e]);let k;p&&(k=y?y.address.countryCode:m?.countryCode),function({shopPay:e,shippingCountry:t}){const s=e.user.installments.credential.value?.countryCode;if(!s)return!1;const i=uu(e),n=Boolean(t&&s!==t),r=Boolean(i&&s!==i);return n||r}({shopPay:i,shippingCountry:k})&&f.push("credential_country_mismatch");const E=uu(i),w=c?g?.countryCode:k;return n.cbtEnabled&&E&&!n.supportedCountries.includes(E)&&f.push("billing_address"),!n.cbtEnabled||!o||d||!E||w&&E===w||f.push("billing_shipping_country_mismatch"),f})}({isSupported:this.isSupported,hasInvalidShippingAddress:this.#jt,proposal:e,shopPay:s}),this.isCheckoutEligible=p(()=>this.isSupported.value&&0===this.ineligibilityReasons.value.length),this.isBuyerBlocked=p(()=>s.user.installments.isRejected.value||!1===s.installments.failedAttempt.value?.retryable),this.isUnavailable=p(()=>!this.isCheckoutEligible.value||this.isBuyerBlocked.value);const n=function({isSupported:e,proposal:t,financingPlans:s,isInstallmentsSelected:i}){const n=p(()=>{if(!(e.value&&t&&s&&i))return;const n=du(t),r=t.negotiated.fields.paymentDue.value;return n&&r?function({config:e,paymentDue:t,financingPlans:s,isInstallmentsSelected:i,buyerCountryCode:n}){const r=e.cbtEnabled?e.financingPlans.filter(e=>e.minPrice.currencyCode===t.currencyCode&&e.maxPrice.currencyCode===t.currencyCode):s,a=r.reduce((e,s)=>{const{minPrice:i,terms:n}=s;return n.some(({loanType:e})=>"SPLIT_PAY"===e)||"GBP"===t.currencyCode?Math.min(e,parseFloat(i.amount)):e},Number.MAX_SAFE_INTEGER),o=r.reduce((e,s)=>{const{minPrice:i,maxPrice:n,terms:r}=s,o=parseFloat(i.amount),d=parseFloat(n.amount),l=Math.max(t.amount,a);return l>=o&&l<=d?e.concat("GBP"===t.currencyCode?r:r.filter(({loanType:e})=>"SPLIT_PAY"===e)):e},[]),d="GBP"===t.currencyCode?3:4,[l,...u]=o,c=l?u.reduce((e,t)=>t.installmentsCount>e.installmentsCount?t:e,l):void 0,h=c?.installmentsCount??d,p=i&&qt(e.availableLoanTypes),g=i&&function(e,t){return e.cbtEnabled?!t||!e.supportedCountries.includes(t)||!e.creditCardEnabledCountries.includes(t):e.supportedCountries.every(t=>!e.creditCardEnabledCountries.includes(t))}(e,n),m=p||g,y=c?Vt(c,{buyerCountryCode:n,currencyCode:t.currencyCode}):h;return{config:e,chargeAmount:(()=>{if("GBP"===t.currencyCode){if(n&&"GB"!==n)return Number(t.amount/y);const s=o.some(({loanType:e,apr:t})=>"INTEREST"===e&&0===t),i=3===e.availableLoanTypes.length;return Number(s&&!i?t.amount/h:t.amount/3)}return Number(t.amount/y)})(),numberOfPaymentTerms:y,paymentMethodMustSupportInterestBearingLoans:p,paymentMethodMustSupportDebitCardOnly:m,sellerCountryRequiresDebitCardOnly:g}}({config:n,paymentDue:r,financingPlans:s.value,isInstallmentsSelected:i.value,buyerCountryCode:t.negotiated.fields.buyerIdentity.value?.countryCode}):void 0});return{config:p(()=>n.value?.config),chargeAmount:p(()=>n.value?.chargeAmount),numberOfPaymentTerms:p(()=>n.value?.numberOfPaymentTerms),paymentMethodMustSupportInterestBearingLoans:p(()=>n.value?.paymentMethodMustSupportInterestBearingLoans??!1),paymentMethodMustSupportDebitCardOnly:p(()=>n.value?.paymentMethodMustSupportDebitCardOnly??!1),sellerCountryRequiresDebitCardOnly:p(()=>n.value?.sellerCountryRequiresDebitCardOnly??!1)}}({isSupported:this.isSupported,proposal:e,financingPlans:s.installmentsFinancingPlans,isInstallmentsSelected:s.session.isInstallmentsSelected});this.config=n.config,this.chargeAmount=n.chargeAmount,this.numberOfPaymentTerms=n.numberOfPaymentTerms,this.paymentMethodMustSupportInterestBearingLoans=n.paymentMethodMustSupportInterestBearingLoans,this.paymentMethodMustSupportDebitCardOnly=n.paymentMethodMustSupportDebitCardOnly,this.sellerCountryRequiresDebitCardOnly=n.sellerCountryRequiresDebitCardOnly}unstable_setHasInvalidShippingAddress(e){this.#jt.value=e}}class hu{#Wt={};#$t=null;#Gt=!1;detectInfiniteRedirect(e,t,s){const i=e.pathname;if(this.#$t&&clearTimeout(this.#$t),this.#Wt[i]=(this.#Wt[i]||0)+1,this.#Wt[i]>=10&&!this.#Gt){const n=new Gt(`Detected potential infinite redirect: ${this.#Wt[i]} navigations to ${i} within 200ms`),r=t.value;s.error(n,{severity:"error",metadata:{redirectDetails:{navigationCounts:JSON.stringify(this.#Wt),currentUrl:e.toString(),path:i,threshold:10,timeframe:200},journeyState:{redirectTo:r.redirectTo?.route}}}),this.#Gt=!0,this.#Wt={}}this.#$t=setTimeout(()=>{this.#Wt={},this.#$t=null},200)}cleanup(){this.#$t&&(clearTimeout(this.#$t),this.#$t=null)}}function pu(){return new Jt("checkout.journey was read before started it",{groupingHash:"JourneyError::ReadBeforeStart"})}function gu(e){if(e)return e;throw pu()}const mu=A(({checkout:e,observability:t,source:s})=>{const i=g(void 0),n=g(void 0),r=g(!1),a=g(0),o=g(0);let d,l,u,c,h,m,v;function f(){if(o.value>0&&d)return d.plan;throw pu()}function b(){if(o.value>0&&u)return u;throw pu()}function S(i){const{latestReceipt:n,negotiator:r}=e;return function({purchasingCompanyHasNegotiatedLocalPickupSelected:e,deliveryFact:t,observability:s,negotiatedState:i,plan:n,postPurchaseInquiryStatus:r,proposedPaymentLines:a,receipt:o,sessionType:d,shippingRequired:l,throttle:u,url:c}){const h=n.greenPath.findIndex(e=>{if(e.skipOverPage?.(i))return!1;const t=Yt(e.features,i);return!e.fastForwardThroughPage||!e.fastForwardThroughPage(i,t)}),p=n.greenPath[h];if(!p)throw new Jt("Cannot initialize a journey without a reachable green-path page",{groupingHash:"JourneyError::InitializeJourneyNoReachablePage"});const g=[];s.leaveErrorBreadcrumb("Journey:initializeJourney: initial firstPage",{firstPageIndex:h,firstPage:p.id,plan:JSON.stringify(n.greenPath)}),n.greenPath.slice(0,h).forEach(e=>{if("information"===e.id){const t=Kt(i.contactInfo,i.allViolations??[]);s.leaveErrorBreadcrumb("Journey:initializeJourney: revalidating information page",{pageComplete:t,contactInfo:JSON.stringify(i.contactInfo),violations:i.allViolations??[]}),g.push({id:e.id,skipped:!1,complete:t})}else g.push({id:e.id,skipped:!1,complete:!0})}),g.push({id:p.id,skipped:!1,complete:!1});const m=n.greenPath.findIndex(e=>!(e.route!==c.normalizedPath||e.skipOverPage&&e.skipOverPage(i))),y=a.some(e=>"direct"===e.method.type&&e.method.sessionId),v=0===i.runningTotal?.amount||y,f="review"===n.greenPath[m]?.id&&!v,b=f?m-1:m,S=n.greenPath[b],A=Boolean(S?.skipOverPage?.(i));if(i.pendingDelivery&&S&&!A&&b>h&&p.fastForwardThroughPage?.(i,Yt(p.features,i),{trustBuyerDestination:!0})){for(const[e,t]of n.greenPath.entries()){if(e=b)break;const s=g[e];g[e]=s?{...s,complete:!0}:{id:t.id,skipped:!0,complete:!0}}g[b]={id:S.id,skipped:!1,complete:!1},s.log("journey_history_advanced","History advanced past a page blocked only by an unpriced address",{sessionType:d,firstPageIndex:h,currentPageFromUrlIndex:m,advanceTo:b,clamped:f})}const _=g.find(e=>!e.complete&&!e.skipped),P=n.greenPath.findIndex(e=>_?.id===e.id),C=n.greenPath[P],k=n.greenPath[m],E=function({plan:e,isSimulated:t,currentPageFromUrlIndex:s,currentPageFromHistoryIndex:i,canLoadReview:n}){const r=e.greenPath[s];if(t&&r)return r;if(s>=0&&s<=i)return r;const a=e.greenPath[i];if("review"===a?.id&&!n){const t=e.greenPath.findIndex(e=>"review"===e.id);return e.greenPath[t-1]||e.greenPath[0]}return a}({plan:n,isSimulated:"simulated"===d,currentPageFromUrlIndex:m,currentPageFromHistoryIndex:P,canLoadReview:v}),w=n.detours.find(e=>"route"in e&&e.route===c.normalizedPath),T=Xt(i.allViolations??[]),[M]=t,I=M?.deliveryAddress??i.shippingAddress,D="BusinessCustomerProfile"===i.buyerIdentity?.customerProfile?.__typename,R=Boolean(D&&!e&&Qt(I)&&Zt(d)&&l),x=new URLSearchParams(c.search),L="processing"===w?.type&&"true"===x.get("post_purchase"),O=("postPurchase"===w?.type||L)&&"success"===r&&"processed"===o?.status&&"created"===o.orderCreationStatus.status,B=("shopPayLogin"===w?.type?n.detours.find(e=>"shopPayLogin"===e.type):void 0)??("offsitePaymentFailed"===w?.type?n.detours.find(e=>"offsitePaymentFailed"===e.type):void 0)??(O?n.detours.find(e=>"postPurchase"===e.type):void 0)??("queued"===u.status?n.detours.find(e=>"throttle"===e.type):void 0)??(T?n.detours.find(e=>"stockProblems"===e.type):void 0)??("action_required"===o?.status||"processing"===o?.status||"processing_remote_checkouts"===o?.status?n.detours.find(e=>"processing"===e.type):void 0)??("processed"===o?.status&&o.redirectUrl?n.detours.find(e=>"processing"===e.type):void 0)??("processed"===o?.status?n.detours.find(e=>"thankYou"===e.type):void 0)??("thankYou"===w?.type&&"simulated"===d?n.detours.find(e=>"thankYou"===e.type):void 0);if(s.leaveErrorBreadcrumb("Journey:initializeJourney: resulting currentPage and expectedDetourFromState",{history:JSON.stringify(g.map(e=>e&&{id:e.id,complete:e.complete,skipped:e.skipped})),normalizedUrlPath:c.normalizedPath,currentPageFromHistory:String(C?.id),currentPage:String(E?.id),expectedDetourFromState:B?.route,receipt:JSON.stringify(o)}),null==B&&null==E)throw new Jt("Failed to initialize Journey: no detour or current page available",{groupingHash:"JourneyError::InitializeJourneyFailure"});return B?{plan:n,history:g,redirectTo:(F=w,N=B,F?.type===N?.type&&F?.route===N?.route?void 0:B),blockedByMissingLocationAddress:R}:{plan:n,history:g,redirectTo:es(k,E)?void 0:E,blockedByMissingLocationAddress:R};var F,N}({purchasingCompanyHasNegotiatedLocalPickupSelected:i.purchasingCompanyHasNegotiatedLocalPickupSelected.peek(),deliveryFact:i.deliveryFact,observability:t,negotiatedState:r.current.peek(),plan:i.plan,postPurchaseInquiryStatus:i.postPurchaseInquiryStatus,proposedPaymentLines:r.parts.paymentLines.peek(),receipt:n.peek(),sessionType:s.type,shippingRequired:i.shippingRequired,throttle:r.throttleState.peek(),url:i.url})}function A(s){const n=gu(i.peek()),r=function(e,t,s,i,n){s.leaveErrorBreadcrumb("Journey:updateJourney: initiated with action",{actionType:t.type});const{plan:r}=e,a=e.redirectTo?{...e,redirectTo:void 0}:e,o=i.currentUrl.value.normalizedPath,d=r.greenPath.find(e=>e.route===o),l=r.detours.find(e=>e.route===o);switch(t.type){case"reinitialize":return t.state;case"clearRedirect":return a;case"pageEntered":{if(d?.id!==t.pageId||t.fromPageId===t.pageId||e.activeStep?.pageId!==t.fromPageId)return e;const{activeStep:s,...i}=e;return i}case"reopenStep":case"progressStep":{const s=ts(d,e.activeStep);if(!d?.steps||!s)return e;const i=d.steps.indexOf(s),n="reopenStep"===t.type?t.stepId:t.toStepId,r=d.steps.findIndex(({id:e})=>e===n);if(r<0)return e;if("reopenStep"===t.type){if(r>=i)return e}else if(t.pageId!==d.id||t.fromStepId!==s.id||r<=i)return e;return{...e,activeStep:{pageId:d.id,stepId:n}}}case"skipRemainingPages":{const{plan:t,history:i}=e;if(!d){if("thankYou"===l?.type)return e;const t="undefined"!=typeof window&&window.location?window.location.href:"SSR: no location available";throw s.leaveErrorBreadcrumb("Skipping to completion, but no current page",{currentDetour:l,currentUrl:t}),new Jt("Missing current page",{groupingHash:"JourneyError::SkipToCompletionNoCurrentPage"})}const n=t.greenPath.findIndex(e=>es(e,d)),r=i.slice(0,n+1),o=r.pop();r.push({...o,complete:!0});for(const[e,s]of t.greenPath.entries()){if(e<=n)continue;const t=r[e];r[e]=t?{...t,skipped:!0}:{id:s.id,skipped:!0,complete:!1}}return s.leaveErrorBreadcrumb("Journey:updateJourney: on progress, skip to completion",{history:r.map(e=>({id:e?.id,complete:e?.complete,skipped:e?.skipped})),currentDetourRoute:l?.route}),{...a,history:r}}case"progress":{const{plan:i,history:n}=e,{page:r}=t;if(null==r)throw s.leaveErrorBreadcrumb("Journey:updateJourney: progress failed, no next page",{currentPage:d?.id,currentDetour:l?.type,actionType:t.type}),new Jt(`Fail to update journey with "${t.type}": attempted to progress without a next page.`,{groupingHash:"JourneyError::UpdateJourneyProgressNoNextPage"});const o=i.greenPath.findIndex(e=>es(e,r)),u=n.slice(0,o);for(const[e,t]of i.greenPath.entries()){if(e>=o)break;const s=u[e];null==s?u[e]={id:t.id,skipped:!0,complete:!0}:s.complete||(u[e]={...s,complete:!0})}return u.push({id:r.id,skipped:!1,complete:!1}),s.leaveErrorBreadcrumb("Journey:updateJourney: on progress",{history:u.map(e=>({id:e?.id,complete:e?.complete,skipped:e?.skipped})),currentPageRoute:r.route}),{...a,history:u}}case"complete":{const{history:t}=e,i=[...t],n=i.pop();return i.push({...n,complete:!0}),s.leaveErrorBreadcrumb("Journey:updateJourney: on complete, set currentPage to undefined",{history:JSON.stringify(i.map(e=>e&&{id:e.id,complete:e.complete,skipped:e.skipped}))}),{...a,history:i}}case"error":{const{plan:i,history:r}=e,{page:o=d}=t;if(null==o)return s.leaveErrorBreadcrumb("Journey:updateJourney: currentPage from state",{history:JSON.stringify(r.map(e=>e?.id)),currentPage:String(d?.id)}),s.error(new Jt(`Fail to update journey with "${t.type}": no next page.`,{groupingHash:"JourneyError::UpdateJourneyErrorCaseNoNextPage"})),{...a,redirectTo:i.greenPath[0]};const u=n?function(e,t,s,i){const[n]=t.greenPath;if(!n)throw new Jt("Cannot validate journey prerequisites without a green-path page",{groupingHash:"JourneyError::ValidatePrerequisitesNoGreenPath"});const r=t.greenPath.findIndex(t=>es(t,e));if(-1===r)return i.leaveErrorBreadcrumb("validatePrerequisitesForPage: target page not found in plan",{targetPageId:e.id,targetPageRoute:e.route}),n;if(!s)return i.leaveErrorBreadcrumb("validatePrerequisitesForPage: no negotiated context available",{targetPageId:e.id}),n;for(const[a,o]of t.greenPath.entries()){if(a>=r)break;let t=!1;if(t="information"!==o.id||Kt(s.contactInfo,s.allViolations??[]),!t)return i.leaveErrorBreadcrumb("validatePrerequisitesForPage: prerequisite page not satisfied, redirecting",{targetPageId:e.id,targetPageRoute:e.route,unsatisfiedPrerequisitePageId:o.id,unsatisfiedPrerequisitePageRoute:o.route}),o}return e}(o,i,n.current.peek(),s):o,c=!es(o,u);n&&c&&s.leaveErrorBreadcrumb("Journey:updateJourney: prerequisite validation redirected",{requestedPage:o.id,redirectedToPage:u.id});const h=i.greenPath.findIndex(e=>es(e,u));return s.leaveErrorBreadcrumb("Journey:updateJourney: on error",{history:r.map(e=>({id:e?.id,complete:e?.complete,skipped:e?.skipped})),originalTargetPageRoute:o.route,finalTargetPageRoute:u.route,currentDetourRoute:l?.route}),{...a,history:[...r.slice(0,h),{id:u.id,skipped:!1,complete:!1}]}}default:y(t)}}(n,s,t,b(),e.negotiator);i.value=r,t.leaveErrorBreadcrumb("Journey state transition",{previousState:{redirectTo:n.redirectTo?.route},action:s,nextState:{redirectTo:r.redirectTo?.route},routerCurrentUrl:l?.normalizedPath})}const _=p(()=>gu(i.value)),P=p(()=>_.value.plan),C=p(()=>{const{normalizedPath:e}=b().currentUrl.value;return P.value.detours.find(t=>t.route===e)}),k=p(()=>{const{normalizedPath:e}=b().currentUrl.value,t=f().greenPath.find(t=>t.route===e);return t&&{page:t,search:d?.preservedSearch}}),E=p(()=>{const e=f(),t=k.value;t&&(v=t);const s=v,{normalizedPath:i}=b().currentUrl.value,{history:n}=_.value,r=e.detours.find(e=>e.route===i);if(t)return t;if(r&&s)return s;if(r&&!s){const t=e.greenPath[0],s=n.find(e=>!e.complete),i=e.greenPath.find(e=>e.id===s?.id)??t;return i&&{page:i,search:d?.preservedSearch}}}),w=p(()=>E.value?.page),T=p(()=>{const{normalizedPath:e}=b().currentUrl.value,t=w.value;return P.value.greenPath.find(t=>t.route===e)??t}),M={state:_,plan:P,currentPage:T,currentDetour:C,pageBeforeDetour:w,searchBeforeDetour:p(()=>E.value?.search),completed:p(()=>function(e){return"thankYou"===e?.type}(C.value)),currentFocus:n,progressing:r,completing:p(()=>a.value>0),start(e){const t=S(e);d=e,l=e.url,u=e.router,m=e.url,c=e.isOnePageLayout,o.value+=1,h=e.preservedSearch,v=void 0,i.value=t,n.value=void 0,r.value=!1,a.value=0},update(e){d=e,m=e.url,e.isOnePageLayout!==c&&(c=e.isOnePageLayout,h=e.preservedSearch,A({type:"reinitialize",state:S(e)}))},dispatch:A,watchNavigation(){const e=b(),s=new hu;let i=_.value.plan.greenPath.find(t=>t.route===e.currentUrl.value.normalizedPath)?.id;const n=e.currentUrl.subscribe(e=>{const{plan:n,activeStep:r}=_.value,a=n.greenPath.find(t=>t.route===e.normalizedPath),o=i;a&&(i=a.id),r&&a&&null!=o&&o!==a.id&&A({type:"pageEntered",fromPageId:o,pageId:a.id}),m!==e&&(m=e,A({type:"clearRedirect"}),s.detectInfiniteRedirect(e,_,t))}),r=e.block(s=>{const i=e.currentUrl.value,n=function(e,t){const s=new URLSearchParams(e.searchParams),i=new URLSearchParams(t.searchParams);return s.sort(),i.sort(),e.pathname===t.pathname&&s.toString()===i.toString()&&JSON.stringify(e.state)===JSON.stringify(t.state)}(i,s);return n&&t.leaveErrorBreadcrumb("[useJourneyTracking] Blocked navigating to same route",{current:{path:i.pathname,search:i.search},requested:{path:s.pathname,search:s.search}}),n});return()=>{s.cleanup(),n(),r()}},async detour(e,s){const{plan:n}=gu(i.peek()),r=n.detours.find(t=>t?.type===e);if(!r)throw t.leaveErrorBreadcrumb("Detour, but no matching detour",{detourType:e,detours:n.detours,currentUrl:b().currentUrl.peek().href}),new Jt("Detour, but no matching detour",{groupingHash:"JourneyError::DetourNoMatchingDetour"});const a=`${r.route}${h??""}`;b().navigate(a,s?.routerOptions)},setCurrentFocus(e){n.value=e},setProgressing(e){r.value=e},startCompletion(){const e=o.peek();return a.value+=1,()=>{e===o.peek()&&(a.value-=1)}}};return M});class yu{#Yt;#Jt;#Kt=!1;get baseName(){return this.#Yt}get updated(){return this.#Kt}constructor({serializations:e,trees:t=e.get("layout"),isCheckoutLayoutForcedToOnePage:s=g(Boolean(e.get("forcedRedesignWallet")))}){this.#Yt=e.get("forcedRedesignWallet")?"three-page":e.get("checkoutLayout"),this.isOnePage=p(()=>s.value||"one-page"===this.#Yt),this.#Jt=g(t),this.trees=this.#Jt}update(e){void 0!==e&&(this.#Kt=!0),this.#Jt.value=e}}function vu(e){return e.some(e=>"ConfirmChangeViolation"===e.__typename&&"TAX_TAX_INCLUSIVITY_MISMATCH"===e.code)}function fu(e){const t=e.shippingAddress.peek(),i=e.locationAddress.peek();return s(t,i)}function bu(e,t,s){const i="NegotiationResultAvailable"===e?.__typename&&e?.sellerProposal||"SubmitRejected"===e?.__typename&&e?.sellerProposal||void 0,n=[];null!=i&&"PendingTerms"!==i.buyerIdentity.__typename||n.push("contactInfo","shippingAddress","buyerIdentity"),null!=i&&"PendingTerms"!==i.delivery.__typename&&"PendingTerms"!==i.deliveryDiscount?.__typename&&"PENDING"!==i.remote?.consolidated.delivery.termsStatus||n.push("billingAddress","deliveryNext"),null!=i&&"PendingTerms"!==i?.deliveryExpectations?.__typename||n.push("deliveryExpectations"),null!=i&&"PendingTerms"!==i.payment.__typename&&"PENDING"!==i.remote?.consolidated.payment.termsStatus||n.push("paymentLines","paymentMethods");const r=vu(t??[]);return(null==i||"PendingTerms"===i.merchandise.__typename||r||"PendingTerms"===i?.merchandiseDiscount?.__typename)&&n.push("merchandiseLines"),null!=i&&"PendingTerms"!==i.tax.__typename||n.push("taxes","duties"),"PendingTerms"===i?.taxExemptions?.__typename&&n.push("taxExemptions"),null!=i&&"PENDING"!==i.remote?.consolidated.taxes.termsStatus||n.push("remoteTaxDetails"),null!=i&&"PendingTerms"!==i?.deliveryDiscount?.__typename&&"PendingTerms"!==i?.merchandiseDiscount?.__typename||n.push("discountLines","totalSavings"),"PendingTerms"===i?.captcha?.__typename&&n.push("captcha"),"PendingTerms"===i?.availableRedeemables?.__typename&&n.push("availableRedeemables"),"PendingTerms"===i?.shopCashBalance?.__typename&&n.push("shopCashBalance"),"PendingTerms"===i?.shopPromotion?.__typename&&n.push("shopPromotion"),"PendingTerms"===i?.shopDiscountOffer?.__typename&&n.push("shopDiscountOffer"),null==i&&n.push("subtotal","runningTotal","total"),"FilledDiscountTerms"===i?.merchandiseDiscount?.__typename&&0===i?.merchandiseDiscount?.lines?.length&&s&&n.push("reduction"),"PendingTerms"===i?.cartCheckoutValidation?.__typename&&n.push("cartCheckoutValidation"),"PendingTerms"===i?.memberships?.__typename&&n.push("memberships"),n}let Su;async function Au(){return Su||(Su=S(()=>t(()=>import("./2b0dcdd4.C-0LQ8Y0.js"),__vite__mapDeps([23,2,3,4,5,6,24,25,26,13,16,18,27,20,15,28,29,14,17,12,19,21,22]))),Su)}function _u(){"function"==typeof window.requestIdleCallback?window.requestIdleCallback(Au):window.setTimeout(Au,0)}function Pu(e,t){if(!("violations"in e))return;const s=e.violations.filter(e=>!t.has(e.code));return s.length!==e.violations.length?{...e,violations:s}:void 0}const Cu="8b9035807842a4e4dbe009f3f1478127",ku=(e,t)=>{const s=e.some(e=>e.id===Cu),i=t.find(e=>e.id===Cu),n=new Set(e);return!s&&i&&n.add(i),Array.from(n)};class Eu extends Error{constructor(){super(...arguments),this.name="MissingProposalMerchandiseError"}}class wu extends Error{constructor(){super(...arguments),this.name="UndefinedTotalAmount"}}function Tu({delivery:e,deliveryMethods:t,negotiatedMerchandise:s,buyerDelivery:i,violations:n,isPointOfSale:r,isPointOfSaleShipToHome:a,observability:o,isAbandonedCartSession:d,remoteDelivery:l}){if(!e)return;if("PendingTerms"===e.__typename){if(!i||"FilledDeliveryTerms"!==i.__typename)return;const{intermediateRates:e,shippingRatesStatusToken:t,progressiveRatesEstimatedTimeUntilCompletion:n,deliveryLines:o}=i;if(!(l?.remoteBuyerDeliveryLines.length?[...o,...l.remoteBuyerDeliveryLines]:o).some(e=>"DeliveryLine"===e.__typename&&("DeliveryStrategyReference"===e.selectedDeliveryStrategy?.__typename||"CustomDeliveryStrategy"===e.selectedDeliveryStrategy?.__typename)))return;return{status:"filled",lines:o.map(e=>function({buyerDeliveryLine:e,negotiatedMerchandise:t,isPointOfSale:s,isPointOfSaleShipToHome:i}){const{groupType:n,targetMerchandise:r,selectedDeliveryStrategy:a}=e;return{status:"available",type:n,targetMerchandiseLines:Bu({targetMerchandise:r,negotiatedMerchandise:t,isPointOfSale:s,isPointOfSaleShipToHome:i}),methods:[],selectedDeliveryMethodHandle:a&&"DeliveryStrategyReference"===a.__typename?a.handle:void 0}}({buyerDeliveryLine:e,negotiatedMerchandise:s,isPointOfSale:r,isPointOfSaleShipToHome:a})),intermediateRates:e,shippingRatesStatusToken:t,progressiveRatesEstimatedTimeUntilCompletion:n,sourceIsBuyerProposal:!0}}const u=(n||[]).reduce((e,t)=>("DELIVERY_DELIVERY_LINE_DETAIL_CHANGED"===t.code&&d||("ConfirmChangeViolation"===t.__typename&&ss.has(t.code)&&(e.hasDeliveryLineChange=!0),"UnresolvableTermViolation"===t.__typename&&is.has(t.code)&&(e.hasNoDeliveryMethods=!0)),e),{hasDeliveryLineChange:!1,hasNoDeliveryMethods:!1});if("UnavailableTerms"===e.__typename){if("FilledDeliveryMethods"===t?.__typename){const e=[...t.shipping.deliveryLines,...t.pickUp.deliveryLines,...t.local.deliveryLines,...t.pickupPoint.deliveryLines,...t.retail.deliveryLines,...t.none.deliveryLines];if(e.length>0)return{status:"partial",lines:ya(e.map((e,t)=>Iu({negotiatedDeliveryLine:e,negotiatedDeliveryLineIndex:t,negotiatedMerchandise:s,isPointOfSale:r,isPointOfSaleShipToHome:a,observability:o,isAbandonedCartSession:d}))),supportsSplitDeliveryMethod:t.supportsSplitDeliveryMethod}}return{status:"unavailable",...u}}if("FilledDeliveryTerms"!==e.__typename)return;const{intermediateRates:c,shippingRatesStatusToken:h,progressiveRatesEstimatedTimeUntilCompletion:p,deliveryLines:g,deliveryMacros:m,deliveryMacrosOmitted:y,splitShippingToggle:v,supportsSplitDeliveryMethod:f}=e,b=l?.remoteSellerDeliveryLines.length?[...g,...l.remoteSellerDeliveryLines]:g,S=ya(b.map((e,t)=>Iu({negotiatedDeliveryLine:e,negotiatedDeliveryLineIndex:t,negotiatedMerchandise:s,violations:n,isPointOfSale:r,isPointOfSaleShipToHome:a,observability:o,isAbandonedCartSession:d}))),A=l?.deliveryMacros??m,_=l?.deliveryMacrosOmitted??y,P=A.map(({id:e,amount:t,amountAfterDiscounts:s,totalAmount:i,totalAmountAfterDiscounts:n,title:r,totalTitle:a,deliveryPromisePresentmentTitle:d,deliveryStrategyHandles:l,isSharedRate:u})=>(null!=i&&null!=n||o?.error(new wu(`Undefined total field for deliveryMacros: totalAmount=${JSON.stringify(i)}, totalAmountAfterDiscounts=${JSON.stringify(n)}`),{severity:"error"}),{id:e,cost:ns(t),costAfterDiscounts:ns(s),totalCost:ns(i??t),totalCostAfterDiscounts:ns(n??s),title:r,totalTitle:a||r,deliveryPromisePresentmentTitle:d,deliveryMethodHandles:Mu(l,S),..."boolean"==typeof u&&{isSharedRate:u}}));return{status:"filled",lines:S,intermediateRates:c,shippingRatesStatusToken:h,progressiveRatesEstimatedTimeUntilCompletion:p,deliveryMacros:P,deliveryMacrosOmitted:_,splitShippingToggle:v,supportsSplitDeliveryMethod:f||"FilledDeliveryMethods"===t?.__typename&&t.supportsSplitDeliveryMethod}}function Mu(e,t){const s=t.reduce((e,t)=>(as(t)&&t.methods.forEach(s=>e[s.handle]=t),e),{});return e.reduce((e,t)=>{const i=s[t];return i?(e[`${i.type}${i?.id?`-${Re(i?.id)}`:""}`]=t,e):e},{})}function Iu({negotiatedDeliveryLine:e,negotiatedDeliveryLineIndex:t,negotiatedMerchandise:s,violations:i,isPointOfSale:n,isPointOfSaleShipToHome:r,observability:a,isAbandonedCartSession:o}){const{id:d,availableOn:l,groupType:u,targetMerchandise:c,availableDeliveryStrategies:h,selectedDeliveryStrategy:p}=e;if("FilledMerchandiseLineTargetCollection"!==c.__typename||!c.linesV2.some(e=>{if("MerchandiseLine"!==e.__typename&&"MerchandiseBundleLineComponent"!==e.__typename)return!1;const{merchandise:t,stableId:i}=e;return("ProductVariantMerchandise"===t.__typename||"SourceProvidedMerchandise"===t.__typename||"ContextualizedProductVariantMerchandise"===t.__typename)&&Du({targetStableId:i,merchandise:t,negotiatedMerchandise:s,isPointOfSale:n,isPointOfSaleShipToHome:r,targetIsLineComponent:"MerchandiseBundleLineComponent"===e.__typename})}))return{id:d,availableOn:l,type:u,status:"not_required",targetMerchandiseLines:Ou({targetMerchandise:c,negotiatedMerchandise:s,observability:a,isPointOfSale:n})};const g=h.filter(e=>"CompleteDeliveryStrategy"===e.__typename).map(({handle:e,title:t,description:i,amount:n,code:r,amountAfterDiscounts:o,estimatedTimeInTransit:d,minDeliveryDateTime:l,maxDeliveryDateTime:u,deliveryPredictionEligible:c,deliveryPromiseProviderApiClientId:h,deliveryPromisePresentmentTitle:p,acceptsInstructions:g,phoneRequired:m,methodType:y,pickupLocation:v,carrierName:f,deliveryStrategyBreakdown:b,custom:S,brandedPromise:A,originLocation:_,displayCheckoutRedesign:P,metafields:C,amountCombinabilityToken:k,deliveryPresentationGroupToken:E,availability:w})=>{let T;("PickupInStoreLocation"===v?.__typename||"PickupPointLocation"===v?.__typename)&&(T={type:v?.__typename,...v,address:ge(v.address)});const M=C.map(e=>({key:e.key,namespace:e.namespace,value:e.value,valueType:"string"}));return{handle:e,title:t,description:i,code:r,cost:ns(n),costAfterDiscounts:ns(o),estimatedTimeInTransit:rs(d),minDeliveryDateTime:l,maxDeliveryDateTime:u,deliveryPredictionEligible:c,deliveryPromiseProviderApiClientId:h,deliveryPromisePresentmentTitle:p,acceptsInstructions:g,phoneRequired:m,methodType:y,pickupLocation:T,carrierName:f,priceBreakdown:Nu(b,s,a),isCustomRate:S??!1,brandedPromise:A,originLocation:_,displayCheckoutRedesign:P,metafields:M,amountCombinabilityToken:k,deliveryPresentationGroupToken:E,availability:w}}),m=p&&"CompleteDeliveryStrategy"===p.__typename?p.handle:void 0,y=i?.some(e=>"ConfirmChangeViolation"===e.__typename&&"DELIVERY_DELIVERY_LINE_DETAIL_CHANGED"===e.code&&e.to.includes(`delivery.deliveryLines[${t}]`))&&!o;return{id:d,availableOn:l,status:"available",type:u,targetMerchandiseLines:Ou({targetMerchandise:c,negotiatedMerchandise:s,observability:a,isPointOfSale:n,isPointOfSaleShipToHome:r}),methods:g,hasDeliveryLineChange:y,hasNoDeliveryMethods:0===g.length,selectedDeliveryMethodHandle:m}}function Du({targetStableId:e,merchandise:t,negotiatedMerchandise:s,isPointOfSale:i,isPointOfSaleShipToHome:n,targetIsLineComponent:r}){if(i&&!n)return!1;if(void 0!==t.requiresShipping)return t.requiresShipping;if(!s||"FilledMerchandiseTerms"!==s.__typename)return!0;const a=r?s.merchandiseLines.flatMap(({lineComponents:e})=>e).filter(e=>"MerchandiseBundleLineComponent"===e.__typename):s.merchandiseLines;for(const o of a)if("requiresShipping"in o.merchandise&&o.stableId===e)return o.merchandise.requiresShipping;return!0}function Ru(e,t){return{quantity:"ProposalMerchandiseQuantityByItem"===e?.__typename&&"IntValueConstraint"===e.items?.__typename?e.items.value:0,image:t?{...t,altText:t.altText||void 0}:void 0}}function xu(e){if("MoneyValueConstraint"===e.totalAmount.__typename)return ns(e.totalAmount)}function Lu(e){const t=("FilledMerchandiseTerms"===e?.__typename&&e.merchandiseLines||[]).flatMap(e=>[e,...e.lineComponents.filter(e=>"MerchandiseBundleLineComponent"===e.__typename)]);return new Map(t.map(e=>[e.stableId,e]))}function Ou({targetMerchandise:e,negotiatedMerchandise:t,observability:s,isPointOfSale:i,isPointOfSaleShipToHome:n}){if("FilledMerchandiseLineTargetCollection"!==e.__typename)return[];const r=Lu(t);return e.linesV2.reduce((e,a)=>{if("MerchandiseLine"!==a.__typename&&"MerchandiseBundleLineComponent"!==a.__typename)return e;const{stableId:o,__typename:d,quantity:l}=a,u=xu(a),c=r.get(o)?.merchandise;if(!c)return s?.error(new Eu(`Missing merchandise for stableId: ${o} in negotiatedMerchandise. Available keys: ${r.keys()} negotiatedMerchandise=${JSON.stringify(t)}`),{severity:"error"}),e;if("ContextualizedProductVariantMerchandise"===c.__typename||"SourceProvidedMerchandise"===c.__typename){const{quantity:s,image:r}=Ru(l,c.image);return[...e,{digest:c.digest,title:c.title,stableId:o,quantity:s,...u&&{totalPrice:u},image:r,requiresShipping:Du({targetStableId:o,merchandise:c,negotiatedMerchandise:t,isPointOfSale:i,isPointOfSaleShipToHome:n,targetIsLineComponent:"MerchandiseBundleLineComponent"===d}),properties:us(c.properties),...Fu(c)&&{id:c.id,subtitle:c.subtitle??void 0,sellingPlan:cs(c.sellingPlan)}}]}return e},[])}function Bu({targetMerchandise:e,negotiatedMerchandise:t,isPointOfSale:s,isPointOfSaleShipToHome:i,observability:n}){if("FilledMerchandiseLineTargetCollection"!==e.__typename)return[];const r=Lu(t),a=e.linesV2.reduce((e,a)=>{if("MerchandiseLine"!==a.__typename&&"MerchandiseBundleLineComponent"!==a.__typename)return e;const{stableId:o,__typename:d,quantity:l}=a,u=xu(a),c=r.get(o)?.merchandise;if(!c)return n?.error(new Eu(`Missing merchandise for stableId: ${o} in negotiatedMerchandise. Available keys: ${r.keys()} negotiatedMerchandise=${JSON.stringify(t)}`),{severity:"error"}),e;if("ProductVariantMerchandise"===c.__typename||"SourceProvidedMerchandise"===c.__typename||"ContextualizedProductVariantMerchandise"===c.__typename){const{quantity:n,image:r}=Ru(l,c.image);return[...e,{digest:c.digest,title:c.title,stableId:o,quantity:n,...u&&{totalPrice:u},image:r,requiresShipping:Du({targetStableId:o,merchandise:c,negotiatedMerchandise:t,isPointOfSale:s,isPointOfSaleShipToHome:i,targetIsLineComponent:"MerchandiseBundleLineComponent"===d}),properties:us(c.properties)}]}return e},[]);return a.length?a:void 0}function Fu(e){return"ContextualizedProductVariantMerchandise"===e.__typename}function Nu(e,t,s){return e?.reduce((e,i)=>{const{excludeFromDeliveryOptionPrice:n,amount:r,targetMerchandise:a,discountRecurringCycleLimit:o,flatRateGroupId:d}=i,l=Ou({targetMerchandise:a,negotiatedMerchandise:t,observability:s}).filter(e=>e.requiresShipping);return l.length?[...e,{excludeFromDeliveryOptionPrice:n,amount:ns(r),targetMerchandiseLines:l,discountRecurringCycleLimit:o??void 0,flatRateGroupId:d??void 0}]:e},[])}function Uu(e){return{title:e.title,appliedDiscounts:e.appliedDiscounts.map(({label:e,allocationValue:t,amountDiscounted:s})=>({label:e,allocationValue:ls(t),amountDiscounted:ns(s)})),lineAmount:ns(e.lineAmount),deliveryChange:e.deliveryChange,isFulfilled:e.isFulfilled}}function qu(e){return{groupType:e.groupType,methodType:e.methodType,targetMerchandiseLines:e.targetMerchandiseLines.map(({stableId:e})=>({stableId:e})),total:ns(e.total),deliveryLines:e.deliveryLines.map(Uu)}}function Vu(e,{includeDeliveryGroups:t=!1}={}){const s=e.deliveryAddress?ge(e.deliveryAddress):null,i=e.pickupAddress?.coordinates,n=i?.latitude&&i?.longitude?{latitude:i?.latitude,longitude:i?.longitude}:void 0,r=e.pickupAddress?{address1:e.pickupAddress.address1,address2:e.pickupAddress.address2??void 0,countryCode:e.pickupAddress.countryCode,coordinates:n,city:e.pickupAddress.city,postalCode:e.pickupAddress.postalCode??void 0,zoneCode:e.pickupAddress.zoneCode??void 0,phone:e.pickupAddress.phone??void 0}:null;return{deliveryAddress:s,deliveryGroups:t&&e.deliveryGroups?e.deliveryGroups.map(qu):null,lines:e.lines.map(Uu),pickupAddress:r,pickupAddressName:e.pickupAddressName??null,total:ns(e.total)}}function zu(e,t=[]){if(0===t.length){let t;return t=0===e.length?[]:e.includes("SHIPPING")&&e.includes("LOCAL")?["SHIPPING","LOCAL"]:e.includes("SHIPPING")?["SHIPPING"]:e.slice(0,1),t}const s=t.filter(t=>e.includes(t));1===t.length&&s.includes("SHIPPING")&&e.includes("LOCAL")&&s.push("LOCAL"),1===t.length&&s.includes("LOCAL")&&e.includes("SHIPPING")&&s.push("SHIPPING");const i=[...new Set(s)];return i.length>0?i:0===e.length?[]:e.includes("SHIPPING")?["SHIPPING"]:e.slice(0,1)}function Hu({negotiatedDeliveryNext:e,enabledDeliveryMethods:t,buyerProposalDelivery:s,negotiatedMerchandise:i,mustSelectProvidedShippingRate:n=!1}){const r=os(i),a=[],[o,d]=r.reduce((e,t)=>"SourceProvidedMerchandise"!==t.__typename&&t.sellingPlan?.subscriptionDetails?[e[0],!0]:[!0,e[1]],[!1,!1]);o&&a.push(ds(e,"ONE_TIME_PURCHASE")),d&&a.push(ds(e,"SUBSCRIPTION"));const l=n?function(e){if("FilledDeliveryTerms"===e?.__typename&&0!==e.deliveryLines.length)for(const t of e.deliveryLines){const e=t.selectedDeliveryStrategy;if("CustomDeliveryStrategy"===e?.__typename){const t="MoneyValueConstraint"===e.price.__typename?e.price.value:void 0;if(t)return{title:e.title,code:e.code??void 0,source:e.source??void 0,price:{amount:t.amount,currencyCode:t.currencyCode}}}}}(s):void 0;return a.map(e=>({...e,deliveryMethodTypes:zu(t,ju(s)??e.deliveryMethodTypes),...l?{customDeliveryStrategy:l}:{}}))}function ju(e){if("FilledDeliveryTerms"!==e?.__typename||0===e.deliveryLines.length)return;const t=[...new Set(e.deliveryLines.flatMap(({deliveryMethodTypes:e})=>e))];return t.length>0?t:void 0}function Wu({negotiatedDeliveryNext:e,negotiatedMerchandiseLines:t,enabledDeliveryMethods:s,existingProposedDeliveryLines:i,fallbackToFirstDeliveryMethod:n=!1,mustSelectProvidedShippingRate:r=!1,buyerDeliveryOptionsMap:a}){const{lines:o,status:d}=e,l=e=>{const t="available"===e.status?e.methods.map(({methodType:e})=>e):[];s.includes("LOCAL")&&t.includes("SHIPPING")&&t.push("LOCAL"),!r&&s.includes("SHIPPING")&&t.includes("LOCAL")&&t.push("SHIPPING");const o=[...new Set(t)],d="available"===e?.status?e.methods[0]?.handle:void 0,l="available"===e.status?e.selectedDeliveryMethodHandle:void 0,u=i?.find(t=>!(t.type!==e.type||t.id&&e.id&&t.id!==e.id));let c=!l&&n?d:l;const h=r&&!c&&u?.deliveryMethodHandle&&u?.isCustomRate;h&&(c=u.deliveryMethodHandle);const p=["SHIPPING"];s.includes("LOCAL")&&p.push("LOCAL");const g=l&&0===o.length?p:o,m="available"===e.status?e.methods.find(({handle:e})=>e===c)?.isCustomRate??(h?u?.isCustomRate:void 0):function(e,t){if(!t)return;const s=t.find(t=>t.type===e.type&&(!e.id||e.id===t.id));return s?.isCustomRate}(e,i),y=function(e,t){if(!t)return{};const s=t.find(t=>t.type===e.type&&(!e.id||e.id===t.id));return s?.deliveryMethodOptions??{}}(e,i);return{id:e.id,type:e.type,deliveryMethodHandle:c,deliveryMethodOptions:Gu(e,a,c===u?.deliveryMethodHandle?y:void 0),deliveryMethodTypes:g,targetMerchandiseLines:e.targetMerchandiseLines||[],isCustomRate:m,customDeliveryStrategy:u?.customDeliveryStrategy}};if("partial"===d&&i){const e=t?function(e){const t=new Map;for(const s of e){t.set(s.stableId,s);for(const e of s.lineComponents)t.set(e.stableId,e)}return t}(t):void 0,s=e?i.flatMap(t=>{const s=function(e,t){if(0===e.targetMerchandiseLines.length)return e;const s=e.targetMerchandiseLines.flatMap(e=>{const s=t.get(e.stableId);return s?[s]:[]});return 0!==s.length?{...e,targetMerchandiseLines:s}:void 0}(t,e);return s?[s]:[]}):i.slice();for(const t of o){const e=$u(t,s);e>=0?s[e]=l(t):s.push(l(t))}return s}return o.map(l)}function $u(e,t){const s=t.findIndex(t=>t.type===e.type&&null!=t.id&&null!=e.id&&t.id===e.id);if(s>=0)return s;const i=new Set(e.targetMerchandiseLines?.map(e=>e.stableId).filter(Boolean)??[]);if(i.size>0){const s=t.findIndex(t=>t.type===e.type&&t.targetMerchandiseLines?.some(e=>e.stableId&&i.has(e.stableId)));if(s>=0)return s}const n=t.findIndex(t=>t.type===e.type&&null==t.id&&0===t.targetMerchandiseLines.length);return n>=0?n:-1}function Gu(e,t,s){if("available"!==e.status)return{};const i=e.selectedDeliveryMethodHandle,n=i?t?.get(i)??{}:{};return s?function(e,t){return{phone:t.phone??e.phone,instructions:t.instructions??e.instructions}}(s,n):n}function Yu(e){if(e&&"object"==typeof e&&"options"in e)return e.options??void 0}function Ju(e){const t=new Map;if(!e||"FilledDeliveryTerms"!==e.__typename)return t;for(const s of e.deliveryLines){if("DeliveryLine"!==s.__typename)continue;const e=s.selectedDeliveryStrategy;if("DeliveryStrategyReference"!==e?.__typename)continue;const i=Yu(e);i&&t.set(e.handle,{phone:i.phone??void 0,instructions:i.instructions??void 0})}return t}function Ku(e){return e?e.flatMap(e=>{if(!function(e){return"__typename"in e}(e))return[e];switch(e.__typename){case"CartMetafieldUpdateOperation":return[{update:{key:e.key,namespace:e.namespace,appId:e.appId,value:e.value,type:e.type}}];case"CartMetafieldDeleteOperation":return[{delete:{key:e.key,namespace:e.namespace,appId:e.appId}}];default:y(e)}}):[]}function Xu(e){return e?e.filter(e=>"CartMetafieldUpdateOperation"===e.__typename):[]}class Qu extends Error{constructor(){super(...arguments),this.name="MerchandiseQuantityError"}}function Zu(e){return null==e||"FilledMerchandiseTerms"!==e.__typename?[]:e.merchandiseLines.filter(e=>"MissingProductVariantMerchandise"===e.merchandise.__typename).map(e=>e.stableId)}function ec(e,t){if(null==e||"FilledMerchandiseTerms"!==e.__typename)return[];const s={preserveUnpriced:null!=t};return e.merchandiseLines.map(e=>"MissingProductVariantMerchandise"===e.merchandise.__typename?t?.find(t=>t.stableId===e.stableId):ic(e,s)).filter(e=>void 0!==e)}function tc({proposedMerchandise:e,negotiatedMerchandiseLines:t}){const s=t?.sellerPriced?t.lines:void 0,i=t?.unpricedStableIds;return e.map(e=>{const t=i?.includes(e.stableId)?void 0:s?.find(t=>t.stableId===e.stableId),n=e.quantity!==t?.quantity;return t?{...t,...n?{quantity:e.quantity,lineAllocations:e.lineAllocations,lineComponentsSource:e.lineComponentsSource,lineComponents:e.lineComponents,totalPrice:e.totalPrice}:{}}:e},[])}function sc(e,t,s){const i=e??t,n=s?.some(e=>"ConfirmChangeViolation"===e.__typename&&"MERCHANDISE_EXPECTED_PRICE_MISMATCH"===e.code),r=s?.some(e=>"ConfirmChangeViolation"===e.__typename&&"MERCHANDISE_EXPECTED_SELLING_PLAN_MISMATCH"===e.code);if("FilledMerchandiseTerms"!==i?.__typename)return{lines:[],taxesIncluded:!1,priceMismatch:n,sellingPlanMismatch:r};const a=ec(i),o=i.merchandiseLines.filter(e=>"totalAmount"in e&&("AnyConstraint"===e.totalAmount.__typename||e.lineComponents?.some(e=>"AnyConstraint"===e.totalAmount.__typename))).map(e=>e.stableId);return{lines:a,sellerPriced:i===e,...o.length>0&&{unpricedStableIds:o},taxesIncluded:i.taxesIncluded,priceMismatch:n,sellingPlanMismatch:r}}function ic(e,t){if("MerchandiseLine"!==e.__typename&&"MerchandiseBundleLineComponent"!==e.__typename)return;const{merchandise:s,quantity:i,totalAmount:n,lineAllocations:r,recurringTotal:a,stableId:o}=e;if("ProductVariantMerchandise"===s.__typename||"ContextualizedProductVariantMerchandise"===s.__typename||"SourceProvidedMerchandise"===s.__typename){let d,l,u,c,h,p,g;const m=s.digest;let y;return"SourceProvidedMerchandise"===s.__typename?(g=s.optionalIdentifier,l=s.taxable,u=s.taxCode,c=s.taxesIncluded,h=s.weight?{value:s.weight?.value,unit:s.weight?.unit}:void 0):d=s.id,"SourceProvidedMerchandise"!==s.__typename&&"ContextualizedProductVariantMerchandise"!==s.__typename||(p=s.sku),"AnyConstraint"!==n.__typename?y=ns(n):t?.preserveUnpriced||(y={currencyCode:"CAD",amount:0}),{quantity:rc(i),totalPrice:y,itemPrice:"ContextualizedProductVariantMerchandise"===s.__typename||"SourceProvidedMerchandise"===s.__typename?ns(s.price):void 0,compareAtPrice:"compareAtPrice"in s&&s.compareAtPrice?ns(s.compareAtPrice):void 0,deferredAmount:"ContextualizedProductVariantMerchandise"===s.__typename&&s.deferredAmount?ns(s.deferredAmount):void 0,recurringTotal:a?ps(a):null,id:d,digest:m,variantId:s.variantId,stableId:o,title:s.title,untranslatedTitle:s.untranslatedTitle,subtitle:s.subtitle??void 0,untranslatedSubtitle:s.untranslatedSubtitle??void 0,productUrl:s.productUrl??"",image:hs(s.image),vendor:s.product.vendor,productType:s.product.productType,productId:s.product.id,requiresShipping:s.requiresShipping,properties:us(s.properties),options:s.options,giftCard:s.giftCard,disclosures:"disclosures"in s.product?s.product.disclosures:[],taxable:l,taxCode:u,taxesIncluded:c,weight:h,sku:p,optionalIdentifier:g,typename:s.__typename,legacyFee:Boolean("MerchandiseLine"===e.__typename&&e.legacyFee),sellingPlan:"sellingPlan"in s?cs(s.sellingPlan):void 0,lineAllocations:r?r.map(e=>function(e){const{stableId:t,quantity:s,totalAmountAfterDiscounts:i,totalAmountAfterLineDiscounts:n,totalAmountBeforeReductions:r,checkoutPriceAfterDiscounts:a,checkoutPriceBeforeReductions:o,allocations:d,unitPrice:l}=e,u=l?{...l,price:ns(l.price)}:null,c=d.reduce((e,t)=>{if("LineComponentDiscountAllocation"!==t.__typename)return e;const{discount:s,allocation:i}=t,n=gs(s);return void 0!==n&&e.push({discountDetails:n,amount:ns(i.amount)}),e},[])??[];return{stableId:t,quantity:s,totalAmountAfterDiscounts:ns(i),totalAmountAfterLineDiscounts:ns(n),totalAmountBeforeReductions:ns(r),checkoutPriceAfterDiscounts:ns(a),checkoutPriceBeforeReductions:ns(o),allocations:c,unitPrice:u}}(e)):[],parentRelationship:"MerchandiseBundleLineComponent"!==e.__typename&&"parentRelationship"in e&&e.parentRelationship?{parent:e.parentRelationship.parent}:null,..."lineComponents"in e&&nc(e)&&{lineComponentsSource:e.lineComponentsSource,lineComponents:e.lineComponents?e.lineComponents.map(e=>ic(e,t)).filter(e=>void 0!==e):[]}}}}function nc(e){return"MerchandiseLine"===e.__typename}function rc(e){if("ProposalMerchandiseQuantityByItem"===e.__typename&&"IntValueConstraint"===e.items.__typename)return e.items.value;throw new Qu(`Unable to determine quantity for merchandise item: ${JSON.stringify(e)}`)}const ac=["EuReverseChargeTaxExemption"],oc=e=>ac.includes(e.__typename);function dc(e){if(e)switch(e.__typename){case"PendingTerms":return{status:"pending",pollDelay:e.pollDelay};case"UnavailableTerms":return{status:"unavailable"};case"FilledTaxExemptionTerms":return{status:"filled",available:e.available.filter(oc).map(lc)};default:return}}const lc=e=>{if("EuReverseChargeTaxExemption"===e.__typename)return{applied:e.applied,handle:"EU_REVERSE_CHARGE_EXEMPTION_RULE",details:uc(e)}};function uc({details:e}){return e?{...e,taxId:e.taxId??"",status:e.status??null}:null}function cc(e={}){return e?.currentProposed?.length?e.currentProposed:"filled"!==e?.negotiated?.status?[]:e.negotiated.available.filter(ms).map(ys)}function hc(e={}){return"filled"!==e?.negotiated?.status?[]:e.negotiated.available.filter(ms).map(ys)}function pc(e,t){return t.map((t,s)=>{const i=e[s];if(i){const{key:e,title:s,value:n,required:r}=i.fields;return e.value=t.key,n.value=t.value,s.value=t.title,r.value=t.required,i}return gc(t)})}function gc(e){const t=g(e.title),s=g(e.key),i=g(e.value),n=g(e.required),r={title:t,key:s,value:i,required:n},a=p(()=>({title:t.value,key:s.value,value:i.value,required:n.value}));return new vs(a,e=>{f(()=>{for(const[t,s]of Object.entries(e)){const e=r[t];e&&(e.value=s)}})},r)}function mc(e){const t=e.map(e=>gc(e));return g(t)}class yc extends Map{constructor(){super(...arguments),this.subscriptions=new Set}subscribe(e){return this.subscriptions.add(e),e(this),()=>this.subscriptions.delete(e)}clear(){super.clear(),this.subscriptions.forEach(e=>e(this))}delete(e){const t=super.delete(e);return this.subscriptions.forEach(e=>e(this)),t}set(e,t){return super.set(e,t),this.subscriptions.forEach(e=>e(this)),this}}function vc(e){return{firstName:e?.firstName??void 0,lastName:e?.lastName??void 0,company:e?.company??void 0,address1:e?.address1??void 0,address2:e?.address2??void 0,city:e?.city??void 0,province:e?.zoneCode??void 0,country:e?.countryCode??void 0,zip:e?.postalCode??void 0,phone:e?.phone??void 0}}function fc(e){if(e)return{first_name:e.firstName??void 0,last_name:e.lastName??void 0,street_address:e.address1??void 0,extended_address:e.address2??void 0,address_locality:e.city??void 0,address_region:e.zoneCode??void 0,address_country:e.countryCode??void 0,postal_code:e.postalCode??void 0,phone_number:e.phone??void 0}}function bc(e){return function(e){const t=e?.find(e=>"UcpPaymentMethod"===e.__typename);if(!t)return;const s=t.instruments?.find(e=>e.id===t.selectedInstrumentId);if(!s)return;const i="StreetAddress"===s.billingAddress?.__typename?s.billingAddress:null;return{id:s.id,handler_id:s.handlerId,type:s.type??"card",selected:!0,display:{brand:s.brand??void 0,last_digits:s.lastDigits??void 0,description:s.richTextDescription??void 0,card_art:s.richCardArt??void 0},cardholder_name:void 0,expiry_month:s.expiryMonth??void 0,expiry_year:s.expiryYear??void 0,billing_address:fc(i)}}(e)??function(e){const t=e?.find(e=>"CreditCardPaymentMethod"===e.__typename),s=t?.instruments?.[0];if(!s)return;const i="StreetAddress"===s.billingAddress?.__typename?s.billingAddress:null;return{externalReferenceId:s.externalReferenceId,lastDigits:s.lastDigits,brand:s.brand?.toUpperCase(),cardHolderName:s.cardHolderName,month:s.month,year:s.year,billingAddress:vc(i)}}(e)}const Sc={addressModalState:{status:"idle",addressType:"shipping",setAsDefault:"default"}};function Ac({enabledDeliveryMethods:e=[],delegatedPaymentInstrument:t}={}){const s=g([]);return{inventoryRecoverySignal:g(void 0),billing:g(!1),contact:g(!1),createAddressParts:Ms(Sc),currentDiscountCodeAttemptSignal:g(null),delegatedPaymentInstrument:g(t),deliveryMethodDeltaSignal:g(0),deliveryMethodsAddressErrors:ce(),deliveryMethodTimingSignal:g(0),derivedErrorMessageSignal:p(()=>Is(s.value)??""),directPaymentFieldsFilled:g(!1),discountCodeWarningSignal:g(null),installmentMonthsSignal:g(void 0),missingMerchandiseStableIdsSignal:g([]),msiInvalidationReasonSignal:g(null),msiInvalidationSnapshotSignal:g(null),msiHadInstallmentsSignal:g(!1),editorSetShopPaySignal:g(null),emailMarketingOptInShownSignal:g(!1),emailMarketingConsentGrantReachedSignal:g(!1),previousPhoneMarketingDisclosureKeySignal:g(void 0),smsMarketingOptInShownSignal:g(!1),shopPayMobilePhoneInputShownSignal:g(!1),noAddressLocationModalShownSignal:g(!1),privacyBannerSettingsSignal:g(null),extensionSkeletonBatchStateSignal:g("idle"),extensionSkeletonBatchReleaseIdSignal:g(0),extensionSkeletonPendingCountSignal:g(0),payment:g(!1),reductionsErrorsSignal:s,reductionsValueSignal:g(""),refreshNegotiationSignal:g(!1),rememberMePhoneErrorSignal:g(void 0),rememberMePhoneSignal:g(void 0),shipping:g(!1),voidedGiftCardsSignal:g([]),cachedMembershipViolations:g([]),hasNegotiatedAlternativePaymentCurrencySignal:g(!1),newCardSignal:g(void 0),hasLoadedSignal:g(!1),bankIdNumberSignal:g(void 0),lastNegotiatedBinSignal:g(void 0),bankPaymentTokenSignal:g(void 0),checkoutProtocolModalEventSignal:g("none"),checkoutProtocolPayButtonLoadingSignal:g(void 0),checkoutProtocolPayButtonDisabledSignal:g(void 0),checkoutProtocolPayButtonMountedSignal:g(!1),checkoutProtocolPayButtonStageSignal:g("pay"),checkoutProtocolPresentedSignal:g(!1),allRenderedSections:g({}),getRenderedSection:Ts({defaultValue:{},initial:{}}),marketingPhoneInputError:g(void 0),buyerHasActedSignal:g(!1),appMetafieldsSignal:g({}),cartLineChangeLoadingSignal:g(!1),prequalifiedAnimatedBadgeShowCounter:g(0),enabledDeliveryMethodsSignal:g(e)}}function _c(e){return"Throttled"===e?.__typename?{status:"queued",token:e.queueToken,pollAfter:new Date(e.pollAfter).getTime(),productVariantAvailabilityV2:[],pollUrl:e.pollUrl}:{status:"inactive",token:e?.queueToken??void 0}}function Pc(e,{isShippingRequired:t,ucp:s}={}){const{shopPayArtifact:i,purchaseOrder:{paymentLines:n,email:r,phone:a,shippingAddress:o,billingAddress:d,deliveryNext:l,deliveryExpectations:u,runningTotal:c,paymentDue:h,merchandiseLines:p,checkoutCompletionTarget:g,metafields:m,cartMetafields:y},recurringTotals:v,deferredTotal:f,checkoutTotalBeforeTaxesAndShipping:b,checkoutTotal:S,checkoutTotalTaxes:A,taxes:_,subtotal:P,legacyRepresentProductsAsFees:C,totalSavings:k,landedCostDetails:E,duties:w,paymentFlexibilityPaymentTermsTemplate:T,optionalDuties:M,discountLines:I,tipLines:D,hasOnlyDeferredShipping:R,note:x,paymentMethods:L,buyerIdentity:O,subtotalBeforeReductions:B,subtotalAfterMerchandiseDiscounts:F,customAttributes:N,dutiesIncluded:U,legacySubtotalBeforeTaxesShippingAndFees:q,legacyMerchandiseLinesAsFees:V,consolidatedTotals:z,consolidatedTaxes:H,remotePaymentDue:j,remoteMerchandiseDetails:W,shopPayEnabledForSellerOfRecord:$}=e;return{deliveryNext:l,billingAddress:d,shippingAddress:o,runningTotal:c,paymentDue:h,shopPayArtifact:i,recurringTotals:v,deferredTotal:f,checkoutTotalBeforeTaxesAndShipping:b,checkoutTotal:S,checkoutTotalTaxes:A,taxes:_,taxExemptions:void 0,subtotal:P,legacyRepresentProductsAsFees:C,totalSavings:k,landedCostDetails:E,duties:w,paymentFlexibilityPaymentTermsTemplate:T,optionalDuties:M,discountLines:I,hasOnlyDeferredShipping:R,note:x,paymentMethods:L,buyerIdentity:O,merchandiseLines:p,subtotalBeforeReductions:B,paymentMethodHistory:void 0,paymentLines:n?{lines:n}:void 0,customAttributes:N,shopPayEnabledForSellerOfRecord:$,acceptEmailMarketing:void 0,emailMarketingConsentGrantReached:void 0,checkoutCompletionTarget:g,acceptSmsMarketing:void 0,attribution:void 0,deliveryExpectations:u,localizationExtensions:void 0,locationAddress:void 0,nonNegotiableTerms:void 0,purchaseOrderNumber:void 0,scriptFingerprint:void 0,transformerFingerprintV2:void 0,checkoutCardsinkCallerIdentificationSignature:void 0,smsMarketingPhone:void 0,allViolations:void 0,tipOptions:void 0,total:c,captcha:void 0,availableRedeemables:void 0,shopCashBalance:void 0,shopPromotion:void 0,shopDiscountOffer:void 0,reduction:void 0,managedByMarketsPro:void 0,managedMarketsPaymentProcessor:void 0,alternativePaymentCurrency:void 0,lpmDisclosure:void 0,cardlessCheckoutEligibilityToken:void 0,saleAttributions:void 0,cartCheckoutValidation:void 0,metafields:m,acceptUnexpectedDiscounts:void 0,dutiesIncluded:U,subtotalAfterMerchandiseDiscounts:F,legacySubtotalBeforeTaxesShippingAndFees:q,legacyMerchandiseLinesAsFees:V,isShippingRequired:t??p?.lines?.some(e=>e.requiresShipping),availableDeliveryAddresses:void 0,mustSelectProvidedAddress:void 0,mustSelectProvidedShippingRate:void 0,canUpdateDiscountCodes:void 0,canUpdateDeliveryAddress:void 0,canUpdateMerchandise:void 0,depositConfiguration:void 0,isImmediateAmountReducedForRedeemables:void 0,pendingDelivery:void 0,contactInfo:{email:r,phone:a},tipLines:D,memberships:void 0,cartMetafields:y,customFields:void 0,additionalMoneyLines:void 0,remoteMerchandiseDetails:W,remotePaymentDetails:void 0,remoteSessionDetails:void 0,remoteTaxDetails:H,remoteConsolidatedTotals:z,remoteTotalDetails:void 0,remotePaymentDue:j,sellability:void 0,ucp:s}}class Cc{constructor(e=new Set,{suppressSelfWrites:t=!1}={}){this.changedParts=e,this.deliveryLineSnapshots=new Map,this.applyingUpdate=!1,this.suppressSelfWrites=t}subscribeToChanges(e){const t=[],s=e=>{let s=!1;const i=e.subscribe(()=>{const t=this.suppressSelfWrites&&this.applyingUpdate;s&&!t&&this.changedParts.add(e),s=!0});t.push(i)};this.deliveryLines=e.deliveryLines,this.deliveryLines&&this.captureDeliveryLineSnapshots(this.deliveryLines);for(const i of Object.values(e))if(Rs(i))for(const e of Object.values(i.fields))s(e);else i instanceof _&&s(i);return()=>{t.forEach(e=>e())}}applyUpdate(e,t){this.applyingUpdate=!0;try{this.applyUpdateTracked(e,t)}finally{this.applyingUpdate=!1}}applyUpdateTracked(e,t){if(e===this.deliveryLines&&this.deliveryLinesChanged()&&this.changedParts.add(e),Rs(e)){const s=[];return f(()=>{for(const[i,n]of Object.entries(e.fields)){if(this.changedParts.has(n))continue;const e=t[i];e&&n.peek()!==e&&(n.value=e),s.push(i)}}),void e[xs](s)}e instanceof _&&!this.changedParts.has(e)&&(e.value=t,e===this.deliveryLines&&this.captureDeliveryLineSnapshots(this.deliveryLines))}deliveryLinesChanged(){for(const[e,t]of this.deliveryLineSnapshots)if(!Object.is(t,e.value))return!0;return!1}captureDeliveryLineSnapshots(e){this.deliveryLineSnapshots.clear(),this.deliveryLineSnapshots.set(e,e.value);for(const t of e.value)this.deliveryLineSnapshots.set(t,t.value)}}class kc{#Xt=Promise.resolve();async run(e){const t=this.#Xt;let s;this.#Xt=new Promise(e=>{s=e}),await t;const i=setTimeout(s,1e4);try{return await e()}finally{clearTimeout(i),s()}}}const Ec=A((e,t)=>{const{checkout:s,client:i,graphql:{coreGraphql:n,throttleGraphql:r},observability:a,userEvents:o,persistence:d,router:l,shop:u,shopPay:c,source:h,url:p}=e,{strategy:m}=t,y=Ke(i,t.negotiateFromSessionData),{throttle:v,sessionToken:b,context:S,initialProgression:A,initialUnresolvedFields:_,initialNegotiation:P}=t.seed??function({client:e,shop:t,negotiateFromSessionData:s}){const i=s?.session?.negotiate?.result,n=Ds(s??void 0),r="Throttled"===i?.__typename||"NegotiationResultAvailable"===i?.__typename?_c(i):{status:"loading",token:e.unstable_getSerialization("queueToken")},a="NegotiationResultAvailable"===i?.__typename?i.sellerProposal:void 0,o="NegotiationResultAvailable"===i?.__typename||"NegotiationResultFailed"===i?.__typename||"TooManyRequests"===i?.__typename?bu(i,n,Ma(a?.note)):[],d={type:"success",violations:n??[],errors:[],negotiationStage:"negotiation"};return{throttle:r,sessionToken:e.unstable_getSerialization("sessionToken"),initialProgression:d,context:Ac({enabledDeliveryMethods:t.enabledDeliveryMethods,delegatedPaymentInstrument:bc(s?.session?.checkoutPaymentMethods)}),initialUnresolvedFields:o,initialNegotiation:s??void 0}}({client:i,shop:u,negotiateFromSessionData:y}),C=g(v),k=s.proposal.negotiated,E=s.proposal.proposed,w=g(new Set(_)),T=g(new Set(_)),M=g(void 0),I=g(!1),D=g(!1),R=g(void 0),x=g(!1),L=g(A),O=g(A),B=g([]),F=new Set,N=new Set,U=new Set,q=new Set,V=new kc,z=new Set;let H,j,W=0,$=0,G=!1,Y=0;const J=function({observability:e,shop:t,loadingFields:s,reportedSilencedViolationCodes:i,getNegotiationCount:n,run:r}){const a=new yc;let o=0,d=[];function l(e,t){return t===e||"progression"===e||"completion"===e}return{negotiate:function(u){const c={...u,identifier:u.identifier??Symbol("negotiationRequest"),negotiationStage:u.negotiationStage??"progression"},{identifier:h}=c;if([...a.values()].some(e=>"progression"===e.negotiationStage)){const t=c.negotiationStage;c.negotiationStage="progression",e.leaveErrorBreadcrumb("[Negotiate] Negotiation stage inherited from pending progression",{originalStage:t})}const p=new Promise((t,s)=>{const i=a.get(h);i&&i.reject(new Ps),a.set(h,{fieldsToResolve:c.fieldsToResolve,threePageWalletEscalation:c.threePageWalletEscalation,negotiationStage:c.negotiationStage,negotiationCustomized:Boolean(c.customizeNegotiation),silenceViolations:c.silenceViolations,eventId:c.reason?.eventId,resolve:t,reject:s}),e.leaveErrorBreadcrumb("[Negotiate] Negotiation request added to pending negotiations",{negotiationStage:c.negotiationStage,fieldsToResolve:c.fieldsToResolve,queueSize:a.size})});return e.leaveErrorBreadcrumb("[Negotiate] Running negotiation",{silenceViolations:c.silenceViolations,negotiationStage:c.negotiationStage,negotiationCount:n()}),o+=1,async function(n){const{identifier:o}=n,d=(s,r,o)=>{let d=r;if("violations"in r&&s.silenceViolations!==n.silenceViolations){const a=ks(r.violations,s.silenceViolations,t);Es({observability:e,negotiationStage:s.negotiationStage,silenceViolations:s.silenceViolations,violations:r.violations,retainedViolations:a,reportedCodes:i});const o=r.status,l=ws(a).hasAny?"error":"success";o!==l&&e.leaveErrorBreadcrumb("[RunNegotiation] Re-filtering violations changed status for cross-resolved request",{originalStatus:o,newStatus:l,requestSilenceViolations:s.silenceViolations,currentSilenceViolations:n.silenceViolations}),d={...r,status:l}}s.resolve(d),a.delete(o)};for await(const i of r(n)){if("stale"===i.status){const s=a.get(o);s&&null!=n.customizeNegotiation?d(s,i,o):"completion"===s?.negotiationStage&&t.hasFlagEnabled(Cs)&&(e.log("negotiation_stale_completion_request_released","[RunNegotiation] Resolving own completion request after stale run",{queueSize:a.size}),e.counter({name:"negotiation_stale_completion_request_released",value:1}),d(s,i,o));continue}if("pendingFields"in i&&0===i.pendingFields?.length){const e=a.get(o);e&&d(e,i,o)}if("fetch_failed"===i.status&&i.networkError){const t=a.get(o);t&&(e.log("negotiation_fetch_failed_request_released","[RunNegotiation] Resolving own pending request after network failure",{queueSize:a.size}),e.counter({name:"negotiation_fetch_failed_request_released",value:1}),d(t,i,o));continue}a.forEach((r,a)=>{const o=s.peek(),u="progression"===r.negotiationStage,c=a===n.identifier&&"completion"===r.negotiationStage&&t.hasFlagEnabled(Cs);if((u||c)&&"invalid"===i.status)return void d(r,i,a);if(r.fieldsToResolve?.some(e=>o.has(e))||o.has("cartCheckoutValidation")&&!n.skipStateUpdates)return void e.leaveErrorBreadcrumb("[RunNegotiation] Ignoring negotiation result");const h=n.negotiationStage,p=r.negotiationStage,g=l(h,p);e.debug("negotiation_evaluated","[RunNegotiation] Evaluating negotiation",{shouldResolve:g,requestStage:p,currentStage:h}),g?(e.log("negotiation_evaluated","[RunNegotiation] Resolving pending negotiation request for pending request",{requestStage:p,currentStage:h,withResultStatus:i.status}),d(r,i,a)):e.leaveErrorBreadcrumb("[RunNegotiation] Not resolving pending negotiation request for pending request",{requestStage:p,currentStage:h,withResultStatus:i.status})})}}(c).catch(e=>{e instanceof Error&&(d.push({error:e,negotiationStage:c.negotiationStage}),a.get(h)?.reject(e),a.delete(h))}).finally(()=>{!function(){if(o-=1,o>0)return;const t=a.size,s=d;d=[];let i=0;s.forEach(({error:e,negotiationStage:t})=>{a.forEach((s,n)=>{l(t,s.negotiationStage)&&(i+=1,s.reject(e),a.delete(n))})}),i>0&&(e.log("negotiation_failure_swept_pending_siblings","[Negotiate] Rejected pending negotiations orphaned by a failed negotiation",{sweptSiblings:i,negotiationStages:s.map(({negotiationStage:e})=>e)}),e.counter({name:"negotiation_failure_swept_pending_siblings",value:i})),t>0&&e.log("negotiation_runs_ended_with_pending_requests","[Negotiate] All runs ended with pending requests",{queueSizeBeforeCleanup:t,queueSizeAfterCleanup:a.size,thrownErrorCount:s.length,cleanupStrategy:"failed_siblings"})}()}),p},waitForPendingNegotiations:async function(t){const s=a.size;if(0===s)return;e.leaveErrorBreadcrumb("[Complete] Completion waiting for negotiation queue to clear",{queueSize:s}),t?.setProgressing?.(!0);const i=setTimeout(()=>{e.log("complete_waiting_for_negotiation_queue_still_waiting","[Complete] Negotiation queue still waiting after 5 seconds",{queueSize:a.size,inFlightRunCount:o})},5e3);await new Promise(e=>{a.subscribe(t=>{0===t.size&&(clearTimeout(i),e())})}),e.leaveErrorBreadcrumb("[Complete] Negotiation queue empty - continuing with completion")},collectPendingNegotiationEventIds:function(e,t){const s=[];return a.forEach((i,n)=>{(n===e||!i.negotiationCustomized&&l(t,i.negotiationStage))&&null!=i.eventId&&s.push(i.eventId)}),s},hasPendingThreePageWalletEscalation:function(){return[...a.values()].some(e=>!0===e.threePageWalletEscalation)}}}({observability:a,shop:u,loadingFields:T,reportedSilencedViolationCodes:z,getNegotiationCount:()=>$,run:e=>ge.negotiate(e)});function K(e){I.value=e}function X(e){B.value=e}function Q(e){C.value=e,q.forEach(t=>t(e))}function Z(e){return q.add(e),()=>q.delete(e)}function ee(e){f(()=>{L.value=e,O.value=e})}function te(e,{progression:t=!1}={}){f(()=>{O.value=e,D.value=!0,t&&(L.value=e)})}function se(e){const t=Pu(L.peek(),e);if(t)return void ee(t);const s=Pu(O.peek(),e);s&&(O.value=s)}function ie(e){!function({loading:e,initialUnresolvedFields:t,current:s},i){if(null==i||"processed"!==i.status)return;const n=Pc(i,{isShippingRequired:s.fields.isShippingRequired.peek(),ucp:s.fields.ucp.peek()});f(()=>{s.value=n,t.peek().size>0&&(t.value=new Set);const i=e.peek();e.value=new Set([...i].filter(e=>!(e in n)))})}({current:k,loading:T,initialUnresolvedFields:w},e)}function ne(){const e=s.latestReceipt.value;return e&&"failed"!==e.status&&"abandoned"!==e.status?{behavior:"block",reason:He.SubmittedForCompletion}:{behavior:"allow"}}function re(e){return F.add(e),()=>F.delete(e)}async function ae(e){await Promise.all([...N].map(t=>t(e)))}function oe(e){return N.add(e),()=>N.delete(e)}async function de(e,t){await Promise.all([...U].map(s=>void 0===t?s(e):s(e,t)))}function le(e){return U.add(e),()=>U.delete(e)}function ue(){return 0===Y&&(x.value=!0),Y+=1,()=>{Y-=1,0===Y&&(x.value=!1)}}function ce(){$+=1;const e=$;return a.histogram({name:"negotiation_round",value:e}),e>=50&&!G&&(G=!0,a.log("negotiation_rounds_excessive","Checkout has run an unusually high number of negotiation rounds",{negotiationRound:e,threshold:50})),e}const he=({updated:e,loadingFields:t=[],buyerProposal:s,reconciler:i})=>{!function(e,{updated:t,buyerProposal:s,reconciler:i}){for(const n of Object.keys(t)){let r,a,o,d=t[n];switch(n){case"contactInfo":d=t[n].email??e.parts.email.peek(),r=e.parts.email;break;case"acceptSmsMarketing":case"acceptEmailMarketing":null!=d&&(r=e.parts[n]);break;case"smsMarketingPhone":break;case"deliveryNext":{const i=t[n],l=!1===e.current.fields.isShippingRequired.peek()&&!0===t.isShippingRequired,u="unavailable"===i.status,c=u&&l&&"FilledMerchandiseTerms"===s?.merchandise.__typename;if(!u||c){const{parts:n}=e,l=e.context.enabledDeliveryMethodsSignal.peek();if(l.length&&!t.sellability?.enabledDeliveryMethods.length){const s={enabledDeliveryMethods:l};void 0===t.sellability&&(s.missingSellerProposalReason="negotiated_update_sellability_missing"),As(e.observability,"negotiator_delivery_line_fallback","[Negotiated] Falling back to enabledDeliveryMethods for delivery line construction because sellability was not available",s)}const c=t.sellability?.enabledDeliveryMethods??[],h=c.length>0?c:l,p=c.filter(e=>"NONE"!==e),g=p.length>0?p:l.filter(e=>"NONE"!==e),m=u?{kind:"recover",deliveryNext:i,enabledDeliveryMethods:g,buyerProposalDelivery:void 0,deliveryMacros:[]}:{kind:"reconcile",deliveryNext:i,enabledDeliveryMethods:h,buyerProposalDelivery:s?.delivery,deliveryMacros:i.deliveryMacros??[]};if("recover"===m.kind&&0===m.enabledDeliveryMethods.length)break;r=n.deliveryLines;const y=n.deliveryLines.peek(),v=t.mustSelectProvidedShippingRate??e.current.fields.mustSelectProvidedShippingRate.value??!1,f=v&&y.length>0?y.map(e=>e.peek()):Hu({negotiatedDeliveryNext:m.deliveryNext,enabledDeliveryMethods:m.enabledDeliveryMethods,buyerProposalDelivery:m.buyerProposalDelivery,negotiatedMerchandise:t?.remoteMerchandiseDetails?.stableIdToShopId?.size?t.remoteMerchandiseDetails?.mergedBuyerProposalMerchandise:s?.merchandise,mustSelectProvidedShippingRate:v}),b=Ju(m.buyerProposalDelivery);d=("recover"===m.kind||0===m.deliveryNext.lines.length?f:Wu({negotiatedDeliveryNext:m.deliveryNext,enabledDeliveryMethods:m.enabledDeliveryMethods,existingProposedDeliveryLines:y.map(e=>e.peek()),fallbackToFirstDeliveryMethod:!1,mustSelectProvidedShippingRate:v,buyerDeliveryOptionsMap:b,negotiatedMerchandiseLines:t.merchandiseLines?.lines})).map(e=>_s(e)),o=n.deliveryMacros;const S=n.deliveryMacros.peek();a=ku(m.deliveryMacros,S)}break}case"merchandiseLines":{const i=e.parts[n].peek(),a=t.remoteMerchandiseDetails?.mergedBuyerProposalMerchandise,o=Boolean(t?.remoteMerchandiseDetails?.stableIdToShopId?.size),l=(()=>o?a?ec(a,i):i:s?ec(s?.merchandise,i):i)(),u=o?a:s?.merchandise;u&&(e.context.missingMerchandiseStableIdsSignal.value=Zu(u)),d=tc({proposedMerchandise:l,negotiatedMerchandiseLines:t.merchandiseLines}),r=e.parts[n];break}case"cartMetafields":d=Ku(s?.cartMetafields),r=e.parts[n];break;case"discountLines":d=t[n].lines,r=e.parts[n];break;case"tipLines":default:r=e.parts[n];break;case"availableRedeemables":d=t[n]??[],r=e.parts[n];break;case"localizationExtensions":{const s=t[n];r=e.parts[n],r&&(d=pc(r.peek(),s??[]));break}case"paymentLines":{const s=t[n],i=e.parts[n].peek(),a=("merchandiseLines"in t?t.merchandiseLines?.lines:e.current.fields.merchandiseLines.peek()?.lines)??e.parts.merchandiseLines.peek(),o=("paymentFlexibilityPaymentTermsTemplate"in t?t.paymentFlexibilityPaymentTermsTemplate:e.current.fields.paymentFlexibilityPaymentTermsTemplate.peek())?.type;d=fs({paymentLines:s.lines,proposedPaymentLines:i,availablePaymentMethods:t.paymentMethods,violations:t.allViolations,url:e.router.currentUrl.value,deferredTotal:t.deferredTotal,shouldNotSetInitialState:e.shop.paymentMethodAutoSelectionDisabled,hasSellingPlan:Ss(a),hasFixedSellingPlan:bs(a),paymentTermsTemplateType:o,isImmediateAmountReducedForRedeemables:t.isImmediateAmountReducedForRedeemables,observability:e.observability,delegatedPaymentInstrument:e.context.delegatedPaymentInstrument.peek(),bankPaymentToken:e.context.bankPaymentTokenSignal.peek()}),r=e.parts[n];break}case"billingAddress":d={...e.parts.billingAddress.peek(),...d},r=e.parts.billingAddress;break;case"remotePaymentDetails":r=e.parts[n],d=t.remotePaymentDetails;break;case"shippingAddress":{const t=e.parts.shippingAddress.peek(),s=d;d={city:"",postalCode:"",...t,...s,coordinates:t.coordinates??s?.coordinates},r=e.parts.shippingAddress;break}case"taxExemptions":{const s=t[n];d=cc({negotiated:s,currentProposed:e.parts.taxExemptions.peek()}),r=e.parts.taxExemptions,"pending"===s.status&&(t.taxExemptions={...e.current.fields.taxExemptions.peek(),...s});break}}r&&i.applyUpdate(r,d),o&&i.applyUpdate(o,a)}}(pe,{updated:e,buyerProposal:s,reconciler:i});const n=new Set(t),r=w.peek();let a;for(const o of r)n.has(o)||(a??=new Set(r),a.delete(o));f(()=>{k.value=e,a&&(w.value=a),T.value=n})},pe={graphql:n,client:i,sessionToken:b,source:h,router:l,url:p,throttleState:C,checkout:s,persistenceManager:d,context:S,observability:a,userEvents:o,shopPay:c,shop:u,current:k,parts:E,facts:s.proposal.facts,loading:T,initialUnresolvedFields:w,initializationError:M,submitting:I,hasNegotiatedOnce:D,pendingFieldsNegotiation:R,isBlocked:x,lastJourneyProgression:L,lastNegotiation:O,validationErrors:B,reportedSilencedViolationCodes:z,setThrottle:Q,listenThrottle:Z,setSubmitting:K,setValidationErrors:X,recordProgression:ee,recordNegotiation:te,removeViolations:se,applyProcessedReceipt:ie,intercept:re,runInterceptors:async function({forceBlock:e=!1,negotiationStage:t,skipEffects:s=!1}){const i=await Promise.all([ne,...F].map(async e=>e({parts:E,reason:t}))),n=i.filter(e=>"block"===e.behavior),r=n.map(e=>e.reason),a=i.flatMap(e=>e.errors??[]),o=i.flatMap(e=>e.context??[]),d=e||n.length>0?{behavior:"block",reasons:r,errors:a,context:o}:{behavior:"allow",errors:a,context:o};return s||await Promise.all(i.map(e=>e.perform?.(d))),d},listen:oe,runListeners:ae,listenBeforeNegotiation:le,runBeforeNegotiationListeners:de,block:ue,negotiate:J.negotiate,complete:async function(e){await J.waitForPendingNegotiations(e),++W;const t=await ge.complete(e);if("rejected"===t.status||"failed"===t.status||"fetch_failed"===t.status||"tooManyRequests"===t.status){const{inventoryRecoverySignal:e}=S,t=e.value;t&&!t.dismissed&&(e.value={...t,dismissed:!0})}return t},waitForPendingNegotiations:J.waitForPendingNegotiations,getNegotiationInput:()=>ge.getNegotiationInput(),start:function(){const e=ce();let t;const s=()=>null==t?e===$:t===W;return{isActive:s,negotiating:(e=Object.keys(k.fields))=>{W+=1,t=W,T.value=new Set(e),j?.();const i=new Cc(void 0,{suppressSelfWrites:!0});return j=i.subscribeToChanges(E),({updated:e,loadingFields:t=[],buyerProposal:n})=>{s()&&he({updated:e,loadingFields:t,buyerProposal:n,reconciler:i})}}}},startNegotiationRound:ce,setLoadingFields:function(e){T.value=new Set(e)},applyNegotiated:he,track:function(e){const t=H;return H=e&&Os(e),{dirty:null==H||H!==t}},serializeNegotiationRequest:e=>V.run(e),collectPendingNegotiationEventIds:J.collectPendingNegotiationEventIds,hasPendingThreePageWalletEscalation:J.hasPendingThreePageWalletEscalation},ge=function(e,t){return{complete:async s=>(await Au()).complete(e,t,s),getNegotiationInput:async()=>(await Au()).getNegotiationInput(e),negotiate:async function*(s){const i=await Au();yield*i.negotiate(e,t,s)}}}(pe,a),me=m?.(pe);pe.negotiate=me?.negotiate??pe.negotiate,pe.complete=me?.complete??pe.complete,pe.getNegotiationInput=me?.getNegotiationInput??pe.getNegotiationInput,function(){const e=Ls(h),t=d?.createUpdate(Rt.PostPurchaseInquiryStatus,{scope:e});t&&E.postPurchaseInquiryStatus.subscribe(e=>t(e));const s=d?.createUpdate(Rt.ExternalDeliveryIds,{scope:e});s&&E.externalDeliveryIds.subscribe(e=>s(e));const i=d?.createUpdate(Rt.ShopPayArtifact,{scope:e});i&&E.shopPayArtifact.subscribe(e=>i(e));const n=d?.createUpdate(Rt.SetShippingAddressAsDefault,{scope:e});n&&E.setShippingAddressAsDefault.subscribe(e=>{void 0!==e&&n(e)})}(),C.subscribe(e=>r.setPollUrl("pollUrl"in e?e.pollUrl:void 0));const ye={unstable_initialNegotiation:g(P),parts:E,current:k,context:{...S},loading:T,initialUnresolvedFields:w,initializationError:M,submitting:I,hasNegotiatedOnce:D,pendingFieldsNegotiation:R,isBlocked:x,lastJourneyProgression:L,lastNegotiation:O,validationErrors:B,throttleState:C,setThrottle:Q,listenThrottle:Z,setSubmitting:K,setValidationErrors:X,recordProgression:ee,recordNegotiation:te,removeViolations:se,applyProcessedReceipt:ie,intercept:re,listen:oe,listenBeforeNegotiation:le,block:ue,runListeners:ae,runBeforeNegotiationListeners:de,negotiate:pe.negotiate,complete:pe.complete,waitForPendingNegotiations:pe.waitForPendingNegotiations,getNegotiationInput:pe.getNegotiationInput,prepareStartup:function(){fe(_u),fe(ve)},runStartup:function(){fe(Se),fe(()=>ie(s.latestReceipt.peek()))}};function ve(){const e=y?.session?.negotiate?.result;"NegotiationResultAvailable"===e?.__typename&&e.checkpointData&&s.checkpointToken.peek()!==e.checkpointData&&s.unstable_overwriteCheckpointToken(e.checkpointData)}function fe(e){try{const t=e();t instanceof Promise&&t.catch(be)}catch(t){be(t)}}function be(e){e instanceof Error&&(M.value??=e)}async function Se(){const e=y?.session?.negotiate,t=e?.result;if(!t||"Throttled"===t.__typename)return;if(Xe(i.unstable_getSerialization("receipt"),e))return;const s="NegotiationResultAvailable"===t.__typename?t.sellerProposal:void 0;if(0===bu(t,Ds(y??void 0),Ma(s?.note)).length)return;const n=await ye.negotiate({force:!0,silenceViolations:["all"],negotiationStage:"negotiation",customizeNegotiation:e=>e});R.value=n,await Bs(ye,n,{source:"pending-fields"})}return ye});class wc extends Error{constructor(){super(...arguments),this.name="OffsitePopupError"}}class Tc{constructor({client:e,observability:t}){this.#Qt=g(!1),this.isOpen=this.#Qt,this.#Zt=null,this.#es=null,this.#ts=null,this.#ss=null,this.#is=!1,this.#ze=e,this.#Et=t,this.open=this.open.bind(this),this.close=this.close.bind(this),this.redirect=this.redirect.bind(this),this.focus=this.focus.bind(this),this.messageHandler=this.messageHandler.bind(this),this.unloadHandler=this.unloadHandler.bind(this)}#Qt;#Zt;#es;#ts;#ss;#Et;#ze;#is;open({onComplete:e,onCancel:t,theme:s,popupDimensions:i,isCryptoPayment:n=!1,title:r}){if(this.isOpen.value)throw new wc("Popup already open");return this.#ts=t,this.#ss=e,this.#is=n,this.#Zt=window.open("about:blank","_blank",function(e,t){const{outerHeight:s,outerWidth:i,screenY:n,screenX:r}=e,a=Math.floor(s/2+n-t.height/2),o=Math.floor(i/2+r-t.width/2);return`popup, width=${t.width}, height=${t.height}, top=${a}, left=${o}`}(window,i)),!this.#Zt||this.#Zt.closed?(Mc({success:!1,observability:this.#Et}),n&&(this.#Et.counter({name:"offsite_payment_popup_flow_open_failed",value:1,attributes:{payment_method_name:"Crypto: USDC",is_mobile:Fs(this.#ze)}}),this.#Et.counter({name:"offsite_payment_redirect_flow",value:1,attributes:{payment_method_name:"Crypto: USDC",redirect_reason:"popup_blocked",is_mobile:Fs(this.#ze)}})),!1):(this.#Qt.value=!0,this.#Zt.document.write(function(e,t){return`\n\n \n ${t}\n \n \n \n
\n
\n \n
\n
\n \n`;var s}(s,r)),Mc({success:!0,observability:this.#Et}),n&&this.#Et.counter({name:"offsite_payment_popup_flow_appeared",value:1,attributes:{payment_method_name:"Crypto: USDC",is_mobile:Fs(this.#ze)}}),this.#es=setInterval(()=>{this.#Zt?.closed&&this.close({runCancelCallback:!0})},500),window.addEventListener("message",this.messageHandler),window.addEventListener("unload",this.unloadHandler),!0)}close({runCancelCallback:e=!1}){if(!this.isOpen.value||!this.#Zt)throw new wc("Popup not opened yet");this.#es&&clearInterval(this.#es),this.#Zt.close(),this.#Qt.value=!1,e&&this.#ts&&this.#ts(),this.#is&&e&&this.#Zt&&this.#Et.counter({name:"offsite_payment_popup_flow_cancelled",value:1,attributes:{payment_method_name:"Crypto: USDC",reason:"cancelled",is_mobile:Fs(this.#ze)}}),this.#is=!1}redirect(e){if(!this.isOpen.value||!this.#Zt)throw new wc("Popup not opened yet");this.#Zt.location.assign(e)}focus(){if(!this.isOpen.value||!this.#Zt)throw new wc("Popup not opened yet");this.#Zt.focus()}unloadHandler(){window.removeEventListener("unload",this.unloadHandler),this.isOpen.value&&this.close({runCancelCallback:!0})}messageHandler(e){if(e.origin===window.location.origin&&"OFFSITE_RETURN"===e.data.type&&e.data.redirectUrl){window.removeEventListener("message",this.messageHandler);const t="true"===new URL(e.data.redirectUrl).searchParams.get("completed");this.#is&&this.isOpen.value&&this.#Zt&&(t?this.#Et.counter({name:"offsite_payment_popup_flow_closed_successfully",value:1,attributes:{payment_method_name:"Crypto: USDC",is_mobile:Fs(this.#ze)}}):this.#Et.counter({name:"offsite_payment_popup_flow_cancelled",value:1,attributes:{payment_method_name:"Crypto: USDC",reason:"incomplete_flow",is_mobile:Fs(this.#ze)}})),this.close({runCancelCallback:!t}),t&&this.#ss?.()}}}function Mc({success:e,observability:t}){t.counter({name:"buyer_experience_offsite_popup_open_count",value:1,attributes:{success:e}})}function Ic({negotiatedFields:e,captureAtFulfillmentEnabled:t}){const s=function(e,t){return p(()=>{const s=Boolean(t.remoteMerchandiseDetails?.value?.stableIdToShopId.size),i=t.remoteConsolidatedTotals?.value;return s&&i?i[e]??t[e].value:t[e].value})}("runningTotal",e),i=function(e){return p(()=>Boolean(e.remoteMerchandiseDetails?.value?.stableIdToShopId.size)&&e.remotePaymentDue?.value?e.remotePaymentDue.value:e.paymentDue.value)}(e),n=p(()=>function({runningTotal:e,merchandiseLines:t,deferredTotal:s}){if(!(e&&e.amount<=0))return!0;const i=Ns(t?.lines).some(e=>Boolean(e.sellingPlan?.subscriptionDetails)),n=s?.amount.amount;return Boolean(i||n)}({runningTotal:s.value,merchandiseLines:e.merchandiseLines.value,deferredTotal:e.deferredTotal.value})),r=p(()=>function({isPaymentRequired:e,paymentDue:t,paymentLines:s,merchandiseLines:i,runningTotal:n,deferredTotal:r,checkoutTotal:a,paymentFlexibilityPaymentTermsTemplate:o,checkoutCompletionTarget:d,buyerIdentity:l,captureAtFulfillmentEnabled:u}){if(!e)return"freeOrder";const c=Ns(i?.lines).some(e=>e.sellingPlan);if(function({paymentDue:e,paymentLines:t,hasSellingPlan:s}){if(!e||e.amount>0)return!1;if(s)return!1;const i=t?.lines.filter(e=>e.cost?.amount&&e.cost.amount>0);return Boolean(i?.every(e=>"giftCard"===e.method.type))}({paymentDue:t,paymentLines:s,hasSellingPlan:c}))return"giftCard";if(function({paymentDue:e,paymentLines:t,hasSellingPlan:s,redemptionSource:i}){if(!e||e.amount>0)return!1;if(s)return!1;const n=t?.lines.filter(e=>e.cost?.amount&&e.cost.amount>0);return Boolean(n?.every(e=>"redeemable"===e.method.type&&e.method.redemptionSource===i))}({paymentDue:t,paymentLines:s,hasSellingPlan:c,redemptionSource:"STORE_CREDIT"}))return"storeCredit";if(function({paymentDue:e,paymentLines:t,runningTotal:s,hasSellingPlan:i,redemptionSources:n}){const r=t?.lines.filter(e=>"redeemable"===e.method.type&&n.includes(e.method.redemptionSource)||"giftCard"===e.method.type).reduce((e,t)=>e+(t.cost?.amount||0),0);return Boolean(e&&e.amount<=0&&!i&&s&&r===s.amount)}({paymentDue:t,paymentLines:s,runningTotal:n,hasSellingPlan:c,redemptionSources:["CUSTOM","STORE_CREDIT"]}))return"redeemables";const h=function({paymentFlexibilityPaymentTermsTemplate:e,deferredTotal:t,checkoutTotal:s,checkoutCompletionTarget:i,buyerIdentity:n,captureAtFulfillmentEnabled:r}){const a="DRAFT_ORDER"===i;return!(Us({deferredTotal:t,checkoutTotal:s,paymentFlexibilityPaymentTermsTemplate:e,isCheckoutToDraft:a})||"FULFILLMENT"===e?.type&&!0===r&&!n?.purchasingCompany)&&(Boolean(e)||a)}({paymentFlexibilityPaymentTermsTemplate:o,deferredTotal:r,checkoutTotal:a,checkoutCompletionTarget:d,buyerIdentity:l,captureAtFulfillmentEnabled:u});return h&&!r?.amount.amount?"deferred":null}({isPaymentRequired:n.value,paymentDue:i.value,paymentLines:e.paymentLines.value,merchandiseLines:e.merchandiseLines.value,runningTotal:s.value,deferredTotal:e.deferredTotal.value,checkoutTotal:e.checkoutTotal.value,paymentFlexibilityPaymentTermsTemplate:e.paymentFlexibilityPaymentTermsTemplate.value,checkoutCompletionTarget:e.checkoutCompletionTarget.value,buyerIdentity:e.buyerIdentity.value,captureAtFulfillmentEnabled:t}));return{isPaymentRequired:n,paymentExemptionReason:r}}function Dc(e){return`${e.paymentMethod}:${e.id}`}class Rc{constructor(){this.#ns=g([]),this.promoted=this.#ns}#ns;promote(e){const t=Dc(e);this.#ns.value.some(e=>Dc(e)===t)||(this.#ns.value=[...this.#ns.value,e])}}function xc(e,t={}){if("FilledBuyerIdentityTerms"!==e.__typename)return;return function(e){if(null!=e&&"email"in e)return e.email}(e.customer)||(e.email?e.email:Oc(t))}function Lc(e,t={}){if("FilledBuyerIdentityTerms"===e.__typename)return e.phone?e.phone:Oc(t)}function Oc(e){return"emptyContactFallback"in e?e.emptyContactFallback:""}function Bc(e,t){if(!t)return e;const s=ge(t);return{...Vs(e),...Vs(s)}}function Fc(e){return Boolean(e&&Object.keys(e).length>0)}function Nc(e,t){if(!e||"AllocatedAlternativePaymentCurrencyTotal"!==e.__typename||!t?.lines)return;const s=t.lines.flatMap(e=>"giftCard"===e.method.type?[e.stableId]:[]),i=e.paymentLineAllocations.reduce((e,t)=>s.includes(t.stableId)?e:e+parseFloat(t.amount.amount),0);return{total:ns(e.total),totalWithoutGiftCards:ns({amount:i.toString(),currencyCode:e.total.currencyCode,__typename:"Money"})}}function Uc(e){if(e&&"PendingTerms"!==e.__typename)return e.availableRedeemables.reduce((e,t)=>{const{balance:s,paymentMethod:i}=t;return"RedeemablePaymentMethod"===i.__typename&&e.push({paymentMethod:Hs(i),balance:ns(s)}),e},[])}function qc(e){return e?e.map(e=>({key:e.activation.key,label:g(e.activation.label),heading:g(e.activation.heading??null),description:g(e.activation.description??null),type:e.activation.type,position:e.activation.position,required:g(e.activation.required),requiredErrorMessage:g(e.activation.requiredErrorMessage??null),target:{target:e.activation.target.target,placementReference:e.activation.target.placementReference},choices:e.activation.validations.choices?.map(({label:e,value:t})=>({label:e,value:t}))??null,validations:{minLength:e.activation.validations.minLength??null,maxLength:e.activation.validations.maxLength??null,minDate:e.activation.validations.minDate??null,maxDate:e.activation.validations.maxDate??null}})):[]}function Vc({deliveryExpectations:e}){switch(e?.__typename){case void 0:case"PendingTerms":return;case"UnavailableTerms":return{status:"unavailable",deliveryExpectationLines:null};case"FilledDeliveryExpectationTerms":return{status:"filled",deliveryExpectationLines:e.deliveryExpectations}}}function zc(e){const t=e?.attributions.find(e=>"DraftOrderAttributions"===e.__typename);if(t)return{draftOrder:{userId:t.userIdentifier,locationId:t.locationIdentifier,sourceName:t.sourceName}}}function Hc(e){if(null==e||"UnavailableTerms"===e.__typename||"PendingTerms"===e.__typename)return{status:"unavailable",reason:""};if("FilledDutyTerms"===e.__typename&&e.totalDutyAmount){const{amount:t,currencyCode:s}=ns(e.totalDutyAmount);return{status:"available_total",totalDuty:{amount:t+(e.totalAdditionalFeesAmount?ns(e.totalAdditionalFeesAmount).amount:0),currencyCode:s}}}return{status:"unavailable",reason:""}}const jc={returnFees:{aggregatedReturnShippingFees:void 0,aggregatedRestockingFees:void 0},billingAddress:void 0,contactMethod:void 0,delivery:void 0,merchandiseLines:void 0,orderDiscounts:void 0,orderNumber:void 0,previouslyPaidTotal:void 0,requiresShipping:void 0,taxesIncluded:void 0,dutiesIncluded:void 0,tax:void 0,taxBreakdown:void 0,taxRecalculation:void 0,duty:void 0,landedCostDetails:void 0,tip:void 0,updatedTotal:void 0,waivedTotal:void 0};function Wc(e){switch(e.__typename){case"FilledMembershipTerms":return{status:"filled",memberships:e.memberships.map(e=>({apply:e.apply,handle:e.handle}))};case"PendingTerms":return{status:"pending"};case"UnavailableTerms":return{status:"unavailable"}}}function $c(e,t){const s=e??[],i=t??[];return s.length!==i.length||s.some((e,t)=>{const s=i[t];return null==s||js(e)!==js(s)})}function Gc(e){return{signature:e.signature,contents:e.contents.map(e=>({signature:e.signature,targetTerms:e.targetTerms,targetLine:void 0===e.targetLine||null===e.targetLine?void 0:{allLines:e.targetLine.allLines,index:e.targetLine.index},attributes:e.attributes}))}}function Yc(e){if(e.message&&"Note"===e.__typename)return e.message}function Jc(e){return"Note"!==e.__typename?[]:e.customAttributes?.map(({__typename:e,...t})=>t)}class Kc{#rs;constructor(e){this.#rs=e}matches(e){return!(void 0===this.#rs||!pe(e,this.#rs)&&(this.#rs=void 0,1))}}const Xc={CheckpointDenied:"NegotiateFromSession.CheckpointDenied",NegotiationResultAvailable:"NegotiateFromSession.Unknown",NegotiationResultFailed:"NegotiateFromSession.NegotiationResultFailed",SubmittedForCompletion:"NegotiateFromSession.SubmittedForCompletion",Throttled:"NegotiateFromSession.Throttled",TooManyRequests:"NegotiateFromSession.Unknown"};function Qc(e){if(e?.attributions&&0!==e?.attributions.length){const t=[];return e?.attributions.forEach(e=>{let s;var i;"Location"===e.recipient.__typename?s={location:{id:e.recipient.id}}:"StaffMember"===e.recipient.__typename?s={staffMember:{id:e.recipient.id}}:"PointOfSaleDevice"===e.recipient.__typename&&(s={pointOfSaleDevice:{id:e.recipient.id}}),s&&t.push({recipient:s,targetMerchandiseLines:(i=e.targetMerchandiseLines,"FilledMerchandiseLineTargetCollection"===i.__typename?{lines:i.linesV2.reduce((e,t)=>"MerchandiseLine"!==t.__typename&&"MerchandiseBundleLineComponent"!==t.__typename?e:[...e,{stableId:t.stableId}],[])}:"AnyMerchandiseLineTargetCollection"===i.__typename?{any:i.any}:{})})}),{attributions:t}}}function Zc(e){const{__typename:t,...s}=e;return s}function eh(e){if(e)switch(e.__typename){case"PendingTerms":return{status:"pending",taskId:e.taskId??void 0,pollDelay:e.pollDelay??void 0};case"FilledShopCashBalance":return{status:"filled",availableBalance:ns(e.availableBalance),eligible:e.eligible,nonEligibleReason:e.nonEligibleReason,redeemableBalance:e.redeemableBalance?ns(e.redeemableBalance):void 0};case"UnavailableTerms":return{status:"unavailable"};default:return}}function th(e){if(e)switch(e.__typename){case"PendingTerms":return{status:"pending",taskId:e.taskId??void 0,pollDelay:e.pollDelay??void 0};case"FilledShopDiscountOffer":return{status:"filled",discountOffer:{adType:e.discountOffer?.adType??null,campaignHandle:e.discountOffer?.campaignHandle??null,offerAmount:e.discountOffer?.offerAmount?ns(e.discountOffer.offerAmount):ns({amount:"0",currencyCode:"USD",__typename:"Money"}),minimumOrderValue:e.discountOffer?.minimumOrderValue?ns(e.discountOffer?.minimumOrderValue):null,minimumOrderValueRemainder:e.discountOffer?.minimumOrderValueRemainder?ns(e.discountOffer?.minimumOrderValueRemainder):null,minimumOrderValueSatisfied:e.discountOffer?.minimumOrderValueSatisfied??!1}};case"UnavailableTerms":return{status:"unavailable"};default:return}}function sh(e){if(e)switch(e.__typename){case"PendingTerms":return{status:"pending",taskId:e.taskId??void 0,pollDelay:e.pollDelay??void 0};case"FilledShopPromotion":return{status:"filled",promotions:e.promotions.map(e=>({promotionId:e.promotionId,availableBalance:ns(e.availableBalance),redeemableBalance:e.redeemableBalance?ns(e.redeemableBalance):null,type:e.type}))??[]};case"UnavailableTerms":return{status:"unavailable"};default:return}}function ih(e){return e&&"TipWrapper"===e.__typename?e.tipSuggestions.map(e=>({percentage:e.percentage,amount:ns(e.amount)})):[]}function nh(e){return e&&"TipWrapper"===e.__typename&&e.terms&&"FilledTipTerms"===e.terms.__typename?e.terms.tipLines.map(rh).filter(e=>Boolean(e)):[]}function rh(e){return"TipLine"===e.__typename?{amount:ns(e.amount)}:void 0}function ah(e){return e?.map(({amount:e})=>({amount:{value:{amount:e.amount.toString(),currencyCode:e.currencyCode}}}))??[]}function oh(e){return e?.paymentHandlers.map(e=>({id:e.id,name:e.name,version:e.version,spec:e.spec,schema:e.schema,config:"object"==typeof e.config?e.config:void 0}))}class dh{#as;constructor({negotiateFromSessionData:e,router:t,shop:s,observability:n,source:r,persistence:a,isOnePageCheckout:o,isShopPayActive:d,checkoutContextData:l,requestInfoData:u,extendedAddressMode:c,receipt:h}){const m=zl(l?.appConfiguration?.allowedDelegations??[],ql),y=ye(r),v="draftOrder"===r?.type,b="abandonedCart"===(r?.type??void 0),S=u.shop?.defaultShippingDetails?.country?{country:u.shop.defaultShippingDetails.country,zone:{code:u.shop.defaultShippingDetails.zone?.code}}:{country:s.country,zone:{code:void 0}},A=e?.session?.negotiate?.result,_=Ws(Ds(e??void 0),"NegotiationResultAvailable"===A?.__typename?A.sellerProposal:void 0,"NegotiationResultAvailable"===A?.__typename?A.buyerProposal:void 0),P=$s(e??void 0),C=Ws(P,"NegotiationResultAvailable"===A?.__typename?A.sellerProposal:void 0,"NegotiationResultAvailable"===A?.__typename?A.buyerProposal:void 0),k="NegotiationResultAvailable"===A?.__typename,E="Throttled"===A?.__typename,w=k||E?Yc(A?.buyerProposal?.note):void 0,T="NegotiationResultAvailable"===A?.__typename?A.sellerProposal:void 0,{availableDeliveryAddresses:M,availableRedeemables:I,buyerIdentity:D,canUpdateDeliveryAddress:R,canUpdateDiscountCodes:x,canUpdateMerchandise:L,captcha:O,checkoutTotal:B,checkoutTotalBeforeTaxesAndShipping:F,checkoutTotalTaxes:N,deferredTotal:U,delivery:q,deliveryExpectations:V,deliveryMethods:z,dutiesIncluded:H,duty:j,hasOnlyDeferredShipping:W,landedCostDetails:$,legacyAggregatedMerchandiseTermsAsFees:G,legacyRepresentProductsAsFees:Y,legacySubtotalBeforeTaxesShippingAndFees:J,managedByMarketsPro:K,managedMarketsPaymentProcessor:X,merchandise:Q,mustSelectProvidedAddress:Z,mustSelectProvidedShippingRate:ee,note:te,payment:se,poNumber:ie,recurringTotals:ne,remote:re,runningTotal:ae,shopCashBalance:oe,shopDiscountOffer:de,shopPayEnabled:le,shopPromotion:ue,subtotalAfterMerchandiseDiscounts:ce,subtotalBeforeReductions:he,subtotalBeforeTaxesAndShipping:me,tax:ve,taxExemptions:fe,tip:be,total:Se,totalSavings:Ae}=T??{},_e=Ia(D),{remoteMerchandise:{remoteBuyerMerchandiseLines:Pe,remoteSellerMerchandiseLines:Ce,stableIdToShopId:ke},remoteDelivery:Ee,remotePayment:we}=Fe("NegotiationResultAvailable"===A?.__typename?A.sellerProposal.remote:void 0),Te=function(e,{includeDeliveryGroups:t=!1}={}){if(!e?.session?.context.policies)return jc;const{context:s,sessionType:i}=e.session,{policies:n,session:r}=s;let a={};n.payment.forEach(e=>{"PreviousPaymentsFact"===e.__typename&&(a={previouslyPaidTotal:e.previouslyPaidTotal,updatedTotal:e.updatedTotal,waivedTotal:e.waivedTotal??void 0,billingAddress:e.billingAddress?ge(e.billingAddress):void 0})});let o={};n.fees.forEach(e=>{"PreviousFeesFact"===e.__typename&&(o={returnFees:e.returnFees})});let d={};n.buyerIdentity.forEach(e=>{"PreviousBuyerIdentityFact"===e.__typename&&(d={contactMethod:e.contactMethod})});let l={};n.merchandise.forEach(e=>{var t;"PreviousMerchandiseFact"===e.__typename&&(l={merchandiseLines:(t=e.lines,t.map(({appliedDiscounts:e,price:t,priceAfterDiscounts:s,properties:i,quantity:n,title:r,image:a,quantityChange:o,variantTitle:d,sku:l,parent:u,stableId:c})=>({stableId:c,appliedDiscounts:e.map(({label:e,amountDiscounted:t})=>({title:e,amountDiscounted:ns(t),presentationLevel:"LINE"})),price:ns(t),priceAfterDiscounts:ns(s),properties:us(i),quantity:n,title:r,image:a&&{url:a.url,one:a.one,two:a.two,four:a.four,altText:a.altText},quantityChange:o,variantTitle:d,sku:l,parentTitle:u?.title})))})});let u={};n.tip.forEach(e=>{"PreviousTipFact"===e.__typename&&(u={tip:ns(e.total)})});let c={};n.tax.forEach(e=>{"PreviousTaxFact"===e.__typename&&(c={...c,tax:ns(e.total),taxBreakdown:e.taxBreakdown?.length?e.taxBreakdown.map(e=>({title:e.title,amount:ns(e.amount)})):void 0}),"PreviousTaxRecalculationFact"===e.__typename&&(c={...c,taxRecalculation:{beforeLines:e.beforeLines.map(e=>({title:e.title,rate:e.rate})),afterLines:e.afterLines.map(e=>({title:e.title,rate:e.rate}))}})});let h={};n.duty.forEach(e=>{"PreviousDutyFact"===e.__typename&&(h={duty:ns(e.total)})});let p={};n.landedCostDetails.forEach(e=>{"PreviousLandedCostDetailsFact"===e.__typename&&(p=e.incotermInformation?{landedCostDetails:{incoterm:e.incotermInformation.incoterm,reason:e.incotermInformation.reason}}:{landedCostDetails:void 0})});const g={delivery:n.delivery.flatMap(e=>"PreviousDeliveryFact"===e.__typename?[Vu(e,{includeDeliveryGroups:"ORDER_EDIT"===i&&t})]:[])};let m={};n.discount.forEach(e=>{"PreviousDiscountFact"===e.__typename&&(m={orderDiscounts:e.orderLevelDiscounts.map(e=>({label:e.label,amount:ns(e.amount)}))})});let y={};return r.forEach(e=>{"PreviousNegotiationFact"===e.__typename&&(y={orderNumber:e.orderNumber,requiresShipping:e.requiresShipping,taxesIncluded:e.taxesIncluded,dutiesIncluded:e.dutiesIncluded})}),{...a,...o,...d,...l,...u,...c,...h,...p,...g,...m,...y}}(e,{includeDeliveryGroups:"orderEdit"===r.type}),Me="NegotiationResultAvailable"===A?.__typename||"Throttled"===A?.__typename?A.buyerProposal:void 0,Ie=Da(te),De=Ra(te),Re=Ma(te),[xe,Le]=Gs(A)?[Ys(Q,Ce),Ys(Me?.merchandise,Pe)]:[Q,Me?.merchandise],Oe=Ee?.isShippingRequired??T?.isShippingRequired??Me?.isShippingRequired,{merchandiseDiscount:Ue,deliveryDiscount:qe}=Js(A),Ve=Me?.delivery,ze=(q&&Be({delivery:q,buyerDelivery:Me?.delivery,remoteDelivery:Ee}))??xa({buyerIdentity:_e,type:"shipping",isShopPayActive:d})??{},He=Ie&&Boolean(ze)&&De,je=sc(xe,Le,_),We=Ss(je.lines),$e=bs(je.lines),Ge=Ks(ae,Me?.runningTotal,_??[],xe),Ye=Ae&&"MoneyValueConstraint"===Ae.__typename?ns(Ae):void 0,Je=he&&"MoneyValueConstraint"===he.__typename?ns(he):void 0,Ke=ce&&"MoneyValueConstraint"===ce.__typename?ns(ce):void 0,Xe=La(se,Ge),Qe=Xs(se),Ze=Qs(se),et=Zs(U??void 0,Qe?.dueDate??void 0),tt=ei(B,Me?.checkoutTotal,_??[],xe),st=Boolean(Us({deferredTotal:et,checkoutTotal:tt,paymentFlexibilityPaymentTermsTemplate:Qe})?.amount),it=ti(se,we.availablePaymentLines),nt=si({availablePayments:it,hasPayableDeposit:st}),rt=ii({hasSellingPlan:We,hasFixedSellingPlan:$e,paymentTermsTemplateType:Qe?.type}),at=ni({payment:se,sortedPaymentMethods:nt,runningTotal:Ge,paymentDue:Xe,deferredTotal:et,checkoutTotal:tt,paymentMethodAutoSelectionDisabled:s.paymentMethodAutoSelectionDisabled,requiresVaulting:We,hasPayableDeposit:st,hasFixedSellingPlan:$e,paymentTermsTemplateType:Qe?.type,preserveAllocatedImmediatePaymentLineAmount:rt,observability:n}),ot=Tu({delivery:q,deliveryMethods:s.shipPickupInOneOrderEnabled?z:void 0,negotiatedMerchandise:xe,buyerDelivery:Me?.delivery,violations:_??[],isPointOfSale:Ie,isPointOfSaleShipToHome:He,observability:n,isAbandonedCartSession:b,remoteDelivery:Ee}),dt=function(e){if("FilledPaymentTerms"===e?.__typename&&"StreetAddress"===e.billingAddress?.__typename)return ge(e.billingAddress)}(se)??function(e){return"CustomerProfile"===e?.customerProfile?.__typename?e?.customerProfile?.billingAddresses[0]?.address:void 0}(_e);let lt;k&&A.sellerProposal.nonNegotiableTerms?lt=Gc(A.sellerProposal.nonNegotiableTerms):"Throttled"===A?.__typename&&A.buyerProposal.nonNegotiableTerms&&(lt=Gc(A.buyerProposal.nonNegotiableTerms));const ut="NegotiationResultAvailable"===A?.__typename&&A.sellerProposal.optionalDuties?Oa(A.sellerProposal.optionalDuties):void 0,ct="NegotiationResultAvailable"===A?.__typename?Ba(A.sellerProposal.attribution):void 0,ht="NegotiationResultAvailable"===A?.__typename?zc(A.sellerProposal.attribution):void 0,pt=void 0===ct&&void 0===ht?void 0:{...ct,...ht},gt="NegotiationResultAvailable"===A?.__typename?Qc(A.sellerProposal.saleAttributions):void 0,mt=Ie&&Re?{code:Re}:void 0,yt=!y&&"CHECKED"===s.emailMarketing,vt=l?.appConfiguration?.features?.isEmailMarketingEnabled??!0,ft="FilledBuyerIdentityTerms"===D?.__typename&&"BusinessCustomerProfile"===D.customer?.__typename,bt=Fa(D),St=Na(D),At=!!vt&&(ft?bt??St??yt:St??bt??yt),_t=k?Wc(A.sellerProposal.memberships):void 0,Pt=ri({sellerProposal:T,buyerProposal:Me,negotiationViolations:_,sellerMerchandise:xe}),Ct={remoteTaxDetails:Wa(re),remoteMerchandiseDetails:{stableIdToShopId:ke,mergedBuyerProposalMerchandise:Le},remoteSessionDetails:Si("NegotiationResultAvailable"===A?.__typename?A.sellerProposal.remote:void 0),remoteConsolidatedTotals:Pt,checkoutCardsinkCallerIdentificationSignature:e?.session?.checkoutCardsinkCallerIdentificationSignature??void 0,remotePaymentDue:La(se,Pt?.runningTotal),remoteTotalDetails:bi({remote:T?.remote,negotiationViolations:_,sellerMerchandise:xe}),additionalMoneyLines:void 0,lpmDisclosure:T?.lpmDisclosure??void 0,cardlessCheckoutEligibilityToken:void 0,billingAddress:dt,shippingAddress:ze,merchandiseLines:je,deliveryNext:ot,pendingDelivery:fi(e),sellability:vi({shop:s,sellerProposal:T,missingSellerProposalReason:(kt=A?.__typename,null==kt?"NegotiateFromSession.Unknown":Xc[kt]),isShippingRequired:Oe,observability:n}),deliveryExpectations:Vc({deliveryExpectations:V}),availableDeliveryAddresses:M?M.map(e=>({address:ge(e),id:e.handle??void 0})):[],mustSelectProvidedAddress:Z??!1,mustSelectProvidedShippingRate:ee??!1,canUpdateDiscountCodes:x??!0,canUpdateDeliveryAddress:R??!0,canUpdateMerchandise:L??!0,note:te?Yc(te):void 0,customAttributes:te?Jc(te):void 0,nonNegotiableTerms:lt,paymentMethodHistory:"FilledPaymentTerms"===se?.__typename?se.paymentMethodHistory:[],paymentLines:at,paymentMethods:nt,availableRedeemables:Uc(I),shopCashBalance:eh(oe),shopPromotion:sh(ue),shopDiscountOffer:th(de),contactInfo:ja(D),buyerIdentity:_e,checkoutCompletionTarget:k?A.sellerProposal.checkoutCompletionTarget:void 0,duties:Hc(j),optionalDuties:ut,dutiesIncluded:H,landedCostDetails:$?.incotermInformation??void 0,taxes:Ha(ve),taxExemptions:dc(fe),subtotal:yi(me,Me?.subtotalBeforeTaxesAndShipping,_??[],xe),subtotalBeforeReductions:Je,subtotalAfterMerchandiseDiscounts:Ke,legacySubtotalBeforeTaxesShippingAndFees:mi(J,Me?.legacySubtotalBeforeTaxesShippingAndFees,_??[],xe),legacyMerchandiseLinesAsFees:gi(G),legacyRepresentProductsAsFees:Y,totalSavings:Ye,runningTotal:Ge,purchaseOrderNumber:k?ie??void 0:void 0,total:"MoneyValueConstraint"===Se?.__typename?ns(Se):void 0,recurringTotals:pi(ne),deferredTotal:et,hasOnlyDeferredShipping:W,checkoutTotal:tt,checkoutTotalBeforeTaxesAndShipping:hi(F,Me?.checkoutTotalBeforeTaxesAndShipping,_??[],xe),checkoutTotalTaxes:ci(N,Me?.checkoutTotalTaxes,_??[],xe),acceptEmailMarketing:At,emailMarketingConsentGrantReached:za(D),acceptSmsMarketing:qa(D)??Va(D)??!1,smsMarketingPhone:Ua(k?A.sellerProposal.buyerIdentity:void 0),allViolations:C,paymentDue:Xe,discountLines:ui({merchandiseDiscount:Ue,deliveryDiscount:qe}),acceptUnexpectedDiscounts:li(Ue),tipOptions:ih(be),tipLines:nh(be),localizationExtensions:T?.localizationExtension?.fields,scriptFingerprint:T?.scriptFingerprint?Zc(T?.scriptFingerprint):void 0,transformerFingerprintV2:T?.transformerFingerprintV2||void 0,attribution:pt,captcha:di(O,P),cartMetafields:Xu(T?.cartMetafields),customFields:s.hasFlagEnabled(oi)?qc(T?.customFields):void 0,shopPayArtifact:void 0,paymentFlexibilityPaymentTermsTemplate:Qe,depositConfiguration:Ze,isImmediateAmountReducedForRedeemables:"FilledPaymentTerms"===se?.__typename&&se.isImmediateAmountReducedForRedeemables,reduction:mt,managedByMarketsPro:K,managedMarketsPaymentProcessor:X,saleAttributions:gt,alternativePaymentCurrency:Nc(T?.alternativePaymentCurrency,at),metafields:[],isShippingRequired:Oe,remotePaymentDetails:we.paymentDetails,memberships:_t,shopPayEnabledForSellerOfRecord:le,ucp:{continueUrl:T?.ucp?.continueUrl??void 0,paymentHandlers:s.hasFlagEnabled(ai)||T?.ucp?.paymentHandlers.length?oh(T?.ucp):void 0,id:e?.session?.ucp?.checkout?.id??("cartNext"===r.type?`gid://shopify/Checkout/${r.sourceId}`:void 0)}};var kt;const Et=Ct.shippingAddress?.countryCode,wt=Ct.shippingAddress?.zoneCode,Tt=Te.billingAddress?.countryCode??Ct.billingAddress?.countryCode??_e?.countryCode??Et??S.country.code??s.popularBillingCountries?.[0]?.value,Mt=Te.billingAddress?.zoneCode??Ct.billingAddress?.zoneCode??wt??S.zone.code,It=function({negotiatedMerchandise:e,negotiatedDeliveryNext:t,enabledDeliveryMethods:s,buyerProposalDelivery:i,mustSelectProvidedShippingRate:n=!1}){const r=Ju(i);return("filled"===t?.status||"partial"===t?.status)&&t.lines.length>0?Wu({negotiatedDeliveryNext:t,enabledDeliveryMethods:s,fallbackToFirstDeliveryMethod:!0,mustSelectProvidedShippingRate:n,buyerDeliveryOptionsMap:r}):Hu({negotiatedDeliveryNext:t,enabledDeliveryMethods:s,buyerProposalDelivery:i,negotiatedMerchandise:e,mustSelectProvidedShippingRate:n})}({negotiatedMerchandise:xe??Le,negotiatedDeliveryNext:Ct?.deliveryNext,enabledDeliveryMethods:Ct.sellability.enabledDeliveryMethods,buyerProposalDelivery:Ve,mustSelectProvidedShippingRate:ee??!1}),Dt="filled"===ot?.status&&ot.deliveryMacros?.length?ot.deliveryMacros:[],xt=v?Ct.shippingAddress:"BusinessCustomerProfile"!==_e.customerProfile?.__typename?function({negotiationResultBuyerDelivery:e,negotiatedShippingAddress:t,customerVaultedShippingAddresses:s}){const i=function(e){const t="FilledDeliveryTerms"===e?.__typename?zs(e):void 0;return"PartialStreetAddress"===t?.destinationAddress?.__typename||"StreetAddress"===t?.destinationAddress?.__typename?ge(t.destinationAddress):void 0}(e)??t;if((void 0===i||Ne(i,["address1","address2","city"]))&&s&&s.length>0){const e=s.filter(e=>e.address.countryCode===i?.countryCode),t=e.find(e=>e.default)??e[0];if(t)return t.address}return i}({negotiationResultBuyerDelivery:"NegotiationResultAvailable"===A?.__typename||"Throttled"===A?.__typename?A?.buyerProposal?.delivery:void 0,negotiatedShippingAddress:Ct.shippingAddress,customerVaultedShippingAddresses:"CustomerProfile"===_e.customerProfile?.__typename?_e.customerProfile.shippingAddresses:void 0}):(_e.customerProfile.checkoutExperienceConfiguration?.editableShippingAddress&&Ct.deliveryNext,Ct.shippingAddress),Lt=function({shippingAddress:e,defaultShippingDetails:t,shop:s,buyerIdentity:i}){const n=s.popularShippingCountries?.[0]?.value,r={city:void 0,address1:void 0,address2:void 0,company:void 0,firstName:void 0,lastName:void 0,name:void 0,phone:void 0,postalCode:void 0,coordinates:void 0,countryCode:t?.country?.code,zoneCode:t?.zone?.code};return Fc(e)?{...r,...e}:i?.countryCode?{...r,countryCode:i.countryCode,zoneCode:t.country.code===i.countryCode?t.zone.code:void 0}:n?{...r,countryCode:n,zoneCode:n===t.country.code?t.zone.code:void 0}:{...r}}({shippingAddress:xt,defaultShippingDetails:S,shop:s,buyerIdentity:Ct.buyerIdentity}),Ot=bc(e?.session?.checkoutPaymentMethods),Bt=Ot?Ja(Ka(Ot)):void 0,Ft=(()=>{const e=Te.billingAddress??Bt??("NegotiationResultAvailable"===A?.__typename&&"FilledPaymentTerms"===A.sellerProposal.payment?.__typename&&A.sellerProposal.payment.billingAddress&&A.sellerProposal.payment.paymentLines.length>0?ge(A.sellerProposal.payment.billingAddress,n):void 0)??Ct.billingAddress;return null==e?.countryCode?Ai(e,Tt,Mt):Ai(e,e?.countryCode??Tt,e?.zoneCode??void 0)})(),Nt=fs({paymentLines:Ct.paymentLines?.lines??[],availablePaymentMethods:Ct.paymentMethods,url:t.currentUrl.value,deferredTotal:et,shouldNotSetInitialState:s.paymentMethodAutoSelectionDisabled,hasPayableDeposit:st,paymentTermsTemplateType:Qe?.type,observability:n}).filter(function(e){return!Ti(t.currentUrl.value.searchParams)||"wallet"!==e.method.type&&"walletsPlatformPaymentMethod"!==e.method.type}),Ut=(()=>{const{purchasingCompany:e}=_e;if(e)return function({isDraftOrderCheckout:e,proposedBillingAddress:t,billingAddressFact:s,companyLocationBillingAddress:i,companyLocationShippingAddress:n}){return s&&!Boolean(i&&pe(s,i))?"billing-fact":e&&t&&qs(t)&&!Boolean(i&&pe(t,i))?"custom":i?.address1?"billing":n?.address1?"shipping":"custom"}({proposedBillingAddress:Ft,isDraftOrderCheckout:v,billingAddressFact:Te.billingAddress,companyLocationBillingAddress:e.location.billingAddress,companyLocationShippingAddress:e.location.shippingAddress});const t=_i({shopRequireMatchingShippingAndBilling:Boolean(s.requireMatchingShippingAndBilling),selectedPaymentMethodType:Nt?.[0]?.method.type,isShippingRequired:Boolean(Oe),isOrderSession:y,isB2B:Boolean(e),isPickupPointDeliveryMethod:It.every(({deliveryMethodTypes:e})=>e.includes("PICKUP_POINT"))});return function({isDigitalGood:e,deliveryMethodTypes:t,proposedBillingAddress:s,proposedShippingAddress:i,sameBillingAndShippingAddress:n,requireMatchingShippingAndBilling:r,isPaymentInstrumentsDelegationEnabled:a,isDelegatedCardInstrument:o=!1}){const d=t.length>0&&(t.every(e=>"PICK_UP"===e)||t.every(e=>"PICKUP_POINT"===e));return e||d||a&&o?"custom":r?"shipping":!qs(s)||i&&pe(i,s)?a?"custom":n?"shipping":"custom":"custom"}({proposedBillingAddress:Ft,proposedShippingAddress:xt,requireMatchingShippingAndBilling:t,sameBillingAndShippingAddress:s.sameBillingAndShippingAddress,deliveryMethodTypes:It.flatMap(({deliveryMethodTypes:e})=>e),isDigitalGood:Ct.merchandiseLines?.lines&&!1===Ct.isShippingRequired,isPaymentInstrumentsDelegationEnabled:m,isDelegatedCardInstrument:null!=Ot&&Xa(Ot)})})(),qt=!!vt&&(Ct.acceptEmailMarketing??yt??!1),Vt=new URLSearchParams(t.currentUrl.value.search),zt="/processing"===t.currentUrl.value.normalizedPath&&"true"===Vt.get("post_purchase")?"success":void 0,Ht=Pi(Nt,[Mi.BuyWithPrime]).length>0,jt="/shoppay_login"===t.currentUrl.value.normalizedPath;let Wt;d?Wt="SHOP_PAY":Ht?Wt="BUY_WITH_PRIME":jt||y||o||(Wt="SHOPIFY");const $t=!jt&&!y&&!o,Gt=function(e){if(void 0===e)return{};const t=e.find(e=>"UnvalidatedParametersFact"===e.__typename);return{email:t?.email??void 0,phone:t?.phone??void 0,shippingAddress:t?.shippingAddress??void 0,billingAddress:t?.billingAddress??void 0}}(e?.session?.context.session),Yt=function(e,t,s,i){const n=Bc(t,i?.shippingAddress),r=Bc(e,i?.billingAddress),a=s?.customerProfile?{}:(o=i)?{email:o?.email??void 0,phone:o?.phone??void 0}:{email:void 0,phone:void 0};var o;return{shippingAddress:n,billingAddress:r,email:a.email,phone:a.email?void 0:a.phone}}(Ft,Lt,_e,Gt),Jt=Fc(xt)||Gt?.shippingAddress?void 0:Lt,{locationCountryCode:Kt,locationZoneCode:Xt}=function({shippingAddressCountryCode:e,shippingAddressZoneCode:t,buyerIdentityCountryCode:s,defaultCountryCode:i,defaultZoneCode:n}){return e?{locationCountryCode:e,locationZoneCode:t}:s?{locationCountryCode:s,locationZoneCode:void 0}:{locationCountryCode:i,locationZoneCode:n}}({shippingAddressCountryCode:Et,shippingAddressZoneCode:wt,buyerIdentityCountryCode:_e?.countryCode,defaultCountryCode:S.country.code,defaultZoneCode:S.zone.code}),Qt=void 0===Yt.email?"":void 0,Zt=void 0===Yt.phone?"":void 0,es=Me?.buyerIdentity?{email:xc(Me.buyerIdentity,{emptyContactFallback:Qt}),phone:Lc(Me.buyerIdentity,{emptyContactFallback:Zt})}:void 0,ts=_e.customerProfile?.email||void 0,ss="Throttled"===A?.__typename?function(e){const t=e?.buyerIdentity;if("FilledBuyerIdentityTerms"===t?.__typename)return t.rememberMe}(Me):void 0,is=Ls(r),rs=a?.get(Rt.PostPurchaseInquiryStatus,{scope:is}),as="done"===rs?"done":zt??rs??"disabled",os={attributes:Ct.customAttributes,attribution:Ct.attribution,discountLines:Ct.discountLines?.lines??[],memberships:_t,legacyRepresentProductsAsFees:Ct.legacyRepresentProductsAsFees,taxExemptions:hc({negotiated:dc(T?.taxExemptions)}),email:ts??es?.email??Yt.email??_e.customerProfile?.email??Ct.contactInfo?.email??(D&&"email"in D?D.email:void 0)??"",phone:es?.phone??Yt.phone??Ct.contactInfo?.phone??(D&&"phone"in D?D.phone:void 0)??"",merchandiseLines:tc({proposedMerchandise:ec(Le,[]),negotiatedMerchandiseLines:Ct.merchandiseLines}),tipLines:Ct?.tipLines,paymentLines:Nt,useStoreCreditForSubscriptionRenewals:!1,availableRedeemables:Ct.availableRedeemables,remotePaymentDetails:we.paymentDetails,acceptEmailMarketing:qt,acceptSmsMarketing:Ct.acceptSmsMarketing??!1,smsMarketingPhone:Ct.smsMarketingPhone??"",acceptPaymentVaulting:!1,localizationExtensions:Ct.localizationExtensions??[],shippingAddress:Yt.shippingAddress??Lt,billingAddress:Yt.billingAddress??Ft,locationAddress:Ci(Ve)??Ai({},Kt,Xt),billingAddressOption:Ut,note:w,cartMetafields:Ku(k?A?.buyerProposal?.cartMetafields:null),postPurchaseInquiryStatus:as,shopPayArtifact:a?.get(Rt.ShopPayArtifact,{scope:is}),deliveryLines:It,deliveryMacros:Dt,externalDeliveryIds:a?.get(Rt.ExternalDeliveryIds,{scope:is}),purchaseOrderNumber:Ct.purchaseOrderNumber??"",optionalDuties:Ct.optionalDuties,captcha:Ct.captcha,reduction:Ct.reduction,saleAttributions:Ct.saleAttributions,rememberMe:ss??Boolean(Ct.buyerIdentity?.rememberMe),shopPayRememberMeVisible:!1,setShippingAddressAsDefault:void 0};Ht&&(Ct.customAttributes=ki(Ct.customAttributes??[]));const ds=k||E?Jc(A?.buyerProposal?.note):void 0,ls=Ht?ki(ds??[]):ds;this.proposed={email:g(os.email??""),phone:g(os.phone??""),acceptEmailMarketing:g(os.acceptEmailMarketing),acceptSmsMarketing:g(os.acceptSmsMarketing),smsMarketingPhone:g(os.smsMarketingPhone),acceptPaymentVaulting:g(os.acceptPaymentVaulting),deliveryLines:wi(os.deliveryLines),deliveryMacros:g(os.deliveryMacros),externalDeliveryIds:g(os.externalDeliveryIds),purchaseOrderNumber:g(os.purchaseOrderNumber),useProgressiveRates:g($t),interfaceFlow:g(Wt),billingAddress:Ei(os.billingAddress,{extendedAddressMode:c}),locationAddress:Ei(os.locationAddress,{extendedAddressMode:c}),shippingAddress:Ei(os.shippingAddress,{extendedAddressMode:c}),billingAddressOption:g(os.billingAddressOption),discountLines:i(os.discountLines,(e,t)=>e.length!==t.length,["money-lines"]),legacyRepresentProductsAsFees:g(os.legacyRepresentProductsAsFees),remotePaymentDetails:g(os.remotePaymentDetails),paymentLines:i(os.paymentLines,(e,t)=>e.some(({method:e})=>"giftCard"===e.type)!==t.some(({method:e})=>"giftCard"===e.type),["money-lines"]),useStoreCreditForSubscriptionRenewals:g(os.useStoreCreditForSubscriptionRenewals),availableRedeemables:g(os.availableRedeemables),merchandiseLines:g(os.merchandiseLines),note:g(os.note),attributes:g(ls),cartMetafields:g(os.cartMetafields),generalPaymentError:g(void 0),generalPaymentErrorCode:g(void 0),directPaymentErrors:{paymentMethodIdentifier:g(void 0),general:g(void 0),name:g(void 0),number:g(void 0),expiry:g(void 0),issueDate:g(void 0),issueNumber:g(void 0),verificationValue:g(void 0)},postPurchaseInquiryStatus:g(os.postPurchaseInquiryStatus),tipLines:g(os.tipLines),localizationExtensions:mc(os.localizationExtensions),shopPayArtifact:g(os.shopPayArtifact),shopPayRememberMeVisible:g(os.shopPayRememberMeVisible),memberships:g(os.memberships),optionalDuties:g(os.optionalDuties),attribution:g(os.attribution),captcha:g(os.captcha),reduction:g(os.reduction),saleAttributions:g(os.saleAttributions),rememberMe:g(os.rememberMe),setShippingAddressAsDefault:g(os.setShippingAddressAsDefault),taxExemptions:g(os.taxExemptions)},this.negotiated=function(e){const t=Ms(e);t.discountLines=i(e.discountLines,(e,t)=>e?.lines.length!==t?.lines.length,["money-lines"]),t.paymentLines=i(e.paymentLines,(e,t)=>(e?.lines.some(({method:e})=>"giftCard"===e.type)??!1)!==(t?.lines.some(({method:e})=>"giftCard"===e.type)??!1),["money-lines"]),t.tipLines=i(e.tipLines,(e,t)=>e?.length!==t?.length,["money-lines"]),t.legacyMerchandiseLinesAsFees=i(e.legacyMerchandiseLinesAsFees,(e,t)=>e?.lines.length!==t?.lines.length,["money-lines"]),t.paymentMethods=i(e.paymentMethods,$c,["payment-selector-change"]);const s=p(()=>Object.entries(t).reduce((e,[t,s])=>(e[t]=s.value,e),{}));return new vs(s,e=>{f(()=>{for(const[s,i]of Object.entries(e)){const e=t[s];e&&(e.value=i)}})},t)}(function(e,t){if("processed"!==t?.status)return e;const s=Pc(t,{isShippingRequired:e.isShippingRequired,ucp:e.ucp}),i={...e};for(const n of Object.keys(i))i[n]=s[n];return i}(Ct,h)),this.facts=Te,this.#as=new Kc(Jt)}isUntouchedPrefilledShippingAddress(e){return this.#as.matches(e)}}class lh{constructor({url:e,shop:t,source:s,shopPayIsActive:i,receipt:n,observability:r}){this.setRememberMeCookies=async()=>{const{checkoutSessionIdentifier:e}=this.#V;if(e){this.#os.value="loading";try{const t=await fetch(this.#ds.shopPayRememberMeUrl(e),{method:"POST",headers:{"Content-Type":"application/json",accept:"application/json",authorization:`Basic ${this.#z.checkoutPublicAccessToken}`,"X-Shopify-Checkout-Version":"2025-03-18"}});if(!t.ok)return this.#Et.log("remember_me_shop_pay_cookies_failed","Failed to set Shop Pay remember me cookies",{status:t.status,statusText:t.statusText}),void(this.#ls.value={data:null,error:{message:t.statusText}});const s=t.headers.get("content-type");if(s&&s.includes("application/json")){const{message:e}=await t.json();return void(this.#ls.value={data:e,error:null})}this.#Et.log("remember_me_unexpected_content_type_received","Unexpected content type for Shop Pay remember me cookies response",{contentType:s}),this.#ls.value={data:null,error:null}}catch(t){const e=t instanceof Error?t.message:String(t);this.#Et.log("remember_me_error_occurred","An error occurred while setting Shop Pay remember me cookies",{errorMessage:e}),this.#ls.value={data:null,error:{message:e}}}finally{this.#os.value="complete"}}},this.#os=g(null),this.status=this.#os,this.#ls=g(null),this.response=this.#ls,this.#us=p(()=>Boolean(!i&&n&&function(e){return"processed"===e?.status}(n)&&!n.redirectUrl&&n.shopAppLinksAndResources?.shopPayOrder)),this.shouldSetRememberMeCookies=this.#us,this.#ds=e,this.#z=t,this.#V=s,this.#Et=r}#os;#ls;#us;#ds;#z;#V;#Et}class uh{#cs;constructor({token:e}){this.#cs=g(e),this.token=this.#cs}update(e){if(e===this.#cs.value)return;if(this.#cs.value=e,"undefined"==typeof window)return;const t=new URL(window.location.href);e?t.searchParams.set("rctx",e):t.searchParams.delete("rctx"),history.replaceState(null,"",t.href)}}class ch{#hs;#ps;constructor(e){this.#ps=e,this.#hs=g(void 0),this.availableToRender=p(()=>{const e=this.#hs.value;if(!e)return[];const t=e.isSplitShipAndPickup?Ii:Di;return(t[this.#ps.identity.current.value]??t.default).filter(t=>Ri[t].shouldRender({preactContext:e,concepts:this.#ps}))}),this.availableToRenderGrouped=p(()=>{const e=this.#hs.value;if(!e)return[];const t=xi(this.availableToRender.value,{preactContext:e,concepts:this.#ps});return Li(t)})}unstable_providePreactContext(e){const t=this.#hs.peek();ot(t,e)||(this.#hs.value=e)}}const hh={provinceCode:"zoneCode",zip:"postalCode"},ph=/^addressLineComponents\.(streetName|streetNumber|additionalInformation|district|subdistrict)$/;function gh(e){if(!e)return;let t;if(e.startsWith(Bi)?t="delivery":e.startsWith(Fi)&&(t="billing"),!t)return;const s="delivery"===t?Bi:Fi,i=e.slice(s.length);if(""===i)return{addressType:t};if(!i.startsWith("."))return;const n=i.slice(1),r=n.match(ph)?.[1],a="additionalInformation"===r?"line2":hh[r??n]??r??n;return $e(a)?{addressType:t,field:a}:{addressType:t}}function mh(e){return Object.entries(Oi).find(([,t])=>t.includes(e))?.[0]}function yh({addressLine:e,renderedFields:t}){return t.includes(e)||t.some(t=>Oi[e].includes(t))}class vh{#gs=new Map;constructor(e){const t=p(()=>e.loading.value.has("allViolations")?[]:e.current.fields.allViolations.value?e.current.fields.allViolations.value.filter(e=>"UnprocessableTermViolation"===e.__typename&&qi.has(e.code)).map(e=>({message:e.localizedMessage||e.nonLocalizedMessage,target:e.target})):[]);this.errors=p(()=>{const s=[...e.validationErrors.value,...t.value].filter(Vi()),i=s.filter(({target:e})=>e?.startsWith(Bi)&&Boolean(e.replace(`${Bi}.`,""))),n=s.filter(({target:e})=>e?.startsWith(zi)&&Boolean(e.replace(`${zi}.`,""))),r=s.filter(({target:e})=>e?.startsWith(Hi)&&Boolean(e.replace(`${Hi}.`,""))),a=s.filter(({target:e})=>e?.startsWith(ji)&&Boolean(e.replace(`${ji}.`,""))),o=s.filter(({target:e})=>e?.startsWith(Fi)&&Boolean(e.replace(`${Fi}.`,""))),d=s.filter(({target:e})=>e===Wi),l=s.filter(e=>![...n,...i,...r,...a,...o,...d].includes(e));return{contactErrors:n,deliveryAddressErrors:i,paymentErrors:r,localizedFieldErrors:a,billingAddressErrors:o,poNumberErrors:d,globalErrors:l}}),this.billingAddressErrors=ce(),this.poNumberError=g(void 0),this.contactErrors={phoneInputError:g(void 0),emailInputError:g(void 0)},this.missingFields={phone:{isValid:g(!0),error:g(""),input:g("")},firstName:{input:g(""),error:g("")}}}startSynchronization({checkout:e,router:t}){m(()=>{const s=e.negotiator.parts.shippingAddress.fields.countryCode.value,i=e.negotiator.parts.billingAddress.fields.countryCode.value,n=t.currentUrl.value.pathname.endsWith("/throttle");v(()=>{n||(e.address.countryDetails.fetch(s),e.address.countryDetails.fetch(i))})}),m(()=>{const e=this.errors.value.contactErrors;v(()=>{this.#ms(this.contactErrors.phoneInputError,"phone",e.find(({target:e})=>"phone"===e?.split(".").pop())?.message),this.#ms(this.contactErrors.emailInputError,"email",e.find(({target:e})=>"email"===e?.split(".").pop())?.message)})}),this.#ys(e.negotiator.context.deliveryMethodsAddressErrors,()=>this.errors.value.deliveryAddressErrors,()=>this.#vs(e,e.negotiator.parts.shippingAddress.fields.countryCode.value,!1),"delivery",""),this.#ys(this.billingAddressErrors,()=>this.errors.value.billingAddressErrors,()=>this.#vs(e,e.negotiator.parts.billingAddress.fields.countryCode.value,!0),"billing","billing_"),m(()=>{const e=this.errors.value.poNumberErrors[0];v(()=>{this.#ms(this.poNumberError,"poNumber",e?.message)})})}#vs(e,t,s){t&&e.address.countryDetails.isLoading(t);const i=t?e.address.countryDetails.get(t):void 0;return Ni({country:i,editFormat:i?e.address.extendedAddressMode.getFormatFromCountry(i):void 0,addressSettings:s?Ui(e):e.configuration.addressSettings.nonBillingAddressSettings.value})}#ys(e,t,s,i,n){const r=p(t),a=p(()=>function({validationErrors:e,addressType:t,renderedFields:s}){const i=Object.values(Oi).flatMap(e=>s.filter(t=>e.includes(t)).slice(0,1)),n=new Map,r=new Map,a=(e,t,s,i=!1)=>{(r.get(e)??-1)>=s||(r.set(e,s),n.set(e,i?{...t,message:" "}:t))};for(const o of e){const e=gh(o.target);if(!e||e.addressType!==t)continue;const n=o.target?.includes(".addressLineComponents.")??!1,r=e.field;let d=void 0===r,l=r??"address1";if(r&&!s.includes(r)){const e="address1"===r||"address2"===r?r:mh(r);e&&yh({addressLine:e,renderedFields:s})?l=e:(l="address1",d=!0)}const u=void 0!==r&&l!==r,c=!n&&o.target?.split(".").pop()!==l;let h=2;if(d?h=0:c&&(h=1),a(l,o,h),"address1"!==l&&"address2"!==l)continue;const p=!r||n||u?Oi[l].filter(e=>s.includes(e)):Oi[l];for(const t of p)a(t,o,d?0:1,!i.includes(t))}return n}({validationErrors:r.value,addressType:i,renderedFields:s()}));for(const[o,d]of Object.entries(e)){if(!$e(o))continue;const e=p(()=>a.value.get(o)?.message),t=p(()=>a.value.get(o)?.target),s=p(()=>({sourceErrors:r.value,message:e.value,target:t.value}));m(()=>{const e=s.value.message;v(()=>{this.#ms(d,`${n}${o}`,e)})})}}#ms(e,t,s){const i=e.value,n="string"==typeof i&&this.#gs.get(t)===i;void 0===s||i&&!n?void 0===s&&n&&(e.value=void 0,this.#gs.delete(t)):(e.value=s,this.#gs.set(t,s))}}class fh{constructor({checkout:e,client:t,events:s,initialNegotiationData:i,router:n}){const r=new vh(e.negotiator);this.errors=r.errors,this.billingAddressErrors=r.billingAddressErrors,this.poNumberError=r.poNumberError,this.contactErrors=r.contactErrors,this.missingFields=r.missingFields,s.addEventListener("bootloader:hydrate-end",()=>{const s=Ke(t,i)?.session?.negotiate;Xe(t.unstable_getSerialization("receipt"),s)||"CheckpointDenied"===s?.result?.__typename||r.startSynchronization({checkout:e,router:n})},{once:!0})}}function bh(e){return"CustomerProfile"===e?.__typename}function Sh({identity:e,proposal:t,shopPay:s,isEmbeddedPartner:i=!1}){switch(e.current.value){case Ut:return!1;case"amazonPay":case"businessCustomer":case"buyWithPrime":return!0;case"shopPay":return s.user.isAuthenticatedUser.value;case"sdkCartHints":return i||t.proposed.email.value.length>0||t.proposed.phone.value.length>0;case"customerAccount":return function(e){const t=e.negotiated.fields.buyerIdentity.value,s=t?.customerProfile;return!(bh(s)&&!s.email)&&(e.proposed.email.value.length>0||Boolean(bh(s)&&s.email))}(t);default:return t.proposed.email.value.length>0}}class Ah extends Error{constructor(){super("NoopVaultedSections is not implemented"),this.name="NoopVaultedSectionsError"}}class _h{#fs;#bs;#Ss=[];#As;#_s;#Ps;constructor(e){this.#As=e.violationsSubscription,this.#_s=e.walletsViolationsSubscription,this.#Ps=e.walletsLastNegotiationViolationsSubscription,this.#fs=g(!1),this.#bs=g(!1),this.hadWalletsBillingViolations=this.#fs,this.hadAmazonBillingViolations=this.#bs}initialize(){this.dispose(),this.#As.hasViolations&&!Yi(this.#As.violations)&&(this.#bs.value=!0),(this.#_s.hasViolations||this.#Ps.hasViolations)&&(this.#fs.value=!0),this.#Ss.push(m(()=>{this.#bs.value||!this.#As.hasViolations||Yi(this.#As.violations)||(this.#bs.value=!0)})),this.#Ss.push(m(()=>{this.#fs.value||!this.#_s.hasViolations&&!this.#Ps.hasViolations||(this.#fs.value=!0)}))}dispose(){for(const e of this.#Ss)e();this.#Ss=[]}}class Ph{constructor(){this.signal=p(()=>{throw new Ah})}dispose(){}}class Ch{#je;#F;#z;#U;#V;#xe;#Cs;#ks;#Es;#ws;#Ts;#Ms;#Is;#Ds;#Ut;#Rs;#xs;#Ls;constructor(e){var t;this.#je=e.identity,this.#F=e.proposal,this.#z=e.shop,this.#Ut=e.isEmbeddedPartner??!1,this.#U=e.shopPay,this.#V=e.source,this.#xe=e.configuration,this.#Cs=e.addressManager,this.#ks=(t=this.#F,p(()=>{const e=t.negotiated.fields.buyerIdentity.value,s=t.proposed.shippingAddress.value;return{hasEditableShippingAddress:"BusinessCustomerProfile"===e?.customerProfile?.__typename&&!0===e.customerProfile.checkoutExperienceConfiguration?.editableShippingAddress,isValidShippingAddress:null!=s}})),this.#Es=function(e,t){return p(()=>{const s=e.negotiated.fields.paymentMethods.value;return{vaultedCardsAvailable:null!=s&&s.some(e=>e.type===$i.CreditCard),isCheckoutToDraft:"draftOrder"===t.type}})}(this.#F,this.#V),this.#Ls=()=>new Map;const s=e.violationsSubscription??{hasViolations:!1,violations:new Set},i=e.walletsViolationsSubscription??{hasViolations:!1},n=e.walletsLastNegotiationViolationsSubscription??{hasViolations:!1};this.#xs=new _h({violationsSubscription:s,walletsViolationsSubscription:i,walletsLastNegotiationViolationsSubscription:n}),this.#ws=function(e){return p(()=>{const t=e.negotiated.fields.paymentMethods.value;return null!=t&&t.some(e=>e.type===$i.CreditCard||e.type===$i.PayPal)})}(this.#F),this.#Ts=function(e){return p(()=>{const t=e.negotiated.fields.paymentMethods.value;return!!t&&t.some(e=>e.type===$i.CreditCard)})}(this.#F),this.#Ms=function(e){return p(()=>Gi({availablePaymentMethods:e.negotiated.fields.paymentMethods.value??[],paymentMethodHistory:e.negotiated.fields.paymentMethodHistory?.value??[]}))}(this.#F),this.#Is=function(e){return p(()=>{const t=e.negotiated.fields.paymentDue.value;return null!=t&&(t.amount??0)>0})}(this.#F),this.#Rs=ye(this.#V),this.#Ds=function(e){return p(()=>{const t=e.negotiated.fields.availableDeliveryAddresses.value;return t?.map(e=>e.address)??[]})}(this.#F),this.signal=p(()=>({contact:this.#Os(),delivery:this.#Bs(),payment:this.#Fs(),billing:this.#Ns()}))}dispose(){this.#xs.dispose()}initializeViolationTracker(){this.#xs.initialize()}#Os(){return Sh({identity:this.#je,proposal:this.#F,shopPay:this.#U,isEmbeddedPartner:this.#Ut})}#Bs(){switch(this.#je.current.value){case Ut:return this.#Ds.value.length>0;case"customerAccount":{if(this.#Ds.value.length>0)return!0;const e=this.#F.negotiated.fields.buyerIdentity.value,t=e?.customerProfile;if(!bh(t))return!1;const s=this.#F.negotiated.fields.shippingAddress.value,i=this.#F.proposed.shippingAddress.value,n=this.#xe.addressSettings?.nonBillingAddressSettings.value,r=!(function(e){return 0===e.shippingAddresses.length}(t)||function(e,t){const[s]=e.shippingAddresses;return 1===e.shippingAddresses.length&&void 0!==s&&t(s.address,"shipping").size>0}(t,this.#Ls)||n&&function(e,t,s,i){return!(function(e,t,s){return!t&&null!=s&&e.shippingAddresses.length>0}(e,s,i)||!s&&!i||t.selectedAddress.value)}(t,this.#Cs.shipping.value,s,i));return r}case"shopPay":{const e=this.#U.user.addresses.value,t=this.#Ds.value;return e.length>0||t.length>0}case"sdkCartHints":{if(this.#xe.isAddressDelegationEnabled)return!0;const s=this.#F.negotiated.fields.shippingAddress.value;return this.#Os()&&(e=this.#Ls,null!=(t=s)&&0===e(t,"shipping").size)}case"businessCustomer":{const e=this.#ks.value;return!(e.hasEditableShippingAddress&&!e.isValidShippingAddress)}default:return!0}var e,t}#Fs(){switch(this.#je.current.value){case Ut:return!1;case"shopPay":{const e=this.#U.user.paymentMethods.value,t=this.#Is.value,s=this.#F.negotiated.fields.isShippingRequired.value??!1;return t||s?!this.#U.enableCardVaulting||e.some(Xi):this.#U.user.addresses.value.length>0}case"sdkCartHints":return this.#xe.isPaymentInstrumentsDelegationEnabled;case"businessCustomer":{const e=this.#F.negotiated.fields.buyerIdentity.value,t=e?.customerProfile;if(this.#Rs||!Ki(t))return!1;const s=this.#F.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value,i=Boolean(s),n=this.#Ts.value,r=this.#Es.value,a=i||r.isCheckoutToDraft;return!!Ji({identitySource:"businessCustomer",isOrderSession:this.#Rs,storeVaultEnabled:this.#z.storeVaultEnabled,customerProfile:t,hasCustomerStoredPaymentMethod:this.#Ms.value})||n||a&&!r.vaultedCardsAvailable}case"customerAccount":{if(Ji({identitySource:"customerAccount",isOrderSession:this.#Rs,storeVaultEnabled:this.#z.storeVaultEnabled,customerProfile:void 0,hasCustomerStoredPaymentMethod:this.#Ms.value}))return!0;const e=this.#F.negotiated.fields.paymentFlexibilityPaymentTermsTemplate.value,t=Boolean(e),s=this.#F.negotiated.fields.paymentMethods.value,i=1===s?.length&&"deferred"===s[0]?.type;return Boolean(t&&i)}default:return!!this.#ws.value||this.#F.proposed.paymentLines.value.length>0}}#Ns(){switch(this.#je.current.value){case"shopPay":{const e=this.#U.session.selectedPaymentMethod.value,t=!this.#F.negotiated.fields.managedByMarketsPro.value&&"IDEAL"===e?.paymentMethod,s="CUSTOM_ONSITE"===e?.paymentMethod;return!this.#Is.value||t||s}case"amazonPay":case"buyWithPrime":return this.#xs.hadAmazonBillingViolations.value;case"applePay":case"googlePay":return this.#xs.hadWalletsBillingViolations.value;case"payPal":return!0;default:return!1}}}class kh extends Ch{constructor(e){super(e),this.initializeViolationTracker()}}class Eh{constructor({observability:e,events:t,proposal:s,isShopPayActive:i,layout:n,client:r,shop:a}){this.#Us=g(),this.#qs=g(null),this.#Vs=g(null),this.#zs=g(null),this.#Hs=g(!1),this.#js=g(!1),this.#Ws=g(!1),this.isDeceleratingSignal=this.#Hs,this.#Et=e,this.#$s=t,this.activeSession=this.#qs,this.escalatedWallet=this.#zs,this.isAcceleratedWalletEscalation=p(()=>{return"APPLE_PAY"===(e=this.#zs.value)||"GOOGLE_PAY"===e;var e}),this.lastClicked=this.#Vs,this.hasConsumedApplePaySubscriptionReviewParam=this.#js,this.hasActiveApplePaySubscriptionReview=this.#Ws;const o=r.initialRequest.url,d=function({proposal:e,layout:t,shop:s,client:i}){return Qi({isApplePaySubscriptionReviewLayoutSupported:t.isOnePage.peek()||s.hasFlagEnabled(sn),hasSubscriptionReviewQueryParam:i.initialRequest.url.searchParams.has(tn),isABTestActive:s.hasFlagEnabled(en),experiments:i.unstable_getSerialization("experiments"),isCaliforniaBillingOrShippingAddress:Zi(e.proposed.billingAddress.peek(),e.proposed.shippingAddress.peek())})}({proposal:s,layout:n,shop:a,client:r}),l=function({paymentLines:e,paymentMethods:t,url:s,isOnePage:i,isShopPayActive:n,isApplePaySubscriptionReviewRequired:r=!1}){const a={[rn]:s.searchParams.get(rn),[nn]:s.searchParams.get(nn)},o=s.pathname.includes("/thank-you");if(r)return"APPLE_PAY";return function({paymentLines:e,isOnePage:t}){if(!un({paymentLines:e,isOnePage:t}))return null;const s=cn(e,"PAYPAL_EXPRESS");return s?.method.walletContent?.isVenmo?"VENMO":"PAYPAL_EXPRESS"}({paymentLines:e,isOnePage:i})||(an({paymentLines:e})?"GOOGLE_PAY":on({paymentLines:e,isOnePage:i,isShopPayActive:n})?"APPLE_PAY":dn({paymentLines:e,paymentMethods:t,urlParams:a,isThankYouPage:o})?Mi.BuyWithPrime:ln({paymentLines:e,paymentMethods:t,urlParams:a})?Mi.AmazonPay:null)}({paymentLines:s.proposed.paymentLines.peek(),paymentMethods:s.negotiated.fields.paymentMethods.peek(),url:o,isOnePage:n.isOnePage.peek(),isShopPayActive:i,isApplePaySubscriptionReviewRequired:d});l&&(this.#zs.value=l,this.#Et.leaveErrorBreadcrumb(`escalatedWallet initialized to "${l}"`,{escalatedWallet:l})),d&&(this.#Hs.value=!0)}#Us;get pendingShippingAddressFormat(){return this.#Us}setPendingShippingAddressFormat(e){this.#Us.value=e}#qs;#Vs;#zs;#Hs;#js;#Ws;#Et;#$s;#Gs(){return null!=this.#qs.peek()||null!=this.#zs.peek()}#Ys(e){const t=this.#Gs();e!==t&&this.#$s.dispatchEvent(t?new hn:new pn)}setIsDecelerating(e){this.#Hs.value=e}consumeApplePaySubscriptionReviewParam(){this.#js.value=!0}setHasActiveApplePaySubscriptionReview(e){this.#Ws.value=e}setEscalatedWallet(e){const t=this.#Gs();"PAYPAL_EXPRESS"!==e&&this.setPendingShippingAddressFormat(void 0),this.#zs.value=e,this.#Et.leaveErrorBreadcrumb(`escalatedWallet set to "${e}"`,{escalatedWallet:e}),this.#Ys(t)}setActiveSession({newValue:e,asPaymentMethod:t}){const s=this.#qs.value;null!==s&&e!==s.wallet&&this.#Et.error(new gn(`Wallet "${e}" started session while another wallet "${s.wallet}" was already active`,{metadata:{conflictType:"StartConflict",wallet:{invoking:e,active:s}}})),this.#Et.leaveErrorBreadcrumb(`activeSession set to "${e}"`,{activeSession:e,asPaymentMethod:t});const i=this.#Gs();this.#qs.value={wallet:e,asPaymentMethod:t},null!==e&&(this.#Vs.value=e),this.#Ys(i)}clearActiveSession({invokingWallet:e}){const t=this.#qs.value,s=this.#Gs();this.#qs.value=null,this.#Ws.value=!1,null!==t&&e!==t.wallet&&this.#Et.error(new gn(`Wallet "${e}" cleared session set by another wallet "${t.wallet}"`,{metadata:{conflictType:"ClearConflict",wallet:{invoking:e,active:t}}})),this.#Et.leaveErrorBreadcrumb(`activeSession cleared by "${e}"`),this.#Ys(s)}}class wh{constructor({serializations:e,receipt:t,profile:s,source:i,checkoutContextData:a,themeData:o,shop:d,mobileCheckoutSdk:l,client:u,persistence:c,shopPay:h,shopPayIsActive:m,requestInfoData:y,isEmbedded:v,isEmbeddedPartner:f,observability:b,userEvents:S,embed:A,events:_,graphql:{coreGraphql:P,shopPayGraphql:C,throttleGraphql:k},i18n:E,router:w,initialNegotiationData:T,url:M}){this.#Js=g(null),this.crossBorderConfirmState=this.#Js;const I=d.hasFlagEnabled(mn);this.#Ks=t??g(void 0),this.latestReceipt=this.#Ks,this.#Xs=g(e.get("checkpointData")),this.checkpointToken=this.#Xs,this.#Qs=g(Boolean(e.get("forcedRedesignWallet"))),this.isCheckoutLayoutForcedToOnePage=this.#Qs;const D=new yu({serializations:e,isCheckoutLayoutForcedToOnePage:this.#Qs}),{initialRequest:{url:R}}=u,x=new od({extendedAddressModePolicy:m?{isConcatenatedEnabled:()=>!1,isDedicatedEnabled:()=>!0,getDedicatedFormat:e=>e.extendedFormattingV2ShopPay?.edit}:yn(d),graphql:P,i18n:E,initialCountryDetails:[y?.httpRequestInfo?.geolocation?.country,y?.shop?.defaultShippingDetails?.country,d.country]});this.address=x;const L=new dh({negotiateFromSessionData:T,router:w,url:M,source:i,shop:d,isOnePageCheckout:D.isOnePage.value,observability:b,persistence:c,isShopPayActive:m,checkoutContextData:a,requestInfoData:y??{},extendedAddressMode:this.address.extendedAddressMode,receipt:this.#Ks.peek()});this.proposal=L,function({client:e,proposal:t,observability:s,shop:i,isOnePageCheckout:n}){const{billingAddressOption:r,paymentLines:a,billingAddress:o,shippingAddress:d,deliveryLines:l}=t.proposed;let u;r.subscribe(t=>{const r=void 0===u&&"custom"===t&&i.sameBillingAndShippingAddress,c="shipping"===u&&"custom"===t;if(u=t,!r&&!c)return;const h={browser:Ze(e.userAgent).name,is_mobile:(p=e.userAgent,/iPhone|iPad|iPod|Android/i.test(p)),is_webview:ld(e.userAgent),is_one_page:n,defaults_to_shipping:i.sameBillingAndShippingAddress,payment_method_type:a.peek()[0]?.method.type??"none"};var p;r?s.log("billing_address_initial_custom","Checkout initialized with custom billing despite shipping default",{...h,has_billing_address:me(o.peek()),has_shipping_address:me(d.peek()),delivery_methods:[...new Set(l.peek().flatMap(e=>e.peek().deliveryMethodTypes))].join(",")}):(s.counter({name:"billing_address_shipping_to_custom",value:1,attributes:h}),s.log("billing_address_shipping_to_custom","Billing address option switched from shipping to custom",h))})}({client:u,proposal:L,observability:b,shop:d,isOnePageCheckout:D.isOnePage.peek()});const O=Ic({negotiatedFields:L.negotiated.fields,captureAtFulfillmentEnabled:d.captureAtFulfillmentEnabled});this.isPaymentRequired=O.isPaymentRequired,this.paymentExemptionReason=O.paymentExemptionReason,this.#Zs=g(!1),this.isRedirectingExternally=this.#Zs,this.wallets=new Eh({observability:b,events:_,proposal:L,isShopPayActive:m,layout:D,shop:d,client:u}),this.identity=new ou({observability:b,wallets:{shopPayIsActive:m,escalatedWalletSignal:this.wallets.escalatedWallet},protocols:{isEmbedded:v,isEmbeddedPartner:Boolean(f),mobileCheckoutSdk:l},shop:d,proposal:L}),this.identity.initialize();const B=new cu({proposal:L,source:i,shop:d,shopPay:h,identity:this.identity});this.installments=B,this.cardNetworkSelection=new cd,this.offsitePopupController=new Tc({client:u,observability:b}),this.configuration=new Hl({serializations:e,layout:D,proposal:L,source:i,appConfiguration:a.appConfiguration,themeData:o,shop:d,profile:s,mobileCheckoutSdk:l,client:u,shopPay:h,requestInfoData:y,router:w,renderContextToken:new uh({token:R.searchParams.get("rctx")??void 0}),identity:this.identity,embed:A,observability:b}),this.extensibility=new ru({activatedExtensions:s?.activatedExtensions??[],client:u,configuration:this.configuration,events:_,graphql:P,identity:this.identity,isCheckoutEditor:this.configuration.branding.shell.configuration.environment.isCheckoutEditor??!1,observability:b,persistence:c,proposal:L,serializedReceipt:e.get("receipt"),shop:d,source:i}),this.addressManager=new Zo({identity:this.identity,observability:b,userEvents:S,proposal:L,wallets:this.wallets,graphql:{coreGraphql:P,shopPayGraphql:C,throttleGraphql:k},i18n:E,address:this.address,configuration:this.configuration,shop:d,shopPay:h,source:i,router:w,initialNegotiationData:T}),this.isShippingRequired=p(()=>De(L)),this.#ei=g(!0),this.supportsSplitShipping=this.#ei,this.unstable_evaluateSupportsSplitShipping(R),this.unstable_graphqlDataRequestInfo=y??void 0,this.paymentMethodPromotions=new Rc,this.thankYouEntrance=new n({progress:!0===e.get("fastThankYouProgress")?new r:void 0}),this.checkoutExit=new hd({events:_}),this.vaultedSections=I?new kh({configuration:this.configuration,addressManager:this.addressManager,identity:this.identity,proposal:L,shop:d,shopPay:h,source:i,isEmbeddedPartner:f}):new Ph,this.sections=I?new ch({configuration:this.configuration,installments:B,isShippingRequired:this.isShippingRequired,vaultedSections:this.vaultedSections,source:i,proposal:L,identity:this.identity,shop:d,embed:A}):new vn,this.rememberMe=new lh({url:M,shop:d,source:i,shopPayIsActive:m,receipt:this.latestReceipt.value,observability:b}),this.negotiator=new Ec({checkout:{address:this.address,checkpointToken:this.checkpointToken,configuration:this.configuration,extensibility:this.extensibility,identity:this.identity,isCheckoutLayoutForcedToOnePage:this.isCheckoutLayoutForcedToOnePage,isShippingRequired:this.isShippingRequired,latestReceipt:this.latestReceipt,proposal:this.proposal,supportsSplitShipping:this.supportsSplitShipping,rememberMe:this.rememberMe,unstable_graphqlDataRequestInfo:this.unstable_graphqlDataRequestInfo,wallets:this.wallets,unstable_overwriteCheckpointToken:e=>this.unstable_overwriteCheckpointToken(e)},client:u,graphql:{coreGraphql:P,throttleGraphql:k},observability:b,userEvents:S,persistence:c,router:w,shop:d,shopPay:h,source:i,url:M},{negotiateFromSessionData:T}),this.journey=new mu({checkout:{latestReceipt:this.latestReceipt,negotiator:this.negotiator},observability:b,source:i}),this.validation=new fh({checkout:this,client:u,events:_,initialNegotiationData:T,router:w}),x.trackCompletion({checkout:this,client:u,events:_,initialNegotiationData:T,shop:d,source:i,userEvents:S})}#Ks;#Xs;#Zs;#Qs;#ei;#Js;unstable_setRedirectingExternally(e){this.#Zs.value=e}unstable_evaluateSupportsSplitShipping(e){const t=fn(e);this.#ei.value=t}setCrossBorderConfirmState(e){this.#Js.value=e}unstable_overwriteLatestReceipt(e){this.#Ks.value=e}unstable_overwriteCheckpointToken(e){this.#Xs.value=e}unstable_forceCheckoutLayoutToOnePage(){this.#Qs.value=!0}unstable_clearForcedCheckoutLayout(){this.#Qs.value=!1}}function Th(e){return{status:"abandoned",id:`gid://shopify/ProcessedReceipt/${e.id}`}}function Mh(e){if(null!=e?.id&&!e.orderStatusPageUrl)return{status:"processing",id:e.id,pollAt:Date.now()+bn}}function Ih(e){if(null!=e?.id)switch(e.__typename){case"ProcessingReceipt":case"WaitingReceipt":if(null==e.pollDelay)return;return $a({id:e.id,pollDelay:e.pollDelay});case"ProcessedReceipt":return Mh({__typename:e.__typename,id:e.id,orderStatusPageUrl:e.orderStatusPageUrl})}}class Dh{constructor(e={}){this.markedAsComplete=!1,this.markedAsUsable=!1,this.loaderPreviouslyRegistered=!1,this.loaders=new Set,this.loaderFinishedCallbacks=new Set,this.eventHandlers=new Set,this.navigationHandlers=new Set,this.initialNavigationFinished=!1,this.navigationInFlight=!0,this.navigationStart=0,this.#ti=g(!1),this.timeOrigin=e.timeOrigin??("undefined"==typeof performance?0:performance.timeOrigin||Date.now()-performance.now()),this.initialLoading=this.#ti}#ti;get loaderCount(){return this.loaders.size}get navigationStartTime(){return this.navigationStart}start({timeStamp:e=performance.now()}={}){this.navigationStart=e,this.navigationInFlight=!0}usable(e=performance.now()){this.initialLoading.value?this.markedAsUsable=!0:this.emitUsable(e)}finish(e=performance.now()){this.initialLoading.value?this.markedAsComplete=!0:this.emitNavigation()}cancelNavigation(e=performance.now()){this.emitNavigation()}mark(e,t){}on(...[e,t]){return"initialLoadingFinish"===e?(0===this.loaders.size?t():this.loaderFinishedCallbacks.add(t),()=>this.loaderFinishedCallbacks.delete(t)):"event"===e?(this.eventHandlers.add(t),()=>this.eventHandlers.delete(t)):(this.navigationHandlers.add(t),this.initialNavigationFinished&&t(),()=>this.navigationHandlers.delete(t))}addLoader(e){return 0===this.loaders.size&&(this.#ti.value=!0,this.loaderPreviouslyRegistered=!0),this.loaders.add(e),()=>{this.loaders.delete(e),0===this.loaders.size&&this.finishInitialLoading()}}finishInitialLoading(){if(this.initialLoading.value){this.#ti.value=!1,this.markedAsUsable&&this.emitUsable(performance.now()),this.markedAsComplete&&this.emitNavigation();for(const e of this.loaderFinishedCallbacks)e()}}emitUsable(e){const t={type:Pn,start:e,duration:0};for(const s of this.eventHandlers)s(t)}emitNavigation(){if(this.navigationInFlight){this.navigationInFlight=!1,this.initialNavigationFinished=!0;for(const e of this.navigationHandlers)e()}}}class Rh{constructor({rootElement:e,serializations:t}){this.prefersDarkMode=function(){const e=window.matchMedia("(prefers-color-scheme: dark)"),t=e.matches,s=g(t),i=e=>{s.value=e.matches};return"function"==typeof e?.addEventListener?e.addEventListener("change",i):e?.addListener?.(i),s}(),this.#si=g(!1),this.apiClientId=t.get("apiClientId")??0,this.enableAgenticCardEntry=g(!0===t.get("enableAgenticCardEntry")),this.rootElement=e,this.#ii=t,this.isFirstMeaningfulInteractionMarked=this.#si,this.cookies=new xh(this.#ii),this.userAgent=window.navigator.userAgent,this.userAgentDetails=t.get("userAgentDetails");const s=t.get("clientBundleInfo");this.assets={assetsBase:s.assetsBase,extensionsBase:s.extensionsBase,postPurchaseExtensionsBase:s.postPurchaseExtensionsBase,isBaselineBrowser:"system"===s.format};const i=new URL(window.location.href),n="yes"===t.get("serverRender")&&e.hasChildNodes();this.initialRequest={url:i,isServerRendered:n,isCheckoutEditor:t.get("isCheckoutEditor")},this.unstable_legacyNavigationPerformance=new Dh}#si;#ii;markFirstMeaningfulInteraction(){this.#si.value=!0}prepare(){this.#ni()}unstable_getSerialization(e){return this.#ii.get(e)}#ni(){const e=this.#ii.get("sourceToken"),t=Cn(Rt.SourceToken);e&&t!==e&&(kn(Rt.ExtensionStorage),En(Rt.SourceToken,e))}}class xh{#ii;constructor(e){this.#ii=e}get(e){const t=Lh(document.cookie).get(e);return void 0!==t?t:"_shopify_y"===e?P(this.#ii?.get("shopifyY"),this.#ii?.get("shopifyYExpiration")):"_shopify_s"===e?P(this.#ii?.get("shopifyS"),this.#ii?.get("shopifySExpiration")):void 0}getAll(){return Lh(document.cookie)}serialize(){return document.cookie}set(e,t,{expiry:s,maxAge:i,path:n="/",sameSite:r=null}={}){let a=`${e}=${t}; secure`;if(null==i){let e=s;e||(e=new Date,e.setFullYear(e.getFullYear()+1)),a+=`; expires=${e.toUTCString()}`}else a+=`; max-age=${i}`;a+=`; path=${n}`,r&&(a+=`; samesite=${r}`),this.setSerialized(a)}setSerialized(e){document.cookie=e}delete(e,t="/"){this.set(e,"",{maxAge:0,path:t})}}function Lh(e){const t=new Map;for(const s of e.split(";")){const e=s.trim(),i=e.indexOf("=");if(i<=0)continue;const n=e.slice(0,i).trim();n&&!t.has(n)&&t.set(n,e.slice(i+1).trim())}return t}class Oh{#ri;constructor(e=function(){const e={},t=document.querySelectorAll('meta[name^="serialized-"]');for(const s of t){const t=s.getAttribute("name")?.replace("serialized-","");e[t]=Bh(s)}return e}()){this.#ri=e}get(e){return this.#ri[e]}}function Bh(e){const t=e.getAttribute("content");try{return t?JSON.parse(t):void 0}catch{return}}class Fh{#ai;constructor(e){this.#ai=e}get consentProvider(){return this.#ai.consentProvider}get trackingConsentHeader(){return this.#ai.trackingConsentHeader}get currentVisitorConsent(){return this.#ai.currentVisitorConsent}get trackingConsentSelection(){return this.#ai.trackingConsentSelection}get analyticsProcessingAllowed(){return this.#ai.analyticsProcessingAllowed}get preferencesProcessingAllowed(){return this.#ai.preferencesProcessingAllowed}get marketingAllowed(){return this.#ai.marketingAllowed}get saleOfDataAllowed(){return this.#ai.saleOfDataAllowed}get shouldShowBanner(){return this.#ai.shouldShowBanner}merchantAllowedProcessing(){return this.#ai.merchantAllowedProcessing()}merchantVisitorConsent(){return this.#ai.merchantVisitorConsent()}get saleOfDataRegion(){return this.#ai.saleOfDataRegion}get getRegion(){return this.#ai.getRegion}merchantMetafields(){return this.#ai.merchantMetafields()}setTrackingConsent(e,t){return this.#ai.setTrackingConsent(e,t)}acceptAll(){return this.#ai.acceptAll()}rejectAll(){return this.#ai.rejectAll()}setPrefetchedConsent(e,t){this.#ai.setPrefetchedConsent(e,t)}dispose(){this.#ai.dispose()}}const Nh=[408,429,430,500,502,503,504],Uh={analytics:wn.NO_VALUE,marketing:wn.NO_VALUE,preferences:wn.NO_VALUE,saleOfData:wn.NO_VALUE},qh=[C.CONSENT_COLLECTED,C.TRACKING_ACCEPTED,C.TRACKING_DECLINED,C.ANALYTICS_ACCEPTED,C.ANALYTICS_DECLINED,C.PREFERENCES_ACCEPTED,C.PREFERENCES_DECLINED,C.MARKETING_ACCEPTED,C.MARKETING_DECLINED,C.SALE_OF_DATA_ACCEPTED,C.SALE_OF_DATA_DECLINED];class Vh{#oi;#di;#li;#ui=[];constructor(e){this.observability=e.observability,this.#oi=g(this.#ci()),this.#di=g(this.#hi()),this.#li=g(this.#pi()),this.currentVisitorConsent=this.#di,this.analyticsProcessingAllowed=p(()=>this.#oi.value.analytics),this.marketingAllowed=p(()=>this.#oi.value.marketing),this.preferencesProcessingAllowed=p(()=>this.#oi.value.preferences),this.saleOfDataAllowed=p(()=>this.#oi.value.saleOfData),this.saleOfDataRegion=p(()=>this.#li.value.saleOfDataRegion),this.getRegion=p(()=>this.#li.value.region),this.shouldShowBanner=e.shouldShowBanner??p(()=>this.#li.value.shouldShowBanner),this.#gi()}dispose(){this.onDispose();for(const{event:e,handler:t}of this.#ui)document.removeEventListener(e,t);this.#ui=[]}onDispose(){}#mi(){f(()=>{this.#oi.value=this.#ci(),this.#di.value=this.#hi(),this.#li.value=this.#pi()})}#gi(){const e=()=>{this.#mi()};for(const t of qh)document.addEventListener(t,e),this.#ui.push({event:t,handler:e})}#ci(){return{analytics:T(),marketing:w(),preferences:E(),saleOfData:k()}}#pi(){return{shouldShowBanner:D(),saleOfDataRegion:I(),region:M()}}#hi(){const e=R();return"analytics"in e?{analytics:e.analytics,marketing:e.marketing,preferences:e.preferences,saleOfData:e.sale_of_data}:Uh}}class zh extends Vh{constructor(e){super({observability:e.observability}),this.consentProvider="consent-tracking-api"}get trackingConsentHeader(){}merchantAllowedProcessing(){return{analytics:T(),marketing:w(),preferences:E(),saleOfData:k()}}merchantVisitorConsent(){const e=R();return"analytics"in e?{analytics:e.analytics,marketing:e.marketing,preferences:e.preferences,sale_of_data:e.sale_of_data}:{analytics:"",marketing:"",preferences:"",sale_of_data:""}}merchantMetafields(){return x()}async setTrackingConsent(e,t){try{return await new Promise(s=>{L({analytics:e.analytics,marketing:e.marketing,preferences:e.preferences,sale_of_data:e.saleOfData,storefrontAccessToken:e.storefrontAccessToken,isExtensionToken:e.isExtensionToken,...e.metafields?.length&&{metafields:e.metafields}},(e,i)=>{if(i)t?.(null,i),s({success:!0});else{const i=this.#yi(e),n=this.#vi(e);this.#fi(i),t?.({error:i,statusCode:n},!1),s({success:!1,error:i,statusCode:n})}})})}catch(s){const e=s instanceof Error?s.message:"Failed to set consent";return this.#fi(e),t?.({error:e},!1),{success:!1,error:e}}}async acceptAll(){return this.setTrackingConsent({analytics:!0,marketing:!0,preferences:!0})}async rejectAll(){return this.setTrackingConsent({analytics:!1,marketing:!1,preferences:!1})}setPrefetchedConsent(e){this.observability.counter({name:"merchant_consent_manager_unsupported_method",value:1,attributes:{method:"setPrefetchedConsent"}}),this.observability.log("merchant_consent_manager_unsupported_method","setPrefetchedConsent() called on MerchantConsentManager - this is a no-op. This method is only supported by ShopConsentManager.")}#yi(e){return e instanceof Error?e.message:"object"==typeof e&&e&&"error"in e?String(e.error):"Failed to set consent"}#vi(e){if("object"==typeof e&&e&&"statusCode"in e&&"number"==typeof e.statusCode)return e.statusCode}#fi(e){this.observability.counter({name:"merchant_consent_manager_error",value:1,attributes:{operation:"setTrackingConsent"}}),this.observability.log("merchant_consent_manager_error",`Failed to call setTrackingConsent() from the consent-tracking-api package in MerchantConsentManager: ${e}`)}}const Hh={id:"210f9c0e85a293621a1ecbb93c76ec9d4f12e6348d8144935c00bdf25bcb6f81",type:"mutation",name:"UserPrivacySettingsSet",source:"mutation UserPrivacySettingsSet($input:UserPrivacySettingsSetInput!){userPrivacySettingsSet(userPrivacySettingsSetInput:$input){userPrivacySettings{...UserPrivacySettingsFragment __typename}userErrors{field message __typename}__typename}}fragment UserPrivacySettingsFragment on UserPrivacySettings{dataSharingOptOut trackingConsentHeader consent{analytics{consented providedAt isExpired defaultConsented __typename}marketing{consented providedAt isExpired defaultConsented __typename}displayBanner __typename}__typename}"};class jh extends Error{constructor(){super(...arguments),this.name="ShopConsentManagerError"}}class Wh extends Error{constructor(){super(...arguments),this.name="ShopConsentManagerUserChangedError"}}const $h="Shop Pay user changed while setting consent",Gh="shop_consent_manager_error",Yh="3.amps",Jh=new Set(["AU"]),Kh=!0;class Xh extends Vh{constructor(e){e.prefetchedConsent?.trackingConsentHeader&&O(e.prefetchedConsent.trackingConsentHeader);const t=g(Kh);super({observability:e.observability,shouldShowBanner:t}),this.#bi=Kh,this.consentProvider="shop-pay-consent-provider",this.#Si=t,this.#Ai=g(void 0),this.trackingConsentSelection=this.#Ai,this.#_i=e.prefetchedConsent?.trackingConsentHeader,this.#Pi=Tn(e.merchantTrackingConsent),this.#q=e.shopPayGraphql,this.#U=e.shopPay,this.#Ci=e.countryCode?.toUpperCase(),this.#ki=this.#Ei()}#q;#U;#ki;#Pi;#Si;#Ai;#bi;#wi;#_i;#Ci;get trackingConsentHeader(){return this.#_i}merchantAllowedProcessing(){return this.#Pi.allowedProcessing}merchantVisitorConsent(){return this.#Pi.visitorConsent}merchantMetafields(){return[]}async setTrackingConsent(e,t){if(void 0!==e.preferences){const e="setTrackingConsent() does not support preferences in ShopConsentManager. Preferences consent is only available in MerchantConsentManager.";return t?.({error:e},!1),{success:!1,error:e}}if(void 0!==e.saleOfData){const e="setTrackingConsent() does not support saleOfData in ShopConsentManager, only in MerchantConsentManager. Sale of data follows an opt-out flow with separate UI in Shop Pay.";return t?.({error:e},!1),{success:!1,error:e}}if(void 0!==e.metafields&&e.metafields.length>0){const e="setTrackingConsent() does not support metafields in ShopConsentManager. Metafields are only available in MerchantConsentManager.";return t?.({error:e},!1),{success:!1,error:e}}const s=this.#U.user.shopAccountUuid.value;try{const i={consent:{analyticsEnabled:e.analytics,marketingEnabled:e.marketing}},n=await S(async()=>{if(!this.#Ti(s))throw new Wh($h);const{data:e,error:t}=await this.#q.mutate(Hh,{variables:{input:i}});if(t)throw t;if(!e)throw new jh("No data returned from mutation");return e},{shouldRetry:e=>this.#Ti(s)&&this.#Mi(e),maxAttempts:3,initialRetryDelay:1});if(!this.#Ti(s))return this.#Ii(t);const r=n.userPrivacySettingsSet.userErrors;if(r&&r.length>0){const e=r.map(e=>e.message).join("; ");return this.#Di("set",new jh(e)),t?.({error:e},!1),{success:!1,error:e}}const a=n.userPrivacySettingsSet.userPrivacySettings??void 0;a&&this.#Ri(a);const o=a?.trackingConsentHeader;return o&&(this.#_i=o,O(this.#_i)),t?.(null,!0),{success:!0}}catch(i){if(i instanceof Wh||!this.#Ti(s))return this.#Ii(t);const e=i,n=e.message??"Failed to set consent";return this.#Di("set",e),t?.({error:n},!1),{success:!1,error:n}}}async acceptAll(){return this.setTrackingConsent({analytics:!0,marketing:!0})}async rejectAll(){return this.setTrackingConsent({analytics:!1,marketing:!1})}setPrefetchedConsent(e,t){if(void 0!==t&&!this.#Ti(t))return;this.#Ri(e);const s=e?.trackingConsentHeader;this.#_i=s??this.#xi(),O(this.#_i)}onDispose(){this.#ki()}#Ri(e){const t=Mn(e);this.#bi=t?.displayBanner??Kh,this.#Si.value=t?In(t):Kh,this.#Ai.value=t?Dn(t):void 0}#Ti(e){return this.#U.user.shopAccountUuid.value===e}#Ii(e){return e?.({error:$h},!1),{success:!1,error:$h}}#Ei(){return m(()=>{const e=this.#U.user.shopAccountUuid.value;void 0!==this.#wi?this.#wi!==e&&(this.#wi=e,this.#Si.value=this.#bi,this.#Ai.value=void 0,this.#_i=""===e?this.#Li():this.#xi(),O(this.#_i)):this.#wi=e})}#xi(){return this.#Oi()??(this.#bi?Yh:"3.AMpS")}#Li(){return this.#Oi()??Yh}#Oi(){return this.#Ci&&Jh.has(this.#Ci)?"3.Amps":void 0}#Mi(e){return e instanceof B||e instanceof F&&Nh.includes(e.response.status)}#Bi(e){if(e instanceof B)return"network";if(e instanceof F){const t=e.response.status;if(t>=400&&t<500)return"4xx";if(t>=500&&t<600)return"5xx"}return"other"}#Fi(e){if(e instanceof F)return e.response.status}#Di(e,t){const s=this.#Bi(t);this.observability.counter({name:Gh,value:1,attributes:{operation:e,errorCategory:s}}),this.observability.log(Gh,`Failed to ${e} shop user consent`,{error:t,errorCategory:s,statusCode:this.#Fi(t),isRetryable:this.#Mi(t)})}}class Qh extends Fh{constructor(e){super(e.shopPayIsActive&&e.useShopConsent?new Xh({shopPayGraphql:e.shopPayGraphql,observability:e.observability,shopPay:e.shopPay,merchantTrackingConsent:e.merchantTrackingConsent,prefetchedConsent:e.prefetchedTrackingConsentHeader?{trackingConsentHeader:e.prefetchedTrackingConsentHeader}:void 0,countryCode:e.countryCode}):new zh({observability:e.observability}))}}const Zh={logging:1,metrics:2,monorail:4,preact:8,graphqlTiming:16};class ep{constructor({serializations:e}){const{commitSha:t,debug:s,deployStage:i,previewBranch:n,services:r}=e.get("environment");var a;this.commitSha=t??"unknown",this.debug=(a=s??0,Object.entries(Zh).reduce((e,[t,s])=>(e[t]=Boolean(a&s),e),{})),this.deployStage=i??"production",this.previewBranch=n,this.services={...Rn,...r}}}class tp{#Ni=new EventTarget;dispatchEvent(e){return this.#Ni.dispatchEvent(e)}addEventListener(e,t,s){this.#Ni.addEventListener(e,t,s)}}const sp="X-Checkout-One-Session-Token",ip=["_cmp_a","_tracking_consent","cart","discount_code","dynamic_checkout_shown_on_cart","remember_me","_shop_app_essential"],np=["channel","profile_preview_token","simulated_preview_token","previewCustomerType","embed_express_checkout",bt,"shop_app_checkout_auth_token"];class rp extends URL{constructor({shop:e,persisted:t,shopPay:s},i){let n;n=e&&s?`/checkout/${Re(e.id)}`:"/checkouts",super(t?`${n}/internal/graphql/persisted`:`${n}/unstable/graphql`,i)}}function ap(e){const t=e?.headers.get("x-request-id"),s=e?.headers.get("cf-ray");return{...t?{"x-request-id":t}:{},...s?{"cf-ray":s}:{}}}const op="FoundationGraphQL";class dp extends N{constructor(e){const{fetch:t,cache:s}=function({client:e,environment:t,observability:s,serializations:i,isShopPayActive:n,getTrackingConsentHeader:r,getWebMcpToolName:a,getSessionTokenOverride:o}){const d=i.get("shop"),l=document.documentElement.lang,u=i.get("graphql"),c=i.get("sessionToken"),h=i.get("encodedBuyerSessionForHeaderTransport"),p=i.get("sourceToken")??"unknown",g=i.get("sourceType")??"unknown",m=i.get("universalCheckoutSessionId"),y=i.get("shopPayConfig"),v=i.get("serverHandling")??"",f=i.get("serverRender")??"no",b=new Map(u?Object.entries(u):[]),S={"Accept-Language":l,"X-Checkout-Web-Deploy-Stage":t.deployStage,"X-Checkout-Web-Build-Id":t.commitSha,"X-Checkout-Web-Source-Id":p,[sp]:c,"X-Checkout-Web-Server-Handling":v,"X-Checkout-Web-Server-Rendering":f,"Shopify-Checkout-Source":`id="${p}", type="${g}"`};m&&(S["Shopify-Universal-Checkout-Source"]=`id="${m}", type="uc"`),h&&(S["Shopify-Session-Essential"]=`payload=${h}`);const A=function({searchParams:e,userAgent:t}){const s=e.get("embed");if(s)return s;const i=e.get(xn);if(i){const s=[`version=${i}`],n=e.get(Ln),r=e.get(On),a=e.get(Bn),o=e.get(Fn),d=Nn(t)||Un(i)&&qn(a);if(n&&s.push(`authentication=${n}`),r&&s.push(`colorscheme=${r}`),d){const e="app"===o?.toLowerCase()?"app":"shop";s.push(`branding=${e}`)}d&&a&&!Nn(t)&&(s.push(`library=CheckoutKit/${a}`),s.push("platform=web"));let l="web";return t&&(l=Vn.test(t)?"mobile":"web"),s.push(`platformcategory=${l}`),s.join(",")}}({searchParams:new URLSearchParams(location.search),userAgent:e.userAgent});A&&(S["Shopify-Checkout-Embed"]=A),n&&(y?.callback_token&&(S["X-Shop-Pay-Token"]=y.callback_token),y?.tracking_visit&&y?.tracking_unique&&(S["X-Shopify-VisitToken"]=y.tracking_visit,S["X-Shopify-UniqueToken"]=y.tracking_unique));const _=new URLSearchParams(location.search),P=_.get("preview"),C=_.get("duration"),k=Object.fromEntries(np.map(e=>[e,_.get(e)]).filter(e=>null!==e[1]));P&&(S["Shopify-Checkout-Queue-Preview"]=P,C&&(S["Shopify-Checkout-Queue-Duration"]=C));const E=_.get("simulated_preview_token");E&&zn(i.get("sourceType"))&&(S["X-Shopify-Editor-Access-Token"]=E);return{fetch:U({url:e=>new rp({shop:d,persisted:""===e.query.source,shopPay:n},location.href),method:e=>{return""!==e.query.source||"mutation"===e.query.type||null!=(t=e.variables)&&"{}"!==JSON.stringify(t)?"POST":"GET";var t},source:e=>""!==e.query.source,headers(){const e={...S},t=r();t&&(e["X-Shopify-Tracking-Consent"]=t);const s=a?.();s&&(e["Shopify-Checkout-Webmcp-Tool"]=s);const i=o?.();return i&&(e[sp]=i),e},credentials:"same-origin",explicitSearchParams:k,onResult({query:e,result:t,response:i,duration:n}){const{name:r}=e;t.error&&Qa(t.error,{observability:s,fileContext:op,queryName:r,documentId:e.id||void 0,requestId:i.headers.get("x-request-id")??void 0}),lp({observability:s,name:r,duration:n,response:i})},onError({query:t,error:i,response:n,duration:r}){const{name:a}=t;400===n?.status&&"undefined"!=typeof document&&(s.leaveErrorBreadcrumb(`Clearing non-essential cookies due to GraphQLFetchHttpBadRequestError on ${op}:Query::${a}`,function(e){const t=e.serialize();return{totalCookies:t.split(";").length,totalSize:encodeURI(t).split(/%..|./).length-1+" bytes"}}(e.cookies)),function(e){for(const t of e.getAll().keys())ip.includes(t)||e.delete(t)}(e.cookies)),Qa(i,{observability:s,fileContext:op,queryName:a,documentId:t.id||void 0}),lp({observability:s,name:a,duration:r,response:n}),n?.redirected&&location.replace(n.url)}}),cache:b}}(e);super(t,s)}}function lp({observability:e,name:t,duration:s,response:i}){e.histogram({name:"response_timing_and_status",value:s,attributes:{queryName:t,status:i?.status??"noResponse"}}),e.log("checkout_graphql_fetch_finished",`[GraphQL][core] ${t} request finished`,{queryName:t,duration:s,"attrs.http.response.status_code":i?.status??"noResponse",...ap(i),pageLoadId:Hn})}const up="ShopPayGraphQL";class cp extends N{constructor(e){const{fetch:t,cache:s}=function({serializations:e,environment:t,observability:s,shopPay:i,isEmbedded:n,getTrackingConsentHeader:r}){const a=document.documentElement.lang,o=new URL("/pay/users/graphql",t.services.shopServer.url),d=e.get("shopPayGraphql"),l=e.get("serverHandling")??"",u=e.get("serverRender")??"no",c=e.get("sourceToken")??"unknown",h=new Map(d?Object.entries(d):[]),p={"Accept-Language":a,"X-Checkout-Web-Deploy-Stage":t.deployStage,"X-Checkout-Web-Build-Id":t.commitSha,"X-Checkout-Web-Source-Id":c,"X-Checkout-Web-Server-Handling":l,"X-Checkout-Web-Server-Rendering":u};if(n){p["X-ShopPay-Embedded-Request"]="true";const t=e.get("shop").id;if(t){const e=jn(t);null==e||Number.isNaN(e)||(p["X-ShopPay-Embedded-Request-Shop-Id"]=String(e))}}function g({name:e,duration:t,response:i}){s.histogram({name:"shop_pay_response_timing_and_status",value:t,attributes:{queryName:e,status:i?.status??"noResponse"}}),s.log("shop_pay_checkout_graphql_fetch_finished",`[GraphQL][shoppay] ${e} request finished`,{queryName:e,duration:t,"attrs.http.response.status_code":i?.status??"noResponse",...ap(i)})}return i.isExternal&&(p["X-Checkout-Web-Checkout-Version"]=Wn.ShopPayExternal),{fetch:U({url:o,headers(){const e={...p},t=r();if(t&&(e["X-Shopify-Tracking-Consent"]=t),i.shouldUseAccessToken){const t=i.accessToken.value;t&&(e.Authorization=`Bearer ${t}`)}return e},onResult({query:e,result:t,response:i,duration:n}){const{name:r}=e,{error:a}=t;g({name:r,duration:n,response:i});const o=i.headers.get("x-request-id");a&&!$n(a)?Qa(a,{observability:s,fileContext:up,queryName:r}):s.leaveErrorBreadcrumb(`${up}:Query::${r}`,{name:r,requestId:o,entrypoint:"shop-pay"})},onError({query:e,error:t,response:i,duration:n}){const{name:r}=e;Qa(t,{observability:s,fileContext:up,queryName:r}),g({name:r,duration:n,response:i})}}),cache:h}}(e);super(t,s)}}class hp extends Error{constructor(){super(...arguments),this.name="MissingGraphQLEndpointError"}}const pp="ThrottleContextGraphQL";class gp extends N{#Ui;constructor(e){const t={current:void 0};super(function({environment:e,observability:t,serializations:s},i){const n=document.documentElement.lang,r=s.get("sourceToken")??"unknown",a=s.get("serverHandling")??"",o={"Accept-Language":n,"X-Checkout-Web-Deploy-Stage":e.deployStage,"X-Checkout-Web-Build-Id":e.commitSha,"X-Checkout-Web-Source-Id":r,"X-Checkout-Web-Server-Handling":a,"X-Queue-Session-Fallback":"true"};return U({url(){if(!i.current)throw new hp("A GraphQL endpoint must be provided");return i.current},method:"POST",credentials:"same-origin",headers:o,onResult({query:e,result:s,response:i}){const{name:n}=e,{error:r}=s,a=i.headers.get("x-request-id");r?Qa(r,{observability:t,fileContext:pp,queryName:n}):t.leaveErrorBreadcrumb(`${pp}:Query::${n}`,{name:n,requestId:a,entrypoint:"throttled"})},onError({query:e,error:s}){Qa(s,{observability:t,fileContext:pp,queryName:e.name})}})}(e,t)),this.#Ui=t}setPollUrl(e){this.#Ui.current=e}}class mp extends q{constructor({shop:e,locale:t,direction:s,translations:i,onError:n}){super({locale:t,direction:s,currency:e.currencyCode,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,fallbackTimeZone:e.timeZone,onError:n},V(i,e.translations))}}function yp(e=document.documentElement){const t=e.dir.toLowerCase();return"ltr"===t||"rtl"===t?t:void 0}class vp extends mp{constructor(e){super({...e,direction:e.direction??yp()})}}class fp extends Array{constructor(){super(),this.identify=this.factory("identify"),this.page=this.factory("page"),this.ready=this.factory("ready"),this.track=this.factory("track"),this.trackForm=this.factory("trackForm"),this.trackLink=this.factory("trackLink")}factory(e){return(...t)=>{if(t.unshift(e),this.push(t),window.__TREKKIE_SHIM_QUEUE&&("track"===e||"page"===e))try{window.__TREKKIE_SHIM_QUEUE.push({from:"trekkie-stub",method:e,args:t.slice(1)})}catch{}return this}}}function bp(e){return"production"===e||"canary"===e||"tophat"===e}const Sp=[/bytedance-ads$/i,/Acunetix-Deepscan/i,/Storebot-Google/i,/Googlebot/i,/Google-Read-Aloud/i,/^Mozilla\/5\.0 \(Windows NT 10\.0; Win64; x64\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/74\.0\.3729\.131 Safari\/537\.36$/,/^Mozilla\/5\.0 \(Windows NT 10\.0; WOW64; rv:58\.0\) Gecko\/20100101 Firefox\/59\.0$/,/facebookexternalhit/i,/meta-externalagent/i,/meta-externalads/i,/meta-externalfetcher/i,/meta-webindexer/i,/ClaudeBot/i,/Amazonbot/i,/Baiduspider/i,/PetalBot/i];function Ap(e){return Sp.some(t=>t.test(e))}const _p=[/\bDdg\//,/\bEdgiOS\//],Pp=["Failed to execute 'appendChild' on 'Node': Identifier 'CURRENCY_LIST' has already been declared","Identifier 'CURRENCY_LIST' has already been declared","Failed to execute 'appendChild' on 'Node': Identifier 'change_ua' has already been declared","Identifier 'change_ua' has already been declared"],Cp=["The node to be removed is not a child of this node"],kp=["Skipped ViewTransition due to another transition starting","Skipped ViewTransition due to document being hidden"],Ep=["before initialization","Cannot access uninitialized variable"],wp=/^https?:\/\/[^/]+\/.*(?:\/data:|https?%3A%2F%2F|aHR0cHM6Ly9|aHR0cDovL)/i,Tp=/^data:[^,]*;base64,/,Mp=/\/(\w+(-\w+)*)$/;class Ip extends Error{constructor(){super(...arguments),this.name="ParseGidError"}}function Dp({appType:e,locale:t,environment:s,serializations:i,onUnactionableError:n}){const r=s.deployStage;if(!bp(r))return;const a=i.get("shop"),o=function(e){const t=`/${e}`.match(Mp);if(void 0!==t?.[1])return t[1];throw new Ip(`Invalid gid: ${e}`)}(a.id),d=i.get("requestId"),l=document.documentElement.lang??"zz",u=i.get("receipt"),c=i.get("serverHandling")??"unknown",h=i.get("serverRender")??"no",p=i.get("clientBundleInfo").browsers??"unknown",g=(i.get("experiments")??[]).reduce((e,{clientHandle:t,variant:s})=>(e[t]={clientHandle:t,variant:s??void 0},e),{}),m={global:{shop:{id:o,name:a.name,domain:a.myshopifyDomain,locale:l,enabledFlags:a.enabledFlags},experiments:g,request:{serializedRequestId:d},receipt:{status:u?.status??"unavailable"},custom:{serverHandling:c,serverRendering:h,browserGroup:p}},error_source:{shop_id:o},cgi_data:{REQUEST_ID:d},device:{deploy_phase:r}};return function({appType:e,appVersion:t,locale:s,releaseStage:i,metadata:n,onError:r}){const a=new z({apiKey:"d194d16e5af0f76897128b2df7483be8",appId:"checkout-web",appType:e,appVersion:t,userAgent:navigator.userAgent,locale:s,releaseStage:i,onError:r,plugins:[H,j,W,$,G],metadata:n});return Y(a),J(a),a}({appType:e,appVersion:s.commitSha,locale:t,releaseStage:r,onError:Rp({onUnactionableError:n,serverHandling:c,serverRendering:h,browserGroup:p}),metadata:m})}function Rp({onUnactionableError:t,serverHandling:s,serverRendering:i,browserGroup:n}){return(r,l)=>{const u=function(t,s){const i=t.exceptions?.[0];if(void 0===i)return!1;if(s instanceof Error&&"_handledByErrorBoundary"in s&&s._handledByErrorBoundary)return!1;const n=i.errorClass,r=i.message;if(s instanceof e&&s.isUnactionable())return!1;if(xp(s,t=>"UnactionableNegotiationFailedError"===t.name&&t instanceof e&&t.isUnactionable()))return!1;if("BugsnagInvalidError"===n&&t.unhandled)return!1;if(Gn(n))return!1;const l=i.stacktrace[0];if(void 0===l)return!1;if(a.includes(n))return!1;if("ViewTransitionRenderError"===n&&s instanceof Error){const e=s.cause;if(e instanceof Error){if(a.includes(e.name))return!1;if("TypeError"===e.name&&"Cannot read properties of undefined (reading '__H')"===e.message)return!1}}return(!r||!kp.some(e=>r.includes(e)))&&((!r||!r.includes("Permission denied to access property"))&&(("SecurityError"!==n||!r?.includes("The document is sandboxed and lacks the 'allow-same-origin' flag"))&&((!r||!fa(r))&&(("TypeError"!==n||!r||!o.some(e=>r.includes(e)))&&(("TypeError"!==n||"Cannot read properties of undefined (reading '__H')"