import{ay as x,b_ as B,J as p,i as M,L as N,az as f,aA as c,aB as v,aI as $,o as r,aD as z,aP as i,aG as d,E as n,aL as D,bi as O,aN as l,aT as T,b9 as j,by as A,aE as L,_ as P}from"./index-D-FY8Yx2.js";import{E as S}from"./EditConfig-BeVcr9VT.js";import{n as G}from"./index.browser-OxPLOBIU.js";import"./VCheckbox-W6o6QHjE.js";import"./VCheckboxBtn-DpMGI-si.js";import"./VSelectionControl-CyrHFsUF.js";import"./VSlider-CGKKjACx.js";import"./VSelect-Y8F8SAQI.js";import"./VVirtualScroll-cGuYysLa.js";import"./VForm-DYLmSGkE.js";import"./VExpansionPanels-CuU7p-4b.js";const J={class:"edit-core-config"},R={key:0},U={class:"header-content"},q={class:"header-icon"},F={class:"header-info"},H={class:"header-title"},K={class:"header-description"},Q=x({__name:"EditCoreConfig",props:{domain:{}},setup(_){const g=L(),{t:u}=B(),t=p(),h=G(11),s=p(!1),y=_,C=e=>!e.hidden,b=M(()=>t.value?Object.values(t.value.values).filter(e=>C(e)):[]);N(()=>y.domain,async e=>{e&&(t.value=await i.getCoreConfig(e))},{immediate:!0});const V=e=>{const a=u(`settings.core_module.${e.domain}.name`);return a!==`settings.core_module.${e.domain}.name`?a:i.providerManifests[e.domain].name},k=e=>{const a=u(`settings.core_module.${e.domain}.description`);return a!==`settings.core_module.${e.domain}.description`?a:i.providerManifests[e.domain].description},E=e=>({streams:"mdi-radio-tower",players:"mdi-speaker-multiple",metadata:"mdi-tag-multiple",music:"mdi-music",webserver:"mdi-web",cache:"mdi-cached"})[e]||"mdi-cog",I=async function(e){s.value=!0,i.saveCoreConfig(t.value.domain,e).then(()=>{s.value=!1,g.push({name:"providersettings"})}).catch(a=>{alert(a),s.value=!1})},w=async function(e,a){s.value=!0;for(const o of Object.values(t.value.values))o.value!==void 0&&a[o.key]==null&&(a[o.key]=o.value);a.session_id=h,i.getCoreConfigEntries(t.value.domain,e,a).then(o=>{t.value.values={};for(const m of o)t.value.values[m.key]=m;s.value=!1}).catch(o=>{alert(o),s.value=!1})};return(e,a)=>(c(),f("section",J,[t.value&&z(i).providerManifests[t.value.domain]?(c(),f("div",R,[r(T,{class:"header-card mb-4",elevation:"0"},{default:d(()=>[n("div",U,[n("div",q,[r(D,{size:"32",color:"primary"},{default:d(()=>[O(l(E(t.value.domain)),1)]),_:1})]),n("div",F,[n("h2",H,l(V(t.value)),1),n("p",K,l(k(t.value)),1)])])]),_:1})])):v("",!0),t.value?(c(),$(S,{key:1,"config-entries":b.value,disabled:!1,onSubmit:I,onAction:w},null,8,["config-entries"])):v("",!0),r(A,{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=o=>s.value=o),scrim:"true",persistent:"",class:"loading-overlay"},{default:d(()=>[r(j,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}}),re=P(Q,[["__scopeId","data-v-4cec6b35"]]);export{re as default};
