// MUST be first: captures the invite-email hash before the supabase client
// (imported transitively by App) consumes it. See src/lib/inviteFlag.ts.
import "./lib/inviteFlag";
import { createRoot } from "react-dom/client";
import App from "./App.tsx";
import "./index.css";
import "./lib/i18n";

// Open the TLS connection to Supabase while React boots — the child's first
// action (resolving their code) then skips the DNS+TLS handshake entirely.
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL as string | undefined;
if (supabaseUrl) {
  const link = document.createElement("link");
  link.rel = "preconnect";
  link.href = new URL(supabaseUrl).origin;
  link.crossOrigin = "anonymous";
  document.head.appendChild(link);
}

createRoot(document.getElementById("root")!).render(<App />);
