import{I as f}from"./ItemsListing-XUXN-Um6.js";import{d as v,bx as b,r as l,s as m,v as e,M as h,m as I,P as w,a$ as r,q as E,h as P,o as T}from"./index-Bn2Tzsay.js";import"./Container-CEbFgC5b.js";import"./index-CBho6rsP.js";import"./VContainer-CRIwFZfO.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./Toolbar-Ba4dAxS1.js";import"./VToolbar-Z0nE2qFc.js";import"./VBtn-BQk37KYJ.js";import"./Button-r9Wpw3CQ.js";import"./ListItem-BNbxxrdg.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-DCLVCnPO.js";import"./VInput-C_1AW61Q.js";import"./MediaItemThumb-B7hfZSf2.js";import"./PanelviewItemCompact-By5cXXTW.js";import"./VSpacer-ygjaGObn.js";import"./VTextField-fPA0WAHx.js";import"./VInfiniteScroll-DvbiA0kw.js";import"./layout-kFqKNtL6.js";import"./VRow-CNVApy9v.js";import"./VVirtualScroll-B56qZ1Y0.js";import"./VAlert-Bj5fXNhB.js";const N=v({name:"Playlists",__name:"LibraryPlaylists",setup(A){const{t:u}=b(),i=l(!1),o=l(m.libraryPlaylistsCount),n=l([{label:"sync_now",icon:"mdi-sync",action:()=>{e.startSync([h.PLAYLIST])},overflowAllowed:!0,disabled:e.syncTasks.value.length>0}]),c=["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 i.value=!1,d(t),await e.getLibraryPlaylists(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},d=async function(t){if(!t.favoritesOnly){o.value=m.libraryPlaylistsCount;return}o.value=await e.getLibraryPlaylistsCount(t.favoritesOnly||!1)};I(()=>{const t=[];for(const a of Object.values(e.providers).filter(p=>p.available&&p.supported_features.includes(w.PLAYLIST_CREATE)))t.push({label:"create_playlist_on",labelArgs:[a.name],action:()=>{_(a.instance_id)},icon:"mdi-playlist-plus"});t.length&&n.value.push({label:"create_playlist_on",icon:"mdi-playlist-plus",subItems:t});const s=e.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],a=>{a.object_id?.startsWith("library://playlist")&&(i.value=!0)});E(s)});const _=async function(t){const s=prompt(u("new_playlist_name"));s&&await e.createPlaylist(s,t).then(()=>location.reload()).catch(a=>alert(a))};return(t,s)=>(T(),P(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":c,"update-available":i.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:o.value},null,8,["update-available","title","extra-menu-items","total"]))}});export{N as default};
