marko 6.4.10 → 6.4.12

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 (112) hide show
  1. package/dist/common/accessor.d.ts +0 -3
  2. package/dist/common/accessor.debug.d.ts +0 -3
  3. package/dist/common/attr-tag.d.ts +1 -0
  4. package/dist/common/errors.d.ts +2 -0
  5. package/dist/common/helpers.d.ts +3 -1
  6. package/dist/common/types.d.ts +4 -3
  7. package/dist/debug/dom/catch.feat.js +1 -1
  8. package/dist/debug/dom/catch.feat.mjs +1 -1
  9. package/dist/debug/dom/compat.feat.js +143 -0
  10. package/dist/debug/dom/compat.feat.mjs +141 -0
  11. package/dist/debug/dom/controllable-input.feat.js +1 -1
  12. package/dist/debug/dom/controllable-input.feat.mjs +1 -1
  13. package/dist/debug/dom/controllable-open.feat.js +1 -1
  14. package/dist/debug/dom/controllable-open.feat.mjs +1 -1
  15. package/dist/debug/dom/controllable-select.feat.js +1 -1
  16. package/dist/debug/dom/controllable-select.feat.mjs +1 -1
  17. package/dist/debug/dom/controllable-textarea.feat.js +1 -1
  18. package/dist/debug/dom/controllable-textarea.feat.mjs +1 -1
  19. package/dist/debug/dom/controllable.feat.js +1 -1
  20. package/dist/debug/dom/controllable.feat.mjs +1 -1
  21. package/dist/debug/dom/dynamic-tag-script.feat.js +1 -1
  22. package/dist/debug/dom/dynamic-tag-script.feat.mjs +1 -1
  23. package/dist/debug/dom/dynamic-tag-var.feat.js +1 -1
  24. package/dist/debug/dom/dynamic-tag-var.feat.mjs +1 -1
  25. package/dist/debug/dom/lazy.feat.js +1 -1
  26. package/dist/debug/dom/lazy.feat.mjs +1 -1
  27. package/dist/debug/dom/placeholder.feat.js +1 -1
  28. package/dist/debug/dom/placeholder.feat.mjs +1 -1
  29. package/dist/debug/{dom-DNB5yq3U.js → dom-CtXOr4Nm.js} +257 -230
  30. package/dist/debug/{dom-C1V5vpFs.mjs → dom-DaHYZpf2.mjs} +238 -229
  31. package/dist/debug/dom.js +8 -134
  32. package/dist/debug/dom.mjs +5 -126
  33. package/dist/debug/html/compat.feat.js +222 -0
  34. package/dist/debug/html/compat.feat.mjs +220 -0
  35. package/dist/debug/html-DMo6pc_h.mjs +3931 -0
  36. package/dist/debug/html-DfZjMkhx.js +4513 -0
  37. package/dist/debug/html.js +83 -4239
  38. package/dist/debug/html.mjs +1 -4152
  39. package/dist/dom/abort-signal.d.ts +1 -1
  40. package/dist/dom/catch.feat.js +3 -3
  41. package/dist/dom/catch.feat.mjs +1 -1
  42. package/dist/dom/{compat.d.ts → compat.feat.d.ts} +18 -9
  43. package/dist/dom/compat.feat.js +101 -0
  44. package/dist/dom/compat.feat.mjs +100 -0
  45. package/dist/dom/control-flow.d.ts +4 -5
  46. package/dist/dom/controllable-input.feat.js +2 -2
  47. package/dist/dom/controllable-input.feat.mjs +1 -1
  48. package/dist/dom/controllable-open.feat.js +2 -2
  49. package/dist/dom/controllable-open.feat.mjs +1 -1
  50. package/dist/dom/controllable-select.feat.js +2 -2
  51. package/dist/dom/controllable-select.feat.mjs +1 -1
  52. package/dist/dom/controllable-textarea.feat.js +2 -2
  53. package/dist/dom/controllable-textarea.feat.mjs +1 -1
  54. package/dist/dom/controllable.feat.js +2 -2
  55. package/dist/dom/controllable.feat.mjs +1 -1
  56. package/dist/dom/dom.d.ts +2 -1
  57. package/dist/dom/dynamic-tag-script.feat.js +2 -2
  58. package/dist/dom/dynamic-tag-script.feat.mjs +1 -1
  59. package/dist/dom/dynamic-tag-var.feat.js +1 -1
  60. package/dist/dom/dynamic-tag-var.feat.mjs +1 -1
  61. package/dist/dom/lazy.feat.js +1 -1
  62. package/dist/dom/lazy.feat.mjs +1 -1
  63. package/dist/dom/load.d.ts +3 -4
  64. package/dist/dom/placeholder.feat.js +3 -3
  65. package/dist/dom/placeholder.feat.mjs +1 -1
  66. package/dist/dom/queue.d.ts +1 -2
  67. package/dist/dom/resume.d.ts +3 -1
  68. package/dist/dom/signals.d.ts +5 -7
  69. package/dist/{dom-C2-Flitp.js → dom-BB-Te-3z.js} +222 -239
  70. package/dist/{dom-DsHYWMCR.mjs → dom-BO-0hzLZ.mjs} +124 -146
  71. package/dist/dom.d.ts +1 -2
  72. package/dist/dom.js +17 -95
  73. package/dist/dom.mjs +6 -79
  74. package/dist/html/assets.d.ts +3 -4
  75. package/dist/html/{compat.d.ts → compat.feat.d.ts} +5 -4
  76. package/dist/html/compat.feat.js +165 -0
  77. package/dist/html/compat.feat.mjs +164 -0
  78. package/dist/html/dynamic-tag.d.ts +1 -2
  79. package/dist/html/for.d.ts +0 -1
  80. package/dist/html/writer.d.ts +4 -3
  81. package/dist/html-DMDc0zKs.mjs +2404 -0
  82. package/dist/html-DrHsybFm.js +2880 -0
  83. package/dist/html.d.ts +1 -2
  84. package/dist/html.js +2 -2578
  85. package/dist/html.mjs +3 -2573
  86. package/dist/translator/index.d.ts +0 -1
  87. package/dist/translator/index.js +4889 -4733
  88. package/dist/translator/interop/out-global.d.ts +5 -0
  89. package/dist/translator/util/assert.d.ts +6 -0
  90. package/dist/translator/util/branch-tag.d.ts +1 -1
  91. package/dist/translator/util/entry-builder.d.ts +1 -1
  92. package/dist/translator/util/finalize-references.d.ts +2 -1
  93. package/dist/translator/util/for-selector.d.ts +1 -1
  94. package/dist/translator/util/known-tag.d.ts +10 -1
  95. package/dist/translator/util/optional.d.ts +0 -1
  96. package/dist/translator/util/reasons.d.ts +0 -1
  97. package/dist/translator/util/references.d.ts +12 -5
  98. package/dist/translator/util/runtime.d.ts +1 -0
  99. package/dist/translator/util/sections.d.ts +11 -2
  100. package/dist/translator/util/signals.d.ts +2 -1
  101. package/dist/translator/util/style-interpolation.d.ts +1 -1
  102. package/dist/translator/util/tag-facts.d.ts +2 -0
  103. package/dist/translator/util/tag-name-type.d.ts +1 -0
  104. package/dist/translator/util/translate-attrs.d.ts +1 -4
  105. package/dist/translator/util/visitors.d.ts +1 -1
  106. package/dist/translator/util/write-guard.d.ts +2 -0
  107. package/dist/translator/visitors/program/index.d.ts +2 -6
  108. package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
  109. package/index.d.ts +2 -7
  110. package/package.json +4 -4
  111. package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
  112. package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
@@ -1,3 +1,26 @@
1
+ // src/common/attr-tag.ts
2
+ const empty = [];
3
+ const rest = Symbol("Attribute Tag");
4
+ function attrTag(attrs) {
5
+ attrs[Symbol.iterator] = attrTagIterator;
6
+ attrs[rest] = empty;
7
+ return attrs;
8
+ }
9
+ function attrTags(first, attrs) {
10
+ if (first) {
11
+ if (first[rest] === empty) first[rest] = [attrs];
12
+ else first[rest].push(attrs);
13
+ return first;
14
+ }
15
+ return attrTag(attrs);
16
+ }
17
+ function isAttrTag(value) {
18
+ return !!value?.[rest];
19
+ }
20
+ function* attrTagIterator() {
21
+ yield this;
22
+ yield* this[rest];
23
+ }
1
24
  // src/common/constants/accessor-prefix.debug.ts
2
25
  const BranchScopes$1 = "BranchScopes:";
3
26
  const ClosureScopes = "ClosureScopes:";
@@ -51,8 +74,6 @@ const Changed = "Changed";
51
74
  const ScopesAccessor = "scopesAccessor";
52
75
  const SignalIndexAccessor = "signalIndexAccessor";
53
76
  const Index = "index";
54
- // src/common/constants/keyed-scopes-prop.debug.ts
55
- const PreviousKey = "PreviousKey:";
56
77
  const Scope = "scope";
57
78
  const Signal = "signal";
58
79
  const Value = "value";
@@ -133,7 +154,7 @@ function escapeStyleValue(str) {
133
154
  else if (c === closers[0]) closers = closers.slice(1);
134
155
  return result + closers;
135
156
  }
136
- const toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
157
+ function toDelimitedString(val, delimiter, stringify) {
137
158
  let str = "";
138
159
  let sep = "";
139
160
  let part;
@@ -155,7 +176,7 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
155
176
  }
156
177
  }
157
178
  return str;
158
- };
179
+ }
159
180
  function isEventHandler(name) {
160
181
  return /^on[A-Z-]/.test(name);
161
182
  }
@@ -168,15 +189,20 @@ function isNotNullishOrFalse(value) {
168
189
  function isPromise(value) {
169
190
  return value != null && typeof value.then === "function";
170
191
  }
192
+ let classAPIRenderer;
193
+ function setClassAPIRenderer(render) {
194
+ classAPIRenderer = render;
195
+ }
171
196
  function normalizeDynamicRenderer(value) {
172
197
  if (value) {
173
198
  if (typeof value === "string") return value;
174
199
  const normalized = value.content || value.default || value;
175
- if (!((typeof normalized === "object" || typeof normalized === "function") && "id" in normalized)) {
176
- if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
177
- if (typeof value !== "object" && typeof value !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received a ${typeof value}.`);
178
- }
179
- if ("id" in normalized) return normalized;
200
+ if (typeof normalized !== "object" && typeof normalized !== "function") throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received ${normalized === value ? `a ${typeof value}` : `an object whose \`content\` or \`default\` is a ${typeof normalized}`}.`);
201
+ if (classAPIRenderer) {
202
+ const renderer = classAPIRenderer(normalized);
203
+ if (renderer || false) return renderer;
204
+ } else if ("id" in normalized) return normalized;
205
+ if (value.content) throw new Error(`A dynamic tag must be a string tag name (like \`"div"\`) or a Marko template/component, but received an object whose \`content\` is not a template/component.`);
180
206
  }
181
207
  }
182
208
  let branchesEnabled;
@@ -287,6 +313,12 @@ function assertNoValueBindingOnCheckable(type, valueChange) {
287
313
  function assertHandlerIsFunction(name, value) {
288
314
  if (value && typeof value !== "function") throw new Error(`The \`${name}\` handler must be a function or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
289
315
  }
316
+ function assertNoNativeAttrTags(tagName, input) {
317
+ for (const name in input) if (name !== "content" && isAttrTag(input[name])) throw new Error(`A dynamic tag passed the native \`<${tagName}>\` tag an [attribute tag](https://markojs.com/docs/reference/language#attribute-tags) as \`${name}\`, but [native tags](https://markojs.com/docs/reference/native-tag) do not support attribute tags.`);
318
+ }
319
+ function assertValidContent(value, renderer) {
320
+ if (value && !renderer?.["id"]) throw new Error(`The \`content\` attribute on a [native tag](https://markojs.com/docs/reference/native-tag#content) must be body content, a \`<define>\` tag variable or attribute tag holding it, or a falsey value (\`null\`, \`undefined\`, \`false\`, \`0\`, …), but received type "${typeof value}".`);
321
+ }
290
322
  function assertValidTagName(tagName) {
291
323
  if (!/^[a-z][a-z0-9._-]*$/i.test(tagName)) throw new Error(`Invalid tag name: "${tagName}". Tag names must start with a letter and contain only letters, numbers, periods, hyphens, and underscores.`);
292
324
  }
@@ -434,9 +466,9 @@ function prepareEffects(fn) {
434
466
  }
435
467
  return preparedEffects;
436
468
  }
437
- let runEffects = ((effects) => {
469
+ let runEffects = (effects) => {
438
470
  for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
439
- });
471
+ };
440
472
  let runRender = (render) => {
441
473
  if (!branchesEnabled || render["scope"]["#ClosestBranch"]?.["#Gen"] !== 0) render[Signal](render[Scope], render[Value]);
442
474
  };
@@ -486,7 +518,7 @@ function $signal(scope, id) {
486
518
  return ((scope[AbortControllers] ||= {})[id] ||= new AbortController()).signal;
487
519
  }
488
520
  /** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
489
- function trackAbort(scope, id, abort) {
521
+ function onAbort(scope, id, abort) {
490
522
  abortsEnabled = 1;
491
523
  trackCleanup(scope);
492
524
  (scope[AbortControllers] ||= {})[id] = { abort };
@@ -585,7 +617,7 @@ function skipScope() {
585
617
  return nextScopeId++;
586
618
  }
587
619
  function destroyBranch(branch) {
588
- branch[ParentBranch]?.[BranchScopes]?.delete(branch);
620
+ branch[ParentBranch]?.[BranchScopes].delete(branch);
589
621
  destroyNestedScopes(branch);
590
622
  }
591
623
  function destroyScope(scope) {
@@ -594,11 +626,11 @@ function destroyScope(scope) {
594
626
  cleanupScope(scope);
595
627
  }
596
628
  }
597
- const destroyNestedScopes = function destroyNestedScopes(scope) {
629
+ function destroyNestedScopes(scope) {
598
630
  scope[Gen$1] = 0;
599
631
  scope[BranchScopes]?.forEach(destroyNestedScopes);
600
632
  scope[AbortScopes]?.forEach(cleanupScope);
601
- };
633
+ }
602
634
  function cleanupScope(scope) {
603
635
  if (subscriptionsEnabled) scope[Subscriptions]?.forEach(unsubscribe, scope);
604
636
  if (abortsEnabled) for (const id in scope[AbortControllers]) $signalReset(scope, id);
@@ -690,7 +722,8 @@ function _const(valueAccessor, fn) {
690
722
  }
691
723
  });
692
724
  }
693
- function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
725
+ function _or(id, fn, defaultPending = 1, scopeIdAccessor) {
726
+ scopeIdAccessor = scopeIdAccessor ? scopeIdAccessor : "#Id";
694
727
  return (scope) => {
695
728
  if (scope["#Gen"] === runId) {
696
729
  if (~id in scope) {
@@ -699,36 +732,33 @@ function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
699
732
  } else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
700
733
  };
701
734
  }
702
- function _for_closure(ownerLoopNodeAccessor, fn) {
735
+ function _for_closure(ownerLoopNodeAccessor, fn, id, scopeIdAccessor) {
736
+ scopeIdAccessor = scopeIdAccessor ? scopeIdAccessor : "#Id";
703
737
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
704
- const ownerSignal = (ownerScope) => {
705
- const scopes = toArray(ownerScope[scopeAccessor]);
706
- queueRender(ownerScope, (_) => {
707
- for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
708
- }, -1);
738
+ const render = (ownerScope) => {
739
+ for (const scope of toArray(ownerScope[scopeAccessor])) if (scope["#Gen"] < runId) fn(scope);
709
740
  };
741
+ const ownerSignal = (ownerScope) => queueRender(ownerScope, render, id, 0, ownerScope[scopeIdAccessor]);
710
742
  ownerSignal._ = (scope) => queueRender(scope, fn, -1);
711
743
  return ownerSignal;
712
744
  }
713
- function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
745
+ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn, getValueScope) {
714
746
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
715
747
  const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
716
- const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
748
+ const prevKey = Symbol(ownerValueAccessor);
717
749
  const ownerSignal = (ownerScope) => {
718
750
  if (ownerScope["#Gen"] < runId) {
719
- const nextKey = ownerScope[ownerValueAccessor];
720
- queueRender(ownerScope, (_) => {
721
- const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
722
- if (map && prevKeyProp in map) {
723
- const prevScope = map.get(map[prevKeyProp]);
724
- const nextScope = map.get(nextKey);
725
- if (prevScope !== nextScope) {
726
- runLiveBranch(prevScope, fn);
727
- runLiveBranch(nextScope, fn);
728
- }
729
- } else for (const scope of toArray(ownerScope[scopeAccessor])) runLiveBranch(scope, fn);
730
- if (map) map[prevKeyProp] = nextKey;
731
- }, -1);
751
+ const nextKey = (getValueScope ? getValueScope(ownerScope) : ownerScope)[ownerValueAccessor];
752
+ const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
753
+ if (map && prevKey in ownerScope) {
754
+ const prevScope = map.get(ownerScope[prevKey]);
755
+ const nextScope = map.get(nextKey);
756
+ if (prevScope !== nextScope) {
757
+ queueLiveBranch(prevScope, fn);
758
+ queueLiveBranch(nextScope, fn);
759
+ }
760
+ } else for (const scope of toArray(ownerScope[scopeAccessor])) queueLiveBranch(scope, fn);
761
+ ownerScope[prevKey] = nextKey;
732
762
  }
733
763
  };
734
764
  ownerSignal._ = (scope) => queueRender(scope, fn, -1);
@@ -743,8 +773,8 @@ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
743
773
  }
744
774
  return map;
745
775
  }
746
- function runLiveBranch(scope, fn) {
747
- if (scope && scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
776
+ function queueLiveBranch(scope, fn) {
777
+ if (scope?.["#Gen"] < runId) queueRender(scope, fn, -1);
748
778
  }
749
779
  function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
750
780
  const scopeAccessor = BranchScopes$1 + ownerConditionalNodeAccessor;
@@ -813,9 +843,7 @@ function _id(scope, accessor) {
813
843
  }
814
844
  function _script(id, fn) {
815
845
  _resumed[id] = fn;
816
- return (scope) => {
817
- queueEffect(scope, fn);
818
- };
846
+ return (scope) => queueEffect(scope, fn);
819
847
  }
820
848
  function _global_read($global, key) {
821
849
  if (!(key in $global)) console.error(`\`$global.${key}\` is not serialized to the client, so this read is \`undefined\`. Serialized globals are embedded in the page: add \`${key}\` to \`serializedGlobals\` at the render call only if it holds no secrets; otherwise copy the field the client needs into its own \`$global\` key and serialize that.`);
@@ -855,7 +883,7 @@ function walk(startNode, walkCodes, branch) {
855
883
  currentNode = startNode;
856
884
  walkInternal(0, walkCodes, branch);
857
885
  }
858
- const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
886
+ function walkInternal(currentWalkIndex, walkCodes, scope) {
859
887
  let value;
860
888
  let currentMultiplier;
861
889
  let storedMultiplier = 0;
@@ -891,7 +919,7 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
891
919
  storedMultiplier = currentMultiplier * 10 + value - 117;
892
920
  }
893
921
  }
894
- };
922
+ }
895
923
  function getDebugKey(index, node) {
896
924
  if (typeof node === "string") return `${node}/${index}`;
897
925
  else if (node.nodeType === 3) return `#text/${index}`;
@@ -943,168 +971,166 @@ function init(runtimeId = "M") {
943
971
  }
944
972
  const renders = self[runtimeId];
945
973
  const defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc);
946
- const initRuntime = (renders) => {
947
- defineRuntime({ value: curRenders = ((renderId) => {
948
- const render = curRenders[renderId] = renders[renderId] || renders(renderId);
949
- const walk = render.w;
950
- const scopeLookup = {};
951
- const pending = [];
952
- const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
953
- const initGlobal = (_) => scopeLookup[0] ||= {
954
- runtimeId,
955
- renderId
956
- };
957
- const initScope = (scope) => {
958
- scope[Gen$1] ??= 1;
959
- scope[Global] = initGlobal();
960
- if (branchesEnabled && scope["#ClosestBranchId"]) scope[ClosestBranch] = getScope(scope[ClosestBranchId]);
961
- return scope;
962
- };
963
- const applyScopes = (partials) => {
964
- let scopeId = partials[0];
965
- for (let i = 1; i < partials.length; i++) {
966
- const partial = partials[i];
967
- if (typeof partial === "number") scopeId += partial;
968
- else {
969
- if (scopeId) initScope(Object.assign(scopeLookup[scopeId] ||= (partial["#Id"] = scopeId, partial), partial));
970
- else Object.assign(initGlobal(), partial);
971
- scopeId++;
972
- }
974
+ const initRuntime = (renders) => defineRuntime({ value: curRenders = ((renderId) => {
975
+ const render = curRenders[renderId] = renders[renderId] || renders(renderId);
976
+ const walk = render.w;
977
+ const scopeLookup = {};
978
+ const pending = [];
979
+ const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
980
+ const initGlobal = (_) => scopeLookup[0] ||= {
981
+ runtimeId,
982
+ renderId
983
+ };
984
+ const initScope = (scope) => {
985
+ scope[Gen$1] ??= 1;
986
+ scope[Global] = initGlobal();
987
+ if (branchesEnabled && scope["#ClosestBranchId"]) scope[ClosestBranch] = getScope(scope[ClosestBranchId]);
988
+ return scope;
989
+ };
990
+ const applyScopes = (partials) => {
991
+ let scopeId = partials[0];
992
+ for (let i = 1; i < partials.length; i++) {
993
+ const partial = partials[i];
994
+ if (typeof partial === "number") scopeId += partial;
995
+ else {
996
+ if (scopeId) initScope(Object.assign(scopeLookup[scopeId] ||= (partial["#Id"] = scopeId, partial), partial));
997
+ else Object.assign(initGlobal(), partial);
998
+ scopeId++;
973
999
  }
974
- };
975
- const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data));
976
- const createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope["#ClosestBranch"] === scope ? scope !== branch && setParentBranch(scope, branch) : scope[ClosestBranch] = branch) => {
977
- return (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
978
- if (visitType === "*") {
979
- while (reorderBranch && pending.length >= reorderDepth) adopt(pending.pop(), reorderBranch);
980
- if (reorderBranch = +lastToken && visitScope) reorderDepth = pending.push(reorderBranch);
981
- return;
982
- }
983
- if (visitType !== "[") {
984
- visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit;
985
- accessor = BranchScopes$1 + (nodeAccessor = lastToken);
986
- singleNode = visitType !== "]" && visitType !== ")";
987
- nextToken();
988
- }
989
- while (branchId = +lastToken) {
990
- (endedBranches ||= []).push(branch = getScope(branchId));
991
- setParentBranch(branch, branch[ClosestBranch]);
992
- if (branch["#AwaitCounter"] = render.p?.[branchId]) branch[AwaitCounter].m = render.m;
993
- if (singleNode) {
994
- while (startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1);
995
- branch["_"] ??= visitScope;
996
- branch[EndNode] = branch[StartNode] = startVisit;
997
- if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
998
- } else {
999
- branch[BranchAccessor] = nodeAccessor;
1000
- curBranchScopes = push(curBranchScopes, branch);
1001
- if (accessor) {
1002
- visitScope[accessor] = curBranchScopes;
1003
- forEach(curBranchScopes, (scope) => scope["_"] ??= visitScope);
1004
- curBranchScopes = branchScopesStack.pop();
1005
- }
1006
- startVisit = branchStarts.pop();
1007
- if (parent !== startVisit.parentNode) parent.prepend(startVisit);
1008
- branch[StartNode] = startVisit;
1009
- branch[EndNode] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
1000
+ }
1001
+ };
1002
+ const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data));
1003
+ const createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope["#ClosestBranch"] === scope ? scope !== branch && setParentBranch(scope, branch) : scope[ClosestBranch] = branch) => {
1004
+ return (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
1005
+ if (visitType === "*") {
1006
+ while (reorderBranch && pending.length >= reorderDepth) adopt(pending.pop(), reorderBranch);
1007
+ if (reorderBranch = +lastToken && visitScope) reorderDepth = pending.push(reorderBranch);
1008
+ return;
1009
+ }
1010
+ if (visitType !== "[") {
1011
+ visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit;
1012
+ accessor = BranchScopes$1 + (nodeAccessor = lastToken);
1013
+ singleNode = visitType !== "]" && visitType !== ")";
1014
+ nextToken();
1015
+ }
1016
+ while (branchId = +lastToken) {
1017
+ (endedBranches ||= []).push(branch = getScope(branchId));
1018
+ setParentBranch(branch, branch[ClosestBranch]);
1019
+ if (branch["#AwaitCounter"] = render.p?.[branchId]) branch[AwaitCounter].m = render.m;
1020
+ if (singleNode) {
1021
+ while (startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1);
1022
+ branch["_"] ??= visitScope;
1023
+ branch[EndNode] = branch[StartNode] = startVisit;
1024
+ if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
1025
+ } else {
1026
+ branch[BranchAccessor] = nodeAccessor;
1027
+ curBranchScopes = push(curBranchScopes, branch);
1028
+ if (accessor) {
1029
+ visitScope[accessor] = curBranchScopes;
1030
+ forEach(curBranchScopes, (scope) => scope["_"] ??= visitScope);
1031
+ curBranchScopes = branchScopesStack.pop();
1010
1032
  }
1011
- while (pending.at(-1)?.["#Id"] >= branchId) adopt(pending.pop(), branch);
1012
- nextToken();
1033
+ startVisit = branchStarts.pop();
1034
+ if (parent !== startVisit.parentNode) parent.prepend(startVisit);
1035
+ branch[StartNode] = startVisit;
1036
+ branch[EndNode] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
1013
1037
  }
1014
- if (endedBranches) {
1015
- for (const ended of endedBranches) pending.push(ended);
1016
- if (singleNode) visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
1038
+ while (pending.at(-1)?.["#Id"] >= branchId) adopt(pending.pop(), branch);
1039
+ nextToken();
1040
+ }
1041
+ if (endedBranches) {
1042
+ for (const ended of endedBranches) pending.push(ended);
1043
+ if (singleNode) visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
1044
+ }
1045
+ if (visitType === "[") {
1046
+ if (!endedBranches) {
1047
+ branchScopesStack.push(curBranchScopes);
1048
+ curBranchScopes = void 0;
1017
1049
  }
1018
- if (visitType === "[") {
1019
- if (!endedBranches) {
1020
- branchScopesStack.push(curBranchScopes);
1021
- curBranchScopes = void 0;
1022
- }
1023
- branchStarts.push(visit);
1024
- } else pending.push(visitScope);
1025
- };
1050
+ branchStarts.push(visit);
1051
+ } else pending.push(visitScope);
1026
1052
  };
1027
- const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1028
- const processResumes = (resumes = [], effects) => {
1029
- let i = 0;
1030
- for (; i < resumes.length; i++) {
1031
- const serialized = resumes[i];
1032
- if (typeof serialized === "string") {
1033
- lastTokenIndex = 0;
1034
- visitText = serialized;
1035
- while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
1036
- else effects.push(lastEffect, getScope(lastToken));
1037
- } else if (Array.isArray(serialized)) {
1038
- if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
1039
- } else if (readyIds && typeof serialized === "number") break;
1040
- else {
1041
- const scopes = serialized(serializeContext);
1042
- if (Array.isArray(scopes)) applyScopes(scopes);
1043
- }
1053
+ };
1054
+ const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1055
+ const processResumes = (resumes = [], effects) => {
1056
+ let i = 0;
1057
+ for (; i < resumes.length; i++) {
1058
+ const serialized = resumes[i];
1059
+ if (typeof serialized === "string") {
1060
+ lastTokenIndex = 0;
1061
+ visitText = serialized;
1062
+ while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
1063
+ else effects.push(lastEffect, getScope(lastToken));
1064
+ } else if (readyIds && typeof serialized !== "function") {
1065
+ if (typeof serialized === "number" || !Object.keys(serialized).every((dep) => readyIds.has(dep) && (render.b[dep]?.n || 0) >= serialized[dep])) break;
1066
+ } else {
1067
+ if (readyIds) resumes.n = (resumes.n || 0) + 1;
1068
+ const scopes = serialized(serializeContext);
1069
+ if (Array.isArray(scopes)) applyScopes(scopes);
1044
1070
  }
1045
- resumes.splice(0, i);
1046
- return i;
1047
- };
1048
- let lastEffect;
1049
- let visits;
1050
- let visit;
1051
- let visitText;
1052
- let visitType;
1053
- let visitScope;
1054
- let lastToken;
1055
- let lastTokenIndex;
1056
- let visitBranches;
1057
- let htmlStart;
1058
- let embedAnchor;
1059
- serializeContext._ = _resumed;
1060
- if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
1061
- for (const otherId in curRenders) if (otherId !== renderId && (otherId.startsWith(renderId) || renderId.startsWith(otherId))) console.error(`Marko rendered with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as both ${JSON.stringify(otherId)} and ${JSON.stringify(renderId)}, so one render claims the other's resume comments. Ensure no $global.renderId in a page starts another.`);
1062
- render.m = (effects) => {
1063
- processResumes(render.r, effects);
1064
- if (readyIds && render.b) for (let progress = 1; progress;) {
1065
- progress = 0;
1066
- for (const readyId of readyIds) {
1067
- const resumes = render.b[readyId];
1068
- if (resumes && processResumes(resumes, effects)) progress = 1;
1069
- }
1071
+ }
1072
+ resumes.splice(0, i);
1073
+ return i;
1074
+ };
1075
+ let lastEffect;
1076
+ let visits;
1077
+ let visit;
1078
+ let visitText;
1079
+ let visitType;
1080
+ let visitScope;
1081
+ let lastToken;
1082
+ let lastTokenIndex;
1083
+ let visitBranches;
1084
+ let htmlStart;
1085
+ let embedAnchor;
1086
+ serializeContext._ = _resumed;
1087
+ if (render.m) throw new Error(`Marko rendered multiple times with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as ${JSON.stringify(renderId)}. Ensure each render into a page has a unique $global.renderId.`);
1088
+ for (const otherId in curRenders) if (otherId !== renderId && (otherId.startsWith(renderId) || renderId.startsWith(otherId))) console.error(`Marko rendered with $global.runtimeId as ${JSON.stringify(runtimeId)} and $global.renderId as both ${JSON.stringify(otherId)} and ${JSON.stringify(renderId)}, so one render claims the other's resume comments. Ensure no $global.renderId in a page starts another.`);
1089
+ render.m = (effects) => {
1090
+ processResumes(render.r, effects);
1091
+ if (readyIds && render.b) for (let progress = 1; progress;) {
1092
+ progress = 0;
1093
+ for (const readyId of readyIds) {
1094
+ const resumes = render.b[readyId];
1095
+ if (resumes && processResumes(resumes, effects)) progress = 1;
1070
1096
  }
1071
- let retained = 0;
1072
- for (visit of visits = render.v) {
1073
- lastTokenIndex = render.i.length;
1074
- visitText = visit.data;
1075
- visitType = visitText[lastTokenIndex++];
1076
- visitScope = getScope(nextToken());
1077
- if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") {
1078
- if (visitType === "&") htmlStart = visit;
1079
- else {
1080
- if (visit.parentNode !== htmlStart.parentNode) console.error("An unescaped placeholder (`$!{}`) rendered HTML that does not parse as a balanced fragment where it is placed (an unclosed, stray or misnested tag), so updating it removes the wrong nodes.");
1081
- visitScope[nextToken()] = htmlStart;
1082
- visitScope[DynamicHTMLLastChild + lastToken] = visit;
1083
- if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1084
- }
1085
- } else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1086
- else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
1097
+ }
1098
+ let retained = 0;
1099
+ for (visit of visits = render.v) {
1100
+ lastTokenIndex = render.i.length;
1101
+ visitText = visit.data;
1102
+ visitType = visitText[lastTokenIndex++];
1103
+ visitScope = getScope(nextToken());
1104
+ if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") {
1105
+ if (visitType === "&") htmlStart = visit;
1087
1106
  else {
1088
- visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling;
1107
+ if (visit.parentNode !== htmlStart.parentNode) console.error("An unescaped placeholder (`$!{}`) rendered HTML that does not parse as a balanced fragment where it is placed (an unclosed, stray or misnested tag), so updating it removes the wrong nodes.");
1108
+ visitScope[nextToken()] = htmlStart;
1109
+ visitScope[DynamicHTMLLastChild + lastToken] = visit;
1089
1110
  if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1090
1111
  }
1091
- if (embedRenders && !embedAnchor && visit.parentNode) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
1092
- }
1093
- if (branchesEnabled && visitBranches) {
1094
- visitType = "*";
1095
- lastToken = "";
1096
- visitBranches();
1112
+ } else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1113
+ else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
1114
+ else {
1115
+ visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling;
1116
+ if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1097
1117
  }
1098
- visits.length = retained;
1099
- return effects;
1100
- };
1101
- render.w = (_) => {
1102
- walk();
1103
- runResumeEffects(render);
1104
- };
1105
- return render;
1106
- }) });
1107
- };
1118
+ if (embedRenders && !embedAnchor && visit.parentNode) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
1119
+ }
1120
+ if (branchesEnabled && visitBranches) {
1121
+ visitType = "*";
1122
+ lastToken = "";
1123
+ visitBranches();
1124
+ }
1125
+ visits.length = retained;
1126
+ return effects;
1127
+ };
1128
+ render.w = (_) => {
1129
+ walk();
1130
+ runResumeEffects(render);
1131
+ };
1132
+ return render;
1133
+ }) });
1108
1134
  if (renders) {
1109
1135
  initRuntime(renders);
1110
1136
  for (const renderId in renders) runResumeEffects(curRenders(renderId));
@@ -1135,7 +1161,7 @@ function _el(id, accessor) {
1135
1161
  function _dynamic_tag_var_resume(accessor) {
1136
1162
  _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => (_) => {
1137
1163
  const node = scope[accessor];
1138
- return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1164
+ return _el_read(node.nodeType > 1 ? node.previousSibling : node);
1139
1165
  };
1140
1166
  }
1141
1167
  // src/dom/renderer.ts
@@ -1169,11 +1195,8 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
1169
1195
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
1170
1196
  setup = setup ? setup._ || setup : void 0;
1171
1197
  params ||= void 0;
1172
- const clone = template ? (branch, ns) => {
1173
- ((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
1174
- } : (branch) => {
1175
- walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
1176
- };
1198
+ const cloneables = {};
1199
+ const clone = template ? (branch, ns) => (cloneables[ns] ||= createCloneableHTML(template, walks, ns))(branch) : (branch) => walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
1177
1200
  return _resumed[id] = (owner) => {
1178
1201
  return {
1179
1202
  ["id"]: id,
@@ -1213,14 +1236,11 @@ function _content_closures(renderer, closureFns) {
1213
1236
  return instance;
1214
1237
  };
1215
1238
  }
1216
- const cloneCache = {};
1217
- function createCloneableHTML(html, ns) {
1239
+ function createCloneableHTML(html, walks, ns) {
1218
1240
  const { firstChild, lastChild } = parseHTML(html, ns);
1219
1241
  const parent = new DocumentFragment();
1220
1242
  insertChildNodes(parent, null, firstChild, lastChild);
1221
- return firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
1222
- walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch);
1223
- } : (branch, walks) => {
1243
+ return firstChild === lastChild && firstChild.nodeType < 8 ? (branch) => walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch) : (branch) => {
1224
1244
  const clone = parent.cloneNode(true);
1225
1245
  clone.namespaceURI = ns;
1226
1246
  walk(clone.firstChild, walks, branch);
@@ -1357,8 +1377,11 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
1357
1377
  }
1358
1378
  }
1359
1379
  }
1360
- function _attr_content(scope, nodeAccessor, value) {
1361
- const content = normalizeClientRender(value);
1380
+ function _attr_content(scope, nodeAccessor, content) {
1381
+ var value = content;
1382
+ content = content?.content || content;
1383
+ if (classAPIRenderer && content) content = classAPIRenderer(content);
1384
+ assertValidContent(value, content);
1362
1385
  if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
1363
1386
  setBranch(scope, nodeAccessor, content, createAndSetupBranch);
1364
1387
  if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
@@ -1393,13 +1416,6 @@ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accesso
1393
1416
  removeChildNodes(firstChild, lastChild);
1394
1417
  }
1395
1418
  });
1396
- function normalizeClientRender(value) {
1397
- const renderer = normalizeDynamicRenderer(value);
1398
- if (renderer) {
1399
- if (renderer["id"]) return renderer;
1400
- else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1401
- }
1402
- }
1403
1419
  function normalizeAttrValue(value) {
1404
1420
  if (isNotNullishOrFalse(value)) return value === true ? "" : value + "";
1405
1421
  }
@@ -1416,7 +1432,7 @@ function _lifecycle(scope, thisObj, index = 0) {
1416
1432
  Object.assign(thisObj, thisObj.onMount?.());
1417
1433
  for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
1418
1434
  }
1419
- trackAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1435
+ onAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1420
1436
  }
1421
1437
  }
1422
1438
  function removeChildNodes(startNode, endNode) {
@@ -1778,7 +1794,7 @@ function _await_promise(nodeAccessor, params) {
1778
1794
  let awaitCounter = tryBranch[AwaitCounter];
1779
1795
  if (!scope[tryAccessor]) {
1780
1796
  scope[tryAccessor] = tryBranch;
1781
- trackAbort(scope, promiseAccessor, (_) => {
1797
+ onAbort(scope, promiseAccessor, (_) => {
1782
1798
  scope[promiseAccessor] = 0;
1783
1799
  if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1784
1800
  });
@@ -1956,7 +1972,7 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
1956
1972
  const rangeAccessor = BranchScopes$1 + nodeAccessor;
1957
1973
  return (scope, display) => {
1958
1974
  const referenceNode = scope[nodeAccessor];
1959
- const onlyChild = referenceNode.nodeType === 1;
1975
+ const onlyChild = referenceNode.nodeType < 3;
1960
1976
  const parentNode = onlyChild ? referenceNode : referenceNode.parentNode;
1961
1977
  let range = scope[rangeAccessor];
1962
1978
  if (!range) {
@@ -1977,9 +1993,6 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
1977
1993
  function rendererKey(renderer) {
1978
1994
  return renderer?.["owner"] ? renderer["id"] + " " + renderer[Owner]["#Id"] : renderer?.["id"] || renderer;
1979
1995
  }
1980
- function patchDynamicTag(fn) {
1981
- _dynamic_tag = fn(_dynamic_tag);
1982
- }
1983
1996
  let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagVar, inputIsArgs) => {
1984
1997
  const scopeOffsetAccessor = getTagVar && getDebugKey(+nodeAccessor.slice(nodeAccessor.lastIndexOf("/") + 1) + 1, "#scopeOffset");
1985
1998
  const childScopeAccessor = BranchScopes$1 + nodeAccessor;
@@ -1993,12 +2006,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
1993
2006
  bindTagVar(scope, branch, scope[scopeOffsetAccessor], tagNameOrRenderer);
1994
2007
  }
1995
2008
  if (typeof tagNameOrRenderer !== "string") setupBranch(tagNameOrRenderer, branch);
1996
- else if (getContent) {
1997
- const content = getContent(scope);
1998
- const elementAccessor = `#${tagNameOrRenderer.toLowerCase()}/0`;
1999
- setBranch(branch, elementAccessor, content, createAndSetupBranch);
2000
- if (content["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], branch[BranchScopes$1 + elementAccessor]);
2001
- }
2009
+ else if (getContent) _attr_content(branch, `#${tagNameOrRenderer.toLowerCase()}/0`, getContent(scope));
2002
2010
  return branch;
2003
2011
  };
2004
2012
  return (scope, newRenderer, getInput) => {
@@ -2017,6 +2025,7 @@ let _dynamic_tag = /*@__PURE__*/ withBranches((nodeAccessor, getContent, getTagV
2017
2025
  const args = getInput?.();
2018
2026
  if (typeof normalizedRenderer === "string") {
2019
2027
  const nodeAccessor = `#${normalizedRenderer.toLowerCase()}/0`;
2028
+ assertNoNativeAttrTags(normalizedRenderer, inputIsArgs ? args[0] : args);
2020
2029
  (getContent ? _attrs : _attrs_content)(childScope, nodeAccessor, (inputIsArgs ? args[0] : args) || {}, controllableSpreadHelpers[childScope[nodeAccessor].tagName]);
2021
2030
  if (childScope["EventAttributes:" + nodeAccessor] || childScope["ControlledHandler:" + nodeAccessor]) queueEffect(childScope, dynamicTagScript);
2022
2031
  } else {
@@ -2094,7 +2103,7 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2094
2103
  const oldScope = oldScopes[i];
2095
2104
  let branch = oldLen && (oldScopesByKey || key !== (oldScope?.["#LoopKey"] ?? i) ? (oldScopesByKey ||= oldScopes.reduce((map, scope, j) => j < i ? map : (scope["#LoopIndex"] = j, map.set(scope["#LoopKey"] ?? j, scope)), /* @__PURE__ */ new Map())).get(key) : oldScope && (start++, oldScope));
2096
2105
  if (branch) {
2097
- hasPotentialMoves = true;
2106
+ hasPotentialMoves = 1;
2098
2107
  oldScopesByKey?.delete(key);
2099
2108
  branch[LoopKey] = key;
2100
2109
  } else {
@@ -2210,4 +2219,4 @@ function bySecondArg(_item, index) {
2210
2219
  function byFirstArg(name) {
2211
2220
  return name;
2212
2221
  }
2213
- export { _attr_style_items as $, DYNAMIC_TAG_SCRIPT_REGISTER_ID as $t, _attr_input_value as A, Setup as An, _closure_get as At, _controllable_select as B, ParentBranch as Bn, _let as Bt, _attr_details_or_dialog_open_script as C, withBranches as Cn, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, Owner as Dn, readyFailed as Dt, _attr_input_checkedValue_default as E, LocalClosures as En, ready as Et, _attr_select_value as F, ClosestBranch as Fn, _global_read as Ft, _attr_class as G, StartNode as Gn, _script as Gt, controllableScripts as H, PendingEffects as Hn, _or as Ht, _attr_select_value_default as I, EndNode as In, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, TagVariable as Kn, _var as Kt, _attr_select_value_script as L, Gen$1 as Ln, _hoist_resume as Lt, _attr_input_value_default as M, Scope as Mn, _el_read as Mt, _attr_input_value_dynamic_default as N, AwaitCounter as Nn, _for_closure as Nt, _attr_input_checked_default as O, Params as On, withLazy as Ot, _attr_input_value_script as P, BranchRenders as Pn, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, Global as Rn, _id as Rt, _attr_details_or_dialog_open_default as S, _call as Sn, _var_resume as St, _attr_input_checkedValue as T, Lazy as Tn, initEmbedded as Tt, controllableSpreadHelpers as U, PendingRenders as Un, _return as Ut, _controllable_textarea as V, PendingEffectScopes as Vn, _let_change as Vt, _attr as W, PlaceholderBranch as Wn, _return_change as Wt, _attr_nonce as X, insertBranchBefore as Xt, _attr_content as Y, destroyBranch as Yt, _attr_style as Z, removeAndDestroyBranch as Zt, patchDynamicTag as _, forTo as _n, createBranch as _t, _for_in as a, installBranchRenders as an, _html as at, startAwait as b, _assert_hoist as bn, _el as bt, _for_to as c, queueAsyncRender as cn, _style_shell as ct, _for_until_unkeyed as d, rendering as dn, _to_text as dt, PLACEHOLDER_DISMISS_REGISTER_ID as en, _attrs as et, _if as f, run as fn, _content as ft, installDynamicTagVar as g, forOf as gn, createAndSetupBranch as gt, dynamicTagScript as h, forIn as hn, _return_setup as ht, _dynamic_tag_content as i, createBranchRenders as in, _attrs_script as it, _attr_input_value_attribute_default as j, Pending as jn, _const as jt, _attr_input_checked_script as k, Returns as kn, _closure as kt, _for_to_unkeyed as l, queueEffect as ln, _text as lt, _try as m, runId as mn, _content_resume as mt, _await_promise as n, $signal as nn, _attrs_partial as nt, _for_of as o, installCatch as on, _lifecycle as ot, _show as p, runEffects as pn, _content_closures as pt, _attr_class_items as q, _var_change as qt, _dynamic_tag as r, $signalReset as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_rule_item as st, _await_content as t, _on as tn, _attrs_content as tt, _for_until as u, queueRender as un, _text_content as ut, renderCatch as v, forUntil as vn, setupBranch as vt, _attr_input_checked as w, Clone as wn, init as wt, _attr_details_or_dialog_open as x, _hoist_read_error as xn, _resumed as xt, runPendingEffects as y, _assert_class_toggles as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, Load as zn, _if_closure as zt };
2222
+ export { _attrs as $, PLACEHOLDER_DISMISS_REGISTER_ID as $t, _attr_input_value_attribute_default as A, Returns as An, _const as At, _controllable_textarea as B, Load as Bn, _let_change as Bt, _attr_input_checked as C, setClassAPIRenderer as Cn, init as Ct, _attr_input_checked_default as D, LocalClosures as Dn, withLazy as Dt, _attr_input_checkedValue_script as E, Lazy as En, readyFailed as Et, _attr_select_value_default as F, BranchRenders as Fn, _hoist as Ft, _attr_class_item as G, PlaceholderBranch as Gn, _var as Gt, controllableSpreadHelpers as H, PendingEffectScopes as Hn, _return as Ht, _attr_select_value_script as I, ClosestBranch as In, _hoist_resume as It, _attr_content as J, attrTag as Jn, destroyBranch as Jt, _attr_class_items as K, StartNode as Kn, _var_change as Kt, _controllable_input as L, EndNode as Ln, _id as Lt, _attr_input_value_dynamic_default as M, Pending as Mn, _for_closure as Mt, _attr_input_value_script as N, Scope as Nn, _for_selector as Nt, _attr_input_checked_script as O, Owner as On, _closure as Ot, _attr_select_value as P, AwaitCounter as Pn, _global_read as Pt, _attr_style_items as Q, DYNAMIC_TAG_SCRIPT_REGISTER_ID as Qt, _controllable_open as R, Gen$1 as Rn, _if_closure as Rt, _attr_details_or_dialog_open_script as S, _call as Sn, getRegisteredWithScope as St, _attr_input_checkedValue_default as T, Clone as Tn, ready as Tt, _attr as U, PendingEffects as Un, _return_change as Ut, controllableScripts as V, ParentBranch as Vn, _or as Vt, _attr_class as W, PendingRenders as Wn, _script as Wt, _attr_style as X, removeAndDestroyBranch as Xt, _attr_nonce as Y, attrTags as Yn, insertBranchBefore as Yt, _attr_style_item as Z, syncGen as Zt, renderCatch as _, forTo as _n, setupBranch as _t, _for_in as a, installBranchRenders as an, _lifecycle as at, _attr_details_or_dialog_open as b, _assert_hoist as bn, _resumed as bt, _for_to as c, queueAsyncRender as cn, _text as ct, _for_until_unkeyed as d, rendering as dn, _content as dt, _on as en, _attrs_content as et, _if as f, run as fn, _content_closures as ft, installDynamicTagVar as g, forOf as gn, createBranch as gt, dynamicTagScript as h, forIn as hn, createAndSetupBranch as ht, _dynamic_tag_content as i, createBranchRenders as in, _html as it, _attr_input_value_default as j, Setup as jn, _el_read as jt, _attr_input_value as k, Params as kn, _closure_get as kt, _for_to_unkeyed as l, queueEffect as ln, _text_content as lt, _try as m, runId as mn, _return_setup as mt, _await_promise as n, $signalReset as nn, _attrs_partial_content as nt, _for_of as o, installCatch as on, _style_rule_item as ot, _show as p, runEffects as pn, _content_resume as pt, _attr_class_names as q, TagVariable as qn, _assert_init as qt, _dynamic_tag as r, onAbort as rn, _attrs_script as rt, _for_of_unkeyed as s, prepareEffects as sn, _style_shell as st, _await_content as t, $signal as tn, _attrs_partial as tt, _for_until as u, queueRender as un, _to_text as ut, runPendingEffects as v, forUntil as vn, _dynamic_tag_var_resume as vt, _attr_input_checkedValue as w, withBranches as wn, initEmbedded as wt, _attr_details_or_dialog_open_default as x, _hoist_read_error as xn, _var_resume as xt, startAwait as y, _assert_class_toggles as yn, _el as yt, _controllable_select as z, Global as zn, _let as zt };