import{F as O,P as m,_ as d,R as s,a1 as $,S as T,T as e,Q as l,W as o,X as u,m as p,a0 as n,a8 as W,r as z,a2 as v,Z as A,a5 as E,a6 as Q,e as i,l as w}from"./vendor-CHzKNe_Q.js";import{bp as R,b8 as X,bV as Z,_ as q}from"./index-D6o2tNli.js";import{u as G}from"./useSaveForLater-Bi6ChY_D.js";import{u as H}from"./useCheckout-9di2oKpg.js";const J={class:"relative"},K={class:"mb-4 flex justify-between text-base font-black"},M={class:"border-y py-2 text-base font-normal"},U={class:"flex justify-between"},Y={key:0},tt={class:"list-disc pl-5 text-neutral-400 print:text-[color:var(--color-additional-950)]"},et={class:"flex items-center justify-between"},at={class:"text-sm"},st={key:0},nt={class:"flex items-center justify-between"},ot={class:"text-sm"},lt={key:1},ct={class:"flex items-center justify-between"},ut={class:"text-sm"},it={class:"flex justify-between"},rt={key:1,class:"flex justify-between"},mt={class:"mt-4 flex justify-between text-base font-black"},dt={class:"text-[--price-color] print:text-inherit"},pt={key:0,class:"mt-4 text-xs font-normal text-neutral-400"},vt=O({__name:"order-summary",props:{cart:{},selectedItems:{},noShipping:{type:Boolean},footnote:{type:Boolean}},setup(a){const c=a,{currentLanguage:b}=R(),{currentCurrency:f}=Z(),{changing:D}=X(),{changing:j}=H(),{loading:B}=G(),L=p(()=>D.value||j.value||B.value),h=z(!0),g=p(()=>w.sumBy(c.selectedItems??c.cart.items,t=>t.discountTotal?.amount??0)),V=p(()=>"shippingPrice"in c.cart?c.cart.shippingPrice:c.cart.shippingSubTotal),_=p(()=>w.sumBy(c.cart.shipments,t=>t.discountAmount?.amount)),x=p(()=>c.cart.discounts?.length||g.value>0||_.value>0);function S(t){return typeof t?.amount=="object"&&t?.amount!==null?t?.amount.amount:t?.amount}return(t,C)=>{const N=m("VcLoaderOverlay"),r=m("VcPriceDisplay"),I=m("VcIcon"),k=m("VcTotalDisplay"),P=m("VcWidget");return s(),d(P,{id:"order-summary",class:"max-md:mt-5 print:break-inside-avoid",title:t.$t("common.titles.order_summary"),"data-test-id":"order-summary-widget"},{default:$(()=>[T(t.$slots,"header",{},void 0,!0),e("div",J,[u(N,{visible:L.value},null,8,["visible"]),e("div",K,[e("span",null,n(t.$t("common.labels.subtotal")),1),e("span",null,[u(r,{value:a.cart.subTotal,"data-test-id":"cart-subtotal-label"},null,8,["value"])])]),e("div",M,[e("div",U,[(s(),d(W(x.value?"button":"span"),{class:"flex appearance-none items-center",onClick:C[0]||(C[0]=y=>h.value=!h.value)},{default:$(()=>[v(n(t.$t("common.labels.discount"))+" ",1),x.value?(s(),d(I,{key:0,class:"ml-1 fill-primary print:hidden",name:h.value?"chevron-down":"chevron-up",size:"xs"},null,8,["name"])):o("",!0)]),_:1})),a.cart.discountTotal?(s(),l("span",Y,[v(n(a.cart.discountTotal?.amount>0?"-":"")+" ",1),u(r,{value:a.cart.discountTotal,"data-test-id":"cart-discount-total-label"},null,8,["value"])])):o("",!0)]),x.value?(s(),l("div",{key:0,class:A(["print:block",{hidden:h.value}])},[e("ul",tt,[(s(!0),l(E,null,Q(a.cart.discounts,(y,F)=>(s(),l("li",{key:F},[e("div",et,[e("span",at,n(y.description||y.coupon),1),u(k,{amount:-S(y),"currency-code":i(f).code,"culture-name":i(b).cultureName},null,8,["amount","currency-code","culture-name"])])]))),128)),g.value>0?(s(),l("li",st,[e("div",nt,[e("span",ot,n(t.$t("common.labels.line_items")),1),u(k,{amount:-g.value,"currency-code":i(f).code,"culture-name":i(b).cultureName},null,8,["amount","currency-code","culture-name"])])])):o("",!0),_.value>0?(s(),l("li",lt,[e("div",ct,[e("span",ut,n(t.$t("common.labels.shipping")),1),u(k,{amount:-_.value,"currency-code":i(f).code,"culture-name":i(b).cultureName},null,8,["amount","currency-code","culture-name"])])])):o("",!0)])],2)):o("",!0),e("div",it,[e("span",null,n(t.$t("common.labels.tax")),1),e("span",null,[v(n(a.cart.taxTotal?.amount>0?"+":"")+" ",1),a.cart.taxTotal?(s(),d(r,{key:0,value:a.cart.taxTotal,"data-test-id":"cart-tax-total-label"},null,8,["value"])):o("",!0)])]),a.noShipping?o("",!0):(s(),l("div",rt,[e("span",null,n(t.$t("common.labels.shipping_cost")),1),e("span",null,[v(n(V.value?.amount>0?"+":"")+" ",1),u(r,{value:V.value,"data-test-id":"cart-shipping-total-label"},null,8,["value"])])]))]),e("div",mt,[e("span",null,n(t.$t("common.labels.total")),1),e("span",dt,[a.cart.total?(s(),d(r,{key:0,value:a.cart.total,"data-test-id":"cart-total-label"},null,8,["value"])):o("",!0)])])]),T(t.$slots,"footer",{},void 0,!0),a.footnote?(s(),l("div",pt,[T(t.$slots,"footnote",{},()=>[v(n(t.$t("common.messages.checkout_pricing_warning")),1)],!0)])):o("",!0)]),_:3},8,["title"])}}}),gt=q(vt,[["__scopeId","data-v-f294cd04"]]);export{gt as O};
//# sourceMappingURL=order-summary-ClKp2qLU.js.map
