1import{q as Me,T as C,aE as qe,aF as H,aG as be,aC as ye,ad as Qe,w as G,E as U,aH as Ee,W as Fe,$ as F,a7 as ve,I as ue,K as ee,x as J,aI as Ue,a as se,O as R,P as me,aJ as Ae,aK as Je,ay as Ie,aw as we,aL as $,L as ce,aM as Xe,aN as Ye,o as Ze,aO as z,aP as Ce,ah as he,D as es,f as ss,aQ as ts,aR as V,aS as W,b as as,e as rs,m as ns,g as os,F as re,h as ls,aT as ne,n as cs,s as is,t as ds}from"./index-entry-CM0FfdjI.js";import{r as m,j as e,l as xe,c as v,C as ie,u as T,t as A,n as Le,h as us,W as ms,o as hs,F as xs,y as ps,f as De,D as fs,a as gs,k as js}from"./vendor-DK5BRhkN.js";import{A as bs,e as ys,L as vs,M as ws}from"./motion-D6knLWPS.js";try{let s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="8f8a2976-b70d-4d00-9202-e77e7b6c532f",s._sentryDebugIdIdentifier="sentry-dbid-8f8a2976-b70d-4d00-9202-e77e7b6c532f")}catch{}{let s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s._sentryModuleMetadata=s._sentryModuleMetadata||{},s._sentryModuleMetadata[new s.Error().stack]=Object.assign({},s._sentryModuleMetadata[new s.Error().stack],{"_sentryBundlerPluginAppKey:frontend/theme":!0})}const de=m.createRef(),Re=m.createContext({productContainerRef:de}),Cs=({children:s})=>{const t=m.useMemo(()=>({productContainerRef:de}),[de]);return e.jsx(Re.Provider,{value:t,children:s})},Te=()=>m.useContext(Re),Ns=(s,t)=>({children:o})=>e.jsx(Me.Item,{className:v("py-6"),initialOpen:t,title:e.jsx(C,{variant:"title-six",className:"text-md",children:s}),children:e.jsx("div",{className:"mb-6",children:o})}),_s=s=>e.jsx("div",{className:"mb-6",...s}),Ps=(s,t)=>e.jsx(C,{variant:"body-sm",className:v("font-regular mb-2 text-[#888888]",s.titleHidden&&"sr-only"),id:t,children:s.title}),ks=(s,t,o)=>{switch(t.type){case"checklist":return e.jsx("div",{role:"group",className:v("grid gap-y-3 justify-items-start",t.name==="size"?"grid-cols-2":"grid-cols-1"),"aria-labelledby":o,children:t.values.map(({value:a,label:c})=>e.jsx(Qe,{value:a,label:c,checked:s.value.includes(a),onChange:r=>{s.onChange(r.currentTarget.checked?[...s.value,a]:s.value.filter(l=>l!==a))}},a))});case"choicechips":return e.jsx(ye,{className:"grid grid-cols-[repeat(auto-fit,minmax(min(100%/2,max(50px,100%/7)),max-content))] justify-start",value:s.value||[],onChange:a=>s.onChange(a),"aria-labelledby":o,children:t.values.map(({value:a,label:c})=>e.jsx(ye.Item,{className:"font-regular",size:"md",value:a,children:c},a))});case"swatches":return e.jsx(be,{className:"grid grid-cols-2 gap-y-3 justify-items-start",value:s.value||[],onChange:a=>s.onChange(a),"aria-labelledby":o,children:t.values.map(({value:a,label:c,color:r})=>e.jsx(be.Item,{value:a,color:r,children:c},a))});case"radiogroup":return e.jsx(H,{...s,value:s.value??"",onChange:(...a)=>s.onChange(...a),children:t.values.map(({value:a,label:c})=>e.jsx(H.Item,{value:a,label:c,children:c},a))});case"pricerange":return e.jsx(qe,{min:t.min,max:t.max,value:s.value,onChange:s.onChange,"aria-labelledby":o});default:return e.jsx(e.Fragment,{})}},Ss=(s,t,o)=>e.jsx(ie,{name:s.name,control:o,defaultValue:[],render:({field:a})=>ks(a,s,t)}),Ms=({section:{title:s,filters:t},initialOpen:o})=>{const a=m.useMemo(()=>s?Ns(s,o):_s,[s]),{control:c}=xe();return e.jsx(a,{children:e.jsx("div",{className:"flex flex-col gap-y-4",children:t.map(r=>{const l=`${r.name}-label`;return e.jsxs("div",{children:[Ps(r,l),Ss(r,l,c)]},r.name)})})})},pe=({className:s,name:t,sections:o,showActions:a,onClose:c,sortOptions:r,cleanDefaults:l})=>{const{control:n,formState:h,watch:i,reset:d}=xe(),{t:x}=T(),p=i([...Object.keys(h.dirtyFields??{}).filter(y=>!["sort"].includes(y)).map(y=>`${t}.${y}`)]).flat().length;m.useMemo(()=>[...o],[o]);const j=m.useMemo(()=>[{title:x("action.sort_by"),filters:[{title:x("action.sort_by"),titleHidden:!0,name:"sort",type:"radiogroup",values:r}]},...o],[r,o]);return e.jsxs("form",{className:v("flex flex-col relative overflow-y-auto overflow-x-hidden",s),onSubmit:y=>{y.preventDefault()},children:[e.jsx("div",{className:"pb-[145px]",children:e.jsx(Me,{exclusive:!0,variant:"icon",iconPosition:"end",children:e.jsx("div",{children:j.map((y,b)=>e.jsx(Ms,{section:y,initialOpen:b===0},b))})})}),a&&e.jsxs("div",{className:` 2 grid grid-cols-1 gap-4 pt-4 pb-8 px-6 fixed w-full bottom-0 left-0 right-0 3 border-t bg-white border-primary-default`,children:[e.jsxs(G,{type:"submit",onClick:c,children:[x("action.apply"),p>0&&` (${p})`]}),e.jsx(G,{type:"reset",variant:"outline",onClick:()=>{d(l),c()},children:x("action.clear")})]})]})},Es=({title:s,sortOptions:t,filterSections:o,cleanDefaults:a})=>e.jsx(U,{children:({onClose:c})=>e.jsxs(e.Fragment,{children:[e.jsx(U.Trigger,{children:e.jsx("button",{className:"typography--body-md underline underline-offset-4 w-fit",children:A("action.filter_and_sort")})}),e.jsxs(U.Content,{direction:"left",className:"max-w-[450px]",children:[e.jsx(U.Header,{className:"sm:px-10 sm:py-8",children:s&&e.jsx(C,{variant:"title-five",children:s})}),e.jsx(U.Body,{className:"py-4 sm:px-10",children:e.jsx(pe,{name:"filters",sections:o,showActions:!0,onClose:c,sortOptions:t,cleanDefaults:a})})]})]})}),Ne=({name:s,tags:t,isLoading:o,skeletonCount:a})=>{const{t:c}=T(),{isLoading:r,t:l}=Ee(),{field:n}=Le({name:s,defaultValue:[]}),h=d=>{n.onChange([...n.value,d.value])},i=d=>{n.onChange(n.value.filter(x=>x.toLowerCase()!==d.value.toLowerCase()))};return!t.length&&!o?null:e.jsx("div",{className:"overflow-x-auto border-t border-[#
3E7E7E7]",children:e.jsxs("fieldset",{children:[e.jsx("legend",{className:"sr-only",role:"group",children:c("action.filter_products_by_type")}),e.jsx(Fe,{className:v(t.length>2?"justify-start sm:justify-center":"justify-center","flex py-6 sm:gap-x-8 gap-x-6 px-5 sm:px-14"),children:o||r?[...Array(a!=null?a+1:4)].map((d,x)=>e.jsx(F,{children:e.jsx(F.Block,{className:"h-12 w-20"})},x)):e.jsxs(e.Fragment,{children:[e.jsx(ve,{role:"checkbox",selected:!n.value.length,"aria-checked":!n.value.length,onClick:()=>n.onChange([]),children:c("general.all")}),t.map(d=>{const x=!!n.value.some(f=>f.toLowerCase()===d.value.toLowerCase());return e.jsx(ve,{selected:x,role:"checkbox","aria-checked":x,onClick:()=>x?i(d):h(d),children:l(d.label)},d.value)})]})})]})})},_e=typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,Fs=({tag:s,selected:t,onClick:o})=>{const{t:a}=Ee();return e.jsxs("button",{type:"button",role:"checkbox","aria-checked":t,onClick:o,className:"flex flex-col items-start w-full cursor-pointer group",children:[e.jsx("div",{className:v("w-full aspect-[5/6] overflow-hidden border",t?"border-primary-active":"border-transparent"),children:s.video?.sources?.length?e.jsx("video",{autoPlay:!_e,muted:!0,loop:!_e,playsInline:!0,preload:"metadata",className:"w-full h-full object-cover",poster:s.video.preview_image?.src,children:s.video.sources.sort((c,r)=>r.height-c.height).map(c=>e.jsx("source",{src:c.url,type:c.mime_type},c.url))}):s.image?.src?e.jsx(ue,{className:"w-full h-full object-cover",alt:s.image.alt??s.label,data:{src:s.image.src,width:158,height:190,crop:"center"}}):null}),e.jsx(C,{variant:"body-md",className:"text-center w-full mt-2",children:a(s.label)})]})},As=({selectedCount:s,onClear:t})=>{const{t:o}=T();return e.jsxs("div",{className:"flex items-center px-6 md:px-8 lg:px-10 pb-4",children:[e.jsx(ee.Fade,{show:s>0,children:e.jsx(C,{variant:"body-sm",children:o("general.selected_count",{count:s})})}),e.jsxs("button",{type:"button",disabled:s===0,className:`ml-auto flex items-center gap-3 ${s>0?"cursor-pointer text-primary":"cursor-default text-subtle opacity-50"}`,onClick:t,children:[e.jsx(J.Close,{className:"w-2 h-2"}),e.jsx(C,{variant:"body-sm",children:o("action.clear_all")})]})]})},Pe=({name:s,tags:t,isLoading:o,skeletonCount:a=3})=>{const{t:c}=T(),{field:r}=Le({name:s,defaultValue:[]}),[l,n]=m.useState(!1),[h,i]=us({dragFree:l,watchDrag:l},[ms()]);m.useEffect(()=>{if(!i)return;const f=()=>{const p=i.containerNode().scrollWidth>i.rootNode().clientWidth;n(j=>j===p?j:p)};return f(),i.on("reInit",f),()=>{i.off("reInit",f)}},[i]);const d=r.value,x=d.length;return!t.length&&!o?null:e.jsxs("div",{className:"py-4 sm:py-10 border-t border-[#E7E7E7]",children:[e.jsx(As,{selectedCount:x,onClear:()=>r.onChange([])}),o&&!t.length?e.jsx("div",{className:"overflow-hidden",children:e.jsx("div",{className:"flex justify-center gap-3 px-6 md:px-8 lg:px-10",children:[...Array(a)].map((f,p)=>e.jsxs(F,{className:"shrink-0 grow-0 basis-[160px]",children:[e.jsx(F.Block,{className:"w-full aspect-square"}),e.jsx(F.Block,{className:"h-6 w-3/4 mt-2 mx-auto rounded"})]},p))})}):e.jsx("div",{className:"overflow-hidden",ref:h,children:e.jsx("div",{className:`flex ${l?"gap-2 sm:gap-4 pl-6 lg:pl-10":"justify-center gap-3"}`,role:"group","aria-label":c("action.filter_products_by_type"),children:t.map((f,p)=>{const j=d.some(b=>b.toLowerCase()===f.value.toLowerCase()),y=p===t.length-1;return e.jsx("div",{className:`shrink-0 grow-0 basis-[160px] ${l&&y?" mr-6 lg:mr-10":""}`,children:e.jsx(Fs,{tag:f,selected:j,onClick:()=>j?r.onChange(d.filter(b=>b.toLowerCase()!==f.value.toLowerCase())):r.onChange([...d,f.value])})},f.value)})})})]})},Is=s=>s.some(t=>t.image?.src!=null||t.video!=null),Ls=({tags:s,sortOptions:t,filterSections:o,tagsInputName:a="tags",onSubmit:c,isLoading:r,defaultValues:l,cleanDefaults:n,expectedTags:h,...i})=>{const d=hs({...i,defaultValues:l}),x=m.useRef(c);return m.useEffect(()=>{x.current=c}),m.useEffect(()=>{const f=d.watch(()=>d.handleSubmit((p,j)=>x.current(p,j))());return()=>f.unsubscribe()},[d.handleSubmit,d.watch]),e.jsxs(xs,{...d,children:[s.length?Is(s)?e.jsx(Pe,{name:a,tags:s,isLoading:r,skeletonCount:h?.count}):e.jsx(Ne,{name:a,tags:s,isLoading:r,skeletonCount:h?.count}):h?.type==="carousel"?e.jsx(Pe,{name:a,tags:[],isLoading:r,skeletonCount:h.count}):h?.type==="tagfilterbar"?e.jsx(Ne,{name:a,tags:[],isLoading:r,skeletonCount:h.count}
3):null,e.jsx(Fe,{size:"fluid",className:"border-t border-[#E7E7E7] sticky top-0 bg-primary z-[15]",children:e.jsxs("div",{className:"flex flex-row justify-between py-6",children:[e.jsx(Es,{title:A("action.filter_and_sort"),sortOptions:t,filterSections:o,cleanDefaults:n}),e.jsx(Ue,{})]})})]})},Ds=({name:s,options:t})=>{const{control:o}=xe(),a=se(({screens:c})=>`(min-width: ${c.md})`);return e.jsx("div",{className:` 4 relative flex flex-1 whitespace-nowrap items-center 5 md:flex-grow-0 md:border-l md:border-primary-default`,children:e.jsx(R,{scrollLock:!a,children:({isOpen:c,onClose:r})=>e.jsxs(e.Fragment,{children:[e.jsx(R.Trigger,{children:e.jsx(G,{className:"w-full h-full rounded-[0] pr-2 hover:enabled:bg-transparent normal-case typography typography--body-sm",variant:"ghost",endIcon:e.jsx(J.ChevronDown,{className:v("w-2 transition",c&&"rotate-180")}),children:A("action.sort_by")})}),a?e.jsx(ee.Fade,{className:` 6 absolute top-full right-2 py-5 px-4 z-10 7 shadow-2 bg-white`,children:e.jsx(R.Content,{onClickAway:l=>{r(),l.preventDefault(),l.stopPropagation()},children:e.jsx(ie,{name:s,control:o,render:({field:l})=>e.jsx(H,{...l,value:l.value??"",onChange:(...n)=>{l.onChange(...n),r()},children:t.map(n=>e.jsx(H.Item,{...n},n.value))})})})}):e.jsxs(me,{children:[e.jsx(R.Backdrop,{className:"z-40"}),e.jsx(ee.Slide,{direction:"bottom",className:v("fixed bottom-0 w-full w-full bg-white z-50","shadow-2 rounded-t-sm"),children:e.jsxs(R.Content,{className:"pb-7",children:[e.jsxs("div",{className:"py-4 px-6 flex justify-between items-center border-b border-primary-default",children:[e.jsx(C,{variant:"title-six",className:"text-md",children:A("action.sort_by")}),e.jsx(Ae,{onClick:r,"aria-label":"Close"})]}),e.jsx(ie,{name:s,control:o,render:({field:l})=>e.jsx(H,{...l,value:l.value??"",onChange:(...n)=>{l.onChange(...n),r()},children:t.map(n=>e.jsx(H.Item,{className:"py-5 mx-6 border-b border-primary-default last:border-0",...n},n.value))})})]})})]})]})})})},Rs=({sections:s,name:t})=>{const{isOpen:o,onToggle:a,onClose:c}=Je(),{productContainerRef:r}=Te();return e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-full h-full rounded-[0] pl-2 hover:enabled:bg-transparent normal-case typography typography--body-sm",variant:"ghost",onClick:a,endIcon:e.jsx(J.ChevronDown,{className:v("w-2 transition",o&&"rotate-180")}),children:o?A("action.hide_filters"):A("action.show_filters")}),e.jsx(me,{containerRef:r,children:e.jsx(bs,{children:o&&e.jsx(ys,{initial:{marginLeft:-334,opacity:0},animate:{marginLeft:0,opacity:1},exit:{marginLeft:-334,opacity:0},transition:{duration:.33},className:"sticky top-[calc(var(--header-height)_-_theme(spacing.8))]",children:e.jsx("div",{className:"w-[334px] max-h-screen overflow-y-auto px-7 py-8 right-0",children:e.jsx(pe,{name:t,sections:s,showActions:!1,onClose:c})})})})})]})},Ts=({name:s,sections:t})=>e.jsx(R,{children:({isOpen:o,onClose:a})=>e.jsxs(e.Fragment,{children:[e.jsx(R.Trigger,{children:e.jsx(G,{className:"w-full h-full rounded-[0] normal-case typography typography--body-sm",variant:"ghost",endIcon:e.jsx(J.ChevronDown,{className:v("w-2 transition",o&&"rotate-180")}),children:o?A("action.hide_filters"):A("action.show_filters")})}),e.jsx(me,{children:e.jsx(ee.Slide,{direction:"bottom",className:"fixed inset-0 bg-white z-50",children:e.jsxs(R.Content,{className:"flex flex-col h-full max-h-full relative",children:[e.jsxs("div",{className:` 8 py-4 px-6 sticky top-0 bg-white z-10 9 flex justify-between items-center 10 border-b border-primary-default`,children:[e.jsx(C,{variant:"title-six",className:"text-md",children:A("action.filter_by")}),e.jsx(Ae,{onClick:a,"aria-label":"Close"})]}),e.jsx(pe,{className:"h-full max-h-ful flex-1 px-6 pt-4 pb-[100px]",name:s,sections:t,showActions:!0,onClose:a})]})})})]})}),Os=({name:s,sections:t})=>{const o=se(({screens:c})=>`(min-width: ${c.md})`),a=m.useMemo(()=>o?Rs:Ts,[o]);return e.jsx("div",{className:` 11 relative flex flex-1 items-center md:flex-grow-0 12 whitespace-nowrap border-r border-primary-default`,children:e.jsx(a,{name:s,sections:t})})},$s=Ie(Ls,{FilterBy:Os,SortBy:Ds}),Bs=(s,t)=>{const[o,a]=m.useMemo(()=>Object.keys(s).map(r=>parseInt(r,10)).sort((r,l)=>r-l).reduce(([r,l],n)=>{const h=s[n],i=Math.max(0,Math.floor(n/t));let d=0,x=0;switch(h.layout){case"2x1":d-=1,x-=1;break}const f=i*t,p=f+(t-1)+d+l,j=ps(n+l,f,p);return[{...r,[j]:h},l+x]},[{},0]),[s]);return{normalisedPromoCards:o,finalIndexShift:a}},oe="productGridResized",Oe=()=>({publish:o=>{const a=new ResizeObserver(c=>{const r=new CustomEvent(oe,{detail:c});document.dispatchEvent(r)});return o.current&&a.observe(o.current),()=>{a.disconnect()}},subscribe:o=>{const a=c=>{const{detail:r}=c;o(r)};return document.addEventListener(oe,a),()=>{document.removeEventListener(oe,a)}}}),Vs=({className:s,gridSize:t,...o}
12)=>{const a=m.useRef(null),{publish:c}=Oe();m.useEffect(()=>{const l=c(a);return()=>{l()}},[]);let r="";switch(t){case"lg":r="grid grid-cols-1 sm:grid-cols-2 gap-y-6 sm:gap-y-4 sm:max-w-[80%] md:max-w-[70%] 2xl:max-w-[50%] mx-auto";break;case"md":r="grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-y-6 sm:gap-y-8";break;case"sm":r="grid grid-cols-4 gap-y-[2px] md:grid-cols-6 sm:gap-y-1";break;default:r="";break}return e.jsx("div",{ref:a,className:v(r,"auto-rows-auto grid-flow-dense auto-rows-[1fr] gap-x-[2px] sm:gap-x-1 mb-8 w-full overflow-hidden",s),...o})},Hs=()=>{const{t:s}=T();return e.jsxs("div",{className:"my-auto p-6 max-w-[600px] mx-auto text-center","data-testid":"collection-no-results",children:[e.jsx("div",{className:"inline-block p-4 bg-surface-primary-default rounded-circle mb-6",children:e.jsx(J.Search,{className:"w-8 h-8"})}),e.jsx(C,{variant:"title-four",className:"mb-4",children:s("collection.no_results_title")}),e.jsx(C,{variant:"body-md",className:"mt-2",children:s("collection.no_results_description")})]})},zs={"1x1":"col-span-1 sm:row-span-1 aspect-[2/3]","2x1":"col-span-2 sm:col-span-2 sm:row-span-1"},Gs=600,Ws=({item:s,handle:t,onClick:o,onQuickAdd:a,settings:c,gridSize:r,idx:l})=>{const{product:n,isLoading:h}=s,i=m.useRef(null),{data:d}=Xe(),{subscribe:x}=Oe(),[f,p]=m.useState(!0),j=se(N=>`(min-width: ${N.screens.xl})`),{primaryBadge:y,secondaryBadge:b}=Ye({badges:n.badges,price:n.price,compareAtPrice:n.compareAtPrice,tags:n.tags}),{ref:k,inView:_}=De({rootMargin:"0px 0px 350px 0px"});return m.useEffect(()=>{if(_){const N=x(([I])=>{i.current?.imageCarousel?.reInit();const{width:S}=I.contentRect;p(S>Gs)});return()=>{p(!0),N()}}return()=>{p(!0)}},[_]),r==="sm"?n.images.length==0?null:e.jsx("div",{className:"collection__product-card",ref:k,"data-inview":_,children:_&&n.images.length&&n.images[0].src?e.jsx("div",{className:"relative overflow-hidden bg-surface-primary-default",children:e.jsx("a",{href:t?`/collections/${t}${n.url}`:n.url,onClick:()=>o(n),children:e.jsx(ue,{data:{src:n.images[0].src,width:j?400:200,height:j?400:200},loading:l<=12?"eager":"lazy",className:"object-cover w-full h-full aspect-[2/3]"})})}):e.jsx(F,{children:e.jsx(F.Block,{className:"w-full bg-surface-primary-default aspect-[2/3]"})},l)}):e.jsx("div",{className:"collection__product-card",ref:k,"data-inview":_,children:_?e.jsx(Ze,{ref:i,"aria-label":`View ${n.title}`,"data-testid":"product-card",product:{...n,images:n.images.map(({src:N,alt:I},S)=>({src:N,alt:I,loading:l<=8&&S===0?"eager":"lazy"}))},isLoading:h,onClick:()=>o(n),onQuickAdd:()=>a(n),useSwatches:d?.enable_swatches??!1,useImageCarousel:!0,useQuickAdd:f||!j},n.id):e.jsxs(z,{"data-testid":"product-card",href:n.url,children:[e.jsx(z.ImageWrapper,{children:e.jsx(z.Image,{alt:n.title})}),e.jsx(z.Details,{title:n.title,price:e.jsx(Ce,{price:n.price}),compareAtPrice:n.compareAtPrice?e.jsx(Ce,{price:n.compareAtPrice}):null,swatches:d?.enable_swatches?n.swatches.map(N=>
12({id:N.id,color:N.color,canonical_color:N.canonicalColor,href:N.url,title:N.title})):[],primaryBadge:y,secondaryBadge:b,color:n.color,isLoadingAdditionalData:h})]})})},Ks=m.memo(({productsOrPromoCards:s,handle:t,settings:o,onClick:a,onQuickAdd:c,gridSize:r})=>{const l=m.useMemo(()=>r==="sm"?s.filter(n=>!("layout"in n)):s,[s,r]);return e.jsx(e.Fragment,{children:l.map((n,h)=>{if("layout"in n){const i=n;return e.jsxs(m.Fragment,{children:[e.jsx("div",{className:we(zs[i.layout],r!=="sm"&&i.layout=="2x1"&&"aspect-[4/3] h-min min-h-[auto] border-b-[3px] border-white",r=="lg"&&"col-span-1"),children:e.jsxs($,{as:i.href?"a":"div",href:i.href,contentPlacement:"inside",overlay:i.overlay,className:"block",children:[i.video?e.jsx($.Video,{className:"h-full",video:i.video,alt:i.title}):e.jsx($.Image,{className:"h-full",src:i.image??"",alt:i.title}),e.jsxs($.Content,{className:we(r==="sm"&&"hidden sm:block"),children:[i.subtitle&&e.jsx($.Subtitle,{children:i.subtitle}),e.jsx($.Title,{children:i.title}),i.buttonText&&e.jsx($.Actions,{children:e.jsx(ce,{className:"underline underline-offset-4",href:i.href,color:i.buttonVariant,children:i.buttonText})})]})]})}),e.jsx("div",{className:"hidden"})]},h)}else{const i=n;return e.jsx(Ws,{idx:h,settings:o,handle:t,onClick:a,onQuickAdd:c,item:i,gridSize:r},i.product.id)}})})}),ke=({fetch:s,isFetching:t=!1,page:o,children:a,className:c,...r})=>{const{searchParams:l,replace:n}=he(),h=new URLSearchParams(l);h.set("page",o.toString());const i=`${window.location.pathname}?${h}`,d=x=>{x.preventDefault(),x.stopPropagation(),n({page:o}),s()};return e.jsx(G,{as:"a",href:i,disabled:t,onClick:d,isLoading:t,className:v("min-w-[200px]",c),...r,children:a})},Se=()=>{},qs=({promoCards:s,targetPageSize:t,isInitialLoading:o,hasNextPage:a,hasPreviousPage:c,isFetching:r,isFetchingNextPage:l,fetchNextPage:n,fetchPreviousPage:h,pages:i,handle:d,enableInfiniteScroll:x=!0})=>{const{searchParams:f,replace:p}=he(),[j]=De({threshold:.1,rootMargin:"200%",onChange:async w=>{if(w&&x&&a&&!l){const g=i[i.length-1]?.nextCursor??0;new URLSearchParams(f).set("page",g.toString()),await n(),p({page:g})}}}),{productContainerRef:y}=Te(),{t:b}=T(),{settings:k}=es(),_=i.some(({products:w})=>w.length>0),N=m.useMemo(()=>i.reduce((w,{products:g})=>w+g.length,0),[i]),I=m.useMemo(()=>i[i.length-1]?.totalCount??0,[i]),{normalisedPromoCards:S,finalIndexShift:X}=Bs(s,t),K=m.useMemo(()=>i.flatMap(({products:w,queryID:g,startOffset:M})=>w.map((B,Q)=>({...B,queryID:g,index:M+Q}))).map((w,g)=>({...w,position:g+1})),[i]),{results:O,settledIds:L}=ss(K,{withVariants:!0}),Y=m.useMemo(()=>{const w=O.map(g=>({...g,isLoading:!L.has(g.product.id)}));return Object.keys(S).filter(g=>parseInt(g,10)<N+Math.abs(X)).forEach(g=>{const M=parseInt(g,10),B=K.findIndex(({index:Q})=>Q===M);B!==-1&&w.splice(B,0,S[M])}),w},[O,L,K,S]),te=i?.[0],ae=i?.[i?.length-1],q=ts(w=>w.currentGridSize);return e.jsx("div",{className:"flex relative flex-1",children:e.jsxs(vs,{children:[e.jsx(ws,{ref:y}),_||o?e.jsxs("div",{className:"w-full",children:[c&&e.jsx("div",{className:"flex w-full justify-center mb-8",children:e.jsx(ke,{fetch:h,isFetching:r,page:i[0]?.prevCursor??0,children:b("action.load_previous")})}),e.jsxs(Vs,{"data-testid":"product-grid",gridSize:q,children:[o?Array(t).fill(0).map((w,g)=>e.jsx(z.Skeleton,{"data-testid":"product-skeleton"},g)):e.jsx(Ks,{onClick:Se,onQuickAdd:Se,productsOrPromoCards:Y,handle:d??!1,settings:k,gridSize:q}),l&&Array(Math.round(t/2)).fill(0).map((w,g)=>q==="sm"?e.jsx(F,{children:e.jsx(F.Block,{className:"w-full aspect-[2/3]"})},g):e.jsx(z.Skeleton,{},g))]}),e.jsxs("div",{className:"flex flex-col gap-y-3 items-center mb-15",children:[a&&e.jsx(ke,{className:v(x&&"hidden"),page:i[i.length-1]?.nextCursor??0,isFetching:r,fetch:n,children:b("action.load_more")}),_&&a&&!l&&x&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-screen z-[-999]",ref:j}),e.jsx(C,{variant:"body-sm",children:b("general.viewing_x_y_of_total_type",{x:te?.startOffset+1,y:ae?.endOffset??1,total:I,type:b("product.products")})})]})]}):e.jsx(Hs,{})]})})},Qs=({children:s,isTitlePrimary:t})=>e.jsx("div",{className:"my-6 flex items-center justify-center",children:e.jsx(C,{variant:"title-five",as:t?"h1":"h3",className:"text-center",children:s})}),Us=({title:s,heroImage:t,heroImageDesktop:o,isTitlePrimary:a,heroImageOverlay:c,description:r})=>{const l=se(({screens:p})=>`(min-width: ${p.sm})`),n=l?o||t:t||o,{t:h}=T(),x=l?150:100,f=r&&r.length>x;return n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"collection-hero-image relative w-full h-full",children:[e.jsx("div",{className:v("collection-hero-image__image h-full",c&&"overlay"),children:e.jsx(ue,{src:n.src,alt:n.alt,className:"w-full h-full object-cover max-h-[248px] sm:max-h-[440px]",width:n.width,height:n.height,loading:"eager",fetchPriority:"high"})}),e.jsx("div",{className:"collection-hero-image__text absolute inset-0 flex items-center justify-center",children:e.jsx(C,{variant:l?"title-three":"title-five",as:a?"h1":"h3",className:"text-center text-inverse",children:s})})]}),r&&e.jsx("div",{className:"mb-4 sm:mb-6 py-3 px-4 sm:max-w-[800px] self-center",children:f?e.jsx(V,{className:({isExpanded:p})=>v(!p&&"flex flex-row items-start gap-1"),children:({isExpanded:p})=>e.jsxs(e.Fragment,{children:[e.jsx(V.Content,{variant:"body-sm",className:v(!p&&"line-clamp-1"),children:r}),e.jsx(V.Trigger,{children:e.jsx(ce,{as:"button",type:"button",variant:"body-sm",className:"underline whitespace-nowrap",children:h(p?"action.read_less":"action.read_more")})})]})}):e.jsx(C,{variant:"body-sm",children:r})})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:v("my-6 flex flex-col justify-center wrapper wrapper--size-fluid max-w-full px-6 lg:px-10 items-center"),children:[e.jsx(C,{variant:"title-four",as:a?"h1":"h3",className:"text-center",children:s}),r&&e.jsx("div",{className:"mt-4 sm:mt-2 sm:max-w-[800px]",children:f?e.jsx(V,{className:({isExpanded:p})=>v(!p&&"flex flex-row items-start gap-1"),children:({isExpanded:p})=>e.jsxs(e.Fragment,{children:[e.jsx(V.Content,{variant:"body-sm",className:v(!p&&"line-clamp-1"),children:r}),e.jsx(V.Trigger,{children:e.jsx(ce,{as:"button",type:"button",variant:"body-sm",className:"underline whitespace-nowrap",children:h(p?"action.read_less":"action.read_more")})})]})}):e.jsx(C,{variant:"body-sm",children:r})})]})})},Js=(s=[],t=[])=>!s.length||!t.length?[]:s.reduce((o,a)=>{const c=W(a),r=t.find(l=>[l.value,l.label].some(n=>
12W(n)===c));return r?[...o,r]:o},[]),Xs="pyjama-sets",Ys=["color","page"],Zs=({handle:s,collectionTitle:t,searchParams:o,i18next:a=fs,location:c=window.location})=>{if(s!==Xs||[...o.keys()].some(j=>!Ys.includes(j)))return null;const l=o.getAll("color");if(l.length!==1)return null;const n=l[0].trim().toLowerCase();if(!n||n.includes(","))return null;const h=n.replace(/\s+/g,"_");if(!a.exists(`color.${h}`))return null;const i=o.getAll("page");if(i.length>1)return null;const d=i[0];if(d!==void 0&&!/^[1-9]\d*$/.test(d))return null;const x=a.t(`color.${h}`,{defaultValue:""});if(!x)return null;const f=new URLSearchParams;f.set("color",n),d&&f.set("page",d);const p=`${x} ${t}`;return{h1:p,title:`${p} | Lounge`,canonicalHref:`${c.origin}${c.pathname}?${f.toString()}`}},le=(s,t)=>document.querySelector(s)?.setAttribute("content",t),et=({title:s,canonicalHref:t})=>{document.title=s,document.querySelector('link[rel="canonical"]')?.setAttribute("href",t),le('meta[property="og:title"]',s),le('meta[name="twitter:title"]',s),le('meta[property="og:url"]',t),document.querySelector('meta[name="description"]')?.remove(),document.querySelector("[data-collection-seo-content]")?.remove()},st=(s=[],t=[])=>!s||s.length===0?t:t.filter(o=>s.some(a=>[o.value,o.label].some(c=>W(a)===W(c)))),tt=(s,t)=>s.trim().toLowerCase()===t.trim().toLowerCase(),ot=({data:{id:s="",handle:t="",promocards:o=[],isTitlePrimary:a=!0,title:c="",product_features_whitelist:r=[],collection_features:l=[],enable_infinite_scroll:n=!1,enable_swatches:h=!1,hero_image:i,hero_image_desktop:d,hero_image_overlay:x,categories_whitelist:f=[],description:p}={}})=>{const{searchParams:j}=he(),{t:y}=T(),{getFlag:b}=as(),k=m.useMemo(()=>b("enable_faceted_color_seo")?Zs({handle:t,collectionTitle:c,searchParams:new URLSearchParams(window.location.search)}):null,[b,t,c]);m.useEffect(()=>{k&&et(k)},[k]);const _=m.useMemo(()=>l.length>0?l.map(u=>u.name):r,[l,r]),N=m.useMemo(()=>l.length>0?{type:l.some(P=>P.image?.src!=null||P.video!=null)?"carousel":"tagfilterbar",count:l.length}:r.length>0?{type:"tagfilterbar",count:r.length}:null,[l,r]),{defaultValues:I,cleanDefaults:S,getValues:X,updateSearchParams:K}=rs({defaultValues:cs}),O=u=>({...u,color:u.color.map(P=>P.toLowerCase()),tags:u.tags.map(P=>_.find(E=>tt(E,P))??P)}),[L,Y]=m.useState(O(I));m.useEffect(()=>Y(O(X())),[j,X,_]);const te=j.get("page")?Number(j.get("page")):1,ae=m.useMemo(()=>ns(L,{isPriceFilterEnabled:b("enable_price_filter")}),[L,b]),q=k?.h1??c,w=k?void 0:p,{data:{pages:g=[]}={},isLoading:M,fetchNextPage:B,fetchPreviousPage:Q,hasNextPage:$e,hasPreviousPage:Be,isFetchingNextPage:Ve,isFetchingPreviousPage:He}=gs({queryKey:["products",s,{...L}],queryFn:({pageParam:u=1})=>is.query({query:"",page:u,hitsPerPage:24,facets:ae,sortKey:L?.sort,collections:t??"",useSwatches:h??!1}),placeholderData:js,initialPageParam:te,getNextPageParam:u=>u.page<Math.ceil(u.totalHits/u.hitsPerPage)?u.page+1:void 0,getPreviousPageParam:u=>u.page>1?u.page-1:void 0}),ze=u=>{const P=O(u);ds(L,P,{collection:t}),K(P),Y(P)},D=g[g.length-1]?.facets??[],fe=m.useMemo(()=>os(D.find(u=>u.name===re.DISCOUNT)),[D]),ge=m.useMemo(()=>st(f,D.find(u=>u.name===re.CATEGORIES)?.values.map(u=>({label:u.value,value:u.value}))),[f,D]),Ge=m.useMemo(()=>ls({facets:D,discountValues:fe,t:y,categoriesOverride:ge,isPriceFilterEnabled:b("enable_price_filter")}),[fe,D,ge,y,b]),We=m.useMemo(()=>{const u=D.find(E=>E.name===re.TAGS),P=Js(_,u?.values.map(E=>({label:E.value,value:E.value})));return l.length?P.map(E=>{const je=l.find(Ke=>W(Ke.name)===W(E.value));return{...E,image:je?.image??null,video:je?.video??null}}):P},[_,D,l]);return e.jsxs(e.Fragment,{children:[e.jsx(Z.HeroImage,{title:q,heroImage:i,heroImageDesktop:d,isTitlePrimary:a,heroImageOverlay:x,description:w}),e.jsxs(Z,{children:[e.jsx(Z.Filters,{onSubmit:ze,tagsInputName:"tags",defaultValues:O(I),cleanDefaults:S,tags:We,isLoading:M,expectedTags:N,filterSections:Ge,sortOptions:[{label:y("general.most_relevant"),value:ne.RELEVANCE},{label:y("general.price_low_to_high"),value:ne.PRICE_ASC},{label:y("general.price_high_to_low"),value:ne.PRICE_DESC}]}),e.jsx(Z.Products,{pages:g&&g.length>0?g.flatMap(u=>({products:u.hits,queryID:u.queryID||"",startOffset:u.offset,endOffset:Math.min(u.offset+u.hitsPerPage,u.totalHits),totalCount:u.totalHits,nextCursor:u.page<Math.ceil(u.totalHits/u.hitsPerPage)?u.page+1:void 0,prevCursor:u.page>1?u.page-1:void 0})):[],fetchNextPage:B,fetchPreviousPage:Q,hasNextPage:$e,hasPreviousPage:Be,isFetching:M,isFetchingNextPage:Ve,isFetchingPreviousPage:He,isInitialLoading:M,targetPageSize:24,handle:t??void 0,promoCards:o,enableInfiniteScroll:n})]})]})},Z=Ie(Cs,{Filters:$s,Products:qs,Title:Qs,HeroImage:Us});export{Z as Collection,ot as CollectionPage}; 13//# sourceMappingURL=index-DU2-0ITs.js.map
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.