1var N=Object.defineProperty;var w=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable;var _=(e,t,s)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,P=(e,t)=>{for(var s in t||(t={}))k.call(t,s)&&_(e,s,t[s]);if(w)for(var s of w(t))x.call(t,s)&&_(e,s,t[s]);return e};var C=(e,t,s)=>new Promise((a,n)=>{var i=r=>{try{o(s.next(r))}catch(m){n(m)}},l=r=>{try{o(s.throw(r))}catch(m){n(m)}},o=r=>r.done?a(r.value):Promise.resolve(r.value).then(i,l);o((s=s.apply(e,t)).next())});import{j as I,p as B,W as M}from"./npm.sellpy-design-system.DdsWMDHW.bundle.js";import{r as y}from"./npm.react-hook-form.HNw-giVQ.bundle.js";import{m as O}from"./npm.lodash.DxN61Y-S.bundle.js";import{l as h,a as F,u as H}from"./npm.react-router.BDfxye5A.bundle.js";import{a as V,aY as D,av as E,cB as $,cy as q,da as z}from"./index.DWkcZ-_z.bundle.js";import{h as U,e as G}from"./npm.apollo-client.CXJpJPbe.bundle.js";import{P as L,u as Q}from"./usePersonalisedSearch.DaHUNodJ.bundle.js";import{g as Y}from"./getDefaultAlgoliaFilters.Bypt2EsX.bundle.js";import{M as S}from"./MarketItemTile.EzOdm3nI.bundle.js";import{u as K}from"./utils.lDoRF1Bx.bundle.js";import{u as J,S as W}from"./useCartSliderItems.DXpsmEEF.bundle.js";import{f as T}from"./requestSource.DkzemPHh.bundle.js";import{u as v}from"./useSimilarAlgoliaSliderItems.BPgZ6OGJ.bundle.js";import{E as X,c as Z}from"./npm.sentry-react.Z7tY98T1.bundle.js";import{u as ee}from"./npm.react-i18next.BwOa93YU.bundle.js";try{let e=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="cedaf87d-94da-4373-bca6-0a089741d5b1",e._sentryDebugIdIdentifier="sentry-dbid-cedaf87d-94da-4373-bca6-0a089741d5b1")}catch(e){}{let e=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{};e._sentryModuleMetadata=e._sentryModuleMetadata||{},e._sentryModuleMetadata[new e.Error().stack]=Object.assign({},e._sentryModuleMetadata[new e.Error().stack],{"_sentryBundlerPluginAppKey:sellpy-market":!0})}const te=["&Denim by H&M","Basic By H&M","Divided by H&M","H&M","H&M Basic","H&M Conscious Collection","H&M Kids","H&M Baby","H&M Mama","H&M Modern Classic","H&M Party","H&M Premium Quality","H&M Sport","H&M Studio","H&M Trend","H&M Young","H&M Home","H&M+","L.O.G.G by H&M","The Garden Collection by H&M"],se=[te.map(e=>`metadata.brand:${e}`)],R=({path:e})=>e==="/hm"?se:"",re=G` 2 query getItemRecommendationsForUser($userId: ID!) { 3 itemRecommendationsForUsers( 4 order: createdAt_DESC 5 first: 1 6 where: { user: { have: { objectId: { equalTo: $userId } } } } 7 ) { 8 edges { 9 node { 10 items { 11 ... on Item { 12 objectId 13 } 14 } 15 } 16 } 17 } 18 } 19`,ae=()=>{var m;const e=V(),{data:t,loading:s}=U(re,{variables:{userId:e},skip:!e}),a=y.useMemo(()=>{var c,u,d,p,g;return(g=(p=(d=(u=(c=t==null?void 0:t.itemRecommendationsForUsers)==null?void 0:c.edges)==null?void 0:u[0])==null?void 0:d.node)==null?void 0:p.items)==null?void 0:g.map(({objectId:f})=>f)},[t]),{items:n=[]}=D(a||[]),i=y.useMemo(()=>n.slice(0,10),[n]),{favorites:l}=E(),o=(m=l==null?void 0:l.map(c=>c.item.objectId).slice(0,5))!=null?m:[],r=v(o,{skip:s||!!(a!=null&&a.length),requestSource:T("recommended-items-from-favorites")});return i!=null&&i.length?i:r},j=O(e=>()=>q(e),({sliderId:e,itemId:t,index:s,totalCount:a})=>`${e}_${t}_${s}_${a}`),ne=i=>C(null,[i],function*({numericFilters:e,facetFilters:t,optionalFilters:s,personalizationFilters:a,defaultFilters:n}){const{searchSingleIndex:o,marketItemIndexes:r}=yield $(),{hits:m}=yield o({indexName:r.salesStartDescending,searchParams:{query:"",filters:n,numericFilters:e,hitsPerPage:20,facetFilters:t,optionalFilters:s,enablePersonalization:!0,personalizationFilters:a,personalizationImpact:L.personalizationImpact}});return m}),A=({landingPageSegment:e,numericFilters:t})=>{const[s,a]=y.useState([]),{optionalFilters:n,personalizationFilters:i,loading:l}=Q(),o=Y();return y.useEffect(()=>{!l&&o&&C(null,null,function*(){const m=yield ne({numericFilters:t,facetFilters:e||void 0,optionalFilters:n,personalizationFilters:i,defaultFilters:o});a(m)})},[o,e,l,t,n,i]),s},oe=["favouriteCount > 10"],De=({id:e,listId:t=e,headline:s,body:a,buttonText:n,buttonLink:i,position:l})=>{var u;const o=H(),{pathname:r}=o,{heartInImage:m}=(u=h())!=null?u:{},c=A({landingPageSegment:R({path:r}),numericFilters:oe});return!c||c.length<3?null:I.jsx(M,{headline:s,type:e,body:a,buttonText:n,buttonLink:i,children:c.map((d,p)=>I.jsx(S,{item:d,heartInImage:m,analyticsMetadata:{listId:t,listName:"Popular items",index:
19p},onClick:j({sliderId:window.location.pathname,sliderType:e,position:l,itemId:d.objectID,index:p,sliderVersion:2,totalCount:c.length})},d.objectID))})},we=({id:e,listId:t=e,headline:s,body:a,buttonText:n,buttonLink:i,position:l})=>{var u;const o=H(),{pathname:r}=o,{heartInImage:m}=(u=h())!=null?u:{},c=A({landingPageSegment:R({path:r})});return I.jsx(M,{headline:s,type:e,body:a,buttonText:n,buttonLink:i,children:c.map((d,p)=>I.jsx(S,{item:d,heartInImage:m,analyticsMetadata:{listId:t,listName:"Latest items",index:p},onClick:j({sliderId:window.location.pathname,sliderType:e,position:l,itemId:d.objectID,index:p,sliderVersion:2,totalCount:c.length})},d.objectID))})},_e=({id:e,listId:t=e,headline:s,body:a,buttonText:n,buttonLink:i,position:l})=>{var p;const o=F(),{favorites:r}=E(),{heartInImage:m}=(p=h())!=null?p:{},c=y.useMemo(()=>{var g;return(g=r==null?void 0:r.map(({item:f})=>f.objectId).slice(0,200))!=null?g:[]},[r]),{items:u=[]}=D(c,{preserveInputOrder:!0}),d=u.filter(g=>o.segment?g.segment===o.segment:!0);return y.useMemo(()=>d.length<3?null:I.jsx(M,{headline:s,type:e,body:a,buttonText:n,buttonLink:i,children:d.map((g,f)=>I.jsx(S,{item:g,heartInImage:m,analyticsMetadata:{listId:t,listName:"Favourites",index:f},onClick:j({sliderId:window.location.pathname,sliderType:e,position:l,itemId:g.objectID,index:f,sliderVersion:2,totalCount:d.length})},g.objectID))}),[d,s,e,t,a,n,i,l,m])},Pe=({id:e,listId:t=e,headline:s,body:a,buttonText:n,buttonLink:i,position:l})=>{var m;const o=ae(),{heartInImage:r}=(m=h())!=null?m:{};return y.useMemo(()=>o.length<3?null:I.jsx(M,{headline:s,type:e,body:a,buttonText:n,buttonLink:i,children:o.map((c,u)=>I.jsx(S,{item:c,heartInImage:r,analyticsMetadata:{listId:t,listName:"Recommended for you",index:u},onClick:j({sliderId:window.location.pathname,sliderType:e,position:l,itemId:c.objectID,index:u,sliderVersion:2,totalCount:o.length})},c.objectID))}),[o,s,e,t,a,n,i,l,r])},Fe=({id:e,listId:t=e,headline:s,body:a,buttonText:n,buttonLink:i,style:l,position:o})=>{var g;const r=F(),m=y.useMemo(()=>z(),[]),{items:c}=D(m,{preserveInputOrder:!0}),u=y.useMemo(()=>{var f;return(f=c==null?void 0:c.filter(b=>r.segment?b.segment===r.segment:!0).map(b=>b.objectID).slice(-5))!=null?f:[]},[c,r.segment]),d=v(u,{requestSource:T("visited-items-slider")}),{heartInImage:p}=(g=h())!=null?g:{};return y.useMemo(()=>d!=null&&d.length?I.jsx(M,{headline:s,type:e,body:a,buttonText:n,buttonLink:i,style:l,children:d.map((f,b)=>I.jsx(S,{item:f,heartInImage:p,analyticsMetadata:{listId:t,listName:"Similar items",index:b},onClick:j({sliderId:window.location.pathname,sliderType:e,position:o,itemId:f.objectID,index:b,sliderVersion:2,totalCount:d.length})},f.objectID)).slice(0,20)}):null,[d,s,e,t,a,n,i,l,o,p])},le=({id:e,listId:t=e,body:s,buttonText:a,buttonLink:n,style:i,position:l})=>{var c;const{t:o}=ee("landing"),{items:r}=J(),{heartInImage:m}=(c=h())!=null?c:{};return y.useMemo(()=>r.length?I.jsxs(W,{$sliderId:e,children:[I.jsx(B,{noMargin:!0,children:o("sliders.similarItemsForCartItemSlider.heading")}),I.jsx(M,{type:e,body:s,buttonText:a,buttonLink:n,style:{padding:0},children:r.map((u,d)=>I.jsx(S,{item:u,heartInImage:m,analyticsMetadata:{listId:t,listName:"Similar items",index:d},onClick:j({sliderId:window.location.pathname,sliderType:e,position:l,itemId:u.objectID,index:d,sliderVersion:2,totalCount:r.length})},u.objectID))})]}):null,[r,e,t,s,a,n,i,l,m,o])},He=e=>I.jsx(X,{fallback:null,onError:(t,s,a)=>Z(t,{componentStack:s,eventId:a}),children:I.jsx(le,P({},e))}),Ee=({headline:e,buttonText:t,buttonLink:s,position:a})=>{var l;const{items:n}=K(),{heartInImage:i}=(l=h())!=null?l:{};return y.useMemo(()=>n!=null&&n.length?I.jsx(M,{type:"previouslyInCart",headline:e,buttonText:t,buttonLink:s,children:n.map((o,r)=>
19I.jsx(S,{item:o,heartInImage:i,analyticsMetadata:{listId:"slider_previouslyInCart",listName:"Previously in cart",index:r},onClick:j({sliderId:window.location.pathname,sliderType:"previouslyInCart",position:a,itemId:o.objectID,index:r,totalCount:n.length})},o.objectID))}):null,[n,t,s,e,a,i])};export{we as A,_e as F,Ee as P,Pe as R,Fe as S,De as a,He as b,ne as p}; 20//# sourceMappingURL=ItemSlider.DeYsBl7Q.bundle.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.