import{l as $,I as C,r as M,w,q as i,y as f,j as s,x as o,A as t,K as d,N as r,L as n,M as u,v as p,O as a}from"./index-e9211ef1.js";import{V as N,_ as B}from"./EditConfig.vue_vue_type_style_index_0_lang-29ce80f7.js";import{b as I,V as m,c as S}from"./VCard-138864fc.js";import{V as g}from"./VDivider-336c24cd.js";import{V as T}from"./VSelect-04a129eb.js";import"./VExpansionPanel-67038b00.js";import"./VBtn-68784d55.js";import"./VDialog-5f240a62.js";import"./VListItem-230d1393.js";import"./VMenu-bc0cce60.js";import"./VSpacer-bdf2f653.js";const P={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},j=["href"],D=n("br",null,null,-1),E=n("br",null,null,-1),O=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 l=>{l&&(e.value=await a.getPlayerConfig(l))},{immediate:!0});const k=async function(l){l.enabled=e.value.enabled,l.name=e.value.name||null,a.savePlayerConfig(_.playerId,l),h.push({name:"playersettings"})};return(l,v)=>(i(),f("section",null,[s(S,null,{default:o(()=>{var c,b;return[e.value&&e.value.provider in t(a).providerManifests?(i(),f("div",P,[s(I,null,{default:o(()=>[d(r(l.$t("settings.config_player",[e.value.name||t(a).players[e.value.player_id].name])),1)]),_:1}),s(m,null,{default:o(()=>[n("b",null,r(l.$t("settings.player_id"))+": ",1),d(r(e.value.player_id),1)]),_:1}),s(m,null,{default:o(()=>[n("b",null,r(l.$t("settings.player_provider"))+": ",1),d(r(t(a).providerManifests[e.value.provider].name)+" ( "+r(t(a).providerManifests[e.value.provider].description)+") ",1),t(a).providerManifests[e.value.provider].documentation?(i(),f("a",{key:0,href:t(a).providerManifests[e.value.provider].documentation,target:"_blank"},r(l.$t("settings.check_docs")),9,j)):u("",!0)]),_:1}),t(a).players[e.value.player_id]?(i(),p(m,{key:0},{default:o(()=>[n("b",null,r(l.$t("settings.player_model"))+": ",1),d(r(t(a).players[e.value.player_id].device_info.manufacturer)+" / "+r(t(a).players[e.value.player_id].device_info.model),1)]),_:1})):u("",!0),t(a).players[e.value.player_id]?(i(),p(m,{key:1},{default:o(()=>[n("b",null,r(l.$t("settings.player_address"))+": ",1),d(r(t(a).players[e.value.player_id].device_info.address),1)]),_:1})):u("",!0),s(m,null,{default:o(()=>[n("b",null,r(l.$t("settings.player_type_label"))+": ",1),d(r(l.$t(`player_type.${t(a).players[e.value.player_id].type}`)),1)]),_:1}),D,s(g),E,O,"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:l.$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:l.$t("settings.enable_player"),color:"primary",disabled:(b=t(a).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};
