import{I as f}from"./ItemsListing-D6AMqIYc.js";import{s as p,c as i,P as v,E as r}from"./index-CxiRlsCY.js";import{d as b,r as l,o as h,a0 as w,D as E,e as I,u as P,au as A}from"./lucide-C2DU1LFb.js";import{u as D}from"./vue-i18n-DySrp6mW.js";import"./Container-CwfZ2VgM.js";import"./index-kQIztB-E.js";import"./vuetify-RelkxOq-.js";import"./utils-CDN07tui.js";import"./Toolbar-MwYpbj3t.js";import"./userPreferences-ln7cf3P6.js";import"./vue-router-BgJK_hRC.js";import"./Button-DBt8j7D4.js";import"./ListItem-DzUpG5Dm.js";import"./NowPlayingBadge.vue_vue_type_style_index_0_lang-D7lqdhVg.js";import"./MediaItemThumb-C7OhU3lK.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-C17dV9_V.js";import"./PanelviewItemCompact-Cjl_ij1h.js";import"./qrcode-DSFhiIp2.js";import"./marked-C0Rlrcoy.js";import"./color-BTziYnFN.js";import"./vueuse-DIaEWNCo.js";/* empty css            */import"./swiper-Jy9GbtzK.js";const Q=b({name:"Playlists",__name:"LibraryPlaylists",setup(L){const{t:c}=D(),s=l(!1),a=l(p.libraryPlaylistsCount),n=l([]),d=["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"],m=async function(t){return s.value=!1,y(t),await i.getLibraryPlaylists(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy,t.provider&&t.provider.length>0?t.provider:void 0)},y=async function(t){if(!t.favoritesOnly&&!t.provider){a.value=p.libraryPlaylistsCount;return}if(t.provider&&t.provider.length>0){a.value=void 0;return}a.value=await i.getLibraryPlaylistsCount(t.favoritesOnly||!1)};h(()=>{const t=[];for(const e of Object.values(i.providers).filter(u=>u.available&&u.supported_features.includes(v.PLAYLIST_CREATE)))t.push({label:"create_playlist_on",labelArgs:[e.name],action:()=>{_(e.instance_id)},icon:"mdi-playlist-plus",overflowAllowed:!0});t.length&&n.value.push({label:"create_playlist_on",icon:"mdi-playlist-plus",subItems:t,overflowAllowed:!0});const o=i.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],e=>{e.object_id?.startsWith("library://playlist")&&(s.value=!0)});w(o)});const _=async function(t){const o=prompt(c("new_playlist_name"));o&&await i.createPlaylist(o,t).then(()=>location.reload()).catch(e=>alert(e))};return(t,o)=>(I(),E(f,{itemtype:"playlists",path:"libraryplaylists","show-duration":!1,"show-provider":!0,"show-favorites-only-filter":!0,"load-paged-data":m,"show-library":!0,"sort-keys":d,"update-available":s.value,title:t.$t("playlists"),"allow-key-hooks":!0,"show-search-button":!0,"extra-menu-items":n.value,icon:P(A),"restore-state":!0,total:a.value,"show-provider-filter":!0},null,8,["update-available","title","extra-menu-items","icon","total"]))}});export{Q as default};
