import React from 'react'; import { createRoot } from 'react-dom/client'; import App from './App'; console.log("[Boot] Initializing FarmOps scripts..."); // --- GLOBAL ERROR CATCHER --- const reportCriticalError = (error: any) => { console.error("[Boot] Critical Error Caught:", error); const rootElement = document.getElementById('root'); if (rootElement) { rootElement.innerHTML = `

Application Boot Failed

A script or storage error prevented FarmOps from starting on this machine.

${error?.name || 'Error'}: ${error?.message || 'Unknown initialization failure'}
${error?.stack || 'No stack trace available'}

If this persists, your browser storage may be full or third-party CDNs are being blocked.

`; } }; window.onerror = (message, source, lineno, colno, error) => { reportCriticalError(error || { message, source, stack: `at ${source}:${lineno}:${colno}` }); return true; }; window.onunhandledrejection = (event) => { reportCriticalError(event.reason); }; const boot = () => { console.log("[Boot] Locating root element..."); const rootElement = document.getElementById('root'); if (!rootElement) { console.error("[Boot] Root element missing from DOM!"); return; } try { console.log("[Boot] Triggering React mount..."); const root = createRoot(rootElement); root.render( ); console.log("[Boot] React render loop active."); } catch (e) { reportCriticalError(e); } }; boot();