@angular/platform-browser 13.0.0-next.7 → 13.0.0-rc.1

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