{"version":3,"file":"angular-extensions-elements-src-lib-lazy-elements.mjs","sources":["../../../projects/elements/src/lib/lazy-elements/lazy-elements.tokens.ts","../../../projects/elements/src/lib/lazy-elements/trusted-types.ts","../../../projects/elements/src/lib/lazy-elements/lazy-elements-loader.service.ts","../../../projects/elements/src/lib/lazy-elements/lazy-element/lazy-element.directive.ts","../../../projects/elements/src/lib/lazy-elements/lazy-element-dynamic/lazy-element-dynamic.directive.ts","../../../projects/elements/src/lib/lazy-elements/lazy-elements.module.ts","../../../projects/elements/src/lib/lazy-elements/lazy-elements.providers.ts","../../../projects/elements/src/lib/lazy-elements/angular-extensions-elements-src-lib-lazy-elements.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nimport {\n  ElementConfig,\n  LazyElementRootOptions,\n  LazyElementsRegistry,\n} from './lazy-elements.interface';\n\nexport const LAZY_ELEMENT_CONFIGS = new InjectionToken<ElementConfig[]>(\n  'LAZY_ELEMENT_CONFIGS',\n);\n\nexport const LAZY_ELEMENT_ROOT_OPTIONS =\n  new InjectionToken<LazyElementRootOptions>('LAZY_ELEMENT_ROOT_OPTIONS');\n\nexport const LAZY_ELEMENT_ROOT_GUARD = new InjectionToken<void>(\n  'LAZY_ELEMENT_ROOT_GUARD',\n);\n\nexport const LAZY_ELEMENTS_REGISTRY = new InjectionToken<LazyElementsRegistry>(\n  'LAZY_ELEMENTS_REGISTRY',\n  {\n    providedIn: 'root',\n    factory: () => new Map<string, Promise<void>>(),\n  },\n);\n","export declare interface TrustedTypePolicy {\n  createScriptURL(url: string): string;\n}\n\nexport declare interface TrustedTypePolicyFactory {\n  createPolicy(\n    policyName: string,\n    policyOptions: {\n      createScriptURL?: (url: string) => string;\n    },\n  ): TrustedTypePolicy;\n}\n\nlet policy: TrustedTypePolicy | null | undefined;\n\nexport function getPolicy(): TrustedTypePolicy | null {\n  if (policy === undefined) {\n    policy = null;\n    if (typeof window !== 'undefined') {\n      const ttWindow = window as unknown as {\n        trustedTypes?: TrustedTypePolicyFactory;\n      };\n      if (ttWindow.trustedTypes !== undefined) {\n        policy = ttWindow.trustedTypes.createPolicy(\n          'angular-extensions#elements',\n          {\n            createScriptURL: (url: string) => url,\n          },\n        );\n      }\n    }\n  }\n  return policy;\n}\n","import {\n  ErrorHandler,\n  Injectable,\n  OnDestroy,\n  HostListener,\n  inject,\n} from '@angular/core';\n\nimport type {\n  Hook,\n  ElementConfig,\n  HooksConfig,\n} from './lazy-elements.interface';\nimport {\n  LAZY_ELEMENT_ROOT_OPTIONS,\n  LAZY_ELEMENTS_REGISTRY,\n} from './lazy-elements.tokens';\nimport { getPolicy } from './trusted-types';\n\nconst LOG_PREFIX = '@angular-extensions/elements';\n\ninterface Notifier {\n  resolve: () => void;\n  reject: (error: any) => void;\n}\n\n@Injectable({\n  providedIn: 'root',\n})\nexport class LazyElementsLoaderService implements OnDestroy {\n  static controller = new AbortController();\n\n  readonly #errorHandler = inject(ErrorHandler);\n  readonly #registry = inject(LAZY_ELEMENTS_REGISTRY);\n  public readonly options =\n    inject(LAZY_ELEMENT_ROOT_OPTIONS, { optional: true }) ?? {};\n\n  configs: ElementConfig[] = [];\n\n  @HostListener('unloaded')\n  ngOnDestroy(): void {\n    LazyElementsLoaderService.controller?.abort();\n    LazyElementsLoaderService.controller = null;\n  }\n\n  addConfigs(newConfigs: ElementConfig[]) {\n    newConfigs.forEach((newConfig) => {\n      const existingConfig = this.getElementConfig(newConfig.tag);\n      if (existingConfig) {\n        ngDevMode &&\n          console.warn(\n            `${LOG_PREFIX} - ElementConfig for tag '${newConfig.tag}' was previously added, it will not be added multiple times, continue...`,\n          );\n      } else {\n        newConfig.isAdded = true;\n        this.configs.push(newConfig);\n        const shouldPreload =\n          newConfig.preload !== undefined\n            ? newConfig.preload\n            : this.options.preload;\n        if (shouldPreload) {\n          this.loadElement(\n            newConfig.url,\n            newConfig.tag,\n            newConfig.isModule,\n            newConfig.importMap,\n            newConfig.hooks,\n          );\n        }\n      }\n    });\n  }\n\n  getElementConfig(tag: string): ElementConfig | undefined {\n    return this.configs.find((config) => config.tag === tag);\n  }\n\n  preload(tags?: string[]) {\n    let configs = this.configs;\n    if (tags) {\n      configs = this.configs.filter((config) => tags.includes(config.tag));\n    }\n    configs.forEach((config) =>\n      this.loadElement(\n        config.url,\n        config.tag,\n        config.isModule,\n        config.importMap,\n        config.hooks,\n      ),\n    );\n  }\n\n  async loadElement(\n    url: string | null,\n    tag: string,\n    isModule?: boolean,\n    importMap?: boolean,\n    hooksConfig?: HooksConfig,\n  ): Promise<void> {\n    const config = this.getElementConfig(tag);\n    isModule ??= config?.isModule ?? this.options.isModule;\n    importMap ??= config?.importMap ?? this.options.importMap;\n\n    if (ngDevMode && !tag) {\n      throw new Error(\n        `${LOG_PREFIX} - tag for '${url}' not found, the *axLazyElement has to be used on HTML element`,\n      );\n    }\n\n    if (!url) {\n      if (ngDevMode && !config?.url && !importMap) {\n        throw new Error(`${LOG_PREFIX} - url for <${tag}> not found`);\n      } else if (importMap) {\n        url = tag;\n      } else {\n        url = config!.url;\n      }\n    }\n\n    if (!this.#hasElement(url)) {\n      const notifier = this.#addElement(url);\n\n      const beforeLoadHook =\n        hooksConfig?.beforeLoad ??\n        config?.hooks?.beforeLoad ??\n        this.options?.hooks?.beforeLoad;\n      const afterLoadHook =\n        hooksConfig?.afterLoad ??\n        config?.hooks?.afterLoad ??\n        this.options?.hooks?.afterLoad;\n\n      if (importMap) {\n        url = await this.#resolveImportMap(url);\n      }\n\n      const script = document.createElement('script') as HTMLScriptElement;\n      if (isModule) {\n        script.type = 'module';\n      }\n      script.src = getPolicy()?.createScriptURL(url) ?? url;\n      const onLoad = () => {\n        if (afterLoadHook) {\n          this.#handleHook(afterLoadHook, tag)\n            .then(notifier.resolve)\n            .catch(notifier.reject);\n        } else {\n          notifier.resolve();\n        }\n\n        cleanup();\n      };\n      const onError = (error: ErrorEvent) => {\n        notifier.reject(error);\n        cleanup();\n        // Caretaker note: don't put it before the `reject` and `cleanup` since the user may have some\n        // custom error handler that will re-throw the error through `throw error`. Hence the code won't\n        // be executed, and the promise won't be rejected.\n        this.#errorHandler.handleError(error);\n      };\n      // The `load` and `error` event listeners capture `this`. That's why they have to be removed manually.\n      // Otherwise, the `LazyElementsLoaderService` is not going to be GC'd.\n      function cleanup() {\n        script.removeEventListener('load', onLoad);\n        script.removeEventListener('error', onError);\n      }\n      script.addEventListener('load', onLoad, {\n        signal: LazyElementsLoaderService.controller?.signal,\n      } as AddEventListenerOptions);\n      script.addEventListener('error', onError, {\n        signal: LazyElementsLoaderService.controller?.signal,\n      } as AddEventListenerOptions);\n      if (beforeLoadHook) {\n        this.#handleHook(beforeLoadHook, tag)\n          .then(() => document.body.appendChild(script))\n          .catch(notifier.reject);\n      } else {\n        document.body.appendChild(script);\n      }\n    }\n    return this.#registry.get(this.#stripUrlProtocol(url));\n  }\n\n  #addElement(url: string): Notifier {\n    let notifier: Notifier;\n    this.#registry.set(\n      this.#stripUrlProtocol(url),\n      new Promise<void>((resolve, reject) => (notifier = { resolve, reject })),\n    );\n    return notifier!;\n  }\n\n  #hasElement(url: string): boolean {\n    return this.#registry.has(this.#stripUrlProtocol(url));\n  }\n\n  #stripUrlProtocol(url: string): string {\n    return url.replace(/https?:\\/\\//, '');\n  }\n\n  #handleHook(hook: Hook, tag: string): Promise<void> {\n    try {\n      return Promise.resolve(hook(tag));\n    } catch (err) {\n      return Promise.reject(err);\n    }\n  }\n\n  async #resolveImportMap(url: string) {\n    const System = (window as any).System;\n    if (System) {\n      await System.prepareImport();\n      url = System.resolve(url);\n    } else if (ngDevMode) {\n      throw new Error(\n        `${LOG_PREFIX} - importMap feature depends on SystemJS library to be globally loaded but none was found, thus '${url}' can't be resolved. You should either load SystemJS or remove the importMap flag.`,\n      );\n    }\n    return url;\n  }\n}\n","import {\n  ChangeDetectorRef,\n  DestroyRef,\n  Directive,\n  EmbeddedViewRef,\n  inject,\n  OnInit,\n  PLATFORM_ID,\n  TemplateRef,\n  ViewContainerRef,\n  input,\n} from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\nimport {\n  takeUntilDestroyed,\n  toObservable,\n  toSignal,\n} from '@angular/core/rxjs-interop';\nimport {\n  animationFrameScheduler,\n  BehaviorSubject,\n  EMPTY,\n  from,\n  catchError,\n  debounceTime,\n  mergeMap,\n  switchMap,\n  tap,\n} from 'rxjs';\n\nimport { ElementConfig } from '../lazy-elements.interface';\nimport { LazyElementsLoaderService } from '../lazy-elements-loader.service';\n\nconst LOG_PREFIX = '@angular-extensions/elements';\n\n@Directive({\n  standalone: true,\n  selector: '[axLazyElement]',\n})\nexport class LazyElementDirective implements OnInit {\n  readonly #platformId = inject(PLATFORM_ID);\n  readonly #destroyRef = inject(DestroyRef);\n  readonly #vcr = inject(ViewContainerRef);\n  readonly #cdr = inject(ChangeDetectorRef);\n  readonly #template = inject(TemplateRef<any>);\n  readonly #elementsLoaderService = inject(LazyElementsLoaderService);\n\n  readonly url = input<string | null>(null, { alias: 'axLazyElement' });\n  readonly loadingTemplateRef = input<TemplateRef<any> | null>(null, {\n    alias: 'axLazyElementLoadingTemplate',\n  });\n  readonly errorTemplateRef = input<TemplateRef<any> | null>(null, {\n    alias: 'axLazyElementErrorTemplate',\n  });\n  readonly isModule = input<boolean>(undefined, {\n    alias: 'axLazyElementModule',\n  });\n  readonly importMap = input(false, { alias: 'axLazyElementImportMap' });\n  readonly loadingSuccess = input<() => void>(undefined, {\n    alias: 'axLazyElementLoadingSuccess',\n  });\n  readonly loadingError = input<(error: ErrorEvent) => void>(undefined, {\n    alias: 'axLazyElementLoadingError',\n  });\n\n  #viewRef: EmbeddedViewRef<any> | null = null;\n  #url$ = toObservable(this.url);\n\n  ngOnInit() {\n    // There's no sense to execute the below logic on the Node.js side since the JavaScript\n    // will not be loaded on the server-side (Angular will only append the script to body).\n    // The `loadElement` promise will never be resolved, since it gets resolved when the `load` event is emitted.\n    // `customElements` are also undefined on the Node.js side; thus, it will always render the error template.\n    if (isPlatformServer(this.#platformId)) {\n      return;\n    }\n\n    this.#setupUrlListener();\n  }\n\n  destroyEmbeddedView() {\n    if (this.#viewRef && !this.#viewRef.destroyed) {\n      this.#viewRef.detach();\n      this.#viewRef.destroy();\n      this.#viewRef = null;\n    }\n  }\n\n  #setupUrlListener(): void {\n    const tpl = this.#template as any;\n    const elementTag = tpl._declarationTContainer\n      ? tpl._declarationTContainer.tagName || tpl._declarationTContainer.value\n      : tpl._def.element.#template.nodes[0].element.name;\n\n    const elementConfig =\n      this.#elementsLoaderService.getElementConfig(elementTag) ||\n      ({} as ElementConfig);\n    const options = this.#elementsLoaderService.options;\n    const loadingComponent =\n      elementConfig.loadingComponent || options.loadingComponent;\n\n    this.#url$\n      .pipe(\n        // This is used to coalesce changes since the `url$` subject might emit multiple values initially, e.g.\n        // `null` (initial value) and the url itself (when the `url` binding is provided).\n        // The `animationFrameScheduler` is used to prevent the frame drop.\n        debounceTime(0, animationFrameScheduler),\n        switchMap((url) => {\n          const loadingTemplateRef = this.loadingTemplateRef();\n          if (loadingTemplateRef) {\n            this.#vcr.createEmbeddedView(loadingTemplateRef);\n          } else if (loadingComponent) {\n            this.#vcr.createComponent(loadingComponent);\n          }\n\n          return from(\n            this.#elementsLoaderService.loadElement(\n              url,\n              elementTag,\n              this.isModule(),\n              this.importMap(),\n              elementConfig?.hooks,\n            ),\n          ).pipe(\n            catchError((error) => {\n              this.loadingError()?.(error);\n              this.#vcr.clear();\n              const errorComponent =\n                elementConfig.errorComponent || options.errorComponent;\n              const errorTemplateRef = this.errorTemplateRef();\n              if (errorTemplateRef) {\n                this.#vcr.createEmbeddedView(errorTemplateRef);\n                this.#cdr.markForCheck();\n              } else if (errorComponent) {\n                this.#vcr.createComponent(errorComponent);\n                this.#cdr.markForCheck();\n              } else if (ngDevMode && !this.loadingError()) {\n                console.error(\n                  `${LOG_PREFIX} - Loading of element <${elementTag}> failed, please provide <ng-template #error>Loading failed...</ng-template> and reference it in *axLazyElement=\"errorTemplate: error\" to display customized error message in place of element`,\n                );\n              }\n              return EMPTY;\n            }),\n          );\n        }),\n        tap(() => this.loadingSuccess()?.()),\n        mergeMap(() => customElements.whenDefined(elementTag)),\n        takeUntilDestroyed(this.#destroyRef),\n      )\n      .subscribe({\n        next: () => {\n          this.#vcr.clear();\n          this.#viewRef = this.#vcr.createEmbeddedView(this.#template);\n          this.#cdr.markForCheck();\n        },\n      });\n  }\n}\n","import {\n  ChangeDetectorRef,\n  DestroyRef,\n  Directive,\n  EmbeddedViewRef,\n  inject,\n  OnInit,\n  PLATFORM_ID,\n  Renderer2,\n  TemplateRef,\n  ViewContainerRef,\n  input,\n  DOCUMENT,\n} from '@angular/core';\nimport { isPlatformServer } from '@angular/common';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { from, mergeMap } from 'rxjs';\n\nimport { ElementConfig } from '../lazy-elements.interface';\nimport { LazyElementsLoaderService } from '../lazy-elements-loader.service';\n\nconst LOG_PREFIX = '@angular-extensions/elements';\n\n@Directive({\n  standalone: true,\n  selector: '[axLazyElementDynamic]',\n})\nexport class LazyElementDynamicDirective implements OnInit {\n  readonly tag = input<string | null>(null, { alias: 'axLazyElementDynamic' });\n  readonly url = input<string | null>(null, {\n    alias: 'axLazyElementDynamicUrl',\n  });\n  readonly loadingTemplateRef = input<TemplateRef<any> | null>(null, {\n    alias: 'axLazyElementDynamicLoadingTemplate',\n  });\n  readonly errorTemplateRef = input<TemplateRef<any> | null>(null, {\n    alias: 'axLazyElementDynamicErrorTemplate',\n  });\n  readonly isModule = input(false, { alias: 'axLazyElementDynamicModule' });\n  readonly importMap = input(false, { alias: 'axLazyElementDynamicImportMap' });\n  readonly loadingSuccess = input<() => void>(undefined, {\n    alias: 'axLazyElementLoadingSuccess',\n  });\n  readonly loadingError = input<(error: ErrorEvent) => void>(undefined, {\n    alias: 'axLazyElementLoadingError',\n  });\n\n  #viewRef: EmbeddedViewRef<any> | null = null;\n\n  readonly #destroyRef = inject(DestroyRef);\n  readonly #platformId = inject(PLATFORM_ID);\n  readonly #document = inject(DOCUMENT);\n  readonly #renderer = inject(Renderer2);\n  readonly #vcr = inject(ViewContainerRef);\n  readonly #cdr = inject(ChangeDetectorRef);\n  readonly #template = inject(TemplateRef<any>);\n  readonly #elementsLoaderService = inject(LazyElementsLoaderService);\n\n  ngOnInit() {\n    // There's no sense to execute the below logic on the Node.js side since the JavaScript\n    // will not be loaded on the server-side (Angular will only append the script to body).\n    // The `loadElement` promise will never be resolved, since it gets resolved when the `load` event is emitted.\n    // `customElements` are also undefined on the Node.js side; thus, it will always render the error template.\n    if (isPlatformServer(this.#platformId)) {\n      return;\n    }\n\n    const tagValue = this.tag();\n    if (ngDevMode) {\n      if (!tagValue || tagValue.length === 0 || !tagValue.includes('-')) {\n        throw new Error(\n          `${LOG_PREFIX} - Valid tag has to be specified when using *axLazyElementDynamic directive (use *axLazyElementDynamic=\"'some-tag'\"), got: \"${tagValue}\"`,\n        );\n      }\n    }\n\n    const tag = tagValue!;\n\n    const elementConfig =\n      this.#elementsLoaderService.getElementConfig(tag) ||\n      ({} as ElementConfig);\n    const options = this.#elementsLoaderService.options;\n    const loadingComponent =\n      elementConfig.loadingComponent || options.loadingComponent;\n\n    const loadingTemplateRef = this.loadingTemplateRef();\n    if (loadingTemplateRef) {\n      this.#vcr.createEmbeddedView(loadingTemplateRef);\n    } else if (loadingComponent) {\n      this.#vcr.createComponent(loadingComponent);\n    }\n\n    const loadElement$ = from(\n      this.#elementsLoaderService.loadElement(\n        this.url(),\n        tag,\n        this.isModule(),\n        this.importMap(),\n        elementConfig?.hooks,\n      ),\n    );\n\n    loadElement$\n      .pipe(\n        mergeMap(() => customElements.whenDefined(tag)),\n        takeUntilDestroyed(this.#destroyRef),\n      )\n      .subscribe({\n        next: () => {\n          this.loadingSuccess()?.();\n          this.#vcr.clear();\n          const originalCreateElement = this.#renderer.createElement;\n          this.#renderer.createElement = (name: string, namespace: string) => {\n            if (name === 'ax-lazy-element') {\n              name = tag;\n            }\n            return this.#document.createElement(name);\n          };\n          this.#viewRef = this.#vcr.createEmbeddedView(this.#template);\n          this.#renderer.createElement = originalCreateElement;\n          this.#cdr.markForCheck();\n        },\n        error: (error) => {\n          this.loadingError()?.(error);\n          const errorComponent =\n            elementConfig.errorComponent || options.errorComponent;\n          this.#vcr.clear();\n          const errorTemplateRef = this.errorTemplateRef();\n          if (errorTemplateRef) {\n            this.#vcr.createEmbeddedView(errorTemplateRef);\n            this.#cdr.markForCheck();\n          } else if (errorComponent) {\n            this.#vcr.createComponent(errorComponent);\n            this.#cdr.markForCheck();\n          } else if (ngDevMode && !this.loadingError()) {\n            console.error(\n              `${LOG_PREFIX} - Loading of element <${this.tag()}> failed, please provide <ng-template #error>Loading failed...</ng-template> and reference it in *axLazyElementDynamic=\"errorTemplate: error\" to display customized error message in place of element\\n\\n`,\n              error,\n            );\n          }\n        },\n      });\n  }\n\n  destroyEmbeddedView() {\n    if (this.#viewRef && !this.#viewRef.destroyed) {\n      this.#viewRef.detach();\n      this.#viewRef.destroy();\n      this.#viewRef = null;\n    }\n  }\n}\n","import {\n  inject,\n  ModuleWithProviders,\n  NgModule,\n  Optional,\n  SkipSelf,\n} from '@angular/core';\n\nimport {\n  ElementConfig,\n  LazyElementModuleOptions,\n  LazyElementModuleRootOptions,\n  LazyElementRootOptions,\n} from './lazy-elements.interface';\nimport {\n  LAZY_ELEMENT_CONFIGS,\n  LAZY_ELEMENT_ROOT_GUARD,\n  LAZY_ELEMENT_ROOT_OPTIONS,\n} from './lazy-elements.tokens';\nimport { LazyElementDirective } from './lazy-element/lazy-element.directive';\nimport { LazyElementDynamicDirective } from './lazy-element-dynamic/lazy-element-dynamic.directive';\nimport { LazyElementsLoaderService } from './lazy-elements-loader.service';\n\nexport function createLazyElementRootGuard(\n  rootOptions: LazyElementRootOptions,\n) {\n  if (ngDevMode && rootOptions) {\n    throw new TypeError(\n      `LazyElementsModule.forRoot() called twice. Lazy feature modules should use LazyElementsModule.forFeature() instead.`,\n    );\n  }\n  return 'LazyElementsModule.forRoot() multiple execution guard';\n}\n\n@NgModule({\n  imports: [LazyElementDirective, LazyElementDynamicDirective],\n  exports: [LazyElementDirective, LazyElementDynamicDirective],\n})\nexport class LazyElementsModule {\n  static forRoot(\n    options: LazyElementModuleRootOptions,\n  ): ModuleWithProviders<LazyElementsModule> {\n    return {\n      ngModule: LazyElementsModule,\n      providers: [\n        {\n          provide: LAZY_ELEMENT_CONFIGS,\n          useValue:\n            options && options.elementConfigs ? options.elementConfigs : [],\n          multi: true,\n        },\n        {\n          provide: LAZY_ELEMENT_ROOT_OPTIONS,\n          useValue: options.rootOptions ? options.rootOptions : {},\n        },\n        {\n          provide: LAZY_ELEMENT_ROOT_GUARD,\n          useFactory: createLazyElementRootGuard,\n          deps: [[LAZY_ELEMENT_ROOT_OPTIONS, new Optional(), new SkipSelf()]],\n        },\n      ],\n    };\n  }\n\n  static forFeature(\n    options: LazyElementModuleOptions,\n  ): ModuleWithProviders<LazyElementsModule> {\n    return {\n      ngModule: LazyElementsModule,\n      providers: [\n        {\n          provide: LAZY_ELEMENT_CONFIGS,\n          useValue:\n            options && options.elementConfigs ? options.elementConfigs : [],\n          multi: true,\n        },\n      ],\n    };\n  }\n\n  readonly lazyElementsLoaderService = inject(LazyElementsLoaderService);\n  readonly elementConfigsMultiProvider = inject<ElementConfig[][]>(\n    LAZY_ELEMENT_CONFIGS,\n    { optional: true },\n  );\n  readonly guard = inject(LAZY_ELEMENT_ROOT_GUARD, { optional: true });\n\n  constructor() {\n    if (\n      this.elementConfigsMultiProvider &&\n      this.elementConfigsMultiProvider.length\n    ) {\n      this.elementConfigsMultiProvider\n        .filter((configs) => configs.some((config) => !config.isAdded))\n        .forEach((configs) =>\n          this.lazyElementsLoaderService.addConfigs(configs),\n        );\n    }\n  }\n}\n","import {\n  ENVIRONMENT_INITIALIZER,\n  EnvironmentProviders,\n  inject,\n  makeEnvironmentProviders,\n  Optional,\n  SkipSelf,\n} from '@angular/core';\n\nimport {\n  ElementConfig,\n  LazyElementOptions,\n  LazyElementRootOptions,\n} from './lazy-elements.interface';\nimport {\n  LAZY_ELEMENT_CONFIGS,\n  LAZY_ELEMENT_ROOT_OPTIONS,\n  LAZY_ELEMENT_ROOT_GUARD,\n} from './lazy-elements.tokens';\nimport { LazyElementsLoaderService } from './lazy-elements-loader.service';\n\nexport function createProvideLazyElementsGuard(\n  rootOptions: LazyElementRootOptions,\n) {\n  if (ngDevMode && rootOptions) {\n    throw new TypeError(\n      `provideAxLazyElements() called twice. Lazy feature modules should use provideAxLazyElementsConfigs() instead.`,\n    );\n  }\n  return 'provideAxLazyElements() multiple execution guard';\n}\n\nexport function provideAxLazyElements(\n  options: LazyElementOptions = {},\n): EnvironmentProviders {\n  return makeEnvironmentProviders([\n    {\n      provide: LAZY_ELEMENT_CONFIGS,\n      useValue: options && options.elementConfigs ? options.elementConfigs : [],\n      multi: true,\n    },\n    {\n      provide: LAZY_ELEMENT_ROOT_OPTIONS,\n      useValue: options.rootOptions ? options.rootOptions : {},\n    },\n    {\n      provide: LAZY_ELEMENT_ROOT_GUARD,\n      useFactory: createProvideLazyElementsGuard,\n      deps: [[LAZY_ELEMENT_ROOT_OPTIONS, new Optional(), new SkipSelf()]],\n    },\n    {\n      multi: true,\n      provide: ENVIRONMENT_INITIALIZER,\n      useValue: () => {\n        inject(LAZY_ELEMENT_ROOT_GUARD, { optional: true });\n\n        const lazyElementsLoaderService = inject(LazyElementsLoaderService);\n        const elementConfigsMultiProvider = inject<ElementConfig[][]>(\n          LAZY_ELEMENT_CONFIGS,\n          { optional: true },\n        );\n\n        if (elementConfigsMultiProvider && elementConfigsMultiProvider.length) {\n          elementConfigsMultiProvider\n            .filter((configs) => configs.some((config) => !config.isAdded))\n            .forEach((configs) =>\n              lazyElementsLoaderService.addConfigs(configs),\n            );\n        }\n      },\n    },\n  ]);\n}\n\nexport function provideAxLazyElementsConfigs(configs: ElementConfig[] = []) {\n  return makeEnvironmentProviders([\n    {\n      provide: LAZY_ELEMENT_CONFIGS,\n      useValue: configs && configs.length ? configs : [],\n      multi: true,\n    },\n    {\n      multi: true,\n      provide: ENVIRONMENT_INITIALIZER,\n      useValue: () => {\n        inject(LAZY_ELEMENT_ROOT_GUARD, { optional: true });\n\n        const lazyElementsLoaderService = inject(LazyElementsLoaderService);\n        const elementConfigsMultiProvider = inject<ElementConfig[][]>(\n          LAZY_ELEMENT_CONFIGS,\n          { optional: true },\n        );\n\n        if (elementConfigsMultiProvider && elementConfigsMultiProvider.length) {\n          elementConfigsMultiProvider\n            .filter((configs) => configs.some((config) => !config.isAdded))\n            .forEach((configs) =>\n              lazyElementsLoaderService.addConfigs(configs),\n            );\n        }\n      },\n    },\n  ]);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["LOG_PREFIX"],"mappings":";;;;;;MAQa,oBAAoB,GAAG,IAAI,cAAc,CACpD,sBAAsB;MAGX,yBAAyB,GACpC,IAAI,cAAc,CAAyB,2BAA2B;MAE3D,uBAAuB,GAAG,IAAI,cAAc,CACvD,yBAAyB;MAGd,sBAAsB,GAAG,IAAI,cAAc,CACtD,wBAAwB,EACxB;AACE,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,MAAM,IAAI,GAAG,EAAyB;AAChD,CAAA;;ACXH,IAAI,MAA4C;SAEhC,SAAS,GAAA;AACvB,IAAA,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,MAAM,GAAG,IAAI;AACb,QAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,MAAM,QAAQ,GAAG,MAEhB;AACD,YAAA,IAAI,QAAQ,CAAC,YAAY,KAAK,SAAS,EAAE;gBACvC,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,YAAY,CACzC,6BAA6B,EAC7B;AACE,oBAAA,eAAe,EAAE,CAAC,GAAW,KAAK,GAAG;AACtC,iBAAA,CACF;YACH;QACF;IACF;AACA,IAAA,OAAO,MAAM;AACf;;ACdA,MAAMA,YAAU,GAAG,8BAA8B;MAUpC,yBAAy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