import{K as j,r as D,B as W,av as E,S as r,P as B,M as m,T as t,U as n,L as b,a7 as O,b as i,V as o,X as c,W as u,aq as v,N as F}from"./vendor-bSWkQivH.js";import{aM as G,b9 as N,aj as H,bc as K}from"./index-Dqv5IkpS.js";import{_ as z}from"./address-selection.vue_vue_type_script_setup_true_lang-CVSe4ho1.js";const X={class:"flex flex-col flex-wrap gap-4 xs:flex-row xs:gap-y-6 lg:gap-8"},J={key:0},Q={class:"flex min-h-18 items-center gap-2 rounded border p-4"},R={class:"grow"},Y={class:"flex items-center gap-3 p-[0.688rem] text-sm"},Z={class:"flex items-center gap-3 p-[0.688rem] text-sm"},ee={key:2,class:"grow"},de=j({__name:"shipping-details-section",props:{disabled:{type:Boolean}},setup(se){var M;const g={pickup:"pickup",shipping:"shipping"},{deliveryAddress:f,shipmentMethod:k,onDeliveryAddressChange:I,setShippingMethod:L}=G(),a=D(((M=k.value)==null?void 0:M.code)===N?"pickup":"shipping"),{availableShippingMethods:P,updateShipment:T,shipment:y,changing:V}=H(),{hasBOPIS:C,openSelectAddressModal:U,loading:w,bopisMethod:q}=K(),S=W(()=>P.value.filter(e=>e.code!==N));function $(e){a.value=e}return E(a,(e,l)=>{var h,p,_;if(!l)return;const d=e===g.pickup?q.value:S.value[0];!d||d.code===((h=y.value)==null?void 0:h.shipmentMethodCode)||T({id:(p=y.value)==null?void 0:p.id,shipmentMethodCode:d.code,shipmentMethodOption:d.optionName,price:(_=d.price)==null?void 0:_.amount})},{immediate:!0}),(e,l)=>{const d=r("VcLabel"),h=r("VcTabSwitch"),p=r("VcImage"),_=r("VcSelect"),x=r("VcLoaderOverlay"),A=r("VcWidget");return m(),B(A,{title:e.$t("shared.checkout.shipping_details_section.title"),"prepend-icon":"truck",size:"lg"},{default:t(()=>[n("div",X,[i(C)?(m(),b("div",J,[o(d,null,{default:t(()=>[c(u(e.$t("shared.checkout.shipping_details_section.labels.delivery_option")),1)]),_:1}),n("div",Q,[o(h,{modelValue:a.value,"onUpdate:modelValue":l[0]||(l[0]=s=>a.value=s),value:g.pickup,icon:"cube",label:e.$t("shared.checkout.shipping_details_section.switchers.pickup"),disabled:i(V),onChange:l[1]||(l[1]=s=>$(s))},null,8,["modelValue","value","label","disabled"]),o(h,{modelValue:a.value,"onUpdate:modelValue":l[2]||(l[2]=s=>a.value=s),value:g.shipping,icon:"truck",label:e.$t("shared.checkout.shipping_details_section.switchers.shipping"),disabled:i(V),onChange:l[3]||(l[3]=s=>$(s))},null,8,["modelValue","value","label","disabled"])])])):O("",!0),a.value===g.shipping?(m(),b(F,{key:1},[n("div",R,[o(d,{required:""},{default:t(()=>[c(u(e.$t("shared.checkout.shipping_details_section.labels.shipping_address")),1)]),_:1}),n("div",{class:v(["flex min-h-18 grow flex-col justify-center divide-y rounded border px-3 py-1.5",{"cursor-not-allowed bg-neutral-50":e.disabled}])},[o(i(z),{placeholder:e.$t("shared.checkout.shipping_details_section.links.select_address"),address:i(f),disabled:e.disabled,onChange:i(I)},null,8,["placeholder","address","disabled","onChange"])],2)]),o(_,{"model-value":i(k),label:e.$t("shared.checkout.shipping_details_section.labels.shipping_method"),items:S.value,disabled:e.disabled,size:"auto","item-size":"lg",class:v(i(C)?"lg:w-3/12":"lg:w-4/12"),required:"","test-id-dropdown":"shipping-method-select",onChange:l[4]||(l[4]=s=>i(L)(s))},{placeholder:t(()=>[n("div",Y,[o(p,{class:"size-12 rounded-sm bg-neutral-100",src:"select-shipping.svg"}),c(" "+u(e.$t("common.placeholders.select_delivery_method")),1)])]),selected:t(({item:s})=>[n("div",Z,[o(p,{class:"size-12 rounded-sm",src:s.logoUrl},null,8,["src"]),c(" "+u(e.$t(`common.methods.delivery_by_id.${s.id}`)),1)])]),item:t(({item:s})=>[o(p,{class:"size-12 rounded-sm",src:s.logoUrl},null,8,["src"]),c(" "+u(e.$t(`common.methods.delivery_by_id.${s.id}`)),1)]),_:1},8,["model-value","label","items","disabled","class"])],64)):(m(),b("div",ee,[o(d,{required:""},{default:t(()=>[c(u(e.$t("shared.checkout.shipping_details_section.labels.pickup_point")),1)]),_:1}),n("div",{class:v(["relative flex min-h-18 grow flex-col justify-center divide-y rounded border px-3 py-1.5",{"cursor-not-allowed bg-neutral-50":e.disabled}])},[i(w)?(m(),B(x,{key:0})):O("",!0),o(i(z),{disabled:i(w)||e.disabled,address:i(f),placeholder:e.$t("shared.checkout.shipping_details_section.links.select_pickup_point"),onChange:i(U)},null,8,["disabled","address","placeholder","onChange"])],2)]))])]),_:1},8,["title"])}}});export{de as _};
//# sourceMappingURL=shipping-details-section.vue_vue_type_script_setup_true_lang-DJwGI0uE.js.map
