import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import App from "./App.tsx";

// ── Production Security: Disable console output to prevent data leaks ──
if (import.meta.env.PROD) {
  console.log = () => { };
  console.info = () => { };
  console.warn = () => { };
  console.debug = () => { };
  // Keep console.error for critical runtime errors only
  const originalError = console.error.bind(console);
  console.error = (...args: unknown[]) => {
    // Only log non-sensitive errors in production
    const msg = String(args[0] ?? "");
    if (!msg.includes("token") && !msg.includes("password") && !msg.includes("secret")) {
      originalError(...args);
    }
  };
}

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