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

import { ToastProvider } from './components/ui/ToastProvider';
import { ExportQueueProvider } from './context/ExportQueueContext';

// Detect render mode (used by headless Puppeteer renderer)
const isRenderMode = new URLSearchParams(window.location.search).has('renderMode');

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    {isRenderMode ? (
      <RenderPage />
    ) : (
      <ToastProvider>
        <ExportQueueProvider>
          <App />
        </ExportQueueProvider>
      </ToastProvider>
    )}
  </StrictMode>,
);
