lwc 2.29.0 → 2.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +319 -683
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +319 -683
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +201 -624
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1138 -2843
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +892 -2428
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +319 -683
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +201 -624
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1138 -2843
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +892 -2428
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +204 -584
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +204 -584
  17. package/dist/synthetic-shadow/esm/es2017/synthetic-shadow.js +99 -323
  18. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow.js +99 -323
  19. package/dist/synthetic-shadow/iife/es2017/synthetic-shadow_debug.js +98 -316
  20. package/dist/synthetic-shadow/iife/es5/synthetic-shadow.js +483 -1220
  21. package/dist/synthetic-shadow/iife/es5/synthetic-shadow_debug.js +470 -1187
  22. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow.js +99 -323
  23. package/dist/synthetic-shadow/umd/es2017/synthetic-shadow_debug.js +98 -316
  24. package/dist/synthetic-shadow/umd/es5/synthetic-shadow.js +483 -1220
  25. package/dist/synthetic-shadow/umd/es5/synthetic-shadow_debug.js +470 -1187
  26. package/dist/wire-service/esm/es2017/wire-service.js +2 -2
  27. package/dist/wire-service/iife/es2017/wire-service.js +2 -2
  28. package/dist/wire-service/iife/es2017/wire-service.min.js +1 -1
  29. package/dist/wire-service/iife/es2017/wire-service_debug.js +2 -2
  30. package/dist/wire-service/iife/es5/wire-service.js +13 -68
  31. package/dist/wire-service/iife/es5/wire-service_debug.js +13 -68
  32. package/dist/wire-service/umd/es2017/wire-service.js +2 -2
  33. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  34. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -2
  35. package/dist/wire-service/umd/es5/wire-service.js +13 -68
  36. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -68
  37. package/package.json +7 -7
@@ -294,7 +294,7 @@
294
294
  CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);
295
295
  return attributeName;
296
296
  }
297
- /** version: 2.29.0 */
297
+ /** version: 2.30.0 */
298
298
 
299
299
  /**
300
300
  * Copyright (C) 2018 salesforce.com, inc.
@@ -376,7 +376,7 @@
376
376
  patch$1(propName);
377
377
  }
378
378
  }
379
- /** version: 2.29.0 */
379
+ /** version: 2.30.0 */
380
380
 
381
381
  /**
382
382
  * Copyright (C) 2018 salesforce.com, inc.
@@ -1705,30 +1705,23 @@
1705
1705
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
1706
1706
  */
1707
1707
  function api$1() {
1708
-
1709
1708
  throw new Error();
1710
1709
  }
1711
1710
  function createPublicPropertyDescriptor(key) {
1712
1711
  return {
1713
1712
  get() {
1714
1713
  const vm = getAssociatedVM(this);
1715
-
1716
1714
  if (isBeingConstructed(vm)) {
1717
-
1718
1715
  return;
1719
1716
  }
1720
-
1721
1717
  componentValueObserved(vm, key);
1722
1718
  return vm.cmpProps[key];
1723
1719
  },
1724
-
1725
1720
  set(newValue) {
1726
1721
  const vm = getAssociatedVM(this);
1727
-
1728
1722
  vm.cmpProps[key] = newValue;
1729
1723
  componentValueMutated(vm, key);
1730
1724
  },
1731
-
1732
1725
  enumerable: true,
1733
1726
  configurable: true
1734
1727
  };
@@ -1740,33 +1733,25 @@
1740
1733
  enumerable,
1741
1734
  configurable
1742
1735
  } = descriptor;
1743
-
1744
1736
  if (!isFunction$1(get)) {
1745
-
1746
1737
  throw new Error();
1747
1738
  }
1748
-
1749
1739
  return {
1750
1740
  get() {
1751
-
1752
1741
  return get.call(this);
1753
1742
  },
1754
-
1755
1743
  set(newValue) {
1756
1744
  const vm = getAssociatedVM(this);
1757
-
1758
1745
  if (set) {
1759
1746
  if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
1760
1747
  let ro = vm.oar[key];
1761
-
1762
1748
  if (isUndefined$1(ro)) {
1763
1749
  ro = vm.oar[key] = createAccessorReactiveObserver(vm, set);
1764
- } // every time we invoke this setter from outside (through this wrapper setter)
1750
+ }
1751
+ // every time we invoke this setter from outside (through this wrapper setter)
1765
1752
  // we should reset the value and then debounce just in case there is a pending
1766
1753
  // invocation the next tick that is not longer relevant since the value is changing
1767
1754
  // from outside.
1768
-
1769
-
1770
1755
  ro.reset(newValue);
1771
1756
  ro.observe(() => {
1772
1757
  set.call(this, newValue);
@@ -1776,7 +1761,6 @@
1776
1761
  }
1777
1762
  }
1778
1763
  },
1779
-
1780
1764
  enumerable,
1781
1765
  configurable
1782
1766
  };
@@ -2364,11 +2348,9 @@
2364
2348
  * SPDX-License-Identifier: MIT
2365
2349
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
2366
2350
  */
2367
-
2368
2351
  function makeHostToken(token) {
2369
2352
  return `${token}-host`;
2370
2353
  }
2371
-
2372
2354
  function createInlineStyleVNode(content) {
2373
2355
  return api.h('style', {
2374
2356
  key: 'style',
@@ -2377,7 +2359,6 @@
2377
2359
  }
2378
2360
  }, [api.t(content)]);
2379
2361
  }
2380
-
2381
2362
  function updateStylesheetToken(vm, template) {
2382
2363
  const {
2383
2364
  elm,
@@ -2394,104 +2375,73 @@
2394
2375
  stylesheets: newStylesheets,
2395
2376
  stylesheetToken: newStylesheetToken
2396
2377
  } = template;
2397
- const isSyntheticShadow = renderMode === 1
2398
- /* RenderMode.Shadow */
2399
- && shadowMode === 1
2400
- /* ShadowMode.Synthetic */
2401
- ;
2378
+ const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
2402
2379
  const {
2403
2380
  hasScopedStyles
2404
2381
  } = context;
2405
2382
  let newToken;
2406
2383
  let newHasTokenInClass;
2407
- let newHasTokenInAttribute; // Reset the styling token applied to the host element.
2408
-
2384
+ let newHasTokenInAttribute;
2385
+ // Reset the styling token applied to the host element.
2409
2386
  const {
2410
2387
  stylesheetToken: oldToken,
2411
2388
  hasTokenInClass: oldHasTokenInClass,
2412
2389
  hasTokenInAttribute: oldHasTokenInAttribute
2413
2390
  } = context;
2414
-
2415
2391
  if (!isUndefined$1(oldToken)) {
2416
2392
  if (oldHasTokenInClass) {
2417
2393
  getClassList(elm).remove(makeHostToken(oldToken));
2418
2394
  }
2419
-
2420
2395
  if (oldHasTokenInAttribute) {
2421
2396
  removeAttribute(elm, makeHostToken(oldToken));
2422
2397
  }
2423
- } // Apply the new template styling token to the host element, if the new template has any
2398
+ }
2399
+ // Apply the new template styling token to the host element, if the new template has any
2424
2400
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
2425
-
2426
-
2427
2401
  if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
2428
2402
  newToken = newStylesheetToken;
2429
- } // Set the new styling token on the host element
2430
-
2431
-
2403
+ }
2404
+ // Set the new styling token on the host element
2432
2405
  if (!isUndefined$1(newToken)) {
2433
2406
  if (hasScopedStyles) {
2434
2407
  getClassList(elm).add(makeHostToken(newToken));
2435
2408
  newHasTokenInClass = true;
2436
2409
  }
2437
-
2438
2410
  if (isSyntheticShadow) {
2439
2411
  setAttribute(elm, makeHostToken(newToken), '');
2440
2412
  newHasTokenInAttribute = true;
2441
2413
  }
2442
- } // Update the styling tokens present on the context object.
2443
-
2444
-
2414
+ }
2415
+ // Update the styling tokens present on the context object.
2445
2416
  context.stylesheetToken = newToken;
2446
2417
  context.hasTokenInClass = newHasTokenInClass;
2447
2418
  context.hasTokenInAttribute = newHasTokenInAttribute;
2448
2419
  }
2449
-
2450
2420
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
2451
2421
  const content = [];
2452
2422
  let root;
2453
-
2454
2423
  for (let i = 0; i < stylesheets.length; i++) {
2455
2424
  let stylesheet = stylesheets[i];
2456
-
2457
2425
  if (isArray$1(stylesheet)) {
2458
2426
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
2459
2427
  } else {
2460
-
2461
2428
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
2462
-
2463
2429
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
2464
- if (!isScopedCss && vm.renderMode === 0
2465
- /* RenderMode.Light */
2466
- ) {
2430
+ if (!isScopedCss && vm.renderMode === 0 /* RenderMode.Light */) {
2467
2431
  logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
2468
2432
  continue;
2469
2433
  }
2470
- } // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
2471
-
2472
-
2473
- const scopeToken = isScopedCss || vm.shadowMode === 1
2474
- /* ShadowMode.Synthetic */
2475
- && vm.renderMode === 1
2476
- /* RenderMode.Shadow */
2477
- ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
2434
+ }
2435
+ // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
2436
+ const scopeToken = isScopedCss || vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */ ? stylesheetToken : undefined;
2437
+ // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
2478
2438
  // native shadow DOM. Synthetic shadow DOM never uses `:host`.
2479
-
2480
- const useActualHostSelector = vm.renderMode === 0
2481
- /* RenderMode.Light */
2482
- ? !isScopedCss : vm.shadowMode === 0
2483
- /* ShadowMode.Native */
2484
- ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
2439
+ const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */ ? !isScopedCss : vm.shadowMode === 0 /* ShadowMode.Native */;
2440
+ // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
2485
2441
  // we use an attribute selector on the host to simulate :dir().
2486
-
2487
2442
  let useNativeDirPseudoclass;
2488
-
2489
- if (vm.renderMode === 1
2490
- /* RenderMode.Shadow */
2491
- ) {
2492
- useNativeDirPseudoclass = vm.shadowMode === 0
2493
- /* ShadowMode.Native */
2494
- ;
2443
+ if (vm.renderMode === 1 /* RenderMode.Shadow */) {
2444
+ useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
2495
2445
  } else {
2496
2446
  // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
2497
2447
  // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
@@ -2499,48 +2449,36 @@
2499
2449
  // Only calculate the root once as necessary
2500
2450
  root = getNearestShadowComponent(vm);
2501
2451
  }
2502
-
2503
- useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
2504
- /* ShadowMode.Native */
2505
- ;
2452
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
2506
2453
  }
2507
2454
 
2508
2455
  ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
2509
2456
  }
2510
2457
  }
2511
-
2512
2458
  return content;
2513
2459
  }
2514
-
2515
2460
  function getStylesheetsContent(vm, template) {
2516
2461
  const {
2517
2462
  stylesheets,
2518
2463
  stylesheetToken
2519
2464
  } = template;
2520
2465
  let content = [];
2521
-
2522
2466
  if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
2523
2467
  content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
2524
2468
  }
2525
-
2526
2469
  return content;
2527
- } // It might be worth caching this to avoid doing the lookup repeatedly, but
2470
+ }
2471
+ // It might be worth caching this to avoid doing the lookup repeatedly, but
2528
2472
  // perf testing has not shown it to be a huge improvement yet:
2529
2473
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
2530
-
2531
2474
  function getNearestShadowComponent(vm) {
2532
2475
  let owner = vm;
2533
-
2534
2476
  while (!isNull(owner)) {
2535
- if (owner.renderMode === 1
2536
- /* RenderMode.Shadow */
2537
- ) {
2477
+ if (owner.renderMode === 1 /* RenderMode.Shadow */) {
2538
2478
  return owner;
2539
2479
  }
2540
-
2541
2480
  owner = owner.owner;
2542
2481
  }
2543
-
2544
2482
  return owner;
2545
2483
  }
2546
2484
  /**
@@ -2548,8 +2486,6 @@
2548
2486
  * this returns the unique token for that scoped stylesheet. Otherwise
2549
2487
  * it returns null.
2550
2488
  */
2551
-
2552
-
2553
2489
  function getScopeTokenClass(owner) {
2554
2490
  const {
2555
2491
  cmpTemplate,
@@ -2563,7 +2499,6 @@
2563
2499
  *
2564
2500
  * A host style token is applied to the component if scoped styles are used.
2565
2501
  */
2566
-
2567
2502
  function getStylesheetTokenHost(vnode) {
2568
2503
  const {
2569
2504
  template
@@ -2573,21 +2508,15 @@
2573
2508
  } = template;
2574
2509
  return !isUndefined$1(stylesheetToken) && computeHasScopedStyles(template) ? makeHostToken(stylesheetToken) : null;
2575
2510
  }
2576
-
2577
2511
  function getNearestNativeShadowComponent(vm) {
2578
2512
  const owner = getNearestShadowComponent(vm);
2579
-
2580
- if (!isNull(owner) && owner.shadowMode === 1
2581
- /* ShadowMode.Synthetic */
2582
- ) {
2513
+ if (!isNull(owner) && owner.shadowMode === 1 /* ShadowMode.Synthetic */) {
2583
2514
  // Synthetic-within-native is impossible. So if the nearest shadow component is
2584
2515
  // synthetic, we know we won't find a native component if we go any further.
2585
2516
  return null;
2586
2517
  }
2587
-
2588
2518
  return owner;
2589
2519
  }
2590
-
2591
2520
  function createStylesheet(vm, stylesheets) {
2592
2521
  const {
2593
2522
  renderMode,
@@ -2596,12 +2525,7 @@
2596
2525
  insertStylesheet
2597
2526
  }
2598
2527
  } = vm;
2599
-
2600
- if (renderMode === 1
2601
- /* RenderMode.Shadow */
2602
- && shadowMode === 1
2603
- /* ShadowMode.Synthetic */
2604
- ) {
2528
+ if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
2605
2529
  for (let i = 0; i < stylesheets.length; i++) {
2606
2530
  insertStylesheet(stylesheets[i]);
2607
2531
  }
@@ -2613,15 +2537,13 @@
2613
2537
  return ArrayMap.call(stylesheets, createInlineStyleVNode);
2614
2538
  } else {
2615
2539
  // native shadow or light DOM, DOM renderer
2616
- const root = getNearestNativeShadowComponent(vm); // null root means a global style
2617
-
2540
+ const root = getNearestNativeShadowComponent(vm);
2541
+ // null root means a global style
2618
2542
  const target = isNull(root) ? undefined : root.shadowRoot;
2619
-
2620
2543
  for (let i = 0; i < stylesheets.length; i++) {
2621
2544
  insertStylesheet(stylesheets[i], target);
2622
2545
  }
2623
2546
  }
2624
-
2625
2547
  return null;
2626
2548
  }
2627
2549
 
@@ -2895,110 +2817,68 @@
2895
2817
  updateStaticChildren(c1, c2, parent, renderer);
2896
2818
  }
2897
2819
  }
2898
-
2899
2820
  function patch(n1, n2, parent, renderer) {
2900
2821
  var _a, _b;
2901
-
2902
2822
  if (n1 === n2) {
2903
2823
  return;
2904
2824
  }
2905
-
2906
2825
  switch (n2.type) {
2907
- case 0
2908
- /* VNodeType.Text */
2909
- :
2826
+ case 0 /* VNodeType.Text */:
2910
2827
  // VText has no special capability, fallback to the owner's renderer
2911
2828
  patchText(n1, n2, renderer);
2912
2829
  break;
2913
-
2914
- case 1
2915
- /* VNodeType.Comment */
2916
- :
2830
+ case 1 /* VNodeType.Comment */:
2917
2831
  // VComment has no special capability, fallback to the owner's renderer
2918
2832
  patchComment(n1, n2, renderer);
2919
2833
  break;
2920
-
2921
- case 4
2922
- /* VNodeType.Static */
2923
- :
2834
+ case 4 /* VNodeType.Static */:
2924
2835
  n2.elm = n1.elm;
2925
2836
  break;
2926
-
2927
- case 5
2928
- /* VNodeType.Fragment */
2929
- :
2837
+ case 5 /* VNodeType.Fragment */:
2930
2838
  patchFragment(n1, n2, parent, renderer);
2931
2839
  break;
2932
-
2933
- case 2
2934
- /* VNodeType.Element */
2935
- :
2840
+ case 2 /* VNodeType.Element */:
2936
2841
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
2937
2842
  break;
2938
-
2939
- case 3
2940
- /* VNodeType.CustomElement */
2941
- :
2843
+ case 3 /* VNodeType.CustomElement */:
2942
2844
  patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
2943
2845
  break;
2944
2846
  }
2945
2847
  }
2946
-
2947
2848
  function mount(node, parent, renderer, anchor) {
2948
2849
  var _a, _b;
2949
-
2950
2850
  switch (node.type) {
2951
- case 0
2952
- /* VNodeType.Text */
2953
- :
2851
+ case 0 /* VNodeType.Text */:
2954
2852
  // VText has no special capability, fallback to the owner's renderer
2955
2853
  mountText(node, parent, anchor, renderer);
2956
2854
  break;
2957
-
2958
- case 1
2959
- /* VNodeType.Comment */
2960
- :
2855
+ case 1 /* VNodeType.Comment */:
2961
2856
  // VComment has no special capability, fallback to the owner's renderer
2962
2857
  mountComment(node, parent, anchor, renderer);
2963
2858
  break;
2964
-
2965
- case 4
2966
- /* VNodeType.Static */
2967
- :
2859
+ case 4 /* VNodeType.Static */:
2968
2860
  // VStatic cannot have a custom renderer associated to them, using owner's renderer
2969
2861
  mountStatic(node, parent, anchor, renderer);
2970
2862
  break;
2971
-
2972
- case 5
2973
- /* VNodeType.Fragment */
2974
- :
2863
+ case 5 /* VNodeType.Fragment */:
2975
2864
  mountFragment(node, parent, anchor, renderer);
2976
2865
  break;
2977
-
2978
- case 2
2979
- /* VNodeType.Element */
2980
- :
2866
+ case 2 /* VNodeType.Element */:
2981
2867
  // If the vnode data has a renderer override use it, else fallback to owner's renderer
2982
2868
  mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
2983
2869
  break;
2984
-
2985
- case 3
2986
- /* VNodeType.CustomElement */
2987
- :
2870
+ case 3 /* VNodeType.CustomElement */:
2988
2871
  // If the vnode data has a renderer override use it, else fallback to owner's renderer
2989
2872
  mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
2990
2873
  break;
2991
2874
  }
2992
2875
  }
2993
-
2994
2876
  function patchText(n1, n2, renderer) {
2995
2877
  n2.elm = n1.elm;
2996
-
2997
2878
  if (n2.text !== n1.text) {
2998
2879
  updateTextContent(n2, renderer);
2999
2880
  }
3000
2881
  }
3001
-
3002
2882
  function mountText(vnode, parent, anchor, renderer) {
3003
2883
  const {
3004
2884
  owner
@@ -3010,16 +2890,14 @@
3010
2890
  linkNodeToShadow(textNode, owner, renderer);
3011
2891
  insertNode(textNode, parent, anchor, renderer);
3012
2892
  }
3013
-
3014
2893
  function patchComment(n1, n2, renderer) {
3015
- n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
2894
+ n2.elm = n1.elm;
2895
+ // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3016
2896
  // it is the case today.
3017
-
3018
2897
  if (n2.text !== n1.text) {
3019
2898
  updateTextContent(n2, renderer);
3020
2899
  }
3021
2900
  }
3022
-
3023
2901
  function mountComment(vnode, parent, anchor, renderer) {
3024
2902
  const {
3025
2903
  owner
@@ -3031,32 +2909,27 @@
3031
2909
  linkNodeToShadow(commentNode, owner, renderer);
3032
2910
  insertNode(commentNode, parent, anchor, renderer);
3033
2911
  }
3034
-
3035
2912
  function mountFragment(vnode, parent, anchor, renderer) {
3036
2913
  const {
3037
2914
  children
3038
2915
  } = vnode;
3039
- mountVNodes(children, parent, renderer, anchor); // children of a fragment will always have at least the two delimiters.
3040
-
2916
+ mountVNodes(children, parent, renderer, anchor);
2917
+ // children of a fragment will always have at least the two delimiters.
3041
2918
  vnode.elm = children[children.length - 1].elm;
3042
2919
  }
3043
-
3044
2920
  function patchFragment(n1, n2, parent, renderer) {
3045
2921
  const {
3046
2922
  children,
3047
2923
  stable
3048
2924
  } = n2;
3049
-
3050
2925
  if (stable) {
3051
2926
  updateStaticChildren(n1.children, children, parent, renderer);
3052
2927
  } else {
3053
2928
  updateDynamicChildren(n1.children, children, parent, renderer);
3054
- } // Note: not reusing n1.elm, because during patching, it may be patched with another text node.
3055
-
3056
-
2929
+ }
2930
+ // Note: not reusing n1.elm, because during patching, it may be patched with another text node.
3057
2931
  n2.elm = children[children.length - 1].elm;
3058
2932
  }
3059
-
3060
2933
  function mountElement(vnode, parent, anchor, renderer) {
3061
2934
  const {
3062
2935
  sel,
@@ -3077,13 +2950,11 @@
3077
2950
  insertNode(elm, parent, anchor, renderer);
3078
2951
  mountVNodes(vnode.children, elm, renderer, null);
3079
2952
  }
3080
-
3081
2953
  function patchElement(n1, n2, renderer) {
3082
2954
  const elm = n2.elm = n1.elm;
3083
2955
  patchElementPropsAndAttrs$1(n1, n2, renderer);
3084
2956
  patchChildren(n1.children, n2.children, elm, renderer);
3085
2957
  }
3086
-
3087
2958
  function mountStatic(vnode, parent, anchor, renderer) {
3088
2959
  const {
3089
2960
  owner
@@ -3094,25 +2965,18 @@
3094
2965
  } = renderer;
3095
2966
  const elm = vnode.elm = cloneNode(vnode.fragment, true);
3096
2967
  linkNodeToShadow(elm, owner, renderer);
3097
-
2968
+ // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3098
2969
  const {
3099
2970
  renderMode,
3100
2971
  shadowMode
3101
2972
  } = owner;
3102
-
3103
2973
  if (isSyntheticShadowDefined) {
3104
- if (shadowMode === 1
3105
- /* ShadowMode.Synthetic */
3106
- || renderMode === 0
3107
- /* RenderMode.Light */
3108
- ) {
2974
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
3109
2975
  elm[KEY__SHADOW_STATIC] = true;
3110
2976
  }
3111
2977
  }
3112
-
3113
2978
  insertNode(elm, parent, anchor, renderer);
3114
2979
  }
3115
-
3116
2980
  function mountCustomElement(vnode, parent, anchor, renderer) {
3117
2981
  const {
3118
2982
  sel,
@@ -3127,60 +2991,48 @@
3127
2991
  * mechanism that only passes that argument if the constructor is known to be
3128
2992
  * an upgradable custom element.
3129
2993
  */
3130
-
3131
2994
  let vm;
3132
-
3133
2995
  const upgradeCallback = elm => {
3134
2996
  // the custom element from the registry is expecting an upgrade callback
3135
2997
  vm = createViewModelHook(elm, vnode, renderer);
3136
2998
  };
3137
-
3138
2999
  const connectedCallback = elm => {
3139
3000
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3140
3001
  connectRootElement(elm);
3141
3002
  }
3142
3003
  };
3143
-
3144
3004
  const disconnectedCallback = elm => {
3145
3005
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3146
3006
  disconnectRootElement(elm);
3147
3007
  }
3148
- }; // Should never get a tag with upper case letter at this point; the compiler
3008
+ };
3009
+ // Should never get a tag with upper case letter at this point; the compiler
3149
3010
  // should produce only tags with lowercase letters. However, the Java
3150
3011
  // compiler may generate tagnames with uppercase letters so - for backwards
3151
3012
  // compatibility, we lower case the tagname here.
3152
-
3153
-
3154
3013
  const normalizedTagname = sel.toLowerCase();
3155
3014
  const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
3156
3015
  vnode.elm = elm;
3157
3016
  vnode.vm = vm;
3158
3017
  linkNodeToShadow(elm, owner, renderer);
3159
3018
  applyStyleScoping(elm, owner, renderer);
3160
-
3161
3019
  if (vm) {
3162
3020
  allocateChildren(vnode, vm);
3163
3021
  }
3164
-
3165
3022
  patchElementPropsAndAttrs$1(null, vnode, renderer);
3166
3023
  insertNode(elm, parent, anchor, renderer);
3167
-
3168
3024
  if (vm) {
3169
3025
  {
3170
3026
  if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3171
-
3172
3027
  runConnectedCallback(vm);
3173
3028
  }
3174
3029
  }
3175
3030
  }
3176
-
3177
3031
  mountVNodes(vnode.children, elm, renderer, null);
3178
-
3179
3032
  if (vm) {
3180
3033
  appendVM(vm);
3181
3034
  }
3182
3035
  }
3183
-
3184
3036
  function patchCustomElement(n1, n2, parent, renderer) {
3185
3037
  if (n1.ctor !== n2.ctor) {
3186
3038
  // If the constructor, unmount the current component and mount a new one using the new
@@ -3193,17 +3045,14 @@
3193
3045
  const elm = n2.elm = n1.elm;
3194
3046
  const vm = n2.vm = n1.vm;
3195
3047
  patchElementPropsAndAttrs$1(n1, n2, renderer);
3196
-
3197
3048
  if (!isUndefined$1(vm)) {
3198
3049
  // in fallback mode, the allocation will always set children to
3199
3050
  // empty and delegate the real allocation to the slot elements
3200
3051
  allocateChildren(n2, vm);
3201
- } // in fallback mode, the children will be always empty, so, nothing
3052
+ }
3053
+ // in fallback mode, the children will be always empty, so, nothing
3202
3054
  // will happen, but in native, it does allocate the light dom
3203
-
3204
-
3205
3055
  patchChildren(n1.children, n2.children, elm, renderer);
3206
-
3207
3056
  if (!isUndefined$1(vm)) {
3208
3057
  // this will probably update the shadowRoot, but only if the vm is in a dirty state
3209
3058
  // this is important to preserve the top to bottom synchronous rendering phase.
@@ -3211,29 +3060,24 @@
3211
3060
  }
3212
3061
  }
3213
3062
  }
3214
-
3215
3063
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
3216
3064
  for (; start < end; ++start) {
3217
3065
  const vnode = vnodes[start];
3218
-
3219
3066
  if (isVNode(vnode)) {
3220
3067
  mount(vnode, parent, renderer, anchor);
3221
3068
  }
3222
3069
  }
3223
3070
  }
3224
-
3225
3071
  function unmount(vnode, parent, renderer, doRemove = false) {
3226
3072
  const {
3227
3073
  type,
3228
3074
  elm,
3229
3075
  sel
3230
- } = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3076
+ } = vnode;
3077
+ // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3231
3078
  // subtree root, is the only element worth unmounting from the subtree.
3232
-
3233
3079
  if (doRemove) {
3234
- if (type === 5
3235
- /* VNodeType.Fragment */
3236
- ) {
3080
+ if (type === 5 /* VNodeType.Fragment */) {
3237
3081
  unmountVNodes(vnode.children, parent, renderer, doRemove);
3238
3082
  } else {
3239
3083
  // The vnode might or might not have a data.renderer associated to it
@@ -3241,51 +3085,39 @@
3241
3085
  removeNode(elm, parent, renderer);
3242
3086
  }
3243
3087
  }
3244
-
3245
3088
  switch (type) {
3246
- case 2
3247
- /* VNodeType.Element */
3248
- :
3089
+ case 2 /* VNodeType.Element */:
3249
3090
  {
3250
3091
  // Slot content is removed to trigger slotchange event when removing slot.
3251
3092
  // Only required for synthetic shadow.
3252
- const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
3253
- /* ShadowMode.Synthetic */
3254
- ;
3093
+ const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
3255
3094
  unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
3256
3095
  break;
3257
3096
  }
3258
-
3259
- case 3
3260
- /* VNodeType.CustomElement */
3261
- :
3097
+ case 3 /* VNodeType.CustomElement */:
3262
3098
  {
3263
3099
  const {
3264
3100
  vm
3265
- } = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
3101
+ } = vnode;
3102
+ // No need to unmount the children here, `removeVM` will take care of removing the
3266
3103
  // children.
3267
-
3268
3104
  if (!isUndefined$1(vm)) {
3269
3105
  removeVM(vm);
3270
3106
  }
3271
3107
  }
3272
3108
  }
3273
3109
  }
3274
-
3275
3110
  function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
3276
3111
  for (; start < end; ++start) {
3277
3112
  const ch = vnodes[start];
3278
-
3279
3113
  if (isVNode(ch)) {
3280
3114
  unmount(ch, parent, renderer, doRemove);
3281
3115
  }
3282
3116
  }
3283
3117
  }
3284
-
3285
3118
  function isVNode(vnode) {
3286
3119
  return vnode != null;
3287
3120
  }
3288
-
3289
3121
  function linkNodeToShadow(elm, owner, renderer) {
3290
3122
  const {
3291
3123
  renderRoot,
@@ -3294,19 +3126,14 @@
3294
3126
  } = owner;
3295
3127
  const {
3296
3128
  isSyntheticShadowDefined
3297
- } = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
3298
-
3129
+ } = renderer;
3130
+ // TODO [#1164]: this should eventually be done by the polyfill directly
3299
3131
  if (isSyntheticShadowDefined) {
3300
- if (shadowMode === 1
3301
- /* ShadowMode.Synthetic */
3302
- || renderMode === 0
3303
- /* RenderMode.Light */
3304
- ) {
3132
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
3305
3133
  elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
3306
3134
  }
3307
3135
  }
3308
3136
  }
3309
-
3310
3137
  function updateTextContent(vnode, renderer) {
3311
3138
  const {
3312
3139
  elm,
@@ -3315,79 +3142,58 @@
3315
3142
  const {
3316
3143
  setText
3317
3144
  } = renderer;
3318
-
3319
3145
  setText(elm, text);
3320
3146
  }
3321
-
3322
3147
  function insertNode(node, parent, anchor, renderer) {
3323
-
3324
3148
  renderer.insert(node, parent, anchor);
3325
3149
  }
3326
-
3327
3150
  function removeNode(node, parent, renderer) {
3328
-
3329
3151
  renderer.remove(node, parent);
3330
3152
  }
3331
-
3332
3153
  function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
3333
3154
  if (isNull(oldVnode)) {
3334
3155
  applyEventListeners(vnode, renderer);
3335
3156
  applyStaticClassAttribute(vnode, renderer);
3336
3157
  applyStaticStyleAttribute(vnode, renderer);
3337
- } // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
3158
+ }
3159
+ // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
3338
3160
  // value is set before type=radio.
3339
-
3340
-
3341
3161
  patchClassAttribute(oldVnode, vnode, renderer);
3342
3162
  patchStyleAttribute(oldVnode, vnode, renderer);
3343
3163
  patchAttributes(oldVnode, vnode, renderer);
3344
3164
  patchProps(oldVnode, vnode, renderer);
3345
3165
  }
3346
-
3347
3166
  function applyStyleScoping(elm, owner, renderer) {
3348
3167
  // Set the class name for `*.scoped.css` style scoping.
3349
3168
  const scopeToken = getScopeTokenClass(owner);
3350
-
3351
3169
  if (!isNull(scopeToken)) {
3352
3170
  const {
3353
3171
  getClassList
3354
- } = renderer; // TODO [#2762]: this dot notation with add is probably problematic
3172
+ } = renderer;
3173
+ // TODO [#2762]: this dot notation with add is probably problematic
3355
3174
  // probably we should have a renderer api for just the add operation
3356
-
3357
3175
  getClassList(elm).add(scopeToken);
3358
- } // Set property element for synthetic shadow DOM style scoping.
3359
-
3360
-
3176
+ }
3177
+ // Set property element for synthetic shadow DOM style scoping.
3361
3178
  const {
3362
3179
  stylesheetToken: syntheticToken
3363
3180
  } = owner.context;
3364
-
3365
- if (owner.shadowMode === 1
3366
- /* ShadowMode.Synthetic */
3367
- && !isUndefined$1(syntheticToken)) {
3181
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
3368
3182
  elm.$shadowToken$ = syntheticToken;
3369
3183
  }
3370
3184
  }
3371
-
3372
3185
  function applyDomManual(elm, vnode) {
3373
3186
  var _a;
3374
-
3375
3187
  const {
3376
3188
  owner,
3377
3189
  data: {
3378
3190
  context
3379
3191
  }
3380
3192
  } = vnode;
3381
-
3382
- if (owner.shadowMode === 1
3383
- /* ShadowMode.Synthetic */
3384
- && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
3385
- /* LwcDomMode.Manual */
3386
- ) {
3193
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual" /* LwcDomMode.Manual */) {
3387
3194
  elm.$domManual$ = true;
3388
3195
  }
3389
3196
  }
3390
-
3391
3197
  function allocateChildren(vnode, vm) {
3392
3198
  // A component with slots will re-render because:
3393
3199
  // 1- There is a change of the internal state.
@@ -3405,30 +3211,23 @@
3405
3211
  renderMode,
3406
3212
  shadowMode
3407
3213
  } = vm;
3408
-
3409
- if (shadowMode === 1
3410
- /* ShadowMode.Synthetic */
3411
- || renderMode === 0
3412
- /* RenderMode.Light */
3413
- ) {
3214
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
3414
3215
  // slow path
3415
- allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
3416
-
3417
- vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
3418
-
3216
+ allocateInSlot(vm, children, vnode.owner);
3217
+ // save the allocated children in case this vnode is reused.
3218
+ vnode.aChildren = children;
3219
+ // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
3419
3220
  vnode.children = EmptyArray;
3420
3221
  }
3421
3222
  }
3422
-
3423
3223
  function createViewModelHook(elm, vnode, renderer) {
3424
- let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
3224
+ let vm = getAssociatedVMIfPresent(elm);
3225
+ // There is a possibility that a custom element is registered under tagName, in which case, the
3425
3226
  // initialization is already carry on, and there is nothing else to do here since this hook is
3426
3227
  // called right after invoking `document.createElement`.
3427
-
3428
3228
  if (!isUndefined$1(vm)) {
3429
3229
  return vm;
3430
3230
  }
3431
-
3432
3231
  const {
3433
3232
  sel,
3434
3233
  mode,
@@ -3440,44 +3239,34 @@
3440
3239
  owner,
3441
3240
  tagName: sel
3442
3241
  });
3443
-
3444
3242
  return vm;
3445
3243
  }
3446
3244
  /**
3447
3245
  * Collects all slots into a SlotSet, traversing through VFragment Nodes
3448
3246
  */
3449
-
3450
-
3451
3247
  function collectSlots(vm, children, cmpSlotsMapping) {
3452
3248
  var _a, _b;
3453
-
3454
3249
  for (let i = 0, len = children.length; i < len; i += 1) {
3455
3250
  const vnode = children[i];
3456
-
3457
3251
  if (isNull(vnode)) {
3458
3252
  continue;
3459
- } // Dive further iff the content is wrapped in a VFragment
3460
-
3461
-
3253
+ }
3254
+ // Dive further iff the content is wrapped in a VFragment
3462
3255
  if (isVFragment(vnode)) {
3463
3256
  // Remove the text delimiter nodes to avoid overriding default slot content
3464
3257
  collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
3465
3258
  continue;
3466
3259
  }
3467
-
3468
3260
  let slotName = '';
3469
-
3470
3261
  if (isVBaseElement(vnode)) {
3471
3262
  slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
3472
3263
  } else if (isVScopedSlotFragment(vnode)) {
3473
3264
  slotName = vnode.slotName;
3474
3265
  }
3475
-
3476
3266
  const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
3477
3267
  ArrayPush$1.call(vnodes, vnode);
3478
3268
  }
3479
3269
  }
3480
-
3481
3270
  function allocateInSlot(vm, children, owner) {
3482
3271
  const {
3483
3272
  cmpSlots: {
@@ -3490,28 +3279,22 @@
3490
3279
  owner,
3491
3280
  slotAssignments: cmpSlotsMapping
3492
3281
  };
3493
-
3494
3282
  if (isFalse(vm.isDirty)) {
3495
3283
  // We need to determine if the old allocation is really different from the new one
3496
3284
  // and mark the vm as dirty
3497
3285
  const oldKeys = keys(oldSlotsMapping);
3498
-
3499
3286
  if (oldKeys.length !== keys(cmpSlotsMapping).length) {
3500
3287
  markComponentAsDirty(vm);
3501
3288
  return;
3502
3289
  }
3503
-
3504
3290
  for (let i = 0, len = oldKeys.length; i < len; i += 1) {
3505
3291
  const key = oldKeys[i];
3506
-
3507
3292
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
3508
3293
  markComponentAsDirty(vm);
3509
3294
  return;
3510
3295
  }
3511
-
3512
3296
  const oldVNodes = oldSlotsMapping[key];
3513
3297
  const vnodes = cmpSlotsMapping[key];
3514
-
3515
3298
  for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
3516
3299
  if (oldVNodes[j] !== vnodes[j]) {
3517
3300
  markComponentAsDirty(vm);
@@ -3520,40 +3303,33 @@
3520
3303
  }
3521
3304
  }
3522
3305
  }
3523
- } // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
3524
-
3525
-
3526
- const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
3306
+ }
3307
+ // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
3308
+ const FromIteration = new WeakMap();
3309
+ // dynamic children means it was generated by an iteration
3527
3310
  // in a template, and will require a more complex diffing algo.
3528
-
3529
3311
  function markAsDynamicChildren(children) {
3530
3312
  FromIteration.set(children, 1);
3531
3313
  }
3532
-
3533
3314
  function hasDynamicChildren(children) {
3534
3315
  return FromIteration.has(children);
3535
3316
  }
3536
-
3537
3317
  function createKeyToOldIdx(children, beginIdx, endIdx) {
3538
- const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
3539
-
3318
+ const map = {};
3319
+ // TODO [#1637]: simplify this by assuming that all vnodes has keys
3540
3320
  for (let j = beginIdx; j <= endIdx; ++j) {
3541
3321
  const ch = children[j];
3542
-
3543
3322
  if (isVNode(ch)) {
3544
3323
  const {
3545
3324
  key
3546
3325
  } = ch;
3547
-
3548
3326
  if (key !== undefined) {
3549
3327
  map[key] = j;
3550
3328
  }
3551
3329
  }
3552
3330
  }
3553
-
3554
3331
  return map;
3555
3332
  }
3556
-
3557
3333
  function updateDynamicChildren(oldCh, newCh, parent, renderer) {
3558
3334
  let oldStartIdx = 0;
3559
3335
  let newStartIdx = 0;
@@ -3569,7 +3345,6 @@
3569
3345
  let elmToMove;
3570
3346
  let before;
3571
3347
  let clonedOldCh = false;
3572
-
3573
3348
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
3574
3349
  if (!isVNode(oldStartVnode)) {
3575
3350
  oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
@@ -3603,54 +3378,46 @@
3603
3378
  if (oldKeyToIdx === undefined) {
3604
3379
  oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
3605
3380
  }
3606
-
3607
3381
  idxInOld = oldKeyToIdx[newStartVnode.key];
3608
-
3609
3382
  if (isUndefined$1(idxInOld)) {
3610
3383
  // New element
3611
3384
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
3612
3385
  newStartVnode = newCh[++newStartIdx];
3613
3386
  } else {
3614
3387
  elmToMove = oldCh[idxInOld];
3615
-
3616
3388
  if (isVNode(elmToMove)) {
3617
3389
  if (elmToMove.sel !== newStartVnode.sel) {
3618
3390
  // New element
3619
3391
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
3620
3392
  } else {
3621
- patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
3393
+ patch(elmToMove, newStartVnode, parent, renderer);
3394
+ // Delete the old child, but copy the array since it is read-only.
3622
3395
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
3623
3396
  // so we only care about the `oldCh` object inside this function.
3624
3397
  // To avoid cloning over and over again, we check `clonedOldCh`
3625
3398
  // and only clone once.
3626
-
3627
3399
  if (!clonedOldCh) {
3628
3400
  clonedOldCh = true;
3629
3401
  oldCh = [...oldCh];
3630
- } // We've already cloned at least once, so it's no longer read-only
3631
-
3632
-
3402
+ }
3403
+ // We've already cloned at least once, so it's no longer read-only
3633
3404
  oldCh[idxInOld] = undefined;
3634
3405
  insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
3635
3406
  }
3636
3407
  }
3637
-
3638
3408
  newStartVnode = newCh[++newStartIdx];
3639
3409
  }
3640
3410
  }
3641
3411
  }
3642
-
3643
3412
  if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
3644
3413
  if (oldStartIdx > oldEndIdx) {
3645
3414
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
3646
3415
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
3647
3416
  let i = newEndIdx;
3648
3417
  let n;
3649
-
3650
3418
  do {
3651
3419
  n = newCh[++i];
3652
3420
  } while (!isVNode(n) && i < newChEnd);
3653
-
3654
3421
  before = isVNode(n) ? n.elm : null;
3655
3422
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
3656
3423
  } else {
@@ -3658,32 +3425,26 @@
3658
3425
  }
3659
3426
  }
3660
3427
  }
3661
-
3662
3428
  function updateStaticChildren(c1, c2, parent, renderer) {
3663
3429
  const c1Length = c1.length;
3664
3430
  const c2Length = c2.length;
3665
-
3666
3431
  if (c1Length === 0) {
3667
3432
  // the old list is empty, we can directly insert anything new
3668
3433
  mountVNodes(c2, parent, renderer, null);
3669
3434
  return;
3670
3435
  }
3671
-
3672
3436
  if (c2Length === 0) {
3673
3437
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
3674
3438
  // this is the case in which the dynamic children of an if-directive should be removed
3675
3439
  unmountVNodes(c1, parent, renderer, true);
3676
3440
  return;
3677
- } // if the old list is not empty, the new list MUST have the same
3441
+ }
3442
+ // if the old list is not empty, the new list MUST have the same
3678
3443
  // amount of nodes, that's why we call this static children
3679
-
3680
-
3681
3444
  let anchor = null;
3682
-
3683
3445
  for (let i = c2Length - 1; i >= 0; i -= 1) {
3684
3446
  const n1 = c1[i];
3685
3447
  const n2 = c2[i];
3686
-
3687
3448
  if (n2 !== n1) {
3688
3449
  if (isVNode(n1)) {
3689
3450
  if (isVNode(n2)) {
@@ -4425,42 +4186,30 @@
4425
4186
  */
4426
4187
  let idx = 0;
4427
4188
  /** The internal slot used to associate different objects the engine manipulates with the VM */
4428
-
4429
4189
  const ViewModelReflection = new WeakMap();
4430
-
4431
4190
  function callHook(cmp, fn, args = []) {
4432
4191
  return fn.apply(cmp, args);
4433
4192
  }
4434
-
4435
4193
  function setHook(cmp, prop, newValue) {
4436
4194
  cmp[prop] = newValue;
4437
4195
  }
4438
-
4439
4196
  function getHook(cmp, prop) {
4440
4197
  return cmp[prop];
4441
4198
  }
4442
-
4443
4199
  function rerenderVM(vm) {
4444
4200
  rehydrate(vm);
4445
4201
  }
4446
4202
  function connectRootElement(elm) {
4447
4203
  const vm = getAssociatedVM(elm);
4448
- logGlobalOperationStart(7
4449
- /* OperationId.GlobalHydrate */
4450
- , vm); // Usually means moving the element from one place to another, which is observable via
4204
+ logGlobalOperationStart(7 /* OperationId.GlobalHydrate */, vm);
4205
+ // Usually means moving the element from one place to another, which is observable via
4451
4206
  // life-cycle hooks.
4452
-
4453
- if (vm.state === 1
4454
- /* VMState.connected */
4455
- ) {
4207
+ if (vm.state === 1 /* VMState.connected */) {
4456
4208
  disconnectRootElement(elm);
4457
4209
  }
4458
-
4459
4210
  runConnectedCallback(vm);
4460
4211
  rehydrate(vm);
4461
- logGlobalOperationEnd(7
4462
- /* OperationId.GlobalHydrate */
4463
- , vm);
4212
+ logGlobalOperationEnd(7 /* OperationId.GlobalHydrate */, vm);
4464
4213
  }
4465
4214
  function disconnectRootElement(elm) {
4466
4215
  const vm = getAssociatedVM(elm);
@@ -4468,54 +4217,42 @@
4468
4217
  }
4469
4218
  function appendVM(vm) {
4470
4219
  rehydrate(vm);
4471
- } // just in case the component comes back, with this we guarantee re-rendering it
4220
+ }
4221
+ // just in case the component comes back, with this we guarantee re-rendering it
4472
4222
  // while preventing any attempt to rehydration until after reinsertion.
4473
-
4474
4223
  function resetComponentStateWhenRemoved(vm) {
4475
4224
  const {
4476
4225
  state
4477
4226
  } = vm;
4478
-
4479
- if (state !== 2
4480
- /* VMState.disconnected */
4481
- ) {
4227
+ if (state !== 2 /* VMState.disconnected */) {
4482
4228
  const {
4483
4229
  oar,
4484
4230
  tro
4485
- } = vm; // Making sure that any observing record will not trigger the rehydrated on this vm
4486
-
4487
- tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked
4488
-
4231
+ } = vm;
4232
+ // Making sure that any observing record will not trigger the rehydrated on this vm
4233
+ tro.reset();
4234
+ // Making sure that any observing accessor record will not trigger the setter to be reinvoked
4489
4235
  for (const key in oar) {
4490
4236
  oar[key].reset();
4491
4237
  }
4492
-
4493
- runDisconnectedCallback(vm); // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
4494
-
4238
+ runDisconnectedCallback(vm);
4239
+ // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
4495
4240
  runChildNodesDisconnectedCallback(vm);
4496
4241
  runLightChildNodesDisconnectedCallback(vm);
4497
4242
  }
4498
- } // this method is triggered by the diffing algo only when a vnode from the
4243
+ }
4244
+ // this method is triggered by the diffing algo only when a vnode from the
4499
4245
  // old vnode.children is removed from the DOM.
4500
-
4501
-
4502
4246
  function removeVM(vm) {
4503
-
4504
4247
  resetComponentStateWhenRemoved(vm);
4505
4248
  }
4506
-
4507
4249
  function getNearestShadowAncestor(vm) {
4508
4250
  let ancestor = vm.owner;
4509
-
4510
- while (!isNull(ancestor) && ancestor.renderMode === 0
4511
- /* RenderMode.Light */
4512
- ) {
4251
+ while (!isNull(ancestor) && ancestor.renderMode === 0 /* RenderMode.Light */) {
4513
4252
  ancestor = ancestor.owner;
4514
4253
  }
4515
-
4516
4254
  return ancestor;
4517
4255
  }
4518
-
4519
4256
  function createVM(elm, ctor, renderer, options) {
4520
4257
  const {
4521
4258
  mode,
@@ -4528,9 +4265,7 @@
4528
4265
  elm,
4529
4266
  def,
4530
4267
  idx: idx++,
4531
- state: 0
4532
- /* VMState.created */
4533
- ,
4268
+ state: 0 /* VMState.created */,
4534
4269
  isScheduled: false,
4535
4270
  isDirty: true,
4536
4271
  tagName,
@@ -4574,17 +4309,14 @@
4574
4309
  };
4575
4310
  vm.shadowMode = computeShadowMode(vm, renderer);
4576
4311
  vm.tro = getTemplateReactiveObserver(vm);
4577
-
4578
-
4579
- invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
4580
-
4312
+ // Create component instance associated to the vm and the element.
4313
+ invokeComponentConstructor(vm, def.ctor);
4314
+ // Initializing the wire decorator per instance only when really needed
4581
4315
  if (hasWireAdapters(vm)) {
4582
4316
  installWireAdapters(vm);
4583
4317
  }
4584
-
4585
4318
  return vm;
4586
4319
  }
4587
-
4588
4320
  function computeShadowMode(vm, renderer) {
4589
4321
  const {
4590
4322
  def
@@ -4594,120 +4326,85 @@
4594
4326
  isNativeShadowDefined
4595
4327
  } = renderer;
4596
4328
  let shadowMode;
4597
-
4598
4329
  if (isSyntheticShadowDefined) {
4599
- if (def.renderMode === 0
4600
- /* RenderMode.Light */
4601
- ) {
4330
+ if (def.renderMode === 0 /* RenderMode.Light */) {
4602
4331
  // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
4603
4332
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
4604
- shadowMode = 0
4605
- /* ShadowMode.Native */
4606
- ;
4333
+ shadowMode = 0 /* ShadowMode.Native */;
4607
4334
  } else if (isNativeShadowDefined) {
4608
4335
  // Not combined with above condition because @lwc/features only supports identifiers in
4609
4336
  // the if-condition.
4610
4337
  if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
4611
- if (def.shadowSupportMode === "any"
4612
- /* ShadowSupportMode.Any */
4613
- ) {
4614
- shadowMode = 0
4615
- /* ShadowMode.Native */
4616
- ;
4338
+ if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
4339
+ shadowMode = 0 /* ShadowMode.Native */;
4617
4340
  } else {
4618
4341
  const shadowAncestor = getNearestShadowAncestor(vm);
4619
-
4620
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
4621
- /* ShadowMode.Native */
4622
- ) {
4342
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
4623
4343
  // Transitive support for native Shadow DOM. A component in native mode
4624
4344
  // transitively opts all of its descendants into native.
4625
- shadowMode = 0
4626
- /* ShadowMode.Native */
4627
- ;
4345
+ shadowMode = 0 /* ShadowMode.Native */;
4628
4346
  } else {
4629
4347
  // Synthetic if neither this component nor any of its ancestors are configured
4630
4348
  // to be native.
4631
- shadowMode = 1
4632
- /* ShadowMode.Synthetic */
4633
- ;
4349
+ shadowMode = 1 /* ShadowMode.Synthetic */;
4634
4350
  }
4635
4351
  }
4636
4352
  } else {
4637
- shadowMode = 1
4638
- /* ShadowMode.Synthetic */
4639
- ;
4353
+ shadowMode = 1 /* ShadowMode.Synthetic */;
4640
4354
  }
4641
4355
  } else {
4642
4356
  // Synthetic if there is no native Shadow DOM support.
4643
- shadowMode = 1
4644
- /* ShadowMode.Synthetic */
4645
- ;
4357
+ shadowMode = 1 /* ShadowMode.Synthetic */;
4646
4358
  }
4647
4359
  } else {
4648
4360
  // Native if the synthetic shadow polyfill is unavailable.
4649
- shadowMode = 0
4650
- /* ShadowMode.Native */
4651
- ;
4361
+ shadowMode = 0 /* ShadowMode.Native */;
4652
4362
  }
4653
4363
 
4654
4364
  return shadowMode;
4655
4365
  }
4656
-
4657
4366
  function associateVM(obj, vm) {
4658
4367
  ViewModelReflection.set(obj, vm);
4659
4368
  }
4660
4369
  function getAssociatedVM(obj) {
4661
4370
  const vm = ViewModelReflection.get(obj);
4662
-
4663
4371
  return vm;
4664
4372
  }
4665
4373
  function getAssociatedVMIfPresent(obj) {
4666
4374
  const maybeVm = ViewModelReflection.get(obj);
4667
-
4668
4375
  return maybeVm;
4669
4376
  }
4670
-
4671
4377
  function rehydrate(vm) {
4672
4378
  if (isTrue(vm.isDirty)) {
4673
4379
  const children = renderComponent(vm);
4674
4380
  patchShadowRoot(vm, children);
4675
4381
  }
4676
4382
  }
4677
-
4678
4383
  function patchShadowRoot(vm, newCh) {
4679
4384
  const {
4680
4385
  renderRoot,
4681
4386
  children: oldCh,
4682
4387
  renderer
4683
- } = vm; // caching the new children collection
4684
-
4388
+ } = vm;
4389
+ // caching the new children collection
4685
4390
  vm.children = newCh;
4686
-
4687
4391
  if (newCh.length > 0 || oldCh.length > 0) {
4688
4392
  // patch function mutates vnodes by adding the element reference,
4689
4393
  // however, if patching fails it contains partial changes.
4690
4394
  if (oldCh !== newCh) {
4691
4395
  runWithBoundaryProtection(vm, vm, () => {
4692
4396
  // pre
4693
- logOperationStart(2
4694
- /* OperationId.Patch */
4695
- , vm);
4397
+ logOperationStart(2 /* OperationId.Patch */, vm);
4696
4398
  }, () => {
4697
4399
  // job
4698
4400
  patchChildren(oldCh, newCh, renderRoot, renderer);
4699
4401
  }, () => {
4700
4402
  // post
4701
- logOperationEnd(2
4702
- /* OperationId.Patch */
4703
- , vm);
4403
+ logOperationEnd(2 /* OperationId.Patch */, vm);
4704
4404
  });
4705
4405
  }
4706
4406
  }
4707
-
4708
- if (vm.state === 1
4709
- /* VMState.connected */
4710
- ) {
4407
+ if (vm.state === 1 /* VMState.connected */) {
4711
4408
  // If the element is connected, that means connectedCallback was already issued, and
4712
4409
  // any successive rendering should finish with the call to renderedCallback, otherwise
4713
4410
  // the connectedCallback will take care of calling it in the right order at the end of
@@ -4715,45 +4412,31 @@
4715
4412
  runRenderedCallback(vm);
4716
4413
  }
4717
4414
  }
4718
-
4719
4415
  function runRenderedCallback(vm) {
4720
4416
  const {
4721
4417
  def: {
4722
4418
  renderedCallback
4723
4419
  }
4724
4420
  } = vm;
4725
-
4726
4421
  const {
4727
4422
  rendered
4728
4423
  } = Services;
4729
-
4730
4424
  if (rendered) {
4731
4425
  invokeServiceHook(vm, rendered);
4732
4426
  }
4733
-
4734
4427
  if (!isUndefined$1(renderedCallback)) {
4735
- logOperationStart(4
4736
- /* OperationId.RenderedCallback */
4737
- , vm);
4428
+ logOperationStart(4 /* OperationId.RenderedCallback */, vm);
4738
4429
  invokeComponentCallback(vm, renderedCallback);
4739
- logOperationEnd(4
4740
- /* OperationId.RenderedCallback */
4741
- , vm);
4430
+ logOperationEnd(4 /* OperationId.RenderedCallback */, vm);
4742
4431
  }
4743
4432
  }
4744
4433
  let rehydrateQueue = [];
4745
-
4746
4434
  function flushRehydrationQueue() {
4747
- logGlobalOperationStart(8
4748
- /* OperationId.GlobalRehydrate */
4749
- );
4750
-
4435
+ logGlobalOperationStart(8 /* OperationId.GlobalRehydrate */);
4751
4436
  const vms = rehydrateQueue.sort((a, b) => a.idx - b.idx);
4752
4437
  rehydrateQueue = []; // reset to a new queue
4753
-
4754
4438
  for (let i = 0, len = vms.length; i < len; i += 1) {
4755
4439
  const vm = vms[i];
4756
-
4757
4440
  try {
4758
4441
  rehydrate(vm);
4759
4442
  } catch (error) {
@@ -4762,73 +4445,51 @@
4762
4445
  if (rehydrateQueue.length === 0) {
4763
4446
  addCallbackToNextTick(flushRehydrationQueue);
4764
4447
  }
4765
-
4766
4448
  ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));
4767
- } // we need to end the measure before throwing.
4768
-
4769
-
4770
- logGlobalOperationEnd(8
4771
- /* OperationId.GlobalRehydrate */
4772
- ); // re-throwing the original error will break the current tick, but since the next tick is
4449
+ }
4450
+ // we need to end the measure before throwing.
4451
+ logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
4452
+ // re-throwing the original error will break the current tick, but since the next tick is
4773
4453
  // already scheduled, it should continue patching the rest.
4774
-
4775
4454
  throw error; // eslint-disable-line no-unsafe-finally
4776
4455
  }
4777
4456
  }
4778
4457
 
4779
- logGlobalOperationEnd(8
4780
- /* OperationId.GlobalRehydrate */
4781
- );
4458
+ logGlobalOperationEnd(8 /* OperationId.GlobalRehydrate */);
4782
4459
  }
4783
4460
 
4784
4461
  function runConnectedCallback(vm) {
4785
4462
  const {
4786
4463
  state
4787
4464
  } = vm;
4788
-
4789
- if (state === 1
4790
- /* VMState.connected */
4791
- ) {
4465
+ if (state === 1 /* VMState.connected */) {
4792
4466
  return; // nothing to do since it was already connected
4793
4467
  }
4794
4468
 
4795
- vm.state = 1
4796
- /* VMState.connected */
4797
- ; // reporting connection
4798
-
4469
+ vm.state = 1 /* VMState.connected */;
4470
+ // reporting connection
4799
4471
  const {
4800
4472
  connected
4801
4473
  } = Services;
4802
-
4803
4474
  if (connected) {
4804
4475
  invokeServiceHook(vm, connected);
4805
4476
  }
4806
-
4807
4477
  if (hasWireAdapters(vm)) {
4808
4478
  connectWireAdapters(vm);
4809
4479
  }
4810
-
4811
4480
  const {
4812
4481
  connectedCallback
4813
4482
  } = vm.def;
4814
-
4815
4483
  if (!isUndefined$1(connectedCallback)) {
4816
- logOperationStart(3
4817
- /* OperationId.ConnectedCallback */
4818
- , vm);
4484
+ logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
4819
4485
  invokeComponentCallback(vm, connectedCallback);
4820
- logOperationEnd(3
4821
- /* OperationId.ConnectedCallback */
4822
- , vm);
4486
+ logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
4823
4487
  }
4824
4488
  }
4825
-
4826
4489
  function hasWireAdapters(vm) {
4827
4490
  return getOwnPropertyNames$1(vm.def.wire).length > 0;
4828
4491
  }
4829
-
4830
4492
  function runDisconnectedCallback(vm) {
4831
-
4832
4493
  if (isFalse(vm.isDirty)) {
4833
4494
  // this guarantees that if the component is reused/reinserted,
4834
4495
  // it will be re-rendered because we are disconnecting the reactivity
@@ -4836,67 +4497,54 @@
4836
4497
  // of disconnected components.
4837
4498
  vm.isDirty = true;
4838
4499
  }
4839
-
4840
- vm.state = 2
4841
- /* VMState.disconnected */
4842
- ; // reporting disconnection
4843
-
4500
+ vm.state = 2 /* VMState.disconnected */;
4501
+ // reporting disconnection
4844
4502
  const {
4845
4503
  disconnected
4846
4504
  } = Services;
4847
-
4848
4505
  if (disconnected) {
4849
4506
  invokeServiceHook(vm, disconnected);
4850
4507
  }
4851
-
4852
4508
  if (hasWireAdapters(vm)) {
4853
4509
  disconnectWireAdapters(vm);
4854
4510
  }
4855
-
4856
4511
  const {
4857
4512
  disconnectedCallback
4858
4513
  } = vm.def;
4859
-
4860
4514
  if (!isUndefined$1(disconnectedCallback)) {
4861
- logOperationStart(5
4862
- /* OperationId.DisconnectedCallback */
4863
- , vm);
4515
+ logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
4864
4516
  invokeComponentCallback(vm, disconnectedCallback);
4865
- logOperationEnd(5
4866
- /* OperationId.DisconnectedCallback */
4867
- , vm);
4517
+ logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
4868
4518
  }
4869
4519
  }
4870
-
4871
4520
  function runChildNodesDisconnectedCallback(vm) {
4872
4521
  const {
4873
4522
  velements: vCustomElementCollection
4874
- } = vm; // Reporting disconnection for every child in inverse order since they are
4523
+ } = vm;
4524
+ // Reporting disconnection for every child in inverse order since they are
4875
4525
  // inserted in reserved order.
4876
-
4877
4526
  for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {
4878
4527
  const {
4879
4528
  elm
4880
- } = vCustomElementCollection[i]; // There are two cases where the element could be undefined:
4529
+ } = vCustomElementCollection[i];
4530
+ // There are two cases where the element could be undefined:
4881
4531
  // * when there is an error during the construction phase, and an error
4882
4532
  // boundary picks it, there is a possibility that the VCustomElement
4883
4533
  // is not properly initialized, and therefore is should be ignored.
4884
4534
  // * when slotted custom element is not used by the element where it is
4885
4535
  // slotted into it, as a result, the custom element was never
4886
4536
  // initialized.
4887
-
4888
4537
  if (!isUndefined$1(elm)) {
4889
- const childVM = getAssociatedVMIfPresent(elm); // The VM associated with the element might be associated undefined
4538
+ const childVM = getAssociatedVMIfPresent(elm);
4539
+ // The VM associated with the element might be associated undefined
4890
4540
  // in the case where the VM failed in the middle of its creation,
4891
4541
  // eg: constructor throwing before invoking super().
4892
-
4893
4542
  if (!isUndefined$1(childVM)) {
4894
4543
  resetComponentStateWhenRemoved(childVM);
4895
4544
  }
4896
4545
  }
4897
4546
  }
4898
4547
  }
4899
-
4900
4548
  function runLightChildNodesDisconnectedCallback(vm) {
4901
4549
  const {
4902
4550
  aChildren: adoptedChildren
@@ -4910,23 +4558,15 @@
4910
4558
  * custom element itself will trigger the removal of anything slotted or anything
4911
4559
  * defined on its shadow.
4912
4560
  */
4913
-
4914
-
4915
4561
  function recursivelyDisconnectChildren(vnodes) {
4916
4562
  for (let i = 0, len = vnodes.length; i < len; i += 1) {
4917
4563
  const vnode = vnodes[i];
4918
-
4919
4564
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
4920
4565
  switch (vnode.type) {
4921
- case 2
4922
- /* VNodeType.Element */
4923
- :
4566
+ case 2 /* VNodeType.Element */:
4924
4567
  recursivelyDisconnectChildren(vnode.children);
4925
4568
  break;
4926
-
4927
- case 3
4928
- /* VNodeType.CustomElement */
4929
- :
4569
+ case 3 /* VNodeType.CustomElement */:
4930
4570
  {
4931
4571
  const vm = getAssociatedVM(vnode.elm);
4932
4572
  resetComponentStateWhenRemoved(vm);
@@ -4935,12 +4575,11 @@
4935
4575
  }
4936
4576
  }
4937
4577
  }
4938
- } // This is a super optimized mechanism to remove the content of the root node (shadow root
4578
+ }
4579
+ // This is a super optimized mechanism to remove the content of the root node (shadow root
4939
4580
  // for shadow DOM components and the root element itself for light DOM) without having to go
4940
4581
  // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
4941
4582
  // children VNodes might not be representing the current state of the DOM.
4942
-
4943
-
4944
4583
  function resetComponentRoot(vm) {
4945
4584
  const {
4946
4585
  children,
@@ -4949,15 +4588,12 @@
4949
4588
  remove
4950
4589
  }
4951
4590
  } = vm;
4952
-
4953
4591
  for (let i = 0, len = children.length; i < len; i++) {
4954
4592
  const child = children[i];
4955
-
4956
4593
  if (!isNull(child) && !isUndefined$1(child.elm)) {
4957
4594
  remove(child.elm, renderRoot);
4958
4595
  }
4959
4596
  }
4960
-
4961
4597
  vm.children = EmptyArray;
4962
4598
  runChildNodesDisconnectedCallback(vm);
4963
4599
  vm.velements = EmptyArray;
@@ -4966,58 +4602,43 @@
4966
4602
  if (isTrue(vm.isScheduled)) {
4967
4603
  return;
4968
4604
  }
4969
-
4970
4605
  vm.isScheduled = true;
4971
-
4972
4606
  if (rehydrateQueue.length === 0) {
4973
4607
  addCallbackToNextTick(flushRehydrationQueue);
4974
4608
  }
4975
-
4976
4609
  ArrayPush$1.call(rehydrateQueue, vm);
4977
4610
  }
4978
-
4979
4611
  function getErrorBoundaryVM(vm) {
4980
4612
  let currentVm = vm;
4981
-
4982
4613
  while (!isNull(currentVm)) {
4983
4614
  if (!isUndefined$1(currentVm.def.errorCallback)) {
4984
4615
  return currentVm;
4985
4616
  }
4986
-
4987
4617
  currentVm = currentVm.owner;
4988
4618
  }
4989
4619
  }
4990
-
4991
4620
  function runWithBoundaryProtection(vm, owner, pre, job, post) {
4992
4621
  let error;
4993
4622
  pre();
4994
-
4995
4623
  try {
4996
4624
  job();
4997
4625
  } catch (e) {
4998
4626
  error = Object(e);
4999
4627
  } finally {
5000
4628
  post();
5001
-
5002
4629
  if (!isUndefined$1(error)) {
5003
4630
  addErrorComponentStack(vm, error);
5004
4631
  const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
5005
-
5006
4632
  if (isUndefined$1(errorBoundaryVm)) {
5007
4633
  throw error; // eslint-disable-line no-unsafe-finally
5008
4634
  }
5009
4635
 
5010
4636
  resetComponentRoot(vm); // remove offenders
5011
-
5012
- logOperationStart(6
5013
- /* OperationId.ErrorCallback */
5014
- , vm); // error boundaries must have an ErrorCallback
5015
-
4637
+ logOperationStart(6 /* OperationId.ErrorCallback */, vm);
4638
+ // error boundaries must have an ErrorCallback
5016
4639
  const errorCallback = errorBoundaryVm.def.errorCallback;
5017
4640
  invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
5018
- logOperationEnd(6
5019
- /* OperationId.ErrorCallback */
5020
- , vm);
4641
+ logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
5021
4642
  }
5022
4643
  }
5023
4644
  }
@@ -5030,6 +4651,7 @@
5030
4651
  */
5031
4652
  const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
5032
4653
  const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
4654
+ const WIRE_DEBUG_ENTRY = '@wire';
5033
4655
  const WireMetaMap = new Map();
5034
4656
  class WireContextRegistrationEvent extends CustomEvent {
5035
4657
  constructor(adapterToken, {
@@ -5049,15 +4671,12 @@
5049
4671
  }
5050
4672
  });
5051
4673
  }
5052
-
5053
4674
  }
5054
-
5055
4675
  function createFieldDataCallback(vm, name) {
5056
4676
  return value => {
5057
4677
  updateComponentValue(vm, name, value);
5058
4678
  };
5059
4679
  }
5060
-
5061
4680
  function createMethodDataCallback(vm, method) {
5062
4681
  return value => {
5063
4682
  // dispatching new value into the wired method
@@ -5067,45 +4686,40 @@
5067
4686
  }, noop);
5068
4687
  };
5069
4688
  }
5070
-
5071
4689
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
5072
- let hasPendingConfig = false; // creating the reactive observer for reactive params when needed
5073
-
4690
+ let hasPendingConfig = false;
4691
+ // creating the reactive observer for reactive params when needed
5074
4692
  const ro = createReactiveObserver(() => {
5075
4693
  if (hasPendingConfig === false) {
5076
- hasPendingConfig = true; // collect new config in the micro-task
5077
-
4694
+ hasPendingConfig = true;
4695
+ // collect new config in the micro-task
5078
4696
  Promise.resolve().then(() => {
5079
- hasPendingConfig = false; // resetting current reactive params
5080
-
5081
- ro.reset(); // dispatching a new config due to a change in the configuration
5082
-
4697
+ hasPendingConfig = false;
4698
+ // resetting current reactive params
4699
+ ro.reset();
4700
+ // dispatching a new config due to a change in the configuration
5083
4701
  computeConfigAndUpdate();
5084
4702
  });
5085
4703
  }
5086
4704
  });
5087
-
5088
4705
  const computeConfigAndUpdate = () => {
5089
4706
  let config;
5090
- ro.observe(() => config = configCallback(component)); // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
4707
+ ro.observe(() => config = configCallback(component));
4708
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
5091
4709
  // TODO: dev-mode validation of config based on the adapter.configSchema
5092
4710
  // @ts-ignore it is assigned in the observe() callback
5093
-
5094
4711
  callbackWhenConfigIsReady(config);
5095
4712
  };
5096
-
5097
4713
  return {
5098
4714
  computeConfigAndUpdate,
5099
4715
  ro
5100
4716
  };
5101
4717
  }
5102
-
5103
4718
  function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
5104
4719
  const {
5105
4720
  adapter
5106
4721
  } = wireDef;
5107
4722
  const adapterContextToken = getAdapterToken(adapter);
5108
-
5109
4723
  if (isUndefined$1(adapterContextToken)) {
5110
4724
  return; // no provider found, nothing to be done
5111
4725
  }
@@ -5119,8 +4733,8 @@
5119
4733
  renderer: {
5120
4734
  dispatchEvent
5121
4735
  }
5122
- } = vm; // waiting for the component to be connected to formally request the context via the token
5123
-
4736
+ } = vm;
4737
+ // waiting for the component to be connected to formally request the context via the token
5124
4738
  ArrayPush$1.call(wiredConnecting, () => {
5125
4739
  // This event is responsible for connecting the host element with another
5126
4740
  // element in the composed path that is providing contextual data. The provider
@@ -5133,18 +4747,15 @@
5133
4747
  // TODO: dev-mode validation of config based on the adapter.contextSchema
5134
4748
  callbackWhenContextIsReady(newContext);
5135
4749
  },
5136
-
5137
4750
  setDisconnectedCallback(disconnectCallback) {
5138
4751
  // adds this callback into the disconnect bucket so it gets disconnected from parent
5139
4752
  // the the element hosting the wire is disconnected
5140
4753
  ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
5141
4754
  }
5142
-
5143
4755
  });
5144
4756
  dispatchEvent(elm, contextRegistrationEvent);
5145
4757
  });
5146
4758
  }
5147
-
5148
4759
  function createConnector(vm, name, wireDef) {
5149
4760
  const {
5150
4761
  method,
@@ -5152,10 +4763,14 @@
5152
4763
  configCallback,
5153
4764
  dynamic
5154
4765
  } = wireDef;
5155
- const dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
4766
+ let debugInfo;
4767
+ const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
4768
+ const dataCallback = value => {
4769
+ fieldOrMethodCallback(value);
4770
+ };
5156
4771
  let context;
5157
- let connector; // Workaround to pass the component element associated to this wire adapter instance.
5158
-
4772
+ let connector;
4773
+ // Workaround to pass the component element associated to this wire adapter instance.
5159
4774
  defineProperty(dataCallback, DeprecatedWiredElementHost, {
5160
4775
  value: vm.elm
5161
4776
  });
@@ -5166,41 +4781,37 @@
5166
4781
  // job
5167
4782
  connector = new adapter(dataCallback);
5168
4783
  }, noop);
5169
-
5170
4784
  const updateConnectorConfig = config => {
5171
4785
  // every time the config is recomputed due to tracking,
5172
4786
  // this callback will be invoked with the new computed config
5173
4787
  runWithBoundaryProtection(vm, vm, noop, () => {
5174
4788
  // job
4789
+ if ("production" !== 'production') ;
5175
4790
  connector.update(config, context);
5176
4791
  }, noop);
5177
- }; // Computes the current wire config and calls the update method on the wire adapter.
4792
+ };
4793
+ // Computes the current wire config and calls the update method on the wire adapter.
5178
4794
  // If it has params, we will need to observe changes in the next tick.
5179
-
5180
-
5181
4795
  const {
5182
4796
  computeConfigAndUpdate,
5183
4797
  ro
5184
- } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig); // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
5185
-
4798
+ } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
4799
+ // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
5186
4800
  if (!isUndefined$1(adapter.contextSchema)) {
5187
4801
  createContextWatcher(vm, wireDef, newContext => {
5188
4802
  // every time the context is pushed into this component,
5189
4803
  // this callback will be invoked with the new computed context
5190
4804
  if (context !== newContext) {
5191
- context = newContext; // Note: when new context arrives, the config will be recomputed and pushed along side the new
4805
+ context = newContext;
4806
+ // Note: when new context arrives, the config will be recomputed and pushed along side the new
5192
4807
  // context, this is to preserve the identity characteristics, config should not have identity
5193
4808
  // (ever), while context can have identity
5194
-
5195
- if (vm.state === 1
5196
- /* VMState.connected */
5197
- ) {
4809
+ if (vm.state === 1 /* VMState.connected */) {
5198
4810
  computeConfigAndUpdate();
5199
4811
  }
5200
4812
  }
5201
4813
  });
5202
4814
  }
5203
-
5204
4815
  return {
5205
4816
  // @ts-ignore the boundary protection executes sync, connector is always defined
5206
4817
  connector,
@@ -5208,7 +4819,6 @@
5208
4819
  resetConfigWatcher: () => ro.reset()
5209
4820
  };
5210
4821
  }
5211
-
5212
4822
  const AdapterToTokenMap = new Map();
5213
4823
  function getAdapterToken(adapter) {
5214
4824
  return AdapterToTokenMap.get(adapter);
@@ -5221,7 +4831,6 @@
5221
4831
  if (adapter.adapter) {
5222
4832
  adapter = adapter.adapter;
5223
4833
  }
5224
-
5225
4834
  const method = descriptor.value;
5226
4835
  const def = {
5227
4836
  adapter,
@@ -5236,7 +4845,6 @@
5236
4845
  if (adapter.adapter) {
5237
4846
  adapter = adapter.adapter;
5238
4847
  }
5239
-
5240
4848
  const def = {
5241
4849
  adapter,
5242
4850
  configCallback,
@@ -5251,13 +4859,12 @@
5251
4859
  wire
5252
4860
  }
5253
4861
  } = vm;
4862
+ vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
5254
4863
  const wiredConnecting = context.wiredConnecting = [];
5255
4864
  const wiredDisconnecting = context.wiredDisconnecting = [];
5256
-
5257
4865
  for (const fieldNameOrMethod in wire) {
5258
4866
  const descriptor = wire[fieldNameOrMethod];
5259
4867
  const wireDef = WireMetaMap.get(descriptor);
5260
-
5261
4868
  if (!isUndefined$1(wireDef)) {
5262
4869
  const {
5263
4870
  connector,
@@ -5267,14 +4874,12 @@
5267
4874
  const hasDynamicParams = wireDef.dynamic.length > 0;
5268
4875
  ArrayPush$1.call(wiredConnecting, () => {
5269
4876
  connector.connect();
5270
-
5271
4877
  if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
5272
4878
  if (hasDynamicParams) {
5273
4879
  Promise.resolve().then(computeConfigAndUpdate);
5274
4880
  return;
5275
4881
  }
5276
4882
  }
5277
-
5278
4883
  computeConfigAndUpdate();
5279
4884
  });
5280
4885
  ArrayPush$1.call(wiredDisconnecting, () => {
@@ -5288,7 +4893,6 @@
5288
4893
  const {
5289
4894
  wiredConnecting
5290
4895
  } = vm.context;
5291
-
5292
4896
  for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
5293
4897
  wiredConnecting[i]();
5294
4898
  }
@@ -5736,7 +5340,6 @@
5736
5340
  }
5737
5341
  return ctor;
5738
5342
  }
5739
- /* version: 2.29.0 */
5740
5343
 
5741
5344
  /*
5742
5345
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6426,10 +6029,10 @@
6426
6029
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6427
6030
  */
6428
6031
  let createScopedConstructor;
6429
- let CachedHTMLElement; // We only call `createScopedRegistry()` if the browser supports custom elements and
6032
+ let CachedHTMLElement;
6033
+ // We only call `createScopedRegistry()` if the browser supports custom elements and
6430
6034
  // ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is enabled, because we don't want to patch eagerly if the flag is disabled
6431
6035
  // or we're in a legacy browser.
6432
-
6433
6036
  if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
6434
6037
  if (hasCustomElements) {
6435
6038
  // If ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY is true, then we eagerly initialize the scoped registry.
@@ -6443,7 +6046,8 @@
6443
6046
  // 4. `customElements.define('x-foo', Ctor)` // throws error because class is bound to stale HTMLElement
6444
6047
  //
6445
6048
  // To reduce the risk of this, it's safer to patch the registry eagerly.
6446
- createScopedConstructor = createScopedRegistry(); // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
6049
+ createScopedConstructor = createScopedRegistry();
6050
+ // It's important to cache window.HTMLElement here. Otherwise, someone else could overwrite window.HTMLElement (e.g.
6447
6051
  // another copy of the engine, or another scoping implementation) and we would get "Illegal constructor" errors
6448
6052
  // because the HTMLElement prototypes are mixed up.
6449
6053
  //
@@ -6451,14 +6055,12 @@
6451
6055
  // with that version of HTMLElement. So if you load two copies of the scoping implementation in the same environment,
6452
6056
  // the second one may accidentally grab window.HTMLElement from the first (when doing `class extends HTMLElement`).
6453
6057
  // Caching avoids this problem.
6454
-
6455
6058
  CachedHTMLElement = window.HTMLElement;
6456
6059
  }
6457
- } // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
6060
+ }
6061
+ // Creates a constructor that is intended to be used as the UserConstructor in a scoped (pivots) registry.
6458
6062
  // In this case, the upgradeCallback only needs to be defined once because we create these on-demand,
6459
6063
  // multiple times per tag name.
6460
-
6461
-
6462
6064
  const createUserConstructor = (upgradeCallback, connectedCallback, disconnectedCallback, HTMLElementToExtend) => {
6463
6065
  // TODO [#2972]: this class should expose observedAttributes as necessary
6464
6066
  return class UserConstructor extends HTMLElementToExtend {
@@ -6466,24 +6068,19 @@
6466
6068
  super();
6467
6069
  upgradeCallback(this);
6468
6070
  }
6469
-
6470
6071
  connectedCallback() {
6471
6072
  connectedCallback(this);
6472
6073
  }
6473
-
6474
6074
  disconnectedCallback() {
6475
6075
  disconnectedCallback(this);
6476
6076
  }
6477
-
6478
6077
  };
6479
6078
  };
6480
-
6481
6079
  function createCustomElementScoped(tagName, upgradeCallback, connectedCallback, disconnectedCallback) {
6482
6080
  if (isUndefined$1(createScopedConstructor) || isUndefined$1(CachedHTMLElement)) {
6483
6081
  // This error should be impossible to hit
6484
6082
  throw new Error('The flag ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY must be set to true to use this feature');
6485
6083
  }
6486
-
6487
6084
  const UserConstructor = createUserConstructor(upgradeCallback, connectedCallback, disconnectedCallback, CachedHTMLElement);
6488
6085
  const ScopedConstructor = createScopedConstructor(tagName, UserConstructor);
6489
6086
  return new ScopedConstructor(UserConstructor);
@@ -6508,9 +6105,7 @@
6508
6105
  * between LWC components and third-party elements. This uses a similar trick to #2, but is much more complex
6509
6106
  * because it must patch the global `customElements` and `HTMLElement` objects.
6510
6107
  */
6511
-
6512
6108
  let createCustomElement;
6513
-
6514
6109
  if (hasCustomElements) {
6515
6110
  if (lwcRuntimeFlags.ENABLE_SCOPED_CUSTOM_ELEMENT_REGISTRY) {
6516
6111
  createCustomElement = createCustomElementScoped;
@@ -6583,7 +6178,7 @@
6583
6178
  function isNull(obj) {
6584
6179
  return obj === null;
6585
6180
  }
6586
- /** version: 2.29.0 */
6181
+ /** version: 2.30.0 */
6587
6182
 
6588
6183
  /*
6589
6184
  * Copyright (c) 2018, salesforce.com, inc.
@@ -6967,20 +6562,16 @@
6967
6562
  * SPDX-License-Identifier: MIT
6968
6563
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6969
6564
  */
6565
+ // TODO [#2472]: Remove this workaround when appropriate.
6970
6566
  // eslint-disable-next-line @lwc/lwc-internal/no-global-node
6971
-
6972
6567
  const _Node$1 = Node;
6973
6568
  const ConnectingSlot = new WeakMap();
6974
6569
  const DisconnectingSlot = new WeakMap();
6975
-
6976
6570
  function callNodeSlot(node, slot) {
6977
-
6978
6571
  const fn = slot.get(node);
6979
-
6980
6572
  if (!isUndefined$1(fn)) {
6981
6573
  fn(node);
6982
6574
  }
6983
-
6984
6575
  return node; // for convenience
6985
6576
  }
6986
6577
 
@@ -6998,24 +6589,20 @@
6998
6589
  const appendedNode = appendChild.call(this, newChild);
6999
6590
  return callNodeSlot(appendedNode, ConnectingSlot);
7000
6591
  },
7001
-
7002
6592
  insertBefore(newChild, referenceNode) {
7003
6593
  const insertedNode = insertBefore.call(this, newChild, referenceNode);
7004
6594
  return callNodeSlot(insertedNode, ConnectingSlot);
7005
6595
  },
7006
-
7007
6596
  removeChild(oldChild) {
7008
6597
  const removedNode = removeChild.call(this, oldChild);
7009
6598
  return callNodeSlot(removedNode, DisconnectingSlot);
7010
6599
  },
7011
-
7012
6600
  replaceChild(newChild, oldChild) {
7013
6601
  const replacedNode = replaceChild.call(this, newChild, oldChild);
7014
6602
  callNodeSlot(replacedNode, DisconnectingSlot);
7015
6603
  callNodeSlot(newChild, ConnectingSlot);
7016
6604
  return replacedNode;
7017
6605
  }
7018
-
7019
6606
  });
7020
6607
  }
7021
6608
  /**
@@ -7029,59 +6616,49 @@
7029
6616
  * const el = createElement('x-foo', { is: FooCtor });
7030
6617
  * ```
7031
6618
  */
7032
-
7033
-
7034
6619
  function createElement(sel, options) {
7035
6620
  if (!isObject(options) || isNull(options)) {
7036
6621
  throw new TypeError(`"createElement" function expects an object as second parameter but received "${toString$1(options)}".`);
7037
6622
  }
7038
-
7039
6623
  const Ctor = options.is;
7040
-
7041
6624
  if (!isFunction$1(Ctor)) {
7042
6625
  throw new TypeError(`"createElement" function expects an "is" option with a valid component constructor.`);
7043
6626
  }
7044
-
7045
6627
  const {
7046
6628
  createCustomElement
7047
- } = renderer; // tagName must be all lowercase, unfortunately, we have legacy code that is
6629
+ } = renderer;
6630
+ // tagName must be all lowercase, unfortunately, we have legacy code that is
7048
6631
  // passing `sel` as a camel-case, which makes them invalid custom elements name
7049
6632
  // the following line guarantees that this does not leaks beyond this point.
7050
-
7051
- const tagName = StringToLowerCase.call(sel); // the custom element from the registry is expecting an upgrade callback
7052
-
6633
+ const tagName = StringToLowerCase.call(sel);
6634
+ // the custom element from the registry is expecting an upgrade callback
7053
6635
  /**
7054
6636
  * Note: if the upgradable constructor does not expect, or throw when we new it
7055
6637
  * with a callback as the first argument, we could implement a more advanced
7056
6638
  * mechanism that only passes that argument if the constructor is known to be
7057
6639
  * an upgradable custom element.
7058
6640
  */
7059
-
7060
6641
  const upgradeCallback = elm => {
7061
6642
  createVM(elm, Ctor, renderer, {
7062
6643
  tagName,
7063
6644
  mode: options.mode !== 'closed' ? 'open' : 'closed',
7064
6645
  owner: null
7065
6646
  });
7066
-
7067
6647
  if (!lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7068
6648
  ConnectingSlot.set(elm, connectRootElement);
7069
6649
  DisconnectingSlot.set(elm, disconnectRootElement);
7070
6650
  }
7071
6651
  };
7072
-
7073
6652
  const connectedCallback = elm => {
7074
6653
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7075
6654
  connectRootElement(elm);
7076
6655
  }
7077
6656
  };
7078
-
7079
6657
  const disconnectedCallback = elm => {
7080
6658
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
7081
6659
  disconnectRootElement(elm);
7082
6660
  }
7083
6661
  };
7084
-
7085
6662
  const element = createCustomElement(tagName, upgradeCallback, connectedCallback, disconnectedCallback);
7086
6663
  return element;
7087
6664
  }
@@ -7154,7 +6731,7 @@
7154
6731
  });
7155
6732
  freeze(LightningElement);
7156
6733
  seal(LightningElement.prototype);
7157
- /* version: 2.29.0 */
6734
+ /* version: 2.30.0 */
7158
6735
 
7159
6736
  exports.LightningElement = LightningElement;
7160
6737
  exports.__unstable__ProfilerControl = profilerControl;