import { StrictMode } from "react";
import { createRoot } from "react-dom/client";

import "./styles.css";
import App from "./App";
import { applyTheme } from "./lib/applyTheme";

// Pre-paint the user's last theme so the Login screen doesn't flash the wrong
// palette before the profile loads. Defaults to "auto" (follow the OS).
applyTheme((localStorage.getItem("bp.theme") as "light" | "dark" | "auto") ?? "auto");

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