import{ay as _,bN as x,J as c,L as k,az as d,aA as r,o as n,aG as l,aB as m,aI as h,E,bi as N,bh as B,aN as I,c3 as j,b8 as w,bx as O,aP as i,aE as S}from"./index-BRUnowC8.js";import{E as z}from"./EditConfig-DaKyuWVG.js";import{n as A}from"./index.browser-OxPLOBIU.js";import"./VForm-CLH0WxMk.js";import"./VExpansionPanels-CpHWuHN2.js";import"./VDialog-Bh3mGVOy.js";import"./VAlert-DQxypmdN.js";import"./VSwitch-Dcs-7m3i.js";import"./VSelectionControl-Co1cRcmS.js";import"./VSlider-BOibVdD7.js";import"./VSelect-B-WERBOu.js";import"./VVirtualScroll-htzu2YXu.js";import"./VCheckboxBtn-D390s4L9.js";const D={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},Q=_({__name:"EditCoreConfig",props:{domain:{}},setup(f){const p=S(),{t:v}=x(),a=c(),g=A(11),s=c(!1),y=f;k(()=>y.domain,async t=>{t&&(a.value=await i.getCoreConfig(t))},{immediate:!0});const C=t=>{const e=v(`settings.core_module.${t.domain}.description`);return e!==`settings.core_module.${t.domain}.description`?e:i.providerManifests[t.domain].description},b=async function(t){s.value=!0,i.saveCoreConfig(a.value.domain,t).then(()=>{s.value=!1,p.push({name:"providersettings"})}).catch(e=>{alert(e),s.value=!1})},V=async function(t,e){s.value=!0;for(const o of Object.values(a.value.values))o.value!==void 0&&e[o.key]==null&&(e[o.key]=o.value);e.session_id=g,i.getCoreConfigEntries(a.value.domain,t,e).then(o=>{a.value.values={};for(const u of o)a.value.values[u.key]=u;s.value=!1}).catch(o=>{alert(o),s.value=!1})};return(t,e)=>(r(),d("section",null,[n(j,null,{default:l(()=>[a.value?(r(),d("div",D,[n(N,null,{default:l(()=>[B(I(C(a.value)),1)]),_:1}),e[1]||(e[1]=E("br",null,null,-1))])):m("",!0),a.value?(r(),h(z,{key:1,"config-entries":Object.values(a.value.values),disabled:!1,onSubmit:b,onAction:V},null,8,["config-entries"])):m("",!0)]),_:1}),n(O,{modelValue:s.value,"onUpdate:modelValue":e[0]||(e[0]=o=>s.value=o),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:l(()=>[n(w,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}});export{Q as default};
