@angular/router 14.1.0 → 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.
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Angular v14.1.0
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, inject, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, 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, filter, mergeMap, first, concatMap, tap, catchError, scan, 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
  /**
@@ -182,7 +182,7 @@ function wrapIntoObservable(value) {
182
182
  * Use of this source code is governed by an MIT-style license that can be
183
183
  * found in the LICENSE file at https://angular.io/license
184
184
  */
185
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
185
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
186
186
  function createEmptyUrlTree() {
187
187
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
188
188
  }
@@ -647,7 +647,7 @@ class UrlParser {
647
647
  parseSegment() {
648
648
  const path = matchSegments(this.remaining);
649
649
  if (path === '' && this.peekStartsWith(';')) {
650
- 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}'.`);
651
651
  }
652
652
  this.capture(path);
653
653
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -716,7 +716,7 @@ class UrlParser {
716
716
  // if is is not one of these characters, then the segment was unescaped
717
717
  // or the group was not closed
718
718
  if (next !== '/' && next !== ')' && next !== ';') {
719
- 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}'`);
720
720
  }
721
721
  let outletName = undefined;
722
722
  if (path.indexOf(':') > -1) {
@@ -747,7 +747,7 @@ class UrlParser {
747
747
  }
748
748
  capture(str) {
749
749
  if (!this.consumeOptional(str)) {
750
- 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}".`);
751
751
  }
752
752
  }
753
753
  }
@@ -800,7 +800,7 @@ function isUrlTree(v) {
800
800
  * Use of this source code is governed by an MIT-style license that can be
801
801
  * found in the LICENSE file at https://angular.io/license
802
802
  */
803
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
803
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
804
804
  /**
805
805
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
806
806
  *
@@ -978,11 +978,11 @@ class Navigation {
978
978
  this.numberOfDoubleDots = numberOfDoubleDots;
979
979
  this.commands = commands;
980
980
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
981
- 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');
982
982
  }
983
983
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
984
984
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
985
- 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');
986
986
  }
987
987
  }
988
988
  toRoot() {
@@ -1081,7 +1081,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1081
1081
  dd -= ci;
1082
1082
  g = g.parent;
1083
1083
  if (!g) {
1084
- 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 \'../\'');
1085
1085
  }
1086
1086
  ci = g.segments.length;
1087
1087
  }
@@ -2364,7 +2364,7 @@ class ChildrenOutletContexts {
2364
2364
  * Use of this source code is governed by an MIT-style license that can be
2365
2365
  * found in the LICENSE file at https://angular.io/license
2366
2366
  */
2367
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
2367
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2368
2368
  /**
2369
2369
  * @description
2370
2370
  *
@@ -2474,12 +2474,12 @@ class RouterOutlet {
2474
2474
  */
2475
2475
  get component() {
2476
2476
  if (!this.activated)
2477
- 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');
2478
2478
  return this.activated.instance;
2479
2479
  }
2480
2480
  get activatedRoute() {
2481
2481
  if (!this.activated)
2482
- 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');
2483
2483
  return this._activatedRoute;
2484
2484
  }
2485
2485
  get activatedRouteData() {
@@ -2493,7 +2493,7 @@ class RouterOutlet {
2493
2493
  */
2494
2494
  detach() {
2495
2495
  if (!this.activated)
2496
- 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');
2497
2497
  this.location.detach();
2498
2498
  const cmp = this.activated;
2499
2499
  this.activated = null;
@@ -2521,7 +2521,7 @@ class RouterOutlet {
2521
2521
  }
2522
2522
  activateWith(activatedRoute, resolverOrInjector) {
2523
2523
  if (this.isActivated) {
2524
- 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');
2525
2525
  }
2526
2526
  this._activatedRoute = activatedRoute;
2527
2527
  const location = this.location;
@@ -2543,9 +2543,9 @@ class RouterOutlet {
2543
2543
  this.activateEvents.emit(this.activated.instance);
2544
2544
  }
2545
2545
  }
2546
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", 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.0", 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.0", 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: [{
2549
2549
  type: Directive,
2550
2550
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2551
2551
  }], ctorParameters: function () {
@@ -2604,9 +2604,9 @@ function isComponentFactoryResolver(item) {
2604
2604
  */
2605
2605
  class ɵEmptyOutletComponent {
2606
2606
  }
2607
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2608
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", 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.0", 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: [{
2610
2610
  type: Component,
2611
2611
  args: [{ template: `<router-outlet></router-outlet>` }]
2612
2612
  }] });
@@ -3503,7 +3503,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3503
3503
  * Use of this source code is governed by an MIT-style license that can be
3504
3504
  * found in the LICENSE file at https://angular.io/license
3505
3505
  */
3506
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || ngDevMode;
3506
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3507
3507
  class NoMatch$1 {
3508
3508
  constructor(segmentGroup) {
3509
3509
  this.segmentGroup = segmentGroup || null;
@@ -3521,11 +3521,11 @@ function absoluteRedirect(newTree) {
3521
3521
  return throwError(new AbsoluteRedirect(newTree));
3522
3522
  }
3523
3523
  function namedOutletsRedirect(redirectTo) {
3524
- 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 &&
3525
3525
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3526
3526
  }
3527
3527
  function canLoadFails(route) {
3528
- return throwError(navigationCancelingError(NG_DEV_MODE$4 &&
3528
+ return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3529
3529
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3530
3530
  }
3531
3531
  /**
@@ -3585,7 +3585,7 @@ class ApplyRedirects {
3585
3585
  }));
3586
3586
  }
3587
3587
  noMatchError(e) {
3588
- 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}'`);
3589
3589
  }
3590
3590
  createUrlTree(rootCandidate, queryParams, fragment) {
3591
3591
  const root = createRoot(rootCandidate);
@@ -3802,7 +3802,7 @@ class ApplyRedirects {
3802
3802
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3803
3803
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3804
3804
  if (!pos)
3805
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$4 &&
3805
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3806
3806
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3807
3807
  return pos;
3808
3808
  }
@@ -3838,7 +3838,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3838
3838
  * Use of this source code is governed by an MIT-style license that can be
3839
3839
  * found in the LICENSE file at https://angular.io/license
3840
3840
  */
3841
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3841
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3842
3842
  class NoMatch {
3843
3843
  }
3844
3844
  function newObservableError(e) {
@@ -3927,7 +3927,7 @@ class Recognizer {
3927
3927
  // multiple activated results for the same outlet. We should merge the children of
3928
3928
  // these results so the final return value is only one `TreeNode` per outlet.
3929
3929
  const mergedChildren = mergeEmptyPathMatches(children);
3930
- if (NG_DEV_MODE$3) {
3930
+ if (NG_DEV_MODE$4) {
3931
3931
  // This should really never happen - we are only taking the first match for each
3932
3932
  // outlet and merge the empty path matches.
3933
3933
  checkOutletNameUniqueness(mergedChildren);
@@ -3962,7 +3962,7 @@ class Recognizer {
3962
3962
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3963
3963
  // production bundle size. This value is intended only to surface a warning to users
3964
3964
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3965
- (NG_DEV_MODE$3 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3965
+ (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3966
3966
  pathIndexShift));
3967
3967
  matchResult = of({
3968
3968
  snapshot,
@@ -3979,7 +3979,7 @@ class Recognizer {
3979
3979
  return null;
3980
3980
  }
3981
3981
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
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$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 ?
3983
3983
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3984
3984
  pathIndexShift));
3985
3985
  return { snapshot, consumedSegments, remainingSegments };
@@ -4093,7 +4093,7 @@ function checkOutletNameUniqueness(nodes) {
4093
4093
  if (routeWithSameOutletName) {
4094
4094
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4095
4095
  const c = n.value.url.map(s => s.toString()).join('/');
4096
- 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}'.`);
4097
4097
  }
4098
4098
  names[n.value.outlet] = n.value;
4099
4099
  });
@@ -4230,6 +4230,91 @@ function switchTap(next) {
4230
4230
  });
4231
4231
  }
4232
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
+
4233
4318
  /**
4234
4319
  * @license
4235
4320
  * Copyright Google LLC All Rights Reserved.
@@ -4295,6 +4380,24 @@ class BaseRouteReuseStrategy {
4295
4380
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4296
4381
  }
4297
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
+
4298
4401
  /**
4299
4402
  * @license
4300
4403
  * Copyright Google LLC All Rights Reserved.
@@ -4402,9 +4505,9 @@ class RouterConfigLoader {
4402
4505
  }));
4403
4506
  }
4404
4507
  }
4405
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4406
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterConfigLoader });
4407
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
4408
4511
  type: Injectable
4409
4512
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4410
4513
 
@@ -4439,6 +4542,13 @@ class DefaultUrlHandlingStrategy {
4439
4542
  }
4440
4543
  }
4441
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
+ */
4442
4552
  const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4443
4553
  function defaultErrorHandler(error) {
4444
4554
  throw error;
@@ -4466,6 +4576,53 @@ const subsetMatchOptions = {
4466
4576
  matrixParams: 'ignored',
4467
4577
  queryParams: 'subset'
4468
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
+ }
4469
4626
  /**
4470
4627
  * @description
4471
4628
  *
@@ -5373,10 +5530,14 @@ class Router {
5373
5530
  return { navigationId };
5374
5531
  }
5375
5532
  }
5376
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5377
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router });
5378
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: Router, decorators: [{
5379
- 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
+ }]
5380
5541
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5381
5542
  function validateCommands(commands) {
5382
5543
  for (let i = 0; i < commands.length; i++) {
@@ -5567,9 +5728,9 @@ class RouterLink {
5567
5728
  });
5568
5729
  }
5569
5730
  }
5570
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5571
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", 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 });
5572
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
5573
5734
  type: Directive,
5574
5735
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5575
5736
  }], ctorParameters: function () {
@@ -5688,9 +5849,9 @@ class RouterLinkWithHref {
5688
5849
  });
5689
5850
  }
5690
5851
  }
5691
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5692
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", 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 });
5693
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
5694
5855
  type: Directive,
5695
5856
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5696
5857
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5917,9 +6078,9 @@ class RouterLinkActive {
5917
6078
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5918
6079
  }
5919
6080
  }
5920
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", 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 });
5921
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", 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 });
5922
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
5923
6084
  type: Directive,
5924
6085
  args: [{
5925
6086
  selector: '[routerLinkActive]',
@@ -5953,91 +6114,6 @@ function isActiveMatchOptions(options) {
5953
6114
  return !!options.paths;
5954
6115
  }
5955
6116
 
5956
- /**
5957
- * @license
5958
- * Copyright Google LLC All Rights Reserved.
5959
- *
5960
- * Use of this source code is governed by an MIT-style license that can be
5961
- * found in the LICENSE file at https://angular.io/license
5962
- */
5963
- /**
5964
- * Provides a strategy for setting the page title after a router navigation.
5965
- *
5966
- * The built-in implementation traverses the router state snapshot and finds the deepest primary
5967
- * outlet with `title` property. Given the `Routes` below, navigating to
5968
- * `/base/child(popup:aux)` would result in the document title being set to "child".
5969
- * ```
5970
- * [
5971
- * {path: 'base', title: 'base', children: [
5972
- * {path: 'child', title: 'child'},
5973
- * ],
5974
- * {path: 'aux', outlet: 'popup', title: 'popupTitle'}
5975
- * ]
5976
- * ```
5977
- *
5978
- * This class can be used as a base class for custom title strategies. That is, you can create your
5979
- * own class that extends the `TitleStrategy`. Note that in the above example, the `title`
5980
- * from the named outlet is never used. However, a custom strategy might be implemented to
5981
- * incorporate titles in named outlets.
5982
- *
5983
- * @publicApi
5984
- * @see [Page title guide](guide/router#setting-the-page-title)
5985
- */
5986
- class TitleStrategy {
5987
- /**
5988
- * @returns The `title` of the deepest primary route.
5989
- */
5990
- buildTitle(snapshot) {
5991
- var _a;
5992
- let pageTitle;
5993
- let route = snapshot.root;
5994
- while (route !== undefined) {
5995
- pageTitle = (_a = this.getResolvedTitleForRoute(route)) !== null && _a !== void 0 ? _a : pageTitle;
5996
- route = route.children.find(child => child.outlet === PRIMARY_OUTLET);
5997
- }
5998
- return pageTitle;
5999
- }
6000
- /**
6001
- * Given an `ActivatedRouteSnapshot`, returns the final value of the
6002
- * `Route.title` property, which can either be a static string or a resolved value.
6003
- */
6004
- getResolvedTitleForRoute(snapshot) {
6005
- return snapshot.data[RouteTitle];
6006
- }
6007
- }
6008
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6009
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
6010
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: TitleStrategy, decorators: [{
6011
- type: Injectable,
6012
- args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
6013
- }] });
6014
- /**
6015
- * The default `TitleStrategy` used by the router that updates the title using the `Title` service.
6016
- */
6017
- class DefaultTitleStrategy extends TitleStrategy {
6018
- constructor(title) {
6019
- super();
6020
- this.title = title;
6021
- }
6022
- /**
6023
- * Sets the title of the browser to the given value.
6024
- *
6025
- * @param title The `pageTitle` from the deepest primary route.
6026
- */
6027
- updateTitle(snapshot) {
6028
- const title = this.buildTitle(snapshot);
6029
- if (title !== undefined) {
6030
- this.title.setTitle(title);
6031
- }
6032
- }
6033
- }
6034
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
6035
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6036
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
6037
- type: Injectable,
6038
- args: [{ providedIn: 'root' }]
6039
- }], ctorParameters: function () { return [{ type: i1.Title }]; } });
6040
-
6041
6117
  /**
6042
6118
  * @license
6043
6119
  * Copyright Google LLC All Rights Reserved.
@@ -6070,9 +6146,9 @@ class PreloadAllModules {
6070
6146
  return fn().pipe(catchError(() => of(null)));
6071
6147
  }
6072
6148
  }
6073
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6074
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6075
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
6076
6152
  type: Injectable,
6077
6153
  args: [{ providedIn: 'root' }]
6078
6154
  }] });
@@ -6090,9 +6166,9 @@ class NoPreloading {
6090
6166
  return of(null);
6091
6167
  }
6092
6168
  }
6093
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6094
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6095
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
6096
6172
  type: Injectable,
6097
6173
  args: [{ providedIn: 'root' }]
6098
6174
  }] });
@@ -6140,7 +6216,15 @@ class RouterPreloader {
6140
6216
  }
6141
6217
  const injectorForCurrentRoute = (_a = route._injector) !== null && _a !== void 0 ? _a : injector;
6142
6218
  const injectorForChildren = (_b = route._loadedInjector) !== null && _b !== void 0 ? _b : injectorForCurrentRoute;
6143
- 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) ||
6144
6228
  (route.loadComponent && !route._loadedComponent)) {
6145
6229
  res.push(this.preloadConfig(injectorForCurrentRoute, route));
6146
6230
  }
@@ -6180,9 +6264,9 @@ class RouterPreloader {
6180
6264
  });
6181
6265
  }
6182
6266
  }
6183
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6184
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterPreloader });
6185
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
6186
6270
  type: Injectable
6187
6271
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6188
6272
 
@@ -6262,9 +6346,9 @@ class RouterScroller {
6262
6346
  }
6263
6347
  }
6264
6348
  }
6265
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6266
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterScroller });
6267
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
6268
6352
  type: Injectable
6269
6353
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6270
6354
 
@@ -6280,36 +6364,26 @@ const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
6280
6364
  * The directives defined in the `RouterModule`.
6281
6365
  */
6282
6366
  const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent];
6283
- /**
6284
- * A [DI token](guide/glossary/#di-token) for the router service.
6285
- *
6286
- * @publicApi
6287
- */
6288
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE ? 'router config' : 'ROUTER_CONFIGURATION', {
6289
- providedIn: 'root',
6290
- factory: () => ({}),
6291
- });
6292
6367
  /**
6293
6368
  * @docsNotRequired
6294
6369
  */
6295
6370
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6296
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.
6297
6376
  const ROUTER_PROVIDERS = [
6298
6377
  Location,
6299
6378
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
6300
- {
6301
- provide: Router,
6302
- useFactory: setupRouter,
6303
- deps: [
6304
- UrlSerializer, ChildrenOutletContexts, Location, Injector, Compiler, ROUTES, TitleStrategy,
6305
- ROUTER_CONFIGURATION, [UrlHandlingStrategy, new Optional()],
6306
- [RouteReuseStrategy, new Optional()]
6307
- ]
6308
- },
6379
+ { provide: Router, useFactory: setupRouter },
6309
6380
  ChildrenOutletContexts,
6310
6381
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6311
6382
  RouterConfigLoader,
6312
6383
  ];
6384
+ function rootRoute(router) {
6385
+ return router.routerState.root;
6386
+ }
6313
6387
  function routerNgProbeToken() {
6314
6388
  return new NgProbeToken('Router', Router);
6315
6389
  }
@@ -6335,8 +6409,7 @@ function routerNgProbeToken() {
6335
6409
  * @publicApi
6336
6410
  */
6337
6411
  class RouterModule {
6338
- // Note: We are injecting the Router so it gets created eagerly...
6339
- constructor(guard, router) { }
6412
+ constructor(guard) { }
6340
6413
  /**
6341
6414
  * Creates and configures a module with all the router providers and directives.
6342
6415
  * Optionally sets up an application listener to perform an initial navigation.
@@ -6397,10 +6470,10 @@ class RouterModule {
6397
6470
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6398
6471
  }
6399
6472
  }
6400
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6401
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6402
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: RouterModule });
6403
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", 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: [{
6404
6477
  type: NgModule,
6405
6478
  args: [{
6406
6479
  declarations: ROUTER_DIRECTIVES,
@@ -6412,8 +6485,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
6412
6485
  }, {
6413
6486
  type: Inject,
6414
6487
  args: [ROUTER_FORROOT_GUARD]
6415
- }] }, { type: Router, decorators: [{
6416
- type: Optional
6417
6488
  }] }];
6418
6489
  } });
6419
6490
  function provideRouterScroller() {
@@ -6460,48 +6531,9 @@ function provideForRootGuard(router) {
6460
6531
  */
6461
6532
  function provideRoutes(routes) {
6462
6533
  return [
6463
- { provide: ANALYZE_FOR_ENTRY_COMPONENTS, multi: true, useValue: routes },
6464
6534
  { provide: ROUTES, multi: true, useValue: routes },
6465
6535
  ];
6466
6536
  }
6467
- function setupRouter(urlSerializer, contexts, location, injector, compiler, config, titleStrategy, opts = {}, urlHandlingStrategy, routeReuseStrategy) {
6468
- const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
6469
- if (urlHandlingStrategy) {
6470
- router.urlHandlingStrategy = urlHandlingStrategy;
6471
- }
6472
- if (routeReuseStrategy) {
6473
- router.routeReuseStrategy = routeReuseStrategy;
6474
- }
6475
- router.titleStrategy = titleStrategy;
6476
- assignExtraOptionsToRouter(opts, router);
6477
- return router;
6478
- }
6479
- function assignExtraOptionsToRouter(opts, router) {
6480
- if (opts.errorHandler) {
6481
- router.errorHandler = opts.errorHandler;
6482
- }
6483
- if (opts.malformedUriErrorHandler) {
6484
- router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
6485
- }
6486
- if (opts.onSameUrlNavigation) {
6487
- router.onSameUrlNavigation = opts.onSameUrlNavigation;
6488
- }
6489
- if (opts.paramsInheritanceStrategy) {
6490
- router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
6491
- }
6492
- if (opts.relativeLinkResolution) {
6493
- router.relativeLinkResolution = opts.relativeLinkResolution;
6494
- }
6495
- if (opts.urlUpdateStrategy) {
6496
- router.urlUpdateStrategy = opts.urlUpdateStrategy;
6497
- }
6498
- if (opts.canceledNavigationResolution) {
6499
- router.canceledNavigationResolution = opts.canceledNavigationResolution;
6500
- }
6501
- }
6502
- function rootRoute(router) {
6503
- return router.routerState.root;
6504
- }
6505
6537
  function getBootstrapListener() {
6506
6538
  const injector = inject(Injector);
6507
6539
  return (bootstrappedComponentRef) => {
@@ -6512,8 +6544,7 @@ function getBootstrapListener() {
6512
6544
  }
6513
6545
  const router = injector.get(Router);
6514
6546
  const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6515
- // Default case
6516
- if (injector.get(INITIAL_NAVIGATION, null, InjectFlags.Optional) === null) {
6547
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6517
6548
  router.initialNavigation();
6518
6549
  }
6519
6550
  (_a = injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)) === null || _a === void 0 ? void 0 : _a.setUpPreloading();
@@ -6557,7 +6588,7 @@ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicato
6557
6588
  });
6558
6589
  function provideEnabledBlockingInitialNavigation() {
6559
6590
  return [
6560
- { provide: INITIAL_NAVIGATION, useValue: 'enabledBlocking' },
6591
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6561
6592
  {
6562
6593
  provide: APP_INITIALIZER,
6563
6594
  multi: true,
@@ -6623,7 +6654,7 @@ function provideEnabledBlockingInitialNavigation() {
6623
6654
  },
6624
6655
  ];
6625
6656
  }
6626
- 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 */ });
6627
6658
  function provideDisabledInitialNavigation() {
6628
6659
  return [
6629
6660
  {
@@ -6636,7 +6667,7 @@ function provideDisabledInitialNavigation() {
6636
6667
  };
6637
6668
  }
6638
6669
  },
6639
- { provide: INITIAL_NAVIGATION, useValue: 'disabled' }
6670
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6640
6671
  ];
6641
6672
  }
6642
6673
  function provideTracing() {
@@ -6680,7 +6711,7 @@ function providePreloading(preloadingStrategy) {
6680
6711
  /**
6681
6712
  * @publicApi
6682
6713
  */
6683
- const VERSION = new Version('14.1.0');
6714
+ const VERSION = new Version('14.1.1');
6684
6715
 
6685
6716
  /**
6686
6717
  * @license