@lwrjs/everywhere 0.9.0-alpha.7 → 0.9.0-alpha.9

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 (25) hide show
  1. package/README.md +0 -5
  2. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/102a7c627b0f61cba691a7fa94d6a856/config.js +10 -0
  3. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_9_0-alpha_9/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +14 -0
  4. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwc/v/{2_17_0/s/60dae7a83431c35c02c87ca8aaaa6044 → 2_33_0/s/90a5f16131da45cef1653112862ca9dc}/lwc.js +1907 -1061
  5. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/everywhereAmd/v/{0_9_0-alpha_7 → 0_9_0-alpha_9}/s/c538071acf5bde58e816967a14c465c3/lwr_everywhereAmd.js +3 -3
  6. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/init/v/{0_9_0-alpha_7 → 0_9_0-alpha_9}/s/6258bcb20cc2d5d6a9f3c5a6f9d0acaf/lwr_init.js +4 -4
  7. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/loader/v/{0_9_0-alpha_7/s/2fd4c84e2a3ccbaa035359815ef103f0 → 0_9_0-alpha_9/s/07df3ed331f5f6b3c21336c94dac7c0b}/lwr_loader.js +1 -1
  8. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/metrics/v/{0_9_0-alpha_7 → 0_9_0-alpha_9}/s/dfbc827104d50ff7d16b59c9d0e06aca/lwr_metrics.js +1 -1
  9. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/profiler/v/{0_9_0-alpha_7 → 0_9_0-alpha_9}/s/5a10236d8c52bc9f6dee22875cd7016d/lwr_profiler.js +1 -1
  10. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/lwr/vault/v/{0_9_0-alpha_7 → 0_9_0-alpha_9}/s/c92abd8c1fec2d7eff62e4b097abbe14/lwr_vault.js +1 -1
  11. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-error-shim.js/v/{0_9_0-alpha_7 → 0_9_0-alpha_9} +1 -1
  12. package/build/__generated_site_amd_modules__/1/resource/amd/lwr-loader-shim.js/v/{0_9_0-alpha_7 → 0_9_0-alpha_9} +5 -5
  13. package/build/__generated_site_amd_modules__/en-US/index.html +6 -6
  14. package/build/__generated_site_amd_modules__/index.html +6 -6
  15. package/build/assets/amd/lwr-everywhere-debug.js +8 -8
  16. package/build/assets/amd/lwr-everywhere-min.js +1 -1
  17. package/build/assets/amd/lwr-everywhere.js +8 -8
  18. package/build/assets/core/lwr-everywhere-debug.js +4 -4
  19. package/build/assets/core/lwr-everywhere.js +4 -4
  20. package/build/assets/esm/lwr-everywhere-debug.js +1 -1
  21. package/build/assets/esm/lwr-everywhere-min.js +1 -1
  22. package/build/assets/esm/lwr-everywhere.js +1 -1
  23. package/package.json +6 -6
  24. package/build/__generated_site_amd_modules__/1/application/amd/l/en-US/ai/amd-bootstrap/configuration/ci/-/-/s/bfda0e15bf5f09571f28aa474081f448/config.js +0 -10
  25. package/build/__generated_site_amd_modules__/1/module/amd/1/l/en-US/mi/@lwrjs/app-service/amd-bootstrap/module/amd/v/0_9_0-alpha_7/s/c40e6caf07454ce13961de8ca76ab7f0/@lwrjs_app-service_amd-bootstrap_module_amd.js +0 -14
@@ -1,4 +1,4 @@
1
- LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
1
+ LWR.define("lwc/v/2_33_0", ["exports"], function(exports) {
2
2
  "use strict";
3
3
  function invariant(value, msg) {
4
4
  if (!value) {
@@ -44,6 +44,7 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
44
44
  isArray: isArray$1
45
45
  } = Array;
46
46
  const {
47
+ concat: ArrayConcat$1,
47
48
  copyWithin: ArrayCopyWithin,
48
49
  fill: ArrayFill,
49
50
  filter: ArrayFilter,
@@ -57,6 +58,7 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
57
58
  reverse: ArrayReverse,
58
59
  shift: ArrayShift,
59
60
  slice: ArraySlice,
61
+ some: ArraySome,
60
62
  sort: ArraySort,
61
63
  splice: ArraySplice,
62
64
  unshift: ArrayUnshift,
@@ -167,8 +169,24 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
167
169
  const KEY__SHADOW_TOKEN = "$shadowToken$";
168
170
  const KEY__SYNTHETIC_MODE = "$$lwc-synthetic-mode";
169
171
  const KEY__SCOPED_CSS = "$scoped$";
170
- const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = 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"]]);
172
+ const XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
173
+ const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
174
+ const XLINK_NAMESPACE = "http://www.w3.org/1999/xlink";
175
+ const CAMEL_REGEX = /-([a-z])/g;
176
+ const {
177
+ NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING,
178
+ NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING
179
+ } = /* @__PURE__ */ (() => {
180
+ const NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING2 = 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"]]);
181
+ const NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING2 = new Map();
182
+ NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING2.forEach((value, key) => NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING2.set(value, key));
183
+ return {
184
+ NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING: NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING2,
185
+ NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING: NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING2
186
+ };
187
+ })();
171
188
  const CACHED_PROPERTY_ATTRIBUTE_MAPPING = new Map();
189
+ const CACHED_ATTRIBUTE_PROPERTY_MAPPING = new Map();
172
190
  function htmlPropertyToAttribute(propName) {
173
191
  const ariaAttributeName = AriaPropNameToAttrNameMap[propName];
174
192
  if (!isUndefined$1(ariaAttributeName)) {
@@ -194,80 +212,43 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
194
212
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
195
213
  return attributeName;
196
214
  }
197
- const XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace";
198
- const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
199
- const XLINK_NAMESPACE = "http://www.w3.org/1999/xlink";
200
- const LWC_VERSION = "2.17.0";
201
- const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
202
- function detect(propName) {
203
- return Object.getOwnPropertyDescriptor(Element.prototype, propName) === void 0;
204
- }
205
- const nodeToAriaPropertyValuesMap = new WeakMap();
206
- function getAriaPropertyMap(elm) {
207
- let map = nodeToAriaPropertyValuesMap.get(elm);
208
- if (map === void 0) {
209
- map = {};
210
- nodeToAriaPropertyValuesMap.set(elm, map);
215
+ function htmlAttributeToProperty(attrName) {
216
+ const ariaPropertyName = AriaAttrNameToPropNameMap[attrName];
217
+ if (!isUndefined$1(ariaPropertyName)) {
218
+ return ariaPropertyName;
211
219
  }
212
- return map;
213
- }
214
- function getNormalizedAriaPropertyValue(value) {
215
- return value == null ? null : String(value);
216
- }
217
- function createAriaPropertyPropertyDescriptor(propName, attrName) {
218
- return {
219
- get() {
220
- const map = getAriaPropertyMap(this);
221
- if (hasOwnProperty$1.call(map, propName)) {
222
- return map[propName];
223
- }
224
- return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
225
- },
226
- set(newValue) {
227
- const normalizedValue = getNormalizedAriaPropertyValue(newValue);
228
- const map = getAriaPropertyMap(this);
229
- map[propName] = normalizedValue;
230
- if (newValue === null) {
231
- this.removeAttribute(attrName);
232
- } else {
233
- this.setAttribute(attrName, newValue);
234
- }
235
- },
236
- configurable: true,
237
- enumerable: true
238
- };
239
- }
240
- function patch$1(propName) {
241
- const attrName = AriaPropNameToAttrNameMap[propName];
242
- const descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);
243
- Object.defineProperty(Element.prototype, propName, descriptor);
244
- }
245
- const ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
246
- for (let i2 = 0, len = ElementPrototypeAriaPropertyNames.length; i2 < len; i2 += 1) {
247
- const propName = ElementPrototypeAriaPropertyNames[i2];
248
- if (detect(propName)) {
249
- patch$1(propName);
220
+ const specialPropertyName = NO_STANDARD_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
221
+ if (!isUndefined$1(specialPropertyName)) {
222
+ return specialPropertyName;
223
+ }
224
+ const cachedPropertyName = CACHED_ATTRIBUTE_PROPERTY_MAPPING.get(attrName);
225
+ if (!isUndefined$1(cachedPropertyName)) {
226
+ return cachedPropertyName;
250
227
  }
228
+ const propertyName = StringReplace.call(attrName, CAMEL_REGEX, (g) => g[1].toUpperCase());
229
+ CACHED_ATTRIBUTE_PROPERTY_MAPPING.set(attrName, propertyName);
230
+ return propertyName;
251
231
  }
232
+ const LWC_VERSION = "2.33.0";
233
+ const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
252
234
  const features = {
253
235
  DUMMY_TEST_FLAG: null,
254
- ENABLE_ELEMENT_PATCH: null,
255
236
  ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,
256
- ENABLE_HMR: null,
257
- ENABLE_HTML_COLLECTIONS_PATCH: null,
258
- ENABLE_INNER_OUTER_TEXT_PATCH: null,
259
237
  ENABLE_MIXED_SHADOW_MODE: null,
260
- ENABLE_NODE_LIST_PATCH: null,
261
- ENABLE_NODE_PATCH: null,
262
- ENABLE_REACTIVE_SETTER: null,
263
- ENABLE_WIRE_SYNC_EMIT: null
238
+ ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE: null,
239
+ ENABLE_WIRE_SYNC_EMIT: null,
240
+ ENABLE_LIGHT_GET_ROOT_NODE_PATCH: null,
241
+ DISABLE_LIGHT_DOM_UNSCOPED_CSS: null,
242
+ ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY: null,
243
+ ENABLE_FROZEN_TEMPLATE: null,
244
+ DISABLE_ARIA_REFLECTION_POLYFILL: null
264
245
  };
265
246
  if (!_globalThis.lwcRuntimeFlags) {
266
247
  Object.defineProperty(_globalThis, "lwcRuntimeFlags", {
267
248
  value: create(null)
268
249
  });
269
250
  }
270
- const runtimeFlags = _globalThis.lwcRuntimeFlags;
251
+ const lwcRuntimeFlags = _globalThis.lwcRuntimeFlags;
271
252
  function setFeatureFlag(name, value) {
272
253
  if (!isBoolean(value)) {
273
254
  const message = `Failed to set the value "${value}" for the runtime feature flag "${name}". Runtime feature flags can only be set to a boolean value.`;
@@ -284,14 +265,14 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
284
265
  return;
285
266
  }
286
267
  if (true) {
287
- runtimeFlags[name] = value;
268
+ lwcRuntimeFlags[name] = value;
288
269
  } else {
289
- const runtimeValue = runtimeFlags[name];
270
+ const runtimeValue = lwcRuntimeFlags[name];
290
271
  if (!isUndefined$1(runtimeValue)) {
291
272
  console.error(`Failed to set the value "${value}" for the runtime feature flag "${name}". "${name}" has already been set with the value "${runtimeValue}".`);
292
273
  return;
293
274
  }
294
- defineProperty(runtimeFlags, name, {
275
+ defineProperty(lwcRuntimeFlags, name, {
295
276
  value
296
277
  });
297
278
  }
@@ -301,10 +282,46 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
301
282
  setFeatureFlag(name, value);
302
283
  }
303
284
  }
285
+ function detect(propName, prototype) {
286
+ return isUndefined$1(getOwnPropertyDescriptor$1(prototype, propName));
287
+ }
288
+ function createAriaPropertyPropertyDescriptor(attrName) {
289
+ return {
290
+ get() {
291
+ return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;
292
+ },
293
+ set(newValue) {
294
+ if (isNull(newValue)) {
295
+ this.removeAttribute(attrName);
296
+ } else {
297
+ this.setAttribute(attrName, newValue);
298
+ }
299
+ },
300
+ configurable: true,
301
+ enumerable: true
302
+ };
303
+ }
304
+ function patch$1(propName, prototype) {
305
+ const attrName = AriaPropNameToAttrNameMap[propName];
306
+ const descriptor = createAriaPropertyPropertyDescriptor(attrName);
307
+ defineProperty(prototype, propName, descriptor);
308
+ }
309
+ function applyAriaReflection(prototype = Element.prototype) {
310
+ const ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);
311
+ for (let i2 = 0, len = ElementPrototypeAriaPropertyNames.length; i2 < len; i2 += 1) {
312
+ const propName = ElementPrototypeAriaPropertyNames[i2];
313
+ if (detect(propName, prototype)) {
314
+ patch$1(propName, prototype);
315
+ }
316
+ }
317
+ }
318
+ if (!lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
319
+ applyAriaReflection();
320
+ }
304
321
  if (typeof __karma__ !== "undefined") {
305
322
  window.addEventListener("test-dummy-flag", () => {
306
323
  let hasFlag = false;
307
- if (runtimeFlags.DUMMY_TEST_FLAG) {
324
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
308
325
  hasFlag = true;
309
326
  }
310
327
  window.dispatchEvent(new CustomEvent("has-dummy-flag", {
@@ -318,7 +335,7 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
318
335
  if (typeof __karma__ !== "undefined") {
319
336
  window.addEventListener("test-dummy-flag", () => {
320
337
  let hasFlag = false;
321
- if (runtimeFlags.DUMMY_TEST_FLAG) {
338
+ if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
322
339
  hasFlag = true;
323
340
  }
324
341
  window.dispatchEvent(new CustomEvent("has-dummy-flag", {
@@ -397,6 +414,15 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
397
414
  }
398
415
  return list;
399
416
  }
417
+ function setRefVNode(vm, ref, vnode) {
418
+ if (isUndefined$1(vm.refVNodes)) {
419
+ throw new Error("refVNodes must be defined when setting a ref");
420
+ }
421
+ const refVNodes = vm.refVNodes;
422
+ if (!(ref in refVNodes) || refVNodes[ref].key < vnode.key) {
423
+ refVNodes[ref] = vnode;
424
+ }
425
+ }
400
426
  const TargetToReactiveRecordMap = new WeakMap();
401
427
  function getReactiveRecord(target) {
402
428
  let reactiveRecord = TargetToReactiveRecordMap.get(target);
@@ -480,10 +506,17 @@ LWR.define("lwc/v/2_17_0", ["exports"], function(exports) {
480
506
  }
481
507
  }
482
508
  function componentValueMutated(vm, key) {
483
- valueMutated(vm.component, key);
509
+ {
510
+ valueMutated(vm.component, key);
511
+ }
484
512
  }
485
513
  function componentValueObserved(vm, key) {
486
- valueObserved(vm.component, key);
514
+ {
515
+ valueObserved(vm.component, key);
516
+ }
517
+ }
518
+ function createReactiveObserver(callback) {
519
+ return new ReactiveObserver(callback);
487
520
  }
488
521
  function getComponentTag(vm) {
489
522
  return `<${StringToLowerCase.call(vm.tagName)}>`;
@@ -546,9 +579,9 @@ ${getComponentStack(vm)}`;
546
579
  function isCircularModuleDependency(obj) {
547
580
  return isFunction$1(obj) && hasOwnProperty$1.call(obj, "__circular__");
548
581
  }
549
- const HTMLElementConstructor$1 = typeof HTMLElement !== "undefined" ? HTMLElement : function() {
582
+ const HTMLElementConstructor = typeof HTMLElement !== "undefined" ? HTMLElement : function() {
550
583
  };
551
- const HTMLElementPrototype = HTMLElementConstructor$1.prototype;
584
+ const HTMLElementPrototype = HTMLElementConstructor.prototype;
552
585
  const defaultDefHTMLPropertyNames = ["accessKey", "dir", "draggable", "hidden", "id", "lang", "spellcheck", "tabIndex", "title"];
553
586
  function offsetPropertyErrorMessage(name) {
554
587
  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.`;
@@ -708,12 +741,12 @@ ${getComponentStack(vm)}`;
708
741
  }
709
742
  })
710
743
  };
711
- if (!options.isLight && !options.isPortal) {
744
+ if (!options.isLight && options.isSynthetic && !options.isPortal) {
712
745
  const {
713
- appendChild: appendChild2,
714
- insertBefore: insertBefore2,
715
- removeChild: removeChild2,
716
- replaceChild: replaceChild2
746
+ appendChild,
747
+ insertBefore,
748
+ removeChild,
749
+ replaceChild
717
750
  } = elm;
718
751
  const originalNodeValueDescriptor = getPropertyDescriptor(elm, "nodeValue");
719
752
  const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, "innerHTML");
@@ -722,7 +755,7 @@ ${getComponentStack(vm)}`;
722
755
  appendChild: generateDataDescriptor({
723
756
  value(aChild) {
724
757
  logMissingPortalError("appendChild", "method");
725
- return appendChild2.call(this, aChild);
758
+ return appendChild.call(this, aChild);
726
759
  }
727
760
  }),
728
761
  insertBefore: generateDataDescriptor({
@@ -730,7 +763,7 @@ ${getComponentStack(vm)}`;
730
763
  if (!isDomMutationAllowed) {
731
764
  logMissingPortalError("insertBefore", "method");
732
765
  }
733
- return insertBefore2.call(this, newNode, referenceNode);
766
+ return insertBefore.call(this, newNode, referenceNode);
734
767
  }
735
768
  }),
736
769
  removeChild: generateDataDescriptor({
@@ -738,13 +771,13 @@ ${getComponentStack(vm)}`;
738
771
  if (!isDomMutationAllowed) {
739
772
  logMissingPortalError("removeChild", "method");
740
773
  }
741
- return removeChild2.call(this, aChild);
774
+ return removeChild.call(this, aChild);
742
775
  }
743
776
  }),
744
777
  replaceChild: generateDataDescriptor({
745
778
  value(newChild, oldChild) {
746
779
  logMissingPortalError("replaceChild", "method");
747
- return replaceChild2.call(this, newChild, oldChild);
780
+ return replaceChild.call(this, newChild, oldChild);
748
781
  }
749
782
  }),
750
783
  nodeValue: generateAccessorDescriptor({
@@ -937,6 +970,15 @@ ${getComponentStack(vm)}`;
937
970
  function patchLightningElementPrototypeWithRestrictions(proto) {
938
971
  defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));
939
972
  }
973
+ function updateComponentValue(vm, key, newValue) {
974
+ const {
975
+ cmpFields
976
+ } = vm;
977
+ if (newValue !== cmpFields[key]) {
978
+ cmpFields[key] = newValue;
979
+ componentValueMutated(vm, key);
980
+ }
981
+ }
940
982
  const {
941
983
  isArray
942
984
  } = Array;
@@ -1390,7 +1432,7 @@ ${getComponentStack(vm)}`;
1390
1432
  }
1391
1433
  return {};
1392
1434
  }
1393
- function init() {
1435
+ function init$1() {
1394
1436
  if (false) {
1395
1437
  throw new ReferenceError();
1396
1438
  }
@@ -1400,7 +1442,7 @@ ${getComponentStack(vm)}`;
1400
1442
  global2.devtoolsFormatters = devtoolsFormatters;
1401
1443
  }
1402
1444
  if (true) {
1403
- init();
1445
+ init$1();
1404
1446
  }
1405
1447
  function defaultValueIsObservable(value) {
1406
1448
  if (value === null) {
@@ -1487,6 +1529,17 @@ ${getComponentStack(vm)}`;
1487
1529
  function unwrap(value) {
1488
1530
  return reactiveMembrane.unwrapProxy(value);
1489
1531
  }
1532
+ function getReadOnlyProxy(value) {
1533
+ return reactiveMembrane.getReadOnlyProxy(value);
1534
+ }
1535
+ function getReactiveProxy(value) {
1536
+ return reactiveMembrane.getProxy(value);
1537
+ }
1538
+ function markLockerLiveObject(obj) {
1539
+ {
1540
+ obj[lockerLivePropertyKey] = void 0;
1541
+ }
1542
+ }
1490
1543
  function createBridgeToElementDescriptor(propName, descriptor) {
1491
1544
  const {
1492
1545
  get,
@@ -1529,17 +1582,16 @@ ${getComponentStack(vm)}`;
1529
1582
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1530
1583
  assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value "${newValue}" for "${propName}" of ${vm}. Value cannot be an object, must be a primitive value.`);
1531
1584
  }
1532
- if (newValue !== vm.cmpProps[propName]) {
1533
- vm.cmpProps[propName] = newValue;
1534
- componentValueMutated(vm, propName);
1535
- }
1585
+ updateComponentValue(vm, propName, newValue);
1536
1586
  return set.call(vm.elm, newValue);
1537
1587
  }
1538
1588
  };
1539
1589
  }
1590
+ const EMPTY_REFS = freeze(create(null));
1591
+ const refsCache = new WeakMap();
1540
1592
  const LightningElement = function() {
1541
1593
  if (isNull(vmBeingConstructed)) {
1542
- throw new ReferenceError("Illegal constructor");
1594
+ throw new TypeError("Illegal constructor");
1543
1595
  }
1544
1596
  const vm = vmBeingConstructed;
1545
1597
  const {
@@ -1551,9 +1603,9 @@ ${getComponentStack(vm)}`;
1551
1603
  } = def;
1552
1604
  if (true) {
1553
1605
  const {
1554
- assertInstanceOfHTMLElement: assertInstanceOfHTMLElement2
1606
+ assertInstanceOfHTMLElement
1555
1607
  } = vm.renderer;
1556
- assertInstanceOfHTMLElement2(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
1608
+ assertInstanceOfHTMLElement(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);
1557
1609
  }
1558
1610
  const component = this;
1559
1611
  setPrototypeOf(elm, bridge.prototype);
@@ -1568,7 +1620,7 @@ ${getComponentStack(vm)}`;
1568
1620
  vm.setHook = setHook2;
1569
1621
  vm.getHook = getHook2;
1570
1622
  }
1571
- this[lockerLivePropertyKey] = void 0;
1623
+ markLockerLiveObject(this);
1572
1624
  associateVM(component, vm);
1573
1625
  associateVM(elm, vm);
1574
1626
  if (vm.renderMode === 1) {
@@ -1591,10 +1643,10 @@ ${getComponentStack(vm)}`;
1591
1643
  ctor
1592
1644
  },
1593
1645
  renderer: {
1594
- attachShadow: attachShadow2
1646
+ attachShadow
1595
1647
  }
1596
1648
  } = vm;
1597
- const shadowRoot = attachShadow2(elm, {
1649
+ const shadowRoot = attachShadow(elm, {
1598
1650
  [KEY__SYNTHETIC_MODE]: shadowMode === 1,
1599
1651
  delegatesFocus: Boolean(ctor.delegatesFocus),
1600
1652
  mode
@@ -1618,17 +1670,17 @@ ${getComponentStack(vm)}`;
1618
1670
  const {
1619
1671
  elm,
1620
1672
  renderer: {
1621
- dispatchEvent: dispatchEvent2
1673
+ dispatchEvent
1622
1674
  }
1623
1675
  } = vm;
1624
- return dispatchEvent2(elm, event);
1676
+ return dispatchEvent(elm, event);
1625
1677
  },
1626
1678
  addEventListener(type, listener, options) {
1627
1679
  const vm = getAssociatedVM(this);
1628
1680
  const {
1629
1681
  elm,
1630
1682
  renderer: {
1631
- addEventListener: addEventListener2
1683
+ addEventListener
1632
1684
  }
1633
1685
  } = vm;
1634
1686
  if (true) {
@@ -1638,60 +1690,60 @@ ${getComponentStack(vm)}`;
1638
1690
  assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event "${type}". Expected an EventListener but received ${listener}.`);
1639
1691
  }
1640
1692
  const wrappedListener = getWrappedComponentsListener(vm, listener);
1641
- addEventListener2(elm, type, wrappedListener, options);
1693
+ addEventListener(elm, type, wrappedListener, options);
1642
1694
  },
1643
1695
  removeEventListener(type, listener, options) {
1644
1696
  const vm = getAssociatedVM(this);
1645
1697
  const {
1646
1698
  elm,
1647
1699
  renderer: {
1648
- removeEventListener: removeEventListener2
1700
+ removeEventListener
1649
1701
  }
1650
1702
  } = vm;
1651
1703
  const wrappedListener = getWrappedComponentsListener(vm, listener);
1652
- removeEventListener2(elm, type, wrappedListener, options);
1704
+ removeEventListener(elm, type, wrappedListener, options);
1653
1705
  },
1654
1706
  hasAttribute(name) {
1655
1707
  const vm = getAssociatedVM(this);
1656
1708
  const {
1657
1709
  elm,
1658
1710
  renderer: {
1659
- getAttribute: getAttribute2
1711
+ getAttribute
1660
1712
  }
1661
1713
  } = vm;
1662
- return !isNull(getAttribute2(elm, name));
1714
+ return !isNull(getAttribute(elm, name));
1663
1715
  },
1664
1716
  hasAttributeNS(namespace, name) {
1665
1717
  const vm = getAssociatedVM(this);
1666
1718
  const {
1667
1719
  elm,
1668
1720
  renderer: {
1669
- getAttribute: getAttribute2
1721
+ getAttribute
1670
1722
  }
1671
1723
  } = vm;
1672
- return !isNull(getAttribute2(elm, name, namespace));
1724
+ return !isNull(getAttribute(elm, name, namespace));
1673
1725
  },
1674
1726
  removeAttribute(name) {
1675
1727
  const vm = getAssociatedVM(this);
1676
1728
  const {
1677
1729
  elm,
1678
1730
  renderer: {
1679
- removeAttribute: removeAttribute2
1731
+ removeAttribute
1680
1732
  }
1681
1733
  } = vm;
1682
1734
  unlockAttribute(elm, name);
1683
- removeAttribute2(elm, name);
1735
+ removeAttribute(elm, name);
1684
1736
  lockAttribute();
1685
1737
  },
1686
1738
  removeAttributeNS(namespace, name) {
1687
1739
  const {
1688
1740
  elm,
1689
1741
  renderer: {
1690
- removeAttribute: removeAttribute2
1742
+ removeAttribute
1691
1743
  }
1692
1744
  } = getAssociatedVM(this);
1693
1745
  unlockAttribute(elm, name);
1694
- removeAttribute2(elm, name, namespace);
1746
+ removeAttribute(elm, name, namespace);
1695
1747
  lockAttribute();
1696
1748
  },
1697
1749
  getAttribute(name) {
@@ -1700,9 +1752,9 @@ ${getComponentStack(vm)}`;
1700
1752
  elm
1701
1753
  } = vm;
1702
1754
  const {
1703
- getAttribute: getAttribute2
1755
+ getAttribute
1704
1756
  } = vm.renderer;
1705
- return getAttribute2(elm, name);
1757
+ return getAttribute(elm, name);
1706
1758
  },
1707
1759
  getAttributeNS(namespace, name) {
1708
1760
  const vm = getAssociatedVM(this);
@@ -1710,23 +1762,23 @@ ${getComponentStack(vm)}`;
1710
1762
  elm
1711
1763
  } = vm;
1712
1764
  const {
1713
- getAttribute: getAttribute2
1765
+ getAttribute
1714
1766
  } = vm.renderer;
1715
- return getAttribute2(elm, name, namespace);
1767
+ return getAttribute(elm, name, namespace);
1716
1768
  },
1717
1769
  setAttribute(name, value) {
1718
1770
  const vm = getAssociatedVM(this);
1719
1771
  const {
1720
1772
  elm,
1721
1773
  renderer: {
1722
- setAttribute: setAttribute2
1774
+ setAttribute
1723
1775
  }
1724
1776
  } = vm;
1725
1777
  if (true) {
1726
1778
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1727
1779
  }
1728
1780
  unlockAttribute(elm, name);
1729
- setAttribute2(elm, name, value);
1781
+ setAttribute(elm, name, value);
1730
1782
  lockAttribute();
1731
1783
  },
1732
1784
  setAttributeNS(namespace, name, value) {
@@ -1734,14 +1786,14 @@ ${getComponentStack(vm)}`;
1734
1786
  const {
1735
1787
  elm,
1736
1788
  renderer: {
1737
- setAttribute: setAttribute2
1789
+ setAttribute
1738
1790
  }
1739
1791
  } = vm;
1740
1792
  if (true) {
1741
1793
  assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);
1742
1794
  }
1743
1795
  unlockAttribute(elm, name);
1744
- setAttribute2(elm, name, value, namespace);
1796
+ setAttribute(elm, name, value, namespace);
1745
1797
  lockAttribute();
1746
1798
  },
1747
1799
  getBoundingClientRect() {
@@ -1749,36 +1801,36 @@ ${getComponentStack(vm)}`;
1749
1801
  const {
1750
1802
  elm,
1751
1803
  renderer: {
1752
- getBoundingClientRect: getBoundingClientRect2
1804
+ getBoundingClientRect
1753
1805
  }
1754
1806
  } = vm;
1755
1807
  if (true) {
1756
1808
  warnIfInvokedDuringConstruction(vm, "getBoundingClientRect()");
1757
1809
  }
1758
- return getBoundingClientRect2(elm);
1810
+ return getBoundingClientRect(elm);
1759
1811
  },
1760
1812
  get isConnected() {
1761
1813
  const vm = getAssociatedVM(this);
1762
1814
  const {
1763
1815
  elm,
1764
1816
  renderer: {
1765
- isConnected: isConnected2
1817
+ isConnected
1766
1818
  }
1767
1819
  } = vm;
1768
- return isConnected2(elm);
1820
+ return isConnected(elm);
1769
1821
  },
1770
1822
  get classList() {
1771
1823
  const vm = getAssociatedVM(this);
1772
1824
  const {
1773
1825
  elm,
1774
1826
  renderer: {
1775
- getClassList: getClassList2
1827
+ getClassList
1776
1828
  }
1777
1829
  } = vm;
1778
1830
  if (true) {
1779
1831
  assert.isFalse(isBeingConstructed(vm), `Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);
1780
1832
  }
1781
- return getClassList2(elm);
1833
+ return getClassList(elm);
1782
1834
  },
1783
1835
  get template() {
1784
1836
  const vm = getAssociatedVM(this);
@@ -1789,6 +1841,50 @@ ${getComponentStack(vm)}`;
1789
1841
  }
1790
1842
  return vm.shadowRoot;
1791
1843
  },
1844
+ get refs() {
1845
+ const vm = getAssociatedVM(this);
1846
+ if (isUpdatingTemplate) {
1847
+ if (true) {
1848
+ logError(`this.refs should not be called while ${getComponentTag(vm)} is rendering. Use this.refs only when the DOM is stable, e.g. in renderedCallback().`);
1849
+ }
1850
+ return;
1851
+ }
1852
+ if (true) {
1853
+ warnIfInvokedDuringConstruction(vm, "refs");
1854
+ }
1855
+ const {
1856
+ refVNodes,
1857
+ hasRefVNodes,
1858
+ cmpTemplate
1859
+ } = vm;
1860
+ if (isNull(cmpTemplate) && !isBeingConstructed(vm)) {
1861
+ logError(`this.refs is undefined for ${getComponentTag(vm)}. This is either because the attached template has no "lwc:ref" directive, or this.refs was invoked before renderedCallback(). Use this.refs only when the referenced HTML elements have been rendered to the DOM, such as within renderedCallback() or disconnectedCallback().`);
1862
+ }
1863
+ if (!hasRefVNodes) {
1864
+ return;
1865
+ }
1866
+ if (isNull(refVNodes)) {
1867
+ return EMPTY_REFS;
1868
+ }
1869
+ let refs = refsCache.get(refVNodes);
1870
+ if (isUndefined$1(refs)) {
1871
+ refs = create(null);
1872
+ for (const key of keys(refVNodes)) {
1873
+ refs[key] = refVNodes[key].elm;
1874
+ }
1875
+ freeze(refs);
1876
+ refsCache.set(refVNodes, refs);
1877
+ }
1878
+ return refs;
1879
+ },
1880
+ set refs(value) {
1881
+ defineProperty(this, "refs", {
1882
+ configurable: true,
1883
+ enumerable: true,
1884
+ writable: true,
1885
+ value
1886
+ });
1887
+ },
1792
1888
  get shadowRoot() {
1793
1889
  return null;
1794
1890
  },
@@ -1875,6 +1971,12 @@ ${getComponentStack(vm)}`;
1875
1971
  lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);
1876
1972
  }
1877
1973
  defineProperties(LightningElement.prototype, lightningBasedDescriptors);
1974
+ function applyAriaReflectionToLightningElement() {
1975
+ applyAriaReflection(LightningElement.prototype);
1976
+ }
1977
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
1978
+ applyAriaReflectionToLightningElement();
1979
+ }
1878
1980
  defineProperty(LightningElement, "CustomElementConstructor", {
1879
1981
  get() {
1880
1982
  throw new ReferenceError("The current runtime does not support CustomElementConstructor.");
@@ -1893,10 +1995,7 @@ ${getComponentStack(vm)}`;
1893
1995
  },
1894
1996
  set(newValue) {
1895
1997
  const vm = getAssociatedVM(this);
1896
- if (newValue !== vm.cmpFields[key]) {
1897
- vm.cmpFields[key] = newValue;
1898
- componentValueMutated(vm, key);
1899
- }
1998
+ updateComponentValue(vm, key, newValue);
1900
1999
  },
1901
2000
  enumerable: true,
1902
2001
  configurable: true
@@ -1935,40 +2034,6 @@ ${getComponentStack(vm)}`;
1935
2034
  configurable: true
1936
2035
  };
1937
2036
  }
1938
- class AccessorReactiveObserver extends ReactiveObserver {
1939
- constructor(vm, set) {
1940
- super(() => {
1941
- if (isFalse(this.debouncing)) {
1942
- this.debouncing = true;
1943
- addCallbackToNextTick(() => {
1944
- if (isTrue(this.debouncing)) {
1945
- const {
1946
- value
1947
- } = this;
1948
- const {
1949
- isDirty: dirtyStateBeforeSetterCall,
1950
- component,
1951
- idx: idx2
1952
- } = vm;
1953
- set.call(component, value);
1954
- this.debouncing = false;
1955
- if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx2 > 0) {
1956
- rerenderVM(vm);
1957
- }
1958
- }
1959
- });
1960
- }
1961
- });
1962
- this.debouncing = false;
1963
- }
1964
- reset(value) {
1965
- super.reset();
1966
- this.debouncing = false;
1967
- if (arguments.length > 0) {
1968
- this.value = value;
1969
- }
1970
- }
1971
- }
1972
2037
  function createPublicAccessorDescriptor(key, descriptor) {
1973
2038
  const {
1974
2039
  get,
@@ -1997,18 +2062,7 @@ ${getComponentStack(vm)}`;
1997
2062
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered2} has side effects on the state of ${vm}.${toString$1(key)}`);
1998
2063
  }
1999
2064
  if (set) {
2000
- if (runtimeFlags.ENABLE_REACTIVE_SETTER) {
2001
- let ro = vm.oar[key];
2002
- if (isUndefined$1(ro)) {
2003
- ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);
2004
- }
2005
- ro.reset(newValue);
2006
- ro.observe(() => {
2007
- set.call(this, newValue);
2008
- });
2009
- } else {
2010
- set.call(this, newValue);
2011
- }
2065
+ set.call(this, newValue);
2012
2066
  } else if (true) {
2013
2067
  assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);
2014
2068
  }
@@ -2019,7 +2073,7 @@ ${getComponentStack(vm)}`;
2019
2073
  }
2020
2074
  function track(target) {
2021
2075
  if (arguments.length === 1) {
2022
- return reactiveMembrane.getProxy(target);
2076
+ return getReactiveProxy(target);
2023
2077
  }
2024
2078
  if (true) {
2025
2079
  assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);
@@ -2040,11 +2094,8 @@ ${getComponentStack(vm)}`;
2040
2094
  assert.invariant(!isInvokingRender, `${vmBeingRendered2}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2041
2095
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered2} has side effects on the state of ${vm}.${toString$1(key)}`);
2042
2096
  }
2043
- const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);
2044
- if (reactiveOrAnyValue !== vm.cmpFields[key]) {
2045
- vm.cmpFields[key] = reactiveOrAnyValue;
2046
- componentValueMutated(vm, key);
2047
- }
2097
+ const reactiveOrAnyValue = getReactiveProxy(newValue);
2098
+ updateComponentValue(vm, key, reactiveOrAnyValue);
2048
2099
  },
2049
2100
  enumerable: true,
2050
2101
  configurable: true
@@ -2065,10 +2116,7 @@ ${getComponentStack(vm)}`;
2065
2116
  },
2066
2117
  set(value) {
2067
2118
  const vm = getAssociatedVM(this);
2068
- if (value !== vm.cmpFields[key]) {
2069
- vm.cmpFields[key] = value;
2070
- componentValueMutated(vm, key);
2071
- }
2119
+ updateComponentValue(vm, key, value);
2072
2120
  },
2073
2121
  enumerable: true,
2074
2122
  configurable: true
@@ -2306,25 +2354,6 @@ No further warnings will appear.`);
2306
2354
  checkVersionMismatch(tpl, "template");
2307
2355
  }
2308
2356
  signedTemplateSet.add(tpl);
2309
- defineProperty(tpl, "stylesheetTokens", {
2310
- enumerable: true,
2311
- configurable: true,
2312
- get() {
2313
- const {
2314
- stylesheetToken
2315
- } = this;
2316
- if (isUndefined$1(stylesheetToken)) {
2317
- return stylesheetToken;
2318
- }
2319
- return {
2320
- hostAttribute: `${stylesheetToken}-host`,
2321
- shadowAttribute: stylesheetToken
2322
- };
2323
- },
2324
- set(value) {
2325
- this.stylesheetToken = isUndefined$1(value) ? void 0 : value.shadowAttribute;
2326
- }
2327
- });
2328
2357
  return tpl;
2329
2358
  }
2330
2359
  function sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {
@@ -2353,7 +2382,7 @@ No further warnings will appear.`);
2353
2382
  const {
2354
2383
  setHook: setHook2
2355
2384
  } = vm;
2356
- newValue = reactiveMembrane.getReadOnlyProxy(newValue);
2385
+ newValue = getReadOnlyProxy(newValue);
2357
2386
  setHook2(vm.component, key, newValue);
2358
2387
  };
2359
2388
  }
@@ -2442,7 +2471,12 @@ No further warnings will appear.`);
2442
2471
  defineProperties(HTMLBridgeElement.prototype, descriptors);
2443
2472
  return HTMLBridgeElement;
2444
2473
  }
2445
- const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2474
+ const BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);
2475
+ {
2476
+ if (lwcRuntimeFlags.DISABLE_ARIA_REFLECTION_POLYFILL) {
2477
+ applyAriaReflection(BaseBridgeElement.prototype);
2478
+ }
2479
+ }
2446
2480
  freeze(BaseBridgeElement);
2447
2481
  seal(BaseBridgeElement.prototype);
2448
2482
  const swappedTemplateMap = new WeakMap();
@@ -2496,12 +2530,10 @@ No further warnings will appear.`);
2496
2530
  if (false) {
2497
2531
  throw new ReferenceError();
2498
2532
  }
2499
- if (runtimeFlags.ENABLE_HMR) {
2500
- const visited = new Set();
2501
- while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
2502
- visited.add(tpl);
2503
- tpl = swappedTemplateMap.get(tpl);
2504
- }
2533
+ const visited = new Set();
2534
+ while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {
2535
+ visited.add(tpl);
2536
+ tpl = swappedTemplateMap.get(tpl);
2505
2537
  }
2506
2538
  return tpl;
2507
2539
  }
@@ -2509,12 +2541,10 @@ No further warnings will appear.`);
2509
2541
  if (false) {
2510
2542
  throw new ReferenceError();
2511
2543
  }
2512
- if (runtimeFlags.ENABLE_HMR) {
2513
- const visited = new Set();
2514
- while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
2515
- visited.add(Ctor);
2516
- Ctor = swappedComponentMap.get(Ctor);
2517
- }
2544
+ const visited = new Set();
2545
+ while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {
2546
+ visited.add(Ctor);
2547
+ Ctor = swappedComponentMap.get(Ctor);
2518
2548
  }
2519
2549
  return Ctor;
2520
2550
  }
@@ -2522,12 +2552,10 @@ No further warnings will appear.`);
2522
2552
  if (false) {
2523
2553
  throw new ReferenceError();
2524
2554
  }
2525
- if (runtimeFlags.ENABLE_HMR) {
2526
- const visited = new Set();
2527
- while (swappedStyleMap.has(style) && !visited.has(style)) {
2528
- visited.add(style);
2529
- style = swappedStyleMap.get(style);
2530
- }
2555
+ const visited = new Set();
2556
+ while (swappedStyleMap.has(style) && !visited.has(style)) {
2557
+ visited.add(style);
2558
+ style = swappedStyleMap.get(style);
2531
2559
  }
2532
2560
  return style;
2533
2561
  }
@@ -2535,34 +2563,32 @@ No further warnings will appear.`);
2535
2563
  if (false) {
2536
2564
  throw new ReferenceError();
2537
2565
  }
2538
- if (runtimeFlags.ENABLE_HMR) {
2539
- const Ctor = vm.def.ctor;
2540
- let componentVMs = activeComponents.get(Ctor);
2541
- if (isUndefined$1(componentVMs)) {
2542
- componentVMs = new Set();
2543
- activeComponents.set(Ctor, componentVMs);
2544
- }
2545
- componentVMs.add(vm);
2546
- const tpl = vm.cmpTemplate;
2547
- if (tpl) {
2548
- let templateVMs = activeTemplates.get(tpl);
2549
- if (isUndefined$1(templateVMs)) {
2550
- templateVMs = new Set();
2551
- activeTemplates.set(tpl, templateVMs);
2552
- }
2553
- templateVMs.add(vm);
2554
- const stylesheets = tpl.stylesheets;
2555
- if (!isUndefined$1(stylesheets)) {
2556
- flattenStylesheets(stylesheets).forEach((stylesheet) => {
2557
- stylesheet = getStyleOrSwappedStyle(stylesheet);
2558
- let stylesheetVMs = activeStyles.get(stylesheet);
2559
- if (isUndefined$1(stylesheetVMs)) {
2560
- stylesheetVMs = new Set();
2561
- activeStyles.set(stylesheet, stylesheetVMs);
2562
- }
2563
- stylesheetVMs.add(vm);
2564
- });
2565
- }
2566
+ const Ctor = vm.def.ctor;
2567
+ let componentVMs = activeComponents.get(Ctor);
2568
+ if (isUndefined$1(componentVMs)) {
2569
+ componentVMs = new Set();
2570
+ activeComponents.set(Ctor, componentVMs);
2571
+ }
2572
+ componentVMs.add(vm);
2573
+ const tpl = vm.cmpTemplate;
2574
+ if (tpl) {
2575
+ let templateVMs = activeTemplates.get(tpl);
2576
+ if (isUndefined$1(templateVMs)) {
2577
+ templateVMs = new Set();
2578
+ activeTemplates.set(tpl, templateVMs);
2579
+ }
2580
+ templateVMs.add(vm);
2581
+ const stylesheets = tpl.stylesheets;
2582
+ if (!isUndefined$1(stylesheets)) {
2583
+ flattenStylesheets(stylesheets).forEach((stylesheet) => {
2584
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
2585
+ let stylesheetVMs = activeStyles.get(stylesheet);
2586
+ if (isUndefined$1(stylesheetVMs)) {
2587
+ stylesheetVMs = new Set();
2588
+ activeStyles.set(stylesheet, stylesheetVMs);
2589
+ }
2590
+ stylesheetVMs.add(vm);
2591
+ });
2566
2592
  }
2567
2593
  }
2568
2594
  }
@@ -2570,27 +2596,25 @@ No further warnings will appear.`);
2570
2596
  if (false) {
2571
2597
  throw new ReferenceError();
2572
2598
  }
2573
- if (runtimeFlags.ENABLE_HMR) {
2574
- const Ctor = vm.def.ctor;
2575
- let list = activeComponents.get(Ctor);
2599
+ const Ctor = vm.def.ctor;
2600
+ let list = activeComponents.get(Ctor);
2601
+ if (!isUndefined$1(list)) {
2602
+ list.delete(vm);
2603
+ }
2604
+ const tpl = vm.cmpTemplate;
2605
+ if (tpl) {
2606
+ list = activeTemplates.get(tpl);
2576
2607
  if (!isUndefined$1(list)) {
2577
2608
  list.delete(vm);
2578
2609
  }
2579
- const tpl = vm.cmpTemplate;
2580
- if (tpl) {
2581
- list = activeTemplates.get(tpl);
2582
- if (!isUndefined$1(list)) {
2583
- list.delete(vm);
2584
- }
2585
- const styles = tpl.stylesheets;
2586
- if (!isUndefined$1(styles)) {
2587
- flattenStylesheets(styles).forEach((style) => {
2588
- list = activeStyles.get(style);
2589
- if (!isUndefined$1(list)) {
2590
- list.delete(vm);
2591
- }
2592
- });
2593
- }
2610
+ const styles = tpl.stylesheets;
2611
+ if (!isUndefined$1(styles)) {
2612
+ flattenStylesheets(styles).forEach((style) => {
2613
+ list = activeStyles.get(style);
2614
+ if (!isUndefined$1(list)) {
2615
+ list.delete(vm);
2616
+ }
2617
+ });
2594
2618
  }
2595
2619
  }
2596
2620
  }
@@ -2603,9 +2627,6 @@ No further warnings will appear.`);
2603
2627
  throw new TypeError(`Invalid Template`);
2604
2628
  }
2605
2629
  }
2606
- if (!runtimeFlags.ENABLE_HMR) {
2607
- throw new Error("HMR is not enabled");
2608
- }
2609
2630
  return false;
2610
2631
  }
2611
2632
  function swapComponent(oldComponent, newComponent) {
@@ -2617,9 +2638,6 @@ No further warnings will appear.`);
2617
2638
  throw new TypeError(`Invalid Component`);
2618
2639
  }
2619
2640
  }
2620
- if (!runtimeFlags.ENABLE_HMR) {
2621
- throw new Error("HMR is not enabled");
2622
- }
2623
2641
  return false;
2624
2642
  }
2625
2643
  function swapStyle(oldStyle, newStyle) {
@@ -2627,9 +2645,6 @@ No further warnings will appear.`);
2627
2645
  swappedStyleMap.set(oldStyle, newStyle);
2628
2646
  return rehydrateHotStyle(oldStyle);
2629
2647
  }
2630
- if (!runtimeFlags.ENABLE_HMR) {
2631
- throw new Error("HMR is not enabled");
2632
- }
2633
2648
  return false;
2634
2649
  }
2635
2650
  const CtorToDefMap = new WeakMap();
@@ -2813,111 +2828,321 @@ No further warnings will appear.`);
2813
2828
  methods: publicMethods
2814
2829
  };
2815
2830
  }
2816
- function getUpgradableConstructor(tagName, renderer2) {
2817
- const {
2818
- getCustomElement: getCustomElement2,
2819
- HTMLElementExported: RendererHTMLElement,
2820
- defineCustomElement: defineCustomElement2
2821
- } = renderer2;
2822
- tagName = tagName.toLowerCase();
2823
- let CE = getCustomElement2(tagName);
2824
- if (!isUndefined$1(CE)) {
2825
- return CE;
2826
- }
2827
- CE = class LWCUpgradableElement extends RendererHTMLElement {
2828
- constructor(upgradeCallback) {
2829
- super();
2830
- if (isFunction$1(upgradeCallback)) {
2831
- upgradeCallback(this);
2832
- }
2831
+ function makeHostToken(token) {
2832
+ return `${token}-host`;
2833
+ }
2834
+ function createInlineStyleVNode(content) {
2835
+ return api.h("style", {
2836
+ key: "style",
2837
+ attrs: {
2838
+ type: "text/css"
2833
2839
  }
2834
- };
2835
- defineCustomElement2(tagName, CE);
2836
- return CE;
2840
+ }, [api.t(content)]);
2837
2841
  }
2838
- function isVBaseElement(vnode) {
2842
+ function updateStylesheetToken(vm, template) {
2839
2843
  const {
2840
- type
2841
- } = vnode;
2842
- return type === 2 || type === 3;
2843
- }
2844
- function isSameVnode(vnode1, vnode2) {
2845
- return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
2846
- }
2847
- const ColonCharCode = 58;
2848
- function patchAttributes(oldVnode, vnode, renderer2) {
2844
+ elm,
2845
+ context,
2846
+ renderMode,
2847
+ shadowMode,
2848
+ renderer: {
2849
+ getClassList,
2850
+ removeAttribute,
2851
+ setAttribute
2852
+ }
2853
+ } = vm;
2849
2854
  const {
2850
- attrs
2851
- } = vnode.data;
2852
- if (isUndefined$1(attrs)) {
2853
- return;
2854
- }
2855
- const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
2856
- if (oldAttrs === attrs) {
2857
- return;
2858
- }
2855
+ stylesheets: newStylesheets,
2856
+ stylesheetToken: newStylesheetToken
2857
+ } = template;
2858
+ const isSyntheticShadow = renderMode === 1 && shadowMode === 1;
2859
2859
  const {
2860
- elm
2861
- } = vnode;
2860
+ hasScopedStyles
2861
+ } = context;
2862
+ let newToken;
2863
+ let newHasTokenInClass;
2864
+ let newHasTokenInAttribute;
2862
2865
  const {
2863
- setAttribute: setAttribute2,
2864
- removeAttribute: removeAttribute2
2865
- } = renderer2;
2866
- for (const key in attrs) {
2867
- const cur = attrs[key];
2868
- const old = oldAttrs[key];
2869
- if (old !== cur) {
2870
- unlockAttribute(elm, key);
2871
- if (StringCharCodeAt.call(key, 3) === ColonCharCode) {
2872
- setAttribute2(elm, key, cur, XML_NAMESPACE);
2873
- } else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {
2874
- setAttribute2(elm, key, cur, XLINK_NAMESPACE);
2875
- } else if (isNull(cur) || isUndefined$1(cur)) {
2876
- removeAttribute2(elm, key);
2877
- } else {
2878
- setAttribute2(elm, key, cur);
2879
- }
2880
- lockAttribute();
2866
+ stylesheetToken: oldToken,
2867
+ hasTokenInClass: oldHasTokenInClass,
2868
+ hasTokenInAttribute: oldHasTokenInAttribute
2869
+ } = context;
2870
+ if (!isUndefined$1(oldToken)) {
2871
+ if (oldHasTokenInClass) {
2872
+ getClassList(elm).remove(makeHostToken(oldToken));
2873
+ }
2874
+ if (oldHasTokenInAttribute) {
2875
+ removeAttribute(elm, makeHostToken(oldToken));
2881
2876
  }
2882
2877
  }
2883
- }
2884
- function isLiveBindingProp(sel, key) {
2885
- return sel === "input" && (key === "value" || key === "checked");
2886
- }
2887
- function patchProps(oldVnode, vnode, renderer2) {
2888
- const {
2889
- props
2890
- } = vnode.data;
2891
- if (isUndefined$1(props)) {
2892
- return;
2893
- }
2894
- const oldProps = isNull(oldVnode) ? EmptyObject : oldVnode.data.props;
2895
- if (oldProps === props) {
2896
- return;
2878
+ if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
2879
+ newToken = newStylesheetToken;
2897
2880
  }
2898
- const isFirstPatch = isNull(oldVnode);
2899
- const {
2900
- elm,
2901
- sel
2902
- } = vnode;
2903
- const {
2904
- getProperty: getProperty2,
2905
- setProperty: setProperty2
2906
- } = renderer2;
2907
- for (const key in props) {
2908
- const cur = props[key];
2909
- if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty2(elm, key) : oldProps[key])) {
2910
- setProperty2(elm, key, cur);
2881
+ if (!isUndefined$1(newToken)) {
2882
+ if (hasScopedStyles) {
2883
+ getClassList(elm).add(makeHostToken(newToken));
2884
+ newHasTokenInClass = true;
2885
+ }
2886
+ if (isSyntheticShadow) {
2887
+ setAttribute(elm, makeHostToken(newToken), "");
2888
+ newHasTokenInAttribute = true;
2911
2889
  }
2912
2890
  }
2891
+ context.stylesheetToken = newToken;
2892
+ context.hasTokenInClass = newHasTokenInClass;
2893
+ context.hasTokenInAttribute = newHasTokenInAttribute;
2913
2894
  }
2914
- const classNameToClassMap = create(null);
2915
- function getMapFromClassName(className) {
2916
- if (className == null) {
2917
- return EmptyObject;
2918
- }
2919
- className = isString(className) ? className : className + "";
2920
- let map = classNameToClassMap[className];
2895
+ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
2896
+ const content = [];
2897
+ let root;
2898
+ for (let i2 = 0; i2 < stylesheets.length; i2++) {
2899
+ let stylesheet = stylesheets[i2];
2900
+ if (isArray$1(stylesheet)) {
2901
+ ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
2902
+ } else {
2903
+ if (true) {
2904
+ checkVersionMismatch(stylesheet, "stylesheet");
2905
+ stylesheet = getStyleOrSwappedStyle(stylesheet);
2906
+ }
2907
+ const isScopedCss = stylesheet[KEY__SCOPED_CSS];
2908
+ if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
2909
+ if (!isScopedCss && vm.renderMode === 0) {
2910
+ logError("Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).");
2911
+ continue;
2912
+ }
2913
+ }
2914
+ const scopeToken = isScopedCss || vm.shadowMode === 1 && vm.renderMode === 1 ? stylesheetToken : void 0;
2915
+ const useActualHostSelector = vm.renderMode === 0 ? !isScopedCss : vm.shadowMode === 0;
2916
+ let useNativeDirPseudoclass;
2917
+ if (vm.renderMode === 1) {
2918
+ useNativeDirPseudoclass = vm.shadowMode === 0;
2919
+ } else {
2920
+ if (isUndefined$1(root)) {
2921
+ root = getNearestShadowComponent(vm);
2922
+ }
2923
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0;
2924
+ }
2925
+ ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
2926
+ }
2927
+ }
2928
+ return content;
2929
+ }
2930
+ function getStylesheetsContent(vm, template) {
2931
+ const {
2932
+ stylesheets,
2933
+ stylesheetToken
2934
+ } = template;
2935
+ let content = [];
2936
+ if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
2937
+ content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
2938
+ }
2939
+ return content;
2940
+ }
2941
+ function getNearestShadowComponent(vm) {
2942
+ let owner = vm;
2943
+ while (!isNull(owner)) {
2944
+ if (owner.renderMode === 1) {
2945
+ return owner;
2946
+ }
2947
+ owner = owner.owner;
2948
+ }
2949
+ return owner;
2950
+ }
2951
+ function getScopeTokenClass(owner) {
2952
+ const {
2953
+ cmpTemplate,
2954
+ context
2955
+ } = owner;
2956
+ return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
2957
+ }
2958
+ function getStylesheetTokenHost(vnode) {
2959
+ const {
2960
+ template
2961
+ } = getComponentInternalDef(vnode.ctor);
2962
+ const {
2963
+ stylesheetToken
2964
+ } = template;
2965
+ return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
2966
+ }
2967
+ function getNearestNativeShadowComponent(vm) {
2968
+ const owner = getNearestShadowComponent(vm);
2969
+ if (!isNull(owner) && owner.shadowMode === 1) {
2970
+ return null;
2971
+ }
2972
+ return owner;
2973
+ }
2974
+ function createStylesheet(vm, stylesheets) {
2975
+ const {
2976
+ renderMode,
2977
+ shadowMode,
2978
+ renderer: {
2979
+ insertStylesheet: insertStylesheet2
2980
+ }
2981
+ } = vm;
2982
+ if (renderMode === 1 && shadowMode === 1) {
2983
+ for (let i2 = 0; i2 < stylesheets.length; i2++) {
2984
+ insertStylesheet2(stylesheets[i2]);
2985
+ }
2986
+ } else if (vm.hydrated) {
2987
+ return ArrayMap.call(stylesheets, createInlineStyleVNode);
2988
+ } else {
2989
+ const root = getNearestNativeShadowComponent(vm);
2990
+ const target = isNull(root) ? void 0 : root.shadowRoot;
2991
+ for (let i2 = 0; i2 < stylesheets.length; i2++) {
2992
+ insertStylesheet2(stylesheets[i2], target);
2993
+ }
2994
+ }
2995
+ return null;
2996
+ }
2997
+ function isVBaseElement(vnode) {
2998
+ const {
2999
+ type
3000
+ } = vnode;
3001
+ return type === 2 || type === 3;
3002
+ }
3003
+ function isSameVnode(vnode1, vnode2) {
3004
+ return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;
3005
+ }
3006
+ function isVCustomElement(vnode) {
3007
+ return vnode.type === 3;
3008
+ }
3009
+ function isVFragment(vnode) {
3010
+ return vnode.type === 5;
3011
+ }
3012
+ function isVScopedSlotFragment(vnode) {
3013
+ return vnode.type === 6;
3014
+ }
3015
+ const ColonCharCode$1 = 58;
3016
+ function patchAttributes(oldVnode, vnode, renderer2) {
3017
+ const {
3018
+ attrs
3019
+ } = vnode.data;
3020
+ if (isUndefined$1(attrs)) {
3021
+ return;
3022
+ }
3023
+ const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
3024
+ if (oldAttrs === attrs) {
3025
+ return;
3026
+ }
3027
+ const {
3028
+ elm
3029
+ } = vnode;
3030
+ const {
3031
+ setAttribute,
3032
+ removeAttribute
3033
+ } = renderer2;
3034
+ for (const key in attrs) {
3035
+ const cur = attrs[key];
3036
+ const old = oldAttrs[key];
3037
+ if (old !== cur) {
3038
+ unlockAttribute(elm, key);
3039
+ if (StringCharCodeAt.call(key, 3) === ColonCharCode$1) {
3040
+ setAttribute(elm, key, cur, XML_NAMESPACE);
3041
+ } else if (StringCharCodeAt.call(key, 5) === ColonCharCode$1) {
3042
+ setAttribute(elm, key, cur, XLINK_NAMESPACE);
3043
+ } else if (isNull(cur) || isUndefined$1(cur)) {
3044
+ removeAttribute(elm, key);
3045
+ } else {
3046
+ setAttribute(elm, key, cur);
3047
+ }
3048
+ lockAttribute();
3049
+ }
3050
+ }
3051
+ }
3052
+ const ColonCharCode = 58;
3053
+ function patchAttrUnlessProp(oldVnode, vnode, renderer2) {
3054
+ const {
3055
+ data: {
3056
+ attrs
3057
+ },
3058
+ elm
3059
+ } = vnode;
3060
+ if (isUndefined$1(attrs)) {
3061
+ return;
3062
+ }
3063
+ const {
3064
+ removeAttribute,
3065
+ setAttribute,
3066
+ setProperty
3067
+ } = renderer2;
3068
+ const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;
3069
+ for (const name in attrs) {
3070
+ const cur = attrs[name];
3071
+ const old = oldAttrs[name];
3072
+ if (old !== cur) {
3073
+ const propName = htmlAttributeToProperty(name);
3074
+ if (propName in elm) {
3075
+ setProperty(elm, name, cur);
3076
+ } else if (StringCharCodeAt.call(name, 3) === ColonCharCode) {
3077
+ setAttribute(elm, name, cur, XML_NAMESPACE);
3078
+ } else if (StringCharCodeAt.call(name, 5) === ColonCharCode) {
3079
+ setAttribute(elm, name, cur, XLINK_NAMESPACE);
3080
+ } else if (isNull(cur) || isUndefined$1(cur)) {
3081
+ removeAttribute(elm, name);
3082
+ } else {
3083
+ setAttribute(elm, name, cur);
3084
+ }
3085
+ }
3086
+ }
3087
+ }
3088
+ function isLiveBindingProp(sel, key) {
3089
+ return sel === "input" && (key === "value" || key === "checked");
3090
+ }
3091
+ function patchProps(oldVnode, vnode, renderer2) {
3092
+ let {
3093
+ props
3094
+ } = vnode.data;
3095
+ const {
3096
+ spread
3097
+ } = vnode.data;
3098
+ if (isUndefined$1(props) && isUndefined$1(spread)) {
3099
+ return;
3100
+ }
3101
+ let oldProps;
3102
+ if (!isNull(oldVnode)) {
3103
+ oldProps = oldVnode.data.props;
3104
+ const oldSpread = oldVnode.data.spread;
3105
+ if (oldProps === props && oldSpread === spread) {
3106
+ return;
3107
+ }
3108
+ if (isUndefined$1(oldProps)) {
3109
+ oldProps = EmptyObject;
3110
+ }
3111
+ if (!isUndefined$1(oldSpread)) {
3112
+ oldProps = assign({}, oldProps, oldSpread);
3113
+ }
3114
+ }
3115
+ if (!isUndefined$1(spread)) {
3116
+ props = assign({}, props, spread);
3117
+ }
3118
+ const isFirstPatch = isNull(oldVnode);
3119
+ const {
3120
+ elm,
3121
+ sel
3122
+ } = vnode;
3123
+ const {
3124
+ getProperty,
3125
+ setProperty
3126
+ } = renderer2;
3127
+ for (const key in props) {
3128
+ const cur = props[key];
3129
+ if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty(elm, key) : oldProps[key]) || !(key in oldProps)) {
3130
+ if (true) {
3131
+ if (!(key in elm)) {
3132
+ logWarn(`Unknown public property "${key}" of element <${elm.tagName.toLowerCase()}>. This is either a typo on the corresponding attribute "${htmlPropertyToAttribute(key)}", or the attribute does not exist in this browser or DOM implementation.`);
3133
+ }
3134
+ }
3135
+ setProperty(elm, key, cur);
3136
+ }
3137
+ }
3138
+ }
3139
+ const classNameToClassMap = create(null);
3140
+ function getMapFromClassName(className) {
3141
+ if (className == null) {
3142
+ return EmptyObject;
3143
+ }
3144
+ className = isString(className) ? className : className + "";
3145
+ let map = classNameToClassMap[className];
2921
3146
  if (map) {
2922
3147
  return map;
2923
3148
  }
@@ -2954,9 +3179,9 @@ No further warnings will appear.`);
2954
3179
  return;
2955
3180
  }
2956
3181
  const {
2957
- getClassList: getClassList2
3182
+ getClassList
2958
3183
  } = renderer2;
2959
- const classList = getClassList2(elm);
3184
+ const classList = getClassList(elm);
2960
3185
  const newClassMap = getMapFromClassName(newClass);
2961
3186
  const oldClassMap = getMapFromClassName(oldClass);
2962
3187
  let name;
@@ -2983,13 +3208,13 @@ No further warnings will appear.`);
2983
3208
  return;
2984
3209
  }
2985
3210
  const {
2986
- setAttribute: setAttribute2,
2987
- removeAttribute: removeAttribute2
3211
+ setAttribute,
3212
+ removeAttribute
2988
3213
  } = renderer2;
2989
3214
  if (!isString(newStyle) || newStyle === "") {
2990
- removeAttribute2(elm, "style");
3215
+ removeAttribute(elm, "style");
2991
3216
  } else {
2992
- setAttribute2(elm, "style", newStyle);
3217
+ setAttribute(elm, "style", newStyle);
2993
3218
  }
2994
3219
  }
2995
3220
  function applyEventListeners(vnode, renderer2) {
@@ -3003,11 +3228,11 @@ No further warnings will appear.`);
3003
3228
  return;
3004
3229
  }
3005
3230
  const {
3006
- addEventListener: addEventListener2
3231
+ addEventListener
3007
3232
  } = renderer2;
3008
3233
  for (const name in on) {
3009
3234
  const handler = on[name];
3010
- addEventListener2(elm, name, handler);
3235
+ addEventListener(elm, name, handler);
3011
3236
  }
3012
3237
  }
3013
3238
  function applyStaticClassAttribute(vnode, renderer2) {
@@ -3021,9 +3246,9 @@ No further warnings will appear.`);
3021
3246
  return;
3022
3247
  }
3023
3248
  const {
3024
- getClassList: getClassList2
3249
+ getClassList
3025
3250
  } = renderer2;
3026
- const classList = getClassList2(elm);
3251
+ const classList = getClassList(elm);
3027
3252
  for (const name in classMap) {
3028
3253
  classList.add(name);
3029
3254
  }
@@ -3039,11 +3264,11 @@ No further warnings will appear.`);
3039
3264
  return;
3040
3265
  }
3041
3266
  const {
3042
- setCSSStyleProperty: setCSSStyleProperty2
3267
+ setCSSStyleProperty
3043
3268
  } = renderer2;
3044
3269
  for (let i2 = 0; i2 < styleDecls.length; i2++) {
3045
3270
  const [prop, value, important] = styleDecls[i2];
3046
- setCSSStyleProperty2(elm, prop, value, important);
3271
+ setCSSStyleProperty(elm, prop, value, important);
3047
3272
  }
3048
3273
  }
3049
3274
  function patchChildren(c1, c2, parent, renderer2) {
@@ -3053,7 +3278,7 @@ No further warnings will appear.`);
3053
3278
  updateStaticChildren(c1, c2, parent, renderer2);
3054
3279
  }
3055
3280
  }
3056
- function patch(n1, n2, renderer2) {
3281
+ function patch(n1, n2, parent, renderer2) {
3057
3282
  var _a, _b;
3058
3283
  if (n1 === n2) {
3059
3284
  return;
@@ -3079,11 +3304,14 @@ No further warnings will appear.`);
3079
3304
  case 4:
3080
3305
  n2.elm = n1.elm;
3081
3306
  break;
3307
+ case 5:
3308
+ patchFragment(n1, n2, parent, renderer2);
3309
+ break;
3082
3310
  case 2:
3083
3311
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer2);
3084
3312
  break;
3085
3313
  case 3:
3086
- patchCustomElement(n1, n2, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer2);
3314
+ patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer2);
3087
3315
  break;
3088
3316
  }
3089
3317
  }
@@ -3099,6 +3327,9 @@ No further warnings will appear.`);
3099
3327
  case 4:
3100
3328
  mountStatic(node, parent, anchor, renderer2);
3101
3329
  break;
3330
+ case 5:
3331
+ mountFragment(node, parent, anchor, renderer2);
3332
+ break;
3102
3333
  case 2:
3103
3334
  mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer2);
3104
3335
  break;
@@ -3118,9 +3349,9 @@ No further warnings will appear.`);
3118
3349
  owner
3119
3350
  } = vnode;
3120
3351
  const {
3121
- createText: createText2
3352
+ createText
3122
3353
  } = renderer2;
3123
- const textNode = vnode.elm = createText2(vnode.text);
3354
+ const textNode = vnode.elm = createText(vnode.text);
3124
3355
  linkNodeToShadow(textNode, owner, renderer2);
3125
3356
  insertNode(textNode, parent, anchor, renderer2);
3126
3357
  }
@@ -3135,12 +3366,31 @@ No further warnings will appear.`);
3135
3366
  owner
3136
3367
  } = vnode;
3137
3368
  const {
3138
- createComment: createComment2
3369
+ createComment
3139
3370
  } = renderer2;
3140
- const commentNode = vnode.elm = createComment2(vnode.text);
3371
+ const commentNode = vnode.elm = createComment(vnode.text);
3141
3372
  linkNodeToShadow(commentNode, owner, renderer2);
3142
3373
  insertNode(commentNode, parent, anchor, renderer2);
3143
3374
  }
3375
+ function mountFragment(vnode, parent, anchor, renderer2) {
3376
+ const {
3377
+ children
3378
+ } = vnode;
3379
+ mountVNodes(children, parent, renderer2, anchor);
3380
+ vnode.elm = children[children.length - 1].elm;
3381
+ }
3382
+ function patchFragment(n1, n2, parent, renderer2) {
3383
+ const {
3384
+ children,
3385
+ stable
3386
+ } = n2;
3387
+ if (stable) {
3388
+ updateStaticChildren(n1.children, children, parent, renderer2);
3389
+ } else {
3390
+ updateDynamicChildren(n1.children, children, parent, renderer2);
3391
+ }
3392
+ n2.elm = children[children.length - 1].elm;
3393
+ }
3144
3394
  function mountElement(vnode, parent, anchor, renderer2) {
3145
3395
  const {
3146
3396
  sel,
@@ -3153,10 +3403,11 @@ No further warnings will appear.`);
3153
3403
  createElement: createElement2
3154
3404
  } = renderer2;
3155
3405
  const namespace = isTrue(svg) ? SVG_NAMESPACE : void 0;
3156
- const elm = createElement2(sel, namespace);
3406
+ const elm = vnode.elm = createElement2(sel, namespace);
3157
3407
  linkNodeToShadow(elm, owner, renderer2);
3158
- fallbackElmHook(elm, vnode, renderer2);
3159
- vnode.elm = elm;
3408
+ applyStyleScoping(elm, owner, renderer2);
3409
+ applyDomManual(elm, vnode);
3410
+ applyElementRestrictions(elm, vnode);
3160
3411
  patchElementPropsAndAttrs$1(null, vnode, renderer2);
3161
3412
  insertNode(elm, parent, anchor, renderer2);
3162
3413
  mountVNodes(vnode.children, elm, renderer2, null);
@@ -3171,27 +3422,21 @@ No further warnings will appear.`);
3171
3422
  owner
3172
3423
  } = vnode;
3173
3424
  const {
3174
- cloneNode: cloneNode2,
3175
- isSyntheticShadowDefined: isSyntheticShadowDefined2
3425
+ cloneNode,
3426
+ isSyntheticShadowDefined
3176
3427
  } = renderer2;
3177
- const elm = vnode.elm = cloneNode2(vnode.fragment, true);
3428
+ const elm = vnode.elm = cloneNode(vnode.fragment, true);
3178
3429
  linkNodeToShadow(elm, owner, renderer2);
3430
+ applyElementRestrictions(elm, vnode);
3179
3431
  const {
3180
3432
  renderMode,
3181
3433
  shadowMode
3182
3434
  } = owner;
3183
- if (isSyntheticShadowDefined2) {
3435
+ if (isSyntheticShadowDefined) {
3184
3436
  if (shadowMode === 1 || renderMode === 0) {
3185
3437
  elm[KEY__SHADOW_STATIC] = true;
3186
3438
  }
3187
3439
  }
3188
- if (true) {
3189
- const isLight = renderMode === 0;
3190
- patchElementWithRestrictions(elm, {
3191
- isPortal: false,
3192
- isLight
3193
- });
3194
- }
3195
3440
  insertNode(elm, parent, anchor, renderer2);
3196
3441
  }
3197
3442
  function mountCustomElement(vnode, parent, anchor, renderer2) {
@@ -3199,42 +3444,65 @@ No further warnings will appear.`);
3199
3444
  sel,
3200
3445
  owner
3201
3446
  } = vnode;
3202
- const UpgradableConstructor = getUpgradableConstructor(sel, renderer2);
3447
+ const {
3448
+ createCustomElement: createCustomElement2
3449
+ } = renderer2;
3203
3450
  let vm;
3204
- const elm = new UpgradableConstructor((elm2) => {
3451
+ const upgradeCallback = (elm2) => {
3205
3452
  vm = createViewModelHook(elm2, vnode, renderer2);
3206
- });
3207
- linkNodeToShadow(elm, owner, renderer2);
3453
+ };
3454
+ let connectedCallback;
3455
+ let disconnectedCallback;
3456
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3457
+ connectedCallback = (elm2) => {
3458
+ connectRootElement(elm2);
3459
+ };
3460
+ disconnectedCallback = (elm2) => {
3461
+ disconnectRootElement(elm2);
3462
+ };
3463
+ }
3464
+ const normalizedTagname = sel.toLowerCase();
3465
+ const elm = createCustomElement2(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
3208
3466
  vnode.elm = elm;
3209
3467
  vnode.vm = vm;
3468
+ linkNodeToShadow(elm, owner, renderer2);
3469
+ applyStyleScoping(elm, owner, renderer2);
3210
3470
  if (vm) {
3211
3471
  allocateChildren(vnode, vm);
3212
- } else if (vnode.ctor !== UpgradableConstructor) {
3213
- throw new TypeError(`Incorrect Component Constructor`);
3214
3472
  }
3215
3473
  patchElementPropsAndAttrs$1(null, vnode, renderer2);
3216
3474
  insertNode(elm, parent, anchor, renderer2);
3217
3475
  if (vm) {
3218
- if (true) {
3219
- assert.isTrue(vm.state === 0, `${vm} cannot be recycled.`);
3476
+ {
3477
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3478
+ if (true) {
3479
+ assert.isTrue(vm.state === 0, `${vm} cannot be recycled.`);
3480
+ }
3481
+ runConnectedCallback(vm);
3482
+ }
3220
3483
  }
3221
- runConnectedCallback(vm);
3222
3484
  }
3223
3485
  mountVNodes(vnode.children, elm, renderer2, null);
3224
3486
  if (vm) {
3225
3487
  appendVM(vm);
3226
3488
  }
3227
3489
  }
3228
- function patchCustomElement(n1, n2, renderer2) {
3229
- const elm = n2.elm = n1.elm;
3230
- const vm = n2.vm = n1.vm;
3231
- patchElementPropsAndAttrs$1(n1, n2, renderer2);
3232
- if (!isUndefined$1(vm)) {
3233
- allocateChildren(n2, vm);
3234
- }
3235
- patchChildren(n1.children, n2.children, elm, renderer2);
3236
- if (!isUndefined$1(vm)) {
3237
- rerenderVM(vm);
3490
+ function patchCustomElement(n1, n2, parent, renderer2) {
3491
+ if (n1.ctor !== n2.ctor) {
3492
+ const anchor = renderer2.nextSibling(n1.elm);
3493
+ unmount(n1, parent, renderer2, true);
3494
+ mountCustomElement(n2, parent, anchor, renderer2);
3495
+ } else {
3496
+ const elm = n2.elm = n1.elm;
3497
+ const vm = n2.vm = n1.vm;
3498
+ patchElementPropsAndAttrs$1(n1, n2, renderer2);
3499
+ if (!isUndefined$1(vm)) {
3500
+ allocateChildren(n2, vm);
3501
+ }
3502
+ patchChildren(n1.children, n2.children, elm, renderer2);
3503
+ if (!isUndefined$1(vm)) {
3504
+ rerenderVM(vm);
3505
+ }
3238
3506
  }
3239
3507
  }
3240
3508
  function mountVNodes(vnodes, parent, renderer2, anchor, start2 = 0, end2 = vnodes.length) {
@@ -3252,7 +3520,11 @@ No further warnings will appear.`);
3252
3520
  sel
3253
3521
  } = vnode;
3254
3522
  if (doRemove) {
3255
- removeNode(elm, parent, renderer2);
3523
+ if (type === 5) {
3524
+ unmountVNodes(vnode.children, parent, renderer2, doRemove);
3525
+ } else {
3526
+ removeNode(elm, parent, renderer2);
3527
+ }
3256
3528
  }
3257
3529
  switch (type) {
3258
3530
  case 2: {
@@ -3281,25 +3553,6 @@ No further warnings will appear.`);
3281
3553
  function isVNode(vnode) {
3282
3554
  return vnode != null;
3283
3555
  }
3284
- function observeElementChildNodes(elm) {
3285
- elm.$domManual$ = true;
3286
- }
3287
- function setElementShadowToken(elm, token) {
3288
- elm.$shadowToken$ = token;
3289
- }
3290
- function setScopeTokenClassIfNecessary(elm, owner, renderer2) {
3291
- const {
3292
- cmpTemplate,
3293
- context
3294
- } = owner;
3295
- const {
3296
- getClassList: getClassList2
3297
- } = renderer2;
3298
- const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;
3299
- if (!isUndefined$1(token) && context.hasScopedStyles) {
3300
- getClassList2(elm).add(token);
3301
- }
3302
- }
3303
3556
  function linkNodeToShadow(elm, owner, renderer2) {
3304
3557
  const {
3305
3558
  renderRoot,
@@ -3307,9 +3560,9 @@ No further warnings will appear.`);
3307
3560
  shadowMode
3308
3561
  } = owner;
3309
3562
  const {
3310
- isSyntheticShadowDefined: isSyntheticShadowDefined2
3563
+ isSyntheticShadowDefined
3311
3564
  } = renderer2;
3312
- if (isSyntheticShadowDefined2) {
3565
+ if (isSyntheticShadowDefined) {
3313
3566
  if (shadowMode === 1 || renderMode === 0) {
3314
3567
  elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
3315
3568
  }
@@ -3321,12 +3574,12 @@ No further warnings will appear.`);
3321
3574
  text
3322
3575
  } = vnode;
3323
3576
  const {
3324
- setText: setText2
3577
+ setText
3325
3578
  } = renderer2;
3326
3579
  if (true) {
3327
3580
  unlockDomMutation();
3328
3581
  }
3329
- setText2(elm, text);
3582
+ setText(elm, text);
3330
3583
  if (true) {
3331
3584
  lockDomMutation();
3332
3585
  }
@@ -3357,41 +3610,50 @@ No further warnings will appear.`);
3357
3610
  }
3358
3611
  patchClassAttribute(oldVnode, vnode, renderer2);
3359
3612
  patchStyleAttribute(oldVnode, vnode, renderer2);
3360
- patchAttributes(oldVnode, vnode, renderer2);
3613
+ if (vnode.data.external) {
3614
+ patchAttrUnlessProp(oldVnode, vnode, renderer2);
3615
+ } else {
3616
+ patchAttributes(oldVnode, vnode, renderer2);
3617
+ }
3361
3618
  patchProps(oldVnode, vnode, renderer2);
3362
3619
  }
3363
- function fallbackElmHook(elm, vnode, renderer2) {
3364
- const {
3365
- owner
3366
- } = vnode;
3367
- setScopeTokenClassIfNecessary(elm, owner, renderer2);
3368
- if (owner.shadowMode === 1) {
3369
- const {
3370
- data: {
3371
- context
3372
- }
3373
- } = vnode;
3620
+ function applyStyleScoping(elm, owner, renderer2) {
3621
+ const scopeToken = getScopeTokenClass(owner);
3622
+ if (!isNull(scopeToken)) {
3374
3623
  const {
3375
- stylesheetToken
3376
- } = owner.context;
3377
- if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual") {
3378
- observeElementChildNodes(elm);
3379
- }
3380
- if (!isUndefined$1(stylesheetToken)) {
3381
- setElementShadowToken(elm, stylesheetToken);
3382
- }
3624
+ getClassList
3625
+ } = renderer2;
3626
+ getClassList(elm).add(scopeToken);
3383
3627
  }
3384
- if (true) {
3385
- const {
3386
- data: {
3387
- context
3388
- }
3389
- } = vnode;
3390
- const isPortal = !isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === "manual";
3391
- const isLight = owner.renderMode === 0;
3628
+ const {
3629
+ stylesheetToken: syntheticToken
3630
+ } = owner.context;
3631
+ if (owner.shadowMode === 1 && !isUndefined$1(syntheticToken)) {
3632
+ elm.$shadowToken$ = syntheticToken;
3633
+ }
3634
+ }
3635
+ function applyDomManual(elm, vnode) {
3636
+ var _a;
3637
+ const {
3638
+ owner,
3639
+ data: {
3640
+ context
3641
+ }
3642
+ } = vnode;
3643
+ if (owner.shadowMode === 1 && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual") {
3644
+ elm.$domManual$ = true;
3645
+ }
3646
+ }
3647
+ function applyElementRestrictions(elm, vnode) {
3648
+ var _a, _b;
3649
+ if (true) {
3650
+ const isSynthetic = vnode.owner.shadowMode === 1;
3651
+ const isPortal = vnode.type === 2 && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual";
3652
+ const isLight = vnode.owner.renderMode === 0;
3392
3653
  patchElementWithRestrictions(elm, {
3393
3654
  isPortal,
3394
- isLight
3655
+ isLight,
3656
+ isSynthetic
3395
3657
  });
3396
3658
  }
3397
3659
  }
@@ -3402,8 +3664,13 @@ No further warnings will appear.`);
3402
3664
  renderMode,
3403
3665
  shadowMode
3404
3666
  } = vm;
3667
+ if (true) {
3668
+ if (renderMode !== 0 && ArraySome.call(children, (child) => !isNull(child) && isVScopedSlotFragment(child))) {
3669
+ logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
3670
+ }
3671
+ }
3405
3672
  if (shadowMode === 1 || renderMode === 0) {
3406
- allocateInSlot(vm, children);
3673
+ allocateInSlot(vm, children, vnode.owner);
3407
3674
  vnode.aChildren = children;
3408
3675
  vnode.children = EmptyArray;
3409
3676
  }
@@ -3419,15 +3686,6 @@ No further warnings will appear.`);
3419
3686
  ctor,
3420
3687
  owner
3421
3688
  } = vnode;
3422
- setScopeTokenClassIfNecessary(elm, owner, renderer2);
3423
- if (owner.shadowMode === 1) {
3424
- const {
3425
- stylesheetToken
3426
- } = owner.context;
3427
- if (!isUndefined$1(stylesheetToken)) {
3428
- setElementShadowToken(elm, stylesheetToken);
3429
- }
3430
- }
3431
3689
  vm = createVM(elm, ctor, renderer2, {
3432
3690
  mode,
3433
3691
  owner,
@@ -3438,39 +3696,54 @@ No further warnings will appear.`);
3438
3696
  }
3439
3697
  return vm;
3440
3698
  }
3441
- function allocateInSlot(vm, children) {
3442
- var _a;
3443
- const {
3444
- cmpSlots: oldSlots
3445
- } = vm;
3446
- const cmpSlots = vm.cmpSlots = create(null);
3699
+ function collectSlots(vm, children, cmpSlotsMapping) {
3700
+ var _a, _b;
3447
3701
  for (let i2 = 0, len = children.length; i2 < len; i2 += 1) {
3448
3702
  const vnode = children[i2];
3449
3703
  if (isNull(vnode)) {
3450
3704
  continue;
3451
3705
  }
3706
+ if (isVFragment(vnode)) {
3707
+ collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
3708
+ continue;
3709
+ }
3452
3710
  let slotName = "";
3453
3711
  if (isVBaseElement(vnode)) {
3454
- slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || "";
3712
+ slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : "";
3713
+ } else if (isVScopedSlotFragment(vnode)) {
3714
+ slotName = vnode.slotName;
3455
3715
  }
3456
- const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || [];
3716
+ const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
3457
3717
  ArrayPush$1.call(vnodes, vnode);
3458
3718
  }
3719
+ }
3720
+ function allocateInSlot(vm, children, owner) {
3721
+ const {
3722
+ cmpSlots: {
3723
+ slotAssignments: oldSlotsMapping
3724
+ }
3725
+ } = vm;
3726
+ const cmpSlotsMapping = create(null);
3727
+ collectSlots(vm, children, cmpSlotsMapping);
3728
+ vm.cmpSlots = {
3729
+ owner,
3730
+ slotAssignments: cmpSlotsMapping
3731
+ };
3459
3732
  if (isFalse(vm.isDirty)) {
3460
- const oldKeys = keys(oldSlots);
3461
- if (oldKeys.length !== keys(cmpSlots).length) {
3733
+ const oldKeys = keys(oldSlotsMapping);
3734
+ if (oldKeys.length !== keys(cmpSlotsMapping).length) {
3462
3735
  markComponentAsDirty(vm);
3463
3736
  return;
3464
3737
  }
3465
3738
  for (let i2 = 0, len = oldKeys.length; i2 < len; i2 += 1) {
3466
3739
  const key = oldKeys[i2];
3467
- if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {
3740
+ if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
3468
3741
  markComponentAsDirty(vm);
3469
3742
  return;
3470
3743
  }
3471
- const oldVNodes = oldSlots[key];
3472
- const vnodes = cmpSlots[key];
3473
- for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {
3744
+ const oldVNodes = oldSlotsMapping[key];
3745
+ const vnodes = cmpSlotsMapping[key];
3746
+ for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
3474
3747
  if (oldVNodes[j] !== vnodes[j]) {
3475
3748
  markComponentAsDirty(vm);
3476
3749
  return;
@@ -3526,20 +3799,20 @@ No further warnings will appear.`);
3526
3799
  } else if (!isVNode(newEndVnode)) {
3527
3800
  newEndVnode = newCh[--newEndIdx];
3528
3801
  } else if (isSameVnode(oldStartVnode, newStartVnode)) {
3529
- patch(oldStartVnode, newStartVnode, renderer2);
3802
+ patch(oldStartVnode, newStartVnode, parent, renderer2);
3530
3803
  oldStartVnode = oldCh[++oldStartIdx];
3531
3804
  newStartVnode = newCh[++newStartIdx];
3532
3805
  } else if (isSameVnode(oldEndVnode, newEndVnode)) {
3533
- patch(oldEndVnode, newEndVnode, renderer2);
3806
+ patch(oldEndVnode, newEndVnode, parent, renderer2);
3534
3807
  oldEndVnode = oldCh[--oldEndIdx];
3535
3808
  newEndVnode = newCh[--newEndIdx];
3536
3809
  } else if (isSameVnode(oldStartVnode, newEndVnode)) {
3537
- patch(oldStartVnode, newEndVnode, renderer2);
3810
+ patch(oldStartVnode, newEndVnode, parent, renderer2);
3538
3811
  insertNode(oldStartVnode.elm, parent, renderer2.nextSibling(oldEndVnode.elm), renderer2);
3539
3812
  oldStartVnode = oldCh[++oldStartIdx];
3540
3813
  newEndVnode = newCh[--newEndIdx];
3541
3814
  } else if (isSameVnode(oldEndVnode, newStartVnode)) {
3542
- patch(oldEndVnode, newStartVnode, renderer2);
3815
+ patch(oldEndVnode, newStartVnode, parent, renderer2);
3543
3816
  insertNode(newStartVnode.elm, parent, oldStartVnode.elm, renderer2);
3544
3817
  oldEndVnode = oldCh[--oldEndIdx];
3545
3818
  newStartVnode = newCh[++newStartIdx];
@@ -3557,7 +3830,7 @@ No further warnings will appear.`);
3557
3830
  if (elmToMove.sel !== newStartVnode.sel) {
3558
3831
  mount(newStartVnode, parent, renderer2, oldStartVnode.elm);
3559
3832
  } else {
3560
- patch(elmToMove, newStartVnode, renderer2);
3833
+ patch(elmToMove, newStartVnode, parent, renderer2);
3561
3834
  if (!clonedOldCh) {
3562
3835
  clonedOldCh = true;
3563
3836
  oldCh = [...oldCh];
@@ -3602,7 +3875,7 @@ No further warnings will appear.`);
3602
3875
  if (n2 !== n1) {
3603
3876
  if (isVNode(n1)) {
3604
3877
  if (isVNode(n2)) {
3605
- patch(n1, n2, renderer2);
3878
+ patch(n1, n2, parent, renderer2);
3606
3879
  anchor = n2.elm;
3607
3880
  } else {
3608
3881
  unmount(n1, parent, renderer2, true);
@@ -3618,6 +3891,17 @@ No further warnings will appear.`);
3618
3891
  function addVNodeToChildLWC(vnode) {
3619
3892
  ArrayPush$1.call(getVMBeingRendered().velements, vnode);
3620
3893
  }
3894
+ function ssf(slotName, factory) {
3895
+ return {
3896
+ type: 6,
3897
+ factory,
3898
+ owner: getVMBeingRendered(),
3899
+ elm: void 0,
3900
+ sel: void 0,
3901
+ key: void 0,
3902
+ slotName
3903
+ };
3904
+ }
3621
3905
  function st(fragment, key) {
3622
3906
  return {
3623
3907
  type: 4,
@@ -3628,6 +3912,17 @@ No further warnings will appear.`);
3628
3912
  owner: getVMBeingRendered()
3629
3913
  };
3630
3914
  }
3915
+ function fr(key, children, stable) {
3916
+ return {
3917
+ type: 5,
3918
+ sel: void 0,
3919
+ key,
3920
+ elm: void 0,
3921
+ children: [t(""), ...children, t("")],
3922
+ stable,
3923
+ owner: getVMBeingRendered()
3924
+ };
3925
+ }
3631
3926
  function h(sel, data, children = EmptyArray) {
3632
3927
  const vmBeingRendered2 = getVMBeingRendered();
3633
3928
  if (true) {
@@ -3646,19 +3941,23 @@ No further warnings will appear.`);
3646
3941
  }
3647
3942
  });
3648
3943
  }
3649
- let elm;
3650
3944
  const {
3651
- key
3945
+ key,
3946
+ ref
3652
3947
  } = data;
3653
- return {
3948
+ const vnode = {
3654
3949
  type: 2,
3655
3950
  sel,
3656
3951
  data,
3657
3952
  children,
3658
- elm,
3953
+ elm: void 0,
3659
3954
  key,
3660
3955
  owner: vmBeingRendered2
3661
3956
  };
3957
+ if (!isUndefined$1(ref)) {
3958
+ setRefVNode(vmBeingRendered2, ref, vnode);
3959
+ }
3960
+ return vnode;
3662
3961
  }
3663
3962
  function ti(value) {
3664
3963
  const shouldNormalize = value > 0 && !(isTrue(value) || isFalse(value));
@@ -3676,8 +3975,34 @@ No further warnings will appear.`);
3676
3975
  assert.isTrue(isObject(data), `s() 2nd argument data must be an object.`);
3677
3976
  assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);
3678
3977
  }
3679
- if (!isUndefined$1(slotset) && !isUndefined$1(slotset[slotName]) && slotset[slotName].length !== 0) {
3680
- children = slotset[slotName];
3978
+ if (!isUndefined$1(slotset) && !isUndefined$1(slotset.slotAssignments) && !isUndefined$1(slotset.slotAssignments[slotName]) && slotset.slotAssignments[slotName].length !== 0) {
3979
+ const newChildren = [];
3980
+ const slotAssignments = slotset.slotAssignments[slotName];
3981
+ for (let i2 = 0; i2 < slotAssignments.length; i2++) {
3982
+ const vnode = slotAssignments[i2];
3983
+ if (!isNull(vnode)) {
3984
+ const assignedNodeIsScopedSlot = isVScopedSlotFragment(vnode);
3985
+ const isScopedSlotElement = !isUndefined$1(data.slotData);
3986
+ if (assignedNodeIsScopedSlot !== isScopedSlotElement) {
3987
+ if (true) {
3988
+ logError(`Mismatched slot types for ${slotName === "" ? "(default)" : slotName} slot. Both parent and child component must use standard type or scoped type for a given slot.`, slotset.owner);
3989
+ }
3990
+ continue;
3991
+ }
3992
+ if (assignedNodeIsScopedSlot) {
3993
+ const vmBeingRenderedInception = getVMBeingRendered();
3994
+ setVMBeingRendered(slotset.owner);
3995
+ try {
3996
+ ArrayPush$1.call(newChildren, vnode.factory(data.slotData, data.key));
3997
+ } finally {
3998
+ setVMBeingRendered(vmBeingRenderedInception);
3999
+ }
4000
+ } else {
4001
+ ArrayPush$1.call(newChildren, vnode);
4002
+ }
4003
+ }
4004
+ }
4005
+ children = newChildren;
3681
4006
  }
3682
4007
  const vmBeingRendered2 = getVMBeingRendered();
3683
4008
  const {
@@ -3714,7 +4039,8 @@ No further warnings will appear.`);
3714
4039
  }
3715
4040
  }
3716
4041
  const {
3717
- key
4042
+ key,
4043
+ ref
3718
4044
  } = data;
3719
4045
  let elm, aChildren, vm;
3720
4046
  const vnode = {
@@ -3731,6 +4057,9 @@ No further warnings will appear.`);
3731
4057
  vm
3732
4058
  };
3733
4059
  addVNodeToChildLWC(vnode);
4060
+ if (!isUndefined$1(ref)) {
4061
+ setRefVNode(vmBeingRendered2, ref, vnode);
4062
+ }
3734
4063
  return vnode;
3735
4064
  }
3736
4065
  function i(iterable, factory) {
@@ -3827,13 +4156,13 @@ No further warnings will appear.`);
3827
4156
  };
3828
4157
  }
3829
4158
  function co(text) {
3830
- let sel, key, elm;
4159
+ let sel, elm;
3831
4160
  return {
3832
4161
  type: 1,
3833
4162
  sel,
3834
4163
  text,
3835
4164
  elm,
3836
- key,
4165
+ key: "c",
3837
4166
  owner: getVMBeingRendered()
3838
4167
  };
3839
4168
  }
@@ -3903,8 +4232,6 @@ No further warnings will appear.`);
3903
4232
  }
3904
4233
  return url;
3905
4234
  }
3906
- const DynamicImportedComponentMap = new Map();
3907
- let dynamicImportedComponentCounter = 0;
3908
4235
  function dc(sel, Ctor, data, children = EmptyArray) {
3909
4236
  if (true) {
3910
4237
  assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);
@@ -3917,15 +4244,7 @@ No further warnings will appear.`);
3917
4244
  if (!isComponentConstructor(Ctor)) {
3918
4245
  throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);
3919
4246
  }
3920
- let idx2 = DynamicImportedComponentMap.get(Ctor);
3921
- if (isUndefined$1(idx2)) {
3922
- idx2 = dynamicImportedComponentCounter++;
3923
- DynamicImportedComponentMap.set(Ctor, idx2);
3924
- }
3925
- const newData = Object.assign(Object.assign({}, data), {
3926
- key: `dc:${idx2}:${data.key}`
3927
- });
3928
- return c(sel, Ctor, newData, children);
4247
+ return c(sel, Ctor, data, children);
3929
4248
  }
3930
4249
  function sc(vnodes) {
3931
4250
  if (true) {
@@ -3955,157 +4274,14 @@ No further warnings will appear.`);
3955
4274
  k,
3956
4275
  co,
3957
4276
  dc,
4277
+ fr,
3958
4278
  ti,
3959
4279
  st,
3960
4280
  gid,
3961
4281
  fid,
3962
- shc
4282
+ shc,
4283
+ ssf
3963
4284
  });
3964
- function makeHostToken(token) {
3965
- return `${token}-host`;
3966
- }
3967
- function createInlineStyleVNode(content) {
3968
- return api.h("style", {
3969
- key: "style",
3970
- attrs: {
3971
- type: "text/css"
3972
- }
3973
- }, [api.t(content)]);
3974
- }
3975
- function updateStylesheetToken(vm, template) {
3976
- const {
3977
- elm,
3978
- context,
3979
- renderMode,
3980
- shadowMode,
3981
- renderer: {
3982
- getClassList: getClassList2,
3983
- removeAttribute: removeAttribute2,
3984
- setAttribute: setAttribute2
3985
- }
3986
- } = vm;
3987
- const {
3988
- stylesheets: newStylesheets,
3989
- stylesheetToken: newStylesheetToken
3990
- } = template;
3991
- const isSyntheticShadow = renderMode === 1 && shadowMode === 1;
3992
- const {
3993
- hasScopedStyles
3994
- } = context;
3995
- let newToken;
3996
- let newHasTokenInClass;
3997
- let newHasTokenInAttribute;
3998
- const {
3999
- stylesheetToken: oldToken,
4000
- hasTokenInClass: oldHasTokenInClass,
4001
- hasTokenInAttribute: oldHasTokenInAttribute
4002
- } = context;
4003
- if (!isUndefined$1(oldToken)) {
4004
- if (oldHasTokenInClass) {
4005
- getClassList2(elm).remove(makeHostToken(oldToken));
4006
- }
4007
- if (oldHasTokenInAttribute) {
4008
- removeAttribute2(elm, makeHostToken(oldToken));
4009
- }
4010
- }
4011
- if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
4012
- newToken = newStylesheetToken;
4013
- }
4014
- if (!isUndefined$1(newToken)) {
4015
- if (hasScopedStyles) {
4016
- getClassList2(elm).add(makeHostToken(newToken));
4017
- newHasTokenInClass = true;
4018
- }
4019
- if (isSyntheticShadow) {
4020
- setAttribute2(elm, makeHostToken(newToken), "");
4021
- newHasTokenInAttribute = true;
4022
- }
4023
- }
4024
- context.stylesheetToken = newToken;
4025
- context.hasTokenInClass = newHasTokenInClass;
4026
- context.hasTokenInAttribute = newHasTokenInAttribute;
4027
- }
4028
- function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
4029
- const content = [];
4030
- let root;
4031
- for (let i2 = 0; i2 < stylesheets.length; i2++) {
4032
- let stylesheet = stylesheets[i2];
4033
- if (isArray$1(stylesheet)) {
4034
- ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
4035
- } else {
4036
- if (true) {
4037
- checkVersionMismatch(stylesheet, "stylesheet");
4038
- stylesheet = getStyleOrSwappedStyle(stylesheet);
4039
- }
4040
- const isScopedCss = stylesheet[KEY__SCOPED_CSS];
4041
- const scopeToken = isScopedCss || vm.shadowMode === 1 && vm.renderMode === 1 ? stylesheetToken : void 0;
4042
- const useActualHostSelector = vm.renderMode === 0 ? !isScopedCss : vm.shadowMode === 0;
4043
- let useNativeDirPseudoclass;
4044
- if (vm.renderMode === 1) {
4045
- useNativeDirPseudoclass = vm.shadowMode === 0;
4046
- } else {
4047
- if (isUndefined$1(root)) {
4048
- root = getNearestShadowComponent(vm);
4049
- }
4050
- useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0;
4051
- }
4052
- ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
4053
- }
4054
- }
4055
- return content;
4056
- }
4057
- function getStylesheetsContent(vm, template) {
4058
- const {
4059
- stylesheets,
4060
- stylesheetToken
4061
- } = template;
4062
- let content = [];
4063
- if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
4064
- content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
4065
- }
4066
- return content;
4067
- }
4068
- function getNearestShadowComponent(vm) {
4069
- let owner = vm;
4070
- while (!isNull(owner)) {
4071
- if (owner.renderMode === 1) {
4072
- return owner;
4073
- }
4074
- owner = owner.owner;
4075
- }
4076
- return owner;
4077
- }
4078
- function getNearestNativeShadowComponent(vm) {
4079
- const owner = getNearestShadowComponent(vm);
4080
- if (!isNull(owner) && owner.shadowMode === 1) {
4081
- return null;
4082
- }
4083
- return owner;
4084
- }
4085
- function createStylesheet(vm, stylesheets) {
4086
- const {
4087
- renderMode,
4088
- shadowMode,
4089
- renderer: {
4090
- ssr: ssr2,
4091
- insertStylesheet: insertStylesheet2
4092
- }
4093
- } = vm;
4094
- if (renderMode === 1 && shadowMode === 1) {
4095
- for (let i2 = 0; i2 < stylesheets.length; i2++) {
4096
- insertStylesheet2(stylesheets[i2]);
4097
- }
4098
- } else if (ssr2 || vm.hydrated) {
4099
- return ArrayMap.call(stylesheets, createInlineStyleVNode);
4100
- } else {
4101
- const root = getNearestNativeShadowComponent(vm);
4102
- const target = isNull(root) ? void 0 : root.shadowRoot;
4103
- for (let i2 = 0; i2 < stylesheets.length; i2++) {
4104
- insertStylesheet2(stylesheets[i2], target);
4105
- }
4106
- }
4107
- return null;
4108
- }
4109
4285
  const operationIdNameMapping = ["constructor", "render", "patch", "connectedCallback", "renderedCallback", "disconnectedCallback", "errorCallback", "lwc-hydrate", "lwc-rehydrate"];
4110
4286
  const isUserTimingSupported = typeof performance !== "undefined" && typeof performance.mark === "function" && typeof performance.clearMarks === "function" && typeof performance.measure === "function" && typeof performance.clearMeasures === "function";
4111
4287
  const start = !isUserTimingSupported ? noop : (markName) => {
@@ -4203,8 +4379,8 @@ No further warnings will appear.`);
4203
4379
  const {
4204
4380
  slots = EmptyArray
4205
4381
  } = html;
4206
- for (const slotName in cmpSlots) {
4207
- assert.isTrue(isArray$1(cmpSlots[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots[slotName])} for slot "${slotName}" in ${vm}.`);
4382
+ for (const slotName in cmpSlots.slotAssignments) {
4383
+ assert.isTrue(isArray$1(cmpSlots.slotAssignments[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots.slotAssignments[slotName])} for slot "${slotName}" in ${vm}.`);
4208
4384
  if (slotName !== "" && ArrayIndexOf.call(slots, slotName) === -1) {
4209
4385
  logError(`Ignoring unknown provided slot name "${slotName}" in ${vm}. Check for a typo on the slot attribute.`, vm);
4210
4386
  }
@@ -4271,17 +4447,17 @@ No further warnings will appear.`);
4271
4447
  }
4272
4448
  const parseFragment = buildParseFragmentFn((html, renderer2) => {
4273
4449
  const {
4274
- createFragment: createFragment2
4450
+ createFragment
4275
4451
  } = renderer2;
4276
- return createFragment2(html);
4452
+ return createFragment(html);
4277
4453
  });
4278
4454
  const parseSVGFragment = buildParseFragmentFn((html, renderer2) => {
4279
4455
  const {
4280
- createFragment: createFragment2,
4281
- getFirstChild: getFirstChild2
4456
+ createFragment,
4457
+ getFirstChild
4282
4458
  } = renderer2;
4283
- const fragment = createFragment2("<svg>" + html + "</svg>");
4284
- return getFirstChild2(fragment);
4459
+ const fragment = createFragment("<svg>" + html + "</svg>");
4460
+ return getFirstChild(fragment);
4285
4461
  });
4286
4462
  function evaluateTemplate(vm, html) {
4287
4463
  if (true) {
@@ -4324,6 +4500,9 @@ No further warnings will appear.`);
4324
4500
  validateSlots(vm, html);
4325
4501
  setActiveVM(vm);
4326
4502
  }
4503
+ const hasRefVNodes = Boolean(html.hasRefs);
4504
+ vm.hasRefVNodes = hasRefVNodes;
4505
+ vm.refVNodes = hasRefVNodes ? create(null) : null;
4327
4506
  vm.velements = [];
4328
4507
  isUpdatingTemplate = true;
4329
4508
  vnodes = html.call(void 0, api, component, cmpSlots, context.tplCache);
@@ -4448,7 +4627,7 @@ No further warnings will appear.`);
4448
4627
  return signedTemplateMap.get(Ctor);
4449
4628
  }
4450
4629
  function getTemplateReactiveObserver(vm) {
4451
- return new ReactiveObserver(() => {
4630
+ return createReactiveObserver(() => {
4452
4631
  const {
4453
4632
  isDirty
4454
4633
  } = vm;
@@ -4558,13 +4737,9 @@ No further warnings will appear.`);
4558
4737
  } = vm;
4559
4738
  if (state !== 2) {
4560
4739
  const {
4561
- oar,
4562
4740
  tro
4563
4741
  } = vm;
4564
4742
  tro.reset();
4565
- for (const key in oar) {
4566
- oar[key].reset();
4567
- }
4568
4743
  runDisconnectedCallback(vm);
4569
4744
  runChildNodesDisconnectedCallback(vm);
4570
4745
  runLightChildNodesDisconnectedCallback(vm);
@@ -4604,13 +4779,16 @@ No further warnings will appear.`);
4604
4779
  tagName,
4605
4780
  mode,
4606
4781
  owner,
4782
+ refVNodes: null,
4783
+ hasRefVNodes: false,
4607
4784
  children: EmptyArray,
4608
4785
  aChildren: EmptyArray,
4609
4786
  velements: EmptyArray,
4610
4787
  cmpProps: create(null),
4611
4788
  cmpFields: create(null),
4612
- cmpSlots: create(null),
4613
- oar: create(null),
4789
+ cmpSlots: {
4790
+ slotAssignments: create(null)
4791
+ },
4614
4792
  cmpTemplate: null,
4615
4793
  hydrated: Boolean(hydrated),
4616
4794
  renderMode: def.renderMode,
@@ -4634,13 +4812,16 @@ No further warnings will appear.`);
4634
4812
  getHook,
4635
4813
  renderer: renderer2
4636
4814
  };
4815
+ if (true) {
4816
+ vm.debugInfo = create(null);
4817
+ }
4637
4818
  vm.shadowMode = computeShadowMode(vm, renderer2);
4638
4819
  vm.tro = getTemplateReactiveObserver(vm);
4639
4820
  if (true) {
4640
4821
  vm.toString = () => {
4641
4822
  return `[object:vm ${def.name} (${vm.idx})]`;
4642
4823
  };
4643
- if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
4824
+ if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
4644
4825
  vm.shadowMode = 0;
4645
4826
  }
4646
4827
  }
@@ -4655,15 +4836,15 @@ No further warnings will appear.`);
4655
4836
  def
4656
4837
  } = vm;
4657
4838
  const {
4658
- isSyntheticShadowDefined: isSyntheticShadowDefined2,
4659
- isNativeShadowDefined: isNativeShadowDefined2
4839
+ isSyntheticShadowDefined,
4840
+ isNativeShadowDefined
4660
4841
  } = renderer2;
4661
4842
  let shadowMode;
4662
- if (isSyntheticShadowDefined2) {
4843
+ if (isSyntheticShadowDefined) {
4663
4844
  if (def.renderMode === 0) {
4664
4845
  shadowMode = 0;
4665
- } else if (isNativeShadowDefined2) {
4666
- if (runtimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4846
+ } else if (isNativeShadowDefined) {
4847
+ if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4667
4848
  if (def.shadowSupportMode === "any") {
4668
4849
  shadowMode = 0;
4669
4850
  } else {
@@ -4741,14 +4922,8 @@ No further warnings will appear.`);
4741
4922
  const {
4742
4923
  def: {
4743
4924
  renderedCallback
4744
- },
4745
- renderer: {
4746
- ssr: ssr2
4747
4925
  }
4748
4926
  } = vm;
4749
- if (isTrue(ssr2)) {
4750
- return;
4751
- }
4752
4927
  const {
4753
4928
  rendered
4754
4929
  } = Services;
@@ -4885,13 +5060,13 @@ No further warnings will appear.`);
4885
5060
  children,
4886
5061
  renderRoot,
4887
5062
  renderer: {
4888
- remove: remove2
5063
+ remove
4889
5064
  }
4890
5065
  } = vm;
4891
5066
  for (let i2 = 0, len = children.length; i2 < len; i2++) {
4892
5067
  const child = children[i2];
4893
5068
  if (!isNull(child) && !isUndefined$1(child.elm)) {
4894
- remove2(child.elm, renderRoot);
5069
+ remove(child.elm, renderRoot);
4895
5070
  }
4896
5071
  }
4897
5072
  vm.children = EmptyArray;
@@ -4899,12 +5074,7 @@ No further warnings will appear.`);
4899
5074
  vm.velements = EmptyArray;
4900
5075
  }
4901
5076
  function scheduleRehydration(vm) {
4902
- const {
4903
- renderer: {
4904
- ssr: ssr2
4905
- }
4906
- } = vm;
4907
- if (isTrue(ssr2) || isTrue(vm.isScheduled)) {
5077
+ if (isTrue(vm.isScheduled)) {
4908
5078
  return;
4909
5079
  }
4910
5080
  vm.isScheduled = true;
@@ -4954,6 +5124,7 @@ No further warnings will appear.`);
4954
5124
  }
4955
5125
  const DeprecatedWiredElementHost = "$$DeprecatedWiredElementHostKey$$";
4956
5126
  const DeprecatedWiredParamsMeta = "$$DeprecatedWiredParamsMetaKey$$";
5127
+ const WIRE_DEBUG_ENTRY = "@wire";
4957
5128
  const WireMetaMap = new Map();
4958
5129
  class WireContextRegistrationEvent extends CustomEvent {
4959
5130
  constructor(adapterToken, {
@@ -4975,14 +5146,8 @@ No further warnings will appear.`);
4975
5146
  }
4976
5147
  }
4977
5148
  function createFieldDataCallback(vm, name) {
4978
- const {
4979
- cmpFields
4980
- } = vm;
4981
5149
  return (value) => {
4982
- if (value !== vm.cmpFields[name]) {
4983
- cmpFields[name] = value;
4984
- componentValueMutated(vm, name);
4985
- }
5150
+ updateComponentValue(vm, name, value);
4986
5151
  };
4987
5152
  }
4988
5153
  function createMethodDataCallback(vm, method) {
@@ -4994,7 +5159,7 @@ No further warnings will appear.`);
4994
5159
  }
4995
5160
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
4996
5161
  let hasPendingConfig = false;
4997
- const ro = new ReactiveObserver(() => {
5162
+ const ro = createReactiveObserver(() => {
4998
5163
  if (hasPendingConfig === false) {
4999
5164
  hasPendingConfig = true;
5000
5165
  Promise.resolve().then(() => {
@@ -5029,7 +5194,7 @@ No further warnings will appear.`);
5029
5194
  wiredDisconnecting
5030
5195
  },
5031
5196
  renderer: {
5032
- dispatchEvent: dispatchEvent2
5197
+ dispatchEvent
5033
5198
  }
5034
5199
  } = vm;
5035
5200
  ArrayPush$1.call(wiredConnecting, () => {
@@ -5041,7 +5206,7 @@ No further warnings will appear.`);
5041
5206
  ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
5042
5207
  }
5043
5208
  });
5044
- dispatchEvent2(elm, contextRegistrationEvent);
5209
+ dispatchEvent(elm, contextRegistrationEvent);
5045
5210
  });
5046
5211
  }
5047
5212
  function createConnector(vm, name, wireDef) {
@@ -5051,7 +5216,21 @@ No further warnings will appear.`);
5051
5216
  configCallback,
5052
5217
  dynamic
5053
5218
  } = wireDef;
5054
- const dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
5219
+ let debugInfo;
5220
+ if (true) {
5221
+ const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
5222
+ debugInfo = create(null);
5223
+ debugInfo.wasDataProvisionedForConfig = false;
5224
+ vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
5225
+ }
5226
+ const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
5227
+ const dataCallback = (value) => {
5228
+ if (true) {
5229
+ debugInfo.data = value;
5230
+ debugInfo.wasDataProvisionedForConfig = true;
5231
+ }
5232
+ fieldOrMethodCallback(value);
5233
+ };
5055
5234
  let context;
5056
5235
  let connector;
5057
5236
  defineProperty(dataCallback, DeprecatedWiredElementHost, {
@@ -5065,6 +5244,11 @@ No further warnings will appear.`);
5065
5244
  }, noop);
5066
5245
  const updateConnectorConfig = (config) => {
5067
5246
  runWithBoundaryProtection(vm, vm, noop, () => {
5247
+ if (true) {
5248
+ debugInfo.config = config;
5249
+ debugInfo.context = context;
5250
+ debugInfo.wasDataProvisionedForConfig = false;
5251
+ }
5068
5252
  connector.update(config, context);
5069
5253
  }, noop);
5070
5254
  };
@@ -5126,6 +5310,9 @@ No further warnings will appear.`);
5126
5310
  wire: wire2
5127
5311
  }
5128
5312
  } = vm;
5313
+ if (true) {
5314
+ vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
5315
+ }
5129
5316
  const wiredConnecting = context.wiredConnecting = [];
5130
5317
  const wiredDisconnecting = context.wiredDisconnecting = [];
5131
5318
  for (const fieldNameOrMethod in wire2) {
@@ -5143,7 +5330,7 @@ No further warnings will appear.`);
5143
5330
  const hasDynamicParams = wireDef.dynamic.length > 0;
5144
5331
  ArrayPush$1.call(wiredConnecting, () => {
5145
5332
  connector.connect();
5146
- if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5333
+ if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5147
5334
  if (hasDynamicParams) {
5148
5335
  Promise.resolve().then(computeConfigAndUpdate);
5149
5336
  return;
@@ -5220,7 +5407,7 @@ No further warnings will appear.`);
5220
5407
  assert.fail("@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.");
5221
5408
  }
5222
5409
  }
5223
- return reactiveMembrane.getReadOnlyProxy(obj);
5410
+ return getReadOnlyProxy(obj);
5224
5411
  }
5225
5412
  let hasMismatch = false;
5226
5413
  function hydrateRoot(vm) {
@@ -5237,10 +5424,10 @@ No further warnings will appear.`);
5237
5424
  const {
5238
5425
  renderRoot: parentNode,
5239
5426
  renderer: {
5240
- getFirstChild: getFirstChild2
5427
+ getFirstChild
5241
5428
  }
5242
5429
  } = vm;
5243
- hydrateChildren(getFirstChild2(parentNode), children, parentNode, vm);
5430
+ hydrateChildren(getFirstChild(parentNode), children, parentNode, vm);
5244
5431
  runRenderedCallback(vm);
5245
5432
  }
5246
5433
  function hydrateNode(node, vnode, renderer2) {
@@ -5256,6 +5443,9 @@ No further warnings will appear.`);
5256
5443
  case 4:
5257
5444
  hydratedNode = hydrateStaticElement(node, vnode, renderer2);
5258
5445
  break;
5446
+ case 5:
5447
+ hydratedNode = hydrateFragment(node, vnode, renderer2);
5448
+ break;
5259
5449
  case 2:
5260
5450
  hydratedNode = hydrateElement(node, vnode, (_a = vnode.data.renderer) !== null && _a !== void 0 ? _a : renderer2);
5261
5451
  break;
@@ -5265,6 +5455,7 @@ No further warnings will appear.`);
5265
5455
  }
5266
5456
  return renderer2.nextSibling(hydratedNode);
5267
5457
  }
5458
+ const NODE_VALUE_PROP = "nodeValue";
5268
5459
  function hydrateText(node, vnode, renderer2) {
5269
5460
  var _a;
5270
5461
  if (!hasCorrectNodeType(vnode, node, 3, renderer2)) {
@@ -5272,17 +5463,17 @@ No further warnings will appear.`);
5272
5463
  }
5273
5464
  if (true) {
5274
5465
  const {
5275
- getProperty: getProperty2
5466
+ getProperty
5276
5467
  } = renderer2;
5277
- const nodeValue = getProperty2(node, "nodeValue");
5468
+ const nodeValue = getProperty(node, NODE_VALUE_PROP);
5278
5469
  if (nodeValue !== vnode.text && !(nodeValue === "\u200D" && vnode.text === "")) {
5279
5470
  logWarn("Hydration mismatch: text values do not match, will recover from the difference", vnode.owner);
5280
5471
  }
5281
5472
  }
5282
5473
  const {
5283
- setText: setText2
5474
+ setText
5284
5475
  } = renderer2;
5285
- setText2(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5476
+ setText(node, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5286
5477
  vnode.elm = node;
5287
5478
  return node;
5288
5479
  }
@@ -5293,17 +5484,17 @@ No further warnings will appear.`);
5293
5484
  }
5294
5485
  if (true) {
5295
5486
  const {
5296
- getProperty: getProperty2
5487
+ getProperty
5297
5488
  } = renderer2;
5298
- const nodeValue = getProperty2(node, "nodeValue");
5489
+ const nodeValue = getProperty(node, NODE_VALUE_PROP);
5299
5490
  if (nodeValue !== vnode.text) {
5300
5491
  logWarn("Hydration mismatch: comment values do not match, will recover from the difference", vnode.owner);
5301
5492
  }
5302
5493
  }
5303
5494
  const {
5304
- setProperty: setProperty2
5495
+ setProperty
5305
5496
  } = renderer2;
5306
- setProperty2(node, "nodeValue", (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5497
+ setProperty(node, NODE_VALUE_PROP, (_a = vnode.text) !== null && _a !== void 0 ? _a : null);
5307
5498
  vnode.elm = node;
5308
5499
  return node;
5309
5500
  }
@@ -5314,6 +5505,14 @@ No further warnings will appear.`);
5314
5505
  vnode.elm = elm;
5315
5506
  return elm;
5316
5507
  }
5508
+ function hydrateFragment(elm, vnode, renderer2) {
5509
+ const {
5510
+ children,
5511
+ owner
5512
+ } = vnode;
5513
+ hydrateChildren(elm, children, renderer2.getProperty(elm, "parentNode"), owner);
5514
+ return vnode.elm = children[children.length - 1].elm;
5515
+ }
5317
5516
  function hydrateElement(elm, vnode, renderer2) {
5318
5517
  if (!hasCorrectNodeType(vnode, elm, 1, renderer2) || !isMatchingElement(vnode, elm, renderer2)) {
5319
5518
  return handleMismatch(elm, vnode, renderer2);
@@ -5333,16 +5532,16 @@ No further warnings will appear.`);
5333
5532
  }
5334
5533
  } = vnode;
5335
5534
  const {
5336
- getProperty: getProperty2
5535
+ getProperty
5337
5536
  } = renderer2;
5338
5537
  if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {
5339
- if (getProperty2(elm, "innerHTML") === props.innerHTML) {
5538
+ if (getProperty(elm, "innerHTML") === props.innerHTML) {
5340
5539
  vnode.data = Object.assign(Object.assign({}, vnode.data), {
5341
5540
  props: cloneAndOmitKey(props, "innerHTML")
5342
5541
  });
5343
5542
  } else {
5344
5543
  if (true) {
5345
- logWarn(`Mismatch hydrating element <${getProperty2(elm, "tagName").toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
5544
+ logWarn(`Mismatch hydrating element <${getProperty(elm, "tagName").toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, owner);
5346
5545
  }
5347
5546
  }
5348
5547
  }
@@ -5350,9 +5549,9 @@ No further warnings will appear.`);
5350
5549
  patchElementPropsAndAttrs(vnode, renderer2);
5351
5550
  if (!isDomManual) {
5352
5551
  const {
5353
- getFirstChild: getFirstChild2
5552
+ getFirstChild
5354
5553
  } = renderer2;
5355
- hydrateChildren(getFirstChild2(elm), vnode.children, elm, owner);
5554
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, owner);
5356
5555
  }
5357
5556
  return elm;
5358
5557
  }
@@ -5382,9 +5581,9 @@ No further warnings will appear.`);
5382
5581
  runConnectedCallback(vm);
5383
5582
  if (vm.renderMode !== 0) {
5384
5583
  const {
5385
- getFirstChild: getFirstChild2
5584
+ getFirstChild
5386
5585
  } = renderer2;
5387
- hydrateChildren(getFirstChild2(elm), vnode.children, elm, vm);
5586
+ hydrateChildren(getFirstChild(elm), vnode.children, elm, vm);
5388
5587
  }
5389
5588
  hydrateVM(vm);
5390
5589
  return elm;
@@ -5423,11 +5622,11 @@ No further warnings will appear.`);
5423
5622
  }
5424
5623
  }
5425
5624
  const {
5426
- nextSibling: nextSibling2
5625
+ nextSibling
5427
5626
  } = renderer2;
5428
5627
  do {
5429
5628
  const current = nextNode;
5430
- nextNode = nextSibling2(nextNode);
5629
+ nextNode = nextSibling(nextNode);
5431
5630
  removeNode(current, parentNode, renderer2);
5432
5631
  } while (nextNode);
5433
5632
  }
@@ -5435,9 +5634,9 @@ No further warnings will appear.`);
5435
5634
  function handleMismatch(node, vnode, renderer2) {
5436
5635
  hasMismatch = true;
5437
5636
  const {
5438
- getProperty: getProperty2
5637
+ getProperty
5439
5638
  } = renderer2;
5440
- const parentNode = getProperty2(node, "parentNode");
5639
+ const parentNode = getProperty(node, "parentNode");
5441
5640
  mount(vnode, parentNode, renderer2, node);
5442
5641
  removeNode(node, parentNode, renderer2);
5443
5642
  return vnode.elm;
@@ -5448,9 +5647,9 @@ No further warnings will appear.`);
5448
5647
  }
5449
5648
  function hasCorrectNodeType(vnode, node, nodeType, renderer2) {
5450
5649
  const {
5451
- getProperty: getProperty2
5650
+ getProperty
5452
5651
  } = renderer2;
5453
- if (getProperty2(node, "nodeType") !== nodeType) {
5652
+ if (getProperty(node, "nodeType") !== nodeType) {
5454
5653
  if (true) {
5455
5654
  logError("Hydration mismatch: incorrect node type received", vnode.owner);
5456
5655
  }
@@ -5460,11 +5659,11 @@ No further warnings will appear.`);
5460
5659
  }
5461
5660
  function isMatchingElement(vnode, elm, renderer2) {
5462
5661
  const {
5463
- getProperty: getProperty2
5662
+ getProperty
5464
5663
  } = renderer2;
5465
- if (vnode.sel.toLowerCase() !== getProperty2(elm, "tagName").toLowerCase()) {
5664
+ if (vnode.sel.toLowerCase() !== getProperty(elm, "tagName").toLowerCase()) {
5466
5665
  if (true) {
5467
- logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty2(elm, "tagName").toLowerCase()}".`, vnode.owner);
5666
+ logError(`Hydration mismatch: expecting element with tag "${vnode.sel.toLowerCase()}" but found "${getProperty(elm, "tagName").toLowerCase()}".`, vnode.owner);
5468
5667
  }
5469
5668
  return false;
5470
5669
  }
@@ -5485,15 +5684,15 @@ No further warnings will appear.`);
5485
5684
  owner
5486
5685
  } = vnode;
5487
5686
  const {
5488
- getAttribute: getAttribute2
5687
+ getAttribute
5489
5688
  } = renderer2;
5490
- const elmAttrValue = getAttribute2(elm, attrName);
5689
+ const elmAttrValue = getAttribute(elm, attrName);
5491
5690
  if (String(attrValue) !== elmAttrValue) {
5492
5691
  if (true) {
5493
5692
  const {
5494
- getProperty: getProperty2
5693
+ getProperty
5495
5694
  } = renderer2;
5496
- logError(`Mismatch hydrating element <${getProperty2(elm, "tagName").toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
5695
+ logError(`Mismatch hydrating element <${getProperty(elm, "tagName").toLowerCase()}>: attribute "${attrName}" has different values, expected "${attrValue}" but found "${elmAttrValue}"`, owner);
5497
5696
  }
5498
5697
  nodesAreCompatible = false;
5499
5698
  }
@@ -5502,22 +5701,46 @@ No further warnings will appear.`);
5502
5701
  }
5503
5702
  function validateClassAttr(vnode, elm, renderer2) {
5504
5703
  const {
5505
- data: {
5506
- className,
5507
- classMap
5508
- }
5704
+ data,
5705
+ owner
5509
5706
  } = vnode;
5707
+ let {
5708
+ className,
5709
+ classMap
5710
+ } = data;
5510
5711
  const {
5511
- getProperty: getProperty2,
5512
- getClassList: getClassList2
5712
+ getProperty,
5713
+ getClassList
5513
5714
  } = renderer2;
5715
+ const scopedToken = getScopeTokenClass(owner);
5716
+ const stylesheetTokenHost = isVCustomElement(vnode) ? getStylesheetTokenHost(vnode) : null;
5717
+ if (!isNull(scopedToken) || !isNull(stylesheetTokenHost)) {
5718
+ if (!isUndefined$1(className)) {
5719
+ const classTokens = [scopedToken, className, stylesheetTokenHost];
5720
+ const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
5721
+ className = ArrayJoin.call(classNames, " ");
5722
+ } else if (!isUndefined$1(classMap)) {
5723
+ classMap = Object.assign(Object.assign(Object.assign({}, classMap), !isNull(scopedToken) ? {
5724
+ [scopedToken]: true
5725
+ } : {}), !isNull(stylesheetTokenHost) ? {
5726
+ [stylesheetTokenHost]: true
5727
+ } : {});
5728
+ } else {
5729
+ const classTokens = [scopedToken, stylesheetTokenHost];
5730
+ const classNames = ArrayFilter.call(classTokens, (token) => !isNull(token));
5731
+ if (classNames.length) {
5732
+ className = ArrayJoin.call(classNames, " ");
5733
+ }
5734
+ }
5735
+ }
5514
5736
  let nodesAreCompatible = true;
5515
- let vnodeClassName;
5516
- if (!isUndefined$1(className) && String(className) !== getProperty2(elm, "className")) {
5737
+ let readableVnodeClassname;
5738
+ const elmClassName = getProperty(elm, "className");
5739
+ if (!isUndefined$1(className) && String(className) !== elmClassName) {
5517
5740
  nodesAreCompatible = false;
5518
- vnodeClassName = className;
5741
+ readableVnodeClassname = className;
5519
5742
  } else if (!isUndefined$1(classMap)) {
5520
- const classList = getClassList2(elm);
5743
+ const classList = getClassList(elm);
5521
5744
  let computedClassName = "";
5522
5745
  for (const name in classMap) {
5523
5746
  computedClassName += " " + name;
@@ -5525,14 +5748,17 @@ No further warnings will appear.`);
5525
5748
  nodesAreCompatible = false;
5526
5749
  }
5527
5750
  }
5528
- vnodeClassName = computedClassName.trim();
5751
+ readableVnodeClassname = computedClassName.trim();
5529
5752
  if (classList.length > keys(classMap).length) {
5530
5753
  nodesAreCompatible = false;
5531
5754
  }
5755
+ } else if (isUndefined$1(className) && elmClassName !== "") {
5756
+ nodesAreCompatible = false;
5757
+ readableVnodeClassname = "";
5532
5758
  }
5533
5759
  if (!nodesAreCompatible) {
5534
5760
  if (true) {
5535
- logError(`Mismatch hydrating element <${getProperty2(elm, "tagName").toLowerCase()}>: attribute "class" has different values, expected "${vnodeClassName}" but found "${getProperty2(elm, "className")}"`, vnode.owner);
5761
+ logError(`Mismatch hydrating element <${getProperty(elm, "tagName").toLowerCase()}>: attribute "class" has different values, expected "${readableVnodeClassname}" but found "${elmClassName}"`, vnode.owner);
5536
5762
  }
5537
5763
  }
5538
5764
  return nodesAreCompatible;
@@ -5545,9 +5771,9 @@ No further warnings will appear.`);
5545
5771
  }
5546
5772
  } = vnode;
5547
5773
  const {
5548
- getAttribute: getAttribute2
5774
+ getAttribute
5549
5775
  } = renderer2;
5550
- const elmStyle = getAttribute2(elm, "style") || "";
5776
+ const elmStyle = getAttribute(elm, "style") || "";
5551
5777
  let vnodeStyle;
5552
5778
  let nodesAreCompatible = true;
5553
5779
  if (!isUndefined$1(style) && style !== elmStyle) {
@@ -5576,44 +5802,44 @@ No further warnings will appear.`);
5576
5802
  if (!nodesAreCompatible) {
5577
5803
  if (true) {
5578
5804
  const {
5579
- getProperty: getProperty2
5805
+ getProperty
5580
5806
  } = renderer2;
5581
- logError(`Mismatch hydrating element <${getProperty2(elm, "tagName").toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
5807
+ logError(`Mismatch hydrating element <${getProperty(elm, "tagName").toLowerCase()}>: attribute "style" has different values, expected "${vnodeStyle}" but found "${elmStyle}".`, vnode.owner);
5582
5808
  }
5583
5809
  }
5584
5810
  return nodesAreCompatible;
5585
5811
  }
5586
- function areCompatibleNodes(client, ssr2, vnode, renderer2) {
5812
+ function areCompatibleNodes(client, ssr, vnode, renderer2) {
5587
5813
  const {
5588
- getProperty: getProperty2,
5589
- getAttribute: getAttribute2
5814
+ getProperty,
5815
+ getAttribute
5590
5816
  } = renderer2;
5591
- if (getProperty2(client, "nodeType") === 3) {
5592
- if (!hasCorrectNodeType(vnode, ssr2, 3, renderer2)) {
5817
+ if (getProperty(client, "nodeType") === 3) {
5818
+ if (!hasCorrectNodeType(vnode, ssr, 3, renderer2)) {
5593
5819
  return false;
5594
5820
  }
5595
- return getProperty2(client, "nodeValue") === getProperty2(ssr2, "nodeValue");
5821
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
5596
5822
  }
5597
- if (getProperty2(client, "nodeType") === 8) {
5598
- if (!hasCorrectNodeType(vnode, ssr2, 8, renderer2)) {
5823
+ if (getProperty(client, "nodeType") === 8) {
5824
+ if (!hasCorrectNodeType(vnode, ssr, 8, renderer2)) {
5599
5825
  return false;
5600
5826
  }
5601
- return getProperty2(client, "nodeValue") === getProperty2(ssr2, "nodeValue");
5827
+ return getProperty(client, NODE_VALUE_PROP) === getProperty(ssr, NODE_VALUE_PROP);
5602
5828
  }
5603
- if (!hasCorrectNodeType(vnode, ssr2, 1, renderer2)) {
5829
+ if (!hasCorrectNodeType(vnode, ssr, 1, renderer2)) {
5604
5830
  return false;
5605
5831
  }
5606
5832
  let isCompatibleElements = true;
5607
- if (getProperty2(client, "tagName") !== getProperty2(ssr2, "tagName")) {
5833
+ if (getProperty(client, "tagName") !== getProperty(ssr, "tagName")) {
5608
5834
  if (true) {
5609
- logError(`Hydration mismatch: expecting element with tag "${getProperty2(client, "tagName").toLowerCase()}" but found "${getProperty2(ssr2, "tagName").toLowerCase()}".`, vnode.owner);
5835
+ logError(`Hydration mismatch: expecting element with tag "${getProperty(client, "tagName").toLowerCase()}" but found "${getProperty(ssr, "tagName").toLowerCase()}".`, vnode.owner);
5610
5836
  }
5611
5837
  return false;
5612
5838
  }
5613
- const clientAttrsNames = getProperty2(client, "getAttributeNames").call(client);
5839
+ const clientAttrsNames = getProperty(client, "getAttributeNames").call(client);
5614
5840
  clientAttrsNames.forEach((attrName) => {
5615
- if (getAttribute2(client, attrName) !== getAttribute2(ssr2, attrName)) {
5616
- logError(`Mismatch hydrating element <${getProperty2(client, "tagName").toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute2(client, attrName)}" but found "${getAttribute2(ssr2, attrName)}"`, vnode.owner);
5841
+ if (getAttribute(client, attrName) !== getAttribute(ssr, attrName)) {
5842
+ logError(`Mismatch hydrating element <${getProperty(client, "tagName").toLowerCase()}>: attribute "${attrName}" has different values, expected "${getAttribute(client, attrName)}" but found "${getAttribute(ssr, attrName)}"`, vnode.owner);
5617
5843
  isCompatibleElements = false;
5618
5844
  }
5619
5845
  });
@@ -5627,6 +5853,9 @@ No further warnings will appear.`);
5627
5853
  }
5628
5854
  const TEMPLATE_PROPS = ["slots", "stylesheetToken", "stylesheets", "renderMode"];
5629
5855
  const ARRAY_MUTATION_METHODS = ["pop", "push", "shift", "unshift", "reverse", "sort", "fill", "splice", "copyWithin"];
5856
+ const STYLESHEET_FUNCTION_EXPANDOS = [
5857
+ "$scoped$"
5858
+ ];
5630
5859
  function getOriginalArrayMethod(prop) {
5631
5860
  switch (prop) {
5632
5861
  case "pop":
@@ -5659,39 +5888,106 @@ No further warnings will appear.`);
5659
5888
  };
5660
5889
  }
5661
5890
  }
5662
- function freezeTemplate(tmpl) {
5663
- if (true) {
5664
- if (!isUndefined$1(tmpl.stylesheets)) {
5665
- warnOnArrayMutation(tmpl.stylesheets);
5666
- }
5667
- for (const prop of TEMPLATE_PROPS) {
5668
- let value = tmpl[prop];
5669
- defineProperty(tmpl, prop, {
5670
- enumerable: true,
5671
- configurable: true,
5672
- get() {
5673
- return value;
5674
- },
5675
- set(newValue) {
5676
- if (!mutationWarningsSilenced) {
5677
- logError(`Dynamically setting the "${prop}" property on a template function is deprecated and may be removed in a future version of LWC.`);
5678
- }
5679
- value = newValue;
5680
- }
5681
- });
5682
- }
5683
- const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, "stylesheetTokens");
5684
- defineProperty(tmpl, "stylesheetTokens", {
5891
+ function warnOnStylesheetFunctionMutation(stylesheet) {
5892
+ for (const prop of STYLESHEET_FUNCTION_EXPANDOS) {
5893
+ let value = stylesheet[prop];
5894
+ defineProperty(stylesheet, prop, {
5685
5895
  enumerable: true,
5686
5896
  configurable: true,
5687
- get: originalDescriptor.get,
5897
+ get() {
5898
+ return value;
5899
+ },
5900
+ set(newValue) {
5901
+ logError(`Dynamically setting the "${prop}" property on a stylesheet function is deprecated and may be removed in a future version of LWC.`);
5902
+ value = newValue;
5903
+ }
5904
+ });
5905
+ }
5906
+ }
5907
+ function warnOnStylesheetsMutation(stylesheets) {
5908
+ traverseStylesheets(stylesheets, (subStylesheets) => {
5909
+ if (isArray$1(subStylesheets)) {
5910
+ warnOnArrayMutation(subStylesheets);
5911
+ } else {
5912
+ warnOnStylesheetFunctionMutation(subStylesheets);
5913
+ }
5914
+ });
5915
+ }
5916
+ function deepFreeze(stylesheets) {
5917
+ traverseStylesheets(stylesheets, (subStylesheets) => {
5918
+ freeze(subStylesheets);
5919
+ });
5920
+ }
5921
+ function traverseStylesheets(stylesheets, callback) {
5922
+ callback(stylesheets);
5923
+ for (let i2 = 0; i2 < stylesheets.length; i2++) {
5924
+ const stylesheet = stylesheets[i2];
5925
+ if (isArray$1(stylesheet)) {
5926
+ traverseStylesheets(stylesheet, callback);
5927
+ } else {
5928
+ callback(stylesheet);
5929
+ }
5930
+ }
5931
+ }
5932
+ function freezeTemplate(tmpl) {
5933
+ if (lwcRuntimeFlags.ENABLE_FROZEN_TEMPLATE) {
5934
+ freeze(tmpl);
5935
+ if (!isUndefined$1(tmpl.stylesheets)) {
5936
+ deepFreeze(tmpl.stylesheets);
5937
+ }
5938
+ } else {
5939
+ defineProperty(tmpl, "stylesheetTokens", {
5940
+ enumerable: true,
5941
+ configurable: true,
5942
+ get() {
5943
+ const {
5944
+ stylesheetToken
5945
+ } = this;
5946
+ if (isUndefined$1(stylesheetToken)) {
5947
+ return stylesheetToken;
5948
+ }
5949
+ return {
5950
+ hostAttribute: `${stylesheetToken}-host`,
5951
+ shadowAttribute: stylesheetToken
5952
+ };
5953
+ },
5688
5954
  set(value) {
5689
- logError(`Dynamically setting the "stylesheetTokens" property on a template function is deprecated and may be removed in a future version of LWC.`);
5690
- mutationWarningsSilenced = true;
5691
- originalDescriptor.set.call(this, value);
5692
- mutationWarningsSilenced = false;
5955
+ this.stylesheetToken = isUndefined$1(value) ? void 0 : value.shadowAttribute;
5693
5956
  }
5694
5957
  });
5958
+ if (true) {
5959
+ if (!isUndefined$1(tmpl.stylesheets)) {
5960
+ warnOnStylesheetsMutation(tmpl.stylesheets);
5961
+ }
5962
+ for (const prop of TEMPLATE_PROPS) {
5963
+ let value = tmpl[prop];
5964
+ defineProperty(tmpl, prop, {
5965
+ enumerable: true,
5966
+ configurable: true,
5967
+ get() {
5968
+ return value;
5969
+ },
5970
+ set(newValue) {
5971
+ if (!mutationWarningsSilenced) {
5972
+ logError(`Dynamically setting the "${prop}" property on a template function is deprecated and may be removed in a future version of LWC.`);
5973
+ }
5974
+ value = newValue;
5975
+ }
5976
+ });
5977
+ }
5978
+ const originalDescriptor = getOwnPropertyDescriptor$1(tmpl, "stylesheetTokens");
5979
+ defineProperty(tmpl, "stylesheetTokens", {
5980
+ enumerable: true,
5981
+ configurable: true,
5982
+ get: originalDescriptor.get,
5983
+ set(value) {
5984
+ logError(`Dynamically setting the "stylesheetTokens" property on a template function is deprecated and may be removed in a future version of LWC.`);
5985
+ mutationWarningsSilenced = true;
5986
+ originalDescriptor.set.call(this, value);
5987
+ mutationWarningsSilenced = false;
5988
+ }
5989
+ });
5990
+ }
5695
5991
  }
5696
5992
  }
5697
5993
  function getComponentConstructor(elm) {
@@ -5704,6 +6000,58 @@ No further warnings will appear.`);
5704
6000
  }
5705
6001
  return ctor;
5706
6002
  }
6003
+ function getHeaderForCustomElement(ce, componentInstance) {
6004
+ return ["div", {}, ["object", {
6005
+ object: ce,
6006
+ config: {
6007
+ skip: true
6008
+ }
6009
+ }], ["div", {}, ["span", {
6010
+ style: "margin: 0 5px; color: red"
6011
+ }, "LWC:"], ["object", {
6012
+ object: componentInstance
6013
+ }]]];
6014
+ }
6015
+ function getHeaderForComponentInstance(componentInstance, debugInfo) {
6016
+ if (keys(debugInfo).length === 0) {
6017
+ return null;
6018
+ }
6019
+ return ["div", {}, ["object", {
6020
+ object: componentInstance,
6021
+ config: {
6022
+ skip: true
6023
+ }
6024
+ }], ["div", {}, ["span", {
6025
+ style: "margin: 0 5px; color: red"
6026
+ }, "Debug:"], ["object", {
6027
+ object: debugInfo
6028
+ }]]];
6029
+ }
6030
+ const LightningElementFormatter = {
6031
+ name: "LightningElementFormatter",
6032
+ header(obj, config) {
6033
+ const vm = getAssociatedVMIfPresent(obj);
6034
+ if (!isUndefined$1(vm) && (isUndefined$1(config) || !config.skip)) {
6035
+ if (obj instanceof HTMLElement) {
6036
+ return getHeaderForCustomElement(obj, vm.component);
6037
+ } else {
6038
+ return getHeaderForComponentInstance(obj, vm.debugInfo);
6039
+ }
6040
+ }
6041
+ return null;
6042
+ },
6043
+ hasBody() {
6044
+ return false;
6045
+ }
6046
+ };
6047
+ function init() {
6048
+ const devtoolsFormatters = _globalThis.devtoolsFormatters || [];
6049
+ ArrayPush$1.call(devtoolsFormatters, LightningElementFormatter);
6050
+ _globalThis.devtoolsFormatters = devtoolsFormatters;
6051
+ }
6052
+ if (true) {
6053
+ init();
6054
+ }
5707
6055
  const supportsConstructableStylesheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);
5708
6056
  const supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets && getOwnPropertyDescriptor$1(document.adoptedStyleSheets, "length").writable;
5709
6057
  const isIE11 = !isUndefined$1(document.documentMode);
@@ -5713,9 +6061,6 @@ No further warnings will appear.`);
5713
6061
  stylesheetCache.clear();
5714
6062
  };
5715
6063
  }
5716
- function isDocument(target) {
5717
- return !isUndefined$1(target.head);
5718
- }
5719
6064
  function createFreshStyleElement(content) {
5720
6065
  const elm = document.createElement("style");
5721
6066
  elm.type = "text/css";
@@ -5724,17 +6069,17 @@ No further warnings will appear.`);
5724
6069
  }
5725
6070
  function createStyleElement(content, cacheData) {
5726
6071
  const {
5727
- stylesheet,
5728
- used
6072
+ element,
6073
+ usedElement
5729
6074
  } = cacheData;
5730
- if (used) {
6075
+ if (usedElement) {
5731
6076
  if (isIE11) {
5732
6077
  return createFreshStyleElement(content);
5733
6078
  }
5734
- return stylesheet.cloneNode(true);
6079
+ return element.cloneNode(true);
5735
6080
  }
5736
- cacheData.used = true;
5737
- return stylesheet;
6081
+ cacheData.usedElement = true;
6082
+ return element;
5738
6083
  }
5739
6084
  function createConstructableStylesheet(content) {
5740
6085
  const stylesheet = new CSSStyleSheet();
@@ -5756,39 +6101,37 @@ No further warnings will appear.`);
5756
6101
  }
5757
6102
  function insertStyleElement(content, target, cacheData) {
5758
6103
  const elm = createStyleElement(content, cacheData);
5759
- const targetAnchorPoint = isDocument(target) ? target.head : target;
5760
- targetAnchorPoint.appendChild(elm);
5761
- }
5762
- function doInsertStylesheet(content, target, cacheData) {
5763
- if (supportsConstructableStylesheets) {
5764
- insertConstructableStylesheet(content, target, cacheData);
5765
- } else {
5766
- insertStyleElement(content, target, cacheData);
5767
- }
6104
+ target.appendChild(elm);
5768
6105
  }
5769
- function getCacheData(content) {
6106
+ function getCacheData(content, useConstructableStylesheet) {
5770
6107
  let cacheData = stylesheetCache.get(content);
5771
6108
  if (isUndefined$1(cacheData)) {
5772
6109
  cacheData = {
5773
- stylesheet: supportsConstructableStylesheets ? createConstructableStylesheet(content) : createFreshStyleElement(content),
6110
+ stylesheet: void 0,
6111
+ element: void 0,
5774
6112
  roots: void 0,
5775
6113
  global: false,
5776
- used: false
6114
+ usedElement: false
5777
6115
  };
5778
6116
  stylesheetCache.set(content, cacheData);
5779
6117
  }
6118
+ if (useConstructableStylesheet && isUndefined$1(cacheData.stylesheet)) {
6119
+ cacheData.stylesheet = createConstructableStylesheet(content);
6120
+ } else if (!useConstructableStylesheet && isUndefined$1(cacheData.element)) {
6121
+ cacheData.element = createFreshStyleElement(content);
6122
+ }
5780
6123
  return cacheData;
5781
6124
  }
5782
6125
  function insertGlobalStylesheet(content) {
5783
- const cacheData = getCacheData(content);
6126
+ const cacheData = getCacheData(content, false);
5784
6127
  if (cacheData.global) {
5785
6128
  return;
5786
6129
  }
5787
6130
  cacheData.global = true;
5788
- doInsertStylesheet(content, document, cacheData);
6131
+ insertStyleElement(content, document.head, cacheData);
5789
6132
  }
5790
6133
  function insertLocalStylesheet(content, target) {
5791
- const cacheData = getCacheData(content);
6134
+ const cacheData = getCacheData(content, supportsConstructableStylesheets);
5792
6135
  let {
5793
6136
  roots
5794
6137
  } = cacheData;
@@ -5798,7 +6141,11 @@ No further warnings will appear.`);
5798
6141
  return;
5799
6142
  }
5800
6143
  roots.add(target);
5801
- doInsertStylesheet(content, target, cacheData);
6144
+ if (supportsConstructableStylesheets) {
6145
+ insertConstructableStylesheet(content, target, cacheData);
6146
+ } else {
6147
+ insertStyleElement(content, target, cacheData);
6148
+ }
5802
6149
  }
5803
6150
  function insertStylesheet(content, target) {
5804
6151
  if (isUndefined$1(target)) {
@@ -5807,9 +6154,6 @@ No further warnings will appear.`);
5807
6154
  insertLocalStylesheet(content, target);
5808
6155
  }
5809
6156
  }
5810
- let getCustomElement;
5811
- let defineCustomElement;
5812
- let HTMLElementConstructor;
5813
6157
  function isCustomElementRegistryAvailable() {
5814
6158
  if (typeof customElements === "undefined") {
5815
6159
  return false;
@@ -5825,205 +6169,688 @@ No further warnings will appear.`);
5825
6169
  return false;
5826
6170
  }
5827
6171
  }
5828
- if (isCustomElementRegistryAvailable()) {
5829
- getCustomElement = customElements.get.bind(customElements);
5830
- defineCustomElement = customElements.define.bind(customElements);
5831
- HTMLElementConstructor = HTMLElement;
5832
- } else {
5833
- const registry = create(null);
5834
- const reverseRegistry = new WeakMap();
5835
- defineCustomElement = function define(name, ctor) {
5836
- if (name !== StringToLowerCase.call(name) || registry[name]) {
5837
- throw new TypeError(`Invalid Registration`);
5838
- }
5839
- registry[name] = ctor;
5840
- reverseRegistry.set(ctor, name);
6172
+ const hasCustomElements = isCustomElementRegistryAvailable();
6173
+ const createCustomElementCompat = (tagName, upgradeCallback) => {
6174
+ const elm = document.createElement(tagName);
6175
+ upgradeCallback(elm);
6176
+ return elm;
6177
+ };
6178
+ const cachedConstructors = new Map();
6179
+ const elementsUpgradedOutsideLWC = new WeakSet();
6180
+ let elementBeingUpgradedByLWC = false;
6181
+ const createUpgradableConstructor = (connectedCallback, disconnectedCallback) => {
6182
+ const hasConnectedCallback = !isUndefined$1(connectedCallback);
6183
+ const hasDisconnectedCallback = !isUndefined$1(disconnectedCallback);
6184
+ class UpgradableConstructor extends HTMLElement {
6185
+ constructor(upgradeCallback) {
6186
+ super();
6187
+ if (elementBeingUpgradedByLWC) {
6188
+ upgradeCallback(this);
6189
+ } else if (hasConnectedCallback || hasDisconnectedCallback) {
6190
+ elementsUpgradedOutsideLWC.add(this);
6191
+ }
6192
+ }
6193
+ }
6194
+ if (hasConnectedCallback) {
6195
+ UpgradableConstructor.prototype.connectedCallback = function() {
6196
+ if (!elementsUpgradedOutsideLWC.has(this)) {
6197
+ connectedCallback(this);
6198
+ }
6199
+ };
6200
+ }
6201
+ if (hasDisconnectedCallback) {
6202
+ UpgradableConstructor.prototype.disconnectedCallback = function() {
6203
+ if (!elementsUpgradedOutsideLWC.has(this)) {
6204
+ disconnectedCallback(this);
6205
+ }
6206
+ };
6207
+ }
6208
+ return UpgradableConstructor;
6209
+ };
6210
+ const createCustomElementVanilla = (tagName, upgradeCallback, connectedCallback, disconnectedCallback) => {
6211
+ let UpgradableConstructor = cachedConstructors.get(tagName);
6212
+ if (isUndefined$1(UpgradableConstructor)) {
6213
+ if (!isUndefined$1(customElements.get(tagName))) {
6214
+ throw new Error(`Unexpected tag name "${tagName}". This name is a registered custom element, preventing LWC to upgrade the element.`);
6215
+ }
6216
+ UpgradableConstructor = createUpgradableConstructor(connectedCallback, disconnectedCallback);
6217
+ customElements.define(tagName, UpgradableConstructor);
6218
+ cachedConstructors.set(tagName, UpgradableConstructor);
6219
+ }
6220
+ elementBeingUpgradedByLWC = true;
6221
+ try {
6222
+ return new UpgradableConstructor(upgradeCallback);
6223
+ } finally {
6224
+ elementBeingUpgradedByLWC = false;
6225
+ }
6226
+ };
6227
+ function createScopedRegistry() {
6228
+ if (!hasCustomElements) {
6229
+ throw new Error("Custom elements are not supported in this environment.");
6230
+ }
6231
+ const {
6232
+ HTMLElement: NativeHTMLElement
6233
+ } = window;
6234
+ const {
6235
+ hasAttribute: nativeHasAttribute,
6236
+ setAttribute: nativeSetAttribute,
6237
+ removeAttribute: nativeRemoveAttribute,
6238
+ getAttribute: nativeGetAttribute
6239
+ } = NativeHTMLElement.prototype;
6240
+ const definitionForElement = new WeakMap();
6241
+ const pendingRegistryForElement = new WeakMap();
6242
+ const definitionForConstructor = new WeakMap();
6243
+ const registeredUserCtors = new WeakSet();
6244
+ const registeredPivotCtors = new WeakSet();
6245
+ const pivotCtorByTag = new Map();
6246
+ const globalDefinitionsByTag = new Map();
6247
+ const globalDefinitionsByClass = new Map();
6248
+ const awaitingUpgrade = new Map();
6249
+ const pendingWhenDefinedCallbacks = new Map();
6250
+ const EMPTY_SET = new Set();
6251
+ function createDefinitionRecord(constructor) {
6252
+ var _a;
6253
+ const {
6254
+ connectedCallback,
6255
+ disconnectedCallback,
6256
+ formAssociatedCallback,
6257
+ formDisabledCallback,
6258
+ formResetCallback,
6259
+ formStateRestoreCallback,
6260
+ adoptedCallback,
6261
+ attributeChangedCallback
6262
+ } = constructor.prototype;
6263
+ const formAssociated = Boolean(constructor.formAssociated);
6264
+ const observedAttributes = new Set((_a = constructor.observedAttributes) !== null && _a !== void 0 ? _a : []);
6265
+ return {
6266
+ UserCtor: constructor,
6267
+ PivotCtor: void 0,
6268
+ connectedCallback,
6269
+ disconnectedCallback,
6270
+ formAssociatedCallback,
6271
+ formDisabledCallback,
6272
+ formResetCallback,
6273
+ formStateRestoreCallback,
6274
+ adoptedCallback,
6275
+ attributeChangedCallback,
6276
+ observedAttributes,
6277
+ formAssociated
6278
+ };
6279
+ }
6280
+ function createPivotingClass(tagName, registeredDefinition) {
6281
+ class PivotCtor extends NativeHTMLElement {
6282
+ constructor(UserCtor) {
6283
+ super();
6284
+ const userCtorIsDefined = !isUndefined$1(UserCtor);
6285
+ if (userCtorIsDefined) {
6286
+ if (!isConstructor(UserCtor)) {
6287
+ throw new TypeError(`Failed to create custom element: the provided constructor is not a constructor.`);
6288
+ }
6289
+ if (!registeredUserCtors.has(UserCtor)) {
6290
+ throw new Error(`Failed to create custom element: the provided constructor is unregistered: ${UserCtor.name}.`);
6291
+ }
6292
+ }
6293
+ const definition = userCtorIsDefined ? getOrCreateDefinitionForConstructor(UserCtor) : globalDefinitionsByTag.get(tagName);
6294
+ if (!isUndefined$1(definition)) {
6295
+ internalUpgrade(this, registeredDefinition, definition);
6296
+ } else {
6297
+ pendingRegistryForElement.set(this, registeredDefinition);
6298
+ }
6299
+ }
6300
+ connectedCallback() {
6301
+ var _a;
6302
+ const definition = definitionForElement.get(this);
6303
+ if (!isUndefined$1(definition)) {
6304
+ (_a = definition.connectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6305
+ } else {
6306
+ let awaiting = awaitingUpgrade.get(tagName);
6307
+ if (isUndefined$1(awaiting)) {
6308
+ awaitingUpgrade.set(tagName, awaiting = new Set());
6309
+ }
6310
+ awaiting.add(this);
6311
+ }
6312
+ }
6313
+ disconnectedCallback() {
6314
+ var _a;
6315
+ const definition = definitionForElement.get(this);
6316
+ if (!isUndefined$1(definition)) {
6317
+ (_a = definition.disconnectedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6318
+ } else {
6319
+ const awaiting = awaitingUpgrade.get(tagName);
6320
+ if (!isUndefined$1(awaiting)) {
6321
+ awaiting.delete(this);
6322
+ }
6323
+ }
6324
+ }
6325
+ formAssociatedCallback(form) {
6326
+ var _a;
6327
+ const definition = definitionForElement.get(this);
6328
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formAssociatedCallback) === null || _a === void 0 ? void 0 : _a.call(this, form);
6329
+ }
6330
+ formDisabledCallback(disabled) {
6331
+ var _a;
6332
+ const definition = definitionForElement.get(this);
6333
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formDisabledCallback) === null || _a === void 0 ? void 0 : _a.call(this, disabled);
6334
+ }
6335
+ formResetCallback() {
6336
+ var _a;
6337
+ const definition = definitionForElement.get(this);
6338
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formResetCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6339
+ }
6340
+ formStateRestoreCallback(state, mode) {
6341
+ var _a;
6342
+ const definition = definitionForElement.get(this);
6343
+ (_a = definition === null || definition === void 0 ? void 0 : definition.formStateRestoreCallback) === null || _a === void 0 ? void 0 : _a.call(this, state, mode);
6344
+ }
6345
+ adoptedCallback() {
6346
+ var _a;
6347
+ const definition = definitionForElement.get(this);
6348
+ (_a = definition === null || definition === void 0 ? void 0 : definition.adoptedCallback) === null || _a === void 0 ? void 0 : _a.call(this);
6349
+ }
6350
+ attributeChangedCallback(name, oldValue, newValue) {
6351
+ var _a;
6352
+ const definition = definitionForElement.get(this);
6353
+ if (registeredDefinition === definition || (definition === null || definition === void 0 ? void 0 : definition.observedAttributes.has(name))) {
6354
+ (_a = definition.attributeChangedCallback) === null || _a === void 0 ? void 0 : _a.apply(this, [name, oldValue, newValue]);
6355
+ }
6356
+ }
6357
+ }
6358
+ PivotCtor.observedAttributes = [...registeredDefinition.observedAttributes];
6359
+ PivotCtor.formAssociated = registeredDefinition.formAssociated;
6360
+ registeredPivotCtors.add(PivotCtor);
6361
+ return PivotCtor;
6362
+ }
6363
+ function getNewObservedAttributes(registeredDefinition, pivotDefinition) {
6364
+ const {
6365
+ observedAttributes,
6366
+ attributeChangedCallback
6367
+ } = pivotDefinition;
6368
+ if (observedAttributes.size === 0 || isUndefined$1(attributeChangedCallback)) {
6369
+ return EMPTY_SET;
6370
+ }
6371
+ return new Set([...pivotDefinition.observedAttributes].filter((x) => !registeredDefinition.observedAttributes.has(x)));
6372
+ }
6373
+ function throwAsyncError(error) {
6374
+ setTimeout(() => {
6375
+ throw error;
6376
+ });
6377
+ }
6378
+ function patchAttributes2(instance, registeredDefinition, pivotDefinition) {
6379
+ const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
6380
+ if (newObservedAttributes.size === 0) {
6381
+ return;
6382
+ }
6383
+ const {
6384
+ attributeChangedCallback
6385
+ } = pivotDefinition;
6386
+ defineProperties(instance, {
6387
+ setAttribute: {
6388
+ value: function setAttribute(name, value) {
6389
+ if (newObservedAttributes.has(name)) {
6390
+ const old = nativeGetAttribute.call(this, name);
6391
+ nativeSetAttribute.call(this, name, value);
6392
+ try {
6393
+ attributeChangedCallback.call(this, name, old, value + "");
6394
+ } catch (error) {
6395
+ throwAsyncError(error);
6396
+ }
6397
+ } else {
6398
+ nativeSetAttribute.call(this, name, value);
6399
+ }
6400
+ },
6401
+ writable: true,
6402
+ enumerable: true,
6403
+ configurable: true
6404
+ },
6405
+ removeAttribute: {
6406
+ value: function removeAttribute(name) {
6407
+ if (newObservedAttributes.has(name)) {
6408
+ const old = nativeGetAttribute.call(this, name);
6409
+ nativeRemoveAttribute.call(this, name);
6410
+ try {
6411
+ attributeChangedCallback.call(this, name, old, null);
6412
+ } catch (error) {
6413
+ throwAsyncError(error);
6414
+ }
6415
+ } else {
6416
+ nativeRemoveAttribute.call(this, name);
6417
+ }
6418
+ },
6419
+ writable: true,
6420
+ enumerable: true,
6421
+ configurable: true
6422
+ }
6423
+ });
6424
+ }
6425
+ function patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition) {
6426
+ const newObservedAttributes = getNewObservedAttributes(registeredDefinition, pivotDefinition);
6427
+ if (getNewObservedAttributes(registeredDefinition, pivotDefinition).size === 0) {
6428
+ return;
6429
+ }
6430
+ const {
6431
+ attributeChangedCallback
6432
+ } = pivotDefinition;
6433
+ newObservedAttributes.forEach((name) => {
6434
+ if (nativeHasAttribute.call(instance, name)) {
6435
+ const newValue = nativeGetAttribute.call(instance, name);
6436
+ attributeChangedCallback.call(instance, name, null, newValue);
6437
+ }
6438
+ });
6439
+ }
6440
+ let upgradingInstance;
6441
+ function internalUpgrade(instance, registeredDefinition, pivotDefinition) {
6442
+ setPrototypeOf(instance, pivotDefinition.UserCtor.prototype);
6443
+ definitionForElement.set(instance, pivotDefinition);
6444
+ if (pivotDefinition !== registeredDefinition) {
6445
+ patchAttributes2(instance, registeredDefinition, pivotDefinition);
6446
+ }
6447
+ upgradingInstance = instance;
6448
+ new pivotDefinition.UserCtor();
6449
+ patchAttributesDuringUpgrade(instance, registeredDefinition, pivotDefinition);
6450
+ }
6451
+ function isConstructor(constructor) {
6452
+ return isFunction$1(constructor) && isObject(constructor.prototype);
6453
+ }
6454
+ function getOrCreateDefinitionForConstructor(constructor) {
6455
+ if (!isConstructor(constructor)) {
6456
+ throw new TypeError("The referenced constructor is not a constructor.");
6457
+ }
6458
+ const definition = definitionForConstructor.get(constructor);
6459
+ if (!isUndefined$1(definition)) {
6460
+ return definition;
6461
+ }
6462
+ return createDefinitionRecord(constructor);
6463
+ }
6464
+ function createPendingWhenDefinedCallback(tagName) {
6465
+ return new Promise((resolve) => {
6466
+ let resolvers = pendingWhenDefinedCallbacks.get(tagName);
6467
+ if (isUndefined$1(resolvers)) {
6468
+ resolvers = [];
6469
+ pendingWhenDefinedCallbacks.set(tagName, resolvers);
6470
+ }
6471
+ resolvers.push(resolve);
6472
+ });
6473
+ }
6474
+ function flushPendingWhenDefinedCallbacks(tagName, ctor) {
6475
+ const resolvers = pendingWhenDefinedCallbacks.get(tagName);
6476
+ if (!isUndefined$1(resolvers)) {
6477
+ for (const resolver of resolvers) {
6478
+ resolver(ctor);
6479
+ }
6480
+ }
6481
+ pendingWhenDefinedCallbacks.delete(tagName);
6482
+ }
6483
+ const {
6484
+ customElements: nativeRegistry
6485
+ } = window;
6486
+ const {
6487
+ define: nativeDefine,
6488
+ whenDefined: nativeWhenDefined,
6489
+ get: nativeGet
6490
+ } = nativeRegistry;
6491
+ CustomElementRegistry.prototype.define = function define(tagName, constructor, options) {
6492
+ if (options && options.extends) {
6493
+ throw new DOMException('NotSupportedError: "extends" key in customElements.define() options is not supported.');
6494
+ }
6495
+ if (globalDefinitionsByTag.has(tagName)) {
6496
+ throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': the name "${tagName}" has already been used with this registry`);
6497
+ }
6498
+ if (!isUndefined$1(globalDefinitionsByClass.get(constructor))) {
6499
+ throw new DOMException(`Failed to execute 'define' on 'CustomElementRegistry': this constructor has already been used with this registry`);
6500
+ }
6501
+ const definition = getOrCreateDefinitionForConstructor(constructor);
6502
+ registeredUserCtors.add(constructor);
6503
+ let PivotCtor = pivotCtorByTag.get(tagName);
6504
+ if (isUndefined$1(PivotCtor)) {
6505
+ PivotCtor = createPivotingClass(tagName, definition);
6506
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
6507
+ }
6508
+ definitionForConstructor.set(constructor, definition);
6509
+ pivotCtorByTag.set(tagName, PivotCtor);
6510
+ globalDefinitionsByTag.set(tagName, definition);
6511
+ globalDefinitionsByClass.set(constructor, definition);
6512
+ definition.PivotCtor = PivotCtor;
6513
+ const awaiting = awaitingUpgrade.get(tagName);
6514
+ if (!isUndefined$1(awaiting)) {
6515
+ awaitingUpgrade.delete(tagName);
6516
+ for (const element of awaiting) {
6517
+ const registeredDefinition = pendingRegistryForElement.get(element);
6518
+ if (!isUndefined$1(registeredDefinition)) {
6519
+ pendingRegistryForElement.delete(element);
6520
+ internalUpgrade(element, registeredDefinition, definition);
6521
+ }
6522
+ }
6523
+ }
6524
+ flushPendingWhenDefinedCallbacks(tagName, constructor);
5841
6525
  };
5842
- getCustomElement = function get(name) {
5843
- return registry[name];
6526
+ CustomElementRegistry.prototype.get = function get(tagName) {
6527
+ const NativeCtor = nativeGet.call(nativeRegistry, tagName);
6528
+ if (!isUndefined$1(NativeCtor)) {
6529
+ const definition = globalDefinitionsByTag.get(tagName);
6530
+ if (!isUndefined$1(definition)) {
6531
+ return definition.UserCtor;
6532
+ }
6533
+ if (registeredPivotCtors.has(NativeCtor)) {
6534
+ return void 0;
6535
+ }
6536
+ return NativeCtor;
6537
+ }
5844
6538
  };
5845
- HTMLElementConstructor = function HTMLElement2() {
5846
- if (!(this instanceof HTMLElement2)) {
5847
- throw new TypeError(`Invalid Invocation`);
6539
+ CustomElementRegistry.prototype.whenDefined = function whenDefined(tagName) {
6540
+ return nativeWhenDefined.call(nativeRegistry, tagName).then((NativeCtor) => {
6541
+ const definition = globalDefinitionsByTag.get(tagName);
6542
+ if (!isUndefined$1(definition)) {
6543
+ return definition.UserCtor;
6544
+ }
6545
+ if (isUndefined$1(NativeCtor)) {
6546
+ NativeCtor = nativeGet.call(nativeRegistry, tagName);
6547
+ }
6548
+ if (registeredPivotCtors.has(NativeCtor)) {
6549
+ return createPendingWhenDefinedCallback(tagName);
6550
+ }
6551
+ return NativeCtor;
6552
+ });
6553
+ };
6554
+ window.HTMLElement = function HTMLElement2() {
6555
+ const instance = upgradingInstance;
6556
+ if (!isUndefined$1(instance)) {
6557
+ upgradingInstance = void 0;
6558
+ return instance;
5848
6559
  }
5849
6560
  const {
5850
6561
  constructor
5851
6562
  } = this;
5852
- const name = reverseRegistry.get(constructor);
5853
- if (!name) {
5854
- throw new TypeError(`Invalid Construction`);
6563
+ const definition = globalDefinitionsByClass.get(constructor);
6564
+ if (isUndefined$1(definition) || isUndefined$1(definition.PivotCtor)) {
6565
+ throw new TypeError("Illegal constructor");
5855
6566
  }
5856
- const elm = document.createElement(name);
5857
- setPrototypeOf(elm, constructor.prototype);
5858
- return elm;
6567
+ const {
6568
+ PivotCtor,
6569
+ UserCtor
6570
+ } = definition;
6571
+ return new PivotCtor(UserCtor);
6572
+ };
6573
+ HTMLElement.prototype = NativeHTMLElement.prototype;
6574
+ return function createPivotConstructor(tagName, UserCtor) {
6575
+ tagName = StringToLowerCase.call(tagName);
6576
+ let PivotCtor = pivotCtorByTag.get(tagName);
6577
+ if (isUndefined$1(PivotCtor)) {
6578
+ const definition = getOrCreateDefinitionForConstructor(UserCtor);
6579
+ PivotCtor = createPivotingClass(tagName, definition);
6580
+ nativeDefine.call(nativeRegistry, tagName, PivotCtor);
6581
+ definition.PivotCtor = PivotCtor;
6582
+ definitionForConstructor.set(UserCtor, definition);
6583
+ pivotCtorByTag.set(tagName, PivotCtor);
6584
+ }
6585
+ registeredUserCtors.add(UserCtor);
6586
+ return PivotCtor;
5859
6587
  };
5860
- HTMLElementConstructor.prototype = HTMLElement.prototype;
5861
- }
5862
- let hydrating = false;
5863
- function setIsHydrating(value) {
5864
- hydrating = value;
5865
- }
5866
- const ssr = false;
5867
- function isHydrating() {
5868
- return hydrating;
5869
- }
5870
- const isNativeShadowDefined = _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED];
5871
- const isSyntheticShadowDefined = hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN);
5872
- function cloneNode(node, deep) {
5873
- return node.cloneNode(deep);
5874
- }
5875
- function createFragment(html) {
5876
- return document.createRange().createContextualFragment(html).firstChild;
5877
- }
5878
- function createElement$1(tagName, namespace) {
5879
- return isUndefined$1(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
5880
- }
5881
- function createText(content) {
5882
- return document.createTextNode(content);
5883
- }
5884
- function createComment(content) {
5885
- return document.createComment(content);
5886
- }
5887
- function insert(node, parent, anchor) {
5888
- parent.insertBefore(node, anchor);
5889
- }
5890
- function remove(node, parent) {
5891
- parent.removeChild(node);
5892
- }
5893
- function nextSibling(node) {
5894
- return node.nextSibling;
5895
6588
  }
5896
- function attachShadow(element, options) {
5897
- if (hydrating) {
5898
- return element.shadowRoot;
6589
+ let createScopedConstructor;
6590
+ let CachedHTMLElement;
6591
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
6592
+ if (hasCustomElements) {
6593
+ createScopedConstructor = createScopedRegistry();
6594
+ CachedHTMLElement = window.HTMLElement;
5899
6595
  }
5900
- return element.attachShadow(options);
5901
- }
5902
- function setText(node, content) {
5903
- node.nodeValue = content;
5904
- }
5905
- function getProperty(node, key) {
5906
- return node[key];
5907
6596
  }
5908
- function setProperty(node, key, value) {
5909
- if (true) {
5910
- if (node instanceof Element && !(key in node)) {
5911
- assert.fail(`Unknown public property "${key}" of element <${node.tagName}>. This is likely a typo on the corresponding attribute "${htmlPropertyToAttribute(key)}".`);
6597
+ const createUserConstructor = (HTMLElementToExtend, upgradeCallback, connectedCallback, disconnectedCallback) => {
6598
+ return class UserConstructor extends HTMLElementToExtend {
6599
+ constructor() {
6600
+ super();
6601
+ upgradeCallback(this);
5912
6602
  }
6603
+ connectedCallback() {
6604
+ if (!isUndefined$1(connectedCallback)) {
6605
+ connectedCallback(this);
6606
+ }
6607
+ }
6608
+ disconnectedCallback() {
6609
+ if (!isUndefined$1(disconnectedCallback)) {
6610
+ disconnectedCallback(this);
6611
+ }
6612
+ }
6613
+ };
6614
+ };
6615
+ function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
6616
+ if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
6617
+ throw new Error("The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature");
6618
+ }
6619
+ const UserConstructor = createUserConstructor(CachedHTMLElement, upgradeCallback, connectedCallback, disconnectedCallback);
6620
+ const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
6621
+ return new ScopedConstructor(UserConstructor);
6622
+ }
6623
+ let createCustomElement;
6624
+ if (hasCustomElements) {
6625
+ if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
6626
+ createCustomElement = createCustomElementScoped;
6627
+ } else {
6628
+ createCustomElement = createCustomElementVanilla;
5913
6629
  }
5914
- node[key] = value;
5915
- }
5916
- function getAttribute(element, name, namespace) {
5917
- return isUndefined$1(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
5918
- }
5919
- function setAttribute(element, name, value, namespace) {
5920
- return isUndefined$1(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
6630
+ } else {
6631
+ createCustomElement = createCustomElementCompat;
5921
6632
  }
5922
- function removeAttribute(element, name, namespace) {
5923
- if (isUndefined$1(namespace)) {
5924
- element.removeAttribute(name);
5925
- } else {
5926
- element.removeAttributeNS(namespace, name);
5927
- }
5928
- }
5929
- function addEventListener(target, type, callback, options) {
5930
- target.addEventListener(type, callback, options);
5931
- }
5932
- function removeEventListener(target, type, callback, options) {
5933
- target.removeEventListener(type, callback, options);
5934
- }
5935
- function dispatchEvent(target, event) {
5936
- return target.dispatchEvent(event);
5937
- }
5938
- function getClassList(element) {
5939
- return element.classList;
5940
- }
5941
- function setCSSStyleProperty(element, name, value, important) {
5942
- element.style.setProperty(name, value, important ? "important" : "");
5943
- }
5944
- function getBoundingClientRect(element) {
5945
- return element.getBoundingClientRect();
5946
- }
5947
- function querySelector(element, selectors) {
5948
- return element.querySelector(selectors);
5949
- }
5950
- function querySelectorAll(element, selectors) {
5951
- return element.querySelectorAll(selectors);
5952
- }
5953
- function getElementsByTagName(element, tagNameOrWildCard) {
5954
- return element.getElementsByTagName(tagNameOrWildCard);
5955
- }
5956
- function getElementsByClassName(element, names) {
5957
- return element.getElementsByClassName(names);
5958
- }
5959
- function getChildren(element) {
5960
- return element.children;
5961
- }
5962
- function getChildNodes(element) {
5963
- return element.childNodes;
5964
- }
5965
- function getFirstChild(element) {
5966
- return element.firstChild;
5967
- }
5968
- function getFirstElementChild(element) {
5969
- return element.firstElementChild;
5970
- }
5971
- function getLastChild(element) {
5972
- return element.lastChild;
5973
- }
5974
- function getLastElementChild(element) {
5975
- return element.lastElementChild;
5976
- }
5977
- function isConnected(node) {
5978
- return node.isConnected;
5979
- }
5980
- function assertInstanceOfHTMLElement(elm, msg) {
5981
- assert.invariant(elm instanceof HTMLElement, msg);
5982
- }
5983
- const HTMLElementExported = HTMLElementConstructor;
5984
- const renderer = {
5985
- ssr,
5986
- isNativeShadowDefined,
5987
- isSyntheticShadowDefined,
5988
- HTMLElementExported,
5989
- isHydrating,
5990
- insert,
5991
- remove,
5992
- cloneNode,
5993
- createFragment,
5994
- createElement: createElement$1,
5995
- createText,
5996
- createComment,
5997
- nextSibling,
5998
- attachShadow,
5999
- getProperty,
6000
- setProperty,
6001
- setText,
6002
- getAttribute,
6003
- setAttribute,
6004
- removeAttribute,
6005
- addEventListener,
6006
- removeEventListener,
6007
- dispatchEvent,
6008
- getClassList,
6009
- setCSSStyleProperty,
6010
- getBoundingClientRect,
6011
- querySelector,
6012
- querySelectorAll,
6013
- getElementsByTagName,
6014
- getElementsByClassName,
6015
- getChildren,
6016
- getChildNodes,
6017
- getFirstChild,
6018
- getFirstElementChild,
6019
- getLastChild,
6020
- getLastElementChild,
6021
- isConnected,
6633
+ function rendererFactory(baseRenderer) {
6634
+ const renderer2 = function(exports2) {
6635
+ function invariant2(value, msg) {
6636
+ if (!value) {
6637
+ throw new Error(`Invariant Violation: ${msg}`);
6638
+ }
6639
+ }
6640
+ function isTrue$12(value, msg) {
6641
+ if (!value) {
6642
+ throw new Error(`Assert Violation: ${msg}`);
6643
+ }
6644
+ }
6645
+ function isFalse$12(value, msg) {
6646
+ if (value) {
6647
+ throw new Error(`Assert Violation: ${msg}`);
6648
+ }
6649
+ }
6650
+ function fail2(msg) {
6651
+ throw new Error(msg);
6652
+ }
6653
+ var assert2 = /* @__PURE__ */ Object.freeze({
6654
+ __proto__: null,
6655
+ invariant: invariant2,
6656
+ isTrue: isTrue$12,
6657
+ isFalse: isFalse$12,
6658
+ fail: fail2
6659
+ });
6660
+ function isUndefined2(obj) {
6661
+ return obj === void 0;
6662
+ }
6663
+ function isNull2(obj) {
6664
+ return obj === null;
6665
+ }
6666
+ function cloneNode(node, deep) {
6667
+ return node.cloneNode(deep);
6668
+ }
6669
+ function createElement2(tagName, namespace) {
6670
+ return isUndefined2(namespace) ? document.createElement(tagName) : document.createElementNS(namespace, tagName);
6671
+ }
6672
+ function createText(content) {
6673
+ return document.createTextNode(content);
6674
+ }
6675
+ function createComment(content) {
6676
+ return document.createComment(content);
6677
+ }
6678
+ exports2.createFragment = void 0;
6679
+ const SUPPORTS_TEMPLATE = typeof HTMLTemplateElement === "function";
6680
+ if (SUPPORTS_TEMPLATE) {
6681
+ exports2.createFragment = function(html) {
6682
+ const template = document.createElement("template");
6683
+ template.innerHTML = html;
6684
+ return template.content.firstChild;
6685
+ };
6686
+ } else {
6687
+ const topLevelWrappingMap = {
6688
+ caption: ["table"],
6689
+ col: ["colgroup", "table"],
6690
+ colgroup: ["table"],
6691
+ option: ["select"],
6692
+ tbody: ["table"],
6693
+ td: ["tr", "tbody", "table"],
6694
+ th: ["tr", "tbody", "table"],
6695
+ thead: ["table"],
6696
+ tfoot: ["table"],
6697
+ tr: ["tbody", "table"]
6698
+ };
6699
+ const getTagName = function(text) {
6700
+ return (/<([a-z][^/\0>\x20\t\r\n\f]+)/i.exec(text) || ["", ""])[1].toLowerCase();
6701
+ };
6702
+ exports2.createFragment = function(html) {
6703
+ const wrapperTags = topLevelWrappingMap[getTagName(html)];
6704
+ if (!isUndefined2(wrapperTags)) {
6705
+ for (const wrapperTag of wrapperTags) {
6706
+ html = `<${wrapperTag}>${html}</${wrapperTag}>`;
6707
+ }
6708
+ }
6709
+ const doc = document.implementation.createHTMLDocument("");
6710
+ doc.body.innerHTML = html;
6711
+ let content = doc.body;
6712
+ if (!isUndefined2(wrapperTags)) {
6713
+ for (let i2 = 0; i2 < wrapperTags.length; i2++) {
6714
+ content = content.firstChild;
6715
+ }
6716
+ }
6717
+ return content.firstChild;
6718
+ };
6719
+ }
6720
+ function insert(node, parent, anchor) {
6721
+ parent.insertBefore(node, anchor);
6722
+ }
6723
+ function remove(node, parent) {
6724
+ parent.removeChild(node);
6725
+ }
6726
+ function nextSibling(node) {
6727
+ return node.nextSibling;
6728
+ }
6729
+ function attachShadow(element, options) {
6730
+ if (!isNull2(element.shadowRoot)) {
6731
+ return element.shadowRoot;
6732
+ }
6733
+ return element.attachShadow(options);
6734
+ }
6735
+ function setText(node, content) {
6736
+ node.nodeValue = content;
6737
+ }
6738
+ function getProperty(node, key) {
6739
+ return node[key];
6740
+ }
6741
+ function setProperty(node, key, value) {
6742
+ node[key] = value;
6743
+ }
6744
+ function getAttribute(element, name, namespace) {
6745
+ return isUndefined2(namespace) ? element.getAttribute(name) : element.getAttributeNS(namespace, name);
6746
+ }
6747
+ function setAttribute(element, name, value, namespace) {
6748
+ return isUndefined2(namespace) ? element.setAttribute(name, value) : element.setAttributeNS(namespace, name, value);
6749
+ }
6750
+ function removeAttribute(element, name, namespace) {
6751
+ if (isUndefined2(namespace)) {
6752
+ element.removeAttribute(name);
6753
+ } else {
6754
+ element.removeAttributeNS(namespace, name);
6755
+ }
6756
+ }
6757
+ function addEventListener(target, type, callback, options) {
6758
+ target.addEventListener(type, callback, options);
6759
+ }
6760
+ function removeEventListener(target, type, callback, options) {
6761
+ target.removeEventListener(type, callback, options);
6762
+ }
6763
+ function dispatchEvent(target, event) {
6764
+ return target.dispatchEvent(event);
6765
+ }
6766
+ function getClassList(element) {
6767
+ return element.classList;
6768
+ }
6769
+ function setCSSStyleProperty(element, name, value, important) {
6770
+ element.style.setProperty(name, value, important ? "important" : "");
6771
+ }
6772
+ function getBoundingClientRect(element) {
6773
+ return element.getBoundingClientRect();
6774
+ }
6775
+ function querySelector(element, selectors) {
6776
+ return element.querySelector(selectors);
6777
+ }
6778
+ function querySelectorAll(element, selectors) {
6779
+ return element.querySelectorAll(selectors);
6780
+ }
6781
+ function getElementsByTagName(element, tagNameOrWildCard) {
6782
+ return element.getElementsByTagName(tagNameOrWildCard);
6783
+ }
6784
+ function getElementsByClassName(element, names) {
6785
+ return element.getElementsByClassName(names);
6786
+ }
6787
+ function getChildren(element) {
6788
+ return element.children;
6789
+ }
6790
+ function getChildNodes(element) {
6791
+ return element.childNodes;
6792
+ }
6793
+ function getFirstChild(element) {
6794
+ return element.firstChild;
6795
+ }
6796
+ function getFirstElementChild(element) {
6797
+ return element.firstElementChild;
6798
+ }
6799
+ function getLastChild(element) {
6800
+ return element.lastChild;
6801
+ }
6802
+ function getLastElementChild(element) {
6803
+ return element.lastElementChild;
6804
+ }
6805
+ function isConnected(node) {
6806
+ return node.isConnected;
6807
+ }
6808
+ function assertInstanceOfHTMLElement(elm, msg) {
6809
+ assert2.invariant(elm instanceof HTMLElement, msg);
6810
+ }
6811
+ exports2.addEventListener = addEventListener;
6812
+ exports2.assertInstanceOfHTMLElement = assertInstanceOfHTMLElement;
6813
+ exports2.attachShadow = attachShadow;
6814
+ exports2.cloneNode = cloneNode;
6815
+ exports2.createComment = createComment;
6816
+ exports2.createElement = createElement2;
6817
+ exports2.createText = createText;
6818
+ exports2.dispatchEvent = dispatchEvent;
6819
+ exports2.getAttribute = getAttribute;
6820
+ exports2.getBoundingClientRect = getBoundingClientRect;
6821
+ exports2.getChildNodes = getChildNodes;
6822
+ exports2.getChildren = getChildren;
6823
+ exports2.getClassList = getClassList;
6824
+ exports2.getElementsByClassName = getElementsByClassName;
6825
+ exports2.getElementsByTagName = getElementsByTagName;
6826
+ exports2.getFirstChild = getFirstChild;
6827
+ exports2.getFirstElementChild = getFirstElementChild;
6828
+ exports2.getLastChild = getLastChild;
6829
+ exports2.getLastElementChild = getLastElementChild;
6830
+ exports2.getProperty = getProperty;
6831
+ exports2.insert = insert;
6832
+ exports2.isConnected = isConnected;
6833
+ exports2.nextSibling = nextSibling;
6834
+ exports2.querySelector = querySelector;
6835
+ exports2.querySelectorAll = querySelectorAll;
6836
+ exports2.remove = remove;
6837
+ exports2.removeAttribute = removeAttribute;
6838
+ exports2.removeEventListener = removeEventListener;
6839
+ exports2.setAttribute = setAttribute;
6840
+ exports2.setCSSStyleProperty = setCSSStyleProperty;
6841
+ exports2.setProperty = setProperty;
6842
+ exports2.setText = setText;
6843
+ return exports2;
6844
+ }({});
6845
+ Object.setPrototypeOf(renderer2, baseRenderer);
6846
+ return renderer2;
6847
+ }
6848
+ const renderer = assign(rendererFactory(null), {
6022
6849
  insertStylesheet,
6023
- assertInstanceOfHTMLElement,
6024
- defineCustomElement,
6025
- getCustomElement
6026
- };
6850
+ createCustomElement,
6851
+ isNativeShadowDefined: _globalThis[KEY__IS_NATIVE_SHADOW_ROOT_DEFINED],
6852
+ isSyntheticShadowDefined: hasOwnProperty$1.call(Element.prototype, KEY__SHADOW_TOKEN)
6853
+ });
6027
6854
  function resetShadowRootAndLightDom(element, Ctor) {
6028
6855
  if (element.shadowRoot) {
6029
6856
  const shadowRoot = element.shadowRoot;
@@ -6064,18 +6891,13 @@ No further warnings will appear.`);
6064
6891
  return;
6065
6892
  }
6066
6893
  try {
6067
- setIsHydrating(true);
6068
6894
  const vm = createVMWithProps(element, Ctor, props);
6069
6895
  hydrateRoot(vm);
6070
- setIsHydrating(false);
6071
6896
  } catch (e) {
6072
6897
  console.error("Recovering from error while hydrating: ", e);
6073
6898
  resetShadowRootAndLightDom(element, Ctor);
6074
6899
  createVMWithProps(element, Ctor, props);
6075
- setIsHydrating(false);
6076
6900
  connectRootElement(element);
6077
- } finally {
6078
- setIsHydrating(false);
6079
6901
  }
6080
6902
  }
6081
6903
  function deprecatedBuildCustomElementConstructor(Ctor) {
@@ -6086,8 +6908,15 @@ No further warnings will appear.`);
6086
6908
  }
6087
6909
  const hydratedCustomElements = new WeakSet();
6088
6910
  function buildCustomElementConstructor(Ctor) {
6911
+ var _a;
6089
6912
  const HtmlPrototype = getComponentHtmlPrototype(Ctor);
6090
- return class extends HtmlPrototype {
6913
+ const {
6914
+ observedAttributes
6915
+ } = HtmlPrototype;
6916
+ const {
6917
+ attributeChangedCallback
6918
+ } = HtmlPrototype.prototype;
6919
+ return _a = class extends HTMLElement {
6091
6920
  constructor() {
6092
6921
  super();
6093
6922
  if (this.isConnected) {
@@ -6111,7 +6940,10 @@ No further warnings will appear.`);
6111
6940
  disconnectedCallback() {
6112
6941
  disconnectRootElement(this);
6113
6942
  }
6114
- };
6943
+ attributeChangedCallback(name, oldValue, newValue) {
6944
+ attributeChangedCallback.call(this, name, oldValue, newValue);
6945
+ }
6946
+ }, _a.observedAttributes = observedAttributes, _a;
6115
6947
  }
6116
6948
  const _Node$1 = Node;
6117
6949
  const ConnectingSlot = new WeakMap();
@@ -6126,32 +6958,34 @@ No further warnings will appear.`);
6126
6958
  }
6127
6959
  return node;
6128
6960
  }
6129
- const {
6130
- appendChild,
6131
- insertBefore,
6132
- removeChild,
6133
- replaceChild
6134
- } = _Node$1.prototype;
6135
- assign(_Node$1.prototype, {
6136
- appendChild(newChild) {
6137
- const appendedNode = appendChild.call(this, newChild);
6138
- return callNodeSlot(appendedNode, ConnectingSlot);
6139
- },
6140
- insertBefore(newChild, referenceNode) {
6141
- const insertedNode = insertBefore.call(this, newChild, referenceNode);
6142
- return callNodeSlot(insertedNode, ConnectingSlot);
6143
- },
6144
- removeChild(oldChild) {
6145
- const removedNode = removeChild.call(this, oldChild);
6146
- return callNodeSlot(removedNode, DisconnectingSlot);
6147
- },
6148
- replaceChild(newChild, oldChild) {
6149
- const replacedNode = replaceChild.call(this, newChild, oldChild);
6150
- callNodeSlot(replacedNode, DisconnectingSlot);
6151
- callNodeSlot(newChild, ConnectingSlot);
6152
- return replacedNode;
6153
- }
6154
- });
6961
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
6962
+ const {
6963
+ appendChild,
6964
+ insertBefore,
6965
+ removeChild,
6966
+ replaceChild
6967
+ } = _Node$1.prototype;
6968
+ assign(_Node$1.prototype, {
6969
+ appendChild(newChild) {
6970
+ const appendedNode = appendChild.call(this, newChild);
6971
+ return callNodeSlot(appendedNode, ConnectingSlot);
6972
+ },
6973
+ insertBefore(newChild, referenceNode) {
6974
+ const insertedNode = insertBefore.call(this, newChild, referenceNode);
6975
+ return callNodeSlot(insertedNode, ConnectingSlot);
6976
+ },
6977
+ removeChild(oldChild) {
6978
+ const removedNode = removeChild.call(this, oldChild);
6979
+ return callNodeSlot(removedNode, DisconnectingSlot);
6980
+ },
6981
+ replaceChild(newChild, oldChild) {
6982
+ const replacedNode = replaceChild.call(this, newChild, oldChild);
6983
+ callNodeSlot(replacedNode, DisconnectingSlot);
6984
+ callNodeSlot(newChild, ConnectingSlot);
6985
+ return replacedNode;
6986
+ }
6987
+ });
6988
+ }
6155
6989
  function createElement(sel, options) {
6156
6990
  if (!isObject(options) || isNull(options)) {
6157
6991
  throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
@@ -6160,21 +6994,32 @@ No further warnings will appear.`);
6160
6994
  if (!isFunction$1(Ctor)) {
6161
6995
  throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
6162
6996
  }
6163
- const UpgradableConstructor = getUpgradableConstructor(sel, renderer);
6164
- let wasComponentUpgraded = false;
6165
- const element = new UpgradableConstructor((elm) => {
6997
+ const {
6998
+ createCustomElement: createCustomElement2
6999
+ } = renderer;
7000
+ const tagName = StringToLowerCase.call(sel);
7001
+ const upgradeCallback = (elm) => {
6166
7002
  createVM(elm, Ctor, renderer, {
6167
- tagName: sel,
7003
+ tagName,
6168
7004
  mode: options.mode !== "closed" ? "open" : "closed",
6169
7005
  owner: null
6170
7006
  });
6171
- ConnectingSlot.set(elm, connectRootElement);
6172
- DisconnectingSlot.set(elm, disconnectRootElement);
6173
- wasComponentUpgraded = true;
6174
- });
6175
- if (!wasComponentUpgraded) {
6176
- console.error(`Unexpected tag name "${sel}". This name is a registered custom element, preventing LWC to upgrade the element.`);
7007
+ if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7008
+ ConnectingSlot.set(elm, connectRootElement);
7009
+ DisconnectingSlot.set(elm, disconnectRootElement);
7010
+ }
7011
+ };
7012
+ let connectedCallback;
7013
+ let disconnectedCallback;
7014
+ if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7015
+ connectedCallback = (elm) => {
7016
+ connectRootElement(elm);
7017
+ };
7018
+ disconnectedCallback = (elm) => {
7019
+ disconnectRootElement(elm);
7020
+ };
6177
7021
  }
7022
+ const element = createCustomElement2(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
6178
7023
  return element;
6179
7024
  }
6180
7025
  const _Node = Node;
@@ -6189,7 +7034,7 @@ No further warnings will appear.`);
6189
7034
  if (rootNode instanceof ShadowRoot && isFalse(hasOwnProperty$1.call(getPrototypeOf$1(rootNode), "synthetic"))) {
6190
7035
  return true;
6191
7036
  }
6192
- return isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
7037
+ return renderer.isSyntheticShadowDefined && !isUndefined$1(node[KEY__SHADOW_RESOLVER]);
6193
7038
  }
6194
7039
  const ComponentConstructorToCustomElementConstructorMap = new Map();
6195
7040
  function getCustomElementConstructor(Ctor) {
@@ -6230,6 +7075,7 @@ No further warnings will appear.`);
6230
7075
  exports.registerDecorators = registerDecorators;
6231
7076
  exports.registerTemplate = registerTemplate;
6232
7077
  exports.renderer = renderer;
7078
+ exports.rendererFactory = rendererFactory;
6233
7079
  exports.sanitizeAttribute = sanitizeAttribute;
6234
7080
  exports.setFeatureFlag = setFeatureFlag;
6235
7081
  exports.setFeatureFlagForTest = setFeatureFlagForTest;