import{al as e,u as a,d as t,mk as s,bv as r,oW as o,bW as n,oX as u,hf as i,oY as l,kR as c,jC as d,og as f,bU as m}from"./4b4bc88f.z1yoAwwH.js";import{m as p}from"./2c1ab0fe.Dbn2KvkT.js";import{ci as v,dZ as C,cn as h}from"./164ad2e3.FTBuhkTQ.js";const R=e("ShopCashContext"),E=R.Provider,T=()=>a(R),b=()=>{const{shopPay:e,checkout:{negotiator:a}}=t(),r=v(),o=C(),n=a.parts.paymentLines;return p(()=>{const a=n.value,t=e.user.paymentMethods.value,u=e.session.selectedPaymentMethod.value;if(!r.value)return;const i=s(a);return i&&"CREDIT_CARD"!==i?i:o.value?.payment?"CREDIT_CARD"===s(a)?"CREDIT_CARD":y(u,t):s(a)})},y=(e,a)=>{if(e||a.length)return e&&r(e)||o(a)?"APPLE_PAY":e&&n(e)||u(a)?"IDEAL":e&&i(e)||l(a)?"CUSTOM_ONSITE":"CREDIT_CARD"};function D({checkout:e,shopPay:a}){return"shopPay"===e.identity.current.value&&!a.isExternal&&"web"===a.app.config.surface&&!a.app.config.version&&!c(e.proposal.negotiated.fields.customAttributes.value)}function P(e){return"treatment"===e.shopPay.installments.paymentMethodRequirementRemovalVariant.value&&"authenticated_user"===e.shopPay.user.flow.value&&D(e)}const g=new Set(["giftCard","freeOrder","storeCredit","redeemables"]);function _(e){return null!==e&&g.has(e)}function A(){const e=v(),a=d(),s=f("STORE_CREDIT"),r=m(["CUSTOM","STORE_CREDIT"]),o=h(),{checkout:{negotiator:n}}=t(),u=n.current.fields.deferredTotal;return p(()=>e.value?a.value?"giftCard":s.value?"storeCredit":r.value?"redeemables":o.value&&!u.value?.amount.amount?"deferred":null:"freeOrder")}export{R as S,A as a,T as b,P as c,E as d,D as e,_ as i,b as u};