import{l as $,a3 as C,r as M,w,y as i,I as f,j as s,A as o,x as t,R as d,N as r,D as n,H as u,z as p,L as l}from"./index-d8f9df52.js";import{V as N,_ as B}from"./EditConfig.vue_vue_type_style_index_0_lang-30c9d211.js";import{c as I,b as m,V as S}from"./VCard-45095a4d.js";import{V as g}from"./VImg-4a7a1cb8.js";import{V as T}from"./VTextField-98808566.js";import"./VExpansionPanel-eb4e2247.js";import"./VCheckboxBtn-a71f5d8b.js";import"./VMenu-7da753a3.js";import"./VVirtualScroll-fd913adb.js";import"./VSpacer-364ca978.js";import"./VDialog-c52f4549.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),R=n("br",null,null,-1),U=n("br",null,null,-1),W=$({__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 c,b;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,R,"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:(c=e.value)==null?void 0:c.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:(b=t(l).providerManifests[e.value.provider])==null?void 0:b.builtin},null,8,["modelValue","label","disabled"])):u("",!0)])):u("",!0),U,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{W as default};
