marko 6.3.20 → 6.3.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/cheatsheet.md +29 -3
  2. package/dist/common/accessor.d.ts +21 -75
  3. package/dist/common/accessor.debug.d.ts +21 -75
  4. package/dist/common/constants/accessor-prefix.d.ts +16 -0
  5. package/dist/common/constants/accessor-prefix.debug.d.ts +16 -0
  6. package/dist/common/constants/accessor-prop.d.ts +30 -0
  7. package/dist/common/constants/accessor-prop.debug.d.ts +30 -0
  8. package/dist/common/constants/closure-signal-prop.d.ts +6 -0
  9. package/dist/common/constants/closure-signal-prop.debug.d.ts +6 -0
  10. package/dist/common/constants/controlled-type.d.ts +9 -0
  11. package/dist/common/constants/keyed-scopes-prop.d.ts +4 -0
  12. package/dist/common/constants/keyed-scopes-prop.debug.d.ts +4 -0
  13. package/dist/common/constants/load-signal-value.d.ts +5 -0
  14. package/dist/common/constants/load-signal-value.debug.d.ts +5 -0
  15. package/dist/common/constants/node-type.d.ts +7 -0
  16. package/dist/common/constants/pending-render-prop.d.ts +9 -0
  17. package/dist/common/constants/pending-render-prop.debug.d.ts +9 -0
  18. package/dist/common/constants/renderer-prop.d.ts +12 -0
  19. package/dist/common/constants/renderer-prop.debug.d.ts +12 -0
  20. package/dist/common/constants/resume-symbol.d.ts +10 -0
  21. package/dist/common/constants/walk-code.d.ts +17 -0
  22. package/dist/common/constants/walk-range-size.d.ts +7 -0
  23. package/dist/common/types.d.ts +15 -45
  24. package/dist/debug/dom.js +291 -225
  25. package/dist/debug/dom.mjs +291 -225
  26. package/dist/debug/html.js +187 -41
  27. package/dist/debug/html.mjs +187 -42
  28. package/dist/dom/compat.d.ts +1 -1
  29. package/dist/dom/control-flow.d.ts +1 -1
  30. package/dist/dom/renderer.d.ts +2 -2
  31. package/dist/dom/scope.d.ts +1 -1
  32. package/dist/dom.js +8 -6
  33. package/dist/dom.mjs +8 -6
  34. package/dist/html/constants/char.d.ts +11 -0
  35. package/dist/html/constants/flush-status.d.ts +6 -0
  36. package/dist/html/constants/mark.d.ts +6 -0
  37. package/dist/html/constants/runtime-key.d.ts +7 -0
  38. package/dist/html/writer.d.ts +20 -23
  39. package/dist/html.d.ts +1 -1
  40. package/dist/html.js +131 -29
  41. package/dist/html.mjs +131 -29
  42. package/dist/translator/core/if.d.ts +7 -7
  43. package/dist/translator/core/index.d.ts +7 -7
  44. package/dist/translator/index.d.ts +9 -9
  45. package/dist/translator/index.js +245 -139
  46. package/dist/translator/interop/constants/feature-type.d.ts +5 -0
  47. package/dist/translator/interop/index.d.ts +2 -2
  48. package/dist/translator/util/body-to-text-literal.d.ts +2 -2
  49. package/dist/translator/util/constants/binding-type.d.ts +10 -0
  50. package/dist/translator/util/constants/compile-stage.d.ts +8 -0
  51. package/dist/translator/util/constants/content-type.d.ts +8 -0
  52. package/dist/translator/util/constants/step.d.ts +5 -0
  53. package/dist/translator/util/constants/tag-name-type.d.ts +7 -0
  54. package/dist/translator/util/is-static.d.ts +1 -1
  55. package/dist/translator/util/references.d.ts +9 -12
  56. package/dist/translator/util/sections.d.ts +4 -8
  57. package/dist/translator/util/signals.d.ts +1 -0
  58. package/dist/translator/util/tag-name-type.d.ts +4 -7
  59. package/dist/translator/util/walks.d.ts +4 -6
  60. package/dist/translator/visitors/constants/sibling-text.d.ts +7 -0
  61. package/dist/translator/visitors/placeholder.d.ts +2 -6
  62. package/dist/translator/visitors/program/index.d.ts +1 -0
  63. package/dist/translator/visitors/tag/constants/class-hydration.d.ts +5 -0
  64. package/dist/translator/visitors/tag/dynamic-tag.d.ts +2 -4
  65. package/package.json +16 -16
  66. package/tags-html.d.ts +98 -22
@@ -21,6 +21,22 @@ function* attrTagIterator() {
21
21
  yield* this[rest];
22
22
  }
23
23
  //#endregion
24
+ //#region src/common/constants/accessor-prefix.debug.ts
25
+ const BranchScopes = "BranchScopes:";
26
+ const ConditionalRenderer = "ConditionalRenderer:";
27
+ const ControlledHandler = "ControlledHandler:";
28
+ const ControlledType = "ControlledType:";
29
+ const ControlledValue = "ControlledValue:";
30
+ const EventAttributes = "EventAttributes:";
31
+ const BranchAccessor = "#BranchAccessor";
32
+ const CatchContent = "#CatchContent";
33
+ const ClosestBranchId = "#ClosestBranchId";
34
+ const LoopKey = "#LoopKey";
35
+ const PlaceholderContent = "#PlaceholderContent";
36
+ const Renderer = "#Renderer";
37
+ const TagVariable = "#TagVariable";
38
+ const Embed = "embed";
39
+ //#endregion
24
40
  //#region src/common/helpers.ts
25
41
  const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
26
42
  const knownWrongAttrs = {
@@ -523,14 +539,15 @@ var State$1 = class {
523
539
  mutated = [];
524
540
  };
525
541
  var Reference = class {
542
+ assigns = null;
543
+ calls = null;
544
+ scopeId = void 0;
545
+ channel = void 0;
526
546
  parent;
527
547
  accessor;
528
548
  flush;
529
549
  pos;
530
550
  id;
531
- assigns = null;
532
- scopeId = void 0;
533
- channel = void 0;
534
551
  constructor(parent, accessor, flush, pos = null, id = null) {
535
552
  this.parent = parent;
536
553
  this.accessor = accessor;
@@ -635,14 +652,31 @@ function writeScopesRoot(state, flushes) {
635
652
  function writeAssigned(state) {
636
653
  let sep = state.buf.length ? "," : "";
637
654
  if (state.assigned.size) {
655
+ const assigned = state.assigned;
656
+ state.assigned = /* @__PURE__ */ new Set();
638
657
  let buf = "";
639
- for (const ref of state.assigned) {
640
- buf += sep + assignsToString(ref.assigns, ref.id);
641
- ref.assigns = null;
642
- sep = ",";
658
+ let hasCalls = false;
659
+ for (const ref of assigned) {
660
+ if (ref.assigns) {
661
+ buf += sep + assignsToString(ref.assigns, ref.id);
662
+ ref.assigns = null;
663
+ sep = ",";
664
+ }
665
+ hasCalls ||= ref.calls !== null;
666
+ }
667
+ if (buf) state.buf.push(buf);
668
+ if (hasCalls) for (const ref of assigned) {
669
+ if (!ref.calls) continue;
670
+ for (const { method, args } of ref.calls) {
671
+ state.buf.push((state.buf.length ? "," : "") + ref.id + "." + method + "(");
672
+ for (let a = 0; a < args.length; a++) {
673
+ if (a) state.buf.push(",");
674
+ writeCallArg(state, args[a]);
675
+ }
676
+ state.buf.push(")");
677
+ }
678
+ ref.calls = null;
643
679
  }
644
- state.buf.push(buf);
645
- state.assigned = /* @__PURE__ */ new Set();
646
680
  }
647
681
  if (hasChannelMutations(state)) {
648
682
  const remaining = [];
@@ -677,8 +711,14 @@ function writeAssigned(state) {
677
711
  state.buf.push(")");
678
712
  }
679
713
  state.mutated = remaining;
680
- if (state.assigned.size) writeAssigned(state);
681
714
  }
715
+ if (state.assigned.size) writeAssigned(state);
716
+ }
717
+ function writeCallArg(state, val) {
718
+ if (val === void 0) {
719
+ state.wroteUndefined = true;
720
+ state.buf.push("$");
721
+ } else if (!writeProp(state, val, null, "")) state.buf.push("void 0");
682
722
  }
683
723
  function hasChannelMutations(state) {
684
724
  return hasMatchingMutations(state.mutated, state.channel?.readyId);
@@ -873,6 +913,7 @@ function writeUnknownObject(state, val, ref) {
873
913
  case Float64Array:
874
914
  case BigInt64Array:
875
915
  case BigUint64Array: return writeTypedArray(state, val, ref);
916
+ case DataView: return writeDataView(state, val, ref);
876
917
  case WeakSet: return writeWeakSet(state);
877
918
  case WeakMap: return writeWeakMap(state);
878
919
  case globalThis.URL: return writeURL(state, val);
@@ -882,6 +923,24 @@ function writeUnknownObject(state, val, ref) {
882
923
  case globalThis.ReadableStream: return writeReadableStream(state, val, ref);
883
924
  case globalThis.Request: return writeRequest(state, val, ref);
884
925
  case globalThis.Response: return writeResponse(state, val, ref);
926
+ case globalThis.Intl?.NumberFormat: return writeIntl(state, val, "NumberFormat", ref);
927
+ case globalThis.Intl?.DateTimeFormat: return writeIntl(state, val, "DateTimeFormat", ref);
928
+ case globalThis.Intl?.Collator: return writeIntl(state, val, "Collator", ref);
929
+ case globalThis.Intl?.PluralRules: return writeIntl(state, val, "PluralRules", ref);
930
+ case globalThis.Intl?.RelativeTimeFormat: return writeIntl(state, val, "RelativeTimeFormat", ref);
931
+ case globalThis.Intl?.ListFormat: return writeIntl(state, val, "ListFormat", ref);
932
+ case globalThis.Intl?.DisplayNames: return writeIntl(state, val, "DisplayNames", ref);
933
+ case globalThis.Intl?.Segmenter: return writeIntl(state, val, "Segmenter", ref);
934
+ case globalThis.Intl?.DurationFormat: return writeIntl(state, val, "DurationFormat", ref);
935
+ case globalThis.Intl?.Locale: return writeIntlLocale(state, val);
936
+ case globalThis.Temporal?.Instant: return writeTemporal(state, val, "Instant");
937
+ case globalThis.Temporal?.Duration: return writeTemporal(state, val, "Duration");
938
+ case globalThis.Temporal?.PlainDate: return writeTemporal(state, val, "PlainDate");
939
+ case globalThis.Temporal?.PlainDateTime: return writeTemporal(state, val, "PlainDateTime");
940
+ case globalThis.Temporal?.PlainMonthDay: return writeTemporal(state, val, "PlainMonthDay");
941
+ case globalThis.Temporal?.PlainTime: return writeTemporal(state, val, "PlainTime");
942
+ case globalThis.Temporal?.PlainYearMonth: return writeTemporal(state, val, "PlainYearMonth");
943
+ case globalThis.Temporal?.ZonedDateTime: return writeTemporal(state, val, "ZonedDateTime");
885
944
  }
886
945
  throwUnserializable(state, val, ref);
887
946
  return false;
@@ -950,9 +1009,15 @@ function writeMap(state, val, ref) {
950
1009
  const items = [];
951
1010
  let assigns;
952
1011
  let needsId;
1012
+ let deferring = false;
953
1013
  let i = 0;
954
1014
  if (val.size < 25) {
955
1015
  for (let [itemKey, itemValue] of val) {
1016
+ if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue))) deferring = true;
1017
+ if (deferring) {
1018
+ deferCall(state, ref, "set", [itemKey, itemValue]);
1019
+ continue;
1020
+ }
956
1021
  if (itemKey === val) {
957
1022
  itemKey = void 0;
958
1023
  (assigns ||= []).push("a[" + i + "][0]");
@@ -967,6 +1032,11 @@ function writeMap(state, val, ref) {
967
1032
  writeArrayArg(state, ref, items, assigns && "((m,a)=>(" + assignsToString(assigns, "m") + ",a.forEach(i=>m.set(i[0],i[1])),m))(new Map,", "new Map(", needsId);
968
1033
  } else {
969
1034
  for (let [itemKey, itemValue] of val) {
1035
+ if (!deferring && (itemKey !== val && isAncestorMember(state, ref, itemKey) || itemValue !== val && isAncestorMember(state, ref, itemValue))) deferring = true;
1036
+ if (deferring) {
1037
+ deferCall(state, ref, "set", [itemKey, itemValue]);
1038
+ continue;
1039
+ }
970
1040
  if (itemKey === val) {
971
1041
  itemKey = 0;
972
1042
  (assigns ||= []).push("a[" + i + "]");
@@ -990,8 +1060,14 @@ function writeSet(state, val, ref) {
990
1060
  const items = [];
991
1061
  let assigns;
992
1062
  let needsId;
1063
+ let deferring = false;
993
1064
  let i = 0;
994
1065
  for (let item of val) {
1066
+ if (!deferring && item !== val && isAncestorMember(state, ref, item)) deferring = true;
1067
+ if (deferring) {
1068
+ deferCall(state, ref, "add", [item]);
1069
+ continue;
1070
+ }
995
1071
  if (item === val) {
996
1072
  item = 0;
997
1073
  (assigns ||= []).push("i[" + i + "]");
@@ -1001,6 +1077,19 @@ function writeSet(state, val, ref) {
1001
1077
  writeArrayArg(state, ref, items, assigns && "((s,i)=>(" + assignsToString(assigns, "s") + ",i.forEach(i=>s.add(i)),s))(new Set,", "new Set(", needsId);
1002
1078
  return true;
1003
1079
  }
1080
+ function isAncestorMember(state, container, member) {
1081
+ if (member === null || typeof member !== "object" && typeof member !== "function") return false;
1082
+ const ref = state.refs.get(member);
1083
+ return ref !== void 0 && isCircular(container, ref);
1084
+ }
1085
+ function deferCall(state, ref, method, args) {
1086
+ ensureId(state, ref);
1087
+ (ref.calls ||= []).push({
1088
+ method,
1089
+ args
1090
+ });
1091
+ state.assigned.add(ref);
1092
+ }
1004
1093
  function writeArrayArg(state, ref, items, assignsPrefix, plainPrefix, needsId) {
1005
1094
  if (assignsPrefix || needsId) {
1006
1095
  const arrayRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
@@ -1021,6 +1110,20 @@ function isDedupedMember(val) {
1021
1110
  default: return false;
1022
1111
  }
1023
1112
  }
1113
+ function canWriteBuffer(state, buffer, ref) {
1114
+ if (Object.getPrototypeOf(buffer)?.constructor === ArrayBuffer) return true;
1115
+ throwUnserializable(state, buffer, ref, "buffer");
1116
+ return false;
1117
+ }
1118
+ function writeDataView(state, val, ref) {
1119
+ const { buffer } = val;
1120
+ if (!canWriteBuffer(state, buffer, ref)) return false;
1121
+ const needsLength = val.byteOffset + val.byteLength < buffer.byteLength;
1122
+ state.buf.push("new DataView(");
1123
+ writeProp(state, buffer, ref, "buffer");
1124
+ state.buf.push((val.byteOffset || needsLength ? "," + val.byteOffset + (needsLength ? "," + val.byteLength : "") : "") + ")");
1125
+ return true;
1126
+ }
1024
1127
  function writeArrayBuffer(state, val) {
1025
1128
  let result;
1026
1129
  if (val.byteLength) {
@@ -1032,6 +1135,7 @@ function writeArrayBuffer(state, val) {
1032
1135
  }
1033
1136
  function writeTypedArray(state, val, ref) {
1034
1137
  if (val.byteOffset || val.byteLength < val.buffer.byteLength || state.refs.has(val.buffer)) {
1138
+ if (!canWriteBuffer(state, val.buffer, ref)) return false;
1035
1139
  const needsLength = val.byteOffset + val.byteLength < val.buffer.byteLength;
1036
1140
  state.buf.push("new " + val.constructor.name + "(");
1037
1141
  writeProp(state, val.buffer, ref, "buffer");
@@ -1191,6 +1295,34 @@ function writeResponse(state, val, ref) {
1191
1295
  }
1192
1296
  return true;
1193
1297
  }
1298
+ function writeIntl(state, val, name, ref) {
1299
+ const { locale, ...options } = val.resolvedOptions();
1300
+ let needsId = false;
1301
+ for (const key in options) if (isDedupedMember(options[key])) {
1302
+ needsId = true;
1303
+ break;
1304
+ }
1305
+ state.buf.push("new Intl." + name + "(" + quote(locale, 0) + ",");
1306
+ let optionsRef;
1307
+ if (needsId) {
1308
+ optionsRef = new Reference(ref, null, state.flush, null, nextRefAccess(state));
1309
+ state.buf.push(optionsRef.id + "={");
1310
+ } else {
1311
+ optionsRef = new Reference(ref, null, state.flush, state.buf.length);
1312
+ state.buf.push("{");
1313
+ }
1314
+ writeObjectProps(state, options, optionsRef);
1315
+ state.buf.push("})");
1316
+ return true;
1317
+ }
1318
+ function writeIntlLocale(state, val) {
1319
+ state.buf.push("new Intl.Locale(" + quote(val.toString(), 0) + ")");
1320
+ return true;
1321
+ }
1322
+ function writeTemporal(state, val, name) {
1323
+ state.buf.push("Temporal." + name + ".from(" + quote(val.toString(), 0) + ")");
1324
+ return true;
1325
+ }
1194
1326
  function writeReadableStream(state, val, ref) {
1195
1327
  const { boundary, channel } = state;
1196
1328
  if (!boundary || val.locked) return false;
@@ -1345,6 +1477,7 @@ function throwUnserializable(state, cause, ref = null, accessor = "") {
1345
1477
  if (accessor) access = toAccess(accessor) + access;
1346
1478
  if (access[0] === ".") access = access.slice(1);
1347
1479
  if (access) message += ` (reading ${access})`;
1480
+ message += ". Values referenced in the browser must be serializable.";
1348
1481
  const err = new TypeError(message, { cause });
1349
1482
  err.stack = void 0;
1350
1483
  state.boundary.abort(err);
@@ -1778,6 +1911,10 @@ function _trailers(html) {
1778
1911
  function _resume(val, id, scopeId) {
1779
1912
  return register(id, val, scopeId === void 0 ? void 0 : _scope_with_id(scopeId));
1780
1913
  }
1914
+ function _resume_locals(val, id, locals, ownerScopeId) {
1915
+ if (ownerScopeId !== void 0) locals["_"] = _scope_with_id(ownerScopeId);
1916
+ return register(id, val, writeScope(_scope_id(), locals));
1917
+ }
1781
1918
  function _el(scopeId, id) {
1782
1919
  return _resume(() => _el_read_error(), id, scopeId);
1783
1920
  }
@@ -1797,7 +1934,7 @@ function _sep(shouldResume) {
1797
1934
  }
1798
1935
  function _resume_branch(scopeId) {
1799
1936
  const branchId = $chunk.context?.[kBranchId];
1800
- if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { ["#ClosestBranchId"]: branchId });
1937
+ if (branchId !== void 0 && branchId !== scopeId) writeScope(scopeId, { [ClosestBranchId]: branchId });
1801
1938
  }
1802
1939
  function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1803
1940
  const shouldResume = serializeReason !== 0;
@@ -1807,8 +1944,8 @@ function _attr_content(nodeAccessor, scopeId, content, serializeReason) {
1807
1944
  else render();
1808
1945
  if (_peek_scope_id() !== branchId) {
1809
1946
  if (shouldResume) writeScope(scopeId, {
1810
- ["BranchScopes:" + nodeAccessor]: writeScope(branchId, {}),
1811
- ["ConditionalRenderer:" + nodeAccessor]: render?.["id"]
1947
+ [BranchScopes + nodeAccessor]: writeScope(branchId, {}),
1948
+ [ConditionalRenderer + nodeAccessor]: render?.["id"]
1812
1949
  });
1813
1950
  } else _scope_id();
1814
1951
  }
@@ -1819,8 +1956,8 @@ function normalizeServerRender(value) {
1819
1956
  }
1820
1957
  function _var(parentScopeId, scopeOffsetAccessor, childScopeId, registryId, nodeAccessor) {
1821
1958
  writeScopePassive(parentScopeId, { [scopeOffsetAccessor]: _scope_id() });
1822
- const childScope = writeScopePassive(childScopeId, { ["#TagVariable"]: _resume({}, registryId, parentScopeId) });
1823
- if (nodeAccessor !== void 0) writeScope(parentScopeId, { ["BranchScopes:" + nodeAccessor]: childScope });
1959
+ const childScope = writeScopePassive(childScopeId, { [TagVariable]: _resume({}, registryId, parentScopeId) });
1960
+ if (nodeAccessor !== void 0) writeScope(parentScopeId, { [BranchScopes + nodeAccessor]: childScope });
1824
1961
  }
1825
1962
  function writeScopePassive(scopeId, partialScope) {
1826
1963
  const target = $chunk.serializeState;
@@ -1896,11 +2033,11 @@ function forBranches(by, iterate, scopeId, accessor, serializeBranch, serializeM
1896
2033
  }
1897
2034
  withBranchId(branchId, () => {
1898
2035
  render();
1899
- const branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { ["#LoopKey"]: itemKey } : {});
2036
+ const branchScope = writeScope(branchId, resumeKeys && !sameAsIndex ? { [LoopKey]: itemKey } : {});
1900
2037
  if (!resumeMarker) loopScopes = push(loopScopes, branchScope);
1901
2038
  });
1902
2039
  });
1903
- if (loopScopes) writeScope(scopeId, { ["BranchScopes:" + accessor]: loopScopes });
2040
+ if (loopScopes) writeScope(scopeId, { [BranchScopes + accessor]: loopScopes });
1904
2041
  writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, singleNode ? flushBranchIds : flushBranchIds ? " " + flushBranchIds : "");
1905
2042
  }
1906
2043
  function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeStateful, parentEndTag, singleNode) {
@@ -1912,8 +2049,8 @@ function _if(cb, scopeId, accessor, serializeBranch, serializeMarker, serializeS
1912
2049
  const branchIndex = resumeBranch ? withBranchId(branchId, cb) : cb();
1913
2050
  const shouldWriteBranch = resumeBranch && branchIndex !== void 0;
1914
2051
  if (shouldWriteBranch && (branchIndex || !resumeMarker)) writeScope(scopeId, {
1915
- ["ConditionalRenderer:" + accessor]: branchIndex || void 0,
1916
- ["BranchScopes:" + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
2052
+ [ConditionalRenderer + accessor]: branchIndex || void 0,
2053
+ [BranchScopes + accessor]: resumeMarker ? void 0 : writeScope(branchId, {})
1917
2054
  });
1918
2055
  writeBranchEnd(scopeId, accessor, serializeStateful, serializeMarker, parentEndTag, singleNode, shouldWriteBranch ? " " + branchId : "");
1919
2056
  }
@@ -2046,9 +2183,9 @@ function _try(scopeId, accessor, content, input) {
2046
2183
  else if (placeholderContent) tryPlaceholder(content, placeholderContent, branchId);
2047
2184
  else content();
2048
2185
  writeScope(branchId, {
2049
- ["#BranchAccessor"]: accessor,
2050
- ["#CatchContent"]: catchContent,
2051
- ["#PlaceholderContent"]: placeholderContent
2186
+ [BranchAccessor]: accessor,
2187
+ [CatchContent]: catchContent,
2188
+ [PlaceholderContent]: placeholderContent
2052
2189
  });
2053
2190
  $chunk.writeHTML($chunk.boundary.state.mark("]", scopeId + " " + accessor + " " + branchId));
2054
2191
  }
@@ -2121,7 +2258,6 @@ function tryCatch(content, catchContent) {
2121
2258
  }
2122
2259
  const NOOP$2 = () => {};
2123
2260
  var State = class {
2124
- $global;
2125
2261
  tagId = 1;
2126
2262
  scopeId = 1;
2127
2263
  reorderId = 1;
@@ -2143,6 +2279,7 @@ var State = class {
2143
2279
  writeScopes = {};
2144
2280
  readyIds = null;
2145
2281
  serializeReason;
2282
+ $global;
2146
2283
  constructor($global) {
2147
2284
  this.$global = $global;
2148
2285
  if ($global.cspNonce) this.nonceAttr = " nonce" + attrAssignment($global.cspNonce);
@@ -2185,10 +2322,10 @@ var State = class {
2185
2322
  }
2186
2323
  };
2187
2324
  var Boundary = class extends AbortController {
2188
- state;
2189
- parent;
2190
2325
  onNext = NOOP$2;
2191
2326
  count = 0;
2327
+ state;
2328
+ parent;
2192
2329
  constructor(state, signal, parent) {
2193
2330
  super();
2194
2331
  this.state = state;
@@ -2218,10 +2355,6 @@ var Boundary = class extends AbortController {
2218
2355
  }
2219
2356
  };
2220
2357
  var Chunk = class Chunk {
2221
- boundary;
2222
- next;
2223
- context;
2224
- serializeState;
2225
2358
  html = "";
2226
2359
  scripts = "";
2227
2360
  effects = "";
@@ -2232,6 +2365,10 @@ var Chunk = class Chunk {
2232
2365
  reorderId = null;
2233
2366
  deferredReady = null;
2234
2367
  placeholder = null;
2368
+ boundary;
2369
+ next;
2370
+ context;
2371
+ serializeState;
2235
2372
  constructor(boundary, next, context, serializeState) {
2236
2373
  this.boundary = boundary;
2237
2374
  this.next = next;
@@ -2727,7 +2864,7 @@ function _attrs(data, nodeAccessor, scopeId, tagName) {
2727
2864
  if (isEventHandler(name)) {
2728
2865
  if (!events) {
2729
2866
  events = {};
2730
- writeScope(scopeId, { ["EventAttributes:" + nodeAccessor]: events });
2867
+ writeScope(scopeId, { [EventAttributes + nodeAccessor]: events });
2731
2868
  }
2732
2869
  events[getEventHandlerName(name)] = value;
2733
2870
  } else result += nonVoidAttr(name, value);
@@ -2756,12 +2893,12 @@ function _attrs_partial_content(data, skip, nodeAccessor, scopeId, tagName, seri
2756
2893
  function writeControlledScope(type, scopeId, nodeAccessor, value, valueChange, serializeType) {
2757
2894
  assertHandlerIsFunction("valueChange", valueChange);
2758
2895
  writeScope(scopeId, serializeType ? {
2759
- ["ControlledType:" + nodeAccessor]: type,
2760
- ["ControlledValue:" + nodeAccessor]: value,
2761
- ["ControlledHandler:" + nodeAccessor]: valueChange
2896
+ [ControlledType + nodeAccessor]: type,
2897
+ [ControlledValue + nodeAccessor]: value,
2898
+ [ControlledHandler + nodeAccessor]: valueChange
2762
2899
  } : {
2763
- ["ControlledValue:" + nodeAccessor]: value,
2764
- ["ControlledHandler:" + nodeAccessor]: valueChange
2900
+ [ControlledValue + nodeAccessor]: value,
2901
+ [ControlledHandler + nodeAccessor]: valueChange
2765
2902
  });
2766
2903
  }
2767
2904
  function stringAttr(name, value) {
@@ -2836,7 +2973,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
2836
2973
  const childScope = getScopeById(branchId);
2837
2974
  const needsScript = childScope && (childScope[`EventAttributes:#${renderer}/0`] || childScope[`ControlledHandler:#${renderer}/0`]);
2838
2975
  if (needsScript) {
2839
- writeScope(branchId, { ["#Renderer"]: renderer });
2976
+ writeScope(branchId, { [Renderer]: renderer });
2840
2977
  _script(branchId, DYNAMIC_TAG_SCRIPT_REGISTER_ID);
2841
2978
  }
2842
2979
  if (shouldResume || needsScript) _html(state.mark("'", scopeId + " " + accessor + " " + branchId));
@@ -2861,7 +2998,7 @@ let _dynamic_tag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, s
2861
2998
  if (shouldResume) _html(state.mark("]", scopeId + " " + accessor + (rendered ? " " + branchId : "")));
2862
2999
  }
2863
3000
  if (rendered) {
2864
- if (shouldResume) writeScope(scopeId, { ["ConditionalRenderer:" + accessor]: renderer?.["id"] || renderer });
3001
+ if (shouldResume) writeScope(scopeId, { [ConditionalRenderer + accessor]: renderer?.["id"] || renderer });
2865
3002
  } else _scope_id();
2866
3003
  return result;
2867
3004
  };
@@ -2884,7 +3021,7 @@ const patchDynamicTag = ((originalDynamicTag) => (patch) => {
2884
3021
  const CONSUMED_RESULT_MESSAGE = "Cannot read from a consumed render result";
2885
3022
  const _template = (templateId, renderer, page) => {
2886
3023
  renderer.render = render;
2887
- renderer["embed"] = !page;
3024
+ renderer[Embed] = !page;
2888
3025
  renderer._ = renderer;
2889
3026
  renderer.mount = () => {
2890
3027
  throw new Error(`mount() is not implemented for the HTML compilation of a Marko template`);
@@ -2938,7 +3075,9 @@ var ServerRendered = class {
2938
3075
  const boundary = this.#read((html) => {
2939
3076
  value += html;
2940
3077
  if (resolve) {
2941
- resolve({
3078
+ const settle = resolve;
3079
+ resolve = reject = void 0;
3080
+ settle({
2942
3081
  value,
2943
3082
  done
2944
3083
  });
@@ -2947,11 +3086,17 @@ var ServerRendered = class {
2947
3086
  }, (err) => {
2948
3087
  aborted = true;
2949
3088
  reason = err;
2950
- if (reject) reject(err);
3089
+ if (reject) {
3090
+ const settle = reject;
3091
+ resolve = reject = void 0;
3092
+ settle(err);
3093
+ }
2951
3094
  }, () => {
2952
3095
  done = true;
2953
3096
  if (resolve) {
2954
- resolve({
3097
+ const settle = resolve;
3098
+ resolve = reject = void 0;
3099
+ settle({
2955
3100
  value,
2956
3101
  done: !value
2957
3102
  });
@@ -3365,6 +3510,7 @@ exports._if = _if;
3365
3510
  exports._peek_scope_id = _peek_scope_id;
3366
3511
  exports._resume = _resume;
3367
3512
  exports._resume_branch = _resume_branch;
3513
+ exports._resume_locals = _resume_locals;
3368
3514
  Object.defineProperty(exports, "_scope", {
3369
3515
  enumerable: true,
3370
3516
  get: function() {