@angular/router 14.2.0-next.0 → 14.2.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/apply_redirects.mjs +4 -3
  2. package/esm2020/src/components/empty_outlet.mjs +3 -3
  3. package/esm2020/src/directives/router_link.mjs +101 -23
  4. package/esm2020/src/directives/router_link_active.mjs +3 -3
  5. package/esm2020/src/directives/router_outlet.mjs +3 -3
  6. package/esm2020/src/index.mjs +3 -2
  7. package/esm2020/src/models.mjs +1 -1
  8. package/esm2020/src/operators/check_guards.mjs +36 -26
  9. package/esm2020/src/operators/resolve_data.mjs +19 -15
  10. package/esm2020/src/page_title_strategy.mjs +6 -6
  11. package/esm2020/src/patchable_relative_link_resolution.mjs +12 -0
  12. package/esm2020/src/private_export.mjs +3 -2
  13. package/esm2020/src/provide_router.mjs +420 -0
  14. package/esm2020/src/recognize.mjs +4 -3
  15. package/esm2020/src/router.mjs +6 -4
  16. package/esm2020/src/router_config.mjs +1 -1
  17. package/esm2020/src/router_config_loader.mjs +3 -3
  18. package/esm2020/src/router_module.mjs +28 -185
  19. package/esm2020/src/router_outlet_context.mjs +3 -3
  20. package/esm2020/src/router_preloader.mjs +12 -11
  21. package/esm2020/src/router_scroller.mjs +3 -3
  22. package/esm2020/src/url_tree.mjs +3 -3
  23. package/esm2020/src/utils/preactivation.mjs +16 -6
  24. package/esm2020/src/utils/type_guards.mjs +5 -1
  25. package/esm2020/src/version.mjs +1 -1
  26. package/esm2020/testing/src/provide_router_for_testing.mjs +51 -0
  27. package/esm2020/testing/src/router_testing_module.mjs +8 -8
  28. package/fesm2015/router.mjs +697 -322
  29. package/fesm2015/router.mjs.map +1 -1
  30. package/fesm2015/testing.mjs +8 -8
  31. package/fesm2015/testing.mjs.map +1 -1
  32. package/fesm2015/upgrade.mjs +1 -1
  33. package/fesm2020/router.mjs +691 -320
  34. package/fesm2020/router.mjs.map +1 -1
  35. package/fesm2020/testing.mjs +8 -8
  36. package/fesm2020/testing.mjs.map +1 -1
  37. package/fesm2020/upgrade.mjs +1 -1
  38. package/index.d.ts +589 -211
  39. package/package.json +4 -4
  40. package/testing/index.d.ts +1 -1
  41. package/upgrade/index.d.ts +1 -1
@@ -1,14 +1,14 @@
1
1
  /**
2
- * @license Angular v14.2.0-next.0
2
+ * @license Angular v14.2.0
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, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, inject, 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
- import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
8
+ import { ɵisObservable, ɵisPromise, Injectable, ɵRuntimeError, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, inject, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, APP_BOOTSTRAP_LISTENER, ApplicationRef, APP_INITIALIZER, ENVIRONMENT_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
9
+ import { from, of, BehaviorSubject, EmptyError, combineLatest, concat, defer, pipe, throwError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import * as i3 from '@angular/common';
11
- import { Location, LocationStrategy, HashLocationStrategy, PathLocationStrategy, ViewportScroller, LOCATION_INITIALIZED } from '@angular/common';
11
+ import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
12
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
 
@@ -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$8 = typeof ngDevMode === 'undefined' || ngDevMode;
205
+ const NG_DEV_MODE$9 = typeof ngDevMode === 'undefined' || ngDevMode;
206
206
  function createEmptyUrlTree() {
207
207
  return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
208
208
  }
@@ -459,9 +459,9 @@ function mapChildrenIntoArray(segment, fn) {
459
459
  */
460
460
  class UrlSerializer {
461
461
  }
462
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
463
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
464
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: UrlSerializer, decorators: [{
462
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
463
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
464
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: UrlSerializer, decorators: [{
465
465
  type: Injectable,
466
466
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
467
467
  }] });
@@ -673,7 +673,7 @@ class UrlParser {
673
673
  parseSegment() {
674
674
  const path = matchSegments(this.remaining);
675
675
  if (path === '' && this.peekStartsWith(';')) {
676
- throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$8 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
676
+ throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, NG_DEV_MODE$9 && `Empty path url segment cannot have parameters: '${this.remaining}'.`);
677
677
  }
678
678
  this.capture(path);
679
679
  return new UrlSegment(decode(path), this.parseMatrixParams());
@@ -742,7 +742,7 @@ class UrlParser {
742
742
  // if is is not one of these characters, then the segment was unescaped
743
743
  // or the group was not closed
744
744
  if (next !== '/' && next !== ')' && next !== ';') {
745
- throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$8 && `Cannot parse url '${this.url}'`);
745
+ throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, NG_DEV_MODE$9 && `Cannot parse url '${this.url}'`);
746
746
  }
747
747
  let outletName = undefined;
748
748
  if (path.indexOf(':') > -1) {
@@ -773,7 +773,7 @@ class UrlParser {
773
773
  }
774
774
  capture(str) {
775
775
  if (!this.consumeOptional(str)) {
776
- throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$8 && `Expected "${str}".`);
776
+ throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, NG_DEV_MODE$9 && `Expected "${str}".`);
777
777
  }
778
778
  }
779
779
  }
@@ -826,7 +826,7 @@ function isUrlTree(v) {
826
826
  * Use of this source code is governed by an MIT-style license that can be
827
827
  * found in the LICENSE file at https://angular.io/license
828
828
  */
829
- const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
829
+ const NG_DEV_MODE$8 = typeof ngDevMode === 'undefined' || ngDevMode;
830
830
  /**
831
831
  * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.
832
832
  *
@@ -1002,11 +1002,11 @@ class Navigation {
1002
1002
  this.numberOfDoubleDots = numberOfDoubleDots;
1003
1003
  this.commands = commands;
1004
1004
  if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
1005
- throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$7 && 'Root segment cannot have matrix parameters');
1005
+ throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, NG_DEV_MODE$8 && 'Root segment cannot have matrix parameters');
1006
1006
  }
1007
1007
  const cmdWithOutlet = commands.find(isCommandWithOutlets);
1008
1008
  if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {
1009
- throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$7 && '{outlets:{}} has to be the last command');
1009
+ throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, NG_DEV_MODE$8 && '{outlets:{}} has to be the last command');
1010
1010
  }
1011
1011
  }
1012
1012
  toRoot() {
@@ -1105,7 +1105,7 @@ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
1105
1105
  dd -= ci;
1106
1106
  g = g.parent;
1107
1107
  if (!g) {
1108
- throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$7 && 'Invalid number of \'../\'');
1108
+ throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, NG_DEV_MODE$8 && 'Invalid number of \'../\'');
1109
1109
  }
1110
1110
  ci = g.segments.length;
1111
1111
  }
@@ -2382,9 +2382,9 @@ class ChildrenOutletContexts {
2382
2382
  return this.contexts.get(childName) || null;
2383
2383
  }
2384
2384
  }
2385
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2386
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2387
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2385
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2386
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2387
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2388
2388
  type: Injectable,
2389
2389
  args: [{ providedIn: 'root' }]
2390
2390
  }] });
@@ -2396,7 +2396,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
2396
2396
  * Use of this source code is governed by an MIT-style license that can be
2397
2397
  * found in the LICENSE file at https://angular.io/license
2398
2398
  */
2399
- const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
2399
+ const NG_DEV_MODE$7 = typeof ngDevMode === 'undefined' || ngDevMode;
2400
2400
  /**
2401
2401
  * @description
2402
2402
  *
@@ -2505,12 +2505,12 @@ class RouterOutlet {
2505
2505
  */
2506
2506
  get component() {
2507
2507
  if (!this.activated)
2508
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2508
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2509
2509
  return this.activated.instance;
2510
2510
  }
2511
2511
  get activatedRoute() {
2512
2512
  if (!this.activated)
2513
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2513
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2514
2514
  return this._activatedRoute;
2515
2515
  }
2516
2516
  get activatedRouteData() {
@@ -2524,7 +2524,7 @@ class RouterOutlet {
2524
2524
  */
2525
2525
  detach() {
2526
2526
  if (!this.activated)
2527
- throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$6 && 'Outlet is not activated');
2527
+ throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, NG_DEV_MODE$7 && 'Outlet is not activated');
2528
2528
  this.location.detach();
2529
2529
  const cmp = this.activated;
2530
2530
  this.activated = null;
@@ -2552,7 +2552,7 @@ class RouterOutlet {
2552
2552
  }
2553
2553
  activateWith(activatedRoute, resolverOrInjector) {
2554
2554
  if (this.isActivated) {
2555
- throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$6 && 'Cannot activate an already activated outlet');
2555
+ throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, NG_DEV_MODE$7 && 'Cannot activate an already activated outlet');
2556
2556
  }
2557
2557
  this._activatedRoute = activatedRoute;
2558
2558
  const location = this.location;
@@ -2574,9 +2574,9 @@ class RouterOutlet {
2574
2574
  this.activateEvents.emit(this.activated.instance);
2575
2575
  }
2576
2576
  }
2577
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.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 });
2578
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2579
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterOutlet, decorators: [{
2577
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.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 });
2578
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterOutlet, isStandalone: true, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2579
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterOutlet, decorators: [{
2580
2580
  type: Directive,
2581
2581
  args: [{
2582
2582
  selector: 'router-outlet',
@@ -2637,9 +2637,9 @@ function isComponentFactoryResolver(item) {
2637
2637
  */
2638
2638
  class ɵEmptyOutletComponent {
2639
2639
  }
2640
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2641
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.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", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2642
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2640
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2641
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.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", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2642
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2643
2643
  type: Component,
2644
2644
  args: [{
2645
2645
  template: `<router-outlet></router-outlet>`,
@@ -3043,10 +3043,20 @@ function getCanActivateChild(p) {
3043
3043
  return null;
3044
3044
  return { node: p, guards: canActivateChild };
3045
3045
  }
3046
- function getToken(token, snapshot, fallbackInjector) {
3047
- const routeInjector = getClosestRouteInjector(snapshot);
3048
- const injector = routeInjector ?? fallbackInjector;
3049
- return injector.get(token);
3046
+ function getTokenOrFunctionIdentity(tokenOrFunction, injector) {
3047
+ const NOT_FOUND = Symbol();
3048
+ const result = injector.get(tokenOrFunction, NOT_FOUND);
3049
+ if (result === NOT_FOUND) {
3050
+ if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {
3051
+ // We think the token is just a function so return it as-is
3052
+ return tokenOrFunction;
3053
+ }
3054
+ else {
3055
+ // This will throw the not found error
3056
+ return injector.get(tokenOrFunction);
3057
+ }
3058
+ }
3059
+ return result;
3050
3060
  }
3051
3061
  function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
3052
3062
  canDeactivateChecks: [],
@@ -3200,6 +3210,9 @@ function isRedirectingNavigationCancelingError(error) {
3200
3210
  function isNavigationCancelingError(error) {
3201
3211
  return error && error[NAVIGATION_CANCELING_ERROR];
3202
3212
  }
3213
+ function isEmptyError(e) {
3214
+ return e instanceof EmptyError || e?.name === 'EmptyError';
3215
+ }
3203
3216
 
3204
3217
  /**
3205
3218
  * @license
@@ -3242,28 +3255,28 @@ function prioritizedGuardValue() {
3242
3255
  * Use of this source code is governed by an MIT-style license that can be
3243
3256
  * found in the LICENSE file at https://angular.io/license
3244
3257
  */
3245
- function checkGuards(moduleInjector, forwardEvent) {
3258
+ function checkGuards(injector, forwardEvent) {
3246
3259
  return mergeMap(t => {
3247
3260
  const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
3248
3261
  if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
3249
3262
  return of({ ...t, guardsResult: true });
3250
3263
  }
3251
- return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, moduleInjector)
3264
+ return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector)
3252
3265
  .pipe(mergeMap(canDeactivate => {
3253
3266
  return canDeactivate && isBoolean(canDeactivate) ?
3254
- runCanActivateChecks(targetSnapshot, canActivateChecks, moduleInjector, forwardEvent) :
3267
+ runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) :
3255
3268
  of(canDeactivate);
3256
3269
  }), map(guardsResult => ({ ...t, guardsResult })));
3257
3270
  });
3258
3271
  }
3259
- function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) {
3260
- return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector)), first(result => {
3272
+ function runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {
3273
+ return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {
3261
3274
  return result !== true;
3262
3275
  }, true));
3263
3276
  }
3264
- function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEvent) {
3277
+ function runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {
3265
3278
  return from(checks).pipe(concatMap((check) => {
3266
- return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, moduleInjector), runCanActivate(futureSnapshot, check.route, moduleInjector));
3279
+ return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));
3267
3280
  }), first(result => {
3268
3281
  return result !== true;
3269
3282
  }, true));
@@ -3296,21 +3309,23 @@ function fireChildActivationStart(snapshot, forwardEvent) {
3296
3309
  }
3297
3310
  return of(true);
3298
3311
  }
3299
- function runCanActivate(futureRSS, futureARS, moduleInjector) {
3312
+ function runCanActivate(futureRSS, futureARS, injector) {
3300
3313
  const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
3301
3314
  if (!canActivate || canActivate.length === 0)
3302
3315
  return of(true);
3303
- const canActivateObservables = canActivate.map((c) => {
3316
+ const canActivateObservables = canActivate.map((canActivate) => {
3304
3317
  return defer(() => {
3305
- const guard = getToken(c, futureARS, moduleInjector);
3306
- const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) :
3307
- guard(futureARS, futureRSS);
3318
+ const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
3319
+ const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);
3320
+ const guardVal = isCanActivate(guard) ?
3321
+ guard.canActivate(futureARS, futureRSS) :
3322
+ closestInjector.runInContext(() => guard(futureARS, futureRSS));
3308
3323
  return wrapIntoObservable(guardVal).pipe(first());
3309
3324
  });
3310
3325
  });
3311
3326
  return of(canActivateObservables).pipe(prioritizedGuardValue());
3312
3327
  }
3313
- function runCanActivateChild(futureRSS, path, moduleInjector) {
3328
+ function runCanActivateChild(futureRSS, path, injector) {
3314
3329
  const futureARS = path[path.length - 1];
3315
3330
  const canActivateChildGuards = path.slice(0, path.length - 1)
3316
3331
  .reverse()
@@ -3318,10 +3333,12 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3318
3333
  .filter(_ => _ !== null);
3319
3334
  const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
3320
3335
  return defer(() => {
3321
- const guardsMapped = d.guards.map((c) => {
3322
- const guard = getToken(c, d.node, moduleInjector);
3323
- const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) :
3324
- guard(futureARS, futureRSS);
3336
+ const guardsMapped = d.guards.map((canActivateChild) => {
3337
+ const closestInjector = getClosestRouteInjector(d.node) ?? injector;
3338
+ const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);
3339
+ const guardVal = isCanActivateChild(guard) ?
3340
+ guard.canActivateChild(futureARS, futureRSS) :
3341
+ closestInjector.runInContext(() => guard(futureARS, futureRSS));
3325
3342
  return wrapIntoObservable(guardVal).pipe(first());
3326
3343
  });
3327
3344
  return of(guardsMapped).pipe(prioritizedGuardValue());
@@ -3329,15 +3346,16 @@ function runCanActivateChild(futureRSS, path, moduleInjector) {
3329
3346
  });
3330
3347
  return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
3331
3348
  }
3332
- function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector) {
3349
+ function runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {
3333
3350
  const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
3334
3351
  if (!canDeactivate || canDeactivate.length === 0)
3335
3352
  return of(true);
3336
3353
  const canDeactivateObservables = canDeactivate.map((c) => {
3337
- const guard = getToken(c, currARS, moduleInjector);
3354
+ const closestInjector = getClosestRouteInjector(currARS) ?? injector;
3355
+ const guard = getTokenOrFunctionIdentity(c, closestInjector);
3338
3356
  const guardVal = isCanDeactivate(guard) ?
3339
3357
  guard.canDeactivate(component, currARS, currRSS, futureRSS) :
3340
- guard(component, currARS, currRSS, futureRSS);
3358
+ closestInjector.runInContext(() => guard(component, currARS, currRSS, futureRSS));
3341
3359
  return wrapIntoObservable(guardVal).pipe(first());
3342
3360
  });
3343
3361
  return of(canDeactivateObservables).pipe(prioritizedGuardValue());
@@ -3348,8 +3366,10 @@ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3348
3366
  return of(true);
3349
3367
  }
3350
3368
  const canLoadObservables = canLoad.map((injectionToken) => {
3351
- const guard = injector.get(injectionToken);
3352
- const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : guard(route, segments);
3369
+ const guard = getTokenOrFunctionIdentity(injectionToken, injector);
3370
+ const guardVal = isCanLoad(guard) ?
3371
+ guard.canLoad(route, segments) :
3372
+ injector.runInContext(() => guard(route, segments));
3353
3373
  return wrapIntoObservable(guardVal);
3354
3374
  });
3355
3375
  return of(canLoadObservables)
@@ -3367,8 +3387,10 @@ function runCanMatchGuards(injector, route, segments, urlSerializer) {
3367
3387
  if (!canMatch || canMatch.length === 0)
3368
3388
  return of(true);
3369
3389
  const canMatchObservables = canMatch.map(injectionToken => {
3370
- const guard = injector.get(injectionToken);
3371
- const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : guard(route, segments);
3390
+ const guard = getTokenOrFunctionIdentity(injectionToken, injector);
3391
+ const guardVal = isCanMatch(guard) ?
3392
+ guard.canMatch(route, segments) :
3393
+ injector.runInContext(() => guard(route, segments));
3372
3394
  return wrapIntoObservable(guardVal);
3373
3395
  });
3374
3396
  return of(canMatchObservables)
@@ -3537,7 +3559,7 @@ function noLeftoversInUrl(segmentGroup, segments, outlet) {
3537
3559
  * Use of this source code is governed by an MIT-style license that can be
3538
3560
  * found in the LICENSE file at https://angular.io/license
3539
3561
  */
3540
- const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || ngDevMode;
3562
+ const NG_DEV_MODE$6 = typeof ngDevMode === 'undefined' || ngDevMode;
3541
3563
  class NoMatch$1 {
3542
3564
  constructor(segmentGroup) {
3543
3565
  this.segmentGroup = segmentGroup || null;
@@ -3555,11 +3577,11 @@ function absoluteRedirect(newTree) {
3555
3577
  return throwError(new AbsoluteRedirect(newTree));
3556
3578
  }
3557
3579
  function namedOutletsRedirect(redirectTo) {
3558
- return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$5 &&
3580
+ return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, NG_DEV_MODE$6 &&
3559
3581
  `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));
3560
3582
  }
3561
3583
  function canLoadFails(route) {
3562
- return throwError(navigationCancelingError(NG_DEV_MODE$5 &&
3584
+ return throwError(navigationCancelingError(NG_DEV_MODE$6 &&
3563
3585
  `Cannot load children because the guard of the route "path: '${route.path}'" returned false`, 3 /* NavigationCancellationCode.GuardRejected */));
3564
3586
  }
3565
3587
  /**
@@ -3619,7 +3641,7 @@ class ApplyRedirects {
3619
3641
  }));
3620
3642
  }
3621
3643
  noMatchError(e) {
3622
- return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$5 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3644
+ return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, NG_DEV_MODE$6 && `Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
3623
3645
  }
3624
3646
  createUrlTree(rootCandidate, queryParams, fragment) {
3625
3647
  const root = createRoot(rootCandidate);
@@ -3669,7 +3691,7 @@ class ApplyRedirects {
3669
3691
  throw e;
3670
3692
  }));
3671
3693
  }), first((s) => !!s), catchError((e, _) => {
3672
- if (e instanceof EmptyError || e.name === 'EmptyError') {
3694
+ if (isEmptyError(e)) {
3673
3695
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3674
3696
  return of(new UrlSegmentGroup([], {}));
3675
3697
  }
@@ -3834,7 +3856,7 @@ class ApplyRedirects {
3834
3856
  findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3835
3857
  const pos = posParams[redirectToUrlSegment.path.substring(1)];
3836
3858
  if (!pos)
3837
- throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$5 &&
3859
+ throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, NG_DEV_MODE$6 &&
3838
3860
  `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3839
3861
  return pos;
3840
3862
  }
@@ -3870,7 +3892,7 @@ function applyRedirects(environmentInjector, configLoader, urlSerializer, config
3870
3892
  * Use of this source code is governed by an MIT-style license that can be
3871
3893
  * found in the LICENSE file at https://angular.io/license
3872
3894
  */
3873
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3895
+ const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
3874
3896
  class NoMatch {
3875
3897
  }
3876
3898
  function newObservableError(e) {
@@ -3959,7 +3981,7 @@ class Recognizer {
3959
3981
  // multiple activated results for the same outlet. We should merge the children of
3960
3982
  // these results so the final return value is only one `TreeNode` per outlet.
3961
3983
  const mergedChildren = mergeEmptyPathMatches(children);
3962
- if (NG_DEV_MODE$4) {
3984
+ if (NG_DEV_MODE$5) {
3963
3985
  // This should really never happen - we are only taking the first match for each
3964
3986
  // outlet and merge the empty path matches.
3965
3987
  checkOutletNameUniqueness(mergedChildren);
@@ -3972,7 +3994,7 @@ class Recognizer {
3972
3994
  return from(routes).pipe(concatMap(r => {
3973
3995
  return this.processSegmentAgainstRoute(r._injector ?? injector, r, segmentGroup, segments, outlet);
3974
3996
  }), first((x) => !!x), catchError(e => {
3975
- if (e instanceof EmptyError) {
3997
+ if (isEmptyError(e)) {
3976
3998
  if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3977
3999
  return of([]);
3978
4000
  }
@@ -3992,7 +4014,7 @@ class Recognizer {
3992
4014
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3993
4015
  // production bundle size. This value is intended only to surface a warning to users
3994
4016
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3995
- (NG_DEV_MODE$4 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
4017
+ (NG_DEV_MODE$5 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3996
4018
  pathIndexShift));
3997
4019
  matchResult = of({
3998
4020
  snapshot,
@@ -4008,7 +4030,7 @@ class Recognizer {
4008
4030
  return null;
4009
4031
  }
4010
4032
  const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
4011
- const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$4 ?
4033
+ const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route), (NG_DEV_MODE$5 ?
4012
4034
  getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
4013
4035
  pathIndexShift));
4014
4036
  return { snapshot, consumedSegments, remainingSegments };
@@ -4121,7 +4143,7 @@ function checkOutletNameUniqueness(nodes) {
4121
4143
  if (routeWithSameOutletName) {
4122
4144
  const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');
4123
4145
  const c = n.value.url.map(s => s.toString()).join('/');
4124
- 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}'.`);
4146
+ 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}'.`);
4125
4147
  }
4126
4148
  names[n.value.outlet] = n.value;
4127
4149
  });
@@ -4177,7 +4199,7 @@ function recognize(injector, rootComponentType, config, serializer, paramsInheri
4177
4199
  * Use of this source code is governed by an MIT-style license that can be
4178
4200
  * found in the LICENSE file at https://angular.io/license
4179
4201
  */
4180
- function resolveData(paramsInheritanceStrategy, moduleInjector) {
4202
+ function resolveData(paramsInheritanceStrategy, injector) {
4181
4203
  return mergeMap(t => {
4182
4204
  const { targetSnapshot, guards: { canActivateChecks } } = t;
4183
4205
  if (!canActivateChecks.length) {
@@ -4185,17 +4207,16 @@ function resolveData(paramsInheritanceStrategy, moduleInjector) {
4185
4207
  }
4186
4208
  let canActivateChecksResolved = 0;
4187
4209
  return from(canActivateChecks)
4188
- .pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, moduleInjector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
4210
+ .pipe(concatMap(check => runResolve(check.route, targetSnapshot, paramsInheritanceStrategy, injector)), tap(() => canActivateChecksResolved++), takeLast(1), mergeMap(_ => canActivateChecksResolved === canActivateChecks.length ? of(t) : EMPTY));
4189
4211
  });
4190
4212
  }
4191
- function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) {
4213
+ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {
4192
4214
  const config = futureARS.routeConfig;
4193
4215
  const resolve = futureARS._resolve;
4194
4216
  if (config?.title !== undefined && !hasStaticTitle(config)) {
4195
4217
  resolve[RouteTitleKey] = config.title;
4196
4218
  }
4197
- return resolveNode(resolve, futureARS, futureRSS, moduleInjector)
4198
- .pipe(map((resolvedData) => {
4219
+ return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map((resolvedData) => {
4199
4220
  futureARS._resolvedData = resolvedData;
4200
4221
  futureARS.data = inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve;
4201
4222
  if (config && hasStaticTitle(config)) {
@@ -4204,24 +4225,27 @@ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjec
4204
4225
  return null;
4205
4226
  }));
4206
4227
  }
4207
- function resolveNode(resolve, futureARS, futureRSS, moduleInjector) {
4228
+ function resolveNode(resolve, futureARS, futureRSS, injector) {
4208
4229
  const keys = getDataKeys(resolve);
4209
4230
  if (keys.length === 0) {
4210
4231
  return of({});
4211
4232
  }
4212
4233
  const data = {};
4213
- return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, moduleInjector)
4234
+ return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector)
4214
4235
  .pipe(first(), tap((value) => {
4215
4236
  data[key] = value;
4216
- }))), takeLast(1), mapTo(data), catchError((e) => e instanceof EmptyError ? EMPTY : throwError(e)));
4237
+ }))), takeLast(1), mapTo(data), catchError((e) => isEmptyError(e) ? EMPTY : throwError(e)));
4217
4238
  }
4218
4239
  function getDataKeys(obj) {
4219
4240
  return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];
4220
4241
  }
4221
- function getResolver(injectionToken, futureARS, futureRSS, moduleInjector) {
4222
- const resolver = getToken(injectionToken, futureARS, moduleInjector);
4223
- return resolver.resolve ? wrapIntoObservable(resolver.resolve(futureARS, futureRSS)) :
4224
- wrapIntoObservable(resolver(futureARS, futureRSS));
4242
+ function getResolver(injectionToken, futureARS, futureRSS, injector) {
4243
+ const closestInjector = getClosestRouteInjector(futureARS) ?? injector;
4244
+ const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);
4245
+ const resolverValue = resolver.resolve ?
4246
+ resolver.resolve(futureARS, futureRSS) :
4247
+ closestInjector.runInContext(() => resolver(futureARS, futureRSS));
4248
+ return wrapIntoObservable(resolverValue);
4225
4249
  }
4226
4250
  function hasStaticTitle(config) {
4227
4251
  return typeof config.title === 'string' || config.title === null;
@@ -4301,9 +4325,9 @@ class TitleStrategy {
4301
4325
  return snapshot.data[RouteTitleKey];
4302
4326
  }
4303
4327
  }
4304
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4305
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4306
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: TitleStrategy, decorators: [{
4328
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4329
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: TitleStrategy, decorators: [{
4307
4331
  type: Injectable,
4308
4332
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4309
4333
  }] });
@@ -4327,13 +4351,25 @@ class DefaultTitleStrategy extends TitleStrategy {
4327
4351
  }
4328
4352
  }
4329
4353
  }
4330
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4331
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4332
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4354
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4355
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4356
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4333
4357
  type: Injectable,
4334
4358
  args: [{ providedIn: 'root' }]
4335
4359
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
4336
4360
 
4361
+ /**
4362
+ * @license
4363
+ * Copyright Google LLC All Rights Reserved.
4364
+ *
4365
+ * Use of this source code is governed by an MIT-style license that can be
4366
+ * found in the LICENSE file at https://angular.io/license
4367
+ */
4368
+ /**
4369
+ * Exists to aid internal migration off of the deprecated relativeLinkResolution option.
4370
+ */
4371
+ function assignRelativeLinkResolution(router) { }
4372
+
4337
4373
  /**
4338
4374
  * @license
4339
4375
  * Copyright Google LLC All Rights Reserved.
@@ -4406,13 +4442,13 @@ class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4406
4442
  * Use of this source code is governed by an MIT-style license that can be
4407
4443
  * found in the LICENSE file at https://angular.io/license
4408
4444
  */
4409
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4445
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4410
4446
  /**
4411
4447
  * A [DI token](guide/glossary/#di-token) for the router service.
4412
4448
  *
4413
4449
  * @publicApi
4414
4450
  */
4415
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4451
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
4416
4452
  providedIn: 'root',
4417
4453
  factory: () => ({}),
4418
4454
  });
@@ -4424,7 +4460,7 @@ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config'
4424
4460
  * Use of this source code is governed by an MIT-style license that can be
4425
4461
  * found in the LICENSE file at https://angular.io/license
4426
4462
  */
4427
- const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4463
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4428
4464
  /**
4429
4465
  * The [DI token](guide/glossary/#di-token) for a router configuration.
4430
4466
  *
@@ -4458,7 +4494,7 @@ class RouterConfigLoader {
4458
4494
  if (this.onLoadEndListener) {
4459
4495
  this.onLoadEndListener(route);
4460
4496
  }
4461
- NG_DEV_MODE$2 && assertStandalone(route.path ?? '', component);
4497
+ NG_DEV_MODE$3 && assertStandalone(route.path ?? '', component);
4462
4498
  route._loadedComponent = component;
4463
4499
  }), finalize(() => {
4464
4500
  this.componentLoaders.delete(route);
@@ -4501,7 +4537,7 @@ class RouterConfigLoader {
4501
4537
  rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4502
4538
  }
4503
4539
  const routes = rawRoutes.map(standardizeConfig);
4504
- NG_DEV_MODE$2 && validateConfig(routes, route.path, requireStandaloneComponents);
4540
+ NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
4505
4541
  return { routes, injector };
4506
4542
  }), finalize(() => {
4507
4543
  this.childrenLoaders.delete(route);
@@ -4523,9 +4559,9 @@ class RouterConfigLoader {
4523
4559
  }));
4524
4560
  }
4525
4561
  }
4526
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4527
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4528
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4562
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4563
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4564
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4529
4565
  type: Injectable,
4530
4566
  args: [{ providedIn: 'root' }]
4531
4567
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
@@ -4568,7 +4604,7 @@ class DefaultUrlHandlingStrategy {
4568
4604
  * Use of this source code is governed by an MIT-style license that can be
4569
4605
  * found in the LICENSE file at https://angular.io/license
4570
4606
  */
4571
- const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4607
+ const NG_DEV_MODE$2 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4572
4608
  function defaultErrorHandler(error) {
4573
4609
  throw error;
4574
4610
  }
@@ -4639,6 +4675,7 @@ function setupRouter() {
4639
4675
  }
4640
4676
  router.titleStrategy = titleStrategy ?? defaultTitleStrategy;
4641
4677
  assignExtraOptionsToRouter(opts, router);
4678
+ assignRelativeLinkResolution(router);
4642
4679
  return router;
4643
4680
  }
4644
4681
  /**
@@ -4972,7 +5009,7 @@ class Router {
4972
5009
  complete: () => {
4973
5010
  if (!dataResolved) {
4974
5011
  this.restoreHistory(t);
4975
- this.cancelNavigationTransition(t, NG_DEV_MODE$1 ?
5012
+ this.cancelNavigationTransition(t, NG_DEV_MODE$2 ?
4976
5013
  `At least one route resolver didn't emit any value.` :
4977
5014
  '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4978
5015
  }
@@ -5039,7 +5076,7 @@ class Router {
5039
5076
  * catch-all to make sure the NavigationCancel event is fired when a
5040
5077
  * navigation gets cancelled but not caught by other means. */
5041
5078
  if (!completed && !errored) {
5042
- const cancelationReason = NG_DEV_MODE$1 ?
5079
+ const cancelationReason = NG_DEV_MODE$2 ?
5043
5080
  `Navigation ID ${overallTransitionState
5044
5081
  .id} is not equal to the current navigation id ${this.navigationId}` :
5045
5082
  '';
@@ -5197,7 +5234,7 @@ class Router {
5197
5234
  * ```
5198
5235
  */
5199
5236
  resetConfig(config) {
5200
- NG_DEV_MODE$1 && validateConfig(config);
5237
+ NG_DEV_MODE$2 && validateConfig(config);
5201
5238
  this.config = config.map(standardizeConfig);
5202
5239
  this.navigated = false;
5203
5240
  this.lastSuccessfulId = -1;
@@ -5552,9 +5589,9 @@ class Router {
5552
5589
  return { navigationId };
5553
5590
  }
5554
5591
  }
5555
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5556
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5557
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: Router, decorators: [{
5592
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5593
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5594
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: Router, decorators: [{
5558
5595
  type: Injectable,
5559
5596
  args: [{
5560
5597
  providedIn: 'root',
@@ -5565,7 +5602,7 @@ function validateCommands(commands) {
5565
5602
  for (let i = 0; i < commands.length; i++) {
5566
5603
  const cmd = commands[i];
5567
5604
  if (cmd == null) {
5568
- throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$1 && `The requested path contains ${cmd} segment at index ${i}`);
5605
+ throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, NG_DEV_MODE$2 && `The requested path contains ${cmd} segment at index ${i}`);
5569
5606
  }
5570
5607
  }
5571
5608
  }
@@ -5684,11 +5721,50 @@ class RouterLink {
5684
5721
  this.tabIndexAttribute = tabIndexAttribute;
5685
5722
  this.renderer = renderer;
5686
5723
  this.el = el;
5724
+ this._preserveFragment = false;
5725
+ this._skipLocationChange = false;
5726
+ this._replaceUrl = false;
5687
5727
  this.commands = null;
5688
5728
  /** @internal */
5689
5729
  this.onChanges = new Subject();
5690
5730
  this.setTabIndexIfNotOnNativeEl('0');
5691
5731
  }
5732
+ /**
5733
+ * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
5734
+ * `UrlCreationOptions`.
5735
+ * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
5736
+ * @see {@link Router#createUrlTree Router#createUrlTree}
5737
+ */
5738
+ set preserveFragment(preserveFragment) {
5739
+ this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
5740
+ }
5741
+ get preserveFragment() {
5742
+ return this._preserveFragment;
5743
+ }
5744
+ /**
5745
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5746
+ * `NavigationBehaviorOptions`.
5747
+ * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
5748
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5749
+ */
5750
+ set skipLocationChange(skipLocationChange) {
5751
+ this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
5752
+ }
5753
+ get skipLocationChange() {
5754
+ return this._skipLocationChange;
5755
+ }
5756
+ /**
5757
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5758
+ * `NavigationBehaviorOptions`.
5759
+ * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
5760
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5761
+ */
5762
+ set replaceUrl(replaceUrl) {
5763
+ this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
5764
+ }
5765
+ get replaceUrl() {
5766
+ return this._replaceUrl;
5767
+ }
5692
5768
  /**
5693
5769
  * Modifies the tab index if there was not a tabindex attribute on the element during
5694
5770
  * instantiation.
@@ -5735,8 +5811,8 @@ class RouterLink {
5735
5811
  return true;
5736
5812
  }
5737
5813
  const extras = {
5738
- skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
5739
- replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
5814
+ skipLocationChange: this.skipLocationChange,
5815
+ replaceUrl: this.replaceUrl,
5740
5816
  state: this.state,
5741
5817
  };
5742
5818
  this.router.navigateByUrl(this.urlTree, extras);
@@ -5753,13 +5829,13 @@ class RouterLink {
5753
5829
  queryParams: this.queryParams,
5754
5830
  fragment: this.fragment,
5755
5831
  queryParamsHandling: this.queryParamsHandling,
5756
- preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
5832
+ preserveFragment: this.preserveFragment,
5757
5833
  });
5758
5834
  }
5759
5835
  }
5760
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5761
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLink, isStandalone: true, 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 });
5762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLink, decorators: [{
5836
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5837
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterLink, isStandalone: true, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5838
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLink, decorators: [{
5763
5839
  type: Directive,
5764
5840
  args: [{
5765
5841
  selector: ':not(a):not(area)[routerLink]',
@@ -5774,16 +5850,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
5774
5850
  type: Input
5775
5851
  }], queryParamsHandling: [{
5776
5852
  type: Input
5853
+ }], state: [{
5854
+ type: Input
5855
+ }], relativeTo: [{
5856
+ type: Input
5777
5857
  }], preserveFragment: [{
5778
5858
  type: Input
5779
5859
  }], skipLocationChange: [{
5780
5860
  type: Input
5781
5861
  }], replaceUrl: [{
5782
5862
  type: Input
5783
- }], state: [{
5784
- type: Input
5785
- }], relativeTo: [{
5786
- type: Input
5787
5863
  }], routerLink: [{
5788
5864
  type: Input
5789
5865
  }], onClick: [{
@@ -5806,6 +5882,9 @@ class RouterLinkWithHref {
5806
5882
  this.router = router;
5807
5883
  this.route = route;
5808
5884
  this.locationStrategy = locationStrategy;
5885
+ this._preserveFragment = false;
5886
+ this._skipLocationChange = false;
5887
+ this._replaceUrl = false;
5809
5888
  this.commands = null;
5810
5889
  // the url displayed on the anchor element.
5811
5890
  // @HostBinding('attr.href') is used rather than @HostBinding() because it removes the
@@ -5819,6 +5898,42 @@ class RouterLinkWithHref {
5819
5898
  }
5820
5899
  });
5821
5900
  }
5901
+ /**
5902
+ * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the
5903
+ * `UrlCreationOptions`.
5904
+ * @see {@link UrlCreationOptions#preserveFragment UrlCreationOptions#preserveFragment}
5905
+ * @see {@link Router#createUrlTree Router#createUrlTree}
5906
+ */
5907
+ set preserveFragment(preserveFragment) {
5908
+ this._preserveFragment = ɵcoerceToBoolean(preserveFragment);
5909
+ }
5910
+ get preserveFragment() {
5911
+ return this._preserveFragment;
5912
+ }
5913
+ /**
5914
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5915
+ * `NavigationBehaviorOptions`.
5916
+ * @see {@link NavigationBehaviorOptions#skipLocationChange NavigationBehaviorOptions#skipLocationChange}
5917
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5918
+ */
5919
+ set skipLocationChange(skipLocationChange) {
5920
+ this._skipLocationChange = ɵcoerceToBoolean(skipLocationChange);
5921
+ }
5922
+ get skipLocationChange() {
5923
+ return this._skipLocationChange;
5924
+ }
5925
+ /**
5926
+ * Passed to {@link Router#navigateByUrl Router#navigateByUrl} as part of the
5927
+ * `NavigationBehaviorOptions`.
5928
+ * @see {@link NavigationBehaviorOptions#replaceUrl NavigationBehaviorOptions#replaceUrl}
5929
+ * @see {@link Router#navigateByUrl Router#navigateByUrl}
5930
+ */
5931
+ set replaceUrl(replaceUrl) {
5932
+ this._replaceUrl = ɵcoerceToBoolean(replaceUrl);
5933
+ }
5934
+ get replaceUrl() {
5935
+ return this._replaceUrl;
5936
+ }
5822
5937
  /**
5823
5938
  * Commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
5824
5939
  * - **array**: commands to pass to {@link Router#createUrlTree Router#createUrlTree}.
@@ -5852,8 +5967,8 @@ class RouterLinkWithHref {
5852
5967
  return true;
5853
5968
  }
5854
5969
  const extras = {
5855
- skipLocationChange: ɵcoerceToBoolean(this.skipLocationChange),
5856
- replaceUrl: ɵcoerceToBoolean(this.replaceUrl),
5970
+ skipLocationChange: this.skipLocationChange,
5971
+ replaceUrl: this.replaceUrl,
5857
5972
  state: this.state
5858
5973
  };
5859
5974
  this.router.navigateByUrl(this.urlTree, extras);
@@ -5875,13 +5990,13 @@ class RouterLinkWithHref {
5875
5990
  queryParams: this.queryParams,
5876
5991
  fragment: this.fragment,
5877
5992
  queryParamsHandling: this.queryParamsHandling,
5878
- preserveFragment: ɵcoerceToBoolean(this.preserveFragment),
5993
+ preserveFragment: this.preserveFragment,
5879
5994
  });
5880
5995
  }
5881
5996
  }
5882
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5883
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0-next.0", type: RouterLinkWithHref, isStandalone: true, 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 });
5884
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5997
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5998
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterLinkWithHref, isStandalone: true, selector: "a[routerLink],area[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", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5999
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5885
6000
  type: Directive,
5886
6001
  args: [{ selector: 'a[routerLink],area[routerLink]', standalone: true }]
5887
6002
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5895,12 +6010,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
5895
6010
  type: Input
5896
6011
  }], queryParamsHandling: [{
5897
6012
  type: Input
5898
- }], preserveFragment: [{
5899
- type: Input
5900
- }], skipLocationChange: [{
5901
- type: Input
5902
- }], replaceUrl: [{
5903
- type: Input
5904
6013
  }], state: [{
5905
6014
  type: Input
5906
6015
  }], relativeTo: [{
@@ -5908,6 +6017,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
5908
6017
  }], href: [{
5909
6018
  type: HostBinding,
5910
6019
  args: ['attr.href']
6020
+ }], preserveFragment: [{
6021
+ type: Input
6022
+ }], skipLocationChange: [{
6023
+ type: Input
6024
+ }], replaceUrl: [{
6025
+ type: Input
5911
6026
  }], routerLink: [{
5912
6027
  type: Input
5913
6028
  }], onClick: [{
@@ -6106,9 +6221,9 @@ class RouterLinkActive {
6106
6221
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
6107
6222
  }
6108
6223
  }
6109
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.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 });
6110
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.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 }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6224
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.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 });
6225
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.2.0", type: RouterLinkActive, isStandalone: true, 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 });
6226
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterLinkActive, decorators: [{
6112
6227
  type: Directive,
6113
6228
  args: [{
6114
6229
  selector: '[routerLinkActive]',
@@ -6173,9 +6288,9 @@ class PreloadAllModules {
6173
6288
  return fn().pipe(catchError(() => of(null)));
6174
6289
  }
6175
6290
  }
6176
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6177
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6178
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6291
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6292
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6293
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: PreloadAllModules, decorators: [{
6179
6294
  type: Injectable,
6180
6295
  args: [{ providedIn: 'root' }]
6181
6296
  }] });
@@ -6193,9 +6308,9 @@ class NoPreloading {
6193
6308
  return of(null);
6194
6309
  }
6195
6310
  }
6196
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6197
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6198
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: NoPreloading, decorators: [{
6311
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6312
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6313
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: NoPreloading, decorators: [{
6199
6314
  type: Injectable,
6200
6315
  args: [{ providedIn: 'root' }]
6201
6316
  }] });
@@ -6289,10 +6404,11 @@ class RouterPreloader {
6289
6404
  });
6290
6405
  }
6291
6406
  }
6292
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6293
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader });
6294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterPreloader, decorators: [{
6295
- type: Injectable
6407
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6408
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6409
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterPreloader, decorators: [{
6410
+ type: Injectable,
6411
+ args: [{ providedIn: 'root' }]
6296
6412
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6297
6413
 
6298
6414
  /**
@@ -6378,12 +6494,421 @@ class RouterScroller {
6378
6494
  }
6379
6495
  }
6380
6496
  }
6381
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6382
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller });
6383
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterScroller, decorators: [{
6497
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6498
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterScroller });
6499
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterScroller, decorators: [{
6384
6500
  type: Injectable
6385
6501
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6386
6502
 
6503
+ /**
6504
+ * @license
6505
+ * Copyright Google LLC All Rights Reserved.
6506
+ *
6507
+ * Use of this source code is governed by an MIT-style license that can be
6508
+ * found in the LICENSE file at https://angular.io/license
6509
+ */
6510
+ const NG_DEV_MODE$1 = typeof ngDevMode === 'undefined' || ngDevMode;
6511
+ /**
6512
+ * Sets up providers necessary to enable `Router` functionality for the application.
6513
+ * Allows to configure a set of routes as well as extra features that should be enabled.
6514
+ *
6515
+ * @usageNotes
6516
+ *
6517
+ * Basic example of how you can add a Router to your application:
6518
+ * ```
6519
+ * const appRoutes: Routes = [];
6520
+ * bootstrapApplication(AppComponent, {
6521
+ * providers: [provideRouter(appRoutes)]
6522
+ * });
6523
+ * ```
6524
+ *
6525
+ * You can also enable optional features in the Router by adding functions from the `RouterFeatures`
6526
+ * type:
6527
+ * ```
6528
+ * const appRoutes: Routes = [];
6529
+ * bootstrapApplication(AppComponent,
6530
+ * {
6531
+ * providers: [
6532
+ * provideRouter(appRoutes,
6533
+ * withDebugTracing(),
6534
+ * withRouterConfig({paramsInheritanceStrategy: 'always'}))
6535
+ * ]
6536
+ * }
6537
+ * );
6538
+ * ```
6539
+ *
6540
+ * @see `RouterFeatures`
6541
+ *
6542
+ * @publicApi
6543
+ * @developerPreview
6544
+ * @param routes A set of `Route`s to use for the application routing table.
6545
+ * @param features Optional features to configure additional router behaviors.
6546
+ * @returns A set of providers to setup a Router.
6547
+ */
6548
+ function provideRouter(routes, ...features) {
6549
+ return [
6550
+ provideRoutes(routes), { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6551
+ { provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
6552
+ features.map(feature => feature.ɵproviders),
6553
+ // TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
6554
+ // how we want them to be configured. This API doesn't currently have a way to configure them
6555
+ // and we should decide what the _best_ way to do that is rather than just sticking with the
6556
+ // status quo of how it's done today.
6557
+ ];
6558
+ }
6559
+ function rootRoute(router) {
6560
+ return router.routerState.root;
6561
+ }
6562
+ /**
6563
+ * Helper function to create an object that represents a Router feature.
6564
+ */
6565
+ function routerFeature(kind, providers) {
6566
+ return { ɵkind: kind, ɵproviders: providers };
6567
+ }
6568
+ /**
6569
+ * Registers a [DI provider](guide/glossary#provider) for a set of routes.
6570
+ * @param routes The route configuration to provide.
6571
+ *
6572
+ * @usageNotes
6573
+ *
6574
+ * ```
6575
+ * @NgModule({
6576
+ * providers: [provideRoutes(ROUTES)]
6577
+ * })
6578
+ * class LazyLoadedChildModule {}
6579
+ * ```
6580
+ *
6581
+ * @publicApi
6582
+ */
6583
+ function provideRoutes(routes) {
6584
+ return [
6585
+ { provide: ROUTES, multi: true, useValue: routes },
6586
+ ];
6587
+ }
6588
+ /**
6589
+ * Enables customizable scrolling behavior for router navigations.
6590
+ *
6591
+ * @usageNotes
6592
+ *
6593
+ * Basic example of how you can enable scrolling feature:
6594
+ * ```
6595
+ * const appRoutes: Routes = [];
6596
+ * bootstrapApplication(AppComponent,
6597
+ * {
6598
+ * providers: [
6599
+ * provideRouter(appRoutes, withInMemoryScrolling())
6600
+ * ]
6601
+ * }
6602
+ * );
6603
+ * ```
6604
+ *
6605
+ * @see `provideRouter`
6606
+ * @see `ViewportScroller`
6607
+ *
6608
+ * @publicApi
6609
+ * @developerPreview
6610
+ * @param options Set of configuration parameters to customize scrolling behavior, see
6611
+ * `InMemoryScrollingOptions` for additional information.
6612
+ * @returns A set of providers for use with `provideRouter`.
6613
+ */
6614
+ function withInMemoryScrolling(options = {}) {
6615
+ const providers = [{
6616
+ provide: ROUTER_SCROLLER,
6617
+ useFactory: () => {
6618
+ const router = inject(Router);
6619
+ const viewportScroller = inject(ViewportScroller);
6620
+ return new RouterScroller(router, viewportScroller, options);
6621
+ },
6622
+ }];
6623
+ return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
6624
+ }
6625
+ function getBootstrapListener() {
6626
+ const injector = inject(Injector);
6627
+ return (bootstrappedComponentRef) => {
6628
+ const ref = injector.get(ApplicationRef);
6629
+ if (bootstrappedComponentRef !== ref.components[0]) {
6630
+ return;
6631
+ }
6632
+ const router = injector.get(Router);
6633
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6634
+ if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6635
+ router.initialNavigation();
6636
+ }
6637
+ injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
6638
+ injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
6639
+ router.resetRootComponentType(ref.componentTypes[0]);
6640
+ bootstrapDone.next();
6641
+ bootstrapDone.complete();
6642
+ };
6643
+ }
6644
+ /**
6645
+ * A subject used to indicate that the bootstrapping phase is done. When initial navigation is
6646
+ * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6647
+ * to the activation phase.
6648
+ */
6649
+ const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE$1 ? 'bootstrap done indicator' : '', {
6650
+ factory: () => {
6651
+ return new Subject();
6652
+ }
6653
+ });
6654
+ const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE$1 ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6655
+ /**
6656
+ * Configures initial navigation to start before the root component is created.
6657
+ *
6658
+ * The bootstrap is blocked until the initial navigation is complete. This value is required for
6659
+ * [server-side rendering](guide/universal) to work.
6660
+ *
6661
+ * @usageNotes
6662
+ *
6663
+ * Basic example of how you can enable this navigation behavior:
6664
+ * ```
6665
+ * const appRoutes: Routes = [];
6666
+ * bootstrapApplication(AppComponent,
6667
+ * {
6668
+ * providers: [
6669
+ * provideRouter(appRoutes, withEnabledBlockingInitialNavigation())
6670
+ * ]
6671
+ * }
6672
+ * );
6673
+ * ```
6674
+ *
6675
+ * @see `provideRouter`
6676
+ *
6677
+ * @publicApi
6678
+ * @developerPreview
6679
+ * @returns A set of providers for use with `provideRouter`.
6680
+ */
6681
+ function withEnabledBlockingInitialNavigation() {
6682
+ const providers = [
6683
+ { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6684
+ {
6685
+ provide: APP_INITIALIZER,
6686
+ multi: true,
6687
+ deps: [Injector],
6688
+ useFactory: (injector) => {
6689
+ const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6690
+ let initNavigation = false;
6691
+ /**
6692
+ * Performs the given action once the router finishes its next/current navigation.
6693
+ *
6694
+ * If the navigation is canceled or errors without a redirect, the navigation is considered
6695
+ * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6696
+ */
6697
+ function afterNextNavigation(action) {
6698
+ const router = injector.get(Router);
6699
+ router.events
6700
+ .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6701
+ e instanceof NavigationError), map(e => {
6702
+ if (e instanceof NavigationEnd) {
6703
+ // Navigation assumed to succeed if we get `ActivationStart`
6704
+ return true;
6705
+ }
6706
+ const redirecting = e instanceof NavigationCancel ?
6707
+ (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6708
+ e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6709
+ false;
6710
+ return redirecting ? null : false;
6711
+ }), filter((result) => result !== null), take(1))
6712
+ .subscribe(() => {
6713
+ action();
6714
+ });
6715
+ }
6716
+ return () => {
6717
+ return locationInitialized.then(() => {
6718
+ return new Promise(resolve => {
6719
+ const router = injector.get(Router);
6720
+ const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6721
+ afterNextNavigation(() => {
6722
+ // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6723
+ // without a redirect.
6724
+ resolve(true);
6725
+ initNavigation = true;
6726
+ });
6727
+ router.afterPreactivation = () => {
6728
+ // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6729
+ // assume activation will complete successfully (even though this is not
6730
+ // guaranteed).
6731
+ resolve(true);
6732
+ // only the initial navigation should be delayed until bootstrapping is done.
6733
+ if (!initNavigation) {
6734
+ return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6735
+ // subsequent navigations should not be delayed
6736
+ }
6737
+ else {
6738
+ return of(void 0);
6739
+ }
6740
+ };
6741
+ router.initialNavigation();
6742
+ });
6743
+ });
6744
+ };
6745
+ }
6746
+ },
6747
+ ];
6748
+ return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);
6749
+ }
6750
+ /**
6751
+ * Disables initial navigation.
6752
+ *
6753
+ * Use if there is a reason to have more control over when the router starts its initial navigation
6754
+ * due to some complex initialization logic.
6755
+ *
6756
+ * @usageNotes
6757
+ *
6758
+ * Basic example of how you can disable initial navigation:
6759
+ * ```
6760
+ * const appRoutes: Routes = [];
6761
+ * bootstrapApplication(AppComponent,
6762
+ * {
6763
+ * providers: [
6764
+ * provideRouter(appRoutes, withDisabledInitialNavigation())
6765
+ * ]
6766
+ * }
6767
+ * );
6768
+ * ```
6769
+ *
6770
+ * @see `provideRouter`
6771
+ *
6772
+ * @returns A set of providers for use with `provideRouter`.
6773
+ *
6774
+ * @publicApi
6775
+ * @developerPreview
6776
+ */
6777
+ function withDisabledInitialNavigation() {
6778
+ const providers = [
6779
+ {
6780
+ provide: APP_INITIALIZER,
6781
+ multi: true,
6782
+ useFactory: () => {
6783
+ const router = inject(Router);
6784
+ return () => {
6785
+ router.setUpLocationChangeListener();
6786
+ };
6787
+ }
6788
+ },
6789
+ { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6790
+ ];
6791
+ return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);
6792
+ }
6793
+ /**
6794
+ * Enables logging of all internal navigation events to the console.
6795
+ * Extra logging might be useful for debugging purposes to inspect Router event sequence.
6796
+ *
6797
+ * @usageNotes
6798
+ *
6799
+ * Basic example of how you can enable debug tracing:
6800
+ * ```
6801
+ * const appRoutes: Routes = [];
6802
+ * bootstrapApplication(AppComponent,
6803
+ * {
6804
+ * providers: [
6805
+ * provideRouter(appRoutes, withDebugTracing())
6806
+ * ]
6807
+ * }
6808
+ * );
6809
+ * ```
6810
+ *
6811
+ * @see `provideRouter`
6812
+ *
6813
+ * @returns A set of providers for use with `provideRouter`.
6814
+ *
6815
+ * @publicApi
6816
+ * @developerPreview
6817
+ */
6818
+ function withDebugTracing() {
6819
+ let providers = [];
6820
+ if (NG_DEV_MODE$1) {
6821
+ providers = [{
6822
+ provide: ENVIRONMENT_INITIALIZER,
6823
+ multi: true,
6824
+ useFactory: () => {
6825
+ const router = inject(Router);
6826
+ return () => router.events.subscribe((e) => {
6827
+ // tslint:disable:no-console
6828
+ console.group?.(`Router Event: ${e.constructor.name}`);
6829
+ console.log(stringifyEvent(e));
6830
+ console.log(e);
6831
+ console.groupEnd?.();
6832
+ // tslint:enable:no-console
6833
+ });
6834
+ }
6835
+ }];
6836
+ }
6837
+ else {
6838
+ providers = [];
6839
+ }
6840
+ return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);
6841
+ }
6842
+ const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE$1 ? 'router preloader' : '');
6843
+ /**
6844
+ * Allows to configure a preloading strategy to use. The strategy is configured by providing a
6845
+ * reference to a class that implements a `PreloadingStrategy`.
6846
+ *
6847
+ * @usageNotes
6848
+ *
6849
+ * Basic example of how you can configure preloading:
6850
+ * ```
6851
+ * const appRoutes: Routes = [];
6852
+ * bootstrapApplication(AppComponent,
6853
+ * {
6854
+ * providers: [
6855
+ * provideRouter(appRoutes, withPreloading(PreloadAllModules))
6856
+ * ]
6857
+ * }
6858
+ * );
6859
+ * ```
6860
+ *
6861
+ * @see `provideRouter`
6862
+ *
6863
+ * @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that
6864
+ * should be used.
6865
+ * @returns A set of providers for use with `provideRouter`.
6866
+ *
6867
+ * @publicApi
6868
+ * @developerPreview
6869
+ */
6870
+ function withPreloading(preloadingStrategy) {
6871
+ const providers = [
6872
+ { provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
6873
+ { provide: PreloadingStrategy, useExisting: preloadingStrategy },
6874
+ ];
6875
+ return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);
6876
+ }
6877
+ /**
6878
+ * Allows to provide extra parameters to configure Router.
6879
+ *
6880
+ * @usageNotes
6881
+ *
6882
+ * Basic example of how you can provide extra configuration options:
6883
+ * ```
6884
+ * const appRoutes: Routes = [];
6885
+ * bootstrapApplication(AppComponent,
6886
+ * {
6887
+ * providers: [
6888
+ * provideRouter(appRoutes, withRouterConfig({
6889
+ * onSameUrlNavigation: 'reload'
6890
+ * }))
6891
+ * ]
6892
+ * }
6893
+ * );
6894
+ * ```
6895
+ *
6896
+ * @see `provideRouter`
6897
+ *
6898
+ * @param options A set of parameters to configure Router, see `RouterConfigOptions` for
6899
+ * additional information.
6900
+ * @returns A set of providers for use with `provideRouter`.
6901
+ *
6902
+ * @publicApi
6903
+ * @developerPreview
6904
+ */
6905
+ function withRouterConfig(options) {
6906
+ const providers = [
6907
+ { provide: ROUTER_CONFIGURATION, useValue: options },
6908
+ ];
6909
+ return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);
6910
+ }
6911
+
6387
6912
  /**
6388
6913
  * @license
6389
6914
  * Copyright Google LLC All Rights Reserved.
@@ -6400,7 +6925,6 @@ const ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterL
6400
6925
  * @docsNotRequired
6401
6926
  */
6402
6927
  const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');
6403
- const ROUTER_PRELOADER = new InjectionToken(NG_DEV_MODE ? 'router preloader' : '');
6404
6928
  // TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept
6405
6929
  // here to avoid a breaking change whereby the provider order matters based on where the
6406
6930
  // `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a "breaking"
@@ -6413,9 +6937,6 @@ const ROUTER_PROVIDERS = [
6413
6937
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6414
6938
  RouterConfigLoader,
6415
6939
  ];
6416
- function rootRoute(router) {
6417
- return router.routerState.root;
6418
- }
6419
6940
  function routerNgProbeToken() {
6420
6941
  return new NgProbeToken('Router', Router);
6421
6942
  }
@@ -6465,7 +6986,7 @@ class RouterModule {
6465
6986
  ngModule: RouterModule,
6466
6987
  providers: [
6467
6988
  ROUTER_PROVIDERS,
6468
- NG_DEV_MODE ? (config?.enableTracing ? provideTracing() : []) : [],
6989
+ NG_DEV_MODE ? (config?.enableTracing ? withDebugTracing().ɵproviders : []) : [],
6469
6990
  provideRoutes(routes),
6470
6991
  {
6471
6992
  provide: ROUTER_FORROOT_GUARD,
@@ -6475,7 +6996,7 @@ class RouterModule {
6475
6996
  { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
6476
6997
  config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(),
6477
6998
  provideRouterScroller(),
6478
- config?.preloadingStrategy ? providePreloading(config.preloadingStrategy) : [],
6999
+ config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).ɵproviders : [],
6479
7000
  { provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken },
6480
7001
  config?.initialNavigation ? provideInitialNavigation(config) : [],
6481
7002
  provideRouterInitializer(),
@@ -6502,10 +7023,10 @@ class RouterModule {
6502
7023
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6503
7024
  }
6504
7025
  }
6505
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6506
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6507
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6508
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0", ngImport: i0, type: RouterModule, decorators: [{
7026
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7027
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
7028
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7029
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: RouterModule, decorators: [{
6509
7030
  type: NgModule,
6510
7031
  args: [{
6511
7032
  imports: ROUTER_DIRECTIVES,
@@ -6517,6 +7038,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0-next.0",
6517
7038
  type: Inject,
6518
7039
  args: [ROUTER_FORROOT_GUARD]
6519
7040
  }] }]; } });
7041
+ /**
7042
+ * For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`
7043
+ * because it reads from the `ExtraOptions` which should not be used in the standalone world.
7044
+ */
6520
7045
  function provideRouterScroller() {
6521
7046
  return {
6522
7047
  provide: ROUTER_SCROLLER,
@@ -6531,58 +7056,33 @@ function provideRouterScroller() {
6531
7056
  },
6532
7057
  };
6533
7058
  }
7059
+ // Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should
7060
+ // provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.
6534
7061
  function provideHashLocationStrategy() {
6535
7062
  return { provide: LocationStrategy, useClass: HashLocationStrategy };
6536
7063
  }
7064
+ // Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not
7065
+ // need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.
6537
7066
  function providePathLocationStrategy() {
6538
7067
  return { provide: LocationStrategy, useClass: PathLocationStrategy };
6539
7068
  }
6540
7069
  function provideForRootGuard(router) {
6541
7070
  if (NG_DEV_MODE && router) {
6542
- throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.`);
7071
+ throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector.` +
7072
+ ` Lazy loaded modules should use RouterModule.forChild() instead.`);
6543
7073
  }
6544
7074
  return 'guarded';
6545
7075
  }
6546
- /**
6547
- * Registers a [DI provider](guide/glossary#provider) for a set of routes.
6548
- * @param routes The route configuration to provide.
6549
- *
6550
- * @usageNotes
6551
- *
6552
- * ```
6553
- * @NgModule({
6554
- * imports: [RouterModule.forChild(ROUTES)],
6555
- * providers: [provideRoutes(EXTRA_ROUTES)]
6556
- * })
6557
- * class MyNgModule {}
6558
- * ```
6559
- *
6560
- * @publicApi
6561
- */
6562
- function provideRoutes(routes) {
7076
+ // Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`
7077
+ // users call `withXInitialNavigation` directly.
7078
+ function provideInitialNavigation(config) {
6563
7079
  return [
6564
- { provide: ROUTES, multi: true, useValue: routes },
7080
+ config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [],
7081
+ config.initialNavigation === 'enabledBlocking' ?
7082
+ withEnabledBlockingInitialNavigation().ɵproviders :
7083
+ [],
6565
7084
  ];
6566
7085
  }
6567
- function getBootstrapListener() {
6568
- const injector = inject(Injector);
6569
- return (bootstrappedComponentRef) => {
6570
- const ref = injector.get(ApplicationRef);
6571
- if (bootstrappedComponentRef !== ref.components[0]) {
6572
- return;
6573
- }
6574
- const router = injector.get(Router);
6575
- const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6576
- if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {
6577
- router.initialNavigation();
6578
- }
6579
- injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();
6580
- injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();
6581
- router.resetRootComponentType(ref.componentTypes[0]);
6582
- bootstrapDone.next();
6583
- bootstrapDone.complete();
6584
- };
6585
- }
6586
7086
  // TODO(atscott): This should not be in the public API
6587
7087
  /**
6588
7088
  * A [DI token](guide/glossary/#di-token) for the router initializer that
@@ -6591,12 +7091,6 @@ function getBootstrapListener() {
6591
7091
  * @publicApi
6592
7092
  */
6593
7093
  const ROUTER_INITIALIZER = new InjectionToken(NG_DEV_MODE ? 'Router Initializer' : '');
6594
- function provideInitialNavigation(config) {
6595
- return [
6596
- config.initialNavigation === 'disabled' ? provideDisabledInitialNavigation() : [],
6597
- config.initialNavigation === 'enabledBlocking' ? provideEnabledBlockingInitialNavigation() : [],
6598
- ];
6599
- }
6600
7094
  function provideRouterInitializer() {
6601
7095
  return [
6602
7096
  // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just
@@ -6605,129 +7099,6 @@ function provideRouterInitializer() {
6605
7099
  { provide: APP_BOOTSTRAP_LISTENER, multi: true, useExisting: ROUTER_INITIALIZER },
6606
7100
  ];
6607
7101
  }
6608
- /**
6609
- * A subject used to indicate that the bootstrapping phase is done. When initial navigation is
6610
- * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing
6611
- * to the activation phase.
6612
- */
6613
- const BOOTSTRAP_DONE = new InjectionToken(NG_DEV_MODE ? 'bootstrap done indicator' : '', {
6614
- factory: () => {
6615
- return new Subject();
6616
- }
6617
- });
6618
- function provideEnabledBlockingInitialNavigation() {
6619
- return [
6620
- { provide: INITIAL_NAVIGATION, useValue: 0 /* InitialNavigation.EnabledBlocking */ },
6621
- {
6622
- provide: APP_INITIALIZER,
6623
- multi: true,
6624
- deps: [Injector],
6625
- useFactory: (injector) => {
6626
- const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve(null));
6627
- let initNavigation = false;
6628
- /**
6629
- * Performs the given action once the router finishes its next/current navigation.
6630
- *
6631
- * If the navigation is canceled or errors without a redirect, the navigation is considered
6632
- * complete. If the `NavigationEnd` event emits, the navigation is also considered complete.
6633
- */
6634
- function afterNextNavigation(action) {
6635
- const router = injector.get(Router);
6636
- router.events
6637
- .pipe(filter((e) => e instanceof NavigationEnd || e instanceof NavigationCancel ||
6638
- e instanceof NavigationError), map(e => {
6639
- if (e instanceof NavigationEnd) {
6640
- // Navigation assumed to succeed if we get `ActivationStart`
6641
- return true;
6642
- }
6643
- const redirecting = e instanceof NavigationCancel ?
6644
- (e.code === 0 /* NavigationCancellationCode.Redirect */ ||
6645
- e.code === 1 /* NavigationCancellationCode.SupersededByNewNavigation */) :
6646
- false;
6647
- return redirecting ? null : false;
6648
- }), filter((result) => result !== null), take(1))
6649
- .subscribe(() => {
6650
- action();
6651
- });
6652
- }
6653
- return () => {
6654
- return locationInitialized.then(() => {
6655
- return new Promise(resolve => {
6656
- const router = injector.get(Router);
6657
- const bootstrapDone = injector.get(BOOTSTRAP_DONE);
6658
- afterNextNavigation(() => {
6659
- // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored
6660
- // without a redirect.
6661
- resolve(true);
6662
- initNavigation = true;
6663
- });
6664
- router.afterPreactivation = () => {
6665
- // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we
6666
- // assume activation will complete successfully (even though this is not
6667
- // guaranteed).
6668
- resolve(true);
6669
- // only the initial navigation should be delayed until bootstrapping is done.
6670
- if (!initNavigation) {
6671
- return bootstrapDone.closed ? of(void 0) : bootstrapDone;
6672
- // subsequent navigations should not be delayed
6673
- }
6674
- else {
6675
- return of(void 0);
6676
- }
6677
- };
6678
- router.initialNavigation();
6679
- });
6680
- });
6681
- };
6682
- }
6683
- },
6684
- ];
6685
- }
6686
- const INITIAL_NAVIGATION = new InjectionToken(NG_DEV_MODE ? 'initial navigation' : '', { providedIn: 'root', factory: () => 1 /* InitialNavigation.EnabledNonBlocking */ });
6687
- function provideDisabledInitialNavigation() {
6688
- return [
6689
- {
6690
- provide: APP_INITIALIZER,
6691
- multi: true,
6692
- useFactory: () => {
6693
- const router = inject(Router);
6694
- return () => {
6695
- router.setUpLocationChangeListener();
6696
- };
6697
- }
6698
- },
6699
- { provide: INITIAL_NAVIGATION, useValue: 2 /* InitialNavigation.Disabled */ }
6700
- ];
6701
- }
6702
- function provideTracing() {
6703
- if (NG_DEV_MODE) {
6704
- return [{
6705
- provide: ENVIRONMENT_INITIALIZER,
6706
- multi: true,
6707
- useFactory: () => {
6708
- const router = inject(Router);
6709
- return () => router.events.subscribe((e) => {
6710
- // tslint:disable:no-console
6711
- console.group?.(`Router Event: ${e.constructor.name}`);
6712
- console.log(stringifyEvent(e));
6713
- console.log(e);
6714
- console.groupEnd?.();
6715
- // tslint:enable:no-console
6716
- });
6717
- }
6718
- }];
6719
- }
6720
- else {
6721
- return [];
6722
- }
6723
- }
6724
- function providePreloading(preloadingStrategy) {
6725
- return [
6726
- RouterPreloader,
6727
- { provide: ROUTER_PRELOADER, useExisting: RouterPreloader },
6728
- { provide: PreloadingStrategy, useExisting: preloadingStrategy },
6729
- ];
6730
- }
6731
7102
 
6732
7103
  /**
6733
7104
  * @license
@@ -6739,7 +7110,7 @@ function providePreloading(preloadingStrategy) {
6739
7110
  /**
6740
7111
  * @publicApi
6741
7112
  */
6742
- const VERSION = new Version('14.2.0-next.0');
7113
+ const VERSION = new Version('14.2.0');
6743
7114
 
6744
7115
  /**
6745
7116
  * @license
@@ -6778,5 +7149,5 @@ const VERSION = new Version('14.2.0-next.0');
6778
7149
  * Generated bundle index. Do not edit.
6779
7150
  */
6780
7151
 
6781
- 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, RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRoutes, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, providePreloading as ɵprovidePreloading };
7152
+ 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, 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 };
6782
7153
  //# sourceMappingURL=router.mjs.map