(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8417],{36192:function(e,t,a){"use strict";a.r(t),a.d(t,{__N_SSP:function(){return p}});var r=a(49074),s=a(46420),l=a(36796),i=a(64897),n=a(50530),o=a(58139),c=a(75668),u=(a(66998),a(92072)),d=a(52322);var p=!0;t.default=function(e){let{page:t,preview:a}=e;const p=(0,i.Z)(),h=t.content.pageHeader.heading,m=t.content?.productsCategoryUid,g=[{href:"/",title:"Home"},{href:"/store",title:"My Nintendo Store"},{href:"/store/games",title:"Games"},{href:"/store/games/[slug]",title:h}],f=r.e.GAMES,b=(0,u.XD)({category:f,productsCategoryUid:m,merchandisedGrid:t?.content?.merchandisedGrid,router:p});return m?(0,d.jsx)(s.X$,{router:p,categoryConfig:b,defaultCategory:f,searchParamWhitelist:n.uy,preserveQueryParamKeys:n.aq,children:(0,d.jsx)(o.Z,{preview:a,breadcrumbLinks:g,page:t.content,pageIcon:"d-pad",cachePrefix:`${(0,l.GL)(h)}`,filterSections:r.I,analytics:{eventPrefix:`Games:${h}`,pageName:`Games PLP - ${h}`}})}):(0,d.jsx)(c.Z,{preview:a,breadcrumbLinks:g,page:t.content,showRating:t.showRating,filterSections:r.I,analytics:{pageName:`Games PLP - ${h}`}})}},75668:function(e,t,a){"use strict";var r=a(82269),s=a(95235),l=a(2784),i=a(5632),n=a.n(i),o=a(82091),c=a(97224),u=a(49074),d=a(46420),p=a(51505),h=a(82732),m=a(64746),g=a(62754),f=a(1505),b=a(85367),y=a(98468),j=a(85669),v=a(9873),x=a(21464),P=a(36796),S=a(13852),w=a(80963),k=a(57912),O=a(61635),M=(a(71105),a(50530)),F=a(72354),C=a(32075),N=a(11034),L=a(23682),H=a(42924),_=a(47975),B=a(62898),E=a(52322);const D=["title","attribute"];function z(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 T(e){for(var t=1;t{let{preview:t,breadcrumbLinks:a,filterSections:s,lightScrim:z,page:Z,pageIcon:R,sortByOptions:G,showRating:A,analytics:$,enableStickyCollectionNav:q,fullBleedHero:V,cmsProductPageSize:U,hiddenFilters:X,disableDefaultMarketingPageHeading:K}=e;const{pageHeader:Q,ctaCollection:Y,merchandisedGrid:J,legalText:W,marketingPage:ee}=Z||{},te=ee?H[ee?.templateName??"plmpStandard"]:null,ae=K?l.Fragment:m.H.NewLevel,re=(0,S.O_)(),{text:se}=(0,o.useLocalizer)(),{trackLoadMoreProducts:le}=(0,u.u)(),ie=(0,i.useRouter)(),{asPath:ne,pathname:oe,locale:ce,query:ue}=ie,de=(0,S.D9)(ue?.slug),pe=(0,o.useFeature)("wdev-1631-horizontal-tiles"),he=pe?.variant?.payload?.value,me=(0,w.Z)(w.o.TABLET_SMALL),ge="horizontal"===he&&!me,fe=(0,o.deserializeHash)(ne),be=(0,l.useRef)(),{0:ye,1:je}=(0,l.useState)((()=>G.find((e=>{let{param:t}=e;return t===fe.sort}))?.value||G[0].value)),{0:ve,1:xe}=(0,l.useState)((()=>parseInt(fe.p)||0)),{isFilterModalOpen:Pe,selectedSortByOption:Se,toggleModalFiltersMenu:we,handleSortByChange:ke}=(0,d.sI)({sortBy:ye,sortByOptions:G,analytics:$,applySortBy:e=>{je((()=>e))}}),Oe=(0,l.useMemo)((()=>G.map((e=>{let{value:t,label:a}=e;return{value:t,label:se(a)}}))),[G,se]),Me=(0,l.useMemo)((()=>({value:Se.value,label:se(Se.label)})),[Se,se]),Fe=(0,l.useMemo)((()=>s.map((e=>e.attribute===u.z.ESRB_RATING&&M.bh[ce]||e))),[ce,s]),Ce=(0,l.useMemo)((()=>Fe.map((e=>{let{attribute:t}=e;return t}))),[Fe]),Ne=(J||[]).flat(),Le=(J||[]).flat().filter((e=>{let{sku:t}=e;return Boolean(t)})),{appliedFilters:He,appliedFiltersQuery:_e,filteredProducts:Be,filteredState:Ee,refine:De,refineByQuery:ze,clearFilters:Te}=(0,S.x3)(Le,Ce,{operator:S.fP.AND,queryToInitializeFilters:fe,hidden:X}),Ie=0===He?.length&&Se.value===G[0].value,Ze=(0,w.Z)(w.o.DESKTOP),Re=(0,l.useRef)();Re.current=Ze;const Ge=Ie?Ne:Be,Ae=(0,l.useMemo)((()=>Ge.slice(0,(U||Ge.length)*(ve+1))),[ve,Ge,U]),$e=Ae.lengthye?[...Ae].sort(ye):Ae),[Ae,ye]),Ve=(0,l.useCallback)((()=>{const e=(0,o.deserializeHash)(ne),t=G.find((t=>{let{param:a}=t;return a===e.sort}))?.value||G[0].value;ze(e),je((()=>t)),xe(parseInt(e.p)||0)}),[G,ne,ze]),Ue=(0,l.useCallback)((e=>{const t=G.find((e=>{let{value:t}=e;return t===ye}))?.param||G[0].value;return`#${new URLSearchParams(T(T({},e),{},{sort:t,p:ve})).toString()}`}),[G,ye,ve]),Xe=(0,l.useCallback)((e=>(xe((()=>0)),e)),[]),Ke=(0,l.useCallback)((function(){Xe(De)(...arguments)}),[De,Xe]),Qe=(0,l.useCallback)((function(){Xe(Te)(...arguments)}),[Te,Xe]),Ye=(0,l.useCallback)((function(){Xe(ke)(...arguments)}),[ke,Xe]),Je=(0,l.useCallback)((()=>{const{pageName:e}=$;le(e);const t=(0,o.deserializeHash)(),a=ve+1;t.p=a,xe((()=>a))}),[ve,$,le]),We=(0,l.useMemo)((()=>Ue(_e)),[_e,Ue]),et=(0,l.useMemo)((()=>He.map((e=>({attribute:e.split(S.HA)[0],label:e.split(S.HA)[1],value:e})))),[He]),tt=(0,l.useMemo)((()=>$?.featureFlag?{featureFlag:$.featureFlag}:{featureFlag:pe?.id,featureFlagVariant:he}),[$,pe,he]),at=(0,l.useMemo)((()=>Fe.filter((e=>{let{attribute:t}=e;return Ee[t]?.items?.length>0})).map(((e,t)=>{let{title:a,attribute:s}=e,l=(0,r.Z)(e,D);return(0,E.jsx)(O.vT,T({attribute:s,title:a&&se(a),startCollapsed:0!==t,refine:Ke,items:Ee[s]?.items||[],showMoreLabel:se("Show more"),showLessLabel:se("Show less"),collapsible:!0,limit:5,showMore:!0,analytics:{pageName:$?.pageName}},l),s)}))),[Fe,Ee,Ke,se,$]),rt=(0,l.useMemo)((()=>(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(O.en,{$singleColumnMobile:ge,children:qe.map(((e,t)=>e.sku?(0,l.createElement)(x.I8,T(T(T({},tt),{},{key:e.sku+t},e),{},{constrain:!1,showRating:A||Boolean(ie.query[F.Tx.UTM_CODE])||!1,mobileHorizontal:ge,analytics:{listDetails:{id:`clp-${(0,P.GL)($.pageName)}`,name:$.pageName}}})):(0,E.jsx)(N.Z,{asset:e.asset.primary.assetPath,cta:e.cta,heading:e.heading},e.heading+t)))}),$e&&(0,E.jsx)(B.VR,{children:(0,E.jsx)(g.B,{variant:"tertiary",icon:f.Z,onClick:Je,children:se("Load more")})})]})),[ie.query,$,tt,A,$e,qe,ge,Je,se]);(0,k.Z)({isDesktop:Ze,scrollToRef:be,scrollToElementID:I,enableStickyCollectionNav:q,pillFarm:Y.list}),(0,l.useEffect)((()=>{n().push({pathname:n().pathname,query:n().query,hash:We},null,{shallow:!0}).catch((e=>{if(!e.cancelled)throw e}))}),[We]),(0,P.nw)((()=>{Ve()})),(0,l.useEffect)((()=>{!0===Re.current&&be.current&&(0,P.n5)(be.current,{offsetY:q&&_.d})}),[He.length,q]),(0,l.useEffect)((()=>{q&&be.current&&ue?.slug!==de&&(0,P.n5)(be.current,{offsetY:_.d,behavior:"smooth",onlyScrollIfAbove:!0})}),[q,ue?.slug,de]),(0,l.useEffect)((()=>{const e=ue?.slug;Boolean(de)&&Boolean(e)&&e!==de&&Ve()}),[Ve,de,ue?.slug]);const st=(0,l.useMemo)((()=>a?(0,E.jsx)(b.B,{currentPage:oe,children:a.map(((e,t)=>(0,E.jsx)(c.Z,{href:e.href,children:(0,E.jsx)("a",{children:se(e.title)})},e.title+t)))}):null),[a,se,oe]),lt=(0,l.useMemo)((()=>Q?.asset?.primary?.assetPath?V?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y.F,{heading:Q.heading,subtitle:Q.description,image:{desktop:{assetPath:Q.asset?.primary?.assetPath},mobile:{assetPath:Q.asset?.secondary?.assetPath}},pillFarm:Y.list,icon:R}),(0,E.jsx)(O.Hr,{})]}):(0,E.jsx)(O.tm,{iconName:R,content:{assetPath:Q.asset?.primary?.assetPath,assetPathAlt:Q.asset?.alt,background:Q.background,cta:Q.cta,description:Q.description,heading:Q.heading,modifiers:Q.modifiers},lightScrim:z}):null),[Q,V,R,z,Y]);return(0,E.jsxs)(L.Kq,{preview:t,children:[ee&&(0,E.jsx)(ae,{children:(0,E.jsx)(te,{marketingPage:ee})}),a&&(0,E.jsx)(O.JL,{children:st}),lt,(0,E.jsxs)(m.H.NewLevel,{children:[!V&&Y?.list.length>0&&(0,E.jsx)(O.$0,{constrained:!0,small:!0,divider:["bottom"],children:(0,E.jsx)(O.l6,{center:!0,items:Y.list})}),(0,E.jsx)("span",{ref:be,id:"products","data-drawer-id":I}),(0,E.jsx)(j.S,{size:36,axis:"vertical"}),(0,E.jsxs)(O.He,{children:[(0,E.jsxs)(B.zB,{$breadcrumbs:!!a,children:[(0,E.jsx)(p.D,{children:st}),(0,E.jsx)(h.S,{label:se("Sort by"),onSelect:Ye,options:Oe,dropdownValue:re?Me:null}),(0,E.jsx)(p.M,{children:(0,E.jsx)(O.Lb,{icon:v.Z,variant:"tertiary",onClick:we,children:se("Filter")})})]}),(0,E.jsx)(j.S,{size:32,axis:"vertical"}),(0,E.jsx)(O.dA,{enableStickyFilterPanel:!0,isFilterModalOpen:Pe,toggleModalFiltersMenu:we,attributeFilterSets:at,isDesktop:Ze,stickyOffset:q&&parseInt(C.TH)+16,customizeFilters:{clearFilters:Qe,removeFilter:Ke,activeFilters:et,totalHits:Be.length},children:rt}),W&&(0,E.jsx)(B.VH,{children:(0,E.jsx)(O.Ho,{data:W,textVariant:"legal"})})]}),(0,E.jsx)(O.y4,{})]})]})};Z.defaultProps={sortByOptions:M.Op},t.Z=Z},86236:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/store/games/[slug]",function(){return a(36192)}])}},function(e){e.O(0,[5106,8286,4511,3759,1635,3682,1640,8139,9774,2888,179],(function(){return t=86236,e(e.s=t);var t}));var t=e.O();_N_E=t}]);