@stencil/core 4.23.2 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -464,10 +464,13 @@ var unwrapErr = (result) => {
464
464
  var import_app_data17 = require("@stencil/core/internal/app-data");
465
465
 
466
466
  // src/runtime/client-hydrate.ts
467
- var import_app_data8 = require("@stencil/core/internal/app-data");
467
+ var import_app_data5 = require("@stencil/core/internal/app-data");
468
468
 
469
469
  // src/runtime/dom-extras.ts
470
- var import_app_data6 = require("@stencil/core/internal/app-data");
470
+ var import_app_data2 = require("@stencil/core/internal/app-data");
471
+
472
+ // src/runtime/slot-polyfill-utils.ts
473
+ var import_app_data = require("@stencil/core/internal/app-data");
471
474
 
472
475
  // src/runtime/runtime-constants.ts
473
476
  var CONTENT_REF_ID = "r";
@@ -495,7 +498,6 @@ var FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS = [
495
498
  ];
496
499
 
497
500
  // src/runtime/slot-polyfill-utils.ts
498
- var import_app_data = require("@stencil/core/internal/app-data");
499
501
  var updateFallbackSlotVisibility = (elm) => {
500
502
  const childNodes = elm.__childNodes || elm.childNodes;
501
503
  if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
@@ -519,27 +521,27 @@ var updateFallbackSlotVisibility = (elm) => {
519
521
  var getSlottedChildNodes = (childNodes) => {
520
522
  const result = [];
521
523
  for (let i2 = 0; i2 < childNodes.length; i2++) {
522
- const slottedNode = childNodes[i2]["s-nr"];
524
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
523
525
  if (slottedNode && slottedNode.isConnected) {
524
526
  result.push(slottedNode);
525
527
  }
526
528
  }
527
529
  return result;
528
530
  };
529
- var getHostSlotNodes = (childNodes, hostName, slotName) => {
531
+ function getHostSlotNodes(childNodes, hostName, slotName) {
530
532
  let i2 = 0;
531
533
  let slottedNodes = [];
532
534
  let childNode;
533
535
  for (; i2 < childNodes.length; i2++) {
534
536
  childNode = childNodes[i2];
535
- if (childNode["s-sr"] && childNode["s-hn"] === hostName && (!slotName || childNode["s-sn"] === slotName)) {
537
+ if (childNode["s-sr"] && childNode["s-hn"] === hostName && (slotName === void 0 || childNode["s-sn"] === slotName)) {
536
538
  slottedNodes.push(childNode);
537
539
  if (typeof slotName !== "undefined") return slottedNodes;
538
540
  }
539
541
  slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
540
542
  }
541
543
  return slottedNodes;
542
- };
544
+ }
543
545
  var getHostSlotChildNodes = (node, slotName, includeSlot = true) => {
544
546
  const childNodes = [];
545
547
  if (includeSlot && node["s-sr"] || !node["s-sr"]) childNodes.push(node);
@@ -597,1801 +599,1881 @@ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
597
599
  };
598
600
  var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
599
601
 
600
- // src/runtime/vdom/vdom-render.ts
601
- var import_app_data5 = require("@stencil/core/internal/app-data");
602
-
603
- // src/runtime/vdom/h.ts
604
- var import_app_data2 = require("@stencil/core/internal/app-data");
605
- var h = (nodeName, vnodeData, ...children) => {
606
- let child = null;
607
- let key = null;
608
- let slotName = null;
609
- let simple = false;
610
- let lastSimple = false;
611
- const vNodeChildren = [];
612
- const walk = (c) => {
613
- for (let i2 = 0; i2 < c.length; i2++) {
614
- child = c[i2];
615
- if (Array.isArray(child)) {
616
- walk(child);
617
- } else if (child != null && typeof child !== "boolean") {
618
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
619
- child = String(child);
620
- } else if (import_app_data2.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
621
- consoleDevError(`vNode passed as children has unexpected type.
622
- Make sure it's using the correct h() function.
623
- Empty objects can also be the cause, look for JSX comments that became objects.`);
602
+ // src/runtime/dom-extras.ts
603
+ var patchPseudoShadowDom = (hostElementPrototype) => {
604
+ patchCloneNode(hostElementPrototype);
605
+ patchSlotAppendChild(hostElementPrototype);
606
+ patchSlotAppend(hostElementPrototype);
607
+ patchSlotPrepend(hostElementPrototype);
608
+ patchSlotInsertAdjacentElement(hostElementPrototype);
609
+ patchSlotInsertAdjacentHTML(hostElementPrototype);
610
+ patchSlotInsertAdjacentText(hostElementPrototype);
611
+ patchInsertBefore(hostElementPrototype);
612
+ patchTextContent(hostElementPrototype);
613
+ patchChildSlotNodes(hostElementPrototype);
614
+ patchSlotRemoveChild(hostElementPrototype);
615
+ };
616
+ var patchCloneNode = (HostElementPrototype) => {
617
+ const orgCloneNode = HostElementPrototype.cloneNode;
618
+ HostElementPrototype.cloneNode = function(deep) {
619
+ const srcNode = this;
620
+ const isShadowDom = import_app_data2.BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
621
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
622
+ if (import_app_data2.BUILD.slot && !isShadowDom && deep) {
623
+ let i2 = 0;
624
+ let slotted, nonStencilNode;
625
+ const stencilPrivates = [
626
+ "s-id",
627
+ "s-cr",
628
+ "s-lr",
629
+ "s-rc",
630
+ "s-sc",
631
+ "s-p",
632
+ "s-cn",
633
+ "s-sr",
634
+ "s-sn",
635
+ "s-hn",
636
+ "s-ol",
637
+ "s-nr",
638
+ "s-si",
639
+ "s-rf",
640
+ "s-scs"
641
+ ];
642
+ const childNodes = this.__childNodes || this.childNodes;
643
+ for (; i2 < childNodes.length; i2++) {
644
+ slotted = childNodes[i2]["s-nr"];
645
+ nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
646
+ if (slotted) {
647
+ if (import_app_data2.BUILD.appendChildSlotFix && clonedNode.__appendChild) {
648
+ clonedNode.__appendChild(slotted.cloneNode(true));
649
+ } else {
650
+ clonedNode.appendChild(slotted.cloneNode(true));
651
+ }
624
652
  }
625
- if (simple && lastSimple) {
626
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
627
- } else {
628
- vNodeChildren.push(simple ? newVNode(null, child) : child);
653
+ if (nonStencilNode) {
654
+ clonedNode.appendChild(childNodes[i2].cloneNode(true));
629
655
  }
630
- lastSimple = simple;
631
656
  }
632
657
  }
658
+ return clonedNode;
633
659
  };
634
- walk(children);
635
- if (vnodeData) {
636
- if (import_app_data2.BUILD.isDev && nodeName === "input") {
637
- validateInputProperties(vnodeData);
638
- }
639
- if (import_app_data2.BUILD.vdomKey && vnodeData.key) {
640
- key = vnodeData.key;
641
- }
642
- if (import_app_data2.BUILD.slotRelocation && vnodeData.name) {
643
- slotName = vnodeData.name;
660
+ };
661
+ var patchSlotAppendChild = (HostElementPrototype) => {
662
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
663
+ HostElementPrototype.appendChild = function(newChild) {
664
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
665
+ const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
666
+ if (slotNode) {
667
+ addSlotRelocateNode(newChild, slotNode);
668
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
669
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
670
+ const parent = intrnlCall(appendAfter, "parentNode");
671
+ let insertedNode;
672
+ if (parent.__insertBefore) {
673
+ insertedNode = parent.__insertBefore(newChild, appendAfter.nextSibling);
674
+ } else {
675
+ insertedNode = parent.insertBefore(newChild, appendAfter.nextSibling);
676
+ }
677
+ updateFallbackSlotVisibility(this);
678
+ return insertedNode;
644
679
  }
645
- if (import_app_data2.BUILD.vdomClass) {
646
- const classData = vnodeData.className || vnodeData.class;
647
- if (classData) {
648
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
680
+ return this.__appendChild(newChild);
681
+ };
682
+ };
683
+ var patchSlotRemoveChild = (ElementPrototype) => {
684
+ ElementPrototype.__removeChild = ElementPrototype.removeChild;
685
+ ElementPrototype.removeChild = function(toRemove) {
686
+ if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
687
+ const childNodes = this.__childNodes || this.childNodes;
688
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
689
+ if (slotNode && toRemove.isConnected) {
690
+ toRemove.remove();
691
+ updateFallbackSlotVisibility(this);
692
+ return;
649
693
  }
650
694
  }
651
- }
652
- if (import_app_data2.BUILD.isDev && vNodeChildren.some(isHost)) {
653
- consoleDevError(`The <Host> must be the single root component. Make sure:
654
- - You are NOT using hostData() and <Host> in the same component.
655
- - <Host> is used once, and it's the single root component of the render() function.`);
656
- }
657
- if (import_app_data2.BUILD.vdomFunctional && typeof nodeName === "function") {
658
- return nodeName(
659
- vnodeData === null ? {} : vnodeData,
660
- vNodeChildren,
661
- vdomFnUtils
662
- );
663
- }
664
- const vnode = newVNode(nodeName, null);
665
- vnode.$attrs$ = vnodeData;
666
- if (vNodeChildren.length > 0) {
667
- vnode.$children$ = vNodeChildren;
668
- }
669
- if (import_app_data2.BUILD.vdomKey) {
670
- vnode.$key$ = key;
671
- }
672
- if (import_app_data2.BUILD.slotRelocation) {
673
- vnode.$name$ = slotName;
674
- }
675
- return vnode;
695
+ return this.__removeChild(toRemove);
696
+ };
676
697
  };
677
- var newVNode = (tag, text) => {
678
- const vnode = {
679
- $flags$: 0,
680
- $tag$: tag,
681
- $text$: text,
682
- $elm$: null,
683
- $children$: null
698
+ var patchSlotPrepend = (HostElementPrototype) => {
699
+ HostElementPrototype.__prepend = HostElementPrototype.prepend;
700
+ HostElementPrototype.prepend = function(...newChildren) {
701
+ newChildren.forEach((newChild) => {
702
+ if (typeof newChild === "string") {
703
+ newChild = this.ownerDocument.createTextNode(newChild);
704
+ }
705
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
706
+ const childNodes = this.__childNodes || this.childNodes;
707
+ const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
708
+ if (slotNode) {
709
+ addSlotRelocateNode(newChild, slotNode, true);
710
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
711
+ const appendAfter = slotChildNodes[0];
712
+ const parent = intrnlCall(appendAfter, "parentNode");
713
+ if (parent.__insertBefore) {
714
+ return parent.__insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
715
+ } else {
716
+ return parent.insertBefore(newChild, intrnlCall(appendAfter, "nextSibling"));
717
+ }
718
+ }
719
+ if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
720
+ newChild.hidden = true;
721
+ }
722
+ return HostElementPrototype.__prepend(newChild);
723
+ });
684
724
  };
685
- if (import_app_data2.BUILD.vdomAttribute) {
686
- vnode.$attrs$ = null;
687
- }
688
- if (import_app_data2.BUILD.vdomKey) {
689
- vnode.$key$ = null;
690
- }
691
- if (import_app_data2.BUILD.slotRelocation) {
692
- vnode.$name$ = null;
693
- }
694
- return vnode;
695
725
  };
696
- var Host = {};
697
- var isHost = (node) => node && node.$tag$ === Host;
698
- var vdomFnUtils = {
699
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
700
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
726
+ var patchSlotAppend = (HostElementPrototype) => {
727
+ HostElementPrototype.__append = HostElementPrototype.append;
728
+ HostElementPrototype.append = function(...newChildren) {
729
+ newChildren.forEach((newChild) => {
730
+ if (typeof newChild === "string") {
731
+ newChild = this.ownerDocument.createTextNode(newChild);
732
+ }
733
+ this.appendChild(newChild);
734
+ });
735
+ };
701
736
  };
702
- var convertToPublic = (node) => ({
703
- vattrs: node.$attrs$,
704
- vchildren: node.$children$,
705
- vkey: node.$key$,
706
- vname: node.$name$,
707
- vtag: node.$tag$,
708
- vtext: node.$text$
709
- });
710
- var convertToPrivate = (node) => {
711
- if (typeof node.vtag === "function") {
712
- const vnodeData = { ...node.vattrs };
713
- if (node.vkey) {
714
- vnodeData.key = node.vkey;
737
+ var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
738
+ const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
739
+ HostElementPrototype.insertAdjacentHTML = function(position, text) {
740
+ if (position !== "afterbegin" && position !== "beforeend") {
741
+ return originalInsertAdjacentHtml.call(this, position, text);
715
742
  }
716
- if (node.vname) {
717
- vnodeData.name = node.vname;
743
+ const container = this.ownerDocument.createElement("_");
744
+ let node;
745
+ container.innerHTML = text;
746
+ if (position === "afterbegin") {
747
+ while (node = container.firstChild) {
748
+ this.prepend(node);
749
+ }
750
+ } else if (position === "beforeend") {
751
+ while (node = container.firstChild) {
752
+ this.append(node);
753
+ }
718
754
  }
719
- return h(node.vtag, vnodeData, ...node.vchildren || []);
720
- }
721
- const vnode = newVNode(node.vtag, node.vtext);
722
- vnode.$attrs$ = node.vattrs;
723
- vnode.$children$ = node.vchildren;
724
- vnode.$key$ = node.vkey;
725
- vnode.$name$ = node.vname;
726
- return vnode;
755
+ };
727
756
  };
728
- var validateInputProperties = (inputElm) => {
729
- const props = Object.keys(inputElm);
730
- const value = props.indexOf("value");
731
- if (value === -1) {
732
- return;
733
- }
734
- const typeIndex = props.indexOf("type");
735
- const minIndex = props.indexOf("min");
736
- const maxIndex = props.indexOf("max");
737
- const stepIndex = props.indexOf("step");
738
- if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
739
- consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
740
- }
757
+ var patchSlotInsertAdjacentText = (HostElementPrototype) => {
758
+ HostElementPrototype.insertAdjacentText = function(position, text) {
759
+ this.insertAdjacentHTML(position, text);
760
+ };
741
761
  };
742
-
743
- // src/runtime/vdom/update-element.ts
744
- var import_app_data4 = require("@stencil/core/internal/app-data");
745
-
746
- // src/runtime/vdom/set-accessor.ts
747
- var import_app_data3 = require("@stencil/core/internal/app-data");
748
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
749
- if (oldValue !== newValue) {
750
- let isProp = isMemberInElement(elm, memberName);
751
- let ln = memberName.toLowerCase();
752
- if (import_app_data3.BUILD.vdomClass && memberName === "class") {
753
- const classList = elm.classList;
754
- const oldClasses = parseClassList(oldValue);
755
- let newClasses = parseClassList(newValue);
756
- if (elm["s-si"]) {
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)));
767
- }
768
- } else if (import_app_data3.BUILD.vdomStyle && memberName === "style") {
769
- if (import_app_data3.BUILD.updatable) {
770
- for (const prop in oldValue) {
771
- if (!newValue || newValue[prop] == null) {
772
- if (!import_app_data3.BUILD.hydrateServerSide && prop.includes("-")) {
773
- elm.style.removeProperty(prop);
774
- } else {
775
- elm.style[prop] = "";
776
- }
777
- }
778
- }
779
- }
780
- for (const prop in newValue) {
781
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
782
- if (!import_app_data3.BUILD.hydrateServerSide && prop.includes("-")) {
783
- elm.style.setProperty(prop, newValue[prop]);
784
- } else {
785
- elm.style[prop] = newValue[prop];
762
+ var patchInsertBefore = (HostElementPrototype) => {
763
+ const eleProto = HostElementPrototype;
764
+ if (eleProto.__insertBefore) return;
765
+ eleProto.__insertBefore = HostElementPrototype.insertBefore;
766
+ HostElementPrototype.insertBefore = function(newChild, currentChild) {
767
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
768
+ const slotNode = getHostSlotNodes(this.__childNodes, this.tagName, slotName)[0];
769
+ const slottedNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
770
+ if (slotNode) {
771
+ let found = false;
772
+ slottedNodes.forEach((childNode) => {
773
+ if (childNode === currentChild || currentChild === null) {
774
+ found = true;
775
+ if (currentChild === null || slotName !== currentChild["s-sn"]) {
776
+ this.appendChild(newChild);
777
+ return;
786
778
  }
787
- }
788
- }
789
- } else if (import_app_data3.BUILD.vdomKey && memberName === "key") {
790
- } else if (import_app_data3.BUILD.vdomRef && memberName === "ref") {
791
- if (newValue) {
792
- newValue(elm);
793
- }
794
- } else if (import_app_data3.BUILD.vdomListener && (import_app_data3.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
795
- if (memberName[2] === "-") {
796
- memberName = memberName.slice(3);
797
- } else if (isMemberInElement(win, ln)) {
798
- memberName = ln.slice(2);
799
- } else {
800
- memberName = ln[2] + memberName.slice(3);
801
- }
802
- if (oldValue || newValue) {
803
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
804
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
805
- if (oldValue) {
806
- plt.rel(elm, memberName, oldValue, capture);
807
- }
808
- if (newValue) {
809
- plt.ael(elm, memberName, newValue, capture);
810
- }
811
- }
812
- } else if (import_app_data3.BUILD.vdomPropOrAttr) {
813
- const isComplex = isComplexType(newValue);
814
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
815
- try {
816
- if (!elm.tagName.includes("-")) {
817
- const n = newValue == null ? "" : newValue;
818
- if (memberName === "list") {
819
- isProp = false;
820
- } else if (oldValue == null || elm[memberName] != n) {
821
- if (typeof elm.__lookupSetter__(memberName) === "function") {
822
- elm[memberName] = n;
823
- } else {
824
- elm.setAttribute(memberName, n);
825
- }
779
+ if (slotName === currentChild["s-sn"]) {
780
+ addSlotRelocateNode(newChild, slotNode);
781
+ const parent = intrnlCall(currentChild, "parentNode");
782
+ if (parent.__insertBefore) {
783
+ parent.__insertBefore(newChild, currentChild);
784
+ } else {
785
+ parent.insertBefore(newChild, currentChild);
826
786
  }
827
- } else {
828
- elm[memberName] = newValue;
829
- }
830
- } catch (e) {
831
- }
832
- }
833
- let xlink = false;
834
- if (import_app_data3.BUILD.vdomXlink) {
835
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
836
- memberName = ln;
837
- xlink = true;
838
- }
839
- }
840
- if (newValue == null || newValue === false) {
841
- if (newValue !== false || elm.getAttribute(memberName) === "") {
842
- if (import_app_data3.BUILD.vdomXlink && xlink) {
843
- elm.removeAttributeNS(XLINK_NS, memberName);
844
- } else {
845
- elm.removeAttribute(memberName);
846
787
  }
788
+ return;
847
789
  }
848
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
849
- newValue = newValue === true ? "" : newValue;
850
- if (import_app_data3.BUILD.vdomXlink && xlink) {
851
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
852
- } else {
853
- elm.setAttribute(memberName, newValue);
854
- }
855
- }
790
+ });
791
+ if (found) return newChild;
856
792
  }
857
- }
793
+ return this.__insertBefore(newChild, currentChild);
794
+ };
858
795
  };
859
- var parseClassListRegex = /\s/;
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);
796
+ var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
797
+ const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
798
+ HostElementPrototype.insertAdjacentElement = function(position, element) {
799
+ if (position !== "afterbegin" && position !== "beforeend") {
800
+ return originalInsertAdjacentElement.call(this, position, element);
801
+ }
802
+ if (position === "afterbegin") {
803
+ this.prepend(element);
804
+ return element;
805
+ } else if (position === "beforeend") {
806
+ this.append(element);
807
+ return element;
808
+ }
809
+ return element;
810
+ };
868
811
  };
869
- var CAPTURE_EVENT_SUFFIX = "Capture";
870
- var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
871
-
872
- // src/runtime/vdom/update-element.ts
873
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
874
- const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
875
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
876
- const newVnodeAttrs = newVnode.$attrs$ || {};
877
- if (import_app_data4.BUILD.updatable) {
878
- for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
879
- if (!(memberName in newVnodeAttrs)) {
880
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
881
- }
812
+ var patchTextContent = (hostElementPrototype) => {
813
+ patchHostOriginalAccessor("textContent", hostElementPrototype);
814
+ Object.defineProperty(hostElementPrototype, "textContent", {
815
+ get: function() {
816
+ let text = "";
817
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
818
+ childNodes.forEach((node) => text += node.textContent || "");
819
+ return text;
820
+ },
821
+ set: function(value) {
822
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
823
+ childNodes.forEach((node) => {
824
+ if (node["s-ol"]) node["s-ol"].remove();
825
+ node.remove();
826
+ });
827
+ this.insertAdjacentHTML("beforeend", value);
882
828
  }
883
- }
884
- for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
885
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
886
- }
829
+ });
887
830
  };
888
- function sortedAttrNames(attrNames) {
889
- return attrNames.includes("ref") ? (
890
- // we need to sort these to ensure that `'ref'` is the last attr
891
- [...attrNames.filter((attr) => attr !== "ref"), "ref"]
892
- ) : (
893
- // no need to sort, return the original array
894
- attrNames
895
- );
896
- }
897
-
898
- // src/runtime/vdom/vdom-render.ts
899
- var scopeId;
900
- var contentRef;
901
- var hostTagName;
902
- var useNativeShadowDom = false;
903
- var checkSlotFallbackVisibility = false;
904
- var checkSlotRelocate = false;
905
- var isSvgMode = false;
906
- var createElm = (oldParentVNode, newParentVNode, childIndex) => {
907
- var _a;
908
- const newVNode2 = newParentVNode.$children$[childIndex];
909
- let i2 = 0;
910
- let elm;
911
- let childNode;
912
- let oldVNode;
913
- if (import_app_data5.BUILD.slotRelocation && !useNativeShadowDom) {
914
- checkSlotRelocate = true;
915
- if (newVNode2.$tag$ === "slot") {
916
- newVNode2.$flags$ |= newVNode2.$children$ ? (
917
- // slot element has fallback content
918
- // still create an element that "mocks" the slot element
919
- 2 /* isSlotFallback */
920
- ) : (
921
- // slot element does not have fallback content
922
- // create an html comment we'll use to always reference
923
- // where actual slot content should sit next to
924
- 1 /* isSlotReference */
925
- );
831
+ var patchChildSlotNodes = (elm) => {
832
+ class FakeNodeList extends Array {
833
+ item(n) {
834
+ return this[n];
926
835
  }
927
836
  }
928
- if (import_app_data5.BUILD.isDev && newVNode2.$elm$) {
929
- consoleDevError(
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://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`
931
- );
932
- }
933
- if (import_app_data5.BUILD.vdomText && newVNode2.$text$ !== null) {
934
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
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("");
937
- } else {
938
- if (import_app_data5.BUILD.svg && !isSvgMode) {
939
- isSvgMode = newVNode2.$tag$ === "svg";
940
- }
941
- elm = newVNode2.$elm$ = import_app_data5.BUILD.svg ? doc.createElementNS(
942
- isSvgMode ? SVG_NS : HTML_NS,
943
- !useNativeShadowDom && import_app_data5.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
944
- ) : doc.createElement(
945
- !useNativeShadowDom && import_app_data5.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
946
- );
947
- if (import_app_data5.BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
948
- isSvgMode = false;
837
+ patchHostOriginalAccessor("children", elm);
838
+ Object.defineProperty(elm, "children", {
839
+ get() {
840
+ return this.childNodes.filter((n) => n.nodeType === 1);
949
841
  }
950
- if (import_app_data5.BUILD.vdomAttribute) {
951
- updateElement(null, newVNode2, isSvgMode);
842
+ });
843
+ Object.defineProperty(elm, "childElementCount", {
844
+ get() {
845
+ return this.children.length;
952
846
  }
953
- if (import_app_data5.BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
954
- elm.classList.add(elm["s-si"] = scopeId);
847
+ });
848
+ patchHostOriginalAccessor("firstChild", elm);
849
+ Object.defineProperty(elm, "firstChild", {
850
+ get() {
851
+ return this.childNodes[0];
955
852
  }
956
- if (newVNode2.$children$) {
957
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
958
- childNode = createElm(oldParentVNode, newVNode2, i2);
959
- if (childNode) {
960
- elm.appendChild(childNode);
961
- }
962
- }
853
+ });
854
+ patchHostOriginalAccessor("lastChild", elm);
855
+ Object.defineProperty(elm, "lastChild", {
856
+ get() {
857
+ return this.childNodes[this.childNodes.length - 1];
963
858
  }
964
- if (import_app_data5.BUILD.svg) {
965
- if (newVNode2.$tag$ === "svg") {
966
- isSvgMode = false;
967
- } else if (elm.tagName === "foreignObject") {
968
- isSvgMode = true;
969
- }
859
+ });
860
+ patchHostOriginalAccessor("childNodes", elm);
861
+ Object.defineProperty(elm, "childNodes", {
862
+ get() {
863
+ const result = new FakeNodeList();
864
+ result.push(...getSlottedChildNodes(this.__childNodes));
865
+ return result;
970
866
  }
971
- }
972
- elm["s-hn"] = hostTagName;
973
- if (import_app_data5.BUILD.slotRelocation) {
974
- if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
975
- elm["s-sr"] = true;
976
- elm["s-cr"] = contentRef;
977
- elm["s-sn"] = newVNode2.$name$ || "";
978
- elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
979
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
980
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
981
- if (import_app_data5.BUILD.experimentalSlotFixes) {
982
- relocateToHostRoot(oldParentVNode.$elm$);
983
- } else {
984
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
985
- }
986
- }
987
- if (import_app_data5.BUILD.scoped) {
988
- addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
867
+ });
868
+ };
869
+ var patchSlottedNode = (node) => {
870
+ if (!node || node.__nextSibling || !globalThis.Node) return;
871
+ patchNextSibling(node);
872
+ patchPreviousSibling(node);
873
+ patchParentNode(node);
874
+ if (node.nodeType === Node.ELEMENT_NODE) {
875
+ patchNextElementSibling(node);
876
+ patchPreviousElementSibling(node);
877
+ }
878
+ };
879
+ var patchNextSibling = (node) => {
880
+ if (!node || node.__nextSibling) return;
881
+ patchHostOriginalAccessor("nextSibling", node);
882
+ Object.defineProperty(node, "nextSibling", {
883
+ get: function() {
884
+ var _a;
885
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
886
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
887
+ if (parentNodes && index > -1) {
888
+ return parentNodes[index + 1];
989
889
  }
890
+ return this.__nextSibling;
990
891
  }
991
- }
992
- return elm;
892
+ });
993
893
  };
994
- var relocateToHostRoot = (parentElm) => {
995
- plt.$flags$ |= 1 /* isTmpDisconnected */;
996
- const host = parentElm.closest(hostTagName.toLowerCase());
997
- if (host != null) {
998
- const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
999
- (ref) => ref["s-cr"]
1000
- );
1001
- const childNodeArray = Array.from(
1002
- parentElm.__childNodes || parentElm.childNodes
1003
- );
1004
- for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
1005
- if (childNode["s-sh"] != null) {
1006
- insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
1007
- childNode["s-sh"] = void 0;
1008
- checkSlotRelocate = true;
894
+ var patchNextElementSibling = (element) => {
895
+ if (!element || element.__nextElementSibling) return;
896
+ patchHostOriginalAccessor("nextElementSibling", element);
897
+ Object.defineProperty(element, "nextElementSibling", {
898
+ get: function() {
899
+ var _a;
900
+ const parentEles = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
901
+ const index = parentEles == null ? void 0 : parentEles.indexOf(this);
902
+ if (parentEles && index > -1) {
903
+ return parentEles[index + 1];
1009
904
  }
905
+ return this.__nextElementSibling;
1010
906
  }
1011
- }
1012
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
907
+ });
1013
908
  };
1014
- var putBackInOriginalLocation = (parentElm, recursive) => {
1015
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1016
- const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
1017
- if (parentElm["s-sr"] && import_app_data5.BUILD.experimentalSlotFixes) {
1018
- let node = parentElm;
1019
- while (node = node.nextSibling) {
1020
- if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
1021
- oldSlotChildNodes.push(node);
909
+ var patchPreviousSibling = (node) => {
910
+ if (!node || node.__previousSibling) return;
911
+ patchHostOriginalAccessor("previousSibling", node);
912
+ Object.defineProperty(node, "previousSibling", {
913
+ get: function() {
914
+ var _a;
915
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.childNodes;
916
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
917
+ if (parentNodes && index > -1) {
918
+ return parentNodes[index - 1];
1022
919
  }
920
+ return this.__previousSibling;
1023
921
  }
1024
- }
1025
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
1026
- const childNode = oldSlotChildNodes[i2];
1027
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
1028
- insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
1029
- childNode["s-ol"].remove();
1030
- childNode["s-ol"] = void 0;
1031
- childNode["s-sh"] = void 0;
1032
- checkSlotRelocate = true;
922
+ });
923
+ };
924
+ var patchPreviousElementSibling = (element) => {
925
+ if (!element || element.__previousElementSibling) return;
926
+ patchHostOriginalAccessor("previousElementSibling", element);
927
+ Object.defineProperty(element, "previousElementSibling", {
928
+ get: function() {
929
+ var _a;
930
+ const parentNodes = (_a = this["s-ol"]) == null ? void 0 : _a.parentNode.children;
931
+ const index = parentNodes == null ? void 0 : parentNodes.indexOf(this);
932
+ if (parentNodes && index > -1) {
933
+ return parentNodes[index - 1];
934
+ }
935
+ return this.__previousElementSibling;
1033
936
  }
1034
- if (recursive) {
1035
- putBackInOriginalLocation(childNode, recursive);
937
+ });
938
+ };
939
+ var patchParentNode = (node) => {
940
+ if (!node || node.__parentNode) return;
941
+ patchHostOriginalAccessor("parentNode", node);
942
+ Object.defineProperty(node, "parentNode", {
943
+ get: function() {
944
+ var _a;
945
+ return ((_a = this["s-ol"]) == null ? void 0 : _a.parentNode) || this.__parentNode;
946
+ },
947
+ set: function(value) {
948
+ this.__parentNode = value;
1036
949
  }
1037
- }
1038
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
950
+ });
1039
951
  };
1040
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1041
- let containerElm = import_app_data5.BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
1042
- let childNode;
1043
- if (import_app_data5.BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1044
- containerElm = containerElm.shadowRoot;
952
+ var validElementPatches = ["children", "nextElementSibling", "previousElementSibling"];
953
+ var validNodesPatches = [
954
+ "childNodes",
955
+ "firstChild",
956
+ "lastChild",
957
+ "nextSibling",
958
+ "previousSibling",
959
+ "textContent",
960
+ "parentNode"
961
+ ];
962
+ function patchHostOriginalAccessor(accessorName, node) {
963
+ let accessor;
964
+ if (validElementPatches.includes(accessorName)) {
965
+ accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
966
+ } else if (validNodesPatches.includes(accessorName)) {
967
+ accessor = Object.getOwnPropertyDescriptor(Node.prototype, accessorName);
1045
968
  }
1046
- for (; startIdx <= endIdx; ++startIdx) {
1047
- if (vnodes[startIdx]) {
1048
- childNode = createElm(null, parentVNode, startIdx);
1049
- if (childNode) {
1050
- vnodes[startIdx].$elm$ = childNode;
1051
- insertBefore(containerElm, childNode, import_app_data5.BUILD.slotRelocation ? referenceNode(before) : before);
1052
- }
969
+ if (!accessor) {
970
+ accessor = Object.getOwnPropertyDescriptor(node, accessorName);
971
+ }
972
+ if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
973
+ }
974
+ function intrnlCall(node, method) {
975
+ if ("__" + method in node) {
976
+ return node["__" + method];
977
+ } else {
978
+ return node[method];
979
+ }
980
+ }
981
+
982
+ // src/runtime/profile.ts
983
+ var import_app_data3 = require("@stencil/core/internal/app-data");
984
+ var i = 0;
985
+ var createTime = (fnName, tagName = "") => {
986
+ if (import_app_data3.BUILD.profile && performance.mark) {
987
+ const key = `st:${fnName}:${tagName}:${i++}`;
988
+ performance.mark(key);
989
+ return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
990
+ } else {
991
+ return () => {
992
+ return;
993
+ };
994
+ }
995
+ };
996
+ var uniqueTime = (key, measureText) => {
997
+ if (import_app_data3.BUILD.profile && performance.mark) {
998
+ if (performance.getEntriesByName(key, "mark").length === 0) {
999
+ performance.mark(key);
1053
1000
  }
1001
+ return () => {
1002
+ if (performance.getEntriesByName(measureText, "measure").length === 0) {
1003
+ performance.measure(measureText, key);
1004
+ }
1005
+ };
1006
+ } else {
1007
+ return () => {
1008
+ return;
1009
+ };
1054
1010
  }
1055
1011
  };
1056
- var removeVnodes = (vnodes, startIdx, endIdx) => {
1057
- for (let index = startIdx; index <= endIdx; ++index) {
1058
- const vnode = vnodes[index];
1059
- if (vnode) {
1060
- const elm = vnode.$elm$;
1061
- nullifyVNodeRefs(vnode);
1062
- if (elm) {
1063
- if (import_app_data5.BUILD.slotRelocation) {
1064
- checkSlotFallbackVisibility = true;
1065
- if (elm["s-ol"]) {
1066
- elm["s-ol"].remove();
1067
- } else {
1068
- putBackInOriginalLocation(elm, true);
1069
- }
1070
- }
1071
- elm.remove();
1012
+ var inspect = (ref) => {
1013
+ const hostRef = getHostRef(ref);
1014
+ if (!hostRef) {
1015
+ return void 0;
1016
+ }
1017
+ const flags = hostRef.$flags$;
1018
+ const hostElement = hostRef.$hostElement$;
1019
+ return {
1020
+ renderCount: hostRef.$renderCount$,
1021
+ flags: {
1022
+ hasRendered: !!(flags & 2 /* hasRendered */),
1023
+ hasConnected: !!(flags & 1 /* hasConnected */),
1024
+ isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
1025
+ isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
1026
+ isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
1027
+ hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
1028
+ hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
1029
+ isWatchReady: !!(flags & 128 /* isWatchReady */),
1030
+ isListenReady: !!(flags & 256 /* isListenReady */),
1031
+ needsRerender: !!(flags & 512 /* needsRerender */)
1032
+ },
1033
+ instanceValues: hostRef.$instanceValues$,
1034
+ ancestorComponent: hostRef.$ancestorComponent$,
1035
+ hostElement,
1036
+ lazyInstance: hostRef.$lazyInstance$,
1037
+ vnode: hostRef.$vnode$,
1038
+ modeName: hostRef.$modeName$,
1039
+ onReadyPromise: hostRef.$onReadyPromise$,
1040
+ onReadyResolve: hostRef.$onReadyResolve$,
1041
+ onInstancePromise: hostRef.$onInstancePromise$,
1042
+ onInstanceResolve: hostRef.$onInstanceResolve$,
1043
+ onRenderResolve: hostRef.$onRenderResolve$,
1044
+ queuedListeners: hostRef.$queuedListeners$,
1045
+ rmListeners: hostRef.$rmListeners$,
1046
+ ["s-id"]: hostElement["s-id"],
1047
+ ["s-cr"]: hostElement["s-cr"],
1048
+ ["s-lr"]: hostElement["s-lr"],
1049
+ ["s-p"]: hostElement["s-p"],
1050
+ ["s-rc"]: hostElement["s-rc"],
1051
+ ["s-sc"]: hostElement["s-sc"]
1052
+ };
1053
+ };
1054
+ var installDevTools = () => {
1055
+ if (import_app_data3.BUILD.devTools) {
1056
+ const stencil = win.stencil = win.stencil || {};
1057
+ const originalInspect = stencil.inspect;
1058
+ stencil.inspect = (ref) => {
1059
+ let result = inspect(ref);
1060
+ if (!result && typeof originalInspect === "function") {
1061
+ result = originalInspect(ref);
1072
1062
  }
1073
- }
1063
+ return result;
1064
+ };
1074
1065
  }
1075
1066
  };
1076
- var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
1077
- let oldStartIdx = 0;
1078
- let newStartIdx = 0;
1079
- let idxInOld = 0;
1080
- let i2 = 0;
1081
- let oldEndIdx = oldCh.length - 1;
1082
- let oldStartVnode = oldCh[0];
1083
- let oldEndVnode = oldCh[oldEndIdx];
1084
- let newEndIdx = newCh.length - 1;
1085
- let newStartVnode = newCh[0];
1086
- let newEndVnode = newCh[newEndIdx];
1087
- let node;
1088
- let elmToMove;
1089
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1090
- if (oldStartVnode == null) {
1091
- oldStartVnode = oldCh[++oldStartIdx];
1092
- } else if (oldEndVnode == null) {
1093
- oldEndVnode = oldCh[--oldEndIdx];
1094
- } else if (newStartVnode == null) {
1095
- newStartVnode = newCh[++newStartIdx];
1096
- } else if (newEndVnode == null) {
1097
- newEndVnode = newCh[--newEndIdx];
1098
- } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
1099
- patch(oldStartVnode, newStartVnode, isInitialRender);
1100
- oldStartVnode = oldCh[++oldStartIdx];
1101
- newStartVnode = newCh[++newStartIdx];
1102
- } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
1103
- patch(oldEndVnode, newEndVnode, isInitialRender);
1104
- oldEndVnode = oldCh[--oldEndIdx];
1105
- newEndVnode = newCh[--newEndIdx];
1106
- } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1107
- if (import_app_data5.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1108
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1109
- }
1110
- patch(oldStartVnode, newEndVnode, isInitialRender);
1111
- insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1112
- oldStartVnode = oldCh[++oldStartIdx];
1113
- newEndVnode = newCh[--newEndIdx];
1114
- } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1115
- if (import_app_data5.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1116
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1117
- }
1118
- patch(oldEndVnode, newStartVnode, isInitialRender);
1119
- insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1120
- oldEndVnode = oldCh[--oldEndIdx];
1121
- newStartVnode = newCh[++newStartIdx];
1122
- } else {
1123
- idxInOld = -1;
1124
- if (import_app_data5.BUILD.vdomKey) {
1125
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1126
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1127
- idxInOld = i2;
1128
- break;
1129
- }
1067
+
1068
+ // src/runtime/vdom/h.ts
1069
+ var import_app_data4 = require("@stencil/core/internal/app-data");
1070
+ var h = (nodeName, vnodeData, ...children) => {
1071
+ let child = null;
1072
+ let key = null;
1073
+ let slotName = null;
1074
+ let simple = false;
1075
+ let lastSimple = false;
1076
+ const vNodeChildren = [];
1077
+ const walk = (c) => {
1078
+ for (let i2 = 0; i2 < c.length; i2++) {
1079
+ child = c[i2];
1080
+ if (Array.isArray(child)) {
1081
+ walk(child);
1082
+ } else if (child != null && typeof child !== "boolean") {
1083
+ if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
1084
+ child = String(child);
1085
+ } else if (import_app_data4.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1086
+ consoleDevError(`vNode passed as children has unexpected type.
1087
+ Make sure it's using the correct h() function.
1088
+ Empty objects can also be the cause, look for JSX comments that became objects.`);
1130
1089
  }
1131
- }
1132
- if (import_app_data5.BUILD.vdomKey && idxInOld >= 0) {
1133
- elmToMove = oldCh[idxInOld];
1134
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1135
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
1090
+ if (simple && lastSimple) {
1091
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
1136
1092
  } else {
1137
- patch(elmToMove, newStartVnode, isInitialRender);
1138
- oldCh[idxInOld] = void 0;
1139
- node = elmToMove.$elm$;
1093
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
1140
1094
  }
1141
- newStartVnode = newCh[++newStartIdx];
1142
- } else {
1143
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
1144
- newStartVnode = newCh[++newStartIdx];
1095
+ lastSimple = simple;
1145
1096
  }
1146
- if (node) {
1147
- if (import_app_data5.BUILD.slotRelocation) {
1148
- insertBefore(
1149
- referenceNode(oldStartVnode.$elm$).parentNode,
1150
- node,
1151
- referenceNode(oldStartVnode.$elm$)
1152
- );
1153
- } else {
1154
- insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
1155
- }
1097
+ }
1098
+ };
1099
+ walk(children);
1100
+ if (vnodeData) {
1101
+ if (import_app_data4.BUILD.isDev && nodeName === "input") {
1102
+ validateInputProperties(vnodeData);
1103
+ }
1104
+ if (import_app_data4.BUILD.vdomKey && vnodeData.key) {
1105
+ key = vnodeData.key;
1106
+ }
1107
+ if (import_app_data4.BUILD.slotRelocation && vnodeData.name) {
1108
+ slotName = vnodeData.name;
1109
+ }
1110
+ if (import_app_data4.BUILD.vdomClass) {
1111
+ const classData = vnodeData.className || vnodeData.class;
1112
+ if (classData) {
1113
+ vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1156
1114
  }
1157
1115
  }
1158
1116
  }
1159
- if (oldStartIdx > oldEndIdx) {
1160
- addVnodes(
1161
- parentElm,
1162
- newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
1163
- newVNode2,
1164
- newCh,
1165
- newStartIdx,
1166
- newEndIdx
1117
+ if (import_app_data4.BUILD.isDev && vNodeChildren.some(isHost)) {
1118
+ consoleDevError(`The <Host> must be the single root component. Make sure:
1119
+ - You are NOT using hostData() and <Host> in the same component.
1120
+ - <Host> is used once, and it's the single root component of the render() function.`);
1121
+ }
1122
+ if (import_app_data4.BUILD.vdomFunctional && typeof nodeName === "function") {
1123
+ return nodeName(
1124
+ vnodeData === null ? {} : vnodeData,
1125
+ vNodeChildren,
1126
+ vdomFnUtils
1167
1127
  );
1168
- } else if (import_app_data5.BUILD.updatable && newStartIdx > newEndIdx) {
1169
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1170
1128
  }
1129
+ const vnode = newVNode(nodeName, null);
1130
+ vnode.$attrs$ = vnodeData;
1131
+ if (vNodeChildren.length > 0) {
1132
+ vnode.$children$ = vNodeChildren;
1133
+ }
1134
+ if (import_app_data4.BUILD.vdomKey) {
1135
+ vnode.$key$ = key;
1136
+ }
1137
+ if (import_app_data4.BUILD.slotRelocation) {
1138
+ vnode.$name$ = slotName;
1139
+ }
1140
+ return vnode;
1171
1141
  };
1172
- var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1173
- if (leftVNode.$tag$ === rightVNode.$tag$) {
1174
- if (import_app_data5.BUILD.slotRelocation && leftVNode.$tag$ === "slot") {
1175
- return leftVNode.$name$ === rightVNode.$name$;
1176
- }
1177
- if (import_app_data5.BUILD.vdomKey && !isInitialRender) {
1178
- return leftVNode.$key$ === rightVNode.$key$;
1142
+ var newVNode = (tag, text) => {
1143
+ const vnode = {
1144
+ $flags$: 0,
1145
+ $tag$: tag,
1146
+ $text$: text,
1147
+ $elm$: null,
1148
+ $children$: null
1149
+ };
1150
+ if (import_app_data4.BUILD.vdomAttribute) {
1151
+ vnode.$attrs$ = null;
1152
+ }
1153
+ if (import_app_data4.BUILD.vdomKey) {
1154
+ vnode.$key$ = null;
1155
+ }
1156
+ if (import_app_data4.BUILD.slotRelocation) {
1157
+ vnode.$name$ = null;
1158
+ }
1159
+ return vnode;
1160
+ };
1161
+ var Host = {};
1162
+ var isHost = (node) => node && node.$tag$ === Host;
1163
+ var vdomFnUtils = {
1164
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
1165
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
1166
+ };
1167
+ var convertToPublic = (node) => ({
1168
+ vattrs: node.$attrs$,
1169
+ vchildren: node.$children$,
1170
+ vkey: node.$key$,
1171
+ vname: node.$name$,
1172
+ vtag: node.$tag$,
1173
+ vtext: node.$text$
1174
+ });
1175
+ var convertToPrivate = (node) => {
1176
+ if (typeof node.vtag === "function") {
1177
+ const vnodeData = { ...node.vattrs };
1178
+ if (node.vkey) {
1179
+ vnodeData.key = node.vkey;
1179
1180
  }
1180
- if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1181
- leftVNode.$key$ = rightVNode.$key$;
1181
+ if (node.vname) {
1182
+ vnodeData.name = node.vname;
1182
1183
  }
1183
- return true;
1184
+ return h(node.vtag, vnodeData, ...node.vchildren || []);
1184
1185
  }
1185
- return false;
1186
+ const vnode = newVNode(node.vtag, node.vtext);
1187
+ vnode.$attrs$ = node.vattrs;
1188
+ vnode.$children$ = node.vchildren;
1189
+ vnode.$key$ = node.vkey;
1190
+ vnode.$name$ = node.vname;
1191
+ return vnode;
1186
1192
  };
1187
- var referenceNode = (node) => node && node["s-ol"] || node;
1188
- var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1189
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
1190
- const oldChildren = oldVNode.$children$;
1191
- const newChildren = newVNode2.$children$;
1192
- const tag = newVNode2.$tag$;
1193
- const text = newVNode2.$text$;
1194
- let defaultHolder;
1195
- if (!import_app_data5.BUILD.vdomText || text === null) {
1196
- if (import_app_data5.BUILD.svg) {
1197
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
1193
+ var validateInputProperties = (inputElm) => {
1194
+ const props = Object.keys(inputElm);
1195
+ const value = props.indexOf("value");
1196
+ if (value === -1) {
1197
+ return;
1198
+ }
1199
+ const typeIndex = props.indexOf("type");
1200
+ const minIndex = props.indexOf("min");
1201
+ const maxIndex = props.indexOf("max");
1202
+ const stepIndex = props.indexOf("step");
1203
+ if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
1204
+ consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
1205
+ }
1206
+ };
1207
+
1208
+ // src/runtime/client-hydrate.ts
1209
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1210
+ const endHydrate = createTime("hydrateClient", tagName);
1211
+ const shadowRoot = hostElm.shadowRoot;
1212
+ const childRenderNodes = [];
1213
+ const slotNodes = [];
1214
+ const slottedNodes = [];
1215
+ const shadowRootNodes = import_app_data5.BUILD.shadowDom && shadowRoot ? [] : null;
1216
+ const vnode = newVNode(tagName, null);
1217
+ vnode.$elm$ = hostElm;
1218
+ let scopeId2;
1219
+ if (import_app_data5.BUILD.scoped) {
1220
+ const cmpMeta = hostRef.$cmpMeta$;
1221
+ if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1222
+ scopeId2 = hostElm["s-sc"];
1223
+ hostElm.classList.add(scopeId2 + "-h");
1224
+ } else if (hostElm["s-sc"]) {
1225
+ delete hostElm["s-sc"];
1198
1226
  }
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$) {
1202
- newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1203
- relocateToHostRoot(newVNode2.$elm$.parentElement);
1227
+ }
1228
+ if (!plt.$orgLocNodes$) {
1229
+ initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1230
+ }
1231
+ hostElm[HYDRATE_ID] = hostId;
1232
+ hostElm.removeAttribute(HYDRATE_ID);
1233
+ hostRef.$vnode$ = clientHydrate(
1234
+ vnode,
1235
+ childRenderNodes,
1236
+ slotNodes,
1237
+ shadowRootNodes,
1238
+ hostElm,
1239
+ hostElm,
1240
+ hostId,
1241
+ slottedNodes
1242
+ );
1243
+ let crIndex = 0;
1244
+ const crLength = childRenderNodes.length;
1245
+ let childRenderNode;
1246
+ for (crIndex; crIndex < crLength; crIndex++) {
1247
+ childRenderNode = childRenderNodes[crIndex];
1248
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
1249
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1250
+ const node = childRenderNode.$elm$;
1251
+ if (!shadowRoot) {
1252
+ node["s-hn"] = tagName.toUpperCase();
1253
+ if (childRenderNode.$tag$ === "slot") {
1254
+ node["s-cr"] = hostElm["s-cr"];
1255
+ }
1256
+ }
1257
+ if (childRenderNode.$tag$ === "slot") {
1258
+ if (childRenderNode.$children$) {
1259
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
1260
+ if (!childRenderNode.$elm$.childNodes.length) {
1261
+ childRenderNode.$children$.forEach((c) => {
1262
+ childRenderNode.$elm$.appendChild(c.$elm$);
1263
+ });
1204
1264
  }
1205
1265
  } else {
1206
- updateElement(oldVNode, newVNode2, isSvgMode);
1266
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
1207
1267
  }
1208
1268
  }
1209
- if (import_app_data5.BUILD.updatable && oldChildren !== null && newChildren !== null) {
1210
- updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1211
- } else if (newChildren !== null) {
1212
- if (import_app_data5.BUILD.updatable && import_app_data5.BUILD.vdomText && oldVNode.$text$ !== null) {
1213
- elm.textContent = "";
1269
+ if (orgLocationNode && orgLocationNode.isConnected) {
1270
+ if (shadowRoot && orgLocationNode["s-en"] === "") {
1271
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1272
+ }
1273
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
1274
+ if (!shadowRoot) {
1275
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1214
1276
  }
1215
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1216
- } else if (
1217
- // don't do this on initial render as it can cause non-hydrated content to be removed
1218
- !isInitialRender && import_app_data5.BUILD.updatable && oldChildren !== null
1219
- ) {
1220
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
1221
- }
1222
- if (import_app_data5.BUILD.svg && isSvgMode && tag === "svg") {
1223
- isSvgMode = false;
1224
1277
  }
1225
- } else if (import_app_data5.BUILD.vdomText && import_app_data5.BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) {
1226
- defaultHolder.parentNode.textContent = text;
1227
- } else if (import_app_data5.BUILD.vdomText && oldVNode.$text$ !== text) {
1228
- elm.data = text;
1278
+ plt.$orgLocNodes$.delete(orgLocationId);
1229
1279
  }
1230
- };
1231
- var relocateNodes = [];
1232
- var markSlotContentForRelocation = (elm) => {
1233
- let node;
1234
- let hostContentNodes;
1235
- let j;
1236
- const children = elm.__childNodes || elm.childNodes;
1237
- for (const childNode of children) {
1238
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
1239
- hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
1240
- const slotName = childNode["s-sn"];
1241
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
1242
- node = hostContentNodes[j];
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"])) {
1244
- if (isNodeLocatedInSlot(node, slotName)) {
1245
- let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1246
- checkSlotFallbackVisibility = true;
1247
- node["s-sn"] = node["s-sn"] || slotName;
1248
- if (relocateNodeData) {
1249
- relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
1250
- relocateNodeData.$slotRefNode$ = childNode;
1251
- } else {
1252
- node["s-sh"] = childNode["s-hn"];
1253
- relocateNodes.push({
1254
- $slotRefNode$: childNode,
1255
- $nodeToRelocate$: node
1256
- });
1257
- }
1258
- if (node["s-sr"]) {
1259
- relocateNodes.map((relocateNode) => {
1260
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
1261
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1262
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
1263
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1264
- }
1265
- }
1266
- });
1267
- }
1268
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1269
- relocateNodes.push({
1270
- $nodeToRelocate$: node
1271
- });
1272
- }
1280
+ const hosts = [];
1281
+ const snLen = slottedNodes.length;
1282
+ let snIndex = 0;
1283
+ let slotGroup;
1284
+ let snGroupIdx;
1285
+ let snGroupLen;
1286
+ let slottedItem;
1287
+ for (snIndex; snIndex < snLen; snIndex++) {
1288
+ slotGroup = slottedNodes[snIndex];
1289
+ if (!slotGroup || !slotGroup.length) continue;
1290
+ snGroupLen = slotGroup.length;
1291
+ snGroupIdx = 0;
1292
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
1293
+ slottedItem = slotGroup[snGroupIdx];
1294
+ if (!hosts[slottedItem.hostId]) {
1295
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
1296
+ }
1297
+ if (!hosts[slottedItem.hostId]) continue;
1298
+ const hostEle = hosts[slottedItem.hostId];
1299
+ if (!hostEle.shadowRoot || !shadowRoot) {
1300
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1301
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1302
+ slottedItem.slot["s-cr"] = hostEle;
1303
+ } else {
1304
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1305
+ }
1306
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1307
+ if (import_app_data5.BUILD.experimentalSlotFixes) {
1308
+ patchSlottedNode(slottedItem.node);
1273
1309
  }
1274
1310
  }
1275
- }
1276
- if (childNode.nodeType === 1 /* ElementNode */) {
1277
- markSlotContentForRelocation(childNode);
1311
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1312
+ hostEle.appendChild(slottedItem.node);
1313
+ }
1278
1314
  }
1279
1315
  }
1280
- };
1281
- var nullifyVNodeRefs = (vNode) => {
1282
- if (import_app_data5.BUILD.vdomRef) {
1283
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1284
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1316
+ if (import_app_data5.BUILD.scoped && scopeId2 && slotNodes.length) {
1317
+ slotNodes.forEach((slot) => {
1318
+ slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1319
+ });
1285
1320
  }
1286
- };
1287
- var insertBefore = (parent, newNode, reference) => {
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);
1321
+ if (import_app_data5.BUILD.shadowDom && shadowRoot) {
1322
+ let rnIdex = 0;
1323
+ const rnLen = shadowRootNodes.length;
1324
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
1325
+ shadowRoot.appendChild(shadowRootNodes[rnIdex]);
1326
+ }
1327
+ Array.from(hostElm.childNodes).forEach((node) => {
1328
+ if (node.nodeType === 8 /* CommentNode */ && typeof node["s-sn"] !== "string") {
1329
+ node.parentNode.removeChild(node);
1330
+ }
1331
+ });
1290
1332
  }
1291
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
1292
- return inserted;
1333
+ hostRef.$hostElement$ = hostElm;
1334
+ endHydrate();
1293
1335
  };
1294
- function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {
1295
- var _a;
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;
1336
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
1337
+ let childNodeType;
1338
+ let childIdSplt;
1339
+ let childVNode;
1340
+ let i2;
1341
+ const scopeId2 = hostElm["s-sc"];
1342
+ if (node.nodeType === 1 /* ElementNode */) {
1343
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1344
+ if (childNodeType) {
1345
+ childIdSplt = childNodeType.split(".");
1346
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
1347
+ childVNode = createSimpleVNode({
1348
+ $flags$: 0,
1349
+ $hostId$: childIdSplt[0],
1350
+ $nodeId$: childIdSplt[1],
1351
+ $depth$: childIdSplt[2],
1352
+ $index$: childIdSplt[3],
1353
+ $tag$: node.tagName.toLowerCase(),
1354
+ $elm$: node,
1355
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
1356
+ // won't try to reconcile them. Classes set on the node will be blown away.
1357
+ $attrs$: { class: node.className || "" }
1358
+ });
1359
+ childRenderNodes.push(childVNode);
1360
+ node.removeAttribute(HYDRATE_CHILD_ID);
1361
+ if (!parentVNode.$children$) {
1362
+ parentVNode.$children$ = [];
1363
+ }
1364
+ if (import_app_data5.BUILD.scoped && scopeId2) {
1365
+ node["s-si"] = scopeId2;
1366
+ childVNode.$attrs$.class += " " + scopeId2;
1367
+ }
1368
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
1369
+ if (typeof slotName === "string") {
1370
+ if (childVNode.$tag$ === "slot-fb") {
1371
+ addSlot(
1372
+ slotName,
1373
+ childIdSplt[2],
1374
+ childVNode,
1375
+ node,
1376
+ parentVNode,
1377
+ childRenderNodes,
1378
+ slotNodes,
1379
+ shadowRootNodes,
1380
+ slottedNodes
1381
+ );
1382
+ if (import_app_data5.BUILD.scoped && scopeId2) {
1383
+ node.classList.add(scopeId2);
1384
+ }
1385
+ }
1386
+ childVNode.$elm$["s-sn"] = slotName;
1387
+ childVNode.$elm$.removeAttribute("s-sn");
1388
+ }
1389
+ if (childVNode.$index$ !== void 0) {
1390
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1391
+ }
1392
+ parentVNode = childVNode;
1393
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
1394
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1308
1395
  }
1309
- child = child.nextSibling;
1310
1396
  }
1311
- if (!found) oldParent.classList.remove(scopeId2 + "-s");
1312
1397
  }
1313
- }
1314
- }
1315
- var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1316
- var _a, _b, _c, _d, _e;
1317
- const hostElm = hostRef.$hostElement$;
1318
- const cmpMeta = hostRef.$cmpMeta$;
1319
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1320
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1321
- hostTagName = hostElm.tagName;
1322
- if (import_app_data5.BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1323
- throw new Error(`The <Host> must be the single root component.
1324
- Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1325
-
1326
- The render() function should look like this instead:
1327
-
1328
- render() {
1329
- // Do not return an array
1330
- return (
1331
- <Host>{content}</Host>
1332
- );
1333
- }
1334
- `);
1335
- }
1336
- if (import_app_data5.BUILD.reflect && cmpMeta.$attrsToReflect$) {
1337
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1338
- cmpMeta.$attrsToReflect$.map(
1339
- ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
1340
- );
1341
- }
1342
- if (isInitialLoad && rootVnode.$attrs$) {
1343
- for (const key of Object.keys(rootVnode.$attrs$)) {
1344
- if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
1345
- rootVnode.$attrs$[key] = hostElm[key];
1398
+ if (node.shadowRoot) {
1399
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
1400
+ clientHydrate(
1401
+ parentVNode,
1402
+ childRenderNodes,
1403
+ slotNodes,
1404
+ shadowRootNodes,
1405
+ hostElm,
1406
+ node.shadowRoot.childNodes[i2],
1407
+ hostId,
1408
+ slottedNodes
1409
+ );
1346
1410
  }
1347
1411
  }
1348
- }
1349
- rootVnode.$tag$ = null;
1350
- rootVnode.$flags$ |= 4 /* isHost */;
1351
- hostRef.$vnode$ = rootVnode;
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) {
1354
- scopeId = hostElm["s-sc"];
1355
- }
1356
- useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1357
- if (import_app_data5.BUILD.slotRelocation) {
1358
- contentRef = hostElm["s-cr"];
1359
- checkSlotFallbackVisibility = false;
1360
- }
1361
- patch(oldVNode, rootVnode, isInitialLoad);
1362
- if (import_app_data5.BUILD.slotRelocation) {
1363
- plt.$flags$ |= 1 /* isTmpDisconnected */;
1364
- if (checkSlotRelocate) {
1365
- markSlotContentForRelocation(rootVnode.$elm$);
1366
- for (const relocateData of relocateNodes) {
1367
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1368
- if (!nodeToRelocate["s-ol"]) {
1369
- const orgLocationNode = import_app_data5.BUILD.isDebug || import_app_data5.BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
1370
- orgLocationNode["s-nr"] = nodeToRelocate;
1371
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1372
- }
1373
- }
1374
- for (const relocateData of relocateNodes) {
1375
- const nodeToRelocate = relocateData.$nodeToRelocate$;
1376
- const slotRefNode = relocateData.$slotRefNode$;
1377
- if (slotRefNode) {
1378
- const parentNodeRef = slotRefNode.parentNode;
1379
- let insertBeforeNode = slotRefNode.nextSibling;
1380
- if (!import_app_data5.BUILD.hydrateServerSide && (!import_app_data5.BUILD.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
1381
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
1382
- while (orgLocationNode) {
1383
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
1384
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
1385
- refNode = refNode.nextSibling;
1386
- while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
1387
- refNode = refNode == null ? void 0 : refNode.nextSibling;
1388
- }
1389
- if (!refNode || !refNode["s-nr"]) {
1390
- insertBeforeNode = refNode;
1391
- break;
1392
- }
1393
- }
1394
- orgLocationNode = orgLocationNode.previousSibling;
1412
+ const nonShadowNodes = node.__childNodes || node.childNodes;
1413
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
1414
+ clientHydrate(
1415
+ parentVNode,
1416
+ childRenderNodes,
1417
+ slotNodes,
1418
+ shadowRootNodes,
1419
+ hostElm,
1420
+ nonShadowNodes[i2],
1421
+ hostId,
1422
+ slottedNodes
1423
+ );
1424
+ }
1425
+ } else if (node.nodeType === 8 /* CommentNode */) {
1426
+ childIdSplt = node.nodeValue.split(".");
1427
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
1428
+ childNodeType = childIdSplt[0];
1429
+ childVNode = createSimpleVNode({
1430
+ $hostId$: childIdSplt[1],
1431
+ $nodeId$: childIdSplt[2],
1432
+ $depth$: childIdSplt[3],
1433
+ $index$: childIdSplt[4] || "0",
1434
+ $elm$: node,
1435
+ $attrs$: null,
1436
+ $children$: null,
1437
+ $key$: null,
1438
+ $name$: null,
1439
+ $tag$: null,
1440
+ $text$: null
1441
+ });
1442
+ if (childNodeType === TEXT_NODE_ID) {
1443
+ childVNode.$elm$ = node.nextSibling;
1444
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1445
+ childVNode.$text$ = childVNode.$elm$.textContent;
1446
+ childRenderNodes.push(childVNode);
1447
+ node.remove();
1448
+ if (hostId === childVNode.$hostId$) {
1449
+ if (!parentVNode.$children$) {
1450
+ parentVNode.$children$ = [];
1395
1451
  }
1452
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1396
1453
  }
1397
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
1398
- if (nodeToRelocate !== insertBeforeNode) {
1399
- if (!import_app_data5.BUILD.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1400
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1401
- }
1402
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1403
- if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1404
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1405
- }
1406
- }
1454
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
1455
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1407
1456
  }
1408
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
1409
- } else {
1410
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1411
- if (isInitialLoad) {
1412
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
1413
- }
1414
- nodeToRelocate.hidden = true;
1457
+ }
1458
+ } else if (childNodeType === COMMENT_NODE_ID) {
1459
+ childVNode.$elm$ = node.nextSibling;
1460
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
1461
+ childRenderNodes.push(childVNode);
1462
+ node.remove();
1463
+ }
1464
+ } else if (childVNode.$hostId$ === hostId) {
1465
+ if (childNodeType === SLOT_NODE_ID) {
1466
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
1467
+ addSlot(
1468
+ slotName,
1469
+ childIdSplt[2],
1470
+ childVNode,
1471
+ node,
1472
+ parentVNode,
1473
+ childRenderNodes,
1474
+ slotNodes,
1475
+ shadowRootNodes,
1476
+ slottedNodes
1477
+ );
1478
+ } else if (childNodeType === CONTENT_REF_ID) {
1479
+ if (import_app_data5.BUILD.shadowDom && shadowRootNodes) {
1480
+ node.remove();
1481
+ } else if (import_app_data5.BUILD.slotRelocation) {
1482
+ hostElm["s-cr"] = node;
1483
+ node["s-cn"] = true;
1415
1484
  }
1416
1485
  }
1417
1486
  }
1418
1487
  }
1419
- if (checkSlotFallbackVisibility) {
1420
- updateFallbackSlotVisibility(rootVnode.$elm$);
1421
- }
1422
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1423
- relocateNodes.length = 0;
1488
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
1489
+ const vnode = newVNode(null, node.textContent);
1490
+ vnode.$elm$ = node;
1491
+ vnode.$index$ = "0";
1492
+ parentVNode.$children$ = [vnode];
1424
1493
  }
1425
- if (import_app_data5.BUILD.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1426
- const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1427
- for (const childNode of children) {
1428
- if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
1429
- if (isInitialLoad && childNode["s-ih"] == null) {
1430
- childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
1431
- }
1432
- childNode.hidden = true;
1494
+ return parentVNode;
1495
+ };
1496
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
1497
+ if (node.nodeType === 1 /* ElementNode */) {
1498
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
1499
+ if (componentId) {
1500
+ orgLocNodes.set(componentId, node);
1501
+ }
1502
+ let i2 = 0;
1503
+ if (node.shadowRoot) {
1504
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
1505
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
1433
1506
  }
1434
1507
  }
1508
+ const nonShadowNodes = node.__childNodes || node.childNodes;
1509
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
1510
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
1511
+ }
1512
+ } else if (node.nodeType === 8 /* CommentNode */) {
1513
+ const childIdSplt = node.nodeValue.split(".");
1514
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
1515
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
1516
+ node.nodeValue = "";
1517
+ node["s-en"] = childIdSplt[3];
1518
+ }
1435
1519
  }
1436
- contentRef = void 0;
1437
- };
1438
- var slotReferenceDebugNode = (slotVNode) => doc.createComment(
1439
- `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
1440
- );
1441
- var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
1442
- `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
1443
- );
1444
-
1445
- // src/runtime/dom-extras.ts
1446
- var patchPseudoShadowDom = (hostElementPrototype) => {
1447
- patchCloneNode(hostElementPrototype);
1448
- patchSlotAppendChild(hostElementPrototype);
1449
- patchSlotAppend(hostElementPrototype);
1450
- patchSlotPrepend(hostElementPrototype);
1451
- patchSlotInsertAdjacentElement(hostElementPrototype);
1452
- patchSlotInsertAdjacentHTML(hostElementPrototype);
1453
- patchSlotInsertAdjacentText(hostElementPrototype);
1454
- patchTextContent(hostElementPrototype);
1455
- patchChildSlotNodes(hostElementPrototype);
1456
- patchSlotRemoveChild(hostElementPrototype);
1457
1520
  };
1458
- var patchCloneNode = (HostElementPrototype) => {
1459
- const orgCloneNode = HostElementPrototype.cloneNode;
1460
- HostElementPrototype.cloneNode = function(deep) {
1461
- const srcNode = this;
1462
- const isShadowDom = import_app_data6.BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
1463
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1464
- if (import_app_data6.BUILD.slot && !isShadowDom && deep) {
1465
- let i2 = 0;
1466
- let slotted, nonStencilNode;
1467
- const stencilPrivates = [
1468
- "s-id",
1469
- "s-cr",
1470
- "s-lr",
1471
- "s-rc",
1472
- "s-sc",
1473
- "s-p",
1474
- "s-cn",
1475
- "s-sr",
1476
- "s-sn",
1477
- "s-hn",
1478
- "s-ol",
1479
- "s-nr",
1480
- "s-si",
1481
- "s-rf",
1482
- "s-scs"
1483
- ];
1484
- const childNodes = this.__childNodes || this.childNodes;
1485
- for (; i2 < childNodes.length; i2++) {
1486
- slotted = childNodes[i2]["s-nr"];
1487
- nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
1488
- if (slotted) {
1489
- if (import_app_data6.BUILD.appendChildSlotFix && clonedNode.__appendChild) {
1490
- clonedNode.__appendChild(slotted.cloneNode(true));
1491
- } else {
1492
- clonedNode.appendChild(slotted.cloneNode(true));
1493
- }
1494
- }
1495
- if (nonStencilNode) {
1496
- clonedNode.appendChild(childNodes[i2].cloneNode(true));
1497
- }
1498
- }
1499
- }
1500
- return clonedNode;
1521
+ var createSimpleVNode = (vnode) => {
1522
+ const defaultVNode = {
1523
+ $flags$: 0,
1524
+ $hostId$: null,
1525
+ $nodeId$: null,
1526
+ $depth$: null,
1527
+ $index$: "0",
1528
+ $elm$: null,
1529
+ $attrs$: null,
1530
+ $children$: null,
1531
+ $key$: null,
1532
+ $name$: null,
1533
+ $tag$: null,
1534
+ $text$: null
1501
1535
  };
1536
+ return { ...defaultVNode, ...vnode };
1502
1537
  };
1503
- var patchSlotAppendChild = (HostElementPrototype) => {
1504
- HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
1505
- HostElementPrototype.appendChild = function(newChild) {
1506
- const slotName = newChild["s-sn"] = getSlotName(newChild);
1507
- const slotNode = getHostSlotNodes(this.__childNodes || this.childNodes, this.tagName, slotName)[0];
1508
- if (slotNode) {
1509
- addSlotRelocateNode(newChild, slotNode);
1510
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1511
- const appendAfter = slotChildNodes[slotChildNodes.length - 1];
1512
- const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
1513
- updateFallbackSlotVisibility(this);
1514
- return insertedNode;
1538
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
1539
+ node["s-sr"] = true;
1540
+ childVNode.$name$ = slotName || null;
1541
+ childVNode.$tag$ = "slot";
1542
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1543
+ if (import_app_data5.BUILD.shadowDom && shadowRootNodes) {
1544
+ const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1545
+ if (childVNode.$name$) {
1546
+ childVNode.$elm$.setAttribute("name", slotName);
1515
1547
  }
1516
- return this.__appendChild(newChild);
1517
- };
1518
- };
1519
- var patchSlotRemoveChild = (ElementPrototype) => {
1520
- ElementPrototype.__removeChild = ElementPrototype.removeChild;
1521
- ElementPrototype.removeChild = function(toRemove) {
1522
- if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
1523
- const childNodes = this.__childNodes || this.childNodes;
1524
- const slotNode = getHostSlotNodes(childNodes, this.tagName, toRemove["s-sn"]);
1525
- if (slotNode && toRemove.isConnected) {
1526
- toRemove.remove();
1527
- updateFallbackSlotVisibility(this);
1528
- return;
1529
- }
1548
+ if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1549
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1550
+ } else {
1551
+ node.parentNode.insertBefore(childVNode.$elm$, node);
1530
1552
  }
1531
- return this.__removeChild(toRemove);
1532
- };
1533
- };
1534
- var patchSlotPrepend = (HostElementPrototype) => {
1535
- HostElementPrototype.__prepend = HostElementPrototype.prepend;
1536
- HostElementPrototype.prepend = function(...newChildren) {
1537
- newChildren.forEach((newChild) => {
1538
- if (typeof newChild === "string") {
1539
- newChild = this.ownerDocument.createTextNode(newChild);
1540
- }
1541
- const slotName = newChild["s-sn"] = getSlotName(newChild);
1542
- const childNodes = this.__childNodes || this.childNodes;
1543
- const slotNode = getHostSlotNodes(childNodes, this.tagName, slotName)[0];
1544
- if (slotNode) {
1545
- addSlotRelocateNode(newChild, slotNode, true);
1546
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1547
- const appendAfter = slotChildNodes[0];
1548
- return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
1549
- }
1550
- if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
1551
- newChild.hidden = true;
1552
- }
1553
- return HostElementPrototype.__prepend(newChild);
1554
- });
1555
- };
1556
- };
1557
- var patchSlotAppend = (HostElementPrototype) => {
1558
- HostElementPrototype.__append = HostElementPrototype.append;
1559
- HostElementPrototype.append = function(...newChildren) {
1560
- newChildren.forEach((newChild) => {
1561
- if (typeof newChild === "string") {
1562
- newChild = this.ownerDocument.createTextNode(newChild);
1563
- }
1564
- this.appendChild(newChild);
1565
- });
1566
- };
1567
- };
1568
- var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
1569
- const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
1570
- HostElementPrototype.insertAdjacentHTML = function(position, text) {
1571
- if (position !== "afterbegin" && position !== "beforeend") {
1572
- return originalInsertAdjacentHtml.call(this, position, text);
1553
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1554
+ node.remove();
1555
+ if (childVNode.$depth$ === "0") {
1556
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1573
1557
  }
1574
- const container = this.ownerDocument.createElement("_");
1575
- let node;
1576
- container.innerHTML = text;
1577
- if (position === "afterbegin") {
1578
- while (node = container.firstChild) {
1579
- this.prepend(node);
1580
- }
1581
- } else if (position === "beforeend") {
1582
- while (node = container.firstChild) {
1583
- this.append(node);
1584
- }
1558
+ } else {
1559
+ const slot = childVNode.$elm$;
1560
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1561
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1562
+ if (shouldMove) {
1563
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1585
1564
  }
1586
- };
1587
- };
1588
- var patchSlotInsertAdjacentText = (HostElementPrototype) => {
1589
- HostElementPrototype.insertAdjacentText = function(position, text) {
1590
- this.insertAdjacentHTML(position, text);
1591
- };
1565
+ childRenderNodes.push(childVNode);
1566
+ }
1567
+ slotNodes.push(childVNode);
1568
+ if (!parentVNode.$children$) {
1569
+ parentVNode.$children$ = [];
1570
+ }
1571
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1572
+ }
1573
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1574
+ let slottedNode = slotNode.nextSibling;
1575
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1576
+ while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
1577
+ slottedNode["s-sn"] = slotName;
1578
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1579
+ slottedNode = slottedNode.nextSibling;
1580
+ }
1592
1581
  };
1593
- var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
1594
- const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
1595
- HostElementPrototype.insertAdjacentElement = function(position, element) {
1596
- if (position !== "afterbegin" && position !== "beforeend") {
1597
- return originalInsertAdjacentElement.call(this, position, element);
1582
+
1583
+ // src/runtime/initialize-component.ts
1584
+ var import_app_data16 = require("@stencil/core/internal/app-data");
1585
+
1586
+ // src/runtime/mode.ts
1587
+ var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
1588
+ var setMode = (handler) => modeResolutionChain.push(handler);
1589
+ var getMode = (ref) => getHostRef(ref).$modeName$;
1590
+
1591
+ // src/runtime/proxy-component.ts
1592
+ var import_app_data15 = require("@stencil/core/internal/app-data");
1593
+
1594
+ // src/runtime/set-value.ts
1595
+ var import_app_data14 = require("@stencil/core/internal/app-data");
1596
+
1597
+ // src/runtime/parse-property-value.ts
1598
+ var import_app_data6 = require("@stencil/core/internal/app-data");
1599
+ var parsePropertyValue = (propValue, propType) => {
1600
+ if (propValue != null && !isComplexType(propValue)) {
1601
+ if (import_app_data6.BUILD.propBoolean && propType & 4 /* Boolean */) {
1602
+ return propValue === "false" ? false : propValue === "" || !!propValue;
1598
1603
  }
1599
- if (position === "afterbegin") {
1600
- this.prepend(element);
1601
- return element;
1602
- } else if (position === "beforeend") {
1603
- this.append(element);
1604
- return element;
1604
+ if (import_app_data6.BUILD.propNumber && propType & 2 /* Number */) {
1605
+ return parseFloat(propValue);
1605
1606
  }
1606
- return element;
1607
- };
1607
+ if (import_app_data6.BUILD.propString && propType & 1 /* String */) {
1608
+ return String(propValue);
1609
+ }
1610
+ return propValue;
1611
+ }
1612
+ return propValue;
1608
1613
  };
1609
- var patchTextContent = (hostElementPrototype) => {
1610
- patchHostOriginalAccessor("textContent", hostElementPrototype);
1611
- Object.defineProperty(hostElementPrototype, "textContent", {
1612
- get: function() {
1613
- let text = "";
1614
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
1615
- childNodes.forEach((node) => text += node.textContent || "");
1616
- return text;
1617
- },
1618
- set: function(value) {
1619
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
1620
- childNodes.forEach((node) => {
1621
- if (node["s-ol"]) node["s-ol"].remove();
1622
- node.remove();
1614
+
1615
+ // src/runtime/update-component.ts
1616
+ var import_app_data13 = require("@stencil/core/internal/app-data");
1617
+
1618
+ // src/runtime/event-emitter.ts
1619
+ var import_app_data8 = require("@stencil/core/internal/app-data");
1620
+
1621
+ // src/runtime/element.ts
1622
+ var import_app_data7 = require("@stencil/core/internal/app-data");
1623
+ var getElement = (ref) => import_app_data7.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
1624
+
1625
+ // src/runtime/event-emitter.ts
1626
+ var createEvent = (ref, name, flags) => {
1627
+ const elm = getElement(ref);
1628
+ return {
1629
+ emit: (detail) => {
1630
+ if (import_app_data8.BUILD.isDev && !elm.isConnected) {
1631
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1632
+ }
1633
+ return emitEvent(elm, name, {
1634
+ bubbles: !!(flags & 4 /* Bubbles */),
1635
+ composed: !!(flags & 2 /* Composed */),
1636
+ cancelable: !!(flags & 1 /* Cancellable */),
1637
+ detail
1623
1638
  });
1624
- this.insertAdjacentHTML("beforeend", value);
1625
1639
  }
1626
- });
1640
+ };
1627
1641
  };
1628
- var patchChildSlotNodes = (elm) => {
1629
- class FakeNodeList extends Array {
1630
- item(n) {
1631
- return this[n];
1642
+ var emitEvent = (elm, name, opts) => {
1643
+ const ev = plt.ce(name, opts);
1644
+ elm.dispatchEvent(ev);
1645
+ return ev;
1646
+ };
1647
+
1648
+ // src/runtime/styles.ts
1649
+ var import_app_data9 = require("@stencil/core/internal/app-data");
1650
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1651
+ var registerStyle = (scopeId2, cssText, allowCS) => {
1652
+ let style = styles.get(scopeId2);
1653
+ if (supportsConstructableStylesheets && allowCS) {
1654
+ style = style || new CSSStyleSheet();
1655
+ if (typeof style === "string") {
1656
+ style = cssText;
1657
+ } else {
1658
+ style.replaceSync(cssText);
1632
1659
  }
1660
+ } else {
1661
+ style = cssText;
1633
1662
  }
1634
- patchHostOriginalAccessor("children", elm);
1635
- Object.defineProperty(elm, "children", {
1636
- get() {
1637
- return this.childNodes.filter((n) => n.nodeType === 1);
1638
- }
1639
- });
1640
- Object.defineProperty(elm, "childElementCount", {
1641
- get() {
1642
- return this.children.length;
1643
- }
1644
- });
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);
1658
- Object.defineProperty(elm, "childNodes", {
1659
- get() {
1660
- var _a, _b;
1661
- if (!plt.$flags$ || !((_a = getHostRef(this)) == null ? void 0 : _a.$flags$) || (plt.$flags$ & 1 /* isTmpDisconnected */) === 0 && ((_b = getHostRef(this)) == null ? void 0 : _b.$flags$) & 2 /* hasRendered */) {
1662
- const result = new FakeNodeList();
1663
- const nodes = getSlottedChildNodes(this.__childNodes);
1664
- result.push(...nodes);
1665
- return result;
1663
+ styles.set(scopeId2, style);
1664
+ };
1665
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1666
+ var _a;
1667
+ const scopeId2 = getScopeId(cmpMeta, mode);
1668
+ const style = styles.get(scopeId2);
1669
+ if (!import_app_data9.BUILD.attachStyles) {
1670
+ return scopeId2;
1671
+ }
1672
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
1673
+ if (style) {
1674
+ if (typeof style === "string") {
1675
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
1676
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1677
+ let styleElm;
1678
+ if (!appliedStyles) {
1679
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1666
1680
  }
1667
- return FakeNodeList.from(this.__childNodes);
1681
+ if (!appliedStyles.has(scopeId2)) {
1682
+ if (import_app_data9.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1683
+ styleElm.innerHTML = style;
1684
+ } else {
1685
+ styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
1686
+ styleElm.innerHTML = style;
1687
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
1688
+ if (nonce != null) {
1689
+ styleElm.setAttribute("nonce", nonce);
1690
+ }
1691
+ if ((import_app_data9.BUILD.hydrateServerSide || import_app_data9.BUILD.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1692
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1693
+ }
1694
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1695
+ if (styleContainerNode.nodeName === "HEAD") {
1696
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1697
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1698
+ styleContainerNode.insertBefore(styleElm, referenceNode2);
1699
+ } else if ("host" in styleContainerNode) {
1700
+ if (supportsConstructableStylesheets) {
1701
+ const stylesheet = new CSSStyleSheet();
1702
+ stylesheet.replaceSync(style);
1703
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1704
+ } else {
1705
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1706
+ if (existingStyleContainer) {
1707
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1708
+ } else {
1709
+ styleContainerNode.prepend(styleElm);
1710
+ }
1711
+ }
1712
+ } else {
1713
+ styleContainerNode.append(styleElm);
1714
+ }
1715
+ }
1716
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
1717
+ styleContainerNode.insertBefore(styleElm, null);
1718
+ }
1719
+ }
1720
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1721
+ styleElm.innerHTML += SLOT_FB_CSS;
1722
+ }
1723
+ if (appliedStyles) {
1724
+ appliedStyles.add(scopeId2);
1725
+ }
1726
+ }
1727
+ } else if (import_app_data9.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1728
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1668
1729
  }
1669
- });
1730
+ }
1731
+ return scopeId2;
1670
1732
  };
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);
1733
+ var attachStyles = (hostRef) => {
1734
+ const cmpMeta = hostRef.$cmpMeta$;
1735
+ const elm = hostRef.$hostElement$;
1736
+ const flags = cmpMeta.$flags$;
1737
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1738
+ const scopeId2 = addStyle(
1739
+ import_app_data9.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1740
+ cmpMeta,
1741
+ hostRef.$modeName$
1742
+ );
1743
+ if ((import_app_data9.BUILD.shadowDom || import_app_data9.BUILD.scoped) && import_app_data9.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
1744
+ elm["s-sc"] = scopeId2;
1745
+ elm.classList.add(scopeId2 + "-h");
1678
1746
  }
1747
+ endAttachStyles();
1679
1748
  };
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];
1749
+ var getScopeId = (cmp, mode) => "sc-" + (import_app_data9.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1750
+
1751
+ // src/runtime/vdom/vdom-render.ts
1752
+ var import_app_data12 = require("@stencil/core/internal/app-data");
1753
+
1754
+ // src/runtime/vdom/update-element.ts
1755
+ var import_app_data11 = require("@stencil/core/internal/app-data");
1756
+
1757
+ // src/runtime/vdom/set-accessor.ts
1758
+ var import_app_data10 = require("@stencil/core/internal/app-data");
1759
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
1760
+ if (oldValue !== newValue) {
1761
+ let isProp = isMemberInElement(elm, memberName);
1762
+ let ln = memberName.toLowerCase();
1763
+ if (import_app_data10.BUILD.vdomClass && memberName === "class") {
1764
+ const classList = elm.classList;
1765
+ const oldClasses = parseClassList(oldValue);
1766
+ let newClasses = parseClassList(newValue);
1767
+ if (elm["s-si"]) {
1768
+ newClasses.push(elm["s-si"]);
1769
+ oldClasses.forEach((c) => {
1770
+ if (c.startsWith(elm["s-si"])) newClasses.push(c);
1771
+ });
1772
+ newClasses = [...new Set(newClasses)];
1773
+ classList.add(...newClasses);
1774
+ delete elm["s-si"];
1775
+ } else {
1776
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
1777
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
1690
1778
  }
1691
- return this.__nextSibling;
1692
- }
1693
- });
1694
- };
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];
1779
+ } else if (import_app_data10.BUILD.vdomStyle && memberName === "style") {
1780
+ if (import_app_data10.BUILD.updatable) {
1781
+ for (const prop in oldValue) {
1782
+ if (!newValue || newValue[prop] == null) {
1783
+ if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
1784
+ elm.style.removeProperty(prop);
1785
+ } else {
1786
+ elm.style[prop] = "";
1787
+ }
1788
+ }
1789
+ }
1705
1790
  }
1706
- return this.__nextElementSibling;
1707
- }
1708
- });
1709
- };
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];
1791
+ for (const prop in newValue) {
1792
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
1793
+ if (!import_app_data10.BUILD.hydrateServerSide && prop.includes("-")) {
1794
+ elm.style.setProperty(prop, newValue[prop]);
1795
+ } else {
1796
+ elm.style[prop] = newValue[prop];
1797
+ }
1798
+ }
1720
1799
  }
1721
- return this.__previousSibling;
1722
- }
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];
1800
+ } else if (import_app_data10.BUILD.vdomKey && memberName === "key") {
1801
+ } else if (import_app_data10.BUILD.vdomRef && memberName === "ref") {
1802
+ if (newValue) {
1803
+ newValue(elm);
1735
1804
  }
1736
- return this.__previousElementSibling;
1737
- }
1738
- });
1739
- };
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);
1755
- }
1756
- if (!accessor) {
1757
- accessor = Object.getOwnPropertyDescriptor(node, accessorName);
1758
- }
1759
- if (accessor) Object.defineProperty(node, "__" + accessorName, accessor);
1760
- }
1761
-
1762
- // src/runtime/profile.ts
1763
- var import_app_data7 = require("@stencil/core/internal/app-data");
1764
- var i = 0;
1765
- var createTime = (fnName, tagName = "") => {
1766
- if (import_app_data7.BUILD.profile && performance.mark) {
1767
- const key = `st:${fnName}:${tagName}:${i++}`;
1768
- performance.mark(key);
1769
- return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
1770
- } else {
1771
- return () => {
1772
- return;
1773
- };
1774
- }
1775
- };
1776
- var uniqueTime = (key, measureText) => {
1777
- if (import_app_data7.BUILD.profile && performance.mark) {
1778
- if (performance.getEntriesByName(key, "mark").length === 0) {
1779
- performance.mark(key);
1780
- }
1781
- return () => {
1782
- if (performance.getEntriesByName(measureText, "measure").length === 0) {
1783
- performance.measure(measureText, key);
1805
+ } else if (import_app_data10.BUILD.vdomListener && (import_app_data10.BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
1806
+ if (memberName[2] === "-") {
1807
+ memberName = memberName.slice(3);
1808
+ } else if (isMemberInElement(win, ln)) {
1809
+ memberName = ln.slice(2);
1810
+ } else {
1811
+ memberName = ln[2] + memberName.slice(3);
1812
+ }
1813
+ if (oldValue || newValue) {
1814
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
1815
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
1816
+ if (oldValue) {
1817
+ plt.rel(elm, memberName, oldValue, capture);
1818
+ }
1819
+ if (newValue) {
1820
+ plt.ael(elm, memberName, newValue, capture);
1821
+ }
1822
+ }
1823
+ } else if (import_app_data10.BUILD.vdomPropOrAttr) {
1824
+ const isComplex = isComplexType(newValue);
1825
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
1826
+ try {
1827
+ if (!elm.tagName.includes("-")) {
1828
+ const n = newValue == null ? "" : newValue;
1829
+ if (memberName === "list") {
1830
+ isProp = false;
1831
+ } else if (oldValue == null || elm[memberName] != n) {
1832
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
1833
+ elm[memberName] = n;
1834
+ } else {
1835
+ elm.setAttribute(memberName, n);
1836
+ }
1837
+ }
1838
+ } else if (elm[memberName] !== newValue) {
1839
+ elm[memberName] = newValue;
1840
+ }
1841
+ } catch (e) {
1842
+ }
1784
1843
  }
1785
- };
1786
- } else {
1787
- return () => {
1788
- return;
1789
- };
1844
+ let xlink = false;
1845
+ if (import_app_data10.BUILD.vdomXlink) {
1846
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
1847
+ memberName = ln;
1848
+ xlink = true;
1849
+ }
1850
+ }
1851
+ if (newValue == null || newValue === false) {
1852
+ if (newValue !== false || elm.getAttribute(memberName) === "") {
1853
+ if (import_app_data10.BUILD.vdomXlink && xlink) {
1854
+ elm.removeAttributeNS(XLINK_NS, memberName);
1855
+ } else {
1856
+ elm.removeAttribute(memberName);
1857
+ }
1858
+ }
1859
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
1860
+ newValue = newValue === true ? "" : newValue;
1861
+ if (import_app_data10.BUILD.vdomXlink && xlink) {
1862
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
1863
+ } else {
1864
+ elm.setAttribute(memberName, newValue);
1865
+ }
1866
+ }
1867
+ }
1790
1868
  }
1791
1869
  };
1792
- var inspect = (ref) => {
1793
- const hostRef = getHostRef(ref);
1794
- if (!hostRef) {
1795
- return void 0;
1870
+ var parseClassListRegex = /\s/;
1871
+ var parseClassList = (value) => {
1872
+ if (typeof value === "object" && "baseVal" in value) {
1873
+ value = value.baseVal;
1796
1874
  }
1797
- const flags = hostRef.$flags$;
1798
- const hostElement = hostRef.$hostElement$;
1799
- return {
1800
- renderCount: hostRef.$renderCount$,
1801
- flags: {
1802
- hasRendered: !!(flags & 2 /* hasRendered */),
1803
- hasConnected: !!(flags & 1 /* hasConnected */),
1804
- isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
1805
- isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
1806
- isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
1807
- hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
1808
- hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
1809
- isWatchReady: !!(flags & 128 /* isWatchReady */),
1810
- isListenReady: !!(flags & 256 /* isListenReady */),
1811
- needsRerender: !!(flags & 512 /* needsRerender */)
1812
- },
1813
- instanceValues: hostRef.$instanceValues$,
1814
- ancestorComponent: hostRef.$ancestorComponent$,
1815
- hostElement,
1816
- lazyInstance: hostRef.$lazyInstance$,
1817
- vnode: hostRef.$vnode$,
1818
- modeName: hostRef.$modeName$,
1819
- onReadyPromise: hostRef.$onReadyPromise$,
1820
- onReadyResolve: hostRef.$onReadyResolve$,
1821
- onInstancePromise: hostRef.$onInstancePromise$,
1822
- onInstanceResolve: hostRef.$onInstanceResolve$,
1823
- onRenderResolve: hostRef.$onRenderResolve$,
1824
- queuedListeners: hostRef.$queuedListeners$,
1825
- rmListeners: hostRef.$rmListeners$,
1826
- ["s-id"]: hostElement["s-id"],
1827
- ["s-cr"]: hostElement["s-cr"],
1828
- ["s-lr"]: hostElement["s-lr"],
1829
- ["s-p"]: hostElement["s-p"],
1830
- ["s-rc"]: hostElement["s-rc"],
1831
- ["s-sc"]: hostElement["s-sc"]
1832
- };
1875
+ if (!value) {
1876
+ return [];
1877
+ }
1878
+ return value.split(parseClassListRegex);
1833
1879
  };
1834
- var installDevTools = () => {
1835
- if (import_app_data7.BUILD.devTools) {
1836
- const stencil = win.stencil = win.stencil || {};
1837
- const originalInspect = stencil.inspect;
1838
- stencil.inspect = (ref) => {
1839
- let result = inspect(ref);
1840
- if (!result && typeof originalInspect === "function") {
1841
- result = originalInspect(ref);
1880
+ var CAPTURE_EVENT_SUFFIX = "Capture";
1881
+ var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
1882
+
1883
+ // src/runtime/vdom/update-element.ts
1884
+ var updateElement = (oldVnode, newVnode, isSvgMode2) => {
1885
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
1886
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
1887
+ const newVnodeAttrs = newVnode.$attrs$ || {};
1888
+ if (import_app_data11.BUILD.updatable) {
1889
+ for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
1890
+ if (!(memberName in newVnodeAttrs)) {
1891
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
1842
1892
  }
1843
- return result;
1844
- };
1893
+ }
1894
+ }
1895
+ for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
1896
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
1845
1897
  }
1846
1898
  };
1899
+ function sortedAttrNames(attrNames) {
1900
+ return attrNames.includes("ref") ? (
1901
+ // we need to sort these to ensure that `'ref'` is the last attr
1902
+ [...attrNames.filter((attr) => attr !== "ref"), "ref"]
1903
+ ) : (
1904
+ // no need to sort, return the original array
1905
+ attrNames
1906
+ );
1907
+ }
1847
1908
 
1848
- // src/runtime/client-hydrate.ts
1849
- var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1850
- const endHydrate = createTime("hydrateClient", tagName);
1851
- const shadowRoot = hostElm.shadowRoot;
1852
- const childRenderNodes = [];
1853
- const slotNodes = [];
1854
- const slottedNodes = [];
1855
- const shadowRootNodes = import_app_data8.BUILD.shadowDom && shadowRoot ? [] : null;
1856
- const vnode = newVNode(tagName, null);
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"];
1909
+ // src/runtime/vdom/vdom-render.ts
1910
+ var scopeId;
1911
+ var contentRef;
1912
+ var hostTagName;
1913
+ var useNativeShadowDom = false;
1914
+ var checkSlotFallbackVisibility = false;
1915
+ var checkSlotRelocate = false;
1916
+ var isSvgMode = false;
1917
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
1918
+ var _a;
1919
+ const newVNode2 = newParentVNode.$children$[childIndex];
1920
+ let i2 = 0;
1921
+ let elm;
1922
+ let childNode;
1923
+ let oldVNode;
1924
+ if (import_app_data12.BUILD.slotRelocation && !useNativeShadowDom) {
1925
+ checkSlotRelocate = true;
1926
+ if (newVNode2.$tag$ === "slot") {
1927
+ newVNode2.$flags$ |= newVNode2.$children$ ? (
1928
+ // slot element has fallback content
1929
+ // still create an element that "mocks" the slot element
1930
+ 2 /* isSlotFallback */
1931
+ ) : (
1932
+ // slot element does not have fallback content
1933
+ // create an html comment we'll use to always reference
1934
+ // where actual slot content should sit next to
1935
+ 1 /* isSlotReference */
1936
+ );
1866
1937
  }
1867
1938
  }
1868
- if (!plt.$orgLocNodes$) {
1869
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1939
+ if (import_app_data12.BUILD.isDev && newVNode2.$elm$) {
1940
+ consoleDevError(
1941
+ `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://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`
1942
+ );
1870
1943
  }
1871
- hostElm[HYDRATE_ID] = hostId;
1872
- hostElm.removeAttribute(HYDRATE_ID);
1873
- hostRef.$vnode$ = clientHydrate(
1874
- vnode,
1875
- childRenderNodes,
1876
- slotNodes,
1877
- shadowRootNodes,
1878
- hostElm,
1879
- hostElm,
1880
- hostId,
1881
- slottedNodes
1882
- );
1883
- let crIndex = 0;
1884
- const crLength = childRenderNodes.length;
1885
- let childRenderNode;
1886
- for (crIndex; crIndex < crLength; crIndex++) {
1887
- childRenderNode = childRenderNodes[crIndex];
1888
- const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
1889
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1890
- const node = childRenderNode.$elm$;
1891
- if (!shadowRoot) {
1892
- node["s-hn"] = tagName.toUpperCase();
1893
- if (childRenderNode.$tag$ === "slot") {
1894
- node["s-cr"] = hostElm["s-cr"];
1895
- }
1944
+ if (import_app_data12.BUILD.vdomText && newVNode2.$text$ !== null) {
1945
+ elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
1946
+ } else if (import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
1947
+ elm = newVNode2.$elm$ = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
1948
+ } else {
1949
+ if (import_app_data12.BUILD.svg && !isSvgMode) {
1950
+ isSvgMode = newVNode2.$tag$ === "svg";
1896
1951
  }
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
- });
1952
+ elm = newVNode2.$elm$ = import_app_data12.BUILD.svg ? doc.createElementNS(
1953
+ isSvgMode ? SVG_NS : HTML_NS,
1954
+ !useNativeShadowDom && import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
1955
+ ) : doc.createElement(
1956
+ !useNativeShadowDom && import_app_data12.BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
1957
+ );
1958
+ if (import_app_data12.BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
1959
+ isSvgMode = false;
1960
+ }
1961
+ if (import_app_data12.BUILD.vdomAttribute) {
1962
+ updateElement(null, newVNode2, isSvgMode);
1963
+ }
1964
+ if (import_app_data12.BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
1965
+ elm.classList.add(elm["s-si"] = scopeId);
1966
+ }
1967
+ if (newVNode2.$children$) {
1968
+ for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
1969
+ childNode = createElm(oldParentVNode, newVNode2, i2);
1970
+ if (childNode) {
1971
+ elm.appendChild(childNode);
1904
1972
  }
1905
- } else {
1906
- childRenderNode.$flags$ |= 1 /* isSlotReference */;
1907
1973
  }
1908
1974
  }
1909
- if (orgLocationNode && orgLocationNode.isConnected) {
1910
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1911
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1912
- }
1913
- orgLocationNode.parentNode.removeChild(orgLocationNode);
1914
- if (!shadowRoot) {
1915
- node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1975
+ if (import_app_data12.BUILD.svg) {
1976
+ if (newVNode2.$tag$ === "svg") {
1977
+ isSvgMode = false;
1978
+ } else if (elm.tagName === "foreignObject") {
1979
+ isSvgMode = true;
1916
1980
  }
1917
1981
  }
1918
- plt.$orgLocNodes$.delete(orgLocationId);
1919
1982
  }
1920
- const hosts = [];
1921
- const snLen = slottedNodes.length;
1922
- let snIndex = 0;
1923
- let slotGroup;
1924
- let snGroupIdx;
1925
- let snGroupLen;
1926
- let slottedItem;
1927
- for (snIndex; snIndex < snLen; snIndex++) {
1928
- slotGroup = slottedNodes[snIndex];
1929
- if (!slotGroup || !slotGroup.length) continue;
1930
- snGroupLen = slotGroup.length;
1931
- snGroupIdx = 0;
1932
- for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
1933
- slottedItem = slotGroup[snGroupIdx];
1934
- if (!hosts[slottedItem.hostId]) {
1935
- hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
1936
- }
1937
- if (!hosts[slottedItem.hostId]) continue;
1938
- const hostEle = hosts[slottedItem.hostId];
1939
- if (!hostEle.shadowRoot || !shadowRoot) {
1940
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1941
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1942
- slottedItem.slot["s-cr"] = hostEle;
1943
- } else {
1944
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1945
- }
1946
- addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1947
- if (import_app_data8.BUILD.experimentalSlotFixes) {
1948
- patchNextPrev(slottedItem.node);
1983
+ elm["s-hn"] = hostTagName;
1984
+ if (import_app_data12.BUILD.slotRelocation) {
1985
+ if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
1986
+ elm["s-sr"] = true;
1987
+ elm["s-cr"] = contentRef;
1988
+ elm["s-sn"] = newVNode2.$name$ || "";
1989
+ elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
1990
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
1991
+ if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
1992
+ if (import_app_data12.BUILD.experimentalSlotFixes) {
1993
+ relocateToHostRoot(oldParentVNode.$elm$);
1994
+ } else {
1995
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
1949
1996
  }
1950
1997
  }
1951
- if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1952
- hostEle.appendChild(slottedItem.node);
1998
+ if (import_app_data12.BUILD.scoped) {
1999
+ addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
1953
2000
  }
1954
2001
  }
1955
2002
  }
1956
- if (import_app_data8.BUILD.scoped && scopeId2 && slotNodes.length) {
1957
- slotNodes.forEach((slot) => {
1958
- slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1959
- });
2003
+ return elm;
2004
+ };
2005
+ var relocateToHostRoot = (parentElm) => {
2006
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
2007
+ const host = parentElm.closest(hostTagName.toLowerCase());
2008
+ if (host != null) {
2009
+ const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
2010
+ (ref) => ref["s-cr"]
2011
+ );
2012
+ const childNodeArray = Array.from(
2013
+ parentElm.__childNodes || parentElm.childNodes
2014
+ );
2015
+ for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
2016
+ if (childNode["s-sh"] != null) {
2017
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
2018
+ childNode["s-sh"] = void 0;
2019
+ checkSlotRelocate = true;
2020
+ }
2021
+ }
1960
2022
  }
1961
- if (import_app_data8.BUILD.shadowDom && shadowRoot) {
1962
- let rnIdex = 0;
1963
- const rnLen = shadowRootNodes.length;
1964
- for (rnIdex; rnIdex < rnLen; rnIdex++) {
1965
- shadowRoot.appendChild(shadowRootNodes[rnIdex]);
2023
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
2024
+ };
2025
+ var putBackInOriginalLocation = (parentElm, recursive) => {
2026
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
2027
+ const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
2028
+ if (parentElm["s-sr"] && import_app_data12.BUILD.experimentalSlotFixes) {
2029
+ let node = parentElm;
2030
+ while (node = node.nextSibling) {
2031
+ if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
2032
+ oldSlotChildNodes.push(node);
2033
+ }
1966
2034
  }
1967
- Array.from(hostElm.childNodes).forEach((node) => {
1968
- if (node.nodeType === 8 /* CommentNode */ && typeof node["s-sn"] !== "string") {
1969
- node.parentNode.removeChild(node);
2035
+ }
2036
+ for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
2037
+ const childNode = oldSlotChildNodes[i2];
2038
+ if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
2039
+ insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
2040
+ childNode["s-ol"].remove();
2041
+ childNode["s-ol"] = void 0;
2042
+ childNode["s-sh"] = void 0;
2043
+ checkSlotRelocate = true;
2044
+ }
2045
+ if (recursive) {
2046
+ putBackInOriginalLocation(childNode, recursive);
2047
+ }
2048
+ }
2049
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
2050
+ };
2051
+ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
2052
+ let containerElm = import_app_data12.BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
2053
+ let childNode;
2054
+ if (import_app_data12.BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
2055
+ containerElm = containerElm.shadowRoot;
2056
+ }
2057
+ for (; startIdx <= endIdx; ++startIdx) {
2058
+ if (vnodes[startIdx]) {
2059
+ childNode = createElm(null, parentVNode, startIdx);
2060
+ if (childNode) {
2061
+ vnodes[startIdx].$elm$ = childNode;
2062
+ insertBefore(containerElm, childNode, import_app_data12.BUILD.slotRelocation ? referenceNode(before) : before);
1970
2063
  }
1971
- });
2064
+ }
1972
2065
  }
1973
- hostRef.$hostElement$ = hostElm;
1974
- endHydrate();
1975
2066
  };
1976
- var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
1977
- let childNodeType;
1978
- let childIdSplt;
1979
- let childVNode;
1980
- let i2;
1981
- const scopeId2 = hostElm["s-sc"];
1982
- if (node.nodeType === 1 /* ElementNode */) {
1983
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1984
- if (childNodeType) {
1985
- childIdSplt = childNodeType.split(".");
1986
- if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
1987
- childVNode = createSimpleVNode({
1988
- $flags$: 0,
1989
- $hostId$: childIdSplt[0],
1990
- $nodeId$: childIdSplt[1],
1991
- $depth$: childIdSplt[2],
1992
- $index$: childIdSplt[3],
1993
- $tag$: node.tagName.toLowerCase(),
1994
- $elm$: node,
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 || "" }
1998
- });
1999
- childRenderNodes.push(childVNode);
2000
- node.removeAttribute(HYDRATE_CHILD_ID);
2001
- if (!parentVNode.$children$) {
2002
- parentVNode.$children$ = [];
2003
- }
2004
- if (import_app_data8.BUILD.scoped && scopeId2) {
2005
- node["s-si"] = scopeId2;
2006
- childVNode.$attrs$.class += " " + scopeId2;
2007
- }
2008
- const slotName = childVNode.$elm$.getAttribute("s-sn");
2009
- if (typeof slotName === "string") {
2010
- if (childVNode.$tag$ === "slot-fb") {
2011
- addSlot(
2012
- slotName,
2013
- childIdSplt[2],
2014
- childVNode,
2015
- node,
2016
- parentVNode,
2017
- childRenderNodes,
2018
- slotNodes,
2019
- shadowRootNodes,
2020
- slottedNodes
2021
- );
2022
- if (import_app_data8.BUILD.scoped && scopeId2) {
2023
- node.classList.add(scopeId2);
2024
- }
2067
+ var removeVnodes = (vnodes, startIdx, endIdx) => {
2068
+ for (let index = startIdx; index <= endIdx; ++index) {
2069
+ const vnode = vnodes[index];
2070
+ if (vnode) {
2071
+ const elm = vnode.$elm$;
2072
+ nullifyVNodeRefs(vnode);
2073
+ if (elm) {
2074
+ if (import_app_data12.BUILD.slotRelocation) {
2075
+ checkSlotFallbackVisibility = true;
2076
+ if (elm["s-ol"]) {
2077
+ elm["s-ol"].remove();
2078
+ } else {
2079
+ putBackInOriginalLocation(elm, true);
2025
2080
  }
2026
- childVNode.$elm$["s-sn"] = slotName;
2027
- childVNode.$elm$.removeAttribute("s-sn");
2028
- }
2029
- if (childVNode.$index$ !== void 0) {
2030
- parentVNode.$children$[childVNode.$index$] = childVNode;
2031
- }
2032
- parentVNode = childVNode;
2033
- if (shadowRootNodes && childVNode.$depth$ === "0") {
2034
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2035
2081
  }
2082
+ elm.remove();
2036
2083
  }
2037
2084
  }
2038
- if (node.shadowRoot) {
2039
- for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
2040
- clientHydrate(
2041
- parentVNode,
2042
- childRenderNodes,
2043
- slotNodes,
2044
- shadowRootNodes,
2045
- hostElm,
2046
- node.shadowRoot.childNodes[i2],
2047
- hostId,
2048
- slottedNodes
2049
- );
2085
+ }
2086
+ };
2087
+ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {
2088
+ let oldStartIdx = 0;
2089
+ let newStartIdx = 0;
2090
+ let idxInOld = 0;
2091
+ let i2 = 0;
2092
+ let oldEndIdx = oldCh.length - 1;
2093
+ let oldStartVnode = oldCh[0];
2094
+ let oldEndVnode = oldCh[oldEndIdx];
2095
+ let newEndIdx = newCh.length - 1;
2096
+ let newStartVnode = newCh[0];
2097
+ let newEndVnode = newCh[newEndIdx];
2098
+ let node;
2099
+ let elmToMove;
2100
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
2101
+ if (oldStartVnode == null) {
2102
+ oldStartVnode = oldCh[++oldStartIdx];
2103
+ } else if (oldEndVnode == null) {
2104
+ oldEndVnode = oldCh[--oldEndIdx];
2105
+ } else if (newStartVnode == null) {
2106
+ newStartVnode = newCh[++newStartIdx];
2107
+ } else if (newEndVnode == null) {
2108
+ newEndVnode = newCh[--newEndIdx];
2109
+ } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
2110
+ patch(oldStartVnode, newStartVnode, isInitialRender);
2111
+ oldStartVnode = oldCh[++oldStartIdx];
2112
+ newStartVnode = newCh[++newStartIdx];
2113
+ } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
2114
+ patch(oldEndVnode, newEndVnode, isInitialRender);
2115
+ oldEndVnode = oldCh[--oldEndIdx];
2116
+ newEndVnode = newCh[--newEndIdx];
2117
+ } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
2118
+ if (import_app_data12.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
2119
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
2050
2120
  }
2051
- }
2052
- const nonShadowNodes = node.__childNodes || node.childNodes;
2053
- for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
2054
- clientHydrate(
2055
- parentVNode,
2056
- childRenderNodes,
2057
- slotNodes,
2058
- shadowRootNodes,
2059
- hostElm,
2060
- nonShadowNodes[i2],
2061
- hostId,
2062
- slottedNodes
2063
- );
2064
- }
2065
- } else if (node.nodeType === 8 /* CommentNode */) {
2066
- childIdSplt = node.nodeValue.split(".");
2067
- if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
2068
- childNodeType = childIdSplt[0];
2069
- childVNode = createSimpleVNode({
2070
- $hostId$: childIdSplt[1],
2071
- $nodeId$: childIdSplt[2],
2072
- $depth$: childIdSplt[3],
2073
- $index$: childIdSplt[4] || "0",
2074
- $elm$: node,
2075
- $attrs$: null,
2076
- $children$: null,
2077
- $key$: null,
2078
- $name$: null,
2079
- $tag$: null,
2080
- $text$: null
2081
- });
2082
- if (childNodeType === TEXT_NODE_ID) {
2083
- childVNode.$elm$ = node.nextSibling;
2084
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
2085
- childVNode.$text$ = childVNode.$elm$.textContent;
2086
- childRenderNodes.push(childVNode);
2087
- node.remove();
2088
- if (hostId === childVNode.$hostId$) {
2089
- if (!parentVNode.$children$) {
2090
- parentVNode.$children$ = [];
2091
- }
2092
- parentVNode.$children$[childVNode.$index$] = childVNode;
2093
- }
2094
- if (shadowRootNodes && childVNode.$depth$ === "0") {
2095
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2121
+ patch(oldStartVnode, newEndVnode, isInitialRender);
2122
+ insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
2123
+ oldStartVnode = oldCh[++oldStartIdx];
2124
+ newEndVnode = newCh[--newEndIdx];
2125
+ } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
2126
+ if (import_app_data12.BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
2127
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
2128
+ }
2129
+ patch(oldEndVnode, newStartVnode, isInitialRender);
2130
+ insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
2131
+ oldEndVnode = oldCh[--oldEndIdx];
2132
+ newStartVnode = newCh[++newStartIdx];
2133
+ } else {
2134
+ idxInOld = -1;
2135
+ if (import_app_data12.BUILD.vdomKey) {
2136
+ for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
2137
+ if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
2138
+ idxInOld = i2;
2139
+ break;
2096
2140
  }
2097
2141
  }
2098
- } else if (childNodeType === COMMENT_NODE_ID) {
2099
- childVNode.$elm$ = node.nextSibling;
2100
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
2101
- childRenderNodes.push(childVNode);
2102
- node.remove();
2142
+ }
2143
+ if (import_app_data12.BUILD.vdomKey && idxInOld >= 0) {
2144
+ elmToMove = oldCh[idxInOld];
2145
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
2146
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
2147
+ } else {
2148
+ patch(elmToMove, newStartVnode, isInitialRender);
2149
+ oldCh[idxInOld] = void 0;
2150
+ node = elmToMove.$elm$;
2103
2151
  }
2104
- } else if (childVNode.$hostId$ === hostId) {
2105
- if (childNodeType === SLOT_NODE_ID) {
2106
- const slotName = node["s-sn"] = childIdSplt[5] || "";
2107
- addSlot(
2108
- slotName,
2109
- childIdSplt[2],
2110
- childVNode,
2152
+ newStartVnode = newCh[++newStartIdx];
2153
+ } else {
2154
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
2155
+ newStartVnode = newCh[++newStartIdx];
2156
+ }
2157
+ if (node) {
2158
+ if (import_app_data12.BUILD.slotRelocation) {
2159
+ insertBefore(
2160
+ referenceNode(oldStartVnode.$elm$).parentNode,
2111
2161
  node,
2112
- parentVNode,
2113
- childRenderNodes,
2114
- slotNodes,
2115
- shadowRootNodes,
2116
- slottedNodes
2162
+ referenceNode(oldStartVnode.$elm$)
2117
2163
  );
2118
- } else if (childNodeType === CONTENT_REF_ID) {
2119
- if (import_app_data8.BUILD.shadowDom && shadowRootNodes) {
2120
- node.remove();
2121
- } else if (import_app_data8.BUILD.slotRelocation) {
2122
- hostElm["s-cr"] = node;
2123
- node["s-cn"] = true;
2124
- }
2164
+ } else {
2165
+ insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
2125
2166
  }
2126
2167
  }
2127
2168
  }
2128
- } else if (parentVNode && parentVNode.$tag$ === "style") {
2129
- const vnode = newVNode(null, node.textContent);
2130
- vnode.$elm$ = node;
2131
- vnode.$index$ = "0";
2132
- parentVNode.$children$ = [vnode];
2133
2169
  }
2134
- return parentVNode;
2135
- };
2136
- var initializeDocumentHydrate = (node, orgLocNodes) => {
2137
- if (node.nodeType === 1 /* ElementNode */) {
2138
- const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
2139
- if (componentId) {
2140
- orgLocNodes.set(componentId, node);
2141
- }
2142
- let i2 = 0;
2143
- if (node.shadowRoot) {
2144
- for (; i2 < node.shadowRoot.childNodes.length; i2++) {
2145
- initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
2146
- }
2147
- }
2148
- const nonShadowNodes = node.__childNodes || node.childNodes;
2149
- for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
2150
- initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
2151
- }
2152
- } else if (node.nodeType === 8 /* CommentNode */) {
2153
- const childIdSplt = node.nodeValue.split(".");
2154
- if (childIdSplt[0] === ORG_LOCATION_ID) {
2155
- orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
2156
- node.nodeValue = "";
2157
- node["s-en"] = childIdSplt[3];
2158
- }
2170
+ if (oldStartIdx > oldEndIdx) {
2171
+ addVnodes(
2172
+ parentElm,
2173
+ newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,
2174
+ newVNode2,
2175
+ newCh,
2176
+ newStartIdx,
2177
+ newEndIdx
2178
+ );
2179
+ } else if (import_app_data12.BUILD.updatable && newStartIdx > newEndIdx) {
2180
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
2159
2181
  }
2160
2182
  };
2161
- var createSimpleVNode = (vnode) => {
2162
- const defaultVNode = {
2163
- $flags$: 0,
2164
- $hostId$: null,
2165
- $nodeId$: null,
2166
- $depth$: null,
2167
- $index$: "0",
2168
- $elm$: null,
2169
- $attrs$: null,
2170
- $children$: null,
2171
- $key$: null,
2172
- $name$: null,
2173
- $tag$: null,
2174
- $text$: null
2175
- };
2176
- return { ...defaultVNode, ...vnode };
2177
- };
2178
- function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
2179
- node["s-sr"] = true;
2180
- childVNode.$name$ = slotName || null;
2181
- childVNode.$tag$ = "slot";
2182
- const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
2183
- if (import_app_data8.BUILD.shadowDom && shadowRootNodes) {
2184
- const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
2185
- if (childVNode.$name$) {
2186
- childVNode.$elm$.setAttribute("name", slotName);
2187
- }
2188
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
2189
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
2190
- } else {
2191
- node.parentNode.insertBefore(childVNode.$elm$, node);
2183
+ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
2184
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
2185
+ if (import_app_data12.BUILD.slotRelocation && leftVNode.$tag$ === "slot") {
2186
+ return leftVNode.$name$ === rightVNode.$name$;
2192
2187
  }
2193
- addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
2194
- node.remove();
2195
- if (childVNode.$depth$ === "0") {
2196
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
2188
+ if (import_app_data12.BUILD.vdomKey && !isInitialRender) {
2189
+ return leftVNode.$key$ === rightVNode.$key$;
2197
2190
  }
2198
- } else {
2199
- const slot = childVNode.$elm$;
2200
- const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
2201
- addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
2202
- if (shouldMove) {
2203
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
2191
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
2192
+ leftVNode.$key$ = rightVNode.$key$;
2204
2193
  }
2205
- childRenderNodes.push(childVNode);
2206
- }
2207
- slotNodes.push(childVNode);
2208
- if (!parentVNode.$children$) {
2209
- parentVNode.$children$ = [];
2210
- }
2211
- parentVNode.$children$[childVNode.$index$] = childVNode;
2212
- }
2213
- var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
2214
- let slottedNode = slotNode.nextSibling;
2215
- slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
2216
- while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ && slottedNode.nodeValue.indexOf(".") !== 1 || slottedNode.nodeType === 3 /* TextNode */))) {
2217
- slottedNode["s-sn"] = slotName;
2218
- slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
2219
- slottedNode = slottedNode.nextSibling;
2194
+ return true;
2220
2195
  }
2196
+ return false;
2221
2197
  };
2222
-
2223
- // src/runtime/initialize-component.ts
2224
- var import_app_data16 = require("@stencil/core/internal/app-data");
2225
-
2226
- // src/runtime/mode.ts
2227
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
2228
- var setMode = (handler) => modeResolutionChain.push(handler);
2229
- var getMode = (ref) => getHostRef(ref).$modeName$;
2230
-
2231
- // src/runtime/proxy-component.ts
2232
- var import_app_data15 = require("@stencil/core/internal/app-data");
2233
-
2234
- // src/runtime/set-value.ts
2235
- var import_app_data14 = require("@stencil/core/internal/app-data");
2236
-
2237
- // src/runtime/parse-property-value.ts
2238
- var import_app_data9 = require("@stencil/core/internal/app-data");
2239
- var parsePropertyValue = (propValue, propType) => {
2240
- if (propValue != null && !isComplexType(propValue)) {
2241
- if (import_app_data9.BUILD.propBoolean && propType & 4 /* Boolean */) {
2242
- return propValue === "false" ? false : propValue === "" || !!propValue;
2198
+ var referenceNode = (node) => node && node["s-ol"] || node;
2199
+ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
2200
+ const elm = newVNode2.$elm$ = oldVNode.$elm$;
2201
+ const oldChildren = oldVNode.$children$;
2202
+ const newChildren = newVNode2.$children$;
2203
+ const tag = newVNode2.$tag$;
2204
+ const text = newVNode2.$text$;
2205
+ let defaultHolder;
2206
+ if (!import_app_data12.BUILD.vdomText || text === null) {
2207
+ if (import_app_data12.BUILD.svg) {
2208
+ isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
2243
2209
  }
2244
- if (import_app_data9.BUILD.propNumber && propType & 2 /* Number */) {
2245
- return parseFloat(propValue);
2210
+ if (import_app_data12.BUILD.vdomAttribute || import_app_data12.BUILD.reflect) {
2211
+ if (import_app_data12.BUILD.slot && tag === "slot" && !useNativeShadowDom) {
2212
+ if (import_app_data12.BUILD.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
2213
+ newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
2214
+ relocateToHostRoot(newVNode2.$elm$.parentElement);
2215
+ }
2216
+ } else {
2217
+ updateElement(oldVNode, newVNode2, isSvgMode);
2218
+ }
2246
2219
  }
2247
- if (import_app_data9.BUILD.propString && propType & 1 /* String */) {
2248
- return String(propValue);
2220
+ if (import_app_data12.BUILD.updatable && oldChildren !== null && newChildren !== null) {
2221
+ updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
2222
+ } else if (newChildren !== null) {
2223
+ if (import_app_data12.BUILD.updatable && import_app_data12.BUILD.vdomText && oldVNode.$text$ !== null) {
2224
+ elm.textContent = "";
2225
+ }
2226
+ addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
2227
+ } else if (
2228
+ // don't do this on initial render as it can cause non-hydrated content to be removed
2229
+ !isInitialRender && import_app_data12.BUILD.updatable && oldChildren !== null
2230
+ ) {
2231
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
2249
2232
  }
2250
- return propValue;
2233
+ if (import_app_data12.BUILD.svg && isSvgMode && tag === "svg") {
2234
+ isSvgMode = false;
2235
+ }
2236
+ } else if (import_app_data12.BUILD.vdomText && import_app_data12.BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) {
2237
+ defaultHolder.parentNode.textContent = text;
2238
+ } else if (import_app_data12.BUILD.vdomText && oldVNode.$text$ !== text) {
2239
+ elm.data = text;
2251
2240
  }
2252
- return propValue;
2253
2241
  };
2254
-
2255
- // src/runtime/update-component.ts
2256
- var import_app_data13 = require("@stencil/core/internal/app-data");
2257
-
2258
- // src/runtime/event-emitter.ts
2259
- var import_app_data11 = require("@stencil/core/internal/app-data");
2260
-
2261
- // src/runtime/element.ts
2262
- var import_app_data10 = require("@stencil/core/internal/app-data");
2263
- var getElement = (ref) => import_app_data10.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2264
-
2265
- // src/runtime/event-emitter.ts
2266
- var createEvent = (ref, name, flags) => {
2267
- const elm = getElement(ref);
2268
- return {
2269
- emit: (detail) => {
2270
- if (import_app_data11.BUILD.isDev && !elm.isConnected) {
2271
- consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2242
+ var relocateNodes = [];
2243
+ var markSlotContentForRelocation = (elm) => {
2244
+ let node;
2245
+ let hostContentNodes;
2246
+ let j;
2247
+ const children = elm.__childNodes || elm.childNodes;
2248
+ for (const childNode of children) {
2249
+ if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
2250
+ hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
2251
+ const slotName = childNode["s-sn"];
2252
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
2253
+ node = hostContentNodes[j];
2254
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!import_app_data12.BUILD.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
2255
+ if (isNodeLocatedInSlot(node, slotName)) {
2256
+ let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
2257
+ checkSlotFallbackVisibility = true;
2258
+ node["s-sn"] = node["s-sn"] || slotName;
2259
+ if (relocateNodeData) {
2260
+ relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"];
2261
+ relocateNodeData.$slotRefNode$ = childNode;
2262
+ } else {
2263
+ node["s-sh"] = childNode["s-hn"];
2264
+ relocateNodes.push({
2265
+ $slotRefNode$: childNode,
2266
+ $nodeToRelocate$: node
2267
+ });
2268
+ }
2269
+ if (node["s-sr"]) {
2270
+ relocateNodes.map((relocateNode) => {
2271
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
2272
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
2273
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
2274
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
2275
+ }
2276
+ }
2277
+ });
2278
+ }
2279
+ } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
2280
+ relocateNodes.push({
2281
+ $nodeToRelocate$: node
2282
+ });
2283
+ }
2284
+ }
2272
2285
  }
2273
- return emitEvent(elm, name, {
2274
- bubbles: !!(flags & 4 /* Bubbles */),
2275
- composed: !!(flags & 2 /* Composed */),
2276
- cancelable: !!(flags & 1 /* Cancellable */),
2277
- detail
2278
- });
2279
2286
  }
2280
- };
2287
+ if (childNode.nodeType === 1 /* ElementNode */) {
2288
+ markSlotContentForRelocation(childNode);
2289
+ }
2290
+ }
2281
2291
  };
2282
- var emitEvent = (elm, name, opts) => {
2283
- const ev = plt.ce(name, opts);
2284
- elm.dispatchEvent(ev);
2285
- return ev;
2292
+ var nullifyVNodeRefs = (vNode) => {
2293
+ if (import_app_data12.BUILD.vdomRef) {
2294
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
2295
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
2296
+ }
2286
2297
  };
2287
-
2288
- // src/runtime/styles.ts
2289
- var import_app_data12 = require("@stencil/core/internal/app-data");
2290
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2291
- var registerStyle = (scopeId2, cssText, allowCS) => {
2292
- let style = styles.get(scopeId2);
2293
- if (supportsConstructableStylesheets && allowCS) {
2294
- style = style || new CSSStyleSheet();
2295
- if (typeof style === "string") {
2296
- style = cssText;
2297
- } else {
2298
- style.replaceSync(cssText);
2298
+ var insertBefore = (parent, newNode, reference) => {
2299
+ if (import_app_data12.BUILD.scoped && typeof newNode["s-sn"] === "string" && !!newNode["s-sr"] && !!newNode["s-cr"]) {
2300
+ addRemoveSlotScopedClass(newNode["s-cr"], newNode, parent, newNode.parentElement);
2301
+ } else if (import_app_data12.BUILD.experimentalSlotFixes && typeof newNode["s-sn"] === "string") {
2302
+ if (parent.getRootNode().nodeType !== 11 /* DOCUMENT_FRAGMENT_NODE */) {
2303
+ patchParentNode(newNode);
2299
2304
  }
2305
+ return parent.insertBefore(newNode, reference);
2306
+ }
2307
+ if (import_app_data12.BUILD.experimentalSlotFixes && parent.__insertBefore) {
2308
+ return parent.__insertBefore(newNode, reference);
2300
2309
  } else {
2301
- style = cssText;
2310
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
2302
2311
  }
2303
- styles.set(scopeId2, style);
2304
2312
  };
2305
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
2313
+ function addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {
2306
2314
  var _a;
2307
- const scopeId2 = getScopeId(cmpMeta, mode);
2308
- const style = styles.get(scopeId2);
2309
- if (!import_app_data12.BUILD.attachStyles) {
2310
- return scopeId2;
2315
+ let scopeId2;
2316
+ if (reference && typeof slotNode["s-sn"] === "string" && !!slotNode["s-sr"] && reference.parentNode && reference.parentNode["s-sc"] && (scopeId2 = slotNode["s-si"] || reference.parentNode["s-sc"])) {
2317
+ const scopeName = slotNode["s-sn"];
2318
+ const hostName = slotNode["s-hn"];
2319
+ (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + "-s");
2320
+ if (oldParent && oldParent.classList.contains(scopeId2 + "-s")) {
2321
+ let child = (oldParent.__childNodes || oldParent.childNodes)[0];
2322
+ let found = false;
2323
+ while (child) {
2324
+ if (child["s-sn"] !== scopeName && child["s-hn"] === hostName && !!child["s-sr"]) {
2325
+ found = true;
2326
+ break;
2327
+ }
2328
+ child = child.nextSibling;
2329
+ }
2330
+ if (!found) oldParent.classList.remove(scopeId2 + "-s");
2331
+ }
2311
2332
  }
2312
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
2313
- if (style) {
2314
- if (typeof style === "string") {
2315
- styleContainerNode = styleContainerNode.head || styleContainerNode;
2316
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2317
- let styleElm;
2318
- if (!appliedStyles) {
2319
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2333
+ }
2334
+ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
2335
+ var _a, _b, _c, _d, _e;
2336
+ const hostElm = hostRef.$hostElement$;
2337
+ const cmpMeta = hostRef.$cmpMeta$;
2338
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
2339
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
2340
+ hostTagName = hostElm.tagName;
2341
+ if (import_app_data12.BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
2342
+ throw new Error(`The <Host> must be the single root component.
2343
+ Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
2344
+
2345
+ The render() function should look like this instead:
2346
+
2347
+ render() {
2348
+ // Do not return an array
2349
+ return (
2350
+ <Host>{content}</Host>
2351
+ );
2352
+ }
2353
+ `);
2354
+ }
2355
+ if (import_app_data12.BUILD.reflect && cmpMeta.$attrsToReflect$) {
2356
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
2357
+ cmpMeta.$attrsToReflect$.map(
2358
+ ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
2359
+ );
2360
+ }
2361
+ if (isInitialLoad && rootVnode.$attrs$) {
2362
+ for (const key of Object.keys(rootVnode.$attrs$)) {
2363
+ if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) {
2364
+ rootVnode.$attrs$[key] = hostElm[key];
2320
2365
  }
2321
- if (!appliedStyles.has(scopeId2)) {
2322
- if (import_app_data12.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2323
- styleElm.innerHTML = style;
2324
- } else {
2325
- styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
2326
- styleElm.innerHTML = style;
2327
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
2328
- if (nonce != null) {
2329
- styleElm.setAttribute("nonce", nonce);
2330
- }
2331
- if ((import_app_data12.BUILD.hydrateServerSide || import_app_data12.BUILD.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2332
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2333
- }
2334
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2335
- if (styleContainerNode.nodeName === "HEAD") {
2336
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2337
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2338
- styleContainerNode.insertBefore(styleElm, referenceNode2);
2339
- } else if ("host" in styleContainerNode) {
2340
- if (supportsConstructableStylesheets) {
2341
- const stylesheet = new CSSStyleSheet();
2342
- stylesheet.replaceSync(style);
2343
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2344
- } else {
2345
- const existingStyleContainer = styleContainerNode.querySelector("style");
2346
- if (existingStyleContainer) {
2347
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2348
- } else {
2349
- styleContainerNode.prepend(styleElm);
2366
+ }
2367
+ }
2368
+ rootVnode.$tag$ = null;
2369
+ rootVnode.$flags$ |= 4 /* isHost */;
2370
+ hostRef.$vnode$ = rootVnode;
2371
+ rootVnode.$elm$ = oldVNode.$elm$ = import_app_data12.BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
2372
+ if (import_app_data12.BUILD.scoped || import_app_data12.BUILD.shadowDom) {
2373
+ scopeId = hostElm["s-sc"];
2374
+ }
2375
+ useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
2376
+ if (import_app_data12.BUILD.slotRelocation) {
2377
+ contentRef = hostElm["s-cr"];
2378
+ checkSlotFallbackVisibility = false;
2379
+ }
2380
+ patch(oldVNode, rootVnode, isInitialLoad);
2381
+ if (import_app_data12.BUILD.slotRelocation) {
2382
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
2383
+ if (checkSlotRelocate) {
2384
+ markSlotContentForRelocation(rootVnode.$elm$);
2385
+ for (const relocateData of relocateNodes) {
2386
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
2387
+ if (!nodeToRelocate["s-ol"]) {
2388
+ const orgLocationNode = import_app_data12.BUILD.isDebug || import_app_data12.BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
2389
+ orgLocationNode["s-nr"] = nodeToRelocate;
2390
+ insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
2391
+ }
2392
+ }
2393
+ for (const relocateData of relocateNodes) {
2394
+ const nodeToRelocate = relocateData.$nodeToRelocate$;
2395
+ const slotRefNode = relocateData.$slotRefNode$;
2396
+ if (slotRefNode) {
2397
+ const parentNodeRef = slotRefNode.parentNode;
2398
+ let insertBeforeNode = slotRefNode.nextSibling;
2399
+ if (!import_app_data12.BUILD.hydrateServerSide && (!import_app_data12.BUILD.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */)) {
2400
+ let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
2401
+ while (orgLocationNode) {
2402
+ let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
2403
+ if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
2404
+ refNode = refNode.nextSibling;
2405
+ while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
2406
+ refNode = refNode == null ? void 0 : refNode.nextSibling;
2407
+ }
2408
+ if (!refNode || !refNode["s-nr"]) {
2409
+ insertBeforeNode = refNode;
2410
+ break;
2350
2411
  }
2351
2412
  }
2352
- } else {
2353
- styleContainerNode.append(styleElm);
2413
+ orgLocationNode = orgLocationNode.previousSibling;
2354
2414
  }
2355
2415
  }
2356
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
2357
- styleContainerNode.insertBefore(styleElm, null);
2416
+ const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
2417
+ const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
2418
+ if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
2419
+ if (nodeToRelocate !== insertBeforeNode) {
2420
+ if (!import_app_data12.BUILD.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
2421
+ nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
2422
+ }
2423
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
2424
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
2425
+ nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
2426
+ }
2427
+ }
2428
+ }
2429
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
2430
+ } else {
2431
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
2432
+ if (isInitialLoad) {
2433
+ nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
2434
+ }
2435
+ nodeToRelocate.hidden = true;
2358
2436
  }
2359
- }
2360
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2361
- styleElm.innerHTML += SLOT_FB_CSS;
2362
- }
2363
- if (appliedStyles) {
2364
- appliedStyles.add(scopeId2);
2365
2437
  }
2366
2438
  }
2367
- } else if (import_app_data12.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2368
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2369
2439
  }
2440
+ if (checkSlotFallbackVisibility) {
2441
+ updateFallbackSlotVisibility(rootVnode.$elm$);
2442
+ }
2443
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
2444
+ relocateNodes.length = 0;
2370
2445
  }
2371
- return scopeId2;
2372
- };
2373
- var attachStyles = (hostRef) => {
2374
- const cmpMeta = hostRef.$cmpMeta$;
2375
- const elm = hostRef.$hostElement$;
2376
- const flags = cmpMeta.$flags$;
2377
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2378
- const scopeId2 = addStyle(
2379
- import_app_data12.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2380
- cmpMeta,
2381
- hostRef.$modeName$
2382
- );
2383
- if ((import_app_data12.BUILD.shadowDom || import_app_data12.BUILD.scoped) && import_app_data12.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
2384
- elm["s-sc"] = scopeId2;
2385
- elm.classList.add(scopeId2 + "-h");
2446
+ if (import_app_data12.BUILD.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2447
+ const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
2448
+ for (const childNode of children) {
2449
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
2450
+ if (isInitialLoad && childNode["s-ih"] == null) {
2451
+ childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
2452
+ }
2453
+ childNode.hidden = true;
2454
+ }
2455
+ }
2386
2456
  }
2387
- endAttachStyles();
2457
+ contentRef = void 0;
2388
2458
  };
2389
- var getScopeId = (cmp, mode) => "sc-" + (import_app_data12.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2459
+ var slotReferenceDebugNode = (slotVNode) => doc.createComment(
2460
+ `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
2461
+ );
2462
+ var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
2463
+ `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
2464
+ );
2390
2465
 
2391
2466
  // src/runtime/update-component.ts
2392
2467
  var attachToAncestor = (hostRef, ancestorComponent) => {
2393
2468
  if (import_app_data13.BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2394
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
2469
+ const index = ancestorComponent["s-p"].push(
2470
+ new Promise(
2471
+ (r) => hostRef.$onRenderResolve$ = () => {
2472
+ ancestorComponent["s-p"].splice(index - 1, 1);
2473
+ r();
2474
+ }
2475
+ )
2476
+ );
2395
2477
  }
2396
2478
  };
2397
2479
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -2762,77 +2844,91 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
2762
2844
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
2763
2845
  members.map(([memberName, [memberFlags]]) => {
2764
2846
  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 */)) {
2765
- if ((memberFlags & 2048 /* Getter */) === 0) {
2847
+ const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
2848
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
2849
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
2850
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
2766
2851
  Object.defineProperty(prototype, memberName, {
2767
2852
  get() {
2768
- return getValue(this, memberName);
2769
- },
2770
- set(newValue) {
2771
- if (import_app_data15.BUILD.isDev) {
2772
- const ref = getHostRef(this);
2773
- if (
2774
- // we are proxying the instance (not element)
2775
- (flags & 1 /* isElementConstructor */) === 0 && // the element is not constructing
2776
- (ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
2777
- (memberFlags & 31 /* Prop */) !== 0 && // the member is not mutable
2778
- (memberFlags & 1024 /* Mutable */) === 0
2779
- ) {
2780
- consoleDevWarn(
2781
- `@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
2782
- More information: https://stenciljs.com/docs/properties#prop-mutability`
2783
- );
2853
+ if (import_app_data15.BUILD.lazyLoad) {
2854
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
2855
+ return getValue(this, memberName);
2784
2856
  }
2857
+ const ref = getHostRef(this);
2858
+ const instance = ref ? ref.$lazyInstance$ : prototype;
2859
+ if (!instance) return;
2860
+ return instance[memberName];
2861
+ }
2862
+ if (!import_app_data15.BUILD.lazyLoad) {
2863
+ return origGetter ? origGetter.apply(this) : getValue(this, memberName);
2785
2864
  }
2786
- setValue(this, memberName, newValue, cmpMeta);
2787
2865
  },
2788
2866
  configurable: true,
2789
2867
  enumerable: true
2790
2868
  });
2791
- } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
2792
- if (import_app_data15.BUILD.lazyLoad) {
2793
- Object.defineProperty(prototype, memberName, {
2794
- get() {
2795
- const ref = getHostRef(this);
2796
- const instance = import_app_data15.BUILD.lazyLoad && ref ? ref.$lazyInstance$ : prototype;
2797
- if (!instance) return;
2798
- return instance[memberName];
2799
- },
2800
- configurable: true,
2801
- enumerable: true
2802
- });
2803
- }
2804
- if (memberFlags & 4096 /* Setter */) {
2805
- const origSetter = Object.getOwnPropertyDescriptor(prototype, memberName).set;
2806
- Object.defineProperty(prototype, memberName, {
2807
- set(newValue) {
2808
- const ref = getHostRef(this);
2809
- if (origSetter) {
2810
- const currentValue = ref.$hostElement$[memberName];
2811
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
2812
- ref.$instanceValues$.set(memberName, currentValue);
2813
- }
2814
- origSetter.apply(this, [parsePropertyValue(newValue, cmpMeta.$members$[memberName][0])]);
2815
- setValue(this, memberName, ref.$hostElement$[memberName], cmpMeta);
2816
- return;
2869
+ }
2870
+ Object.defineProperty(prototype, memberName, {
2871
+ set(newValue) {
2872
+ const ref = getHostRef(this);
2873
+ if (import_app_data15.BUILD.isDev) {
2874
+ if (
2875
+ // we are proxying the instance (not element)
2876
+ (flags & 1 /* isElementConstructor */) === 0 && // if the class has a setter, then the Element can update instance values, so ignore
2877
+ (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0 && // the element is not constructing
2878
+ (ref && ref.$flags$ & 8 /* isConstructingInstance */) === 0 && // the member is a prop
2879
+ (cmpMeta.$members$[memberName][0] & 31 /* Prop */) !== 0 && // the member is not mutable
2880
+ (cmpMeta.$members$[memberName][0] & 1024 /* Mutable */) === 0
2881
+ ) {
2882
+ consoleDevWarn(
2883
+ `@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
2884
+ More information: https://stenciljs.com/docs/properties#prop-mutability`
2885
+ );
2886
+ }
2887
+ }
2888
+ if (origSetter) {
2889
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
2890
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
2891
+ newValue = ref.$instanceValues$.get(memberName);
2892
+ } else if (!ref.$instanceValues$.get(memberName) && currentValue) {
2893
+ ref.$instanceValues$.set(memberName, currentValue);
2894
+ }
2895
+ origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
2896
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
2897
+ setValue(this, memberName, newValue, cmpMeta);
2898
+ return;
2899
+ }
2900
+ if (!import_app_data15.BUILD.lazyLoad) {
2901
+ setValue(this, memberName, newValue, cmpMeta);
2902
+ return;
2903
+ }
2904
+ if (import_app_data15.BUILD.lazyLoad) {
2905
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
2906
+ setValue(this, memberName, newValue, cmpMeta);
2907
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
2908
+ ref.$onReadyPromise$.then(() => {
2909
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
2910
+ ref.$lazyInstance$[memberName] = newValue;
2911
+ }
2912
+ });
2817
2913
  }
2818
- if (!ref) return;
2819
- const setterSetVal = () => {
2820
- const currentValue = ref.$lazyInstance$[memberName];
2821
- if (!ref.$instanceValues$.get(memberName) && currentValue) {
2822
- ref.$instanceValues$.set(memberName, currentValue);
2823
- }
2824
- ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, cmpMeta.$members$[memberName][0]);
2825
- setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
2826
- };
2827
- if (ref.$lazyInstance$) {
2828
- setterSetVal();
2829
- } else {
2830
- ref.$onReadyPromise$.then(() => setterSetVal());
2914
+ return;
2915
+ }
2916
+ const setterSetVal = () => {
2917
+ const currentValue = ref.$lazyInstance$[memberName];
2918
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
2919
+ ref.$instanceValues$.set(memberName, currentValue);
2831
2920
  }
2921
+ ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
2922
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
2923
+ };
2924
+ if (ref.$lazyInstance$) {
2925
+ setterSetVal();
2926
+ } else {
2927
+ ref.$onReadyPromise$.then(() => setterSetVal());
2832
2928
  }
2833
- });
2929
+ }
2834
2930
  }
2835
- }
2931
+ });
2836
2932
  } else if (import_app_data15.BUILD.lazyLoad && import_app_data15.BUILD.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2837
2933
  Object.defineProperty(prototype, memberName, {
2838
2934
  value(...args) {
@@ -2874,8 +2970,9 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
2874
2970
  return;
2875
2971
  }
2876
2972
  const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
2877
- if (!propDesc.get || !!propDesc.set) {
2878
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
2973
+ newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
2974
+ if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
2975
+ this[propName] = newValue;
2879
2976
  }
2880
2977
  });
2881
2978
  };