1import{a as Q}from"/build/_shared/chunk-BA2K3D5C.js";import{c as q}from"/build/_shared/chunk-KDX5YMAU.js";import{a as D}from"/build/_shared/chunk-SYJV6ZQ7.js";import{a as L}from"/build/_shared/chunk-O2SOWP54.js";import{a as K}from"/build/_shared/chunk-6GXZJ4II.js";import{a as H}from"/build/_shared/chunk-2PERMO3C.js";import{i as G}from"/build/_shared/chunk-GTA4OOPW.js";import{a as _}from"/build/_shared/chunk-CTH3JSOV.js";import{d as F}from"/build/_shared/chunk-WOCI7MY6.js";import{a as U}from"/build/_shared/chunk-DIKXELKC.js";import{a as B}from"/build/_shared/chunk-UXJUA2QE.js";import{b}from"/build/_shared/chunk-V53WT573.js";import{a as W}from"/build/_shared/chunk-YUUKFOQM.js";import{a as I}from"/build/_shared/chunk-5OBEDPFR.js";import{a as J}from"/build/_shared/chunk-H6S7FWVP.js";import{d as v}from"/build/_shared/chunk-T36URGAI.js";var r=v(J());var j=v(Q());var e=v(I()),ue=({brand:a,productCategory:s,searchTerm:i,carouselConfig:C,carouselName:w,variant:c,onSlideClick:p,onCloseClick:N,lazyLoadCarousell:E,listLocation:P,...k})=>{var x,f;let[t,n]=(0,r.useState)(s),[y,m]=(0,r.useState)(i),[g,o]=(0,r.useState)(a);(0,r.useEffect)(()=>{n(s),m(i),o(a)},[s,i,a]);let{translate:d}=W();return(0,e.jsxs)("div",{className:`${c==="personalisedCarousel"?"ml-4 md:ml-0":""}`,children:[c==="personalisedCarousel"?(0,e.jsxs)("div",{className:"md:flex mb-6 md:mb-12 md:justify-between",children:[(0,e.jsxs)("div",{className:"pb-6 md:pb-0 md:pt-6",children:[(0,e.jsx)(B,{as:"div",className:"font-semibold md:font-bold sm:pb-4 md:pb-2 lg:pb-4 text-2xl sm:text-[40px] md:text-3xl lg:text-[40px]",children:d("content.personalised.carousel.weveGotYou")}),(0,e.jsx)(B,{as:"div",className:"font-light md:font-regular text-base sm:text-xl md:text-lg lg:text-xl",children:d("content.personalised.carousel.shopLatestEssentials")})]}),(0,e.jsxs)("div",{className:"flex flex-row md:items-end",children:[(0,e.jsx)(b,{className:`${t==="womens-clothing"?"bg-black text-primary":" border border-slate-500"} rounded-lg text-base sm:text-xl md:text-base lg:text-xl font-regular p-3 sm:p-4 md:p-3 lg:p-4 lg:h-2/3 mr-3 sm:mr-3 md:mr-3 lg:mr-6`,onClick:()=>{m(""),o(""),n("womens-clothing")},children:d("content.personalised.carousel.womens")}),(0,e.jsx)(b,{className:`${t==="mens"?"bg-black text-primary":" border border-slate-500"} rounded-lg text-base sm:text-xl md:text-base lg:text-xl font-regular p-3 sm:p-4 md:p-3 lg:p-4 lg:h-2/3 mr-3 sm:mr-3 md:mr-3 lg:mr-6`,onClick:()=>{m(""),o(""),n("mens")},children:d("content.personalised.carousel.mens")}),(0,e.jsx)(b,{className:`${t==="beauty"?"bg-black text-primary":" border border-slate-500"} rounded-lg text-base sm:text-xl md:text-base lg:text-xl font-regular p-3 sm:p-4 md:p-3 lg:p-4 lg:h-2/3 mr-3 sm:mr-3 md:mr-3 lg:mr-6`,onClick:()=>{m(""),o(""),n("beauty")},children:d("content.personalised.carousel.beauty")}),(0,e.jsx)(b,{className:`${t==="home"?"bg-black text-primary":" border border-slate-500"} rounded-lg text-base sm:text-xl md:text-base lg:text-xl font-regular p-3 sm:p-4 md:p-3 lg:p-4 lg:h-2/3`,onClick:()=>{m(""),o(""),n("home")},children:d("content.personalised.carousel.home")})]})]}):"",E?(0,e.jsx)(j.default,{once:!0,offset:500,placeholder:(0,e.jsx)(L,{slidesPerView:(f=(x=k.carousel)==null?void 0:x.slidesPerView)!=null?f:void 0}),children:(0,e.jsx)(Y,{brand:g,productCategory:t,searchTerm:y,carouselConfig:C,carouselName:w,variant:c,onSlideClick:p,onCloseClick:N,listLocation:P})}):(0,e.jsx)(Y,{brand:g,productCategory:t,searchTerm:y,carouselConfig:C,carouselName:w,variant:c,onSlideClick:p,onCloseClick:N})]})},Y=({brand:a,productCategory:s,searchTerm:i,carouselConfig:C,carouselName:w,variant:c,onSlideClick:p,onCloseClick:N,lazyLoadCarousell:E,listLocation:P="homepage",...k})=>{var x,f,T,V,O,M,z,R,A,$;let t=G({listType:"carousel"}),{viewItemList:n}=H(),{ref:y,inView:m}=K({triggerOnce:!0,threshold:.1}),g=(0,r.useRef)(null);(0,r.useEffect)(()=>{let l=i?i.replace(/["^~]/g,""):"",u=[];a&&a!=="null"&&u.push({key:"brand",values:[a]}),s&&s!=="null"&&u.push({key:"categorySlugs",values:[s]});let h=0,S=10;t.search(l,h,S,u)},[a,i,s]);let o=(0,r.useMemo)(()=>D(`personalised_carousel_${s!=null?s:"default"}`,P),[s,P]);(0,r.useEffect)(()=>{var u,h;let l=(h=(u=t.data)==null?void 0:u.plpProductSearch)==null?void 0:h.edges;m&&(l!=null&&l.length)&&g.current!==o&&(g.current=o,n(l.map(S=>S.node),o))},[m,t.data,o,n]);let d=U(2,4);return!((x=t.data)!=null&&x.plpProductSearch)||!((T=(f=t.data)==null?void 0:f.plpProductSearch)!=null&&T.edges)||((M=(O=(V=t.data)==null?void 0:V.plpProductSearch)==null?void 0:O.edges)==null?void 0:M.length)===0?(0,e.jsx)(L,{slidesPerView:(R=(z=k.carousel)==null?void 0:z.slidesPerView)!=null?R:void 0}):(0,e.jsx)("div",{ref:y,children:(0,e.jsx)(F,{slideDeficitBehaviour:"start",carouselConfig:C,carouselName:o,renderControls:()=>(0,e.jsx)(_,{showControls:!0,prevButtonClassName:"top-1/3",nextButtonClassName:"top-1/3"}),children:($=(A=t.data)==null?void 0:A.plpProductSearch.edges)==null?void 0:$.map(l=>(0,e.jsx)("div",{onClick:()=>p&&p(l),children:(0,e.jsx)(q,{analyticsCategory:"carousel",layout:"1-column",imageWidths:d,...l.no
1de,productClick:N,listType:o,carouselName:o},l.node.productKey)},l.node.productKey))})})};export{ue as a,Y as b};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.