Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
{"version":3,"file":"platform-browser.mjs","sources":["../../../../../../packages/platform-browser/src/browser/generic_browser_adapter.ts","../../../../../../packages/platform-browser/src/browser/browser_adapter.ts","../../../../../../packages/platform-browser/src/browser/testability.ts","../../../../../../packages/platform-browser/src/browser/xhr.ts","../../../../../../packages/platform-browser/src/dom/events/event_manager.ts","../../../../../../packages/platform-browser/src/dom/shared_styles_host.ts","../../../../../../packages/platform-browser/src/dom/dom_renderer.ts","../../../../../../packages/platform-browser/src/dom/events/dom_events.ts","../../../../../../packages/platform-browser/src/dom/events/event_delegation.ts","../../../../../../packages/platform-browser/src/dom/events/key_events.ts","../../../../../../packages/platform-browser/src/browser.ts","../../../../../../packages/platform-browser/src/browser/meta.ts","../../../../../../packages/platform-browser/src/browser/title.ts","../../../../../../packages/platform-browser/src/dom/util.ts","../../../../../../packages/platform-browser/src/browser/tools/common_tools.ts","../../../../../../packages/platform-browser/src/browser/tools/tools.ts","../../../../../../packages/platform-browser/src/dom/debug/by.ts","../../../../../../packages/platform-browser/src/dom/events/hammer_gestures.ts","../../../../../../packages/platform-browser/src/security/dom_sanitization_service.ts","../../../../../../packages/platform-browser/src/hydration.ts","../../../../../../packages/platform-browser/src/version.ts","../../../../../../packages/platform-browser/public_api.ts","../../../../../../packages/platform-browser/index.ts","../../../../../../packages/platform-browser/platform-browser.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.io/license\n */\n\nimport {ɵDomAdapter as DomAdapter} from '@angular/common';\n\n/**\n * Provides DOM operations in any browser environment.\n *\n * @security Tread carefully! Interacting with the DOM directly is dangerous and\n * can introduce XSS risks.\n */\nexport abstract class GenericBrowserDomAdapter extends DomAdapter {\n override readonly supportsDOMEvents: boolean = true;\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.io/license\n */\n\nimport {\n ɵparseCookieValue as parseCookieValue,\n ɵsetRootDomAdapter as setRootDomAdapter,\n} from '@angular/common';\n\nimport {GenericBrowserDomAdapter} from './generic_browser_adapter';\n\n/**\n * A `DomAdapter` powered by full browser DOM APIs.\n *\n * @security Tread carefully! Interacting with the DOM directly is dangerous and\n * can introduce XSS risks.\n */\n/* tslint:disable:requireParameterType no-console */\nexport class BrowserDomAdapter extends GenericBrowserDomAdapter {\n static makeCurrent() {\n setRootDomAdapter(new BrowserDomAdapter());\n }\n\n override onAndCancel(el: Node, evt: any, listener: any): Function {\n el.addEventListener(evt, listener);\n return () => {\n el.removeEventListener(evt, listener);\n };\n }\n override dispatchEvent(el: Node, evt: any) {\n el.dispatchEvent(evt);\n }\n override remove(node: Node): void {\n (node as Element | Text | Comment).remove();\n }\n override createElement(tagName: string, doc?: Document): HTMLElement {\n doc = doc || this.getDefaultDocument();\n return doc.createElement(tagName);\n }\n override createHtmlDocument(): Document {\n return document.implementation.createHTMLDocument('fakeTitle');\n }\n override getDefaultDocument(): Document {\n return document;\n }\n\n override isElementNode(node: Node): boolean {\n return node.nodeType === Node.ELEMENT_NODE;\n }\n\n override isShadowRoot(node: any): boolean {\n return node instanceof DocumentFragment;\n }\n\n /** @deprecated No longer being used in Ivy code. To be removed in version 14. */\n override getGlobalEventTarget(doc: Document, target: string): EventTarget | null {\n if (target === 'window') {\n return window;\n }\n if (target === 'document') {\n return doc;\n }\n if (target === 'body') {\n return doc.body;\n }\n return null;\n }\n override getBaseHref(doc: Document): string | null {\n const href = getBaseElementHref();\n return href == null ? null : relativePath(href);\n }\n override resetBaseElement(): void {\n baseElement = null;\n }\n override getUserAgent(): string {\n return window.navigator.userAgent;\n }\n override getCookie(name: string): string | null {\n return parseCookieValue(document.cookie, name);\n }\n}\n\nlet baseElement: HTMLElement | null = null;\nfunction getBaseElementHref(): string | null {\n baseElement = baseElement || document.querySelector('base');\n return baseElement ? baseElement.getAttribute('href') : null;\n}\n\nfunction relativePath(url: string): string {\n // The base URL doesn't really matter, we just need it so relative paths have something\n // to resolve against. In the browser `HTMLBaseElement.href` is always absolute.\n return new URL(url, document.baseURI).pathname;\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.io/license\n */\n\nimport {ɵgetDOM as getDOM} from '@angular/common';\nimport {\n GetTestability,\n Testability,\n TestabilityRegistry,\n ɵglobal as global,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\n\nimport {RuntimeErrorCode} from '../errors';\n\nexport class BrowserGetTestability implements GetTestability {\n addToWindow(registry: TestabilityRegistry): void {\n global['getAngularTestability'] = (elem: any, findInAncestors: boolean = true) => {\n const testability = registry.findTestabilityInTree(elem, findInAncestors);\n if (testability == null) {\n throw new RuntimeError(\n RuntimeErrorCode.TESTABILITY_NOT_FOUND,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n 'Could not find testability for element.',\n );\n }\n return testability;\n };\n\n global['getAllAngularTestabilities'] = () => registry.getAllTestabilities();\n\n global['getAllAngularRootElements'] = () => registry.getAllRootElements();\n\n const whenAllStable = (callback: () => void) => {\n const testabilities = global['getAllAngularTestabilities']() as Testability[];\n let count = testabilities.length;\n const decrement = function () {\n count--;\n if (count == 0) {\n callback();\n }\n };\n testabilities.forEach((testability) => {\n testability.whenStable(decrement);\n });\n };\n\n if (!global['frameworkStabilizers']) {\n global['frameworkStabilizers'] = [];\n }\n global['frameworkStabilizers'].push(whenAllStable);\n }\n\n findTestabilityInTree(\n registry: TestabilityRegistry,\n elem: any,\n findInAncestors: boolean,\n ): Testability | null {\n if (elem == null) {\n return null;\n }\n const t = registry.getTestability(elem);\n if (t != null) {\n return t;\n } else if (!findInAncestors) {\n return null;\n }\n if (getDOM().isShadowRoot(elem)) {\n return this.findTestabilityInTree(registry, (elem).host, true);\n }\n return this.findTestabilityInTree(registry, elem.parentElement, true);\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.io/license\n */\n\nimport {XhrFactory} from '@angular/common';\nimport {Injectable} from '@angular/core';\n\n/**\n * A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API.\n */\n@Injectable()\nexport class BrowserXhr implements XhrFactory {\n build(): XMLHttpRequest {\n return new XMLHttpRequest();\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.io/license\n */\n\nimport {\n Inject,\n Injectable,\n InjectionToken,\n NgZone,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\n\nimport {RuntimeErrorCode} from '../../errors';\n\n/**\n * The injection token for plugins of the `EventManager` service.\n *\n * @publicApi\n */\nexport const EVENT_MANAGER_PLUGINS = new InjectionToken(\n ngDevMode ? 'EventManagerPlugins' : '',\n);\n\n/**\n * An injectable service that provides event management for Angular\n * through a browser plug-in.\n *\n * @publicApi\n */\n@Injectable()\nexport class EventManager {\n private _plugins: EventManagerPlugin[];\n private _eventNameToPlugin = new Map();\n\n /**\n * Initializes an instance of the event-manager service.\n */\n constructor(\n @Inject(EVENT_MANAGER_PLUGINS) plugins: EventManagerPlugin[],\n private _zone: NgZone,\n ) {\n plugins.forEach((plugin) => {\n plugin.manager = this;\n });\n this._plugins = plugins.slice().reverse();\n }\n\n /**\n * Registers a handler for a specific element and event.\n *\n * @param element The HTML element to receive event notifications.\n * @param eventName The name of the event to listen for.\n * @param handler A function to call when the notification occurs. Receives the\n * event object as an argument.\n * @returns A callback function that can be used to remove the handler.\n */\n addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {\n const plugin = this._findPluginFor(eventName);\n return plugin.addEventListener(element, eventName, handler);\n }\n\n /**\n * Retrieves the compilation zone in which event listeners are registered.\n */\n getZone(): NgZone {\n return this._zone;\n }\n\n /** @internal */\n _findPluginFor(eventName: string): EventManagerPlugin {\n let plugin = this._eventNameToPlugin.get(eventName);\n if (plugin) {\n return plugin;\n }\n\n const plugins = this._plugins;\n plugin = plugins.find((plugin) => plugin.supports(eventName));\n if (!plugin) {\n throw new RuntimeError(\n RuntimeErrorCode.NO_PLUGIN_FOR_EVENT,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n `No event manager plugin found for event ${eventName}`,\n );\n }\n\n this._eventNameToPlugin.set(eventName, plugin);\n return plugin;\n }\n}\n\n/**\n * The plugin definition for the `EventManager` class\n *\n * It can be used as a base class to create custom manager plugins, i.e. you can create your own\n * class that extends the `EventManagerPlugin` one.\n *\n * @publicApi\n */\nexport abstract class EventManagerPlugin {\n // TODO: remove (has some usage in G3)\n constructor(private _doc: any) {}\n\n // Using non-null assertion because it's set by EventManager's constructor\n manager!: EventManager;\n\n /**\n * Should return `true` for every event name that should be supported by this plugin\n */\n abstract supports(eventName: string): boolean;\n\n /**\n * Implement the behaviour for the supported events\n */\n abstract addEventListener(element: HTMLElement, eventName: string, handler: Function): Function;\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.io/license\n */\n\nimport {DOCUMENT, isPlatformServer} from '@angular/common';\nimport {\n APP_ID,\n CSP_NONCE,\n Inject,\n Injectable,\n OnDestroy,\n Optional,\n PLATFORM_ID,\n} from '@angular/core';\n\n/** The style elements attribute name used to set value of `APP_ID` token. */\nconst APP_ID_ATTRIBUTE_NAME = 'ng-app-id';\n\n@Injectable()\nexport class SharedStylesHost implements OnDestroy {\n // Maps all registered host nodes to a list of style nodes that have been added to the host node.\n private readonly styleRef = new Map<\n string /** Style string */,\n {\n elements: HTMLStyleElement[];\n usage: number;\n }\n >();\n private readonly hostNodes = new Set();\n private readonly styleNodesInDOM: Map | null;\n private readonly platformIsServer: boolean;\n\n constructor(\n @Inject(DOCUMENT) private readonly doc: Document,\n @Inject(APP_ID) private readonly appId: string,\n @Inject(CSP_NONCE) @Optional() private nonce?: string | null,\n @Inject(PLATFORM_ID) readonly platformId: object = {},\n ) {\n this.styleNodesInDOM = this.collectServerRenderedStyles();\n this.platformIsServer = isPlatformServer(platformId);\n this.resetHostNodes();\n }\n\n addStyles(styles: string[]): void {\n for (const style of styles) {\n const usageCount = this.changeUsageCount(style, 1);\n\n if (usageCount === 1) {\n this.onStyleAdded(style);\n }\n }\n }\n\n removeStyles(styles: string[]): void {\n for (const style of styles) {\n const usageCount = this.changeUsageCount(style, -1);\n\n if (usageCount <= 0) {\n this.onStyleRemoved(style);\n }\n }\n }\n\n ngOnDestroy(): void {\n const styleNodesInDOM = this.styleNodesInDOM;\n if (styleNodesInDOM) {\n styleNodesInDOM.forEach((node) => node.remove());\n styleNodesInDOM.clear();\n }\n\n for (const style of this.getAllStyles()) {\n this.onStyleRemoved(style);\n }\n\n this.resetHostNodes();\n }\n\n addHost(hostNode: Node): void {\n this.hostNodes.add(hostNode);\n\n for (const style of this.getAllStyles()) {\n this.addStyleToHost(hostNode, style);\n }\n }\n\n removeHost(hostNode: Node): void {\n this.hostNodes.delete(hostNode);\n }\n\n private getAllStyles(): IterableIterator {\n return this.styleRef.keys();\n }\n\n private onStyleAdded(style: string): void {\n for (const host of this.hostNodes) {\n this.addStyleToHost(host, style);\n }\n }\n\n private onStyleRemoved(style: string): void {\n const styleRef = this.styleRef;\n styleRef.get(style)?.elements?.forEach((node) => node.remove());\n styleRef.delete(style);\n }\n\n private collectServerRenderedStyles(): Map | null {\n const styles = this.doc.head?.querySelectorAll(\n `style[${APP_ID_ATTRIBUTE_NAME}=\"${this.appId}\"]`,\n );\n\n if (styles?.length) {\n const styleMap = new Map();\n\n styles.forEach((style) => {\n if (style.textContent != null) {\n styleMap.set(style.textContent, style);\n }\n });\n\n return styleMap;\n }\n\n return null;\n }\n\n private changeUsageCount(style: string, delta: number): number {\n const map = this.styleRef;\n if (map.has(style)) {\n const styleRefValue = map.get(style)!;\n styleRefValue.usage += delta;\n\n return styleRefValue.usage;\n }\n\n map.set(style, {usage: delta, elements: []});\n return delta;\n }\n\n private getStyleElement(host: Node, style: string): HTMLStyleElement {\n const styleNodesInDOM = this.styleNodesInDOM;\n const styleEl = styleNodesInDOM?.get(style);\n if (styleEl?.parentNode === host) {\n // `styleNodesInDOM` cannot be undefined due to the above `styleNodesInDOM?.get`.\n styleNodesInDOM!.delete(style);\n\n styleEl.removeAttribute(APP_ID_ATTRIBUTE_NAME);\n\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // This attribute is solely used for debugging purposes.\n styleEl.setAttribute('ng-style-reused', '');\n }\n\n return styleEl;\n } else {\n const styleEl = this.doc.createElement('style');\n\n if (this.nonce) {\n styleEl.setAttribute('nonce', this.nonce);\n }\n\n styleEl.textContent = style;\n\n if (this.platformIsServer) {\n styleEl.setAttribute(APP_ID_ATTRIBUTE_NAME, this.appId);\n }\n\n host.appendChild(styleEl);\n\n return styleEl;\n }\n }\n\n private addStyleToHost(host: Node, style: string): void {\n const styleEl = this.getStyleElement(host, style);\n const styleRef = this.styleRef;\n const styleElRef = styleRef.get(style)?.elements;\n if (styleElRef) {\n styleElRef.push(styleEl);\n } else {\n styleRef.set(style, {elements: [styleEl], usage: 1});\n }\n }\n\n private resetHostNodes(): void {\n const hostNodes = this.hostNodes;\n hostNodes.clear();\n // Re-add the head element back since this is the default host.\n hostNodes.add(this.doc.head);\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.io/license\n */\n\nimport {DOCUMENT, isPlatformServer, ɵgetDOM as getDOM} from '@angular/common';\nimport {\n APP_ID,\n CSP_NONCE,\n Inject,\n Injectable,\n InjectionToken,\n NgZone,\n OnDestroy,\n PLATFORM_ID,\n Renderer2,\n RendererFactory2,\n RendererStyleFlags2,\n RendererType2,\n ViewEncapsulation,\n ɵRuntimeError as RuntimeError,\n} from '@angular/core';\n\nimport {RuntimeErrorCode} from '../errors';\n\nimport {EventManager} from './events/event_manager';\nimport {SharedStylesHost} from './shared_styles_host';\n\nexport const NAMESPACE_URIS: {[ns: string]: string} = {\n 'svg': 'http://www.w3.org/2000/svg',\n 'xhtml': 'http://www.w3.org/1999/xhtml',\n 'xlink': 'http://www.w3.org/1999/xlink',\n 'xml': 'http://www.w3.org/XML/1998/namespace',\n 'xmlns': 'http://www.w3.org/2000/xmlns/',\n 'math': 'http://www.w3.org/1998/Math/MathML',\n};\n\nconst COMPONENT_REGEX = /%COMP%/g;\n\nexport const COMPONENT_VARIABLE = '%COMP%';\nexport const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;\nexport const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;\n\n/**\n * The default value for the `REMOVE_STYLES_ON_COMPONENT_DESTROY` DI token.\n */\nconst REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = true;\n\n/**\n * A DI token that indicates whether styles\n * of destroyed components should be removed from DOM.\n *\n * By default, the value is set to `true`.\n * @publicApi\n */\nexport const REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken(\n ngDevMode ? 'RemoveStylesOnCompDestroy' : '',\n {\n providedIn: 'root',\n factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT,\n },\n);\n\nexport function shimContentAttribute(componentShortId: string): string {\n return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);\n}\n\nexport function shimHostAttribute(componentShortId: string): string {\n return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);\n}\n\nexport function shimStylesContent(compId: string, styles: string[]): string[] {\n return styles.map((s) => s.replace(COMPONENT_REGEX, compId));\n}\n\n@Injectable()\nexport class DomRendererFactory2 implements RendererFactory2, OnDestroy {\n private readonly rendererByCompId = new Map<\n string,\n EmulatedEncapsulationDomRenderer2 | NoneEncapsulationDomRenderer\n >();\n private readonly defaultRenderer: Renderer2;\n private readonly platformIsServer: boolean;\n\n constructor(\n private readonly eventManager: EventManager,\n private readonly sharedStylesHost: SharedStylesHost,\n @Inject(APP_ID) private readonly appId: string,\n @Inject(REMOVE_STYLES_ON_COMPONENT_DESTROY) private removeStylesOnCompDestroy: boolean,\n @Inject(DOCUMENT) private readonly doc: Document,\n @Inject(PLATFORM_ID) readonly platformId: Object,\n readonly ngZone: NgZone,\n @Inject(CSP_NONCE) private readonly nonce: string | null = null,\n ) {\n this.platformIsServer = isPlatformServer(platformId);\n this.defaultRenderer = new DefaultDomRenderer2(\n eventManager,\n doc,\n ngZone,\n this.platformIsServer,\n );\n }\n\n createRenderer(element: any, type: RendererType2 | null): Renderer2 {\n if (!element || !type) {\n return this.defaultRenderer;\n }\n\n if (this.platformIsServer && type.encapsulation === ViewEncapsulation.ShadowDom) {\n // Domino does not support shadow DOM.\n type = {...type, encapsulation: ViewEncapsulation.Emulated};\n }\n\n const renderer = this.getOrCreateRenderer(element, type);\n // Renderers have different logic due to different encapsulation behaviours.\n // Ex: for emulated, an attribute is added to the element.\n if (renderer instanceof EmulatedEncapsulationDomRenderer2) {\n renderer.applyToHost(element);\n } else if (renderer instanceof NoneEncapsulationDomRenderer) {\n renderer.applyStyles();\n }\n\n return renderer;\n }\n\n private getOrCreateRenderer(element: any, type: RendererType2): Renderer2 {\n const rendererByCompId = this.rendererByCompId;\n let renderer = rendererByCompId.get(type.id);\n\n if (!renderer) {\n const doc = this.doc;\n const ngZone = this.ngZone;\n const eventManager = this.eventManager;\n const sharedStylesHost = this.sharedStylesHost;\n const removeStylesOnCompDestroy = this.removeStylesOnCompDestroy;\n const platformIsServer = this.platformIsServer;\n\n switch (type.encapsulation) {\n case ViewEncapsulation.Emulated:\n renderer = new EmulatedEncapsulationDomRenderer2(\n eventManager,\n sharedStylesHost,\n type,\n this.appId,\n removeStylesOnCompDestroy,\n doc,\n ngZone,\n platformIsServer,\n );\n break;\n case ViewEncapsulation.ShadowDom:\n return new ShadowDomRenderer(\n eventManager,\n sharedStylesHost,\n element,\n type,\n doc,\n ngZone,\n this.nonce,\n platformIsServer,\n );\n default:\n renderer = new NoneEncapsulationDomRenderer(\n eventManager,\n sharedStylesHost,\n type,\n removeStylesOnCompDestroy,\n doc,\n ngZone,\n platformIsServer,\n );\n break;\n }\n\n rendererByCompId.set(type.id, renderer);\n }\n\n return renderer;\n }\n\n ngOnDestroy() {\n this.rendererByCompId.clear();\n }\n}\n\nclass DefaultDomRenderer2 implements Renderer2 {\n data: {[key: string]: any} = Object.create(null);\n\n /**\n * By default this renderer throws when encountering synthetic properties\n * This can be disabled for example by the AsyncAnimationRendererFactory\n */\n throwOnSyntheticProps = true;\n\n constructor(\n private readonly eventManager: EventManager,\n private readonly doc: Document,\n private readonly ngZone: NgZone,\n private readonly platformIsServer: boolean,\n ) {}\n\n destroy(): void {}\n\n destroyNode = null;\n\n createElement(name: string, namespace?: string): any {\n if (namespace) {\n // TODO: `|| namespace` was added in\n // https://github.com/angular/angular/commit/2b9cc8503d48173492c29f5a271b61126104fbdb to\n // support how Ivy passed around the namespace URI rather than short name at the time. It did\n // not, however extend the support to other parts of the system (setAttribute, setAttribute,\n // and the ServerRenderer). We should decide what exactly the semantics for dealing with\n // namespaces should be and make it consistent.\n // Related issues:\n // https://github.com/angular/angular/issues/44028\n // https://github.com/angular/angular/issues/44883\n return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);\n }\n\n return this.doc.createElement(name);\n }\n\n createComment(value: string): any {\n return this.doc.createComment(value);\n }\n\n createText(value: string): any {\n return this.doc.createTextNode(value);\n }\n\n appendChild(parent: any, newChild: any): void {\n const targetParent = isTemplateNode(parent) ? parent.content : parent;\n targetParent.appendChild(newChild);\n }\n\n insertBefore(parent: any, newChild: any, refChild: any): void {\n if (parent) {\n const targetParent = isTemplateNode(parent) ? parent.content : parent;\n targetParent.insertBefore(newChild, refChild);\n }\n }\n\n removeChild(_parent: any, oldChild: any): void {\n oldChild.remove();\n }\n\n selectRootElement(selectorOrNode: string | any, preserveContent?: boolean): any {\n let el: any =\n typeof selectorOrNode === 'string' ? this.doc.querySelector(selectorOrNode) : selectorOrNode;\n if (!el) {\n throw new RuntimeError(\n RuntimeErrorCode.ROOT_NODE_NOT_FOUND,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n `The selector \"${selectorOrNode}\" did not match any elements`,\n );\n }\n if (!preserveContent) {\n el.textContent = '';\n }\n return el;\n }\n\n parentNode(node: any): any {\n return node.parentNode;\n }\n\n nextSibling(node: any): any {\n return node.nextSibling;\n }\n\n setAttribute(el: any, name: string, value: string, namespace?: string): void {\n if (namespace) {\n name = namespace + ':' + name;\n const namespaceUri = NAMESPACE_URIS[namespace];\n if (namespaceUri) {\n el.setAttributeNS(namespaceUri, name, value);\n } else {\n el.setAttribute(name, value);\n }\n } else {\n el.setAttribute(name, value);\n }\n }\n\n removeAttribute(el: any, name: string, namespace?: string): void {\n if (namespace) {\n const namespaceUri = NAMESPACE_URIS[namespace];\n if (namespaceUri) {\n el.removeAttributeNS(namespaceUri, name);\n } else {\n el.removeAttribute(`${namespace}:${name}`);\n }\n } else {\n el.removeAttribute(name);\n }\n }\n\n addClass(el: any, name: string): void {\n el.classList.add(name);\n }\n\n removeClass(el: any, name: string): void {\n el.classList.remove(name);\n }\n\n setStyle(el: any, style: string, value: any, flags: RendererStyleFlags2): void {\n if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {\n el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? 'important' : '');\n } else {\n el.style[style] = value;\n }\n }\n\n removeStyle(el: any, style: string, flags: RendererStyleFlags2): void {\n if (flags & RendererStyleFlags2.DashCase) {\n // removeProperty has no effect when used on camelCased properties.\n el.style.removeProperty(style);\n } else {\n el.style[style] = '';\n }\n }\n\n setProperty(el: any, name: string, value: any): void {\n if (el == null) {\n return;\n }\n\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n this.throwOnSyntheticProps &&\n checkNoSyntheticProp(name, 'property');\n el[name] = value;\n }\n\n setValue(node: any, value: string): void {\n node.nodeValue = value;\n }\n\n listen(\n target: 'window' | 'document' | 'body' | any,\n event: string,\n callback: (event: any) => boolean,\n ): () => void {\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n this.throwOnSyntheticProps &&\n checkNoSyntheticProp(event, 'listener');\n if (typeof target === 'string') {\n target = getDOM().getGlobalEventTarget(this.doc, target);\n if (!target) {\n throw new Error(`Unsupported event target ${target} for event ${event}`);\n }\n }\n\n return this.eventManager.addEventListener(\n target,\n event,\n this.decoratePreventDefault(callback),\n ) as VoidFunction;\n }\n\n private decoratePreventDefault(eventHandler: Function): Function {\n // `DebugNode.triggerEventHandler` needs to know if the listener was created with\n // decoratePreventDefault or is a listener added outside the Angular context so it can handle\n // the two differently. In the first case, the special '__ngUnwrap__' token is passed to the\n // unwrap the listener (see below).\n return (event: any) => {\n // Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function\n // so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The\n // debug_node can inspect the listener toString contents for the existence of this special\n // token. Because the token is a string literal, it is ensured to not be modified by compiled\n // code.\n if (event === '__ngUnwrap__') {\n return eventHandler;\n }\n\n // Run the event handler inside the ngZone because event handlers are not patched\n // by Zone on the server. This is required only for tests.\n const allowDefaultBehavior = this.platformIsServer\n ? this.ngZone.runGuarded(() => eventHandler(event))\n : eventHandler(event);\n if (allowDefaultBehavior === false) {\n event.preventDefault();\n }\n\n return undefined;\n };\n }\n}\n\nconst AT_CHARCODE = (() => '@'.charCodeAt(0))();\nfunction checkNoSyntheticProp(name: string, nameKind: string) {\n if (name.charCodeAt(0) === AT_CHARCODE) {\n throw new RuntimeError(\n RuntimeErrorCode.UNEXPECTED_SYNTHETIC_PROPERTY,\n `Unexpected synthetic ${nameKind} ${name} found. Please make sure that:\n - Either \\`BrowserAnimationsModule\\` or \\`NoopAnimationsModule\\` are imported in your application.\n - There is corresponding configuration for the animation named \\`${name}\\` defined in the \\`animations\\` field of the \\`@Component\\` decorator (see https://angular.io/api/core/Component#animations).`,\n );\n }\n}\n\nfunction isTemplateNode(node: any): node is HTMLTemplateElement {\n return node.tagName === 'TEMPLATE' && node.content !== undefined;\n}\n\nclass ShadowDomRenderer extends DefaultDomRenderer2 {\n private shadowRoot: any;\n\n constructor(\n eventManager: EventManager,\n private sharedStylesHost: SharedStylesHost,\n private hostEl: any,\n component: RendererType2,\n doc: Document,\n ngZone: NgZone,\n nonce: string | null,\n platformIsServer: boolean,\n ) {\n super(eventManager, doc, ngZone, platformIsServer);\n this.shadowRoot = (hostEl as any).attachShadow({mode: 'open'});\n\n this.sharedStylesHost.addHost(this.shadowRoot);\n const styles = shimStylesContent(component.id, component.styles);\n\n for (const style of styles) {\n const styleEl = document.createElement('style');\n\n if (nonce) {\n styleEl.setAttribute('nonce', nonce);\n }\n\n styleEl.textContent = style;\n this.shadowRoot.appendChild(styleEl);\n }\n }\n\n private nodeOrShadowRoot(node: any): any {\n return node === this.hostEl ? this.shadowRoot : node;\n }\n\n override appendChild(parent: any, newChild: any): void {\n return super.appendChild(this.nodeOrShadowRoot(parent), newChild);\n }\n override insertBefore(parent: any, newChild: any, refChild: any): void {\n return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);\n }\n override removeChild(_parent: any, oldChild: any): void {\n return super.removeChild(null, oldChild);\n }\n override parentNode(node: any): any {\n return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));\n }\n\n override destroy() {\n this.sharedStylesHost.removeHost(this.shadowRoot);\n }\n}\n\nclass NoneEncapsulationDomRenderer extends DefaultDomRenderer2 {\n private readonly styles: string[];\n\n constructor(\n eventManager: EventManager,\n private readonly sharedStylesHost: SharedStylesHost,\n component: RendererType2,\n private removeStylesOnCompDestroy: boolean,\n doc: Document,\n ngZone: NgZone,\n platformIsServer: boolean,\n compId?: string,\n ) {\n super(eventManager, doc, ngZone, platformIsServer);\n this.styles = compId ? shimStylesContent(compId, component.styles) : component.styles;\n }\n\n applyStyles(): void {\n this.sharedStylesHost.addStyles(this.styles);\n }\n\n override destroy(): void {\n if (!this.removeStylesOnCompDestroy) {\n return;\n }\n\n this.sharedStylesHost.removeStyles(this.styles);\n }\n}\n\nclass EmulatedEncapsulationDomRenderer2 extends NoneEncapsulationDomRenderer {\n private contentAttr: string;\n private hostAttr: string;\n\n constructor(\n eventManager: EventManager,\n sharedStylesHost: SharedStylesHost,\n component: RendererType2,\n appId: string,\n removeStylesOnCompDestroy: boolean,\n doc: Document,\n ngZone: NgZone,\n platformIsServer: boolean,\n ) {\n const compId = appId + '-' + component.id;\n super(\n eventManager,\n sharedStylesHost,\n component,\n removeStylesOnCompDestroy,\n doc,\n ngZone,\n platformIsServer,\n compId,\n );\n this.contentAttr = shimContentAttribute(compId);\n this.hostAttr = shimHostAttribute(compId);\n }\n\n applyToHost(element: any): void {\n this.applyStyles();\n this.setAttribute(element, this.hostAttr, '');\n }\n\n override createElement(parent: any, name: string): Element {\n const el = super.createElement(parent, name);\n super.setAttribute(el, this.contentAttr, '');\n return el;\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.io/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {Inject, Injectable} from '@angular/core';\n\nimport {EventManagerPlugin} from './event_manager';\n\n@Injectable()\nexport class DomEventsPlugin extends EventManagerPlugin {\n constructor(@Inject(DOCUMENT) doc: any) {\n super(doc);\n }\n\n // This plugin should come last in the list of plugins, because it accepts all\n // events.\n override supports(eventName: string): boolean {\n return true;\n }\n\n override addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {\n element.addEventListener(eventName, handler as EventListener, false);\n return () => this.removeEventListener(element, eventName, handler as EventListener);\n }\n\n removeEventListener(target: any, eventName: string, callback: Function): void {\n return target.removeEventListener(eventName, callback as EventListener);\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.io/license\n */\n\nimport {Inject, Injectable, inject, ɵGLOBAL_EVENT_DELEGATION} from '@angular/core';\nimport {EventManagerPlugin} from './event_manager';\nimport {DOCUMENT} from '@angular/common';\n\n@Injectable()\nexport class EventDelegationPlugin extends EventManagerPlugin {\n private delegate = inject(ɵGLOBAL_EVENT_DELEGATION, {optional: true});\n constructor(@Inject(DOCUMENT) doc: any) {\n super(doc);\n }\n\n override supports(eventName: string): boolean {\n // If `GlobalDelegationEventPlugin` implementation is not provided,\n // this plugin is kept disabled.\n return this.delegate ? this.delegate.supports(eventName) : false;\n }\n\n override addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {\n return this.delegate!.addEventListener(element, eventName, handler);\n }\n\n removeEventListener(element: HTMLElement, eventName: string, callback: Function): void {\n return this.delegate!.removeEventListener(element, eventName, callback);\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.io/license\n */\n\nimport {DOCUMENT, ɵgetDOM as getDOM} from '@angular/common';\nimport {Inject, Injectable, NgZone} from '@angular/core';\n\nimport {EventManagerPlugin} from './event_manager';\n\n/**\n * Defines supported modifiers for key events.\n */\nconst MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];\n\n// The following values are here for cross-browser compatibility and to match the W3C standard\n// cf https://www.w3.org/TR/DOM-Level-3-Events-key/\nconst _keyMap: {[k: string]: string} = {\n '\\b': 'Backspace',\n '\\t': 'Tab',\n '\\x7F': 'Delete',\n '\\x1B': 'Escape',\n 'Del': 'Delete',\n 'Esc': 'Escape',\n 'Left': 'ArrowLeft',\n 'Right': 'ArrowRight',\n 'Up': 'ArrowUp',\n 'Down': 'ArrowDown',\n 'Menu': 'ContextMenu',\n 'Scroll': 'ScrollLock',\n 'Win': 'OS',\n};\n\n/**\n * Retrieves modifiers from key-event objects.\n */\nconst MODIFIER_KEY_GETTERS: {[key: string]: (event: KeyboardEvent) => boolean} = {\n 'alt': (event: KeyboardEvent) => event.altKey,\n 'control': (event: KeyboardEvent) => event.ctrlKey,\n 'meta': (event: KeyboardEvent) => event.metaKey,\n 'shift': (event: KeyboardEvent) => event.shiftKey,\n};\n\n/**\n * A browser plug-in that provides support for handling of key events in Angular.\n */\n@Injectable()\nexport class KeyEventsPlugin extends EventManagerPlugin {\n /**\n * Initializes an instance of the browser plug-in.\n * @param doc The document in which key events will be detected.\n */\n constructor(@Inject(DOCUMENT) doc: any) {\n super(doc);\n }\n\n /**\n * Reports whether a named key event is supported.\n * @param eventName The event name to query.\n * @return True if the named key event is supported.\n */\n override supports(eventName: string): boolean {\n return KeyEventsPlugin.parseEventName(eventName) != null;\n }\n\n /**\n * Registers a handler for a specific element and key event.\n * @param element The HTML element to receive event notifications.\n * @param eventName The name of the key event to listen for.\n * @param handler A function to call when the notification occurs. Receives the\n * event object as an argument.\n * @returns The key event that was registered.\n */\n override addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {\n const parsedEvent = KeyEventsPlugin.parseEventName(eventName)!;\n\n const outsideHandler = KeyEventsPlugin.eventCallback(\n parsedEvent['fullKey'],\n handler,\n this.manager.getZone(),\n );\n\n return this.manager.getZone().runOutsideAngular(() => {\n return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);\n });\n }\n\n /**\n * Parses the user provided full keyboard event definition and normalizes it for\n * later internal use. It ensures the string is all lowercase, converts special\n * characters to a standard spelling, and orders all the values consistently.\n *\n * @param eventName The name of the key event to listen for.\n * @returns an object with the full, normalized string, and the dom event name\n * or null in the case when the event doesn't match a keyboard event.\n */\n static parseEventName(eventName: string): {fullKey: string; domEventName: string} | null {\n const parts: string[] = eventName.toLowerCase().split('.');\n\n const domEventName = parts.shift();\n if (parts.length === 0 || !(domEventName === 'keydown' || domEventName === 'keyup')) {\n return null;\n }\n\n const key = KeyEventsPlugin._normalizeKey(parts.pop()!);\n\n let fullKey = '';\n let codeIX = parts.indexOf('code');\n if (codeIX > -1) {\n parts.splice(codeIX, 1);\n fullKey = 'code.';\n }\n MODIFIER_KEYS.forEach((modifierName) => {\n const index: number = parts.indexOf(modifierName);\n if (index > -1) {\n parts.splice(index, 1);\n fullKey += modifierName + '.';\n }\n });\n fullKey += key;\n\n if (parts.length != 0 || key.length === 0) {\n // returning null instead of throwing to let another plugin process the event\n return null;\n }\n\n // NOTE: Please don't rewrite this as so, as it will break JSCompiler property renaming.\n // The code must remain in the `result['domEventName']` form.\n // return {domEventName, fullKey};\n const result: {fullKey: string; domEventName: string} = {} as any;\n result['domEventName'] = domEventName;\n result['fullKey'] = fullKey;\n return result;\n }\n\n /**\n * Determines whether the actual keys pressed match the configured key code string.\n * The `fullKeyCode` event is normalized in the `parseEventName` method when the\n * event is attached to the DOM during the `addEventListener` call. This is unseen\n * by the end user and is normalized for internal consistency and parsing.\n *\n * @param event The keyboard event.\n * @param fullKeyCode The normalized user defined expected key event string\n * @returns boolean.\n */\n static matchEventFullKeyCode(event: KeyboardEvent, fullKeyCode: string): boolean {\n let keycode = _keyMap[event.key] || event.key;\n let key = '';\n if (fullKeyCode.indexOf('code.') > -1) {\n keycode = event.code;\n key = 'code.';\n }\n // the keycode could be unidentified so we have to check here\n if (keycode == null || !keycode) return false;\n keycode = keycode.toLowerCase();\n if (keycode === ' ') {\n keycode = 'space'; // for readability\n } else if (keycode === '.') {\n keycode = 'dot'; // because '.' is used as a separator in event names\n }\n MODIFIER_KEYS.forEach((modifierName) => {\n if (modifierName !== keycode) {\n const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];\n if (modifierGetter(event)) {\n key += modifierName + '.';\n }\n }\n });\n key += keycode;\n return key === fullKeyCode;\n }\n\n /**\n * Configures a handler callback for a key event.\n * @param fullKey The event name that combines all simultaneous keystrokes.\n * @param handler The function that responds to the key event.\n * @param zone The zone in which the event occurred.\n * @returns A callback function.\n */\n static eventCallback(fullKey: string, handler: Function, zone: NgZone): Function {\n return (event: KeyboardEvent) => {\n if (KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {\n zone.runGuarded(() => handler(event));\n }\n };\n }\n\n /** @internal */\n static _normalizeKey(keyName: string): string {\n return keyName === 'esc' ? 'escape' : keyName;\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.io/license\n */\n\nimport {\n CommonModule,\n DOCUMENT,\n XhrFactory,\n ɵPLATFORM_BROWSER_ID as PLATFORM_BROWSER_ID,\n} from '@angular/common';\nimport {\n APP_ID,\n ApplicationConfig as ApplicationConfigFromCore,\n ApplicationModule,\n ApplicationRef,\n createPlatformFactory,\n ErrorHandler,\n Inject,\n InjectionToken,\n ModuleWithProviders,\n NgModule,\n NgZone,\n Optional,\n PLATFORM_ID,\n PLATFORM_INITIALIZER,\n platformCore,\n PlatformRef,\n Provider,\n RendererFactory2,\n SkipSelf,\n StaticProvider,\n Testability,\n TestabilityRegistry,\n Type,\n ɵINJECTOR_SCOPE as INJECTOR_SCOPE,\n ɵinternalCreateApplication as internalCreateApplication,\n ɵRuntimeError as RuntimeError,\n ɵsetDocument,\n ɵTESTABILITY as TESTABILITY,\n ɵTESTABILITY_GETTER as TESTABILITY_GETTER,\n} from '@angular/core';\n\nimport {BrowserDomAdapter} from './browser/browser_adapter';\nimport {BrowserGetTestability} from './browser/testability';\nimport {BrowserXhr} from './browser/xhr';\nimport {DomRendererFactory2} from './dom/dom_renderer';\nimport {DomEventsPlugin} from './dom/events/dom_events';\nimport {EventDelegationPlugin} from './dom/events/event_delegation';\nimport {EVENT_MANAGER_PLUGINS, EventManager} from './dom/events/event_manager';\nimport {KeyEventsPlugin} from './dom/events/key_events';\nimport {SharedStylesHost} from './dom/shared_styles_host';\nimport {RuntimeErrorCode} from './errors';\n\n/**\n * Set of config options available during the application bootstrap operation.\n *\n * @publicApi\n *\n * @deprecated\n * `ApplicationConfig` has moved, please import `ApplicationConfig` from `@angular/core` instead.\n */\n// The below is a workaround to add a deprecated message.\ntype ApplicationConfig = ApplicationConfigFromCore;\nexport {ApplicationConfig};\n\n/**\n * Bootstraps an instance of an Angular application and renders a standalone component as the\n * application's root component. More information about standalone components can be found in [this\n * guide](guide/components/importing).\n *\n * @usageNotes\n * The root component passed into this function *must* be a standalone one (should have the\n * `standalone: true` flag in the `@Component` decorator config).\n *\n * ```typescript\n * @Component({\n * standalone: true,\n * template: 'Hello world!'\n * })\n * class RootComponent {}\n *\n * const appRef: ApplicationRef = await bootstrapApplication(RootComponent);\n * ```\n *\n * You can add the list of providers that should be available in the application injector by\n * specifying the `providers` field in an object passed as the second argument:\n *\n * ```typescript\n * await bootstrapApplication(RootComponent, {\n * providers: [\n * {provide: BACKEND_URL, useValue: 'https://yourdomain.com/api'}\n * ]\n * });\n * ```\n *\n * The `importProvidersFrom` helper method can be used to collect all providers from any\n * existing NgModule (and transitively from all NgModules that it imports):\n *\n * ```typescript\n * await bootstrapApplication(RootComponent, {\n * providers: [\n * importProvidersFrom(SomeNgModule)\n * ]\n * });\n * ```\n *\n * Note: the `bootstrapApplication` method doesn't include [Testability](api/core/Testability) by\n * default. You can add [Testability](api/core/Testability) by getting the list of necessary\n * providers using `provideProtractorTestingSupport()` function and adding them into the `providers`\n * array, for example:\n *\n * ```typescript\n * import {provideProtractorTestingSupport} from '@angular/platform-browser';\n *\n * await bootstrapApplication(RootComponent, {providers: [provideProtractorTestingSupport()]});\n * ```\n *\n * @param rootComponent A reference to a standalone component that should be rendered.\n * @param options Extra configuration for the bootstrap operation, see `ApplicationConfig` for\n * additional info.\n * @returns A promise that returns an `ApplicationRef` instance once resolved.\n *\n * @publicApi\n */\nexport function bootstrapApplication(\n rootComponent: Type,\n options?: ApplicationConfig,\n): Promise {\n return internalCreateApplication({rootComponent, ...createProvidersConfig(options)});\n}\n\n/**\n * Create an instance of an Angular application without bootstrapping any components. This is useful\n * for the situation where one wants to decouple application environment creation (a platform and\n * associated injectors) from rendering components on a screen. Components can be subsequently\n * bootstrapped on the returned `ApplicationRef`.\n *\n * @param options Extra configuration for the application environment, see `ApplicationConfig` for\n * additional info.\n * @returns A promise that returns an `ApplicationRef` instance once resolved.\n *\n * @publicApi\n */\nexport function createApplication(options?: ApplicationConfig) {\n return internalCreateApplication(createProvidersConfig(options));\n}\n\nfunction createProvidersConfig(options?: ApplicationConfig) {\n return {\n appProviders: [...BROWSER_MODULE_PROVIDERS, ...(options?.providers ?? [])],\n platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS,\n };\n}\n\n/**\n * Returns a set of providers required to setup [Testability](api/core/Testability) for an\n * application bootstrapped using the `bootstrapApplication` function. The set of providers is\n * needed to support testing an application with Protractor (which relies on the Testability APIs\n * to be present).\n *\n * @returns An array of providers required to setup Testability for an application and make it\n * available for testing using Protractor.\n *\n * @publicApi\n */\nexport function provideProtractorTestingSupport(): Provider[] {\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideProtractorTestingSupport` call results in app\n // code.\n return [...TESTABILITY_PROVIDERS];\n}\n\nexport function initDomAdapter() {\n BrowserDomAdapter.makeCurrent();\n}\n\nexport function errorHandler(): ErrorHandler {\n return new ErrorHandler();\n}\n\nexport function _document(): any {\n // Tell ivy about the global document\n ɵsetDocument(document);\n return document;\n}\n\nexport const INTERNAL_BROWSER_PLATFORM_PROVIDERS: StaticProvider[] = [\n {provide: PLATFORM_ID, useValue: PLATFORM_BROWSER_ID},\n {provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true},\n {provide: DOCUMENT, useFactory: _document, deps: []},\n];\n\n/**\n * A factory function that returns a `PlatformRef` instance associated with browser service\n * providers.\n *\n * @publicApi\n */\nexport const platformBrowser: (extraProviders?: StaticProvider[]) => PlatformRef =\n createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);\n\n/**\n * Internal marker to signal whether providers from the `BrowserModule` are already present in DI.\n * This is needed to avoid loading `BrowserModule` providers twice. We can't rely on the\n * `BrowserModule` presence itself, since the standalone-based bootstrap just imports\n * `BrowserModule` providers without referencing the module itself.\n */\nconst BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken(\n typeof ngDevMode === 'undefined' || ngDevMode ? 'BrowserModule Providers Marker' : '',\n);\n\nconst TESTABILITY_PROVIDERS = [\n {\n provide: TESTABILITY_GETTER,\n useClass: BrowserGetTestability,\n deps: [],\n },\n {\n provide: TESTABILITY,\n useClass: Testability,\n deps: [NgZone, TestabilityRegistry, TESTABILITY_GETTER],\n },\n {\n provide: Testability, // Also provide as `Testability` for backwards-compatibility.\n useClass: Testability,\n deps: [NgZone, TestabilityRegistry, TESTABILITY_GETTER],\n },\n];\n\nconst BROWSER_MODULE_PROVIDERS: Provider[] = [\n {provide: INJECTOR_SCOPE, useValue: 'root'},\n {provide: ErrorHandler, useFactory: errorHandler, deps: []},\n {\n provide: EVENT_MANAGER_PLUGINS,\n useClass: DomEventsPlugin,\n multi: true,\n deps: [DOCUMENT, NgZone, PLATFORM_ID],\n },\n {provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [DOCUMENT]},\n {\n provide: EVENT_MANAGER_PLUGINS,\n useClass: EventDelegationPlugin,\n multi: true,\n },\n DomRendererFactory2,\n SharedStylesHost,\n EventManager,\n {provide: RendererFactory2, useExisting: DomRendererFactory2},\n {provide: XhrFactory, useClass: BrowserXhr, deps: []},\n typeof ngDevMode === 'undefined' || ngDevMode\n ? {provide: BROWSER_MODULE_PROVIDERS_MARKER, useValue: true}\n : [],\n];\n\n/**\n * Exports required infrastructure for all Angular apps.\n * Included by default in all Angular apps created with the CLI\n * `new` command.\n * Re-exports `CommonModule` and `ApplicationModule`, making their\n * exports and providers available to all apps.\n *\n * @publicApi\n */\n@NgModule({\n providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],\n exports: [CommonModule, ApplicationModule],\n})\nexport class BrowserModule {\n constructor(\n @Optional()\n @SkipSelf()\n @Inject(BROWSER_MODULE_PROVIDERS_MARKER)\n providersAlreadyPresent: boolean | null,\n ) {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && providersAlreadyPresent) {\n throw new RuntimeError(\n RuntimeErrorCode.BROWSER_MODULE_ALREADY_LOADED,\n `Providers from the \\`BrowserModule\\` have already been loaded. If you need access ` +\n `to common directives such as NgIf and NgFor, import the \\`CommonModule\\` instead.`,\n );\n }\n }\n\n /**\n * Configures a browser-based app to transition from a server-rendered app, if\n * one is present on the page.\n *\n * @param params An object containing an identifier for the app to transition.\n * The ID must match between the client and server versions of the app.\n * @returns The reconfigured `BrowserModule` to import into the app's root `AppModule`.\n *\n * @deprecated Use {@link APP_ID} instead to set the application ID.\n */\n static withServerTransition(params: {appId: string}): ModuleWithProviders {\n return {\n ngModule: BrowserModule,\n providers: [{provide: APP_ID, useValue: params.appId}],\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.io/license\n */\n\nimport {DOCUMENT, ɵDomAdapter as DomAdapter, ɵgetDOM as getDOM} from '@angular/common';\nimport {Inject, Injectable} from '@angular/core';\n\n/**\n * Represents the attributes of an HTML `` element. The element itself is\n * represented by the internal `HTMLMetaElement`.\n *\n * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)\n * @see {@link Meta}\n *\n * @publicApi\n */\nexport type MetaDefinition = {\n charset?: string;\n content?: string;\n httpEquiv?: string;\n id?: string;\n itemprop?: string;\n name?: string;\n property?: string;\n scheme?: string;\n url?: string;\n} & {\n // TODO(IgorMinar): this type looks wrong\n [prop: string]: string;\n};\n\n/**\n * A service for managing HTML `` tags.\n *\n * Properties of the `MetaDefinition` object match the attributes of the\n * HTML `` tag. These tags define document metadata that is important for\n * things like configuring a Content Security Policy, defining browser compatibility\n * and security settings, setting HTTP Headers, defining rich content for social sharing,\n * and Search Engine Optimization (SEO).\n *\n * To identify specific `` tags in a document, use an attribute selection\n * string in the format `\"tag_attribute='value string'\"`.\n * For example, an `attrSelector` value of `\"name='description'\"` matches a tag\n * whose `name` attribute has the value `\"description\"`.\n * Selectors are used with the `querySelector()` Document method,\n * in the format `meta[{attrSelector}]`.\n *\n * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)\n * @see [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector)\n *\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root'})\nexport class Meta {\n private _dom: DomAdapter;\n constructor(@Inject(DOCUMENT) private _doc: any) {\n this._dom = getDOM();\n }\n /**\n * Retrieves or creates a specific `` tag element in the current HTML document.\n * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute\n * values in the provided tag definition, and verifies that all other attribute values are equal.\n * If an existing element is found, it is returned and is not modified in any way.\n * @param tag The definition of a `` element to match or create.\n * @param forceCreation True to create a new element without checking whether one already exists.\n * @returns The existing element with the same attributes and values if found,\n * the new element if no match is found, or `null` if the tag parameter is not defined.\n */\n addTag(tag: MetaDefinition, forceCreation: boolean = false): HTMLMetaElement | null {\n if (!tag) return null;\n return this._getOrCreateElement(tag, forceCreation);\n }\n\n /**\n * Retrieves or creates a set of `` tag elements in the current HTML document.\n * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute\n * values in the provided tag definition, and verifies that all other attribute values are equal.\n * @param tags An array of tag definitions to match or create.\n * @param forceCreation True to create new elements without checking whether they already exist.\n * @returns The matching elements if found, or the new elements.\n */\n addTags(tags: MetaDefinition[], forceCreation: boolean = false): HTMLMetaElement[] {\n if (!tags) return [];\n return tags.reduce((result: HTMLMetaElement[], tag: MetaDefinition) => {\n if (tag) {\n result.push(this._getOrCreateElement(tag, forceCreation));\n }\n return result;\n }, []);\n }\n\n /**\n * Retrieves a `` tag element in the current HTML document.\n * @param attrSelector The tag attribute and value to match against, in the format\n * `\"tag_attribute='value string'\"`.\n * @returns The matching element, if any.\n */\n getTag(attrSelector: string): HTMLMetaElement | null {\n if (!attrSelector) return null;\n return this._doc.querySelector(`meta[${attrSelector}]`) || null;\n }\n\n /**\n * Retrieves a set of `` tag elements in the current HTML document.\n * @param attrSelector The tag attribute and value to match against, in the format\n * `\"tag_attribute='value string'\"`.\n * @returns The matching elements, if any.\n */\n getTags(attrSelector: string): HTMLMetaElement[] {\n if (!attrSelector) return [];\n const list /*NodeList*/ = this._doc.querySelectorAll(`meta[${attrSelector}]`);\n return list ? [].slice.call(list) : [];\n }\n\n /**\n * Modifies an existing `` tag element in the current HTML document.\n * @param tag The tag description with which to replace the existing tag content.\n * @param selector A tag attribute and value to match against, to identify\n * an existing tag. A string in the format `\"tag_attribute=`value string`\"`.\n * If not supplied, matches a tag with the same `name` or `property` attribute value as the\n * replacement tag.\n * @return The modified element.\n */\n updateTag(tag: MetaDefinition, selector?: string): HTMLMetaElement | null {\n if (!tag) return null;\n selector = selector || this._parseSelector(tag);\n const meta: HTMLMetaElement = this.getTag(selector)!;\n if (meta) {\n return this._setMetaElementAttributes(tag, meta);\n }\n return this._getOrCreateElement(tag, true);\n }\n\n /**\n * Removes an existing `` tag element from the current HTML document.\n * @param attrSelector A tag attribute and value to match against, to identify\n * an existing tag. A string in the format `\"tag_attribute=`value string`\"`.\n */\n removeTag(attrSelector: string): void {\n this.removeTagElement(this.getTag(attrSelector)!);\n }\n\n /**\n * Removes an existing `` tag element from the current HTML document.\n * @param meta The tag definition to match against to identify an existing tag.\n */\n removeTagElement(meta: HTMLMetaElement): void {\n if (meta) {\n this._dom.remove(meta);\n }\n }\n\n private _getOrCreateElement(\n meta: MetaDefinition,\n forceCreation: boolean = false,\n ): HTMLMetaElement {\n if (!forceCreation) {\n const selector: string = this._parseSelector(meta);\n // It's allowed to have multiple elements with the same name so it's not enough to\n // just check that element with the same name already present on the page. We also need to\n // check if element has tag attributes\n const elem = this.getTags(selector).filter((elem) => this._containsAttributes(meta, elem))[0];\n if (elem !== undefined) return elem;\n }\n const element: HTMLMetaElement = this._dom.createElement('meta') as HTMLMetaElement;\n this._setMetaElementAttributes(meta, element);\n const head = this._doc.getElementsByTagName('head')[0];\n head.appendChild(element);\n return element;\n }\n\n private _setMetaElementAttributes(tag: MetaDefinition, el: HTMLMetaElement): HTMLMetaElement {\n Object.keys(tag).forEach((prop: string) =>\n el.setAttribute(this._getMetaKeyMap(prop), tag[prop]),\n );\n return el;\n }\n\n private _parseSelector(tag: MetaDefinition): string {\n const attr: string = tag.name ? 'name' : 'property';\n return `${attr}=\"${tag[attr]}\"`;\n }\n\n private _containsAttributes(tag: MetaDefinition, elem: HTMLMetaElement): boolean {\n return Object.keys(tag).every(\n (key: string) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key],\n );\n }\n\n private _getMetaKeyMap(prop: string): string {\n return META_KEYS_MAP[prop] || prop;\n }\n}\n\n/**\n * Mapping for MetaDefinition properties with their correct meta attribute names\n */\nconst META_KEYS_MAP: {[prop: string]: string} = {\n httpEquiv: 'http-equiv',\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.io/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {Inject, Injectable} from '@angular/core';\n\n/**\n * A service that can be used to get and set the title of a current HTML document.\n *\n * Since an Angular application can't be bootstrapped on the entire HTML document (`` tag)\n * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements\n * (representing the `` tag). Instead, this service can be used to set and get the current\n * title value.\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root'})\nexport class Title {\n constructor(@Inject(DOCUMENT) private _doc: any) {}\n /**\n * Get the title of the current HTML document.\n */\n getTitle(): string {\n return this._doc.title;\n }\n\n /**\n * Set the title of the current HTML document.\n * @param newTitle\n */\n setTitle(newTitle: string) {\n this._doc.title = newTitle || '';\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.io/license\n */\n\nimport {ɵglobal as global} from '@angular/core';\n\n/**\n * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if\n * `name` is `'probe'`.\n * @param name Name under which it will be exported. Keep in mind this will be a property of the\n * global `ng` object.\n * @param value The value to export.\n */\nexport function exportNgVar(name: string, value: any): void {\n if (typeof COMPILED === 'undefined' || !COMPILED) {\n // Note: we can't export `ng` when using closure enhanced optimization as:\n // - closure declares globals itself for minified names, which sometimes clobber our `ng` global\n // - we can't declare a closure extern as the namespace `ng` is already used within Google\n // for typings for angularJS (via `goog.provide('ng....')`).\n const ng = (global['ng'] = (global['ng'] as {[key: string]: any} | undefined) || {});\n ng[name] = value;\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.io/license\n */\n\nimport {ApplicationRef, ComponentRef} from '@angular/core';\n\nexport class ChangeDetectionPerfRecord {\n constructor(\n public msPerTick: number,\n public numTicks: number,\n ) {}\n}\n\n/**\n * Entry point for all Angular profiling-related debug tools. This object\n * corresponds to the `ng.profiler` in the dev console.\n */\nexport class AngularProfiler {\n appRef: ApplicationRef;\n\n constructor(ref: ComponentRef) {\n this.appRef = ref.injector.get(ApplicationRef);\n }\n\n // tslint:disable:no-console\n /**\n * Exercises change detection in a loop and then prints the average amount of\n * time in milliseconds how long a single round of change detection takes for\n * the current state of the UI. It runs a minimum of 5 rounds for a minimum\n * of 500 milliseconds.\n *\n * Optionally, a user may pass a `config` parameter containing a map of\n * options. Supported options are:\n *\n * `record` (boolean) - causes the profiler to record a CPU profile while\n * it exercises the change detector. Example:\n *\n * ```\n * ng.profiler.timeChangeDetection({record: true})\n * ```\n */\n timeChangeDetection(config: any): ChangeDetectionPerfRecord {\n const record = config && config['record'];\n const profileName = 'Change Detection';\n // Profiler is not available in Android browsers without dev tools opened\n if (record && 'profile' in console && typeof console.profile === 'function') {\n console.profile(profileName);\n }\n const start = performance.now();\n let numTicks = 0;\n while (numTicks < 5 || performance.now() - start < 500) {\n this.appRef.tick();\n numTicks++;\n }\n const end = performance.now();\n if (record && 'profileEnd' in console && typeof console.profileEnd === 'function') {\n console.profileEnd(profileName);\n }\n const msPerTick = (end - start) / numTicks;\n console.log(`ran ${numTicks} change detection cycles`);\n console.log(`${msPerTick.toFixed(2)} ms per check`);\n\n return new ChangeDetectionPerfRecord(msPerTick, numTicks);\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.io/license\n */\n\nimport {ComponentRef} from '@angular/core';\n\nimport {exportNgVar} from '../../dom/util';\n\nimport {AngularProfiler} from './common_tools';\n\nconst PROFILER_GLOBAL_NAME = 'profiler';\n\n/**\n * Enabled Angular debug tools that are accessible via your browser's\n * developer console.\n *\n * Usage:\n *\n * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)\n * 1. Type `ng.` (usually the console will show auto-complete suggestion)\n * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`\n * then hit Enter.\n *\n * @publicApi\n */\nexport function enableDebugTools(ref: ComponentRef): ComponentRef {\n exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));\n return ref;\n}\n\n/**\n * Disables Angular tools.\n *\n * @publicApi\n */\nexport function disableDebugTools(): void {\n exportNgVar(PROFILER_GLOBAL_NAME, 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.io/license\n */\n\nimport {ɵgetDOM as getDOM} from '@angular/common';\nimport {DebugElement, DebugNode, Predicate, Type} from '@angular/core';\n\n/**\n * Predicates for use with {@link DebugElement}'s query functions.\n *\n * @publicApi\n */\nexport class By {\n /**\n * Match all nodes.\n *\n * @usageNotes\n * ### Example\n *\n * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}\n */\n static all(): Predicate {\n return () => true;\n }\n\n /**\n * Match elements by the given CSS selector.\n *\n * @usageNotes\n * ### Example\n *\n * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}\n */\n static css(selector: string): Predicate {\n return (debugElement) => {\n return debugElement.nativeElement != null\n ? elementMatches(debugElement.nativeElement, selector)\n : false;\n };\n }\n\n /**\n * Match nodes that have the given directive present.\n *\n * @usageNotes\n * ### Example\n *\n * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}\n */\n static directive(type: Type): Predicate {\n return (debugNode) => debugNode.providerTokens!.indexOf(type) !== -1;\n }\n}\n\nfunction elementMatches(n: any, selector: string): boolean {\n if (getDOM().isElementNode(n)) {\n return (\n (n.matches && n.matches(selector)) ||\n (n.msMatchesSelector && n.msMatchesSelector(selector)) ||\n (n.webkitMatchesSelector && n.webkitMatchesSelector(selector))\n );\n }\n\n return false;\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.io/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {\n Inject,\n Injectable,\n InjectionToken,\n NgModule,\n Optional,\n Provider,\n ɵConsole as Console,\n} from '@angular/core';\n\nimport {EVENT_MANAGER_PLUGINS, EventManagerPlugin} from './event_manager';\n\n/**\n * Supported HammerJS recognizer event names.\n */\nconst EVENT_NAMES = {\n // pan\n 'pan': true,\n 'panstart': true,\n 'panmove': true,\n 'panend': true,\n 'pancancel': true,\n 'panleft': true,\n 'panright': true,\n 'panup': true,\n 'pandown': true,\n // pinch\n 'pinch': true,\n 'pinchstart': true,\n 'pinchmove': true,\n 'pinchend': true,\n 'pinchcancel': true,\n 'pinchin': true,\n 'pinchout': true,\n // press\n 'press': true,\n 'pressup': true,\n // rotate\n 'rotate': true,\n 'rotatestart': true,\n 'rotatemove': true,\n 'rotateend': true,\n 'rotatecancel': true,\n // swipe\n 'swipe': true,\n 'swipeleft': true,\n 'swiperight': true,\n 'swipeup': true,\n 'swipedown': true,\n // tap\n 'tap': true,\n 'doubletap': true,\n};\n\n/**\n * DI token for providing [HammerJS](https://hammerjs.github.io/) support to Angular.\n * @see {@link HammerGestureConfig}\n *\n * @ngModule HammerModule\n * @publicApi\n */\nexport const HAMMER_GESTURE_CONFIG = new InjectionToken('HammerGestureConfig');\n\n/**\n * Function that loads HammerJS, returning a promise that is resolved once HammerJs is loaded.\n *\n * @publicApi\n */\nexport type HammerLoader = () => Promise;\n\n/**\n * Injection token used to provide a HammerLoader to Angular.\n *\n * @see {@link HammerLoader}\n *\n * @publicApi\n */\nexport const HAMMER_LOADER = new InjectionToken('HammerLoader');\n\nexport interface HammerInstance {\n on(eventName: string, callback?: Function): void;\n off(eventName: string, callback?: Function): void;\n destroy?(): void;\n}\n\n/**\n * An injectable [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)\n * for gesture recognition. Configures specific event recognition.\n * @publicApi\n */\n@Injectable()\nexport class HammerGestureConfig {\n /**\n * A set of supported event names for gestures to be used in Angular.\n * Angular supports all built-in recognizers, as listed in\n * [HammerJS documentation](https://hammerjs.github.io/).\n */\n events: string[] = [];\n\n /**\n * Maps gesture event names to a set of configuration options\n * that specify overrides to the default values for specific properties.\n *\n * The key is a supported event name to be configured,\n * and the options object contains a set of properties, with override values\n * to be applied to the named recognizer event.\n * For example, to disable recognition of the rotate event, specify\n * `{\"rotate\": {\"enable\": false}}`.\n *\n * Properties that are not present take the HammerJS default values.\n * For information about which properties are supported for which events,\n * and their allowed and default values, see\n * [HammerJS documentation](https://hammerjs.github.io/).\n *\n */\n overrides: {[key: string]: Object} = {};\n\n /**\n * Properties whose default values can be overridden for a given event.\n * Different sets of properties apply to different events.\n * For information about which properties are supported for which events,\n * and their allowed and default values, see\n * [HammerJS documentation](https://hammerjs.github.io/).\n */\n options?: {\n cssProps?: any;\n domEvents?: boolean;\n enable?: boolean | ((manager: any) => boolean);\n preset?: any[];\n touchAction?: string;\n recognizers?: any[];\n inputClass?: any;\n inputTarget?: EventTarget;\n };\n\n /**\n * Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)\n * and attaches it to a given HTML element.\n * @param element The element that will recognize gestures.\n * @returns A HammerJS event-manager object.\n */\n buildHammer(element: HTMLElement): HammerInstance {\n const mc = new Hammer!(element, this.options);\n\n mc.get('pinch').set({enable: true});\n mc.get('rotate').set({enable: true});\n\n for (const eventName in this.overrides) {\n mc.get(eventName).set(this.overrides[eventName]);\n }\n\n return mc;\n }\n}\n\n/**\n * Event plugin that adds Hammer support to an application.\n *\n * @ngModule HammerModule\n */\n@Injectable()\nexport class HammerGesturesPlugin extends EventManagerPlugin {\n private _loaderPromise: Promise | null = null;\n\n constructor(\n @Inject(DOCUMENT) doc: any,\n @Inject(HAMMER_GESTURE_CONFIG) private _config: HammerGestureConfig,\n private console: Console,\n @Optional() @Inject(HAMMER_LOADER) private loader?: HammerLoader | null,\n ) {\n super(doc);\n }\n\n override supports(eventName: string): boolean {\n if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {\n return false;\n }\n\n if (!(window as any).Hammer && !this.loader) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n this.console.warn(\n `The \"${eventName}\" event cannot be bound because Hammer.JS is not ` +\n `loaded and no custom loader has been specified.`,\n );\n }\n return false;\n }\n\n return true;\n }\n\n override addEventListener(element: HTMLElement, eventName: string, handler: Function): Function {\n const zone = this.manager.getZone();\n eventName = eventName.toLowerCase();\n\n // If Hammer is not present but a loader is specified, we defer adding the event listener\n // until Hammer is loaded.\n if (!(window as any).Hammer && this.loader) {\n this._loaderPromise = this._loaderPromise || zone.runOutsideAngular(() => this.loader!());\n // This `addEventListener` method returns a function to remove the added listener.\n // Until Hammer is loaded, the returned function needs to *cancel* the registration rather\n // than remove anything.\n let cancelRegistration = false;\n let deregister: Function = () => {\n cancelRegistration = true;\n };\n\n zone.runOutsideAngular(() =>\n this._loaderPromise!.then(() => {\n // If Hammer isn't actually loaded when the custom loader resolves, give up.\n if (!(window as any).Hammer) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n this.console.warn(\n `The custom HAMMER_LOADER completed, but Hammer.JS is not present.`,\n );\n }\n deregister = () => {};\n return;\n }\n\n if (!cancelRegistration) {\n // Now that Hammer is loaded and the listener is being loaded for real,\n // the deregistration function changes from canceling registration to\n // removal.\n deregister = this.addEventListener(element, eventName, handler);\n }\n }).catch(() => {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n this.console.warn(\n `The \"${eventName}\" event cannot be bound because the custom ` +\n `Hammer.JS loader failed.`,\n );\n }\n deregister = () => {};\n }),\n );\n\n // Return a function that *executes* `deregister` (and not `deregister` itself) so that we\n // can change the behavior of `deregister` once the listener is added. Using a closure in\n // this way allows us to avoid any additional data structures to track listener removal.\n return () => {\n deregister();\n };\n }\n\n return zone.runOutsideAngular(() => {\n // Creating the manager bind events, must be done outside of angular\n const mc = this._config.buildHammer(element);\n const callback = function (eventObj: HammerInput) {\n zone.runGuarded(function () {\n handler(eventObj);\n });\n };\n mc.on(eventName, callback);\n return () => {\n mc.off(eventName, callback);\n // destroy mc to prevent memory leak\n if (typeof mc.destroy === 'function') {\n mc.destroy();\n }\n };\n });\n }\n\n isCustomEvent(eventName: string): boolean {\n return this._config.events.indexOf(eventName) > -1;\n }\n}\n\n/**\n * Adds support for HammerJS.\n *\n * Import this module at the root of your application so that Angular can work with\n * HammerJS to detect gesture events.\n *\n * Note that applications still need to include the HammerJS script itself. This module\n * simply sets up the coordination layer between HammerJS and Angular's `EventManager`.\n *\n * @publicApi\n */\n@NgModule({\n providers: [\n {\n provide: EVENT_MANAGER_PLUGINS,\n useClass: HammerGesturesPlugin,\n multi: true,\n deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, Console, [new Optional(), HAMMER_LOADER]],\n },\n {provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: []},\n ],\n})\nexport class HammerModule {}\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.io/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {\n forwardRef,\n Inject,\n Injectable,\n Sanitizer,\n SecurityContext,\n ɵ_sanitizeHtml as _sanitizeHtml,\n ɵ_sanitizeUrl as _sanitizeUrl,\n ɵallowSanitizationBypassAndThrow as allowSanitizationBypassOrThrow,\n ɵbypassSanitizationTrustHtml as bypassSanitizationTrustHtml,\n ɵbypassSanitizationTrustResourceUrl as bypassSanitizationTrustResourceUrl,\n ɵbypassSanitizationTrustScript as bypassSanitizationTrustScript,\n ɵbypassSanitizationTrustStyle as bypassSanitizationTrustStyle,\n ɵbypassSanitizationTrustUrl as bypassSanitizationTrustUrl,\n ɵBypassType as BypassType,\n ɵRuntimeError as RuntimeError,\n ɵunwrapSafeValue as unwrapSafeValue,\n ɵXSS_SECURITY_URL as XSS_SECURITY_URL,\n} from '@angular/core';\n\nimport {RuntimeErrorCode} from '../errors';\n\nexport {SecurityContext};\n\n/**\n * Marker interface for a value that's safe to use in a particular context.\n *\n * @publicApi\n */\nexport interface SafeValue {}\n\n/**\n * Marker interface for a value that's safe to use as HTML.\n *\n * @publicApi\n */\nexport interface SafeHtml extends SafeValue {}\n\n/**\n * Marker interface for a value that's safe to use as style (CSS).\n *\n * @publicApi\n */\nexport interface SafeStyle extends SafeValue {}\n\n/**\n * Marker interface for a value that's safe to use as JavaScript.\n *\n * @publicApi\n */\nexport interface SafeScript extends SafeValue {}\n\n/**\n * Marker interface for a value that's safe to use as a URL linking to a document.\n *\n * @publicApi\n */\nexport interface SafeUrl extends SafeValue {}\n\n/**\n * Marker interface for a value that's safe to use as a URL to load executable code from.\n *\n * @publicApi\n */\nexport interface SafeResourceUrl extends SafeValue {}\n\n/**\n * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing\n * values to be safe to use in the different DOM contexts.\n *\n * For example, when binding a URL in an `` hyperlink, `someValue` will be\n * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on\n * the website.\n *\n * In specific situations, it might be necessary to disable sanitization, for example if the\n * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.\n * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`\n * methods, and then binding to that value from the template.\n *\n * These situations should be very rare, and extraordinary care must be taken to avoid creating a\n * Cross Site Scripting (XSS) security bug!\n *\n * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as\n * close as possible to the source of the value, to make it easy to verify no security bug is\n * created by its use.\n *\n * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that\n * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous\n * code. The sanitizer leaves safe values intact.\n *\n * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in\n * sanitization for the value passed in. Carefully check and audit all values and code paths going\n * into this call. Make sure any user data is appropriately escaped for this security context.\n * For more detail, see the [Security Guide](https://g.co/ng/security).\n *\n * @publicApi\n */\n@Injectable({providedIn: 'root', useExisting: forwardRef(() => DomSanitizerImpl)})\nexport abstract class DomSanitizer implements Sanitizer {\n /**\n * Gets a safe value from either a known safe value or a value with unknown safety.\n *\n * If the given value is already a `SafeValue`, this method returns the unwrapped value.\n * If the security context is HTML and the given value is a plain string, this method\n * sanitizes the string, removing any potentially unsafe content.\n * For any other security context, this method throws an error if provided\n * with a plain string.\n */\n abstract sanitize(context: SecurityContext, value: SafeValue | string | null): string | null;\n\n /**\n * Bypass security and trust the given value to be safe HTML. Only use this when the bound HTML\n * is unsafe (e.g. contains `