import{g as b,l as f,r as k,o as V,J as l,M as p,v as o,B as r,F as d,D as y,j as m,y as u,x as v,z as C,K as h,A as g,G as S,U as _}from"./index-a9406375.js";import{_ as D}from"./PanelviewItem.vue_vue_type_style_index_0_lang-d3692f9a.js";import{i as x,e as L}from"./contextmenu-4c94374f.js";import{x as G,y as A,V as B,k as E}from"./VImg-587dd6c1.js";import{V as N}from"./VBadge-7bedf590.js";import{V as P}from"./VToolbar-302db6bb.js";import{V as M,a as $}from"./VSlideGroup-68a8434e.js";import"./ListItem-4d766283.js";import"./VMenu-c481067f.js";import"./VTooltip-272de438.js";import"./VCheckboxBtn-75d17b72.js";import"./VCard-9c841067.js";const T=b()({name:"VSlideGroupItem",props:G(),emits:{"group:selected":c=>!0},setup(c,t){let{slots:n}=t;const e=A(c,M);return()=>{var i;return(i=n.default)==null?void 0:i.call(n,{isSelected:e.isSelected.value,select:e.select,toggle:e.toggle,selectedClass:e.selectedClass.value})}}}),F={key:0,class:"widget-row"},O={class:"mr-3"},z={key:1,class:"mr-3"},Z=f({__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()=>{l.getRecentlyPlayedItems(20).then(e=>{t.value.recently_played.items=e}),l.getLibraryArtists(void 0,void 0,20,void 0,"RANDOM()").then(e=>{t.value.artists.items=e.items,t.value.artists.count=e.total}),l.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}),l.getRecentlyPlayedItems(10,[p.PLAYLIST]).then(e=>{t.value.playlists.items=e,l.getLibraryPlaylists(void 0,void 0,20,void 0,"timestamp_added DESC").then(i=>{t.value.playlists.count=i.total;const s=e.map(function(a){return a.name});for(const a of i.items)s.includes(a.name)||t.value.playlists.items.push(a)})}),l.getRecentlyPlayedItems(10,[p.RADIO]).then(e=>{t.value.radios.items=e,l.getLibraryRadios(void 0,void 0,20,void 0,"timestamp_added DESC").then(i=>{t.value.radios.count=i.total;const s=e.map(function(a){return a.name});for(const a of i.items)s.includes(a.name)||t.value.radios.items.push(a)})}),l.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 l.browse("",e=>{t.value.browse.items.push(...e)})});const n=function(e){x(e)&&["artist","album","playlist"].includes(e.media_type)?_.push({name:e.media_type,params:{itemId:e.item_id,provider:e.provider}}):e.media_type===p.FOLDER?_.push({name:"browse",query:{path:e.path}}):L.emit("playdialog",{items:[e],showContextMenuItems:!0})};return(e,i)=>(o(),r("div",null,[(o(!0),r(d,null,y(t.value,s=>(o(),r("div",{key:s.label},[m(B),s.items.length?(o(),r("div",F,[m(P,{color:"transparent",style:g(s.path?"cursor: pointer":""),onClick:a=>s.path?e.$router.replace(s.path):""},{prepend:u(()=>[m(E,{icon:s.icon,style:{"margin-left":"15px"}},null,8,["icon"])]),title:u(()=>[s.count?(o(),v(N,{key:0,inline:"",color:"grey",content:s.count},{default:u(()=>[C("span",O,h(e.$t(s.label)),1)]),_:2},1032,["content"])):(o(),r("span",z,h(e.$t(s.label)),1))]),_:2},1032,["style","onClick"]),m($,{"show-arrows":""},{default:u(()=>[(o(!0),r(d,null,y(s.items,a=>(o(),v(T,{key:a.uri},{default:u(()=>[m(D,{item:a,"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)])):S("",!0)]))),128))]))}});export{Z as default};
