import{I as f}from"./ItemsListing-BGUL9QyB.js";import{x as y,r as i,H as m,o as v,I as e,af as r,b,y as h,z as I,M as p,aj as n}from"./index-CFvoaD7J.js";import"./ItemContextMenu.vue_vue_type_style_index_0_scoped_4409cede_lang-41DbVClm.js";import"./ProviderIcon.vue_vue_type_script_setup_true_lang-Ji67J6Pu.js";import"./VListItem-CSPID7yq.js";import"./VChip-Ccz1-bmn.js";import"./VList-fGk9SRdf.js";import"./VCardText-CpOuj25H.js";import"./VCard-DxLPF-Ra.js";import"./VMenu-9pSrU4Fo.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./eventbus-CGRXT3Tn.js";import"./ListItem-nYGtvGaY.js";import"./VCheckbox-B5r7QKHZ.js";import"./VCheckboxBtn-CRgZyCzV.js";import"./VTooltip-DC73AT2B.js";import"./VSpacer-UYEiyhN7.js";/* empty css              */import"./PanelviewItemCompact-BQIsDE0n.js";import"./Container-BDz3QMuX.js";import"./VContainer-CzfHAKpA.js";import"./Toolbar-DNen7a-V.js";import"./VToolbar-Da4d1W_R.js";import"./VTextField-DF4u_eMy.js";import"./VInfiniteScroll-D1yVLjQf.js";import"./layout-BeGdxe2Y.js";import"./VRow-BC1No8oB.js";import"./VVirtualScroll-BDBVEoUv.js";import"./VAlert-CIiIOQza.js";const V=y({name:"Podcasts",__name:"LibraryPodcasts",setup(w){const a=i(!1),s=i(m.libraryPodcastsCount),d=i([]),u=["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&&!a.value){for(e.startSync([p.PLAYLIST]),await n(250);e.syncTasks.value.length>0&&e.syncTasks.value.filter(o=>o.media_types.includes(p.PLAYLIST)).length!=0;)await n(500);await n(500)}return a.value=!1,_(t),await e.getLibraryPodcasts(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},_=async function(t){if(!t.favoritesOnly){s.value=m.libraryPodcastsCount;return}s.value=await e.getLibraryPodcastsCount(t.favoritesOnly||!1)};return v(()=>{const t=e.subscribe_multi([r.MEDIA_ITEM_ADDED,r.MEDIA_ITEM_UPDATED,r.MEDIA_ITEM_DELETED],o=>{var l;(l=o.object_id)!=null&&l.startsWith("library://podcast")&&(a.value=!0)});b(t)}),(t,o)=>(h(),I(f,{itemtype:"podcasts","show-duration":!1,"show-provider":!0,"show-favorites-only-filter":!0,"load-paged-data":c,"show-library":!0,"sort-keys":u,"update-available":a.value,title:t.$t("podcasts"),"allow-key-hooks":!0,"show-search-button":!0,"extra-menu-items":d.value,icon:"mdi-podcast","restore-state":!0,total:s.value},null,8,["update-available","title","extra-menu-items","total"]))}});export{V as default};
