@stencil/core 4.35.3-dev.1752161791.11e6f9d → 4.35.3-dev.1752253566.6106c70

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.
@@ -638,7 +638,7 @@ var isJsFile = lowerPathParam((p) => p.endsWith(".js") || p.endsWith(".mjs") ||
638
638
  var import_app_data18 = require("@stencil/core/internal/app-data");
639
639
 
640
640
  // src/runtime/client-hydrate.ts
641
- var import_app_data6 = require("@stencil/core/internal/app-data");
641
+ var import_app_data7 = require("@stencil/core/internal/app-data");
642
642
 
643
643
  // src/runtime/dom-extras.ts
644
644
  var import_app_data3 = require("@stencil/core/internal/app-data");
@@ -1164,6 +1164,9 @@ var validNodesPatches = [
1164
1164
  "parentNode"
1165
1165
  ];
1166
1166
  function patchHostOriginalAccessor(accessorName, node) {
1167
+ if (!globalThis.Node || !globalThis.Element) {
1168
+ return;
1169
+ }
1167
1170
  let accessor;
1168
1171
  if (validElementPatches.includes(accessorName)) {
1169
1172
  accessor = Object.getOwnPropertyDescriptor(Element.prototype, accessorName);
@@ -1272,8 +1275,133 @@ var installDevTools = () => {
1272
1275
  }
1273
1276
  };
1274
1277
 
1275
- // src/runtime/vdom/h.ts
1278
+ // src/runtime/styles.ts
1276
1279
  var import_app_data5 = require("@stencil/core/internal/app-data");
1280
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
1281
+ var registerStyle = (scopeId2, cssText, allowCS) => {
1282
+ let style = styles.get(scopeId2);
1283
+ if (supportsConstructableStylesheets && allowCS) {
1284
+ style = style || new CSSStyleSheet();
1285
+ if (typeof style === "string") {
1286
+ style = cssText;
1287
+ } else {
1288
+ style.replaceSync(cssText);
1289
+ }
1290
+ } else {
1291
+ style = cssText;
1292
+ }
1293
+ styles.set(scopeId2, style);
1294
+ };
1295
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1296
+ var _a;
1297
+ const scopeId2 = getScopeId(cmpMeta, mode);
1298
+ const style = styles.get(scopeId2);
1299
+ if (!import_app_data5.BUILD.attachStyles || !win.document) {
1300
+ return scopeId2;
1301
+ }
1302
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
1303
+ if (style) {
1304
+ if (typeof style === "string") {
1305
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
1306
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
1307
+ let styleElm;
1308
+ if (!appliedStyles) {
1309
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
1310
+ }
1311
+ if (!appliedStyles.has(scopeId2)) {
1312
+ if (import_app_data5.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
1313
+ styleElm.innerHTML = style;
1314
+ } else {
1315
+ styleElm = win.document.createElement("style");
1316
+ styleElm.innerHTML = style;
1317
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1318
+ if (nonce != null) {
1319
+ styleElm.setAttribute("nonce", nonce);
1320
+ }
1321
+ if ((import_app_data5.BUILD.hydrateServerSide || import_app_data5.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
1322
+ styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1323
+ }
1324
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1325
+ if (styleContainerNode.nodeName === "HEAD") {
1326
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1327
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1328
+ styleContainerNode.insertBefore(
1329
+ styleElm,
1330
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
1331
+ );
1332
+ } else if ("host" in styleContainerNode) {
1333
+ if (supportsConstructableStylesheets) {
1334
+ const stylesheet = new CSSStyleSheet();
1335
+ stylesheet.replaceSync(style);
1336
+ if (supportsMutableAdoptedStyleSheets) {
1337
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
1338
+ } else {
1339
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
1340
+ }
1341
+ } else {
1342
+ const existingStyleContainer = styleContainerNode.querySelector("style");
1343
+ if (existingStyleContainer) {
1344
+ existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
1345
+ } else {
1346
+ styleContainerNode.prepend(styleElm);
1347
+ }
1348
+ }
1349
+ } else {
1350
+ styleContainerNode.append(styleElm);
1351
+ }
1352
+ }
1353
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1354
+ styleContainerNode.insertBefore(styleElm, null);
1355
+ }
1356
+ }
1357
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
1358
+ styleElm.innerHTML += SLOT_FB_CSS;
1359
+ }
1360
+ if (appliedStyles) {
1361
+ appliedStyles.add(scopeId2);
1362
+ }
1363
+ }
1364
+ } else if (import_app_data5.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
1365
+ if (supportsMutableAdoptedStyleSheets) {
1366
+ styleContainerNode.adoptedStyleSheets.push(style);
1367
+ } else {
1368
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
1369
+ }
1370
+ }
1371
+ }
1372
+ return scopeId2;
1373
+ };
1374
+ var attachStyles = (hostRef) => {
1375
+ const cmpMeta = hostRef.$cmpMeta$;
1376
+ const elm = hostRef.$hostElement$;
1377
+ const flags = cmpMeta.$flags$;
1378
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
1379
+ const scopeId2 = addStyle(
1380
+ import_app_data5.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
1381
+ cmpMeta,
1382
+ hostRef.$modeName$
1383
+ );
1384
+ if ((import_app_data5.BUILD.shadowDom || import_app_data5.BUILD.scoped) && import_app_data5.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
1385
+ elm["s-sc"] = scopeId2;
1386
+ elm.classList.add(scopeId2 + "-h");
1387
+ }
1388
+ endAttachStyles();
1389
+ };
1390
+ var getScopeId = (cmp, mode) => "sc-" + (import_app_data5.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
1391
+ var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
1392
+ var hydrateScopedToShadow = () => {
1393
+ if (!win.document) {
1394
+ return;
1395
+ }
1396
+ const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
1397
+ let i2 = 0;
1398
+ for (; i2 < styles2.length; i2++) {
1399
+ registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
1400
+ }
1401
+ };
1402
+
1403
+ // src/runtime/vdom/h.ts
1404
+ var import_app_data6 = require("@stencil/core/internal/app-data");
1277
1405
  var h = (nodeName, vnodeData, ...children) => {
1278
1406
  let child = null;
1279
1407
  let key = null;
@@ -1289,7 +1417,7 @@ var h = (nodeName, vnodeData, ...children) => {
1289
1417
  } else if (child != null && typeof child !== "boolean") {
1290
1418
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
1291
1419
  child = String(child);
1292
- } else if (import_app_data5.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1420
+ } else if (import_app_data6.BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
1293
1421
  consoleDevError(`vNode passed as children has unexpected type.
1294
1422
  Make sure it's using the correct h() function.
1295
1423
  Empty objects can also be the cause, look for JSX comments that became objects.`);
@@ -1305,28 +1433,28 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1305
1433
  };
1306
1434
  walk(children);
1307
1435
  if (vnodeData) {
1308
- if (import_app_data5.BUILD.isDev && nodeName === "input") {
1436
+ if (import_app_data6.BUILD.isDev && nodeName === "input") {
1309
1437
  validateInputProperties(vnodeData);
1310
1438
  }
1311
- if (import_app_data5.BUILD.vdomKey && vnodeData.key) {
1439
+ if (import_app_data6.BUILD.vdomKey && vnodeData.key) {
1312
1440
  key = vnodeData.key;
1313
1441
  }
1314
- if (import_app_data5.BUILD.slotRelocation && vnodeData.name) {
1442
+ if (import_app_data6.BUILD.slotRelocation && vnodeData.name) {
1315
1443
  slotName = vnodeData.name;
1316
1444
  }
1317
- if (import_app_data5.BUILD.vdomClass) {
1445
+ if (import_app_data6.BUILD.vdomClass) {
1318
1446
  const classData = vnodeData.className || vnodeData.class;
1319
1447
  if (classData) {
1320
1448
  vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
1321
1449
  }
1322
1450
  }
1323
1451
  }
1324
- if (import_app_data5.BUILD.isDev && vNodeChildren.some(isHost)) {
1452
+ if (import_app_data6.BUILD.isDev && vNodeChildren.some(isHost)) {
1325
1453
  consoleDevError(`The <Host> must be the single root component. Make sure:
1326
1454
  - You are NOT using hostData() and <Host> in the same component.
1327
1455
  - <Host> is used once, and it's the single root component of the render() function.`);
1328
1456
  }
1329
- if (import_app_data5.BUILD.vdomFunctional && typeof nodeName === "function") {
1457
+ if (import_app_data6.BUILD.vdomFunctional && typeof nodeName === "function") {
1330
1458
  return nodeName(
1331
1459
  vnodeData === null ? {} : vnodeData,
1332
1460
  vNodeChildren,
@@ -1338,10 +1466,10 @@ Empty objects can also be the cause, look for JSX comments that became objects.`
1338
1466
  if (vNodeChildren.length > 0) {
1339
1467
  vnode.$children$ = vNodeChildren;
1340
1468
  }
1341
- if (import_app_data5.BUILD.vdomKey) {
1469
+ if (import_app_data6.BUILD.vdomKey) {
1342
1470
  vnode.$key$ = key;
1343
1471
  }
1344
- if (import_app_data5.BUILD.slotRelocation) {
1472
+ if (import_app_data6.BUILD.slotRelocation) {
1345
1473
  vnode.$name$ = slotName;
1346
1474
  }
1347
1475
  return vnode;
@@ -1354,13 +1482,13 @@ var newVNode = (tag, text) => {
1354
1482
  $elm$: null,
1355
1483
  $children$: null
1356
1484
  };
1357
- if (import_app_data5.BUILD.vdomAttribute) {
1485
+ if (import_app_data6.BUILD.vdomAttribute) {
1358
1486
  vnode.$attrs$ = null;
1359
1487
  }
1360
- if (import_app_data5.BUILD.vdomKey) {
1488
+ if (import_app_data6.BUILD.vdomKey) {
1361
1489
  vnode.$key$ = null;
1362
1490
  }
1363
- if (import_app_data5.BUILD.slotRelocation) {
1491
+ if (import_app_data6.BUILD.slotRelocation) {
1364
1492
  vnode.$name$ = null;
1365
1493
  }
1366
1494
  return vnode;
@@ -1414,18 +1542,18 @@ var validateInputProperties = (inputElm) => {
1414
1542
 
1415
1543
  // src/runtime/client-hydrate.ts
1416
1544
  var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1417
- var _a;
1545
+ var _a, _b, _c;
1418
1546
  const endHydrate = createTime("hydrateClient", tagName);
1419
1547
  const shadowRoot = hostElm.shadowRoot;
1420
1548
  const childRenderNodes = [];
1421
1549
  const slotNodes = [];
1422
1550
  const slottedNodes = [];
1423
- const shadowRootNodes = import_app_data6.BUILD.shadowDom && shadowRoot ? [] : null;
1551
+ const shadowRootNodes = import_app_data7.BUILD.shadowDom && shadowRoot ? [] : null;
1424
1552
  const vnode = newVNode(tagName, null);
1425
1553
  vnode.$elm$ = hostElm;
1426
1554
  const members = Object.entries(((_a = hostRef.$cmpMeta$) == null ? void 0 : _a.$members$) || {});
1427
1555
  members.forEach(([memberName, [memberFlags, metaAttributeName]]) => {
1428
- var _a2, _b;
1556
+ var _a2, _b2;
1429
1557
  if (!(memberFlags & 31 /* Prop */)) {
1430
1558
  return;
1431
1559
  }
@@ -1435,13 +1563,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1435
1563
  const attrPropVal = parsePropertyValue(
1436
1564
  attrVal,
1437
1565
  memberFlags,
1438
- import_app_data6.BUILD.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1566
+ import_app_data7.BUILD.formAssociated && !!(((_a2 = hostRef.$cmpMeta$) == null ? void 0 : _a2.$flags$) & 64 /* formAssociated */)
1439
1567
  );
1440
- (_b = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b.set(memberName, attrPropVal);
1568
+ (_b2 = hostRef == null ? void 0 : hostRef.$instanceValues$) == null ? void 0 : _b2.set(memberName, attrPropVal);
1441
1569
  }
1442
1570
  });
1443
1571
  let scopeId2;
1444
- if (import_app_data6.BUILD.scoped) {
1572
+ if (import_app_data7.BUILD.scoped) {
1445
1573
  const cmpMeta = hostRef.$cmpMeta$;
1446
1574
  if (cmpMeta && cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */ && hostElm["s-sc"]) {
1447
1575
  scopeId2 = hostElm["s-sc"];
@@ -1478,6 +1606,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1478
1606
  if (childRenderNode.$tag$ === "slot") {
1479
1607
  node["s-cr"] = hostElm["s-cr"];
1480
1608
  }
1609
+ } else if (((_b = childRenderNode.$tag$) == null ? void 0 : _b.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
1610
+ const cmpMeta = getHostRef(childRenderNode.$elm$);
1611
+ const scopeId3 = getScopeId(
1612
+ cmpMeta.$cmpMeta$,
1613
+ import_app_data7.BUILD.mode ? childRenderNode.$elm$.getAttribute("s-mode") : void 0
1614
+ );
1615
+ const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
1616
+ if (styleSheet) {
1617
+ hostElm.shadowRoot.append(styleSheet.cloneNode(true));
1618
+ }
1481
1619
  }
1482
1620
  if (childRenderNode.$tag$ === "slot") {
1483
1621
  childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
@@ -1493,7 +1631,7 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1493
1631
  }
1494
1632
  }
1495
1633
  if (orgLocationNode && orgLocationNode.isConnected) {
1496
- if (shadowRoot && orgLocationNode["s-en"] === "") {
1634
+ if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
1497
1635
  orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1498
1636
  }
1499
1637
  orgLocationNode.parentNode.removeChild(orgLocationNode);
@@ -1501,7 +1639,9 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1501
1639
  node["s-oo"] = parseInt(childRenderNode.$nodeId$);
1502
1640
  }
1503
1641
  }
1504
- plt.$orgLocNodes$.delete(orgLocationId);
1642
+ if (orgLocationNode && !orgLocationNode["s-id"]) {
1643
+ plt.$orgLocNodes$.delete(orgLocationId);
1644
+ }
1505
1645
  }
1506
1646
  const hosts = [];
1507
1647
  const snLen = slottedNodes.length;
@@ -1522,29 +1662,34 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1522
1662
  }
1523
1663
  if (!hosts[slottedItem.hostId]) continue;
1524
1664
  const hostEle = hosts[slottedItem.hostId];
1665
+ if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1666
+ hostEle.appendChild(slottedItem.node);
1667
+ }
1525
1668
  if (!hostEle.shadowRoot || !shadowRoot) {
1526
- slottedItem.slot["s-cr"] = hostEle["s-cr"];
1527
- if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1528
- slottedItem.slot["s-cr"] = hostEle;
1529
- } else {
1530
- slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1669
+ if (!slottedItem.slot["s-cr"]) {
1670
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1671
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1672
+ slottedItem.slot["s-cr"] = hostEle;
1673
+ } else {
1674
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1675
+ }
1531
1676
  }
1532
1677
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1533
- if (import_app_data6.BUILD.experimentalSlotFixes) {
1678
+ if (((_c = slottedItem.node.parentElement) == null ? void 0 : _c.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
1679
+ slottedItem.node.removeAttribute("slot");
1680
+ }
1681
+ if (import_app_data7.BUILD.experimentalSlotFixes) {
1534
1682
  patchSlottedNode(slottedItem.node);
1535
1683
  }
1536
1684
  }
1537
- if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) {
1538
- hostEle.appendChild(slottedItem.node);
1539
- }
1540
1685
  }
1541
1686
  }
1542
- if (import_app_data6.BUILD.scoped && scopeId2 && slotNodes.length) {
1687
+ if (import_app_data7.BUILD.scoped && scopeId2 && slotNodes.length) {
1543
1688
  slotNodes.forEach((slot) => {
1544
1689
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1545
1690
  });
1546
1691
  }
1547
- if (import_app_data6.BUILD.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1692
+ if (import_app_data7.BUILD.shadowDom && shadowRoot) {
1548
1693
  let rnIdex = 0;
1549
1694
  const rnLen = shadowRootNodes.length;
1550
1695
  if (rnLen) {
@@ -1555,14 +1700,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1555
1700
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1556
1701
  if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1557
1702
  node.removeAttribute("hidden");
1558
- } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1703
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1559
1704
  node.parentNode.removeChild(node);
1560
1705
  }
1561
1706
  }
1562
1707
  });
1563
1708
  }
1564
1709
  }
1565
- plt.$orgLocNodes$.delete(hostElm["s-id"]);
1566
1710
  hostRef.$hostElement$ = hostElm;
1567
1711
  endHydrate();
1568
1712
  };
@@ -1594,7 +1738,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1594
1738
  if (!parentVNode.$children$) {
1595
1739
  parentVNode.$children$ = [];
1596
1740
  }
1597
- if (import_app_data6.BUILD.scoped && scopeId2) {
1741
+ if (import_app_data7.BUILD.scoped && scopeId2 && childIdSplt[0] === hostId) {
1598
1742
  node["s-si"] = scopeId2;
1599
1743
  childVNode.$attrs$.class += " " + scopeId2;
1600
1744
  }
@@ -1612,7 +1756,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1612
1756
  shadowRootNodes,
1613
1757
  slottedNodes
1614
1758
  );
1615
- if (import_app_data6.BUILD.scoped && scopeId2) {
1759
+ if (import_app_data7.BUILD.scoped && scopeId2) {
1616
1760
  node.classList.add(scopeId2);
1617
1761
  }
1618
1762
  }
@@ -1709,9 +1853,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1709
1853
  slottedNodes
1710
1854
  );
1711
1855
  } else if (childNodeType === CONTENT_REF_ID) {
1712
- if (import_app_data6.BUILD.shadowDom && shadowRootNodes) {
1856
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes) {
1713
1857
  node.remove();
1714
- } else if (import_app_data6.BUILD.slotRelocation) {
1858
+ } else if (import_app_data7.BUILD.slotRelocation) {
1715
1859
  hostElm["s-cr"] = node;
1716
1860
  node["s-cn"] = true;
1717
1861
  }
@@ -1724,7 +1868,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1724
1868
  vnode.$index$ = "0";
1725
1869
  parentVNode.$children$ = [vnode];
1726
1870
  } else {
1727
- if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1871
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
1728
1872
  node.remove();
1729
1873
  }
1730
1874
  }
@@ -1777,15 +1921,15 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1777
1921
  childVNode.$name$ = slotName || null;
1778
1922
  childVNode.$tag$ = "slot";
1779
1923
  const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : "";
1780
- if (import_app_data6.BUILD.shadowDom && shadowRootNodes && win.document) {
1924
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes && win.document) {
1781
1925
  const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1782
1926
  if (childVNode.$name$) {
1783
1927
  childVNode.$elm$.setAttribute("name", slotName);
1784
1928
  }
1785
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1786
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1929
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1930
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1787
1931
  } else {
1788
- node.parentNode.insertBefore(slot, node);
1932
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1789
1933
  }
1790
1934
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1791
1935
  node.remove();
@@ -1809,13 +1953,17 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1809
1953
  parentVNode.$children$[childVNode.$index$] = childVNode;
1810
1954
  }
1811
1955
  var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1956
+ var _a, _b;
1812
1957
  let slottedNode = slotNode.nextSibling;
1813
1958
  slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
1814
- 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 */))) {
1815
- slottedNode["s-sn"] = slotName;
1816
- slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1817
- slottedNode = slottedNode.nextSibling;
1818
- }
1959
+ if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
1960
+ do {
1961
+ 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 */))) {
1962
+ slottedNode["s-sn"] = slotName;
1963
+ slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1964
+ }
1965
+ slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
1966
+ } while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
1819
1967
  };
1820
1968
  var findCorrespondingNode = (node, type) => {
1821
1969
  let sibling = node;
@@ -2246,31 +2394,31 @@ var import_app_data16 = require("@stencil/core/internal/app-data");
2246
2394
  var import_app_data15 = require("@stencil/core/internal/app-data");
2247
2395
 
2248
2396
  // src/runtime/parse-property-value.ts
2249
- var import_app_data7 = require("@stencil/core/internal/app-data");
2397
+ var import_app_data8 = require("@stencil/core/internal/app-data");
2250
2398
  var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2251
- if ((import_app_data7.BUILD.hydrateClientSide || import_app_data7.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2399
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2252
2400
  try {
2253
2401
  propValue = JSON.parse(propValue);
2254
2402
  return propValue;
2255
2403
  } catch (e) {
2256
2404
  }
2257
2405
  }
2258
- if ((import_app_data7.BUILD.hydrateClientSide || import_app_data7.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2406
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2259
2407
  propValue = deserializeProperty(propValue);
2260
2408
  return propValue;
2261
2409
  }
2262
2410
  if (propValue != null && !isComplexType(propValue)) {
2263
- if (import_app_data7.BUILD.propBoolean && propType & 4 /* Boolean */) {
2264
- if (import_app_data7.BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2411
+ if (import_app_data8.BUILD.propBoolean && propType & 4 /* Boolean */) {
2412
+ if (import_app_data8.BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2265
2413
  return propValue === "" || !!propValue;
2266
2414
  } else {
2267
2415
  return propValue === "false" ? false : propValue === "" || !!propValue;
2268
2416
  }
2269
2417
  }
2270
- if (import_app_data7.BUILD.propNumber && propType & 2 /* Number */) {
2418
+ if (import_app_data8.BUILD.propNumber && propType & 2 /* Number */) {
2271
2419
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2272
2420
  }
2273
- if (import_app_data7.BUILD.propString && propType & 1 /* String */) {
2421
+ if (import_app_data8.BUILD.propString && propType & 1 /* String */) {
2274
2422
  return String(propValue);
2275
2423
  }
2276
2424
  return propValue;
@@ -2282,18 +2430,18 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2282
2430
  var import_app_data14 = require("@stencil/core/internal/app-data");
2283
2431
 
2284
2432
  // src/runtime/event-emitter.ts
2285
- var import_app_data9 = require("@stencil/core/internal/app-data");
2433
+ var import_app_data10 = require("@stencil/core/internal/app-data");
2286
2434
 
2287
2435
  // src/runtime/element.ts
2288
- var import_app_data8 = require("@stencil/core/internal/app-data");
2289
- var getElement = (ref) => import_app_data8.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2436
+ var import_app_data9 = require("@stencil/core/internal/app-data");
2437
+ var getElement = (ref) => import_app_data9.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2290
2438
 
2291
2439
  // src/runtime/event-emitter.ts
2292
2440
  var createEvent = (ref, name, flags) => {
2293
2441
  const elm = getElement(ref);
2294
2442
  return {
2295
2443
  emit: (detail) => {
2296
- if (import_app_data9.BUILD.isDev && !elm.isConnected) {
2444
+ if (import_app_data10.BUILD.isDev && !elm.isConnected) {
2297
2445
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2298
2446
  }
2299
2447
  return emitEvent(elm, name, {
@@ -2311,131 +2459,6 @@ var emitEvent = (elm, name, opts) => {
2311
2459
  return ev;
2312
2460
  };
2313
2461
 
2314
- // src/runtime/styles.ts
2315
- var import_app_data10 = require("@stencil/core/internal/app-data");
2316
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
2317
- var registerStyle = (scopeId2, cssText, allowCS) => {
2318
- let style = styles.get(scopeId2);
2319
- if (supportsConstructableStylesheets && allowCS) {
2320
- style = style || new CSSStyleSheet();
2321
- if (typeof style === "string") {
2322
- style = cssText;
2323
- } else {
2324
- style.replaceSync(cssText);
2325
- }
2326
- } else {
2327
- style = cssText;
2328
- }
2329
- styles.set(scopeId2, style);
2330
- };
2331
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
2332
- var _a;
2333
- const scopeId2 = getScopeId(cmpMeta, mode);
2334
- const style = styles.get(scopeId2);
2335
- if (!import_app_data10.BUILD.attachStyles || !win.document) {
2336
- return scopeId2;
2337
- }
2338
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
2339
- if (style) {
2340
- if (typeof style === "string") {
2341
- styleContainerNode = styleContainerNode.head || styleContainerNode;
2342
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
2343
- let styleElm;
2344
- if (!appliedStyles) {
2345
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
2346
- }
2347
- if (!appliedStyles.has(scopeId2)) {
2348
- if (import_app_data10.BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
2349
- styleElm.innerHTML = style;
2350
- } else {
2351
- styleElm = win.document.createElement("style");
2352
- styleElm.innerHTML = style;
2353
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
2354
- if (nonce != null) {
2355
- styleElm.setAttribute("nonce", nonce);
2356
- }
2357
- if ((import_app_data10.BUILD.hydrateServerSide || import_app_data10.BUILD.hotModuleReplacement) && (cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */)) {
2358
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
2359
- }
2360
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
2361
- if (styleContainerNode.nodeName === "HEAD") {
2362
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
2363
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
2364
- styleContainerNode.insertBefore(
2365
- styleElm,
2366
- (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
2367
- );
2368
- } else if ("host" in styleContainerNode) {
2369
- if (supportsConstructableStylesheets) {
2370
- const stylesheet = new CSSStyleSheet();
2371
- stylesheet.replaceSync(style);
2372
- if (supportsMutableAdoptedStyleSheets) {
2373
- styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
2374
- } else {
2375
- styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
2376
- }
2377
- } else {
2378
- const existingStyleContainer = styleContainerNode.querySelector("style");
2379
- if (existingStyleContainer) {
2380
- existingStyleContainer.innerHTML = style + existingStyleContainer.innerHTML;
2381
- } else {
2382
- styleContainerNode.prepend(styleElm);
2383
- }
2384
- }
2385
- } else {
2386
- styleContainerNode.append(styleElm);
2387
- }
2388
- }
2389
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2390
- styleContainerNode.insertBefore(styleElm, null);
2391
- }
2392
- }
2393
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
2394
- styleElm.innerHTML += SLOT_FB_CSS;
2395
- }
2396
- if (appliedStyles) {
2397
- appliedStyles.add(scopeId2);
2398
- }
2399
- }
2400
- } else if (import_app_data10.BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
2401
- if (supportsMutableAdoptedStyleSheets) {
2402
- styleContainerNode.adoptedStyleSheets.push(style);
2403
- } else {
2404
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
2405
- }
2406
- }
2407
- }
2408
- return scopeId2;
2409
- };
2410
- var attachStyles = (hostRef) => {
2411
- const cmpMeta = hostRef.$cmpMeta$;
2412
- const elm = hostRef.$hostElement$;
2413
- const flags = cmpMeta.$flags$;
2414
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
2415
- const scopeId2 = addStyle(
2416
- import_app_data10.BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
2417
- cmpMeta,
2418
- hostRef.$modeName$
2419
- );
2420
- if ((import_app_data10.BUILD.shadowDom || import_app_data10.BUILD.scoped) && import_app_data10.BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
2421
- elm["s-sc"] = scopeId2;
2422
- elm.classList.add(scopeId2 + "-h");
2423
- }
2424
- endAttachStyles();
2425
- };
2426
- var getScopeId = (cmp, mode) => "sc-" + (import_app_data10.BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
2427
- var convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, "$1{");
2428
- var hydrateScopedToShadow = () => {
2429
- if (!win.document) {
2430
- return;
2431
- }
2432
- const styles2 = win.document.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2433
- let i2 = 0;
2434
- for (; i2 < styles2.length; i2++) {
2435
- registerStyle(styles2[i2].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles2[i2].innerHTML), true);
2436
- }
2437
- };
2438
-
2439
2462
  // src/runtime/vdom/vdom-render.ts
2440
2463
  var import_app_data13 = require("@stencil/core/internal/app-data");
2441
2464
 
@@ -2454,12 +2477,13 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2454
2477
  const classList = elm.classList;
2455
2478
  const oldClasses = parseClassList(oldValue);
2456
2479
  let newClasses = parseClassList(newValue);
2457
- if (import_app_data11.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
2458
- newClasses.push(elm["s-si"]);
2480
+ if (import_app_data11.BUILD.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2481
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2482
+ newClasses.push(scopeId2);
2459
2483
  oldClasses.forEach((c) => {
2460
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2484
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2461
2485
  });
2462
- newClasses = [...new Set(newClasses)];
2486
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2463
2487
  classList.add(...newClasses);
2464
2488
  } else {
2465
2489
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
@@ -3210,6 +3234,12 @@ var scheduleUpdate = (hostRef, isInitialLoad) => {
3210
3234
  }
3211
3235
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
3212
3236
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
3237
+ if (isInitialLoad) {
3238
+ queueMicrotask(() => {
3239
+ dispatch();
3240
+ });
3241
+ return;
3242
+ }
3213
3243
  return import_app_data14.BUILD.taskQueue ? writeTask(dispatch) : dispatch();
3214
3244
  };
3215
3245
  var dispatchHooks = (hostRef, isInitialLoad) => {
@@ -3410,10 +3440,16 @@ var forceUpdate = (ref) => {
3410
3440
  return false;
3411
3441
  };
3412
3442
  var appDidLoad = (who) => {
3443
+ var _a;
3413
3444
  if (import_app_data14.BUILD.asyncQueue) {
3414
3445
  plt.$flags$ |= 2 /* appLoaded */;
3415
3446
  }
3416
3447
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: import_app_data14.NAMESPACE } }));
3448
+ if (import_app_data14.BUILD.hydrateClientSide) {
3449
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3450
+ plt.$orgLocNodes$.clear();
3451
+ }
3452
+ }
3417
3453
  if (import_app_data14.BUILD.profile && performance.measure) {
3418
3454
  performance.measure(`[Stencil] ${import_app_data14.NAMESPACE} initial load (by ${who})`, "st:app:start");
3419
3455
  }
@@ -3845,6 +3881,11 @@ var connectedCallback = (elm) => {
3845
3881
  if (import_app_data18.BUILD.hydrateServerSide || (import_app_data18.BUILD.slot || import_app_data18.BUILD.shadowDom) && // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
3846
3882
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3847
3883
  setContentReference(elm);
3884
+ } else if (import_app_data18.BUILD.hydrateClientSide && !(cmpMeta.$flags$ & 4 /* hasSlotRelocation */)) {
3885
+ const commendPlaceholder = elm.firstChild;
3886
+ if ((commendPlaceholder == null ? void 0 : commendPlaceholder.nodeType) === 8 /* CommentNode */ && !commendPlaceholder["s-cn"] && !commendPlaceholder.nodeValue) {
3887
+ elm.removeChild(commendPlaceholder);
3888
+ }
3848
3889
  }
3849
3890
  }
3850
3891
  if (import_app_data18.BUILD.asyncLoading) {
@@ -3949,7 +3990,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3949
3990
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
3950
3991
  }
3951
3992
  if (import_app_data20.BUILD.experimentalSlotFixes) {
3952
- if (import_app_data20.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3993
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
3953
3994
  patchPseudoShadowDom(Cstr.prototype);
3954
3995
  }
3955
3996
  } else {
@@ -4166,7 +4207,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
4166
4207
  }
4167
4208
  };
4168
4209
  if (import_app_data21.BUILD.experimentalSlotFixes) {
4169
- if (import_app_data21.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
4210
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
4170
4211
  patchPseudoShadowDom(HostElement.prototype);
4171
4212
  }
4172
4213
  } else {