const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../auth-callback-error-BqK-lk7L.js","../rolldown-runtime-Bh1tDfsg.js","../ra-BWTkRGwR.js","../mui-7yojldoe.js","../i18n-C38mAdbY.js","../vendor-BDQ8BclH.js","../serverVersion-CTVcDU76.js"])))=>i.map(i=>d[i]);
import"../rolldown-runtime-Bh1tDfsg.js";import{t as e}from"../auth-DRR-1urg.js";import{Mi as t,Mt as n,_i as r,ki as i}from"../ra-BWTkRGwR.js";import{t as a}from"../react-BIIYalT6.js";import{B as o,G as s,R as c,W as l,q as u}from"../serverVersion-CTVcDU76.js";var d=a();t();var f=i(),p=u(`auth-callback`),m=e=>{try{let t=new URL(e),n=t.pathname.replace(/\/auth-callback(?:\/index\.html)?\/?$/,``);return n.endsWith(`/`)&&(n=n.slice(0,-1)),`${t.origin}${n}`}catch{return``}},h=(e,t)=>{e.href=`${m(e.href)||e.origin}/#${t.startsWith(`/`)?t:`/${t}`}`},g=e=>e instanceof Error&&e.message?e.message:typeof e==`string`?e:`Unexpected error during authentication.`,_=async e=>e.handleCallback?.(),v=()=>{document.head.dataset.baseTitle||(document.head.dataset.baseTitle=`Ketesa`),document.title||(document.title=`Ketesa`)};typeof window<`u`&&window.__KETESA_AUTH_CALLBACK_ENTRY__&&((t=document.getElementById(`root`),i=window.location,a=e)=>{v();let u=t?(0,d.createRoot)(t):null;u?.render((0,f.jsx)(n,{loadingPrimary:``,loadingSecondary:``}));let m=document.getElementById(`loader`);m&&(m.classList.add(`fade-out`),m.addEventListener(`transitionend`,()=>m.remove(),{once:!0})),(async()=>{await c(),await l(o().etkeccAdmin,``);let e=s();return e.name&&(document.head.dataset.baseTitle=e.name,document.title.includes(e.name)||(document.title=e.name)),_(a)})().then(e=>{h(i,e?.redirectTo||`/`)}).catch(async e=>{let t=g(e);if(p.error(`OAuth callback error`,{href:i.href,message:t}),!u)return;let{renderAuthCallbackError:n}=await r(async()=>{let{renderAuthCallbackError:e}=await import(`../auth-callback-error-BqK-lk7L.js`);return{renderAuthCallbackError:e}},__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);await n(u,{message:t,onBack:()=>h(i,`/login`)})})})();