"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[49],{227:(t,e,n)=>{n.d(e,{a:()=>u,b:()=>d});var i=n(0),s=n(1),l=n(156),a=n(5),r=n(16),c=n(177),o=n(13);function u({pathname:t,flags:e,config:n,quantityPricingProductIds:a=[],cartApp:u}){const m=d(u.cart.value),p=(0,r.a)(null==m?void 0:m.currency),h=(0,s.useMemo)((()=>(null==m?void 0:m.items)?(0,c.a)(m.items,a).filter((t=>{var e;return!(null===(e=t.properties)||void 0===e?void 0:e._iwp)})):[]),[null==m?void 0:m.items,a]);return(0,i.jsx)("ul",{"aria-label":"Cart items",children:h.map(((s,a)=>(0,i.jsx)("li",{"aria-label":(0,o.b)(s.product_title,s.options_with_values),children:(0,i.jsx)(l.a,Object.assign({},s,{cartItemkKey:s.key,pathname:t,line:a+1,flags:e,cartApp:u,height:n.product_image_height,width:n.product_image_width,hostname:n.hostname,currency:null==m?void 0:m.currency,formatCurrency:p}))},s.key)))})}function d(t){var e,n;const i=(0,a.m)("orderDiscountLabel");if(!t)return t;const s=null!==(e=t.cart_level_discount_applications)&&void 0!==e?e:[];if(s.length<1||"enabled"!==i())return t;const l=new Set(s.map((t=>t.title)));let r=!1;const c=(null!==(n=t.items)&&void 0!==n?n:[]).map((t=>{var e,n,i;const s=null!==(e=t.discounts)&&void 0!==e?e:[],a=null!==(n=t.discounted_price)&&void 0!==n?n:0;let c=0;const o=s.filter((t=>!((null==t?void 0:t.title)&&l.has(t.title)&&(c+=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)&&l.has(t.title))));return i.length!==n.length?(u=!0,Object.assign(Object.assign({},t),{discounts:i})):t})):t.item_components,m=c>0||o.length!==s.length;if(m||u){r=!0;const e=Math.max(1,null!==(i=t.quantity)&&void 0!==i?i:1),n=a*e,s=Math.round((n+c)/e);return Object.assign(Object.assign(Object.assign({},t),m?{discounted_price:s,discounts:o}:{}),u?{item_components:d}:{})}return t}));return r?Object.assign(Object.assign({},t),{items:c}):t}}}]);