import { createRoot } from "react-dom/client"; import { recordBootFailure } from "../adapters/diagnostics/bounded-diagnostics.js"; import { BootErrorShell } from "../presentation/boundaries/boot-error-shell.jsx"; import { createRuntimeComposition } from "./create-runtime-composition.js"; import { initializeColorScheme } from "./initialize-color-scheme.js"; import { BootConfigError } from "./load-runtime-config.js"; import { ReleaseManifestError } from "./load-release-manifest.js"; import { RuntimeApplication } from "./runtime-application.jsx"; import "../presentation/styles/theme.css"; const rootElement = document.getElementById("root"); if (!rootElement) { throw new Error("Missing #root mount element"); } const root = createRoot(rootElement); async function boot() { try { const composition = await createRuntimeComposition(); document.documentElement.dataset.buildId = composition.release.buildId; document.documentElement.dataset.releaseId = composition.release.releaseId; initializeColorScheme(composition.application.preferences); root.render(); } catch (error) { const safe = error instanceof BootConfigError || error instanceof ReleaseManifestError ? error.safe : { supportReference: "boot:unknown" }; recordBootFailure(error, safe); root.render(); } } void boot();