import{I as f}from"./ItemsListing-BxIggw9V.js";import{x as v,r as l,H as p,o as b,I as a,ah as n,b as D,y as h,D as E,n as d,G as I,F as w,M as m,ak as u}from"./index-Dvn4b3kE.js";import{_ as A}from"./AddManualLink.vue_vue_type_script_setup_true_lang-BujK_7Tz.js";import"./ItemContextMenu.vue_vue_type_style_index_0_scoped_3a9a25e3_lang-C3noc3qK.js";import"./ProviderIcon.vue_vue_type_style_index_0_lang-CxRRSRNY.js";import"./VListItem-XlHdRn90.js";import"./VChip-BKGA7XXZ.js";import"./VList-BFxH2oe3.js";import"./VMenu-BxZEtUbH.js";import"./VCard-DDEjK8sh.js";import"./VCardText-CXkKR7ML.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./eventbus-CGRXT3Tn.js";import"./ListItem-CqruFv9t.js";import"./VCheckbox-DXoKCkvo.js";import"./VCheckboxBtn-B2R62I44.js";import"./VSpacer-BpjLI35r.js";/* empty css              */import"./PanelviewItemCompact-CceVDOrI.js";import"./Container-DWavih6c.js";import"./VContainer-C3X0IHcx.js";import"./Toolbar-XsObLWPI.js";import"./VToolbar-Bi9Fkevh.js";import"./VTextField-CNfw_aKz.js";import"./VInfiniteScroll-DgELJAW0.js";import"./layout-BesXh2w9.js";import"./VRow-PHUs5bQJ.js";import"./VVirtualScroll-DezxvIhI.js";import"./VAlert-BKHMgC3s.js";import"./VDialog-CHkPjb9d.js";const at=v({name:"Radios",__name:"LibraryRadios",setup(T){const o=l(!1),s=l(p.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 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){s.value=p.libraryRadiosCount;return}s.value=await a.getLibraryRadiosCount(t.favoritesOnly||!1)};return(t,e)=>(h(),E(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{at as default};
