@stencil/core 4.35.3-dev.1752161791.11e6f9d → 4.35.3-dev.1752210255.bfbd683

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;
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.$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;
@@ -1523,14 +1663,16 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1523
1663
  if (!hosts[slottedItem.hostId]) continue;
1524
1664
  const hostEle = hosts[slottedItem.hostId];
1525
1665
  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];
1666
+ if (!slottedItem.slot["s-cr"]) {
1667
+ slottedItem.slot["s-cr"] = hostEle["s-cr"];
1668
+ if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
1669
+ slottedItem.slot["s-cr"] = hostEle;
1670
+ } else {
1671
+ slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
1672
+ }
1531
1673
  }
1532
1674
  addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]);
1533
- if (import_app_data6.BUILD.experimentalSlotFixes) {
1675
+ if (import_app_data7.BUILD.experimentalSlotFixes) {
1534
1676
  patchSlottedNode(slottedItem.node);
1535
1677
  }
1536
1678
  }
@@ -1539,12 +1681,12 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1539
1681
  }
1540
1682
  }
1541
1683
  }
1542
- if (import_app_data6.BUILD.scoped && scopeId2 && slotNodes.length) {
1684
+ if (import_app_data7.BUILD.scoped && scopeId2 && slotNodes.length) {
1543
1685
  slotNodes.forEach((slot) => {
1544
1686
  slot.$elm$.parentElement.classList.add(scopeId2 + "-s");
1545
1687
  });
1546
1688
  }
1547
- if (import_app_data6.BUILD.shadowDom && shadowRoot && !shadowRoot.childNodes.length) {
1689
+ if (import_app_data7.BUILD.shadowDom && shadowRoot) {
1548
1690
  let rnIdex = 0;
1549
1691
  const rnLen = shadowRootNodes.length;
1550
1692
  if (rnLen) {
@@ -1555,14 +1697,13 @@ var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1555
1697
  if (typeof node["s-en"] !== "string" && typeof node["s-sn"] !== "string") {
1556
1698
  if (node.nodeType === 1 /* ElementNode */ && node.slot && node.hidden) {
1557
1699
  node.removeAttribute("hidden");
1558
- } else if (node.nodeType === 8 /* CommentNode */ || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1700
+ } else if (node.nodeType === 8 /* CommentNode */ && !node.nodeValue || node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1559
1701
  node.parentNode.removeChild(node);
1560
1702
  }
1561
1703
  }
1562
1704
  });
1563
1705
  }
1564
1706
  }
1565
- plt.$orgLocNodes$.delete(hostElm["s-id"]);
1566
1707
  hostRef.$hostElement$ = hostElm;
1567
1708
  endHydrate();
1568
1709
  };
@@ -1594,7 +1735,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1594
1735
  if (!parentVNode.$children$) {
1595
1736
  parentVNode.$children$ = [];
1596
1737
  }
1597
- if (import_app_data6.BUILD.scoped && scopeId2) {
1738
+ if (import_app_data7.BUILD.scoped && scopeId2 && childIdSplt[0] === hostId) {
1598
1739
  node["s-si"] = scopeId2;
1599
1740
  childVNode.$attrs$.class += " " + scopeId2;
1600
1741
  }
@@ -1612,7 +1753,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1612
1753
  shadowRootNodes,
1613
1754
  slottedNodes
1614
1755
  );
1615
- if (import_app_data6.BUILD.scoped && scopeId2) {
1756
+ if (import_app_data7.BUILD.scoped && scopeId2) {
1616
1757
  node.classList.add(scopeId2);
1617
1758
  }
1618
1759
  }
@@ -1709,9 +1850,9 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1709
1850
  slottedNodes
1710
1851
  );
1711
1852
  } else if (childNodeType === CONTENT_REF_ID) {
1712
- if (import_app_data6.BUILD.shadowDom && shadowRootNodes) {
1853
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes) {
1713
1854
  node.remove();
1714
- } else if (import_app_data6.BUILD.slotRelocation) {
1855
+ } else if (import_app_data7.BUILD.slotRelocation) {
1715
1856
  hostElm["s-cr"] = node;
1716
1857
  node["s-cn"] = true;
1717
1858
  }
@@ -1724,7 +1865,7 @@ var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes,
1724
1865
  vnode.$index$ = "0";
1725
1866
  parentVNode.$children$ = [vnode];
1726
1867
  } else {
1727
- if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim()) {
1868
+ if (node.nodeType === 3 /* TextNode */ && !node.wholeText.trim() && !node["s-nr"]) {
1728
1869
  node.remove();
1729
1870
  }
1730
1871
  }
@@ -1777,15 +1918,15 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1777
1918
  childVNode.$name$ = slotName || null;
1778
1919
  childVNode.$tag$ = "slot";
1779
1920
  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) {
1921
+ if (import_app_data7.BUILD.shadowDom && shadowRootNodes && win.document) {
1781
1922
  const slot = childVNode.$elm$ = win.document.createElement(childVNode.$tag$);
1782
1923
  if (childVNode.$name$) {
1783
1924
  childVNode.$elm$.setAttribute("name", slotName);
1784
1925
  }
1785
- if (parentNodeId && parentNodeId !== childVNode.$hostId$) {
1786
- parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]);
1926
+ if (parentVNode.$elm$.shadowRoot && parentNodeId && parentNodeId !== childVNode.$hostId$) {
1927
+ internalCall(parentVNode.$elm$, "insertBefore")(slot, internalCall(parentVNode.$elm$, "children")[0]);
1787
1928
  } else {
1788
- node.parentNode.insertBefore(slot, node);
1929
+ internalCall(internalCall(node, "parentNode"), "insertBefore")(slot, node);
1789
1930
  }
1790
1931
  addSlottedNodes(slottedNodes, slotId, slotName, node, childVNode.$hostId$);
1791
1932
  node.remove();
@@ -1811,7 +1952,7 @@ function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNod
1811
1952
  var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => {
1812
1953
  let slottedNode = slotNode.nextSibling;
1813
1954
  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 */))) {
1955
+ while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */ || slottedNode.tagName === "SLOT"))) {
1815
1956
  slottedNode["s-sn"] = slotName;
1816
1957
  slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
1817
1958
  slottedNode = slottedNode.nextSibling;
@@ -2246,31 +2387,31 @@ var import_app_data16 = require("@stencil/core/internal/app-data");
2246
2387
  var import_app_data15 = require("@stencil/core/internal/app-data");
2247
2388
 
2248
2389
  // src/runtime/parse-property-value.ts
2249
- var import_app_data7 = require("@stencil/core/internal/app-data");
2390
+ var import_app_data8 = require("@stencil/core/internal/app-data");
2250
2391
  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("]"))) {
2392
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && (propValue.startsWith("{") && propValue.endsWith("}") || propValue.startsWith("[") && propValue.endsWith("]"))) {
2252
2393
  try {
2253
2394
  propValue = JSON.parse(propValue);
2254
2395
  return propValue;
2255
2396
  } catch (e) {
2256
2397
  }
2257
2398
  }
2258
- if ((import_app_data7.BUILD.hydrateClientSide || import_app_data7.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2399
+ if ((import_app_data8.BUILD.hydrateClientSide || import_app_data8.BUILD.hydrateServerSide) && typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
2259
2400
  propValue = deserializeProperty(propValue);
2260
2401
  return propValue;
2261
2402
  }
2262
2403
  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") {
2404
+ if (import_app_data8.BUILD.propBoolean && propType & 4 /* Boolean */) {
2405
+ if (import_app_data8.BUILD.formAssociated && isFormAssociated && typeof propValue === "string") {
2265
2406
  return propValue === "" || !!propValue;
2266
2407
  } else {
2267
2408
  return propValue === "false" ? false : propValue === "" || !!propValue;
2268
2409
  }
2269
2410
  }
2270
- if (import_app_data7.BUILD.propNumber && propType & 2 /* Number */) {
2411
+ if (import_app_data8.BUILD.propNumber && propType & 2 /* Number */) {
2271
2412
  return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
2272
2413
  }
2273
- if (import_app_data7.BUILD.propString && propType & 1 /* String */) {
2414
+ if (import_app_data8.BUILD.propString && propType & 1 /* String */) {
2274
2415
  return String(propValue);
2275
2416
  }
2276
2417
  return propValue;
@@ -2282,18 +2423,18 @@ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
2282
2423
  var import_app_data14 = require("@stencil/core/internal/app-data");
2283
2424
 
2284
2425
  // src/runtime/event-emitter.ts
2285
- var import_app_data9 = require("@stencil/core/internal/app-data");
2426
+ var import_app_data10 = require("@stencil/core/internal/app-data");
2286
2427
 
2287
2428
  // 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;
2429
+ var import_app_data9 = require("@stencil/core/internal/app-data");
2430
+ var getElement = (ref) => import_app_data9.BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
2290
2431
 
2291
2432
  // src/runtime/event-emitter.ts
2292
2433
  var createEvent = (ref, name, flags) => {
2293
2434
  const elm = getElement(ref);
2294
2435
  return {
2295
2436
  emit: (detail) => {
2296
- if (import_app_data9.BUILD.isDev && !elm.isConnected) {
2437
+ if (import_app_data10.BUILD.isDev && !elm.isConnected) {
2297
2438
  consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
2298
2439
  }
2299
2440
  return emitEvent(elm, name, {
@@ -2311,131 +2452,6 @@ var emitEvent = (elm, name, opts) => {
2311
2452
  return ev;
2312
2453
  };
2313
2454
 
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
2455
  // src/runtime/vdom/vdom-render.ts
2440
2456
  var import_app_data13 = require("@stencil/core/internal/app-data");
2441
2457
 
@@ -2454,12 +2470,13 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
2454
2470
  const classList = elm.classList;
2455
2471
  const oldClasses = parseClassList(oldValue);
2456
2472
  let newClasses = parseClassList(newValue);
2457
- if (import_app_data11.BUILD.hydrateClientSide && elm["s-si"] && initialRender) {
2458
- newClasses.push(elm["s-si"]);
2473
+ if (import_app_data11.BUILD.hydrateClientSide && (elm["s-si"] || elm["s-sc"]) && initialRender) {
2474
+ const scopeId2 = elm["s-sc"] || elm["s-si"];
2475
+ newClasses.push(scopeId2);
2459
2476
  oldClasses.forEach((c) => {
2460
- if (c.startsWith(elm["s-si"])) newClasses.push(c);
2477
+ if (c.startsWith(scopeId2)) newClasses.push(c);
2461
2478
  });
2462
- newClasses = [...new Set(newClasses)];
2479
+ newClasses = [...new Set(newClasses)].filter((c) => c);
2463
2480
  classList.add(...newClasses);
2464
2481
  } else {
2465
2482
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
@@ -3410,10 +3427,16 @@ var forceUpdate = (ref) => {
3410
3427
  return false;
3411
3428
  };
3412
3429
  var appDidLoad = (who) => {
3430
+ var _a;
3413
3431
  if (import_app_data14.BUILD.asyncQueue) {
3414
3432
  plt.$flags$ |= 2 /* appLoaded */;
3415
3433
  }
3416
3434
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: import_app_data14.NAMESPACE } }));
3435
+ if (import_app_data14.BUILD.hydrateClientSide) {
3436
+ if ((_a = plt.$orgLocNodes$) == null ? void 0 : _a.size) {
3437
+ plt.$orgLocNodes$.clear();
3438
+ }
3439
+ }
3417
3440
  if (import_app_data14.BUILD.profile && performance.measure) {
3418
3441
  performance.measure(`[Stencil] ${import_app_data14.NAMESPACE} initial load (by ${who})`, "st:app:start");
3419
3442
  }
@@ -3845,6 +3868,11 @@ var connectedCallback = (elm) => {
3845
3868
  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
3869
  cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */)) {
3847
3870
  setContentReference(elm);
3871
+ } else if (import_app_data18.BUILD.hydrateClientSide && !(cmpMeta.$flags$ & 4 /* hasSlotRelocation */)) {
3872
+ const commendPlaceholder = elm.firstChild;
3873
+ if ((commendPlaceholder == null ? void 0 : commendPlaceholder.nodeType) === 8 /* CommentNode */ && !commendPlaceholder["s-cn"] && !commendPlaceholder.nodeValue) {
3874
+ elm.removeChild(commendPlaceholder);
3875
+ }
3848
3876
  }
3849
3877
  }
3850
3878
  if (import_app_data18.BUILD.asyncLoading) {
@@ -3949,7 +3977,7 @@ var proxyCustomElement = (Cstr, compactMeta) => {
3949
3977
  cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
3950
3978
  }
3951
3979
  if (import_app_data20.BUILD.experimentalSlotFixes) {
3952
- if (import_app_data20.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
3980
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
3953
3981
  patchPseudoShadowDom(Cstr.prototype);
3954
3982
  }
3955
3983
  } else {
@@ -4166,7 +4194,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
4166
4194
  }
4167
4195
  };
4168
4196
  if (import_app_data21.BUILD.experimentalSlotFixes) {
4169
- if (import_app_data21.BUILD.scoped && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
4197
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
4170
4198
  patchPseudoShadowDom(HostElement.prototype);
4171
4199
  }
4172
4200
  } else {