import{I as y}from"./ItemsListing-BNJg2MyK.js";import{x as b,r as s,H as u,o as f,I as o,ag as r,b as v,y as k,z as h,M as m,aj as l}from"./index-DJHitrKX.js";import"./ItemContextMenu.vue_vue_type_style_index_0_scoped_9ca321c3_lang-_lsFI5rQ.js";import"./ProviderIcon.vue_vue_type_script_setup_true_lang-CNlAq-jT.js";import"./VListItem-12Wt-HBF.js";import"./VChip-ClDFnVJT.js";import"./VList-BX74mk0S.js";import"./VCardText-8kU2RnWJ.js";import"./VCard-CTh4pnjm.js";import"./VMenu-iVz4cckD.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./eventbus-CGRXT3Tn.js";import"./ListItem-DOz6X9XT.js";import"./VCheckbox-3aIL0vaW.js";import"./VCheckboxBtn-dAENQuo8.js";import"./VTooltip-CC0Yfw6u.js";import"./VSpacer-C1vP4eYJ.js";/* empty css              */import"./PanelviewItemCompact-UEfnScEJ.js";import"./Container-DzCq22Wj.js";import"./VContainer-BVnHxF_6.js";import"./Toolbar-DsD0yISu.js";import"./VToolbar-5UlLOvbM.js";import"./VTextField-B3QP6rDq.js";import"./VInfiniteScroll-CN_ha1Dt.js";import"./layout-DuzBpUJc.js";import"./VRow-B5X4VCpx.js";import"./VVirtualScroll-2KPgq6zI.js";import"./VAlert-DIuxfh9u.js";const V=b({name:"Audiobooks",__name:"LibraryAudiobooks",setup(A){const e=s(!1),i=s(u.libraryAudiobooksCount),p=s([]),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"],c=async function(t){if(t.refresh&&!e.value){for(o.startSync([m.PLAYLIST]),await l(250);o.syncTasks.value.length>0&&o.syncTasks.value.filter(a=>a.media_types.includes(m.PLAYLIST)).length!=0;)await l(500);await l(500)}return e.value=!1,_(t),await o.getLibraryAudiobooks(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},_=async function(t){if(!t.favoritesOnly){i.value=u.libraryAudiobooksCount;return}i.value=await o.getLibraryAudiobooksCount(t.favoritesOnly||!1)};return f(()=>{const t=o.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],a=>{var n;(n=a.object_id)!=null&&n.startsWith("library://audiobook")&&(e.value=!0)});v(t)}),(t,a)=>(k(),h(y,{itemtype:"audiobooks",path:"libraryaudiobooks","show-duration":!1,"show-provider":!0,"show-favorites-only-filter":!0,"load-paged-data":c,"show-library":!0,"sort-keys":d,"update-available":e.value,title:t.$t("audiobooks"),"allow-key-hooks":!0,"show-search-button":!0,"extra-menu-items":p.value,icon:"mdi-book-play-outline","restore-state":!0,total:i.value},null,8,["update-available","title","extra-menu-items","total"]))}});export{V as default};
