"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[34],{117:(t,e,n)=>{n.d(e,{a:()=>o,b:()=>u});var i=n(0),a=n(2),s=n(78),c=n(7),l=n(34),r=n(137);function o({cart:t,pathname:e,selectedVariant:n,flags:c,cartStatus:o,changeCart:d,config:m,quantityPricingProductIds:h=[]}){const g=u(t),p=(0,l.a)(null==g?void 0:g.currency),v=(0,a.useMemo)((()=>(null==g?void 0:g.items)?(0,r.a)(g.items,h):[]),[null==g?void 0:g.items,h]);return(0,i.jsx)("ul",{"aria-label":"Cart items",children:v.map(((t,a)=>(0,i.jsx)("li",{"aria-label":t.product_title,children:(0,i.jsx)(s.a,Object.assign({},t,{cartItemkKey:t.key,selectedVariantId:null==n?void 0:n.variantId,pathname:e,line:a+1,flags:c,cartStatus:o,changeCart:d,height:m.product_image_height,width:m.product_image_width,hostname:m.hostname,currency:null==g?void 0:g.currency,formatCurrency:p}))},t.key)))})}function u(t){var e,n;const i=(0,c.h)("orderDiscountLabel");if(!t)return t;const a=null!==(e=t.cart_level_discount_applications)&&void 0!==e?e:[];if(a.length<1||"enabled"!==i())return t;const s=new Set(a.map((t=>t.title)));let l=!1;const r=(null!==(n=t.items)&&void 0!==n?n:[]).map((t=>{var e,n,i;const a=null!==(e=t.discounts)&&void 0!==e?e:[],c=null!==(n=t.discounted_price)&&void 0!==n?n:0;let r=0;const o=a.filter((t=>!((null==t?void 0:t.title)&&s.has(t.title)&&(r+=t.amount,1))));let u=!1;const d=Array.isArray(t.item_components)?t.item_components.map((t=>{var e;const n=null!==(e=t.discounts)&&void 0!==e?e:[],i=n.filter((t=>!((null==t?void 0:t.title)&&s.has(t.title))));return i.length!==n.length?(u=!0,Object.assign(Object.assign({},t),{discounts:i})):t})):t.item_components,m=r>0||o.length!==a.length;if(m||u){l=!0;const e=Math.max(1,null!==(i=t.quantity)&&void 0!==i?i:1),n=c*e,a=Math.round((n+r)/e);return Object.assign(Object.assign(Object.assign({},t),m?{discounted_price:a,discounts:o}:{}),u?{item_components:d}:{})}return t}));return l?Object.assign(Object.assign({},t),{items:r}):t}}}]);