lwc 2.29.0 → 2.30.1

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 (39) hide show
  1. package/dist/engine-dom/esm/es2017/engine-dom.js +321 -683
  2. package/dist/engine-dom/iife/es2017/engine-dom.js +321 -685
  3. package/dist/engine-dom/iife/es2017/engine-dom.min.js +1 -1
  4. package/dist/engine-dom/iife/es2017/engine-dom_debug.js +199 -626
  5. package/dist/engine-dom/iife/es5/engine-dom.js +1141 -2846
  6. package/dist/engine-dom/iife/es5/engine-dom.min.js +1 -1
  7. package/dist/engine-dom/iife/es5/engine-dom_debug.js +891 -2431
  8. package/dist/engine-dom/umd/es2017/engine-dom.js +321 -685
  9. package/dist/engine-dom/umd/es2017/engine-dom.min.js +1 -1
  10. package/dist/engine-dom/umd/es2017/engine-dom_debug.js +199 -626
  11. package/dist/engine-dom/umd/es5/engine-dom.js +1141 -2846
  12. package/dist/engine-dom/umd/es5/engine-dom.min.js +1 -1
  13. package/dist/engine-dom/umd/es5/engine-dom_debug.js +891 -2431
  14. package/dist/engine-server/commonjs/es2017/engine-server.js +206 -586
  15. package/dist/engine-server/commonjs/es2017/engine-server.min.js +1 -1
  16. package/dist/engine-server/esm/es2017/engine-server.js +206 -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 -4
  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 -4
  30. package/dist/wire-service/iife/es5/wire-service.js +13 -70
  31. package/dist/wire-service/iife/es5/wire-service.min.js +1 -1
  32. package/dist/wire-service/iife/es5/wire-service_debug.js +13 -70
  33. package/dist/wire-service/umd/es2017/wire-service.js +2 -4
  34. package/dist/wire-service/umd/es2017/wire-service.min.js +1 -1
  35. package/dist/wire-service/umd/es2017/wire-service_debug.js +2 -4
  36. package/dist/wire-service/umd/es5/wire-service.js +13 -70
  37. package/dist/wire-service/umd/es5/wire-service.min.js +1 -1
  38. package/dist/wire-service/umd/es5/wire-service_debug.js +13 -70
  39. package/package.json +7 -7
@@ -1,7 +1,5 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  /* proxy-compat-disable */
6
4
  /**
7
5
  * Copyright (C) 2018 salesforce.com, inc.
@@ -436,9 +434,9 @@ function htmlEscape(str, attrMode = false) {
436
434
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
437
435
  */
438
436
  // Increment whenever the LWC template compiler changes
439
- const LWC_VERSION = "2.29.0";
437
+ const LWC_VERSION = "2.30.1";
440
438
  const LWC_VERSION_COMMENT_REGEX = /\/\*LWC compiler v([\d.]+)\*\/\s*}/;
441
- /** version: 2.29.0 */
439
+ /** version: 2.30.1 */
442
440
 
443
441
  /*
444
442
  * Copyright (c) 2020, salesforce.com, inc.
@@ -550,7 +548,7 @@ function setFeatureFlagForTest(name, value) {
550
548
  setFeatureFlag(name, value);
551
549
  }
552
550
  }
553
- /** version: 2.29.0 */
551
+ /** version: 2.30.1 */
554
552
 
555
553
  /* proxy-compat-disable */
556
554
 
@@ -560,16 +558,14 @@ function setFeatureFlagForTest(name, value) {
560
558
  * SPDX-License-Identifier: MIT
561
559
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
562
560
  */
561
+ // Only used in LWC's Karma tests
563
562
  // @ts-ignore
564
-
565
563
  if (process.env.NODE_ENV !== 'production' && typeof __karma__ !== 'undefined') {
566
564
  window.addEventListener('test-dummy-flag', () => {
567
565
  let hasFlag = false;
568
-
569
566
  if (lwcRuntimeFlags.DUMMY_TEST_FLAG) {
570
567
  hasFlag = true;
571
568
  }
572
-
573
569
  window.dispatchEvent(new CustomEvent('has-dummy-flag', {
574
570
  detail: {
575
571
  package: '@lwc/engine-core',
@@ -2240,36 +2236,29 @@ function api$1() {
2240
2236
  if (process.env.NODE_ENV !== 'production') {
2241
2237
  assert.fail(`@api decorator can only be used as a decorator function.`);
2242
2238
  }
2243
-
2244
2239
  throw new Error();
2245
2240
  }
2246
2241
  function createPublicPropertyDescriptor(key) {
2247
2242
  return {
2248
2243
  get() {
2249
2244
  const vm = getAssociatedVM(this);
2250
-
2251
2245
  if (isBeingConstructed(vm)) {
2252
2246
  if (process.env.NODE_ENV !== 'production') {
2253
2247
  logError(`Can’t read the value of property \`${toString$1(key)}\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);
2254
2248
  }
2255
-
2256
2249
  return;
2257
2250
  }
2258
2251
  return vm.cmpProps[key];
2259
2252
  },
2260
-
2261
2253
  set(newValue) {
2262
2254
  const vm = getAssociatedVM(this);
2263
-
2264
2255
  if (process.env.NODE_ENV !== 'production') {
2265
2256
  const vmBeingRendered = getVMBeingRendered();
2266
2257
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2267
2258
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2268
2259
  }
2269
-
2270
2260
  vm.cmpProps[key] = newValue;
2271
2261
  },
2272
-
2273
2262
  enumerable: true,
2274
2263
  configurable: true
2275
2264
  };
@@ -2281,46 +2270,37 @@ function createPublicAccessorDescriptor(key, descriptor) {
2281
2270
  enumerable,
2282
2271
  configurable
2283
2272
  } = descriptor;
2284
-
2285
2273
  if (!isFunction$1(get)) {
2286
2274
  if (process.env.NODE_ENV !== 'production') {
2287
2275
  assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);
2288
2276
  }
2289
-
2290
2277
  throw new Error();
2291
2278
  }
2292
-
2293
2279
  return {
2294
2280
  get() {
2295
2281
  if (process.env.NODE_ENV !== 'production') {
2296
2282
  // Assert that the this value is an actual Component with an associated VM.
2297
2283
  getAssociatedVM(this);
2298
2284
  }
2299
-
2300
2285
  return get.call(this);
2301
2286
  },
2302
-
2303
2287
  set(newValue) {
2304
2288
  const vm = getAssociatedVM(this);
2305
-
2306
2289
  if (process.env.NODE_ENV !== 'production') {
2307
2290
  const vmBeingRendered = getVMBeingRendered();
2308
2291
  assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);
2309
2292
  assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);
2310
2293
  }
2311
-
2312
2294
  if (set) {
2313
2295
  if (lwcRuntimeFlags.ENABLE_REACTIVE_SETTER) {
2314
2296
  let ro = vm.oar[key];
2315
-
2316
2297
  if (isUndefined$1(ro)) {
2317
2298
  ro = vm.oar[key] = createAccessorReactiveObserver();
2318
- } // every time we invoke this setter from outside (through this wrapper setter)
2299
+ }
2300
+ // every time we invoke this setter from outside (through this wrapper setter)
2319
2301
  // we should reset the value and then debounce just in case there is a pending
2320
2302
  // invocation the next tick that is not longer relevant since the value is changing
2321
2303
  // from outside.
2322
-
2323
-
2324
2304
  ro.reset(newValue);
2325
2305
  ro.observe(() => {
2326
2306
  set.call(this, newValue);
@@ -2332,7 +2312,6 @@ function createPublicAccessorDescriptor(key, descriptor) {
2332
2312
  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.`);
2333
2313
  }
2334
2314
  },
2335
-
2336
2315
  enumerable,
2337
2316
  configurable
2338
2317
  };
@@ -3198,11 +3177,9 @@ function getComponentDef(Ctor) {
3198
3177
  * SPDX-License-Identifier: MIT
3199
3178
  * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
3200
3179
  */
3201
-
3202
3180
  function makeHostToken(token) {
3203
3181
  return `${token}-host`;
3204
3182
  }
3205
-
3206
3183
  function createInlineStyleVNode(content) {
3207
3184
  return api.h('style', {
3208
3185
  key: 'style',
@@ -3211,7 +3188,6 @@ function createInlineStyleVNode(content) {
3211
3188
  }
3212
3189
  }, [api.t(content)]);
3213
3190
  }
3214
-
3215
3191
  function updateStylesheetToken(vm, template) {
3216
3192
  const {
3217
3193
  elm,
@@ -3228,112 +3204,81 @@ function updateStylesheetToken(vm, template) {
3228
3204
  stylesheets: newStylesheets,
3229
3205
  stylesheetToken: newStylesheetToken
3230
3206
  } = template;
3231
- const isSyntheticShadow = renderMode === 1
3232
- /* RenderMode.Shadow */
3233
- && shadowMode === 1
3234
- /* ShadowMode.Synthetic */
3235
- ;
3207
+ const isSyntheticShadow = renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */;
3236
3208
  const {
3237
3209
  hasScopedStyles
3238
3210
  } = context;
3239
3211
  let newToken;
3240
3212
  let newHasTokenInClass;
3241
- let newHasTokenInAttribute; // Reset the styling token applied to the host element.
3242
-
3213
+ let newHasTokenInAttribute;
3214
+ // Reset the styling token applied to the host element.
3243
3215
  const {
3244
3216
  stylesheetToken: oldToken,
3245
3217
  hasTokenInClass: oldHasTokenInClass,
3246
3218
  hasTokenInAttribute: oldHasTokenInAttribute
3247
3219
  } = context;
3248
-
3249
3220
  if (!isUndefined$1(oldToken)) {
3250
3221
  if (oldHasTokenInClass) {
3251
3222
  getClassList(elm).remove(makeHostToken(oldToken));
3252
3223
  }
3253
-
3254
3224
  if (oldHasTokenInAttribute) {
3255
3225
  removeAttribute(elm, makeHostToken(oldToken));
3256
3226
  }
3257
- } // Apply the new template styling token to the host element, if the new template has any
3227
+ }
3228
+ // Apply the new template styling token to the host element, if the new template has any
3258
3229
  // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.
3259
-
3260
-
3261
3230
  if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {
3262
3231
  newToken = newStylesheetToken;
3263
- } // Set the new styling token on the host element
3264
-
3265
-
3232
+ }
3233
+ // Set the new styling token on the host element
3266
3234
  if (!isUndefined$1(newToken)) {
3267
3235
  if (hasScopedStyles) {
3268
3236
  getClassList(elm).add(makeHostToken(newToken));
3269
3237
  newHasTokenInClass = true;
3270
3238
  }
3271
-
3272
3239
  if (isSyntheticShadow) {
3273
3240
  setAttribute(elm, makeHostToken(newToken), '');
3274
3241
  newHasTokenInAttribute = true;
3275
3242
  }
3276
- } // Update the styling tokens present on the context object.
3277
-
3278
-
3243
+ }
3244
+ // Update the styling tokens present on the context object.
3279
3245
  context.stylesheetToken = newToken;
3280
3246
  context.hasTokenInClass = newHasTokenInClass;
3281
3247
  context.hasTokenInAttribute = newHasTokenInAttribute;
3282
3248
  }
3283
-
3284
3249
  function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3285
3250
  const content = [];
3286
3251
  let root;
3287
-
3288
3252
  for (let i = 0; i < stylesheets.length; i++) {
3289
3253
  let stylesheet = stylesheets[i];
3290
-
3291
3254
  if (isArray$1(stylesheet)) {
3292
3255
  ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));
3293
3256
  } else {
3294
3257
  if (process.env.NODE_ENV !== 'production') {
3295
3258
  // Check for compiler version mismatch in dev mode only
3296
- checkVersionMismatch(stylesheet, 'stylesheet'); // in dev-mode, we support hot swapping of stylesheet, which means that
3259
+ checkVersionMismatch(stylesheet, 'stylesheet');
3260
+ // in dev-mode, we support hot swapping of stylesheet, which means that
3297
3261
  // the component instance might be attempting to use an old version of
3298
3262
  // the stylesheet, while internally, we have a replacement for it.
3299
-
3300
3263
  stylesheet = getStyleOrSwappedStyle(stylesheet);
3301
3264
  }
3302
-
3303
3265
  const isScopedCss = stylesheet[KEY__SCOPED_CSS];
3304
-
3305
3266
  if (lwcRuntimeFlags.DISABLE_LIGHT_DOM_UNSCOPED_CSS) {
3306
- if (!isScopedCss && vm.renderMode === 0
3307
- /* RenderMode.Light */
3308
- ) {
3267
+ if (!isScopedCss && vm.renderMode === 0 /* RenderMode.Light */) {
3309
3268
  logError('Unscoped CSS is not supported in Light DOM. Please use scoped CSS (*.scoped.css) instead of unscoped CSS (*.css).');
3310
3269
  continue;
3311
3270
  }
3312
- } // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3313
-
3314
-
3315
- const scopeToken = isScopedCss || vm.shadowMode === 1
3316
- /* ShadowMode.Synthetic */
3317
- && vm.renderMode === 1
3318
- /* RenderMode.Shadow */
3319
- ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3271
+ }
3272
+ // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.
3273
+ const scopeToken = isScopedCss || vm.shadowMode === 1 /* ShadowMode.Synthetic */ && vm.renderMode === 1 /* RenderMode.Shadow */ ? stylesheetToken : undefined;
3274
+ // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering
3320
3275
  // native shadow DOM. Synthetic shadow DOM never uses `:host`.
3321
-
3322
- const useActualHostSelector = vm.renderMode === 0
3323
- /* RenderMode.Light */
3324
- ? !isScopedCss : vm.shadowMode === 0
3325
- /* ShadowMode.Native */
3326
- ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3276
+ const useActualHostSelector = vm.renderMode === 0 /* RenderMode.Light */ ? !isScopedCss : vm.shadowMode === 0 /* ShadowMode.Native */;
3277
+ // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,
3327
3278
  // we use an attribute selector on the host to simulate :dir().
3328
-
3329
3279
  let useNativeDirPseudoclass;
3330
-
3331
- if (vm.renderMode === 1
3332
- /* RenderMode.Shadow */
3333
- ) {
3334
- useNativeDirPseudoclass = vm.shadowMode === 0
3335
- /* ShadowMode.Native */
3336
- ;
3280
+ if (vm.renderMode === 1 /* RenderMode.Shadow */) {
3281
+ useNativeDirPseudoclass = vm.shadowMode === 0 /* ShadowMode.Native */;
3337
3282
  } else {
3338
3283
  // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.
3339
3284
  // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.
@@ -3341,48 +3286,36 @@ function evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {
3341
3286
  // Only calculate the root once as necessary
3342
3287
  root = getNearestShadowComponent(vm);
3343
3288
  }
3344
-
3345
- useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0
3346
- /* ShadowMode.Native */
3347
- ;
3289
+ useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0 /* ShadowMode.Native */;
3348
3290
  }
3349
3291
 
3350
3292
  ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));
3351
3293
  }
3352
3294
  }
3353
-
3354
3295
  return content;
3355
3296
  }
3356
-
3357
3297
  function getStylesheetsContent(vm, template) {
3358
3298
  const {
3359
3299
  stylesheets,
3360
3300
  stylesheetToken
3361
3301
  } = template;
3362
3302
  let content = [];
3363
-
3364
3303
  if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {
3365
3304
  content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);
3366
3305
  }
3367
-
3368
3306
  return content;
3369
- } // It might be worth caching this to avoid doing the lookup repeatedly, but
3307
+ }
3308
+ // It might be worth caching this to avoid doing the lookup repeatedly, but
3370
3309
  // perf testing has not shown it to be a huge improvement yet:
3371
3310
  // https://github.com/salesforce/lwc/pull/2460#discussion_r691208892
3372
-
3373
3311
  function getNearestShadowComponent(vm) {
3374
3312
  let owner = vm;
3375
-
3376
3313
  while (!isNull(owner)) {
3377
- if (owner.renderMode === 1
3378
- /* RenderMode.Shadow */
3379
- ) {
3314
+ if (owner.renderMode === 1 /* RenderMode.Shadow */) {
3380
3315
  return owner;
3381
3316
  }
3382
-
3383
3317
  owner = owner.owner;
3384
3318
  }
3385
-
3386
3319
  return owner;
3387
3320
  }
3388
3321
  /**
@@ -3390,8 +3323,6 @@ function getNearestShadowComponent(vm) {
3390
3323
  * this returns the unique token for that scoped stylesheet. Otherwise
3391
3324
  * it returns null.
3392
3325
  */
3393
-
3394
-
3395
3326
  function getScopeTokenClass(owner) {
3396
3327
  const {
3397
3328
  cmpTemplate,
@@ -3399,7 +3330,6 @@ function getScopeTokenClass(owner) {
3399
3330
  } = owner;
3400
3331
  return context.hasScopedStyles && (cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken) || null;
3401
3332
  }
3402
-
3403
3333
  function createStylesheet(vm, stylesheets) {
3404
3334
  const {
3405
3335
  renderMode,
@@ -3408,12 +3338,7 @@ function createStylesheet(vm, stylesheets) {
3408
3338
  insertStylesheet
3409
3339
  }
3410
3340
  } = vm;
3411
-
3412
- if (renderMode === 1
3413
- /* RenderMode.Shadow */
3414
- && shadowMode === 1
3415
- /* ShadowMode.Synthetic */
3416
- ) {
3341
+ if (renderMode === 1 /* RenderMode.Shadow */ && shadowMode === 1 /* ShadowMode.Synthetic */) {
3417
3342
  for (let i = 0; i < stylesheets.length; i++) {
3418
3343
  insertStylesheet(stylesheets[i]);
3419
3344
  }
@@ -3424,7 +3349,6 @@ function createStylesheet(vm, stylesheets) {
3424
3349
  // native shadow or light DOM, SSR
3425
3350
  return ArrayMap.call(stylesheets, createInlineStyleVNode);
3426
3351
  }
3427
-
3428
3352
  return null;
3429
3353
  }
3430
3354
 
@@ -3699,14 +3623,11 @@ function patchChildren(c1, c2, parent, renderer) {
3699
3623
  updateStaticChildren(c1, c2, parent, renderer);
3700
3624
  }
3701
3625
  }
3702
-
3703
3626
  function patch(n1, n2, parent, renderer) {
3704
3627
  var _a, _b;
3705
-
3706
3628
  if (n1 === n2) {
3707
3629
  return;
3708
3630
  }
3709
-
3710
3631
  if (process.env.NODE_ENV !== 'production') {
3711
3632
  if (!isSameVnode(n1, n2)) {
3712
3633
  throw new Error('Expected these VNodes to be the same: ' + JSON.stringify({
@@ -3718,103 +3639,63 @@ function patch(n1, n2, parent, renderer) {
3718
3639
  }));
3719
3640
  }
3720
3641
  }
3721
-
3722
3642
  switch (n2.type) {
3723
- case 0
3724
- /* VNodeType.Text */
3725
- :
3643
+ case 0 /* VNodeType.Text */:
3726
3644
  // VText has no special capability, fallback to the owner's renderer
3727
3645
  patchText(n1, n2, renderer);
3728
3646
  break;
3729
-
3730
- case 1
3731
- /* VNodeType.Comment */
3732
- :
3647
+ case 1 /* VNodeType.Comment */:
3733
3648
  // VComment has no special capability, fallback to the owner's renderer
3734
3649
  patchComment(n1, n2, renderer);
3735
3650
  break;
3736
-
3737
- case 4
3738
- /* VNodeType.Static */
3739
- :
3651
+ case 4 /* VNodeType.Static */:
3740
3652
  n2.elm = n1.elm;
3741
3653
  break;
3742
-
3743
- case 5
3744
- /* VNodeType.Fragment */
3745
- :
3654
+ case 5 /* VNodeType.Fragment */:
3746
3655
  patchFragment(n1, n2, parent, renderer);
3747
3656
  break;
3748
-
3749
- case 2
3750
- /* VNodeType.Element */
3751
- :
3657
+ case 2 /* VNodeType.Element */:
3752
3658
  patchElement(n1, n2, (_a = n2.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3753
3659
  break;
3754
-
3755
- case 3
3756
- /* VNodeType.CustomElement */
3757
- :
3660
+ case 3 /* VNodeType.CustomElement */:
3758
3661
  patchCustomElement(n1, n2, parent, (_b = n2.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3759
3662
  break;
3760
3663
  }
3761
3664
  }
3762
-
3763
3665
  function mount(node, parent, renderer, anchor) {
3764
3666
  var _a, _b;
3765
-
3766
3667
  switch (node.type) {
3767
- case 0
3768
- /* VNodeType.Text */
3769
- :
3668
+ case 0 /* VNodeType.Text */:
3770
3669
  // VText has no special capability, fallback to the owner's renderer
3771
3670
  mountText(node, parent, anchor, renderer);
3772
3671
  break;
3773
-
3774
- case 1
3775
- /* VNodeType.Comment */
3776
- :
3672
+ case 1 /* VNodeType.Comment */:
3777
3673
  // VComment has no special capability, fallback to the owner's renderer
3778
3674
  mountComment(node, parent, anchor, renderer);
3779
3675
  break;
3780
-
3781
- case 4
3782
- /* VNodeType.Static */
3783
- :
3676
+ case 4 /* VNodeType.Static */:
3784
3677
  // VStatic cannot have a custom renderer associated to them, using owner's renderer
3785
3678
  mountStatic(node, parent, anchor, renderer);
3786
3679
  break;
3787
-
3788
- case 5
3789
- /* VNodeType.Fragment */
3790
- :
3680
+ case 5 /* VNodeType.Fragment */:
3791
3681
  mountFragment(node, parent, anchor, renderer);
3792
3682
  break;
3793
-
3794
- case 2
3795
- /* VNodeType.Element */
3796
- :
3683
+ case 2 /* VNodeType.Element */:
3797
3684
  // If the vnode data has a renderer override use it, else fallback to owner's renderer
3798
3685
  mountElement(node, parent, anchor, (_a = node.data.renderer) !== null && _a !== void 0 ? _a : renderer);
3799
3686
  break;
3800
-
3801
- case 3
3802
- /* VNodeType.CustomElement */
3803
- :
3687
+ case 3 /* VNodeType.CustomElement */:
3804
3688
  // If the vnode data has a renderer override use it, else fallback to owner's renderer
3805
3689
  mountCustomElement(node, parent, anchor, (_b = node.data.renderer) !== null && _b !== void 0 ? _b : renderer);
3806
3690
  break;
3807
3691
  }
3808
3692
  }
3809
-
3810
3693
  function patchText(n1, n2, renderer) {
3811
3694
  n2.elm = n1.elm;
3812
-
3813
3695
  if (n2.text !== n1.text) {
3814
3696
  updateTextContent(n2, renderer);
3815
3697
  }
3816
3698
  }
3817
-
3818
3699
  function mountText(vnode, parent, anchor, renderer) {
3819
3700
  const {
3820
3701
  owner
@@ -3826,16 +3707,14 @@ function mountText(vnode, parent, anchor, renderer) {
3826
3707
  linkNodeToShadow(textNode, owner, renderer);
3827
3708
  insertNode(textNode, parent, anchor, renderer);
3828
3709
  }
3829
-
3830
3710
  function patchComment(n1, n2, renderer) {
3831
- n2.elm = n1.elm; // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3711
+ n2.elm = n1.elm;
3712
+ // FIXME: Comment nodes should be static, we shouldn't need to diff them together. However
3832
3713
  // it is the case today.
3833
-
3834
3714
  if (n2.text !== n1.text) {
3835
3715
  updateTextContent(n2, renderer);
3836
3716
  }
3837
3717
  }
3838
-
3839
3718
  function mountComment(vnode, parent, anchor, renderer) {
3840
3719
  const {
3841
3720
  owner
@@ -3847,32 +3726,27 @@ function mountComment(vnode, parent, anchor, renderer) {
3847
3726
  linkNodeToShadow(commentNode, owner, renderer);
3848
3727
  insertNode(commentNode, parent, anchor, renderer);
3849
3728
  }
3850
-
3851
3729
  function mountFragment(vnode, parent, anchor, renderer) {
3852
3730
  const {
3853
3731
  children
3854
3732
  } = vnode;
3855
- mountVNodes(children, parent, renderer, anchor); // children of a fragment will always have at least the two delimiters.
3856
-
3733
+ mountVNodes(children, parent, renderer, anchor);
3734
+ // children of a fragment will always have at least the two delimiters.
3857
3735
  vnode.elm = children[children.length - 1].elm;
3858
3736
  }
3859
-
3860
3737
  function patchFragment(n1, n2, parent, renderer) {
3861
3738
  const {
3862
3739
  children,
3863
3740
  stable
3864
3741
  } = n2;
3865
-
3866
3742
  if (stable) {
3867
3743
  updateStaticChildren(n1.children, children, parent, renderer);
3868
3744
  } else {
3869
3745
  updateDynamicChildren(n1.children, children, parent, renderer);
3870
- } // Note: not reusing n1.elm, because during patching, it may be patched with another text node.
3871
-
3872
-
3746
+ }
3747
+ // Note: not reusing n1.elm, because during patching, it may be patched with another text node.
3873
3748
  n2.elm = children[children.length - 1].elm;
3874
3749
  }
3875
-
3876
3750
  function mountElement(vnode, parent, anchor, renderer) {
3877
3751
  const {
3878
3752
  sel,
@@ -3894,13 +3768,11 @@ function mountElement(vnode, parent, anchor, renderer) {
3894
3768
  insertNode(elm, parent, anchor, renderer);
3895
3769
  mountVNodes(vnode.children, elm, renderer, null);
3896
3770
  }
3897
-
3898
3771
  function patchElement(n1, n2, renderer) {
3899
3772
  const elm = n2.elm = n1.elm;
3900
3773
  patchElementPropsAndAttrs$1(n1, n2, renderer);
3901
3774
  patchChildren(n1.children, n2.children, elm, renderer);
3902
3775
  }
3903
-
3904
3776
  function mountStatic(vnode, parent, anchor, renderer) {
3905
3777
  const {
3906
3778
  owner
@@ -3911,26 +3783,19 @@ function mountStatic(vnode, parent, anchor, renderer) {
3911
3783
  } = renderer;
3912
3784
  const elm = vnode.elm = cloneNode(vnode.fragment, true);
3913
3785
  linkNodeToShadow(elm, owner, renderer);
3914
- applyElementRestrictions(elm, vnode); // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3915
-
3786
+ applyElementRestrictions(elm, vnode);
3787
+ // Marks this node as Static to propagate the shadow resolver. must happen after elm is assigned to the proper shadow
3916
3788
  const {
3917
3789
  renderMode,
3918
3790
  shadowMode
3919
3791
  } = owner;
3920
-
3921
3792
  if (isSyntheticShadowDefined) {
3922
- if (shadowMode === 1
3923
- /* ShadowMode.Synthetic */
3924
- || renderMode === 0
3925
- /* RenderMode.Light */
3926
- ) {
3793
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
3927
3794
  elm[KEY__SHADOW_STATIC] = true;
3928
3795
  }
3929
3796
  }
3930
-
3931
3797
  insertNode(elm, parent, anchor, renderer);
3932
3798
  }
3933
-
3934
3799
  function mountCustomElement(vnode, parent, anchor, renderer) {
3935
3800
  const {
3936
3801
  sel,
@@ -3945,44 +3810,36 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3945
3810
  * mechanism that only passes that argument if the constructor is known to be
3946
3811
  * an upgradable custom element.
3947
3812
  */
3948
-
3949
3813
  let vm;
3950
-
3951
3814
  const upgradeCallback = elm => {
3952
3815
  // the custom element from the registry is expecting an upgrade callback
3953
3816
  vm = createViewModelHook(elm, vnode, renderer);
3954
3817
  };
3955
-
3956
3818
  const connectedCallback = elm => {
3957
3819
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3958
3820
  connectRootElement(elm);
3959
3821
  }
3960
3822
  };
3961
-
3962
3823
  const disconnectedCallback = elm => {
3963
3824
  if (lwcRuntimeFlags.ENABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE) {
3964
3825
  disconnectRootElement(elm);
3965
3826
  }
3966
- }; // Should never get a tag with upper case letter at this point; the compiler
3827
+ };
3828
+ // Should never get a tag with upper case letter at this point; the compiler
3967
3829
  // should produce only tags with lowercase letters. However, the Java
3968
3830
  // compiler may generate tagnames with uppercase letters so - for backwards
3969
3831
  // compatibility, we lower case the tagname here.
3970
-
3971
-
3972
3832
  const normalizedTagname = sel.toLowerCase();
3973
3833
  const elm = createCustomElement(normalizedTagname, upgradeCallback, connectedCallback, disconnectedCallback);
3974
3834
  vnode.elm = elm;
3975
3835
  vnode.vm = vm;
3976
3836
  linkNodeToShadow(elm, owner, renderer);
3977
3837
  applyStyleScoping(elm, owner, renderer);
3978
-
3979
3838
  if (vm) {
3980
3839
  allocateChildren(vnode, vm);
3981
3840
  }
3982
-
3983
3841
  patchElementPropsAndAttrs$1(null, vnode, renderer);
3984
3842
  insertNode(elm, parent, anchor, renderer);
3985
-
3986
3843
  if (vm) {
3987
3844
  {
3988
3845
  // On the server, we don't have native custom element lifecycle callbacks, so we must
@@ -3990,14 +3847,11 @@ function mountCustomElement(vnode, parent, anchor, renderer) {
3990
3847
  runConnectedCallback(vm);
3991
3848
  }
3992
3849
  }
3993
-
3994
3850
  mountVNodes(vnode.children, elm, renderer, null);
3995
-
3996
3851
  if (vm) {
3997
3852
  appendVM(vm);
3998
3853
  }
3999
3854
  }
4000
-
4001
3855
  function patchCustomElement(n1, n2, parent, renderer) {
4002
3856
  if (n1.ctor !== n2.ctor) {
4003
3857
  // If the constructor, unmount the current component and mount a new one using the new
@@ -4010,17 +3864,14 @@ function patchCustomElement(n1, n2, parent, renderer) {
4010
3864
  const elm = n2.elm = n1.elm;
4011
3865
  const vm = n2.vm = n1.vm;
4012
3866
  patchElementPropsAndAttrs$1(n1, n2, renderer);
4013
-
4014
3867
  if (!isUndefined$1(vm)) {
4015
3868
  // in fallback mode, the allocation will always set children to
4016
3869
  // empty and delegate the real allocation to the slot elements
4017
3870
  allocateChildren(n2, vm);
4018
- } // in fallback mode, the children will be always empty, so, nothing
3871
+ }
3872
+ // in fallback mode, the children will be always empty, so, nothing
4019
3873
  // will happen, but in native, it does allocate the light dom
4020
-
4021
-
4022
3874
  patchChildren(n1.children, n2.children, elm, renderer);
4023
-
4024
3875
  if (!isUndefined$1(vm)) {
4025
3876
  // this will probably update the shadowRoot, but only if the vm is in a dirty state
4026
3877
  // this is important to preserve the top to bottom synchronous rendering phase.
@@ -4028,29 +3879,24 @@ function patchCustomElement(n1, n2, parent, renderer) {
4028
3879
  }
4029
3880
  }
4030
3881
  }
4031
-
4032
3882
  function mountVNodes(vnodes, parent, renderer, anchor, start = 0, end = vnodes.length) {
4033
3883
  for (; start < end; ++start) {
4034
3884
  const vnode = vnodes[start];
4035
-
4036
3885
  if (isVNode(vnode)) {
4037
3886
  mount(vnode, parent, renderer, anchor);
4038
3887
  }
4039
3888
  }
4040
3889
  }
4041
-
4042
3890
  function unmount(vnode, parent, renderer, doRemove = false) {
4043
3891
  const {
4044
3892
  type,
4045
3893
  elm,
4046
3894
  sel
4047
- } = vnode; // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
3895
+ } = vnode;
3896
+ // When unmounting a VNode subtree not all the elements have to removed from the DOM. The
4048
3897
  // subtree root, is the only element worth unmounting from the subtree.
4049
-
4050
3898
  if (doRemove) {
4051
- if (type === 5
4052
- /* VNodeType.Fragment */
4053
- ) {
3899
+ if (type === 5 /* VNodeType.Fragment */) {
4054
3900
  unmountVNodes(vnode.children, parent, renderer, doRemove);
4055
3901
  } else {
4056
3902
  // The vnode might or might not have a data.renderer associated to it
@@ -4058,51 +3904,39 @@ function unmount(vnode, parent, renderer, doRemove = false) {
4058
3904
  removeNode(elm, parent, renderer);
4059
3905
  }
4060
3906
  }
4061
-
4062
3907
  switch (type) {
4063
- case 2
4064
- /* VNodeType.Element */
4065
- :
3908
+ case 2 /* VNodeType.Element */:
4066
3909
  {
4067
3910
  // Slot content is removed to trigger slotchange event when removing slot.
4068
3911
  // Only required for synthetic shadow.
4069
- const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1
4070
- /* ShadowMode.Synthetic */
4071
- ;
3912
+ const shouldRemoveChildren = sel === 'slot' && vnode.owner.shadowMode === 1 /* ShadowMode.Synthetic */;
4072
3913
  unmountVNodes(vnode.children, elm, renderer, shouldRemoveChildren);
4073
3914
  break;
4074
3915
  }
4075
-
4076
- case 3
4077
- /* VNodeType.CustomElement */
4078
- :
3916
+ case 3 /* VNodeType.CustomElement */:
4079
3917
  {
4080
3918
  const {
4081
3919
  vm
4082
- } = vnode; // No need to unmount the children here, `removeVM` will take care of removing the
3920
+ } = vnode;
3921
+ // No need to unmount the children here, `removeVM` will take care of removing the
4083
3922
  // children.
4084
-
4085
3923
  if (!isUndefined$1(vm)) {
4086
3924
  removeVM(vm);
4087
3925
  }
4088
3926
  }
4089
3927
  }
4090
3928
  }
4091
-
4092
3929
  function unmountVNodes(vnodes, parent, renderer, doRemove = false, start = 0, end = vnodes.length) {
4093
3930
  for (; start < end; ++start) {
4094
3931
  const ch = vnodes[start];
4095
-
4096
3932
  if (isVNode(ch)) {
4097
3933
  unmount(ch, parent, renderer, doRemove);
4098
3934
  }
4099
3935
  }
4100
3936
  }
4101
-
4102
3937
  function isVNode(vnode) {
4103
3938
  return vnode != null;
4104
3939
  }
4105
-
4106
3940
  function linkNodeToShadow(elm, owner, renderer) {
4107
3941
  const {
4108
3942
  renderRoot,
@@ -4111,19 +3945,14 @@ function linkNodeToShadow(elm, owner, renderer) {
4111
3945
  } = owner;
4112
3946
  const {
4113
3947
  isSyntheticShadowDefined
4114
- } = renderer; // TODO [#1164]: this should eventually be done by the polyfill directly
4115
-
3948
+ } = renderer;
3949
+ // TODO [#1164]: this should eventually be done by the polyfill directly
4116
3950
  if (isSyntheticShadowDefined) {
4117
- if (shadowMode === 1
4118
- /* ShadowMode.Synthetic */
4119
- || renderMode === 0
4120
- /* RenderMode.Light */
4121
- ) {
3951
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4122
3952
  elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];
4123
3953
  }
4124
3954
  }
4125
3955
  }
4126
-
4127
3956
  function updateTextContent(vnode, renderer) {
4128
3957
  const {
4129
3958
  elm,
@@ -4132,120 +3961,87 @@ function updateTextContent(vnode, renderer) {
4132
3961
  const {
4133
3962
  setText
4134
3963
  } = renderer;
4135
-
4136
3964
  if (process.env.NODE_ENV !== 'production') {
4137
3965
  unlockDomMutation();
4138
3966
  }
4139
-
4140
3967
  setText(elm, text);
4141
-
4142
3968
  if (process.env.NODE_ENV !== 'production') {
4143
3969
  lockDomMutation();
4144
3970
  }
4145
3971
  }
4146
-
4147
3972
  function insertNode(node, parent, anchor, renderer) {
4148
3973
  if (process.env.NODE_ENV !== 'production') {
4149
3974
  unlockDomMutation();
4150
3975
  }
4151
-
4152
3976
  renderer.insert(node, parent, anchor);
4153
-
4154
3977
  if (process.env.NODE_ENV !== 'production') {
4155
3978
  lockDomMutation();
4156
3979
  }
4157
3980
  }
4158
-
4159
3981
  function removeNode(node, parent, renderer) {
4160
3982
  if (process.env.NODE_ENV !== 'production') {
4161
3983
  unlockDomMutation();
4162
3984
  }
4163
-
4164
3985
  renderer.remove(node, parent);
4165
-
4166
3986
  if (process.env.NODE_ENV !== 'production') {
4167
3987
  lockDomMutation();
4168
3988
  }
4169
3989
  }
4170
-
4171
3990
  function patchElementPropsAndAttrs$1(oldVnode, vnode, renderer) {
4172
3991
  if (isNull(oldVnode)) {
4173
3992
  applyEventListeners(vnode, renderer);
4174
3993
  applyStaticClassAttribute(vnode, renderer);
4175
3994
  applyStaticStyleAttribute(vnode, renderer);
4176
- } // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
3995
+ }
3996
+ // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if
4177
3997
  // value is set before type=radio.
4178
-
4179
-
4180
3998
  patchClassAttribute(oldVnode, vnode, renderer);
4181
3999
  patchStyleAttribute(oldVnode, vnode, renderer);
4182
4000
  patchAttributes(oldVnode, vnode, renderer);
4183
4001
  patchProps(oldVnode, vnode, renderer);
4184
4002
  }
4185
-
4186
4003
  function applyStyleScoping(elm, owner, renderer) {
4187
4004
  // Set the class name for `*.scoped.css` style scoping.
4188
4005
  const scopeToken = getScopeTokenClass(owner);
4189
-
4190
4006
  if (!isNull(scopeToken)) {
4191
4007
  const {
4192
4008
  getClassList
4193
- } = renderer; // TODO [#2762]: this dot notation with add is probably problematic
4009
+ } = renderer;
4010
+ // TODO [#2762]: this dot notation with add is probably problematic
4194
4011
  // probably we should have a renderer api for just the add operation
4195
-
4196
4012
  getClassList(elm).add(scopeToken);
4197
- } // Set property element for synthetic shadow DOM style scoping.
4198
-
4199
-
4013
+ }
4014
+ // Set property element for synthetic shadow DOM style scoping.
4200
4015
  const {
4201
4016
  stylesheetToken: syntheticToken
4202
4017
  } = owner.context;
4203
-
4204
- if (owner.shadowMode === 1
4205
- /* ShadowMode.Synthetic */
4206
- && !isUndefined$1(syntheticToken)) {
4018
+ if (owner.shadowMode === 1 /* ShadowMode.Synthetic */ && !isUndefined$1(syntheticToken)) {
4207
4019
  elm.$shadowToken$ = syntheticToken;
4208
4020
  }
4209
4021
  }
4210
-
4211
4022
  function applyDomManual(elm, vnode) {
4212
4023
  var _a;
4213
-
4214
4024
  const {
4215
4025
  owner,
4216
4026
  data: {
4217
4027
  context
4218
4028
  }
4219
4029
  } = vnode;
4220
-
4221
- if (owner.shadowMode === 1
4222
- /* ShadowMode.Synthetic */
4223
- && ((_a = context === null || context === void 0 ? void 0 : context.lwc) === null || _a === void 0 ? void 0 : _a.dom) === "manual"
4224
- /* LwcDomMode.Manual */
4225
- ) {
4030
+ 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 */) {
4226
4031
  elm.$domManual$ = true;
4227
4032
  }
4228
4033
  }
4229
-
4230
4034
  function applyElementRestrictions(elm, vnode) {
4231
4035
  var _a, _b;
4232
-
4233
4036
  if (process.env.NODE_ENV !== 'production') {
4234
- const isPortal = vnode.type === 2
4235
- /* VNodeType.Element */
4236
- && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual"
4237
- /* LwcDomMode.Manual */
4238
- ;
4239
- const isLight = vnode.owner.renderMode === 0
4240
- /* RenderMode.Light */
4241
- ;
4037
+ const isPortal = vnode.type === 2 /* VNodeType.Element */ && ((_b = (_a = vnode.data.context) === null || _a === void 0 ? void 0 : _a.lwc) === null || _b === void 0 ? void 0 : _b.dom) === "manual" /* LwcDomMode.Manual */;
4038
+ const isLight = vnode.owner.renderMode === 0 /* RenderMode.Light */;
4242
4039
  patchElementWithRestrictions(elm, {
4243
4040
  isPortal,
4244
4041
  isLight
4245
4042
  });
4246
4043
  }
4247
4044
  }
4248
-
4249
4045
  function allocateChildren(vnode, vm) {
4250
4046
  // A component with slots will re-render because:
4251
4047
  // 1- There is a change of the internal state.
@@ -4263,41 +4059,31 @@ function allocateChildren(vnode, vm) {
4263
4059
  renderMode,
4264
4060
  shadowMode
4265
4061
  } = vm;
4266
-
4267
4062
  if (process.env.NODE_ENV !== 'production') {
4268
4063
  // If any of the children being allocated is a scoped slot fragment, make sure the receiving
4269
4064
  // component is a light DOM component. This is mainly to validate light dom parent running
4270
4065
  // in native shadow mode.
4271
- if (renderMode !== 0
4272
- /* RenderMode.Light */
4273
- && ArraySome.call(children, child => !isNull(child) && isVScopedSlotFragment(child))) {
4066
+ if (renderMode !== 0 /* RenderMode.Light */ && ArraySome.call(children, child => !isNull(child) && isVScopedSlotFragment(child))) {
4274
4067
  logError(`Invalid usage of 'lwc:slot-data' on ${getComponentTag(vm)} tag. Scoped slot content can only be passed to a light dom child.`);
4275
4068
  }
4276
4069
  }
4277
-
4278
- if (shadowMode === 1
4279
- /* ShadowMode.Synthetic */
4280
- || renderMode === 0
4281
- /* RenderMode.Light */
4282
- ) {
4070
+ if (shadowMode === 1 /* ShadowMode.Synthetic */ || renderMode === 0 /* RenderMode.Light */) {
4283
4071
  // slow path
4284
- allocateInSlot(vm, children, vnode.owner); // save the allocated children in case this vnode is reused.
4285
-
4286
- vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4287
-
4072
+ allocateInSlot(vm, children, vnode.owner);
4073
+ // save the allocated children in case this vnode is reused.
4074
+ vnode.aChildren = children;
4075
+ // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!
4288
4076
  vnode.children = EmptyArray;
4289
4077
  }
4290
4078
  }
4291
-
4292
4079
  function createViewModelHook(elm, vnode, renderer) {
4293
- let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the
4080
+ let vm = getAssociatedVMIfPresent(elm);
4081
+ // There is a possibility that a custom element is registered under tagName, in which case, the
4294
4082
  // initialization is already carry on, and there is nothing else to do here since this hook is
4295
4083
  // called right after invoking `document.createElement`.
4296
-
4297
4084
  if (!isUndefined$1(vm)) {
4298
4085
  return vm;
4299
4086
  }
4300
-
4301
4087
  const {
4302
4088
  sel,
4303
4089
  mode,
@@ -4309,48 +4095,37 @@ function createViewModelHook(elm, vnode, renderer) {
4309
4095
  owner,
4310
4096
  tagName: sel
4311
4097
  });
4312
-
4313
4098
  if (process.env.NODE_ENV !== 'production') {
4314
4099
  assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);
4315
4100
  }
4316
-
4317
4101
  return vm;
4318
4102
  }
4319
4103
  /**
4320
4104
  * Collects all slots into a SlotSet, traversing through VFragment Nodes
4321
4105
  */
4322
-
4323
-
4324
4106
  function collectSlots(vm, children, cmpSlotsMapping) {
4325
4107
  var _a, _b;
4326
-
4327
4108
  for (let i = 0, len = children.length; i < len; i += 1) {
4328
4109
  const vnode = children[i];
4329
-
4330
4110
  if (isNull(vnode)) {
4331
4111
  continue;
4332
- } // Dive further iff the content is wrapped in a VFragment
4333
-
4334
-
4112
+ }
4113
+ // Dive further iff the content is wrapped in a VFragment
4335
4114
  if (isVFragment(vnode)) {
4336
4115
  // Remove the text delimiter nodes to avoid overriding default slot content
4337
4116
  collectSlots(vm, vnode.children.slice(1, -1), cmpSlotsMapping);
4338
4117
  continue;
4339
4118
  }
4340
-
4341
4119
  let slotName = '';
4342
-
4343
4120
  if (isVBaseElement(vnode)) {
4344
4121
  slotName = (_b = (_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) !== null && _b !== void 0 ? _b : '';
4345
4122
  } else if (isVScopedSlotFragment(vnode)) {
4346
4123
  slotName = vnode.slotName;
4347
4124
  }
4348
-
4349
4125
  const vnodes = cmpSlotsMapping[slotName] = cmpSlotsMapping[slotName] || [];
4350
4126
  ArrayPush$1.call(vnodes, vnode);
4351
4127
  }
4352
4128
  }
4353
-
4354
4129
  function allocateInSlot(vm, children, owner) {
4355
4130
  const {
4356
4131
  cmpSlots: {
@@ -4363,28 +4138,22 @@ function allocateInSlot(vm, children, owner) {
4363
4138
  owner,
4364
4139
  slotAssignments: cmpSlotsMapping
4365
4140
  };
4366
-
4367
4141
  if (isFalse(vm.isDirty)) {
4368
4142
  // We need to determine if the old allocation is really different from the new one
4369
4143
  // and mark the vm as dirty
4370
4144
  const oldKeys = keys(oldSlotsMapping);
4371
-
4372
4145
  if (oldKeys.length !== keys(cmpSlotsMapping).length) {
4373
4146
  markComponentAsDirty(vm);
4374
4147
  return;
4375
4148
  }
4376
-
4377
4149
  for (let i = 0, len = oldKeys.length; i < len; i += 1) {
4378
4150
  const key = oldKeys[i];
4379
-
4380
4151
  if (isUndefined$1(cmpSlotsMapping[key]) || oldSlotsMapping[key].length !== cmpSlotsMapping[key].length) {
4381
4152
  markComponentAsDirty(vm);
4382
4153
  return;
4383
4154
  }
4384
-
4385
4155
  const oldVNodes = oldSlotsMapping[key];
4386
4156
  const vnodes = cmpSlotsMapping[key];
4387
-
4388
4157
  for (let j = 0, a = cmpSlotsMapping[key].length; j < a; j += 1) {
4389
4158
  if (oldVNodes[j] !== vnodes[j]) {
4390
4159
  markComponentAsDirty(vm);
@@ -4393,40 +4162,33 @@ function allocateInSlot(vm, children, owner) {
4393
4162
  }
4394
4163
  }
4395
4164
  }
4396
- } // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4397
-
4398
-
4399
- const FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration
4165
+ }
4166
+ // Using a WeakMap instead of a WeakSet because this one works in IE11 :(
4167
+ const FromIteration = new WeakMap();
4168
+ // dynamic children means it was generated by an iteration
4400
4169
  // in a template, and will require a more complex diffing algo.
4401
-
4402
4170
  function markAsDynamicChildren(children) {
4403
4171
  FromIteration.set(children, 1);
4404
4172
  }
4405
-
4406
4173
  function hasDynamicChildren(children) {
4407
4174
  return FromIteration.has(children);
4408
4175
  }
4409
-
4410
4176
  function createKeyToOldIdx(children, beginIdx, endIdx) {
4411
- const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys
4412
-
4177
+ const map = {};
4178
+ // TODO [#1637]: simplify this by assuming that all vnodes has keys
4413
4179
  for (let j = beginIdx; j <= endIdx; ++j) {
4414
4180
  const ch = children[j];
4415
-
4416
4181
  if (isVNode(ch)) {
4417
4182
  const {
4418
4183
  key
4419
4184
  } = ch;
4420
-
4421
4185
  if (key !== undefined) {
4422
4186
  map[key] = j;
4423
4187
  }
4424
4188
  }
4425
4189
  }
4426
-
4427
4190
  return map;
4428
4191
  }
4429
-
4430
4192
  function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4431
4193
  let oldStartIdx = 0;
4432
4194
  let newStartIdx = 0;
@@ -4442,7 +4204,6 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4442
4204
  let elmToMove;
4443
4205
  let before;
4444
4206
  let clonedOldCh = false;
4445
-
4446
4207
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
4447
4208
  if (!isVNode(oldStartVnode)) {
4448
4209
  oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left
@@ -4476,54 +4237,46 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4476
4237
  if (oldKeyToIdx === undefined) {
4477
4238
  oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);
4478
4239
  }
4479
-
4480
4240
  idxInOld = oldKeyToIdx[newStartVnode.key];
4481
-
4482
4241
  if (isUndefined$1(idxInOld)) {
4483
4242
  // New element
4484
4243
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4485
4244
  newStartVnode = newCh[++newStartIdx];
4486
4245
  } else {
4487
4246
  elmToMove = oldCh[idxInOld];
4488
-
4489
4247
  if (isVNode(elmToMove)) {
4490
4248
  if (elmToMove.sel !== newStartVnode.sel) {
4491
4249
  // New element
4492
4250
  mount(newStartVnode, parent, renderer, oldStartVnode.elm);
4493
4251
  } else {
4494
- patch(elmToMove, newStartVnode, parent, renderer); // Delete the old child, but copy the array since it is read-only.
4252
+ patch(elmToMove, newStartVnode, parent, renderer);
4253
+ // Delete the old child, but copy the array since it is read-only.
4495
4254
  // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,
4496
4255
  // so we only care about the `oldCh` object inside this function.
4497
4256
  // To avoid cloning over and over again, we check `clonedOldCh`
4498
4257
  // and only clone once.
4499
-
4500
4258
  if (!clonedOldCh) {
4501
4259
  clonedOldCh = true;
4502
4260
  oldCh = [...oldCh];
4503
- } // We've already cloned at least once, so it's no longer read-only
4504
-
4505
-
4261
+ }
4262
+ // We've already cloned at least once, so it's no longer read-only
4506
4263
  oldCh[idxInOld] = undefined;
4507
4264
  insertNode(elmToMove.elm, parent, oldStartVnode.elm, renderer);
4508
4265
  }
4509
4266
  }
4510
-
4511
4267
  newStartVnode = newCh[++newStartIdx];
4512
4268
  }
4513
4269
  }
4514
4270
  }
4515
-
4516
4271
  if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {
4517
4272
  if (oldStartIdx > oldEndIdx) {
4518
4273
  // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an
4519
4274
  // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.
4520
4275
  let i = newEndIdx;
4521
4276
  let n;
4522
-
4523
4277
  do {
4524
4278
  n = newCh[++i];
4525
4279
  } while (!isVNode(n) && i < newChEnd);
4526
-
4527
4280
  before = isVNode(n) ? n.elm : null;
4528
4281
  mountVNodes(newCh, parent, renderer, before, newStartIdx, newEndIdx + 1);
4529
4282
  } else {
@@ -4531,32 +4284,26 @@ function updateDynamicChildren(oldCh, newCh, parent, renderer) {
4531
4284
  }
4532
4285
  }
4533
4286
  }
4534
-
4535
4287
  function updateStaticChildren(c1, c2, parent, renderer) {
4536
4288
  const c1Length = c1.length;
4537
4289
  const c2Length = c2.length;
4538
-
4539
4290
  if (c1Length === 0) {
4540
4291
  // the old list is empty, we can directly insert anything new
4541
4292
  mountVNodes(c2, parent, renderer, null);
4542
4293
  return;
4543
4294
  }
4544
-
4545
4295
  if (c2Length === 0) {
4546
4296
  // the old list is nonempty and the new list is empty so we can directly remove all old nodes
4547
4297
  // this is the case in which the dynamic children of an if-directive should be removed
4548
4298
  unmountVNodes(c1, parent, renderer, true);
4549
4299
  return;
4550
- } // if the old list is not empty, the new list MUST have the same
4300
+ }
4301
+ // if the old list is not empty, the new list MUST have the same
4551
4302
  // amount of nodes, that's why we call this static children
4552
-
4553
-
4554
4303
  let anchor = null;
4555
-
4556
4304
  for (let i = c2Length - 1; i >= 0; i -= 1) {
4557
4305
  const n1 = c1[i];
4558
4306
  const n2 = c2[i];
4559
-
4560
4307
  if (n2 !== n1) {
4561
4308
  if (isVNode(n1)) {
4562
4309
  if (isVNode(n2)) {
@@ -5501,42 +5248,30 @@ function invokeServiceHook(vm, cbs) {
5501
5248
  */
5502
5249
  let idx = 0;
5503
5250
  /** The internal slot used to associate different objects the engine manipulates with the VM */
5504
-
5505
5251
  const ViewModelReflection = new WeakMap();
5506
-
5507
5252
  function callHook(cmp, fn, args = []) {
5508
5253
  return fn.apply(cmp, args);
5509
5254
  }
5510
-
5511
5255
  function setHook(cmp, prop, newValue) {
5512
5256
  cmp[prop] = newValue;
5513
5257
  }
5514
-
5515
5258
  function getHook(cmp, prop) {
5516
5259
  return cmp[prop];
5517
5260
  }
5518
-
5519
5261
  function rerenderVM(vm) {
5520
5262
  rehydrate(vm);
5521
5263
  }
5522
5264
  function connectRootElement(elm) {
5523
5265
  const vm = getAssociatedVM(elm);
5524
- logGlobalOperationStart(7
5525
- /* OperationId.GlobalHydrate */
5526
- , vm); // Usually means moving the element from one place to another, which is observable via
5266
+ logGlobalOperationStart(7 /* OperationId.GlobalHydrate */, vm);
5267
+ // Usually means moving the element from one place to another, which is observable via
5527
5268
  // life-cycle hooks.
5528
-
5529
- if (vm.state === 1
5530
- /* VMState.connected */
5531
- ) {
5269
+ if (vm.state === 1 /* VMState.connected */) {
5532
5270
  disconnectRootElement(elm);
5533
5271
  }
5534
-
5535
5272
  runConnectedCallback(vm);
5536
5273
  rehydrate(vm);
5537
- logGlobalOperationEnd(7
5538
- /* OperationId.GlobalHydrate */
5539
- , vm);
5274
+ logGlobalOperationEnd(7 /* OperationId.GlobalHydrate */, vm);
5540
5275
  }
5541
5276
  function disconnectRootElement(elm) {
5542
5277
  const vm = getAssociatedVM(elm);
@@ -5544,65 +5279,48 @@ function disconnectRootElement(elm) {
5544
5279
  }
5545
5280
  function appendVM(vm) {
5546
5281
  rehydrate(vm);
5547
- } // just in case the component comes back, with this we guarantee re-rendering it
5282
+ }
5283
+ // just in case the component comes back, with this we guarantee re-rendering it
5548
5284
  // while preventing any attempt to rehydration until after reinsertion.
5549
-
5550
5285
  function resetComponentStateWhenRemoved(vm) {
5551
5286
  const {
5552
5287
  state
5553
5288
  } = vm;
5554
-
5555
- if (state !== 2
5556
- /* VMState.disconnected */
5557
- ) {
5289
+ if (state !== 2 /* VMState.disconnected */) {
5558
5290
  const {
5559
5291
  oar,
5560
5292
  tro
5561
- } = vm; // Making sure that any observing record will not trigger the rehydrated on this vm
5562
-
5563
- tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked
5564
-
5293
+ } = vm;
5294
+ // Making sure that any observing record will not trigger the rehydrated on this vm
5295
+ tro.reset();
5296
+ // Making sure that any observing accessor record will not trigger the setter to be reinvoked
5565
5297
  for (const key in oar) {
5566
5298
  oar[key].reset();
5567
5299
  }
5568
-
5569
- runDisconnectedCallback(vm); // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
5570
-
5300
+ runDisconnectedCallback(vm);
5301
+ // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)
5571
5302
  runChildNodesDisconnectedCallback(vm);
5572
5303
  runLightChildNodesDisconnectedCallback(vm);
5573
5304
  }
5574
-
5575
5305
  if (process.env.NODE_ENV !== 'production') {
5576
5306
  removeActiveVM(vm);
5577
5307
  }
5578
- } // this method is triggered by the diffing algo only when a vnode from the
5308
+ }
5309
+ // this method is triggered by the diffing algo only when a vnode from the
5579
5310
  // old vnode.children is removed from the DOM.
5580
-
5581
-
5582
5311
  function removeVM(vm) {
5583
5312
  if (process.env.NODE_ENV !== 'production') {
5584
- assert.isTrue(vm.state === 1
5585
- /* VMState.connected */
5586
- || vm.state === 2
5587
- /* VMState.disconnected */
5588
- , `${vm} must have been connected.`);
5313
+ assert.isTrue(vm.state === 1 /* VMState.connected */ || vm.state === 2 /* VMState.disconnected */, `${vm} must have been connected.`);
5589
5314
  }
5590
-
5591
5315
  resetComponentStateWhenRemoved(vm);
5592
5316
  }
5593
-
5594
5317
  function getNearestShadowAncestor(vm) {
5595
5318
  let ancestor = vm.owner;
5596
-
5597
- while (!isNull(ancestor) && ancestor.renderMode === 0
5598
- /* RenderMode.Light */
5599
- ) {
5319
+ while (!isNull(ancestor) && ancestor.renderMode === 0 /* RenderMode.Light */) {
5600
5320
  ancestor = ancestor.owner;
5601
5321
  }
5602
-
5603
5322
  return ancestor;
5604
5323
  }
5605
-
5606
5324
  function createVM(elm, ctor, renderer, options) {
5607
5325
  const {
5608
5326
  mode,
@@ -5615,9 +5333,7 @@ function createVM(elm, ctor, renderer, options) {
5615
5333
  elm,
5616
5334
  def,
5617
5335
  idx: idx++,
5618
- state: 0
5619
- /* VMState.created */
5620
- ,
5336
+ state: 0 /* VMState.created */,
5621
5337
  isScheduled: false,
5622
5338
  isDirty: true,
5623
5339
  tagName,
@@ -5659,31 +5375,27 @@ function createVM(elm, ctor, renderer, options) {
5659
5375
  getHook,
5660
5376
  renderer
5661
5377
  };
5378
+ if (process.env.NODE_ENV !== 'production') {
5379
+ vm.debugInfo = create(null);
5380
+ }
5662
5381
  vm.shadowMode = computeShadowMode(vm, renderer);
5663
5382
  vm.tro = getTemplateReactiveObserver();
5664
-
5665
5383
  if (process.env.NODE_ENV !== 'production') {
5666
5384
  vm.toString = () => {
5667
5385
  return `[object:vm ${def.name} (${vm.idx})]`;
5668
5386
  };
5669
-
5670
5387
  if (lwcRuntimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {
5671
- vm.shadowMode = 0
5672
- /* ShadowMode.Native */
5673
- ;
5388
+ vm.shadowMode = 0 /* ShadowMode.Native */;
5674
5389
  }
5675
- } // Create component instance associated to the vm and the element.
5676
-
5677
-
5678
- invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed
5679
-
5390
+ }
5391
+ // Create component instance associated to the vm and the element.
5392
+ invokeComponentConstructor(vm, def.ctor);
5393
+ // Initializing the wire decorator per instance only when really needed
5680
5394
  if (hasWireAdapters(vm)) {
5681
5395
  installWireAdapters(vm);
5682
5396
  }
5683
-
5684
5397
  return vm;
5685
5398
  }
5686
-
5687
5399
  function computeShadowMode(vm, renderer) {
5688
5400
  const {
5689
5401
  def
@@ -5693,191 +5405,135 @@ function computeShadowMode(vm, renderer) {
5693
5405
  isNativeShadowDefined
5694
5406
  } = renderer;
5695
5407
  let shadowMode;
5696
-
5697
5408
  if (isSyntheticShadowDefined) {
5698
- if (def.renderMode === 0
5699
- /* RenderMode.Light */
5700
- ) {
5409
+ if (def.renderMode === 0 /* RenderMode.Light */) {
5701
5410
  // ShadowMode.Native implies "not synthetic shadow" which is consistent with how
5702
5411
  // everything defaults to native when the synthetic shadow polyfill is unavailable.
5703
- shadowMode = 0
5704
- /* ShadowMode.Native */
5705
- ;
5412
+ shadowMode = 0 /* ShadowMode.Native */;
5706
5413
  } else if (isNativeShadowDefined) {
5707
5414
  // Not combined with above condition because @lwc/features only supports identifiers in
5708
5415
  // the if-condition.
5709
5416
  if (lwcRuntimeFlags.ENABLE_MIXED_SHADOW_MODE) {
5710
- if (def.shadowSupportMode === "any"
5711
- /* ShadowSupportMode.Any */
5712
- ) {
5713
- shadowMode = 0
5714
- /* ShadowMode.Native */
5715
- ;
5417
+ if (def.shadowSupportMode === "any" /* ShadowSupportMode.Any */) {
5418
+ shadowMode = 0 /* ShadowMode.Native */;
5716
5419
  } else {
5717
5420
  const shadowAncestor = getNearestShadowAncestor(vm);
5718
-
5719
- if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0
5720
- /* ShadowMode.Native */
5721
- ) {
5421
+ if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0 /* ShadowMode.Native */) {
5722
5422
  // Transitive support for native Shadow DOM. A component in native mode
5723
5423
  // transitively opts all of its descendants into native.
5724
- shadowMode = 0
5725
- /* ShadowMode.Native */
5726
- ;
5424
+ shadowMode = 0 /* ShadowMode.Native */;
5727
5425
  } else {
5728
5426
  // Synthetic if neither this component nor any of its ancestors are configured
5729
5427
  // to be native.
5730
- shadowMode = 1
5731
- /* ShadowMode.Synthetic */
5732
- ;
5428
+ shadowMode = 1 /* ShadowMode.Synthetic */;
5733
5429
  }
5734
5430
  }
5735
5431
  } else {
5736
- shadowMode = 1
5737
- /* ShadowMode.Synthetic */
5738
- ;
5432
+ shadowMode = 1 /* ShadowMode.Synthetic */;
5739
5433
  }
5740
5434
  } else {
5741
5435
  // Synthetic if there is no native Shadow DOM support.
5742
- shadowMode = 1
5743
- /* ShadowMode.Synthetic */
5744
- ;
5436
+ shadowMode = 1 /* ShadowMode.Synthetic */;
5745
5437
  }
5746
5438
  } else {
5747
5439
  // Native if the synthetic shadow polyfill is unavailable.
5748
- shadowMode = 0
5749
- /* ShadowMode.Native */
5750
- ;
5440
+ shadowMode = 0 /* ShadowMode.Native */;
5751
5441
  }
5752
5442
 
5753
5443
  return shadowMode;
5754
5444
  }
5755
-
5756
5445
  function assertIsVM(obj) {
5757
5446
  if (isNull(obj) || !isObject(obj) || !('renderRoot' in obj)) {
5758
5447
  throw new TypeError(`${obj} is not a VM.`);
5759
5448
  }
5760
5449
  }
5761
-
5762
5450
  function associateVM(obj, vm) {
5763
5451
  ViewModelReflection.set(obj, vm);
5764
5452
  }
5765
5453
  function getAssociatedVM(obj) {
5766
5454
  const vm = ViewModelReflection.get(obj);
5767
-
5768
5455
  if (process.env.NODE_ENV !== 'production') {
5769
5456
  assertIsVM(vm);
5770
5457
  }
5771
-
5772
5458
  return vm;
5773
5459
  }
5774
5460
  function getAssociatedVMIfPresent(obj) {
5775
5461
  const maybeVm = ViewModelReflection.get(obj);
5776
-
5777
5462
  if (process.env.NODE_ENV !== 'production') {
5778
5463
  if (!isUndefined$1(maybeVm)) {
5779
5464
  assertIsVM(maybeVm);
5780
5465
  }
5781
5466
  }
5782
-
5783
5467
  return maybeVm;
5784
5468
  }
5785
-
5786
5469
  function rehydrate(vm) {
5787
5470
  if (isTrue(vm.isDirty)) {
5788
5471
  const children = renderComponent$1(vm);
5789
5472
  patchShadowRoot(vm, children);
5790
5473
  }
5791
5474
  }
5792
-
5793
5475
  function patchShadowRoot(vm, newCh) {
5794
5476
  const {
5795
5477
  renderRoot,
5796
5478
  children: oldCh,
5797
5479
  renderer
5798
- } = vm; // caching the new children collection
5799
-
5480
+ } = vm;
5481
+ // caching the new children collection
5800
5482
  vm.children = newCh;
5801
-
5802
5483
  if (newCh.length > 0 || oldCh.length > 0) {
5803
5484
  // patch function mutates vnodes by adding the element reference,
5804
5485
  // however, if patching fails it contains partial changes.
5805
5486
  if (oldCh !== newCh) {
5806
5487
  runWithBoundaryProtection(vm, vm, () => {
5807
5488
  // pre
5808
- logOperationStart(2
5809
- /* OperationId.Patch */
5810
- , vm);
5489
+ logOperationStart(2 /* OperationId.Patch */, vm);
5811
5490
  }, () => {
5812
5491
  // job
5813
5492
  patchChildren(oldCh, newCh, renderRoot, renderer);
5814
5493
  }, () => {
5815
5494
  // post
5816
- logOperationEnd(2
5817
- /* OperationId.Patch */
5818
- , vm);
5495
+ logOperationEnd(2 /* OperationId.Patch */, vm);
5819
5496
  });
5820
5497
  }
5821
5498
  }
5822
-
5823
- if (vm.state === 1
5824
- /* VMState.connected */
5825
- ) ;
5499
+ if (vm.state === 1 /* VMState.connected */) ;
5826
5500
  }
5827
5501
 
5828
5502
  function runConnectedCallback(vm) {
5829
5503
  const {
5830
5504
  state
5831
5505
  } = vm;
5832
-
5833
- if (state === 1
5834
- /* VMState.connected */
5835
- ) {
5506
+ if (state === 1 /* VMState.connected */) {
5836
5507
  return; // nothing to do since it was already connected
5837
5508
  }
5838
5509
 
5839
- vm.state = 1
5840
- /* VMState.connected */
5841
- ; // reporting connection
5842
-
5510
+ vm.state = 1 /* VMState.connected */;
5511
+ // reporting connection
5843
5512
  const {
5844
5513
  connected
5845
5514
  } = Services;
5846
-
5847
5515
  if (connected) {
5848
5516
  invokeServiceHook(vm, connected);
5849
5517
  }
5850
-
5851
5518
  if (hasWireAdapters(vm)) {
5852
5519
  connectWireAdapters(vm);
5853
5520
  }
5854
-
5855
5521
  const {
5856
5522
  connectedCallback
5857
5523
  } = vm.def;
5858
-
5859
5524
  if (!isUndefined$1(connectedCallback)) {
5860
- logOperationStart(3
5861
- /* OperationId.ConnectedCallback */
5862
- , vm);
5525
+ logOperationStart(3 /* OperationId.ConnectedCallback */, vm);
5863
5526
  invokeComponentCallback(vm, connectedCallback);
5864
- logOperationEnd(3
5865
- /* OperationId.ConnectedCallback */
5866
- , vm);
5527
+ logOperationEnd(3 /* OperationId.ConnectedCallback */, vm);
5867
5528
  }
5868
5529
  }
5869
-
5870
5530
  function hasWireAdapters(vm) {
5871
5531
  return getOwnPropertyNames$1(vm.def.wire).length > 0;
5872
5532
  }
5873
-
5874
5533
  function runDisconnectedCallback(vm) {
5875
5534
  if (process.env.NODE_ENV !== 'production') {
5876
- assert.isTrue(vm.state !== 2
5877
- /* VMState.disconnected */
5878
- , `${vm} must be inserted.`);
5535
+ assert.isTrue(vm.state !== 2 /* VMState.disconnected */, `${vm} must be inserted.`);
5879
5536
  }
5880
-
5881
5537
  if (isFalse(vm.isDirty)) {
5882
5538
  // this guarantees that if the component is reused/reinserted,
5883
5539
  // it will be re-rendered because we are disconnecting the reactivity
@@ -5885,67 +5541,54 @@ function runDisconnectedCallback(vm) {
5885
5541
  // of disconnected components.
5886
5542
  vm.isDirty = true;
5887
5543
  }
5888
-
5889
- vm.state = 2
5890
- /* VMState.disconnected */
5891
- ; // reporting disconnection
5892
-
5544
+ vm.state = 2 /* VMState.disconnected */;
5545
+ // reporting disconnection
5893
5546
  const {
5894
5547
  disconnected
5895
5548
  } = Services;
5896
-
5897
5549
  if (disconnected) {
5898
5550
  invokeServiceHook(vm, disconnected);
5899
5551
  }
5900
-
5901
5552
  if (hasWireAdapters(vm)) {
5902
5553
  disconnectWireAdapters(vm);
5903
5554
  }
5904
-
5905
5555
  const {
5906
5556
  disconnectedCallback
5907
5557
  } = vm.def;
5908
-
5909
5558
  if (!isUndefined$1(disconnectedCallback)) {
5910
- logOperationStart(5
5911
- /* OperationId.DisconnectedCallback */
5912
- , vm);
5559
+ logOperationStart(5 /* OperationId.DisconnectedCallback */, vm);
5913
5560
  invokeComponentCallback(vm, disconnectedCallback);
5914
- logOperationEnd(5
5915
- /* OperationId.DisconnectedCallback */
5916
- , vm);
5561
+ logOperationEnd(5 /* OperationId.DisconnectedCallback */, vm);
5917
5562
  }
5918
5563
  }
5919
-
5920
5564
  function runChildNodesDisconnectedCallback(vm) {
5921
5565
  const {
5922
5566
  velements: vCustomElementCollection
5923
- } = vm; // Reporting disconnection for every child in inverse order since they are
5567
+ } = vm;
5568
+ // Reporting disconnection for every child in inverse order since they are
5924
5569
  // inserted in reserved order.
5925
-
5926
5570
  for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {
5927
5571
  const {
5928
5572
  elm
5929
- } = vCustomElementCollection[i]; // There are two cases where the element could be undefined:
5573
+ } = vCustomElementCollection[i];
5574
+ // There are two cases where the element could be undefined:
5930
5575
  // * when there is an error during the construction phase, and an error
5931
5576
  // boundary picks it, there is a possibility that the VCustomElement
5932
5577
  // is not properly initialized, and therefore is should be ignored.
5933
5578
  // * when slotted custom element is not used by the element where it is
5934
5579
  // slotted into it, as a result, the custom element was never
5935
5580
  // initialized.
5936
-
5937
5581
  if (!isUndefined$1(elm)) {
5938
- const childVM = getAssociatedVMIfPresent(elm); // The VM associated with the element might be associated undefined
5582
+ const childVM = getAssociatedVMIfPresent(elm);
5583
+ // The VM associated with the element might be associated undefined
5939
5584
  // in the case where the VM failed in the middle of its creation,
5940
5585
  // eg: constructor throwing before invoking super().
5941
-
5942
5586
  if (!isUndefined$1(childVM)) {
5943
5587
  resetComponentStateWhenRemoved(childVM);
5944
5588
  }
5945
5589
  }
5946
5590
  }
5947
5591
  }
5948
-
5949
5592
  function runLightChildNodesDisconnectedCallback(vm) {
5950
5593
  const {
5951
5594
  aChildren: adoptedChildren
@@ -5959,23 +5602,15 @@ function runLightChildNodesDisconnectedCallback(vm) {
5959
5602
  * custom element itself will trigger the removal of anything slotted or anything
5960
5603
  * defined on its shadow.
5961
5604
  */
5962
-
5963
-
5964
5605
  function recursivelyDisconnectChildren(vnodes) {
5965
5606
  for (let i = 0, len = vnodes.length; i < len; i += 1) {
5966
5607
  const vnode = vnodes[i];
5967
-
5968
5608
  if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {
5969
5609
  switch (vnode.type) {
5970
- case 2
5971
- /* VNodeType.Element */
5972
- :
5610
+ case 2 /* VNodeType.Element */:
5973
5611
  recursivelyDisconnectChildren(vnode.children);
5974
5612
  break;
5975
-
5976
- case 3
5977
- /* VNodeType.CustomElement */
5978
- :
5613
+ case 3 /* VNodeType.CustomElement */:
5979
5614
  {
5980
5615
  const vm = getAssociatedVM(vnode.elm);
5981
5616
  resetComponentStateWhenRemoved(vm);
@@ -5984,12 +5619,11 @@ function recursivelyDisconnectChildren(vnodes) {
5984
5619
  }
5985
5620
  }
5986
5621
  }
5987
- } // This is a super optimized mechanism to remove the content of the root node (shadow root
5622
+ }
5623
+ // This is a super optimized mechanism to remove the content of the root node (shadow root
5988
5624
  // for shadow DOM components and the root element itself for light DOM) without having to go
5989
5625
  // into snabbdom. Especially useful when the reset is a consequence of an error, in which case the
5990
5626
  // children VNodes might not be representing the current state of the DOM.
5991
-
5992
-
5993
5627
  function resetComponentRoot(vm) {
5994
5628
  const {
5995
5629
  children,
@@ -5998,62 +5632,47 @@ function resetComponentRoot(vm) {
5998
5632
  remove
5999
5633
  }
6000
5634
  } = vm;
6001
-
6002
5635
  for (let i = 0, len = children.length; i < len; i++) {
6003
5636
  const child = children[i];
6004
-
6005
5637
  if (!isNull(child) && !isUndefined$1(child.elm)) {
6006
5638
  remove(child.elm, renderRoot);
6007
5639
  }
6008
5640
  }
6009
-
6010
5641
  vm.children = EmptyArray;
6011
5642
  runChildNodesDisconnectedCallback(vm);
6012
5643
  vm.velements = EmptyArray;
6013
5644
  }
6014
-
6015
5645
  function getErrorBoundaryVM(vm) {
6016
5646
  let currentVm = vm;
6017
-
6018
5647
  while (!isNull(currentVm)) {
6019
5648
  if (!isUndefined$1(currentVm.def.errorCallback)) {
6020
5649
  return currentVm;
6021
5650
  }
6022
-
6023
5651
  currentVm = currentVm.owner;
6024
5652
  }
6025
5653
  }
6026
-
6027
5654
  function runWithBoundaryProtection(vm, owner, pre, job, post) {
6028
5655
  let error;
6029
5656
  pre();
6030
-
6031
5657
  try {
6032
5658
  job();
6033
5659
  } catch (e) {
6034
5660
  error = Object(e);
6035
5661
  } finally {
6036
5662
  post();
6037
-
6038
5663
  if (!isUndefined$1(error)) {
6039
5664
  addErrorComponentStack(vm, error);
6040
5665
  const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);
6041
-
6042
5666
  if (isUndefined$1(errorBoundaryVm)) {
6043
5667
  throw error; // eslint-disable-line no-unsafe-finally
6044
5668
  }
6045
5669
 
6046
5670
  resetComponentRoot(vm); // remove offenders
6047
-
6048
- logOperationStart(6
6049
- /* OperationId.ErrorCallback */
6050
- , vm); // error boundaries must have an ErrorCallback
6051
-
5671
+ logOperationStart(6 /* OperationId.ErrorCallback */, vm);
5672
+ // error boundaries must have an ErrorCallback
6052
5673
  const errorCallback = errorBoundaryVm.def.errorCallback;
6053
5674
  invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);
6054
- logOperationEnd(6
6055
- /* OperationId.ErrorCallback */
6056
- , vm);
5675
+ logOperationEnd(6 /* OperationId.ErrorCallback */, vm);
6057
5676
  }
6058
5677
  }
6059
5678
  }
@@ -6066,6 +5685,7 @@ function runWithBoundaryProtection(vm, owner, pre, job, post) {
6066
5685
  */
6067
5686
  const DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';
6068
5687
  const DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';
5688
+ const WIRE_DEBUG_ENTRY = '@wire';
6069
5689
  const WireMetaMap = new Map();
6070
5690
  class WireContextRegistrationEvent extends CustomEvent {
6071
5691
  constructor(adapterToken, {
@@ -6085,15 +5705,12 @@ class WireContextRegistrationEvent extends CustomEvent {
6085
5705
  }
6086
5706
  });
6087
5707
  }
6088
-
6089
5708
  }
6090
-
6091
5709
  function createFieldDataCallback(vm, name) {
6092
5710
  return value => {
6093
5711
  updateComponentValue(vm, name, value);
6094
5712
  };
6095
5713
  }
6096
-
6097
5714
  function createMethodDataCallback(vm, method) {
6098
5715
  return value => {
6099
5716
  // dispatching new value into the wired method
@@ -6103,32 +5720,27 @@ function createMethodDataCallback(vm, method) {
6103
5720
  }, noop);
6104
5721
  };
6105
5722
  }
6106
-
6107
5723
  function createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {
6108
-
5724
+ // creating the reactive observer for reactive params when needed
6109
5725
  const ro = createReactiveObserver();
6110
-
6111
5726
  const computeConfigAndUpdate = () => {
6112
5727
  let config;
6113
- ro.observe(() => config = configCallback(component)); // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
5728
+ ro.observe(() => config = configCallback(component));
5729
+ // eslint-disable-next-line @lwc/lwc-internal/no-invalid-todo
6114
5730
  // TODO: dev-mode validation of config based on the adapter.configSchema
6115
5731
  // @ts-ignore it is assigned in the observe() callback
6116
-
6117
5732
  callbackWhenConfigIsReady(config);
6118
5733
  };
6119
-
6120
5734
  return {
6121
5735
  computeConfigAndUpdate,
6122
5736
  ro
6123
5737
  };
6124
5738
  }
6125
-
6126
5739
  function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
6127
5740
  const {
6128
5741
  adapter
6129
5742
  } = wireDef;
6130
5743
  const adapterContextToken = getAdapterToken(adapter);
6131
-
6132
5744
  if (isUndefined$1(adapterContextToken)) {
6133
5745
  return; // no provider found, nothing to be done
6134
5746
  }
@@ -6142,8 +5754,8 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
6142
5754
  renderer: {
6143
5755
  dispatchEvent
6144
5756
  }
6145
- } = vm; // waiting for the component to be connected to formally request the context via the token
6146
-
5757
+ } = vm;
5758
+ // waiting for the component to be connected to formally request the context via the token
6147
5759
  ArrayPush$1.call(wiredConnecting, () => {
6148
5760
  // This event is responsible for connecting the host element with another
6149
5761
  // element in the composed path that is providing contextual data. The provider
@@ -6156,18 +5768,15 @@ function createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {
6156
5768
  // TODO: dev-mode validation of config based on the adapter.contextSchema
6157
5769
  callbackWhenContextIsReady(newContext);
6158
5770
  },
6159
-
6160
5771
  setDisconnectedCallback(disconnectCallback) {
6161
5772
  // adds this callback into the disconnect bucket so it gets disconnected from parent
6162
5773
  // the the element hosting the wire is disconnected
6163
5774
  ArrayPush$1.call(wiredDisconnecting, disconnectCallback);
6164
5775
  }
6165
-
6166
5776
  });
6167
5777
  dispatchEvent(elm, contextRegistrationEvent);
6168
5778
  });
6169
5779
  }
6170
-
6171
5780
  function createConnector(vm, name, wireDef) {
6172
5781
  const {
6173
5782
  method,
@@ -6175,10 +5784,27 @@ function createConnector(vm, name, wireDef) {
6175
5784
  configCallback,
6176
5785
  dynamic
6177
5786
  } = wireDef;
6178
- const dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
5787
+ let debugInfo;
5788
+ if (process.env.NODE_ENV !== 'production') {
5789
+ const wiredPropOrMethod = isUndefined$1(method) ? name : method.name;
5790
+ debugInfo = create(null);
5791
+ debugInfo.wasDataProvisionedForConfig = false;
5792
+ vm.debugInfo[WIRE_DEBUG_ENTRY][wiredPropOrMethod] = debugInfo;
5793
+ }
5794
+ const fieldOrMethodCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);
5795
+ const dataCallback = value => {
5796
+ if (process.env.NODE_ENV !== 'production') {
5797
+ debugInfo.data = value;
5798
+ // Note: most of the time, the data provided is for the current config, but there may be
5799
+ // some conditions in which it does not, ex:
5800
+ // race conditions in a poor network while the adapter does not cancel a previous request.
5801
+ debugInfo.wasDataProvisionedForConfig = true;
5802
+ }
5803
+ fieldOrMethodCallback(value);
5804
+ };
6179
5805
  let context;
6180
- let connector; // Workaround to pass the component element associated to this wire adapter instance.
6181
-
5806
+ let connector;
5807
+ // Workaround to pass the component element associated to this wire adapter instance.
6182
5808
  defineProperty(dataCallback, DeprecatedWiredElementHost, {
6183
5809
  value: vm.elm
6184
5810
  });
@@ -6189,41 +5815,41 @@ function createConnector(vm, name, wireDef) {
6189
5815
  // job
6190
5816
  connector = new adapter(dataCallback);
6191
5817
  }, noop);
6192
-
6193
5818
  const updateConnectorConfig = config => {
6194
5819
  // every time the config is recomputed due to tracking,
6195
5820
  // this callback will be invoked with the new computed config
6196
5821
  runWithBoundaryProtection(vm, vm, noop, () => {
6197
5822
  // job
5823
+ if (process.env.NODE_ENV !== 'production') {
5824
+ debugInfo.config = config;
5825
+ debugInfo.context = context;
5826
+ debugInfo.wasDataProvisionedForConfig = false;
5827
+ }
6198
5828
  connector.update(config, context);
6199
5829
  }, noop);
6200
- }; // Computes the current wire config and calls the update method on the wire adapter.
5830
+ };
5831
+ // Computes the current wire config and calls the update method on the wire adapter.
6201
5832
  // If it has params, we will need to observe changes in the next tick.
6202
-
6203
-
6204
5833
  const {
6205
5834
  computeConfigAndUpdate,
6206
5835
  ro
6207
- } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig); // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
6208
-
5836
+ } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig);
5837
+ // if the adapter needs contextualization, we need to watch for new context and push it alongside the config
6209
5838
  if (!isUndefined$1(adapter.contextSchema)) {
6210
5839
  createContextWatcher(vm, wireDef, newContext => {
6211
5840
  // every time the context is pushed into this component,
6212
5841
  // this callback will be invoked with the new computed context
6213
5842
  if (context !== newContext) {
6214
- context = newContext; // Note: when new context arrives, the config will be recomputed and pushed along side the new
5843
+ context = newContext;
5844
+ // Note: when new context arrives, the config will be recomputed and pushed along side the new
6215
5845
  // context, this is to preserve the identity characteristics, config should not have identity
6216
5846
  // (ever), while context can have identity
6217
-
6218
- if (vm.state === 1
6219
- /* VMState.connected */
6220
- ) {
5847
+ if (vm.state === 1 /* VMState.connected */) {
6221
5848
  computeConfigAndUpdate();
6222
5849
  }
6223
5850
  }
6224
5851
  });
6225
5852
  }
6226
-
6227
5853
  return {
6228
5854
  // @ts-ignore the boundary protection executes sync, connector is always defined
6229
5855
  connector,
@@ -6231,7 +5857,6 @@ function createConnector(vm, name, wireDef) {
6231
5857
  resetConfigWatcher: () => ro.reset()
6232
5858
  };
6233
5859
  }
6234
-
6235
5860
  const AdapterToTokenMap = new Map();
6236
5861
  function getAdapterToken(adapter) {
6237
5862
  return AdapterToTokenMap.get(adapter);
@@ -6244,7 +5869,6 @@ function storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {
6244
5869
  if (adapter.adapter) {
6245
5870
  adapter = adapter.adapter;
6246
5871
  }
6247
-
6248
5872
  const method = descriptor.value;
6249
5873
  const def = {
6250
5874
  adapter,
@@ -6259,7 +5883,6 @@ function storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {
6259
5883
  if (adapter.adapter) {
6260
5884
  adapter = adapter.adapter;
6261
5885
  }
6262
-
6263
5886
  const def = {
6264
5887
  adapter,
6265
5888
  configCallback,
@@ -6274,17 +5897,17 @@ function installWireAdapters(vm) {
6274
5897
  wire
6275
5898
  }
6276
5899
  } = vm;
5900
+ if (process.env.NODE_ENV !== 'production') {
5901
+ vm.debugInfo[WIRE_DEBUG_ENTRY] = create(null);
5902
+ }
6277
5903
  const wiredConnecting = context.wiredConnecting = [];
6278
5904
  const wiredDisconnecting = context.wiredDisconnecting = [];
6279
-
6280
5905
  for (const fieldNameOrMethod in wire) {
6281
5906
  const descriptor = wire[fieldNameOrMethod];
6282
5907
  const wireDef = WireMetaMap.get(descriptor);
6283
-
6284
5908
  if (process.env.NODE_ENV !== 'production') {
6285
5909
  assert.invariant(wireDef, `Internal Error: invalid wire definition found.`);
6286
5910
  }
6287
-
6288
5911
  if (!isUndefined$1(wireDef)) {
6289
5912
  const {
6290
5913
  connector,
@@ -6294,14 +5917,12 @@ function installWireAdapters(vm) {
6294
5917
  const hasDynamicParams = wireDef.dynamic.length > 0;
6295
5918
  ArrayPush$1.call(wiredConnecting, () => {
6296
5919
  connector.connect();
6297
-
6298
5920
  if (!lwcRuntimeFlags.ENABLE_WIRE_SYNC_EMIT) {
6299
5921
  if (hasDynamicParams) {
6300
5922
  Promise.resolve().then(computeConfigAndUpdate);
6301
5923
  return;
6302
5924
  }
6303
5925
  }
6304
-
6305
5926
  computeConfigAndUpdate();
6306
5927
  });
6307
5928
  ArrayPush$1.call(wiredDisconnecting, () => {
@@ -6315,7 +5936,6 @@ function connectWireAdapters(vm) {
6315
5936
  const {
6316
5937
  wiredConnecting
6317
5938
  } = vm.context;
6318
-
6319
5939
  for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {
6320
5940
  wiredConnecting[i]();
6321
5941
  }
@@ -6504,7 +6124,7 @@ function freezeTemplate(tmpl) {
6504
6124
  });
6505
6125
  }
6506
6126
  }
6507
- /* version: 2.29.0 */
6127
+ /* version: 2.30.1 */
6508
6128
 
6509
6129
  /*
6510
6130
  * Copyright (c) 2020, salesforce.com, inc.
@@ -6975,7 +6595,7 @@ function renderComponent(tagName, Ctor, props = {}) {
6975
6595
  */
6976
6596
  freeze(LightningElement);
6977
6597
  seal(LightningElement.prototype);
6978
- /* version: 2.29.0 */
6598
+ /* version: 2.30.1 */
6979
6599
 
6980
6600
  exports.LightningElement = LightningElement;
6981
6601
  exports.api = api$1;