@stencil/core 4.22.3-dev.1733806913.ee4aa0b → 4.22.3-dev.1733893307.ec243c2

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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Client Platform v4.22.3-dev.1733806913.ee4aa0b | MIT Licensed | https://stenciljs.com
2
+ Stencil Client Platform v4.22.3-dev.1733893307.ec243c2 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -104,6 +104,7 @@ var CONTENT_REF_ID = "r";
104
104
  var ORG_LOCATION_ID = "o";
105
105
  var SLOT_NODE_ID = "s";
106
106
  var TEXT_NODE_ID = "t";
107
+ var COMMENT_NODE_ID = "c";
107
108
  var HYDRATE_ID = "s-id";
108
109
  var HYDRATED_STYLE_ID = "sty-id";
109
110
  var HYDRATE_CHILD_ID = "c-id";
@@ -321,99 +322,19 @@ var unwrapErr = (result) => {
321
322
  };
322
323
 
323
324
  // src/runtime/connected-callback.ts
324
- import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
325
+ import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
325
326
 
326
327
  // src/runtime/client-hydrate.ts
327
- import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
328
+ import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
328
329
 
329
- // src/runtime/profile.ts
330
- import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
331
- var i = 0;
332
- var createTime = (fnName, tagName = "") => {
333
- if (BUILD7.profile && performance.mark) {
334
- const key = `st:${fnName}:${tagName}:${i++}`;
335
- performance.mark(key);
336
- return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
337
- } else {
338
- return () => {
339
- return;
340
- };
341
- }
342
- };
343
- var uniqueTime = (key, measureText) => {
344
- if (BUILD7.profile && performance.mark) {
345
- if (performance.getEntriesByName(key, "mark").length === 0) {
346
- performance.mark(key);
347
- }
348
- return () => {
349
- if (performance.getEntriesByName(measureText, "measure").length === 0) {
350
- performance.measure(measureText, key);
351
- }
352
- };
353
- } else {
354
- return () => {
355
- return;
356
- };
357
- }
358
- };
359
- var inspect = (ref) => {
360
- const hostRef = getHostRef(ref);
361
- if (!hostRef) {
362
- return void 0;
363
- }
364
- const flags = hostRef.$flags$;
365
- const hostElement = hostRef.$hostElement$;
366
- return {
367
- renderCount: hostRef.$renderCount$,
368
- flags: {
369
- hasRendered: !!(flags & 2 /* hasRendered */),
370
- hasConnected: !!(flags & 1 /* hasConnected */),
371
- isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
372
- isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
373
- isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
374
- hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
375
- hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
376
- isWatchReady: !!(flags & 128 /* isWatchReady */),
377
- isListenReady: !!(flags & 256 /* isListenReady */),
378
- needsRerender: !!(flags & 512 /* needsRerender */)
379
- },
380
- instanceValues: hostRef.$instanceValues$,
381
- ancestorComponent: hostRef.$ancestorComponent$,
382
- hostElement,
383
- lazyInstance: hostRef.$lazyInstance$,
384
- vnode: hostRef.$vnode$,
385
- modeName: hostRef.$modeName$,
386
- onReadyPromise: hostRef.$onReadyPromise$,
387
- onReadyResolve: hostRef.$onReadyResolve$,
388
- onInstancePromise: hostRef.$onInstancePromise$,
389
- onInstanceResolve: hostRef.$onInstanceResolve$,
390
- onRenderResolve: hostRef.$onRenderResolve$,
391
- queuedListeners: hostRef.$queuedListeners$,
392
- rmListeners: hostRef.$rmListeners$,
393
- ["s-id"]: hostElement["s-id"],
394
- ["s-cr"]: hostElement["s-cr"],
395
- ["s-lr"]: hostElement["s-lr"],
396
- ["s-p"]: hostElement["s-p"],
397
- ["s-rc"]: hostElement["s-rc"],
398
- ["s-sc"]: hostElement["s-sc"]
399
- };
400
- };
401
- var installDevTools = () => {
402
- if (BUILD7.devTools) {
403
- const stencil = win.stencil = win.stencil || {};
404
- const originalInspect = stencil.inspect;
405
- stencil.inspect = (ref) => {
406
- let result = inspect(ref);
407
- if (!result && typeof originalInspect === "function") {
408
- result = originalInspect(ref);
409
- }
410
- return result;
411
- };
412
- }
413
- };
330
+ // src/runtime/dom-extras.ts
331
+ import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
332
+
333
+ // src/runtime/vdom/vdom-render.ts
334
+ import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
414
335
 
415
336
  // src/runtime/vdom/h.ts
416
- import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
337
+ import { BUILD as BUILD7 } from "@stencil/core/internal/app-data";
417
338
  var h = (nodeName, vnodeData, ...children) => {
418
339
  let child = null;
419
340
  let key = null;
@@ -429,7 +350,7 @@ var h = (nodeName, vnodeData, ...children) => {
429
350
  } else if (child != null && typeof child !== "boolean") {
430
351
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
431
352
  child = String(child);
432
- } else if (BUILD8.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
353
+ } else if (BUILD7.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
433
354
  consoleDevError(`vNode passed as children has unexpected type.
434
355
  Make sure it's using the correct h() function.
435
356
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -445,28 +366,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
445
366
  };
446
367
  walk(children);
447
368
  if (vnodeData) {
448
- if (BUILD8.isDev && nodeName === "input") {
369
+ if (BUILD7.isDev && nodeName === "input") {
449
370
  validateInputProperties(vnodeData);
450
371
  }
451
- if (BUILD8.vdomKey && vnodeData.key) {
372
+ if (BUILD7.vdomKey && vnodeData.key) {
452
373
  key = vnodeData.key;
453
374
  }
454
- if (BUILD8.slotRelocation && vnodeData.name) {
375
+ if (BUILD7.slotRelocation && vnodeData.name) {
455
376
  slotName = vnodeData.name;
456
377
  }
457
- if (BUILD8.vdomClass) {
378
+ if (BUILD7.vdomClass) {
458
379
  const classData = vnodeData.className || vnodeData.class;
459
380
  if (classData) {
460
381
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
461
382
  }
462
383
  }
463
384
  }
464
- if (BUILD8.isDev && vNodeChildren.some(isHost)) {
385
+ if (BUILD7.isDev && vNodeChildren.some(isHost)) {
465
386
  consoleDevError(`The <Host> must be the single root component. Make sure:
466
387
  - You are NOT using hostData() and <Host> in the same component.
467
388
  - <Host> is used once, and it's the single root component of the render() function.`);
468
389
  }
469
- if (BUILD8.vdomFunctional && typeof nodeName === "function") {
390
+ if (BUILD7.vdomFunctional && typeof nodeName === "function") {
470
391
  return nodeName(
471
392
  vnodeData === null ? {} : vnodeData,
472
393
  vNodeChildren,
@@ -478,10 +399,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
478
399
  if (vNodeChildren.length > 0) {
479
400
  vnode.$children$ = vNodeChildren;
480
401
  }
481
- if (BUILD8.vdomKey) {
402
+ if (BUILD7.vdomKey) {
482
403
  vnode.$key$ = key;
483
404
  }
484
- if (BUILD8.slotRelocation) {
405
+ if (BUILD7.slotRelocation) {
485
406
  vnode.$name$ = slotName;
486
407
  }
487
408
  return vnode;
@@ -494,13 +415,13 @@ var newVNode = (tag, text) => {
494
415
  $elm$: null,
495
416
  $children$: null
496
417
  };
497
- if (BUILD8.vdomAttribute) {
418
+ if (BUILD7.vdomAttribute) {
498
419
  vnode.$attrs$ = null;
499
420
  }
500
- if (BUILD8.vdomKey) {
421
+ if (BUILD7.vdomKey) {
501
422
  vnode.$key$ = null;
502
423
  }
503
- if (BUILD8.slotRelocation) {
424
+ if (BUILD7.slotRelocation) {
504
425
  vnode.$name$ = null;
505
426
  }
506
427
  return vnode;
@@ -552,416 +473,51 @@ var validateInputProperties = (inputElm) => {
552
473
  }
553
474
  };
554
475
 
555
- // src/runtime/client-hydrate.ts
556
- var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
557
- const endHydrate = createTime("hydrateClient", tagName);
558
- const shadowRoot = hostElm.shadowRoot;
559
- const childRenderNodes = [];
560
- const slotNodes = [];
561
- const shadowRootNodes = BUILD9.shadowDom && shadowRoot ? [] : null;
562
- const vnode = hostRef.$vnode$ = newVNode(tagName, null);
563
- if (!plt.$orgLocNodes$) {
564
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
565
- }
566
- hostElm[HYDRATE_ID] = hostId;
567
- hostElm.removeAttribute(HYDRATE_ID);
568
- clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
569
- childRenderNodes.map((c) => {
570
- const orgLocationId = c.$hostId$ + "." + c.$nodeId$;
571
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
572
- const node = c.$elm$;
573
- if (orgLocationNode && supportsShadow && orgLocationNode["s-en"] === "") {
574
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
575
- }
576
- if (!shadowRoot) {
577
- node["s-hn"] = tagName;
578
- if (orgLocationNode) {
579
- node["s-ol"] = orgLocationNode;
580
- node["s-ol"]["s-nr"] = node;
581
- }
582
- }
583
- plt.$orgLocNodes$.delete(orgLocationId);
584
- });
585
- if (BUILD9.shadowDom && shadowRoot) {
586
- shadowRootNodes.map((shadowRootNode) => {
587
- if (shadowRootNode) {
588
- shadowRoot.appendChild(shadowRootNode);
589
- }
590
- });
591
- }
592
- endHydrate();
593
- };
594
- var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
595
- let childNodeType;
596
- let childIdSplt;
597
- let childVNode;
598
- let i2;
599
- if (node.nodeType === 1 /* ElementNode */) {
600
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
601
- if (childNodeType) {
602
- childIdSplt = childNodeType.split(".");
603
- if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
604
- childVNode = {
605
- $flags$: 0,
606
- $hostId$: childIdSplt[0],
607
- $nodeId$: childIdSplt[1],
608
- $depth$: childIdSplt[2],
609
- $index$: childIdSplt[3],
610
- $tag$: node.tagName.toLowerCase(),
611
- $elm$: node,
612
- $attrs$: null,
613
- $children$: null,
614
- $key$: null,
615
- $name$: null,
616
- $text$: null
617
- };
618
- childRenderNodes.push(childVNode);
619
- node.removeAttribute(HYDRATE_CHILD_ID);
620
- if (!parentVNode.$children$) {
621
- parentVNode.$children$ = [];
622
- }
623
- parentVNode.$children$[childVNode.$index$] = childVNode;
624
- parentVNode = childVNode;
625
- if (shadowRootNodes && childVNode.$depth$ === "0") {
626
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
627
- }
628
- }
629
- }
630
- if (node.shadowRoot) {
631
- for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
632
- clientHydrate(
633
- parentVNode,
634
- childRenderNodes,
635
- slotNodes,
636
- shadowRootNodes,
637
- hostElm,
638
- node.shadowRoot.childNodes[i2],
639
- hostId
640
- );
476
+ // src/runtime/vdom/update-element.ts
477
+ import { BUILD as BUILD9 } from "@stencil/core/internal/app-data";
478
+
479
+ // src/runtime/vdom/set-accessor.ts
480
+ import { BUILD as BUILD8 } from "@stencil/core/internal/app-data";
481
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
482
+ if (oldValue !== newValue) {
483
+ let isProp = isMemberInElement(elm, memberName);
484
+ let ln = memberName.toLowerCase();
485
+ if (BUILD8.vdomClass && memberName === "class") {
486
+ const classList = elm.classList;
487
+ const oldClasses = parseClassList(oldValue);
488
+ const newClasses = parseClassList(newValue);
489
+ if (elm["s-si"] && newClasses.indexOf(elm["s-si"]) < 0) {
490
+ newClasses.push(elm["s-si"]);
641
491
  }
642
- }
643
- for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
644
- clientHydrate(
645
- parentVNode,
646
- childRenderNodes,
647
- slotNodes,
648
- shadowRootNodes,
649
- hostElm,
650
- node.childNodes[i2],
651
- hostId
652
- );
653
- }
654
- } else if (node.nodeType === 8 /* CommentNode */) {
655
- childIdSplt = node.nodeValue.split(".");
656
- if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
657
- childNodeType = childIdSplt[0];
658
- childVNode = {
659
- $flags$: 0,
660
- $hostId$: childIdSplt[1],
661
- $nodeId$: childIdSplt[2],
662
- $depth$: childIdSplt[3],
663
- $index$: childIdSplt[4],
664
- $elm$: node,
665
- $attrs$: null,
666
- $children$: null,
667
- $key$: null,
668
- $name$: null,
669
- $tag$: null,
670
- $text$: null
671
- };
672
- if (childNodeType === TEXT_NODE_ID) {
673
- childVNode.$elm$ = node.nextSibling;
674
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
675
- childVNode.$text$ = childVNode.$elm$.textContent;
676
- childRenderNodes.push(childVNode);
677
- node.remove();
678
- if (!parentVNode.$children$) {
679
- parentVNode.$children$ = [];
680
- }
681
- parentVNode.$children$[childVNode.$index$] = childVNode;
682
- if (shadowRootNodes && childVNode.$depth$ === "0") {
683
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
492
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
493
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
494
+ } else if (BUILD8.vdomStyle && memberName === "style") {
495
+ if (BUILD8.updatable) {
496
+ for (const prop in oldValue) {
497
+ if (!newValue || newValue[prop] == null) {
498
+ if (!BUILD8.hydrateServerSide && prop.includes("-")) {
499
+ elm.style.removeProperty(prop);
500
+ } else {
501
+ elm.style[prop] = "";
502
+ }
684
503
  }
685
504
  }
686
- } else if (childVNode.$hostId$ === hostId) {
687
- if (childNodeType === SLOT_NODE_ID) {
688
- childVNode.$tag$ = "slot";
689
- if (childIdSplt[5]) {
690
- node["s-sn"] = childVNode.$name$ = childIdSplt[5];
505
+ }
506
+ for (const prop in newValue) {
507
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
508
+ if (!BUILD8.hydrateServerSide && prop.includes("-")) {
509
+ elm.style.setProperty(prop, newValue[prop]);
691
510
  } else {
692
- node["s-sn"] = "";
693
- }
694
- node["s-sr"] = true;
695
- if (BUILD9.shadowDom && shadowRootNodes) {
696
- childVNode.$elm$ = doc.createElement(childVNode.$tag$);
697
- if (childVNode.$name$) {
698
- childVNode.$elm$.setAttribute("name", childVNode.$name$);
699
- }
700
- node.parentNode.insertBefore(childVNode.$elm$, node);
701
- node.remove();
702
- if (childVNode.$depth$ === "0") {
703
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
704
- }
705
- }
706
- slotNodes.push(childVNode);
707
- if (!parentVNode.$children$) {
708
- parentVNode.$children$ = [];
709
- }
710
- parentVNode.$children$[childVNode.$index$] = childVNode;
711
- } else if (childNodeType === CONTENT_REF_ID) {
712
- if (BUILD9.shadowDom && shadowRootNodes) {
713
- node.remove();
714
- } else if (BUILD9.slotRelocation) {
715
- hostElm["s-cr"] = node;
716
- node["s-cn"] = true;
511
+ elm.style[prop] = newValue[prop];
717
512
  }
718
513
  }
719
514
  }
720
- }
721
- } else if (parentVNode && parentVNode.$tag$ === "style") {
722
- const vnode = newVNode(null, node.textContent);
723
- vnode.$elm$ = node;
724
- vnode.$index$ = "0";
725
- parentVNode.$children$ = [vnode];
726
- }
727
- };
728
- var initializeDocumentHydrate = (node, orgLocNodes) => {
729
- if (node.nodeType === 1 /* ElementNode */) {
730
- let i2 = 0;
731
- if (node.shadowRoot) {
732
- for (; i2 < node.shadowRoot.childNodes.length; i2++) {
733
- initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
515
+ } else if (BUILD8.vdomKey && memberName === "key") {
516
+ } else if (BUILD8.vdomRef && memberName === "ref") {
517
+ if (newValue) {
518
+ newValue(elm);
734
519
  }
735
- }
736
- for (i2 = 0; i2 < node.childNodes.length; i2++) {
737
- initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
738
- }
739
- } else if (node.nodeType === 8 /* CommentNode */) {
740
- const childIdSplt = node.nodeValue.split(".");
741
- if (childIdSplt[0] === ORG_LOCATION_ID) {
742
- orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
743
- node.nodeValue = "";
744
- node["s-en"] = childIdSplt[3];
745
- }
746
- }
747
- };
748
-
749
- // src/runtime/initialize-component.ts
750
- import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
751
-
752
- // src/runtime/mode.ts
753
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
754
- var setMode = (handler) => modeResolutionChain.push(handler);
755
- var getMode = (ref) => getHostRef(ref).$modeName$;
756
-
757
- // src/runtime/proxy-component.ts
758
- import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
759
-
760
- // src/runtime/set-value.ts
761
- import { BUILD as BUILD18 } from "@stencil/core/internal/app-data";
762
-
763
- // src/runtime/parse-property-value.ts
764
- import { BUILD as BUILD10 } from "@stencil/core/internal/app-data";
765
- var parsePropertyValue = (propValue, propType) => {
766
- if (propValue != null && !isComplexType(propValue)) {
767
- if (BUILD10.propBoolean && propType & 4 /* Boolean */) {
768
- return propValue === "false" ? false : propValue === "" || !!propValue;
769
- }
770
- if (BUILD10.propNumber && propType & 2 /* Number */) {
771
- return parseFloat(propValue);
772
- }
773
- if (BUILD10.propString && propType & 1 /* String */) {
774
- return String(propValue);
775
- }
776
- return propValue;
777
- }
778
- return propValue;
779
- };
780
-
781
- // src/runtime/update-component.ts
782
- import { BUILD as BUILD17, NAMESPACE } from "@stencil/core/internal/app-data";
783
-
784
- // src/runtime/event-emitter.ts
785
- import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
786
-
787
- // src/runtime/element.ts
788
- import { BUILD as BUILD11 } from "@stencil/core/internal/app-data";
789
- var getElement = (ref) => BUILD11.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
790
-
791
- // src/runtime/event-emitter.ts
792
- var createEvent = (ref, name, flags) => {
793
- const elm = getElement(ref);
794
- return {
795
- emit: (detail) => {
796
- if (BUILD12.isDev && !elm.isConnected) {
797
- consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
798
- }
799
- return emitEvent(elm, name, {
800
- bubbles: !!(flags & 4 /* Bubbles */),
801
- composed: !!(flags & 2 /* Composed */),
802
- cancelable: !!(flags & 1 /* Cancellable */),
803
- detail
804
- });
805
- }
806
- };
807
- };
808
- var emitEvent = (elm, name, opts) => {
809
- const ev = plt.ce(name, opts);
810
- elm.dispatchEvent(ev);
811
- return ev;
812
- };
813
-
814
- // src/runtime/styles.ts
815
- import { BUILD as BUILD13 } from "@stencil/core/internal/app-data";
816
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
817
- var registerStyle = (scopeId2, cssText, allowCS) => {
818
- let style = styles.get(scopeId2);
819
- if (supportsConstructableStylesheets && allowCS) {
820
- style = style || new CSSStyleSheet();
821
- if (typeof style === "string") {
822
- style = cssText;
823
- } else {
824
- style.replaceSync(cssText);
825
- }
826
- } else {
827
- style = cssText;
828
- }
829
- styles.set(scopeId2, style);
830
- };
831
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
832
- var _a;
833
- const scopeId2 = getScopeId(cmpMeta, mode);
834
- const style = styles.get(scopeId2);
835
- if (!BUILD13.attachStyles) {
836
- return scopeId2;
837
- }
838
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
839
- if (style) {
840
- if (typeof style === "string") {
841
- styleContainerNode = styleContainerNode.head || styleContainerNode;
842
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
843
- let styleElm;
844
- if (!appliedStyles) {
845
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
846
- }
847
- if (!appliedStyles.has(scopeId2)) {
848
- if (BUILD13.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
849
- styleElm.innerHTML = style;
850
- } else {
851
- styleElm = doc.createElement("style");
852
- styleElm.innerHTML = style;
853
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
854
- if (nonce != null) {
855
- styleElm.setAttribute("nonce", nonce);
856
- }
857
- if ((BUILD13.hydrateServerSide || BUILD13.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
858
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
859
- }
860
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
861
- if (styleContainerNode.nodeName === "HEAD") {
862
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
863
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
864
- styleContainerNode.insertBefore(styleElm, referenceNode2);
865
- } else if ("host" in styleContainerNode) {
866
- if (supportsConstructableStylesheets) {
867
- const stylesheet = new CSSStyleSheet();
868
- stylesheet.replaceSync(style);
869
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
870
- } else {
871
- const existingStyleContainer = styleContainerNode.querySelector("style");
872
- if (existingStyleContainer) {
873
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
874
- } else {
875
- styleContainerNode.prepend(styleElm);
876
- }
877
- }
878
- } else {
879
- styleContainerNode.append(styleElm);
880
- }
881
- }
882
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
883
- styleContainerNode.insertBefore(styleElm, null);
884
- }
885
- }
886
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
887
- styleElm.innerHTML += SLOT_FB_CSS;
888
- }
889
- if (appliedStyles) {
890
- appliedStyles.add(scopeId2);
891
- }
892
- }
893
- } else if (BUILD13.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
894
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
895
- }
896
- }
897
- return scopeId2;
898
- };
899
- var attachStyles = (hostRef) => {
900
- const cmpMeta = hostRef.$cmpMeta$;
901
- const elm = hostRef.$hostElement$;
902
- const flags = cmpMeta.$flags$;
903
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
904
- const scopeId2 = addStyle(
905
- BUILD13.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
906
- cmpMeta,
907
- hostRef.$modeName$
908
- );
909
- if ((BUILD13.shadowDom || BUILD13.scoped) && BUILD13.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
910
- elm["s-sc"] = scopeId2;
911
- elm.classList.add(scopeId2 + "-h");
912
- if (BUILD13.scoped && flags & 2 /* scopedCssEncapsulation */) {
913
- elm.classList.add(scopeId2 + "-s");
914
- }
915
- }
916
- endAttachStyles();
917
- };
918
- var getScopeId = (cmp, mode) => "sc-" + (BUILD13.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
919
-
920
- // src/runtime/vdom/vdom-render.ts
921
- import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
922
-
923
- // src/runtime/vdom/update-element.ts
924
- import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
925
-
926
- // src/runtime/vdom/set-accessor.ts
927
- import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
928
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
929
- if (oldValue !== newValue) {
930
- let isProp = isMemberInElement(elm, memberName);
931
- let ln = memberName.toLowerCase();
932
- if (BUILD14.vdomClass && memberName === "class") {
933
- const classList = elm.classList;
934
- const oldClasses = parseClassList(oldValue);
935
- const newClasses = parseClassList(newValue);
936
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
937
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
938
- } else if (BUILD14.vdomStyle && memberName === "style") {
939
- if (BUILD14.updatable) {
940
- for (const prop in oldValue) {
941
- if (!newValue || newValue[prop] == null) {
942
- if (!BUILD14.hydrateServerSide && prop.includes("-")) {
943
- elm.style.removeProperty(prop);
944
- } else {
945
- elm.style[prop] = "";
946
- }
947
- }
948
- }
949
- }
950
- for (const prop in newValue) {
951
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
952
- if (!BUILD14.hydrateServerSide && prop.includes("-")) {
953
- elm.style.setProperty(prop, newValue[prop]);
954
- } else {
955
- elm.style[prop] = newValue[prop];
956
- }
957
- }
958
- }
959
- } else if (BUILD14.vdomKey && memberName === "key") {
960
- } else if (BUILD14.vdomRef && memberName === "ref") {
961
- if (newValue) {
962
- newValue(elm);
963
- }
964
- } else if (BUILD14.vdomListener && (BUILD14.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
520
+ } else if (BUILD8.vdomListener && (BUILD8.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
965
521
  if (memberName[2] === "-") {
966
522
  memberName = memberName.slice(3);
967
523
  } else if (isMemberInElement(win, ln)) {
@@ -979,7 +535,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
979
535
  plt.ael(elm, memberName, newValue, capture);
980
536
  }
981
537
  }
982
- } else if (BUILD14.vdomPropOrAttr) {
538
+ } else if (BUILD8.vdomPropOrAttr) {
983
539
  const isComplex = isComplexType(newValue);
984
540
  if ((isProp || isComplex && newValue !== null) && !isSvg) {
985
541
  try {
@@ -1001,7 +557,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
1001
557
  }
1002
558
  }
1003
559
  let xlink = false;
1004
- if (BUILD14.vdomXlink) {
560
+ if (BUILD8.vdomXlink) {
1005
561
  if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
1006
562
  memberName = ln;
1007
563
  xlink = true;
@@ -1009,7 +565,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
1009
565
  }
1010
566
  if (newValue == null || newValue === false) {
1011
567
  if (newValue !== false || elm.getAttribute(memberName) === "") {
1012
- if (BUILD14.vdomXlink && xlink) {
568
+ if (BUILD8.vdomXlink && xlink) {
1013
569
  elm.removeAttributeNS(XLINK_NS, memberName);
1014
570
  } else {
1015
571
  elm.removeAttribute(memberName);
@@ -1017,7 +573,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
1017
573
  }
1018
574
  } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
1019
575
  newValue = newValue === true ? "" : newValue;
1020
- if (BUILD14.vdomXlink && xlink) {
576
+ if (BUILD8.vdomXlink && xlink) {
1021
577
  elm.setAttributeNS(XLINK_NS, memberName, newValue);
1022
578
  } else {
1023
579
  elm.setAttribute(memberName, newValue);
@@ -1036,7 +592,7 @@ var updateElement = (oldVnode, newVnode, isSvgMode2) => {
1036
592
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
1037
593
  const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
1038
594
  const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
1039
- if (BUILD15.updatable) {
595
+ if (BUILD9.updatable) {
1040
596
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
1041
597
  if (!(memberName in newVnodeAttrs)) {
1042
598
  setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
@@ -1072,7 +628,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1072
628
  let elm;
1073
629
  let childNode;
1074
630
  let oldVNode;
1075
- if (BUILD16.slotRelocation && !useNativeShadowDom) {
631
+ if (BUILD10.slotRelocation && !useNativeShadowDom) {
1076
632
  checkSlotRelocate = true;
1077
633
  if (newVNode2.$tag$ === "slot") {
1078
634
  if (scopeId) {
@@ -1090,37 +646,37 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1090
646
  );
1091
647
  }
1092
648
  }
1093
- if (BUILD16.isDev && newVNode2.$elm$) {
649
+ if (BUILD10.isDev && newVNode2.$elm$) {
1094
650
  consoleDevError(
1095
651
  `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`
1096
652
  );
1097
653
  }
1098
- if (BUILD16.vdomText && newVNode2.$text$ !== null) {
654
+ if (BUILD10.vdomText && newVNode2.$text$ !== null) {
1099
655
  elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
1100
- } else if (BUILD16.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
1101
- elm = newVNode2.$elm$ = BUILD16.isDebug || BUILD16.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
656
+ } else if (BUILD10.slotRelocation && newVNode2.$flags$ & 1 /* isSlotReference */) {
657
+ elm = newVNode2.$elm$ = BUILD10.isDebug || BUILD10.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
1102
658
  } else {
1103
- if (BUILD16.svg && !isSvgMode) {
659
+ if (BUILD10.svg && !isSvgMode) {
1104
660
  isSvgMode = newVNode2.$tag$ === "svg";
1105
661
  }
1106
- elm = newVNode2.$elm$ = BUILD16.svg ? doc.createElementNS(
662
+ elm = newVNode2.$elm$ = BUILD10.svg ? doc.createElementNS(
1107
663
  isSvgMode ? SVG_NS : HTML_NS,
1108
- !useNativeShadowDom && BUILD16.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
664
+ !useNativeShadowDom && BUILD10.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
1109
665
  ) : doc.createElement(
1110
- !useNativeShadowDom && BUILD16.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
666
+ !useNativeShadowDom && BUILD10.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
1111
667
  );
1112
- if (BUILD16.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
668
+ if (BUILD10.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
1113
669
  isSvgMode = false;
1114
670
  }
1115
- if (BUILD16.vdomAttribute) {
671
+ if (BUILD10.vdomAttribute) {
1116
672
  updateElement(null, newVNode2, isSvgMode);
1117
673
  }
1118
674
  const rootNode = elm.getRootNode();
1119
675
  const isElementWithinShadowRoot = !rootNode.querySelector("body");
1120
- if (!isElementWithinShadowRoot && BUILD16.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
676
+ if (!isElementWithinShadowRoot && BUILD10.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
1121
677
  elm.classList.add(elm["s-si"] = scopeId);
1122
678
  }
1123
- if (BUILD16.scoped) {
679
+ if (BUILD10.scoped) {
1124
680
  updateElementScopeIds(elm, parentElm);
1125
681
  }
1126
682
  if (newVNode2.$children$) {
@@ -1131,7 +687,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1131
687
  }
1132
688
  }
1133
689
  }
1134
- if (BUILD16.svg) {
690
+ if (BUILD10.svg) {
1135
691
  if (newVNode2.$tag$ === "svg") {
1136
692
  isSvgMode = false;
1137
693
  } else if (elm.tagName === "foreignObject") {
@@ -1140,7 +696,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1140
696
  }
1141
697
  }
1142
698
  elm["s-hn"] = hostTagName;
1143
- if (BUILD16.slotRelocation) {
699
+ if (BUILD10.slotRelocation) {
1144
700
  if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
1145
701
  elm["s-sr"] = true;
1146
702
  elm["s-cr"] = contentRef;
@@ -1148,7 +704,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1148
704
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
1149
705
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
1150
706
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
1151
- if (BUILD16.experimentalSlotFixes) {
707
+ if (BUILD10.experimentalSlotFixes) {
1152
708
  relocateToHostRoot(oldParentVNode.$elm$);
1153
709
  } else {
1154
710
  putBackInOriginalLocation(oldParentVNode.$elm$, false);
@@ -1181,7 +737,7 @@ var relocateToHostRoot = (parentElm) => {
1181
737
  var putBackInOriginalLocation = (parentElm, recursive) => {
1182
738
  plt.$flags$ |= 1 /* isTmpDisconnected */;
1183
739
  const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
1184
- if (parentElm["s-sr"] && BUILD16.experimentalSlotFixes) {
740
+ if (parentElm["s-sr"] && BUILD10.experimentalSlotFixes) {
1185
741
  let node = parentElm;
1186
742
  while (node = node.nextSibling) {
1187
743
  if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
@@ -1205,9 +761,9 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
1205
761
  plt.$flags$ &= ~1 /* isTmpDisconnected */;
1206
762
  };
1207
763
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1208
- let containerElm = BUILD16.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
764
+ let containerElm = BUILD10.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
1209
765
  let childNode;
1210
- if (BUILD16.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
766
+ if (BUILD10.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
1211
767
  containerElm = containerElm.shadowRoot;
1212
768
  }
1213
769
  for (; startIdx <= endIdx; ++startIdx) {
@@ -1215,7 +771,7 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
1215
771
  childNode = createElm(null, parentVNode, startIdx, parentElm);
1216
772
  if (childNode) {
1217
773
  vnodes[startIdx].$elm$ = childNode;
1218
- insertBefore(containerElm, childNode, BUILD16.slotRelocation ? referenceNode(before) : before);
774
+ insertBefore(containerElm, childNode, BUILD10.slotRelocation ? referenceNode(before) : before);
1219
775
  }
1220
776
  }
1221
777
  }
@@ -1227,7 +783,7 @@ var removeVnodes = (vnodes, startIdx, endIdx) => {
1227
783
  const elm = vnode.$elm$;
1228
784
  nullifyVNodeRefs(vnode);
1229
785
  if (elm) {
1230
- if (BUILD16.slotRelocation) {
786
+ if (BUILD10.slotRelocation) {
1231
787
  checkSlotFallbackVisibility = true;
1232
788
  if (elm["s-ol"]) {
1233
789
  elm["s-ol"].remove();
@@ -1271,7 +827,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1271
827
  oldEndVnode = oldCh[--oldEndIdx];
1272
828
  newEndVnode = newCh[--newEndIdx];
1273
829
  } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
1274
- if (BUILD16.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
830
+ if (BUILD10.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1275
831
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1276
832
  }
1277
833
  patch(oldStartVnode, newEndVnode, isInitialRender);
@@ -1279,7 +835,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1279
835
  oldStartVnode = oldCh[++oldStartIdx];
1280
836
  newEndVnode = newCh[--newEndIdx];
1281
837
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
1282
- if (BUILD16.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
838
+ if (BUILD10.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
1283
839
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1284
840
  }
1285
841
  patch(oldEndVnode, newStartVnode, isInitialRender);
@@ -1288,7 +844,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1288
844
  newStartVnode = newCh[++newStartIdx];
1289
845
  } else {
1290
846
  idxInOld = -1;
1291
- if (BUILD16.vdomKey) {
847
+ if (BUILD10.vdomKey) {
1292
848
  for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
1293
849
  if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
1294
850
  idxInOld = i2;
@@ -1296,7 +852,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1296
852
  }
1297
853
  }
1298
854
  }
1299
- if (BUILD16.vdomKey && idxInOld >= 0) {
855
+ if (BUILD10.vdomKey && idxInOld >= 0) {
1300
856
  elmToMove = oldCh[idxInOld];
1301
857
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1302
858
  node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
@@ -1311,7 +867,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1311
867
  newStartVnode = newCh[++newStartIdx];
1312
868
  }
1313
869
  if (node) {
1314
- if (BUILD16.slotRelocation) {
870
+ if (BUILD10.slotRelocation) {
1315
871
  insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
1316
872
  } else {
1317
873
  insertBefore(oldStartVnode.$elm$.parentNode, node, oldStartVnode.$elm$);
@@ -1328,13 +884,13 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
1328
884
  newStartIdx,
1329
885
  newEndIdx
1330
886
  );
1331
- } else if (BUILD16.updatable && newStartIdx > newEndIdx) {
887
+ } else if (BUILD10.updatable && newStartIdx > newEndIdx) {
1332
888
  removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1333
889
  }
1334
890
  };
1335
891
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1336
892
  if (leftVNode.$tag$ === rightVNode.$tag$) {
1337
- if (BUILD16.slotRelocation && leftVNode.$tag$ === "slot") {
893
+ if (BUILD10.slotRelocation && leftVNode.$tag$ === "slot") {
1338
894
  if (
1339
895
  // The component gets hydrated and no VDOM has been initialized.
1340
896
  // Here the comparison can't happen as $name$ property is not set for `leftNode`.
@@ -1346,7 +902,7 @@ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
1346
902
  }
1347
903
  return leftVNode.$name$ === rightVNode.$name$;
1348
904
  }
1349
- if (BUILD16.vdomKey && !isInitialRender) {
905
+ if (BUILD10.vdomKey && !isInitialRender) {
1350
906
  return leftVNode.$key$ === rightVNode.$key$;
1351
907
  }
1352
908
  return true;
@@ -1364,13 +920,13 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1364
920
  const tag = newVNode2.$tag$;
1365
921
  const text = newVNode2.$text$;
1366
922
  let defaultHolder;
1367
- if (!BUILD16.vdomText || text === null) {
1368
- if (BUILD16.svg) {
923
+ if (!BUILD10.vdomText || text === null) {
924
+ if (BUILD10.svg) {
1369
925
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
1370
926
  }
1371
- if (BUILD16.vdomAttribute || BUILD16.reflect) {
1372
- if (BUILD16.slot && tag === "slot" && !useNativeShadowDom) {
1373
- if (BUILD16.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
927
+ if (BUILD10.vdomAttribute || BUILD10.reflect) {
928
+ if (BUILD10.slot && tag === "slot" && !useNativeShadowDom) {
929
+ if (BUILD10.experimentalSlotFixes && oldVNode.$name$ !== newVNode2.$name$) {
1374
930
  newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1375
931
  relocateToHostRoot(newVNode2.$elm$.parentElement);
1376
932
  }
@@ -1378,25 +934,25 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1378
934
  updateElement(oldVNode, newVNode2, isSvgMode);
1379
935
  }
1380
936
  }
1381
- if (BUILD16.updatable && oldChildren !== null && newChildren !== null) {
937
+ if (BUILD10.updatable && oldChildren !== null && newChildren !== null) {
1382
938
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
1383
939
  } else if (newChildren !== null) {
1384
- if (BUILD16.updatable && BUILD16.vdomText && oldVNode.$text$ !== null) {
940
+ if (BUILD10.updatable && BUILD10.vdomText && oldVNode.$text$ !== null) {
1385
941
  elm.textContent = "";
1386
942
  }
1387
943
  addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
1388
944
  } else if (
1389
945
  // don't do this on initial render as it can cause non-hydrated content to be removed
1390
- !isInitialRender && BUILD16.updatable && oldChildren !== null
946
+ !isInitialRender && BUILD10.updatable && oldChildren !== null
1391
947
  ) {
1392
948
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
1393
949
  }
1394
- if (BUILD16.svg && isSvgMode && tag === "svg") {
950
+ if (BUILD10.svg && isSvgMode && tag === "svg") {
1395
951
  isSvgMode = false;
1396
952
  }
1397
- } else if (BUILD16.vdomText && BUILD16.slotRelocation && (defaultHolder = elm["s-cr"])) {
953
+ } else if (BUILD10.vdomText && BUILD10.slotRelocation && (defaultHolder = elm["s-cr"])) {
1398
954
  defaultHolder.parentNode.textContent = text;
1399
- } else if (BUILD16.vdomText && oldVNode.$text$ !== text) {
955
+ } else if (BUILD10.vdomText && oldVNode.$text$ !== text) {
1400
956
  elm.data = text;
1401
957
  }
1402
958
  };
@@ -1414,7 +970,7 @@ var updateFallbackSlotVisibility = (elm) => {
1414
970
  childNode.hidden = true;
1415
971
  break;
1416
972
  }
1417
- } else {
973
+ } else if (slotName === siblingNode["s-sn"]) {
1418
974
  if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
1419
975
  childNode.hidden = true;
1420
976
  break;
@@ -1439,7 +995,7 @@ var markSlotContentForRelocation = (elm) => {
1439
995
  const slotName = childNode["s-sn"];
1440
996
  for (j = hostContentNodes.length - 1; j >= 0; j--) {
1441
997
  node = hostContentNodes[j];
1442
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD16.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
998
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD10.experimentalSlotFixes || !node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
1443
999
  if (isNodeLocatedInSlot(node, slotName)) {
1444
1000
  let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1445
1001
  checkSlotFallbackVisibility = true;
@@ -1493,14 +1049,14 @@ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1493
1049
  return slotName === "";
1494
1050
  };
1495
1051
  var nullifyVNodeRefs = (vNode) => {
1496
- if (BUILD16.vdomRef) {
1052
+ if (BUILD10.vdomRef) {
1497
1053
  vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1498
1054
  vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1499
1055
  }
1500
1056
  };
1501
1057
  var insertBefore = (parent, newNode, reference) => {
1502
1058
  const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
1503
- if (BUILD16.scoped) {
1059
+ if (BUILD10.scoped) {
1504
1060
  updateElementScopeIds(newNode, parent);
1505
1061
  }
1506
1062
  return inserted;
@@ -1538,7 +1094,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1538
1094
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1539
1095
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1540
1096
  hostTagName = hostElm.tagName;
1541
- if (BUILD16.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1097
+ if (BUILD10.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1542
1098
  throw new Error(`The <Host> must be the single root component.
1543
1099
  Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1544
1100
 
@@ -1552,7 +1108,7 @@ render() {
1552
1108
  }
1553
1109
  `);
1554
1110
  }
1555
- if (BUILD16.reflect && cmpMeta.$attrsToReflect$) {
1111
+ if (BUILD10.reflect && cmpMeta.$attrsToReflect$) {
1556
1112
  rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1557
1113
  cmpMeta.$attrsToReflect$.map(
1558
1114
  ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
@@ -1568,24 +1124,24 @@ render() {
1568
1124
  rootVnode.$tag$ = null;
1569
1125
  rootVnode.$flags$ |= 4 /* isHost */;
1570
1126
  hostRef.$vnode$ = rootVnode;
1571
- rootVnode.$elm$ = oldVNode.$elm$ = BUILD16.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
1572
- if (BUILD16.scoped || BUILD16.shadowDom) {
1127
+ rootVnode.$elm$ = oldVNode.$elm$ = BUILD10.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
1128
+ if (BUILD10.scoped || BUILD10.shadowDom) {
1573
1129
  scopeId = hostElm["s-sc"];
1574
1130
  }
1575
1131
  useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1576
- if (BUILD16.slotRelocation) {
1132
+ if (BUILD10.slotRelocation) {
1577
1133
  contentRef = hostElm["s-cr"];
1578
1134
  checkSlotFallbackVisibility = false;
1579
1135
  }
1580
1136
  patch(oldVNode, rootVnode, isInitialLoad);
1581
- if (BUILD16.slotRelocation) {
1137
+ if (BUILD10.slotRelocation) {
1582
1138
  plt.$flags$ |= 1 /* isTmpDisconnected */;
1583
1139
  if (checkSlotRelocate) {
1584
1140
  markSlotContentForRelocation(rootVnode.$elm$);
1585
1141
  for (const relocateData of relocateNodes) {
1586
1142
  const nodeToRelocate = relocateData.$nodeToRelocate$;
1587
1143
  if (!nodeToRelocate["s-ol"]) {
1588
- const orgLocationNode = BUILD16.isDebug || BUILD16.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
1144
+ const orgLocationNode = BUILD10.isDebug || BUILD10.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
1589
1145
  orgLocationNode["s-nr"] = nodeToRelocate;
1590
1146
  insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1591
1147
  }
@@ -1596,7 +1152,7 @@ render() {
1596
1152
  if (slotRefNode) {
1597
1153
  const parentNodeRef = slotRefNode.parentNode;
1598
1154
  let insertBeforeNode = slotRefNode.nextSibling;
1599
- if (!BUILD16.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
1155
+ if (!BUILD10.experimentalSlotFixes || insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
1600
1156
  let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
1601
1157
  while (orgLocationNode) {
1602
1158
  let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
@@ -1615,7 +1171,7 @@ render() {
1615
1171
  }
1616
1172
  if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
1617
1173
  if (nodeToRelocate !== insertBeforeNode) {
1618
- if (!BUILD16.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1174
+ if (!BUILD10.experimentalSlotFixes && !nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1619
1175
  nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1620
1176
  }
1621
1177
  insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
@@ -1641,7 +1197,7 @@ render() {
1641
1197
  plt.$flags$ &= ~1 /* isTmpDisconnected */;
1642
1198
  relocateNodes.length = 0;
1643
1199
  }
1644
- if (BUILD16.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1200
+ if (BUILD10.experimentalScopedSlotChanges && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1645
1201
  const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1646
1202
  for (const childNode of children) {
1647
1203
  if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
@@ -1652,37 +1208,926 @@ render() {
1652
1208
  }
1653
1209
  }
1654
1210
  }
1655
- contentRef = void 0;
1211
+ contentRef = void 0;
1212
+ };
1213
+ var slotReferenceDebugNode = (slotVNode) => doc.createComment(
1214
+ `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
1215
+ );
1216
+ var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
1217
+ `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
1218
+ );
1219
+
1220
+ // src/runtime/dom-extras.ts
1221
+ var patchPseudoShadowDom = (hostElementPrototype) => {
1222
+ patchCloneNode(hostElementPrototype);
1223
+ patchSlotAppendChild(hostElementPrototype);
1224
+ patchSlotAppend(hostElementPrototype);
1225
+ patchSlotPrepend(hostElementPrototype);
1226
+ patchSlotInsertAdjacentElement(hostElementPrototype);
1227
+ patchSlotInsertAdjacentHTML(hostElementPrototype);
1228
+ patchSlotInsertAdjacentText(hostElementPrototype);
1229
+ patchTextContent(hostElementPrototype);
1230
+ patchChildSlotNodes(hostElementPrototype);
1231
+ patchSlotRemoveChild(hostElementPrototype);
1232
+ };
1233
+ var patchCloneNode = (HostElementPrototype) => {
1234
+ const orgCloneNode = HostElementPrototype.cloneNode;
1235
+ HostElementPrototype.cloneNode = function(deep) {
1236
+ const srcNode = this;
1237
+ const isShadowDom = BUILD11.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
1238
+ const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
1239
+ if (BUILD11.slot && !isShadowDom && deep) {
1240
+ let i2 = 0;
1241
+ let slotted, nonStencilNode;
1242
+ const stencilPrivates = [
1243
+ "s-id",
1244
+ "s-cr",
1245
+ "s-lr",
1246
+ "s-rc",
1247
+ "s-sc",
1248
+ "s-p",
1249
+ "s-cn",
1250
+ "s-sr",
1251
+ "s-sn",
1252
+ "s-hn",
1253
+ "s-ol",
1254
+ "s-nr",
1255
+ "s-si",
1256
+ "s-rf",
1257
+ "s-scs"
1258
+ ];
1259
+ const childNodes = this.__childNodes || this.childNodes;
1260
+ for (; i2 < childNodes.length; i2++) {
1261
+ slotted = childNodes[i2]["s-nr"];
1262
+ nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
1263
+ if (slotted) {
1264
+ if (BUILD11.appendChildSlotFix && clonedNode.__appendChild) {
1265
+ clonedNode.__appendChild(slotted.cloneNode(true));
1266
+ } else {
1267
+ clonedNode.appendChild(slotted.cloneNode(true));
1268
+ }
1269
+ }
1270
+ if (nonStencilNode) {
1271
+ clonedNode.appendChild(childNodes[i2].cloneNode(true));
1272
+ }
1273
+ }
1274
+ }
1275
+ return clonedNode;
1276
+ };
1277
+ };
1278
+ var patchSlotAppendChild = (HostElementPrototype) => {
1279
+ HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
1280
+ HostElementPrototype.appendChild = function(newChild) {
1281
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
1282
+ const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, slotName, this.tagName);
1283
+ if (slotNode) {
1284
+ addSlotRelocateNode(newChild, slotNode);
1285
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1286
+ const appendAfter = slotChildNodes[slotChildNodes.length - 1];
1287
+ const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
1288
+ updateFallbackSlotVisibility(this);
1289
+ return insertedNode;
1290
+ }
1291
+ return this.__appendChild(newChild);
1292
+ };
1293
+ };
1294
+ var patchSlotRemoveChild = (ElementPrototype) => {
1295
+ ElementPrototype.__removeChild = ElementPrototype.removeChild;
1296
+ ElementPrototype.removeChild = function(toRemove) {
1297
+ if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
1298
+ const childNodes = this.__childNodes || this.childNodes;
1299
+ const slotNode = getHostSlotNode(childNodes, toRemove["s-sn"], this.tagName);
1300
+ if (slotNode && toRemove.isConnected) {
1301
+ toRemove.remove();
1302
+ updateFallbackSlotVisibility(this);
1303
+ return;
1304
+ }
1305
+ }
1306
+ return this.__removeChild(toRemove);
1307
+ };
1308
+ };
1309
+ var patchSlotPrepend = (HostElementPrototype) => {
1310
+ HostElementPrototype.__prepend = HostElementPrototype.prepend;
1311
+ HostElementPrototype.prepend = function(...newChildren) {
1312
+ newChildren.forEach((newChild) => {
1313
+ if (typeof newChild === "string") {
1314
+ newChild = this.ownerDocument.createTextNode(newChild);
1315
+ }
1316
+ const slotName = newChild["s-sn"] = getSlotName(newChild);
1317
+ const childNodes = this.__childNodes || this.childNodes;
1318
+ const slotNode = getHostSlotNode(childNodes, slotName, this.tagName);
1319
+ if (slotNode) {
1320
+ addSlotRelocateNode(newChild, slotNode, true);
1321
+ const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
1322
+ const appendAfter = slotChildNodes[0];
1323
+ return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
1324
+ }
1325
+ if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
1326
+ newChild.hidden = true;
1327
+ }
1328
+ return HostElementPrototype.__prepend(newChild);
1329
+ });
1330
+ };
1331
+ };
1332
+ var patchSlotAppend = (HostElementPrototype) => {
1333
+ HostElementPrototype.__append = HostElementPrototype.append;
1334
+ HostElementPrototype.append = function(...newChildren) {
1335
+ newChildren.forEach((newChild) => {
1336
+ if (typeof newChild === "string") {
1337
+ newChild = this.ownerDocument.createTextNode(newChild);
1338
+ }
1339
+ this.appendChild(newChild);
1340
+ });
1341
+ };
1342
+ };
1343
+ var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
1344
+ const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
1345
+ HostElementPrototype.insertAdjacentHTML = function(position, text) {
1346
+ if (position !== "afterbegin" && position !== "beforeend") {
1347
+ return originalInsertAdjacentHtml.call(this, position, text);
1348
+ }
1349
+ const container = this.ownerDocument.createElement("_");
1350
+ let node;
1351
+ container.innerHTML = text;
1352
+ if (position === "afterbegin") {
1353
+ while (node = container.firstChild) {
1354
+ this.prepend(node);
1355
+ }
1356
+ } else if (position === "beforeend") {
1357
+ while (node = container.firstChild) {
1358
+ this.append(node);
1359
+ }
1360
+ }
1361
+ };
1362
+ };
1363
+ var patchSlotInsertAdjacentText = (HostElementPrototype) => {
1364
+ HostElementPrototype.insertAdjacentText = function(position, text) {
1365
+ this.insertAdjacentHTML(position, text);
1366
+ };
1367
+ };
1368
+ var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
1369
+ const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
1370
+ HostElementPrototype.insertAdjacentElement = function(position, element) {
1371
+ if (position !== "afterbegin" && position !== "beforeend") {
1372
+ return originalInsertAdjacentElement.call(this, position, element);
1373
+ }
1374
+ if (position === "afterbegin") {
1375
+ this.prepend(element);
1376
+ return element;
1377
+ } else if (position === "beforeend") {
1378
+ this.append(element);
1379
+ return element;
1380
+ }
1381
+ return element;
1382
+ };
1383
+ };
1384
+ var patchTextContent = (hostElementPrototype) => {
1385
+ let descriptor = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "textContent");
1386
+ if (!descriptor) {
1387
+ descriptor = Object.getOwnPropertyDescriptor(hostElementPrototype, "textContent");
1388
+ }
1389
+ if (descriptor) Object.defineProperty(hostElementPrototype, "__textContent", descriptor);
1390
+ Object.defineProperty(hostElementPrototype, "textContent", {
1391
+ get: function() {
1392
+ let text = "";
1393
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
1394
+ childNodes.forEach((node) => text += node.textContent || "");
1395
+ return text;
1396
+ },
1397
+ set: function(value) {
1398
+ const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
1399
+ childNodes.forEach((node) => {
1400
+ if (node["s-ol"]) node["s-ol"].remove();
1401
+ node.remove();
1402
+ });
1403
+ this.insertAdjacentHTML("beforeend", value);
1404
+ }
1405
+ });
1406
+ };
1407
+ var patchChildSlotNodes = (elm) => {
1408
+ class FakeNodeList extends Array {
1409
+ item(n) {
1410
+ return this[n];
1411
+ }
1412
+ }
1413
+ let childNodesFn = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "childNodes");
1414
+ if (!childNodesFn) {
1415
+ childNodesFn = Object.getOwnPropertyDescriptor(elm, "childNodes");
1416
+ }
1417
+ if (childNodesFn) Object.defineProperty(elm, "__childNodes", childNodesFn);
1418
+ let childrenFn = Object.getOwnPropertyDescriptor(Element.prototype, "children");
1419
+ if (!childrenFn) {
1420
+ childrenFn = Object.getOwnPropertyDescriptor(elm, "children");
1421
+ }
1422
+ if (childrenFn) Object.defineProperty(elm, "__children", childrenFn);
1423
+ Object.defineProperty(elm, "children", {
1424
+ get() {
1425
+ return this.childNodes.filter((n) => n.nodeType === 1);
1426
+ }
1427
+ });
1428
+ Object.defineProperty(elm, "childElementCount", {
1429
+ get() {
1430
+ return this.children.length;
1431
+ }
1432
+ });
1433
+ if (!childNodesFn) return;
1434
+ Object.defineProperty(elm, "childNodes", {
1435
+ get() {
1436
+ var _a, _b;
1437
+ 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 */) {
1438
+ const result = new FakeNodeList();
1439
+ const nodes = getSlottedChildNodes(this.__childNodes);
1440
+ result.push(...nodes);
1441
+ return result;
1442
+ }
1443
+ return FakeNodeList.from(this.__childNodes);
1444
+ }
1445
+ });
1446
+ };
1447
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
1448
+ let slottedNodeLocation;
1449
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
1450
+ slottedNodeLocation = newChild["s-ol"];
1451
+ } else {
1452
+ slottedNodeLocation = document.createTextNode("");
1453
+ slottedNodeLocation["s-nr"] = newChild;
1454
+ }
1455
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
1456
+ const parent = slotNode["s-cr"].parentNode;
1457
+ const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild;
1458
+ if (typeof position !== "undefined") {
1459
+ if (BUILD11.hydrateClientSide) {
1460
+ slottedNodeLocation["s-oo"] = position;
1461
+ const childNodes = parent.__childNodes || parent.childNodes;
1462
+ const slotRelocateNodes = [slottedNodeLocation];
1463
+ childNodes.forEach((n) => {
1464
+ if (n["s-nr"]) slotRelocateNodes.push(n);
1465
+ });
1466
+ slotRelocateNodes.sort((a, b) => {
1467
+ if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1;
1468
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
1469
+ return 0;
1470
+ });
1471
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
1472
+ }
1473
+ } else {
1474
+ appendMethod.call(parent, slottedNodeLocation);
1475
+ }
1476
+ newChild["s-ol"] = slottedNodeLocation;
1477
+ newChild["s-sh"] = slotNode["s-hn"];
1478
+ };
1479
+ var getSlottedChildNodes = (childNodes) => {
1480
+ const result = [];
1481
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
1482
+ const slottedNode = childNodes[i2]["s-nr"];
1483
+ if (slottedNode && slottedNode.isConnected) {
1484
+ result.push(slottedNode);
1485
+ }
1486
+ }
1487
+ return result;
1488
+ };
1489
+ var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
1490
+ var getHostSlotNode = (childNodes, slotName, hostName) => {
1491
+ let i2 = 0;
1492
+ let childNode;
1493
+ for (; i2 < childNodes.length; i2++) {
1494
+ childNode = childNodes[i2];
1495
+ if (childNode["s-sr"] && childNode["s-sn"] === slotName && childNode["s-hn"] === hostName) {
1496
+ return childNode;
1497
+ }
1498
+ childNode = getHostSlotNode(childNode.childNodes, slotName, hostName);
1499
+ if (childNode) {
1500
+ return childNode;
1501
+ }
1502
+ }
1503
+ return null;
1504
+ };
1505
+ var getHostSlotChildNodes = (n, slotName) => {
1506
+ const childNodes = [n];
1507
+ while ((n = n.nextSibling) && n["s-sn"] === slotName) {
1508
+ childNodes.push(n);
1509
+ }
1510
+ return childNodes;
1511
+ };
1512
+
1513
+ // src/runtime/profile.ts
1514
+ import { BUILD as BUILD12 } from "@stencil/core/internal/app-data";
1515
+ var i = 0;
1516
+ var createTime = (fnName, tagName = "") => {
1517
+ if (BUILD12.profile && performance.mark) {
1518
+ const key = `st:${fnName}:${tagName}:${i++}`;
1519
+ performance.mark(key);
1520
+ return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
1521
+ } else {
1522
+ return () => {
1523
+ return;
1524
+ };
1525
+ }
1526
+ };
1527
+ var uniqueTime = (key, measureText) => {
1528
+ if (BUILD12.profile && performance.mark) {
1529
+ if (performance.getEntriesByName(key, "mark").length === 0) {
1530
+ performance.mark(key);
1531
+ }
1532
+ return () => {
1533
+ if (performance.getEntriesByName(measureText, "measure").length === 0) {
1534
+ performance.measure(measureText, key);
1535
+ }
1536
+ };
1537
+ } else {
1538
+ return () => {
1539
+ return;
1540
+ };
1541
+ }
1542
+ };
1543
+ var inspect = (ref) => {
1544
+ const hostRef = getHostRef(ref);
1545
+ if (!hostRef) {
1546
+ return void 0;
1547
+ }
1548
+ const flags = hostRef.$flags$;
1549
+ const hostElement = hostRef.$hostElement$;
1550
+ return {
1551
+ renderCount: hostRef.$renderCount$,
1552
+ flags: {
1553
+ hasRendered: !!(flags & 2 /* hasRendered */),
1554
+ hasConnected: !!(flags & 1 /* hasConnected */),
1555
+ isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
1556
+ isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
1557
+ isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
1558
+ hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
1559
+ hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
1560
+ isWatchReady: !!(flags & 128 /* isWatchReady */),
1561
+ isListenReady: !!(flags & 256 /* isListenReady */),
1562
+ needsRerender: !!(flags & 512 /* needsRerender */)
1563
+ },
1564
+ instanceValues: hostRef.$instanceValues$,
1565
+ ancestorComponent: hostRef.$ancestorComponent$,
1566
+ hostElement,
1567
+ lazyInstance: hostRef.$lazyInstance$,
1568
+ vnode: hostRef.$vnode$,
1569
+ modeName: hostRef.$modeName$,
1570
+ onReadyPromise: hostRef.$onReadyPromise$,
1571
+ onReadyResolve: hostRef.$onReadyResolve$,
1572
+ onInstancePromise: hostRef.$onInstancePromise$,
1573
+ onInstanceResolve: hostRef.$onInstanceResolve$,
1574
+ onRenderResolve: hostRef.$onRenderResolve$,
1575
+ queuedListeners: hostRef.$queuedListeners$,
1576
+ rmListeners: hostRef.$rmListeners$,
1577
+ ["s-id"]: hostElement["s-id"],
1578
+ ["s-cr"]: hostElement["s-cr"],
1579
+ ["s-lr"]: hostElement["s-lr"],
1580
+ ["s-p"]: hostElement["s-p"],
1581
+ ["s-rc"]: hostElement["s-rc"],
1582
+ ["s-sc"]: hostElement["s-sc"]
1583
+ };
1584
+ };
1585
+ var installDevTools = () => {
1586
+ if (BUILD12.devTools) {
1587
+ const stencil = win.stencil = win.stencil || {};
1588
+ const originalInspect = stencil.inspect;
1589
+ stencil.inspect = (ref) => {
1590
+ let result = inspect(ref);
1591
+ if (!result && typeof originalInspect === "function") {
1592
+ result = originalInspect(ref);
1593
+ }
1594
+ return result;
1595
+ };
1596
+ }
1597
+ };
1598
+
1599
+ // src/runtime/client-hydrate.ts
1600
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1601
+ const endHydrate = createTime("hydrateClient", tagName);
1602
+ const shadowRoot = hostElm.shadowRoot;
1603
+ const childRenderNodes = [];
1604
+ const slotNodes = [];
1605
+ const slottedNodes = [];
1606
+ const shadowRootNodes = BUILD13.shadowDom && shadowRoot ? [] : null;
1607
+ const vnode = newVNode(tagName, null);
1608
+ vnode.$elm$ = hostElm;
1609
+ if (!plt.$orgLocNodes$) {
1610
+ initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
1611
+ }
1612
+ hostElm[HYDRATE_ID] = hostId;
1613
+ hostElm.removeAttribute(HYDRATE_ID);
1614
+ hostRef.$vnode$ = clientHydrate(
1615
+ vnode,
1616
+ childRenderNodes,
1617
+ slotNodes,
1618
+ shadowRootNodes,
1619
+ hostElm,
1620
+ hostElm,
1621
+ hostId,
1622
+ slottedNodes
1623
+ );
1624
+ let crIndex = 0;
1625
+ const crLength = childRenderNodes.length;
1626
+ let childRenderNode;
1627
+ for (crIndex; crIndex < crLength; crIndex++) {
1628
+ childRenderNode = childRenderNodes[crIndex];
1629
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
1630
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1631
+ const node = childRenderNode.$elm$;
1632
+ if (!shadowRoot) {
1633
+ node["s-hn"] = tagName.toUpperCase();
1634
+ if (childRenderNode.$tag$ === "slot") {
1635
+ node["s-cr"] = hostElm["s-cr"];
1636
+ }
1637
+ }
1638
+ if (orgLocationNode && orgLocationNode.isConnected) {
1639
+ if (shadowRoot && orgLocationNode["s-en"] === "") {
1640
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1641
+ }
1642
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
1643
+ if (!shadowRoot) {
1644
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1645
+ }
1646
+ }
1647
+ plt.$orgLocNodes$.delete(orgLocationId);
1648
+ }
1649
+ const hosts = [];
1650
+ let snIndex = 0;
1651
+ const snLen = slottedNodes.length;
1652
+ let slotGroup;
1653
+ let snGroupIdx;
1654
+ let snGroupLen;
1655
+ let slottedItem;
1656
+ for (snIndex; snIndex < snLen; snIndex++) {
1657
+ slotGroup = slottedNodes[snIndex];
1658
+ if (!slotGroup || !slotGroup.length) continue;
1659
+ snGroupLen = slotGroup.length;
1660
+ snGroupIdx = 0;
1661
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
1662
+ slottedItem = slotGroup[snGroupIdx];
1663
+ if (!hosts[slottedItem.hostId]) {
1664
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
1665
+ }
1666
+ if (!hosts[slottedItem.hostId]) continue;
1667
+ const hostEle = hosts[slottedItem.hostId];
1668
+ if (!hostEle.shadowRoot || !shadowRoot) {
1669
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1670
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1671
+ slottedItem.slot["s-cr"] = hostEle;
1672
+ } else {
1673
+ const hostChildren = hostEle.__childNodes || hostEle.childNodes;
1674
+ slottedItem.slot["s-cr"] = hostChildren[0];
1675
+ }
1676
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1677
+ }
1678
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1679
+ hostEle.appendChild(slottedItem.node);
1680
+ }
1681
+ }
1682
+ }
1683
+ if (BUILD13.shadowDom && shadowRoot) {
1684
+ let rnIdex = 0;
1685
+ const rnLen = shadowRootNodes.length;
1686
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
1687
+ shadowRoot.appendChild(shadowRootNodes[rnIdex]);
1688
+ }
1689
+ Array.from(hostElm.childNodes).forEach((node) => {
1690
+ if (node.nodeType === 8 /* CommentNode */ && typeof node["s-sn"] !== "string") {
1691
+ node.parentNode.removeChild(node);
1692
+ }
1693
+ });
1694
+ }
1695
+ hostRef.$hostElement$ = hostElm;
1696
+ endHydrate();
1697
+ };
1698
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
1699
+ let childNodeType;
1700
+ let childIdSplt;
1701
+ let childVNode;
1702
+ let i2;
1703
+ const scopeId2 = hostElm["s-sc"];
1704
+ if (node.nodeType === 1 /* ElementNode */) {
1705
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1706
+ if (childNodeType) {
1707
+ childIdSplt = childNodeType.split(".");
1708
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
1709
+ childVNode = createSimpleVNode({
1710
+ $flags$: 0,
1711
+ $hostId$: childIdSplt[0],
1712
+ $nodeId$: childIdSplt[1],
1713
+ $depth$: childIdSplt[2],
1714
+ $index$: childIdSplt[3],
1715
+ $tag$: node.tagName.toLowerCase(),
1716
+ $elm$: node,
1717
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` reconciliation will fail:
1718
+ // client side changes before componentDidLoad will be ignored, `set-accessor.ts` will just take the element's initial classes
1719
+ $attrs$: { class: node.className }
1720
+ });
1721
+ childRenderNodes.push(childVNode);
1722
+ node.removeAttribute(HYDRATE_CHILD_ID);
1723
+ if (!parentVNode.$children$) {
1724
+ parentVNode.$children$ = [];
1725
+ }
1726
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
1727
+ if (typeof slotName === "string") {
1728
+ if (childVNode.$tag$ === "slot-fb") {
1729
+ addSlot(
1730
+ slotName,
1731
+ childIdSplt[2],
1732
+ childVNode,
1733
+ node,
1734
+ parentVNode,
1735
+ childRenderNodes,
1736
+ slotNodes,
1737
+ shadowRootNodes,
1738
+ slottedNodes
1739
+ );
1740
+ }
1741
+ childVNode.$elm$["s-sn"] = slotName;
1742
+ childVNode.$elm$.removeAttribute("s-sn");
1743
+ }
1744
+ if (childVNode.$index$ !== void 0) {
1745
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1746
+ }
1747
+ if (scopeId2) node["s-si"] = scopeId2;
1748
+ parentVNode = childVNode;
1749
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
1750
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1751
+ }
1752
+ }
1753
+ }
1754
+ if (node.shadowRoot) {
1755
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
1756
+ clientHydrate(
1757
+ parentVNode,
1758
+ childRenderNodes,
1759
+ slotNodes,
1760
+ shadowRootNodes,
1761
+ hostElm,
1762
+ node.shadowRoot.childNodes[i2],
1763
+ hostId,
1764
+ slottedNodes
1765
+ );
1766
+ }
1767
+ }
1768
+ const nonShadowNodes = node.__childNodes || node.childNodes;
1769
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
1770
+ clientHydrate(
1771
+ parentVNode,
1772
+ childRenderNodes,
1773
+ slotNodes,
1774
+ shadowRootNodes,
1775
+ hostElm,
1776
+ nonShadowNodes[i2],
1777
+ hostId,
1778
+ slottedNodes
1779
+ );
1780
+ }
1781
+ } else if (node.nodeType === 8 /* CommentNode */) {
1782
+ childIdSplt = node.nodeValue.split(".");
1783
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
1784
+ childNodeType = childIdSplt[0];
1785
+ childVNode = createSimpleVNode({
1786
+ $hostId$: childIdSplt[1],
1787
+ $nodeId$: childIdSplt[2],
1788
+ $depth$: childIdSplt[3],
1789
+ $index$: childIdSplt[4] || "0",
1790
+ $elm$: node,
1791
+ $attrs$: null,
1792
+ $children$: null,
1793
+ $key$: null,
1794
+ $name$: null,
1795
+ $tag$: null,
1796
+ $text$: null
1797
+ });
1798
+ if (childNodeType === TEXT_NODE_ID) {
1799
+ childVNode.$elm$ = node.nextSibling;
1800
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1801
+ childVNode.$text$ = childVNode.$elm$.textContent;
1802
+ childRenderNodes.push(childVNode);
1803
+ node.remove();
1804
+ if (hostId === childVNode.$hostId$) {
1805
+ if (!parentVNode.$children$) {
1806
+ parentVNode.$children$ = [];
1807
+ }
1808
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1809
+ }
1810
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
1811
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1812
+ }
1813
+ }
1814
+ } else if (childNodeType === COMMENT_NODE_ID) {
1815
+ childVNode.$elm$ = node.nextSibling;
1816
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
1817
+ childRenderNodes.push(childVNode);
1818
+ node.remove();
1819
+ }
1820
+ } else if (childVNode.$hostId$ === hostId) {
1821
+ if (childNodeType === SLOT_NODE_ID) {
1822
+ childVNode.$tag$ = "slot";
1823
+ const slotName = node["s-sn"] = childVNode.$name$ = childIdSplt[5] || "";
1824
+ addSlot(
1825
+ slotName,
1826
+ childIdSplt[2],
1827
+ childVNode,
1828
+ node,
1829
+ parentVNode,
1830
+ childRenderNodes,
1831
+ slotNodes,
1832
+ shadowRootNodes,
1833
+ slottedNodes
1834
+ );
1835
+ } else if (childNodeType === CONTENT_REF_ID) {
1836
+ if (BUILD13.shadowDom && shadowRootNodes) {
1837
+ node.remove();
1838
+ } else if (BUILD13.slotRelocation) {
1839
+ hostElm["s-cr"] = node;
1840
+ node["s-cn"] = true;
1841
+ }
1842
+ }
1843
+ }
1844
+ }
1845
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
1846
+ const vnode = newVNode(null, node.textContent);
1847
+ vnode.$elm$ = node;
1848
+ vnode.$index$ = "0";
1849
+ parentVNode.$children$ = [vnode];
1850
+ }
1851
+ return parentVNode;
1852
+ };
1853
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
1854
+ if (node.nodeType === 1 /* ElementNode */) {
1855
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
1856
+ if (componentId) {
1857
+ orgLocNodes.set(componentId, node);
1858
+ }
1859
+ let i2 = 0;
1860
+ if (node.shadowRoot) {
1861
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
1862
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
1863
+ }
1864
+ }
1865
+ const nonShadowNodes = node.__childNodes || node.childNodes;
1866
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
1867
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
1868
+ }
1869
+ } else if (node.nodeType === 8 /* CommentNode */) {
1870
+ const childIdSplt = node.nodeValue.split(".");
1871
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
1872
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
1873
+ node.nodeValue = "";
1874
+ node["s-en"] = childIdSplt[3];
1875
+ }
1876
+ }
1877
+ };
1878
+ var createSimpleVNode = (vnode) => {
1879
+ const defaultVNode = {
1880
+ $flags$: 0,
1881
+ $hostId$: null,
1882
+ $nodeId$: null,
1883
+ $depth$: null,
1884
+ $index$: "0",
1885
+ $elm$: null,
1886
+ $attrs$: null,
1887
+ $children$: null,
1888
+ $key$: null,
1889
+ $name$: null,
1890
+ $tag$: null,
1891
+ $text$: null
1892
+ };
1893
+ return { ...defaultVNode, ...vnode };
1894
+ };
1895
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
1896
+ node["s-sr"] = true;
1897
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1898
+ if (BUILD13.shadowDom && shadowRootNodes) {
1899
+ const slot = childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1900
+ if (childVNode.$name$) {
1901
+ childVNode.$elm$.setAttribute("name", slotName);
1902
+ }
1903
+ if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1904
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1905
+ } else {
1906
+ node.parentNode.insertBefore(childVNode.$elm$, node);
1907
+ }
1908
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1909
+ node.remove();
1910
+ if (childVNode.$depth$ === "0") {
1911
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1912
+ }
1913
+ } else {
1914
+ const slot = childVNode.$elm$;
1915
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
1916
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
1917
+ if (shouldMove) {
1918
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1919
+ }
1920
+ childRenderNodes.push(childVNode);
1921
+ }
1922
+ slotNodes.push(childVNode);
1923
+ if (!parentVNode.$children$) {
1924
+ parentVNode.$children$ = [];
1925
+ }
1926
+ parentVNode.$children$[childVNode.$index$] = childVNode;
1927
+ }
1928
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1929
+ let slottedNode = slotNode.nextSibling;
1930
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1931
+ 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 */))) {
1932
+ slottedNode["s-sn"] = slotName;
1933
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1934
+ slottedNode = slottedNode.nextSibling;
1935
+ }
1936
+ };
1937
+
1938
+ // src/runtime/initialize-component.ts
1939
+ import { BUILD as BUILD21 } from "@stencil/core/internal/app-data";
1940
+
1941
+ // src/runtime/mode.ts
1942
+ var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
1943
+ var setMode = (handler) => modeResolutionChain.push(handler);
1944
+ var getMode = (ref) => getHostRef(ref).$modeName$;
1945
+
1946
+ // src/runtime/proxy-component.ts
1947
+ import { BUILD as BUILD20 } from "@stencil/core/internal/app-data";
1948
+
1949
+ // src/runtime/set-value.ts
1950
+ import { BUILD as BUILD19 } from "@stencil/core/internal/app-data";
1951
+
1952
+ // src/runtime/parse-property-value.ts
1953
+ import { BUILD as BUILD14 } from "@stencil/core/internal/app-data";
1954
+ var parsePropertyValue = (propValue, propType) => {
1955
+ if (propValue != null && !isComplexType(propValue)) {
1956
+ if (BUILD14.propBoolean && propType & 4 /* Boolean */) {
1957
+ return propValue === "false" ? false : propValue === "" || !!propValue;
1958
+ }
1959
+ if (BUILD14.propNumber && propType & 2 /* Number */) {
1960
+ return parseFloat(propValue);
1961
+ }
1962
+ if (BUILD14.propString && propType & 1 /* String */) {
1963
+ return String(propValue);
1964
+ }
1965
+ return propValue;
1966
+ }
1967
+ return propValue;
1968
+ };
1969
+
1970
+ // src/runtime/update-component.ts
1971
+ import { BUILD as BUILD18, NAMESPACE } from "@stencil/core/internal/app-data";
1972
+
1973
+ // src/runtime/event-emitter.ts
1974
+ import { BUILD as BUILD16 } from "@stencil/core/internal/app-data";
1975
+
1976
+ // src/runtime/element.ts
1977
+ import { BUILD as BUILD15 } from "@stencil/core/internal/app-data";
1978
+ var getElement = (ref) => BUILD15.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
1979
+
1980
+ // src/runtime/event-emitter.ts
1981
+ var createEvent = (ref, name, flags) => {
1982
+ const elm = getElement(ref);
1983
+ return {
1984
+ emit: (detail) => {
1985
+ if (BUILD16.isDev && !elm.isConnected) {
1986
+ consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1987
+ }
1988
+ return emitEvent(elm, name, {
1989
+ bubbles: !!(flags & 4 /* Bubbles */),
1990
+ composed: !!(flags & 2 /* Composed */),
1991
+ cancelable: !!(flags & 1 /* Cancellable */),
1992
+ detail
1993
+ });
1994
+ }
1995
+ };
1996
+ };
1997
+ var emitEvent = (elm, name, opts) => {
1998
+ const ev = plt.ce(name, opts);
1999
+ elm.dispatchEvent(ev);
2000
+ return ev;
2001
+ };
2002
+
2003
+ // src/runtime/styles.ts
2004
+ import { BUILD as BUILD17 } from "@stencil/core/internal/app-data";
2005
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2006
+ var registerStyle = (scopeId2, cssText, allowCS) => {
2007
+ let style = styles.get(scopeId2);
2008
+ if (supportsConstructableStylesheets && allowCS) {
2009
+ style = style || new CSSStyleSheet();
2010
+ if (typeof style === "string") {
2011
+ style = cssText;
2012
+ } else {
2013
+ style.replaceSync(cssText);
2014
+ }
2015
+ } else {
2016
+ style = cssText;
2017
+ }
2018
+ styles.set(scopeId2, style);
2019
+ };
2020
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
2021
+ var _a;
2022
+ const scopeId2 = getScopeId(cmpMeta, mode);
2023
+ const style = styles.get(scopeId2);
2024
+ if (!BUILD17.attachStyles) {
2025
+ return scopeId2;
2026
+ }
2027
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
2028
+ if (style) {
2029
+ if (typeof style === "string") {
2030
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
2031
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2032
+ let styleElm;
2033
+ if (!appliedStyles) {
2034
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2035
+ }
2036
+ if (!appliedStyles.has(scopeId2)) {
2037
+ if (BUILD17.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2038
+ styleElm.innerHTML = style;
2039
+ } else {
2040
+ styleElm = doc.createElement("style");
2041
+ styleElm.innerHTML = style;
2042
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
2043
+ if (nonce != null) {
2044
+ styleElm.setAttribute("nonce", nonce);
2045
+ }
2046
+ if ((BUILD17.hydrateServerSide || BUILD17.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2047
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2048
+ }
2049
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2050
+ if (styleContainerNode.nodeName === "HEAD") {
2051
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2052
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2053
+ styleContainerNode.insertBefore(styleElm, referenceNode2);
2054
+ } else if ("host" in styleContainerNode) {
2055
+ if (supportsConstructableStylesheets) {
2056
+ const stylesheet = new CSSStyleSheet();
2057
+ stylesheet.replaceSync(style);
2058
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2059
+ } else {
2060
+ const existingStyleContainer = styleContainerNode.querySelector("style");
2061
+ if (existingStyleContainer) {
2062
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2063
+ } else {
2064
+ styleContainerNode.prepend(styleElm);
2065
+ }
2066
+ }
2067
+ } else {
2068
+ styleContainerNode.append(styleElm);
2069
+ }
2070
+ }
2071
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
2072
+ styleContainerNode.insertBefore(styleElm, null);
2073
+ }
2074
+ }
2075
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2076
+ styleElm.innerHTML += SLOT_FB_CSS;
2077
+ }
2078
+ if (appliedStyles) {
2079
+ appliedStyles.add(scopeId2);
2080
+ }
2081
+ }
2082
+ } else if (BUILD17.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2083
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2084
+ }
2085
+ }
2086
+ return scopeId2;
2087
+ };
2088
+ var attachStyles = (hostRef) => {
2089
+ const cmpMeta = hostRef.$cmpMeta$;
2090
+ const elm = hostRef.$hostElement$;
2091
+ const flags = cmpMeta.$flags$;
2092
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2093
+ const scopeId2 = addStyle(
2094
+ BUILD17.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2095
+ cmpMeta,
2096
+ hostRef.$modeName$
2097
+ );
2098
+ if ((BUILD17.shadowDom || BUILD17.scoped) && BUILD17.cssAnnotations && flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
2099
+ elm["s-sc"] = scopeId2;
2100
+ elm.classList.add(scopeId2 + "-h");
2101
+ if (BUILD17.scoped && flags & 2 /* scopedCssEncapsulation */) {
2102
+ elm.classList.add(scopeId2 + "-s");
2103
+ }
2104
+ }
2105
+ endAttachStyles();
1656
2106
  };
1657
- var slotReferenceDebugNode = (slotVNode) => doc.createComment(
1658
- `<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`
1659
- );
1660
- var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(
1661
- `org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`)
1662
- );
2107
+ var getScopeId = (cmp, mode) => "sc-" + (BUILD17.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1663
2108
 
1664
2109
  // src/runtime/update-component.ts
1665
2110
  var attachToAncestor = (hostRef, ancestorComponent) => {
1666
- if (BUILD17.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
2111
+ if (BUILD18.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
1667
2112
  ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
1668
2113
  }
1669
2114
  };
1670
2115
  var scheduleUpdate = (hostRef, isInitialLoad) => {
1671
- if (BUILD17.taskQueue && BUILD17.updatable) {
2116
+ if (BUILD18.taskQueue && BUILD18.updatable) {
1672
2117
  hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1673
2118
  }
1674
- if (BUILD17.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
2119
+ if (BUILD18.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1675
2120
  hostRef.$flags$ |= 512 /* needsRerender */;
1676
2121
  return;
1677
2122
  }
1678
2123
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1679
2124
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1680
- return BUILD17.taskQueue ? writeTask(dispatch) : dispatch();
2125
+ return BUILD18.taskQueue ? writeTask(dispatch) : dispatch();
1681
2126
  };
1682
2127
  var dispatchHooks = (hostRef, isInitialLoad) => {
1683
2128
  const elm = hostRef.$hostElement$;
1684
2129
  const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
1685
- const instance = BUILD17.lazyLoad ? hostRef.$lazyInstance$ : elm;
2130
+ const instance = BUILD18.lazyLoad ? hostRef.$lazyInstance$ : elm;
1686
2131
  if (!instance) {
1687
2132
  throw new Error(
1688
2133
  `Can't render component <${elm.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`
@@ -1690,7 +2135,7 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1690
2135
  }
1691
2136
  let maybePromise;
1692
2137
  if (isInitialLoad) {
1693
- if (BUILD17.lazyLoad && BUILD17.hostListener) {
2138
+ if (BUILD18.lazyLoad && BUILD18.hostListener) {
1694
2139
  hostRef.$flags$ |= 256 /* isListenReady */;
1695
2140
  if (hostRef.$queuedListeners$) {
1696
2141
  hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
@@ -1698,17 +2143,17 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1698
2143
  }
1699
2144
  }
1700
2145
  emitLifecycleEvent(elm, "componentWillLoad");
1701
- if (BUILD17.cmpWillLoad) {
2146
+ if (BUILD18.cmpWillLoad) {
1702
2147
  maybePromise = safeCall(instance, "componentWillLoad");
1703
2148
  }
1704
2149
  } else {
1705
2150
  emitLifecycleEvent(elm, "componentWillUpdate");
1706
- if (BUILD17.cmpWillUpdate) {
2151
+ if (BUILD18.cmpWillUpdate) {
1707
2152
  maybePromise = safeCall(instance, "componentWillUpdate");
1708
2153
  }
1709
2154
  }
1710
2155
  emitLifecycleEvent(elm, "componentWillRender");
1711
- if (BUILD17.cmpWillRender) {
2156
+ if (BUILD18.cmpWillRender) {
1712
2157
  maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender"));
1713
2158
  }
1714
2159
  endSchedule();
@@ -1724,23 +2169,23 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1724
2169
  const elm = hostRef.$hostElement$;
1725
2170
  const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
1726
2171
  const rc = elm["s-rc"];
1727
- if (BUILD17.style && isInitialLoad) {
2172
+ if (BUILD18.style && isInitialLoad) {
1728
2173
  attachStyles(hostRef);
1729
2174
  }
1730
2175
  const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
1731
- if (BUILD17.isDev) {
2176
+ if (BUILD18.isDev) {
1732
2177
  hostRef.$flags$ |= 1024 /* devOnRender */;
1733
2178
  }
1734
- if (BUILD17.hydrateServerSide) {
2179
+ if (BUILD18.hydrateServerSide) {
1735
2180
  await callRender(hostRef, instance, elm, isInitialLoad);
1736
2181
  } else {
1737
2182
  callRender(hostRef, instance, elm, isInitialLoad);
1738
2183
  }
1739
- if (BUILD17.isDev) {
2184
+ if (BUILD18.isDev) {
1740
2185
  hostRef.$renderCount$ = hostRef.$renderCount$ === void 0 ? 1 : hostRef.$renderCount$ + 1;
1741
2186
  hostRef.$flags$ &= ~1024 /* devOnRender */;
1742
2187
  }
1743
- if (BUILD17.hydrateServerSide) {
2188
+ if (BUILD18.hydrateServerSide) {
1744
2189
  try {
1745
2190
  serverSideConnected(elm);
1746
2191
  if (isInitialLoad) {
@@ -1754,13 +2199,13 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1754
2199
  consoleError(e, elm);
1755
2200
  }
1756
2201
  }
1757
- if (BUILD17.asyncLoading && rc) {
2202
+ if (BUILD18.asyncLoading && rc) {
1758
2203
  rc.map((cb) => cb());
1759
2204
  elm["s-rc"] = void 0;
1760
2205
  }
1761
2206
  endRender();
1762
2207
  endUpdate();
1763
- if (BUILD17.asyncLoading) {
2208
+ if (BUILD18.asyncLoading) {
1764
2209
  const childrenPromises = (_a = elm["s-p"]) != null ? _a : [];
1765
2210
  const postUpdate = () => postUpdateComponent(hostRef);
1766
2211
  if (childrenPromises.length === 0) {
@@ -1776,10 +2221,10 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1776
2221
  };
1777
2222
  var renderingRef = null;
1778
2223
  var callRender = (hostRef, instance, elm, isInitialLoad) => {
1779
- const allRenderFn = BUILD17.allRenderFn ? true : false;
1780
- const lazyLoad = BUILD17.lazyLoad ? true : false;
1781
- const taskQueue = BUILD17.taskQueue ? true : false;
1782
- const updatable = BUILD17.updatable ? true : false;
2224
+ const allRenderFn = BUILD18.allRenderFn ? true : false;
2225
+ const lazyLoad = BUILD18.lazyLoad ? true : false;
2226
+ const taskQueue = BUILD18.taskQueue ? true : false;
2227
+ const updatable = BUILD18.updatable ? true : false;
1783
2228
  try {
1784
2229
  renderingRef = instance;
1785
2230
  instance = allRenderFn ? instance.render() : instance.render && instance.render();
@@ -1789,9 +2234,9 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
1789
2234
  if (updatable || lazyLoad) {
1790
2235
  hostRef.$flags$ |= 2 /* hasRendered */;
1791
2236
  }
1792
- if (BUILD17.hasRenderFn || BUILD17.reflect) {
1793
- if (BUILD17.vdomRender || BUILD17.reflect) {
1794
- if (BUILD17.hydrateServerSide) {
2237
+ if (BUILD18.hasRenderFn || BUILD18.reflect) {
2238
+ if (BUILD18.vdomRender || BUILD18.reflect) {
2239
+ if (BUILD18.hydrateServerSide) {
1795
2240
  return Promise.resolve(instance).then((value) => renderVdom(hostRef, value, isInitialLoad));
1796
2241
  } else {
1797
2242
  renderVdom(hostRef, instance, isInitialLoad);
@@ -1816,57 +2261,57 @@ var postUpdateComponent = (hostRef) => {
1816
2261
  const tagName = hostRef.$cmpMeta$.$tagName$;
1817
2262
  const elm = hostRef.$hostElement$;
1818
2263
  const endPostUpdate = createTime("postUpdate", tagName);
1819
- const instance = BUILD17.lazyLoad ? hostRef.$lazyInstance$ : elm;
2264
+ const instance = BUILD18.lazyLoad ? hostRef.$lazyInstance$ : elm;
1820
2265
  const ancestorComponent = hostRef.$ancestorComponent$;
1821
- if (BUILD17.cmpDidRender) {
1822
- if (BUILD17.isDev) {
2266
+ if (BUILD18.cmpDidRender) {
2267
+ if (BUILD18.isDev) {
1823
2268
  hostRef.$flags$ |= 1024 /* devOnRender */;
1824
2269
  }
1825
2270
  safeCall(instance, "componentDidRender");
1826
- if (BUILD17.isDev) {
2271
+ if (BUILD18.isDev) {
1827
2272
  hostRef.$flags$ &= ~1024 /* devOnRender */;
1828
2273
  }
1829
2274
  }
1830
2275
  emitLifecycleEvent(elm, "componentDidRender");
1831
2276
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1832
2277
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1833
- if (BUILD17.asyncLoading && BUILD17.cssAnnotations) {
2278
+ if (BUILD18.asyncLoading && BUILD18.cssAnnotations) {
1834
2279
  addHydratedFlag(elm);
1835
2280
  }
1836
- if (BUILD17.cmpDidLoad) {
1837
- if (BUILD17.isDev) {
2281
+ if (BUILD18.cmpDidLoad) {
2282
+ if (BUILD18.isDev) {
1838
2283
  hostRef.$flags$ |= 2048 /* devOnDidLoad */;
1839
2284
  }
1840
2285
  safeCall(instance, "componentDidLoad");
1841
- if (BUILD17.isDev) {
2286
+ if (BUILD18.isDev) {
1842
2287
  hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
1843
2288
  }
1844
2289
  }
1845
2290
  emitLifecycleEvent(elm, "componentDidLoad");
1846
2291
  endPostUpdate();
1847
- if (BUILD17.asyncLoading) {
2292
+ if (BUILD18.asyncLoading) {
1848
2293
  hostRef.$onReadyResolve$(elm);
1849
2294
  if (!ancestorComponent) {
1850
2295
  appDidLoad(tagName);
1851
2296
  }
1852
2297
  }
1853
2298
  } else {
1854
- if (BUILD17.cmpDidUpdate) {
1855
- if (BUILD17.isDev) {
2299
+ if (BUILD18.cmpDidUpdate) {
2300
+ if (BUILD18.isDev) {
1856
2301
  hostRef.$flags$ |= 1024 /* devOnRender */;
1857
2302
  }
1858
2303
  safeCall(instance, "componentDidUpdate");
1859
- if (BUILD17.isDev) {
2304
+ if (BUILD18.isDev) {
1860
2305
  hostRef.$flags$ &= ~1024 /* devOnRender */;
1861
2306
  }
1862
2307
  }
1863
2308
  emitLifecycleEvent(elm, "componentDidUpdate");
1864
2309
  endPostUpdate();
1865
2310
  }
1866
- if (BUILD17.method && BUILD17.lazyLoad) {
2311
+ if (BUILD18.method && BUILD18.lazyLoad) {
1867
2312
  hostRef.$onInstanceResolve$(elm);
1868
2313
  }
1869
- if (BUILD17.asyncLoading) {
2314
+ if (BUILD18.asyncLoading) {
1870
2315
  if (hostRef.$onRenderResolve$) {
1871
2316
  hostRef.$onRenderResolve$();
1872
2317
  hostRef.$onRenderResolve$ = void 0;
@@ -1878,7 +2323,7 @@ var postUpdateComponent = (hostRef) => {
1878
2323
  }
1879
2324
  };
1880
2325
  var forceUpdate = (ref) => {
1881
- if (BUILD17.updatable && (Build.isBrowser || Build.isTesting)) {
2326
+ if (BUILD18.updatable && (Build.isBrowser || Build.isTesting)) {
1882
2327
  const hostRef = getHostRef(ref);
1883
2328
  const isConnected = hostRef.$hostElement$.isConnected;
1884
2329
  if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
@@ -1889,14 +2334,14 @@ var forceUpdate = (ref) => {
1889
2334
  return false;
1890
2335
  };
1891
2336
  var appDidLoad = (who) => {
1892
- if (BUILD17.cssAnnotations) {
2337
+ if (BUILD18.cssAnnotations) {
1893
2338
  addHydratedFlag(doc.documentElement);
1894
2339
  }
1895
- if (BUILD17.asyncQueue) {
2340
+ if (BUILD18.asyncQueue) {
1896
2341
  plt.$flags$ |= 2 /* appLoaded */;
1897
2342
  }
1898
2343
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1899
- if (BUILD17.profile && performance.measure) {
2344
+ if (BUILD18.profile && performance.measure) {
1900
2345
  performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
1901
2346
  }
1902
2347
  };
@@ -1911,7 +2356,7 @@ var safeCall = (instance, method, arg) => {
1911
2356
  return void 0;
1912
2357
  };
1913
2358
  var emitLifecycleEvent = (elm, lifecycleName) => {
1914
- if (BUILD17.lifecycleDOMEvents) {
2359
+ if (BUILD18.lifecycleDOMEvents) {
1915
2360
  emitEvent(elm, "stencil_" + lifecycleName, {
1916
2361
  bubbles: true,
1917
2362
  composed: true,
@@ -1923,7 +2368,7 @@ var emitLifecycleEvent = (elm, lifecycleName) => {
1923
2368
  };
1924
2369
  var addHydratedFlag = (elm) => {
1925
2370
  var _a, _b;
1926
- return BUILD17.hydratedClass ? elm.classList.add((_a = BUILD17.hydratedSelectorName) != null ? _a : "hydrated") : BUILD17.hydratedAttribute ? elm.setAttribute((_b = BUILD17.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
2371
+ return BUILD18.hydratedClass ? elm.classList.add((_a = BUILD18.hydratedSelectorName) != null ? _a : "hydrated") : BUILD18.hydratedAttribute ? elm.setAttribute((_b = BUILD18.hydratedSelectorName) != null ? _b : "hydrated", "") : void 0;
1927
2372
  };
1928
2373
  var serverSideConnected = (elm) => {
1929
2374
  const children = elm.children;
@@ -1942,21 +2387,21 @@ var serverSideConnected = (elm) => {
1942
2387
  var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1943
2388
  var setValue = (ref, propName, newVal, cmpMeta) => {
1944
2389
  const hostRef = getHostRef(ref);
1945
- if (BUILD18.lazyLoad && !hostRef) {
2390
+ if (BUILD19.lazyLoad && !hostRef) {
1946
2391
  throw new Error(
1947
2392
  `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
1948
2393
  );
1949
2394
  }
1950
- const elm = BUILD18.lazyLoad ? hostRef.$hostElement$ : ref;
2395
+ const elm = BUILD19.lazyLoad ? hostRef.$hostElement$ : ref;
1951
2396
  const oldVal = hostRef.$instanceValues$.get(propName);
1952
2397
  const flags = hostRef.$flags$;
1953
- const instance = BUILD18.lazyLoad ? hostRef.$lazyInstance$ : elm;
2398
+ const instance = BUILD19.lazyLoad ? hostRef.$lazyInstance$ : elm;
1954
2399
  newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1955
2400
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1956
2401
  const didValueChange = newVal !== oldVal && !areBothNaN;
1957
- if ((!BUILD18.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
2402
+ if ((!BUILD19.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
1958
2403
  hostRef.$instanceValues$.set(propName, newVal);
1959
- if (BUILD18.isDev) {
2404
+ if (BUILD19.isDev) {
1960
2405
  if (hostRef.$flags$ & 1024 /* devOnRender */) {
1961
2406
  consoleDevWarn(
1962
2407
  `The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,
@@ -1979,8 +2424,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1979
2424
  );
1980
2425
  }
1981
2426
  }
1982
- if (!BUILD18.lazyLoad || instance) {
1983
- if (BUILD18.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
2427
+ if (!BUILD19.lazyLoad || instance) {
2428
+ if (BUILD19.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1984
2429
  const watchMethods = cmpMeta.$watchers$[propName];
1985
2430
  if (watchMethods) {
1986
2431
  watchMethods.map((watchMethodName) => {
@@ -1992,8 +2437,8 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1992
2437
  });
1993
2438
  }
1994
2439
  }
1995
- if (BUILD18.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1996
- if (BUILD18.cmpShouldUpdate && instance.componentShouldUpdate) {
2440
+ if (BUILD19.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
2441
+ if (BUILD19.cmpShouldUpdate && instance.componentShouldUpdate) {
1997
2442
  if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1998
2443
  return;
1999
2444
  }
@@ -2008,40 +2453,40 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
2008
2453
  var proxyComponent = (Cstr, cmpMeta, flags) => {
2009
2454
  var _a, _b;
2010
2455
  const prototype = Cstr.prototype;
2011
- if (BUILD19.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
2456
+ if (BUILD20.formAssociated && cmpMeta.$flags$ & 64 /* formAssociated */ && flags & 1 /* isElementConstructor */) {
2012
2457
  FORM_ASSOCIATED_CUSTOM_ELEMENT_CALLBACKS.forEach((cbName) => {
2013
2458
  const originalFormAssociatedCallback = prototype[cbName];
2014
2459
  Object.defineProperty(prototype, cbName, {
2015
2460
  value(...args) {
2016
2461
  const hostRef = getHostRef(this);
2017
- const instance = BUILD19.lazyLoad ? hostRef.$lazyInstance$ : this;
2462
+ const instance = BUILD20.lazyLoad ? hostRef.$lazyInstance$ : this;
2018
2463
  if (!instance) {
2019
2464
  hostRef.$onReadyPromise$.then((asyncInstance) => {
2020
2465
  const cb = asyncInstance[cbName];
2021
2466
  typeof cb === "function" && cb.call(asyncInstance, ...args);
2022
2467
  });
2023
2468
  } else {
2024
- const cb = BUILD19.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
2469
+ const cb = BUILD20.lazyLoad ? instance[cbName] : originalFormAssociatedCallback;
2025
2470
  typeof cb === "function" && cb.call(instance, ...args);
2026
2471
  }
2027
2472
  }
2028
2473
  });
2029
2474
  });
2030
2475
  }
2031
- if (BUILD19.member && cmpMeta.$members$ || BUILD19.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
2032
- if (BUILD19.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
2476
+ if (BUILD20.member && cmpMeta.$members$ || BUILD20.watchCallback && (cmpMeta.$watchers$ || Cstr.watchers)) {
2477
+ if (BUILD20.watchCallback && Cstr.watchers && !cmpMeta.$watchers$) {
2033
2478
  cmpMeta.$watchers$ = Cstr.watchers;
2034
2479
  }
2035
2480
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
2036
2481
  members.map(([memberName, [memberFlags]]) => {
2037
- if ((BUILD19.prop || BUILD19.state) && (memberFlags & 31 /* Prop */ || (!BUILD19.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
2482
+ if ((BUILD20.prop || BUILD20.state) && (memberFlags & 31 /* Prop */ || (!BUILD20.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
2038
2483
  if ((memberFlags & 2048 /* Getter */) === 0) {
2039
2484
  Object.defineProperty(prototype, memberName, {
2040
2485
  get() {
2041
2486
  return getValue(this, memberName);
2042
2487
  },
2043
2488
  set(newValue) {
2044
- if (BUILD19.isDev) {
2489
+ if (BUILD20.isDev) {
2045
2490
  const ref = getHostRef(this);
2046
2491
  if (
2047
2492
  // we are proxying the instance (not element)
@@ -2062,11 +2507,11 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
2062
2507
  enumerable: true
2063
2508
  });
2064
2509
  } else if (flags & 1 /* isElementConstructor */ && memberFlags & 2048 /* Getter */) {
2065
- if (BUILD19.lazyLoad) {
2510
+ if (BUILD20.lazyLoad) {
2066
2511
  Object.defineProperty(prototype, memberName, {
2067
2512
  get() {
2068
2513
  const ref = getHostRef(this);
2069
- const instance = BUILD19.lazyLoad && ref ? ref.$lazyInstance$ : prototype;
2514
+ const instance = BUILD20.lazyLoad && ref ? ref.$lazyInstance$ : prototype;
2070
2515
  if (!instance) return;
2071
2516
  return instance[memberName];
2072
2517
  },
@@ -2106,7 +2551,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
2106
2551
  });
2107
2552
  }
2108
2553
  }
2109
- } else if (BUILD19.lazyLoad && BUILD19.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2554
+ } else if (BUILD20.lazyLoad && BUILD20.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
2110
2555
  Object.defineProperty(prototype, memberName, {
2111
2556
  value(...args) {
2112
2557
  var _a2;
@@ -2119,7 +2564,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
2119
2564
  });
2120
2565
  }
2121
2566
  });
2122
- if (BUILD19.observeAttribute && (!BUILD19.lazyLoad || flags & 1 /* isElementConstructor */)) {
2567
+ if (BUILD20.observeAttribute && (!BUILD20.lazyLoad || flags & 1 /* isElementConstructor */)) {
2123
2568
  const attrNameToPropName = /* @__PURE__ */ new Map();
2124
2569
  prototype.attributeChangedCallback = function(attrName, oldValue, newValue) {
2125
2570
  plt.jmp(() => {
@@ -2135,8 +2580,8 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
2135
2580
  const hostRef = getHostRef(this);
2136
2581
  const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
2137
2582
  if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
2138
- const elm = BUILD19.lazyLoad ? hostRef.$hostElement$ : this;
2139
- const instance = BUILD19.lazyLoad ? hostRef.$lazyInstance$ : elm;
2583
+ const elm = BUILD20.lazyLoad ? hostRef.$hostElement$ : this;
2584
+ const instance = BUILD20.lazyLoad ? hostRef.$lazyInstance$ : elm;
2140
2585
  const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
2141
2586
  entry == null ? void 0 : entry.forEach((callbackName) => {
2142
2587
  if (instance[callbackName] != null) {
@@ -2159,7 +2604,7 @@ More information: https://stenciljs.com/docs/properties#prop-mutability`
2159
2604
  var _a2;
2160
2605
  const attrName = m[1] || propName;
2161
2606
  attrNameToPropName.set(attrName, propName);
2162
- if (BUILD19.reflect && m[0] & 512 /* ReflectAttr */) {
2607
+ if (BUILD20.reflect && m[0] & 512 /* ReflectAttr */) {
2163
2608
  (_a2 = cmpMeta.$attrsToReflect$) == null ? void 0 : _a2.push([propName, attrName]);
2164
2609
  }
2165
2610
  return attrName;
@@ -2177,7 +2622,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2177
2622
  if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
2178
2623
  hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2179
2624
  const bundleId = cmpMeta.$lazyBundleId$;
2180
- if ((BUILD20.lazyLoad || BUILD20.hydrateClientSide) && bundleId) {
2625
+ if ((BUILD21.lazyLoad || BUILD21.hydrateClientSide) && bundleId) {
2181
2626
  const CstrImport = loadModule(cmpMeta, hostRef, hmrVersionId);
2182
2627
  if (CstrImport && "then" in CstrImport) {
2183
2628
  const endLoad = uniqueTime(
@@ -2192,442 +2637,174 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2192
2637
  if (!Cstr) {
2193
2638
  throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2194
2639
  }
2195
- if (BUILD20.member && !Cstr.isProxied) {
2196
- if (BUILD20.watchCallback) {
2640
+ if (BUILD21.member && !Cstr.isProxied) {
2641
+ if (BUILD21.watchCallback) {
2197
2642
  cmpMeta.$watchers$ = Cstr.watchers;
2198
2643
  }
2199
2644
  proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
2200
2645
  Cstr.isProxied = true;
2201
2646
  }
2202
2647
  const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
2203
- if (BUILD20.member) {
2204
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
2205
- }
2206
- try {
2207
- new Cstr(hostRef);
2208
- } catch (e) {
2209
- consoleError(e);
2210
- }
2211
- if (BUILD20.member) {
2212
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
2213
- }
2214
- if (BUILD20.watchCallback) {
2215
- hostRef.$flags$ |= 128 /* isWatchReady */;
2216
- }
2217
- endNewInstance();
2218
- fireConnectedCallback(hostRef.$lazyInstance$);
2219
- } else {
2220
- Cstr = elm.constructor;
2221
- const cmpTag = elm.localName;
2222
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
2223
- }
2224
- if (BUILD20.style && Cstr && Cstr.style) {
2225
- let style;
2226
- if (typeof Cstr.style === "string") {
2227
- style = Cstr.style;
2228
- } else if (BUILD20.mode && typeof Cstr.style !== "string") {
2229
- hostRef.$modeName$ = computeMode(elm);
2230
- if (hostRef.$modeName$) {
2231
- style = Cstr.style[hostRef.$modeName$];
2232
- }
2233
- if (BUILD20.hydrateServerSide && hostRef.$modeName$) {
2234
- elm.setAttribute("s-mode", hostRef.$modeName$);
2235
- }
2236
- }
2237
- const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
2238
- if (!styles.has(scopeId2)) {
2239
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
2240
- if (!BUILD20.hydrateServerSide && BUILD20.shadowDom && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2241
- BUILD20.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2242
- style = await import("./shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
2243
- }
2244
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2245
- endRegisterStyles();
2246
- }
2247
- }
2248
- }
2249
- const ancestorComponent = hostRef.$ancestorComponent$;
2250
- const schedule = () => scheduleUpdate(hostRef, true);
2251
- if (BUILD20.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
2252
- ancestorComponent["s-rc"].push(schedule);
2253
- } else {
2254
- schedule();
2255
- }
2256
- };
2257
- var fireConnectedCallback = (instance) => {
2258
- if (BUILD20.lazyLoad && BUILD20.connectedCallback) {
2259
- safeCall(instance, "connectedCallback");
2260
- }
2261
- };
2262
-
2263
- // src/runtime/connected-callback.ts
2264
- var connectedCallback = (elm) => {
2265
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2266
- const hostRef = getHostRef(elm);
2267
- const cmpMeta = hostRef.$cmpMeta$;
2268
- const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
2269
- if (BUILD21.hostListenerTargetParent) {
2270
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2271
- }
2272
- if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2273
- hostRef.$flags$ |= 1 /* hasConnected */;
2274
- let hostId;
2275
- if (BUILD21.hydrateClientSide) {
2276
- hostId = elm.getAttribute(HYDRATE_ID);
2277
- if (hostId) {
2278
- if (BUILD21.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2279
- const scopeId2 = BUILD21.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
2280
- elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
2281
- }
2282
- initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2283
- }
2284
- }
2285
- if (BUILD21.slotRelocation && !hostId) {
2286
- if (BUILD21.hydrateServerSide || (BUILD21.slot || BUILD21.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2287
- cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
2288
- setContentReference(elm);
2289
- }
2290
- }
2291
- if (BUILD21.asyncLoading) {
2292
- let ancestorComponent = elm;
2293
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
2294
- if (BUILD21.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
2295
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
2296
- break;
2297
- }
2298
- }
2299
- }
2300
- if (BUILD21.prop && !BUILD21.hydrateServerSide && cmpMeta.$members$) {
2301
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2302
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2303
- const value = elm[memberName];
2304
- delete elm[memberName];
2305
- elm[memberName] = value;
2306
- }
2307
- });
2308
- }
2309
- if (BUILD21.initializeNextTick) {
2310
- nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2311
- } else {
2312
- initializeComponent(elm, hostRef, cmpMeta);
2313
- }
2314
- } else {
2315
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2316
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2317
- fireConnectedCallback(hostRef.$lazyInstance$);
2318
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2319
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
2320
- }
2321
- }
2322
- endConnected();
2323
- }
2324
- };
2325
- var setContentReference = (elm) => {
2326
- const contentRefElm = elm["s-cr"] = doc.createComment(
2327
- BUILD21.isDebug ? `content-ref (host=${elm.localName})` : ""
2328
- );
2329
- contentRefElm["s-cn"] = true;
2330
- insertBefore(elm, contentRefElm, elm.firstChild);
2331
- };
2332
-
2333
- // src/runtime/disconnected-callback.ts
2334
- import { BUILD as BUILD22 } from "@stencil/core/internal/app-data";
2335
- var disconnectInstance = (instance) => {
2336
- if (BUILD22.lazyLoad && BUILD22.disconnectedCallback) {
2337
- safeCall(instance, "disconnectedCallback");
2338
- }
2339
- if (BUILD22.cmpDidUnload) {
2340
- safeCall(instance, "componentDidUnload");
2341
- }
2342
- };
2343
- var disconnectedCallback = async (elm) => {
2344
- if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2345
- const hostRef = getHostRef(elm);
2346
- if (BUILD22.hostListener) {
2347
- if (hostRef.$rmListeners$) {
2348
- hostRef.$rmListeners$.map((rmListener) => rmListener());
2349
- hostRef.$rmListeners$ = void 0;
2350
- }
2351
- }
2352
- if (!BUILD22.lazyLoad) {
2353
- disconnectInstance(elm);
2354
- } else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2355
- disconnectInstance(hostRef.$lazyInstance$);
2356
- } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2357
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2358
- }
2359
- }
2360
- };
2361
-
2362
- // src/runtime/dom-extras.ts
2363
- import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
2364
- var patchPseudoShadowDom = (hostElementPrototype) => {
2365
- patchCloneNode(hostElementPrototype);
2366
- patchSlotAppendChild(hostElementPrototype);
2367
- patchSlotAppend(hostElementPrototype);
2368
- patchSlotPrepend(hostElementPrototype);
2369
- patchSlotInsertAdjacentElement(hostElementPrototype);
2370
- patchSlotInsertAdjacentHTML(hostElementPrototype);
2371
- patchSlotInsertAdjacentText(hostElementPrototype);
2372
- patchTextContent(hostElementPrototype);
2373
- patchChildSlotNodes(hostElementPrototype);
2374
- patchSlotRemoveChild(hostElementPrototype);
2375
- };
2376
- var patchCloneNode = (HostElementPrototype) => {
2377
- const orgCloneNode = HostElementPrototype.cloneNode;
2378
- HostElementPrototype.cloneNode = function(deep) {
2379
- const srcNode = this;
2380
- const isShadowDom = BUILD23.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
2381
- const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
2382
- if (BUILD23.slot && !isShadowDom && deep) {
2383
- let i2 = 0;
2384
- let slotted, nonStencilNode;
2385
- const stencilPrivates = [
2386
- "s-id",
2387
- "s-cr",
2388
- "s-lr",
2389
- "s-rc",
2390
- "s-sc",
2391
- "s-p",
2392
- "s-cn",
2393
- "s-sr",
2394
- "s-sn",
2395
- "s-hn",
2396
- "s-ol",
2397
- "s-nr",
2398
- "s-si",
2399
- "s-rf",
2400
- "s-scs"
2401
- ];
2402
- const childNodes = this.__childNodes || this.childNodes;
2403
- for (; i2 < childNodes.length; i2++) {
2404
- slotted = childNodes[i2]["s-nr"];
2405
- nonStencilNode = stencilPrivates.every((privateField) => !childNodes[i2][privateField]);
2406
- if (slotted) {
2407
- if (BUILD23.appendChildSlotFix && clonedNode.__appendChild) {
2408
- clonedNode.__appendChild(slotted.cloneNode(true));
2409
- } else {
2410
- clonedNode.appendChild(slotted.cloneNode(true));
2411
- }
2412
- }
2413
- if (nonStencilNode) {
2414
- clonedNode.appendChild(childNodes[i2].cloneNode(true));
2415
- }
2416
- }
2417
- }
2418
- return clonedNode;
2419
- };
2420
- };
2421
- var patchSlotAppendChild = (HostElementPrototype) => {
2422
- HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
2423
- HostElementPrototype.appendChild = function(newChild) {
2424
- const slotName = newChild["s-sn"] = getSlotName(newChild);
2425
- const slotNode = getHostSlotNode(this.__childNodes || this.childNodes, slotName, this.tagName);
2426
- if (slotNode) {
2427
- addSlotRelocateNode(newChild, slotNode);
2428
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2429
- const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2430
- const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
2431
- updateFallbackSlotVisibility(this);
2432
- return insertedNode;
2433
- }
2434
- return this.__appendChild(newChild);
2435
- };
2436
- };
2437
- var patchSlotRemoveChild = (ElementPrototype) => {
2438
- ElementPrototype.__removeChild = ElementPrototype.removeChild;
2439
- ElementPrototype.removeChild = function(toRemove) {
2440
- if (toRemove && typeof toRemove["s-sn"] !== "undefined") {
2441
- const childNodes = this.__childNodes || this.childNodes;
2442
- const slotNode = getHostSlotNode(childNodes, toRemove["s-sn"], this.tagName);
2443
- if (slotNode && toRemove.isConnected) {
2444
- toRemove.remove();
2445
- updateFallbackSlotVisibility(this);
2446
- return;
2447
- }
2448
- }
2449
- return this.__removeChild(toRemove);
2450
- };
2451
- };
2452
- var patchSlotPrepend = (HostElementPrototype) => {
2453
- HostElementPrototype.__prepend = HostElementPrototype.prepend;
2454
- HostElementPrototype.prepend = function(...newChildren) {
2455
- newChildren.forEach((newChild) => {
2456
- if (typeof newChild === "string") {
2457
- newChild = this.ownerDocument.createTextNode(newChild);
2458
- }
2459
- const slotName = newChild["s-sn"] = getSlotName(newChild);
2460
- const childNodes = this.__childNodes || this.childNodes;
2461
- const slotNode = getHostSlotNode(childNodes, slotName, this.tagName);
2462
- if (slotNode) {
2463
- addSlotRelocateNode(newChild, slotNode, true);
2464
- const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2465
- const appendAfter = slotChildNodes[0];
2466
- return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
2648
+ if (BUILD21.member) {
2649
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
2467
2650
  }
2468
- if (newChild.nodeType === 1 && !!newChild.getAttribute("slot")) {
2469
- newChild.hidden = true;
2651
+ try {
2652
+ new Cstr(hostRef);
2653
+ } catch (e) {
2654
+ consoleError(e);
2470
2655
  }
2471
- return HostElementPrototype.__prepend(newChild);
2472
- });
2473
- };
2474
- };
2475
- var patchSlotAppend = (HostElementPrototype) => {
2476
- HostElementPrototype.__append = HostElementPrototype.append;
2477
- HostElementPrototype.append = function(...newChildren) {
2478
- newChildren.forEach((newChild) => {
2479
- if (typeof newChild === "string") {
2480
- newChild = this.ownerDocument.createTextNode(newChild);
2656
+ if (BUILD21.member) {
2657
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
2481
2658
  }
2482
- this.appendChild(newChild);
2483
- });
2484
- };
2485
- };
2486
- var patchSlotInsertAdjacentHTML = (HostElementPrototype) => {
2487
- const originalInsertAdjacentHtml = HostElementPrototype.insertAdjacentHTML;
2488
- HostElementPrototype.insertAdjacentHTML = function(position, text) {
2489
- if (position !== "afterbegin" && position !== "beforeend") {
2490
- return originalInsertAdjacentHtml.call(this, position, text);
2659
+ if (BUILD21.watchCallback) {
2660
+ hostRef.$flags$ |= 128 /* isWatchReady */;
2661
+ }
2662
+ endNewInstance();
2663
+ fireConnectedCallback(hostRef.$lazyInstance$);
2664
+ } else {
2665
+ Cstr = elm.constructor;
2666
+ const cmpTag = elm.localName;
2667
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
2491
2668
  }
2492
- const container = this.ownerDocument.createElement("_");
2493
- let node;
2494
- container.innerHTML = text;
2495
- if (position === "afterbegin") {
2496
- while (node = container.firstChild) {
2497
- this.prepend(node);
2669
+ if (BUILD21.style && Cstr && Cstr.style) {
2670
+ let style;
2671
+ if (typeof Cstr.style === "string") {
2672
+ style = Cstr.style;
2673
+ } else if (BUILD21.mode && typeof Cstr.style !== "string") {
2674
+ hostRef.$modeName$ = computeMode(elm);
2675
+ if (hostRef.$modeName$) {
2676
+ style = Cstr.style[hostRef.$modeName$];
2677
+ }
2678
+ if (BUILD21.hydrateServerSide && hostRef.$modeName$) {
2679
+ elm.setAttribute("s-mode", hostRef.$modeName$);
2680
+ }
2498
2681
  }
2499
- } else if (position === "beforeend") {
2500
- while (node = container.firstChild) {
2501
- this.append(node);
2682
+ const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
2683
+ if (!styles.has(scopeId2)) {
2684
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
2685
+ if (!BUILD21.hydrateServerSide && BUILD21.shadowDom && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2686
+ BUILD21.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2687
+ style = await import("./shadow-css.js").then((m) => m.scopeCss(style, scopeId2));
2688
+ }
2689
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2690
+ endRegisterStyles();
2502
2691
  }
2503
2692
  }
2504
- };
2505
- };
2506
- var patchSlotInsertAdjacentText = (HostElementPrototype) => {
2507
- HostElementPrototype.insertAdjacentText = function(position, text) {
2508
- this.insertAdjacentHTML(position, text);
2509
- };
2510
- };
2511
- var patchSlotInsertAdjacentElement = (HostElementPrototype) => {
2512
- const originalInsertAdjacentElement = HostElementPrototype.insertAdjacentElement;
2513
- HostElementPrototype.insertAdjacentElement = function(position, element) {
2514
- if (position !== "afterbegin" && position !== "beforeend") {
2515
- return originalInsertAdjacentElement.call(this, position, element);
2516
- }
2517
- if (position === "afterbegin") {
2518
- this.prepend(element);
2519
- return element;
2520
- } else if (position === "beforeend") {
2521
- this.append(element);
2522
- return element;
2523
- }
2524
- return element;
2525
- };
2526
- };
2527
- var patchTextContent = (hostElementPrototype) => {
2528
- let descriptor = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "textContent");
2529
- if (!descriptor) {
2530
- descriptor = Object.getOwnPropertyDescriptor(hostElementPrototype, "textContent");
2531
2693
  }
2532
- if (descriptor) Object.defineProperty(hostElementPrototype, "__textContent", descriptor);
2533
- Object.defineProperty(hostElementPrototype, "textContent", {
2534
- get: function() {
2535
- let text = "";
2536
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
2537
- childNodes.forEach((node) => text += node.textContent || "");
2538
- return text;
2539
- },
2540
- set: function(value) {
2541
- const childNodes = this.__childNodes ? this.childNodes : getSlottedChildNodes(this.childNodes);
2542
- childNodes.forEach((node) => {
2543
- if (node["s-ol"]) node["s-ol"].remove();
2544
- node.remove();
2545
- });
2546
- this.insertAdjacentHTML("beforeend", value);
2547
- }
2548
- });
2549
- };
2550
- var patchChildSlotNodes = (elm) => {
2551
- class FakeNodeList extends Array {
2552
- item(n) {
2553
- return this[n];
2554
- }
2694
+ const ancestorComponent = hostRef.$ancestorComponent$;
2695
+ const schedule = () => scheduleUpdate(hostRef, true);
2696
+ if (BUILD21.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
2697
+ ancestorComponent["s-rc"].push(schedule);
2698
+ } else {
2699
+ schedule();
2555
2700
  }
2556
- let childNodesFn = globalThis.Node && Object.getOwnPropertyDescriptor(Node.prototype, "childNodes");
2557
- if (!childNodesFn) {
2558
- childNodesFn = Object.getOwnPropertyDescriptor(elm, "childNodes");
2701
+ };
2702
+ var fireConnectedCallback = (instance) => {
2703
+ if (BUILD21.lazyLoad && BUILD21.connectedCallback) {
2704
+ safeCall(instance, "connectedCallback");
2559
2705
  }
2560
- if (childNodesFn) Object.defineProperty(elm, "__childNodes", childNodesFn);
2561
- Object.defineProperty(elm, "children", {
2562
- get() {
2563
- return this.childNodes.filter((n) => n.nodeType === 1);
2564
- }
2565
- });
2566
- Object.defineProperty(elm, "childElementCount", {
2567
- get() {
2568
- return this.children.length;
2706
+ };
2707
+
2708
+ // src/runtime/connected-callback.ts
2709
+ var connectedCallback = (elm) => {
2710
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2711
+ const hostRef = getHostRef(elm);
2712
+ const cmpMeta = hostRef.$cmpMeta$;
2713
+ const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
2714
+ if (BUILD22.hostListenerTargetParent) {
2715
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2569
2716
  }
2570
- });
2571
- if (!childNodesFn) return;
2572
- Object.defineProperty(elm, "childNodes", {
2573
- get() {
2574
- var _a, _b;
2575
- 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 */) {
2576
- const result = new FakeNodeList();
2577
- const nodes = getSlottedChildNodes(this.__childNodes);
2578
- result.push(...nodes);
2579
- return result;
2717
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2718
+ hostRef.$flags$ |= 1 /* hasConnected */;
2719
+ let hostId;
2720
+ if (BUILD22.hydrateClientSide) {
2721
+ hostId = elm.getAttribute(HYDRATE_ID);
2722
+ if (hostId) {
2723
+ if (BUILD22.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2724
+ const scopeId2 = BUILD22.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
2725
+ elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
2726
+ } else if (BUILD22.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
2727
+ const scopeId2 = getScopeId(cmpMeta, BUILD22.mode ? elm.getAttribute("s-mode") : void 0);
2728
+ elm["s-sc"] = scopeId2;
2729
+ }
2730
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2731
+ }
2732
+ }
2733
+ if (BUILD22.slotRelocation && !hostId) {
2734
+ if (BUILD22.hydrateServerSide || (BUILD22.slot || BUILD22.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2735
+ cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
2736
+ setContentReference(elm);
2737
+ }
2738
+ }
2739
+ if (BUILD22.asyncLoading) {
2740
+ let ancestorComponent = elm;
2741
+ while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
2742
+ if (BUILD22.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
2743
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
2744
+ break;
2745
+ }
2746
+ }
2747
+ }
2748
+ if (BUILD22.prop && !BUILD22.hydrateServerSide && cmpMeta.$members$) {
2749
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2750
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2751
+ const value = elm[memberName];
2752
+ delete elm[memberName];
2753
+ elm[memberName] = value;
2754
+ }
2755
+ });
2756
+ }
2757
+ if (BUILD22.initializeNextTick) {
2758
+ nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2759
+ } else {
2760
+ initializeComponent(elm, hostRef, cmpMeta);
2761
+ }
2762
+ } else {
2763
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2764
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2765
+ fireConnectedCallback(hostRef.$lazyInstance$);
2766
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2767
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$));
2580
2768
  }
2581
- return FakeNodeList.from(this.__childNodes);
2582
2769
  }
2583
- });
2584
- };
2585
- var addSlotRelocateNode = (newChild, slotNode, prepend) => {
2586
- let slottedNodeLocation;
2587
- if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
2588
- slottedNodeLocation = newChild["s-ol"];
2589
- } else {
2590
- slottedNodeLocation = document.createTextNode("");
2591
- slottedNodeLocation["s-nr"] = newChild;
2770
+ endConnected();
2592
2771
  }
2593
- const parent = slotNode["s-cr"].parentNode;
2594
- const appendMethod = prepend ? parent.__prepend : parent.__appendChild;
2595
- newChild["s-ol"] = slottedNodeLocation;
2596
- newChild["s-sh"] = slotNode["s-hn"];
2597
- appendMethod.call(parent, slottedNodeLocation);
2598
2772
  };
2599
- var getSlottedChildNodes = (childNodes) => {
2600
- const result = [];
2601
- for (let i2 = 0; i2 < childNodes.length; i2++) {
2602
- const slottedNode = childNodes[i2]["s-nr"];
2603
- if (slottedNode && slottedNode.isConnected) {
2604
- result.push(slottedNode);
2605
- }
2773
+ var setContentReference = (elm) => {
2774
+ const contentRefElm = elm["s-cr"] = doc.createComment(
2775
+ BUILD22.isDebug ? `content-ref (host=${elm.localName})` : ""
2776
+ );
2777
+ contentRefElm["s-cn"] = true;
2778
+ insertBefore(elm, contentRefElm, elm.firstChild);
2779
+ };
2780
+
2781
+ // src/runtime/disconnected-callback.ts
2782
+ import { BUILD as BUILD23 } from "@stencil/core/internal/app-data";
2783
+ var disconnectInstance = (instance) => {
2784
+ if (BUILD23.lazyLoad && BUILD23.disconnectedCallback) {
2785
+ safeCall(instance, "disconnectedCallback");
2786
+ }
2787
+ if (BUILD23.cmpDidUnload) {
2788
+ safeCall(instance, "componentDidUnload");
2606
2789
  }
2607
- return result;
2608
2790
  };
2609
- var getSlotName = (node) => node["s-sn"] || node.nodeType === 1 && node.getAttribute("slot") || "";
2610
- var getHostSlotNode = (childNodes, slotName, hostName) => {
2611
- let i2 = 0;
2612
- let childNode;
2613
- for (; i2 < childNodes.length; i2++) {
2614
- childNode = childNodes[i2];
2615
- if (childNode["s-sr"] && childNode["s-sn"] === slotName && childNode["s-hn"] === hostName) {
2616
- return childNode;
2791
+ var disconnectedCallback = async (elm) => {
2792
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2793
+ const hostRef = getHostRef(elm);
2794
+ if (BUILD23.hostListener) {
2795
+ if (hostRef.$rmListeners$) {
2796
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
2797
+ hostRef.$rmListeners$ = void 0;
2798
+ }
2617
2799
  }
2618
- childNode = getHostSlotNode(childNode.childNodes, slotName, hostName);
2619
- if (childNode) {
2620
- return childNode;
2800
+ if (!BUILD23.lazyLoad) {
2801
+ disconnectInstance(elm);
2802
+ } else if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2803
+ disconnectInstance(hostRef.$lazyInstance$);
2804
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2805
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2621
2806
  }
2622
2807
  }
2623
- return null;
2624
- };
2625
- var getHostSlotChildNodes = (n, slotName) => {
2626
- const childNodes = [n];
2627
- while ((n = n.nextSibling) && n["s-sn"] === slotName) {
2628
- childNodes.push(n);
2629
- }
2630
- return childNodes;
2631
2808
  };
2632
2809
 
2633
2810
  // src/runtime/bootstrap-custom-element.ts
@@ -3008,6 +3185,9 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
3008
3185
  childId = `${hostId}.${nodeId}`;
3009
3186
  if (nodeRef.nodeType === 1 /* ElementNode */) {
3010
3187
  nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
3188
+ if (typeof nodeRef["s-sn"] === "string" && !nodeRef.getAttribute("slot")) {
3189
+ nodeRef.setAttribute("s-sn", nodeRef["s-sn"]);
3190
+ }
3011
3191
  } else if (nodeRef.nodeType === 3 /* TextNode */) {
3012
3192
  if (hostId === 0) {
3013
3193
  const textContent = (_a = nodeRef.nodeValue) == null ? void 0 : _a.trim();
@@ -3019,6 +3199,10 @@ var insertVdomAnnotations = (doc2, staticComponents) => {
3019
3199
  const commentBeforeTextNode = doc2.createComment(childId);
3020
3200
  commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
3021
3201
  insertBefore(nodeRef.parentNode, commentBeforeTextNode, nodeRef);
3202
+ } else if (nodeRef.nodeType === 8 /* CommentNode */) {
3203
+ const commentBeforeTextNode = doc2.createComment(childId);
3204
+ commentBeforeTextNode.nodeValue = `${COMMENT_NODE_ID}.${childId}`;
3205
+ nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
3022
3206
  }
3023
3207
  }
3024
3208
  let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
@@ -3099,6 +3283,9 @@ var insertChildVNodeAnnotations = (doc2, vnodeChild, cmpData, hostId, depth, ind
3099
3283
  childElm["s-node-id"] = nodeId;
3100
3284
  if (childElm.nodeType === 1 /* ElementNode */) {
3101
3285
  childElm.setAttribute(HYDRATE_CHILD_ID, childId);
3286
+ if (typeof childElm["s-sn"] === "string" && !childElm.getAttribute("slot")) {
3287
+ childElm.setAttribute("s-sn", childElm["s-sn"]);
3288
+ }
3102
3289
  } else if (childElm.nodeType === 3 /* TextNode */) {
3103
3290
  const parentNode = childElm.parentNode;
3104
3291
  const nodeName = parentNode == null ? void 0 : parentNode.nodeName;