import{n as x}from"./index.browser-OxPLOBIU.js";import{d as B,r as k,m as H,v as o,a$ as L,q as N,ae as S,c as w,b as i,w as a,bJ as I,bm as P,o as m,e as V,a as u,u as s,h as b,b4 as C,b5 as f,t as h,b6 as g,bF as M,ch as D,y as j,bD as U,x as O,f as q,bx as z}from"./index-CD7iYaFT.js";import{E as F}from"./EditConfig-BoSMCX1M.js";import{V as J,b as R}from"./VBtn-B0XatuYF.js";import"./VForm-CSOJ83b-.js";import"./VInput-DDFZ8lhb.js";import"./VExpansionPanels-TUY6dJc5.js";import"./VAlert-cuze2JsR.js";import"./VSwitch-Bf96mRby.js";import"./VTextField-CVfOZKc3.js";import"./VVirtualScroll-BREm3RjH.js";import"./VSlider-Vu2fOVGH.js";import"./VDialog-3VB6G7S5.js";import"./VSpacer-B8t0Vh55.js";/* empty css              */import"./_plugin-vue_export-helper-DlAUqK2U.js";const G={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},K={id:"auth",href:"",target:"_blank"},de=B({__name:"AddProviderDetails",props:{domain:{}},setup(r){const T=q(),p=k([]),y=x(11),d=k(!1),c=k(!1),v=r;H(()=>{const n=o.subscribe(L.AUTH_SESSION,e=>{if(e.object_id!==y)return;const t=e.data;c.value=!0,window.setTimeout(()=>{const l=document.getElementById("auth");l.setAttribute("href",t),l.click()},100)});N(n)}),S(()=>v.domain,async n=>{n&&(p.value=await o.getProviderConfigEntries(v.domain,void 0,void 0,{session_id:y}))},{immediate:!0});const A=async function(n){d.value=!0,o.saveProviderConfig(v.domain,n).then(()=>{T.push({name:"providersettings"})}).catch(e=>{alert(e)}).finally(()=>{d.value=!1,c.value=!1})},E=async function(n,e){d.value=!0;for(const t of p.value)t.value!==void 0&&e[t.key]==null&&(e[t.key]=t.value);e.session_id=y,o.getProviderConfigEntries(v.domain,void 0,n,e).then(t=>{p.value=t}).catch(t=>{alert(t)}).finally(()=>{d.value=!1,c.value=!1})},$=function(n){const e=[],{t}=z();for(const l of n)l.includes("@")?e.push(`[${l.replace("@","")}](https://github.com/${l.replace("@","")})`):e.push(l);return`**${t("settings.codeowners")}**: `+e.join(" / ")};return(n,e)=>(m(),w("section",null,[i(I,null,{default:a(()=>[s(o).providerManifests[r.domain]?(m(),w("div",G,[i(C,null,{default:a(()=>[f(h(n.$t("settings.setup_provider",[s(o).providerManifests[r.domain].name])),1)]),_:1}),i(g,{innerHTML:s(M)(s(o).providerManifests[r.domain].description)},null,8,["innerHTML"]),e[3]||(e[3]=u("br",null,null,-1)),s(o).providerManifests[r.domain].codeowners.length?(m(),b(g,{key:0,innerHTML:s(M)($(s(o).providerManifests[r.domain].codeowners))},null,8,["innerHTML"])):V("",!0),s(o).providerManifests[r.domain].documentation?(m(),b(g,{key:1},{default:a(()=>[u("b",null,h(n.$t("settings.need_help_setup_provider")),1),e[2]||(e[2]=f("  ",-1)),u("a",{onClick:e[0]||(e[0]=t=>s(D)(s(o).providerManifests[r.domain].documentation))},h(n.$t("settings.check_docs")),1)]),_:1})):V("",!0)])):V("",!0),e[4]||(e[4]=u("br",null,null,-1)),i(j),e[5]||(e[5]=u("br",null,null,-1)),e[6]||(e[6]=u("br",null,null,-1)),i(F,{"config-entries":p.value,disabled:!1,onSubmit:A,onAction:E},null,8,["config-entries"])]),_:1}),i(P,{modelValue:d.value,"onUpdate:modelValue":e[1]||(e[1]=t=>d.value=t),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:a(()=>[c.value?(m(),b(O,{key:0,style:{"background-color":"white"}},{default:a(()=>[i(C,null,{default:a(()=>[...e[7]||(e[7]=[f("Authenticating...",-1)])]),_:1}),i(g,null,{default:a(()=>[...e[8]||(e[8]=[f("A new tab/popup should be opened where you can authenticate",-1)])]),_:1}),i(U,null,{default:a(()=>[u("a",K,[i(J,null,{default:a(()=>[...e[9]||(e[9]=[f("Click here if the popup did not open",-1)])]),_:1})])]),_:1})]),_:1})):(m(),b(R,{key:1,indeterminate:"",size:"64",color:"primary"}))]),_:1},8,["modelValue"])]))}});export{de as default};
