sibujs 4.14.0 → 4.15.0

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 (93) hide show
  1. package/dist/browser.cjs +297 -45
  2. package/dist/browser.js +6 -7
  3. package/dist/build.cjs +2189 -573
  4. package/dist/build.js +16 -15
  5. package/dist/cdn.dev.global.js +13 -12
  6. package/dist/cdn.full.dev.global.js +14 -13
  7. package/dist/cdn.full.global.js +12 -12
  8. package/dist/cdn.global.js +12 -12
  9. package/dist/{chunk-RVR5NPFL.js → chunk-2VKTFA7C.js} +1 -1
  10. package/dist/{chunk-7ILEHTVX.js → chunk-4AEFGRYW.js} +1 -1
  11. package/dist/{chunk-4TQDTWWN.js → chunk-6IV5ZRG6.js} +5 -7
  12. package/dist/{chunk-GVAMIU6K.js → chunk-75EAQH3U.js} +2 -2
  13. package/dist/{chunk-TLS4NVIB.js → chunk-7JO7DPSS.js} +4 -4
  14. package/dist/{chunk-SVULV7O4.js → chunk-AQH7WDSE.js} +6 -8
  15. package/dist/{chunk-S37PZD6I.js → chunk-BF3WBJJQ.js} +60 -10
  16. package/dist/{chunk-LJMX4SQ7.js → chunk-BG4BP44S.js} +3 -3
  17. package/dist/{chunk-N7A6FKWW.js → chunk-D44TAGCT.js} +2 -2
  18. package/dist/{chunk-CCKUNHVU.js → chunk-DAEXQJQA.js} +1 -1
  19. package/dist/chunk-DNCQDFJJ.js +22 -0
  20. package/dist/{chunk-BKZ5N6NK.js → chunk-DNCT2UXB.js} +4 -4
  21. package/dist/{chunk-BOYKGGVD.js → chunk-DRWOD7RZ.js} +4 -4
  22. package/dist/chunk-DS5V2PRE.js +64 -0
  23. package/dist/{chunk-VM2U5LEL.js → chunk-EHSJESRN.js} +595 -123
  24. package/dist/{chunk-MIRKTVH4.js → chunk-GFM5WWPU.js} +252 -5
  25. package/dist/{chunk-52XFPGSN.js → chunk-HTPOIAAL.js} +1 -1
  26. package/dist/{chunk-3HEX6QJQ.js → chunk-I2R5QALY.js} +2 -4
  27. package/dist/{chunk-4FJSAUKB.js → chunk-IUBV5WO5.js} +1 -1
  28. package/dist/{chunk-A454RAEK.js → chunk-KIDETDMU.js} +5 -7
  29. package/dist/{chunk-JTFQ7IL4.js → chunk-KPAXG5IR.js} +7 -9
  30. package/dist/{chunk-AE32RGWX.js → chunk-LGUXYHTZ.js} +3 -3
  31. package/dist/{chunk-Y4LUM2XS.js → chunk-LQWLPQOK.js} +6 -8
  32. package/dist/{chunk-CNPT6NKV.js → chunk-MINLMJUY.js} +48 -9
  33. package/dist/{chunk-BNXRWZZV.js → chunk-OURTGOJT.js} +8 -10
  34. package/dist/{chunk-F67F77IA.js → chunk-TQ24Y3IV.js} +2 -2
  35. package/dist/{chunk-2TTRW2TE.js → chunk-UM3M5PXS.js} +8 -8
  36. package/dist/{chunk-CJ7KS3DF.js → chunk-VSTX3XSX.js} +205 -15
  37. package/dist/{chunk-HQIAL7F2.js → chunk-XPDZ2LDR.js} +2 -2
  38. package/dist/{chunk-UUIKJJIK.js → chunk-Y7JM7GY2.js} +5 -7
  39. package/dist/{chunk-QS6GMWDD.js → chunk-YAFITBOK.js} +1269 -162
  40. package/dist/data.cjs +285 -33
  41. package/dist/data.js +6 -7
  42. package/dist/devtools.cjs +289 -39
  43. package/dist/devtools.js +5 -6
  44. package/dist/{dispose-EIHHHDC7.js → dispose-3WDBYJMH.js} +3 -1
  45. package/dist/ecosystem.cjs +345 -61
  46. package/dist/ecosystem.d.cts +1 -1
  47. package/dist/ecosystem.d.ts +1 -1
  48. package/dist/ecosystem.js +10 -10
  49. package/dist/extras.cjs +568 -248
  50. package/dist/extras.d.cts +1 -1
  51. package/dist/extras.d.ts +1 -1
  52. package/dist/extras.js +27 -27
  53. package/dist/index.cjs +2134 -515
  54. package/dist/index.d.cts +628 -211
  55. package/dist/index.d.ts +628 -211
  56. package/dist/index.js +22 -15
  57. package/dist/motion.cjs +286 -30
  58. package/dist/motion.js +4 -4
  59. package/dist/patterns.cjs +301 -43
  60. package/dist/patterns.js +6 -6
  61. package/dist/performance.cjs +286 -36
  62. package/dist/performance.js +9 -9
  63. package/dist/plugins.cjs +1237 -291
  64. package/dist/plugins.d.cts +3 -1
  65. package/dist/plugins.d.ts +3 -1
  66. package/dist/plugins.js +20 -19
  67. package/dist/{renderRoute-fxgsm2Ir.d.ts → renderRoute-B84MONaO.d.cts} +2 -2
  68. package/dist/{renderRoute-DP20XwMS.d.cts → renderRoute-_yxPuEQY.d.ts} +2 -2
  69. package/dist/{routeHead-CE9SV-cH.d.cts → routeHead-DLxlq15W.d.cts} +94 -0
  70. package/dist/{routeHead-DzVxPviY.d.ts → routeHead-w8nANZ3M.d.ts} +94 -0
  71. package/dist/{ssr-NECEU4X4.js → ssr-EF3IUHTE.js} +6 -6
  72. package/dist/ssr-dom.cjs +64 -9
  73. package/dist/ssr-dom.d.cts +2 -0
  74. package/dist/ssr-dom.d.ts +2 -0
  75. package/dist/ssr-dom.js +2 -1
  76. package/dist/ssr.cjs +850 -170
  77. package/dist/ssr.d.cts +5 -3
  78. package/dist/ssr.d.ts +5 -3
  79. package/dist/ssr.js +16 -15
  80. package/dist/{tagFactory-DkytnJws.d.cts → tagFactory-BfEh69VF.d.cts} +7 -0
  81. package/dist/{tagFactory-Bnd_Nph9.d.ts → tagFactory-pSYiLYyh.d.ts} +7 -0
  82. package/dist/testing.cjs +817 -132
  83. package/dist/testing.d.cts +4 -2
  84. package/dist/testing.d.ts +4 -2
  85. package/dist/testing.js +18 -17
  86. package/dist/track-core-0edROAF5.d.ts +187 -0
  87. package/dist/track-core-DN5fYLWi.d.cts +187 -0
  88. package/dist/ui.cjs +293 -43
  89. package/dist/ui.js +10 -12
  90. package/dist/widgets.cjs +285 -27
  91. package/dist/widgets.js +7 -7
  92. package/package.json +1 -1
  93. package/dist/chunk-7ZHH77QA.js +0 -9
package/dist/extras.cjs CHANGED
@@ -452,6 +452,12 @@ function reportError(error, context) {
452
452
  });
453
453
  }
454
454
 
455
+ // src/utils/globalSingleton.ts
456
+ function globalSingleton(key, create) {
457
+ const g2 = globalThis;
458
+ return g2[key] ?? (g2[key] = create());
459
+ }
460
+
455
461
  // src/core/rendering/adoptScope.ts
456
462
  var current = null;
457
463
  function inAdoptScope() {
@@ -557,7 +563,12 @@ function beginHydration() {
557
563
  }
558
564
 
559
565
  // src/core/rendering/dispose.ts
560
- var elementDisposers = /* @__PURE__ */ new WeakMap();
566
+ var state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.disposers.v1"), () => ({
567
+ disposers: /* @__PURE__ */ new WeakMap(),
568
+ captures: [],
569
+ bindings: { count: 0 }
570
+ }));
571
+ var elementDisposers = state2.disposers;
561
572
  var MAX_DRAIN_TEARDOWNS = 1e4;
562
573
  function reportDrainRunaway(label2, executed, remaining) {
563
574
  if (typeof console === "undefined") return;
@@ -566,13 +577,13 @@ function reportDrainRunaway(label2, executed, remaining) {
566
577
  { executed, remaining }
567
578
  );
568
579
  }
569
- var activeBindingCount = 0;
580
+ var bindings = state2.bindings;
570
581
  function resolveCapture(capture) {
571
582
  let frame = capture;
572
583
  while (frame?.closed) frame = frame.forwardTo;
573
584
  return frame ?? null;
574
585
  }
575
- var registrationCaptures = [];
586
+ var registrationCaptures = state2.captures;
576
587
  function currentDisposerCapture() {
577
588
  return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
578
589
  }
@@ -591,7 +602,7 @@ function registerDisposer(node, teardown) {
591
602
  elementDisposers.set(node, disposers);
592
603
  }
593
604
  disposers.push(teardown);
594
- if (DEV) activeBindingCount++;
605
+ if (DEV) bindings.count++;
595
606
  const capture = resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
596
607
  if (capture) capture.entries.push([node, teardown]);
597
608
  }
@@ -644,7 +655,7 @@ function unregisterDisposer(node, teardown) {
644
655
  const index = disposers.indexOf(teardown);
645
656
  if (index === -1) return false;
646
657
  disposers.splice(index, 1);
647
- if (DEV) activeBindingCount--;
658
+ if (DEV) bindings.count--;
648
659
  if (disposers.length === 0) elementDisposers.delete(node);
649
660
  return true;
650
661
  }
@@ -668,17 +679,17 @@ function disposeNodeOwn(node) {
668
679
  let executed = 0;
669
680
  let runaway = false;
670
681
  while (!runaway) {
671
- const pending = elementDisposers.get(node);
672
- if (!pending || pending.length === 0) break;
673
- const snapshot = pending.slice();
682
+ const pending2 = elementDisposers.get(node);
683
+ if (!pending2 || pending2.length === 0) break;
684
+ const snapshot = pending2.slice();
674
685
  elementDisposers.delete(node);
675
- if (DEV) activeBindingCount -= snapshot.length;
686
+ if (DEV) bindings.count -= snapshot.length;
676
687
  for (let i2 = 0; i2 < snapshot.length; i2++) {
677
688
  if (executed >= MAX_DRAIN_TEARDOWNS) {
678
689
  const rest = snapshot.slice(i2);
679
690
  const added = elementDisposers.get(node);
680
691
  elementDisposers.set(node, added ? rest.concat(added) : rest);
681
- if (DEV) activeBindingCount += rest.length;
692
+ if (DEV) bindings.count += rest.length;
682
693
  reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
683
694
  runaway = true;
684
695
  break;
@@ -881,6 +892,201 @@ function bindOwnerScope(fn) {
881
892
  return (...args) => runWithOwnerScope(scope, () => fn(...args));
882
893
  }
883
894
  var currentStructOwner = null;
895
+ var frozenOwners = 0;
896
+ var ACTIVE = 0;
897
+ var PAUSED = 1;
898
+ var ENDED = 2;
899
+ var NOOP = () => {
900
+ };
901
+ var skippedWhileHeld = /* @__PURE__ */ new Set();
902
+ var waiters = /* @__PURE__ */ new Set();
903
+ var heldRoots = /* @__PURE__ */ new Set();
904
+ function ownerState(tok) {
905
+ let state5 = ACTIVE;
906
+ for (let t = tok; t !== null; ) {
907
+ const o = t.sub;
908
+ if (o === null) return ENDED;
909
+ if (o._frozen === true) state5 = PAUSED;
910
+ t = o._owner ?? null;
911
+ }
912
+ return state5;
913
+ }
914
+ var endWatchers = /* @__PURE__ */ new Set();
915
+ var stateWatchers = /* @__PURE__ */ new Set();
916
+ var stateCheckQueued = false;
917
+ function queueStateCheck() {
918
+ if (stateCheckQueued || stateWatchers.size === 0) return;
919
+ stateCheckQueued = true;
920
+ queueMicrotask(() => {
921
+ stateCheckQueued = false;
922
+ for (const watcher of [...stateWatchers]) {
923
+ if (!stateWatchers.has(watcher)) continue;
924
+ const state5 = watcher.check.state();
925
+ if (state5 === ENDED) stateWatchers.delete(watcher);
926
+ if (state5 === ENDED || state5 === watcher.last) continue;
927
+ watcher.last = state5;
928
+ try {
929
+ watcher.listener(state5);
930
+ } catch (err) {
931
+ reportError(err, { phase: "effect" });
932
+ }
933
+ }
934
+ });
935
+ }
936
+ var ALWAYS_ACTIVE = Object.assign(() => false, {
937
+ state: () => ACTIVE,
938
+ wait: (onActive) => {
939
+ onActive();
940
+ return NOOP;
941
+ },
942
+ onEnd: () => NOOP,
943
+ run: (fn) => fn(),
944
+ onChange: () => NOOP,
945
+ within: () => false
946
+ });
947
+ function captureFrozen() {
948
+ const tok = currentStructOwner;
949
+ if (tok === null) return ALWAYS_ACTIVE;
950
+ const state5 = () => ownerState(tok);
951
+ const check = Object.assign(() => state5() !== ACTIVE, {
952
+ state: state5,
953
+ wait: (onActive, onEnd) => {
954
+ const now = state5();
955
+ if (now !== PAUSED) {
956
+ (now === ACTIVE ? onActive : onEnd)();
957
+ return NOOP;
958
+ }
959
+ const waiter = { check, onActive, onEnd };
960
+ waiters.add(waiter);
961
+ return () => {
962
+ waiters.delete(waiter);
963
+ };
964
+ },
965
+ onEnd: (onEnd) => {
966
+ if (state5() === ENDED) {
967
+ onEnd();
968
+ return NOOP;
969
+ }
970
+ const watcher = { check, onActive: NOOP, onEnd };
971
+ endWatchers.add(watcher);
972
+ return () => {
973
+ endWatchers.delete(watcher);
974
+ };
975
+ },
976
+ run: (fn) => {
977
+ const prev = currentStructOwner;
978
+ currentStructOwner = tok.sub === null ? null : tok;
979
+ try {
980
+ return fn();
981
+ } finally {
982
+ currentStructOwner = prev;
983
+ }
984
+ },
985
+ onChange: (listener) => {
986
+ const last = state5();
987
+ if (last === ENDED) return NOOP;
988
+ const watcher = { check, last, listener };
989
+ stateWatchers.add(watcher);
990
+ return () => {
991
+ stateWatchers.delete(watcher);
992
+ };
993
+ },
994
+ within: (owner) => {
995
+ const target = owner.run(() => currentStructOwner);
996
+ if (target === null) return false;
997
+ for (let t = tok; t !== null; ) {
998
+ if (t === target) return true;
999
+ const o = t.sub;
1000
+ if (o === null) return false;
1001
+ t = o._owner ?? null;
1002
+ }
1003
+ return false;
1004
+ }
1005
+ });
1006
+ return check;
1007
+ }
1008
+ function holdSubtree(root) {
1009
+ heldRoots.add(root);
1010
+ return () => {
1011
+ if (heldRoots.delete(root)) settleHeld();
1012
+ };
1013
+ }
1014
+ function isHeld(sub2) {
1015
+ if (frozenOwners !== 0 && hasFrozenOwner(sub2)) return true;
1016
+ if (heldRoots.size !== 0) {
1017
+ const node = sub2._errorNode;
1018
+ if (node != null) {
1019
+ for (const root of heldRoots) if (root.contains(node)) return true;
1020
+ }
1021
+ }
1022
+ return false;
1023
+ }
1024
+ function notifyEnded() {
1025
+ for (const watcher of stateWatchers) if (watcher.check.state() === ENDED) stateWatchers.delete(watcher);
1026
+ let ended = null;
1027
+ for (const watcher of endWatchers) {
1028
+ if (watcher.check.state() !== ENDED) continue;
1029
+ endWatchers.delete(watcher);
1030
+ (ended ?? (ended = [])).push(watcher);
1031
+ }
1032
+ if (ended === null) return;
1033
+ for (const watcher of ended) {
1034
+ try {
1035
+ watcher.onEnd();
1036
+ } catch (err) {
1037
+ reportError(err, { phase: "cleanup" });
1038
+ }
1039
+ }
1040
+ }
1041
+ function dropReleasedSkipped() {
1042
+ for (const sub2 of skippedWhileHeld) {
1043
+ if (sub2._disposed === true || sub2.depsHead == null) skippedWhileHeld.delete(sub2);
1044
+ }
1045
+ }
1046
+ function settleHeld() {
1047
+ for (const sub2 of skippedWhileHeld) {
1048
+ if (sub2._disposed === true) skippedWhileHeld.delete(sub2);
1049
+ else if (!isHeld(sub2)) {
1050
+ skippedWhileHeld.delete(sub2);
1051
+ if (!pendingSet.has(sub2)) {
1052
+ pendingSet.add(sub2);
1053
+ pendingQueue.push(sub2);
1054
+ }
1055
+ }
1056
+ }
1057
+ if (frozenOwners === 0 && heldRoots.size === 0) skippedWhileHeld.clear();
1058
+ let ready = null;
1059
+ for (const waiter of waiters) {
1060
+ if (waiter.check.state() === PAUSED) continue;
1061
+ waiters.delete(waiter);
1062
+ (ready ?? (ready = [])).push(waiter);
1063
+ }
1064
+ if (ready !== null) {
1065
+ const settle = ready;
1066
+ queueMicrotask(() => {
1067
+ for (const waiter of settle) {
1068
+ const state5 = waiter.check.state();
1069
+ if (state5 === PAUSED) waiters.add(waiter);
1070
+ else
1071
+ try {
1072
+ (state5 === ACTIVE ? waiter.onActive : waiter.onEnd)();
1073
+ } catch (err) {
1074
+ reportError(err, { phase: "effect" });
1075
+ }
1076
+ }
1077
+ });
1078
+ }
1079
+ if (pendingQueue.length > 0) drainNotificationQueue();
1080
+ }
1081
+ function hasFrozenOwner(sub2) {
1082
+ for (let t = sub2._owner ?? null; t !== null; ) {
1083
+ const o = t.sub;
1084
+ if (o === null) return false;
1085
+ if (o._frozen === true) return true;
1086
+ t = o._owner ?? null;
1087
+ }
1088
+ return false;
1089
+ }
884
1090
  var subscriberEpochCounter = 0;
885
1091
  function retrack(effectFn, subscriber) {
886
1092
  const prev = currentSubscriber;
@@ -988,6 +1194,20 @@ function structuralBinding(commit, ownerNode) {
988
1194
  } finally {
989
1195
  currentStructOwner = prev;
990
1196
  }
1197
+ },
1198
+ freeze: () => {
1199
+ const s2 = sub2;
1200
+ if (s2._disposed || s2._frozen) return;
1201
+ s2._frozen = true;
1202
+ frozenOwners++;
1203
+ queueStateCheck();
1204
+ },
1205
+ thaw: () => {
1206
+ if (!sub2._frozen) return;
1207
+ sub2._frozen = false;
1208
+ frozenOwners--;
1209
+ queueStateCheck();
1210
+ settleHeld();
991
1211
  }
992
1212
  };
993
1213
  }
@@ -1016,20 +1236,34 @@ function createBinding(commit, ownerNode, structural) {
1016
1236
  subscriber._errorNode = ownerNode;
1017
1237
  subscriber._tok = null;
1018
1238
  subscriber._owner = null;
1239
+ subscriber._frozen = false;
1019
1240
  if (structural) subscriber._tok = { sub: subscriber };
1020
1241
  try {
1021
1242
  run();
1022
1243
  } catch (err) {
1023
1244
  subscriber._disposed = true;
1024
1245
  subscriber._errorNode = void 0;
1025
- if (subscriber._tok != null) subscriber._tok.sub = null;
1246
+ if (subscriber._tok != null) {
1247
+ subscriber._tok.sub = null;
1248
+ if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
1249
+ }
1026
1250
  cleanup(subscriber);
1027
1251
  throw err;
1028
1252
  }
1029
1253
  subscriber._dispose = () => {
1030
1254
  subscriber._disposed = true;
1255
+ const wasFrozen = subscriber._frozen === true;
1256
+ if (wasFrozen) {
1257
+ subscriber._frozen = false;
1258
+ frozenOwners--;
1259
+ }
1031
1260
  subscriber._errorNode = void 0;
1032
- if (subscriber._tok != null) subscriber._tok.sub = null;
1261
+ if (subscriber._tok != null) {
1262
+ subscriber._tok.sub = null;
1263
+ if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
1264
+ if (skippedWhileHeld.size !== 0) dropReleasedSkipped();
1265
+ if (wasFrozen || waiters.size !== 0) settleHeld();
1266
+ }
1033
1267
  cleanup(subscriber);
1034
1268
  };
1035
1269
  return subscriber;
@@ -1139,6 +1373,10 @@ function runPendingOwners(sub2) {
1139
1373
  }
1140
1374
  }
1141
1375
  function runQueued(sub2) {
1376
+ if ((frozenOwners !== 0 || heldRoots.size !== 0) && isHeld(sub2)) {
1377
+ skippedWhileHeld.add(sub2);
1378
+ return;
1379
+ }
1142
1380
  if (quarantined.size > 0 && quarantined.has(sub2)) return;
1143
1381
  if (sub2._hasComputedDep === true && !depsChanged(sub2)) return;
1144
1382
  if (tickRepeat(sub2)) {
@@ -1286,7 +1524,7 @@ function forEachSubscriber(signal2, visit) {
1286
1524
  }
1287
1525
 
1288
1526
  // src/reactivity/track.ts
1289
- var _runtimeVersion = true ? "4.14.0" : "dev";
1527
+ var _runtimeVersion = true ? "4.15.0" : "dev";
1290
1528
  var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
1291
1529
  function resolveReactiveApi() {
1292
1530
  const g2 = globalThis;
@@ -1322,6 +1560,8 @@ function resolveReactiveApi() {
1322
1560
  runWithOwnerScope,
1323
1561
  bindOwnerScope,
1324
1562
  structuralBinding,
1563
+ captureFrozen,
1564
+ holdSubtree,
1325
1565
  version: _runtimeVersion
1326
1566
  };
1327
1567
  g2[REGISTRY_KEY] = local;
@@ -1349,6 +1589,22 @@ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
1349
1589
  var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
1350
1590
  var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
1351
1591
  var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
1592
+ var captureFrozen2 = API.captureFrozen ?? (() => Object.assign(() => false, {
1593
+ state: () => 0,
1594
+ wait: (onActive) => {
1595
+ onActive();
1596
+ return () => {
1597
+ };
1598
+ },
1599
+ onEnd: () => () => {
1600
+ },
1601
+ run: (fn) => fn(),
1602
+ onChange: () => () => {
1603
+ },
1604
+ within: () => false
1605
+ }));
1606
+ var holdSubtree2 = API.holdSubtree ?? (() => () => {
1607
+ });
1352
1608
 
1353
1609
  // src/core/devtoolsHook.ts
1354
1610
  function emitDevtools(hook, event, payload) {
@@ -1598,14 +1854,14 @@ function runInSSRContext(fn) {
1598
1854
  }
1599
1855
  function trackPending(promise, label2, hydration = true) {
1600
1856
  const store = getRequestStore();
1601
- const pending = store?.pending;
1602
- const sessions = pending || !hydration ? [] : hydrationOwners();
1603
- if (!pending && sessions.length === 0) return promise;
1857
+ const pending2 = store?.pending;
1858
+ const sessions = pending2 || !hydration ? [] : hydrationOwners();
1859
+ if (!pending2 && sessions.length === 0) return promise;
1604
1860
  const entry = { label: label2, since: Date.now(), boundary: currentBoundary() ?? void 0 };
1605
- pending?.add(entry);
1861
+ pending2?.add(entry);
1606
1862
  const release = holdHydration(sessions, entry);
1607
1863
  const done = () => {
1608
- pending?.delete(entry);
1864
+ pending2?.delete(entry);
1609
1865
  store?.wake?.();
1610
1866
  release();
1611
1867
  };
@@ -1804,7 +2060,7 @@ var isBatching = API2.isBatching;
1804
2060
  // src/core/signals/signal.ts
1805
2061
  var _g2 = globalThis;
1806
2062
  function signal(initial, options) {
1807
- const state3 = {
2063
+ const state5 = {
1808
2064
  value: initial,
1809
2065
  __v: 0,
1810
2066
  __sc: 0,
@@ -1817,67 +2073,61 @@ function signal(initial, options) {
1817
2073
  };
1818
2074
  const debugName = DEV ? options?.name : void 0;
1819
2075
  const equalsFn = options?.equals;
1820
- if (debugName) state3.__name = debugName;
2076
+ if (debugName) state5.__name = debugName;
1821
2077
  function get() {
1822
- recordDependency2(state3);
1823
- return state3.value;
2078
+ recordDependency2(state5);
2079
+ return state5.value;
1824
2080
  }
1825
- get.__signal = state3;
2081
+ get.__signal = state5;
1826
2082
  if (debugName) get.__name = debugName;
1827
2083
  let set;
1828
2084
  if (equalsFn) {
1829
2085
  set = (next) => {
1830
- const prev = state3.value;
2086
+ const prev = state5.value;
1831
2087
  const newValue = typeof next === "function" ? next(prev) : next;
1832
2088
  if (equalsFn(prev, newValue)) return;
1833
- state3.value = newValue;
1834
- state3.__v++;
2089
+ state5.value = newValue;
2090
+ state5.__v++;
1835
2091
  if (DEV) {
1836
2092
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1837
- if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
2093
+ if (hook) emitDevtools(hook, "signal:update", { signal: state5, name: debugName, oldValue: prev, newValue });
1838
2094
  }
1839
- if (!enqueueBatchedSignal(state3)) {
1840
- notifySubscribers2(state3);
2095
+ if (!enqueueBatchedSignal(state5)) {
2096
+ notifySubscribers2(state5);
1841
2097
  }
1842
2098
  };
1843
2099
  } else if (DEV) {
1844
2100
  set = (next) => {
1845
- const prev = state3.value;
2101
+ const prev = state5.value;
1846
2102
  const newValue = typeof next === "function" ? next(prev) : next;
1847
2103
  if (Object.is(newValue, prev)) return;
1848
- state3.value = newValue;
1849
- state3.__v++;
2104
+ state5.value = newValue;
2105
+ state5.__v++;
1850
2106
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1851
- if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
1852
- if (!enqueueBatchedSignal(state3)) {
1853
- notifySubscribers2(state3);
2107
+ if (hook) emitDevtools(hook, "signal:update", { signal: state5, name: debugName, oldValue: prev, newValue });
2108
+ if (!enqueueBatchedSignal(state5)) {
2109
+ notifySubscribers2(state5);
1854
2110
  }
1855
2111
  };
1856
2112
  } else {
1857
2113
  set = (next) => {
1858
- const prev = state3.value;
2114
+ const prev = state5.value;
1859
2115
  const newValue = typeof next === "function" ? next(prev) : next;
1860
2116
  if (Object.is(newValue, prev)) return;
1861
- state3.value = newValue;
1862
- state3.__v++;
1863
- if (!enqueueBatchedSignal(state3)) {
1864
- notifySubscribers2(state3);
2117
+ state5.value = newValue;
2118
+ state5.__v++;
2119
+ if (!enqueueBatchedSignal(state5)) {
2120
+ notifySubscribers2(state5);
1865
2121
  }
1866
2122
  };
1867
2123
  }
1868
2124
  if (DEV) {
1869
2125
  const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
1870
- if (hook) emitDevtools(hook, "signal:create", { signal: state3, name: debugName, getter: get, initial });
2126
+ if (hook) emitDevtools(hook, "signal:create", { signal: state5, name: debugName, getter: get, initial });
1871
2127
  }
1872
2128
  return [get, set];
1873
2129
  }
1874
2130
 
1875
- // src/utils/globalSingleton.ts
1876
- function globalSingleton(key, create) {
1877
- const g2 = globalThis;
1878
- return g2[key] ?? (g2[key] = create());
1879
- }
1880
-
1881
2131
  // src/utils/guards.ts
1882
2132
  var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
1883
2133
  function isUnsafeKey(key) {
@@ -2183,10 +2433,10 @@ function primeFromTransfer() {
2183
2433
  }
2184
2434
  }
2185
2435
  registerTransferCollector("q", () => {
2186
- const cache = getRequestScopedCache("query");
2187
- if (!cache) return void 0;
2436
+ const cache2 = getRequestScopedCache("query");
2437
+ if (!cache2) return void 0;
2188
2438
  const out = {};
2189
- for (const [key, entry] of cache) {
2439
+ for (const [key, entry] of cache2) {
2190
2440
  if (entry.noTransfer || entry.data === void 0 || entry.error) continue;
2191
2441
  out[key] = { d: entry.data, t: entry.dataUpdatedAt };
2192
2442
  }
@@ -2200,8 +2450,8 @@ function abandonEntry(entry) {
2200
2450
  entry.promise = null;
2201
2451
  entry.generation++;
2202
2452
  }
2203
- function getOrCreateEntry(cache, key, initialData) {
2204
- let entry = cache.get(key);
2453
+ function getOrCreateEntry(cache2, key, initialData) {
2454
+ let entry = cache2.get(key);
2205
2455
  if (!entry) {
2206
2456
  entry = {
2207
2457
  data: initialData,
@@ -2219,7 +2469,7 @@ function getOrCreateEntry(cache, key, initialData) {
2219
2469
  sharedFrom: void 0,
2220
2470
  hasShared: false
2221
2471
  };
2222
- cache.set(key, entry);
2472
+ cache2.set(key, entry);
2223
2473
  }
2224
2474
  return entry;
2225
2475
  }
@@ -2244,7 +2494,7 @@ function query(key, fetcher, options = {}) {
2244
2494
  const resolveKey = typeof key === "function" ? key : () => key;
2245
2495
  const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
2246
2496
  const isEnabled = onServer && !ssr ? () => false : enabledGate ?? (() => Boolean(enabled));
2247
- const cache = getActiveQueryCache();
2497
+ const cache2 = getActiveQueryCache();
2248
2498
  const [data2, setData] = signal(initialData);
2249
2499
  const [isFetching, setIsFetching] = signal(false);
2250
2500
  const [error, setError] = signal(void 0);
@@ -2269,7 +2519,7 @@ function query(key, fetcher, options = {}) {
2269
2519
  data2();
2270
2520
  updatedAt();
2271
2521
  if (!currentKey) return true;
2272
- const entry = cache.get(currentKey);
2522
+ const entry = cache2.get(currentKey);
2273
2523
  if (!entry || entry.dataUpdatedAt === 0) return true;
2274
2524
  return Date.now() - entry.dataUpdatedAt >= staleTime;
2275
2525
  });
@@ -2328,13 +2578,13 @@ function query(key, fetcher, options = {}) {
2328
2578
  entry.refetchers.delete(doFetch);
2329
2579
  entry.subscribers = Math.max(0, entry.subscribers - 1);
2330
2580
  if (entry.subscribers > 0 || cacheTime < 0 || key2 === null) return;
2331
- if (cache.get(key2) !== entry) return;
2581
+ if (cache2.get(key2) !== entry) return;
2332
2582
  if (entry.gcTimer !== null) clearTimeout(entry.gcTimer);
2333
2583
  entry.gcTimer = setTimeout(() => {
2334
- const current2 = cache.get(key2);
2584
+ const current2 = cache2.get(key2);
2335
2585
  if (current2 === entry && current2.subscribers <= 0) {
2336
2586
  abandonEntry(current2);
2337
- cache.delete(key2);
2587
+ cache2.delete(key2);
2338
2588
  }
2339
2589
  }, cacheTime);
2340
2590
  entry.gcTimer.unref?.();
@@ -2361,7 +2611,7 @@ function query(key, fetcher, options = {}) {
2361
2611
  async function doFetch() {
2362
2612
  if (disposed || !currentKey || !untracked2(isEnabled)) return;
2363
2613
  const key2 = currentKey;
2364
- const entry = getOrCreateEntry(cache, key2);
2614
+ const entry = getOrCreateEntry(cache2, key2);
2365
2615
  attachToEntry(entry, key2);
2366
2616
  if (entry.promise) {
2367
2617
  setIsFetching(true);
@@ -2441,7 +2691,7 @@ function query(key, fetcher, options = {}) {
2441
2691
  }
2442
2692
  function onCacheUpdate() {
2443
2693
  if (disposed || !currentKey) return;
2444
- const entry = cache.get(currentKey);
2694
+ const entry = cache2.get(currentKey);
2445
2695
  if (!entry) {
2446
2696
  batch(() => {
2447
2697
  commitBase(null, void 0);
@@ -2471,7 +2721,7 @@ function query(key, fetcher, options = {}) {
2471
2721
  setIsFetching(false);
2472
2722
  return;
2473
2723
  }
2474
- const entry = getOrCreateEntry(cache, key2, initialData);
2724
+ const entry = getOrCreateEntry(cache2, key2, initialData);
2475
2725
  if (!ssr) entry.noTransfer = true;
2476
2726
  const reattached = attachedEntry !== entry;
2477
2727
  attachToEntry(entry, key2);
@@ -2890,23 +3140,23 @@ function debounce(getter, delay) {
2890
3140
  function throttle(getter, interval) {
2891
3141
  const [throttled, setThrottled] = signal(getter());
2892
3142
  let cooldown = false;
2893
- let pending = null;
3143
+ let pending2 = null;
2894
3144
  let lastEmitted = getter();
2895
3145
  let timer = null;
2896
3146
  function emit(value) {
2897
3147
  setThrottled(value);
2898
3148
  lastEmitted = value;
2899
3149
  cooldown = true;
2900
- pending = null;
3150
+ pending2 = null;
2901
3151
  timer = setTimeout(endWindow, interval);
2902
3152
  }
2903
3153
  function endWindow() {
2904
3154
  timer = null;
2905
- if (pending !== null && !Object.is(pending.value, lastEmitted)) {
2906
- emit(pending.value);
3155
+ if (pending2 !== null && !Object.is(pending2.value, lastEmitted)) {
3156
+ emit(pending2.value);
2907
3157
  return;
2908
3158
  }
2909
- pending = null;
3159
+ pending2 = null;
2910
3160
  cooldown = false;
2911
3161
  }
2912
3162
  const stop2 = effect(() => {
@@ -2914,7 +3164,7 @@ function throttle(getter, interval) {
2914
3164
  if (!cooldown) {
2915
3165
  if (!Object.is(value, lastEmitted)) emit(value);
2916
3166
  } else {
2917
- pending = { value };
3167
+ pending2 = { value };
2918
3168
  }
2919
3169
  });
2920
3170
  Object.defineProperty(throttled, "dispose", {
@@ -3268,8 +3518,8 @@ async function offlineStore(options) {
3268
3518
  const out = [];
3269
3519
  for (const remote of remoteItems) {
3270
3520
  const key = remote[keyPath];
3271
- const pending = key == null ? void 0 : pendingByKey.get(key);
3272
- if (!pending) {
3521
+ const pending2 = key == null ? void 0 : pendingByKey.get(key);
3522
+ if (!pending2) {
3273
3523
  out.push(remote);
3274
3524
  continue;
3275
3525
  }
@@ -3287,8 +3537,8 @@ async function offlineStore(options) {
3287
3537
  continue;
3288
3538
  }
3289
3539
  try {
3290
- const local = pending.type === "delete" ? void 0 : await idbGet(db, "items", key);
3291
- const choice = await activeAdapter.resolveConflict({ key, local, remote, pending });
3540
+ const local = pending2.type === "delete" ? void 0 : await idbGet(db, "items", key);
3541
+ const choice = await activeAdapter.resolveConflict({ key, local, remote, pending: pending2 });
3292
3542
  if (choice !== void 0) out.push(choice);
3293
3543
  } catch (err) {
3294
3544
  if (typeof console !== "undefined") {
@@ -3340,23 +3590,23 @@ function syncAdapter(config) {
3340
3590
  var _clientScope = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.routeLoader.v2"), () => ({ stack: [] }));
3341
3591
  var _disposed = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.routeLoader.disposed.v1"), () => /* @__PURE__ */ new WeakSet());
3342
3592
  function currentScope() {
3343
- const cache = getRequestScopedCache("routeLoader");
3344
- if (!cache) return _clientScope;
3345
- let scope = cache.get("scope");
3593
+ const cache2 = getRequestScopedCache("routeLoader");
3594
+ if (!cache2) return _clientScope;
3595
+ let scope = cache2.get("scope");
3346
3596
  if (!scope) {
3347
3597
  scope = { stack: [] };
3348
- cache.set("scope", scope);
3598
+ cache2.set("scope", scope);
3349
3599
  }
3350
3600
  return scope;
3351
3601
  }
3352
3602
  function automaticKey(loader, context) {
3353
3603
  const key = `loader:${context.path}${loader.name ? `:${loader.name}` : ""}`;
3354
- const cache = getRequestScopedCache("routeLoader");
3355
- if (!cache) return key;
3356
- let owners = cache.get("owners");
3604
+ const cache2 = getRequestScopedCache("routeLoader");
3605
+ if (!cache2) return key;
3606
+ let owners = cache2.get("owners");
3357
3607
  if (!owners) {
3358
3608
  owners = /* @__PURE__ */ new Map();
3359
- cache.set("owners", owners);
3609
+ cache2.set("owners", owners);
3360
3610
  }
3361
3611
  const owner = owners.get(key);
3362
3612
  if (owner === void 0) {
@@ -4352,13 +4602,13 @@ function idle(timeout = 6e4) {
4352
4602
 
4353
4603
  // src/browser/permissions.ts
4354
4604
  function permissions(name) {
4355
- const [state3, setState] = signal("prompt");
4605
+ const [state5, setState] = signal("prompt");
4356
4606
  let permissionStatus = null;
4357
4607
  let onChange = null;
4358
4608
  let disposed = false;
4359
4609
  if (typeof navigator === "undefined" || !navigator.permissions) {
4360
4610
  setState("unsupported");
4361
- return { state: state3, dispose: () => {
4611
+ return { state: state5, dispose: () => {
4362
4612
  } };
4363
4613
  }
4364
4614
  navigator.permissions.query({ name }).then((status) => {
@@ -4381,7 +4631,7 @@ function permissions(name) {
4381
4631
  onChange = null;
4382
4632
  }
4383
4633
  }
4384
- return { state: state3, dispose: dispose2 };
4634
+ return { state: state5, dispose: dispose2 };
4385
4635
  }
4386
4636
 
4387
4637
  // src/browser/clipboard.ts
@@ -4730,9 +4980,9 @@ function colorScheme() {
4730
4980
  // src/browser/format.ts
4731
4981
  var I18N_STATE = /* @__PURE__ */ Symbol.for("sibujs.i18n.v1");
4732
4982
  function activeI18nLocale() {
4733
- const state3 = globalThis[I18N_STATE];
4734
- if (!state3) return void 0;
4735
- return state3.getLocale ? state3.getLocale() : state3.locale?.[0]();
4983
+ const state5 = globalThis[I18N_STATE];
4984
+ if (!state5) return void 0;
4985
+ return state5.getLocale ? state5.getLocale() : state5.locale?.[0]();
4736
4986
  }
4737
4987
  function formatNumber(value, options) {
4738
4988
  const { locale, ...formatOptions } = options ?? {};
@@ -4914,9 +5164,9 @@ function notifyUrlWrite() {
4914
5164
  for (const sync of Array.from(_url.instances)) sync();
4915
5165
  }
4916
5166
  var SCROLL_ENTRY_KEY = "__sibuScrollKey";
4917
- function withoutEntryIdentity(state3) {
4918
- if (state3 === null || typeof state3 !== "object" || !Object.hasOwn(state3, SCROLL_ENTRY_KEY)) return state3;
4919
- const { [SCROLL_ENTRY_KEY]: _identity, ...rest } = state3;
5167
+ function withoutEntryIdentity(state5) {
5168
+ if (state5 === null || typeof state5 !== "object" || !Object.hasOwn(state5, SCROLL_ENTRY_KEY)) return state5;
5169
+ const { [SCROLL_ENTRY_KEY]: _identity, ...rest } = state5;
4920
5170
  return rest;
4921
5171
  }
4922
5172
  function urlState() {
@@ -4954,9 +5204,9 @@ function urlState() {
4954
5204
  window.addEventListener("hashchange", syncFromLocation);
4955
5205
  _url.instances.add(syncFromLocation);
4956
5206
  function writeHistory(newUrl, opts) {
4957
- const state3 = "state" in opts ? opts.state : window.history.state;
4958
- if (opts.replace) window.history.replaceState(state3, "", newUrl);
4959
- else window.history.pushState("state" in opts ? state3 : withoutEntryIdentity(state3), "", newUrl);
5207
+ const state5 = "state" in opts ? opts.state : window.history.state;
5208
+ if (opts.replace) window.history.replaceState(state5, "", newUrl);
5209
+ else window.history.pushState("state" in opts ? state5 : withoutEntryIdentity(state5), "", newUrl);
4960
5210
  }
4961
5211
  function setParams(next, opts = {}) {
4962
5212
  const p2 = next instanceof URLSearchParams ? next : new URLSearchParams(next);
@@ -5763,7 +6013,7 @@ function ownEntry(table2, key) {
5763
6013
  return Object.hasOwn(table2, key) ? table2[key] : void 0;
5764
6014
  }
5765
6015
  function machine(config) {
5766
- const [state3, setState] = signal(config.initial);
6016
+ const [state5, setState] = signal(config.initial);
5767
6017
  const [context, setContext] = signal(config.context || {});
5768
6018
  let currentState = config.initial;
5769
6019
  let currentContext = context();
@@ -5837,10 +6087,10 @@ function machine(config) {
5837
6087
  if (queue.length > 0) drain();
5838
6088
  }
5839
6089
  function matches(s2) {
5840
- return state3() === s2;
6090
+ return state5() === s2;
5841
6091
  }
5842
6092
  function can(event) {
5843
- const currentState2 = state3();
6093
+ const currentState2 = state5();
5844
6094
  const stateDef = ownEntry(config.states, currentState2);
5845
6095
  if (!stateDef?.on) return false;
5846
6096
  const transition2 = ownEntry(stateDef.on, event);
@@ -5851,7 +6101,7 @@ function machine(config) {
5851
6101
  }
5852
6102
  return true;
5853
6103
  }
5854
- return { state: state3, context, send, matches, can };
6104
+ return { state: state5, context, send, matches, can };
5855
6105
  }
5856
6106
 
5857
6107
  // src/patterns/persist.ts
@@ -5940,7 +6190,7 @@ function persisted(key, initial, options = {}) {
5940
6190
  // src/patterns/optimistic.ts
5941
6191
  function optimistic(initialValue) {
5942
6192
  const [value, setValue] = signal(initialValue);
5943
- const [pending, setPending] = signal(false);
6193
+ const [pending2, setPending] = signal(false);
5944
6194
  let inflightCount = 0;
5945
6195
  let version = 0;
5946
6196
  async function update(optimisticValue, asyncAction) {
@@ -5966,7 +6216,7 @@ function optimistic(initialValue) {
5966
6216
  }
5967
6217
  }
5968
6218
  }
5969
- return { value, pending, update };
6219
+ return { value, pending: pending2, update };
5970
6220
  }
5971
6221
  function optimisticList(initialValue) {
5972
6222
  let nextRowId = 0;
@@ -6012,7 +6262,7 @@ function optimisticList(initialValue) {
6012
6262
  if (i2 > 0) claims.splice(0, i2);
6013
6263
  }
6014
6264
  const [items, setItems] = signal(order.map((id) => effectiveValue(records.get(id))));
6015
- const [pending, setPending] = signal(false);
6265
+ const [pending2, setPending] = signal(false);
6016
6266
  let inflight = 0;
6017
6267
  const retiredRowIds = /* @__PURE__ */ new Set();
6018
6268
  function project() {
@@ -6215,7 +6465,7 @@ function optimisticList(initialValue) {
6215
6465
  }
6216
6466
  return {
6217
6467
  items,
6218
- pending,
6468
+ pending: pending2,
6219
6469
  add,
6220
6470
  remove,
6221
6471
  update: updateItem
@@ -6317,13 +6567,13 @@ function adopt(value) {
6317
6567
  resolvePromise = resolve;
6318
6568
  rejectPromise = reject;
6319
6569
  });
6320
- let state3 = "invoking";
6570
+ let state5 = "invoking";
6321
6571
  let nativeTarget;
6322
- const waiters = [];
6572
+ const waiters2 = [];
6323
6573
  const transition2 = (next) => {
6324
- state3 = next;
6574
+ state5 = next;
6325
6575
  if (next === "invoking") return;
6326
- for (const waiter of waiters.splice(0)) waiter();
6576
+ for (const waiter of waiters2.splice(0)) waiter();
6327
6577
  };
6328
6578
  const fulfil = (result) => {
6329
6579
  resolvePromise(result);
@@ -6379,18 +6629,18 @@ function adopt(value) {
6379
6629
  } catch (error) {
6380
6630
  onReject(error);
6381
6631
  }
6382
- if (!done && state3 === "invoking") transition2("pending");
6632
+ if (!done && state5 === "invoking") transition2("pending");
6383
6633
  });
6384
6634
  };
6385
6635
  invokeLater(value, then);
6386
6636
  const probe = (onRejected, onOpen) => {
6387
6637
  const decide = () => {
6388
- if (state3 === "native") probeNative(nativeTarget, onRejected, onOpen);
6389
- else (state3 === "rejected" ? onRejected : onOpen)();
6638
+ if (state5 === "native") probeNative(nativeTarget, onRejected, onOpen);
6639
+ else (state5 === "rejected" ? onRejected : onOpen)();
6390
6640
  };
6391
- if (state3 === "native") probeNative(nativeTarget, onRejected, onOpen);
6392
- else if (state3 === "invoking") waiters.push(decide);
6393
- else queueMicrotask(state3 === "rejected" ? onRejected : onOpen);
6641
+ if (state5 === "native") probeNative(nativeTarget, onRejected, onOpen);
6642
+ else if (state5 === "invoking") waiters2.push(decide);
6643
+ else queueMicrotask(state5 === "rejected" ? onRejected : onOpen);
6394
6644
  };
6395
6645
  return { promise, failedEarly: false, probe };
6396
6646
  }
@@ -6431,12 +6681,12 @@ function globalStore(config) {
6431
6681
  const [getState, setState] = signal({ ...initialState });
6432
6682
  const subscriptions = /* @__PURE__ */ new Map();
6433
6683
  const middlewares = config.middleware || [];
6434
- function notifyListeners2(state3) {
6684
+ function notifyListeners2(state5) {
6435
6685
  if (subscriptions.size === 0) return;
6436
6686
  for (const subscription of Array.from(subscriptions.values())) {
6437
6687
  if (!subscription.active) continue;
6438
6688
  try {
6439
- subscription.callback(state3);
6689
+ subscription.callback(state5);
6440
6690
  } catch (err) {
6441
6691
  reportError(err, { phase: "event", name: "globalStore(subscribe)" });
6442
6692
  }
@@ -7411,16 +7661,16 @@ function form(config) {
7411
7661
  }
7412
7662
  if (isValid()) {
7413
7663
  const report = (error) => reportError(error, { phase: "async", name: "form.handleSubmit" });
7414
- let pending;
7664
+ let pending2;
7415
7665
  try {
7416
- pending = adoptThenable(onSubmit(values()));
7666
+ pending2 = adoptThenable(onSubmit(values()));
7417
7667
  } catch (error) {
7418
7668
  report(error);
7419
7669
  return;
7420
7670
  }
7421
- if (pending) {
7671
+ if (pending2) {
7422
7672
  setSubmitting(true);
7423
- pending.then(
7673
+ pending2.then(
7424
7674
  () => setSubmitting(false),
7425
7675
  (error) => {
7426
7676
  setSubmitting(false);
@@ -8362,8 +8612,8 @@ function commitSafeAttribute(el, name, value, options) {
8362
8612
  else el.removeAttribute(name);
8363
8613
  return false;
8364
8614
  }
8365
- const pending = value == null || value === false ? null : value === true ? "" : String(value);
8366
- const refusal = contextualAttributeRefusal(el, name, pending, options.reactive ? "reactive" : "runtime");
8615
+ const pending2 = value == null || value === false ? null : value === true ? "" : String(value);
8616
+ const refusal = contextualAttributeRefusal(el, name, pending2, options.reactive ? "reactive" : "runtime");
8367
8617
  if (refusal !== ContextualRefusal.None) {
8368
8618
  warnContextualRefusal(options.label ?? "setSafeAttribute", name, refusal);
8369
8619
  if (ns) el.removeAttributeNS(ns, localName);
@@ -9188,14 +9438,14 @@ function noSideEffect(fn) {
9188
9438
  }
9189
9439
 
9190
9440
  // src/utils/embedPolicy.ts
9191
- var state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.embed.v2"), () => ({
9441
+ var state3 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.embed.v2"), () => ({
9192
9442
  allowed: [],
9193
9443
  frames: /* @__PURE__ */ new WeakMap()
9194
9444
  }));
9195
9445
  var REQUEST_CACHE = "embed";
9196
9446
  function currentEmbedAllowlist() {
9197
9447
  const scoped = getRequestStore()?.caches?.get(REQUEST_CACHE)?.get("allowed");
9198
- return scoped ?? state2.allowed;
9448
+ return scoped ?? state3.allowed;
9199
9449
  }
9200
9450
  function resolveEmbedSrc(value, allowed = currentEmbedAllowlist()) {
9201
9451
  if (typeof value !== "string" || sanitizeUrl(value) === "") return null;
@@ -9255,7 +9505,7 @@ function narrowEmbedAllow(value) {
9255
9505
  return granted.filter((feature) => !denied.includes(feature)).join("; ");
9256
9506
  }
9257
9507
  function getEmbedRecord(frame) {
9258
- return state2.frames.get(frame);
9508
+ return state3.frames.get(frame);
9259
9509
  }
9260
9510
  function intersect(current2, permitted, separator) {
9261
9511
  const allowed = permitted.split(separator);
@@ -9370,6 +9620,25 @@ function serializePlannedHeadEntry(tag, attributes) {
9370
9620
  return `<${tag} ${pairs} />`;
9371
9621
  }
9372
9622
 
9623
+ // src/utils/styleKey.ts
9624
+ var EXCEPTIONS = { cssFloat: "float" };
9625
+ var VENDOR_PREFIX = /^(webkit|moz|ms|o)-/;
9626
+ var cache = /* @__PURE__ */ new Map();
9627
+ var CACHE_MAX = 1e3;
9628
+ function styleKeyToProperty(key) {
9629
+ let name = cache.get(key);
9630
+ if (name !== void 0) return name;
9631
+ if (key.startsWith("--")) name = key;
9632
+ else if (Object.hasOwn(EXCEPTIONS, key)) name = EXCEPTIONS[key];
9633
+ else {
9634
+ name = key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
9635
+ if (VENDOR_PREFIX.test(name)) name = `-${name}`;
9636
+ }
9637
+ if (cache.size >= CACHE_MAX) cache.clear();
9638
+ cache.set(key, name);
9639
+ return name;
9640
+ }
9641
+
9373
9642
  // src/platform/serverDom.ts
9374
9643
  var HTML_NS3 = "http://www.w3.org/1999/xhtml";
9375
9644
  var SVG_NS3 = "http://www.w3.org/2000/svg";
@@ -10000,9 +10269,15 @@ var ServerAttr = class {
10000
10269
  get nodeValue() {
10001
10270
  return this._value;
10002
10271
  }
10272
+ set nodeValue(v) {
10273
+ this.value = v;
10274
+ }
10003
10275
  get textContent() {
10004
10276
  return this._value;
10005
10277
  }
10278
+ set textContent(v) {
10279
+ this.value = v;
10280
+ }
10006
10281
  };
10007
10282
  var ServerNamedNodeMap = class extends Array {
10008
10283
  static get [Symbol.species]() {
@@ -10039,12 +10314,6 @@ function splitDeclarations(text2) {
10039
10314
  out.push(text2.slice(start));
10040
10315
  return out;
10041
10316
  }
10042
- var CAMEL_EXCEPTIONS = { cssFloat: "float" };
10043
- function toKebab(prop) {
10044
- if (prop.startsWith("--")) return prop;
10045
- if (Object.hasOwn(CAMEL_EXCEPTIONS, prop)) return CAMEL_EXCEPTIONS[prop];
10046
- return prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`).replace(/^(webkit|moz|ms)-/, "-$1-");
10047
- }
10048
10317
  var ServerStyle = class {
10049
10318
  constructor(el) {
10050
10319
  this.el = el;
@@ -10139,13 +10408,13 @@ function styleProxy(style2) {
10139
10408
  get(target, key, receiver) {
10140
10409
  if (typeof key === "string" && !(key in target)) {
10141
10410
  if (/^\d+$/.test(key)) return target.item(Number(key));
10142
- return target.getPropertyValue(toKebab(key));
10411
+ return target.getPropertyValue(styleKeyToProperty(key));
10143
10412
  }
10144
10413
  return Reflect.get(target, key, receiver);
10145
10414
  },
10146
10415
  set(target, key, value, receiver) {
10147
10416
  if (typeof key === "string" && !(key in target)) {
10148
- target.setProperty(toKebab(key), value == null ? "" : String(value));
10417
+ target.setProperty(styleKeyToProperty(key), value == null ? "" : String(value));
10149
10418
  return true;
10150
10419
  }
10151
10420
  return Reflect.set(target, key, value, receiver);
@@ -10550,6 +10819,10 @@ var ServerInputElement = class extends ServerHTMLElement {
10550
10819
  get defaultChecked() {
10551
10820
  return this.hasAttribute("checked");
10552
10821
  }
10822
+ /** Reflects to the `checked` attribute; `checked` follows it until written (dirty checkedness). */
10823
+ set defaultChecked(v) {
10824
+ this.toggleAttribute("checked", !!v);
10825
+ }
10553
10826
  get type() {
10554
10827
  return (this.getAttribute("type") ?? "text").toLowerCase();
10555
10828
  }
@@ -10607,8 +10880,10 @@ reflectDisabled(ServerTextAreaElement.prototype);
10607
10880
  var ServerOptionElement = class extends ServerHTMLElement {
10608
10881
  constructor() {
10609
10882
  super(...arguments);
10610
- /** @internal */
10883
+ /** Selectedness; `null` while it follows the `selected` attribute. @internal */
10611
10884
  this._selected = null;
10885
+ /** Set by a `selected` write: the attribute no longer decides selectedness. @internal */
10886
+ this._dirty = false;
10612
10887
  }
10613
10888
  get value() {
10614
10889
  return this.getAttribute("value") ?? this.text;
@@ -10625,18 +10900,48 @@ var ServerOptionElement = class extends ServerHTMLElement {
10625
10900
  get label() {
10626
10901
  return this.getAttribute("label") ?? this.text;
10627
10902
  }
10903
+ set label(v) {
10904
+ this.setAttribute("label", v);
10905
+ }
10628
10906
  get selected() {
10629
10907
  return this._selected ?? this.hasAttribute("selected");
10630
10908
  }
10631
10909
  set selected(v) {
10632
10910
  this._selected = !!v;
10911
+ this._dirty = true;
10912
+ const select3 = singleSelectOf(this);
10913
+ if (select3 && v) {
10914
+ for (const o of select3.options) if (o !== this) o._selected = false;
10915
+ }
10633
10916
  }
10634
10917
  get defaultSelected() {
10635
10918
  return this.hasAttribute("selected");
10636
10919
  }
10920
+ /** Reflects to the `selected` attribute; `selected` follows it unless written. */
10921
+ set defaultSelected(v) {
10922
+ this.toggleAttribute("selected", !!v);
10923
+ if (this._dirty) return;
10924
+ this._selected = null;
10925
+ const select3 = singleSelectOf(this);
10926
+ if (!select3) return;
10927
+ let last = null;
10928
+ for (const o of select3.options) if (o.selected) last = o;
10929
+ for (const o of select3.options) if (o !== last && o.selected) o._selected = false;
10930
+ }
10637
10931
  };
10932
+ function singleSelectOf(option2) {
10933
+ let parent = option2.parentNode;
10934
+ if (parent instanceof ServerElement && parent.localName === "optgroup") parent = parent.parentNode;
10935
+ return parent instanceof ServerSelectElement && !parent.hasAttribute("multiple") ? parent : null;
10936
+ }
10638
10937
  reflectDisabled(ServerOptionElement.prototype);
10639
10938
  var ServerSelectElement = class extends ServerHTMLElement {
10939
+ get multiple() {
10940
+ return this.hasAttribute("multiple");
10941
+ }
10942
+ set multiple(v) {
10943
+ this.toggleAttribute("multiple", !!v);
10944
+ }
10640
10945
  get options() {
10641
10946
  return this.querySelectorAll("option");
10642
10947
  }
@@ -10941,21 +11246,21 @@ function compileSelector(selector) {
10941
11246
  const tokens = text2.match(/(?:\\.|\[[^\]]*\]|[^\s>])+|>/g) ?? [];
10942
11247
  const compounds = [];
10943
11248
  const combinators = [];
10944
- let pending = " ";
11249
+ let pending2 = " ";
10945
11250
  let scoped = false;
10946
11251
  for (const token of tokens) {
10947
11252
  if (token === ">") {
10948
- pending = ">";
11253
+ pending2 = ">";
10949
11254
  continue;
10950
11255
  }
10951
11256
  if (token === ":scope") {
10952
11257
  scoped = true;
10953
- pending = " ";
11258
+ pending2 = " ";
10954
11259
  continue;
10955
11260
  }
10956
- if (compounds.length > 0) combinators.unshift(pending);
11261
+ if (compounds.length > 0) combinators.unshift(pending2);
10957
11262
  compounds.unshift(parseCompound(token, selector));
10958
- pending = " ";
11263
+ pending2 = " ";
10959
11264
  }
10960
11265
  if (compounds.length === 0) throw syntaxError(selector);
10961
11266
  groups.push({ compounds, combinators, scoped });
@@ -11806,12 +12111,12 @@ async function hydrateAdopt(component, container, options = {}) {
11806
12111
  inScope(rootScope, () => session.place(container, tree));
11807
12112
  }
11808
12113
  const deadline = Date.now() + (options.timeout ?? 1e4);
11809
- const { pending, wake } = hydration;
12114
+ const { pending: pending2, wake } = hydration;
11810
12115
  for (; ; ) {
11811
12116
  await macrotask();
11812
- if (pending.size === 0) {
12117
+ if (pending2.size === 0) {
11813
12118
  await macrotask();
11814
- if (pending.size === 0) break;
12119
+ if (pending2.size === 0) break;
11815
12120
  continue;
11816
12121
  }
11817
12122
  const remaining = deadline - Date.now();
@@ -11882,9 +12187,9 @@ function installHook() {
11882
12187
  if (hookInstalled) return;
11883
12188
  hookInstalled = true;
11884
12189
  setBoundaryHook((container) => {
11885
- const state3 = requestSlot("stream");
12190
+ const state5 = requestSlot("stream");
11886
12191
  const store = getRequestStore();
11887
- if (!state3 || !store) return null;
12192
+ if (!state5 || !store) return null;
11888
12193
  const id = `sibu-sus-${store.suspenseIdCounter++}`;
11889
12194
  container.setAttribute("data-sibu-suspense-id", id);
11890
12195
  const record = {
@@ -11895,8 +12200,8 @@ function installHook() {
11895
12200
  fallbackHtml: null,
11896
12201
  api: {
11897
12202
  enter: (fn) => {
11898
- if (record.fallbackHtml === null && state3.serialize) {
11899
- record.fallbackHtml = Array.from(container.childNodes, (n) => state3.serialize?.(n) ?? "").join("");
12203
+ if (record.fallbackHtml === null && state5.serialize) {
12204
+ record.fallbackHtml = Array.from(container.childNodes, (n) => state5.serialize?.(n) ?? "").join("");
11900
12205
  }
11901
12206
  return runInBoundary(record.api, fn);
11902
12207
  },
@@ -11906,7 +12211,7 @@ function installHook() {
11906
12211
  }
11907
12212
  }
11908
12213
  };
11909
- state3.boundaries.push(record);
12214
+ state5.boundaries.push(record);
11910
12215
  return record.api;
11911
12216
  });
11912
12217
  }
@@ -11991,9 +12296,9 @@ async function waitFor(ready, deadline, stop2) {
11991
12296
  });
11992
12297
  }
11993
12298
  }
11994
- function pendingFor(pending, boundary) {
11995
- if (!pending) return false;
11996
- for (const work of pending) if (work.boundary === boundary) return true;
12299
+ function pendingFor(pending2, boundary) {
12300
+ if (!pending2) return false;
12301
+ for (const work of pending2) if (work.boundary === boundary) return true;
11997
12302
  return false;
11998
12303
  }
11999
12304
  function streamPage(input2, options = {}) {
@@ -12006,8 +12311,8 @@ function streamPage(input2, options = {}) {
12006
12311
  const MARK_END = "<sibu-stream-end>";
12007
12312
  void runInSSRContext(async () => {
12008
12313
  const store = getRequestStore();
12009
- const state3 = { boundaries: [], serialize: null };
12010
- requestSlot("stream", () => state3);
12314
+ const state5 = { boundaries: [], serialize: null };
12315
+ requestSlot("stream", () => state5);
12011
12316
  const errors = [];
12012
12317
  if (store) store.errors = errors;
12013
12318
  let holder = null;
@@ -12028,13 +12333,13 @@ function streamPage(input2, options = {}) {
12028
12333
  throw explainServerError(err);
12029
12334
  }
12030
12335
  const serialize = (node) => renderToStringWith(node, { marker: options.marker ?? "root", ids });
12031
- state3.serialize = serialize;
12336
+ state5.serialize = serialize;
12032
12337
  holder = document.createDocumentFragment();
12033
12338
  holder.appendChild(root);
12034
12339
  const ready = (b2) => b2.done && !pendingFor(store?.pending, b2.api);
12035
12340
  const serializeWithFallbacks = (node) => {
12036
12341
  const held = [];
12037
- for (const b2 of state3.boundaries) {
12342
+ for (const b2 of state5.boundaries) {
12038
12343
  if (ready(b2) || b2.container === node || !node.contains(b2.container)) continue;
12039
12344
  if (held.some((h) => h.b.container.contains(b2.container))) continue;
12040
12345
  const nodes = Array.from(b2.container.childNodes);
@@ -12056,9 +12361,9 @@ function streamPage(input2, options = {}) {
12056
12361
  await waitFor(() => !pendingFor(store?.pending, void 0), shellDeadline, stopWaiting);
12057
12362
  failIfErrored();
12058
12363
  if (channel.cancelled) return;
12059
- for (const b2 of state3.boundaries) {
12364
+ for (const b2 of state5.boundaries) {
12060
12365
  const inline = (x) => x.done && !pendingFor(store?.pending, x.api);
12061
- const enclosing = state3.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
12366
+ const enclosing = state5.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
12062
12367
  if (inline(b2) && enclosing.every(inline)) b2.emitted = true;
12063
12368
  }
12064
12369
  const shell = serializeWithFallbacks(holder);
@@ -12079,8 +12384,8 @@ function streamPage(input2, options = {}) {
12079
12384
  if (channel.cancelled) return;
12080
12385
  failIfErrored();
12081
12386
  const deadline = Date.now() + (options.timeout ?? 1e4);
12082
- const outstanding = () => state3.boundaries.filter((b2) => !b2.emitted);
12083
- const ancestorsOf = (b2) => state3.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
12387
+ const outstanding = () => state5.boundaries.filter((b2) => !b2.emitted);
12388
+ const ancestorsOf = (b2) => state5.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
12084
12389
  const emittable = (b2) => ready(b2) && ancestorsOf(b2).every((a2) => a2.emitted);
12085
12390
  let bodyClosed = false;
12086
12391
  for (; ; ) {
@@ -12104,7 +12409,7 @@ function streamPage(input2, options = {}) {
12104
12409
  if (channel.cancelled) return;
12105
12410
  failIfErrored();
12106
12411
  }
12107
- for (const b2 of state3.boundaries) {
12412
+ for (const b2 of state5.boundaries) {
12108
12413
  if (b2 === next || !next.container.contains(b2.container) || !ready(b2)) continue;
12109
12414
  const between2 = ancestorsOf(b2).filter((a2) => a2 !== next && next.container.contains(a2.container));
12110
12415
  if (between2.every(ready)) b2.emitted = true;
@@ -12803,12 +13108,12 @@ function escapeScriptJson(json) {
12803
13108
  }
12804
13109
  var DEFAULT_MAX_SSR_BYTES = 1024 * 1024;
12805
13110
  var SAFE_GLOBAL_NAME = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
12806
- function serializeState(state3, nonce, options) {
13111
+ function serializeState(state5, nonce, options) {
12807
13112
  const globalName = options?.global ?? SSR_DATA_ATTR;
12808
13113
  if (!SAFE_GLOBAL_NAME.test(globalName)) {
12809
13114
  throw new Error(`[SibuJS SSR] serializeState: global must be an identifier (got: ${JSON.stringify(globalName)})`);
12810
13115
  }
12811
- const rawJson = JSON.stringify(state3);
13116
+ const rawJson = JSON.stringify(state5);
12812
13117
  const maxBytes = options?.maxBytes ?? DEFAULT_MAX_SSR_BYTES;
12813
13118
  const byteLen = typeof TextEncoder !== "undefined" ? new TextEncoder().encode(rawJson).byteLength : Buffer.byteLength(rawJson, "utf8");
12814
13119
  if (byteLen > maxBytes) {
@@ -12920,8 +13225,8 @@ function normalizedStore(schema) {
12920
13225
  return ownGet(getState().entities, id);
12921
13226
  }
12922
13227
  function getAll() {
12923
- const state3 = getState();
12924
- return state3.ids.map((id) => state3.entities[id]);
13228
+ const state5 = getState();
13229
+ return state5.ids.map((id) => state5.entities[id]);
12925
13230
  }
12926
13231
  function update(id, partial) {
12927
13232
  const prev = getState();
@@ -12954,8 +13259,8 @@ function normalizedStore(schema) {
12954
13259
  });
12955
13260
  }
12956
13261
  function select3(predicate) {
12957
- const state3 = getState();
12958
- return state3.ids.map((id) => state3.entities[id]).filter(predicate);
13262
+ const state5 = getState();
13263
+ return state5.ids.map((id) => state5.entities[id]).filter(predicate);
12959
13264
  }
12960
13265
  return { add, addMany, get, getAll, update, remove, select: select3, getState };
12961
13266
  }
@@ -13043,8 +13348,8 @@ function createChunkRegistry(config = {}) {
13043
13348
  onLoadEnd,
13044
13349
  onLoadError
13045
13350
  } = config;
13046
- const cache = /* @__PURE__ */ new Map();
13047
- const pending = /* @__PURE__ */ new Map();
13351
+ const cache2 = /* @__PURE__ */ new Map();
13352
+ const pending2 = /* @__PURE__ */ new Map();
13048
13353
  const preloaded = /* @__PURE__ */ new Map();
13049
13354
  function notify2(name, run) {
13050
13355
  try {
@@ -13054,17 +13359,17 @@ function createChunkRegistry(config = {}) {
13054
13359
  }
13055
13360
  }
13056
13361
  function evict() {
13057
- while (cache.size >= maxCacheSize) {
13362
+ while (cache2.size >= maxCacheSize) {
13058
13363
  let lru = null;
13059
13364
  let lruTime = Infinity;
13060
- for (const [key, entry] of cache) {
13365
+ for (const [key, entry] of cache2) {
13061
13366
  if (entry.lastAccess < lruTime) {
13062
13367
  lruTime = entry.lastAccess;
13063
13368
  lru = key;
13064
13369
  }
13065
13370
  }
13066
13371
  if (!lru) return;
13067
- cache.delete(lru);
13372
+ cache2.delete(lru);
13068
13373
  }
13069
13374
  }
13070
13375
  function isValid(entry) {
@@ -13101,13 +13406,13 @@ function createChunkRegistry(config = {}) {
13101
13406
  }
13102
13407
  }
13103
13408
  async function loadFn(id, loader) {
13104
- const cached = cache.get(id);
13409
+ const cached = cache2.get(id);
13105
13410
  if (cached && isValid(cached)) {
13106
13411
  cached.accessCount++;
13107
13412
  cached.lastAccess = Date.now();
13108
13413
  return cached.value;
13109
13414
  }
13110
- const existing = pending.get(id);
13415
+ const existing = pending2.get(id);
13111
13416
  if (existing) return existing.promise;
13112
13417
  let resolveOuter;
13113
13418
  let rejectOuter;
@@ -13116,22 +13421,22 @@ function createChunkRegistry(config = {}) {
13116
13421
  rejectOuter = reject;
13117
13422
  });
13118
13423
  const entry = { promise: outcome };
13119
- pending.set(id, entry);
13120
- const owns = () => pending.get(id) === entry;
13424
+ pending2.set(id, entry);
13425
+ const owns = () => pending2.get(id) === entry;
13121
13426
  notify2("onLoadStart", () => onLoadStart?.(id));
13122
13427
  void loadWithRetry(id, loader).then(
13123
13428
  (value) => {
13124
13429
  if (owns()) {
13125
- pending.delete(id);
13430
+ pending2.delete(id);
13126
13431
  evict();
13127
13432
  const now = Date.now();
13128
- cache.set(id, { value, timestamp: now, lastAccess: now, accessCount: 1 });
13433
+ cache2.set(id, { value, timestamp: now, lastAccess: now, accessCount: 1 });
13129
13434
  }
13130
13435
  notify2("onLoadEnd", () => onLoadEnd?.(id));
13131
13436
  resolveOuter(value);
13132
13437
  },
13133
13438
  (err) => {
13134
- if (owns()) pending.delete(id);
13439
+ if (owns()) pending2.delete(id);
13135
13440
  const error = err instanceof Error ? err : new Error(String(err));
13136
13441
  notify2("onLoadError", () => onLoadError?.(id, error));
13137
13442
  rejectOuter(error);
@@ -13143,7 +13448,7 @@ function createChunkRegistry(config = {}) {
13143
13448
  return outcome;
13144
13449
  }
13145
13450
  function preloadFn(id, loader) {
13146
- if (cache.has(id) || pending.has(id) || preloaded.has(id)) return;
13451
+ if (cache2.has(id) || pending2.has(id) || preloaded.has(id)) return;
13147
13452
  const marker2 = {};
13148
13453
  preloaded.set(id, marker2);
13149
13454
  loadFn(id, loader).catch(() => {
@@ -13165,14 +13470,14 @@ function createChunkRegistry(config = {}) {
13165
13470
  * Check if a chunk is cached and valid.
13166
13471
  */
13167
13472
  has(id) {
13168
- const entry = cache.get(id);
13473
+ const entry = cache2.get(id);
13169
13474
  return !!entry && isValid(entry);
13170
13475
  },
13171
13476
  /**
13172
13477
  * Get a cached chunk synchronously. Returns undefined if not cached.
13173
13478
  */
13174
13479
  get(id) {
13175
- const entry = cache.get(id);
13480
+ const entry = cache2.get(id);
13176
13481
  if (entry && isValid(entry)) {
13177
13482
  entry.accessCount++;
13178
13483
  entry.lastAccess = Date.now();
@@ -13189,9 +13494,9 @@ function createChunkRegistry(config = {}) {
13189
13494
  * a subsequent `load(id, …)` starts fresh work rather than adopting it.
13190
13495
  */
13191
13496
  invalidate(id) {
13192
- cache.delete(id);
13497
+ cache2.delete(id);
13193
13498
  preloaded.delete(id);
13194
- pending.delete(id);
13499
+ pending2.delete(id);
13195
13500
  },
13196
13501
  /**
13197
13502
  * Clear all cached chunks, and supersede every load still in flight.
@@ -13199,9 +13504,9 @@ function createChunkRegistry(config = {}) {
13199
13504
  * Same barrier as `invalidate`, applied to every key at once.
13200
13505
  */
13201
13506
  clear() {
13202
- cache.clear();
13507
+ cache2.clear();
13203
13508
  preloaded.clear();
13204
- pending.clear();
13509
+ pending2.clear();
13205
13510
  },
13206
13511
  /**
13207
13512
  * Get cache statistics.
@@ -13211,9 +13516,9 @@ function createChunkRegistry(config = {}) {
13211
13516
  */
13212
13517
  stats() {
13213
13518
  return {
13214
- size: cache.size,
13519
+ size: cache2.size,
13215
13520
  maxSize: maxCacheSize,
13216
- pending: pending.size,
13521
+ pending: pending2.size,
13217
13522
  preloaded: preloaded.size
13218
13523
  };
13219
13524
  }
@@ -13951,16 +14256,16 @@ async function loadWasmModuleWithOptions(source2, opts = {}) {
13951
14256
  if (cachedInstance) return cachedInstance;
13952
14257
  const inFlight = inFlightCache.get(key);
13953
14258
  if (inFlight) return inFlight;
13954
- const pending = instantiateWasm(source2, opts.imports, key, generation).then((instance) => {
14259
+ const pending2 = instantiateWasm(source2, opts.imports, key, generation).then((instance) => {
13955
14260
  if (isCurrentGeneration(generation)) instanceCache.set(key, instance);
13956
14261
  return instance;
13957
14262
  });
13958
- inFlightCache.set(key, pending);
13959
- void pending.catch(() => {
14263
+ inFlightCache.set(key, pending2);
14264
+ void pending2.catch(() => {
13960
14265
  }).then(() => {
13961
- if (inFlightCache.get(key) === pending) inFlightCache.delete(key);
14266
+ if (inFlightCache.get(key) === pending2) inFlightCache.delete(key);
13962
14267
  });
13963
- return pending;
14268
+ return pending2;
13964
14269
  }
13965
14270
  async function instantiateWasm(source2, wasmImports, key, generation) {
13966
14271
  const cachedModule = key ? moduleCache.get(key) : void 0;
@@ -14137,7 +14442,7 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
14137
14442
  const active = document.activeElement;
14138
14443
  if (active === snapshot.el) return;
14139
14444
  if (active && active !== document.body && active !== document.documentElement) return;
14140
- if (snapshot.el.isConnected) {
14445
+ if (snapshot.el.isConnected && !snapshot.el.closest("[inert]")) {
14141
14446
  refocus(snapshot.el, snapshot);
14142
14447
  return;
14143
14448
  }
@@ -14164,8 +14469,25 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
14164
14469
  });
14165
14470
  }
14166
14471
 
14472
+ // src/core/rendering/range.ts
14473
+ var state4 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.ranges.v1"), () => ({
14474
+ ends: /* @__PURE__ */ new WeakMap(),
14475
+ pending: /* @__PURE__ */ new WeakMap(),
14476
+ registrations: /* @__PURE__ */ new Set(),
14477
+ listeners: /* @__PURE__ */ new Set(),
14478
+ notice: { queued: false, batch: [] }
14479
+ }));
14480
+ var ends = state4.ends;
14481
+ function registerRange(start, last) {
14482
+ ends.set(start, last);
14483
+ }
14484
+ var pending = state4.pending;
14485
+ var registrations = state4.registrations;
14486
+ var loadListeners = state4.listeners;
14487
+ var notice = state4.notice;
14488
+
14167
14489
  // src/reactivity/bindChildNode.ts
14168
- function bindChildNode(placeholder, getter) {
14490
+ function bindChildNode(placeholder, getter, exposeNodes) {
14169
14491
  let lastNodes = [];
14170
14492
  const scope = captureScope();
14171
14493
  function commit() {
@@ -14236,6 +14558,12 @@ function bindChildNode(placeholder, getter) {
14236
14558
  lastNodes = newNodes;
14237
14559
  restoreFocusWithin(focused, newNodes, "bindChildNode");
14238
14560
  }
14561
+ if (exposeNodes) {
14562
+ registerRange(placeholder, () => {
14563
+ for (let i2 = lastNodes.length - 1; i2 >= 0; i2--) if (lastNodes[i2].parentNode !== null) return lastNodes[i2];
14564
+ return null;
14565
+ });
14566
+ }
14239
14567
  return reactiveBinding2(commit, placeholder, true);
14240
14568
  }
14241
14569
 
@@ -14264,14 +14592,6 @@ var CLOBBER_RISKY_IDS = /* @__PURE__ */ new Set([
14264
14592
  var warnedLoneStrings = /* @__PURE__ */ new Set();
14265
14593
  var MAX_WARNED_LONE_STRINGS = 100;
14266
14594
  var loneStringCapAnnounced = false;
14267
- var kebabCache = /* @__PURE__ */ new Map();
14268
- function toKebab2(prop) {
14269
- let cached = kebabCache.get(prop);
14270
- if (cached !== void 0) return cached;
14271
- cached = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
14272
- kebabCache.set(prop, cached);
14273
- return cached;
14274
- }
14275
14595
  function applyStyle(el, style2) {
14276
14596
  if (typeof style2 === "function") {
14277
14597
  const getter = style2;
@@ -14295,7 +14615,7 @@ function applyStyle(el, style2) {
14295
14615
  if (!Object.hasOwn(value, prop)) continue;
14296
14616
  const val = value[prop];
14297
14617
  if (val == null) continue;
14298
- const name = toKebab2(prop);
14618
+ const name = styleKeyToProperty(prop);
14299
14619
  next.push(name);
14300
14620
  decl.setProperty(name, sanitizeCSSDeclaration(name, String(val), { element: el }));
14301
14621
  }
@@ -14315,7 +14635,7 @@ function applyStyle(el, style2) {
14315
14635
  for (const prop in style2) {
14316
14636
  if (!Object.hasOwn(style2, prop)) continue;
14317
14637
  const val = style2[prop];
14318
- const name = toKebab2(prop);
14638
+ const name = styleKeyToProperty(prop);
14319
14639
  if (typeof val === "function") {
14320
14640
  const getter = val;
14321
14641
  const teardown = reactiveBinding2(() => {
@@ -15134,8 +15454,8 @@ function scrollRestoration(options) {
15134
15454
  nativeModeLease = acquireScrollRestorationMode("manual");
15135
15455
  if (currentKey !== null) tagCurrentEntry(currentKey);
15136
15456
  popstateHandler = (event) => {
15137
- const state3 = event.state ?? null;
15138
- const rawDestination = state3 ? state3[stateKey] : void 0;
15457
+ const state5 = event.state ?? null;
15458
+ const rawDestination = state5 ? state5[stateKey] : void 0;
15139
15459
  const destination = typeof rawDestination === "string" ? rawDestination : null;
15140
15460
  let outgoing = currentKey;
15141
15461
  if (outgoing === null && options?.getKey) {
@@ -15291,18 +15611,18 @@ function createPluginRegistry() {
15291
15611
  return true;
15292
15612
  };
15293
15613
  installStack.add(p2.name);
15294
- let pending;
15614
+ let pending2;
15295
15615
  try {
15296
- pending = adoptThenable(p2.install(ctx, options));
15616
+ pending2 = adoptThenable(p2.install(ctx, options));
15297
15617
  } finally {
15298
15618
  installStack.delete(p2.name);
15299
15619
  }
15300
- if (!pending) {
15620
+ if (!pending2) {
15301
15621
  if (!commit()) throw new PluginInstallCancelledError(p2.name);
15302
15622
  return;
15303
15623
  }
15304
15624
  if (myGeneration === generation) pendingInstalls.set(p2.name, myGeneration);
15305
- const settled = pending.then(
15625
+ const settled = pending2.then(
15306
15626
  () => {
15307
15627
  if (commit()) return;
15308
15628
  if (pendingInstalls.get(p2.name) === myGeneration) pendingInstalls.delete(p2.name);
@@ -15485,16 +15805,16 @@ function createModuleRegistry() {
15485
15805
  };
15486
15806
  }
15487
15807
  function createBundle(modules) {
15488
- const cache = /* @__PURE__ */ new Map();
15808
+ const cache2 = /* @__PURE__ */ new Map();
15489
15809
  const bundle = {};
15490
15810
  for (const key of Object.keys(modules)) {
15491
15811
  Object.defineProperty(bundle, key, {
15492
15812
  get() {
15493
- if (cache.has(key)) {
15494
- return cache.get(key);
15813
+ if (cache2.has(key)) {
15814
+ return cache2.get(key);
15495
15815
  }
15496
15816
  const value = modules[key]();
15497
- cache.set(key, value);
15817
+ cache2.set(key, value);
15498
15818
  return value;
15499
15819
  },
15500
15820
  enumerable: true,
@@ -15563,7 +15883,7 @@ var CDN_ENTRY_POINTS = {
15563
15883
  };
15564
15884
  var packageInfo = {
15565
15885
  name: "sibujs",
15566
- version: true ? "4.14.0" : "dev",
15886
+ version: true ? "4.15.0" : "dev",
15567
15887
  entryPoints: MODULE_ENTRY_POINTS,
15568
15888
  /**
15569
15889
  * Generate the package.json `exports` map. Module entries resolve to the
@@ -15708,7 +16028,7 @@ var env = {
15708
16028
  };
15709
16029
 
15710
16030
  // src/plugins/versioning.ts
15711
- var VERSION = true ? "4.14.0" : "dev";
16031
+ var VERSION = true ? "4.15.0" : "dev";
15712
16032
  var NUM = "(?:0|[1-9]\\d*)";
15713
16033
  var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
15714
16034
  var BUILD_ID = "[0-9a-zA-Z-]+";
@@ -15893,9 +16213,9 @@ function createMigrationRunner(config) {
15893
16213
  return serialize(async () => {
15894
16214
  const applied = [];
15895
16215
  const errors = [];
15896
- let pending;
16216
+ let pending2;
15897
16217
  try {
15898
- pending = getPending();
16218
+ pending2 = getPending();
15899
16219
  } catch (e) {
15900
16220
  errors.push({
15901
16221
  version: getAppliedVersion() ?? "",
@@ -15903,7 +16223,7 @@ function createMigrationRunner(config) {
15903
16223
  });
15904
16224
  return { applied, errors };
15905
16225
  }
15906
- for (const migration of pending) {
16226
+ for (const migration of pending2) {
15907
16227
  try {
15908
16228
  await migration.up();
15909
16229
  } catch (e) {
@@ -16014,24 +16334,24 @@ function assertCacheSize(name, value) {
16014
16334
  throw new RangeError(`[Startup] ${name} must be a non-negative integer, got ${value}`);
16015
16335
  }
16016
16336
  }
16017
- function makeRoomFor(cache, key, maxSize, isValid) {
16337
+ function makeRoomFor(cache2, key, maxSize, isValid) {
16018
16338
  if (maxSize === 0) return false;
16019
- if (cache.has(key)) return true;
16020
- if (cache.size < maxSize) return true;
16021
- for (const [k, entry] of cache) {
16022
- if (!isValid(entry)) cache.delete(k);
16339
+ if (cache2.has(key)) return true;
16340
+ if (cache2.size < maxSize) return true;
16341
+ for (const [k, entry] of cache2) {
16342
+ if (!isValid(entry)) cache2.delete(k);
16023
16343
  }
16024
- while (cache.size >= maxSize) {
16344
+ while (cache2.size >= maxSize) {
16025
16345
  let oldestKey = null;
16026
16346
  let oldestTime = Infinity;
16027
- for (const [k, entry] of cache) {
16347
+ for (const [k, entry] of cache2) {
16028
16348
  if (entry.timestamp < oldestTime) {
16029
16349
  oldestTime = entry.timestamp;
16030
16350
  oldestKey = k;
16031
16351
  }
16032
16352
  }
16033
16353
  if (oldestKey === null) break;
16034
- cache.delete(oldestKey);
16354
+ cache2.delete(oldestKey);
16035
16355
  }
16036
16356
  return true;
16037
16357
  }
@@ -16039,57 +16359,57 @@ function prerenderRoutes(routes, options) {
16039
16359
  const maxCacheSize = options?.maxCacheSize ?? 50;
16040
16360
  const cacheTTL = options?.cacheTTL ?? 0;
16041
16361
  assertCacheSize("maxCacheSize", maxCacheSize);
16042
- const cache = /* @__PURE__ */ new Map();
16362
+ const cache2 = /* @__PURE__ */ new Map();
16043
16363
  function isValid(entry) {
16044
16364
  if (cacheTTL === 0) return true;
16045
16365
  return Date.now() - entry.timestamp < cacheTTL;
16046
16366
  }
16047
16367
  for (const route of routes) {
16048
- if (!makeRoomFor(cache, route.path, maxCacheSize, isValid)) break;
16368
+ if (!makeRoomFor(cache2, route.path, maxCacheSize, isValid)) break;
16049
16369
  const html2 = renderToString(route.component());
16050
- cache.set(route.path, { html: html2, timestamp: Date.now() });
16370
+ cache2.set(route.path, { html: html2, timestamp: Date.now() });
16051
16371
  }
16052
16372
  return {
16053
16373
  /** Get cached HTML for a route, or undefined if not cached or expired */
16054
16374
  get(path2) {
16055
- const entry = cache.get(path2);
16375
+ const entry = cache2.get(path2);
16056
16376
  if (!entry) return void 0;
16057
16377
  if (!isValid(entry)) {
16058
- cache.delete(path2);
16378
+ cache2.delete(path2);
16059
16379
  return void 0;
16060
16380
  }
16061
16381
  return entry.html;
16062
16382
  },
16063
16383
  /** Check if a route has been prerendered and is still valid */
16064
16384
  has(path2) {
16065
- const entry = cache.get(path2);
16385
+ const entry = cache2.get(path2);
16066
16386
  if (!entry) return false;
16067
16387
  if (!isValid(entry)) {
16068
- cache.delete(path2);
16388
+ cache2.delete(path2);
16069
16389
  return false;
16070
16390
  }
16071
16391
  return true;
16072
16392
  },
16073
16393
  /** Invalidate a cached route */
16074
16394
  invalidate(path2) {
16075
- cache.delete(path2);
16395
+ cache2.delete(path2);
16076
16396
  },
16077
16397
  /** Clear all cached routes */
16078
16398
  clear() {
16079
- cache.clear();
16399
+ cache2.clear();
16080
16400
  },
16081
16401
  /** Get cache statistics */
16082
16402
  stats() {
16083
16403
  if (cacheTTL > 0) {
16084
- for (const [key, entry] of cache) {
16404
+ for (const [key, entry] of cache2) {
16085
16405
  if (!isValid(entry)) {
16086
- cache.delete(key);
16406
+ cache2.delete(key);
16087
16407
  }
16088
16408
  }
16089
16409
  }
16090
16410
  return {
16091
- size: cache.size,
16092
- routes: Array.from(cache.keys())
16411
+ size: cache2.size,
16412
+ routes: Array.from(cache2.keys())
16093
16413
  };
16094
16414
  }
16095
16415
  };
@@ -16098,7 +16418,7 @@ function createSSRCache(config) {
16098
16418
  const maxSize = config?.maxSize ?? 100;
16099
16419
  const defaultTTL = config?.defaultTTL ?? 6e4;
16100
16420
  assertCacheSize("maxSize", maxSize);
16101
- const cache = /* @__PURE__ */ new Map();
16421
+ const cache2 = /* @__PURE__ */ new Map();
16102
16422
  let hits = 0;
16103
16423
  let misses = 0;
16104
16424
  function isValid(entry) {
@@ -16108,13 +16428,13 @@ function createSSRCache(config) {
16108
16428
  return {
16109
16429
  /** Get cached HTML for a key, or undefined if not cached or expired */
16110
16430
  get(key) {
16111
- const entry = cache.get(key);
16431
+ const entry = cache2.get(key);
16112
16432
  if (!entry) {
16113
16433
  misses++;
16114
16434
  return void 0;
16115
16435
  }
16116
16436
  if (!isValid(entry)) {
16117
- cache.delete(key);
16437
+ cache2.delete(key);
16118
16438
  misses++;
16119
16439
  return void 0;
16120
16440
  }
@@ -16123,8 +16443,8 @@ function createSSRCache(config) {
16123
16443
  },
16124
16444
  /** Cache an HTML string with an optional TTL override */
16125
16445
  set(key, html2, ttl) {
16126
- if (!makeRoomFor(cache, key, maxSize, isValid)) return;
16127
- cache.set(key, {
16446
+ if (!makeRoomFor(cache2, key, maxSize, isValid)) return;
16447
+ cache2.set(key, {
16128
16448
  html: html2,
16129
16449
  timestamp: Date.now(),
16130
16450
  ttl: ttl ?? defaultTTL
@@ -16132,27 +16452,27 @@ function createSSRCache(config) {
16132
16452
  },
16133
16453
  /** Check if a key exists in the cache and is still valid */
16134
16454
  has(key) {
16135
- const entry = cache.get(key);
16455
+ const entry = cache2.get(key);
16136
16456
  if (!entry) return false;
16137
16457
  if (!isValid(entry)) {
16138
- cache.delete(key);
16458
+ cache2.delete(key);
16139
16459
  return false;
16140
16460
  }
16141
16461
  return true;
16142
16462
  },
16143
16463
  /** Invalidate a cached entry */
16144
16464
  invalidate(key) {
16145
- cache.delete(key);
16465
+ cache2.delete(key);
16146
16466
  },
16147
16467
  /** Clear all cached entries and reset statistics */
16148
16468
  clear() {
16149
- cache.clear();
16469
+ cache2.clear();
16150
16470
  hits = 0;
16151
16471
  misses = 0;
16152
16472
  },
16153
16473
  /** Get cache statistics including hit/miss counts */
16154
16474
  stats() {
16155
- return { size: cache.size, hits, misses };
16475
+ return { size: cache2.size, hits, misses };
16156
16476
  }
16157
16477
  };
16158
16478
  }
@@ -16565,8 +16885,8 @@ function initDevTools(config) {
16565
16885
  function clearEvents() {
16566
16886
  eventLog.length = 0;
16567
16887
  }
16568
- function registerComponent(name, element, state3) {
16569
- hook.components.set(name, { element, state: state3 });
16888
+ function registerComponent(name, element, state5) {
16889
+ hook.components.set(name, { element, state: state5 });
16570
16890
  emit();
16571
16891
  }
16572
16892
  function unregisterComponent(name) {
@@ -19010,9 +19330,9 @@ function zustandAdapter(options) {
19010
19330
  return createPlugin("sibu-zustand", (ctx) => {
19011
19331
  const { store } = options;
19012
19332
  const [getState, setSibuState] = signal(store.getState());
19013
- const unsubscribe = store.subscribe((state3) => {
19333
+ const unsubscribe = store.subscribe((state5) => {
19014
19334
  batch(() => {
19015
- setSibuState(state3);
19335
+ setSibuState(state5);
19016
19336
  });
19017
19337
  });
19018
19338
  function select3(selector) {