@angular/router 15.0.0 → 15.1.0-next.0

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 (41) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/directives/router_link.mjs +3 -3
  3. package/esm2020/src/directives/router_link_active.mjs +3 -3
  4. package/esm2020/src/directives/router_outlet.mjs +5 -5
  5. package/esm2020/src/events.mjs +34 -1
  6. package/esm2020/src/index.mjs +2 -2
  7. package/esm2020/src/models.mjs +1 -1
  8. package/esm2020/src/navigation_transition.mjs +328 -0
  9. package/esm2020/src/operators/activate_routes.mjs +1 -1
  10. package/esm2020/src/operators/apply_redirects.mjs +1 -1
  11. package/esm2020/src/operators/check_guards.mjs +1 -1
  12. package/esm2020/src/operators/recognize.mjs +1 -1
  13. package/esm2020/src/operators/resolve_data.mjs +1 -1
  14. package/esm2020/src/page_title_strategy.mjs +6 -6
  15. package/esm2020/src/private_export.mjs +1 -1
  16. package/esm2020/src/provide_router.mjs +6 -13
  17. package/esm2020/src/route_reuse_strategy.mjs +15 -1
  18. package/esm2020/src/router.mjs +100 -347
  19. package/esm2020/src/router_config_loader.mjs +3 -3
  20. package/esm2020/src/router_module.mjs +4 -4
  21. package/esm2020/src/router_outlet_context.mjs +3 -3
  22. package/esm2020/src/router_preloader.mjs +9 -9
  23. package/esm2020/src/router_scroller.mjs +3 -3
  24. package/esm2020/src/url_handling_strategy.mjs +15 -1
  25. package/esm2020/src/url_tree.mjs +3 -3
  26. package/esm2020/src/version.mjs +1 -1
  27. package/esm2020/testing/src/router_testing_module.mjs +8 -54
  28. package/fesm2015/router.mjs +524 -403
  29. package/fesm2015/router.mjs.map +1 -1
  30. package/fesm2015/testing.mjs +9 -55
  31. package/fesm2015/testing.mjs.map +1 -1
  32. package/fesm2015/upgrade.mjs +1 -1
  33. package/fesm2020/router.mjs +538 -412
  34. package/fesm2020/router.mjs.map +1 -1
  35. package/fesm2020/testing.mjs +9 -55
  36. package/fesm2020/testing.mjs.map +1 -1
  37. package/fesm2020/upgrade.mjs +1 -1
  38. package/index.d.ts +113 -62
  39. package/package.json +4 -4
  40. package/testing/index.d.ts +2 -7
  41. package/upgrade/index.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0
2
+ * @license Angular v15.1.0-next.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -202,7 +202,7 @@ function wrapIntoObservable(value) {
202
202
  * Use of this source code is governed by an MIT-style license that can be
203
203
  * found in the LICENSE file at https://angular.io/license
204
204
  */
205
- const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
205
+ const NG_DEV_MODE$a = typeof ngDevMode === 'undefined' || ngDevMode;
206
206
  const pathCompareMap = {
207
207
  'exact': equalSegmentGroups,
208
208
  'subset': containsSegmentGroup,
@@ -327,7 +327,7 @@ class UrlTree {
327
327
  this.root = root;
328
328
  this.queryParams = queryParams;
329
329
  this.fragment = fragment;
330
- if (NG_DEV_MODE$9) {
330
+ if (NG_DEV_MODE$a) {
331
331
  if (root.segments.length > 0) {
332
332
  throw new ɵRuntimeError(4015 /* RuntimeErrorCode.INVALID_ROOT_URL_SEGMENT */, 'The root `UrlSegmentGroup` should not contain `segments`. ' +
333
333
  'Instead, these segments belong in the `children` so they can be associated with a named outlet.');
@@ -461,9 +461,9 @@ function mapChildrenIntoArray(segment, fn) {
461
461
  */
462
462
  class UrlSerializer {
463
463
  }
464
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: UrlSerializer, decorators: [{
464
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlSerializer, decorators: [{
467
467
  type: Injectable,
468
468
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
469
469
  }] });
@@ -675,7 +675,7 @@ class UrlParser {
675
675
  parseSegment() {
676
676
  const path = matchSegments(this.remaining);
677
677
  if (path === '' && this.peekStartsWith(';')) {
678
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$9 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
678
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$a && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
679
679
  }
680
680
  this.capture(path);
681
681
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -744,7 +744,7 @@ class UrlParser {
744
744
  // if is is not one of these characters, then the segment was unescaped
745
745
  // or the group was not closed
746
746
  if (next !== '/' && next !== ')' && next !== ';') {
747
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$9 && `Cannot parse url '${this.url}'`);
747
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$a && `Cannot parse url '${this.url}'`);
748
748
  }
749
749
  let outletName = undefined;
750
750
  if (path.indexOf(':') > -1) {
@@ -775,7 +775,7 @@ class UrlParser {
775
775
  }
776
776
  capture(str) {
777
777
  if (!this.consumeOptional(str)) {
778
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$9 && `Expected "${str}".`);
778
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$a && `Expected "${str}".`);
779
779
  }
780
780
  }
781
781
  }
@@ -828,7 +828,7 @@ function isUrlTree(v) {
828
828
  * Use of this source code is governed by an MIT-style license that can be
829
829
  * found in the LICENSE file at https://angular.io/license
830
830
  */
831
- const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
831
+ const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
832
832
  /**
833
833
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
834
834
  *
@@ -999,11 +999,11 @@ class Navigation {
999
999
  this.numberOfDoubleDots = numberOfDoubleDots;
1000
1000
  this.commands = commands;
1001
1001
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
1002
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
1002
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$9 && 'Root segment cannot have matrix parameters');
1003
1003
  }
1004
1004
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
1005
1005
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
1006
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
1006
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$9 && '{outlets:{}} has to be the last command');
1007
1007
  }
1008
1008
  }
1009
1009
  toRoot() {
@@ -1102,7 +1102,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1102
1102
  dd -= ci;
1103
1103
  g = g.parent;
1104
1104
  if (!g) {
1105
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
1105
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$9 && 'Invalid number of \'../\'');
1106
1106
  }
1107
1107
  ci = g.segments.length;
1108
1108
  }
@@ -1378,6 +1378,37 @@ class NavigationCancel extends RouterEvent {
1378
1378
  return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;
1379
1379
  }
1380
1380
  }
1381
+ /**
1382
+ * An event triggered when a navigation is skipped.
1383
+ * This can happen for a couple reasons including onSameUrlHandling
1384
+ * is set to `ignore` and the navigation URL is not different than the
1385
+ * current state.
1386
+ *
1387
+ * @publicApi
1388
+ */
1389
+ class NavigationSkipped extends RouterEvent {
1390
+ constructor(
1391
+ /** @docsNotRequired */
1392
+ id,
1393
+ /** @docsNotRequired */
1394
+ url,
1395
+ /**
1396
+ * A description of why the navigation was skipped. For debug purposes only. Use `code`
1397
+ * instead for a stable skipped reason that can be used in production.
1398
+ */
1399
+ reason,
1400
+ /**
1401
+ * A code to indicate why the navigation was skipped. This code is stable for
1402
+ * the reason and can be relied on whereas the `reason` string could change and should not be
1403
+ * used in production.
1404
+ */
1405
+ code) {
1406
+ super(id, url);
1407
+ this.reason = reason;
1408
+ this.code = code;
1409
+ this.type = 16 /* EventType.NavigationSkipped */;
1410
+ }
1411
+ }
1381
1412
  /**
1382
1413
  * An event triggered when a navigation fails due to an unexpected error.
1383
1414
  *
@@ -1704,6 +1735,8 @@ function stringifyEvent(routerEvent) {
1704
1735
  return `GuardsCheckStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;
1705
1736
  case 2 /* EventType.NavigationCancel */:
1706
1737
  return `NavigationCancel(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
1738
+ case 16 /* EventType.NavigationSkipped */:
1739
+ return `NavigationSkipped(id: ${routerEvent.id}, url: '${routerEvent.url}')`;
1707
1740
  case 1 /* EventType.NavigationEnd */:
1708
1741
  return `NavigationEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}')`;
1709
1742
  case 3 /* EventType.NavigationError */:
@@ -2386,9 +2419,9 @@ class ChildrenOutletContexts {
2386
2419
  return this.contexts.get(childName) || null;
2387
2420
  }
2388
2421
  }
2389
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2390
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2391
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2422
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2423
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2424
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2392
2425
  type: Injectable,
2393
2426
  args: [{ providedIn: 'root' }]
2394
2427
  }] });
@@ -2400,7 +2433,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
2400
2433
  * Use of this source code is governed by an MIT-style license that can be
2401
2434
  * found in the LICENSE file at https://angular.io/license
2402
2435
  */
2403
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
2436
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
2404
2437
  /**
2405
2438
  * @description
2406
2439
  *
@@ -2540,12 +2573,12 @@ class RouterOutlet {
2540
2573
  */
2541
2574
  get component() {
2542
2575
  if (!this.activated)
2543
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2576
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2544
2577
  return this.activated.instance;
2545
2578
  }
2546
2579
  get activatedRoute() {
2547
2580
  if (!this.activated)
2548
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2581
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2549
2582
  return this._activatedRoute;
2550
2583
  }
2551
2584
  get activatedRouteData() {
@@ -2559,7 +2592,7 @@ class RouterOutlet {
2559
2592
  */
2560
2593
  detach() {
2561
2594
  if (!this.activated)
2562
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2595
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$8 && 'Outlet is not activated');
2563
2596
  this.location.detach();
2564
2597
  const cmp = this.activated;
2565
2598
  this.activated = null;
@@ -2587,11 +2620,11 @@ class RouterOutlet {
2587
2620
  }
2588
2621
  activateWith(activatedRoute, resolverOrInjector) {
2589
2622
  if (this.isActivated) {
2590
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
2623
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$8 && 'Cannot activate an already activated outlet');
2591
2624
  }
2592
2625
  this._activatedRoute = activatedRoute;
2593
2626
  const location = this.location;
2594
- const snapshot = activatedRoute._futureSnapshot;
2627
+ const snapshot = activatedRoute.snapshot;
2595
2628
  const component = snapshot.component;
2596
2629
  const childContexts = this.parentContexts.getOrCreateContext(this.name).children;
2597
2630
  const injector = new OutletInjector(activatedRoute, childContexts, location.injector);
@@ -2609,9 +2642,9 @@ class RouterOutlet {
2609
2642
  this.activateEvents.emit(this.activated.instance);
2610
2643
  }
2611
2644
  }
2612
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2613
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2614
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterOutlet, decorators: [{
2645
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2646
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2647
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterOutlet, decorators: [{
2615
2648
  type: Directive,
2616
2649
  args: [{
2617
2650
  selector: 'router-outlet',
@@ -2671,9 +2704,9 @@ function isComponentFactoryResolver(item) {
2671
2704
  */
2672
2705
  class ɵEmptyOutletComponent {
2673
2706
  }
2674
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2675
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.0", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2676
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2707
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2708
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.0-next.0", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2709
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2677
2710
  type: Component,
2678
2711
  args: [{
2679
2712
  template: `<router-outlet></router-outlet>`,
@@ -3591,7 +3624,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3591
3624
  * Use of this source code is governed by an MIT-style license that can be
3592
3625
  * found in the LICENSE file at https://angular.io/license
3593
3626
  */
3594
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
3627
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
3595
3628
  class NoMatch$1 {
3596
3629
  constructor(segmentGroup) {
3597
3630
  this.segmentGroup = segmentGroup || null;
@@ -3609,11 +3642,11 @@ function absoluteRedirect(newTree) {
3609
3642
  return throwError(new AbsoluteRedirect(newTree));
3610
3643
  }
3611
3644
  function namedOutletsRedirect(redirectTo) {
3612
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
3645
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$7 &&
3613
3646
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3614
3647
  }
3615
3648
  function canLoadFails(route) {
3616
- return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
3649
+ return throwError(navigationCancelingError(NG_DEV_MODE$7 &&
3617
3650
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3618
3651
  }
3619
3652
  /**
@@ -3673,7 +3706,7 @@ class ApplyRedirects {
3673
3706
  }));
3674
3707
  }
3675
3708
  noMatchError(e) {
3676
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3709
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$7 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3677
3710
  }
3678
3711
  createUrlTree(rootCandidate, queryParams, fragment) {
3679
3712
  const root = createRoot(rootCandidate);
@@ -3890,7 +3923,7 @@ class ApplyRedirects {
3890
3923
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3891
3924
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3892
3925
  if (!pos)
3893
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
3926
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$7 &&
3894
3927
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3895
3928
  return pos;
3896
3929
  }
@@ -3926,7 +3959,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3926
3959
  * Use of this source code is governed by an MIT-style license that can be
3927
3960
  * found in the LICENSE file at https://angular.io/license
3928
3961
  */
3929
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3962
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3930
3963
  class NoMatch {
3931
3964
  }
3932
3965
  function newObservableError(e) {
@@ -4014,7 +4047,7 @@ class Recognizer {
4014
4047
  // multiple activated results for the same outlet. We should merge the children of
4015
4048
  // these results so the final return value is only one `TreeNode` per outlet.
4016
4049
  const mergedChildren = mergeEmptyPathMatches(children);
4017
- if (NG_DEV_MODE$5) {
4050
+ if (NG_DEV_MODE$6) {
4018
4051
  // This should really never happen - we are only taking the first match for each
4019
4052
  // outlet and merge the empty path matches.
4020
4053
  checkOutletNameUniqueness(mergedChildren);
@@ -4173,7 +4206,7 @@ function checkOutletNameUniqueness(nodes) {
4173
4206
  if (routeWithSameOutletName) {
4174
4207
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4175
4208
  const c = n.value.url.map(s => s.toString()).join('/');
4176
- throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$5 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4209
+ throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, NG_DEV_MODE$6 && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);
4177
4210
  }
4178
4211
  names[n.value.outlet] = n.value;
4179
4212
  });
@@ -4307,6 +4340,309 @@ function switchTap(next) {
4307
4340
  });
4308
4341
  }
4309
4342
 
4343
+ /**
4344
+ * @license
4345
+ * Copyright Google LLC All Rights Reserved.
4346
+ *
4347
+ * Use of this source code is governed by an MIT-style license that can be
4348
+ * found in the LICENSE file at https://angular.io/license
4349
+ */
4350
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4351
+ class NavigationTransitions {
4352
+ constructor(router) {
4353
+ this.router = router;
4354
+ this.currentNavigation = null;
4355
+ }
4356
+ setupNavigations(transitions) {
4357
+ const eventsSubject = this.router.events;
4358
+ return transitions.pipe(filter(t => t.id !== 0),
4359
+ // Extract URL
4360
+ map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.router.urlHandlingStrategy.extract(t.rawUrl) }))),
4361
+ // Using switchMap so we cancel executing navigations when a new one comes in
4362
+ switchMap(overallTransitionState => {
4363
+ let completed = false;
4364
+ let errored = false;
4365
+ return of(overallTransitionState)
4366
+ .pipe(
4367
+ // Store the Navigation object
4368
+ tap(t => {
4369
+ this.currentNavigation = {
4370
+ id: t.id,
4371
+ initialUrl: t.rawUrl,
4372
+ extractedUrl: t.extractedUrl,
4373
+ trigger: t.source,
4374
+ extras: t.extras,
4375
+ previousNavigation: !this.router.lastSuccessfulNavigation ? null : Object.assign(Object.assign({}, this.router.lastSuccessfulNavigation), { previousNavigation: null }),
4376
+ };
4377
+ }), switchMap(t => {
4378
+ const browserUrlTree = this.router.browserUrlTree.toString();
4379
+ const urlTransition = !this.router.navigated ||
4380
+ t.extractedUrl.toString() !== browserUrlTree ||
4381
+ // Navigations which succeed or ones which fail and are cleaned up
4382
+ // correctly should result in `browserUrlTree` and `currentUrlTree`
4383
+ // matching. If this is not the case, assume something went wrong and
4384
+ // try processing the URL again.
4385
+ browserUrlTree !== this.router.currentUrlTree.toString();
4386
+ if (!urlTransition && this.router.onSameUrlNavigation !== 'reload') {
4387
+ const reason = NG_DEV_MODE$5 ?
4388
+ `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` :
4389
+ '';
4390
+ this.router.triggerEvent(new NavigationSkipped(t.id, this.router.serializeUrl(overallTransitionState.rawUrl), reason, 0 /* NavigationSkippedCode.IgnoredSameUrlNavigation */));
4391
+ this.router.rawUrlTree = t.rawUrl;
4392
+ t.resolve(null);
4393
+ return EMPTY;
4394
+ }
4395
+ if (this.router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {
4396
+ // If the source of the navigation is from a browser event, the URL is
4397
+ // already updated. We already need to sync the internal state.
4398
+ if (isBrowserTriggeredNavigation(t.source)) {
4399
+ this.router.browserUrlTree = t.extractedUrl;
4400
+ }
4401
+ return of(t).pipe(
4402
+ // Fire NavigationStart event
4403
+ switchMap(t => {
4404
+ const transition = this.router.transitions.getValue();
4405
+ eventsSubject.next(new NavigationStart(t.id, this.router.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4406
+ if (transition !== this.router.transitions.getValue()) {
4407
+ return EMPTY;
4408
+ }
4409
+ // This delay is required to match old behavior that forced
4410
+ // navigation to always be async
4411
+ return Promise.resolve(t);
4412
+ }),
4413
+ // ApplyRedirects
4414
+ applyRedirects(this.router.ngModule.injector, this.router.configLoader, this.router.urlSerializer, this.router.config),
4415
+ // Update the currentNavigation
4416
+ // `urlAfterRedirects` is guaranteed to be set after this point
4417
+ tap(t => {
4418
+ this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
4419
+ overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4420
+ }),
4421
+ // Recognize
4422
+ recognize(this.router.ngModule.injector, this.router.rootComponentType, this.router.config, this.router.urlSerializer, this.router.paramsInheritanceStrategy),
4423
+ // Update URL if in `eager` update mode
4424
+ tap(t => {
4425
+ overallTransitionState.targetSnapshot = t.targetSnapshot;
4426
+ if (this.router.urlUpdateStrategy === 'eager') {
4427
+ if (!t.extras.skipLocationChange) {
4428
+ const rawUrl = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4429
+ this.router.setBrowserUrl(rawUrl, t);
4430
+ }
4431
+ this.router.browserUrlTree = t.urlAfterRedirects;
4432
+ }
4433
+ // Fire RoutesRecognized
4434
+ const routesRecognized = new RoutesRecognized(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4435
+ eventsSubject.next(routesRecognized);
4436
+ }));
4437
+ }
4438
+ else if (urlTransition &&
4439
+ this.router.urlHandlingStrategy.shouldProcessUrl(this.router.rawUrlTree)) {
4440
+ // When the current URL shouldn't be processed, but the previous one
4441
+ // was, we handle this by navigating from the current URL to an empty
4442
+ // state so deactivate guards can run.
4443
+ const { id, extractedUrl, source, restoredState, extras } = t;
4444
+ const navStart = new NavigationStart(id, this.router.serializeUrl(extractedUrl), source, restoredState);
4445
+ eventsSubject.next(navStart);
4446
+ const targetSnapshot = createEmptyState(extractedUrl, this.router.rootComponentType)
4447
+ .snapshot;
4448
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
4449
+ return of(overallTransitionState);
4450
+ }
4451
+ else {
4452
+ /* When neither the current or previous URL can be processed, do
4453
+ * nothing other than update router's internal reference to the
4454
+ * current "settled" URL. This way the next navigation will be coming
4455
+ * from the current URL in the browser.
4456
+ */
4457
+ const reason = NG_DEV_MODE$5 ?
4458
+ `Navigation was ignored because the UrlHandlingStrategy` +
4459
+ ` indicated neither the current URL ${this.router.rawUrlTree} nor target URL ${t.rawUrl} should be processed.` :
4460
+ '';
4461
+ this.router.triggerEvent(new NavigationSkipped(t.id, this.router.serializeUrl(overallTransitionState.extractedUrl), reason, 1 /* NavigationSkippedCode.IgnoredByUrlHandlingStrategy */));
4462
+ this.router.rawUrlTree = t.rawUrl;
4463
+ t.resolve(null);
4464
+ return EMPTY;
4465
+ }
4466
+ }),
4467
+ // --- GUARDS ---
4468
+ tap(t => {
4469
+ const guardsStart = new GuardsCheckStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4470
+ this.router.triggerEvent(guardsStart);
4471
+ }), map(t => {
4472
+ overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.router.rootContexts) });
4473
+ return overallTransitionState;
4474
+ }), checkGuards(this.router.ngModule.injector, (evt) => this.router.triggerEvent(evt)), tap(t => {
4475
+ overallTransitionState.guardsResult = t.guardsResult;
4476
+ if (isUrlTree(t.guardsResult)) {
4477
+ throw redirectingNavigationError(this.router.urlSerializer, t.guardsResult);
4478
+ }
4479
+ const guardsEnd = new GuardsCheckEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4480
+ this.router.triggerEvent(guardsEnd);
4481
+ }), filter(t => {
4482
+ if (!t.guardsResult) {
4483
+ this.router.restoreHistory(t);
4484
+ this.router.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4485
+ return false;
4486
+ }
4487
+ return true;
4488
+ }),
4489
+ // --- RESOLVE ---
4490
+ switchTap(t => {
4491
+ if (t.guards.canActivateChecks.length) {
4492
+ return of(t).pipe(tap(t => {
4493
+ const resolveStart = new ResolveStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4494
+ this.router.triggerEvent(resolveStart);
4495
+ }), switchMap(t => {
4496
+ let dataResolved = false;
4497
+ return of(t).pipe(resolveData(this.router.paramsInheritanceStrategy, this.router.ngModule.injector), tap({
4498
+ next: () => dataResolved = true,
4499
+ complete: () => {
4500
+ if (!dataResolved) {
4501
+ this.router.restoreHistory(t);
4502
+ this.router.cancelNavigationTransition(t, NG_DEV_MODE$5 ?
4503
+ `At least one route resolver didn't emit any value.` :
4504
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4505
+ }
4506
+ }
4507
+ }));
4508
+ }), tap(t => {
4509
+ const resolveEnd = new ResolveEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4510
+ this.router.triggerEvent(resolveEnd);
4511
+ }));
4512
+ }
4513
+ return undefined;
4514
+ }),
4515
+ // --- LOAD COMPONENTS ---
4516
+ switchTap((t) => {
4517
+ const loadComponents = (route) => {
4518
+ var _a;
4519
+ const loaders = [];
4520
+ if (((_a = route.routeConfig) === null || _a === void 0 ? void 0 : _a.loadComponent) &&
4521
+ !route.routeConfig._loadedComponent) {
4522
+ loaders.push(this.router.configLoader.loadComponent(route.routeConfig)
4523
+ .pipe(tap(loadedComponent => {
4524
+ route.component = loadedComponent;
4525
+ }), map(() => void 0)));
4526
+ }
4527
+ for (const child of route.children) {
4528
+ loaders.push(...loadComponents(child));
4529
+ }
4530
+ return loaders;
4531
+ };
4532
+ return combineLatest(loadComponents(t.targetSnapshot.root))
4533
+ .pipe(defaultIfEmpty(), take(1));
4534
+ }), switchTap(() => this.router.afterPreactivation()), map((t) => {
4535
+ const targetRouterState = createRouterState(this.router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4536
+ overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
4537
+ return (overallTransitionState);
4538
+ }),
4539
+ /* Once here, we are about to activate synchronously. The assumption is
4540
+ this will succeed, and user code may read from the Router service.
4541
+ Therefore before activation, we need to update router properties storing
4542
+ the current URL and the RouterState, as well as updated the browser URL.
4543
+ All this should happen *before* activating. */
4544
+ tap((t) => {
4545
+ this.router.currentUrlTree = t.urlAfterRedirects;
4546
+ this.router.rawUrlTree = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4547
+ this.router.routerState =
4548
+ t.targetRouterState;
4549
+ if (this.router.urlUpdateStrategy === 'deferred') {
4550
+ if (!t.extras.skipLocationChange) {
4551
+ this.router.setBrowserUrl(this.router.rawUrlTree, t);
4552
+ }
4553
+ this.router.browserUrlTree = t.urlAfterRedirects;
4554
+ }
4555
+ }), activateRoutes(this.router.rootContexts, this.router.routeReuseStrategy, (evt) => this.router.triggerEvent(evt)), tap({
4556
+ next() {
4557
+ completed = true;
4558
+ },
4559
+ complete() {
4560
+ completed = true;
4561
+ }
4562
+ }), finalize(() => {
4563
+ var _a;
4564
+ /* When the navigation stream finishes either through error or success,
4565
+ * we set the `completed` or `errored` flag. However, there are some
4566
+ * situations where we could get here without either of those being set.
4567
+ * For instance, a redirect during NavigationStart. Therefore, this is a
4568
+ * catch-all to make sure the NavigationCancel event is fired when a
4569
+ * navigation gets cancelled but not caught by other means. */
4570
+ if (!completed && !errored) {
4571
+ const cancelationReason = NG_DEV_MODE$5 ?
4572
+ `Navigation ID ${overallTransitionState
4573
+ .id} is not equal to the current navigation id ${this.router.navigationId}` :
4574
+ '';
4575
+ this.router.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4576
+ }
4577
+ // Only clear current navigation if it is still set to the one that
4578
+ // finalized.
4579
+ if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === overallTransitionState.id) {
4580
+ this.currentNavigation = null;
4581
+ }
4582
+ }), catchError((e) => {
4583
+ var _a;
4584
+ errored = true;
4585
+ /* This error type is issued during Redirect, and is handled as a
4586
+ * cancellation rather than an error. */
4587
+ if (isNavigationCancelingError$1(e)) {
4588
+ if (!isRedirectingNavigationCancelingError$1(e)) {
4589
+ // Set property only if we're not redirecting. If we landed on a page
4590
+ // and redirect to `/` route, the new navigation is going to see the
4591
+ // `/` isn't a change from the default currentUrlTree and won't
4592
+ // navigate. This is only applicable with initial navigation, so
4593
+ // setting `navigated` only when not redirecting resolves this
4594
+ // scenario.
4595
+ this.router.navigated = true;
4596
+ this.router.restoreHistory(overallTransitionState, true);
4597
+ }
4598
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4599
+ eventsSubject.next(navCancel);
4600
+ // When redirecting, we need to delay resolving the navigation
4601
+ // promise and push it to the redirect navigation
4602
+ if (!isRedirectingNavigationCancelingError$1(e)) {
4603
+ overallTransitionState.resolve(false);
4604
+ }
4605
+ else {
4606
+ const mergedTree = this.router.urlHandlingStrategy.merge(e.url, this.router.rawUrlTree);
4607
+ const extras = {
4608
+ skipLocationChange: overallTransitionState.extras.skipLocationChange,
4609
+ // The URL is already updated at this point if we have 'eager' URL
4610
+ // updates or if the navigation was triggered by the browser (back
4611
+ // button, URL bar, etc). We want to replace that item in history
4612
+ // if the navigation is rejected.
4613
+ replaceUrl: this.router.urlUpdateStrategy === 'eager' ||
4614
+ isBrowserTriggeredNavigation(overallTransitionState.source)
4615
+ };
4616
+ this.router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4617
+ resolve: overallTransitionState.resolve,
4618
+ reject: overallTransitionState.reject,
4619
+ promise: overallTransitionState.promise
4620
+ });
4621
+ }
4622
+ /* All other errors should reset to the router's internal URL reference
4623
+ * to the pre-error state. */
4624
+ }
4625
+ else {
4626
+ this.router.restoreHistory(overallTransitionState, true);
4627
+ const navError = new NavigationError(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4628
+ eventsSubject.next(navError);
4629
+ try {
4630
+ overallTransitionState.resolve(this.router.errorHandler(e));
4631
+ }
4632
+ catch (ee) {
4633
+ overallTransitionState.reject(ee);
4634
+ }
4635
+ }
4636
+ return EMPTY;
4637
+ }));
4638
+ // TODO(jasonaden): remove cast once g3 is on updated TypeScript
4639
+ }));
4640
+ }
4641
+ }
4642
+ function isBrowserTriggeredNavigation(source) {
4643
+ return source !== 'imperative';
4644
+ }
4645
+
4310
4646
  /**
4311
4647
  * @license
4312
4648
  * Copyright Google LLC All Rights Reserved.
@@ -4359,9 +4695,9 @@ class TitleStrategy {
4359
4695
  return snapshot.data[RouteTitleKey];
4360
4696
  }
4361
4697
  }
4362
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4363
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4364
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: TitleStrategy, decorators: [{
4698
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4699
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4700
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: TitleStrategy, decorators: [{
4365
4701
  type: Injectable,
4366
4702
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4367
4703
  }] });
@@ -4385,9 +4721,9 @@ class DefaultTitleStrategy extends TitleStrategy {
4385
4721
  }
4386
4722
  }
4387
4723
  }
4388
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4389
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4390
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4724
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4725
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4726
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4391
4727
  type: Injectable,
4392
4728
  args: [{ providedIn: 'root' }]
4393
4729
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -4408,6 +4744,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImpor
4408
4744
  */
4409
4745
  class RouteReuseStrategy {
4410
4746
  }
4747
+ RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4748
+ RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4749
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4750
+ type: Injectable,
4751
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4752
+ }] });
4411
4753
  /**
4412
4754
  * @description
4413
4755
  *
@@ -4456,6 +4798,12 @@ class BaseRouteReuseStrategy {
4456
4798
  }
4457
4799
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4458
4800
  }
4801
+ DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4802
+ DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4804
+ type: Injectable,
4805
+ args: [{ providedIn: 'root' }]
4806
+ }] });
4459
4807
 
4460
4808
  /**
4461
4809
  * @license
@@ -4598,9 +4946,9 @@ class RouterConfigLoader {
4598
4946
  }));
4599
4947
  }
4600
4948
  }
4601
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4602
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4603
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4949
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4950
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4951
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4604
4952
  type: Injectable,
4605
4953
  args: [{ providedIn: 'root' }]
4606
4954
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
@@ -4632,6 +4980,12 @@ function maybeUnwrapDefaultExport(input) {
4632
4980
  */
4633
4981
  class UrlHandlingStrategy {
4634
4982
  }
4983
+ UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4984
+ UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4985
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4986
+ type: Injectable,
4987
+ args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4988
+ }] });
4635
4989
  /**
4636
4990
  * @publicApi
4637
4991
  */
@@ -4646,6 +5000,12 @@ class DefaultUrlHandlingStrategy {
4646
5000
  return newUrlPart;
4647
5001
  }
4648
5002
  }
5003
+ DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5004
+ DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
5005
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
5006
+ type: Injectable,
5007
+ args: [{ providedIn: 'root' }]
5008
+ }] });
4649
5009
 
4650
5010
  /**
4651
5011
  * @license
@@ -4710,18 +5070,7 @@ function setupRouter() {
4710
5070
  const compiler = inject(Compiler);
4711
5071
  const config = (_a = inject(ROUTES, { optional: true })) !== null && _a !== void 0 ? _a : [];
4712
5072
  const opts = (_b = inject(ROUTER_CONFIGURATION, { optional: true })) !== null && _b !== void 0 ? _b : {};
4713
- const defaultTitleStrategy = inject(DefaultTitleStrategy);
4714
- const titleStrategy = inject(TitleStrategy, { optional: true });
4715
- const urlHandlingStrategy = inject(UrlHandlingStrategy, { optional: true });
4716
- const routeReuseStrategy = inject(RouteReuseStrategy, { optional: true });
4717
5073
  const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
4718
- if (urlHandlingStrategy) {
4719
- router.urlHandlingStrategy = urlHandlingStrategy;
4720
- }
4721
- if (routeReuseStrategy) {
4722
- router.routeReuseStrategy = routeReuseStrategy;
4723
- }
4724
- router.titleStrategy = titleStrategy !== null && titleStrategy !== void 0 ? titleStrategy : defaultTitleStrategy;
4725
5074
  assignExtraOptionsToRouter(opts, router);
4726
5075
  return router;
4727
5076
  }
@@ -4742,15 +5091,24 @@ class Router {
4742
5091
  * Creates the router service.
4743
5092
  */
4744
5093
  // TODO: vsavkin make internal after the final is out.
4745
- constructor(rootComponentType, urlSerializer, rootContexts, location, injector, compiler, config) {
5094
+ constructor(
5095
+ /** @internal */
5096
+ rootComponentType,
5097
+ /** @internal */
5098
+ urlSerializer,
5099
+ /** @internal */
5100
+ rootContexts,
5101
+ /** @internal */
5102
+ location, injector, compiler, config) {
4746
5103
  this.rootComponentType = rootComponentType;
4747
5104
  this.urlSerializer = urlSerializer;
4748
5105
  this.rootContexts = rootContexts;
4749
5106
  this.location = location;
4750
5107
  this.config = config;
5108
+ /** @internal */
4751
5109
  this.lastSuccessfulNavigation = null;
4752
- this.currentNavigation = null;
4753
5110
  this.disposed = false;
5111
+ /** @internal */
4754
5112
  this.navigationId = 0;
4755
5113
  /**
4756
5114
  * The id of the currently active page in the router.
@@ -4768,6 +5126,8 @@ class Router {
4768
5126
  this.events = new Subject();
4769
5127
  /**
4770
5128
  * A handler for navigation errors in this NgModule.
5129
+ *
5130
+ * @deprecated Subscribe to the `Router` events and watch for `NavigationError` instead.
4771
5131
  */
4772
5132
  this.errorHandler = defaultErrorHandler;
4773
5133
  /**
@@ -4775,6 +5135,10 @@ class Router {
4775
5135
  * when `url` contains an invalid character.
4776
5136
  * The most common case is a `%` sign
4777
5137
  * that's not encoded and is not part of a percent encoded sequence.
5138
+ *
5139
+ * @deprecated Configure this through `RouterModule.forRoot` instead:
5140
+ * `RouterModule.forRoot(routes, {malformedUriErrorHandler: myHandler})`
5141
+ * @see `RouterModule`
4778
5142
  */
4779
5143
  this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
4780
5144
  /**
@@ -4793,12 +5157,25 @@ class Router {
4793
5157
  /**
4794
5158
  * A strategy for extracting and merging URLs.
4795
5159
  * Used for AngularJS to Angular migrations.
5160
+ *
5161
+ * @deprecated Configure using `providers` instead:
5162
+ * `{provide: UrlHandlingStrategy, useClass: MyStrategy}`.
4796
5163
  */
4797
- this.urlHandlingStrategy = new DefaultUrlHandlingStrategy();
5164
+ this.urlHandlingStrategy = inject(UrlHandlingStrategy);
4798
5165
  /**
4799
5166
  * A strategy for re-using routes.
5167
+ *
5168
+ * @deprecated Configure using `providers` instead:
5169
+ * `{provide: RouteReuseStrategy, useClass: MyStrategy}`.
5170
+ */
5171
+ this.routeReuseStrategy = inject(RouteReuseStrategy);
5172
+ /**
5173
+ * A strategy for setting the title based on the `routerState`.
5174
+ *
5175
+ * @deprecated Configure using `providers` instead:
5176
+ * `{provide: TitleStrategy, useClass: MyStrategy}`.
4800
5177
  */
4801
- this.routeReuseStrategy = new DefaultRouteReuseStrategy();
5178
+ this.titleStrategy = inject(TitleStrategy);
4802
5179
  /**
4803
5180
  * How to handle a navigation request to the current URL. One of:
4804
5181
  *
@@ -4811,6 +5188,11 @@ class Router {
4811
5188
  * component first. This behavior is configured by the `RouteReuseStrategy`. In order to reload
4812
5189
  * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
4813
5190
  * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
5191
+ *
5192
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5193
+ * @see `withRouterConfig`
5194
+ * @see `provideRouter`
5195
+ * @see `RouterModule`
4814
5196
  */
4815
5197
  this.onSameUrlNavigation = 'ignore';
4816
5198
  /**
@@ -4821,6 +5203,11 @@ class Router {
4821
5203
  * for path-less or component-less routes.
4822
5204
  * - `'always'` : Inherit parent parameters, data, and resolved data
4823
5205
  * for all child routes.
5206
+ *
5207
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5208
+ * @see `withRouterConfig`
5209
+ * @see `provideRouter`
5210
+ * @see `RouterModule`
4824
5211
  */
4825
5212
  this.paramsInheritanceStrategy = 'emptyOnly';
4826
5213
  /**
@@ -4829,6 +5216,11 @@ class Router {
4829
5216
  * Set to `'eager'` to update the browser URL at the beginning of navigation.
4830
5217
  * You can choose to update early so that, if navigation fails,
4831
5218
  * you can show an error message with the URL that failed.
5219
+ *
5220
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5221
+ * @see `withRouterConfig`
5222
+ * @see `provideRouter`
5223
+ * @see `RouterModule`
4832
5224
  */
4833
5225
  this.urlUpdateStrategy = 'deferred';
4834
5226
  /**
@@ -4852,8 +5244,13 @@ class Router {
4852
5244
  *
4853
5245
  * The default value is `replace`.
4854
5246
  *
5247
+ * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.
5248
+ * @see `withRouterConfig`
5249
+ * @see `provideRouter`
5250
+ * @see `RouterModule`
4855
5251
  */
4856
5252
  this.canceledNavigationResolution = 'replace';
5253
+ this.navigationTransitions = new NavigationTransitions(this);
4857
5254
  const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r));
4858
5255
  const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r));
4859
5256
  this.configLoader = injector.get(RouterConfigLoader);
@@ -4872,7 +5269,6 @@ class Router {
4872
5269
  id: 0,
4873
5270
  targetPageId: 0,
4874
5271
  currentUrlTree: this.currentUrlTree,
4875
- currentRawUrl: this.currentUrlTree,
4876
5272
  extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
4877
5273
  urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
4878
5274
  rawUrl: this.currentUrlTree,
@@ -4889,7 +5285,7 @@ class Router {
4889
5285
  guards: { canActivateChecks: [], canDeactivateChecks: [] },
4890
5286
  guardsResult: null,
4891
5287
  });
4892
- this.navigations = this.setupNavigations(this.transitions);
5288
+ this.navigations = this.navigationTransitions.setupNavigations(this.transitions);
4893
5289
  this.processNavigations();
4894
5290
  }
4895
5291
  /**
@@ -4901,282 +5297,6 @@ class Router {
4901
5297
  var _a;
4902
5298
  return (_a = this.location.getState()) === null || _a === void 0 ? void 0 : _a.ɵrouterPageId;
4903
5299
  }
4904
- setupNavigations(transitions) {
4905
- const eventsSubject = this.events;
4906
- return transitions.pipe(filter(t => t.id !== 0),
4907
- // Extract URL
4908
- map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl) }))),
4909
- // Using switchMap so we cancel executing navigations when a new one comes in
4910
- switchMap(overallTransitionState => {
4911
- let completed = false;
4912
- let errored = false;
4913
- return of(overallTransitionState)
4914
- .pipe(
4915
- // Store the Navigation object
4916
- tap(t => {
4917
- this.currentNavigation = {
4918
- id: t.id,
4919
- initialUrl: t.rawUrl,
4920
- extractedUrl: t.extractedUrl,
4921
- trigger: t.source,
4922
- extras: t.extras,
4923
- previousNavigation: this.lastSuccessfulNavigation ? Object.assign(Object.assign({}, this.lastSuccessfulNavigation), { previousNavigation: null }) :
4924
- null
4925
- };
4926
- }), switchMap(t => {
4927
- const browserUrlTree = this.browserUrlTree.toString();
4928
- const urlTransition = !this.navigated ||
4929
- t.extractedUrl.toString() !== browserUrlTree ||
4930
- // Navigations which succeed or ones which fail and are cleaned up
4931
- // correctly should result in `browserUrlTree` and `currentUrlTree`
4932
- // matching. If this is not the case, assume something went wrong and
4933
- // try processing the URL again.
4934
- browserUrlTree !== this.currentUrlTree.toString();
4935
- const processCurrentUrl = (this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4936
- this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4937
- if (processCurrentUrl) {
4938
- // If the source of the navigation is from a browser event, the URL is
4939
- // already updated. We already need to sync the internal state.
4940
- if (isBrowserTriggeredNavigation(t.source)) {
4941
- this.browserUrlTree = t.extractedUrl;
4942
- }
4943
- return of(t).pipe(
4944
- // Fire NavigationStart event
4945
- switchMap(t => {
4946
- const transition = this.transitions.getValue();
4947
- eventsSubject.next(new NavigationStart(t.id, this.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4948
- if (transition !== this.transitions.getValue()) {
4949
- return EMPTY;
4950
- }
4951
- // This delay is required to match old behavior that forced
4952
- // navigation to always be async
4953
- return Promise.resolve(t);
4954
- }),
4955
- // ApplyRedirects
4956
- applyRedirects(this.ngModule.injector, this.configLoader, this.urlSerializer, this.config),
4957
- // Update the currentNavigation
4958
- // `urlAfterRedirects` is guaranteed to be set after this point
4959
- tap(t => {
4960
- this.currentNavigation = Object.assign(Object.assign({}, this.currentNavigation), { finalUrl: t.urlAfterRedirects });
4961
- overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4962
- }),
4963
- // Recognize
4964
- recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy),
4965
- // Update URL if in `eager` update mode
4966
- tap(t => {
4967
- overallTransitionState.targetSnapshot = t.targetSnapshot;
4968
- if (this.urlUpdateStrategy === 'eager') {
4969
- if (!t.extras.skipLocationChange) {
4970
- const rawUrl = this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4971
- this.setBrowserUrl(rawUrl, t);
4972
- }
4973
- this.browserUrlTree = t.urlAfterRedirects;
4974
- }
4975
- // Fire RoutesRecognized
4976
- const routesRecognized = new RoutesRecognized(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4977
- eventsSubject.next(routesRecognized);
4978
- }));
4979
- }
4980
- else {
4981
- const processPreviousUrl = urlTransition && this.rawUrlTree &&
4982
- this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree);
4983
- /* When the current URL shouldn't be processed, but the previous one
4984
- * was, we handle this "error condition" by navigating to the
4985
- * previously successful URL, but leaving the URL intact.*/
4986
- if (processPreviousUrl) {
4987
- const { id, extractedUrl, source, restoredState, extras } = t;
4988
- const navStart = new NavigationStart(id, this.serializeUrl(extractedUrl), source, restoredState);
4989
- eventsSubject.next(navStart);
4990
- const targetSnapshot = createEmptyState(extractedUrl, this.rootComponentType).snapshot;
4991
- overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
4992
- return of(overallTransitionState);
4993
- }
4994
- else {
4995
- /* When neither the current or previous URL can be processed, do
4996
- * nothing other than update router's internal reference to the
4997
- * current "settled" URL. This way the next navigation will be coming
4998
- * from the current URL in the browser.
4999
- */
5000
- this.rawUrlTree = t.rawUrl;
5001
- t.resolve(null);
5002
- return EMPTY;
5003
- }
5004
- }
5005
- }),
5006
- // --- GUARDS ---
5007
- tap(t => {
5008
- const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
5009
- this.triggerEvent(guardsStart);
5010
- }), map(t => {
5011
- overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) });
5012
- return overallTransitionState;
5013
- }), checkGuards(this.ngModule.injector, (evt) => this.triggerEvent(evt)), tap(t => {
5014
- overallTransitionState.guardsResult = t.guardsResult;
5015
- if (isUrlTree(t.guardsResult)) {
5016
- throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
5017
- }
5018
- const guardsEnd = new GuardsCheckEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
5019
- this.triggerEvent(guardsEnd);
5020
- }), filter(t => {
5021
- if (!t.guardsResult) {
5022
- this.restoreHistory(t);
5023
- this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
5024
- return false;
5025
- }
5026
- return true;
5027
- }),
5028
- // --- RESOLVE ---
5029
- switchTap(t => {
5030
- if (t.guards.canActivateChecks.length) {
5031
- return of(t).pipe(tap(t => {
5032
- const resolveStart = new ResolveStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
5033
- this.triggerEvent(resolveStart);
5034
- }), switchMap(t => {
5035
- let dataResolved = false;
5036
- return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.ngModule.injector), tap({
5037
- next: () => dataResolved = true,
5038
- complete: () => {
5039
- if (!dataResolved) {
5040
- this.restoreHistory(t);
5041
- this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
5042
- `At least one route resolver didn't emit any value.` :
5043
- '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
5044
- }
5045
- }
5046
- }));
5047
- }), tap(t => {
5048
- const resolveEnd = new ResolveEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
5049
- this.triggerEvent(resolveEnd);
5050
- }));
5051
- }
5052
- return undefined;
5053
- }),
5054
- // --- LOAD COMPONENTS ---
5055
- switchTap((t) => {
5056
- const loadComponents = (route) => {
5057
- var _a;
5058
- const loaders = [];
5059
- if (((_a = route.routeConfig) === null || _a === void 0 ? void 0 : _a.loadComponent) &&
5060
- !route.routeConfig._loadedComponent) {
5061
- loaders.push(this.configLoader.loadComponent(route.routeConfig)
5062
- .pipe(tap(loadedComponent => {
5063
- route.component = loadedComponent;
5064
- }), map(() => void 0)));
5065
- }
5066
- for (const child of route.children) {
5067
- loaders.push(...loadComponents(child));
5068
- }
5069
- return loaders;
5070
- };
5071
- return combineLatest(loadComponents(t.targetSnapshot.root))
5072
- .pipe(defaultIfEmpty(), take(1));
5073
- }), switchTap(() => this.afterPreactivation()), map((t) => {
5074
- const targetRouterState = createRouterState(this.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
5075
- overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
5076
- return (overallTransitionState);
5077
- }),
5078
- /* Once here, we are about to activate synchronously. The assumption is
5079
- this will succeed, and user code may read from the Router service.
5080
- Therefore before activation, we need to update router properties storing
5081
- the current URL and the RouterState, as well as updated the browser URL.
5082
- All this should happen *before* activating. */
5083
- tap((t) => {
5084
- this.currentUrlTree = t.urlAfterRedirects;
5085
- this.rawUrlTree =
5086
- this.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
5087
- this.routerState = t.targetRouterState;
5088
- if (this.urlUpdateStrategy === 'deferred') {
5089
- if (!t.extras.skipLocationChange) {
5090
- this.setBrowserUrl(this.rawUrlTree, t);
5091
- }
5092
- this.browserUrlTree = t.urlAfterRedirects;
5093
- }
5094
- }), activateRoutes(this.rootContexts, this.routeReuseStrategy, (evt) => this.triggerEvent(evt)), tap({
5095
- next() {
5096
- completed = true;
5097
- },
5098
- complete() {
5099
- completed = true;
5100
- }
5101
- }), finalize(() => {
5102
- var _a;
5103
- /* When the navigation stream finishes either through error or success,
5104
- * we set the `completed` or `errored` flag. However, there are some
5105
- * situations where we could get here without either of those being set.
5106
- * For instance, a redirect during NavigationStart. Therefore, this is a
5107
- * catch-all to make sure the NavigationCancel event is fired when a
5108
- * navigation gets cancelled but not caught by other means. */
5109
- if (!completed && !errored) {
5110
- const cancelationReason = NG_DEV_MODE$2 ?
5111
- `Navigation ID ${overallTransitionState
5112
- .id} is not equal to the current navigation id ${this.navigationId}` :
5113
- '';
5114
- this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
5115
- }
5116
- // Only clear current navigation if it is still set to the one that
5117
- // finalized.
5118
- if (((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.id) === overallTransitionState.id) {
5119
- this.currentNavigation = null;
5120
- }
5121
- }), catchError((e) => {
5122
- var _a;
5123
- errored = true;
5124
- /* This error type is issued during Redirect, and is handled as a
5125
- * cancellation rather than an error. */
5126
- if (isNavigationCancelingError$1(e)) {
5127
- if (!isRedirectingNavigationCancelingError$1(e)) {
5128
- // Set property only if we're not redirecting. If we landed on a page
5129
- // and redirect to `/` route, the new navigation is going to see the
5130
- // `/` isn't a change from the default currentUrlTree and won't
5131
- // navigate. This is only applicable with initial navigation, so
5132
- // setting `navigated` only when not redirecting resolves this
5133
- // scenario.
5134
- this.navigated = true;
5135
- this.restoreHistory(overallTransitionState, true);
5136
- }
5137
- const navCancel = new NavigationCancel(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
5138
- eventsSubject.next(navCancel);
5139
- // When redirecting, we need to delay resolving the navigation
5140
- // promise and push it to the redirect navigation
5141
- if (!isRedirectingNavigationCancelingError$1(e)) {
5142
- overallTransitionState.resolve(false);
5143
- }
5144
- else {
5145
- const mergedTree = this.urlHandlingStrategy.merge(e.url, this.rawUrlTree);
5146
- const extras = {
5147
- skipLocationChange: overallTransitionState.extras.skipLocationChange,
5148
- // The URL is already updated at this point if we have 'eager' URL
5149
- // updates or if the navigation was triggered by the browser (back
5150
- // button, URL bar, etc). We want to replace that item in history
5151
- // if the navigation is rejected.
5152
- replaceUrl: this.urlUpdateStrategy === 'eager' ||
5153
- isBrowserTriggeredNavigation(overallTransitionState.source)
5154
- };
5155
- this.scheduleNavigation(mergedTree, 'imperative', null, extras, {
5156
- resolve: overallTransitionState.resolve,
5157
- reject: overallTransitionState.reject,
5158
- promise: overallTransitionState.promise
5159
- });
5160
- }
5161
- /* All other errors should reset to the router's internal URL reference
5162
- * to the pre-error state. */
5163
- }
5164
- else {
5165
- this.restoreHistory(overallTransitionState, true);
5166
- const navError = new NavigationError(overallTransitionState.id, this.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
5167
- eventsSubject.next(navError);
5168
- try {
5169
- overallTransitionState.resolve(this.errorHandler(e));
5170
- }
5171
- catch (ee) {
5172
- overallTransitionState.reject(ee);
5173
- }
5174
- }
5175
- return EMPTY;
5176
- }));
5177
- // TODO(jasonaden): remove cast once g3 is on updated TypeScript
5178
- }));
5179
- }
5180
5300
  /**
5181
5301
  * @internal
5182
5302
  * TODO: this should be removed once the constructor of the router made internal
@@ -5217,11 +5337,18 @@ class Router {
5217
5337
  setTimeout(() => {
5218
5338
  var _a;
5219
5339
  const extras = { replaceUrl: true };
5220
- // Navigations coming from Angular router have a navigationId state
5221
- // property. When this exists, restore the state.
5222
- const state = ((_a = event.state) === null || _a === void 0 ? void 0 : _a.navigationId) ? event.state : null;
5223
- if (state) {
5224
- const stateCopy = Object.assign({}, state);
5340
+ // TODO: restoredState should always include the entire state, regardless
5341
+ // of navigationId. This requires a breaking change to update the type on
5342
+ // NavigationStart’s restoredState, which currently requires navigationId
5343
+ // to always be present. The Router used to only restore history state if
5344
+ // a navigationId was present.
5345
+ // The stored navigationId is used by the RouterScroller to retrieve the scroll
5346
+ // position for the page.
5347
+ const restoredState = ((_a = event.state) === null || _a === void 0 ? void 0 : _a.navigationId) ? event.state : null;
5348
+ // Separate to NavigationStart.restoredState, we must also restore the state to
5349
+ // history.state and generate a new navigationId, since it will be overwritten
5350
+ if (event.state) {
5351
+ const stateCopy = Object.assign({}, event.state);
5225
5352
  delete stateCopy.navigationId;
5226
5353
  delete stateCopy.ɵrouterPageId;
5227
5354
  if (Object.keys(stateCopy).length !== 0) {
@@ -5229,7 +5356,7 @@ class Router {
5229
5356
  }
5230
5357
  }
5231
5358
  const urlTree = this.parseUrl(event['url']);
5232
- this.scheduleNavigation(urlTree, source, state, extras);
5359
+ this.scheduleNavigation(urlTree, source, restoredState, extras);
5233
5360
  }, 0);
5234
5361
  }
5235
5362
  });
@@ -5244,7 +5371,7 @@ class Router {
5244
5371
  * and `null` when idle.
5245
5372
  */
5246
5373
  getCurrentNavigation() {
5247
- return this.currentNavigation;
5374
+ return this.navigationTransitions.currentNavigation;
5248
5375
  }
5249
5376
  /** @internal */
5250
5377
  triggerEvent(event) {
@@ -5471,13 +5598,14 @@ class Router {
5471
5598
  this.currentPageId = t.targetPageId;
5472
5599
  this.events
5473
5600
  .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
5474
- this.lastSuccessfulNavigation = this.currentNavigation;
5601
+ this.lastSuccessfulNavigation = this.getCurrentNavigation();
5475
5602
  (_a = this.titleStrategy) === null || _a === void 0 ? void 0 : _a.updateTitle(this.routerState.snapshot);
5476
5603
  t.resolve(true);
5477
5604
  }, e => {
5478
5605
  this.console.warn(`Unhandled Navigation Error: ${e}`);
5479
5606
  });
5480
5607
  }
5608
+ /** @internal */
5481
5609
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
5482
5610
  var _a, _b;
5483
5611
  if (this.disposed) {
@@ -5531,7 +5659,6 @@ class Router {
5531
5659
  source,
5532
5660
  restoredState,
5533
5661
  currentUrlTree: this.currentUrlTree,
5534
- currentRawUrl: this.rawUrlTree,
5535
5662
  rawUrl,
5536
5663
  extras,
5537
5664
  resolve,
@@ -5546,10 +5673,11 @@ class Router {
5546
5673
  return Promise.reject(e);
5547
5674
  });
5548
5675
  }
5549
- setBrowserUrl(url, t) {
5676
+ /** @internal */
5677
+ setBrowserUrl(url, transition) {
5550
5678
  const path = this.urlSerializer.serialize(url);
5551
- const state = Object.assign(Object.assign({}, t.extras.state), this.generateNgRouterState(t.id, t.targetPageId));
5552
- if (this.location.isCurrentPathEqualTo(path) || !!t.extras.replaceUrl) {
5679
+ const state = Object.assign(Object.assign({}, transition.extras.state), this.generateNgRouterState(transition.id, transition.targetPageId));
5680
+ if (this.location.isCurrentPathEqualTo(path) || !!transition.extras.replaceUrl) {
5553
5681
  this.location.replaceState(path, '', state);
5554
5682
  }
5555
5683
  else {
@@ -5559,29 +5687,31 @@ class Router {
5559
5687
  /**
5560
5688
  * Performs the necessary rollback action to restore the browser URL to the
5561
5689
  * state before the transition.
5690
+ * @internal
5562
5691
  */
5563
- restoreHistory(t, restoringFromCaughtError = false) {
5692
+ restoreHistory(transition, restoringFromCaughtError = false) {
5564
5693
  var _a, _b;
5565
5694
  if (this.canceledNavigationResolution === 'computed') {
5566
- const targetPagePosition = this.currentPageId - t.targetPageId;
5695
+ const targetPagePosition = this.currentPageId - transition.targetPageId;
5567
5696
  // The navigator change the location before triggered the browser event,
5568
5697
  // so we need to go back to the current url if the navigation is canceled.
5569
5698
  // Also, when navigation gets cancelled while using url update strategy eager, then we need to
5570
5699
  // go back. Because, when `urlUpdateStrategy` is `eager`; `setBrowserUrl` method is called
5571
5700
  // before any verification.
5572
- const browserUrlUpdateOccurred = (t.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
5573
- this.currentUrlTree === ((_a = this.currentNavigation) === null || _a === void 0 ? void 0 : _a.finalUrl));
5701
+ const browserUrlUpdateOccurred = (transition.source === 'popstate' || this.urlUpdateStrategy === 'eager' ||
5702
+ this.currentUrlTree === ((_a = this.getCurrentNavigation()) === null || _a === void 0 ? void 0 : _a.finalUrl));
5574
5703
  if (browserUrlUpdateOccurred && targetPagePosition !== 0) {
5575
5704
  this.location.historyGo(targetPagePosition);
5576
5705
  }
5577
- else if (this.currentUrlTree === ((_b = this.currentNavigation) === null || _b === void 0 ? void 0 : _b.finalUrl) && targetPagePosition === 0) {
5706
+ else if (this.currentUrlTree === ((_b = this.getCurrentNavigation()) === null || _b === void 0 ? void 0 : _b.finalUrl) &&
5707
+ targetPagePosition === 0) {
5578
5708
  // We got to the activation stage (where currentUrlTree is set to the navigation's
5579
5709
  // finalUrl), but we weren't moving anywhere in history (skipLocationChange or replaceUrl).
5580
5710
  // We still need to reset the router state back to what it was when the navigation started.
5581
- this.resetState(t);
5711
+ this.resetState(transition);
5582
5712
  // TODO(atscott): resetting the `browserUrlTree` should really be done in `resetState`.
5583
5713
  // Investigate if this can be done by running TGP.
5584
- this.browserUrlTree = t.currentUrlTree;
5714
+ this.browserUrlTree = transition.currentUrlTree;
5585
5715
  this.resetUrlToCurrentUrlTree();
5586
5716
  }
5587
5717
  else {
@@ -5595,7 +5725,7 @@ class Router {
5595
5725
  // reject. For 'eager' navigations, it seems like we also really should reset the state
5596
5726
  // because the navigation was cancelled. Investigate if this can be done by running TGP.
5597
5727
  if (restoringFromCaughtError) {
5598
- this.resetState(t);
5728
+ this.resetState(transition);
5599
5729
  }
5600
5730
  this.resetUrlToCurrentUrlTree();
5601
5731
  }
@@ -5613,10 +5743,11 @@ class Router {
5613
5743
  resetUrlToCurrentUrlTree() {
5614
5744
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5615
5745
  }
5616
- cancelNavigationTransition(t, reason, code) {
5617
- const navCancel = new NavigationCancel(t.id, this.serializeUrl(t.extractedUrl), reason, code);
5746
+ /** @internal */
5747
+ cancelNavigationTransition(transition, reason, code) {
5748
+ const navCancel = new NavigationCancel(transition.id, this.serializeUrl(transition.extractedUrl), reason, code);
5618
5749
  this.triggerEvent(navCancel);
5619
- t.resolve(false);
5750
+ transition.resolve(false);
5620
5751
  }
5621
5752
  generateNgRouterState(navigationId, routerPageId) {
5622
5753
  if (this.canceledNavigationResolution === 'computed') {
@@ -5625,9 +5756,9 @@ class Router {
5625
5756
  return { navigationId };
5626
5757
  }
5627
5758
  }
5628
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5629
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5630
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: Router, decorators: [{
5759
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5760
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5761
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: Router, decorators: [{
5631
5762
  type: Injectable,
5632
5763
  args: [{
5633
5764
  providedIn: 'root',
@@ -5642,9 +5773,6 @@ function validateCommands(commands) {
5642
5773
  }
5643
5774
  }
5644
5775
  }
5645
- function isBrowserTriggeredNavigation(source) {
5646
- return source !== 'imperative';
5647
- }
5648
5776
 
5649
5777
  /**
5650
5778
  * @description
@@ -5921,9 +6049,9 @@ class RouterLink {
5921
6049
  });
5922
6050
  }
5923
6051
  }
5924
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5925
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
5926
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLink, decorators: [{
6052
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
6053
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.0", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
6054
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLink, decorators: [{
5927
6055
  type: Directive,
5928
6056
  args: [{
5929
6057
  selector: '[routerLink]',
@@ -6152,9 +6280,9 @@ class RouterLinkActive {
6152
6280
  return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
6153
6281
  }
6154
6282
  }
6155
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6156
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6157
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6283
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6284
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.1.0-next.0", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6285
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6158
6286
  type: Directive,
6159
6287
  args: [{
6160
6288
  selector: '[routerLinkActive]',
@@ -6216,9 +6344,9 @@ class PreloadAllModules {
6216
6344
  return fn().pipe(catchError(() => of(null)));
6217
6345
  }
6218
6346
  }
6219
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6220
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6221
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6347
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6348
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6349
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6222
6350
  type: Injectable,
6223
6351
  args: [{ providedIn: 'root' }]
6224
6352
  }] });
@@ -6236,9 +6364,9 @@ class NoPreloading {
6236
6364
  return of(null);
6237
6365
  }
6238
6366
  }
6239
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6240
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6241
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: NoPreloading, decorators: [{
6367
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6368
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6369
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: NoPreloading, decorators: [{
6242
6370
  type: Injectable,
6243
6371
  args: [{ providedIn: 'root' }]
6244
6372
  }] });
@@ -6334,9 +6462,9 @@ class RouterPreloader {
6334
6462
  });
6335
6463
  }
6336
6464
  }
6337
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6338
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6339
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterPreloader, decorators: [{
6465
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6466
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6467
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterPreloader, decorators: [{
6340
6468
  type: Injectable,
6341
6469
  args: [{ providedIn: 'root' }]
6342
6470
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
@@ -6427,9 +6555,9 @@ class RouterScroller {
6427
6555
  }
6428
6556
  }
6429
6557
  }
6430
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6431
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterScroller });
6432
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterScroller, decorators: [{
6558
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6559
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterScroller });
6560
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterScroller, decorators: [{
6433
6561
  type: Injectable
6434
6562
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6435
6563
 
@@ -6592,8 +6720,10 @@ function getBootstrapListener() {
6592
6720
  (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
6593
6721
  (_b = injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)) === null || _b === void 0 ? void 0 : _b.init();
6594
6722
  router.resetRootComponentType(ref.componentTypes[0]);
6595
- bootstrapDone.next();
6596
- bootstrapDone.complete();
6723
+ if (!bootstrapDone.closed) {
6724
+ bootstrapDone.next();
6725
+ bootstrapDone.unsubscribe();
6726
+ }
6597
6727
  };
6598
6728
  }
6599
6729
  /**
@@ -6641,7 +6771,6 @@ function withEnabledBlockingInitialNavigation() {
6641
6771
  deps: [Injector],
6642
6772
  useFactory: (injector) => {
6643
6773
  const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());
6644
- let initNavigation = false;
6645
6774
  /**
6646
6775
  * Performs the given action once the router finishes its next/current navigation.
6647
6776
  *
@@ -6676,21 +6805,13 @@ function withEnabledBlockingInitialNavigation() {
6676
6805
  // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6677
6806
  // without a redirect.
6678
6807
  resolve(true);
6679
- initNavigation = true;
6680
6808
  });
6681
6809
  router.afterPreactivation = () => {
6682
6810
  // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6683
6811
  // assume activation will complete successfully (even though this is not
6684
6812
  // guaranteed).
6685
6813
  resolve(true);
6686
- // only the initial navigation should be delayed until bootstrapping is done.
6687
- if (!initNavigation) {
6688
- return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6689
- // subsequent navigations should not be delayed
6690
- }
6691
- else {
6692
- return of(void 0);
6693
- }
6814
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6694
6815
  };
6695
6816
  router.initialNavigation();
6696
6817
  });
@@ -6980,10 +7101,10 @@ class RouterModule {
6980
7101
  };
6981
7102
  }
6982
7103
  }
6983
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6984
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
6985
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6986
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.0", ngImport: i0, type: RouterModule, decorators: [{
7104
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7105
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
7106
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7107
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.0-next.0", ngImport: i0, type: RouterModule, decorators: [{
6987
7108
  type: NgModule,
6988
7109
  args: [{
6989
7110
  imports: ROUTER_DIRECTIVES,
@@ -7070,7 +7191,7 @@ function provideRouterInitializer() {
7070
7191
  /**
7071
7192
  * @publicApi
7072
7193
  */
7073
- const VERSION = new Version('15.0.0');
7194
+ const VERSION = new Version('15.1.0-next.0');
7074
7195
 
7075
7196
  /**
7076
7197
  * @license
@@ -7109,5 +7230,5 @@ const VERSION = new Version('15.0.0');
7109
7230
  * Generated bundle index. Do not edit.
7110
7231
  */
7111
7232
 
7112
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
7233
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationSkipped, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
7113
7234
  //# sourceMappingURL=router.mjs.map