"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[1621],{30317:(e,t,n)=>{n.r(t),n.d(t,{SKELETON_CARDS_COUNT:()=>G,default:()=>E});var a=n(30758),s=n(86534),o=n(97500),i=n.n(o),c=n(41978),r=n(9183),l=n(11808),m=n(31685),d=n(83028),u=n(17534),h=n(62878),g=n(23342),S=n(21953),p=n(1019),f=n(11521),x=n(86070);const y=({section:e})=>(0,x.jsx)(p.p,{pageId:e.uri,title:e.data.title?.text??"",showAll:!0,index:0,id:e.uri,rowGap:S.lT,fullPage:!0,children:e.sectionItems.items.map(f.G)});var _=n(435),j=n(9783),H=n(42331),w=n(94921);const D=({section:e})=>(0,x.jsx)(H.x,{config:(0,w.s1)(w.yV.MUSIC_VIDEOS),children:(0,x.jsx)(p.p,{pageId:e.uri,title:l.Ru.get("music_videos"),showAll:!0,index:0,id:e.uri,rowGap:(0,_.po)("looser"),fullPage:!0,children:e.sectionItems.items.map(((e,t)=>{if("TrackResponseWrapper"!==e.content.__typename||"Track"!==e.content.data.__typename)return null;const n=e.content.data;return(0,x.jsx)(j.O,{title:n.name,trackUri:n.uri,artists:n.artists.items,album:n.albumOfTrack,contentRating:n.contentRating,referrerIdentifier:"other",index:t},n.uri)}))})});var I=n(36485);const v=({section:e})=>{switch(e.data?.__typename){case"HomeGenericSectionData":return(0,x.jsx)(y,{section:(0,g.M)(e,e.data)});case"HomeMusicVideosSectionData":return(0,x.jsx)(D,{section:(0,g.M)(e,e.data)});case"HomeShortsSectionData":case"HomeRecentlyPlayedSectionData":case"HomeFeedBaselineSectionData":case"HomeNativeAdsSectionData":case"HomeOnboardingSectionData":case"HomeGridSectionData":case"HomeSpotlightSectionData":case"HomePromotionSectionData":case null:case void 0:case"HomeFeatureActivationSectionData":case"HomeWatchFeedSectionData":case"HomeOnboardingSectionDataV2":case"HomeYourDJSectionData":return null;case"HomeFeatureActivationSectionDataV2":return(0,x.jsx)(h.G,{sectionItems:e.sectionItems.items,showAll:!0,uri:e.uri,localStorageKey:e.data.localStorageKey});default:return(0,I.k)(e.data),null}};var A=n(42674),O=n(44237);const C=(0,a.memo)((({cardCount:e})=>(0,x.jsx)(O._,{isLoading:!0,showAll:!0,withTitle:!0,children:[...new Array(e).keys()].map(((e,t)=>(0,x.jsx)(A.u,{isLoading:!0},t)))})));var b=n(95534),k=n(47721),N=n(95625),P=n(69916),R=n(22253),T=n(44453),F=n(18232);const G=10,M=({uri:e})=>{const t=(0,r.zy)(),n=new URLSearchParams(t.search).get("pCountry"),o=(0,c.d4)(k.JJ),{request:m}=(0,a.useContext)(P.j),{data:h,isLoading:g,error:S}=(0,s.q)({queryKey:["homeV2","section",e,{numberOfItems:20}],queryFn:async({pageParam:t})=>(0,R.c)(m,u.U3,{uri:e,timeZone:(0,b.Ff)(),sp_t:(0,N.v8)("sp_t")??"",country:n??o,sectionItemsOffset:t,sectionItemsLimit:20}),initialPageParam:0,getNextPageParam:e=>{if("HomeSectionCollection"===e?.data?.homeSections?.__typename&&"HomeSection"===e.data.homeSections.sections[0]?.__typename){const t=e.data.homeSections.sections[0]?.sectionItems.pagingInfo;return t.nextOffset&&t.nextOffset>0?t.nextOffset:void 0}},gcTime:b.gO,staleTime:b.jl}),p=(0,a.useMemo)((()=>h?.pages?h.pages.reduce(((e,t)=>{if(!t?.data?.homeSections||"HomeSectionCollection"!==t?.data?.homeSections.__typename||0===t.data.homeSections.sections.length)return e;switch(t.data.homeSections.sections[0]?.__typename){case"HomeSection":return null===e?(0,T.h)(t.data.homeSections.sections[0]):(e.sectionItems.items=[...e.sectionItems.items,...t.data.homeSections.sections[0].sectionItems.items],e);case"GenericError":case"NotFound":return e;default:return(0,I.k)(t.data.homeSections.sections[0]),e}}),null):null),[h?.pages]);if(g)return(0,x.jsx)("section",{"data-testid":"home-page",children:(0,x.jsx)("div",{className:F.A.home,children:(0,x.jsx)("div",{className:i()(F.A.content,"contentSpacing"),children:(0,x.jsx)(C,{cardCount:G})})})});if(null!==S)return(0,x.jsx)(d.A,{hasError:!0,errorMessage:l.Ru.get("error.generic")});const f=h?.pages[0]?.data?.homeSections;return"HomeSectionCollection"!==f?.__typename||0===f.sections.length||"HomeSection"!==f.sections[0]?.__typename||null===p?(0,x.jsx)(d.A,{hasError:!0,errorMessage:l.Ru.get("error.generic")}):(0,x.jsx)("section",{"data-testid":"home-section-page",children:(0,x.jsx)("div",{className:F.A.home,children:(0,x.jsx)("div",{className:i()(F.A.content,"contentSpacing"),children:(0,x.jsx)(v,{section:p})})})})},E=({uri:e})=>(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(m.Q,{children:l.Ru.get("page.generic-title")}),(0,x.jsx)(M,{uri:e})]})},44453:(e,t,n)=>{n.d(t,{h:()=>a});n(28360),n(76263);function a(e){return"object"!=typeof e||null===e?e:window.structuredClone?window.structuredClone(e):JSON.parse(JSON.stringify(e))}}}]); //# sourceMappingURL=home-v2-section.js.map