import{I as _}from"./ItemsListing-52fc3de5.js";import{d as y,r as n,s as m,o as f,b as e,a7 as r,a as b,c as v,e as A,M as u}from"./index-af8b7753.js";import{s as i}from"./VCheckbox-e055872e.js";import"./eventbus-3080c6de.js";import"./VListItem-0186c915.js";import"./ListItem-6ec3b906.js";import"./Button-b1542585.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./VMenu-cf6ae0bc.js";import"./VCard-4405819f.js";import"./VCardText-b2843211.js";import"./VSpacer-a83ddbc5.js";/* empty css              */import"./PanelviewItemCompact-70a213fe.js";import"./VAlert-e27964fd.js";import"./Container-736465bf.js";import"./Toolbar-cce034aa.js";import"./VList-92308f1a.js";import"./VToolbar-99429184.js";import"./VTextField-be93763f.js";import"./VCheckboxBtn-77b0c8cb.js";import"./VInfiniteScroll-c6eeb0a7.js";import"./layout-db5fa092.js";import"./VVirtualScroll-4c0c507a.js";const H=y({name:"Albums",__name:"LibraryAlbums",setup(h){const s=n(!1),o=n(m.libraryAlbumsCount),p=["name","name_desc","sort_name","sort_name_desc","year","year_desc","timestamp_added","timestamp_added_desc","last_played","last_played_desc","play_count","play_count_desc","artist_name","artist_name_desc"];f(()=>{const t=e.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],a=>{var l;(l=a.object_id)!=null&&l.startsWith("library://artist")&&(s.value=!0)});b(t)});const c=async function(t){if(t.refresh){for(e.startSync([u.ALBUM]),await i(250);e.syncTasks.value.length>0&&e.syncTasks.value.filter(a=>a.media_types.includes(u.ALBUM)).length!=0;)await i(500);await i(500)}return s.value=!1,d(t),await e.getLibraryAlbums(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},d=async function(t){if(!t.favoritesOnly){o.value=m.libraryAlbumsCount;return}o.value=await e.getLibraryAlbumsCount(t.favoritesOnly||!1)};return(t,a)=>(v(),A(_,{itemtype:"albums","show-provider":!1,"show-favorites-only-filter":!0,"load-paged-data":c,"sort-keys":p,"update-available":s.value,title:t.$t("albums"),"allow-key-hooks":!0,"show-search-button":!0,icon:"mdi-album","restore-state":!0,total:o.value},null,8,["update-available","title","total"]))}});export{H as default};
