@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 * as i3 from '@angular/common';
11
11
  import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } 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
  *
@@ -980,11 +983,11 @@ class Navigation {
980
983
  this.numberOfDoubleDots = numberOfDoubleDots;
981
984
  this.commands = commands;
982
985
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
983
- throw new Error('Root segment cannot have matrix parameters');
986
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
984
987
  }
985
988
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
986
989
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
987
- throw new Error('{outlets:{}} has to be the last command');
990
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
988
991
  }
989
992
  }
990
993
  toRoot() {
@@ -1083,7 +1086,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1083
1086
  dd -= ci;
1084
1087
  g = g.parent;
1085
1088
  if (!g) {
1086
- throw new Error('Invalid number of \'../\'');
1089
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1087
1090
  }
1088
1091
  ci = g.segments.length;
1089
1092
  }
@@ -1338,10 +1341,20 @@ class NavigationCancel extends RouterEvent {
1338
1341
  id,
1339
1342
  /** @docsNotRequired */
1340
1343
  url,
1341
- /** @docsNotRequired */
1342
- reason) {
1344
+ /**
1345
+ * A description of why the navigation was cancelled. For debug purposes only. Use `code`
1346
+ * instead for a stable cancellation reason that can be used in production.
1347
+ */
1348
+ reason,
1349
+ /**
1350
+ * A code to indicate why the navigation was canceled. This cancellation code is stable for
1351
+ * the reason and can be relied on whereas the `reason` string could change and should not be
1352
+ * used in production.
1353
+ */
1354
+ code) {
1343
1355
  super(id, url);
1344
1356
  this.reason = reason;
1357
+ this.code = code;
1345
1358
  this.type = 2 /* EventType.NavigationCancel */;
1346
1359
  }
1347
1360
  /** @docsNotRequired */
@@ -2315,6 +2328,7 @@ class ChildrenOutletContexts {
2315
2328
  * Use of this source code is governed by an MIT-style license that can be
2316
2329
  * found in the LICENSE file at https://angular.io/license
2317
2330
  */
2331
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2318
2332
  /**
2319
2333
  * @description
2320
2334
  *
@@ -2423,12 +2437,12 @@ class RouterOutlet {
2423
2437
  */
2424
2438
  get component() {
2425
2439
  if (!this.activated)
2426
- throw new Error('Outlet is not activated');
2440
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2427
2441
  return this.activated.instance;
2428
2442
  }
2429
2443
  get activatedRoute() {
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._activatedRoute;
2433
2447
  }
2434
2448
  get activatedRouteData() {
@@ -2442,7 +2456,7 @@ class RouterOutlet {
2442
2456
  */
2443
2457
  detach() {
2444
2458
  if (!this.activated)
2445
- throw new Error('Outlet is not activated');
2459
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2446
2460
  this.location.detach();
2447
2461
  const cmp = this.activated;
2448
2462
  this.activated = null;
@@ -2470,7 +2484,7 @@ class RouterOutlet {
2470
2484
  }
2471
2485
  activateWith(activatedRoute, resolverOrInjector) {
2472
2486
  if (this.isActivated) {
2473
- throw new Error('Cannot activate an already activated outlet');
2487
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2474
2488
  }
2475
2489
  this._activatedRoute = activatedRoute;
2476
2490
  const location = this.location;
@@ -2492,9 +2506,9 @@ class RouterOutlet {
2492
2506
  this.activateEvents.emit(this.activated.instance);
2493
2507
  }
2494
2508
  }
2495
- 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 });
2496
- 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 });
2497
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterOutlet, decorators: [{
2509
+ 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 });
2510
+ 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 });
2511
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterOutlet, decorators: [{
2498
2512
  type: Directive,
2499
2513
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2500
2514
  }], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
@@ -2551,9 +2565,9 @@ function isComponentFactoryResolver(item) {
2551
2565
  */
2552
2566
  class ɵEmptyOutletComponent {
2553
2567
  }
2554
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2555
- ɵ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"] }] });
2556
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2568
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2569
+ ɵ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"] }] });
2570
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2557
2571
  type: Component,
2558
2572
  args: [{ template: `<router-outlet></router-outlet>` }]
2559
2573
  }] });
@@ -2602,13 +2616,13 @@ function validateConfig(config, parentPath = '', requireStandaloneComponents = f
2602
2616
  }
2603
2617
  function assertStandalone(fullPath, component) {
2604
2618
  if (component && !ɵisStandalone(component)) {
2605
- throw new Error(`Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2619
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);
2606
2620
  }
2607
2621
  }
2608
2622
  function validateNode(route, fullPath, requireStandaloneComponents) {
2609
2623
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
2610
2624
  if (!route) {
2611
- throw new Error(`
2625
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `
2612
2626
  Invalid configuration of route '${fullPath}': Encountered undefined route.
2613
2627
  The reason might be an extra comma.
2614
2628
 
@@ -2621,47 +2635,47 @@ function validateNode(route, fullPath, requireStandaloneComponents) {
2621
2635
  `);
2622
2636
  }
2623
2637
  if (Array.isArray(route)) {
2624
- throw new Error(`Invalid configuration of route '${fullPath}': Array cannot be specified`);
2638
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);
2625
2639
  }
2626
2640
  if (!route.component && !route.loadComponent && !route.children && !route.loadChildren &&
2627
2641
  (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
2628
- throw new Error(`Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);
2642
+ 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`);
2629
2643
  }
2630
2644
  if (route.redirectTo && route.children) {
2631
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2645
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);
2632
2646
  }
2633
2647
  if (route.redirectTo && route.loadChildren) {
2634
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2648
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);
2635
2649
  }
2636
2650
  if (route.children && route.loadChildren) {
2637
- throw new Error(`Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2651
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);
2638
2652
  }
2639
2653
  if (route.redirectTo && (route.component || route.loadComponent)) {
2640
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2654
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);
2641
2655
  }
2642
2656
  if (route.component && route.loadComponent) {
2643
- throw new Error(`Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2657
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);
2644
2658
  }
2645
2659
  if (route.redirectTo && route.canActivate) {
2646
- throw new Error(`Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2660
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` +
2647
2661
  `so canActivate will never be executed.`);
2648
2662
  }
2649
2663
  if (route.path && route.matcher) {
2650
- throw new Error(`Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2664
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);
2651
2665
  }
2652
2666
  if (route.redirectTo === void 0 && !route.component && !route.loadComponent &&
2653
2667
  !route.children && !route.loadChildren) {
2654
- throw new Error(`Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);
2668
+ 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`);
2655
2669
  }
2656
2670
  if (route.path === void 0 && route.matcher === void 0) {
2657
- throw new Error(`Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2671
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);
2658
2672
  }
2659
2673
  if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
2660
- throw new Error(`Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2674
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);
2661
2675
  }
2662
2676
  if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
2663
2677
  const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;
2664
- throw new Error(`Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2678
+ throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: "${fullPath}", redirectTo: "${route.redirectTo}"}': please provide 'pathMatch'. ${exp}`);
2665
2679
  }
2666
2680
  if (requireStandaloneComponents) {
2667
2681
  assertStandalone(fullPath, route.component);
@@ -3215,17 +3229,9 @@ function runCanActivate(futureRSS, futureARS, moduleInjector) {
3215
3229
  const canActivateObservables = canActivate.map((c) => {
3216
3230
  return defer(() => {
3217
3231
  const guard = getToken(c, futureARS, moduleInjector);
3218
- let observable;
3219
- if (isCanActivate(guard)) {
3220
- observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS));
3221
- }
3222
- else if (isFunction(guard)) {
3223
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3224
- }
3225
- else {
3226
- throw new Error('Invalid CanActivate guard');
3227
- }
3228
- return observable.pipe(first());
3232
+ const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
3233
+ guard(futureARS, futureRSS);
3234
+ return wrapIntoObservable(guardVal).pipe(first());
3229
3235
  });
3230
3236
  });
3231
3237
  return of(canActivateObservables).pipe(prioritizedGuardValue());
@@ -3240,17 +3246,9 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3240
3246
  return defer(() => {
3241
3247
  const guardsMapped = d.guards.map((c) => {
3242
3248
  const guard = getToken(c, d.node, moduleInjector);
3243
- let observable;
3244
- if (isCanActivateChild(guard)) {
3245
- observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS));
3246
- }
3247
- else if (isFunction(guard)) {
3248
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3249
- }
3250
- else {
3251
- throw new Error('Invalid CanActivateChild guard');
3252
- }
3253
- return observable.pipe(first());
3249
+ const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
3250
+ guard(futureARS, futureRSS);
3251
+ return wrapIntoObservable(guardVal).pipe(first());
3254
3252
  });
3255
3253
  return of(guardsMapped).pipe(prioritizedGuardValue());
3256
3254
  });
@@ -3263,17 +3261,10 @@ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector
3263
3261
  return of(true);
3264
3262
  const canDeactivateObservables = canDeactivate.map((c) => {
3265
3263
  const guard = getToken(c, currARS, moduleInjector);
3266
- let observable;
3267
- if (isCanDeactivate(guard)) {
3268
- observable = wrapIntoObservable(guard.canDeactivate(component, currARS, currRSS, futureRSS));
3269
- }
3270
- else if (isFunction(guard)) {
3271
- observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
3272
- }
3273
- else {
3274
- throw new Error('Invalid CanDeactivate guard');
3275
- }
3276
- return observable.pipe(first());
3264
+ const guardVal = isCanDeactivate(guard) ?
3265
+ guard.canDeactivate(component, currARS, currRSS, futureRSS) :
3266
+ guard(component, currARS, currRSS, futureRSS);
3267
+ return wrapIntoObservable(guardVal).pipe(first());
3277
3268
  });
3278
3269
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
3279
3270
  }
@@ -3284,16 +3275,7 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3284
3275
  }
3285
3276
  const canLoadObservables = canLoad.map((injectionToken) => {
3286
3277
  const guard = injector.get(injectionToken);
3287
- let guardVal;
3288
- if (isCanLoad(guard)) {
3289
- guardVal = guard.canLoad(route, segments);
3290
- }
3291
- else if (isFunction(guard)) {
3292
- guardVal = guard(route, segments);
3293
- }
3294
- else {
3295
- throw new Error('Invalid CanLoad guard');
3296
- }
3278
+ const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
3297
3279
  return wrapIntoObservable(guardVal);
3298
3280
  });
3299
3281
  return of(canLoadObservables)
@@ -3303,7 +3285,7 @@ function redirectIfUrlTree(urlSerializer) {
3303
3285
  return pipe(tap((result) => {
3304
3286
  if (!isUrlTree(result))
3305
3287
  return;
3306
- const error = navigationCancelingError(`Redirecting to "${urlSerializer.serialize(result)}"`);
3288
+ const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON + urlSerializer.serialize(result));
3307
3289
  error.url = result;
3308
3290
  throw error;
3309
3291
  }), map(result => result === true));
@@ -3483,6 +3465,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3483
3465
  * Use of this source code is governed by an MIT-style license that can be
3484
3466
  * found in the LICENSE file at https://angular.io/license
3485
3467
  */
3468
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3486
3469
  class NoMatch$1 {
3487
3470
  constructor(segmentGroup) {
3488
3471
  this.segmentGroup = segmentGroup || null;
@@ -3500,10 +3483,12 @@ function absoluteRedirect(newTree) {
3500
3483
  return throwError(new AbsoluteRedirect(newTree));
3501
3484
  }
3502
3485
  function namedOutletsRedirect(redirectTo) {
3503
- return throwError(new Error(`Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3486
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3487
+ `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3504
3488
  }
3505
3489
  function canLoadFails(route) {
3506
- return throwError(navigationCancelingError(`Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3490
+ return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3491
+ `Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3507
3492
  }
3508
3493
  /**
3509
3494
  * Returns the `UrlTree` with the redirection applied.
@@ -3562,7 +3547,7 @@ class ApplyRedirects {
3562
3547
  }));
3563
3548
  }
3564
3549
  noMatchError(e) {
3565
- return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3550
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3566
3551
  }
3567
3552
  createUrlTree(rootCandidate, queryParams, fragment) {
3568
3553
  const root = createRoot(rootCandidate);
@@ -3777,7 +3762,8 @@ class ApplyRedirects {
3777
3762
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3778
3763
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3779
3764
  if (!pos)
3780
- throw new Error(`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3765
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3766
+ `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3781
3767
  return pos;
3782
3768
  }
3783
3769
  findOrReturn(redirectToUrlSegment, actualSegments) {
@@ -3901,7 +3887,7 @@ class Recognizer {
3901
3887
  // multiple activated results for the same outlet. We should merge the children of
3902
3888
  // these results so the final return value is only one `TreeNode` per outlet.
3903
3889
  const mergedChildren = mergeEmptyPathMatches(children);
3904
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
3890
+ if (NG_DEV_MODE$3) {
3905
3891
  // This should really never happen - we are only taking the first match for each
3906
3892
  // outlet and merge the empty path matches.
3907
3893
  checkOutletNameUniqueness(mergedChildren);
@@ -4063,7 +4049,7 @@ function checkOutletNameUniqueness(nodes) {
4063
4049
  if (routeWithSameOutletName) {
4064
4050
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4065
4051
  const c = n.value.url.map(s => s.toString()).join('/');
4066
- throw new Error(`Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4052
+ 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}'.`);
4067
4053
  }
4068
4054
  names[n.value.outlet] = n.value;
4069
4055
  });
@@ -4369,9 +4355,9 @@ class RouterConfigLoader {
4369
4355
  }));
4370
4356
  }
4371
4357
  }
4372
- 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 });
4373
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterConfigLoader });
4374
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterConfigLoader, decorators: [{
4358
+ 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 });
4359
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader });
4360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterConfigLoader, decorators: [{
4375
4361
  type: Injectable
4376
4362
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4377
4363
 
@@ -4738,7 +4724,8 @@ class Router {
4738
4724
  guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)
4739
4725
  })), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4740
4726
  if (isUrlTree(t.guardsResult)) {
4741
- const error = navigationCancelingError(`Redirecting to "${this.serializeUrl(t.guardsResult)}"`);
4727
+ const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON +
4728
+ `"${this.serializeUrl(t.guardsResult)}"`);
4742
4729
  error.url = t.guardsResult;
4743
4730
  throw error;
4744
4731
  }
@@ -4747,7 +4734,7 @@ class Router {
4747
4734
  }), filter(t => {
4748
4735
  if (!t.guardsResult) {
4749
4736
  this.restoreHistory(t);
4750
- this.cancelNavigationTransition(t, '');
4737
+ this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4751
4738
  return false;
4752
4739
  }
4753
4740
  return true;
@@ -4765,7 +4752,9 @@ class Router {
4765
4752
  complete: () => {
4766
4753
  if (!dataResolved) {
4767
4754
  this.restoreHistory(t);
4768
- this.cancelNavigationTransition(t, `At least one route resolver didn't emit any value.`);
4755
+ this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
4756
+ `At least one route resolver didn't emit any value.` :
4757
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4769
4758
  }
4770
4759
  }
4771
4760
  }));
@@ -4775,7 +4764,7 @@ class Router {
4775
4764
  }));
4776
4765
  }
4777
4766
  return undefined;
4778
- }), switchTap(() => this.afterPreactivation()),
4767
+ }),
4779
4768
  // --- LOAD COMPONENTS ---
4780
4769
  switchTap((t) => {
4781
4770
  const loadComponents = (route) => {
@@ -4794,7 +4783,7 @@ class Router {
4794
4783
  };
4795
4784
  return combineLatest(loadComponents(t.targetSnapshot.root))
4796
4785
  .pipe(defaultIfEmpty(), take(1));
4797
- }), map((t) => {
4786
+ }), switchTap(() => this.afterPreactivation()), map((t) => {
4798
4787
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4799
4788
  return ({ ...t, targetRouterState });
4800
4789
  }),
@@ -4830,8 +4819,10 @@ class Router {
4830
4819
  * event is fired when a navigation gets cancelled but not caught by other
4831
4820
  * means. */
4832
4821
  if (!completed && !errored) {
4833
- const cancelationReason = `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}`;
4834
- this.cancelNavigationTransition(t, cancelationReason);
4822
+ const cancelationReason = NG_DEV_MODE$1 ?
4823
+ `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
4824
+ '';
4825
+ this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4835
4826
  }
4836
4827
  // Only clear current navigation if it is still set to the one that
4837
4828
  // finalized.
@@ -4864,7 +4855,7 @@ class Router {
4864
4855
  this.navigated = true;
4865
4856
  this.restoreHistory(t, true);
4866
4857
  }
4867
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message);
4858
+ const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, 0 /* NavigationCancellationCode.Redirect */);
4868
4859
  eventsSubject.next(navCancel);
4869
4860
  // When redirecting, we need to delay resolving the navigation
4870
4861
  // promise and push it to the redirect navigation
@@ -5335,8 +5326,8 @@ class Router {
5335
5326
  resetUrlToCurrentUrlTree() {
5336
5327
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5337
5328
  }
5338
- cancelNavigationTransition(t, reason) {
5339
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason);
5329
+ cancelNavigationTransition(t, reason, code) {
5330
+ const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
5340
5331
  this.triggerEvent(navCancel);
5341
5332
  t.resolve(false);
5342
5333
  }
@@ -5347,16 +5338,16 @@ class Router {
5347
5338
  return { navigationId };
5348
5339
  }
5349
5340
  }
5350
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5351
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: Router });
5352
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: Router, decorators: [{
5341
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5342
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router });
5343
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: Router, decorators: [{
5353
5344
  type: Injectable
5354
5345
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5355
5346
  function validateCommands(commands) {
5356
5347
  for (let i = 0; i < commands.length; i++) {
5357
5348
  const cmd = commands[i];
5358
5349
  if (cmd == null) {
5359
- throw new Error(`The requested path contains ${cmd} segment at index ${i}`);
5350
+ throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
5360
5351
  }
5361
5352
  }
5362
5353
  }
@@ -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 () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
@@ -5667,9 +5658,9 @@ class RouterLinkWithHref {
5667
5658
  });
5668
5659
  }
5669
5660
  }
5670
- 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 });
5671
- 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 });
5672
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5661
+ 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 });
5662
+ 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 });
5663
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5673
5664
  type: Directive,
5674
5665
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5675
5666
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5894,9 +5885,9 @@ class RouterLinkActive {
5894
5885
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5895
5886
  }
5896
5887
  }
5897
- 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 });
5898
- 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 });
5899
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterLinkActive, decorators: [{
5888
+ 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 });
5889
+ 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 });
5890
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterLinkActive, decorators: [{
5900
5891
  type: Directive,
5901
5892
  args: [{
5902
5893
  selector: '[routerLinkActive]',
@@ -5999,9 +5990,9 @@ class DefaultTitleStrategy extends TitleStrategy {
5999
5990
  }
6000
5991
  }
6001
5992
  }
6002
- 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 });
6003
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6004
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5993
+ 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 });
5994
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5995
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6005
5996
  type: Injectable,
6006
5997
  args: [{ providedIn: 'root' }]
6007
5998
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -6038,9 +6029,9 @@ class PreloadAllModules {
6038
6029
  return fn().pipe(catchError(() => of(null)));
6039
6030
  }
6040
6031
  }
6041
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6042
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6043
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: PreloadAllModules, decorators: [{
6032
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6033
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6034
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: PreloadAllModules, decorators: [{
6044
6035
  type: Injectable,
6045
6036
  args: [{ providedIn: 'root' }]
6046
6037
  }] });
@@ -6058,9 +6049,9 @@ class NoPreloading {
6058
6049
  return of(null);
6059
6050
  }
6060
6051
  }
6061
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6062
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6063
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: NoPreloading, decorators: [{
6052
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6053
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6054
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: NoPreloading, decorators: [{
6064
6055
  type: Injectable,
6065
6056
  args: [{ providedIn: 'root' }]
6066
6057
  }] });
@@ -6146,9 +6137,9 @@ class RouterPreloader {
6146
6137
  });
6147
6138
  }
6148
6139
  }
6149
- 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 });
6150
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterPreloader });
6151
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterPreloader, decorators: [{
6140
+ 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 });
6141
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader });
6142
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterPreloader, decorators: [{
6152
6143
  type: Injectable
6153
6144
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6154
6145
 
@@ -6235,9 +6226,9 @@ class RouterScroller {
6235
6226
  }
6236
6227
  }
6237
6228
  }
6238
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6239
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterScroller });
6240
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterScroller, decorators: [{
6229
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6230
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller });
6231
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterScroller, decorators: [{
6241
6232
  type: Injectable
6242
6233
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6243
6234
 
@@ -6370,10 +6361,10 @@ class RouterModule {
6370
6361
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6371
6362
  }
6372
6363
  }
6373
- 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 });
6374
- 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] });
6375
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterModule });
6376
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.3", ngImport: i0, type: RouterModule, decorators: [{
6364
+ 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 });
6365
+ 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] });
6366
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule });
6367
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4", ngImport: i0, type: RouterModule, decorators: [{
6377
6368
  type: NgModule,
6378
6369
  args: [{
6379
6370
  declarations: ROUTER_DIRECTIVES,
@@ -6409,7 +6400,7 @@ function providePathLocationStrategy() {
6409
6400
  }
6410
6401
  function provideForRootGuard(router) {
6411
6402
  if (NG_DEV_MODE && router) {
6412
- throw new Error(`RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6403
+ throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
6413
6404
  }
6414
6405
  return 'guarded';
6415
6406
  }
@@ -6535,17 +6526,50 @@ function provideEnabledBlockingInitialNavigation() {
6535
6526
  useFactory: (injector) => {
6536
6527
  const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6537
6528
  let initNavigation = false;
6529
+ /**
6530
+ * Performs the given action once the router finishes its next/current navigation.
6531
+ *
6532
+ * If the navigation is canceled or errors without a redirect, the navigation is considered
6533
+ * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6534
+ */
6535
+ function afterNextNavigation(action) {
6536
+ const router = injector.get(Router);
6537
+ router.events
6538
+ .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6539
+ e instanceof NavigationError), map(e => {
6540
+ if (e instanceof NavigationEnd) {
6541
+ // Navigation assumed to succeed if we get `ActivationStart`
6542
+ return true;
6543
+ }
6544
+ const redirecting = e instanceof NavigationCancel ?
6545
+ (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6546
+ e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6547
+ false;
6548
+ return redirecting ? null : false;
6549
+ }), filter((result) => result !== null), take(1))
6550
+ .subscribe(() => {
6551
+ action();
6552
+ });
6553
+ }
6538
6554
  return () => {
6539
6555
  return locationInitialized.then(() => {
6540
6556
  return new Promise(resolve => {
6541
6557
  const router = injector.get(Router);
6542
6558
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6559
+ afterNextNavigation(() => {
6560
+ // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6561
+ // without a redirect.
6562
+ resolve(true);
6563
+ initNavigation = true;
6564
+ });
6543
6565
  router.afterPreactivation = () => {
6544
- // only the initial navigation should be delayed
6566
+ // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6567
+ // assume activation will complete successfully (even though this is not
6568
+ // guaranteed).
6569
+ resolve(true);
6570
+ // only the initial navigation should be delayed until bootstrapping is done.
6545
6571
  if (!initNavigation) {
6546
- initNavigation = true;
6547
- resolve(true);
6548
- return bootstrapDone;
6572
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6549
6573
  // subsequent navigations should not be delayed
6550
6574
  }
6551
6575
  else {
@@ -6616,7 +6640,7 @@ function providePreloading(preloadingStrategy) {
6616
6640
  /**
6617
6641
  * @publicApi
6618
6642
  */
6619
- const VERSION = new Version('14.1.0-next.3');
6643
+ const VERSION = new Version('14.1.0-next.4');
6620
6644
 
6621
6645
  /**
6622
6646
  * @license