lwc 2.28.1 → 2.30.0

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 (37) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +319 -683
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +319 -683
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +201 -624
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1138 -2843
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +892 -2428
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +319 -683
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +201 -624
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1138 -2843
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +892 -2428
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +204 -584
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +204 -584
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +99 -323
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +99 -323
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +98 -316
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +483 -1220
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +470 -1187
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +99 -323
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +98 -316
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +483 -1220
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +470 -1187
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
  29. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service.js +13 -68
  31. package/dist/wire-service/iife/es5/wire-service_debug.js +13 -68
  32. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  33. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  34. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es5/wire-service.js +13 -68
  36. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -68
  37. package/package.json +7 -7
@@ -2,68 +2,58 @@
2
2
  'use strict';
3
3
 
4
4
  var _create, _create2;
5
-
6
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7
-
8
6
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
9
-
10
7
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
-
12
8
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
-
14
9
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
+
15
11
  /*
16
12
  * Copyright (c) 2018, salesforce.com, inc.
17
13
  * All rights reserved.
18
14
  * SPDX-License-Identifier: MIT
19
15
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
20
16
  */
21
-
22
17
  var assign = Object.assign,
23
- create = Object.create,
24
- defineProperties = Object.defineProperties,
25
- defineProperty = Object.defineProperty,
26
- getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor,
27
- getPrototypeOf = Object.getPrototypeOf,
28
- hasOwnProperty = Object.hasOwnProperty,
29
- setPrototypeOf = Object.setPrototypeOf;
18
+ create = Object.create,
19
+ defineProperties = Object.defineProperties,
20
+ defineProperty = Object.defineProperty,
21
+ getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor,
22
+ getPrototypeOf = Object.getPrototypeOf,
23
+ hasOwnProperty = Object.hasOwnProperty,
24
+ setPrototypeOf = Object.setPrototypeOf;
30
25
  var _Array$prototype = Array.prototype,
31
- ArrayFilter = _Array$prototype.filter,
32
- ArrayFind = _Array$prototype.find,
33
- ArrayIndexOf = _Array$prototype.indexOf,
34
- ArrayMap = _Array$prototype.map,
35
- ArrayPush = _Array$prototype.push,
36
- ArrayReduce = _Array$prototype.reduce,
37
- ArrayReverse = _Array$prototype.reverse,
38
- ArraySlice = _Array$prototype.slice,
39
- ArraySplice = _Array$prototype.splice,
40
- forEach = _Array$prototype.forEach;
26
+ ArrayFilter = _Array$prototype.filter,
27
+ ArrayFind = _Array$prototype.find,
28
+ ArrayIndexOf = _Array$prototype.indexOf,
29
+ ArrayMap = _Array$prototype.map,
30
+ ArrayPush = _Array$prototype.push,
31
+ ArrayReduce = _Array$prototype.reduce,
32
+ ArrayReverse = _Array$prototype.reverse,
33
+ ArraySlice = _Array$prototype.slice,
34
+ ArraySplice = _Array$prototype.splice,
35
+ forEach = _Array$prototype.forEach;
41
36
  var _String$prototype = String.prototype,
42
- StringCharCodeAt = _String$prototype.charCodeAt;
43
-
37
+ StringCharCodeAt = _String$prototype.charCodeAt;
44
38
  function isUndefined(obj) {
45
39
  return obj === undefined;
46
40
  }
47
-
48
41
  function isNull(obj) {
49
42
  return obj === null;
50
43
  }
51
-
52
44
  function isTrue(obj) {
53
45
  return obj === true;
54
46
  }
55
-
56
47
  function isFalse(obj) {
57
48
  return obj === false;
58
49
  }
59
-
60
50
  function isFunction(obj) {
61
51
  return typeof obj === 'function';
62
52
  }
63
-
64
53
  function isObject(obj) {
65
54
  return _typeof(obj) === 'object';
66
55
  }
56
+
67
57
  /*
68
58
  * Copyright (c) 2018, salesforce.com, inc.
69
59
  * All rights reserved.
@@ -71,16 +61,12 @@
71
61
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
72
62
  */
73
63
  // Inspired from: https://mathiasbynens.be/notes/globalthis
74
-
75
-
76
64
  var _globalThis = /*@__PURE__*/function () {
77
65
  // On recent browsers, `globalThis` is already defined. In this case return it directly.
78
66
  if ((typeof globalThis === "undefined" ? "undefined" : _typeof(globalThis)) === 'object') {
79
67
  return globalThis;
80
68
  }
81
-
82
69
  var _globalThis;
83
-
84
70
  try {
85
71
  // eslint-disable-next-line no-extend-native
86
72
  Object.defineProperty(Object.prototype, '__magic__', {
@@ -88,14 +74,15 @@
88
74
  return this;
89
75
  },
90
76
  configurable: true
91
- }); // __magic__ is undefined in Safari 10 and IE10 and older.
77
+ });
78
+ // __magic__ is undefined in Safari 10 and IE10 and older.
92
79
  // @ts-ignore
93
80
  // eslint-disable-next-line no-undef
94
-
95
- _globalThis = __magic__; // @ts-ignore
96
-
81
+ _globalThis = __magic__;
82
+ // @ts-ignore
97
83
  delete Object.prototype.__magic__;
98
- } catch (ex) {// In IE8, Object.defineProperty only works on DOM objects.
84
+ } catch (ex) {
85
+ // In IE8, Object.defineProperty only works on DOM objects.
99
86
  } finally {
100
87
  // If the magic above fails for some reason we assume that we are in a legacy browser.
101
88
  // Assume `window` exists in this case.
@@ -104,17 +91,15 @@
104
91
  _globalThis = window;
105
92
  }
106
93
  }
107
-
108
94
  return _globalThis;
109
95
  }();
96
+
110
97
  /*
111
98
  * Copyright (c) 2018, salesforce.com, inc.
112
99
  * All rights reserved.
113
100
  * SPDX-License-Identifier: MIT
114
101
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
115
102
  */
116
-
117
-
118
103
  var KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';
119
104
  var KEY__SHADOW_RESOLVER = '$shadowResolver$';
120
105
  var KEY__SHADOW_RESOLVER_PRIVATE = '$$ShadowResolverKey$$';
@@ -123,7 +108,7 @@
123
108
  var KEY__SHADOW_TOKEN = '$shadowToken$';
124
109
  var KEY__SHADOW_TOKEN_PRIVATE = '$$ShadowTokenKey$$';
125
110
  var KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';
126
- /** version: 2.28.1 */
111
+ /** version: 2.30.0 */
127
112
 
128
113
  /*
129
114
  * Copyright (c) 2018, salesforce.com, inc.
@@ -133,25 +118,23 @@
133
118
  */
134
119
  // TODO [#2472]: Remove this workaround when appropriate.
135
120
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
136
-
137
-
138
121
  var _Node = Node;
139
122
  var nodePrototype = _Node.prototype;
140
123
  var DOCUMENT_POSITION_CONTAINED_BY = _Node.DOCUMENT_POSITION_CONTAINED_BY,
141
- DOCUMENT_POSITION_PRECEDING = _Node.DOCUMENT_POSITION_PRECEDING,
142
- DOCUMENT_POSITION_FOLLOWING = _Node.DOCUMENT_POSITION_FOLLOWING,
143
- ELEMENT_NODE = _Node.ELEMENT_NODE,
144
- TEXT_NODE = _Node.TEXT_NODE,
145
- CDATA_SECTION_NODE = _Node.CDATA_SECTION_NODE,
146
- PROCESSING_INSTRUCTION_NODE = _Node.PROCESSING_INSTRUCTION_NODE,
147
- COMMENT_NODE = _Node.COMMENT_NODE;
124
+ DOCUMENT_POSITION_PRECEDING = _Node.DOCUMENT_POSITION_PRECEDING,
125
+ DOCUMENT_POSITION_FOLLOWING = _Node.DOCUMENT_POSITION_FOLLOWING,
126
+ ELEMENT_NODE = _Node.ELEMENT_NODE,
127
+ TEXT_NODE = _Node.TEXT_NODE,
128
+ CDATA_SECTION_NODE = _Node.CDATA_SECTION_NODE,
129
+ PROCESSING_INSTRUCTION_NODE = _Node.PROCESSING_INSTRUCTION_NODE,
130
+ COMMENT_NODE = _Node.COMMENT_NODE;
148
131
  var appendChild = nodePrototype.appendChild,
149
- cloneNode = nodePrototype.cloneNode,
150
- compareDocumentPosition = nodePrototype.compareDocumentPosition,
151
- insertBefore = nodePrototype.insertBefore,
152
- removeChild = nodePrototype.removeChild,
153
- replaceChild = nodePrototype.replaceChild,
154
- hasChildNodes = nodePrototype.hasChildNodes;
132
+ cloneNode = nodePrototype.cloneNode,
133
+ compareDocumentPosition = nodePrototype.compareDocumentPosition,
134
+ insertBefore = nodePrototype.insertBefore,
135
+ removeChild = nodePrototype.removeChild,
136
+ replaceChild = nodePrototype.replaceChild,
137
+ hasChildNodes = nodePrototype.hasChildNodes;
155
138
  var contains = HTMLElement.prototype.contains;
156
139
  var firstChildGetter = getOwnPropertyDescriptor(nodePrototype, 'firstChild').get;
157
140
  var lastChildGetter = getOwnPropertyDescriptor(nodePrototype, 'lastChild').get;
@@ -159,35 +142,34 @@
159
142
  var parentNodeGetter = getOwnPropertyDescriptor(nodePrototype, 'parentNode').get;
160
143
  var ownerDocumentGetter = getOwnPropertyDescriptor(nodePrototype, 'ownerDocument').get;
161
144
  var parentElementGetter = hasOwnProperty.call(nodePrototype, 'parentElement') ? getOwnPropertyDescriptor(nodePrototype, 'parentElement').get : getOwnPropertyDescriptor(HTMLElement.prototype, 'parentElement').get; // IE11
162
-
163
145
  var textContextSetter = getOwnPropertyDescriptor(nodePrototype, 'textContent').set;
164
146
  var childNodesGetter = hasOwnProperty.call(nodePrototype, 'childNodes') ? getOwnPropertyDescriptor(nodePrototype, 'childNodes').get : getOwnPropertyDescriptor(HTMLElement.prototype, 'childNodes').get; // IE11
165
-
166
147
  var isConnected = hasOwnProperty.call(nodePrototype, 'isConnected') ? getOwnPropertyDescriptor(nodePrototype, 'isConnected').get : function () {
167
- var doc = ownerDocumentGetter.call(this); // IE11
168
-
169
- return (// if doc is null, it means `this` is actually a document instance which
148
+ var doc = ownerDocumentGetter.call(this);
149
+ // IE11
150
+ return (
151
+ // if doc is null, it means `this` is actually a document instance which
170
152
  // is always connected
171
153
  doc === null || (compareDocumentPosition.call(doc, this) & DOCUMENT_POSITION_CONTAINED_BY) !== 0
172
154
  );
173
155
  };
156
+
174
157
  /*
175
158
  * Copyright (c) 2018, salesforce.com, inc.
176
159
  * All rights reserved.
177
160
  * SPDX-License-Identifier: MIT
178
161
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
179
162
  */
180
-
181
163
  var _Element$prototype = Element.prototype,
182
- getAttribute = _Element$prototype.getAttribute,
183
- getBoundingClientRect = _Element$prototype.getBoundingClientRect,
184
- getElementsByTagName$1 = _Element$prototype.getElementsByTagName,
185
- getElementsByTagNameNS$1 = _Element$prototype.getElementsByTagNameNS,
186
- hasAttribute = _Element$prototype.hasAttribute,
187
- querySelector = _Element$prototype.querySelector,
188
- querySelectorAll$1 = _Element$prototype.querySelectorAll,
189
- removeAttribute = _Element$prototype.removeAttribute,
190
- setAttribute = _Element$prototype.setAttribute;
164
+ getAttribute = _Element$prototype.getAttribute,
165
+ getBoundingClientRect = _Element$prototype.getBoundingClientRect,
166
+ getElementsByTagName$1 = _Element$prototype.getElementsByTagName,
167
+ getElementsByTagNameNS$1 = _Element$prototype.getElementsByTagNameNS,
168
+ hasAttribute = _Element$prototype.hasAttribute,
169
+ querySelector = _Element$prototype.querySelector,
170
+ querySelectorAll$1 = _Element$prototype.querySelectorAll,
171
+ removeAttribute = _Element$prototype.removeAttribute,
172
+ setAttribute = _Element$prototype.setAttribute;
191
173
  var attachShadow$1 = hasOwnProperty.call(Element.prototype, 'attachShadow') ? Element.prototype.attachShadow : function () {
192
174
  throw new TypeError('attachShadow() is not supported in current browser. Load the @lwc/synthetic-shadow polyfill and use Lightning Web Components');
193
175
  };
@@ -196,17 +178,15 @@
196
178
  var lastElementChildGetter = getOwnPropertyDescriptor(Element.prototype, 'lastElementChild').get;
197
179
  var innerTextDescriptor = getOwnPropertyDescriptor(HTMLElement.prototype, 'innerText');
198
180
  var innerTextGetter = innerTextDescriptor ? innerTextDescriptor.get : null;
199
- var innerTextSetter = innerTextDescriptor ? innerTextDescriptor.set : null; // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
200
-
181
+ var innerTextSetter = innerTextDescriptor ? innerTextDescriptor.set : null;
182
+ // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
201
183
  var outerTextDescriptor = getOwnPropertyDescriptor(HTMLElement.prototype, 'outerText');
202
184
  var outerTextGetter = outerTextDescriptor ? outerTextDescriptor.get : null;
203
185
  var outerTextSetter = outerTextDescriptor ? outerTextDescriptor.set : null;
204
186
  var innerHTMLDescriptor = hasOwnProperty.call(Element.prototype, 'innerHTML') ? getOwnPropertyDescriptor(Element.prototype, 'innerHTML') : getOwnPropertyDescriptor(HTMLElement.prototype, 'innerHTML'); // IE11
205
-
206
187
  var innerHTMLGetter = innerHTMLDescriptor.get;
207
188
  var innerHTMLSetter = innerHTMLDescriptor.set;
208
189
  var outerHTMLDescriptor = hasOwnProperty.call(Element.prototype, 'outerHTML') ? getOwnPropertyDescriptor(Element.prototype, 'outerHTML') : getOwnPropertyDescriptor(HTMLElement.prototype, 'outerHTML'); // IE11
209
-
210
190
  var outerHTMLGetter = outerHTMLDescriptor.get;
211
191
  var outerHTMLSetter = outerHTMLDescriptor.set;
212
192
  var tagNameGetter = getOwnPropertyDescriptor(Element.prototype, 'tagName').get;
@@ -214,11 +194,9 @@
214
194
  var tabIndexGetter = tabIndexDescriptor.get;
215
195
  var tabIndexSetter = tabIndexDescriptor.set;
216
196
  var matches = hasOwnProperty.call(Element.prototype, 'matches') ? Element.prototype.matches : Element.prototype.msMatchesSelector; // IE11
217
-
218
197
  var childrenGetter = hasOwnProperty.call(Element.prototype, 'children') ? getOwnPropertyDescriptor(Element.prototype, 'children').get : getOwnPropertyDescriptor(HTMLElement.prototype, 'children').get; // IE11
219
198
  // for IE11, access from HTMLElement
220
199
  // for all other browsers access the method from the parent Element interface
221
-
222
200
  var getElementsByClassName$1 = HTMLElement.prototype.getElementsByClassName;
223
201
  var shadowRootGetter = hasOwnProperty.call(Element.prototype, 'shadowRoot') ? getOwnPropertyDescriptor(Element.prototype, 'shadowRoot').get : function () {
224
202
  return null;
@@ -226,15 +204,14 @@
226
204
  var assignedSlotGetter$1 = hasOwnProperty.call(Element.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Element.prototype, 'assignedSlot').get : function () {
227
205
  return null;
228
206
  };
207
+
229
208
  /*
230
209
  * Copyright (c) 2018, salesforce.com, inc.
231
210
  * All rights reserved.
232
211
  * SPDX-License-Identifier: MIT
233
212
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
234
213
  */
235
-
236
214
  var assignedNodes, assignedElements;
237
-
238
215
  if (typeof HTMLSlotElement !== 'undefined') {
239
216
  assignedNodes = HTMLSlotElement.prototype.assignedNodes;
240
217
  assignedElements = HTMLSlotElement.prototype.assignedElements;
@@ -242,64 +219,61 @@
242
219
  assignedNodes = function assignedNodes() {
243
220
  throw new TypeError("assignedNodes() is not supported in current browser. Load the @lwc/synthetic-shadow polyfill to start using <slot> elements in your Lightning Web Component's template");
244
221
  };
245
-
246
222
  assignedElements = function assignedElements() {
247
223
  throw new TypeError("assignedElements() is not supported in current browser. Load the @lwc/synthetic-shadow polyfill to start using <slot> elements in your Lightning Web Component's template");
248
224
  };
249
225
  }
226
+
250
227
  /*
251
228
  * Copyright (c) 2018, salesforce.com, inc.
252
229
  * All rights reserved.
253
230
  * SPDX-License-Identifier: MIT
254
231
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
255
232
  */
256
-
257
-
258
233
  var eventTargetGetter = getOwnPropertyDescriptor(Event.prototype, 'target').get;
259
234
  var eventCurrentTargetGetter = getOwnPropertyDescriptor(Event.prototype, 'currentTarget').get;
260
- var focusEventRelatedTargetGetter = getOwnPropertyDescriptor(FocusEvent.prototype, 'relatedTarget').get; // IE does not implement composedPath() but that's ok because we only use this instead of our
235
+ var focusEventRelatedTargetGetter = getOwnPropertyDescriptor(FocusEvent.prototype, 'relatedTarget').get;
236
+ // IE does not implement composedPath() but that's ok because we only use this instead of our
261
237
  // composedPath() polyfill when dealing with native shadow DOM components in mixed mode. Defaulting
262
238
  // to a NOOP just to be safe, even though this is almost guaranteed to be defined such a scenario.
263
-
264
239
  var composedPath = hasOwnProperty.call(Event.prototype, 'composedPath') ? Event.prototype.composedPath : function () {
265
240
  return [];
266
241
  };
242
+
267
243
  /*
268
244
  * Copyright (c) 2018, salesforce.com, inc.
269
245
  * All rights reserved.
270
246
  * SPDX-License-Identifier: MIT
271
247
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
272
248
  */
273
-
274
249
  var DocumentPrototypeActiveElement = getOwnPropertyDescriptor(Document.prototype, 'activeElement').get;
275
250
  var elementFromPoint = hasOwnProperty.call(Document.prototype, 'elementFromPoint') ? Document.prototype.elementFromPoint : Document.prototype.msElementFromPoint; // IE11
276
-
277
251
  var elementsFromPoint = hasOwnProperty.call(Document.prototype, 'elementsFromPoint') ? Document.prototype.elementsFromPoint : Document.prototype.msElementsFromPoint; // IE11
278
252
  // defaultView can be null when a document has no browsing context. For example, the owner document
279
253
  // of a node in a template doesn't have a default view: https://jsfiddle.net/hv9z0q5a/
280
-
281
254
  var defaultViewGetter = getOwnPropertyDescriptor(Document.prototype, 'defaultView').get;
282
255
  var _Document$prototype = Document.prototype,
283
- querySelectorAll = _Document$prototype.querySelectorAll,
284
- getElementById = _Document$prototype.getElementById,
285
- getElementsByClassName = _Document$prototype.getElementsByClassName,
286
- getElementsByTagName = _Document$prototype.getElementsByTagName,
287
- getElementsByTagNameNS = _Document$prototype.getElementsByTagNameNS; // In Firefox v57 and lower, getElementsByName is defined on HTMLDocument.prototype
256
+ querySelectorAll = _Document$prototype.querySelectorAll,
257
+ getElementById = _Document$prototype.getElementById,
258
+ getElementsByClassName = _Document$prototype.getElementsByClassName,
259
+ getElementsByTagName = _Document$prototype.getElementsByTagName,
260
+ getElementsByTagNameNS = _Document$prototype.getElementsByTagNameNS;
261
+ // In Firefox v57 and lower, getElementsByName is defined on HTMLDocument.prototype
288
262
  // In all other browsers have the method on Document.prototype
289
-
290
263
  var getElementsByName = HTMLDocument.prototype.getElementsByName;
264
+
291
265
  /*
292
266
  * Copyright (c) 2018, salesforce.com, inc.
293
267
  * All rights reserved.
294
268
  * SPDX-License-Identifier: MIT
295
269
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
296
270
  */
297
-
298
271
  var _window = window,
299
- windowAddEventListener = _window.addEventListener,
300
- windowRemoveEventListener = _window.removeEventListener,
301
- windowGetComputedStyle = _window.getComputedStyle,
302
- windowGetSelection = _window.getSelection;
272
+ windowAddEventListener = _window.addEventListener,
273
+ windowRemoveEventListener = _window.removeEventListener,
274
+ windowGetComputedStyle = _window.getComputedStyle,
275
+ windowGetSelection = _window.getSelection;
276
+
303
277
  /*
304
278
  * Copyright (c) 2018, salesforce.com, inc.
305
279
  * All rights reserved.
@@ -309,91 +283,82 @@
309
283
  // There is code in the polyfills that requires access to the unpatched
310
284
  // Mutation Observer constructor, this the code for that.
311
285
  // Eventually, the polyfill should uses the patched version, and this file can be removed.
312
-
313
286
  var MO = MutationObserver;
314
287
  var MutationObserverObserve = MO.prototype.observe;
288
+
315
289
  /*
316
290
  * Copyright (c) 2018, salesforce.com, inc.
317
291
  * All rights reserved.
318
292
  * SPDX-License-Identifier: MIT
319
293
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
320
294
  */
321
-
322
295
  var NativeShadowRoot = null;
323
-
324
296
  if (typeof ShadowRoot !== 'undefined') {
325
297
  NativeShadowRoot = ShadowRoot;
326
298
  }
327
-
328
299
  var isNativeShadowRootDefined = !isNull(NativeShadowRoot);
329
300
  var isInstanceOfNativeShadowRoot = isNull(NativeShadowRoot) ? function () {
330
301
  return false;
331
302
  } : function (node) {
332
303
  return node instanceof NativeShadowRoot;
333
304
  };
305
+
334
306
  /*
335
307
  * Copyright (c) 2018, salesforce.com, inc.
336
308
  * All rights reserved.
337
309
  * SPDX-License-Identifier: MIT
338
310
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
339
311
  */
340
-
341
312
  function detect$4() {
342
313
  return typeof HTMLSlotElement === 'undefined';
343
314
  }
315
+
344
316
  /*
345
317
  * Copyright (c) 2018, salesforce.com, inc.
346
318
  * All rights reserved.
347
319
  * SPDX-License-Identifier: MIT
348
320
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
349
321
  */
350
-
351
-
352
322
  var createElement = Document.prototype.createElement;
353
323
  var CHAR_S = 115;
354
324
  var CHAR_L = 108;
355
325
  var CHAR_O = 111;
356
326
  var CHAR_T = 116;
357
-
358
327
  function apply$4() {
359
328
  // IE11 does not have this element definition
360
329
  // we don't care much about the construction phase, just the prototype
361
330
  var HTMLSlotElement = /*#__PURE__*/_createClass(function HTMLSlotElement() {
362
331
  _classCallCheck(this, HTMLSlotElement);
363
332
  }); // prototype inheritance dance
364
-
365
-
366
333
  setPrototypeOf(HTMLSlotElement, HTMLElement.constructor);
367
334
  setPrototypeOf(HTMLSlotElement.prototype, HTMLElement.prototype);
368
- Window.prototype.HTMLSlotElement = HTMLSlotElement; // IE11 doesn't have HTMLSlotElement, in which case we
335
+ Window.prototype.HTMLSlotElement = HTMLSlotElement;
336
+ // IE11 doesn't have HTMLSlotElement, in which case we
369
337
  // need to patch Document.prototype.createElement to remap `slot`
370
338
  // elements to the right prototype
371
-
372
339
  defineProperty(Document.prototype, 'createElement', {
373
340
  value: function value(tagName, _options) {
374
341
  var elm = createElement.apply(this, ArraySlice.call(arguments));
375
-
376
342
  if (tagName.length === 4 && StringCharCodeAt.call(tagName, 0) === CHAR_S && StringCharCodeAt.call(tagName, 1) === CHAR_L && StringCharCodeAt.call(tagName, 2) === CHAR_O && StringCharCodeAt.call(tagName, 3) === CHAR_T) {
377
343
  // the new element is the `slot`, resetting the proto chain
378
344
  // the new newly created global HTMLSlotElement.prototype
379
345
  setPrototypeOf(elm, HTMLSlotElement.prototype);
380
346
  }
381
-
382
347
  return elm;
383
348
  }
384
349
  });
385
350
  }
351
+
386
352
  /*
387
353
  * Copyright (c) 2018, salesforce.com, inc.
388
354
  * All rights reserved.
389
355
  * SPDX-License-Identifier: MIT
390
356
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
391
357
  */
392
-
393
-
394
358
  if (detect$4()) {
395
359
  apply$4();
396
360
  }
361
+
397
362
  /*
398
363
  * Copyright (c) 2018, salesforce.com, inc.
399
364
  * All rights reserved.
@@ -401,29 +366,23 @@
401
366
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
402
367
  */
403
368
  // Helpful for tests running with jsdom
404
-
405
-
406
369
  function getOwnerDocument(node) {
407
- var doc = ownerDocumentGetter.call(node); // if doc is null, it means `this` is actually a document instance
408
-
370
+ var doc = ownerDocumentGetter.call(node);
371
+ // if doc is null, it means `this` is actually a document instance
409
372
  return doc === null ? node : doc;
410
373
  }
411
-
412
374
  function getOwnerWindow(node) {
413
375
  var doc = getOwnerDocument(node);
414
376
  var win = defaultViewGetter.call(doc);
415
-
416
377
  if (win === null) {
417
378
  // this method should never be called with a node that is not part
418
379
  // of a qualifying connected node.
419
380
  throw new TypeError();
420
381
  }
421
-
422
382
  return win;
423
383
  }
424
-
425
- var skipGlobalPatching; // TODO [#1222]: remove global bypass
426
-
384
+ var skipGlobalPatching;
385
+ // TODO [#1222]: remove global bypass
427
386
  function isGlobalPatchingSkipped(node) {
428
387
  // we lazily compute this value instead of doing it during evaluation, this helps
429
388
  // for apps that are setting this after the engine code is evaluated.
@@ -431,46 +390,40 @@
431
390
  var ownerDocument = getOwnerDocument(node);
432
391
  skipGlobalPatching = ownerDocument.body && getAttribute.call(ownerDocument.body, 'data-global-patching-bypass') === 'temporary-bypass';
433
392
  }
434
-
435
393
  return isTrue(skipGlobalPatching);
436
394
  }
437
-
438
395
  function arrayFromCollection(collection) {
439
396
  var size = collection.length;
440
397
  var cloned = [];
441
-
442
398
  if (size > 0) {
443
399
  for (var i = 0; i < size; i++) {
444
400
  cloned[i] = collection[i];
445
401
  }
446
402
  }
447
-
448
403
  return cloned;
449
404
  }
405
+
450
406
  /*
451
407
  * Copyright (c) 2018, salesforce.com, inc.
452
408
  * All rights reserved.
453
409
  * SPDX-License-Identifier: MIT
454
410
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
455
411
  */
456
-
457
-
458
412
  var eventTargetPrototype = typeof EventTarget !== 'undefined' ? EventTarget.prototype : _Node.prototype;
459
413
  var addEventListener = eventTargetPrototype.addEventListener,
460
- dispatchEvent = eventTargetPrototype.dispatchEvent,
461
- removeEventListener = eventTargetPrototype.removeEventListener;
414
+ dispatchEvent = eventTargetPrototype.dispatchEvent,
415
+ removeEventListener = eventTargetPrototype.removeEventListener;
416
+
462
417
  /**
463
418
  * Copyright (C) 2018 salesforce.com, inc.
464
419
  */
465
-
466
420
  if (!_globalThis.lwcRuntimeFlags) {
467
421
  Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
468
422
  value: create(null)
469
423
  });
470
424
  }
471
-
472
425
  var lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
473
- /** version: 2.28.1 */
426
+ /** version: 2.30.0 */
474
427
 
475
428
  /*
476
429
  * Copyright (c) 2018, salesforce.com, inc.
@@ -478,51 +431,42 @@
478
431
  * SPDX-License-Identifier: MIT
479
432
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
480
433
  */
481
-
434
+ // Used as a back reference to identify the host element
482
435
  var HostElementKey = '$$HostElementKey$$';
483
436
  var ShadowedNodeKey = '$$ShadowedNodeKey$$';
484
-
485
437
  function fastDefineProperty(node, propName, config) {
486
438
  var shadowedNode = node;
487
-
488
439
  {
489
- var value = config.value; // in prod, we prioritize performance
490
-
440
+ var value = config.value;
441
+ // in prod, we prioritize performance
491
442
  shadowedNode[propName] = value;
492
443
  }
493
444
  }
494
-
495
445
  function setNodeOwnerKey(node, value) {
496
446
  fastDefineProperty(node, HostElementKey, {
497
447
  value: value,
498
448
  configurable: true
499
449
  });
500
450
  }
501
-
502
451
  function setNodeKey(node, value) {
503
452
  fastDefineProperty(node, ShadowedNodeKey, {
504
453
  value: value
505
454
  });
506
455
  }
507
-
508
456
  function getNodeOwnerKey(node) {
509
457
  return node[HostElementKey];
510
458
  }
511
-
512
459
  function getNodeNearestOwnerKey(node) {
513
460
  var host = node;
514
- var hostKey; // search for the first element with owner identity
461
+ var hostKey;
462
+ // search for the first element with owner identity
515
463
  // in case of manually inserted elements and elements slotted from Light DOM
516
-
517
464
  while (!isNull(host)) {
518
465
  hostKey = getNodeOwnerKey(host);
519
-
520
466
  if (!isUndefined(hostKey)) {
521
467
  return hostKey;
522
468
  }
523
-
524
469
  host = parentNodeGetter.call(host);
525
-
526
470
  if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
527
471
  if (!isNull(host) && isSyntheticSlotElement(host)) {
528
472
  return undefined;
@@ -530,7 +474,6 @@
530
474
  }
531
475
  }
532
476
  }
533
-
534
477
  function getNodeKey(node) {
535
478
  return node[ShadowedNodeKey];
536
479
  }
@@ -539,42 +482,34 @@
539
482
  * cases. If we need to traverse up and verify those nodes that don't have owner key, use
540
483
  * isNodeDeepShadowed instead.
541
484
  */
542
-
543
-
544
485
  function isNodeShadowed(node) {
545
486
  return !isUndefined(getNodeOwnerKey(node));
546
487
  }
488
+
547
489
  /*
548
490
  * Copyright (c) 2018, salesforce.com, inc.
549
491
  * All rights reserved.
550
492
  * SPDX-License-Identifier: MIT
551
493
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
552
494
  */
495
+ // when finding a slot in the DOM, we can fold it if it is contained
553
496
  // inside another slot.
554
-
555
-
556
497
  function foldSlotElement(slot) {
557
498
  var parent = parentElementGetter.call(slot);
558
-
559
499
  while (!isNull(parent) && isSlotElement(parent)) {
560
500
  slot = parent;
561
501
  parent = parentElementGetter.call(slot);
562
502
  }
563
-
564
503
  return slot;
565
504
  }
566
-
567
505
  function isNodeSlotted(host, node) {
568
-
569
- var hostKey = getNodeKey(host); // this routine assumes that the node is coming from a different shadow (it is not owned by the host)
506
+ var hostKey = getNodeKey(host);
507
+ // this routine assumes that the node is coming from a different shadow (it is not owned by the host)
570
508
  // just in case the provided node is not an element
571
-
572
509
  var currentElement = node instanceof Element ? node : parentElementGetter.call(node);
573
-
574
510
  while (!isNull(currentElement) && currentElement !== host) {
575
511
  var elmOwnerKey = getNodeNearestOwnerKey(currentElement);
576
512
  var parent = parentElementGetter.call(currentElement);
577
-
578
513
  if (elmOwnerKey === hostKey) {
579
514
  // we have reached an element inside the host's template, and only if
580
515
  // that element is an slot, then the node is considered slotted
@@ -600,7 +535,6 @@
600
535
  * most outer slot parent before jumping into its corresponding host.
601
536
  */
602
537
  currentElement = getNodeOwner(foldSlotElement(parent));
603
-
604
538
  if (!isNull(currentElement)) {
605
539
  if (currentElement === host) {
606
540
  // the slot element is a top level element inside the shadow
@@ -619,197 +553,156 @@
619
553
  currentElement = parent;
620
554
  }
621
555
  }
622
-
623
556
  return false;
624
557
  }
625
-
626
558
  function getNodeOwner(node) {
627
559
  if (!(node instanceof _Node)) {
628
560
  return null;
629
561
  }
630
-
631
562
  var ownerKey = getNodeNearestOwnerKey(node);
632
-
633
563
  if (isUndefined(ownerKey)) {
634
564
  return null;
635
565
  }
636
-
637
- var nodeOwner = node; // At this point, node is a valid node with owner identity, now we need to find the owner node
566
+ var nodeOwner = node;
567
+ // At this point, node is a valid node with owner identity, now we need to find the owner node
638
568
  // search for a custom element with a VM that owns the first element with owner identity attached to it
639
-
640
569
  while (!isNull(nodeOwner) && getNodeKey(nodeOwner) !== ownerKey) {
641
570
  nodeOwner = parentNodeGetter.call(nodeOwner);
642
571
  }
643
-
644
572
  if (isNull(nodeOwner)) {
645
573
  return null;
646
574
  }
647
-
648
575
  return nodeOwner;
649
576
  }
650
-
651
577
  function isSyntheticSlotElement(node) {
652
578
  return isSlotElement(node) && isNodeShadowed(node);
653
579
  }
654
-
655
580
  function isSlotElement(node) {
656
581
  return node instanceof HTMLSlotElement;
657
582
  }
658
-
659
583
  function isNodeOwnedBy(owner, node) {
660
-
661
584
  var ownerKey = getNodeNearestOwnerKey(node);
662
-
663
585
  if (isUndefined(ownerKey)) {
664
586
  if (lwcRuntimeFlags.ENABLE_LIGHT_GET_ROOT_NODE_PATCH) {
665
587
  // in case of root level light DOM element slotting into a synthetic shadow
666
588
  var host = parentNodeGetter.call(node);
667
-
668
589
  if (!isNull(host) && isSyntheticSlotElement(host)) {
669
590
  return false;
670
591
  }
671
- } // in case of manually inserted elements
672
-
673
-
592
+ }
593
+ // in case of manually inserted elements
674
594
  return true;
675
595
  }
676
-
677
596
  return getNodeKey(owner) === ownerKey;
678
597
  }
679
-
680
598
  function shadowRootChildNodes(root) {
681
599
  var elm = getHost(root);
682
600
  return getAllMatches(elm, arrayFromCollection(childNodesGetter.call(elm)));
683
601
  }
684
-
685
602
  function getAllSlottedMatches(host, nodeList) {
686
603
  var filteredAndPatched = [];
687
-
688
604
  for (var i = 0, len = nodeList.length; i < len; i += 1) {
689
605
  var node = nodeList[i];
690
-
691
606
  if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
692
607
  ArrayPush.call(filteredAndPatched, node);
693
608
  }
694
609
  }
695
-
696
610
  return filteredAndPatched;
697
611
  }
698
-
699
612
  function getFirstSlottedMatch(host, nodeList) {
700
613
  for (var i = 0, len = nodeList.length; i < len; i += 1) {
701
614
  var node = nodeList[i];
702
-
703
615
  if (!isNodeOwnedBy(host, node) && isNodeSlotted(host, node)) {
704
616
  return node;
705
617
  }
706
618
  }
707
-
708
619
  return null;
709
620
  }
710
-
711
621
  function getAllMatches(owner, nodeList) {
712
622
  var filteredAndPatched = [];
713
-
714
623
  for (var i = 0, len = nodeList.length; i < len; i += 1) {
715
624
  var node = nodeList[i];
716
625
  var isOwned = isNodeOwnedBy(owner, node);
717
-
718
626
  if (isOwned) {
719
627
  // Patch querySelector, querySelectorAll, etc
720
628
  // if element is owned by VM
721
629
  ArrayPush.call(filteredAndPatched, node);
722
630
  }
723
631
  }
724
-
725
632
  return filteredAndPatched;
726
633
  }
727
-
728
634
  function getFirstMatch(owner, nodeList) {
729
635
  for (var i = 0, len = nodeList.length; i < len; i += 1) {
730
636
  if (isNodeOwnedBy(owner, nodeList[i])) {
731
637
  return nodeList[i];
732
638
  }
733
639
  }
734
-
735
640
  return null;
736
641
  }
737
-
738
642
  function shadowRootQuerySelector(root, selector) {
739
643
  var elm = getHost(root);
740
644
  var nodeList = arrayFromCollection(querySelectorAll$1.call(elm, selector));
741
645
  return getFirstMatch(elm, nodeList);
742
646
  }
743
-
744
647
  function shadowRootQuerySelectorAll(root, selector) {
745
648
  var elm = getHost(root);
746
649
  var nodeList = querySelectorAll$1.call(elm, selector);
747
650
  return getAllMatches(elm, arrayFromCollection(nodeList));
748
651
  }
749
-
750
652
  function getFilteredChildNodes(node) {
751
653
  if (!isSyntheticShadowHost(node) && !isSlotElement(node)) {
752
654
  // regular element - fast path
753
655
  var children = childNodesGetter.call(node);
754
656
  return arrayFromCollection(children);
755
657
  }
756
-
757
658
  if (isSyntheticShadowHost(node)) {
758
659
  // we need to get only the nodes that were slotted
759
660
  var slots = arrayFromCollection(querySelectorAll$1.call(node, 'slot'));
760
- var resolver = getShadowRootResolver(getShadowRoot(node)); // Typescript is inferring the wrong function type for this particular
661
+ var resolver = getShadowRootResolver(getShadowRoot(node));
662
+ // Typescript is inferring the wrong function type for this particular
761
663
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
762
664
  // @ts-ignore type-mismatch
763
-
764
665
  return ArrayReduce.call(slots, function (seed, slot) {
765
666
  if (resolver === getShadowRootResolver(slot)) {
766
667
  ArrayPush.apply(seed, getFilteredSlotAssignedNodes(slot));
767
668
  }
768
-
769
669
  return seed;
770
670
  }, []);
771
671
  } else {
772
672
  // slot element
773
673
  var _children = arrayFromCollection(childNodesGetter.call(node));
774
-
775
674
  var _resolver = getShadowRootResolver(node);
776
-
777
675
  return ArrayFilter.call(_children, function (child) {
778
676
  return _resolver === getShadowRootResolver(child);
779
677
  });
780
678
  }
781
679
  }
782
-
783
680
  function getFilteredSlotAssignedNodes(slot) {
784
681
  var owner = getNodeOwner(slot);
785
-
786
682
  if (isNull(owner)) {
787
683
  return [];
788
684
  }
789
-
790
685
  var childNodes = arrayFromCollection(childNodesGetter.call(slot));
791
686
  return ArrayFilter.call(childNodes, function (child) {
792
687
  return !isNodeShadowed(child) || !isNodeOwnedBy(owner, child);
793
688
  });
794
689
  }
690
+
795
691
  /*
796
692
  * Copyright (c) 2018, salesforce.com, inc.
797
693
  * All rights reserved.
798
694
  * SPDX-License-Identifier: MIT
799
695
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
800
696
  */
801
-
802
-
803
697
  function getInnerHTML(node) {
804
698
  var s = '';
805
699
  var childNodes = getFilteredChildNodes(node);
806
-
807
700
  for (var i = 0, len = childNodes.length; i < len; i += 1) {
808
701
  s += getOuterHTML(childNodes[i]);
809
702
  }
810
-
811
703
  return s;
812
704
  }
705
+
813
706
  /*
814
707
  * Copyright (c) 2018, salesforce.com, inc.
815
708
  * All rights reserved.
@@ -817,48 +710,36 @@
817
710
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
818
711
  */
819
712
  // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString
820
-
821
-
822
713
  var escapeAttrRegExp = /[&\u00A0"]/g;
823
714
  var escapeDataRegExp = /[&\u00A0<>]/g;
824
715
  var _String$prototype2 = String.prototype,
825
- replace = _String$prototype2.replace,
826
- toLowerCase = _String$prototype2.toLowerCase;
827
-
716
+ replace = _String$prototype2.replace,
717
+ toLowerCase = _String$prototype2.toLowerCase;
828
718
  function escapeReplace(c) {
829
719
  switch (c) {
830
720
  case '&':
831
721
  return '&amp;';
832
-
833
722
  case '<':
834
723
  return '&lt;';
835
-
836
724
  case '>':
837
725
  return '&gt;';
838
-
839
726
  case '"':
840
727
  return '&quot;';
841
-
842
728
  case "\xA0":
843
729
  return '&nbsp;';
844
-
845
730
  default:
846
731
  return '';
847
732
  }
848
733
  }
849
-
850
734
  function escapeAttr(s) {
851
735
  return replace.call(s, escapeAttrRegExp, escapeReplace);
852
736
  }
853
-
854
737
  function escapeData(s) {
855
738
  return replace.call(s, escapeDataRegExp, escapeReplace);
856
- } // http://www.whatwg.org/specs/web-apps/current-work/#void-elements
857
-
858
-
739
+ }
740
+ // http://www.whatwg.org/specs/web-apps/current-work/#void-elements
859
741
  var voidElements = new Set(['AREA', 'BASE', 'BR', 'COL', 'COMMAND', 'EMBED', 'HR', 'IMG', 'INPUT', 'KEYGEN', 'LINK', 'META', 'PARAM', 'SOURCE', 'TRACK', 'WBR']);
860
742
  var plaintextParents = new Set(['STYLE', 'SCRIPT', 'XMP', 'IFRAME', 'NOEMBED', 'NOFRAMES', 'PLAINTEXT', 'NOSCRIPT']);
861
-
862
743
  function getOuterHTML(node) {
863
744
  switch (node.nodeType) {
864
745
  case ELEMENT_NODE:
@@ -866,47 +747,36 @@
866
747
  var attrs = node.attributes;
867
748
  var tagName = tagNameGetter.call(node);
868
749
  var s = '<' + toLowerCase.call(tagName);
869
-
870
750
  for (var i = 0, attr; attr = attrs[i]; i++) {
871
751
  s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
872
752
  }
873
-
874
753
  s += '>';
875
-
876
754
  if (voidElements.has(tagName)) {
877
755
  return s;
878
756
  }
879
-
880
757
  return s + getInnerHTML(node) + '</' + toLowerCase.call(tagName) + '>';
881
758
  }
882
-
883
759
  case TEXT_NODE:
884
760
  {
885
761
  var data = node.data,
886
- parentNode = node.parentNode;
887
-
762
+ parentNode = node.parentNode;
888
763
  if (parentNode instanceof Element && plaintextParents.has(tagNameGetter.call(parentNode))) {
889
764
  return data;
890
765
  }
891
-
892
766
  return escapeData(data);
893
767
  }
894
-
895
768
  case CDATA_SECTION_NODE:
896
769
  {
897
770
  return "<!CDATA[[".concat(node.data, "]]>");
898
771
  }
899
-
900
772
  case PROCESSING_INSTRUCTION_NODE:
901
773
  {
902
774
  return "<?".concat(node.target, " ").concat(node.data, "?>");
903
775
  }
904
-
905
776
  case COMMENT_NODE:
906
777
  {
907
778
  return "<!--".concat(node.data, "-->");
908
779
  }
909
-
910
780
  default:
911
781
  {
912
782
  // intentionally ignoring unknown node types
@@ -916,50 +786,42 @@
916
786
  }
917
787
  }
918
788
  }
789
+
919
790
  /*
920
791
  * Copyright (c) 2018, salesforce.com, inc.
921
792
  * All rights reserved.
922
793
  * SPDX-License-Identifier: MIT
923
794
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
924
795
  */
925
-
926
-
927
796
  function getTextContent(node) {
928
797
  switch (node.nodeType) {
929
798
  case ELEMENT_NODE:
930
799
  {
931
800
  var childNodes = getFilteredChildNodes(node);
932
801
  var content = '';
933
-
934
802
  for (var i = 0, len = childNodes.length; i < len; i += 1) {
935
803
  var currentNode = childNodes[i];
936
-
937
804
  if (currentNode.nodeType !== COMMENT_NODE) {
938
805
  content += getTextContent(currentNode);
939
806
  }
940
807
  }
941
-
942
808
  return content;
943
809
  }
944
-
945
810
  default:
946
811
  return node.nodeValue;
947
812
  }
948
813
  }
814
+
949
815
  /*
950
816
  * Copyright (c) 2018, salesforce.com, inc.
951
817
  * All rights reserved.
952
818
  * SPDX-License-Identifier: MIT
953
819
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
954
820
  */
955
-
956
-
957
821
  var Items$1 = new WeakMap();
958
-
959
822
  function StaticNodeList() {
960
823
  throw new TypeError('Illegal constructor');
961
824
  }
962
-
963
825
  StaticNodeList.prototype = create(NodeList.prototype, (_create = {
964
826
  constructor: {
965
827
  writable: true,
@@ -1023,7 +885,6 @@
1023
885
  configurable: true,
1024
886
  value: function value() {
1025
887
  var _this = this;
1026
-
1027
888
  var nextIndex = 0;
1028
889
  return {
1029
890
  next: function next() {
@@ -1048,14 +909,13 @@
1048
909
  value: function value() {
1049
910
  return '[object NodeList]';
1050
911
  }
1051
- }), _create)); // prototype inheritance dance
1052
-
912
+ }), _create));
913
+ // prototype inheritance dance
1053
914
  setPrototypeOf(StaticNodeList, NodeList);
1054
-
1055
915
  function createStaticNodeList(items) {
1056
916
  var nodeList = create(StaticNodeList.prototype);
1057
- Items$1.set(nodeList, items); // setting static indexes
1058
-
917
+ Items$1.set(nodeList, items);
918
+ // setting static indexes
1059
919
  forEach.call(items, function (item, index) {
1060
920
  defineProperty(nodeList, index, {
1061
921
  value: item,
@@ -1065,6 +925,7 @@
1065
925
  });
1066
926
  return nodeList;
1067
927
  }
928
+
1068
929
  /*
1069
930
  * Copyright (c) 2018, salesforce.com, inc.
1070
931
  * All rights reserved.
@@ -1072,91 +933,72 @@
1072
933
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1073
934
  */
1074
935
  // Walk up the DOM tree, collecting all shadow roots plus the document root
1075
-
1076
-
1077
936
  function getAllRootNodes(node) {
1078
937
  var _a;
1079
-
1080
938
  var rootNodes = [];
1081
939
  var currentRootNode = node.getRootNode();
1082
-
1083
940
  while (!isUndefined(currentRootNode)) {
1084
941
  rootNodes.push(currentRootNode);
1085
942
  currentRootNode = (_a = currentRootNode.host) === null || _a === void 0 ? void 0 : _a.getRootNode();
1086
943
  }
1087
-
1088
944
  return rootNodes;
1089
- } // Keep searching up the host tree until we find an element that is within the immediate shadow root
1090
-
1091
-
945
+ }
946
+ // Keep searching up the host tree until we find an element that is within the immediate shadow root
1092
947
  var findAncestorHostInImmediateShadowRoot = function findAncestorHostInImmediateShadowRoot(rootNode, targetRootNode) {
1093
948
  var host;
1094
-
1095
949
  while (!isUndefined(host = rootNode.host)) {
1096
950
  var thisRootNode = host.getRootNode();
1097
-
1098
951
  if (thisRootNode === targetRootNode) {
1099
952
  return host;
1100
953
  }
1101
-
1102
954
  rootNode = thisRootNode;
1103
955
  }
1104
956
  };
1105
-
1106
957
  function fauxElementsFromPoint(context, doc, left, top) {
1107
958
  var elements = elementsFromPoint.call(doc, left, top);
1108
959
  var result = [];
1109
- var rootNodes = getAllRootNodes(context); // Filter the elements array to only include those elements that are in this shadow root or in one of its
960
+ var rootNodes = getAllRootNodes(context);
961
+ // Filter the elements array to only include those elements that are in this shadow root or in one of its
1110
962
  // ancestor roots. This matches Chrome and Safari's implementation (but not Firefox's, which only includes
1111
963
  // elements in the immediate shadow root: https://crbug.com/1207863#c4).
1112
-
1113
964
  if (!isNull(elements)) {
1114
965
  // can be null in IE https://developer.mozilla.org/en-US/docs/Web/API/Document/elementsFromPoint#browser_compatibility
1115
966
  for (var i = 0; i < elements.length; i++) {
1116
967
  var element = elements[i];
1117
-
1118
968
  if (isSyntheticSlotElement(element)) {
1119
969
  continue;
1120
970
  }
1121
-
1122
971
  var elementRootNode = element.getRootNode();
1123
-
1124
972
  if (ArrayIndexOf.call(rootNodes, elementRootNode) !== -1) {
1125
973
  ArrayPush.call(result, element);
1126
974
  continue;
1127
- } // In cases where the host element is not visible but its shadow descendants are, then
975
+ }
976
+ // In cases where the host element is not visible but its shadow descendants are, then
1128
977
  // we may get the shadow descendant instead of the host element here. (The
1129
978
  // browser doesn't know the difference in synthetic shadow DOM.)
1130
979
  // In native shadow DOM, however, elementsFromPoint would return the host but not
1131
980
  // the child. So we need to detect if this shadow element's host is accessible from
1132
981
  // the context's shadow root. Note we also need to be careful not to add the host
1133
982
  // multiple times.
1134
-
1135
-
1136
983
  var ancestorHost = findAncestorHostInImmediateShadowRoot(elementRootNode, rootNodes[0]);
1137
-
1138
984
  if (!isUndefined(ancestorHost) && ArrayIndexOf.call(elements, ancestorHost) === -1 && ArrayIndexOf.call(result, ancestorHost) === -1) {
1139
985
  ArrayPush.call(result, ancestorHost);
1140
986
  }
1141
987
  }
1142
988
  }
1143
-
1144
989
  return result;
1145
990
  }
991
+
1146
992
  /*
1147
993
  * Copyright (c) 2018, salesforce.com, inc.
1148
994
  * All rights reserved.
1149
995
  * SPDX-License-Identifier: MIT
1150
996
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1151
997
  */
1152
-
1153
-
1154
998
  var Items = new WeakMap();
1155
-
1156
999
  function StaticHTMLCollection() {
1157
1000
  throw new TypeError('Illegal constructor');
1158
1001
  }
1159
-
1160
1002
  StaticHTMLCollection.prototype = create(HTMLCollection.prototype, (_create2 = {
1161
1003
  constructor: {
1162
1004
  writable: true,
@@ -1187,17 +1029,13 @@
1187
1029
  if (name === '') {
1188
1030
  return null;
1189
1031
  }
1190
-
1191
1032
  var items = Items.get(this);
1192
-
1193
1033
  for (var i = 0, len = items.length; i < len; i++) {
1194
1034
  var item = items[len];
1195
-
1196
1035
  if (name === getAttribute.call(item, 'id') || name === getAttribute.call(item, 'name')) {
1197
1036
  return item;
1198
1037
  }
1199
1038
  }
1200
-
1201
1039
  return null;
1202
1040
  }
1203
1041
  }
@@ -1212,14 +1050,13 @@
1212
1050
  value: function value() {
1213
1051
  return '[object HTMLCollection]';
1214
1052
  }
1215
- }), _create2)); // prototype inheritance dance
1216
-
1053
+ }), _create2));
1054
+ // prototype inheritance dance
1217
1055
  setPrototypeOf(StaticHTMLCollection, HTMLCollection);
1218
-
1219
1056
  function createStaticHTMLCollection(items) {
1220
1057
  var collection = create(StaticHTMLCollection.prototype);
1221
- Items.set(collection, items); // setting static indexes
1222
-
1058
+ Items.set(collection, items);
1059
+ // setting static indexes
1223
1060
  forEach.call(items, function (item, index) {
1224
1061
  defineProperty(collection, index, {
1225
1062
  value: item,
@@ -1229,28 +1066,24 @@
1229
1066
  });
1230
1067
  return collection;
1231
1068
  }
1069
+
1232
1070
  /*
1233
1071
  * Copyright (c) 2018, salesforce.com, inc.
1234
1072
  * All rights reserved.
1235
1073
  * SPDX-License-Identifier: MIT
1236
1074
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1237
1075
  */
1238
-
1239
1076
  /**
1240
1077
  * This method checks whether or not the content of the node is computed
1241
1078
  * based on the light-dom slotting mechanism. This applies to synthetic slot elements
1242
1079
  * and elements with shadow dom attached to them. It doesn't apply to native slot elements
1243
1080
  * because we don't want to patch the children getters for those elements.
1244
1081
  */
1245
-
1246
-
1247
1082
  function hasMountedChildren(node) {
1248
1083
  return isSyntheticSlotElement(node) || isSyntheticShadowHost(node);
1249
1084
  }
1250
-
1251
1085
  function getShadowParent(node, value) {
1252
1086
  var owner = getNodeOwner(node);
1253
-
1254
1087
  if (value === owner) {
1255
1088
  // walking up via parent chain might end up in the shadow root element
1256
1089
  return getShadowRoot(owner);
@@ -1263,64 +1096,50 @@
1263
1096
  // where they slotted into, but its shadowed parent is always the
1264
1097
  // owner of the slot.
1265
1098
  var slotOwner = getNodeOwner(value);
1266
-
1267
1099
  if (!isNull(slotOwner) && isNodeOwnedBy(owner, slotOwner)) {
1268
1100
  // it is a slotted element, and therefore its parent is always going to be the host of the slot
1269
1101
  return slotOwner;
1270
1102
  }
1271
1103
  }
1272
1104
  }
1273
-
1274
1105
  return null;
1275
1106
  }
1276
-
1277
1107
  function hasChildNodesPatched() {
1278
1108
  return getInternalChildNodes(this).length > 0;
1279
1109
  }
1280
-
1281
1110
  function firstChildGetterPatched() {
1282
1111
  var childNodes = getInternalChildNodes(this);
1283
1112
  return childNodes[0] || null;
1284
1113
  }
1285
-
1286
1114
  function lastChildGetterPatched() {
1287
1115
  var childNodes = getInternalChildNodes(this);
1288
1116
  return childNodes[childNodes.length - 1] || null;
1289
1117
  }
1290
-
1291
1118
  function textContentGetterPatched() {
1292
1119
  return getTextContent(this);
1293
1120
  }
1294
-
1295
1121
  function textContentSetterPatched(value) {
1296
1122
  textContextSetter.call(this, value);
1297
1123
  }
1298
-
1299
1124
  function parentNodeGetterPatched() {
1300
1125
  var value = parentNodeGetter.call(this);
1301
-
1302
1126
  if (isNull(value)) {
1303
1127
  return value;
1304
- } // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1305
-
1306
-
1128
+ }
1129
+ // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1307
1130
  return getShadowParent(this, value);
1308
1131
  }
1309
-
1310
1132
  function parentElementGetterPatched() {
1311
1133
  var value = parentNodeGetter.call(this);
1312
-
1313
1134
  if (isNull(value)) {
1314
1135
  return null;
1315
1136
  }
1316
-
1317
- var parentNode = getShadowParent(this, value); // it could be that the parentNode is the shadowRoot, in which case
1137
+ var parentNode = getShadowParent(this, value);
1138
+ // it could be that the parentNode is the shadowRoot, in which case
1318
1139
  // we need to return null.
1319
1140
  // TODO [#1635]: this needs optimization, maybe implementing it based on this.assignedSlot
1320
-
1321
1141
  return parentNode instanceof Element ? parentNode : null;
1322
1142
  }
1323
-
1324
1143
  function compareDocumentPositionPatched(otherNode) {
1325
1144
  if (this === otherNode) {
1326
1145
  return 0;
@@ -1330,71 +1149,56 @@
1330
1149
  } else if (getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
1331
1150
  // "this" and "otherNode" belongs to 2 different shadow tree.
1332
1151
  return 35; // Node.DOCUMENT_POSITION_DISCONNECTED | Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC | Node.DOCUMENT_POSITION_PRECEDING
1333
- } // Since "this" and "otherNode" are part of the same shadow tree we can safely rely to the native
1152
+ }
1153
+ // Since "this" and "otherNode" are part of the same shadow tree we can safely rely to the native
1334
1154
  // Node.compareDocumentPosition implementation.
1335
-
1336
-
1337
1155
  return compareDocumentPosition.call(this, otherNode);
1338
1156
  }
1339
-
1340
1157
  function containsPatched(otherNode) {
1341
1158
  if (otherNode == null || getNodeOwnerKey(this) !== getNodeOwnerKey(otherNode)) {
1342
1159
  // it is from another shadow
1343
1160
  return false;
1344
1161
  }
1345
-
1346
1162
  return (compareDocumentPosition.call(this, otherNode) & DOCUMENT_POSITION_CONTAINED_BY) !== 0;
1347
1163
  }
1348
-
1349
1164
  function cloneNodePatched(deep) {
1350
- var clone = cloneNode.call(this, false); // Per spec, browsers only care about truthy values
1165
+ var clone = cloneNode.call(this, false);
1166
+ // Per spec, browsers only care about truthy values
1351
1167
  // Not strict true or false
1352
-
1353
1168
  if (!deep) {
1354
1169
  return clone;
1355
1170
  }
1356
-
1357
1171
  var childNodes = getInternalChildNodes(this);
1358
-
1359
1172
  for (var i = 0, len = childNodes.length; i < len; i += 1) {
1360
1173
  clone.appendChild(childNodes[i].cloneNode(true));
1361
1174
  }
1362
-
1363
1175
  return clone;
1364
1176
  }
1365
1177
  /**
1366
1178
  * This method only applies to elements with a shadow or slots
1367
1179
  */
1368
-
1369
-
1370
1180
  function childNodesGetterPatched() {
1371
1181
  if (isSyntheticShadowHost(this)) {
1372
1182
  var owner = getNodeOwner(this);
1373
1183
  var childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
1374
-
1375
1184
  return createStaticNodeList(childNodes);
1376
- } // nothing to do here since this does not have a synthetic shadow attached to it
1185
+ }
1186
+ // nothing to do here since this does not have a synthetic shadow attached to it
1377
1187
  // TODO [#1636]: what about slot elements?
1378
-
1379
-
1380
1188
  return childNodesGetter.call(this);
1381
1189
  }
1382
-
1383
1190
  var nativeGetRootNode = _Node.prototype.getRootNode;
1384
1191
  /**
1385
1192
  * Get the root by climbing up the dom tree, beyond the shadow root
1386
1193
  * If Node.prototype.getRootNode is supported, use it
1387
1194
  * else, assume we are working in non-native shadow mode and climb using parentNode
1388
1195
  */
1389
-
1390
1196
  var getDocumentOrRootNode = !isUndefined(nativeGetRootNode) ? nativeGetRootNode : function () {
1391
1197
  var node = this;
1392
1198
  var nodeParent;
1393
-
1394
1199
  while (!isNull(nodeParent = parentNodeGetter.call(node))) {
1395
1200
  node = nodeParent;
1396
1201
  }
1397
-
1398
1202
  return node;
1399
1203
  };
1400
1204
  /**
@@ -1406,15 +1210,12 @@
1406
1210
  * of a native shadow or the synthetic shadow.
1407
1211
  * @param {Node} node
1408
1212
  */
1409
-
1410
1213
  function getNearestRoot(node) {
1411
1214
  var ownerNode = getNodeOwner(node);
1412
-
1413
1215
  if (isNull(ownerNode)) {
1414
1216
  // we hit a wall, either we are in native shadow mode or the node is not in lwc boundary.
1415
1217
  return getDocumentOrRootNode.call(node);
1416
1218
  }
1417
-
1418
1219
  return getShadowRoot(ownerNode);
1419
1220
  }
1420
1221
  /**
@@ -1436,22 +1237,18 @@
1436
1237
  * _Spec_: https://dom.spec.whatwg.org/#dom-node-getrootnode
1437
1238
  *
1438
1239
  **/
1439
-
1440
-
1441
1240
  function getRootNodePatched(options) {
1442
1241
  var composed = isUndefined(options) ? false : !!options.composed;
1443
1242
  return isTrue(composed) ? getDocumentOrRootNode.call(this, options) : getNearestRoot(this);
1444
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
1243
+ }
1244
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
1445
1245
  // do not give access to nodes beyond the immediate children.
1446
-
1447
-
1448
1246
  defineProperties(_Node.prototype, {
1449
1247
  firstChild: {
1450
1248
  get: function get() {
1451
1249
  if (hasMountedChildren(this)) {
1452
1250
  return firstChildGetterPatched.call(this);
1453
1251
  }
1454
-
1455
1252
  return firstChildGetter.call(this);
1456
1253
  },
1457
1254
  enumerable: true,
@@ -1462,7 +1259,6 @@
1462
1259
  if (hasMountedChildren(this)) {
1463
1260
  return lastChildGetterPatched.call(this);
1464
1261
  }
1465
-
1466
1262
  return lastChildGetter.call(this);
1467
1263
  },
1468
1264
  enumerable: true,
@@ -1474,15 +1270,12 @@
1474
1270
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1475
1271
  return textContentGetterPatched.call(this);
1476
1272
  }
1477
-
1478
1273
  return textContentGetter.call(this);
1479
- } // TODO [#1222]: remove global bypass
1480
-
1481
-
1274
+ }
1275
+ // TODO [#1222]: remove global bypass
1482
1276
  if (isGlobalPatchingSkipped(this)) {
1483
1277
  return textContentGetter.call(this);
1484
1278
  }
1485
-
1486
1279
  return textContentGetterPatched.call(this);
1487
1280
  },
1488
1281
  set: textContentSetterPatched,
@@ -1494,14 +1287,12 @@
1494
1287
  if (isNodeShadowed(this)) {
1495
1288
  return parentNodeGetterPatched.call(this);
1496
1289
  }
1497
-
1498
- var parentNode = parentNodeGetter.call(this); // Handle the case where a top level light DOM element is slotted into a synthetic
1290
+ var parentNode = parentNodeGetter.call(this);
1291
+ // Handle the case where a top level light DOM element is slotted into a synthetic
1499
1292
  // shadow slot.
1500
-
1501
1293
  if (!isNull(parentNode) && isSyntheticSlotElement(parentNode)) {
1502
1294
  return getNodeOwner(parentNode);
1503
1295
  }
1504
-
1505
1296
  return parentNode;
1506
1297
  },
1507
1298
  enumerable: true,
@@ -1512,14 +1303,12 @@
1512
1303
  if (isNodeShadowed(this)) {
1513
1304
  return parentElementGetterPatched.call(this);
1514
1305
  }
1515
-
1516
- var parentElement = parentElementGetter.call(this); // Handle the case where a top level light DOM element is slotted into a synthetic
1306
+ var parentElement = parentElementGetter.call(this);
1307
+ // Handle the case where a top level light DOM element is slotted into a synthetic
1517
1308
  // shadow slot.
1518
-
1519
1309
  if (!isNull(parentElement) && isSyntheticSlotElement(parentElement)) {
1520
1310
  return getNodeOwner(parentElement);
1521
1311
  }
1522
-
1523
1312
  return parentElement;
1524
1313
  },
1525
1314
  enumerable: true,
@@ -1530,7 +1319,6 @@
1530
1319
  if (hasMountedChildren(this)) {
1531
1320
  return childNodesGetterPatched.call(this);
1532
1321
  }
1533
-
1534
1322
  return childNodesGetter.call(this);
1535
1323
  },
1536
1324
  enumerable: true,
@@ -1541,7 +1329,6 @@
1541
1329
  if (hasMountedChildren(this)) {
1542
1330
  return hasChildNodesPatched.call(this);
1543
1331
  }
1544
-
1545
1332
  return hasChildNodes.call(this);
1546
1333
  },
1547
1334
  enumerable: true,
@@ -1554,7 +1341,6 @@
1554
1341
  if (isGlobalPatchingSkipped(this)) {
1555
1342
  return compareDocumentPosition.call(this, otherNode);
1556
1343
  }
1557
-
1558
1344
  return compareDocumentPositionPatched.call(this, otherNode);
1559
1345
  },
1560
1346
  enumerable: true,
@@ -1570,24 +1356,19 @@
1570
1356
  if (this === otherNode) {
1571
1357
  return true;
1572
1358
  }
1573
-
1574
1359
  if (!lwcRuntimeFlags.ENABLE_NODE_PATCH) {
1575
1360
  if (otherNode == null) {
1576
1361
  return false;
1577
1362
  }
1578
-
1579
1363
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1580
1364
  return containsPatched.call(this, otherNode);
1581
1365
  }
1582
-
1583
1366
  return contains.call(this, otherNode);
1584
- } // TODO [#1222]: remove global bypass
1585
-
1586
-
1367
+ }
1368
+ // TODO [#1222]: remove global bypass
1587
1369
  if (isGlobalPatchingSkipped(this)) {
1588
1370
  return contains.call(this, otherNode);
1589
1371
  }
1590
-
1591
1372
  return containsPatched.call(this, otherNode);
1592
1373
  },
1593
1374
  enumerable: true,
@@ -1600,19 +1381,15 @@
1600
1381
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
1601
1382
  return cloneNodePatched.call(this, deep);
1602
1383
  }
1603
-
1604
1384
  return cloneNode.call(this, deep);
1605
1385
  }
1606
-
1607
1386
  if (isTrue(deep)) {
1608
1387
  // TODO [#1222]: remove global bypass
1609
1388
  if (isGlobalPatchingSkipped(this)) {
1610
1389
  return cloneNode.call(this, deep);
1611
1390
  }
1612
-
1613
1391
  return cloneNodePatched.call(this, deep);
1614
1392
  }
1615
-
1616
1393
  return cloneNode.call(this, deep);
1617
1394
  },
1618
1395
  enumerable: true,
@@ -1633,33 +1410,28 @@
1633
1410
  }
1634
1411
  }
1635
1412
  });
1636
-
1637
1413
  var getInternalChildNodes = function (node) {
1638
1414
  return node.childNodes;
1639
- }; // IE11 extra patches for wrong prototypes
1640
-
1415
+ };
1416
+ // IE11 extra patches for wrong prototypes
1641
1417
  if (hasOwnProperty.call(HTMLElement.prototype, 'contains')) {
1642
1418
  defineProperty(HTMLElement.prototype, 'contains', getOwnPropertyDescriptor(_Node.prototype, 'contains'));
1643
1419
  }
1644
-
1645
1420
  if (hasOwnProperty.call(HTMLElement.prototype, 'parentElement')) {
1646
1421
  defineProperty(HTMLElement.prototype, 'parentElement', getOwnPropertyDescriptor(_Node.prototype, 'parentElement'));
1647
1422
  }
1423
+
1648
1424
  /*
1649
1425
  * Copyright (c) 2018, salesforce.com, inc.
1650
1426
  * All rights reserved.
1651
1427
  * SPDX-License-Identifier: MIT
1652
1428
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1653
1429
  */
1654
-
1655
-
1656
1430
  var EventListenerMap = new WeakMap();
1657
1431
  var ComposedPathMap = new WeakMap();
1658
-
1659
1432
  function isEventListenerOrEventListenerObject(fnOrObj) {
1660
1433
  return isFunction(fnOrObj) || isObject(fnOrObj) && !isNull(fnOrObj) && isFunction(fnOrObj.handleEvent);
1661
1434
  }
1662
-
1663
1435
  function shouldInvokeListener(event, target, currentTarget) {
1664
1436
  // Subsequent logic assumes that `currentTarget` must be contained in the composed path for the listener to be
1665
1437
  // invoked, but this is not always the case. `composedPath()` will sometimes return an empty array, even when the
@@ -1667,62 +1439,47 @@
1667
1439
  if (target === currentTarget) {
1668
1440
  return true;
1669
1441
  }
1670
-
1671
1442
  var composedPath = ComposedPathMap.get(event);
1672
-
1673
1443
  if (isUndefined(composedPath)) {
1674
1444
  composedPath = event.composedPath();
1675
1445
  ComposedPathMap.set(event, composedPath);
1676
1446
  }
1677
-
1678
1447
  return composedPath.includes(currentTarget);
1679
1448
  }
1680
-
1681
1449
  function getEventListenerWrapper(fnOrObj) {
1682
1450
  if (!isEventListenerOrEventListenerObject(fnOrObj)) {
1683
1451
  return fnOrObj;
1684
1452
  }
1685
-
1686
1453
  var wrapperFn = EventListenerMap.get(fnOrObj);
1687
-
1688
1454
  if (isUndefined(wrapperFn)) {
1689
1455
  wrapperFn = function wrapperFn(event) {
1690
1456
  // This function is invoked from an event listener and currentTarget is always defined.
1691
1457
  var currentTarget = eventCurrentTargetGetter.call(event);
1692
-
1693
1458
  var actualTarget = getActualTarget(event);
1694
-
1695
1459
  if (!shouldInvokeListener(event, actualTarget, currentTarget)) {
1696
1460
  return;
1697
1461
  }
1698
-
1699
1462
  return isFunction(fnOrObj) ? fnOrObj.call(this, event) : fnOrObj.handleEvent && fnOrObj.handleEvent(event);
1700
1463
  };
1701
-
1702
1464
  EventListenerMap.set(fnOrObj, wrapperFn);
1703
1465
  }
1704
-
1705
1466
  return wrapperFn;
1706
1467
  }
1468
+
1707
1469
  /*
1708
1470
  * Copyright (c) 2018, salesforce.com, inc.
1709
1471
  * All rights reserved.
1710
1472
  * SPDX-License-Identifier: MIT
1711
1473
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1712
1474
  */
1713
-
1714
-
1715
1475
  var eventToContextMap = new WeakMap();
1716
1476
  var customElementToWrappedListeners = new WeakMap();
1717
-
1718
1477
  function getEventMap(elm) {
1719
1478
  var listenerInfo = customElementToWrappedListeners.get(elm);
1720
-
1721
1479
  if (isUndefined(listenerInfo)) {
1722
1480
  listenerInfo = create(null);
1723
1481
  customElementToWrappedListeners.set(elm, listenerInfo);
1724
1482
  }
1725
-
1726
1483
  return listenerInfo;
1727
1484
  }
1728
1485
  /**
@@ -1730,89 +1487,67 @@
1730
1487
  * property of events dispatched on shadow roots always resolve to their host. This function understands this
1731
1488
  * abstraction and properly returns a reference to the shadow root when appropriate.
1732
1489
  */
1733
-
1734
-
1735
1490
  function getActualTarget(event) {
1736
1491
  var _a;
1737
-
1738
1492
  return (_a = eventToShadowRootMap.get(event)) !== null && _a !== void 0 ? _a : eventTargetGetter.call(event);
1739
1493
  }
1740
-
1741
1494
  var shadowRootEventListenerMap = new WeakMap();
1742
-
1743
1495
  function getWrappedShadowRootListener(listener) {
1744
1496
  if (!isFunction(listener)) {
1745
1497
  throw new TypeError(); // avoiding problems with non-valid listeners
1746
1498
  }
1747
1499
 
1748
1500
  var shadowRootWrappedListener = shadowRootEventListenerMap.get(listener);
1749
-
1750
1501
  if (isUndefined(shadowRootWrappedListener)) {
1751
1502
  shadowRootWrappedListener = function shadowRootWrappedListener(event) {
1752
1503
  // currentTarget is always defined inside an event listener
1753
- var currentTarget = eventCurrentTargetGetter.call(event); // If currentTarget is not an instance of a native shadow root then we're dealing with a
1504
+ var currentTarget = eventCurrentTargetGetter.call(event);
1505
+ // If currentTarget is not an instance of a native shadow root then we're dealing with a
1754
1506
  // host element whose synthetic shadow root must be accessed via getShadowRoot().
1755
-
1756
1507
  if (!isInstanceOfNativeShadowRoot(currentTarget)) {
1757
1508
  currentTarget = getShadowRoot(currentTarget);
1758
1509
  }
1759
-
1760
1510
  var actualTarget = getActualTarget(event);
1761
-
1762
1511
  if (shouldInvokeListener(event, actualTarget, currentTarget)) {
1763
1512
  listener.call(currentTarget, event);
1764
1513
  }
1765
1514
  };
1766
-
1767
- shadowRootWrappedListener.placement = 1
1768
- /* EventListenerContext.SHADOW_ROOT_LISTENER */
1769
- ;
1515
+ shadowRootWrappedListener.placement = 1 /* EventListenerContext.SHADOW_ROOT_LISTENER */;
1770
1516
  shadowRootEventListenerMap.set(listener, shadowRootWrappedListener);
1771
1517
  }
1772
-
1773
1518
  return shadowRootWrappedListener;
1774
1519
  }
1775
-
1776
1520
  var customElementEventListenerMap = new WeakMap();
1777
-
1778
1521
  function getWrappedCustomElementListener(listener) {
1779
1522
  if (!isFunction(listener)) {
1780
1523
  throw new TypeError(); // avoiding problems with non-valid listeners
1781
1524
  }
1782
1525
 
1783
1526
  var customElementWrappedListener = customElementEventListenerMap.get(listener);
1784
-
1785
1527
  if (isUndefined(customElementWrappedListener)) {
1786
1528
  customElementWrappedListener = function customElementWrappedListener(event) {
1787
1529
  // currentTarget is always defined inside an event listener
1788
1530
  var currentTarget = eventCurrentTargetGetter.call(event);
1789
1531
  var actualTarget = getActualTarget(event);
1790
-
1791
1532
  if (shouldInvokeListener(event, actualTarget, currentTarget)) {
1792
1533
  listener.call(currentTarget, event);
1793
1534
  }
1794
1535
  };
1795
-
1796
- customElementWrappedListener.placement = 0
1797
- /* EventListenerContext.CUSTOM_ELEMENT_LISTENER */
1798
- ;
1536
+ customElementWrappedListener.placement = 0 /* EventListenerContext.CUSTOM_ELEMENT_LISTENER */;
1799
1537
  customElementEventListenerMap.set(listener, customElementWrappedListener);
1800
1538
  }
1801
-
1802
1539
  return customElementWrappedListener;
1803
1540
  }
1804
-
1805
1541
  function domListener(evt) {
1806
1542
  var immediatePropagationStopped = false;
1807
1543
  var propagationStopped = false;
1808
1544
  var type = evt.type,
1809
- stopImmediatePropagation = evt.stopImmediatePropagation,
1810
- stopPropagation = evt.stopPropagation; // currentTarget is always defined
1811
-
1545
+ stopImmediatePropagation = evt.stopImmediatePropagation,
1546
+ stopPropagation = evt.stopPropagation;
1547
+ // currentTarget is always defined
1812
1548
  var currentTarget = eventCurrentTargetGetter.call(evt);
1813
1549
  var listenerMap = getEventMap(currentTarget);
1814
1550
  var listeners = listenerMap[type]; // it must have listeners at this point
1815
-
1816
1551
  defineProperty(evt, 'stopImmediatePropagation', {
1817
1552
  value: function value() {
1818
1553
  immediatePropagationStopped = true;
@@ -1830,10 +1565,9 @@
1830
1565
  writable: true,
1831
1566
  enumerable: true,
1832
1567
  configurable: true
1833
- }); // in case a listener adds or removes other listeners during invocation
1834
-
1568
+ });
1569
+ // in case a listener adds or removes other listeners during invocation
1835
1570
  var bookkeeping = ArraySlice.call(listeners);
1836
-
1837
1571
  function invokeListenersByPlacement(placement) {
1838
1572
  forEach.call(bookkeeping, function (listener) {
1839
1573
  if (isFalse(immediatePropagationStopped) && listener.placement === placement) {
@@ -1845,75 +1579,54 @@
1845
1579
  }
1846
1580
  });
1847
1581
  }
1848
-
1849
- eventToContextMap.set(evt, 1
1850
- /* EventListenerContext.SHADOW_ROOT_LISTENER */
1851
- );
1852
- invokeListenersByPlacement(1
1853
- /* EventListenerContext.SHADOW_ROOT_LISTENER */
1854
- );
1855
-
1582
+ eventToContextMap.set(evt, 1 /* EventListenerContext.SHADOW_ROOT_LISTENER */);
1583
+ invokeListenersByPlacement(1 /* EventListenerContext.SHADOW_ROOT_LISTENER */);
1856
1584
  if (isFalse(immediatePropagationStopped) && isFalse(propagationStopped)) {
1857
1585
  // doing the second iteration only if the first one didn't interrupt the event propagation
1858
- eventToContextMap.set(evt, 0
1859
- /* EventListenerContext.CUSTOM_ELEMENT_LISTENER */
1860
- );
1861
- invokeListenersByPlacement(0
1862
- /* EventListenerContext.CUSTOM_ELEMENT_LISTENER */
1863
- );
1586
+ eventToContextMap.set(evt, 0 /* EventListenerContext.CUSTOM_ELEMENT_LISTENER */);
1587
+ invokeListenersByPlacement(0 /* EventListenerContext.CUSTOM_ELEMENT_LISTENER */);
1864
1588
  }
1865
1589
 
1866
- eventToContextMap.set(evt, 2
1867
- /* EventListenerContext.UNKNOWN_LISTENER */
1868
- );
1590
+ eventToContextMap.set(evt, 2 /* EventListenerContext.UNKNOWN_LISTENER */);
1869
1591
  }
1870
1592
 
1871
1593
  function attachDOMListener(elm, type, wrappedListener) {
1872
1594
  var listenerMap = getEventMap(elm);
1873
1595
  var cmpEventHandlers = listenerMap[type];
1874
-
1875
1596
  if (isUndefined(cmpEventHandlers)) {
1876
1597
  cmpEventHandlers = listenerMap[type] = [];
1877
- } // Prevent identical listeners from subscribing to the same event type.
1598
+ }
1599
+ // Prevent identical listeners from subscribing to the same event type.
1878
1600
  // TODO [#1824]: Options will also play a factor when we introduce support for them (#1824).
1879
-
1880
-
1881
1601
  if (ArrayIndexOf.call(cmpEventHandlers, wrappedListener) !== -1) {
1882
1602
  return;
1883
- } // only add to DOM if there is no other listener on the same placement yet
1884
-
1885
-
1603
+ }
1604
+ // only add to DOM if there is no other listener on the same placement yet
1886
1605
  if (cmpEventHandlers.length === 0) {
1887
1606
  // super.addEventListener() - this will not work on
1888
1607
  addEventListener.call(elm, type, domListener);
1889
1608
  }
1890
-
1891
1609
  ArrayPush.call(cmpEventHandlers, wrappedListener);
1892
1610
  }
1893
-
1894
1611
  function detachDOMListener(elm, type, wrappedListener) {
1895
1612
  var listenerMap = getEventMap(elm);
1896
1613
  var p;
1897
1614
  var listeners;
1898
-
1899
1615
  if (!isUndefined(listeners = listenerMap[type]) && (p = ArrayIndexOf.call(listeners, wrappedListener)) !== -1) {
1900
- ArraySplice.call(listeners, p, 1); // only remove from DOM if there is no other listener on the same placement
1901
-
1616
+ ArraySplice.call(listeners, p, 1);
1617
+ // only remove from DOM if there is no other listener on the same placement
1902
1618
  if (listeners.length === 0) {
1903
1619
  removeEventListener.call(elm, type, domListener);
1904
1620
  }
1905
1621
  }
1906
1622
  }
1907
-
1908
1623
  function addCustomElementEventListener(type, listener, _options) {
1909
-
1910
-
1624
+ // TODO [#1824]: Lift this restriction on the option parameter
1911
1625
  if (isFunction(listener)) {
1912
1626
  var wrappedListener = getWrappedCustomElementListener(listener);
1913
1627
  attachDOMListener(this, type, wrappedListener);
1914
1628
  }
1915
1629
  }
1916
-
1917
1630
  function removeCustomElementEventListener(type, listener, _options) {
1918
1631
  // TODO [#1824]: Lift this restriction on the option parameter
1919
1632
  if (isFunction(listener)) {
@@ -1921,17 +1634,14 @@
1921
1634
  detachDOMListener(this, type, wrappedListener);
1922
1635
  }
1923
1636
  }
1924
-
1925
1637
  function addShadowRootEventListener(sr, type, listener, _options) {
1926
-
1927
-
1638
+ // TODO [#1824]: Lift this restriction on the option parameter
1928
1639
  if (isFunction(listener)) {
1929
1640
  var elm = getHost(sr);
1930
1641
  var wrappedListener = getWrappedShadowRootListener(listener);
1931
1642
  attachDOMListener(elm, type, wrappedListener);
1932
1643
  }
1933
1644
  }
1934
-
1935
1645
  function removeShadowRootEventListener(sr, type, listener, _options) {
1936
1646
  // TODO [#1824]: Lift this restriction on the option parameter
1937
1647
  if (isFunction(listener)) {
@@ -1940,37 +1650,31 @@
1940
1650
  detachDOMListener(elm, type, wrappedListener);
1941
1651
  }
1942
1652
  }
1653
+
1943
1654
  /*
1944
1655
  * Copyright (c) 2018, salesforce.com, inc.
1945
1656
  * All rights reserved.
1946
1657
  * SPDX-License-Identifier: MIT
1947
1658
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1948
1659
  */
1949
-
1950
-
1951
1660
  var InternalSlot = new WeakMap();
1952
1661
  var _document = document,
1953
- createDocumentFragment = _document.createDocumentFragment;
1954
-
1662
+ createDocumentFragment = _document.createDocumentFragment;
1955
1663
  function hasInternalSlot(root) {
1956
1664
  return InternalSlot.has(root);
1957
1665
  }
1958
-
1959
1666
  function getInternalSlot(root) {
1960
1667
  var record = InternalSlot.get(root);
1961
-
1962
1668
  if (isUndefined(record)) {
1963
1669
  throw new TypeError();
1964
1670
  }
1965
-
1966
1671
  return record;
1967
1672
  }
1968
-
1969
1673
  defineProperty(_Node.prototype, KEY__SHADOW_RESOLVER, {
1970
1674
  set: function set(fn) {
1971
1675
  if (isUndefined(fn)) return;
1972
- this[KEY__SHADOW_RESOLVER_PRIVATE] = fn; // TODO [#1164]: temporary propagation of the key
1973
-
1676
+ this[KEY__SHADOW_RESOLVER_PRIVATE] = fn;
1677
+ // TODO [#1164]: temporary propagation of the key
1974
1678
  setNodeOwnerKey(this, fn.nodeKey);
1975
1679
  },
1976
1680
  get: function get() {
@@ -1982,52 +1686,42 @@
1982
1686
  defineProperty(_globalThis, KEY__IS_NATIVE_SHADOW_ROOT_DEFINED, {
1983
1687
  value: isNativeShadowRootDefined
1984
1688
  });
1985
-
1986
1689
  function getShadowRootResolver(node) {
1987
1690
  return node[KEY__SHADOW_RESOLVER];
1988
1691
  }
1989
-
1990
1692
  function setShadowRootResolver(node, fn) {
1991
1693
  node[KEY__SHADOW_RESOLVER] = fn;
1992
1694
  }
1993
-
1994
1695
  function isDelegatingFocus(host) {
1995
1696
  return getInternalSlot(host).delegatesFocus;
1996
1697
  }
1997
-
1998
1698
  function getHost(root) {
1999
1699
  return getInternalSlot(root).host;
2000
1700
  }
2001
-
2002
1701
  function getShadowRoot(elm) {
2003
1702
  return getInternalSlot(elm).shadowRoot;
2004
- } // Intentionally adding `Node` here in addition to `Element` since this check is harmless for nodes
1703
+ }
1704
+ // Intentionally adding `Node` here in addition to `Element` since this check is harmless for nodes
2005
1705
  // and we can avoid having to cast the type before calling this method in a few places.
2006
-
2007
-
2008
1706
  function isSyntheticShadowHost(node) {
2009
1707
  var shadowRootRecord = InternalSlot.get(node);
2010
1708
  return !isUndefined(shadowRootRecord) && node === shadowRootRecord.host;
2011
1709
  }
2012
-
2013
1710
  function isSyntheticShadowRoot(node) {
2014
1711
  var shadowRootRecord = InternalSlot.get(node);
2015
1712
  return !isUndefined(shadowRootRecord) && node === shadowRootRecord.shadowRoot;
2016
1713
  }
2017
-
2018
1714
  var uid = 0;
2019
-
2020
1715
  function attachShadow(elm, options) {
2021
1716
  if (InternalSlot.has(elm)) {
2022
1717
  throw new Error("Failed to execute 'attachShadow' on 'Element': Shadow root cannot be created on a host which already hosts a shadow tree.");
2023
1718
  }
2024
-
2025
1719
  var mode = options.mode,
2026
- delegatesFocus = options.delegatesFocus; // creating a real fragment for shadowRoot instance
2027
-
1720
+ delegatesFocus = options.delegatesFocus;
1721
+ // creating a real fragment for shadowRoot instance
2028
1722
  var doc = getOwnerDocument(elm);
2029
- var sr = createDocumentFragment.call(doc); // creating shadow internal record
2030
-
1723
+ var sr = createDocumentFragment.call(doc);
1724
+ // creating shadow internal record
2031
1725
  var record = {
2032
1726
  mode: mode,
2033
1727
  delegatesFocus: !!delegatesFocus,
@@ -2036,19 +1730,16 @@
2036
1730
  };
2037
1731
  InternalSlot.set(sr, record);
2038
1732
  InternalSlot.set(elm, record);
2039
-
2040
1733
  var shadowResolver = function shadowResolver() {
2041
1734
  return sr;
2042
1735
  };
2043
-
2044
1736
  var x = shadowResolver.nodeKey = uid++;
2045
1737
  setNodeKey(elm, x);
2046
- setShadowRootResolver(sr, shadowResolver); // correcting the proto chain
2047
-
1738
+ setShadowRootResolver(sr, shadowResolver);
1739
+ // correcting the proto chain
2048
1740
  setPrototypeOf(sr, SyntheticShadowRoot.prototype);
2049
1741
  return sr;
2050
1742
  }
2051
-
2052
1743
  var SyntheticShadowRootDescriptors = {
2053
1744
  constructor: {
2054
1745
  writable: true,
@@ -2077,31 +1768,25 @@
2077
1768
  var host = getHost(this);
2078
1769
  var doc = getOwnerDocument(host);
2079
1770
  var activeElement = DocumentPrototypeActiveElement.call(doc);
2080
-
2081
1771
  if (isNull(activeElement)) {
2082
1772
  return activeElement;
2083
1773
  }
2084
-
2085
1774
  if ((compareDocumentPosition.call(host, activeElement) & DOCUMENT_POSITION_CONTAINED_BY) === 0) {
2086
1775
  return null;
2087
- } // activeElement must be child of the host and owned by it
2088
-
2089
-
1776
+ }
1777
+ // activeElement must be child of the host and owned by it
2090
1778
  var node = activeElement;
2091
-
2092
1779
  while (!isNodeOwnedBy(host, node)) {
2093
1780
  // parentElement is always an element because we are talking up the tree knowing
2094
1781
  // that it is a child of the host.
2095
1782
  node = parentElementGetter.call(node);
2096
- } // If we have a slot element here that means that we were dealing
1783
+ }
1784
+ // If we have a slot element here that means that we were dealing
2097
1785
  // with an element that was passed to one of our slots. In this
2098
1786
  // case, activeElement returns null.
2099
-
2100
-
2101
1787
  if (isSlotElement(node)) {
2102
1788
  return null;
2103
1789
  }
2104
-
2105
1790
  return node;
2106
1791
  }
2107
1792
  },
@@ -2211,9 +1896,9 @@
2211
1896
  enumerable: true,
2212
1897
  configurable: true,
2213
1898
  value: function value(evt) {
2214
- eventToShadowRootMap.set(evt, this); // Typescript does not like it when you treat the `arguments` object as an array
1899
+ eventToShadowRootMap.set(evt, this);
1900
+ // Typescript does not like it when you treat the `arguments` object as an array
2215
1901
  // @ts-ignore type-mismatch
2216
-
2217
1902
  return dispatchEvent.apply(getHost(this), arguments);
2218
1903
  }
2219
1904
  },
@@ -2253,7 +1938,6 @@
2253
1938
  configurable: true,
2254
1939
  value: function value(otherNode) {
2255
1940
  var host = getHost(this);
2256
-
2257
1941
  if (this === otherNode) {
2258
1942
  // "this" and "otherNode" are the same shadow root.
2259
1943
  return 0;
@@ -2269,6 +1953,7 @@
2269
1953
  }
2270
1954
  }
2271
1955
  },
1956
+
2272
1957
  contains: {
2273
1958
  writable: true,
2274
1959
  enumerable: true,
@@ -2277,9 +1962,8 @@
2277
1962
  if (this === otherNode) {
2278
1963
  return true;
2279
1964
  }
2280
-
2281
- var host = getHost(this); // must be child of the host and owned by it.
2282
-
1965
+ var host = getHost(this);
1966
+ // must be child of the host and owned by it.
2283
1967
  return (compareDocumentPosition.call(host, otherNode) & DOCUMENT_POSITION_CONTAINED_BY) !== 0 && isNodeOwnedBy(host, otherNode);
2284
1968
  }
2285
1969
  },
@@ -2343,6 +2027,7 @@
2343
2027
  return 11; // Node.DOCUMENT_FRAGMENT_NODE
2344
2028
  }
2345
2029
  },
2030
+
2346
2031
  nodeValue: {
2347
2032
  enumerable: true,
2348
2033
  configurable: true,
@@ -2377,15 +2062,12 @@
2377
2062
  get: function get() {
2378
2063
  var childNodes = getInternalChildNodes(this);
2379
2064
  var textContent = '';
2380
-
2381
2065
  for (var i = 0, len = childNodes.length; i < len; i += 1) {
2382
2066
  var currentNode = childNodes[i];
2383
-
2384
2067
  if (currentNode.nodeType !== COMMENT_NODE) {
2385
2068
  textContent += getTextContent(currentNode);
2386
2069
  }
2387
2070
  }
2388
-
2389
2071
  return textContent;
2390
2072
  },
2391
2073
  set: function set(v) {
@@ -2410,11 +2092,9 @@
2410
2092
  get: function get() {
2411
2093
  var childNodes = getInternalChildNodes(this);
2412
2094
  var innerHTML = '';
2413
-
2414
2095
  for (var i = 0, len = childNodes.length; i < len; i += 1) {
2415
2096
  innerHTML += getOuterHTML(childNodes[i]);
2416
2097
  }
2417
-
2418
2098
  return innerHTML;
2419
2099
  },
2420
2100
  set: function set(v) {
@@ -2481,13 +2161,11 @@
2481
2161
  }
2482
2162
  };
2483
2163
  assign(SyntheticShadowRootDescriptors, NodePatchDescriptors, ParentNodePatchDescriptors, ElementPatchDescriptors, ShadowRootDescriptors);
2484
-
2485
2164
  function SyntheticShadowRoot() {
2486
2165
  throw new TypeError('Illegal constructor');
2487
2166
  }
2488
-
2489
- SyntheticShadowRoot.prototype = create(DocumentFragment.prototype, SyntheticShadowRootDescriptors); // `this.shadowRoot instanceof ShadowRoot` should evaluate to true even for synthetic shadow
2490
-
2167
+ SyntheticShadowRoot.prototype = create(DocumentFragment.prototype, SyntheticShadowRootDescriptors);
2168
+ // `this.shadowRoot instanceof ShadowRoot` should evaluate to true even for synthetic shadow
2491
2169
  defineProperty(SyntheticShadowRoot, Symbol.hasInstance, {
2492
2170
  value: function value(object) {
2493
2171
  // Technically we should walk up the entire prototype chain, but with SyntheticShadowRoot
@@ -2495,18 +2173,16 @@
2495
2173
  return isObject(object) && !isNull(object) && (isInstanceOfNativeShadowRoot(object) || getPrototypeOf(object) === SyntheticShadowRoot.prototype);
2496
2174
  }
2497
2175
  });
2176
+
2498
2177
  /*
2499
2178
  * Copyright (c) 2018, salesforce.com, inc.
2500
2179
  * All rights reserved.
2501
2180
  * SPDX-License-Identifier: MIT
2502
2181
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2503
2182
  */
2504
-
2505
-
2506
2183
  function pathComposer(startNode, composed) {
2507
2184
  var composedPath = [];
2508
2185
  var startRoot;
2509
-
2510
2186
  if (startNode instanceof Window) {
2511
2187
  startRoot = startNode;
2512
2188
  } else if (startNode instanceof _Node) {
@@ -2514,15 +2190,11 @@
2514
2190
  } else {
2515
2191
  return composedPath;
2516
2192
  }
2517
-
2518
2193
  var current = startNode;
2519
-
2520
2194
  while (!isNull(current)) {
2521
2195
  composedPath.push(current);
2522
-
2523
2196
  if (current instanceof Element || current instanceof Text) {
2524
2197
  var assignedSlot = current.assignedSlot;
2525
-
2526
2198
  if (!isNull(assignedSlot)) {
2527
2199
  current = assignedSlot;
2528
2200
  } else {
@@ -2537,29 +2209,25 @@
2537
2209
  current = null;
2538
2210
  }
2539
2211
  }
2540
-
2541
2212
  var doc;
2542
-
2543
2213
  if (startNode instanceof Window) {
2544
2214
  doc = startNode.document;
2545
2215
  } else {
2546
2216
  doc = getOwnerDocument(startNode);
2547
- } // event composedPath includes window when startNode's ownerRoot is document
2548
-
2549
-
2217
+ }
2218
+ // event composedPath includes window when startNode's ownerRoot is document
2550
2219
  if (composedPath[composedPath.length - 1] === doc) {
2551
2220
  composedPath.push(window);
2552
2221
  }
2553
-
2554
2222
  return composedPath;
2555
2223
  }
2224
+
2556
2225
  /*
2557
2226
  * Copyright (c) 2018, salesforce.com, inc.
2558
2227
  * All rights reserved.
2559
2228
  * SPDX-License-Identifier: MIT
2560
2229
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2561
2230
  */
2562
-
2563
2231
  /**
2564
2232
  @license
2565
2233
  Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
@@ -2569,97 +2237,79 @@
2569
2237
  Code distributed by Google as part of the polymer project is also
2570
2238
  subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
2571
2239
  */
2572
-
2573
-
2574
2240
  function retarget(refNode, path) {
2575
2241
  if (isNull(refNode)) {
2576
2242
  return null;
2577
- } // If ANCESTOR's root is not a shadow root or ANCESTOR's root is BASE's
2243
+ }
2244
+ // If ANCESTOR's root is not a shadow root or ANCESTOR's root is BASE's
2578
2245
  // shadow-including inclusive ancestor, return ANCESTOR.
2579
-
2580
-
2581
2246
  var refNodePath = pathComposer(refNode, true);
2582
2247
  var p$ = path;
2583
-
2584
2248
  for (var i = 0, ancestor, lastRoot, root, rootIdx; i < p$.length; i++) {
2585
2249
  ancestor = p$[i];
2586
2250
  root = ancestor instanceof Window ? ancestor : ancestor.getRootNode();
2587
-
2588
2251
  if (root !== lastRoot) {
2589
2252
  rootIdx = refNodePath.indexOf(root);
2590
2253
  lastRoot = root;
2591
2254
  }
2592
-
2593
2255
  if (!isSyntheticShadowRoot(root) || !isUndefined(rootIdx) && rootIdx > -1) {
2594
2256
  return ancestor;
2595
2257
  }
2596
2258
  }
2597
-
2598
2259
  return null;
2599
2260
  }
2261
+
2600
2262
  /*
2601
2263
  * Copyright (c) 2018, salesforce.com, inc.
2602
2264
  * All rights reserved.
2603
2265
  * SPDX-License-Identifier: MIT
2604
2266
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2605
2267
  */
2606
-
2607
-
2608
2268
  function fauxElementFromPoint(context, doc, left, top) {
2609
2269
  var element = elementFromPoint.call(doc, left, top);
2610
-
2611
2270
  if (isNull(element)) {
2612
2271
  return element;
2613
2272
  }
2614
-
2615
2273
  return retarget(context, pathComposer(element, true));
2616
2274
  }
2275
+
2617
2276
  /*
2618
2277
  * Copyright (c) 2018, salesforce.com, inc.
2619
2278
  * All rights reserved.
2620
2279
  * SPDX-License-Identifier: MIT
2621
2280
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2622
2281
  */
2623
-
2624
-
2625
2282
  function elemFromPoint(left, top) {
2626
2283
  return fauxElementFromPoint(this, this, left, top);
2627
2284
  }
2628
-
2629
2285
  Document.prototype.elementFromPoint = elemFromPoint;
2630
-
2631
2286
  function elemsFromPoint(left, top) {
2632
2287
  return fauxElementsFromPoint(this, this, left, top);
2633
2288
  }
2634
-
2635
- Document.prototype.elementsFromPoint = elemsFromPoint; // Go until we reach to top of the LWC tree
2636
-
2289
+ Document.prototype.elementsFromPoint = elemsFromPoint;
2290
+ // Go until we reach to top of the LWC tree
2637
2291
  defineProperty(Document.prototype, 'activeElement', {
2638
2292
  get: function get() {
2639
2293
  var node = DocumentPrototypeActiveElement.call(this);
2640
-
2641
2294
  if (isNull(node)) {
2642
2295
  return node;
2643
2296
  }
2644
-
2645
2297
  while (!isUndefined(getNodeOwnerKey(node))) {
2646
2298
  node = parentElementGetter.call(node);
2647
-
2648
2299
  if (isNull(node)) {
2649
2300
  return null;
2650
2301
  }
2651
2302
  }
2652
-
2653
2303
  if (node.tagName === 'HTML') {
2654
2304
  // IE 11. Active element should never be html element
2655
2305
  node = this.body;
2656
2306
  }
2657
-
2658
2307
  return node;
2659
2308
  },
2660
2309
  enumerable: true,
2661
2310
  configurable: true
2662
- }); // The following patched methods hide shadowed elements from global
2311
+ });
2312
+ // The following patched methods hide shadowed elements from global
2663
2313
  // traversing mechanisms. They are simplified for performance reasons to
2664
2314
  // filter by ownership and do not account for slotted elements. This
2665
2315
  // compromise is fine for our synthetic shadow dom because root elements
@@ -2668,16 +2318,13 @@
2668
2318
  // static HTMLCollection or static NodeList. We decided that this compromise
2669
2319
  // is not a big problem considering the amount of code that is relying on
2670
2320
  // the liveliness of these results are rare.
2671
-
2672
2321
  defineProperty(Document.prototype, 'getElementById', {
2673
2322
  value: function value() {
2674
2323
  var elm = getElementById.apply(this, ArraySlice.call(arguments));
2675
-
2676
2324
  if (isNull(elm)) {
2677
2325
  return null;
2678
- } // TODO [#1222]: remove global bypass
2679
-
2680
-
2326
+ }
2327
+ // TODO [#1222]: remove global bypass
2681
2328
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm) ? elm : null;
2682
2329
  },
2683
2330
  writable: true,
@@ -2687,7 +2334,8 @@
2687
2334
  defineProperty(Document.prototype, 'querySelector', {
2688
2335
  value: function value() {
2689
2336
  var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
2690
- var filtered = ArrayFind.call(elements, // TODO [#1222]: remove global bypass
2337
+ var filtered = ArrayFind.call(elements,
2338
+ // TODO [#1222]: remove global bypass
2691
2339
  function (elm) {
2692
2340
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2693
2341
  });
@@ -2700,7 +2348,8 @@
2700
2348
  defineProperty(Document.prototype, 'querySelectorAll', {
2701
2349
  value: function value() {
2702
2350
  var elements = arrayFromCollection(querySelectorAll.apply(this, ArraySlice.call(arguments)));
2703
- var filtered = ArrayFilter.call(elements, // TODO [#1222]: remove global bypass
2351
+ var filtered = ArrayFilter.call(elements,
2352
+ // TODO [#1222]: remove global bypass
2704
2353
  function (elm) {
2705
2354
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2706
2355
  });
@@ -2713,7 +2362,8 @@
2713
2362
  defineProperty(Document.prototype, 'getElementsByClassName', {
2714
2363
  value: function value() {
2715
2364
  var elements = arrayFromCollection(getElementsByClassName.apply(this, ArraySlice.call(arguments)));
2716
- var filtered = ArrayFilter.call(elements, // TODO [#1222]: remove global bypass
2365
+ var filtered = ArrayFilter.call(elements,
2366
+ // TODO [#1222]: remove global bypass
2717
2367
  function (elm) {
2718
2368
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2719
2369
  });
@@ -2726,7 +2376,8 @@
2726
2376
  defineProperty(Document.prototype, 'getElementsByTagName', {
2727
2377
  value: function value() {
2728
2378
  var elements = arrayFromCollection(getElementsByTagName.apply(this, ArraySlice.call(arguments)));
2729
- var filtered = ArrayFilter.call(elements, // TODO [#1222]: remove global bypass
2379
+ var filtered = ArrayFilter.call(elements,
2380
+ // TODO [#1222]: remove global bypass
2730
2381
  function (elm) {
2731
2382
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2732
2383
  });
@@ -2739,7 +2390,8 @@
2739
2390
  defineProperty(Document.prototype, 'getElementsByTagNameNS', {
2740
2391
  value: function value() {
2741
2392
  var elements = arrayFromCollection(getElementsByTagNameNS.apply(this, ArraySlice.call(arguments)));
2742
- var filtered = ArrayFilter.call(elements, // TODO [#1222]: remove global bypass
2393
+ var filtered = ArrayFilter.call(elements,
2394
+ // TODO [#1222]: remove global bypass
2743
2395
  function (elm) {
2744
2396
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2745
2397
  });
@@ -2749,11 +2401,13 @@
2749
2401
  enumerable: true,
2750
2402
  configurable: true
2751
2403
  });
2752
- defineProperty( // In Firefox v57 and lower, getElementsByName is defined on HTMLDocument.prototype
2404
+ defineProperty(
2405
+ // In Firefox v57 and lower, getElementsByName is defined on HTMLDocument.prototype
2753
2406
  getOwnPropertyDescriptor(HTMLDocument.prototype, 'getElementsByName') ? HTMLDocument.prototype : Document.prototype, 'getElementsByName', {
2754
2407
  value: function value() {
2755
2408
  var elements = arrayFromCollection(getElementsByName.apply(this, ArraySlice.call(arguments)));
2756
- var filtered = ArrayFilter.call(elements, // TODO [#1222]: remove global bypass
2409
+ var filtered = ArrayFilter.call(elements,
2410
+ // TODO [#1222]: remove global bypass
2757
2411
  function (elm) {
2758
2412
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(elm);
2759
2413
  });
@@ -2763,37 +2417,35 @@
2763
2417
  enumerable: true,
2764
2418
  configurable: true
2765
2419
  });
2420
+
2766
2421
  /*
2767
2422
  * Copyright (c) 2018, salesforce.com, inc.
2768
2423
  * All rights reserved.
2769
2424
  * SPDX-License-Identifier: MIT
2770
2425
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2771
2426
  */
2772
-
2773
2427
  Object.defineProperty(window, 'ShadowRoot', {
2774
2428
  value: SyntheticShadowRoot,
2775
2429
  configurable: true,
2776
2430
  writable: true
2777
2431
  });
2432
+
2778
2433
  /*
2779
2434
  * Copyright (c) 2018, salesforce.com, inc.
2780
2435
  * All rights reserved.
2781
2436
  * SPDX-License-Identifier: MIT
2782
2437
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2783
2438
  */
2784
-
2785
2439
  var composedDescriptor = Object.getOwnPropertyDescriptor(Event.prototype, 'composed');
2786
-
2787
2440
  function detect$3() {
2788
2441
  if (!composedDescriptor) {
2789
2442
  // No need to apply this polyfill if this client completely lacks
2790
2443
  // support for the composed property.
2791
2444
  return false;
2792
- } // Assigning a throwaway click event here to suppress a ts error when we
2445
+ }
2446
+ // Assigning a throwaway click event here to suppress a ts error when we
2793
2447
  // pass clickEvent into the composed getter below. The error is:
2794
2448
  // [ts] Variable 'clickEvent' is used before being assigned.
2795
-
2796
-
2797
2449
  var clickEvent = new Event('click');
2798
2450
  var button = document.createElement('button');
2799
2451
  button.addEventListener('click', function (event) {
@@ -2802,16 +2454,14 @@
2802
2454
  button.click();
2803
2455
  return !composedDescriptor.get.call(clickEvent);
2804
2456
  }
2457
+
2805
2458
  /*
2806
2459
  * Copyright (c) 2018, salesforce.com, inc.
2807
2460
  * All rights reserved.
2808
2461
  * SPDX-License-Identifier: MIT
2809
2462
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2810
2463
  */
2811
-
2812
-
2813
2464
  var originalClickDescriptor = Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'click');
2814
-
2815
2465
  function handleClick(event) {
2816
2466
  Object.defineProperty(event, 'composed', {
2817
2467
  configurable: true,
@@ -2821,11 +2471,9 @@
2821
2471
  }
2822
2472
  });
2823
2473
  }
2824
-
2825
2474
  function apply$3() {
2826
2475
  HTMLElement.prototype.click = function () {
2827
2476
  addEventListener.call(this, 'click', handleClick);
2828
-
2829
2477
  try {
2830
2478
  originalClickDescriptor.value.call(this);
2831
2479
  } finally {
@@ -2833,38 +2481,35 @@
2833
2481
  }
2834
2482
  };
2835
2483
  }
2484
+
2836
2485
  /*
2837
2486
  * Copyright (c) 2018, salesforce.com, inc.
2838
2487
  * All rights reserved.
2839
2488
  * SPDX-License-Identifier: MIT
2840
2489
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2841
2490
  */
2842
-
2843
-
2844
2491
  if (detect$3()) {
2845
2492
  apply$3();
2846
2493
  }
2494
+
2847
2495
  /*
2848
2496
  * Copyright (c) 2018, salesforce.com, inc.
2849
2497
  * All rights reserved.
2850
2498
  * SPDX-License-Identifier: MIT
2851
2499
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2852
2500
  */
2853
-
2854
-
2855
2501
  function detect$2() {
2856
2502
  return new Event('test', {
2857
2503
  composed: true
2858
2504
  }).composed !== true;
2859
2505
  }
2506
+
2860
2507
  /*
2861
2508
  * Copyright (c) 2018, salesforce.com, inc.
2862
2509
  * All rights reserved.
2863
2510
  * SPDX-License-Identifier: MIT
2864
2511
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2865
2512
  */
2866
-
2867
-
2868
2513
  function apply$2() {
2869
2514
  // https://github.com/w3c/webcomponents/issues/513#issuecomment-224183937
2870
2515
  var composedEvents = assign(create(null), {
@@ -2918,8 +2563,8 @@
2918
2563
  touchstart: 1,
2919
2564
  wheel: 1
2920
2565
  });
2921
- var EventConstructor = Event; // Patch Event constructor to add the composed property on events created via new Event.
2922
-
2566
+ var EventConstructor = Event;
2567
+ // Patch Event constructor to add the composed property on events created via new Event.
2923
2568
  function PatchedEvent(type, eventInitDict) {
2924
2569
  var event = new EventConstructor(type, eventInitDict);
2925
2570
  var isComposed = !!(eventInitDict && eventInitDict.composed);
@@ -2934,14 +2579,13 @@
2934
2579
  });
2935
2580
  return event;
2936
2581
  }
2937
-
2938
2582
  PatchedEvent.prototype = EventConstructor.prototype;
2939
2583
  PatchedEvent.AT_TARGET = EventConstructor.AT_TARGET;
2940
2584
  PatchedEvent.BUBBLING_PHASE = EventConstructor.BUBBLING_PHASE;
2941
2585
  PatchedEvent.CAPTURING_PHASE = EventConstructor.CAPTURING_PHASE;
2942
2586
  PatchedEvent.NONE = EventConstructor.NONE;
2943
- window.Event = PatchedEvent; // Patch the Event prototype to add the composed property on user agent dispatched event.
2944
-
2587
+ window.Event = PatchedEvent;
2588
+ // Patch the Event prototype to add the composed property on user agent dispatched event.
2945
2589
  Object.defineProperties(Event.prototype, {
2946
2590
  composed: {
2947
2591
  get: function get() {
@@ -2953,27 +2597,24 @@
2953
2597
  }
2954
2598
  });
2955
2599
  }
2600
+
2956
2601
  /*
2957
2602
  * Copyright (c) 2018, salesforce.com, inc.
2958
2603
  * All rights reserved.
2959
2604
  * SPDX-License-Identifier: MIT
2960
2605
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2961
2606
  */
2962
-
2963
-
2964
2607
  if (detect$2()) {
2965
2608
  apply$2();
2966
2609
  }
2610
+
2967
2611
  /*
2968
2612
  * Copyright (c) 2018, salesforce.com, inc.
2969
2613
  * All rights reserved.
2970
2614
  * SPDX-License-Identifier: MIT
2971
2615
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2972
2616
  */
2973
-
2974
-
2975
2617
  var CustomEventConstructor = CustomEvent;
2976
-
2977
2618
  function PatchedCustomEvent(type, eventInitDict) {
2978
2619
  var event = new CustomEventConstructor(type, eventInitDict);
2979
2620
  var isComposed = !!(eventInitDict && eventInitDict.composed);
@@ -2988,23 +2629,22 @@
2988
2629
  });
2989
2630
  return event;
2990
2631
  }
2991
-
2992
2632
  PatchedCustomEvent.prototype = CustomEventConstructor.prototype;
2993
2633
  window.CustomEvent = PatchedCustomEvent;
2634
+
2994
2635
  /*
2995
2636
  * Copyright (c) 2018, salesforce.com, inc.
2996
2637
  * All rights reserved.
2997
2638
  * SPDX-License-Identifier: MIT
2998
2639
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2999
2640
  */
3000
-
3001
2641
  if (typeof ClipboardEvent !== 'undefined') {
3002
2642
  var isComposedType = assign(create(null), {
3003
2643
  copy: 1,
3004
2644
  cut: 1,
3005
2645
  paste: 1
3006
- }); // Patch the prototype to override the composed property on user-agent dispatched events
3007
-
2646
+ });
2647
+ // Patch the prototype to override the composed property on user-agent dispatched events
3008
2648
  defineProperties(ClipboardEvent.prototype, {
3009
2649
  composed: {
3010
2650
  get: function get() {
@@ -3016,50 +2656,44 @@
3016
2656
  }
3017
2657
  });
3018
2658
  }
2659
+
3019
2660
  /*
3020
2661
  * Copyright (c) 2018, salesforce.com, inc.
3021
2662
  * All rights reserved.
3022
2663
  * SPDX-License-Identifier: MIT
3023
2664
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3024
2665
  */
3025
-
3026
-
3027
2666
  function detect$1() {
3028
2667
  // Note: when using this in mobile apps, we might have a DOM that does not support iframes.
3029
2668
  return typeof HTMLIFrameElement !== 'undefined';
3030
2669
  }
2670
+
3031
2671
  /*
3032
2672
  * Copyright (c) 2018, salesforce.com, inc.
3033
2673
  * All rights reserved.
3034
2674
  * SPDX-License-Identifier: MIT
3035
2675
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3036
2676
  */
3037
-
3038
-
3039
2677
  function apply$1() {
3040
2678
  // the iframe property descriptor for `contentWindow` should always be available, otherwise this method should never be called
3041
2679
  var desc = getOwnPropertyDescriptor(HTMLIFrameElement.prototype, 'contentWindow');
3042
2680
  var originalGetter = desc.get;
3043
-
3044
2681
  desc.get = function () {
3045
- var original = originalGetter.call(this); // If the original iframe element is not a keyed node, then do not wrap it
3046
-
2682
+ var original = originalGetter.call(this);
2683
+ // If the original iframe element is not a keyed node, then do not wrap it
3047
2684
  if (isNull(original) || isUndefined(getNodeOwnerKey(this))) {
3048
2685
  return original;
3049
- } // only if the element is an iframe inside a shadowRoot, we care about this problem
2686
+ }
2687
+ // only if the element is an iframe inside a shadowRoot, we care about this problem
3050
2688
  // because in that case, the code that is accessing the iframe, is very likely code
3051
2689
  // compiled with proxy-compat transformation. It is true that other code without those
3052
2690
  // transformations might also access an iframe from within a shadowRoot, but in that,
3053
2691
  // case, which is more rare, we still return the wrapper, and it should work the same,
3054
2692
  // this part is just an optimization.
3055
-
3056
-
3057
2693
  return wrapIframeWindow(original);
3058
2694
  };
3059
-
3060
2695
  defineProperty(HTMLIFrameElement.prototype, 'contentWindow', desc);
3061
2696
  }
3062
-
3063
2697
  function wrapIframeWindow(win) {
3064
2698
  return {
3065
2699
  addEventListener: function addEventListener() {
@@ -3092,82 +2726,67 @@
3092
2726
  // @ts-ignore type-mismatch
3093
2727
  return win.removeEventListener.apply(win, arguments);
3094
2728
  },
3095
-
3096
2729
  get closed() {
3097
2730
  return win.closed;
3098
2731
  },
3099
-
3100
2732
  get frames() {
3101
2733
  return win.frames;
3102
2734
  },
3103
-
3104
2735
  get length() {
3105
2736
  return win.length;
3106
2737
  },
3107
-
3108
2738
  get location() {
3109
2739
  return win.location;
3110
2740
  },
3111
-
3112
2741
  set location(value) {
3113
2742
  win.location = value;
3114
2743
  },
3115
-
3116
2744
  get opener() {
3117
2745
  return win.opener;
3118
2746
  },
3119
-
3120
2747
  get parent() {
3121
2748
  return win.parent;
3122
2749
  },
3123
-
3124
2750
  get self() {
3125
2751
  return win.self;
3126
2752
  },
3127
-
3128
2753
  get top() {
3129
2754
  return win.top;
3130
2755
  },
3131
-
3132
2756
  get window() {
3133
2757
  return win.window;
3134
2758
  }
3135
-
3136
2759
  }; // this is limited
3137
2760
  }
2761
+
3138
2762
  /*
3139
2763
  * Copyright (c) 2018, salesforce.com, inc.
3140
2764
  * All rights reserved.
3141
2765
  * SPDX-License-Identifier: MIT
3142
2766
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3143
2767
  */
3144
-
3145
-
3146
2768
  if (detect$1()) {
3147
2769
  apply$1();
3148
2770
  }
2771
+
3149
2772
  /*
3150
2773
  * Copyright (c) 2018, salesforce.com, inc.
3151
2774
  * All rights reserved.
3152
2775
  * SPDX-License-Identifier: MIT
3153
2776
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3154
2777
  */
3155
-
3156
-
3157
2778
  var OriginalMutationObserver = MutationObserver;
3158
2779
  var _OriginalMutationObse = OriginalMutationObserver.prototype,
3159
- originalDisconnect = _OriginalMutationObse.disconnect,
3160
- originalObserve = _OriginalMutationObse.observe,
3161
- originalTakeRecords = _OriginalMutationObse.takeRecords; // Internal fields to maintain relationships
3162
-
2780
+ originalDisconnect = _OriginalMutationObse.disconnect,
2781
+ originalObserve = _OriginalMutationObse.observe,
2782
+ originalTakeRecords = _OriginalMutationObse.takeRecords;
2783
+ // Internal fields to maintain relationships
3163
2784
  var wrapperLookupField = '$$lwcObserverCallbackWrapper$$';
3164
2785
  var observerLookupField = '$$lwcNodeObservers$$';
3165
2786
  var observerToNodesMap = new WeakMap();
3166
-
3167
2787
  function getNodeObservers(node) {
3168
2788
  return node[observerLookupField];
3169
2789
  }
3170
-
3171
2790
  function setNodeObservers(node, observers) {
3172
2791
  node[observerLookupField] = observers;
3173
2792
  }
@@ -3175,13 +2794,11 @@
3175
2794
  * Retarget the mutation record's target value to its shadowRoot
3176
2795
  * @param {MutationRecord} originalRecord
3177
2796
  */
3178
-
3179
-
3180
2797
  function retargetMutationRecord(originalRecord) {
3181
2798
  var addedNodes = originalRecord.addedNodes,
3182
- removedNodes = originalRecord.removedNodes,
3183
- target = originalRecord.target,
3184
- type = originalRecord.type;
2799
+ removedNodes = originalRecord.removedNodes,
2800
+ target = originalRecord.target,
2801
+ type = originalRecord.type;
3185
2802
  var retargetedRecord = create(MutationRecord.prototype);
3186
2803
  defineProperties(retargetedRecord, {
3187
2804
  addedNodes: {
@@ -3221,22 +2838,17 @@
3221
2838
  * @param {MutationObserver} observer
3222
2839
  * @param {Node} target
3223
2840
  */
3224
-
3225
-
3226
2841
  function isQualifiedObserver(observer, target) {
3227
2842
  var parentNode = target;
3228
-
3229
2843
  while (!isNull(parentNode)) {
3230
2844
  var parentNodeObservers = getNodeObservers(parentNode);
3231
-
3232
- if (!isUndefined(parentNodeObservers) && (parentNodeObservers[0] === observer || // perf optimization to check for the first item is a match
2845
+ if (!isUndefined(parentNodeObservers) && (parentNodeObservers[0] === observer ||
2846
+ // perf optimization to check for the first item is a match
3233
2847
  ArrayIndexOf.call(parentNodeObservers, observer) !== -1)) {
3234
2848
  return true;
3235
2849
  }
3236
-
3237
2850
  parentNode = parentNode.parentNode;
3238
2851
  }
3239
-
3240
2852
  return false;
3241
2853
  }
3242
2854
  /**
@@ -3248,30 +2860,26 @@
3248
2860
  * @param {MutationRecords[]} mutations
3249
2861
  * @param {MutationObserver} observer
3250
2862
  */
3251
-
3252
-
3253
2863
  function filterMutationRecords(mutations, observer) {
3254
2864
  return ArrayReduce.call(mutations, function (filteredSet, record) {
3255
2865
  var target = record.target,
3256
- addedNodes = record.addedNodes,
3257
- removedNodes = record.removedNodes,
3258
- type = record.type; // If target is an lwc host,
2866
+ addedNodes = record.addedNodes,
2867
+ removedNodes = record.removedNodes,
2868
+ type = record.type;
2869
+ // If target is an lwc host,
3259
2870
  // Determine if the mutations affected the host or the shadowRoot
3260
2871
  // Mutations affecting host: changes to slot content
3261
2872
  // Mutations affecting shadowRoot: changes to template content
3262
-
3263
2873
  if (type === 'childList' && !isUndefined(getNodeKey(target))) {
3264
2874
  // In case of added nodes, we can climb up the tree and determine eligibility
3265
2875
  if (addedNodes.length > 0) {
3266
2876
  // Optimization: Peek in and test one node to decide if the MutationRecord qualifies
3267
2877
  // The remaining nodes in this MutationRecord will have the same ownerKey
3268
2878
  var sampleNode = addedNodes[0];
3269
-
3270
2879
  if (isQualifiedObserver(observer, sampleNode)) {
3271
2880
  // If the target was being observed, then return record as-is
3272
2881
  // this will be the case for slot content
3273
2882
  var nodeObservers = getNodeObservers(target);
3274
-
3275
2883
  if (nodeObservers && (nodeObservers[0] === observer || ArrayIndexOf.call(nodeObservers, observer) !== -1)) {
3276
2884
  ArrayPush.call(filteredSet, record);
3277
2885
  } else {
@@ -3284,14 +2892,13 @@
3284
2892
  // We can only check if either the host or shadow root was observed and qualify the record
3285
2893
  var shadowRoot = target.shadowRoot;
3286
2894
  var _sampleNode = removedNodes[0];
3287
-
3288
- if (getNodeNearestOwnerKey(target) === getNodeNearestOwnerKey(_sampleNode) && // trickery: sampleNode is slot content
2895
+ if (getNodeNearestOwnerKey(target) === getNodeNearestOwnerKey(_sampleNode) &&
2896
+ // trickery: sampleNode is slot content
3289
2897
  isQualifiedObserver(observer, target) // use target as a close enough reference to climb up
3290
2898
  ) {
3291
2899
  ArrayPush.call(filteredSet, record);
3292
2900
  } else if (shadowRoot) {
3293
2901
  var shadowRootObservers = getNodeObservers(shadowRoot);
3294
-
3295
2902
  if (shadowRootObservers && (shadowRootObservers[0] === observer || ArrayIndexOf.call(shadowRootObservers, observer) !== -1)) {
3296
2903
  ArrayPush.call(filteredSet, retargetMutationRecord(record));
3297
2904
  }
@@ -3304,27 +2911,22 @@
3304
2911
  ArrayPush.call(filteredSet, record);
3305
2912
  }
3306
2913
  }
3307
-
3308
2914
  return filteredSet;
3309
2915
  }, []);
3310
2916
  }
3311
-
3312
2917
  function getWrappedCallback(callback) {
3313
2918
  var wrappedCallback = callback[wrapperLookupField];
3314
-
3315
2919
  if (isUndefined(wrappedCallback)) {
3316
2920
  wrappedCallback = callback[wrapperLookupField] = function (mutations, observer) {
3317
2921
  // Filter mutation records
3318
- var filteredRecords = filterMutationRecords(mutations, observer); // If not records are eligible for the observer, do not invoke callback
3319
-
2922
+ var filteredRecords = filterMutationRecords(mutations, observer);
2923
+ // If not records are eligible for the observer, do not invoke callback
3320
2924
  if (filteredRecords.length === 0) {
3321
2925
  return;
3322
2926
  }
3323
-
3324
2927
  callback.call(observer, filteredRecords, observer);
3325
2928
  };
3326
2929
  }
3327
-
3328
2930
  return wrappedCallback;
3329
2931
  }
3330
2932
  /**
@@ -3333,28 +2935,21 @@
3333
2935
  * 2. Add a property field to track all observed targets of the observer instance
3334
2936
  * @param {MutationCallback} callback
3335
2937
  */
3336
-
3337
-
3338
2938
  function PatchedMutationObserver(callback) {
3339
2939
  var wrappedCallback = getWrappedCallback(callback);
3340
2940
  var observer = new OriginalMutationObserver(wrappedCallback);
3341
2941
  return observer;
3342
2942
  }
3343
-
3344
2943
  function patchedDisconnect() {
3345
2944
  var _this2 = this;
3346
-
3347
- originalDisconnect.call(this); // Clear the node to observer reference which is a strong references
3348
-
2945
+ originalDisconnect.call(this);
2946
+ // Clear the node to observer reference which is a strong references
3349
2947
  var observedNodes = observerToNodesMap.get(this);
3350
-
3351
2948
  if (!isUndefined(observedNodes)) {
3352
2949
  forEach.call(observedNodes, function (observedNode) {
3353
2950
  var observers = observedNode[observerLookupField];
3354
-
3355
2951
  if (!isUndefined(observers)) {
3356
2952
  var index = ArrayIndexOf.call(observers, _this2);
3357
-
3358
2953
  if (index !== -1) {
3359
2954
  ArraySplice.call(observers, index, 1);
3360
2955
  }
@@ -3369,49 +2964,38 @@
3369
2964
  * @param {Node} target
3370
2965
  * @param {Object} options
3371
2966
  */
3372
-
3373
-
3374
2967
  function patchedObserve(target, options) {
3375
- var targetObservers = getNodeObservers(target); // Maintain a list of all observers that want to observe a node
3376
-
2968
+ var targetObservers = getNodeObservers(target);
2969
+ // Maintain a list of all observers that want to observe a node
3377
2970
  if (isUndefined(targetObservers)) {
3378
2971
  targetObservers = [];
3379
2972
  setNodeObservers(target, targetObservers);
3380
- } // Same observer trying to observe the same node
3381
-
3382
-
2973
+ }
2974
+ // Same observer trying to observe the same node
3383
2975
  if (ArrayIndexOf.call(targetObservers, this) === -1) {
3384
2976
  ArrayPush.call(targetObservers, this);
3385
2977
  } // else There is more bookkeeping to do here https://dom.spec.whatwg.org/#dom-mutationobserver-observe Step #7
3386
2978
  // SyntheticShadowRoot instances are not actually a part of the DOM so observe the host instead.
3387
-
3388
-
3389
2979
  if (isSyntheticShadowRoot(target)) {
3390
2980
  target = target.host;
3391
- } // maintain a list of all nodes observed by this observer
3392
-
3393
-
2981
+ }
2982
+ // maintain a list of all nodes observed by this observer
3394
2983
  if (observerToNodesMap.has(this)) {
3395
2984
  var observedNodes = observerToNodesMap.get(this);
3396
-
3397
2985
  if (ArrayIndexOf.call(observedNodes, target) === -1) {
3398
2986
  ArrayPush.call(observedNodes, target);
3399
2987
  }
3400
2988
  } else {
3401
2989
  observerToNodesMap.set(this, [target]);
3402
2990
  }
3403
-
3404
2991
  return originalObserve.call(this, target, options);
3405
2992
  }
3406
2993
  /**
3407
2994
  * Patch the takeRecords() api to filter MutationRecords based on the observed targets
3408
2995
  */
3409
-
3410
-
3411
2996
  function patchedTakeRecords() {
3412
2997
  return filterMutationRecords(originalTakeRecords.call(this), this);
3413
2998
  }
3414
-
3415
2999
  PatchedMutationObserver.prototype = OriginalMutationObserver.prototype;
3416
3000
  PatchedMutationObserver.prototype.disconnect = patchedDisconnect;
3417
3001
  PatchedMutationObserver.prototype.observe = patchedObserve;
@@ -3421,63 +3005,54 @@
3421
3005
  configurable: true,
3422
3006
  writable: true
3423
3007
  });
3008
+
3424
3009
  /*
3425
3010
  * Copyright (c) 2018, salesforce.com, inc.
3426
3011
  * All rights reserved.
3427
3012
  * SPDX-License-Identifier: MIT
3428
3013
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3429
3014
  */
3430
-
3431
3015
  function patchedAddEventListener$1(type, listener, optionsOrCapture) {
3432
3016
  if (isSyntheticShadowHost(this)) {
3433
3017
  // Typescript does not like it when you treat the `arguments` object as an array
3434
3018
  // @ts-ignore type-mismatch
3435
3019
  return addCustomElementEventListener.apply(this, arguments);
3436
3020
  }
3437
-
3438
3021
  if (arguments.length < 2) {
3439
3022
  // Slow path, unlikely to be called frequently. We expect modern browsers to throw:
3440
3023
  // https://googlechrome.github.io/samples/event-listeners-mandatory-arguments/
3441
3024
  var args = ArraySlice.call(arguments);
3442
-
3443
3025
  if (args.length > 1) {
3444
3026
  args[1] = getEventListenerWrapper(args[1]);
3445
- } // Ignore types because we're passing through to native method
3027
+ }
3028
+ // Ignore types because we're passing through to native method
3446
3029
  // @ts-ignore type-mismatch
3447
-
3448
-
3449
3030
  return addEventListener.apply(this, args);
3450
- } // Fast path. This function is optimized to avoid ArraySlice because addEventListener is called
3031
+ }
3032
+ // Fast path. This function is optimized to avoid ArraySlice because addEventListener is called
3451
3033
  // very frequently, and it provides a measurable perf boost to avoid so much array cloning.
3452
-
3453
-
3454
- var wrappedListener = getEventListenerWrapper(listener); // The third argument is optional, so passing in `undefined` for `optionsOrCapture` gives capture=false
3455
-
3034
+ var wrappedListener = getEventListenerWrapper(listener);
3035
+ // The third argument is optional, so passing in `undefined` for `optionsOrCapture` gives capture=false
3456
3036
  return addEventListener.call(this, type, wrappedListener, optionsOrCapture);
3457
3037
  }
3458
-
3459
3038
  function patchedRemoveEventListener$1(_type, _listener, _optionsOrCapture) {
3460
3039
  if (isSyntheticShadowHost(this)) {
3461
3040
  // Typescript does not like it when you treat the `arguments` object as an array
3462
3041
  // @ts-ignore type-mismatch
3463
3042
  return removeCustomElementEventListener.apply(this, arguments);
3464
3043
  }
3465
-
3466
3044
  var args = ArraySlice.call(arguments);
3467
-
3468
3045
  if (arguments.length > 1) {
3469
3046
  args[1] = getEventListenerWrapper(args[1]);
3470
- } // Ignore types because we're passing through to native method
3047
+ }
3048
+ // Ignore types because we're passing through to native method
3471
3049
  // @ts-ignore type-mismatch
3472
-
3473
-
3474
- removeEventListener.apply(this, args); // Account for listeners that were added before this polyfill was applied
3050
+ removeEventListener.apply(this, args);
3051
+ // Account for listeners that were added before this polyfill was applied
3475
3052
  // Typescript does not like it when you treat the `arguments` object as an array
3476
3053
  // @ts-ignore type-mismatch
3477
-
3478
3054
  removeEventListener.apply(this, arguments);
3479
3055
  }
3480
-
3481
3056
  defineProperties(eventTargetPrototype, {
3482
3057
  addEventListener: {
3483
3058
  value: patchedAddEventListener$1,
@@ -3492,53 +3067,48 @@
3492
3067
  configurable: true
3493
3068
  }
3494
3069
  });
3070
+
3495
3071
  /*
3496
3072
  * Copyright (c) 2018, salesforce.com, inc.
3497
3073
  * All rights reserved.
3498
3074
  * SPDX-License-Identifier: MIT
3499
3075
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3500
3076
  */
3501
-
3502
3077
  function detect() {
3503
3078
  return typeof EventTarget === 'undefined';
3504
3079
  }
3080
+
3505
3081
  /*
3506
3082
  * Copyright (c) 2018, salesforce.com, inc.
3507
3083
  * All rights reserved.
3508
3084
  * SPDX-License-Identifier: MIT
3509
3085
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3510
3086
  */
3511
-
3512
-
3513
3087
  function patchedAddEventListener(_type, _listener, _options) {
3514
3088
  if (arguments.length > 1) {
3515
3089
  var args = ArraySlice.call(arguments);
3516
- args[1] = getEventListenerWrapper(args[1]); // Ignore types because we're passing through to native method
3090
+ args[1] = getEventListenerWrapper(args[1]);
3091
+ // Ignore types because we're passing through to native method
3517
3092
  // @ts-ignore type-mismatch
3518
-
3519
3093
  return windowAddEventListener.apply(this, args);
3520
- } // Typescript does not like it when you treat the `arguments` object as an array
3094
+ }
3095
+ // Typescript does not like it when you treat the `arguments` object as an array
3521
3096
  // @ts-ignore type-mismatch
3522
-
3523
-
3524
3097
  return windowAddEventListener.apply(this, arguments);
3525
3098
  }
3526
-
3527
3099
  function patchedRemoveEventListener(_type, _listener, _options) {
3528
3100
  if (arguments.length > 1) {
3529
3101
  var args = ArraySlice.call(arguments);
3530
- args[1] = getEventListenerWrapper(args[1]); // Ignore types because we're passing through to native method
3102
+ args[1] = getEventListenerWrapper(args[1]);
3103
+ // Ignore types because we're passing through to native method
3531
3104
  // @ts-ignore type-mismatch
3532
-
3533
3105
  windowRemoveEventListener.apply(this, args);
3534
- } // Account for listeners that were added before this polyfill was applied
3106
+ }
3107
+ // Account for listeners that were added before this polyfill was applied
3535
3108
  // Typescript does not like it when you treat the `arguments` object as an array
3536
3109
  // @ts-ignore type-mismatch
3537
-
3538
-
3539
3110
  windowRemoveEventListener.apply(this, arguments);
3540
3111
  }
3541
-
3542
3112
  function apply() {
3543
3113
  defineProperties(Window.prototype, {
3544
3114
  addEventListener: {
@@ -3555,60 +3125,49 @@
3555
3125
  }
3556
3126
  });
3557
3127
  }
3128
+
3558
3129
  /*
3559
3130
  * Copyright (c) 2018, salesforce.com, inc.
3560
3131
  * All rights reserved.
3561
3132
  * SPDX-License-Identifier: MIT
3562
3133
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3563
3134
  */
3564
-
3565
-
3566
3135
  if (detect()) {
3567
3136
  apply();
3568
3137
  }
3138
+
3569
3139
  /*
3570
3140
  * Copyright (c) 2018, salesforce.com, inc.
3571
3141
  * All rights reserved.
3572
3142
  * SPDX-License-Identifier: MIT
3573
3143
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3574
3144
  */
3575
-
3576
-
3577
3145
  function patchedCurrentTargetGetter() {
3578
3146
  var currentTarget = eventCurrentTargetGetter.call(this);
3579
-
3580
3147
  if (isNull(currentTarget)) {
3581
3148
  return null;
3582
3149
  }
3583
-
3584
- if (eventToContextMap.get(this) === 1
3585
- /* EventListenerContext.SHADOW_ROOT_LISTENER */
3586
- ) {
3150
+ if (eventToContextMap.get(this) === 1 /* EventListenerContext.SHADOW_ROOT_LISTENER */) {
3587
3151
  return getShadowRoot(currentTarget);
3588
3152
  }
3589
-
3590
3153
  return currentTarget;
3591
3154
  }
3592
-
3593
3155
  function patchedTargetGetter() {
3594
3156
  var originalTarget = eventTargetGetter.call(this);
3595
-
3596
3157
  if (!(originalTarget instanceof _Node)) {
3597
3158
  return originalTarget;
3598
3159
  }
3599
-
3600
3160
  var doc = getOwnerDocument(originalTarget);
3601
3161
  var composedPath = pathComposer(originalTarget, this.composed);
3602
- var originalCurrentTarget = eventCurrentTargetGetter.call(this); // Handle cases where the currentTarget is null (for async events), and when an event has been
3162
+ var originalCurrentTarget = eventCurrentTargetGetter.call(this);
3163
+ // Handle cases where the currentTarget is null (for async events), and when an event has been
3603
3164
  // added to Window
3604
-
3605
3165
  if (!(originalCurrentTarget instanceof _Node)) {
3606
3166
  // TODO [#1511]: Special escape hatch to support legacy behavior. Should be fixed.
3607
3167
  // If the event's target is being accessed async and originalTarget is not a keyed element, do not retarget
3608
3168
  if (isNull(originalCurrentTarget) && isUndefined(getNodeOwnerKey(originalTarget))) {
3609
3169
  return originalTarget;
3610
3170
  }
3611
-
3612
3171
  return retarget(doc, composedPath);
3613
3172
  } else if (originalCurrentTarget === doc || originalCurrentTarget === doc.body) {
3614
3173
  // TODO [#1530]: If currentTarget is document or document.body (Third party libraries that have global event listeners)
@@ -3616,68 +3175,53 @@
3616
3175
  if (isUndefined(getNodeOwnerKey(originalTarget))) {
3617
3176
  return originalTarget;
3618
3177
  }
3619
-
3620
3178
  return retarget(doc, composedPath);
3621
3179
  }
3622
-
3623
3180
  var actualCurrentTarget = originalCurrentTarget;
3624
- var actualPath = composedPath; // Address the possibility that `currentTarget` is a shadow root
3625
-
3181
+ var actualPath = composedPath;
3182
+ // Address the possibility that `currentTarget` is a shadow root
3626
3183
  if (isSyntheticShadowHost(originalCurrentTarget)) {
3627
3184
  var context = eventToContextMap.get(this);
3628
-
3629
- if (context === 1
3630
- /* EventListenerContext.SHADOW_ROOT_LISTENER */
3631
- ) {
3185
+ if (context === 1 /* EventListenerContext.SHADOW_ROOT_LISTENER */) {
3632
3186
  actualCurrentTarget = getShadowRoot(originalCurrentTarget);
3633
3187
  }
3634
- } // Address the possibility that `target` is a shadow root
3635
-
3636
-
3188
+ }
3189
+ // Address the possibility that `target` is a shadow root
3637
3190
  if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
3638
3191
  actualPath = pathComposer(getShadowRoot(originalTarget), this.composed);
3639
3192
  }
3640
-
3641
3193
  return retarget(actualCurrentTarget, actualPath);
3642
3194
  }
3643
-
3644
3195
  function patchedComposedPathValue() {
3645
- var originalTarget = eventTargetGetter.call(this); // Account for events with targets that are not instances of Node (e.g., when a readystatechange
3196
+ var originalTarget = eventTargetGetter.call(this);
3197
+ // Account for events with targets that are not instances of Node (e.g., when a readystatechange
3646
3198
  // handler is listening on an instance of XMLHttpRequest).
3647
-
3648
3199
  if (!(originalTarget instanceof _Node)) {
3649
3200
  return [];
3650
- } // If the original target is inside a native shadow root, then just call the native
3201
+ }
3202
+ // If the original target is inside a native shadow root, then just call the native
3651
3203
  // composePath() method. The event is already retargeted and this causes our composedPath()
3652
3204
  // polyfill to compute the wrong value. This is only an issue when you have a native web
3653
3205
  // component inside an LWC component (see test in same commit) but this scenario is unlikely
3654
3206
  // because we don't yet support that. Workaround specifically for W-9846457. Mixed mode solution
3655
3207
  // will likely be more involved.
3656
-
3657
-
3658
3208
  var hasShadowRoot = Boolean(originalTarget.shadowRoot);
3659
3209
  var hasSyntheticShadowRootAttached = hasInternalSlot(originalTarget);
3660
-
3661
3210
  if (hasShadowRoot && !hasSyntheticShadowRootAttached) {
3662
3211
  return composedPath.call(this);
3663
3212
  }
3664
-
3665
- var originalCurrentTarget = eventCurrentTargetGetter.call(this); // If the event has completed propagation, the composedPath should be an empty array.
3666
-
3213
+ var originalCurrentTarget = eventCurrentTargetGetter.call(this);
3214
+ // If the event has completed propagation, the composedPath should be an empty array.
3667
3215
  if (isNull(originalCurrentTarget)) {
3668
3216
  return [];
3669
- } // Address the possibility that `target` is a shadow root
3670
-
3671
-
3217
+ }
3218
+ // Address the possibility that `target` is a shadow root
3672
3219
  var actualTarget = originalTarget;
3673
-
3674
3220
  if (isSyntheticShadowHost(originalTarget) && eventToShadowRootMap.has(this)) {
3675
3221
  actualTarget = getShadowRoot(originalTarget);
3676
3222
  }
3677
-
3678
3223
  return pathComposer(actualTarget, this.composed);
3679
3224
  }
3680
-
3681
3225
  defineProperties(Event.prototype, {
3682
3226
  target: {
3683
3227
  get: patchedTargetGetter,
@@ -3709,66 +3253,61 @@
3709
3253
  configurable: true
3710
3254
  }
3711
3255
  });
3256
+
3712
3257
  /*
3713
3258
  * Copyright (c) 2018, salesforce.com, inc.
3714
3259
  * All rights reserved.
3715
3260
  * SPDX-License-Identifier: MIT
3716
3261
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3717
3262
  */
3718
-
3719
3263
  function retargetRelatedTarget(Ctor) {
3720
3264
  var relatedTargetGetter = getOwnPropertyDescriptor(Ctor.prototype, 'relatedTarget').get;
3721
3265
  defineProperty(Ctor.prototype, 'relatedTarget', {
3722
3266
  get: function get() {
3723
3267
  var relatedTarget = relatedTargetGetter.call(this);
3724
-
3725
3268
  if (isNull(relatedTarget)) {
3726
3269
  return null;
3727
3270
  }
3728
-
3729
3271
  if (!(relatedTarget instanceof _Node) || !isNodeShadowed(relatedTarget)) {
3730
3272
  return relatedTarget;
3731
3273
  }
3732
-
3733
3274
  var pointOfReference = eventCurrentTargetGetter.call(this);
3734
-
3735
3275
  if (isNull(pointOfReference)) {
3736
3276
  pointOfReference = getOwnerDocument(relatedTarget);
3737
3277
  }
3738
-
3739
3278
  return retarget(pointOfReference, pathComposer(relatedTarget, true));
3740
3279
  },
3741
3280
  enumerable: true,
3742
3281
  configurable: true
3743
3282
  });
3744
3283
  }
3284
+
3745
3285
  /*
3746
3286
  * Copyright (c) 2018, salesforce.com, inc.
3747
3287
  * All rights reserved.
3748
3288
  * SPDX-License-Identifier: MIT
3749
3289
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3750
3290
  */
3751
-
3752
-
3753
3291
  retargetRelatedTarget(FocusEvent);
3292
+
3754
3293
  /*
3755
3294
  * Copyright (c) 2018, salesforce.com, inc.
3756
3295
  * All rights reserved.
3757
3296
  * SPDX-License-Identifier: MIT
3758
3297
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3759
3298
  */
3760
-
3761
3299
  retargetRelatedTarget(MouseEvent);
3300
+
3762
3301
  /*
3763
3302
  * Copyright (c) 2021, salesforce.com, inc.
3764
3303
  * All rights reserved.
3765
3304
  * SPDX-License-Identifier: MIT
3766
3305
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3767
3306
  */
3768
-
3769
3307
  var assignedSlotGetter = hasOwnProperty.call(Text.prototype, 'assignedSlot') ? getOwnPropertyDescriptor(Text.prototype, 'assignedSlot').get : function () {
3770
3308
  return null;
3771
3309
  };
3310
+
3772
3311
  /*
3773
3312
  * Copyright (c) 2018, salesforce.com, inc.
3774
3313
  * All rights reserved.
@@ -3779,20 +3318,16 @@
3779
3318
  // "Registered observers in a node’s registered observer list have a weak
3780
3319
  // reference to the node."
3781
3320
  // https://dom.spec.whatwg.org/#garbage-collection
3782
-
3783
3321
  var observer;
3784
3322
  var observerConfig = {
3785
3323
  childList: true
3786
3324
  };
3787
3325
  var SlotChangeKey = new WeakMap();
3788
-
3789
3326
  function initSlotObserver() {
3790
3327
  return new MO(function (mutations) {
3791
3328
  var slots = [];
3792
3329
  forEach.call(mutations, function (mutation) {
3793
-
3794
3330
  var slot = mutation.target;
3795
-
3796
3331
  if (ArrayIndexOf.call(slots, slot) === -1) {
3797
3332
  ArrayPush.call(slots, slot);
3798
3333
  dispatchEvent.call(slot, new CustomEvent('slotchange'));
@@ -3800,34 +3335,29 @@
3800
3335
  });
3801
3336
  });
3802
3337
  }
3803
-
3804
3338
  function getFilteredSlotFlattenNodes(slot) {
3805
- var childNodes = arrayFromCollection(childNodesGetter.call(slot)); // Typescript is inferring the wrong function type for this particular
3339
+ var childNodes = arrayFromCollection(childNodesGetter.call(slot));
3340
+ // Typescript is inferring the wrong function type for this particular
3806
3341
  // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
3807
3342
  // @ts-ignore type-mismatch
3808
-
3809
3343
  return ArrayReduce.call(childNodes, function (seed, child) {
3810
3344
  if (child instanceof Element && isSlotElement(child)) {
3811
3345
  ArrayPush.apply(seed, getFilteredSlotFlattenNodes(child));
3812
3346
  } else {
3813
3347
  ArrayPush.call(seed, child);
3814
3348
  }
3815
-
3816
3349
  return seed;
3817
3350
  }, []);
3818
3351
  }
3819
-
3820
3352
  function assignedSlotGetterPatched() {
3821
- var parentNode = parentNodeGetter.call(this); // use original assignedSlot if parent has a native shdow root
3822
-
3353
+ var parentNode = parentNodeGetter.call(this);
3354
+ // use original assignedSlot if parent has a native shdow root
3823
3355
  if (parentNode instanceof Element) {
3824
3356
  var sr = shadowRootGetter.call(parentNode);
3825
-
3826
3357
  if (isInstanceOfNativeShadowRoot(sr)) {
3827
3358
  if (this instanceof Text) {
3828
3359
  return assignedSlotGetter.call(this);
3829
3360
  }
3830
-
3831
3361
  return assignedSlotGetter$1.call(this);
3832
3362
  }
3833
3363
  }
@@ -3841,28 +3371,21 @@
3841
3371
  * the light DOM node doesn't have an owner key and therefor the slot owner key will be
3842
3372
  * different than the node owner key (always `undefined`).
3843
3373
  */
3844
-
3845
-
3846
3374
  if (!isNull(parentNode) && isSlotElement(parentNode) && getNodeOwnerKey(parentNode) !== getNodeOwnerKey(this)) {
3847
3375
  return parentNode;
3848
3376
  }
3849
-
3850
3377
  return null;
3851
3378
  }
3852
-
3853
3379
  defineProperties(HTMLSlotElement.prototype, {
3854
3380
  addEventListener: {
3855
3381
  value: function value(type, listener, options) {
3856
3382
  // super.addEventListener - but that doesn't work with typescript
3857
3383
  HTMLElement.prototype.addEventListener.call(this, type, listener, options);
3858
-
3859
3384
  if (type === 'slotchange' && !SlotChangeKey.get(this)) {
3860
3385
  SlotChangeKey.set(this, true);
3861
-
3862
3386
  if (!observer) {
3863
3387
  observer = initSlotObserver();
3864
3388
  }
3865
-
3866
3389
  MutationObserverObserve.call(observer, this, observerConfig);
3867
3390
  }
3868
3391
  },
@@ -3917,13 +3440,13 @@
3917
3440
  var childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
3918
3441
  return createStaticNodeList(childNodes);
3919
3442
  }
3920
-
3921
3443
  return childNodesGetter.call(this);
3922
3444
  },
3923
3445
  enumerable: true,
3924
3446
  configurable: true
3925
3447
  }
3926
3448
  });
3449
+
3927
3450
  /*
3928
3451
  * Copyright (c) 2018, salesforce.com, inc.
3929
3452
  * All rights reserved.
@@ -3932,7 +3455,6 @@
3932
3455
  */
3933
3456
  // Non-deep-traversing patches: this descriptor map includes all descriptors that
3934
3457
  // do not five access to nodes beyond the immediate children.
3935
-
3936
3458
  defineProperties(Text.prototype, {
3937
3459
  assignedSlot: {
3938
3460
  get: assignedSlotGetterPatched,
@@ -3940,27 +3462,25 @@
3940
3462
  configurable: true
3941
3463
  }
3942
3464
  });
3465
+
3943
3466
  /*
3944
3467
  * Copyright (c) 2018, salesforce.com, inc.
3945
3468
  * All rights reserved.
3946
3469
  * SPDX-License-Identifier: MIT
3947
3470
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3948
3471
  */
3949
-
3950
3472
  /**
3951
3473
  * This methods filters out elements that are not in the same shadow root of context.
3952
3474
  * It does not enforce shadow dom semantics if $context is not managed by LWC
3953
3475
  */
3954
-
3955
3476
  function getNonPatchedFilteredArrayOfNodes(context, unfilteredNodes) {
3956
3477
  var filtered;
3957
- var ownerKey = getNodeOwnerKey(context); // a node inside a shadow.
3958
-
3478
+ var ownerKey = getNodeOwnerKey(context);
3479
+ // a node inside a shadow.
3959
3480
  if (!isUndefined(ownerKey)) {
3960
3481
  if (isSyntheticShadowHost(context)) {
3961
3482
  // element with shadowRoot attached
3962
3483
  var owner = getNodeOwner(context);
3963
-
3964
3484
  if (isNull(owner)) {
3965
3485
  filtered = [];
3966
3486
  } else if (getNodeKey(context)) {
@@ -3978,7 +3498,8 @@
3978
3498
  }
3979
3499
  } else if (context instanceof HTMLBodyElement) {
3980
3500
  // `context` is document.body which is already patched.
3981
- filtered = ArrayFilter.call(unfilteredNodes, // TODO [#1222]: remove global bypass
3501
+ filtered = ArrayFilter.call(unfilteredNodes,
3502
+ // TODO [#1222]: remove global bypass
3982
3503
  function (elm) {
3983
3504
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
3984
3505
  });
@@ -3986,53 +3507,42 @@
3986
3507
  // `context` is outside the lwc boundary, return unfiltered list.
3987
3508
  filtered = ArraySlice.call(unfilteredNodes);
3988
3509
  }
3989
-
3990
3510
  return filtered;
3991
3511
  }
3512
+
3992
3513
  /*
3993
3514
  * Copyright (c) 2018, salesforce.com, inc.
3994
3515
  * All rights reserved.
3995
3516
  * SPDX-License-Identifier: MIT
3996
3517
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3997
3518
  */
3998
-
3999
-
4000
3519
  function innerHTMLGetterPatched() {
4001
3520
  var childNodes = getInternalChildNodes(this);
4002
3521
  var innerHTML = '';
4003
-
4004
3522
  for (var i = 0, len = childNodes.length; i < len; i += 1) {
4005
3523
  innerHTML += getOuterHTML(childNodes[i]);
4006
3524
  }
4007
-
4008
3525
  return innerHTML;
4009
3526
  }
4010
-
4011
3527
  function outerHTMLGetterPatched() {
4012
3528
  return getOuterHTML(this);
4013
3529
  }
4014
-
4015
3530
  function attachShadowPatched(options) {
4016
3531
  // To retain native behavior of the API, provide synthetic shadowRoot only when specified
4017
3532
  if (options[KEY__SYNTHETIC_MODE]) {
4018
3533
  return attachShadow(this, options);
4019
3534
  }
4020
-
4021
3535
  return attachShadow$1.call(this, options);
4022
3536
  }
4023
-
4024
3537
  function shadowRootGetterPatched() {
4025
3538
  if (isSyntheticShadowHost(this)) {
4026
3539
  var shadow = getShadowRoot(this);
4027
-
4028
3540
  if (shadow.mode === 'open') {
4029
3541
  return shadow;
4030
3542
  }
4031
3543
  }
4032
-
4033
3544
  return shadowRootGetter.call(this);
4034
3545
  }
4035
-
4036
3546
  function childrenGetterPatched() {
4037
3547
  var owner = getNodeOwner(this);
4038
3548
  var childNodes = isNull(owner) ? [] : getAllMatches(owner, getFilteredChildNodes(this));
@@ -4040,22 +3550,18 @@
4040
3550
  return node instanceof Element;
4041
3551
  }));
4042
3552
  }
4043
-
4044
3553
  function childElementCountGetterPatched() {
4045
3554
  return this.children.length;
4046
3555
  }
4047
-
4048
3556
  function firstElementChildGetterPatched() {
4049
3557
  return this.children[0] || null;
4050
3558
  }
4051
-
4052
3559
  function lastElementChildGetterPatched() {
4053
3560
  var children = this.children;
4054
3561
  return children.item(children.length - 1) || null;
4055
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
3562
+ }
3563
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
4056
3564
  // do not five access to nodes beyond the immediate children.
4057
-
4058
-
4059
3565
  defineProperties(Element.prototype, {
4060
3566
  innerHTML: {
4061
3567
  get: function get() {
@@ -4063,15 +3569,12 @@
4063
3569
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4064
3570
  return innerHTMLGetterPatched.call(this);
4065
3571
  }
4066
-
4067
3572
  return innerHTMLGetter.call(this);
4068
- } // TODO [#1222]: remove global bypass
4069
-
4070
-
3573
+ }
3574
+ // TODO [#1222]: remove global bypass
4071
3575
  if (isGlobalPatchingSkipped(this)) {
4072
3576
  return innerHTMLGetter.call(this);
4073
3577
  }
4074
-
4075
3578
  return innerHTMLGetterPatched.call(this);
4076
3579
  },
4077
3580
  set: function set(v) {
@@ -4086,15 +3589,12 @@
4086
3589
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
4087
3590
  return outerHTMLGetterPatched.call(this);
4088
3591
  }
4089
-
4090
3592
  return outerHTMLGetter.call(this);
4091
- } // TODO [#1222]: remove global bypass
4092
-
4093
-
3593
+ }
3594
+ // TODO [#1222]: remove global bypass
4094
3595
  if (isGlobalPatchingSkipped(this)) {
4095
3596
  return outerHTMLGetter.call(this);
4096
3597
  }
4097
-
4098
3598
  return outerHTMLGetterPatched.call(this);
4099
3599
  },
4100
3600
  set: function set(v) {
@@ -4120,7 +3620,6 @@
4120
3620
  if (hasMountedChildren(this)) {
4121
3621
  return childrenGetterPatched.call(this);
4122
3622
  }
4123
-
4124
3623
  return childrenGetter.call(this);
4125
3624
  },
4126
3625
  enumerable: true,
@@ -4131,7 +3630,6 @@
4131
3630
  if (hasMountedChildren(this)) {
4132
3631
  return childElementCountGetterPatched.call(this);
4133
3632
  }
4134
-
4135
3633
  return childElementCountGetter.call(this);
4136
3634
  },
4137
3635
  enumerable: true,
@@ -4142,7 +3640,6 @@
4142
3640
  if (hasMountedChildren(this)) {
4143
3641
  return firstElementChildGetterPatched.call(this);
4144
3642
  }
4145
-
4146
3643
  return firstElementChildGetter.call(this);
4147
3644
  },
4148
3645
  enumerable: true,
@@ -4153,7 +3650,6 @@
4153
3650
  if (hasMountedChildren(this)) {
4154
3651
  return lastElementChildGetterPatched.call(this);
4155
3652
  }
4156
-
4157
3653
  return lastElementChildGetter.call(this);
4158
3654
  },
4159
3655
  enumerable: true,
@@ -4164,30 +3660,24 @@
4164
3660
  enumerable: true,
4165
3661
  configurable: true
4166
3662
  }
4167
- }); // IE11 extra patches for wrong prototypes
4168
-
3663
+ });
3664
+ // IE11 extra patches for wrong prototypes
4169
3665
  if (hasOwnProperty.call(HTMLElement.prototype, 'innerHTML')) {
4170
3666
  defineProperty(HTMLElement.prototype, 'innerHTML', getOwnPropertyDescriptor(Element.prototype, 'innerHTML'));
4171
3667
  }
4172
-
4173
3668
  if (hasOwnProperty.call(HTMLElement.prototype, 'outerHTML')) {
4174
3669
  defineProperty(HTMLElement.prototype, 'outerHTML', getOwnPropertyDescriptor(Element.prototype, 'outerHTML'));
4175
3670
  }
4176
-
4177
3671
  if (hasOwnProperty.call(HTMLElement.prototype, 'children')) {
4178
3672
  defineProperty(HTMLElement.prototype, 'children', getOwnPropertyDescriptor(Element.prototype, 'children'));
4179
- } // Deep-traversing patches from this point on:
4180
-
4181
-
3673
+ }
3674
+ // Deep-traversing patches from this point on:
4182
3675
  function querySelectorPatched() {
4183
3676
  var _this3 = this;
4184
-
4185
3677
  var nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
4186
-
4187
3678
  if (isSyntheticShadowHost(this)) {
4188
3679
  // element with shadowRoot attached
4189
3680
  var owner = getNodeOwner(this);
4190
-
4191
3681
  if (!isUndefined(getNodeKey(this))) {
4192
3682
  // it is a custom element, and we should then filter by slotted elements
4193
3683
  return getFirstSlottedMatch(this, nodeList);
@@ -4200,7 +3690,6 @@
4200
3690
  } else if (isNodeShadowed(this)) {
4201
3691
  // element inside a shadowRoot
4202
3692
  var ownerKey = getNodeOwnerKey(this);
4203
-
4204
3693
  if (!isUndefined(ownerKey)) {
4205
3694
  // `this` is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
4206
3695
  var elm = ArrayFind.call(nodeList, function (elm) {
@@ -4211,16 +3700,13 @@
4211
3700
  if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
4212
3701
  // `this` is a manually inserted element inside a shadowRoot, return the first element.
4213
3702
  return nodeList.length === 0 ? null : nodeList[0];
4214
- } // Element is inside a shadow but we dont know which one. Use the
3703
+ }
3704
+ // Element is inside a shadow but we dont know which one. Use the
4215
3705
  // "nearest" owner key to filter by ownership.
4216
-
4217
-
4218
3706
  var contextNearestOwnerKey = getNodeNearestOwnerKey(this);
4219
-
4220
3707
  var _elm = ArrayFind.call(nodeList, function (elm) {
4221
3708
  return getNodeNearestOwnerKey(elm) === contextNearestOwnerKey;
4222
3709
  });
4223
-
4224
3710
  return isUndefined(_elm) ? null : _elm;
4225
3711
  }
4226
3712
  } else {
@@ -4229,25 +3715,21 @@
4229
3715
  var _elm3 = nodeList[0];
4230
3716
  return isUndefined(_elm3) ? null : _elm3;
4231
3717
  }
4232
- } // element belonging to the document
4233
-
4234
-
4235
- var _elm2 = ArrayFind.call(nodeList, // TODO [#1222]: remove global bypass
3718
+ }
3719
+ // element belonging to the document
3720
+ var _elm2 = ArrayFind.call(nodeList,
3721
+ // TODO [#1222]: remove global bypass
4236
3722
  function (elm) {
4237
3723
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(_this3);
4238
3724
  });
4239
-
4240
3725
  return isUndefined(_elm2) ? null : _elm2;
4241
3726
  }
4242
3727
  }
4243
-
4244
3728
  function getFilteredArrayOfNodes(context, unfilteredNodes, shadowDomSemantic) {
4245
3729
  var filtered;
4246
-
4247
3730
  if (isSyntheticShadowHost(context)) {
4248
3731
  // element with shadowRoot attached
4249
3732
  var owner = getNodeOwner(context);
4250
-
4251
3733
  if (!isUndefined(getNodeKey(context))) {
4252
3734
  // it is a custom element, and we should then filter by slotted elements
4253
3735
  filtered = getAllSlottedMatches(context, unfilteredNodes);
@@ -4260,15 +3742,12 @@
4260
3742
  } else if (isNodeShadowed(context)) {
4261
3743
  // element inside a shadowRoot
4262
3744
  var ownerKey = getNodeOwnerKey(context);
4263
-
4264
3745
  if (!isUndefined(ownerKey)) {
4265
3746
  // context is handled by lwc, using getNodeNearestOwnerKey to include manually inserted elements in the same shadow.
4266
3747
  filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
4267
3748
  return getNodeNearestOwnerKey(elm) === ownerKey;
4268
3749
  });
4269
- } else if (shadowDomSemantic === 1
4270
- /* ShadowDomSemantic.Enabled */
4271
- ) {
3750
+ } else if (shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
4272
3751
  // context is inside a shadow, we dont know which one.
4273
3752
  var contextNearestOwnerKey = getNodeNearestOwnerKey(context);
4274
3753
  filtered = ArrayFilter.call(unfilteredNodes, function (elm) {
@@ -4279,11 +3758,10 @@
4279
3758
  filtered = ArraySlice.call(unfilteredNodes);
4280
3759
  }
4281
3760
  } else {
4282
- if (context instanceof HTMLBodyElement || shadowDomSemantic === 1
4283
- /* ShadowDomSemantic.Enabled */
4284
- ) {
3761
+ if (context instanceof HTMLBodyElement || shadowDomSemantic === 1 /* ShadowDomSemantic.Enabled */) {
4285
3762
  // `context` is document.body or element belonging to the document with the patch enabled
4286
- filtered = ArrayFilter.call(unfilteredNodes, // TODO [#1222]: remove global bypass
3763
+ filtered = ArrayFilter.call(unfilteredNodes,
3764
+ // TODO [#1222]: remove global bypass
4287
3765
  function (elm) {
4288
3766
  return isUndefined(getNodeOwnerKey(elm)) || isGlobalPatchingSkipped(context);
4289
3767
  });
@@ -4292,9 +3770,9 @@
4292
3770
  filtered = ArraySlice.call(unfilteredNodes);
4293
3771
  }
4294
3772
  }
4295
-
4296
3773
  return filtered;
4297
- } // The following patched methods hide shadowed elements from global
3774
+ }
3775
+ // The following patched methods hide shadowed elements from global
4298
3776
  // traversing mechanisms. They are simplified for performance reasons to
4299
3777
  // filter by ownership and do not account for slotted elements. This
4300
3778
  // compromise is fine for our synthetic shadow dom because root elements
@@ -4303,8 +3781,6 @@
4303
3781
  // static HTMLCollection or static NodeList. We decided that this compromise
4304
3782
  // is not a big problem considering the amount of code that is relying on
4305
3783
  // the liveliness of these results are rare.
4306
-
4307
-
4308
3784
  defineProperties(Element.prototype, {
4309
3785
  querySelector: {
4310
3786
  value: querySelectorPatched,
@@ -4315,37 +3791,28 @@
4315
3791
  querySelectorAll: {
4316
3792
  value: function value() {
4317
3793
  var nodeList = arrayFromCollection(querySelectorAll$1.apply(this, ArraySlice.call(arguments)));
4318
-
4319
3794
  if (!lwcRuntimeFlags.ENABLE_NODE_LIST_PATCH) {
4320
- var filteredResults = getFilteredArrayOfNodes(this, nodeList, 0
4321
- /* ShadowDomSemantic.Disabled */
4322
- );
3795
+ var filteredResults = getFilteredArrayOfNodes(this, nodeList, 0 /* ShadowDomSemantic.Disabled */);
4323
3796
  return createStaticNodeList(filteredResults);
4324
3797
  }
4325
-
4326
- return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1
4327
- /* ShadowDomSemantic.Enabled */
4328
- ));
3798
+ return createStaticNodeList(getFilteredArrayOfNodes(this, nodeList, 1 /* ShadowDomSemantic.Enabled */));
4329
3799
  },
3800
+
4330
3801
  writable: true,
4331
3802
  enumerable: true,
4332
3803
  configurable: true
4333
3804
  }
4334
- }); // The following APIs are used directly by Jest internally so we avoid patching them during testing.
4335
-
3805
+ });
3806
+ // The following APIs are used directly by Jest internally so we avoid patching them during testing.
4336
3807
  {
4337
3808
  defineProperties(Element.prototype, {
4338
3809
  getElementsByClassName: {
4339
3810
  value: function value() {
4340
3811
  var elements = arrayFromCollection(getElementsByClassName$1.apply(this, ArraySlice.call(arguments)));
4341
-
4342
3812
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4343
3813
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4344
3814
  }
4345
-
4346
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1
4347
- /* ShadowDomSemantic.Enabled */
4348
- );
3815
+ var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4349
3816
  return createStaticHTMLCollection(filteredResults);
4350
3817
  },
4351
3818
  writable: true,
@@ -4355,14 +3822,10 @@
4355
3822
  getElementsByTagName: {
4356
3823
  value: function value() {
4357
3824
  var elements = arrayFromCollection(getElementsByTagName$1.apply(this, ArraySlice.call(arguments)));
4358
-
4359
3825
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4360
3826
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4361
3827
  }
4362
-
4363
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1
4364
- /* ShadowDomSemantic.Enabled */
4365
- );
3828
+ var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4366
3829
  return createStaticHTMLCollection(filteredResults);
4367
3830
  },
4368
3831
  writable: true,
@@ -4372,14 +3835,10 @@
4372
3835
  getElementsByTagNameNS: {
4373
3836
  value: function value() {
4374
3837
  var elements = arrayFromCollection(getElementsByTagNameNS$1.apply(this, ArraySlice.call(arguments)));
4375
-
4376
3838
  if (!lwcRuntimeFlags.ENABLE_HTML_COLLECTIONS_PATCH) {
4377
3839
  return createStaticHTMLCollection(getNonPatchedFilteredArrayOfNodes(this, elements));
4378
3840
  }
4379
-
4380
- var filteredResults = getFilteredArrayOfNodes(this, elements, 1
4381
- /* ShadowDomSemantic.Enabled */
4382
- );
3841
+ var filteredResults = getFilteredArrayOfNodes(this, elements, 1 /* ShadowDomSemantic.Enabled */);
4383
3842
  return createStaticHTMLCollection(filteredResults);
4384
3843
  },
4385
3844
  writable: true,
@@ -4387,48 +3846,39 @@
4387
3846
  configurable: true
4388
3847
  }
4389
3848
  });
4390
- } // IE11 extra patches for wrong prototypes
4391
-
4392
-
3849
+ }
3850
+ // IE11 extra patches for wrong prototypes
4393
3851
  if (hasOwnProperty.call(HTMLElement.prototype, 'getElementsByClassName')) {
4394
3852
  defineProperty(HTMLElement.prototype, 'getElementsByClassName', getOwnPropertyDescriptor(Element.prototype, 'getElementsByClassName'));
4395
3853
  }
3854
+
4396
3855
  /*
4397
3856
  * Copyright (c) 2018, salesforce.com, inc.
4398
3857
  * All rights reserved.
4399
3858
  * SPDX-License-Identifier: MIT
4400
3859
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4401
3860
  */
4402
-
4403
-
4404
3861
  function getElementComputedStyle(element) {
4405
3862
  var win = getOwnerWindow(element);
4406
3863
  return windowGetComputedStyle.call(win, element);
4407
3864
  }
4408
-
4409
3865
  function getWindowSelection(node) {
4410
3866
  var win = getOwnerWindow(node);
4411
3867
  return windowGetSelection.call(win);
4412
3868
  }
4413
-
4414
3869
  function nodeIsBeingRendered(nodeComputedStyle) {
4415
3870
  return nodeComputedStyle.visibility === 'visible' && nodeComputedStyle.display !== 'none';
4416
3871
  }
4417
-
4418
3872
  function getSelectionState(element) {
4419
3873
  var win = getOwnerWindow(element);
4420
3874
  var selection = getWindowSelection(element);
4421
-
4422
3875
  if (selection === null) {
4423
3876
  return null;
4424
3877
  }
4425
-
4426
3878
  var ranges = [];
4427
-
4428
3879
  for (var i = 0; i < selection.rangeCount; i++) {
4429
3880
  ranges.push(selection.getRangeAt(i));
4430
3881
  }
4431
-
4432
3882
  var state = {
4433
3883
  element: element,
4434
3884
  onselect: win.onselect,
@@ -4441,25 +3891,21 @@
4441
3891
  win.onselectionchange = null;
4442
3892
  return state;
4443
3893
  }
4444
-
4445
3894
  function restoreSelectionState(state) {
4446
3895
  if (state === null) {
4447
3896
  return;
4448
3897
  }
4449
-
4450
3898
  var element = state.element,
4451
- onselect = state.onselect,
4452
- onselectstart = state.onselectstart,
4453
- onselectionchange = state.onselectionchange,
4454
- ranges = state.ranges;
3899
+ onselect = state.onselect,
3900
+ onselectstart = state.onselectstart,
3901
+ onselectionchange = state.onselectionchange,
3902
+ ranges = state.ranges;
4455
3903
  var win = getOwnerWindow(element);
4456
3904
  var selection = getWindowSelection(element);
4457
3905
  selection.removeAllRanges();
4458
-
4459
3906
  for (var i = 0; i < ranges.length; i++) {
4460
3907
  selection.addRange(ranges[i]);
4461
3908
  }
4462
-
4463
3909
  win.onselect = onselect;
4464
3910
  win.onselectstart = onselectstart;
4465
3911
  win.onselectionchange = onselectionchange;
@@ -4470,37 +3916,29 @@
4470
3916
  * NOTE: For performance reasons, since this function will be called multiple times while calculating the innerText of
4471
3917
  * an element, it does not restore the current selection.
4472
3918
  */
4473
-
4474
-
4475
3919
  function getTextNodeInnerText(textNode) {
4476
3920
  var selection = getWindowSelection(textNode);
4477
-
4478
3921
  if (selection === null) {
4479
3922
  return textNode.textContent || '';
4480
3923
  }
4481
-
4482
3924
  var range = document.createRange();
4483
3925
  range.selectNodeContents(textNode);
4484
3926
  var domRect = range.getBoundingClientRect();
4485
-
4486
3927
  if (domRect.height <= 0 || domRect.width <= 0) {
4487
3928
  // the text node is not rendered
4488
3929
  return '';
4489
- } // Needed to remove non rendered characters from the text node.
4490
-
4491
-
3930
+ }
3931
+ // Needed to remove non rendered characters from the text node.
4492
3932
  selection.removeAllRanges();
4493
3933
  selection.addRange(range);
4494
- var selectionText = selection.toString(); // The textNode is visible, but it may not be selectable. When the text is not selectable,
3934
+ var selectionText = selection.toString();
3935
+ // The textNode is visible, but it may not be selectable. When the text is not selectable,
4495
3936
  // textContent is the nearest approximation to innerText.
4496
-
4497
3937
  return selectionText ? selectionText : textNode.textContent || '';
4498
3938
  }
4499
-
4500
3939
  var nodeIsElement = function nodeIsElement(node) {
4501
3940
  return node.nodeType === ELEMENT_NODE;
4502
3941
  };
4503
-
4504
3942
  var nodeIsText = function nodeIsText(node) {
4505
3943
  return node.nodeType === TEXT_NODE;
4506
3944
  };
@@ -4508,15 +3946,11 @@
4508
3946
  * Spec: https://html.spec.whatwg.org/multipage/dom.html#inner-text-collection-steps
4509
3947
  * One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1132
4510
3948
  */
4511
-
4512
-
4513
3949
  function innerTextCollectionSteps(node) {
4514
3950
  var items = [];
4515
-
4516
3951
  if (nodeIsElement(node)) {
4517
3952
  var tagName = node.tagName;
4518
3953
  var computedStyle = getElementComputedStyle(node);
4519
-
4520
3954
  if (tagName === 'OPTION') {
4521
3955
  // For options, is hard to get the "rendered" text, let's use the original getter.
4522
3956
  return [1, innerTextGetter.call(node), 1];
@@ -4524,49 +3958,37 @@
4524
3958
  return [];
4525
3959
  } else {
4526
3960
  var childNodes = node.childNodes;
4527
-
4528
3961
  for (var i = 0, n = childNodes.length; i < n; i++) {
4529
3962
  ArrayPush.apply(items, innerTextCollectionSteps(childNodes[i]));
4530
3963
  }
4531
3964
  }
4532
-
4533
3965
  if (!nodeIsBeingRendered(computedStyle)) {
4534
3966
  if (tagName === 'SELECT' || tagName === 'DATALIST') {
4535
3967
  // the select is either: .visibility != 'visible' or .display === hidden, therefore this select should
4536
3968
  // not display any value.
4537
3969
  return [];
4538
3970
  }
4539
-
4540
3971
  return items;
4541
3972
  }
4542
-
4543
3973
  if (tagName === 'BR') {
4544
- items.push("\n"
4545
- /* line feed */
4546
- );
3974
+ items.push("\n" /* line feed */);
4547
3975
  }
4548
3976
 
4549
3977
  var display = computedStyle.display;
4550
-
4551
3978
  if (display === 'table-cell') {
4552
3979
  // omitting case: and node's CSS box is not the last 'table-cell' box of its enclosing 'table-row' box
4553
- items.push("\t"
4554
- /* tab */
4555
- );
3980
+ items.push("\t" /* tab */);
4556
3981
  }
4557
3982
 
4558
3983
  if (display === 'table-row') {
4559
3984
  // omitting case: and node's CSS box is not the last 'table-row' box of the nearest ancestor 'table' box
4560
- items.push("\n"
4561
- /* line feed */
4562
- );
3985
+ items.push("\n" /* line feed */);
4563
3986
  }
4564
3987
 
4565
3988
  if (tagName === 'P') {
4566
3989
  items.unshift(2);
4567
3990
  items.push(2);
4568
3991
  }
4569
-
4570
3992
  if (display === 'block' || display === 'table-caption' || display === 'flex' || display === 'table') {
4571
3993
  items.unshift(1);
4572
3994
  items.push(1);
@@ -4574,7 +3996,6 @@
4574
3996
  } else if (nodeIsText(node)) {
4575
3997
  items.push(getTextNodeInnerText(node));
4576
3998
  }
4577
-
4578
3999
  return items;
4579
4000
  }
4580
4001
  /**
@@ -4582,39 +4003,29 @@
4582
4003
  *
4583
4004
  * One spec implementation: https://github.com/servo/servo/blob/721271dcd3c20db5ca8cf146e2b5907647afb4d6/components/layout/query.rs#L1087
4584
4005
  */
4585
-
4586
-
4587
4006
  function getInnerText(element) {
4588
4007
  var thisComputedStyle = getElementComputedStyle(element);
4589
-
4590
4008
  if (!nodeIsBeingRendered(thisComputedStyle)) {
4591
4009
  return getTextContent(element) || '';
4592
4010
  }
4593
-
4594
4011
  var selectionState = getSelectionState(element);
4595
4012
  var results = [];
4596
4013
  var childNodes = element.childNodes;
4597
-
4598
4014
  for (var i = 0, n = childNodes.length; i < n; i++) {
4599
4015
  ArrayPush.apply(results, innerTextCollectionSteps(childNodes[i]));
4600
4016
  }
4601
-
4602
4017
  restoreSelectionState(selectionState);
4603
4018
  var elementInnerText = '';
4604
4019
  var maxReqLineBreakCount = 0;
4605
-
4606
4020
  for (var _i = 0, _n = results.length; _i < _n; _i++) {
4607
4021
  var item = results[_i];
4608
-
4609
4022
  if (typeof item === 'string') {
4610
4023
  if (maxReqLineBreakCount > 0) {
4611
4024
  for (var j = 0; j < maxReqLineBreakCount; j++) {
4612
4025
  elementInnerText += "\n";
4613
4026
  }
4614
-
4615
4027
  maxReqLineBreakCount = 0;
4616
4028
  }
4617
-
4618
4029
  if (item.length > 0) {
4619
4030
  elementInnerText += item;
4620
4031
  }
@@ -4622,30 +4033,26 @@
4622
4033
  if (elementInnerText.length == 0) {
4623
4034
  // Remove required line break count at the start.
4624
4035
  continue;
4625
- } // Store the count if it's the max of this run,
4036
+ }
4037
+ // Store the count if it's the max of this run,
4626
4038
  // but it may be ignored if no text item is found afterwards,
4627
4039
  // which means that these are consecutive line breaks at the end.
4628
-
4629
-
4630
4040
  if (item > maxReqLineBreakCount) {
4631
4041
  maxReqLineBreakCount = item;
4632
4042
  }
4633
4043
  }
4634
4044
  }
4635
-
4636
4045
  return elementInnerText;
4637
4046
  }
4047
+
4638
4048
  /*
4639
4049
  * Copyright (c) 2018, salesforce.com, inc.
4640
4050
  * All rights reserved.
4641
4051
  * SPDX-License-Identifier: MIT
4642
4052
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4643
4053
  */
4644
-
4645
-
4646
4054
  var FocusableSelector = "\n [contenteditable],\n [tabindex],\n a[href],\n area[href],\n audio[controls],\n button,\n iframe,\n input,\n select,\n textarea,\n video[controls]\n";
4647
4055
  var formElementTagNames = new Set(['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA']);
4648
-
4649
4056
  function filterSequentiallyFocusableElements(elements) {
4650
4057
  return elements.filter(function (element) {
4651
4058
  if (hasAttribute.call(element, 'tabindex')) {
@@ -4654,97 +4061,78 @@
4654
4061
  // than filtering out elements based on tabindex="-1".
4655
4062
  return getAttribute.call(element, 'tabindex') === '0';
4656
4063
  }
4657
-
4658
4064
  if (formElementTagNames.has(tagNameGetter.call(element))) {
4659
4065
  return !hasAttribute.call(element, 'disabled');
4660
4066
  }
4661
-
4662
4067
  return true;
4663
4068
  });
4664
4069
  }
4665
-
4666
- var DidAddMouseEventListeners = new WeakMap(); // Due to browser differences, it is impossible to know what is focusable until
4070
+ var DidAddMouseEventListeners = new WeakMap();
4071
+ // Due to browser differences, it is impossible to know what is focusable until
4667
4072
  // we actually try to focus it. We need to refactor our focus delegation logic
4668
4073
  // to verify whether or not the target was actually focused instead of trying
4669
4074
  // to predict focusability like we do here.
4670
-
4671
4075
  function isVisible(element) {
4672
4076
  var _getBoundingClientRec = getBoundingClientRect.call(element),
4673
- width = _getBoundingClientRec.width,
4674
- height = _getBoundingClientRec.height;
4675
-
4676
- var noZeroSize = width > 0 || height > 0; // The area element can be 0x0 and focusable. Hardcoding this is not ideal
4077
+ width = _getBoundingClientRec.width,
4078
+ height = _getBoundingClientRec.height;
4079
+ var noZeroSize = width > 0 || height > 0;
4080
+ // The area element can be 0x0 and focusable. Hardcoding this is not ideal
4677
4081
  // but it will minimize changes in the current behavior.
4678
-
4679
4082
  var isAreaElement = element.tagName === 'AREA';
4680
4083
  return (noZeroSize || isAreaElement) && getComputedStyle(element).visibility !== 'hidden';
4681
- } // This function based on https://allyjs.io/data-tables/focusable.html
4084
+ }
4085
+ // This function based on https://allyjs.io/data-tables/focusable.html
4682
4086
  // It won't catch everything, but should be good enough
4683
4087
  // There are a lot of edge cases here that we can't realistically handle
4684
4088
  // Determines if a particular element is tabbable, as opposed to simply focusable
4685
-
4686
-
4687
4089
  function isTabbable(element) {
4688
4090
  if (isSyntheticShadowHost(element) && isDelegatingFocus(element)) {
4689
4091
  return false;
4690
4092
  }
4691
-
4692
4093
  return matches.call(element, FocusableSelector) && isVisible(element);
4693
4094
  }
4694
-
4695
4095
  function hostElementFocus() {
4696
4096
  var _rootNode = this.getRootNode();
4697
-
4698
4097
  if (_rootNode === this) {
4699
4098
  // We invoke the focus() method even if the host is disconnected in order to eliminate
4700
4099
  // observable differences for component authors between synthetic and native.
4701
4100
  var focusable = querySelector.call(this, FocusableSelector);
4702
-
4703
4101
  if (!isNull(focusable)) {
4704
4102
  // @ts-ignore type-mismatch
4705
4103
  focusable.focus.apply(focusable, arguments);
4706
4104
  }
4707
-
4708
4105
  return;
4709
- } // If the root node is not the host element then it's either the document or a shadow root.
4710
-
4711
-
4106
+ }
4107
+ // If the root node is not the host element then it's either the document or a shadow root.
4712
4108
  var rootNode = _rootNode;
4713
-
4714
4109
  if (rootNode.activeElement === this) {
4715
4110
  // The focused element should not change if the focus method is invoked
4716
4111
  // on the shadow-including ancestor of the currently focused element.
4717
4112
  return;
4718
4113
  }
4719
-
4720
4114
  var focusables = arrayFromCollection(querySelectorAll$1.call(this, FocusableSelector));
4721
4115
  var didFocus = false;
4722
-
4723
4116
  while (!didFocus && focusables.length !== 0) {
4724
- var _focusable = focusables.shift(); // @ts-ignore type-mismatch
4725
-
4726
-
4727
- _focusable.focus.apply(_focusable, arguments); // Get the root node of the current focusable in case it was slotted.
4728
-
4729
-
4117
+ var _focusable = focusables.shift();
4118
+ // @ts-ignore type-mismatch
4119
+ _focusable.focus.apply(_focusable, arguments);
4120
+ // Get the root node of the current focusable in case it was slotted.
4730
4121
  var currentRootNode = _focusable.getRootNode();
4731
-
4732
4122
  didFocus = currentRootNode.activeElement === _focusable;
4733
4123
  }
4734
4124
  }
4735
-
4736
4125
  function getTabbableSegments(host) {
4737
4126
  var doc = getOwnerDocument(host);
4738
4127
  var all = filterSequentiallyFocusableElements(arrayFromCollection(querySelectorAll.call(doc, FocusableSelector)));
4739
4128
  var inner = filterSequentiallyFocusableElements(arrayFromCollection(querySelectorAll$1.call(host, FocusableSelector)));
4740
-
4741
4129
  var firstChild = inner[0];
4742
4130
  var lastChild = inner[inner.length - 1];
4743
- var hostIndex = ArrayIndexOf.call(all, host); // Host element can show up in our "previous" section if its tabindex is 0
4131
+ var hostIndex = ArrayIndexOf.call(all, host);
4132
+ // Host element can show up in our "previous" section if its tabindex is 0
4744
4133
  // We want to filter that out here
4745
-
4746
- var firstChildIndex = hostIndex > -1 ? hostIndex : ArrayIndexOf.call(all, firstChild); // Account for an empty inner list
4747
-
4134
+ var firstChildIndex = hostIndex > -1 ? hostIndex : ArrayIndexOf.call(all, firstChild);
4135
+ // Account for an empty inner list
4748
4136
  var lastChildIndex = inner.length === 0 ? firstChildIndex + 1 : ArrayIndexOf.call(all, lastChild) + 1;
4749
4137
  var prev = ArraySlice.call(all, 0, firstChildIndex);
4750
4138
  var next = ArraySlice.call(all, lastChildIndex);
@@ -4754,23 +4142,18 @@
4754
4142
  next: next
4755
4143
  };
4756
4144
  }
4757
-
4758
4145
  function getActiveElement(host) {
4759
4146
  var doc = getOwnerDocument(host);
4760
4147
  var activeElement = DocumentPrototypeActiveElement.call(doc);
4761
-
4762
4148
  if (isNull(activeElement)) {
4763
4149
  return activeElement;
4764
- } // activeElement must be child of the host and owned by it
4765
-
4766
-
4150
+ }
4151
+ // activeElement must be child of the host and owned by it
4767
4152
  return (compareDocumentPosition.call(host, activeElement) & DOCUMENT_POSITION_CONTAINED_BY) !== 0 ? activeElement : null;
4768
4153
  }
4769
-
4770
4154
  function relatedTargetPosition(host, relatedTarget) {
4771
4155
  // assert: target must be child of host
4772
4156
  var pos = compareDocumentPosition.call(host, relatedTarget);
4773
-
4774
4157
  if (pos & DOCUMENT_POSITION_CONTAINED_BY) {
4775
4158
  // focus remains inside the host
4776
4159
  return 0;
@@ -4780,17 +4163,14 @@
4780
4163
  } else if (pos & DOCUMENT_POSITION_FOLLOWING) {
4781
4164
  // focus is coming from below
4782
4165
  return 2;
4783
- } // we don't know what's going on.
4784
-
4785
-
4166
+ }
4167
+ // we don't know what's going on.
4786
4168
  return -1;
4787
4169
  }
4788
-
4789
4170
  function muteEvent(event) {
4790
4171
  event.preventDefault();
4791
4172
  event.stopPropagation();
4792
4173
  }
4793
-
4794
4174
  function muteFocusEventsDuringExecution(win, func) {
4795
4175
  windowAddEventListener.call(win, 'focusin', muteEvent, true);
4796
4176
  windowAddEventListener.call(win, 'focusout', muteEvent, true);
@@ -4798,11 +4178,9 @@
4798
4178
  windowRemoveEventListener.call(win, 'focusin', muteEvent, true);
4799
4179
  windowRemoveEventListener.call(win, 'focusout', muteEvent, true);
4800
4180
  }
4801
-
4802
4181
  function focusOnNextOrBlur(segment, target, relatedTarget) {
4803
4182
  var win = getOwnerWindow(relatedTarget);
4804
4183
  var next = getNextTabbable(segment, relatedTarget);
4805
-
4806
4184
  if (isNull(next)) {
4807
4185
  // nothing to focus on, blur to invalidate the operation
4808
4186
  muteFocusEventsDuringExecution(win, function () {
@@ -4814,38 +4192,30 @@
4814
4192
  });
4815
4193
  }
4816
4194
  }
4817
-
4818
4195
  var letBrowserHandleFocus = false;
4819
-
4820
4196
  function disableKeyboardFocusNavigationRoutines() {
4821
4197
  letBrowserHandleFocus = true;
4822
4198
  }
4823
-
4824
4199
  function enableKeyboardFocusNavigationRoutines() {
4825
4200
  letBrowserHandleFocus = false;
4826
4201
  }
4827
-
4828
4202
  function isKeyboardFocusNavigationRoutineEnabled() {
4829
4203
  return !letBrowserHandleFocus;
4830
4204
  }
4831
-
4832
4205
  function skipHostHandler(event) {
4833
4206
  if (letBrowserHandleFocus) {
4834
4207
  return;
4835
4208
  }
4836
-
4837
4209
  var host = eventCurrentTargetGetter.call(event);
4838
- var target = eventTargetGetter.call(event); // If the host delegating focus with tabindex=0 is not the target, we know
4210
+ var target = eventTargetGetter.call(event);
4211
+ // If the host delegating focus with tabindex=0 is not the target, we know
4839
4212
  // that the event was dispatched on a descendant node of the host. This
4840
4213
  // means the focus is coming from below and we don't need to do anything.
4841
-
4842
4214
  if (host !== target) {
4843
4215
  // Focus is coming from above
4844
4216
  return;
4845
4217
  }
4846
-
4847
4218
  var relatedTarget = focusEventRelatedTargetGetter.call(event);
4848
-
4849
4219
  if (isNull(relatedTarget)) {
4850
4220
  // If relatedTarget is null, the user is most likely tabbing into the document from the
4851
4221
  // browser chrome. We could probably deduce whether focus is coming in from the top or the
@@ -4854,15 +4224,12 @@
4854
4224
  // document.
4855
4225
  return;
4856
4226
  }
4857
-
4858
4227
  var segments = getTabbableSegments(host);
4859
4228
  var position = relatedTargetPosition(host, relatedTarget);
4860
-
4861
4229
  if (position === 1) {
4862
4230
  // Focus is coming from above
4863
4231
  var findTabbableElms = isTabbableFrom.bind(null, host.getRootNode());
4864
4232
  var first = ArrayFind.call(segments.inner, findTabbableElms);
4865
-
4866
4233
  if (!isUndefined(first)) {
4867
4234
  var win = getOwnerWindow(first);
4868
4235
  muteFocusEventsDuringExecution(win, function () {
@@ -4876,14 +4243,11 @@
4876
4243
  focusOnNextOrBlur(ArrayReverse.call(segments.prev), target, relatedTarget);
4877
4244
  }
4878
4245
  }
4879
-
4880
4246
  function skipShadowHandler(event) {
4881
4247
  if (letBrowserHandleFocus) {
4882
4248
  return;
4883
4249
  }
4884
-
4885
4250
  var relatedTarget = focusEventRelatedTargetGetter.call(event);
4886
-
4887
4251
  if (isNull(relatedTarget)) {
4888
4252
  // If relatedTarget is null, the user is most likely tabbing into the document from the
4889
4253
  // browser chrome. We could probably deduce whether focus is coming in from the top or the
@@ -4892,87 +4256,67 @@
4892
4256
  // document.
4893
4257
  return;
4894
4258
  }
4895
-
4896
4259
  var host = eventCurrentTargetGetter.call(event);
4897
4260
  var segments = getTabbableSegments(host);
4898
-
4899
4261
  if (ArrayIndexOf.call(segments.inner, relatedTarget) !== -1) {
4900
4262
  // If relatedTarget is contained by the host's subtree we can assume that the user is
4901
4263
  // tabbing between elements inside of the shadow. Do nothing.
4902
4264
  return;
4903
4265
  }
4904
-
4905
- var target = eventTargetGetter.call(event); // Determine where the focus is coming from (Tab or Shift+Tab)
4906
-
4266
+ var target = eventTargetGetter.call(event);
4267
+ // Determine where the focus is coming from (Tab or Shift+Tab)
4907
4268
  var position = relatedTargetPosition(host, relatedTarget);
4908
-
4909
4269
  if (position === 1) {
4910
4270
  // Focus is coming from above
4911
4271
  focusOnNextOrBlur(segments.next, target, relatedTarget);
4912
4272
  }
4913
-
4914
4273
  if (position === 2) {
4915
4274
  // Focus is coming from below
4916
4275
  focusOnNextOrBlur(ArrayReverse.call(segments.prev), target, relatedTarget);
4917
4276
  }
4918
- } // Use this function to determine whether you can start from one root and end up
4277
+ }
4278
+ // Use this function to determine whether you can start from one root and end up
4919
4279
  // at another element via tabbing.
4920
-
4921
-
4922
4280
  function isTabbableFrom(fromRoot, toElm) {
4923
4281
  if (!isTabbable(toElm)) {
4924
4282
  return false;
4925
4283
  }
4926
-
4927
4284
  var ownerDocument = getOwnerDocument(toElm);
4928
4285
  var root = toElm.getRootNode();
4929
-
4930
4286
  while (root !== ownerDocument && root !== fromRoot) {
4931
4287
  var sr = root;
4932
4288
  var host = sr.host;
4933
-
4934
4289
  if (getAttribute.call(host, 'tabindex') === '-1') {
4935
4290
  return false;
4936
4291
  }
4937
-
4938
4292
  root = host && host.getRootNode();
4939
4293
  }
4940
-
4941
4294
  return true;
4942
4295
  }
4943
-
4944
4296
  function getNextTabbable(tabbables, relatedTarget) {
4945
4297
  var len = tabbables.length;
4946
-
4947
4298
  if (len > 0) {
4948
4299
  for (var i = 0; i < len; i += 1) {
4949
4300
  var next = tabbables[i];
4950
-
4951
4301
  if (isTabbableFrom(relatedTarget.getRootNode(), next)) {
4952
4302
  return next;
4953
4303
  }
4954
4304
  }
4955
4305
  }
4956
-
4957
4306
  return null;
4958
- } // Skips the host element
4959
-
4960
-
4307
+ }
4308
+ // Skips the host element
4961
4309
  function handleFocus(elm) {
4962
-
4963
- bindDocumentMousedownMouseupHandlers(elm); // Unbind any focusin listeners we may have going on
4964
-
4310
+ bindDocumentMousedownMouseupHandlers(elm);
4311
+ // Unbind any focusin listeners we may have going on
4965
4312
  ignoreFocusIn(elm);
4966
4313
  addEventListener.call(elm, 'focusin', skipHostHandler, true);
4967
4314
  }
4968
-
4969
4315
  function ignoreFocus(elm) {
4970
4316
  removeEventListener.call(elm, 'focusin', skipHostHandler, true);
4971
4317
  }
4972
-
4973
4318
  function bindDocumentMousedownMouseupHandlers(elm) {
4974
4319
  var ownerDocument = getOwnerDocument(elm);
4975
-
4976
4320
  if (!DidAddMouseEventListeners.get(ownerDocument)) {
4977
4321
  DidAddMouseEventListeners.set(ownerDocument, true);
4978
4322
  addEventListener.call(ownerDocument, 'mousedown', disableKeyboardFocusNavigationRoutines, true);
@@ -4989,63 +4333,55 @@
4989
4333
  // mouseup | FOCUSIN
4990
4334
  // mouseup-setTimeout | mouseup-setTimeout
4991
4335
  setTimeout(enableKeyboardFocusNavigationRoutines);
4992
- }, true); // [W-7824445] If the element is draggable, the mousedown event is dispatched before the
4336
+ }, true);
4337
+ // [W-7824445] If the element is draggable, the mousedown event is dispatched before the
4993
4338
  // element is starting to be dragged, which disable the keyboard focus navigation routine.
4994
4339
  // But by specification, the mouseup event is never dispatched once the element is dropped.
4995
4340
  //
4996
4341
  // For all draggable element, we need to add an event listener to re-enable the keyboard
4997
4342
  // navigation routine after dragging starts.
4998
-
4999
4343
  addEventListener.call(ownerDocument, 'dragstart', enableKeyboardFocusNavigationRoutines, true);
5000
4344
  }
5001
- } // Skips the shadow tree
5002
-
5003
-
4345
+ }
4346
+ // Skips the shadow tree
5004
4347
  function handleFocusIn(elm) {
5005
-
5006
- bindDocumentMousedownMouseupHandlers(elm); // Unbind any focus listeners we may have going on
5007
-
5008
- ignoreFocus(elm); // This focusin listener is to catch focusin events from keyboard interactions
4348
+ bindDocumentMousedownMouseupHandlers(elm);
4349
+ // Unbind any focus listeners we may have going on
4350
+ ignoreFocus(elm);
4351
+ // This focusin listener is to catch focusin events from keyboard interactions
5009
4352
  // A better solution would perhaps be to listen for keydown events, but
5010
4353
  // the keydown event happens on whatever element already has focus (or no element
5011
4354
  // at all in the case of the location bar. So, instead we have to assume that focusin
5012
4355
  // without a mousedown means keyboard navigation
5013
-
5014
4356
  addEventListener.call(elm, 'focusin', skipShadowHandler, true);
5015
4357
  }
5016
-
5017
4358
  function ignoreFocusIn(elm) {
5018
4359
  removeEventListener.call(elm, 'focusin', skipShadowHandler, true);
5019
4360
  }
4361
+
5020
4362
  /*
5021
4363
  * Copyright (c) 2018, salesforce.com, inc.
5022
4364
  * All rights reserved.
5023
4365
  * SPDX-License-Identifier: MIT
5024
4366
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5025
4367
  */
5026
-
5027
-
5028
4368
  var _HTMLElement$prototyp = HTMLElement.prototype,
5029
- blur = _HTMLElement$prototyp.blur,
5030
- focus = _HTMLElement$prototyp.focus;
4369
+ blur = _HTMLElement$prototyp.blur,
4370
+ focus = _HTMLElement$prototyp.focus;
5031
4371
  /**
5032
4372
  * This method only applies to elements with a shadow attached to them
5033
4373
  */
5034
-
5035
4374
  function tabIndexGetterPatched() {
5036
4375
  if (isDelegatingFocus(this) && isFalse(hasAttribute.call(this, 'tabindex'))) {
5037
4376
  // this covers the case where the default tabindex should be 0 because the
5038
4377
  // custom element is delegating its focus
5039
4378
  return 0;
5040
4379
  }
5041
-
5042
4380
  return tabIndexGetter.call(this);
5043
4381
  }
5044
4382
  /**
5045
4383
  * This method only applies to elements with a shadow attached to them
5046
4384
  */
5047
-
5048
-
5049
4385
  function tabIndexSetterPatched(value) {
5050
4386
  // This tabIndex setter might be confusing unless it is understood that HTML
5051
4387
  // elements have default tabIndex property values. Natively focusable elements have
@@ -5053,53 +4389,48 @@
5053
4389
  // value of -1. For example, the tabIndex property value is -1 for both <x-foo> and
5054
4390
  // <x-foo tabindex="-1">, but our delegatesFocus polyfill should only kick in for
5055
4391
  // the latter case when the value of the tabindex attribute is -1.
5056
- var delegatesFocus = isDelegatingFocus(this); // Record the state of things before invoking component setter.
5057
-
4392
+ var delegatesFocus = isDelegatingFocus(this);
4393
+ // Record the state of things before invoking component setter.
5058
4394
  var prevValue = tabIndexGetter.call(this);
5059
4395
  var prevHasAttr = hasAttribute.call(this, 'tabindex');
5060
- tabIndexSetter.call(this, value); // Record the state of things after invoking component setter.
5061
-
4396
+ tabIndexSetter.call(this, value);
4397
+ // Record the state of things after invoking component setter.
5062
4398
  var currValue = tabIndexGetter.call(this);
5063
4399
  var currHasAttr = hasAttribute.call(this, 'tabindex');
5064
- var didValueChange = prevValue !== currValue; // If the tabindex attribute is initially rendered, we can assume that this setter has
4400
+ var didValueChange = prevValue !== currValue;
4401
+ // If the tabindex attribute is initially rendered, we can assume that this setter has
5065
4402
  // previously executed and a listener has been added. We must remove that listener if
5066
4403
  // the tabIndex property value has changed or if the component no longer renders a
5067
4404
  // tabindex attribute.
5068
-
5069
4405
  if (prevHasAttr && (didValueChange || isFalse(currHasAttr))) {
5070
4406
  if (prevValue === -1) {
5071
4407
  ignoreFocusIn(this);
5072
4408
  }
5073
-
5074
4409
  if (prevValue === 0 && delegatesFocus) {
5075
4410
  ignoreFocus(this);
5076
4411
  }
5077
- } // If a tabindex attribute was not rendered after invoking its setter, it means the
4412
+ }
4413
+ // If a tabindex attribute was not rendered after invoking its setter, it means the
5078
4414
  // component is taking control. Do nothing.
5079
-
5080
-
5081
4415
  if (isFalse(currHasAttr)) {
5082
4416
  return;
5083
- } // If the tabindex attribute is initially rendered, we can assume that this setter has
4417
+ }
4418
+ // If the tabindex attribute is initially rendered, we can assume that this setter has
5084
4419
  // previously executed and a listener has been added. If the tabindex attribute is still
5085
4420
  // rendered after invoking the setter AND the tabIndex property value has not changed,
5086
4421
  // we don't need to do any work.
5087
-
5088
-
5089
4422
  if (prevHasAttr && currHasAttr && isFalse(didValueChange)) {
5090
4423
  return;
5091
- } // At this point we know that a tabindex attribute was rendered after invoking the
4424
+ }
4425
+ // At this point we know that a tabindex attribute was rendered after invoking the
5092
4426
  // setter and that either:
5093
4427
  // 1) This is the first time this setter is being invoked.
5094
4428
  // 2) This is not the first time this setter is being invoked and the value is changing.
5095
4429
  // We need to add the appropriate listeners in either case.
5096
-
5097
-
5098
4430
  if (currValue === -1) {
5099
4431
  // Add the magic to skip the shadow tree
5100
4432
  handleFocusIn(this);
5101
4433
  }
5102
-
5103
4434
  if (currValue === 0 && delegatesFocus) {
5104
4435
  // Add the magic to skip the host element
5105
4436
  handleFocus(this);
@@ -5108,60 +4439,50 @@
5108
4439
  /**
5109
4440
  * This method only applies to elements with a shadow attached to them
5110
4441
  */
5111
-
5112
-
5113
4442
  function blurPatched() {
5114
4443
  if (isDelegatingFocus(this)) {
5115
4444
  var currentActiveElement = getActiveElement(this);
5116
-
5117
4445
  if (!isNull(currentActiveElement)) {
5118
4446
  // if there is an active element, blur it (intentionally using the dot notation in case the user defines the blur routine)
5119
4447
  currentActiveElement.blur();
5120
4448
  return;
5121
4449
  }
5122
4450
  }
5123
-
5124
4451
  return blur.call(this);
5125
4452
  }
5126
-
5127
4453
  function focusPatched() {
5128
4454
  // Save enabled state
5129
- var originallyEnabled = isKeyboardFocusNavigationRoutineEnabled(); // Change state by disabling if originally enabled
5130
-
4455
+ var originallyEnabled = isKeyboardFocusNavigationRoutineEnabled();
4456
+ // Change state by disabling if originally enabled
5131
4457
  if (originallyEnabled) {
5132
4458
  disableKeyboardFocusNavigationRoutines();
5133
4459
  }
5134
-
5135
4460
  if (isSyntheticShadowHost(this) && isDelegatingFocus(this)) {
5136
4461
  hostElementFocus.call(this);
5137
4462
  return;
5138
- } // Typescript does not like it when you treat the `arguments` object as an array
4463
+ }
4464
+ // Typescript does not like it when you treat the `arguments` object as an array
5139
4465
  // @ts-ignore type-mismatch
5140
-
5141
-
5142
- focus.apply(this, arguments); // Restore state by enabling if originally enabled
5143
-
4466
+ focus.apply(this, arguments);
4467
+ // Restore state by enabling if originally enabled
5144
4468
  if (originallyEnabled) {
5145
4469
  enableKeyboardFocusNavigationRoutines();
5146
4470
  }
5147
- } // Non-deep-traversing patches: this descriptor map includes all descriptors that
4471
+ }
4472
+ // Non-deep-traversing patches: this descriptor map includes all descriptors that
5148
4473
  // do not five access to nodes beyond the immediate children.
5149
-
5150
-
5151
4474
  defineProperties(HTMLElement.prototype, {
5152
4475
  tabIndex: {
5153
4476
  get: function get() {
5154
4477
  if (isSyntheticShadowHost(this)) {
5155
4478
  return tabIndexGetterPatched.call(this);
5156
4479
  }
5157
-
5158
4480
  return tabIndexGetter.call(this);
5159
4481
  },
5160
4482
  set: function set(v) {
5161
4483
  if (isSyntheticShadowHost(this)) {
5162
4484
  return tabIndexSetterPatched.call(this, v);
5163
4485
  }
5164
-
5165
4486
  return tabIndexSetter.call(this, v);
5166
4487
  },
5167
4488
  enumerable: true,
@@ -5172,7 +4493,6 @@
5172
4493
  if (isSyntheticShadowHost(this)) {
5173
4494
  return blurPatched.call(this);
5174
4495
  }
5175
-
5176
4496
  blur.call(this);
5177
4497
  },
5178
4498
  enumerable: true,
@@ -5189,28 +4509,24 @@
5189
4509
  writable: true,
5190
4510
  configurable: true
5191
4511
  }
5192
- }); // Note: In JSDOM innerText is not implemented: https://github.com/jsdom/jsdom/issues/1245
5193
-
4512
+ });
4513
+ // Note: In JSDOM innerText is not implemented: https://github.com/jsdom/jsdom/issues/1245
5194
4514
  if (innerTextGetter !== null && innerTextSetter !== null) {
5195
4515
  defineProperty(HTMLElement.prototype, 'innerText', {
5196
4516
  get: function get() {
5197
4517
  if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
5198
4518
  return innerTextGetter.call(this);
5199
4519
  }
5200
-
5201
4520
  if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
5202
4521
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
5203
4522
  return getInnerText(this);
5204
4523
  }
5205
-
5206
4524
  return innerTextGetter.call(this);
5207
- } // TODO [#1222]: remove global bypass
5208
-
5209
-
4525
+ }
4526
+ // TODO [#1222]: remove global bypass
5210
4527
  if (isGlobalPatchingSkipped(this)) {
5211
4528
  return innerTextGetter.call(this);
5212
4529
  }
5213
-
5214
4530
  return getInnerText(this);
5215
4531
  },
5216
4532
  set: function set(v) {
@@ -5219,9 +4535,8 @@
5219
4535
  enumerable: true,
5220
4536
  configurable: true
5221
4537
  });
5222
- } // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
5223
-
5224
-
4538
+ }
4539
+ // Note: Firefox does not have outerText, https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText
5225
4540
  if (outerTextGetter !== null && outerTextSetter !== null) {
5226
4541
  // From https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/outerText :
5227
4542
  // HTMLElement.outerText is a non-standard property. As a getter, it returns the same value as Node.innerText.
@@ -5231,20 +4546,16 @@
5231
4546
  if (!lwcRuntimeFlags.ENABLE_INNER_OUTER_TEXT_PATCH) {
5232
4547
  return outerTextGetter.call(this);
5233
4548
  }
5234
-
5235
4549
  if (!lwcRuntimeFlags.ENABLE_ELEMENT_PATCH) {
5236
4550
  if (isNodeShadowed(this) || isSyntheticShadowHost(this)) {
5237
4551
  return getInnerText(this);
5238
4552
  }
5239
-
5240
4553
  return outerTextGetter.call(this);
5241
- } // TODO [#1222]: remove global bypass
5242
-
5243
-
4554
+ }
4555
+ // TODO [#1222]: remove global bypass
5244
4556
  if (isGlobalPatchingSkipped(this)) {
5245
4557
  return outerTextGetter.call(this);
5246
4558
  }
5247
-
5248
4559
  return getInnerText(this);
5249
4560
  },
5250
4561
  set: function set(v) {
@@ -5257,18 +4568,16 @@
5257
4568
  configurable: true
5258
4569
  });
5259
4570
  }
4571
+
5260
4572
  /*
5261
4573
  * Copyright (c) 2018, salesforce.com, inc.
5262
4574
  * All rights reserved.
5263
4575
  * SPDX-License-Identifier: MIT
5264
4576
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5265
4577
  */
5266
-
5267
-
5268
4578
  function getShadowToken(node) {
5269
4579
  return node[KEY__SHADOW_TOKEN];
5270
4580
  }
5271
-
5272
4581
  function setShadowToken(node, shadowToken) {
5273
4582
  node[KEY__SHADOW_TOKEN] = shadowToken;
5274
4583
  }
@@ -5281,20 +4590,15 @@
5281
4590
  * - this custom attribute must be unique.
5282
4591
  *
5283
4592
  **/
5284
-
5285
-
5286
4593
  defineProperty(Element.prototype, KEY__SHADOW_TOKEN, {
5287
4594
  set: function set(shadowToken) {
5288
4595
  var oldShadowToken = this[KEY__SHADOW_TOKEN_PRIVATE];
5289
-
5290
4596
  if (!isUndefined(oldShadowToken) && oldShadowToken !== shadowToken) {
5291
4597
  removeAttribute.call(this, oldShadowToken);
5292
4598
  }
5293
-
5294
4599
  if (!isUndefined(shadowToken)) {
5295
4600
  setAttribute.call(this, shadowToken, '');
5296
4601
  }
5297
-
5298
4602
  this[KEY__SHADOW_TOKEN_PRIVATE] = shadowToken;
5299
4603
  },
5300
4604
  get: function get() {
@@ -5302,16 +4606,13 @@
5302
4606
  },
5303
4607
  configurable: true
5304
4608
  });
5305
-
5306
4609
  function recursivelySetShadowResolver(node, fn) {
5307
4610
  node[KEY__SHADOW_RESOLVER] = fn;
5308
4611
  var childNodes = childNodesGetter.call(node);
5309
-
5310
4612
  for (var i = 0, n = childNodes.length; i < n; i++) {
5311
4613
  recursivelySetShadowResolver(childNodes[i], fn);
5312
4614
  }
5313
4615
  }
5314
-
5315
4616
  defineProperty(Element.prototype, KEY__SHADOW_STATIC, {
5316
4617
  set: function set(v) {
5317
4618
  // Marking an element as static will propagate the shadow resolver to the children.
@@ -5319,7 +4620,6 @@
5319
4620
  var fn = this[KEY__SHADOW_RESOLVER];
5320
4621
  recursivelySetShadowResolver(this, fn);
5321
4622
  }
5322
-
5323
4623
  this[KEY__SHADOW_STATIC_PRIVATE] = v;
5324
4624
  },
5325
4625
  get: function get() {
@@ -5327,57 +4627,48 @@
5327
4627
  },
5328
4628
  configurable: true
5329
4629
  });
4630
+
5330
4631
  /*
5331
4632
  * Copyright (c) 2018, salesforce.com, inc.
5332
4633
  * All rights reserved.
5333
4634
  * SPDX-License-Identifier: MIT
5334
4635
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
5335
4636
  */
5336
-
5337
- var DomManualPrivateKey = '$$DomManualKey$$'; // Resolver function used when a node is removed from within a portal
5338
-
5339
- var DocumentResolverFn = function DocumentResolverFn() {}; // We can use a single observer without having to worry about leaking because
4637
+ var DomManualPrivateKey = '$$DomManualKey$$';
4638
+ // Resolver function used when a node is removed from within a portal
4639
+ var DocumentResolverFn = function DocumentResolverFn() {};
4640
+ // We can use a single observer without having to worry about leaking because
5340
4641
  // "Registered observers in a node’s registered observer list have a weak
5341
4642
  // reference to the node."
5342
4643
  // https://dom.spec.whatwg.org/#garbage-collection
5343
-
5344
-
5345
4644
  var portalObserver;
5346
4645
  var portalObserverConfig = {
5347
4646
  childList: true
5348
4647
  };
5349
-
5350
4648
  function adoptChildNode(node, fn, shadowToken) {
5351
4649
  var previousNodeShadowResolver = getShadowRootResolver(node);
5352
-
5353
4650
  if (previousNodeShadowResolver === fn) {
5354
4651
  return; // nothing to do here, it is already correctly patched
5355
4652
  }
5356
4653
 
5357
4654
  setShadowRootResolver(node, fn);
5358
-
5359
4655
  if (node instanceof Element) {
5360
4656
  setShadowToken(node, shadowToken);
5361
-
5362
4657
  if (isSyntheticShadowHost(node)) {
5363
4658
  // Root LWC elements can't get content slotted into them, therefore we don't observe their children.
5364
4659
  return;
5365
4660
  }
5366
-
5367
4661
  if (isUndefined(previousNodeShadowResolver)) {
5368
4662
  // we only care about Element without shadowResolver (no MO.observe has been called)
5369
4663
  MutationObserverObserve.call(portalObserver, node, portalObserverConfig);
5370
- } // recursively patching all children as well
5371
-
5372
-
4664
+ }
4665
+ // recursively patching all children as well
5373
4666
  var childNodes = childNodesGetter.call(node);
5374
-
5375
4667
  for (var i = 0, len = childNodes.length; i < len; i += 1) {
5376
4668
  adoptChildNode(childNodes[i], fn, shadowToken);
5377
4669
  }
5378
4670
  }
5379
4671
  }
5380
-
5381
4672
  function initPortalObserver() {
5382
4673
  return new MO(function (mutations) {
5383
4674
  forEach.call(mutations, function (mutation) {
@@ -5392,23 +4683,20 @@
5392
4683
  * (or not in the case of removal) by the element.
5393
4684
  */
5394
4685
  var elm = mutation.target,
5395
- addedNodes = mutation.addedNodes,
5396
- removedNodes = mutation.removedNodes; // the target of the mutation should always have a ShadowRootResolver attached to it
5397
-
4686
+ addedNodes = mutation.addedNodes,
4687
+ removedNodes = mutation.removedNodes;
4688
+ // the target of the mutation should always have a ShadowRootResolver attached to it
5398
4689
  var fn = getShadowRootResolver(elm);
5399
- var shadowToken = getShadowToken(elm); // Process removals first to handle the case where an element is removed and reinserted
5400
-
4690
+ var shadowToken = getShadowToken(elm);
4691
+ // Process removals first to handle the case where an element is removed and reinserted
5401
4692
  for (var i = 0, len = removedNodes.length; i < len; i += 1) {
5402
4693
  var node = removedNodes[i];
5403
-
5404
4694
  if (!(compareDocumentPosition.call(elm, node) & _Node.DOCUMENT_POSITION_CONTAINED_BY)) {
5405
4695
  adoptChildNode(node, DocumentResolverFn, undefined);
5406
4696
  }
5407
4697
  }
5408
-
5409
4698
  for (var _i2 = 0, _len = addedNodes.length; _i2 < _len; _i2 += 1) {
5410
4699
  var _node = addedNodes[_i2];
5411
-
5412
4700
  if (compareDocumentPosition.call(elm, _node) & _Node.DOCUMENT_POSITION_CONTAINED_BY) {
5413
4701
  adoptChildNode(_node, fn, shadowToken);
5414
4702
  }
@@ -5416,19 +4704,17 @@
5416
4704
  });
5417
4705
  });
5418
4706
  }
5419
-
5420
4707
  function markElementAsPortal(elm) {
5421
4708
  if (isUndefined(portalObserver)) {
5422
4709
  portalObserver = initPortalObserver();
5423
4710
  }
5424
-
5425
4711
  if (isUndefined(getShadowRootResolver(elm))) {
5426
4712
  // only an element from a within a shadowRoot should be used here
5427
4713
  throw new Error("Invalid Element");
5428
- } // install mutation observer for portals
5429
-
5430
-
5431
- MutationObserverObserve.call(portalObserver, elm, portalObserverConfig); // TODO [#1253]: optimization to synchronously adopt new child nodes added
4714
+ }
4715
+ // install mutation observer for portals
4716
+ MutationObserverObserve.call(portalObserver, elm, portalObserverConfig);
4717
+ // TODO [#1253]: optimization to synchronously adopt new child nodes added
5432
4718
  // to this elm, we can do that by patching the most common operations
5433
4719
  // on the node itself
5434
4720
  }
@@ -5447,12 +4733,9 @@
5447
4733
  *
5448
4734
  **/
5449
4735
  // TODO [#1306]: rename this to $observerConnection$
5450
-
5451
-
5452
4736
  defineProperty(Element.prototype, '$domManual$', {
5453
4737
  set: function set(v) {
5454
4738
  this[DomManualPrivateKey] = v;
5455
-
5456
4739
  if (isTrue(v)) {
5457
4740
  markElementAsPortal(this);
5458
4741
  }
@@ -5462,6 +4745,6 @@
5462
4745
  },
5463
4746
  configurable: true
5464
4747
  });
5465
- /** version: 2.28.1 */
4748
+ /** version: 2.30.0 */
5466
4749
 
5467
4750
  })();