import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import App from './App.tsx'; import './index.css'; // Proteção contra aviso ruidoso de dimensionamento do Recharts durante transições de layout const originalWarn = console.warn; const originalError = console.error; const isRechartsDimensionWarning = (msg: unknown) => typeof msg === 'string' && (msg.includes('width(0) and height(0) of chart should be greater than 0') || (msg.includes('width') && msg.includes('height') && msg.includes('of chart should be greater than 0'))); console.warn = (...args: any[]) => { if (isRechartsDimensionWarning(args[0])) return; originalWarn.apply(console, args); }; console.error = (...args: any[]) => { if (isRechartsDimensionWarning(args[0])) return; originalError.apply(console, args); }; // Proteção global contra extensões de navegador e tradutores automáticos (Google Translate / Edge Translate) // que alteram nós de texto e causam a exceção NotFoundError: Failed to execute 'removeChild'/'insertBefore' on 'Node' if (typeof Node === 'function' && Node.prototype) { const originalRemoveChild = Node.prototype.removeChild; Node.prototype.removeChild = function (child: T): T { if (child && child.parentNode !== this) { if (console && typeof console.warn === 'function') { console.warn('Proteção de DOM: tentativa de removeChild em nó com parentNode diferente.', child, this); } return child; } return originalRemoveChild.apply(this, [child]) as T; }; const originalInsertBefore = Node.prototype.insertBefore; Node.prototype.insertBefore = function (newNode: T, referenceNode: Node | null): T { if (referenceNode && referenceNode.parentNode !== this) { if (console && typeof console.warn === 'function') { console.warn('Proteção de DOM: tentativa de insertBefore em nó com parentNode diferente.', referenceNode, this); } return newNode; } return originalInsertBefore.apply(this, [newNode, referenceNode]) as T; }; } try { const rootElement = document.getElementById('root'); if (rootElement) { createRoot(rootElement).render( , ); } } catch (err) { console.error('Erro crítico ao inicializar o React:', err); const rootElement = document.getElementById('root'); if (rootElement) { rootElement.innerHTML = `
⚠️

Inconsistência de Inicialização

Ocorreu uma falha ao montar a interface. Isso pode ter sido provocado por dados em cache antigos ou extensões do navegador.

${String(err)}
`; } }