@biggive/components 202501170933.0.0 → 202501211147.0.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 (87) hide show
  1. package/dist/biggive/biggive.esm.js +1 -1
  2. package/dist/biggive/biggive.esm.js.map +1 -1
  3. package/dist/biggive/{p-f3843702.entry.js → p-08caba7b.entry.js} +2 -2
  4. package/dist/biggive/{p-972e8b70.entry.js → p-130c66ba.entry.js} +2 -2
  5. package/dist/biggive/{p-4d544ada.entry.js → p-1668ace9.entry.js} +2 -2
  6. package/dist/biggive/{p-62791aae.entry.js → p-1d9d1fb2.entry.js} +2 -2
  7. package/dist/biggive/p-22982c55.js +3 -0
  8. package/dist/biggive/p-22982c55.js.map +1 -0
  9. package/dist/biggive/{p-8c6c1385.entry.js → p-2baa279c.entry.js} +2 -2
  10. package/dist/biggive/{p-9f09fec7.entry.js → p-372349f5.entry.js} +2 -2
  11. package/dist/biggive/{p-f0b40214.entry.js → p-42a8df24.entry.js} +2 -2
  12. package/dist/biggive/{p-c964fd9f.entry.js → p-4e3802b0.entry.js} +2 -2
  13. package/dist/biggive/{p-05d6cfa4.entry.js → p-64677357.entry.js} +2 -2
  14. package/dist/biggive/{p-6684c3f7.entry.js → p-7c0358ab.entry.js} +2 -2
  15. package/dist/biggive/p-aefad0be.entry.js +2 -0
  16. package/dist/biggive/{p-257dc505.entry.js → p-c4222c1b.entry.js} +2 -2
  17. package/dist/biggive/{p-e2d84fe2.entry.js → p-d05e6bf8.entry.js} +2 -2
  18. package/dist/biggive/{p-f7a53e18.entry.js → p-d7f9d076.entry.js} +2 -2
  19. package/dist/biggive/{p-6eb68ed6.entry.js → p-f6ee342f.entry.js} +2 -2
  20. package/dist/biggive/{p-7459c28f.entry.js → p-ff8a3dc2.entry.js} +2 -2
  21. package/dist/cjs/biggive-accordion_38.cjs.entry.js +1 -1
  22. package/dist/cjs/biggive-article-card.cjs.entry.js +1 -1
  23. package/dist/cjs/biggive-basic-card.cjs.entry.js +1 -1
  24. package/dist/cjs/biggive-beneficiary-icon.cjs.entry.js +1 -1
  25. package/dist/cjs/biggive-biography-card.cjs.entry.js +1 -1
  26. package/dist/cjs/biggive-boxed-content.cjs.entry.js +1 -1
  27. package/dist/cjs/biggive-category-icon.cjs.entry.js +1 -1
  28. package/dist/cjs/biggive-container-card.cjs.entry.js +1 -1
  29. package/dist/cjs/biggive-cookie-banner.cjs.entry.js +1 -1
  30. package/dist/cjs/biggive-form.cjs.entry.js +1 -1
  31. package/dist/cjs/biggive-icon-group.cjs.entry.js +1 -1
  32. package/dist/cjs/biggive-image-card.cjs.entry.js +1 -1
  33. package/dist/cjs/biggive-nav-group.cjs.entry.js +1 -1
  34. package/dist/cjs/biggive-nav-item.cjs.entry.js +1 -1
  35. package/dist/cjs/biggive-table.cjs.entry.js +1 -1
  36. package/dist/cjs/biggive-video.cjs.entry.js +1 -1
  37. package/dist/cjs/biggive.cjs.js +2 -2
  38. package/dist/cjs/biggive.cjs.js.map +1 -1
  39. package/dist/cjs/{index-e6b3a940.js → index-c57c3e85.js} +1152 -1111
  40. package/dist/cjs/index-c57c3e85.js.map +1 -0
  41. package/dist/cjs/loader.cjs.js +1 -1
  42. package/dist/collection/collection-manifest.json +1 -1
  43. package/dist/esm/biggive-accordion_38.entry.js +1 -1
  44. package/dist/esm/biggive-article-card.entry.js +1 -1
  45. package/dist/esm/biggive-basic-card.entry.js +1 -1
  46. package/dist/esm/biggive-beneficiary-icon.entry.js +1 -1
  47. package/dist/esm/biggive-biography-card.entry.js +1 -1
  48. package/dist/esm/biggive-boxed-content.entry.js +1 -1
  49. package/dist/esm/biggive-category-icon.entry.js +1 -1
  50. package/dist/esm/biggive-container-card.entry.js +1 -1
  51. package/dist/esm/biggive-cookie-banner.entry.js +1 -1
  52. package/dist/esm/biggive-form.entry.js +1 -1
  53. package/dist/esm/biggive-icon-group.entry.js +1 -1
  54. package/dist/esm/biggive-image-card.entry.js +1 -1
  55. package/dist/esm/biggive-nav-group.entry.js +1 -1
  56. package/dist/esm/biggive-nav-item.entry.js +1 -1
  57. package/dist/esm/biggive-table.entry.js +1 -1
  58. package/dist/esm/biggive-video.entry.js +1 -1
  59. package/dist/esm/biggive.js +3 -3
  60. package/dist/esm/biggive.js.map +1 -1
  61. package/dist/esm/{index-501730c4.js → index-a7be7e08.js} +1152 -1111
  62. package/dist/esm/index-a7be7e08.js.map +1 -0
  63. package/dist/esm/loader.js +2 -2
  64. package/hydrate/index.js +1016 -984
  65. package/hydrate/index.mjs +1016 -984
  66. package/package.json +2 -2
  67. package/dist/biggive/p-14df7401.entry.js +0 -2
  68. package/dist/biggive/p-e5a29e75.js +0 -3
  69. package/dist/biggive/p-e5a29e75.js.map +0 -1
  70. package/dist/cjs/index-e6b3a940.js.map +0 -1
  71. package/dist/esm/index-501730c4.js.map +0 -1
  72. /package/dist/biggive/{p-f3843702.entry.js.map → p-08caba7b.entry.js.map} +0 -0
  73. /package/dist/biggive/{p-972e8b70.entry.js.map → p-130c66ba.entry.js.map} +0 -0
  74. /package/dist/biggive/{p-4d544ada.entry.js.map → p-1668ace9.entry.js.map} +0 -0
  75. /package/dist/biggive/{p-62791aae.entry.js.map → p-1d9d1fb2.entry.js.map} +0 -0
  76. /package/dist/biggive/{p-8c6c1385.entry.js.map → p-2baa279c.entry.js.map} +0 -0
  77. /package/dist/biggive/{p-9f09fec7.entry.js.map → p-372349f5.entry.js.map} +0 -0
  78. /package/dist/biggive/{p-f0b40214.entry.js.map → p-42a8df24.entry.js.map} +0 -0
  79. /package/dist/biggive/{p-c964fd9f.entry.js.map → p-4e3802b0.entry.js.map} +0 -0
  80. /package/dist/biggive/{p-05d6cfa4.entry.js.map → p-64677357.entry.js.map} +0 -0
  81. /package/dist/biggive/{p-6684c3f7.entry.js.map → p-7c0358ab.entry.js.map} +0 -0
  82. /package/dist/biggive/{p-14df7401.entry.js.map → p-aefad0be.entry.js.map} +0 -0
  83. /package/dist/biggive/{p-257dc505.entry.js.map → p-c4222c1b.entry.js.map} +0 -0
  84. /package/dist/biggive/{p-e2d84fe2.entry.js.map → p-d05e6bf8.entry.js.map} +0 -0
  85. /package/dist/biggive/{p-f7a53e18.entry.js.map → p-d7f9d076.entry.js.map} +0 -0
  86. /package/dist/biggive/{p-6eb68ed6.entry.js.map → p-f6ee342f.entry.js.map} +0 -0
  87. /package/dist/biggive/{p-7459c28f.entry.js.map → p-ff8a3dc2.entry.js.map} +0 -0
@@ -2,7 +2,7 @@ const NAMESPACE = 'biggive';
2
2
  const BUILD = /* biggive */ { allRenderFn: true, appendChildSlotFix: true, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: true, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: true, experimentalScopedSlotChanges: true, experimentalSlotFixes: true, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: false, scoped: false, scopedSlotTextContentFix: true, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: true, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
3
3
 
4
4
  /*
5
- Stencil Client Platform v4.23.2 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Platform v4.24.0 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  var __defProp = Object.defineProperty;
8
8
  var __export = (target, all) => {
@@ -224,20 +224,20 @@ var updateFallbackSlotVisibility = (elm) => {
224
224
  }
225
225
  }
226
226
  };
227
- var getHostSlotNodes = (childNodes, hostName, slotName) => {
227
+ function getHostSlotNodes(childNodes, hostName, slotName) {
228
228
  let i2 = 0;
229
229
  let slottedNodes = [];
230
230
  let childNode;
231
231
  for (; i2 < childNodes.length; i2++) {
232
232
  childNode = childNodes[i2];
233
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (!slotName || childNode["s-sn"] === slotName)) {
233
+ if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
234
234
  slottedNodes.push(childNode);
235
235
  if (typeof slotName !== "undefined") return slottedNodes;
236
236
  }
237
237
  slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
238
238
  }
239
239
  return slottedNodes;
240
- };
240
+ }
241
241
  var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
242
242
  const childNodes = [];
243
243
  if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
@@ -293,6 +293,125 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
293
293
  newChild["s-ol"] = slottedNodeLocation;
294
294
  newChild["s-sh"] = slotNode["s-hn"];
295
295
  };
296
+ var patchSlottedNode = (node) => {
297
+ if (!node || node.__nextSibling || !globalThis.Node) return;
298
+ patchNextSibling(node);
299
+ patchPreviousSibling(node);
300
+ patchParentNode(node);
301
+ if (node.nodeType === Node.ELEMENT_NODE) {
302
+ patchNextElementSibling(node);
303
+ patchPreviousElementSibling(node);
304
+ }
305
+ };
306
+ var patchNextSibling = (node) => {
307
+ if (!node || node.__nextSibling) return;
308
+ patchHostOriginalAccessor("nextSibling", node);
309
+ Object.defineProperty(node, "nextSibling", {
310
+ get: function() {
311
+ var _a;
312
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
313
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
314
+ if (parentNodes && index > -1) {
315
+ return parentNodes[index + 1];
316
+ }
317
+ return this.__nextSibling;
318
+ }
319
+ });
320
+ };
321
+ var patchNextElementSibling = (element) => {
322
+ if (!element || element.__nextElementSibling) return;
323
+ patchHostOriginalAccessor("nextElementSibling", element);
324
+ Object.defineProperty(element, "nextElementSibling", {
325
+ get: function() {
326
+ var _a;
327
+ const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
328
+ const index = parentEles == null ? void 0 : parentEles.indexOf(this);
329
+ if (parentEles && index > -1) {
330
+ return parentEles[index + 1];
331
+ }
332
+ return this.__nextElementSibling;
333
+ }
334
+ });
335
+ };
336
+ var patchPreviousSibling = (node) => {
337
+ if (!node || node.__previousSibling) return;
338
+ patchHostOriginalAccessor("previousSibling", node);
339
+ Object.defineProperty(node, "previousSibling", {
340
+ get: function() {
341
+ var _a;
342
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
343
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
344
+ if (parentNodes && index > -1) {
345
+ return parentNodes[index - 1];
346
+ }
347
+ return this.__previousSibling;
348
+ }
349
+ });
350
+ };
351
+ var patchPreviousElementSibling = (element) => {
352
+ if (!element || element.__previousElementSibling) return;
353
+ patchHostOriginalAccessor("previousElementSibling", element);
354
+ Object.defineProperty(element, "previousElementSibling", {
355
+ get: function() {
356
+ var _a;
357
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
358
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
359
+ if (parentNodes && index > -1) {
360
+ return parentNodes[index - 1];
361
+ }
362
+ return this.__previousElementSibling;
363
+ }
364
+ });
365
+ };
366
+ var patchParentNode = (node) => {
367
+ if (!node || node.__parentNode) return;
368
+ patchHostOriginalAccessor("parentNode", node);
369
+ Object.defineProperty(node, "parentNode", {
370
+ get: function() {
371
+ var _a;
372
+ return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
373
+ },
374
+ set: function(value) {
375
+ this.__parentNode = value;
376
+ }
377
+ });
378
+ };
379
+ var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
380
+ var validNodesPatches = [
381
+ "childNodes",
382
+ "firstChild",
383
+ "lastChild",
384
+ "nextSibling",
385
+ "previousSibling",
386
+ "textContent",
387
+ "parentNode"
388
+ ];
389
+ function patchHostOriginalAccessor(accessorName, node) {
390
+ let accessor;
391
+ if (validElementPatches.includes(accessorName)) {
392
+ accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
393
+ } else if (validNodesPatches.includes(accessorName)) {
394
+ accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
395
+ }
396
+ if (!accessor) {
397
+ accessor = Object.getOwnPropertyDescriptor(node, accessorName);
398
+ }
399
+ if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
400
+ }
401
+ var createTime = (fnName, tagName = "") => {
402
+ {
403
+ return () => {
404
+ return;
405
+ };
406
+ }
407
+ };
408
+ var uniqueTime = (key, measureText) => {
409
+ {
410
+ return () => {
411
+ return;
412
+ };
413
+ }
414
+ };
296
415
  var h = (nodeName, vnodeData, ...children) => {
297
416
  let child = null;
298
417
  let key = null;
@@ -404,1203 +523,1117 @@ var convertToPrivate = (node) => {
404
523
  vnode.$name$ = node.vname;
405
524
  return vnode;
406
525
  };
407
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
408
- if (oldValue !== newValue) {
409
- let isProp = isMemberInElement(elm, memberName);
410
- let ln = memberName.toLowerCase();
411
- if (memberName === "class") {
412
- const classList = elm.classList;
413
- const oldClasses = parseClassList(oldValue);
414
- let newClasses = parseClassList(newValue);
415
- if (elm["s-si"]) {
416
- newClasses.push(elm["s-si"]);
417
- oldClasses.forEach((c) => {
418
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
419
- });
420
- newClasses = [...new Set(newClasses)];
421
- classList.add(...newClasses);
422
- delete elm["s-si"];
423
- } else {
424
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
425
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
526
+
527
+ // src/runtime/client-hydrate.ts
528
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
529
+ const endHydrate = createTime("hydrateClient", tagName);
530
+ const shadowRoot = hostElm.shadowRoot;
531
+ const childRenderNodes = [];
532
+ const slotNodes = [];
533
+ const slottedNodes = [];
534
+ const shadowRootNodes = shadowRoot ? [] : null;
535
+ const vnode = newVNode(tagName, null);
536
+ vnode.$elm$ = hostElm;
537
+ if (!plt.$orgLocNodes$) {
538
+ initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
539
+ }
540
+ hostElm[HYDRATE_ID] = hostId;
541
+ hostElm.removeAttribute(HYDRATE_ID);
542
+ hostRef.$vnode$ = clientHydrate(
543
+ vnode,
544
+ childRenderNodes,
545
+ slotNodes,
546
+ shadowRootNodes,
547
+ hostElm,
548
+ hostElm,
549
+ hostId,
550
+ slottedNodes
551
+ );
552
+ let crIndex = 0;
553
+ const crLength = childRenderNodes.length;
554
+ let childRenderNode;
555
+ for (crIndex; crIndex < crLength; crIndex++) {
556
+ childRenderNode = childRenderNodes[crIndex];
557
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
558
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
559
+ const node = childRenderNode.$elm$;
560
+ if (!shadowRoot) {
561
+ node["s-hn"] = tagName.toUpperCase();
562
+ if (childRenderNode.$tag$ === "slot") {
563
+ node["s-cr"] = hostElm["s-cr"];
426
564
  }
427
- } else if (memberName === "style") {
428
- {
429
- for (const prop in oldValue) {
430
- if (!newValue || newValue[prop] == null) {
431
- if (prop.includes("-")) {
432
- elm.style.removeProperty(prop);
433
- } else {
434
- elm.style[prop] = "";
435
- }
436
- }
565
+ }
566
+ if (childRenderNode.$tag$ === "slot") {
567
+ if (childRenderNode.$children$) {
568
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
569
+ if (!childRenderNode.$elm$.childNodes.length) {
570
+ childRenderNode.$children$.forEach((c) => {
571
+ childRenderNode.$elm$.appendChild(c.$elm$);
572
+ });
437
573
  }
574
+ } else {
575
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
438
576
  }
439
- for (const prop in newValue) {
440
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
441
- if (prop.includes("-")) {
442
- elm.style.setProperty(prop, newValue[prop]);
443
- } else {
444
- elm.style[prop] = newValue[prop];
445
- }
446
- }
577
+ }
578
+ if (orgLocationNode && orgLocationNode.isConnected) {
579
+ if (shadowRoot && orgLocationNode["s-en"] === "") {
580
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
447
581
  }
448
- } else if (memberName === "key") ; else if (memberName === "ref") {
449
- if (newValue) {
450
- newValue(elm);
582
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
583
+ if (!shadowRoot) {
584
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
451
585
  }
452
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
453
- if (memberName[2] === "-") {
454
- memberName = memberName.slice(3);
455
- } else if (isMemberInElement(win, ln)) {
456
- memberName = ln.slice(2);
457
- } else {
458
- memberName = ln[2] + memberName.slice(3);
586
+ }
587
+ plt.$orgLocNodes$.delete(orgLocationId);
588
+ }
589
+ const hosts = [];
590
+ const snLen = slottedNodes.length;
591
+ let snIndex = 0;
592
+ let slotGroup;
593
+ let snGroupIdx;
594
+ let snGroupLen;
595
+ let slottedItem;
596
+ for (snIndex; snIndex < snLen; snIndex++) {
597
+ slotGroup = slottedNodes[snIndex];
598
+ if (!slotGroup || !slotGroup.length) continue;
599
+ snGroupLen = slotGroup.length;
600
+ snGroupIdx = 0;
601
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
602
+ slottedItem = slotGroup[snGroupIdx];
603
+ if (!hosts[slottedItem.hostId]) {
604
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
459
605
  }
460
- if (oldValue || newValue) {
461
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
462
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
463
- if (oldValue) {
464
- plt.rel(elm, memberName, oldValue, capture);
606
+ if (!hosts[slottedItem.hostId]) continue;
607
+ const hostEle = hosts[slottedItem.hostId];
608
+ if (!hostEle.shadowRoot || !shadowRoot) {
609
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
610
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
611
+ slottedItem.slot["s-cr"] = hostEle;
612
+ } else {
613
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
465
614
  }
466
- if (newValue) {
467
- plt.ael(elm, memberName, newValue, capture);
615
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
616
+ {
617
+ patchSlottedNode(slottedItem.node);
468
618
  }
469
619
  }
470
- } else {
471
- const isComplex = isComplexType(newValue);
472
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
473
- try {
474
- if (!elm.tagName.includes("-")) {
475
- const n = newValue == null ? "" : newValue;
476
- if (memberName === "list") {
477
- isProp = false;
478
- } else if (oldValue == null || elm[memberName] != n) {
479
- if (typeof elm.__lookupSetter__(memberName) === "function") {
480
- elm[memberName] = n;
481
- } else {
482
- elm.setAttribute(memberName, n);
483
- }
484
- }
485
- } else {
486
- elm[memberName] = newValue;
487
- }
488
- } catch (e) {
489
- }
490
- }
491
- if (newValue == null || newValue === false) {
492
- if (newValue !== false || elm.getAttribute(memberName) === "") {
493
- {
494
- elm.removeAttribute(memberName);
495
- }
496
- }
497
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
498
- newValue = newValue === true ? "" : newValue;
499
- {
500
- elm.setAttribute(memberName, newValue);
501
- }
502
- }
503
- }
504
- }
505
- };
506
- var parseClassListRegex = /\s/;
507
- var parseClassList = (value) => {
508
- if (typeof value === "object" && "baseVal" in value) {
509
- value = value.baseVal;
510
- }
511
- if (!value) {
512
- return [];
513
- }
514
- return value.split(parseClassListRegex);
515
- };
516
- var CAPTURE_EVENT_SUFFIX = "Capture";
517
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
518
-
519
- // src/runtime/vdom/update-element.ts
520
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
521
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
522
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
523
- const newVnodeAttrs = newVnode.$attrs$ || {};
524
- {
525
- for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
526
- if (!(memberName in newVnodeAttrs)) {
527
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
528
- }
529
- }
530
- }
531
- for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
532
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
533
- }
534
- };
535
- function sortedAttrNames(attrNames) {
536
- return attrNames.includes("ref") ? (
537
- // we need to sort these to ensure that `'ref'` is the last attr
538
- [...attrNames.filter((attr) => attr !== "ref"), "ref"]
539
- ) : (
540
- // no need to sort, return the original array
541
- attrNames
542
- );
543
- }
544
- var contentRef;
545
- var hostTagName;
546
- var useNativeShadowDom = false;
547
- var checkSlotFallbackVisibility = false;
548
- var checkSlotRelocate = false;
549
- var isSvgMode = false;
550
- var createElm = (oldParentVNode, newParentVNode, childIndex) => {
551
- var _a;
552
- const newVNode2 = newParentVNode.$children$[childIndex];
553
- let i2 = 0;
554
- let elm;
555
- let childNode;
556
- let oldVNode;
557
- if (!useNativeShadowDom) {
558
- checkSlotRelocate = true;
559
- if (newVNode2.$tag$ === "slot") {
560
- newVNode2.$flags$ |= newVNode2.$children$ ? (
561
- // slot element has fallback content
562
- // still create an element that "mocks" the slot element
563
- 2 /* isSlotFallback */
564
- ) : (
565
- // slot element does not have fallback content
566
- // create an html comment we'll use to always reference
567
- // where actual slot content should sit next to
568
- 1 /* isSlotReference */
569
- );
570
- }
571
- }
572
- if (newVNode2.$text$ !== null) {
573
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
574
- } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
575
- elm = newVNode2.$elm$ = doc.createTextNode("");
576
- } else {
577
- if (!isSvgMode) {
578
- isSvgMode = newVNode2.$tag$ === "svg";
579
- }
580
- elm = newVNode2.$elm$ = doc.createElementNS(
581
- isSvgMode ? SVG_NS : HTML_NS,
582
- !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
583
- ) ;
584
- if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
585
- isSvgMode = false;
586
- }
587
- {
588
- updateElement(null, newVNode2, isSvgMode);
589
- }
590
- if (newVNode2.$children$) {
591
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
592
- childNode = createElm(oldParentVNode, newVNode2, i2);
593
- if (childNode) {
594
- elm.appendChild(childNode);
595
- }
596
- }
597
- }
598
- {
599
- if (newVNode2.$tag$ === "svg") {
600
- isSvgMode = false;
601
- } else if (elm.tagName === "foreignObject") {
602
- isSvgMode = true;
603
- }
604
- }
605
- }
606
- elm["s-hn"] = hostTagName;
607
- {
608
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
609
- elm["s-sr"] = true;
610
- elm["s-cr"] = contentRef;
611
- elm["s-sn"] = newVNode2.$name$ || "";
612
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
613
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
614
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
615
- {
616
- relocateToHostRoot(oldParentVNode.$elm$);
617
- }
618
- }
619
- }
620
- }
621
- return elm;
622
- };
623
- var relocateToHostRoot = (parentElm) => {
624
- plt.$flags$ |= 1 /* isTmpDisconnected */;
625
- const host = parentElm.closest(hostTagName.toLowerCase());
626
- if (host != null) {
627
- const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
628
- (ref) => ref["s-cr"]
629
- );
630
- const childNodeArray = Array.from(
631
- parentElm.__childNodes || parentElm.childNodes
632
- );
633
- for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
634
- if (childNode["s-sh"] != null) {
635
- insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
636
- childNode["s-sh"] = void 0;
637
- checkSlotRelocate = true;
638
- }
639
- }
640
- }
641
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
642
- };
643
- var putBackInOriginalLocation = (parentElm, recursive) => {
644
- plt.$flags$ |= 1 /* isTmpDisconnected */;
645
- const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
646
- if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
647
- let node = parentElm;
648
- while (node = node.nextSibling) {
649
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
650
- oldSlotChildNodes.push(node);
620
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
621
+ hostEle.appendChild(slottedItem.node);
651
622
  }
652
623
  }
653
624
  }
654
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
655
- const childNode = oldSlotChildNodes[i2];
656
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
657
- insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
658
- childNode["s-ol"].remove();
659
- childNode["s-ol"] = void 0;
660
- childNode["s-sh"] = void 0;
661
- checkSlotRelocate = true;
662
- }
663
- if (recursive) {
664
- putBackInOriginalLocation(childNode, recursive);
625
+ if (shadowRoot) {
626
+ let rnIdex = 0;
627
+ const rnLen = shadowRootNodes.length;
628
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
629
+ shadowRoot.appendChild(shadowRootNodes[rnIdex]);
665
630
  }
666
- }
667
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
668
- };
669
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
670
- let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
671
- let childNode;
672
- if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
673
- containerElm = containerElm.shadowRoot;
674
- }
675
- for (; startIdx <= endIdx; ++startIdx) {
676
- if (vnodes[startIdx]) {
677
- childNode = createElm(null, parentVNode, startIdx);
678
- if (childNode) {
679
- vnodes[startIdx].$elm$ = childNode;
680
- insertBefore(containerElm, childNode, referenceNode(before) );
631
+ Array.from(hostElm.childNodes).forEach((node) => {
632
+ if (node.nodeType === 8 /* CommentNode */ && typeof node["s-sn"] !== "string") {
633
+ node.parentNode.removeChild(node);
681
634
  }
682
- }
635
+ });
683
636
  }
637
+ hostRef.$hostElement$ = hostElm;
638
+ endHydrate();
684
639
  };
685
- var removeVnodes = (vnodes, startIdx, endIdx) => {
686
- for (let index = startIdx; index <= endIdx; ++index) {
687
- const vnode = vnodes[index];
688
- if (vnode) {
689
- const elm = vnode.$elm$;
690
- nullifyVNodeRefs(vnode);
691
- if (elm) {
692
- {
693
- checkSlotFallbackVisibility = true;
694
- if (elm["s-ol"]) {
695
- elm["s-ol"].remove();
696
- } else {
697
- putBackInOriginalLocation(elm, true);
640
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
641
+ let childNodeType;
642
+ let childIdSplt;
643
+ let childVNode;
644
+ let i2;
645
+ if (node.nodeType === 1 /* ElementNode */) {
646
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
647
+ if (childNodeType) {
648
+ childIdSplt = childNodeType.split(".");
649
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
650
+ childVNode = createSimpleVNode({
651
+ $flags$: 0,
652
+ $hostId$: childIdSplt[0],
653
+ $nodeId$: childIdSplt[1],
654
+ $depth$: childIdSplt[2],
655
+ $index$: childIdSplt[3],
656
+ $tag$: node.tagName.toLowerCase(),
657
+ $elm$: node,
658
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
659
+ // won't try to reconcile them. Classes set on the node will be blown away.
660
+ $attrs$: { class: node.className || "" }
661
+ });
662
+ childRenderNodes.push(childVNode);
663
+ node.removeAttribute(HYDRATE_CHILD_ID);
664
+ if (!parentVNode.$children$) {
665
+ parentVNode.$children$ = [];
666
+ }
667
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
668
+ if (typeof slotName === "string") {
669
+ if (childVNode.$tag$ === "slot-fb") {
670
+ addSlot(
671
+ slotName,
672
+ childIdSplt[2],
673
+ childVNode,
674
+ node,
675
+ parentVNode,
676
+ childRenderNodes,
677
+ slotNodes,
678
+ shadowRootNodes,
679
+ slottedNodes
680
+ );
698
681
  }
682
+ childVNode.$elm$["s-sn"] = slotName;
683
+ childVNode.$elm$.removeAttribute("s-sn");
684
+ }
685
+ if (childVNode.$index$ !== void 0) {
686
+ parentVNode.$children$[childVNode.$index$] = childVNode;
687
+ }
688
+ parentVNode = childVNode;
689
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
690
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
699
691
  }
700
- elm.remove();
701
692
  }
702
693
  }
703
- }
704
- };
705
- var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
706
- let oldStartIdx = 0;
707
- let newStartIdx = 0;
708
- let idxInOld = 0;
709
- let i2 = 0;
710
- let oldEndIdx = oldCh.length - 1;
711
- let oldStartVnode = oldCh[0];
712
- let oldEndVnode = oldCh[oldEndIdx];
713
- let newEndIdx = newCh.length - 1;
714
- let newStartVnode = newCh[0];
715
- let newEndVnode = newCh[newEndIdx];
716
- let node;
717
- let elmToMove;
718
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
719
- if (oldStartVnode == null) {
720
- oldStartVnode = oldCh[++oldStartIdx];
721
- } else if (oldEndVnode == null) {
722
- oldEndVnode = oldCh[--oldEndIdx];
723
- } else if (newStartVnode == null) {
724
- newStartVnode = newCh[++newStartIdx];
725
- } else if (newEndVnode == null) {
726
- newEndVnode = newCh[--newEndIdx];
727
- } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
728
- patch(oldStartVnode, newStartVnode, isInitialRender);
729
- oldStartVnode = oldCh[++oldStartIdx];
730
- newStartVnode = newCh[++newStartIdx];
731
- } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
732
- patch(oldEndVnode, newEndVnode, isInitialRender);
733
- oldEndVnode = oldCh[--oldEndIdx];
734
- newEndVnode = newCh[--newEndIdx];
735
- } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
736
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
737
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
738
- }
739
- patch(oldStartVnode, newEndVnode, isInitialRender);
740
- insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
741
- oldStartVnode = oldCh[++oldStartIdx];
742
- newEndVnode = newCh[--newEndIdx];
743
- } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
744
- if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
745
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
694
+ if (node.shadowRoot) {
695
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
696
+ clientHydrate(
697
+ parentVNode,
698
+ childRenderNodes,
699
+ slotNodes,
700
+ shadowRootNodes,
701
+ hostElm,
702
+ node.shadowRoot.childNodes[i2],
703
+ hostId,
704
+ slottedNodes
705
+ );
746
706
  }
747
- patch(oldEndVnode, newStartVnode, isInitialRender);
748
- insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
749
- oldEndVnode = oldCh[--oldEndIdx];
750
- newStartVnode = newCh[++newStartIdx];
751
- } else {
752
- idxInOld = -1;
753
- {
754
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
755
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
756
- idxInOld = i2;
757
- break;
707
+ }
708
+ const nonShadowNodes = node.__childNodes || node.childNodes;
709
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
710
+ clientHydrate(
711
+ parentVNode,
712
+ childRenderNodes,
713
+ slotNodes,
714
+ shadowRootNodes,
715
+ hostElm,
716
+ nonShadowNodes[i2],
717
+ hostId,
718
+ slottedNodes
719
+ );
720
+ }
721
+ } else if (node.nodeType === 8 /* CommentNode */) {
722
+ childIdSplt = node.nodeValue.split(".");
723
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
724
+ childNodeType = childIdSplt[0];
725
+ childVNode = createSimpleVNode({
726
+ $hostId$: childIdSplt[1],
727
+ $nodeId$: childIdSplt[2],
728
+ $depth$: childIdSplt[3],
729
+ $index$: childIdSplt[4] || "0",
730
+ $elm$: node,
731
+ $attrs$: null,
732
+ $children$: null,
733
+ $key$: null,
734
+ $name$: null,
735
+ $tag$: null,
736
+ $text$: null
737
+ });
738
+ if (childNodeType === TEXT_NODE_ID) {
739
+ childVNode.$elm$ = node.nextSibling;
740
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
741
+ childVNode.$text$ = childVNode.$elm$.textContent;
742
+ childRenderNodes.push(childVNode);
743
+ node.remove();
744
+ if (hostId === childVNode.$hostId$) {
745
+ if (!parentVNode.$children$) {
746
+ parentVNode.$children$ = [];
747
+ }
748
+ parentVNode.$children$[childVNode.$index$] = childVNode;
749
+ }
750
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
751
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
758
752
  }
759
753
  }
760
- }
761
- if (idxInOld >= 0) {
762
- elmToMove = oldCh[idxInOld];
763
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
764
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
765
- } else {
766
- patch(elmToMove, newStartVnode, isInitialRender);
767
- oldCh[idxInOld] = void 0;
768
- node = elmToMove.$elm$;
754
+ } else if (childNodeType === COMMENT_NODE_ID) {
755
+ childVNode.$elm$ = node.nextSibling;
756
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
757
+ childRenderNodes.push(childVNode);
758
+ node.remove();
769
759
  }
770
- newStartVnode = newCh[++newStartIdx];
771
- } else {
772
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
773
- newStartVnode = newCh[++newStartIdx];
774
- }
775
- if (node) {
776
- {
777
- insertBefore(
778
- referenceNode(oldStartVnode.$elm$).parentNode,
760
+ } else if (childVNode.$hostId$ === hostId) {
761
+ if (childNodeType === SLOT_NODE_ID) {
762
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
763
+ addSlot(
764
+ slotName,
765
+ childIdSplt[2],
766
+ childVNode,
779
767
  node,
780
- referenceNode(oldStartVnode.$elm$)
768
+ parentVNode,
769
+ childRenderNodes,
770
+ slotNodes,
771
+ shadowRootNodes,
772
+ slottedNodes
781
773
  );
774
+ } else if (childNodeType === CONTENT_REF_ID) {
775
+ if (shadowRootNodes) {
776
+ node.remove();
777
+ } else {
778
+ hostElm["s-cr"] = node;
779
+ node["s-cn"] = true;
780
+ }
782
781
  }
783
782
  }
784
783
  }
784
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
785
+ const vnode = newVNode(null, node.textContent);
786
+ vnode.$elm$ = node;
787
+ vnode.$index$ = "0";
788
+ parentVNode.$children$ = [vnode];
785
789
  }
786
- if (oldStartIdx > oldEndIdx) {
787
- addVnodes(
788
- parentElm,
789
- newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
790
- newVNode2,
791
- newCh,
792
- newStartIdx,
793
- newEndIdx
794
- );
795
- } else if (newStartIdx > newEndIdx) {
796
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
790
+ return parentVNode;
791
+ };
792
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
793
+ if (node.nodeType === 1 /* ElementNode */) {
794
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
795
+ if (componentId) {
796
+ orgLocNodes.set(componentId, node);
797
+ }
798
+ let i2 = 0;
799
+ if (node.shadowRoot) {
800
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
801
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
802
+ }
803
+ }
804
+ const nonShadowNodes = node.__childNodes || node.childNodes;
805
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
806
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
807
+ }
808
+ } else if (node.nodeType === 8 /* CommentNode */) {
809
+ const childIdSplt = node.nodeValue.split(".");
810
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
811
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
812
+ node.nodeValue = "";
813
+ node["s-en"] = childIdSplt[3];
814
+ }
797
815
  }
798
816
  };
799
- var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
800
- if (leftVNode.$tag$ === rightVNode.$tag$) {
801
- if (leftVNode.$tag$ === "slot") {
802
- return leftVNode.$name$ === rightVNode.$name$;
817
+ var createSimpleVNode = (vnode) => {
818
+ const defaultVNode = {
819
+ $flags$: 0,
820
+ $hostId$: null,
821
+ $nodeId$: null,
822
+ $depth$: null,
823
+ $index$: "0",
824
+ $elm$: null,
825
+ $attrs$: null,
826
+ $children$: null,
827
+ $key$: null,
828
+ $name$: null,
829
+ $tag$: null,
830
+ $text$: null
831
+ };
832
+ return { ...defaultVNode, ...vnode };
833
+ };
834
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
835
+ node["s-sr"] = true;
836
+ childVNode.$name$ = slotName || null;
837
+ childVNode.$tag$ = "slot";
838
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
839
+ if (shadowRootNodes) {
840
+ const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
841
+ if (childVNode.$name$) {
842
+ childVNode.$elm$.setAttribute("name", slotName);
803
843
  }
804
- if (!isInitialRender) {
805
- return leftVNode.$key$ === rightVNode.$key$;
844
+ if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
845
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
846
+ } else {
847
+ node.parentNode.insertBefore(childVNode.$elm$, node);
806
848
  }
807
- if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
808
- leftVNode.$key$ = rightVNode.$key$;
849
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
850
+ node.remove();
851
+ if (childVNode.$depth$ === "0") {
852
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
809
853
  }
810
- return true;
854
+ } else {
855
+ const slot = childVNode.$elm$;
856
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
857
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
858
+ if (shouldMove) {
859
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
860
+ }
861
+ childRenderNodes.push(childVNode);
862
+ }
863
+ slotNodes.push(childVNode);
864
+ if (!parentVNode.$children$) {
865
+ parentVNode.$children$ = [];
866
+ }
867
+ parentVNode.$children$[childVNode.$index$] = childVNode;
868
+ }
869
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
870
+ let slottedNode = slotNode.nextSibling;
871
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
872
+ while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
873
+ slottedNode["s-sn"] = slotName;
874
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
875
+ slottedNode = slottedNode.nextSibling;
811
876
  }
812
- return false;
813
877
  };
814
- var referenceNode = (node) => node && node["s-ol"] || node;
815
- var patch = (oldVNode, newVNode2, isInitialRender = false) => {
816
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
817
- const oldChildren = oldVNode.$children$;
818
- const newChildren = newVNode2.$children$;
819
- const tag = newVNode2.$tag$;
820
- const text = newVNode2.$text$;
821
- let defaultHolder;
822
- if (text === null) {
823
- {
824
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
878
+ var parsePropertyValue = (propValue, propType) => {
879
+ if (propValue != null && !isComplexType(propValue)) {
880
+ if (propType & 4 /* Boolean */) {
881
+ return propValue === "false" ? false : propValue === "" || !!propValue;
825
882
  }
826
- {
827
- if (tag === "slot" && !useNativeShadowDom) {
828
- if (oldVNode.$name$ !== newVNode2.$name$) {
829
- newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
830
- relocateToHostRoot(newVNode2.$elm$.parentElement);
831
- }
832
- } else {
833
- updateElement(oldVNode, newVNode2, isSvgMode);
834
- }
883
+ if (propType & 2 /* Number */) {
884
+ return parseFloat(propValue);
835
885
  }
836
- if (oldChildren !== null && newChildren !== null) {
837
- updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
838
- } else if (newChildren !== null) {
839
- if (oldVNode.$text$ !== null) {
840
- elm.textContent = "";
841
- }
842
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
843
- } else if (
844
- // don't do this on initial render as it can cause non-hydrated content to be removed
845
- !isInitialRender && BUILD.updatable && oldChildren !== null
846
- ) {
847
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
886
+ if (propType & 1 /* String */) {
887
+ return String(propValue);
848
888
  }
849
- if (isSvgMode && tag === "svg") {
850
- isSvgMode = false;
889
+ return propValue;
890
+ }
891
+ return propValue;
892
+ };
893
+ var getElement = (ref) => getHostRef(ref).$hostElement$ ;
894
+
895
+ // src/runtime/event-emitter.ts
896
+ var createEvent = (ref, name, flags) => {
897
+ const elm = getElement(ref);
898
+ return {
899
+ emit: (detail) => {
900
+ return emitEvent(elm, name, {
901
+ bubbles: !!(flags & 4 /* Bubbles */),
902
+ composed: !!(flags & 2 /* Composed */),
903
+ cancelable: !!(flags & 1 /* Cancellable */),
904
+ detail
905
+ });
906
+ }
907
+ };
908
+ };
909
+ var emitEvent = (elm, name, opts) => {
910
+ const ev = plt.ce(name, opts);
911
+ elm.dispatchEvent(ev);
912
+ return ev;
913
+ };
914
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
915
+ var registerStyle = (scopeId2, cssText, allowCS) => {
916
+ let style = styles.get(scopeId2);
917
+ if (supportsConstructableStylesheets && allowCS) {
918
+ style = style || new CSSStyleSheet();
919
+ if (typeof style === "string") {
920
+ style = cssText;
921
+ } else {
922
+ style.replaceSync(cssText);
851
923
  }
852
- } else if ((defaultHolder = elm["s-cr"])) {
853
- defaultHolder.parentNode.textContent = text;
854
- } else if (oldVNode.$text$ !== text) {
855
- elm.data = text;
924
+ } else {
925
+ style = cssText;
856
926
  }
927
+ styles.set(scopeId2, style);
857
928
  };
858
- var relocateNodes = [];
859
- var markSlotContentForRelocation = (elm) => {
860
- let node;
861
- let hostContentNodes;
862
- let j;
863
- const children = elm.__childNodes || elm.childNodes;
864
- for (const childNode of children) {
865
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
866
- hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
867
- const slotName = childNode["s-sn"];
868
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
869
- node = hostContentNodes[j];
870
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
871
- if (isNodeLocatedInSlot(node, slotName)) {
872
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
873
- checkSlotFallbackVisibility = true;
874
- node["s-sn"] = node["s-sn"] || slotName;
875
- if (relocateNodeData) {
876
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
877
- relocateNodeData.$slotRefNode$ = childNode;
878
- } else {
879
- node["s-sh"] = childNode["s-hn"];
880
- relocateNodes.push({
881
- $slotRefNode$: childNode,
882
- $nodeToRelocate$: node
883
- });
884
- }
885
- if (node["s-sr"]) {
886
- relocateNodes.map((relocateNode) => {
887
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
888
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
889
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
890
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
891
- }
929
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
930
+ var _a;
931
+ const scopeId2 = getScopeId(cmpMeta);
932
+ const style = styles.get(scopeId2);
933
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
934
+ if (style) {
935
+ if (typeof style === "string") {
936
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
937
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
938
+ let styleElm;
939
+ if (!appliedStyles) {
940
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
941
+ }
942
+ if (!appliedStyles.has(scopeId2)) {
943
+ if (styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
944
+ styleElm.innerHTML = style;
945
+ } else {
946
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
947
+ styleElm.innerHTML = style;
948
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
949
+ if (nonce != null) {
950
+ styleElm.setAttribute("nonce", nonce);
951
+ }
952
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
953
+ if (styleContainerNode.nodeName === "HEAD") {
954
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
955
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
956
+ styleContainerNode.insertBefore(styleElm, referenceNode2);
957
+ } else if ("host" in styleContainerNode) {
958
+ if (supportsConstructableStylesheets) {
959
+ const stylesheet = new CSSStyleSheet();
960
+ stylesheet.replaceSync(style);
961
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
962
+ } else {
963
+ const existingStyleContainer = styleContainerNode.querySelector("style");
964
+ if (existingStyleContainer) {
965
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
966
+ } else {
967
+ styleContainerNode.prepend(styleElm);
892
968
  }
893
- });
969
+ }
970
+ } else {
971
+ styleContainerNode.append(styleElm);
894
972
  }
895
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
896
- relocateNodes.push({
897
- $nodeToRelocate$: node
898
- });
973
+ }
974
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
975
+ styleContainerNode.insertBefore(styleElm, null);
899
976
  }
900
977
  }
978
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
979
+ styleElm.innerHTML += SLOT_FB_CSS;
980
+ }
981
+ if (appliedStyles) {
982
+ appliedStyles.add(scopeId2);
983
+ }
901
984
  }
902
- }
903
- if (childNode.nodeType === 1 /* ElementNode */) {
904
- markSlotContentForRelocation(childNode);
985
+ } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
986
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
905
987
  }
906
988
  }
989
+ return scopeId2;
907
990
  };
908
- var nullifyVNodeRefs = (vNode) => {
909
- {
910
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
911
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
991
+ var attachStyles = (hostRef) => {
992
+ const cmpMeta = hostRef.$cmpMeta$;
993
+ const elm = hostRef.$hostElement$;
994
+ const flags = cmpMeta.$flags$;
995
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
996
+ const scopeId2 = addStyle(
997
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
998
+ cmpMeta);
999
+ if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
1000
+ elm["s-sc"] = scopeId2;
1001
+ elm.classList.add(scopeId2 + "-h");
912
1002
  }
1003
+ endAttachStyles();
913
1004
  };
914
- var insertBefore = (parent, newNode, reference) => {
915
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
916
- return inserted;
917
- };
918
- var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
919
- var _a, _b, _c, _d, _e;
920
- const hostElm = hostRef.$hostElement$;
921
- const cmpMeta = hostRef.$cmpMeta$;
922
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
923
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
924
- hostTagName = hostElm.tagName;
925
- if (isInitialLoad && rootVnode.$attrs$) {
926
- for (const key of Object.keys(rootVnode.$attrs$)) {
927
- if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
928
- rootVnode.$attrs$[key] = hostElm[key];
1005
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
1006
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
1007
+ if (oldValue !== newValue) {
1008
+ let isProp = isMemberInElement(elm, memberName);
1009
+ let ln = memberName.toLowerCase();
1010
+ if (memberName === "class") {
1011
+ const classList = elm.classList;
1012
+ const oldClasses = parseClassList(oldValue);
1013
+ let newClasses = parseClassList(newValue);
1014
+ if (elm["s-si"]) {
1015
+ newClasses.push(elm["s-si"]);
1016
+ oldClasses.forEach((c) => {
1017
+ if (c.startsWith(elm["s-si"])) newClasses.push(c);
1018
+ });
1019
+ newClasses = [...new Set(newClasses)];
1020
+ classList.add(...newClasses);
1021
+ delete elm["s-si"];
1022
+ } else {
1023
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
1024
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
929
1025
  }
930
- }
931
- }
932
- rootVnode.$tag$ = null;
933
- rootVnode.$flags$ |= 4 /* isHost */;
934
- hostRef.$vnode$ = rootVnode;
935
- rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
936
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
937
- {
938
- contentRef = hostElm["s-cr"];
939
- checkSlotFallbackVisibility = false;
940
- }
941
- patch(oldVNode, rootVnode, isInitialLoad);
942
- {
943
- plt.$flags$ |= 1 /* isTmpDisconnected */;
944
- if (checkSlotRelocate) {
945
- markSlotContentForRelocation(rootVnode.$elm$);
946
- for (const relocateData of relocateNodes) {
947
- const nodeToRelocate = relocateData.$nodeToRelocate$;
948
- if (!nodeToRelocate["s-ol"]) {
949
- const orgLocationNode = doc.createTextNode("");
950
- orgLocationNode["s-nr"] = nodeToRelocate;
951
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1026
+ } else if (memberName === "style") {
1027
+ {
1028
+ for (const prop in oldValue) {
1029
+ if (!newValue || newValue[prop] == null) {
1030
+ if (prop.includes("-")) {
1031
+ elm.style.removeProperty(prop);
1032
+ } else {
1033
+ elm.style[prop] = "";
1034
+ }
1035
+ }
952
1036
  }
953
1037
  }
954
- for (const relocateData of relocateNodes) {
955
- const nodeToRelocate = relocateData.$nodeToRelocate$;
956
- const slotRefNode = relocateData.$slotRefNode$;
957
- if (slotRefNode) {
958
- const parentNodeRef = slotRefNode.parentNode;
959
- let insertBeforeNode = slotRefNode.nextSibling;
960
- if ((insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
961
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
962
- while (orgLocationNode) {
963
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
964
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
965
- refNode = refNode.nextSibling;
966
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
967
- refNode = refNode == null ? void 0 : refNode.nextSibling;
968
- }
969
- if (!refNode || !refNode["s-nr"]) {
970
- insertBeforeNode = refNode;
971
- break;
972
- }
973
- }
974
- orgLocationNode = orgLocationNode.previousSibling;
975
- }
1038
+ for (const prop in newValue) {
1039
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
1040
+ if (prop.includes("-")) {
1041
+ elm.style.setProperty(prop, newValue[prop]);
1042
+ } else {
1043
+ elm.style[prop] = newValue[prop];
976
1044
  }
977
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
978
- if (nodeToRelocate !== insertBeforeNode) {
979
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
980
- if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
981
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1045
+ }
1046
+ }
1047
+ } else if (memberName === "key") ; else if (memberName === "ref") {
1048
+ if (newValue) {
1049
+ newValue(elm);
1050
+ }
1051
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
1052
+ if (memberName[2] === "-") {
1053
+ memberName = memberName.slice(3);
1054
+ } else if (isMemberInElement(win, ln)) {
1055
+ memberName = ln.slice(2);
1056
+ } else {
1057
+ memberName = ln[2] + memberName.slice(3);
1058
+ }
1059
+ if (oldValue || newValue) {
1060
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
1061
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
1062
+ if (oldValue) {
1063
+ plt.rel(elm, memberName, oldValue, capture);
1064
+ }
1065
+ if (newValue) {
1066
+ plt.ael(elm, memberName, newValue, capture);
1067
+ }
1068
+ }
1069
+ } else {
1070
+ const isComplex = isComplexType(newValue);
1071
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
1072
+ try {
1073
+ if (!elm.tagName.includes("-")) {
1074
+ const n = newValue == null ? "" : newValue;
1075
+ if (memberName === "list") {
1076
+ isProp = false;
1077
+ } else if (oldValue == null || elm[memberName] != n) {
1078
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
1079
+ elm[memberName] = n;
1080
+ } else {
1081
+ elm.setAttribute(memberName, n);
982
1082
  }
983
1083
  }
1084
+ } else if (elm[memberName] !== newValue) {
1085
+ elm[memberName] = newValue;
984
1086
  }
985
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
986
- } else {
987
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
988
- if (isInitialLoad) {
989
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
990
- }
991
- nodeToRelocate.hidden = true;
992
- }
1087
+ } catch (e) {
993
1088
  }
994
1089
  }
995
- }
996
- if (checkSlotFallbackVisibility) {
997
- updateFallbackSlotVisibility(rootVnode.$elm$);
998
- }
999
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1000
- relocateNodes.length = 0;
1001
- }
1002
- if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1003
- const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1004
- for (const childNode of children) {
1005
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
1006
- if (isInitialLoad && childNode["s-ih"] == null) {
1007
- childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
1090
+ if (newValue == null || newValue === false) {
1091
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
1092
+ {
1093
+ elm.removeAttribute(memberName);
1094
+ }
1095
+ }
1096
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
1097
+ newValue = newValue === true ? "" : newValue;
1098
+ {
1099
+ elm.setAttribute(memberName, newValue);
1008
1100
  }
1009
- childNode.hidden = true;
1010
1101
  }
1011
1102
  }
1012
1103
  }
1013
- contentRef = void 0;
1014
1104
  };
1015
- var patchNextPrev = (node) => {
1016
- if (!node || node.__nextSibling || !globalThis.Node) return;
1017
- patchNextSibling(node);
1018
- patchPreviousSibling(node);
1019
- if (node.nodeType === Node.ELEMENT_NODE) {
1020
- patchNextElementSibling(node);
1021
- patchPreviousElementSibling(node);
1105
+ var parseClassListRegex = /\s/;
1106
+ var parseClassList = (value) => {
1107
+ if (typeof value === "object" && "baseVal" in value) {
1108
+ value = value.baseVal;
1022
1109
  }
1110
+ if (!value) {
1111
+ return [];
1112
+ }
1113
+ return value.split(parseClassListRegex);
1023
1114
  };
1024
- var patchNextSibling = (node) => {
1025
- if (!node || node.__nextSibling) return;
1026
- patchHostOriginalAccessor("nextSibling", node);
1027
- Object.defineProperty(node, "nextSibling", {
1028
- get: function() {
1029
- var _a;
1030
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
1031
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1032
- if (parentNodes && index > -1) {
1033
- return parentNodes[index + 1];
1034
- }
1035
- return this.__nextSibling;
1036
- }
1037
- });
1038
- };
1039
- var patchNextElementSibling = (element) => {
1040
- if (!element || element.__nextElementSibling) return;
1041
- patchHostOriginalAccessor("nextElementSibling", element);
1042
- Object.defineProperty(element, "nextElementSibling", {
1043
- get: function() {
1044
- var _a;
1045
- const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
1046
- const index = parentEles == null ? void 0 : parentEles.indexOf(this);
1047
- if (parentEles && index > -1) {
1048
- return parentEles[index + 1];
1049
- }
1050
- return this.__nextElementSibling;
1051
- }
1052
- });
1053
- };
1054
- var patchPreviousSibling = (node) => {
1055
- if (!node || node.__previousSibling) return;
1056
- patchHostOriginalAccessor("previousSibling", node);
1057
- Object.defineProperty(node, "previousSibling", {
1058
- get: function() {
1059
- var _a;
1060
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
1061
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1062
- if (parentNodes && index > -1) {
1063
- return parentNodes[index - 1];
1064
- }
1065
- return this.__previousSibling;
1066
- }
1067
- });
1068
- };
1069
- var patchPreviousElementSibling = (element) => {
1070
- if (!element || element.__previousElementSibling) return;
1071
- patchHostOriginalAccessor("previousElementSibling", element);
1072
- Object.defineProperty(element, "previousElementSibling", {
1073
- get: function() {
1074
- var _a;
1075
- const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
1076
- const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1077
- if (parentNodes && index > -1) {
1078
- return parentNodes[index - 1];
1115
+ var CAPTURE_EVENT_SUFFIX = "Capture";
1116
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
1117
+
1118
+ // src/runtime/vdom/update-element.ts
1119
+ var updateElement = (oldVnode, newVnode, isSvgMode2) => {
1120
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
1121
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
1122
+ const newVnodeAttrs = newVnode.$attrs$ || {};
1123
+ {
1124
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
1125
+ if (!(memberName in newVnodeAttrs)) {
1126
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
1079
1127
  }
1080
- return this.__previousElementSibling;
1081
1128
  }
1082
- });
1083
- };
1084
- var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
1085
- var validNodesPatches = [
1086
- "childNodes",
1087
- "firstChild",
1088
- "lastChild",
1089
- "nextSibling",
1090
- "previousSibling",
1091
- "textContent"
1092
- ];
1093
- function patchHostOriginalAccessor(accessorName, node) {
1094
- let accessor;
1095
- if (validElementPatches.includes(accessorName)) {
1096
- accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
1097
- } else if (validNodesPatches.includes(accessorName)) {
1098
- accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
1099
- }
1100
- if (!accessor) {
1101
- accessor = Object.getOwnPropertyDescriptor(node, accessorName);
1102
- }
1103
- if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
1104
- }
1105
- var createTime = (fnName, tagName = "") => {
1106
- {
1107
- return () => {
1108
- return;
1109
- };
1110
1129
  }
1111
- };
1112
- var uniqueTime = (key, measureText) => {
1113
- {
1114
- return () => {
1115
- return;
1116
- };
1130
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
1131
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
1117
1132
  }
1118
1133
  };
1119
-
1120
- // src/runtime/client-hydrate.ts
1121
- var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1122
- const endHydrate = createTime("hydrateClient", tagName);
1123
- const shadowRoot = hostElm.shadowRoot;
1124
- const childRenderNodes = [];
1125
- const slotNodes = [];
1126
- const slottedNodes = [];
1127
- const shadowRootNodes = shadowRoot ? [] : null;
1128
- const vnode = newVNode(tagName, null);
1129
- vnode.$elm$ = hostElm;
1130
- if (!plt.$orgLocNodes$) {
1131
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1132
- }
1133
- hostElm[HYDRATE_ID] = hostId;
1134
- hostElm.removeAttribute(HYDRATE_ID);
1135
- hostRef.$vnode$ = clientHydrate(
1136
- vnode,
1137
- childRenderNodes,
1138
- slotNodes,
1139
- shadowRootNodes,
1140
- hostElm,
1141
- hostElm,
1142
- hostId,
1143
- slottedNodes
1134
+ function sortedAttrNames(attrNames) {
1135
+ return attrNames.includes("ref") ? (
1136
+ // we need to sort these to ensure that `'ref'` is the last attr
1137
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
1138
+ ) : (
1139
+ // no need to sort, return the original array
1140
+ attrNames
1144
1141
  );
1145
- let crIndex = 0;
1146
- const crLength = childRenderNodes.length;
1147
- let childRenderNode;
1148
- for (crIndex; crIndex < crLength; crIndex++) {
1149
- childRenderNode = childRenderNodes[crIndex];
1150
- const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
1151
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1152
- const node = childRenderNode.$elm$;
1153
- if (!shadowRoot) {
1154
- node["s-hn"] = tagName.toUpperCase();
1155
- if (childRenderNode.$tag$ === "slot") {
1156
- node["s-cr"] = hostElm["s-cr"];
1157
- }
1142
+ }
1143
+ var contentRef;
1144
+ var hostTagName;
1145
+ var useNativeShadowDom = false;
1146
+ var checkSlotFallbackVisibility = false;
1147
+ var checkSlotRelocate = false;
1148
+ var isSvgMode = false;
1149
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
1150
+ var _a;
1151
+ const newVNode2 = newParentVNode.$children$[childIndex];
1152
+ let i2 = 0;
1153
+ let elm;
1154
+ let childNode;
1155
+ let oldVNode;
1156
+ if (!useNativeShadowDom) {
1157
+ checkSlotRelocate = true;
1158
+ if (newVNode2.$tag$ === "slot") {
1159
+ newVNode2.$flags$ |= newVNode2.$children$ ? (
1160
+ // slot element has fallback content
1161
+ // still create an element that "mocks" the slot element
1162
+ 2 /* isSlotFallback */
1163
+ ) : (
1164
+ // slot element does not have fallback content
1165
+ // create an html comment we'll use to always reference
1166
+ // where actual slot content should sit next to
1167
+ 1 /* isSlotReference */
1168
+ );
1158
1169
  }
1159
- if (childRenderNode.$tag$ === "slot") {
1160
- if (childRenderNode.$children$) {
1161
- childRenderNode.$flags$ |= 2 /* isSlotFallback */;
1162
- if (!childRenderNode.$elm$.childNodes.length) {
1163
- childRenderNode.$children$.forEach((c) => {
1164
- childRenderNode.$elm$.appendChild(c.$elm$);
1165
- });
1170
+ }
1171
+ if (newVNode2.$text$ !== null) {
1172
+ elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
1173
+ } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
1174
+ elm = newVNode2.$elm$ = doc.createTextNode("");
1175
+ } else {
1176
+ if (!isSvgMode) {
1177
+ isSvgMode = newVNode2.$tag$ === "svg";
1178
+ }
1179
+ elm = newVNode2.$elm$ = doc.createElementNS(
1180
+ isSvgMode ? SVG_NS : HTML_NS,
1181
+ !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
1182
+ ) ;
1183
+ if (isSvgMode && newVNode2.$tag$ === "foreignObject") {
1184
+ isSvgMode = false;
1185
+ }
1186
+ {
1187
+ updateElement(null, newVNode2, isSvgMode);
1188
+ }
1189
+ if (newVNode2.$children$) {
1190
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
1191
+ childNode = createElm(oldParentVNode, newVNode2, i2);
1192
+ if (childNode) {
1193
+ elm.appendChild(childNode);
1166
1194
  }
1167
- } else {
1168
- childRenderNode.$flags$ |= 1 /* isSlotReference */;
1169
1195
  }
1170
1196
  }
1171
- if (orgLocationNode && orgLocationNode.isConnected) {
1172
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1173
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1174
- }
1175
- orgLocationNode.parentNode.removeChild(orgLocationNode);
1176
- if (!shadowRoot) {
1177
- node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1197
+ {
1198
+ if (newVNode2.$tag$ === "svg") {
1199
+ isSvgMode = false;
1200
+ } else if (elm.tagName === "foreignObject") {
1201
+ isSvgMode = true;
1178
1202
  }
1179
1203
  }
1180
- plt.$orgLocNodes$.delete(orgLocationId);
1181
1204
  }
1182
- const hosts = [];
1183
- const snLen = slottedNodes.length;
1184
- let snIndex = 0;
1185
- let slotGroup;
1186
- let snGroupIdx;
1187
- let snGroupLen;
1188
- let slottedItem;
1189
- for (snIndex; snIndex < snLen; snIndex++) {
1190
- slotGroup = slottedNodes[snIndex];
1191
- if (!slotGroup || !slotGroup.length) continue;
1192
- snGroupLen = slotGroup.length;
1193
- snGroupIdx = 0;
1194
- for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
1195
- slottedItem = slotGroup[snGroupIdx];
1196
- if (!hosts[slottedItem.hostId]) {
1197
- hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
1198
- }
1199
- if (!hosts[slottedItem.hostId]) continue;
1200
- const hostEle = hosts[slottedItem.hostId];
1201
- if (!hostEle.shadowRoot || !shadowRoot) {
1202
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1203
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1204
- slottedItem.slot["s-cr"] = hostEle;
1205
- } else {
1206
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1207
- }
1208
- addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1205
+ elm["s-hn"] = hostTagName;
1206
+ {
1207
+ if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
1208
+ elm["s-sr"] = true;
1209
+ elm["s-cr"] = contentRef;
1210
+ elm["s-sn"] = newVNode2.$name$ || "";
1211
+ elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
1212
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
1213
+ if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
1209
1214
  {
1210
- patchNextPrev(slottedItem.node);
1215
+ relocateToHostRoot(oldParentVNode.$elm$);
1211
1216
  }
1212
1217
  }
1213
- if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1214
- hostEle.appendChild(slottedItem.node);
1218
+ }
1219
+ }
1220
+ return elm;
1221
+ };
1222
+ var relocateToHostRoot = (parentElm) => {
1223
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1224
+ const host = parentElm.closest(hostTagName.toLowerCase());
1225
+ if (host != null) {
1226
+ const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
1227
+ (ref) => ref["s-cr"]
1228
+ );
1229
+ const childNodeArray = Array.from(
1230
+ parentElm.__childNodes || parentElm.childNodes
1231
+ );
1232
+ for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
1233
+ if (childNode["s-sh"] != null) {
1234
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
1235
+ childNode["s-sh"] = void 0;
1236
+ checkSlotRelocate = true;
1215
1237
  }
1216
1238
  }
1217
1239
  }
1218
- if (shadowRoot) {
1219
- let rnIdex = 0;
1220
- const rnLen = shadowRootNodes.length;
1221
- for (rnIdex; rnIdex < rnLen; rnIdex++) {
1222
- shadowRoot.appendChild(shadowRootNodes[rnIdex]);
1240
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1241
+ };
1242
+ var putBackInOriginalLocation = (parentElm, recursive) => {
1243
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1244
+ const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
1245
+ if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
1246
+ let node = parentElm;
1247
+ while (node = node.nextSibling) {
1248
+ if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
1249
+ oldSlotChildNodes.push(node);
1250
+ }
1223
1251
  }
1224
- Array.from(hostElm.childNodes).forEach((node) => {
1225
- if (node.nodeType === 8 /* CommentNode */ && typeof node["s-sn"] !== "string") {
1226
- node.parentNode.removeChild(node);
1252
+ }
1253
+ for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
1254
+ const childNode = oldSlotChildNodes[i2];
1255
+ if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
1256
+ insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
1257
+ childNode["s-ol"].remove();
1258
+ childNode["s-ol"] = void 0;
1259
+ childNode["s-sh"] = void 0;
1260
+ checkSlotRelocate = true;
1261
+ }
1262
+ if (recursive) {
1263
+ putBackInOriginalLocation(childNode, recursive);
1264
+ }
1265
+ }
1266
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1267
+ };
1268
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1269
+ let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
1270
+ let childNode;
1271
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1272
+ containerElm = containerElm.shadowRoot;
1273
+ }
1274
+ for (; startIdx <= endIdx; ++startIdx) {
1275
+ if (vnodes[startIdx]) {
1276
+ childNode = createElm(null, parentVNode, startIdx);
1277
+ if (childNode) {
1278
+ vnodes[startIdx].$elm$ = childNode;
1279
+ insertBefore(containerElm, childNode, referenceNode(before) );
1227
1280
  }
1228
- });
1281
+ }
1229
1282
  }
1230
- hostRef.$hostElement$ = hostElm;
1231
- endHydrate();
1232
1283
  };
1233
- var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
1234
- let childNodeType;
1235
- let childIdSplt;
1236
- let childVNode;
1237
- let i2;
1238
- if (node.nodeType === 1 /* ElementNode */) {
1239
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1240
- if (childNodeType) {
1241
- childIdSplt = childNodeType.split(".");
1242
- if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
1243
- childVNode = createSimpleVNode({
1244
- $flags$: 0,
1245
- $hostId$: childIdSplt[0],
1246
- $nodeId$: childIdSplt[1],
1247
- $depth$: childIdSplt[2],
1248
- $index$: childIdSplt[3],
1249
- $tag$: node.tagName.toLowerCase(),
1250
- $elm$: node,
1251
- // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
1252
- // won't try to reconcile them. Classes set on the node will be blown away.
1253
- $attrs$: { class: node.className || "" }
1254
- });
1255
- childRenderNodes.push(childVNode);
1256
- node.removeAttribute(HYDRATE_CHILD_ID);
1257
- if (!parentVNode.$children$) {
1258
- parentVNode.$children$ = [];
1259
- }
1260
- const slotName = childVNode.$elm$.getAttribute("s-sn");
1261
- if (typeof slotName === "string") {
1262
- if (childVNode.$tag$ === "slot-fb") {
1263
- addSlot(
1264
- slotName,
1265
- childIdSplt[2],
1266
- childVNode,
1267
- node,
1268
- parentVNode,
1269
- childRenderNodes,
1270
- slotNodes,
1271
- shadowRootNodes,
1272
- slottedNodes
1273
- );
1284
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
1285
+ for (let index = startIdx; index <= endIdx; ++index) {
1286
+ const vnode = vnodes[index];
1287
+ if (vnode) {
1288
+ const elm = vnode.$elm$;
1289
+ nullifyVNodeRefs(vnode);
1290
+ if (elm) {
1291
+ {
1292
+ checkSlotFallbackVisibility = true;
1293
+ if (elm["s-ol"]) {
1294
+ elm["s-ol"].remove();
1295
+ } else {
1296
+ putBackInOriginalLocation(elm, true);
1274
1297
  }
1275
- childVNode.$elm$["s-sn"] = slotName;
1276
- childVNode.$elm$.removeAttribute("s-sn");
1277
- }
1278
- if (childVNode.$index$ !== void 0) {
1279
- parentVNode.$children$[childVNode.$index$] = childVNode;
1280
- }
1281
- parentVNode = childVNode;
1282
- if (shadowRootNodes && childVNode.$depth$ === "0") {
1283
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1284
1298
  }
1299
+ elm.remove();
1285
1300
  }
1286
1301
  }
1287
- if (node.shadowRoot) {
1288
- for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
1289
- clientHydrate(
1290
- parentVNode,
1291
- childRenderNodes,
1292
- slotNodes,
1293
- shadowRootNodes,
1294
- hostElm,
1295
- node.shadowRoot.childNodes[i2],
1296
- hostId,
1297
- slottedNodes
1298
- );
1299
- }
1300
- }
1301
- const nonShadowNodes = node.__childNodes || node.childNodes;
1302
- for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
1303
- clientHydrate(
1304
- parentVNode,
1305
- childRenderNodes,
1306
- slotNodes,
1307
- shadowRootNodes,
1308
- hostElm,
1309
- nonShadowNodes[i2],
1310
- hostId,
1311
- slottedNodes
1312
- );
1313
- }
1314
- } else if (node.nodeType === 8 /* CommentNode */) {
1315
- childIdSplt = node.nodeValue.split(".");
1316
- if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
1317
- childNodeType = childIdSplt[0];
1318
- childVNode = createSimpleVNode({
1319
- $hostId$: childIdSplt[1],
1320
- $nodeId$: childIdSplt[2],
1321
- $depth$: childIdSplt[3],
1322
- $index$: childIdSplt[4] || "0",
1323
- $elm$: node,
1324
- $attrs$: null,
1325
- $children$: null,
1326
- $key$: null,
1327
- $name$: null,
1328
- $tag$: null,
1329
- $text$: null
1330
- });
1331
- if (childNodeType === TEXT_NODE_ID) {
1332
- childVNode.$elm$ = node.nextSibling;
1333
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1334
- childVNode.$text$ = childVNode.$elm$.textContent;
1335
- childRenderNodes.push(childVNode);
1336
- node.remove();
1337
- if (hostId === childVNode.$hostId$) {
1338
- if (!parentVNode.$children$) {
1339
- parentVNode.$children$ = [];
1340
- }
1341
- parentVNode.$children$[childVNode.$index$] = childVNode;
1342
- }
1343
- if (shadowRootNodes && childVNode.$depth$ === "0") {
1344
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1302
+ }
1303
+ };
1304
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
1305
+ let oldStartIdx = 0;
1306
+ let newStartIdx = 0;
1307
+ let idxInOld = 0;
1308
+ let i2 = 0;
1309
+ let oldEndIdx = oldCh.length - 1;
1310
+ let oldStartVnode = oldCh[0];
1311
+ let oldEndVnode = oldCh[oldEndIdx];
1312
+ let newEndIdx = newCh.length - 1;
1313
+ let newStartVnode = newCh[0];
1314
+ let newEndVnode = newCh[newEndIdx];
1315
+ let node;
1316
+ let elmToMove;
1317
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1318
+ if (oldStartVnode == null) {
1319
+ oldStartVnode = oldCh[++oldStartIdx];
1320
+ } else if (oldEndVnode == null) {
1321
+ oldEndVnode = oldCh[--oldEndIdx];
1322
+ } else if (newStartVnode == null) {
1323
+ newStartVnode = newCh[++newStartIdx];
1324
+ } else if (newEndVnode == null) {
1325
+ newEndVnode = newCh[--newEndIdx];
1326
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
1327
+ patch(oldStartVnode, newStartVnode, isInitialRender);
1328
+ oldStartVnode = oldCh[++oldStartIdx];
1329
+ newStartVnode = newCh[++newStartIdx];
1330
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
1331
+ patch(oldEndVnode, newEndVnode, isInitialRender);
1332
+ oldEndVnode = oldCh[--oldEndIdx];
1333
+ newEndVnode = newCh[--newEndIdx];
1334
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1335
+ if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1336
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1337
+ }
1338
+ patch(oldStartVnode, newEndVnode, isInitialRender);
1339
+ insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1340
+ oldStartVnode = oldCh[++oldStartIdx];
1341
+ newEndVnode = newCh[--newEndIdx];
1342
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1343
+ if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1344
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1345
+ }
1346
+ patch(oldEndVnode, newStartVnode, isInitialRender);
1347
+ insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1348
+ oldEndVnode = oldCh[--oldEndIdx];
1349
+ newStartVnode = newCh[++newStartIdx];
1350
+ } else {
1351
+ idxInOld = -1;
1352
+ {
1353
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1354
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1355
+ idxInOld = i2;
1356
+ break;
1345
1357
  }
1346
1358
  }
1347
- } else if (childNodeType === COMMENT_NODE_ID) {
1348
- childVNode.$elm$ = node.nextSibling;
1349
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
1350
- childRenderNodes.push(childVNode);
1351
- node.remove();
1359
+ }
1360
+ if (idxInOld >= 0) {
1361
+ elmToMove = oldCh[idxInOld];
1362
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1363
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
1364
+ } else {
1365
+ patch(elmToMove, newStartVnode, isInitialRender);
1366
+ oldCh[idxInOld] = void 0;
1367
+ node = elmToMove.$elm$;
1352
1368
  }
1353
- } else if (childVNode.$hostId$ === hostId) {
1354
- if (childNodeType === SLOT_NODE_ID) {
1355
- const slotName = node["s-sn"] = childIdSplt[5] || "";
1356
- addSlot(
1357
- slotName,
1358
- childIdSplt[2],
1359
- childVNode,
1369
+ newStartVnode = newCh[++newStartIdx];
1370
+ } else {
1371
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
1372
+ newStartVnode = newCh[++newStartIdx];
1373
+ }
1374
+ if (node) {
1375
+ {
1376
+ insertBefore(
1377
+ referenceNode(oldStartVnode.$elm$).parentNode,
1360
1378
  node,
1361
- parentVNode,
1362
- childRenderNodes,
1363
- slotNodes,
1364
- shadowRootNodes,
1365
- slottedNodes
1379
+ referenceNode(oldStartVnode.$elm$)
1366
1380
  );
1367
- } else if (childNodeType === CONTENT_REF_ID) {
1368
- if (shadowRootNodes) {
1369
- node.remove();
1370
- } else {
1371
- hostElm["s-cr"] = node;
1372
- node["s-cn"] = true;
1373
- }
1374
1381
  }
1375
1382
  }
1376
1383
  }
1377
- } else if (parentVNode && parentVNode.$tag$ === "style") {
1378
- const vnode = newVNode(null, node.textContent);
1379
- vnode.$elm$ = node;
1380
- vnode.$index$ = "0";
1381
- parentVNode.$children$ = [vnode];
1382
1384
  }
1383
- return parentVNode;
1385
+ if (oldStartIdx > oldEndIdx) {
1386
+ addVnodes(
1387
+ parentElm,
1388
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
1389
+ newVNode2,
1390
+ newCh,
1391
+ newStartIdx,
1392
+ newEndIdx
1393
+ );
1394
+ } else if (newStartIdx > newEndIdx) {
1395
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1396
+ }
1384
1397
  };
1385
- var initializeDocumentHydrate = (node, orgLocNodes) => {
1386
- if (node.nodeType === 1 /* ElementNode */) {
1387
- const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
1388
- if (componentId) {
1389
- orgLocNodes.set(componentId, node);
1390
- }
1391
- let i2 = 0;
1392
- if (node.shadowRoot) {
1393
- for (; i2 < node.shadowRoot.childNodes.length; i2++) {
1394
- initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
1395
- }
1398
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1399
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1400
+ if (leftVNode.$tag$ === "slot") {
1401
+ return leftVNode.$name$ === rightVNode.$name$;
1396
1402
  }
1397
- const nonShadowNodes = node.__childNodes || node.childNodes;
1398
- for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
1399
- initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
1403
+ if (!isInitialRender) {
1404
+ return leftVNode.$key$ === rightVNode.$key$;
1400
1405
  }
1401
- } else if (node.nodeType === 8 /* CommentNode */) {
1402
- const childIdSplt = node.nodeValue.split(".");
1403
- if (childIdSplt[0] === ORG_LOCATION_ID) {
1404
- orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
1405
- node.nodeValue = "";
1406
- node["s-en"] = childIdSplt[3];
1406
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1407
+ leftVNode.$key$ = rightVNode.$key$;
1407
1408
  }
1409
+ return true;
1408
1410
  }
1411
+ return false;
1409
1412
  };
1410
- var createSimpleVNode = (vnode) => {
1411
- const defaultVNode = {
1412
- $flags$: 0,
1413
- $hostId$: null,
1414
- $nodeId$: null,
1415
- $depth$: null,
1416
- $index$: "0",
1417
- $elm$: null,
1418
- $attrs$: null,
1419
- $children$: null,
1420
- $key$: null,
1421
- $name$: null,
1422
- $tag$: null,
1423
- $text$: null
1424
- };
1425
- return { ...defaultVNode, ...vnode };
1426
- };
1427
- function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
1428
- node["s-sr"] = true;
1429
- childVNode.$name$ = slotName || null;
1430
- childVNode.$tag$ = "slot";
1431
- const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1432
- if (shadowRootNodes) {
1433
- const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1434
- if (childVNode.$name$) {
1435
- childVNode.$elm$.setAttribute("name", slotName);
1413
+ var referenceNode = (node) => node && node["s-ol"] || node;
1414
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1415
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
1416
+ const oldChildren = oldVNode.$children$;
1417
+ const newChildren = newVNode2.$children$;
1418
+ const tag = newVNode2.$tag$;
1419
+ const text = newVNode2.$text$;
1420
+ let defaultHolder;
1421
+ if (text === null) {
1422
+ {
1423
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
1436
1424
  }
1437
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1438
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1439
- } else {
1440
- node.parentNode.insertBefore(childVNode.$elm$, node);
1425
+ {
1426
+ if (tag === "slot" && !useNativeShadowDom) {
1427
+ if (oldVNode.$name$ !== newVNode2.$name$) {
1428
+ newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1429
+ relocateToHostRoot(newVNode2.$elm$.parentElement);
1430
+ }
1431
+ } else {
1432
+ updateElement(oldVNode, newVNode2, isSvgMode);
1433
+ }
1441
1434
  }
1442
- addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1443
- node.remove();
1444
- if (childVNode.$depth$ === "0") {
1445
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1435
+ if (oldChildren !== null && newChildren !== null) {
1436
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1437
+ } else if (newChildren !== null) {
1438
+ if (oldVNode.$text$ !== null) {
1439
+ elm.textContent = "";
1440
+ }
1441
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1442
+ } else if (
1443
+ // don't do this on initial render as it can cause non-hydrated content to be removed
1444
+ !isInitialRender && BUILD.updatable && oldChildren !== null
1445
+ ) {
1446
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1447
+ }
1448
+ if (isSvgMode && tag === "svg") {
1449
+ isSvgMode = false;
1450
+ }
1451
+ } else if ((defaultHolder = elm["s-cr"])) {
1452
+ defaultHolder.parentNode.textContent = text;
1453
+ } else if (oldVNode.$text$ !== text) {
1454
+ elm.data = text;
1455
+ }
1456
+ };
1457
+ var relocateNodes = [];
1458
+ var markSlotContentForRelocation = (elm) => {
1459
+ let node;
1460
+ let hostContentNodes;
1461
+ let j;
1462
+ const children = elm.__childNodes || elm.childNodes;
1463
+ for (const childNode of children) {
1464
+ if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
1465
+ hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
1466
+ const slotName = childNode["s-sn"];
1467
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1468
+ node = hostContentNodes[j];
1469
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
1470
+ if (isNodeLocatedInSlot(node, slotName)) {
1471
+ let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1472
+ checkSlotFallbackVisibility = true;
1473
+ node["s-sn"] = node["s-sn"] || slotName;
1474
+ if (relocateNodeData) {
1475
+ relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
1476
+ relocateNodeData.$slotRefNode$ = childNode;
1477
+ } else {
1478
+ node["s-sh"] = childNode["s-hn"];
1479
+ relocateNodes.push({
1480
+ $slotRefNode$: childNode,
1481
+ $nodeToRelocate$: node
1482
+ });
1483
+ }
1484
+ if (node["s-sr"]) {
1485
+ relocateNodes.map((relocateNode) => {
1486
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
1487
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1488
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1489
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1490
+ }
1491
+ }
1492
+ });
1493
+ }
1494
+ } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1495
+ relocateNodes.push({
1496
+ $nodeToRelocate$: node
1497
+ });
1498
+ }
1499
+ }
1500
+ }
1446
1501
  }
1447
- } else {
1448
- const slot = childVNode.$elm$;
1449
- const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1450
- addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1451
- if (shouldMove) {
1452
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1502
+ if (childNode.nodeType === 1 /* ElementNode */) {
1503
+ markSlotContentForRelocation(childNode);
1453
1504
  }
1454
- childRenderNodes.push(childVNode);
1455
- }
1456
- slotNodes.push(childVNode);
1457
- if (!parentVNode.$children$) {
1458
- parentVNode.$children$ = [];
1459
- }
1460
- parentVNode.$children$[childVNode.$index$] = childVNode;
1461
- }
1462
- var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1463
- let slottedNode = slotNode.nextSibling;
1464
- slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1465
- while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
1466
- slottedNode["s-sn"] = slotName;
1467
- slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1468
- slottedNode = slottedNode.nextSibling;
1469
1505
  }
1470
1506
  };
1471
- var parsePropertyValue = (propValue, propType) => {
1472
- if (propValue != null && !isComplexType(propValue)) {
1473
- if (propType & 4 /* Boolean */) {
1474
- return propValue === "false" ? false : propValue === "" || !!propValue;
1475
- }
1476
- if (propType & 2 /* Number */) {
1477
- return parseFloat(propValue);
1478
- }
1479
- if (propType & 1 /* String */) {
1480
- return String(propValue);
1481
- }
1482
- return propValue;
1507
+ var nullifyVNodeRefs = (vNode) => {
1508
+ {
1509
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1510
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1483
1511
  }
1484
- return propValue;
1485
- };
1486
- var getElement = (ref) => getHostRef(ref).$hostElement$ ;
1487
-
1488
- // src/runtime/event-emitter.ts
1489
- var createEvent = (ref, name, flags) => {
1490
- const elm = getElement(ref);
1491
- return {
1492
- emit: (detail) => {
1493
- return emitEvent(elm, name, {
1494
- bubbles: !!(flags & 4 /* Bubbles */),
1495
- composed: !!(flags & 2 /* Composed */),
1496
- cancelable: !!(flags & 1 /* Cancellable */),
1497
- detail
1498
- });
1499
- }
1500
- };
1501
1512
  };
1502
- var emitEvent = (elm, name, opts) => {
1503
- const ev = plt.ce(name, opts);
1504
- elm.dispatchEvent(ev);
1505
- return ev;
1506
- };
1507
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1508
- var registerStyle = (scopeId2, cssText, allowCS) => {
1509
- let style = styles.get(scopeId2);
1510
- if (supportsConstructableStylesheets && allowCS) {
1511
- style = style || new CSSStyleSheet();
1512
- if (typeof style === "string") {
1513
- style = cssText;
1514
- } else {
1515
- style.replaceSync(cssText);
1513
+ var insertBefore = (parent, newNode, reference) => {
1514
+ if (typeof newNode["s-sn"] === "string") {
1515
+ if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
1516
+ patchParentNode(newNode);
1516
1517
  }
1518
+ return parent.insertBefore(newNode, reference);
1519
+ }
1520
+ if (parent.__insertBefore) {
1521
+ return parent.__insertBefore(newNode, reference);
1517
1522
  } else {
1518
- style = cssText;
1523
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
1519
1524
  }
1520
- styles.set(scopeId2, style);
1521
1525
  };
1522
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
1523
- var _a;
1524
- const scopeId2 = getScopeId(cmpMeta);
1525
- const style = styles.get(scopeId2);
1526
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
1527
- if (style) {
1528
- if (typeof style === "string") {
1529
- styleContainerNode = styleContainerNode.head || styleContainerNode;
1530
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1531
- let styleElm;
1532
- if (!appliedStyles) {
1533
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1526
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1527
+ var _a, _b, _c, _d, _e;
1528
+ const hostElm = hostRef.$hostElement$;
1529
+ const cmpMeta = hostRef.$cmpMeta$;
1530
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1531
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1532
+ hostTagName = hostElm.tagName;
1533
+ if (isInitialLoad && rootVnode.$attrs$) {
1534
+ for (const key of Object.keys(rootVnode.$attrs$)) {
1535
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
1536
+ rootVnode.$attrs$[key] = hostElm[key];
1534
1537
  }
1535
- if (!appliedStyles.has(scopeId2)) {
1536
- if (styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1537
- styleElm.innerHTML = style;
1538
- } else {
1539
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
1540
- styleElm.innerHTML = style;
1541
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1542
- if (nonce != null) {
1543
- styleElm.setAttribute("nonce", nonce);
1544
- }
1545
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1546
- if (styleContainerNode.nodeName === "HEAD") {
1547
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1548
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1549
- styleContainerNode.insertBefore(styleElm, referenceNode2);
1550
- } else if ("host" in styleContainerNode) {
1551
- if (supportsConstructableStylesheets) {
1552
- const stylesheet = new CSSStyleSheet();
1553
- stylesheet.replaceSync(style);
1554
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1555
- } else {
1556
- const existingStyleContainer = styleContainerNode.querySelector("style");
1557
- if (existingStyleContainer) {
1558
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1559
- } else {
1560
- styleContainerNode.prepend(styleElm);
1538
+ }
1539
+ }
1540
+ rootVnode.$tag$ = null;
1541
+ rootVnode.$flags$ |= 4 /* isHost */;
1542
+ hostRef.$vnode$ = rootVnode;
1543
+ rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
1544
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1545
+ {
1546
+ contentRef = hostElm["s-cr"];
1547
+ checkSlotFallbackVisibility = false;
1548
+ }
1549
+ patch(oldVNode, rootVnode, isInitialLoad);
1550
+ {
1551
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1552
+ if (checkSlotRelocate) {
1553
+ markSlotContentForRelocation(rootVnode.$elm$);
1554
+ for (const relocateData of relocateNodes) {
1555
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
1556
+ if (!nodeToRelocate["s-ol"]) {
1557
+ const orgLocationNode = doc.createTextNode("");
1558
+ orgLocationNode["s-nr"] = nodeToRelocate;
1559
+ insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1560
+ }
1561
+ }
1562
+ for (const relocateData of relocateNodes) {
1563
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
1564
+ const slotRefNode = relocateData.$slotRefNode$;
1565
+ if (slotRefNode) {
1566
+ const parentNodeRef = slotRefNode.parentNode;
1567
+ let insertBeforeNode = slotRefNode.nextSibling;
1568
+ if ((insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
1569
+ let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
1570
+ while (orgLocationNode) {
1571
+ let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
1572
+ if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
1573
+ refNode = refNode.nextSibling;
1574
+ while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
1575
+ refNode = refNode == null ? void 0 : refNode.nextSibling;
1576
+ }
1577
+ if (!refNode || !refNode["s-nr"]) {
1578
+ insertBeforeNode = refNode;
1579
+ break;
1561
1580
  }
1562
1581
  }
1563
- } else {
1564
- styleContainerNode.append(styleElm);
1582
+ orgLocationNode = orgLocationNode.previousSibling;
1565
1583
  }
1566
1584
  }
1567
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
1568
- styleContainerNode.insertBefore(styleElm, null);
1585
+ const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
1586
+ const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
1587
+ if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
1588
+ if (nodeToRelocate !== insertBeforeNode) {
1589
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1590
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1591
+ nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1592
+ }
1593
+ }
1594
+ }
1595
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
1596
+ } else {
1597
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1598
+ if (isInitialLoad) {
1599
+ nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
1600
+ }
1601
+ nodeToRelocate.hidden = true;
1569
1602
  }
1570
- }
1571
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1572
- styleElm.innerHTML += SLOT_FB_CSS;
1573
- }
1574
- if (appliedStyles) {
1575
- appliedStyles.add(scopeId2);
1576
1603
  }
1577
1604
  }
1578
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
1579
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1580
1605
  }
1606
+ if (checkSlotFallbackVisibility) {
1607
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1608
+ }
1609
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
1610
+ relocateNodes.length = 0;
1581
1611
  }
1582
- return scopeId2;
1583
- };
1584
- var attachStyles = (hostRef) => {
1585
- const cmpMeta = hostRef.$cmpMeta$;
1586
- const elm = hostRef.$hostElement$;
1587
- const flags = cmpMeta.$flags$;
1588
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1589
- const scopeId2 = addStyle(
1590
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1591
- cmpMeta);
1592
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
1593
- elm["s-sc"] = scopeId2;
1594
- elm.classList.add(scopeId2 + "-h");
1612
+ if (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1613
+ const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1614
+ for (const childNode of children) {
1615
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
1616
+ if (isInitialLoad && childNode["s-ih"] == null) {
1617
+ childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
1618
+ }
1619
+ childNode.hidden = true;
1620
+ }
1621
+ }
1595
1622
  }
1596
- endAttachStyles();
1623
+ contentRef = void 0;
1597
1624
  };
1598
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
1599
1625
 
1600
1626
  // src/runtime/update-component.ts
1601
1627
  var attachToAncestor = (hostRef, ancestorComponent) => {
1602
1628
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
1603
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
1629
+ const index = ancestorComponent["s-p"].push(
1630
+ new Promise(
1631
+ (r) => hostRef.$onRenderResolve$ = () => {
1632
+ ancestorComponent["s-p"].splice(index - 1, 1);
1633
+ r();
1634
+ }
1635
+ )
1636
+ );
1604
1637
  }
1605
1638
  };
1606
1639
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -1803,62 +1836,69 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1803
1836
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1804
1837
  members.map(([memberName, [memberFlags]]) => {
1805
1838
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1806
- if ((memberFlags & 2048 /* Getter */) === 0) {
1839
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
1840
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1841
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1842
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1807
1843
  Object.defineProperty(prototype, memberName, {
1808
1844
  get() {
1809
- return getValue(this, memberName);
1810
- },
1811
- set(newValue) {
1812
- setValue(this, memberName, newValue, cmpMeta);
1813
- },
1814
- configurable: true,
1815
- enumerable: true
1816
- });
1817
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
1818
- {
1819
- Object.defineProperty(prototype, memberName, {
1820
- get() {
1845
+ {
1846
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1847
+ return getValue(this, memberName);
1848
+ }
1821
1849
  const ref = getHostRef(this);
1822
1850
  const instance = ref ? ref.$lazyInstance$ : prototype;
1823
1851
  if (!instance) return;
1824
1852
  return instance[memberName];
1825
- },
1826
- configurable: true,
1827
- enumerable: true
1828
- });
1829
- }
1830
- if (memberFlags & 4096 /* Setter */) {
1831
- const origSetter = Object.getOwnPropertyDescriptor(prototype, memberName).set;
1832
- Object.defineProperty(prototype, memberName, {
1833
- set(newValue) {
1834
- const ref = getHostRef(this);
1835
- if (origSetter) {
1836
- const currentValue = ref.$hostElement$[memberName];
1837
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
1838
- ref.$instanceValues$.set(memberName, currentValue);
1839
- }
1840
- origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
1841
- setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
1842
- return;
1853
+ }
1854
+ },
1855
+ configurable: true,
1856
+ enumerable: true
1857
+ });
1858
+ }
1859
+ Object.defineProperty(prototype, memberName, {
1860
+ set(newValue) {
1861
+ const ref = getHostRef(this);
1862
+ if (origSetter) {
1863
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1864
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1865
+ newValue = ref.$instanceValues$.get(memberName);
1866
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
1867
+ ref.$instanceValues$.set(memberName, currentValue);
1868
+ }
1869
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
1870
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1871
+ setValue(this, memberName, newValue, cmpMeta);
1872
+ return;
1873
+ }
1874
+ {
1875
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1876
+ setValue(this, memberName, newValue, cmpMeta);
1877
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1878
+ ref.$onReadyPromise$.then(() => {
1879
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1880
+ ref.$lazyInstance$[memberName] = newValue;
1881
+ }
1882
+ });
1843
1883
  }
1844
- if (!ref) return;
1845
- const setterSetVal = () => {
1846
- const currentValue = ref.$lazyInstance$[memberName];
1847
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
1848
- ref.$instanceValues$.set(memberName, currentValue);
1849
- }
1850
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
1851
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1852
- };
1853
- if (ref.$lazyInstance$) {
1854
- setterSetVal();
1855
- } else {
1856
- ref.$onReadyPromise$.then(() => setterSetVal());
1884
+ return;
1885
+ }
1886
+ const setterSetVal = () => {
1887
+ const currentValue = ref.$lazyInstance$[memberName];
1888
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
1889
+ ref.$instanceValues$.set(memberName, currentValue);
1857
1890
  }
1891
+ ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
1892
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
1893
+ };
1894
+ if (ref.$lazyInstance$) {
1895
+ setterSetVal();
1896
+ } else {
1897
+ ref.$onReadyPromise$.then(() => setterSetVal());
1858
1898
  }
1859
- });
1899
+ }
1860
1900
  }
1861
- }
1901
+ });
1862
1902
  } else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1863
1903
  Object.defineProperty(prototype, memberName, {
1864
1904
  value(...args) {
@@ -1899,8 +1939,9 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1899
1939
  return;
1900
1940
  }
1901
1941
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
1902
- if (!propDesc.get || !!propDesc.set) {
1903
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1942
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
1943
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
1944
+ this[propName] = newValue;
1904
1945
  }
1905
1946
  });
1906
1947
  };
@@ -2199,4 +2240,4 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
2199
2240
 
2200
2241
  export { H, getAssetPath as a, bootstrapLazy as b, createEvent as c, Host as d, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
2201
2242
 
2202
- //# sourceMappingURL=index-501730c4.js.map
2243
+ //# sourceMappingURL=index-a7be7e08.js.map