source: trip-planner-front/node_modules/@angular/platform-browser/__ivy_ngcc__/fesm2015/platform-browser.js@ e29cc2e

Last change on this file since e29cc2e was e29cc2e, checked in by Ema <ema_spirova@…>, 3 years ago

primeNG components

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