@angular/router 14.0.1 → 14.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Angular v14.0.1
2
+ * @license Angular v14.0.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i3 from '@angular/common';
8
- import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
8
+ import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
9
9
  import * as i0 from '@angular/core';
10
- import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
10
+ import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, Inject, ApplicationRef, ENVIRONMENT_INITIALIZER, Version } from '@angular/core';
11
11
  import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
12
12
  import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, mapTo, finalize, refCount, defaultIfEmpty, mergeAll } from 'rxjs/operators';
13
13
  import * as i1 from '@angular/platform-browser';
@@ -2230,7 +2230,10 @@ class RouterOutlet {
2230
2230
  }
2231
2231
  /** @nodoc */
2232
2232
  ngOnDestroy() {
2233
- this.parentContexts.onChildOutletDestroyed(this.name);
2233
+ // Ensure that the registered outlet is this one before removing it on the context.
2234
+ if (this.parentContexts.getContext(this.name)?.outlet === this) {
2235
+ this.parentContexts.onChildOutletDestroyed(this.name);
2236
+ }
2234
2237
  }
2235
2238
  /** @nodoc */
2236
2239
  ngOnInit() {
@@ -2328,9 +2331,9 @@ class RouterOutlet {
2328
2331
  this.activateEvents.emit(this.activated.instance);
2329
2332
  }
2330
2333
  }
2331
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2332
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2333
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterOutlet, decorators: [{
2334
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2335
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2336
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterOutlet, decorators: [{
2334
2337
  type: Directive,
2335
2338
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2336
2339
  }], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
@@ -2387,9 +2390,9 @@ function isComponentFactoryResolver(item) {
2387
2390
  */
2388
2391
  class ɵEmptyOutletComponent {
2389
2392
  }
2390
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2391
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.1", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2393
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2394
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.0.4", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2393
2396
  type: Component,
2394
2397
  args: [{ template: `<router-outlet></router-outlet>` }]
2395
2398
  }] });
@@ -3651,7 +3654,7 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3651
3654
  * Use of this source code is governed by an MIT-style license that can be
3652
3655
  * found in the LICENSE file at https://angular.io/license
3653
3656
  */
3654
- const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3657
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3655
3658
  class NoMatch {
3656
3659
  }
3657
3660
  function newObservableError(e) {
@@ -3772,7 +3775,7 @@ class Recognizer {
3772
3775
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3773
3776
  // production bundle size. This value is intended only to surface a warning to users
3774
3777
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3775
- (NG_DEV_MODE$2 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3778
+ (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3776
3779
  pathIndexShift));
3777
3780
  }
3778
3781
  else {
@@ -3783,7 +3786,7 @@ class Recognizer {
3783
3786
  consumedSegments = result.consumedSegments;
3784
3787
  remainingSegments = result.remainingSegments;
3785
3788
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3786
- snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$2 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3789
+ snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3787
3790
  pathIndexShift));
3788
3791
  }
3789
3792
  const childConfig = getChildConfig(route);
@@ -4087,7 +4090,7 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4087
4090
  * Use of this source code is governed by an MIT-style license that can be
4088
4091
  * found in the LICENSE file at https://angular.io/license
4089
4092
  */
4090
- const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4093
+ const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4091
4094
  /**
4092
4095
  * The [DI token](guide/glossary/#di-token) for a router configuration.
4093
4096
  *
@@ -4121,7 +4124,7 @@ class RouterConfigLoader {
4121
4124
  if (this.onLoadEndListener) {
4122
4125
  this.onLoadEndListener(route);
4123
4126
  }
4124
- NG_DEV_MODE$1 && assertStandalone(route.path ?? '', component);
4127
+ NG_DEV_MODE$2 && assertStandalone(route.path ?? '', component);
4125
4128
  route._loadedComponent = component;
4126
4129
  }), finalize(() => {
4127
4130
  this.componentLoaders.delete(route);
@@ -4164,7 +4167,7 @@ class RouterConfigLoader {
4164
4167
  rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4165
4168
  }
4166
4169
  const routes = rawRoutes.map(standardizeConfig);
4167
- NG_DEV_MODE$1 && validateConfig(routes, route.path, requireStandaloneComponents);
4170
+ NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
4168
4171
  return { routes, injector };
4169
4172
  }), finalize(() => {
4170
4173
  this.childrenLoaders.delete(route);
@@ -4186,9 +4189,9 @@ class RouterConfigLoader {
4186
4189
  }));
4187
4190
  }
4188
4191
  }
4189
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4190
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterConfigLoader });
4191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4192
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4193
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader });
4194
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterConfigLoader, decorators: [{
4192
4195
  type: Injectable
4193
4196
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4194
4197
 
@@ -4230,19 +4233,13 @@ class DefaultUrlHandlingStrategy {
4230
4233
  * Use of this source code is governed by an MIT-style license that can be
4231
4234
  * found in the LICENSE file at https://angular.io/license
4232
4235
  */
4233
- const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
4236
+ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4234
4237
  function defaultErrorHandler(error) {
4235
4238
  throw error;
4236
4239
  }
4237
4240
  function defaultMalformedUriErrorHandler(error, urlSerializer, url) {
4238
4241
  return urlSerializer.parse('/');
4239
4242
  }
4240
- /**
4241
- * @internal
4242
- */
4243
- function defaultRouterHook(snapshot, runExtras) {
4244
- return of(null);
4245
- }
4246
4243
  /**
4247
4244
  * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`
4248
4245
  * (exact = true).
@@ -4322,13 +4319,12 @@ class Router {
4322
4319
  this.navigated = false;
4323
4320
  this.lastSuccessfulId = -1;
4324
4321
  /**
4325
- * Hooks that enable you to pause navigation,
4326
- * either before or after the preactivation phase.
4322
+ * Hook that enables you to pause navigation after the preactivation phase.
4327
4323
  * Used by `RouterModule`.
4328
4324
  *
4329
4325
  * @internal
4330
4326
  */
4331
- this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook };
4327
+ this.afterPreactivation = () => of(void 0);
4332
4328
  /**
4333
4329
  * A strategy for extracting and merging URLs.
4334
4330
  * Used for AngularJS to Angular migrations.
@@ -4553,17 +4549,6 @@ class Router {
4553
4549
  }
4554
4550
  }
4555
4551
  }),
4556
- // Before Preactivation
4557
- switchTap(t => {
4558
- const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
4559
- return this.hooks.beforePreactivation(targetSnapshot, {
4560
- navigationId,
4561
- appliedUrlTree,
4562
- rawUrlTree,
4563
- skipLocationChange: !!skipLocationChange,
4564
- replaceUrl: !!replaceUrl,
4565
- });
4566
- }),
4567
4552
  // --- GUARDS ---
4568
4553
  tap(t => {
4569
4554
  const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
@@ -4610,18 +4595,7 @@ class Router {
4610
4595
  }));
4611
4596
  }
4612
4597
  return undefined;
4613
- }),
4614
- // --- AFTER PREACTIVATION ---
4615
- switchTap((t) => {
4616
- const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
4617
- return this.hooks.afterPreactivation(targetSnapshot, {
4618
- navigationId,
4619
- appliedUrlTree,
4620
- rawUrlTree,
4621
- skipLocationChange: !!skipLocationChange,
4622
- replaceUrl: !!replaceUrl,
4623
- });
4624
- }),
4598
+ }), switchTap(() => this.afterPreactivation()),
4625
4599
  // --- LOAD COMPONENTS ---
4626
4600
  switchTap((t) => {
4627
4601
  const loadComponents = (route) => {
@@ -4838,7 +4812,7 @@ class Router {
4838
4812
  * ```
4839
4813
  */
4840
4814
  resetConfig(config) {
4841
- NG_DEV_MODE && validateConfig(config);
4815
+ NG_DEV_MODE$1 && validateConfig(config);
4842
4816
  this.config = config.map(standardizeConfig);
4843
4817
  this.navigated = false;
4844
4818
  this.lastSuccessfulId = -1;
@@ -5193,9 +5167,9 @@ class Router {
5193
5167
  return { navigationId };
5194
5168
  }
5195
5169
  }
5196
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5197
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: Router });
5198
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: Router, decorators: [{
5170
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5171
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router });
5172
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: Router, decorators: [{
5199
5173
  type: Injectable
5200
5174
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5201
5175
  function validateCommands(commands) {
@@ -5394,9 +5368,9 @@ class RouterLink {
5394
5368
  });
5395
5369
  }
5396
5370
  }
5397
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5398
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5399
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLink, decorators: [{
5371
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5372
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5373
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLink, decorators: [{
5400
5374
  type: Directive,
5401
5375
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5402
5376
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
@@ -5513,9 +5487,9 @@ class RouterLinkWithHref {
5513
5487
  });
5514
5488
  }
5515
5489
  }
5516
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5517
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5518
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5490
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5491
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5492
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5519
5493
  type: Directive,
5520
5494
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5521
5495
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5740,9 +5714,9 @@ class RouterLinkActive {
5740
5714
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5741
5715
  }
5742
5716
  }
5743
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5744
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.1", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5745
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterLinkActive, decorators: [{
5717
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5718
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.0.4", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5719
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterLinkActive, decorators: [{
5746
5720
  type: Directive,
5747
5721
  args: [{
5748
5722
  selector: '[routerLinkActive]',
@@ -5845,9 +5819,9 @@ class DefaultTitleStrategy extends TitleStrategy {
5845
5819
  }
5846
5820
  }
5847
5821
  }
5848
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5849
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5850
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5822
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5823
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5824
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5851
5825
  type: Injectable,
5852
5826
  args: [{ providedIn: 'root' }]
5853
5827
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -5884,6 +5858,12 @@ class PreloadAllModules {
5884
5858
  return fn().pipe(catchError(() => of(null)));
5885
5859
  }
5886
5860
  }
5861
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5862
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
5863
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: PreloadAllModules, decorators: [{
5864
+ type: Injectable,
5865
+ args: [{ providedIn: 'root' }]
5866
+ }] });
5887
5867
  /**
5888
5868
  * @description
5889
5869
  *
@@ -5898,6 +5878,12 @@ class NoPreloading {
5898
5878
  return of(null);
5899
5879
  }
5900
5880
  }
5881
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5882
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
5883
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: NoPreloading, decorators: [{
5884
+ type: Injectable,
5885
+ args: [{ providedIn: 'root' }]
5886
+ }] });
5901
5887
  /**
5902
5888
  * The preloader optimistically loads all router configurations to
5903
5889
  * make navigations into lazily-loaded sections of the application faster.
@@ -5980,9 +5966,9 @@ class RouterPreloader {
5980
5966
  });
5981
5967
  }
5982
5968
  }
5983
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
5984
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterPreloader });
5985
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterPreloader, decorators: [{
5969
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
5970
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader });
5971
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterPreloader, decorators: [{
5986
5972
  type: Injectable
5987
5973
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
5988
5974
 
@@ -5993,6 +5979,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
5993
5979
  * Use of this source code is governed by an MIT-style license that can be
5994
5980
  * found in the LICENSE file at https://angular.io/license
5995
5981
  */
5982
+ const ROUTER_SCROLLER = new InjectionToken('');
5996
5983
  class RouterScroller {
5997
5984
  constructor(router,
5998
5985
  /** @docsNotRequired */ viewportScroller, options = {}) {
@@ -6068,9 +6055,9 @@ class RouterScroller {
6068
6055
  }
6069
6056
  }
6070
6057
  }
6071
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6072
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterScroller });
6073
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterScroller, decorators: [{
6058
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6059
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller });
6060
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterScroller, decorators: [{
6074
6061
  type: Injectable
6075
6062
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6076
6063
 
@@ -6081,6 +6068,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
6081
6068
  * Use of this source code is governed by an MIT-style license that can be
6082
6069
  * found in the LICENSE file at https://angular.io/license
6083
6070
  */
6071
+ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6084
6072
  /**
6085
6073
  * The directives defined in the `RouterModule`.
6086
6074
  */
@@ -6090,11 +6078,15 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
6090
6078
  *
6091
6079
  * @publicApi
6092
6080
  */
6093
- const ROUTER_CONFIGURATION = new InjectionToken('ROUTER_CONFIGURATION');
6081
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6082
+ providedIn: 'root',
6083
+ factory: () => ({}),
6084
+ });
6094
6085
  /**
6095
6086
  * @docsNotRequired
6096
6087
  */
6097
- const ROUTER_FORROOT_GUARD = new InjectionToken('ROUTER_FORROOT_GUARD');
6088
+ const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6089
+ const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6098
6090
  const ROUTER_PROVIDERS = [
6099
6091
  Location,
6100
6092
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
@@ -6109,10 +6101,6 @@ const ROUTER_PROVIDERS = [
6109
6101
  },
6110
6102
  ChildrenOutletContexts,
6111
6103
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6112
- RouterPreloader,
6113
- NoPreloading,
6114
- PreloadAllModules,
6115
- { provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
6116
6104
  RouterConfigLoader,
6117
6105
  ];
6118
6106
  function routerNgProbeToken() {
@@ -6165,6 +6153,7 @@ class RouterModule {
6165
6153
  ngModule: RouterModule,
6166
6154
  providers: [
6167
6155
  ROUTER_PROVIDERS,
6156
+ NG_DEV_MODE ? (config?.enableTracing ? provideTracing() : []) : [],
6168
6157
  provideRoutes(routes),
6169
6158
  {
6170
6159
  provide: ROUTER_FORROOT_GUARD,
@@ -6172,22 +6161,11 @@ class RouterModule {
6172
6161
  deps: [[Router, new Optional(), new SkipSelf()]]
6173
6162
  },
6174
6163
  { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
6175
- {
6176
- provide: LocationStrategy,
6177
- useFactory: provideLocationStrategy,
6178
- deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION]
6179
- },
6180
- {
6181
- provide: RouterScroller,
6182
- useFactory: createRouterScroller,
6183
- deps: [Router, ViewportScroller, ROUTER_CONFIGURATION]
6184
- },
6185
- {
6186
- provide: PreloadingStrategy,
6187
- useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
6188
- NoPreloading
6189
- },
6164
+ config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
6165
+ provideRouterScroller(),
6166
+ config?.preloadingStrategy ? providePreloading(config.preloadingStrategy) : [],
6190
6167
  { provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
6168
+ config?.initialNavigation ? provideInitialNavigation(config) : [],
6191
6169
  provideRouterInitializer(),
6192
6170
  ],
6193
6171
  };
@@ -6212,10 +6190,10 @@ class RouterModule {
6212
6190
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6213
6191
  }
6214
6192
  }
6215
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6216
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.1", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6217
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterModule });
6218
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterModule, decorators: [{
6193
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6194
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6195
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule });
6196
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.4", ngImport: i0, type: RouterModule, decorators: [{
6219
6197
  type: NgModule,
6220
6198
  args: [{
6221
6199
  declarations: ROUTER_DIRECTIVES,
@@ -6229,18 +6207,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImpor
6229
6207
  }] }, { type: Router, decorators: [{
6230
6208
  type: Optional
6231
6209
  }] }]; } });
6232
- function createRouterScroller(router, viewportScroller, config) {
6233
- if (config.scrollOffset) {
6234
- viewportScroller.setOffset(config.scrollOffset);
6235
- }
6236
- return new RouterScroller(router, viewportScroller, config);
6210
+ function provideRouterScroller() {
6211
+ return {
6212
+ provide: ROUTER_SCROLLER,
6213
+ useFactory: () => {
6214
+ const router = inject(Router);
6215
+ const viewportScroller = inject(ViewportScroller);
6216
+ const config = inject(ROUTER_CONFIGURATION);
6217
+ if (config.scrollOffset) {
6218
+ viewportScroller.setOffset(config.scrollOffset);
6219
+ }
6220
+ return new RouterScroller(router, viewportScroller, config);
6221
+ },
6222
+ };
6223
+ }
6224
+ function provideHashLocationStrategy() {
6225
+ return { provide: LocationStrategy, useClass: HashLocationStrategy };
6237
6226
  }
6238
- function provideLocationStrategy(platformLocationStrategy, baseHref, options = {}) {
6239
- return options.useHash ? new HashLocationStrategy(platformLocationStrategy, baseHref) :
6240
- new PathLocationStrategy(platformLocationStrategy, baseHref);
6227
+ function providePathLocationStrategy() {
6228
+ return { provide: LocationStrategy, useClass: PathLocationStrategy };
6241
6229
  }
6242
6230
  function provideForRootGuard(router) {
6243
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && router) {
6231
+ if (NG_DEV_MODE && router) {
6244
6232
  throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6245
6233
  }
6246
6234
  return 'guarded';
@@ -6277,16 +6265,6 @@ function setupRouter(urlSerializer, contexts, location, injector, compiler, conf
6277
6265
  }
6278
6266
  router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
6279
6267
  assignExtraOptionsToRouter(opts, router);
6280
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && opts.enableTracing) {
6281
- router.events.subscribe((e) => {
6282
- // tslint:disable:no-console
6283
- console.group?.(`Router Event: ${e.constructor.name}`);
6284
- console.log(stringifyEvent(e));
6285
- console.log(e);
6286
- console.groupEnd?.();
6287
- // tslint:enable:no-console
6288
- });
6289
- }
6290
6268
  return router;
6291
6269
  }
6292
6270
  function assignExtraOptionsToRouter(opts, router) {
@@ -6315,112 +6293,136 @@ function assignExtraOptionsToRouter(opts, router) {
6315
6293
  function rootRoute(router) {
6316
6294
  return router.routerState.root;
6317
6295
  }
6318
- /**
6319
- * Router initialization requires two steps:
6320
- *
6321
- * First, we start the navigation in a `APP_INITIALIZER` to block the bootstrap if
6322
- * a resolver or a guard executes asynchronously.
6323
- *
6324
- * Next, we actually run activation in a `BOOTSTRAP_LISTENER`, using the
6325
- * `afterPreactivation` hook provided by the router.
6326
- * The router navigation starts, reaches the point when preactivation is done, and then
6327
- * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
6328
- */
6329
- class RouterInitializer {
6330
- constructor(injector) {
6331
- this.injector = injector;
6332
- this.initNavigation = false;
6333
- this.destroyed = false;
6334
- this.resultOfPreactivationDone = new Subject();
6335
- }
6336
- appInitializer() {
6337
- const p = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6338
- return p.then(() => {
6339
- // If the injector was destroyed, the DI lookups below will fail.
6340
- if (this.destroyed) {
6341
- return Promise.resolve(true);
6342
- }
6343
- let resolve = null;
6344
- const res = new Promise(r => resolve = r);
6345
- const router = this.injector.get(Router);
6346
- const opts = this.injector.get(ROUTER_CONFIGURATION);
6347
- if (opts.initialNavigation === 'disabled') {
6348
- router.setUpLocationChangeListener();
6349
- resolve(true);
6350
- }
6351
- else if (opts.initialNavigation === 'enabledBlocking') {
6352
- router.hooks.afterPreactivation = () => {
6353
- // only the initial navigation should be delayed
6354
- if (!this.initNavigation) {
6355
- this.initNavigation = true;
6356
- resolve(true);
6357
- return this.resultOfPreactivationDone;
6358
- // subsequent navigations should not be delayed
6359
- }
6360
- else {
6361
- return of(null);
6362
- }
6363
- };
6364
- router.initialNavigation();
6365
- }
6366
- else {
6367
- resolve(true);
6368
- }
6369
- return res;
6370
- });
6371
- }
6372
- bootstrapListener(bootstrappedComponentRef) {
6373
- const opts = this.injector.get(ROUTER_CONFIGURATION);
6374
- const preloader = this.injector.get(RouterPreloader);
6375
- const routerScroller = this.injector.get(RouterScroller);
6376
- const router = this.injector.get(Router);
6377
- const ref = this.injector.get(ApplicationRef);
6296
+ function getBootstrapListener() {
6297
+ const injector = inject(Injector);
6298
+ return (bootstrappedComponentRef) => {
6299
+ const ref = injector.get(ApplicationRef);
6378
6300
  if (bootstrappedComponentRef !== ref.components[0]) {
6379
6301
  return;
6380
6302
  }
6303
+ const router = injector.get(Router);
6304
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6381
6305
  // Default case
6382
- if (opts.initialNavigation === 'enabledNonBlocking' || opts.initialNavigation === undefined) {
6306
+ if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6383
6307
  router.initialNavigation();
6384
6308
  }
6385
- preloader.setUpPreloading();
6386
- routerScroller.init();
6309
+ injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
6310
+ injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
6387
6311
  router.resetRootComponentType(ref.componentTypes[0]);
6388
- this.resultOfPreactivationDone.next(null);
6389
- this.resultOfPreactivationDone.complete();
6390
- }
6391
- ngOnDestroy() {
6392
- this.destroyed = true;
6393
- }
6394
- }
6395
- RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
6396
- RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterInitializer });
6397
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.0.1", ngImport: i0, type: RouterInitializer, decorators: [{
6398
- type: Injectable
6399
- }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
6400
- function getAppInitializer(r) {
6401
- return r.appInitializer.bind(r);
6402
- }
6403
- function getBootstrapListener(r) {
6404
- return r.bootstrapListener.bind(r);
6312
+ bootstrapDone.next();
6313
+ bootstrapDone.complete();
6314
+ };
6405
6315
  }
6316
+ // TODO(atscott): This should not be in the public API
6406
6317
  /**
6407
6318
  * A [DI token](guide/glossary/#di-token) for the router initializer that
6408
6319
  * is called after the app is bootstrapped.
6409
6320
  *
6410
6321
  * @publicApi
6411
6322
  */
6412
- const ROUTER_INITIALIZER = new InjectionToken('Router Initializer');
6323
+ const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
6324
+ function provideInitialNavigation(config) {
6325
+ return [
6326
+ config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
6327
+ config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
6328
+ ];
6329
+ }
6413
6330
  function provideRouterInitializer() {
6414
6331
  return [
6415
- RouterInitializer,
6332
+ // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
6333
+ // have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.
6334
+ { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener },
6335
+ { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6336
+ ];
6337
+ }
6338
+ /**
6339
+ * A subject used to indicate that the bootstrapping phase is done. When initial navigation is
6340
+ * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6341
+ * to the activation phase.
6342
+ */
6343
+ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
6344
+ factory: () => {
6345
+ return new Subject();
6346
+ }
6347
+ });
6348
+ function provideEnabledBlockingInitialNavigation() {
6349
+ return [
6350
+ { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6416
6351
  {
6417
6352
  provide: APP_INITIALIZER,
6418
6353
  multi: true,
6419
- useFactory: getAppInitializer,
6420
- deps: [RouterInitializer]
6354
+ deps: [Injector],
6355
+ useFactory: (injector) => {
6356
+ const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6357
+ let initNavigation = false;
6358
+ return () => {
6359
+ return locationInitialized.then(() => {
6360
+ return new Promise(resolve => {
6361
+ const router = injector.get(Router);
6362
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6363
+ router.afterPreactivation = () => {
6364
+ // only the initial navigation should be delayed
6365
+ if (!initNavigation) {
6366
+ initNavigation = true;
6367
+ resolve(true);
6368
+ return bootstrapDone;
6369
+ // subsequent navigations should not be delayed
6370
+ }
6371
+ else {
6372
+ return of(void 0);
6373
+ }
6374
+ };
6375
+ router.initialNavigation();
6376
+ });
6377
+ });
6378
+ };
6379
+ }
6421
6380
  },
6422
- { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] },
6423
- { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6381
+ ];
6382
+ }
6383
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6384
+ function provideDisabledInitialNavigation() {
6385
+ return [
6386
+ {
6387
+ provide: APP_INITIALIZER,
6388
+ multi: true,
6389
+ useFactory: () => {
6390
+ const router = inject(Router);
6391
+ return () => {
6392
+ router.setUpLocationChangeListener();
6393
+ };
6394
+ }
6395
+ },
6396
+ { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6397
+ ];
6398
+ }
6399
+ function provideTracing() {
6400
+ if (NG_DEV_MODE) {
6401
+ return [{
6402
+ provide: ENVIRONMENT_INITIALIZER,
6403
+ multi: true,
6404
+ useFactory: () => {
6405
+ const router = inject(Router);
6406
+ return () => router.events.subscribe((e) => {
6407
+ // tslint:disable:no-console
6408
+ console.group?.(`Router Event: ${e.constructor.name}`);
6409
+ console.log(stringifyEvent(e));
6410
+ console.log(e);
6411
+ console.groupEnd?.();
6412
+ // tslint:enable:no-console
6413
+ });
6414
+ }
6415
+ }];
6416
+ }
6417
+ else {
6418
+ return [];
6419
+ }
6420
+ }
6421
+ function providePreloading(preloadingStrategy) {
6422
+ return [
6423
+ RouterPreloader,
6424
+ { provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
6425
+ { provide: PreloadingStrategy, useExisting: preloadingStrategy },
6424
6426
  ];
6425
6427
  }
6426
6428
 
@@ -6434,7 +6436,7 @@ function provideRouterInitializer() {
6434
6436
  /**
6435
6437
  * @publicApi
6436
6438
  */
6437
- const VERSION = new Version('14.0.1');
6439
+ const VERSION = new Version('14.0.4');
6438
6440
 
6439
6441
  /**
6440
6442
  * @license
@@ -6473,5 +6475,5 @@ const VERSION = new Version('14.0.1');
6473
6475
  * Generated bundle index. Do not edit.
6474
6476
  */
6475
6477
 
6476
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten };
6478
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
6477
6479
  //# sourceMappingURL=router.mjs.map