import { verifyStartup, showCompatibilityError } from './startup-check.js';
const startupResults = verifyStartup();
if (startupResults.failed.length > 0) {
console.error('Startup checks failed:', startupResults.failed);
showCompatibilityError(startupResults);
} else {
console.log('All startup checks passed');
import('./app.js').then(({ default: app }) => {
return Promise.all([
import('./components/error-boundary.js'),
import('./components/mywebdav-app.js')
]).then(([errorBoundary, mywebdavApp]) => {
if (!app.isReady()) {
console.error('CRITICAL: Application failed to initialize properly');
document.body.innerHTML = `
Application Failed to Initialize
Please refresh the page. If the problem persists, check the console for errors.
`;
return;
}
customElements.define('mywebdav-app', mywebdavApp.RBoxApp);
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker.register('/static/service-worker.js').then(() => {
app.getLogger().info('Service worker registered successfully');
}).catch((error) => {
app.getLogger().error('Service worker registration failed', error);
});
});
}
app.getLogger().info('Main application loaded successfully');
window.addEventListener('load', () => {
app.getLazyLoader().observeAll('[data-src]');
app.getLogger().info('Application fully ready');
});
});
}).catch((error) => {
console.error('Failed to load application modules:', error);
document.body.innerHTML = `
Failed to Load Application
${error.message}
`;
});
}