import { i18n } from '@osd/i18n' ; import { CoreSystem } from './core_system' ; import { ApmSystem } from './apm_system' ; internal export async function __osdBootstrap__ ( ) { const injectedMetadata = JSON . parse ( document . querySelector ( 'osd-injected-metadata' ) ! . getAttribute ( 'data' ) ! ) ; let i18nError ; const apmSystem = new ApmSystem ( injectedMetadata . vars . apmConfig , injectedMetadata . basePath ) ; await Promise . all ( [ apmSystem . setup ( ) . catch ( console . warn ) , i18n . load ( injectedMetadata . i18n . translationsUrl ) . catch ( ( error ) => { i18nError = error ; } ) , ] ) ; const coreSystem = new CoreSystem ( { injectedMetadata , rootDomElement : document . body , browserSupportsCsp : ! ( window as any ) . __osdCspNotEnforced__ , } ) ; const setup = await coreSystem . setup ( ) ; if ( i18nError && setup ) { setup . fatalErrors . add ( i18nError ) ; } const start = await coreSystem . start ( ) ; await apmSystem . start ( start ) ; }