/** * @license Angular v19.2.4 * (c) 2010-2025 Google LLC. https://angular.io/ * License: MIT */ import { ɵDomAdapter as _DomAdapter, ɵsetRootDomAdapter as _setRootDomAdapter, ɵparseCookieValue as _parseCookieValue, ɵgetDOM as _getDOM, isPlatformServer, DOCUMENT, CommonModule, XhrFactory, ɵPLATFORM_BROWSER_ID as _PLATFORM_BROWSER_ID } from '@angular/common'; export { ɵgetDOM } from '@angular/common'; import * as i0 from '@angular/core'; import { ɵglobal as _global, ɵRuntimeError as _RuntimeError, Injectable, InjectionToken, Inject, APP_ID, CSP_NONCE, PLATFORM_ID, Optional, ViewEncapsulation, ɵTracingService as _TracingService, RendererStyleFlags2, createPlatformFactory, ɵinternalCreateApplication as _internalCreateApplication, inject, ApplicationModule, ɵINJECTOR_SCOPE as _INJECTOR_SCOPE, ErrorHandler, RendererFactory2, ɵTESTABILITY_GETTER as _TESTABILITY_GETTER, NgZone, TestabilityRegistry, Testability, ɵTESTABILITY as _TESTABILITY, platformCore, PLATFORM_INITIALIZER, ɵsetDocument as _setDocument, NgModule, ApplicationRef, Injector, ɵConsole as _Console, ɵXSS_SECURITY_URL as _XSS_SECURITY_URL, SecurityContext, ɵallowSanitizationBypassAndThrow as _allowSanitizationBypassAndThrow, ɵunwrapSafeValue as _unwrapSafeValue, ɵ_sanitizeUrl as __sanitizeUrl, ɵ_sanitizeHtml as __sanitizeHtml, ɵbypassSanitizationTrustHtml as _bypassSanitizationTrustHtml, ɵbypassSanitizationTrustStyle as _bypassSanitizationTrustStyle, ɵbypassSanitizationTrustScript as _bypassSanitizationTrustScript, ɵbypassSanitizationTrustUrl as _bypassSanitizationTrustUrl, ɵbypassSanitizationTrustResourceUrl as _bypassSanitizationTrustResourceUrl, forwardRef, makeEnvironmentProviders, ɵwithDomHydration as _withDomHydration, ɵwithEventReplay as _withEventReplay, ɵwithI18nSupport as _withI18nSupport, ɵwithIncrementalHydration as _withIncrementalHydration, ENVIRONMENT_INITIALIZER, ɵZONELESS_ENABLED as _ZONELESS_ENABLED, ɵformatRuntimeError as _formatRuntimeError, Version } from '@angular/core'; import { ɵwithHttpTransferCache as _withHttpTransferCache } from '@angular/common/http'; /** * Provides DOM operations in any browser environment. * * @security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. */ class GenericBrowserDomAdapter extends _DomAdapter { supportsDOMEvents = true; } /** * A `DomAdapter` powered by full browser DOM APIs. * * @security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. */ class BrowserDomAdapter extends GenericBrowserDomAdapter { static makeCurrent() { _setRootDomAdapter(new BrowserDomAdapter()); } onAndCancel(el, evt, listener, options) { el.addEventListener(evt, listener, options); return () => { el.removeEventListener(evt, listener, options); }; } dispatchEvent(el, evt) { el.dispatchEvent(evt); } remove(node) { node.remove(); } createElement(tagName, doc) { doc = doc || this.getDefaultDocument(); return doc.createElement(tagName); } createHtmlDocument() { return document.implementation.createHTMLDocument('fakeTitle'); } getDefaultDocument() { return document; } isElementNode(node) { return node.nodeType === Node.ELEMENT_NODE; } isShadowRoot(node) { return node instanceof DocumentFragment; } /** @deprecated No longer being used in Ivy code. To be removed in version 14. */ getGlobalEventTarget(doc, target) { if (target === 'window') { return window; } if (target === 'document') { return doc; } if (target === 'body') { return doc.body; } return null; } getBaseHref(doc) { const href = getBaseElementHref(); return href == null ? null : relativePath(href); } resetBaseElement() { baseElement = null; } getUserAgent() { return window.navigator.userAgent; } getCookie(name) { return _parseCookieValue(document.cookie, name); } } let baseElement = null; function getBaseElementHref() { baseElement = baseElement || document.querySelector('base'); return baseElement ? baseElement.getAttribute('href') : null; } function relativePath(url) { // The base URL doesn't really matter, we just need it so relative paths have something // to resolve against. In the browser `HTMLBaseElement.href` is always absolute. return new URL(url, document.baseURI).pathname; } class BrowserGetTestability { addToWindow(registry) { _global['getAngularTestability'] = (elem, findInAncestors = true) => { const testability = registry.findTestabilityInTree(elem, findInAncestors); if (testability == null) { throw new _RuntimeError(5103 /* RuntimeErrorCode.TESTABILITY_NOT_FOUND */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Could not find testability for element.'); } return testability; }; _global['getAllAngularTestabilities'] = () => registry.getAllTestabilities(); _global['getAllAngularRootElements'] = () => registry.getAllRootElements(); const whenAllStable = (callback) => { const testabilities = _global['getAllAngularTestabilities'](); let count = testabilities.length; const decrement = function () { count--; if (count == 0) { callback(); } }; testabilities.forEach((testability) => { testability.whenStable(decrement); }); }; if (!_global['frameworkStabilizers']) { _global['frameworkStabilizers'] = []; } _global['frameworkStabilizers'].push(whenAllStable); } findTestabilityInTree(registry, elem, findInAncestors) { if (elem == null) { return null; } const t = registry.getTestability(elem); if (t != null) { return t; } else if (!findInAncestors) { return null; } if (_getDOM().isShadowRoot(elem)) { return this.findTestabilityInTree(registry, elem.host, true); } return this.findTestabilityInTree(registry, elem.parentElement, true); } } /** * A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API. */ class BrowserXhr { build() { return new XMLHttpRequest(); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BrowserXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BrowserXhr }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: BrowserXhr, decorators: [{ type: Injectable }] }); /** * The injection token for plugins of the `EventManager` service. * * @publicApi */ const EVENT_MANAGER_PLUGINS = new InjectionToken(ngDevMode ? 'EventManagerPlugins' : ''); /** * An injectable service that provides event management for Angular * through a browser plug-in. * * @publicApi */ class EventManager { _zone; _plugins; _eventNameToPlugin = new Map(); /** * Initializes an instance of the event-manager service. */ constructor(plugins, _zone) { this._zone = _zone; plugins.forEach((plugin) => { plugin.manager = this; }); this._plugins = plugins.slice().reverse(); } /** * Registers a handler for a specific element and event. * * @param element The HTML element to receive event notifications. * @param eventName The name of the event to listen for. * @param handler A function to call when the notification occurs. Receives the * event object as an argument. * @param options Options that configure how the event listener is bound. * @returns A callback function that can be used to remove the handler. */ addEventListener(element, eventName, handler, options) { const plugin = this._findPluginFor(eventName); return plugin.addEventListener(element, eventName, handler, options); } /** * Retrieves the compilation zone in which event listeners are registered. */ getZone() { return this._zone; } /** @internal */ _findPluginFor(eventName) { let plugin = this._eventNameToPlugin.get(eventName); if (plugin) { return plugin; } const plugins = this._plugins; plugin = plugins.find((plugin) => plugin.supports(eventName)); if (!plugin) { throw new _RuntimeError(5101 /* RuntimeErrorCode.NO_PLUGIN_FOR_EVENT */, (typeof ngDevMode === 'undefined' || ngDevMode) && `No event manager plugin found for event ${eventName}`); } this._eventNameToPlugin.set(eventName, plugin); return plugin; } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EventManager, deps: [{ token: EVENT_MANAGER_PLUGINS }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EventManager }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.4", ngImport: i0, type: EventManager, decorators: [{ type: Injectable }], ctorParameters: () => [{ type: undefined, decorators: [{ type: Inject, args: [EVENT_MANAGER_PLUGINS] }] }, { type: i0.NgZone }] }); /** * The plugin definition for the `EventManager` class * * It can be used as a base class to create custom manager plugins, i.e. you can create your own * class that extends the `EventManagerPlugin` one. * * @publicApi */ class EventManagerPlugin { _doc; // TODO: remove (has some usage in G3) constructor(_doc) { this._doc = _doc; } // Using non-null assertion because it's set by EventManager's constructor manager; } /** The style elements attribute name used to set value of `APP_ID` token. */ const APP_ID_ATTRIBUTE_NAME = 'ng-app-id'; /** * Removes all provided elements from the document. * @param elements An array of HTML Elements. */ function removeElements(elements) { for (const element of elements) { element.remove(); } } /** * Creates a `style` element with the provided inline style content. * @param style A string of the inline style content. * @param doc A DOM Document to use to create the element. * @returns An HTMLStyleElement instance. */ function createStyleElement(style, doc) { const styleElement = doc.createElement('style'); styleElement.textContent = style; return styleElement; } /** * Searches a DOM document's head element for style elements with a matching application * identifier attribute (`ng-app-id`) to the provide identifier and adds usage records for each. * @param doc An HTML DOM document instance. * @param appId A string containing an Angular application identifer. * @param inline A Map object for tracking inline (defined via `styles` in component decorator) style usage. * @param external A Map object for tracking external (defined via `styleUrls` in component decorator) style usage. */ function addServerStyles(doc, appId, inline, external) { const elements = doc.head?.querySelectorAll(`style[${APP_ID_ATTRIBUTE_NAME}="${appId}"],link[${APP_ID_ATTRIBUTE_NAME}="${appId}"]`); if (elements) { for (const styleElement of elements) { styleElement.removeAttribute(APP_ID_ATTRIBUTE_NAME); if (styleElement instanceof HTMLLinkElement) { // Only use filename from href // The href is build time generated with a unique value to prevent duplicates. external.set(styleElement.href.slice(styleElement.href.lastIndexOf('/') + 1), { usage: 0, elements: [styleElement], }); } else if (styleElement.textContent) { inline.set(styleElement.textContent, { usage: 0, elements: [styleElement] }); } } } } /** * Creates a `link` element for the provided external style URL. * @param url A string of the URL for the stylesheet. * @param doc A DOM Document to use to create the element. * @returns An HTMLLinkElement instance. */ function createLinkElement(url, doc) { const linkElement = doc.createElement('link'); linkElement.setAttribute('rel', 'stylesheet'); linkElement.setAttribute('href', url); return linkElement; } class SharedStylesHost { doc; appId; nonce; /** * Provides usage information for active inline style content and associated HTML