lwc 2.5.10-alpha1 → 2.7.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 (54) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +168 -134
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +169 -135
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +2 -2
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +154 -133
  5. package/dist/engine-dom/iife/es5/engine-dom.js +185 -145
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +2 -2
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +172 -145
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +170 -136
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +2 -2
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +155 -134
  11. package/dist/engine-dom/umd/es5/engine-dom.js +186 -146
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +2 -2
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +173 -146
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +179 -142
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +2 -2
  16. package/dist/engine-server/esm/es2017/engine-server.js +179 -142
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +29 -130
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +30 -131
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.min.js +2 -2
  20. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +30 -131
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +37 -128
  22. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.min.js +2 -2
  23. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +37 -128
  24. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +31 -132
  25. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.min.js +2 -2
  26. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +31 -132
  27. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +38 -129
  28. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.min.js +2 -2
  29. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +38 -129
  30. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  31. package/dist/wire-service/iife/es2017/wire-service.js +3 -3
  32. package/dist/wire-service/iife/es2017/wire-service_debug.js +3 -3
  33. package/dist/wire-service/iife/es5/wire-service.js +12 -12
  34. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  35. package/dist/wire-service/iife/es5/wire-service_debug.js +12 -12
  36. package/dist/wire-service/umd/es2017/wire-service.js +4 -4
  37. package/dist/wire-service/umd/es2017/wire-service_debug.js +4 -4
  38. package/dist/wire-service/umd/es5/wire-service.js +13 -13
  39. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  40. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -13
  41. package/package.json +8 -8
  42. package/dist/engine/esm/es2017/engine.js +0 -7981
  43. package/dist/engine/iife/es2017/engine.js +0 -8013
  44. package/dist/engine/iife/es2017/engine.min.js +0 -9
  45. package/dist/engine/iife/es2017/engine_debug.js +0 -6541
  46. package/dist/engine/iife/es5/engine.js +0 -6060
  47. package/dist/engine/iife/es5/engine.min.js +0 -23
  48. package/dist/engine/iife/es5/engine_debug.js +0 -4856
  49. package/dist/engine/umd/es2017/engine.js +0 -8014
  50. package/dist/engine/umd/es2017/engine.min.js +0 -9
  51. package/dist/engine/umd/es2017/engine_debug.js +0 -6542
  52. package/dist/engine/umd/es5/engine.js +0 -6061
  53. package/dist/engine/umd/es5/engine.min.js +0 -23
  54. package/dist/engine/umd/es5/engine_debug.js +0 -4857
@@ -1,4857 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
- typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LWC = {}));
5
- }(this, (function (exports) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
-
22
- /* global Reflect, Promise */
23
- var extendStatics = function (d, b) {
24
- extendStatics = Object.setPrototypeOf || {
25
- __proto__: []
26
- } instanceof Array && function (d, b) {
27
- d.__proto__ = b;
28
- } || function (d, b) {
29
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
30
- };
31
-
32
- return extendStatics(d, b);
33
- };
34
-
35
- function __extends(d, b) {
36
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
37
- extendStatics(d, b);
38
-
39
- function __() {
40
- this.constructor = d;
41
- }
42
-
43
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44
- }
45
- /** @deprecated */
46
-
47
- function __spreadArrays() {
48
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
49
-
50
- for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];
51
-
52
- return r;
53
- }
54
-
55
- /* proxy-compat-disable */
56
- /*
57
- * Copyright (c) 2018, salesforce.com, inc.
58
- * All rights reserved.
59
- * SPDX-License-Identifier: MIT
60
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
61
- */
62
- function detect() {
63
- // Don't apply polyfill when ProxyCompat is enabled.
64
- if ('getKey' in Proxy) {
65
- return false;
66
- }
67
- var proxy = new Proxy([3, 4], {});
68
- var res = [1, 2].concat(proxy);
69
- return res.length !== 4;
70
- }
71
- /*
72
- * Copyright (c) 2018, salesforce.com, inc.
73
- * All rights reserved.
74
- * SPDX-License-Identifier: MIT
75
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
76
- */
77
- var isConcatSpreadable = Symbol.isConcatSpreadable;
78
- var isArray = Array.isArray;
79
- var _b = Array.prototype, ArraySlice = _b.slice, ArrayUnshift = _b.unshift, ArrayShift = _b.shift;
80
- function isObject(O) {
81
- return typeof O === 'object' ? O !== null : typeof O === 'function';
82
- } // https://www.ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
83
- function isSpreadable(O) {
84
- if (!isObject(O)) {
85
- return false;
86
- }
87
- var spreadable = O[isConcatSpreadable];
88
- return spreadable !== undefined ? Boolean(spreadable) : isArray(O);
89
- } // https://www.ecma-international.org/ecma-262/6.0/#sec-array.prototype.concat
90
- function ArrayConcatPolyfill() {
91
- var _args = [];
92
- for (var _i = 0; _i < arguments.length; _i++) {
93
- _args[_i] = arguments[_i];
94
- }
95
- var O = Object(this);
96
- var A = [];
97
- var N = 0;
98
- var items = ArraySlice.call(arguments);
99
- ArrayUnshift.call(items, O);
100
- while (items.length) {
101
- var E = ArrayShift.call(items);
102
- if (isSpreadable(E)) {
103
- var k_1 = 0;
104
- var length = E.length;
105
- for (k_1; k_1 < length; k_1 += 1, N += 1) {
106
- if (k_1 in E) {
107
- var subElement = E[k_1];
108
- A[N] = subElement;
109
- }
110
- }
111
- }
112
- else {
113
- A[N] = E;
114
- N += 1;
115
- }
116
- }
117
- return A;
118
- }
119
- function apply() {
120
- // eslint-disable-next-line no-extend-native
121
- Array.prototype.concat = ArrayConcatPolyfill;
122
- }
123
- /*
124
- * Copyright (c) 2018, salesforce.com, inc.
125
- * All rights reserved.
126
- * SPDX-License-Identifier: MIT
127
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
128
- */
129
- if (detect()) {
130
- apply();
131
- }
132
- /**
133
- * Copyright (C) 2018 salesforce.com, inc.
134
- */
135
- /*
136
- * Copyright (c) 2018, salesforce.com, inc.
137
- * All rights reserved.
138
- * SPDX-License-Identifier: MIT
139
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
140
- */
141
- function invariant(value, msg) {
142
- if (!value) {
143
- throw new Error("Invariant Violation: " + msg);
144
- }
145
- }
146
- function isTrue(value, msg) {
147
- if (!value) {
148
- throw new Error("Assert Violation: " + msg);
149
- }
150
- }
151
- function isFalse(value, msg) {
152
- if (value) {
153
- throw new Error("Assert Violation: " + msg);
154
- }
155
- }
156
- function fail(msg) {
157
- throw new Error(msg);
158
- }
159
- var assert = /*#__PURE__*/ Object.freeze({
160
- __proto__: null,
161
- invariant: invariant,
162
- isTrue: isTrue,
163
- isFalse: isFalse,
164
- fail: fail
165
- });
166
- /*
167
- * Copyright (c) 2018, salesforce.com, inc.
168
- * All rights reserved.
169
- * SPDX-License-Identifier: MIT
170
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
171
- */
172
- var assign = Object.assign, create = Object.create, defineProperty = Object.defineProperty, freeze = Object.freeze, hasOwnProperty = Object.hasOwnProperty, keys = Object.keys, seal = Object.seal, setPrototypeOf = Object.setPrototypeOf;
173
- var isArray$1 = Array.isArray;
174
- var _c = Array.prototype, ArrayJoin = _c.join, ArrayMap = _c.map, forEach = _c.forEach;
175
- var _d = String.prototype, StringReplace = _d.replace, StringToLowerCase = _d.toLowerCase;
176
- function isUndefined(obj) {
177
- return obj === undefined;
178
- }
179
- function isNull(obj) {
180
- return obj === null;
181
- }
182
- function isFalse$1(obj) {
183
- return obj === false;
184
- }
185
- function isFunction(obj) {
186
- return typeof obj === 'function';
187
- }
188
- function isObject$1(obj) {
189
- return typeof obj === 'object';
190
- }
191
- var OtS = {}.toString;
192
- function toString(obj) {
193
- if (obj && obj.toString) {
194
- // Arrays might hold objects with "null" prototype So using
195
- // Array.prototype.toString directly will cause an error Iterate through
196
- // all the items and handle individually.
197
- if (isArray$1(obj)) {
198
- return ArrayJoin.call(ArrayMap.call(obj, toString), ',');
199
- }
200
- return obj.toString();
201
- }
202
- else if (typeof obj === 'object') {
203
- return OtS.call(obj);
204
- }
205
- else {
206
- return obj + '';
207
- }
208
- }
209
- /*
210
- * Copyright (c) 2018, salesforce.com, inc.
211
- * All rights reserved.
212
- * SPDX-License-Identifier: MIT
213
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
214
- */
215
- /**
216
- * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and
217
- * ariaGrabbed) are deprecated:
218
- * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes
219
- *
220
- * The above list of 46 aria attributes is consistent with the following resources:
221
- * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
222
- * https://wicg.github.io/aom/spec/aria-reflection.html
223
- */
224
- var AriaPropertyNames = ['ariaActiveDescendant', 'ariaAtomic', 'ariaAutoComplete', 'ariaBusy', 'ariaChecked', 'ariaColCount', 'ariaColIndex', 'ariaColSpan', 'ariaControls', 'ariaCurrent', 'ariaDescribedBy', 'ariaDetails', 'ariaDisabled', 'ariaErrorMessage', 'ariaExpanded', 'ariaFlowTo', 'ariaHasPopup', 'ariaHidden', 'ariaInvalid', 'ariaKeyShortcuts', 'ariaLabel', 'ariaLabelledBy', 'ariaLevel', 'ariaLive', 'ariaModal', 'ariaMultiLine', 'ariaMultiSelectable', 'ariaOrientation', 'ariaOwns', 'ariaPlaceholder', 'ariaPosInSet', 'ariaPressed', 'ariaReadOnly', 'ariaRelevant', 'ariaRequired', 'ariaRoleDescription', 'ariaRowCount', 'ariaRowIndex', 'ariaRowSpan', 'ariaSelected', 'ariaSetSize', 'ariaSort', 'ariaValueMax', 'ariaValueMin', 'ariaValueNow', 'ariaValueText', 'role'];
225
- var _e = (function () {
226
- var AriaAttrNameToPropNameMap = create(null);
227
- var AriaPropNameToAttrNameMap = create(null); // Synthetic creation of all AOM property descriptors for Custom Elements
228
- forEach.call(AriaPropertyNames, function (propName) {
229
- var attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, function () { return 'aria-'; }));
230
- AriaAttrNameToPropNameMap[attrName] = propName;
231
- AriaPropNameToAttrNameMap[propName] = attrName;
232
- });
233
- return {
234
- AriaAttrNameToPropNameMap: AriaAttrNameToPropNameMap,
235
- AriaPropNameToAttrNameMap: AriaPropNameToAttrNameMap
236
- };
237
- })(), AriaPropNameToAttrNameMap = _e.AriaPropNameToAttrNameMap;
238
- /*
239
- * Copyright (c) 2018, salesforce.com, inc.
240
- * All rights reserved.
241
- * SPDX-License-Identifier: MIT
242
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
243
- */
244
- // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
245
- // we can't use typeof since it will fail when transpiling.
246
- var hasNativeSymbolSupport = /*@__PURE__*/ (function () { return Symbol('x').toString() === 'Symbol(x)'; })();
247
- /*
248
- * Copyright (c) 2018, salesforce.com, inc.
249
- * All rights reserved.
250
- * SPDX-License-Identifier: MIT
251
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
252
- */
253
- // This method abstracts the creation of symbols, so we can fallback to strings when native symbols
254
- // are not supported.
255
- function createHiddenField(key, namespace) {
256
- return hasNativeSymbolSupport ? Symbol(key) : "$$lwc-" + namespace + "-" + key + "$$";
257
- }
258
- var hiddenFieldsMap = new WeakMap();
259
- function setHiddenField(o, field, value) {
260
- var valuesByField = hiddenFieldsMap.get(o);
261
- if (isUndefined(valuesByField)) {
262
- valuesByField = create(null);
263
- hiddenFieldsMap.set(o, valuesByField);
264
- }
265
- valuesByField[field] = value;
266
- }
267
- function getHiddenField(o, field) {
268
- var valuesByField = hiddenFieldsMap.get(o);
269
- if (!isUndefined(valuesByField)) {
270
- return valuesByField[field];
271
- }
272
- }
273
- /** version: 1.17.8 */
274
- /*
275
- * Copyright (c) 2018, salesforce.com, inc.
276
- * All rights reserved.
277
- * SPDX-License-Identifier: MIT
278
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
279
- */
280
- function detect$1(propName) {
281
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;
282
- }
283
- /*
284
- * Copyright (c) 2018, salesforce.com, inc.
285
- * All rights reserved.
286
- * SPDX-License-Identifier: MIT
287
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
288
- */
289
- var nodeToAriaPropertyValuesMap = new WeakMap();
290
- function getAriaPropertyMap(elm) {
291
- var map = nodeToAriaPropertyValuesMap.get(elm);
292
- if (map === undefined) {
293
- map = {};
294
- nodeToAriaPropertyValuesMap.set(elm, map);
295
- }
296
- return map;
297
- }
298
- function getNormalizedAriaPropertyValue(value) {
299
- return value == null ? null : String(value);
300
- }
301
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
302
- return {
303
- get: function () {
304
- var map = getAriaPropertyMap(this);
305
- if (hasOwnProperty.call(map, propName)) {
306
- return map[propName];
307
- } // otherwise just reflect what's in the attribute
308
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
309
- },
310
- set: function (newValue) {
311
- var normalizedValue = getNormalizedAriaPropertyValue(newValue);
312
- var map = getAriaPropertyMap(this);
313
- map[propName] = normalizedValue; // reflect into the corresponding attribute
314
- if (newValue === null) {
315
- this.removeAttribute(attrName);
316
- }
317
- else {
318
- this.setAttribute(attrName, newValue);
319
- }
320
- },
321
- configurable: true,
322
- enumerable: true
323
- };
324
- }
325
- function patch(propName) {
326
- // Typescript is inferring the wrong function type for this particular
327
- // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972
328
- // @ts-ignore type-mismatch
329
- var attrName = AriaPropNameToAttrNameMap[propName];
330
- var descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
331
- Object.defineProperty(Element.prototype, propName, descriptor);
332
- }
333
- /*
334
- * Copyright (c) 2018, salesforce.com, inc.
335
- * All rights reserved.
336
- * SPDX-License-Identifier: MIT
337
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
338
- */
339
- var ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
340
- for (var i_2 = 0, len = ElementPrototypeAriaPropertyNames.length; i_2 < len; i_2 += 1) {
341
- var propName = ElementPrototypeAriaPropertyNames[i_2];
342
- if (detect$1(propName)) {
343
- patch(propName);
344
- }
345
- }
346
- /* proxy-compat-disable */
347
- /**
348
- * Copyright (C) 2018 salesforce.com, inc.
349
- */
350
- /*
351
- * Copyright (c) 2018, salesforce.com, inc.
352
- * All rights reserved.
353
- * SPDX-License-Identifier: MIT
354
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
355
- */
356
- function invariant$1(value, msg) {
357
- if (!value) {
358
- throw new Error("Invariant Violation: " + msg);
359
- }
360
- }
361
- function isTrue$1(value, msg) {
362
- if (!value) {
363
- throw new Error("Assert Violation: " + msg);
364
- }
365
- }
366
- function isFalse$2(value, msg) {
367
- if (value) {
368
- throw new Error("Assert Violation: " + msg);
369
- }
370
- }
371
- function fail$1(msg) {
372
- throw new Error(msg);
373
- }
374
- var assert$1 = /*#__PURE__*/ Object.freeze({
375
- __proto__: null,
376
- invariant: invariant$1,
377
- isTrue: isTrue$1,
378
- isFalse: isFalse$2,
379
- fail: fail$1
380
- });
381
- /*
382
- * Copyright (c) 2018, salesforce.com, inc.
383
- * All rights reserved.
384
- * SPDX-License-Identifier: MIT
385
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
386
- */
387
- var assign$1 = Object.assign, create$1 = Object.create, defineProperties$1 = Object.defineProperties, defineProperty$1 = Object.defineProperty, freeze$1 = Object.freeze, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, getOwnPropertyNames$1 = Object.getOwnPropertyNames, getPrototypeOf$1 = Object.getPrototypeOf, hasOwnProperty$1 = Object.hasOwnProperty, isFrozen$1 = Object.isFrozen, keys$1 = Object.keys, seal$1 = Object.seal, setPrototypeOf$1 = Object.setPrototypeOf;
388
- var isArray$2 = Array.isArray;
389
- var _f = Array.prototype, ArrayJoin$1 = _f.join, ArrayMap$1 = _f.map, ArrayPush$1 = _f.push, ArraySlice$2 = _f.slice, ArrayUnshift$2 = _f.unshift, forEach$1 = _f.forEach;
390
- var StringFromCharCode$1 = String.fromCharCode;
391
- var _g = String.prototype, StringCharCodeAt$1 = _g.charCodeAt, StringReplace$1 = _g.replace, StringSlice$1 = _g.slice, StringToLowerCase$1 = _g.toLowerCase;
392
- function isUndefined$1(obj) {
393
- return obj === undefined;
394
- }
395
- function isNull$1(obj) {
396
- return obj === null;
397
- }
398
- function isTrue$1$1(obj) {
399
- return obj === true;
400
- }
401
- function isFalse$1$1(obj) {
402
- return obj === false;
403
- }
404
- function isFunction$1(obj) {
405
- return typeof obj === 'function';
406
- }
407
- function isString(obj) {
408
- return typeof obj === 'string';
409
- }
410
- var OtS$1 = {}.toString;
411
- function toString$1(obj) {
412
- if (obj && obj.toString) {
413
- // Arrays might hold objects with "null" prototype So using
414
- // Array.prototype.toString directly will cause an error Iterate through
415
- // all the items and handle individually.
416
- if (isArray$2(obj)) {
417
- return ArrayJoin$1.call(ArrayMap$1.call(obj, toString$1), ',');
418
- }
419
- return obj.toString();
420
- }
421
- else if (typeof obj === 'object') {
422
- return OtS$1.call(obj);
423
- }
424
- else {
425
- return obj + '';
426
- }
427
- }
428
- function getPropertyDescriptor(o, p) {
429
- do {
430
- var d_1 = getOwnPropertyDescriptor$1(o, p);
431
- if (!isUndefined$1(d_1)) {
432
- return d_1;
433
- }
434
- o = getPrototypeOf$1(o);
435
- } while (o !== null);
436
- }
437
- /*
438
- * Copyright (c) 2018, salesforce.com, inc.
439
- * All rights reserved.
440
- * SPDX-License-Identifier: MIT
441
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
442
- */
443
- /**
444
- * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and
445
- * ariaGrabbed) are deprecated:
446
- * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes
447
- *
448
- * The above list of 46 aria attributes is consistent with the following resources:
449
- * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060
450
- * https://wicg.github.io/aom/spec/aria-reflection.html
451
- */
452
- var AriaPropertyNames$1 = ['ariaActiveDescendant', 'ariaAtomic', 'ariaAutoComplete', 'ariaBusy', 'ariaChecked', 'ariaColCount', 'ariaColIndex', 'ariaColSpan', 'ariaControls', 'ariaCurrent', 'ariaDescribedBy', 'ariaDetails', 'ariaDisabled', 'ariaErrorMessage', 'ariaExpanded', 'ariaFlowTo', 'ariaHasPopup', 'ariaHidden', 'ariaInvalid', 'ariaKeyShortcuts', 'ariaLabel', 'ariaLabelledBy', 'ariaLevel', 'ariaLive', 'ariaModal', 'ariaMultiLine', 'ariaMultiSelectable', 'ariaOrientation', 'ariaOwns', 'ariaPlaceholder', 'ariaPosInSet', 'ariaPressed', 'ariaReadOnly', 'ariaRelevant', 'ariaRequired', 'ariaRoleDescription', 'ariaRowCount', 'ariaRowIndex', 'ariaRowSpan', 'ariaSelected', 'ariaSetSize', 'ariaSort', 'ariaValueMax', 'ariaValueMin', 'ariaValueNow', 'ariaValueText', 'role'];
453
- var _h = (function () {
454
- var AriaAttrNameToPropNameMap = create$1(null);
455
- var AriaPropNameToAttrNameMap = create$1(null); // Synthetic creation of all AOM property descriptors for Custom Elements
456
- forEach$1.call(AriaPropertyNames$1, function (propName) {
457
- var attrName = StringToLowerCase$1.call(StringReplace$1.call(propName, /^aria/, function () { return 'aria-'; }));
458
- AriaAttrNameToPropNameMap[attrName] = propName;
459
- AriaPropNameToAttrNameMap[propName] = attrName;
460
- });
461
- return {
462
- AriaAttrNameToPropNameMap: AriaAttrNameToPropNameMap,
463
- AriaPropNameToAttrNameMap: AriaPropNameToAttrNameMap
464
- };
465
- })(), AriaPropNameToAttrNameMap$1 = _h.AriaPropNameToAttrNameMap;
466
- /*
467
- * Copyright (c) 2018, salesforce.com, inc.
468
- * All rights reserved.
469
- * SPDX-License-Identifier: MIT
470
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
471
- */
472
- // We use this to detect symbol support in order to avoid the expensive symbol polyfill. Note that
473
- // we can't use typeof since it will fail when transpiling.
474
- var hasNativeSymbolSupport$1 = /*@__PURE__*/ (function () { return Symbol('x').toString() === 'Symbol(x)'; })();
475
- /*
476
- * Copyright (c) 2018, salesforce.com, inc.
477
- * All rights reserved.
478
- * SPDX-License-Identifier: MIT
479
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
480
- */
481
- // This method abstracts the creation of symbols, so we can fallback to strings when native symbols
482
- // are not supported.
483
- function createHiddenField$1(key, namespace) {
484
- return hasNativeSymbolSupport$1 ? Symbol(key) : "$$lwc-" + namespace + "-" + key + "$$";
485
- }
486
- var hiddenFieldsMap$1 = new WeakMap();
487
- function setHiddenField$1(o, field, value) {
488
- var valuesByField = hiddenFieldsMap$1.get(o);
489
- if (isUndefined$1(valuesByField)) {
490
- valuesByField = create$1(null);
491
- hiddenFieldsMap$1.set(o, valuesByField);
492
- }
493
- valuesByField[field] = value;
494
- }
495
- function getHiddenField$1(o, field) {
496
- var valuesByField = hiddenFieldsMap$1.get(o);
497
- if (!isUndefined$1(valuesByField)) {
498
- return valuesByField[field];
499
- }
500
- }
501
- /**
502
- * Map composed of properties to attributes not following the HTML property to attribute mapping
503
- * convention.
504
- */
505
- var NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING$1 = new Map([['accessKey', 'accesskey'], ['readOnly', 'readonly'], ['tabIndex', 'tabindex'], ['bgColor', 'bgcolor'], ['colSpan', 'colspan'], ['rowSpan', 'rowspan'], ['contentEditable', 'contenteditable'], ['crossOrigin', 'crossorigin'], ['dateTime', 'datetime'], ['formAction', 'formaction'], ['isMap', 'ismap'], ['maxLength', 'maxlength'], ['minLength', 'minlength'], ['noValidate', 'novalidate'], ['useMap', 'usemap'], ['htmlFor', 'for']]);
506
- /**
507
- * Map associating previously transformed HTML property into HTML attribute.
508
- */
509
- var CACHED_PROPERTY_ATTRIBUTE_MAPPING$1 = new Map();
510
- function htmlPropertyToAttribute$1(propName) {
511
- var ariaAttributeName = AriaPropNameToAttrNameMap$1[propName];
512
- if (!isUndefined$1(ariaAttributeName)) {
513
- return ariaAttributeName;
514
- }
515
- var specialAttributeName = NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING$1.get(propName);
516
- if (!isUndefined$1(specialAttributeName)) {
517
- return specialAttributeName;
518
- }
519
- var cachedAttributeName = CACHED_PROPERTY_ATTRIBUTE_MAPPING$1.get(propName);
520
- if (!isUndefined$1(cachedAttributeName)) {
521
- return cachedAttributeName;
522
- }
523
- var attributeName = '';
524
- for (var i_3 = 0, len = propName.length; i_3 < len; i_3++) {
525
- var code = StringCharCodeAt$1.call(propName, i_3);
526
- if (code >= 65 && // "A"
527
- code <= 90 // "Z"
528
- ) {
529
- attributeName += '-' + StringFromCharCode$1(code + 32);
530
- }
531
- else {
532
- attributeName += StringFromCharCode$1(code);
533
- }
534
- }
535
- CACHED_PROPERTY_ATTRIBUTE_MAPPING$1.set(propName, attributeName);
536
- return attributeName;
537
- }
538
- /** version: 1.17.8 */
539
- /*
540
- * Copyright (c) 2018, salesforce.com, inc.
541
- * All rights reserved.
542
- * SPDX-License-Identifier: MIT
543
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
544
- */
545
- var nextTickCallbackQueue = [];
546
- var SPACE_CHAR = 32;
547
- var EmptyObject = seal$1(create$1(null));
548
- var EmptyArray = seal$1([]);
549
- function flushCallbackQueue() {
550
- var callbacks = nextTickCallbackQueue;
551
- nextTickCallbackQueue = []; // reset to a new queue
552
- for (var i_4 = 0, len = callbacks.length; i_4 < len; i_4 += 1) {
553
- callbacks[i_4]();
554
- }
555
- }
556
- function addCallbackToNextTick(callback) {
557
- if (nextTickCallbackQueue.length === 0) {
558
- Promise.resolve().then(flushCallbackQueue);
559
- }
560
- ArrayPush$1.call(nextTickCallbackQueue, callback);
561
- }
562
- function guid() {
563
- function s4() {
564
- return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
565
- }
566
- return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();
567
- }
568
- /*
569
- * Copyright (c) 2019, salesforce.com, inc.
570
- * All rights reserved.
571
- * SPDX-License-Identifier: MIT
572
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
573
- */
574
- var create$1$1 = Object.create;
575
- var _j = Array.prototype, ArraySplice$1$1 = _j.splice, ArrayIndexOf$1$1 = _j.indexOf, ArrayPush$1$1 = _j.push;
576
- var TargetToReactiveRecordMap = new WeakMap();
577
- function isUndefined$1$1(obj) {
578
- return obj === undefined;
579
- }
580
- function getReactiveRecord(target) {
581
- var reactiveRecord = TargetToReactiveRecordMap.get(target);
582
- if (isUndefined$1$1(reactiveRecord)) {
583
- var newRecord = create$1$1(null);
584
- reactiveRecord = newRecord;
585
- TargetToReactiveRecordMap.set(target, newRecord);
586
- }
587
- return reactiveRecord;
588
- }
589
- var currentReactiveObserver = null;
590
- function valueMutated(target, key) {
591
- var reactiveRecord = TargetToReactiveRecordMap.get(target);
592
- if (!isUndefined$1$1(reactiveRecord)) {
593
- var reactiveObservers = reactiveRecord[key];
594
- if (!isUndefined$1$1(reactiveObservers)) {
595
- for (var i_5 = 0, len = reactiveObservers.length; i_5 < len; i_5 += 1) {
596
- var ro = reactiveObservers[i_5];
597
- ro.notify();
598
- }
599
- }
600
- }
601
- }
602
- function valueObserved(target, key) {
603
- // We should determine if an active Observing Record is present to track mutations.
604
- if (currentReactiveObserver === null) {
605
- return;
606
- }
607
- var ro = currentReactiveObserver;
608
- var reactiveRecord = getReactiveRecord(target);
609
- var reactiveObservers = reactiveRecord[key];
610
- if (isUndefined$1$1(reactiveObservers)) {
611
- reactiveObservers = [];
612
- reactiveRecord[key] = reactiveObservers;
613
- }
614
- else if (reactiveObservers[0] === ro) {
615
- return; // perf optimization considering that most subscriptions will come from the same record
616
- }
617
- if (ArrayIndexOf$1$1.call(reactiveObservers, ro) === -1) {
618
- ro.link(reactiveObservers);
619
- }
620
- }
621
- var ReactiveObserver = /** @class */ (function () {
622
- function ReactiveObserver(callback) {
623
- this.listeners = [];
624
- this.callback = callback;
625
- }
626
- ReactiveObserver.prototype.observe = function (job) {
627
- var inceptionReactiveRecord = currentReactiveObserver;
628
- currentReactiveObserver = this;
629
- var error;
630
- try {
631
- job();
632
- }
633
- catch (e) {
634
- error = Object(e);
635
- }
636
- finally {
637
- currentReactiveObserver = inceptionReactiveRecord;
638
- if (error !== undefined) {
639
- throw error; // eslint-disable-line no-unsafe-finally
640
- }
641
- }
642
- };
643
- /**
644
- * This method is responsible for disconnecting the Reactive Observer
645
- * from any Reactive Record that has a reference to it, to prevent future
646
- * notifications about previously recorded access.
647
- */
648
- ReactiveObserver.prototype.reset = function () {
649
- var listeners = this.listeners;
650
- var len = listeners.length;
651
- if (len > 0) {
652
- for (var i_6 = 0; i_6 < len; i_6 += 1) {
653
- var set = listeners[i_6];
654
- var pos = ArrayIndexOf$1$1.call(listeners[i_6], this);
655
- ArraySplice$1$1.call(set, pos, 1);
656
- }
657
- listeners.length = 0;
658
- }
659
- }; // friend methods
660
- ReactiveObserver.prototype.notify = function () {
661
- this.callback.call(undefined, this);
662
- };
663
- ReactiveObserver.prototype.link = function (reactiveObservers) {
664
- ArrayPush$1$1.call(reactiveObservers, this); // we keep track of observing records where the observing record was added to so we can do some clean up later on
665
- ArrayPush$1$1.call(this.listeners, reactiveObservers);
666
- };
667
- return ReactiveObserver;
668
- }());
669
- /*
670
- * Copyright (c) 2018, salesforce.com, inc.
671
- * All rights reserved.
672
- * SPDX-License-Identifier: MIT
673
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
674
- */
675
- function componentValueMutated(vm, key) {
676
- valueMutated(vm.component, key);
677
- }
678
- function componentValueObserved(vm, key) {
679
- valueObserved(vm.component, key);
680
- }
681
- /*
682
- * Copyright (c) 2018, salesforce.com, inc.
683
- * All rights reserved.
684
- * SPDX-License-Identifier: MIT
685
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
686
- */
687
- function getComponentTag(vm) {
688
- return "<" + StringToLowerCase$1.call(vm.tagName) + ">";
689
- } // TODO [#1695]: Unify getComponentStack and getErrorComponentStack
690
- function getErrorComponentStack(vm) {
691
- var wcStack = [];
692
- var currentVm = vm;
693
- while (!isNull$1(currentVm)) {
694
- ArrayPush$1.call(wcStack, getComponentTag(currentVm));
695
- currentVm = currentVm.owner;
696
- }
697
- return wcStack.reverse().join('\n\t');
698
- }
699
- /*
700
- * Copyright (c) 2018, salesforce.com, inc.
701
- * All rights reserved.
702
- * SPDX-License-Identifier: MIT
703
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
704
- */
705
- function handleEvent(event, vnode) {
706
- var type = event.type;
707
- var on = vnode.data.on;
708
- var handler = on && on[type]; // call event handler if exists
709
- if (handler) {
710
- handler.call(undefined, event);
711
- }
712
- }
713
- function createListener() {
714
- return function handler(event) {
715
- handleEvent(event, handler.vnode);
716
- };
717
- }
718
- function updateAllEventListeners(oldVnode, vnode) {
719
- if (isUndefined$1(oldVnode.listener)) {
720
- createAllEventListeners(vnode);
721
- }
722
- else {
723
- vnode.listener = oldVnode.listener;
724
- vnode.listener.vnode = vnode;
725
- }
726
- }
727
- function createAllEventListeners(vnode) {
728
- var elm = vnode.elm, on = vnode.data.on, renderer = vnode.owner.renderer;
729
- if (isUndefined$1(on)) {
730
- return;
731
- }
732
- var listener = vnode.listener = createListener();
733
- listener.vnode = vnode;
734
- var name;
735
- for (name in on) {
736
- renderer.addEventListener(elm, name, listener);
737
- }
738
- }
739
- var modEvents = {
740
- update: updateAllEventListeners,
741
- create: createAllEventListeners
742
- };
743
- /*
744
- * Copyright (c) 2018, salesforce.com, inc.
745
- * All rights reserved.
746
- * SPDX-License-Identifier: MIT
747
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
748
- */
749
- var defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];
750
- function offsetPropertyErrorMessage(name) {
751
- return "Using the `" + name + "` property is an anti-pattern because it rounds the value to an integer. Instead, use the `getBoundingClientRect` method to obtain fractional values for the size of an element and its position relative to the viewport.";
752
- } // Global HTML Attributes & Properties
753
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes
754
- // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
755
- assign$1(create$1(null), {
756
- accessKey: {
757
- attribute: 'accesskey'
758
- },
759
- accessKeyLabel: {
760
- readOnly: true
761
- },
762
- className: {
763
- attribute: 'class',
764
- error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.'
765
- },
766
- contentEditable: {
767
- attribute: 'contenteditable'
768
- },
769
- dataset: {
770
- readOnly: true,
771
- error: "Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead."
772
- },
773
- dir: {
774
- attribute: 'dir'
775
- },
776
- draggable: {
777
- attribute: 'draggable'
778
- },
779
- dropzone: {
780
- attribute: 'dropzone',
781
- readOnly: true
782
- },
783
- hidden: {
784
- attribute: 'hidden'
785
- },
786
- id: {
787
- attribute: 'id'
788
- },
789
- inputMode: {
790
- attribute: 'inputmode'
791
- },
792
- lang: {
793
- attribute: 'lang'
794
- },
795
- slot: {
796
- attribute: 'slot',
797
- error: 'Using the `slot` property is an anti-pattern.'
798
- },
799
- spellcheck: {
800
- attribute: 'spellcheck'
801
- },
802
- style: {
803
- attribute: 'style'
804
- },
805
- tabIndex: {
806
- attribute: 'tabindex'
807
- },
808
- title: {
809
- attribute: 'title'
810
- },
811
- translate: {
812
- attribute: 'translate'
813
- },
814
- // additional "global attributes" that are not present in the link above.
815
- isContentEditable: {
816
- readOnly: true
817
- },
818
- offsetHeight: {
819
- readOnly: true,
820
- error: offsetPropertyErrorMessage('offsetHeight')
821
- },
822
- offsetLeft: {
823
- readOnly: true,
824
- error: offsetPropertyErrorMessage('offsetLeft')
825
- },
826
- offsetParent: {
827
- readOnly: true
828
- },
829
- offsetTop: {
830
- readOnly: true,
831
- error: offsetPropertyErrorMessage('offsetTop')
832
- },
833
- offsetWidth: {
834
- readOnly: true,
835
- error: offsetPropertyErrorMessage('offsetWidth')
836
- },
837
- role: {
838
- attribute: 'role'
839
- }
840
- });
841
- var controlledElement = null;
842
- var controlledAttributeName;
843
- function isAttributeLocked(elm, attrName) {
844
- return elm !== controlledElement || attrName !== controlledAttributeName;
845
- }
846
- function lockAttribute(_elm, _key) {
847
- controlledElement = null;
848
- controlledAttributeName = undefined;
849
- }
850
- function unlockAttribute(elm, key) {
851
- controlledElement = elm;
852
- controlledAttributeName = key;
853
- }
854
- /*
855
- * Copyright (c) 2018, salesforce.com, inc.
856
- * All rights reserved.
857
- * SPDX-License-Identifier: MIT
858
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
859
- */
860
- var xlinkNS = 'http://www.w3.org/1999/xlink';
861
- var xmlNS = 'http://www.w3.org/XML/1998/namespace';
862
- var ColonCharCode = 58;
863
- function updateAttrs(oldVnode, vnode) {
864
- var attrs = vnode.data.attrs, renderer = vnode.owner.renderer;
865
- if (isUndefined$1(attrs)) {
866
- return;
867
- }
868
- var oldAttrs = oldVnode.data.attrs;
869
- if (oldAttrs === attrs) {
870
- return;
871
- }
872
- var elm = vnode.elm;
873
- var setAttribute = renderer.setAttribute, removeAttribute = renderer.removeAttribute;
874
- var key;
875
- oldAttrs = isUndefined$1(oldAttrs) ? EmptyObject : oldAttrs; // update modified attributes, add new attributes
876
- // this routine is only useful for data-* attributes in all kind of elements
877
- // and aria-* in standard elements (custom elements will use props for these)
878
- for (key in attrs) {
879
- var cur = attrs[key];
880
- var old = oldAttrs[key];
881
- if (old !== cur) {
882
- unlockAttribute(elm, key);
883
- if (StringCharCodeAt$1.call(key, 3) === ColonCharCode) {
884
- // Assume xml namespace
885
- setAttribute(elm, key, cur, xmlNS);
886
- }
887
- else if (StringCharCodeAt$1.call(key, 5) === ColonCharCode) {
888
- // Assume xlink namespace
889
- setAttribute(elm, key, cur, xlinkNS);
890
- }
891
- else if (isNull$1(cur)) {
892
- removeAttribute(elm, key);
893
- }
894
- else {
895
- setAttribute(elm, key, cur);
896
- }
897
- lockAttribute();
898
- }
899
- }
900
- }
901
- var emptyVNode = {
902
- data: {}
903
- };
904
- var modAttrs = {
905
- create: function (vnode) { return updateAttrs(emptyVNode, vnode); },
906
- update: updateAttrs
907
- };
908
- /*
909
- * Copyright (c) 2018, salesforce.com, inc.
910
- * All rights reserved.
911
- * SPDX-License-Identifier: MIT
912
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
913
- */
914
- function isLiveBindingProp(sel, key) {
915
- // For properties with live bindings, we read values from the DOM element
916
- // instead of relying on internally tracked values.
917
- return sel === 'input' && (key === 'value' || key === 'checked');
918
- }
919
- function update(oldVnode, vnode) {
920
- var props = vnode.data.props;
921
- if (isUndefined$1(props)) {
922
- return;
923
- }
924
- var oldProps = oldVnode.data.props;
925
- if (oldProps === props) {
926
- return;
927
- }
928
- var isFirstPatch = isUndefined$1(oldProps);
929
- var elm = vnode.elm, sel = vnode.sel, renderer = vnode.owner.renderer;
930
- for (var key in props) {
931
- var cur = props[key]; // if it is the first time this element is patched, or the current value is different to the previous value...
932
- if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? renderer.getProperty(elm, key) : oldProps[key])) {
933
- renderer.setProperty(elm, key, cur);
934
- }
935
- }
936
- }
937
- var emptyVNode$1 = {
938
- data: {}
939
- };
940
- var modProps = {
941
- create: function (vnode) { return update(emptyVNode$1, vnode); },
942
- update: update
943
- };
944
- /*
945
- * Copyright (c) 2018, salesforce.com, inc.
946
- * All rights reserved.
947
- * SPDX-License-Identifier: MIT
948
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
949
- */
950
- var classNameToClassMap = create$1(null);
951
- function getMapFromClassName(className) {
952
- // Intentionally using == to match undefined and null values from computed style attribute
953
- if (className == null) {
954
- return EmptyObject;
955
- } // computed class names must be string
956
- className = isString(className) ? className : className + '';
957
- var map = classNameToClassMap[className];
958
- if (map) {
959
- return map;
960
- }
961
- map = create$1(null);
962
- var start = 0;
963
- var o;
964
- var len = className.length;
965
- for (o = 0; o < len; o++) {
966
- if (StringCharCodeAt$1.call(className, o) === SPACE_CHAR) {
967
- if (o > start) {
968
- map[StringSlice$1.call(className, start, o)] = true;
969
- }
970
- start = o + 1;
971
- }
972
- }
973
- if (o > start) {
974
- map[StringSlice$1.call(className, start, o)] = true;
975
- }
976
- classNameToClassMap[className] = map;
977
- return map;
978
- }
979
- function updateClassAttribute(oldVnode, vnode) {
980
- var elm = vnode.elm, newClass = vnode.data.className, renderer = vnode.owner.renderer;
981
- var oldClass = oldVnode.data.className;
982
- if (oldClass === newClass) {
983
- return;
984
- }
985
- var classList = renderer.getClassList(elm);
986
- var newClassMap = getMapFromClassName(newClass);
987
- var oldClassMap = getMapFromClassName(oldClass);
988
- var name;
989
- for (name in oldClassMap) {
990
- // remove only if it is not in the new class collection and it is not set from within the instance
991
- if (isUndefined$1(newClassMap[name])) {
992
- classList.remove(name);
993
- }
994
- }
995
- for (name in newClassMap) {
996
- if (isUndefined$1(oldClassMap[name])) {
997
- classList.add(name);
998
- }
999
- }
1000
- }
1001
- var emptyVNode$2 = {
1002
- data: {}
1003
- };
1004
- var modComputedClassName = {
1005
- create: function (vnode) { return updateClassAttribute(emptyVNode$2, vnode); },
1006
- update: updateClassAttribute
1007
- };
1008
- /*
1009
- * Copyright (c) 2018, salesforce.com, inc.
1010
- * All rights reserved.
1011
- * SPDX-License-Identifier: MIT
1012
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1013
- */
1014
- function updateStyleAttribute(oldVnode, vnode) {
1015
- var elm = vnode.elm, newStyle = vnode.data.style, renderer = vnode.owner.renderer;
1016
- var setAttribute = renderer.setAttribute, removeAttribute = renderer.removeAttribute;
1017
- if (oldVnode.data.style === newStyle) {
1018
- return;
1019
- }
1020
- if (!isString(newStyle) || newStyle === '') {
1021
- removeAttribute(elm, 'style');
1022
- }
1023
- else {
1024
- setAttribute(elm, 'style', newStyle);
1025
- }
1026
- }
1027
- var emptyVNode$3 = {
1028
- data: {}
1029
- };
1030
- var modComputedStyle = {
1031
- create: function (vnode) { return updateStyleAttribute(emptyVNode$3, vnode); },
1032
- update: updateStyleAttribute
1033
- };
1034
- /*
1035
- * Copyright (c) 2018, salesforce.com, inc.
1036
- * All rights reserved.
1037
- * SPDX-License-Identifier: MIT
1038
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1039
- */
1040
- // The compiler takes care of transforming the inline classnames into an object. It's faster to set the
1041
- // different classnames properties individually instead of via a string.
1042
- function createClassAttribute(vnode) {
1043
- var elm = vnode.elm, classMap = vnode.data.classMap, renderer = vnode.owner.renderer;
1044
- if (isUndefined$1(classMap)) {
1045
- return;
1046
- }
1047
- var classList = renderer.getClassList(elm);
1048
- for (var name in classMap) {
1049
- classList.add(name);
1050
- }
1051
- }
1052
- var modStaticClassName = {
1053
- create: createClassAttribute
1054
- };
1055
- /*
1056
- * Copyright (c) 2018, salesforce.com, inc.
1057
- * All rights reserved.
1058
- * SPDX-License-Identifier: MIT
1059
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1060
- */
1061
- // The compiler takes care of transforming the inline style into an object. It's faster to set the
1062
- // different style properties individually instead of via a string.
1063
- function createStyleAttribute(vnode) {
1064
- var elm = vnode.elm, styleMap = vnode.data.styleMap, renderer = vnode.owner.renderer;
1065
- if (isUndefined$1(styleMap)) {
1066
- return;
1067
- }
1068
- for (var name in styleMap) {
1069
- renderer.setCSSStyleProperty(elm, name, styleMap[name]);
1070
- }
1071
- }
1072
- var modStaticStyle = {
1073
- create: createStyleAttribute
1074
- };
1075
- /*
1076
- * Copyright (c) 2018, salesforce.com, inc.
1077
- * All rights reserved.
1078
- * SPDX-License-Identifier: MIT
1079
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1080
- */
1081
- /**
1082
- @license
1083
- Copyright (c) 2015 Simon Friis Vindum.
1084
- This code may only be used under the MIT License found at
1085
- https://github.com/snabbdom/snabbdom/blob/master/LICENSE
1086
- Code distributed by Snabbdom as part of the Snabbdom project at
1087
- https://github.com/snabbdom/snabbdom/
1088
- */
1089
- function isUndef(s) {
1090
- return s === undefined;
1091
- }
1092
- function sameVnode(vnode1, vnode2) {
1093
- return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
1094
- }
1095
- function isVNode(vnode) {
1096
- return vnode != null;
1097
- }
1098
- function createKeyToOldIdx(children, beginIdx, endIdx) {
1099
- var map = {};
1100
- var j, key, ch; // TODO [#1637]: simplify this by assuming that all vnodes has keys
1101
- for (j = beginIdx; j <= endIdx; ++j) {
1102
- ch = children[j];
1103
- if (isVNode(ch)) {
1104
- key = ch.key;
1105
- if (key !== undefined) {
1106
- map[key] = j;
1107
- }
1108
- }
1109
- }
1110
- return map;
1111
- }
1112
- function addVnodes(parentElm, before, vnodes, startIdx, endIdx) {
1113
- for (; startIdx <= endIdx; ++startIdx) {
1114
- var ch = vnodes[startIdx];
1115
- if (isVNode(ch)) {
1116
- ch.hook.create(ch);
1117
- ch.hook.insert(ch, parentElm, before);
1118
- }
1119
- }
1120
- }
1121
- function removeVnodes(parentElm, vnodes, startIdx, endIdx) {
1122
- for (; startIdx <= endIdx; ++startIdx) {
1123
- var ch = vnodes[startIdx]; // text nodes do not have logic associated to them
1124
- if (isVNode(ch)) {
1125
- ch.hook.remove(ch, parentElm);
1126
- }
1127
- }
1128
- }
1129
- function updateDynamicChildren(parentElm, oldCh, newCh) {
1130
- var oldStartIdx = 0;
1131
- var newStartIdx = 0;
1132
- var oldEndIdx = oldCh.length - 1;
1133
- var oldStartVnode = oldCh[0];
1134
- var oldEndVnode = oldCh[oldEndIdx];
1135
- var newChEnd = newCh.length - 1;
1136
- var newEndIdx = newChEnd;
1137
- var newStartVnode = newCh[0];
1138
- var newEndVnode = newCh[newEndIdx];
1139
- var oldKeyToIdx;
1140
- var idxInOld;
1141
- var elmToMove;
1142
- var before;
1143
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1144
- if (!isVNode(oldStartVnode)) {
1145
- oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
1146
- }
1147
- else if (!isVNode(oldEndVnode)) {
1148
- oldEndVnode = oldCh[--oldEndIdx];
1149
- }
1150
- else if (!isVNode(newStartVnode)) {
1151
- newStartVnode = newCh[++newStartIdx];
1152
- }
1153
- else if (!isVNode(newEndVnode)) {
1154
- newEndVnode = newCh[--newEndIdx];
1155
- }
1156
- else if (sameVnode(oldStartVnode, newStartVnode)) {
1157
- patchVnode(oldStartVnode, newStartVnode);
1158
- oldStartVnode = oldCh[++oldStartIdx];
1159
- newStartVnode = newCh[++newStartIdx];
1160
- }
1161
- else if (sameVnode(oldEndVnode, newEndVnode)) {
1162
- patchVnode(oldEndVnode, newEndVnode);
1163
- oldEndVnode = oldCh[--oldEndIdx];
1164
- newEndVnode = newCh[--newEndIdx];
1165
- }
1166
- else if (sameVnode(oldStartVnode, newEndVnode)) {
1167
- // Vnode moved right
1168
- patchVnode(oldStartVnode, newEndVnode);
1169
- newEndVnode.hook.move(oldStartVnode, parentElm, oldEndVnode.owner.renderer.nextSibling(oldEndVnode.elm));
1170
- oldStartVnode = oldCh[++oldStartIdx];
1171
- newEndVnode = newCh[--newEndIdx];
1172
- }
1173
- else if (sameVnode(oldEndVnode, newStartVnode)) {
1174
- // Vnode moved left
1175
- patchVnode(oldEndVnode, newStartVnode);
1176
- newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);
1177
- oldEndVnode = oldCh[--oldEndIdx];
1178
- newStartVnode = newCh[++newStartIdx];
1179
- }
1180
- else {
1181
- if (oldKeyToIdx === undefined) {
1182
- oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
1183
- }
1184
- idxInOld = oldKeyToIdx[newStartVnode.key];
1185
- if (isUndef(idxInOld)) {
1186
- // New element
1187
- newStartVnode.hook.create(newStartVnode);
1188
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
1189
- newStartVnode = newCh[++newStartIdx];
1190
- }
1191
- else {
1192
- elmToMove = oldCh[idxInOld];
1193
- if (isVNode(elmToMove)) {
1194
- if (elmToMove.sel !== newStartVnode.sel) {
1195
- // New element
1196
- newStartVnode.hook.create(newStartVnode);
1197
- newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);
1198
- }
1199
- else {
1200
- patchVnode(elmToMove, newStartVnode);
1201
- oldCh[idxInOld] = undefined;
1202
- newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);
1203
- }
1204
- }
1205
- newStartVnode = newCh[++newStartIdx];
1206
- }
1207
- }
1208
- }
1209
- if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
1210
- if (oldStartIdx > oldEndIdx) {
1211
- // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
1212
- // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
1213
- var i_7 = newEndIdx;
1214
- var n = void 0;
1215
- do {
1216
- n = newCh[++i_7];
1217
- } while (!isVNode(n) && i_7 < newChEnd);
1218
- before = isVNode(n) ? n.elm : null;
1219
- addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);
1220
- }
1221
- else {
1222
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
1223
- }
1224
- }
1225
- }
1226
- function updateStaticChildren(parentElm, oldCh, newCh) {
1227
- var oldChLength = oldCh.length;
1228
- var newChLength = newCh.length;
1229
- if (oldChLength === 0) {
1230
- // the old list is empty, we can directly insert anything new
1231
- addVnodes(parentElm, null, newCh, 0, newChLength);
1232
- return;
1233
- }
1234
- if (newChLength === 0) {
1235
- // the old list is nonempty and the new list is empty so we can directly remove all old nodes
1236
- // this is the case in which the dynamic children of an if-directive should be removed
1237
- removeVnodes(parentElm, oldCh, 0, oldChLength);
1238
- return;
1239
- } // if the old list is not empty, the new list MUST have the same
1240
- // amount of nodes, that's why we call this static children
1241
- var referenceElm = null;
1242
- for (var i_8 = newChLength - 1; i_8 >= 0; i_8 -= 1) {
1243
- var vnode = newCh[i_8];
1244
- var oldVNode = oldCh[i_8];
1245
- if (vnode !== oldVNode) {
1246
- if (isVNode(oldVNode)) {
1247
- if (isVNode(vnode)) {
1248
- // both vnodes must be equivalent, and se just need to patch them
1249
- patchVnode(oldVNode, vnode);
1250
- referenceElm = vnode.elm;
1251
- }
1252
- else {
1253
- // removing the old vnode since the new one is null
1254
- oldVNode.hook.remove(oldVNode, parentElm);
1255
- }
1256
- }
1257
- else if (isVNode(vnode)) {
1258
- // this condition is unnecessary
1259
- vnode.hook.create(vnode); // insert the new node one since the old one is null
1260
- vnode.hook.insert(vnode, parentElm, referenceElm);
1261
- referenceElm = vnode.elm;
1262
- }
1263
- }
1264
- }
1265
- }
1266
- function patchVnode(oldVnode, vnode) {
1267
- if (oldVnode !== vnode) {
1268
- vnode.elm = oldVnode.elm;
1269
- vnode.hook.update(oldVnode, vnode);
1270
- }
1271
- }
1272
- /*
1273
- * Copyright (c) 2020, salesforce.com, inc.
1274
- * All rights reserved.
1275
- * SPDX-License-Identifier: MIT
1276
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1277
- */
1278
- // This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having
1279
- // to inject at runtime.
1280
- var HTMLElementConstructor = typeof HTMLElement !== 'undefined' ? HTMLElement : function () { };
1281
- var HTMLElementPrototype = HTMLElementConstructor.prototype;
1282
- /*
1283
- * Copyright (c) 2018, salesforce.com, inc.
1284
- * All rights reserved.
1285
- * SPDX-License-Identifier: MIT
1286
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1287
- */
1288
- /**
1289
- * This is a descriptor map that contains
1290
- * all standard properties that a Custom Element can support (including AOM properties), which
1291
- * determines what kind of capabilities the Base HTML Element and
1292
- * Base Lightning Element should support.
1293
- */
1294
- var HTMLElementOriginalDescriptors = create$1(null);
1295
- forEach$1.call(keys$1(AriaPropNameToAttrNameMap$1), function (propName) {
1296
- // Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
1297
- // in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.
1298
- var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
1299
- if (!isUndefined$1(descriptor)) {
1300
- HTMLElementOriginalDescriptors[propName] = descriptor;
1301
- }
1302
- });
1303
- forEach$1.call(defaultDefHTMLPropertyNames, function (propName) {
1304
- // Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because
1305
- // in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into
1306
- // this category, so, better to be sure.
1307
- var descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);
1308
- if (!isUndefined$1(descriptor)) {
1309
- HTMLElementOriginalDescriptors[propName] = descriptor;
1310
- }
1311
- });
1312
- /**
1313
- * Copyright (C) 2017 salesforce.com, inc.
1314
- */
1315
- var isArray$1$1 = Array.isArray;
1316
- var getPrototypeOf$1$1 = Object.getPrototypeOf, ObjectCreate = Object.create, ObjectDefineProperty = Object.defineProperty, isExtensible = Object.isExtensible, getOwnPropertyDescriptor$1$1 = Object.getOwnPropertyDescriptor, getOwnPropertyNames$1$1 = Object.getOwnPropertyNames, getOwnPropertySymbols = Object.getOwnPropertySymbols, preventExtensions = Object.preventExtensions, hasOwnProperty$1$1 = Object.hasOwnProperty;
1317
- var _k = Array.prototype, ArrayPush$2 = _k.push, ArrayConcat = _k.concat;
1318
- function isUndefined$2(obj) {
1319
- return obj === undefined;
1320
- }
1321
- function isFunction$1$1(obj) {
1322
- return typeof obj === 'function';
1323
- }
1324
- var proxyToValueMap = new WeakMap();
1325
- function registerProxy(proxy, value) {
1326
- proxyToValueMap.set(proxy, value);
1327
- }
1328
- var unwrap = function (replicaOrAny) { return proxyToValueMap.get(replicaOrAny) || replicaOrAny; };
1329
- var BaseProxyHandler = /** @class */ (function () {
1330
- function BaseProxyHandler(membrane, value) {
1331
- this.originalTarget = value;
1332
- this.membrane = membrane;
1333
- } // Shared utility methods
1334
- BaseProxyHandler.prototype.wrapDescriptor = function (descriptor) {
1335
- if (hasOwnProperty$1$1.call(descriptor, 'value')) {
1336
- descriptor.value = this.wrapValue(descriptor.value);
1337
- }
1338
- else {
1339
- var originalSet = descriptor.set, originalGet = descriptor.get;
1340
- if (!isUndefined$2(originalGet)) {
1341
- descriptor.get = this.wrapGetter(originalGet);
1342
- }
1343
- if (!isUndefined$2(originalSet)) {
1344
- descriptor.set = this.wrapSetter(originalSet);
1345
- }
1346
- }
1347
- return descriptor;
1348
- };
1349
- BaseProxyHandler.prototype.copyDescriptorIntoShadowTarget = function (shadowTarget, key) {
1350
- var originalTarget = this.originalTarget; // Note: a property might get defined multiple times in the shadowTarget
1351
- // but it will always be compatible with the previous descriptor
1352
- // to preserve the object invariants, which makes these lines safe.
1353
- var originalDescriptor = getOwnPropertyDescriptor$1$1(originalTarget, key);
1354
- if (!isUndefined$2(originalDescriptor)) {
1355
- var wrappedDesc = this.wrapDescriptor(originalDescriptor);
1356
- ObjectDefineProperty(shadowTarget, key, wrappedDesc);
1357
- }
1358
- };
1359
- BaseProxyHandler.prototype.lockShadowTarget = function (shadowTarget) {
1360
- var _this = this;
1361
- var originalTarget = this.originalTarget;
1362
- var targetKeys = ArrayConcat.call(getOwnPropertyNames$1$1(originalTarget), getOwnPropertySymbols(originalTarget));
1363
- targetKeys.forEach(function (key) {
1364
- _this.copyDescriptorIntoShadowTarget(shadowTarget, key);
1365
- });
1366
- var tagPropertyKey = this.membrane.tagPropertyKey;
1367
- if (!isUndefined$2(tagPropertyKey) && !hasOwnProperty$1$1.call(shadowTarget, tagPropertyKey)) {
1368
- ObjectDefineProperty(shadowTarget, tagPropertyKey, ObjectCreate(null));
1369
- }
1370
- preventExtensions(shadowTarget);
1371
- }; // Shared Traps
1372
- BaseProxyHandler.prototype.apply = function (shadowTarget, thisArg, argArray) {
1373
- /* No op */
1374
- };
1375
- BaseProxyHandler.prototype.construct = function (shadowTarget, argArray, newTarget) {
1376
- /* No op */
1377
- };
1378
- BaseProxyHandler.prototype.get = function (shadowTarget, key) {
1379
- var _b = this, originalTarget = _b.originalTarget, valueObserved = _b.membrane.valueObserved;
1380
- var value = originalTarget[key];
1381
- valueObserved(originalTarget, key);
1382
- return this.wrapValue(value);
1383
- };
1384
- BaseProxyHandler.prototype.has = function (shadowTarget, key) {
1385
- var _b = this, originalTarget = _b.originalTarget, _c = _b.membrane, tagPropertyKey = _c.tagPropertyKey, valueObserved = _c.valueObserved;
1386
- valueObserved(originalTarget, key); // since key is never going to be undefined, and tagPropertyKey might be undefined
1387
- // we can simply compare them as the second part of the condition.
1388
- return key in originalTarget || key === tagPropertyKey;
1389
- };
1390
- BaseProxyHandler.prototype.ownKeys = function (shadowTarget) {
1391
- var _b = this, originalTarget = _b.originalTarget, tagPropertyKey = _b.membrane.tagPropertyKey; // if the membrane tag key exists and it is not in the original target, we add it to the keys.
1392
- var keys = isUndefined$2(tagPropertyKey) || hasOwnProperty$1$1.call(originalTarget, tagPropertyKey) ? [] : [tagPropertyKey]; // small perf optimization using push instead of concat to avoid creating an extra array
1393
- ArrayPush$2.apply(keys, getOwnPropertyNames$1$1(originalTarget));
1394
- ArrayPush$2.apply(keys, getOwnPropertySymbols(originalTarget));
1395
- return keys;
1396
- };
1397
- BaseProxyHandler.prototype.isExtensible = function (shadowTarget) {
1398
- var originalTarget = this.originalTarget; // optimization to avoid attempting to lock down the shadowTarget multiple times
1399
- if (!isExtensible(shadowTarget)) {
1400
- return false; // was already locked down
1401
- }
1402
- if (!isExtensible(originalTarget)) {
1403
- this.lockShadowTarget(shadowTarget);
1404
- return false;
1405
- }
1406
- return true;
1407
- };
1408
- BaseProxyHandler.prototype.getPrototypeOf = function (shadowTarget) {
1409
- var originalTarget = this.originalTarget;
1410
- return getPrototypeOf$1$1(originalTarget);
1411
- };
1412
- BaseProxyHandler.prototype.getOwnPropertyDescriptor = function (shadowTarget, key) {
1413
- var _b = this, originalTarget = _b.originalTarget, _c = _b.membrane, valueObserved = _c.valueObserved, tagPropertyKey = _c.tagPropertyKey; // keys looked up via getOwnPropertyDescriptor need to be reactive
1414
- valueObserved(originalTarget, key);
1415
- var desc = getOwnPropertyDescriptor$1$1(originalTarget, key);
1416
- if (isUndefined$2(desc)) {
1417
- if (key !== tagPropertyKey) {
1418
- return undefined;
1419
- } // if the key is the membrane tag key, and is not in the original target,
1420
- // we produce a synthetic descriptor and install it on the shadow target
1421
- desc = {
1422
- value: undefined,
1423
- writable: false,
1424
- configurable: false,
1425
- enumerable: false
1426
- };
1427
- ObjectDefineProperty(shadowTarget, tagPropertyKey, desc);
1428
- return desc;
1429
- }
1430
- if (desc.configurable === false) {
1431
- // updating the descriptor to non-configurable on the shadow
1432
- this.copyDescriptorIntoShadowTarget(shadowTarget, key);
1433
- } // Note: by accessing the descriptor, the key is marked as observed
1434
- // but access to the value, setter or getter (if available) cannot observe
1435
- // mutations, just like regular methods, in which case we just do nothing.
1436
- return this.wrapDescriptor(desc);
1437
- };
1438
- return BaseProxyHandler;
1439
- }());
1440
- var getterMap = new WeakMap();
1441
- var setterMap = new WeakMap();
1442
- var reverseGetterMap = new WeakMap();
1443
- var reverseSetterMap = new WeakMap();
1444
- var ReactiveProxyHandler = /** @class */ (function (_super) {
1445
- __extends(ReactiveProxyHandler, _super);
1446
- function ReactiveProxyHandler() {
1447
- return _super !== null && _super.apply(this, arguments) || this;
1448
- }
1449
- ReactiveProxyHandler.prototype.wrapValue = function (value) {
1450
- return this.membrane.getProxy(value);
1451
- };
1452
- ReactiveProxyHandler.prototype.wrapGetter = function (originalGet) {
1453
- var wrappedGetter = getterMap.get(originalGet);
1454
- if (!isUndefined$2(wrappedGetter)) {
1455
- return wrappedGetter;
1456
- }
1457
- var handler = this;
1458
- var get = function () {
1459
- // invoking the original getter with the original target
1460
- return handler.wrapValue(originalGet.call(unwrap(this)));
1461
- };
1462
- getterMap.set(originalGet, get);
1463
- reverseGetterMap.set(get, originalGet);
1464
- return get;
1465
- };
1466
- ReactiveProxyHandler.prototype.wrapSetter = function (originalSet) {
1467
- var wrappedSetter = setterMap.get(originalSet);
1468
- if (!isUndefined$2(wrappedSetter)) {
1469
- return wrappedSetter;
1470
- }
1471
- var set = function (v) {
1472
- // invoking the original setter with the original target
1473
- originalSet.call(unwrap(this), unwrap(v));
1474
- };
1475
- setterMap.set(originalSet, set);
1476
- reverseSetterMap.set(set, originalSet);
1477
- return set;
1478
- };
1479
- ReactiveProxyHandler.prototype.unwrapDescriptor = function (descriptor) {
1480
- if (hasOwnProperty$1$1.call(descriptor, 'value')) {
1481
- // dealing with a data descriptor
1482
- descriptor.value = unwrap(descriptor.value);
1483
- }
1484
- else {
1485
- var set = descriptor.set, get = descriptor.get;
1486
- if (!isUndefined$2(get)) {
1487
- descriptor.get = this.unwrapGetter(get);
1488
- }
1489
- if (!isUndefined$2(set)) {
1490
- descriptor.set = this.unwrapSetter(set);
1491
- }
1492
- }
1493
- return descriptor;
1494
- };
1495
- ReactiveProxyHandler.prototype.unwrapGetter = function (redGet) {
1496
- var reverseGetter = reverseGetterMap.get(redGet);
1497
- if (!isUndefined$2(reverseGetter)) {
1498
- return reverseGetter;
1499
- }
1500
- var handler = this;
1501
- var get = function () {
1502
- // invoking the red getter with the proxy of this
1503
- return unwrap(redGet.call(handler.wrapValue(this)));
1504
- };
1505
- getterMap.set(get, redGet);
1506
- reverseGetterMap.set(redGet, get);
1507
- return get;
1508
- };
1509
- ReactiveProxyHandler.prototype.unwrapSetter = function (redSet) {
1510
- var reverseSetter = reverseSetterMap.get(redSet);
1511
- if (!isUndefined$2(reverseSetter)) {
1512
- return reverseSetter;
1513
- }
1514
- var handler = this;
1515
- var set = function (v) {
1516
- // invoking the red setter with the proxy of this
1517
- redSet.call(handler.wrapValue(this), handler.wrapValue(v));
1518
- };
1519
- setterMap.set(set, redSet);
1520
- reverseSetterMap.set(redSet, set);
1521
- return set;
1522
- };
1523
- ReactiveProxyHandler.prototype.set = function (shadowTarget, key, value) {
1524
- var _b = this, originalTarget = _b.originalTarget, valueMutated = _b.membrane.valueMutated;
1525
- var oldValue = originalTarget[key];
1526
- if (oldValue !== value) {
1527
- originalTarget[key] = value;
1528
- valueMutated(originalTarget, key);
1529
- }
1530
- else if (key === 'length' && isArray$1$1(originalTarget)) {
1531
- // fix for issue #236: push will add the new index, and by the time length
1532
- // is updated, the internal length is already equal to the new length value
1533
- // therefore, the oldValue is equal to the value. This is the forking logic
1534
- // to support this use case.
1535
- valueMutated(originalTarget, key);
1536
- }
1537
- return true;
1538
- };
1539
- ReactiveProxyHandler.prototype.deleteProperty = function (shadowTarget, key) {
1540
- var _b = this, originalTarget = _b.originalTarget, valueMutated = _b.membrane.valueMutated;
1541
- delete originalTarget[key];
1542
- valueMutated(originalTarget, key);
1543
- return true;
1544
- };
1545
- ReactiveProxyHandler.prototype.setPrototypeOf = function (shadowTarget, prototype) {
1546
- };
1547
- ReactiveProxyHandler.prototype.preventExtensions = function (shadowTarget) {
1548
- if (isExtensible(shadowTarget)) {
1549
- var originalTarget = this.originalTarget;
1550
- preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject
1551
- // the preventExtension call, in which case we should not attempt to lock down
1552
- // the shadow target.
1553
- if (isExtensible(originalTarget)) {
1554
- return false;
1555
- }
1556
- this.lockShadowTarget(shadowTarget);
1557
- }
1558
- return true;
1559
- };
1560
- ReactiveProxyHandler.prototype.defineProperty = function (shadowTarget, key, descriptor) {
1561
- var _b = this, originalTarget = _b.originalTarget, _c = _b.membrane, valueMutated = _c.valueMutated, tagPropertyKey = _c.tagPropertyKey;
1562
- if (key === tagPropertyKey && !hasOwnProperty$1$1.call(originalTarget, key)) {
1563
- // To avoid leaking the membrane tag property into the original target, we must
1564
- // be sure that the original target doesn't have yet.
1565
- // NOTE: we do not return false here because Object.freeze and equivalent operations
1566
- // will attempt to set the descriptor to the same value, and expect no to throw. This
1567
- // is an small compromise for the sake of not having to diff the descriptors.
1568
- return true;
1569
- }
1570
- ObjectDefineProperty(originalTarget, key, this.unwrapDescriptor(descriptor)); // intentionally testing if false since it could be undefined as well
1571
- if (descriptor.configurable === false) {
1572
- this.copyDescriptorIntoShadowTarget(shadowTarget, key);
1573
- }
1574
- valueMutated(originalTarget, key);
1575
- return true;
1576
- };
1577
- return ReactiveProxyHandler;
1578
- }(BaseProxyHandler));
1579
- var getterMap$1 = new WeakMap();
1580
- var setterMap$1 = new WeakMap();
1581
- var ReadOnlyHandler = /** @class */ (function (_super) {
1582
- __extends(ReadOnlyHandler, _super);
1583
- function ReadOnlyHandler() {
1584
- return _super !== null && _super.apply(this, arguments) || this;
1585
- }
1586
- ReadOnlyHandler.prototype.wrapValue = function (value) {
1587
- return this.membrane.getReadOnlyProxy(value);
1588
- };
1589
- ReadOnlyHandler.prototype.wrapGetter = function (originalGet) {
1590
- var wrappedGetter = getterMap$1.get(originalGet);
1591
- if (!isUndefined$2(wrappedGetter)) {
1592
- return wrappedGetter;
1593
- }
1594
- var handler = this;
1595
- var get = function () {
1596
- // invoking the original getter with the original target
1597
- return handler.wrapValue(originalGet.call(unwrap(this)));
1598
- };
1599
- getterMap$1.set(originalGet, get);
1600
- return get;
1601
- };
1602
- ReadOnlyHandler.prototype.wrapSetter = function (originalSet) {
1603
- var wrappedSetter = setterMap$1.get(originalSet);
1604
- if (!isUndefined$2(wrappedSetter)) {
1605
- return wrappedSetter;
1606
- }
1607
- var set = function (v) {
1608
- };
1609
- setterMap$1.set(originalSet, set);
1610
- return set;
1611
- };
1612
- ReadOnlyHandler.prototype.set = function (shadowTarget, key, value) {
1613
- return false;
1614
- };
1615
- ReadOnlyHandler.prototype.deleteProperty = function (shadowTarget, key) {
1616
- return false;
1617
- };
1618
- ReadOnlyHandler.prototype.setPrototypeOf = function (shadowTarget, prototype) {
1619
- };
1620
- ReadOnlyHandler.prototype.preventExtensions = function (shadowTarget) {
1621
- return false;
1622
- };
1623
- ReadOnlyHandler.prototype.defineProperty = function (shadowTarget, key, descriptor) {
1624
- return false;
1625
- };
1626
- return ReadOnlyHandler;
1627
- }(BaseProxyHandler));
1628
- var ObjectDotPrototype = Object.prototype;
1629
- function defaultValueIsObservable(value) {
1630
- // intentionally checking for null
1631
- if (value === null) {
1632
- return false;
1633
- } // treat all non-object types, including undefined, as non-observable values
1634
- if (typeof value !== 'object') {
1635
- return false;
1636
- }
1637
- if (isArray$1$1(value)) {
1638
- return true;
1639
- }
1640
- var proto = getPrototypeOf$1$1(value);
1641
- return proto === ObjectDotPrototype || proto === null || getPrototypeOf$1$1(proto) === null;
1642
- }
1643
- var defaultValueObserved = function (obj, key) {
1644
- /* do nothing */
1645
- };
1646
- var defaultValueMutated = function (obj, key) {
1647
- /* do nothing */
1648
- };
1649
- var defaultValueDistortion = function (value) { return value; };
1650
- function createShadowTarget(value) {
1651
- return isArray$1$1(value) ? [] : {};
1652
- }
1653
- var ReactiveMembrane = /** @class */ (function () {
1654
- function ReactiveMembrane(options) {
1655
- this.valueDistortion = defaultValueDistortion;
1656
- this.valueMutated = defaultValueMutated;
1657
- this.valueObserved = defaultValueObserved;
1658
- this.valueIsObservable = defaultValueIsObservable;
1659
- this.objectGraph = new WeakMap();
1660
- if (!isUndefined$2(options)) {
1661
- var valueDistortion_1 = options.valueDistortion, valueMutated_1 = options.valueMutated, valueObserved_1 = options.valueObserved, valueIsObservable = options.valueIsObservable, tagPropertyKey = options.tagPropertyKey;
1662
- this.valueDistortion = isFunction$1$1(valueDistortion_1) ? valueDistortion_1 : defaultValueDistortion;
1663
- this.valueMutated = isFunction$1$1(valueMutated_1) ? valueMutated_1 : defaultValueMutated;
1664
- this.valueObserved = isFunction$1$1(valueObserved_1) ? valueObserved_1 : defaultValueObserved;
1665
- this.valueIsObservable = isFunction$1$1(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;
1666
- this.tagPropertyKey = tagPropertyKey;
1667
- }
1668
- }
1669
- ReactiveMembrane.prototype.getProxy = function (value) {
1670
- var unwrappedValue = unwrap(value);
1671
- var distorted = this.valueDistortion(unwrappedValue);
1672
- if (this.valueIsObservable(distorted)) {
1673
- var o = this.getReactiveState(unwrappedValue, distorted); // when trying to extract the writable version of a readonly
1674
- // we return the readonly.
1675
- return o.readOnly === value ? value : o.reactive;
1676
- }
1677
- return distorted;
1678
- };
1679
- ReactiveMembrane.prototype.getReadOnlyProxy = function (value) {
1680
- value = unwrap(value);
1681
- var distorted = this.valueDistortion(value);
1682
- if (this.valueIsObservable(distorted)) {
1683
- return this.getReactiveState(value, distorted).readOnly;
1684
- }
1685
- return distorted;
1686
- };
1687
- ReactiveMembrane.prototype.unwrapProxy = function (p) {
1688
- return unwrap(p);
1689
- };
1690
- ReactiveMembrane.prototype.getReactiveState = function (value, distortedValue) {
1691
- var objectGraph = this.objectGraph;
1692
- var reactiveState = objectGraph.get(distortedValue);
1693
- if (reactiveState) {
1694
- return reactiveState;
1695
- }
1696
- var membrane = this;
1697
- reactiveState = {
1698
- get reactive() {
1699
- var reactiveHandler = new ReactiveProxyHandler(membrane, distortedValue); // caching the reactive proxy after the first time it is accessed
1700
- var proxy = new Proxy(createShadowTarget(distortedValue), reactiveHandler);
1701
- registerProxy(proxy, value);
1702
- ObjectDefineProperty(this, 'reactive', {
1703
- value: proxy
1704
- });
1705
- return proxy;
1706
- },
1707
- get readOnly() {
1708
- var readOnlyHandler = new ReadOnlyHandler(membrane, distortedValue); // caching the readOnly proxy after the first time it is accessed
1709
- var proxy = new Proxy(createShadowTarget(distortedValue), readOnlyHandler);
1710
- registerProxy(proxy, value);
1711
- ObjectDefineProperty(this, 'readOnly', {
1712
- value: proxy
1713
- });
1714
- return proxy;
1715
- }
1716
- };
1717
- objectGraph.set(distortedValue, reactiveState);
1718
- return reactiveState;
1719
- };
1720
- return ReactiveMembrane;
1721
- }());
1722
- /** version: 1.0.0 */
1723
- /*
1724
- * Copyright (c) 2018, salesforce.com, inc.
1725
- * All rights reserved.
1726
- * SPDX-License-Identifier: MIT
1727
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1728
- */
1729
- var lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');
1730
- function valueDistortion(value) {
1731
- return value;
1732
- }
1733
- var reactiveMembrane = new ReactiveMembrane({
1734
- valueObserved: valueObserved,
1735
- valueMutated: valueMutated,
1736
- valueDistortion: valueDistortion,
1737
- tagPropertyKey: lockerLivePropertyKey
1738
- });
1739
- /**
1740
- * EXPERIMENTAL: This function implements an unwrap mechanism that
1741
- * works for observable membrane objects. This API is subject to
1742
- * change or being removed.
1743
- */
1744
- var unwrap$1 = function (value) {
1745
- var unwrapped = reactiveMembrane.unwrapProxy(value);
1746
- if (unwrapped !== value) {
1747
- // if value is a proxy, unwrap to access original value and apply distortion
1748
- return valueDistortion(unwrapped);
1749
- }
1750
- return value;
1751
- };
1752
- /*
1753
- * Copyright (c) 2018, salesforce.com, inc.
1754
- * All rights reserved.
1755
- * SPDX-License-Identifier: MIT
1756
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1757
- */
1758
- /**
1759
- * This operation is called with a descriptor of an standard html property
1760
- * that a Custom Element can support (including AOM properties), which
1761
- * determines what kind of capabilities the Base Lightning Element should support. When producing the new descriptors
1762
- * for the Base Lightning Element, it also include the reactivity bit, so the standard property is reactive.
1763
- */
1764
- function createBridgeToElementDescriptor(propName, descriptor) {
1765
- var get = descriptor.get, set = descriptor.set, enumerable = descriptor.enumerable, configurable = descriptor.configurable;
1766
- if (!isFunction$1(get)) {
1767
- throw new TypeError();
1768
- }
1769
- if (!isFunction$1(set)) {
1770
- throw new TypeError();
1771
- }
1772
- return {
1773
- enumerable: enumerable,
1774
- configurable: configurable,
1775
- get: function () {
1776
- var vm = getAssociatedVM(this);
1777
- if (isBeingConstructed(vm)) {
1778
- return;
1779
- }
1780
- componentValueObserved(vm, propName);
1781
- return get.call(vm.elm);
1782
- },
1783
- set: function (newValue) {
1784
- var vm = getAssociatedVM(this);
1785
- if (newValue !== vm.cmpProps[propName]) {
1786
- vm.cmpProps[propName] = newValue;
1787
- componentValueMutated(vm, propName);
1788
- }
1789
- return set.call(vm.elm, newValue);
1790
- }
1791
- };
1792
- }
1793
- /**
1794
- * This class is the base class for any LWC element.
1795
- * Some elements directly extends this class, others implement it via inheritance.
1796
- **/
1797
- function BaseLightningElementConstructor() {
1798
- if (isNull$1(vmBeingConstructed)) {
1799
- throw new ReferenceError('Illegal constructor');
1800
- }
1801
- var vm = vmBeingConstructed;
1802
- var elm = vm.elm, mode = vm.mode, renderer = vm.renderer, _b = vm.def, ctor = _b.ctor, bridge = _b.bridge;
1803
- var component = this;
1804
- setPrototypeOf$1(elm, bridge.prototype);
1805
- var cmpRoot = renderer.attachShadow(elm, {
1806
- mode: mode,
1807
- delegatesFocus: !!ctor.delegatesFocus,
1808
- '$$lwc-synthetic-mode$$': true
1809
- });
1810
- vm.component = this;
1811
- vm.cmpRoot = cmpRoot; // Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new
1812
- // component creation and passes hooks to instrument all the component interactions with the
1813
- // engine. We are intentionally hiding this argument from the formal API of LightningElement
1814
- // because we don't want folks to know about it just yet.
1815
- if (arguments.length === 1) {
1816
- var _c = arguments[0], callHook_1 = _c.callHook, setHook_1 = _c.setHook, getHook_1 = _c.getHook;
1817
- vm.callHook = callHook_1;
1818
- vm.setHook = setHook_1;
1819
- vm.getHook = getHook_1;
1820
- } // Making the component instance a live value when using Locker to support expandos.
1821
- defineProperty$1(component, lockerLivePropertyKey, EmptyObject); // Linking elm, shadow root and component with the VM.
1822
- associateVM(component, vm);
1823
- associateVM(cmpRoot, vm);
1824
- associateVM(elm, vm); // Adding extra guard rails in DEV mode.
1825
- return this;
1826
- }
1827
- BaseLightningElementConstructor.prototype = {
1828
- constructor: BaseLightningElementConstructor,
1829
- dispatchEvent: function (event) {
1830
- var _b = getAssociatedVM(this), elm = _b.elm, dispatchEvent = _b.renderer.dispatchEvent;
1831
- return dispatchEvent(elm, event);
1832
- },
1833
- addEventListener: function (type, listener, options) {
1834
- var vm = getAssociatedVM(this);
1835
- var elm = vm.elm, addEventListener = vm.renderer.addEventListener;
1836
- var wrappedListener = getWrappedComponentsListener(vm, listener);
1837
- addEventListener(elm, type, wrappedListener, options);
1838
- },
1839
- removeEventListener: function (type, listener, options) {
1840
- var vm = getAssociatedVM(this);
1841
- var elm = vm.elm, removeEventListener = vm.renderer.removeEventListener;
1842
- var wrappedListener = getWrappedComponentsListener(vm, listener);
1843
- removeEventListener(elm, type, wrappedListener, options);
1844
- },
1845
- hasAttribute: function (name) {
1846
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1847
- return !isNull$1(getAttribute(elm, name));
1848
- },
1849
- hasAttributeNS: function (namespace, name) {
1850
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1851
- return !isNull$1(getAttribute(elm, name, namespace));
1852
- },
1853
- removeAttribute: function (name) {
1854
- var _b = getAssociatedVM(this), elm = _b.elm, removeAttribute = _b.renderer.removeAttribute;
1855
- unlockAttribute(elm, name);
1856
- removeAttribute(elm, name);
1857
- lockAttribute();
1858
- },
1859
- removeAttributeNS: function (namespace, name) {
1860
- var _b = getAssociatedVM(this), elm = _b.elm, removeAttribute = _b.renderer.removeAttribute;
1861
- unlockAttribute(elm, name);
1862
- removeAttribute(elm, name, namespace);
1863
- lockAttribute();
1864
- },
1865
- getAttribute: function (name) {
1866
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1867
- return getAttribute(elm, name);
1868
- },
1869
- getAttributeNS: function (namespace, name) {
1870
- var _b = getAssociatedVM(this), elm = _b.elm, getAttribute = _b.renderer.getAttribute;
1871
- return getAttribute(elm, name, namespace);
1872
- },
1873
- setAttribute: function (name, value) {
1874
- var vm = getAssociatedVM(this);
1875
- var elm = vm.elm, setAttribute = vm.renderer.setAttribute;
1876
- unlockAttribute(elm, name);
1877
- setAttribute(elm, name, value);
1878
- lockAttribute();
1879
- },
1880
- setAttributeNS: function (namespace, name, value) {
1881
- var vm = getAssociatedVM(this);
1882
- var elm = vm.elm, setAttribute = vm.renderer.setAttribute;
1883
- unlockAttribute(elm, name);
1884
- setAttribute(elm, name, value, namespace);
1885
- lockAttribute();
1886
- },
1887
- getBoundingClientRect: function () {
1888
- var vm = getAssociatedVM(this);
1889
- var elm = vm.elm, getBoundingClientRect = vm.renderer.getBoundingClientRect;
1890
- return getBoundingClientRect(elm);
1891
- },
1892
- querySelector: function (selectors) {
1893
- var vm = getAssociatedVM(this);
1894
- var elm = vm.elm, querySelector = vm.renderer.querySelector;
1895
- return querySelector(elm, selectors);
1896
- },
1897
- querySelectorAll: function (selectors) {
1898
- var vm = getAssociatedVM(this);
1899
- var elm = vm.elm, querySelectorAll = vm.renderer.querySelectorAll;
1900
- return querySelectorAll(elm, selectors);
1901
- },
1902
- getElementsByTagName: function (tagNameOrWildCard) {
1903
- var vm = getAssociatedVM(this);
1904
- var elm = vm.elm, getElementsByTagName = vm.renderer.getElementsByTagName;
1905
- return getElementsByTagName(elm, tagNameOrWildCard);
1906
- },
1907
- getElementsByClassName: function (names) {
1908
- var vm = getAssociatedVM(this);
1909
- var elm = vm.elm, getElementsByClassName = vm.renderer.getElementsByClassName;
1910
- return getElementsByClassName(elm, names);
1911
- },
1912
- get isConnected() {
1913
- var _b = getAssociatedVM(this), elm = _b.elm, isConnected = _b.renderer.isConnected;
1914
- return isConnected(elm);
1915
- },
1916
- get classList() {
1917
- var vm = getAssociatedVM(this);
1918
- var elm = vm.elm, getClassList = vm.renderer.getClassList;
1919
- return getClassList(elm);
1920
- },
1921
- get template() {
1922
- var vm = getAssociatedVM(this);
1923
- return vm.cmpRoot;
1924
- },
1925
- get shadowRoot() {
1926
- // From within the component instance, the shadowRoot is always reported as "closed".
1927
- // Authors should rely on this.template instead.
1928
- return null;
1929
- },
1930
- render: function () {
1931
- var vm = getAssociatedVM(this);
1932
- return vm.def.template;
1933
- },
1934
- toString: function () {
1935
- var vm = getAssociatedVM(this);
1936
- return "[object " + vm.def.name + "]";
1937
- }
1938
- };
1939
- var lightningBasedDescriptors = create$1(null);
1940
- for (var propName in HTMLElementOriginalDescriptors) {
1941
- lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
1942
- }
1943
- defineProperties$1(BaseLightningElementConstructor.prototype, lightningBasedDescriptors);
1944
- defineProperty$1(BaseLightningElementConstructor, 'CustomElementConstructor', {
1945
- get: function () {
1946
- // If required, a runtime-specific implementation must be defined.
1947
- throw new ReferenceError('The current runtime does not support CustomElementConstructor.');
1948
- },
1949
- configurable: true
1950
- });
1951
- var BaseLightningElement = BaseLightningElementConstructor;
1952
- /*
1953
- * Copyright (c) 2018, salesforce.com, inc.
1954
- * All rights reserved.
1955
- * SPDX-License-Identifier: MIT
1956
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1957
- */
1958
- /**
1959
- * @wire decorator to wire fields and methods to a wire adapter in
1960
- * LWC Components. This function implements the internals of this
1961
- * decorator.
1962
- */
1963
- function wire(_adapter, _config) {
1964
- throw new Error();
1965
- }
1966
- function internalWireFieldDecorator(key) {
1967
- return {
1968
- get: function () {
1969
- var vm = getAssociatedVM(this);
1970
- componentValueObserved(vm, key);
1971
- return vm.cmpFields[key];
1972
- },
1973
- set: function (value) {
1974
- var vm = getAssociatedVM(this);
1975
- /**
1976
- * Reactivity for wired fields is provided in wiring.
1977
- * We intentionally add reactivity here since this is just
1978
- * letting the author to do the wrong thing, but it will keep our
1979
- * system to be backward compatible.
1980
- */
1981
- if (value !== vm.cmpFields[key]) {
1982
- vm.cmpFields[key] = value;
1983
- componentValueMutated(vm, key);
1984
- }
1985
- },
1986
- enumerable: true,
1987
- configurable: true
1988
- };
1989
- }
1990
- /*
1991
- * Copyright (c) 2018, salesforce.com, inc.
1992
- * All rights reserved.
1993
- * SPDX-License-Identifier: MIT
1994
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1995
- */
1996
- function track(target) {
1997
- if (arguments.length === 1) {
1998
- return reactiveMembrane.getProxy(target);
1999
- }
2000
- throw new Error();
2001
- }
2002
- function internalTrackDecorator(key) {
2003
- return {
2004
- get: function () {
2005
- var vm = getAssociatedVM(this);
2006
- componentValueObserved(vm, key);
2007
- return vm.cmpFields[key];
2008
- },
2009
- set: function (newValue) {
2010
- var vm = getAssociatedVM(this);
2011
- var reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2012
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2013
- vm.cmpFields[key] = reactiveOrAnyValue;
2014
- componentValueMutated(vm, key);
2015
- }
2016
- },
2017
- enumerable: true,
2018
- configurable: true
2019
- };
2020
- }
2021
- /**
2022
- * Copyright (C) 2018 salesforce.com, inc.
2023
- */
2024
- /**
2025
- * Copyright (C) 2018 salesforce.com, inc.
2026
- */
2027
- /*
2028
- * Copyright (c) 2018, salesforce.com, inc.
2029
- * All rights reserved.
2030
- * SPDX-License-Identifier: MIT
2031
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2032
- */
2033
- var create$2 = Object.create;
2034
- function isUndefined$3(obj) {
2035
- return obj === undefined;
2036
- }
2037
- function isTrue$1$1$1(obj) {
2038
- return obj === true;
2039
- }
2040
- function isFalse$1$1$1(obj) {
2041
- return obj === false;
2042
- }
2043
- /*
2044
- * Copyright (c) 2018, salesforce.com, inc.
2045
- * All rights reserved.
2046
- * SPDX-License-Identifier: MIT
2047
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2048
- */
2049
- // Inspired from: https://mathiasbynens.be/notes/globalthis
2050
- var _globalThis = /*@__PURE__*/ function () {
2051
- // On recent browsers, `globalThis` is already defined. In this case return it directly.
2052
- if (typeof globalThis === 'object') {
2053
- return globalThis;
2054
- }
2055
- var _globalThis;
2056
- try {
2057
- // eslint-disable-next-line no-extend-native
2058
- Object.defineProperty(Object.prototype, '__magic__', {
2059
- get: function () {
2060
- return this;
2061
- },
2062
- configurable: true
2063
- }); // __magic__ is undefined in Safari 10 and IE10 and older.
2064
- // @ts-ignore
2065
- // eslint-disable-next-line no-undef
2066
- _globalThis = __magic__; // @ts-ignore
2067
- delete Object.prototype.__magic__;
2068
- }
2069
- catch (ex) { // In IE8, Object.defineProperty only works on DOM objects.
2070
- }
2071
- finally {
2072
- // If the magic above fails for some reason we assume that we are in a legacy browser.
2073
- // Assume `window` exists in this case.
2074
- if (typeof _globalThis === 'undefined') {
2075
- // @ts-ignore
2076
- _globalThis = window;
2077
- }
2078
- }
2079
- return _globalThis;
2080
- }();
2081
- /** version: 1.17.8 */
2082
- /*
2083
- * Copyright (c) 2018, salesforce.com, inc.
2084
- * All rights reserved.
2085
- * SPDX-License-Identifier: MIT
2086
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2087
- */
2088
- if (!_globalThis.lwcRuntimeFlags) {
2089
- Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {
2090
- value: create$2(null)
2091
- });
2092
- }
2093
- var runtimeFlags = _globalThis.lwcRuntimeFlags; // This function is not supported for use within components and is meant for
2094
- // configuring runtime feature flags during app initialization.
2095
- function setFeatureFlag(name, value) {
2096
- var isBoolean = isTrue$1$1$1(value) || isFalse$1$1$1(value);
2097
- if (!isBoolean) {
2098
- var message = "Failed to set the value \"" + value + "\" for the runtime feature flag \"" + name + "\". Runtime feature flags can only be set to a boolean value.";
2099
- {
2100
- // eslint-disable-next-line no-console
2101
- console.error(message);
2102
- return;
2103
- }
2104
- }
2105
- if (isUndefined$3(featureFlagLookup[name])) {
2106
- // eslint-disable-next-line no-console
2107
- console.warn("Failed to set the value \"" + value + "\" for the runtime feature flag \"" + name + "\" because it is undefined. Possible reasons are that 1) it was misspelled or 2) it was removed from the @lwc/features package.");
2108
- return;
2109
- }
2110
- {
2111
- // Disallow the same flag to be set more than once in production
2112
- var runtimeValue = runtimeFlags[name];
2113
- if (!isUndefined$3(runtimeValue)) {
2114
- // eslint-disable-next-line no-console
2115
- console.error("Failed to set the value \"" + value + "\" for the runtime feature flag \"" + name + "\". \"" + name + "\" has already been set with the value \"" + runtimeValue + "\".");
2116
- return;
2117
- }
2118
- Object.defineProperty(runtimeFlags, name, {
2119
- value: value
2120
- });
2121
- }
2122
- } // This function is exposed to components to facilitate testing so we add a
2123
- // check to make sure it is not invoked in production.
2124
- function setFeatureFlagForTest(name, value) {
2125
- }
2126
- var featureFlagLookup = {
2127
- ENABLE_REACTIVE_SETTER: null,
2128
- ENABLE_HMR: null,
2129
- // Flag to toggle on/off the enforcement of innerText/outerText shadow dom semantic in elements when using synthetic shadow.
2130
- // Note: Once active, elements outside the lwc boundary are controlled by the ENABLE_ELEMENT_PATCH flag.
2131
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
2132
- // Flags to toggle on/off the enforcement of shadow dom semantic in element/node outside lwc boundary when using synthetic shadow.
2133
- ENABLE_ELEMENT_PATCH: null,
2134
- ENABLE_NODE_LIST_PATCH: null,
2135
- ENABLE_HTML_COLLECTIONS_PATCH: null,
2136
- ENABLE_NODE_PATCH: null
2137
- };
2138
- /** version: 1.17.8 */
2139
- /*
2140
- * Copyright (c) 2018, salesforce.com, inc.
2141
- * All rights reserved.
2142
- * SPDX-License-Identifier: MIT
2143
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2144
- */
2145
- function api() {
2146
- throw new Error();
2147
- }
2148
- function createPublicPropertyDescriptor(key) {
2149
- return {
2150
- get: function () {
2151
- var vm = getAssociatedVM(this);
2152
- if (isBeingConstructed(vm)) {
2153
- return;
2154
- }
2155
- componentValueObserved(vm, key);
2156
- return vm.cmpProps[key];
2157
- },
2158
- set: function (newValue) {
2159
- var vm = getAssociatedVM(this);
2160
- vm.cmpProps[key] = newValue;
2161
- componentValueMutated(vm, key);
2162
- },
2163
- enumerable: true,
2164
- configurable: true
2165
- };
2166
- }
2167
- var AccessorReactiveObserver = /** @class */ (function (_super) {
2168
- __extends(AccessorReactiveObserver, _super);
2169
- function AccessorReactiveObserver(vm, set) {
2170
- var _this = _super.call(this, function () {
2171
- if (isFalse$1$1(_this.debouncing)) {
2172
- _this.debouncing = true;
2173
- addCallbackToNextTick(function () {
2174
- if (isTrue$1$1(_this.debouncing)) {
2175
- var value = _this.value;
2176
- var dirtyStateBeforeSetterCall = vm.isDirty, component = vm.component, idx_1 = vm.idx;
2177
- set.call(component, value); // de-bouncing after the call to the original setter to prevent
2178
- // infinity loop if the setter itself is mutating things that
2179
- // were accessed during the previous invocation.
2180
- _this.debouncing = false;
2181
- if (isTrue$1$1(vm.isDirty) && isFalse$1$1(dirtyStateBeforeSetterCall) && idx_1 > 0) {
2182
- // immediate rehydration due to a setter driven mutation, otherwise
2183
- // the component will get rendered on the second tick, which it is not
2184
- // desirable.
2185
- rerenderVM(vm);
2186
- }
2187
- }
2188
- });
2189
- }
2190
- }) || this;
2191
- _this.debouncing = false;
2192
- return _this;
2193
- }
2194
- AccessorReactiveObserver.prototype.reset = function (value) {
2195
- _super.prototype.reset.call(this);
2196
- this.debouncing = false;
2197
- if (arguments.length > 0) {
2198
- this.value = value;
2199
- }
2200
- };
2201
- return AccessorReactiveObserver;
2202
- }(ReactiveObserver));
2203
- function createPublicAccessorDescriptor(key, descriptor) {
2204
- var get = descriptor.get, set = descriptor.set, enumerable = descriptor.enumerable, configurable = descriptor.configurable;
2205
- if (!isFunction$1(get)) {
2206
- throw new Error();
2207
- }
2208
- return {
2209
- get: function () {
2210
- return get.call(this);
2211
- },
2212
- set: function (newValue) {
2213
- var _this = this;
2214
- var vm = getAssociatedVM(this);
2215
- if (set) {
2216
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2217
- var ro = vm.oar[key];
2218
- if (isUndefined$1(ro)) {
2219
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2220
- } // every time we invoke this setter from outside (through this wrapper setter)
2221
- // we should reset the value and then debounce just in case there is a pending
2222
- // invocation the next tick that is not longer relevant since the value is changing
2223
- // from outside.
2224
- ro.reset(newValue);
2225
- ro.observe(function () {
2226
- set.call(_this, newValue);
2227
- });
2228
- }
2229
- else {
2230
- set.call(this, newValue);
2231
- }
2232
- }
2233
- },
2234
- enumerable: enumerable,
2235
- configurable: configurable
2236
- };
2237
- }
2238
- function createObservedFieldPropertyDescriptor(key) {
2239
- return {
2240
- get: function () {
2241
- var vm = getAssociatedVM(this);
2242
- componentValueObserved(vm, key);
2243
- return vm.cmpFields[key];
2244
- },
2245
- set: function (newValue) {
2246
- var vm = getAssociatedVM(this);
2247
- if (newValue !== vm.cmpFields[key]) {
2248
- vm.cmpFields[key] = newValue;
2249
- componentValueMutated(vm, key);
2250
- }
2251
- },
2252
- enumerable: true,
2253
- configurable: true
2254
- };
2255
- }
2256
- /*
2257
- * Copyright (c) 2018, salesforce.com, inc.
2258
- * All rights reserved.
2259
- * SPDX-License-Identifier: MIT
2260
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2261
- */
2262
- var PropType;
2263
- (function (PropType) {
2264
- PropType[PropType["Field"] = 0] = "Field";
2265
- PropType[PropType["Set"] = 1] = "Set";
2266
- PropType[PropType["Get"] = 2] = "Get";
2267
- PropType[PropType["GetSet"] = 3] = "GetSet";
2268
- })(PropType || (PropType = {}));
2269
- /**
2270
- * INTERNAL: This function can only be invoked by compiled code. The compiler
2271
- * will prevent this function from being imported by user-land code.
2272
- */
2273
- function registerDecorators(Ctor, meta) {
2274
- var proto = Ctor.prototype;
2275
- var publicProps = meta.publicProps, publicMethods = meta.publicMethods, wire = meta.wire, track = meta.track, fields = meta.fields;
2276
- var apiMethods = create$1(null);
2277
- var apiFields = create$1(null);
2278
- var wiredMethods = create$1(null);
2279
- var wiredFields = create$1(null);
2280
- var observedFields = create$1(null);
2281
- var apiFieldsConfig = create$1(null);
2282
- var descriptor;
2283
- if (!isUndefined$1(publicProps)) {
2284
- for (var fieldName in publicProps) {
2285
- var propConfig = publicProps[fieldName];
2286
- apiFieldsConfig[fieldName] = propConfig.config;
2287
- descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2288
- if (propConfig.config > 0) {
2289
- if (isUndefined$1(descriptor)) {
2290
- throw new Error();
2291
- }
2292
- descriptor = createPublicAccessorDescriptor(fieldName, descriptor);
2293
- }
2294
- else {
2295
- descriptor = createPublicPropertyDescriptor(fieldName);
2296
- }
2297
- apiFields[fieldName] = descriptor;
2298
- defineProperty$1(proto, fieldName, descriptor);
2299
- }
2300
- }
2301
- if (!isUndefined$1(publicMethods)) {
2302
- forEach$1.call(publicMethods, function (methodName) {
2303
- descriptor = getOwnPropertyDescriptor$1(proto, methodName);
2304
- if (isUndefined$1(descriptor)) {
2305
- throw new Error();
2306
- }
2307
- apiMethods[methodName] = descriptor;
2308
- });
2309
- }
2310
- if (!isUndefined$1(wire)) {
2311
- for (var fieldOrMethodName in wire) {
2312
- var _b = wire[fieldOrMethodName], adapter = _b.adapter, method = _b.method, configCallback = _b.config, _c = _b.dynamic, dynamic = _c === void 0 ? [] : _c;
2313
- descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);
2314
- if (method === 1) {
2315
- if (isUndefined$1(descriptor)) {
2316
- throw new Error();
2317
- }
2318
- wiredMethods[fieldOrMethodName] = descriptor;
2319
- storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic);
2320
- }
2321
- else {
2322
- descriptor = internalWireFieldDecorator(fieldOrMethodName);
2323
- wiredFields[fieldOrMethodName] = descriptor;
2324
- storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic);
2325
- defineProperty$1(proto, fieldOrMethodName, descriptor);
2326
- }
2327
- }
2328
- }
2329
- if (!isUndefined$1(track)) {
2330
- for (var fieldName in track) {
2331
- descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2332
- descriptor = internalTrackDecorator(fieldName);
2333
- defineProperty$1(proto, fieldName, descriptor);
2334
- }
2335
- }
2336
- if (!isUndefined$1(fields)) {
2337
- for (var i_9 = 0, n = fields.length; i_9 < n; i_9++) {
2338
- var fieldName = fields[i_9];
2339
- descriptor = getOwnPropertyDescriptor$1(proto, fieldName);
2340
- observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);
2341
- }
2342
- }
2343
- setDecoratorsMeta(Ctor, {
2344
- apiMethods: apiMethods,
2345
- apiFields: apiFields,
2346
- apiFieldsConfig: apiFieldsConfig,
2347
- wiredMethods: wiredMethods,
2348
- wiredFields: wiredFields,
2349
- observedFields: observedFields
2350
- });
2351
- return Ctor;
2352
- }
2353
- var signedDecoratorToMetaMap = new Map();
2354
- function setDecoratorsMeta(Ctor, meta) {
2355
- signedDecoratorToMetaMap.set(Ctor, meta);
2356
- }
2357
- var defaultMeta = {
2358
- apiMethods: EmptyObject,
2359
- apiFields: EmptyObject,
2360
- apiFieldsConfig: EmptyObject,
2361
- wiredMethods: EmptyObject,
2362
- wiredFields: EmptyObject,
2363
- observedFields: EmptyObject
2364
- };
2365
- function getDecoratorsMeta(Ctor) {
2366
- var meta = signedDecoratorToMetaMap.get(Ctor);
2367
- return isUndefined$1(meta) ? defaultMeta : meta;
2368
- }
2369
- var signedTemplateSet = new Set();
2370
- function defaultEmptyTemplate() {
2371
- return [];
2372
- }
2373
- signedTemplateSet.add(defaultEmptyTemplate);
2374
- function isTemplateRegistered(tpl) {
2375
- return signedTemplateSet.has(tpl);
2376
- }
2377
- /**
2378
- * INTERNAL: This function can only be invoked by compiled code. The compiler
2379
- * will prevent this function from being imported by userland code.
2380
- */
2381
- function registerTemplate(tpl) {
2382
- signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing
2383
- // assignment of templates easily, without too much transformation
2384
- return tpl;
2385
- }
2386
- /**
2387
- * EXPERIMENTAL: This function acts like a hook for Lightning Locker
2388
- * Service and other similar libraries to sanitize vulnerable attributes.
2389
- * This API is subject to change or being removed.
2390
- */
2391
- function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
2392
- // locker-service patches this function during runtime to sanitize vulnerable attributes.
2393
- // when ran off-core this function becomes a noop and returns the user authored value.
2394
- return attrValue;
2395
- }
2396
- /*
2397
- * Copyright (c) 2018, salesforce.com, inc.
2398
- * All rights reserved.
2399
- * SPDX-License-Identifier: MIT
2400
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2401
- */
2402
- // from the element instance, and get the value or set a new value on the component.
2403
- // This means that across different elements, similar names can get the exact same
2404
- // descriptor, so we can cache them:
2405
- var cachedGetterByKey = create$1(null);
2406
- var cachedSetterByKey = create$1(null);
2407
- function createGetter(key) {
2408
- var fn = cachedGetterByKey[key];
2409
- if (isUndefined$1(fn)) {
2410
- fn = cachedGetterByKey[key] = function () {
2411
- var vm = getAssociatedVM(this);
2412
- var getHook = vm.getHook;
2413
- return getHook(vm.component, key);
2414
- };
2415
- }
2416
- return fn;
2417
- }
2418
- function createSetter(key) {
2419
- var fn = cachedSetterByKey[key];
2420
- if (isUndefined$1(fn)) {
2421
- fn = cachedSetterByKey[key] = function (newValue) {
2422
- var vm = getAssociatedVM(this);
2423
- var setHook = vm.setHook;
2424
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2425
- setHook(vm.component, key, newValue);
2426
- };
2427
- }
2428
- return fn;
2429
- }
2430
- function createMethodCaller(methodName) {
2431
- return function () {
2432
- var vm = getAssociatedVM(this);
2433
- var callHook = vm.callHook, component = vm.component;
2434
- var fn = component[methodName];
2435
- return callHook(vm.component, fn, ArraySlice$2.call(arguments));
2436
- };
2437
- }
2438
- function createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback) {
2439
- return function attributeChangedCallback(attrName, oldValue, newValue) {
2440
- if (oldValue === newValue) {
2441
- // Ignore same values.
2442
- return;
2443
- }
2444
- var propName = attributeToPropMap[attrName];
2445
- if (isUndefined$1(propName)) {
2446
- if (!isUndefined$1(superAttributeChangedCallback)) {
2447
- // delegate unknown attributes to the super.
2448
- // Typescript does not like it when you treat the `arguments` object as an array
2449
- // @ts-ignore type-mismatch
2450
- superAttributeChangedCallback.apply(this, arguments);
2451
- }
2452
- return;
2453
- }
2454
- if (!isAttributeLocked(this, attrName)) {
2455
- // Ignore changes triggered by the engine itself during:
2456
- // * diffing when public props are attempting to reflect to the DOM
2457
- // * component via `this.setAttribute()`, should never update the prop
2458
- // Both cases, the setAttribute call is always wrapped by the unlocking of the
2459
- // attribute to be changed
2460
- return;
2461
- } // Reflect attribute change to the corresponding property when changed from outside.
2462
- this[propName] = newValue;
2463
- };
2464
- }
2465
- function HTMLBridgeElementFactory(SuperClass, props, methods) {
2466
- var HTMLBridgeElement;
2467
- /**
2468
- * Modern browsers will have all Native Constructors as regular Classes
2469
- * and must be instantiated with the new keyword. In older browsers,
2470
- * specifically IE11, those are objects with a prototype property defined,
2471
- * since they are not supposed to be extended or instantiated with the
2472
- * new keyword. This forking logic supports both cases, specifically because
2473
- * wc.ts relies on the construction path of the bridges to create new
2474
- * fully qualifying web components.
2475
- */
2476
- if (isFunction$1(SuperClass)) {
2477
- HTMLBridgeElement = /** @class */ (function (_super) {
2478
- __extends(HTMLBridgeElement, _super);
2479
- function HTMLBridgeElement() {
2480
- return _super !== null && _super.apply(this, arguments) || this;
2481
- }
2482
- return HTMLBridgeElement;
2483
- }(SuperClass));
2484
- }
2485
- else {
2486
- HTMLBridgeElement = function () {
2487
- // Bridge classes are not supposed to be instantiated directly in
2488
- // browsers that do not support web components.
2489
- throw new TypeError('Illegal constructor');
2490
- }; // prototype inheritance dance
2491
- setPrototypeOf$1(HTMLBridgeElement, SuperClass);
2492
- setPrototypeOf$1(HTMLBridgeElement.prototype, SuperClass.prototype);
2493
- defineProperty$1(HTMLBridgeElement.prototype, 'constructor', {
2494
- writable: true,
2495
- configurable: true,
2496
- value: HTMLBridgeElement
2497
- });
2498
- } // generating the hash table for attributes to avoid duplicate fields and facilitate validation
2499
- // and false positives in case of inheritance.
2500
- var attributeToPropMap = create$1(null);
2501
- var superAttributeChangedCallback = SuperClass.prototype.attributeChangedCallback;
2502
- var _b = SuperClass.observedAttributes, superObservedAttributes = _b === void 0 ? [] : _b;
2503
- var descriptors = create$1(null); // expose getters and setters for each public props on the new Element Bridge
2504
- for (var i_10 = 0, len = props.length; i_10 < len; i_10 += 1) {
2505
- var propName = props[i_10];
2506
- attributeToPropMap[htmlPropertyToAttribute$1(propName)] = propName;
2507
- descriptors[propName] = {
2508
- get: createGetter(propName),
2509
- set: createSetter(propName),
2510
- enumerable: true,
2511
- configurable: true
2512
- };
2513
- } // expose public methods as props on the new Element Bridge
2514
- for (var i_11 = 0, len = methods.length; i_11 < len; i_11 += 1) {
2515
- var methodName = methods[i_11];
2516
- descriptors[methodName] = {
2517
- value: createMethodCaller(methodName),
2518
- writable: true,
2519
- configurable: true
2520
- };
2521
- } // creating a new attributeChangedCallback per bridge because they are bound to the corresponding
2522
- // map of attributes to props. We do this after all other props and methods to avoid the possibility
2523
- // of getting overrule by a class declaration in user-land, and we make it non-writable, non-configurable
2524
- // to preserve this definition.
2525
- descriptors.attributeChangedCallback = {
2526
- value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)
2527
- }; // Specify attributes for which we want to reflect changes back to their corresponding
2528
- // properties via attributeChangedCallback.
2529
- defineProperty$1(HTMLBridgeElement, 'observedAttributes', {
2530
- get: function () {
2531
- return __spreadArrays(superObservedAttributes, keys$1(attributeToPropMap));
2532
- }
2533
- });
2534
- defineProperties$1(HTMLBridgeElement.prototype, descriptors);
2535
- return HTMLBridgeElement;
2536
- }
2537
- var BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2538
- freeze$1(BaseBridgeElement);
2539
- seal$1(BaseBridgeElement.prototype);
2540
- /*
2541
- * Copyright (c) 2020, salesforce.com, inc.
2542
- * All rights reserved.
2543
- * SPDX-License-Identifier: MIT
2544
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2545
- */
2546
- function resolveCircularModuleDependency(fn) {
2547
- return fn();
2548
- }
2549
- function isCircularModuleDependency(obj) {
2550
- return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');
2551
- }
2552
- function setActiveVM(vm) {
2553
- {
2554
- // this method should never leak to prod
2555
- throw new ReferenceError();
2556
- }
2557
- }
2558
- function swapTemplate(oldTpl, newTpl) {
2559
- if (!runtimeFlags.ENABLE_HMR) {
2560
- throw new Error('HMR is not enabled');
2561
- }
2562
- return false;
2563
- }
2564
- function swapComponent(oldComponent, newComponent) {
2565
- if (!runtimeFlags.ENABLE_HMR) {
2566
- throw new Error('HMR is not enabled');
2567
- }
2568
- return false;
2569
- }
2570
- function swapStyle(oldStyle, newStyle) {
2571
- if (!runtimeFlags.ENABLE_HMR) {
2572
- throw new Error('HMR is not enabled');
2573
- }
2574
- return false;
2575
- }
2576
- /*
2577
- * Copyright (c) 2018, salesforce.com, inc.
2578
- * All rights reserved.
2579
- * SPDX-License-Identifier: MIT
2580
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2581
- */
2582
- var CtorToDefMap = new WeakMap();
2583
- function getCtorProto(Ctor) {
2584
- var proto = getPrototypeOf$1(Ctor);
2585
- if (isNull$1(proto)) {
2586
- throw new ReferenceError("Invalid prototype chain for " + Ctor.name + ", you must extend LightningElement.");
2587
- } // covering the cases where the ref is circular in AMD
2588
- if (isCircularModuleDependency(proto)) {
2589
- var p = resolveCircularModuleDependency(proto);
2590
- // of our Base class without having to leak it to user-land. If the circular function returns
2591
- // itself, that's the signal that we have hit the end of the proto chain, which must always
2592
- // be base.
2593
- proto = p === proto ? BaseLightningElement : p;
2594
- }
2595
- return proto;
2596
- }
2597
- function createComponentDef(Ctor) {
2598
- var decoratorsMeta = getDecoratorsMeta(Ctor);
2599
- var apiFields = decoratorsMeta.apiFields, apiFieldsConfig = decoratorsMeta.apiFieldsConfig, apiMethods = decoratorsMeta.apiMethods, wiredFields = decoratorsMeta.wiredFields, wiredMethods = decoratorsMeta.wiredMethods, observedFields = decoratorsMeta.observedFields;
2600
- var proto = Ctor.prototype;
2601
- var connectedCallback = proto.connectedCallback, disconnectedCallback = proto.disconnectedCallback, renderedCallback = proto.renderedCallback, errorCallback = proto.errorCallback, render = proto.render;
2602
- var superProto = getCtorProto(Ctor);
2603
- var superDef = superProto !== BaseLightningElement ? getComponentInternalDef(superProto) : lightingElementDef;
2604
- var bridge = HTMLBridgeElementFactory(superDef.bridge, keys$1(apiFields), keys$1(apiMethods));
2605
- var props = assign$1(create$1(null), superDef.props, apiFields);
2606
- var propsConfig = assign$1(create$1(null), superDef.propsConfig, apiFieldsConfig);
2607
- var methods = assign$1(create$1(null), superDef.methods, apiMethods);
2608
- var wire = assign$1(create$1(null), superDef.wire, wiredFields, wiredMethods);
2609
- connectedCallback = connectedCallback || superDef.connectedCallback;
2610
- disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;
2611
- renderedCallback = renderedCallback || superDef.renderedCallback;
2612
- errorCallback = errorCallback || superDef.errorCallback;
2613
- render = render || superDef.render;
2614
- var template = getComponentRegisteredTemplate(Ctor) || superDef.template;
2615
- var name = Ctor.name || superDef.name; // installing observed fields into the prototype.
2616
- defineProperties$1(proto, observedFields);
2617
- var def = {
2618
- ctor: Ctor,
2619
- name: name,
2620
- wire: wire,
2621
- props: props,
2622
- propsConfig: propsConfig,
2623
- methods: methods,
2624
- bridge: bridge,
2625
- template: template,
2626
- connectedCallback: connectedCallback,
2627
- disconnectedCallback: disconnectedCallback,
2628
- renderedCallback: renderedCallback,
2629
- errorCallback: errorCallback,
2630
- render: render
2631
- };
2632
- return def;
2633
- }
2634
- /**
2635
- * EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is
2636
- * subject to change or being removed.
2637
- */
2638
- function isComponentConstructor(ctor) {
2639
- if (!isFunction$1(ctor)) {
2640
- return false;
2641
- } // Fast path: LightningElement is part of the prototype chain of the constructor.
2642
- if (ctor.prototype instanceof BaseLightningElement) {
2643
- return true;
2644
- } // Slow path: LightningElement is not part of the prototype chain of the constructor, we need
2645
- // climb up the constructor prototype chain to check in case there are circular dependencies
2646
- // to resolve.
2647
- var current = ctor;
2648
- do {
2649
- if (isCircularModuleDependency(current)) {
2650
- var circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end
2651
- // of the proto chain, which must always be a valid base constructor.
2652
- if (circularResolved === current) {
2653
- return true;
2654
- }
2655
- current = circularResolved;
2656
- }
2657
- if (current === BaseLightningElement) {
2658
- return true;
2659
- }
2660
- } while (!isNull$1(current) && (current = getPrototypeOf$1(current))); // Finally return false if the LightningElement is not part of the prototype chain.
2661
- return false;
2662
- }
2663
- function getComponentInternalDef(Ctor) {
2664
- var def = CtorToDefMap.get(Ctor);
2665
- if (isUndefined$1(def)) {
2666
- if (isCircularModuleDependency(Ctor)) {
2667
- var resolvedCtor = resolveCircularModuleDependency(Ctor);
2668
- def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,
2669
- // look up the definition in cache instead of re-resolving and recreating the def.
2670
- CtorToDefMap.set(Ctor, def);
2671
- return def;
2672
- }
2673
- if (!isComponentConstructor(Ctor)) {
2674
- throw new TypeError(Ctor + " is not a valid component, or does not extends LightningElement from \"lwc\". You probably forgot to add the extend clause on the class declaration.");
2675
- }
2676
- def = createComponentDef(Ctor);
2677
- CtorToDefMap.set(Ctor, def);
2678
- }
2679
- return def;
2680
- }
2681
- var lightingElementDef = {
2682
- ctor: BaseLightningElement,
2683
- name: BaseLightningElement.name,
2684
- props: lightningBasedDescriptors,
2685
- propsConfig: EmptyObject,
2686
- methods: EmptyObject,
2687
- wire: EmptyObject,
2688
- bridge: BaseBridgeElement,
2689
- template: defaultEmptyTemplate,
2690
- render: BaseLightningElement.prototype.render
2691
- };
2692
- var PropDefType;
2693
- (function (PropDefType) {
2694
- PropDefType["any"] = "any";
2695
- })(PropDefType || (PropDefType = {}));
2696
- /**
2697
- * EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is
2698
- * subject to change or being removed.
2699
- */
2700
- function getComponentDef(Ctor) {
2701
- var def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful
2702
- // for some external services, e.g.: Locker Service, usually, all they care
2703
- // is about the shape of the constructor, the internals of it are not relevant
2704
- // because they don't have a way to mess with that.
2705
- var ctor = def.ctor, name = def.name, props = def.props, propsConfig = def.propsConfig, methods = def.methods;
2706
- var publicProps = {};
2707
- for (var key in props) {
2708
- // avoid leaking the reference to the public props descriptors
2709
- publicProps[key] = {
2710
- config: propsConfig[key] || 0,
2711
- type: PropDefType.any,
2712
- attr: htmlPropertyToAttribute$1(key)
2713
- };
2714
- }
2715
- var publicMethods = {};
2716
- for (var key in methods) {
2717
- // avoid leaking the reference to the public method descriptors
2718
- publicMethods[key] = methods[key].value;
2719
- }
2720
- return {
2721
- ctor: ctor,
2722
- name: name,
2723
- props: publicProps,
2724
- methods: publicMethods
2725
- };
2726
- }
2727
- /*
2728
- * Copyright (c) 2018, salesforce.com, inc.
2729
- * All rights reserved.
2730
- * SPDX-License-Identifier: MIT
2731
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2732
- */
2733
- var noop = function () { return void 0; };
2734
- function observeElementChildNodes(elm) {
2735
- elm.$domManual$ = true;
2736
- }
2737
- function setElementShadowToken(elm, token) {
2738
- elm.$shadowToken$ = token;
2739
- }
2740
- function updateNodeHook(oldVnode, vnode) {
2741
- var elm = vnode.elm, text = vnode.text, renderer = vnode.owner.renderer;
2742
- if (oldVnode.text !== text) {
2743
- renderer.setText(elm, text);
2744
- }
2745
- }
2746
- function insertNodeHook(vnode, parentNode, referenceNode) {
2747
- var renderer = vnode.owner.renderer;
2748
- renderer.insert(vnode.elm, parentNode, referenceNode);
2749
- }
2750
- function removeNodeHook(vnode, parentNode) {
2751
- var renderer = vnode.owner.renderer;
2752
- renderer.remove(vnode.elm, parentNode);
2753
- }
2754
- function createElmHook(vnode) {
2755
- modEvents.create(vnode); // Attrs need to be applied to element before props
2756
- // IE11 will wipe out value on radio inputs if value
2757
- // is set before type=radio.
2758
- modAttrs.create(vnode);
2759
- modProps.create(vnode);
2760
- modStaticClassName.create(vnode);
2761
- modStaticStyle.create(vnode);
2762
- modComputedClassName.create(vnode);
2763
- modComputedStyle.create(vnode);
2764
- }
2765
- var LWCDOMMode;
2766
- (function (LWCDOMMode) {
2767
- LWCDOMMode["manual"] = "manual";
2768
- })(LWCDOMMode || (LWCDOMMode = {}));
2769
- function fallbackElmHook(elm, vnode) {
2770
- var owner = vnode.owner;
2771
- if (isTrue$1$1(owner.renderer.syntheticShadow)) {
2772
- var context = vnode.data.context;
2773
- var shadowAttribute = owner.context.shadowAttribute;
2774
- if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === LWCDOMMode.manual) {
2775
- // this element will now accept any manual content inserted into it
2776
- observeElementChildNodes(elm);
2777
- } // when running in synthetic shadow mode, we need to set the shadowToken value
2778
- // into each element from the template, so they can be styled accordingly.
2779
- setElementShadowToken(elm, shadowAttribute);
2780
- }
2781
- var context;
2782
- }
2783
- function updateElmHook(oldVnode, vnode) {
2784
- // Attrs need to be applied to element before props
2785
- // IE11 will wipe out value on radio inputs if value
2786
- // is set before type=radio.
2787
- modAttrs.update(oldVnode, vnode);
2788
- modProps.update(oldVnode, vnode);
2789
- modComputedClassName.update(oldVnode, vnode);
2790
- modComputedStyle.update(oldVnode, vnode);
2791
- }
2792
- function updateChildrenHook(oldVnode, vnode) {
2793
- var children = vnode.children, owner = vnode.owner;
2794
- var fn = hasDynamicChildren(children) ? updateDynamicChildren : updateStaticChildren;
2795
- runWithBoundaryProtection(owner, owner.owner, noop, function () {
2796
- fn(vnode.elm, oldVnode.children, children);
2797
- }, noop);
2798
- }
2799
- function allocateChildrenHook(vnode, vm) {
2800
- // A component with slots will re-render because:
2801
- // 1- There is a change of the internal state.
2802
- // 2- There is a change on the external api (ex: slots)
2803
- //
2804
- // In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the
2805
- // slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children
2806
- // in a reused VCustomElement, there won't be any slotted children.
2807
- // For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.
2808
- //
2809
- // In case #2, we will always get a fresh VCustomElement.
2810
- var children = vnode.aChildren || vnode.children;
2811
- vm.aChildren = children;
2812
- if (isTrue$1$1(vm.renderer.syntheticShadow)) {
2813
- // slow path
2814
- allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.
2815
- vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
2816
- vnode.children = EmptyArray;
2817
- }
2818
- }
2819
- function createViewModelHook(elm, vnode) {
2820
- if (!isUndefined$1(getAssociatedVMIfPresent(elm))) {
2821
- // There is a possibility that a custom element is registered under tagName,
2822
- // in which case, the initialization is already carry on, and there is nothing else
2823
- // to do here since this hook is called right after invoking `document.createElement`.
2824
- return;
2825
- }
2826
- var sel = vnode.sel, mode = vnode.mode, ctor = vnode.ctor, owner = vnode.owner;
2827
- var def = getComponentInternalDef(ctor);
2828
- if (isTrue$1$1(owner.renderer.syntheticShadow)) {
2829
- var shadowAttribute = owner.context.shadowAttribute; // when running in synthetic shadow mode, we need to set the shadowToken value
2830
- // into each element from the template, so they can be styled accordingly.
2831
- setElementShadowToken(elm, shadowAttribute);
2832
- }
2833
- createVM(elm, def, {
2834
- mode: mode,
2835
- owner: owner,
2836
- tagName: sel,
2837
- renderer: owner.renderer
2838
- });
2839
- }
2840
- function createCustomElmHook(vnode) {
2841
- modEvents.create(vnode); // Attrs need to be applied to element before props
2842
- // IE11 will wipe out value on radio inputs if value
2843
- // is set before type=radio.
2844
- modAttrs.create(vnode);
2845
- modProps.create(vnode);
2846
- modStaticClassName.create(vnode);
2847
- modStaticStyle.create(vnode);
2848
- modComputedClassName.create(vnode);
2849
- modComputedStyle.create(vnode);
2850
- }
2851
- function createChildrenHook(vnode) {
2852
- var elm = vnode.elm, children = vnode.children;
2853
- for (var j = 0; j < children.length; ++j) {
2854
- var ch = children[j];
2855
- if (ch != null) {
2856
- ch.hook.create(ch);
2857
- ch.hook.insert(ch, elm, null);
2858
- }
2859
- }
2860
- }
2861
- function updateCustomElmHook(oldVnode, vnode) {
2862
- // Attrs need to be applied to element before props
2863
- // IE11 will wipe out value on radio inputs if value
2864
- // is set before type=radio.
2865
- modAttrs.update(oldVnode, vnode);
2866
- modProps.update(oldVnode, vnode);
2867
- modComputedClassName.update(oldVnode, vnode);
2868
- modComputedStyle.update(oldVnode, vnode);
2869
- }
2870
- function removeElmHook(vnode) {
2871
- // this method only needs to search on child vnodes from template
2872
- // to trigger the remove hook just in case some of those children
2873
- // are custom elements.
2874
- var children = vnode.children, elm = vnode.elm;
2875
- for (var j = 0, len = children.length; j < len; ++j) {
2876
- var ch = children[j];
2877
- if (!isNull$1(ch)) {
2878
- ch.hook.remove(ch, elm);
2879
- }
2880
- }
2881
- } // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
2882
- var FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
2883
- // in a template, and will require a more complex diffing algo.
2884
- function markAsDynamicChildren(children) {
2885
- FromIteration.set(children, 1);
2886
- }
2887
- function hasDynamicChildren(children) {
2888
- return FromIteration.has(children);
2889
- }
2890
- /*
2891
- * Copyright (c) 2020, salesforce.com, inc.
2892
- * All rights reserved.
2893
- * SPDX-License-Identifier: MIT
2894
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2895
- */
2896
- function getUpgradableConstructor(tagName, renderer) {
2897
- // Should never get a tag with upper case letter at this point, the compiler should
2898
- // produce only tags with lowercase letters
2899
- // But, for backwards compatibility, we will lower case the tagName
2900
- tagName = tagName.toLowerCase();
2901
- var CE = renderer.getCustomElement(tagName);
2902
- if (!isUndefined$1(CE)) {
2903
- return CE;
2904
- }
2905
- /**
2906
- * LWC Upgradable Element reference to an element that was created
2907
- * via the scoped registry mechanism, and that is ready to be upgraded.
2908
- */
2909
- CE = /** @class */ (function (_super) {
2910
- __extends(LWCUpgradableElement, _super);
2911
- function LWCUpgradableElement(upgradeCallback) {
2912
- var _this = _super.call(this) || this;
2913
- if (isFunction$1(upgradeCallback)) {
2914
- upgradeCallback(_this); // nothing to do with the result for now
2915
- }
2916
- return _this;
2917
- }
2918
- return LWCUpgradableElement;
2919
- }(renderer.HTMLElement));
2920
- renderer.defineCustomElement(tagName, CE);
2921
- return CE;
2922
- }
2923
- /*
2924
- * Copyright (c) 2018, salesforce.com, inc.
2925
- * All rights reserved.
2926
- * SPDX-License-Identifier: MIT
2927
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2928
- */
2929
- var CHAR_S = 115;
2930
- var CHAR_V = 118;
2931
- var CHAR_G = 103;
2932
- var NamespaceAttributeForSVG = 'http://www.w3.org/2000/svg';
2933
- var SymbolIterator = Symbol.iterator;
2934
- var TextHook = {
2935
- create: function (vnode) {
2936
- var owner = vnode.owner;
2937
- var renderer = owner.renderer;
2938
- var elm = renderer.createText(vnode.text);
2939
- linkNodeToShadow(elm, owner);
2940
- vnode.elm = elm;
2941
- },
2942
- update: updateNodeHook,
2943
- insert: insertNodeHook,
2944
- move: insertNodeHook,
2945
- remove: removeNodeHook
2946
- }; // insert is called after update, which is used somewhere else (via a module)
2947
- // to mark the vm as inserted, that means we cannot use update as the main channel
2948
- // to rehydrate when dirty, because sometimes the element is not inserted just yet,
2949
- // which breaks some invariants. For that reason, we have the following for any
2950
- // Custom Element that is inserted via a template.
2951
- var ElementHook = {
2952
- create: function (vnode) {
2953
- var sel = vnode.sel, owner = vnode.owner, ns = vnode.data.ns;
2954
- var renderer = owner.renderer;
2955
- var elm = renderer.createElement(sel, ns);
2956
- linkNodeToShadow(elm, owner);
2957
- fallbackElmHook(elm, vnode);
2958
- vnode.elm = elm;
2959
- createElmHook(vnode);
2960
- },
2961
- update: function (oldVnode, vnode) {
2962
- updateElmHook(oldVnode, vnode);
2963
- updateChildrenHook(oldVnode, vnode);
2964
- },
2965
- insert: function (vnode, parentNode, referenceNode) {
2966
- insertNodeHook(vnode, parentNode, referenceNode);
2967
- createChildrenHook(vnode);
2968
- },
2969
- move: function (vnode, parentNode, referenceNode) {
2970
- insertNodeHook(vnode, parentNode, referenceNode);
2971
- },
2972
- remove: function (vnode, parentNode) {
2973
- removeNodeHook(vnode, parentNode);
2974
- removeElmHook(vnode);
2975
- }
2976
- };
2977
- var CustomElementHook = {
2978
- create: function (vnode) {
2979
- var sel = vnode.sel, owner = vnode.owner;
2980
- var renderer = owner.renderer;
2981
- var UpgradableConstructor = getUpgradableConstructor(sel, renderer);
2982
- /**
2983
- * Note: if the upgradable constructor does not expect, or throw when we new it
2984
- * with a callback as the first argument, we could implement a more advanced
2985
- * mechanism that only passes that argument if the constructor is known to be
2986
- * an upgradable custom element.
2987
- */
2988
- var elm = new UpgradableConstructor(function (elm) {
2989
- // the custom element from the registry is expecting an upgrade callback
2990
- createViewModelHook(elm, vnode);
2991
- });
2992
- linkNodeToShadow(elm, owner);
2993
- vnode.elm = elm;
2994
- var vm = getAssociatedVMIfPresent(elm);
2995
- if (vm) {
2996
- allocateChildrenHook(vnode, vm);
2997
- }
2998
- else if (vnode.ctor !== UpgradableConstructor) {
2999
- throw new TypeError("Incorrect Component Constructor");
3000
- }
3001
- createCustomElmHook(vnode);
3002
- },
3003
- update: function (oldVnode, vnode) {
3004
- updateCustomElmHook(oldVnode, vnode);
3005
- var vm = getAssociatedVMIfPresent(vnode.elm);
3006
- if (vm) {
3007
- // in fallback mode, the allocation will always set children to
3008
- // empty and delegate the real allocation to the slot elements
3009
- allocateChildrenHook(vnode, vm);
3010
- } // in fallback mode, the children will be always empty, so, nothing
3011
- // will happen, but in native, it does allocate the light dom
3012
- updateChildrenHook(oldVnode, vnode);
3013
- if (vm) {
3014
- // this is important to preserve the top to bottom synchronous rendering phase.
3015
- rerenderVM(vm);
3016
- }
3017
- },
3018
- insert: function (vnode, parentNode, referenceNode) {
3019
- insertNodeHook(vnode, parentNode, referenceNode);
3020
- var vm = getAssociatedVMIfPresent(vnode.elm);
3021
- if (vm) {
3022
- runConnectedCallback(vm);
3023
- }
3024
- createChildrenHook(vnode);
3025
- if (vm) {
3026
- appendVM(vm);
3027
- }
3028
- },
3029
- move: function (vnode, parentNode, referenceNode) {
3030
- insertNodeHook(vnode, parentNode, referenceNode);
3031
- },
3032
- remove: function (vnode, parentNode) {
3033
- removeNodeHook(vnode, parentNode);
3034
- var vm = getAssociatedVMIfPresent(vnode.elm);
3035
- if (vm) {
3036
- // for custom elements we don't have to go recursively because the removeVM routine
3037
- // will take care of disconnecting any child VM attached to its shadow as well.
3038
- removeVM(vm);
3039
- }
3040
- }
3041
- };
3042
- function linkNodeToShadow(elm, owner) {
3043
- var renderer = owner.renderer, cmpRoot = owner.cmpRoot; // TODO [#1164]: this should eventually be done by the polyfill directly
3044
- if (renderer.syntheticShadow) {
3045
- elm.$shadowResolver$ = cmpRoot.$shadowResolver$;
3046
- }
3047
- } // TODO [#1136]: this should be done by the compiler, adding ns to every sub-element
3048
- function addNS(vnode) {
3049
- var data = vnode.data, children = vnode.children, sel = vnode.sel;
3050
- data.ns = NamespaceAttributeForSVG; // TODO [#1275]: review why `sel` equal `foreignObject` should get this `ns`
3051
- if (isArray$2(children) && sel !== 'foreignObject') {
3052
- for (var j = 0, n = children.length; j < n; ++j) {
3053
- var childNode = children[j];
3054
- if (childNode != null && childNode.hook === ElementHook) {
3055
- addNS(childNode);
3056
- }
3057
- }
3058
- }
3059
- }
3060
- function addVNodeToChildLWC(vnode) {
3061
- ArrayPush$1.call(getVMBeingRendered().velements, vnode);
3062
- } // [h]tml node
3063
- function h(sel, data, children) {
3064
- var vmBeingRendered = getVMBeingRendered();
3065
- var key = data.key;
3066
- var text, elm;
3067
- var vnode = {
3068
- sel: sel,
3069
- data: data,
3070
- children: children,
3071
- text: text,
3072
- elm: elm,
3073
- key: key,
3074
- hook: ElementHook,
3075
- owner: vmBeingRendered
3076
- };
3077
- if (sel.length === 3 && StringCharCodeAt$1.call(sel, 0) === CHAR_S && StringCharCodeAt$1.call(sel, 1) === CHAR_V && StringCharCodeAt$1.call(sel, 2) === CHAR_G) {
3078
- addNS(vnode);
3079
- }
3080
- return vnode;
3081
- } // [t]ab[i]ndex function
3082
- function ti(value) {
3083
- // if value is greater than 0, we normalize to 0
3084
- // If value is an invalid tabIndex value (null, undefined, string, etc), we let that value pass through
3085
- // If value is less than -1, we don't care
3086
- var shouldNormalize = value > 0 && !(isTrue$1$1(value) || isFalse$1$1(value));
3087
- return shouldNormalize ? 0 : value;
3088
- } // [s]lot element node
3089
- function s(slotName, data, children, slotset) {
3090
- if (!isUndefined$1(slotset) && !isUndefined$1(slotset[slotName]) && slotset[slotName].length !== 0) {
3091
- children = slotset[slotName];
3092
- }
3093
- var vnode = h('slot', data, children);
3094
- if (vnode.owner.renderer.syntheticShadow) {
3095
- // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
3096
- sc(children);
3097
- }
3098
- return vnode;
3099
- } // [c]ustom element node
3100
- function c(sel, Ctor, data, children) {
3101
- if (children === void 0) { children = EmptyArray; }
3102
- var vmBeingRendered = getVMBeingRendered();
3103
- var key = data.key;
3104
- var text, elm;
3105
- var vnode = {
3106
- sel: sel,
3107
- data: data,
3108
- children: children,
3109
- text: text,
3110
- elm: elm,
3111
- key: key,
3112
- hook: CustomElementHook,
3113
- ctor: Ctor,
3114
- owner: vmBeingRendered,
3115
- mode: 'open'
3116
- };
3117
- addVNodeToChildLWC(vnode);
3118
- return vnode;
3119
- } // [i]terable node
3120
- function i(iterable, factory) {
3121
- var list = []; // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
3122
- sc(list);
3123
- if (isUndefined$1(iterable) || iterable === null) {
3124
- return list;
3125
- }
3126
- var iterator = iterable[SymbolIterator]();
3127
- var next = iterator.next();
3128
- var j = 0;
3129
- var value = next.value, last = next.done;
3130
- while (last === false) {
3131
- // implementing a look-back-approach because we need to know if the element is the last
3132
- next = iterator.next();
3133
- last = next.done; // template factory logic based on the previous collected value
3134
- var vnode = factory(value, j, j === 0, last);
3135
- if (isArray$2(vnode)) {
3136
- ArrayPush$1.apply(list, vnode);
3137
- }
3138
- else {
3139
- ArrayPush$1.call(list, vnode);
3140
- }
3141
- j += 1;
3142
- value = next.value;
3143
- }
3144
- return list;
3145
- }
3146
- /**
3147
- * [f]lattening
3148
- */
3149
- function f(items) {
3150
- var len = items.length;
3151
- var flattened = []; // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic
3152
- sc(flattened);
3153
- for (var j = 0; j < len; j += 1) {
3154
- var item = items[j];
3155
- if (isArray$2(item)) {
3156
- ArrayPush$1.apply(flattened, item);
3157
- }
3158
- else {
3159
- ArrayPush$1.call(flattened, item);
3160
- }
3161
- }
3162
- return flattened;
3163
- } // [t]ext node
3164
- function t(text) {
3165
- var data = EmptyObject;
3166
- var sel, children, key, elm;
3167
- return {
3168
- sel: sel,
3169
- data: data,
3170
- children: children,
3171
- text: text,
3172
- elm: elm,
3173
- key: key,
3174
- hook: TextHook,
3175
- owner: getVMBeingRendered()
3176
- };
3177
- } // [d]ynamic value to produce a text vnode
3178
- function d(value) {
3179
- if (value == null) {
3180
- return null;
3181
- }
3182
- return t(value);
3183
- } // [b]ind function
3184
- function b(fn) {
3185
- var vmBeingRendered = getVMBeingRendered();
3186
- if (isNull$1(vmBeingRendered)) {
3187
- throw new Error();
3188
- }
3189
- var vm = vmBeingRendered;
3190
- return function (event) {
3191
- invokeEventListener(vm, fn, vm.component, event);
3192
- };
3193
- } // [k]ey function
3194
- function k(compilerKey, obj) {
3195
- switch (typeof obj) {
3196
- case 'number':
3197
- case 'string':
3198
- return compilerKey + ':' + obj;
3199
- }
3200
- } // [g]lobal [id] function
3201
- function gid(id) {
3202
- var vmBeingRendered = getVMBeingRendered();
3203
- if (isUndefined$1(id) || id === '') {
3204
- return id;
3205
- } // We remove attributes when they are assigned a value of null
3206
- if (isNull$1(id)) {
3207
- return null;
3208
- }
3209
- return id + "-" + vmBeingRendered.idx;
3210
- } // [f]ragment [id] function
3211
- function fid(url) {
3212
- var vmBeingRendered = getVMBeingRendered();
3213
- if (isUndefined$1(url) || url === '') {
3214
- return url;
3215
- } // We remove attributes when they are assigned a value of null
3216
- if (isNull$1(url)) {
3217
- return null;
3218
- } // Apply transformation only for fragment-only-urls
3219
- if (/^#/.test(url)) {
3220
- return url + "-" + vmBeingRendered.idx;
3221
- }
3222
- return url;
3223
- }
3224
- /**
3225
- * Map to store an index value assigned to any dynamic component reference ingested
3226
- * by dc() api. This allows us to generate a unique unique per template per dynamic
3227
- * component reference to avoid diffing algo mismatches.
3228
- */
3229
- var DynamicImportedComponentMap = new Map();
3230
- var dynamicImportedComponentCounter = 0;
3231
- /**
3232
- * create a dynamic component via `<x-foo lwc:dynamic={Ctor}>`
3233
- */
3234
- function dc(sel, Ctor, data, children) {
3235
- if (Ctor == null) {
3236
- return null;
3237
- }
3238
- if (!isComponentConstructor(Ctor)) {
3239
- throw new Error("Invalid LWC Constructor " + toString$1(Ctor) + " for custom element <" + sel + ">.");
3240
- }
3241
- var idx = DynamicImportedComponentMap.get(Ctor);
3242
- if (isUndefined$1(idx)) {
3243
- idx = dynamicImportedComponentCounter++;
3244
- DynamicImportedComponentMap.set(Ctor, idx);
3245
- } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo
3246
- // to identify different constructors as vnodes with different keys to avoid reusing the
3247
- // element used for previous constructors.
3248
- data.key = "dc:" + idx + ":" + data.key;
3249
- return c(sel, Ctor, data, children);
3250
- }
3251
- /**
3252
- * slow children collection marking mechanism. this API allows the compiler to signal
3253
- * to the engine that a particular collection of children must be diffed using the slow
3254
- * algo based on keys due to the nature of the list. E.g.:
3255
- *
3256
- * - slot element's children: the content of the slot has to be dynamic when in synthetic
3257
- * shadow mode because the `vnode.children` might be the slotted
3258
- * content vs default content, in which case the size and the
3259
- * keys are not matching.
3260
- * - children that contain dynamic components
3261
- * - children that are produced by iteration
3262
- *
3263
- */
3264
- function sc(vnodes) {
3265
- // choose to use the snabbdom virtual dom diffing algo instead of our
3266
- // static dummy algo.
3267
- markAsDynamicChildren(vnodes);
3268
- return vnodes;
3269
- }
3270
- var api$1 = /*#__PURE__*/ Object.freeze({
3271
- __proto__: null,
3272
- h: h,
3273
- ti: ti,
3274
- s: s,
3275
- c: c,
3276
- i: i,
3277
- f: f,
3278
- t: t,
3279
- d: d,
3280
- b: b,
3281
- k: k,
3282
- gid: gid,
3283
- fid: fid,
3284
- dc: dc,
3285
- sc: sc
3286
- });
3287
- /*
3288
- * Copyright (c) 2018, salesforce.com, inc.
3289
- * All rights reserved.
3290
- * SPDX-License-Identifier: MIT
3291
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3292
- */
3293
- function createShadowStyleVNode(content) {
3294
- return h('style', {
3295
- key: 'style',
3296
- attrs: {
3297
- type: 'text/css'
3298
- }
3299
- }, [t(content)]);
3300
- }
3301
- function updateSyntheticShadowAttributes(vm, template) {
3302
- var elm = vm.elm, context = vm.context, renderer = vm.renderer;
3303
- var newStylesheets = template.stylesheets, newStylesheetTokens = template.stylesheetTokens;
3304
- var newHostAttribute;
3305
- var newShadowAttribute; // Reset the styling token applied to the host element.
3306
- var oldHostAttribute = context.hostAttribute;
3307
- if (!isUndefined$1(oldHostAttribute)) {
3308
- renderer.removeAttribute(elm, oldHostAttribute);
3309
- } // Apply the new template styling token to the host element, if the new template has any
3310
- // associated stylesheets.
3311
- if (!isUndefined$1(newStylesheetTokens) && !isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3312
- newHostAttribute = newStylesheetTokens.hostAttribute;
3313
- newShadowAttribute = newStylesheetTokens.shadowAttribute;
3314
- renderer.setAttribute(elm, newHostAttribute, '');
3315
- } // Update the styling tokens present on the context object.
3316
- context.hostAttribute = newHostAttribute;
3317
- context.shadowAttribute = newShadowAttribute;
3318
- }
3319
- function evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, nativeShadow) {
3320
- var content = [];
3321
- for (var i_12 = 0; i_12 < stylesheets.length; i_12++) {
3322
- var stylesheet = stylesheets[i_12];
3323
- if (isArray$2(stylesheet)) {
3324
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, hostSelector, shadowSelector, nativeShadow));
3325
- }
3326
- else {
3327
- ArrayPush$1.call(content, stylesheet(hostSelector, shadowSelector, nativeShadow));
3328
- }
3329
- }
3330
- return content;
3331
- }
3332
- function getStylesheetsContent(vm, template) {
3333
- var stylesheets = template.stylesheets, tokens = template.stylesheetTokens;
3334
- var syntheticShadow = vm.renderer.syntheticShadow;
3335
- var content = [];
3336
- if (!isUndefined$1(stylesheets) && !isUndefined$1(tokens)) {
3337
- var hostSelector = syntheticShadow ? "[" + tokens.hostAttribute + "]" : '';
3338
- var shadowSelector = syntheticShadow ? "[" + tokens.shadowAttribute + "]" : '';
3339
- content = evaluateStylesheetsContent(stylesheets, hostSelector, shadowSelector, !syntheticShadow);
3340
- }
3341
- return content;
3342
- }
3343
- function createStylesheet(vm, stylesheets) {
3344
- var renderer = vm.renderer;
3345
- if (renderer.syntheticShadow) {
3346
- for (var i_13 = 0; i_13 < stylesheets.length; i_13++) {
3347
- renderer.insertGlobalStylesheet(stylesheets[i_13]);
3348
- }
3349
- return null;
3350
- }
3351
- else {
3352
- var shadowStyleSheetContent = ArrayJoin$1.call(stylesheets, '\n');
3353
- return createShadowStyleVNode(shadowStyleSheetContent);
3354
- }
3355
- }
3356
- /*
3357
- * Copyright (c) 2018, salesforce.com, inc.
3358
- * All rights reserved.
3359
- * SPDX-License-Identifier: MIT
3360
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3361
- */
3362
- var GlobalMeasurementPhase;
3363
- (function (GlobalMeasurementPhase) {
3364
- GlobalMeasurementPhase["REHYDRATE"] = "lwc-rehydrate";
3365
- GlobalMeasurementPhase["HYDRATE"] = "lwc-hydrate";
3366
- })(GlobalMeasurementPhase || (GlobalMeasurementPhase = {})); // Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.
3367
- // JSDom (used in Jest) for example doesn't implement the UserTiming APIs.
3368
- var isUserTimingSupported = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';
3369
- function getMarkName(phase, vm) {
3370
- // Adding the VM idx to the mark name creates a unique mark name component instance. This is necessary to produce
3371
- // the right measures for components that are recursive.
3372
- return getComponentTag(vm) + " - " + phase + " - " + vm.idx;
3373
- }
3374
- function getMeasureName(phase, vm) {
3375
- return getComponentTag(vm) + " - " + phase;
3376
- }
3377
- function start(markName) {
3378
- performance.mark(markName);
3379
- }
3380
- function end(measureName, markName) {
3381
- performance.measure(measureName, markName); // Clear the created marks and measure to avoid filling the performance entries buffer.
3382
- // Note: Even if the entries get deleted, existing PerformanceObservers preserve a copy of those entries.
3383
- performance.clearMarks(markName);
3384
- performance.clearMarks(measureName);
3385
- }
3386
- function noop$1() {
3387
- /* do nothing */
3388
- }
3389
- var startMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3390
- var markName = getMarkName(phase, vm);
3391
- start(markName);
3392
- };
3393
- var endMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3394
- var markName = getMarkName(phase, vm);
3395
- var measureName = getMeasureName(phase, vm);
3396
- end(measureName, markName);
3397
- };
3398
- var startGlobalMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3399
- var markName = isUndefined$1(vm) ? phase : getMarkName(phase, vm);
3400
- start(markName);
3401
- };
3402
- var endGlobalMeasure = !isUserTimingSupported ? noop$1 : function (phase, vm) {
3403
- var markName = isUndefined$1(vm) ? phase : getMarkName(phase, vm);
3404
- end(phase, markName);
3405
- };
3406
- /*
3407
- * Copyright (c) 2018, salesforce.com, inc.
3408
- * All rights reserved.
3409
- * SPDX-License-Identifier: MIT
3410
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3411
- */
3412
- function noop$2(_opId, _phase, _cmpName, _vm_idx) { }
3413
- var logOperation = noop$2;
3414
- var OperationId;
3415
- (function (OperationId) {
3416
- OperationId[OperationId["constructor"] = 0] = "constructor";
3417
- OperationId[OperationId["render"] = 1] = "render";
3418
- OperationId[OperationId["patch"] = 2] = "patch";
3419
- OperationId[OperationId["connectedCallback"] = 3] = "connectedCallback";
3420
- OperationId[OperationId["renderedCallback"] = 4] = "renderedCallback";
3421
- OperationId[OperationId["disconnectedCallback"] = 5] = "disconnectedCallback";
3422
- OperationId[OperationId["errorCallback"] = 6] = "errorCallback";
3423
- })(OperationId || (OperationId = {}));
3424
- var Phase;
3425
- (function (Phase) {
3426
- Phase[Phase["Start"] = 0] = "Start";
3427
- Phase[Phase["Stop"] = 1] = "Stop";
3428
- })(Phase || (Phase = {}));
3429
- var opIdToMeasurementPhaseMappingArray = ['constructor', 'render', 'patch', 'connectedCallback', 'renderedCallback', 'disconnectedCallback', 'errorCallback'];
3430
- var profilerEnabled = false;
3431
- var logMarks = false;
3432
- var bufferLogging = false;
3433
- var profilerStateCallbacks = [];
3434
- function trackProfilerState(callback) {
3435
- callback(profilerEnabled);
3436
- profilerStateCallbacks.push(callback);
3437
- }
3438
- function logOperationStart(opId, vm) {
3439
- if (logMarks) {
3440
- startMeasure(opIdToMeasurementPhaseMappingArray[opId], vm);
3441
- }
3442
- if (bufferLogging) {
3443
- logOperation(opId, Phase.Start, vm.tagName, vm.idx);
3444
- }
3445
- }
3446
- function logOperationEnd(opId, vm) {
3447
- if (logMarks) {
3448
- endMeasure(opIdToMeasurementPhaseMappingArray[opId], vm);
3449
- }
3450
- if (bufferLogging) {
3451
- logOperation(opId, Phase.Stop, vm.tagName, vm.idx);
3452
- }
3453
- }
3454
- function enableProfiler() {
3455
- profilerEnabled = true;
3456
- bufferLogging = true;
3457
- notifyProfilerStateChange();
3458
- }
3459
- function disableProfiler() {
3460
- {
3461
- profilerEnabled = false;
3462
- bufferLogging = false;
3463
- logMarks = false;
3464
- }
3465
- notifyProfilerStateChange();
3466
- }
3467
- function notifyProfilerStateChange() {
3468
- for (var i_14 = 0; i_14 < profilerStateCallbacks.length; i_14++) {
3469
- profilerStateCallbacks[i_14](profilerEnabled);
3470
- }
3471
- }
3472
- function attachDispatcher(dispatcher) {
3473
- logOperation = dispatcher;
3474
- bufferLogging = true;
3475
- }
3476
- function detachDispatcher() {
3477
- var currentLogOperation = logOperation;
3478
- logOperation = noop$2;
3479
- bufferLogging = false;
3480
- return currentLogOperation;
3481
- }
3482
- var profilerControl = {
3483
- enableProfiler: enableProfiler,
3484
- disableProfiler: disableProfiler,
3485
- attachDispatcher: attachDispatcher,
3486
- detachDispatcher: detachDispatcher
3487
- };
3488
- /*
3489
- * Copyright (c) 2018, salesforce.com, inc.
3490
- * All rights reserved.
3491
- * SPDX-License-Identifier: MIT
3492
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3493
- */
3494
- var isUpdatingTemplate = false;
3495
- var vmBeingRendered = null;
3496
- function getVMBeingRendered() {
3497
- return vmBeingRendered;
3498
- }
3499
- function setVMBeingRendered(vm) {
3500
- vmBeingRendered = vm;
3501
- }
3502
- var profilerEnabled$1 = false;
3503
- trackProfilerState(function (t) { return profilerEnabled$1 = t; });
3504
- function validateSlots(vm, html) {
3505
- {
3506
- // this method should never leak to prod
3507
- throw new ReferenceError();
3508
- }
3509
- }
3510
- function evaluateTemplate(vm, html) {
3511
- var isUpdatingTemplateInception = isUpdatingTemplate;
3512
- var vmOfTemplateBeingUpdatedInception = vmBeingRendered;
3513
- var vnodes = [];
3514
- runWithBoundaryProtection(vm, vm.owner, function () {
3515
- // pre
3516
- vmBeingRendered = vm;
3517
- if (profilerEnabled$1) {
3518
- logOperationStart(OperationId.render, vm);
3519
- }
3520
- }, function () {
3521
- // job
3522
- var component = vm.component, context = vm.context, cmpSlots = vm.cmpSlots, cmpTemplate = vm.cmpTemplate, tro = vm.tro, renderer = vm.renderer;
3523
- tro.observe(function () {
3524
- // Reset the cache memoizer for template when needed.
3525
- if (html !== cmpTemplate) {
3526
- // Perf opt: do not reset the shadow root during the first rendering (there is
3527
- // nothing to reset).
3528
- if (!isNull$1(cmpTemplate)) {
3529
- // It is important to reset the content to avoid reusing similar elements
3530
- // generated from a different template, because they could have similar IDs,
3531
- // and snabbdom just rely on the IDs.
3532
- resetShadowRoot(vm);
3533
- } // Check that the template was built by the compiler.
3534
- if (!isTemplateRegistered(html)) {
3535
- throw new TypeError("Invalid template returned by the render() method on " + vm + ". It must return an imported template (e.g.: `import html from \"./" + vm.def.name + ".html\"`), instead, it has returned: " + toString$1(html) + ".");
3536
- }
3537
- vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.
3538
- context.tplCache = create$1(null); // Update the synthetic shadow attributes on the host element if necessary.
3539
- if (renderer.syntheticShadow) {
3540
- updateSyntheticShadowAttributes(vm, html);
3541
- } // Evaluate, create stylesheet and cache the produced VNode for future
3542
- // re-rendering.
3543
- var stylesheetsContent = getStylesheetsContent(vm, html);
3544
- context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);
3545
- }
3546
- if ("production" !== 'production') ; // right before producing the vnodes, we clear up all internal references
3547
- // to custom elements from the template.
3548
- vm.velements = []; // Set the global flag that template is being updated
3549
- isUpdatingTemplate = true;
3550
- vnodes = html.call(undefined, api$1, component, cmpSlots, context.tplCache);
3551
- var styleVNode = context.styleVNode;
3552
- if (!isNull$1(styleVNode)) {
3553
- ArrayUnshift$2.call(vnodes, styleVNode);
3554
- }
3555
- });
3556
- }, function () {
3557
- // post
3558
- isUpdatingTemplate = isUpdatingTemplateInception;
3559
- vmBeingRendered = vmOfTemplateBeingUpdatedInception;
3560
- if (profilerEnabled$1) {
3561
- logOperationEnd(OperationId.render, vm);
3562
- }
3563
- });
3564
- return vnodes;
3565
- }
3566
- /*
3567
- * Copyright (c) 2018, salesforce.com, inc.
3568
- * All rights reserved.
3569
- * SPDX-License-Identifier: MIT
3570
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3571
- */
3572
- function addErrorComponentStack(vm, error) {
3573
- if (!isFrozen$1(error) && isUndefined$1(error.wcStack)) {
3574
- var wcStack_1 = getErrorComponentStack(vm);
3575
- defineProperty$1(error, 'wcStack', {
3576
- get: function () {
3577
- return wcStack_1;
3578
- }
3579
- });
3580
- }
3581
- }
3582
- var vmBeingConstructed = null;
3583
- function isBeingConstructed(vm) {
3584
- return vmBeingConstructed === vm;
3585
- }
3586
- var profilerEnabled$2 = false;
3587
- trackProfilerState(function (t) { return profilerEnabled$2 = t; });
3588
- var noop$3 = function () { return void 0; };
3589
- function invokeComponentCallback(vm, fn, args) {
3590
- var component = vm.component, callHook = vm.callHook, owner = vm.owner;
3591
- var result;
3592
- runWithBoundaryProtection(vm, owner, noop$3, function () {
3593
- // job
3594
- result = callHook(component, fn, args);
3595
- }, noop$3);
3596
- return result;
3597
- }
3598
- function invokeComponentConstructor(vm, Ctor) {
3599
- var vmBeingConstructedInception = vmBeingConstructed;
3600
- var error;
3601
- if (profilerEnabled$2) {
3602
- logOperationStart(OperationId.constructor, vm);
3603
- }
3604
- vmBeingConstructed = vm;
3605
- /**
3606
- * Constructors don't need to be wrapped with a boundary because for root elements
3607
- * it should throw, while elements from template are already wrapped by a boundary
3608
- * associated to the diffing algo.
3609
- */
3610
- try {
3611
- // job
3612
- var result = new Ctor(); // Check indirectly if the constructor result is an instance of LightningElement. Using
3613
- // the "instanceof" operator would not work here since Locker Service provides its own
3614
- // implementation of LightningElement, so we indirectly check if the base constructor is
3615
- // invoked by accessing the component on the vm.
3616
- if (vmBeingConstructed.component !== result) {
3617
- throw new TypeError('Invalid component constructor, the class should extend LightningElement.');
3618
- }
3619
- }
3620
- catch (e) {
3621
- error = Object(e);
3622
- }
3623
- finally {
3624
- if (profilerEnabled$2) {
3625
- logOperationEnd(OperationId.constructor, vm);
3626
- }
3627
- vmBeingConstructed = vmBeingConstructedInception;
3628
- if (!isUndefined$1(error)) {
3629
- addErrorComponentStack(vm, error); // re-throwing the original error annotated after restoring the context
3630
- throw error; // eslint-disable-line no-unsafe-finally
3631
- }
3632
- }
3633
- }
3634
- function invokeComponentRenderMethod(vm) {
3635
- var render = vm.def.render, callHook = vm.callHook, component = vm.component, owner = vm.owner;
3636
- var vmBeingRenderedInception = getVMBeingRendered();
3637
- var html;
3638
- var renderInvocationSuccessful = false;
3639
- runWithBoundaryProtection(vm, owner, function () {
3640
- setVMBeingRendered(vm);
3641
- }, function () {
3642
- // job
3643
- vm.tro.observe(function () {
3644
- html = callHook(component, render);
3645
- renderInvocationSuccessful = true;
3646
- });
3647
- }, function () {
3648
- setVMBeingRendered(vmBeingRenderedInception);
3649
- }); // If render() invocation failed, process errorCallback in boundary and return an empty template
3650
- return renderInvocationSuccessful ? evaluateTemplate(vm, html) : [];
3651
- }
3652
- function invokeComponentRenderedCallback(vm) {
3653
- var renderedCallback = vm.def.renderedCallback, component = vm.component, callHook = vm.callHook, owner = vm.owner;
3654
- if (!isUndefined$1(renderedCallback)) {
3655
- runWithBoundaryProtection(vm, owner, function () {
3656
- if (profilerEnabled$2) {
3657
- logOperationStart(OperationId.renderedCallback, vm);
3658
- }
3659
- }, function () {
3660
- // job
3661
- callHook(component, renderedCallback);
3662
- }, function () {
3663
- // post
3664
- if (profilerEnabled$2) {
3665
- logOperationEnd(OperationId.renderedCallback, vm);
3666
- }
3667
- });
3668
- }
3669
- }
3670
- function invokeEventListener(vm, fn, thisValue, event) {
3671
- var callHook = vm.callHook, owner = vm.owner;
3672
- runWithBoundaryProtection(vm, owner, noop$3, function () {
3673
- // job
3674
- if ("production" !== 'production') ;
3675
- callHook(thisValue, fn, [event]);
3676
- }, noop$3);
3677
- }
3678
- /*
3679
- * Copyright (c) 2018, salesforce.com, inc.
3680
- * All rights reserved.
3681
- * SPDX-License-Identifier: MIT
3682
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3683
- */
3684
- var signedTemplateMap = new Map();
3685
- /**
3686
- * INTERNAL: This function can only be invoked by compiled code. The compiler
3687
- * will prevent this function from being imported by userland code.
3688
- */
3689
- function registerComponent(Ctor, _b) {
3690
- var tmpl = _b.tmpl;
3691
- signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,
3692
- // without too much transformation
3693
- return Ctor;
3694
- }
3695
- function getComponentRegisteredTemplate(Ctor) {
3696
- return signedTemplateMap.get(Ctor);
3697
- }
3698
- function createComponent(vm, Ctor) {
3699
- // create the component instance
3700
- invokeComponentConstructor(vm, Ctor);
3701
- if (isUndefined$1(vm.component)) {
3702
- throw new ReferenceError("Invalid construction for " + Ctor + ", you must extend LightningElement.");
3703
- }
3704
- }
3705
- function getTemplateReactiveObserver(vm) {
3706
- return new ReactiveObserver(function () {
3707
- var isDirty = vm.isDirty;
3708
- if (isFalse$1$1(isDirty)) {
3709
- markComponentAsDirty(vm);
3710
- scheduleRehydration(vm);
3711
- }
3712
- });
3713
- }
3714
- function renderComponent(vm) {
3715
- vm.tro.reset();
3716
- var vnodes = invokeComponentRenderMethod(vm);
3717
- vm.isDirty = false;
3718
- vm.isScheduled = false;
3719
- return vnodes;
3720
- }
3721
- function markComponentAsDirty(vm) {
3722
- vm.isDirty = true;
3723
- }
3724
- var cmpEventListenerMap = new WeakMap();
3725
- function getWrappedComponentsListener(vm, listener) {
3726
- if (!isFunction$1(listener)) {
3727
- throw new TypeError(); // avoiding problems with non-valid listeners
3728
- }
3729
- var wrappedListener = cmpEventListenerMap.get(listener);
3730
- if (isUndefined$1(wrappedListener)) {
3731
- wrappedListener = function (event) {
3732
- invokeEventListener(vm, listener, undefined, event);
3733
- };
3734
- cmpEventListenerMap.set(listener, wrappedListener);
3735
- }
3736
- return wrappedListener;
3737
- }
3738
- /*
3739
- * Copyright (c) 2018, salesforce.com, inc.
3740
- * All rights reserved.
3741
- * SPDX-License-Identifier: MIT
3742
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3743
- */
3744
- var Services = create$1(null);
3745
- var hooks = ['rendered', 'connected', 'disconnected'];
3746
- /**
3747
- * EXPERIMENTAL: This function allows for the registration of "services"
3748
- * in LWC by exposing hooks into the component life-cycle. This API is
3749
- * subject to change or being removed.
3750
- */
3751
- function register(service) {
3752
- for (var i_15 = 0; i_15 < hooks.length; ++i_15) {
3753
- var hookName = hooks[i_15];
3754
- if (hookName in service) {
3755
- var l = Services[hookName];
3756
- if (isUndefined$1(l)) {
3757
- Services[hookName] = l = [];
3758
- }
3759
- ArrayPush$1.call(l, service[hookName]);
3760
- }
3761
- }
3762
- }
3763
- function invokeServiceHook(vm, cbs) {
3764
- var component = vm.component, def = vm.def, context = vm.context;
3765
- for (var i_16 = 0, len = cbs.length; i_16 < len; ++i_16) {
3766
- cbs[i_16].call(undefined, component, {}, def, context);
3767
- }
3768
- }
3769
- /*
3770
- * Copyright (c) 2018, salesforce.com, inc.
3771
- * All rights reserved.
3772
- * SPDX-License-Identifier: MIT
3773
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3774
- */
3775
- var VMState;
3776
- (function (VMState) {
3777
- VMState[VMState["created"] = 0] = "created";
3778
- VMState[VMState["connected"] = 1] = "connected";
3779
- VMState[VMState["disconnected"] = 2] = "disconnected";
3780
- })(VMState || (VMState = {}));
3781
- var profilerEnabled$3 = false;
3782
- trackProfilerState(function (t) { return profilerEnabled$3 = t; });
3783
- var idx = 0;
3784
- /** The internal slot used to associate different objects the engine manipulates with the VM */
3785
- var ViewModelReflection = createHiddenField$1('ViewModel', 'engine');
3786
- function callHook(cmp, fn, args) {
3787
- if (args === void 0) { args = []; }
3788
- return fn.apply(cmp, args);
3789
- }
3790
- function setHook(cmp, prop, newValue) {
3791
- cmp[prop] = newValue;
3792
- }
3793
- function getHook(cmp, prop) {
3794
- return cmp[prop];
3795
- }
3796
- function rerenderVM(vm) {
3797
- rehydrate(vm);
3798
- }
3799
- function connectRootElement(elm) {
3800
- var vm = getAssociatedVM(elm);
3801
- startGlobalMeasure(GlobalMeasurementPhase.HYDRATE, vm); // Usually means moving the element from one place to another, which is observable via
3802
- // life-cycle hooks.
3803
- if (vm.state === VMState.connected) {
3804
- disconnectRootElement(elm);
3805
- }
3806
- runConnectedCallback(vm);
3807
- rehydrate(vm);
3808
- endGlobalMeasure(GlobalMeasurementPhase.HYDRATE, vm);
3809
- }
3810
- function disconnectRootElement(elm) {
3811
- var vm = getAssociatedVM(elm);
3812
- resetComponentStateWhenRemoved(vm);
3813
- }
3814
- function appendVM(vm) {
3815
- rehydrate(vm);
3816
- } // just in case the component comes back, with this we guarantee re-rendering it
3817
- // while preventing any attempt to rehydration until after reinsertion.
3818
- function resetComponentStateWhenRemoved(vm) {
3819
- var state = vm.state;
3820
- if (state !== VMState.disconnected) {
3821
- var oar = vm.oar, tro = vm.tro; // Making sure that any observing record will not trigger the rehydrated on this vm
3822
- tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked
3823
- for (var key in oar) {
3824
- oar[key].reset();
3825
- }
3826
- runDisconnectedCallback(vm); // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
3827
- runShadowChildNodesDisconnectedCallback(vm);
3828
- runLightChildNodesDisconnectedCallback(vm);
3829
- }
3830
- } // this method is triggered by the diffing algo only when a vnode from the
3831
- // old vnode.children is removed from the DOM.
3832
- function removeVM(vm) {
3833
- resetComponentStateWhenRemoved(vm);
3834
- }
3835
- function createVM(elm, def, options) {
3836
- var mode = options.mode, owner = options.owner, renderer = options.renderer, tagName = options.tagName;
3837
- var vm = {
3838
- elm: elm,
3839
- def: def,
3840
- idx: idx++,
3841
- state: VMState.created,
3842
- isScheduled: false,
3843
- isDirty: true,
3844
- tagName: tagName,
3845
- mode: mode,
3846
- owner: owner,
3847
- renderer: renderer,
3848
- children: EmptyArray,
3849
- aChildren: EmptyArray,
3850
- velements: EmptyArray,
3851
- cmpProps: create$1(null),
3852
- cmpFields: create$1(null),
3853
- cmpSlots: create$1(null),
3854
- oar: create$1(null),
3855
- cmpTemplate: null,
3856
- context: {
3857
- hostAttribute: undefined,
3858
- shadowAttribute: undefined,
3859
- styleVNode: null,
3860
- tplCache: EmptyObject,
3861
- wiredConnecting: EmptyArray,
3862
- wiredDisconnecting: EmptyArray
3863
- },
3864
- tro: null,
3865
- component: null,
3866
- cmpRoot: null,
3867
- callHook: callHook,
3868
- setHook: setHook,
3869
- getHook: getHook
3870
- };
3871
- vm.tro = getTemplateReactiveObserver(vm);
3872
- createComponent(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
3873
- if (isFalse$1$1(renderer.ssr) && hasWireAdapters(vm)) {
3874
- installWireAdapters(vm);
3875
- }
3876
- return vm;
3877
- }
3878
- function associateVM(obj, vm) {
3879
- setHiddenField$1(obj, ViewModelReflection, vm);
3880
- }
3881
- function getAssociatedVM(obj) {
3882
- var vm = getHiddenField$1(obj, ViewModelReflection);
3883
- return vm;
3884
- }
3885
- function getAssociatedVMIfPresent(obj) {
3886
- var maybeVm = getHiddenField$1(obj, ViewModelReflection);
3887
- return maybeVm;
3888
- }
3889
- function rehydrate(vm) {
3890
- if (isTrue$1$1(vm.isDirty)) {
3891
- var children = renderComponent(vm);
3892
- patchShadowRoot(vm, children);
3893
- }
3894
- }
3895
- function patchShadowRoot(vm, newCh) {
3896
- var cmpRoot = vm.cmpRoot, oldCh = vm.children; // caching the new children collection
3897
- vm.children = newCh;
3898
- if (newCh.length > 0 || oldCh.length > 0) {
3899
- // patch function mutates vnodes by adding the element reference,
3900
- // however, if patching fails it contains partial changes.
3901
- if (oldCh !== newCh) {
3902
- var fn_1 = hasDynamicChildren(newCh) ? updateDynamicChildren : updateStaticChildren;
3903
- runWithBoundaryProtection(vm, vm, function () {
3904
- // pre
3905
- if (profilerEnabled$3) {
3906
- logOperationStart(OperationId.patch, vm);
3907
- }
3908
- }, function () {
3909
- // job
3910
- fn_1(cmpRoot, oldCh, newCh);
3911
- }, function () {
3912
- // post
3913
- if (profilerEnabled$3) {
3914
- logOperationEnd(OperationId.patch, vm);
3915
- }
3916
- });
3917
- }
3918
- }
3919
- if (vm.state === VMState.connected) {
3920
- // If the element is connected, that means connectedCallback was already issued, and
3921
- // any successive rendering should finish with the call to renderedCallback, otherwise
3922
- // the connectedCallback will take care of calling it in the right order at the end of
3923
- // the current rehydration process.
3924
- runRenderedCallback(vm);
3925
- }
3926
- }
3927
- function runRenderedCallback(vm) {
3928
- if (isTrue$1$1(vm.renderer.ssr)) {
3929
- return;
3930
- }
3931
- var rendered = Services.rendered;
3932
- if (rendered) {
3933
- invokeServiceHook(vm, rendered);
3934
- }
3935
- invokeComponentRenderedCallback(vm);
3936
- }
3937
- var rehydrateQueue = [];
3938
- function flushRehydrationQueue() {
3939
- startGlobalMeasure(GlobalMeasurementPhase.REHYDRATE);
3940
- var vms = rehydrateQueue.sort(function (a, b) { return a.idx - b.idx; });
3941
- rehydrateQueue = []; // reset to a new queue
3942
- for (var i_17 = 0, len = vms.length; i_17 < len; i_17 += 1) {
3943
- var vm = vms[i_17];
3944
- try {
3945
- rehydrate(vm);
3946
- }
3947
- catch (error) {
3948
- if (i_17 + 1 < len) {
3949
- // pieces of the queue are still pending to be rehydrated, those should have priority
3950
- if (rehydrateQueue.length === 0) {
3951
- addCallbackToNextTick(flushRehydrationQueue);
3952
- }
3953
- ArrayUnshift$2.apply(rehydrateQueue, ArraySlice$2.call(vms, i_17 + 1));
3954
- } // we need to end the measure before throwing.
3955
- endGlobalMeasure(GlobalMeasurementPhase.REHYDRATE); // re-throwing the original error will break the current tick, but since the next tick is
3956
- // already scheduled, it should continue patching the rest.
3957
- throw error; // eslint-disable-line no-unsafe-finally
3958
- }
3959
- }
3960
- endGlobalMeasure(GlobalMeasurementPhase.REHYDRATE);
3961
- }
3962
- function runConnectedCallback(vm) {
3963
- var state = vm.state;
3964
- if (state === VMState.connected) {
3965
- return; // nothing to do since it was already connected
3966
- }
3967
- vm.state = VMState.connected; // reporting connection
3968
- var connected = Services.connected;
3969
- if (connected) {
3970
- invokeServiceHook(vm, connected);
3971
- }
3972
- if (hasWireAdapters(vm)) {
3973
- connectWireAdapters(vm);
3974
- }
3975
- var connectedCallback = vm.def.connectedCallback;
3976
- if (!isUndefined$1(connectedCallback)) {
3977
- if (profilerEnabled$3) {
3978
- logOperationStart(OperationId.connectedCallback, vm);
3979
- }
3980
- invokeComponentCallback(vm, connectedCallback);
3981
- if (profilerEnabled$3) {
3982
- logOperationEnd(OperationId.connectedCallback, vm);
3983
- }
3984
- }
3985
- }
3986
- function hasWireAdapters(vm) {
3987
- return getOwnPropertyNames$1(vm.def.wire).length > 0;
3988
- }
3989
- function runDisconnectedCallback(vm) {
3990
- if (isFalse$1$1(vm.isDirty)) {
3991
- // this guarantees that if the component is reused/reinserted,
3992
- // it will be re-rendered because we are disconnecting the reactivity
3993
- // linking, so mutations are not automatically reflected on the state
3994
- // of disconnected components.
3995
- vm.isDirty = true;
3996
- }
3997
- vm.state = VMState.disconnected; // reporting disconnection
3998
- var disconnected = Services.disconnected;
3999
- if (disconnected) {
4000
- invokeServiceHook(vm, disconnected);
4001
- }
4002
- if (hasWireAdapters(vm)) {
4003
- disconnectWireAdapters(vm);
4004
- }
4005
- var disconnectedCallback = vm.def.disconnectedCallback;
4006
- if (!isUndefined$1(disconnectedCallback)) {
4007
- if (profilerEnabled$3) {
4008
- logOperationStart(OperationId.disconnectedCallback, vm);
4009
- }
4010
- invokeComponentCallback(vm, disconnectedCallback);
4011
- if (profilerEnabled$3) {
4012
- logOperationEnd(OperationId.disconnectedCallback, vm);
4013
- }
4014
- }
4015
- }
4016
- function runShadowChildNodesDisconnectedCallback(vm) {
4017
- var vCustomElementCollection = vm.velements; // Reporting disconnection for every child in inverse order since they are
4018
- // inserted in reserved order.
4019
- for (var i_18 = vCustomElementCollection.length - 1; i_18 >= 0; i_18 -= 1) {
4020
- var elm = vCustomElementCollection[i_18].elm; // There are two cases where the element could be undefined:
4021
- // * when there is an error during the construction phase, and an error
4022
- // boundary picks it, there is a possibility that the VCustomElement
4023
- // is not properly initialized, and therefore is should be ignored.
4024
- // * when slotted custom element is not used by the element where it is
4025
- // slotted into it, as a result, the custom element was never
4026
- // initialized.
4027
- if (!isUndefined$1(elm)) {
4028
- var childVM = getAssociatedVMIfPresent(elm); // The VM associated with the element might be associated undefined
4029
- // in the case where the VM failed in the middle of its creation,
4030
- // eg: constructor throwing before invoking super().
4031
- if (!isUndefined$1(childVM)) {
4032
- resetComponentStateWhenRemoved(childVM);
4033
- }
4034
- }
4035
- }
4036
- }
4037
- function runLightChildNodesDisconnectedCallback(vm) {
4038
- var adoptedChildren = vm.aChildren;
4039
- recursivelyDisconnectChildren(adoptedChildren);
4040
- }
4041
- /**
4042
- * The recursion doesn't need to be a complete traversal of the vnode graph,
4043
- * instead it can be partial, when a custom element vnode is found, we don't
4044
- * need to continue into its children because by attempting to disconnect the
4045
- * custom element itself will trigger the removal of anything slotted or anything
4046
- * defined on its shadow.
4047
- */
4048
- function recursivelyDisconnectChildren(vnodes) {
4049
- for (var i_19 = 0, len = vnodes.length; i_19 < len; i_19 += 1) {
4050
- var vnode = vnodes[i_19];
4051
- if (!isNull$1(vnode) && isArray$2(vnode.children) && !isUndefined$1(vnode.elm)) {
4052
- // vnode is a VElement with children
4053
- if (isUndefined$1(vnode.ctor)) {
4054
- // it is a VElement, just keep looking (recursively)
4055
- recursivelyDisconnectChildren(vnode.children);
4056
- }
4057
- else {
4058
- // it is a VCustomElement, disconnect it and ignore its children
4059
- resetComponentStateWhenRemoved(getAssociatedVM(vnode.elm));
4060
- }
4061
- }
4062
- }
4063
- } // This is a super optimized mechanism to remove the content of the shadowRoot without having to go
4064
- // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
4065
- // children VNodes might not be representing the current state of the DOM.
4066
- function resetShadowRoot(vm) {
4067
- var children = vm.children, cmpRoot = vm.cmpRoot, renderer = vm.renderer;
4068
- for (var i_20 = 0, len = children.length; i_20 < len; i_20++) {
4069
- var child = children[i_20];
4070
- if (!isNull$1(child) && !isUndefined$1(child.elm)) {
4071
- renderer.remove(child.elm, cmpRoot);
4072
- }
4073
- }
4074
- vm.children = EmptyArray;
4075
- runShadowChildNodesDisconnectedCallback(vm);
4076
- vm.velements = EmptyArray;
4077
- }
4078
- function scheduleRehydration(vm) {
4079
- if (isTrue$1$1(vm.renderer.ssr) || isTrue$1$1(vm.isScheduled)) {
4080
- return;
4081
- }
4082
- vm.isScheduled = true;
4083
- if (rehydrateQueue.length === 0) {
4084
- addCallbackToNextTick(flushRehydrationQueue);
4085
- }
4086
- ArrayPush$1.call(rehydrateQueue, vm);
4087
- }
4088
- function getErrorBoundaryVM(vm) {
4089
- var currentVm = vm;
4090
- while (!isNull$1(currentVm)) {
4091
- if (!isUndefined$1(currentVm.def.errorCallback)) {
4092
- return currentVm;
4093
- }
4094
- currentVm = currentVm.owner;
4095
- }
4096
- } // slow path routine
4097
- // NOTE: we should probably more this routine to the synthetic shadow folder
4098
- // and get the allocation to be cached by in the elm instead of in the VM
4099
- function allocateInSlot(vm, children) {
4100
- var oldSlots = vm.cmpSlots;
4101
- var cmpSlots = vm.cmpSlots = create$1(null);
4102
- for (var i_21 = 0, len = children.length; i_21 < len; i_21 += 1) {
4103
- var vnode = children[i_21];
4104
- if (isNull$1(vnode)) {
4105
- continue;
4106
- }
4107
- var data = vnode.data;
4108
- var slotName = data.attrs && data.attrs.slot || '';
4109
- var vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot
4110
- // which might have similar keys. Each vnode will always have a key that
4111
- // starts with a numeric character from compiler. In this case, we add a unique
4112
- // notation for slotted vnodes keys, e.g.: `@foo:1:1`
4113
- if (!isUndefined$1(vnode.key)) {
4114
- vnode.key = "@" + slotName + ":" + vnode.key;
4115
- }
4116
- ArrayPush$1.call(vnodes, vnode);
4117
- }
4118
- if (isFalse$1$1(vm.isDirty)) {
4119
- // We need to determine if the old allocation is really different from the new one
4120
- // and mark the vm as dirty
4121
- var oldKeys = keys$1(oldSlots);
4122
- if (oldKeys.length !== keys$1(cmpSlots).length) {
4123
- markComponentAsDirty(vm);
4124
- return;
4125
- }
4126
- for (var i_22 = 0, len = oldKeys.length; i_22 < len; i_22 += 1) {
4127
- var key = oldKeys[i_22];
4128
- if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
4129
- markComponentAsDirty(vm);
4130
- return;
4131
- }
4132
- var oldVNodes = oldSlots[key];
4133
- var vnodes = cmpSlots[key];
4134
- for (var j = 0, a = cmpSlots[key].length; j < a; j += 1) {
4135
- if (oldVNodes[j] !== vnodes[j]) {
4136
- markComponentAsDirty(vm);
4137
- return;
4138
- }
4139
- }
4140
- }
4141
- }
4142
- }
4143
- function runWithBoundaryProtection(vm, owner, pre, job, post) {
4144
- var error;
4145
- pre();
4146
- try {
4147
- job();
4148
- }
4149
- catch (e) {
4150
- error = Object(e);
4151
- }
4152
- finally {
4153
- post();
4154
- if (!isUndefined$1(error)) {
4155
- addErrorComponentStack(vm, error);
4156
- var errorBoundaryVm = isNull$1(owner) ? undefined : getErrorBoundaryVM(owner);
4157
- if (isUndefined$1(errorBoundaryVm)) {
4158
- throw error; // eslint-disable-line no-unsafe-finally
4159
- }
4160
- resetShadowRoot(vm); // remove offenders
4161
- if (profilerEnabled$3) {
4162
- logOperationStart(OperationId.errorCallback, vm);
4163
- } // error boundaries must have an ErrorCallback
4164
- var errorCallback = errorBoundaryVm.def.errorCallback;
4165
- invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
4166
- if (profilerEnabled$3) {
4167
- logOperationEnd(OperationId.errorCallback, vm);
4168
- }
4169
- }
4170
- }
4171
- }
4172
- /*
4173
- * Copyright (c) 2018, salesforce.com, inc.
4174
- * All rights reserved.
4175
- * SPDX-License-Identifier: MIT
4176
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4177
- */
4178
- var DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
4179
- var DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
4180
- var WireMetaMap = new Map();
4181
- function noop$4() { }
4182
- var WireContextRegistrationEvent = /** @class */ (function (_super) {
4183
- __extends(WireContextRegistrationEvent, _super);
4184
- function WireContextRegistrationEvent(adapterToken, _b) {
4185
- var setNewContext = _b.setNewContext, setDisconnectedCallback = _b.setDisconnectedCallback;
4186
- var _this = _super.call(this, adapterToken, {
4187
- bubbles: true,
4188
- composed: true
4189
- }) || this;
4190
- defineProperties$1(_this, {
4191
- setNewContext: {
4192
- value: setNewContext
4193
- },
4194
- setDisconnectedCallback: {
4195
- value: setDisconnectedCallback
4196
- }
4197
- });
4198
- return _this;
4199
- }
4200
- return WireContextRegistrationEvent;
4201
- }(CustomEvent));
4202
- function createFieldDataCallback(vm, name) {
4203
- var cmpFields = vm.cmpFields;
4204
- return function (value) {
4205
- if (value !== vm.cmpFields[name]) {
4206
- // storing the value in the underlying storage
4207
- cmpFields[name] = value;
4208
- componentValueMutated(vm, name);
4209
- }
4210
- };
4211
- }
4212
- function createMethodDataCallback(vm, method) {
4213
- return function (value) {
4214
- // dispatching new value into the wired method
4215
- runWithBoundaryProtection(vm, vm.owner, noop$4, function () {
4216
- // job
4217
- method.call(vm.component, value);
4218
- }, noop$4);
4219
- };
4220
- }
4221
- function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
4222
- var hasPendingConfig = false; // creating the reactive observer for reactive params when needed
4223
- var ro = new ReactiveObserver(function () {
4224
- if (hasPendingConfig === false) {
4225
- hasPendingConfig = true; // collect new config in the micro-task
4226
- Promise.resolve().then(function () {
4227
- hasPendingConfig = false; // resetting current reactive params
4228
- ro.reset(); // dispatching a new config due to a change in the configuration
4229
- computeConfigAndUpdate();
4230
- });
4231
- }
4232
- });
4233
- var computeConfigAndUpdate = function () {
4234
- var config;
4235
- ro.observe(function () { return config = configCallback(component); }); // eslint-disable-next-line lwc-internal/no-invalid-todo
4236
- // TODO: dev-mode validation of config based on the adapter.configSchema
4237
- // @ts-ignore it is assigned in the observe() callback
4238
- callbackWhenConfigIsReady(config);
4239
- };
4240
- return {
4241
- computeConfigAndUpdate: computeConfigAndUpdate,
4242
- ro: ro
4243
- };
4244
- }
4245
- function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
4246
- var adapter = wireDef.adapter;
4247
- var adapterContextToken = getAdapterToken(adapter);
4248
- if (isUndefined$1(adapterContextToken)) {
4249
- return; // no provider found, nothing to be done
4250
- }
4251
- var elm = vm.elm, renderer = vm.renderer, _b = vm.context, wiredConnecting = _b.wiredConnecting, wiredDisconnecting = _b.wiredDisconnecting; // waiting for the component to be connected to formally request the context via the token
4252
- ArrayPush$1.call(wiredConnecting, function () {
4253
- // This event is responsible for connecting the host element with another
4254
- // element in the composed path that is providing contextual data. The provider
4255
- // must be listening for a special dom event with the name corresponding to the value of
4256
- // `adapterContextToken`, which will remain secret and internal to this file only to
4257
- // guarantee that the linkage can be forged.
4258
- var contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {
4259
- setNewContext: function (newContext) {
4260
- // eslint-disable-next-line lwc-internal/no-invalid-todo
4261
- // TODO: dev-mode validation of config based on the adapter.contextSchema
4262
- callbackWhenContextIsReady(newContext);
4263
- },
4264
- setDisconnectedCallback: function (disconnectCallback) {
4265
- // adds this callback into the disconnect bucket so it gets disconnected from parent
4266
- // the the element hosting the wire is disconnected
4267
- ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
4268
- }
4269
- });
4270
- renderer.dispatchEvent(elm, contextRegistrationEvent);
4271
- });
4272
- }
4273
- function createConnector(vm, name, wireDef) {
4274
- var method = wireDef.method, adapter = wireDef.adapter, configCallback = wireDef.configCallback, dynamic = wireDef.dynamic;
4275
- var dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
4276
- var context;
4277
- var connector; // Workaround to pass the component element associated to this wire adapter instance.
4278
- defineProperty$1(dataCallback, DeprecatedWiredElementHost, {
4279
- value: vm.elm
4280
- });
4281
- defineProperty$1(dataCallback, DeprecatedWiredParamsMeta, {
4282
- value: dynamic
4283
- });
4284
- runWithBoundaryProtection(vm, vm, noop$4, function () {
4285
- // job
4286
- connector = new adapter(dataCallback);
4287
- }, noop$4);
4288
- var updateConnectorConfig = function (config) {
4289
- // every time the config is recomputed due to tracking,
4290
- // this callback will be invoked with the new computed config
4291
- runWithBoundaryProtection(vm, vm, noop$4, function () {
4292
- // job
4293
- connector.update(config, context);
4294
- }, noop$4);
4295
- }; // Computes the current wire config and calls the update method on the wire adapter.
4296
- // If it has params, we will need to observe changes in the next tick.
4297
- var _b = createConfigWatcher(vm.component, configCallback, updateConnectorConfig), computeConfigAndUpdate = _b.computeConfigAndUpdate, ro = _b.ro; // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
4298
- if (!isUndefined$1(adapter.contextSchema)) {
4299
- createContextWatcher(vm, wireDef, function (newContext) {
4300
- // every time the context is pushed into this component,
4301
- // this callback will be invoked with the new computed context
4302
- if (context !== newContext) {
4303
- context = newContext; // Note: when new context arrives, the config will be recomputed and pushed along side the new
4304
- // context, this is to preserve the identity characteristics, config should not have identity
4305
- // (ever), while context can have identity
4306
- if (vm.state === VMState.connected) {
4307
- computeConfigAndUpdate();
4308
- }
4309
- }
4310
- });
4311
- }
4312
- return {
4313
- // @ts-ignore the boundary protection executes sync, connector is always defined
4314
- connector: connector,
4315
- computeConfigAndUpdate: computeConfigAndUpdate,
4316
- resetConfigWatcher: function () { return ro.reset(); }
4317
- };
4318
- }
4319
- var AdapterToTokenMap = new Map();
4320
- function getAdapterToken(adapter) {
4321
- return AdapterToTokenMap.get(adapter);
4322
- }
4323
- function setAdapterToken(adapter, token) {
4324
- AdapterToTokenMap.set(adapter, token);
4325
- }
4326
- function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
4327
- // support for callable adapters
4328
- if (adapter.adapter) {
4329
- adapter = adapter.adapter;
4330
- }
4331
- var method = descriptor.value;
4332
- var def = {
4333
- adapter: adapter,
4334
- method: method,
4335
- configCallback: configCallback,
4336
- dynamic: dynamic
4337
- };
4338
- WireMetaMap.set(descriptor, def);
4339
- }
4340
- function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
4341
- // support for callable adapters
4342
- if (adapter.adapter) {
4343
- adapter = adapter.adapter;
4344
- }
4345
- var def = {
4346
- adapter: adapter,
4347
- configCallback: configCallback,
4348
- dynamic: dynamic
4349
- };
4350
- WireMetaMap.set(descriptor, def);
4351
- }
4352
- function installWireAdapters(vm) {
4353
- var context = vm.context, wire = vm.def.wire;
4354
- var wiredConnecting = context.wiredConnecting = [];
4355
- var wiredDisconnecting = context.wiredDisconnecting = [];
4356
- var _loop_1 = function (fieldNameOrMethod) {
4357
- var descriptor = wire[fieldNameOrMethod];
4358
- var wireDef = WireMetaMap.get(descriptor);
4359
- if (!isUndefined$1(wireDef)) {
4360
- var _b = createConnector(vm, fieldNameOrMethod, wireDef), connector_1 = _b.connector, computeConfigAndUpdate_1 = _b.computeConfigAndUpdate, resetConfigWatcher_1 = _b.resetConfigWatcher;
4361
- var hasDynamicParams_1 = wireDef.dynamic.length > 0;
4362
- ArrayPush$1.call(wiredConnecting, function () {
4363
- connector_1.connect();
4364
- if (hasDynamicParams_1) {
4365
- Promise.resolve().then(computeConfigAndUpdate_1);
4366
- }
4367
- else {
4368
- computeConfigAndUpdate_1();
4369
- }
4370
- });
4371
- ArrayPush$1.call(wiredDisconnecting, function () {
4372
- connector_1.disconnect();
4373
- resetConfigWatcher_1();
4374
- });
4375
- }
4376
- };
4377
- for (var fieldNameOrMethod in wire) {
4378
- _loop_1(fieldNameOrMethod);
4379
- }
4380
- }
4381
- function connectWireAdapters(vm) {
4382
- var wiredConnecting = vm.context.wiredConnecting;
4383
- for (var i_23 = 0, len = wiredConnecting.length; i_23 < len; i_23 += 1) {
4384
- wiredConnecting[i_23]();
4385
- }
4386
- }
4387
- function disconnectWireAdapters(vm) {
4388
- var wiredDisconnecting = vm.context.wiredDisconnecting;
4389
- runWithBoundaryProtection(vm, vm, noop$4, function () {
4390
- // job
4391
- for (var i_24 = 0, len = wiredDisconnecting.length; i_24 < len; i_24 += 1) {
4392
- wiredDisconnecting[i_24]();
4393
- }
4394
- }, noop$4);
4395
- }
4396
- /*
4397
- * Copyright (c) 2018, salesforce.com, inc.
4398
- * All rights reserved.
4399
- * SPDX-License-Identifier: MIT
4400
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4401
- */
4402
- function createContextProvider(adapter) {
4403
- var adapterContextToken = getAdapterToken(adapter);
4404
- if (!isUndefined$1(adapterContextToken)) {
4405
- throw new Error("Adapter already has a context provider.");
4406
- }
4407
- adapterContextToken = guid();
4408
- setAdapterToken(adapter, adapterContextToken);
4409
- var providers = new WeakSet();
4410
- return function (elm, options) {
4411
- if (providers.has(elm)) {
4412
- throw new Error("Adapter was already installed on " + elm + ".");
4413
- }
4414
- providers.add(elm);
4415
- var consumerConnectedCallback = options.consumerConnectedCallback, consumerDisconnectedCallback = options.consumerDisconnectedCallback;
4416
- elm.addEventListener(adapterContextToken, function (evt) {
4417
- var setNewContext = evt.setNewContext, setDisconnectedCallback = evt.setDisconnectedCallback;
4418
- var consumer = {
4419
- provide: function (newContext) {
4420
- setNewContext(newContext);
4421
- }
4422
- };
4423
- var disconnectCallback = function () {
4424
- if (!isUndefined$1(consumerDisconnectedCallback)) {
4425
- consumerDisconnectedCallback(consumer);
4426
- }
4427
- };
4428
- setDisconnectedCallback(disconnectCallback);
4429
- consumerConnectedCallback(consumer);
4430
- evt.stopImmediatePropagation();
4431
- });
4432
- };
4433
- }
4434
- /*
4435
- * Copyright (c) 2018, salesforce.com, inc.
4436
- * All rights reserved.
4437
- * SPDX-License-Identifier: MIT
4438
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4439
- */
4440
- /**
4441
- * EXPERIMENTAL: This function allows you to create a reactive readonly
4442
- * membrane around any object value. This API is subject to change or
4443
- * being removed.
4444
- */
4445
- function readonly(obj) {
4446
- return reactiveMembrane.getReadOnlyProxy(obj);
4447
- }
4448
- /* version: 1.17.8 */
4449
- /*
4450
- * Copyright (c) 2018, salesforce.com, inc.
4451
- * All rights reserved.
4452
- * SPDX-License-Identifier: MIT
4453
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4454
- */
4455
- var globalStylesheets = create(null);
4456
- var globalStylesheetsParentElement = document.head || document.body || document;
4457
- var getCustomElement, defineCustomElement, HTMLElementConstructor$1;
4458
- function isCustomElementRegistryAvailable() {
4459
- if (typeof customElements === 'undefined') {
4460
- return false;
4461
- }
4462
- try {
4463
- // dereference HTMLElement global because babel wraps globals in compat mode with a
4464
- // _wrapNativeSuper()
4465
- // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not
4466
- // get wrapped by babel.
4467
- var HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation
4468
- // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,
4469
- // which are not equipped to be initialized that way.
4470
- var clazz = /** @class */ (function (_super) {
4471
- __extends(clazz, _super);
4472
- function clazz() {
4473
- return _super !== null && _super.apply(this, arguments) || this;
4474
- }
4475
- return clazz;
4476
- }(HTMLElementAlias));
4477
- customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);
4478
- new clazz();
4479
- return true;
4480
- }
4481
- catch (_a) {
4482
- return false;
4483
- }
4484
- }
4485
- if (isCustomElementRegistryAvailable()) {
4486
- getCustomElement = customElements.get.bind(customElements);
4487
- defineCustomElement = customElements.define.bind(customElements);
4488
- HTMLElementConstructor$1 = HTMLElement;
4489
- }
4490
- else {
4491
- var registry_1 = create(null);
4492
- var reverseRegistry_1 = new WeakMap();
4493
- defineCustomElement = function define(name, ctor) {
4494
- if (name !== StringToLowerCase.call(name) || registry_1[name]) {
4495
- throw new TypeError("Invalid Registration");
4496
- }
4497
- registry_1[name] = ctor;
4498
- reverseRegistry_1.set(ctor, name);
4499
- };
4500
- getCustomElement = function get(name) {
4501
- return registry_1[name];
4502
- };
4503
- HTMLElementConstructor$1 = function HTMLElement() {
4504
- if (!(this instanceof HTMLElement)) {
4505
- throw new TypeError("Invalid Invocation");
4506
- }
4507
- var constructor = this.constructor;
4508
- var name = reverseRegistry_1.get(constructor);
4509
- if (!name) {
4510
- throw new TypeError("Invalid Construction");
4511
- }
4512
- var elm = document.createElement(name);
4513
- setPrototypeOf(elm, constructor.prototype);
4514
- return elm;
4515
- };
4516
- HTMLElementConstructor$1.prototype = HTMLElement.prototype;
4517
- } // TODO [#0]: Evaluate how we can extract the `$shadowToken$` property name in a shared package
4518
- // to avoid having to synchronize it between the different modules.
4519
- var useSyntheticShadow = hasOwnProperty.call(Element.prototype, '$shadowToken$');
4520
- var renderer = {
4521
- ssr: false,
4522
- syntheticShadow: useSyntheticShadow,
4523
- createElement: function (tagName, namespace) {
4524
- return isUndefined(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
4525
- },
4526
- createText: function (content) {
4527
- return document.createTextNode(content);
4528
- },
4529
- insert: function (node, parent, anchor) {
4530
- parent.insertBefore(node, anchor);
4531
- },
4532
- remove: function (node, parent) {
4533
- parent.removeChild(node);
4534
- },
4535
- nextSibling: function (node) {
4536
- return node.nextSibling;
4537
- },
4538
- attachShadow: function (element, options) {
4539
- return element.attachShadow(options);
4540
- },
4541
- setText: function (node, content) {
4542
- node.nodeValue = content;
4543
- },
4544
- getProperty: function (node, key) {
4545
- return node[key];
4546
- },
4547
- setProperty: function (node, key, value) {
4548
- node[key] = value;
4549
- },
4550
- getAttribute: function (element, name, namespace) {
4551
- return isUndefined(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
4552
- },
4553
- setAttribute: function (element, name, value, namespace) {
4554
- return isUndefined(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
4555
- },
4556
- removeAttribute: function (element, name, namespace) {
4557
- if (isUndefined(namespace)) {
4558
- element.removeAttribute(name);
4559
- }
4560
- else {
4561
- element.removeAttributeNS(namespace, name);
4562
- }
4563
- },
4564
- addEventListener: function (target, type, callback, options) {
4565
- target.addEventListener(type, callback, options);
4566
- },
4567
- removeEventListener: function (target, type, callback, options) {
4568
- target.removeEventListener(type, callback, options);
4569
- },
4570
- dispatchEvent: function (target, event) {
4571
- return target.dispatchEvent(event);
4572
- },
4573
- getClassList: function (element) {
4574
- return element.classList;
4575
- },
4576
- setCSSStyleProperty: function (element, name, value) {
4577
- // TODO [#0]: How to avoid this type casting? Shall we use a different type interface to
4578
- // represent elements in the engine?
4579
- element.style.setProperty(name, value);
4580
- },
4581
- getBoundingClientRect: function (element) {
4582
- return element.getBoundingClientRect();
4583
- },
4584
- querySelector: function (element, selectors) {
4585
- return element.querySelector(selectors);
4586
- },
4587
- querySelectorAll: function (element, selectors) {
4588
- return element.querySelectorAll(selectors);
4589
- },
4590
- getElementsByTagName: function (element, tagNameOrWildCard) {
4591
- return element.getElementsByTagName(tagNameOrWildCard);
4592
- },
4593
- getElementsByClassName: function (element, names) {
4594
- return element.getElementsByClassName(names);
4595
- },
4596
- isConnected: function (node) {
4597
- return node.isConnected;
4598
- },
4599
- insertGlobalStylesheet: function (content) {
4600
- if (!isUndefined(globalStylesheets[content])) {
4601
- return;
4602
- }
4603
- globalStylesheets[content] = true;
4604
- var elm = document.createElement('style');
4605
- elm.type = 'text/css';
4606
- elm.textContent = content;
4607
- globalStylesheetsParentElement.appendChild(elm);
4608
- },
4609
- assertInstanceOfHTMLElement: function (elm, msg) {
4610
- assert.invariant(elm instanceof HTMLElement, msg);
4611
- },
4612
- defineCustomElement: defineCustomElement,
4613
- getCustomElement: getCustomElement,
4614
- HTMLElement: HTMLElementConstructor$1
4615
- };
4616
- /*
4617
- * Copyright (c) 2018, salesforce.com, inc.
4618
- * All rights reserved.
4619
- * SPDX-License-Identifier: MIT
4620
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4621
- */
4622
- /**
4623
- * This function builds a Web Component class from a LWC constructor so it can be
4624
- * registered as a new element via customElements.define() at any given time.
4625
- *
4626
- * @deprecated since version 1.3.11
4627
- *
4628
- * @example
4629
- * ```
4630
- * import { buildCustomElementConstructor } from 'lwc';
4631
- * import Foo from 'ns/foo';
4632
- * const WC = buildCustomElementConstructor(Foo);
4633
- * customElements.define('x-foo', WC);
4634
- * const elm = document.createElement('x-foo');
4635
- * ```
4636
- */
4637
- function deprecatedBuildCustomElementConstructor(Ctor) {
4638
- return Ctor.CustomElementConstructor;
4639
- }
4640
- function buildCustomElementConstructor(Ctor) {
4641
- var def = getComponentInternalDef(Ctor);
4642
- return /** @class */ (function (_super) {
4643
- __extends(class_1, _super);
4644
- function class_1() {
4645
- var _this = _super.call(this) || this;
4646
- createVM(_this, def, {
4647
- mode: 'open',
4648
- owner: null,
4649
- tagName: _this.tagName,
4650
- renderer: renderer
4651
- });
4652
- return _this;
4653
- }
4654
- class_1.prototype.connectedCallback = function () {
4655
- connectRootElement(this);
4656
- };
4657
- class_1.prototype.disconnectedCallback = function () {
4658
- disconnectRootElement(this);
4659
- };
4660
- return class_1;
4661
- }(def.bridge));
4662
- }
4663
- /*
4664
- * Copyright (c) 2018, salesforce.com, inc.
4665
- * All rights reserved.
4666
- * SPDX-License-Identifier: MIT
4667
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4668
- */
4669
- var ConnectingSlot = createHiddenField('connecting', 'engine');
4670
- var DisconnectingSlot = createHiddenField('disconnecting', 'engine');
4671
- function callNodeSlot(node, slot) {
4672
- var fn = getHiddenField(node, slot);
4673
- if (!isUndefined(fn)) {
4674
- fn(node);
4675
- }
4676
- return node; // for convenience
4677
- } // Monkey patching Node methods to be able to detect the insertions and removal of root elements
4678
- // created via createElement.
4679
- var _l = Node.prototype, appendChild = _l.appendChild, insertBefore = _l.insertBefore, removeChild = _l.removeChild, replaceChild = _l.replaceChild;
4680
- assign(Node.prototype, {
4681
- appendChild: function (newChild) {
4682
- var appendedNode = appendChild.call(this, newChild);
4683
- return callNodeSlot(appendedNode, ConnectingSlot);
4684
- },
4685
- insertBefore: function (newChild, referenceNode) {
4686
- var insertedNode = insertBefore.call(this, newChild, referenceNode);
4687
- return callNodeSlot(insertedNode, ConnectingSlot);
4688
- },
4689
- removeChild: function (oldChild) {
4690
- var removedNode = removeChild.call(this, oldChild);
4691
- return callNodeSlot(removedNode, DisconnectingSlot);
4692
- },
4693
- replaceChild: function (newChild, oldChild) {
4694
- var replacedNode = replaceChild.call(this, newChild, oldChild);
4695
- callNodeSlot(replacedNode, DisconnectingSlot);
4696
- callNodeSlot(newChild, ConnectingSlot);
4697
- return replacedNode;
4698
- }
4699
- });
4700
- /**
4701
- * EXPERIMENTAL: This function is almost identical to document.createElement with the slightly
4702
- * difference that in the options, you can pass the `is` property set to a Constructor instead of
4703
- * just a string value. The intent is to allow the creation of an element controlled by LWC without
4704
- * having to register the element as a custom element.
4705
- *
4706
- * @example
4707
- * ```
4708
- * const el = createElement('x-foo', { is: FooCtor });
4709
- * ```
4710
- */
4711
- function createElement(sel, options) {
4712
- if (!isObject$1(options) || isNull(options)) {
4713
- throw new TypeError("\"createElement\" function expects an object as second parameter but received \"" + toString(options) + "\".");
4714
- }
4715
- var Ctor = options.is;
4716
- if (!isFunction(Ctor)) {
4717
- throw new TypeError("\"createElement\" function expects an \"is\" option with a valid component constructor.");
4718
- }
4719
- var UpgradableConstructor = getUpgradableConstructor(sel, renderer);
4720
- var wasComponentUpgraded = false; // the custom element from the registry is expecting an upgrade callback
4721
- /**
4722
- * Note: if the upgradable constructor does not expect, or throw when we new it
4723
- * with a callback as the first argument, we could implement a more advanced
4724
- * mechanism that only passes that argument if the constructor is known to be
4725
- * an upgradable custom element.
4726
- */
4727
- var element = new UpgradableConstructor(function (elm) {
4728
- var def = getComponentInternalDef(Ctor);
4729
- createVM(elm, def, {
4730
- tagName: sel,
4731
- mode: options.mode !== 'closed' ? 'open' : 'closed',
4732
- owner: null,
4733
- renderer: renderer
4734
- });
4735
- setHiddenField(elm, ConnectingSlot, connectRootElement);
4736
- setHiddenField(elm, DisconnectingSlot, disconnectRootElement);
4737
- wasComponentUpgraded = true;
4738
- });
4739
- if (!wasComponentUpgraded) {
4740
- /* eslint-disable-next-line no-console */
4741
- console.error("Unexpected tag name \"" + sel + "\". This name is a registered custom element, preventing LWC to upgrade the element.");
4742
- }
4743
- return element;
4744
- }
4745
- /*
4746
- * Copyright (c) 2018, salesforce.com, inc.
4747
- * All rights reserved.
4748
- * SPDX-License-Identifier: MIT
4749
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4750
- */
4751
- /**
4752
- * EXPERIMENTAL: This function provides access to the component constructor, given an HTMLElement.
4753
- * This API is subject to change or being removed.
4754
- */
4755
- function getComponentConstructor(elm) {
4756
- var ctor = null;
4757
- if (elm instanceof HTMLElement) {
4758
- var vm = getAssociatedVMIfPresent(elm);
4759
- if (!isUndefined(vm)) {
4760
- ctor = vm.def.ctor;
4761
- }
4762
- }
4763
- return ctor;
4764
- }
4765
- /*
4766
- * Copyright (c) 2018, salesforce.com, inc.
4767
- * All rights reserved.
4768
- * SPDX-License-Identifier: MIT
4769
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4770
- */
4771
- /**
4772
- * EXPERIMENTAL: This function detects whether or not a Node is controlled by a LWC template. This
4773
- * API is subject to change or being removed.
4774
- */
4775
- function isNodeFromTemplate(node) {
4776
- if (isFalse$1(node instanceof Node)) {
4777
- return false;
4778
- } // TODO [#1250]: skipping the shadowRoot instances itself makes no sense, we need to revisit
4779
- // this with locker
4780
- if (node instanceof ShadowRoot) {
4781
- return false;
4782
- }
4783
- if (useSyntheticShadow) {
4784
- // TODO [#1252]: old behavior that is still used by some pieces of the platform,
4785
- // specifically, nodes inserted manually on places where `lwc:dom="manual"` directive is not
4786
- // used, will be considered global elements.
4787
- if (isUndefined(node.$shadowResolver$)) {
4788
- return false;
4789
- }
4790
- }
4791
- var root = node.getRootNode();
4792
- return root instanceof ShadowRoot;
4793
- }
4794
- /*
4795
- * Copyright (c) 2018, salesforce.com, inc.
4796
- * All rights reserved.
4797
- * SPDX-License-Identifier: MIT
4798
- * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
4799
- */
4800
- var ComponentConstructorToCustomElementConstructorMap = new Map();
4801
- function getCustomElementConstructor(Ctor) {
4802
- if (Ctor === BaseLightningElement) {
4803
- throw new TypeError("Invalid Constructor. LightningElement base class can't be claimed as a custom element.");
4804
- }
4805
- var ce = ComponentConstructorToCustomElementConstructorMap.get(Ctor);
4806
- if (isUndefined(ce)) {
4807
- ce = buildCustomElementConstructor(Ctor);
4808
- ComponentConstructorToCustomElementConstructorMap.set(Ctor, ce);
4809
- }
4810
- return ce;
4811
- }
4812
- /**
4813
- * This static getter builds a Web Component class from a LWC constructor so it can be registered
4814
- * as a new element via customElements.define() at any given time. E.g.:
4815
- *
4816
- * import Foo from 'ns/foo';
4817
- * customElements.define('x-foo', Foo.CustomElementConstructor);
4818
- * const elm = document.createElement('x-foo');
4819
- *
4820
- */
4821
- defineProperty(BaseLightningElement, 'CustomElementConstructor', {
4822
- get: function () {
4823
- return getCustomElementConstructor(this);
4824
- }
4825
- });
4826
- freeze(BaseLightningElement);
4827
- seal(BaseLightningElement.prototype);
4828
- /* version: 1.17.8 */
4829
-
4830
- exports.LightningElement = BaseLightningElement;
4831
- exports.__unstable__ProfilerControl = profilerControl;
4832
- exports.api = api;
4833
- exports.buildCustomElementConstructor = deprecatedBuildCustomElementConstructor;
4834
- exports.createContextProvider = createContextProvider;
4835
- exports.createElement = createElement;
4836
- exports.getComponentConstructor = getComponentConstructor;
4837
- exports.getComponentDef = getComponentDef;
4838
- exports.isComponentConstructor = isComponentConstructor;
4839
- exports.isNodeFromTemplate = isNodeFromTemplate;
4840
- exports.readonly = readonly;
4841
- exports.register = register;
4842
- exports.registerComponent = registerComponent;
4843
- exports.registerDecorators = registerDecorators;
4844
- exports.registerTemplate = registerTemplate;
4845
- exports.sanitizeAttribute = sanitizeAttribute;
4846
- exports.setFeatureFlag = setFeatureFlag;
4847
- exports.setFeatureFlagForTest = setFeatureFlagForTest;
4848
- exports.swapComponent = swapComponent;
4849
- exports.swapStyle = swapStyle;
4850
- exports.swapTemplate = swapTemplate;
4851
- exports.track = track;
4852
- exports.unwrap = unwrap$1;
4853
- exports.wire = wire;
4854
-
4855
- Object.defineProperty(exports, '__esModule', { value: true });
4856
-
4857
- })));