@angular/common 20.1.0-next.2 → 20.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/{common_module.d-Cpp8wYHt.d.ts → common_module.d.d.ts} +17 -13
  2. package/fesm2022/common.mjs +31 -20
  3. package/fesm2022/common.mjs.map +1 -1
  4. package/fesm2022/{common_module-D4mHDfs1.mjs → common_module.mjs} +105 -97
  5. package/fesm2022/common_module.mjs.map +1 -0
  6. package/fesm2022/http/testing.mjs +10 -13
  7. package/fesm2022/http/testing.mjs.map +1 -1
  8. package/fesm2022/http.mjs +29 -17
  9. package/fesm2022/http.mjs.map +1 -1
  10. package/fesm2022/{location-BIEtBxGx.mjs → location.mjs} +17 -17
  11. package/fesm2022/location.mjs.map +1 -0
  12. package/fesm2022/{module-CBsxN_3E.mjs → module.mjs} +215 -51
  13. package/fesm2022/module.mjs.map +1 -0
  14. package/fesm2022/{platform_navigation-B45Jeakb.mjs → platform_navigation.mjs} +5 -5
  15. package/fesm2022/platform_navigation.mjs.map +1 -0
  16. package/fesm2022/testing.mjs +15 -15
  17. package/fesm2022/testing.mjs.map +1 -1
  18. package/fesm2022/upgrade.mjs +7 -7
  19. package/fesm2022/upgrade.mjs.map +1 -1
  20. package/fesm2022/{xhr-CEmSPUGj.mjs → xhr.mjs} +2 -2
  21. package/fesm2022/xhr.mjs.map +1 -0
  22. package/http/index.d.ts +641 -5
  23. package/http/testing/index.d.ts +2 -2
  24. package/index.d.ts +6 -6
  25. package/{module.d-yNBsZ8gb.d.ts → module.d.d.ts} +71 -1
  26. package/package.json +2 -2
  27. package/{platform_location.d-Lbv6Ueec.d.ts → platform_location.d.d.ts} +1 -1
  28. package/testing/index.d.ts +2 -2
  29. package/upgrade/index.d.ts +3 -3
  30. package/{xhr.d-D_1kTQR5.d.ts → xhr.d.d.ts} +1 -1
  31. package/fesm2022/common_module-D4mHDfs1.mjs.map +0 -1
  32. package/fesm2022/location-BIEtBxGx.mjs.map +0 -1
  33. package/fesm2022/module-CBsxN_3E.mjs.map +0 -1
  34. package/fesm2022/platform_navigation-B45Jeakb.mjs.map +0 -1
  35. package/fesm2022/xhr-CEmSPUGj.mjs.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location.mjs","sources":["../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/common/src/dom_adapter.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/common/src/location/platform_location.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/common/src/location/util.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/common/src/location/location_strategy.ts","../../../../../k8-fastbuild-ST-46c76129e412/bin/packages/common/src/location/location.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\nlet _DOM: DomAdapter = null!;\n\nexport function getDOM(): DomAdapter {\n return _DOM;\n}\n\nexport function setRootDomAdapter(adapter: DomAdapter) {\n _DOM ??= adapter;\n}\n\n/**\n * Provides DOM operations in an environment-agnostic way.\n *\n * @security Tread carefully! Interacting with the DOM directly is dangerous and\n * can introduce XSS risks.\n */\nexport abstract class DomAdapter {\n // Needs Domino-friendly test utility\n abstract dispatchEvent(el: any, evt: any): any;\n abstract readonly supportsDOMEvents: boolean;\n\n // Used by Meta\n abstract remove(el: any): void;\n abstract createElement(tagName: any, doc?: any): HTMLElement;\n abstract createHtmlDocument(): Document;\n abstract getDefaultDocument(): Document;\n\n // Used by By.css\n abstract isElementNode(node: any): boolean;\n\n // Used by Testability\n abstract isShadowRoot(node: any): boolean;\n\n // Used by KeyEventsPlugin\n abstract onAndCancel(el: any, evt: any, listener: any, options?: any): Function;\n\n // Used by PlatformLocation and ServerEventManagerPlugin\n abstract getGlobalEventTarget(doc: Document, target: string): any;\n\n // Used by PlatformLocation\n abstract getBaseHref(doc: Document): string | null;\n abstract resetBaseElement(): void;\n\n // TODO: remove dependency in DefaultValueAccessor\n abstract getUserAgent(): string;\n\n // Used in the legacy @angular/http package which has some usage in g3.\n abstract getCookie(name: string): string | null;\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 {inject, Injectable, InjectionToken, DOCUMENT} from '@angular/core';\n\nimport {getDOM} from '../dom_adapter';\n\n/**\n * This class should not be used directly by an application developer. Instead, use\n * {@link Location}.\n *\n * `PlatformLocation` encapsulates all calls to DOM APIs, which allows the Router to be\n * platform-agnostic.\n * This means that we can have different implementation of `PlatformLocation` for the different\n * platforms that Angular supports. For example, `@angular/platform-browser` provides an\n * implementation specific to the browser environment, while `@angular/platform-server` provides\n * one suitable for use with server-side rendering.\n *\n * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy}\n * when they need to interact with the DOM APIs like pushState, popState, etc.\n *\n * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly\n * by the {@link /api/router/Router Router} in order to navigate between routes. Since all interactions between\n * {@link /api/router/Router Router} /\n * {@link Location} / {@link LocationStrategy} and DOM APIs flow through the `PlatformLocation`\n * class, they are all platform-agnostic.\n *\n * @publicApi\n */\n@Injectable({providedIn: 'platform', useFactory: () => inject(BrowserPlatformLocation)})\nexport abstract class PlatformLocation {\n abstract getBaseHrefFromDOM(): string;\n abstract getState(): unknown;\n /**\n * Returns a function that, when executed, removes the `popstate` event handler.\n */\n abstract onPopState(fn: LocationChangeListener): VoidFunction;\n /**\n * Returns a function that, when executed, removes the `hashchange` event handler.\n */\n abstract onHashChange(fn: LocationChangeListener): VoidFunction;\n\n abstract get href(): string;\n abstract get protocol(): string;\n abstract get hostname(): string;\n abstract get port(): string;\n abstract get pathname(): string;\n abstract get search(): string;\n abstract get hash(): string;\n\n abstract replaceState(state: any, title: string, url: string): void;\n\n abstract pushState(state: any, title: string, url: string): void;\n\n abstract forward(): void;\n\n abstract back(): void;\n\n historyGo?(relativePosition: number): void {\n throw new Error(ngDevMode ? 'Not implemented' : '');\n }\n}\n\n/**\n * @description\n * Indicates when a location is initialized.\n *\n * @publicApi\n */\nexport const LOCATION_INITIALIZED = new InjectionToken<Promise<any>>(\n ngDevMode ? 'Location Initialized' : '',\n);\n\n/**\n * @description\n * A serializable version of the event from `onPopState` or `onHashChange`\n *\n * @publicApi\n */\nexport interface LocationChangeEvent {\n type: string;\n state: any;\n}\n\n/**\n * @publicApi\n */\nexport interface LocationChangeListener {\n (event: LocationChangeEvent): any;\n}\n\n/**\n * `PlatformLocation` encapsulates all of the direct calls to platform APIs.\n * This class should not be used directly by an application developer. Instead, use\n * {@link Location}.\n *\n * @publicApi\n */\n@Injectable({\n providedIn: 'platform',\n useFactory: () => new BrowserPlatformLocation(),\n})\nexport class BrowserPlatformLocation extends PlatformLocation {\n private _location: Location;\n private _history: History;\n private _doc = inject(DOCUMENT);\n\n constructor() {\n super();\n this._location = window.location;\n this._history = window.history;\n }\n\n override getBaseHrefFromDOM(): string {\n return getDOM().getBaseHref(this._doc)!;\n }\n\n override onPopState(fn: LocationChangeListener): VoidFunction {\n const window = getDOM().getGlobalEventTarget(this._doc, 'window');\n window.addEventListener('popstate', fn, false);\n return () => window.removeEventListener('popstate', fn);\n }\n\n override onHashChange(fn: LocationChangeListener): VoidFunction {\n const window = getDOM().getGlobalEventTarget(this._doc, 'window');\n window.addEventListener('hashchange', fn, false);\n return () => window.removeEventListener('hashchange', fn);\n }\n\n override get href(): string {\n return this._location.href;\n }\n override get protocol(): string {\n return this._location.protocol;\n }\n override get hostname(): string {\n return this._location.hostname;\n }\n override get port(): string {\n return this._location.port;\n }\n override get pathname(): string {\n return this._location.pathname;\n }\n override get search(): string {\n return this._location.search;\n }\n override get hash(): string {\n return this._location.hash;\n }\n override set pathname(newPath: string) {\n this._location.pathname = newPath;\n }\n\n override pushState(state: any, title: string, url: string): void {\n this._history.pushState(state, title, url);\n }\n\n override replaceState(state: any, title: string, url: string): void {\n this._history.replaceState(state, title, url);\n }\n\n override forward(): void {\n this._history.forward();\n }\n\n override back(): void {\n this._history.back();\n }\n\n override historyGo(relativePosition: number = 0): void {\n this._history.go(relativePosition);\n }\n\n override getState(): unknown {\n return this._history.state;\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 * Joins two parts of a URL with a slash if needed.\n *\n * @param start URL string\n * @param end URL string\n *\n *\n * @returns The joined URL string.\n */\nexport function joinWithSlash(start: string, end: string) {\n // If `start` is an empty string, return `end` as the result.\n if (!start) return end;\n // If `end` is an empty string, return `start` as the result.\n if (!end) return start;\n // If `start` ends with a slash, remove the leading slash from `end`.\n if (start.endsWith('/')) {\n return end.startsWith('/') ? start + end.slice(1) : start + end;\n }\n // If `start` doesn't end with a slash, add one if `end` doesn't start with a slash.\n return end.startsWith('/') ? start + end : `${start}/${end}`;\n}\n\n/**\n * Removes a trailing slash from a URL string if needed.\n * Looks for the first occurrence of either `#`, `?`, or the end of the\n * line as `/` characters and removes the trailing slash if one exists.\n *\n * @param url URL string.\n *\n * @returns The URL string, modified if needed.\n */\nexport function stripTrailingSlash(url: string): string {\n // Find the index of the first occurrence of `#`, `?`, or the end of the string.\n // This marks the start of the query string, fragment, or the end of the URL path.\n const pathEndIdx = url.search(/#|\\?|$/);\n // Check if the character before `pathEndIdx` is a trailing slash.\n // If it is, remove the trailing slash and return the modified URL.\n // Otherwise, return the URL as is.\n return url[pathEndIdx - 1] === '/' ? url.slice(0, pathEndIdx - 1) + url.slice(pathEndIdx) : url;\n}\n\n/**\n * Normalizes URL parameters by prepending with `?` if needed.\n *\n * @param params String of URL parameters.\n *\n * @returns The normalized URL parameters string.\n */\nexport function normalizeQueryParams(params: string): string {\n return params && params[0] !== '?' ? `?${params}` : params;\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 DOCUMENT,\n Inject,\n inject,\n Injectable,\n InjectionToken,\n OnDestroy,\n Optional,\n} from '@angular/core';\n\nimport {LocationChangeListener, PlatformLocation} from './platform_location';\nimport {joinWithSlash, normalizeQueryParams} from './util';\n\n/**\n * Enables the `Location` service to read route state from the browser's URL.\n * Angular provides two strategies:\n * `HashLocationStrategy` and `PathLocationStrategy`.\n *\n * Applications should use the `Router` or `Location` services to\n * interact with application route state.\n *\n * For instance, `HashLocationStrategy` produces URLs like\n * <code class=\"no-auto-link\">http://example.com/#/foo</code>,\n * and `PathLocationStrategy` produces\n * <code class=\"no-auto-link\">http://example.com/foo</code> as an equivalent URL.\n *\n * See these two classes for more.\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root', useFactory: () => inject(PathLocationStrategy)})\nexport abstract class LocationStrategy {\n abstract path(includeHash?: boolean): string;\n abstract prepareExternalUrl(internal: string): string;\n abstract getState(): unknown;\n abstract pushState(state: any, title: string, url: string, queryParams: string): void;\n abstract replaceState(state: any, title: string, url: string, queryParams: string): void;\n abstract forward(): void;\n abstract back(): void;\n historyGo?(relativePosition: number): void {\n throw new Error(ngDevMode ? 'Not implemented' : '');\n }\n abstract onPopState(fn: LocationChangeListener): void;\n abstract getBaseHref(): string;\n}\n\n/**\n * A predefined DI token for the base href\n * to be used with the `PathLocationStrategy`.\n * The base href is the URL prefix that should be preserved when generating\n * and recognizing URLs.\n *\n * @usageNotes\n *\n * The following example shows how to use this token to configure the root app injector\n * with a base href value, so that the DI framework can supply the dependency anywhere in the app.\n *\n * ```ts\n * import {NgModule} from '@angular/core';\n * import {APP_BASE_HREF} from '@angular/common';\n *\n * @NgModule({\n * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]\n * })\n * class AppModule {}\n * ```\n *\n * @publicApi\n */\nexport const APP_BASE_HREF = new InjectionToken<string>(ngDevMode ? 'appBaseHref' : '');\n\n/**\n * @description\n * A {@link LocationStrategy} used to configure the {@link Location} service to\n * represent its state in the\n * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the\n * browser's URL.\n *\n * If you're using `PathLocationStrategy`, you may provide a {@link APP_BASE_HREF}\n * or add a `<base href>` element to the document to override the default.\n *\n * For instance, if you provide an `APP_BASE_HREF` of `'/my/app/'` and call\n * `location.go('/foo')`, the browser's URL will become\n * `example.com/my/app/foo`. To ensure all relative URIs resolve correctly,\n * the `<base href>` and/or `APP_BASE_HREF` should end with a `/`.\n *\n * Similarly, if you add `<base href='/my/app/'/>` to the document and call\n * `location.go('/foo')`, the browser's URL will become\n * `example.com/my/app/foo`.\n *\n * Note that when using `PathLocationStrategy`, neither the query nor\n * the fragment in the `<base href>` will be preserved, as outlined\n * by the [RFC](https://tools.ietf.org/html/rfc3986#section-5.2.2).\n *\n * @usageNotes\n *\n * ### Example\n *\n * {@example common/location/ts/path_location_component.ts region='LocationComponent'}\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root'})\nexport class PathLocationStrategy extends LocationStrategy implements OnDestroy {\n private _baseHref: string;\n private _removeListenerFns: (() => void)[] = [];\n\n constructor(\n private _platformLocation: PlatformLocation,\n @Optional() @Inject(APP_BASE_HREF) href?: string,\n ) {\n super();\n\n this._baseHref =\n href ??\n this._platformLocation.getBaseHrefFromDOM() ??\n inject(DOCUMENT).location?.origin ??\n '';\n }\n\n /** @docs-private */\n ngOnDestroy(): void {\n while (this._removeListenerFns.length) {\n this._removeListenerFns.pop()!();\n }\n }\n\n override onPopState(fn: LocationChangeListener): void {\n this._removeListenerFns.push(\n this._platformLocation.onPopState(fn),\n this._platformLocation.onHashChange(fn),\n );\n }\n\n override getBaseHref(): string {\n return this._baseHref;\n }\n\n override prepareExternalUrl(internal: string): string {\n return joinWithSlash(this._baseHref, internal);\n }\n\n override path(includeHash: boolean = false): string {\n const pathname =\n this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);\n const hash = this._platformLocation.hash;\n return hash && includeHash ? `${pathname}${hash}` : pathname;\n }\n\n override pushState(state: any, title: string, url: string, queryParams: string) {\n const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));\n this._platformLocation.pushState(state, title, externalUrl);\n }\n\n override replaceState(state: any, title: string, url: string, queryParams: string) {\n const externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));\n this._platformLocation.replaceState(state, title, externalUrl);\n }\n\n override forward(): void {\n this._platformLocation.forward();\n }\n\n override back(): void {\n this._platformLocation.back();\n }\n\n override getState(): unknown {\n return this._platformLocation.getState();\n }\n\n override historyGo(relativePosition: number = 0): void {\n this._platformLocation.historyGo?.(relativePosition);\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 {Injectable, OnDestroy, ɵɵinject} from '@angular/core';\nimport {Subject, SubscriptionLike} from 'rxjs';\n\nimport {LocationStrategy} from './location_strategy';\nimport {joinWithSlash, normalizeQueryParams, stripTrailingSlash} from './util';\n\n/** @publicApi */\nexport interface PopStateEvent {\n pop?: boolean;\n state?: any;\n type?: string;\n url?: string;\n}\n\n/**\n * @description\n *\n * A service that applications can use to interact with a browser's URL.\n *\n * Depending on the `LocationStrategy` used, `Location` persists\n * to the URL's path or the URL's hash segment.\n *\n * @usageNotes\n *\n * It's better to use the `Router.navigate()` service to trigger route changes. Use\n * `Location` only if you need to interact with or create normalized URLs outside of\n * routing.\n *\n * `Location` is responsible for normalizing the URL against the application's base href.\n * A normalized URL is absolute from the URL host, includes the application's base href, and has no\n * trailing slash:\n * - `/my/app/user/123` is normalized\n * - `my/app/user/123` **is not** normalized\n * - `/my/app/user/123/` **is not** normalized\n *\n * ### Example\n *\n * {@example common/location/ts/path_location_component.ts region='LocationComponent'}\n *\n * @publicApi\n */\n@Injectable({\n providedIn: 'root',\n // See #23917\n useFactory: createLocation,\n})\nexport class Location implements OnDestroy {\n /** @internal */\n _subject = new Subject<PopStateEvent>();\n /** @internal */\n _basePath: string;\n /** @internal */\n _locationStrategy: LocationStrategy;\n /** @internal */\n _urlChangeListeners: ((url: string, state: unknown) => void)[] = [];\n /** @internal */\n _urlChangeSubscription: SubscriptionLike | null = null;\n\n constructor(locationStrategy: LocationStrategy) {\n this._locationStrategy = locationStrategy;\n const baseHref = this._locationStrategy.getBaseHref();\n // Note: This class's interaction with base HREF does not fully follow the rules\n // outlined in the spec https://www.freesoft.org/CIE/RFC/1808/18.htm.\n // Instead of trying to fix individual bugs with more and more code, we should\n // investigate using the URL constructor and providing the base as a second\n // argument.\n // https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#parameters\n this._basePath = _stripOrigin(stripTrailingSlash(_stripIndexHtml(baseHref)));\n this._locationStrategy.onPopState((ev) => {\n this._subject.next({\n 'url': this.path(true),\n 'pop': true,\n 'state': ev.state,\n 'type': ev.type,\n });\n });\n }\n\n /** @docs-private */\n ngOnDestroy(): void {\n this._urlChangeSubscription?.unsubscribe();\n this._urlChangeListeners = [];\n }\n\n /**\n * Normalizes the URL path for this location.\n *\n * @param includeHash True to include an anchor fragment in the path.\n *\n * @returns The normalized URL path.\n */\n // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is\n // removed.\n path(includeHash: boolean = false): string {\n return this.normalize(this._locationStrategy.path(includeHash));\n }\n\n /**\n * Reports the current state of the location history.\n * @returns The current value of the `history.state` object.\n */\n getState(): unknown {\n return this._locationStrategy.getState();\n }\n\n /**\n * Normalizes the given path and compares to the current normalized path.\n *\n * @param path The given URL path.\n * @param query Query parameters.\n *\n * @returns True if the given URL path is equal to the current normalized path, false\n * otherwise.\n */\n isCurrentPathEqualTo(path: string, query: string = ''): boolean {\n return this.path() == this.normalize(path + normalizeQueryParams(query));\n }\n\n /**\n * Normalizes a URL path by stripping any trailing slashes.\n *\n * @param url String representing a URL.\n *\n * @returns The normalized URL string.\n */\n normalize(url: string): string {\n return Location.stripTrailingSlash(_stripBasePath(this._basePath, _stripIndexHtml(url)));\n }\n\n /**\n * Normalizes an external URL path.\n * If the given URL doesn't begin with a leading slash (`'/'`), adds one\n * before normalizing. Adds a hash if `HashLocationStrategy` is\n * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.\n *\n * @param url String representing a URL.\n *\n * @returns A normalized platform-specific URL.\n */\n prepareExternalUrl(url: string): string {\n if (url && url[0] !== '/') {\n url = '/' + url;\n }\n return this._locationStrategy.prepareExternalUrl(url);\n }\n\n // TODO: rename this method to pushState\n /**\n * Changes the browser's URL to a normalized version of a given URL, and pushes a\n * new item onto the platform's history.\n *\n * @param path URL path to normalize.\n * @param query Query parameters.\n * @param state Location history state.\n *\n */\n go(path: string, query: string = '', state: any = null): void {\n this._locationStrategy.pushState(state, '', path, query);\n this._notifyUrlChangeListeners(\n this.prepareExternalUrl(path + normalizeQueryParams(query)),\n state,\n );\n }\n\n /**\n * Changes the browser's URL to a normalized version of the given URL, and replaces\n * the top item on the platform's history stack.\n *\n * @param path URL path to normalize.\n * @param query Query parameters.\n * @param state Location history state.\n */\n replaceState(path: string, query: string = '', state: any = null): void {\n this._locationStrategy.replaceState(state, '', path, query);\n this._notifyUrlChangeListeners(\n this.prepareExternalUrl(path + normalizeQueryParams(query)),\n state,\n );\n }\n\n /**\n * Navigates forward in the platform's history.\n */\n forward(): void {\n this._locationStrategy.forward();\n }\n\n /**\n * Navigates back in the platform's history.\n */\n back(): void {\n this._locationStrategy.back();\n }\n\n /**\n * Navigate to a specific page from session history, identified by its relative position to the\n * current page.\n *\n * @param relativePosition Position of the target page in the history relative to the current\n * page.\n * A negative value moves backwards, a positive value moves forwards, e.g. `location.historyGo(2)`\n * moves forward two pages and `location.historyGo(-2)` moves back two pages. When we try to go\n * beyond what's stored in the history session, we stay in the current page. Same behaviour occurs\n * when `relativePosition` equals 0.\n * @see https://developer.mozilla.org/en-US/docs/Web/API/History_API#Moving_to_a_specific_point_in_history\n */\n historyGo(relativePosition: number = 0): void {\n this._locationStrategy.historyGo?.(relativePosition);\n }\n\n /**\n * Registers a URL change listener. Use to catch updates performed by the Angular\n * framework that are not detectible through \"popstate\" or \"hashchange\" events.\n *\n * @param fn The change handler function, which take a URL and a location history state.\n * @returns A function that, when executed, unregisters a URL change listener.\n */\n onUrlChange(fn: (url: string, state: unknown) => void): VoidFunction {\n this._urlChangeListeners.push(fn);\n\n this._urlChangeSubscription ??= this.subscribe((v) => {\n this._notifyUrlChangeListeners(v.url, v.state);\n });\n\n return () => {\n const fnIndex = this._urlChangeListeners.indexOf(fn);\n this._urlChangeListeners.splice(fnIndex, 1);\n\n if (this._urlChangeListeners.length === 0) {\n this._urlChangeSubscription?.unsubscribe();\n this._urlChangeSubscription = null;\n }\n };\n }\n\n /** @internal */\n _notifyUrlChangeListeners(url: string = '', state: unknown) {\n this._urlChangeListeners.forEach((fn) => fn(url, state));\n }\n\n /**\n * Subscribes to the platform's `popState` events.\n *\n * Note: `Location.go()` does not trigger the `popState` event in the browser. Use\n * `Location.onUrlChange()` to subscribe to URL changes instead.\n *\n * @param value Event that is triggered when the state history changes.\n * @param exception The exception to throw.\n *\n * @see [onpopstate](https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onpopstate)\n *\n * @returns Subscribed events.\n */\n subscribe(\n onNext: (value: PopStateEvent) => void,\n onThrow?: ((exception: any) => void) | null,\n onReturn?: (() => void) | null,\n ): SubscriptionLike {\n return this._subject.subscribe({\n next: onNext,\n error: onThrow ?? undefined,\n complete: onReturn ?? undefined,\n });\n }\n\n /**\n * Normalizes URL parameters by prepending with `?` if needed.\n *\n * @param params String of URL parameters.\n *\n * @returns The normalized URL parameters string.\n */\n public static normalizeQueryParams: (params: string) => string = normalizeQueryParams;\n\n /**\n * Joins two parts of a URL with a slash if needed.\n *\n * @param start URL string\n * @param end URL string\n *\n *\n * @returns The joined URL string.\n */\n public static joinWithSlash: (start: string, end: string) => string = joinWithSlash;\n\n /**\n * Removes a trailing slash from a URL string if needed.\n * Looks for the first occurrence of either `#`, `?`, or the end of the\n * line as `/` characters and removes the trailing slash if one exists.\n *\n * @param url URL string.\n *\n * @returns The URL string, modified if needed.\n */\n public static stripTrailingSlash: (url: string) => string = stripTrailingSlash;\n}\n\nexport function createLocation() {\n return new Location(ɵɵinject(LocationStrategy as any));\n}\n\nfunction _stripBasePath(basePath: string, url: string): string {\n if (!basePath || !url.startsWith(basePath)) {\n return url;\n }\n const strippedUrl = url.substring(basePath.length);\n if (strippedUrl === '' || ['/', ';', '?', '#'].includes(strippedUrl[0])) {\n return strippedUrl;\n }\n return url;\n}\n\nfunction _stripIndexHtml(url: string): string {\n return url.replace(/\\/index.html$/, '');\n}\n\nfunction _stripOrigin(baseHref: string): string {\n // DO NOT REFACTOR! Previously, this check looked like this:\n // `/^(https?:)?\\/\\//.test(baseHref)`, but that resulted in\n // syntactically incorrect code after Closure Compiler minification.\n // This was likely caused by a bug in Closure Compiler, but\n // for now, the check is rewritten to use `new RegExp` instead.\n const isAbsoluteUrl = new RegExp('^(https?:)?//').test(baseHref);\n if (isAbsoluteUrl) {\n const [, pathname] = baseHref.split(/\\/\\/[^\\/]+/);\n return pathname;\n }\n return baseHref;\n}\n"],"names":["i1.LocationStrategy","ɵɵinject"],"mappings":";;;;;;;;;;AAQA,IAAI,IAAI,GAAe,IAAK;SAEZ,MAAM,GAAA;AACpB,IAAA,OAAO,IAAI;AACb;AAEM,SAAU,iBAAiB,CAAC,OAAmB,EAAA;IACnD,IAAI,KAAK,OAAO;AAClB;AAEA;;;;;AAKG;MACmB,UAAU,CAAA;AAgC/B;;AC5CD;;;;;;;;;;;;;;;;;;;;;AAqBG;MAEmB,gBAAgB,CAAA;AA4BpC,IAAA,SAAS,CAAE,gBAAwB,EAAA;AACjC,QAAA,MAAM,IAAI,KAAK,CAAC,SAAS,GAAG,iBAAiB,GAAG,EAAE,CAAC;;kHA7BjC,gBAAgB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA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AM,aAAa,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IAChE,IAAI,aAAa,EAAE;QACjB,MAAM,GAAG,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,CAAC;AACjD,QAAA,OAAO,QAAQ;;AAEjB,IAAA,OAAO,QAAQ;AACjB;;;;"}
@@ -1,14 +1,14 @@
1
1
  /**
2
- * @license Angular v20.1.0-next.2
2
+ * @license Angular v20.1.0-rc.0
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
7
  import * as i0 from '@angular/core';
8
- import { ɵRuntimeError as _RuntimeError, Injectable, InjectionToken, inject, NgZone, DestroyRef, PendingTasks, ɵConsole as _Console, ɵformatRuntimeError as _formatRuntimeError, runInInjectionContext, DOCUMENT, Inject, makeEnvironmentProviders, NgModule } from '@angular/core';
8
+ import { ɵRuntimeError as _RuntimeError, Injectable, InjectionToken, inject, NgZone, DestroyRef, ɵformatRuntimeError as _formatRuntimeError, PendingTasks, ɵConsole as _Console, runInInjectionContext, DOCUMENT, Inject, makeEnvironmentProviders, NgModule } from '@angular/core';
9
9
  import { concatMap, filter, map, finalize, switchMap } from 'rxjs/operators';
10
10
  import { of, Observable, from } from 'rxjs';
11
- import { XhrFactory, parseCookieValue } from './xhr-CEmSPUGj.mjs';
11
+ import { XhrFactory, parseCookieValue } from './xhr.mjs';
12
12
 
13
13
  /**
14
14
  * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
@@ -782,10 +782,34 @@ class HttpRequest {
782
782
  * Whether this request should be sent with outgoing credentials (cookies).
783
783
  */
784
784
  withCredentials = false;
785
+ /**
786
+ * The credentials mode of the request, which determines how cookies and HTTP authentication are handled.
787
+ * This can affect whether cookies are sent with the request, and how authentication is handled.
788
+ */
789
+ credentials;
785
790
  /**
786
791
  * When using the fetch implementation and set to `true`, the browser will not abort the associated request if the page that initiated it is unloaded before the request is complete.
787
792
  */
788
793
  keepalive = false;
794
+ /**
795
+ * Controls how the request will interact with the browser's HTTP cache.
796
+ * This affects whether a response is retrieved from the cache, how it is stored, or if it bypasses the cache altogether.
797
+ */
798
+ cache;
799
+ /**
800
+ * Indicates the relative priority of the request. This may be used by the browser to decide the order in which requests are dispatched and resources fetched.
801
+ */
802
+ priority;
803
+ /**
804
+ * The mode of the request, which determines how the request will interact with the browser's security model.
805
+ * This can affect things like CORS (Cross-Origin Resource Sharing) and same-origin policies.
806
+ */
807
+ mode;
808
+ /**
809
+ * The redirect mode of the request, which determines how redirects are handled.
810
+ * This can affect whether the request follows redirects automatically, or if it fails when a redirect occurs.
811
+ */
812
+ redirect;
789
813
  /**
790
814
  * The expected response type of the server.
791
815
  *
@@ -816,6 +840,10 @@ class HttpRequest {
816
840
  * The HttpTransferCache option for the request
817
841
  */
818
842
  transferCache;
843
+ /**
844
+ * The timeout for the backend HTTP request in ms.
845
+ */
846
+ timeout;
819
847
  constructor(method, url, third, fourth) {
820
848
  this.url = url;
821
849
  this.method = method.toUpperCase();
@@ -844,15 +872,38 @@ class HttpRequest {
844
872
  this.responseType = options.responseType;
845
873
  }
846
874
  // Override headers if they're provided.
847
- if (!!options.headers) {
875
+ if (options.headers) {
848
876
  this.headers = options.headers;
849
877
  }
850
- if (!!options.context) {
878
+ if (options.context) {
851
879
  this.context = options.context;
852
880
  }
853
- if (!!options.params) {
881
+ if (options.params) {
854
882
  this.params = options.params;
855
883
  }
884
+ if (options.priority) {
885
+ this.priority = options.priority;
886
+ }
887
+ if (options.cache) {
888
+ this.cache = options.cache;
889
+ }
890
+ if (options.credentials) {
891
+ this.credentials = options.credentials;
892
+ }
893
+ if (typeof options.timeout === 'number') {
894
+ // XHR will ignore any value below 1. AbortSignals only accept unsigned integers.
895
+ if (options.timeout < 1 || !Number.isInteger(options.timeout)) {
896
+ // TODO: create a runtime error
897
+ throw new Error(ngDevMode ? '`timeout` must be a positive integer value' : '');
898
+ }
899
+ this.timeout = options.timeout;
900
+ }
901
+ if (options.mode) {
902
+ this.mode = options.mode;
903
+ }
904
+ if (options.redirect) {
905
+ this.redirect = options.redirect;
906
+ }
856
907
  // We do want to assign transferCache even if it's falsy (false is valid value)
857
908
  this.transferCache = options.transferCache;
858
909
  }
@@ -967,9 +1018,15 @@ class HttpRequest {
967
1018
  const url = update.url || this.url;
968
1019
  const responseType = update.responseType || this.responseType;
969
1020
  const keepalive = update.keepalive ?? this.keepalive;
1021
+ const priority = update.priority || this.priority;
1022
+ const cache = update.cache || this.cache;
1023
+ const mode = update.mode || this.mode;
1024
+ const redirect = update.redirect || this.redirect;
1025
+ const credentials = update.credentials || this.credentials;
970
1026
  // Carefully handle the transferCache to differentiate between
971
1027
  // `false` and `undefined` in the update args.
972
1028
  const transferCache = update.transferCache ?? this.transferCache;
1029
+ const timeout = update.timeout ?? this.timeout;
973
1030
  // The body is somewhat special - a `null` value in update.body means
974
1031
  // whatever current body is present is being overridden with an empty
975
1032
  // body, whereas an `undefined` value in update.body implies no
@@ -1005,6 +1062,12 @@ class HttpRequest {
1005
1062
  withCredentials,
1006
1063
  transferCache,
1007
1064
  keepalive,
1065
+ cache,
1066
+ priority,
1067
+ timeout,
1068
+ mode,
1069
+ redirect,
1070
+ credentials,
1008
1071
  });
1009
1072
  }
1010
1073
  }
@@ -1292,6 +1355,10 @@ function addBody(options, body) {
1292
1355
  withCredentials: options.withCredentials,
1293
1356
  transferCache: options.transferCache,
1294
1357
  keepalive: options.keepalive,
1358
+ priority: options.priority,
1359
+ cache: options.cache,
1360
+ mode: options.mode,
1361
+ redirect: options.redirect,
1295
1362
  };
1296
1363
  }
1297
1364
  /**
@@ -1419,6 +1486,11 @@ class HttpClient {
1419
1486
  withCredentials: options.withCredentials,
1420
1487
  transferCache: options.transferCache,
1421
1488
  keepalive: options.keepalive,
1489
+ priority: options.priority,
1490
+ cache: options.cache,
1491
+ mode: options.mode,
1492
+ redirect: options.redirect,
1493
+ credentials: options.credentials,
1422
1494
  });
1423
1495
  }
1424
1496
  // Start with an Observable.of() the initial request, and run the handler (which
@@ -1573,10 +1645,10 @@ class HttpClient {
1573
1645
  put(url, body, options = {}) {
1574
1646
  return this.request('PUT', url, addBody(options, body));
1575
1647
  }
1576
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable });
1577
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClient });
1648
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClient, deps: [{ token: HttpHandler }], target: i0.ɵɵFactoryTarget.Injectable });
1649
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClient });
1578
1650
  }
1579
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClient, decorators: [{
1651
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClient, decorators: [{
1580
1652
  type: Injectable
1581
1653
  }], ctorParameters: () => [{ type: HttpHandler }] });
1582
1654
 
@@ -1626,7 +1698,22 @@ class FetchBackend {
1626
1698
  return new Observable((observer) => {
1627
1699
  const aborter = new AbortController();
1628
1700
  this.doRequest(request, aborter.signal, observer).then(noop, (error) => observer.error(new HttpErrorResponse({ error })));
1629
- return () => aborter.abort();
1701
+ let timeoutId;
1702
+ if (request.timeout) {
1703
+ // TODO: Replace with AbortSignal.any([aborter.signal, AbortSignal.timeout(request.timeout)])
1704
+ // when AbortSignal.any support is Baseline widely available (NET nov. 2026)
1705
+ timeoutId = this.ngZone.runOutsideAngular(() => setTimeout(() => {
1706
+ if (!aborter.signal.aborted) {
1707
+ aborter.abort(new DOMException('signal timed out', 'TimeoutError'));
1708
+ }
1709
+ }, request.timeout));
1710
+ }
1711
+ return () => {
1712
+ if (timeoutId !== undefined) {
1713
+ clearTimeout(timeoutId);
1714
+ }
1715
+ aborter.abort();
1716
+ };
1630
1717
  });
1631
1718
  }
1632
1719
  async doRequest(request, signal, observer) {
@@ -1789,7 +1876,16 @@ class FetchBackend {
1789
1876
  createRequestInit(req) {
1790
1877
  // We could share some of this logic with the XhrBackend
1791
1878
  const headers = {};
1792
- const credentials = req.withCredentials ? 'include' : undefined;
1879
+ let credentials;
1880
+ // If the request has a credentials property, use it.
1881
+ // Otherwise, if the request has withCredentials set to true, use 'include'.
1882
+ credentials = req.credentials;
1883
+ // If withCredentials is true should be set to 'include', for compatibility
1884
+ if (req.withCredentials) {
1885
+ // A warning is logged in development mode if the request has both
1886
+ (typeof ngDevMode === 'undefined' || ngDevMode) && warningOptionsMessage(req);
1887
+ credentials = 'include';
1888
+ }
1793
1889
  // Setting all the requested headers.
1794
1890
  req.headers.forEach((name, values) => (headers[name] = values.join(',')));
1795
1891
  // Add an Accept header if one isn't present already.
@@ -1810,6 +1906,10 @@ class FetchBackend {
1810
1906
  headers,
1811
1907
  credentials,
1812
1908
  keepalive: req.keepalive,
1909
+ cache: req.cache,
1910
+ priority: req.priority,
1911
+ mode: req.mode,
1912
+ redirect: req.redirect,
1813
1913
  };
1814
1914
  }
1815
1915
  concatChunks(chunks, totalLength) {
@@ -1821,10 +1921,10 @@ class FetchBackend {
1821
1921
  }
1822
1922
  return chunksAll;
1823
1923
  }
1824
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1825
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: FetchBackend });
1924
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: FetchBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
1925
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: FetchBackend });
1826
1926
  }
1827
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: FetchBackend, decorators: [{
1927
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: FetchBackend, decorators: [{
1828
1928
  type: Injectable
1829
1929
  }], ctorParameters: () => [] });
1830
1930
  /**
@@ -1833,6 +1933,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2",
1833
1933
  class FetchFactory {
1834
1934
  }
1835
1935
  function noop() { }
1936
+ function warningOptionsMessage(req) {
1937
+ if (req.credentials && req.withCredentials) {
1938
+ console.warn(_formatRuntimeError(2819 /* RuntimeErrorCode.WITH_CREDENTIALS_OVERRIDES_EXPLICIT_CREDENTIALS */, `Angular detected that a \`HttpClient\` request has both \`withCredentials: true\` and \`credentials: '${req.credentials}'\` options. The \`withCredentials\` option is overriding the explicit \`credentials\` setting to 'include'. Consider removing \`withCredentials\` and using \`credentials: '${req.credentials}'\` directly for clarity.`));
1939
+ }
1940
+ }
1836
1941
  /**
1837
1942
  * Zone.js treats a rejected promise that has not yet been awaited
1838
1943
  * as an unhandled error. This function adds a noop `.then` to make
@@ -1963,10 +2068,10 @@ class HttpInterceptorHandler extends HttpHandler {
1963
2068
  return this.chain(initialRequest, (downstreamRequest) => this.backend.handle(downstreamRequest));
1964
2069
  }
1965
2070
  }
1966
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
1967
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpInterceptorHandler });
2071
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpInterceptorHandler, deps: [{ token: HttpBackend }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2072
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpInterceptorHandler });
1968
2073
  }
1969
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
2074
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpInterceptorHandler, decorators: [{
1970
2075
  type: Injectable
1971
2076
  }], ctorParameters: () => [{ type: HttpBackend }, { type: i0.EnvironmentInjector }] });
1972
2077
 
@@ -2168,10 +2273,10 @@ class JsonpClientBackend {
2168
2273
  foreignDocument ??= this.document.implementation.createHTMLDocument();
2169
2274
  foreignDocument.adoptNode(script);
2170
2275
  }
2171
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
2172
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: JsonpClientBackend });
2276
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: JsonpClientBackend, deps: [{ token: JsonpCallbackContext }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
2277
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: JsonpClientBackend });
2173
2278
  }
2174
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: JsonpClientBackend, decorators: [{
2279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: JsonpClientBackend, decorators: [{
2175
2280
  type: Injectable
2176
2281
  }], ctorParameters: () => [{ type: JsonpCallbackContext }, { type: undefined, decorators: [{
2177
2282
  type: Inject,
@@ -2210,10 +2315,10 @@ class JsonpInterceptor {
2210
2315
  intercept(initialRequest, next) {
2211
2316
  return runInInjectionContext(this.injector, () => jsonpInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
2212
2317
  }
2213
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2214
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: JsonpInterceptor });
2318
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: JsonpInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2319
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: JsonpInterceptor });
2215
2320
  }
2216
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: JsonpInterceptor, decorators: [{
2321
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: JsonpInterceptor, decorators: [{
2217
2322
  type: Injectable
2218
2323
  }], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
2219
2324
 
@@ -2232,6 +2337,44 @@ function getResponseUrl(xhr) {
2232
2337
  }
2233
2338
  return null;
2234
2339
  }
2340
+ /**
2341
+ * Validates whether the request is compatible with the XHR backend.
2342
+ * Show a warning if the request contains options that are not supported by XHR.
2343
+ */
2344
+ function validateXhrCompatibility(req) {
2345
+ const unsupportedOptions = [
2346
+ {
2347
+ property: 'keepalive',
2348
+ errorCode: 2813 /* RuntimeErrorCode.KEEPALIVE_NOT_SUPPORTED_WITH_XHR */,
2349
+ },
2350
+ {
2351
+ property: 'cache',
2352
+ errorCode: 2814 /* RuntimeErrorCode.CACHE_NOT_SUPPORTED_WITH_XHR */,
2353
+ },
2354
+ {
2355
+ property: 'priority',
2356
+ errorCode: 2815 /* RuntimeErrorCode.PRIORITY_NOT_SUPPORTED_WITH_XHR */,
2357
+ },
2358
+ {
2359
+ property: 'mode',
2360
+ errorCode: 2816 /* RuntimeErrorCode.MODE_NOT_SUPPORTED_WITH_XHR */,
2361
+ },
2362
+ {
2363
+ property: 'redirect',
2364
+ errorCode: 2817 /* RuntimeErrorCode.REDIRECT_NOT_SUPPORTED_WITH_XHR */,
2365
+ },
2366
+ {
2367
+ property: 'credentials',
2368
+ errorCode: 2818 /* RuntimeErrorCode.CREDENTIALS_NOT_SUPPORTED_WITH_XHR */,
2369
+ },
2370
+ ];
2371
+ // Check each unsupported option and warn if present
2372
+ for (const { property, errorCode } of unsupportedOptions) {
2373
+ if (property in req) {
2374
+ console.warn(_formatRuntimeError(errorCode, `Angular detected that a \`HttpClient\` request with the \`${property}\` option was sent using XHR, which does not support it. To use the \`${property}\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
2375
+ }
2376
+ }
2377
+ }
2235
2378
  /**
2236
2379
  * Uses `XMLHttpRequest` to send requests to a backend server.
2237
2380
  * @see {@link HttpHandler}
@@ -2256,14 +2399,19 @@ class HttpXhrBackend {
2256
2399
  throw new _RuntimeError(-2800 /* RuntimeErrorCode.MISSING_JSONP_MODULE */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
2257
2400
  `Cannot make a JSONP request without JSONP support. To fix the problem, either add the \`withJsonpSupport()\` call (if \`provideHttpClient()\` is used) or import the \`HttpClientJsonpModule\` in the root NgModule.`);
2258
2401
  }
2259
- if (req.keepalive && ngDevMode) {
2260
- console.warn(_formatRuntimeError(2813 /* RuntimeErrorCode.KEEPALIVE_NOT_SUPPORTED_WITH_XHR */, `Angular detected that a \`HttpClient\` request with the \`keepalive\` option was sent using XHR, which does not support it. To use the \`keepalive\` option, enable Fetch API support by passing \`withFetch()\` as an argument to \`provideHttpClient()\`.`));
2261
- }
2402
+ // Validate that the request is compatible with the XHR backend.
2403
+ ngDevMode && validateXhrCompatibility(req);
2262
2404
  // Check whether this factory has a special function to load an XHR implementation
2263
2405
  // for various non-browser environments. We currently limit it to only `ServerXhr`
2264
2406
  // class, which needs to load an XHR implementation.
2265
2407
  const xhrFactory = this.xhrFactory;
2266
- const source = xhrFactory.ɵloadImpl
2408
+ const source =
2409
+ // Note that `ɵloadImpl` is never defined in client bundles and can be
2410
+ // safely dropped whenever we're running in the browser.
2411
+ // This branching is redundant.
2412
+ // The `ngServerMode` guard also enables tree-shaking of the `from()`
2413
+ // function from the common bundle, as it's only used in server code.
2414
+ typeof ngServerMode !== 'undefined' && ngServerMode && xhrFactory.ɵloadImpl
2267
2415
  ? from(xhrFactory.ɵloadImpl())
2268
2416
  : of(null);
2269
2417
  return source.pipe(switchMap(() => {
@@ -2290,6 +2438,9 @@ class HttpXhrBackend {
2290
2438
  xhr.setRequestHeader(CONTENT_TYPE_HEADER, detectedType);
2291
2439
  }
2292
2440
  }
2441
+ if (req.timeout) {
2442
+ xhr.timeout = req.timeout;
2443
+ }
2293
2444
  // Set the responseType if one was requested.
2294
2445
  if (req.responseType) {
2295
2446
  const responseType = req.responseType.toLowerCase();
@@ -2410,6 +2561,19 @@ class HttpXhrBackend {
2410
2561
  });
2411
2562
  observer.error(res);
2412
2563
  };
2564
+ let onTimeout = onError;
2565
+ if (req.timeout) {
2566
+ onTimeout = (_) => {
2567
+ const { url } = partialFromXhr();
2568
+ const res = new HttpErrorResponse({
2569
+ error: new DOMException('Request timed out', 'TimeoutError'),
2570
+ status: xhr.status || 0,
2571
+ statusText: xhr.statusText || 'Request timeout',
2572
+ url: url || undefined,
2573
+ });
2574
+ observer.error(res);
2575
+ };
2576
+ }
2413
2577
  // The sentHeaders flag tracks whether the HttpResponseHeaders event
2414
2578
  // has been sent on the stream. This is necessary to track if progress
2415
2579
  // is enabled since the event will be sent on only the first download
@@ -2462,7 +2626,7 @@ class HttpXhrBackend {
2462
2626
  // By default, register for load and error events.
2463
2627
  xhr.addEventListener('load', onLoad);
2464
2628
  xhr.addEventListener('error', onError);
2465
- xhr.addEventListener('timeout', onError);
2629
+ xhr.addEventListener('timeout', onTimeout);
2466
2630
  xhr.addEventListener('abort', onError);
2467
2631
  // Progress events are only enabled if requested.
2468
2632
  if (req.reportProgress) {
@@ -2483,7 +2647,7 @@ class HttpXhrBackend {
2483
2647
  xhr.removeEventListener('error', onError);
2484
2648
  xhr.removeEventListener('abort', onError);
2485
2649
  xhr.removeEventListener('load', onLoad);
2486
- xhr.removeEventListener('timeout', onError);
2650
+ xhr.removeEventListener('timeout', onTimeout);
2487
2651
  if (req.reportProgress) {
2488
2652
  xhr.removeEventListener('progress', onDownProgress);
2489
2653
  if (reqBody !== null && xhr.upload) {
@@ -2498,10 +2662,10 @@ class HttpXhrBackend {
2498
2662
  });
2499
2663
  }));
2500
2664
  }
2501
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXhrBackend, deps: [{ token: XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable });
2502
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXhrBackend });
2665
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXhrBackend, deps: [{ token: XhrFactory }], target: i0.ɵɵFactoryTarget.Injectable });
2666
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXhrBackend });
2503
2667
  }
2504
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXhrBackend, decorators: [{
2668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXhrBackend, decorators: [{
2505
2669
  type: Injectable
2506
2670
  }], ctorParameters: () => [{ type: XhrFactory }] });
2507
2671
 
@@ -2551,10 +2715,10 @@ class HttpXsrfCookieExtractor {
2551
2715
  }
2552
2716
  return this.lastToken;
2553
2717
  }
2554
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable });
2555
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXsrfCookieExtractor });
2718
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXsrfCookieExtractor, deps: [{ token: DOCUMENT }, { token: XSRF_COOKIE_NAME }], target: i0.ɵɵFactoryTarget.Injectable });
2719
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXsrfCookieExtractor });
2556
2720
  }
2557
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
2721
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXsrfCookieExtractor, decorators: [{
2558
2722
  type: Injectable
2559
2723
  }], ctorParameters: () => [{ type: undefined, decorators: [{
2560
2724
  type: Inject,
@@ -2595,10 +2759,10 @@ class HttpXsrfInterceptor {
2595
2759
  intercept(initialRequest, next) {
2596
2760
  return runInInjectionContext(this.injector, () => xsrfInterceptorFn(initialRequest, (downstreamRequest) => next.handle(downstreamRequest)));
2597
2761
  }
2598
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2599
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXsrfInterceptor });
2762
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXsrfInterceptor, deps: [{ token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable });
2763
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXsrfInterceptor });
2600
2764
  }
2601
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
2765
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpXsrfInterceptor, decorators: [{
2602
2766
  type: Injectable
2603
2767
  }], ctorParameters: () => [{ type: i0.EnvironmentInjector }] });
2604
2768
 
@@ -2864,9 +3028,9 @@ class HttpClientXsrfModule {
2864
3028
  providers: withXsrfConfiguration(options).ɵproviders,
2865
3029
  };
2866
3030
  }
2867
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2868
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientXsrfModule });
2869
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientXsrfModule, providers: [
3031
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientXsrfModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3032
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientXsrfModule });
3033
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientXsrfModule, providers: [
2870
3034
  HttpXsrfInterceptor,
2871
3035
  { provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
2872
3036
  { provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
@@ -2877,7 +3041,7 @@ class HttpClientXsrfModule {
2877
3041
  { provide: XSRF_ENABLED, useValue: true },
2878
3042
  ] });
2879
3043
  }
2880
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
3044
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientXsrfModule, decorators: [{
2881
3045
  type: NgModule,
2882
3046
  args: [{
2883
3047
  providers: [
@@ -2903,11 +3067,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2",
2903
3067
  * @deprecated use `provideHttpClient(withInterceptorsFromDi())` as providers instead
2904
3068
  */
2905
3069
  class HttpClientModule {
2906
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2907
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientModule });
2908
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientModule, providers: [provideHttpClient(withInterceptorsFromDi())] });
3070
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3071
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientModule });
3072
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientModule, providers: [provideHttpClient(withInterceptorsFromDi())] });
2909
3073
  }
2910
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientModule, decorators: [{
3074
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientModule, decorators: [{
2911
3075
  type: NgModule,
2912
3076
  args: [{
2913
3077
  /**
@@ -2927,11 +3091,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2",
2927
3091
  * @deprecated `withJsonpSupport()` as providers instead
2928
3092
  */
2929
3093
  class HttpClientJsonpModule {
2930
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2931
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientJsonpModule });
2932
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientJsonpModule, providers: [withJsonpSupport().ɵproviders] });
3094
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientJsonpModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
3095
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientJsonpModule });
3096
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientJsonpModule, providers: [withJsonpSupport().ɵproviders] });
2933
3097
  }
2934
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
3098
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-rc.0", ngImport: i0, type: HttpClientJsonpModule, decorators: [{
2935
3099
  type: NgModule,
2936
3100
  args: [{
2937
3101
  providers: [withJsonpSupport().ɵproviders],
@@ -2939,4 +3103,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.0-next.2",
2939
3103
  }] });
2940
3104
 
2941
3105
  export { FetchBackend, HTTP_INTERCEPTORS, HTTP_ROOT_INTERCEPTOR_FNS, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpContext, HttpContextToken, HttpErrorResponse, HttpEventType, HttpFeatureKind, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpInterceptorHandler, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpStatusCode, HttpUrlEncodingCodec, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, REQUESTS_CONTRIBUTE_TO_STABILITY, provideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXsrfConfiguration };
2942
- //# sourceMappingURL=module-CBsxN_3E.mjs.map
3106
+ //# sourceMappingURL=module.mjs.map