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