!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]="0567d8df-6be6-47c4-bec8-9929206a4cea",e._sentryDebugIdIdentifier="sentry-dbid-0567d8df-6be6-47c4-bec8-9929206a4cea")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5188],{15188:function(e,t,a){a.d(t,{Z:function(){return Y}});var r=a(95235),s=a(82269),i=a(2784),l=a(76542),n=a(64897),o=a(82091),c=a(97224),u=a(46420),d=a(94922),h=a(51505),m=a(82732),p=a(57724),f=a(90374),g=a(1505),b=a(7387),j=a(79447),y=a(89214),x=a(9873),P=a(9046),v=a(95395),O=a(83533),k=a(90862),F=a(2002),w=a(88627),M=(a(64629),a(99140)),S=a(27298),N=a(50802),D=a(26378),I=a(52322);const C=["attribute","items","cmsItems","refine","cmsRefine"];function L(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}const H=e=>{const{attribute:t,items:a,cmsItems:l,refine:n,cmsRefine:o}=e,c=(0,s.Z)(e,C),u=(0,i.useMemo)((()=>(0,N.iJ)(t,a,l)),[t,a,l]),d=(0,i.useCallback)((e=>{let{value:t,cmsValue:a}=e;t&&n(t),a&&o(a)}),[n,o]);return(0,I.jsx)(w.vT,function(e){for(var t=1;t{if(!e?.length)return t||[];if(!t?.length)return e||[];const{interval:r=10,isPromoInFirstPosition:s}=a||{};let i=0;return t.reduce(((t,a,l)=>{if(0===l&&s){const t=e?.[i];return t?(i++,[t,a]):[a]}if(l>0&&l%r===0){const r=e?.[i];return r?(i++,[...t,r,a]):[...t,a]}return[...t,a]}),[])},z=a(62156),_=a(402),B=a(49481),R=a(73353),A=a(33831);const T=["title","attribute"],G=["objectID"],U=["objectID"];function V(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,r)}return a}function q(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)((()=>L.map((e=>{let{attribute:t}=e;return t}))),[L]),{appliedFilters:tt,filteredProducts:at,filteredState:rt,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:a}=e;t&&ke(t),a&&st(a)}))(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}=V||{};e&&De(e),ye&&ye()}),[ye,De,V]),mt=(0,i.useCallback)((()=>{const{pageName:e}=V;De(e),ve({show:Ve+1})}),[V,Ve,De,ve]),pt=(0,i.useMemo)((()=>fe.map((e=>{let{value:t,label:a}=e;return{value:t,label:Ie(a)}}))),[fe,Ie]),ft=(0,i.useRef)(),gt=(0,S.Z)({isSearching:ue,cacheKey:"nintendo.plp.cache",cachePrefix:J,activeIndexName:ge,rawSearchHits:he}),bt=(0,i.useMemo)((()=>({value:Ke.value,label:Ie(Ke.label)})),[Ke,Ie]),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 at.filter((t=>{if(!e.has(t.sku))return e.add(t.sku),!0}))}),[at]),xt=(0,i.useMemo)((()=>(0,N.hG)(be,jt)),[be,jt]),Pt=(0,i.useMemo)((()=>L.map(((e,t)=>{let{title:a,attribute:r}=e,i=(0,s.Z)(e,T);const l=de?.[r]||[];return(0,I.jsx)(E,q({title:a&&Ie(a),attribute:r,startCollapsed:0!==t,showMoreLabel:Ie("Show more"),showLessLabel:Ie("Show less"),collapsible:!0,limit:5,showMore:!0,refine:ot,cmsRefine:st,items:l,cmsItems:rt[r]?.items||[],analytics:{pageName:V.pageName}},i),r)}))),[L,Ie,V,rt,st,ot,de]),vt=(0,i.useMemo)((()=>V?.featureFlag?{featureFlag:V.featureFlag}:{featureFlag:Le?.id,featureFlagVariant:He}),[V,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,wt=Q||Ft.length,Mt=(0,i.useMemo)((()=>Ft.slice(0,wt*(Ve+1))),[Ve,Ft,wt]),St=Mt.length0&&(!Dt&&!kt||Ve>Nt||!Mt?.length||Ke?.value!==d.f.DEFAULT||ItFe?St?(0,I.jsx)(A.VR,{children:(0,I.jsx)(f.B,{variant:"tertiary",icon:g.Z,onClick:mt,children:Ie(W)})}):Ct?(0,I.jsx)(w.CD,{isLoading:ue,hasMore:me,onLoadMoreClick:ht}):gt.length>0?(0,I.jsx)(A.VR,{children:(0,I.jsx)(f.B,{variant:"tertiary",icon:g.Z,onClick:mt,children:Ie(W)})}):null:null),[Fe,gt,ue,me,St,Ct,Ie,W,ht,mt]),Ht=(0,i.useMemo)((()=>kt?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(w.en,{ref:$e,$singleColumnMobile:Ze,children:[Mt.map(((e,t)=>e.sku?(0,i.createElement)(k.I8,q(q(q({},vt),{},{key:`default-cms-${e.sku}-${t}`},e),{},{constrain:!1,showRating:r||Boolean(Se.query[M.Tx.UTM_CODE])||!1,mobileHorizontal:Ze,analytics:{listDetails:{id:`plp-${(0,F.GL)(V.pageName)}`,name:V.pageName}}})):(0,I.jsx)(D.Z,{cta:e.cta,heading:e.heading,asset:e.asset.primary.assetPath},e.heading+t))),Ct&>.map((e=>{let{objectID:t}=e,a=(0,s.Z)(e,G);return(0,I.jsx)(w.xb,q(q({},a),{},{showRating:r||!1,mobileHorizontal:Ze,analytics:q({eventName:Ae,searchId:a.searchId,position:a.resultsPosition,locale:Se.locale,pageName:V?.pageName,itemListDetails:{id:`plp-${(0,F.GL)(V.pageName)}`,name:V.pageName}},vt)}),`default-search-${t}`)}))]}),Lt]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(w.en,{ref:$e,$singleColumnMobile:Ze,children:[Mt.map(((e,t)=>(0,i.createElement)(k.I8,q(q(q({},vt),{},{key:`filtered-cms-${e.sku}-${t}`},e),{},{constrain:!1,mobileHorizontal:Ze,analytics:{listDetails:{id:`plp-${(0,F.GL)(V.pageName)}`,name:V.pageName}}})))),Ct&>.map((e=>{let{objectID:t}=e,a=(0,s.Z)(e,U);return(0,I.jsx)(w.xb,q(q({mobileHorizontal:Ze},a),{},{analytics:q({eventName:Ae,searchId:a.searchId,position:a.resultsPosition,locale:Se.locale,pageName:V.pageName,itemListDetails:{id:`plp-${(0,F.GL)(V.pageName)}`,name:V.pageName}},vt)}),`filtered-search-${t}`)}))]}),Lt]})),[V.pageName,Ae,kt,r,$e,Mt,gt,Se.locale,Se.query,vt,Ze,Ct,Lt]),Et=Ot&&ie;(0,z.Z)({isDesktop:Te,scrollToRef:ft,scrollToElementID:K,enableStickyCollectionNav:ee,pillFarm:re.list}),(0,i.useEffect)((()=>{it((0,o.deserializeHash)(Se.asPath))}),[it,Se.asPath]),(0,i.useEffect)((()=>{Ge.current&&ft.current&&(0,F.n5)(ft.current,{offsetY:ee&&R.d})}),[ee,be.length,jt.length]),(0,i.useEffect)((()=>{ee&&(0,F.n5)(ft.current,{offsetY:R.d,behavior:"smooth",onlyScrollIfAbove:!0})}),[ee]);const Zt=()=>(0,I.jsx)(b.B,{currentPage:Se.pathname,children:H.map(((e,t)=>(0,I.jsx)(c.Z,{href:e.href,children:(0,I.jsx)("a",{children:Ie(e.title)})},e.title+t)))});return(0,I.jsxs)(_.Kq,{disableScrollRestoration:!0,children:[oe&&(0,I.jsx)(Me,{children:(0,I.jsx)(we,{marketingPage:oe})}),H&&(0,I.jsx)(w.JL,{children:Zt()}),ae?.asset?.primary?.assetPath&&(0,I.jsx)(I.Fragment,{children:Y?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(j.F,{heading:ae.heading,subtitle:ae.description,image:{desktop:{assetPath:ae.asset?.primary?.assetPath},mobile:{assetPath:ae.asset?.secondary?.assetPath}},pillFarm:re.list,icon:a}),(0,I.jsx)(w.Hr,{})]}):(0,I.jsx)(w.tm,{iconName:a,content:{assetPath:ae.asset?.primary?.assetPath,assetPathAlt:ae.asset?.alt,background:ae.background,cta:ae.cta,description:ae.description,heading:ae.heading,modifiers:ae.modifiers}})}),(0,I.jsxs)(p.H.NewLevel,{children:[!Y&&re?.list.length>0&&(0,I.jsx)(w.$0,{constrained:!0,small:!0,divider:["bottom"],children:(0,I.jsx)(w.l6,{center:!0,items:re.list})}),(0,I.jsx)("span",{ref:ft,id:"products","data-drawer-id":K}),(0,I.jsx)(y.S,{size:36,axis:"vertical"}),(0,I.jsx)(w.He,{children:(0,I.jsxs)(A.zB,{$breadcrumbs:!!H,children:[(0,I.jsx)(h.D,{children:H&&Zt()}),(0,I.jsx)(m.S,{label:Ie("Sort by"),onSelect:dt,options:pt,dropdownValue:Fe?bt:null}),(0,I.jsx)(h.M,{children:(0,I.jsx)(w.Lb,{icon:x.Z,variant:"tertiary",onClick:Je,children:Ie("Filter")})})]})}),(0,I.jsx)(y.S,{size:32,axis:"vertical"}),Et&&(0,I.jsx)(h.M,{children:(0,I.jsx)(w.mI,{$isOpen:C,$height:Re,children:(0,I.jsx)(w.He,{children:(0,I.jsx)(w.bn,{ref:Be,children:ie})})})}),(0,I.jsx)(w.He,{children:(0,I.jsx)(w.dA,{enableStickyFilterPanel:!0,isFilterModalOpen:qe,toggleModalFiltersMenu:Je,attributeFilterSets:Pt,isDesktop:Te,stickyOffset:ee&&parseInt(Z.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)(w.mI,{$isOpen:C,$height:_e,children:(0,I.jsx)(w.bn,{ref:ze,children:ie})})}),!!le&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(P.S,{children:(0,I.jsx)(p.H,{children:Ie(le)})}),Ht]})]}):Ht})}),(0,I.jsx)(w.y4,{})]})]})}J.defaultProps={filterCMSProducts:!0,seeAllCtaLabel:"See all"};var Y=J},27298:function(e,t,a){var r=a(82269),s=a(2784),i=a(64897),l=a(58567),n=a(82091),o=a(44644);const c=["p"];t.Z=e=>{const{0:t,1:a}=(0,s.useState)([]),{isSearching:u,cacheKey:d,cachePrefix:h,activeIndexName:m,rawSearchHits:p}=e,f=(0,i.Z)(),g=(0,n.useLocalizer)();return(0,s.useEffect)((()=>{const e=(0,n.deserializeHash)(f.asPath),{p:t}=e,s=(0,r.Z)(e,c),i=o.U2(d,{}),b=`${h}_${JSON.stringify(s)}_${f.locale}`,j=u?i[b]||[]:((e,t)=>{const a=t?.[0]?.__position||0;return[...(e||[]).slice(0,a),...t]})(i[b],p);o.t8(d,{[b]:j});const y=Object.values(j).sort(((e,t)=>e.__position-t.__position)),x=(0,l.p)(y,{locale:f.locale,localizer:g,indexName:m});a(x)}),[u,d,h,p,f.asPath,f.locale,m,g]),t}}}]); //# sourceMappingURL=5188-df3c0a4cba3a3a00.js.map