import{l as j,a3 as x,r as g,w as N,y as c,I as y,j as i,A as l,R as f,N as u,x as d,z as p,D as r,H as m,L as n}from"./index-0b85ac09.js";import{_ as $}from"./EditConfig.vue_vue_type_style_index_0_lang-805c93f6.js";import{n as B}from"./index.browser-7e542916.js";import{c as D,b as v,V as E}from"./VCard-49371ce3.js";import{V as h,w as O}from"./VImg-0b02a672.js";import{f as S}from"./VMenu-17c39295.js";import"./VExpansionPanel-4544781e.js";import"./VTextField-5fb2df8c.js";import"./VCheckboxBtn-f7c239ad.js";import"./VVirtualScroll-3bbd56c5.js";import"./VSpacer-e64ca4a5.js";import"./VDialog-69cc554b.js";const T={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},z=r("br",null,null,-1),A=["href"],I=r("br",null,null,-1),R=r("br",null,null,-1),H=r("br",null,null,-1),Z=j({__name:"EditCoreConfig",props:{domain:{}},setup(C){const V=C,b=x(),e=g(),k=B(11),s=g(!1);N(()=>V.domain,async t=>{t&&(e.value=await n.getCoreConfig(t))},{immediate:!0});const w=async function(t){s.value=!0,n.saveCoreConfig(e.value.domain,t).then(()=>{s.value=!1,b.push({name:"providersettings"})}).catch(o=>{alert(o),s.value=!1})},M=async function(t,o){s.value=!0;for(const a of Object.values(e.value.values))a.value!==void 0&&o[a.key]==null&&(o[a.key]=a.value);o.session_id=k,n.getCoreConfigEntries(e.value.domain,t,o).then(a=>{e.value.values={};for(const _ of a)e.value.values[_.key]=_;s.value=!1}).catch(a=>{alert(a),s.value=!1})};return(t,o)=>(c(),y("section",null,[i(E,null,{default:l(()=>[e.value?(c(),y("div",T,[i(D,null,{default:l(()=>[f(u(t.$t("settings.setup_provider",[d(n).providerManifests[e.value.domain].name])),1)]),_:1}),i(v,null,{default:l(()=>[f(u(d(n).providerManifests[e.value.domain].description),1)]),_:1}),z,d(n).providerManifests[e.value.domain].codeowners.length?(c(),p(v,{key:0},{default:l(()=>[r("b",null,u(t.$t("settings.codeowners"))+": ",1),f(u(d(n).providerManifests[e.value.domain].codeowners.join(" / ")),1)]),_:1})):m("",!0),d(n).providerManifests[e.value.domain].documentation?(c(),p(v,{key:1},{default:l(()=>[r("b",null,u(t.$t("settings.need_help_setup_provider")),1),f("  "),r("a",{href:d(n).providerManifests[e.value.domain].documentation,target:"_blank"},u(t.$t("settings.check_docs")),9,A)]),_:1})):m("",!0),I,i(h),R,H])):m("",!0),i(h),e.value?(c(),p($,{key:1,"config-entries":Object.values(e.value.values),disabled:!1,onSubmit:w,onAction:M},null,8,["config-entries"])):m("",!0)]),_:1}),i(S,{modelValue:s.value,"onUpdate:modelValue":o[0]||(o[0]=a=>s.value=a),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:l(()=>[i(O,{indeterminate:"",size:"64",color:"primary"})]),_:1},8,["modelValue"])]))}});export{Z as default};
