import{I as f}from"./ItemsListing-Cd5IBPUO.js";import{x as v,r as l,H as u,o as b,I as a,ag as n,b as D,y as E,D as h,n as d,G as I,F as w,M as m,aj as p}from"./index-DuDRe8hE.js";import{_ as A}from"./AddManualLink.vue_vue_type_script_setup_true_lang-CCTeV53K.js";import"./ItemContextMenu.vue_vue_type_style_index_0_scoped_ea20d839_lang-Cfo9s-Sj.js";import"./ProviderIcon.vue_vue_type_script_setup_true_lang-CHFYJo9W.js";import"./VListItem-CuoSvcqW.js";import"./VChip-BRQkwjNJ.js";import"./VList-BlpguAX2.js";import"./VCardText-Dn8Yf3BC.js";import"./VCard-Cf5RelEw.js";import"./VMenu-B49kEbTj.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./eventbus-CGRXT3Tn.js";import"./ListItem-xrpNnThP.js";import"./VCheckbox-DBOdVsut.js";import"./VCheckboxBtn-CMIUd74V.js";import"./VTooltip-aHjUkPs6.js";import"./VSpacer-CYzCqmAo.js";/* empty css              */import"./PanelviewItemCompact-BQvk3oJ_.js";import"./Container-CQhyPPl2.js";import"./VContainer-CCoTeKDA.js";import"./Toolbar-CibNv11m.js";import"./VToolbar-Dhcm-C4i.js";import"./VTextField-D5EFKWzi.js";import"./VInfiniteScroll-BaRPR-8K.js";import"./layout-qserhqCM.js";import"./VRow-C-co90yO.js";import"./VVirtualScroll-CdwGYB7u.js";import"./VAlert-sqJ4UeFM.js";import"./VDialog-BsvLwk-0.js";const ot=v({name:"Radios",__name:"LibraryRadios",setup(g){const o=l(!1),s=l(u.libraryRadiosCount),r=l(!1),c=["name","name_desc","sort_name","sort_name_desc","timestamp_added","timestamp_added_desc","last_played","last_played_desc","play_count","play_count_desc"];b(()=>{const t=a.subscribe_multi([n.MEDIA_ITEM_ADDED,n.MEDIA_ITEM_UPDATED,n.MEDIA_ITEM_DELETED],e=>{var i;(i=e.object_id)!=null&&i.startsWith("library://radio")&&(o.value=!0)});D(t)});const y=async function(t){if(t.refresh&&!o.value){for(a.startSync([m.RADIO]),await p(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(e=>e.media_types.includes(m.RADIO)).length!=0;)await p(500);await p(500)}return o.value=!1,_(t),await a.getLibraryRadios(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},_=async function(t){if(!t.favoritesOnly){s.value=u.libraryRadiosCount;return}s.value=await a.getLibraryRadiosCount(t.favoritesOnly||!1)};return(t,e)=>(E(),h(w,null,[d(f,{itemtype:"radios",path:"libraryradios","show-duration":!1,"show-provider":!1,"show-favorites-only-filter":!0,"load-paged-data":y,"sort-keys":c,"update-available":o.value,title:t.$t("radios"),"show-search-button":!0,"allow-key-hooks":!0,"extra-menu-items":[{label:"add_url_item",labelArgs:[],action:()=>{r.value=!0},icon:"mdi-playlist-plus"}],icon:"mdi-access-point","restore-state":!0,total:s.value},null,8,["update-available","title","extra-menu-items","total"]),d(A,{modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=i=>r.value=i),type:I(m).RADIO},null,8,["modelValue","type"])],64))}});export{ot as default};
