@angular/router 20.0.0-next.1 → 20.0.0-next.2

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,14 +1,14 @@
1
1
  /**
2
- * @license Angular v20.0.0-next.1
2
+ * @license Angular v20.0.0-next.2
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { provideLocationMocks } from '@angular/common/testing';
8
7
  import * as i0 from '@angular/core';
9
- import { NgModule, Injectable, signal, Component, ViewChild } from '@angular/core';
10
- import { ROUTES, ROUTER_CONFIGURATION, RouterModule, ɵROUTER_PROVIDERS, withPreloading, NoPreloading, RouterOutlet, Router, ɵafterNextNavigation } from '@angular/router';
8
+ import { NgModule, signal, Injectable, ViewChild, Component } from '@angular/core';
11
9
  import { TestBed } from '@angular/core/testing';
10
+ import { ROUTES, ROUTER_CONFIGURATION, RouterModule, ɵROUTER_PROVIDERS as _ROUTER_PROVIDERS, withPreloading, NoPreloading, Router, ɵafterNextNavigation as _afterNextNavigation, RouterOutlet } from '@angular/router';
11
+ import { provideLocationMocks } from '@angular/common/testing';
12
12
 
13
13
  /**
14
14
  * @description
@@ -50,21 +50,21 @@ class RouterTestingModule {
50
50
  ],
51
51
  };
52
52
  }
53
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
54
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0-next.1", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
55
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RouterTestingModule, providers: [
56
- ɵROUTER_PROVIDERS,
53
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RouterTestingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
54
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.0.0-next.2", ngImport: i0, type: RouterTestingModule, exports: [RouterModule] });
55
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RouterTestingModule, providers: [
56
+ _ROUTER_PROVIDERS,
57
57
  provideLocationMocks(),
58
58
  withPreloading(NoPreloading).ɵproviders,
59
59
  { provide: ROUTES, multi: true, useValue: [] },
60
60
  ], imports: [RouterModule] });
61
61
  }
62
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RouterTestingModule, decorators: [{
62
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RouterTestingModule, decorators: [{
63
63
  type: NgModule,
64
64
  args: [{
65
65
  exports: [RouterModule],
66
66
  providers: [
67
- ɵROUTER_PROVIDERS,
67
+ _ROUTER_PROVIDERS,
68
68
  provideLocationMocks(),
69
69
  withPreloading(NoPreloading).ɵproviders,
70
70
  { provide: ROUTES, multi: true, useValue: [] },
@@ -90,20 +90,20 @@ class RootFixtureService {
90
90
  this.fixture.detectChanges();
91
91
  return this.fixture;
92
92
  }
93
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
94
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RootFixtureService, providedIn: 'root' });
93
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RootFixtureService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
94
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RootFixtureService, providedIn: 'root' });
95
95
  }
96
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RootFixtureService, decorators: [{
96
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RootFixtureService, decorators: [{
97
97
  type: Injectable,
98
98
  args: [{ providedIn: 'root' }]
99
99
  }] });
100
100
  class RootCmp {
101
101
  outlet;
102
102
  routerOutletData = signal(undefined);
103
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component });
104
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0-next.1", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet [routerOutletData]="routerOutletData()"></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
103
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RootCmp, deps: [], target: i0.ɵɵFactoryTarget.Component });
104
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.0.0-next.2", type: RootCmp, isStandalone: true, selector: "ng-component", viewQueries: [{ propertyName: "outlet", first: true, predicate: RouterOutlet, descendants: true }], ngImport: i0, template: '<router-outlet [routerOutletData]="routerOutletData()"></router-outlet>', isInline: true, dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }] });
105
105
  }
106
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.1", ngImport: i0, type: RootCmp, decorators: [{
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.0-next.2", ngImport: i0, type: RootCmp, decorators: [{
107
107
  type: Component,
108
108
  args: [{
109
109
  template: '<router-outlet [routerOutletData]="routerOutletData()"></router-outlet>',
@@ -168,7 +168,7 @@ class RouterTestingHarness {
168
168
  const redirectTrackingPromise = new Promise((resolve) => {
169
169
  resolveFn = resolve;
170
170
  });
171
- ɵafterNextNavigation(TestBed.inject(Router), resolveFn);
171
+ _afterNextNavigation(TestBed.inject(Router), resolveFn);
172
172
  await router.navigateByUrl(url);
173
173
  await redirectTrackingPromise;
174
174
  this.fixture.detectChanges();
@@ -192,24 +192,5 @@ class RouterTestingHarness {
192
192
  }
193
193
  }
194
194
 
195
- /**
196
- * @module
197
- * @description
198
- * Entry point for all public APIs of the router/testing package.
199
- */
200
-
201
- /**
202
- * @module
203
- * @description
204
- * Entry point for all public APIs of this package.
205
- */
206
- // This file only reexports content of the `src` folder. Keep it that way.
207
-
208
- // This file is not used to build this module. It is only used during editing
209
-
210
- /**
211
- * Generated bundle index. Do not edit.
212
- */
213
-
214
195
  export { RouterTestingHarness, RouterTestingModule };
215
196
  //# sourceMappingURL=testing.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"testing.mjs","sources":["../../../../../../packages/router/testing/src/router_testing_module.ts","../../../../../../packages/router/testing/src/router_testing_harness.ts","../../../../../../packages/router/testing/src/testing.ts","../../../../../../packages/router/testing/public_api.ts","../../../../../../packages/router/testing/index.ts","../../../../../../packages/router/testing/testing.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {provideLocationMocks} from '@angular/common/testing';\nimport {ModuleWithProviders, NgModule} from '@angular/core';\nimport {\n ExtraOptions,\n NoPreloading,\n ROUTER_CONFIGURATION,\n RouterModule,\n ROUTES,\n Routes,\n withPreloading,\n ɵROUTER_PROVIDERS as ROUTER_PROVIDERS,\n} from '@angular/router';\n\n/**\n * @description\n *\n * Sets up the router to be used for testing.\n *\n * The modules sets up the router to be used for testing.\n * It provides spy implementations of `Location` and `LocationStrategy`.\n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * beforeEach(() => {\n * TestBed.configureTestingModule({\n * imports: [\n * RouterModule.forRoot(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n * @deprecated Use `provideRouter` or `RouterModule`/`RouterModule.forRoot` instead.\n * This module was previously used to provide a helpful collection of test fakes,\n * most notably those for `Location` and `LocationStrategy`. These are generally not\n * required anymore, as `MockPlatformLocation` is provided in `TestBed` by default.\n * However, you can use them directly with `provideLocationMocks`.\n */\n@NgModule({\n exports: [RouterModule],\n providers: [\n ROUTER_PROVIDERS,\n provideLocationMocks(),\n withPreloading(NoPreloading).ɵproviders,\n {provide: ROUTES, multi: true, useValue: []},\n ],\n})\nexport class RouterTestingModule {\n static withRoutes(\n routes: Routes,\n config?: ExtraOptions,\n ): ModuleWithProviders<RouterTestingModule> {\n return {\n ngModule: RouterTestingModule,\n providers: [\n {provide: ROUTES, multi: true, useValue: routes},\n {provide: ROUTER_CONFIGURATION, useValue: config ? config : {}},\n ],\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n Component,\n DebugElement,\n Injectable,\n Type,\n ViewChild,\n WritableSignal,\n signal,\n} from '@angular/core';\nimport {ComponentFixture, TestBed} from '@angular/core/testing';\nimport {Router, RouterOutlet, ɵafterNextNavigation as afterNextNavigation} from '@angular/router';\n\n@Injectable({providedIn: 'root'})\nexport class RootFixtureService {\n private fixture?: ComponentFixture<RootCmp>;\n private harness?: RouterTestingHarness;\n\n createHarness(): RouterTestingHarness {\n if (this.harness) {\n throw new Error('Only one harness should be created per test.');\n }\n this.harness = new RouterTestingHarness(this.getRootFixture());\n return this.harness;\n }\n\n private getRootFixture(): ComponentFixture<RootCmp> {\n if (this.fixture !== undefined) {\n return this.fixture;\n }\n this.fixture = TestBed.createComponent(RootCmp);\n this.fixture.detectChanges();\n return this.fixture;\n }\n}\n\n@Component({\n template: '<router-outlet [routerOutletData]=\"routerOutletData()\"></router-outlet>',\n imports: [RouterOutlet],\n})\nexport class RootCmp {\n @ViewChild(RouterOutlet) outlet?: RouterOutlet;\n readonly routerOutletData = signal<unknown>(undefined);\n}\n\n/**\n * A testing harness for the `Router` to reduce the boilerplate needed to test routes and routed\n * components.\n *\n * @publicApi\n */\nexport class RouterTestingHarness {\n /**\n * Creates a `RouterTestingHarness` instance.\n *\n * The `RouterTestingHarness` also creates its own root component with a `RouterOutlet` for the\n * purposes of rendering route components.\n *\n * Throws an error if an instance has already been created.\n * Use of this harness also requires `destroyAfterEach: true` in the `ModuleTeardownOptions`\n *\n * @param initialUrl The target of navigation to trigger before returning the harness.\n */\n static async create(initialUrl?: string): Promise<RouterTestingHarness> {\n const harness = TestBed.inject(RootFixtureService).createHarness();\n if (initialUrl !== undefined) {\n await harness.navigateByUrl(initialUrl);\n }\n return harness;\n }\n\n /**\n * Fixture of the root component of the RouterTestingHarness\n */\n public readonly fixture: ComponentFixture<{routerOutletData: WritableSignal<unknown>}>;\n\n /** @internal */\n constructor(fixture: ComponentFixture<{routerOutletData: WritableSignal<unknown>}>) {\n this.fixture = fixture;\n }\n\n /** Instructs the root fixture to run change detection. */\n detectChanges(): void {\n this.fixture.detectChanges();\n }\n /** The `DebugElement` of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeDebugElement(): DebugElement | null {\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n if (!outlet || !outlet.isActivated) {\n return null;\n }\n return this.fixture.debugElement.query((v) => v.componentInstance === outlet.component);\n }\n /** The native element of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeNativeElement(): HTMLElement | null {\n return this.routeDebugElement?.nativeElement ?? null;\n }\n\n /**\n * Triggers a `Router` navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components. The root component is reused within the same test in subsequent calls to\n * `navigateForTest`.\n *\n * When testing `Routes` with a guards that reject the navigation, the `RouterOutlet` might not be\n * activated and the `activatedComponent` may be `null`.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='Guard'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes\n * (`null` if the outlet does not get activated).\n */\n async navigateByUrl(url: string): Promise<null | {}>;\n /**\n * Triggers a router navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='RoutedComponent'}\n *\n * The root component is reused within the same test in subsequent calls to `navigateByUrl`.\n *\n * This function also makes it easier to test components that depend on `ActivatedRoute` data.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='ActivatedRoute'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @param requiredRoutedComponentType After navigation completes, the required type for the\n * activated component of the `RouterOutlet`. If the outlet is not activated or a different\n * component is activated, this function will throw an error.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes.\n */\n async navigateByUrl<T>(url: string, requiredRoutedComponentType: Type<T>): Promise<T>;\n async navigateByUrl<T>(url: string, requiredRoutedComponentType?: Type<T>): Promise<T | null> {\n const router = TestBed.inject(Router);\n let resolveFn!: () => void;\n const redirectTrackingPromise = new Promise<void>((resolve) => {\n resolveFn = resolve;\n });\n afterNextNavigation(TestBed.inject(Router), resolveFn);\n await router.navigateByUrl(url);\n await redirectTrackingPromise;\n this.fixture.detectChanges();\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n // The outlet might not be activated if the user is testing a navigation for a guard that\n // rejects\n if (outlet && outlet.isActivated && outlet.activatedRoute.component) {\n const activatedComponent = outlet.component;\n if (\n requiredRoutedComponentType !== undefined &&\n !(activatedComponent instanceof requiredRoutedComponentType)\n ) {\n throw new Error(\n `Unexpected routed component type. Expected ${requiredRoutedComponentType.name} but got ${activatedComponent.constructor.name}`,\n );\n }\n return activatedComponent as T;\n } else {\n if (requiredRoutedComponentType !== undefined) {\n throw new Error(\n `Unexpected routed component type. Expected ${requiredRoutedComponentType.name} but the navigation did not activate any component.`,\n );\n }\n return null;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router/testing package.\n */\nexport * from './router_testing_module';\nexport {RouterTestingHarness} from './router_testing_harness';\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/testing';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ROUTER_PROVIDERS","afterNextNavigation"],"mappings":";;;;;;;;;;;;AAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;MAUU,mBAAmB,CAAA;AAC9B,IAAA,OAAO,UAAU,CACf,MAAc,EACd,MAAqB,EAAA;QAErB,OAAO;AACL,YAAA,QAAQ,EAAE,mBAAmB;AAC7B,YAAA,SAAS,EAAE;gBACT,EAAC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AM,CAAC,cAAc,CAAC,SAAS,EAAE;AACnE,YAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS,CAAA;YAC3C,IACE,2BAA2B,KAAK,SAAS;AACzC,gBAAA,EAAE,kBAAkB,YAAY,2BAA2B,CAAC,EAC5D;AACA,gBAAA,MAAM,IAAI,KAAK,CACb,CAAA,2CAAA,EAA8C,2BAA2B,CAAC,IAAI,CAAY,SAAA,EAAA,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAA,CAAE,CAChI,CAAA;aACH;AACA,YAAA,OAAO,kBAAuB,CAAA;SAChC;aAAO;AACL,YAAA,IAAI,2BAA2B,KAAK,SAAS,EAAE;gBAC7C,MAAM,IAAI,KAAK,CACb,CAAA,2CAAA,EAA8C,2BAA2B,CAAC,IAAI,CAAqD,mDAAA,CAAA,CACpI,CAAA;aACH;AACA,YAAA,OAAO,IAAI,CAAA;SACb;KACF;AACD;;ACxKD;;;;AAIG;;ACJH;;;;AAIG;AAGH;;ACPA;;ACRA;;AAEG;;;;"}
1
+ {"version":3,"file":"testing.mjs","sources":["../../../../../../packages/router/testing/src/router_testing_module.ts","../../../../../../packages/router/testing/src/router_testing_harness.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {provideLocationMocks} from '@angular/common/testing';\nimport {ModuleWithProviders, NgModule} from '@angular/core';\nimport {\n ExtraOptions,\n NoPreloading,\n ROUTER_CONFIGURATION,\n RouterModule,\n ROUTES,\n Routes,\n withPreloading,\n ɵROUTER_PROVIDERS as ROUTER_PROVIDERS,\n} from '@angular/router';\n\n/**\n * @description\n *\n * Sets up the router to be used for testing.\n *\n * The modules sets up the router to be used for testing.\n * It provides spy implementations of `Location` and `LocationStrategy`.\n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * beforeEach(() => {\n * TestBed.configureTestingModule({\n * imports: [\n * RouterModule.forRoot(\n * [{path: '', component: BlankCmp}, {path: 'simple', component: SimpleCmp}]\n * )\n * ]\n * });\n * });\n * ```\n *\n * @publicApi\n * @deprecated Use `provideRouter` or `RouterModule`/`RouterModule.forRoot` instead.\n * This module was previously used to provide a helpful collection of test fakes,\n * most notably those for `Location` and `LocationStrategy`. These are generally not\n * required anymore, as `MockPlatformLocation` is provided in `TestBed` by default.\n * However, you can use them directly with `provideLocationMocks`.\n */\n@NgModule({\n exports: [RouterModule],\n providers: [\n ROUTER_PROVIDERS,\n provideLocationMocks(),\n withPreloading(NoPreloading).ɵproviders,\n {provide: ROUTES, multi: true, useValue: []},\n ],\n})\nexport class RouterTestingModule {\n static withRoutes(\n routes: Routes,\n config?: ExtraOptions,\n ): ModuleWithProviders<RouterTestingModule> {\n return {\n ngModule: RouterTestingModule,\n providers: [\n {provide: ROUTES, multi: true, useValue: routes},\n {provide: ROUTER_CONFIGURATION, useValue: config ? config : {}},\n ],\n };\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {\n Component,\n DebugElement,\n Injectable,\n Type,\n ViewChild,\n WritableSignal,\n signal,\n} from '@angular/core';\nimport {ComponentFixture, TestBed} from '@angular/core/testing';\nimport {Router, RouterOutlet, ɵafterNextNavigation as afterNextNavigation} from '@angular/router';\n\n@Injectable({providedIn: 'root'})\nexport class RootFixtureService {\n private fixture?: ComponentFixture<RootCmp>;\n private harness?: RouterTestingHarness;\n\n createHarness(): RouterTestingHarness {\n if (this.harness) {\n throw new Error('Only one harness should be created per test.');\n }\n this.harness = new RouterTestingHarness(this.getRootFixture());\n return this.harness;\n }\n\n private getRootFixture(): ComponentFixture<RootCmp> {\n if (this.fixture !== undefined) {\n return this.fixture;\n }\n this.fixture = TestBed.createComponent(RootCmp);\n this.fixture.detectChanges();\n return this.fixture;\n }\n}\n\n@Component({\n template: '<router-outlet [routerOutletData]=\"routerOutletData()\"></router-outlet>',\n imports: [RouterOutlet],\n})\nexport class RootCmp {\n @ViewChild(RouterOutlet) outlet?: RouterOutlet;\n readonly routerOutletData = signal<unknown>(undefined);\n}\n\n/**\n * A testing harness for the `Router` to reduce the boilerplate needed to test routes and routed\n * components.\n *\n * @publicApi\n */\nexport class RouterTestingHarness {\n /**\n * Creates a `RouterTestingHarness` instance.\n *\n * The `RouterTestingHarness` also creates its own root component with a `RouterOutlet` for the\n * purposes of rendering route components.\n *\n * Throws an error if an instance has already been created.\n * Use of this harness also requires `destroyAfterEach: true` in the `ModuleTeardownOptions`\n *\n * @param initialUrl The target of navigation to trigger before returning the harness.\n */\n static async create(initialUrl?: string): Promise<RouterTestingHarness> {\n const harness = TestBed.inject(RootFixtureService).createHarness();\n if (initialUrl !== undefined) {\n await harness.navigateByUrl(initialUrl);\n }\n return harness;\n }\n\n /**\n * Fixture of the root component of the RouterTestingHarness\n */\n public readonly fixture: ComponentFixture<{routerOutletData: WritableSignal<unknown>}>;\n\n /** @internal */\n constructor(fixture: ComponentFixture<{routerOutletData: WritableSignal<unknown>}>) {\n this.fixture = fixture;\n }\n\n /** Instructs the root fixture to run change detection. */\n detectChanges(): void {\n this.fixture.detectChanges();\n }\n /** The `DebugElement` of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeDebugElement(): DebugElement | null {\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n if (!outlet || !outlet.isActivated) {\n return null;\n }\n return this.fixture.debugElement.query((v) => v.componentInstance === outlet.component);\n }\n /** The native element of the `RouterOutlet` component. `null` if the outlet is not activated. */\n get routeNativeElement(): HTMLElement | null {\n return this.routeDebugElement?.nativeElement ?? null;\n }\n\n /**\n * Triggers a `Router` navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components. The root component is reused within the same test in subsequent calls to\n * `navigateForTest`.\n *\n * When testing `Routes` with a guards that reject the navigation, the `RouterOutlet` might not be\n * activated and the `activatedComponent` may be `null`.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='Guard'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes\n * (`null` if the outlet does not get activated).\n */\n async navigateByUrl(url: string): Promise<null | {}>;\n /**\n * Triggers a router navigation and waits for it to complete.\n *\n * The root component with a `RouterOutlet` created for the harness is used to render `Route`\n * components.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='RoutedComponent'}\n *\n * The root component is reused within the same test in subsequent calls to `navigateByUrl`.\n *\n * This function also makes it easier to test components that depend on `ActivatedRoute` data.\n *\n * {@example router/testing/test/router_testing_harness_examples.spec.ts region='ActivatedRoute'}\n *\n * @param url The target of the navigation. Passed to `Router.navigateByUrl`.\n * @param requiredRoutedComponentType After navigation completes, the required type for the\n * activated component of the `RouterOutlet`. If the outlet is not activated or a different\n * component is activated, this function will throw an error.\n * @returns The activated component instance of the `RouterOutlet` after navigation completes.\n */\n async navigateByUrl<T>(url: string, requiredRoutedComponentType: Type<T>): Promise<T>;\n async navigateByUrl<T>(url: string, requiredRoutedComponentType?: Type<T>): Promise<T | null> {\n const router = TestBed.inject(Router);\n let resolveFn!: () => void;\n const redirectTrackingPromise = new Promise<void>((resolve) => {\n resolveFn = resolve;\n });\n afterNextNavigation(TestBed.inject(Router), resolveFn);\n await router.navigateByUrl(url);\n await redirectTrackingPromise;\n this.fixture.detectChanges();\n const outlet = (this.fixture.componentInstance as RootCmp).outlet;\n // The outlet might not be activated if the user is testing a navigation for a guard that\n // rejects\n if (outlet && outlet.isActivated && outlet.activatedRoute.component) {\n const activatedComponent = outlet.component;\n if (\n requiredRoutedComponentType !== undefined &&\n !(activatedComponent instanceof requiredRoutedComponentType)\n ) {\n throw new Error(\n `Unexpected routed component type. Expected ${requiredRoutedComponentType.name} but got ${activatedComponent.constructor.name}`,\n );\n }\n return activatedComponent as T;\n } else {\n if (requiredRoutedComponentType !== undefined) {\n throw new Error(\n `Unexpected routed component type. Expected ${requiredRoutedComponentType.name} but the navigation did not activate any component.`,\n );\n }\n return null;\n }\n }\n}\n"],"names":["ROUTER_PROVIDERS","afterNextNavigation"],"mappings":";;;;;;;;;;;;AAqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;MAUU,mBAAmB,CAAA;AAC9B,IAAA,OAAO,UAAU,CACf,MAAc,EACd,MAAqB,EAAA;QAErB,OAAO;AACL,YAAA,QAAQ,EAAE,mBAAmB;AAC7B,YAAA,SAAS,EAAE;gBACT,EAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAC;AAChD,gBAAA,EAAC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,EAAE,EAAC;AAChE,aAAA;SACF;;kHAXQ,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,YARpB,YAAY,CAAA,EAAA,CAAA;AAQX,IAAA,OAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,mBAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,EAPnB,SAAA,EAAA;YACTA,iBAAgB;AAChB,YAAA,oBAAoB,EAAE;AACtB,YAAA,cAAc,CAAC,YAAY,CAAC,CAAC,UAAU;YACvC,EAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAC;AAC7C,SAAA,EAAA,OAAA,EAAA,CANS,YAAY,CAAA,EAAA,CAAA;;sGAQX,mBAAmB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AM,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE;AACnE,YAAA,MAAM,kBAAkB,GAAG,MAAM,CAAC,SAAS;YAC3C,IACE,2BAA2B,KAAK,SAAS;AACzC,gBAAA,EAAE,kBAAkB,YAAY,2BAA2B,CAAC,EAC5D;AACA,gBAAA,MAAM,IAAI,KAAK,CACb,CAAA,2CAAA,EAA8C,2BAA2B,CAAC,IAAI,CAAY,SAAA,EAAA,kBAAkB,CAAC,WAAW,CAAC,IAAI,CAAA,CAAE,CAChI;;AAEH,YAAA,OAAO,kBAAuB;;aACzB;AACL,YAAA,IAAI,2BAA2B,KAAK,SAAS,EAAE;gBAC7C,MAAM,IAAI,KAAK,CACb,CAAA,2CAAA,EAA8C,2BAA2B,CAAC,IAAI,CAAqD,mDAAA,CAAA,CACpI;;AAEH,YAAA,OAAO,IAAI;;;AAGhB;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.0.0-next.1
2
+ * @license Angular v20.0.0-next.2
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -126,18 +126,5 @@ function resolveUrl(url) {
126
126
  };
127
127
  }
128
128
 
129
- /**
130
- * @module
131
- * @description
132
- * Entry point for all public APIs of this package.
133
- */
134
- // This file only reexports content of the `src` folder. Keep it that way.
135
-
136
- // This file is not used to build this module. It is only used during editing
137
-
138
- /**
139
- * Generated bundle index. Do not edit.
140
- */
141
-
142
129
  export { RouterUpgradeInitializer, locationSyncBootstrapListener, setUpLocationSync };
143
130
  //# sourceMappingURL=upgrade.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.mjs","sources":["../../../../../../packages/router/upgrade/src/upgrade.ts","../../../../../../packages/router/upgrade/public_api.ts","../../../../../../packages/router/upgrade/index.ts","../../../../../../packages/router/upgrade/upgrade.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Location} from '@angular/common';\nimport {APP_BOOTSTRAP_LISTENER, ComponentRef, InjectionToken} from '@angular/core';\nimport {Router, ɵRestoredState as RestoredState} from '@angular/router';\nimport {UpgradeModule} from '@angular/upgrade/static';\n\n/**\n * Creates an initializer that sets up `ngRoute` integration\n * along with setting up the Angular router.\n *\n * @usageNotes\n *\n * <code-example language=\"typescript\">\n * @NgModule({\n * imports: [\n * RouterModule.forRoot(SOME_ROUTES),\n * UpgradeModule\n * ],\n * providers: [\n * RouterUpgradeInitializer\n * ]\n * })\n * export class AppModule {\n * ngDoBootstrap() {}\n * }\n * </code-example>\n *\n * @publicApi\n */\nexport const RouterUpgradeInitializer = {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: locationSyncBootstrapListener as (ngUpgrade: UpgradeModule) => () => void,\n deps: [UpgradeModule],\n};\n\n/**\n * @internal\n */\nexport function locationSyncBootstrapListener(ngUpgrade: UpgradeModule) {\n return () => {\n setUpLocationSync(ngUpgrade);\n };\n}\n\n/**\n * Sets up a location change listener to trigger `history.pushState`.\n * Works around the problem that `onPopState` does not trigger `history.pushState`.\n * Must be called *after* calling `UpgradeModule.bootstrap`.\n *\n * @param ngUpgrade The upgrade NgModule.\n * @param urlType The location strategy.\n * @see {@link /api/common/HashLocationStrategy HashLocationStrategy}\n * @see {@link /api/common/PathLocationStrategy PathLocationStrategy}\n *\n * @publicApi\n */\nexport function setUpLocationSync(ngUpgrade: UpgradeModule, urlType: 'path' | 'hash' = 'path') {\n if (!ngUpgrade.$injector) {\n throw new Error(`\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n `);\n }\n\n const router: Router = ngUpgrade.injector.get(Router);\n const location: Location = ngUpgrade.injector.get(Location);\n\n ngUpgrade.$injector\n .get('$rootScope')\n .$on(\n '$locationChangeStart',\n (\n event: any,\n newUrl: string,\n oldUrl: string,\n newState?: {[k: string]: unknown} | RestoredState,\n oldState?: {[k: string]: unknown} | RestoredState,\n ) => {\n // Navigations coming from Angular router have a navigationId state\n // property. Don't trigger Angular router navigation again if it is\n // caused by a URL change from the current Angular router\n // navigation.\n const currentNavigationId = router.getCurrentNavigation()?.id;\n const newStateNavigationId = newState?.navigationId;\n if (newStateNavigationId !== undefined && newStateNavigationId === currentNavigationId) {\n return;\n }\n\n let url;\n if (urlType === 'path') {\n url = resolveUrl(newUrl);\n } else if (urlType === 'hash') {\n // Remove the first hash from the URL\n const hashIdx = newUrl.indexOf('#');\n url = resolveUrl(newUrl.substring(0, hashIdx) + newUrl.substring(hashIdx + 1));\n } else {\n throw 'Invalid URLType passed to setUpLocationSync: ' + urlType;\n }\n const path = location.normalize(url.pathname);\n router.navigateByUrl(path + url.search + url.hash);\n },\n );\n}\n\n/**\n * Normalizes and parses a URL.\n *\n * - Normalizing means that a relative URL will be resolved into an absolute URL in the context of\n * the application document.\n * - Parsing means that the anchor's `protocol`, `hostname`, `port`, `pathname` and related\n * properties are all populated to reflect the normalized URL.\n *\n * While this approach has wide compatibility, it doesn't work as expected on IE. On IE, normalizing\n * happens similar to other browsers, but the parsed components will not be set. (E.g. if you assign\n * `a.href = 'foo'`, then `a.protocol`, `a.host`, etc. will not be correctly updated.)\n * We work around that by performing the parsing in a 2nd step by taking a previously normalized URL\n * and assigning it again. This correctly populates all properties.\n *\n * See\n * https://github.com/angular/angular.js/blob/2c7400e7d07b0f6cec1817dab40b9250ce8ebce6/src/ng/urlUtils.js#L26-L33\n * for more info.\n */\nlet anchor: HTMLAnchorElement | undefined;\nfunction resolveUrl(url: string): {pathname: string; search: string; hash: string} {\n anchor ??= document.createElement('a');\n\n anchor.setAttribute('href', url);\n anchor.setAttribute('href', anchor.href);\n\n return {\n // IE does not start `pathname` with `/` like other browsers.\n pathname: `/${anchor.pathname.replace(/^\\//, '')}`,\n search: anchor.search,\n hash: anchor.hash,\n };\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\nexport * from './src/upgrade';\n\n// This file only reexports content of the `src` folder. Keep it that way.\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\n// This file is not used to build this module. It is only used during editing\n// by the TypeScript language service and during build for verification. `ngc`\n// replaces this file with production index.ts when it rewrites private symbol\n// names.\n\nexport * from './public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;AAaA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACU,MAAA,wBAAwB,GAAG;AACtC,IAAA,OAAO,EAAE,sBAAsB;AAC/B,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,UAAU,EAAE,6BAAyE;IACrF,IAAI,EAAE,CAAC,aAAa,CAAC;EACtB;AAED;;AAEG;AACG,SAAU,6BAA6B,CAAC,SAAwB,EAAA;AACpE,IAAA,OAAO,MAAK;QACV,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAC9B,KAAC,CAAA;AACH,CAAA;AAEA;;;;;;;;;;;AAWG;SACa,iBAAiB,CAAC,SAAwB,EAAE,UAA2B,MAAM,EAAA;AAC3F,IAAA,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,CAAA;;;AAGb,MAAA,CAAA,CAAC,CAAA;KACN;IAEA,MAAM,MAAM,GAAW,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IACrD,MAAM,QAAQ,GAAa,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;AAE3D,IAAA,SAAS,CAAC,SAAS;SAChB,GAAG,CAAC,YAA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AC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;IAExC,OAAO;;AAEL,QAAA,QAAQ,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAE,CAAA;QAClD,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;KAClB,CAAA;AACH;;ACvIA;;;;AAIG;AAGH;;ACPA;;ACRA;;AAEG;;;;"}
1
+ {"version":3,"file":"upgrade.mjs","sources":["../../../../../../packages/router/upgrade/src/upgrade.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n\nimport {Location} from '@angular/common';\nimport {APP_BOOTSTRAP_LISTENER, ComponentRef, InjectionToken} from '@angular/core';\nimport {Router, ɵRestoredState as RestoredState} from '@angular/router';\nimport {UpgradeModule} from '@angular/upgrade/static';\n\n/**\n * Creates an initializer that sets up `ngRoute` integration\n * along with setting up the Angular router.\n *\n * @usageNotes\n *\n * <code-example language=\"typescript\">\n * @NgModule({\n * imports: [\n * RouterModule.forRoot(SOME_ROUTES),\n * UpgradeModule\n * ],\n * providers: [\n * RouterUpgradeInitializer\n * ]\n * })\n * export class AppModule {\n * ngDoBootstrap() {}\n * }\n * </code-example>\n *\n * @publicApi\n */\nexport const RouterUpgradeInitializer = {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: locationSyncBootstrapListener as (ngUpgrade: UpgradeModule) => () => void,\n deps: [UpgradeModule],\n};\n\n/**\n * @internal\n */\nexport function locationSyncBootstrapListener(ngUpgrade: UpgradeModule) {\n return () => {\n setUpLocationSync(ngUpgrade);\n };\n}\n\n/**\n * Sets up a location change listener to trigger `history.pushState`.\n * Works around the problem that `onPopState` does not trigger `history.pushState`.\n * Must be called *after* calling `UpgradeModule.bootstrap`.\n *\n * @param ngUpgrade The upgrade NgModule.\n * @param urlType The location strategy.\n * @see {@link /api/common/HashLocationStrategy HashLocationStrategy}\n * @see {@link /api/common/PathLocationStrategy PathLocationStrategy}\n *\n * @publicApi\n */\nexport function setUpLocationSync(ngUpgrade: UpgradeModule, urlType: 'path' | 'hash' = 'path') {\n if (!ngUpgrade.$injector) {\n throw new Error(`\n RouterUpgradeInitializer can be used only after UpgradeModule.bootstrap has been called.\n Remove RouterUpgradeInitializer and call setUpLocationSync after UpgradeModule.bootstrap.\n `);\n }\n\n const router: Router = ngUpgrade.injector.get(Router);\n const location: Location = ngUpgrade.injector.get(Location);\n\n ngUpgrade.$injector\n .get('$rootScope')\n .$on(\n '$locationChangeStart',\n (\n event: any,\n newUrl: string,\n oldUrl: string,\n newState?: {[k: string]: unknown} | RestoredState,\n oldState?: {[k: string]: unknown} | RestoredState,\n ) => {\n // Navigations coming from Angular router have a navigationId state\n // property. Don't trigger Angular router navigation again if it is\n // caused by a URL change from the current Angular router\n // navigation.\n const currentNavigationId = router.getCurrentNavigation()?.id;\n const newStateNavigationId = newState?.navigationId;\n if (newStateNavigationId !== undefined && newStateNavigationId === currentNavigationId) {\n return;\n }\n\n let url;\n if (urlType === 'path') {\n url = resolveUrl(newUrl);\n } else if (urlType === 'hash') {\n // Remove the first hash from the URL\n const hashIdx = newUrl.indexOf('#');\n url = resolveUrl(newUrl.substring(0, hashIdx) + newUrl.substring(hashIdx + 1));\n } else {\n throw 'Invalid URLType passed to setUpLocationSync: ' + urlType;\n }\n const path = location.normalize(url.pathname);\n router.navigateByUrl(path + url.search + url.hash);\n },\n );\n}\n\n/**\n * Normalizes and parses a URL.\n *\n * - Normalizing means that a relative URL will be resolved into an absolute URL in the context of\n * the application document.\n * - Parsing means that the anchor's `protocol`, `hostname`, `port`, `pathname` and related\n * properties are all populated to reflect the normalized URL.\n *\n * While this approach has wide compatibility, it doesn't work as expected on IE. On IE, normalizing\n * happens similar to other browsers, but the parsed components will not be set. (E.g. if you assign\n * `a.href = 'foo'`, then `a.protocol`, `a.host`, etc. will not be correctly updated.)\n * We work around that by performing the parsing in a 2nd step by taking a previously normalized URL\n * and assigning it again. This correctly populates all properties.\n *\n * See\n * https://github.com/angular/angular.js/blob/2c7400e7d07b0f6cec1817dab40b9250ce8ebce6/src/ng/urlUtils.js#L26-L33\n * for more info.\n */\nlet anchor: HTMLAnchorElement | undefined;\nfunction resolveUrl(url: string): {pathname: string; search: string; hash: string} {\n anchor ??= document.createElement('a');\n\n anchor.setAttribute('href', url);\n anchor.setAttribute('href', anchor.href);\n\n return {\n // IE does not start `pathname` with `/` like other browsers.\n pathname: `/${anchor.pathname.replace(/^\\//, '')}`,\n search: anchor.search,\n hash: anchor.hash,\n };\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAaA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACU,MAAA,wBAAwB,GAAG;AACtC,IAAA,OAAO,EAAE,sBAAsB;AAC/B,IAAA,KAAK,EAAE,IAAI;AACX,IAAA,UAAU,EAAE,6BAAyE;IACrF,IAAI,EAAE,CAAC,aAAa,CAAC;;AAGvB;;AAEG;AACG,SAAU,6BAA6B,CAAC,SAAwB,EAAA;AACpE,IAAA,OAAO,MAAK;QACV,iBAAiB,CAAC,SAAS,CAAC;AAC9B,KAAC;AACH;AAEA;;;;;;;;;;;AAWG;SACa,iBAAiB,CAAC,SAAwB,EAAE,UAA2B,MAAM,EAAA;AAC3F,IAAA,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC;;;AAGb,MAAA,CAAA,CAAC;;IAGN,MAAM,MAAM,GAAW,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;IACrD,MAAM,QAAQ,GAAa,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC;AAE3D,IAAA,SAAS,CAAC;SACP,GAAG,CAAC,YAAY;AAChB,SAAA,GAAG,CACF,sBAAsB,EACtB,C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