import {StrictMode} from 'react';
import {createRoot} from 'react-dom/client';
import App from './App.tsx';
import './index.css';
import { DialogProvider } from './hooks/useDialog';

const originalConsoleError = console.error;
console.error = (...args) => {
  const msg = typeof args[0] === 'string' ? args.join(' ') : args.map(a => String(a)).join(' ');
  if (msg.includes('ABORTED_BY_USER')) return;
  if (msg.includes('offline')) return;
  if (msg.includes('Encountered two children with the same key')) return;
  if (msg.includes('Each child in a list should have a unique "key" prop')) return;
  if (msg.includes('validateDOMNesting')) return;
  originalConsoleError(...args);
};

createRoot(document.getElementById('root')!).render(
    <DialogProvider>
      <App />
    </DialogProvider>
);
