import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App.tsx'; // Prevent ReferenceErrors for environment variables in the browser (window as any).process = { env: { NODE_ENV: 'production' } }; (window as any).global = window; console.log("IIPL Portal: Initializing Bootloader..."); const mountApp = () => { const rootElement = document.getElementById('iipl-portal-root') || document.getElementById('root'); if (rootElement) { console.log("IIPL Portal: Target found. Mounting application core."); const root = ReactDOM.createRoot(rootElement); root.render( ); } else { console.error("IIPL Portal: Critical Error - Root element not found."); } }; // Handle both standard HTML and WordPress shortcode injection timings if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', mountApp); } else { // If already loaded (common in some WP themes/AJAX loads) mountApp(); }