import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { ClerkProvider } from "@clerk/react";
import App from "./App.jsx";
import "./index.css";

const PUBLISHABLE_KEY = import.meta.env.VITE_CLERK_PUBLISHABLE_KEY;

if (!PUBLISHABLE_KEY) {
  throw new Error("Missing VITE_CLERK_PUBLISHABLE_KEY — add it to signal-ui/.env");
}

const WEBAPP_URL = "https://signal-ui-xi.vercel.app";

createRoot(document.getElementById("root")).render(
  <StrictMode>
    <ClerkProvider
      publishableKey={PUBLISHABLE_KEY}
      signInUrl={WEBAPP_URL}
      signUpUrl={WEBAPP_URL}
      afterSignInUrl={WEBAPP_URL}
      afterSignUpUrl={WEBAPP_URL}
    >
      <App />
    </ClerkProvider>
  </StrictMode>
);