"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[1621],{78774:(e,t,n)=>{n.r(t),n.d(t,{HomeV2FullPageSection:()=>z,SKELETON_CARDS_COUNT:()=>q,default:()=>Q});var o=n(85093),i=n(62822),a=n(93091),s=n.n(a),r=(n(83234),n(79024),n(38408),n(43379),n(2823),n(97460),n(29426),n(34192),n(80456),n(93577),n(54520),n(91531),n(93678),n(34145),n(30758)),c=n(70087),l=n(97500),u=n.n(l),d=n(88677),m=n(44286),h=n(92107),g=n(45625),p=n(44206),v=n(98505),f=n(93493),S=n(53349),x=n(47547),_=(n(25550),n(15342),n(38195)),y=n(36085),j=n(64328),w=n(86070),H=function(e){var t,n,o=e.section;return(0,w.jsx)(y.p,{id:o.uri,title:null!==(t=null===(n=o.data.title)||void 0===n?void 0:n.text)&&void 0!==t?t:"",showAll:!0,index:0,rowGap:_.lT,fullPage:!0,children:o.sectionItems.items.map(j.Gx)})},D=n(94842),A=n(67802),C=n(33828),I=n(68040),O=function(e){var t,n,o=e.section;return(0,w.jsx)(C.x,{config:(0,I.s1)(I.yV.HOME_LOW_DENSITY),children:(0,w.jsx)(y.p,{id:o.uri,title:null!==(t=null===(n=o.data.title)||void 0===n?void 0:n.text)&&void 0!==t?t:"",showAll:!0,index:0,rowGap:(0,D.po)("looser"),fullPage:!0,children:o.sectionItems.items.map(A.G)})})},P=(n(47994),n(46040)),b=function(e){var t=e.section;return(0,w.jsx)(C.x,{config:(0,I.s1)(I.yV.MUSIC_VIDEOS),children:(0,w.jsx)(y.p,{id:t.uri,title:h.Ru.get("music_videos"),showAll:!0,index:0,rowGap:(0,D.po)("looser"),fullPage:!0,children:t.sectionItems.items.map((function(e,t){if("TrackResponseWrapper"!==e.content.__typename||"Track"!==e.content.data.__typename)return null;var n=e.content.data;return(0,w.jsx)(P.O,{title:n.name,trackUri:n.uri,artists:n.artists.items,album:n.albumOfTrack,contentRating:n.contentRating,referrerIdentifier:"other",index:t},n.uri)}))})})},N=n(58114),k=n(82704),G=function(e){var t,n=e.section,o=(0,f.NC)(N.hWV);switch("spotify:section:0JQ5DAnM3wGh0gz1MXnu3K"===n.uri&&o&&n.data&&(n.data.__typename="HomeGridSectionData"),null===(t=n.data)||void 0===t?void 0:t.__typename){case"HomeGenericSectionData":return(0,w.jsx)(H,{section:(0,x.M)(n,n.data)});case"HomeMusicVideosSectionData":return(0,w.jsx)(b,{section:(0,x.M)(n,n.data)});case"HomeShortsSectionData":case"HomeRecentlyPlayedSectionData":case"HomeFeedBaselineSectionData":case"HomeNativeAdsSectionData":case"HomeOnboardingSectionData":return null;case"HomeGridSectionData":return o?(0,w.jsx)(O,{section:(0,x.M)(n,n.data)}):null;case"HomeSpotlightSectionData":case"HomePromotionSectionData":case null:case void 0:case"HomeFeatureActivationSectionData":case"HomeWatchFeedSectionData":case"HomeOnboardingSectionDataV2":case"HomeYourDJSectionData":return null;case"HomeFeatureActivationSectionDataV2":return(0,w.jsx)(S.G,{sectionItems:n.sectionItems.items,showAll:!0,uri:n.uri,localStorageKey:n.data.localStorageKey});default:return(0,k.k)(n.data),null}},M=n(66042),R=n(82886),T=(0,r.memo)((function(e){var t=e.cardCount;return(0,w.jsx)(R._,{isLoading:!0,showAll:!0,withTitle:!0,children:(0,o.A)(new Array(t).keys()).map((function(e,t){return(0,w.jsx)(M.u,{isLoading:!0},t)}))})})),F=n(90379),L=n(74512),V=n(5280),E=n(75355),J=n(68576),K=n(52562),U=n(71060),q=10,W=function(e){var t,n,a,l=e.uri,g=(0,m.zy)(),f=new URLSearchParams(g.search).get("pCountry"),S=(0,d.d4)(L.JJ),x=(0,r.useContext)(E.j).request,_=(0,c.q)({queryKey:["homeV2","section",l,{numberOfItems:20}],queryFn:(a=(0,i.A)(s().mark((function e(t){var n,o;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.pageParam,e.abrupt("return",(0,J.c)(x,v.U3,{uri:l,timeZone:(0,F.Ff)(),sp_t:null!==(n=(0,V.v8)("sp_t"))&&void 0!==n?n:"",country:null!=f?f:S,sectionItemsOffset:o,sectionItemsLimit:20}));case 2:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)}),initialPageParam:0,getNextPageParam:function(e){var t,n;if("HomeSectionCollection"===(null==e||null===(t=e.data)||void 0===t||null===(t=t.homeSections)||void 0===t?void 0:t.__typename)&&"HomeSection"===(null===(n=e.data.homeSections.sections[0])||void 0===n?void 0:n.__typename)){var o,i=null===(o=e.data.homeSections.sections[0])||void 0===o?void 0:o.sectionItems.pagingInfo;return i.nextOffset&&i.nextOffset>0?i.nextOffset:void 0}},gcTime:F.gO,staleTime:F.jl}),y=_.data,j=_.isLoading,H=_.error,D=(0,r.useMemo)((function(){return null!=y&&y.pages?y.pages.reduce((function(e,t){var n,i,a;if(null==t||null===(n=t.data)||void 0===n||!n.homeSections||"HomeSectionCollection"!==(null==t||null===(i=t.data)||void 0===i?void 0:i.homeSections.__typename)||0===t.data.homeSections.sections.length)return e;switch(null===(a=t.data.homeSections.sections[0])||void 0===a?void 0:a.__typename){case"HomeSection":return null===e?(0,K.h)(t.data.homeSections.sections[0]):(e.sectionItems.items=[].concat((0,o.A)(e.sectionItems.items),(0,o.A)(t.data.homeSections.sections[0].sectionItems.items)),e);case"GenericError":case"NotFound":return e;default:return(0,k.k)(t.data.homeSections.sections[0]),e}}),null):null}),[null==y?void 0:y.pages]);if(j)return(0,w.jsx)("section",{"data-testid":"home-page",children:(0,w.jsx)("div",{className:U.A.home,children:(0,w.jsx)("div",{className:u()(U.A.homepageContent,"contentSpacing"),children:(0,w.jsx)(T,{cardCount:q})})})});if(null!==H)return(0,w.jsx)(p.LoadingPage,{hasError:!0,errorMessage:h.Ru.get("error.generic")});var A=null==y||null===(t=y.pages[0])||void 0===t||null===(t=t.data)||void 0===t?void 0:t.homeSections;return"HomeSectionCollection"!==(null==A?void 0:A.__typename)||0===A.sections.length||"HomeSection"!==(null===(n=A.sections[0])||void 0===n?void 0:n.__typename)||null===D?(0,w.jsx)(p.LoadingPage,{hasError:!0,errorMessage:h.Ru.get("error.generic")}):(0,w.jsx)("section",{"data-testid":"home-section-page",children:(0,w.jsx)("div",{className:U.A.home,children:(0,w.jsx)("div",{className:u()(U.A.homepageContent,"contentSpacing"),children:(0,w.jsx)(G,{section:D})})})})},z=function(e){var t=e.uri;return(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(g.Q,{children:h.Ru.get("page.generic-title")}),(0,w.jsx)(W,{uri:t})]})};const Q=z},52562:(e,t,n)=>{n.d(t,{h:()=>i});var o=n(37005);n(42486),n(79024),n(26851),n(9750),n(71425),n(5672),n(43379),n(59255),n(20031),n(44967),n(96403),n(83355),n(41214);function i(e){return"object"!==(0,o.A)(e)||null===e?e:window.structuredClone?window.structuredClone(e):JSON.parse(JSON.stringify(e))}}}]); //# sourceMappingURL=home-v2-section.js.map