import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; const rootElement = document.getElementById('root'); // Global error handler for startup crashes (before React mounts) window.onerror = function(message, source, lineno) { console.error("Window Error Caught:", message, source, lineno); if (rootElement) { // Forcefully remove the static loading text and show error rootElement.innerHTML = `

SYSTEM INITIALIZATION FAILURE

${message}

${source} : ${lineno}

`; } }; if (!rootElement) { throw new Error("Could not find root element to mount to"); } console.log("System initialization sequence started..."); try { const root = ReactDOM.createRoot(rootElement); root.render( ); console.log("System mounted successfully."); } catch (e) { console.error("CRITICAL SYSTEM FAILURE:", e); // Visual fallback if React crashes during render rootElement.innerHTML = `

CRITICAL FAILURE

The system encountered a fatal error.

${e}
`; }