marko 6.0.0-next.3.84 → 6.0.0-next.3.86

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.
package/dist/html.js CHANGED
@@ -23,6 +23,7 @@ __export(html_exports, {
23
23
  attrTags: () => attrTags,
24
24
  attrs: () => attrs,
25
25
  classAttr: () => classAttr,
26
+ commentSeparator: () => commentSeparator,
26
27
  compat: () => compat,
27
28
  controllable_detailsOrDialog_open: () => controllable_detailsOrDialog_open,
28
29
  controllable_input_checked: () => controllable_input_checked,
@@ -52,7 +53,7 @@ __export(html_exports, {
52
53
  nodeRef: () => nodeRef,
53
54
  optionValueAttr: () => optionValueAttr,
54
55
  partialAttrs: () => partialAttrs,
55
- peekNextScope: () => peekNextScope,
56
+ peekNextScopeId: () => peekNextScopeId,
56
57
  register: () => register2,
57
58
  registerContent: () => registerContent,
58
59
  resumeClosestBranch: () => resumeClosestBranch,
@@ -64,6 +65,8 @@ __export(html_exports, {
64
65
  resumeSingleNodeForIn: () => resumeSingleNodeForIn,
65
66
  resumeSingleNodeForOf: () => resumeSingleNodeForOf,
66
67
  resumeSingleNodeForTo: () => resumeSingleNodeForTo,
68
+ serializeGuard: () => serializeGuard,
69
+ serializeIf: () => serializeIf,
67
70
  setTagVar: () => setTagVar,
68
71
  styleAttr: () => styleAttr,
69
72
  toString: () => toString,
@@ -1111,8 +1114,8 @@ function withContext(key, value, cb) {
1111
1114
  ctx[kPendingContexts]--, ctx[key] = prev;
1112
1115
  }
1113
1116
  }
1114
- function setTagVar(parentScopeId, scopeOffsetAccessor, childScope, registryId) {
1115
- ensureScopeWithId(parentScopeId)[scopeOffsetAccessor] = nextScopeId(), childScope.e = register2(
1117
+ function setTagVar(parentScopeId, scopeOffsetAccessor, childScopeId, registryId) {
1118
+ ensureScopeWithId(parentScopeId)[scopeOffsetAccessor] = nextScopeId(), ensureScopeWithId(childScopeId).e = register2(
1116
1119
  {},
1117
1120
  registryId,
1118
1121
  parentScopeId
@@ -1131,17 +1134,24 @@ function nextScopeId() {
1131
1134
  function peekNextScopeId() {
1132
1135
  return $chunk.boundary.state.scopeId;
1133
1136
  }
1134
- function peekNextScope() {
1135
- return ensureScopeWithId(peekNextScopeId());
1136
- }
1137
1137
  function getScopeById(scopeId) {
1138
1138
  if (scopeId !== void 0)
1139
1139
  return $chunk.boundary.state.scopes.get(scopeId);
1140
1140
  }
1141
- function markResumeNode(scopeId, accessor) {
1141
+ function serializeIf(condition, key) {
1142
+ return condition && (condition === 1 || condition[key]) ? 1 : void 0;
1143
+ }
1144
+ function serializeGuard(condition, key) {
1145
+ return condition && (condition === 1 || condition[key]) ? 1 : 0;
1146
+ }
1147
+ function markResumeNode(scopeId, accessor, shouldResume) {
1148
+ if (shouldResume === 0) return "";
1142
1149
  let { state } = $chunk.boundary;
1143
1150
  return state.needsMainRuntime = !0, state.mark("*" /* Node */, scopeId + " " + accessor);
1144
1151
  }
1152
+ function commentSeparator(shouldResume) {
1153
+ return shouldResume === 0 ? "" : "<!>";
1154
+ }
1145
1155
  function nodeRef(scopeId, id) {
1146
1156
  let getter = () => {
1147
1157
  };
@@ -1160,7 +1170,9 @@ var branchIdKey = Symbol();
1160
1170
  function withBranchId(branchId, cb) {
1161
1171
  return withContext(branchIdKey, branchId, cb);
1162
1172
  }
1163
- function resumeForOf(list, cb, by, scopeId, accessor) {
1173
+ function resumeForOf(list, cb, by, scopeId, accessor, serializeBranch) {
1174
+ if (serializeBranch === 0)
1175
+ return forOf(list, cb);
1164
1176
  let loopScopes = /* @__PURE__ */ new Map();
1165
1177
  forOf(list, (item, index) => {
1166
1178
  let branchId = peekNextScopeId();
@@ -1181,7 +1193,9 @@ function resumeForOf(list, cb, by, scopeId, accessor) {
1181
1193
  )
1182
1194
  );
1183
1195
  }
1184
- function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, onlyChildInParent) {
1196
+ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, serializeBranch, onlyChildInParent) {
1197
+ if (serializeBranch === 0)
1198
+ return forOf(list, cb);
1185
1199
  let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
1186
1200
  forOf(list, (item, index) => {
1187
1201
  let branchId = peekNextScopeId();
@@ -1200,7 +1214,9 @@ function resumeSingleNodeForOf(list, cb, by, scopeId, accessor, onlyChildInParen
1200
1214
  function forOfBy(by, item, index) {
1201
1215
  return by ? typeof by == "string" ? item[by] : by(item, index) : index;
1202
1216
  }
1203
- function resumeForIn(obj, cb, by, scopeId, accessor) {
1217
+ function resumeForIn(obj, cb, by, scopeId, accessor, serializeBranch) {
1218
+ if (serializeBranch === 0)
1219
+ return forIn(obj, cb);
1204
1220
  let loopScopes = /* @__PURE__ */ new Map(), sep = "";
1205
1221
  forIn(obj, (key, value) => {
1206
1222
  let branchId = peekNextScopeId();
@@ -1218,7 +1234,9 @@ function resumeForIn(obj, cb, by, scopeId, accessor) {
1218
1234
  )
1219
1235
  );
1220
1236
  }
1221
- function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, onlyChild) {
1237
+ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, serializeBranch, onlyChild) {
1238
+ if (serializeBranch === 0)
1239
+ return forIn(obj, cb);
1222
1240
  let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
1223
1241
  forIn(obj, (key, value) => {
1224
1242
  let branchId = peekNextScopeId();
@@ -1237,7 +1255,9 @@ function resumeSingleNodeForIn(obj, cb, by, scopeId, accessor, onlyChild) {
1237
1255
  function forInBy(by, name, value) {
1238
1256
  return by ? by(name, value) : name;
1239
1257
  }
1240
- function resumeForTo(to, from, step, cb, by, scopeId, accessor) {
1258
+ function resumeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch) {
1259
+ if (serializeBranch === 0)
1260
+ return forTo(to, from, step, cb);
1241
1261
  let loopScopes = /* @__PURE__ */ new Map(), sep = "";
1242
1262
  forTo(to, from, step, (index) => {
1243
1263
  let branchId = peekNextScopeId();
@@ -1255,7 +1275,9 @@ function resumeForTo(to, from, step, cb, by, scopeId, accessor) {
1255
1275
  )
1256
1276
  );
1257
1277
  }
1258
- function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, onlyChild) {
1278
+ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, serializeBranch, onlyChild) {
1279
+ if (serializeBranch === 0)
1280
+ return forTo(to, from, step, cb);
1259
1281
  let loopScopes = /* @__PURE__ */ new Map(), branchIds = "";
1260
1282
  forTo(to, from, step, (index) => {
1261
1283
  let branchId = peekNextScopeId();
@@ -1274,28 +1296,32 @@ function resumeSingleNodeForTo(to, from, step, cb, by, scopeId, accessor, onlyCh
1274
1296
  function forToBy(by, index) {
1275
1297
  return by ? by(index) : index;
1276
1298
  }
1277
- function resumeConditional(cb, scopeId, accessor, dynamic) {
1299
+ function resumeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker) {
1300
+ if (serializeBranch === 0)
1301
+ return cb();
1278
1302
  let branchId = peekNextScopeId();
1279
- dynamic && $chunk.writeHTML(
1303
+ serializeMarker && $chunk.writeHTML(
1280
1304
  $chunk.boundary.state.mark("[" /* BranchStart */, branchId + "")
1281
1305
  );
1282
1306
  let branchIndex = withBranchId(branchId, cb);
1283
1307
  branchIndex !== void 0 ? writeScope(scopeId, {
1284
- ["c" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
1308
+ ["c" /* ConditionalRenderer */ + accessor]: serializeMarker ? branchIndex : void 0,
1285
1309
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1286
- }) : nextScopeId(), dynamic && $chunk.writeHTML(
1310
+ }) : nextScopeId(), serializeMarker && $chunk.writeHTML(
1287
1311
  $chunk.boundary.state.mark(
1288
1312
  "]" /* BranchEnd */,
1289
1313
  scopeId + " " + accessor
1290
1314
  )
1291
1315
  );
1292
1316
  }
1293
- function resumeSingleNodeConditional(cb, scopeId, accessor, dynamic, onlyChild) {
1317
+ function resumeSingleNodeConditional(cb, scopeId, accessor, serializeBranch, serializeMarker, onlyChild) {
1318
+ if (serializeBranch === 0)
1319
+ return cb();
1294
1320
  let branchId = peekNextScopeId(), branchIndex = withBranchId(branchId, cb), rendered = branchIndex !== void 0;
1295
1321
  rendered ? writeScope(scopeId, {
1296
- ["c" /* ConditionalRenderer */ + accessor]: dynamic ? branchIndex : void 0,
1322
+ ["c" /* ConditionalRenderer */ + accessor]: serializeMarker ? branchIndex : void 0,
1297
1323
  ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {})
1298
- }) : nextScopeId(), dynamic && $chunk.writeHTML(
1324
+ }) : nextScopeId(), serializeMarker && $chunk.writeHTML(
1299
1325
  $chunk.boundary.state.mark(
1300
1326
  onlyChild ? "=" /* BranchSingleNodeOnlyChildInParent */ : "|" /* BranchSingleNode */,
1301
1327
  scopeId + " " + accessor + (rendered ? " " + branchId : "")
@@ -1306,8 +1332,8 @@ var writeScope = (scopeId, partialScope) => {
1306
1332
  let { state } = $chunk.boundary, { scopes } = state, scope = scopes.get(scopeId);
1307
1333
  return state.needsMainRuntime = !0, scope ? Object.assign(scope, partialScope) : (scope = partialScope, scope[K_SCOPE_ID] = scopeId, state.scopes.set(scopeId, scope)), state.writeScopes ? state.writeScopes[scopeId] = scope : state.writeScopes = { [scopeId]: scope }, scope;
1308
1334
  };
1309
- function writeExistingScope(scope) {
1310
- return writeScope(scope[K_SCOPE_ID], scope);
1335
+ function writeExistingScope(scopeId) {
1336
+ return writeScope(scopeId, ensureScopeWithId(scopeId));
1311
1337
  }
1312
1338
  function ensureScopeWithId(scopeId) {
1313
1339
  let { state } = $chunk.boundary, scope = state.scopes.get(scopeId);
@@ -1855,153 +1881,11 @@ var prefix = "$C_", RENDERER_REGISTER_ID = prefix + "r", SET_SCOPE_REGISTER_ID =
1855
1881
  // src/common/meta.ts
1856
1882
  var DEFAULT_RUNTIME_ID = "M", DEFAULT_RENDER_ID = "_";
1857
1883
 
1858
- // src/html/dynamic-tag.ts
1859
- var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, resume) => {
1860
- let renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
1861
- if (typeof renderer == "string") {
1862
- let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
1863
- nextScopeId(), write(`<${renderer}${attrs(input, accessor, scopeId, renderer)}>`), voidElementsReg.test(renderer) || (withBranchId(branchId, () => {
1864
- renderer === "textarea" ? write(
1865
- controllable_textarea_value(
1866
- scopeId,
1867
- accessor,
1868
- input.value,
1869
- input.valueChange
1870
- )
1871
- ) : content && (renderer === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
1872
- scopeId,
1873
- accessor,
1874
- input.value,
1875
- input.valueChange,
1876
- content
1877
- ) : content());
1878
- }), write(`</${renderer}>`)), resume && write(
1879
- state.mark(
1880
- "|" /* BranchSingleNode */,
1881
- scopeId + " " + accessor + " " + branchId
1882
- )
1883
- );
1884
- } else
1885
- resume && write(state.mark("[" /* BranchStart */, branchId + "")), result = withBranchId(branchId, () => {
1886
- if (renderer)
1887
- return inputIsArgs ? renderer(...inputOrArgs) : renderer(
1888
- content ? { ...inputOrArgs, content } : inputOrArgs
1889
- );
1890
- if (content)
1891
- return content();
1892
- }), resume && write(state.mark("]" /* BranchEnd */, scopeId + " " + accessor));
1893
- return peekNextScopeId() !== branchId ? resume && writeScope(scopeId, {
1894
- ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {}),
1895
- ["c" /* ConditionalRenderer */ + accessor]: renderer?.h || renderer
1896
- }) : nextScopeId(), result;
1897
- };
1898
- function createContent(id, fn) {
1899
- return fn.h = id, fn;
1900
- }
1901
- function registerContent(id, fn, scopeId) {
1902
- return register2(createContent(id, fn), id, scopeId);
1903
- }
1904
- function patchDynamicTag(patch) {
1905
- dynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
1906
- let patched = patch(scopeId, accessor, tag);
1907
- return patched.h = tag, originalDynamicTag(
1908
- scopeId,
1909
- accessor,
1910
- patched,
1911
- input,
1912
- content,
1913
- inputIsArgs,
1914
- resume
1915
- );
1916
- })(dynamicTag);
1917
- }
1918
-
1919
- // src/html/compat.ts
1920
- var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
1921
- fork,
1922
- write,
1923
- writeScript,
1924
- nextScopeId,
1925
- isTagsAPI(fn) {
1926
- return !!fn.h;
1927
- },
1928
- patchDynamicTag,
1929
- writeSetScopeForComponent(m5c) {
1930
- let scopeId = nextScopeId();
1931
- writeScope(scopeId, { m5c }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
1932
- },
1933
- toJSON() {
1934
- let compatRegistered = COMPAT_REGISTRY.get(this);
1935
- if (!compatRegistered) {
1936
- let registered = getRegistered(this);
1937
- if (registered) {
1938
- let scopeId = getScopeId(registered.scope);
1939
- scopeId !== void 0 && writeScope(scopeId, {}), COMPAT_REGISTRY.set(
1940
- this,
1941
- compatRegistered = [registered.id, scopeId]
1942
- );
1943
- }
1944
- }
1945
- return compatRegistered;
1946
- },
1947
- render(renderer, willRerender, classAPIOut, component, input) {
1948
- let $global2 = classAPIOut.global, state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
1949
- state || ($global2.runtimeId ||= DEFAULT_RUNTIME_ID, $global2.renderId ||= $global2.componentIdPrefix || DEFAULT_RENDER_ID, $global2[K_TAGS_API_STATE] = state = new State2($global2));
1950
- let boundary = new Boundary(state), head = new Chunk(
1951
- boundary,
1952
- null,
1953
- null
1954
- ), normalizedInput = input;
1955
- if ("renderBody" in input) {
1956
- normalizedInput = {};
1957
- for (let key in input)
1958
- normalizedInput[key === "renderBody" ? "content" : key] = input[key];
1959
- }
1960
- head.render(() => {
1961
- if (willRerender) {
1962
- let scopeId = peekNextScopeId();
1963
- writeScope(scopeId, { m5c: component.id }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
1964
- }
1965
- renderer(normalizedInput);
1966
- });
1967
- let asyncOut = classAPIOut.beginAsync();
1968
- queueMicrotask(
1969
- boundary.onNext = () => {
1970
- if (boundary.signal.aborted)
1971
- asyncOut.error(boundary.signal.reason);
1972
- else if (boundary.done) {
1973
- let { scripts, html } = head.consume().flushScript();
1974
- asyncOut.script(scripts), asyncOut.write(html), asyncOut.end();
1975
- }
1976
- }
1977
- );
1978
- },
1979
- registerRenderer(renderer, id) {
1980
- return register(
1981
- RENDERER_REGISTER_ID,
1982
- renderer,
1983
- register(id, () => {
1984
- })
1985
- );
1986
- },
1987
- registerRenderBody(fn) {
1988
- register(RENDER_BODY_ID, fn);
1989
- }
1990
- };
1991
-
1992
- // src/html/for.ts
1993
- function forOfBy2(by, item, index) {
1994
- return by ? typeof by == "string" ? item[by] : by(item, index) : index;
1995
- }
1996
- function forInBy2(by, name, value) {
1997
- return by ? by(name, value) : name;
1998
- }
1999
- function forToBy2(by, index) {
2000
- return by ? by(index) : index;
2001
- }
2002
-
2003
1884
  // src/html/template.ts
2004
1885
  var createTemplate = (templateId, renderer) => (renderer.render = render, renderer._ = renderer, registerContent(templateId, renderer));
1886
+ function isTemplate(renderer) {
1887
+ return !!renderer._;
1888
+ }
2005
1889
  function render(input = {}) {
2006
1890
  let { $global: $global2 } = input;
2007
1891
  $global2 ? ({ $global: $global2, ...input } = input, $global2 = {
@@ -2070,20 +1954,23 @@ var ServerRendered = class {
2070
1954
  );
2071
1955
  }
2072
1956
  toReadable() {
2073
- let encoder = new TextEncoder();
1957
+ let cancelled = !1, boundary, encoder = new TextEncoder();
2074
1958
  return new ReadableStream({
2075
1959
  start: (ctrl) => {
2076
- this.#read(
1960
+ boundary = this.#read(
2077
1961
  (html) => {
2078
1962
  ctrl.enqueue(encoder.encode(html));
2079
1963
  },
2080
1964
  (err) => {
2081
- ctrl.error(err);
1965
+ boundary = void 0, cancelled || ctrl.error(err);
2082
1966
  },
2083
1967
  () => {
2084
- ctrl.close();
1968
+ boundary = void 0, ctrl.close();
2085
1969
  }
2086
1970
  );
1971
+ },
1972
+ cancel: (reason) => {
1973
+ cancelled = !0, boundary?.abort(reason);
2087
1974
  }
2088
1975
  });
2089
1976
  }
@@ -2135,6 +2022,165 @@ var ServerRendered = class {
2135
2022
  };
2136
2023
  function NOOP2() {
2137
2024
  }
2025
+
2026
+ // src/html/dynamic-tag.ts
2027
+ var voidElementsReg = /^(?:area|b(?:ase|r)|col|embed|hr|i(?:mg|nput)|link|meta|param|source|track|wbr)$/, dynamicTag = (scopeId, accessor, tag, inputOrArgs, content, inputIsArgs, shouldResume) => {
2028
+ let renderer = normalizeDynamicRenderer(tag), state = getState(), branchId = peekNextScopeId(), result;
2029
+ if (typeof renderer == "string") {
2030
+ let input = (inputIsArgs ? inputOrArgs[0] : inputOrArgs) || {};
2031
+ if (nextScopeId(), write(`<${renderer}${attrs(input, accessor, scopeId, renderer)}>`), !voidElementsReg.test(renderer)) {
2032
+ let renderNativeTag = () => {
2033
+ renderer === "textarea" ? write(
2034
+ controllable_textarea_value(
2035
+ scopeId,
2036
+ accessor,
2037
+ input.value,
2038
+ input.valueChange
2039
+ )
2040
+ ) : content && (renderer === "select" && ("value" in input || "valueChange" in input) ? controllable_select_value(
2041
+ scopeId,
2042
+ accessor,
2043
+ input.value,
2044
+ input.valueChange,
2045
+ content
2046
+ ) : content());
2047
+ };
2048
+ shouldResume ? withBranchId(branchId, renderNativeTag) : renderNativeTag(), write(`</${renderer}>`);
2049
+ }
2050
+ shouldResume && write(
2051
+ state.mark(
2052
+ "|" /* BranchSingleNode */,
2053
+ scopeId + " " + accessor + " " + branchId
2054
+ )
2055
+ );
2056
+ } else {
2057
+ shouldResume && write(state.mark("[" /* BranchStart */, branchId + ""));
2058
+ let render2 = () => {
2059
+ if (renderer) {
2060
+ if (isTemplate(renderer)) {
2061
+ let input = inputIsArgs ? inputOrArgs[0] : inputOrArgs;
2062
+ return renderer(
2063
+ content ? { ...input, content } : input,
2064
+ shouldResume
2065
+ );
2066
+ }
2067
+ return inputIsArgs ? renderer(...inputOrArgs) : renderer(
2068
+ content ? { ...inputOrArgs, content } : inputOrArgs
2069
+ );
2070
+ } else if (content)
2071
+ return content();
2072
+ };
2073
+ result = shouldResume ? withBranchId(branchId, render2) : render2(), shouldResume && write(state.mark("]" /* BranchEnd */, scopeId + " " + accessor));
2074
+ }
2075
+ return peekNextScopeId() !== branchId ? shouldResume && writeScope(scopeId, {
2076
+ ["d" /* ConditionalScope */ + accessor]: writeScope(branchId, {}),
2077
+ ["c" /* ConditionalRenderer */ + accessor]: renderer?.h || renderer
2078
+ }) : nextScopeId(), result;
2079
+ };
2080
+ function createContent(id, fn) {
2081
+ return fn.h = id, fn;
2082
+ }
2083
+ function registerContent(id, fn, scopeId) {
2084
+ return register2(createContent(id, fn), id, scopeId);
2085
+ }
2086
+ function patchDynamicTag(patch) {
2087
+ dynamicTag = /* @__PURE__ */ ((originalDynamicTag) => (scopeId, accessor, tag, input, content, inputIsArgs, resume) => {
2088
+ let patched = patch(scopeId, accessor, tag);
2089
+ return patched.h = tag, originalDynamicTag(
2090
+ scopeId,
2091
+ accessor,
2092
+ patched,
2093
+ input,
2094
+ content,
2095
+ inputIsArgs,
2096
+ resume
2097
+ );
2098
+ })(dynamicTag);
2099
+ }
2100
+
2101
+ // src/html/compat.ts
2102
+ var K_TAGS_API_STATE = Symbol(), COMPAT_REGISTRY = /* @__PURE__ */ new WeakMap(), compat = {
2103
+ fork,
2104
+ write,
2105
+ writeScript,
2106
+ nextScopeId,
2107
+ isTagsAPI(fn) {
2108
+ return !!fn.h;
2109
+ },
2110
+ patchDynamicTag,
2111
+ writeSetScopeForComponent(m5c) {
2112
+ let scopeId = nextScopeId();
2113
+ writeScope(scopeId, { m5c }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
2114
+ },
2115
+ toJSON() {
2116
+ let compatRegistered = COMPAT_REGISTRY.get(this);
2117
+ if (!compatRegistered) {
2118
+ let registered = getRegistered(this);
2119
+ if (registered) {
2120
+ let scopeId = getScopeId(registered.scope);
2121
+ scopeId !== void 0 && writeScope(scopeId, {}), COMPAT_REGISTRY.set(
2122
+ this,
2123
+ compatRegistered = [registered.id, scopeId]
2124
+ );
2125
+ }
2126
+ }
2127
+ return compatRegistered;
2128
+ },
2129
+ render(renderer, willRerender, classAPIOut, component, input) {
2130
+ let $global2 = classAPIOut.global, state = $global2[K_TAGS_API_STATE] ||= getChunk()?.boundary.state;
2131
+ state || ($global2.runtimeId ||= DEFAULT_RUNTIME_ID, $global2.renderId ||= $global2.componentIdPrefix || DEFAULT_RENDER_ID, $global2[K_TAGS_API_STATE] = state = new State2($global2));
2132
+ let boundary = new Boundary(state), head = new Chunk(
2133
+ boundary,
2134
+ null,
2135
+ null
2136
+ ), normalizedInput = input;
2137
+ if ("renderBody" in input) {
2138
+ normalizedInput = {};
2139
+ for (let key in input)
2140
+ normalizedInput[key === "renderBody" ? "content" : key] = input[key];
2141
+ }
2142
+ head.render(() => {
2143
+ if (willRerender) {
2144
+ let scopeId = peekNextScopeId();
2145
+ writeScope(scopeId, { m5c: component.id }), writeEffect(scopeId, SET_SCOPE_REGISTER_ID);
2146
+ }
2147
+ isTemplate(renderer) && willRerender ? renderer(normalizedInput, 1) : renderer(normalizedInput);
2148
+ });
2149
+ let asyncOut = classAPIOut.beginAsync();
2150
+ queueMicrotask(
2151
+ boundary.onNext = () => {
2152
+ if (boundary.signal.aborted)
2153
+ asyncOut.error(boundary.signal.reason);
2154
+ else if (boundary.done) {
2155
+ let { scripts, html } = head.consume().flushScript();
2156
+ asyncOut.script(scripts), asyncOut.write(html), asyncOut.end();
2157
+ }
2158
+ }
2159
+ );
2160
+ },
2161
+ registerRenderer(renderer, id) {
2162
+ return register(
2163
+ RENDERER_REGISTER_ID,
2164
+ renderer,
2165
+ register(id, () => {
2166
+ })
2167
+ );
2168
+ },
2169
+ registerRenderBody(fn) {
2170
+ register(RENDER_BODY_ID, fn);
2171
+ }
2172
+ };
2173
+
2174
+ // src/html/for.ts
2175
+ function forOfBy2(by, item, index) {
2176
+ return by ? typeof by == "string" ? item[by] : by(item, index) : index;
2177
+ }
2178
+ function forInBy2(by, name, value) {
2179
+ return by ? by(name, value) : name;
2180
+ }
2181
+ function forToBy2(by, index) {
2182
+ return by ? by(index) : index;
2183
+ }
2138
2184
  // Annotate the CommonJS export names for ESM import in node:
2139
2185
  0 && (module.exports = {
2140
2186
  $global,
@@ -2143,6 +2189,7 @@ function NOOP2() {
2143
2189
  attrTags,
2144
2190
  attrs,
2145
2191
  classAttr,
2192
+ commentSeparator,
2146
2193
  compat,
2147
2194
  controllable_detailsOrDialog_open,
2148
2195
  controllable_input_checked,
@@ -2172,7 +2219,7 @@ function NOOP2() {
2172
2219
  nodeRef,
2173
2220
  optionValueAttr,
2174
2221
  partialAttrs,
2175
- peekNextScope,
2222
+ peekNextScopeId,
2176
2223
  register,
2177
2224
  registerContent,
2178
2225
  resumeClosestBranch,
@@ -2184,6 +2231,8 @@ function NOOP2() {
2184
2231
  resumeSingleNodeForIn,
2185
2232
  resumeSingleNodeForOf,
2186
2233
  resumeSingleNodeForTo,
2234
+ serializeGuard,
2235
+ serializeIf,
2187
2236
  setTagVar,
2188
2237
  styleAttr,
2189
2238
  toString,