Files
dotfiles/.config/spicetify/Extracted/Themed/xpui/home-v2.js
T
2024-05-05 19:02:45 +02:00

2 lines
12 KiB
JavaScript
Executable File

"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[7704],{37648:(e,t,s)=>{s.d(t,{E:()=>n});var a=s(50959),i=s(11527);const n=e=>(0,i.jsx)(a.Suspense,{fallback:null,children:(0,a.createElement)((0,a.lazy)((async()=>{const{FeatureActivationSection:e}=await Promise.all([s.e(1814),s.e(9792)]).then(s.bind(s,34807));return{default:e}})),e)})},59711:(e,t,s)=>{s.r(t),s.d(t,{SKELETON_CARDS_COUNT:()=>Le,SKELETON_SHELVES_COUNT:()=>Fe,default:()=>We});s(86277);var a=s(50959),i=s(82187),n=s.n(i),r=s(35869),o=s(75802),c=s(10226),l=s(37902),d=s(85648),p=s(41038),m=s(88099),u=s(91643),g=s(67998),h=s(51450),x=s(46974),j=s(29673),f=s(80626),y=s(53724),v=s(24902),b=s(51901),S=s(50540),w=s(17676),D=s(97154),k=s(58206),C=s(3533),N=s(82557),_=s(65376),I=s(61058),M=s(76862);const H="AaXwi9LLckdsxNwrosnQ",F="yX31EzBkHzNooefkSvT3",L="EjJHF7tjFYigQK8pIVbV",T="Z5xLXZofWXGooKRjW6kd",E="kM546dTx5cxDNH530zm8",W="mnhJCpUiriAb7Ay3HOTz",A="rRldspwHsrgo8DsecR2Q";var P=s(11527);const R=({isMWP:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,disablePictureInPicture:!0,className:`${T} ${E}`,"aria-hidden":"true",children:[(0,P.jsx)("source",{src:(0,_.g)(`videos/Sw23-${e?"Mobile":"Desktop"}-Left.webm`),type:"video/webm; codecs=vp09.01.41.08"}),(0,P.jsx)("source",{src:(0,_.g)(`videos/Sw23-${e?"Mobile":"Desktop"}-Left.mp4`),type:"video/mp4"})]}),(0,P.jsxs)("video",{autoPlay:!0,loop:!0,muted:!0,playsInline:!0,disablePictureInPicture:!0,className:`${T} ${W}`,"aria-hidden":"true",children:[(0,P.jsx)("source",{src:(0,_.g)(`videos/Sw23-${e?"Mobile":"Desktop"}-Right.webm`),type:"video/webm; codecs=vp09.01.41.08"}),(0,P.jsx)("source",{src:(0,_.g)(`videos/Sw23-${e?"Mobile":"Desktop"}-Right.mp4`),type:"video/mp4"})]})]}),U=({isMWP:e})=>(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)("picture",{children:[(0,P.jsx)("source",{srcSet:(0,_.g)(`images/Sw23-${e?"Mobile":"Desktop"}-Left.webp`),type:"image/webp"}),(0,P.jsx)("source",{srcSet:(0,_.g)(`images/Sw23-${e?"Mobile":"Desktop"}-Left.png`),type:"image/png"}),(0,P.jsx)("img",{className:`${T} ${E}`,src:"",alt:""})]}),(0,P.jsxs)("picture",{children:[(0,P.jsx)("source",{srcSet:(0,_.g)(`images/Sw23-${e?"Mobile":"Desktop"}-Right.webp`),type:"image/webp"}),(0,P.jsx)("source",{srcSet:(0,_.g)(`images/Sw23-${e?"Mobile":"Desktop"}-Right.png`),type:"image/png"}),(0,P.jsx)("img",{className:`${T} ${W}`,src:"",alt:""})]})]}),$=(0,a.forwardRef)((({linkUri:e,loggedIn:t,isMWP:s,isStatic:a=!1,onClick:i},r)=>{const o=(0,I.jh)(),c=(0,M.T)();return(0,P.jsx)("div",{className:H,ref:r,children:(0,P.jsxs)("div",{className:(0,D.Mg)("invertedLight",n()(F,{[L]:s})),children:[a||c?(0,P.jsx)(U,{isMWP:s}):(0,P.jsx)(R,{isMWP:s}),(0,P.jsx)(k.D,{as:"h2",variant:"brio",semanticColor:"textBase",className:A,children:t?d.ag.get("shared.wrapped-banner.title"):d.ag.get("shared.wrapped-banner.title-loggedout")}),(0,P.jsx)(k.D,{as:"p",variant:o===I.Uo.SMALL||s?"mesto":"ballad",semanticColor:"textBase",children:t?d.ag.get("shared.wrapped-banner.body"):d.ag.get("shared.wrapped-banner.body-loggedout")}),(0,P.jsx)(C.D,{colorSet:"invertedDark",iconTrailing:N.T,href:e,target:"_blank",size:o===I.Uo.SMALL||s?"small":"medium",onClick:i,children:d.ag.get("shared.wrapped-banner.button")})]})})}));var O=s(86337);const z=()=>{const e=(0,S.g)(),t=(0,c.W6)(w.bQB),{openURLWithSessionTransfer:s}=(0,O.e)(),{spec:i,logger:n}=(0,f.fU)(b.e,{data:{identifier:"wrapped",uri:"spotify:2023wrapped"}}),r=(0,a.useMemo)((()=>i.campaignFactory({identifier:"wrapped",uri:"spotify:2023wrapped"}).bannerFactory({identifier:"home_wrapped_banner",uri:"desktop_banner"})),[i]),o=(0,f.Wi)(r),l="https://spotify.com/wrapped",d=(0,a.useCallback)((e=>{n.logInteraction(r.hitUiNavigate({destination:l})),s(l),e.preventDefault()}),[n,s,r]);return(0,P.jsx)($,{linkUri:l,loggedIn:!e,onClick:d,ref:o,isStatic:t})};s(46758),s(45205);var Z=s(79977);const J=JSON.parse('{"data":{"__typename":"HomeLearningSectionData","title":{"text":"Introducing"}},"sectionItems":{"items":[{"title":"Video Courses","description":"Learn from the best online creators.Try everything, for free."}],"totalCount":1}}');var V=s(69736),B=s(85255),K=s(77725);const Q="https://learning.spotify.net",Y="dnyg39bzenKDCjizwMzt",q="wQraCJRwv242wm4StxJc",X="ZRShtgAZLMUHmCZ3kelw",G="fodeOTunaw7uLX6oRbLw",ee="CVo6IW1mq3srWy9YZrAk",te="IbWcT9VDY62fMGWKyVRg",se="Dfqze5PoXWjDFglzjSTo",ae="KBC0QaBWPGFHcOPnXlFA",ie=["Learn from the best online creators.","Try everything, for free."],ne=({index:e})=>{const{spec:t,logger:s,UBIFragment:i}=(0,f.fU)(B.I,{data:{uri:"spotify:app:learning",position:e,reason:""}}),n=(0,a.useCallback)((()=>{const e=t.cardLinkFactory({position:0}).hitNavigateToExternalUri({destination:Q});s.logInteraction(e)}),[s,t]);return(0,P.jsx)(i,{spec:t,children:(0,P.jsx)("div",{className:Y,tabIndex:0,role:"button",onClick:()=>{n(),window.open(Q,"_blank","noopener")},children:(0,P.jsxs)("div",{className:q,children:[(0,P.jsxs)("div",{className:X,children:[(0,P.jsx)("div",{className:ee,children:(0,P.jsx)(V.x,{variant:"titleMedium",semanticColor:"textBase",children:"Video Courses"})}),(0,P.jsx)(V.x,{variant:"bodySmall",className:te,children:ie[0]}),(0,P.jsx)(V.x,{variant:"bodySmall",className:te,children:ie[1]})]}),(0,P.jsx)("div",{className:G,children:(0,P.jsx)(C.D,{as:"a",size:"small",href:Q,target:"_blank",colorSet:"invertedLight",iconTrailing:K.h,onClick:e=>{n(),e.stopPropagation()},children:(0,P.jsx)(V.x,{variant:"bodySmallBold",children:"Discover Courses"})})}),(0,P.jsx)("div",{className:se}),(0,P.jsx)("div",{className:ae})]})})})};var re=s(53502),oe=s(98874);const ce="zecaxp9A6ET66ZYuMSLr",le="CNmffmOxA0meXLgIZ2P4",de=({spec:e,index:t,shelfTitle:s,isDjRendered:i})=>{const n=(0,a.useCallback)((e=>e<=3?e:4!==e||i?4===e&&i?3:5!==e||i?5===e&&i?2:i?Math.min(4,e-3):4:3:2),[i]);return(0,P.jsx)(f.Nh,{spec:e.shelvesFactory(),children:(0,P.jsxs)(oe.G,{getSpanColumns:n,className:ce,children:[(0,P.jsx)("div",{className:le,children:(0,P.jsx)(re.r,{title:s})}),(0,P.jsx)(ne,{index:t})]})})},pe=JSON.parse('{"uri":"spotify:section:0JQ5DAVAaDNAlq7hOF3StH","data":{"__typename":"HomeYourDJSectionData","title":{"text":"Meet DJ"}},"sectionItems":{"items":[{"uri":"spotify:playlist:37i9dQZF1EYkqdzj48dyYq","content":{"__typename":"PlaylistResponseWrapper","data":{"__typename":"Playlist","uri":"spotify:playlist:37i9dQZF1EYkqdzj48dyYq","name":"DJ","images":{"items":[{"sources":[{"url":"https://lexicon-assets.spotifycdn.com/DJ-Beta-CoverArt-300.jpg","width":null,"height":null}],"extractedColors":{"colorDark":{"hex":"#0858B8","isFallback":false}}}]},"description":"All kinds of music, picked by your own AI DJ.","ownerV2":{"data":{"__typename":"User","name":"Spotify"}}}},"data":null}],"totalCount":1}}');var me=s(62303),ue=s(67577),ge=s(70526),he=(s(53321),s(39301),s(36255)),xe=s(81879);const je=({spec:e,section:t,index:s})=>(0,a.useMemo)((()=>t.sectionItems.items.some((e=>(0,xe.d)(e.content)))),[t.sectionItems])?(0,P.jsx)(f.Nh,{spec:e.shelvesFactory(),children:(0,P.jsx)(he.q,{total:t.sectionItems.totalCount,seeAllUri:t.uri,pageId:t.uri,title:t.data.title?.text??"",index:s,id:t.uri,children:t.sectionItems.items.map(xe.x).filter((e=>!!e))})}):null;var fe=s(17622);const ye=({spec:e,section:t,index:s})=>(0,P.jsx)(f.Nh,{spec:e.shelvesFactory(),children:(0,P.jsx)(fe.default,{title:t.data.title?.text??void 0,showAll:!1,index:s})});var ve=s(62648),be=s(37648),Se=s(85998);const we=({spec:e,greeting:t,section:s,index:a})=>{const i=(0,ue.xp)();switch(s.data?.__typename){case"HomeGenericSectionData":return(0,P.jsx)(je,{spec:e,section:(0,Se.f)(s,s.data),index:a});case"HomeShortsSectionData":return(0,P.jsx)(ve.s,{spec:e,greeting:t,section:(0,Se.f)(s,s.data)});case"HomeRecentlyPlayedSectionData":return(0,P.jsx)(ye,{spec:e,section:(0,Se.f)(s,s.data),index:a});case"HomeFeedBaselineSectionData":case"HomeNativeAdsSectionData":case"HomeOnboardingSectionData":case"HomeOnboardingSectionDataV2":return null;case"HomeYourDJSectionData":{const e=(0,Se.f)(s,s.data),{data:t,sectionItems:a}=e,n=a.items[0];if(i(s,s.data)&&"PlaylistResponseWrapper"===n.content.__typename&&"Playlist"===n.content.data.__typename){const{data:e}=n.content;return(0,P.jsx)(ue.KE,{uri:ue.rv,shelfTitle:t.title?.text??"",title:e.name,description:e.description??""})}return null}case"HomeFeatureActivationSectionDataV2":return(0,P.jsx)(be.E,{sectionItems:s.sectionItems.items,uri:s.uri,localStorageKey:s.data.localStorageKey});case"HomeFeatureActivationSectionData":case null:case void 0:return null;default:return(0,ge._)(s.data),null}};const De=({spec:e,greeting:t,container:s})=>{const{spec:i,logger:n}=(0,f.fU)(Z.createDesktopHomeFeatureActivationShelfEventFactory,{}),r=(0,c.W6)(w.iiT,{loadingValue:!1}),o=(0,c.W6)(w.FRh,{loadingValue:!1}),l=(0,a.useMemo)((()=>((e,t,s)=>{const a=[];s&&a.push(J),t&&a.push(pe);let i=[];return i=function(e){const t=e.sections.items;return t.length>0&&"HomeShortsSectionData"===t[0].data?.__typename}(e)?[e.sections.items[0],...a,...e.sections.items.slice(1)]:[...a,...e.sections.items],i.map((e=>"HomeLearningSectionData"===e.data?.__typename?{localOverride:!0,item:e}:{localOverride:!1,item:e}))})(s,r,o)),[s,r,o]),d=(0,ue.xp)();return(0,a.useEffect)((()=>{(0,me.wW)()&&n.logImpression(i.impressionElementFactory().impression())}),[i,n]),(0,P.jsx)(P.Fragment,{children:l.map(((s,a)=>{if(s.localOverride){const t=s.item,i=t?.sectionItems.items[0];if(!t||!i)return null;const n=l.find((e=>"HomeYourDJSectionData"===e.item.data?.__typename));let r=!1;if(n){const e=n.item;r=d(e,e.data)}return(0,P.jsx)(de,{spec:e,index:a,isDjRendered:r,shelfTitle:t.data.title.text},`${a}-${i.title}`)}return(0,P.jsx)(we,{spec:e,greeting:t,section:s.item,index:a},`${a}-${s.item.uri}`)}))})};var ke=s(75235),Ce=s(62116),Ne=s(91530),_e=s(84440),Ie=s(8885);const Me=()=>(0,c.W6)(w.Jw1)===w.pFI.ONHOME?(0,P.jsx)(Ie.w,{children:(0,P.jsx)(_e.W,{onSearch:!1})}):null;var He=s(24322);const Fe=6,Le=6,Te=(0,a.memo)((({shelfCount:e,cardCount:t})=>(0,P.jsx)("section",{"data-testid":"home-page",children:(0,P.jsx)("div",{className:He.Z.home,children:(0,P.jsxs)("div",{className:n()(He.Z.content,"contentSpacing"),children:[(0,P.jsx)(m.H,{withTitle:!1}),[...new Array(e).keys()].map(((e,s)=>(0,P.jsx)(ke.e,{withTitle:!0,cardCount:t},s)))]})})}))),Ee=({spec:e})=>{(0,g.z)("home");const t=(0,r.v9)(Ne.rZ),s=(0,o.TH)(),a=new URLSearchParams(s.search).get("pCountry"),{subfeedId:i=null}=(0,o.UO)(),{data:l,error:p,fetching:m}=(0,y.b3)({timeZone:(0,v.UE)(),sp_t:(0,h.vQ)("sp_t")??"",country:a??t,facet:i},{gcTime:v.us,staleTime:v.fS}),j=(0,c.W6)(w._dp),f=(0,c.W6)(w.bQB),b=j||f;if(m)return(0,P.jsx)(Te,{shelfCount:Fe,cardCount:Le});if(null!==p)return(0,P.jsx)(u.h,{hasError:!0,errorMessage:d.ag.get("error.generic")});const S=l?.home;return"HomeResponsePayload"!==S?.__typename?(0,P.jsx)(u.h,{hasError:!0,errorMessage:d.ag.get("error.generic")}):0===S.sectionContainer.sections.totalCount||0===S.sectionContainer.sections.items.length?((0,x.vK)(new Error("Empty response from pathfinder"),"Home"),(0,P.jsx)(u.h,{hasError:!0,errorMessage:d.ag.get("error.generic")})):(0,P.jsx)("section",{"data-testid":"home-page",children:(0,P.jsx)("div",{className:He.Z.home,children:(0,P.jsxs)("div",{className:n()(He.Z.content,"contentSpacing"),children:[b&&(0,P.jsx)(z,{}),(0,P.jsx)(De,{spec:e,greeting:S.greeting?.text??null,container:S.sectionContainer})]})})})},We=()=>{const{spec:e}=(0,f.fU)(l.F,{data:{identifier:"home",uri:"spotify:home"}}),t=(0,Ce.k)({type:"locale",uri:"home"});return(0,P.jsxs)(f.Nh,{spec:e,children:[(0,P.jsx)(p.$,{children:(0,j.nW)({i18n:d.ag,shouldLocalize:t})}),(0,P.jsx)(a.Suspense,{fallback:null,children:(0,P.jsx)(Me,{})}),(0,P.jsx)(Ee,{spec:e})]})}}}]);
//# sourceMappingURL=home-v2.js.map