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
@@ -71,7 +71,7 @@ const Returns = "returns";
71
71
  const Lazy = "lazy";
72
72
  //#endregion
73
73
  //#region src/common/helpers.ts
74
- const htmlAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
74
+ const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
75
75
  const knownWrongAttrs = {
76
76
  className: "class",
77
77
  classList: "class",
@@ -113,11 +113,11 @@ function _call(fn, v) {
113
113
  fn(v);
114
114
  return v;
115
115
  }
116
- function stringifyClassObject(name, value) {
116
+ function stringifyClassEntry(name, value) {
117
117
  return value ? name : "";
118
118
  }
119
119
  const warnedStyleKeys = /* @__PURE__ */ new Set();
120
- function stringifyStyleObject(name, value) {
120
+ function stringifyStyleEntry(name, value) {
121
121
  if (/[A-Z]/.test(name) && !name.includes("-") && !warnedStyleKeys.has(name)) {
122
122
  warnedStyleKeys.add(name);
123
123
  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-")}\`.`);
@@ -164,10 +164,10 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
164
164
  function isEventHandler(name) {
165
165
  return /^on[A-Z-]/.test(name);
166
166
  }
167
- function getEventHandlerName(name) {
167
+ function getEventType(name) {
168
168
  return name[2] === "-" ? name.slice(3) : name.slice(2).toLowerCase();
169
169
  }
170
- function isNotVoid(value) {
170
+ function isNotNullishOrFalse(value) {
171
171
  return value != null && value !== false;
172
172
  }
173
173
  function isPromise(value) {
@@ -196,9 +196,9 @@ function withDynamicHtml(runtime) {
196
196
  }
197
197
  //#endregion
198
198
  //#region src/common/errors.ts
199
- const lowercaseEventHandlerReg = /^on[a-z]/;
199
+ const lowercaseOnAttrReg = /^on[a-z]/;
200
200
  function assertValidAttrValue(name, value) {
201
- 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.`);
201
+ 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.`);
202
202
  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." : ""}`);
203
203
  const unrenderable = describeUnrenderable(value);
204
204
  if (unrenderable) throw new Error(`The \`${name}\` attribute cannot be ${unrenderable}.`);
@@ -237,7 +237,7 @@ function describeUnrenderable(value) {
237
237
  }
238
238
  }
239
239
  function assertValidLoopKey(key, seenKeys) {
240
- 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}"`}.`);
240
+ 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}"`}.`);
241
241
  if (seenKeys) {
242
242
  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.`);
243
243
  seenKeys.add(key);
@@ -246,7 +246,7 @@ function assertValidLoopKey(key, seenKeys) {
246
246
  function assertValidList(value) {
247
247
  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)}.`);
248
248
  }
249
- function assertValidRangeStart(name, value) {
249
+ function assertOptionalRangeNumber(name, value) {
250
250
  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)}.`);
251
251
  }
252
252
  function assertValidRangeBound(name, value) {
@@ -256,7 +256,7 @@ function describeForValue(value) {
256
256
  return typeof value === "number" || typeof value === "bigint" ? `\`${value}\`` : value === null ? "null" : `type "${typeof value}"`;
257
257
  }
258
258
  function assertValidAttrName(name) {
259
- if (htmlAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
259
+ if (invalidNativeAttrNameReg.test(name)) throw new Error(`Invalid attribute name: ${JSON.stringify(name)}`);
260
260
  const suggestion = getWrongAttrSuggestion(name);
261
261
  if (suggestion) throw new Error(`\`${name}\` is not a valid attribute, did you mean \`${suggestion}\`?`);
262
262
  }
@@ -324,16 +324,16 @@ function forOf(list, cb) {
324
324
  }
325
325
  function forTo(to, from, step, cb) {
326
326
  assertValidRangeBound("to", to);
327
- assertValidRangeStart("from", from);
328
- assertValidRangeStart("step", step);
327
+ assertOptionalRangeNumber("from", from);
328
+ assertOptionalRangeNumber("step", step);
329
329
  const start = from || 0;
330
330
  const delta = step || 1;
331
331
  for (let steps = (to - start) / delta, i = 0; i <= steps; i++) cb(start + i * delta);
332
332
  }
333
333
  function forUntil(until, from, step, cb) {
334
334
  assertValidRangeBound("until", until);
335
- assertValidRangeStart("from", from);
336
- assertValidRangeStart("step", step);
335
+ assertOptionalRangeNumber("from", from);
336
+ assertOptionalRangeNumber("step", step);
337
337
  const start = from || 0;
338
338
  const delta = step || 1;
339
339
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
@@ -532,7 +532,7 @@ function push(opt, item) {
532
532
  //#region src/dom/event.ts
533
533
  function _on(element, type, handler) {
534
534
  assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
535
- if (element[1 + type] === void 0) delegate(type, handleDelegated);
535
+ delegate(type, handleDelegated);
536
536
  element[1 + type] = handler || null;
537
537
  }
538
538
  const delegate = (type, handler) => handler[1 + type] ||= (document.addEventListener(type, handler, true), 1);
@@ -641,7 +641,7 @@ function schedule() {
641
641
  if (!isScheduled) {
642
642
  if (console.createTask) {
643
643
  const task = console.createTask("queue");
644
- runTask = () => task.run(run);
644
+ runTask = (_) => task.run(run);
645
645
  } else runTask = run;
646
646
  isScheduled = 1;
647
647
  queueMicrotask(flushAndWaitFrame);
@@ -654,7 +654,7 @@ function flushAndWaitFrame() {
654
654
  function triggerMacroTask() {
655
655
  if (!channel) {
656
656
  channel = new MessageChannel();
657
- channel.port1.onmessage = () => {
657
+ channel.port1.onmessage = (_) => {
658
658
  isScheduled = 0;
659
659
  {
660
660
  const run = runTask;
@@ -719,22 +719,22 @@ function _for_closure(ownerLoopNodeAccessor, fn) {
719
719
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
720
720
  const ownerSignal = (ownerScope) => {
721
721
  const scopes = toArray(ownerScope[scopeAccessor]);
722
- queueRender(ownerScope, () => {
722
+ queueRender(ownerScope, (_) => {
723
723
  for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
724
724
  }, -1);
725
725
  };
726
- ownerSignal._ = fn;
726
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
727
727
  return ownerSignal;
728
728
  }
729
- function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccessor, fn) {
729
+ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
730
730
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
731
731
  const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
732
732
  const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
733
733
  const ownerSignal = (ownerScope) => {
734
734
  if (ownerScope["#Gen"] < runId) {
735
735
  const nextKey = ownerScope[ownerValueAccessor];
736
- queueRender(ownerScope, () => {
737
- const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor);
736
+ queueRender(ownerScope, (_) => {
737
+ const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
738
738
  if (map && prevKeyProp in map) {
739
739
  const prevScope = map.get(map[prevKeyProp]);
740
740
  const nextScope = map.get(nextKey);
@@ -747,15 +747,14 @@ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, keyValueAccess
747
747
  }, -1);
748
748
  }
749
749
  };
750
- ownerSignal._ = fn;
750
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
751
751
  return ownerSignal;
752
752
  }
753
- function keyedScopes(ownerScope, scopeAccessor, mapAccessor, keyValueAccessor) {
753
+ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
754
754
  const map = ownerScope[mapAccessor] ||= /* @__PURE__ */ new Map();
755
755
  if (!map.size) for (const scope of toArray(ownerScope[scopeAccessor])) {
756
- const key = scope["#LoopKey"] ?? scope[keyValueAccessor];
756
+ const key = scope[LoopKey];
757
757
  if (key === void 0) return ownerScope[mapAccessor] = null;
758
- scope[LoopKey] = key;
759
758
  map.set(key, scope);
760
759
  }
761
760
  return map;
@@ -770,11 +769,11 @@ function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
770
769
  const ifScope = scope[scopeAccessor];
771
770
  if (ifScope && ifScope["#Gen"] > 0 && ifScope["#Gen"] < runId && (scope[branchAccessor] || 0) === branch) queueRender(ifScope, fn, -1);
772
771
  };
773
- ownerSignal._ = fn;
772
+ ownerSignal._ = (scope) => queueRender(scope, fn, -1);
774
773
  return ownerSignal;
775
774
  }
776
- function subscribeToScopeSet(ownerScope, accessor, scope) {
777
- const subscribers = ownerScope[accessor] ||= /* @__PURE__ */ new Set();
775
+ function subscribeToScopeSet(owner, accessor, scope) {
776
+ const subscribers = owner[accessor] ||= /* @__PURE__ */ new Set();
778
777
  const { size } = subscribers;
779
778
  if (subscribers.add(scope).size !== size) trackCleanup(scope, subscribers);
780
779
  }
@@ -786,7 +785,7 @@ function _closure(...closureSignals) {
786
785
  return (scope) => {
787
786
  if (scope[scopeInstances]) {
788
787
  scope[scopeInstances][Changed] = 1;
789
- for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) queueRender(childScope, closureSignals[childScope[signalIndex] || 0], -1);
788
+ for (const childScope of scope[scopeInstances]) if (childScope["#Gen"] > 0 && childScope["#Gen"] < runId) closureSignals[childScope[signalIndex] || 0](childScope);
790
789
  }
791
790
  };
792
791
  }
@@ -794,22 +793,15 @@ function _closure_get(valueAccessor, fn, getOwnerScope, resumeId) {
794
793
  const closureSignal = ((scope, resumed) => {
795
794
  const ownerScope = getOwnerScope ? getOwnerScope(scope) : scope["_"];
796
795
  scope[closureSignal[SignalIndexAccessor]] = closureSignal[Index];
797
- if (!resumed) fn(scope);
798
- else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, closureSignal);
799
796
  subscribeToScopeSet(ownerScope, closureSignal[ScopeInstancesAccessor], scope);
797
+ if (!resumed) queueRender(scope, fn, -1);
798
+ else if (ownerScope[closureSignal["scopeInstancesAccessor"]]["Changed"]) queueAsyncRender(scope, fn);
800
799
  });
801
800
  closureSignal[ScopeInstancesAccessor] = ClosureScopes + valueAccessor;
802
801
  closureSignal[SignalIndexAccessor] = ClosureSignalIndex + valueAccessor;
803
802
  if (resumeId) _resumed[resumeId] = (scope) => closureSignal(scope, 1);
804
803
  return closureSignal;
805
804
  }
806
- function _child_setup(setup) {
807
- setup._ = (scope, owner) => {
808
- scope["_"] ||= owner;
809
- queueRender(scope, setup, -1);
810
- };
811
- return setup;
812
- }
813
805
  function _var(scope, childAccessor, signal) {
814
806
  const childScope = scope[childAccessor];
815
807
  childScope[TagVariable] = (value) => signal(scope, value);
@@ -825,13 +817,13 @@ const _var_change = (scope, value, name = "This") => {
825
817
  };
826
818
  const tagIdsByGlobal = /* @__PURE__ */ new WeakMap();
827
819
  function _id(scope, accessor) {
828
- let id = accessor !== void 0 && scope[accessor];
820
+ let id = accessor && scope[accessor];
829
821
  if (!id) {
830
822
  const $global = scope[Global];
831
823
  const n = tagIdsByGlobal.get($global) || 0;
832
824
  tagIdsByGlobal.set($global, n + 1);
833
825
  id = "c" + $global.runtimeId + $global.renderId + n.toString(36);
834
- if (accessor !== void 0) scope[accessor] = id;
826
+ if (accessor) scope[accessor] = id;
835
827
  }
836
828
  return id;
837
829
  }
@@ -865,7 +857,7 @@ function* traverse(scope, path, args, i = path.length - 1) {
865
857
  function _hoist(...path) {
866
858
  return (scope) => {
867
859
  const fn = (...args) => traverse(scope, path, args).next().value;
868
- fn[Symbol.iterator] = () => traverse(scope, path, []);
860
+ fn[Symbol.iterator] = (_) => traverse(scope, path, []);
869
861
  return fn;
870
862
  };
871
863
  }
@@ -899,7 +891,11 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
899
891
  if (value === 48) scope[getDebugKey(currentScopeIndex++, "#scopeOffset")] = skipScope();
900
892
  } else if (value < 92) {
901
893
  value = 25 * currentMultiplier + value - 67;
902
- while (value--) walkNextNode();
894
+ while (value--) if (currentNode.firstChild) currentNode = currentNode.firstChild;
895
+ else {
896
+ while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
897
+ walkNextSibling();
898
+ }
903
899
  } else if (value < 107) {
904
900
  value = 10 * currentMultiplier + value - 97;
905
901
  while (value--) walkNextSibling();
@@ -920,12 +916,7 @@ function getDebugKey(index, node) {
920
916
  else if (node.nodeType === 1) return `#${node.tagName.toLowerCase()}/${index}`;
921
917
  return index;
922
918
  }
923
- const walkNextNode = () => {
924
- if (currentNode.firstChild) return currentNode = currentNode.firstChild;
925
- while (!currentNode.nextSibling && currentNode.parentNode) currentNode = currentNode.parentNode;
926
- walkNextSibling();
927
- };
928
- const walkNextSibling = () => currentNode = currentNode.nextSibling || currentNode;
919
+ const walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode;
929
920
  //#endregion
930
921
  //#region src/dom/resume.ts
931
922
  const _resumed = {};
@@ -949,7 +940,7 @@ function withLazy() {
949
940
  function initEmbedded(readyId, runtimeId) {
950
941
  if (!embedRenders) {
951
942
  embedRenders = /* @__PURE__ */ new Map();
952
- new MutationObserver(() => {
943
+ new MutationObserver((_) => {
953
944
  for (const [anchor, [renderId, scopes]] of embedRenders) if (!anchor.isConnected) {
954
945
  embedRenders.delete(anchor);
955
946
  delete curRenders[renderId];
@@ -977,7 +968,7 @@ function init(runtimeId = "M") {
977
968
  const scopeLookup = {};
978
969
  const pending = [];
979
970
  const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
980
- const initGlobal = () => scopeLookup[0] ||= {
971
+ const initGlobal = (_) => scopeLookup[0] ||= {
981
972
  runtimeId,
982
973
  renderId
983
974
  };
@@ -1051,7 +1042,7 @@ function init(runtimeId = "M") {
1051
1042
  } else pending.push(visitScope);
1052
1043
  };
1053
1044
  };
1054
- const nextToken = () => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1045
+ const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1055
1046
  const processResumes = (resumes = [], effects) => {
1056
1047
  let i = 0;
1057
1048
  for (; i < resumes.length; i++) {
@@ -1125,7 +1116,7 @@ function init(runtimeId = "M") {
1125
1116
  visits.length = retained;
1126
1117
  return effects;
1127
1118
  };
1128
- render.w = () => {
1119
+ render.w = (_) => {
1129
1120
  walk();
1130
1121
  runResumeEffects(render);
1131
1122
  };
@@ -1157,10 +1148,10 @@ function _var_resume(id, signal) {
1157
1148
  return signal;
1158
1149
  }
1159
1150
  function _el(id, accessor) {
1160
- return _resumed[id] = (scope) => () => _el_read(scope[accessor]);
1151
+ return _resumed[id] = (scope) => (_) => _el_read(scope[accessor]);
1161
1152
  }
1162
1153
  function _dynamic_tag_var_resume(accessor) {
1163
- _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => () => {
1154
+ _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => (_) => {
1164
1155
  const node = scope[accessor];
1165
1156
  return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1166
1157
  };
@@ -1186,11 +1177,11 @@ function createAndSetupBranch($global, renderer, parentScope, parentNode) {
1186
1177
  return setupBranch(renderer, createBranch($global, renderer, parentScope, parentNode));
1187
1178
  }
1188
1179
  function setupBranch(renderer, branch) {
1189
- if (renderer["setup"]) queueRender(branch, renderer[Setup], -1);
1180
+ renderer[Setup]?.(branch);
1190
1181
  return branch;
1191
1182
  }
1192
1183
  function _return_setup(setup) {
1193
- (setup._ || setup)[Returns] = 1;
1184
+ setup[Returns] = 1;
1194
1185
  return setup;
1195
1186
  }
1196
1187
  function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
@@ -1229,14 +1220,15 @@ function _content_closures(renderer, closureFns) {
1229
1220
  for (const key in closureFns) closureSignals[key] = _const(key, closureFns[key]);
1230
1221
  return (owner, closureValues) => {
1231
1222
  const instance = renderer(owner);
1232
- const clone = instance[Clone];
1223
+ const setup = instance[Setup];
1233
1224
  const setClosures = instance[LocalClosures] = (branch) => {
1234
1225
  for (const key in closureSignals) closureSignals[key](branch, closureValues[key]);
1235
1226
  };
1236
- instance[Clone] = (branch, ns) => {
1237
- clone(branch, ns);
1227
+ instance[Setup] = (branch) => {
1228
+ setup?.(branch);
1238
1229
  setClosures(branch);
1239
1230
  };
1231
+ instance[Setup][Returns] = (setup || instance["params"])?.[Returns];
1240
1232
  return instance;
1241
1233
  };
1242
1234
  }
@@ -1271,7 +1263,7 @@ function setAttribute(element, name, value) {
1271
1263
  }
1272
1264
  }
1273
1265
  function _attr_class(element, value) {
1274
- setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassObject) || void 0);
1266
+ setAttribute(element, "class", toDelimitedString(value, " ", stringifyClassEntry) || void 0);
1275
1267
  }
1276
1268
  function _attr_class_items(element, items) {
1277
1269
  for (const key in items) _attr_class_item(element, key, items[key]);
@@ -1288,7 +1280,7 @@ function _attr_class_names(element, names, value) {
1288
1280
  } while (start = end + 1);
1289
1281
  }
1290
1282
  function _attr_style(element, value) {
1291
- setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleObject) || void 0);
1283
+ setAttribute(element, "style", toDelimitedString(value, ";", stringifyStyleEntry) || void 0);
1292
1284
  }
1293
1285
  function _attr_style_items(element, items) {
1294
1286
  for (const key in items) _attr_style_item(element, key, items[key]);
@@ -1345,7 +1337,7 @@ function _attrs_partial(scope, nodeAccessor, nextAttrs, skip, controllable) {
1345
1337
  if (!skip[name] && !(nextAttrs && (name in nextAttrs || hasAttrAlias(el, name, nextAttrs)))) el.removeAttribute(name);
1346
1338
  }
1347
1339
  for (const name in nextAttrs) {
1348
- const key = isEventHandler(name) ? `on-${getEventHandlerName(name)}` : name;
1340
+ const key = isEventHandler(name) ? `on-${getEventType(name)}` : name;
1349
1341
  if (!skip[key]) partial[key] = nextAttrs[name];
1350
1342
  }
1351
1343
  assertExclusiveAttrs({
@@ -1379,7 +1371,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
1379
1371
  break;
1380
1372
  default:
1381
1373
  assertValidAttrName(name);
1382
- if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[getEventHandlerName(name)] = value;
1374
+ if (isEventHandler(name)) (events ||= scope[EventAttributes + nodeAccessor] = {})[getEventType(name)] = value;
1383
1375
  else if (!(skip?.test(name) || name === "content" && el.tagName !== "META")) _attr(el, name, value);
1384
1376
  }
1385
1377
  }
@@ -1387,7 +1379,7 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
1387
1379
  function _attr_content(scope, nodeAccessor, value) {
1388
1380
  const content = normalizeClientRender(value);
1389
1381
  if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
1390
- setConditionalRenderer(scope, nodeAccessor, content, createAndSetupBranch);
1382
+ setBranch(scope, nodeAccessor, content, createAndSetupBranch);
1391
1383
  if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
1392
1384
  }
1393
1385
  content?.[LocalClosures]?.(scope[BranchScopes$1 + nodeAccessor]);
@@ -1428,7 +1420,7 @@ function normalizeClientRender(value) {
1428
1420
  }
1429
1421
  }
1430
1422
  function normalizeAttrValue(value) {
1431
- if (isNotVoid(value)) return value === true ? "" : value + "";
1423
+ if (isNotNullishOrFalse(value)) return value === true ? "" : value + "";
1432
1424
  }
1433
1425
  function _lifecycle(scope, thisObj, index = 0) {
1434
1426
  const accessor = Lifecycle + index;
@@ -1443,7 +1435,7 @@ function _lifecycle(scope, thisObj, index = 0) {
1443
1435
  Object.assign(thisObj, thisObj.onMount?.());
1444
1436
  for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
1445
1437
  }
1446
- trackAbort(scope, accessor, () => thisObj.onDestroy?.());
1438
+ trackAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1447
1439
  }
1448
1440
  }
1449
1441
  function removeChildNodes(startNode, endNode) {
@@ -1489,7 +1481,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
1489
1481
  let inputType = "";
1490
1482
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
1491
1483
  const el = scope[nodeAccessor];
1492
- const normalizedChecked = isNotVoid(checked);
1484
+ const normalizedChecked = isNotNullishOrFalse(checked);
1493
1485
  if (el.defaultChecked !== normalizedChecked) {
1494
1486
  const restoreValue = scope["#Gen"] < runId ? el.checked : normalizedChecked;
1495
1487
  el.defaultChecked = normalizedChecked;
@@ -1501,11 +1493,11 @@ function _attr_input_checked_default(scope, nodeAccessor, checked) {
1501
1493
  * resolves the kind at run time). */
1502
1494
  const controllableScripts = {};
1503
1495
  /** The render pass equivalent, for a tag whose name is only known at run time;
1504
- * a statically named tag passes its claim to `_attrs` instead. */
1505
- const controllableRenders = {};
1496
+ * a statically named tag passes its helper to `_attrs` instead. */
1497
+ const controllableSpreadHelpers = {};
1506
1498
  function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
1507
1499
  const el = scope[nodeAccessor];
1508
- const normalizedChecked = isNotVoid(checked);
1500
+ const normalizedChecked = isNotNullishOrFalse(checked);
1509
1501
  assertHandlerIsFunction("checkedChange", checkedChange);
1510
1502
  scope[ControlledHandler + nodeAccessor] = checkedChange;
1511
1503
  scope[ControlledType + nodeAccessor] = checkedChange ? 0 : 5;
@@ -1514,7 +1506,7 @@ function _attr_input_checked(scope, nodeAccessor, checked, checkedChange) {
1514
1506
  }
1515
1507
  function _attr_input_checked_script(scope, nodeAccessor) {
1516
1508
  const el = scope[nodeAccessor];
1517
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1509
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1518
1510
  const checkedChange = scope[ControlledHandler + nodeAccessor];
1519
1511
  if (checkedChange) {
1520
1512
  const newValue = el.checked;
@@ -1549,7 +1541,7 @@ function _attr_input_checkedValue_script(scope, nodeAccessor) {
1549
1541
  if (scope["ControlledValue:" + nodeAccessor]) scope[ControlledValue + nodeAccessor].push(el.value);
1550
1542
  else scope[ControlledValue + nodeAccessor] = el.value;
1551
1543
  }
1552
- syncControllableFormInput(el, hasCheckboxChanged, () => {
1544
+ syncControllableFormInput(el, hasCheckboxChanged, (_) => {
1553
1545
  const checkedValueChange = scope[ControlledHandler + nodeAccessor];
1554
1546
  if (checkedValueChange) {
1555
1547
  const controlledValueKey = ControlledValue + nodeAccessor;
@@ -1621,7 +1613,7 @@ function _attr_select_value_default(scope, nodeAccessor, value) {
1621
1613
  const live = scope[Gen$1] < runId;
1622
1614
  const multiple = Array.isArray(value);
1623
1615
  const normalizedValue = multiple ? value.map(normalizeStrProp) : normalizeStrProp(value);
1624
- pendingEffects.unshift(() => {
1616
+ pendingEffects.unshift((_) => {
1625
1617
  for (const opt of el.options) {
1626
1618
  const selected = multiple ? normalizedValue.includes(opt.value) : opt.value === normalizedValue;
1627
1619
  if (opt.defaultSelected !== selected) {
@@ -1640,13 +1632,13 @@ function _attr_select_value(scope, nodeAccessor, value, valueChange) {
1640
1632
  assertHandlerIsFunction("valueChange", valueChange);
1641
1633
  scope[ControlledHandler + nodeAccessor] = valueChange;
1642
1634
  scope[ControlledType + nodeAccessor] = valueChange ? 3 : 5;
1643
- if (valueChange) pendingEffects.unshift(() => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1644
- if (valueChange && existing) pendingEffects.unshift(() => setSelectValue(el, normalizedValue, multiple), scope);
1635
+ if (valueChange) pendingEffects.unshift((_) => assertSelectValueMatchesOption(el, normalizedValue, value), scope);
1636
+ if (valueChange && existing) pendingEffects.unshift((_) => setSelectValue(el, normalizedValue, multiple), scope);
1645
1637
  else _attr_select_value_default(scope, nodeAccessor, normalizedValue);
1646
1638
  }
1647
1639
  function _attr_select_value_script(scope, nodeAccessor) {
1648
1640
  const el = scope[nodeAccessor];
1649
- const onChange = () => {
1641
+ const onChange = (_) => {
1650
1642
  const valueChange = scope[ControlledHandler + nodeAccessor];
1651
1643
  if (valueChange) {
1652
1644
  const oldValue = scope[ControlledValue + nodeAccessor];
@@ -1670,10 +1662,10 @@ function _attr_select_value_script(scope, nodeAccessor) {
1670
1662
  }
1671
1663
  }
1672
1664
  syncControllableFormInput(el, hasSelectChanged, onChange);
1673
- observeOnce(scope, nodeAccessor, {
1665
+ observeControlled(scope, nodeAccessor, {
1674
1666
  childList: true,
1675
1667
  subtree: true
1676
- }, () => {
1668
+ }, (_) => {
1677
1669
  const value = scope[ControlledValue + nodeAccessor];
1678
1670
  if (Array.isArray(value) ? value.length !== el.selectedOptions.length || value.some((_, i) => !value.includes(el.selectedOptions[i].value)) : el.value !== value) onChange();
1679
1671
  });
@@ -1690,10 +1682,10 @@ function assertSelectValueMatchesOption(el, normalizedValue, value) {
1690
1682
  if ((Array.isArray(normalizedValue) ? normalizedValue : [normalizedValue]).some((v) => v && !options.includes(v))) console.error("A controlled `<select>`'s `value` has no matching `<option>`:", value);
1691
1683
  }
1692
1684
  function _attr_details_or_dialog_open_default(scope, nodeAccessor, open) {
1693
- if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotVoid(open);
1685
+ if (scope["#Gen"] === runId) scope[nodeAccessor].open = isNotNullishOrFalse(open);
1694
1686
  }
1695
1687
  function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
1696
- const normalizedOpen = scope[ControlledValue + nodeAccessor] = isNotVoid(open);
1688
+ const normalizedOpen = scope[ControlledValue + nodeAccessor] = isNotNullishOrFalse(open);
1697
1689
  assertHandlerIsFunction("openChange", openChange);
1698
1690
  scope[ControlledHandler + nodeAccessor] = openChange;
1699
1691
  scope[ControlledType + nodeAccessor] = openChange ? 4 : 5;
@@ -1702,10 +1694,10 @@ function _attr_details_or_dialog_open(scope, nodeAccessor, open, openChange) {
1702
1694
  }
1703
1695
  function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1704
1696
  const el = scope[nodeAccessor];
1705
- observeOnce(scope, nodeAccessor, {
1697
+ observeControlled(scope, nodeAccessor, {
1706
1698
  attributes: true,
1707
1699
  attributeFilter: ["open"]
1708
- }, () => {
1700
+ }, (_) => {
1709
1701
  const openChange = scope[ControlledHandler + nodeAccessor];
1710
1702
  if (openChange && el.open === !scope["ControlledValue:" + nodeAccessor]) {
1711
1703
  const newValue = el.open;
@@ -1715,7 +1707,7 @@ function _attr_details_or_dialog_open_script(scope, nodeAccessor) {
1715
1707
  }
1716
1708
  });
1717
1709
  }
1718
- function observeOnce(scope, nodeAccessor, init, callback) {
1710
+ function observeControlled(scope, nodeAccessor, init, callback) {
1719
1711
  (scope[ControlledObserver + nodeAccessor] ||= new MutationObserver(callback)).observe(scope[nodeAccessor], init);
1720
1712
  }
1721
1713
  function syncControllableFormInput(el, hasChanged, onChange) {
@@ -1731,7 +1723,7 @@ function handleChange(ev) {
1731
1723
  function handleFormReset(ev) {
1732
1724
  const handlers = [];
1733
1725
  for (const el of ev.target.elements || []) if (el._ && el.c(el)) handlers.push(el._);
1734
- requestAnimationFrame(() => {
1726
+ requestAnimationFrame((_) => {
1735
1727
  if (!ev.defaultPrevented) for (const change of handlers) change();
1736
1728
  });
1737
1729
  }
@@ -1803,11 +1795,11 @@ function _await_promise(nodeAccessor, params) {
1803
1795
  let awaitBranch = scope[branchAccessor];
1804
1796
  const tryBranch = scope[tryAccessor] || isPromise(promise) && findTryWithPlaceholder(scope) || awaitBranch;
1805
1797
  if (!tryBranch) {
1806
- const deferred = scope[promiseAccessor] = () => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1798
+ const deferred = scope[promiseAccessor] = (_) => deferred === scope[promiseAccessor] && awaitPromise(scope, promise);
1807
1799
  const awaitCounter = findTryWithPlaceholder(scope)?.[AwaitCounter];
1808
1800
  if (awaitCounter?.i) {
1809
1801
  const complete = awaitCounter.c;
1810
- awaitCounter.c = () => complete() || queueAsyncRender(scope, deferred);
1802
+ awaitCounter.c = (_) => complete() || queueAsyncRender(scope, deferred);
1811
1803
  }
1812
1804
  return;
1813
1805
  }
@@ -1815,14 +1807,14 @@ function _await_promise(nodeAccessor, params) {
1815
1807
  let awaitCounter = tryBranch[AwaitCounter];
1816
1808
  if (!scope[tryAccessor]) {
1817
1809
  scope[tryAccessor] = tryBranch;
1818
- trackAbort(scope, promiseAccessor, () => {
1810
+ trackAbort(scope, promiseAccessor, (_) => {
1819
1811
  scope[promiseAccessor] = 0;
1820
1812
  if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1821
1813
  });
1822
1814
  if (awaitBranch) awaitBranch[PendingRenders] ||= [];
1823
- if (tryBranch !== awaitBranch) awaitCounter = addAwaitCounter(scope, tryBranch);
1815
+ if (tryBranch !== awaitBranch) awaitCounter = startAwait(scope, tryBranch);
1824
1816
  else {
1825
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => {
1817
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => {
1826
1818
  if (tryBranch === scope[branchAccessor]) {
1827
1819
  const anchor = scope[nodeAccessor];
1828
1820
  if (anchor.parentNode) {
@@ -1832,7 +1824,7 @@ function _await_promise(nodeAccessor, params) {
1832
1824
  }
1833
1825
  }
1834
1826
  });
1835
- scheduleAwaitFrame(awaitCounter, scope, () => {
1827
+ countAwait(awaitCounter, scope, (_) => {
1836
1828
  if (!awaitBranch["#DetachedAwait"]) {
1837
1829
  awaitBranch[StartNode].parentNode.insertBefore(scope[nodeAccessor], awaitBranch[StartNode]);
1838
1830
  tempDetachBranch(tryBranch);
@@ -1849,7 +1841,7 @@ function _await_promise(nodeAccessor, params) {
1849
1841
  awaitPromise(scope, data);
1850
1842
  awaitCounter.c();
1851
1843
  run();
1852
- } else queueAsyncRender(scope, () => {
1844
+ } else queueAsyncRender(scope, (_) => {
1853
1845
  if (!scope[promiseAccessor]) {
1854
1846
  awaitBranch = resolveAwait(scope, referenceNode, data);
1855
1847
  const pendingRenders = awaitBranch[PendingRenders];
@@ -1875,27 +1867,25 @@ function _await_promise(nodeAccessor, params) {
1875
1867
  }
1876
1868
  function _await_content(nodeAccessor, template, walks, setup) {
1877
1869
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1878
- const promiseAccessor = Promise$1 + nodeAccessor;
1879
1870
  const renderer = _content("", template, walks, setup)();
1880
1871
  return (scope) => {
1881
- const pendingScopes = collectScopes(() => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1872
+ const pendingScopes = collectScopes((_) => (scope[branchAccessor] = createBranch(scope[Global], renderer, scope, scope[nodeAccessor].parentNode))[DetachedAwait] = renderer);
1882
1873
  scope[branchAccessor][PendingScopes] = pendingScopes;
1883
- if (typeof scope[promiseAccessor] === "function") scope[promiseAccessor]();
1884
1874
  };
1885
1875
  }
1886
- function addAwaitCounter(scope, tryBranch = findTryWithPlaceholder(scope)) {
1876
+ function startAwait(scope, tryBranch = findTryWithPlaceholder(scope)) {
1887
1877
  if (!tryBranch) return;
1888
1878
  let awaitCounter = tryBranch[AwaitCounter];
1889
- if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, () => dismissPlaceholder(tryBranch));
1890
- scheduleAwaitFrame(awaitCounter, tryBranch, () => {
1879
+ if (!awaitCounter?.i) awaitCounter = createAwaitCounter(tryBranch, (_) => dismissPlaceholder(tryBranch));
1880
+ countAwait(awaitCounter, tryBranch, (_) => {
1891
1881
  (tryBranch[PlaceholderBranch] = createAndSetupBranch(tryBranch[Global], tryBranch[PlaceholderContent](), tryBranch["_"], tryBranch[StartNode].parentNode))[TryBranch] = tryBranch;
1892
1882
  insertBranchBefore(tryBranch[PlaceholderBranch], tryBranch[StartNode].parentNode, tryBranch[StartNode]);
1893
1883
  tempDetachBranch(tryBranch);
1894
1884
  });
1895
1885
  return awaitCounter;
1896
1886
  }
1897
- function scheduleAwaitFrame(awaitCounter, scope, render) {
1898
- if (!awaitCounter.i++) requestAnimationFrame(() => awaitCounter.i && runEffects(prepareEffects(() => queueRender(scope, render, -1))));
1887
+ function countAwait(awaitCounter, scope, render) {
1888
+ if (!awaitCounter.i++) requestAnimationFrame((_) => awaitCounter.i && runEffects(prepareEffects((_) => queueRender(scope, render, -1))));
1899
1889
  }
1900
1890
  function queueCompleteAwaitCounter(tryBranch, awaitCounter) {
1901
1891
  queueRender(tryBranch, completeAwaitCounter, -1, awaitCounter, tryBranch["#Id"] + 1e9);
@@ -1943,13 +1933,14 @@ function dismissPlaceholder(tryBranch) {
1943
1933
  }
1944
1934
  function _try(nodeAccessor, template, walks, setup, placeholderContent, catchContent) {
1945
1935
  const branchAccessor = BranchScopes$1 + nodeAccessor;
1946
- const renderer = _content("", template, walks, setup)();
1936
+ const renderer = _content("", template, walks)();
1947
1937
  return (scope) => {
1948
- setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
1938
+ setBranch(scope, nodeAccessor, renderer, createBranch);
1949
1939
  const branch = scope[branchAccessor];
1950
1940
  branch[BranchAccessor] = nodeAccessor;
1951
1941
  branch[CatchContent] = catchContent;
1952
1942
  branch[PlaceholderContent] = placeholderContent || void 0;
1943
+ if (setup) queueRender(branch, setup, -1);
1953
1944
  };
1954
1945
  }
1955
1946
  function renderCatch(scope, error) {
@@ -1964,8 +1955,11 @@ function renderCatch(scope, error) {
1964
1955
  destroyBranch(tryWithCatch);
1965
1956
  }
1966
1957
  const catchContent = tryWithCatch[CatchContent]();
1967
- setConditionalRenderer(owner, tryWithCatch[BranchAccessor], catchContent, createAndSetupBranch);
1968
- catchContent[Params]?.(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], [error]);
1958
+ setBranch(owner, tryWithCatch[BranchAccessor], catchContent, createBranch);
1959
+ queueRender(owner[BranchScopes$1 + tryWithCatch[BranchAccessor]], (branch) => {
1960
+ setupBranch(catchContent, branch);
1961
+ catchContent[Params]?.(branch, [error]);
1962
+ }, -1);
1969
1963
  }
1970
1964
  }
1971
1965
  function findTryWithPlaceholder(scope) {
@@ -1984,7 +1978,7 @@ const _if = /*@__PURE__*/ withBranches((nodeAccessor, ...branchesArgs) => {
1984
1978
  let i = 0;
1985
1979
  while (i < branchesArgs.length) branches.push(_content("", branchesArgs[i++], branchesArgs[i++], branchesArgs[i++])());
1986
1980
  return (scope, newBranch) => {
1987
- if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0))) setConditionalRenderer(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
1981
+ if (newBranch !== (scope[branchAccessor] ?? (scope["BranchScopes:" + nodeAccessor] && 0))) setBranch(scope, nodeAccessor, branches[scope[branchAccessor] = newBranch], createAndSetupBranch);
1988
1982
  };
1989
1983
  });
1990
1984
  const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor, endNodeAccessor) => {
@@ -2030,34 +2024,40 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
2030
2024
  const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
2031
2025
  const childScopeAccessor = BranchScopes$1 + nodeAccessor;
2032
2026
  const rendererAccessor = ConditionalRenderer + nodeAccessor;
2027
+ const createTagBranch = ($global, tagNameOrRenderer, scope, parentNode) => {
2028
+ if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2029
+ const branch = createBranch($global, tagNameOrRenderer, scope, parentNode);
2030
+ 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);
2031
+ if (getTagVar) {
2032
+ branch[TagVariable] = (value) => getTagVar()(scope, value);
2033
+ bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer);
2034
+ }
2035
+ if (typeof tagNameOrRenderer !== "string") setupBranch(tagNameOrRenderer, branch);
2036
+ else if (getContent) {
2037
+ const content = getContent(scope);
2038
+ const elementAccessor = `#${tagNameOrRenderer.toLowerCase()}/0`;
2039
+ setBranch(branch, elementAccessor, content, createAndSetupBranch);
2040
+ if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], branch[BranchScopes$1 + elementAccessor]);
2041
+ }
2042
+ return branch;
2043
+ };
2033
2044
  return (scope, newRenderer, getInput) => {
2034
2045
  const normalizedRenderer = normalizeDynamicRenderer(newRenderer);
2035
2046
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(normalizedRenderer) || (getContent ? void 0 : 0)) || getContent && !(normalizedRenderer || scope[childScopeAccessor])) {
2036
- const renderer = normalizedRenderer || (getContent ? getContent(scope) : void 0);
2037
- setConditionalRenderer(scope, nodeAccessor, renderer, createBranchWithTagNameOrRenderer);
2038
- if (getTagVar) {
2039
- if (normalizedRenderer) {
2040
- scope[childScopeAccessor][TagVariable] = (value) => getTagVar()(scope, value);
2041
- bindTagVar(scope, scope[childScopeAccessor], scope[scopeOffsetAccessor], normalizedRenderer);
2042
- } else getTagVar()(scope);
2043
- }
2044
- if (typeof renderer === "string") {
2045
- if (getContent) {
2046
- const content = getContent(scope);
2047
- setConditionalRenderer(scope[childScopeAccessor], `#${renderer.toLowerCase()}/0`, content, createAndSetupBranch);
2048
- if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[childScopeAccessor][`BranchScopes:#${renderer.toLowerCase()}/0`]);
2049
- }
2050
- } else if (renderer) {
2051
- setupBranch(renderer, scope[childScopeAccessor]);
2052
- if (renderer["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2047
+ let renderer = normalizedRenderer;
2048
+ if (renderer) setBranch(scope, nodeAccessor, renderer, createTagBranch);
2049
+ else {
2050
+ if (getTagVar) getTagVar()(scope);
2051
+ setBranch(scope, nodeAccessor, renderer = getContent ? getContent(scope) : void 0, createAndSetupBranch);
2053
2052
  }
2053
+ if (typeof renderer !== "string" && renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2054
2054
  }
2055
2055
  if (normalizedRenderer) {
2056
2056
  const childScope = scope[childScopeAccessor];
2057
2057
  const args = getInput?.();
2058
2058
  if (typeof normalizedRenderer === "string") {
2059
2059
  const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
2060
- (getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableRenders[childScope[nodeAccessor].tagName]);
2060
+ (getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope[nodeAccessor].tagName]);
2061
2061
  if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
2062
2062
  } else {
2063
2063
  normalizedRenderer[LocalClosures]?.(childScope);
@@ -2080,7 +2080,7 @@ const _dynamic_tag_content = /*@__PURE__*/ withBranches((nodeAccessor) => {
2080
2080
  const rendererAccessor = ConditionalRenderer + nodeAccessor;
2081
2081
  return (scope, renderer) => {
2082
2082
  if (scope[rendererAccessor] !== (scope[rendererAccessor] = rendererKey(renderer))) {
2083
- setConditionalRenderer(scope, nodeAccessor, renderer, createAndSetupBranch);
2083
+ setBranch(scope, nodeAccessor, renderer, createAndSetupBranch);
2084
2084
  if (renderer?.["accessor"]) subscribeToScopeSet(renderer[Owner], renderer[Accessor], scope[childScopeAccessor]);
2085
2085
  }
2086
2086
  renderer?.[LocalClosures]?.(scope[childScopeAccessor]);
@@ -2093,7 +2093,7 @@ function installDynamicTagVar(bind) {
2093
2093
  function dynamicTagScript(branch) {
2094
2094
  _attrs_script(branch, `#${branch[Renderer].toLowerCase()}/0`);
2095
2095
  }
2096
- function setConditionalRenderer(scope, nodeAccessor, newRenderer, createBranch) {
2096
+ function setBranch(scope, nodeAccessor, newRenderer, createBranch) {
2097
2097
  const referenceNode = scope[nodeAccessor];
2098
2098
  const prevBranch = scope[BranchScopes$1 + nodeAccessor];
2099
2099
  const parentNode = referenceNode.nodeType > 1 ? (prevBranch?.["#StartNode"] || referenceNode).parentNode : referenceNode;
@@ -2120,7 +2120,7 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2120
2120
  return (scope, value) => {
2121
2121
  const referenceNode = scope[nodeAccessor];
2122
2122
  const oldScopes = toArray(scope[scopesAccessor]);
2123
- const newScopes = scope[scopesAccessor] = [];
2123
+ const newScopes = [];
2124
2124
  scope[keyedScopesAccessor] = null;
2125
2125
  const oldLen = oldScopes.length;
2126
2126
  const parentNode = referenceNode.nodeType > 1 ? referenceNode.parentNode || oldScopes[0]?.["#StartNode"].parentNode : referenceNode;
@@ -2136,11 +2136,15 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2136
2136
  if (branch) {
2137
2137
  hasPotentialMoves = true;
2138
2138
  oldScopesByKey?.delete(key);
2139
- } else branch = createAndSetupBranch(scope[Global], renderer, scope, parentNode);
2140
- branch[LoopKey] = key;
2139
+ branch[LoopKey] = key;
2140
+ } else {
2141
+ (branch = createBranch(scope[Global], renderer, scope, parentNode))[LoopKey] = key;
2142
+ setupBranch(renderer, branch);
2143
+ }
2141
2144
  newScopes.push(branch);
2142
2145
  params?.(branch, args);
2143
2146
  });
2147
+ scope[scopesAccessor] = newScopes;
2144
2148
  const newLen = newScopes.length;
2145
2149
  const hasSiblings = referenceNode !== parentNode;
2146
2150
  let afterReference = null;
@@ -2237,12 +2241,6 @@ function reorderKeyed(newScopes, start, newEnd, parentNode, afterReference) {
2237
2241
  afterReference = newScopes[start + i][StartNode];
2238
2242
  }
2239
2243
  }
2240
- function createBranchWithTagNameOrRenderer($global, tagNameOrRenderer, parentScope, parentNode) {
2241
- if (typeof tagNameOrRenderer === "string") assertValidTagName(tagNameOrRenderer);
2242
- const branch = createBranch($global, tagNameOrRenderer, parentScope, parentNode);
2243
- 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);
2244
- return branch;
2245
- }
2246
2244
  function bySecondArg(_item, index) {
2247
2245
  return index;
2248
2246
  }
@@ -2250,4 +2248,4 @@ function byFirstArg(name) {
2250
2248
  return name;
2251
2249
  }
2252
2250
  //#endregion
2253
- export { _attr_style_items as $, insertBranchBefore as $t, _attr_input_value as A, Params as An, withLazy as At, _controllable_select as B, Global as Bn, _hoist_resume as Bt, _attr_details_or_dialog_open_script as C, _assert_hoist as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, Clone as Dn, initEmbedded as Dt, _attr_input_checkedValue_default as E, withBranches as En, init as Et, _attr_select_value as F, AwaitCounter as Fn, _el_read as Ft, _attr_class as G, PendingRenders as Gn, _or as Gt, controllableRenders as H, ParentBranch as Hn, _if_closure as Ht, _attr_select_value_default as I, BranchRenders as In, _for_closure as It, _attr_class_names as J, TagVariable as Jn, _script as Jt, _attr_class_item as K, PlaceholderBranch as Kn, _return as Kt, _attr_select_value_script as L, ClosestBranch as Ln, _for_selector as Lt, _attr_input_value_default as M, Setup as Mn, _closure as Mt, _attr_input_value_dynamic_default as N, Pending as Nn, _closure_get as Nt, _attr_input_checked_default as O, Lazy as On, ready as Ot, _attr_input_value_script as P, Scope as Pn, _const as Pt, _attr_style_item as Q, destroyBranch as Qt, _controllable_input as R, EndNode as Rn, _global_read as Rt, _attr_details_or_dialog_open_default as S, _assert_class_toggles as Sn, _el as St, _attr_input_checkedValue as T, _call as Tn, getRegisteredWithScope as Tt, controllableScripts as U, PendingEffectScopes as Un, _let as Ut, _controllable_textarea as V, Load as Vn, _id as Vt, _attr as W, PendingEffects as Wn, _let_change as Wt, _attr_nonce as X, _var_change as Xt, _attr_content as Y, _var as Yt, _attr_style as Z, _assert_init as Zt, installDynamicTagVar as _, runId as _n, _return_setup as _t, _for_in as a, $signal as an, _html as at, runPendingEffects as b, forTo as bn, setupBranch as bt, _for_to as c, installBranchRenders as cn, _style_shell as ct, _for_until_unkeyed as d, queueAsyncRender as dn, _to_text as dt, removeAndDestroyBranch as en, _attrs as et, _if as f, queueEffect as fn, insertChildNodes as ft, dynamicTagScript as g, runEffects as gn, _content_resume as gt, addAwaitCounter as h, run as hn, _content_closures as ht, _dynamic_tag_content as i, _on as in, _attrs_script as it, _attr_input_value_attribute_default as j, Returns as jn, _child_setup as jt, _attr_input_checked_script as k, Owner as kn, readyFailed as kt, _for_to_unkeyed as l, installCatch as ln, _text as lt, _try as m, rendering as mn, _content as mt, _await_promise as n, DYNAMIC_TAG_SCRIPT_REGISTER_ID as nn, _attrs_partial as nt, _for_of as o, $signalReset as on, _lifecycle as ot, _show as p, queueRender as pn, toInsertNode as pt, _attr_class_items as q, StartNode as qn, _return_change as qt, _dynamic_tag as r, PLACEHOLDER_DISMISS_REGISTER_ID as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, createBranchRenders as sn, _style_rule_item as st, _await_content as t, syncGen as tn, _attrs_content as tt, _for_until as u, prepareEffects as un, _text_content as ut, patchDynamicTag as v, forIn as vn, createAndSetupBranch as vt, _attr_input_checked as w, _hoist_read_error as wn, _var_resume as wt, _attr_details_or_dialog_open as x, forUntil as xn, _dynamic_tag_var_resume as xt, renderCatch as y, forOf as yn, createBranch as yt, _controllable_open as z, Gen$1 as zn, _hoist as zt };
2251
+ export { _attr_style_items as $, removeAndDestroyBranch as $t, _attr_input_value as A, Params as An, withLazy as At, _controllable_select as B, Global as Bn, _id as Bt, _attr_details_or_dialog_open_script as C, _hoist_read_error as Cn, _resumed as Ct, _attr_input_checkedValue_script as D, Lazy as Dn, initEmbedded as Dt, _attr_input_checkedValue_default as E, Clone as En, init as Et, _attr_select_value as F, AwaitCounter as Fn, _for_closure as Ft, _attr_class as G, PendingRenders as Gn, _return as Gt, controllableScripts as H, ParentBranch as Hn, _let as Ht, _attr_select_value_default as I, BranchRenders as In, _for_selector as It, _attr_class_names as J, TagVariable as Jn, _var as Jt, _attr_class_item as K, PlaceholderBranch as Kn, _return_change as Kt, _attr_select_value_script as L, ClosestBranch as Ln, _global_read as Lt, _attr_input_value_default as M, Setup as Mn, _closure_get as Mt, _attr_input_value_dynamic_default as N, Pending as Nn, _const as Nt, _attr_input_checked_default as O, LocalClosures as On, ready as Ot, _attr_input_value_script as P, Scope as Pn, _el_read as Pt, _attr_style_item as Q, insertBranchBefore as Qt, _controllable_input as R, EndNode as Rn, _hoist as Rt, _attr_details_or_dialog_open_default as S, _assert_hoist as Sn, _el as St, _attr_input_checkedValue as T, withBranches as Tn, getRegisteredWithScope as Tt, controllableSpreadHelpers as U, PendingEffectScopes as Un, _let_change as Ut, _controllable_textarea as V, Load as Vn, _if_closure as Vt, _attr as W, PendingEffects as Wn, _or as Wt, _attr_nonce as X, _assert_init as Xt, _attr_content as Y, _var_change as Yt, _attr_style as Z, destroyBranch as Zt, patchDynamicTag as _, forIn as _n, _return_setup as _t, _for_in as a, $signalReset as an, _html as at, startAwait as b, forUntil as bn, setupBranch as bt, _for_to as c, installCatch as cn, _style_shell as ct, _for_until_unkeyed as d, queueEffect as dn, _to_text as dt, syncGen as en, _attrs as et, _if as f, queueRender as fn, insertChildNodes as ft, installDynamicTagVar as g, runId as gn, _content_resume as gt, dynamicTagScript as h, runEffects as hn, _content_closures as ht, _dynamic_tag_content as i, $signal as in, _attrs_script as it, _attr_input_value_attribute_default as j, Returns as jn, _closure as jt, _attr_input_checked_script as k, Owner as kn, readyFailed as kt, _for_to_unkeyed as l, prepareEffects as ln, _text as lt, _try as m, run as mn, _content as mt, _await_promise as n, PLACEHOLDER_DISMISS_REGISTER_ID as nn, _attrs_partial as nt, _for_of as o, createBranchRenders as on, _lifecycle as ot, _show as p, rendering as pn, toInsertNode as pt, _attr_class_items as q, StartNode as qn, _script as qt, _dynamic_tag as r, _on as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, installBranchRenders as sn, _style_rule_item as st, _await_content as t, DYNAMIC_TAG_SCRIPT_REGISTER_ID as tn, _attrs_content as tt, _for_until as u, queueAsyncRender as un, _text_content as ut, renderCatch as v, forOf as vn, createAndSetupBranch as vt, _attr_input_checked as w, _call as wn, _var_resume as wt, _attr_details_or_dialog_open as x, _assert_class_toggles as xn, _dynamic_tag_var_resume as xt, runPendingEffects as y, forTo as yn, createBranch as yt, _controllable_open as z, Gen$1 as zn, _hoist_resume as zt };