import{I as y}from"./ItemsListing-D0RDJqR8.js";import{d as v,r as l,s as d,o as b,b as a,a7 as n,a as D,c as E,h,f as p,u as w,F as I,M as m}from"./index-CQHe9KB5.js";import{_ as A}from"./AddManualLink.vue_vue_type_script_setup_true_lang-D3KxdP2m.js";import{s as u}from"./VCheckbox-_eVssUuR.js";import"./eventbus-CxBHXMjo.js";import"./VListItem-932LEcae.js";import"./ListItem-BlTvbW6N.js";import"./Button-C2tPqXAJ.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./VMenu-C_g4AWFG.js";import"./VCard-BBArKN8n.js";import"./VCardText-BC98CPwQ.js";import"./VSpacer-BB-V2OH5.js";/* empty css              */import"./PanelviewItemCompact-C9xC4OzX.js";import"./VAlert-CgwdfNK_.js";import"./Container-D0GZf7eO.js";import"./Toolbar-Bxz1a-Vc.js";import"./VToolbar-AihbUtg2.js";import"./VList-SeV0eskX.js";import"./VTextField-DJj81lxi.js";import"./VCheckboxBtn-WpBm-DQx.js";import"./VInfiniteScroll-tYOoNmCo.js";import"./layout-BxB_31nW.js";import"./VVirtualScroll-qRehF0qb.js";import"./VDialog-pSjwSbGd.js";const Y=v({name:"Radios",__name:"LibraryRadios",setup(T){const o=l(!1),i=l(d.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 s;(s=e.object_id)!=null&&s.startsWith("library://radio")&&(o.value=!0)});D(t)});const f=async function(t){if(t.refresh&&!o.value){for(a.startSync([m.RADIO]),await u(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(e=>e.media_types.includes(m.RADIO)).length!=0;)await u(500);await u(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){i.value=d.libraryRadiosCount;return}i.value=await a.getLibraryRadiosCount(t.favoritesOnly||!1)};return(t,e)=>(E(),h(I,null,[p(y,{itemtype:"radios","show-duration":!1,"show-provider":!1,"show-favorites-only-filter":!0,"load-paged-data":f,"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:i.value},null,8,["update-available","title","extra-menu-items","total"]),p(A,{modelValue:r.value,"onUpdate:modelValue":e[0]||(e[0]=s=>r.value=s),type:w(m).RADIO},null,8,["modelValue","type"])],64))}});export{Y as default};
