import{n as x}from"./index.browser-OxPLOBIU.js";import{aw as B,J as b,a3 as L,aN as o,b9 as S,a4 as H,L as N,ax as k,ay as d,o as a,aE as i,az as V,E as f,aB as r,aG as y,be as w,bf as v,aL as P,bg as h,b_ as C,aS as I,c1 as $,bT as j,M as D,aQ as U,b6 as z,bv as O,aC as G,bL as J}from"./index-Dj6UKNsX.js";import{E as Q}from"./EditConfig-B0XoDh_u.js";import"./VForm-DDKxMAmn.js";import"./VExpansionPanels-DboS79vY.js";import"./VDialog-5KHkpnhE.js";import"./VAlert-CFvRz3gu.js";import"./VSwitch-DQEiK9D_.js";import"./VSelectionControl-CCjz0Lnv.js";import"./VSlider-Dcfg9Wg5.js";import"./VSelect-VNw4nPSb.js";import"./VVirtualScroll-Cg5AQGzG.js";import"./VCheckboxBtn-B5wUW3kZ.js";const R={key:0,style:{"margin-left":"-5px","margin-right":"-5px"}},q={id:"auth",href:"",target:"_blank"},se=B({__name:"AddProviderDetails",props:{domain:{}},setup(l){const M=G(),m=b([]),g=x(11),u=b(!1),p=b(!1),c=l;L(()=>{const n=o.subscribe(S.AUTH_SESSION,e=>{if(e.object_id!==g)return;const t=e.data;p.value=!0,window.setTimeout(()=>{const s=document.getElementById("auth");s.setAttribute("href",t),s.click()},100)});H(n)}),N(()=>c.domain,async n=>{n&&(m.value=await o.getProviderConfigEntries(c.domain,void 0,void 0,{session_id:g}))},{immediate:!0});const T=async function(n){u.value=!0,o.saveProviderConfig(c.domain,n).then(()=>{M.push({name:"providersettings"})}).catch(e=>{alert(e)}).finally(()=>{u.value=!1,p.value=!1})},A=async function(n,e){u.value=!0;for(const t of m.value)t.value!==void 0&&e[t.key]==null&&(e[t.key]=t.value);e.session_id=g,o.getProviderConfigEntries(c.domain,void 0,n,e).then(t=>{m.value=t}).catch(t=>{alert(t)}).finally(()=>{u.value=!1,p.value=!1})},E=function(n){const e=[],{t}=J();for(const s of n)s.includes("@")?e.push(`[${s.replace("@","")}](https://github.com/${s.replace("@","")})`):e.push(s);return`**${t("settings.codeowners")}**: `+e.join(" / ")};return(n,e)=>(d(),k("section",null,[a($,null,{default:i(()=>[r(o).providerManifests[l.domain]?(d(),k("div",R,[a(w,null,{default:i(()=>[v(P(n.$t("settings.setup_provider",[r(o).providerManifests[l.domain].name])),1)]),_:1}),a(h,{innerHTML:r(C)(r(o).providerManifests[l.domain].description)},null,8,["innerHTML"]),e[1]||(e[1]=f("br",null,null,-1)),r(o).providerManifests[l.domain].codeowners.length?(d(),y(h,{key:0,innerHTML:r(C)(E(r(o).providerManifests[l.domain].codeowners))},null,8,["innerHTML"])):V("",!0)])):V("",!0),e[2]||(e[2]=f("br",null,null,-1)),a(I),e[3]||(e[3]=f("br",null,null,-1)),e[4]||(e[4]=f("br",null,null,-1)),a(Q,{"config-entries":m.value,disabled:!1,onSubmit:T,onAction:A},null,8,["config-entries"])]),_:1}),a(O,{modelValue:u.value,"onUpdate:modelValue":e[0]||(e[0]=t=>u.value=t),scrim:"true",persistent:"",style:{display:"flex","align-items":"center","justify-content":"center"}},{default:i(()=>[p.value?(d(),y(U,{key:0,style:{"background-color":"white"}},{default:i(()=>[a(w,null,{default:i(()=>[...e[5]||(e[5]=[v("Authenticating...",-1)])]),_:1}),a(h,null,{default:i(()=>[...e[6]||(e[6]=[v("A new tab/popup should be opened where you can authenticate",-1)])]),_:1}),a(j,null,{default:i(()=>[f("a",q,[a(D,null,{default:i(()=>[...e[7]||(e[7]=[v("Click here if the popup did not open",-1)])]),_:1})])]),_:1})]),_:1})):(d(),y(z,{key:1,indeterminate:"",size:"64",color:"primary"}))]),_:1},8,["modelValue"])]))}});export{se as default};
