@devschile/chucao 1.5.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/dist/chucao/chucao.esm.js +1 -1
  2. package/dist/chucao/{p-061ffcf3.entry.js → p-175aee94.entry.js} +2 -2
  3. package/dist/chucao/{p-c0c5522f.entry.js → p-85a49fd7.entry.js} +2 -2
  4. package/dist/chucao/p-ImsAHlk9.js +3 -0
  5. package/dist/chucao/p-ImsAHlk9.js.map +1 -0
  6. package/dist/chucao/{p-117c93d3.entry.js → p-af2c57b5.entry.js} +2 -2
  7. package/dist/chucao/{p-fa56821f.entry.js → p-b4520f1c.entry.js} +2 -2
  8. package/dist/chucao/{p-14d8a79c.entry.js → p-d75eeeea.entry.js} +2 -2
  9. package/dist/chucao/{p-b07c23e1.entry.js → p-dde82d7d.entry.js} +2 -2
  10. package/dist/chucao/{p-bb82aaf8.entry.js → p-fcc70c8d.entry.js} +2 -2
  11. package/dist/chucao/{p-c1edf460.entry.js → p-fe0c9320.entry.js} +2 -2
  12. package/dist/cjs/ch-accordion.cjs.entry.js +1 -1
  13. package/dist/cjs/ch-badge_6.cjs.entry.js +1 -1
  14. package/dist/cjs/ch-checkbox.cjs.entry.js +1 -1
  15. package/dist/cjs/ch-divider.cjs.entry.js +1 -1
  16. package/dist/cjs/ch-link.cjs.entry.js +1 -1
  17. package/dist/cjs/ch-radio.cjs.entry.js +1 -1
  18. package/dist/cjs/ch-tabs.cjs.entry.js +1 -1
  19. package/dist/cjs/ch-textarea.cjs.entry.js +1 -1
  20. package/dist/cjs/chucao.cjs.js +1 -1
  21. package/dist/cjs/{index-D7ZSLrHc.js → index-CiYvuUBV.js} +679 -9
  22. package/dist/cjs/index-CiYvuUBV.js.map +1 -0
  23. package/dist/cjs/loader.cjs.js +1 -1
  24. package/dist/components/ch-accordion.js +1 -1
  25. package/dist/components/ch-badge.js +1 -1
  26. package/dist/components/ch-button.js +1 -1
  27. package/dist/components/ch-card.js +1 -1
  28. package/dist/components/ch-checkbox.js +1 -1
  29. package/dist/components/ch-divider.js +1 -1
  30. package/dist/components/ch-input.js +1 -1
  31. package/dist/components/ch-link.js +1 -1
  32. package/dist/components/ch-radio.js +1 -1
  33. package/dist/components/ch-select.js +1 -1
  34. package/dist/components/ch-switch.js +1 -1
  35. package/dist/components/ch-tabs.js +1 -1
  36. package/dist/components/ch-textarea.js +1 -1
  37. package/dist/components/index.js +1 -1
  38. package/dist/components/p-x4aZoujY.js +2 -0
  39. package/dist/components/p-x4aZoujY.js.map +1 -0
  40. package/dist/esm/ch-accordion.entry.js +1 -1
  41. package/dist/esm/ch-badge_6.entry.js +1 -1
  42. package/dist/esm/ch-checkbox.entry.js +1 -1
  43. package/dist/esm/ch-divider.entry.js +1 -1
  44. package/dist/esm/ch-link.entry.js +1 -1
  45. package/dist/esm/ch-radio.entry.js +1 -1
  46. package/dist/esm/ch-tabs.entry.js +1 -1
  47. package/dist/esm/ch-textarea.entry.js +1 -1
  48. package/dist/esm/chucao.js +2 -2
  49. package/dist/esm/{index-B0AkgfgP.js → index-ImsAHlk9.js} +679 -9
  50. package/dist/esm/index-ImsAHlk9.js.map +1 -0
  51. package/dist/esm/loader.js +2 -2
  52. package/hydrate/index.d.ts +287 -0
  53. package/hydrate/index.js +24283 -0
  54. package/hydrate/index.mjs +24273 -0
  55. package/hydrate/package.json +12 -0
  56. package/package.json +7 -1
  57. package/dist/chucao/p-B0AkgfgP.js +0 -3
  58. package/dist/chucao/p-B0AkgfgP.js.map +0 -1
  59. package/dist/cjs/index-D7ZSLrHc.js.map +0 -1
  60. package/dist/components/p-W-iJXblk.js +0 -2
  61. package/dist/components/p-W-iJXblk.js.map +0 -1
  62. package/dist/esm/index-B0AkgfgP.js.map +0 -1
  63. /package/dist/chucao/{p-061ffcf3.entry.js.map → p-175aee94.entry.js.map} +0 -0
  64. /package/dist/chucao/{p-c0c5522f.entry.js.map → p-85a49fd7.entry.js.map} +0 -0
  65. /package/dist/chucao/{p-117c93d3.entry.js.map → p-af2c57b5.entry.js.map} +0 -0
  66. /package/dist/chucao/{p-fa56821f.entry.js.map → p-b4520f1c.entry.js.map} +0 -0
  67. /package/dist/chucao/{p-14d8a79c.entry.js.map → p-d75eeeea.entry.js.map} +0 -0
  68. /package/dist/chucao/{p-b07c23e1.entry.js.map → p-dde82d7d.entry.js.map} +0 -0
  69. /package/dist/chucao/{p-bb82aaf8.entry.js.map → p-fcc70c8d.entry.js.map} +0 -0
  70. /package/dist/chucao/{p-c1edf460.entry.js.map → p-fe0c9320.entry.js.map} +0 -0
@@ -10,6 +10,30 @@ const globalStyles = ":root{--color-background-base:#100a1c;--color-background-t
10
10
  Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
11
11
  */
12
12
 
13
+ var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
14
+ PrimitiveType2["Undefined"] = "undefined";
15
+ PrimitiveType2["Null"] = "null";
16
+ PrimitiveType2["String"] = "string";
17
+ PrimitiveType2["Number"] = "number";
18
+ PrimitiveType2["SpecialNumber"] = "number";
19
+ PrimitiveType2["Boolean"] = "boolean";
20
+ PrimitiveType2["BigInt"] = "bigint";
21
+ return PrimitiveType2;
22
+ })(PrimitiveType || {});
23
+ var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
24
+ NonPrimitiveType2["Array"] = "array";
25
+ NonPrimitiveType2["Date"] = "date";
26
+ NonPrimitiveType2["Map"] = "map";
27
+ NonPrimitiveType2["Object"] = "object";
28
+ NonPrimitiveType2["RegularExpression"] = "regexp";
29
+ NonPrimitiveType2["Set"] = "set";
30
+ NonPrimitiveType2["Channel"] = "channel";
31
+ NonPrimitiveType2["Symbol"] = "symbol";
32
+ return NonPrimitiveType2;
33
+ })(NonPrimitiveType || {});
34
+ var TYPE_CONSTANT = "type";
35
+ var VALUE_CONSTANT = "value";
36
+ var SERIALIZED_PREFIX = "serialized:";
13
37
 
14
38
  // src/utils/get-prop-descriptor.ts
15
39
  function getPropertyDescriptor(obj, memberName, getOnly) {
@@ -124,6 +148,16 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
124
148
 
125
149
  // src/client/client-style.ts
126
150
  var styles = /* @__PURE__ */ new Map();
151
+
152
+ // src/runtime/runtime-constants.ts
153
+ var CONTENT_REF_ID = "r";
154
+ var ORG_LOCATION_ID = "o";
155
+ var SLOT_NODE_ID = "s";
156
+ var TEXT_NODE_ID = "t";
157
+ var COMMENT_NODE_ID = "c";
158
+ var HYDRATE_ID = "s-id";
159
+ var HYDRATED_STYLE_ID = "sty-id";
160
+ var HYDRATE_CHILD_ID = "c-id";
127
161
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
128
162
  var win = typeof window !== "undefined" ? window : {};
129
163
  var plt = {
@@ -211,6 +245,82 @@ function createShadowRoot(cmpMeta) {
211
245
  shadowRoot.prepend(styleElm);
212
246
  }
213
247
  }
248
+ var getSlottedChildNodes = (childNodes) => {
249
+ const result = [];
250
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
251
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
252
+ if (slottedNode && slottedNode.isConnected) {
253
+ result.push(slottedNode);
254
+ }
255
+ }
256
+ return result;
257
+ };
258
+ var addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
259
+ if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
260
+ return;
261
+ }
262
+ const slottedNodeLocation = document.createTextNode("");
263
+ slottedNodeLocation["s-nr"] = newChild;
264
+ if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
265
+ const parent = slotNode["s-cr"].parentNode;
266
+ const appendMethod = internalCall(parent, "appendChild");
267
+ if (typeof position !== "undefined") {
268
+ slottedNodeLocation["s-oo"] = position;
269
+ const childNodes = internalCall(parent, "childNodes");
270
+ const slotRelocateNodes = [slottedNodeLocation];
271
+ childNodes.forEach((n) => {
272
+ if (n["s-nr"]) slotRelocateNodes.push(n);
273
+ });
274
+ slotRelocateNodes.sort((a, b) => {
275
+ if (!a["s-oo"] || a["s-oo"] < (b["s-oo"] || 0)) return -1;
276
+ else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1;
277
+ return 0;
278
+ });
279
+ slotRelocateNodes.forEach((n) => appendMethod.call(parent, n));
280
+ } else {
281
+ appendMethod.call(parent, slottedNodeLocation);
282
+ }
283
+ newChild["s-ol"] = slottedNodeLocation;
284
+ newChild["s-sh"] = slotNode["s-hn"];
285
+ };
286
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
287
+ function patchSlotNode(node) {
288
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
289
+ const assignedFactory = (elementsOnly) => (function(opts) {
290
+ const toReturn = [];
291
+ const slotName = this["s-sn"];
292
+ if (opts == null ? void 0 : opts.flatten) {
293
+ console.error(`
294
+ Flattening is not supported for Stencil non-shadow slots.
295
+ You can use \`.childNodes\` to nested slot fallback content.
296
+ If you have a particular use case, please open an issue on the Stencil repo.
297
+ `);
298
+ }
299
+ const parent = this["s-cr"].parentElement;
300
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
301
+ slottedNodes.forEach((n) => {
302
+ if (slotName === getSlotName(n)) {
303
+ toReturn.push(n);
304
+ }
305
+ });
306
+ if (elementsOnly) {
307
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
308
+ }
309
+ return toReturn;
310
+ }).bind(node);
311
+ node.assignedElements = assignedFactory(true);
312
+ node.assignedNodes = assignedFactory(false);
313
+ }
314
+ function internalCall(node, method) {
315
+ if ("__" + method in node) {
316
+ const toReturn = node["__" + method];
317
+ if (typeof toReturn !== "function") return toReturn;
318
+ return toReturn.bind(node);
319
+ } else {
320
+ if (typeof node[method] !== "function") return node[method];
321
+ return node[method].bind(node);
322
+ }
323
+ }
214
324
  var createTime = (fnName, tagName = "") => {
215
325
  {
216
326
  return () => {
@@ -264,7 +374,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
264
374
  if (!appliedStyles) {
265
375
  rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
266
376
  }
267
- if (!appliedStyles.has(scopeId2)) {
377
+ const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
378
+ if (existingStyleElm) {
379
+ existingStyleElm.textContent = style;
380
+ } else if (!appliedStyles.has(scopeId2)) {
268
381
  styleElm = win.document.createElement("style");
269
382
  styleElm.textContent = style;
270
383
  const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
@@ -333,6 +446,12 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
333
446
  styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
334
447
  }
335
448
  appliedStyles.add(scopeId2);
449
+ if ("host" in styleContainerNode) {
450
+ const ssrStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
451
+ if (ssrStyleElm) {
452
+ writeTask(() => ssrStyleElm.remove());
453
+ }
454
+ }
336
455
  }
337
456
  }
338
457
  }
@@ -353,6 +472,17 @@ var attachStyles = (hostRef) => {
353
472
  endAttachStyles();
354
473
  };
355
474
  var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
475
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
476
+ var hydrateScopedToShadow = () => {
477
+ if (!win.document) {
478
+ return;
479
+ }
480
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
481
+ let i2 = 0;
482
+ for (; i2 < styles2.length; i2++) {
483
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
484
+ }
485
+ };
356
486
  var isComplexType = (o) => {
357
487
  o = typeof o;
358
488
  return o === "object" || o === "function";
@@ -428,8 +558,511 @@ var newVNode = (tag, text) => {
428
558
  var Host = {};
429
559
  var isHost = (node) => node && node.$tag$ === Host;
430
560
 
561
+ // src/runtime/client-hydrate.ts
562
+ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
563
+ var _a, _b, _c, _d;
564
+ const endHydrate = createTime("hydrateClient", tagName);
565
+ const shadowRoot = hostElm.shadowRoot;
566
+ const childRenderNodes = [];
567
+ const slotNodes = [];
568
+ const slottedNodes = [];
569
+ const shadowRootNodes = shadowRoot ? [] : null;
570
+ const vnode = newVNode(tagName, null);
571
+ vnode.$elm$ = hostElm;
572
+ if (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
573
+ initializeDocumentHydrate(win.document.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map());
574
+ }
575
+ hostElm[HYDRATE_ID] = hostId;
576
+ hostElm.removeAttribute(HYDRATE_ID);
577
+ hostRef.$vnode$ = clientHydrate(
578
+ vnode,
579
+ childRenderNodes,
580
+ slotNodes,
581
+ shadowRootNodes,
582
+ hostElm,
583
+ hostElm,
584
+ hostId,
585
+ slottedNodes
586
+ );
587
+ let crIndex = 0;
588
+ const crLength = childRenderNodes.length;
589
+ let childRenderNode;
590
+ for (crIndex; crIndex < crLength; crIndex++) {
591
+ childRenderNode = childRenderNodes[crIndex];
592
+ const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$;
593
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
594
+ const node = childRenderNode.$elm$;
595
+ if (!shadowRoot) {
596
+ node["s-hn"] = transformTag(tagName).toUpperCase();
597
+ if (childRenderNode.$tag$ === "slot") {
598
+ node["s-cr"] = hostElm["s-cr"];
599
+ }
600
+ } else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
601
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
602
+ if (cmpMeta) {
603
+ const scopeId3 = getScopeId(
604
+ cmpMeta.$cmpMeta$);
605
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
606
+ if (styleSheet) {
607
+ shadowRootNodes.unshift(styleSheet.cloneNode(true));
608
+ }
609
+ }
610
+ }
611
+ if (childRenderNode.$tag$ === "slot") {
612
+ childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
613
+ if (childRenderNode.$children$) {
614
+ childRenderNode.$flags$ |= 2 /* isSlotFallback */;
615
+ if (!childRenderNode.$elm$.childNodes.length) {
616
+ childRenderNode.$children$.forEach((c) => {
617
+ childRenderNode.$elm$.appendChild(c.$elm$);
618
+ });
619
+ }
620
+ } else {
621
+ childRenderNode.$flags$ |= 1 /* isSlotReference */;
622
+ }
623
+ }
624
+ if (orgLocationNode && orgLocationNode.isConnected) {
625
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
626
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
627
+ }
628
+ orgLocationNode.parentNode.removeChild(orgLocationNode);
629
+ if (!shadowRoot) {
630
+ node["s-oo"] = parseInt(childRenderNode.$nodeId$);
631
+ }
632
+ }
633
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
634
+ plt.$orgLocNodes$.delete(orgLocationId);
635
+ }
636
+ }
637
+ const hosts = [];
638
+ const snLen = slottedNodes.length;
639
+ let snIndex = 0;
640
+ let slotGroup;
641
+ let snGroupIdx;
642
+ let snGroupLen;
643
+ let slottedItem;
644
+ let currentPos = 0;
645
+ for (snIndex; snIndex < snLen; snIndex++) {
646
+ slotGroup = slottedNodes[snIndex];
647
+ if (!slotGroup || !slotGroup.length) continue;
648
+ snGroupLen = slotGroup.length;
649
+ snGroupIdx = 0;
650
+ for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) {
651
+ slottedItem = slotGroup[snGroupIdx];
652
+ if (!hosts[slottedItem.hostId]) {
653
+ hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId);
654
+ }
655
+ if (!hosts[slottedItem.hostId]) continue;
656
+ const hostEle = hosts[slottedItem.hostId];
657
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
658
+ hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
659
+ }
660
+ if (!hostEle.shadowRoot || !shadowRoot) {
661
+ if (!slottedItem.slot["s-cr"]) {
662
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
663
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
664
+ slottedItem.slot["s-cr"] = hostEle;
665
+ } else {
666
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
667
+ }
668
+ }
669
+ addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
670
+ if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
671
+ slottedItem.node.removeAttribute("slot");
672
+ }
673
+ }
674
+ currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
675
+ }
676
+ }
677
+ if (shadowRoot && !shadowRoot.childNodes.length) {
678
+ let rnIdex = 0;
679
+ const rnLen = shadowRootNodes.length;
680
+ if (rnLen) {
681
+ for (rnIdex; rnIdex < rnLen; rnIdex++) {
682
+ const node = shadowRootNodes[rnIdex];
683
+ if (node) {
684
+ shadowRoot.appendChild(node);
685
+ }
686
+ }
687
+ Array.from(hostElm.childNodes).forEach((node) => {
688
+ if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
689
+ if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
690
+ node.removeAttribute("hidden");
691
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue) {
692
+ node.parentNode.removeChild(node);
693
+ }
694
+ }
695
+ });
696
+ }
697
+ }
698
+ hostRef.$hostElement$ = hostElm;
699
+ endHydrate();
700
+ };
701
+ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
702
+ let childNodeType;
703
+ let childIdSplt;
704
+ let childVNode;
705
+ let i2;
706
+ if (node.nodeType === 1 /* ElementNode */) {
707
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
708
+ if (childNodeType) {
709
+ childIdSplt = childNodeType.split(".");
710
+ if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
711
+ childVNode = createSimpleVNode({
712
+ $flags$: 0,
713
+ $hostId$: childIdSplt[0],
714
+ $nodeId$: childIdSplt[1],
715
+ $depth$: childIdSplt[2],
716
+ $index$: childIdSplt[3],
717
+ $tag$: node.tagName.toLowerCase(),
718
+ $elm$: node,
719
+ // If we don't add the initial classes to the VNode, the first `vdom-render.ts` patch
720
+ // won't try to reconcile them. Classes set on the node will be blown away.
721
+ $attrs$: { class: node.className || "" }
722
+ });
723
+ childRenderNodes.push(childVNode);
724
+ node.removeAttribute(HYDRATE_CHILD_ID);
725
+ if (!parentVNode.$children$) {
726
+ parentVNode.$children$ = [];
727
+ }
728
+ const slotName = childVNode.$elm$.getAttribute("s-sn");
729
+ if (typeof slotName === "string") {
730
+ if (childVNode.$tag$ === "slot-fb") {
731
+ addSlot(
732
+ slotName,
733
+ childIdSplt[2],
734
+ childVNode,
735
+ node,
736
+ parentVNode,
737
+ childRenderNodes,
738
+ slotNodes,
739
+ shadowRootNodes,
740
+ slottedNodes
741
+ );
742
+ }
743
+ childVNode.$elm$["s-sn"] = slotName;
744
+ childVNode.$elm$.removeAttribute("s-sn");
745
+ }
746
+ if (childVNode.$index$ !== void 0) {
747
+ parentVNode.$children$[childVNode.$index$] = childVNode;
748
+ }
749
+ parentVNode = childVNode;
750
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
751
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
752
+ }
753
+ }
754
+ }
755
+ if (node.shadowRoot) {
756
+ for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
757
+ clientHydrate(
758
+ parentVNode,
759
+ childRenderNodes,
760
+ slotNodes,
761
+ shadowRootNodes,
762
+ hostElm,
763
+ node.shadowRoot.childNodes[i2],
764
+ hostId,
765
+ slottedNodes
766
+ );
767
+ }
768
+ }
769
+ const nonShadowNodes = node.__childNodes || node.childNodes;
770
+ for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) {
771
+ clientHydrate(
772
+ parentVNode,
773
+ childRenderNodes,
774
+ slotNodes,
775
+ shadowRootNodes,
776
+ hostElm,
777
+ nonShadowNodes[i2],
778
+ hostId,
779
+ slottedNodes
780
+ );
781
+ }
782
+ } else if (node.nodeType === 8 /* CommentNode */) {
783
+ childIdSplt = node.nodeValue.split(".");
784
+ if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
785
+ childNodeType = childIdSplt[0];
786
+ childVNode = createSimpleVNode({
787
+ $hostId$: childIdSplt[1],
788
+ $nodeId$: childIdSplt[2],
789
+ $depth$: childIdSplt[3],
790
+ $index$: childIdSplt[4] || "0",
791
+ $elm$: node,
792
+ $attrs$: null,
793
+ $children$: null,
794
+ $key$: null,
795
+ $name$: null,
796
+ $tag$: null,
797
+ $text$: null
798
+ });
799
+ if (childNodeType === TEXT_NODE_ID) {
800
+ childVNode.$elm$ = findCorrespondingNode(node, 3 /* TextNode */);
801
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
802
+ childVNode.$text$ = childVNode.$elm$.textContent;
803
+ childRenderNodes.push(childVNode);
804
+ node.remove();
805
+ if (hostId === childVNode.$hostId$) {
806
+ if (!parentVNode.$children$) {
807
+ parentVNode.$children$ = [];
808
+ }
809
+ parentVNode.$children$[childVNode.$index$] = childVNode;
810
+ }
811
+ if (shadowRootNodes && childVNode.$depth$ === "0") {
812
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
813
+ }
814
+ }
815
+ } else if (childNodeType === COMMENT_NODE_ID) {
816
+ childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
817
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
818
+ childRenderNodes.push(childVNode);
819
+ node.remove();
820
+ }
821
+ } else if (childVNode.$hostId$ === hostId) {
822
+ if (childNodeType === SLOT_NODE_ID) {
823
+ const slotName = node["s-sn"] = childIdSplt[5] || "";
824
+ addSlot(
825
+ slotName,
826
+ childIdSplt[2],
827
+ childVNode,
828
+ node,
829
+ parentVNode,
830
+ childRenderNodes,
831
+ slotNodes,
832
+ shadowRootNodes,
833
+ slottedNodes
834
+ );
835
+ } else if (childNodeType === CONTENT_REF_ID) {
836
+ if (shadowRootNodes) {
837
+ node.remove();
838
+ }
839
+ }
840
+ }
841
+ }
842
+ } else if (parentVNode && parentVNode.$tag$ === "style") {
843
+ const vnode = newVNode(null, node.textContent);
844
+ vnode.$elm$ = node;
845
+ vnode.$index$ = "0";
846
+ parentVNode.$children$ = [vnode];
847
+ }
848
+ return parentVNode;
849
+ };
850
+ var initializeDocumentHydrate = (node, orgLocNodes) => {
851
+ if (node.nodeType === 1 /* ElementNode */) {
852
+ const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID);
853
+ if (componentId) {
854
+ orgLocNodes.set(componentId, node);
855
+ }
856
+ let i2 = 0;
857
+ if (node.shadowRoot) {
858
+ for (; i2 < node.shadowRoot.childNodes.length; i2++) {
859
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
860
+ }
861
+ }
862
+ const nonShadowNodes = node.__childNodes || node.childNodes;
863
+ for (i2 = 0; i2 < nonShadowNodes.length; i2++) {
864
+ initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes);
865
+ }
866
+ } else if (node.nodeType === 8 /* CommentNode */) {
867
+ const childIdSplt = node.nodeValue.split(".");
868
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
869
+ orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
870
+ node.nodeValue = "";
871
+ node["s-en"] = childIdSplt[3];
872
+ }
873
+ }
874
+ };
875
+ var createSimpleVNode = (vnode) => {
876
+ const defaultVNode = {
877
+ $flags$: 0,
878
+ $hostId$: null,
879
+ $nodeId$: null,
880
+ $depth$: null,
881
+ $index$: "0",
882
+ $elm$: null,
883
+ $attrs$: null,
884
+ $children$: null,
885
+ $key$: null,
886
+ $name$: null,
887
+ $tag$: null,
888
+ $text$: null
889
+ };
890
+ return { ...defaultVNode, ...vnode };
891
+ };
892
+ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) {
893
+ node["s-sr"] = true;
894
+ childVNode.$name$ = slotName || null;
895
+ childVNode.$tag$ = "slot";
896
+ const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
897
+ if (shadowRootNodes && win.document) {
898
+ const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
899
+ if (childVNode.$name$) {
900
+ childVNode.$elm$.setAttribute("name", slotName);
901
+ }
902
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
903
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
904
+ } else {
905
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
906
+ }
907
+ addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
908
+ node.remove();
909
+ if (childVNode.$depth$ === "0") {
910
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
911
+ }
912
+ } else {
913
+ const slot = childVNode.$elm$;
914
+ const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot;
915
+ addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$);
916
+ patchSlotNode(node);
917
+ if (shouldMove) {
918
+ parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
919
+ }
920
+ }
921
+ childRenderNodes.push(childVNode);
922
+ slotNodes.push(childVNode);
923
+ if (!parentVNode.$children$) {
924
+ parentVNode.$children$ = [];
925
+ }
926
+ parentVNode.$children$[childVNode.$index$] = childVNode;
927
+ }
928
+ var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
929
+ var _a, _b;
930
+ let slottedNode = slotNode.nextSibling;
931
+ slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
932
+ if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
933
+ do {
934
+ if (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (!slottedNode["getAttribute"] || !slottedNode.getAttribute("slot")) && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */))) {
935
+ slottedNode["s-sn"] = slotName;
936
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
937
+ }
938
+ slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
939
+ } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
940
+ };
941
+ var findCorrespondingNode = (node, type) => {
942
+ let sibling = node;
943
+ do {
944
+ sibling = sibling.nextSibling;
945
+ } while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
946
+ return sibling;
947
+ };
948
+
949
+ // src/utils/remote-value.ts
950
+ var RemoteValue = class _RemoteValue {
951
+ /**
952
+ * Deserializes a LocalValue serialized object back to its original JavaScript representation
953
+ *
954
+ * @param serialized The serialized LocalValue object
955
+ * @returns The original JavaScript value/object
956
+ */
957
+ static fromLocalValue(serialized) {
958
+ const type = serialized[TYPE_CONSTANT];
959
+ const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
960
+ switch (type) {
961
+ case "string" /* String */:
962
+ return value;
963
+ case "boolean" /* Boolean */:
964
+ return value;
965
+ case "bigint" /* BigInt */:
966
+ return BigInt(value);
967
+ case "undefined" /* Undefined */:
968
+ return void 0;
969
+ case "null" /* Null */:
970
+ return null;
971
+ case "number" /* Number */:
972
+ if (value === "NaN") return NaN;
973
+ if (value === "-0") return -0;
974
+ if (value === "Infinity") return Infinity;
975
+ if (value === "-Infinity") return -Infinity;
976
+ return value;
977
+ case "array" /* Array */:
978
+ return value.map((item) => _RemoteValue.fromLocalValue(item));
979
+ case "date" /* Date */:
980
+ return new Date(value);
981
+ case "map" /* Map */:
982
+ const map = /* @__PURE__ */ new Map();
983
+ for (const [key, val] of value) {
984
+ const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
985
+ const deserializedValue = _RemoteValue.fromLocalValue(val);
986
+ map.set(deserializedKey, deserializedValue);
987
+ }
988
+ return map;
989
+ case "object" /* Object */:
990
+ const obj = {};
991
+ for (const [key, val] of value) {
992
+ obj[key] = _RemoteValue.fromLocalValue(val);
993
+ }
994
+ return obj;
995
+ case "regexp" /* RegularExpression */:
996
+ const { pattern, flags } = value;
997
+ return new RegExp(pattern, flags);
998
+ case "set" /* Set */:
999
+ const set = /* @__PURE__ */ new Set();
1000
+ for (const item of value) {
1001
+ set.add(_RemoteValue.fromLocalValue(item));
1002
+ }
1003
+ return set;
1004
+ case "symbol" /* Symbol */:
1005
+ return Symbol(value);
1006
+ default:
1007
+ throw new Error(`Unsupported type: ${type}`);
1008
+ }
1009
+ }
1010
+ /**
1011
+ * Utility method to deserialize multiple LocalValues at once
1012
+ *
1013
+ * @param serializedValues Array of serialized LocalValue objects
1014
+ * @returns Array of deserialized JavaScript values
1015
+ */
1016
+ static fromLocalValueArray(serializedValues) {
1017
+ return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
1018
+ }
1019
+ /**
1020
+ * Verifies if the given object matches the structure of a serialized LocalValue
1021
+ *
1022
+ * @param obj Object to verify
1023
+ * @returns boolean indicating if the object has LocalValue structure
1024
+ */
1025
+ static isLocalValueObject(obj) {
1026
+ if (typeof obj !== "object" || obj === null) {
1027
+ return false;
1028
+ }
1029
+ if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
1030
+ return false;
1031
+ }
1032
+ const type = obj[TYPE_CONSTANT];
1033
+ const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
1034
+ if (!hasTypeProperty) {
1035
+ return false;
1036
+ }
1037
+ if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
1038
+ return obj.hasOwnProperty(VALUE_CONSTANT);
1039
+ }
1040
+ return true;
1041
+ }
1042
+ };
1043
+
1044
+ // src/utils/serialize.ts
1045
+ function decodeBase64Unicode(base64) {
1046
+ const binary = atob(base64);
1047
+ const bytes = new Uint8Array(binary.length);
1048
+ for (let i2 = 0; i2 < binary.length; i2++) {
1049
+ bytes[i2] = binary.charCodeAt(i2);
1050
+ }
1051
+ return new TextDecoder().decode(bytes);
1052
+ }
1053
+ function deserializeProperty(value) {
1054
+ if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
1055
+ return value;
1056
+ }
1057
+ return RemoteValue.fromLocalValue(JSON.parse(decodeBase64Unicode(value.slice(SERIALIZED_PREFIX.length))));
1058
+ }
1059
+
431
1060
  // src/runtime/parse-property-value.ts
432
1061
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
1062
+ if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
1063
+ propValue = deserializeProperty(propValue);
1064
+ return propValue;
1065
+ }
433
1066
  if (propValue != null && !isComplexType(propValue)) {
434
1067
  if (propType & 4 /* Boolean */) {
435
1068
  {
@@ -480,7 +1113,15 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
480
1113
  const classList = elm.classList;
481
1114
  const oldClasses = parseClassList(oldValue);
482
1115
  let newClasses = parseClassList(newValue);
483
- {
1116
+ if ((elm["s-si"] || elm["s-sc"]) && initialRender) {
1117
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
1118
+ newClasses.push(scopeId2);
1119
+ oldClasses.forEach((c) => {
1120
+ if (c.startsWith(scopeId2)) newClasses.push(c);
1121
+ });
1122
+ newClasses = [...new Set(newClasses)].filter((c) => c);
1123
+ classList.add(...newClasses);
1124
+ } else {
484
1125
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
485
1126
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
486
1127
  }
@@ -598,7 +1239,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
598
1239
  oldVnodeAttrs[memberName],
599
1240
  void 0,
600
1241
  isSvgMode2,
601
- newVnode.$flags$);
1242
+ newVnode.$flags$,
1243
+ isInitialRender
1244
+ );
602
1245
  }
603
1246
  }
604
1247
  }
@@ -609,7 +1252,9 @@ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
609
1252
  oldVnodeAttrs[memberName],
610
1253
  newVnodeAttrs[memberName],
611
1254
  isSvgMode2,
612
- newVnode.$flags$);
1255
+ newVnode.$flags$,
1256
+ isInitialRender
1257
+ );
613
1258
  }
614
1259
  };
615
1260
  function sortedAttrNames(attrNames) {
@@ -817,7 +1462,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
817
1462
  relocateToHostRoot(newVNode2.$elm$.parentElement);
818
1463
  }
819
1464
  }
820
- updateElement(oldVNode, newVNode2, isSvgMode);
1465
+ updateElement(oldVNode, newVNode2, isSvgMode, isInitialRender);
821
1466
  }
822
1467
  if (oldChildren !== null && newChildren !== null) {
823
1468
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -831,7 +1476,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
831
1476
  !isInitialRender && BUILD.updatable && oldChildren !== null
832
1477
  ) {
833
1478
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
834
- } else ;
1479
+ } else if (isInitialRender && BUILD.updatable && oldChildren !== null && newChildren === null) {
1480
+ newVNode2.$children$ = oldChildren;
1481
+ }
835
1482
  } else if (oldVNode.$text$ !== text) {
836
1483
  elm.data = text;
837
1484
  }
@@ -1031,7 +1678,13 @@ var postUpdateComponent = (hostRef) => {
1031
1678
  }
1032
1679
  };
1033
1680
  var appDidLoad = (who) => {
1681
+ var _a;
1034
1682
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1683
+ {
1684
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
1685
+ plt.$orgLocNodes$.clear();
1686
+ }
1687
+ }
1035
1688
  };
1036
1689
  var safeCall = (instance, method, arg, elm) => {
1037
1690
  if (instance && instance[method]) {
@@ -1309,10 +1962,21 @@ var connectedCallback = (elm) => {
1309
1962
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1310
1963
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1311
1964
  hostRef.$flags$ |= 1 /* hasConnected */;
1965
+ let hostId;
1966
+ {
1967
+ hostId = elm.getAttribute(HYDRATE_ID);
1968
+ if (hostId) {
1969
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1970
+ const scopeId2 = addStyle(elm.shadowRoot, cmpMeta);
1971
+ elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
1972
+ }
1973
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
1974
+ }
1975
+ }
1312
1976
  {
1313
1977
  let ancestorComponent = elm;
1314
1978
  while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
1315
- if (ancestorComponent["s-p"]) {
1979
+ if (ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
1316
1980
  attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
1317
1981
  break;
1318
1982
  }
@@ -1381,6 +2045,12 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1381
2045
  let isBootstrapping = true;
1382
2046
  Object.assign(plt, options);
1383
2047
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
2048
+ {
2049
+ plt.$flags$ |= 2 /* appLoaded */;
2050
+ }
2051
+ {
2052
+ hydrateScopedToShadow();
2053
+ }
1384
2054
  lazyBundles.map((lazyBundle) => {
1385
2055
  lazyBundle[1].map((compactMeta) => {
1386
2056
  const cmpMeta = {
@@ -1501,6 +2171,6 @@ exports.h = h;
1501
2171
  exports.promiseResolve = promiseResolve;
1502
2172
  exports.registerInstance = registerInstance;
1503
2173
  exports.setNonce = setNonce;
1504
- //# sourceMappingURL=index-D7ZSLrHc.js.map
2174
+ //# sourceMappingURL=index-CiYvuUBV.js.map
1505
2175
 
1506
- //# sourceMappingURL=index-D7ZSLrHc.js.map
2176
+ //# sourceMappingURL=index-CiYvuUBV.js.map