@rindo/core 4.23.0 → 4.23.2

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.
@@ -31,7 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var platform_exports = {};
32
32
  __export(platform_exports, {
33
33
  Build: () => Build,
34
- Env: () => import_app_data21.Env,
34
+ Env: () => import_app_data22.Env,
35
35
  Fragment: () => Fragment,
36
36
  Host: () => Host,
37
37
  addHostEventListeners: () => addHostEventListeners,
@@ -43,6 +43,7 @@ __export(platform_exports, {
43
43
  consoleError: () => consoleError,
44
44
  createEvent: () => createEvent,
45
45
  defineCustomElement: () => defineCustomElement,
46
+ deleteHostRef: () => deleteHostRef,
46
47
  disconnectedCallback: () => disconnectedCallback,
47
48
  doc: () => doc,
48
49
  flushAll: () => flushAll,
@@ -117,6 +118,7 @@ var hostRefs = /* @__PURE__ */ new Map();
117
118
  var getHostRef = (elm) => {
118
119
  return hostRefs.get(elm);
119
120
  };
121
+ var deleteHostRef = (ref) => hostRefs.delete(ref);
120
122
  var registerInstance = (lazyInstance, hostRef) => {
121
123
  if (lazyInstance == null || lazyInstance.constructor == null) {
122
124
  throw new Error(`Invalid component constructor`);
@@ -380,7 +382,7 @@ var isMemberInElement = (elm, memberName) => {
380
382
  };
381
383
 
382
384
  // src/testing/platform/index.ts
383
- var import_app_data21 = require("@rindo/core/internal/app-data");
385
+ var import_app_data22 = require("@rindo/core/internal/app-data");
384
386
 
385
387
  // src/runtime/asset-path.ts
386
388
  var getAssetPath = (path) => {
@@ -390,15 +392,14 @@ var getAssetPath = (path) => {
390
392
  var setAssetPath = (path) => plt.$resourcesUrl$ = path;
391
393
 
392
394
  // src/runtime/bootstrap-custom-element.ts
393
- var import_app_data18 = require("@rindo/core/internal/app-data");
395
+ var import_app_data19 = require("@rindo/core/internal/app-data");
394
396
 
395
397
  // src/utils/constants.ts
396
- var EMPTY_OBJ = {};
397
398
  var SVG_NS = "http://www.w3.org/2000/svg";
398
399
  var HTML_NS = "http://www.w3.org/1999/xhtml";
399
400
 
400
401
  // src/utils/helpers.ts
401
- var isDef = (v) => v != null;
402
+ var isDef = (v) => v != null && v !== void 0;
402
403
  var isComplexType = (o) => {
403
404
  o = typeof o;
404
405
  return o === "object" || o === "function";
@@ -460,13 +461,13 @@ var unwrapErr = (result) => {
460
461
  };
461
462
 
462
463
  // src/runtime/connected-callback.ts
463
- var import_app_data16 = require("@rindo/core/internal/app-data");
464
+ var import_app_data17 = require("@rindo/core/internal/app-data");
464
465
 
465
466
  // src/runtime/client-hydrate.ts
466
- var import_app_data7 = require("@rindo/core/internal/app-data");
467
+ var import_app_data8 = require("@rindo/core/internal/app-data");
467
468
 
468
469
  // src/runtime/dom-extras.ts
469
- var import_app_data5 = require("@rindo/core/internal/app-data");
470
+ var import_app_data6 = require("@rindo/core/internal/app-data");
470
471
 
471
472
  // src/runtime/runtime-constants.ts
472
473
  var CONTENT_REF_ID = "r";
@@ -493,11 +494,114 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
493
494
  "formStateRestoreCallback"
494
495
  ];
495
496
 
497
+ // src/runtime/slot-polyfill-utils.ts
498
+ var import_app_data = require("@rindo/core/internal/app-data");
499
+ var updateFallbackSlotVisibility = (elm) => {
500
+ const childNodes = elm.__childNodes || elm.childNodes;
501
+ if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
502
+ getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
503
+ var _a;
504
+ if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
505
+ if ((_a = getHostSlotChildNodes(slotNode, slotNode["s-sn"], false)) == null ? void 0 : _a.length) {
506
+ slotNode.hidden = true;
507
+ } else {
508
+ slotNode.hidden = false;
509
+ }
510
+ }
511
+ });
512
+ }
513
+ for (const childNode of childNodes) {
514
+ if (childNode.nodeType === 1 /* ElementNode */ && (childNode.__childNodes || childNode.childNodes).length) {
515
+ updateFallbackSlotVisibility(childNode);
516
+ }
517
+ }
518
+ };
519
+ var getSlottedChildNodes = (childNodes) => {
520
+ const result = [];
521
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
522
+ const slottedNode = childNodes[i2]["s-nr"];
523
+ if (slottedNode && slottedNode.isConnected) {
524
+ result.push(slottedNode);
525
+ }
526
+ }
527
+ return result;
528
+ };
529
+ var getHostSlotNodes = (childNodes, hostName, slotName) => {
530
+ let i2 = 0;
531
+ let slottedNodes = [];
532
+ let childNode;
533
+ for (; i2 < childNodes.length; i2++) {
534
+ childNode = childNodes[i2];
535
+ if (childNode["s-sr"] && childNode["s-hn"] === hostName && (!slotName || childNode["s-sn"] === slotName)) {
536
+ slottedNodes.push(childNode);
537
+ if (typeof slotName !== "undefined") return slottedNodes;
538
+ }
539
+ slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
540
+ }
541
+ return slottedNodes;
542
+ };
543
+ var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
544
+ const childNodes = [];
545
+ if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
546
+ while ((node = node.nextSibling) && node["s-sn"] === slotName) {
547
+ childNodes.push(node);
548
+ }
549
+ return childNodes;
550
+ };
551
+ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
552
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
553
+ if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
554
+ return true;
555
+ }
556
+ if (nodeToRelocate.getAttribute("slot") === slotName) {
557
+ return true;
558
+ }
559
+ return false;
560
+ }
561
+ if (nodeToRelocate["s-sn"] === slotName) {
562
+ return true;
563
+ }
564
+ return slotName === "";
565
+ };
566
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
567
+ let slottedNodeLocation;
568
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
569
+ slottedNodeLocation = newChild["s-ol"];
570
+ } else {
571
+ slottedNodeLocation = document.createTextNode("");
572
+ slottedNodeLocation["s-nr"] = newChild;
573
+ }
574
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
575
+ const parent = slotNode["s-cr"].parentNode;
576
+ const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
577
+ if (typeof position !== "undefined") {
578
+ if (import_app_data.BUILD.hydrateClientSide) {
579
+ slottedNodeLocation["s-oo"] = position;
580
+ const childNodes = parent.__childNodes || parent.childNodes;
581
+ const slotRelocateNodes = [slottedNodeLocation];
582
+ childNodes.forEach((n) => {
583
+ if (n["s-nr"]) slotRelocateNodes.push(n);
584
+ });
585
+ slotRelocateNodes.sort((a, b) => {
586
+ if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
587
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
588
+ return 0;
589
+ });
590
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
591
+ }
592
+ } else {
593
+ appendMethod.call(parent, slottedNodeLocation);
594
+ }
595
+ newChild["s-ol"] = slottedNodeLocation;
596
+ newChild["s-sh"] = slotNode["s-hn"];
597
+ };
598
+ var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
599
+
496
600
  // src/runtime/vdom/vdom-render.ts
497
- var import_app_data4 = require("@rindo/core/internal/app-data");
601
+ var import_app_data5 = require("@rindo/core/internal/app-data");
498
602
 
499
603
  // src/runtime/vdom/h.ts
500
- var import_app_data = require("@rindo/core/internal/app-data");
604
+ var import_app_data2 = require("@rindo/core/internal/app-data");
501
605
  var h = (nodeName, vnodeData, ...children) => {
502
606
  let child = null;
503
607
  let key = null;
@@ -513,7 +617,7 @@ var h = (nodeName, vnodeData, ...children) => {
513
617
  } else if (child != null && typeof child !== "boolean") {
514
618
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
515
619
  child = String(child);
516
- } else if (import_app_data.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
620
+ } else if (import_app_data2.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
517
621
  consoleDevError(`vNode passed as children has unexpected type.
518
622
  Make sure it's using the correct h() function.
519
623
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -529,28 +633,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
529
633
  };
530
634
  walk(children);
531
635
  if (vnodeData) {
532
- if (import_app_data.BUILD.isDev && nodeName === "input") {
636
+ if (import_app_data2.BUILD.isDev && nodeName === "input") {
533
637
  validateInputProperties(vnodeData);
534
638
  }
535
- if (import_app_data.BUILD.vdomKey && vnodeData.key) {
639
+ if (import_app_data2.BUILD.vdomKey && vnodeData.key) {
536
640
  key = vnodeData.key;
537
641
  }
538
- if (import_app_data.BUILD.slotRelocation && vnodeData.name) {
642
+ if (import_app_data2.BUILD.slotRelocation && vnodeData.name) {
539
643
  slotName = vnodeData.name;
540
644
  }
541
- if (import_app_data.BUILD.vdomClass) {
645
+ if (import_app_data2.BUILD.vdomClass) {
542
646
  const classData = vnodeData.className || vnodeData.class;
543
647
  if (classData) {
544
648
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
545
649
  }
546
650
  }
547
651
  }
548
- if (import_app_data.BUILD.isDev && vNodeChildren.some(isHost)) {
652
+ if (import_app_data2.BUILD.isDev && vNodeChildren.some(isHost)) {
549
653
  consoleDevError(`The <Host> must be the single root component. Make sure:
550
654
  - You are NOT using hostData() and <Host> in the same component.
551
655
  - <Host> is used once, and it's the single root component of the render() function.`);
552
656
  }
553
- if (import_app_data.BUILD.vdomFunctional && typeof nodeName === "function") {
657
+ if (import_app_data2.BUILD.vdomFunctional && typeof nodeName === "function") {
554
658
  return nodeName(
555
659
  vnodeData === null ? {} : vnodeData,
556
660
  vNodeChildren,
@@ -562,10 +666,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
562
666
  if (vNodeChildren.length > 0) {
563
667
  vnode.$children$ = vNodeChildren;
564
668
  }
565
- if (import_app_data.BUILD.vdomKey) {
669
+ if (import_app_data2.BUILD.vdomKey) {
566
670
  vnode.$key$ = key;
567
671
  }
568
- if (import_app_data.BUILD.slotRelocation) {
672
+ if (import_app_data2.BUILD.slotRelocation) {
569
673
  vnode.$name$ = slotName;
570
674
  }
571
675
  return vnode;
@@ -578,13 +682,13 @@ var newVNode = (tag, text) => {
578
682
  $elm$: null,
579
683
  $children$: null
580
684
  };
581
- if (import_app_data.BUILD.vdomAttribute) {
685
+ if (import_app_data2.BUILD.vdomAttribute) {
582
686
  vnode.$attrs$ = null;
583
687
  }
584
- if (import_app_data.BUILD.vdomKey) {
688
+ if (import_app_data2.BUILD.vdomKey) {
585
689
  vnode.$key$ = null;
586
690
  }
587
- if (import_app_data.BUILD.slotRelocation) {
691
+ if (import_app_data2.BUILD.slotRelocation) {
588
692
  vnode.$name$ = null;
589
693
  }
590
694
  return vnode;
@@ -637,28 +741,35 @@ var validateInputProperties = (inputElm) => {
637
741
  };
638
742
 
639
743
  // src/runtime/vdom/update-element.ts
640
- var import_app_data3 = require("@rindo/core/internal/app-data");
744
+ var import_app_data4 = require("@rindo/core/internal/app-data");
641
745
 
642
746
  // src/runtime/vdom/set-accessor.ts
643
- var import_app_data2 = require("@rindo/core/internal/app-data");
747
+ var import_app_data3 = require("@rindo/core/internal/app-data");
644
748
  var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
645
749
  if (oldValue !== newValue) {
646
750
  let isProp = isMemberInElement(elm, memberName);
647
751
  let ln = memberName.toLowerCase();
648
- if (import_app_data2.BUILD.vdomClass && memberName === "class") {
752
+ if (import_app_data3.BUILD.vdomClass && memberName === "class") {
649
753
  const classList = elm.classList;
650
754
  const oldClasses = parseClassList(oldValue);
651
- const newClasses = parseClassList(newValue);
652
- if (elm["s-si"] && newClasses.indexOf(elm["s-si"]) < 0) {
755
+ let newClasses = parseClassList(newValue);
756
+ if (elm["s-si"]) {
653
757
  newClasses.push(elm["s-si"]);
758
+ oldClasses.forEach((c) => {
759
+ if (c.startsWith(elm["s-si"])) newClasses.push(c);
760
+ });
761
+ newClasses = [...new Set(newClasses)];
762
+ classList.add(...newClasses);
763
+ delete elm["s-si"];
764
+ } else {
765
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
766
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
654
767
  }
655
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
656
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
657
- } else if (import_app_data2.BUILD.vdomStyle && memberName === "style") {
658
- if (import_app_data2.BUILD.updatable) {
768
+ } else if (import_app_data3.BUILD.vdomStyle && memberName === "style") {
769
+ if (import_app_data3.BUILD.updatable) {
659
770
  for (const prop in oldValue) {
660
771
  if (!newValue || newValue[prop] == null) {
661
- if (!import_app_data2.BUILD.hydrateServerSide && prop.includes("-")) {
772
+ if (!import_app_data3.BUILD.hydrateServerSide && prop.includes("-")) {
662
773
  elm.style.removeProperty(prop);
663
774
  } else {
664
775
  elm.style[prop] = "";
@@ -668,19 +779,19 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
668
779
  }
669
780
  for (const prop in newValue) {
670
781
  if (!oldValue || newValue[prop] !== oldValue[prop]) {
671
- if (!import_app_data2.BUILD.hydrateServerSide && prop.includes("-")) {
782
+ if (!import_app_data3.BUILD.hydrateServerSide && prop.includes("-")) {
672
783
  elm.style.setProperty(prop, newValue[prop]);
673
784
  } else {
674
785
  elm.style[prop] = newValue[prop];
675
786
  }
676
787
  }
677
788
  }
678
- } else if (import_app_data2.BUILD.vdomKey && memberName === "key") {
679
- } else if (import_app_data2.BUILD.vdomRef && memberName === "ref") {
789
+ } else if (import_app_data3.BUILD.vdomKey && memberName === "key") {
790
+ } else if (import_app_data3.BUILD.vdomRef && memberName === "ref") {
680
791
  if (newValue) {
681
792
  newValue(elm);
682
793
  }
683
- } else if (import_app_data2.BUILD.vdomListener && (import_app_data2.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
794
+ } else if (import_app_data3.BUILD.vdomListener && (import_app_data3.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
684
795
  if (memberName[2] === "-") {
685
796
  memberName = memberName.slice(3);
686
797
  } else if (isMemberInElement(win, ln)) {
@@ -698,7 +809,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
698
809
  plt.ael(elm, memberName, newValue, capture);
699
810
  }
700
811
  }
701
- } else if (import_app_data2.BUILD.vdomPropOrAttr) {
812
+ } else if (import_app_data3.BUILD.vdomPropOrAttr) {
702
813
  const isComplex = isComplexType(newValue);
703
814
  if ((isProp || isComplex && newValue !== null) && !isSvg) {
704
815
  try {
@@ -720,7 +831,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
720
831
  }
721
832
  }
722
833
  let xlink = false;
723
- if (import_app_data2.BUILD.vdomXlink) {
834
+ if (import_app_data3.BUILD.vdomXlink) {
724
835
  if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
725
836
  memberName = ln;
726
837
  xlink = true;
@@ -728,7 +839,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
728
839
  }
729
840
  if (newValue == null || newValue === false) {
730
841
  if (newValue !== false || elm.getAttribute(memberName) === "") {
731
- if (import_app_data2.BUILD.vdomXlink && xlink) {
842
+ if (import_app_data3.BUILD.vdomXlink && xlink) {
732
843
  elm.removeAttributeNS(XLINK_NS, memberName);
733
844
  } else {
734
845
  elm.removeAttribute(memberName);
@@ -736,7 +847,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
736
847
  }
737
848
  } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
738
849
  newValue = newValue === true ? "" : newValue;
739
- if (import_app_data2.BUILD.vdomXlink && xlink) {
850
+ if (import_app_data3.BUILD.vdomXlink && xlink) {
740
851
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
741
852
  } else {
742
853
  elm.setAttribute(memberName, newValue);
@@ -746,16 +857,24 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
746
857
  }
747
858
  };
748
859
  var parseClassListRegex = /\s/;
749
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
860
+ var parseClassList = (value) => {
861
+ if (typeof value === "object" && "baseVal" in value) {
862
+ value = value.baseVal;
863
+ }
864
+ if (!value) {
865
+ return [];
866
+ }
867
+ return value.split(parseClassListRegex);
868
+ };
750
869
  var CAPTURE_EVENT_SUFFIX = "Capture";
751
870
  var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
752
871
 
753
872
  // src/runtime/vdom/update-element.ts
754
873
  var updateElement = (oldVnode, newVnode, isSvgMode2) => {
755
874
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
756
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
757
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
758
- if (import_app_data3.BUILD.updatable) {
875
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
876
+ const newVnodeAttrs = newVnode.$attrs$ || {};
877
+ if (import_app_data4.BUILD.updatable) {
759
878
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
760
879
  if (!(memberName in newVnodeAttrs)) {
761
880
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
@@ -784,19 +903,16 @@ var useNativeShadowDom = false;
784
903
  var checkSlotFallbackVisibility = false;
785
904
  var checkSlotRelocate = false;
786
905
  var isSvgMode = false;
787
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
906
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
788
907
  var _a;
789
908
  const newVNode2 = newParentVNode.$children$[childIndex];
790
909
  let i2 = 0;
791
910
  let elm;
792
911
  let childNode;
793
912
  let oldVNode;
794
- if (import_app_data4.BUILD.slotRelocation && !useNativeShadowDom) {
913
+ if (import_app_data5.BUILD.slotRelocation && !useNativeShadowDom) {
795
914
  checkSlotRelocate = true;
796
915
  if (newVNode2.$tag$ === "slot") {
797
- if (scopeId) {
798
- parentElm.classList.add(scopeId + "-s");
799
- }
800
916
  newVNode2.$flags$ |= newVNode2.$children$ ? (
801
917
  // slot element has fallback content
802
918
  // still create an element that "mocks" the slot element
@@ -809,48 +925,43 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
809
925
  );
810
926
  }
811
927
  }
812
- if (import_app_data4.BUILD.isDev && newVNode2.$elm$) {
928
+ if (import_app_data5.BUILD.isDev && newVNode2.$elm$) {
813
929
  consoleDevError(
814
930
  `The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://rindojs.web.app/docs/templating-jsx#avoid-shared-jsx-nodes`
815
931
  );
816
932
  }
817
- if (import_app_data4.BUILD.vdomText && newVNode2.$text$ !== null) {
933
+ if (import_app_data5.BUILD.vdomText && newVNode2.$text$ !== null) {
818
934
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
819
- } else if (import_app_data4.BUILD.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
820
- elm = newVNode2.$elm$ = import_app_data4.BUILD.isDebug || import_app_data4.BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
935
+ } else if (import_app_data5.BUILD.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
936
+ elm = newVNode2.$elm$ = import_app_data5.BUILD.isDebug || import_app_data5.BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
821
937
  } else {
822
- if (import_app_data4.BUILD.svg && !isSvgMode) {
938
+ if (import_app_data5.BUILD.svg && !isSvgMode) {
823
939
  isSvgMode = newVNode2.$tag$ === "svg";
824
940
  }
825
- elm = newVNode2.$elm$ = import_app_data4.BUILD.svg ? doc.createElementNS(
941
+ elm = newVNode2.$elm$ = import_app_data5.BUILD.svg ? doc.createElementNS(
826
942
  isSvgMode ? SVG_NS : HTML_NS,
827
- !useNativeShadowDom && import_app_data4.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
943
+ !useNativeShadowDom && import_app_data5.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
828
944
  ) : doc.createElement(
829
- !useNativeShadowDom && import_app_data4.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
945
+ !useNativeShadowDom && import_app_data5.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
830
946
  );
831
- if (import_app_data4.BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
947
+ if (import_app_data5.BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
832
948
  isSvgMode = false;
833
949
  }
834
- if (import_app_data4.BUILD.vdomAttribute) {
950
+ if (import_app_data5.BUILD.vdomAttribute) {
835
951
  updateElement(null, newVNode2, isSvgMode);
836
952
  }
837
- const rootNode = elm.getRootNode();
838
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
839
- if (!isElementWithinShadowRoot && import_app_data4.BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
953
+ if (import_app_data5.BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
840
954
  elm.classList.add(elm["s-si"] = scopeId);
841
955
  }
842
- if (import_app_data4.BUILD.scoped) {
843
- updateElementScopeIds(elm, parentElm);
844
- }
845
956
  if (newVNode2.$children$) {
846
957
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
847
- childNode = createElm(oldParentVNode, newVNode2, i2, elm);
958
+ childNode = createElm(oldParentVNode, newVNode2, i2);
848
959
  if (childNode) {
849
960
  elm.appendChild(childNode);
850
961
  }
851
962
  }
852
963
  }
853
- if (import_app_data4.BUILD.svg) {
964
+ if (import_app_data5.BUILD.svg) {
854
965
  if (newVNode2.$tag$ === "svg") {
855
966
  isSvgMode = false;
856
967
  } else if (elm.tagName === "foreignObject") {
@@ -859,7 +970,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
859
970
  }
860
971
  }
861
972
  elm["s-hn"] = hostTagName;
862
- if (import_app_data4.BUILD.slotRelocation) {
973
+ if (import_app_data5.BUILD.slotRelocation) {
863
974
  if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
864
975
  elm["s-sr"] = true;
865
976
  elm["s-cr"] = contentRef;
@@ -867,12 +978,15 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
867
978
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
868
979
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
869
980
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
870
- if (import_app_data4.BUILD.experimentalSlotFixes) {
981
+ if (import_app_data5.BUILD.experimentalSlotFixes) {
871
982
  relocateToHostRoot(oldParentVNode.$elm$);
872
983
  } else {
873
984
  putBackInOriginalLocation(oldParentVNode.$elm$, false);
874
985
  }
875
986
  }
987
+ if (import_app_data5.BUILD.scoped) {
988
+ addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
989
+ }
876
990
  }
877
991
  }
878
992
  return elm;
@@ -900,7 +1014,7 @@ var relocateToHostRoot = (parentElm) => {
900
1014
  var putBackInOriginalLocation = (parentElm, recursive) => {
901
1015
  plt.$flags$ |= 1 /* isTmpDisconnected */;
902
1016
  const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
903
- if (parentElm["s-sr"] && import_app_data4.BUILD.experimentalSlotFixes) {
1017
+ if (parentElm["s-sr"] && import_app_data5.BUILD.experimentalSlotFixes) {
904
1018
  let node = parentElm;
905
1019
  while (node = node.nextSibling) {
906
1020
  if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
@@ -911,7 +1025,7 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
911
1025
  for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
912
1026
  const childNode = oldSlotChildNodes[i2];
913
1027
  if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
914
- insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
1028
+ insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
915
1029
  childNode["s-ol"].remove();
916
1030
  childNode["s-ol"] = void 0;
917
1031
  childNode["s-sh"] = void 0;
@@ -924,17 +1038,17 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
924
1038
  plt.$flags$ &= ~1 /* isTmpDisconnected */;
925
1039
  };
926
1040
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
927
- let containerElm = import_app_data4.BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
1041
+ let containerElm = import_app_data5.BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
928
1042
  let childNode;
929
- if (import_app_data4.BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1043
+ if (import_app_data5.BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
930
1044
  containerElm = containerElm.shadowRoot;
931
1045
  }
932
1046
  for (; startIdx <= endIdx; ++startIdx) {
933
1047
  if (vnodes[startIdx]) {
934
- childNode = createElm(null, parentVNode, startIdx, parentElm);
1048
+ childNode = createElm(null, parentVNode, startIdx);
935
1049
  if (childNode) {
936
1050
  vnodes[startIdx].$elm$ = childNode;
937
- insertBefore(containerElm, childNode, import_app_data4.BUILD.slotRelocation ? referenceNode(before) : before);
1051
+ insertBefore(containerElm, childNode, import_app_data5.BUILD.slotRelocation ? referenceNode(before) : before);
938
1052
  }
939
1053
  }
940
1054
  }
@@ -946,7 +1060,7 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
946
1060
  const elm = vnode.$elm$;
947
1061
  nullifyVNodeRefs(vnode);
948
1062
  if (elm) {
949
- if (import_app_data4.BUILD.slotRelocation) {
1063
+ if (import_app_data5.BUILD.slotRelocation) {
950
1064
  checkSlotFallbackVisibility = true;
951
1065
  if (elm["s-ol"]) {
952
1066
  elm["s-ol"].remove();
@@ -990,7 +1104,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
990
1104
  oldEndVnode = oldCh[--oldEndIdx];
991
1105
  newEndVnode = newCh[--newEndIdx];
992
1106
  } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
993
- if (import_app_data4.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1107
+ if (import_app_data5.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
994
1108
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
995
1109
  }
996
1110
  patch(oldStartVnode, newEndVnode, isInitialRender);
@@ -998,7 +1112,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
998
1112
  oldStartVnode = oldCh[++oldStartIdx];
999
1113
  newEndVnode = newCh[--newEndIdx];
1000
1114
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1001
- if (import_app_data4.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1115
+ if (import_app_data5.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1002
1116
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1003
1117
  }
1004
1118
  patch(oldEndVnode, newStartVnode, isInitialRender);
@@ -1007,7 +1121,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1007
1121
  newStartVnode = newCh[++newStartIdx];
1008
1122
  } else {
1009
1123
  idxInOld = -1;
1010
- if (import_app_data4.BUILD.vdomKey) {
1124
+ if (import_app_data5.BUILD.vdomKey) {
1011
1125
  for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1012
1126
  if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1013
1127
  idxInOld = i2;
@@ -1015,10 +1129,10 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1015
1129
  }
1016
1130
  }
1017
1131
  }
1018
- if (import_app_data4.BUILD.vdomKey && idxInOld >= 0) {
1132
+ if (import_app_data5.BUILD.vdomKey && idxInOld >= 0) {
1019
1133
  elmToMove = oldCh[idxInOld];
1020
1134
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1021
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
1135
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
1022
1136
  } else {
1023
1137
  patch(elmToMove, newStartVnode, isInitialRender);
1024
1138
  oldCh[idxInOld] = void 0;
@@ -1026,12 +1140,16 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1026
1140
  }
1027
1141
  newStartVnode = newCh[++newStartIdx];
1028
1142
  } else {
1029
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx, parentElm);
1143
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
1030
1144
  newStartVnode = newCh[++newStartIdx];
1031
1145
  }
1032
1146
  if (node) {
1033
- if (import_app_data4.BUILD.slotRelocation) {
1034
- insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
1147
+ if (import_app_data5.BUILD.slotRelocation) {
1148
+ insertBefore(
1149
+ referenceNode(oldStartVnode.$elm$).parentNode,
1150
+ node,
1151
+ referenceNode(oldStartVnode.$elm$)
1152
+ );
1035
1153
  } else {
1036
1154
  insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1037
1155
  }
@@ -1047,35 +1165,26 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1047
1165
  newStartIdx,
1048
1166
  newEndIdx
1049
1167
  );
1050
- } else if (import_app_data4.BUILD.updatable && newStartIdx > newEndIdx) {
1168
+ } else if (import_app_data5.BUILD.updatable && newStartIdx > newEndIdx) {
1051
1169
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1052
1170
  }
1053
1171
  };
1054
1172
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1055
1173
  if (leftVNode.$tag$ === rightVNode.$tag$) {
1056
- if (import_app_data4.BUILD.slotRelocation && leftVNode.$tag$ === "slot") {
1057
- if (
1058
- // The component gets hydrated and no VDOM has been initialized.
1059
- // Here the comparison can't happen as $name$ property is not set for `leftNode`.
1060
- "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
1061
- // hydration comments to be removed
1062
- leftVNode.$elm$.nodeType !== 8
1063
- ) {
1064
- return false;
1065
- }
1174
+ if (import_app_data5.BUILD.slotRelocation && leftVNode.$tag$ === "slot") {
1066
1175
  return leftVNode.$name$ === rightVNode.$name$;
1067
1176
  }
1068
- if (import_app_data4.BUILD.vdomKey && !isInitialRender) {
1177
+ if (import_app_data5.BUILD.vdomKey && !isInitialRender) {
1069
1178
  return leftVNode.$key$ === rightVNode.$key$;
1070
1179
  }
1180
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1181
+ leftVNode.$key$ = rightVNode.$key$;
1182
+ }
1071
1183
  return true;
1072
1184
  }
1073
1185
  return false;
1074
1186
  };
1075
- var referenceNode = (node) => {
1076
- return node && node["s-ol"] || node;
1077
- };
1078
- var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
1187
+ var referenceNode = (node) => node && node["s-ol"] || node;
1079
1188
  var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1080
1189
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
1081
1190
  const oldChildren = oldVNode.$children$;
@@ -1083,13 +1192,13 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1083
1192
  const tag = newVNode2.$tag$;
1084
1193
  const text = newVNode2.$text$;
1085
1194
  let defaultHolder;
1086
- if (!import_app_data4.BUILD.vdomText || text === null) {
1087
- if (import_app_data4.BUILD.svg) {
1195
+ if (!import_app_data5.BUILD.vdomText || text === null) {
1196
+ if (import_app_data5.BUILD.svg) {
1088
1197
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
1089
1198
  }
1090
- if (import_app_data4.BUILD.vdomAttribute || import_app_data4.BUILD.reflect) {
1091
- if (import_app_data4.BUILD.slot && tag === "slot" && !useNativeShadowDom) {
1092
- if (import_app_data4.BUILD.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
1199
+ if (import_app_data5.BUILD.vdomAttribute || import_app_data5.BUILD.reflect) {
1200
+ if (import_app_data5.BUILD.slot && tag === "slot" && !useNativeShadowDom) {
1201
+ if (import_app_data5.BUILD.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
1093
1202
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1094
1203
  relocateToHostRoot(newVNode2.$elm$.parentElement);
1095
1204
  }
@@ -1097,55 +1206,28 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1097
1206
  updateElement(oldVNode, newVNode2, isSvgMode);
1098
1207
  }
1099
1208
  }
1100
- if (import_app_data4.BUILD.updatable && oldChildren !== null && newChildren !== null) {
1209
+ if (import_app_data5.BUILD.updatable && oldChildren !== null && newChildren !== null) {
1101
1210
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1102
1211
  } else if (newChildren !== null) {
1103
- if (import_app_data4.BUILD.updatable && import_app_data4.BUILD.vdomText && oldVNode.$text$ !== null) {
1212
+ if (import_app_data5.BUILD.updatable && import_app_data5.BUILD.vdomText && oldVNode.$text$ !== null) {
1104
1213
  elm.textContent = "";
1105
1214
  }
1106
1215
  addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1107
1216
  } else if (
1108
1217
  // don't do this on initial render as it can cause non-hydrated content to be removed
1109
- !isInitialRender && import_app_data4.BUILD.updatable && oldChildren !== null
1218
+ !isInitialRender && import_app_data5.BUILD.updatable && oldChildren !== null
1110
1219
  ) {
1111
1220
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
1112
1221
  }
1113
- if (import_app_data4.BUILD.svg && isSvgMode && tag === "svg") {
1222
+ if (import_app_data5.BUILD.svg && isSvgMode && tag === "svg") {
1114
1223
  isSvgMode = false;
1115
1224
  }
1116
- } else if (import_app_data4.BUILD.vdomText && import_app_data4.BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) {
1225
+ } else if (import_app_data5.BUILD.vdomText && import_app_data5.BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) {
1117
1226
  defaultHolder.parentNode.textContent = text;
1118
- } else if (import_app_data4.BUILD.vdomText && oldVNode.$text$ !== text) {
1227
+ } else if (import_app_data5.BUILD.vdomText && oldVNode.$text$ !== text) {
1119
1228
  elm.data = text;
1120
1229
  }
1121
1230
  };
1122
- var updateFallbackSlotVisibility = (elm) => {
1123
- const childNodes = elm.__childNodes || elm.childNodes;
1124
- for (const childNode of childNodes) {
1125
- if (childNode.nodeType === 1 /* ElementNode */) {
1126
- if (childNode["s-sr"]) {
1127
- const slotName = childNode["s-sn"];
1128
- childNode.hidden = false;
1129
- for (const siblingNode of childNodes) {
1130
- if (siblingNode !== childNode) {
1131
- if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
1132
- if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
1133
- childNode.hidden = true;
1134
- break;
1135
- }
1136
- } else if (slotName === siblingNode["s-sn"]) {
1137
- if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
1138
- childNode.hidden = true;
1139
- break;
1140
- }
1141
- }
1142
- }
1143
- }
1144
- }
1145
- updateFallbackSlotVisibility(childNode);
1146
- }
1147
- }
1148
- };
1149
1231
  var relocateNodes = [];
1150
1232
  var markSlotContentForRelocation = (elm) => {
1151
1233
  let node;
@@ -1158,7 +1240,7 @@ var markSlotContentForRelocation = (elm) => {
1158
1240
  const slotName = childNode["s-sn"];
1159
1241
  for (j = hostContentNodes.length - 1; j >= 0; j--) {
1160
1242
  node = hostContentNodes[j];
1161
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!import_app_data4.BUILD.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
1243
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!import_app_data5.BUILD.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
1162
1244
  if (isNodeLocatedInSlot(node, slotName)) {
1163
1245
  let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1164
1246
  checkSlotFallbackVisibility = true;
@@ -1196,60 +1278,40 @@ var markSlotContentForRelocation = (elm) => {
1196
1278
  }
1197
1279
  }
1198
1280
  };
1199
- var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1200
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1201
- if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
1202
- return true;
1203
- }
1204
- if (nodeToRelocate.getAttribute("slot") === slotName) {
1205
- return true;
1206
- }
1207
- return false;
1208
- }
1209
- if (nodeToRelocate["s-sn"] === slotName) {
1210
- return true;
1211
- }
1212
- return slotName === "";
1213
- };
1214
1281
  var nullifyVNodeRefs = (vNode) => {
1215
- if (import_app_data4.BUILD.vdomRef) {
1282
+ if (import_app_data5.BUILD.vdomRef) {
1216
1283
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1217
1284
  vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1218
1285
  }
1219
1286
  };
1220
1287
  var insertBefore = (parent, newNode, reference) => {
1221
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
1222
- if (import_app_data4.BUILD.scoped) {
1223
- updateElementScopeIds(newNode, parent);
1288
+ if (import_app_data5.BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
1289
+ addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
1224
1290
  }
1291
+ const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
1225
1292
  return inserted;
1226
1293
  };
1227
- var findScopeIds = (element) => {
1228
- const scopeIds = [];
1229
- if (element) {
1230
- scopeIds.push(
1231
- ...element["s-scs"] || [],
1232
- element["s-si"],
1233
- element["s-sc"],
1234
- ...findScopeIds(element.parentElement)
1235
- );
1236
- }
1237
- return scopeIds;
1238
- };
1239
- var updateElementScopeIds = (element, parent, iterateChildNodes = false) => {
1294
+ function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {
1240
1295
  var _a;
1241
- if (element && parent && element.nodeType === 1 /* ElementNode */) {
1242
- const scopeIds = new Set(findScopeIds(parent).filter(Boolean));
1243
- if (scopeIds.size) {
1244
- (_a = element.classList) == null ? void 0 : _a.add(...element["s-scs"] = Array.from(scopeIds));
1245
- if (element["s-ol"] || iterateChildNodes) {
1246
- for (const childNode of Array.from(element.__childNodes || element.childNodes)) {
1247
- updateElementScopeIds(childNode, element, true);
1296
+ let scopeId2;
1297
+ if (reference && typeof slotNode["s-sn"] === "string" && !!slotNode["s-sr"] && reference.parentNode && reference.parentNode["s-sc"] && (scopeId2 = slotNode["s-si"] || reference.parentNode["s-sc"])) {
1298
+ const scopeName = slotNode["s-sn"];
1299
+ const hostName = slotNode["s-hn"];
1300
+ (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + "-s");
1301
+ if (oldParent && oldParent.classList.contains(scopeId2 + "-s")) {
1302
+ let child = (oldParent.__childNodes || oldParent.childNodes)[0];
1303
+ let found = false;
1304
+ while (child) {
1305
+ if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) {
1306
+ found = true;
1307
+ break;
1248
1308
  }
1309
+ child = child.nextSibling;
1249
1310
  }
1311
+ if (!found) oldParent.classList.remove(scopeId2 + "-s");
1250
1312
  }
1251
1313
  }
1252
- };
1314
+ }
1253
1315
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1254
1316
  var _a, _b, _c, _d, _e;
1255
1317
  const hostElm = hostRef.$hostElement$;
@@ -1257,7 +1319,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1257
1319
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1258
1320
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1259
1321
  hostTagName = hostElm.tagName;
1260
- if (import_app_data4.BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1322
+ if (import_app_data5.BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1261
1323
  throw new Error(`The <Host> must be the single root component.
1262
1324
  Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1263
1325
 
@@ -1271,7 +1333,7 @@ render() {
1271
1333
  }
1272
1334
  `);
1273
1335
  }
1274
- if (import_app_data4.BUILD.reflect && cmpMeta.$attrsToReflect$) {
1336
+ if (import_app_data5.BUILD.reflect && cmpMeta.$attrsToReflect$) {
1275
1337
  rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1276
1338
  cmpMeta.$attrsToReflect$.map(
1277
1339
  ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
@@ -1287,24 +1349,24 @@ render() {
1287
1349
  rootVnode.$tag$ = null;
1288
1350
  rootVnode.$flags$ |= 4 /* isHost */;
1289
1351
  hostRef.$vnode$ = rootVnode;
1290
- rootVnode.$elm$ = oldVNode.$elm$ = import_app_data4.BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
1291
- if (import_app_data4.BUILD.scoped || import_app_data4.BUILD.shadowDom) {
1352
+ rootVnode.$elm$ = oldVNode.$elm$ = import_app_data5.BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
1353
+ if (import_app_data5.BUILD.scoped || import_app_data5.BUILD.shadowDom) {
1292
1354
  scopeId = hostElm["s-sc"];
1293
1355
  }
1294
1356
  useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1295
- if (import_app_data4.BUILD.slotRelocation) {
1357
+ if (import_app_data5.BUILD.slotRelocation) {
1296
1358
  contentRef = hostElm["s-cr"];
1297
1359
  checkSlotFallbackVisibility = false;
1298
1360
  }
1299
1361
  patch(oldVNode, rootVnode, isInitialLoad);
1300
- if (import_app_data4.BUILD.slotRelocation) {
1362
+ if (import_app_data5.BUILD.slotRelocation) {
1301
1363
  plt.$flags$ |= 1 /* isTmpDisconnected */;
1302
1364
  if (checkSlotRelocate) {
1303
1365
  markSlotContentForRelocation(rootVnode.$elm$);
1304
1366
  for (const relocateData of relocateNodes) {
1305
1367
  const nodeToRelocate = relocateData.$nodeToRelocate$;
1306
1368
  if (!nodeToRelocate["s-ol"]) {
1307
- const orgLocationNode = import_app_data4.BUILD.isDebug || import_app_data4.BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
1369
+ const orgLocationNode = import_app_data5.BUILD.isDebug || import_app_data5.BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
1308
1370
  orgLocationNode["s-nr"] = nodeToRelocate;
1309
1371
  insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1310
1372
  }
@@ -1315,7 +1377,7 @@ render() {
1315
1377
  if (slotRefNode) {
1316
1378
  const parentNodeRef = slotRefNode.parentNode;
1317
1379
  let insertBeforeNode = slotRefNode.nextSibling;
1318
- if (!import_app_data4.BUILD.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
1380
+ if (!import_app_data5.BUILD.hydrateServerSide && (!import_app_data5.BUILD.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
1319
1381
  let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
1320
1382
  while (orgLocationNode) {
1321
1383
  let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
@@ -1334,11 +1396,11 @@ render() {
1334
1396
  }
1335
1397
  if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
1336
1398
  if (nodeToRelocate !== insertBeforeNode) {
1337
- if (!import_app_data4.BUILD.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1399
+ if (!import_app_data5.BUILD.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1338
1400
  nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1339
1401
  }
1340
1402
  insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1341
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1403
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1342
1404
  nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1343
1405
  }
1344
1406
  }
@@ -1360,7 +1422,7 @@ render() {
1360
1422
  plt.$flags$ &= ~1 /* isTmpDisconnected */;
1361
1423
  relocateNodes.length = 0;
1362
1424
  }
1363
- if (import_app_data4.BUILD.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1425
+ if (import_app_data5.BUILD.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1364
1426
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1365
1427
  for (const childNode of children) {
1366
1428
  if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
@@ -1397,9 +1459,9 @@ var patchCloneNode = (HostElementPrototype) => {
1397
1459
  const orgCloneNode = HostElementPrototype.cloneNode;
1398
1460
  HostElementPrototype.cloneNode = function(deep) {
1399
1461
  const srcNode = this;
1400
- const isShadowDom = import_app_data5.BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
1462
+ const isShadowDom = import_app_data6.BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
1401
1463
  const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1402
- if (import_app_data5.BUILD.slot && !isShadowDom && deep) {
1464
+ if (import_app_data6.BUILD.slot && !isShadowDom && deep) {
1403
1465
  let i2 = 0;
1404
1466
  let slotted, nonRindoNode;
1405
1467
  const rindoPrivates = [
@@ -1424,7 +1486,7 @@ var patchCloneNode = (HostElementPrototype) => {
1424
1486
  slotted = childNodes[i2]["s-nr"];
1425
1487
  nonRindoNode = rindoPrivates.every((privateField) => !childNodes[i2][privateField]);
1426
1488
  if (slotted) {
1427
- if (import_app_data5.BUILD.appendChildSlotFix && clonedNode.__appendChild) {
1489
+ if (import_app_data6.BUILD.appendChildSlotFix && clonedNode.__appendChild) {
1428
1490
  clonedNode.__appendChild(slotted.cloneNode(true));
1429
1491
  } else {
1430
1492
  clonedNode.appendChild(slotted.cloneNode(true));
@@ -1442,7 +1504,7 @@ var patchSlotAppendChild = (HostElementPrototype) => {
1442
1504
  HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
1443
1505
  HostElementPrototype.appendChild = function(newChild) {
1444
1506
  const slotName = newChild["s-sn"] = getSlotName(newChild);
1445
- const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, slotName, this.tagName);
1507
+ const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
1446
1508
  if (slotNode) {
1447
1509
  addSlotRelocateNode(newChild, slotNode);
1448
1510
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
@@ -1459,7 +1521,7 @@ var patchSlotRemoveChild = (ElementPrototype) => {
1459
1521
  ElementPrototype.removeChild = function(toRemove) {
1460
1522
  if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
1461
1523
  const childNodes = this.__childNodes || this.childNodes;
1462
- const slotNode = getHostSlotNode(childNodes, toRemove["s-sn"], this.tagName);
1524
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
1463
1525
  if (slotNode && toRemove.isConnected) {
1464
1526
  toRemove.remove();
1465
1527
  updateFallbackSlotVisibility(this);
@@ -1478,7 +1540,7 @@ var patchSlotPrepend = (HostElementPrototype) => {
1478
1540
  }
1479
1541
  const slotName = newChild["s-sn"] = getSlotName(newChild);
1480
1542
  const childNodes = this.__childNodes || this.childNodes;
1481
- const slotNode = getHostSlotNode(childNodes, slotName, this.tagName);
1543
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
1482
1544
  if (slotNode) {
1483
1545
  addSlotRelocateNode(newChild, slotNode, true);
1484
1546
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
@@ -1545,11 +1607,7 @@ var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
1545
1607
  };
1546
1608
  };
1547
1609
  var patchTextContent = (hostElementPrototype) => {
1548
- let descriptor = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "textContent");
1549
- if (!descriptor) {
1550
- descriptor = Object.getOwnPropertyDescriptor(hostElementPrototype, "textContent");
1551
- }
1552
- if (descriptor) Object.defineProperty(hostElementPrototype, "__textContent", descriptor);
1610
+ patchHostOriginalAccessor("textContent", hostElementPrototype);
1553
1611
  Object.defineProperty(hostElementPrototype, "textContent", {
1554
1612
  get: function() {
1555
1613
  let text = "";
@@ -1573,16 +1631,7 @@ var patchChildSlotNodes = (elm) => {
1573
1631
  return this[n];
1574
1632
  }
1575
1633
  }
1576
- let childNodesFn = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "childNodes");
1577
- if (!childNodesFn) {
1578
- childNodesFn = Object.getOwnPropertyDescriptor(elm, "childNodes");
1579
- }
1580
- if (childNodesFn) Object.defineProperty(elm, "__childNodes", childNodesFn);
1581
- let childrenFn = Object.getOwnPropertyDescriptor(Element.prototype, "children");
1582
- if (!childrenFn) {
1583
- childrenFn = Object.getOwnPropertyDescriptor(elm, "children");
1584
- }
1585
- if (childrenFn) Object.defineProperty(elm, "__children", childrenFn);
1634
+ patchHostOriginalAccessor("children", elm);
1586
1635
  Object.defineProperty(elm, "children", {
1587
1636
  get() {
1588
1637
  return this.childNodes.filter((n) => n.nodeType === 1);
@@ -1593,7 +1642,19 @@ var patchChildSlotNodes = (elm) => {
1593
1642
  return this.children.length;
1594
1643
  }
1595
1644
  });
1596
- if (!childNodesFn) return;
1645
+ patchHostOriginalAccessor("firstChild", elm);
1646
+ Object.defineProperty(elm, "firstChild", {
1647
+ get() {
1648
+ return this.childNodes[0];
1649
+ }
1650
+ });
1651
+ patchHostOriginalAccessor("lastChild", elm);
1652
+ Object.defineProperty(elm, "lastChild", {
1653
+ get() {
1654
+ return this.childNodes[this.childNodes.length - 1];
1655
+ }
1656
+ });
1657
+ patchHostOriginalAccessor("childNodes", elm);
1597
1658
  Object.defineProperty(elm, "childNodes", {
1598
1659
  get() {
1599
1660
  var _a, _b;
@@ -1607,77 +1668,102 @@ var patchChildSlotNodes = (elm) => {
1607
1668
  }
1608
1669
  });
1609
1670
  };
1610
- var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
1611
- let slottedNodeLocation;
1612
- if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
1613
- slottedNodeLocation = newChild["s-ol"];
1614
- } else {
1615
- slottedNodeLocation = document.createTextNode("");
1616
- slottedNodeLocation["s-nr"] = newChild;
1671
+ var patchNextPrev = (node) => {
1672
+ if (!node || node.__nextSibling || !globalThis.Node) return;
1673
+ patchNextSibling(node);
1674
+ patchPreviousSibling(node);
1675
+ if (node.nodeType === Node.ELEMENT_NODE) {
1676
+ patchNextElementSibling(node);
1677
+ patchPreviousElementSibling(node);
1617
1678
  }
1618
- if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
1619
- const parent = slotNode["s-cr"].parentNode;
1620
- const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
1621
- if (typeof position !== "undefined") {
1622
- if (import_app_data5.BUILD.hydrateClientSide) {
1623
- slottedNodeLocation["s-oo"] = position;
1624
- const childNodes = parent.__childNodes || parent.childNodes;
1625
- const slotRelocateNodes = [slottedNodeLocation];
1626
- childNodes.forEach((n) => {
1627
- if (n["s-nr"]) slotRelocateNodes.push(n);
1628
- });
1629
- slotRelocateNodes.sort((a, b) => {
1630
- if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
1631
- else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
1632
- return 0;
1633
- });
1634
- slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
1679
+ };
1680
+ var patchNextSibling = (node) => {
1681
+ if (!node || node.__nextSibling) return;
1682
+ patchHostOriginalAccessor("nextSibling", node);
1683
+ Object.defineProperty(node, "nextSibling", {
1684
+ get: function() {
1685
+ var _a;
1686
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
1687
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1688
+ if (parentNodes && index > -1) {
1689
+ return parentNodes[index + 1];
1690
+ }
1691
+ return this.__nextSibling;
1635
1692
  }
1636
- } else {
1637
- appendMethod.call(parent, slottedNodeLocation);
1638
- }
1639
- newChild["s-ol"] = slottedNodeLocation;
1640
- newChild["s-sh"] = slotNode["s-hn"];
1693
+ });
1641
1694
  };
1642
- var getSlottedChildNodes = (childNodes) => {
1643
- const result = [];
1644
- for (let i2 = 0; i2 < childNodes.length; i2++) {
1645
- const slottedNode = childNodes[i2]["s-nr"];
1646
- if (slottedNode && slottedNode.isConnected) {
1647
- result.push(slottedNode);
1695
+ var patchNextElementSibling = (element) => {
1696
+ if (!element || element.__nextElementSibling) return;
1697
+ patchHostOriginalAccessor("nextElementSibling", element);
1698
+ Object.defineProperty(element, "nextElementSibling", {
1699
+ get: function() {
1700
+ var _a;
1701
+ const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
1702
+ const index = parentEles == null ? void 0 : parentEles.indexOf(this);
1703
+ if (parentEles && index > -1) {
1704
+ return parentEles[index + 1];
1705
+ }
1706
+ return this.__nextElementSibling;
1648
1707
  }
1649
- }
1650
- return result;
1708
+ });
1651
1709
  };
1652
- var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
1653
- var getHostSlotNode = (childNodes, slotName, hostName) => {
1654
- let i2 = 0;
1655
- let childNode;
1656
- for (; i2 < childNodes.length; i2++) {
1657
- childNode = childNodes[i2];
1658
- if (childNode["s-sr"] && childNode["s-sn"] === slotName && childNode["s-hn"] === hostName) {
1659
- return childNode;
1710
+ var patchPreviousSibling = (node) => {
1711
+ if (!node || node.__previousSibling) return;
1712
+ patchHostOriginalAccessor("previousSibling", node);
1713
+ Object.defineProperty(node, "previousSibling", {
1714
+ get: function() {
1715
+ var _a;
1716
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
1717
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1718
+ if (parentNodes && index > -1) {
1719
+ return parentNodes[index - 1];
1720
+ }
1721
+ return this.__previousSibling;
1660
1722
  }
1661
- childNode = getHostSlotNode(childNode.childNodes, slotName, hostName);
1662
- if (childNode) {
1663
- return childNode;
1723
+ });
1724
+ };
1725
+ var patchPreviousElementSibling = (element) => {
1726
+ if (!element || element.__previousElementSibling) return;
1727
+ patchHostOriginalAccessor("previousElementSibling", element);
1728
+ Object.defineProperty(element, "previousElementSibling", {
1729
+ get: function() {
1730
+ var _a;
1731
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
1732
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
1733
+ if (parentNodes && index > -1) {
1734
+ return parentNodes[index - 1];
1735
+ }
1736
+ return this.__previousElementSibling;
1664
1737
  }
1665
- }
1666
- return null;
1738
+ });
1667
1739
  };
1668
- var getHostSlotChildNodes = (n, slotName) => {
1669
- const childNodes = [n];
1670
- while ((n = n.nextSibling) && n["s-sn"] === slotName) {
1671
- childNodes.push(n);
1740
+ var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
1741
+ var validNodesPatches = [
1742
+ "childNodes",
1743
+ "firstChild",
1744
+ "lastChild",
1745
+ "nextSibling",
1746
+ "previousSibling",
1747
+ "textContent"
1748
+ ];
1749
+ function patchHostOriginalAccessor(accessorName, node) {
1750
+ let accessor;
1751
+ if (validElementPatches.includes(accessorName)) {
1752
+ accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
1753
+ } else if (validNodesPatches.includes(accessorName)) {
1754
+ accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
1672
1755
  }
1673
- return childNodes;
1674
- };
1756
+ if (!accessor) {
1757
+ accessor = Object.getOwnPropertyDescriptor(node, accessorName);
1758
+ }
1759
+ if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
1760
+ }
1675
1761
 
1676
1762
  // src/runtime/profile.ts
1677
- var import_app_data6 = require("@rindo/core/internal/app-data");
1763
+ var import_app_data7 = require("@rindo/core/internal/app-data");
1678
1764
  var i = 0;
1679
1765
  var createTime = (fnName, tagName = "") => {
1680
- if (import_app_data6.BUILD.profile && performance.mark) {
1766
+ if (import_app_data7.BUILD.profile && performance.mark) {
1681
1767
  const key = `st:${fnName}:${tagName}:${i++}`;
1682
1768
  performance.mark(key);
1683
1769
  return () => performance.measure(`[Rindo] ${fnName}() <${tagName}>`, key);
@@ -1688,7 +1774,7 @@ var createTime = (fnName, tagName = "") => {
1688
1774
  }
1689
1775
  };
1690
1776
  var uniqueTime = (key, measureText) => {
1691
- if (import_app_data6.BUILD.profile && performance.mark) {
1777
+ if (import_app_data7.BUILD.profile && performance.mark) {
1692
1778
  if (performance.getEntriesByName(key, "mark").length === 0) {
1693
1779
  performance.mark(key);
1694
1780
  }
@@ -1746,7 +1832,7 @@ var inspect = (ref) => {
1746
1832
  };
1747
1833
  };
1748
1834
  var installDevTools = () => {
1749
- if (import_app_data6.BUILD.devTools) {
1835
+ if (import_app_data7.BUILD.devTools) {
1750
1836
  const rindo = win.rindo = win.rindo || {};
1751
1837
  const originalInspect = rindo.inspect;
1752
1838
  rindo.inspect = (ref) => {
@@ -1766,9 +1852,19 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1766
1852
  const childRenderNodes = [];
1767
1853
  const slotNodes = [];
1768
1854
  const slottedNodes = [];
1769
- const shadowRootNodes = import_app_data7.BUILD.shadowDom && shadowRoot ? [] : null;
1855
+ const shadowRootNodes = import_app_data8.BUILD.shadowDom && shadowRoot ? [] : null;
1770
1856
  const vnode = newVNode(tagName, null);
1771
1857
  vnode.$elm$ = hostElm;
1858
+ let scopeId2;
1859
+ if (import_app_data8.BUILD.scoped) {
1860
+ const cmpMeta = hostRef.$cmpMeta$;
1861
+ if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1862
+ scopeId2 = hostElm["s-sc"];
1863
+ hostElm.classList.add(scopeId2 + "-h");
1864
+ } else if (hostElm["s-sc"]) {
1865
+ delete hostElm["s-sc"];
1866
+ }
1867
+ }
1772
1868
  if (!plt.$orgLocNodes$) {
1773
1869
  initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1774
1870
  }
@@ -1798,6 +1894,18 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1798
1894
  node["s-cr"] = hostElm["s-cr"];
1799
1895
  }
1800
1896
  }
1897
+ if (childRenderNode.$tag$ === "slot") {
1898
+ if (childRenderNode.$children$) {
1899
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
1900
+ if (!childRenderNode.$elm$.childNodes.length) {
1901
+ childRenderNode.$children$.forEach((c) => {
1902
+ childRenderNode.$elm$.appendChild(c.$elm$);
1903
+ });
1904
+ }
1905
+ } else {
1906
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
1907
+ }
1908
+ }
1801
1909
  if (orgLocationNode && orgLocationNode.isConnected) {
1802
1910
  if (shadowRoot && orgLocationNode["s-en"] === "") {
1803
1911
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
@@ -1810,8 +1918,8 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1810
1918
  plt.$orgLocNodes$.delete(orgLocationId);
1811
1919
  }
1812
1920
  const hosts = [];
1813
- let snIndex = 0;
1814
1921
  const snLen = slottedNodes.length;
1922
+ let snIndex = 0;
1815
1923
  let slotGroup;
1816
1924
  let snGroupIdx;
1817
1925
  let snGroupLen;
@@ -1833,17 +1941,24 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1833
1941
  if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1834
1942
  slottedItem.slot["s-cr"] = hostEle;
1835
1943
  } else {
1836
- const hostChildren = hostEle.__childNodes || hostEle.childNodes;
1837
- slottedItem.slot["s-cr"] = hostChildren[0];
1944
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1838
1945
  }
1839
1946
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1947
+ if (import_app_data8.BUILD.experimentalSlotFixes) {
1948
+ patchNextPrev(slottedItem.node);
1949
+ }
1840
1950
  }
1841
1951
  if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1842
1952
  hostEle.appendChild(slottedItem.node);
1843
1953
  }
1844
1954
  }
1845
1955
  }
1846
- if (import_app_data7.BUILD.shadowDom && shadowRoot) {
1956
+ if (import_app_data8.BUILD.scoped && scopeId2 && slotNodes.length) {
1957
+ slotNodes.forEach((slot) => {
1958
+ slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1959
+ });
1960
+ }
1961
+ if (import_app_data8.BUILD.shadowDom && shadowRoot) {
1847
1962
  let rnIdex = 0;
1848
1963
  const rnLen = shadowRootNodes.length;
1849
1964
  for (rnIdex; rnIdex < rnLen; rnIdex++) {
@@ -1877,15 +1992,19 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1877
1992
  $index$: childIdSplt[3],
1878
1993
  $tag$: node.tagName.toLowerCase(),
1879
1994
  $elm$: node,
1880
- // If we don't add the initial classes to the VNode, the first `vdom-render.ts` reconciliation will fail:
1881
- // client side changes before componentDidLoad will be ignored, `set-accessor.ts` will just take the element's initial classes
1882
- $attrs$: { class: node.className }
1995
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
1996
+ // won't try to reconcile them. Classes set on the node will be blown away.
1997
+ $attrs$: { class: node.className || "" }
1883
1998
  });
1884
1999
  childRenderNodes.push(childVNode);
1885
2000
  node.removeAttribute(HYDRATE_CHILD_ID);
1886
2001
  if (!parentVNode.$children$) {
1887
2002
  parentVNode.$children$ = [];
1888
2003
  }
2004
+ if (import_app_data8.BUILD.scoped && scopeId2) {
2005
+ node["s-si"] = scopeId2;
2006
+ childVNode.$attrs$.class += " " + scopeId2;
2007
+ }
1889
2008
  const slotName = childVNode.$elm$.getAttribute("s-sn");
1890
2009
  if (typeof slotName === "string") {
1891
2010
  if (childVNode.$tag$ === "slot-fb") {
@@ -1900,6 +2019,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1900
2019
  shadowRootNodes,
1901
2020
  slottedNodes
1902
2021
  );
2022
+ if (import_app_data8.BUILD.scoped && scopeId2) {
2023
+ node.classList.add(scopeId2);
2024
+ }
1903
2025
  }
1904
2026
  childVNode.$elm$["s-sn"] = slotName;
1905
2027
  childVNode.$elm$.removeAttribute("s-sn");
@@ -1907,7 +2029,6 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1907
2029
  if (childVNode.$index$ !== void 0) {
1908
2030
  parentVNode.$children$[childVNode.$index$] = childVNode;
1909
2031
  }
1910
- if (scopeId2) node["s-si"] = scopeId2;
1911
2032
  parentVNode = childVNode;
1912
2033
  if (shadowRootNodes && childVNode.$depth$ === "0") {
1913
2034
  shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
@@ -1982,8 +2103,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1982
2103
  }
1983
2104
  } else if (childVNode.$hostId$ === hostId) {
1984
2105
  if (childNodeType === SLOT_NODE_ID) {
1985
- childVNode.$tag$ = "slot";
1986
- const slotName = node["s-sn"] = childVNode.$name$ = childIdSplt[5] || "";
2106
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
1987
2107
  addSlot(
1988
2108
  slotName,
1989
2109
  childIdSplt[2],
@@ -1996,9 +2116,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1996
2116
  slottedNodes
1997
2117
  );
1998
2118
  } else if (childNodeType === CONTENT_REF_ID) {
1999
- if (import_app_data7.BUILD.shadowDom && shadowRootNodes) {
2119
+ if (import_app_data8.BUILD.shadowDom && shadowRootNodes) {
2000
2120
  node.remove();
2001
- } else if (import_app_data7.BUILD.slotRelocation) {
2121
+ } else if (import_app_data8.BUILD.slotRelocation) {
2002
2122
  hostElm["s-cr"] = node;
2003
2123
  node["s-cn"] = true;
2004
2124
  }
@@ -2057,8 +2177,10 @@ var createSimpleVNode = (vnode) => {
2057
2177
  };
2058
2178
  function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
2059
2179
  node["s-sr"] = true;
2180
+ childVNode.$name$ = slotName || null;
2181
+ childVNode.$tag$ = "slot";
2060
2182
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
2061
- if (import_app_data7.BUILD.shadowDom && shadowRootNodes) {
2183
+ if (import_app_data8.BUILD.shadowDom && shadowRootNodes) {
2062
2184
  const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
2063
2185
  if (childVNode.$name$) {
2064
2186
  childVNode.$elm$.setAttribute("name", slotName);
@@ -2099,7 +2221,7 @@ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) =>
2099
2221
  };
2100
2222
 
2101
2223
  // src/runtime/initialize-component.ts
2102
- var import_app_data15 = require("@rindo/core/internal/app-data");
2224
+ var import_app_data16 = require("@rindo/core/internal/app-data");
2103
2225
 
2104
2226
  // src/runtime/mode.ts
2105
2227
  var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
@@ -2107,22 +2229,22 @@ var setMode = (handler) => modeResolutionChain.push(handler);
2107
2229
  var getMode = (ref) => getHostRef(ref).$modeName$;
2108
2230
 
2109
2231
  // src/runtime/proxy-component.ts
2110
- var import_app_data14 = require("@rindo/core/internal/app-data");
2232
+ var import_app_data15 = require("@rindo/core/internal/app-data");
2111
2233
 
2112
2234
  // src/runtime/set-value.ts
2113
- var import_app_data13 = require("@rindo/core/internal/app-data");
2235
+ var import_app_data14 = require("@rindo/core/internal/app-data");
2114
2236
 
2115
2237
  // src/runtime/parse-property-value.ts
2116
- var import_app_data8 = require("@rindo/core/internal/app-data");
2238
+ var import_app_data9 = require("@rindo/core/internal/app-data");
2117
2239
  var parsePropertyValue = (propValue, propType) => {
2118
2240
  if (propValue != null && !isComplexType(propValue)) {
2119
- if (import_app_data8.BUILD.propBoolean && propType & 4 /* Boolean */) {
2241
+ if (import_app_data9.BUILD.propBoolean && propType & 4 /* Boolean */) {
2120
2242
  return propValue === "false" ? false : propValue === "" || !!propValue;
2121
2243
  }
2122
- if (import_app_data8.BUILD.propNumber && propType & 2 /* Number */) {
2244
+ if (import_app_data9.BUILD.propNumber && propType & 2 /* Number */) {
2123
2245
  return parseFloat(propValue);
2124
2246
  }
2125
- if (import_app_data8.BUILD.propString && propType & 1 /* String */) {
2247
+ if (import_app_data9.BUILD.propString && propType & 1 /* String */) {
2126
2248
  return String(propValue);
2127
2249
  }
2128
2250
  return propValue;
@@ -2131,21 +2253,21 @@ var parsePropertyValue = (propValue, propType) => {
2131
2253
  };
2132
2254
 
2133
2255
  // src/runtime/update-component.ts
2134
- var import_app_data12 = require("@rindo/core/internal/app-data");
2256
+ var import_app_data13 = require("@rindo/core/internal/app-data");
2135
2257
 
2136
2258
  // src/runtime/event-emitter.ts
2137
- var import_app_data10 = require("@rindo/core/internal/app-data");
2259
+ var import_app_data11 = require("@rindo/core/internal/app-data");
2138
2260
 
2139
2261
  // src/runtime/element.ts
2140
- var import_app_data9 = require("@rindo/core/internal/app-data");
2141
- var getElement = (ref) => import_app_data9.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2262
+ var import_app_data10 = require("@rindo/core/internal/app-data");
2263
+ var getElement = (ref) => import_app_data10.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2142
2264
 
2143
2265
  // src/runtime/event-emitter.ts
2144
2266
  var createEvent = (ref, name, flags) => {
2145
2267
  const elm = getElement(ref);
2146
2268
  return {
2147
2269
  emit: (detail) => {
2148
- if (import_app_data10.BUILD.isDev && !elm.isConnected) {
2270
+ if (import_app_data11.BUILD.isDev && !elm.isConnected) {
2149
2271
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2150
2272
  }
2151
2273
  return emitEvent(elm, name, {
@@ -2164,7 +2286,7 @@ var emitEvent = (elm, name, opts) => {
2164
2286
  };
2165
2287
 
2166
2288
  // src/runtime/styles.ts
2167
- var import_app_data11 = require("@rindo/core/internal/app-data");
2289
+ var import_app_data12 = require("@rindo/core/internal/app-data");
2168
2290
  var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2169
2291
  var registerStyle = (scopeId2, cssText, allowCS) => {
2170
2292
  let style = styles.get(scopeId2);
@@ -2184,7 +2306,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2184
2306
  var _a;
2185
2307
  const scopeId2 = getScopeId(cmpMeta, mode);
2186
2308
  const style = styles.get(scopeId2);
2187
- if (!import_app_data11.BUILD.attachStyles) {
2309
+ if (!import_app_data12.BUILD.attachStyles) {
2188
2310
  return scopeId2;
2189
2311
  }
2190
2312
  styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
@@ -2197,16 +2319,16 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2197
2319
  rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2198
2320
  }
2199
2321
  if (!appliedStyles.has(scopeId2)) {
2200
- if (import_app_data11.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2322
+ if (import_app_data12.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2201
2323
  styleElm.innerHTML = style;
2202
2324
  } else {
2203
- styleElm = doc.createElement("style");
2325
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
2204
2326
  styleElm.innerHTML = style;
2205
2327
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
2206
2328
  if (nonce != null) {
2207
2329
  styleElm.setAttribute("nonce", nonce);
2208
2330
  }
2209
- if ((import_app_data11.BUILD.hydrateServerSide || import_app_data11.BUILD.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2331
+ if ((import_app_data12.BUILD.hydrateServerSide || import_app_data12.BUILD.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2210
2332
  styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2211
2333
  }
2212
2334
  if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
@@ -2242,7 +2364,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2242
2364
  appliedStyles.add(scopeId2);
2243
2365
  }
2244
2366
  }
2245
- } else if (import_app_data11.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2367
+ } else if (import_app_data12.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2246
2368
  styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2247
2369
  }
2248
2370
  }
@@ -2254,43 +2376,40 @@ var attachStyles = (hostRef) => {
2254
2376
  const flags = cmpMeta.$flags$;
2255
2377
  const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2256
2378
  const scopeId2 = addStyle(
2257
- import_app_data11.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2379
+ import_app_data12.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2258
2380
  cmpMeta,
2259
2381
  hostRef.$modeName$
2260
2382
  );
2261
- if ((import_app_data11.BUILD.shadowDom || import_app_data11.BUILD.scoped) && import_app_data11.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
2383
+ if ((import_app_data12.BUILD.shadowDom || import_app_data12.BUILD.scoped) && import_app_data12.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
2262
2384
  elm["s-sc"] = scopeId2;
2263
2385
  elm.classList.add(scopeId2 + "-h");
2264
- if (import_app_data11.BUILD.scoped && flags & 2 /* scopedCssEncapsulation */) {
2265
- elm.classList.add(scopeId2 + "-s");
2266
- }
2267
2386
  }
2268
2387
  endAttachStyles();
2269
2388
  };
2270
- var getScopeId = (cmp, mode) => "sc-" + (import_app_data11.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2389
+ var getScopeId = (cmp, mode) => "sc-" + (import_app_data12.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2271
2390
 
2272
2391
  // src/runtime/update-component.ts
2273
2392
  var attachToAncestor = (hostRef, ancestorComponent) => {
2274
- if (import_app_data12.BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2393
+ if (import_app_data13.BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2275
2394
  ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
2276
2395
  }
2277
2396
  };
2278
2397
  var scheduleUpdate = (hostRef, isInitialLoad) => {
2279
- if (import_app_data12.BUILD.taskQueue && import_app_data12.BUILD.updatable) {
2398
+ if (import_app_data13.BUILD.taskQueue && import_app_data13.BUILD.updatable) {
2280
2399
  hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
2281
2400
  }
2282
- if (import_app_data12.BUILD.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
2401
+ if (import_app_data13.BUILD.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
2283
2402
  hostRef.$flags$ |= 512 /* needsRerender */;
2284
2403
  return;
2285
2404
  }
2286
2405
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
2287
2406
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
2288
- return import_app_data12.BUILD.taskQueue ? writeTask(dispatch) : dispatch();
2407
+ return import_app_data13.BUILD.taskQueue ? writeTask(dispatch) : dispatch();
2289
2408
  };
2290
2409
  var dispatchHooks = (hostRef, isInitialLoad) => {
2291
2410
  const elm = hostRef.$hostElement$;
2292
2411
  const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
2293
- const instance = import_app_data12.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2412
+ const instance = import_app_data13.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2294
2413
  if (!instance) {
2295
2414
  throw new Error(
2296
2415
  `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Rindo runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://rindojs.web.app/docs/custom-elements#externalruntime`
@@ -2298,7 +2417,7 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2298
2417
  }
2299
2418
  let maybePromise;
2300
2419
  if (isInitialLoad) {
2301
- if (import_app_data12.BUILD.lazyLoad && import_app_data12.BUILD.hostListener) {
2420
+ if (import_app_data13.BUILD.lazyLoad && import_app_data13.BUILD.hostListener) {
2302
2421
  hostRef.$flags$ |= 256 /* isListenReady */;
2303
2422
  if (hostRef.$queuedListeners$) {
2304
2423
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
@@ -2306,17 +2425,17 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
2306
2425
  }
2307
2426
  }
2308
2427
  emitLifecycleEvent(elm, "componentWillLoad");
2309
- if (import_app_data12.BUILD.cmpWillLoad) {
2428
+ if (import_app_data13.BUILD.cmpWillLoad) {
2310
2429
  maybePromise = safeCall(instance, "componentWillLoad");
2311
2430
  }
2312
2431
  } else {
2313
2432
  emitLifecycleEvent(elm, "componentWillUpdate");
2314
- if (import_app_data12.BUILD.cmpWillUpdate) {
2433
+ if (import_app_data13.BUILD.cmpWillUpdate) {
2315
2434
  maybePromise = safeCall(instance, "componentWillUpdate");
2316
2435
  }
2317
2436
  }
2318
2437
  emitLifecycleEvent(elm, "componentWillRender");
2319
- if (import_app_data12.BUILD.cmpWillRender) {
2438
+ if (import_app_data13.BUILD.cmpWillRender) {
2320
2439
  maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender"));
2321
2440
  }
2322
2441
  endSchedule();
@@ -2332,23 +2451,23 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
2332
2451
  const elm = hostRef.$hostElement$;
2333
2452
  const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
2334
2453
  const rc = elm["s-rc"];
2335
- if (import_app_data12.BUILD.style && isInitialLoad) {
2454
+ if (import_app_data13.BUILD.style && isInitialLoad) {
2336
2455
  attachStyles(hostRef);
2337
2456
  }
2338
2457
  const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
2339
- if (import_app_data12.BUILD.isDev) {
2458
+ if (import_app_data13.BUILD.isDev) {
2340
2459
  hostRef.$flags$ |= 1024 /* devOnRender */;
2341
2460
  }
2342
- if (import_app_data12.BUILD.hydrateServerSide) {
2461
+ if (import_app_data13.BUILD.hydrateServerSide) {
2343
2462
  await callRender(hostRef, instance, elm, isInitialLoad);
2344
2463
  } else {
2345
2464
  callRender(hostRef, instance, elm, isInitialLoad);
2346
2465
  }
2347
- if (import_app_data12.BUILD.isDev) {
2466
+ if (import_app_data13.BUILD.isDev) {
2348
2467
  hostRef.$renderCount$ = hostRef.$renderCount$ === void 0 ? 1 : hostRef.$renderCount$ + 1;
2349
2468
  hostRef.$flags$ &= ~1024 /* devOnRender */;
2350
2469
  }
2351
- if (import_app_data12.BUILD.hydrateServerSide) {
2470
+ if (import_app_data13.BUILD.hydrateServerSide) {
2352
2471
  try {
2353
2472
  serverSideConnected(elm);
2354
2473
  if (isInitialLoad) {
@@ -2362,13 +2481,13 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
2362
2481
  consoleError(e, elm);
2363
2482
  }
2364
2483
  }
2365
- if (import_app_data12.BUILD.asyncLoading && rc) {
2484
+ if (import_app_data13.BUILD.asyncLoading && rc) {
2366
2485
  rc.map((cb) => cb());
2367
2486
  elm["s-rc"] = void 0;
2368
2487
  }
2369
2488
  endRender();
2370
2489
  endUpdate();
2371
- if (import_app_data12.BUILD.asyncLoading) {
2490
+ if (import_app_data13.BUILD.asyncLoading) {
2372
2491
  const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
2373
2492
  const postUpdate = () => postUpdateComponent(hostRef);
2374
2493
  if (childrenPromises.length === 0) {
@@ -2384,10 +2503,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
2384
2503
  };
2385
2504
  var renderingRef = null;
2386
2505
  var callRender = (hostRef, instance, elm, isInitialLoad) => {
2387
- const allRenderFn = import_app_data12.BUILD.allRenderFn ? true : false;
2388
- const lazyLoad = import_app_data12.BUILD.lazyLoad ? true : false;
2389
- const taskQueue = import_app_data12.BUILD.taskQueue ? true : false;
2390
- const updatable = import_app_data12.BUILD.updatable ? true : false;
2506
+ const allRenderFn = import_app_data13.BUILD.allRenderFn ? true : false;
2507
+ const lazyLoad = import_app_data13.BUILD.lazyLoad ? true : false;
2508
+ const taskQueue = import_app_data13.BUILD.taskQueue ? true : false;
2509
+ const updatable = import_app_data13.BUILD.updatable ? true : false;
2391
2510
  try {
2392
2511
  renderingRef = instance;
2393
2512
  instance = allRenderFn ? instance.render() : instance.render && instance.render();
@@ -2397,9 +2516,9 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
2397
2516
  if (updatable || lazyLoad) {
2398
2517
  hostRef.$flags$ |= 2 /* hasRendered */;
2399
2518
  }
2400
- if (import_app_data12.BUILD.hasRenderFn || import_app_data12.BUILD.reflect) {
2401
- if (import_app_data12.BUILD.vdomRender || import_app_data12.BUILD.reflect) {
2402
- if (import_app_data12.BUILD.hydrateServerSide) {
2519
+ if (import_app_data13.BUILD.hasRenderFn || import_app_data13.BUILD.reflect) {
2520
+ if (import_app_data13.BUILD.vdomRender || import_app_data13.BUILD.reflect) {
2521
+ if (import_app_data13.BUILD.hydrateServerSide) {
2403
2522
  return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
2404
2523
  } else {
2405
2524
  renderVdom(hostRef, instance, isInitialLoad);
@@ -2424,57 +2543,57 @@ var postUpdateComponent = (hostRef) => {
2424
2543
  const tagName = hostRef.$cmpMeta$.$tagName$;
2425
2544
  const elm = hostRef.$hostElement$;
2426
2545
  const endPostUpdate = createTime("postUpdate", tagName);
2427
- const instance = import_app_data12.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2546
+ const instance = import_app_data13.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2428
2547
  const ancestorComponent = hostRef.$ancestorComponent$;
2429
- if (import_app_data12.BUILD.cmpDidRender) {
2430
- if (import_app_data12.BUILD.isDev) {
2548
+ if (import_app_data13.BUILD.cmpDidRender) {
2549
+ if (import_app_data13.BUILD.isDev) {
2431
2550
  hostRef.$flags$ |= 1024 /* devOnRender */;
2432
2551
  }
2433
2552
  safeCall(instance, "componentDidRender");
2434
- if (import_app_data12.BUILD.isDev) {
2553
+ if (import_app_data13.BUILD.isDev) {
2435
2554
  hostRef.$flags$ &= ~1024 /* devOnRender */;
2436
2555
  }
2437
2556
  }
2438
2557
  emitLifecycleEvent(elm, "componentDidRender");
2439
2558
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
2440
2559
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
2441
- if (import_app_data12.BUILD.asyncLoading && import_app_data12.BUILD.cssAnnotations) {
2560
+ if (import_app_data13.BUILD.asyncLoading && import_app_data13.BUILD.cssAnnotations) {
2442
2561
  addHydratedFlag(elm);
2443
2562
  }
2444
- if (import_app_data12.BUILD.cmpDidLoad) {
2445
- if (import_app_data12.BUILD.isDev) {
2563
+ if (import_app_data13.BUILD.cmpDidLoad) {
2564
+ if (import_app_data13.BUILD.isDev) {
2446
2565
  hostRef.$flags$ |= 2048 /* devOnDidLoad */;
2447
2566
  }
2448
2567
  safeCall(instance, "componentDidLoad");
2449
- if (import_app_data12.BUILD.isDev) {
2568
+ if (import_app_data13.BUILD.isDev) {
2450
2569
  hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
2451
2570
  }
2452
2571
  }
2453
2572
  emitLifecycleEvent(elm, "componentDidLoad");
2454
2573
  endPostUpdate();
2455
- if (import_app_data12.BUILD.asyncLoading) {
2574
+ if (import_app_data13.BUILD.asyncLoading) {
2456
2575
  hostRef.$onReadyResolve$(elm);
2457
2576
  if (!ancestorComponent) {
2458
2577
  appDidLoad(tagName);
2459
2578
  }
2460
2579
  }
2461
2580
  } else {
2462
- if (import_app_data12.BUILD.cmpDidUpdate) {
2463
- if (import_app_data12.BUILD.isDev) {
2581
+ if (import_app_data13.BUILD.cmpDidUpdate) {
2582
+ if (import_app_data13.BUILD.isDev) {
2464
2583
  hostRef.$flags$ |= 1024 /* devOnRender */;
2465
2584
  }
2466
2585
  safeCall(instance, "componentDidUpdate");
2467
- if (import_app_data12.BUILD.isDev) {
2586
+ if (import_app_data13.BUILD.isDev) {
2468
2587
  hostRef.$flags$ &= ~1024 /* devOnRender */;
2469
2588
  }
2470
2589
  }
2471
2590
  emitLifecycleEvent(elm, "componentDidUpdate");
2472
2591
  endPostUpdate();
2473
2592
  }
2474
- if (import_app_data12.BUILD.method && import_app_data12.BUILD.lazyLoad) {
2593
+ if (import_app_data13.BUILD.method && import_app_data13.BUILD.lazyLoad) {
2475
2594
  hostRef.$onInstanceResolve$(elm);
2476
2595
  }
2477
- if (import_app_data12.BUILD.asyncLoading) {
2596
+ if (import_app_data13.BUILD.asyncLoading) {
2478
2597
  if (hostRef.$onRenderResolve$) {
2479
2598
  hostRef.$onRenderResolve$();
2480
2599
  hostRef.$onRenderResolve$ = void 0;
@@ -2486,7 +2605,7 @@ var postUpdateComponent = (hostRef) => {
2486
2605
  }
2487
2606
  };
2488
2607
  var forceUpdate = (ref) => {
2489
- if (import_app_data12.BUILD.updatable && (Build.isBrowser || Build.isTesting)) {
2608
+ if (import_app_data13.BUILD.updatable && (Build.isBrowser || Build.isTesting)) {
2490
2609
  const hostRef = getHostRef(ref);
2491
2610
  const isConnected = hostRef.$hostElement$.isConnected;
2492
2611
  if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
@@ -2497,15 +2616,15 @@ var forceUpdate = (ref) => {
2497
2616
  return false;
2498
2617
  };
2499
2618
  var appDidLoad = (who) => {
2500
- if (import_app_data12.BUILD.cssAnnotations) {
2619
+ if (import_app_data13.BUILD.cssAnnotations) {
2501
2620
  addHydratedFlag(doc.documentElement);
2502
2621
  }
2503
- if (import_app_data12.BUILD.asyncQueue) {
2622
+ if (import_app_data13.BUILD.asyncQueue) {
2504
2623
  plt.$flags$ |= 2 /* appLoaded */;
2505
2624
  }
2506
- nextTick(() => emitEvent(win, "appload", { detail: { namespace: import_app_data12.NAMESPACE } }));
2507
- if (import_app_data12.BUILD.profile && performance.measure) {
2508
- performance.measure(`[Rindo] ${import_app_data12.NAMESPACE} initial load (by ${who})`, "st:app:start");
2625
+ nextTick(() => emitEvent(win, "appload", { detail: { namespace: import_app_data13.NAMESPACE } }));
2626
+ if (import_app_data13.BUILD.profile && performance.measure) {
2627
+ performance.measure(`[Rindo] ${import_app_data13.NAMESPACE} initial load (by ${who})`, "st:app:start");
2509
2628
  }
2510
2629
  };
2511
2630
  var safeCall = (instance, method, arg) => {
@@ -2519,19 +2638,19 @@ var safeCall = (instance, method, arg) => {
2519
2638
  return void 0;
2520
2639
  };
2521
2640
  var emitLifecycleEvent = (elm, lifecycleName) => {
2522
- if (import_app_data12.BUILD.lifecycleDOMEvents) {
2641
+ if (import_app_data13.BUILD.lifecycleDOMEvents) {
2523
2642
  emitEvent(elm, "rindo_" + lifecycleName, {
2524
2643
  bubbles: true,
2525
2644
  composed: true,
2526
2645
  detail: {
2527
- namespace: import_app_data12.NAMESPACE
2646
+ namespace: import_app_data13.NAMESPACE
2528
2647
  }
2529
2648
  });
2530
2649
  }
2531
2650
  };
2532
2651
  var addHydratedFlag = (elm) => {
2533
2652
  var _a, _b;
2534
- return import_app_data12.BUILD.hydratedClass ? elm.classList.add((_a = import_app_data12.BUILD.hydratedSelectorName) != null ? _a : "hydrated") : import_app_data12.BUILD.hydratedAttribute ? elm.setAttribute((_b = import_app_data12.BUILD.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
2653
+ return import_app_data13.BUILD.hydratedClass ? elm.classList.add((_a = import_app_data13.BUILD.hydratedSelectorName) != null ? _a : "hydrated") : import_app_data13.BUILD.hydratedAttribute ? elm.setAttribute((_b = import_app_data13.BUILD.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
2535
2654
  };
2536
2655
  var serverSideConnected = (elm) => {
2537
2656
  const children = elm.children;
@@ -2550,21 +2669,21 @@ var serverSideConnected = (elm) => {
2550
2669
  var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
2551
2670
  var setValue = (ref, propName, newVal, cmpMeta) => {
2552
2671
  const hostRef = getHostRef(ref);
2553
- if (import_app_data13.BUILD.lazyLoad && !hostRef) {
2672
+ if (import_app_data14.BUILD.lazyLoad && !hostRef) {
2554
2673
  throw new Error(
2555
2674
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Rindo runtime. This usually happens when integrating a 3rd party Rindo component with another Rindo component or application.`
2556
2675
  );
2557
2676
  }
2558
- const elm = import_app_data13.BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
2677
+ const elm = import_app_data14.BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
2559
2678
  const oldVal = hostRef.$instanceValues$.get(propName);
2560
2679
  const flags = hostRef.$flags$;
2561
- const instance = import_app_data13.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2680
+ const instance = import_app_data14.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2562
2681
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
2563
2682
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
2564
2683
  const didValueChange = newVal !== oldVal && !areBothNaN;
2565
- if ((!import_app_data13.BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
2684
+ if ((!import_app_data14.BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
2566
2685
  hostRef.$instanceValues$.set(propName, newVal);
2567
- if (import_app_data13.BUILD.isDev) {
2686
+ if (import_app_data14.BUILD.isDev) {
2568
2687
  if (hostRef.$flags$ & 1024 /* devOnRender */) {
2569
2688
  consoleDevWarn(
2570
2689
  `The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,
@@ -2587,8 +2706,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2587
2706
  );
2588
2707
  }
2589
2708
  }
2590
- if (!import_app_data13.BUILD.lazyLoad || instance) {
2591
- if (import_app_data13.BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
2709
+ if (!import_app_data14.BUILD.lazyLoad || instance) {
2710
+ if (import_app_data14.BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
2592
2711
  const watchMethods = cmpMeta.$watchers$[propName];
2593
2712
  if (watchMethods) {
2594
2713
  watchMethods.map((watchMethodName) => {
@@ -2600,8 +2719,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2600
2719
  });
2601
2720
  }
2602
2721
  }
2603
- if (import_app_data13.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2604
- if (import_app_data13.BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
2722
+ if (import_app_data14.BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2723
+ if (import_app_data14.BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
2605
2724
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
2606
2725
  return;
2607
2726
  }
@@ -2616,40 +2735,40 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2616
2735
  var proxyComponent = (Cstr, cmpMeta, flags) => {
2617
2736
  var _a, _b;
2618
2737
  const prototype = Cstr.prototype;
2619
- if (import_app_data14.BUILD.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
2738
+ if (import_app_data15.BUILD.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
2620
2739
  FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
2621
2740
  const originalFormAssociatedCallback = prototype[cbName];
2622
2741
  Object.defineProperty(prototype, cbName, {
2623
2742
  value(...args) {
2624
2743
  const hostRef = getHostRef(this);
2625
- const instance = import_app_data14.BUILD.lazyLoad ? hostRef.$lazyInstance$ : this;
2744
+ const instance = import_app_data15.BUILD.lazyLoad ? hostRef.$lazyInstance$ : this;
2626
2745
  if (!instance) {
2627
2746
  hostRef.$onReadyPromise$.then((asyncInstance) => {
2628
2747
  const cb = asyncInstance[cbName];
2629
2748
  typeof cb === "function" && cb.call(asyncInstance, ...args);
2630
2749
  });
2631
2750
  } else {
2632
- const cb = import_app_data14.BUILD.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
2751
+ const cb = import_app_data15.BUILD.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
2633
2752
  typeof cb === "function" && cb.call(instance, ...args);
2634
2753
  }
2635
2754
  }
2636
2755
  });
2637
2756
  });
2638
2757
  }
2639
- if (import_app_data14.BUILD.member && cmpMeta.$members$ || import_app_data14.BUILD.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
2640
- if (import_app_data14.BUILD.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
2758
+ if (import_app_data15.BUILD.member && cmpMeta.$members$ || import_app_data15.BUILD.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
2759
+ if (import_app_data15.BUILD.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
2641
2760
  cmpMeta.$watchers$ = Cstr.watchers;
2642
2761
  }
2643
2762
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
2644
2763
  members.map(([memberName, [memberFlags]]) => {
2645
- if ((import_app_data14.BUILD.prop || import_app_data14.BUILD.state) && (memberFlags & 31 /* Prop */ || (!import_app_data14.BUILD.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
2764
+ if ((import_app_data15.BUILD.prop || import_app_data15.BUILD.state) && (memberFlags & 31 /* Prop */ || (!import_app_data15.BUILD.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
2646
2765
  if ((memberFlags & 2048 /* Getter */) === 0) {
2647
2766
  Object.defineProperty(prototype, memberName, {
2648
2767
  get() {
2649
2768
  return getValue(this, memberName);
2650
2769
  },
2651
2770
  set(newValue) {
2652
- if (import_app_data14.BUILD.isDev) {
2771
+ if (import_app_data15.BUILD.isDev) {
2653
2772
  const ref = getHostRef(this);
2654
2773
  if (
2655
2774
  // we are proxying the instance (not element)
@@ -2670,11 +2789,11 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2670
2789
  enumerable: true
2671
2790
  });
2672
2791
  } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
2673
- if (import_app_data14.BUILD.lazyLoad) {
2792
+ if (import_app_data15.BUILD.lazyLoad) {
2674
2793
  Object.defineProperty(prototype, memberName, {
2675
2794
  get() {
2676
2795
  const ref = getHostRef(this);
2677
- const instance = import_app_data14.BUILD.lazyLoad && ref ? ref.$lazyInstance$ : prototype;
2796
+ const instance = import_app_data15.BUILD.lazyLoad && ref ? ref.$lazyInstance$ : prototype;
2678
2797
  if (!instance) return;
2679
2798
  return instance[memberName];
2680
2799
  },
@@ -2714,7 +2833,7 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2714
2833
  });
2715
2834
  }
2716
2835
  }
2717
- } else if (import_app_data14.BUILD.lazyLoad && import_app_data14.BUILD.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2836
+ } else if (import_app_data15.BUILD.lazyLoad && import_app_data15.BUILD.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2718
2837
  Object.defineProperty(prototype, memberName, {
2719
2838
  value(...args) {
2720
2839
  var _a2;
@@ -2727,13 +2846,13 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2727
2846
  });
2728
2847
  }
2729
2848
  });
2730
- if (import_app_data14.BUILD.observeAttribute && (!import_app_data14.BUILD.lazyLoad || flags & 1 /* isElementConstructor */)) {
2849
+ if (import_app_data15.BUILD.observeAttribute && (!import_app_data15.BUILD.lazyLoad || flags & 1 /* isElementConstructor */)) {
2731
2850
  const attrNameToPropName = /* @__PURE__ */ new Map();
2732
2851
  prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
2733
2852
  plt.jmp(() => {
2734
2853
  var _a2;
2735
2854
  const propName = attrNameToPropName.get(attrName);
2736
- if (this.hasOwnProperty(propName)) {
2855
+ if (this.hasOwnProperty(propName) && import_app_data15.BUILD.lazyLoad) {
2737
2856
  newValue = this[propName];
2738
2857
  delete this[propName];
2739
2858
  } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
@@ -2743,8 +2862,8 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2743
2862
  const hostRef = getHostRef(this);
2744
2863
  const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
2745
2864
  if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
2746
- const elm = import_app_data14.BUILD.lazyLoad ? hostRef.$hostElement$ : this;
2747
- const instance = import_app_data14.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2865
+ const elm = import_app_data15.BUILD.lazyLoad ? hostRef.$hostElement$ : this;
2866
+ const instance = import_app_data15.BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2748
2867
  const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
2749
2868
  entry == null ? void 0 : entry.forEach((callbackName) => {
2750
2869
  if (instance[callbackName] != null) {
@@ -2767,7 +2886,7 @@ More information: https://rindojs.web.app/docs/properties#prop-mutability`
2767
2886
  var _a2;
2768
2887
  const attrName = m[1] || propName;
2769
2888
  attrNameToPropName.set(attrName, propName);
2770
- if (import_app_data14.BUILD.reflect && m[0] & 512 /* ReflectAttr */) {
2889
+ if (import_app_data15.BUILD.reflect && m[0] & 512 /* ReflectAttr */) {
2771
2890
  (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
2772
2891
  }
2773
2892
  return attrName;
@@ -2785,7 +2904,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2785
2904
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
2786
2905
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2787
2906
  const bundleId = cmpMeta.$lazyBundleId$;
2788
- if ((import_app_data15.BUILD.lazyLoad || import_app_data15.BUILD.hydrateClientSide) && bundleId) {
2907
+ if ((import_app_data16.BUILD.lazyLoad || import_app_data16.BUILD.hydrateClientSide) && bundleId) {
2789
2908
  const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
2790
2909
  if (CstrImport && "then" in CstrImport) {
2791
2910
  const endLoad = uniqueTime(
@@ -2800,15 +2919,15 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2800
2919
  if (!Cstr) {
2801
2920
  throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2802
2921
  }
2803
- if (import_app_data15.BUILD.member && !Cstr.isProxied) {
2804
- if (import_app_data15.BUILD.watchCallback) {
2922
+ if (import_app_data16.BUILD.member && !Cstr.isProxied) {
2923
+ if (import_app_data16.BUILD.watchCallback) {
2805
2924
  cmpMeta.$watchers$ = Cstr.watchers;
2806
2925
  }
2807
2926
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
2808
2927
  Cstr.isProxied = true;
2809
2928
  }
2810
2929
  const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
2811
- if (import_app_data15.BUILD.member) {
2930
+ if (import_app_data16.BUILD.member) {
2812
2931
  hostRef.$flags$ |= 8 /* isConstructingInstance */;
2813
2932
  }
2814
2933
  try {
@@ -2816,10 +2935,10 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2816
2935
  } catch (e) {
2817
2936
  consoleError(e);
2818
2937
  }
2819
- if (import_app_data15.BUILD.member) {
2938
+ if (import_app_data16.BUILD.member) {
2820
2939
  hostRef.$flags$ &= ~8 /* isConstructingInstance */;
2821
2940
  }
2822
- if (import_app_data15.BUILD.watchCallback) {
2941
+ if (import_app_data16.BUILD.watchCallback) {
2823
2942
  hostRef.$flags$ |= 128 /* isWatchReady */;
2824
2943
  }
2825
2944
  endNewInstance();
@@ -2829,24 +2948,24 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2829
2948
  const cmpTag = elm.localName;
2830
2949
  customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
2831
2950
  }
2832
- if (import_app_data15.BUILD.style && Cstr && Cstr.style) {
2951
+ if (import_app_data16.BUILD.style && Cstr && Cstr.style) {
2833
2952
  let style;
2834
2953
  if (typeof Cstr.style === "string") {
2835
2954
  style = Cstr.style;
2836
- } else if (import_app_data15.BUILD.mode && typeof Cstr.style !== "string") {
2955
+ } else if (import_app_data16.BUILD.mode && typeof Cstr.style !== "string") {
2837
2956
  hostRef.$modeName$ = computeMode(elm);
2838
2957
  if (hostRef.$modeName$) {
2839
2958
  style = Cstr.style[hostRef.$modeName$];
2840
2959
  }
2841
- if (import_app_data15.BUILD.hydrateServerSide && hostRef.$modeName$) {
2960
+ if (import_app_data16.BUILD.hydrateServerSide && hostRef.$modeName$) {
2842
2961
  elm.setAttribute("s-mode", hostRef.$modeName$);
2843
2962
  }
2844
2963
  }
2845
2964
  const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
2846
2965
  if (!styles.has(scopeId2)) {
2847
2966
  const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
2848
- if (!import_app_data15.BUILD.hydrateServerSide && import_app_data15.BUILD.shadowDom && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2849
- import_app_data15.BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2967
+ if (!import_app_data16.BUILD.hydrateServerSide && import_app_data16.BUILD.shadowDom && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2968
+ import_app_data16.BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2850
2969
  style = await import("../client/shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
2851
2970
  }
2852
2971
  registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
@@ -2856,14 +2975,14 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2856
2975
  }
2857
2976
  const ancestorComponent = hostRef.$ancestorComponent$;
2858
2977
  const schedule = () => scheduleUpdate(hostRef, true);
2859
- if (import_app_data15.BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
2978
+ if (import_app_data16.BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
2860
2979
  ancestorComponent["s-rc"].push(schedule);
2861
2980
  } else {
2862
2981
  schedule();
2863
2982
  }
2864
2983
  };
2865
2984
  var fireConnectedCallback = (instance) => {
2866
- if (import_app_data15.BUILD.lazyLoad && import_app_data15.BUILD.connectedCallback) {
2985
+ if (import_app_data16.BUILD.lazyLoad && import_app_data16.BUILD.connectedCallback) {
2867
2986
  safeCall(instance, "connectedCallback");
2868
2987
  }
2869
2988
  };
@@ -2874,41 +2993,41 @@ var connectedCallback = (elm) => {
2874
2993
  const hostRef = getHostRef(elm);
2875
2994
  const cmpMeta = hostRef.$cmpMeta$;
2876
2995
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
2877
- if (import_app_data16.BUILD.hostListenerTargetParent) {
2996
+ if (import_app_data17.BUILD.hostListenerTargetParent) {
2878
2997
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2879
2998
  }
2880
2999
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2881
3000
  hostRef.$flags$ |= 1 /* hasConnected */;
2882
3001
  let hostId;
2883
- if (import_app_data16.BUILD.hydrateClientSide) {
3002
+ if (import_app_data17.BUILD.hydrateClientSide) {
2884
3003
  hostId = elm.getAttribute(HYDRATE_ID);
2885
3004
  if (hostId) {
2886
- if (import_app_data16.BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2887
- const scopeId2 = import_app_data16.BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
3005
+ if (import_app_data17.BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3006
+ const scopeId2 = import_app_data17.BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
2888
3007
  elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
2889
- } else if (import_app_data16.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2890
- const scopeId2 = getScopeId(cmpMeta, import_app_data16.BUILD.mode ? elm.getAttribute("s-mode") : void 0);
3008
+ } else if (import_app_data17.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3009
+ const scopeId2 = getScopeId(cmpMeta, import_app_data17.BUILD.mode ? elm.getAttribute("s-mode") : void 0);
2891
3010
  elm["s-sc"] = scopeId2;
2892
3011
  }
2893
3012
  initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2894
3013
  }
2895
3014
  }
2896
- if (import_app_data16.BUILD.slotRelocation && !hostId) {
2897
- if (import_app_data16.BUILD.hydrateServerSide || (import_app_data16.BUILD.slot || import_app_data16.BUILD.shadowDom) && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
3015
+ if (import_app_data17.BUILD.slotRelocation && !hostId) {
3016
+ if (import_app_data17.BUILD.hydrateServerSide || (import_app_data17.BUILD.slot || import_app_data17.BUILD.shadowDom) && // TODO(RINDO-854): Remove code related to legacy shadowDomShim field
2898
3017
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
2899
3018
  setContentReference(elm);
2900
3019
  }
2901
3020
  }
2902
- if (import_app_data16.BUILD.asyncLoading) {
3021
+ if (import_app_data17.BUILD.asyncLoading) {
2903
3022
  let ancestorComponent = elm;
2904
3023
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
2905
- if (import_app_data16.BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
3024
+ if (import_app_data17.BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
2906
3025
  attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
2907
3026
  break;
2908
3027
  }
2909
3028
  }
2910
3029
  }
2911
- if (import_app_data16.BUILD.prop && !import_app_data16.BUILD.hydrateServerSide && cmpMeta.$members$) {
3030
+ if (import_app_data17.BUILD.prop && !import_app_data17.BUILD.hydrateServerSide && cmpMeta.$members$) {
2912
3031
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2913
3032
  if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2914
3033
  const value = elm[memberName];
@@ -2917,7 +3036,7 @@ var connectedCallback = (elm) => {
2917
3036
  }
2918
3037
  });
2919
3038
  }
2920
- if (import_app_data16.BUILD.initializeNextTick) {
3039
+ if (import_app_data17.BUILD.initializeNextTick) {
2921
3040
  nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2922
3041
  } else {
2923
3042
  initializeComponent(elm, hostRef, cmpMeta);
@@ -2935,32 +3054,32 @@ var connectedCallback = (elm) => {
2935
3054
  };
2936
3055
  var setContentReference = (elm) => {
2937
3056
  const contentRefElm = elm["s-cr"] = doc.createComment(
2938
- import_app_data16.BUILD.isDebug ? `content-ref (host=${elm.localName})` : ""
3057
+ import_app_data17.BUILD.isDebug ? `content-ref (host=${elm.localName})` : ""
2939
3058
  );
2940
3059
  contentRefElm["s-cn"] = true;
2941
3060
  insertBefore(elm, contentRefElm, elm.firstChild);
2942
3061
  };
2943
3062
 
2944
3063
  // src/runtime/disconnected-callback.ts
2945
- var import_app_data17 = require("@rindo/core/internal/app-data");
3064
+ var import_app_data18 = require("@rindo/core/internal/app-data");
2946
3065
  var disconnectInstance = (instance) => {
2947
- if (import_app_data17.BUILD.lazyLoad && import_app_data17.BUILD.disconnectedCallback) {
3066
+ if (import_app_data18.BUILD.lazyLoad && import_app_data18.BUILD.disconnectedCallback) {
2948
3067
  safeCall(instance, "disconnectedCallback");
2949
3068
  }
2950
- if (import_app_data17.BUILD.cmpDidUnload) {
3069
+ if (import_app_data18.BUILD.cmpDidUnload) {
2951
3070
  safeCall(instance, "componentDidUnload");
2952
3071
  }
2953
3072
  };
2954
3073
  var disconnectedCallback = async (elm) => {
2955
3074
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2956
3075
  const hostRef = getHostRef(elm);
2957
- if (import_app_data17.BUILD.hostListener) {
3076
+ if (import_app_data18.BUILD.hostListener) {
2958
3077
  if (hostRef.$rmListeners$) {
2959
3078
  hostRef.$rmListeners$.map((rmListener) => rmListener());
2960
3079
  hostRef.$rmListeners$ = void 0;
2961
3080
  }
2962
3081
  }
2963
- if (!import_app_data17.BUILD.lazyLoad) {
3082
+ if (!import_app_data18.BUILD.lazyLoad) {
2964
3083
  disconnectInstance(elm);
2965
3084
  } else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2966
3085
  disconnectInstance(hostRef.$lazyInstance$);
@@ -2968,6 +3087,12 @@ var disconnectedCallback = async (elm) => {
2968
3087
  hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2969
3088
  }
2970
3089
  }
3090
+ if (rootAppliedStyles.has(elm)) {
3091
+ rootAppliedStyles.delete(elm);
3092
+ }
3093
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
3094
+ rootAppliedStyles.delete(elm.shadowRoot);
3095
+ }
2971
3096
  };
2972
3097
 
2973
3098
  // src/runtime/bootstrap-custom-element.ts
@@ -2979,36 +3104,36 @@ var proxyCustomElement = (Cstr, compactMeta) => {
2979
3104
  $flags$: compactMeta[0],
2980
3105
  $tagName$: compactMeta[1]
2981
3106
  };
2982
- if (import_app_data18.BUILD.member) {
3107
+ if (import_app_data19.BUILD.member) {
2983
3108
  cmpMeta.$members$ = compactMeta[2];
2984
3109
  }
2985
- if (import_app_data18.BUILD.hostListener) {
3110
+ if (import_app_data19.BUILD.hostListener) {
2986
3111
  cmpMeta.$listeners$ = compactMeta[3];
2987
3112
  }
2988
- if (import_app_data18.BUILD.watchCallback) {
3113
+ if (import_app_data19.BUILD.watchCallback) {
2989
3114
  cmpMeta.$watchers$ = Cstr.$watchers$;
2990
3115
  }
2991
- if (import_app_data18.BUILD.reflect) {
3116
+ if (import_app_data19.BUILD.reflect) {
2992
3117
  cmpMeta.$attrsToReflect$ = [];
2993
3118
  }
2994
- if (import_app_data18.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3119
+ if (import_app_data19.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2995
3120
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2996
3121
  }
2997
- if (import_app_data18.BUILD.experimentalSlotFixes) {
2998
- if (import_app_data18.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3122
+ if (import_app_data19.BUILD.experimentalSlotFixes) {
3123
+ if (import_app_data19.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2999
3124
  patchPseudoShadowDom(Cstr.prototype);
3000
3125
  }
3001
3126
  } else {
3002
- if (import_app_data18.BUILD.slotChildNodesFix) {
3127
+ if (import_app_data19.BUILD.slotChildNodesFix) {
3003
3128
  patchChildSlotNodes(Cstr.prototype);
3004
3129
  }
3005
- if (import_app_data18.BUILD.cloneNodeFix) {
3130
+ if (import_app_data19.BUILD.cloneNodeFix) {
3006
3131
  patchCloneNode(Cstr.prototype);
3007
3132
  }
3008
- if (import_app_data18.BUILD.appendChildSlotFix) {
3133
+ if (import_app_data19.BUILD.appendChildSlotFix) {
3009
3134
  patchSlotAppendChild(Cstr.prototype);
3010
3135
  }
3011
- if (import_app_data18.BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3136
+ if (import_app_data19.BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3012
3137
  patchTextContent(Cstr.prototype);
3013
3138
  }
3014
3139
  }
@@ -3026,20 +3151,30 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3026
3151
  this.__hasHostListenerAttached = true;
3027
3152
  }
3028
3153
  connectedCallback(this);
3029
- if (import_app_data18.BUILD.connectedCallback && originalConnectedCallback) {
3154
+ if (import_app_data19.BUILD.connectedCallback && originalConnectedCallback) {
3030
3155
  originalConnectedCallback.call(this);
3031
3156
  }
3032
3157
  },
3033
3158
  disconnectedCallback() {
3034
3159
  disconnectedCallback(this);
3035
- if (import_app_data18.BUILD.disconnectedCallback && originalDisconnectedCallback) {
3160
+ if (import_app_data19.BUILD.disconnectedCallback && originalDisconnectedCallback) {
3036
3161
  originalDisconnectedCallback.call(this);
3037
3162
  }
3163
+ plt.raf(() => {
3164
+ var _a;
3165
+ const hostRef = getHostRef(this);
3166
+ if (((_a = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
3167
+ delete hostRef.$vnode$;
3168
+ }
3169
+ if (this instanceof Node && !this.isConnected) {
3170
+ deleteHostRef(this);
3171
+ }
3172
+ });
3038
3173
  },
3039
3174
  __attachShadow() {
3040
3175
  if (supportsShadow) {
3041
3176
  if (!this.shadowRoot) {
3042
- if (import_app_data18.BUILD.shadowDelegatesFocus) {
3177
+ if (import_app_data19.BUILD.shadowDelegatesFocus) {
3043
3178
  this.attachShadow({
3044
3179
  mode: "open",
3045
3180
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
@@ -3063,7 +3198,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3063
3198
  return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
3064
3199
  };
3065
3200
  var forceModeUpdate = (elm) => {
3066
- if (import_app_data18.BUILD.style && import_app_data18.BUILD.mode && !import_app_data18.BUILD.lazyLoad) {
3201
+ if (import_app_data19.BUILD.style && import_app_data19.BUILD.mode && !import_app_data19.BUILD.lazyLoad) {
3067
3202
  const mode = computeMode(elm);
3068
3203
  const hostRef = getHostRef(elm);
3069
3204
  if (hostRef.$modeName$ !== mode) {
@@ -3086,7 +3221,7 @@ var forceModeUpdate = (elm) => {
3086
3221
  };
3087
3222
 
3088
3223
  // src/runtime/bootstrap-lazy.ts
3089
- var import_app_data19 = require("@rindo/core/internal/app-data");
3224
+ var import_app_data20 = require("@rindo/core/internal/app-data");
3090
3225
 
3091
3226
  // src/runtime/hmr-component.ts
3092
3227
  var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
@@ -3098,7 +3233,7 @@ var hmrStart = (hostElement, cmpMeta, hmrVersionId) => {
3098
3233
  // src/runtime/bootstrap-lazy.ts
3099
3234
  var bootstrapLazy = (lazyBundles, options = {}) => {
3100
3235
  var _a;
3101
- if (import_app_data19.BUILD.profile && performance.mark) {
3236
+ if (import_app_data20.BUILD.profile && performance.mark) {
3102
3237
  performance.mark("st:app:start");
3103
3238
  }
3104
3239
  installDevTools();
@@ -3114,12 +3249,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3114
3249
  let isBootstrapping = true;
3115
3250
  Object.assign(plt, options);
3116
3251
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
3117
- if (import_app_data19.BUILD.asyncQueue) {
3252
+ if (import_app_data20.BUILD.asyncQueue) {
3118
3253
  if (options.syncQueue) {
3119
3254
  plt.$flags$ |= 4 /* queueSync */;
3120
3255
  }
3121
3256
  }
3122
- if (import_app_data19.BUILD.hydrateClientSide) {
3257
+ if (import_app_data20.BUILD.hydrateClientSide) {
3123
3258
  plt.$flags$ |= 2 /* appLoaded */;
3124
3259
  }
3125
3260
  let hasSlotRelocation = false;
@@ -3135,22 +3270,22 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3135
3270
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
3136
3271
  hasSlotRelocation = true;
3137
3272
  }
3138
- if (import_app_data19.BUILD.member) {
3273
+ if (import_app_data20.BUILD.member) {
3139
3274
  cmpMeta.$members$ = compactMeta[2];
3140
3275
  }
3141
- if (import_app_data19.BUILD.hostListener) {
3276
+ if (import_app_data20.BUILD.hostListener) {
3142
3277
  cmpMeta.$listeners$ = compactMeta[3];
3143
3278
  }
3144
- if (import_app_data19.BUILD.reflect) {
3279
+ if (import_app_data20.BUILD.reflect) {
3145
3280
  cmpMeta.$attrsToReflect$ = [];
3146
3281
  }
3147
- if (import_app_data19.BUILD.watchCallback) {
3282
+ if (import_app_data20.BUILD.watchCallback) {
3148
3283
  cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
3149
3284
  }
3150
- if (import_app_data19.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3285
+ if (import_app_data20.BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3151
3286
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
3152
3287
  }
3153
- const tagName = import_app_data19.BUILD.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
3288
+ const tagName = import_app_data20.BUILD.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
3154
3289
  const HostElement = class extends HTMLElement {
3155
3290
  // RindoLazyHost
3156
3291
  constructor(self) {
@@ -3158,10 +3293,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3158
3293
  this.hasRegisteredEventListeners = false;
3159
3294
  self = this;
3160
3295
  registerHost(self, cmpMeta);
3161
- if (import_app_data19.BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3296
+ if (import_app_data20.BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
3162
3297
  if (supportsShadow) {
3163
3298
  if (!self.shadowRoot) {
3164
- if (import_app_data19.BUILD.shadowDelegatesFocus) {
3299
+ if (import_app_data20.BUILD.shadowDelegatesFocus) {
3165
3300
  self.attachShadow({
3166
3301
  mode: "open",
3167
3302
  delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
@@ -3176,7 +3311,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3176
3311
  );
3177
3312
  }
3178
3313
  }
3179
- } else if (!import_app_data19.BUILD.hydrateServerSide && !("shadowRoot" in self)) {
3314
+ } else if (!import_app_data20.BUILD.hydrateServerSide && !("shadowRoot" in self)) {
3180
3315
  self.shadowRoot = self;
3181
3316
  }
3182
3317
  }
@@ -3199,33 +3334,40 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3199
3334
  }
3200
3335
  disconnectedCallback() {
3201
3336
  plt.jmp(() => disconnectedCallback(this));
3337
+ plt.raf(() => {
3338
+ var _a3;
3339
+ const hostRef = getHostRef(this);
3340
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
3341
+ delete hostRef.$vnode$.$elm$;
3342
+ }
3343
+ });
3202
3344
  }
3203
3345
  componentOnReady() {
3204
3346
  return getHostRef(this).$onReadyPromise$;
3205
3347
  }
3206
3348
  };
3207
- if (import_app_data19.BUILD.experimentalSlotFixes) {
3208
- if (import_app_data19.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3349
+ if (import_app_data20.BUILD.experimentalSlotFixes) {
3350
+ if (import_app_data20.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3209
3351
  patchPseudoShadowDom(HostElement.prototype);
3210
3352
  }
3211
3353
  } else {
3212
- if (import_app_data19.BUILD.slotChildNodesFix) {
3354
+ if (import_app_data20.BUILD.slotChildNodesFix) {
3213
3355
  patchChildSlotNodes(HostElement.prototype);
3214
3356
  }
3215
- if (import_app_data19.BUILD.cloneNodeFix) {
3357
+ if (import_app_data20.BUILD.cloneNodeFix) {
3216
3358
  patchCloneNode(HostElement.prototype);
3217
3359
  }
3218
- if (import_app_data19.BUILD.appendChildSlotFix) {
3360
+ if (import_app_data20.BUILD.appendChildSlotFix) {
3219
3361
  patchSlotAppendChild(HostElement.prototype);
3220
3362
  }
3221
- if (import_app_data19.BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3363
+ if (import_app_data20.BUILD.scopedSlotTextContentFix && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3222
3364
  patchTextContent(HostElement.prototype);
3223
3365
  }
3224
3366
  }
3225
- if (import_app_data19.BUILD.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */) {
3367
+ if (import_app_data20.BUILD.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */) {
3226
3368
  HostElement.formAssociated = true;
3227
3369
  }
3228
- if (import_app_data19.BUILD.hotModuleReplacement) {
3370
+ if (import_app_data20.BUILD.hotModuleReplacement) {
3229
3371
  HostElement.prototype["s-hmr"] = function(hmrVersionId) {
3230
3372
  hmrStart(this, cmpMeta, hmrVersionId);
3231
3373
  };
@@ -3244,7 +3386,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3244
3386
  if (hasSlotRelocation) {
3245
3387
  dataStyles.textContent += SLOT_FB_CSS;
3246
3388
  }
3247
- if (import_app_data19.BUILD.invisiblePrehydration && (import_app_data19.BUILD.hydratedClass || import_app_data19.BUILD.hydratedAttribute)) {
3389
+ if (import_app_data20.BUILD.invisiblePrehydration && (import_app_data20.BUILD.hydratedClass || import_app_data20.BUILD.hydratedAttribute)) {
3248
3390
  dataStyles.textContent += cmpTags.sort() + HYDRATED_CSS;
3249
3391
  }
3250
3392
  if (dataStyles.innerHTML.length) {
@@ -3260,7 +3402,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3260
3402
  if (deferredConnectedCallbacks.length) {
3261
3403
  deferredConnectedCallbacks.map((host) => host.connectedCallback());
3262
3404
  } else {
3263
- if (import_app_data19.BUILD.profile) {
3405
+ if (import_app_data20.BUILD.profile) {
3264
3406
  plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, "timeout"));
3265
3407
  } else {
3266
3408
  plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30));
@@ -3273,10 +3415,10 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
3273
3415
  var Fragment = (_, children) => children;
3274
3416
 
3275
3417
  // src/runtime/host-listener.ts
3276
- var import_app_data20 = require("@rindo/core/internal/app-data");
3418
+ var import_app_data21 = require("@rindo/core/internal/app-data");
3277
3419
  var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
3278
- if (import_app_data20.BUILD.hostListener && listeners) {
3279
- if (import_app_data20.BUILD.hostListenerTargetParent) {
3420
+ if (import_app_data21.BUILD.hostListener && listeners) {
3421
+ if (import_app_data21.BUILD.hostListenerTargetParent) {
3280
3422
  if (attachParentListeners) {
3281
3423
  listeners = listeners.filter(([flags]) => flags & 32 /* TargetParent */);
3282
3424
  } else {
@@ -3284,7 +3426,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
3284
3426
  }
3285
3427
  }
3286
3428
  listeners.map(([flags, name, method]) => {
3287
- const target = import_app_data20.BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
3429
+ const target = import_app_data21.BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
3288
3430
  const handler = hostListenerProxy(hostRef, method);
3289
3431
  const opts = hostListenerOpts(flags);
3290
3432
  plt.ael(target, name, handler, opts);
@@ -3295,7 +3437,7 @@ var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) =>
3295
3437
  var hostListenerProxy = (hostRef, methodName) => (ev) => {
3296
3438
  var _a;
3297
3439
  try {
3298
- if (import_app_data20.BUILD.lazyLoad) {
3440
+ if (import_app_data21.BUILD.lazyLoad) {
3299
3441
  if (hostRef.$flags$ & 256 /* isListenReady */) {
3300
3442
  (_a = hostRef.$lazyInstance$) == null ? void 0 : _a[methodName](ev);
3301
3443
  } else {
@@ -3309,10 +3451,10 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
3309
3451
  }
3310
3452
  };
3311
3453
  var getHostListenerTarget = (elm, flags) => {
3312
- if (import_app_data20.BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
3313
- if (import_app_data20.BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
3314
- if (import_app_data20.BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
3315
- if (import_app_data20.BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement)
3454
+ if (import_app_data21.BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */) return doc;
3455
+ if (import_app_data21.BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */) return win;
3456
+ if (import_app_data21.BUILD.hostListenerTargetBody && flags & 16 /* TargetBody */) return doc.body;
3457
+ if (import_app_data21.BUILD.hostListenerTargetParent && flags & 32 /* TargetParent */ && elm.parentElement)
3316
3458
  return elm.parentElement;
3317
3459
  return elm;
3318
3460
  };
@@ -3486,6 +3628,7 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
3486
3628
  consoleError,
3487
3629
  createEvent,
3488
3630
  defineCustomElement,
3631
+ deleteHostRef,
3489
3632
  disconnectedCallback,
3490
3633
  doc,
3491
3634
  flushAll,