import{g as f,l as _,r as k,o as V,J as i,M as p,v as o,B as m,F as d,D as y,j as u,X as C,y as r,x as v,G as h,O as S,K as g,A as x,U as b}from"./index-e5db0b73.js";import{_ as D}from"./PanelviewItem.vue_vue_type_style_index_0_lang-221d4edc.js";import{i as L,e as G}from"./contextmenu-8eac6b44.js";import{x as A,y as E,V as N,k as P}from"./VImg-7a057c50.js";import{V as B}from"./VBadge-efd00f67.js";import{V as M}from"./VToolbar-4e8dded4.js";import{V as T,a as O}from"./VSlideGroup-3a4ba80a.js";import"./ListItem-ac3869d3.js";import"./VMenu-d9833a31.js";import"./VTooltip-71530943.js";import"./VCheckboxBtn-46446b67.js";import"./VCard-c9b9f4e9.js";const $=f()({name:"VSlideGroupItem",props:A(),emits:{"group:selected":c=>!0},setup(c,t){let{slots:n}=t;const e=E(c,T);return()=>{var l;return(l=n.default)==null?void 0:l.call(n,{isSelected:e.isSelected.value,select:e.select,toggle:e.toggle,selectedClass:e.selectedClass.value})}}}),F={key:0,class:"widget-row"},W=_({__name:"HomeView",setup(c){const t=k({recently_played:{label:"recently_played",icon:"mdi-motion-play",items:[]},artists:{label:"artists",icon:"mdi-account-music",path:"/artists",items:[]},albums:{label:"albums",icon:"mdi-album",path:"/albums",items:[]},playlists:{label:"playlists",icon:"mdi-playlist-music",path:"/playlists",items:[]},tracks:{label:"tracks",icon:"mdi-file-music",path:"/tracks",items:[]},radios:{label:"radios",icon:"mdi-radio",path:"/radios",items:[]},browse:{label:"browse",icon:"mdi-folder",path:"/browse",items:[]}});V(async()=>{i.getRecentlyPlayedItems(20).then(e=>{t.value.recently_played.items=e}),i.getLibraryArtists(void 0,void 0,20,void 0,"RANDOM()").then(e=>{t.value.artists.items=e.items,t.value.artists.count=e.total}),i.getLibraryAlbums(void 0,void 0,20,void 0,"timestamp_added DESC").then(e=>{t.value.albums.items=e.items,t.value.albums.count=e.total}),i.getRecentlyPlayedItems(10,[p.PLAYLIST]).then(e=>{t.value.playlists.items=e,i.getLibraryPlaylists(void 0,void 0,20,void 0,"timestamp_added DESC").then(l=>{t.value.playlists.count=l.total;const a=e.map(function(s){return s.name});for(const s of l.items)a.includes(s.name)||t.value.playlists.items.push(s)})}),i.getRecentlyPlayedItems(10,[p.RADIO]).then(e=>{t.value.radios.items=e,i.getLibraryRadios(void 0,void 0,20,void 0,"timestamp_added DESC").then(l=>{t.value.radios.count=l.total;const a=e.map(function(s){return s.name});for(const s of l.items)a.includes(s.name)||t.value.radios.items.push(s)})}),i.getLibraryTracks(void 0,void 0,20,void 0,"timestamp_added DESC").then(e=>{t.value.tracks.items=e.items,t.value.tracks.count=e.total}),await i.browse("",e=>{t.value.browse.items.push(...e)})});const n=function(e){L(e)&&["artist","album","playlist"].includes(e.media_type)?b.push({name:e.media_type,params:{itemId:e.item_id,provider:e.provider}}):e.media_type===p.FOLDER?b.push({name:"browse",query:{path:e.path}}):G.emit("playdialog",{items:[e],showContextMenuItems:!0})};return(e,l)=>(o(),m("div",null,[(o(!0),m(d,null,y(t.value,a=>(o(),m("div",{key:a.label},[u(N),a.items.length?(o(),m("div",F,[u(M,{color:"transparent",style:x(a.path?"cursor: pointer":""),onClick:s=>a.path?e.$router.replace(a.path):""},C({prepend:r(()=>[u(P,{icon:a.icon,style:{"margin-left":"15px"}},null,8,["icon"])]),title:r(()=>[S(g(e.$t(a.label)),1)]),_:2},[a.path?{name:"append",fn:r(()=>[a.count?(o(),v(B,{key:0,color:"grey",content:a.count},null,8,["content"])):h("",!0)]),key:"0"}:void 0]),1032,["style","onClick"]),u(O,{"show-arrows":!1},{prev:r(()=>[]),next:r(()=>[]),default:r(()=>[(o(!0),m(d,null,y(a.items,s=>(o(),v($,{key:s.uri},{default:r(()=>[u(D,{item:s,"show-checkboxes":!1,"show-track-number":!1,"is-selected":!1,style:{height:"160px",width:"120px",margin:"5px"},onClick:n},null,8,["item"])]),_:2},1024))),128))]),_:2},1024)])):h("",!0)]))),128))]))}});export{W as default};
