mirror of
https://github.com/kristoferssolo/solorice.git
synced 2025-10-21 20:10:34 +00:00
2 lines
46 KiB
JavaScript
Executable File
2 lines
46 KiB
JavaScript
Executable File
"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[7125],{10741:(e,t,s)=>{s.d(t,{u:()=>m});var r=s(97500),a=s.n(r),n=s(8159),i=s(13466),o=s(17930),c=s(45346),l=s(85513),u=s(79303),d=s(76748),p=s(86070);const m=({uri:e,src:t,playAriaLabel:s,onClick:r,isPlaying:m,isActive:h,isLocked:y,isEpisode:f,isVideo:g,spec:x})=>{const b=(0,c.W)(),j=(0,u.s)(),R=(0,n.YQ)((t=>{let s;if(b({type:"click",intent:m?"pause":"play"}),x){const t=x.playbackButtonFactory();let r;r=h&&m?t.hitPause({itemToBePaused:e}):h&&!m?t.hitResume({itemToBeResumed:e}):t.hitPlay({itemToBePlayed:e}),s=j.logInteraction(r)}r(t,s)}),l.d,{leading:!0,trailing:!1});return(0,p.jsxs)("div",{className:d.A.rowImageWithPlay,children:[(0,p.jsx)(o.e,{src:t,isEpisode:f,isVideo:g}),(0,p.jsx)(i.x,{className:a()(d.A.rowPlayPauseButton,d.A.rowImagePlayPauseButton),iconClassName:d.A.rowPlayPauseIcon,onClick:R,isPlaying:m,isLocked:y,playAriaLabel:s})]})}},68079:(e,t,s)=>{s.d(t,{r:()=>x});var r=s(30758),a=s(71306),n=s(12783),i=s(92867),o=s(61544),c=s(59996),l=s(57276),u=s(72091);const d="CqCtb3wr4SK8AiZwxeH0",p="IGCDq9qa08JVVY3mcy7Y",m="Vn9yz8P5MjIvDT8c0U6w",h="MtV402NmdUF5mceSD0Dy",y="WDC2Yzs811n7JCYtYQzc";var f=s(86070);const g=a.l0o,x=({title:e,imageUrl:t,viewId:s,pageId:a,color:x=g,href:b,index:j,ubiId:R})=>{const C=s&&`/genre/${s}`||b||"#",{spec:v,logger:A}=(0,u.r)(i.b,{data:{position:j,identifier:R}}),k=(0,r.useCallback)((()=>{const e=(0,o.o_)(C)?.toURI();e&&A.logInteraction(v.hitUiNavigate({destination:e}))}),[A,v,C]);return(0,f.jsx)("div",{className:p,children:(0,f.jsx)(c.N,{to:C,pageId:a,className:d,onClick:k,children:(0,f.jsxs)("div",{className:m,style:{backgroundColor:x},children:[t?(0,f.jsx)(l._,{loading:"lazy",src:t,className:y}):null,(0,f.jsx)(n.E,{variant:"titleSmall",className:h,children:e})]})})})}},89130:(e,t,s)=>{s.d(t,{K:()=>a});var r=s(61544);function a(e){const t=(0,r.o_)(e,{parseUnknown:!0}),[s,a]=t?.args??[];if(a&&"page"===s)return`/genre/${a}`}},83342:(e,t,s)=>{s.d(t,{PG:()=>a,f8:()=>i,oC:()=>r,s8:()=>n});const r=o(120),a=o(30),n=o(60),i=o(15);function o(e){return 60*e*1e3}},14828:(e,t,s)=>{s.d(t,{RS:()=>a,f0:()=>i,o8:()=>n});var r=s(36485);function a(e){return{url:e.url,width:e.width,height:e.height}}function n(e){if("Episode"===e.__typename){const t=e.podcastV2.data;return"Podcast"!==t.__typename?[]:t.coverArt?.sources.map(a)??[]}return[]}function i(e){switch(e.__typename){case"Artist":return e.visuals.avatarImage?.sources.map(a)??[];case"Album":case"Audiobook":case"Podcast":case"Episode":case"Chapter":return e.coverArt?.sources.map(a)??[];case"Track":return e.albumOfTrack?.coverArt?.sources.map(a)??[];case"Playlist":return e.images.items[0]?.sources.map(a)??[];case"User":return e.avatar?.sources.map(a)??[];case"Merch":return e.image?.sources.map(a)??[];case"ArtistConcerts":{const t=e.mainArtist.data;return"Artist"!==t.__typename?[]:t.visuals.avatarImage?.sources.map(a)??[]}case"BrowseSectionContainer":return e.data?.cardRepresentation?.artwork?.sources.map(a)??[];case"BrowseClientFeature":return e.artwork?.sources.map(a)??e.iconOverlay?.sources.map(a)??[];case"GenericError":case"NotFound":case"RestrictedContent":case"BrowseSpacesHub":case"BrowseExternalHref":return[];default:return(0,r.k)(e),[]}}},10866:(e,t,s)=>{s.r(t),s.d(t,{default:()=>pa});var r=s(30758),a=s(69898),n=s(41978),i=s(9183),o=s(3074),c=s.n(o),l=s(81987),u=s(5800),d=s(11808),p=s(31685),m=s(41695),h=s(62413),y=s(32046),f=s(39733),g=s(86070);const x={albums:u.$h.SEARCH_ALBUMS,artists:u.$h.SEARCH_ARTISTS,episodes:u.$h.SEARCH_EPISODES,genres:u.$h.SEARCH_GENRES,playlists:u.$h.SEARCH_PLAYLISTS,podcasts:u.$h.SEARCH_SHOWS,audiobooks:u.$h.SEARCH_AUDIOBOOKS,tracks:u.$h.SEARCH_SONGS,users:u.$h.SEARCH_PROFILES,podcastAndEpisodes:u.$h.SEARCH_PODCASTS_AND_EPISODES,topResults:u.$h.SEARCH};function b({children:e}){const{query:t="",category:s=""}=(0,i.g)();return(0,g.jsx)(y.e,{pageId:x[s],entityUri:`spotify:app:search:${t}:${s}`,children:e})}function j({children:e}){const{query:t}=(0,i.g)();return(0,g.jsx)(y.e,{pageId:u.$h.SEARCH,entityUri:`spotify:app:search:${t}`,children:e})}var R=s(36385),C=s(1019),v=s(68079),A=s(14828),k=s(89130),I=s(36485);function w(e){const t=(0,A.f0)(e);if(t.length>0)return t[0].url}function P(e,t){switch(e.content.__typename){case"BrowseXlinkResponseWrapper":case"BrowseSectionContainerWrapper":return function(e,t,s){switch(e.__typename){case"BrowseClientFeature":return(0,g.jsx)(v.r,{title:e.title?.transformedLabel??"",pageId:"search",href:e.featureUri,color:e.backgroundColor?.hex,imageUrl:w(e),ubiId:e.featureUri,index:t},e.featureUri);case"BrowseSectionContainer":return e.data?.cardRepresentation?(0,g.jsx)(v.r,{title:e.data.cardRepresentation.title?.transformedLabel??"",pageId:"search",href:(0,k.K)(s),color:e.data.cardRepresentation.backgroundColor?.hex,imageUrl:w(e),ubiId:s,index:t},s):null;case"BrowseSpacesHub":case"GenericError":case"NotFound":case"BrowseExternalHref":return null;default:return(0,I.k)(e),null}}(e.content.data,t,e.uri);case"AlbumResponseWrapper":case"ArtistResponseWrapper":case"EpisodeOrChapterResponseWrapper":case"PlaylistResponseWrapper":case"PodcastOrAudiobookResponseWrapper":case"TrackResponseWrapper":case"UserResponseWrapper":case"ConcertResponseWrapper":case"MerchResponseWrapper":case"ArtistConcertsResponseWrapper":case"NoContent":case"UnknownType":return null;default:return(0,I.k)(e.content),null}}var S=s(83342),E=s(15742),N=s(8385);const _=new E.l("browseAll","query","cd6fcd0ce9d1849477645646601a6d444597013355467e24066dad2c1dc9b740",null),T=()=>{const{data:e}=((e,t)=>(0,N.I)(_,e,t))({pagePagination:{offset:0,limit:10},sectionPagination:{offset:0,limit:99}},{gcTime:S.oC,staleTime:S.PG});return"BrowseSectionContainer"!==e?.browseStart?.__typename?[]:e.browseStart.sections?.items??[]};var U=s(42331),q=s(94921),F=s(17869);const O="AGAj7hr0pC57oadgb75h",L=({browseAllSpec:e})=>{const t=T();return(0,g.jsx)("div",{className:O,children:t.map(((t,s)=>function(e,t,s){if(!e.data?.__typename)return null;switch(e.data.__typename){case"BrowseGridSectionData":return(0,g.jsx)(F.r,{spec:t,children:(0,g.jsx)(U.x,{config:(0,q.s1)(q.yV.BROWSE),children:(0,g.jsx)(C.p,{title:e.data?.title?.transformedLabel??"",index:s,id:e.uri,showAll:!0,children:e.sectionItems.items.map(((e,t)=>P(e,t)))})})},e.uri);case"BrowseSingleItemSectionData":case"BrowseGenericSectionData":case"BrowseRelatedSectionData":case"BrowseUnsupportedSectionData":return null;default:return(0,I.k)(e.data),null}}(t,e,s)))})};var D=s(25009),V=s(13623),B=s(95302);const H=()=>{const{searchHistory:e,clearSearchHistory:t}=(0,V.k)();return 0===e.length?null:(0,g.jsx)(C.p,{index:0,id:"recent-searches",total:e.length,seeAllUri:"spotify:app:recent-searches",title:d.Ru.get("search.title.recent-searches"),children:e.map(((e,s)=>(0,g.jsx)(B.pZ,{index:s,value:"search-history",children:(0,g.jsx)(D.X,{entity:e,index:s,clearSearchHistory:t})},e.uri)))})};var M=s(72091);const W="_YN9HVrnrcvnaCjYnNkM",$=()=>{const{spec:e,UBIFragment:t}=(0,M.r)(R.A,{data:{uri:"search:find"}}),{recentSearchesSpec:s,browseAllSpec:a}=(0,r.useMemo)((()=>({recentSearchesSpec:e.recentSearchesFactory(),topGenresSpec:e.topGenresFactory(),browseAllSpec:e.browseAllFactory()})),[e]);return(0,g.jsxs)("div",{className:W,children:[(0,g.jsx)(t,{spec:s,children:(0,g.jsx)(H,{})}),(0,g.jsx)(L,{browseAllSpec:a})]})};var G=s(43058),Z=s(75801),J=s(61544),Y=s(4594),K=s(76056),X=s(37985),z=s(12783),Q=s(43830),ee=s(25668);const te=(0,r.createContext)(null),se=te.Provider;function re(){const e=(0,r.useContext)(te);if(null===e)throw new Error("Trying to use 'SearchContext' without 'SearchProvider'!");return e}var ae=s(52608),ne=s(48905);const ie="_5hJUuCVGXtd6CaXQBUM",oe="DH8aRN7lGO_ZqFegRTmj",ce="W37c8X5LCtHtmryEzR4I",le="oNTqWDEksr002PdYJVmT",ue=({forChip:e})=>{const{query:t,serpId:s}=re(),r=!(0,ae.n)(),a=`/search/${t}`,n=(0,J.Ru)(t).toURI(),{spec:i,logger:o}=(0,M.r)(ee.w,{data:{uri:n,reason:s}}),c=(0,ne.t)(i);return(0,g.jsxs)("div",{className:ie,"aria-live":"polite",ref:c,children:[(0,g.jsx)(z.E,{as:"h1",variant:"titleSmall",className:oe,children:e?d.Ru.get("search.empty-results-title-for-chip",t,e):d.Ru.get("search.empty-results-title",t)}),(0,g.jsx)("p",{className:ce,children:r?d.Ru.get("web-player.search-modal.offline"):d.Ru.get("search.empty-results-text")}),e&&(0,g.jsx)(X.N_,{to:a,children:(0,g.jsx)(Q.$,{colorSet:"invertedLight",className:le,onClick:()=>{o.logInteraction(i.seeAllButtonFactory().hitUiNavigate({destination:a}))},children:d.Ru.get("search.see-all")})})]})};var de=s(59744);const pe={results:null,isError:!1,isFetchMoreError:!1};var me=s(95244),he=s(97513),ye=s(32994),fe=s(42116),ge=s(86945),xe=s(42582),be=s(79303);const je="l5wWcdJAOxbcnqyfuEmX",Re="niq6jXm6QbYCNJJ6J0wQ",Ce="L3pQN7b5ky5wG5LuGE6o",ve=({index:e,item:t})=>{const{episode:s,show:r}=t,{usePlayContextItem:a}=(0,xe.P)({uri:t.episode.uri},{featureIdentifier:"search",referrerIdentifier:"search"});return(0,g.jsxs)("div",{className:Ce,children:[(0,g.jsx)(me.q,{index:e,episode:{...s,requestId:t.requestId},showMetadata:r,usePlayContextItem:a}),(0,g.jsx)("hr",{className:Re,"aria-hidden":!0})]})},Ae=({showTitle:e=!0,displayEmptyPageOnEmptyResults:t=!0,displayError:s=!0,enableInfiniteScroll:r=!1,fetchData:a,totalCountRef:n,items:i,isError:o})=>{const{query:c,serpId:l}=re(),u=(0,J.Ru)(c).toURI(),{ref:d,breakpoint:p}=(0,ge.x)({[ye.E.MEDIUM]:0,[ye.E.LARGE]:600}),m=(0,be.s)(),h=`spotify:app:search:${encodeURIComponent(c)}:episodes`,{spec:y,UBIFragment:f}=(0,M.r)(Z.w,{data:{uri:u,reason:l}});return o?s?(0,g.jsx)(G.o,{}):null:0===n.current?t?(0,g.jsx)(f,{spec:y.emptyResultsFactory(),children:(0,g.jsx)(ue,{forChip:K.j7.episodes()})}):null:(0,g.jsxs)(fe.o.Provider,{value:p,children:[i&&e&&(0,g.jsx)(Y.k,{title:K.j7.episodes(),seeAllUri:h,onClickTitle:()=>{y&&m.logInteraction(y.episodesListFactory().episodesListHeaderFactory().titleFactory().hitUiNavigate({destination:h}))},onClickSeeAll:()=>{y&&m.logInteraction(y.episodesListFactory().episodesListHeaderFactory().seeAllLinkFactory().hitUiNavigate({destination:h}))},hasMoreElements:!r&&i.length<(n.current||0)}),(0,g.jsx)("div",{ref:d,className:je,children:i&&(0,g.jsx)(he._,{triggerOnInitialLoad:!1,onReachBottom:()=>{r&&a()},children:i})})]})},ke=e=>{const{query:t,api:s}=re(),{results:a,isError:n,fetchData:i,totalCountRef:o}=((e,t)=>{const s=(0,de.a)(),a=(0,r.useRef)(null),n=(0,r.useRef)(0),[i,o]=(0,r.useState)(pe),c=(0,r.useCallback)((async(r=!1)=>{if(!s())return;r&&(n.current=0,a.current=null);let i=e;if(null!==a.current){if(n.current>=a.current)return;n.current+i>a.current&&(i=a.current-n.current)}try{const e=await t(n.current,i);n.current+=i,a.current=e.totalCount||0,s()&&o((t=>({isError:!1,isFetchMoreError:!1,results:(r||null===t.results?[]:t.results).concat(e.items)})))}catch(e){s()&&o((e=>{const t=null===e.results||r;return{results:r?[]:e.results,isError:t,isFetchMoreError:!t}}))}}),[e,t,s]);return(0,r.useEffect)((()=>{c(!0)}),[c]),{results:i.results,isError:i.isError,fetchData:c,totalCountRef:a}})(30,(0,r.useCallback)(((e,r)=>s.getFullEpisodes(t,e,r)),[s,t]));return(0,g.jsx)(Ae,{...e,fetchData:i,totalCountRef:o,items:a?.map(((e,t)=>(0,g.jsx)(ve,{item:e,index:t},t))),isError:n})};var Ie=s(17395);const we=e=>{const{title:t,category:s,query:r,results:a,onAddToHistory:n,position:i,showSeeAll:o}=e;if(!a)return null;const{items:c,totalCount:l}=a;return c&&0!==c.length?(0,g.jsx)(C.p,{index:i,id:s,total:l||0,title:t,testId:`${s}-search-entity`,seeAllUri:`spotify:app:search:${encodeURIComponent(r)}:${s}`,showSeeAll:o,children:c.map(((e,t)=>(0,g.jsx)(B.pZ,{value:s,index:t,children:(0,g.jsx)(Ie.Q,{onClick:()=>n(e),entity:e,index:t})},e.uri)))}):null},Pe="T2yEew5FpZAOv3uHa0NK",Se=({results:e})=>{const{query:t,serpId:s,onAddToHistory:r}=re(),a=(0,J.Ru)(t).toURI(),{spec:n,UBIFragment:i}=(0,M.r)(Z.w,{data:{uri:a,reason:s}});return 0===e?.podcasts.totalCount&&0===e?.episodes.totalCount?(0,g.jsx)(i,{spec:n.emptyResultsFactory(),children:(0,g.jsx)(ue,{forChip:K.j7.podcastAndEpisodes()})}):(0,g.jsx)(i,{spec:n,children:(0,g.jsxs)("div",{className:Pe,children:[0!==e?.podcasts.totalCount&&(0,g.jsx)("div",{children:(0,g.jsx)(we,{position:0,category:"podcasts",title:K.j7.podcastAndEpisodes(),query:t,results:e?.podcasts,onAddToHistory:r})}),0!==e?.episodes.totalCount&&(0,g.jsx)("div",{children:(0,g.jsx)(ke,{displayEmptyPageOnEmptyResults:!1,displayError:!1})})]})})};var Ee=s(97500),Ne=s.n(Ee),_e=s(26486),Te=s(86534),Ue=s(19159);const qe=({query:e,category:t,pageSize:s,includePreReleases:n})=>{const{api:i}=re(),o=(0,a.jE)(),c=(0,l.NC)(Ue.Z85),u=(0,r.useMemo)((()=>["searchCategoryResults",e,{category:t,pageSize:s,includePreReleases:n}]),[t,n,s,e]),{data:d,isError:p,isLoading:m,fetchNextPage:h}=(0,Te.q)({queryKey:u,initialPageParam:{offset:0,limit:s},queryFn:async({pageParam:s})=>await i.getSearchCategoryResults(e,t,!0,n,s.offset,s.limit),getNextPageParam:(e,t)=>{if(!e)return null;const r=e.pagingInfo?.nextOffset;if(null===r)return null;let a=s;return void 0!==e.totalCount&&r+a>=e.totalCount&&(a=e.totalCount-r),{offset:r,limit:a}},select:e=>e.pages.flatMap((e=>e.items)),gcTime:c>0?6e5:0,staleTime:c>0?3e5:0});return(0,r.useEffect)((()=>()=>{c>0&&o.setQueryData(u,(e=>({pages:e?.pages.slice(0,c)??[],pageParams:e?.pageParams.slice(0,c)??[]})))}),[c,o,u]),{results:d,isLoading:m,isError:p,fetchNextPage:h}};var Fe=s(16436);const Oe="w7SWsAZah4vovAuFxjgk",Le="Qmu4FPZCnrDpQ85s4az5",De=({displayChips:e,category:t})=>{const{query:s,serpId:a,onAddToHistory:n}=re(),i=(0,l.NC)(Ue.Jl4)&&"audiobooks"===t,{results:o,isError:c,isLoading:u,fetchNextPage:d}=qe({query:s,category:t,pageSize:30,includePreReleases:i}),p=(0,r.useCallback)(((e,t)=>(0,g.jsx)(B.pZ,{value:"card",index:t,children:(0,g.jsx)(Ie.Q,{entity:e,onClick:()=>n(e),testId:`search-category-card-${t}`,index:t})},`${e.uri}-${t}`)),[n]),m=(0,J.Ru)(s).toURI(),{spec:h,UBIFragment:y}=(0,M.r)(_e.b,{data:{uri:m,identifier:t,reason:a}}),f=(0,r.useMemo)((()=>h.cardsFactory()),[h]),x=(0,r.useMemo)((()=>h.emptyResultsFactory()),[h]);return c?(0,g.jsx)(G.o,{}):u||o&&0!==o.length?(0,g.jsx)(y,{spec:f,children:(0,g.jsx)("div",{className:Ne()(Oe,{[Le]:e}),children:o&&(0,g.jsx)(he._,{onReachBottom:d,triggerOnInitialLoad:!1,children:(0,g.jsx)(Fe.E,{render:()=>o.map(((e,t)=>p(e,t)))})})})}):(0,g.jsx)(y,{spec:x,children:(0,g.jsx)(ue,{forChip:K.j7[t]()})})};var Ve=s(4652),Be=s(55665),He=s(71588),Me=s(48100),We=s(39710),$e=s(84401),Ge=s(15739),Ze=s(9813),Je=s(71801),Ye=s(17930),Ke=s(84075),Xe=s(41609),ze=s(72445),Qe=s(84537),et=s(96849),tt=s(6941),st=s(40009),rt=s(69905),at=s(92421),nt=s(81783),it=s(98912),ot=s(54687),ct=s(12274),lt=s(8031),ut=s(4096),dt=s(48200),pt=s(59355),mt=s(58237),ht=s(78074),yt=s(16972),ft=s(94672),gt=s(76748);const xt=r.memo((function({uri:e,name:t,duration:s,artists:r,album:a,isExplicit:n,is19PlusOnly:i,isPlayable:o,index:c,imgUrl:l,requestId:u,isLyricsMatch:p,hasAssociatedVideo:m}){const{isActive:h,isPlaying:y,triggerPlay:f,togglePlay:x}=(0,xe.P)({uri:e},{featureIdentifier:"search",referrerIdentifier:"search"}),{spec:b}=(0,M.r)(Be.i,{data:{position:c,reason:u??"",uri:e}}),j=(0,yt.T)(e),R=(0,dt.g)(e,o),{badges:C,hasBadges:v}=(0,ft.b)({downloadAvailability:j,isExplicit:n,isMOGEFRestricted:i,hasAssociatedVideo:m}),A=r?.map((e=>e.name)).join(d.Ru.getSeparator())||"",k=(0,ut.c)();return(0,g.jsx)(B.pZ,{value:"row",index:c,children:(0,g.jsx)(He.h,{menu:(0,g.jsx)(Me.P,{uri:e,albumUri:a?.uri,artists:r,contextUri:e}),children:(0,g.jsxs)(it.w,{uri:e,contextUri:e,onTriggerPlay:(e,t)=>{f({loggingParams:t})},isActive:h,index:c,ariaRowIndex:c+1,isPlayable:R,ageRestricted:i,dragMetadata:{name:t,createdBy:A},spec:b,children:[(0,g.jsx)(tt.y,{ariaColIndex:0,children:(0,g.jsx)(Xe.$,{uri:e,playAriaLabel:d.Ru.get("tracklist.a11y.play",t,A),onClick:(e,t)=>{x({loggingParams:t})},isPlaying:y,isActive:h,spec:b,children:(0,g.jsx)(Qe.a,{children:c+1})})}),(0,g.jsxs)(st.U,{ariaColIndex:1,children:[(0,g.jsx)(Ye.e,{src:l}),(0,g.jsxs)(Ke.l,{children:[(0,g.jsx)(We.R,{enabled:k,uri:e,className:gt.A.rowTitle,children:(0,g.jsx)(nt.p,{titleText:t,children:t})}),v&&(0,g.jsxs)(Ze.P,{children:[C.download&&(0,g.jsx)(pt._,{}),C.explicit&&(0,g.jsx)(mt.g,{}),C.nineteen&&(0,g.jsx)(ht.q,{className:gt.A.nineteen,size:16}),C.hasAssociatedVideo&&(0,g.jsx)(ot.l,{})]}),(0,g.jsxs)(at.p,{children:[(0,g.jsx)(Ge.l,{artists:r,spec:b}),p&&(0,g.jsx)(lt.G,{})]})]})]}),(0,g.jsx)(rt.o,{ariaColIndex:2,children:(0,g.jsx)($e.g,{uri:a?.uri||"",name:a?.name||"",creatorUri:r?.[0]?.uri,spec:b,children:a?.name})}),(0,g.jsxs)(et.l,{ariaColIndex:3,children:[(0,g.jsx)(ct.d,{uri:e,spec:b}),(0,g.jsx)(Je.P,{duration:s.milliseconds}),(0,g.jsx)(ze.Y,{menu:(0,g.jsx)(Me.P,{uri:e,albumUri:a?.uri,artists:r,contextUri:e}),label:d.Ru.get("more.label.track",t,A),spec:b})]})]})})})}),((e,t)=>e.uri===t.uri));var bt=s(45546),jt=s(46288),Rt=s(45879),Ct=s(76792),vt=s(58943),At=s(60765),kt=s(59996);const It="search-searchCategory-SearchCategory",wt="search-searchCategory-wrapper",Pt="search-searchCategory-categoryGridItem",St=({to:e,title:t,selected:s,onClick:r})=>(0,g.jsx)(kt.N,{replace:!0,to:e,tabIndex:-1,onClick:r,className:Pt,children:(0,g.jsx)(Ct.v,{selected:s,selectedColorSet:"invertedLight",tabIndex:-1,children:t})}),Et=({searchCategories:e,selectedCategory:t,displayChips:s})=>{const{query:r}=re(),{spec:a,logger:n}=(0,M.r)(vt.q,{});if(!r||!s)return null;const i=encodeURIComponent(r);return(0,g.jsx)("div",{className:It,children:(0,g.jsx)("div",{className:Ne()(wt,"contentSpacing"),children:(0,g.jsxs)(At.F,{children:[e.length>0&&(0,g.jsx)(St,{to:`spotify:app:search:${i}`,title:d.Ru.get("search.title.all"),selected:void 0===t,onClick:()=>{n.logInteraction(a.chipFactory({identifier:"all",position:0}).hitUiNavigate({destination:`spotify:app:search:${i}`}))}},"all"),e.map(((e,s)=>{const r=K.j7[e]?.()??"";return r||console.warn("Received empty title for category: ",e),(0,g.jsx)(St,{to:`spotify:app:search:${i}:${e}`,title:r,selected:t===e,onClick:()=>{n.logInteraction(a.chipFactory({identifier:e,position:s+1}).hitUiNavigate({destination:`spotify:app:search:${i}:${e}`}))}},e)}))]})})})};var Nt=s(1878),_t=s(3554);const Tt="oahixVvmYv3VD8UxHkpr",Ut=({pageSize:e=100})=>{if(e>100)throw new Error("PathFinder does not support page sizes > 100");const t=(0,h.A)(),{query:s,serpId:a}=re(),{results:n,isError:i,isLoading:o,fetchNextPage:c}=qe({query:s,category:"tracks",pageSize:20,includePreReleases:!1}),l=(0,r.useCallback)(((e,t)=>{const s=(0,_t.g)(e.album?.images,{desiredSize:40});return(0,g.jsx)(xt,{index:t,uri:(0,Nt.a)(e),duration:e.duration,name:e.name,album:e.album||void 0,artists:e.artists,isPlayable:e.isPlayable,isExplicit:e.isExplicit,is19PlusOnly:e.is19PlusOnly,imgUrl:s?.url||"",requestId:e.requestId,isLyricsMatch:e.isLyricsMatch,hasAssociatedVideo:e.hasAssociatedVideo},t+e.uri)}),[]),u=(0,r.useMemo)((()=>[jt.$.INDEX,jt.$.TITLE_AND_ARTIST,jt.$.ALBUM,jt.$.DURATION]),[]),p=(0,r.useCallback)((e=>({uri:e.uri})),[]),m=(0,J.Ru)(s).toURI(),{spec:y,UBIFragment:f}=(0,M.r)(Ve.t,{data:{uri:m,reason:a}}),x=(0,r.useMemo)((()=>y.tracksFactory()),[y]),b=d.Ru.get("search.showing-category-query-songs",s);if(i)return(0,g.jsx)(G.o,{});if(!(o||n&&0!==n.length))return(0,g.jsx)(f,{spec:y.emptyResultsFactory(),children:(0,g.jsx)(ue,{forChip:K.j7.podcastAndEpisodes()})});const j=t?48:Rt.uC+48;return(0,g.jsx)(f,{spec:x,children:(0,g.jsx)(B.pZ,{value:"search-results-tracklist",children:(0,g.jsx)("div",{className:Tt,children:n&&(0,g.jsx)(he._,{triggerOnInitialLoad:!1,onReachBottom:c,children:(0,g.jsx)(bt.S4,{ariaLabel:b,hasHeaderRow:!0,columns:u,renderRow:l,resolveItem:p,nrTracks:n.length,headerTop:j,tracks:n,columnPersistenceKey:"search-results-tracklist"},s)})})})})},qt=({results:e,displayChips:t})=>{const{category:s}=re();return s?"podcastAndEpisodes"===s?(0,g.jsx)(Se,{results:e}):"tracks"===s?(0,g.jsx)(Ut,{}):"episodes"===s?(0,g.jsx)(ke,{enableInfiniteScroll:!0,showTitle:!1}):(0,g.jsx)(De,{displayChips:t,category:s}):(0,g.jsx)(G.o,{})};var Ft=s(22252),Ot=s(21953),Lt=s(58192),Dt=s(53222),Vt=s(570),Bt=s(25639),Ht=s(93240),Mt=s(75930),Wt=s(83547),$t=s(30171),Gt=s(7939),Zt=s(40312),Jt=s(32045);const Yt="MdWVOTFflb7OayRjn9pZ",Kt="N7Ng_kgcjiOOGs7Y48l9",Xt="_4tnwlIafghEfbtatHyO",zt="xgdE_xwOB8XLCxHOdp_I",Qt="YQfV97NZUj3G9JJwAiuY",es=e=>{const{checkConcertInCollectionFn:t=Jt.aw,unsaveConcertFn:s=Jt.Jr,saveConcertFn:a=Jt.m9,enqueueSnackbarFn:i=Ht.M8}=e.deps??{},o=(0,J.o_)(e.uri),[c,l]=(0,r.useState)(),u=(0,n.d4)(Gt.F6),{isLoading:p,data:m}=(0,Bt.I)({queryKey:["concertInCollection",{concertUri:e.uri,username:u}],queryFn:async()=>{const s=await t(Zt.n.getInstance(),u,e.uri);return s.body?.found[0]??!1},retry:!1,enabled:!!u});if((0,r.useEffect)((()=>{l(m)}),[m]),!o)return null;const h=c?Mt.k:Wt.P,y=c?"textPositive":void 0;return(0,g.jsx)(X.N_,{to:`/${o.toURLPath()}`,onClick:e.onClick,className:zt,children:(0,g.jsxs)("div",{className:Yt,children:[(0,g.jsxs)("div",{className:Kt,children:[(0,g.jsxs)("div",{className:Xt,children:[(0,g.jsx)(z.E,{as:"div",variant:"marginal",children:e.date.month}),(0,g.jsx)(z.E,{as:"div",variant:"bodySmallBold",children:e.date.day})]}),(0,g.jsxs)("div",{className:Qt,children:[(0,g.jsx)(z.E,{children:e.title}),(0,g.jsx)(z.E,{semanticColor:"textSubdued",variant:"bodySmall",children:e.subtitle})]})]}),void 0!==c&&(0,g.jsx)($t.H,{semanticColor:y,iconOnly:h,"aria-label":d.Ru.get("concerts_interested_tooltip"),onClick:t=>{t.preventDefault(),t.stopPropagation(),p||(c?(l(!1),i(d.Ru.get("concerts_removed-from-your-saved-events")),s(Zt.n.getInstance(),o.id)):(e.onClickInterested&&e.onClickInterested(),l(!0),i(d.Ru.get("concerts_added-to-your-saved-events")),a(Zt.n.getInstance(),o.id)))}})]})})};var ts=s(68179);const ss="mh7QL6adD4FIJhD5Exb9",rs="FgawEObrsLOnHPzhrl5a",as="PrDOhMH2lS5D8mMwbmF1",ns="hd4Hw4T7wuHZluBSTMZc",is=e=>{const t=(0,J.o_)(e.uri);return t?(0,g.jsx)(X.N_,{to:`/artist/${t.id}/concerts`,onClick:e.onClick,className:ns,children:(0,g.jsxs)("div",{className:ss,children:[(0,g.jsx)("div",{className:rs,children:(0,g.jsx)(ts.T,{className:as})}),e.children]})}):null},os="XZWs6fKwvH8afOAX9oRk",cs="xZzauCAsVPuDnvFjEnl5",ls="UDNDdAPalgpoNPaKmACx",us="yKnPM8up5atlbSBdRXVv",ds="ifJugrlP5ysjVmb2s4v3",ps="NsXrW_ZuSRESU0URaCER",ms=({uri:e,date:t,title:s,subtitle:a})=>{const{spec:n}=(0,M.r)(Dt.S,{data:{uri:e}}),i=(0,be.s)(),o=(0,ne.t)(n),c=new Date(t),l=d.Ru.formatDate(c,{weekday:"short"}),u=d.Ru.formatDate(c,{hour:"numeric",minute:"numeric"}),p=d.Ru.formatDate(c,{day:"numeric"}),m=d.Ru.formatDate(c,{month:"short"}),h=(0,r.useMemo)((()=>n.localConcertFactory({uri:e})),[e,n]),y=(0,r.useMemo)((()=>n.interestedButtonFactory({uri:e})),[e,n]);return(0,g.jsx)("div",{ref:o,children:(0,g.jsx)(es,{uri:e,title:s,subtitle:d.Ru.get("search.concert.event",l,u,a),date:{day:p,month:m},onClick:()=>{i.logInteraction(h.hitUiNavigate({destination:e}))},onClickInterested:()=>{i.logInteraction(y.hitUiSelect())}})})},hs=({artistUri:e})=>{const{spec:t}=(0,M.r)(Vt._,{data:{uri:e??""}}),s=(0,be.s)(),a=(0,ne.t)(t),n=(0,r.useMemo)((()=>t.onTourShelfFactory({uri:e??""})),[e,t]);return(0,g.jsx)("div",{ref:a,children:(0,g.jsx)(is,{uri:e??"",onClick:()=>{s.logInteraction(n.hitUiNavigate({destination:`${e}:concerts`}))},children:d.Ru.get("search.concerts.see-all")})})},ys=({artistUri:e,concert:t})=>(0,g.jsxs)("section",{className:Ne()(ds),children:[(0,g.jsx)("div",{className:os,children:(0,g.jsx)("div",{className:cs,children:(0,g.jsx)("div",{className:ls,children:(0,g.jsx)(z.E,{as:"h2",variant:"titleSmall",className:us,children:d.Ru.get("search.title.concerts")})})})}),(0,g.jsx)("div",{className:ps,children:t?(0,g.jsx)(ms,{...t}):(0,g.jsx)(hs,{artistUri:e})})]});var fs=s(65265),gs=s(89661),xs=s(10741);const bs=r.memo((function({uri:e,name:t,duration:s,album:r,artists:a,index:n,imgUrl:i,isPlayable:o,isExplicit:c,is19PlusOnly:l,requestId:u,isLyricsMatch:p,hasAssociatedVideo:m}){const{isActive:h,isPlaying:y,triggerPlay:f,togglePlay:x}=(0,xe.P)({uri:e},{featureIdentifier:"search",referrerIdentifier:"search"}),{spec:b}=(0,M.r)(Be.i,{data:{position:n,reason:u??"",uri:e}}),j=(0,yt.T)(e),R=(0,dt.g)(e,o),{badges:C,hasBadges:v}=(0,ft.b)({downloadAvailability:j,isExplicit:c,isMOGEFRestricted:l,hasAssociatedVideo:m}),A=(a||[]).map((e=>e.name)).join(d.Ru.getSeparator()),k=(0,ut.c)();return(0,g.jsx)(B.pZ,{value:"row",index:n,children:(0,g.jsx)(He.h,{menu:(0,g.jsx)(Me.P,{uri:e,artists:a,contextUri:e,albumUri:r?.uri}),children:(0,g.jsxs)(it.w,{uri:e,contextUri:e,index:n,ariaRowIndex:n,onTriggerPlay:(e,t)=>{f({loggingParams:t})},isActive:h,isPlayable:R,ageRestricted:l,dragMetadata:{name:t,createdBy:A},spec:b,children:[(0,g.jsxs)(st.U,{ariaColIndex:0,children:[(0,g.jsx)(xs.u,{uri:e,src:i,onClick:(e,t)=>{x({loggingParams:t})},isLocked:!1,isPlaying:y,isActive:h,playAriaLabel:d.Ru.get("tracklist.a11y.play",t,A),spec:b}),(0,g.jsxs)(Ke.l,{children:[(0,g.jsx)(We.R,{enabled:k,uri:e,className:gt.A.rowTitle,children:(0,g.jsx)(nt.p,{titleText:t,children:t})}),v&&(0,g.jsxs)(Ze.P,{children:[C.download&&(0,g.jsx)(pt._,{}),C.explicit&&(0,g.jsx)(mt.g,{}),C.nineteen&&(0,g.jsx)(ht.q,{className:gt.A.nineteen,size:16}),C.hasAssociatedVideo&&(0,g.jsx)(ot.l,{})]}),(0,g.jsxs)(at.p,{children:[(0,g.jsx)(Ge.l,{artists:a,spec:b}),p&&(0,g.jsx)(lt.G,{})]})]})]}),(0,g.jsxs)(et.l,{ariaColIndex:1,children:[(0,g.jsx)(ct.d,{uri:e,spec:b}),(0,g.jsx)(Je.P,{duration:s.milliseconds}),(0,g.jsx)(ze.Y,{menu:(0,g.jsx)(Me.P,{uri:e,artists:a,contextUri:e,albumUri:r?.uri}),label:d.Ru.get("more.label.track",t,A),spec:b})]})]})})})}),((e,t)=>e.uri===t.uri&&e.index===t.index)),js=r.memo((function({tracks:e,query:t}){const s=(0,l.NC)(Ue.LX5),a=(0,r.useCallback)(((e,t)=>{const r=(0,_t.g)(e.album?.images,{desiredSize:40});return(0,g.jsx)(bs,{uri:(0,Nt.a)(e),duration:e.duration,name:e.name,album:e.album||void 0,artists:e.artists,isPlayable:e.isPlayable,isExplicit:e.isExplicit,is19PlusOnly:e.is19PlusOnly,index:t,imgUrl:r?.url||"",requestId:e.requestId,isLyricsMatch:e.isLyricsMatch,hasAssociatedVideo:e.hasAssociatedVideo&&s},e.uri)}),[s]),n=(0,r.useMemo)((()=>[jt.$.TITLE_AND_ARTIST,jt.$.DURATION]),[]),i=(0,r.useCallback)((e=>({uri:e.uri})),[]);return e&&(0,g.jsx)(B.pZ,{value:"search-results-tracklist",children:(0,g.jsx)(bt.S4,{ariaLabel:d.Ru.get("search.a11y.songs-search-results"),renderRow:a,rowPlaceholder:gs.qq,nrTracks:Math.min(e.length,4),tracks:e,resolveItem:i,columns:n},t)})}),((e,t)=>e.tracks===t.tracks)),Rs="qTGjBrDb0ehi3T31ixUg",Cs="UypXfD8vtkwoy6Hvjxh6",vs="k1hAaTegqCFmfemVkI4k",As="hkyAoNduIpi1yzoJT7Yg",ks="sQqi2VrhnxcFciXdvgjL",Is="ib6ClWIXW5DmWXaC0W08",ws="nTbpvWKW0gZOhU4sejUH",Ps=({tracks:e,query:t,className:s,showSeeAll:a=!0,spec:n})=>{const i=(0,be.s)(),o=(0,r.useCallback)((()=>(0,g.jsx)("div",{className:ws,children:(0,g.jsx)(r.Suspense,{fallback:null,children:(0,g.jsx)(js,{tracks:e.items,query:t})})})),[t,e]),c=`spotify:app:search:${encodeURIComponent(t)}:tracks`,l=(0,r.useCallback)((()=>{const e=n.headerFactory().titleFactory().hitUiNavigate({destination:c});i.logInteraction(e)}),[i,n,c]),u=(0,r.useCallback)((()=>{const e=n.headerFactory().seeAllFactory().hitUiNavigate({destination:c});i.logInteraction(e)}),[i,n,c]);return e.items.length?(0,g.jsxs)("section",{className:Ne()(Is,s),"aria-label":d.Ru.get("search.title.tracks"),"data-testid":"search-tracks-result",children:[(0,g.jsx)("div",{className:Rs,children:e.items.length>3?(0,g.jsxs)("div",{className:Ne()(Cs,vs),children:[(0,g.jsx)("div",{className:As,children:(0,g.jsx)(z.E,{as:"h2",variant:"titleSmall",children:a?(0,g.jsx)(kt.N,{to:c,className:ks,onClick:l,children:d.Ru.get("search.title.tracks")}):(0,g.jsx)("span",{className:ks,children:d.Ru.get("search.title.tracks")})})}),a&&(0,g.jsx)(fs.h,{link:c,onClick:u})]}):(0,g.jsx)(z.E,{as:"h2",variant:"titleSmall",className:ks,children:d.Ru.get("search.title.tracks")})}),(0,g.jsx)(F.r,{spec:n,children:(0,g.jsx)(Fe.E,{render:o})})]}):null},Ss=({topRecommendations:e,query:t,className:s,onAddToHistory:r,position:a,showSeeAll:n})=>{const i=e.totalCount||0;return(0,g.jsx)(C.p,{index:a,id:"top-recommendations",className:s,total:i,title:d.Ru.get("artist-page.featuring",e.artistName),seeAllUri:`spotify:app:search:${encodeURIComponent(t)}:topRecommendations`,showSeeAll:n,children:e.items.map(((e,t)=>(0,g.jsx)(B.pZ,{index:t,value:"top-recommendations",children:(0,g.jsx)(Ie.Q,{onClick:()=>r(e),entity:e,index:t})},e.uri)))})};var Es=s(57734);const Ns="vKsgiy0W3aHYmZUlwHoQ",_s="w2O3N2xilgVcd4ep6cQL",Ts="T2cpdJTvNpOFPvN4WJM4",Us="u372KlVrkMz1ZpJ89LMG",qs="DIYNtp69Gd1l3eaBT3Bg",Fs="cXdpTaiu9PEfynRcDKrU",Os="yZ3EPSfU0nkNoCu19iPL",Ls="OtEFcRGkMfUXBZC2HF5M",Ds=({topResults:e,onAddToHistory:t})=>{const[s]=e.items;return s&&(0,g.jsx)(Es.$,{total:1,className:Ns,title:d.Ru.get("search.title.top-result"),withEncoreCards:!1,children:[(0,g.jsx)("div",{"aria-live":"polite","data-testid":"top-result-card",className:_s,children:(0,g.jsx)(B.pZ,{value:"top-result-card",children:(0,g.jsx)(Ie.Q,{isHero:!0,index:0,onClick:()=>t(s),entity:s})})},"top-result-item")]})};var Vs=s(71817);const Bs=e=>e?.type===Vs.c.ARTIST,Hs=({results:e})=>{const{query:t,onAddToHistory:s,serpId:a}=re(),n=(0,J.Ru)(t).toURI(),{spec:i,UBIFragment:o}=(0,M.r)(Lt.P,{data:{uri:n,reason:a}}),c=e.topResults.items.length>0,l=e.tracks.items.length>0,u=e.topRecommendations.items.length>0,[d]=e.topResults.items??[],p=Bs(d)?(e=>{const[t]=e??[];if(t&&"uri"in(t.data??{}))return{uri:t.data.uri,date:t.data.startDateIsoString,title:t.data.location.city,subtitle:t.data.location.name}})(d.localConcerts?.items):void 0,m=Bs(d)&&(d.hasConcerts||!!p),h=(0,r.useMemo)((()=>({topResult:i.topResultFactory(),trackList:i.trackListFactory(),shelves:i.shelvesFactory()})),[i]);return(0,g.jsx)(Fe.E,{className:Ts,rowGap:Ot.WG,colGap:Ot.CJ,testId:"search-results",render:({columnCount:r})=>{let a,n;return c?a=r>3?qs:Fs:u&&(r>5&&l?(a=Us,n=Os):(a=Fs,n=Ls)),(0,g.jsxs)(B.pZ,{value:"search-results",children:[c&&(0,g.jsx)(o,{spec:h.topResult,children:(0,g.jsx)(Ds,{topResults:e.topResults,onAddToHistory:s})}),(0,g.jsxs)("section",{className:a,children:[m&&(0,g.jsx)(ys,{artistUri:d.uri,concert:p}),l&&(0,g.jsx)(Ps,{spec:h.trackList,query:t,tracks:m?{totalCount:3,items:e.tracks.items.slice(0,3)}:e.tracks,onAddToHistory:s,showSeeAll:!1})]}),u&&(0,g.jsx)(o,{spec:h.shelves,children:(0,g.jsx)(Ss,{position:0,query:t,className:n,topRecommendations:e.topRecommendations,onAddToHistory:s,showSeeAll:!1})}),K.ud.map(((r,a)=>(0,g.jsx)(o,{spec:h.shelves,children:(0,g.jsx)(we,{position:a+1,category:r,title:K.j7[r](),query:t,results:e[r],onAddToHistory:s,showSeeAll:!1})},`search-shelf-${r}`)))]})}})},Ms=({results:e,hasResults:t})=>{const{query:s,serpId:r}=re(),a=(0,J.Ru)(s).toURI(),n=!(0,ae.n)(),{spec:i,UBIFragment:o}=(0,M.r)(Lt.P,{data:{uri:a,reason:r}});return n?(0,g.jsx)(ue,{}):e?e&&!t?(0,g.jsx)(o,{spec:i.emptyResultsFactory(),children:(0,g.jsx)(ue,{})}):(0,g.jsx)(Hs,{results:e}):null},Ws=new E.l("searchDesktop","query","c45b57fa9839e633f8ed1bf2c7c8d64027b6668d493ade79e4ee8c7f567bed8f",null);function $s(e){return e.map((e=>e.url?{url:e.url,width:Number(e.width)||56,height:Number(e.height)||56}:e))}var Gs=s(52471),Zs=s(4055),Js=s(7353);function Ys(e,t){if("PreRelease"!==e.data?.__typename)return null;const s=e.data.preReleaseContent;if(!s)return null;const r=(0,Zs.mp)(e.data.releaseDate),a=s.artists.items.map((e=>"Artist"===e.data.__typename?{type:Vs.c.ARTIST,name:e.data.profile.name,uri:e.data.uri}:null)).filter(Js.P);return{type:Vs.c.PRE_RELEASE_ALBUM,name:s.name||"",uri:e.data.uri,images:$s(s.coverArt?.sources||[]),release:r,releaseTimezone:e.data.timezone,artists:a,color:(0,Gs.m)(s.coverArt?.extractedColors),requestId:t}}function Ks(e,t){return{items:(e?.items||[]).map((e=>{const{__typename:s}=e;switch(s){case"AlbumResponseWrapper":return Xs(e,t);case"PreReleaseResponseWrapper":return Ys(e,t);case"UnknownTypeWrapper":return null;default:return(0,I.k)(s),null}})).filter(Js.P),totalCount:e?.totalCount||0}}function Xs(e,t){if("Album"!==e.data.__typename)return null;const s=e.data;return{type:Vs.c.ALBUM,name:s.name,uri:s.uri,images:$s(s.coverArt?.sources||[]),artists:s.artists.items.map((e=>({type:Vs.c.ARTIST,name:e.profile.name,uri:e.uri}))),year:s.date?.year,requestId:t,color:(0,Gs.m)(e.data.coverArt?.extractedColors),isPlayable:e.data.playability.playable,playabilityReason:e.data.playability.reason}}const zs=new E.l("searchAlbums","query","de1046fc459b96b661b2f4e4d821118a9fbe4b563084bf5994e89ce34acc10c0",null),Qs=(e,t)=>{const s="object"==typeof e?.requestIds?e?.requestIds:void 0,r=s?.[t],a="object"==typeof r?r:void 0;return"string"==typeof a?.["search-api"]?a?.["search-api"]:void 0},er=e=>Qs(e,"/searchV2"),tr=e=>Qs(e,"/searchV2/topResults"),sr=(e,t)=>({...e,pagingInfo:t});function rr(e,t){return{items:ar(e?.items||[],t),totalCount:e?.totalCount||0}}function ar(e,t){return e.map((e=>nr(e,t))).filter(Js.P)}function nr(e,t){if("Artist"!==e.data?.__typename)return null;const s=e.data;return{type:Vs.c.ARTIST,name:s.profile.name,images:$s(s.visuals?.avatarImage?.sources||[]),uri:s.uri,verified:s.profile.verified||!1,requestId:t,hasConcerts:s.hasConcerts??!1,localConcerts:s.localConcerts,color:(0,Gs.m)(s.visuals.avatarImage?.extractedColors)}}const ir=new E.l("searchArtists","query","f1b4c1195368a8f4a3620973869d1a60d8a1dcbf8cd155dd693b7f7b7b3de2e9",null);function or(e,t){return{items:cr(e?.items||[],t),totalCount:e?.totalCount}}function cr(e,t){return e.map((e=>lr(e,t))).filter(Js.P)}function lr(e,t){if("Audiobook"!==e.data?.__typename)return null;const s=e.data;let r=null;return s.isPreRelease&&s.preReleaseEndDateTime?r=new Date(s.preReleaseEndDateTime?.isoString):s.publishDate&&(r=new Date(s.publishDate.isoString)),{type:Vs.c.AUDIOBOOK,uri:s.uri,name:s.name,images:$s(s.coverArt?.sources||[]),authorName:s.authors?.[0]?.name??"",topics:s.topics.items||[],publishDate:r,requestId:t,color:(0,Gs.m)(s.coverArt?.extractedColors),signifierText:s.accessInfo?.signifier?.text??void 0,isPreRelease:!!s.isPreRelease}}const ur=new E.l("searchAudiobooks","query","82ec16373818a73b4d7323c076e4f5d550ec3b0e5e2650d4715ca011dfa775fe",null);var dr=s(79787),pr=s(18573),mr=s(8035),hr=s(54443);const yr={type:Vs.c.SHOW,uri:"",name:"",publisher:"",images:[],mediaType:hr.Q.UNKNOWN};function fr(e,t){return{items:gr(e?.items||[],t),totalCount:e?.totalCount||0}}function gr(e,t){return e.map((e=>xr(e,t))).filter(Js.P)}function xr(e,t){if("Episode"!==e.data?.__typename)return null;const s=e.data,r=s.podcastV2.data;let a=yr;return"Podcast"===r.__typename&&(a={type:Vs.c.SHOW,uri:r.uri,name:r.name,publisher:r.publisher?.name||"",mediaType:(0,mr.w)(r.mediaType),images:$s(r.coverArt?.sources||[])}),{type:Vs.c.EPISODE,name:s.name,images:$s(s.coverArt?.sources||[]),uri:s.uri,duration:{milliseconds:s.duration.totalMilliseconds},isExplicit:s.contentRating?.label===dr.x7.Explicit,release:(0,Zs.mp)(s.releaseDate),description:s.description||"",playedState:(0,pr.fS)(s.duration,s.playedState),is19PlusOnly:s.contentRating?.label===dr.x7.NineteenPlus,show:a,requestId:t,color:(0,Gs.m)(s.coverArt?.extractedColors),mediaType:s.mediaTypes??[],podcastSubscription:(0,pr.Wx)(s.restrictions,s.playability)}}const br=new E.l("searchEpisodes","query","6c94e7db591c68ff6244234e1b2378b3eb6a1f5c1999b711a7bd12b9708f6322",null);const jr=new E.l("searchFullEpisodes","query","22e377f7b7c40e7ee0aa57dcb6d27120e524bb7dc14271101abed22aded60f8e",null);var Rr=s(58646);const Cr={...yr,description:"",htmlDescription:"",coverArt:[],trailer:null,topics:[],podcastType:"UNKNOWN",showTypes:[],publisherName:"",consumptionOrder:"recent",nextBestEpisode:void 0,gatedContentAccessReason:void 0,isLocked:!1};function vr(e,t){return e.map((e=>function(e,t){if("Episode"!==e.data?.__typename)return null;let s=Cr;"Podcast"===e.data.podcastV2.data.__typename&&(s=(0,Rr._v)(e.data.podcastV2.data));return{requestId:t,episode:(0,Rr.S)(e.data),show:s}}(e,t))).filter(Js.P)}async function Ar(e,t){const s=await e(jr,t),r=s?.data?.searchV2?.episodes;return r?function(e,t){return{items:vr(e?.items||[],t),totalCount:e?.totalCount||0}}(r,er(s?.extensions)):null}function kr(e,t){return{items:Ir(e?.items||[],t),totalCount:e?.totalCount||0}}function Ir(e,t){return e.map((e=>wr(e,t))).filter(Js.P)}function wr(e,t){if("Genre"!==e.data?.__typename)return null;const s=e.data,r=(0,J.o_)(s.uri);return{type:Vs.c.GENRE,name:s.name,uri:r?s.uri:`spotify:genre:${s.uri}`,images:$s(s.image?.sources||[]),requestId:t,color:(0,Gs.m)(s.image?.extractedColors)}}const Pr=new E.l("searchGenres","query","9e1c0e056c46239dd1956ea915b988913c87c04ce3dadccdb537774490266f46",null);const Sr={type:Vs.c.USER,uri:"",displayName:"",username:"",images:[]};function Er(e,t){return{items:Nr(e?.items||[],t),totalCount:e?.totalCount||0}}function Nr(e,t){return e.map((e=>_r(e,t))).filter(Js.P)}function _r(e,t){if("Playlist"!==e.data?.__typename)return null;const s=e.data;let r=Sr;if("User"===s.ownerV2?.data.__typename){const e=s.ownerV2?.data;r={type:Vs.c.USER,uri:e.uri||"",displayName:e.name||"",username:e.username||"",images:$s(e.avatar?.sources||[])}}return{type:Vs.c.PLAYLIST,uri:s.uri,name:s.name,images:$s(s.images?.items.flatMap((e=>e.sources))||[]),owner:r,requestId:t,formatListData:{type:s.format??"",attributes:(a=s.attributes??[],a.reduce(((e,t)=>(e[t.key]=t.value,e)),{}))},color:(0,Gs.m)(s.images.items[0]?.extractedColors)};var a}const Tr=new E.l("searchPlaylists","query","fc3a690182167dbad20ac7a03f842b97be4e9737710600874cb903f30112ad58",null);function Ur(e,t){return{items:qr(e?.items||[],t),totalCount:e?.totalCount||0}}function qr(e,t){return e.map((e=>Fr(e,t))).filter(Js.P)}function Fr(e,t){if("Podcast"!==e.data?.__typename)return null;const s=e.data;return{type:Vs.c.SHOW,uri:s.uri,name:s.name,images:$s(s.coverArt?.sources||[]),publisher:s.publisher?.name||"",topics:s.topics.items||[],requestId:t,color:(0,Gs.m)(s.coverArt?.extractedColors)}}const Or=new E.l("searchPodcasts","query","cbd33edc7a612454640d753caff6fb1074a7868843612d257dcef5e71e837dd9",null);function Lr(e,t){return{items:Dr(e,t),totalCount:e?.totalCount||0}}function Dr(e,t){return e?.items.map((({item:e,matchedFields:s})=>Vr(e,s,t))).filter(Js.P)||[]}function Vr(e,t,s){if("Track"!==e.data?.__typename)return null;const r=e.data,a=r.albumOfTrack,n=!!r.associations&&r.associations.associatedVideos.totalCount>0;return{type:Vs.c.TRACK,uri:r.uri,name:r.name,isPlayable:r.playability.playable,album:{type:Vs.c.ALBUM,uri:a?.uri||"",name:a?.name||"",images:$s(a?.coverArt?.sources||[])},artists:r.artists.items.map((e=>({type:Vs.c.ARTIST,name:e.profile.name,uri:e.uri}))),duration:{milliseconds:r.duration.totalMilliseconds},hasAssociatedVideo:n,isExplicit:"EXPLICIT"===r.contentRating?.label,is19PlusOnly:"NINETEEN_PLUS"===r.contentRating?.label,requestId:s,isLyricsMatch:!!t?.includes(dr.tC.Lyrics),color:(0,Gs.m)(a?.coverArt?.extractedColors)}}function Br(e,t){return{items:Hr(e?.items||[],t),totalCount:e?.totalCount||0}}function Hr(e,t){return e.map((e=>Mr(e,t))).filter(Js.P)}function Mr(e,t){if("User"!==e.data?.__typename)return null;const s=e.data;return{type:Vs.c.USER,uri:s.uri,name:s.displayName||s.username,images:$s(s.avatar?.sources??[]),requestId:t,color:(0,Gs.m)(s.avatar?.extractedColors)}}var Wr=s(5103);function $r(e,t){const s=e?.itemsV2??[],r=s.map((({item:e,matchedFields:s})=>{const{__typename:r}=e;switch(r){case"AlbumResponseWrapper":return Xs(e,t);case"ArtistResponseWrapper":return nr(e,t);case"AudiobookResponseWrapper":return lr(e,t);case"EpisodeResponseWrapper":return xr(e,t);case"GenreResponseWrapper":return wr(e,t);case"PlaylistResponseWrapper":return _r(e,t);case"PodcastResponseWrapper":return Fr(e,t);case"TrackResponseWrapper":return Vr(e,s,t);case"UserResponseWrapper":return Mr(e,t);case"PreReleaseResponseWrapper":return Ys(e,t);case"UnknownTypeWrapper":return null;default:return(0,I.k)(r),null}})).filter(Js.P);return{totalCount:s.length,items:r}}function Gr(e,t){const s=e?.featured||[];return{artistName:s.length?Zr(e):"",items:s?.map((e=>_r(e,t))).filter(Js.P)||[],totalCount:s.length||0}}function Zr(e){const t=(0,Wr.no)(e,"itemsV2",[]);try{const e=(0,Wr.Jt)(t.map((({item:e})=>e)).filter(Boolean),"0.data");return e?.profile?.name||""}catch{return""}}const Jr=new E.l("searchTopResultsOnly","query","687bc81d19e8f64df145ed1977639975a008a80309327503704692260907a961",null);const Yr=new E.l("searchTracks","query","5307479c18ff24aa1bd70691fdb0e77734bede8cce3bd7d43b6ff7314f52a6b8",null);const Kr=new E.l("searchUsers","query","d3f7547835dc86a4fdf3997e0f79314e7580eaf4aaf2f4cb1e71e189c5dfcb1f",null);const Xr={items:[],totalCount:0,pagingInfo:{nextOffset:null}},zr={albums:{items:[],totalCount:0},artists:{items:[],totalCount:0},episodes:{items:[],totalCount:0},genres:{items:[],totalCount:0},playlists:{items:[],totalCount:0},podcasts:{items:[],totalCount:0},audiobooks:{items:[],totalCount:0},topResults:{items:[]},tracks:{items:[],totalCount:0},users:{items:[],totalCount:0},topRecommendations:{artistName:"",items:[],totalCount:0},chipOrder:{items:[]}};class Qr{constructor(e){this._request=e}async getSearchResults(e,t=!0,s=0,r=10,a=5,n=!1,i=!1,o=!1){const c={searchTerm:e,offset:s,limit:r,numberOfTopResults:a,includeAudiobooks:t,includeArtistHasConcertsField:n,includePreReleases:i,includeLocalConcertsField:o},l=await this._request(Ws,c),u=l?.data?.searchV2;if(!u)return zr;const d=er(l?.extensions),p=tr(l?.extensions);return{albums:Ks(u.albumsV2,d),artists:rr(u.artists,d),episodes:fr(u.episodes,d),genres:kr(u.genres,d),playlists:Er(u.playlists,d),podcasts:Ur(u.podcasts,d),audiobooks:or(u.audiobooks??null,d),tracks:Lr(u.tracksV2,d),users:Br(u.users,d),topResults:$r(u.topResultsV2,p),topRecommendations:Gr(u.topResultsV2,p),chipOrder:u.chipOrder}}async getSearchCategoryResults(e,t,s=!1,r=!1,a=0,n=25,i=20){const o={searchTerm:e,offset:a,limit:n,numberOfTopResults:i,includeAudiobooks:s,includePreReleases:r};let c=null;switch(t){case"albums":c=await async function(e,t){const s=await e(zs,t),r=s?.data?.searchV2?.albumsV2;return r?sr(Ks(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"artists":c=await async function(e,t){const s=await e(ir,t),r=s?.data?.searchV2?.artists;return r?sr(rr(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"episodes":c=await async function(e,t){const s=await e(br,t),r=s?.data?.searchV2?.episodes;return r?sr(fr(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"genres":c=await async function(e,t){const s=await e(Pr,t),r=s?.data?.searchV2?.genres;return r?sr(kr(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"playlists":c=await async function(e,t){const s=await e(Tr,t),r=s?.data?.searchV2?.playlists;return r?sr(Er(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"podcasts":c=await async function(e,t){const s=await e(Or,t),r=s?.data?.searchV2?.podcasts;return r?sr(Ur(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"audiobooks":c=await async function(e,t){const s=await e(ur,t),r=s?.data?.searchV2?.audiobooks;return r?sr(or(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"tracks":c=await async function(e,t){const s=await e(Yr,t),r=s?.data?.searchV2?.tracksV2;return r?sr(Lr(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"users":c=await async function(e,t){const s=await e(Kr,t),r=s?.data?.searchV2?.users;return r?sr(Br(r,er(s?.extensions)),r.pagingInfo):null}(this._request,o);break;case"topResults":c=await async function(e,t){const s=await e(Jr,t),r=s?.data?.searchV2?.topResultsV2;return r?$r(r,tr(s?.extensions)):null}(this._request,o);break;case"podcastAndEpisodes":c=await Ar(this._request,o);break;default:(0,I.k)(t)}return c||Xr}async getFullEpisodes(e,t=0,s=25){const r={searchTerm:e,offset:t,limit:s};return await Ar(this._request,r)||Xr}}var ea=s(6029),ta=s(20842),sa=s(40353),ra=s(21233),aa=s(95625);const na={[dr.pb.Podcasts]:["podcasts","podcastAndEpisodes"],[dr.pb.Episodes]:["episodes","podcastAndEpisodes"],[dr.pb.TopResults]:["topResults","topResults"],[dr.pb.Artists]:["artists","artists"],[dr.pb.Albums]:["albums","albums"],[dr.pb.Playlists]:["playlists","playlists"],[dr.pb.Tracks]:["tracks","tracks"],[dr.pb.Audiobooks]:["audiobooks","audiobooks"],[dr.pb.Genres]:["genres","genres"],[dr.pb.Users]:["users","users"]};var ia=s(63198),oa=s(2628),ca=s(47721),la=s(52732);const ua="kMLumUDiP1DgYtLABkVO",da=({results:e,hasResults:t})=>{const s=(0,h.A)(),{isBrowser:a}=(0,n.d4)((e=>e.platform)),o=(0,n.d4)(ca.JJ),c=(0,ia.V)(),d=(0,f.vh)(),{version:p}=(0,f.mv)(),{category:x}=re(),R=((e,t,s)=>{const r=e?.chipOrder?.items??[];return Array.from(r.reduce(((r,a)=>{if(!a.typeName)return r;if(!s&&a.typeName===dr.pb.TopResults)return r;const[n,i]=na[a.typeName];return i&&n&&(t===i||e?.[n]?.items?.length)?(r.add(i),r):r}),new Set([])))})(e,x,!1),C="podcasts"!==x&&"episodes"!==x,v=(e=>{if(!e)return!1;const[t]=e.topResults.items;return Boolean(t&&t.type===Vs.c.TRACK)})(e),A=(0,l.NC)(Ue.ijb);return(0,r.useEffect)((()=>{a||e&&t&&(({eventSender:e,country:t,isAnonymous:s,context:r,variant:a})=>{const n={category:"internal-search-test",action:"search-results-page-visit",variant:a,label:"desktop-app",context:r,os:(0,ra.f)(),country:t,spt:(0,aa.v8)("sp_t")};s?e.send((0,sa.r)(n)):e.send((0,ta._)(n))})({eventSender:d,country:o,isAnonymous:c,context:JSON.stringify({top_result_is_track:v,version:p}),variant:A})}),[o,d,t,c,a,e,v,A,p]),(0,g.jsxs)(B.pZ,{value:"search-page",children:[!s&&(0,g.jsx)(m.g,{children:(0,g.jsx)(Ft.o,{isSearchChipsEnabled:!0})}),(0,g.jsx)(Et,{searchCategories:R,selectedCategory:x,displayChips:C}),(0,g.jsx)("div",{className:"contentSpacing",id:"searchPage",children:(0,g.jsx)(Fe.E,{className:ua,render:()=>(0,g.jsxs)(i.BV,{children:[(0,g.jsx)(i.qh,{path:"/",element:(0,g.jsx)(y.e,{pageId:u.$h.FIND,entityUri:"spotify:app:search",children:(0,g.jsx)($,{})})}),(0,g.jsx)(i.qh,{path:":query",element:(0,g.jsx)(j,{children:(0,g.jsx)(Ms,{results:e,hasResults:t})})}),(0,g.jsx)(i.qh,{path:":query/:category",element:(0,g.jsx)(b,{children:(0,g.jsx)(qt,{results:e,displayChips:C})})})]})})})]})};const pa=r.memo((function(){const e=(0,a.jE)(),t=(0,l.NC)(Ue.KvH),s=(0,l.NC)(Ue.Lh5),n=(0,l.NC)(Ue.Jl4),i=!(0,ae.n)(),[{category:o,query:u},m]=(0,ea.o)();(0,oa.m)("search");const[h,y]=(0,r.useState)({results:null,queryForResults:u??""}),f=h.results,x=function(e){return null!==e&&void 0!==Object.keys(e).find((t=>"chipOrder"!==t&&e[t].items.length>0))}(f),b=(0,r.useMemo)((()=>new Qr((0,la.lY)(Zt.n.getInstance()))),[]),{searchHistory:j,setSearchHistory:R}=(0,V.k)(),C=(0,r.useCallback)((e=>{R([e,...j])}),[j,R]),v=(0,r.useCallback)((async e=>{e===h.queryForResults&&x||m(e,o,!1)}),[h.queryForResults,o,x,m]);(0,r.useEffect)((()=>{if(!u)return;if(i)return void y({results:null,queryForResults:u});const r=["searchPageResults",u,{numberOfTopResults:5,isConcertsInSearchEnabled:t,isBookPrereleaseEnabled:n,isLocalConcertsInSearchEnabled:s}];e.ensureQueryData({queryKey:r,queryFn:()=>b.getSearchResults(u,!0,0,10,5,t,n,s),gcTime:9e5,staleTime:9e5}).then((e=>{y({results:e,queryForResults:u})}))}),[b,n,t,s,i,u,e]),(0,r.useEffect)((()=>{u||y({results:null,queryForResults:""})}),[u]);const A=(0,r.useMemo)((()=>c().create().toString()),[o,h.queryForResults]),k=(0,r.useMemo)((()=>({api:b,category:o,query:h.queryForResults,onAddToHistory:C,onSearchRequest:v,serpId:A})),[b,o,C,v,h.queryForResults,A]);return(0,g.jsxs)(se,{value:k,children:[(0,g.jsx)(p.Q,{children:d.Ru.get("search.page-title")}),(0,g.jsx)(da,{results:f,hasResults:x})]})}))},1878:(e,t,s)=>{s.d(t,{a:()=>r});const r=e=>e?.linked_from?.uri||e.uri}}]);
|
|
//# sourceMappingURL=xpui-routes-search.js.map
|