import{l as $,a6 as C,r as M,w,v as i,A as f,j as s,y as o,q as t,N as d,J as r,I as n,D as u,x as p,H as l}from"./index-dcf0de03.js";import{V as N,_ as B}from"./EditConfig.vue_vue_type_style_index_0_lang-80768ce3.js";import{c as I,b as m,V as S}from"./VCard-111cabcf.js";import{b as g}from"./VMenu-3bdd1b96.js";import{V as T}from"./VTextField-f81f9175.js";import"./VExpansionPanel-286d9c63.js";import"./VCheckboxBtn-d54a899d.js";import"./index-0afee102.js";import"./VBtn-a0da5efe.js";import"./VListItem-943ee224.js";import"./VSpacer-4e341220.js";import"./VDialog-ccbfddc9.js";const D={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},P=["href"],j=n("br",null,null,-1),E=n("br",null,null,-1),U=n("br",null,null,-1),q=n("br",null,null,-1),X=$({__name:"EditPlayer",props:{playerId:{}},setup(V){const _=V,h=C(),e=M();w(()=>_.playerId,async a=>{a&&(e.value=await l.getPlayerConfig(a))},{immediate:!0});const k=async function(a){a.enabled=e.value.enabled,a.name=e.value.name||null,l.savePlayerConfig(_.playerId,a),h.push({name:"playersettings"})};return(a,v)=>(i(),f("section",null,[s(S,null,{default:o(()=>{var b,c;return[e.value&&e.value.provider in t(l).providerManifests?(i(),f("div",D,[s(I,null,{default:o(()=>[d(r(a.$t("settings.config_player",[e.value.name||t(l).players[e.value.player_id].name])),1)]),_:1}),s(m,null,{default:o(()=>[n("b",null,r(a.$t("settings.player_id"))+": ",1),d(r(e.value.player_id),1)]),_:1}),s(m,null,{default:o(()=>[n("b",null,r(a.$t("settings.player_provider"))+": ",1),d(r(t(l).providerManifests[e.value.provider].name)+" ( "+r(t(l).providerManifests[e.value.provider].description)+") ",1),t(l).providerManifests[e.value.provider].documentation?(i(),f("a",{key:0,href:t(l).providerManifests[e.value.provider].documentation,target:"_blank"},r(a.$t("settings.check_docs")),9,P)):u("",!0)]),_:1}),t(l).players[e.value.player_id]?(i(),p(m,{key:0},{default:o(()=>[n("b",null,r(a.$t("settings.player_model"))+": ",1),d(r(t(l).players[e.value.player_id].device_info.manufacturer)+" / "+r(t(l).players[e.value.player_id].device_info.model),1)]),_:1})):u("",!0),t(l).players[e.value.player_id]?(i(),p(m,{key:1},{default:o(()=>[n("b",null,r(a.$t("settings.player_address"))+": ",1),d(r(t(l).players[e.value.player_id].device_info.address),1)]),_:1})):u("",!0),s(m,null,{default:o(()=>[n("b",null,r(a.$t("settings.player_type_label"))+": ",1),d(r(a.$t(`player_type.${t(l).players[e.value.player_id].type}`)),1)]),_:1}),j,s(g),E,U,"name"in e.value?(i(),p(T,{key:2,modelValue:e.value.name,"onUpdate:modelValue":v[0]||(v[0]=y=>e.value.name=y),placeholder:(b=e.value)==null?void 0:b.name,label:a.$t("settings.player_name"),variant:"outlined",clearable:""},null,8,["modelValue","placeholder","label"])):u("",!0),"enabled"in e.value?(i(),p(N,{key:3,modelValue:e.value.enabled,"onUpdate:modelValue":v[1]||(v[1]=y=>e.value.enabled=y),label:a.$t("settings.enable_player"),color:"primary",disabled:(c=t(l).providerManifests[e.value.provider])==null?void 0:c.builtin},null,8,["modelValue","label","disabled"])):u("",!0)])):u("",!0),q,s(g),e.value?(i(),p(B,{key:1,disabled:!e.value.enabled,"config-entries":Object.values(e.value.values),onSubmit:k},null,8,["disabled","config-entries"])):u("",!0)]}),_:1})]))}});export{X as default};
