import React from "react";
import ReactDOM from "react-dom/client";

import { App } from "@/app/app";
import { env } from "@/shared/config/env";
import "@/styles.css";
import "maplibre-gl/dist/maplibre-gl.css";
import "katex/dist/katex.min.css";
import "streamdown/styles.css";

async function prepareMocks() {
  if (!env.TJWATER_ENABLE_MSW) return;
  const { worker } = await import("@/mocks/browser");
  await worker.start({ onUnhandledRequest: "bypass" });
}

await prepareMocks();

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