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