@angular/router 14.1.0-next.4 → 14.1.1

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.
Files changed (39) hide show
  1. package/esm2020/src/apply_redirects.mjs +6 -5
  2. package/esm2020/src/components/empty_outlet.mjs +3 -3
  3. package/esm2020/src/directives/router_link.mjs +6 -6
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +4 -4
  6. package/esm2020/src/events.mjs +10 -2
  7. package/esm2020/src/index.mjs +3 -2
  8. package/esm2020/src/models.mjs +1 -1
  9. package/esm2020/src/navigation_canceling_error.mjs +32 -0
  10. package/esm2020/src/operators/check_guards.mjs +5 -6
  11. package/esm2020/src/operators/prioritized_guard_value.mjs +22 -27
  12. package/esm2020/src/operators/recognize.mjs +1 -1
  13. package/esm2020/src/page_title_strategy.mjs +11 -5
  14. package/esm2020/src/private_export.mjs +3 -2
  15. package/esm2020/src/router.mjs +134 -83
  16. package/esm2020/src/router_config.mjs +19 -0
  17. package/esm2020/src/router_config_loader.mjs +3 -3
  18. package/esm2020/src/router_module.mjs +21 -78
  19. package/esm2020/src/router_preloader.mjs +19 -11
  20. package/esm2020/src/router_scroller.mjs +3 -3
  21. package/esm2020/src/shared.mjs +1 -11
  22. package/esm2020/src/url_tree.mjs +4 -1
  23. package/esm2020/src/utils/type_guards.mjs +9 -5
  24. package/esm2020/src/version.mjs +1 -1
  25. package/esm2020/testing/src/router_testing_module.mjs +10 -12
  26. package/fesm2015/router.mjs +388 -323
  27. package/fesm2015/router.mjs.map +1 -1
  28. package/fesm2015/testing.mjs +10 -12
  29. package/fesm2015/testing.mjs.map +1 -1
  30. package/fesm2015/upgrade.mjs +1 -1
  31. package/fesm2020/router.mjs +382 -326
  32. package/fesm2020/router.mjs.map +1 -1
  33. package/fesm2020/testing.mjs +10 -12
  34. package/fesm2020/testing.mjs.map +1 -1
  35. package/fesm2020/upgrade.mjs +1 -1
  36. package/index.d.ts +22 -9
  37. package/package.json +4 -4
  38. package/testing/index.d.ts +2 -3
  39. package/upgrade/index.d.ts +1 -1
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.4
2
+ * @license Angular v14.1.1
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, ɵ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';
8
+ import { ɵisObservable, ɵisPromise, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, inject, Injectable, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, NgProbeToken, SkipSelf, 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
- 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
10
  import * as i3 from '@angular/common';
12
11
  import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
12
+ import { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
13
13
  import * as i1 from '@angular/platform-browser';
14
14
 
15
15
  /**
@@ -60,16 +60,6 @@ class ParamsAsMap {
60
60
  function convertToParamMap(params) {
61
61
  return new ParamsAsMap(params);
62
62
  }
63
- const REDIRECTING_CANCELLATION_REASON = 'Redirecting to ';
64
- const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
65
- function navigationCancelingError(message) {
66
- const error = Error('NavigationCancelingError: ' + (message || ''));
67
- error[NAVIGATION_CANCELING_ERROR] = true;
68
- return error;
69
- }
70
- function isNavigationCancelingError(error) {
71
- return error && error[NAVIGATION_CANCELING_ERROR];
72
- }
73
63
  // Matches the route configuration (`route`) against the actual URL (`segments`).
74
64
  function defaultUrlMatcher(segments, segmentGroup, route) {
75
65
  const parts = route.path.split('/');
@@ -192,7 +182,7 @@ function wrapIntoObservable(value) {
192
182
  * Use of this source code is governed by an MIT-style license that can be
193
183
  * found in the LICENSE file at https://angular.io/license
194
184
  */
195
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
185
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
196
186
  function createEmptyUrlTree() {
197
187
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
198
188
  }
@@ -657,7 +647,7 @@ class UrlParser {
657
647
  parseSegment() {
658
648
  const path = matchSegments(this.remaining);
659
649
  if (path === '' && this.peekStartsWith(';')) {
660
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$7 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
650
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
661
651
  }
662
652
  this.capture(path);
663
653
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -726,7 +716,7 @@ class UrlParser {
726
716
  // if is is not one of these characters, then the segment was unescaped
727
717
  // or the group was not closed
728
718
  if (next !== '/' && next !== ')' && next !== ';') {
729
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$7 && `Cannot parse url '${this.url}'`);
719
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
730
720
  }
731
721
  let outletName = undefined;
732
722
  if (path.indexOf(':') > -1) {
@@ -757,7 +747,7 @@ class UrlParser {
757
747
  }
758
748
  capture(str) {
759
749
  if (!this.consumeOptional(str)) {
760
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$7 && `Expected "${str}".`);
750
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
761
751
  }
762
752
  }
763
753
  }
@@ -799,6 +789,9 @@ function mergeTrivialChildren(s) {
799
789
  }
800
790
  return s;
801
791
  }
792
+ function isUrlTree(v) {
793
+ return v instanceof UrlTree;
794
+ }
802
795
 
803
796
  /**
804
797
  * @license
@@ -807,7 +800,7 @@ function mergeTrivialChildren(s) {
807
800
  * Use of this source code is governed by an MIT-style license that can be
808
801
  * found in the LICENSE file at https://angular.io/license
809
802
  */
810
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
803
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
811
804
  /**
812
805
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
813
806
  *
@@ -985,11 +978,11 @@ class Navigation {
985
978
  this.numberOfDoubleDots = numberOfDoubleDots;
986
979
  this.commands = commands;
987
980
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
988
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$6 && 'Root segment cannot have matrix parameters');
981
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
989
982
  }
990
983
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
991
984
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
992
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$6 && '{outlets:{}} has to be the last command');
985
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
993
986
  }
994
987
  }
995
988
  toRoot() {
@@ -1088,7 +1081,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1088
1081
  dd -= ci;
1089
1082
  g = g.parent;
1090
1083
  if (!g) {
1091
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$6 && 'Invalid number of \'../\'');
1084
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
1092
1085
  }
1093
1086
  ci = g.segments.length;
1094
1087
  }
@@ -1380,9 +1373,17 @@ class NavigationError extends RouterEvent {
1380
1373
  /** @docsNotRequired */
1381
1374
  url,
1382
1375
  /** @docsNotRequired */
1383
- error) {
1376
+ error,
1377
+ /**
1378
+ * The target of the navigation when the error occurred.
1379
+ *
1380
+ * Note that this can be `undefined` because an error could have occurred before the
1381
+ * `RouterStateSnapshot` was created for the navigation.
1382
+ */
1383
+ target) {
1384
1384
  super(id, url);
1385
1385
  this.error = error;
1386
+ this.target = target;
1386
1387
  this.type = 3 /* EventType.NavigationError */;
1387
1388
  }
1388
1389
  /** @docsNotRequired */
@@ -2246,6 +2247,37 @@ function createActivatedRoute(c) {
2246
2247
  return new ActivatedRoute(new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c);
2247
2248
  }
2248
2249
 
2250
+ /**
2251
+ * @license
2252
+ * Copyright Google LLC All Rights Reserved.
2253
+ *
2254
+ * Use of this source code is governed by an MIT-style license that can be
2255
+ * found in the LICENSE file at https://angular.io/license
2256
+ */
2257
+ const NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
2258
+ function redirectingNavigationError(urlSerializer, redirect) {
2259
+ const { redirectTo, navigationBehaviorOptions } = isUrlTree(redirect) ? { redirectTo: redirect, navigationBehaviorOptions: undefined } : redirect;
2260
+ const error = navigationCancelingError(ngDevMode && `Redirecting to "${urlSerializer.serialize(redirectTo)}"`, 0 /* NavigationCancellationCode.Redirect */, redirect);
2261
+ error.url = redirectTo;
2262
+ error.navigationBehaviorOptions = navigationBehaviorOptions;
2263
+ return error;
2264
+ }
2265
+ function navigationCancelingError(message, code, redirectUrl) {
2266
+ const error = new Error('NavigationCancelingError: ' + (message || ''));
2267
+ error[NAVIGATION_CANCELING_ERROR] = true;
2268
+ error.cancellationCode = code;
2269
+ if (redirectUrl) {
2270
+ error.url = redirectUrl;
2271
+ }
2272
+ return error;
2273
+ }
2274
+ function isRedirectingNavigationCancelingError$1(error) {
2275
+ return isNavigationCancelingError$1(error) && isUrlTree(error.url);
2276
+ }
2277
+ function isNavigationCancelingError$1(error) {
2278
+ return error && error[NAVIGATION_CANCELING_ERROR];
2279
+ }
2280
+
2249
2281
  /**
2250
2282
  * @license
2251
2283
  * Copyright Google LLC All Rights Reserved.
@@ -2332,7 +2364,7 @@ class ChildrenOutletContexts {
2332
2364
  * Use of this source code is governed by an MIT-style license that can be
2333
2365
  * found in the LICENSE file at https://angular.io/license
2334
2366
  */
2335
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2367
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2336
2368
  /**
2337
2369
  * @description
2338
2370
  *
@@ -2442,12 +2474,12 @@ class RouterOutlet {
2442
2474
  */
2443
2475
  get component() {
2444
2476
  if (!this.activated)
2445
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2477
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2446
2478
  return this.activated.instance;
2447
2479
  }
2448
2480
  get activatedRoute() {
2449
2481
  if (!this.activated)
2450
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2482
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2451
2483
  return this._activatedRoute;
2452
2484
  }
2453
2485
  get activatedRouteData() {
@@ -2461,7 +2493,7 @@ class RouterOutlet {
2461
2493
  */
2462
2494
  detach() {
2463
2495
  if (!this.activated)
2464
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$5 && 'Outlet is not activated');
2496
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2465
2497
  this.location.detach();
2466
2498
  const cmp = this.activated;
2467
2499
  this.activated = null;
@@ -2489,7 +2521,7 @@ class RouterOutlet {
2489
2521
  }
2490
2522
  activateWith(activatedRoute, resolverOrInjector) {
2491
2523
  if (this.isActivated) {
2492
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$5 && 'Cannot activate an already activated outlet');
2524
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
2493
2525
  }
2494
2526
  this._activatedRoute = activatedRoute;
2495
2527
  const location = this.location;
@@ -2511,9 +2543,9 @@ class RouterOutlet {
2511
2543
  this.activateEvents.emit(this.activated.instance);
2512
2544
  }
2513
2545
  }
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: [{
2546
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2547
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2548
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterOutlet, decorators: [{
2517
2549
  type: Directive,
2518
2550
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2519
2551
  }], ctorParameters: function () {
@@ -2572,9 +2604,9 @@ function isComponentFactoryResolver(item) {
2572
2604
  */
2573
2605
  class ɵEmptyOutletComponent {
2574
2606
  }
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: [{
2607
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2608
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.1", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2609
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2578
2610
  type: Component,
2579
2611
  args: [{ template: `<router-outlet></router-outlet>` }]
2580
2612
  }] });
@@ -3113,9 +3145,6 @@ function isFunction(v) {
3113
3145
  function isBoolean(v) {
3114
3146
  return typeof v === 'boolean';
3115
3147
  }
3116
- function isUrlTree(v) {
3117
- return v instanceof UrlTree;
3118
- }
3119
3148
  function isCanLoad(guard) {
3120
3149
  return guard && isFunction(guard.canLoad);
3121
3150
  }
@@ -3131,6 +3160,12 @@ function isCanDeactivate(guard) {
3131
3160
  function isCanMatch(guard) {
3132
3161
  return guard && isFunction(guard.canMatch);
3133
3162
  }
3163
+ function isRedirectingNavigationCancelingError(error) {
3164
+ return isNavigationCancelingError(error) && isUrlTree(error.url);
3165
+ }
3166
+ function isNavigationCancelingError(error) {
3167
+ return error && error[NAVIGATION_CANCELING_ERROR];
3168
+ }
3134
3169
 
3135
3170
  /**
3136
3171
  * @license
@@ -3143,31 +3178,26 @@ const INITIAL_VALUE = Symbol('INITIAL_VALUE');
3143
3178
  function prioritizedGuardValue() {
3144
3179
  return switchMap(obs => {
3145
3180
  return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE))))
3146
- .pipe(scan((acc, list) => {
3147
- let isPending = false;
3148
- return list.reduce((innerAcc, val, i) => {
3149
- if (innerAcc !== INITIAL_VALUE)
3150
- return innerAcc;
3151
- // Toggle pending flag if any values haven't been set yet
3152
- if (val === INITIAL_VALUE)
3153
- isPending = true;
3154
- // Any other return values are only valid if we haven't yet hit a pending
3155
- // call. This guarantees that in the case of a guard at the bottom of the
3156
- // tree that returns a redirect, we will wait for the higher priority
3157
- // guard at the top to finish before performing the redirect.
3158
- if (!isPending) {
3159
- // Early return when we hit a `false` value as that should always
3160
- // cancel navigation
3161
- if (val === false)
3162
- return val;
3163
- if (i === list.length - 1 || isUrlTree(val)) {
3164
- return val;
3165
- }
3181
+ .pipe(map((results) => {
3182
+ for (const result of results) {
3183
+ if (result === true) {
3184
+ // If result is true, check the next one
3185
+ continue;
3186
+ }
3187
+ else if (result === INITIAL_VALUE) {
3188
+ // If guard has not finished, we need to stop processing.
3189
+ return INITIAL_VALUE;
3166
3190
  }
3167
- return innerAcc;
3168
- }, acc);
3169
- }, INITIAL_VALUE), filter(item => item !== INITIAL_VALUE), map(item => isUrlTree(item) ? item : item === true), //
3170
- take(1));
3191
+ else if (result === false || result instanceof UrlTree) {
3192
+ // Result finished and was not true. Return the result.
3193
+ // Note that we only allow false/UrlTree. Other values are considered invalid and
3194
+ // ignored.
3195
+ return result;
3196
+ }
3197
+ }
3198
+ // Everything resolved to true. Return true.
3199
+ return true;
3200
+ }), filter((item) => item !== INITIAL_VALUE), take(1));
3171
3201
  });
3172
3202
  }
3173
3203
 
@@ -3295,9 +3325,7 @@ function redirectIfUrlTree(urlSerializer) {
3295
3325
  return pipe(tap((result) => {
3296
3326
  if (!isUrlTree(result))
3297
3327
  return;
3298
- const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON + urlSerializer.serialize(result));
3299
- error.url = result;
3300
- throw error;
3328
+ throw redirectingNavigationError(urlSerializer, result);
3301
3329
  }), map(result => result === true));
3302
3330
  }
3303
3331
  function runCanMatchGuards(injector, route, segments, urlSerializer) {
@@ -3475,7 +3503,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3475
3503
  * Use of this source code is governed by an MIT-style license that can be
3476
3504
  * found in the LICENSE file at https://angular.io/license
3477
3505
  */
3478
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3506
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3479
3507
  class NoMatch$1 {
3480
3508
  constructor(segmentGroup) {
3481
3509
  this.segmentGroup = segmentGroup || null;
@@ -3493,12 +3521,12 @@ function absoluteRedirect(newTree) {
3493
3521
  return throwError(new AbsoluteRedirect(newTree));
3494
3522
  }
3495
3523
  function namedOutletsRedirect(redirectTo) {
3496
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$4 &&
3524
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
3497
3525
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3498
3526
  }
3499
3527
  function canLoadFails(route) {
3500
- return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3501
- `Cannot load children because the guard of the route "path: '${route.path}'" returned false`));
3528
+ return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3529
+ `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3502
3530
  }
3503
3531
  /**
3504
3532
  * Returns the `UrlTree` with the redirection applied.
@@ -3557,7 +3585,7 @@ class ApplyRedirects {
3557
3585
  }));
3558
3586
  }
3559
3587
  noMatchError(e) {
3560
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$4 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3588
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3561
3589
  }
3562
3590
  createUrlTree(rootCandidate, queryParams, fragment) {
3563
3591
  const root = createRoot(rootCandidate);
@@ -3739,9 +3767,9 @@ class ApplyRedirects {
3739
3767
  }
3740
3768
  }
3741
3769
  applyRedirectCommands(segments, redirectTo, posParams) {
3742
- return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3770
+ return this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
3743
3771
  }
3744
- applyRedirectCreatreUrlTree(redirectTo, urlTree, segments, posParams) {
3772
+ applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {
3745
3773
  const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
3746
3774
  return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
3747
3775
  }
@@ -3774,7 +3802,7 @@ class ApplyRedirects {
3774
3802
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3775
3803
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3776
3804
  if (!pos)
3777
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3805
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3778
3806
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3779
3807
  return pos;
3780
3808
  }
@@ -3810,7 +3838,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3810
3838
  * Use of this source code is governed by an MIT-style license that can be
3811
3839
  * found in the LICENSE file at https://angular.io/license
3812
3840
  */
3813
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3841
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3814
3842
  class NoMatch {
3815
3843
  }
3816
3844
  function newObservableError(e) {
@@ -3899,7 +3927,7 @@ class Recognizer {
3899
3927
  // multiple activated results for the same outlet. We should merge the children of
3900
3928
  // these results so the final return value is only one `TreeNode` per outlet.
3901
3929
  const mergedChildren = mergeEmptyPathMatches(children);
3902
- if (NG_DEV_MODE$3) {
3930
+ if (NG_DEV_MODE$4) {
3903
3931
  // This should really never happen - we are only taking the first match for each
3904
3932
  // outlet and merge the empty path matches.
3905
3933
  checkOutletNameUniqueness(mergedChildren);
@@ -3934,7 +3962,7 @@ class Recognizer {
3934
3962
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3935
3963
  // production bundle size. This value is intended only to surface a warning to users
3936
3964
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3937
- (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3965
+ (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3938
3966
  pathIndexShift));
3939
3967
  matchResult = of({
3940
3968
  snapshot,
@@ -3951,7 +3979,7 @@ class Recognizer {
3951
3979
  return null;
3952
3980
  }
3953
3981
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3954
- const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$3 ?
3982
+ const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), getOutlet(route), (_b = (_a = route.component) !== null && _a !== void 0 ? _a : route._loadedComponent) !== null && _b !== void 0 ? _b : null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$4 ?
3955
3983
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3956
3984
  pathIndexShift));
3957
3985
  return { snapshot, consumedSegments, remainingSegments };
@@ -4065,7 +4093,7 @@ function checkOutletNameUniqueness(nodes) {
4065
4093
  if (routeWithSameOutletName) {
4066
4094
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4067
4095
  const c = n.value.url.map(s => s.toString()).join('/');
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}'.`);
4096
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$4 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4069
4097
  }
4070
4098
  names[n.value.outlet] = n.value;
4071
4099
  });
@@ -4202,6 +4230,91 @@ function switchTap(next) {
4202
4230
  });
4203
4231
  }
4204
4232
 
4233
+ /**
4234
+ * @license
4235
+ * Copyright Google LLC All Rights Reserved.
4236
+ *
4237
+ * Use of this source code is governed by an MIT-style license that can be
4238
+ * found in the LICENSE file at https://angular.io/license
4239
+ */
4240
+ /**
4241
+ * Provides a strategy for setting the page title after a router navigation.
4242
+ *
4243
+ * The built-in implementation traverses the router state snapshot and finds the deepest primary
4244
+ * outlet with `title` property. Given the `Routes` below, navigating to
4245
+ * `/base/child(popup:aux)` would result in the document title being set to "child".
4246
+ * ```
4247
+ * [
4248
+ * {path: 'base', title: 'base', children: [
4249
+ * {path: 'child', title: 'child'},
4250
+ * ],
4251
+ * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
4252
+ * ]
4253
+ * ```
4254
+ *
4255
+ * This class can be used as a base class for custom title strategies. That is, you can create your
4256
+ * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
4257
+ * from the named outlet is never used. However, a custom strategy might be implemented to
4258
+ * incorporate titles in named outlets.
4259
+ *
4260
+ * @publicApi
4261
+ * @see [Page title guide](guide/router#setting-the-page-title)
4262
+ */
4263
+ class TitleStrategy {
4264
+ /**
4265
+ * @returns The `title` of the deepest primary route.
4266
+ */
4267
+ buildTitle(snapshot) {
4268
+ var _a;
4269
+ let pageTitle;
4270
+ let route = snapshot.root;
4271
+ while (route !== undefined) {
4272
+ pageTitle = (_a = this.getResolvedTitleForRoute(route)) !== null && _a !== void 0 ? _a : pageTitle;
4273
+ route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
4274
+ }
4275
+ return pageTitle;
4276
+ }
4277
+ /**
4278
+ * Given an `ActivatedRouteSnapshot`, returns the final value of the
4279
+ * `Route.title` property, which can either be a static string or a resolved value.
4280
+ */
4281
+ getResolvedTitleForRoute(snapshot) {
4282
+ return snapshot.data[RouteTitle];
4283
+ }
4284
+ }
4285
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4286
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4287
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: TitleStrategy, decorators: [{
4288
+ type: Injectable,
4289
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4290
+ }] });
4291
+ /**
4292
+ * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
4293
+ */
4294
+ class DefaultTitleStrategy extends TitleStrategy {
4295
+ constructor(title) {
4296
+ super();
4297
+ this.title = title;
4298
+ }
4299
+ /**
4300
+ * Sets the title of the browser to the given value.
4301
+ *
4302
+ * @param title The `pageTitle` from the deepest primary route.
4303
+ */
4304
+ updateTitle(snapshot) {
4305
+ const title = this.buildTitle(snapshot);
4306
+ if (title !== undefined) {
4307
+ this.title.setTitle(title);
4308
+ }
4309
+ }
4310
+ }
4311
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4312
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4314
+ type: Injectable,
4315
+ args: [{ providedIn: 'root' }]
4316
+ }], ctorParameters: function () { return [{ type: i1.Title }]; } });
4317
+
4205
4318
  /**
4206
4319
  * @license
4207
4320
  * Copyright Google LLC All Rights Reserved.
@@ -4267,6 +4380,24 @@ class BaseRouteReuseStrategy {
4267
4380
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4268
4381
  }
4269
4382
 
4383
+ /**
4384
+ * @license
4385
+ * Copyright Google LLC All Rights Reserved.
4386
+ *
4387
+ * Use of this source code is governed by an MIT-style license that can be
4388
+ * found in the LICENSE file at https://angular.io/license
4389
+ */
4390
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4391
+ /**
4392
+ * A [DI token](guide/glossary/#di-token) for the router service.
4393
+ *
4394
+ * @publicApi
4395
+ */
4396
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4397
+ providedIn: 'root',
4398
+ factory: () => ({}),
4399
+ });
4400
+
4270
4401
  /**
4271
4402
  * @license
4272
4403
  * Copyright Google LLC All Rights Reserved.
@@ -4374,9 +4505,9 @@ class RouterConfigLoader {
4374
4505
  }));
4375
4506
  }
4376
4507
  }
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: [{
4508
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4509
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterConfigLoader });
4510
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4380
4511
  type: Injectable
4381
4512
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4382
4513
 
@@ -4411,6 +4542,13 @@ class DefaultUrlHandlingStrategy {
4411
4542
  }
4412
4543
  }
4413
4544
 
4545
+ /**
4546
+ * @license
4547
+ * Copyright Google LLC All Rights Reserved.
4548
+ *
4549
+ * Use of this source code is governed by an MIT-style license that can be
4550
+ * found in the LICENSE file at https://angular.io/license
4551
+ */
4414
4552
  const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4415
4553
  function defaultErrorHandler(error) {
4416
4554
  throw error;
@@ -4438,6 +4576,53 @@ const subsetMatchOptions = {
4438
4576
  matrixParams: 'ignored',
4439
4577
  queryParams: 'subset'
4440
4578
  };
4579
+ function assignExtraOptionsToRouter(opts, router) {
4580
+ if (opts.errorHandler) {
4581
+ router.errorHandler = opts.errorHandler;
4582
+ }
4583
+ if (opts.malformedUriErrorHandler) {
4584
+ router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
4585
+ }
4586
+ if (opts.onSameUrlNavigation) {
4587
+ router.onSameUrlNavigation = opts.onSameUrlNavigation;
4588
+ }
4589
+ if (opts.paramsInheritanceStrategy) {
4590
+ router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
4591
+ }
4592
+ if (opts.relativeLinkResolution) {
4593
+ router.relativeLinkResolution = opts.relativeLinkResolution;
4594
+ }
4595
+ if (opts.urlUpdateStrategy) {
4596
+ router.urlUpdateStrategy = opts.urlUpdateStrategy;
4597
+ }
4598
+ if (opts.canceledNavigationResolution) {
4599
+ router.canceledNavigationResolution = opts.canceledNavigationResolution;
4600
+ }
4601
+ }
4602
+ function setupRouter() {
4603
+ var _a, _b;
4604
+ const urlSerializer = inject(UrlSerializer);
4605
+ const contexts = inject(ChildrenOutletContexts);
4606
+ const location = inject(Location);
4607
+ const injector = inject(Injector);
4608
+ const compiler = inject(Compiler);
4609
+ const config = (_a = inject(ROUTES, { optional: true })) !== null && _a !== void 0 ? _a : [];
4610
+ const opts = (_b = inject(ROUTER_CONFIGURATION, { optional: true })) !== null && _b !== void 0 ? _b : {};
4611
+ const defaultTitleStrategy = inject(DefaultTitleStrategy);
4612
+ const titleStrategy = inject(TitleStrategy, { optional: true });
4613
+ const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
4614
+ const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
4615
+ const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
4616
+ if (urlHandlingStrategy) {
4617
+ router.urlHandlingStrategy = urlHandlingStrategy;
4618
+ }
4619
+ if (routeReuseStrategy) {
4620
+ router.routeReuseStrategy = routeReuseStrategy;
4621
+ }
4622
+ router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
4623
+ assignExtraOptionsToRouter(opts, router);
4624
+ return router;
4625
+ }
4441
4626
  /**
4442
4627
  * @description
4443
4628
  *
@@ -4627,10 +4812,11 @@ class Router {
4627
4812
  // Extract URL
4628
4813
  map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))),
4629
4814
  // Using switchMap so we cancel executing navigations when a new one comes in
4630
- switchMap(t => {
4815
+ switchMap(overallTransitionState => {
4631
4816
  let completed = false;
4632
4817
  let errored = false;
4633
- return of(t).pipe(
4818
+ return of(overallTransitionState)
4819
+ .pipe(
4634
4820
  // Store the Navigation object
4635
4821
  tap(t => {
4636
4822
  this.currentNavigation = {
@@ -4648,8 +4834,8 @@ class Router {
4648
4834
  t.extractedUrl.toString() !== browserUrlTree ||
4649
4835
  // Navigations which succeed or ones which fail and are cleaned up
4650
4836
  // correctly should result in `browserUrlTree` and `currentUrlTree`
4651
- // matching. If this is not the case, assume something went wrong and try
4652
- // processing the URL again.
4837
+ // matching. If this is not the case, assume something went wrong and
4838
+ // try processing the URL again.
4653
4839
  browserUrlTree !== this.currentUrlTree.toString();
4654
4840
  const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4655
4841
  this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
@@ -4677,11 +4863,13 @@ class Router {
4677
4863
  // `urlAfterRedirects` is guaranteed to be set after this point
4678
4864
  tap(t => {
4679
4865
  this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
4866
+ overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4680
4867
  }),
4681
4868
  // Recognize
4682
4869
  recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy, this.relativeLinkResolution),
4683
4870
  // Update URL if in `eager` update mode
4684
4871
  tap(t => {
4872
+ overallTransitionState.targetSnapshot = t.targetSnapshot;
4685
4873
  if (this.urlUpdateStrategy === 'eager') {
4686
4874
  if (!t.extras.skipLocationChange) {
4687
4875
  const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
@@ -4697,21 +4885,22 @@ class Router {
4697
4885
  else {
4698
4886
  const processPreviousUrl = urlTransition && this.rawUrlTree &&
4699
4887
  this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
4700
- /* When the current URL shouldn't be processed, but the previous one was,
4701
- * we handle this "error condition" by navigating to the previously
4702
- * successful URL, but leaving the URL intact.*/
4888
+ /* When the current URL shouldn't be processed, but the previous one
4889
+ * was, we handle this "error condition" by navigating to the
4890
+ * previously successful URL, but leaving the URL intact.*/
4703
4891
  if (processPreviousUrl) {
4704
4892
  const { id, extractedUrl, source, restoredState, extras } = t;
4705
4893
  const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
4706
4894
  eventsSubject.next(navStart);
4707
4895
  const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
4708
- return of(Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) }));
4896
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
4897
+ return of(overallTransitionState);
4709
4898
  }
4710
4899
  else {
4711
- /* When neither the current or previous URL can be processed, do nothing
4712
- * other than update router's internal reference to the current "settled"
4713
- * URL. This way the next navigation will be coming from the current URL
4714
- * in the browser.
4900
+ /* When neither the current or previous URL can be processed, do
4901
+ * nothing other than update router's internal reference to the
4902
+ * current "settled" URL. This way the next navigation will be coming
4903
+ * from the current URL in the browser.
4715
4904
  */
4716
4905
  this.rawUrlTree = t.rawUrl;
4717
4906
  t.resolve(null);
@@ -4723,12 +4912,13 @@ class Router {
4723
4912
  tap(t => {
4724
4913
  const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4725
4914
  this.triggerEvent(guardsStart);
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 => {
4915
+ }), map(t => {
4916
+ overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) });
4917
+ return overallTransitionState;
4918
+ }), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
4919
+ overallTransitionState.guardsResult = t.guardsResult;
4727
4920
  if (isUrlTree(t.guardsResult)) {
4728
- const error = navigationCancelingError(REDIRECTING_CANCELLATION_REASON +
4729
- `"${this.serializeUrl(t.guardsResult)}"`);
4730
- error.url = t.guardsResult;
4731
- throw error;
4921
+ throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4732
4922
  }
4733
4923
  const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4734
4924
  this.triggerEvent(guardsEnd);
@@ -4787,13 +4977,14 @@ class Router {
4787
4977
  .pipe(defaultIfEmpty(), take(1));
4788
4978
  }), switchTap(() => this.afterPreactivation()), map((t) => {
4789
4979
  const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4790
- return (Object.assign(Object.assign({}, t), { targetRouterState }));
4980
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
4981
+ return (overallTransitionState);
4791
4982
  }),
4792
- /* Once here, we are about to activate syncronously. The assumption is this
4793
- will succeed, and user code may read from the Router service. Therefore
4794
- before activation, we need to update router properties storing the current
4795
- URL and the RouterState, as well as updated the browser URL. All this should
4796
- happen *before* activating. */
4983
+ /* Once here, we are about to activate synchronously. The assumption is
4984
+ this will succeed, and user code may read from the Router service.
4985
+ Therefore before activation, we need to update router properties storing
4986
+ the current URL and the RouterState, as well as updated the browser URL.
4987
+ All this should happen *before* activating. */
4797
4988
  tap((t) => {
4798
4989
  this.currentUrlTree = t.urlAfterRedirects;
4799
4990
  this.rawUrlTree =
@@ -4814,82 +5005,76 @@ class Router {
4814
5005
  }
4815
5006
  }), finalize(() => {
4816
5007
  var _a;
4817
- /* When the navigation stream finishes either through error or success, we
4818
- * set the `completed` or `errored` flag. However, there are some situations
4819
- * where we could get here without either of those being set. For instance, a
4820
- * redirect during NavigationStart. Therefore, this is a catch-all to make
4821
- * sure the NavigationCancel
4822
- * event is fired when a navigation gets cancelled but not caught by other
4823
- * means. */
5008
+ /* When the navigation stream finishes either through error or success,
5009
+ * we set the `completed` or `errored` flag. However, there are some
5010
+ * situations where we could get here without either of those being set.
5011
+ * For instance, a redirect during NavigationStart. Therefore, this is a
5012
+ * catch-all to make sure the NavigationCancel event is fired when a
5013
+ * navigation gets cancelled but not caught by other means. */
4824
5014
  if (!completed && !errored) {
4825
5015
  const cancelationReason = NG_DEV_MODE$1 ?
4826
- `Navigation ID ${t.id} is not equal to the current navigation id ${this.navigationId}` :
5016
+ `Navigation ID ${overallTransitionState
5017
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4827
5018
  '';
4828
- this.cancelNavigationTransition(t, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
5019
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4829
5020
  }
4830
5021
  // Only clear current navigation if it is still set to the one that
4831
5022
  // finalized.
4832
- if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === t.id) {
5023
+ if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === overallTransitionState.id) {
4833
5024
  this.currentNavigation = null;
4834
5025
  }
4835
5026
  }), catchError((e) => {
4836
- // TODO(atscott): The NavigationTransition `t` used here does not accurately
4837
- // reflect the current state of the whole transition because some operations
4838
- // return a new object rather than modifying the one in the outermost
4839
- // `switchMap`.
4840
- // The fix can likely be to:
4841
- // 1. Rename the outer `t` variable so it's not shadowed all the time and
4842
- // confusing
4843
- // 2. Keep reassigning to the outer variable after each stage to ensure it
4844
- // gets updated. Or change the implementations to not return a copy.
4845
- // Not changed yet because it affects existing code and would need to be
4846
- // tested more thoroughly.
5027
+ var _a;
4847
5028
  errored = true;
4848
5029
  /* This error type is issued during Redirect, and is handled as a
4849
5030
  * cancellation rather than an error. */
4850
- if (isNavigationCancelingError(e)) {
4851
- const redirecting = isUrlTree(e.url);
4852
- if (!redirecting) {
4853
- // Set property only if we're not redirecting. If we landed on a page and
4854
- // redirect to `/` route, the new navigation is going to see the `/`
4855
- // isn't a change from the default currentUrlTree and won't navigate.
4856
- // This is only applicable with initial navigation, so setting
4857
- // `navigated` only when not redirecting resolves this scenario.
5031
+ if (isNavigationCancelingError$1(e)) {
5032
+ if (!isRedirectingNavigationCancelingError$1(e)) {
5033
+ // Set property only if we're not redirecting. If we landed on a page
5034
+ // and redirect to `/` route, the new navigation is going to see the
5035
+ // `/` isn't a change from the default currentUrlTree and won't
5036
+ // navigate. This is only applicable with initial navigation, so
5037
+ // setting `navigated` only when not redirecting resolves this
5038
+ // scenario.
4858
5039
  this.navigated = true;
4859
- this.restoreHistory(t, true);
5040
+ this.restoreHistory(overallTransitionState, true);
4860
5041
  }
4861
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), e.message, 0 /* NavigationCancellationCode.Redirect */);
5042
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4862
5043
  eventsSubject.next(navCancel);
4863
5044
  // When redirecting, we need to delay resolving the navigation
4864
5045
  // promise and push it to the redirect navigation
4865
- if (!redirecting) {
4866
- t.resolve(false);
5046
+ if (!isRedirectingNavigationCancelingError$1(e)) {
5047
+ overallTransitionState.resolve(false);
4867
5048
  }
4868
5049
  else {
4869
5050
  const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
4870
5051
  const extras = {
4871
- skipLocationChange: t.extras.skipLocationChange,
5052
+ skipLocationChange: overallTransitionState.extras.skipLocationChange,
4872
5053
  // The URL is already updated at this point if we have 'eager' URL
4873
5054
  // updates or if the navigation was triggered by the browser (back
4874
- // button, URL bar, etc). We want to replace that item in history if
4875
- // the navigation is rejected.
5055
+ // button, URL bar, etc). We want to replace that item in history
5056
+ // if the navigation is rejected.
4876
5057
  replaceUrl: this.urlUpdateStrategy === 'eager' ||
4877
- isBrowserTriggeredNavigation(t.source)
5058
+ isBrowserTriggeredNavigation(overallTransitionState.source)
4878
5059
  };
4879
- this.scheduleNavigation(mergedTree, 'imperative', null, extras, { resolve: t.resolve, reject: t.reject, promise: t.promise });
5060
+ this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
5061
+ resolve: overallTransitionState.resolve,
5062
+ reject: overallTransitionState.reject,
5063
+ promise: overallTransitionState.promise
5064
+ });
4880
5065
  }
4881
- /* All other errors should reset to the router's internal URL reference to
4882
- * the pre-error state. */
5066
+ /* All other errors should reset to the router's internal URL reference
5067
+ * to the pre-error state. */
4883
5068
  }
4884
5069
  else {
4885
- this.restoreHistory(t, true);
4886
- const navError = new NavigationError(t.id, this.serializeUrl(t.extractedUrl), e);
5070
+ this.restoreHistory(overallTransitionState, true);
5071
+ const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4887
5072
  eventsSubject.next(navError);
4888
5073
  try {
4889
- t.resolve(this.errorHandler(e));
5074
+ overallTransitionState.resolve(this.errorHandler(e));
4890
5075
  }
4891
5076
  catch (ee) {
4892
- t.reject(ee);
5077
+ overallTransitionState.reject(ee);
4893
5078
  }
4894
5079
  }
4895
5080
  return EMPTY;
@@ -5287,7 +5472,7 @@ class Router {
5287
5472
  // The navigator change the location before triggered the browser event,
5288
5473
  // so we need to go back to the current url if the navigation is canceled.
5289
5474
  // Also, when navigation gets cancelled while using url update strategy eager, then we need to
5290
- // go back. Because, when `urlUpdateSrategy` is `eager`; `setBrowserUrl` method is called
5475
+ // go back. Because, when `urlUpdateStrategy` is `eager`; `setBrowserUrl` method is called
5291
5476
  // before any verification.
5292
5477
  const browserUrlUpdateOccurred = (t.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
5293
5478
  this.currentUrlTree === ((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.finalUrl));
@@ -5345,10 +5530,14 @@ class Router {
5345
5530
  return { navigationId };
5346
5531
  }
5347
5532
  }
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: [{
5351
- type: Injectable
5533
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5534
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5535
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: Router, decorators: [{
5536
+ type: Injectable,
5537
+ args: [{
5538
+ providedIn: 'root',
5539
+ useFactory: setupRouter,
5540
+ }]
5352
5541
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5353
5542
  function validateCommands(commands) {
5354
5543
  for (let i = 0; i < commands.length; i++) {
@@ -5539,9 +5728,9 @@ class RouterLink {
5539
5728
  });
5540
5729
  }
5541
5730
  }
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: [{
5731
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5732
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5733
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLink, decorators: [{
5545
5734
  type: Directive,
5546
5735
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5547
5736
  }], ctorParameters: function () {
@@ -5660,9 +5849,9 @@ class RouterLinkWithHref {
5660
5849
  });
5661
5850
  }
5662
5851
  }
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: [{
5852
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5853
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5854
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5666
5855
  type: Directive,
5667
5856
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5668
5857
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5889,9 +6078,9 @@ class RouterLinkActive {
5889
6078
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5890
6079
  }
5891
6080
  }
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: [{
6081
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6082
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.1", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6083
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterLinkActive, decorators: [{
5895
6084
  type: Directive,
5896
6085
  args: [{
5897
6086
  selector: '[routerLinkActive]',
@@ -5925,85 +6114,6 @@ function isActiveMatchOptions(options) {
5925
6114
  return !!options.paths;
5926
6115
  }
5927
6116
 
5928
- /**
5929
- * @license
5930
- * Copyright Google LLC All Rights Reserved.
5931
- *
5932
- * Use of this source code is governed by an MIT-style license that can be
5933
- * found in the LICENSE file at https://angular.io/license
5934
- */
5935
- /**
5936
- * Provides a strategy for setting the page title after a router navigation.
5937
- *
5938
- * The built-in implementation traverses the router state snapshot and finds the deepest primary
5939
- * outlet with `title` property. Given the `Routes` below, navigating to
5940
- * `/base/child(popup:aux)` would result in the document title being set to "child".
5941
- * ```
5942
- * [
5943
- * {path: 'base', title: 'base', children: [
5944
- * {path: 'child', title: 'child'},
5945
- * ],
5946
- * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
5947
- * ]
5948
- * ```
5949
- *
5950
- * This class can be used as a base class for custom title strategies. That is, you can create your
5951
- * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
5952
- * from the named outlet is never used. However, a custom strategy might be implemented to
5953
- * incorporate titles in named outlets.
5954
- *
5955
- * @publicApi
5956
- * @see [Page title guide](guide/router#setting-the-page-title)
5957
- */
5958
- class TitleStrategy {
5959
- /**
5960
- * @returns The `title` of the deepest primary route.
5961
- */
5962
- buildTitle(snapshot) {
5963
- var _a;
5964
- let pageTitle;
5965
- let route = snapshot.root;
5966
- while (route !== undefined) {
5967
- pageTitle = (_a = this.getResolvedTitleForRoute(route)) !== null && _a !== void 0 ? _a : pageTitle;
5968
- route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
5969
- }
5970
- return pageTitle;
5971
- }
5972
- /**
5973
- * Given an `ActivatedRouteSnapshot`, returns the final value of the
5974
- * `Route.title` property, which can either be a static string or a resolved value.
5975
- */
5976
- getResolvedTitleForRoute(snapshot) {
5977
- return snapshot.data[RouteTitle];
5978
- }
5979
- }
5980
- /**
5981
- * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
5982
- */
5983
- class DefaultTitleStrategy extends TitleStrategy {
5984
- constructor(title) {
5985
- super();
5986
- this.title = title;
5987
- }
5988
- /**
5989
- * Sets the title of the browser to the given value.
5990
- *
5991
- * @param title The `pageTitle` from the deepest primary route.
5992
- */
5993
- updateTitle(snapshot) {
5994
- const title = this.buildTitle(snapshot);
5995
- if (title !== undefined) {
5996
- this.title.setTitle(title);
5997
- }
5998
- }
5999
- }
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: [{
6003
- type: Injectable,
6004
- args: [{ providedIn: 'root' }]
6005
- }], ctorParameters: function () { return [{ type: i1.Title }]; } });
6006
-
6007
6117
  /**
6008
6118
  * @license
6009
6119
  * Copyright Google LLC All Rights Reserved.
@@ -6036,9 +6146,9 @@ class PreloadAllModules {
6036
6146
  return fn().pipe(catchError(() => of(null)));
6037
6147
  }
6038
6148
  }
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: [{
6149
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6150
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6151
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6042
6152
  type: Injectable,
6043
6153
  args: [{ providedIn: 'root' }]
6044
6154
  }] });
@@ -6056,9 +6166,9 @@ class NoPreloading {
6056
6166
  return of(null);
6057
6167
  }
6058
6168
  }
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: [{
6169
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6170
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6171
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: NoPreloading, decorators: [{
6062
6172
  type: Injectable,
6063
6173
  args: [{ providedIn: 'root' }]
6064
6174
  }] });
@@ -6106,7 +6216,15 @@ class RouterPreloader {
6106
6216
  }
6107
6217
  const injectorForCurrentRoute = (_a = route._injector) !== null && _a !== void 0 ? _a : injector;
6108
6218
  const injectorForChildren = (_b = route._loadedInjector) !== null && _b !== void 0 ? _b : injectorForCurrentRoute;
6109
- if ((route.loadChildren && !route._loadedRoutes) ||
6219
+ // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not
6220
+ // `loadComponent`. `canLoad` guards only block loading of child routes by design. This
6221
+ // happens as a consequence of needing to descend into children for route matching immediately
6222
+ // while component loading is deferred until route activation. Because `canLoad` guards can
6223
+ // have side effects, we cannot execute them here so we instead skip preloading altogether
6224
+ // when present. Lastly, it remains to be decided whether `canLoad` should behave this way
6225
+ // at all. Code splitting and lazy loading is separate from client-side authorization checks
6226
+ // and should not be used as a security measure to prevent loading of code.
6227
+ if ((route.loadChildren && !route._loadedRoutes && route.canLoad === undefined) ||
6110
6228
  (route.loadComponent && !route._loadedComponent)) {
6111
6229
  res.push(this.preloadConfig(injectorForCurrentRoute, route));
6112
6230
  }
@@ -6146,9 +6264,9 @@ class RouterPreloader {
6146
6264
  });
6147
6265
  }
6148
6266
  }
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: [{
6267
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6268
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterPreloader });
6269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterPreloader, decorators: [{
6152
6270
  type: Injectable
6153
6271
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6154
6272
 
@@ -6228,9 +6346,9 @@ class RouterScroller {
6228
6346
  }
6229
6347
  }
6230
6348
  }
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: [{
6349
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6350
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterScroller });
6351
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterScroller, decorators: [{
6234
6352
  type: Injectable
6235
6353
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6236
6354
 
@@ -6246,36 +6364,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6246
6364
  * The directives defined in the `RouterModule`.
6247
6365
  */
6248
6366
  const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent];
6249
- /**
6250
- * A [DI token](guide/glossary/#di-token) for the router service.
6251
- *
6252
- * @publicApi
6253
- */
6254
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6255
- providedIn: 'root',
6256
- factory: () => ({}),
6257
- });
6258
6367
  /**
6259
6368
  * @docsNotRequired
6260
6369
  */
6261
6370
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6262
6371
  const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6372
+ // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6373
+ // here to avoid a breaking change whereby the provider order matters based on where the
6374
+ // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
6375
+ // change in a major version.
6263
6376
  const ROUTER_PROVIDERS = [
6264
6377
  Location,
6265
6378
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
6266
- {
6267
- provide: Router,
6268
- useFactory: setupRouter,
6269
- deps: [
6270
- UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES,
6271
- ROUTER_CONFIGURATION, DefaultTitleStrategy, [TitleStrategy, new Optional()],
6272
- [UrlHandlingStrategy, new Optional()], [RouteReuseStrategy, new Optional()]
6273
- ]
6274
- },
6379
+ { provide: Router, useFactory: setupRouter },
6275
6380
  ChildrenOutletContexts,
6276
6381
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6277
6382
  RouterConfigLoader,
6278
6383
  ];
6384
+ function rootRoute(router) {
6385
+ return router.routerState.root;
6386
+ }
6279
6387
  function routerNgProbeToken() {
6280
6388
  return new NgProbeToken('Router', Router);
6281
6389
  }
@@ -6301,8 +6409,7 @@ function routerNgProbeToken() {
6301
6409
  * @publicApi
6302
6410
  */
6303
6411
  class RouterModule {
6304
- // Note: We are injecting the Router so it gets created eagerly...
6305
- constructor(guard, router) { }
6412
+ constructor(guard) { }
6306
6413
  /**
6307
6414
  * Creates and configures a module with all the router providers and directives.
6308
6415
  * Optionally sets up an application listener to perform an initial navigation.
@@ -6363,10 +6470,10 @@ class RouterModule {
6363
6470
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6364
6471
  }
6365
6472
  }
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: [{
6473
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6474
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.1", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6475
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterModule });
6476
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.1", ngImport: i0, type: RouterModule, decorators: [{
6370
6477
  type: NgModule,
6371
6478
  args: [{
6372
6479
  declarations: ROUTER_DIRECTIVES,
@@ -6378,8 +6485,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.4",
6378
6485
  }, {
6379
6486
  type: Inject,
6380
6487
  args: [ROUTER_FORROOT_GUARD]
6381
- }] }, { type: Router, decorators: [{
6382
- type: Optional
6383
6488
  }] }];
6384
6489
  } });
6385
6490
  function provideRouterScroller() {
@@ -6426,48 +6531,9 @@ function provideForRootGuard(router) {
6426
6531
  */
6427
6532
  function provideRoutes(routes) {
6428
6533
  return [
6429
- { provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
6430
6534
  { provide: ROUTES, multi: true, useValue: routes },
6431
6535
  ];
6432
6536
  }
6433
- function setupRouter(urlSerializer, contexts, location, injector, compiler, config, opts = {}, defaultTitleStrategy, titleStrategy, urlHandlingStrategy, routeReuseStrategy) {
6434
- const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
6435
- if (urlHandlingStrategy) {
6436
- router.urlHandlingStrategy = urlHandlingStrategy;
6437
- }
6438
- if (routeReuseStrategy) {
6439
- router.routeReuseStrategy = routeReuseStrategy;
6440
- }
6441
- router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
6442
- assignExtraOptionsToRouter(opts, router);
6443
- return router;
6444
- }
6445
- function assignExtraOptionsToRouter(opts, router) {
6446
- if (opts.errorHandler) {
6447
- router.errorHandler = opts.errorHandler;
6448
- }
6449
- if (opts.malformedUriErrorHandler) {
6450
- router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
6451
- }
6452
- if (opts.onSameUrlNavigation) {
6453
- router.onSameUrlNavigation = opts.onSameUrlNavigation;
6454
- }
6455
- if (opts.paramsInheritanceStrategy) {
6456
- router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
6457
- }
6458
- if (opts.relativeLinkResolution) {
6459
- router.relativeLinkResolution = opts.relativeLinkResolution;
6460
- }
6461
- if (opts.urlUpdateStrategy) {
6462
- router.urlUpdateStrategy = opts.urlUpdateStrategy;
6463
- }
6464
- if (opts.canceledNavigationResolution) {
6465
- router.canceledNavigationResolution = opts.canceledNavigationResolution;
6466
- }
6467
- }
6468
- function rootRoute(router) {
6469
- return router.routerState.root;
6470
- }
6471
6537
  function getBootstrapListener() {
6472
6538
  const injector = inject(Injector);
6473
6539
  return (bootstrappedComponentRef) => {
@@ -6478,8 +6544,7 @@ function getBootstrapListener() {
6478
6544
  }
6479
6545
  const router = injector.get(Router);
6480
6546
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6481
- // Default case
6482
- if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6547
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6483
6548
  router.initialNavigation();
6484
6549
  }
6485
6550
  (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
@@ -6523,7 +6588,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
6523
6588
  });
6524
6589
  function provideEnabledBlockingInitialNavigation() {
6525
6590
  return [
6526
- { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6591
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6527
6592
  {
6528
6593
  provide: APP_INITIALIZER,
6529
6594
  multi: true,
@@ -6589,7 +6654,7 @@ function provideEnabledBlockingInitialNavigation() {
6589
6654
  },
6590
6655
  ];
6591
6656
  }
6592
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '');
6657
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6593
6658
  function provideDisabledInitialNavigation() {
6594
6659
  return [
6595
6660
  {
@@ -6602,7 +6667,7 @@ function provideDisabledInitialNavigation() {
6602
6667
  };
6603
6668
  }
6604
6669
  },
6605
- { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6670
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6606
6671
  ];
6607
6672
  }
6608
6673
  function provideTracing() {
@@ -6646,7 +6711,7 @@ function providePreloading(preloadingStrategy) {
6646
6711
  /**
6647
6712
  * @publicApi
6648
6713
  */
6649
- const VERSION = new Version('14.1.0-next.4');
6714
+ const VERSION = new Version('14.1.1');
6650
6715
 
6651
6716
  /**
6652
6717
  * @license