// Main entry point for Calendar Plantempus import { eventBus } from './core/EventBus.js'; import { calendarConfig } from './core/CalendarConfig.js'; import { CalendarTypeFactory } from './factories/CalendarTypeFactory.js'; import { ManagerFactory } from './factories/ManagerFactory.js'; /** * Initialize the calendar application with simple direct calls */ async function initializeCalendar(): Promise { try { // Use the singleton calendar configuration const config = calendarConfig; // Initialize the CalendarTypeFactory before creating managers CalendarTypeFactory.initialize(); // Create managers using factory pattern const managerFactory = ManagerFactory.getInstance(); const managers = managerFactory.createManagers(eventBus, config); // Enable debug mode for development eventBus.setDebug(true); // Initialize all managers await managerFactory.initializeManagers(managers); // Expose to window for debugging (window as any).calendarDebug = { eventBus, ...managers }; } catch (error) { throw error; } } // Initialize when DOM is ready - now handles async properly if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { initializeCalendar().catch(error => { }); }); } else { initializeCalendar().catch(error => { }); }