import{l as N,a8 as $,r as D,J as t,ai as x,b as E,w as L,ac as T,v as l,B as y,j as o,y as n,O as f,K as d,F as G,D as F,ad as I,x as _,q as c,z as g,G as M}from"./index-e5db0b73.js";import{L as j,_ as z,B as v}from"./ListItem-ac3869d3.js";import{C as O}from"./Container-238e2d02.js";import{j as R,k as h}from"./VImg-7a057c50.js";import{V as U}from"./VToolbar-4e8dded4.js";import"./VMenu-d9833a31.js";const q={style:{"margin-bottom":"10px"}},J={class:"line-clamp-1"},K={class:"line-clamp-1"},ee=N({__name:"Players",setup(S){const p=$(),r=D([]),k=t.subscribe_multi([x.PLAYER_CONFIG_UPDATED],()=>{b()});E(k);const b=async function(){r.value=(await t.getPlayerConfigs()).sort((e,s)=>m(e).localeCompare(m(s)))},C=function(e){t.removePlayerConfig(e),r.value=r.value.filter(s=>s.player_id!=e)},u=function(e){e in t.players&&p.push(`/settings/editplayer/${e}`)},P=function(e){e in t.players&&p.push("/settings/editprovider/ugp")},B=function(){p.push("/settings/editprovider/ugp")},w=function(e){e.enabled=!e.enabled,t.savePlayerConfig(e.player_id,{enabled:e.enabled})},m=function(e){var s;return e.name||((s=t.players[e.player_id])==null?void 0:s.display_name)||e.default_name||e.player_id},V=function(e){window.open(e,"_blank")};return L(()=>t.players,e=>{e&&b()},{immediate:!0}),(e,s)=>{const A=T("hold");return l(),y("div",q,[o(U,{density:"compact",class:"titlebar",color:"transparent",style:{height:"55px"}},{title:n(()=>[f(d(e.$t("settings.players")),1)]),append:n(()=>[o(R,{color:"accent",variant:"outlined",onClick:B},{default:n(()=>[f(d(e.$t("settings.add_group_player")),1)]),_:1})]),_:1}),o(O,null,{default:n(()=>[(l(!0),y(G,null,F(r.value,a=>I((l(),_(j,{key:a.player_id,link:"","context-menu-items":[{label:"settings.configure",labelArgs:[],action:()=>{u(a.player_id)},icon:"mdi-cog"},{label:"settings.edit_group_members",labelArgs:[],action:()=>{P(a.player_id)},icon:"mdi-speaker-multiple",hide:a.provider!="ugp"},{label:a.enabled?"settings.disable":"settings.enable",labelArgs:[],action:()=>{w(a)},icon:"mdi-cancel"},{label:"settings.documentation",labelArgs:[],action:()=>{V(c(t).providerManifests[a.provider].documentation)},icon:"mdi-bookshelf",disabled:!c(t).providerManifests[a.provider].documentation},{label:"settings.delete",labelArgs:[],action:()=>{C(a.player_id)},icon:"mdi-delete"}],onClick:i=>u(a.player_id)},{prepend:n(()=>[o(z,{domain:a.provider,size:40,class:"listitem-media-thumb"},null,8,["domain"])]),title:n(()=>[g("div",J,d(m(a)),1)]),subtitle:n(()=>{var i;return[g("div",K,d(((i=c(t).providers[a.provider])==null?void 0:i.name)||a.provider),1)]}),append:n(()=>{var i;return[a.enabled?(i=c(t).players[a.player_id])!=null&&i.available?M("",!0):(l(),_(v,{key:1,icon:"",title:e.$t("settings.player_not_available")},{default:n(()=>[o(h,{icon:"mdi-timer-sand"})]),_:1},8,["title"])):(l(),_(v,{key:0,icon:"",title:e.$t("settings.player_disabled")},{default:n(()=>[o(h,{icon:"mdi-cancel"})]),_:1},8,["title"]))]}),_:2},1032,["context-menu-items","onClick"])),[[A,()=>{u(a.player_id)}]])),128))]),_:1})])}}});export{ee as default};
