import{T as e,m as s,q as t,t as a,z as o,B as n,h as l,u as r}from"./2c1ab0fe.Dbn2KvkT.js";import{jC as c,og as i,bU as u,bb as d,d as p,w as g,aF as h,h9 as m,bS as y,ch as b,ha as _,hb as f,aa as v,bg as k,d1 as P,o_ as C,dV as w}from"./4b4bc88f.z1yoAwwH.js";import{ci as I,aR as A,ir as x,bt as E,bZ as S,b_ as M,M as L,b7 as U,ad as B,ae as R,gi as T,is as D}from"./164ad2e3.FTBuhkTQ.js";import{i as N}from"./c6b02d73.Ba1sudbg.js";const O=()=>{const a=I(),o=c(),n=i("STORE_CREDIT"),l=u(),r=d("deliveryNext"),p=e(null),g=s(()=>({giftCard:o.value,storeCredit:n.value,redeemables:l.value,freeOrder:!a.value}));return t(()=>{r.value||(p.current=g.value)}),s(()=>{const e=g.value;return r.value?p.current??e:e})};function q(){const{shopPay:e,checkout:s}=p(),{paymentMethods:t}=s.negotiator.current.fields,o=s.installments.paymentMethodMustSupportInterestBearingLoans;return{creditCardDisabled:a(s=>N(s,t,e.session.isInstallmentsSelected,o),[t,o,e.session.isInstallmentsSelected])}}const V={id:"fdc8128f690860079c498a10b90912e0f80562eb838162c450f12b65d69b0389",type:"query",name:"MsiCardEligibility",source:"query MsiCardEligibility($checkoutContextInput:CheckoutContextInput!){checkoutSession(checkoutContextInput:$checkoutContextInput){user{paymentMethods{...on CreditCard{id msiEligible __typename}__typename}__typename}__typename}}"},z=Object.freeze({}),Y=A(({checkout:e,graphql:s,shop:t,shopPay:a,source:l})=>{const r=e.proposal.negotiated.fields,c=o(()=>r.buyerIdentity.value?.presentmentCurrency),i=o(()=>m(r.paymentMethods.value??[])),u=o(()=>"shopPay"!==e.identity.current.value||!i.value||"MXN"!==c.value),d=o(()=>a.user.paymentMethods.value.filter(y).map(e=>e.id).sort().join(",")),p=s.shopPayGraphql.query(V,{variables:{checkoutContextInput:{checkoutVersion:h({source:l}),checkoutIdentifier:l.checkoutSessionIdentifier??"unknown",shopifyDomain:t.myshopifyDomain,shopId:g(t.id)}},skip:()=>u.value});let b=d.peek(),_=c.peek();return n(function(){const e=d.value,s=c.value,t=e!==b||s!==_;b=e,_=s,t&&!u.peek()&&p.refetch({deduplicate:!0})}),{eligibilityByCardId:o(()=>{if(u.value)return z;const e=p.data.value?.checkoutSession?.user?.paymentMethods;if(!e)return z;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 j(e){if("wallet"!==e?.method.type)return!1;switch(e.method.name){case"APPLE_PAY":return f(e);case"GOOGLE_PAY":return _(e);case"PAYPAL_EXPRESS":return b(e);default:return!1}}const G=x.get("base")??0;function X({children:e,open:s=!1,...t}){const a="entered"===E(s,"slow"),{isAppLayout:o}=S(),n=M(),{checkout:{negotiator:c}}=p(),{checkoutProtocolModalEventSignal:i}=c.context;return l(()=>{const e=e=>{i.value="modal_open"===e?"redesign":"none",n.notify({checkout_ui:{type:e,payload:{duration:G}}})};if(a&&o)return e("modal_open"),()=>{e("modal_close")}},[a,o,n,i]),r(L,{size:"large",open:s,...t,children:e})}function W(){const e=U(),{shopPay:s,checkout:{address:t,negotiator:a}}=p(),{value:o}=a.current.fields.paymentMethods,{billingAddress:n,billingAddressOption:l}=a.parts,r=v("shipping"===l.value?e.value:n.value,{extendedAddressMode:t.extendedAddressMode}),{eligibilityByCardId:c}=k(Y),i=s.session.selectedPaymentMethod.value,u=P(o),d=!(null==i||!y(i))&&(c.value[i.paymentAttributes.id]??!1);return({sessionToken:e,creditCardInstallments:t,msiEligibleCard:a=d}={})=>{const n=s.session.hsaRequested.peek();return{method:{type:"wallet",name:"SHOP_PAY",walletContent:{paymentMethod:"CREDIT_CARD",sessionToken:e,billingAddress:r,paymentMethodIdentifier:C(o),...null!=t&&t>0&&{creditCardInstallments:t},...a&&{msiEligibleCard:a},...u&&{hsaRequested:n}}}}}}x.get("slow");const J="/cdn/shopifycloud/checkout-web/assets/c1/assets/applepay-logo.BVeJpuwf.svg",H={walletLogo:"e5syv",xxxsmall:"_7NPtB",xxsmall:"XGA28",xsmall:"gKSKB",small:"DWmRr",medium:"RULId",large:"SMmkH",AmazonPayLogoVerticalAlignment:"EpCJ3",BuyWithPrimeLogoVerticalAlignment:"_705vE",ShopPayLogoVerticalAlignment:"Zxnlh"};function K({size:e="medium",wallet:s,invertColor:t=!1}){const a=B(),o=R(a);let n=T();t&&(n="light"===n?"dark":"light");const{i18n:l,observability:c}=p(),i={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:l.translate("brand.amazon_pay")},APPLE_PAY:{iconUrl:J,lightIconUrl:J,altText:l.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:l.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:l.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:l.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?l.translate("brand.venmo"):l.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:l.translate("brand.shop_pay")}}[s];if(!i)return c.log("wallet_logo_unsupported_wallet_encountered","Unsupported wallet type in WalletLogo",{wallet:s,severity:"warning"}),null;const u="light"===n?i.lightIconUrl:i.iconUrl,d=[H.walletLogo,H[e],i.customClassName&&H[i.customClassName]].filter(Boolean).join(" ");return r("img",{src:u,className:d,alt:i.altText})}function Q(){const{i18n:e}=p(),{isWebLayout:s}=S();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:r(D,{})}),target:w}:{message:e.translate("payment_errors.processing_error"),target:w}}function Z(...s){const[t,a]=s,o=e(a),{shopPay:{progressInterceptor:n}}=p();o.current=a,l(()=>n.intercept(t,()=>o.current()),[n,t])}export{G as M,X as O,Y as S,K as W,q as a,Z as b,Q as c,W as d,j as i,O as u};