import{I as f}from"./ItemsListing-CHZs9N6z.js";import{a7 as b,bp as v,F as o,a6 as u,L as h,ap as s,ar as E,aN as r,N as I,ai as w,a9 as P}from"./index-CFcIX8RO.js";import"./Container-iGBsqgnx.js";import"./index-kQIztB-E.js";import"./Toolbar-DambSy-S.js";import"./VToolbar-B_3_MVxk.js";import"./Button-IxLZkOI0.js";import"./ListItem-CWPLlf7K.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-CGTv89Z9.js";import"./VCheckboxBtn-Dy9mjR59.js";import"./MediaItemThumb-oOnMmU-2.js";import"./PanelviewItemCompact-YHP34gKS.js";import"./VInfiniteScroll-DY-7nfIB.js";import"./VVirtualScroll-BRrQ8Y7O.js";import"./VAlert-DZurr_D6.js";const R=b({name:"Playlists",__name:"LibraryPlaylists",setup(D){const{t:c}=v(),l=o(!1),i=o(u.libraryPlaylistsCount),n=o([]),m=["name","name_desc","sort_name","sort_name_desc","timestamp_added","timestamp_added_desc","timestamp_modified","timestamp_modified_desc","last_played","last_played_desc","play_count","play_count_desc"],y=async function(t){return l.value=!1,d(t),await s.getLibraryPlaylists(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},d=async function(t){if(!t.favoritesOnly){i.value=u.libraryPlaylistsCount;return}i.value=await s.getLibraryPlaylistsCount(t.favoritesOnly||!1)};h(()=>{const t=[];for(const e of Object.values(s.providers).filter(p=>p.available&&p.supported_features.includes(E.PLAYLIST_CREATE)))t.push({label:"create_playlist_on",labelArgs:[e.name],action:()=>{_(e.instance_id)},icon:"mdi-playlist-plus"});t.length&&n.value.push({label:"create_playlist_on",icon:"mdi-playlist-plus",subItems:t});const a=s.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],e=>{e.object_id?.startsWith("library://playlist")&&(l.value=!0)});I(a)});const _=async function(t){const a=prompt(c("new_playlist_name"));a&&await s.createPlaylist(a,t).then(()=>location.reload()).catch(e=>alert(e))};return(t,a)=>(P(),w(f,{itemtype:"playlists",path:"libraryplaylists","show-duration":!1,"show-provider":!0,"show-favorites-only-filter":!0,"load-paged-data":y,"show-library":!0,"sort-keys":m,"update-available":l.value,title:t.$t("playlists"),"allow-key-hooks":!0,"show-search-button":!0,"extra-menu-items":n.value,icon:"mdi-playlist-play","restore-state":!0,total:i.value},null,8,["update-available","title","extra-menu-items","total"]))}});export{R as default};
