marko 6.0.60 → 6.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,21 +1,21 @@
1
1
  // src/common/attr-tag.ts
2
2
  var empty = [];
3
3
  var rest = true ? Symbol("Attribute Tag") : Symbol();
4
- function attrTag(attrs2) {
5
- attrs2[Symbol.iterator] = attrTagIterator;
6
- attrs2[rest] = empty;
7
- return attrs2;
4
+ function attrTag(attrs) {
5
+ attrs[Symbol.iterator] = attrTagIterator;
6
+ attrs[rest] = empty;
7
+ return attrs;
8
8
  }
9
- function attrTags(first, attrs2) {
9
+ function attrTags(first, attrs) {
10
10
  if (first) {
11
11
  if (first[rest] === empty) {
12
- first[rest] = [attrs2];
12
+ first[rest] = [attrs];
13
13
  } else {
14
- first[rest].push(attrs2);
14
+ first[rest].push(attrs);
15
15
  }
16
16
  return first;
17
17
  }
18
- return attrTag(attrs2);
18
+ return attrTag(attrs);
19
19
  }
20
20
  function* attrTagIterator() {
21
21
  yield this;
@@ -76,13 +76,13 @@ function normalizeDynamicRenderer(value) {
76
76
  }
77
77
 
78
78
  // src/html/content.ts
79
- function toString(val) {
79
+ function _unescaped(val) {
80
80
  return val ? val + "" : val === 0 ? "0" : "";
81
81
  }
82
82
  var unsafeXMLReg = /[<&]/g;
83
83
  var replaceUnsafeXML = (c) => c === "&" ? "&amp;" : "&lt;";
84
84
  var escapeXMLStr = (str) => unsafeXMLReg.test(str) ? str.replace(unsafeXMLReg, replaceUnsafeXML) : str;
85
- function escapeXML(val) {
85
+ function _escape(val) {
86
86
  return val ? escapeXMLStr(val + "") : val === 0 ? "0" : "&zwj;";
87
87
  }
88
88
  function escapeTextAreaValue(val) {
@@ -90,12 +90,12 @@ function escapeTextAreaValue(val) {
90
90
  }
91
91
  var unsafeScriptReg = /<\/script/g;
92
92
  var escapeScriptStr = (str) => unsafeScriptReg.test(str) ? str.replace(unsafeScriptReg, "\\x3C/script") : str;
93
- function escapeScript(val) {
93
+ function _escape_script(val) {
94
94
  return val ? escapeScriptStr(val + "") : val === 0 ? "0" : "";
95
95
  }
96
96
  var unsafeStyleReg = /<\/style/g;
97
97
  var escapeStyleStr = (str) => unsafeStyleReg.test(str) ? str.replace(unsafeStyleReg, "\\3C/style") : str;
98
- function escapeStyle(val) {
98
+ function _escape_style(val) {
99
99
  return val ? escapeStyleStr(val + "") : val === 0 ? "0" : "";
100
100
  }
101
101
 
@@ -701,7 +701,7 @@ function writeProp(state, val, parent, accessor) {
701
701
  return false;
702
702
  }
703
703
  }
704
- function writeReferenceOr(state, write2, val, parent, accessor) {
704
+ function writeReferenceOr(state, write, val, parent, accessor) {
705
705
  let ref = state.refs.get(val);
706
706
  if (ref) {
707
707
  if (ref.init) {
@@ -729,7 +729,7 @@ function writeReferenceOr(state, write2, val, parent, accessor) {
729
729
  if (true) {
730
730
  ref.debug = DEBUG.get(val);
731
731
  }
732
- if (write2(state, val, ref)) return true;
732
+ if (write(state, val, ref)) return true;
733
733
  state.refs.delete(ref);
734
734
  return false;
735
735
  }
@@ -1610,20 +1610,20 @@ function getState() {
1610
1610
  function getScopeId(scope) {
1611
1611
  return scope[K_SCOPE_ID];
1612
1612
  }
1613
- function write(html) {
1613
+ function _html(html) {
1614
1614
  $chunk.writeHTML(html);
1615
1615
  }
1616
1616
  function writeScript(script) {
1617
1617
  $chunk.writeScript(script);
1618
1618
  }
1619
- function writeEffect(scopeId, registryId) {
1619
+ function _script(scopeId, registryId) {
1620
1620
  $chunk.boundary.state.needsMainRuntime = true;
1621
1621
  $chunk.writeEffect(scopeId, registryId);
1622
1622
  }
1623
- function writeContent(nodeAccessor, scopeId, content, serializeReason) {
1623
+ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1624
1624
  const shouldResume = serializeReason !== 0;
1625
1625
  const render2 = normalizeServerRender(content);
1626
- const branchId = peekNextScopeId();
1626
+ const branchId = _peek_scope_id();
1627
1627
  if (render2) {
1628
1628
  if (shouldResume) {
1629
1629
  withBranchId(branchId, render2);
@@ -1631,7 +1631,7 @@ function writeContent(nodeAccessor, scopeId, content, serializeReason) {
1631
1631
  render2();
1632
1632
  }
1633
1633
  }
1634
- const rendered = peekNextScopeId() !== branchId;
1634
+ const rendered = _peek_scope_id() !== branchId;
1635
1635
  if (rendered) {
1636
1636
  if (shouldResume) {
1637
1637
  writeScope(scopeId, {
@@ -1643,7 +1643,7 @@ function writeContent(nodeAccessor, scopeId, content, serializeReason) {
1643
1643
  });
1644
1644
  }
1645
1645
  } else {
1646
- nextScopeId();
1646
+ _scope_id();
1647
1647
  }
1648
1648
  }
1649
1649
  function normalizeServerRender(value) {
@@ -1671,26 +1671,26 @@ function withContext(key, value, cb) {
1671
1671
  ctx[key] = prev;
1672
1672
  }
1673
1673
  }
1674
- function setTagVar(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
1675
- ensureScopeWithId(parentScopeId)[scopeOffsetAccessor] = nextScopeId();
1676
- ensureScopeWithId(childScopeId)["#TagVariable" /* TagVariable */] = register2(
1674
+ function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
1675
+ _scope_with_id(parentScopeId)[scopeOffsetAccessor] = _scope_id();
1676
+ _scope_with_id(childScopeId)["#TagVariable" /* TagVariable */] = _resume(
1677
1677
  {},
1678
1678
  registryId,
1679
1679
  parentScopeId
1680
1680
  );
1681
1681
  }
1682
- function register2(val, id, scopeId) {
1683
- return scopeId === void 0 ? register(id, val) : register(id, val, ensureScopeWithId(scopeId));
1682
+ function _resume(val, id, scopeId) {
1683
+ return scopeId === void 0 ? register(id, val) : register(id, val, _scope_with_id(scopeId));
1684
1684
  }
1685
- function nextTagId() {
1685
+ function _id() {
1686
1686
  const state = $chunk.boundary.state;
1687
1687
  const { $global: $global2 } = state;
1688
1688
  return "s" + $global2.runtimeId + $global2.renderId + (state.tagId++).toString(36);
1689
1689
  }
1690
- function nextScopeId() {
1690
+ function _scope_id() {
1691
1691
  return $chunk.boundary.state.scopeId++;
1692
1692
  }
1693
- function peekNextScopeId() {
1693
+ function _peek_scope_id() {
1694
1694
  return $chunk.boundary.state.scopeId;
1695
1695
  }
1696
1696
  function getScopeById(scopeId) {
@@ -1698,39 +1698,39 @@ function getScopeById(scopeId) {
1698
1698
  return $chunk.boundary.state.scopes.get(scopeId);
1699
1699
  }
1700
1700
  }
1701
- function serializeIf(condition, key) {
1701
+ function _serialize_if(condition, key) {
1702
1702
  return condition && (condition === 1 || condition[key]) ? 1 : void 0;
1703
1703
  }
1704
- function serializeGuard(condition, key) {
1704
+ function _serialize_guard(condition, key) {
1705
1705
  return condition && (condition === 1 || condition[key]) ? 1 : 0;
1706
1706
  }
1707
- function markResumeNode(scopeId, accessor, shouldResume) {
1707
+ function _el_resume(scopeId, accessor, shouldResume) {
1708
1708
  if (shouldResume === 0) return "";
1709
1709
  const { state } = $chunk.boundary;
1710
1710
  state.needsMainRuntime = true;
1711
1711
  return state.mark("*" /* Node */, scopeId + " " + accessor);
1712
1712
  }
1713
- function commentSeparator(shouldResume) {
1713
+ function _sep(shouldResume) {
1714
1714
  return shouldResume === 0 ? "" : "<!>";
1715
1715
  }
1716
- function nodeRef(scopeId, id) {
1716
+ function _el(scopeId, id) {
1717
1717
  const getter = () => {
1718
1718
  if (true) {
1719
1719
  throw new Error("Cannot read a node reference on the server.");
1720
1720
  }
1721
1721
  };
1722
- return id ? register2(getter, id, scopeId) : getter;
1722
+ return id ? _resume(getter, id, scopeId) : getter;
1723
1723
  }
1724
- function hoist(scopeId, id) {
1724
+ function _hoist(scopeId, id) {
1725
1725
  const getter = () => {
1726
1726
  if (true) {
1727
1727
  throw new Error("Cannot read a hoisted value on the server.");
1728
1728
  }
1729
1729
  };
1730
1730
  getter[Symbol.iterator] = getter;
1731
- return id ? register2(getter, id, scopeId) : getter;
1731
+ return id ? _resume(getter, id, scopeId) : getter;
1732
1732
  }
1733
- function resumeClosestBranch(scopeId) {
1733
+ function _resume_branch(scopeId) {
1734
1734
  const branchId = $chunk.context?.[branchIdKey];
1735
1735
  if (branchId !== void 0 && branchId !== scopeId) {
1736
1736
  writeScope(scopeId, { ["#ClosestBranchId" /* ClosestBranchId */]: branchId });
@@ -1743,22 +1743,23 @@ function isInResumedBranch() {
1743
1743
  function withBranchId(branchId, cb) {
1744
1744
  return withContext(branchIdKey, branchId, cb);
1745
1745
  }
1746
- function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1746
+ function _for_of(list, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1747
1747
  const { state } = $chunk.boundary;
1748
1748
  const resumeBranch = serializeBranch !== 0;
1749
1749
  const resumeMarker = serializeMarker !== 0;
1750
- let singleNodeBranchIds = "";
1750
+ let flushBranchIds = "";
1751
1751
  if (resumeBranch) {
1752
1752
  const loopScopes = /* @__PURE__ */ new Map();
1753
1753
  forOf(list, (item, index) => {
1754
- const branchId = peekNextScopeId();
1754
+ const branchId = _peek_scope_id();
1755
1755
  if (resumeMarker) {
1756
1756
  if (singleNode) {
1757
- singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
1757
+ flushBranchIds = " " + branchId + flushBranchIds;
1758
1758
  } else {
1759
1759
  $chunk.writeHTML(
1760
- state.mark("[" /* BranchStart */, branchId + (index ? " " : ""))
1760
+ state.mark("[" /* BranchStart */, flushBranchIds)
1761
1761
  );
1762
+ flushBranchIds = branchId + "";
1762
1763
  }
1763
1764
  }
1764
1765
  withBranchId(branchId, () => {
@@ -1777,32 +1778,30 @@ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch, serialize
1777
1778
  writeBranchEnd(
1778
1779
  scopeId,
1779
1780
  accessor,
1781
+ resumeBranch,
1780
1782
  resumeMarker,
1781
1783
  parentEndTag,
1782
- resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
1783
- parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1784
- scopeId + " " + accessor + singleNodeBranchIds
1785
- ) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
1784
+ singleNode,
1785
+ singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
1786
1786
  );
1787
1787
  }
1788
- function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1788
+ function _for_in(obj, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1789
1789
  const { state } = $chunk.boundary;
1790
1790
  const resumeBranch = serializeBranch !== 0;
1791
1791
  const resumeMarker = serializeMarker !== 0;
1792
- let singleNodeBranchIds = "";
1792
+ let flushBranchIds = "";
1793
1793
  if (resumeBranch) {
1794
1794
  const loopScopes = /* @__PURE__ */ new Map();
1795
- let sep = "";
1796
1795
  forIn(obj, (key, value) => {
1797
- const branchId = peekNextScopeId();
1796
+ const branchId = _peek_scope_id();
1798
1797
  if (resumeMarker) {
1799
1798
  if (singleNode) {
1800
- singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
1799
+ flushBranchIds = " " + branchId + flushBranchIds;
1801
1800
  } else {
1802
1801
  $chunk.writeHTML(
1803
- state.mark("[" /* BranchStart */, branchId + sep)
1802
+ state.mark("[" /* BranchStart */, flushBranchIds)
1804
1803
  );
1805
- sep = " ";
1804
+ flushBranchIds = branchId + "";
1806
1805
  }
1807
1806
  }
1808
1807
  withBranchId(branchId, () => {
@@ -1821,32 +1820,30 @@ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch, serializeM
1821
1820
  writeBranchEnd(
1822
1821
  scopeId,
1823
1822
  accessor,
1823
+ resumeBranch,
1824
1824
  resumeMarker,
1825
1825
  parentEndTag,
1826
- resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
1827
- parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1828
- scopeId + " " + accessor + singleNodeBranchIds
1829
- ) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
1826
+ singleNode,
1827
+ singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
1830
1828
  );
1831
1829
  }
1832
- function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1830
+ function _for_to(to, from, step, cb, by, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1833
1831
  const { state } = $chunk.boundary;
1834
1832
  const resumeBranch = serializeBranch !== 0;
1835
1833
  const resumeMarker = serializeMarker !== 0;
1836
- let singleNodeBranchIds = "";
1834
+ let flushBranchIds = "";
1837
1835
  if (resumeBranch) {
1838
1836
  const loopScopes = /* @__PURE__ */ new Map();
1839
- let sep = "";
1840
1837
  forTo(to, from, step, (i) => {
1841
- const branchId = peekNextScopeId();
1838
+ const branchId = _peek_scope_id();
1842
1839
  if (resumeMarker) {
1843
1840
  if (singleNode) {
1844
- singleNodeBranchIds = " " + branchId + singleNodeBranchIds;
1841
+ flushBranchIds = " " + branchId + flushBranchIds;
1845
1842
  } else {
1846
1843
  $chunk.writeHTML(
1847
- state.mark("[" /* BranchStart */, branchId + sep)
1844
+ state.mark("[" /* BranchStart */, flushBranchIds)
1848
1845
  );
1849
- sep = " ";
1846
+ flushBranchIds = branchId + "";
1850
1847
  }
1851
1848
  }
1852
1849
  withBranchId(branchId, () => {
@@ -1865,21 +1862,20 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch,
1865
1862
  writeBranchEnd(
1866
1863
  scopeId,
1867
1864
  accessor,
1865
+ resumeBranch,
1868
1866
  resumeMarker,
1869
1867
  parentEndTag,
1870
- resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
1871
- parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1872
- scopeId + " " + accessor + singleNodeBranchIds
1873
- ) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
1868
+ singleNode,
1869
+ singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : ""
1874
1870
  );
1875
1871
  }
1876
- function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1872
+ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, parentEndTag, singleNode) {
1877
1873
  const { state } = $chunk.boundary;
1878
1874
  const resumeBranch = serializeBranch !== 0;
1879
1875
  const resumeMarker = serializeMarker !== 0;
1880
- const branchId = peekNextScopeId();
1876
+ const branchId = _peek_scope_id();
1881
1877
  if (resumeMarker && resumeBranch && !singleNode) {
1882
- $chunk.writeHTML(state.mark("[" /* BranchStart */, branchId + ""));
1878
+ $chunk.writeHTML(state.mark("[" /* BranchStart */, ""));
1883
1879
  }
1884
1880
  const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
1885
1881
  const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
@@ -1892,21 +1888,28 @@ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMark
1892
1888
  writeBranchEnd(
1893
1889
  scopeId,
1894
1890
  accessor,
1891
+ resumeBranch,
1895
1892
  resumeMarker,
1896
1893
  parentEndTag,
1897
- resumeMarker && (!parentEndTag || resumeBranch) && (singleNode ? state.mark(
1898
- parentEndTag ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1899
- scopeId + " " + accessor + (shouldWriteBranch ? " " + branchId : "")
1900
- ) : state.mark("]" /* BranchEnd */, scopeId + " " + accessor))
1894
+ singleNode,
1895
+ shouldWriteBranch ? " " + branchId : ""
1901
1896
  );
1902
1897
  }
1903
- function writeBranchEnd(scopeId, accessor, resumeMarker, parentEndTag, mark) {
1898
+ function writeBranchEnd(scopeId, accessor, resumeBranch, resumeMarker, parentEndTag, singleNode, branchIds) {
1904
1899
  const endTag = parentEndTag || "";
1905
1900
  if (resumeMarker) {
1906
- if (mark) {
1901
+ if (!parentEndTag || resumeBranch) {
1902
+ const { state } = $chunk.boundary;
1903
+ const mark = singleNode ? state.mark(
1904
+ parentEndTag ? "}" /* BranchEndSingleNodeOnlyChildInParent */ : "|" /* BranchEndSingleNode */,
1905
+ scopeId + " " + accessor + (branchIds || "")
1906
+ ) : state.mark(
1907
+ parentEndTag ? ")" /* BranchEndOnlyChildInParent */ : "]" /* BranchEnd */,
1908
+ scopeId + " " + accessor + (branchIds || "")
1909
+ );
1907
1910
  $chunk.writeHTML(mark + endTag);
1908
1911
  } else {
1909
- $chunk.writeHTML(endTag + markResumeNode(scopeId, accessor));
1912
+ $chunk.writeHTML(endTag + _el_resume(scopeId, accessor));
1910
1913
  }
1911
1914
  } else {
1912
1915
  $chunk.writeHTML(endTag);
@@ -1942,10 +1945,10 @@ if (true) {
1942
1945
  return scope;
1943
1946
  })(writeScope);
1944
1947
  }
1945
- function writeExistingScope(scopeId) {
1946
- return writeScope(scopeId, ensureScopeWithId(scopeId));
1948
+ function _existing_scope(scopeId) {
1949
+ return writeScope(scopeId, _scope_with_id(scopeId));
1947
1950
  }
1948
- function ensureScopeWithId(scopeId) {
1951
+ function _scope_with_id(scopeId) {
1949
1952
  const { state } = $chunk.boundary;
1950
1953
  let scope = state.scopes.get(scopeId);
1951
1954
  if (!scope) {
@@ -1957,13 +1960,13 @@ function ensureScopeWithId(scopeId) {
1957
1960
  function $global() {
1958
1961
  return $chunk.boundary.state.$global;
1959
1962
  }
1960
- function fork(scopeId, accessor, promise, content, serializeMarker) {
1963
+ function _await(scopeId, accessor, promise, content, serializeMarker) {
1961
1964
  const resumeMarker = serializeMarker !== 0;
1962
1965
  if (!isPromise(promise)) {
1963
1966
  if (resumeMarker) {
1964
- const branchId = peekNextScopeId();
1967
+ const branchId = _peek_scope_id();
1965
1968
  $chunk.writeHTML(
1966
- $chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
1969
+ $chunk.boundary.state.mark("[" /* BranchStart */, "")
1967
1970
  );
1968
1971
  content(promise);
1969
1972
  writeScope(scopeId, {
@@ -1972,7 +1975,7 @@ function fork(scopeId, accessor, promise, content, serializeMarker) {
1972
1975
  $chunk.writeHTML(
1973
1976
  $chunk.boundary.state.mark(
1974
1977
  "]" /* BranchEnd */,
1975
- scopeId + " " + accessor
1978
+ scopeId + " " + accessor + " " + branchId
1976
1979
  )
1977
1980
  );
1978
1981
  } else {
@@ -1995,23 +1998,20 @@ function fork(scopeId, accessor, promise, content, serializeMarker) {
1995
1998
  if (!boundary.signal.aborted) {
1996
1999
  chunk.render(() => {
1997
2000
  if (resumeMarker) {
1998
- const branchId = peekNextScopeId();
2001
+ const branchId = _peek_scope_id();
1999
2002
  $chunk.writeHTML(
2000
- $chunk.boundary.state.mark(
2001
- "[" /* BranchStart */,
2002
- branchId + ""
2003
- )
2003
+ $chunk.boundary.state.mark("[" /* BranchStart */, "")
2004
2004
  );
2005
2005
  content(value);
2006
2006
  boundary.state.serializer.writeAssign(
2007
2007
  writeScope(branchId, {}),
2008
- ensureScopeWithId(scopeId),
2008
+ _scope_with_id(scopeId),
2009
2009
  "ConditionalScope:" /* ConditionalScope */ + accessor
2010
2010
  );
2011
2011
  $chunk.writeHTML(
2012
2012
  $chunk.boundary.state.mark(
2013
2013
  "]" /* BranchEnd */,
2014
- scopeId + " " + accessor
2014
+ scopeId + " " + accessor + " " + branchId
2015
2015
  )
2016
2016
  );
2017
2017
  } else {
@@ -2028,11 +2028,9 @@ function fork(scopeId, accessor, promise, content, serializeMarker) {
2028
2028
  }
2029
2029
  );
2030
2030
  }
2031
- function tryContent(scopeId, accessor, content, input) {
2032
- const branchId = peekNextScopeId();
2033
- $chunk.writeHTML(
2034
- $chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
2035
- );
2031
+ function _try(scopeId, accessor, content, input) {
2032
+ const branchId = _peek_scope_id();
2033
+ $chunk.writeHTML($chunk.boundary.state.mark("[" /* BranchStart */, ""));
2036
2034
  const catchContent = normalizeDynamicRenderer(input.catch);
2037
2035
  const placeholderContent = normalizeDynamicRenderer(input.placeholder);
2038
2036
  if (catchContent) {
@@ -2056,7 +2054,7 @@ function tryContent(scopeId, accessor, content, input) {
2056
2054
  $chunk.writeHTML(
2057
2055
  $chunk.boundary.state.mark(
2058
2056
  "]" /* BranchEnd */,
2059
- scopeId + " " + accessor
2057
+ scopeId + " " + accessor + " " + branchId
2060
2058
  )
2061
2059
  );
2062
2060
  }
@@ -2472,7 +2470,7 @@ function flushSerializer(boundary) {
2472
2470
  }
2473
2471
  }
2474
2472
  }
2475
- function writeTrailers(html) {
2473
+ function _trailers(html) {
2476
2474
  $chunk.boundary.state.trailerHTML += html;
2477
2475
  }
2478
2476
  function concatEffects(a, b) {
@@ -2536,24 +2534,24 @@ function getFilteredGlobals($global2) {
2536
2534
  }
2537
2535
  return filtered;
2538
2536
  }
2539
- function writeSubscribe(subscribers, scope) {
2537
+ function _subscribe(subscribers, scope) {
2540
2538
  $chunk.boundary.state.serializer.writeCall(scope, subscribers, "add");
2541
2539
  return scope;
2542
2540
  }
2543
2541
 
2544
2542
  // src/html/attrs.ts
2545
- function classAttr(value) {
2543
+ function _attr_class(value) {
2546
2544
  return stringAttr("class", classValue(value));
2547
2545
  }
2548
- function styleAttr(value) {
2546
+ function _attr_style(value) {
2549
2547
  return stringAttr("style", styleValue(value));
2550
2548
  }
2551
- function optionValueAttr(value) {
2549
+ function _attr_option_value(value) {
2552
2550
  const selectedValue = getContext(kSelectedValue);
2553
- return attr("value", value) + (!isVoid(value) && (Array.isArray(selectedValue) ? selectedValue.includes(value) : selectedValue === value) ? " selected" : "");
2551
+ return _attr("value", value) + (!isVoid(value) && (Array.isArray(selectedValue) ? selectedValue.includes(value) : selectedValue === value) ? " selected" : "");
2554
2552
  }
2555
2553
  var kSelectedValue = Symbol("selectedValue");
2556
- function controllable_select_value(scopeId, nodeAccessor, value, valueChange, content) {
2554
+ function _attr_select_value(scopeId, nodeAccessor, value, valueChange, content) {
2557
2555
  if (valueChange) {
2558
2556
  writeControlledScope(
2559
2557
  3 /* SelectValue */,
@@ -2567,7 +2565,7 @@ function controllable_select_value(scopeId, nodeAccessor, value, valueChange, co
2567
2565
  withContext(kSelectedValue, value, content);
2568
2566
  }
2569
2567
  }
2570
- function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2568
+ function _attr_textarea_value(scopeId, nodeAccessor, value, valueChange) {
2571
2569
  if (valueChange) {
2572
2570
  writeControlledScope(
2573
2571
  2 /* InputValue */,
@@ -2579,7 +2577,7 @@ function controllable_textarea_value(scopeId, nodeAccessor, value, valueChange)
2579
2577
  }
2580
2578
  return escapeTextAreaValue(value);
2581
2579
  }
2582
- function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
2580
+ function _attr_input_value(scopeId, nodeAccessor, value, valueChange) {
2583
2581
  if (valueChange) {
2584
2582
  writeControlledScope(
2585
2583
  2 /* InputValue */,
@@ -2589,9 +2587,9 @@ function controllable_input_value(scopeId, nodeAccessor, value, valueChange) {
2589
2587
  valueChange
2590
2588
  );
2591
2589
  }
2592
- return attr("value", value);
2590
+ return _attr("value", value);
2593
2591
  }
2594
- function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
2592
+ function _attr_input_checked(scopeId, nodeAccessor, checked, checkedChange) {
2595
2593
  if (checkedChange) {
2596
2594
  writeControlledScope(
2597
2595
  0 /* InputChecked */,
@@ -2601,11 +2599,11 @@ function controllable_input_checked(scopeId, nodeAccessor, checked, checkedChang
2601
2599
  checkedChange
2602
2600
  );
2603
2601
  }
2604
- return attr("checked", checked);
2602
+ return _attr("checked", checked);
2605
2603
  }
2606
- function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
2604
+ function _attr_input_checkedValue(scopeId, nodeAccessor, checkedValue, checkedValueChange, value) {
2607
2605
  const multiple = Array.isArray(checkedValue);
2608
- const valueAttr = attr("value", value);
2606
+ const valueAttr = _attr("value", value);
2609
2607
  if (checkedValueChange) {
2610
2608
  writeControlledScope(
2611
2609
  1 /* InputCheckedValue */,
@@ -2617,7 +2615,7 @@ function controllable_input_checkedValue(scopeId, nodeAccessor, checkedValue, ch
2617
2615
  }
2618
2616
  return (multiple ? checkedValue.includes(value) : checkedValue === value) ? valueAttr + " checked" : valueAttr;
2619
2617
  }
2620
- function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChange) {
2618
+ function _attr_details_or_dialog_open(scopeId, nodeAccessor, open, openChange) {
2621
2619
  if (openChange) {
2622
2620
  writeControlledScope(
2623
2621
  4 /* DetailsOrDialogOpen */,
@@ -2627,26 +2625,26 @@ function controllable_detailsOrDialog_open(scopeId, nodeAccessor, open, openChan
2627
2625
  openChange
2628
2626
  );
2629
2627
  }
2630
- return attr("open", open);
2628
+ return _attr("open", open);
2631
2629
  }
2632
- function attr(name, value) {
2630
+ function _attr(name, value) {
2633
2631
  return isVoid(value) ? "" : nonVoidAttr(name, value);
2634
2632
  }
2635
- function attrs(data, nodeAccessor, scopeId, tagName) {
2633
+ function _attrs(data, nodeAccessor, scopeId, tagName) {
2636
2634
  let result = "";
2637
2635
  let skip = /[\s/>"'=]/;
2638
2636
  let events;
2639
2637
  switch (tagName) {
2640
2638
  case "input":
2641
2639
  if (data.checkedChange) {
2642
- result += controllable_input_checked(
2640
+ result += _attr_input_checked(
2643
2641
  scopeId,
2644
2642
  nodeAccessor,
2645
2643
  data.checked,
2646
2644
  data.checkedChange
2647
2645
  );
2648
2646
  } else if (data.checkedValue || data.checkedValueChange) {
2649
- result += controllable_input_checkedValue(
2647
+ result += _attr_input_checkedValue(
2650
2648
  scopeId,
2651
2649
  nodeAccessor,
2652
2650
  data.checkedValue,
@@ -2654,7 +2652,7 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
2654
2652
  data.value
2655
2653
  );
2656
2654
  } else if (data.valueChange) {
2657
- result += controllable_input_value(
2655
+ result += _attr_input_value(
2658
2656
  scopeId,
2659
2657
  nodeAccessor,
2660
2658
  data.value,
@@ -2673,14 +2671,14 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
2673
2671
  break;
2674
2672
  case "option":
2675
2673
  if (data.value) {
2676
- result += optionValueAttr(data.value);
2674
+ result += _attr_option_value(data.value);
2677
2675
  skip = /^value$|[\s/>"'=]/;
2678
2676
  }
2679
2677
  break;
2680
2678
  case "details":
2681
2679
  case "dialog":
2682
2680
  if (data.openChange) {
2683
- result += controllable_detailsOrDialog_open(
2681
+ result += _attr_details_or_dialog_open(
2684
2682
  scopeId,
2685
2683
  nodeAccessor,
2686
2684
  data.open,
@@ -2694,10 +2692,10 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
2694
2692
  const value = data[name];
2695
2693
  switch (name) {
2696
2694
  case "class":
2697
- result += classAttr(value);
2695
+ result += _attr_class(value);
2698
2696
  break;
2699
2697
  case "style":
2700
- result += styleAttr(value);
2698
+ result += _attr_style(value);
2701
2699
  break;
2702
2700
  default:
2703
2701
  if (name && !(isVoid(value) || skip.test(name) || name === "content" && tagName !== "meta")) {
@@ -2718,20 +2716,20 @@ function attrs(data, nodeAccessor, scopeId, tagName) {
2718
2716
  }
2719
2717
  return result;
2720
2718
  }
2721
- function writeAttrsAndContent(data, nodeAccessor, scopeId, tagName, serializeReason) {
2722
- write(`${attrs(data, nodeAccessor, scopeId, tagName)}>`);
2723
- writeContent(nodeAccessor, scopeId, data?.content, serializeReason);
2719
+ function _attrs_content(data, nodeAccessor, scopeId, tagName, serializeReason) {
2720
+ _html(`${_attrs(data, nodeAccessor, scopeId, tagName)}>`);
2721
+ _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
2724
2722
  }
2725
- function partialAttrs(data, skip, nodeAccessor, scopeId, tagName) {
2723
+ function _attrs_partial(data, skip, nodeAccessor, scopeId, tagName) {
2726
2724
  const partial = {};
2727
2725
  for (const key in data) {
2728
2726
  if (!skip[key]) partial[key] = data[key];
2729
2727
  }
2730
- return attrs(partial, nodeAccessor, scopeId, tagName);
2728
+ return _attrs(partial, nodeAccessor, scopeId, tagName);
2731
2729
  }
2732
- function writePartialAttrsAndContent(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
2733
- write(`${partialAttrs(data, skip, nodeAccessor, scopeId, tagName)}>`);
2734
- writeContent(nodeAccessor, scopeId, data?.content, serializeReason);
2730
+ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, serializeReason) {
2731
+ _html(`${_attrs_partial(data, skip, nodeAccessor, scopeId, tagName)}>`);
2732
+ _attr_content(nodeAccessor, scopeId, data?.content, serializeReason);
2735
2733
  }
2736
2734
  function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange) {
2737
2735
  writeScope(scopeId, {
@@ -2795,7 +2793,7 @@ var DEFAULT_RUNTIME_ID = "M";
2795
2793
  var DEFAULT_RENDER_ID = "_";
2796
2794
 
2797
2795
  // src/html/template.ts
2798
- var createTemplate = (templateId, renderer) => {
2796
+ var _template = (templateId, renderer) => {
2799
2797
  renderer.render = render;
2800
2798
  renderer._ = renderer;
2801
2799
  if (true) {
@@ -2805,7 +2803,7 @@ var createTemplate = (templateId, renderer) => {
2805
2803
  );
2806
2804
  };
2807
2805
  }
2808
- return registerContent(templateId, renderer);
2806
+ return _content_resume(templateId, renderer);
2809
2807
  };
2810
2808
  function isTemplate(renderer) {
2811
2809
  return !!renderer._;
@@ -2993,14 +2991,14 @@ var ServerRendered = class {
2993
2991
  return;
2994
2992
  }
2995
2993
  const { boundary } = head;
2996
- const onNext = boundary.onNext = (write2) => {
2994
+ const onNext = boundary.onNext = (write) => {
2997
2995
  if (boundary.signal.aborted) {
2998
2996
  if (!tick2) offTick(onNext);
2999
2997
  boundary.onNext = NOOP2;
3000
2998
  onAbort(boundary.signal.reason);
3001
2999
  } else {
3002
3000
  const { done } = boundary;
3003
- if (done || write2) {
3001
+ if (done || write) {
3004
3002
  const html = (head = head.consume()).flushHTML();
3005
3003
  if (html) onWrite(html);
3006
3004
  if (done) {
@@ -3035,7 +3033,7 @@ function NOOP2() {
3035
3033
 
3036
3034
  // src/html/dynamic-tag.ts
3037
3035
  var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/;
3038
- var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
3036
+ var _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, serializeReason) => {
3039
3037
  const shouldResume = serializeReason !== 0;
3040
3038
  const renderer = normalizeDynamicRenderer(tag);
3041
3039
  if (true) {
@@ -3044,13 +3042,15 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
3044
3042
  }
3045
3043
  }
3046
3044
  const state = getState();
3047
- const branchId = peekNextScopeId();
3045
+ const branchId = _peek_scope_id();
3046
+ let rendered = false;
3048
3047
  let result;
3049
3048
  if (typeof renderer === "string") {
3050
3049
  const input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
3051
- nextScopeId();
3052
- write(
3053
- `<${renderer}${attrs(input, true ? `#${renderer}/0` : 0, branchId, renderer)}>`
3050
+ rendered = true;
3051
+ _scope_id();
3052
+ _html(
3053
+ `<${renderer}${_attrs(input, true ? `#${renderer}/0` : 0, branchId, renderer)}>`
3054
3054
  );
3055
3055
  if (!voidElementsReg.test(renderer)) {
3056
3056
  const renderContent = content || normalizeDynamicRenderer(input.content);
@@ -3060,8 +3060,8 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
3060
3060
  "A dynamic tag rendering a `<textarea>` cannot have `content` and must use the `value` attribute instead."
3061
3061
  );
3062
3062
  }
3063
- write(
3064
- controllable_textarea_value(
3063
+ _html(
3064
+ _attr_textarea_value(
3065
3065
  branchId,
3066
3066
  true ? `#${renderer}/0` : 0,
3067
3067
  input.value,
@@ -3075,7 +3075,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
3075
3075
  );
3076
3076
  }
3077
3077
  if (renderer === "select" && ("value" in input || "valueChange" in input)) {
3078
- controllable_select_value(
3078
+ _attr_select_value(
3079
3079
  branchId,
3080
3080
  true ? `#${renderer}/0` : 0,
3081
3081
  input.value,
@@ -3083,7 +3083,7 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
3083
3083
  renderContent
3084
3084
  );
3085
3085
  } else {
3086
- dynamicTag(
3086
+ _dynamic_tag(
3087
3087
  branchId,
3088
3088
  true ? `#${renderer}/0` : 0,
3089
3089
  renderContent,
@@ -3094,23 +3094,23 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
3094
3094
  );
3095
3095
  }
3096
3096
  }
3097
- write(`</${renderer}>`);
3097
+ _html(`</${renderer}>`);
3098
3098
  } else if (content) {
3099
3099
  throw new Error(
3100
3100
  `Body content is not supported for the \`<${renderer}>\` tag.`
3101
3101
  );
3102
3102
  }
3103
3103
  if (shouldResume) {
3104
- write(
3104
+ _html(
3105
3105
  state.mark(
3106
- "'" /* BranchNativeTag */,
3106
+ "'" /* BranchEndNativeTag */,
3107
3107
  scopeId + " " + accessor + " " + branchId
3108
3108
  )
3109
3109
  );
3110
3110
  }
3111
3111
  } else {
3112
3112
  if (shouldResume) {
3113
- write(state.mark("[" /* BranchStart */, branchId + ""));
3113
+ _html(state.mark("[" /* BranchStart */, ""));
3114
3114
  }
3115
3115
  const render2 = () => {
3116
3116
  if (renderer) {
@@ -3129,11 +3129,16 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
3129
3129
  }
3130
3130
  };
3131
3131
  result = shouldResume ? withBranchId(branchId, render2) : render2();
3132
+ rendered = _peek_scope_id() !== branchId;
3132
3133
  if (shouldResume) {
3133
- write(state.mark("]" /* BranchEnd */, scopeId + " " + accessor));
3134
+ _html(
3135
+ state.mark(
3136
+ "]" /* BranchEnd */,
3137
+ scopeId + " " + accessor + (rendered ? " " + branchId : "")
3138
+ )
3139
+ );
3134
3140
  }
3135
3141
  }
3136
- const rendered = peekNextScopeId() !== branchId;
3137
3142
  if (rendered) {
3138
3143
  if (shouldResume) {
3139
3144
  writeScope(scopeId, {
@@ -3142,19 +3147,19 @@ var dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, ser
3142
3147
  });
3143
3148
  }
3144
3149
  } else {
3145
- nextScopeId();
3150
+ _scope_id();
3146
3151
  }
3147
3152
  return result;
3148
3153
  };
3149
- function createContent(id, fn) {
3154
+ function _content(id, fn) {
3150
3155
  fn.___id = id;
3151
3156
  return fn;
3152
3157
  }
3153
- function registerContent(id, fn, scopeId) {
3154
- return register2(createContent(id, fn), id, scopeId);
3158
+ function _content_resume(id, fn, scopeId) {
3159
+ return _resume(_content(id, fn), id, scopeId);
3155
3160
  }
3156
3161
  function patchDynamicTag(patch) {
3157
- dynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
3162
+ _dynamic_tag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
3158
3163
  const patched = patch(scopeId, accessor, tag);
3159
3164
  if (patched !== tag) patched.___id = tag;
3160
3165
  return originalDynamicTag(
@@ -3166,7 +3171,7 @@ function patchDynamicTag(patch) {
3166
3171
  inputIsArgs,
3167
3172
  resume
3168
3173
  );
3169
- })(dynamicTag);
3174
+ })(_dynamic_tag);
3170
3175
  }
3171
3176
 
3172
3177
  // src/html/compat.ts
@@ -3174,11 +3179,11 @@ var K_TAGS_API_STATE = Symbol();
3174
3179
  var COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap();
3175
3180
  var compat = {
3176
3181
  $global,
3177
- fork,
3178
- write,
3182
+ fork: _await,
3183
+ write: _html,
3179
3184
  writeScript,
3180
- nextScopeId,
3181
- peekNextScopeId,
3185
+ nextScopeId: _scope_id,
3186
+ peekNextScopeId: _peek_scope_id,
3182
3187
  isInResumedBranch,
3183
3188
  ensureState($global2) {
3184
3189
  let state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
@@ -3202,7 +3207,7 @@ var compat = {
3202
3207
  patchDynamicTag,
3203
3208
  writeSetScopeForComponent(branchId, m5c) {
3204
3209
  writeScope(branchId, { m5c });
3205
- writeEffect(branchId, SET_SCOPE_REGISTER_ID);
3210
+ _script(branchId, SET_SCOPE_REGISTER_ID);
3206
3211
  },
3207
3212
  toJSON(state) {
3208
3213
  return function toJSON() {
@@ -3248,9 +3253,9 @@ var compat = {
3248
3253
  }
3249
3254
  head.render(() => {
3250
3255
  if (willRerender) {
3251
- const scopeId = peekNextScopeId();
3256
+ const scopeId = _peek_scope_id();
3252
3257
  writeScope(scopeId, { m5c: component.id });
3253
- writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
3258
+ _script(scopeId, SET_SCOPE_REGISTER_ID);
3254
3259
  }
3255
3260
  if (isTemplate(renderer) && willRerender) {
3256
3261
  renderer(normalizedInput, 1);
@@ -3288,62 +3293,62 @@ function NOOP3() {
3288
3293
  }
3289
3294
  export {
3290
3295
  $global,
3291
- attr,
3296
+ _attr,
3297
+ _attr_class,
3298
+ _attr_content,
3299
+ _attr_details_or_dialog_open as _attr_details_open,
3300
+ _attr_details_or_dialog_open as _attr_dialog_open,
3301
+ _attr_input_checked,
3302
+ _attr_input_checkedValue,
3303
+ _attr_input_value,
3304
+ _attr_option_value,
3305
+ _attr_select_value,
3306
+ _attr_style,
3307
+ _attr_textarea_value,
3308
+ _attrs,
3309
+ _attrs_content,
3310
+ _attrs_partial,
3311
+ _attrs_partial_content,
3312
+ _await,
3313
+ _content,
3314
+ _content_resume,
3315
+ _dynamic_tag,
3316
+ _el,
3317
+ _el_resume,
3318
+ _escape,
3319
+ _escape_script,
3320
+ _escape_style,
3321
+ _existing_scope,
3322
+ _for_in,
3323
+ _for_of,
3324
+ _for_to,
3325
+ _hoist,
3326
+ _html,
3327
+ _id,
3328
+ _if,
3329
+ _peek_scope_id,
3330
+ _resume,
3331
+ _resume_branch,
3332
+ writeScope as _scope,
3333
+ _scope_id,
3334
+ _scope_with_id,
3335
+ _script,
3336
+ _sep,
3337
+ _serialize_guard,
3338
+ _serialize_if,
3339
+ _subscribe,
3340
+ _template,
3341
+ _trailers,
3342
+ _try,
3343
+ _unescaped,
3344
+ _var,
3292
3345
  attrTag,
3293
3346
  attrTags,
3294
- attrs,
3295
- classAttr,
3296
- commentSeparator,
3297
3347
  compat,
3298
- controllable_detailsOrDialog_open,
3299
- controllable_input_checked,
3300
- controllable_input_checkedValue,
3301
- controllable_input_value,
3302
- controllable_select_value,
3303
- controllable_textarea_value,
3304
- createContent,
3305
- createTemplate,
3306
- dynamicTag,
3307
- ensureScopeWithId,
3308
- escapeScript,
3309
- escapeStyle,
3310
- escapeXML,
3311
3348
  forIn,
3312
3349
  forInBy,
3313
3350
  forOf,
3314
3351
  forOfBy,
3315
3352
  forTo,
3316
- forToBy,
3317
- fork,
3318
- getScopeById,
3319
- hoist,
3320
- markResumeNode,
3321
- nextScopeId,
3322
- nextTagId,
3323
- nodeRef,
3324
- optionValueAttr,
3325
- partialAttrs,
3326
- peekNextScopeId,
3327
- register2 as register,
3328
- registerContent,
3329
- resumeClosestBranch,
3330
- resumeConditional,
3331
- resumeForIn,
3332
- resumeForOf,
3333
- resumeForTo,
3334
- serializeGuard,
3335
- serializeIf,
3336
- setTagVar,
3337
- styleAttr,
3338
- toString,
3339
- tryContent,
3340
- write,
3341
- writeAttrsAndContent,
3342
- writeContent,
3343
- writeEffect,
3344
- writeExistingScope,
3345
- writePartialAttrsAndContent,
3346
- writeScope,
3347
- writeSubscribe,
3348
- writeTrailers
3353
+ forToBy
3349
3354
  };