import{F as N,m as y,Q as S,R as r,_ as b,W as g,P as c,X as l,a1 as n,T as d,a2 as h,a0 as p,Z as F,e as t,Y as w,bq as W,a5 as G}from"./vendor-sJIIH5Cr.js";import{b5 as L,a3 as R,bJ as M}from"./index-BGo1APpE.js";import{_ as J}from"./address-selection.vue_vue_type_script_setup_true_lang-BLGxNoJe.js";import{u as Q}from"./useCheckout-vKY3Jg1X.js";import{_ as X}from"./payment-processing-cyber-source.vue_vue_type_script_setup_true_lang-CDGhMqrK.js";const Y=N({__name:"payment",props:{hidePaymentButton:{type:Boolean},payment:{},disabled:{type:Boolean},cart:{},order:{}},setup(e){const o=e,m=y(()=>o.payment?.paymentGatewayCode||o.order?.inPayments[0].paymentMethod?.typeName||o.cart?.payments[0]?.paymentGatewayCode);return(C,_)=>(r(),S("div",null,[m.value==="CyberSourcePaymentMethod"?(r(),b(X,{key:0,order:e.order,cart:e.cart,"hide-payment-button":e.hidePaymentButton,disabled:e.disabled,payment:e.payment},null,8,["order","cart","hide-payment-button","disabled","payment"])):g("",!0)]))}}),Z={class:"flex flex-col gap-6 lg:flex-row lg:gap-8"},j={class:"lg:w-3/5"},H={class:"space-y-3 lg:w-2/5"},K={class:"flex items-center gap-3 p-3 text-sm"},ee=["data-selected-payment-method-id"],ae=["data-payment-method-id"],oe=N({__name:"billing-details-section",props:{disabled:{type:Boolean},cart:{}},setup(e){const o=e,{allItemsAreDigital:m,availablePaymentMethods:C,availableShippingMethods:_}=L(),{isAuthenticated:z}=R(),v=y(()=>A.value?.code===M||_.value.length===1&&_.value[0].code===M),B=y(()=>{const a=o.cart;return a&&a.payments&&a.payments.length>0?a.payments[0]:null}),x=y(()=>z.value&&o.cart&&f.value&&f.value.allowCartPayment&&B.value&&$.value),{billingAddressEqualsShipping:u,billingAddress:$,paymentMethod:f,shipmentMethod:A,onBillingAddressChange:I,setPaymentMethod:q,isPurchaseOrderNumberEnabled:E,purchaseOrderNumber:V}=Q();return(a,i)=>{const O=c("VcLabel"),U=c("VcCheckbox"),k=c("VcImage"),T=c("VcSelect"),D=c("VcInput"),P=c("VcWidget");return r(),S(G,null,[l(P,{title:a.$t("shared.checkout.billing_details_section.title"),"prepend-icon":"cash",class:"mt-5",size:"lg","data-test-id":"checkout.payment-details-section"},{default:n(()=>[d("div",Z,[d("div",j,[l(O,{required:""},{default:n(()=>[h(p(a.$t("shared.checkout.billing_details_section.labels.billing_address")),1)]),_:1}),d("div",{class:F(["grow divide-y rounded-[--vc-radius] border",{"cursor-not-allowed bg-neutral-50":e.disabled}])},[!t(m)&&!v.value?(r(),b(U,{key:0,modelValue:t(u),"onUpdate:modelValue":i[0]||(i[0]=s=>w(u)?u.value=s:null),disabled:e.disabled,name:"billingAddressEqualsShipping",class:"p-3"},{default:n(()=>[h(p(a.$t("shared.checkout.billing_details_section.labels.same_as_shipping_address")),1)]),_:1},8,["modelValue","disabled"])):g("",!0),l(t(J),{placeholder:!t(m)&&!v.value&&t(u)?a.$t("shared.checkout.shipping_details_section.links.select_address"):a.$t("shared.checkout.billing_details_section.links.select_address"),address:t($),disabled:e.disabled,readonly:!t(m)&&!v.value&&t(u),class:"min-h-18 px-3 py-1.5",onChange:t(I)},null,8,["placeholder","address","disabled","readonly","onChange"])],2)]),d("div",H,[l(T,{"model-value":t(f),label:a.$t("shared.checkout.billing_details_section.labels.payment_method"),items:t(C),disabled:e.disabled,size:"auto",required:"","test-id-dropdown":"checkout.payment-method-selector",onChange:i[1]||(i[1]=s=>t(q)(s))},{placeholder:n(()=>[d("div",K,[l(k,{class:"size-12 rounded bg-neutral-100",src:"select-payment.svg"}),h(" "+p(a.$t("common.placeholders.select_payment_method")),1)])]),selected:n(({item:s})=>[d("div",{class:"flex items-center gap-3 p-3 text-sm","data-selected-payment-method-id":s.code},[l(k,{class:"size-12 rounded",src:s.logoUrl},null,8,["src"]),h(" "+p(s.name),1)],8,ee)]),item:n(({item:s})=>[l(k,{class:"size-12 rounded",src:s.logoUrl},null,8,["src"]),d("span",{"data-payment-method-id":s.code},p(s.name),9,ae)]),_:1},8,["model-value","label","items","disabled"]),l(W,{name:"slide-fade-top",mode:"in-out"},{default:n(()=>[t(E)?(r(),b(D,{key:0,modelValue:t(V),"onUpdate:modelValue":i[2]||(i[2]=s=>w(V)?V.value=s:null),modelModifiers:{trim:!0},placeholder:a.$t("common.placeholders.purchase_order_number"),disabled:e.disabled,name:"purchaseOrderNumber"},null,8,["modelValue","placeholder","disabled"])):g("",!0)]),_:1})])])]),_:1},8,["title"]),x.value?(r(),b(P,{key:0,title:a.$t("shared.checkout.billing_details_section.payment_card"),"prepend-icon":"cash",size:"lg",class:"mt-5"},{default:n(()=>[l(Y,{"hide-payment-button":"",cart:e.cart,payment:B.value},null,8,["cart","payment"])]),_:1},8,["title"])):g("",!0)],64)}}});export{oe as _};
//# sourceMappingURL=billing-details-section.vue_vue_type_script_setup_true_lang-D4_CgTaI.js.map
