import{l as d,L as f,r as m,o as _,H as a,ao as i,b as y,v as b,x as h,M as s,ap as n}from"./index-dcf0de03.js";import{_ as v}from"./ItemsListing.vue_vue_type_style_index_0_lang-38bc2f50.js";import"./ListviewItem-2c46c8ee.js";import"./MediaItemThumb.vue_vue_type_style_index_0_lang-b38d9ae1.js";import"./ListItem-6dad7331.js";import"./VBtn-a0da5efe.js";import"./VMenu-3bdd1b96.js";import"./index-0afee102.js";import"./VListItem-943ee224.js";import"./VCheckboxBtn-d54a899d.js";import"./VCard-111cabcf.js";/* empty css                             */import"./PanelviewItem.vue_vue_type_style_index_0_lang-44df1bef.js";import"./contextmenu-ec34ccac.js";import"./eventbus-d154090d.js";import"./Alert-eb81bdeb.js";import"./Container-d623752d.js";/* empty css              */import"./VToolbar-dfba6de4.js";import"./VTextField-f81f9175.js";import"./VBadge-8be61727.js";import"./VRow-73379099.js";const z=d({__name:"LibraryRadios",setup(D){const{t:l}=f(),u=m([]),o=m(!1);_(()=>{const t=a.subscribe_multi([i.MEDIA_ITEM_ADDED,i.MEDIA_ITEM_UPDATED,i.MEDIA_ITEM_DELETED],e=>{var r;(r=e.object_id)!=null&&r.startsWith("library://radio")&&(o.value=!0)});y(t)});const p=async function(t){if(t.refresh){for(a.startSync([s.RADIO]),await n(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(e=>e.media_types.includes(s.RADIO)).length!=0;)await n(500);await n(500)}return o.value=!1,await a.getLibraryRadios(t.favoritesOnly||void 0,t.search,t.limit,t.offset,t.sortBy)},c=async function(){const t=prompt(l("enter_url"));t&&a.getItem(s.RADIO,t,"url").then(e=>{const r=prompt(l("enter_name"),e.name);e.name=r||e.name,a.addItemToLibrary(e).then(()=>o.value=!0)}).catch(e=>alert(e))};return(t,e)=>(b(),h(v,{itemtype:"radios",items:u.value,"show-duration":!1,"show-provider":!1,"show-favorites-only-filter":!0,"load-data":p,"sort-keys":["sort_name","timestamp_added DESC"],"update-available":o.value,title:t.$t("radios"),"show-search-button":!0,"allow-key-hooks":!0,"context-menu-items":[{label:"add_url_item",labelArgs:[],action:()=>{c()},icon:"mdi-link-plus"}]},null,8,["items","update-available","title","context-menu-items"]))}});export{z as default};
