import { bootstrapApplication } from '@angular/platform-browser';
import { provideHttpClient } from '@angular/common/http';
import { registerLocaleData } from '@angular/common';
import { LOCALE_ID, provideZonelessChangeDetection, APP_INITIALIZER } from '@angular/core';
import localeFr from '@angular/common/locales/fr';

import { AppComponent } from './src/app.component';
import { provideViewers } from './src/app/services/file-viewer-registry.service';
import { initializeRouterLogging } from './src/core/logging/log.router-listener';
import { initializeVisibilityLogging } from './src/core/logging/log.visibility-listener';

registerLocaleData(localeFr);

bootstrapApplication(AppComponent, {
  providers: [
    provideZonelessChangeDetection(),
    provideHttpClient(),
    { provide: LOCALE_ID, useValue: 'fr' },
    ...provideViewers(),
    {
      provide: APP_INITIALIZER,
      useFactory: initializeRouterLogging,
      multi: true,
    },
    {
      provide: APP_INITIALIZER,
      useFactory: initializeVisibilityLogging,
      multi: true,
    },
  ],
}).catch(err => console.error(err));

// AI Studio always uses an `index.tsx` file for all project types.
