import{I as _}from"./ItemsListing-08846369.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-a1b8d248.js";import{s as i}from"./VCheckbox-5797eb11.js";import"./eventbus-142801ce.js";import"./VListItem-99589506.js";import"./ListItem-8ce3726a.js";import"./Button-36db0a16.js";import"./_plugin-vue_export-helper-c27b6911.js";import"./VMenu-a4b04473.js";import"./VCard-62364c90.js";import"./VCardText-426e9876.js";import"./VSpacer-c665d1ef.js";/* empty css              */import"./PanelviewItemCompact-412c96c5.js";import"./VAlert-11c8d9d0.js";import"./Container-6ba8cd4d.js";import"./Toolbar-e7daca02.js";import"./VList-db9ad95c.js";import"./VToolbar-69b0039c.js";import"./VTextField-11675678.js";import"./VCheckboxBtn-b34ea085.js";import"./VInfiniteScroll-b88bd748.js";import"./layout-2c6f8b0d.js";import"./VVirtualScroll-abd3c2c6.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"];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};
