import{l as w,I as A,r as B,O as t,af as N,b as L,w as D,a9 as E,q as o,v as r,x as n,y as V,z as $,F as x,Q as I,A as d,j as p,L as m,N as _,M as F}from"./index-e9211ef1.js";import{C as M,L as T,a as z}from"./Container-349a0ac0.js";import{B as b}from"./Button-59559304.js";import{V as f}from"./VBtn-68784d55.js";import"./VMenu-bc0cce60.js";import"./VDivider-336c24cd.js";import"./VListItem-230d1393.js";/* empty css              */const O={class:"line-clamp-1"},R={class:"line-clamp-1"},K=w({__name:"Players",setup(U){const y=A(),s=B([]);console.log(s);const v=t.subscribe_multi([N.PLAYER_CONFIG_UPDATED],()=>{u()});L(v);const u=async function(){s.value=await t.getPlayerConfigs()},g=function(e){t.removePlayerConfig(e),s.value=s.value.filter(l=>l.player_id!=e)},c=function(e){e in t.players&&y.push(`/settings/editplayer/${e}`)},k=function(e){e.enabled=!e.enabled,t.savePlayerConfig(e.player_id,{enabled:e.enabled})},h=function(e){var l;return e.name||((l=t.players[e.player_id])==null?void 0:l.display_name)||e.default_name||e.player_id},C=function(e){window.open(e,"_blank")};return D(()=>t.players,e=>{e&&u()},{immediate:!0}),(e,l)=>{const P=E("hold");return o(),r(M,null,{default:n(()=>[(o(!0),V(x,null,$(s.value,a=>I((o(),r(T,{key:a.player_id,link:"",onClick:i=>c(a.player_id),"context-menu-items":[{label:"settings.configure",labelArgs:[],action:()=>{c(a.player_id)},icon:"mdi-cog"},{label:a.enabled?"settings.disable":"settings.enable",labelArgs:[],action:()=>{k(a)},icon:"mdi-cancel"},{label:"settings.documentation",labelArgs:[],action:()=>{C(d(t).providerManifests[a.provider].documentation)},icon:"mdi-bookshelf",disabled:!d(t).providerManifests[a.provider].documentation},{label:"settings.delete",labelArgs:[],action:()=>{g(a.player_id)},icon:"mdi-delete"}]},{prepend:n(()=>[p(z,{domain:a.provider,size:40,class:"listitem-media-thumb"},null,8,["domain"])]),title:n(()=>[m("div",O,_(h(a)),1)]),subtitle:n(()=>{var i;return[m("div",R,_(((i=d(t).providers[a.provider])==null?void 0:i.name)||a.provider),1)]}),append:n(()=>{var i;return[a.enabled?(i=d(t).players[a.player_id])!=null&&i.available?F("",!0):(o(),r(b,{key:1,icon:"",title:e.$t("settings.player_not_available")},{default:n(()=>[p(f,{icon:"mdi-timer-sand"})]),_:1},8,["title"])):(o(),r(b,{key:0,icon:"",title:e.$t("settings.player_disabled")},{default:n(()=>[p(f,{icon:"mdi-cancel"})]),_:1},8,["title"]))]}),_:2},1032,["onClick","context-menu-items"])),[[P,()=>{c(a.player_id)}]])),128))]),_:1})}}});export{K as default};
