import{aa as P,dR as de,cz as le,aL as B,j as e,az as N,T as l,A as E,aN as K,c as X,r as x,dS as ue,dT as me,dU as he,dV as pe,l as c,O as v,F as b,a4 as H,dW as ge,$ as j,aJ as fe,N as _e,cG as ve,ab as F,au as ye,G as Ce,aM as Ie,dX as be,b9 as J,aE as we,dY as xe,an as Se,ao as Ae,cw as He,dZ as M,a5 as D,o as _,d_ as Ve,d$ as Ee,e0 as ke,e as O,dh as Ge,di as Ne,m as Y,cK as qe,a1 as Le,p as Pe,cq as Be,cU as Fe,cx as Oe,e1 as $e,H as Te,n as Re,e2 as ze,a0 as je,C as U,e3 as Me}from"./index-_o4gWTfP.js";import{u as ee,s as q,V as De}from"./Voucher-Ig0-XaK9.js";import{u as Ue}from"./useCartItems-C65RSY_g.js";import{S as We,C as Qe}from"./Coupon-DejzZMNC.js";import{T as Ze}from"./Totals-DJBA0L8F.js";import"./Note-PydA5lYM.js";import"./VoucherEuroIcon-CqpHVPWV.js";import"./Text-DyGzhmB6.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="299c9133-bf7d-4c6f-93d5-edd7859f9fc3",t._sentryDebugIdIdentifier="sentry-dbid-299c9133-bf7d-4c6f-93d5-edd7859f9fc3")}catch{}})();const Ke="_wrapper_1ou5z_72",Xe="_enter_1ou5z_76",Je="_exit_1ou5z_77",Ye="_enterActive_1ou5z_83",et="_exitActive_1ou5z_87",tt={wrapper:Ke,enter:Xe,exit:Je,enterActive:Ye,exitActive:et,"hero-video-slide-in":"_hero-video-slide-in_1ou5z_1","hero-video-slide-out":"_hero-video-slide-out_1ou5z_1"},nt="_buttonCta_1pyek_73",at={buttonCta:nt,"hero-video-slide-in":"_hero-video-slide-in_1pyek_1","hero-video-slide-out":"_hero-video-slide-out_1pyek_1"};function rt(){const t=P(a=>a.cart.gifts);return!!!de()||!t?!1:t.some(a=>a.is_available&&a.insufficient_amount)}function st(){const t=P(n=>n.cart.totals),r=(t==null?void 0:t.subtotal)??0,{data:a}=le();return!a||!a.length?!1:a.some(n=>n.minimalOrderAmount?n.minimalOrderAmount.value-r>0:!1)}const te=()=>{const t=B(),r=rt(),a=st();if(t&&!r&&!a)return null;const n={label:t?e(l,{id:"cart.emptyState.continueShoppingButton"}):e(l,{id:"account.login.headingDefault"}),path:t?E.shopAll:E.login};return e(N,{name:"cart.priviliges.cta",category:"cart.priviliges.cta",variant:"secondary",to:n.path,wide:!0,className:at.buttonCta,children:n.label})},ot=()=>{const t=K(),{items:r,loading:a,hasItems:n,quantity:o}=X(),[h,d]=x.useState([]),p=ue(),w=me(),f=async i=>(d(m=>[...m,{...i,oldItemId:parseInt(i.id)}]),await p(t??"",i)),u=i=>{d(m=>m.filter(y=>y.id!==i.id))},g=async(i,m)=>{const y=m.configurableOptions&&he(i.configurableOptions.map(C=>({label:C.optionLabel,value:C.configurableProductOptionValueUid})),m);await w(m,i.quantity,y?pe(y):void 0,!1),u(i)};return!r&&h.length===0?{cartItems:[],removeItem:f,restoreItem:g,removeItemFromHistory:u,loading:a,hasItems:n,quantity:o}:{cartItems:[...(r||[]).filter(i=>!h.some(m=>m.id===(i==null?void 0:i.id))),...h].sort((i,m)=>{const y=(i==null?void 0:i.oldItemId)!==void 0?i.oldItemId:parseInt((i==null?void 0:i.id)??""),C=(m==null?void 0:m.oldItemId)!==void 0?m.oldItemId:parseInt((m==null?void 0:m.id)??"");return y-C}),removeItem:f,restoreItem:g,removeItemFromHistory:u,loading:a,hasItems:n,quantity:o}},it="_container_s3awm_72",ct="_section_s3awm_76",dt="_header_s3awm_82",lt="_subHeader_s3awm_86",ut="_separator_s3awm_91",I={container:it,section:ct,header:dt,subHeader:lt,separator:ut,"hero-video-slide-in":"_hero-video-slide-in_s3awm_1","hero-video-slide-out":"_hero-video-slide-out_s3awm_1"},mt=(t,r)=>{var o,h;const a=((o=t.insufficientAmount)==null?void 0:o.value)??0,n=((h=r.insufficientAmount)==null?void 0:h.value)??0;return a<n?-1:0},W=(t,r)=>{const{items:a,products:n}=t;return a==null?void 0:a.map((o,h)=>c(x.Fragment,{children:[r&&e(H,{className:I.separator}),e(ge,{productId:o.productId,cartItem:o.item,rule:t,withSku:!1,hasGiftSelection:(n==null?void 0:n.length)>1})]},`${h}-${o.productUid}`))},ht=()=>{const t=B(),{freeGifts:r}=X(),{freeGiftVouchers:a}=ee({skipCustomerCoupons:!0}),n=[...a.filter(d=>!d.isCartItem).filter(d=>{var f;const p=(f=d.items)==null?void 0:f.map(u=>u.productId),w=r==null?void 0:r.map(u=>{var g;return(g=u.items)==null?void 0:g.map(k=>k.productId)}).flat();return!(w!=null&&w.some(u=>p==null?void 0:p.includes(u)))}),...r??[]],o=n.filter(d=>{var p;return(p=d.itemIds)==null?void 0:p.length}),h=t?n.filter(d=>{var p;return!((p=d.itemIds)!=null&&p.length)&&d.isValidCustomerGroup}):n.filter(d=>{var p;return!d.isValidCustomerGroup||d.isValidCustomerGroup&&!((p=d.itemIds)!=null&&p.length)});return e(v,{children:c("div",{className:I.container,children:[c("section",{className:I.section,children:[o.length>0&&e(v,{children:e(b,{element:"h2",variant:"h2",className:I.header,children:e(l,{values:{0:o.length},id:"cart.gifts.claimed"})})}),o.map(d=>W(d,!0))]}),c("section",{className:I.section,children:[h.length>0&&c(v,{children:[e(b,{element:"h2",variant:"h2",className:I.header,children:t?e(l,{values:{0:h.length},id:"cart.gifts.unclaimed.customer"}):e(l,{values:{0:h.length},id:"cart.gifts.unclaimed.guest"})}),h.length&&!t&&e("div",{className:I.subHeader,children:e(l,{id:"account.login.headingDefault"})}),e(H,{className:I.separator})]}),h.sort(mt).map(d=>W(d,!1))]})]})})},pt=()=>{const{items:t}=Ue(),[r,a]=j.useState(!1),n=fe([],!1);j.useEffect(()=>{if(!t||r)return;const o={event:"view_cart",ecommerce:{items:t}};a(!0),n==null||n([{ecommerce:null},o])},[t,r,a,n])},gt=t=>t.numberOfVouchers>0?e("div",{className:_e(q.header,q.marginBottom),children:c("div",{className:q.loaderContainer,children:[e(b,{variant:"h2",element:"h3",children:e(l,{id:"user.rewards.vouchersHeading"})}),t.children]})}):null,ne=()=>{const{loading:t,salesRuleVouchers:r,customerCoupons:a}=ee({skipFreeGifts:!0}),n=[...r,...a];return t?e(ve,{}):c(v,{children:[e(gt,{numberOfVouchers:n.length}),n.length>0&&e(H,{}),n.map(o=>e(De,{voucher:o,showButtons:!0},o.couponId))]})},ft="_emptyState_17efo_72",_t="_icon_17efo_80",vt="_heading_17efo_85",yt="_explanation_17efo_89",Ct="_button_17efo_93",A={emptyState:ft,icon:_t,heading:vt,explanation:yt,button:Ct,"hero-video-slide-in":"_hero-video-slide-in_17efo_1","hero-video-slide-out":"_hero-video-slide-out_17efo_1"},It=t=>x.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 300 300",...t},x.createElement("path",{d:"M253.26,86.29a10.54,10.54,0,0,0-10.48-9.52h-34.9V57.88a57.89,57.89,0,0,0-115.77,0V76.77H57.22a10.54,10.54,0,0,0-10.48,9.52L27.36,288.47A10.52,10.52,0,0,0,37.83,300H262.17a10.52,10.52,0,0,0,10.47-11.53ZM106.85,57.88a43.15,43.15,0,0,1,86.3,0V76.77h-86.3ZM49.41,279,66.78,97.82H92.11V137H78.43v14.74h42.1V137H106.85V97.82h86.3V137H179.47v14.74h42.09V137H207.88V97.82h25.34L250.59,279Z"}),x.createElement("rect",{x:80.54,y:214.17,width:138.92,height:14.96})),bt=F("CartEmptyIcon")(It),ae=()=>{const t=B();return c("div",{className:A.emptyState,children:[e(ye,{component:bt,title:"Cart",className:A.icon}),e(b,{element:"h1",variant:"h3",className:A.heading,children:e(l,{id:"cart.emptyState.heading"})}),!t&&c(v,{children:[e(Ce,{className:A.explanation,children:e(l,{id:"cart.emptyState.explanation"})}),e(N,{minWidth:!0,variant:"primary",to:E.login,className:A.button,name:"Sign in or register",category:"cart.emptyState.signIn",children:e(l,{id:"cart.emptyState.signInButton"})})]}),e(N,{minWidth:!0,variant:"secondary",to:E.home,className:A.button,name:"Continue shopping",category:"cart.emptyState.continueShopping",children:e(l,{id:"cart.emptyState.continueShoppingButton"})})]})},wt="_title_1fw8j_72",xt="_price_1fw8j_76",St="_total_1fw8j_81",At="_weAccept_1fw8j_85",Ht="_unclaimed_1fw8j_89",Vt="_vouchers_1fw8j_93",Et="_ctaButton_1fw8j_97",kt="_sticky_1fw8j_101",G={title:wt,price:xt,total:St,weAccept:At,unclaimed:Ht,vouchers:Vt,ctaButton:Et,sticky:kt,"hero-video-slide-in":"_hero-video-slide-in_1fw8j_1","hero-video-slide-out":"_hero-video-slide-out_1fw8j_1"},Gt=({className:t})=>{const r=Ie(),a=be(),{isMobile:n}=J();return c("aside",{className:t,children:[a&&n&&c(v,{children:[e(we,{}),e("div",{className:G.vouchers,children:e(ne,{})}),e("div",{className:G.ctaButton,children:e(te,{})})]}),e(b,{variant:"h2",element:"h1",color:"dark",className:G.title,children:e(l,{id:"cart.orderSummary.heading"})}),e(H,{}),e(Ze,{}),e(We,{children:e(N,{to:E.checkout,variant:"highlight",wide:!0,disabled:!r,name:"Checkout",category:"cart.orderSummary.checkout","data-testid":"cart.placeOrder",children:e(l,{id:"cart.orderSummary.checkoutButtonLabel"})})}),e("div",{className:G.weAccept,children:e(xe,{})}),e(Qe,{})]})},Nt=F("CartPageOrderSummary")(Gt),L=_("div",{target:"eb7asqd0"})("@media screen and (min-width:992px){display:flex;max-width:1100px;margin:0 auto 30px;}"),qt=_("div",{target:"eb7asqd1"})("@media screen and (min-width:992px){margin-bottom:40px;min-width:0;flex:1 1 auto;}"),Lt=_("div",{target:"eb7asqd2"})("position:relative;@media screen and (min-width:768px){margin-top:2rem;}@media screen and (min-width:992px){width:270px;flex:0 0 auto;margin-left:60px;}@media screen and (min-width:1080px){margin-left:112px;}"),Pt=_(Nt,{shouldForwardProp:t=>t!=="top",target:"eb7asqd3"})("position:sticky;top:",t=>t.top+20,"px;z-index:2;"),re=O("display:flex;align-items:center;gap:0.5em;"),Q=_(b,{target:"eb7asqd4"})(re,"    margin-bottom:10px;"),Bt=_(b,{target:"eb7asqd5"})(re,"    margin:20px 0 10px;"),Ft=_("span",{target:"eb7asqd6"})("font-size:0.5em;text-transform:lowercase;font-weight:normal;"),se=O("margin-bottom:50px;"),Ot=_("div",{target:"eb7asqd7"})(se),$t=_("section",{target:"eb7asqd8"})(se),Z=({quantity:t})=>c(Ft,{as:"span",children:["(",e(l,{values:{quantity:t},id:"cart.cartItemListing.numberOfItems"}),")"]}),Tt=()=>{var T,R,z;pt();const{cartItems:t,loading:r,removeItem:a,restoreItem:n,removeItemFromHistory:o,quantity:h}=ot(),d=Se(Ae),{isMobile:p}=J(),w=((R=(T=t==null?void 0:t.at(0))==null?void 0:T.prices)==null?void 0:R.price.currency)??He.EUR,f=t==null?void 0:t.filter(s=>s.reservation.salableQty<s.quantity&&!s.extensionAttributes.isPersonalShopperBoxItem&&!s.extensionAttributes.isFreeGift),u=t==null?void 0:t.filter(s=>s.reservation.salableQty>=s.quantity&&!s.extensionAttributes.isPersonalShopperBoxItem&&!s.extensionAttributes.isFreeGift),g=t==null?void 0:t.filter(s=>s.reservation.salableQty>=s.quantity&&s.extensionAttributes.isPersonalShopperBoxItem);if((!u||!(u!=null&&u.length))&&(!g||!(g!=null&&g.length))&&!r)return e(ae,{});const k=((z=t==null?void 0:t.filter(s=>s.extensionAttributes.isFreeGift))==null?void 0:z.length)??0,V=(f==null?void 0:f.length)??0,$=V>0,i=(g==null?void 0:g.reduce((s,S)=>s+S.quantity,0))||0,m=h-i-k,y=u==null?void 0:u.find(s=>{var S;return(s==null?void 0:s.quantity)>(((S=s==null?void 0:s.product)==null?void 0:S.onlyXLeftInStock)??Number.MAX_SAFE_INTEGER)}),C=(s,S)=>e(ke,{timeout:600,children:ce=>c(Ee,{height:{unmounted:0,entering:0,entered:"auto",exiting:0,exited:0}[ce],duration:600,animateOpacity:!0,children:[e(H,{}),e(Ve,{cartItem:s,currency:w,remove:a,restore:n,onClose:o,disabled:S})]})},s.id),oe=m>0&&c(Ot,{children:[c(Q,{variant:"h2",element:"h1",color:"dark",children:[e(l,{id:"cart.cartItemListing.heading"}),e(Z,{quantity:m})]}),V>0&&e(Bt,{variant:"h4",element:"h3",children:e(l,{id:"cart.cartItemListing.notAvailableHeading"})}),c(M,{children:[f==null?void 0:f.map(s=>C(s,!0)),V>0&&e(H,{}),u==null?void 0:u.map(s=>C(s,!1))]})]}),ie=i>0&&c($t,{children:[c(Q,{variant:"h2",element:"h2",color:"dark",children:[e(l,{id:"cart.cartItemListing.personalShopperHeading"}),e(Z,{quantity:i})]}),e(M,{children:g==null?void 0:g.map(s=>C(s,!1))})]});return c(v,{children:[$&&e(L,{children:e(D,{autoHide:!1,children:e(l,{values:{unavailableCount:V},id:"cart.cartItemListing.notAvailableGeneralError"})})}),y&&e(L,{children:e(D,{autoHide:!1,children:e(l,{id:"cart.cartItemListing.quantityGeneralError"})})}),c(L,{children:[c(qt,{children:[oe,ie,e(ht,{}),!p&&e(ne,{}),!p&&e(te,{})]}),e(Lt,{children:e(Pt,{top:(d==null?void 0:d.height)??0})})]})]})},Rt=({className:t})=>{const r=P(n=>n.cart);if(!r.details||!r.details.items||r.details.items.length===0)return null;const a=[...r.details.items].sort((n,o)=>o.price-n.price)[0].product_id;return e(qe,{fallback:e(x.Fragment,{}),children:e(Ge,{blueConicPosition:"cartSlider",children:e(Ne,{recommendationsType:"crosssell",header:Y._({id:"cart.cartPage.upSellTitle"}),productId:a,className:t,itemListSlot:"cartSlider"})})})},zt=_(Rt,{target:"egnq93b0"})("border-top:1px solid ",Le.colors.graylightest,";padding-top:70px;padding-bottom:70px;margin:0 auto;max-width:1100px;@media ",Pe("lg"),"{padding-top:80px;padding-bottom:80px;}"),jt=O("display:flex;align-items:center;gap:0.5em;"),tn=_(b,{target:"egnq93b1"})(jt,"    margin-bottom:10px;"),Mt=_("span",{target:"egnq93b2"})("font-size:0.5em;text-transform:lowercase;font-weight:normal;"),nn=({quantity:t})=>c(Mt,{as:"span",children:["(",e(l,{values:{quantity:t},id:"cart.cartItemListing.numberOfItems"}),")"]}),Dt=()=>{var h;Be(ze);const t=K(),r=Fe(),{data:a,loading:n}=Oe();t&&r(t),x.useEffect(()=>{$e(!0)},[]);let o;return((h=a==null?void 0:a.items)==null?void 0:h.length)===0||!t?o=e(ae,{}):n?o=e(je,{fullScreen:!0,reason:e(l,{id:"cart.pageLoader.reason"})}):o=c(v,{children:[e(U,{children:e(Tt,{})}),e(U,{children:e(zt,{})}),e(Me,{})]}),c(v,{children:[e(Te,{children:e("title",{children:Y._({id:"cart.cartPage.pageTitle"})})}),e(Re,{pageType:"cart",contentClassName:tt.wrapper,children:o})]})},an=F("CartPage")(Dt);export{nn as ItemCount,tn as StyledHeading,an as default};
//# sourceMappingURL=index-BR1i-Lrc.js.map
