/**
 * Design System Server - Main Entry Point
 *
 * Vite module entry point that initializes the application
 */

// Import CSS bundle first to ensure all styles are loaded before components render
import './css-bundle.js'
import app from './core/app.js'

// Initialize application when DOM is ready
if (document.readyState === 'loading') {
  document.addEventListener('DOMContentLoaded', initApp)
} else {
  initApp()
}

function initApp() {
  console.log('Initializing Design System Server v1.0.0...')
  app.init().catch(error => {
    console.error('Failed to initialize application:', error)
  })
}

// Enable hot module reloading in development
if (import.meta.hot) {
  import.meta.hot.accept('./core/app.js', (newModule) => {
    console.log('App module hot-reloaded')
  })
}
