import{I as y}from"./ItemsListing-HGPehT6Y.js";import{d as _,r as n,s as m,o as b,b as e,a9 as s,a as f,c as v,e as A,M as u,ad as r}from"./index-BcUYXcPq.js";import"./ItemContextMenu.vue_vue_type_style_index_0_scoped_85c6bb69_lang-CQtpREte.js";import"./ProviderIcon.vue_vue_type_script_setup_true_lang-B54PMsCQ.js";import"./VListItem-DC0X47Q4.js";import"./VCheckboxBtn-DvMOQpng.js";import"./VList-BKlimdrv.js";import"./VCardText-D-aWL0fz.js";import"./VCard-Dx-t9yLE.js";import"./VMenu-7bd_kTRb.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./eventbus-CGRXT3Tn.js";import"./ListItem-Cq4V-Lz8.js";import"./Button-70QbWoUa.js";import"./VCheckbox-BEPbmvTc.js";import"./VSpacer-G9Q32ju2.js";/* empty css              */import"./PanelviewItemCompact-w04R_lVh.js";import"./VAlert-DbYDqcUs.js";import"./Container-BixSAZes.js";import"./VContainer-CoH7hbKx.js";import"./Toolbar-CtV0cu85.js";import"./VToolbar-B-HEXsGH.js";import"./VTextField-rtqk6KCF.js";import"./VInfiniteScroll-BVPAk5NO.js";import"./layout-B1VfN3Kd.js";import"./VRow-CBTscIT0.js";import"./VVirtualScroll-BfIwRbDJ.js";const R=_({name:"Albums",__name:"LibraryAlbums",setup(h){const o=n(!1),i=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"];b(()=>{const t=e.subscribe_multi([s.MEDIA_ITEM_ADDED,s.MEDIA_ITEM_UPDATED,s.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([u.ALBUM]),await r(250);e.syncTasks.value.length>0&&e.syncTasks.value.filter(a=>a.media_types.includes(u.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){i.value=m.libraryAlbumsCount;return}i.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:i.value,"show-album-type-filter":!0},null,8,["update-available","title","total"]))}});export{R as default};
