UNPKG

86.8 kBJavaScriptView Raw
1/**
2 * @license Angular v17.3.7
3 * (c) 2010-2024 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7import * as i0 from '@angular/core';
8import { ɵglobal, ɵRuntimeError, Injectable, InjectionToken, Inject, APP_ID, CSP_NONCE, PLATFORM_ID, Optional, ViewEncapsulation, RendererStyleFlags2, ɵinternalCreateApplication, ErrorHandler, ɵsetDocument, PLATFORM_INITIALIZER, createPlatformFactory, platformCore, ɵTESTABILITY_GETTER, ɵTESTABILITY, Testability, NgZone, TestabilityRegistry, ɵINJECTOR_SCOPE, RendererFactory2, ApplicationModule, NgModule, SkipSelf, ApplicationRef, ɵConsole, forwardRef, ɵXSS_SECURITY_URL, SecurityContext, ɵallowSanitizationBypassAndThrow, ɵunwrapSafeValue, ɵ_sanitizeUrl, ɵ_sanitizeHtml, ɵbypassSanitizationTrustHtml, ɵbypassSanitizationTrustStyle, ɵbypassSanitizationTrustScript, ɵbypassSanitizationTrustUrl, ɵbypassSanitizationTrustResourceUrl, ENVIRONMENT_INITIALIZER, inject, ɵformatRuntimeError, makeEnvironmentProviders, ɵwithDomHydration, Version, makeStateKey as makeStateKey$1, TransferState as TransferState$1 } from '@angular/core';
9import { ɵDomAdapter, ɵsetRootDomAdapter, ɵparseCookieValue, ɵgetDOM, isPlatformServer, DOCUMENT, ɵPLATFORM_BROWSER_ID, XhrFactory, CommonModule } from '@angular/common';
10export { ɵgetDOM } from '@angular/common';
11import { ɵwithHttpTransferCache } from '@angular/common/http';
12
13/**
14 * Provides DOM operations in any browser environment.
15 *
16 * @security Tread carefully! Interacting with the DOM directly is dangerous and
17 * can introduce XSS risks.
18 */
19class GenericBrowserDomAdapter extends ɵDomAdapter {
20 constructor() {
21 super(...arguments);
22 this.supportsDOMEvents = true;
23 }
24}
25
26/**
27 * A `DomAdapter` powered by full browser DOM APIs.
28 *
29 * @security Tread carefully! Interacting with the DOM directly is dangerous and
30 * can introduce XSS risks.
31 */
32/* tslint:disable:requireParameterType no-console */
33class BrowserDomAdapter extends GenericBrowserDomAdapter {
34 static makeCurrent() {
35 ɵsetRootDomAdapter(new BrowserDomAdapter());
36 }
37 onAndCancel(el, evt, listener) {
38 el.addEventListener(evt, listener);
39 return () => {
40 el.removeEventListener(evt, listener);
41 };
42 }
43 dispatchEvent(el, evt) {
44 el.dispatchEvent(evt);
45 }
46 remove(node) {
47 if (node.parentNode) {
48 node.parentNode.removeChild(node);
49 }
50 }
51 createElement(tagName, doc) {
52 doc = doc || this.getDefaultDocument();
53 return doc.createElement(tagName);
54 }
55 createHtmlDocument() {
56 return document.implementation.createHTMLDocument('fakeTitle');
57 }
58 getDefaultDocument() {
59 return document;
60 }
61 isElementNode(node) {
62 return node.nodeType === Node.ELEMENT_NODE;
63 }
64 isShadowRoot(node) {
65 return node instanceof DocumentFragment;
66 }
67 /** @deprecated No longer being used in Ivy code. To be removed in version 14. */
68 getGlobalEventTarget(doc, target) {
69 if (target === 'window') {
70 return window;
71 }
72 if (target === 'document') {
73 return doc;
74 }
75 if (target === 'body') {
76 return doc.body;
77 }
78 return null;
79 }
80 getBaseHref(doc) {
81 const href = getBaseElementHref();
82 return href == null ? null : relativePath(href);
83 }
84 resetBaseElement() {
85 baseElement = null;
86 }
87 getUserAgent() {
88 return window.navigator.userAgent;
89 }
90 getCookie(name) {
91 return ɵparseCookieValue(document.cookie, name);
92 }
93}
94let baseElement = null;
95function getBaseElementHref() {
96 baseElement = baseElement || document.querySelector('base');
97 return baseElement ? baseElement.getAttribute('href') : null;
98}
99function relativePath(url) {
100 // The base URL doesn't really matter, we just need it so relative paths have something
101 // to resolve against. In the browser `HTMLBaseElement.href` is always absolute.
102 return new URL(url, document.baseURI).pathname;
103}
104
105class BrowserGetTestability {
106 addToWindow(registry) {
107 ɵglobal['getAngularTestability'] = (elem, findInAncestors = true) => {
108 const testability = registry.findTestabilityInTree(elem, findInAncestors);
109 if (testability == null) {
110 throw new ɵRuntimeError(5103 /* RuntimeErrorCode.TESTABILITY_NOT_FOUND */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
111 'Could not find testability for element.');
112 }
113 return testability;
114 };
115 ɵglobal['getAllAngularTestabilities'] = () => registry.getAllTestabilities();
116 ɵglobal['getAllAngularRootElements'] = () => registry.getAllRootElements();
117 const whenAllStable = (callback) => {
118 const testabilities = ɵglobal['getAllAngularTestabilities']();
119 let count = testabilities.length;
120 const decrement = function () {
121 count--;
122 if (count == 0) {
123 callback();
124 }
125 };
126 testabilities.forEach((testability) => {
127 testability.whenStable(decrement);
128 });
129 };
130 if (!ɵglobal['frameworkStabilizers']) {
131 ɵglobal['frameworkStabilizers'] = [];
132 }
133 ɵglobal['frameworkStabilizers'].push(whenAllStable);
134 }
135 findTestabilityInTree(registry, elem, findInAncestors) {
136 if (elem == null) {
137 return null;
138 }
139 const t = registry.getTestability(elem);
140 if (t != null) {
141 return t;
142 }
143 else if (!findInAncestors) {
144 return null;
145 }
146 if (ɵgetDOM().isShadowRoot(elem)) {
147 return this.findTestabilityInTree(registry, elem.host, true);
148 }
149 return this.findTestabilityInTree(registry, elem.parentElement, true);
150 }
151}
152
153/**
154 * A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API.
155 */
156class BrowserXhr {
157 build() {
158 return new XMLHttpRequest();
159 }
160 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: BrowserXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
161 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: BrowserXhr }); }
162}
163i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: BrowserXhr, decorators: [{
164 type: Injectable
165 }] });
166
167/**
168 * The injection token for plugins of the `EventManager` service.
169 *
170 * @publicApi
171 */
172const EVENT_MANAGER_PLUGINS = new InjectionToken(ngDevMode ? 'EventManagerPlugins' : '');
173/**
174 * An injectable service that provides event management for Angular
175 * through a browser plug-in.
176 *
177 * @publicApi
178 */
179class EventManager {
180 /**
181 * Initializes an instance of the event-manager service.
182 */
183 constructor(plugins, _zone) {
184 this._zone = _zone;
185 this._eventNameToPlugin = new Map();
186 plugins.forEach((plugin) => {
187 plugin.manager = this;
188 });
189 this._plugins = plugins.slice().reverse();
190 }
191 /**
192 * Registers a handler for a specific element and event.
193 *
194 * @param element The HTML element to receive event notifications.
195 * @param eventName The name of the event to listen for.
196 * @param handler A function to call when the notification occurs. Receives the
197 * event object as an argument.
198 * @returns A callback function that can be used to remove the handler.
199 */
200 addEventListener(element, eventName, handler) {
201 const plugin = this._findPluginFor(eventName);
202 return plugin.addEventListener(element, eventName, handler);
203 }
204 /**
205 * Retrieves the compilation zone in which event listeners are registered.
206 */
207 getZone() {
208 return this._zone;
209 }
210 /** @internal */
211 _findPluginFor(eventName) {
212 let plugin = this._eventNameToPlugin.get(eventName);
213 if (plugin) {
214 return plugin;
215 }
216 const plugins = this._plugins;
217 plugin = plugins.find((plugin) => plugin.supports(eventName));
218 if (!plugin) {
219 throw new ɵRuntimeError(5101 /* RuntimeErrorCode.NO_PLUGIN_FOR_EVENT */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
220 `No event manager plugin found for event ${eventName}`);
221 }
222 this._eventNameToPlugin.set(eventName, plugin);
223 return plugin;
224 }
225 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: EventManager, deps: [{ token: EVENT_MANAGER_PLUGINS }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable }); }
226 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: EventManager }); }
227}
228i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: EventManager, decorators: [{
229 type: Injectable
230 }], ctorParameters: () => [{ type: undefined, decorators: [{
231 type: Inject,
232 args: [EVENT_MANAGER_PLUGINS]
233 }] }, { type: i0.NgZone }] });
234/**
235 * The plugin definition for the `EventManager` class
236 *
237 * It can be used as a base class to create custom manager plugins, i.e. you can create your own
238 * class that extends the `EventManagerPlugin` one.
239 *
240 * @publicApi
241 */
242class EventManagerPlugin {
243 // TODO: remove (has some usage in G3)
244 constructor(_doc) {
245 this._doc = _doc;
246 }
247}
248
249/** The style elements attribute name used to set value of `APP_ID` token. */
250const APP_ID_ATTRIBUTE_NAME = 'ng-app-id';
251class SharedStylesHost {
252 constructor(doc, appId, nonce, platformId = {}) {
253 this.doc = doc;
254 this.appId = appId;
255 this.nonce = nonce;
256 this.platformId = platformId;
257 // Maps all registered host nodes to a list of style nodes that have been added to the host node.
258 this.styleRef = new Map();
259 this.hostNodes = new Set();
260 this.styleNodesInDOM = this.collectServerRenderedStyles();
261 this.platformIsServer = isPlatformServer(platformId);
262 this.resetHostNodes();
263 }
264 addStyles(styles) {
265 for (const style of styles) {
266 const usageCount = this.changeUsageCount(style, 1);
267 if (usageCount === 1) {
268 this.onStyleAdded(style);
269 }
270 }
271 }
272 removeStyles(styles) {
273 for (const style of styles) {
274 const usageCount = this.changeUsageCount(style, -1);
275 if (usageCount <= 0) {
276 this.onStyleRemoved(style);
277 }
278 }
279 }
280 ngOnDestroy() {
281 const styleNodesInDOM = this.styleNodesInDOM;
282 if (styleNodesInDOM) {
283 styleNodesInDOM.forEach((node) => node.remove());
284 styleNodesInDOM.clear();
285 }
286 for (const style of this.getAllStyles()) {
287 this.onStyleRemoved(style);
288 }
289 this.resetHostNodes();
290 }
291 addHost(hostNode) {
292 this.hostNodes.add(hostNode);
293 for (const style of this.getAllStyles()) {
294 this.addStyleToHost(hostNode, style);
295 }
296 }
297 removeHost(hostNode) {
298 this.hostNodes.delete(hostNode);
299 }
300 getAllStyles() {
301 return this.styleRef.keys();
302 }
303 onStyleAdded(style) {
304 for (const host of this.hostNodes) {
305 this.addStyleToHost(host, style);
306 }
307 }
308 onStyleRemoved(style) {
309 const styleRef = this.styleRef;
310 styleRef.get(style)?.elements?.forEach((node) => node.remove());
311 styleRef.delete(style);
312 }
313 collectServerRenderedStyles() {
314 const styles = this.doc.head?.querySelectorAll(`style[${APP_ID_ATTRIBUTE_NAME}="${this.appId}"]`);
315 if (styles?.length) {
316 const styleMap = new Map();
317 styles.forEach((style) => {
318 if (style.textContent != null) {
319 styleMap.set(style.textContent, style);
320 }
321 });
322 return styleMap;
323 }
324 return null;
325 }
326 changeUsageCount(style, delta) {
327 const map = this.styleRef;
328 if (map.has(style)) {
329 const styleRefValue = map.get(style);
330 styleRefValue.usage += delta;
331 return styleRefValue.usage;
332 }
333 map.set(style, { usage: delta, elements: [] });
334 return delta;
335 }
336 getStyleElement(host, style) {
337 const styleNodesInDOM = this.styleNodesInDOM;
338 const styleEl = styleNodesInDOM?.get(style);
339 if (styleEl?.parentNode === host) {
340 // `styleNodesInDOM` cannot be undefined due to the above `styleNodesInDOM?.get`.
341 styleNodesInDOM.delete(style);
342 styleEl.removeAttribute(APP_ID_ATTRIBUTE_NAME);
343 if (typeof ngDevMode === 'undefined' || ngDevMode) {
344 // This attribute is solely used for debugging purposes.
345 styleEl.setAttribute('ng-style-reused', '');
346 }
347 return styleEl;
348 }
349 else {
350 const styleEl = this.doc.createElement('style');
351 if (this.nonce) {
352 styleEl.setAttribute('nonce', this.nonce);
353 }
354 styleEl.textContent = style;
355 if (this.platformIsServer) {
356 styleEl.setAttribute(APP_ID_ATTRIBUTE_NAME, this.appId);
357 }
358 host.appendChild(styleEl);
359 return styleEl;
360 }
361 }
362 addStyleToHost(host, style) {
363 const styleEl = this.getStyleElement(host, style);
364 const styleRef = this.styleRef;
365 const styleElRef = styleRef.get(style)?.elements;
366 if (styleElRef) {
367 styleElRef.push(styleEl);
368 }
369 else {
370 styleRef.set(style, { elements: [styleEl], usage: 1 });
371 }
372 }
373 resetHostNodes() {
374 const hostNodes = this.hostNodes;
375 hostNodes.clear();
376 // Re-add the head element back since this is the default host.
377 hostNodes.add(this.doc.head);
378 }
379 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SharedStylesHost, deps: [{ token: DOCUMENT }, { token: APP_ID }, { token: CSP_NONCE, optional: true }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable }); }
380 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SharedStylesHost }); }
381}
382i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: SharedStylesHost, decorators: [{
383 type: Injectable
384 }], ctorParameters: () => [{ type: Document, decorators: [{
385 type: Inject,
386 args: [DOCUMENT]
387 }] }, { type: undefined, decorators: [{
388 type: Inject,
389 args: [APP_ID]
390 }] }, { type: undefined, decorators: [{
391 type: Inject,
392 args: [CSP_NONCE]
393 }, {
394 type: Optional
395 }] }, { type: undefined, decorators: [{
396 type: Inject,
397 args: [PLATFORM_ID]
398 }] }] });
399
400const NAMESPACE_URIS = {
401 'svg': 'http://www.w3.org/2000/svg',
402 'xhtml': 'http://www.w3.org/1999/xhtml',
403 'xlink': 'http://www.w3.org/1999/xlink',
404 'xml': 'http://www.w3.org/XML/1998/namespace',
405 'xmlns': 'http://www.w3.org/2000/xmlns/',
406 'math': 'http://www.w3.org/1998/MathML/',
407};
408const COMPONENT_REGEX = /%COMP%/g;
409const COMPONENT_VARIABLE = '%COMP%';
410const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
411const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
412/**
413 * The default value for the `REMOVE_STYLES_ON_COMPONENT_DESTROY` DI token.
414 */
415const REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT = true;
416/**
417 * A [DI token](guide/glossary#di-token "DI token definition") that indicates whether styles
418 * of destroyed components should be removed from DOM.
419 *
420 * By default, the value is set to `true`.
421 * @publicApi
422 */
423const REMOVE_STYLES_ON_COMPONENT_DESTROY = new InjectionToken(ngDevMode ? 'RemoveStylesOnCompDestroy' : '', {
424 providedIn: 'root',
425 factory: () => REMOVE_STYLES_ON_COMPONENT_DESTROY_DEFAULT,
426});
427function shimContentAttribute(componentShortId) {
428 return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
429}
430function shimHostAttribute(componentShortId) {
431 return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
432}
433function shimStylesContent(compId, styles) {
434 return styles.map(s => s.replace(COMPONENT_REGEX, compId));
435}
436class DomRendererFactory2 {
437 constructor(eventManager, sharedStylesHost, appId, removeStylesOnCompDestroy, doc, platformId, ngZone, nonce = null) {
438 this.eventManager = eventManager;
439 this.sharedStylesHost = sharedStylesHost;
440 this.appId = appId;
441 this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
442 this.doc = doc;
443 this.platformId = platformId;
444 this.ngZone = ngZone;
445 this.nonce = nonce;
446 this.rendererByCompId = new Map();
447 this.platformIsServer = isPlatformServer(platformId);
448 this.defaultRenderer =
449 new DefaultDomRenderer2(eventManager, doc, ngZone, this.platformIsServer);
450 }
451 createRenderer(element, type) {
452 if (!element || !type) {
453 return this.defaultRenderer;
454 }
455 if (this.platformIsServer && type.encapsulation === ViewEncapsulation.ShadowDom) {
456 // Domino does not support shadow DOM.
457 type = { ...type, encapsulation: ViewEncapsulation.Emulated };
458 }
459 const renderer = this.getOrCreateRenderer(element, type);
460 // Renderers have different logic due to different encapsulation behaviours.
461 // Ex: for emulated, an attribute is added to the element.
462 if (renderer instanceof EmulatedEncapsulationDomRenderer2) {
463 renderer.applyToHost(element);
464 }
465 else if (renderer instanceof NoneEncapsulationDomRenderer) {
466 renderer.applyStyles();
467 }
468 return renderer;
469 }
470 getOrCreateRenderer(element, type) {
471 const rendererByCompId = this.rendererByCompId;
472 let renderer = rendererByCompId.get(type.id);
473 if (!renderer) {
474 const doc = this.doc;
475 const ngZone = this.ngZone;
476 const eventManager = this.eventManager;
477 const sharedStylesHost = this.sharedStylesHost;
478 const removeStylesOnCompDestroy = this.removeStylesOnCompDestroy;
479 const platformIsServer = this.platformIsServer;
480 switch (type.encapsulation) {
481 case ViewEncapsulation.Emulated:
482 renderer = new EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, type, this.appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer);
483 break;
484 case ViewEncapsulation.ShadowDom:
485 return new ShadowDomRenderer(eventManager, sharedStylesHost, element, type, doc, ngZone, this.nonce, platformIsServer);
486 default:
487 renderer = new NoneEncapsulationDomRenderer(eventManager, sharedStylesHost, type, removeStylesOnCompDestroy, doc, ngZone, platformIsServer);
488 break;
489 }
490 rendererByCompId.set(type.id, renderer);
491 }
492 return renderer;
493 }
494 ngOnDestroy() {
495 this.rendererByCompId.clear();
496 }
497 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomRendererFactory2, deps: [{ token: EventManager }, { token: SharedStylesHost }, { token: APP_ID }, { token: REMOVE_STYLES_ON_COMPONENT_DESTROY }, { token: DOCUMENT }, { token: PLATFORM_ID }, { token: i0.NgZone }, { token: CSP_NONCE }], target: i0.ɵɵFactoryTarget.Injectable }); }
498 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomRendererFactory2 }); }
499}
500i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomRendererFactory2, decorators: [{
501 type: Injectable
502 }], ctorParameters: () => [{ type: EventManager }, { type: SharedStylesHost }, { type: undefined, decorators: [{
503 type: Inject,
504 args: [APP_ID]
505 }] }, { type: undefined, decorators: [{
506 type: Inject,
507 args: [REMOVE_STYLES_ON_COMPONENT_DESTROY]
508 }] }, { type: Document, decorators: [{
509 type: Inject,
510 args: [DOCUMENT]
511 }] }, { type: Object, decorators: [{
512 type: Inject,
513 args: [PLATFORM_ID]
514 }] }, { type: i0.NgZone }, { type: undefined, decorators: [{
515 type: Inject,
516 args: [CSP_NONCE]
517 }] }] });
518class DefaultDomRenderer2 {
519 constructor(eventManager, doc, ngZone, platformIsServer) {
520 this.eventManager = eventManager;
521 this.doc = doc;
522 this.ngZone = ngZone;
523 this.platformIsServer = platformIsServer;
524 this.data = Object.create(null);
525 /**
526 * By default this renderer throws when encountering synthetic properties
527 * This can be disabled for example by the AsyncAnimationRendererFactory
528 */
529 this.throwOnSyntheticProps = true;
530 this.destroyNode = null;
531 }
532 destroy() { }
533 createElement(name, namespace) {
534 if (namespace) {
535 // TODO: `|| namespace` was added in
536 // https://github.com/angular/angular/commit/2b9cc8503d48173492c29f5a271b61126104fbdb to
537 // support how Ivy passed around the namespace URI rather than short name at the time. It did
538 // not, however extend the support to other parts of the system (setAttribute, setAttribute,
539 // and the ServerRenderer). We should decide what exactly the semantics for dealing with
540 // namespaces should be and make it consistent.
541 // Related issues:
542 // https://github.com/angular/angular/issues/44028
543 // https://github.com/angular/angular/issues/44883
544 return this.doc.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
545 }
546 return this.doc.createElement(name);
547 }
548 createComment(value) {
549 return this.doc.createComment(value);
550 }
551 createText(value) {
552 return this.doc.createTextNode(value);
553 }
554 appendChild(parent, newChild) {
555 const targetParent = isTemplateNode(parent) ? parent.content : parent;
556 targetParent.appendChild(newChild);
557 }
558 insertBefore(parent, newChild, refChild) {
559 if (parent) {
560 const targetParent = isTemplateNode(parent) ? parent.content : parent;
561 targetParent.insertBefore(newChild, refChild);
562 }
563 }
564 removeChild(parent, oldChild) {
565 if (parent) {
566 parent.removeChild(oldChild);
567 }
568 }
569 selectRootElement(selectorOrNode, preserveContent) {
570 let el = typeof selectorOrNode === 'string' ? this.doc.querySelector(selectorOrNode) :
571 selectorOrNode;
572 if (!el) {
573 throw new ɵRuntimeError(-5104 /* RuntimeErrorCode.ROOT_NODE_NOT_FOUND */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
574 `The selector "${selectorOrNode}" did not match any elements`);
575 }
576 if (!preserveContent) {
577 el.textContent = '';
578 }
579 return el;
580 }
581 parentNode(node) {
582 return node.parentNode;
583 }
584 nextSibling(node) {
585 return node.nextSibling;
586 }
587 setAttribute(el, name, value, namespace) {
588 if (namespace) {
589 name = namespace + ':' + name;
590 const namespaceUri = NAMESPACE_URIS[namespace];
591 if (namespaceUri) {
592 el.setAttributeNS(namespaceUri, name, value);
593 }
594 else {
595 el.setAttribute(name, value);
596 }
597 }
598 else {
599 el.setAttribute(name, value);
600 }
601 }
602 removeAttribute(el, name, namespace) {
603 if (namespace) {
604 const namespaceUri = NAMESPACE_URIS[namespace];
605 if (namespaceUri) {
606 el.removeAttributeNS(namespaceUri, name);
607 }
608 else {
609 el.removeAttribute(`${namespace}:${name}`);
610 }
611 }
612 else {
613 el.removeAttribute(name);
614 }
615 }
616 addClass(el, name) {
617 el.classList.add(name);
618 }
619 removeClass(el, name) {
620 el.classList.remove(name);
621 }
622 setStyle(el, style, value, flags) {
623 if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {
624 el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? 'important' : '');
625 }
626 else {
627 el.style[style] = value;
628 }
629 }
630 removeStyle(el, style, flags) {
631 if (flags & RendererStyleFlags2.DashCase) {
632 // removeProperty has no effect when used on camelCased properties.
633 el.style.removeProperty(style);
634 }
635 else {
636 el.style[style] = '';
637 }
638 }
639 setProperty(el, name, value) {
640 if (el == null) {
641 return;
642 }
643 (typeof ngDevMode === 'undefined' || ngDevMode) && this.throwOnSyntheticProps &&
644 checkNoSyntheticProp(name, 'property');
645 el[name] = value;
646 }
647 setValue(node, value) {
648 node.nodeValue = value;
649 }
650 listen(target, event, callback) {
651 (typeof ngDevMode === 'undefined' || ngDevMode) && this.throwOnSyntheticProps &&
652 checkNoSyntheticProp(event, 'listener');
653 if (typeof target === 'string') {
654 target = ɵgetDOM().getGlobalEventTarget(this.doc, target);
655 if (!target) {
656 throw new Error(`Unsupported event target ${target} for event ${event}`);
657 }
658 }
659 return this.eventManager.addEventListener(target, event, this.decoratePreventDefault(callback));
660 }
661 decoratePreventDefault(eventHandler) {
662 // `DebugNode.triggerEventHandler` needs to know if the listener was created with
663 // decoratePreventDefault or is a listener added outside the Angular context so it can handle
664 // the two differently. In the first case, the special '__ngUnwrap__' token is passed to the
665 // unwrap the listener (see below).
666 return (event) => {
667 // Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function
668 // so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The
669 // debug_node can inspect the listener toString contents for the existence of this special
670 // token. Because the token is a string literal, it is ensured to not be modified by compiled
671 // code.
672 if (event === '__ngUnwrap__') {
673 return eventHandler;
674 }
675 // Run the event handler inside the ngZone because event handlers are not patched
676 // by Zone on the server. This is required only for tests.
677 const allowDefaultBehavior = this.platformIsServer ?
678 this.ngZone.runGuarded(() => eventHandler(event)) :
679 eventHandler(event);
680 if (allowDefaultBehavior === false) {
681 event.preventDefault();
682 }
683 return undefined;
684 };
685 }
686}
687const AT_CHARCODE = (() => '@'.charCodeAt(0))();
688function checkNoSyntheticProp(name, nameKind) {
689 if (name.charCodeAt(0) === AT_CHARCODE) {
690 throw new ɵRuntimeError(5105 /* RuntimeErrorCode.UNEXPECTED_SYNTHETIC_PROPERTY */, `Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
691 - Either \`BrowserAnimationsModule\` or \`NoopAnimationsModule\` are imported in your application.
692 - 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).`);
693 }
694}
695function isTemplateNode(node) {
696 return node.tagName === 'TEMPLATE' && node.content !== undefined;
697}
698class ShadowDomRenderer extends DefaultDomRenderer2 {
699 constructor(eventManager, sharedStylesHost, hostEl, component, doc, ngZone, nonce, platformIsServer) {
700 super(eventManager, doc, ngZone, platformIsServer);
701 this.sharedStylesHost = sharedStylesHost;
702 this.hostEl = hostEl;
703 this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
704 this.sharedStylesHost.addHost(this.shadowRoot);
705 const styles = shimStylesContent(component.id, component.styles);
706 for (const style of styles) {
707 const styleEl = document.createElement('style');
708 if (nonce) {
709 styleEl.setAttribute('nonce', nonce);
710 }
711 styleEl.textContent = style;
712 this.shadowRoot.appendChild(styleEl);
713 }
714 }
715 nodeOrShadowRoot(node) {
716 return node === this.hostEl ? this.shadowRoot : node;
717 }
718 appendChild(parent, newChild) {
719 return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
720 }
721 insertBefore(parent, newChild, refChild) {
722 return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
723 }
724 removeChild(parent, oldChild) {
725 return super.removeChild(this.nodeOrShadowRoot(parent), oldChild);
726 }
727 parentNode(node) {
728 return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
729 }
730 destroy() {
731 this.sharedStylesHost.removeHost(this.shadowRoot);
732 }
733}
734class NoneEncapsulationDomRenderer extends DefaultDomRenderer2 {
735 constructor(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, compId) {
736 super(eventManager, doc, ngZone, platformIsServer);
737 this.sharedStylesHost = sharedStylesHost;
738 this.removeStylesOnCompDestroy = removeStylesOnCompDestroy;
739 this.styles = compId ? shimStylesContent(compId, component.styles) : component.styles;
740 }
741 applyStyles() {
742 this.sharedStylesHost.addStyles(this.styles);
743 }
744 destroy() {
745 if (!this.removeStylesOnCompDestroy) {
746 return;
747 }
748 this.sharedStylesHost.removeStyles(this.styles);
749 }
750}
751class EmulatedEncapsulationDomRenderer2 extends NoneEncapsulationDomRenderer {
752 constructor(eventManager, sharedStylesHost, component, appId, removeStylesOnCompDestroy, doc, ngZone, platformIsServer) {
753 const compId = appId + '-' + component.id;
754 super(eventManager, sharedStylesHost, component, removeStylesOnCompDestroy, doc, ngZone, platformIsServer, compId);
755 this.contentAttr = shimContentAttribute(compId);
756 this.hostAttr = shimHostAttribute(compId);
757 }
758 applyToHost(element) {
759 this.applyStyles();
760 this.setAttribute(element, this.hostAttr, '');
761 }
762 createElement(parent, name) {
763 const el = super.createElement(parent, name);
764 super.setAttribute(el, this.contentAttr, '');
765 return el;
766 }
767}
768
769class DomEventsPlugin extends EventManagerPlugin {
770 constructor(doc) {
771 super(doc);
772 }
773 // This plugin should come last in the list of plugins, because it accepts all
774 // events.
775 supports(eventName) {
776 return true;
777 }
778 addEventListener(element, eventName, handler) {
779 element.addEventListener(eventName, handler, false);
780 return () => this.removeEventListener(element, eventName, handler);
781 }
782 removeEventListener(target, eventName, callback) {
783 return target.removeEventListener(eventName, callback);
784 }
785 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
786 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomEventsPlugin }); }
787}
788i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomEventsPlugin, decorators: [{
789 type: Injectable
790 }], ctorParameters: () => [{ type: undefined, decorators: [{
791 type: Inject,
792 args: [DOCUMENT]
793 }] }] });
794
795/**
796 * Defines supported modifiers for key events.
797 */
798const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
799// The following values are here for cross-browser compatibility and to match the W3C standard
800// cf https://www.w3.org/TR/DOM-Level-3-Events-key/
801const _keyMap = {
802 '\b': 'Backspace',
803 '\t': 'Tab',
804 '\x7F': 'Delete',
805 '\x1B': 'Escape',
806 'Del': 'Delete',
807 'Esc': 'Escape',
808 'Left': 'ArrowLeft',
809 'Right': 'ArrowRight',
810 'Up': 'ArrowUp',
811 'Down': 'ArrowDown',
812 'Menu': 'ContextMenu',
813 'Scroll': 'ScrollLock',
814 'Win': 'OS'
815};
816/**
817 * Retrieves modifiers from key-event objects.
818 */
819const MODIFIER_KEY_GETTERS = {
820 'alt': (event) => event.altKey,
821 'control': (event) => event.ctrlKey,
822 'meta': (event) => event.metaKey,
823 'shift': (event) => event.shiftKey
824};
825/**
826 * A browser plug-in that provides support for handling of key events in Angular.
827 */
828class KeyEventsPlugin extends EventManagerPlugin {
829 /**
830 * Initializes an instance of the browser plug-in.
831 * @param doc The document in which key events will be detected.
832 */
833 constructor(doc) {
834 super(doc);
835 }
836 /**
837 * Reports whether a named key event is supported.
838 * @param eventName The event name to query.
839 * @return True if the named key event is supported.
840 */
841 supports(eventName) {
842 return KeyEventsPlugin.parseEventName(eventName) != null;
843 }
844 /**
845 * Registers a handler for a specific element and key event.
846 * @param element The HTML element to receive event notifications.
847 * @param eventName The name of the key event to listen for.
848 * @param handler A function to call when the notification occurs. Receives the
849 * event object as an argument.
850 * @returns The key event that was registered.
851 */
852 addEventListener(element, eventName, handler) {
853 const parsedEvent = KeyEventsPlugin.parseEventName(eventName);
854 const outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
855 return this.manager.getZone().runOutsideAngular(() => {
856 return ɵgetDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
857 });
858 }
859 /**
860 * Parses the user provided full keyboard event definition and normalizes it for
861 * later internal use. It ensures the string is all lowercase, converts special
862 * characters to a standard spelling, and orders all the values consistently.
863 *
864 * @param eventName The name of the key event to listen for.
865 * @returns an object with the full, normalized string, and the dom event name
866 * or null in the case when the event doesn't match a keyboard event.
867 */
868 static parseEventName(eventName) {
869 const parts = eventName.toLowerCase().split('.');
870 const domEventName = parts.shift();
871 if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
872 return null;
873 }
874 const key = KeyEventsPlugin._normalizeKey(parts.pop());
875 let fullKey = '';
876 let codeIX = parts.indexOf('code');
877 if (codeIX > -1) {
878 parts.splice(codeIX, 1);
879 fullKey = 'code.';
880 }
881 MODIFIER_KEYS.forEach(modifierName => {
882 const index = parts.indexOf(modifierName);
883 if (index > -1) {
884 parts.splice(index, 1);
885 fullKey += modifierName + '.';
886 }
887 });
888 fullKey += key;
889 if (parts.length != 0 || key.length === 0) {
890 // returning null instead of throwing to let another plugin process the event
891 return null;
892 }
893 // NOTE: Please don't rewrite this as so, as it will break JSCompiler property renaming.
894 // The code must remain in the `result['domEventName']` form.
895 // return {domEventName, fullKey};
896 const result = {};
897 result['domEventName'] = domEventName;
898 result['fullKey'] = fullKey;
899 return result;
900 }
901 /**
902 * Determines whether the actual keys pressed match the configured key code string.
903 * The `fullKeyCode` event is normalized in the `parseEventName` method when the
904 * event is attached to the DOM during the `addEventListener` call. This is unseen
905 * by the end user and is normalized for internal consistency and parsing.
906 *
907 * @param event The keyboard event.
908 * @param fullKeyCode The normalized user defined expected key event string
909 * @returns boolean.
910 */
911 static matchEventFullKeyCode(event, fullKeyCode) {
912 let keycode = _keyMap[event.key] || event.key;
913 let key = '';
914 if (fullKeyCode.indexOf('code.') > -1) {
915 keycode = event.code;
916 key = 'code.';
917 }
918 // the keycode could be unidentified so we have to check here
919 if (keycode == null || !keycode)
920 return false;
921 keycode = keycode.toLowerCase();
922 if (keycode === ' ') {
923 keycode = 'space'; // for readability
924 }
925 else if (keycode === '.') {
926 keycode = 'dot'; // because '.' is used as a separator in event names
927 }
928 MODIFIER_KEYS.forEach(modifierName => {
929 if (modifierName !== keycode) {
930 const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
931 if (modifierGetter(event)) {
932 key += modifierName + '.';
933 }
934 }
935 });
936 key += keycode;
937 return key === fullKeyCode;
938 }
939 /**
940 * Configures a handler callback for a key event.
941 * @param fullKey The event name that combines all simultaneous keystrokes.
942 * @param handler The function that responds to the key event.
943 * @param zone The zone in which the event occurred.
944 * @returns A callback function.
945 */
946 static eventCallback(fullKey, handler, zone) {
947 return (event) => {
948 if (KeyEventsPlugin.matchEventFullKeyCode(event, fullKey)) {
949 zone.runGuarded(() => handler(event));
950 }
951 };
952 }
953 /** @internal */
954 static _normalizeKey(keyName) {
955 return keyName === 'esc' ? 'escape' : keyName;
956 }
957 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: KeyEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
958 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: KeyEventsPlugin }); }
959}
960i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: KeyEventsPlugin, decorators: [{
961 type: Injectable
962 }], ctorParameters: () => [{ type: undefined, decorators: [{
963 type: Inject,
964 args: [DOCUMENT]
965 }] }] });
966
967/**
968 * Bootstraps an instance of an Angular application and renders a standalone component as the
969 * application's root component. More information about standalone components can be found in [this
970 * guide](guide/standalone-components).
971 *
972 * @usageNotes
973 * The root component passed into this function *must* be a standalone one (should have the
974 * `standalone: true` flag in the `@Component` decorator config).
975 *
976 * ```typescript
977 * @Component({
978 * standalone: true,
979 * template: 'Hello world!'
980 * })
981 * class RootComponent {}
982 *
983 * const appRef: ApplicationRef = await bootstrapApplication(RootComponent);
984 * ```
985 *
986 * You can add the list of providers that should be available in the application injector by
987 * specifying the `providers` field in an object passed as the second argument:
988 *
989 * ```typescript
990 * await bootstrapApplication(RootComponent, {
991 * providers: [
992 * {provide: BACKEND_URL, useValue: 'https://yourdomain.com/api'}
993 * ]
994 * });
995 * ```
996 *
997 * The `importProvidersFrom` helper method can be used to collect all providers from any
998 * existing NgModule (and transitively from all NgModules that it imports):
999 *
1000 * ```typescript
1001 * await bootstrapApplication(RootComponent, {
1002 * providers: [
1003 * importProvidersFrom(SomeNgModule)
1004 * ]
1005 * });
1006 * ```
1007 *
1008 * Note: the `bootstrapApplication` method doesn't include [Testability](api/core/Testability) by
1009 * default. You can add [Testability](api/core/Testability) by getting the list of necessary
1010 * providers using `provideProtractorTestingSupport()` function and adding them into the `providers`
1011 * array, for example:
1012 *
1013 * ```typescript
1014 * import {provideProtractorTestingSupport} from '@angular/platform-browser';
1015 *
1016 * await bootstrapApplication(RootComponent, {providers: [provideProtractorTestingSupport()]});
1017 * ```
1018 *
1019 * @param rootComponent A reference to a standalone component that should be rendered.
1020 * @param options Extra configuration for the bootstrap operation, see `ApplicationConfig` for
1021 * additional info.
1022 * @returns A promise that returns an `ApplicationRef` instance once resolved.
1023 *
1024 * @publicApi
1025 */
1026function bootstrapApplication(rootComponent, options) {
1027 return ɵinternalCreateApplication({ rootComponent, ...createProvidersConfig(options) });
1028}
1029/**
1030 * Create an instance of an Angular application without bootstrapping any components. This is useful
1031 * for the situation where one wants to decouple application environment creation (a platform and
1032 * associated injectors) from rendering components on a screen. Components can be subsequently
1033 * bootstrapped on the returned `ApplicationRef`.
1034 *
1035 * @param options Extra configuration for the application environment, see `ApplicationConfig` for
1036 * additional info.
1037 * @returns A promise that returns an `ApplicationRef` instance once resolved.
1038 *
1039 * @publicApi
1040 */
1041function createApplication(options) {
1042 return ɵinternalCreateApplication(createProvidersConfig(options));
1043}
1044function createProvidersConfig(options) {
1045 return {
1046 appProviders: [
1047 ...BROWSER_MODULE_PROVIDERS,
1048 ...(options?.providers ?? []),
1049 ],
1050 platformProviders: INTERNAL_BROWSER_PLATFORM_PROVIDERS
1051 };
1052}
1053/**
1054 * Returns a set of providers required to setup [Testability](api/core/Testability) for an
1055 * application bootstrapped using the `bootstrapApplication` function. The set of providers is
1056 * needed to support testing an application with Protractor (which relies on the Testability APIs
1057 * to be present).
1058 *
1059 * @returns An array of providers required to setup Testability for an application and make it
1060 * available for testing using Protractor.
1061 *
1062 * @publicApi
1063 */
1064function provideProtractorTestingSupport() {
1065 // Return a copy to prevent changes to the original array in case any in-place
1066 // alterations are performed to the `provideProtractorTestingSupport` call results in app
1067 // code.
1068 return [...TESTABILITY_PROVIDERS];
1069}
1070function initDomAdapter() {
1071 BrowserDomAdapter.makeCurrent();
1072}
1073function errorHandler() {
1074 return new ErrorHandler();
1075}
1076function _document() {
1077 // Tell ivy about the global document
1078 ɵsetDocument(document);
1079 return document;
1080}
1081const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
1082 { provide: PLATFORM_ID, useValue: ɵPLATFORM_BROWSER_ID },
1083 { provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
1084 { provide: DOCUMENT, useFactory: _document, deps: [] },
1085];
1086/**
1087 * A factory function that returns a `PlatformRef` instance associated with browser service
1088 * providers.
1089 *
1090 * @publicApi
1091 */
1092const platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
1093/**
1094 * Internal marker to signal whether providers from the `BrowserModule` are already present in DI.
1095 * This is needed to avoid loading `BrowserModule` providers twice. We can't rely on the
1096 * `BrowserModule` presence itself, since the standalone-based bootstrap just imports
1097 * `BrowserModule` providers without referencing the module itself.
1098 */
1099const BROWSER_MODULE_PROVIDERS_MARKER = new InjectionToken((typeof ngDevMode === 'undefined' || ngDevMode) ? 'BrowserModule Providers Marker' : '');
1100const TESTABILITY_PROVIDERS = [
1101 {
1102 provide: ɵTESTABILITY_GETTER,
1103 useClass: BrowserGetTestability,
1104 deps: [],
1105 },
1106 {
1107 provide: ɵTESTABILITY,
1108 useClass: Testability,
1109 deps: [NgZone, TestabilityRegistry, ɵTESTABILITY_GETTER]
1110 },
1111 {
1112 provide: Testability, // Also provide as `Testability` for backwards-compatibility.
1113 useClass: Testability,
1114 deps: [NgZone, TestabilityRegistry, ɵTESTABILITY_GETTER]
1115 }
1116];
1117const BROWSER_MODULE_PROVIDERS = [
1118 { provide: ɵINJECTOR_SCOPE, useValue: 'root' },
1119 { provide: ErrorHandler, useFactory: errorHandler, deps: [] }, {
1120 provide: EVENT_MANAGER_PLUGINS,
1121 useClass: DomEventsPlugin,
1122 multi: true,
1123 deps: [DOCUMENT, NgZone, PLATFORM_ID]
1124 },
1125 { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [DOCUMENT] },
1126 DomRendererFactory2, SharedStylesHost, EventManager,
1127 { provide: RendererFactory2, useExisting: DomRendererFactory2 },
1128 { provide: XhrFactory, useClass: BrowserXhr, deps: [] },
1129 (typeof ngDevMode === 'undefined' || ngDevMode) ?
1130 { provide: BROWSER_MODULE_PROVIDERS_MARKER, useValue: true } :
1131 []
1132];
1133/**
1134 * Exports required infrastructure for all Angular apps.
1135 * Included by default in all Angular apps created with the CLI
1136 * `new` command.
1137 * Re-exports `CommonModule` and `ApplicationModule`, making their
1138 * exports and providers available to all apps.
1139 *
1140 * @publicApi
1141 */
1142class BrowserModule {
1143 constructor(providersAlreadyPresent) {
1144 if ((typeof ngDevMode === 'undefined' || ngDevMode) && providersAlreadyPresent) {
1145 throw new ɵRuntimeError(5100 /* RuntimeErrorCode.BROWSER_MODULE_ALREADY_LOADED */, `Providers from the \`BrowserModule\` have already been loaded. If you need access ` +
1146 `to common directives such as NgIf and NgFor, import the \`CommonModule\` instead.`);
1147 }
1148 }
1149 /**
1150 * Configures a browser-based app to transition from a server-rendered app, if
1151 * one is present on the page.
1152 *
1153 * @param params An object containing an identifier for the app to transition.
1154 * The ID must match between the client and server versions of the app.
1155 * @returns The reconfigured `BrowserModule` to import into the app's root `AppModule`.
1156 *
1157 * @deprecated Use {@link APP_ID} instead to set the application ID.
1158 */
1159 static withServerTransition(params) {
1160 return {
1161 ngModule: BrowserModule,
1162 providers: [
1163 { provide: APP_ID, useValue: params.appId },
1164 ],
1165 };
1166 }
1167 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: BrowserModule, deps: [{ token: BROWSER_MODULE_PROVIDERS_MARKER, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
1168 static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: BrowserModule, exports: [CommonModule, ApplicationModule] }); }
1169 static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: BrowserModule, providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS], imports: [CommonModule, ApplicationModule] }); }
1170}
1171i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: BrowserModule, decorators: [{
1172 type: NgModule,
1173 args: [{
1174 providers: [...BROWSER_MODULE_PROVIDERS, ...TESTABILITY_PROVIDERS],
1175 exports: [CommonModule, ApplicationModule],
1176 }]
1177 }], ctorParameters: () => [{ type: undefined, decorators: [{
1178 type: Optional
1179 }, {
1180 type: SkipSelf
1181 }, {
1182 type: Inject,
1183 args: [BROWSER_MODULE_PROVIDERS_MARKER]
1184 }] }] });
1185
1186/**
1187 * A service for managing HTML `<meta>` tags.
1188 *
1189 * Properties of the `MetaDefinition` object match the attributes of the
1190 * HTML `<meta>` tag. These tags define document metadata that is important for
1191 * things like configuring a Content Security Policy, defining browser compatibility
1192 * and security settings, setting HTTP Headers, defining rich content for social sharing,
1193 * and Search Engine Optimization (SEO).
1194 *
1195 * To identify specific `<meta>` tags in a document, use an attribute selection
1196 * string in the format `"tag_attribute='value string'"`.
1197 * For example, an `attrSelector` value of `"name='description'"` matches a tag
1198 * whose `name` attribute has the value `"description"`.
1199 * Selectors are used with the `querySelector()` Document method,
1200 * in the format `meta[{attrSelector}]`.
1201 *
1202 * @see [HTML meta tag](https://developer.mozilla.org/docs/Web/HTML/Element/meta)
1203 * @see [Document.querySelector()](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
1204 *
1205 *
1206 * @publicApi
1207 */
1208class Meta {
1209 constructor(_doc) {
1210 this._doc = _doc;
1211 this._dom = ɵgetDOM();
1212 }
1213 /**
1214 * Retrieves or creates a specific `<meta>` tag element in the current HTML document.
1215 * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
1216 * values in the provided tag definition, and verifies that all other attribute values are equal.
1217 * If an existing element is found, it is returned and is not modified in any way.
1218 * @param tag The definition of a `<meta>` element to match or create.
1219 * @param forceCreation True to create a new element without checking whether one already exists.
1220 * @returns The existing element with the same attributes and values if found,
1221 * the new element if no match is found, or `null` if the tag parameter is not defined.
1222 */
1223 addTag(tag, forceCreation = false) {
1224 if (!tag)
1225 return null;
1226 return this._getOrCreateElement(tag, forceCreation);
1227 }
1228 /**
1229 * Retrieves or creates a set of `<meta>` tag elements in the current HTML document.
1230 * In searching for an existing tag, Angular attempts to match the `name` or `property` attribute
1231 * values in the provided tag definition, and verifies that all other attribute values are equal.
1232 * @param tags An array of tag definitions to match or create.
1233 * @param forceCreation True to create new elements without checking whether they already exist.
1234 * @returns The matching elements if found, or the new elements.
1235 */
1236 addTags(tags, forceCreation = false) {
1237 if (!tags)
1238 return [];
1239 return tags.reduce((result, tag) => {
1240 if (tag) {
1241 result.push(this._getOrCreateElement(tag, forceCreation));
1242 }
1243 return result;
1244 }, []);
1245 }
1246 /**
1247 * Retrieves a `<meta>` tag element in the current HTML document.
1248 * @param attrSelector The tag attribute and value to match against, in the format
1249 * `"tag_attribute='value string'"`.
1250 * @returns The matching element, if any.
1251 */
1252 getTag(attrSelector) {
1253 if (!attrSelector)
1254 return null;
1255 return this._doc.querySelector(`meta[${attrSelector}]`) || null;
1256 }
1257 /**
1258 * Retrieves a set of `<meta>` tag elements in the current HTML document.
1259 * @param attrSelector The tag attribute and value to match against, in the format
1260 * `"tag_attribute='value string'"`.
1261 * @returns The matching elements, if any.
1262 */
1263 getTags(attrSelector) {
1264 if (!attrSelector)
1265 return [];
1266 const list /*NodeList*/ = this._doc.querySelectorAll(`meta[${attrSelector}]`);
1267 return list ? [].slice.call(list) : [];
1268 }
1269 /**
1270 * Modifies an existing `<meta>` tag element in the current HTML document.
1271 * @param tag The tag description with which to replace the existing tag content.
1272 * @param selector A tag attribute and value to match against, to identify
1273 * an existing tag. A string in the format `"tag_attribute=`value string`"`.
1274 * If not supplied, matches a tag with the same `name` or `property` attribute value as the
1275 * replacement tag.
1276 * @return The modified element.
1277 */
1278 updateTag(tag, selector) {
1279 if (!tag)
1280 return null;
1281 selector = selector || this._parseSelector(tag);
1282 const meta = this.getTag(selector);
1283 if (meta) {
1284 return this._setMetaElementAttributes(tag, meta);
1285 }
1286 return this._getOrCreateElement(tag, true);
1287 }
1288 /**
1289 * Removes an existing `<meta>` tag element from the current HTML document.
1290 * @param attrSelector A tag attribute and value to match against, to identify
1291 * an existing tag. A string in the format `"tag_attribute=`value string`"`.
1292 */
1293 removeTag(attrSelector) {
1294 this.removeTagElement(this.getTag(attrSelector));
1295 }
1296 /**
1297 * Removes an existing `<meta>` tag element from the current HTML document.
1298 * @param meta The tag definition to match against to identify an existing tag.
1299 */
1300 removeTagElement(meta) {
1301 if (meta) {
1302 this._dom.remove(meta);
1303 }
1304 }
1305 _getOrCreateElement(meta, forceCreation = false) {
1306 if (!forceCreation) {
1307 const selector = this._parseSelector(meta);
1308 // It's allowed to have multiple elements with the same name so it's not enough to
1309 // just check that element with the same name already present on the page. We also need to
1310 // check if element has tag attributes
1311 const elem = this.getTags(selector).filter(elem => this._containsAttributes(meta, elem))[0];
1312 if (elem !== undefined)
1313 return elem;
1314 }
1315 const element = this._dom.createElement('meta');
1316 this._setMetaElementAttributes(meta, element);
1317 const head = this._doc.getElementsByTagName('head')[0];
1318 head.appendChild(element);
1319 return element;
1320 }
1321 _setMetaElementAttributes(tag, el) {
1322 Object.keys(tag).forEach((prop) => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
1323 return el;
1324 }
1325 _parseSelector(tag) {
1326 const attr = tag.name ? 'name' : 'property';
1327 return `${attr}="${tag[attr]}"`;
1328 }
1329 _containsAttributes(tag, elem) {
1330 return Object.keys(tag).every((key) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
1331 }
1332 _getMetaKeyMap(prop) {
1333 return META_KEYS_MAP[prop] || prop;
1334 }
1335 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Meta, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
1336 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Meta, providedIn: 'root' }); }
1337}
1338i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Meta, decorators: [{
1339 type: Injectable,
1340 args: [{ providedIn: 'root' }]
1341 }], ctorParameters: () => [{ type: undefined, decorators: [{
1342 type: Inject,
1343 args: [DOCUMENT]
1344 }] }] });
1345/**
1346 * Mapping for MetaDefinition properties with their correct meta attribute names
1347 */
1348const META_KEYS_MAP = {
1349 httpEquiv: 'http-equiv'
1350};
1351
1352/**
1353 * A service that can be used to get and set the title of a current HTML document.
1354 *
1355 * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
1356 * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
1357 * (representing the `<title>` tag). Instead, this service can be used to set and get the current
1358 * title value.
1359 *
1360 * @publicApi
1361 */
1362class Title {
1363 constructor(_doc) {
1364 this._doc = _doc;
1365 }
1366 /**
1367 * Get the title of the current HTML document.
1368 */
1369 getTitle() {
1370 return this._doc.title;
1371 }
1372 /**
1373 * Set the title of the current HTML document.
1374 * @param newTitle
1375 */
1376 setTitle(newTitle) {
1377 this._doc.title = newTitle || '';
1378 }
1379 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Title, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
1380 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Title, providedIn: 'root' }); }
1381}
1382i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: Title, decorators: [{
1383 type: Injectable,
1384 args: [{ providedIn: 'root' }]
1385 }], ctorParameters: () => [{ type: undefined, decorators: [{
1386 type: Inject,
1387 args: [DOCUMENT]
1388 }] }] });
1389
1390/**
1391 * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
1392 * `name` is `'probe'`.
1393 * @param name Name under which it will be exported. Keep in mind this will be a property of the
1394 * global `ng` object.
1395 * @param value The value to export.
1396 */
1397function exportNgVar(name, value) {
1398 if (typeof COMPILED === 'undefined' || !COMPILED) {
1399 // Note: we can't export `ng` when using closure enhanced optimization as:
1400 // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
1401 // - we can't declare a closure extern as the namespace `ng` is already used within Google
1402 // for typings for angularJS (via `goog.provide('ng....')`).
1403 const ng = ɵglobal['ng'] = ɵglobal['ng'] || {};
1404 ng[name] = value;
1405 }
1406}
1407
1408class ChangeDetectionPerfRecord {
1409 constructor(msPerTick, numTicks) {
1410 this.msPerTick = msPerTick;
1411 this.numTicks = numTicks;
1412 }
1413}
1414/**
1415 * Entry point for all Angular profiling-related debug tools. This object
1416 * corresponds to the `ng.profiler` in the dev console.
1417 */
1418class AngularProfiler {
1419 constructor(ref) {
1420 this.appRef = ref.injector.get(ApplicationRef);
1421 }
1422 // tslint:disable:no-console
1423 /**
1424 * Exercises change detection in a loop and then prints the average amount of
1425 * time in milliseconds how long a single round of change detection takes for
1426 * the current state of the UI. It runs a minimum of 5 rounds for a minimum
1427 * of 500 milliseconds.
1428 *
1429 * Optionally, a user may pass a `config` parameter containing a map of
1430 * options. Supported options are:
1431 *
1432 * `record` (boolean) - causes the profiler to record a CPU profile while
1433 * it exercises the change detector. Example:
1434 *
1435 * ```
1436 * ng.profiler.timeChangeDetection({record: true})
1437 * ```
1438 */
1439 timeChangeDetection(config) {
1440 const record = config && config['record'];
1441 const profileName = 'Change Detection';
1442 // Profiler is not available in Android browsers without dev tools opened
1443 if (record && 'profile' in console && typeof console.profile === 'function') {
1444 console.profile(profileName);
1445 }
1446 const start = performance.now();
1447 let numTicks = 0;
1448 while (numTicks < 5 || (performance.now() - start) < 500) {
1449 this.appRef.tick();
1450 numTicks++;
1451 }
1452 const end = performance.now();
1453 if (record && 'profileEnd' in console && typeof console.profileEnd === 'function') {
1454 console.profileEnd(profileName);
1455 }
1456 const msPerTick = (end - start) / numTicks;
1457 console.log(`ran ${numTicks} change detection cycles`);
1458 console.log(`${msPerTick.toFixed(2)} ms per check`);
1459 return new ChangeDetectionPerfRecord(msPerTick, numTicks);
1460 }
1461}
1462
1463const PROFILER_GLOBAL_NAME = 'profiler';
1464/**
1465 * Enabled Angular debug tools that are accessible via your browser's
1466 * developer console.
1467 *
1468 * Usage:
1469 *
1470 * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
1471 * 1. Type `ng.` (usually the console will show auto-complete suggestion)
1472 * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
1473 * then hit Enter.
1474 *
1475 * @publicApi
1476 */
1477function enableDebugTools(ref) {
1478 exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
1479 return ref;
1480}
1481/**
1482 * Disables Angular tools.
1483 *
1484 * @publicApi
1485 */
1486function disableDebugTools() {
1487 exportNgVar(PROFILER_GLOBAL_NAME, null);
1488}
1489
1490/**
1491 * Predicates for use with {@link DebugElement}'s query functions.
1492 *
1493 * @publicApi
1494 */
1495class By {
1496 /**
1497 * Match all nodes.
1498 *
1499 * @usageNotes
1500 * ### Example
1501 *
1502 * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
1503 */
1504 static all() {
1505 return () => true;
1506 }
1507 /**
1508 * Match elements by the given CSS selector.
1509 *
1510 * @usageNotes
1511 * ### Example
1512 *
1513 * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
1514 */
1515 static css(selector) {
1516 return (debugElement) => {
1517 return debugElement.nativeElement != null ?
1518 elementMatches(debugElement.nativeElement, selector) :
1519 false;
1520 };
1521 }
1522 /**
1523 * Match nodes that have the given directive present.
1524 *
1525 * @usageNotes
1526 * ### Example
1527 *
1528 * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
1529 */
1530 static directive(type) {
1531 return (debugNode) => debugNode.providerTokens.indexOf(type) !== -1;
1532 }
1533}
1534function elementMatches(n, selector) {
1535 if (ɵgetDOM().isElementNode(n)) {
1536 return n.matches && n.matches(selector) ||
1537 n.msMatchesSelector && n.msMatchesSelector(selector) ||
1538 n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
1539 }
1540 return false;
1541}
1542
1543/**
1544 * Supported HammerJS recognizer event names.
1545 */
1546const EVENT_NAMES = {
1547 // pan
1548 'pan': true,
1549 'panstart': true,
1550 'panmove': true,
1551 'panend': true,
1552 'pancancel': true,
1553 'panleft': true,
1554 'panright': true,
1555 'panup': true,
1556 'pandown': true,
1557 // pinch
1558 'pinch': true,
1559 'pinchstart': true,
1560 'pinchmove': true,
1561 'pinchend': true,
1562 'pinchcancel': true,
1563 'pinchin': true,
1564 'pinchout': true,
1565 // press
1566 'press': true,
1567 'pressup': true,
1568 // rotate
1569 'rotate': true,
1570 'rotatestart': true,
1571 'rotatemove': true,
1572 'rotateend': true,
1573 'rotatecancel': true,
1574 // swipe
1575 'swipe': true,
1576 'swipeleft': true,
1577 'swiperight': true,
1578 'swipeup': true,
1579 'swipedown': true,
1580 // tap
1581 'tap': true,
1582 'doubletap': true
1583};
1584/**
1585 * DI token for providing [HammerJS](https://hammerjs.github.io/) support to Angular.
1586 * @see {@link HammerGestureConfig}
1587 *
1588 * @ngModule HammerModule
1589 * @publicApi
1590 */
1591const HAMMER_GESTURE_CONFIG = new InjectionToken('HammerGestureConfig');
1592/**
1593 * Injection token used to provide a {@link HammerLoader} to Angular.
1594 *
1595 * @publicApi
1596 */
1597const HAMMER_LOADER = new InjectionToken('HammerLoader');
1598/**
1599 * An injectable [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
1600 * for gesture recognition. Configures specific event recognition.
1601 * @publicApi
1602 */
1603class HammerGestureConfig {
1604 constructor() {
1605 /**
1606 * A set of supported event names for gestures to be used in Angular.
1607 * Angular supports all built-in recognizers, as listed in
1608 * [HammerJS documentation](https://hammerjs.github.io/).
1609 */
1610 this.events = [];
1611 /**
1612 * Maps gesture event names to a set of configuration options
1613 * that specify overrides to the default values for specific properties.
1614 *
1615 * The key is a supported event name to be configured,
1616 * and the options object contains a set of properties, with override values
1617 * to be applied to the named recognizer event.
1618 * For example, to disable recognition of the rotate event, specify
1619 * `{"rotate": {"enable": false}}`.
1620 *
1621 * Properties that are not present take the HammerJS default values.
1622 * For information about which properties are supported for which events,
1623 * and their allowed and default values, see
1624 * [HammerJS documentation](https://hammerjs.github.io/).
1625 *
1626 */
1627 this.overrides = {};
1628 }
1629 /**
1630 * Creates a [HammerJS Manager](https://hammerjs.github.io/api/#hammermanager)
1631 * and attaches it to a given HTML element.
1632 * @param element The element that will recognize gestures.
1633 * @returns A HammerJS event-manager object.
1634 */
1635 buildHammer(element) {
1636 const mc = new Hammer(element, this.options);
1637 mc.get('pinch').set({ enable: true });
1638 mc.get('rotate').set({ enable: true });
1639 for (const eventName in this.overrides) {
1640 mc.get(eventName).set(this.overrides[eventName]);
1641 }
1642 return mc;
1643 }
1644 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerGestureConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1645 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerGestureConfig }); }
1646}
1647i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerGestureConfig, decorators: [{
1648 type: Injectable
1649 }] });
1650/**
1651 * Event plugin that adds Hammer support to an application.
1652 *
1653 * @ngModule HammerModule
1654 */
1655class HammerGesturesPlugin extends EventManagerPlugin {
1656 constructor(doc, _config, console, loader) {
1657 super(doc);
1658 this._config = _config;
1659 this.console = console;
1660 this.loader = loader;
1661 this._loaderPromise = null;
1662 }
1663 supports(eventName) {
1664 if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
1665 return false;
1666 }
1667 if (!window.Hammer && !this.loader) {
1668 if (typeof ngDevMode === 'undefined' || ngDevMode) {
1669 this.console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not ` +
1670 `loaded and no custom loader has been specified.`);
1671 }
1672 return false;
1673 }
1674 return true;
1675 }
1676 addEventListener(element, eventName, handler) {
1677 const zone = this.manager.getZone();
1678 eventName = eventName.toLowerCase();
1679 // If Hammer is not present but a loader is specified, we defer adding the event listener
1680 // until Hammer is loaded.
1681 if (!window.Hammer && this.loader) {
1682 this._loaderPromise = this._loaderPromise || zone.runOutsideAngular(() => this.loader());
1683 // This `addEventListener` method returns a function to remove the added listener.
1684 // Until Hammer is loaded, the returned function needs to *cancel* the registration rather
1685 // than remove anything.
1686 let cancelRegistration = false;
1687 let deregister = () => {
1688 cancelRegistration = true;
1689 };
1690 zone.runOutsideAngular(() => this._loaderPromise
1691 .then(() => {
1692 // If Hammer isn't actually loaded when the custom loader resolves, give up.
1693 if (!window.Hammer) {
1694 if (typeof ngDevMode === 'undefined' || ngDevMode) {
1695 this.console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
1696 }
1697 deregister = () => { };
1698 return;
1699 }
1700 if (!cancelRegistration) {
1701 // Now that Hammer is loaded and the listener is being loaded for real,
1702 // the deregistration function changes from canceling registration to
1703 // removal.
1704 deregister = this.addEventListener(element, eventName, handler);
1705 }
1706 })
1707 .catch(() => {
1708 if (typeof ngDevMode === 'undefined' || ngDevMode) {
1709 this.console.warn(`The "${eventName}" event cannot be bound because the custom ` +
1710 `Hammer.JS loader failed.`);
1711 }
1712 deregister = () => { };
1713 }));
1714 // Return a function that *executes* `deregister` (and not `deregister` itself) so that we
1715 // can change the behavior of `deregister` once the listener is added. Using a closure in
1716 // this way allows us to avoid any additional data structures to track listener removal.
1717 return () => {
1718 deregister();
1719 };
1720 }
1721 return zone.runOutsideAngular(() => {
1722 // Creating the manager bind events, must be done outside of angular
1723 const mc = this._config.buildHammer(element);
1724 const callback = function (eventObj) {
1725 zone.runGuarded(function () {
1726 handler(eventObj);
1727 });
1728 };
1729 mc.on(eventName, callback);
1730 return () => {
1731 mc.off(eventName, callback);
1732 // destroy mc to prevent memory leak
1733 if (typeof mc.destroy === 'function') {
1734 mc.destroy();
1735 }
1736 };
1737 });
1738 }
1739 isCustomEvent(eventName) {
1740 return this._config.events.indexOf(eventName) > -1;
1741 }
1742 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerGesturesPlugin, deps: [{ token: DOCUMENT }, { token: HAMMER_GESTURE_CONFIG }, { token: i0.ɵConsole }, { token: HAMMER_LOADER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1743 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerGesturesPlugin }); }
1744}
1745i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerGesturesPlugin, decorators: [{
1746 type: Injectable
1747 }], ctorParameters: () => [{ type: undefined, decorators: [{
1748 type: Inject,
1749 args: [DOCUMENT]
1750 }] }, { type: HammerGestureConfig, decorators: [{
1751 type: Inject,
1752 args: [HAMMER_GESTURE_CONFIG]
1753 }] }, { type: i0.ɵConsole }, { type: undefined, decorators: [{
1754 type: Optional
1755 }, {
1756 type: Inject,
1757 args: [HAMMER_LOADER]
1758 }] }] });
1759/**
1760 * Adds support for HammerJS.
1761 *
1762 * Import this module at the root of your application so that Angular can work with
1763 * HammerJS to detect gesture events.
1764 *
1765 * Note that applications still need to include the HammerJS script itself. This module
1766 * simply sets up the coordination layer between HammerJS and Angular's `EventManager`.
1767 *
1768 * @publicApi
1769 */
1770class HammerModule {
1771 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1772 static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.7", ngImport: i0, type: HammerModule }); }
1773 static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerModule, providers: [
1774 {
1775 provide: EVENT_MANAGER_PLUGINS,
1776 useClass: HammerGesturesPlugin,
1777 multi: true,
1778 deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, ɵConsole, [new Optional(), HAMMER_LOADER]]
1779 },
1780 { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
1781 ] }); }
1782}
1783i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: HammerModule, decorators: [{
1784 type: NgModule,
1785 args: [{
1786 providers: [
1787 {
1788 provide: EVENT_MANAGER_PLUGINS,
1789 useClass: HammerGesturesPlugin,
1790 multi: true,
1791 deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, ɵConsole, [new Optional(), HAMMER_LOADER]]
1792 },
1793 { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
1794 ]
1795 }]
1796 }] });
1797
1798/**
1799 * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
1800 * values to be safe to use in the different DOM contexts.
1801 *
1802 * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
1803 * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
1804 * the website.
1805 *
1806 * In specific situations, it might be necessary to disable sanitization, for example if the
1807 * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
1808 * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
1809 * methods, and then binding to that value from the template.
1810 *
1811 * These situations should be very rare, and extraordinary care must be taken to avoid creating a
1812 * Cross Site Scripting (XSS) security bug!
1813 *
1814 * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
1815 * close as possible to the source of the value, to make it easy to verify no security bug is
1816 * created by its use.
1817 *
1818 * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
1819 * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
1820 * code. The sanitizer leaves safe values intact.
1821 *
1822 * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
1823 * sanitization for the value passed in. Carefully check and audit all values and code paths going
1824 * into this call. Make sure any user data is appropriately escaped for this security context.
1825 * For more detail, see the [Security Guide](https://g.co/ng/security).
1826 *
1827 * @publicApi
1828 */
1829class DomSanitizer {
1830 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomSanitizer, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1831 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomSanitizer, providedIn: 'root', useExisting: i0.forwardRef(() => DomSanitizerImpl) }); }
1832}
1833i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomSanitizer, decorators: [{
1834 type: Injectable,
1835 args: [{ providedIn: 'root', useExisting: forwardRef(() => DomSanitizerImpl) }]
1836 }] });
1837class DomSanitizerImpl extends DomSanitizer {
1838 constructor(_doc) {
1839 super();
1840 this._doc = _doc;
1841 }
1842 sanitize(ctx, value) {
1843 if (value == null)
1844 return null;
1845 switch (ctx) {
1846 case SecurityContext.NONE:
1847 return value;
1848 case SecurityContext.HTML:
1849 if (ɵallowSanitizationBypassAndThrow(value, "HTML" /* BypassType.Html */)) {
1850 return ɵunwrapSafeValue(value);
1851 }
1852 return ɵ_sanitizeHtml(this._doc, String(value)).toString();
1853 case SecurityContext.STYLE:
1854 if (ɵallowSanitizationBypassAndThrow(value, "Style" /* BypassType.Style */)) {
1855 return ɵunwrapSafeValue(value);
1856 }
1857 return value;
1858 case SecurityContext.SCRIPT:
1859 if (ɵallowSanitizationBypassAndThrow(value, "Script" /* BypassType.Script */)) {
1860 return ɵunwrapSafeValue(value);
1861 }
1862 throw new ɵRuntimeError(5200 /* RuntimeErrorCode.SANITIZATION_UNSAFE_SCRIPT */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
1863 'unsafe value used in a script context');
1864 case SecurityContext.URL:
1865 if (ɵallowSanitizationBypassAndThrow(value, "URL" /* BypassType.Url */)) {
1866 return ɵunwrapSafeValue(value);
1867 }
1868 return ɵ_sanitizeUrl(String(value));
1869 case SecurityContext.RESOURCE_URL:
1870 if (ɵallowSanitizationBypassAndThrow(value, "ResourceURL" /* BypassType.ResourceUrl */)) {
1871 return ɵunwrapSafeValue(value);
1872 }
1873 throw new ɵRuntimeError(5201 /* RuntimeErrorCode.SANITIZATION_UNSAFE_RESOURCE_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
1874 `unsafe value used in a resource URL context (see ${ɵXSS_SECURITY_URL})`);
1875 default:
1876 throw new ɵRuntimeError(5202 /* RuntimeErrorCode.SANITIZATION_UNEXPECTED_CTX */, (typeof ngDevMode === 'undefined' || ngDevMode) &&
1877 `Unexpected SecurityContext ${ctx} (see ${ɵXSS_SECURITY_URL})`);
1878 }
1879 }
1880 bypassSecurityTrustHtml(value) {
1881 return ɵbypassSanitizationTrustHtml(value);
1882 }
1883 bypassSecurityTrustStyle(value) {
1884 return ɵbypassSanitizationTrustStyle(value);
1885 }
1886 bypassSecurityTrustScript(value) {
1887 return ɵbypassSanitizationTrustScript(value);
1888 }
1889 bypassSecurityTrustUrl(value) {
1890 return ɵbypassSanitizationTrustUrl(value);
1891 }
1892 bypassSecurityTrustResourceUrl(value) {
1893 return ɵbypassSanitizationTrustResourceUrl(value);
1894 }
1895 static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomSanitizerImpl, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
1896 static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomSanitizerImpl, providedIn: 'root' }); }
1897}
1898i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.7", ngImport: i0, type: DomSanitizerImpl, decorators: [{
1899 type: Injectable,
1900 args: [{ providedIn: 'root' }]
1901 }], ctorParameters: () => [{ type: undefined, decorators: [{
1902 type: Inject,
1903 args: [DOCUMENT]
1904 }] }] });
1905
1906/**
1907 * The list of features as an enum to uniquely type each `HydrationFeature`.
1908 * @see {@link HydrationFeature}
1909 *
1910 * @publicApi
1911 */
1912var HydrationFeatureKind;
1913(function (HydrationFeatureKind) {
1914 HydrationFeatureKind[HydrationFeatureKind["NoHttpTransferCache"] = 0] = "NoHttpTransferCache";
1915 HydrationFeatureKind[HydrationFeatureKind["HttpTransferCacheOptions"] = 1] = "HttpTransferCacheOptions";
1916})(HydrationFeatureKind || (HydrationFeatureKind = {}));
1917/**
1918 * Helper function to create an object that represents a Hydration feature.
1919 */
1920function hydrationFeature(ɵkind, ɵproviders = [], ɵoptions = {}) {
1921 return { ɵkind, ɵproviders };
1922}
1923/**
1924 * Disables HTTP transfer cache. Effectively causes HTTP requests to be performed twice: once on the
1925 * server and other one on the browser.
1926 *
1927 * @publicApi
1928 */
1929function withNoHttpTransferCache() {
1930 // This feature has no providers and acts as a flag that turns off
1931 // HTTP transfer cache (which otherwise is turned on by default).
1932 return hydrationFeature(HydrationFeatureKind.NoHttpTransferCache);
1933}
1934/**
1935 * The function accepts a an object, which allows to configure cache parameters,
1936 * such as which headers should be included (no headers are included by default),
1937 * wether POST requests should be cached or a callback function to determine if a
1938 * particular request should be cached.
1939 *
1940 * @publicApi
1941 */
1942function withHttpTransferCacheOptions(options) {
1943 // This feature has no providers and acts as a flag to pass options to the HTTP transfer cache.
1944 return hydrationFeature(HydrationFeatureKind.HttpTransferCacheOptions, ɵwithHttpTransferCache(options));
1945}
1946/**
1947 * Returns an `ENVIRONMENT_INITIALIZER` token setup with a function
1948 * that verifies whether compatible ZoneJS was used in an application
1949 * and logs a warning in a console if it's not the case.
1950 */
1951function provideZoneJsCompatibilityDetector() {
1952 return [{
1953 provide: ENVIRONMENT_INITIALIZER,
1954 useValue: () => {
1955 const ngZone = inject(NgZone);
1956 // Checking `ngZone instanceof NgZone` would be insufficient here,
1957 // because custom implementations might use NgZone as a base class.
1958 if (ngZone.constructor !== NgZone) {
1959 const console = inject(ɵConsole);
1960 const message = ɵformatRuntimeError(-5000 /* RuntimeErrorCode.UNSUPPORTED_ZONEJS_INSTANCE */, 'Angular detected that hydration was enabled for an application ' +
1961 'that uses a custom or a noop Zone.js implementation. ' +
1962 'This is not yet a fully supported configuration.');
1963 // tslint:disable-next-line:no-console
1964 console.warn(message);
1965 }
1966 },
1967 multi: true,
1968 }];
1969}
1970/**
1971 * Sets up providers necessary to enable hydration functionality for the application.
1972 *
1973 * By default, the function enables the recommended set of features for the optimal
1974 * performance for most of the applications. It includes the following features:
1975 *
1976 * * Reconciling DOM hydration. Learn more about it [here](guide/hydration).
1977 * * [`HttpClient`](api/common/http/HttpClient) response caching while running on the server and
1978 * transferring this cache to the client to avoid extra HTTP requests. Learn more about data caching
1979 * [here](/guide/ssr#caching-data-when-using-httpclient).
1980 *
1981 * These functions allow you to disable some of the default features or configure features
1982 * * {@link withNoHttpTransferCache} to disable HTTP transfer cache
1983 * * {@link withHttpTransferCacheOptions} to configure some HTTP transfer cache options
1984 *
1985 * @usageNotes
1986 *
1987 * Basic example of how you can enable hydration in your application when
1988 * `bootstrapApplication` function is used:
1989 * ```
1990 * bootstrapApplication(AppComponent, {
1991 * providers: [provideClientHydration()]
1992 * });
1993 * ```
1994 *
1995 * Alternatively if you are using NgModules, you would add `provideClientHydration`
1996 * to your root app module's provider list.
1997 * ```
1998 * @NgModule({
1999 * declarations: [RootCmp],
2000 * bootstrap: [RootCmp],
2001 * providers: [provideClientHydration()],
2002 * })
2003 * export class AppModule {}
2004 * ```
2005 *
2006 * @see {@link withNoHttpTransferCache}
2007 * @see {@link withHttpTransferCacheOptions}
2008 *
2009 * @param features Optional features to configure additional router behaviors.
2010 * @returns A set of providers to enable hydration.
2011 *
2012 * @publicApi
2013 */
2014function provideClientHydration(...features) {
2015 const providers = [];
2016 const featuresKind = new Set();
2017 const hasHttpTransferCacheOptions = featuresKind.has(HydrationFeatureKind.HttpTransferCacheOptions);
2018 for (const { ɵproviders, ɵkind } of features) {
2019 featuresKind.add(ɵkind);
2020 if (ɵproviders.length) {
2021 providers.push(ɵproviders);
2022 }
2023 }
2024 if (typeof ngDevMode !== 'undefined' && ngDevMode &&
2025 featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) && hasHttpTransferCacheOptions) {
2026 // TODO: Make this a runtime error
2027 throw new Error('Configuration error: found both withHttpTransferCacheOptions() and withNoHttpTransferCache() in the same call to provideClientHydration(), which is a contradiction.');
2028 }
2029 return makeEnvironmentProviders([
2030 (typeof ngDevMode !== 'undefined' && ngDevMode) ? provideZoneJsCompatibilityDetector() : [],
2031 ɵwithDomHydration(),
2032 ((featuresKind.has(HydrationFeatureKind.NoHttpTransferCache) || hasHttpTransferCacheOptions) ?
2033 [] :
2034 ɵwithHttpTransferCache({})),
2035 providers,
2036 ]);
2037}
2038
2039/**
2040 * @module
2041 * @description
2042 * Entry point for all public APIs of the platform-browser package.
2043 */
2044/**
2045 * @publicApi
2046 */
2047const VERSION = new Version('17.3.7');
2048
2049// Re-export TransferState to the public API of the `platform-browser` for backwards-compatibility.
2050/**
2051 * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
2052 *
2053 * Example:
2054 *
2055 * ```
2056 * const COUNTER_KEY = makeStateKey<number>('counter');
2057 * let value = 10;
2058 *
2059 * transferState.set(COUNTER_KEY, value);
2060 * ```
2061 *
2062 * @publicApi
2063 * @deprecated `makeStateKey` has moved, please import `makeStateKey` from `@angular/core` instead.
2064 */
2065// The below is a workaround to add a deprecated message.
2066const makeStateKey = makeStateKey$1;
2067// The below type is needed for G3 due to JSC_CONFORMANCE_VIOLATION.
2068const TransferState = TransferState$1;
2069
2070/**
2071 * @module
2072 * @description
2073 * Entry point for all public APIs of this package.
2074 */
2075// This file only reexports content of the `src` folder. Keep it that way.
2076
2077// This file is not used to build this module. It is only used during editing
2078
2079/**
2080 * Generated bundle index. Do not edit.
2081 */
2082
2083export { BrowserModule, By, DomSanitizer, EVENT_MANAGER_PLUGINS, EventManager, EventManagerPlugin, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, HammerModule, HydrationFeatureKind, Meta, REMOVE_STYLES_ON_COMPONENT_DESTROY, Title, TransferState, VERSION, bootstrapApplication, createApplication, disableDebugTools, enableDebugTools, makeStateKey, platformBrowser, provideClientHydration, provideProtractorTestingSupport, withHttpTransferCacheOptions, withNoHttpTransferCache, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserGetTestability as ɵBrowserGetTestability, DomEventsPlugin as ɵDomEventsPlugin, DomRendererFactory2 as ɵDomRendererFactory2, DomSanitizerImpl as ɵDomSanitizerImpl, HammerGesturesPlugin as ɵHammerGesturesPlugin, INTERNAL_BROWSER_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS, KeyEventsPlugin as ɵKeyEventsPlugin, SharedStylesHost as ɵSharedStylesHost, initDomAdapter as ɵinitDomAdapter };
2084//# sourceMappingURL=platform-browser.mjs.map