1 |
|
2 |
|
3 |
|
4 |
|
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, Inject, ViewEncapsulation, APP_ID, RendererStyleFlags2, ErrorHandler, ɵsetDocument, PLATFORM_ID, PLATFORM_INITIALIZER, createPlatformFactory, platformCore, ɵINJECTOR_SCOPE, NgZone, RendererFactory2, Testability, ApplicationModule, NgModule, Optional, SkipSelf, ɵɵinject, ApplicationRef, ɵConsole, forwardRef, SecurityContext, ɵallowSanitizationBypassAndThrow, ɵunwrapSafeValue, ɵgetSanitizationBypassType, ɵ_sanitizeUrl, ɵ_sanitizeHtml, ɵbypassSanitizationTrustHtml, ɵbypassSanitizationTrustStyle, ɵbypassSanitizationTrustScript, ɵbypassSanitizationTrustUrl, ɵbypassSanitizationTrustResourceUrl, Version } from '@angular/core';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | class GenericBrowserDomAdapter extends ɵDomAdapter {
|
26 | constructor() {
|
27 | super(...arguments);
|
28 | this.supportsDOMEvents = true;
|
29 | }
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
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 |
|
53 |
|
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 |
|
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 |
|
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 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 | const TRANSITION_ID = new InjectionToken('TRANSITION_ID');
|
135 | function appInitializerFactory(transitionId, document, injector) {
|
136 | return () => {
|
137 |
|
138 |
|
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 |
|
159 |
|
160 |
|
161 |
|
162 |
|
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 |
|
218 |
|
219 | class BrowserXhr {
|
220 | build() {
|
221 | return new XMLHttpRequest();
|
222 | }
|
223 | }
|
224 | BrowserXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
225 | BrowserXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserXhr });
|
226 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserXhr, decorators: [{
|
227 | type: Injectable
|
228 | }] });
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 | const EVENT_MANAGER_PLUGINS = new InjectionToken('EventManagerPlugins');
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 | class EventManager {
|
250 | |
251 |
|
252 |
|
253 | constructor(plugins, _zone) {
|
254 | this._zone = _zone;
|
255 | this._eventNameToPlugin = new Map();
|
256 | plugins.forEach(p => p.manager = this);
|
257 | this._plugins = plugins.slice().reverse();
|
258 | }
|
259 | |
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | addEventListener(element, eventName, handler) {
|
269 | const plugin = this._findPluginFor(eventName);
|
270 | return plugin.addEventListener(element, eventName, handler);
|
271 | }
|
272 | |
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | addGlobalEventListener(target, eventName, handler) {
|
283 | const plugin = this._findPluginFor(eventName);
|
284 | return plugin.addGlobalEventListener(target, eventName, handler);
|
285 | }
|
286 | |
287 |
|
288 |
|
289 | getZone() {
|
290 | return this._zone;
|
291 | }
|
292 |
|
293 | _findPluginFor(eventName) {
|
294 | const plugin = this._eventNameToPlugin.get(eventName);
|
295 | if (plugin) {
|
296 | return plugin;
|
297 | }
|
298 | const plugins = this._plugins;
|
299 | for (let i = 0; i < plugins.length; i++) {
|
300 | const plugin = plugins[i];
|
301 | if (plugin.supports(eventName)) {
|
302 | this._eventNameToPlugin.set(eventName, plugin);
|
303 | return plugin;
|
304 | }
|
305 | }
|
306 | throw new Error(`No event manager plugin found for event ${eventName}`);
|
307 | }
|
308 | }
|
309 | EventManager.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: EventManager, deps: [{ token: EVENT_MANAGER_PLUGINS }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
|
310 | EventManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: EventManager });
|
311 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: EventManager, decorators: [{
|
312 | type: Injectable
|
313 | }], ctorParameters: function () {
|
314 | return [{ type: undefined, decorators: [{
|
315 | type: Inject,
|
316 | args: [EVENT_MANAGER_PLUGINS]
|
317 | }] }, { type: i0.NgZone }];
|
318 | } });
|
319 | class EventManagerPlugin {
|
320 | constructor(_doc) {
|
321 | this._doc = _doc;
|
322 | }
|
323 | addGlobalEventListener(element, eventName, handler) {
|
324 | const target = ɵgetDOM().getGlobalEventTarget(this._doc, element);
|
325 | if (!target) {
|
326 | throw new Error(`Unsupported event target ${target} for event ${eventName}`);
|
327 | }
|
328 | return this.addEventListener(target, eventName, handler);
|
329 | }
|
330 | }
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 | class SharedStylesHost {
|
340 | constructor() {
|
341 |
|
342 | this._stylesSet = new Set();
|
343 | }
|
344 | addStyles(styles) {
|
345 | const additions = new Set();
|
346 | styles.forEach(style => {
|
347 | if (!this._stylesSet.has(style)) {
|
348 | this._stylesSet.add(style);
|
349 | additions.add(style);
|
350 | }
|
351 | });
|
352 | this.onStylesAdded(additions);
|
353 | }
|
354 | onStylesAdded(additions) { }
|
355 | getAllStyles() {
|
356 | return Array.from(this._stylesSet);
|
357 | }
|
358 | }
|
359 | SharedStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SharedStylesHost, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
360 | SharedStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SharedStylesHost });
|
361 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SharedStylesHost, decorators: [{
|
362 | type: Injectable
|
363 | }] });
|
364 | class DomSharedStylesHost extends SharedStylesHost {
|
365 | constructor(_doc) {
|
366 | super();
|
367 | this._doc = _doc;
|
368 |
|
369 | this._hostNodes = new Map();
|
370 | this._hostNodes.set(_doc.head, []);
|
371 | }
|
372 | _addStylesToHost(styles, host, styleNodes) {
|
373 | styles.forEach((style) => {
|
374 | const styleEl = this._doc.createElement('style');
|
375 | styleEl.textContent = style;
|
376 | styleNodes.push(host.appendChild(styleEl));
|
377 | });
|
378 | }
|
379 | addHost(hostNode) {
|
380 | const styleNodes = [];
|
381 | this._addStylesToHost(this._stylesSet, hostNode, styleNodes);
|
382 | this._hostNodes.set(hostNode, styleNodes);
|
383 | }
|
384 | removeHost(hostNode) {
|
385 | const styleNodes = this._hostNodes.get(hostNode);
|
386 | if (styleNodes) {
|
387 | styleNodes.forEach(removeStyle);
|
388 | }
|
389 | this._hostNodes.delete(hostNode);
|
390 | }
|
391 | onStylesAdded(additions) {
|
392 | this._hostNodes.forEach((styleNodes, hostNode) => {
|
393 | this._addStylesToHost(additions, hostNode, styleNodes);
|
394 | });
|
395 | }
|
396 | ngOnDestroy() {
|
397 | this._hostNodes.forEach(styleNodes => styleNodes.forEach(removeStyle));
|
398 | }
|
399 | }
|
400 | DomSharedStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSharedStylesHost, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
401 | DomSharedStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSharedStylesHost });
|
402 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSharedStylesHost, decorators: [{
|
403 | type: Injectable
|
404 | }], ctorParameters: function () {
|
405 | return [{ type: undefined, decorators: [{
|
406 | type: Inject,
|
407 | args: [DOCUMENT]
|
408 | }] }];
|
409 | } });
|
410 | function removeStyle(styleNode) {
|
411 | ɵgetDOM().remove(styleNode);
|
412 | }
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 | const NAMESPACE_URIS = {
|
422 | 'svg': 'http://www.w3.org/2000/svg',
|
423 | 'xhtml': 'http://www.w3.org/1999/xhtml',
|
424 | 'xlink': 'http://www.w3.org/1999/xlink',
|
425 | 'xml': 'http://www.w3.org/XML/1998/namespace',
|
426 | 'xmlns': 'http://www.w3.org/2000/xmlns/',
|
427 | };
|
428 | const COMPONENT_REGEX = /%COMP%/g;
|
429 | const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
430 | const COMPONENT_VARIABLE = '%COMP%';
|
431 | const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
|
432 | const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
|
433 | function shimContentAttribute(componentShortId) {
|
434 | return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
435 | }
|
436 | function shimHostAttribute(componentShortId) {
|
437 | return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
438 | }
|
439 | function flattenStyles(compId, styles, target) {
|
440 | for (let i = 0; i < styles.length; i++) {
|
441 | let style = styles[i];
|
442 | if (Array.isArray(style)) {
|
443 | flattenStyles(compId, style, target);
|
444 | }
|
445 | else {
|
446 | style = style.replace(COMPONENT_REGEX, compId);
|
447 | target.push(style);
|
448 | }
|
449 | }
|
450 | return target;
|
451 | }
|
452 | function decoratePreventDefault(eventHandler) {
|
453 |
|
454 |
|
455 |
|
456 |
|
457 | return (event) => {
|
458 |
|
459 |
|
460 |
|
461 |
|
462 | if (event === '__ngUnwrap__') {
|
463 | return eventHandler;
|
464 | }
|
465 | const allowDefaultBehavior = eventHandler(event);
|
466 | if (allowDefaultBehavior === false) {
|
467 |
|
468 | event.preventDefault();
|
469 | event.returnValue = false;
|
470 | }
|
471 | return undefined;
|
472 | };
|
473 | }
|
474 | let hasLoggedNativeEncapsulationWarning = false;
|
475 | class DomRendererFactory2 {
|
476 | constructor(eventManager, sharedStylesHost, appId) {
|
477 | this.eventManager = eventManager;
|
478 | this.sharedStylesHost = sharedStylesHost;
|
479 | this.appId = appId;
|
480 | this.rendererByCompId = new Map();
|
481 | this.defaultRenderer = new DefaultDomRenderer2(eventManager);
|
482 | }
|
483 | createRenderer(element, type) {
|
484 | if (!element || !type) {
|
485 | return this.defaultRenderer;
|
486 | }
|
487 | switch (type.encapsulation) {
|
488 | case ViewEncapsulation.Emulated: {
|
489 | let renderer = this.rendererByCompId.get(type.id);
|
490 | if (!renderer) {
|
491 | renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId);
|
492 | this.rendererByCompId.set(type.id, renderer);
|
493 | }
|
494 | renderer.applyToHost(element);
|
495 | return renderer;
|
496 | }
|
497 |
|
498 |
|
499 | case 1:
|
500 | case ViewEncapsulation.ShadowDom:
|
501 |
|
502 | if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
503 |
|
504 |
|
505 |
|
506 | !hasLoggedNativeEncapsulationWarning && type.encapsulation === 1) {
|
507 | hasLoggedNativeEncapsulationWarning = true;
|
508 | console.warn('ViewEncapsulation.Native is no longer supported. Falling back to ViewEncapsulation.ShadowDom. The fallback will be removed in v12.');
|
509 | }
|
510 | return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
|
511 | default: {
|
512 | if (!this.rendererByCompId.has(type.id)) {
|
513 | const styles = flattenStyles(type.id, type.styles, []);
|
514 | this.sharedStylesHost.addStyles(styles);
|
515 | this.rendererByCompId.set(type.id, this.defaultRenderer);
|
516 | }
|
517 | return this.defaultRenderer;
|
518 | }
|
519 | }
|
520 | }
|
521 | begin() { }
|
522 | end() { }
|
523 | }
|
524 | DomRendererFactory2.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomRendererFactory2, deps: [{ token: EventManager }, { token: DomSharedStylesHost }, { token: APP_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
525 | DomRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomRendererFactory2 });
|
526 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomRendererFactory2, decorators: [{
|
527 | type: Injectable
|
528 | }], ctorParameters: function () {
|
529 | return [{ type: EventManager }, { type: DomSharedStylesHost }, { type: undefined, decorators: [{
|
530 | type: Inject,
|
531 | args: [APP_ID]
|
532 | }] }];
|
533 | } });
|
534 | class DefaultDomRenderer2 {
|
535 | constructor(eventManager) {
|
536 | this.eventManager = eventManager;
|
537 | this.data = Object.create(null);
|
538 | this.destroyNode = null;
|
539 | }
|
540 | destroy() { }
|
541 | createElement(name, namespace) {
|
542 | if (namespace) {
|
543 |
|
544 |
|
545 | return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
|
546 | }
|
547 | return document.createElement(name);
|
548 | }
|
549 | createComment(value) {
|
550 | return document.createComment(value);
|
551 | }
|
552 | createText(value) {
|
553 | return document.createTextNode(value);
|
554 | }
|
555 | appendChild(parent, newChild) {
|
556 | parent.appendChild(newChild);
|
557 | }
|
558 | insertBefore(parent, newChild, refChild) {
|
559 | if (parent) {
|
560 | parent.insertBefore(newChild, refChild);
|
561 | }
|
562 | }
|
563 | removeChild(parent, oldChild) {
|
564 | if (parent) {
|
565 | parent.removeChild(oldChild);
|
566 | }
|
567 | }
|
568 | selectRootElement(selectorOrNode, preserveContent) {
|
569 | let el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
|
570 | selectorOrNode;
|
571 | if (!el) {
|
572 | throw new Error(`The selector "${selectorOrNode}" did not match any elements`);
|
573 | }
|
574 | if (!preserveContent) {
|
575 | el.textContent = '';
|
576 | }
|
577 | return el;
|
578 | }
|
579 | parentNode(node) {
|
580 | return node.parentNode;
|
581 | }
|
582 | nextSibling(node) {
|
583 | return node.nextSibling;
|
584 | }
|
585 | setAttribute(el, name, value, namespace) {
|
586 | if (namespace) {
|
587 | name = namespace + ':' + name;
|
588 |
|
589 |
|
590 | const namespaceUri = NAMESPACE_URIS[namespace];
|
591 | if (namespaceUri) {
|
592 | el.setAttributeNS(namespaceUri, name, value);
|
593 | }
|
594 | else {
|
595 | el.setAttribute(name, value);
|
596 | }
|
597 | }
|
598 | else {
|
599 | el.setAttribute(name, value);
|
600 | }
|
601 | }
|
602 | removeAttribute(el, name, namespace) {
|
603 | if (namespace) {
|
604 |
|
605 |
|
606 | const namespaceUri = NAMESPACE_URIS[namespace];
|
607 | if (namespaceUri) {
|
608 | el.removeAttributeNS(namespaceUri, name);
|
609 | }
|
610 | else {
|
611 |
|
612 |
|
613 |
|
614 | el.removeAttribute(`${namespace}:${name}`);
|
615 | }
|
616 | }
|
617 | else {
|
618 | el.removeAttribute(name);
|
619 | }
|
620 | }
|
621 | addClass(el, name) {
|
622 | el.classList.add(name);
|
623 | }
|
624 | removeClass(el, name) {
|
625 | el.classList.remove(name);
|
626 | }
|
627 | setStyle(el, style, value, flags) {
|
628 | if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {
|
629 | el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? 'important' : '');
|
630 | }
|
631 | else {
|
632 | el.style[style] = value;
|
633 | }
|
634 | }
|
635 | removeStyle(el, style, flags) {
|
636 | if (flags & RendererStyleFlags2.DashCase) {
|
637 | el.style.removeProperty(style);
|
638 | }
|
639 | else {
|
640 |
|
641 |
|
642 | el.style[style] = '';
|
643 | }
|
644 | }
|
645 | setProperty(el, name, value) {
|
646 | NG_DEV_MODE && checkNoSyntheticProp(name, 'property');
|
647 | el[name] = value;
|
648 | }
|
649 | setValue(node, value) {
|
650 | node.nodeValue = value;
|
651 | }
|
652 | listen(target, event, callback) {
|
653 | NG_DEV_MODE && checkNoSyntheticProp(event, 'listener');
|
654 | if (typeof target === 'string') {
|
655 | return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
|
656 | }
|
657 | return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
|
658 | }
|
659 | }
|
660 | const AT_CHARCODE = (() => '@'.charCodeAt(0))();
|
661 | function checkNoSyntheticProp(name, nameKind) {
|
662 | if (name.charCodeAt(0) === AT_CHARCODE) {
|
663 | throw new Error(`Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
|
664 | - Either \`BrowserAnimationsModule\` or \`NoopAnimationsModule\` are imported in your application.
|
665 | - 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).`);
|
666 | }
|
667 | }
|
668 | class EmulatedEncapsulationDomRenderer2 extends DefaultDomRenderer2 {
|
669 | constructor(eventManager, sharedStylesHost, component, appId) {
|
670 | super(eventManager);
|
671 | this.component = component;
|
672 | const styles = flattenStyles(appId + '-' + component.id, component.styles, []);
|
673 | sharedStylesHost.addStyles(styles);
|
674 | this.contentAttr = shimContentAttribute(appId + '-' + component.id);
|
675 | this.hostAttr = shimHostAttribute(appId + '-' + component.id);
|
676 | }
|
677 | applyToHost(element) {
|
678 | super.setAttribute(element, this.hostAttr, '');
|
679 | }
|
680 | createElement(parent, name) {
|
681 | const el = super.createElement(parent, name);
|
682 | super.setAttribute(el, this.contentAttr, '');
|
683 | return el;
|
684 | }
|
685 | }
|
686 | class ShadowDomRenderer extends DefaultDomRenderer2 {
|
687 | constructor(eventManager, sharedStylesHost, hostEl, component) {
|
688 | super(eventManager);
|
689 | this.sharedStylesHost = sharedStylesHost;
|
690 | this.hostEl = hostEl;
|
691 | this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
|
692 | this.sharedStylesHost.addHost(this.shadowRoot);
|
693 | const styles = flattenStyles(component.id, component.styles, []);
|
694 | for (let i = 0; i < styles.length; i++) {
|
695 | const styleEl = document.createElement('style');
|
696 | styleEl.textContent = styles[i];
|
697 | this.shadowRoot.appendChild(styleEl);
|
698 | }
|
699 | }
|
700 | nodeOrShadowRoot(node) {
|
701 | return node === this.hostEl ? this.shadowRoot : node;
|
702 | }
|
703 | destroy() {
|
704 | this.sharedStylesHost.removeHost(this.shadowRoot);
|
705 | }
|
706 | appendChild(parent, newChild) {
|
707 | return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
|
708 | }
|
709 | insertBefore(parent, newChild, refChild) {
|
710 | return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
|
711 | }
|
712 | removeChild(parent, oldChild) {
|
713 | return super.removeChild(this.nodeOrShadowRoot(parent), oldChild);
|
714 | }
|
715 | parentNode(node) {
|
716 | return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
|
717 | }
|
718 | }
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 | class DomEventsPlugin extends EventManagerPlugin {
|
728 | constructor(doc) {
|
729 | super(doc);
|
730 | }
|
731 |
|
732 |
|
733 | supports(eventName) {
|
734 | return true;
|
735 | }
|
736 | addEventListener(element, eventName, handler) {
|
737 | element.addEventListener(eventName, handler, false);
|
738 | return () => this.removeEventListener(element, eventName, handler);
|
739 | }
|
740 | removeEventListener(target, eventName, callback) {
|
741 | return target.removeEventListener(eventName, callback);
|
742 | }
|
743 | }
|
744 | DomEventsPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
745 | DomEventsPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomEventsPlugin });
|
746 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomEventsPlugin, decorators: [{
|
747 | type: Injectable
|
748 | }], ctorParameters: function () {
|
749 | return [{ type: undefined, decorators: [{
|
750 | type: Inject,
|
751 | args: [DOCUMENT]
|
752 | }] }];
|
753 | } });
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 | const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
|
766 | const DOM_KEY_LOCATION_NUMPAD = 3;
|
767 |
|
768 | const _keyMap = {
|
769 |
|
770 |
|
771 | '\b': 'Backspace',
|
772 | '\t': 'Tab',
|
773 | '\x7F': 'Delete',
|
774 | '\x1B': 'Escape',
|
775 | 'Del': 'Delete',
|
776 | 'Esc': 'Escape',
|
777 | 'Left': 'ArrowLeft',
|
778 | 'Right': 'ArrowRight',
|
779 | 'Up': 'ArrowUp',
|
780 | 'Down': 'ArrowDown',
|
781 | 'Menu': 'ContextMenu',
|
782 | 'Scroll': 'ScrollLock',
|
783 | 'Win': 'OS'
|
784 | };
|
785 |
|
786 |
|
787 |
|
788 | const _chromeNumKeyPadMap = {
|
789 | 'A': '1',
|
790 | 'B': '2',
|
791 | 'C': '3',
|
792 | 'D': '4',
|
793 | 'E': '5',
|
794 | 'F': '6',
|
795 | 'G': '7',
|
796 | 'H': '8',
|
797 | 'I': '9',
|
798 | 'J': '*',
|
799 | 'K': '+',
|
800 | 'M': '-',
|
801 | 'N': '.',
|
802 | 'O': '/',
|
803 | '\x60': '0',
|
804 | '\x90': 'NumLock'
|
805 | };
|
806 |
|
807 |
|
808 |
|
809 | const MODIFIER_KEY_GETTERS = {
|
810 | 'alt': (event) => event.altKey,
|
811 | 'control': (event) => event.ctrlKey,
|
812 | 'meta': (event) => event.metaKey,
|
813 | 'shift': (event) => event.shiftKey
|
814 | };
|
815 |
|
816 |
|
817 |
|
818 |
|
819 | class KeyEventsPlugin extends EventManagerPlugin {
|
820 | |
821 |
|
822 |
|
823 |
|
824 | constructor(doc) {
|
825 | super(doc);
|
826 | }
|
827 | |
828 |
|
829 |
|
830 |
|
831 |
|
832 | supports(eventName) {
|
833 | return KeyEventsPlugin.parseEventName(eventName) != null;
|
834 | }
|
835 | |
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 | addEventListener(element, eventName, handler) {
|
844 | const parsedEvent = KeyEventsPlugin.parseEventName(eventName);
|
845 | const outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
846 | return this.manager.getZone().runOutsideAngular(() => {
|
847 | return ɵgetDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
|
848 | });
|
849 | }
|
850 | static parseEventName(eventName) {
|
851 | const parts = eventName.toLowerCase().split('.');
|
852 | const domEventName = parts.shift();
|
853 | if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
854 | return null;
|
855 | }
|
856 | const key = KeyEventsPlugin._normalizeKey(parts.pop());
|
857 | let fullKey = '';
|
858 | MODIFIER_KEYS.forEach(modifierName => {
|
859 | const index = parts.indexOf(modifierName);
|
860 | if (index > -1) {
|
861 | parts.splice(index, 1);
|
862 | fullKey += modifierName + '.';
|
863 | }
|
864 | });
|
865 | fullKey += key;
|
866 | if (parts.length != 0 || key.length === 0) {
|
867 |
|
868 | return null;
|
869 | }
|
870 |
|
871 |
|
872 |
|
873 | const result = {};
|
874 | result['domEventName'] = domEventName;
|
875 | result['fullKey'] = fullKey;
|
876 | return result;
|
877 | }
|
878 | static getEventFullKey(event) {
|
879 | let fullKey = '';
|
880 | let key = getEventKey(event);
|
881 | key = key.toLowerCase();
|
882 | if (key === ' ') {
|
883 | key = 'space';
|
884 | }
|
885 | else if (key === '.') {
|
886 | key = 'dot';
|
887 | }
|
888 | MODIFIER_KEYS.forEach(modifierName => {
|
889 | if (modifierName != key) {
|
890 | const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
891 | if (modifierGetter(event)) {
|
892 | fullKey += modifierName + '.';
|
893 | }
|
894 | }
|
895 | });
|
896 | fullKey += key;
|
897 | return fullKey;
|
898 | }
|
899 | |
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 | static eventCallback(fullKey, handler, zone) {
|
907 | return (event /** TODO #9100 */) => {
|
908 | if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
|
909 | zone.runGuarded(() => handler(event));
|
910 | }
|
911 | };
|
912 | }
|
913 |
|
914 | static _normalizeKey(keyName) {
|
915 |
|
916 | switch (keyName) {
|
917 | case 'esc':
|
918 | return 'escape';
|
919 | default:
|
920 | return keyName;
|
921 | }
|
922 | }
|
923 | }
|
924 | KeyEventsPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: KeyEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
925 | KeyEventsPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: KeyEventsPlugin });
|
926 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: KeyEventsPlugin, decorators: [{
|
927 | type: Injectable
|
928 | }], ctorParameters: function () {
|
929 | return [{ type: undefined, decorators: [{
|
930 | type: Inject,
|
931 | args: [DOCUMENT]
|
932 | }] }];
|
933 | } });
|
934 | function getEventKey(event) {
|
935 | let key = event.key;
|
936 | if (key == null) {
|
937 | key = event.keyIdentifier;
|
938 |
|
939 |
|
940 |
|
941 | if (key == null) {
|
942 | return 'Unidentified';
|
943 | }
|
944 | if (key.startsWith('U+')) {
|
945 | key = String.fromCharCode(parseInt(key.substring(2), 16));
|
946 | if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
|
947 |
|
948 |
|
949 |
|
950 | key = _chromeNumKeyPadMap[key];
|
951 | }
|
952 | }
|
953 | }
|
954 | return _keyMap[key] || key;
|
955 | }
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 | function initDomAdapter() {
|
965 | BrowserDomAdapter.makeCurrent();
|
966 | BrowserGetTestability.init();
|
967 | }
|
968 | function errorHandler() {
|
969 | return new ErrorHandler();
|
970 | }
|
971 | function _document() {
|
972 |
|
973 | ɵsetDocument(document);
|
974 | return document;
|
975 | }
|
976 | const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
|
977 | { provide: PLATFORM_ID, useValue: ɵPLATFORM_BROWSER_ID },
|
978 | { provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
|
979 | { provide: DOCUMENT, useFactory: _document, deps: [] },
|
980 | ];
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 | const platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
988 | const BROWSER_MODULE_PROVIDERS = [
|
989 | { provide: ɵINJECTOR_SCOPE, useValue: 'root' },
|
990 | { provide: ErrorHandler, useFactory: errorHandler, deps: [] },
|
991 | {
|
992 | provide: EVENT_MANAGER_PLUGINS,
|
993 | useClass: DomEventsPlugin,
|
994 | multi: true,
|
995 | deps: [DOCUMENT, NgZone, PLATFORM_ID]
|
996 | },
|
997 | { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [DOCUMENT] },
|
998 | {
|
999 | provide: DomRendererFactory2,
|
1000 | useClass: DomRendererFactory2,
|
1001 | deps: [EventManager, DomSharedStylesHost, APP_ID]
|
1002 | },
|
1003 | { provide: RendererFactory2, useExisting: DomRendererFactory2 },
|
1004 | { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
|
1005 | { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [DOCUMENT] },
|
1006 | { provide: Testability, useClass: Testability, deps: [NgZone] },
|
1007 | { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, NgZone] },
|
1008 | { provide: XhrFactory, useClass: BrowserXhr, deps: [] },
|
1009 | ];
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 | class BrowserModule {
|
1020 | constructor(parentModule) {
|
1021 | if (parentModule) {
|
1022 | 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.`);
|
1023 | }
|
1024 | }
|
1025 | |
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 | static withServerTransition(params) {
|
1034 | return {
|
1035 | ngModule: BrowserModule,
|
1036 | providers: [
|
1037 | { provide: APP_ID, useValue: params.appId },
|
1038 | { provide: TRANSITION_ID, useExisting: APP_ID },
|
1039 | SERVER_TRANSITION_PROVIDERS,
|
1040 | ],
|
1041 | };
|
1042 | }
|
1043 | }
|
1044 | BrowserModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserModule, deps: [{ token: BrowserModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule });
|
1045 | BrowserModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserModule, exports: [CommonModule, ApplicationModule] });
|
1046 | BrowserModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserModule, providers: BROWSER_MODULE_PROVIDERS, imports: [CommonModule, ApplicationModule] });
|
1047 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserModule, decorators: [{
|
1048 | type: NgModule,
|
1049 | args: [{ providers: BROWSER_MODULE_PROVIDERS, exports: [CommonModule, ApplicationModule] }]
|
1050 | }], ctorParameters: function () {
|
1051 | return [{ type: BrowserModule, decorators: [{
|
1052 | type: Optional
|
1053 | }, {
|
1054 | type: SkipSelf
|
1055 | }, {
|
1056 | type: Inject,
|
1057 | args: [BrowserModule]
|
1058 | }] }];
|
1059 | } });
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 | function createMeta() {
|
1072 | return new Meta(ɵɵinject(DOCUMENT));
|
1073 | }
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 | class Meta {
|
1097 | constructor(_doc) {
|
1098 | this._doc = _doc;
|
1099 | this._dom = ɵgetDOM();
|
1100 | }
|
1101 | |
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 | addTag(tag, forceCreation = false) {
|
1112 | if (!tag)
|
1113 | return null;
|
1114 | return this._getOrCreateElement(tag, forceCreation);
|
1115 | }
|
1116 | |
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 | addTags(tags, forceCreation = false) {
|
1125 | if (!tags)
|
1126 | return [];
|
1127 | return tags.reduce((result, tag) => {
|
1128 | if (tag) {
|
1129 | result.push(this._getOrCreateElement(tag, forceCreation));
|
1130 | }
|
1131 | return result;
|
1132 | }, []);
|
1133 | }
|
1134 | |
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 | getTag(attrSelector) {
|
1141 | if (!attrSelector)
|
1142 | return null;
|
1143 | return this._doc.querySelector(`meta[${attrSelector}]`) || null;
|
1144 | }
|
1145 | |
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 | getTags(attrSelector) {
|
1152 | if (!attrSelector)
|
1153 | return [];
|
1154 | const list = this._doc.querySelectorAll(`meta[${attrSelector}]`);
|
1155 | return list ? [].slice.call(list) : [];
|
1156 | }
|
1157 | |
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 | updateTag(tag, selector) {
|
1167 | if (!tag)
|
1168 | return null;
|
1169 | selector = selector || this._parseSelector(tag);
|
1170 | const meta = this.getTag(selector);
|
1171 | if (meta) {
|
1172 | return this._setMetaElementAttributes(tag, meta);
|
1173 | }
|
1174 | return this._getOrCreateElement(tag, true);
|
1175 | }
|
1176 | |
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 | removeTag(attrSelector) {
|
1182 | this.removeTagElement(this.getTag(attrSelector));
|
1183 | }
|
1184 | |
1185 |
|
1186 |
|
1187 |
|
1188 | removeTagElement(meta) {
|
1189 | if (meta) {
|
1190 | this._dom.remove(meta);
|
1191 | }
|
1192 | }
|
1193 | _getOrCreateElement(meta, forceCreation = false) {
|
1194 | if (!forceCreation) {
|
1195 | const selector = this._parseSelector(meta);
|
1196 |
|
1197 |
|
1198 |
|
1199 | const elem = this.getTags(selector).filter(elem => this._containsAttributes(meta, elem))[0];
|
1200 | if (elem !== undefined)
|
1201 | return elem;
|
1202 | }
|
1203 | const element = this._dom.createElement('meta');
|
1204 | this._setMetaElementAttributes(meta, element);
|
1205 | const head = this._doc.getElementsByTagName('head')[0];
|
1206 | head.appendChild(element);
|
1207 | return element;
|
1208 | }
|
1209 | _setMetaElementAttributes(tag, el) {
|
1210 | Object.keys(tag).forEach((prop) => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
|
1211 | return el;
|
1212 | }
|
1213 | _parseSelector(tag) {
|
1214 | const attr = tag.name ? 'name' : 'property';
|
1215 | return `${attr}="${tag[attr]}"`;
|
1216 | }
|
1217 | _containsAttributes(tag, elem) {
|
1218 | return Object.keys(tag).every((key) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
|
1219 | }
|
1220 | _getMetaKeyMap(prop) {
|
1221 | return META_KEYS_MAP[prop] || prop;
|
1222 | }
|
1223 | }
|
1224 | Meta.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Meta, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
1225 | Meta.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Meta, providedIn: 'root', useFactory: createMeta, deps: [] });
|
1226 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Meta, decorators: [{
|
1227 | type: Injectable,
|
1228 | args: [{ providedIn: 'root', useFactory: createMeta, deps: [] }]
|
1229 | }], ctorParameters: function () {
|
1230 | return [{ type: undefined, decorators: [{
|
1231 | type: Inject,
|
1232 | args: [DOCUMENT]
|
1233 | }] }];
|
1234 | } });
|
1235 |
|
1236 |
|
1237 |
|
1238 | const META_KEYS_MAP = {
|
1239 | httpEquiv: 'http-equiv'
|
1240 | };
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 | function createTitle() {
|
1253 | return new Title(ɵɵinject(DOCUMENT));
|
1254 | }
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 | class Title {
|
1266 | constructor(_doc) {
|
1267 | this._doc = _doc;
|
1268 | }
|
1269 | |
1270 |
|
1271 |
|
1272 | getTitle() {
|
1273 | return this._doc.title;
|
1274 | }
|
1275 | |
1276 |
|
1277 |
|
1278 |
|
1279 | setTitle(newTitle) {
|
1280 | this._doc.title = newTitle || '';
|
1281 | }
|
1282 | }
|
1283 | Title.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Title, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
1284 | Title.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Title, providedIn: 'root', useFactory: createTitle, deps: [] });
|
1285 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Title, decorators: [{
|
1286 | type: Injectable,
|
1287 | args: [{ providedIn: 'root', useFactory: createTitle, deps: [] }]
|
1288 | }], ctorParameters: function () {
|
1289 | return [{ type: undefined, decorators: [{
|
1290 | type: Inject,
|
1291 | args: [DOCUMENT]
|
1292 | }] }];
|
1293 | } });
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 | const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
1303 | const DASH_CASE_REGEXP = /-([a-z])/g;
|
1304 | function camelCaseToDashCase(input) {
|
1305 | return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
1306 | }
|
1307 | function dashCaseToCamelCase(input) {
|
1308 | return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
1309 | }
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 | function exportNgVar(name, value) {
|
1318 | if (typeof COMPILED === 'undefined' || !COMPILED) {
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 | const ng = ɵglobal['ng'] = ɵglobal['ng'] || {};
|
1324 | ng[name] = value;
|
1325 | }
|
1326 | }
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 | const win = typeof window !== 'undefined' && window || {};
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 | class ChangeDetectionPerfRecord {
|
1345 | constructor(msPerTick, numTicks) {
|
1346 | this.msPerTick = msPerTick;
|
1347 | this.numTicks = numTicks;
|
1348 | }
|
1349 | }
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 | class AngularProfiler {
|
1355 | constructor(ref) {
|
1356 | this.appRef = ref.injector.get(ApplicationRef);
|
1357 | }
|
1358 |
|
1359 | |
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 | timeChangeDetection(config) {
|
1376 | const record = config && config['record'];
|
1377 | const profileName = 'Change Detection';
|
1378 |
|
1379 | const isProfilerAvailable = win.console.profile != null;
|
1380 | if (record && isProfilerAvailable) {
|
1381 | win.console.profile(profileName);
|
1382 | }
|
1383 | const start = performanceNow();
|
1384 | let numTicks = 0;
|
1385 | while (numTicks < 5 || (performanceNow() - start) < 500) {
|
1386 | this.appRef.tick();
|
1387 | numTicks++;
|
1388 | }
|
1389 | const end = performanceNow();
|
1390 | if (record && isProfilerAvailable) {
|
1391 | win.console.profileEnd(profileName);
|
1392 | }
|
1393 | const msPerTick = (end - start) / numTicks;
|
1394 | win.console.log(`ran ${numTicks} change detection cycles`);
|
1395 | win.console.log(`${msPerTick.toFixed(2)} ms per check`);
|
1396 | return new ChangeDetectionPerfRecord(msPerTick, numTicks);
|
1397 | }
|
1398 | }
|
1399 | function performanceNow() {
|
1400 | return win.performance && win.performance.now ? win.performance.now() :
|
1401 | new Date().getTime();
|
1402 | }
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 | const PROFILER_GLOBAL_NAME = 'profiler';
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 | function enableDebugTools(ref) {
|
1426 | exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
|
1427 | return ref;
|
1428 | }
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 | function disableDebugTools() {
|
1435 | exportNgVar(PROFILER_GLOBAL_NAME, null);
|
1436 | }
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 | function escapeHtml(text) {
|
1446 | const escapedText = {
|
1447 | '&': '&a;',
|
1448 | '"': '&q;',
|
1449 | '\'': '&s;',
|
1450 | '<': '&l;',
|
1451 | '>': '&g;',
|
1452 | };
|
1453 | return text.replace(/[&"'<>]/g, s => escapedText[s]);
|
1454 | }
|
1455 | function unescapeHtml(text) {
|
1456 | const unescapedText = {
|
1457 | '&a;': '&',
|
1458 | '&q;': '"',
|
1459 | '&s;': '\'',
|
1460 | '&l;': '<',
|
1461 | '&g;': '>',
|
1462 | };
|
1463 | return text.replace(/&[^;]+;/g, s => unescapedText[s]);
|
1464 | }
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 | function makeStateKey(key) {
|
1480 | return key;
|
1481 | }
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 |
|
1493 |
|
1494 |
|
1495 | class TransferState {
|
1496 | constructor() {
|
1497 | this.store = {};
|
1498 | this.onSerializeCallbacks = {};
|
1499 | }
|
1500 |
|
1501 | static init(initState) {
|
1502 | const transferState = new TransferState();
|
1503 | transferState.store = initState;
|
1504 | return transferState;
|
1505 | }
|
1506 | |
1507 |
|
1508 |
|
1509 | get(key, defaultValue) {
|
1510 | return this.store[key] !== undefined ? this.store[key] : defaultValue;
|
1511 | }
|
1512 | |
1513 |
|
1514 |
|
1515 | set(key, value) {
|
1516 | this.store[key] = value;
|
1517 | }
|
1518 | |
1519 |
|
1520 |
|
1521 | remove(key) {
|
1522 | delete this.store[key];
|
1523 | }
|
1524 | |
1525 |
|
1526 |
|
1527 | hasKey(key) {
|
1528 | return this.store.hasOwnProperty(key);
|
1529 | }
|
1530 | |
1531 |
|
1532 |
|
1533 | onSerialize(key, callback) {
|
1534 | this.onSerializeCallbacks[key] = callback;
|
1535 | }
|
1536 | |
1537 |
|
1538 |
|
1539 | toJson() {
|
1540 |
|
1541 | for (const key in this.onSerializeCallbacks) {
|
1542 | if (this.onSerializeCallbacks.hasOwnProperty(key)) {
|
1543 | try {
|
1544 | this.store[key] = this.onSerializeCallbacks[key]();
|
1545 | }
|
1546 | catch (e) {
|
1547 | console.warn('Exception in onSerialize callback: ', e);
|
1548 | }
|
1549 | }
|
1550 | }
|
1551 | return JSON.stringify(this.store);
|
1552 | }
|
1553 | }
|
1554 | TransferState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TransferState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1555 | TransferState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TransferState });
|
1556 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TransferState, decorators: [{
|
1557 | type: Injectable
|
1558 | }] });
|
1559 | function initTransferState(doc, appId) {
|
1560 |
|
1561 |
|
1562 | const script = doc.getElementById(appId + '-state');
|
1563 | let initialState = {};
|
1564 | if (script && script.textContent) {
|
1565 | try {
|
1566 |
|
1567 | initialState = JSON.parse(unescapeHtml(script.textContent));
|
1568 | }
|
1569 | catch (e) {
|
1570 | console.warn('Exception while restoring TransferState for app ' + appId, e);
|
1571 | }
|
1572 | }
|
1573 | return TransferState.init(initialState);
|
1574 | }
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 | class BrowserTransferStateModule {
|
1582 | }
|
1583 | BrowserTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1584 | BrowserTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule });
|
1585 | BrowserTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule, providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT, APP_ID] }] });
|
1586 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule, decorators: [{
|
1587 | type: NgModule,
|
1588 | args: [{
|
1589 | providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT, APP_ID] }],
|
1590 | }]
|
1591 | }] });
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 |
|
1597 |
|
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 | class By {
|
1606 | |
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 | static all() {
|
1615 | return () => true;
|
1616 | }
|
1617 | |
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 |
|
1625 | static css(selector) {
|
1626 | return (debugElement) => {
|
1627 | return debugElement.nativeElement != null ?
|
1628 | elementMatches(debugElement.nativeElement, selector) :
|
1629 | false;
|
1630 | };
|
1631 | }
|
1632 | |
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 | static directive(type) {
|
1641 | return (debugNode) => debugNode.providerTokens.indexOf(type) !== -1;
|
1642 | }
|
1643 | }
|
1644 | function elementMatches(n, selector) {
|
1645 | if (ɵgetDOM().isElementNode(n)) {
|
1646 | return n.matches && n.matches(selector) ||
|
1647 | n.msMatchesSelector && n.msMatchesSelector(selector) ||
|
1648 | n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
|
1649 | }
|
1650 | return false;
|
1651 | }
|
1652 |
|
1653 |
|
1654 |
|
1655 |
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 | const EVENT_NAMES = {
|
1664 |
|
1665 | 'pan': true,
|
1666 | 'panstart': true,
|
1667 | 'panmove': true,
|
1668 | 'panend': true,
|
1669 | 'pancancel': true,
|
1670 | 'panleft': true,
|
1671 | 'panright': true,
|
1672 | 'panup': true,
|
1673 | 'pandown': true,
|
1674 |
|
1675 | 'pinch': true,
|
1676 | 'pinchstart': true,
|
1677 | 'pinchmove': true,
|
1678 | 'pinchend': true,
|
1679 | 'pinchcancel': true,
|
1680 | 'pinchin': true,
|
1681 | 'pinchout': true,
|
1682 |
|
1683 | 'press': true,
|
1684 | 'pressup': true,
|
1685 |
|
1686 | 'rotate': true,
|
1687 | 'rotatestart': true,
|
1688 | 'rotatemove': true,
|
1689 | 'rotateend': true,
|
1690 | 'rotatecancel': true,
|
1691 |
|
1692 | 'swipe': true,
|
1693 | 'swipeleft': true,
|
1694 | 'swiperight': true,
|
1695 | 'swipeup': true,
|
1696 | 'swipedown': true,
|
1697 |
|
1698 | 'tap': true,
|
1699 | 'doubletap': true
|
1700 | };
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 | const HAMMER_GESTURE_CONFIG = new InjectionToken('HammerGestureConfig');
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 | const HAMMER_LOADER = new InjectionToken('HammerLoader');
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 | class HammerGestureConfig {
|
1721 | constructor() {
|
1722 | |
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 | this.events = [];
|
1728 | |
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 |
|
1740 |
|
1741 |
|
1742 |
|
1743 |
|
1744 | this.overrides = {};
|
1745 | }
|
1746 | |
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 | buildHammer(element) {
|
1753 | const mc = new Hammer(element, this.options);
|
1754 | mc.get('pinch').set({ enable: true });
|
1755 | mc.get('rotate').set({ enable: true });
|
1756 | for (const eventName in this.overrides) {
|
1757 | mc.get(eventName).set(this.overrides[eventName]);
|
1758 | }
|
1759 | return mc;
|
1760 | }
|
1761 | }
|
1762 | HammerGestureConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGestureConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1763 | HammerGestureConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGestureConfig });
|
1764 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGestureConfig, decorators: [{
|
1765 | type: Injectable
|
1766 | }] });
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 | class HammerGesturesPlugin extends EventManagerPlugin {
|
1773 | constructor(doc, _config, console, loader) {
|
1774 | super(doc);
|
1775 | this._config = _config;
|
1776 | this.console = console;
|
1777 | this.loader = loader;
|
1778 | this._loaderPromise = null;
|
1779 | }
|
1780 | supports(eventName) {
|
1781 | if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
|
1782 | return false;
|
1783 | }
|
1784 | if (!window.Hammer && !this.loader) {
|
1785 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
1786 | this.console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not ` +
|
1787 | `loaded and no custom loader has been specified.`);
|
1788 | }
|
1789 | return false;
|
1790 | }
|
1791 | return true;
|
1792 | }
|
1793 | addEventListener(element, eventName, handler) {
|
1794 | const zone = this.manager.getZone();
|
1795 | eventName = eventName.toLowerCase();
|
1796 |
|
1797 |
|
1798 | if (!window.Hammer && this.loader) {
|
1799 | this._loaderPromise = this._loaderPromise || this.loader();
|
1800 |
|
1801 |
|
1802 |
|
1803 | let cancelRegistration = false;
|
1804 | let deregister = () => {
|
1805 | cancelRegistration = true;
|
1806 | };
|
1807 | this._loaderPromise
|
1808 | .then(() => {
|
1809 |
|
1810 | if (!window.Hammer) {
|
1811 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
1812 | this.console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
|
1813 | }
|
1814 | deregister = () => { };
|
1815 | return;
|
1816 | }
|
1817 | if (!cancelRegistration) {
|
1818 |
|
1819 |
|
1820 | deregister = this.addEventListener(element, eventName, handler);
|
1821 | }
|
1822 | })
|
1823 | .catch(() => {
|
1824 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
1825 | this.console.warn(`The "${eventName}" event cannot be bound because the custom ` +
|
1826 | `Hammer.JS loader failed.`);
|
1827 | }
|
1828 | deregister = () => { };
|
1829 | });
|
1830 |
|
1831 |
|
1832 |
|
1833 | return () => {
|
1834 | deregister();
|
1835 | };
|
1836 | }
|
1837 | return zone.runOutsideAngular(() => {
|
1838 |
|
1839 | const mc = this._config.buildHammer(element);
|
1840 | const callback = function (eventObj) {
|
1841 | zone.runGuarded(function () {
|
1842 | handler(eventObj);
|
1843 | });
|
1844 | };
|
1845 | mc.on(eventName, callback);
|
1846 | return () => {
|
1847 | mc.off(eventName, callback);
|
1848 |
|
1849 | if (typeof mc.destroy === 'function') {
|
1850 | mc.destroy();
|
1851 | }
|
1852 | };
|
1853 | });
|
1854 | }
|
1855 | isCustomEvent(eventName) {
|
1856 | return this._config.events.indexOf(eventName) > -1;
|
1857 | }
|
1858 | }
|
1859 | HammerGesturesPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGesturesPlugin, deps: [{ token: DOCUMENT }, { token: HAMMER_GESTURE_CONFIG }, { token: i0.ɵConsole }, { token: HAMMER_LOADER, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
1860 | HammerGesturesPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGesturesPlugin });
|
1861 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGesturesPlugin, decorators: [{
|
1862 | type: Injectable
|
1863 | }], ctorParameters: function () {
|
1864 | return [{ type: undefined, decorators: [{
|
1865 | type: Inject,
|
1866 | args: [DOCUMENT]
|
1867 | }] }, { type: HammerGestureConfig, decorators: [{
|
1868 | type: Inject,
|
1869 | args: [HAMMER_GESTURE_CONFIG]
|
1870 | }] }, { type: i0.ɵConsole }, { type: undefined, decorators: [{
|
1871 | type: Optional
|
1872 | }, {
|
1873 | type: Inject,
|
1874 | args: [HAMMER_LOADER]
|
1875 | }] }];
|
1876 | } });
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 | class HammerModule {
|
1889 | }
|
1890 | HammerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1891 | HammerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule });
|
1892 | HammerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule, providers: [
|
1893 | {
|
1894 | provide: EVENT_MANAGER_PLUGINS,
|
1895 | useClass: HammerGesturesPlugin,
|
1896 | multi: true,
|
1897 | deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, ɵConsole, [new Optional(), HAMMER_LOADER]]
|
1898 | },
|
1899 | { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
|
1900 | ] });
|
1901 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule, decorators: [{
|
1902 | type: NgModule,
|
1903 | args: [{
|
1904 | providers: [
|
1905 | {
|
1906 | provide: EVENT_MANAGER_PLUGINS,
|
1907 | useClass: HammerGesturesPlugin,
|
1908 | multi: true,
|
1909 | deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, ɵConsole, [new Optional(), HAMMER_LOADER]]
|
1910 | },
|
1911 | { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
|
1912 | ]
|
1913 | }]
|
1914 | }] });
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 | class DomSanitizer {
|
1955 | }
|
1956 | DomSanitizer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1957 | DomSanitizer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizer, providedIn: 'root', useExisting: i0.forwardRef(function () { return DomSanitizerImpl; }) });
|
1958 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizer, decorators: [{
|
1959 | type: Injectable,
|
1960 | args: [{ providedIn: 'root', useExisting: forwardRef(() => DomSanitizerImpl) }]
|
1961 | }] });
|
1962 | function domSanitizerImplFactory(injector) {
|
1963 | return new DomSanitizerImpl(injector.get(DOCUMENT));
|
1964 | }
|
1965 | class DomSanitizerImpl extends DomSanitizer {
|
1966 | constructor(_doc) {
|
1967 | super();
|
1968 | this._doc = _doc;
|
1969 | }
|
1970 | sanitize(ctx, value) {
|
1971 | if (value == null)
|
1972 | return null;
|
1973 | switch (ctx) {
|
1974 | case SecurityContext.NONE:
|
1975 | return value;
|
1976 | case SecurityContext.HTML:
|
1977 | if (ɵallowSanitizationBypassAndThrow(value, "HTML" )) {
|
1978 | return ɵunwrapSafeValue(value);
|
1979 | }
|
1980 | return ɵ_sanitizeHtml(this._doc, String(value)).toString();
|
1981 | case SecurityContext.STYLE:
|
1982 | if (ɵallowSanitizationBypassAndThrow(value, "Style" )) {
|
1983 | return ɵunwrapSafeValue(value);
|
1984 | }
|
1985 | return value;
|
1986 | case SecurityContext.SCRIPT:
|
1987 | if (ɵallowSanitizationBypassAndThrow(value, "Script" )) {
|
1988 | return ɵunwrapSafeValue(value);
|
1989 | }
|
1990 | throw new Error('unsafe value used in a script context');
|
1991 | case SecurityContext.URL:
|
1992 | const type = ɵgetSanitizationBypassType(value);
|
1993 | if (ɵallowSanitizationBypassAndThrow(value, "URL" )) {
|
1994 | return ɵunwrapSafeValue(value);
|
1995 | }
|
1996 | return ɵ_sanitizeUrl(String(value));
|
1997 | case SecurityContext.RESOURCE_URL:
|
1998 | if (ɵallowSanitizationBypassAndThrow(value, "ResourceURL" )) {
|
1999 | return ɵunwrapSafeValue(value);
|
2000 | }
|
2001 | throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
|
2002 | default:
|
2003 | throw new Error(`Unexpected SecurityContext ${ctx} (see https://g.co/ng/security#xss)`);
|
2004 | }
|
2005 | }
|
2006 | bypassSecurityTrustHtml(value) {
|
2007 | return ɵbypassSanitizationTrustHtml(value);
|
2008 | }
|
2009 | bypassSecurityTrustStyle(value) {
|
2010 | return ɵbypassSanitizationTrustStyle(value);
|
2011 | }
|
2012 | bypassSecurityTrustScript(value) {
|
2013 | return ɵbypassSanitizationTrustScript(value);
|
2014 | }
|
2015 | bypassSecurityTrustUrl(value) {
|
2016 | return ɵbypassSanitizationTrustUrl(value);
|
2017 | }
|
2018 | bypassSecurityTrustResourceUrl(value) {
|
2019 | return ɵbypassSanitizationTrustResourceUrl(value);
|
2020 | }
|
2021 | }
|
2022 | DomSanitizerImpl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizerImpl, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
2023 | DomSanitizerImpl.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizerImpl, providedIn: 'root', useFactory: domSanitizerImplFactory, deps: [{ token: Injector }] });
|
2024 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizerImpl, decorators: [{
|
2025 | type: Injectable,
|
2026 | args: [{ providedIn: 'root', useFactory: domSanitizerImplFactory, deps: [Injector] }]
|
2027 | }], ctorParameters: function () {
|
2028 | return [{ type: undefined, decorators: [{
|
2029 | type: Inject,
|
2030 | args: [DOCUMENT]
|
2031 | }] }];
|
2032 | } });
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 | const VERSION = new Version('13.0.3');
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 | export { BrowserModule, BrowserTransferStateModule, By, DomSanitizer, EVENT_MANAGER_PLUGINS, EventManager, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, HammerModule, Meta, Title, TransferState, VERSION, disableDebugTools, enableDebugTools, makeStateKey, platformBrowser, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserGetTestability as ɵBrowserGetTestability, DomEventsPlugin as ɵDomEventsPlugin, DomRendererFactory2 as ɵDomRendererFactory2, DomSanitizerImpl as ɵDomSanitizerImpl, DomSharedStylesHost as ɵDomSharedStylesHost, 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 };
|
2084 |
|