-
Notifications
You must be signed in to change notification settings - Fork 0
/
721.3c88df41a0a78aa2c4cc.js
4003 lines (3287 loc) · 116 KB
/
721.3c88df41a0a78aa2c4cc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"use strict";
(self["webpackChunkdemo"] = self["webpackChunkdemo"] || []).push([[721],{
/***/ 721:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: consume shared module (default) @angular/common@=12.2.11 (strict) (singleton) (fallback: ./node_modules/@angular/common/fesm2015/common.js)
var common_js_ = __webpack_require__(5289);
// EXTERNAL MODULE: consume shared module (default) @angular/core@=12.2.11 (strict) (singleton) (fallback: ./node_modules/@angular/core/fesm2015/core.js)
var core_js_ = __webpack_require__(1426);
;// CONCATENATED MODULE: ./node_modules/@angular/platform-browser/fesm2015/platform-browser.js
/**
* @license Angular v12.2.11
* (c) 2010-2021 Google LLC. https://angular.io/
* License: MIT
*/
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Provides DOM operations in any browser environment.
*
* @security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
*/
class GenericBrowserDomAdapter extends common_js_["ɵDomAdapter"] {
constructor() {
super(...arguments);
this.supportsDOMEvents = true;
}
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A `DomAdapter` powered by full browser DOM APIs.
*
* @security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
*/
/* tslint:disable:requireParameterType no-console */
class BrowserDomAdapter extends GenericBrowserDomAdapter {
static makeCurrent() {
(0,common_js_["ɵsetRootDomAdapter"])(new BrowserDomAdapter());
}
onAndCancel(el, evt, listener) {
el.addEventListener(evt, listener, false); // Needed to follow Dart's subscription semantic, until fix of
// https://code.google.com/p/dart/issues/detail?id=17406
return () => {
el.removeEventListener(evt, listener, false);
};
}
dispatchEvent(el, evt) {
el.dispatchEvent(evt);
}
remove(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
}
createElement(tagName, doc) {
doc = doc || this.getDefaultDocument();
return doc.createElement(tagName);
}
createHtmlDocument() {
return document.implementation.createHTMLDocument('fakeTitle');
}
getDefaultDocument() {
return document;
}
isElementNode(node) {
return node.nodeType === Node.ELEMENT_NODE;
}
isShadowRoot(node) {
return node instanceof DocumentFragment;
}
/** @deprecated No longer being used in Ivy code. To be removed in version 14. */
getGlobalEventTarget(doc, target) {
if (target === 'window') {
return window;
}
if (target === 'document') {
return doc;
}
if (target === 'body') {
return doc.body;
}
return null;
}
getBaseHref(doc) {
const href = getBaseElementHref();
return href == null ? null : relativePath(href);
}
resetBaseElement() {
baseElement = null;
}
getUserAgent() {
return window.navigator.userAgent;
}
getCookie(name) {
return (0,common_js_["ɵparseCookieValue"])(document.cookie, name);
}
}
let baseElement = null;
function getBaseElementHref() {
baseElement = baseElement || document.querySelector('base');
return baseElement ? baseElement.getAttribute('href') : null;
} // based on urlUtils.js in AngularJS 1
let urlParsingNode;
function relativePath(url) {
urlParsingNode = urlParsingNode || document.createElement('a');
urlParsingNode.setAttribute('href', url);
const pathName = urlParsingNode.pathname;
return pathName.charAt(0) === '/' ? pathName : `/${pathName}`;
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* An id that identifies a particular application being bootstrapped, that should
* match across the client/server boundary.
*/
const TRANSITION_ID = /*#__PURE__*/new core_js_.InjectionToken('TRANSITION_ID');
function appInitializerFactory(transitionId, document, injector) {
return () => {
// Wait for all application initializers to be completed before removing the styles set by
// the server.
injector.get(core_js_.ApplicationInitStatus).donePromise.then(() => {
const dom = (0,common_js_["ɵgetDOM"])();
const styles = document.querySelectorAll(`style[ng-transition="${transitionId}"]`);
for (let i = 0; i < styles.length; i++) {
dom.remove(styles[i]);
}
});
};
}
const SERVER_TRANSITION_PROVIDERS = [{
provide: core_js_.APP_INITIALIZER,
useFactory: appInitializerFactory,
deps: [TRANSITION_ID, common_js_.DOCUMENT, core_js_.Injector],
multi: true
}];
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
class BrowserGetTestability {
static init() {
(0,core_js_.setTestabilityGetter)(new BrowserGetTestability());
}
addToWindow(registry) {
core_js_["ɵglobal"].getAngularTestability = (elem, findInAncestors = true) => {
const testability = registry.findTestabilityInTree(elem, findInAncestors);
if (testability == null) {
throw new Error('Could not find testability for element.');
}
return testability;
};
core_js_["ɵglobal"].getAllAngularTestabilities = () => registry.getAllTestabilities();
core_js_["ɵglobal"].getAllAngularRootElements = () => registry.getAllRootElements();
const whenAllStable = (callback
/** TODO #9100 */
) => {
const testabilities = core_js_["ɵglobal"].getAllAngularTestabilities();
let count = testabilities.length;
let didWork = false;
const decrement = function (didWork_
/** TODO #9100 */
) {
didWork = didWork || didWork_;
count--;
if (count == 0) {
callback(didWork);
}
};
testabilities.forEach(function (testability
/** TODO #9100 */
) {
testability.whenStable(decrement);
});
};
if (!core_js_["ɵglobal"].frameworkStabilizers) {
core_js_["ɵglobal"].frameworkStabilizers = [];
}
core_js_["ɵglobal"].frameworkStabilizers.push(whenAllStable);
}
findTestabilityInTree(registry, elem, findInAncestors) {
if (elem == null) {
return null;
}
const t = registry.getTestability(elem);
if (t != null) {
return t;
} else if (!findInAncestors) {
return null;
}
if ((0,common_js_["ɵgetDOM"])().isShadowRoot(elem)) {
return this.findTestabilityInTree(registry, elem.host, true);
}
return this.findTestabilityInTree(registry, elem.parentElement, true);
}
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API.
*/
let BrowserXhr = /*#__PURE__*/(() => {
class BrowserXhr {
build() {
return new XMLHttpRequest();
}
}
BrowserXhr.ɵfac = function BrowserXhr_Factory(t) {
return new (t || BrowserXhr)();
};
BrowserXhr.ɵprov = /*@__PURE__*/core_js_["ɵɵdefineInjectable"]({
token: BrowserXhr,
factory: BrowserXhr.ɵfac
});
return BrowserXhr;
})();
/*#__PURE__*/
(function () {
(typeof ngDevMode === "undefined" || ngDevMode) && void 0;
})();
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const CAMEL_CASE_REGEXP = /([A-Z])/g;
const DASH_CASE_REGEXP = /-([a-z])/g;
function camelCaseToDashCase(input) {
return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
}
function dashCaseToCamelCase(input) {
return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
}
/**
* Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
* `name` is `'probe'`.
* @param name Name under which it will be exported. Keep in mind this will be a property of the
* global `ng` object.
* @param value The value to export.
*/
function exportNgVar(name, value) {
if (typeof COMPILED === 'undefined' || !COMPILED) {
// Note: we can't export `ng` when using closure enhanced optimization as:
// - closure declares globals itself for minified names, which sometimes clobber our `ng` global
// - we can't declare a closure extern as the namespace `ng` is already used within Google
// for typings for angularJS (via `goog.provide('ng....')`).
const ng = core_js_["ɵglobal"].ng = core_js_["ɵglobal"].ng || {};
ng[name] = value;
}
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const ɵ0 = () => ({
'ApplicationRef': core_js_.ApplicationRef,
'NgZone': core_js_.NgZone
});
const CORE_TOKENS = /*#__PURE__*/ɵ0();
const INSPECT_GLOBAL_NAME = 'probe';
const CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
/**
* Returns a {@link DebugElement} for the given native DOM element, or
* null if the given native element does not have an Angular view associated
* with it.
*/
function inspectNativeElementR2(element) {
return (0,core_js_["ɵgetDebugNodeR2"])(element);
}
function _createNgProbeR2(coreTokens) {
exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElementR2);
exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object.assign(Object.assign({}, CORE_TOKENS), _ngProbeTokensToMap(coreTokens || [])));
return () => inspectNativeElementR2;
}
function _ngProbeTokensToMap(tokens) {
return tokens.reduce((prev, t) => (prev[t.name] = t.token, prev), {});
}
/**
* In Ivy, we don't support NgProbe because we have our own set of testing utilities
* with more robust functionality.
*
* We shouldn't bring in NgProbe because it prevents DebugNode and friends from
* tree-shaking properly.
*/
const ELEMENT_PROBE_PROVIDERS__POST_R3__ = [];
/**
* Providers which support debugging Angular applications (e.g. via `ng.probe`).
*/
const ELEMENT_PROBE_PROVIDERS__PRE_R3__ = [{
provide: core_js_.APP_INITIALIZER,
useFactory: _createNgProbeR2,
deps: [[core_js_.NgProbeToken, /*#__PURE__*/new core_js_.Optional()]],
multi: true
}];
const ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS__POST_R3__;
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* The injection token for the event-manager plug-in service.
*
* @publicApi
*/
const EVENT_MANAGER_PLUGINS = /*#__PURE__*/new core_js_.InjectionToken('EventManagerPlugins');
/**
* An injectable service that provides event management for Angular
* through a browser plug-in.
*
* @publicApi
*/
let EventManager = /*#__PURE__*/(() => {
class EventManager {
/**
* Initializes an instance of the event-manager service.
*/
constructor(plugins, _zone) {
this._zone = _zone;
this._eventNameToPlugin = new Map();
plugins.forEach(p => p.manager = this);
this._plugins = plugins.slice().reverse();
}
/**
* Registers a handler for a specific element and event.
*
* @param element The HTML element to receive event notifications.
* @param eventName The name of the event to listen for.
* @param handler A function to call when the notification occurs. Receives the
* event object as an argument.
* @returns A callback function that can be used to remove the handler.
*/
addEventListener(element, eventName, handler) {
const plugin = this._findPluginFor(eventName);
return plugin.addEventListener(element, eventName, handler);
}
/**
* Registers a global handler for an event in a target view.
*
* @param target A target for global event notifications. One of "window", "document", or "body".
* @param eventName The name of the event to listen for.
* @param handler A function to call when the notification occurs. Receives the
* event object as an argument.
* @returns A callback function that can be used to remove the handler.
* @deprecated No longer being used in Ivy code. To be removed in version 14.
*/
addGlobalEventListener(target, eventName, handler) {
const plugin = this._findPluginFor(eventName);
return plugin.addGlobalEventListener(target, eventName, handler);
}
/**
* Retrieves the compilation zone in which event listeners are registered.
*/
getZone() {
return this._zone;
}
/** @internal */
_findPluginFor(eventName) {
const plugin = this._eventNameToPlugin.get(eventName);
if (plugin) {
return plugin;
}
const plugins = this._plugins;
for (let i = 0; i < plugins.length; i++) {
const plugin = plugins[i];
if (plugin.supports(eventName)) {
this._eventNameToPlugin.set(eventName, plugin);
return plugin;
}
}
throw new Error(`No event manager plugin found for event ${eventName}`);
}
}
EventManager.ɵfac = function EventManager_Factory(t) {
return new (t || EventManager)(core_js_["ɵɵinject"](EVENT_MANAGER_PLUGINS), core_js_["ɵɵinject"](core_js_.NgZone));
};
EventManager.ɵprov = /*@__PURE__*/core_js_["ɵɵdefineInjectable"]({
token: EventManager,
factory: EventManager.ɵfac
});
return EventManager;
})();
/*#__PURE__*/
(function () {
(typeof ngDevMode === "undefined" || ngDevMode) && void 0;
})();
class EventManagerPlugin {
constructor(_doc) {
this._doc = _doc;
}
addGlobalEventListener(element, eventName, handler) {
const target = (0,common_js_["ɵgetDOM"])().getGlobalEventTarget(this._doc, element);
if (!target) {
throw new Error(`Unsupported event target ${target} for event ${eventName}`);
}
return this.addEventListener(target, eventName, handler);
}
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
let SharedStylesHost = /*#__PURE__*/(() => {
class SharedStylesHost {
constructor() {
/** @internal */
this._stylesSet = new Set();
}
addStyles(styles) {
const additions = new Set();
styles.forEach(style => {
if (!this._stylesSet.has(style)) {
this._stylesSet.add(style);
additions.add(style);
}
});
this.onStylesAdded(additions);
}
onStylesAdded(additions) {}
getAllStyles() {
return Array.from(this._stylesSet);
}
}
SharedStylesHost.ɵfac = function SharedStylesHost_Factory(t) {
return new (t || SharedStylesHost)();
};
SharedStylesHost.ɵprov = /*@__PURE__*/core_js_["ɵɵdefineInjectable"]({
token: SharedStylesHost,
factory: SharedStylesHost.ɵfac
});
return SharedStylesHost;
})();
/*#__PURE__*/
(function () {
(typeof ngDevMode === "undefined" || ngDevMode) && void 0;
})();
let DomSharedStylesHost = /*#__PURE__*/(() => {
class DomSharedStylesHost extends SharedStylesHost {
constructor(_doc) {
super();
this._doc = _doc; // Maps all registered host nodes to a list of style nodes that have been added to the host node.
this._hostNodes = new Map();
this._hostNodes.set(_doc.head, []);
}
_addStylesToHost(styles, host, styleNodes) {
styles.forEach(style => {
const styleEl = this._doc.createElement('style');
styleEl.textContent = style;
styleNodes.push(host.appendChild(styleEl));
});
}
addHost(hostNode) {
const styleNodes = [];
this._addStylesToHost(this._stylesSet, hostNode, styleNodes);
this._hostNodes.set(hostNode, styleNodes);
}
removeHost(hostNode) {
const styleNodes = this._hostNodes.get(hostNode);
if (styleNodes) {
styleNodes.forEach(removeStyle);
}
this._hostNodes.delete(hostNode);
}
onStylesAdded(additions) {
this._hostNodes.forEach((styleNodes, hostNode) => {
this._addStylesToHost(additions, hostNode, styleNodes);
});
}
ngOnDestroy() {
this._hostNodes.forEach(styleNodes => styleNodes.forEach(removeStyle));
}
}
DomSharedStylesHost.ɵfac = function DomSharedStylesHost_Factory(t) {
return new (t || DomSharedStylesHost)(core_js_["ɵɵinject"](common_js_.DOCUMENT));
};
DomSharedStylesHost.ɵprov = /*@__PURE__*/core_js_["ɵɵdefineInjectable"]({
token: DomSharedStylesHost,
factory: DomSharedStylesHost.ɵfac
});
return DomSharedStylesHost;
})();
/*#__PURE__*/
(function () {
(typeof ngDevMode === "undefined" || ngDevMode) && void 0;
})();
function removeStyle(styleNode) {
(0,common_js_["ɵgetDOM"])().remove(styleNode);
}
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const NAMESPACE_URIS = {
'svg': 'http://www.w3.org/2000/svg',
'xhtml': 'http://www.w3.org/1999/xhtml',
'xlink': 'http://www.w3.org/1999/xlink',
'xml': 'http://www.w3.org/XML/1998/namespace',
'xmlns': 'http://www.w3.org/2000/xmlns/'
};
const COMPONENT_REGEX = /%COMP%/g;
const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
const COMPONENT_VARIABLE = '%COMP%';
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
function shimContentAttribute(componentShortId) {
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
function shimHostAttribute(componentShortId) {
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
function flattenStyles(compId, styles, target) {
for (let i = 0; i < styles.length; i++) {
let style = styles[i];
if (Array.isArray(style)) {
flattenStyles(compId, style, target);
} else {
style = style.replace(COMPONENT_REGEX, compId);
target.push(style);
}
}
return target;
}
function decoratePreventDefault(eventHandler) {
// `DebugNode.triggerEventHandler` needs to know if the listener was created with
// decoratePreventDefault or is a listener added outside the Angular context so it can handle the
// two differently. In the first case, the special '__ngUnwrap__' token is passed to the unwrap
// the listener (see below).
return event => {
// Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function
// so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The debug_node
// can inspect the listener toString contents for the existence of this special token. Because
// the token is a string literal, it is ensured to not be modified by compiled code.
if (event === '__ngUnwrap__') {
return eventHandler;
}
const allowDefaultBehavior = eventHandler(event);
if (allowDefaultBehavior === false) {
// TODO(tbosch): move preventDefault into event plugins...
event.preventDefault();
event.returnValue = false;
}
return undefined;
};
}
let hasLoggedNativeEncapsulationWarning = false;
let DomRendererFactory2 = /*#__PURE__*/(() => {
class DomRendererFactory2 {
constructor(eventManager, sharedStylesHost, appId) {
this.eventManager = eventManager;
this.sharedStylesHost = sharedStylesHost;
this.appId = appId;
this.rendererByCompId = new Map();
this.defaultRenderer = new DefaultDomRenderer2(eventManager);
}
createRenderer(element, type) {
if (!element || !type) {
return this.defaultRenderer;
}
switch (type.encapsulation) {
case core_js_.ViewEncapsulation.Emulated:
{
let renderer = this.rendererByCompId.get(type.id);
if (!renderer) {
renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId);
this.rendererByCompId.set(type.id, renderer);
}
renderer.applyToHost(element);
return renderer;
}
// @ts-ignore TODO: Remove as part of FW-2290. TS complains about us dealing with an enum
// value that is not known (but previously was the value for ViewEncapsulation.Native)
case 1:
case core_js_.ViewEncapsulation.ShadowDom:
// TODO(FW-2290): remove the `case 1:` fallback logic and the warning in v12.
if ((typeof ngDevMode === 'undefined' || ngDevMode) && // @ts-ignore TODO: Remove as part of FW-2290. TS complains about us dealing with an
// enum value that is not known (but previously was the value for
// ViewEncapsulation.Native)
!hasLoggedNativeEncapsulationWarning && type.encapsulation === 1) {
hasLoggedNativeEncapsulationWarning = true;
console.warn('ViewEncapsulation.Native is no longer supported. Falling back to ViewEncapsulation.ShadowDom. The fallback will be removed in v12.');
}
return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
default:
{
if (!this.rendererByCompId.has(type.id)) {
const styles = flattenStyles(type.id, type.styles, []);
this.sharedStylesHost.addStyles(styles);
this.rendererByCompId.set(type.id, this.defaultRenderer);
}
return this.defaultRenderer;
}
}
}
begin() {}
end() {}
}
DomRendererFactory2.ɵfac = function DomRendererFactory2_Factory(t) {
return new (t || DomRendererFactory2)(core_js_["ɵɵinject"](EventManager), core_js_["ɵɵinject"](DomSharedStylesHost), core_js_["ɵɵinject"](core_js_.APP_ID));
};
DomRendererFactory2.ɵprov = /*@__PURE__*/core_js_["ɵɵdefineInjectable"]({
token: DomRendererFactory2,
factory: DomRendererFactory2.ɵfac
});
return DomRendererFactory2;
})();
/*#__PURE__*/
(function () {
(typeof ngDevMode === "undefined" || ngDevMode) && void 0;
})();
class DefaultDomRenderer2 {
constructor(eventManager) {
this.eventManager = eventManager;
this.data = Object.create(null);
}
destroy() {}
createElement(name, namespace) {
if (namespace) {
// In cases where Ivy (not ViewEngine) is giving us the actual namespace, the look up by key
// will result in undefined, so we just return the namespace here.
return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
}
return document.createElement(name);
}
createComment(value) {
return document.createComment(value);
}
createText(value) {
return document.createTextNode(value);
}
appendChild(parent, newChild) {
parent.appendChild(newChild);
}
insertBefore(parent, newChild, refChild) {
if (parent) {
parent.insertBefore(newChild, refChild);
}
}
removeChild(parent, oldChild) {
if (parent) {
parent.removeChild(oldChild);
}
}
selectRootElement(selectorOrNode, preserveContent) {
let el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) : selectorOrNode;
if (!el) {
throw new Error(`The selector "${selectorOrNode}" did not match any elements`);
}
if (!preserveContent) {
el.textContent = '';
}
return el;
}
parentNode(node) {
return node.parentNode;
}
nextSibling(node) {
return node.nextSibling;
}
setAttribute(el, name, value, namespace) {
if (namespace) {
name = namespace + ':' + name; // TODO(FW-811): Ivy may cause issues here because it's passing around
// full URIs for namespaces, therefore this lookup will fail.
const namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.setAttributeNS(namespaceUri, name, value);
} else {
el.setAttribute(name, value);
}
} else {
el.setAttribute(name, value);
}
}
removeAttribute(el, name, namespace) {
if (namespace) {
// TODO(FW-811): Ivy may cause issues here because it's passing around
// full URIs for namespaces, therefore this lookup will fail.
const namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.removeAttributeNS(namespaceUri, name);
} else {
// TODO(FW-811): Since ivy is passing around full URIs for namespaces
// this could result in properties like `http://www.w3.org/2000/svg:cx="123"`,
// which is wrong.
el.removeAttribute(`${namespace}:${name}`);
}
} else {
el.removeAttribute(name);
}
}
addClass(el, name) {
el.classList.add(name);
}
removeClass(el, name) {
el.classList.remove(name);
}
setStyle(el, style, value, flags) {
if (flags & (core_js_.RendererStyleFlags2.DashCase | core_js_.RendererStyleFlags2.Important)) {
el.style.setProperty(style, value, flags & core_js_.RendererStyleFlags2.Important ? 'important' : '');
} else {
el.style[style] = value;
}
}
removeStyle(el, style, flags) {
if (flags & core_js_.RendererStyleFlags2.DashCase) {
el.style.removeProperty(style);
} else {
// IE requires '' instead of null
// see https://github.com/angular/angular/issues/7916
el.style[style] = '';
}
}
setProperty(el, name, value) {
NG_DEV_MODE && checkNoSyntheticProp(name, 'property');
el[name] = value;
}
setValue(node, value) {
node.nodeValue = value;
}
listen(target, event, callback) {
NG_DEV_MODE && checkNoSyntheticProp(event, 'listener');
if (typeof target === 'string') {
return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
}
return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
}
}
const ɵ0$1 = () => '@'.charCodeAt(0);
const AT_CHARCODE = /*#__PURE__*/ɵ0$1();
function checkNoSyntheticProp(name, nameKind) {
if (name.charCodeAt(0) === AT_CHARCODE) {
throw new Error(`Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
- Either \`BrowserAnimationsModule\` or \`NoopAnimationsModule\` are imported in your application.
- 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).`);
}
}
class EmulatedEncapsulationDomRenderer2 extends DefaultDomRenderer2 {
constructor(eventManager, sharedStylesHost, component, appId) {
super(eventManager);
this.component = component;
const styles = flattenStyles(appId + '-' + component.id, component.styles, []);
sharedStylesHost.addStyles(styles);
this.contentAttr = shimContentAttribute(appId + '-' + component.id);
this.hostAttr = shimHostAttribute(appId + '-' + component.id);
}
applyToHost(element) {
super.setAttribute(element, this.hostAttr, '');
}
createElement(parent, name) {
const el = super.createElement(parent, name);
super.setAttribute(el, this.contentAttr, '');
return el;
}
}
class ShadowDomRenderer extends DefaultDomRenderer2 {
constructor(eventManager, sharedStylesHost, hostEl, component) {
super(eventManager);
this.sharedStylesHost = sharedStylesHost;