marko 6.4.9 → 6.4.11

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 (90) hide show
  1. package/cheatsheet.md +1 -1
  2. package/dist/common/accessor.d.ts +0 -3
  3. package/dist/common/accessor.debug.d.ts +0 -3
  4. package/dist/common/helpers.d.ts +1 -1
  5. package/dist/common/types.d.ts +4 -3
  6. package/dist/debug/dom/catch.feat.js +2 -3
  7. package/dist/debug/dom/catch.feat.mjs +2 -3
  8. package/dist/debug/dom/controllable-input.feat.js +2 -3
  9. package/dist/debug/dom/controllable-input.feat.mjs +2 -3
  10. package/dist/debug/dom/controllable-open.feat.js +2 -3
  11. package/dist/debug/dom/controllable-open.feat.mjs +2 -3
  12. package/dist/debug/dom/controllable-select.feat.js +2 -3
  13. package/dist/debug/dom/controllable-select.feat.mjs +2 -3
  14. package/dist/debug/dom/controllable-textarea.feat.js +2 -3
  15. package/dist/debug/dom/controllable-textarea.feat.mjs +2 -3
  16. package/dist/debug/dom/controllable.feat.js +2 -3
  17. package/dist/debug/dom/controllable.feat.mjs +2 -3
  18. package/dist/debug/dom/dynamic-tag-script.feat.js +2 -3
  19. package/dist/debug/dom/dynamic-tag-script.feat.mjs +2 -3
  20. package/dist/debug/dom/dynamic-tag-var.feat.js +2 -3
  21. package/dist/debug/dom/dynamic-tag-var.feat.mjs +2 -3
  22. package/dist/debug/dom/lazy.feat.js +2 -3
  23. package/dist/debug/dom/lazy.feat.mjs +2 -3
  24. package/dist/debug/dom/placeholder.feat.js +2 -3
  25. package/dist/debug/dom/placeholder.feat.mjs +2 -3
  26. package/dist/debug/{dom-VKjkbuuo.mjs → dom-DjUZd-9y.mjs} +221 -261
  27. package/dist/debug/{dom-QkYva5Qx.js → dom-mQ5mPBTF.js} +226 -260
  28. package/dist/debug/dom.js +10 -18
  29. package/dist/debug/dom.mjs +10 -19
  30. package/dist/debug/html.js +87 -125
  31. package/dist/debug/html.mjs +87 -125
  32. package/dist/dom/abort-signal.d.ts +1 -1
  33. package/dist/dom/catch.feat.js +4 -5
  34. package/dist/dom/catch.feat.mjs +2 -3
  35. package/dist/dom/control-flow.d.ts +4 -4
  36. package/dist/dom/controllable-input.feat.js +1 -2
  37. package/dist/dom/controllable-input.feat.mjs +1 -2
  38. package/dist/dom/controllable-open.feat.js +2 -3
  39. package/dist/dom/controllable-open.feat.mjs +2 -3
  40. package/dist/dom/controllable-select.feat.js +2 -3
  41. package/dist/dom/controllable-select.feat.mjs +2 -3
  42. package/dist/dom/controllable-textarea.feat.js +2 -3
  43. package/dist/dom/controllable-textarea.feat.mjs +2 -3
  44. package/dist/dom/controllable.feat.js +1 -2
  45. package/dist/dom/controllable.feat.mjs +1 -2
  46. package/dist/dom/dynamic-tag-script.feat.js +3 -4
  47. package/dist/dom/dynamic-tag-script.feat.mjs +2 -3
  48. package/dist/dom/dynamic-tag-var.feat.js +3 -4
  49. package/dist/dom/dynamic-tag-var.feat.mjs +1 -2
  50. package/dist/dom/lazy.feat.js +2 -3
  51. package/dist/dom/lazy.feat.mjs +2 -3
  52. package/dist/dom/load.d.ts +3 -4
  53. package/dist/dom/placeholder.feat.js +2 -3
  54. package/dist/dom/placeholder.feat.mjs +2 -3
  55. package/dist/dom/queue.d.ts +1 -2
  56. package/dist/dom/signals.d.ts +5 -7
  57. package/dist/{dom-IujlfJ6b.js → dom-B8j2453O.js} +158 -190
  58. package/dist/{dom-DtKQb840.mjs → dom-HEWdZCCb.mjs} +134 -172
  59. package/dist/dom.d.ts +1 -1
  60. package/dist/dom.js +22 -30
  61. package/dist/dom.mjs +10 -19
  62. package/dist/html/assets.d.ts +3 -4
  63. package/dist/html/for.d.ts +0 -1
  64. package/dist/html/writer.d.ts +2 -2
  65. package/dist/html.d.ts +1 -1
  66. package/dist/html.js +99 -131
  67. package/dist/html.mjs +99 -132
  68. package/dist/translator/index.d.ts +0 -1
  69. package/dist/translator/index.js +4771 -4760
  70. package/dist/translator/interop/out-global.d.ts +5 -0
  71. package/dist/translator/util/assert.d.ts +13 -2
  72. package/dist/translator/util/entry-builder.d.ts +1 -1
  73. package/dist/translator/util/finalize-references.d.ts +2 -1
  74. package/dist/translator/util/for-selector.d.ts +1 -1
  75. package/dist/translator/util/known-tag.d.ts +10 -1
  76. package/dist/translator/util/references.d.ts +11 -5
  77. package/dist/translator/util/runtime.d.ts +1 -0
  78. package/dist/translator/util/sections.d.ts +6 -1
  79. package/dist/translator/util/signals.d.ts +2 -1
  80. package/dist/translator/util/sources.d.ts +1 -1
  81. package/dist/translator/util/style-interpolation.d.ts +1 -1
  82. package/dist/translator/util/tag-name-type.d.ts +4 -0
  83. package/dist/translator/util/visitors.d.ts +1 -1
  84. package/dist/translator/util/write-guard.d.ts +2 -0
  85. package/dist/translator/visitors/program/index.d.ts +0 -4
  86. package/dist/translator/visitors/referenced-identifier.d.ts +3 -1
  87. package/package.json +6 -6
  88. package/tags/lifecycle.d.marko +2 -0
  89. package/dist/common/constants/keyed-scopes-prop.d.ts +0 -4
  90. package/dist/common/constants/keyed-scopes-prop.debug.d.ts +0 -4
@@ -1,4 +1,4 @@
1
- //#region src/common/constants/accessor-prefix.debug.ts
1
+ // src/common/constants/accessor-prefix.debug.ts
2
2
  const BranchScopes$1 = "BranchScopes:";
3
3
  const ClosureScopes = "ClosureScopes:";
4
4
  const ClosureSignalIndex = "ClosureSignalIndex:";
@@ -15,8 +15,7 @@ const Lifecycle = "Lifecycle:";
15
15
  const Promise$1 = "Promise:";
16
16
  const TagVariableChange$1 = "TagVariableChange:";
17
17
  const TryBranch$1 = "TryBranch:";
18
- //#endregion
19
- //#region src/common/constants/accessor-prop.debug.ts
18
+ // src/common/constants/accessor-prop.debug.ts
20
19
  const Global = "$global";
21
20
  const AbortControllers = "#AbortControllers";
22
21
  const AbortScopes = "#AbortScopes";
@@ -46,17 +45,12 @@ const Subscriptions = "#Subscriptions";
46
45
  const TagVariable = "#TagVariable";
47
46
  const TagVariableChange = "#TagVariableChange";
48
47
  const TryBranch = "#TryBranch";
49
- //#endregion
50
- //#region src/common/constants/closure-scopes-prop.debug.ts
48
+ // src/common/constants/closure-scopes-prop.debug.ts
51
49
  const Changed = "Changed";
52
- //#endregion
53
- //#region src/common/constants/closure-signal-prop.debug.ts
50
+ // src/common/constants/closure-signal-prop.debug.ts
54
51
  const ScopesAccessor = "scopesAccessor";
55
52
  const SignalIndexAccessor = "signalIndexAccessor";
56
53
  const Index = "index";
57
- //#endregion
58
- //#region src/common/constants/keyed-scopes-prop.debug.ts
59
- const PreviousKey = "PreviousKey:";
60
54
  const Scope = "scope";
61
55
  const Signal = "signal";
62
56
  const Value = "value";
@@ -69,8 +63,7 @@ const Accessor = "accessor";
69
63
  const LocalClosures = "localClosures";
70
64
  const Returns = "returns";
71
65
  const Lazy = "lazy";
72
- //#endregion
73
- //#region src/common/helpers.ts
66
+ // src/common/helpers.ts
74
67
  const invalidNativeAttrNameReg = /^[^a-z_]|[^a-z0-9._:-]/i;
75
68
  const knownWrongAttrs = {
76
69
  className: "class",
@@ -138,7 +131,7 @@ function escapeStyleValue(str) {
138
131
  else if (c === closers[0]) closers = closers.slice(1);
139
132
  return result + closers;
140
133
  }
141
- const toDelimitedString = function toDelimitedString(val, delimiter, stringify) {
134
+ function toDelimitedString(val, delimiter, stringify) {
142
135
  let str = "";
143
136
  let sep = "";
144
137
  let part;
@@ -160,7 +153,7 @@ const toDelimitedString = function toDelimitedString(val, delimiter, stringify)
160
153
  }
161
154
  }
162
155
  return str;
163
- };
156
+ }
164
157
  function isEventHandler(name) {
165
158
  return /^on[A-Z-]/.test(name);
166
159
  }
@@ -194,8 +187,7 @@ function withDynamicHtml(runtime) {
194
187
  dynamicHtmlEnabled = 1;
195
188
  return runtime;
196
189
  }
197
- //#endregion
198
- //#region src/common/errors.ts
190
+ // src/common/errors.ts
199
191
  const lowercaseOnAttrReg = /^on[a-z]/;
200
192
  function assertValidAttrValue(name, value) {
201
193
  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.`);
@@ -310,8 +302,7 @@ function joinWithAnd(a) {
310
302
  default: return `${a.slice(0, -1).join(", ")}, and ${a[a.length - 1]}`;
311
303
  }
312
304
  }
313
- //#endregion
314
- //#region src/common/for.ts
305
+ // src/common/for.ts
315
306
  function forIn(obj, cb) {
316
307
  for (const key in obj) cb(key, obj[key]);
317
308
  }
@@ -338,8 +329,7 @@ function forUntil(until, from, step, cb) {
338
329
  const delta = step || 1;
339
330
  for (let steps = (until - start) / delta, i = 0; i < steps; i++) cb(start + i * delta);
340
331
  }
341
- //#endregion
342
- //#region src/dom/queue.ts
332
+ // src/dom/queue.ts
343
333
  let rendering;
344
334
  let runId = 2;
345
335
  let pendingEffects = [];
@@ -442,9 +432,9 @@ function prepareEffects(fn) {
442
432
  }
443
433
  return preparedEffects;
444
434
  }
445
- let runEffects = ((effects) => {
435
+ let runEffects = (effects) => {
446
436
  for (let i = 0; i < effects.length;) effects[i++](effects[i++]);
447
- });
437
+ };
448
438
  let runRender = (render) => {
449
439
  if (!branchesEnabled || render["scope"]["#ClosestBranch"]?.["#Gen"] !== 0) render[Signal](render[Scope], render[Value]);
450
440
  };
@@ -479,8 +469,7 @@ function runRenders(renders = pendingRenders) {
479
469
  runRender(render);
480
470
  }
481
471
  }
482
- //#endregion
483
- //#region src/dom/abort-signal.ts
472
+ // src/dom/abort-signal.ts
484
473
  function $signalReset(scope, id) {
485
474
  const ctrl = scope[AbortControllers]?.[id];
486
475
  if (ctrl) {
@@ -495,7 +484,7 @@ function $signal(scope, id) {
495
484
  return ((scope[AbortControllers] ||= {})[id] ||= new AbortController()).signal;
496
485
  }
497
486
  /** Runs `abort` as a destroyed scope's `$signal` would fire, without creating one. */
498
- function trackAbort(scope, id, abort) {
487
+ function onAbort(scope, id, abort) {
499
488
  abortsEnabled = 1;
500
489
  trackCleanup(scope);
501
490
  (scope[AbortControllers] ||= {})[id] = { abort };
@@ -514,8 +503,7 @@ let subscriptionsEnabled;
514
503
  function abort(ctrl) {
515
504
  ctrl.abort();
516
505
  }
517
- //#endregion
518
- //#region src/common/opt.ts
506
+ // src/common/opt.ts
519
507
  function toArray(opt) {
520
508
  return opt ? Array.isArray(opt) ? opt : [opt] : [];
521
509
  }
@@ -528,8 +516,7 @@ function forEach(opt, cb) {
528
516
  function push(opt, item) {
529
517
  return opt ? Array.isArray(opt) ? (opt.push(item), opt) : [opt, item] : item;
530
518
  }
531
- //#endregion
532
- //#region src/dom/event.ts
519
+ // src/dom/event.ts
533
520
  function _on(element, type, handler) {
534
521
  assertHandlerIsFunction("on" + type[0].toUpperCase() + type.slice(1), handler);
535
522
  delegate(type, handleDelegated);
@@ -551,21 +538,18 @@ function handleDelegated(ev) {
551
538
  }
552
539
  delete ev.currentTarget;
553
540
  }
554
- //#endregion
555
- //#region src/dom/parse-html.ts
541
+ // src/dom/parse-html.ts
556
542
  const parsers = {};
557
543
  function parseHTML(html, ns) {
558
544
  const parser = parsers[ns] ||= document.createElementNS(ns, "template");
559
545
  parser.innerHTML = html;
560
546
  return parser.content || parser;
561
547
  }
562
- //#endregion
563
- //#region src/common/meta.ts
548
+ // src/common/meta.ts
564
549
  const DYNAMIC_TAG_SCRIPT_REGISTER_ID = "_dynamicTagScript";
565
550
  const DYNAMIC_TAG_VAR_REGISTER_ID = "_dynamicTagVar";
566
551
  const PLACEHOLDER_DISMISS_REGISTER_ID = "_placeholderDismiss";
567
- //#endregion
568
- //#region src/dom/scope.ts
552
+ // src/dom/scope.ts
569
553
  let nextScopeId = 1e6;
570
554
  let collectingScopes;
571
555
  function createScope($global, closestBranch) {
@@ -599,7 +583,7 @@ function skipScope() {
599
583
  return nextScopeId++;
600
584
  }
601
585
  function destroyBranch(branch) {
602
- branch[ParentBranch]?.[BranchScopes]?.delete(branch);
586
+ branch[ParentBranch]?.[BranchScopes].delete(branch);
603
587
  destroyNestedScopes(branch);
604
588
  }
605
589
  function destroyScope(scope) {
@@ -608,11 +592,11 @@ function destroyScope(scope) {
608
592
  cleanupScope(scope);
609
593
  }
610
594
  }
611
- const destroyNestedScopes = function destroyNestedScopes(scope) {
595
+ function destroyNestedScopes(scope) {
612
596
  scope[Gen$1] = 0;
613
597
  scope[BranchScopes]?.forEach(destroyNestedScopes);
614
598
  scope[AbortScopes]?.forEach(cleanupScope);
615
- };
599
+ }
616
600
  function cleanupScope(scope) {
617
601
  if (subscriptionsEnabled) scope[Subscriptions]?.forEach(unsubscribe, scope);
618
602
  if (abortsEnabled) for (const id in scope[AbortControllers]) $signalReset(scope, id);
@@ -632,8 +616,7 @@ function detachBranch(branch) {
632
616
  fragment.namespaceURI = branch[StartNode].parentNode.namespaceURI;
633
617
  insertChildNodes(fragment, null, branch[StartNode], branch[EndNode]);
634
618
  }
635
- //#endregion
636
- //#region src/dom/schedule.ts
619
+ // src/dom/schedule.ts
637
620
  let runTask;
638
621
  let isScheduled;
639
622
  let channel;
@@ -665,8 +648,7 @@ function triggerMacroTask() {
665
648
  }
666
649
  channel.port2.postMessage(0);
667
650
  }
668
- //#endregion
669
- //#region src/dom/signals.ts
651
+ // src/dom/signals.ts
670
652
  function _let(id, fn) {
671
653
  const valueAccessor = id.slice(0, id.lastIndexOf("/"));
672
654
  id = +id.slice(id.lastIndexOf("/") + 1);
@@ -706,7 +688,8 @@ function _const(valueAccessor, fn) {
706
688
  }
707
689
  });
708
690
  }
709
- function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
691
+ function _or(id, fn, defaultPending = 1, scopeIdAccessor) {
692
+ scopeIdAccessor = scopeIdAccessor ? scopeIdAccessor : "#Id";
710
693
  return (scope) => {
711
694
  if (scope["#Gen"] === runId) {
712
695
  if (~id in scope) {
@@ -715,36 +698,33 @@ function _or(id, fn, defaultPending = 1, scopeIdAccessor = "#Id") {
715
698
  } else queueRender(scope, fn, id, 0, scope[scopeIdAccessor]);
716
699
  };
717
700
  }
718
- function _for_closure(ownerLoopNodeAccessor, fn) {
701
+ function _for_closure(ownerLoopNodeAccessor, fn, id, scopeIdAccessor) {
702
+ scopeIdAccessor = scopeIdAccessor ? scopeIdAccessor : "#Id";
719
703
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
720
- const ownerSignal = (ownerScope) => {
721
- const scopes = toArray(ownerScope[scopeAccessor]);
722
- queueRender(ownerScope, (_) => {
723
- for (const scope of scopes) if (scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
724
- }, -1);
704
+ const render = (ownerScope) => {
705
+ for (const scope of toArray(ownerScope[scopeAccessor])) if (scope["#Gen"] < runId) fn(scope);
725
706
  };
707
+ const ownerSignal = (ownerScope) => queueRender(ownerScope, render, id, 0, ownerScope[scopeIdAccessor]);
726
708
  ownerSignal._ = (scope) => queueRender(scope, fn, -1);
727
709
  return ownerSignal;
728
710
  }
729
- function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn) {
711
+ function _for_selector(ownerLoopNodeAccessor, ownerValueAccessor, fn, getValueScope) {
730
712
  const scopeAccessor = BranchScopes$1 + ownerLoopNodeAccessor;
731
713
  const mapAccessor = KeyedScopes + ownerLoopNodeAccessor;
732
- const prevKeyProp = `${PreviousKey}${ownerValueAccessor}`;
714
+ const prevKey = Symbol(ownerValueAccessor);
733
715
  const ownerSignal = (ownerScope) => {
734
716
  if (ownerScope["#Gen"] < runId) {
735
- const nextKey = ownerScope[ownerValueAccessor];
736
- queueRender(ownerScope, (_) => {
737
- const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
738
- if (map && prevKeyProp in map) {
739
- const prevScope = map.get(map[prevKeyProp]);
740
- const nextScope = map.get(nextKey);
741
- if (prevScope !== nextScope) {
742
- runLiveBranch(prevScope, fn);
743
- runLiveBranch(nextScope, fn);
744
- }
745
- } else for (const scope of toArray(ownerScope[scopeAccessor])) runLiveBranch(scope, fn);
746
- if (map) map[prevKeyProp] = nextKey;
747
- }, -1);
717
+ const nextKey = (getValueScope ? getValueScope(ownerScope) : ownerScope)[ownerValueAccessor];
718
+ const map = keyedScopes(ownerScope, scopeAccessor, mapAccessor);
719
+ if (map && prevKey in ownerScope) {
720
+ const prevScope = map.get(ownerScope[prevKey]);
721
+ const nextScope = map.get(nextKey);
722
+ if (prevScope !== nextScope) {
723
+ queueLiveBranch(prevScope, fn);
724
+ queueLiveBranch(nextScope, fn);
725
+ }
726
+ } else for (const scope of toArray(ownerScope[scopeAccessor])) queueLiveBranch(scope, fn);
727
+ ownerScope[prevKey] = nextKey;
748
728
  }
749
729
  };
750
730
  ownerSignal._ = (scope) => queueRender(scope, fn, -1);
@@ -759,8 +739,8 @@ function keyedScopes(ownerScope, scopeAccessor, mapAccessor) {
759
739
  }
760
740
  return map;
761
741
  }
762
- function runLiveBranch(scope, fn) {
763
- if (scope && scope["#Gen"] > 0 && scope["#Gen"] < runId) fn(scope);
742
+ function queueLiveBranch(scope, fn) {
743
+ if (scope?.["#Gen"] < runId) queueRender(scope, fn, -1);
764
744
  }
765
745
  function _if_closure(ownerConditionalNodeAccessor, branch, fn) {
766
746
  const scopeAccessor = BranchScopes$1 + ownerConditionalNodeAccessor;
@@ -829,9 +809,7 @@ function _id(scope, accessor) {
829
809
  }
830
810
  function _script(id, fn) {
831
811
  _resumed[id] = fn;
832
- return (scope) => {
833
- queueEffect(scope, fn);
834
- };
812
+ return (scope) => queueEffect(scope, fn);
835
813
  }
836
814
  function _global_read($global, key) {
837
815
  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.`);
@@ -864,15 +842,14 @@ function _hoist(...path) {
864
842
  function _hoist_resume(id, ...path) {
865
843
  return _resumed[id] = _hoist(...path);
866
844
  }
867
- //#endregion
868
- //#region src/dom/walker.ts
845
+ // src/dom/walker.ts
869
846
  /** Cloned templates are small, where a TreeWalker's per-step cost dominates. */
870
847
  let currentNode;
871
848
  function walk(startNode, walkCodes, branch) {
872
849
  currentNode = startNode;
873
850
  walkInternal(0, walkCodes, branch);
874
851
  }
875
- const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
852
+ function walkInternal(currentWalkIndex, walkCodes, scope) {
876
853
  let value;
877
854
  let currentMultiplier;
878
855
  let storedMultiplier = 0;
@@ -908,7 +885,7 @@ const walkInternal = function walkInternal(currentWalkIndex, walkCodes, scope) {
908
885
  storedMultiplier = currentMultiplier * 10 + value - 117;
909
886
  }
910
887
  }
911
- };
888
+ }
912
889
  function getDebugKey(index, node) {
913
890
  if (typeof node === "string") return `${node}/${index}`;
914
891
  else if (node.nodeType === 3) return `#text/${index}`;
@@ -917,8 +894,7 @@ function getDebugKey(index, node) {
917
894
  return index;
918
895
  }
919
896
  const walkNextSibling = (_) => currentNode = currentNode.nextSibling || currentNode;
920
- //#endregion
921
- //#region src/dom/resume.ts
897
+ // src/dom/resume.ts
922
898
  const _resumed = {};
923
899
  let curRenders;
924
900
  let embedRenders;
@@ -961,168 +937,166 @@ function init(runtimeId = "M") {
961
937
  }
962
938
  const renders = self[runtimeId];
963
939
  const defineRuntime = (desc) => Object.defineProperty(self, runtimeId, desc);
964
- const initRuntime = (renders) => {
965
- defineRuntime({ value: curRenders = ((renderId) => {
966
- const render = curRenders[renderId] = renders[renderId] || renders(renderId);
967
- const walk = render.w;
968
- const scopeLookup = {};
969
- const pending = [];
970
- const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
971
- const initGlobal = (_) => scopeLookup[0] ||= {
972
- runtimeId,
973
- renderId
974
- };
975
- const initScope = (scope) => {
976
- scope[Gen$1] ??= 1;
977
- scope[Global] = initGlobal();
978
- if (branchesEnabled && scope["#ClosestBranchId"]) scope[ClosestBranch] = getScope(scope[ClosestBranchId]);
979
- return scope;
980
- };
981
- const applyScopes = (partials) => {
982
- let scopeId = partials[0];
983
- for (let i = 1; i < partials.length; i++) {
984
- const partial = partials[i];
985
- if (typeof partial === "number") scopeId += partial;
986
- else {
987
- if (scopeId) initScope(Object.assign(scopeLookup[scopeId] ||= (partial["#Id"] = scopeId, partial), partial));
988
- else Object.assign(initGlobal(), partial);
989
- scopeId++;
990
- }
940
+ const initRuntime = (renders) => defineRuntime({ value: curRenders = ((renderId) => {
941
+ const render = curRenders[renderId] = renders[renderId] || renders(renderId);
942
+ const walk = render.w;
943
+ const scopeLookup = {};
944
+ const pending = [];
945
+ const getScope = (id) => scopeLookup[id] || (+id ? initScope(scopeLookup[id] = { ["#Id"]: +id }) : initGlobal());
946
+ const initGlobal = (_) => scopeLookup[0] ||= {
947
+ runtimeId,
948
+ renderId
949
+ };
950
+ const initScope = (scope) => {
951
+ scope[Gen$1] ??= 1;
952
+ scope[Global] = initGlobal();
953
+ if (branchesEnabled && scope["#ClosestBranchId"]) scope[ClosestBranch] = getScope(scope[ClosestBranchId]);
954
+ return scope;
955
+ };
956
+ const applyScopes = (partials) => {
957
+ let scopeId = partials[0];
958
+ for (let i = 1; i < partials.length; i++) {
959
+ const partial = partials[i];
960
+ if (typeof partial === "number") scopeId += partial;
961
+ else {
962
+ if (scopeId) initScope(Object.assign(scopeLookup[scopeId] ||= (partial["#Id"] = scopeId, partial), partial));
963
+ else Object.assign(initGlobal(), partial);
964
+ scopeId++;
991
965
  }
992
- };
993
- const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data));
994
- const createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope["#ClosestBranch"] === scope ? scope !== branch && setParentBranch(scope, branch) : scope[ClosestBranch] = branch) => {
995
- return (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
996
- if (visitType === "*") {
997
- while (reorderBranch && pending.length >= reorderDepth) adopt(pending.pop(), reorderBranch);
998
- if (reorderBranch = +lastToken && visitScope) reorderDepth = pending.push(reorderBranch);
999
- return;
1000
- }
1001
- if (visitType !== "[") {
1002
- visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit;
1003
- accessor = BranchScopes$1 + (nodeAccessor = lastToken);
1004
- singleNode = visitType !== "]" && visitType !== ")";
1005
- nextToken();
1006
- }
1007
- while (branchId = +lastToken) {
1008
- (endedBranches ||= []).push(branch = getScope(branchId));
1009
- setParentBranch(branch, branch[ClosestBranch]);
1010
- if (branch["#AwaitCounter"] = render.p?.[branchId]) branch[AwaitCounter].m = render.m;
1011
- if (singleNode) {
1012
- while (startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1);
1013
- branch["_"] ??= visitScope;
1014
- branch[EndNode] = branch[StartNode] = startVisit;
1015
- if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
1016
- } else {
1017
- branch[BranchAccessor] = nodeAccessor;
1018
- curBranchScopes = push(curBranchScopes, branch);
1019
- if (accessor) {
1020
- visitScope[accessor] = curBranchScopes;
1021
- forEach(curBranchScopes, (scope) => scope["_"] ??= visitScope);
1022
- curBranchScopes = branchScopesStack.pop();
1023
- }
1024
- startVisit = branchStarts.pop();
1025
- if (parent !== startVisit.parentNode) parent.prepend(startVisit);
1026
- branch[StartNode] = startVisit;
1027
- branch[EndNode] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
966
+ }
967
+ };
968
+ const serializeContext = ((data, registryId) => typeof data === "number" ? registryId ? _resumed[registryId](getScope(data)) : getScope(data) : applyScopes(data));
969
+ const createVisitBranches = (branchScopesStack = [], branchStarts = [], curBranchScopes, reorderBranch, reorderDepth = 0, adopt = (scope, branch) => scope["#ClosestBranch"] === scope ? scope !== branch && setParentBranch(scope, branch) : scope[ClosestBranch] = branch) => {
970
+ return (branchId, branch, endedBranches, accessor, nodeAccessor, singleNode, parent = visit.parentNode, startVisit = visit) => {
971
+ if (visitType === "*") {
972
+ while (reorderBranch && pending.length >= reorderDepth) adopt(pending.pop(), reorderBranch);
973
+ if (reorderBranch = +lastToken && visitScope) reorderDepth = pending.push(reorderBranch);
974
+ return;
975
+ }
976
+ if (visitType !== "[") {
977
+ visitScope[nextToken()] = visitType === ")" || visitType === "}" ? parent : visit;
978
+ accessor = BranchScopes$1 + (nodeAccessor = lastToken);
979
+ singleNode = visitType !== "]" && visitType !== ")";
980
+ nextToken();
981
+ }
982
+ while (branchId = +lastToken) {
983
+ (endedBranches ||= []).push(branch = getScope(branchId));
984
+ setParentBranch(branch, branch[ClosestBranch]);
985
+ if (branch["#AwaitCounter"] = render.p?.[branchId]) branch[AwaitCounter].m = render.m;
986
+ if (singleNode) {
987
+ while (startVisit.previousSibling && (startVisit = startVisit.previousSibling).nodeType > 1);
988
+ branch["_"] ??= visitScope;
989
+ branch[EndNode] = branch[StartNode] = startVisit;
990
+ if (visitType === "(") branch[getDebugKey(0, startVisit)] = startVisit;
991
+ } else {
992
+ branch[BranchAccessor] = nodeAccessor;
993
+ curBranchScopes = push(curBranchScopes, branch);
994
+ if (accessor) {
995
+ visitScope[accessor] = curBranchScopes;
996
+ forEach(curBranchScopes, (scope) => scope["_"] ??= visitScope);
997
+ curBranchScopes = branchScopesStack.pop();
1028
998
  }
1029
- while (pending.at(-1)?.["#Id"] >= branchId) adopt(pending.pop(), branch);
1030
- nextToken();
999
+ startVisit = branchStarts.pop();
1000
+ if (parent !== startVisit.parentNode) parent.prepend(startVisit);
1001
+ branch[StartNode] = startVisit;
1002
+ branch[EndNode] = visit.previousSibling === startVisit ? startVisit : parent.insertBefore(new Text(), visit);
1031
1003
  }
1032
- if (endedBranches) {
1033
- for (const ended of endedBranches) pending.push(ended);
1034
- if (singleNode) visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
1004
+ while (pending.at(-1)?.["#Id"] >= branchId) adopt(pending.pop(), branch);
1005
+ nextToken();
1006
+ }
1007
+ if (endedBranches) {
1008
+ for (const ended of endedBranches) pending.push(ended);
1009
+ if (singleNode) visitScope[accessor] = endedBranches.length > 1 ? endedBranches.reverse() : endedBranches[0];
1010
+ }
1011
+ if (visitType === "[") {
1012
+ if (!endedBranches) {
1013
+ branchScopesStack.push(curBranchScopes);
1014
+ curBranchScopes = void 0;
1035
1015
  }
1036
- if (visitType === "[") {
1037
- if (!endedBranches) {
1038
- branchScopesStack.push(curBranchScopes);
1039
- curBranchScopes = void 0;
1040
- }
1041
- branchStarts.push(visit);
1042
- } else pending.push(visitScope);
1043
- };
1016
+ branchStarts.push(visit);
1017
+ } else pending.push(visitScope);
1044
1018
  };
1045
- const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1046
- const processResumes = (resumes = [], effects) => {
1047
- let i = 0;
1048
- for (; i < resumes.length; i++) {
1049
- const serialized = resumes[i];
1050
- if (typeof serialized === "string") {
1051
- lastTokenIndex = 0;
1052
- visitText = serialized;
1053
- while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
1054
- else effects.push(lastEffect, getScope(lastToken));
1055
- } else if (Array.isArray(serialized)) {
1056
- if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
1057
- } else if (readyIds && typeof serialized === "number") break;
1058
- else {
1059
- const scopes = serialized(serializeContext);
1060
- if (Array.isArray(scopes)) applyScopes(scopes);
1061
- }
1019
+ };
1020
+ const nextToken = (_) => lastToken = visitText.slice(lastTokenIndex, (lastTokenIndex = visitText.indexOf(" ", lastTokenIndex) + 1 || visitText.length + 1) - 1);
1021
+ const processResumes = (resumes = [], effects) => {
1022
+ let i = 0;
1023
+ for (; i < resumes.length; i++) {
1024
+ const serialized = resumes[i];
1025
+ if (typeof serialized === "string") {
1026
+ lastTokenIndex = 0;
1027
+ visitText = serialized;
1028
+ while (nextToken()) if (/\D/.test(lastToken)) lastEffect = _resumed[lastToken];
1029
+ else effects.push(lastEffect, getScope(lastToken));
1030
+ } else if (Array.isArray(serialized)) {
1031
+ if (!(readyIds && serialized.every((dep) => readyIds.has(dep) && !render.b[dep].length))) break;
1032
+ } else if (readyIds && typeof serialized === "number") break;
1033
+ else {
1034
+ const scopes = serialized(serializeContext);
1035
+ if (Array.isArray(scopes)) applyScopes(scopes);
1062
1036
  }
1063
- resumes.splice(0, i);
1064
- return i;
1065
- };
1066
- let lastEffect;
1067
- let visits;
1068
- let visit;
1069
- let visitText;
1070
- let visitType;
1071
- let visitScope;
1072
- let lastToken;
1073
- let lastTokenIndex;
1074
- let visitBranches;
1075
- let htmlStart;
1076
- let embedAnchor;
1077
- serializeContext._ = _resumed;
1078
- 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.`);
1079
- 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.`);
1080
- render.m = (effects) => {
1081
- processResumes(render.r, effects);
1082
- if (readyIds && render.b) for (let progress = 1; progress;) {
1083
- progress = 0;
1084
- for (const readyId of readyIds) {
1085
- const resumes = render.b[readyId];
1086
- if (resumes && processResumes(resumes, effects)) progress = 1;
1087
- }
1037
+ }
1038
+ resumes.splice(0, i);
1039
+ return i;
1040
+ };
1041
+ let lastEffect;
1042
+ let visits;
1043
+ let visit;
1044
+ let visitText;
1045
+ let visitType;
1046
+ let visitScope;
1047
+ let lastToken;
1048
+ let lastTokenIndex;
1049
+ let visitBranches;
1050
+ let htmlStart;
1051
+ let embedAnchor;
1052
+ serializeContext._ = _resumed;
1053
+ 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.`);
1054
+ 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.`);
1055
+ render.m = (effects) => {
1056
+ processResumes(render.r, effects);
1057
+ if (readyIds && render.b) for (let progress = 1; progress;) {
1058
+ progress = 0;
1059
+ for (const readyId of readyIds) {
1060
+ const resumes = render.b[readyId];
1061
+ if (resumes && processResumes(resumes, effects)) progress = 1;
1088
1062
  }
1089
- let retained = 0;
1090
- for (visit of visits = render.v) {
1091
- lastTokenIndex = render.i.length;
1092
- visitText = visit.data;
1093
- visitType = visitText[lastTokenIndex++];
1094
- visitScope = getScope(nextToken());
1095
- if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") {
1096
- if (visitType === "&") htmlStart = visit;
1097
- else {
1098
- 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.");
1099
- visitScope[nextToken()] = htmlStart;
1100
- visitScope[DynamicHTMLLastChild + lastToken] = visit;
1101
- if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1102
- }
1103
- } else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1104
- else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
1063
+ }
1064
+ let retained = 0;
1065
+ for (visit of visits = render.v) {
1066
+ lastTokenIndex = render.i.length;
1067
+ visitText = visit.data;
1068
+ visitType = visitText[lastTokenIndex++];
1069
+ visitScope = getScope(nextToken());
1070
+ if (dynamicHtmlEnabled && visitType > "%" && visitType <= "'") {
1071
+ if (visitType === "&") htmlStart = visit;
1105
1072
  else {
1106
- visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling;
1073
+ 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.");
1074
+ visitScope[nextToken()] = htmlStart;
1075
+ visitScope[DynamicHTMLLastChild + lastToken] = visit;
1107
1076
  if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1108
1077
  }
1109
- if (embedRenders && !embedAnchor && visit.parentNode) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
1110
- }
1111
- if (branchesEnabled && visitBranches) {
1112
- visitType = "*";
1113
- lastToken = "";
1114
- visitBranches();
1078
+ } else if (branchesEnabled && visitType > "'") (visitBranches ||= createVisitBranches())();
1079
+ else if (lazyEnabled && render.b && visitType > "%") visits[retained++] = visit;
1080
+ else {
1081
+ visitScope[nextToken()] = visitType === "%" ? visit.parentNode.insertBefore(new Text(), visit) : visit.previousSibling;
1082
+ if ((branchesEnabled || lazyEnabled) && pending[pending.length - 1] !== visitScope) pending.push(visitScope);
1115
1083
  }
1116
- visits.length = retained;
1117
- return effects;
1118
- };
1119
- render.w = (_) => {
1120
- walk();
1121
- runResumeEffects(render);
1122
- };
1123
- return render;
1124
- }) });
1125
- };
1084
+ if (embedRenders && !embedAnchor && visit.parentNode) embedRenders.set(embedAnchor = visit.parentNode.insertBefore(new Text(), visit), [renderId, scopeLookup]);
1085
+ }
1086
+ if (branchesEnabled && visitBranches) {
1087
+ visitType = "*";
1088
+ lastToken = "";
1089
+ visitBranches();
1090
+ }
1091
+ visits.length = retained;
1092
+ return effects;
1093
+ };
1094
+ render.w = (_) => {
1095
+ walk();
1096
+ runResumeEffects(render);
1097
+ };
1098
+ return render;
1099
+ }) });
1126
1100
  if (renders) {
1127
1101
  initRuntime(renders);
1128
1102
  for (const renderId in renders) runResumeEffects(curRenders(renderId));
@@ -1153,11 +1127,10 @@ function _el(id, accessor) {
1153
1127
  function _dynamic_tag_var_resume(accessor) {
1154
1128
  _resumed[DYNAMIC_TAG_VAR_REGISTER_ID + accessor] = (scope) => (_) => {
1155
1129
  const node = scope[accessor];
1156
- return _el_read(node.nodeType === 8 ? node.previousSibling : node);
1130
+ return _el_read(node.nodeType > 1 ? node.previousSibling : node);
1157
1131
  };
1158
1132
  }
1159
- //#endregion
1160
- //#region src/dom/renderer.ts
1133
+ // src/dom/renderer.ts
1161
1134
  function createBranch($global, renderer, parentScope, parentNode) {
1162
1135
  const branch = createScope($global);
1163
1136
  branch["_"] = renderer["owner"] || parentScope;
@@ -1188,11 +1161,8 @@ function _content(id, template, walks, setup, params, dynamicScopesAccessor) {
1188
1161
  walks = walks ? walks.replace(/[^\0-1]+$/, "") : "";
1189
1162
  setup = setup ? setup._ || setup : void 0;
1190
1163
  params ||= void 0;
1191
- const clone = template ? (branch, ns) => {
1192
- ((cloneCache[ns] ||= {})[1 + template] ||= createCloneableHTML(template, ns))(branch, walks);
1193
- } : (branch) => {
1194
- walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
1195
- };
1164
+ const cloneables = {};
1165
+ const clone = template ? (branch, ns) => (cloneables[ns] ||= createCloneableHTML(template, walks, ns))(branch) : (branch) => walk(branch[StartNode] = branch[EndNode] = new Text(), walks, branch);
1196
1166
  return _resumed[id] = (owner) => {
1197
1167
  return {
1198
1168
  ["id"]: id,
@@ -1232,14 +1202,11 @@ function _content_closures(renderer, closureFns) {
1232
1202
  return instance;
1233
1203
  };
1234
1204
  }
1235
- const cloneCache = {};
1236
- function createCloneableHTML(html, ns) {
1205
+ function createCloneableHTML(html, walks, ns) {
1237
1206
  const { firstChild, lastChild } = parseHTML(html, ns);
1238
1207
  const parent = new DocumentFragment();
1239
1208
  insertChildNodes(parent, null, firstChild, lastChild);
1240
- return firstChild === lastChild && firstChild.nodeType < 8 ? (branch, walks) => {
1241
- walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch);
1242
- } : (branch, walks) => {
1209
+ return firstChild === lastChild && firstChild.nodeType < 8 ? (branch) => walk(branch[StartNode] = branch[EndNode] = firstChild.cloneNode(true), walks, branch) : (branch) => {
1243
1210
  const clone = parent.cloneNode(true);
1244
1211
  clone.namespaceURI = ns;
1245
1212
  walk(clone.firstChild, walks, branch);
@@ -1247,8 +1214,7 @@ function createCloneableHTML(html, ns) {
1247
1214
  branch[EndNode] = clone.lastChild;
1248
1215
  };
1249
1216
  }
1250
- //#endregion
1251
- //#region src/dom/dom.ts
1217
+ // src/dom/dom.ts
1252
1218
  function _to_text(value) {
1253
1219
  assertValidTextValue(value);
1254
1220
  return value || value === 0 ? value + "" : "";
@@ -1378,7 +1344,12 @@ function attrsInternal(scope, nodeAccessor, nextAttrs, controllable) {
1378
1344
  }
1379
1345
  }
1380
1346
  function _attr_content(scope, nodeAccessor, value) {
1381
- const content = normalizeClientRender(value);
1347
+ const renderer = normalizeDynamicRenderer(value);
1348
+ let content;
1349
+ if (renderer) {
1350
+ if (renderer["id"]) content = renderer;
1351
+ else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1352
+ }
1382
1353
  if (scope["ConditionalRenderer:" + nodeAccessor] !== (scope["ConditionalRenderer:" + nodeAccessor] = rendererKey(content))) {
1383
1354
  setBranch(scope, nodeAccessor, content, createAndSetupBranch);
1384
1355
  if (content?.["accessor"]) subscribeToScopeSet(content[Owner], content[Accessor], scope[BranchScopes$1 + nodeAccessor]);
@@ -1413,13 +1384,6 @@ const _html = /*@__PURE__*/ withDynamicHtml(function _html(scope, value, accesso
1413
1384
  removeChildNodes(firstChild, lastChild);
1414
1385
  }
1415
1386
  });
1416
- function normalizeClientRender(value) {
1417
- const renderer = normalizeDynamicRenderer(value);
1418
- if (renderer) {
1419
- if (renderer["id"]) return renderer;
1420
- else throw new Error(`Invalid \`content\` attribute. Received ${typeof value}`);
1421
- }
1422
- }
1423
1387
  function normalizeAttrValue(value) {
1424
1388
  if (isNotNullishOrFalse(value)) return value === true ? "" : value + "";
1425
1389
  }
@@ -1436,7 +1400,7 @@ function _lifecycle(scope, thisObj, index = 0) {
1436
1400
  Object.assign(thisObj, thisObj.onMount?.());
1437
1401
  for (const prop in snapshot) if (!Object.is(snapshot[prop], thisObj[prop])) throw new Error(`Tried to overwrite existing property "${prop}" in <lifecycle> onMount.`);
1438
1402
  }
1439
- trackAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1403
+ onAbort(scope, accessor, (_) => thisObj.onDestroy?.());
1440
1404
  }
1441
1405
  }
1442
1406
  function removeChildNodes(startNode, endNode) {
@@ -1455,8 +1419,7 @@ function insertChildNodes(parentNode, referenceNode, startNode, endNode) {
1455
1419
  startNode = next;
1456
1420
  }
1457
1421
  }
1458
- //#endregion
1459
- //#region src/dom/resolve-cursor-position.ts
1422
+ // src/dom/resolve-cursor-position.ts
1460
1423
  const R = /[\p{L}\p{N}]/gu;
1461
1424
  function resolveCursorPosition(inputType, initialPosition, initialValue, updatedValue) {
1462
1425
  if ((initialPosition || initialPosition === 0) && (initialPosition !== initialValue.length || /kw/.test(inputType))) {
@@ -1470,8 +1433,7 @@ function resolveCursorPosition(inputType, initialPosition, initialValue, updated
1470
1433
  }
1471
1434
  return -1;
1472
1435
  }
1473
- //#endregion
1474
- //#region src/dom/controllable.ts
1436
+ // src/dom/controllable.ts
1475
1437
  let inputType = "";
1476
1438
  function _attr_input_checked_default(scope, nodeAccessor, checked) {
1477
1439
  const el = scope[nodeAccessor];
@@ -1766,8 +1728,7 @@ function _controllable_open(scope, nodeAccessor, nextAttrs) {
1766
1728
  return /^open(?:Change)?$/;
1767
1729
  }
1768
1730
  }
1769
- //#endregion
1770
- //#region src/dom/control-flow.ts
1731
+ // src/dom/control-flow.ts
1771
1732
  function _await_promise(nodeAccessor, params) {
1772
1733
  const promiseAccessor = Promise$1 + nodeAccessor;
1773
1734
  const branchAccessor = BranchScopes$1 + nodeAccessor;
@@ -1801,7 +1762,7 @@ function _await_promise(nodeAccessor, params) {
1801
1762
  let awaitCounter = tryBranch[AwaitCounter];
1802
1763
  if (!scope[tryAccessor]) {
1803
1764
  scope[tryAccessor] = tryBranch;
1804
- trackAbort(scope, promiseAccessor, (_) => {
1765
+ onAbort(scope, promiseAccessor, (_) => {
1805
1766
  scope[promiseAccessor] = 0;
1806
1767
  if (scope[tryAccessor]) queueAsyncRender(scope[tryAccessor], completeAwaitCounter, awaitCounter);
1807
1768
  });
@@ -1979,7 +1940,7 @@ const _show = /*@__PURE__*/ withBranches((nodeAccessor, startNodeAccessor) => {
1979
1940
  const rangeAccessor = BranchScopes$1 + nodeAccessor;
1980
1941
  return (scope, display) => {
1981
1942
  const referenceNode = scope[nodeAccessor];
1982
- const onlyChild = referenceNode.nodeType === 1;
1943
+ const onlyChild = referenceNode.nodeType < 3;
1983
1944
  const parentNode = onlyChild ? referenceNode : referenceNode.parentNode;
1984
1945
  let range = scope[rangeAccessor];
1985
1946
  if (!range) {
@@ -2117,7 +2078,7 @@ const loop = /*@__PURE__*/ withBranches((forEach, reorder) => (nodeAccessor, tem
2117
2078
  const oldScope = oldScopes[i];
2118
2079
  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));
2119
2080
  if (branch) {
2120
- hasPotentialMoves = true;
2081
+ hasPotentialMoves = 1;
2121
2082
  oldScopesByKey?.delete(key);
2122
2083
  branch[LoopKey] = key;
2123
2084
  } else {
@@ -2233,5 +2194,4 @@ function bySecondArg(_item, index) {
2233
2194
  function byFirstArg(name) {
2234
2195
  return name;
2235
2196
  }
2236
- //#endregion
2237
- 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 };
2197
+ export { _attr_style_items as $, DYNAMIC_TAG_SCRIPT_REGISTER_ID as $t, _attr_input_value as A, Returns as An, _closure_get as At, _controllable_select as B, Load as Bn, _let as Bt, _attr_details_or_dialog_open_script as C, _call as Cn, getRegisteredWithScope as Ct, _attr_input_checkedValue_script as D, LocalClosures as Dn, readyFailed as Dt, _attr_input_checkedValue_default as E, Lazy as En, ready as Et, _attr_select_value as F, BranchRenders as Fn, _global_read as Ft, _attr_class as G, PlaceholderBranch as Gn, _script as Gt, controllableScripts as H, PendingEffectScopes as Hn, _or as Ht, _attr_select_value_default as I, ClosestBranch as In, _hoist as It, _attr_class_names as J, _assert_init as Jt, _attr_class_item as K, StartNode as Kn, _var as Kt, _attr_select_value_script as L, EndNode as Ln, _hoist_resume as Lt, _attr_input_value_default as M, Pending as Mn, _el_read as Mt, _attr_input_value_dynamic_default as N, Scope as Nn, _for_closure as Nt, _attr_input_checked_default as O, Owner as On, withLazy as Ot, _attr_input_value_script as P, AwaitCounter as Pn, _for_selector as Pt, _attr_style_item as Q, syncGen as Qt, _controllable_input as R, Gen$1 as Rn, _id as Rt, _attr_details_or_dialog_open_default as S, _hoist_read_error as Sn, _var_resume as St, _attr_input_checkedValue as T, Clone as Tn, initEmbedded as Tt, controllableSpreadHelpers as U, PendingEffects as Un, _return as Ut, _controllable_textarea as V, ParentBranch as Vn, _let_change as Vt, _attr as W, PendingRenders 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 _, forOf as _n, createBranch as _t, _for_in as a, createBranchRenders as an, _html as at, startAwait as b, _assert_class_toggles as bn, _el as bt, _for_to as c, prepareEffects as cn, _style_shell as ct, _for_until_unkeyed as d, queueRender as dn, _to_text as dt, PLACEHOLDER_DISMISS_REGISTER_ID as en, _attrs as et, _if as f, rendering as fn, _content as ft, installDynamicTagVar as g, forIn as gn, createAndSetupBranch as gt, dynamicTagScript as h, runId as hn, _return_setup as ht, _dynamic_tag_content as i, onAbort as in, _attrs_script as it, _attr_input_value_attribute_default as j, Setup as jn, _const as jt, _attr_input_checked_script as k, Params as kn, _closure as kt, _for_to_unkeyed as l, queueAsyncRender as ln, _text as lt, _try as m, runEffects as mn, _content_resume as mt, _await_promise as n, $signal as nn, _attrs_partial as nt, _for_of as o, installBranchRenders as on, _lifecycle as ot, _show as p, run as pn, _content_closures as pt, _attr_class_items as q, TagVariable as qn, _var_change as qt, _dynamic_tag as r, $signalReset as rn, _attrs_partial_content as rt, _for_of_unkeyed as s, installCatch as sn, _style_rule_item as st, _await_content as t, _on as tn, _attrs_content as tt, _for_until as u, queueEffect as un, _text_content as ut, renderCatch as v, forTo as vn, setupBranch as vt, _attr_input_checked as w, withBranches as wn, init as wt, _attr_details_or_dialog_open as x, _assert_hoist as xn, _resumed as xt, runPendingEffects as y, forUntil as yn, _dynamic_tag_var_resume as yt, _controllable_open as z, Global as zn, _if_closure as zt };