import{C as q,q as m,r as z,l as x,N as p,K as d,E as a,O as j,aD as T,P as t,D as l,a3 as n,Q as r,R as s,M as A,S as v,am as W,F as J,J as K,u}from"./vendor-BGtMsOoo.js";import{bp as M,ae as Q,bq as R,e as G}from"./index-CRze-aDK.js";import{u as H}from"./order-summary.vue_vue_type_style_index_0_scoped_471240a6_lang-DB8A0s2y.js";const U={class:"relative"},X={class:"mb-4 flex justify-between text-base font-black"},Y={class:"border-y py-2 text-base font-normal"},Z={class:"flex justify-between"},ee={key:0},te={class:"list-disc pl-5 text-neutral-400 print:text-[color:var(--color-additional-950)]"},ae={class:"flex items-center justify-between"},se={class:"text-sm"},ne={key:0},oe={class:"flex items-center justify-between"},le={class:"text-sm"},ce={key:1},re={class:"flex items-center justify-between"},ue={class:"text-sm"},ie={class:"flex justify-between"},me={key:1,class:"flex justify-between"},pe={class:"mt-4 flex justify-between text-base font-black"},de={class:"text-[--price-color] print:text-inherit"},ve={key:0,class:"mt-4 text-xs font-normal text-neutral-400"},he=q({__name:"order-summary",props:{cart:{},selectedItems:{},noShipping:{type:Boolean},footnote:{type:Boolean}},setup(B){const c=B,{currentLanguage:_}=M(),{currentCurrency:f}=R(),{changing:N}=Q(),{changing:S}=H(),I=m(()=>N.value||S.value),h=z(!0),b=m(()=>x.sumBy(c.selectedItems??c.cart.items,e=>{var o;return((o=e.discountTotal)==null?void 0:o.amount)??0})),V=m(()=>"shippingPrice"in c.cart?c.cart.shippingPrice:c.cart.shippingSubTotal),g=m(()=>x.sumBy(c.cart.shipments,e=>{var o;return(o=e.discountAmount)==null?void 0:o.amount})),k=m(()=>{var e;return((e=c.cart.discounts)==null?void 0:e.length)||b.value>0||g.value>0});function P(e){return typeof(e==null?void 0:e.amount)=="object"&&(e==null?void 0:e.amount)!==null?e==null?void 0:e.amount.amount:e==null?void 0:e.amount}return(e,o)=>{const L=p("VcLoaderOverlay"),i=p("VcPriceDisplay"),O=p("VcIcon"),C=p("VcTotalDisplay"),E=p("VcWidget");return a(),d(E,{id:"order-summary",class:"max-md:mt-5 print:break-inside-avoid",title:e.$t("common.titles.order_summary")},{default:j(()=>{var $,D,w;return[T(e.$slots,"header",{},void 0,!0),t("div",U,[r(L,{visible:I.value},null,8,["visible"]),t("div",X,[t("span",null,s(e.$t("common.labels.subtotal")),1),t("span",null,[r(i,{value:e.cart.subTotal},null,8,["value"])])]),t("div",Y,[t("div",Z,[(a(),d(A(k.value?"button":"span"),{class:"flex appearance-none items-center",onClick:o[0]||(o[0]=y=>h.value=!h.value)},{default:j(()=>[v(s(e.$t("common.labels.discount"))+" ",1),k.value?(a(),d(O,{key:0,class:"ml-1 fill-primary print:hidden",name:h.value?"chevron-down":"chevron-up",size:"xs"},null,8,["name"])):n("",!0)]),_:1})),e.cart.discountTotal?(a(),l("span",ee,[v(s((($=e.cart.discountTotal)==null?void 0:$.amount)>0?"-":"")+" ",1),r(i,{value:e.cart.discountTotal},null,8,["value"])])):n("",!0)]),k.value?(a(),l("div",{key:0,class:W(["print:block",{hidden:h.value}])},[t("ul",te,[(a(!0),l(J,null,K(e.cart.discounts,(y,F)=>(a(),l("li",{key:F},[t("div",ae,[t("span",se,s(y.description||y.coupon),1),r(C,{amount:-P(y),"currency-code":u(f).code,"culture-name":u(_).cultureName},null,8,["amount","currency-code","culture-name"])])]))),128)),b.value>0?(a(),l("li",ne,[t("div",oe,[t("span",le,s(e.$t("common.labels.line_items")),1),r(C,{amount:-b.value,"currency-code":u(f).code,"culture-name":u(_).cultureName},null,8,["amount","currency-code","culture-name"])])])):n("",!0),g.value>0?(a(),l("li",ce,[t("div",re,[t("span",ue,s(e.$t("common.labels.shipping")),1),r(C,{amount:-g.value,"currency-code":u(f).code,"culture-name":u(_).cultureName},null,8,["amount","currency-code","culture-name"])])])):n("",!0)])],2)):n("",!0),t("div",ie,[t("span",null,s(e.$t("common.labels.tax")),1),t("span",null,[v(s(((D=e.cart.taxTotal)==null?void 0:D.amount)>0?"+":"")+" ",1),e.cart.taxTotal?(a(),d(i,{key:0,value:e.cart.taxTotal},null,8,["value"])):n("",!0)])]),e.noShipping?n("",!0):(a(),l("div",me,[t("span",null,s(e.$t("common.labels.shipping_cost")),1),t("span",null,[v(s(((w=V.value)==null?void 0:w.amount)>0?"+":"")+" ",1),r(i,{value:V.value},null,8,["value"])])]))]),t("div",pe,[t("span",null,s(e.$t("common.labels.total")),1),t("span",de,[e.cart.total?(a(),d(i,{key:0,value:e.cart.total},null,8,["value"])):n("",!0)])])]),T(e.$slots,"footer",{},void 0,!0),e.footnote?(a(),l("div",ve,[T(e.$slots,"footnote",{},()=>[v(s(e.$t("common.messages.checkout_pricing_warning")),1)],!0)])):n("",!0)]}),_:3},8,["title"])}}}),be=G(he,[["__scopeId","data-v-471240a6"]]);export{be as O};
//# sourceMappingURL=order-summary-BfC6AHs9.js.map
