import React, { StrictMode, Component, ErrorInfo, ReactNode } from 'react'; import { createRoot } from 'react-dom/client'; import App from './App.tsx'; import './index.css'; interface RootErrorBoundaryProps { children: ReactNode; } interface RootErrorBoundaryState { hasError: boolean; error: Error | null; } class RootErrorBoundary extends Component { constructor(props: RootErrorBoundaryProps) { super(props); this.state = { hasError: false, error: null }; } static getDerivedStateFromError(error: Error) { return { hasError: true, error }; } componentDidCatch(error: Error, errorInfo: ErrorInfo) { console.error('[App Root Error Caught]:', error, errorInfo); } handleReset = () => { localStorage.clear(); sessionStorage.clear(); window.location.reload(); }; render() { if (this.state.hasError) { return (

Application Error

An unexpected issue occurred while rendering the application.

{this.state.error?.message || 'Unknown runtime error'}
); } return this.props.children; } } const rootElement = document.getElementById('root'); if (rootElement) { createRoot(rootElement).render( , ); } else { console.error('Failed to find root element #root'); }