import "./styles.css";
import { RegistryProvider } from "@effect/atom-react";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import { App } from "./App";
import { defaultApiMode } from "./mocks/scenario";

// Zero-host dev loop: install the mock transport BEFORE the first render so the very
// first atom reads hit fixtures. The whole branch is dead-code-eliminated from
// production builds (import.meta.env.DEV is false), so no fixture code ships.
if (import.meta.env.DEV && defaultApiMode === "mock") {
	await import("./mocks/http");
}

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