(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[827],{66181:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(93828),s=n(52023);function o(e){return(0,s.Z)(1,arguments),(0,r.Z)(e).getFullYear()}},30253:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/trending",function(){return n(18026)}])},59377:function(e,t,n){"use strict";n.d(t,{Z:function(){return o}});var r=n(10972),s=(n(97176),n(82336)),o=function(){return(0,r.jsx)("div",{role:"status",className:"w-full p-8 flex-center",children:(0,r.jsxs)("div",{className:"rounded-sm bg-black/5 p-6 text-center flex-center",children:[(0,r.jsx)("div",{className:"scale-150",children:(0,r.jsx)(s.T,{className:"mx-auto fill-redorange text-black/15"})}),(0,r.jsx)("p",{className:"mt-4 text-eyebrows",children:"Loading more..."})]})})}},53263:function(e,t,n){"use strict";n.d(t,{Z:function(){return x}});var r=n(10972),s=n(97176);function o(){return o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},o.apply(this,arguments)}function a(e,t){return a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},a(e,t)}var i=function(e){var t,n;function r(){return e.apply(this,arguments)||this}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,a(t,n);var i=r.prototype;return i.getColumns=function(){var e=this.props,t=e.children,n=e.columnsCount,r=Array.from({length:n},(function(){return[]}));return s.Children.forEach(t,(function(e,t){e&&s.isValidElement(e)&&r[t%n].push(e)})),r},i.renderColumns=function(){var e=this.props.gutter;return this.getColumns().map((function(t,n){return s.createElement("div",{key:n,style:{display:"flex",flexDirection:"column",justifyContent:"flex-start",alignContent:"stretch",flex:1,width:0,gap:e}},t.map((function(e){return e})))}))},i.render=function(){var e=this.props,t=e.gutter,n=e.className,r=e.style;return s.createElement("div",{style:o({display:"flex",flexDirection:"row",justifyContent:"center",alignContent:"stretch",boxSizing:"border-box",width:"100%",gap:t},r),className:n},this.renderColumns())},r}(s.Component);i.propTypes={},i.defaultProps={columnsCount:3,gutter:"0",className:null,style:{}};var u=i,l="undefined"!==typeof window?s.useLayoutEffect:s.useEffect,c=function(){var e=function(){var e=(0,s.useState)(!1),t=e[0],n=e[1];return l((function(){n(!0)}),[]),t}(),t=(0,s.useState)(0),n=t[0],r=t[1],o=(0,s.useCallback)((function(){e&&r(window.innerWidth)}),[e]);return l((function(){if(e)return window.addEventListener("resize",o),o(),function(){return window.removeEventListener("resize",o)}}),[e,o]),n},f=function(e){var t=e.columnsCountBreakPoints,n=e.children,r=e.className,o=e.style,a=c(),i=(0,s.useMemo)((function(){var e=Object.keys(t).sort((function(e,t){return e-t})),n=e.length>0?t[e[0]]:1;return e.forEach((function(e){e<a&&(n=t[e])})),n}),[a,t]);return s.createElement("div",{className:r,style:o},s.Children.map(n,(function(e,t){return s.cloneElement(e,{key:t,columnsCount:i})})))};f.propTypes={},f.defaultProps={columnsCountBreakPoints:{350:1,750:2,900:3},className:null,style:null};var d=f,p=u,m=n(83267),x=function(e){var t=(0,m.f)().breakpoint;return(0,r.jsx)(d,{columnsCountBreakPoints:{0:1,350:2,550:3,900:4,1100:5,1400:6,1700:7},children:(0,r.jsx)(p,{gutter:["none","sm"].includes(t)?"1rem":"1.5rem",className:"m-0 w-full p-4 py-2.5 pb-20 sm:px-10 md:px-16 md:py-4",children:e.children||(0,r.jsx)("div",{})})})}},18026:function(e,t,n){"use strict";n.r(t),n.d(t,{__N_SSP:function(){return j}});var r=n(47568),s=n(26042),o=n(36305),a=n(72655),i=n.n(a),u=n(10972),l=n(32010),c=n(97176),f=n(42708),d=n(22503),p=n(81333),m=n(59377),x=n(25177),h=n(53263),y=n(49676),v=n(7775),N=n(17031),w=n(34479),g=n(99826),j=!0;t.default=function(){var e=(0,c.useContext)(v.E).showError,t=(0,c.useState)(0),n=t[0],a=t[1],j=(0,d.Eu)().authLoaded,C=(0,l.useRouter)().query,b=C.modelName,k=C.diversityFactor,E=C.diversityAttributes,O=C.explorationFactor,_=(0,g.r0m)({fetchPolicy:"cache-and-network",skip:!j,variables:(0,s.Z)({page:n,limit:50},void 0!==b&&{modelName:b},k&&!isNaN(parseFloat(k))&&{diversityFactor:parseFloat(k)},E&&{diversityAttributes:Array.isArray(E)?E:[E]},O&&!isNaN(parseFloat(O))&&{explorationFactor:parseFloat(O)}),onError:e,notifyOnNetworkStatusChange:!0}),P=_.data,Z=_.loading,B=_.fetchMore,R=_.networkStatus,F=(0,c.useMemo)((function(){if(void 0!==(null===P||void 0===P?void 0:P.userPersonalizedProducts))return(0,o.Z)(P.userPersonalizedProducts)}),[P]),S=(0,N.Z)({data:F||[],networkStatus:R,loading:Z}),L=S.hasReachedEnd,z=S.fetchingMore,A=S.isLoading,T=function(){if(null===F||void 0===F?void 0:F.length){var e=n+1;return w.ZP.trackEvent("[INFINITE SCROLL]",{location:"for-you",pageCount:e,authorized:w.ZP.isAuthorized}),a(e),B({variables:{page:e,limit:50}})}};return(0,u.jsxs)(x.Z,{hideFooter:!0,children:[A&&!(null===F||void 0===F?void 0:F.length)?(0,u.jsxs)(h.Z,{children:[(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.2"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.5"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.3"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.6"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.1"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.5"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.3"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.6"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.1"}}),(0,u.jsx)(y.O.Box,{className:"w-full",style:{aspectRatio:"1/1.5"}})]}):(0,u.jsxs)(u.Fragment,{children:[A?(0,u.jsx)("div",{className:"mt-4 flex flex-row justify-center gap-6 p-2",children:(0,u.jsx)("p",{className:"rounded-sm bg-cream px-3 py-2",children:"Looking for new products..."})}):null,(0,u.jsx)(h.Z,{children:null===F||void 0===F?void 0:F.map((function(e){return(0,u.jsx)(p.Z,{product:e,pageName:"for-you"},e.id)}))})]}),z?(0,u.jsx)(m.Z,{}):null,!L&&!A&&!z&&F&&F.length>0&&(0,u.jsx)(f.df,{className:"-translate-y-96",onChange:function(){var e=(0,r.Z)(i().mark((function e(t){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=3;break}return e.next=3,T();case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()})]})}}},function(e){e.O(0,[5177,1333,9774,2888,179],(function(){return t=30253,e(e.s=t);var t}));var t=e.O();_N_E=t}]);