import{d as I,r as P,v as t,b2 as $,q as M,O as U,bj as g,cl as _,aW as V,ae as w,c,b as d,w as o,bM as L,o as i,e as u,a as s,h as p,u as r,b7 as h,b8 as y,t as n,b9 as v,ck as B,y as E,f as N}from"./index-DAuB1RBy.js";import{E as O}from"./EditConfig-DbCOrXkK.js";import{V as G}from"./VTextField-DQF4-MrD.js";import{V as R}from"./VSwitch-Ce26WVSl.js";import"./VForm-BGGj3phW.js";import"./VInput-DkB9U5qk.js";import"./VExpansionPanels-DEX_OiAA.js";import"./VAlert-DFCGfYqG.js";import"./VBtn-CSPvubWm.js";import"./VSlider-fAOLkzI7.js";import"./VVirtualScroll-X5Y5sbII.js";import"./VDialog-CGsvDHVp.js";import"./VSpacer-GX5iwvaY.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";const q={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},te=I({__name:"EditPlayer",props:{playerId:{}},setup(k){const D=N(),e=P(),f=k,b=P(!1);(async()=>{if(f.playerId)try{b.value=(await t.getDSPConfig(f.playerId)).enabled}catch(l){console.error("Error fetching DSP config:",l)}})();const S=t.subscribe($.PLAYER_DSP_CONFIG_UPDATED,l=>{b.value=l.data.enabled});M(S);const C=U(()=>{if(!e.value)return[];const l=Object.values(e.value.values),a=t.players[e.value.player_id];return a&&a.type!==g.GROUP?l.push({key:"dsp_settings",type:_.DSP_SETTINGS,label:"",default_value:b.value,required:!1,category:"audio"}):a&&a.type===g.GROUP&&a.supported_features.includes(V.MULTI_DEVICE_DSP)?l.push({key:"dsp_note_multi_device_group",type:_.LABEL,label:"You can configure the DSP for each player individually.",default_value:null,required:!1,category:"audio"}):a&&a.type===g.GROUP&&!a.supported_features.includes(V.MULTI_DEVICE_DSP)&&l.push({key:"dsp_note_multi_device_group_not_supported",type:_.LABEL,label:"This group type does not support DSP when playing to multiple devices.",default_value:null,required:!1,category:"audio"}),l});w(()=>f.playerId,async l=>{l&&(e.value=await t.getPlayerConfig(l))},{immediate:!0});const T=async function(l){delete l.dsp_settings,l.enabled=e.value.enabled,l.name=e.value.name||null,t.savePlayerConfig(f.playerId,l),D.push({name:"playersettings"})};return(l,a)=>(i(),c("section",null,[d(L,null,{default:o(()=>[e.value&&r(t).getProviderManifest(e.value.provider).domain in r(t).providerManifests?(i(),c("div",q,[d(h,null,{default:o(()=>[y(n(l.$t("settings.config_player",[e.value.name||r(t).players[e.value.player_id]?.name||e.value.default_name])),1)]),_:1}),d(v,null,{default:o(()=>[s("b",null,n(l.$t("settings.player_id"))+": ",1),y(n(e.value.player_id),1)]),_:1}),d(v,null,{default:o(()=>[s("b",null,n(l.$t("settings.player_provider"))+": ",1),y(n(r(t).getProviderManifest(e.value.provider)?.name)+" ",1),r(t).getProviderManifest(e.value.provider)?.documentation?(i(),c("a",{key:0,onClick:a[0]||(a[0]=m=>r(B)(r(t).getProviderManifest(e.value.provider)?.documentation))}," ["+n(l.$t("settings.check_docs"))+"]",1)):u("",!0)]),_:1}),r(t).players[e.value.player_id]?(i(),p(v,{key:0},{default:o(()=>[s("b",null,n(l.$t("settings.player_model"))+": ",1),y(n(r(t).players[e.value.player_id].device_info.manufacturer)+" / "+n(r(t).players[e.value.player_id].device_info.model),1)]),_:1})):u("",!0),r(t).players[e.value.player_id]?.device_info.ip_address?(i(),p(v,{key:1},{default:o(()=>[s("b",null,n(l.$t("settings.player_address"))+": ",1),y(n(r(t).players[e.value.player_id].device_info.ip_address),1)]),_:1})):u("",!0),r(t).players[e.value.player_id]?(i(),p(v,{key:2},{default:o(()=>[s("b",null,n(l.$t("settings.player_type_label"))+": ",1),y(n(l.$t(`player_type.${r(t).players[e.value.player_id].type}`)),1)]),_:1})):u("",!0),a[3]||(a[3]=s("br",null,null,-1)),d(E),a[4]||(a[4]=s("br",null,null,-1)),a[5]||(a[5]=s("br",null,null,-1)),"name"in e.value?(i(),p(G,{key:3,modelValue:e.value.name,"onUpdate:modelValue":a[1]||(a[1]=m=>e.value.name=m),placeholder:e.value?.name,label:l.$t("settings.player_name"),variant:"outlined",clearable:"",class:"configcolumnleft",style:{"margin-right":"25px"}},null,8,["modelValue","placeholder","label"])):u("",!0),"enabled"in e.value?(i(),p(R,{key:4,modelValue:e.value.enabled,"onUpdate:modelValue":a[2]||(a[2]=m=>e.value.enabled=m),label:l.$t("settings.enable_player"),color:"primary",disabled:r(t).getProviderManifest(e.value.provider)?.builtin},null,8,["modelValue","label","disabled"])):u("",!0)])):u("",!0),a[6]||(a[6]=s("br",null,null,-1)),d(E),e.value?(i(),p(O,{key:1,disabled:!e.value.enabled,"config-entries":C.value,onSubmit:T},null,8,["disabled","config-entries"])):u("",!0)]),_:1})]))}});export{te as default};
