@angular/router 14.1.0-next.3 → 14.1.0-next.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,11 +1,11 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.3
2
+ * @license Angular v14.1.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- 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';
8
+ import { ɵisObservable, ɵisPromise, ɵRuntimeError, 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';
9
9
  import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import { map, switchMap, take, startWith, scan, filter, mergeMap, first, concatMap, tap, catchError, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
11
11
  import * as i3 from '@angular/common';
@@ -60,9 +60,10 @@ class ParamsAsMap {
60
60
  function convertToParamMap(params) {
61
61
  return new ParamsAsMap(params);
62
62
  }
63
+ const REDIRECTING_CANCELLATION_REASON = 'Redirecting to ';
63
64
  const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
64
65
  function navigationCancelingError(message) {
65
- const error = Error('NavigationCancelingError: ' + message);
66
+ const error = Error('NavigationCancelingError: ' + (message || ''));
66
67
  error[NAVIGATION_CANCELING_ERROR] = true;
67
68
  return error;
68
69
  }
@@ -191,6 +192,7 @@ function wrapIntoObservable(value) {
191
192
  * Use of this source code is governed by an MIT-style license that can be
192
193
  * found in the LICENSE file at https://angular.io/license
193
194
  */
195
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
194
196
  function createEmptyUrlTree() {
195
197
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
196
198
  }
@@ -655,7 +657,7 @@ class UrlParser {
655
657
  parseSegment() {
656
658
  const path = matchSegments(this.remaining);
657
659
  if (path === '' && this.peekStartsWith(';')) {
658
- throw new Error(`Empty path url segment cannot have parameters: '${this.remaining}'.`);
660
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
659
661
  }
660
662
  this.capture(path);
661
663
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -724,7 +726,7 @@ class UrlParser {
724
726
  // if is is not one of these characters, then the segment was unescaped
725
727
  // or the group was not closed
726
728
  if (next !== '/' && next !== ')' && next !== ';') {
727
- throw new Error(`Cannot parse url '${this.url}'`);
729
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
728
730
  }
729
731
  let outletName = undefined;
730
732
  if (path.indexOf(':') > -1) {
@@ -755,7 +757,7 @@ class UrlParser {
755
757
  }
756
758
  capture(str) {
757
759
  if (!this.consumeOptional(str)) {
758
- throw new Error(`Expected "${str}".`);
760
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
759
761
  }
760
762
  }
761
763
  }
@@ -805,6 +807,7 @@ function mergeTrivialChildren(s) {
805
807
  * Use of this source code is governed by an MIT-style license that can be
806
808
  * found in the LICENSE file at https://angular.io/license
807
809
  */
810
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
808
811
  /**
809
812
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
810
813
  *
@@ -982,11 +985,11 @@ class Navigation {
982
985
  this.numberOfDoubleDots = numberOfDoubleDots;
983
986
  this.commands = commands;
984
987
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
985
- throw new Error('Root segment cannot have matrix parameters');
988
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
986
989
  }
987
990
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
988
991
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
989
- throw new Error('{outlets:{}} has to be the last command');
992
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
990
993
  }
991
994
  }
992
995
  toRoot() {
@@ -1085,7 +1088,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1085
1088
  dd -= ci;
1086
1089
  g = g.parent;
1087
1090
  if (!g) {
1088
- throw new Error('Invalid number of \'../\'');
1091
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1089
1092
  }
1090
1093
  ci = g.segments.length;
1091
1094
  }
@@ -1340,10 +1343,20 @@ class NavigationCancel extends RouterEvent {
1340
1343
  id,
1341
1344
  /** @docsNotRequired */
1342
1345
  url,
1343
- /** @docsNotRequired */
1344
- reason) {
1346
+ /**
1347
+ * A description of why the navigation was cancelled. For debug purposes only. Use `code`
1348
+ * instead for a stable cancellation reason that can be used in production.
1349
+ */
1350
+ reason,
1351
+ /**
1352
+ * A code to indicate why the navigation was canceled. This cancellation code is stable for
1353
+ * the reason and can be relied on whereas the `reason` string could change and should not be
1354
+ * used in production.
1355
+ */
1356
+ code) {
1345
1357
  super(id, url);
1346
1358
  this.reason = reason;
1359
+ this.code = code;
1347
1360
  this.type = 2 /* EventType.NavigationCancel */;
1348
1361
  }
1349
1362
  /** @docsNotRequired */
@@ -2319,6 +2332,7 @@ class ChildrenOutletContexts {
2319
2332
  * Use of this source code is governed by an MIT-style license that can be
2320
2333
  * found in the LICENSE file at https://angular.io/license
2321
2334
  */
2335
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2322
2336
  /**
2323
2337
  * @description
2324
2338
  *
@@ -2428,12 +2442,12 @@ class RouterOutlet {
2428
2442
  */
2429
2443
  get component() {
2430
2444
  if (!this.activated)
2431
- throw new Error('Outlet is not activated');
2445
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2432
2446
  return this.activated.instance;
2433
2447
  }
2434
2448
  get activatedRoute() {
2435
2449
  if (!this.activated)
2436
- throw new Error('Outlet is not activated');
2450
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2437
2451
  return this._activatedRoute;
2438
2452
  }
2439
2453
  get activatedRouteData() {
@@ -2447,7 +2461,7 @@ class RouterOutlet {
2447
2461
  */
2448
2462
  detach() {
2449
2463
  if (!this.activated)
2450
- throw new Error('Outlet is not activated');
2464
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2451
2465
  this.location.detach();
2452
2466
  const cmp = this.activated;
2453
2467
  this.activated = null;
@@ -2475,7 +2489,7 @@ class RouterOutlet {
2475
2489
  }
2476
2490
  activateWith(activatedRoute, resolverOrInjector) {
2477
2491
  if (this.isActivated) {
2478
- throw new Error('Cannot activate an already activated outlet');
2492
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2479
2493
  }
2480
2494
  this._activatedRoute = activatedRoute;
2481
2495
  const location = this.location;
@@ -2497,9 +2511,9 @@ class RouterOutlet {
2497
2511
  this.activateEvents.emit(this.activated.instance);
2498
2512
  }
2499
2513
  }
2500
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2501
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.3", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2502
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterOutlet, decorators: [{
2514
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.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 });
2515
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.4", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2516
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterOutlet, decorators: [{
2503
2517
  type: Directive,
2504
2518
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2505
2519
  }], ctorParameters: function () {
@@ -2558,9 +2572,9 @@ function isComponentFactoryResolver(item) {
2558
2572
  */
2559
2573
  class ɵEmptyOutletComponent {
2560
2574
  }
2561
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2562
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-next.3", 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"] }] });
2563
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2575
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2576
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-next.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"] }] });
2577
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2564
2578
  type: Component,
2565
2579
  args: [{ template: `<router-outlet></router-outlet>` }]
2566
2580
  }] });
@@ -2610,13 +2624,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
2610
2624
  }
2611
2625
  function assertStandalone(fullPath, component) {
2612
2626
  if (component && !ɵisStandalone(component)) {
2613
- throw new Error(`Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2627
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2614
2628
  }
2615
2629
  }
2616
2630
  function validateNode(route, fullPath, requireStandaloneComponents) {
2617
2631
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
2618
2632
  if (!route) {
2619
- throw new Error(`
2633
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
2620
2634
  Invalid configuration of route '${fullPath}': Encountered undefined route.
2621
2635
  The reason might be an extra comma.
2622
2636
 
@@ -2629,47 +2643,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
2629
2643
  `);
2630
2644
  }
2631
2645
  if (Array.isArray(route)) {
2632
- throw new Error(`Invalid configuration of route '${fullPath}': Array cannot be specified`);
2646
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
2633
2647
  }
2634
2648
  if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
2635
2649
  (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
2636
- throw new Error(`Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
2650
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
2637
2651
  }
2638
2652
  if (route.redirectTo && route.children) {
2639
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2653
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2640
2654
  }
2641
2655
  if (route.redirectTo && route.loadChildren) {
2642
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2656
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2643
2657
  }
2644
2658
  if (route.children && route.loadChildren) {
2645
- throw new Error(`Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2659
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2646
2660
  }
2647
2661
  if (route.redirectTo && (route.component || route.loadComponent)) {
2648
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2662
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2649
2663
  }
2650
2664
  if (route.component && route.loadComponent) {
2651
- throw new Error(`Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2665
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2652
2666
  }
2653
2667
  if (route.redirectTo && route.canActivate) {
2654
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2668
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2655
2669
  `so canActivate will never be executed.`);
2656
2670
  }
2657
2671
  if (route.path && route.matcher) {
2658
- throw new Error(`Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2672
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2659
2673
  }
2660
2674
  if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
2661
2675
  !route.children && !route.loadChildren) {
2662
- throw new Error(`Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
2676
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
2663
2677
  }
2664
2678
  if (route.path === void 0 && route.matcher === void 0) {
2665
- throw new Error(`Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2679
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2666
2680
  }
2667
2681
  if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
2668
- throw new Error(`Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2682
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2669
2683
  }
2670
2684
  if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
2671
2685
  const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
2672
- throw new Error(`Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2686
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2673
2687
  }
2674
2688
  if (requireStandaloneComponents) {
2675
2689
  assertStandalone(fullPath, route.component);
@@ -3225,17 +3239,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
3225
3239
  const canActivateObservables = canActivate.map((c) => {
3226
3240
  return defer(() => {
3227
3241
  const guard = getToken(c, futureARS, moduleInjector);
3228
- let observable;
3229
- if (isCanActivate(guard)) {
3230
- observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS));
3231
- }
3232
- else if (isFunction(guard)) {
3233
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3234
- }
3235
- else {
3236
- throw new Error('Invalid CanActivate guard');
3237
- }
3238
- return observable.pipe(first());
3242
+ const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
3243
+ guard(futureARS, futureRSS);
3244
+ return wrapIntoObservable(guardVal).pipe(first());
3239
3245
  });
3240
3246
  });
3241
3247
  return of(canActivateObservables).pipe(prioritizedGuardValue());
@@ -3250,17 +3256,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3250
3256
  return defer(() => {
3251
3257
  const guardsMapped = d.guards.map((c) => {
3252
3258
  const guard = getToken(c, d.node, moduleInjector);
3253
- let observable;
3254
- if (isCanActivateChild(guard)) {
3255
- observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS));
3256
- }
3257
- else if (isFunction(guard)) {
3258
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3259
- }
3260
- else {
3261
- throw new Error('Invalid CanActivateChild guard');
3262
- }
3263
- return observable.pipe(first());
3259
+ const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
3260
+ guard(futureARS, futureRSS);
3261
+ return wrapIntoObservable(guardVal).pipe(first());
3264
3262
  });
3265
3263
  return of(guardsMapped).pipe(prioritizedGuardValue());
3266
3264
  });
@@ -3273,17 +3271,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3273
3271
  return of(true);
3274
3272
  const canDeactivateObservables = canDeactivate.map((c) => {
3275
3273
  const guard = getToken(c, currARS, moduleInjector);
3276
- let observable;
3277
- if (isCanDeactivate(guard)) {
3278
- observable = wrapIntoObservable(guard.canDeactivate(component, currARS, currRSS, futureRSS));
3279
- }
3280
- else if (isFunction(guard)) {
3281
- observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
3282
- }
3283
- else {
3284
- throw new Error('Invalid CanDeactivate guard');
3285
- }
3286
- return observable.pipe(first());
3274
+ const guardVal = isCanDeactivate(guard) ?
3275
+ guard.canDeactivate(component, currARS, currRSS, futureRSS) :
3276
+ guard(component, currARS, currRSS, futureRSS);
3277
+ return wrapIntoObservable(guardVal).pipe(first());
3287
3278
  });
3288
3279
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
3289
3280
  }
@@ -3294,16 +3285,7 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3294
3285
  }
3295
3286
  const canLoadObservables = canLoad.map((injectionToken) => {
3296
3287
  const guard = injector.get(injectionToken);
3297
- let guardVal;
3298
- if (isCanLoad(guard)) {
3299
- guardVal = guard.canLoad(route, segments);
3300
- }
3301
- else if (isFunction(guard)) {
3302
- guardVal = guard(route, segments);
3303
- }
3304
- else {
3305
- throw new Error('Invalid CanLoad guard');
3306
- }
3288
+ const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
3307
3289
  return wrapIntoObservable(guardVal);
3308
3290
  });
3309
3291
  return of(canLoadObservables)
@@ -3313,7 +3295,7 @@ function redirectIfUrlTree(urlSerializer) {
3313
3295
  return pipe(tap((result) => {
3314
3296
  if (!isUrlTree(result))
3315
3297
  return;
3316
- const error = navigationCancelingError(`Redirecting to "${urlSerializer.serialize(result)}"`);
3298
+ const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON + urlSerializer.serialize(result));
3317
3299
  error.url = result;
3318
3300
  throw error;
3319
3301
  }), map(result => result === true));
@@ -3493,6 +3475,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3493
3475
  * Use of this source code is governed by an MIT-style license that can be
3494
3476
  * found in the LICENSE file at https://angular.io/license
3495
3477
  */
3478
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3496
3479
  class NoMatch$1 {
3497
3480
  constructor(segmentGroup) {
3498
3481
  this.segmentGroup = segmentGroup || null;
@@ -3510,10 +3493,12 @@ function absoluteRedirect(newTree) {
3510
3493
  return throwError(new AbsoluteRedirect(newTree));
3511
3494
  }
3512
3495
  function namedOutletsRedirect(redirectTo) {
3513
- return throwError(new Error(`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3496
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3497
+ `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3514
3498
  }
3515
3499
  function canLoadFails(route) {
3516
- return throwError(navigationCancelingError(`Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3500
+ return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3501
+ `Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3517
3502
  }
3518
3503
  /**
3519
3504
  * Returns the `UrlTree` with the redirection applied.
@@ -3572,7 +3557,7 @@ class ApplyRedirects {
3572
3557
  }));
3573
3558
  }
3574
3559
  noMatchError(e) {
3575
- return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3560
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3576
3561
  }
3577
3562
  createUrlTree(rootCandidate, queryParams, fragment) {
3578
3563
  const root = createRoot(rootCandidate);
@@ -3789,7 +3774,8 @@ class ApplyRedirects {
3789
3774
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3790
3775
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3791
3776
  if (!pos)
3792
- throw new Error(`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3777
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3778
+ `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3793
3779
  return pos;
3794
3780
  }
3795
3781
  findOrReturn(redirectToUrlSegment, actualSegments) {
@@ -3913,7 +3899,7 @@ class Recognizer {
3913
3899
  // multiple activated results for the same outlet. We should merge the children of
3914
3900
  // these results so the final return value is only one `TreeNode` per outlet.
3915
3901
  const mergedChildren = mergeEmptyPathMatches(children);
3916
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
3902
+ if (NG_DEV_MODE$3) {
3917
3903
  // This should really never happen - we are only taking the first match for each
3918
3904
  // outlet and merge the empty path matches.
3919
3905
  checkOutletNameUniqueness(mergedChildren);
@@ -4079,7 +4065,7 @@ function checkOutletNameUniqueness(nodes) {
4079
4065
  if (routeWithSameOutletName) {
4080
4066
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4081
4067
  const c = n.value.url.map(s => s.toString()).join('/');
4082
- throw new Error(`Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4068
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$3 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4083
4069
  }
4084
4070
  names[n.value.outlet] = n.value;
4085
4071
  });
@@ -4388,9 +4374,9 @@ class RouterConfigLoader {
4388
4374
  }));
4389
4375
  }
4390
4376
  }
4391
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4392
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterConfigLoader });
4393
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterConfigLoader, decorators: [{
4377
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4378
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader });
4379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader, decorators: [{
4394
4380
  type: Injectable
4395
4381
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4396
4382
 
@@ -4739,7 +4725,8 @@ class Router {
4739
4725
  this.triggerEvent(guardsStart);
4740
4726
  }), map(t => (Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) }))), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4741
4727
  if (isUrlTree(t.guardsResult)) {
4742
- const error = navigationCancelingError(`Redirecting to "${this.serializeUrl(t.guardsResult)}"`);
4728
+ const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON +
4729
+ `"${this.serializeUrl(t.guardsResult)}"`);
4743
4730
  error.url = t.guardsResult;
4744
4731
  throw error;
4745
4732
  }
@@ -4748,7 +4735,7 @@ class Router {
4748
4735
  }), filter(t => {
4749
4736
  if (!t.guardsResult) {
4750
4737
  this.restoreHistory(t);
4751
- this.cancelNavigationTransition(t, '');
4738
+ this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4752
4739
  return false;
4753
4740
  }
4754
4741
  return true;
@@ -4766,7 +4753,9 @@ class Router {
4766
4753
  complete: () => {
4767
4754
  if (!dataResolved) {
4768
4755
  this.restoreHistory(t);
4769
- this.cancelNavigationTransition(t, `At least one route resolver didn't emit any value.`);
4756
+ this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
4757
+ `At least one route resolver didn't emit any value.` :
4758
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4770
4759
  }
4771
4760
  }
4772
4761
  }));
@@ -4776,7 +4765,7 @@ class Router {
4776
4765
  }));
4777
4766
  }
4778
4767
  return undefined;
4779
- }), switchTap(() => this.afterPreactivation()),
4768
+ }),
4780
4769
  // --- LOAD COMPONENTS ---
4781
4770
  switchTap((t) => {
4782
4771
  const loadComponents = (route) => {
@@ -4796,7 +4785,7 @@ class Router {
4796
4785
  };
4797
4786
  return combineLatest(loadComponents(t.targetSnapshot.root))
4798
4787
  .pipe(defaultIfEmpty(), take(1));
4799
- }), map((t) => {
4788
+ }), switchTap(() => this.afterPreactivation()), map((t) => {
4800
4789
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4801
4790
  return (Object.assign(Object.assign({}, t), { targetRouterState }));
4802
4791
  }),
@@ -4833,8 +4822,10 @@ class Router {
4833
4822
  * event is fired when a navigation gets cancelled but not caught by other
4834
4823
  * means. */
4835
4824
  if (!completed && !errored) {
4836
- const cancelationReason = `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}`;
4837
- this.cancelNavigationTransition(t, cancelationReason);
4825
+ const cancelationReason = NG_DEV_MODE$1 ?
4826
+ `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
4827
+ '';
4828
+ this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4838
4829
  }
4839
4830
  // Only clear current navigation if it is still set to the one that
4840
4831
  // finalized.
@@ -4867,7 +4858,7 @@ class Router {
4867
4858
  this.navigated = true;
4868
4859
  this.restoreHistory(t, true);
4869
4860
  }
4870
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message);
4861
+ const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, 0 /* NavigationCancellationCode.Redirect */);
4871
4862
  eventsSubject.next(navCancel);
4872
4863
  // When redirecting, we need to delay resolving the navigation
4873
4864
  // promise and push it to the redirect navigation
@@ -5342,8 +5333,8 @@ class Router {
5342
5333
  resetUrlToCurrentUrlTree() {
5343
5334
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5344
5335
  }
5345
- cancelNavigationTransition(t, reason) {
5346
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason);
5336
+ cancelNavigationTransition(t, reason, code) {
5337
+ const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
5347
5338
  this.triggerEvent(navCancel);
5348
5339
  t.resolve(false);
5349
5340
  }
@@ -5354,16 +5345,16 @@ class Router {
5354
5345
  return { navigationId };
5355
5346
  }
5356
5347
  }
5357
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5358
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: Router });
5359
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: Router, decorators: [{
5348
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5349
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router });
5350
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router, decorators: [{
5360
5351
  type: Injectable
5361
5352
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5362
5353
  function validateCommands(commands) {
5363
5354
  for (let i = 0; i < commands.length; i++) {
5364
5355
  const cmd = commands[i];
5365
5356
  if (cmd == null) {
5366
- throw new Error(`The requested path contains ${cmd} segment at index ${i}`);
5357
+ throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
5367
5358
  }
5368
5359
  }
5369
5360
  }
@@ -5548,9 +5539,9 @@ class RouterLink {
5548
5539
  });
5549
5540
  }
5550
5541
  }
5551
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5552
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.3", 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 });
5553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterLink, decorators: [{
5542
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5543
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.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 });
5544
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLink, decorators: [{
5554
5545
  type: Directive,
5555
5546
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5556
5547
  }], ctorParameters: function () {
@@ -5669,9 +5660,9 @@ class RouterLinkWithHref {
5669
5660
  });
5670
5661
  }
5671
5662
  }
5672
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5673
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.3", 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 });
5674
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5663
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5664
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.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 });
5665
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5675
5666
  type: Directive,
5676
5667
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5677
5668
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5898,9 +5889,9 @@ class RouterLinkActive {
5898
5889
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5899
5890
  }
5900
5891
  }
5901
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", 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 });
5902
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.3", 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 });
5903
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterLinkActive, decorators: [{
5892
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.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 });
5893
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.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 });
5894
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkActive, decorators: [{
5904
5895
  type: Directive,
5905
5896
  args: [{
5906
5897
  selector: '[routerLinkActive]',
@@ -6006,9 +5997,9 @@ class DefaultTitleStrategy extends TitleStrategy {
6006
5997
  }
6007
5998
  }
6008
5999
  }
6009
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
6010
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6011
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6000
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
6001
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6002
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6012
6003
  type: Injectable,
6013
6004
  args: [{ providedIn: 'root' }]
6014
6005
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -6045,9 +6036,9 @@ class PreloadAllModules {
6045
6036
  return fn().pipe(catchError(() => of(null)));
6046
6037
  }
6047
6038
  }
6048
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6049
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6050
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: PreloadAllModules, decorators: [{
6039
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6040
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6041
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, decorators: [{
6051
6042
  type: Injectable,
6052
6043
  args: [{ providedIn: 'root' }]
6053
6044
  }] });
@@ -6065,9 +6056,9 @@ class NoPreloading {
6065
6056
  return of(null);
6066
6057
  }
6067
6058
  }
6068
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6069
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6070
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: NoPreloading, decorators: [{
6059
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6060
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6061
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, decorators: [{
6071
6062
  type: Injectable,
6072
6063
  args: [{ providedIn: 'root' }]
6073
6064
  }] });
@@ -6155,9 +6146,9 @@ class RouterPreloader {
6155
6146
  });
6156
6147
  }
6157
6148
  }
6158
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6159
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterPreloader });
6160
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterPreloader, decorators: [{
6149
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6150
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader });
6151
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader, decorators: [{
6161
6152
  type: Injectable
6162
6153
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6163
6154
 
@@ -6237,9 +6228,9 @@ class RouterScroller {
6237
6228
  }
6238
6229
  }
6239
6230
  }
6240
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6241
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterScroller });
6242
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterScroller, decorators: [{
6231
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6232
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller });
6233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller, decorators: [{
6243
6234
  type: Injectable
6244
6235
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6245
6236
 
@@ -6372,10 +6363,10 @@ class RouterModule {
6372
6363
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6373
6364
  }
6374
6365
  }
6375
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6376
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6377
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterModule });
6378
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterModule, decorators: [{
6366
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6367
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6368
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule });
6369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule, decorators: [{
6379
6370
  type: NgModule,
6380
6371
  args: [{
6381
6372
  declarations: ROUTER_DIRECTIVES,
@@ -6413,7 +6404,7 @@ function providePathLocationStrategy() {
6413
6404
  }
6414
6405
  function provideForRootGuard(router) {
6415
6406
  if (NG_DEV_MODE && router) {
6416
- throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6407
+ throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6417
6408
  }
6418
6409
  return 'guarded';
6419
6410
  }
@@ -6540,17 +6531,50 @@ function provideEnabledBlockingInitialNavigation() {
6540
6531
  useFactory: (injector) => {
6541
6532
  const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6542
6533
  let initNavigation = false;
6534
+ /**
6535
+ * Performs the given action once the router finishes its next/current navigation.
6536
+ *
6537
+ * If the navigation is canceled or errors without a redirect, the navigation is considered
6538
+ * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6539
+ */
6540
+ function afterNextNavigation(action) {
6541
+ const router = injector.get(Router);
6542
+ router.events
6543
+ .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6544
+ e instanceof NavigationError), map(e => {
6545
+ if (e instanceof NavigationEnd) {
6546
+ // Navigation assumed to succeed if we get `ActivationStart`
6547
+ return true;
6548
+ }
6549
+ const redirecting = e instanceof NavigationCancel ?
6550
+ (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6551
+ e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6552
+ false;
6553
+ return redirecting ? null : false;
6554
+ }), filter((result) => result !== null), take(1))
6555
+ .subscribe(() => {
6556
+ action();
6557
+ });
6558
+ }
6543
6559
  return () => {
6544
6560
  return locationInitialized.then(() => {
6545
6561
  return new Promise(resolve => {
6546
6562
  const router = injector.get(Router);
6547
6563
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6564
+ afterNextNavigation(() => {
6565
+ // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6566
+ // without a redirect.
6567
+ resolve(true);
6568
+ initNavigation = true;
6569
+ });
6548
6570
  router.afterPreactivation = () => {
6549
- // only the initial navigation should be delayed
6571
+ // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6572
+ // assume activation will complete successfully (even though this is not
6573
+ // guaranteed).
6574
+ resolve(true);
6575
+ // only the initial navigation should be delayed until bootstrapping is done.
6550
6576
  if (!initNavigation) {
6551
- initNavigation = true;
6552
- resolve(true);
6553
- return bootstrapDone;
6577
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6554
6578
  // subsequent navigations should not be delayed
6555
6579
  }
6556
6580
  else {
@@ -6622,7 +6646,7 @@ function providePreloading(preloadingStrategy) {
6622
6646
  /**
6623
6647
  * @publicApi
6624
6648
  */
6625
- const VERSION = new Version('14.1.0-next.3');
6649
+ const VERSION = new Version('14.1.0-next.4');
6626
6650
 
6627
6651
  /**
6628
6652
  * @license