import{Q as L,x as S,a4 as t,aU as M,b as N,c as h,b7 as g,ca as _,ay as C,w as R,Z as c,B as p,U as d,bD as G,S as s,a9 as o,W as u,R as y,a0 as r,aZ as O,ao as v,ab as n,a_ as f,c9 as A,Y as T,bE as q}from"./index-CjKqSS7W.js";import{E as F}from"./EditConfig-9zjcpbs4.js";import{V as Y}from"./VTextField-cwB3gAIj.js";import{V as Z}from"./VSwitch-Bc2Oj35C.js";import"./VForm-BKq248nc.js";import"./VCheckboxBtn-Yw1fo7EH.js";import"./VExpansionPanels-DQqGBT2F.js";import"./VAlert-uW_UuQw8.js";import"./VBtn-CIAN6k9R.js";import"./VSlider-B9z5HH84.js";import"./VVirtualScroll-LbHvdAV3.js";import"./VDialog-OUDbMT8x.js";import"./VSpacer-DzR7cAEV.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";const j={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},oe=L({__name:"EditPlayer",props:{playerId:{}},setup(I){const $=q(),e=S(),m=I,b=S(!1);(async()=>{if(m.playerId)try{b.value=(await t.getDSPConfig(m.playerId)).enabled}catch(a){console.error("Error fetching DSP config:",a)}})();const U=t.subscribe(M.PLAYER_DSP_CONFIG_UPDATED,a=>{b.value=a.data.enabled});N(U);const w=h(()=>{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:b.value,required:!1,category:"audio"}):l&&l.type===g.GROUP&&l.supported_features.includes(C.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(C.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});R(()=>m.playerId,async a=>{a&&(e.value=await t.getPlayerConfig(a))},{immediate:!0});const B=async function(a){delete a.dsp_settings,a.enabled=e.value.enabled,a.name=e.value.name||null,t.savePlayerConfig(m.playerId,a),$.push({name:"playersettings"})};return(a,l)=>(s(),c("section",null,[p(G,null,{default:d(()=>{var P,E,V;return[e.value&&r(t).getProviderManifest(e.value.provider).domain in r(t).providerManifests?(s(),c("div",j,[p(O,null,{default:d(()=>{var i;return[v(n(a.$t("settings.config_player",[e.value.name||((i=r(t).players[e.value.player_id])==null?void 0:i.name)||e.value.default_name])),1)]}),_:1}),p(f,null,{default:d(()=>[u("b",null,n(a.$t("settings.player_id"))+": ",1),v(n(e.value.player_id),1)]),_:1}),p(f,null,{default:d(()=>{var i,k;return[u("b",null,n(a.$t("settings.player_provider"))+": ",1),v(n((i=r(t).getProviderManifest(e.value.provider))==null?void 0:i.name)+" ",1),(k=r(t).getProviderManifest(e.value.provider))!=null&&k.documentation?(s(),c("a",{key:0,onClick:l[0]||(l[0]=W=>{var D;return r(A)((D=r(t).getProviderManifest(e.value.provider))==null?void 0:D.documentation)})}," ["+n(a.$t("settings.check_docs"))+"]",1)):o("",!0)]}),_:1}),r(t).players[e.value.player_id]?(s(),y(f,{key:0},{default:d(()=>[u("b",null,n(a.$t("settings.player_model"))+": ",1),v(n(r(t).players[e.value.player_id].device_info.manufacturer)+" / "+n(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(f,{key:1},{default:d(()=>[u("b",null,n(a.$t("settings.player_address"))+": ",1),v(n(r(t).players[e.value.player_id].device_info.ip_address),1)]),_:1})):o("",!0),r(t).players[e.value.player_id]?(s(),y(f,{key:2},{default:d(()=>[u("b",null,n(a.$t("settings.player_type_label"))+": ",1),v(n(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(Y,{key:3,modelValue:e.value.name,"onUpdate:modelValue":l[1]||(l[1]=i=>e.value.name=i),placeholder:(E=e.value)==null?void 0:E.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(Z,{key:4,modelValue:e.value.enabled,"onUpdate:modelValue":l[2]||(l[2]=i=>e.value.enabled=i),label:a.$t("settings.enable_player"),color:"primary",disabled:(V=r(t).getProviderManifest(e.value.provider))==null?void 0:V.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(F,{key:1,disabled:!e.value.enabled,"config-entries":w.value,onSubmit:B},null,8,["disabled","config-entries"])):o("",!0)]}),_:1})]))}});export{oe as default};
