import{I as y}from"./ItemsListing-D0_QSUgh.js";import{d as _,r as n,s as u,o as b,b as e,a9 as i,a as f,c as v,e as A,M as m,ad as r}from"./index-Dh8vTPrL.js";import"./VCheckbox-BHLOyC9w.js";import"./eventbus-Bx0SmCX1.js";import"./VListItem-BiYBTZ39.js";import"./VCheckboxBtn-CNxrFD70.js";import"./VList-3zZGcDKM.js";import"./VCardText-BRzAu4nY.js";import"./VCard-DBrKNDRb.js";import"./VMenu-bkp9FdIZ.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ListItem-BrzlQzsJ.js";import"./Button-uBTEHpd0.js";import"./VSpacer-ByaMfX_d.js";/* empty css              */import"./PanelviewItemCompact-Dp_kpJNm.js";import"./VAlert-6B6_WW_o.js";import"./Container-CJnP1AXv.js";import"./Toolbar-DtRA5hwR.js";import"./VToolbar-BUh6HJIk.js";import"./VTextField-Dm45LZPf.js";import"./VInfiniteScroll-BuVahgbA.js";import"./layout-Dlul22en.js";import"./VVirtualScroll-BqfdfU30.js";const H=_({name:"Albums",__name:"LibraryAlbums",setup(h){const o=n(!1),s=n(u.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"];b(()=>{const t=e.subscribe_multi([i.MEDIA_ITEM_ADDED,i.MEDIA_ITEM_UPDATED,i.MEDIA_ITEM_DELETED],a=>{var l;(l=a.object_id)!=null&&l.startsWith("library://artist")&&(o.value=!0)});f(t)});const c=async function(t){if(t.refresh){for(e.startSync([m.ALBUM]),await r(250);e.syncTasks.value.length>0&&e.syncTasks.value.filter(a=>a.media_types.includes(m.ALBUM)).length!=0;)await r(500);await r(500)}return o.value=!1,d(t),await e.getLibraryAlbums(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy,t.albumType)},d=async function(t){if(!t.favoritesOnly&&!t.albumType){s.value=u.libraryAlbumsCount;return}s.value=await e.getLibraryAlbumsCount(t.favoritesOnly||void 0,t.albumType||void 0)};return(t,a)=>(v(),A(y,{itemtype:"albums","show-provider":!1,"show-favorites-only-filter":!0,"load-paged-data":c,"sort-keys":p,"update-available":o.value,title:t.$t("albums"),"allow-key-hooks":!0,"show-search-button":!0,icon:"mdi-album","restore-state":!0,total:s.value,"show-album-type-filter":!0},null,8,["update-available","title","total"]))}});export{H as default};
