PageSourceSearch

https://www.pawsandrelax.ae/cdn/shopifycloud/checkout-web/assets/c1/7114e006.C0d6b2jC.js

js pawsandrelax.ae collected 2026-10-01 15:01:37 UTC 26,581 bytes, 1 lines download raw bytes

1import{l as me,A as fe,T as L,h as ne,n as Ce,u as n,S as x,x as Ve,e as Fe,_ as Be,q as V,Q as is,g as ze,k as as,p as $e}from"./2c1ab0fe.BqEHHmaW.js";import{bl as rs,e9 as os,bJ as ls,ct as ds,n as X,fi as qe,b as W,R as cs,f9 as Ie,l as Te,eL as us,c as Z,P as te,B as pe,y as ye,fj as ms,W as Ge,A as Me,C as fs,cS as ps,fk as gs,J as hs,$ as bs,I as vs,fl as As,bB as _s,cZ as Ss}from"./164ad2e3.B-RZxMRs.js";import{b as Cs}from"./efa0389a.Cs2SKqxy.js";import{O as D,aT as Pe,bb as we,eg as Is,eW as ys,cE as Ms,ek as Ps,bY as Es,da as ke,eX as Ns,dx as Le,eY as Fs,d as Bs,k as He,eZ as Ee,Q as ge,e_ as ws,cp as Ne,bj as Ue,bh as We,e$ as je,a7 as ks,f0 as Ls,f1 as xs}from"./4c290a1e.BmtxTAo1.js";import{O as Je}from"./f692f62f.1VqP6fD-.js";import{C as Ds}from"./a422df8c.CKbe5ZCF.js";import{O as Ke,u as Ye}from"./7a8217fd.BeIRNtxb.js";import{M as Rs,a as Qe,u as Xe}from"./b684bff6.B-rDNIoI.js";import{C as Os}from"./0e67bd3b.BhWTSIBe.js";import{u as Vs,A as zs}from"./74835653.iSBmIlKy.js";import{P as $s}from"./47b970b2.CHEXY0ny.js";import{u as Ze}from"./53bbdad9.LzgynQsL.js";function qs({i18n:e,paymentMethodMustSupportInterestBearingLoans:s,supportedCountryOptions:t}){const a=t.map(i=>i.label).join(", ");return s?a?e.translate("installments.installments_debit_cards_supported_countries",{countries:a}):e.translate("installments.installments_valid_debit_cards_fallback"):a?e.translate("installments.installments_cards_supported_countries",{countries:a}):e.translate("installments.installments_valid_cards_fallback")}function Ts({id:e,editableAddress:s,addressType:t,countriesOverride:a,saveText:i,cancelText:r,onSave:o,onSuccess:d,onCancel:m,showSavedAddressSelector:f=!0,addressErrorsSignal:b,combineViolationAndValidationErrors:v=!0,addressSettings:u,showDefaultAddressCheckbox:h=!1,onAddressAutoComplete:l}){const[A,g]=me(!1),{i18n:S,checkout:C,shopPay:p}=D(),{createAddressParts:c}=Pe(),_=c.addressModalState.value,y=we("shippingAddress").value,z=we("billingAddress").value,R=t==="shipping",M=C.installments.isSupported.value,N=Is(),B=ys(),T=a??(R?N:B),ee=t==="billing",w=M&&p.session.isInstallmentsSelected.value&&C.installments.supportedCountryOptions.value.length>0?C.installments.supportedCountryOptions.value:B,$=ee&&M&&p.session.isInstallmentsSelected.value,Y=$?w:T,{updateCountryCodeForSPIBillingAddress:j}=Vs(s.fields.countryCode,Y),G=ee?C.configuration.addressSettings.billingAddressSettings.value:C.configuration.addressSettings.nonBillingAddressSettings.value,ie=M?qs({i18n:S,paymentMethodMustSupportInterestBearingLoans:C.installments.paymentMethodMustSupportInterestBearingLoans.value,supportedCountryOptions:C.installments.supportedCountryOptions.value}):"",q=s.value,P=fe({...q}),k=s.fields?.countryCode.value,J=u??G,H=rs(k,Y,J),oe=os(k),he=L(()=>Ms(),[]),K=b??he,be=R?Ps:Es,{violations:le,clearViolations:de}=ls(be);ne(()=>{(t==="shipping"&&y||t==="billing"&&z)&&de()},[de,t,y,z]),ne(()=>{if(_.status!=="editing")return;const E=oe(t,Array.from(le)),re=Array.from(E).filter(([F])=>q[F]===P.current?.[F]);if(re.length===0)return;const se=H(q,t),I=v?re.concat(Array.from(se)):Array.from(se);Ce(()=>{for(const[F,U]of I)K[F].value=U})},[K,_.status,t,v,q,H,le,oe]);const ve=fe(()=>{for(const E of Object.keys(K))K[E].value=void 0});ne(()=>{const E=ve.current;return()=>E()},[]),ne(()=>{$&&j()},[$,j]);const ae=C.configuration.defaultPhoneNumber.value;ne(()=>{if(!ae)return;J?.isRequired("phone",{useMerchantSettings:!0})&&!s.fields.phone.value&&(s.fields.phone.value=ae)},[ae,J,s.fields.phone]);const Ae=async()=>{if(A)return;g(!0);const E=H(q,t);if(E.size){Ce(()=>{for(const[se,I]of E)K[se].value=I}),g(!1);return}await o?.(q)&&d?.(),g(!1)},_e=n(x,{children:[h?n(ds,{id:`${e??`${t}AddressForm`}_default_address`,name:"default_address",checked:_.setAsDefault==="default"||_.setAsDefault==="enabled",disabled:_.setAsDefault==="default",onChange:E=>{c.addressModalState.value={..._,setAsDefault:E?"enabled":"disabled"}},label:_.setAsDefault==="default"?n(X,{color:"subdued",children:S.translate("address_management.address_form.default_address")}):S.translate("address_management.address_form.default_address")}):null,n(qe,{submitText:i??S.translate("address_management.address_form.save"),cancelText:r??S.translate("address_management.address_form.cancel"),loading:A,handleCancel:m})]});return n(cs,{onSubmit:Ae,children:[$?n(x,{children:[n(X,{children:ie}),n(W,{blockSize:"base"})]}):null,n(zs,{id:e??`${t}AddressForm`,address:s,addressType:t,addressErrors:K,showSavedAddressSelector:f,addressSettings:J,onAddressAutoComplete:l,countries:Y,children:_e})]})}const Gs="CctLS",Hs={SmallBadge:Gs};function Us({explicitlyPreferred:e,onSetDefault:s,showBadge:t=!0,badgeSize:a="base"}){const{i18n:i}=D(),r=e&&t,o=!e&&s;return n(x,{children:[r&&n(x,{children:[n(W,{blockSize:"small-400"}),a==="small"?n("span",{className:Hs.SmallBadge,children:n(Ie,{size:"small",children:i.translate("payment.default")})}):n(Ie,{size:a,children:i.translate("payment.default")})]}),o&&n(Te,{inlineSize:"fill",variant:"plain",onClick:s,accessibilityLabel:i.translate("shipping.address_default"),inlineAlignment:"start",textDecoration:"none",children:i.translate("shipping.address_default")})]})}const Ws="bAwqP",js="_2x9LQ",Js="Oic4c",Se={Content:Ws,InlineDefaultBadge:js,InlineBadgeProbe:Js};function Ks({address:e,actions:s,nameLinePosition:t,addressDisplayName:a,explicitlyPreferred:i,onSetDefault:r,isImmutableAddress:o,isSelected:d,showsMoreOptionsWhenSelected:m,showPhone:f}){const{i18n:b}=D(),{nameLine:v,primary:u,secondary:h}=us({address:e,nameLinePosition:t,addressDisplayName:a,showPhone:f}),l=Ve(Je),A=l&&!!i&&!o,{nameRef:g,probeRef:S,showProbe:C,inlineBadgeFits:p}=Xs({enabled:A,primary:u,isSelected:d,showsMoreOptionsWhenSelected:m}),c=n(x,{children:[n(W,{display:"inline",inlineSize:"small-200"}),n("span",{className:Se.InlineDefaultBadge,children:n(Ie,{size:"small",children:b.translate("payment.default")})})]});return n(ye,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"base",alignItems:"start",alignContent:"start",children:[n(Z,{alignItems:"start",children:n("div",{className:Se.Content,children:[t==="block"&&n(te,{children:v}),A?n(pe,{children:[n("span",{ref:g,children:n(X,{type:"strong",children:u})}
1),C.value&&n("span",{"aria-hidden":!0,className:Se.InlineBadgeProbe,ref:S,children:c}),p.value&&c]}):n(te,{children:n(X,{type:"strong",children:u})}),n(te,{children:h}),!o&&n(Us,{explicitlyPreferred:i,onSetDefault:d?r:void 0,showBadge:!l||!p.value,badgeSize:l?"small":"base"})]})}),s]})}const Ys=24;function Qs(e){const s=parseFloat(getComputedStyle(document.documentElement).fontSize),t=xe(e.getPropertyValue(De(ke.fontSize.base)),s)*ms,a=xe(e.getPropertyValue(De(ke.spacing.small100)),s),i=t+a;return Number.isFinite(i)?i:Ys}function xe(e,s){const t=e.trim();return t.endsWith("rem")?Ns(t,s):t.endsWith("px")?parseFloat(t):NaN}function De(e){return e.replace(/^var\(|\)$/g,"")}function Xs({enabled:e,primary:s,isSelected:t,showsMoreOptionsWhenSelected:a}){const i=fe(null),r=fe(null),o=Fe(!1),d=Fe(!1);return Be(()=>{d.value=e},[e,d]),Be(()=>{const m=i.current,f=r.current;if(!e||!m||!f)return;const b=()=>{const h=m.closest("label")?.parentElement,l=m.getClientRects();if(!h||l.length!==1){o.value=!1;return}const[A]=l,g=h.getBoundingClientRect(),S=getComputedStyle(h),p=S.direction==="rtl"?A.left-g.left:g.right-A.right,c=f.getBoundingClientRect().width,_=a&&!t?Qs(S):0;o.value=c>0&&p-_>=c};let v=!1;return b(),document.fonts?.ready.then(()=>{v||b()}).catch(()=>{}),window.addEventListener("resize",b),()=>{v=!0,window.removeEventListener("resize",b)}},[e,d.value,s,t,a,o]),{nameRef:i,probeRef:r,showProbe:d,inlineBadgeFits:o}}function Zs({state:e,description:s,error:t,onConfirm:a,onCancel:i}){const{i18n:r}=D();return n(x,{children:[t?n(Z,{gap:"base",children:n(Ge,{tone:"critical",errorType:Me.PaymentError,children:t})}):null,n(te,{children:s}),n(W,{blockSize:"base"}),n(qe,{submitText:r.translate("shipping.delete"),cancelText:r.translate("address_management.address_form.cancel"),loading:e==="deleting",handleSubmit:a,handleCancel:i,submitButtonAppearance:"critical"})]})}function en({state:e,title:s,description:t,error:a,onConfirm:i,onCancel:r}){return n(Ke,{open:e==="active"||e==="deleting",heading:s,onHide:r,children:n(Zs,{state:e,description:t,error:a,onConfirm:i,onCancel:r})})}function sn(e,s){return L(()=>{const t=new Map(e.map(o=>[o.id,o])),a=new Set(s.flatMap(({addressIds:o})=>[...o])),i=e.filter(({id:o})=>!a.has(o)),r=s.map(({title:o,addressIds:d})=>({title:o,addresses:Array.from(d).flatMap(m=>{const f=t.get(m);return f?[f]:[]})}));return{ungroupedImmutableAddresses:i,groupedImmutableAddresses:r}},[e,s])}const es="addressSelector--",nn=hs("AddressSelector");function tn({id:e,selectedId:s="",addressType:t="shipping",onChange:a,onEdit:i,onDelete:r,onSetDefault:o,addresses:d,addressesTitle:m,immutableAddresses:f=[],immutableAddressSections:b=[],getAddressDisplayName:v,selectedAddressDetails:u}){const h=fs(e,nn),{i18n:l}=D(),[A,g]=me("idle"),S=ps(),C=L(()=>d.filter(P=>!P.disabled),[d]),p=L(()=>d.filter(P=>P.disabled),[d]),c=t==="shipping",_=gs(t),y=V(P=>(i||r)&&P===s,[i,r,s]),[z,R]=me(_),M=L(()=>i?{accessibilityLabel:c?l.translate("shipping.address_edit"):l.translate("billing.address_edit"),onClick:i,label:c?l.translate("shipping.edit"):l.translate("billing.edit")}:void 0,[i,c,l]),N=V(()=>(R(_),g("active")),[_]),B=L(()=>r?{accessibilityLabel:c?l.translate("shipping.address_delete"):l.translate("billing.address_delete"),onClick:N,label:c?l.translate("shipping.delete"):l.translate("billing.delete"),destructive:!0}:void 0,[r,c,l,N]),T=s?ss(s,h):void 0,ee=V(([P=""])=>{const k=an(P,h);k&&a(k)},[a,h]),{ungroupedImmutableAddresses:w,groupedImmutableAddresses:$}=sn(f,b),Y=d.length+f.length===1,j=c?l.translate("shipping.address_more"):l.translate("billing.address_more"),G=L(()=>[...M?[M]:[],...B?[B]:[]],[M,B]),ie=w.length>0&&d.length>0&&m,q=L(()=>T?[T]:[],[T]);return n(x,{children:[n(Ds,{name:`${t}Address`,values:q,onChange:ee,hideRadioControl:Y,selectedContentBackground:u?"selected":void 0,children:[n(ce,{addresses:w,formId:h,selectedId:s,isImmutable:!0,getAddressDisplayName:v,onSetDefault:o}),ie&&n(x,{children:[n(W,{blockSize:"base"}),n(X,{color:"subdued",children:m}),n(W,{blockSize:"base"})]}),n(ce,{addresses:C,formId:h,selectedId:s,shouldShowMoreOptionsButton:y,moreOptionsAccessibilityLabel:j,moreOptionsActions:G,getAddressDisplayName:v,onSetDefault:o,selectedAddressDetail
1s:u}),n(ce,{addresses:p,formId:h,selectedId:s,shouldShowMoreOptionsButton:y,moreOptionsAccessibilityLabel:j,moreOptionsActions:G,getAddressDisplayName:v,onSetDefault:o}),$.map(({title:P,addresses:k})=>n(ce,{title:P,addresses:k,formId:h,selectedId:s,isImmutable:!0,selectedAddressDetails:u},P))]}),r&&n(en,{state:A,title:c?l.translate("shipping.address_delete"):l.translate("billing.address_delete"),description:l.translate("address_management.confirm_address_deletion",{address:z}),onConfirm:async()=>{g("deleting"),await r(),S.current&&g("idle")},onCancel:()=>g("idle")})]})}function ss(e,s=""){return`${s}${es}${e}`}function an(e,s=""){return e.replace(`${s}${es}`,"")}function ce({title:e,addresses:s,formId:t,selectedId:a,isImmutable:i=!1,shouldShowMoreOptionsButton:r,moreOptionsAccessibilityLabel:o,moreOptionsActions:d,getAddressDisplayName:m,onSetDefault:f,selectedAddressDetails:b}){const v=s.map(u=>n(rn,{addressId:u.id,address:u.address,choiceValue:ss(u.id,t),disabled:u.disabled,isImmutableAddress:i,showMoreOptionsButton:!!r?.(u.id),moreOptionsAccessibilityLabel:o,moreOptionsActions:d,addressDisplayName:m?.(u.id),explicitlyPreferred:u.default,onSetDefault:f,isSelected:a===u.id,details:a===u.id?b:void 0},u.id));return e?n(x,{children:[n(W,{blockSize:"base"}),n(X,{color:"subdued",children:e}),n(W,{blockSize:"base"}),v]}):n(x,{children:v})}const rn=is(function({addressId:s,address:t,choiceValue:a,disabled:i=!1,isImmutableAddress:r=!1,showMoreOptionsButton:o=!1,moreOptionsAccessibilityLabel:d="",moreOptionsActions:m=[],addressDisplayName:f,explicitlyPreferred:b,onSetDefault:v,isSelected:u,details:h}){const l=Ve(Je),A=n(Cs,{value:a,disabled:i,selectedContent:h,selectedContentPadding:h?"none":void 0,secondaryContent:o&&!r&&n(Rs,{accessibilityLabel:d,options:m}),children:n(ye,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",alignItems:"center",alignContent:"center",children:n(Z,{gap:"small-400",children:n(Ks,{nameLinePosition:"inline",address:t,addressDisplayName:f,explicitlyPreferred:b,isImmutableAddress:r,onSetDefault:v,isSelected:u,showsMoreOptionsWhenSelected:!r&&m.length>0,showPhone:!0})})})},s);return l?A:n(ye,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr)",gridTemplateRows:"minmax(0, 1fr)",alignItems:"start",alignContent:"start",children:A},s)});function on({onClick:e,textLabel:s}){const{rollup:{action:{tone:t}={}}={}}=bs();return n(Te,{tone:t==="custom"?"custom":void 0,variant:"plain",textDecoration:"none",onClick:e,children:n(Z,{direction:"inline",gap:"small-100",alignItems:"center",children:[n(vs,{type:"plus",size:"base"}),n(X,{children:s})]})})}function ln({open:e,isEditing:s,address:t,addressType:a,onSave:i,onClose:r,id:o,saveText:d,cancelText:m,showSavedAddressSelector:f,combineViolationAndValidationErrors:b,addressErrorsSignal:v,addressSettings:u,modalSubtitle:h,showDefaultAddressCheckbox:l,errorBannerMessage:A}){const{i18n:g}=D(),S=a==="shipping",C=S?g.translate("address_management.address_form.add"):g.translate("billing.address_form.add_address"),p=S?g.translate("shipping.address_edit"):g.translate("billing.address_edit"),c=s?p:C,_=S?g.translate("address_management.address_form.save"):g.translate("billing.address_form.save"),y=S?g.translate("address_management.address_form.cancel"):g.translate("billing.address_form.cancel"),z=b===void 0?s:b,R=ze(()=>A?.value??void 0);return n(Ke,{open:e,heading:c,onHide:r,children:[h?n(x,{children:[n(te,{color:"subdued",children:h}),n(W,{blockSize:"base"})]}):null,n(Z,{gap:"base",children:[n(as,{when:R,children:M=>n(Ge,{tone:"critical",errorType:a==="shipping"?Me.DeliveryError:Me.PaymentError,children:n(te,{children:M})})}),t&&n(Ts,{id:o,editableAddress:t,addressType:a,saveText:d??_,cancelText:m??y,onSave:i,onSuccess:r,onCancel:r,showSavedAddressSelector:f,addressErrorsSignal:v,combineViolationAndValidationErrors:z,addressSettings:u,showDefaultAddressCheckbox:l})]})]})}function dn({id:e,addressType:s="shipping",onSave:t,onAddAction:a,showSavedAddressSelector:i=!0,addressErrorsSignal:r,errorBannerMessage:o,showNewAddressButton:d=!0,combineViolationAndValidationErrors:m,addressSettings:f,modalSubtitle:b,showDefaultAddressCheckbox:v=!1,hideAddressModal:u=!1}){const{i18n:h}=D(),{createAddressParts:l}=Pe(),A=l.addressModalState.value,g=s==="shipping",S=A.status==="editing",C=A.addressType===s&&(A.status==="editing"||A.status==="adding"),p=!u&&C,c=()=>{o&&(o.value=void 0),l.addressModalState.value={status:"idle",addressType:s,address:A.address,setAsDefault:"default"}},_=g?h.translate("shipping.add_address"):h.translate("billing.add_address");return n(x,{children:[d&&n(on,{onClick:a,textLabel:_}),n(ln,{open:p,isEditing:S,address:A.address,addressType:s,onSave:t,onClose:c,id:e,showSavedAddressSelector:i,addressErrorsSignal:r,errorBannerMessage:o,c
1ombineViolationAndValidationErrors:m,addressSettings:f,modalSubtitle:b,showDefaultAddressCheckbox:v})]})}class ue extends Error{constructor(s,t){super(s),this.name="InvalidSelectedAddressError",this.groupingHash="AddressEdit::InvalidSelectedAddressError",this.name="InvalidSelectedAddressError",this.groupingHash=t}}function kn({addressType:e,addresses:s,immutableAddresses:t=[],immutableAddressSections:a=[],addressesTitle:i,selectedAddress:r,onSelectAddress:o,onCreateAddress:d=async()=>{},onUpdateAddress:m=async()=>{},onDeleteAddress:f=async()=>!1,onSetDefault:b=async()=>!1,addressErrorsSignal:v,canCreateAddress:u=!1,canUpdateAddress:h=!1,canDeleteAddress:l=!1,canSetDefaultAddress:A=!1,getAddressDisplayName:g,addressSettings:S,modalSubtitle:C,canChangeCompanyLocation:p=!1,createAddressFormId:c,errorBannerMessage:_,noticesSection:y="delivery",selectedAddressDetails:z,showNotices:R=!0,onBeforeSelectAddress:M,onBeforeCreateAddress:N,onBeforeUpdateAddress:B,onBeforeDeleteAddress:T,hideAddressModal:ee=!1}){const{createAddressParts:w}=Pe(),{checkout:$,i18n:Y,observability:j}=D(),{extendedAddressMode:G}=$.address,ie=e==="shipping"&&$.proposal.negotiated.fields.mustSelectProvidedAddress.value,{defaultShippingDetails:q}=$.configuration.addressSettings.nonBillingAddressSettings.value,P=q.country.code,k=L(()=>s.map(Re),[s]),J=L(()=>t.map(Re),[t]),H=L(()=>k.filter(I=>!I.disabled),[k]),[oe,he]=me(0),K=V(I=>{const F=[...H,...J],U=F.find(({id:O})=>O===I);if(!U){const O=F.map(({id:Q})=>Q).join(",");j.error(new ue(`Unexpected address id: '${I}' not found in choices ${O}`,"AddressEdit::handleChange::InvalidSelectedAddressError"));return}if(M){let O=!1;M(U,()=>{O=!0,o(U)}),O||he(Q=>Q+1)}else o(U)},[H,J,o,M,j]),be=V(()=>{if(!r)throw new ue("Attempted to edit an address without a selected address","AddressEdit::handleEditAction::InvalidSelectedAddressError");w.addressModalState.value={status:"editing",address:Le(r.address,{extendedAddressMode:G}),addressType:e,addressId:r.id,setAsDefault:r.default?"default":"disabled"}},[r,e,w.addressModalState,G]),le=V(()=>{const I=H?.[0],F=Le({firstName:I?.address.firstName,lastName:I?.address.lastName,countryCode:P??I?.address.countryCode},{extendedAddressMode:G});w.addressModalState.value={status:"adding",address:F,addressType:e,setAsDefault:"disabled"}},[e,H,w.addressModalState,P,G]),de=V(async()=>{if(!r)throw new ue("Attempted to delete an address without a selected address","AddressEdit::handleDelete::InvalidSelectedAddressError");const I=r.id;return T?T(I,()=>f(I)):f(I)},[f,T,r]),ve=V(async I=>{const F=w.addressModalState.value,U=F.setAsDefault==="enabled";if(F.status==="adding"){const O={address:I,setDefault:U};return N?N(O,()=>d(O)):d(O)}if(F.status==="editing"){const Q={id:F.addressId,address:I,setDefault:U};return B?B(Q,()=>m(Q)):m(Q)}},[w.addressModalState,d,m,N,B]),ae=V(async()=>{if(!r)throw new ue("Attempted to set a default address without a selected address","AddressEdit::handleSetDefault::InvalidSelectedAddressError");r.default||await b(r.id)},[b,r]),Ae=l&&H.length>1,_e=u||h,E=w.addressModalState.value,re=E.status==="editing"&&k.some(({id:I})=>I===E.addressId),se=A&&(E.status!=="editing"||re);return n(Z,{gap:"base",children:[R&&n(As,{section:y}),ie?n(_s,{tone:"info",children:Y.translate("address_management.must_use_address_banner")}):null,n(tn,{id:e==="shipping"?"shippingAddressSelector":void 0,addressType:e,selectedId:r?.id,onChange:K,onEdit:h?be:void 0,getAddressDisplayName:g,addresses:k,addressesTitle:i,immutableAddresses:J,immutableAddressSections:a,onDelete:Ae?de:void 0,onSetDefault:A?ae:void 0,selectedAddressDetails:z},oe),p&&n(pe,{padding:"none small-100",children:n(Os,{showIcon:!0})}),_e&&n(pe,{padding:"none small-100",children:n(dn,{id:c,addressType:e,onSave:ve,onAddAction:le,showNewAddressButton:u,showSavedAddressSelector:!1,addressErrorsSignal:v,errorBannerMessage:_,modalSubtitle:C,addressSettings:S,showDefaultAddressCheckbox:se,hideAddressModal:ee})})]})}function Re(e){return{...e,id:e.id?e.id:Fs(e.address)}}function cn(e,s,t,a){return e==="billing"?t?s.find(i=>Bs(i.address,t,["phone","firstName"]))??null:null:a??null}const ns=e=>!e.firstName?.trim();function un(e,s,t){const a=e.selectedPaymentMethod.value;if(!a||!He(a))return;const i=a.paymentAttributes.billingAddress.address;!ns(i)||!Ee(i,s)||e.selectPaymentMethod({...a,paymentAttributes:{...a.paymentAttributes,billingAddressValid:t,billingAddress:{...a.paymentAttributes.billingAddress,address:{...i,firstName:s.firstName}}}})}function mn(e,s,t){Ce(()=>{for(const a of e.paymentMethods.value){if(!He(a))continue;const{billingAddress:i}=a.paymentAttributes;!ns(i.address)||!Ee(i.address,s)||e.updateCreditCard(a.id,{billingAddressValid:t,billingAddress:{...i,address:{...i.address,firstName:s.firstName}}})}})}function Oe(e,s,t,a){un(e,t,a),mn(s,t,a)}function fn({enabled:e,addressType:s,onPersistSuccess:t}){const{i18n:a,shopPay:i,observability:r,checkout:o}=D(),d=ge(),{lastJourneyProgression:m,lastNegotiation:f}=ks(),b=o.validation.missingFields.firstName.input,v=o.validation.missingFields.firstName.error,u=s==="billing"?Ls:xs;function h(p){const c=p.peek();if(!("violations"in c))return;const _=c.violations.filter(y=>
1!u.has(y.code));_.length!==c.violations.length&&(p.value={...c,violations:_})}function l(){v.value="";const p=s==="billing"?o.addressManager.billing.value:o.addressManager.shipping.value;p.errors.fields.firstName.value=void 0,h(m),h(f)}function A(p){const c=d.billingAddress.value;if(!c)return{success:!1,location:"first_name_no_address"};const _={...c,firstName:p};return d.billingAddress.value=_,l(),t?.(),{success:!0}}function g(p,c){const _={...p,address:{...p.address,firstName:c}};return s==="billing"?(i.session.unstable_updateSelectedBillingAddress(_),d.billingAddress.value=_.address):(i.session.unstable_updateSelectedShippingAddress(_),d.shippingAddress.value=_.address,S(_)),l(),t?.(),{success:!0}}function S(p){const c=i.session.selectedBillingAddress.value;!c||c.id!==p.id||Ee(c.address,p.address)&&(i.session.unstable_updateSelectedBillingAddress(p),d.billingAddress.value=p.address)}async function C(p,c,_){const y=_==="billing",z=y?o.addressManager.billing.value:o.addressManager.shipping.value,R={...p,address:{...p.address,firstName:c}},M=await z.updateAddress({id:p.id,address:R.address}),N=i.user.addresses.value.find(B=>B.id===p.id)??R;return M?(y?(d.billingAddress.value=M.address,Oe(i.session,i.user,N.address,N.valid)):(S(N),Oe(i.session,i.user,N.address,N.valid)),l(),t?.(),{success:!0}):(r.leaveErrorBreadcrumb("Shop Pay update address first name failed"),v.value=a.translate("field_errors.address_generic_error"),{success:!1,location:"first_name_update_failed"})}Ye("firstName",async()=>{if(!e)return{success:!0};const p=b.value.trim();if(!p)return v.value=a.translate("field_errors.address_first_name_blank"),{success:!1,location:"first_name_blank"};const c=cn(s,i.user.addresses.value,d.billingAddress.value,i.session.selectedShippingAddress.value);return c?i.user.addresses.value.some(y=>y.id===c.id)?C(c,p,s):g(c,p):s==="billing"?A(p):{success:!1,location:"first_name_no_address"}})}function pn({addressType:e="shipping",onPersistSuccess:s}={}){const{i18n:t,checkout:{validation:a},shopPay:i}=D(),{isMissingFirstName:r}=Qe({addressType:e}),o=ge(),d=ze(()=>{const l=e==="billing"?i.session.selectedBillingAddress.value:i.session.selectedShippingAddress.value;return l?.id===ws?l:l?.id??(e==="billing"?o.billingAddress.value:o.shippingAddress.value)}),m=a.missingFields.firstName.input,f=a.missingFields.firstName.error;fn({enabled:r,addressType:e,onPersistSuccess:s}),$e(()=>{if(d.value)return()=>{m.value="",f.value=""}});const b=V(l=>{if(!Ne(l))return t.translate("field_errors.address_first_name_blank")},[t]),v=Ue(m,f,b);We(m,f,b);const u=f.value,h=je(u)?u.message:u;return n(Ss,{name:"firstName",label:t.translate("contact.first_name_label"),required:!0,autocomplete:"given-name",...v,error:v.error||h})}function ts(e,s,t){return Ne(e)?t(e,s)?{isValid:!0}:{isValid:!1,reason:"phone_invalid"}:{isValid:!1,reason:"phone_blank"}}const gn={id:"fb48dec1806e3e11b7375d723d9e47d5006dda9d3285b2f42dc9138fade9163b",type:"mutation",name:"AddPhone",source:"mutation AddPhone($phone:String!,$payAddressUuid:String){addPhone(phone:$phone,payAddressUuid:$payAddressUuid){userErrors{field message __typename}__typename}}"};function hn(e,s,{enabled:t,addressType:a="shipping"}){const{i18n:i,graphql:{shopPayGraphql:r},shopPay:o,observability:d}=D(),m=ge(),{formatPhoneNumber:f,validatePhoneNumber:b}=Ze(),u=(a==="billing"?m.billingAddress.value:m.shippingAddress.value)?.countryCode,h=L(()=>An({graphql:r,observability:d}),[r,d]);Ye("phone",async()=>{if(!t)return{success:!0};const l=ts(s.value,u,b);if(!l.isValid)return e.value=vn(l.reason,i),{success:!1,location:l.reason};e.value=void 0;const A=f(s.value,u);if(!A)return e.value=i.translate("field_errors.shipping_line_phone_invalid"),{success:!1,location:"phone_format_failed"};const g=a==="billing"?o.session.selectedBillingAddress.value?.uuid:o.session.selectedShippingAddress.value?.uuid;return await h(A,g)?(o.user.unstable_setPhoneNumber(A),{success:!0}):(e.value=i.translate("field_errors.shipping_line_phone_invalid"),{success:!1,location:"add_phone_mutation_failed"})})}function bn({addressType:e="shipping"}={}){const{i18n:s,checkout:{validation:t}}=D(),a=ge(),{validatePhoneNumber:i}=Ze(),{isMissingPhone:r}=Xe({addressType:e}),d=(e==="billing"?a.billingAddress.value:a.shippingAddress.value)?.countryCode,m=t.missingFields.phone.input,f=t.missingFields.phone.error,b=t.missingFields.phone.isValid;hn(f,m,{enabled:r,addressType:e}),$e(()=>{const g=ts(m.value,d,i);b.value=g.isValid}),ne(()=>()=>{b.value=!0,f.value=""},[b,f]);const v=V(g=>{if(!Ne(g))return s.translate("field_errors.phone_blank");if(!i(g??"",d))return s.translate("field_errors.shipping_line_phone_invalid")},[i,d,s]),{onInput:u,...h}=Ue(m,f,v);We(m,f,v);const l=f.value,A=je(l)?l.message:l;return n($s,{name:"phone",countryCode:d??"",label:s.translate("contact.phone_label"),prefillCountryCode:!0,required:!0,autocomplete:e==="billing"?"billing tel-national":"shipping tel-national",...h,onInput:g=>{u?.(g),m.value=g??""},error:h.error||A})}
1function vn(e,s){return e==="phone_blank"?s.translate("field_errors.phone_blank"):s.translate("field_errors.shipping_line_phone_invalid")}function An({graphql:e,observability:s}){return async(t,a)=>{const{data:i,error:r}=await e.mutate(gn,{variables:{phone:t,payAddressUuid:a}});return r||i==null||i.addPhone==null?(s.leaveErrorBreadcrumb("Shop Pay add phone mutation failed with a transport or null-response error"),!1):i.addPhone.userErrors?.length>0?(s.leaveErrorBreadcrumb("Shop Pay add phone mutation returned user errors",{userErrors:JSON.stringify(i.addPhone.userErrors)}),!1):!0}}function Ln({addressType:e="shipping",onFirstNamePersisted:s}={}){const{isMissingPhone:t}=Xe({addressType:e}),{isMissingFirstName:a}=Qe({addressType:e});return!t&&!a?null:n(pe,{paddingInline:"base",paddingBlockStart:"small-200",paddingBlockEnd:"base",children:n(Z,{direction:"block",gap:"base",children:[a&&n(pn,{addressType:e,onPersistSuccess:s}),t&&n(bn,{addressType:e})]})})}export{kn as A,Ts as C,Ln as M,on as a,en as b,tn as c,Ks as d};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.