@angular/router 14.1.0-next.0 → 14.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Angular v14.1.0-next.0
2
+ * @license Angular v14.1.0-next.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
8
  import { ɵisObservable, ɵisPromise, EventEmitter, Directive, Attribute, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, InjectionToken, InjectFlags, NgModuleFactory, Injectable, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, Input, HostListener, HostBinding, Optional, ContentChildren, Injector, Compiler, NgProbeToken, ANALYZE_FOR_ENTRY_COMPONENTS, SkipSelf, Inject, APP_INITIALIZER, APP_BOOTSTRAP_LISTENER, NgModule, ApplicationRef, Version } from '@angular/core';
9
- import { from, of, BehaviorSubject, combineLatest, throwError, EmptyError, concat, defer, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
9
+ import { from, of, BehaviorSubject, combineLatest, concat, defer, pipe, throwError, EmptyError, Observable, EMPTY, ConnectableObservable, Subject } from 'rxjs';
10
10
  import * as i3 from '@angular/common';
11
11
  import { Location, LocationStrategy, PlatformLocation, APP_BASE_HREF, ViewportScroller, HashLocationStrategy, PathLocationStrategy, LOCATION_INITIALIZED } from '@angular/common';
12
- import { map, switchMap, take, startWith, scan, filter, catchError, concatMap, last as last$1, first, mergeMap, tap, takeLast, mapTo, finalize, refCount, defaultIfEmpty, mergeAll } from 'rxjs/operators';
12
+ import { map, switchMap, take, startWith, scan, filter, mergeMap, first, concatMap, tap, catchError, last as last$1, takeWhile, defaultIfEmpty, takeLast, mapTo, finalize, refCount, mergeAll } from 'rxjs/operators';
13
13
  import * as i1 from '@angular/platform-browser';
14
14
 
15
15
  /**
@@ -2489,9 +2489,9 @@ class RouterOutlet {
2489
2489
  this.activateEvents.emit(this.activated.instance);
2490
2490
  }
2491
2491
  }
2492
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
2493
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.0", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2494
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterOutlet, decorators: [{
2492
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterOutlet, deps: [{ token: ChildrenOutletContexts }, { token: i0.ViewContainerRef }, { token: 'name', attribute: true }, { token: i0.ChangeDetectorRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Directive });
2493
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.1", type: RouterOutlet, selector: "router-outlet", outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], ngImport: i0 });
2494
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterOutlet, decorators: [{
2495
2495
  type: Directive,
2496
2496
  args: [{ selector: 'router-outlet', exportAs: 'outlet' }]
2497
2497
  }], ctorParameters: function () { return [{ type: ChildrenOutletContexts }, { type: i0.ViewContainerRef }, { type: undefined, decorators: [{
@@ -2548,9 +2548,9 @@ function isComponentFactoryResolver(item) {
2548
2548
  */
2549
2549
  class ɵEmptyOutletComponent {
2550
2550
  }
2551
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2552
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-next.0", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2553
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2551
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2552
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0-next.1", type: ɵEmptyOutletComponent, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2553
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2554
2554
  type: Component,
2555
2555
  args: [{ template: `<router-outlet></router-outlet>` }]
2556
2556
  }] });
@@ -2920,6 +2920,146 @@ class ActivateRoutes {
2920
2920
  }
2921
2921
  }
2922
2922
 
2923
+ /**
2924
+ * @license
2925
+ * Copyright Google LLC All Rights Reserved.
2926
+ *
2927
+ * Use of this source code is governed by an MIT-style license that can be
2928
+ * found in the LICENSE file at https://angular.io/license
2929
+ */
2930
+ class CanActivate {
2931
+ constructor(path) {
2932
+ this.path = path;
2933
+ this.route = this.path[this.path.length - 1];
2934
+ }
2935
+ }
2936
+ class CanDeactivate {
2937
+ constructor(component, route) {
2938
+ this.component = component;
2939
+ this.route = route;
2940
+ }
2941
+ }
2942
+ function getAllRouteGuards(future, curr, parentContexts) {
2943
+ const futureRoot = future._root;
2944
+ const currRoot = curr ? curr._root : null;
2945
+ return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);
2946
+ }
2947
+ function getCanActivateChild(p) {
2948
+ const canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;
2949
+ if (!canActivateChild || canActivateChild.length === 0)
2950
+ return null;
2951
+ return { node: p, guards: canActivateChild };
2952
+ }
2953
+ function getToken(token, snapshot, fallbackInjector) {
2954
+ const routeInjector = getClosestRouteInjector(snapshot);
2955
+ const injector = routeInjector ?? fallbackInjector;
2956
+ return injector.get(token);
2957
+ }
2958
+ function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
2959
+ canDeactivateChecks: [],
2960
+ canActivateChecks: []
2961
+ }) {
2962
+ const prevChildren = nodeChildrenAsMap(currNode);
2963
+ // Process the children of the future route
2964
+ futureNode.children.forEach(c => {
2965
+ getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);
2966
+ delete prevChildren[c.value.outlet];
2967
+ });
2968
+ // Process any children left from the current route (not active for the future route)
2969
+ forEach(prevChildren, (v, k) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));
2970
+ return checks;
2971
+ }
2972
+ function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {
2973
+ canDeactivateChecks: [],
2974
+ canActivateChecks: []
2975
+ }) {
2976
+ const future = futureNode.value;
2977
+ const curr = currNode ? currNode.value : null;
2978
+ const context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;
2979
+ // reusing the node
2980
+ if (curr && future.routeConfig === curr.routeConfig) {
2981
+ const shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);
2982
+ if (shouldRun) {
2983
+ checks.canActivateChecks.push(new CanActivate(futurePath));
2984
+ }
2985
+ else {
2986
+ // we need to set the data
2987
+ future.data = curr.data;
2988
+ future._resolvedData = curr._resolvedData;
2989
+ }
2990
+ // If we have a component, we need to go through an outlet.
2991
+ if (future.component) {
2992
+ getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks);
2993
+ // if we have a componentless route, we recurse but keep the same outlet map.
2994
+ }
2995
+ else {
2996
+ getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);
2997
+ }
2998
+ if (shouldRun && context && context.outlet && context.outlet.isActivated) {
2999
+ checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, curr));
3000
+ }
3001
+ }
3002
+ else {
3003
+ if (curr) {
3004
+ deactivateRouteAndItsChildren(currNode, context, checks);
3005
+ }
3006
+ checks.canActivateChecks.push(new CanActivate(futurePath));
3007
+ // If we have a component, we need to go through an outlet.
3008
+ if (future.component) {
3009
+ getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks);
3010
+ // if we have a componentless route, we recurse but keep the same outlet map.
3011
+ }
3012
+ else {
3013
+ getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);
3014
+ }
3015
+ }
3016
+ return checks;
3017
+ }
3018
+ function shouldRunGuardsAndResolvers(curr, future, mode) {
3019
+ if (typeof mode === 'function') {
3020
+ return mode(curr, future);
3021
+ }
3022
+ switch (mode) {
3023
+ case 'pathParamsChange':
3024
+ return !equalPath(curr.url, future.url);
3025
+ case 'pathParamsOrQueryParamsChange':
3026
+ return !equalPath(curr.url, future.url) ||
3027
+ !shallowEqual(curr.queryParams, future.queryParams);
3028
+ case 'always':
3029
+ return true;
3030
+ case 'paramsOrQueryParamsChange':
3031
+ return !equalParamsAndUrlSegments(curr, future) ||
3032
+ !shallowEqual(curr.queryParams, future.queryParams);
3033
+ case 'paramsChange':
3034
+ default:
3035
+ return !equalParamsAndUrlSegments(curr, future);
3036
+ }
3037
+ }
3038
+ function deactivateRouteAndItsChildren(route, context, checks) {
3039
+ const children = nodeChildrenAsMap(route);
3040
+ const r = route.value;
3041
+ forEach(children, (node, childName) => {
3042
+ if (!r.component) {
3043
+ deactivateRouteAndItsChildren(node, context, checks);
3044
+ }
3045
+ else if (context) {
3046
+ deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks);
3047
+ }
3048
+ else {
3049
+ deactivateRouteAndItsChildren(node, null, checks);
3050
+ }
3051
+ });
3052
+ if (!r.component) {
3053
+ checks.canDeactivateChecks.push(new CanDeactivate(null, r));
3054
+ }
3055
+ else if (context && context.outlet && context.outlet.isActivated) {
3056
+ checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));
3057
+ }
3058
+ else {
3059
+ checks.canDeactivateChecks.push(new CanDeactivate(null, r));
3060
+ }
3061
+ }
3062
+
2923
3063
  /**
2924
3064
  * @license
2925
3065
  * Copyright Google LLC All Rights Reserved.
@@ -2961,6 +3101,9 @@ function isCanActivateChild(guard) {
2961
3101
  function isCanDeactivate(guard) {
2962
3102
  return guard && isFunction(guard.canDeactivate);
2963
3103
  }
3104
+ function isCanMatch(guard) {
3105
+ return guard && isFunction(guard.canMatch);
3106
+ }
2964
3107
 
2965
3108
  /**
2966
3109
  * @license
@@ -3001,6 +3144,180 @@ function prioritizedGuardValue() {
3001
3144
  });
3002
3145
  }
3003
3146
 
3147
+ /**
3148
+ * @license
3149
+ * Copyright Google LLC All Rights Reserved.
3150
+ *
3151
+ * Use of this source code is governed by an MIT-style license that can be
3152
+ * found in the LICENSE file at https://angular.io/license
3153
+ */
3154
+ function checkGuards(moduleInjector, forwardEvent) {
3155
+ return mergeMap(t => {
3156
+ const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
3157
+ if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
3158
+ return of({ ...t, guardsResult: true });
3159
+ }
3160
+ return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, moduleInjector)
3161
+ .pipe(mergeMap(canDeactivate => {
3162
+ return canDeactivate && isBoolean(canDeactivate) ?
3163
+ runCanActivateChecks(targetSnapshot, canActivateChecks, moduleInjector, forwardEvent) :
3164
+ of(canDeactivate);
3165
+ }), map(guardsResult => ({ ...t, guardsResult })));
3166
+ });
3167
+ }
3168
+ function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) {
3169
+ return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector)), first(result => {
3170
+ return result !== true;
3171
+ }, true));
3172
+ }
3173
+ function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEvent) {
3174
+ return from(checks).pipe(concatMap((check) => {
3175
+ return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, moduleInjector), runCanActivate(futureSnapshot, check.route, moduleInjector));
3176
+ }), first(result => {
3177
+ return result !== true;
3178
+ }, true));
3179
+ }
3180
+ /**
3181
+ * This should fire off `ActivationStart` events for each route being activated at this
3182
+ * level.
3183
+ * In other words, if you're activating `a` and `b` below, `path` will contain the
3184
+ * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always
3185
+ * return
3186
+ * `true` so checks continue to run.
3187
+ */
3188
+ function fireActivationStart(snapshot, forwardEvent) {
3189
+ if (snapshot !== null && forwardEvent) {
3190
+ forwardEvent(new ActivationStart(snapshot));
3191
+ }
3192
+ return of(true);
3193
+ }
3194
+ /**
3195
+ * This should fire off `ChildActivationStart` events for each route being activated at this
3196
+ * level.
3197
+ * In other words, if you're activating `a` and `b` below, `path` will contain the
3198
+ * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always
3199
+ * return
3200
+ * `true` so checks continue to run.
3201
+ */
3202
+ function fireChildActivationStart(snapshot, forwardEvent) {
3203
+ if (snapshot !== null && forwardEvent) {
3204
+ forwardEvent(new ChildActivationStart(snapshot));
3205
+ }
3206
+ return of(true);
3207
+ }
3208
+ function runCanActivate(futureRSS, futureARS, moduleInjector) {
3209
+ const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
3210
+ if (!canActivate || canActivate.length === 0)
3211
+ return of(true);
3212
+ const canActivateObservables = canActivate.map((c) => {
3213
+ return defer(() => {
3214
+ const guard = getToken(c, futureARS, moduleInjector);
3215
+ let observable;
3216
+ if (isCanActivate(guard)) {
3217
+ observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS));
3218
+ }
3219
+ else if (isFunction(guard)) {
3220
+ observable = wrapIntoObservable(guard(futureARS, futureRSS));
3221
+ }
3222
+ else {
3223
+ throw new Error('Invalid CanActivate guard');
3224
+ }
3225
+ return observable.pipe(first());
3226
+ });
3227
+ });
3228
+ return of(canActivateObservables).pipe(prioritizedGuardValue());
3229
+ }
3230
+ function runCanActivateChild(futureRSS, path, moduleInjector) {
3231
+ const futureARS = path[path.length - 1];
3232
+ const canActivateChildGuards = path.slice(0, path.length - 1)
3233
+ .reverse()
3234
+ .map(p => getCanActivateChild(p))
3235
+ .filter(_ => _ !== null);
3236
+ const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
3237
+ return defer(() => {
3238
+ const guardsMapped = d.guards.map((c) => {
3239
+ const guard = getToken(c, d.node, moduleInjector);
3240
+ let observable;
3241
+ if (isCanActivateChild(guard)) {
3242
+ observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS));
3243
+ }
3244
+ else if (isFunction(guard)) {
3245
+ observable = wrapIntoObservable(guard(futureARS, futureRSS));
3246
+ }
3247
+ else {
3248
+ throw new Error('Invalid CanActivateChild guard');
3249
+ }
3250
+ return observable.pipe(first());
3251
+ });
3252
+ return of(guardsMapped).pipe(prioritizedGuardValue());
3253
+ });
3254
+ });
3255
+ return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
3256
+ }
3257
+ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector) {
3258
+ const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
3259
+ if (!canDeactivate || canDeactivate.length === 0)
3260
+ return of(true);
3261
+ const canDeactivateObservables = canDeactivate.map((c) => {
3262
+ const guard = getToken(c, currARS, moduleInjector);
3263
+ let observable;
3264
+ if (isCanDeactivate(guard)) {
3265
+ observable = wrapIntoObservable(guard.canDeactivate(component, currARS, currRSS, futureRSS));
3266
+ }
3267
+ else if (isFunction(guard)) {
3268
+ observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
3269
+ }
3270
+ else {
3271
+ throw new Error('Invalid CanDeactivate guard');
3272
+ }
3273
+ return observable.pipe(first());
3274
+ });
3275
+ return of(canDeactivateObservables).pipe(prioritizedGuardValue());
3276
+ }
3277
+ function runCanLoadGuards(injector, route, segments, urlSerializer) {
3278
+ const canLoad = route.canLoad;
3279
+ if (canLoad === undefined || canLoad.length === 0) {
3280
+ return of(true);
3281
+ }
3282
+ const canLoadObservables = canLoad.map((injectionToken) => {
3283
+ const guard = injector.get(injectionToken);
3284
+ let guardVal;
3285
+ if (isCanLoad(guard)) {
3286
+ guardVal = guard.canLoad(route, segments);
3287
+ }
3288
+ else if (isFunction(guard)) {
3289
+ guardVal = guard(route, segments);
3290
+ }
3291
+ else {
3292
+ throw new Error('Invalid CanLoad guard');
3293
+ }
3294
+ return wrapIntoObservable(guardVal);
3295
+ });
3296
+ return of(canLoadObservables)
3297
+ .pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
3298
+ }
3299
+ function redirectIfUrlTree(urlSerializer) {
3300
+ return pipe(tap((result) => {
3301
+ if (!isUrlTree(result))
3302
+ return;
3303
+ const error = navigationCancelingError(`Redirecting to "${urlSerializer.serialize(result)}"`);
3304
+ error.url = result;
3305
+ throw error;
3306
+ }), map(result => result === true));
3307
+ }
3308
+ function runCanMatchGuards(injector, route, segments, urlSerializer) {
3309
+ const canMatch = route.canMatch;
3310
+ if (!canMatch || canMatch.length === 0)
3311
+ return of(true);
3312
+ const canMatchObservables = canMatch.map(injectionToken => {
3313
+ const guard = injector.get(injectionToken);
3314
+ const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : guard(route, segments);
3315
+ return wrapIntoObservable(guardVal);
3316
+ });
3317
+ return of(canMatchObservables)
3318
+ .pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));
3319
+ }
3320
+
3004
3321
  /**
3005
3322
  * @license
3006
3323
  * Copyright Google LLC All Rights Reserved.
@@ -3015,6 +3332,14 @@ const noMatch$1 = {
3015
3332
  parameters: {},
3016
3333
  positionalParamSegments: {}
3017
3334
  };
3335
+ function matchWithChecks(segmentGroup, route, segments, injector, urlSerializer) {
3336
+ const result = match(segmentGroup, route, segments);
3337
+ if (!result.matched) {
3338
+ return of(result);
3339
+ }
3340
+ return runCanMatchGuards(injector, route, segments, urlSerializer)
3341
+ .pipe(map((v) => v === true ? result : { ...noMatch$1 }));
3342
+ }
3018
3343
  function match(segmentGroup, route, segments) {
3019
3344
  if (route.path === '') {
3020
3345
  if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
@@ -3346,28 +3671,31 @@ class ApplyRedirects {
3346
3671
  }
3347
3672
  return of(new UrlSegmentGroup(segments, {}));
3348
3673
  }
3349
- const { matched, consumedSegments, remainingSegments } = match(rawSegmentGroup, route, segments);
3350
- if (!matched)
3351
- return noMatch(rawSegmentGroup);
3352
- // Only create the Route's `EnvironmentInjector` if it matches the attempted navigation
3353
- injector = getOrCreateRouteInjectorIfNeeded(route, injector);
3354
- const childConfig$ = this.getChildConfig(injector, route, segments);
3355
- return childConfig$.pipe(mergeMap((routerConfig) => {
3356
- const childInjector = routerConfig.injector ?? injector;
3357
- const childConfig = routerConfig.routes;
3358
- const { segmentGroup: splitSegmentGroup, slicedSegments } = split(rawSegmentGroup, consumedSegments, remainingSegments, childConfig);
3359
- // See comment on the other call to `split` about why this is necessary.
3360
- const segmentGroup = new UrlSegmentGroup(splitSegmentGroup.segments, splitSegmentGroup.children);
3361
- if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
3362
- const expanded$ = this.expandChildren(childInjector, childConfig, segmentGroup);
3363
- return expanded$.pipe(map((children) => new UrlSegmentGroup(consumedSegments, children)));
3364
- }
3365
- if (childConfig.length === 0 && slicedSegments.length === 0) {
3366
- return of(new UrlSegmentGroup(consumedSegments, {}));
3367
- }
3368
- const matchedOnOutlet = getOutlet(route) === outlet;
3369
- const expanded$ = this.expandSegment(childInjector, segmentGroup, childConfig, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true);
3370
- return expanded$.pipe(map((cs) => new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children)));
3674
+ return matchWithChecks(rawSegmentGroup, route, segments, injector, this.urlSerializer)
3675
+ .pipe(switchMap(({ matched, consumedSegments, remainingSegments }) => {
3676
+ if (!matched)
3677
+ return noMatch(rawSegmentGroup);
3678
+ // Only create the Route's `EnvironmentInjector` if it matches the attempted
3679
+ // navigation
3680
+ injector = getOrCreateRouteInjectorIfNeeded(route, injector);
3681
+ const childConfig$ = this.getChildConfig(injector, route, segments);
3682
+ return childConfig$.pipe(mergeMap((routerConfig) => {
3683
+ const childInjector = routerConfig.injector ?? injector;
3684
+ const childConfig = routerConfig.routes;
3685
+ const { segmentGroup: splitSegmentGroup, slicedSegments } = split(rawSegmentGroup, consumedSegments, remainingSegments, childConfig);
3686
+ // See comment on the other call to `split` about why this is necessary.
3687
+ const segmentGroup = new UrlSegmentGroup(splitSegmentGroup.segments, splitSegmentGroup.children);
3688
+ if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
3689
+ const expanded$ = this.expandChildren(childInjector, childConfig, segmentGroup);
3690
+ return expanded$.pipe(map((children) => new UrlSegmentGroup(consumedSegments, children)));
3691
+ }
3692
+ if (childConfig.length === 0 && slicedSegments.length === 0) {
3693
+ return of(new UrlSegmentGroup(consumedSegments, {}));
3694
+ }
3695
+ const matchedOnOutlet = getOutlet(route) === outlet;
3696
+ const expanded$ = this.expandSegment(childInjector, segmentGroup, childConfig, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true);
3697
+ return expanded$.pipe(map((cs) => new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children)));
3698
+ }));
3371
3699
  }));
3372
3700
  }
3373
3701
  getChildConfig(injector, route, segments) {
@@ -3380,7 +3708,7 @@ class ApplyRedirects {
3380
3708
  if (route._loadedRoutes !== undefined) {
3381
3709
  return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
3382
3710
  }
3383
- return this.runCanLoadGuards(injector, route, segments)
3711
+ return runCanLoadGuards(injector, route, segments, this.urlSerializer)
3384
3712
  .pipe(mergeMap((shouldLoadResult) => {
3385
3713
  if (shouldLoadResult) {
3386
3714
  return this.configLoader.loadChildren(injector, route)
@@ -3394,33 +3722,6 @@ class ApplyRedirects {
3394
3722
  }
3395
3723
  return of({ routes: [], injector });
3396
3724
  }
3397
- runCanLoadGuards(injector, route, segments) {
3398
- const canLoad = route.canLoad;
3399
- if (!canLoad || canLoad.length === 0)
3400
- return of(true);
3401
- const canLoadObservables = canLoad.map((injectionToken) => {
3402
- const guard = injector.get(injectionToken);
3403
- let guardVal;
3404
- if (isCanLoad(guard)) {
3405
- guardVal = guard.canLoad(route, segments);
3406
- }
3407
- else if (isFunction(guard)) {
3408
- guardVal = guard(route, segments);
3409
- }
3410
- else {
3411
- throw new Error('Invalid CanLoad guard');
3412
- }
3413
- return wrapIntoObservable(guardVal);
3414
- });
3415
- return of(canLoadObservables)
3416
- .pipe(prioritizedGuardValue(), tap((result) => {
3417
- if (!isUrlTree(result))
3418
- return;
3419
- const error = navigationCancelingError(`Redirecting to "${this.urlSerializer.serialize(result)}"`);
3420
- error.url = result;
3421
- throw error;
3422
- }), map(result => result === true));
3423
- }
3424
3725
  lineralizeSegments(route, urlTree) {
3425
3726
  let res = [];
3426
3727
  let c = urlTree.root;
@@ -3446,196 +3747,44 @@ class ApplyRedirects {
3446
3747
  const res = {};
3447
3748
  forEach(redirectToParams, (v, k) => {
3448
3749
  const copySourceValue = typeof v === 'string' && v.startsWith(':');
3449
- if (copySourceValue) {
3450
- const sourceName = v.substring(1);
3451
- res[k] = actualParams[sourceName];
3452
- }
3453
- else {
3454
- res[k] = v;
3455
- }
3456
- });
3457
- return res;
3458
- }
3459
- createSegmentGroup(redirectTo, group, segments, posParams) {
3460
- const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
3461
- let children = {};
3462
- forEach(group.children, (child, name) => {
3463
- children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams);
3464
- });
3465
- return new UrlSegmentGroup(updatedSegments, children);
3466
- }
3467
- createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
3468
- return redirectToSegments.map(s => s.path.startsWith(':') ? this.findPosParam(redirectTo, s, posParams) :
3469
- this.findOrReturn(s, actualSegments));
3470
- }
3471
- findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3472
- const pos = posParams[redirectToUrlSegment.path.substring(1)];
3473
- if (!pos)
3474
- throw new Error(`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3475
- return pos;
3476
- }
3477
- findOrReturn(redirectToUrlSegment, actualSegments) {
3478
- let idx = 0;
3479
- for (const s of actualSegments) {
3480
- if (s.path === redirectToUrlSegment.path) {
3481
- actualSegments.splice(idx);
3482
- return s;
3483
- }
3484
- idx++;
3485
- }
3486
- return redirectToUrlSegment;
3487
- }
3488
- }
3489
-
3490
- /**
3491
- * @license
3492
- * Copyright Google LLC All Rights Reserved.
3493
- *
3494
- * Use of this source code is governed by an MIT-style license that can be
3495
- * found in the LICENSE file at https://angular.io/license
3496
- */
3497
- function applyRedirects(environmentInjector, configLoader, urlSerializer, config) {
3498
- return switchMap(t => applyRedirects$1(environmentInjector, configLoader, urlSerializer, t.extractedUrl, config)
3499
- .pipe(map(urlAfterRedirects => ({ ...t, urlAfterRedirects }))));
3500
- }
3501
-
3502
- /**
3503
- * @license
3504
- * Copyright Google LLC All Rights Reserved.
3505
- *
3506
- * Use of this source code is governed by an MIT-style license that can be
3507
- * found in the LICENSE file at https://angular.io/license
3508
- */
3509
- class CanActivate {
3510
- constructor(path) {
3511
- this.path = path;
3512
- this.route = this.path[this.path.length - 1];
3513
- }
3514
- }
3515
- class CanDeactivate {
3516
- constructor(component, route) {
3517
- this.component = component;
3518
- this.route = route;
3519
- }
3520
- }
3521
- function getAllRouteGuards(future, curr, parentContexts) {
3522
- const futureRoot = future._root;
3523
- const currRoot = curr ? curr._root : null;
3524
- return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);
3525
- }
3526
- function getCanActivateChild(p) {
3527
- const canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;
3528
- if (!canActivateChild || canActivateChild.length === 0)
3529
- return null;
3530
- return { node: p, guards: canActivateChild };
3531
- }
3532
- function getToken(token, snapshot, fallbackInjector) {
3533
- const routeInjector = getClosestRouteInjector(snapshot);
3534
- const injector = routeInjector ?? fallbackInjector;
3535
- return injector.get(token);
3536
- }
3537
- function getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {
3538
- canDeactivateChecks: [],
3539
- canActivateChecks: []
3540
- }) {
3541
- const prevChildren = nodeChildrenAsMap(currNode);
3542
- // Process the children of the future route
3543
- futureNode.children.forEach(c => {
3544
- getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);
3545
- delete prevChildren[c.value.outlet];
3546
- });
3547
- // Process any children left from the current route (not active for the future route)
3548
- forEach(prevChildren, (v, k) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));
3549
- return checks;
3550
- }
3551
- function getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {
3552
- canDeactivateChecks: [],
3553
- canActivateChecks: []
3554
- }) {
3555
- const future = futureNode.value;
3556
- const curr = currNode ? currNode.value : null;
3557
- const context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;
3558
- // reusing the node
3559
- if (curr && future.routeConfig === curr.routeConfig) {
3560
- const shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);
3561
- if (shouldRun) {
3562
- checks.canActivateChecks.push(new CanActivate(futurePath));
3563
- }
3564
- else {
3565
- // we need to set the data
3566
- future.data = curr.data;
3567
- future._resolvedData = curr._resolvedData;
3568
- }
3569
- // If we have a component, we need to go through an outlet.
3570
- if (future.component) {
3571
- getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks);
3572
- // if we have a componentless route, we recurse but keep the same outlet map.
3573
- }
3574
- else {
3575
- getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);
3576
- }
3577
- if (shouldRun && context && context.outlet && context.outlet.isActivated) {
3578
- checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, curr));
3579
- }
3580
- }
3581
- else {
3582
- if (curr) {
3583
- deactivateRouteAndItsChildren(currNode, context, checks);
3584
- }
3585
- checks.canActivateChecks.push(new CanActivate(futurePath));
3586
- // If we have a component, we need to go through an outlet.
3587
- if (future.component) {
3588
- getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks);
3589
- // if we have a componentless route, we recurse but keep the same outlet map.
3590
- }
3591
- else {
3592
- getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);
3593
- }
3594
- }
3595
- return checks;
3596
- }
3597
- function shouldRunGuardsAndResolvers(curr, future, mode) {
3598
- if (typeof mode === 'function') {
3599
- return mode(curr, future);
3750
+ if (copySourceValue) {
3751
+ const sourceName = v.substring(1);
3752
+ res[k] = actualParams[sourceName];
3753
+ }
3754
+ else {
3755
+ res[k] = v;
3756
+ }
3757
+ });
3758
+ return res;
3600
3759
  }
3601
- switch (mode) {
3602
- case 'pathParamsChange':
3603
- return !equalPath(curr.url, future.url);
3604
- case 'pathParamsOrQueryParamsChange':
3605
- return !equalPath(curr.url, future.url) ||
3606
- !shallowEqual(curr.queryParams, future.queryParams);
3607
- case 'always':
3608
- return true;
3609
- case 'paramsOrQueryParamsChange':
3610
- return !equalParamsAndUrlSegments(curr, future) ||
3611
- !shallowEqual(curr.queryParams, future.queryParams);
3612
- case 'paramsChange':
3613
- default:
3614
- return !equalParamsAndUrlSegments(curr, future);
3760
+ createSegmentGroup(redirectTo, group, segments, posParams) {
3761
+ const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
3762
+ let children = {};
3763
+ forEach(group.children, (child, name) => {
3764
+ children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams);
3765
+ });
3766
+ return new UrlSegmentGroup(updatedSegments, children);
3615
3767
  }
3616
- }
3617
- function deactivateRouteAndItsChildren(route, context, checks) {
3618
- const children = nodeChildrenAsMap(route);
3619
- const r = route.value;
3620
- forEach(children, (node, childName) => {
3621
- if (!r.component) {
3622
- deactivateRouteAndItsChildren(node, context, checks);
3623
- }
3624
- else if (context) {
3625
- deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks);
3626
- }
3627
- else {
3628
- deactivateRouteAndItsChildren(node, null, checks);
3629
- }
3630
- });
3631
- if (!r.component) {
3632
- checks.canDeactivateChecks.push(new CanDeactivate(null, r));
3768
+ createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {
3769
+ return redirectToSegments.map(s => s.path.startsWith(':') ? this.findPosParam(redirectTo, s, posParams) :
3770
+ this.findOrReturn(s, actualSegments));
3633
3771
  }
3634
- else if (context && context.outlet && context.outlet.isActivated) {
3635
- checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));
3772
+ findPosParam(redirectTo, redirectToUrlSegment, posParams) {
3773
+ const pos = posParams[redirectToUrlSegment.path.substring(1)];
3774
+ if (!pos)
3775
+ throw new Error(`Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);
3776
+ return pos;
3636
3777
  }
3637
- else {
3638
- checks.canDeactivateChecks.push(new CanDeactivate(null, r));
3778
+ findOrReturn(redirectToUrlSegment, actualSegments) {
3779
+ let idx = 0;
3780
+ for (const s of actualSegments) {
3781
+ if (s.path === redirectToUrlSegment.path) {
3782
+ actualSegments.splice(idx);
3783
+ return s;
3784
+ }
3785
+ idx++;
3786
+ }
3787
+ return redirectToUrlSegment;
3639
3788
  }
3640
3789
  }
3641
3790
 
@@ -3646,128 +3795,9 @@ function deactivateRouteAndItsChildren(route, context, checks) {
3646
3795
  * Use of this source code is governed by an MIT-style license that can be
3647
3796
  * found in the LICENSE file at https://angular.io/license
3648
3797
  */
3649
- function checkGuards(moduleInjector, forwardEvent) {
3650
- return mergeMap(t => {
3651
- const { targetSnapshot, currentSnapshot, guards: { canActivateChecks, canDeactivateChecks } } = t;
3652
- if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {
3653
- return of({ ...t, guardsResult: true });
3654
- }
3655
- return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, moduleInjector)
3656
- .pipe(mergeMap(canDeactivate => {
3657
- return canDeactivate && isBoolean(canDeactivate) ?
3658
- runCanActivateChecks(targetSnapshot, canActivateChecks, moduleInjector, forwardEvent) :
3659
- of(canDeactivate);
3660
- }), map(guardsResult => ({ ...t, guardsResult })));
3661
- });
3662
- }
3663
- function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) {
3664
- return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector)), first(result => {
3665
- return result !== true;
3666
- }, true));
3667
- }
3668
- function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEvent) {
3669
- return from(checks).pipe(concatMap((check) => {
3670
- return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, moduleInjector), runCanActivate(futureSnapshot, check.route, moduleInjector));
3671
- }), first(result => {
3672
- return result !== true;
3673
- }, true));
3674
- }
3675
- /**
3676
- * This should fire off `ActivationStart` events for each route being activated at this
3677
- * level.
3678
- * In other words, if you're activating `a` and `b` below, `path` will contain the
3679
- * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always
3680
- * return
3681
- * `true` so checks continue to run.
3682
- */
3683
- function fireActivationStart(snapshot, forwardEvent) {
3684
- if (snapshot !== null && forwardEvent) {
3685
- forwardEvent(new ActivationStart(snapshot));
3686
- }
3687
- return of(true);
3688
- }
3689
- /**
3690
- * This should fire off `ChildActivationStart` events for each route being activated at this
3691
- * level.
3692
- * In other words, if you're activating `a` and `b` below, `path` will contain the
3693
- * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always
3694
- * return
3695
- * `true` so checks continue to run.
3696
- */
3697
- function fireChildActivationStart(snapshot, forwardEvent) {
3698
- if (snapshot !== null && forwardEvent) {
3699
- forwardEvent(new ChildActivationStart(snapshot));
3700
- }
3701
- return of(true);
3702
- }
3703
- function runCanActivate(futureRSS, futureARS, moduleInjector) {
3704
- const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;
3705
- if (!canActivate || canActivate.length === 0)
3706
- return of(true);
3707
- const canActivateObservables = canActivate.map((c) => {
3708
- return defer(() => {
3709
- const guard = getToken(c, futureARS, moduleInjector);
3710
- let observable;
3711
- if (isCanActivate(guard)) {
3712
- observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS));
3713
- }
3714
- else if (isFunction(guard)) {
3715
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3716
- }
3717
- else {
3718
- throw new Error('Invalid CanActivate guard');
3719
- }
3720
- return observable.pipe(first());
3721
- });
3722
- });
3723
- return of(canActivateObservables).pipe(prioritizedGuardValue());
3724
- }
3725
- function runCanActivateChild(futureRSS, path, moduleInjector) {
3726
- const futureARS = path[path.length - 1];
3727
- const canActivateChildGuards = path.slice(0, path.length - 1)
3728
- .reverse()
3729
- .map(p => getCanActivateChild(p))
3730
- .filter(_ => _ !== null);
3731
- const canActivateChildGuardsMapped = canActivateChildGuards.map((d) => {
3732
- return defer(() => {
3733
- const guardsMapped = d.guards.map((c) => {
3734
- const guard = getToken(c, d.node, moduleInjector);
3735
- let observable;
3736
- if (isCanActivateChild(guard)) {
3737
- observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS));
3738
- }
3739
- else if (isFunction(guard)) {
3740
- observable = wrapIntoObservable(guard(futureARS, futureRSS));
3741
- }
3742
- else {
3743
- throw new Error('Invalid CanActivateChild guard');
3744
- }
3745
- return observable.pipe(first());
3746
- });
3747
- return of(guardsMapped).pipe(prioritizedGuardValue());
3748
- });
3749
- });
3750
- return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());
3751
- }
3752
- function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector) {
3753
- const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;
3754
- if (!canDeactivate || canDeactivate.length === 0)
3755
- return of(true);
3756
- const canDeactivateObservables = canDeactivate.map((c) => {
3757
- const guard = getToken(c, currARS, moduleInjector);
3758
- let observable;
3759
- if (isCanDeactivate(guard)) {
3760
- observable = wrapIntoObservable(guard.canDeactivate(component, currARS, currRSS, futureRSS));
3761
- }
3762
- else if (isFunction(guard)) {
3763
- observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS));
3764
- }
3765
- else {
3766
- throw new Error('Invalid CanDeactivate guard');
3767
- }
3768
- return observable.pipe(first());
3769
- });
3770
- return of(canDeactivateObservables).pipe(prioritizedGuardValue());
3798
+ function applyRedirects(environmentInjector, configLoader, urlSerializer, config) {
3799
+ return switchMap(t => applyRedirects$1(environmentInjector, configLoader, urlSerializer, t.extractedUrl, config)
3800
+ .pipe(map(urlAfterRedirects => ({ ...t, urlAfterRedirects }))));
3771
3801
  }
3772
3802
 
3773
3803
  /**
@@ -3784,46 +3814,45 @@ function newObservableError(e) {
3784
3814
  // TODO(atscott): This pattern is used throughout the router code and can be `throwError` instead.
3785
3815
  return new Observable((obs) => obs.error(e));
3786
3816
  }
3787
- function recognize$1(rootComponentType, config, urlTree, url, paramsInheritanceStrategy = 'emptyOnly', relativeLinkResolution = 'legacy') {
3788
- try {
3789
- const result = new Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution)
3790
- .recognize();
3817
+ function recognize$1(injector, rootComponentType, config, urlTree, url, urlSerializer, paramsInheritanceStrategy = 'emptyOnly', relativeLinkResolution = 'legacy') {
3818
+ return new Recognizer(injector, rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution, urlSerializer)
3819
+ .recognize()
3820
+ .pipe(switchMap(result => {
3791
3821
  if (result === null) {
3792
3822
  return newObservableError(new NoMatch());
3793
3823
  }
3794
3824
  else {
3795
3825
  return of(result);
3796
3826
  }
3797
- }
3798
- catch (e) {
3799
- // Catch the potential error from recognize due to duplicate outlet matches and return as an
3800
- // `Observable` error instead.
3801
- return newObservableError(e);
3802
- }
3827
+ }));
3803
3828
  }
3804
3829
  class Recognizer {
3805
- constructor(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution) {
3830
+ constructor(injector, rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution, urlSerializer) {
3831
+ this.injector = injector;
3806
3832
  this.rootComponentType = rootComponentType;
3807
3833
  this.config = config;
3808
3834
  this.urlTree = urlTree;
3809
3835
  this.url = url;
3810
3836
  this.paramsInheritanceStrategy = paramsInheritanceStrategy;
3811
3837
  this.relativeLinkResolution = relativeLinkResolution;
3838
+ this.urlSerializer = urlSerializer;
3812
3839
  }
3813
3840
  recognize() {
3814
3841
  const rootSegmentGroup = split(this.urlTree.root, [], [], this.config.filter(c => c.redirectTo === undefined), this.relativeLinkResolution)
3815
3842
  .segmentGroup;
3816
- const children = this.processSegmentGroup(this.config, rootSegmentGroup, PRIMARY_OUTLET);
3817
- if (children === null) {
3818
- return null;
3819
- }
3820
- // Use Object.freeze to prevent readers of the Router state from modifying it outside of a
3821
- // navigation, resulting in the router being out of sync with the browser.
3822
- const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {});
3823
- const rootNode = new TreeNode(root, children);
3824
- const routeState = new RouterStateSnapshot(this.url, rootNode);
3825
- this.inheritParamsAndData(routeState._root);
3826
- return routeState;
3843
+ return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET)
3844
+ .pipe(map(children => {
3845
+ if (children === null) {
3846
+ return null;
3847
+ }
3848
+ // Use Object.freeze to prevent readers of the Router state from modifying it outside of a
3849
+ // navigation, resulting in the router being out of sync with the browser.
3850
+ const root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {});
3851
+ const rootNode = new TreeNode(root, children);
3852
+ const routeState = new RouterStateSnapshot(this.url, rootNode);
3853
+ this.inheritParamsAndData(routeState._root);
3854
+ return routeState;
3855
+ }));
3827
3856
  }
3828
3857
  inheritParamsAndData(routeNode) {
3829
3858
  const route = routeNode.value;
@@ -3832,11 +3861,11 @@ class Recognizer {
3832
3861
  route.data = Object.freeze(i.data);
3833
3862
  routeNode.children.forEach(n => this.inheritParamsAndData(n));
3834
3863
  }
3835
- processSegmentGroup(config, segmentGroup, outlet) {
3864
+ processSegmentGroup(injector, config, segmentGroup, outlet) {
3836
3865
  if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
3837
- return this.processChildren(config, segmentGroup);
3866
+ return this.processChildren(injector, config, segmentGroup);
3838
3867
  }
3839
- return this.processSegment(config, segmentGroup, segmentGroup.segments, outlet);
3868
+ return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet);
3840
3869
  }
3841
3870
  /**
3842
3871
  * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if
@@ -3846,102 +3875,126 @@ class Recognizer {
3846
3875
  * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the
3847
3876
  * config.
3848
3877
  */
3849
- processChildren(config, segmentGroup) {
3850
- const children = [];
3851
- for (const childOutlet of Object.keys(segmentGroup.children)) {
3878
+ processChildren(injector, config, segmentGroup) {
3879
+ return from(Object.keys(segmentGroup.children))
3880
+ .pipe(concatMap(childOutlet => {
3852
3881
  const child = segmentGroup.children[childOutlet];
3853
- // Sort the config so that routes with outlets that match the one being activated appear
3854
- // first, followed by routes for other outlets, which might match if they have an empty path.
3882
+ // Sort the config so that routes with outlets that match the one being activated
3883
+ // appear first, followed by routes for other outlets, which might match if they have
3884
+ // an empty path.
3855
3885
  const sortedConfig = sortByMatchingOutlets(config, childOutlet);
3856
- const outletChildren = this.processSegmentGroup(sortedConfig, child, childOutlet);
3857
- if (outletChildren === null) {
3858
- // Configs must match all segment children so because we did not find a match for this
3859
- // outlet, return `null`.
3886
+ return this.processSegmentGroup(injector, sortedConfig, child, childOutlet);
3887
+ }), scan((children, outletChildren) => {
3888
+ if (!children || !outletChildren)
3860
3889
  return null;
3861
- }
3862
3890
  children.push(...outletChildren);
3863
- }
3864
- // Because we may have matched two outlets to the same empty path segment, we can have multiple
3865
- // activated results for the same outlet. We should merge the children of these results so the
3866
- // final return value is only one `TreeNode` per outlet.
3867
- const mergedChildren = mergeEmptyPathMatches(children);
3868
- if (typeof ngDevMode === 'undefined' || ngDevMode) {
3869
- // This should really never happen - we are only taking the first match for each outlet and
3870
- // merge the empty path matches.
3871
- checkOutletNameUniqueness(mergedChildren);
3872
- }
3873
- sortActivatedRouteSnapshots(mergedChildren);
3874
- return mergedChildren;
3875
- }
3876
- processSegment(config, segmentGroup, segments, outlet) {
3877
- for (const r of config) {
3878
- const children = this.processSegmentAgainstRoute(r, segmentGroup, segments, outlet);
3879
- if (children !== null) {
3880
- return children;
3891
+ return children;
3892
+ }), takeWhile(children => children !== null), defaultIfEmpty(null), last$1(), map(children => {
3893
+ if (children === null)
3894
+ return null;
3895
+ // Because we may have matched two outlets to the same empty path segment, we can have
3896
+ // multiple activated results for the same outlet. We should merge the children of
3897
+ // these results so the final return value is only one `TreeNode` per outlet.
3898
+ const mergedChildren = mergeEmptyPathMatches(children);
3899
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
3900
+ // This should really never happen - we are only taking the first match for each
3901
+ // outlet and merge the empty path matches.
3902
+ checkOutletNameUniqueness(mergedChildren);
3881
3903
  }
3882
- }
3883
- if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3884
- return [];
3885
- }
3886
- return null;
3904
+ sortActivatedRouteSnapshots(mergedChildren);
3905
+ return mergedChildren;
3906
+ }));
3887
3907
  }
3888
- processSegmentAgainstRoute(route, rawSegment, segments, outlet) {
3908
+ processSegment(injector, routes, segmentGroup, segments, outlet) {
3909
+ return from(routes).pipe(concatMap(r => {
3910
+ return this.processSegmentAgainstRoute(r._injector ?? injector, r, segmentGroup, segments, outlet);
3911
+ }), first((x) => !!x), catchError(e => {
3912
+ if (e instanceof EmptyError) {
3913
+ if (noLeftoversInUrl(segmentGroup, segments, outlet)) {
3914
+ return of([]);
3915
+ }
3916
+ return of(null);
3917
+ }
3918
+ throw e;
3919
+ }));
3920
+ }
3921
+ processSegmentAgainstRoute(injector, route, rawSegment, segments, outlet) {
3889
3922
  if (route.redirectTo || !isImmediateMatch(route, rawSegment, segments, outlet))
3890
- return null;
3891
- let snapshot;
3892
- let consumedSegments = [];
3893
- let remainingSegments = [];
3923
+ return of(null);
3924
+ let matchResult;
3894
3925
  if (route.path === '**') {
3895
3926
  const params = segments.length > 0 ? last(segments).parameters : {};
3896
3927
  const pathIndexShift = getPathIndexShift(rawSegment) + segments.length;
3897
- snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route),
3928
+ const snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze({ ...this.urlTree.queryParams }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getSourceSegmentGroup(rawSegment), pathIndexShift, getResolve(route),
3898
3929
  // NG_DEV_MODE is used to prevent the getCorrectedPathIndexShift function from affecting
3899
3930
  // production bundle size. This value is intended only to surface a warning to users
3900
3931
  // depending on `relativeLinkResolution: 'legacy'` in dev mode.
3901
3932
  (NG_DEV_MODE$2 ? getCorrectedPathIndexShift(rawSegment) + segments.length :
3902
3933
  pathIndexShift));
3934
+ matchResult = of({
3935
+ snapshot,
3936
+ consumedSegments: [],
3937
+ remainingSegments: [],
3938
+ });
3903
3939
  }
3904
3940
  else {
3905
- const result = match(rawSegment, route, segments);
3906
- if (!result.matched) {
3907
- return null;
3908
- }
3909
- consumedSegments = result.consumedSegments;
3910
- remainingSegments = result.remainingSegments;
3911
- const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3912
- snapshot = new ActivatedRouteSnapshot(consumedSegments, result.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$2 ? getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3913
- pathIndexShift));
3941
+ matchResult =
3942
+ matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer)
3943
+ .pipe(map(({ matched, consumedSegments, remainingSegments, parameters }) => {
3944
+ if (!matched) {
3945
+ return null;
3946
+ }
3947
+ const pathIndexShift = getPathIndexShift(rawSegment) + consumedSegments.length;
3948
+ 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$2 ?
3949
+ getCorrectedPathIndexShift(rawSegment) + consumedSegments.length :
3950
+ pathIndexShift));
3951
+ return { snapshot, consumedSegments, remainingSegments };
3952
+ }));
3914
3953
  }
3915
- const childConfig = getChildConfig(route);
3916
- const { segmentGroup, slicedSegments } = split(rawSegment, consumedSegments, remainingSegments,
3917
- // Filter out routes with redirectTo because we are trying to create activated route
3918
- // snapshots and don't handle redirects here. That should have been done in
3919
- // `applyRedirects`.
3920
- childConfig.filter(c => c.redirectTo === undefined), this.relativeLinkResolution);
3921
- if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
3922
- const children = this.processChildren(childConfig, segmentGroup);
3923
- if (children === null) {
3924
- return null;
3954
+ return matchResult.pipe(switchMap((result) => {
3955
+ if (result === null) {
3956
+ return of(null);
3925
3957
  }
3926
- return [new TreeNode(snapshot, children)];
3927
- }
3928
- if (childConfig.length === 0 && slicedSegments.length === 0) {
3929
- return [new TreeNode(snapshot, [])];
3930
- }
3931
- const matchedOnOutlet = getOutlet(route) === outlet;
3932
- // If we matched a config due to empty path match on a different outlet, we need to continue
3933
- // passing the current outlet for the segment rather than switch to PRIMARY.
3934
- // Note that we switch to primary when we have a match because outlet configs look like this:
3935
- // {path: 'a', outlet: 'a', children: [
3936
- // {path: 'b', component: B},
3937
- // {path: 'c', component: C},
3938
- // ]}
3939
- // Notice that the children of the named outlet are configured with the primary outlet
3940
- const children = this.processSegment(childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet);
3941
- if (children === null) {
3942
- return null;
3943
- }
3944
- return [new TreeNode(snapshot, children)];
3958
+ const { snapshot, consumedSegments, remainingSegments } = result;
3959
+ // Only create the Route's `EnvironmentInjector` if it matches the attempted
3960
+ // navigation
3961
+ injector = getOrCreateRouteInjectorIfNeeded(route, injector);
3962
+ const childInjector = route._loadedInjector ?? injector;
3963
+ const childConfig = getChildConfig(route);
3964
+ const { segmentGroup, slicedSegments } = split(rawSegment, consumedSegments, remainingSegments,
3965
+ // Filter out routes with redirectTo because we are trying to create activated route
3966
+ // snapshots and don't handle redirects here. That should have been done in
3967
+ // `applyRedirects`.
3968
+ childConfig.filter(c => c.redirectTo === undefined), this.relativeLinkResolution);
3969
+ if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
3970
+ return this.processChildren(childInjector, childConfig, segmentGroup).pipe(map(children => {
3971
+ if (children === null) {
3972
+ return null;
3973
+ }
3974
+ return [new TreeNode(snapshot, children)];
3975
+ }));
3976
+ }
3977
+ if (childConfig.length === 0 && slicedSegments.length === 0) {
3978
+ return of([new TreeNode(snapshot, [])]);
3979
+ }
3980
+ const matchedOnOutlet = getOutlet(route) === outlet;
3981
+ // If we matched a config due to empty path match on a different outlet, we need to
3982
+ // continue passing the current outlet for the segment rather than switch to PRIMARY.
3983
+ // Note that we switch to primary when we have a match because outlet configs look like
3984
+ // this: {path: 'a', outlet: 'a', children: [
3985
+ // {path: 'b', component: B},
3986
+ // {path: 'c', component: C},
3987
+ // ]}
3988
+ // Notice that the children of the named outlet are configured with the primary outlet
3989
+ return this
3990
+ .processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet)
3991
+ .pipe(map(children => {
3992
+ if (children === null) {
3993
+ return null;
3994
+ }
3995
+ return [new TreeNode(snapshot, children)];
3996
+ }));
3997
+ }));
3945
3998
  }
3946
3999
  }
3947
4000
  function sortActivatedRouteSnapshots(nodes) {
@@ -3967,9 +4020,9 @@ function hasEmptyPathConfig(node) {
3967
4020
  return config && config.path === '' && config.redirectTo === undefined;
3968
4021
  }
3969
4022
  /**
3970
- * Finds `TreeNode`s with matching empty path route configs and merges them into `TreeNode` with the
3971
- * children from each duplicate. This is necessary because different outlets can match a single
3972
- * empty path route config and the results need to then be merged.
4023
+ * Finds `TreeNode`s with matching empty path route configs and merges them into `TreeNode` with
4024
+ * the children from each duplicate. This is necessary because different outlets can match a
4025
+ * single empty path route config and the results need to then be merged.
3973
4026
  */
3974
4027
  function mergeEmptyPathMatches(nodes) {
3975
4028
  const result = [];
@@ -3990,9 +4043,9 @@ function mergeEmptyPathMatches(nodes) {
3990
4043
  }
3991
4044
  }
3992
4045
  // For each node which has children from multiple sources, we need to recompute a new `TreeNode`
3993
- // by also merging those children. This is necessary when there are multiple empty path configs in
3994
- // a row. Put another way: whenever we combine children of two nodes, we need to also check if any
3995
- // of those children can be combined into a single node as well.
4046
+ // by also merging those children. This is necessary when there are multiple empty path configs
4047
+ // in a row. Put another way: whenever we combine children of two nodes, we need to also check
4048
+ // if any of those children can be combined into a single node as well.
3996
4049
  for (const mergedNode of mergedNodes) {
3997
4050
  const mergedChildren = mergeEmptyPathMatches(mergedNode.children);
3998
4051
  result.push(new TreeNode(mergedNode.value, mergedChildren));
@@ -4050,8 +4103,8 @@ function getResolve(route) {
4050
4103
  * Use of this source code is governed by an MIT-style license that can be
4051
4104
  * found in the LICENSE file at https://angular.io/license
4052
4105
  */
4053
- function recognize(rootComponentType, config, serializer, paramsInheritanceStrategy, relativeLinkResolution) {
4054
- return mergeMap(t => recognize$1(rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects), paramsInheritanceStrategy, relativeLinkResolution)
4106
+ function recognize(injector, rootComponentType, config, serializer, paramsInheritanceStrategy, relativeLinkResolution) {
4107
+ return mergeMap(t => recognize$1(injector, rootComponentType, config, t.urlAfterRedirects, serializer.serialize(t.urlAfterRedirects), serializer, paramsInheritanceStrategy, relativeLinkResolution)
4055
4108
  .pipe(map(targetSnapshot => ({ ...t, targetSnapshot }))));
4056
4109
  }
4057
4110
 
@@ -4312,9 +4365,9 @@ class RouterConfigLoader {
4312
4365
  }));
4313
4366
  }
4314
4367
  }
4315
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4316
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterConfigLoader });
4317
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterConfigLoader, decorators: [{
4368
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4369
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterConfigLoader });
4370
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4318
4371
  type: Injectable
4319
4372
  }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4320
4373
 
@@ -4363,12 +4416,6 @@ function defaultErrorHandler(error) {
4363
4416
  function defaultMalformedUriErrorHandler(error, urlSerializer, url) {
4364
4417
  return urlSerializer.parse('/');
4365
4418
  }
4366
- /**
4367
- * @internal
4368
- */
4369
- function defaultRouterHook(snapshot, runExtras) {
4370
- return of(null);
4371
- }
4372
4419
  /**
4373
4420
  * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`
4374
4421
  * (exact = true).
@@ -4448,13 +4495,12 @@ class Router {
4448
4495
  this.navigated = false;
4449
4496
  this.lastSuccessfulId = -1;
4450
4497
  /**
4451
- * Hooks that enable you to pause navigation,
4452
- * either before or after the preactivation phase.
4498
+ * Hook that enables you to pause navigation after the preactivation phase.
4453
4499
  * Used by `RouterModule`.
4454
4500
  *
4455
4501
  * @internal
4456
4502
  */
4457
- this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook };
4503
+ this.afterPreactivation = () => of(void 0);
4458
4504
  /**
4459
4505
  * A strategy for extracting and merging URLs.
4460
4506
  * Used for AngularJS to Angular migrations.
@@ -4634,7 +4680,7 @@ class Router {
4634
4680
  };
4635
4681
  }),
4636
4682
  // Recognize
4637
- recognize(this.rootComponentType, this.config, (url) => this.serializeUrl(url), this.paramsInheritanceStrategy, this.relativeLinkResolution),
4683
+ recognize(this.ngModule.injector, this.rootComponentType, this.config, this.urlSerializer, this.paramsInheritanceStrategy, this.relativeLinkResolution),
4638
4684
  // Update URL if in `eager` update mode
4639
4685
  tap(t => {
4640
4686
  if (this.urlUpdateStrategy === 'eager') {
@@ -4679,17 +4725,6 @@ class Router {
4679
4725
  }
4680
4726
  }
4681
4727
  }),
4682
- // Before Preactivation
4683
- switchTap(t => {
4684
- const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
4685
- return this.hooks.beforePreactivation(targetSnapshot, {
4686
- navigationId,
4687
- appliedUrlTree,
4688
- rawUrlTree,
4689
- skipLocationChange: !!skipLocationChange,
4690
- replaceUrl: !!replaceUrl,
4691
- });
4692
- }),
4693
4728
  // --- GUARDS ---
4694
4729
  tap(t => {
4695
4730
  const guardsStart = new GuardsCheckStart(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
@@ -4736,18 +4771,7 @@ class Router {
4736
4771
  }));
4737
4772
  }
4738
4773
  return undefined;
4739
- }),
4740
- // --- AFTER PREACTIVATION ---
4741
- switchTap((t) => {
4742
- const { targetSnapshot, id: navigationId, extractedUrl: appliedUrlTree, rawUrl: rawUrlTree, extras: { skipLocationChange, replaceUrl } } = t;
4743
- return this.hooks.afterPreactivation(targetSnapshot, {
4744
- navigationId,
4745
- appliedUrlTree,
4746
- rawUrlTree,
4747
- skipLocationChange: !!skipLocationChange,
4748
- replaceUrl: !!replaceUrl,
4749
- });
4750
- }),
4774
+ }), switchTap(() => this.afterPreactivation()),
4751
4775
  // --- LOAD COMPONENTS ---
4752
4776
  switchTap((t) => {
4753
4777
  const loadComponents = (route) => {
@@ -5319,9 +5343,9 @@ class Router {
5319
5343
  return { navigationId };
5320
5344
  }
5321
5345
  }
5322
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5323
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: Router });
5324
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: Router, decorators: [{
5346
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5347
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: Router });
5348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: Router, decorators: [{
5325
5349
  type: Injectable
5326
5350
  }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5327
5351
  function validateCommands(commands) {
@@ -5520,9 +5544,9 @@ class RouterLink {
5520
5544
  });
5521
5545
  }
5522
5546
  }
5523
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
5524
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.0", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5525
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterLink, decorators: [{
5547
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
5548
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.1", type: RouterLink, selector: ":not(a):not(area)[routerLink]", inputs: { queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick()" } }, usesOnChanges: true, ngImport: i0 });
5549
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterLink, decorators: [{
5526
5550
  type: Directive,
5527
5551
  args: [{ selector: ':not(a):not(area)[routerLink]' }]
5528
5552
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: undefined, decorators: [{
@@ -5639,9 +5663,9 @@ class RouterLinkWithHref {
5639
5663
  });
5640
5664
  }
5641
5665
  }
5642
- RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5643
- RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.0", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5644
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5666
+ RouterLinkWithHref.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterLinkWithHref, deps: [{ token: Router }, { token: ActivatedRoute }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5667
+ RouterLinkWithHref.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.1", type: RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", state: "state", relativeTo: "relativeTo", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target", "attr.href": "this.href" } }, usesOnChanges: true, ngImport: i0 });
5668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterLinkWithHref, decorators: [{
5645
5669
  type: Directive,
5646
5670
  args: [{ selector: 'a[routerLink],area[routerLink]' }]
5647
5671
  }], ctorParameters: function () { return [{ type: Router }, { type: ActivatedRoute }, { type: i3.LocationStrategy }]; }, propDecorators: { target: [{
@@ -5866,9 +5890,9 @@ class RouterLinkActive {
5866
5890
  this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn);
5867
5891
  }
5868
5892
  }
5869
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.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 });
5870
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.0", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5871
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterLinkActive, decorators: [{
5893
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }, { token: RouterLinkWithHref, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
5894
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0-next.1", type: RouterLinkActive, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }, { propertyName: "linksWithHrefs", predicate: RouterLinkWithHref, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
5895
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterLinkActive, decorators: [{
5872
5896
  type: Directive,
5873
5897
  args: [{
5874
5898
  selector: '[routerLinkActive]',
@@ -5971,9 +5995,9 @@ class DefaultTitleStrategy extends TitleStrategy {
5971
5995
  }
5972
5996
  }
5973
5997
  }
5974
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5975
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
5976
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5998
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
5999
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
6000
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
5977
6001
  type: Injectable,
5978
6002
  args: [{ providedIn: 'root' }]
5979
6003
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -6106,9 +6130,9 @@ class RouterPreloader {
6106
6130
  });
6107
6131
  }
6108
6132
  }
6109
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6110
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterPreloader });
6111
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterPreloader, decorators: [{
6133
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6134
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterPreloader });
6135
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterPreloader, decorators: [{
6112
6136
  type: Injectable
6113
6137
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6114
6138
 
@@ -6194,9 +6218,9 @@ class RouterScroller {
6194
6218
  }
6195
6219
  }
6196
6220
  }
6197
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6198
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterScroller });
6199
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterScroller, decorators: [{
6221
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6222
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterScroller });
6223
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterScroller, decorators: [{
6200
6224
  type: Injectable
6201
6225
  }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: undefined }]; } });
6202
6226
 
@@ -6338,10 +6362,10 @@ class RouterModule {
6338
6362
  return { ngModule: RouterModule, providers: [provideRoutes(routes)] };
6339
6363
  }
6340
6364
  }
6341
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6342
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6343
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterModule });
6344
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterModule, decorators: [{
6365
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }, { token: Router, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6366
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterModule, declarations: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent] });
6367
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterModule });
6368
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterModule, decorators: [{
6345
6369
  type: NgModule,
6346
6370
  args: [{
6347
6371
  declarations: ROUTER_DIRECTIVES,
@@ -6475,7 +6499,7 @@ class RouterInitializer {
6475
6499
  resolve(true);
6476
6500
  }
6477
6501
  else if (opts.initialNavigation === 'enabledBlocking') {
6478
- router.hooks.afterPreactivation = () => {
6502
+ router.afterPreactivation = () => {
6479
6503
  // only the initial navigation should be delayed
6480
6504
  if (!this.initNavigation) {
6481
6505
  this.initNavigation = true;
@@ -6484,7 +6508,7 @@ class RouterInitializer {
6484
6508
  // subsequent navigations should not be delayed
6485
6509
  }
6486
6510
  else {
6487
- return of(null);
6511
+ return of(void 0);
6488
6512
  }
6489
6513
  };
6490
6514
  router.initialNavigation();
@@ -6511,16 +6535,16 @@ class RouterInitializer {
6511
6535
  preloader.setUpPreloading();
6512
6536
  routerScroller.init();
6513
6537
  router.resetRootComponentType(ref.componentTypes[0]);
6514
- this.resultOfPreactivationDone.next(null);
6538
+ this.resultOfPreactivationDone.next(void 0);
6515
6539
  this.resultOfPreactivationDone.complete();
6516
6540
  }
6517
6541
  ngOnDestroy() {
6518
6542
  this.destroyed = true;
6519
6543
  }
6520
6544
  }
6521
- RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
6522
- RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterInitializer });
6523
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.0", ngImport: i0, type: RouterInitializer, decorators: [{
6545
+ RouterInitializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterInitializer, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
6546
+ RouterInitializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterInitializer });
6547
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0-next.1", ngImport: i0, type: RouterInitializer, decorators: [{
6524
6548
  type: Injectable
6525
6549
  }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
6526
6550
  function getAppInitializer(r) {
@@ -6560,7 +6584,7 @@ function provideRouterInitializer() {
6560
6584
  /**
6561
6585
  * @publicApi
6562
6586
  */
6563
- const VERSION = new Version('14.1.0-next.0');
6587
+ const VERSION = new Version('14.1.0-next.1');
6564
6588
 
6565
6589
  /**
6566
6590
  * @license