@angular/router 15.0.1 → 15.0.3

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 (36) hide show
  1. package/esm2020/src/components/empty_outlet.mjs +3 -3
  2. package/esm2020/src/deprecated_load_children.mjs +3 -1
  3. package/esm2020/src/directives/router_link.mjs +3 -3
  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/models.mjs +1 -1
  7. package/esm2020/src/navigation_transition.mjs +138 -78
  8. package/esm2020/src/page_title_strategy.mjs +6 -6
  9. package/esm2020/src/private_export.mjs +1 -2
  10. package/esm2020/src/provide_router.mjs +6 -7
  11. package/esm2020/src/route_reuse_strategy.mjs +6 -6
  12. package/esm2020/src/router.mjs +49 -147
  13. package/esm2020/src/router_config_loader.mjs +3 -3
  14. package/esm2020/src/router_module.mjs +11 -9
  15. package/esm2020/src/router_outlet_context.mjs +3 -3
  16. package/esm2020/src/router_preloader.mjs +9 -9
  17. package/esm2020/src/router_scroller.mjs +20 -21
  18. package/esm2020/src/router_state.mjs +1 -1
  19. package/esm2020/src/url_handling_strategy.mjs +6 -6
  20. package/esm2020/src/url_tree.mjs +4 -4
  21. package/esm2020/src/version.mjs +1 -1
  22. package/esm2020/testing/src/router_testing_module.mjs +47 -55
  23. package/fesm2015/router.mjs +400 -436
  24. package/fesm2015/router.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +48 -56
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2015/upgrade.mjs +1 -1
  28. package/fesm2020/router.mjs +394 -434
  29. package/fesm2020/router.mjs.map +1 -1
  30. package/fesm2020/testing.mjs +48 -56
  31. package/fesm2020/testing.mjs.map +1 -1
  32. package/fesm2020/upgrade.mjs +1 -1
  33. package/index.d.ts +16 -37
  34. package/package.json +4 -4
  35. package/testing/index.d.ts +1 -7
  36. package/upgrade/index.d.ts +1 -1
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v15.0.1
2
+ * @license Angular v15.0.3
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵisObservable, ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, Injector, Compiler, NgModuleRef, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
8
+ import { ɵisObservable, ɵisPromise, ɵRuntimeError, Injectable, EventEmitter, inject, ViewContainerRef, ChangeDetectorRef, EnvironmentInjector, Directive, Input, Output, Component, createEnvironmentInjector, ɵisStandalone, ComponentFactoryResolver, ɵisInjectable, InjectionToken, InjectFlags, NgModuleFactory, ɵConsole, NgZone, ɵcoerceToBoolean, ɵɵsanitizeUrlOrResourceUrl, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, APP_INITIALIZER, NgProbeToken, SkipSelf, NgModule, Inject, Version } from '@angular/core';
9
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
11
  import { Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';
@@ -461,9 +461,9 @@ function mapChildrenIntoArray(segment, fn) {
461
461
  */
462
462
  class UrlSerializer {
463
463
  }
464
- UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
- UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlSerializer, decorators: [{
464
+ UrlSerializer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlSerializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
465
+ UrlSerializer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlSerializer, providedIn: 'root', useFactory: () => new DefaultUrlSerializer() });
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlSerializer, decorators: [{
467
467
  type: Injectable,
468
468
  args: [{ providedIn: 'root', useFactory: () => new DefaultUrlSerializer() }]
469
469
  }] });
@@ -2386,9 +2386,9 @@ class ChildrenOutletContexts {
2386
2386
  return this.contexts.get(childName) || null;
2387
2387
  }
2388
2388
  }
2389
- ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2390
- ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2391
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2389
+ ChildrenOutletContexts.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ChildrenOutletContexts, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2390
+ ChildrenOutletContexts.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ChildrenOutletContexts, providedIn: 'root' });
2391
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ChildrenOutletContexts, decorators: [{
2392
2392
  type: Injectable,
2393
2393
  args: [{ providedIn: 'root' }]
2394
2394
  }] });
@@ -2609,9 +2609,9 @@ class RouterOutlet {
2609
2609
  this.activateEvents.emit(this.activated.instance);
2610
2610
  }
2611
2611
  }
2612
- RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2613
- RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2614
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterOutlet, decorators: [{
2612
+ RouterOutlet.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterOutlet, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2613
+ RouterOutlet.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: RouterOutlet, isStandalone: true, selector: "router-outlet", inputs: { name: "name" }, outputs: { activateEvents: "activate", deactivateEvents: "deactivate", attachEvents: "attach", detachEvents: "detach" }, exportAs: ["outlet"], usesOnChanges: true, ngImport: i0 });
2614
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterOutlet, decorators: [{
2615
2615
  type: Directive,
2616
2616
  args: [{
2617
2617
  selector: 'router-outlet',
@@ -2671,9 +2671,9 @@ function isComponentFactoryResolver(item) {
2671
2671
  */
2672
2672
  class ɵEmptyOutletComponent {
2673
2673
  }
2674
- ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2675
- ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.1", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2676
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2674
+ ɵEmptyOutletComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ɵEmptyOutletComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2675
+ ɵEmptyOutletComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.3", type: ɵEmptyOutletComponent, isStandalone: true, selector: "ng-component", ngImport: i0, template: `<router-outlet></router-outlet>`, isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
2676
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: ɵEmptyOutletComponent, decorators: [{
2677
2677
  type: Component,
2678
2678
  args: [{
2679
2679
  template: `<router-outlet></router-outlet>`,
@@ -4307,6 +4307,19 @@ function switchTap(next) {
4307
4307
  });
4308
4308
  }
4309
4309
 
4310
+ /**
4311
+ * @license
4312
+ * Copyright Google LLC All Rights Reserved.
4313
+ *
4314
+ * Use of this source code is governed by an MIT-style license that can be
4315
+ * found in the LICENSE file at https://angular.io/license
4316
+ */
4317
+ // This file exists to support the legacy `loadChildren: string` behavior being patched back into
4318
+ // Angular.
4319
+ function deprecatedLoadChildrenString(injector, loadChildren) {
4320
+ return null;
4321
+ }
4322
+
4310
4323
  /**
4311
4324
  * @license
4312
4325
  * Copyright Google LLC All Rights Reserved.
@@ -4315,16 +4328,188 @@ function switchTap(next) {
4315
4328
  * found in the LICENSE file at https://angular.io/license
4316
4329
  */
4317
4330
  const NG_DEV_MODE$5 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4331
+ /**
4332
+ * The [DI token](guide/glossary/#di-token) for a router configuration.
4333
+ *
4334
+ * `ROUTES` is a low level API for router configuration via dependency injection.
4335
+ *
4336
+ * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4337
+ * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4338
+ *
4339
+ * @publicApi
4340
+ */
4341
+ const ROUTES = new InjectionToken('ROUTES');
4342
+ class RouterConfigLoader {
4343
+ constructor(injector, compiler) {
4344
+ this.injector = injector;
4345
+ this.compiler = compiler;
4346
+ this.componentLoaders = new WeakMap();
4347
+ this.childrenLoaders = new WeakMap();
4348
+ }
4349
+ loadComponent(route) {
4350
+ if (this.componentLoaders.get(route)) {
4351
+ return this.componentLoaders.get(route);
4352
+ }
4353
+ else if (route._loadedComponent) {
4354
+ return of(route._loadedComponent);
4355
+ }
4356
+ if (this.onLoadStartListener) {
4357
+ this.onLoadStartListener(route);
4358
+ }
4359
+ const loadRunner = wrapIntoObservable(route.loadComponent())
4360
+ .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4361
+ var _a;
4362
+ if (this.onLoadEndListener) {
4363
+ this.onLoadEndListener(route);
4364
+ }
4365
+ NG_DEV_MODE$5 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4366
+ route._loadedComponent = component;
4367
+ }), finalize(() => {
4368
+ this.componentLoaders.delete(route);
4369
+ }));
4370
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4371
+ const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4372
+ this.componentLoaders.set(route, loader);
4373
+ return loader;
4374
+ }
4375
+ loadChildren(parentInjector, route) {
4376
+ if (this.childrenLoaders.get(route)) {
4377
+ return this.childrenLoaders.get(route);
4378
+ }
4379
+ else if (route._loadedRoutes) {
4380
+ return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4381
+ }
4382
+ if (this.onLoadStartListener) {
4383
+ this.onLoadStartListener(route);
4384
+ }
4385
+ const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4386
+ const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4387
+ if (this.onLoadEndListener) {
4388
+ this.onLoadEndListener(route);
4389
+ }
4390
+ // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4391
+ // injector associated with lazy loading a `Route` array.
4392
+ let injector;
4393
+ let rawRoutes;
4394
+ let requireStandaloneComponents = false;
4395
+ if (Array.isArray(factoryOrRoutes)) {
4396
+ rawRoutes = factoryOrRoutes;
4397
+ requireStandaloneComponents = true;
4398
+ }
4399
+ else {
4400
+ injector = factoryOrRoutes.create(parentInjector).injector;
4401
+ // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4402
+ // will get stuck in an infinite loop. The child module's Injector will look to
4403
+ // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4404
+ // for it's parent module instead.
4405
+ rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4406
+ }
4407
+ const routes = rawRoutes.map(standardizeConfig);
4408
+ NG_DEV_MODE$5 && validateConfig(routes, route.path, requireStandaloneComponents);
4409
+ return { routes, injector };
4410
+ }), finalize(() => {
4411
+ this.childrenLoaders.delete(route);
4412
+ }));
4413
+ // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4414
+ const loader = new ConnectableObservable(loadRunner, () => new Subject())
4415
+ .pipe(refCount());
4416
+ this.childrenLoaders.set(route, loader);
4417
+ return loader;
4418
+ }
4419
+ loadModuleFactoryOrRoutes(loadChildren) {
4420
+ const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4421
+ if (deprecatedResult) {
4422
+ return deprecatedResult;
4423
+ }
4424
+ return wrapIntoObservable(loadChildren())
4425
+ .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4426
+ if (t instanceof NgModuleFactory || Array.isArray(t)) {
4427
+ return of(t);
4428
+ }
4429
+ else {
4430
+ return from(this.compiler.compileModuleAsync(t));
4431
+ }
4432
+ }));
4433
+ }
4434
+ }
4435
+ RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4436
+ RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterConfigLoader, decorators: [{
4438
+ type: Injectable,
4439
+ args: [{ providedIn: 'root' }]
4440
+ }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4441
+ function isWrappedDefaultExport(value) {
4442
+ // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4443
+ // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4444
+ // `default` will be a renamed property.
4445
+ return value && typeof value === 'object' && 'default' in value;
4446
+ }
4447
+ function maybeUnwrapDefaultExport(input) {
4448
+ // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4449
+ // subject to property renaming, so we reference it with bracket access.
4450
+ return isWrappedDefaultExport(input) ? input['default'] : input;
4451
+ }
4452
+
4453
+ /**
4454
+ * @license
4455
+ * Copyright Google LLC All Rights Reserved.
4456
+ *
4457
+ * Use of this source code is governed by an MIT-style license that can be
4458
+ * found in the LICENSE file at https://angular.io/license
4459
+ */
4460
+ const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4318
4461
  class NavigationTransitions {
4319
- constructor(router) {
4320
- this.router = router;
4462
+ constructor() {
4321
4463
  this.currentNavigation = null;
4464
+ this.lastSuccessfulNavigation = null;
4465
+ this.events = new Subject();
4466
+ this.configLoader = inject(RouterConfigLoader);
4467
+ this.environmentInjector = inject(EnvironmentInjector);
4468
+ this.urlSerializer = inject(UrlSerializer);
4469
+ this.rootContexts = inject(ChildrenOutletContexts);
4470
+ this.navigationId = 0;
4471
+ const onLoadStart = (r) => this.events.next(new RouteConfigLoadStart(r));
4472
+ const onLoadEnd = (r) => this.events.next(new RouteConfigLoadEnd(r));
4473
+ this.configLoader.onLoadEndListener = onLoadEnd;
4474
+ this.configLoader.onLoadStartListener = onLoadStart;
4475
+ }
4476
+ get hasRequestedNavigation() {
4477
+ return this.navigationId !== 0;
4322
4478
  }
4323
- setupNavigations(transitions) {
4324
- const eventsSubject = this.router.events;
4325
- return transitions.pipe(filter(t => t.id !== 0),
4479
+ complete() {
4480
+ var _a;
4481
+ (_a = this.transitions) === null || _a === void 0 ? void 0 : _a.complete();
4482
+ }
4483
+ handleNavigationRequest(request) {
4484
+ var _a;
4485
+ const id = ++this.navigationId;
4486
+ (_a = this.transitions) === null || _a === void 0 ? void 0 : _a.next(Object.assign(Object.assign(Object.assign({}, this.transitions.value), request), { id }));
4487
+ }
4488
+ setupNavigations(router) {
4489
+ this.transitions = new BehaviorSubject({
4490
+ id: 0,
4491
+ targetPageId: 0,
4492
+ currentUrlTree: router.currentUrlTree,
4493
+ currentRawUrl: router.currentUrlTree,
4494
+ extractedUrl: router.urlHandlingStrategy.extract(router.currentUrlTree),
4495
+ urlAfterRedirects: router.urlHandlingStrategy.extract(router.currentUrlTree),
4496
+ rawUrl: router.currentUrlTree,
4497
+ extras: {},
4498
+ resolve: null,
4499
+ reject: null,
4500
+ promise: Promise.resolve(true),
4501
+ source: 'imperative',
4502
+ restoredState: null,
4503
+ currentSnapshot: router.routerState.snapshot,
4504
+ targetSnapshot: null,
4505
+ currentRouterState: router.routerState,
4506
+ targetRouterState: null,
4507
+ guards: { canActivateChecks: [], canDeactivateChecks: [] },
4508
+ guardsResult: null,
4509
+ });
4510
+ return this.transitions.pipe(filter(t => t.id !== 0),
4326
4511
  // Extract URL
4327
- map(t => (Object.assign(Object.assign({}, t), { extractedUrl: this.router.urlHandlingStrategy.extract(t.rawUrl) }))),
4512
+ map(t => (Object.assign(Object.assign({}, t), { extractedUrl: router.urlHandlingStrategy.extract(t.rawUrl) }))),
4328
4513
  // Using switchMap so we cancel executing navigations when a new one comes in
4329
4514
  switchMap(overallTransitionState => {
4330
4515
  let completed = false;
@@ -4339,32 +4524,32 @@ class NavigationTransitions {
4339
4524
  extractedUrl: t.extractedUrl,
4340
4525
  trigger: t.source,
4341
4526
  extras: t.extras,
4342
- previousNavigation: !this.router.lastSuccessfulNavigation ? null : Object.assign(Object.assign({}, this.router.lastSuccessfulNavigation), { previousNavigation: null }),
4527
+ previousNavigation: !this.lastSuccessfulNavigation ? null : Object.assign(Object.assign({}, this.lastSuccessfulNavigation), { previousNavigation: null }),
4343
4528
  };
4344
4529
  }), switchMap(t => {
4345
- const browserUrlTree = this.router.browserUrlTree.toString();
4346
- const urlTransition = !this.router.navigated ||
4530
+ const browserUrlTree = router.browserUrlTree.toString();
4531
+ const urlTransition = !router.navigated ||
4347
4532
  t.extractedUrl.toString() !== browserUrlTree ||
4348
4533
  // Navigations which succeed or ones which fail and are cleaned up
4349
4534
  // correctly should result in `browserUrlTree` and `currentUrlTree`
4350
4535
  // matching. If this is not the case, assume something went wrong and
4351
4536
  // try processing the URL again.
4352
- browserUrlTree !== this.router.currentUrlTree.toString();
4353
- const processCurrentUrl = (this.router.onSameUrlNavigation === 'reload' ? true :
4354
- urlTransition) &&
4355
- this.router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4537
+ browserUrlTree !== router.currentUrlTree.toString();
4538
+ const processCurrentUrl = (router.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
4539
+ router.urlHandlingStrategy.shouldProcessUrl(t.rawUrl);
4356
4540
  if (processCurrentUrl) {
4357
4541
  // If the source of the navigation is from a browser event, the URL is
4358
4542
  // already updated. We already need to sync the internal state.
4359
4543
  if (isBrowserTriggeredNavigation(t.source)) {
4360
- this.router.browserUrlTree = t.extractedUrl;
4544
+ router.browserUrlTree = t.extractedUrl;
4361
4545
  }
4362
4546
  return of(t).pipe(
4363
4547
  // Fire NavigationStart event
4364
4548
  switchMap(t => {
4365
- const transition = this.router.transitions.getValue();
4366
- eventsSubject.next(new NavigationStart(t.id, this.router.serializeUrl(t.extractedUrl), t.source, t.restoredState));
4367
- if (transition !== this.router.transitions.getValue()) {
4549
+ var _a, _b;
4550
+ const transition = (_a = this.transitions) === null || _a === void 0 ? void 0 : _a.getValue();
4551
+ this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));
4552
+ if (transition !== ((_b = this.transitions) === null || _b === void 0 ? void 0 : _b.getValue())) {
4368
4553
  return EMPTY;
4369
4554
  }
4370
4555
  // This delay is required to match old behavior that forced
@@ -4372,7 +4557,7 @@ class NavigationTransitions {
4372
4557
  return Promise.resolve(t);
4373
4558
  }),
4374
4559
  // ApplyRedirects
4375
- applyRedirects(this.router.ngModule.injector, this.router.configLoader, this.router.urlSerializer, this.router.config),
4560
+ applyRedirects(this.environmentInjector, this.configLoader, this.urlSerializer, router.config),
4376
4561
  // Update the currentNavigation
4377
4562
  // `urlAfterRedirects` is guaranteed to be set after this point
4378
4563
  tap(t => {
@@ -4380,33 +4565,33 @@ class NavigationTransitions {
4380
4565
  overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;
4381
4566
  }),
4382
4567
  // Recognize
4383
- recognize(this.router.ngModule.injector, this.router.rootComponentType, this.router.config, this.router.urlSerializer, this.router.paramsInheritanceStrategy),
4568
+ recognize(this.environmentInjector, router.rootComponentType, router.config, this.urlSerializer, router.paramsInheritanceStrategy),
4384
4569
  // Update URL if in `eager` update mode
4385
4570
  tap(t => {
4386
4571
  overallTransitionState.targetSnapshot = t.targetSnapshot;
4387
- if (this.router.urlUpdateStrategy === 'eager') {
4572
+ if (router.urlUpdateStrategy === 'eager') {
4388
4573
  if (!t.extras.skipLocationChange) {
4389
- const rawUrl = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4390
- this.router.setBrowserUrl(rawUrl, t);
4574
+ const rawUrl = router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4575
+ router.setBrowserUrl(rawUrl, t);
4391
4576
  }
4392
- this.router.browserUrlTree = t.urlAfterRedirects;
4577
+ router.browserUrlTree = t.urlAfterRedirects;
4393
4578
  }
4394
4579
  // Fire RoutesRecognized
4395
- const routesRecognized = new RoutesRecognized(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4396
- eventsSubject.next(routesRecognized);
4580
+ const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4581
+ this.events.next(routesRecognized);
4397
4582
  }));
4398
4583
  }
4399
4584
  else {
4400
- const processPreviousUrl = urlTransition && this.router.rawUrlTree &&
4401
- this.router.urlHandlingStrategy.shouldProcessUrl(this.router.rawUrlTree);
4585
+ const processPreviousUrl = urlTransition && router.rawUrlTree &&
4586
+ router.urlHandlingStrategy.shouldProcessUrl(router.rawUrlTree);
4402
4587
  /* When the current URL shouldn't be processed, but the previous one
4403
4588
  * was, we handle this "error condition" by navigating to the
4404
4589
  * previously successful URL, but leaving the URL intact.*/
4405
4590
  if (processPreviousUrl) {
4406
4591
  const { id, extractedUrl, source, restoredState, extras } = t;
4407
- const navStart = new NavigationStart(id, this.router.serializeUrl(extractedUrl), source, restoredState);
4408
- eventsSubject.next(navStart);
4409
- const targetSnapshot = createEmptyState(extractedUrl, this.router.rootComponentType)
4592
+ const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);
4593
+ this.events.next(navStart);
4594
+ const targetSnapshot = createEmptyState(extractedUrl, router.rootComponentType)
4410
4595
  .snapshot;
4411
4596
  overallTransitionState = Object.assign(Object.assign({}, t), { targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign(Object.assign({}, extras), { skipLocationChange: false, replaceUrl: false }) });
4412
4597
  return of(overallTransitionState);
@@ -4417,7 +4602,7 @@ class NavigationTransitions {
4417
4602
  * current "settled" URL. This way the next navigation will be coming
4418
4603
  * from the current URL in the browser.
4419
4604
  */
4420
- this.router.rawUrlTree = t.rawUrl;
4605
+ router.rawUrlTree = t.rawUrl;
4421
4606
  t.resolve(null);
4422
4607
  return EMPTY;
4423
4608
  }
@@ -4425,22 +4610,22 @@ class NavigationTransitions {
4425
4610
  }),
4426
4611
  // --- GUARDS ---
4427
4612
  tap(t => {
4428
- const guardsStart = new GuardsCheckStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4429
- this.router.triggerEvent(guardsStart);
4613
+ const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4614
+ this.events.next(guardsStart);
4430
4615
  }), map(t => {
4431
- overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.router.rootContexts) });
4616
+ overallTransitionState = Object.assign(Object.assign({}, t), { guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts) });
4432
4617
  return overallTransitionState;
4433
- }), checkGuards(this.router.ngModule.injector, (evt) => this.router.triggerEvent(evt)), tap(t => {
4618
+ }), checkGuards(this.environmentInjector, (evt) => this.events.next(evt)), tap(t => {
4434
4619
  overallTransitionState.guardsResult = t.guardsResult;
4435
4620
  if (isUrlTree(t.guardsResult)) {
4436
- throw redirectingNavigationError(this.router.urlSerializer, t.guardsResult);
4621
+ throw redirectingNavigationError(this.urlSerializer, t.guardsResult);
4437
4622
  }
4438
- const guardsEnd = new GuardsCheckEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4439
- this.router.triggerEvent(guardsEnd);
4623
+ const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);
4624
+ this.events.next(guardsEnd);
4440
4625
  }), filter(t => {
4441
4626
  if (!t.guardsResult) {
4442
- this.router.restoreHistory(t);
4443
- this.router.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */);
4627
+ router.restoreHistory(t);
4628
+ this.cancelNavigationTransition(t, '', 3 /* NavigationCancellationCode.GuardRejected */, router);
4444
4629
  return false;
4445
4630
  }
4446
4631
  return true;
@@ -4449,24 +4634,24 @@ class NavigationTransitions {
4449
4634
  switchTap(t => {
4450
4635
  if (t.guards.canActivateChecks.length) {
4451
4636
  return of(t).pipe(tap(t => {
4452
- const resolveStart = new ResolveStart(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4453
- this.router.triggerEvent(resolveStart);
4637
+ const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4638
+ this.events.next(resolveStart);
4454
4639
  }), switchMap(t => {
4455
4640
  let dataResolved = false;
4456
- return of(t).pipe(resolveData(this.router.paramsInheritanceStrategy, this.router.ngModule.injector), tap({
4641
+ return of(t).pipe(resolveData(router.paramsInheritanceStrategy, this.environmentInjector), tap({
4457
4642
  next: () => dataResolved = true,
4458
4643
  complete: () => {
4459
4644
  if (!dataResolved) {
4460
- this.router.restoreHistory(t);
4461
- this.router.cancelNavigationTransition(t, NG_DEV_MODE$5 ?
4645
+ router.restoreHistory(t);
4646
+ this.cancelNavigationTransition(t, NG_DEV_MODE$4 ?
4462
4647
  `At least one route resolver didn't emit any value.` :
4463
- '', 2 /* NavigationCancellationCode.NoDataFromResolver */);
4648
+ '', 2 /* NavigationCancellationCode.NoDataFromResolver */, router);
4464
4649
  }
4465
4650
  }
4466
4651
  }));
4467
4652
  }), tap(t => {
4468
- const resolveEnd = new ResolveEnd(t.id, this.router.serializeUrl(t.extractedUrl), this.router.serializeUrl(t.urlAfterRedirects), t.targetSnapshot);
4469
- this.router.triggerEvent(resolveEnd);
4653
+ const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);
4654
+ this.events.next(resolveEnd);
4470
4655
  }));
4471
4656
  }
4472
4657
  return undefined;
@@ -4478,7 +4663,7 @@ class NavigationTransitions {
4478
4663
  const loaders = [];
4479
4664
  if (((_a = route.routeConfig) === null || _a === void 0 ? void 0 : _a.loadComponent) &&
4480
4665
  !route.routeConfig._loadedComponent) {
4481
- loaders.push(this.router.configLoader.loadComponent(route.routeConfig)
4666
+ loaders.push(this.configLoader.loadComponent(route.routeConfig)
4482
4667
  .pipe(tap(loadedComponent => {
4483
4668
  route.component = loadedComponent;
4484
4669
  }), map(() => void 0)));
@@ -4490,8 +4675,8 @@ class NavigationTransitions {
4490
4675
  };
4491
4676
  return combineLatest(loadComponents(t.targetSnapshot.root))
4492
4677
  .pipe(defaultIfEmpty(), take(1));
4493
- }), switchTap(() => this.router.afterPreactivation()), map((t) => {
4494
- const targetRouterState = createRouterState(this.router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4678
+ }), switchTap(() => router.afterPreactivation()), map((t) => {
4679
+ const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);
4495
4680
  overallTransitionState = Object.assign(Object.assign({}, t), { targetRouterState });
4496
4681
  return (overallTransitionState);
4497
4682
  }),
@@ -4501,21 +4686,28 @@ class NavigationTransitions {
4501
4686
  the current URL and the RouterState, as well as updated the browser URL.
4502
4687
  All this should happen *before* activating. */
4503
4688
  tap((t) => {
4504
- this.router.currentUrlTree = t.urlAfterRedirects;
4505
- this.router.rawUrlTree = this.router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4506
- this.router.routerState =
4689
+ router.currentUrlTree = t.urlAfterRedirects;
4690
+ router.rawUrlTree =
4691
+ router.urlHandlingStrategy.merge(t.urlAfterRedirects, t.rawUrl);
4692
+ router.routerState =
4507
4693
  t.targetRouterState;
4508
- if (this.router.urlUpdateStrategy === 'deferred') {
4694
+ if (router.urlUpdateStrategy === 'deferred') {
4509
4695
  if (!t.extras.skipLocationChange) {
4510
- this.router.setBrowserUrl(this.router.rawUrlTree, t);
4696
+ router.setBrowserUrl(router.rawUrlTree, t);
4511
4697
  }
4512
- this.router.browserUrlTree = t.urlAfterRedirects;
4698
+ router.browserUrlTree = t.urlAfterRedirects;
4513
4699
  }
4514
- }), activateRoutes(this.router.rootContexts, this.router.routeReuseStrategy, (evt) => this.router.triggerEvent(evt)), tap({
4515
- next() {
4700
+ }), activateRoutes(this.rootContexts, router.routeReuseStrategy, (evt) => this.events.next(evt)), tap({
4701
+ next: (t) => {
4702
+ var _a;
4516
4703
  completed = true;
4704
+ this.lastSuccessfulNavigation = this.currentNavigation;
4705
+ router.navigated = true;
4706
+ this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(router.currentUrlTree)));
4707
+ (_a = router.titleStrategy) === null || _a === void 0 ? void 0 : _a.updateTitle(t.targetRouterState.snapshot);
4708
+ t.resolve(true);
4517
4709
  },
4518
- complete() {
4710
+ complete: () => {
4519
4711
  completed = true;
4520
4712
  }
4521
4713
  }), finalize(() => {
@@ -4527,11 +4719,11 @@ class NavigationTransitions {
4527
4719
  * catch-all to make sure the NavigationCancel event is fired when a
4528
4720
  * navigation gets cancelled but not caught by other means. */
4529
4721
  if (!completed && !errored) {
4530
- const cancelationReason = NG_DEV_MODE$5 ?
4722
+ const cancelationReason = NG_DEV_MODE$4 ?
4531
4723
  `Navigation ID ${overallTransitionState
4532
- .id} is not equal to the current navigation id ${this.router.navigationId}` :
4724
+ .id} is not equal to the current navigation id ${this.navigationId}` :
4533
4725
  '';
4534
- this.router.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */);
4726
+ this.cancelNavigationTransition(overallTransitionState, cancelationReason, 1 /* NavigationCancellationCode.SupersededByNewNavigation */, router);
4535
4727
  }
4536
4728
  // Only clear current navigation if it is still set to the one that
4537
4729
  // finalized.
@@ -4551,28 +4743,28 @@ class NavigationTransitions {
4551
4743
  // navigate. This is only applicable with initial navigation, so
4552
4744
  // setting `navigated` only when not redirecting resolves this
4553
4745
  // scenario.
4554
- this.router.navigated = true;
4555
- this.router.restoreHistory(overallTransitionState, true);
4746
+ router.navigated = true;
4747
+ router.restoreHistory(overallTransitionState, true);
4556
4748
  }
4557
- const navCancel = new NavigationCancel(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4558
- eventsSubject.next(navCancel);
4749
+ const navCancel = new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode);
4750
+ this.events.next(navCancel);
4559
4751
  // When redirecting, we need to delay resolving the navigation
4560
4752
  // promise and push it to the redirect navigation
4561
4753
  if (!isRedirectingNavigationCancelingError$1(e)) {
4562
4754
  overallTransitionState.resolve(false);
4563
4755
  }
4564
4756
  else {
4565
- const mergedTree = this.router.urlHandlingStrategy.merge(e.url, this.router.rawUrlTree);
4757
+ const mergedTree = router.urlHandlingStrategy.merge(e.url, router.rawUrlTree);
4566
4758
  const extras = {
4567
4759
  skipLocationChange: overallTransitionState.extras.skipLocationChange,
4568
4760
  // The URL is already updated at this point if we have 'eager' URL
4569
4761
  // updates or if the navigation was triggered by the browser (back
4570
4762
  // button, URL bar, etc). We want to replace that item in history
4571
4763
  // if the navigation is rejected.
4572
- replaceUrl: this.router.urlUpdateStrategy === 'eager' ||
4764
+ replaceUrl: router.urlUpdateStrategy === 'eager' ||
4573
4765
  isBrowserTriggeredNavigation(overallTransitionState.source)
4574
4766
  };
4575
- this.router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4767
+ router.scheduleNavigation(mergedTree, 'imperative', null, extras, {
4576
4768
  resolve: overallTransitionState.resolve,
4577
4769
  reject: overallTransitionState.reject,
4578
4770
  promise: overallTransitionState.promise
@@ -4582,11 +4774,11 @@ class NavigationTransitions {
4582
4774
  * to the pre-error state. */
4583
4775
  }
4584
4776
  else {
4585
- this.router.restoreHistory(overallTransitionState, true);
4586
- const navError = new NavigationError(overallTransitionState.id, this.router.serializeUrl(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4587
- eventsSubject.next(navError);
4777
+ router.restoreHistory(overallTransitionState, true);
4778
+ const navError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, (_a = overallTransitionState.targetSnapshot) !== null && _a !== void 0 ? _a : undefined);
4779
+ this.events.next(navError);
4588
4780
  try {
4589
- overallTransitionState.resolve(this.router.errorHandler(e));
4781
+ overallTransitionState.resolve(router.errorHandler(e));
4590
4782
  }
4591
4783
  catch (ee) {
4592
4784
  overallTransitionState.reject(ee);
@@ -4597,7 +4789,18 @@ class NavigationTransitions {
4597
4789
  // TODO(jasonaden): remove cast once g3 is on updated TypeScript
4598
4790
  }));
4599
4791
  }
4792
+ cancelNavigationTransition(t, reason, code, router) {
4793
+ const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);
4794
+ this.events.next(navCancel);
4795
+ t.resolve(false);
4796
+ }
4600
4797
  }
4798
+ NavigationTransitions.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NavigationTransitions, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4799
+ NavigationTransitions.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NavigationTransitions, providedIn: 'root' });
4800
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NavigationTransitions, decorators: [{
4801
+ type: Injectable,
4802
+ args: [{ providedIn: 'root' }]
4803
+ }], ctorParameters: function () { return []; } });
4601
4804
  function isBrowserTriggeredNavigation(source) {
4602
4805
  return source !== 'imperative';
4603
4806
  }
@@ -4654,9 +4857,9 @@ class TitleStrategy {
4654
4857
  return snapshot.data[RouteTitleKey];
4655
4858
  }
4656
4859
  }
4657
- TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4658
- TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4659
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: TitleStrategy, decorators: [{
4860
+ TitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TitleStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4861
+ TitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TitleStrategy, providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) });
4862
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: TitleStrategy, decorators: [{
4660
4863
  type: Injectable,
4661
4864
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultTitleStrategy) }]
4662
4865
  }] });
@@ -4680,9 +4883,9 @@ class DefaultTitleStrategy extends TitleStrategy {
4680
4883
  }
4681
4884
  }
4682
4885
  }
4683
- DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4684
- DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4685
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4886
+ DefaultTitleStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultTitleStrategy, deps: [{ token: i1.Title }], target: i0.ɵɵFactoryTarget.Injectable });
4887
+ DefaultTitleStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultTitleStrategy, providedIn: 'root' });
4888
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultTitleStrategy, decorators: [{
4686
4889
  type: Injectable,
4687
4890
  args: [{ providedIn: 'root' }]
4688
4891
  }], ctorParameters: function () { return [{ type: i1.Title }]; } });
@@ -4703,9 +4906,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4703
4906
  */
4704
4907
  class RouteReuseStrategy {
4705
4908
  }
4706
- RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4707
- RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4708
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4909
+ RouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouteReuseStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4910
+ RouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouteReuseStrategy, providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) });
4911
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouteReuseStrategy, decorators: [{
4709
4912
  type: Injectable,
4710
4913
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultRouteReuseStrategy) }]
4711
4914
  }] });
@@ -4757,9 +4960,9 @@ class BaseRouteReuseStrategy {
4757
4960
  }
4758
4961
  class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {
4759
4962
  }
4760
- DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4761
- DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4762
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4963
+ DefaultRouteReuseStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultRouteReuseStrategy, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
4964
+ DefaultRouteReuseStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultRouteReuseStrategy, providedIn: 'root' });
4965
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultRouteReuseStrategy, decorators: [{
4763
4966
  type: Injectable,
4764
4967
  args: [{ providedIn: 'root' }]
4765
4968
  }] });
@@ -4771,158 +4974,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImpor
4771
4974
  * Use of this source code is governed by an MIT-style license that can be
4772
4975
  * found in the LICENSE file at https://angular.io/license
4773
4976
  */
4774
- const NG_DEV_MODE$4 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4977
+ const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4775
4978
  /**
4776
4979
  * A [DI token](guide/glossary/#di-token) for the router service.
4777
4980
  *
4778
4981
  * @publicApi
4779
4982
  */
4780
- const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$4 ? 'router config' : '', {
4983
+ const ROUTER_CONFIGURATION = new InjectionToken(NG_DEV_MODE$3 ? 'router config' : '', {
4781
4984
  providedIn: 'root',
4782
4985
  factory: () => ({}),
4783
4986
  });
4784
4987
 
4785
- /**
4786
- * @license
4787
- * Copyright Google LLC All Rights Reserved.
4788
- *
4789
- * Use of this source code is governed by an MIT-style license that can be
4790
- * found in the LICENSE file at https://angular.io/license
4791
- */
4792
- function deprecatedLoadChildrenString(injector, loadChildren) {
4793
- return null;
4794
- }
4795
-
4796
- /**
4797
- * @license
4798
- * Copyright Google LLC All Rights Reserved.
4799
- *
4800
- * Use of this source code is governed by an MIT-style license that can be
4801
- * found in the LICENSE file at https://angular.io/license
4802
- */
4803
- const NG_DEV_MODE$3 = typeof ngDevMode === 'undefined' || !!ngDevMode;
4804
- /**
4805
- * The [DI token](guide/glossary/#di-token) for a router configuration.
4806
- *
4807
- * `ROUTES` is a low level API for router configuration via dependency injection.
4808
- *
4809
- * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,
4810
- * `RouterModule.forChild()`, `provideRoutes`, or `Router.resetConfig()`.
4811
- *
4812
- * @publicApi
4813
- */
4814
- const ROUTES = new InjectionToken('ROUTES');
4815
- class RouterConfigLoader {
4816
- constructor(injector, compiler) {
4817
- this.injector = injector;
4818
- this.compiler = compiler;
4819
- this.componentLoaders = new WeakMap();
4820
- this.childrenLoaders = new WeakMap();
4821
- }
4822
- loadComponent(route) {
4823
- if (this.componentLoaders.get(route)) {
4824
- return this.componentLoaders.get(route);
4825
- }
4826
- else if (route._loadedComponent) {
4827
- return of(route._loadedComponent);
4828
- }
4829
- if (this.onLoadStartListener) {
4830
- this.onLoadStartListener(route);
4831
- }
4832
- const loadRunner = wrapIntoObservable(route.loadComponent())
4833
- .pipe(map(maybeUnwrapDefaultExport), tap(component => {
4834
- var _a;
4835
- if (this.onLoadEndListener) {
4836
- this.onLoadEndListener(route);
4837
- }
4838
- NG_DEV_MODE$3 && assertStandalone((_a = route.path) !== null && _a !== void 0 ? _a : '', component);
4839
- route._loadedComponent = component;
4840
- }), finalize(() => {
4841
- this.componentLoaders.delete(route);
4842
- }));
4843
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4844
- const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());
4845
- this.componentLoaders.set(route, loader);
4846
- return loader;
4847
- }
4848
- loadChildren(parentInjector, route) {
4849
- if (this.childrenLoaders.get(route)) {
4850
- return this.childrenLoaders.get(route);
4851
- }
4852
- else if (route._loadedRoutes) {
4853
- return of({ routes: route._loadedRoutes, injector: route._loadedInjector });
4854
- }
4855
- if (this.onLoadStartListener) {
4856
- this.onLoadStartListener(route);
4857
- }
4858
- const moduleFactoryOrRoutes$ = this.loadModuleFactoryOrRoutes(route.loadChildren);
4859
- const loadRunner = moduleFactoryOrRoutes$.pipe(map((factoryOrRoutes) => {
4860
- if (this.onLoadEndListener) {
4861
- this.onLoadEndListener(route);
4862
- }
4863
- // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is no
4864
- // injector associated with lazy loading a `Route` array.
4865
- let injector;
4866
- let rawRoutes;
4867
- let requireStandaloneComponents = false;
4868
- if (Array.isArray(factoryOrRoutes)) {
4869
- rawRoutes = factoryOrRoutes;
4870
- requireStandaloneComponents = true;
4871
- }
4872
- else {
4873
- injector = factoryOrRoutes.create(parentInjector).injector;
4874
- // When loading a module that doesn't provide `RouterModule.forChild()` preloader
4875
- // will get stuck in an infinite loop. The child module's Injector will look to
4876
- // its parent `Injector` when it doesn't find any ROUTES so it will return routes
4877
- // for it's parent module instead.
4878
- rawRoutes = flatten(injector.get(ROUTES, [], InjectFlags.Self | InjectFlags.Optional));
4879
- }
4880
- const routes = rawRoutes.map(standardizeConfig);
4881
- NG_DEV_MODE$3 && validateConfig(routes, route.path, requireStandaloneComponents);
4882
- return { routes, injector };
4883
- }), finalize(() => {
4884
- this.childrenLoaders.delete(route);
4885
- }));
4886
- // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much
4887
- const loader = new ConnectableObservable(loadRunner, () => new Subject())
4888
- .pipe(refCount());
4889
- this.childrenLoaders.set(route, loader);
4890
- return loader;
4891
- }
4892
- loadModuleFactoryOrRoutes(loadChildren) {
4893
- const deprecatedResult = deprecatedLoadChildrenString(this.injector, loadChildren);
4894
- if (deprecatedResult) {
4895
- return deprecatedResult;
4896
- }
4897
- return wrapIntoObservable(loadChildren())
4898
- .pipe(map(maybeUnwrapDefaultExport), mergeMap((t) => {
4899
- if (t instanceof NgModuleFactory || Array.isArray(t)) {
4900
- return of(t);
4901
- }
4902
- else {
4903
- return from(this.compiler.compileModuleAsync(t));
4904
- }
4905
- }));
4906
- }
4907
- }
4908
- RouterConfigLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, deps: [{ token: i0.Injector }, { token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
4909
- RouterConfigLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, providedIn: 'root' });
4910
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterConfigLoader, decorators: [{
4911
- type: Injectable,
4912
- args: [{ providedIn: 'root' }]
4913
- }], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }]; } });
4914
- function isWrappedDefaultExport(value) {
4915
- // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be
4916
- // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that
4917
- // `default` will be a renamed property.
4918
- return value && typeof value === 'object' && 'default' in value;
4919
- }
4920
- function maybeUnwrapDefaultExport(input) {
4921
- // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not
4922
- // subject to property renaming, so we reference it with bracket access.
4923
- return isWrappedDefaultExport(input) ? input['default'] : input;
4924
- }
4925
-
4926
4988
  /**
4927
4989
  * @license
4928
4990
  * Copyright Google LLC All Rights Reserved.
@@ -4939,9 +5001,9 @@ function maybeUnwrapDefaultExport(input) {
4939
5001
  */
4940
5002
  class UrlHandlingStrategy {
4941
5003
  }
4942
- UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4943
- UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
4944
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
5004
+ UrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5005
+ UrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlHandlingStrategy, providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) });
5006
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: UrlHandlingStrategy, decorators: [{
4945
5007
  type: Injectable,
4946
5008
  args: [{ providedIn: 'root', useFactory: () => inject(DefaultUrlHandlingStrategy) }]
4947
5009
  }] });
@@ -4959,9 +5021,9 @@ class DefaultUrlHandlingStrategy {
4959
5021
  return newUrlPart;
4960
5022
  }
4961
5023
  }
4962
- DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
4963
- DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
4964
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
5024
+ DefaultUrlHandlingStrategy.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultUrlHandlingStrategy, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5025
+ DefaultUrlHandlingStrategy.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultUrlHandlingStrategy, providedIn: 'root' });
5026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: DefaultUrlHandlingStrategy, decorators: [{
4965
5027
  type: Injectable,
4966
5028
  args: [{ providedIn: 'root' }]
4967
5029
  }] });
@@ -5000,39 +5062,6 @@ const subsetMatchOptions = {
5000
5062
  matrixParams: 'ignored',
5001
5063
  queryParams: 'subset'
5002
5064
  };
5003
- function assignExtraOptionsToRouter(opts, router) {
5004
- if (opts.errorHandler) {
5005
- router.errorHandler = opts.errorHandler;
5006
- }
5007
- if (opts.malformedUriErrorHandler) {
5008
- router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
5009
- }
5010
- if (opts.onSameUrlNavigation) {
5011
- router.onSameUrlNavigation = opts.onSameUrlNavigation;
5012
- }
5013
- if (opts.paramsInheritanceStrategy) {
5014
- router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
5015
- }
5016
- if (opts.urlUpdateStrategy) {
5017
- router.urlUpdateStrategy = opts.urlUpdateStrategy;
5018
- }
5019
- if (opts.canceledNavigationResolution) {
5020
- router.canceledNavigationResolution = opts.canceledNavigationResolution;
5021
- }
5022
- }
5023
- function setupRouter() {
5024
- var _a, _b;
5025
- const urlSerializer = inject(UrlSerializer);
5026
- const contexts = inject(ChildrenOutletContexts);
5027
- const location = inject(Location);
5028
- const injector = inject(Injector);
5029
- const compiler = inject(Compiler);
5030
- const config = (_a = inject(ROUTES, { optional: true })) !== null && _a !== void 0 ? _a : [];
5031
- const opts = (_b = inject(ROUTER_CONFIGURATION, { optional: true })) !== null && _b !== void 0 ? _b : {};
5032
- const router = new Router(null, urlSerializer, contexts, location, injector, compiler, flatten(config));
5033
- assignExtraOptionsToRouter(opts, router);
5034
- return router;
5035
- }
5036
5065
  /**
5037
5066
  * @description
5038
5067
  *
@@ -5046,29 +5075,9 @@ function setupRouter() {
5046
5075
  * @publicApi
5047
5076
  */
5048
5077
  class Router {
5049
- /**
5050
- * Creates the router service.
5051
- */
5052
- // TODO: vsavkin make internal after the final is out.
5053
- constructor(
5054
- /** @internal */
5055
- rootComponentType,
5056
- /** @internal */
5057
- urlSerializer,
5058
- /** @internal */
5059
- rootContexts,
5060
- /** @internal */
5061
- location, injector, compiler, config) {
5062
- this.rootComponentType = rootComponentType;
5063
- this.urlSerializer = urlSerializer;
5064
- this.rootContexts = rootContexts;
5065
- this.location = location;
5066
- this.config = config;
5067
- /** @internal */
5068
- this.lastSuccessfulNavigation = null;
5078
+ constructor() {
5079
+ var _a;
5069
5080
  this.disposed = false;
5070
- /** @internal */
5071
- this.navigationId = 0;
5072
5081
  /**
5073
5082
  * The id of the currently active page in the router.
5074
5083
  * Updated to the transition's target id on a successful navigation.
@@ -5078,22 +5087,20 @@ class Router {
5078
5087
  * page.
5079
5088
  */
5080
5089
  this.currentPageId = 0;
5090
+ this.console = inject(ɵConsole);
5081
5091
  this.isNgZoneEnabled = false;
5082
- /**
5083
- * An event stream for routing events in this NgModule.
5084
- */
5085
- this.events = new Subject();
5092
+ this.options = inject(ROUTER_CONFIGURATION, { optional: true }) || {};
5086
5093
  /**
5087
5094
  * A handler for navigation errors in this NgModule.
5088
5095
  */
5089
- this.errorHandler = defaultErrorHandler;
5096
+ this.errorHandler = this.options.errorHandler || defaultErrorHandler;
5090
5097
  /**
5091
5098
  * A handler for errors thrown by `Router.parseUrl(url)`
5092
5099
  * when `url` contains an invalid character.
5093
5100
  * The most common case is a `%` sign
5094
5101
  * that's not encoded and is not part of a percent encoded sequence.
5095
5102
  */
5096
- this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
5103
+ this.malformedUriErrorHandler = this.options.malformedUriErrorHandler || defaultMalformedUriErrorHandler;
5097
5104
  /**
5098
5105
  * True if at least one navigation event has occurred,
5099
5106
  * false otherwise.
@@ -5133,7 +5140,7 @@ class Router {
5133
5140
  * routed components on same url navigation, you need to set `onSameUrlNavigation` to `'reload'`
5134
5141
  * _and_ provide a `RouteReuseStrategy` which returns `false` for `shouldReuseRoute`.
5135
5142
  */
5136
- this.onSameUrlNavigation = 'ignore';
5143
+ this.onSameUrlNavigation = this.options.onSameUrlNavigation || 'ignore';
5137
5144
  /**
5138
5145
  * How to merge parameters, data, resolved data, and title from parent to child
5139
5146
  * routes. One of:
@@ -5143,7 +5150,7 @@ class Router {
5143
5150
  * - `'always'` : Inherit parent parameters, data, and resolved data
5144
5151
  * for all child routes.
5145
5152
  */
5146
- this.paramsInheritanceStrategy = 'emptyOnly';
5153
+ this.paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || 'emptyOnly';
5147
5154
  /**
5148
5155
  * Determines when the router updates the browser URL.
5149
5156
  * By default (`"deferred"`), updates the browser URL after navigation has finished.
@@ -5151,7 +5158,7 @@ class Router {
5151
5158
  * You can choose to update early so that, if navigation fails,
5152
5159
  * you can show an error message with the URL that failed.
5153
5160
  */
5154
- this.urlUpdateStrategy = 'deferred';
5161
+ this.urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';
5155
5162
  /**
5156
5163
  * Configures how the Router attempts to restore state when a navigation is cancelled.
5157
5164
  *
@@ -5174,44 +5181,30 @@ class Router {
5174
5181
  * The default value is `replace`.
5175
5182
  *
5176
5183
  */
5177
- this.canceledNavigationResolution = 'replace';
5178
- this.navigationTransitions = new NavigationTransitions(this);
5179
- const onLoadStart = (r) => this.triggerEvent(new RouteConfigLoadStart(r));
5180
- const onLoadEnd = (r) => this.triggerEvent(new RouteConfigLoadEnd(r));
5181
- this.configLoader = injector.get(RouterConfigLoader);
5182
- this.configLoader.onLoadEndListener = onLoadEnd;
5183
- this.configLoader.onLoadStartListener = onLoadStart;
5184
- this.ngModule = injector.get(NgModuleRef);
5185
- this.console = injector.get(ɵConsole);
5186
- const ngZone = injector.get(NgZone);
5187
- this.isNgZoneEnabled = ngZone instanceof NgZone && NgZone.isInAngularZone();
5188
- this.resetConfig(config);
5184
+ this.canceledNavigationResolution = this.options.canceledNavigationResolution || 'replace';
5185
+ this.config = flatten((_a = inject(ROUTES, { optional: true })) !== null && _a !== void 0 ? _a : []);
5186
+ this.navigationTransitions = inject(NavigationTransitions);
5187
+ this.urlSerializer = inject(UrlSerializer);
5188
+ this.location = inject(Location);
5189
+ /** @internal */
5190
+ this.rootComponentType = null;
5191
+ this.isNgZoneEnabled = inject(NgZone) instanceof NgZone && NgZone.isInAngularZone();
5192
+ this.resetConfig(this.config);
5189
5193
  this.currentUrlTree = new UrlTree();
5190
5194
  this.rawUrlTree = this.currentUrlTree;
5191
5195
  this.browserUrlTree = this.currentUrlTree;
5192
5196
  this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
5193
- this.transitions = new BehaviorSubject({
5194
- id: 0,
5195
- targetPageId: 0,
5196
- currentUrlTree: this.currentUrlTree,
5197
- extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree),
5198
- urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree),
5199
- rawUrl: this.currentUrlTree,
5200
- extras: {},
5201
- resolve: null,
5202
- reject: null,
5203
- promise: Promise.resolve(true),
5204
- source: 'imperative',
5205
- restoredState: null,
5206
- currentSnapshot: this.routerState.snapshot,
5207
- targetSnapshot: null,
5208
- currentRouterState: this.routerState,
5209
- targetRouterState: null,
5210
- guards: { canActivateChecks: [], canDeactivateChecks: [] },
5211
- guardsResult: null,
5197
+ this.navigationTransitions.setupNavigations(this).subscribe(t => {
5198
+ this.lastSuccessfulId = t.id;
5199
+ this.currentPageId = t.targetPageId;
5200
+ }, e => {
5201
+ this.console.warn(`Unhandled Navigation Error: ${e}`);
5212
5202
  });
5213
- this.navigations = this.navigationTransitions.setupNavigations(this.transitions);
5214
- this.processNavigations();
5203
+ }
5204
+ // TODO(b/260747083): This should not exist and navigationId should be private in
5205
+ // `NavigationTransitions`
5206
+ get navigationId() {
5207
+ return this.navigationTransitions.navigationId;
5215
5208
  }
5216
5209
  /**
5217
5210
  * The ɵrouterPageId of whatever page is currently active in the browser history. This is
@@ -5223,24 +5216,28 @@ class Router {
5223
5216
  return (_a = this.location.getState()) === null || _a === void 0 ? void 0 : _a.ɵrouterPageId;
5224
5217
  }
5225
5218
  /**
5226
- * @internal
5227
- * TODO: this should be removed once the constructor of the router made internal
5219
+ * An event stream for routing events.
5228
5220
  */
5221
+ get events() {
5222
+ // TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal
5223
+ // cleanup: tests are doing `(route.events as Subject<Event>).next(...)`. This isn't
5224
+ // allowed/supported but we still have to fix these or file bugs against the teams before making
5225
+ // the change.
5226
+ return this.navigationTransitions.events;
5227
+ }
5228
+ /** @internal */
5229
5229
  resetRootComponentType(rootComponentType) {
5230
5230
  this.rootComponentType = rootComponentType;
5231
5231
  // TODO: vsavkin router 4.0 should make the root component set to null
5232
5232
  // this will simplify the lifecycle of the router.
5233
5233
  this.routerState.root.component = this.rootComponentType;
5234
5234
  }
5235
- setTransition(t) {
5236
- this.transitions.next(Object.assign(Object.assign({}, this.transitions.value), t));
5237
- }
5238
5235
  /**
5239
5236
  * Sets up the location change listener and performs the initial navigation.
5240
5237
  */
5241
5238
  initialNavigation() {
5242
5239
  this.setUpLocationChangeListener();
5243
- if (this.navigationId === 0) {
5240
+ if (!this.navigationTransitions.hasRequestedNavigation) {
5244
5241
  this.navigateByUrl(this.location.path(true), { replaceUrl: true });
5245
5242
  }
5246
5243
  }
@@ -5298,10 +5295,6 @@ class Router {
5298
5295
  getCurrentNavigation() {
5299
5296
  return this.navigationTransitions.currentNavigation;
5300
5297
  }
5301
- /** @internal */
5302
- triggerEvent(event) {
5303
- this.events.next(event);
5304
- }
5305
5298
  /**
5306
5299
  * Resets the route configuration used for navigation and generating links.
5307
5300
  *
@@ -5330,7 +5323,7 @@ class Router {
5330
5323
  }
5331
5324
  /** Disposes of the router. */
5332
5325
  dispose() {
5333
- this.transitions.complete();
5326
+ this.navigationTransitions.complete();
5334
5327
  if (this.locationSubscription) {
5335
5328
  this.locationSubscription.unsubscribe();
5336
5329
  this.locationSubscription = undefined;
@@ -5515,21 +5508,6 @@ class Router {
5515
5508
  return result;
5516
5509
  }, {});
5517
5510
  }
5518
- processNavigations() {
5519
- this.navigations.subscribe(t => {
5520
- var _a;
5521
- this.navigated = true;
5522
- this.lastSuccessfulId = t.id;
5523
- this.currentPageId = t.targetPageId;
5524
- this.events
5525
- .next(new NavigationEnd(t.id, this.serializeUrl(t.extractedUrl), this.serializeUrl(this.currentUrlTree)));
5526
- this.lastSuccessfulNavigation = this.getCurrentNavigation();
5527
- (_a = this.titleStrategy) === null || _a === void 0 ? void 0 : _a.updateTitle(this.routerState.snapshot);
5528
- t.resolve(true);
5529
- }, e => {
5530
- this.console.warn(`Unhandled Navigation Error: ${e}`);
5531
- });
5532
- }
5533
5511
  /** @internal */
5534
5512
  scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {
5535
5513
  var _a, _b;
@@ -5550,7 +5528,6 @@ class Router {
5550
5528
  reject = rej;
5551
5529
  });
5552
5530
  }
5553
- const id = ++this.navigationId;
5554
5531
  let targetPageId;
5555
5532
  if (this.canceledNavigationResolution === 'computed') {
5556
5533
  const isInitialPage = this.currentPageId === 0;
@@ -5578,12 +5555,12 @@ class Router {
5578
5555
  // This is unused when `canceledNavigationResolution` is not computed.
5579
5556
  targetPageId = 0;
5580
5557
  }
5581
- this.setTransition({
5582
- id,
5558
+ this.navigationTransitions.handleNavigationRequest({
5583
5559
  targetPageId,
5584
5560
  source,
5585
5561
  restoredState,
5586
5562
  currentUrlTree: this.currentUrlTree,
5563
+ currentRawUrl: this.currentUrlTree,
5587
5564
  rawUrl,
5588
5565
  extras,
5589
5566
  resolve,
@@ -5668,12 +5645,6 @@ class Router {
5668
5645
  resetUrlToCurrentUrlTree() {
5669
5646
  this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));
5670
5647
  }
5671
- /** @internal */
5672
- cancelNavigationTransition(transition, reason, code) {
5673
- const navCancel = new NavigationCancel(transition.id, this.serializeUrl(transition.extractedUrl), reason, code);
5674
- this.triggerEvent(navCancel);
5675
- transition.resolve(false);
5676
- }
5677
5648
  generateNgRouterState(navigationId, routerPageId) {
5678
5649
  if (this.canceledNavigationResolution === 'computed') {
5679
5650
  return { navigationId, ɵrouterPageId: routerPageId };
@@ -5681,15 +5652,12 @@ class Router {
5681
5652
  return { navigationId };
5682
5653
  }
5683
5654
  }
5684
- Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
5685
- Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, providedIn: 'root', useFactory: setupRouter });
5686
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: Router, decorators: [{
5655
+ Router.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: Router, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
5656
+ Router.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: Router, providedIn: 'root' });
5657
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: Router, decorators: [{
5687
5658
  type: Injectable,
5688
- args: [{
5689
- providedIn: 'root',
5690
- useFactory: setupRouter,
5691
- }]
5692
- }], ctorParameters: function () { return [{ type: i0.Type }, { type: UrlSerializer }, { type: ChildrenOutletContexts }, { type: i3.Location }, { type: i0.Injector }, { type: i0.Compiler }, { type: undefined }]; } });
5659
+ args: [{ providedIn: 'root' }]
5660
+ }], ctorParameters: function () { return []; } });
5693
5661
  function validateCommands(commands) {
5694
5662
  for (let i = 0; i < commands.length; i++) {
5695
5663
  const cmd = commands[i];
@@ -5974,9 +5942,9 @@ class RouterLink {
5974
5942
  });
5975
5943
  }
5976
5944
  }
5977
- RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5978
- RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
5979
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLink, decorators: [{
5945
+ RouterLink.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLink, deps: [{ token: Router }, { token: ActivatedRoute }, { token: 'tabindex', attribute: true }, { token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i3.LocationStrategy }], target: i0.ɵɵFactoryTarget.Directive });
5946
+ RouterLink.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: RouterLink, isStandalone: true, selector: "[routerLink]", inputs: { target: "target", queryParams: "queryParams", fragment: "fragment", queryParamsHandling: "queryParamsHandling", state: "state", relativeTo: "relativeTo", preserveFragment: "preserveFragment", skipLocationChange: "skipLocationChange", replaceUrl: "replaceUrl", routerLink: "routerLink" }, host: { listeners: { "click": "onClick($event.button,$event.ctrlKey,$event.shiftKey,$event.altKey,$event.metaKey)" }, properties: { "attr.target": "this.target" } }, usesOnChanges: true, ngImport: i0 });
5947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLink, decorators: [{
5980
5948
  type: Directive,
5981
5949
  args: [{
5982
5950
  selector: '[routerLink]',
@@ -6205,9 +6173,9 @@ class RouterLinkActive {
6205
6173
  return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);
6206
6174
  }
6207
6175
  }
6208
- RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6209
- RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.1", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6210
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterLinkActive, decorators: [{
6176
+ RouterLinkActive.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLinkActive, deps: [{ token: Router }, { token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: RouterLink, optional: true }], target: i0.ɵɵFactoryTarget.Directive });
6177
+ RouterLinkActive.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.0.3", type: RouterLinkActive, isStandalone: true, selector: "[routerLinkActive]", inputs: { routerLinkActiveOptions: "routerLinkActiveOptions", ariaCurrentWhenActive: "ariaCurrentWhenActive", routerLinkActive: "routerLinkActive" }, outputs: { isActiveChange: "isActiveChange" }, queries: [{ propertyName: "links", predicate: RouterLink, descendants: true }], exportAs: ["routerLinkActive"], usesOnChanges: true, ngImport: i0 });
6178
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterLinkActive, decorators: [{
6211
6179
  type: Directive,
6212
6180
  args: [{
6213
6181
  selector: '[routerLinkActive]',
@@ -6269,9 +6237,9 @@ class PreloadAllModules {
6269
6237
  return fn().pipe(catchError(() => of(null)));
6270
6238
  }
6271
6239
  }
6272
- PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6273
- PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6274
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: PreloadAllModules, decorators: [{
6240
+ PreloadAllModules.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreloadAllModules, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6241
+ PreloadAllModules.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreloadAllModules, providedIn: 'root' });
6242
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: PreloadAllModules, decorators: [{
6275
6243
  type: Injectable,
6276
6244
  args: [{ providedIn: 'root' }]
6277
6245
  }] });
@@ -6289,9 +6257,9 @@ class NoPreloading {
6289
6257
  return of(null);
6290
6258
  }
6291
6259
  }
6292
- NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6293
- NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6294
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: NoPreloading, decorators: [{
6260
+ NoPreloading.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NoPreloading, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
6261
+ NoPreloading.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NoPreloading, providedIn: 'root' });
6262
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: NoPreloading, decorators: [{
6295
6263
  type: Injectable,
6296
6264
  args: [{ providedIn: 'root' }]
6297
6265
  }] });
@@ -6387,18 +6355,19 @@ class RouterPreloader {
6387
6355
  });
6388
6356
  }
6389
6357
  }
6390
- RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6391
- RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6392
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterPreloader, decorators: [{
6358
+ RouterPreloader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterPreloader, deps: [{ token: Router }, { token: i0.Compiler }, { token: i0.EnvironmentInjector }, { token: PreloadingStrategy }, { token: RouterConfigLoader }], target: i0.ɵɵFactoryTarget.Injectable });
6359
+ RouterPreloader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterPreloader, providedIn: 'root' });
6360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterPreloader, decorators: [{
6393
6361
  type: Injectable,
6394
6362
  args: [{ providedIn: 'root' }]
6395
6363
  }], ctorParameters: function () { return [{ type: Router }, { type: i0.Compiler }, { type: i0.EnvironmentInjector }, { type: PreloadingStrategy }, { type: RouterConfigLoader }]; } });
6396
6364
 
6397
6365
  const ROUTER_SCROLLER = new InjectionToken('');
6398
6366
  class RouterScroller {
6399
- constructor(router,
6400
- /** @docsNotRequired */ viewportScroller, zone, options = {}) {
6401
- this.router = router;
6367
+ /** @nodoc */
6368
+ constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {
6369
+ this.urlSerializer = urlSerializer;
6370
+ this.transitions = transitions;
6402
6371
  this.viewportScroller = viewportScroller;
6403
6372
  this.zone = zone;
6404
6373
  this.options = options;
@@ -6421,7 +6390,7 @@ class RouterScroller {
6421
6390
  this.scrollEventsSubscription = this.consumeScrollEvents();
6422
6391
  }
6423
6392
  createScrollEvents() {
6424
- return this.router.events.subscribe(e => {
6393
+ return this.transitions.events.subscribe(e => {
6425
6394
  if (e instanceof NavigationStart) {
6426
6395
  // store the scroll position of the current stable navigations.
6427
6396
  this.store[this.lastId] = this.viewportScroller.getScrollPosition();
@@ -6430,12 +6399,12 @@ class RouterScroller {
6430
6399
  }
6431
6400
  else if (e instanceof NavigationEnd) {
6432
6401
  this.lastId = e.id;
6433
- this.scheduleScrollEvent(e, this.router.parseUrl(e.urlAfterRedirects).fragment);
6402
+ this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);
6434
6403
  }
6435
6404
  });
6436
6405
  }
6437
6406
  consumeScrollEvents() {
6438
- return this.router.events.subscribe(e => {
6407
+ return this.transitions.events.subscribe(e => {
6439
6408
  if (!(e instanceof Scroll))
6440
6409
  return;
6441
6410
  // a popstate event. The pop state event will always ignore anchor scrolling.
@@ -6465,26 +6434,23 @@ class RouterScroller {
6465
6434
  // component by executing its update block of the template function.
6466
6435
  setTimeout(() => {
6467
6436
  this.zone.run(() => {
6468
- this.router.triggerEvent(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6437
+ this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
6469
6438
  });
6470
6439
  }, 0);
6471
6440
  });
6472
6441
  }
6473
6442
  /** @nodoc */
6474
6443
  ngOnDestroy() {
6475
- if (this.routerEventsSubscription) {
6476
- this.routerEventsSubscription.unsubscribe();
6477
- }
6478
- if (this.scrollEventsSubscription) {
6479
- this.scrollEventsSubscription.unsubscribe();
6480
- }
6444
+ var _a, _b;
6445
+ (_a = this.routerEventsSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
6446
+ (_b = this.scrollEventsSubscription) === null || _b === void 0 ? void 0 : _b.unsubscribe();
6481
6447
  }
6482
6448
  }
6483
- RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6484
- RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller });
6485
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterScroller, decorators: [{
6449
+ RouterScroller.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterScroller, deps: "invalid", target: i0.ɵɵFactoryTarget.Injectable });
6450
+ RouterScroller.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterScroller });
6451
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterScroller, decorators: [{
6486
6452
  type: Injectable
6487
- }], ctorParameters: function () { return [{ type: Router }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6453
+ }], ctorParameters: function () { return [{ type: UrlSerializer }, { type: NavigationTransitions }, { type: i3.ViewportScroller }, { type: i0.NgZone }, { type: undefined }]; } });
6488
6454
 
6489
6455
  /**
6490
6456
  * @license
@@ -6537,10 +6503,6 @@ function provideRouter(routes, ...features) {
6537
6503
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6538
6504
  { provide: APP_BOOTSTRAP_LISTENER, multi: true, useFactory: getBootstrapListener },
6539
6505
  features.map(feature => feature.ɵproviders),
6540
- // TODO: All options used by the `assignExtraOptionsToRouter` factory need to be reviewed for
6541
- // how we want them to be configured. This API doesn't currently have a way to configure them
6542
- // and we should decide what the _best_ way to do that is rather than just sticking with the
6543
- // status quo of how it's done today.
6544
6506
  ]);
6545
6507
  }
6546
6508
  function rootRoute(router) {
@@ -6621,10 +6583,11 @@ function withInMemoryScrolling(options = {}) {
6621
6583
  const providers = [{
6622
6584
  provide: ROUTER_SCROLLER,
6623
6585
  useFactory: () => {
6624
- const router = inject(Router);
6625
6586
  const viewportScroller = inject(ViewportScroller);
6626
6587
  const zone = inject(NgZone);
6627
- return new RouterScroller(router, viewportScroller, zone, options);
6588
+ const transitions = inject(NavigationTransitions);
6589
+ const urlSerializer = inject(UrlSerializer);
6590
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);
6628
6591
  },
6629
6592
  }];
6630
6593
  return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);
@@ -6929,7 +6892,7 @@ const ROUTER_FORROOT_GUARD = new InjectionToken(NG_DEV_MODE ? 'router duplicate
6929
6892
  const ROUTER_PROVIDERS = [
6930
6893
  Location,
6931
6894
  { provide: UrlSerializer, useClass: DefaultUrlSerializer },
6932
- { provide: Router, useFactory: setupRouter },
6895
+ Router,
6933
6896
  ChildrenOutletContexts,
6934
6897
  { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
6935
6898
  RouterConfigLoader,
@@ -7026,10 +6989,10 @@ class RouterModule {
7026
6989
  };
7027
6990
  }
7028
6991
  }
7029
- RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
7030
- RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
7031
- RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
7032
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.1", ngImport: i0, type: RouterModule, decorators: [{
6992
+ RouterModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, deps: [{ token: ROUTER_FORROOT_GUARD, optional: true }], target: i0.ɵɵFactoryTarget.NgModule });
6993
+ RouterModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, imports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent], exports: [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent] });
6994
+ RouterModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, imports: [ɵEmptyOutletComponent] });
6995
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.3", ngImport: i0, type: RouterModule, decorators: [{
7033
6996
  type: NgModule,
7034
6997
  args: [{
7035
6998
  imports: ROUTER_DIRECTIVES,
@@ -7051,14 +7014,15 @@ function provideRouterScroller() {
7051
7014
  return {
7052
7015
  provide: ROUTER_SCROLLER,
7053
7016
  useFactory: () => {
7054
- const router = inject(Router);
7055
7017
  const viewportScroller = inject(ViewportScroller);
7056
7018
  const zone = inject(NgZone);
7057
7019
  const config = inject(ROUTER_CONFIGURATION);
7020
+ const transitions = inject(NavigationTransitions);
7021
+ const urlSerializer = inject(UrlSerializer);
7058
7022
  if (config.scrollOffset) {
7059
7023
  viewportScroller.setOffset(config.scrollOffset);
7060
7024
  }
7061
- return new RouterScroller(router, viewportScroller, zone, config);
7025
+ return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);
7062
7026
  },
7063
7027
  };
7064
7028
  }
@@ -7116,7 +7080,7 @@ function provideRouterInitializer() {
7116
7080
  /**
7117
7081
  * @publicApi
7118
7082
  */
7119
- const VERSION = new Version('15.0.1');
7083
+ const VERSION = new Version('15.0.3');
7120
7084
 
7121
7085
  /**
7122
7086
  * @license
@@ -7155,5 +7119,5 @@ const VERSION = new Version('15.0.1');
7155
7119
  * Generated bundle index. Do not edit.
7156
7120
  */
7157
7121
 
7158
- export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, assignExtraOptionsToRouter as ɵassignExtraOptionsToRouter, flatten as ɵflatten, withPreloading as ɵwithPreloading };
7122
+ export { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTES, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, provideRouter, provideRoutes, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withInMemoryScrolling, withPreloading, withRouterConfig, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, flatten as ɵflatten, withPreloading as ɵwithPreloading };
7159
7123
  //# sourceMappingURL=router.mjs.map