import{F as N,Q as S,R as r,_ as y,W as b,m 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-DWvj1jit.js";import{b8 as L,a6 as R,bP as M}from"./index-8PssKxKU.js";import{_ as Q}from"./address-selection.vue_vue_type_script_setup_true_lang-BfVGXiZI.js";import{u as X}from"./useCheckout-BFs0QrMv.js";import{_ as Y}from"./payment-processing-cyber-source.vue_vue_type_script_setup_true_lang-CFvckfOD.js";const Z=N({__name:"payment",props:{hidePaymentButton:{type:Boolean},payment:{},disabled:{type:Boolean},cart:{},order:{}},setup(e){const o=e,m=g(()=>o.payment?.paymentGatewayCode||o.order?.inPayments[0].paymentMethod?.typeName||o.cart?.payments[0]?.paymentGatewayCode);return(C,_)=>(r(),S("div",null,[m.value==="CyberSourcePaymentMethod"?(r(),y(Y,{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"])):b("",!0)]))}}),j={class:"flex flex-col gap-6 lg:flex-row lg:gap-8"},H={class:"lg:w-3/5"},J={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=g(()=>A.value?.code===M||_.value.length===1&&_.value[0].code===M),B=g(()=>{const a=o.cart;return a&&a.payments&&a.payments.length>0?a.payments[0]:null}),x=g(()=>z.value&&o.cart&&f.value&&f.value.allowCartPayment&&B.value&&P.value),{billingAddressEqualsShipping:u,billingAddress:P,paymentMethod:f,shipmentMethod:A,onBillingAddressChange:I,setPaymentMethod:q,isPurchaseOrderNumberEnabled:E,purchaseOrderNumber:V}=X();return(a,i)=>{const O=c("VcLabel"),U=c("VcCheckbox"),k=c("VcImage"),T=c("VcSelect"),D=c("VcInput"),$=c("VcWidget");return r(),S(G,null,[l($,{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",j,[d("div",H,[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(),y(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"])):b("",!0),l(t(Q),{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(P),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",J,[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(),y(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"])):b("",!0)]),_:1})])])]),_:1},8,["title"]),x.value?(r(),y($,{key:0,title:a.$t("shared.checkout.billing_details_section.payment_card"),"prepend-icon":"cash",size:"lg",class:"mt-5"},{default:n(()=>[l(Z,{"hide-payment-button":"",cart:e.cart,payment:B.value},null,8,["cart","payment"])]),_:1},8,["title"])):b("",!0)],64)}}});export{oe as _};
//# sourceMappingURL=billing-details-section.vue_vue_type_script_setup_true_lang-CjQg8UAE.js.map
