!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="83b7f1ff-4ec8-46fe-aec9-e406335dbb3c",e._sentryDebugIdIdentifier="sentry-dbid-83b7f1ff-4ec8-46fe-aec9-e406335dbb3c")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5188],{15188:function(e,t,r){r.d(t,{Z:function(){return J}});var a=r(95235),s=r(82269),i=r(2784),l=r(76542),n=r(64897),o=r(82091),c=r(97224),u=r(46420),d=r(94922),h=r(51505),m=r(82732),p=r(14516),f=r(5719),g=r(1505),b=r(13156),j=r(57353),y=r(7364),x=r(9873),P=r(27070),v=r(95395),O=r(83533),k=r(90862),F=r(2002),M=r(55850),w=(r(64629),r(99140)),D=r(50802),S=r(26378),I=r(52322);const N=["attribute","items","cmsItems","refine","cmsRefine"];function C(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}const L=e=>{const{attribute:t,items:r,cmsItems:l,refine:n,cmsRefine:o}=e,c=(0,s.Z)(e,N),u=(0,i.useMemo)((()=>(0,D.iJ)(t,r,l)),[t,r,l]),d=(0,i.useCallback)((e=>{let{value:t,cmsValue:r}=e;t&&n(t),r&&o(r)}),[n,o]);return(0,I.jsx)(M.vT,function(e){for(var t=1;t{if(!e?.length)return t||[];if(!t?.length)return e||[];const{interval:a=10,isPromoInFirstPosition:s}=r||{};let i=0;return t.reduce(((t,r,l)=>{if(0===l&&s){const t=e?.[i];return t?(i++,[t,r]):[r]}if(l>0&&l%a===0){const a=e?.[i];return a?(i++,[...t,a,r]):[...t,r]}return[...t,r]}),[])},Z=r(62156),B=r(402),R=r(49481),z=r(73353),T=r(33831);const A=["title","attribute"],_=["objectID"],G=["objectID"];function U(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function V(e){for(var t=1;t(se||[]).flat()),[se]),We=(0,i.useMemo)((()=>Ke?.value===d.f.DEFAULT?Qe.filter((e=>{let{sku:t}=e;return Boolean(t)})):[]),[Qe,Ke]),Xe=(0,i.useMemo)((()=>{if(ce){const e=Qe.filter((e=>{let{sku:t}=e;return!t}));return $(e,We,{isPromoInFirstPosition:ne})}return Qe}),[We,Qe,ne,ce]),et=(0,i.useMemo)((()=>C.map((e=>{let{attribute:t}=e;return t}))),[C]),{appliedFilters:tt,filteredProducts:rt,filteredState:at,refine:st,refineByQuery:it,clearFilters:lt}=(0,v.x3)(We,et,{operator:v.fP.AND,queryToInitializeFilters:(0,o.deserializeHash)(),hidden:te}),nt=(0,i.useCallback)((e=>(ve({show:0}),e)),[ve]),ot=(0,i.useCallback)((function(){return nt(xe)(...arguments)}),[nt,xe]),ct=(0,i.useCallback)((e=>{nt((e=>{let{value:t,cmsValue:r}=e;t&&ke(t),r&&st(r)}))(e)}),[ke,st,nt]),ut=(0,i.useCallback)((()=>{nt((()=>{Oe(),lt()}))()}),[Oe,lt,nt]),dt=(0,i.useCallback)((function(){nt(Ye)(...arguments)}),[Ye,nt]),ht=(0,i.useCallback)((()=>{const{pageName:e}=U||{};e&&Ie(e),ye&&ye()}),[ye,Ie,U]),mt=(0,i.useCallback)((()=>{const{pageName:e}=U;Ie(e),ve({show:Ve+1})}),[U,Ve,Ie,ve]),pt=(0,i.useMemo)((()=>fe.map((e=>{let{value:t,label:r}=e;return{value:t,label:Ne(r)}}))),[fe,Ne]),ft=(0,i.useRef)(),gt=(0,v.D6)({isSearching:ue,cacheKey:"nintendo.plp.cache",cachePrefix:K,activeIndexName:ge,rawSearchHits:he}),bt=(0,i.useMemo)((()=>({value:Ke.value,label:Ne(Ke.label)})),[Ke,Ne]),jt=(0,i.useMemo)((()=>tt.map((e=>({attribute:e.split(v.HA)[0],label:e.split(v.HA)[1],value:e})))),[tt]),yt=(0,i.useMemo)((()=>{const e=new Set;return rt.filter((t=>{if(!e.has(t.sku))return e.add(t.sku),!0}))}),[rt]),xt=(0,i.useMemo)((()=>(0,D.hG)(be,jt)),[be,jt]),Pt=(0,i.useMemo)((()=>C.map(((e,t)=>{let{title:r,attribute:a}=e,i=(0,s.Z)(e,A);const l=de?.[a]||[];return(0,I.jsx)(H,V({title:r&&Ne(r),attribute:a,startCollapsed:0!==t,showMoreLabel:Ne("Show more"),showLessLabel:Ne("Show less"),collapsible:!0,limit:5,showMore:!0,refine:ot,cmsRefine:st,items:l,cmsItems:at[a]?.items||[],analytics:{pageName:U.pageName}},i),a)}))),[C,Ne,U,at,st,ot,de]),vt=(0,i.useMemo)((()=>U?.featureFlag?{featureFlag:U.featureFlag}:{featureFlag:Le?.id,featureFlagVariant:He}),[U,Le,He]),Ot=(0,i.useMemo)((()=>Ke?.value===d.f.DEFAULT&&!xt.length),[xt,Ke]),kt=(0,i.useMemo)((()=>!be?.length&&!jt?.length&&Ke?.value===d.f.DEFAULT&&Xe?.length>0),[be,jt,Ke,Xe]),Ft=kt?Xe:yt,Mt=Y||Ft.length,wt=(0,i.useMemo)((()=>Ft.slice(0,Mt*(Ve+1))),[Ve,Ft,Mt]),Dt=wt.length0&&(!It&&!kt||Ve>St||!wt?.length||Ke?.value!==d.f.DEFAULT||NtFe?Dt?(0,I.jsx)(T.VR,{children:(0,I.jsx)(f.B,{variant:"tertiary",icon:g.Z,onClick:mt,children:Ne(Q)})}):Ct?(0,I.jsx)(M.CD,{isLoading:ue,hasMore:me,onLoadMoreClick:ht}):gt.length>0?(0,I.jsx)(T.VR,{children:(0,I.jsx)(f.B,{variant:"tertiary",icon:g.Z,onClick:mt,children:Ne(Q)})}):null:null),[Fe,gt,ue,me,Dt,Ct,Ne,Q,ht,mt]),Ht=(0,i.useMemo)((()=>kt?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(M.en,{ref:Ze,$singleColumnMobile:$e,children:[wt.map(((e,t)=>e.sku?(0,i.createElement)(k.I8,V(V(V({},vt),{},{key:`default-cms-${e.sku}-${t}`},e),{},{constrain:!1,showRating:a||Boolean(De.query[w.Tx.UTM_CODE])||!1,mobileHorizontal:$e,analytics:{listDetails:{id:`plp-${(0,F.GL)(U.pageName)}`,name:U.pageName}}})):(0,I.jsx)(S.Z,{cta:e.cta,heading:e.heading,asset:e.asset.primary.assetPath},e.heading+t))),Ct&>.map((e=>{let{objectID:t}=e,r=(0,s.Z)(e,_);return(0,I.jsx)(M.xb,V(V({},r),{},{showRating:a||!1,mobileHorizontal:$e,analytics:V({eventName:Ae,searchId:r.searchId,position:r.resultsPosition,locale:De.locale,pageName:U?.pageName,itemListDetails:{id:`plp-${(0,F.GL)(U.pageName)}`,name:U.pageName}},vt)}),`default-search-${t}`)}))]}),Lt]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(M.en,{ref:Ze,$singleColumnMobile:$e,children:[wt.map(((e,t)=>(0,i.createElement)(k.I8,V(V(V({},vt),{},{key:`filtered-cms-${e.sku}-${t}`},e),{},{constrain:!1,mobileHorizontal:$e,analytics:{listDetails:{id:`plp-${(0,F.GL)(U.pageName)}`,name:U.pageName}}})))),Ct&>.map((e=>{let{objectID:t}=e,r=(0,s.Z)(e,G);return(0,I.jsx)(M.xb,V(V({mobileHorizontal:$e},r),{},{analytics:V({eventName:Ae,searchId:r.searchId,position:r.resultsPosition,locale:De.locale,pageName:U.pageName,itemListDetails:{id:`plp-${(0,F.GL)(U.pageName)}`,name:U.pageName}},vt)}),`filtered-search-${t}`)}))]}),Lt]})),[U.pageName,Ae,kt,a,Ze,wt,gt,De.locale,De.query,vt,$e,Ct,Lt]),Et=Ot&&ie;(0,Z.Z)({isDesktop:_e,scrollToRef:ft,scrollToElementID:q,enableStickyCollectionNav:ee,pillFarm:ae.list}),(0,i.useEffect)((()=>{it((0,o.deserializeHash)(De.asPath))}),[it,De.asPath]),(0,i.useEffect)((()=>{Ge.current&&ft.current&&(0,F.n5)(ft.current,{offsetY:ee&&z.d})}),[ee,be.length,jt.length]),(0,i.useEffect)((()=>{ee&&(0,F.n5)(ft.current,{offsetY:z.d,behavior:"smooth",onlyScrollIfAbove:!0})}),[ee]);const $t=()=>(0,I.jsx)(b.B,{currentPage:De.pathname,children:L.map(((e,t)=>(0,I.jsx)(c.Z,{href:e.href,children:(0,I.jsx)("a",{children:Ne(e.title)})},e.title+t)))});return(0,I.jsxs)(B.Kq,{disableScrollRestoration:!0,children:[oe&&(0,I.jsx)(we,{children:(0,I.jsx)(Me,{marketingPage:oe})}),L&&(0,I.jsx)(M.JL,{children:$t()}),re?.asset?.primary?.assetPath&&(0,I.jsx)(I.Fragment,{children:J?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j.F,{heading:re.heading,subtitle:re.description,image:{desktop:{assetPath:re.asset?.primary?.assetPath},mobile:{assetPath:re.asset?.secondary?.assetPath}},pillFarm:ae.list,icon:r}),(0,I.jsx)(M.Hr,{})]}):(0,I.jsx)(M.tm,{iconName:r,content:{assetPath:re.asset?.primary?.assetPath,assetPathAlt:re.asset?.alt,background:re.background,cta:re.cta,description:re.description,heading:re.heading,modifiers:re.modifiers}})}),(0,I.jsxs)(p.H.NewLevel,{children:[!J&&ae?.list.length>0&&(0,I.jsx)(M.$0,{constrained:!0,small:!0,divider:["bottom"],children:(0,I.jsx)(M.l6,{center:!0,items:ae.list})}),(0,I.jsx)("span",{ref:ft,id:"products","data-drawer-id":q}),(0,I.jsx)("span",{ref:W}),(0,I.jsx)(y.S,{size:36,axis:"vertical"}),(0,I.jsx)(M.He,{children:(0,I.jsxs)(T.zB,{$breadcrumbs:!!L,children:[(0,I.jsx)(h.D,{children:L&&$t()}),(0,I.jsx)(m.S,{label:Ne("Sort by"),onSelect:dt,options:pt,dropdownValue:Fe?bt:null}),(0,I.jsx)(h.M,{children:(0,I.jsx)(M.Lb,{icon:x.Z,variant:"tertiary",onClick:Je,children:Ne("Filter")})})]})}),(0,I.jsx)(y.S,{size:32,axis:"vertical"}),Et&&(0,I.jsx)(h.M,{children:(0,I.jsx)(M.mI,{$isOpen:N,$height:Te,children:(0,I.jsx)(M.He,{children:(0,I.jsx)(M.bn,{ref:ze,children:ie})})})}),(0,I.jsx)(M.He,{children:(0,I.jsx)(M.dA,{enableStickyFilterPanel:!0,isFilterModalOpen:qe,toggleModalFiltersMenu:Je,attributeFilterSets:Pt,isDesktop:_e,stickyOffset:ee&&parseInt(E.TH)+16,customizeFilters:{activeFilters:xt,removeFilter:ct,clearFilters:ut,totalHits:je+yt.length},children:Et?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(h.D,{children:(0,I.jsx)(M.mI,{$isOpen:N,$height:Re,children:(0,I.jsx)(M.bn,{ref:Be,children:ie})})}),!!le&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(P.S,{children:(0,I.jsx)(p.H,{children:Ne(le)})}),Ht]})]}):Ht})}),(0,I.jsx)(M.y4,{})]})]})}K.defaultProps={filterCMSProducts:!0,seeAllCtaLabel:"See all"};var J=K}}]); //# sourceMappingURL=5188-356de68c94708451.js.map