import{Q as U,x as C,c as B,a4 as t,b7 as g,ca as _,ay as D,w as L,Z as b,B as p,U as d,bD as h,S as s,a9 as o,W as u,R as y,a0 as r,aZ as N,ao as f,ab as i,a_ as m,c9 as R,Y as T,bE as G}from"./index-Bduq4vJM.js";import{E as O}from"./EditConfig-CEDj8nuH.js";import{V as q}from"./VTextField-lpT7m_Xn.js";import{V as A}from"./VSwitch-7T-ZmqqN.js";import"./VForm-Cm4j-rit.js";import"./VCheckboxBtn-DLibXb0-.js";import"./VExpansionPanels-CUuvVvLb.js";import"./VAlert-BjDi0iTj.js";import"./VBtn-DWiYTBpb.js";import"./VSlider-ZsJroA_b.js";import"./VVirtualScroll-VdTkqEkN.js";import"./VDialog-B3s_EL-H.js";import"./VSpacer-BnmXZ56R.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";const F={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},ne=U({__name:"EditPlayer",props:{playerId:{}},setup($){const I=G(),e=C(),v=$,c=C(!1);(async()=>{if(v.playerId)try{c.value=(await t.getDSPConfig(v.playerId)).enabled}catch(a){console.error("Error fetching DSP config:",a)}})();const w=B(()=>{if(!e.value)return[];const a=Object.values(e.value.values),l=t.players[e.value.player_id];return l&&l.type!==g.GROUP?a.push({key:"dsp_settings",type:_.DSP_SETTINGS,label:"",default_value:c.value,required:!1,category:"audio"}):l&&l.type===g.GROUP&&l.supported_features.includes(D.MULTI_DEVICE_DSP)?a.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"}):l&&l.type===g.GROUP&&!l.supported_features.includes(D.MULTI_DEVICE_DSP)&&a.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"}),a});L(()=>v.playerId,async a=>{a&&(e.value=await t.getPlayerConfig(a))},{immediate:!0});const M=async function(a){delete a.dsp_settings,a.enabled=e.value.enabled,a.name=e.value.name||null,t.savePlayerConfig(v.playerId,a),I.push({name:"playersettings"})};return(a,l)=>(s(),b("section",null,[p(h,null,{default:d(()=>{var P,V,k;return[e.value&&r(t).getProviderManifest(e.value.provider).domain in r(t).providerManifests?(s(),b("div",F,[p(N,null,{default:d(()=>{var n;return[f(i(a.$t("settings.config_player",[e.value.name||((n=r(t).players[e.value.player_id])==null?void 0:n.name)||e.value.default_name])),1)]}),_:1}),p(m,null,{default:d(()=>[u("b",null,i(a.$t("settings.player_id"))+": ",1),f(i(e.value.player_id),1)]),_:1}),p(m,null,{default:d(()=>{var n,E;return[u("b",null,i(a.$t("settings.player_provider"))+": ",1),f(i((n=r(t).getProviderManifest(e.value.provider))==null?void 0:n.name)+" ",1),(E=r(t).getProviderManifest(e.value.provider))!=null&&E.documentation?(s(),b("a",{key:0,onClick:l[0]||(l[0]=Z=>{var S;return r(R)((S=r(t).getProviderManifest(e.value.provider))==null?void 0:S.documentation)})}," ["+i(a.$t("settings.check_docs"))+"]",1)):o("",!0)]}),_:1}),r(t).players[e.value.player_id]?(s(),y(m,{key:0},{default:d(()=>[u("b",null,i(a.$t("settings.player_model"))+": ",1),f(i(r(t).players[e.value.player_id].device_info.manufacturer)+" / "+i(r(t).players[e.value.player_id].device_info.model),1)]),_:1})):o("",!0),(P=r(t).players[e.value.player_id])!=null&&P.device_info.ip_address?(s(),y(m,{key:1},{default:d(()=>[u("b",null,i(a.$t("settings.player_address"))+": ",1),f(i(r(t).players[e.value.player_id].device_info.ip_address),1)]),_:1})):o("",!0),r(t).players[e.value.player_id]?(s(),y(m,{key:2},{default:d(()=>[u("b",null,i(a.$t("settings.player_type_label"))+": ",1),f(i(a.$t(`player_type.${r(t).players[e.value.player_id].type}`)),1)]),_:1})):o("",!0),l[3]||(l[3]=u("br",null,null,-1)),p(T),l[4]||(l[4]=u("br",null,null,-1)),l[5]||(l[5]=u("br",null,null,-1)),"name"in e.value?(s(),y(q,{key:3,modelValue:e.value.name,"onUpdate:modelValue":l[1]||(l[1]=n=>e.value.name=n),placeholder:(V=e.value)==null?void 0:V.name,label:a.$t("settings.player_name"),variant:"outlined",clearable:"",class:"configcolumnleft",style:{"margin-right":"25px"}},null,8,["modelValue","placeholder","label"])):o("",!0),"enabled"in e.value?(s(),y(A,{key:4,modelValue:e.value.enabled,"onUpdate:modelValue":l[2]||(l[2]=n=>e.value.enabled=n),label:a.$t("settings.enable_player"),color:"primary",disabled:(k=r(t).getProviderManifest(e.value.provider))==null?void 0:k.builtin},null,8,["modelValue","label","disabled"])):o("",!0)])):o("",!0),l[6]||(l[6]=u("br",null,null,-1)),p(T),e.value?(s(),y(O,{key:1,disabled:!e.value.enabled,"config-entries":w.value,onSubmit:M},null,8,["disabled","config-entries"])):o("",!0)]}),_:1})]))}});export{ne as default};
