import App from './App.svelte';
import { mount } from 'svelte';

// Register service worker for PWA and push notifications
if ('serviceWorker' in navigator) {
  navigator.serviceWorker.register('/sw.js')
    .then((registration) => {
      console.log('[Nūr] SW registered:', registration.scope);
      
      // Check for updates periodically
      setInterval(() => registration.update(), 60 * 60 * 1000);
    })
    .catch((error) => {
      console.error('[Nūr] SW registration failed:', error);
    });
}

const app = mount(App, { target: document.getElementById('app') });
export default app;