marko 6.4.5 → 6.4.7

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 (145) hide show
  1. package/cheatsheet.md +2 -1
  2. package/dist/common/errors.d.ts +3 -1
  3. package/dist/common/helpers.d.ts +7 -7
  4. package/dist/debug/dom/catch.feat.js +4 -4
  5. package/dist/debug/dom/catch.feat.mjs +4 -4
  6. package/dist/debug/dom/controllable-input.feat.js +1 -1
  7. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  8. package/dist/debug/dom/controllable-open.feat.js +1 -1
  9. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  10. package/dist/debug/dom/controllable-select.feat.js +1 -1
  11. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  12. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  13. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  14. package/dist/debug/dom/controllable.feat.js +5 -5
  15. package/dist/debug/dom/controllable.feat.mjs +5 -5
  16. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  17. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  18. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -2
  19. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -2
  20. package/dist/debug/dom/lazy.feat.js +1 -1
  21. package/dist/debug/dom/lazy.feat.mjs +1 -1
  22. package/dist/debug/dom/placeholder.feat.js +1 -1
  23. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  24. package/dist/debug/{dom-BeY1nGUb.mjs → dom-CFCBDift.mjs} +133 -135
  25. package/dist/debug/{dom-CUxvM4i9.js → dom-D8znnhpf.js} +148 -150
  26. package/dist/debug/dom.js +21 -22
  27. package/dist/debug/dom.mjs +22 -22
  28. package/dist/debug/html.js +736 -664
  29. package/dist/debug/html.mjs +736 -665
  30. package/dist/dom/catch.feat.js +5 -5
  31. package/dist/dom/catch.feat.mjs +4 -4
  32. package/dist/dom/control-flow.d.ts +3 -3
  33. package/dist/dom/controllable-input.feat.js +2 -2
  34. package/dist/dom/controllable-input.feat.mjs +1 -1
  35. package/dist/dom/controllable-open.feat.js +2 -2
  36. package/dist/dom/controllable-open.feat.mjs +1 -1
  37. package/dist/dom/controllable-select.feat.js +2 -2
  38. package/dist/dom/controllable-select.feat.mjs +1 -1
  39. package/dist/dom/controllable-textarea.feat.js +2 -2
  40. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  41. package/dist/dom/controllable.d.ts +4 -4
  42. package/dist/dom/controllable.feat.js +2 -2
  43. package/dist/dom/controllable.feat.mjs +2 -2
  44. package/dist/dom/dom.d.ts +5 -5
  45. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  46. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  47. package/dist/dom/dynamic-tag-var.feat.js +3 -3
  48. package/dist/dom/dynamic-tag-var.feat.mjs +2 -2
  49. package/dist/dom/lazy.feat.js +1 -1
  50. package/dist/dom/lazy.feat.mjs +1 -1
  51. package/dist/dom/placeholder.feat.js +2 -2
  52. package/dist/dom/placeholder.feat.mjs +1 -1
  53. package/dist/dom/renderer.d.ts +1 -3
  54. package/dist/dom/resume.d.ts +2 -3
  55. package/dist/dom/signals.d.ts +6 -8
  56. package/dist/{dom-Diu8MpmL.js → dom-Bpkm72vV.js} +157 -166
  57. package/dist/{dom-DefWmvQB.mjs → dom-CVAevsbz.mjs} +103 -107
  58. package/dist/dom.d.ts +1 -1
  59. package/dist/dom.js +37 -37
  60. package/dist/dom.mjs +22 -22
  61. package/dist/html/assets.d.ts +2 -2
  62. package/dist/html/compat.d.ts +2 -1
  63. package/dist/html/control-flow.d.ts +20 -0
  64. package/dist/html/inlined-runtimes.d.ts +2 -2
  65. package/dist/html/inlined-runtimes.debug.d.ts +2 -2
  66. package/dist/html/serializer.d.ts +63 -16
  67. package/dist/html/template.d.ts +1 -1
  68. package/dist/html/writer.d.ts +47 -35
  69. package/dist/html.d.ts +3 -2
  70. package/dist/html.js +531 -484
  71. package/dist/html.mjs +531 -484
  72. package/dist/translator/core/for.d.ts +0 -4
  73. package/dist/translator/core/return.d.ts +0 -3
  74. package/dist/translator/core/style.d.ts +2 -2
  75. package/dist/translator/index.js +8093 -8021
  76. package/dist/translator/util/analyze-errors.d.ts +2 -1
  77. package/dist/translator/util/assert.d.ts +15 -1
  78. package/dist/translator/util/bindings.d.ts +24 -12
  79. package/dist/translator/util/body-to-text.d.ts +9 -0
  80. package/dist/translator/util/branch-tag.d.ts +10 -3
  81. package/dist/translator/util/build-string-expression.d.ts +4 -0
  82. package/dist/translator/util/content-derives.d.ts +7 -0
  83. package/dist/translator/util/cyclic-memo.d.ts +6 -2
  84. package/dist/translator/util/entry-builder.d.ts +6 -3
  85. package/dist/translator/util/finalize-references.d.ts +6 -3
  86. package/dist/translator/util/for-selector.d.ts +1 -1
  87. package/dist/translator/util/generate-uid.d.ts +4 -2
  88. package/dist/translator/util/get-root.d.ts +3 -3
  89. package/dist/translator/util/get-tag-name.d.ts +1 -1
  90. package/dist/translator/util/known-tag.d.ts +14 -9
  91. package/dist/translator/util/module-read.d.ts +0 -3
  92. package/dist/translator/util/module-registrations.d.ts +44 -0
  93. package/dist/translator/util/nested-attribute-tags.d.ts +1 -1
  94. package/dist/translator/util/optional.d.ts +7 -2
  95. package/dist/translator/util/params-tree.d.ts +18 -0
  96. package/dist/translator/util/reasons.d.ts +13 -8
  97. package/dist/translator/util/references.d.ts +23 -27
  98. package/dist/translator/util/runtime.d.ts +0 -12
  99. package/dist/translator/util/scope-accessor.d.ts +0 -1
  100. package/dist/translator/util/scope-read.d.ts +3 -0
  101. package/dist/translator/util/section-renderer.d.ts +4 -0
  102. package/dist/translator/util/sections.d.ts +21 -21
  103. package/dist/translator/util/setup-work.d.ts +2 -1
  104. package/dist/translator/util/signals.d.ts +16 -14
  105. package/dist/translator/util/simplify-fn.d.ts +1 -0
  106. package/dist/translator/util/slots.d.ts +4 -4
  107. package/dist/translator/util/solve-reasons.d.ts +1 -3
  108. package/dist/translator/util/sources.d.ts +2 -1
  109. package/dist/translator/util/state.d.ts +4 -2
  110. package/dist/translator/util/statement-tag.d.ts +2 -0
  111. package/dist/translator/util/static-text.d.ts +2 -1
  112. package/dist/translator/util/structure.d.ts +0 -10
  113. package/dist/translator/util/tag-facts.d.ts +8 -1
  114. package/dist/translator/util/tag-import.d.ts +20 -0
  115. package/dist/translator/util/tag-name-type.d.ts +9 -2
  116. package/dist/translator/util/to-only-or-block.d.ts +3 -0
  117. package/dist/translator/util/to-property-name.d.ts +2 -0
  118. package/dist/translator/util/translate-attrs.d.ts +7 -5
  119. package/dist/translator/util/translate-var.d.ts +2 -0
  120. package/dist/translator/util/traverse.d.ts +1 -2
  121. package/dist/translator/util/visitors.d.ts +4 -1
  122. package/dist/translator/util/with-previous-location.d.ts +1 -1
  123. package/dist/translator/util/write-guard.d.ts +2 -2
  124. package/dist/translator/util/writer.d.ts +1 -2
  125. package/dist/translator/visitors/export-declaration.d.ts +2 -3
  126. package/dist/translator/visitors/function.d.ts +0 -35
  127. package/dist/translator/visitors/import-declaration.d.ts +1 -15
  128. package/dist/translator/visitors/placeholder.d.ts +2 -1
  129. package/dist/translator/visitors/program/html.d.ts +0 -1
  130. package/dist/translator/visitors/program/index.d.ts +4 -5
  131. package/dist/translator/visitors/program/pre-analyze.d.ts +2 -0
  132. package/dist/translator/visitors/tag/custom-tag.d.ts +0 -14
  133. package/dist/translator/visitors/tag/dynamic-tag.d.ts +1 -0
  134. package/dist/translator/visitors/tag/native-tag.d.ts +3 -12
  135. package/package.json +4 -4
  136. package/dist/translator/util/binding-has-prop.d.ts +0 -8
  137. package/dist/translator/util/binding-prop-tree.d.ts +0 -18
  138. package/dist/translator/util/body-to-text-literal.d.ts +0 -9
  139. package/dist/translator/util/import-reference.d.ts +0 -3
  140. package/dist/translator/util/normalize-string-expression.d.ts +0 -4
  141. package/dist/translator/util/plugin-hooks.d.ts +0 -4
  142. package/dist/translator/util/resolve-relative-to-entry.d.ts +0 -2
  143. package/dist/translator/util/set-tag-derived-from.d.ts +0 -7
  144. package/dist/translator/util/to-first-expression-or-block.d.ts +0 -2
  145. package/dist/translator/util/to-first-statement-or-block.d.ts +0 -2
@@ -72,7 +72,7 @@ const Returns = "returns";
72
72
  const Lazy = "lazy";
73
73
  //#endregion
74
74
  //#region src/common/helpers.ts
75
- const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
75
+ const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
76
76
  const knownWrongAttrs = {
77
77
  className: "class",
78
78
  classList: "class",
@@ -114,11 +114,11 @@ function _call(fn, v) {
114
114
  fn(v);
115
115
  return v;
116
116
  }
117
- function stringifyClassObject(name, value) {
117
+ function stringifyClassEntry(name, value) {
118
118
  return value ? name : "";
119
119
  }
120
120
  const warnedStyleKeys = /* @__PURE__ */ new Set();
121
- function stringifyStyleObject(name, value) {
121
+ function stringifyStyleEntry(name, value) {
122
122
  if (/[A-Z]/.test(name) && !name.includes("-") && !warnedStyleKeys.has(name)) {
123
123
  warnedStyleKeys.add(name);
124
124
  console.warn(`\`${name}\` is not a CSS property name; \`style\` object keys are written verbatim, so it renders as invalid CSS. Use \`${name.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()).replace(/^ms-/, "-ms-")}\`.`);
@@ -165,10 +165,10 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
165
165
  function isEventHandler(name) {
166
166
  return /^on[A-Z-]/.test(name);
167
167
  }
168
- function getEventHandlerName(name) {
168
+ function getEventType(name) {
169
169
  return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
170
170
  }
171
- function isNotVoid(value) {
171
+ function isNotNullishOrFalse(value) {
172
172
  return value != null && value !== false;
173
173
  }
174
174
  function isPromise(value) {
@@ -197,9 +197,9 @@ function withDynamicHtml(runtime) {
197
197
  }
198
198
  //#endregion
199
199
  //#region src/common/errors.ts
200
- const lowercaseEventHandlerReg = /^on[a-z]/;
200
+ const lowercaseOnAttrReg = /^on[a-z]/;
201
201
  function assertValidAttrValue(name, value) {
202
- if (value && typeof value !== "string" && lowercaseEventHandlerReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
202
+ if (value && typeof value !== "string" && lowercaseOnAttrReg.test(name)) throw new Error(`The \`${name}\` attribute must be a string or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}". To attach an event listener, use the \`on${name[2].toUpperCase()}${name.slice(3)}\` event handler instead.`);
203
203
  if (typeof value === "function") throw new Error(`The \`${name}\` attribute cannot be a function.${/Change$/.test(name) ? " A change handler is only used when its matching controllable attribute combination applies." : ""}`);
204
204
  const unrenderable = describeUnrenderable(value);
205
205
  if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
@@ -238,7 +238,7 @@ function describeUnrenderable(value) {
238
238
  }
239
239
  }
240
240
  function assertValidLoopKey(key, seenKeys) {
241
- if (typeof key !== "string" && typeof key !== "number") throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null ? "null" : `type "${typeof key}"`}.`);
241
+ if (typeof key !== "string" && typeof key !== "number" || key !== key) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a string or number for each item, but received ${key === null || key !== key ? key : `type "${typeof key}"`}.`);
242
242
  if (seenKeys) {
243
243
  if (seenKeys.has(key)) throw new Error(`A \`<for>\` tag's \`by\` attribute must return a unique value for each item, but \`${key}\` was used more than once.`);
244
244
  seenKeys.add(key);
@@ -247,7 +247,7 @@ function assertValidLoopKey(key, seenKeys) {
247
247
  function assertValidList(value) {
248
248
  if (value && typeof value[Symbol.iterator] !== "function") throw new Error(`A \`<for>\` tag's \`of\` attribute must be an iterable, such as an array, but received ${describeForValue(value)}.`);
249
249
  }
250
- function assertValidRangeStart(name, value) {
250
+ function assertOptionalRangeNumber(name, value) {
251
251
  if (value && (typeof value !== "number" || !isFinite(value))) throw new Error(`A \`<for>\` tag's \`${name}\` attribute must be a finite number, but received ${describeForValue(value)}.`);
252
252
  }
253
253
  function assertValidRangeBound(name, value) {
@@ -257,7 +257,7 @@ function describeForValue(value) {
257
257
  return typeof value === "number" || typeof value === "bigint" ? `\`${value}\`` : value === null ? "null" : `type "${typeof value}"`;
258
258
  }
259
259
  function assertValidAttrName(name) {
260
- if (htmlAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
260
+ if (invalidNativeAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
261
261
  const suggestion = getWrongAttrSuggestion(name);
262
262
  if (suggestion) throw new Error(`\`${name}\` is not a valid attribute, did you mean \`${suggestion}\`?`);
263
263
  }
@@ -325,16 +325,16 @@ function forOf(list, cb) {
325
325
  }
326
326
  function forTo(to, from, step, cb) {
327
327
  assertValidRangeBound("to", to);
328
- assertValidRangeStart("from", from);
329
- assertValidRangeStart("step", step);
328
+ assertOptionalRangeNumber("from", from);
329
+ assertOptionalRangeNumber("step", step);
330
330
  const start = from || 0;
331
331
  const delta = step || 1;
332
332
  for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
333
333
  }
334
334
  function forUntil(until, from, step, cb) {
335
335
  assertValidRangeBound("until", until);
336
- assertValidRangeStart("from", from);
337
- assertValidRangeStart("step", step);
336
+ assertOptionalRangeNumber("from", from);
337
+ assertOptionalRangeNumber("step", step);
338
338
  const start = from || 0;
339
339
  const delta = step || 1;
340
340
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
@@ -533,7 +533,7 @@ function push(opt, item) {
533
533
  //#region src/dom/event.ts
534
534
  function _on(element, type, handler) {
535
535
  assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
536
- if (element[1 + type] === void 0) delegate(type, handleDelegated);
536
+ delegate(type, handleDelegated);
537
537
  element[1 + type] = handler || null;
538
538
  }
539
539
  const delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, true), 1);
@@ -642,7 +642,7 @@ function schedule() {
642
642
  if (!isScheduled) {
643
643
  if (console.createTask) {
644
644
  const task = console.createTask("queue");
645
- runTask = () => task.run(run);
645
+ runTask = (_) => task.run(run);
646
646
  } else runTask = run;
647
647
  isScheduled = 1;
648
648
  queueMicrotask(flushAndWaitFrame);
@@ -655,7 +655,7 @@ function flushAndWaitFrame() {
655
655
  function triggerMacroTask() {
656
656
  if (!channel) {
657
657
  channel = new MessageChannel();
658
- channel.port1.onmessage = () => {
658
+ channel.port1.onmessage = (_) => {
659
659
  isScheduled = 0;
660
660
  {
661
661
  const run = runTask;
@@ -720,22 +720,22 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
720
720
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
721
721
  const ownerSignal = (ownerScope) => {
722
722
  const scopes = toArray(ownerScope[scopeAccessor]);
723
- queueRender(ownerScope, () => {
723
+ queueRender(ownerScope, (_) => {
724
724
  for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
725
725
  }, -1);
726
726
  };
727
- ownerSignal._ = fn;
727
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
728
728
  return ownerSignal;
729
729
  }
730
- function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccessor, fn) {
730
+ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
731
731
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
732
732
  const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
733
733
  const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
734
734
  const ownerSignal = (ownerScope) => {
735
735
  if (ownerScope["#Gen"] < runId) {
736
736
  const nextKey = ownerScope[ownerValueAccessor];
737
- queueRender(ownerScope, () => {
738
- const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor);
737
+ queueRender(ownerScope, (_) => {
738
+ const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
739
739
  if (map && prevKeyProp in map) {
740
740
  const prevScope = map.get(map[prevKeyProp]);
741
741
  const nextScope = map.get(nextKey);
@@ -748,15 +748,14 @@ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccess
748
748
  }, -1);
749
749
  }
750
750
  };
751
- ownerSignal._ = fn;
751
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
752
752
  return ownerSignal;
753
753
  }
754
- function keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor) {
754
+ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
755
755
  const map = ownerScope[mapAccessor] ||= /* @__PURE__ */ new Map();
756
756
  if (!map.size) for (const scope of toArray(ownerScope[scopeAccessor])) {
757
- const key = scope["#LoopKey"] ?? scope[keyValueAccessor];
757
+ const key = scope[LoopKey];
758
758
  if (key === void 0) return ownerScope[mapAccessor] = null;
759
- scope[LoopKey] = key;
760
759
  map.set(key, scope);
761
760
  }
762
761
  return map;
@@ -771,11 +770,11 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
771
770
  const ifScope = scope[scopeAccessor];
772
771
  if (ifScope && ifScope["#Gen"] > 0 && ifScope["#Gen"] < runId && (scope[branchAccessor] || 0) === branch) queueRender(ifScope, fn, -1);
773
772
  };
774
- ownerSignal._ = fn;
773
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
775
774
  return ownerSignal;
776
775
  }
777
- function subscribeToScopeSet(ownerScope, accessor, scope) {
778
- const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
776
+ function subscribeToScopeSet(owner, accessor, scope) {
777
+ const subscribers = owner[accessor] ||= /* @__PURE__ */ new Set();
779
778
  const { size } = subscribers;
780
779
  if (subscribers.add(scope).size !== size) trackCleanup(scope, subscribers);
781
780
  }
@@ -787,7 +786,7 @@ function _closure(...closureSignals) {
787
786
  return (scope) => {
788
787
  if (scope[scopeInstances]) {
789
788
  scope[scopeInstances][Changed] = 1;
790
- for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
789
+ for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) closureSignals[childScope[signalIndex] || 0](childScope);
791
790
  }
792
791
  };
793
792
  }
@@ -795,22 +794,15 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
795
794
  const closureSignal = ((scope, resumed) => {
796
795
  const ownerScope = getOwnerScope ? getOwnerScope(scope) : scope["_"];
797
796
  scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
798
- if (!resumed) fn(scope);
799
- else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, closureSignal);
800
797
  subscribeToScopeSet(ownerScope, closureSignal[ScopeInstancesAccessor], scope);
798
+ if (!resumed) queueRender(scope, fn, -1);
799
+ else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, fn);
801
800
  });
802
801
  closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
803
802
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
804
803
  if (resumeId) _resumed[resumeId] = (scope) => closureSignal(scope, 1);
805
804
  return closureSignal;
806
805
  }
807
- function _child_setup(setup) {
808
- setup._ = (scope, owner) => {
809
- scope["_"] ||= owner;
810
- queueRender(scope, setup, -1);
811
- };
812
- return setup;
813
- }
814
806
  function _var(scope, childAccessor, signal) {
815
807
  const childScope = scope[childAccessor];
816
808
  childScope[TagVariable] = (value) => signal(scope, value);
@@ -826,13 +818,13 @@ const _var_change = (scope, value, name = "This") => {
826
818
  };
827
819
  const tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
828
820
  function _id(scope, accessor) {
829
- let id = accessor !== void 0 && scope[accessor];
821
+ let id = accessor && scope[accessor];
830
822
  if (!id) {
831
823
  const $global = scope[Global];
832
824
  const n = tagIdsByGlobal.get($global) || 0;
833
825
  tagIdsByGlobal.set($global, n + 1);
834
826
  id = "c" + $global.runtimeId + $global.renderId + n.toString(36);
835
- if (accessor !== void 0) scope[accessor] = id;
827
+ if (accessor) scope[accessor] = id;
836
828
  }
837
829
  return id;
838
830
  }
@@ -866,7 +858,7 @@ function* traverse(scope, path, args, i = path.length - 1) {
866
858
  function _hoist(...path) {
867
859
  return (scope) => {
868
860
  const fn = (...args) => traverse(scope, path, args).next().value;
869
- fn[Symbol.iterator] = () => traverse(scope, path, []);
861
+ fn[Symbol.iterator] = (_) => traverse(scope, path, []);
870
862
  return fn;
871
863
  };
872
864
  }
@@ -900,7 +892,11 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
900
892
  if (value === 48) scope[getDebugKey(currentScopeIndex++, "#scopeOffset")] = skipScope();
901
893
  } else if (value < 92) {
902
894
  value = 25 * currentMultiplier + value - 67;
903
- while (value--) walkNextNode();
895
+ while (value--) if (currentNode.firstChild) currentNode = currentNode.firstChild;
896
+ else {
897
+ while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
898
+ walkNextSibling();
899
+ }
904
900
  } else if (value < 107) {
905
901
  value = 10 * currentMultiplier + value - 97;
906
902
  while (value--) walkNextSibling();
@@ -921,12 +917,7 @@ function getDebugKey(index, node) {
921
917
  else if (node.nodeType === 1) return `#${node.tagName.toLowerCase()}/${index}`;
922
918
  return index;
923
919
  }
924
- const walkNextNode = () => {
925
- if (currentNode.firstChild) return currentNode = currentNode.firstChild;
926
- while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
927
- walkNextSibling();
928
- };
929
- const walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode;
920
+ const walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode;
930
921
  //#endregion
931
922
  //#region src/dom/resume.ts
932
923
  const _resumed = {};
@@ -950,7 +941,7 @@ function withLazy() {
950
941
  function initEmbedded(readyId, runtimeId) {
951
942
  if (!embedRenders) {
952
943
  embedRenders = /* @__PURE__ */ new Map();
953
- new MutationObserver(() => {
944
+ new MutationObserver((_) => {
954
945
  for (const [anchor, [renderId, scopes]] of embedRenders) if (!anchor.isConnected) {
955
946
  embedRenders.delete(anchor);
956
947
  delete curRenders[renderId];
@@ -978,7 +969,7 @@ function init(runtimeId = "M") {
978
969
  const scopeLookup = {};
979
970
  const pending = [];
980
971
  const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
981
- const initGlobal = () => scopeLookup[0] ||= {
972
+ const initGlobal = (_) => scopeLookup[0] ||= {
982
973
  runtimeId,
983
974
  renderId
984
975
  };
@@ -1052,7 +1043,7 @@ function init(runtimeId = "M") {
1052
1043
  } else pending.push(visitScope);
1053
1044
  };
1054
1045
  };
1055
- const nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1046
+ const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1056
1047
  const processResumes = (resumes = [], effects) => {
1057
1048
  let i = 0;
1058
1049
  for (; i < resumes.length; i++) {
@@ -1126,7 +1117,7 @@ function init(runtimeId = "M") {
1126
1117
  visits.length = retained;
1127
1118
  return effects;
1128
1119
  };
1129
- render.w = () => {
1120
+ render.w = (_) => {
1130
1121
  walk();
1131
1122
  runResumeEffects(render);
1132
1123
  };
@@ -1158,10 +1149,10 @@ function _var_resume(id, signal) {
1158
1149
  return signal;
1159
1150
  }
1160
1151
  function _el(id, accessor) {
1161
- return _resumed[id] = (scope) => () => _el_read(scope[accessor]);
1152
+ return _resumed[id] = (scope) => (_) => _el_read(scope[accessor]);
1162
1153
  }
1163
1154
  function _dynamic_tag_var_resume(accessor) {
1164
- _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => () => {
1155
+ _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => (_) => {
1165
1156
  const node = scope[accessor];
1166
1157
  return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1167
1158
  };
@@ -1187,11 +1178,11 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1187
1178
  return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
1188
1179
  }
1189
1180
  function setupBranch(renderer, branch) {
1190
- if (renderer["setup"]) queueRender(branch, renderer[Setup], -1);
1181
+ renderer[Setup]?.(branch);
1191
1182
  return branch;
1192
1183
  }
1193
1184
  function _return_setup(setup) {
1194
- (setup._ || setup)[Returns] = 1;
1185
+ setup[Returns] = 1;
1195
1186
  return setup;
1196
1187
  }
1197
1188
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
@@ -1230,14 +1221,15 @@ function _content_closures(renderer, closureFns) {
1230
1221
  for (const key in closureFns) closureSignals[key] = _const(key, closureFns[key]);
1231
1222
  return (owner, closureValues) => {
1232
1223
  const instance = renderer(owner);
1233
- const clone = instance[Clone];
1224
+ const setup = instance[Setup];
1234
1225
  const setClosures = instance[LocalClosures] = (branch) => {
1235
1226
  for (const key in closureSignals) closureSignals[key](branch, closureValues[key]);
1236
1227
  };
1237
- instance[Clone] = (branch, ns) => {
1238
- clone(branch, ns);
1228
+ instance[Setup] = (branch) => {
1229
+ setup?.(branch);
1239
1230
  setClosures(branch);
1240
1231
  };
1232
+ instance[Setup][Returns] = (setup || instance["params"])?.[Returns];
1241
1233
  return instance;
1242
1234
  };
1243
1235
  }
@@ -1272,7 +1264,7 @@ function setAttribute(element, name, value) {
1272
1264
  }
1273
1265
  }
1274
1266
  function _attr_class(element, value) {
1275
- setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassObject) || void 0);
1267
+ setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassEntry) || void 0);
1276
1268
  }
1277
1269
  function _attr_class_items(element, items) {
1278
1270
  for (const key in items) _attr_class_item(element, key, items[key]);
@@ -1289,7 +1281,7 @@ function _attr_class_names(element, names, value) {
1289
1281
  } while (start = end + 1);
1290
1282
  }
1291
1283
  function _attr_style(element, value) {
1292
- setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleObject) || void 0);
1284
+ setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleEntry) || void 0);
1293
1285
  }
1294
1286
  function _attr_style_items(element, items) {
1295
1287
  for (const key in items) _attr_style_item(element, key, items[key]);
@@ -1346,7 +1338,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
1346
1338
  if (!skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) el.removeAttribute(name);
1347
1339
  }
1348
1340
  for (const name in nextAttrs) {
1349
- const key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
1341
+ const key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
1350
1342
  if (!skip[key]) partial[key] = nextAttrs[name];
1351
1343
  }
1352
1344
  assertExclusiveAttrs({
@@ -1380,7 +1372,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
1380
1372
  break;
1381
1373
  default:
1382
1374
  assertValidAttrName(name);
1383
- if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[getEventHandlerName(name)] = value;
1375
+ if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[getEventType(name)] = value;
1384
1376
  else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) _attr(el, name, value);
1385
1377
  }
1386
1378
  }
@@ -1388,7 +1380,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
1388
1380
  function _attr_content(scope, nodeAccessor, value) {
1389
1381
  const content = normalizeClientRender(value);
1390
1382
  if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
1391
- setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
1383
+ setBranch(scope, nodeAccessor, content, createAndSetupBranch);
1392
1384
  if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
1393
1385
  }
1394
1386
  content?.[LocalClosures]?.(scope[BranchScopes$1 + nodeAccessor]);
@@ -1429,7 +1421,7 @@ function normalizeClientRender(value) {
1429
1421
  }
1430
1422
  }
1431
1423
  function normalizeAttrValue(value) {
1432
- if (isNotVoid(value)) return value === true ? "" : value + "";
1424
+ if (isNotNullishOrFalse(value)) return value === true ? "" : value + "";
1433
1425
  }
1434
1426
  function _lifecycle(scope, thisObj, index = 0) {
1435
1427
  const accessor = Lifecycle + index;
@@ -1444,7 +1436,7 @@ function _lifecycle(scope, thisObj, index = 0) {
1444
1436
  Object.assign(thisObj, thisObj.onMount?.());
1445
1437
  for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
1446
1438
  }
1447
- trackAbort(scope, accessor, () => thisObj.onDestroy?.());
1439
+ trackAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1448
1440
  }
1449
1441
  }
1450
1442
  function removeChildNodes(startNode, endNode) {
@@ -1490,7 +1482,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
1490
1482
  let inputType = "";
1491
1483
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
1492
1484
  const el = scope[nodeAccessor];
1493
- const normalizedChecked = isNotVoid(checked);
1485
+ const normalizedChecked = isNotNullishOrFalse(checked);
1494
1486
  if (el.defaultChecked !== normalizedChecked) {
1495
1487
  const restoreValue = scope["#Gen"] < runId ? el.checked : normalizedChecked;
1496
1488
  el.defaultChecked = normalizedChecked;
@@ -1502,11 +1494,11 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
1502
1494
  * resolves the kind at run time). */
1503
1495
  const controllableScripts = {};
1504
1496
  /** The render pass equivalent, for a tag whose name is only known at run time;
1505
- * a statically named tag passes its claim to `_attrs` instead. */
1506
- const controllableRenders = {};
1497
+ * a statically named tag passes its helper to `_attrs` instead. */
1498
+ const controllableSpreadHelpers = {};
1507
1499
  function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
1508
1500
  const el = scope[nodeAccessor];
1509
- const normalizedChecked = isNotVoid(checked);
1501
+ const normalizedChecked = isNotNullishOrFalse(checked);
1510
1502
  assertHandlerIsFunction("checkedChange", checkedChange);
1511
1503
  scope[ControlledHandler + nodeAccessor] = checkedChange;
1512
1504
  scope[ControlledType + nodeAccessor] = checkedChange ? 0 : 5;
@@ -1515,7 +1507,7 @@ function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
1515
1507
  }
1516
1508
  function _attr_input_checked_script(scope, nodeAccessor) {
1517
1509
  const el = scope[nodeAccessor];
1518
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1510
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1519
1511
  const checkedChange = scope[ControlledHandler + nodeAccessor];
1520
1512
  if (checkedChange) {
1521
1513
  const newValue = el.checked;
@@ -1550,7 +1542,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
1550
1542
  if (scope["ControlledValue:" + nodeAccessor]) scope[ControlledValue + nodeAccessor].push(el.value);
1551
1543
  else scope[ControlledValue + nodeAccessor] = el.value;
1552
1544
  }
1553
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1545
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1554
1546
  const checkedValueChange = scope[ControlledHandler + nodeAccessor];
1555
1547
  if (checkedValueChange) {
1556
1548
  const controlledValueKey = ControlledValue + nodeAccessor;
@@ -1622,7 +1614,7 @@ function _attr_select_value_default(scope, nodeAccessor, value) {
1622
1614
  const live = scope[Gen$1] < runId;
1623
1615
  const multiple = Array.isArray(value);
1624
1616
  const normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
1625
- pendingEffects.unshift(() => {
1617
+ pendingEffects.unshift((_) => {
1626
1618
  for (const opt of el.options) {
1627
1619
  const selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
1628
1620
  if (opt.defaultSelected !== selected) {
@@ -1641,13 +1633,13 @@ function _attr_select_value(scope, nodeAccessor, value, valueChange) {
1641
1633
  assertHandlerIsFunction("valueChange", valueChange);
1642
1634
  scope[ControlledHandler + nodeAccessor] = valueChange;
1643
1635
  scope[ControlledType + nodeAccessor] = valueChange ? 3 : 5;
1644
- if (valueChange) pendingEffects.unshift(() => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1645
- if (valueChange && existing) pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope);
1636
+ if (valueChange) pendingEffects.unshift((_) => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1637
+ if (valueChange && existing) pendingEffects.unshift((_) => setSelectValue(el, normalizedValue, multiple), scope);
1646
1638
  else _attr_select_value_default(scope, nodeAccessor, normalizedValue);
1647
1639
  }
1648
1640
  function _attr_select_value_script(scope, nodeAccessor) {
1649
1641
  const el = scope[nodeAccessor];
1650
- const onChange = () => {
1642
+ const onChange = (_) => {
1651
1643
  const valueChange = scope[ControlledHandler + nodeAccessor];
1652
1644
  if (valueChange) {
1653
1645
  const oldValue = scope[ControlledValue + nodeAccessor];
@@ -1671,10 +1663,10 @@ function _attr_select_value_script(scope, nodeAccessor) {
1671
1663
  }
1672
1664
  }
1673
1665
  syncControllableFormInput(el, hasSelectChanged, onChange);
1674
- observeOnce(scope, nodeAccessor, {
1666
+ observeControlled(scope, nodeAccessor, {
1675
1667
  childList: true,
1676
1668
  subtree: true
1677
- }, () => {
1669
+ }, (_) => {
1678
1670
  const value = scope[ControlledValue + nodeAccessor];
1679
1671
  if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) onChange();
1680
1672
  });
@@ -1691,10 +1683,10 @@ function assertSelectValueMatchesOption(el, normalizedValue, value) {
1691
1683
  if ((Array.isArray(normalizedValue) ? normalizedValue : [normalizedValue]).some((v) => v && !options.includes(v))) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
1692
1684
  }
1693
1685
  function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
1694
- if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotVoid(open);
1686
+ if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotNullishOrFalse(open);
1695
1687
  }
1696
1688
  function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
1697
- const normalizedOpen = scope[ControlledValue + nodeAccessor] = isNotVoid(open);
1689
+ const normalizedOpen = scope[ControlledValue + nodeAccessor] = isNotNullishOrFalse(open);
1698
1690
  assertHandlerIsFunction("openChange", openChange);
1699
1691
  scope[ControlledHandler + nodeAccessor] = openChange;
1700
1692
  scope[ControlledType + nodeAccessor] = openChange ? 4 : 5;
@@ -1703,10 +1695,10 @@ function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
1703
1695
  }
1704
1696
  function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1705
1697
  const el = scope[nodeAccessor];
1706
- observeOnce(scope, nodeAccessor, {
1698
+ observeControlled(scope, nodeAccessor, {
1707
1699
  attributes: true,
1708
1700
  attributeFilter: ["open"]
1709
- }, () => {
1701
+ }, (_) => {
1710
1702
  const openChange = scope[ControlledHandler + nodeAccessor];
1711
1703
  if (openChange && el.open === !scope["ControlledValue:" + nodeAccessor]) {
1712
1704
  const newValue = el.open;
@@ -1716,7 +1708,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1716
1708
  }
1717
1709
  });
1718
1710
  }
1719
- function observeOnce(scope, nodeAccessor, init, callback) {
1711
+ function observeControlled(scope, nodeAccessor, init, callback) {
1720
1712
  (scope[ControlledObserver + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
1721
1713
  }
1722
1714
  function syncControllableFormInput(el, hasChanged, onChange) {
@@ -1732,7 +1724,7 @@ function handleChange(ev) {
1732
1724
  function handleFormReset(ev) {
1733
1725
  const handlers = [];
1734
1726
  for (const el of ev.target.elements || []) if (el._ && el.c(el)) handlers.push(el._);
1735
- requestAnimationFrame(() => {
1727
+ requestAnimationFrame((_) => {
1736
1728
  if (!ev.defaultPrevented) for (const change of handlers) change();
1737
1729
  });
1738
1730
  }
@@ -1804,11 +1796,11 @@ function _await_promise(nodeAccessor, params) {
1804
1796
  let awaitBranch = scope[branchAccessor];
1805
1797
  const tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
1806
1798
  if (!tryBranch) {
1807
- const deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1799
+ const deferred = scope[promiseAccessor] = (_) => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1808
1800
  const awaitCounter = findTryWithPlaceholder(scope)?.[AwaitCounter];
1809
1801
  if (awaitCounter?.i) {
1810
1802
  const complete = awaitCounter.c;
1811
- awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
1803
+ awaitCounter.c = (_) => complete() || queueAsyncRender(scope, deferred);
1812
1804
  }
1813
1805
  return;
1814
1806
  }
@@ -1816,14 +1808,14 @@ function _await_promise(nodeAccessor, params) {
1816
1808
  let awaitCounter = tryBranch[AwaitCounter];
1817
1809
  if (!scope[tryAccessor]) {
1818
1810
  scope[tryAccessor] = tryBranch;
1819
- trackAbort(scope, promiseAccessor, () => {
1811
+ trackAbort(scope, promiseAccessor, (_) => {
1820
1812
  scope[promiseAccessor] = 0;
1821
1813
  if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1822
1814
  });
1823
1815
  if (awaitBranch) awaitBranch[PendingRenders] ||= [];
1824
- if (tryBranch !== awaitBranch) awaitCounter = addAwaitCounter(scope, tryBranch);
1816
+ if (tryBranch !== awaitBranch) awaitCounter = startAwait(scope, tryBranch);
1825
1817
  else {
1826
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
1818
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => {
1827
1819
  if (tryBranch === scope[branchAccessor]) {
1828
1820
  const anchor = scope[nodeAccessor];
1829
1821
  if (anchor.parentNode) {
@@ -1833,7 +1825,7 @@ function _await_promise(nodeAccessor, params) {
1833
1825
  }
1834
1826
  }
1835
1827
  });
1836
- scheduleAwaitFrame(awaitCounter, scope, () => {
1828
+ countAwait(awaitCounter, scope, (_) => {
1837
1829
  if (!awaitBranch["#DetachedAwait"]) {
1838
1830
  awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
1839
1831
  tempDetachBranch(tryBranch);
@@ -1850,7 +1842,7 @@ function _await_promise(nodeAccessor, params) {
1850
1842
  awaitPromise(scope, data);
1851
1843
  awaitCounter.c();
1852
1844
  run();
1853
- } else queueAsyncRender(scope, () => {
1845
+ } else queueAsyncRender(scope, (_) => {
1854
1846
  if (!scope[promiseAccessor]) {
1855
1847
  awaitBranch = resolveAwait(scope, referenceNode, data);
1856
1848
  const pendingRenders = awaitBranch[PendingRenders];
@@ -1876,27 +1868,25 @@ function _await_promise(nodeAccessor, params) {
1876
1868
  }
1877
1869
  function _await_content(nodeAccessor, template, walks, setup) {
1878
1870
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1879
- const promiseAccessor = Promise$1 + nodeAccessor;
1880
1871
  const renderer = _content("", template, walks, setup)();
1881
1872
  return (scope) => {
1882
- const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1873
+ const pendingScopes = collectScopes((_) => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1883
1874
  scope[branchAccessor][PendingScopes] = pendingScopes;
1884
- if (typeof scope[promiseAccessor] === "function") scope[promiseAccessor]();
1885
1875
  };
1886
1876
  }
1887
- function addAwaitCounter(scope, tryBranch = findTryWithPlaceholder(scope)) {
1877
+ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1888
1878
  if (!tryBranch) return;
1889
1879
  let awaitCounter = tryBranch[AwaitCounter];
1890
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
1891
- scheduleAwaitFrame(awaitCounter, tryBranch, () => {
1880
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => dismissPlaceholder(tryBranch));
1881
+ countAwait(awaitCounter, tryBranch, (_) => {
1892
1882
  (tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent](), tryBranch["_"], tryBranch[StartNode].parentNode))[TryBranch] = tryBranch;
1893
1883
  insertBranchBefore(tryBranch[PlaceholderBranch], tryBranch[StartNode].parentNode, tryBranch[StartNode]);
1894
1884
  tempDetachBranch(tryBranch);
1895
1885
  });
1896
1886
  return awaitCounter;
1897
1887
  }
1898
- function scheduleAwaitFrame(awaitCounter, scope, render) {
1899
- if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1888
+ function countAwait(awaitCounter, scope, render) {
1889
+ if (!awaitCounter.i++) requestAnimationFrame((_) => awaitCounter.i && runEffects(prepareEffects((_) => queueRender(scope, render, -1))));
1900
1890
  }
1901
1891
  function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
1902
1892
  queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch["#Id"] + 1e9);
@@ -1944,13 +1934,14 @@ function dismissPlaceholder(tryBranch) {
1944
1934
  }
1945
1935
  function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
1946
1936
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1947
- const renderer = _content("", template, walks, setup)();
1937
+ const renderer = _content("", template, walks)();
1948
1938
  return (scope) => {
1949
- setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
1939
+ setBranch(scope, nodeAccessor, renderer, createBranch);
1950
1940
  const branch = scope[branchAccessor];
1951
1941
  branch[BranchAccessor] = nodeAccessor;
1952
1942
  branch[CatchContent] = catchContent;
1953
1943
  branch[PlaceholderContent] = placeholderContent || void 0;
1944
+ if (setup) queueRender(branch, setup, -1);
1954
1945
  };
1955
1946
  }
1956
1947
  function renderCatch(scope, error) {
@@ -1965,8 +1956,11 @@ function renderCatch(scope, error) {
1965
1956
  destroyBranch(tryWithCatch);
1966
1957
  }
1967
1958
  const catchContent = tryWithCatch[CatchContent]();
1968
- setConditionalRenderer(owner, tryWithCatch[BranchAccessor], catchContent, createAndSetupBranch);
1969
- catchContent[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
1959
+ setBranch(owner, tryWithCatch[BranchAccessor], catchContent, createBranch);
1960
+ queueRender(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], (branch) => {
1961
+ setupBranch(catchContent, branch);
1962
+ catchContent[Params]?.(branch, [error]);
1963
+ }, -1);
1970
1964
  }
1971
1965
  }
1972
1966
  function findTryWithPlaceholder(scope) {
@@ -1985,7 +1979,7 @@ const _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
1985
1979
  let i = 0;
1986
1980
  while (i < branchesArgs.length) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
1987
1981
  return (scope, newBranch) => {
1988
- if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0))) setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
1982
+ if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0))) setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
1989
1983
  };
1990
1984
  });
1991
1985
  const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNodeAccessor) => {
@@ -2031,34 +2025,40 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
2031
2025
  const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
2032
2026
  const childScopeAccessor = BranchScopes$1 + nodeAccessor;
2033
2027
  const rendererAccessor = ConditionalRenderer + nodeAccessor;
2028
+ const createTagBranch = ($global, tagNameOrRenderer, scope, parentNode) => {
2029
+ if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2030
+ const branch = createBranch($global, tagNameOrRenderer, scope, parentNode);
2031
+ if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer.toLowerCase()}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
2032
+ if (getTagVar) {
2033
+ branch[TagVariable] = (value) => getTagVar()(scope, value);
2034
+ bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer);
2035
+ }
2036
+ if (typeof tagNameOrRenderer !== "string") setupBranch(tagNameOrRenderer, branch);
2037
+ else if (getContent) {
2038
+ const content = getContent(scope);
2039
+ const elementAccessor = `#${tagNameOrRenderer.toLowerCase()}/0`;
2040
+ setBranch(branch, elementAccessor, content, createAndSetupBranch);
2041
+ if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], branch[BranchScopes$1 + elementAccessor]);
2042
+ }
2043
+ return branch;
2044
+ };
2034
2045
  return (scope, newRenderer, getInput) => {
2035
2046
  const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
2036
2047
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer) || (getContent ? void 0 : 0)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
2037
- const renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
2038
- setConditionalRenderer(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer);
2039
- if (getTagVar) {
2040
- if (normalizedRenderer) {
2041
- scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
2042
- bindTagVar(scope, scope[childScopeAccessor], scope[scopeOffsetAccessor], normalizedRenderer);
2043
- } else getTagVar()(scope);
2044
- }
2045
- if (typeof renderer === "string") {
2046
- if (getContent) {
2047
- const content = getContent(scope);
2048
- setConditionalRenderer(scope[childScopeAccessor], `#${renderer.toLowerCase()}/0`, content, createAndSetupBranch);
2049
- if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${renderer.toLowerCase()}/0`]);
2050
- }
2051
- } else if (renderer) {
2052
- setupBranch(renderer, scope[childScopeAccessor]);
2053
- if (renderer["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2048
+ let renderer = normalizedRenderer;
2049
+ if (renderer) setBranch(scope, nodeAccessor, renderer, createTagBranch);
2050
+ else {
2051
+ if (getTagVar) getTagVar()(scope);
2052
+ setBranch(scope, nodeAccessor, renderer = getContent ? getContent(scope) : void 0, createAndSetupBranch);
2054
2053
  }
2054
+ if (typeof renderer !== "string" && renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2055
2055
  }
2056
2056
  if (normalizedRenderer) {
2057
2057
  const childScope = scope[childScopeAccessor];
2058
2058
  const args = getInput?.();
2059
2059
  if (typeof normalizedRenderer === "string") {
2060
2060
  const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
2061
- (getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope[nodeAccessor].tagName]);
2061
+ (getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope[nodeAccessor].tagName]);
2062
2062
  if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
2063
2063
  } else {
2064
2064
  normalizedRenderer[LocalClosures]?.(childScope);
@@ -2081,7 +2081,7 @@ const _dynamic_tag_content = /*@__PURE__*/ withBranches((nodeAccessor) => {
2081
2081
  const rendererAccessor = ConditionalRenderer + nodeAccessor;
2082
2082
  return (scope, renderer) => {
2083
2083
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer))) {
2084
- setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
2084
+ setBranch(scope, nodeAccessor, renderer, createAndSetupBranch);
2085
2085
  if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2086
2086
  }
2087
2087
  renderer?.[LocalClosures]?.(scope[childScopeAccessor]);
@@ -2094,7 +2094,7 @@ function installDynamicTagVar(bind) {
2094
2094
  function dynamicTagScript(branch) {
2095
2095
  _attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
2096
2096
  }
2097
- function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
2097
+ function setBranch(scope, nodeAccessor, newRenderer, createBranch) {
2098
2098
  const referenceNode = scope[nodeAccessor];
2099
2099
  const prevBranch = scope[BranchScopes$1 + nodeAccessor];
2100
2100
  const parentNode = referenceNode.nodeType > 1 ? (prevBranch?.["#StartNode"] || referenceNode).parentNode : referenceNode;
@@ -2121,7 +2121,7 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2121
2121
  return (scope, value) => {
2122
2122
  const referenceNode = scope[nodeAccessor];
2123
2123
  const oldScopes = toArray(scope[scopesAccessor]);
2124
- const newScopes = scope[scopesAccessor] = [];
2124
+ const newScopes = [];
2125
2125
  scope[keyedScopesAccessor] = null;
2126
2126
  const oldLen = oldScopes.length;
2127
2127
  const parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.["#StartNode"].parentNode : referenceNode;
@@ -2137,11 +2137,15 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2137
2137
  if (branch) {
2138
2138
  hasPotentialMoves = true;
2139
2139
  oldScopesByKey?.delete(key);
2140
- } else branch = createAndSetupBranch(scope[Global], renderer, scope, parentNode);
2141
- branch[LoopKey] = key;
2140
+ branch[LoopKey] = key;
2141
+ } else {
2142
+ (branch = createBranch(scope[Global], renderer, scope, parentNode))[LoopKey] = key;
2143
+ setupBranch(renderer, branch);
2144
+ }
2142
2145
  newScopes.push(branch);
2143
2146
  params?.(branch, args);
2144
2147
  });
2148
+ scope[scopesAccessor] = newScopes;
2145
2149
  const newLen = newScopes.length;
2146
2150
  const hasSiblings = referenceNode !== parentNode;
2147
2151
  let afterReference = null;
@@ -2238,12 +2242,6 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
2238
2242
  afterReference = newScopes[start + i][StartNode];
2239
2243
  }
2240
2244
  }
2241
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
2242
- if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2243
- const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
2244
- if (typeof tagNameOrRenderer === "string") branch[`#${tagNameOrRenderer.toLowerCase()}/0`] = branch[StartNode] = branch[EndNode] = document.createElementNS(tagNameOrRenderer === "svg" ? "http://www.w3.org/2000/svg" : tagNameOrRenderer === "math" ? "http://www.w3.org/1998/Math/MathML" : parentNode.namespaceURI, tagNameOrRenderer);
2245
- return branch;
2246
- }
2247
2245
  function bySecondArg(_item, index) {
2248
2246
  return index;
2249
2247
  }
@@ -2323,6 +2321,12 @@ Object.defineProperty(exports, "Load", {
2323
2321
  return Load;
2324
2322
  }
2325
2323
  });
2324
+ Object.defineProperty(exports, "LocalClosures", {
2325
+ enumerable: true,
2326
+ get: function() {
2327
+ return LocalClosures;
2328
+ }
2329
+ });
2326
2330
  Object.defineProperty(exports, "Owner", {
2327
2331
  enumerable: true,
2328
2332
  get: function() {
@@ -2635,12 +2639,6 @@ Object.defineProperty(exports, "_call", {
2635
2639
  return _call;
2636
2640
  }
2637
2641
  });
2638
- Object.defineProperty(exports, "_child_setup", {
2639
- enumerable: true,
2640
- get: function() {
2641
- return _child_setup;
2642
- }
2643
- });
2644
2642
  Object.defineProperty(exports, "_closure", {
2645
2643
  enumerable: true,
2646
2644
  get: function() {
@@ -2953,22 +2951,16 @@ Object.defineProperty(exports, "_var_resume", {
2953
2951
  return _var_resume;
2954
2952
  }
2955
2953
  });
2956
- Object.defineProperty(exports, "addAwaitCounter", {
2957
- enumerable: true,
2958
- get: function() {
2959
- return addAwaitCounter;
2960
- }
2961
- });
2962
- Object.defineProperty(exports, "controllableRenders", {
2954
+ Object.defineProperty(exports, "controllableScripts", {
2963
2955
  enumerable: true,
2964
2956
  get: function() {
2965
- return controllableRenders;
2957
+ return controllableScripts;
2966
2958
  }
2967
2959
  });
2968
- Object.defineProperty(exports, "controllableScripts", {
2960
+ Object.defineProperty(exports, "controllableSpreadHelpers", {
2969
2961
  enumerable: true,
2970
2962
  get: function() {
2971
- return controllableScripts;
2963
+ return controllableSpreadHelpers;
2972
2964
  }
2973
2965
  });
2974
2966
  Object.defineProperty(exports, "createAndSetupBranch", {
@@ -3163,6 +3155,12 @@ Object.defineProperty(exports, "setupBranch", {
3163
3155
  return setupBranch;
3164
3156
  }
3165
3157
  });
3158
+ Object.defineProperty(exports, "startAwait", {
3159
+ enumerable: true,
3160
+ get: function() {
3161
+ return startAwait;
3162
+ }
3163
+ });
3166
3164
  Object.defineProperty(exports, "syncGen", {
3167
3165
  enumerable: true,
3168
3166
  get: function() {