import{_ as f}from"./ItemsListing.vue_vue_type_style_index_0_lang-5f9be450.js";import{v as _,Q as y,r as u,o as b,L as a,al as s,b as v,y as h,z as D,x as E,M as i,am as n,K as I}from"./index-4abadf84.js";import"./ListviewItem-233411ae.js";import"./VBadge-148f67ae.js";import"./Container-cc02c26a.js";import"./forwardRefs-7da7908a.js";import"./VMenu-5b409939.js";/* empty css              */import"./VCheckboxBtn-c7727adb.js";import"./VSlideGroup-fc835928.js";import"./VCard-63dfea61.js";import"./VCardText-a4be1fd3.js";import"./VTooltip-2600ff41.js";import"./PanelviewItem.vue_vue_type_style_index_0_lang-3d5ca720.js";import"./contextmenu-c1d86d74.js";import"./Alert-3abd6204.js";import"./VToolbar-42c79991.js";import"./VTextField-ce4a0dcf.js";import"./VVirtualScroll-26a90d88.js";const V=_({__name:"LibraryRadios",setup(k){const{t:l}=y(),p=u([]),o=u(!1),m={name:"sort_name",recent:"timestamp_added DESC"};b(()=>{const e=a.subscribe_multi([s.MEDIA_ITEM_ADDED,s.MEDIA_ITEM_UPDATED,s.MEDIA_ITEM_DELETED],t=>{var r;(r=t.object_id)!=null&&r.startsWith("library://radio")&&(o.value=!0)});v(e)});const c=async function(e){if(e.refresh&&!o.value){for(a.startSync([i.RADIO]),await n(250);a.syncTasks.value.length>0&&a.syncTasks.value.filter(t=>t.media_types.includes(i.RADIO)).length!=0;)await n(500);await n(500)}return o.value=!1,await a.getLibraryRadios(e.favoritesOnly||void 0,e.search,e.limit,e.offset,m[e.sortBy])},d=async function(){const e=prompt(l("enter_url"));e&&a.getItem(i.RADIO,e,"url").then(t=>{const r=prompt(l("enter_name"),t.name);t.name=r||t.name,a.addItemToLibrary(t).then(()=>o.value=!0)}).catch(t=>alert(t))};return(e,t)=>(h(),D(f,{itemtype:"radios",items:p.value,"show-duration":!1,"show-provider":!1,"show-favorites-only-filter":!0,"load-paged-data":c,"sort-keys":Object.keys(m),"update-available":o.value,title:E(I)("bp4")?e.$t("radios"):"","show-search-button":!0,"allow-key-hooks":!0,"context-menu-items":[{label:"add_url_item",labelArgs:[],action:()=>{d()},icon:"mdi-link-plus"}]},null,8,["items","sort-keys","update-available","title","context-menu-items"]))}});export{V as default};
