import{Ht as e,It as s,Jt as t,Lt as a,Pt as o,Xt as n,jt as r,nn as i,pt as l,yt as c}from"./630ba094.L_X-5TXi.js";import{$w as d,$y as u,Ac as p,Bl as h,Cu as m,EE as g,Eo as y,Fo as f,JD as b,JO as v,Nb as _,SO as k,Ss as P,Su as w,Tp as C,Uf as A,Xg as I,Xu as x,Zd as E,_u as S,al as D,dk as M,gf as R,gu as L,hg as T,iA as U,ip as N,kd as O,mb as B,mg as W,mu as Y,pb as q,pd as V,pg as X,rd as z,rf as J,sh as j,th as G,tw as H,ux as $,vu as K,wb as Q,wu as Z,xO as F,yg as ee}from"./6ec9a0fa.rdcQt2v8.js";import{t as se}from"./173d1fdf.ANJvZbGg.js";import{t as te}from"./0d85278a.CTy9dP2P.js";function ae(){const{i18n:e}=F(),{isWebLayout:s}=h();return({offerGuestCheckout:t=!1}={})=>t&&s?{message:e.translate("payment_errors.processing_error_checkout_as_guest",{checkout_as_guest_link:e.translate("account_management.checkout_as_guest_link")}),messageNode:e.translate("payment_errors.processing_error_checkout_as_guest",{checkout_as_guest_link:c(V,{})}),target:d}:{message:e.translate("payment_errors.processing_error"),target:d}}function oe({checkout:e,shopPay:s}){return"shopPay"===e.identity.current.value&&!s.isExternal&&"web"===s.app.config.surface&&!s.app.config.version&&!j(e.proposal.negotiated.fields.customAttributes.value)}function ne(e){return e.shopPay.installments.cardlessCheckoutQualified.value&&"authenticated_user"===e.shopPay.user.flow.value&&oe(e)}var re="/cdn/shopifycloud/checkout-web/assets/c1/assets/applepay-logo.BVeJpuwf.svg",ie={walletLogo:"e5syv",xxxsmall:"_7NPtB",xxsmall:"XGA28",xsmall:"gKSKB",small:"DWmRr",medium:"RULId",large:"SMmkH",AmazonPayLogoVerticalAlignment:"EpCJ3",BuyWithPrimeLogoVerticalAlignment:"_705vE",ShopPayLogoVerticalAlignment:"Zxnlh"};function le({size:e="medium",wallet:s,invertColor:t=!1}){const a=J(),o=E(a);let n=u();t&&(n="light"===n?"dark":"light");const{i18n:r,observability:i}=F(),l={amazon_pay:{iconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/apay-logo.qbCmTpxR.svg",customClassName:"AmazonPayLogoVerticalAlignment",lightIconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/apay-logo-light.BOpRNbfJ.svg",altText:r.translate("brand.amazon_pay")},APPLE_PAY:{iconUrl:re,lightIconUrl:re,altText:r.translate("brand.apple_pay")},APPLE_PAY_BORDERLESS:{iconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/applepay-logo-borderless.BpIqGUgE.svg",lightIconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/applepay-logo-borderless-light.D4uI0NI6.svg",altText:r.translate("brand.apple_pay")},buy_with_prime:{iconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/bwp-logo.BRDn9X4f.svg",customClassName:"BuyWithPrimeLogoVerticalAlignment",lightIconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/bwp-logo-light.Be3NC6rq.svg",altText:r.translate("brand.buy_with_prime")},GOOGLE_PAY:{iconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/gpay-logo.BbJVlra3.svg",lightIconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/gpay-logo-light.B_DsI0cq.svg",altText:r.translate("brand.google_pay")},PAYPAL_EXPRESS:{iconUrl:o?"/cdn/shopifycloud/checkout-web/assets/c1/assets/venmo-logo.DabXQIZQ.svg":"/cdn/shopifycloud/checkout-web/assets/c1/assets/paypal-logo.Q2f7XzPy.svg",lightIconUrl:o?"/cdn/shopifycloud/checkout-web/assets/c1/assets/venmo-logo-light.Nme_SAlP.svg":"/cdn/shopifycloud/checkout-web/assets/c1/assets/paypal-logo-light.Do6ddnMD.svg",altText:o?r.translate("brand.venmo"):r.translate("brand.paypal")},SHOP_PAY:{iconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/shop-pay-logo.yJ-5VMKh.svg",customClassName:"ShopPayLogoVerticalAlignment",lightIconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/shop-pay-logo-light.Ts-yoc2V.svg",altText:r.translate("brand.shop_pay")},SHOP_PAY_WORDMARK:{iconUrl:P,lightIconUrl:"/cdn/shopifycloud/checkout-web/assets/c1/assets/shop-pay-wordmark-light.CJCUoMi-.svg",altText:r.translate("brand.shop_pay")}}[s];if(!l)return i.log("wallet_logo_unsupported_wallet_encountered","Unsupported wallet type in WalletLogo",{wallet:s,severity:"warning"}),null;const d="light"===n?l.lightIconUrl:l.iconUrl,p=[ie.walletLogo,ie[e],l.customClassName&&ie[l.customClassName]].filter(Boolean).join(" ");return c("img",{src:d,className:p,alt:l.altText})}function ce(){const{shopPay:e,checkout:s}=F(),{paymentMethods:t}=s.negotiator.current.fields,a=s.installments.paymentMethodMustSupportInterestBearingLoans;return{creditCardDisabled:n(s=>se(s,t,e.session.isInstallmentsSelected,a),[t,a,e.session.isInstallmentsSelected])}}var de=()=>{const{shopPay:e,checkout:{negotiator:s}}=F(),t=ee(),a=D(),n=s.parts.paymentLines;return o(()=>{const s=n.value,o=e.user.paymentMethods.value,r=e.session.selectedPaymentMethods.value[0];if(!t.value)return;const i=y(s);return i&&"CREDIT_CARD"!==i?i:a.value?.payment?"CREDIT_CARD"===y(s)?"CREDIT_CARD":ue(r,o):y(s)})},ue=(e,s)=>{if(e||s.length)return e&&Y(e)||w(s)?"APPLE_PAY":e&&K(e)||Z(s)?"IDEAL":e&&S(e)||m(s)?"CUSTOM_ONSITE":"CREDIT_CARD"},pe={id:"fdc8128f690860079c498a10b90912e0f80562eb838162c450f12b65d69b0389",type:"query",name:"MsiCardEligibility",source:"query MsiCardEligibility($checkoutContextInput:CheckoutContextInput!){checkoutSession(checkoutContextInput:$checkoutContextInput){user{paymentMethods{...on CreditCard{id msiEligible __typename}__typename}__typename}__typename}}"},he=Object.freeze({}),me=R(({checkout:s,graphql:t,shop:o,shopPay:n,source:r})=>{const i=s.proposal.negotiated.fields,l=a(()=>i.buyerIdentity.value?.presentmentCurrency),c=a(()=>$(i.paymentMethods.value??[])),d=a(()=>"shopPay"!==s.identity.current.value||!c.value||"MXN"!==l.value),u=a(()=>n.user.paymentMethods.value.filter(L).map(e=>e.id).sort().join(",")),p=t.shopPayGraphql.query(pe,{variables:{checkoutContextInput:{checkoutVersion:f({source:r}),checkoutIdentifier:r.checkoutSessionIdentifier??"unknown",shopifyDomain:o.myshopifyDomain,shopId:b(o.id)}},skip:()=>d.value});let h=u.peek(),m=l.peek();return e(function(){const e=u.value,s=l.value,t=e!==h||s!==m;h=e,m=s,t&&!d.peek()&&p.refetch({deduplicate:!0})}),{eligibilityByCardId:a(()=>{if(d.value)return he;const e=p.data.value?.checkoutSession?.user?.paymentMethods;if(!e)return he;const s={};for(const t of e)"CreditCard"===t.__typename&&(s[t.id]=t.msiEligible??!1);return s}),error:p.error,loading:p.loading}});function ge(e){if("wallet"!==e?.method.type)return!1;switch(e.method.name){case"APPLE_PAY":return _(e);case"GOOGLE_PAY":return q(e);case"PAYPAL_EXPRESS":return B(e);default:return!1}}var ye=()=>{const e=ee(),a=X(),n=W("STORE_CREDIT"),r=T(),i=Q("deliveryNext"),l=t(null),c=o(()=>({giftCard:a.value,storeCredit:n.value,redeemables:r.value,freeOrder:!e.value}));return s(()=>{i.value||(l.current=c.value)}),o(()=>{const e=c.value;return i.value?l.current??e:e})};function fe(e){return e?!0===e?"always":e:"never"}function be({children:e,hideDivider:s,dividerDisplay:t,after:a,className:o,...n}){const{section:l}=G(F().checkout).main.value,d=fe(te(s)),u="whenEmpty"===d?"_0AAq3":void 0;return c(i,{children:[c(A,{borderRadius:l?.cornerRadius,colorScheme:l?.colorScheme,containerName:"s-shell-section",className:r(u,o),...n,children:e}),a,c(Ce,{hideDivider:d,dividerDisplay:t})]})}function ve({condition:e,children:s,after:t,...a}){return te(e)?c(be,{...a,after:t,children:s}):c(i,{children:[s,t]})}function _e({min:e,max:s,children:t,...a}){const o=g(),n=we(e?{min:e}:{max:s}),r=we(e?{max:e}:{min:s}),d=we(e?{min:e}:{max:s}),u=U(s?{base:!0,[s]:!1}:{base:!1,[e]:!0});return c(l,{when:o,fallback:c(i,{children:[c(be,{...a,display:n,dividerDisplay:d,children:t}),c(I,{display:r,children:t})]}),children:u?c(be,{...a,children:t}):c(I,{children:t})})}function ke({condition:e,...s}){const{hideDivider:t,children:a,after:o}=s;return te(e)?c(be,{...s}):c(i,{children:[a,o,"always"!==fe(te(t))&&c(Pe,{})]})}function Pe({spacing:e="large-400",showDivider:s,borderStyle:t,borderWidth:a,display:o}){return c(I,{display:o,className:"gfFXW",paddingBlockStart:e,paddingBlockEnd:s?e:void 0,children:s&&c(N,{borderStyle:t,borderWidth:v(a)})})}function we(e){return e.min?"base"===e.min?"none":`@media (inline-size >= ${e.min}) block, none`:e.max?"base"===e.max?"auto":`@media (inline-size >= ${e.max}) none, auto`:"none"}function Ce({hideDivider:e,dividerDisplay:s}){const{divider:{borderStyle:t,borderWidth:a}}=M(),{spacing:o,divider:{visibility:n,borderStyle:r=t,borderWidth:i=a}={}}=G(F().checkout).main.value;return"always"===e?null:c(Pe,s?{display:s,spacing:C(o),showDivider:"visible"===n,borderStyle:r,borderWidth:i}:{spacing:C(o),showDivider:"visible"===n,borderStyle:r,borderWidth:i})}function Ae(){const e=O(),{shopPay:s,checkout:{address:t,negotiator:a}}=F(),{eligibilityByCardId:o}=k(me);return n(({sessionToken:n,creditCardInstallments:r,msiEligibleCard:i}={})=>{const l=s.session.selectedPaymentMethods.value[0];if("SHOP_PAY_BALANCE"===l?.paymentMethod)return{method:{type:"wallet",name:"SHOP_PAY",walletContent:{...H,...n&&{sessionToken:n}}}};const{billingAddress:c,billingAddressOption:d}=a.parts,u=z("shipping"===d.value?e.value:c.value,{extendedAddressMode:t.extendedAddressMode}),h=i??(!(null==l||!L(l))&&(o.value[l.paymentAttributes.id]??!1)),m=s.session.hsaRequested.value,g=a.current.fields.paymentMethods.value,y=p(g);return{method:{type:"wallet",name:"SHOP_PAY",walletContent:{paymentMethod:"CREDIT_CARD",sessionToken:n,billingAddress:u,paymentMethodIdentifier:x(g),...null!=r&&r>0&&{creditCardInstallments:r},...h&&{msiEligibleCard:h},...(y||m)&&{hsaRequested:y&&m}}}}},[t.extendedAddressMode,e,o,a,s])}export{ke as a,ye as c,de as d,ce as f,ae as g,oe as h,_e as i,ge as l,ne as m,Ce as n,be as o,le as p,ve as r,Pe as s,Ae as t,me as u};