Skip to content

The only tool you need to know what is happening and how to fix it.

1.7 KB
Raw Blame
import"../chunks/DsnmJJEf.js";import{p as w,y as _,e as v,d as j,a as y,l as c,j as S,h as k,g as m,r as z}from"../chunks/BKFspo1J.js";import{i as b}from"../chunks/COK9M2N0.js";import{r as x}from"../chunks/UDuKBjKQ.js";import{g as P}from"../chunks/Cv0CJCi1.js";import{a as s}from"../chunks/h7yRWCtK.js";import{p as T}from"../chunks/BrdmM8Kw.js";import{g as n,d as L}from"../chunks/BHvJp7nu.js";import{E}from"../chunks/CGiec90h.js";import{L as M}from"../chunks/CN84UmjY.js";import{a as O}from"../chunks/Czrimi2J.js";const F=!1,K=Object.freeze(Object.defineProperty({__proto__:null,ssr:F},Symbol.toStringTag,{value:"Module"}));var R=v('<div class="flex h-screen w-full items-center justify-center px-4"><!></div>');function N(p,u){w(u,!0);let o=S("");_(async()=>{const t=window.location.hash.startsWith("#")?window.location.hash.slice(1):"",i=new URLSearchParams(t),r=i.get("token"),h=i.get("needsSetup")==="true";if(history.replaceState(null,"",window.location.pathname),!r){c(o,"Missing authentication token."),setTimeout(()=>n("/login?error=oauth_failed"),1500);return}if(s.setToken(r),h){P(x("/finish-setup"));return}try{const l=await fetch("/api/me/login-bundle",{headers:{Authorization:`Bearer ${r}`}});if(!l.ok)throw new Error("Failed to load account");const e=await l.json();s.setOrganizations(e.organizations||[]),T.setProjects(e.projects||[]),n(O(L(),e.organizations||[],e.projects||[]))}catch{s.logout(),c(o,"Failed to load your account. Please try logging in again."),setTimeout(()=>n("/login?error=oauth_failed"),1500)}});var a=R(),f=k(a);{var g=t=>{E(t,{get error(){return m(o)},class:"max-w-md"})},d=t=>{M(t,{size:"xlg"})};b(f,t=>{m(o)?t(g):t(d,!1)})}z(a),j(p,a),y()}export{N as component,K as universal};