@solidjs/signals 2.0.0-beta.10 → 2.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/dev.js +777 -397
  2. package/dist/node.cjs +1862 -1540
  3. package/dist/prod.js +1555 -1222
  4. package/dist/types/boundaries.d.ts +2 -2
  5. package/dist/types/core/constants.d.ts +8 -6
  6. package/dist/types/core/core.d.ts +29 -8
  7. package/dist/types/core/dev.d.ts +1 -1
  8. package/dist/types/core/effect.d.ts +1 -0
  9. package/dist/types/core/graph.d.ts +1 -0
  10. package/dist/types/core/index.d.ts +1 -1
  11. package/dist/types/core/scheduler.d.ts +19 -3
  12. package/dist/types/core/types.d.ts +2 -0
  13. package/dist/types/index.d.ts +1 -1
  14. package/dist/types/map.d.ts +21 -5
  15. package/dist/types/signals.d.ts +25 -4
  16. package/dist/types/src/boundaries.d.ts +173 -0
  17. package/dist/types/src/core/action.d.ts +35 -0
  18. package/dist/types/src/core/async.d.ts +6 -0
  19. package/dist/types/src/core/constants.d.ts +51 -0
  20. package/dist/types/src/core/context.d.ts +36 -0
  21. package/dist/types/src/core/core.d.ts +174 -0
  22. package/dist/types/src/core/dev.d.ts +49 -0
  23. package/dist/types/src/core/effect.d.ts +32 -0
  24. package/dist/types/src/core/error.d.ts +38 -0
  25. package/dist/types/src/core/external.d.ts +45 -0
  26. package/dist/types/src/core/graph.d.ts +5 -0
  27. package/dist/types/src/core/heap.d.ts +14 -0
  28. package/dist/types/src/core/index.d.ts +12 -0
  29. package/dist/types/src/core/lanes.d.ts +54 -0
  30. package/dist/types/src/core/owner.d.ts +116 -0
  31. package/dist/types/src/core/scheduler.d.ts +122 -0
  32. package/dist/types/src/core/types.d.ts +85 -0
  33. package/dist/types/src/index.d.ts +9 -0
  34. package/dist/types/src/map.d.ts +53 -0
  35. package/dist/types/src/signals.d.ts +512 -0
  36. package/dist/types/src/store/index.d.ts +9 -0
  37. package/dist/types/src/store/optimistic.d.ts +45 -0
  38. package/dist/types/src/store/projection.d.ts +66 -0
  39. package/dist/types/src/store/reconcile.d.ts +23 -0
  40. package/dist/types/src/store/store.d.ts +125 -0
  41. package/dist/types/src/store/storePath.d.ts +58 -0
  42. package/dist/types/src/store/utils.d.ts +114 -0
  43. package/dist/types-cjs/boundaries.d.cts +2 -2
  44. package/dist/types-cjs/core/constants.d.cts +8 -6
  45. package/dist/types-cjs/core/core.d.cts +29 -8
  46. package/dist/types-cjs/core/dev.d.cts +1 -1
  47. package/dist/types-cjs/core/effect.d.cts +1 -0
  48. package/dist/types-cjs/core/graph.d.cts +1 -0
  49. package/dist/types-cjs/core/index.d.cts +1 -1
  50. package/dist/types-cjs/core/scheduler.d.cts +19 -3
  51. package/dist/types-cjs/core/types.d.cts +2 -0
  52. package/dist/types-cjs/index.d.cts +1 -1
  53. package/dist/types-cjs/map.d.cts +21 -5
  54. package/dist/types-cjs/signals.d.cts +25 -4
  55. package/dist/types-cjs/src/boundaries.d.cts +173 -0
  56. package/dist/types-cjs/src/core/action.d.cts +35 -0
  57. package/dist/types-cjs/src/core/async.d.cts +6 -0
  58. package/dist/types-cjs/src/core/constants.d.cts +51 -0
  59. package/dist/types-cjs/src/core/context.d.cts +36 -0
  60. package/dist/types-cjs/src/core/core.d.cts +174 -0
  61. package/dist/types-cjs/src/core/dev.d.cts +49 -0
  62. package/dist/types-cjs/src/core/effect.d.cts +32 -0
  63. package/dist/types-cjs/src/core/error.d.cts +38 -0
  64. package/dist/types-cjs/src/core/external.d.cts +45 -0
  65. package/dist/types-cjs/src/core/graph.d.cts +5 -0
  66. package/dist/types-cjs/src/core/heap.d.cts +14 -0
  67. package/dist/types-cjs/src/core/index.d.cts +12 -0
  68. package/dist/types-cjs/src/core/lanes.d.cts +54 -0
  69. package/dist/types-cjs/src/core/owner.d.cts +116 -0
  70. package/dist/types-cjs/src/core/scheduler.d.cts +122 -0
  71. package/dist/types-cjs/src/core/types.d.cts +85 -0
  72. package/dist/types-cjs/src/index.d.cts +9 -0
  73. package/dist/types-cjs/src/map.d.cts +53 -0
  74. package/dist/types-cjs/src/signals.d.cts +512 -0
  75. package/dist/types-cjs/src/store/index.d.cts +9 -0
  76. package/dist/types-cjs/src/store/optimistic.d.cts +45 -0
  77. package/dist/types-cjs/src/store/projection.d.cts +66 -0
  78. package/dist/types-cjs/src/store/reconcile.d.cts +23 -0
  79. package/dist/types-cjs/src/store/store.d.cts +125 -0
  80. package/dist/types-cjs/src/store/storePath.d.cts +58 -0
  81. package/dist/types-cjs/src/store/utils.d.cts +114 -0
  82. package/package.json +4 -4
package/dist/prod.js CHANGED
@@ -33,12 +33,14 @@ const REACTIVE_DISPOSED = 1 << 6;
33
33
  const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
34
34
  const REACTIVE_SNAPSHOT_STALE = 1 << 8;
35
35
  const REACTIVE_LAZY = 1 << 9;
36
+ const REACTIVE_MANUAL_WRITE = 1 << 10;
36
37
  const CONFIG_OWNED_WRITE = 1 << 0;
37
38
  const CONFIG_NO_SNAPSHOT = 1 << 1;
38
39
  const CONFIG_TRANSPARENT = 1 << 2;
39
40
  const CONFIG_IN_SNAPSHOT_SCOPE = 1 << 3;
40
41
  const CONFIG_CHILDREN_FORBIDDEN = 1 << 4;
41
42
  const CONFIG_AUTO_DISPOSE = 1 << 5;
43
+ const CONFIG_SYNC = 1 << 6;
42
44
  const STATUS_PENDING = 1 << 0;
43
45
  const STATUS_ERROR = 1 << 1;
44
46
  const STATUS_UNINITIALIZED = 1 << 2;
@@ -51,6 +53,16 @@ const STORE_SNAPSHOT_PROPS = "sp";
51
53
  const SUPPORTS_PROXY = typeof Proxy === "function";
52
54
  const defaultContext = {};
53
55
  const $REFRESH = Symbol("refresh");
56
+ const diagnosticListeners = new Set();
57
+ const diagnosticCaptures = new Set();
58
+ let diagnosticSequence = 0;
59
+ const DEV$1 = undefined;
60
+ function emitDiagnostic(e) {
61
+ const t = { sequence: ++diagnosticSequence, ...e };
62
+ for (const e of diagnosticListeners) e(t);
63
+ for (const e of diagnosticCaptures) e.push(t);
64
+ return t;
65
+ }
54
66
  function actualInsertIntoHeap(e, t) {
55
67
  const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
56
68
  if (n >= e.o) e.o = n + 1;
@@ -58,76 +70,80 @@ function actualInsertIntoHeap(e, t) {
58
70
  const r = t.l[i];
59
71
  if (r === undefined) t.l[i] = e;
60
72
  else {
61
- const t = r.T;
62
- t.S = e;
63
- e.T = t;
64
- r.T = e;
73
+ const t = r.S;
74
+ t.T = e;
75
+ e.S = t;
76
+ r.S = e;
65
77
  }
66
78
  if (i > t.O) t.O = i;
67
79
  }
68
80
  function insertIntoHeap(e, t) {
69
- let n = e.R;
70
- if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
81
+ let n = e._;
82
+ if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_MANUAL_WRITE)) return;
71
83
  if (n & REACTIVE_CHECK) {
72
- e.R = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
73
- } else e.R = n | REACTIVE_IN_HEAP;
84
+ e._ = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
85
+ } else e._ = n | REACTIVE_IN_HEAP;
74
86
  if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
75
87
  }
76
88
  function insertIntoHeapHeight(e, t) {
77
- let n = e.R;
78
- if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
79
- e.R = n | REACTIVE_IN_HEAP_HEIGHT;
89
+ let n = e._;
90
+ if (
91
+ n &
92
+ (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT | REACTIVE_MANUAL_WRITE)
93
+ )
94
+ return;
95
+ e._ = n | REACTIVE_IN_HEAP_HEIGHT;
80
96
  actualInsertIntoHeap(e, t);
81
97
  }
82
98
  function deleteFromHeap(e, t) {
83
- const n = e.R;
99
+ const n = e._;
84
100
  if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
85
- e.R = n & -25;
101
+ e._ = n & -25;
86
102
  const i = e.o;
87
- if (e.T === e) t.l[i] = undefined;
103
+ if (e.S === e) t.l[i] = undefined;
88
104
  else {
89
- const n = e.S;
105
+ const n = e.T;
90
106
  const r = t.l[i];
91
107
  const s = n ?? r;
92
108
  if (e === r) t.l[i] = n;
93
- else e.T.S = n;
94
- s.T = e.T;
109
+ else e.S.T = n;
110
+ s.S = e.S;
95
111
  }
96
- e.T = e;
97
- e.S = undefined;
112
+ e.S = e;
113
+ e.T = undefined;
98
114
  }
99
115
  function markHeap(e) {
100
- if (e._) return;
101
- e._ = true;
116
+ if (e.R) return;
117
+ e.R = true;
102
118
  for (let t = 0; t <= e.O; t++) {
103
- for (let n = e.l[t]; n !== undefined; n = n.S) {
104
- if (n.R & REACTIVE_IN_HEAP) markNode(n);
119
+ for (let n = e.l[t]; n !== undefined; n = n.T) {
120
+ if (n._ & REACTIVE_IN_HEAP) markNode(n);
105
121
  }
106
122
  }
107
123
  }
108
124
  function markNode(e, t = REACTIVE_DIRTY) {
109
- const n = e.R;
125
+ const n = e._;
110
126
  if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
111
- e.R = (n & -4) | t;
112
- for (let t = e.I; t !== null; t = t.h) {
113
- markNode(t.p, REACTIVE_CHECK);
127
+ e._ = (n & -4) | t;
128
+ for (let t = e.I; t !== null; t = t.p) {
129
+ markNode(t.h, REACTIVE_CHECK);
114
130
  }
115
131
  if (e.N !== null) {
116
132
  for (let t = e.N; t !== null; t = t.A) {
117
- for (let e = t.I; e !== null; e = e.h) {
118
- markNode(e.p, REACTIVE_CHECK);
133
+ for (let e = t.I; e !== null; e = e.p) {
134
+ markNode(e.h, REACTIVE_CHECK);
119
135
  }
120
136
  }
121
137
  }
122
138
  }
123
139
  function runHeap(e, t) {
124
- e._ = false;
125
- for (e.P = 0; e.P <= e.O; e.P++) {
126
- let n = e.l[e.P];
140
+ e.R = false;
141
+ for (e.C = 0; e.C <= e.O; e.C++) {
142
+ let n = e.l[e.C];
127
143
  while (n !== undefined) {
128
- if (n.R & REACTIVE_IN_HEAP) t(n);
144
+ if (n._ & REACTIVE_IN_HEAP) t(n);
129
145
  else adjustHeight(n, e);
130
- n = e.l[e.P];
146
+ n = e.l[e.C];
131
147
  }
132
148
  }
133
149
  e.O = 0;
@@ -135,31 +151,105 @@ function runHeap(e, t) {
135
151
  function adjustHeight(e, t) {
136
152
  deleteFromHeap(e, t);
137
153
  let n = e.o;
138
- for (let t = e.C; t; t = t.D) {
154
+ for (let t = e.P; t; t = t.D) {
139
155
  const e = t.m;
140
156
  const i = e.V || e;
141
157
  if (i.L && i.o >= n) n = i.o + 1;
142
158
  }
143
159
  if (e.o !== n) {
144
160
  e.o = n;
145
- for (let n = e.I; n !== null; n = n.h) {
146
- insertIntoHeapHeight(n.p, t);
161
+ for (let n = e.I; n !== null; n = n.p) {
162
+ insertIntoHeapHeight(n.h, t);
147
163
  }
148
164
  }
149
165
  }
150
- const DEV$1 = undefined;
166
+ const signalLanes = new WeakMap();
167
+ const activeLanes = new Set();
168
+ function getOrCreateLane(e) {
169
+ let t = signalLanes.get(e);
170
+ if (t) {
171
+ return findLane(t);
172
+ }
173
+ const n = e.U;
174
+ const i = n?.G ? findLane(n.G) : null;
175
+ t = { F: e, k: new Set(), W: [[], []], H: null, M: activeTransition, j: i };
176
+ signalLanes.set(e, t);
177
+ activeLanes.add(t);
178
+ e.$ = false;
179
+ return t;
180
+ }
181
+ function findLane(e) {
182
+ while (e.H) e = e.H;
183
+ return e;
184
+ }
185
+ function mergeLanes(e, t) {
186
+ e = findLane(e);
187
+ t = findLane(t);
188
+ if (e === t) return e;
189
+ t.H = e;
190
+ for (const n of t.k) e.k.add(n);
191
+ e.W[0].push(...t.W[0]);
192
+ e.W[1].push(...t.W[1]);
193
+ return e;
194
+ }
195
+ function resolveLane(e) {
196
+ const t = e.G;
197
+ if (!t) return undefined;
198
+ const n = findLane(t);
199
+ if (activeLanes.has(n)) return n;
200
+ e.G = undefined;
201
+ return undefined;
202
+ }
203
+ function resolveTransition(e) {
204
+ return resolveLane(e)?.M ?? e.M;
205
+ }
206
+ function hasActiveOverride(e) {
207
+ return !!(e.K !== undefined && e.K !== NOT_PENDING);
208
+ }
209
+ function assignOrMergeLane(e, t) {
210
+ const n = findLane(t);
211
+ const i = e.G;
212
+ if (i) {
213
+ if (i.H) {
214
+ e.G = t;
215
+ return;
216
+ }
217
+ const r = findLane(i);
218
+ if (activeLanes.has(r)) {
219
+ if (r !== n && !hasActiveOverride(e)) {
220
+ if (n.j && findLane(n.j) === r) {
221
+ e.G = t;
222
+ } else if (r.j && findLane(r.j) === n);
223
+ else mergeLanes(n, r);
224
+ }
225
+ return;
226
+ }
227
+ }
228
+ e.G = t;
229
+ }
151
230
  const transitions = new Set();
152
- const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
153
- const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
231
+ const dirtyQueue = { l: new Array(2e3).fill(undefined), R: false, C: 0, O: 0 };
232
+ const zombieQueue = { l: new Array(2e3).fill(undefined), R: false, C: 0, O: 0 };
154
233
  let clock = 0;
155
234
  let activeTransition = null;
156
235
  let scheduled = false;
236
+ let syncDepth = 0;
157
237
  let projectionWriteActive = false;
158
238
  let stashedOptimisticReads = null;
159
239
  const transientStoreNodes = new Set();
160
240
  function registerTransientStoreNode(e) {
161
241
  transientStoreNodes.add(e);
162
242
  }
243
+ function canUseSimpleSyncFlush(e) {
244
+ return (
245
+ transitions.size === 0 &&
246
+ activeLanes.size === 0 &&
247
+ e.Y.length === 0 &&
248
+ e.Z.length === 0 &&
249
+ e.q.size === 0 &&
250
+ transientStoreNodes.size === 0
251
+ );
252
+ }
163
253
  function sweepTransientStoreNodes() {
164
254
  if (transientStoreNodes.size === 0) return;
165
255
  for (const e of transientStoreNodes) {
@@ -167,10 +257,10 @@ function sweepTransientStoreNodes() {
167
257
  transientStoreNodes.delete(e);
168
258
  continue;
169
259
  }
170
- if (e.U !== NOT_PENDING) continue;
171
- if (e.G !== undefined && e.G !== NOT_PENDING) continue;
260
+ if (e.B !== NOT_PENDING) continue;
261
+ if (e.K !== undefined && e.K !== NOT_PENDING) continue;
172
262
  transientStoreNodes.delete(e);
173
- e.k?.();
263
+ e.X?.();
174
264
  }
175
265
  }
176
266
  function enforceLoadingBoundary(e) {}
@@ -179,27 +269,27 @@ function shouldReadStashedOptimisticValue(e) {
179
269
  }
180
270
  function runLaneEffects(e) {
181
271
  for (const t of activeLanes) {
182
- if (t.F || t.W.size > 0) continue;
183
- const n = t.H[e - 1];
272
+ if (t.H || t.k.size > 0) continue;
273
+ const n = t.W[e - 1];
184
274
  if (n.length) {
185
- t.H[e - 1] = [];
275
+ t.W[e - 1] = [];
186
276
  runQueue(n, e);
187
277
  }
188
278
  }
189
279
  }
190
280
  function queueStashedOptimisticEffects(e) {
191
- for (let t = e.I; t !== null; t = t.h) {
192
- const e = t.p;
193
- if (!e.M) continue;
194
- if (e.M === EFFECT_TRACKED) {
195
- if (!e.j) {
196
- e.j = true;
197
- e.$.enqueue(EFFECT_USER, e.K);
281
+ for (let t = e.I; t !== null; t = t.p) {
282
+ const e = t.h;
283
+ if (!e.J) continue;
284
+ if (e.J === EFFECT_TRACKED) {
285
+ if (!e.ee) {
286
+ e.ee = true;
287
+ e.te.enqueue(EFFECT_USER, e.ne);
198
288
  }
199
289
  continue;
200
290
  }
201
- const n = e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
202
- if (n.P > e.o) n.P = e.o;
291
+ const n = e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
292
+ if (n.C > e.o) n.C = e.o;
203
293
  insertIntoHeap(e, n);
204
294
  }
205
295
  }
@@ -207,67 +297,67 @@ function setProjectionWriteActive(e) {
207
297
  projectionWriteActive = e;
208
298
  }
209
299
  function mergeTransitionState(e, t) {
210
- t.Y = e;
211
- e.B.push(...t.B);
212
- for (const n of activeLanes) if (n.Z === t) n.Z = e;
213
- e.q.push(...t.q);
214
- for (const n of t.X) e.X.add(n);
215
- for (const [n, i] of t.J) {
216
- let t = e.J.get(n);
217
- if (!t) e.J.set(n, (t = new Set()));
300
+ t.ie = e;
301
+ e.re.push(...t.re);
302
+ for (const n of activeLanes) if (n.M === t) n.M = e;
303
+ e.Z.push(...t.Z);
304
+ for (const n of t.q) e.q.add(n);
305
+ for (const [n, i] of t.se) {
306
+ let t = e.se.get(n);
307
+ if (!t) e.se.set(n, (t = new Set()));
218
308
  for (const e of i) t.add(e);
219
309
  }
220
- for (const n of t.ee) e.ee.add(n);
310
+ for (const n of t.oe) e.oe.add(n);
221
311
  }
222
312
  function resolveOptimisticNodes(e) {
223
313
  for (let t = 0; t < e.length; t++) {
224
314
  const n = e[t];
225
- n.te = undefined;
226
- if (n.U !== NOT_PENDING) {
227
- n.ne = n.U;
228
- n.U = NOT_PENDING;
315
+ n.G = undefined;
316
+ if (n.B !== NOT_PENDING) {
317
+ n.ue = n.B;
318
+ n.B = NOT_PENDING;
229
319
  }
230
- const i = n.G;
231
- n.G = NOT_PENDING;
232
- if (i !== NOT_PENDING && n.ne !== i) insertSubs(n, true);
233
- n.Z = null;
320
+ const i = n.K;
321
+ n.K = NOT_PENDING;
322
+ if (i !== NOT_PENDING && n.ue !== i) insertSubs(n, true);
323
+ n.M = null;
234
324
  }
235
325
  e.length = 0;
236
326
  }
237
327
  function cleanupCompletedLanes(e) {
238
328
  for (const t of activeLanes) {
239
- const n = e ? t.Z === e : !t.Z;
329
+ const n = e ? t.M === e : !t.M;
240
330
  if (!n) continue;
241
- if (!t.F) {
242
- if (t.H[0].length) runQueue(t.H[0], EFFECT_RENDER);
243
- if (t.H[1].length) runQueue(t.H[1], EFFECT_USER);
244
- }
245
- if (t.ie.te === t) t.ie.te = undefined;
246
- t.W.clear();
247
- t.H[0].length = 0;
248
- t.H[1].length = 0;
331
+ if (!t.H) {
332
+ if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
333
+ if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
334
+ }
335
+ if (t.F.G === t) t.F.G = undefined;
336
+ t.k.clear();
337
+ t.W[0].length = 0;
338
+ t.W[1].length = 0;
249
339
  activeLanes.delete(t);
250
- signalLanes.delete(t.ie);
340
+ signalLanes.delete(t.F);
251
341
  }
252
342
  }
253
343
  function schedule() {
254
344
  if (scheduled) return;
255
345
  scheduled = true;
256
- if (!globalQueue.re && !projectionWriteActive) queueMicrotask(flush);
346
+ if (!syncDepth && !globalQueue.le && !projectionWriteActive) queueMicrotask(flush);
257
347
  }
258
348
  class Queue {
259
349
  i = null;
260
- se = [[], []];
261
- oe = [];
350
+ ce = [[], []];
351
+ Y = [];
262
352
  created = clock;
263
353
  addChild(e) {
264
- this.oe.push(e);
354
+ this.Y.push(e);
265
355
  e.i = this;
266
356
  }
267
357
  removeChild(e) {
268
- const t = this.oe.indexOf(e);
358
+ const t = this.Y.indexOf(e);
269
359
  if (t >= 0) {
270
- this.oe.splice(t, 1);
360
+ this.Y.splice(t, 1);
271
361
  e.i = null;
272
362
  }
273
363
  }
@@ -276,81 +366,84 @@ class Queue {
276
366
  return false;
277
367
  }
278
368
  run(e) {
279
- if (this.se[e - 1].length) {
280
- const t = this.se[e - 1];
281
- this.se[e - 1] = [];
369
+ if (this.ce[e - 1].length) {
370
+ const t = this.ce[e - 1];
371
+ this.ce[e - 1] = [];
282
372
  runQueue(t, e);
283
373
  }
284
- for (let t = 0; t < this.oe.length; t++) this.oe[t].run?.(e);
374
+ for (let t = 0; t < this.Y.length; t++) this.Y[t].run?.(e);
285
375
  }
286
376
  enqueue(e, t) {
287
377
  if (e) {
288
378
  if (currentOptimisticLane) {
289
379
  const n = findLane(currentOptimisticLane);
290
- n.H[e - 1].push(t);
380
+ n.W[e - 1].push(t);
291
381
  } else {
292
- this.se[e - 1].push(t);
382
+ this.ce[e - 1].push(t);
293
383
  }
294
384
  }
295
385
  schedule();
296
386
  }
297
387
  stashQueues(e) {
298
- e.se[0].push(...this.se[0]);
299
- e.se[1].push(...this.se[1]);
300
- this.se = [[], []];
301
- for (let t = 0; t < this.oe.length; t++) {
302
- let n = this.oe[t];
303
- let i = e.oe[t];
388
+ e.ce[0].push(...this.ce[0]);
389
+ e.ce[1].push(...this.ce[1]);
390
+ this.ce = [[], []];
391
+ for (let t = 0; t < this.Y.length; t++) {
392
+ let n = this.Y[t];
393
+ let i = e.Y[t];
304
394
  if (!i) {
305
- i = { se: [[], []], oe: [] };
306
- e.oe[t] = i;
395
+ i = { ce: [[], []], Y: [] };
396
+ e.Y[t] = i;
307
397
  }
308
398
  n.stashQueues(i);
309
399
  }
310
400
  }
311
401
  restoreQueues(e) {
312
- this.se[0].push(...e.se[0]);
313
- this.se[1].push(...e.se[1]);
314
- for (let t = 0; t < e.oe.length; t++) {
315
- const n = e.oe[t];
316
- let i = this.oe[t];
402
+ this.ce[0].push(...e.ce[0]);
403
+ this.ce[1].push(...e.ce[1]);
404
+ for (let t = 0; t < e.Y.length; t++) {
405
+ const n = e.Y[t];
406
+ let i = this.Y[t];
317
407
  if (i) i.restoreQueues(n);
318
408
  }
319
409
  }
320
410
  }
321
411
  class GlobalQueue extends Queue {
322
- re = false;
323
- ue = [];
324
- q = [];
325
- X = new Set();
326
- static ce;
327
- static ae;
328
- static le = null;
412
+ le = false;
413
+ ae = null;
414
+ fe = [];
415
+ Z = [];
416
+ q = new Set();
417
+ static Ee;
418
+ static Se;
419
+ static Te;
420
+ static de = null;
329
421
  flush() {
330
- if (this.re) return;
331
- this.re = true;
422
+ if (this.le) return;
423
+ this.le = true;
332
424
  try {
333
- runHeap(dirtyQueue, GlobalQueue.ce);
425
+ runHeap(dirtyQueue, GlobalQueue.Ee);
334
426
  if (activeTransition) {
335
427
  const e = transitionComplete(activeTransition);
336
428
  if (!e) {
337
429
  const e = activeTransition;
338
- runHeap(zombieQueue, GlobalQueue.ce);
339
- this.ue = [];
340
- this.q = [];
341
- this.X = new Set();
430
+ runHeap(zombieQueue, GlobalQueue.Ee);
431
+ this.ae = null;
432
+ this.fe = [];
433
+ this.Z = [];
434
+ this.q = new Set();
342
435
  runLaneEffects(EFFECT_RENDER);
343
436
  runLaneEffects(EFFECT_USER);
344
- this.stashQueues(e.fe);
437
+ this.stashQueues(e.Oe);
345
438
  clock++;
346
- scheduled = dirtyQueue.O >= dirtyQueue.P;
347
- reassignPendingTransition(e.ue);
439
+ scheduled = dirtyQueue.O >= dirtyQueue.C;
440
+ reassignPendingTransition(e.fe);
348
441
  activeTransition = null;
349
- if (!e.B.length && !e.J.size && e.q.length) {
442
+ if (!e.re.length && !e.se.size && e.Z.length) {
350
443
  stashedOptimisticReads = new Set();
351
- for (let t = 0; t < e.q.length; t++) {
352
- const n = e.q[t];
353
- if (n.L || n.Ee & CONFIG_OWNED_WRITE) continue;
444
+ for (let t = 0; t < e.Z.length; t++) {
445
+ const n = e.Z[t];
446
+ if (n.L || n._e & CONFIG_OWNED_WRITE) continue;
354
447
  stashedOptimisticReads.add(n);
355
448
  queueStashedOptimisticEffects(n);
356
449
  }
@@ -362,36 +455,44 @@ class GlobalQueue extends Queue {
362
455
  }
363
456
  return;
364
457
  }
365
- this.ue !== activeTransition.ue && this.ue.push(...activeTransition.ue);
366
- this.restoreQueues(activeTransition.fe);
458
+ this.fe !== activeTransition.fe && this.fe.push(...activeTransition.fe);
459
+ this.restoreQueues(activeTransition.Oe);
367
460
  transitions.delete(activeTransition);
368
461
  const t = activeTransition;
369
462
  activeTransition = null;
370
- reassignPendingTransition(this.ue);
463
+ reassignPendingTransition(this.fe);
371
464
  finalizePureQueue(t);
372
465
  } else {
373
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.ce);
374
- finalizePureQueue();
466
+ if (canUseSimpleSyncFlush(this)) {
467
+ commitPendingNodes();
468
+ if (dirtyQueue.O >= dirtyQueue.C) {
469
+ runHeap(dirtyQueue, GlobalQueue.Ee);
470
+ commitPendingNodes();
471
+ }
472
+ } else {
473
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.Ee);
474
+ finalizePureQueue();
475
+ }
375
476
  }
376
477
  clock++;
377
- scheduled = dirtyQueue.O >= dirtyQueue.P;
378
- runLaneEffects(EFFECT_RENDER);
478
+ scheduled = dirtyQueue.O >= dirtyQueue.C;
479
+ activeLanes.size && runLaneEffects(EFFECT_RENDER);
379
480
  this.run(EFFECT_RENDER);
380
- runLaneEffects(EFFECT_USER);
481
+ activeLanes.size && runLaneEffects(EFFECT_USER);
381
482
  this.run(EFFECT_USER);
382
483
  if (false);
383
484
  } finally {
384
- this.re = false;
485
+ this.le = false;
385
486
  }
386
487
  }
387
488
  notify(e, t, n, i) {
388
489
  if (t & STATUS_PENDING) {
389
490
  if (n & STATUS_PENDING) {
390
- const t = i !== undefined ? i : e.Te;
491
+ const t = i !== undefined ? i : e.Re;
391
492
  if (activeTransition && t) {
392
493
  const n = t.source;
393
- let i = activeTransition.J.get(n);
394
- if (!i) activeTransition.J.set(n, (i = new Set()));
494
+ let i = activeTransition.se.get(n);
495
+ if (!i) activeTransition.se.set(n, (i = new Set()));
395
496
  const r = i.size;
396
497
  i.add(e);
397
498
  if (i.size !== r) schedule();
@@ -404,18 +505,18 @@ class GlobalQueue extends Queue {
404
505
  initTransition(e) {
405
506
  if (e) e = currentTransition(e);
406
507
  if (e && e === activeTransition) return;
407
- if (!e && activeTransition && activeTransition.Se === clock) return;
508
+ if (!e && activeTransition && activeTransition.Ie === clock) return;
408
509
  if (!activeTransition) {
409
510
  activeTransition = e ?? {
410
- Se: clock,
411
- ue: [],
412
- J: new Map(),
413
- q: [],
414
- X: new Set(),
415
- B: [],
416
- fe: { se: [[], []], oe: [] },
417
- Y: false,
418
- ee: new Set()
511
+ Ie: clock,
512
+ fe: [],
513
+ se: new Map(),
514
+ Z: [],
515
+ q: new Set(),
516
+ re: [],
517
+ Oe: { ce: [[], []], Y: [] },
518
+ ie: false,
519
+ oe: new Set()
419
520
  };
420
521
  } else if (e) {
421
522
  const t = activeTransition;
@@ -424,102 +525,138 @@ class GlobalQueue extends Queue {
424
525
  activeTransition = e;
425
526
  }
426
527
  transitions.add(activeTransition);
427
- activeTransition.Se = clock;
428
- if (this.ue !== activeTransition.ue) {
429
- for (let e = 0; e < this.ue.length; e++) {
430
- const t = this.ue[e];
431
- t.Z = activeTransition;
432
- activeTransition.ue.push(t);
528
+ activeTransition.Ie = clock;
529
+ if (this.ae !== null) {
530
+ this.ae.M = activeTransition;
531
+ activeTransition.fe.push(this.ae);
532
+ this.ae = null;
533
+ }
534
+ if (this.fe !== activeTransition.fe) {
535
+ for (let e = 0; e < this.fe.length; e++) {
536
+ const t = this.fe[e];
537
+ t.M = activeTransition;
538
+ activeTransition.fe.push(t);
433
539
  }
434
- this.ue = activeTransition.ue;
540
+ this.fe = activeTransition.fe;
435
541
  }
436
- if (this.q !== activeTransition.q) {
437
- for (let e = 0; e < this.q.length; e++) {
438
- const t = this.q[e];
439
- t.Z = activeTransition;
440
- activeTransition.q.push(t);
542
+ if (this.Z !== activeTransition.Z) {
543
+ for (let e = 0; e < this.Z.length; e++) {
544
+ const t = this.Z[e];
545
+ t.M = activeTransition;
546
+ activeTransition.Z.push(t);
441
547
  }
442
- this.q = activeTransition.q;
548
+ this.Z = activeTransition.Z;
443
549
  }
444
550
  for (const e of activeLanes) {
445
- if (!e.Z) e.Z = activeTransition;
551
+ if (!e.M) e.M = activeTransition;
446
552
  }
447
- if (this.X !== activeTransition.X) {
448
- for (const e of this.X) activeTransition.X.add(e);
449
- this.X = activeTransition.X;
553
+ if (this.q !== activeTransition.q) {
554
+ for (const e of this.q) activeTransition.q.add(e);
555
+ this.q = activeTransition.q;
450
556
  }
451
557
  }
452
558
  }
559
+ function queuePendingNode(e) {
560
+ if (activeTransition) {
561
+ globalQueue.fe.push(e);
562
+ return;
563
+ }
564
+ if (globalQueue.ae === null && globalQueue.fe.length === 0) {
565
+ globalQueue.ae = e;
566
+ return;
567
+ }
568
+ if (globalQueue.ae !== null) {
569
+ globalQueue.fe.push(globalQueue.ae);
570
+ globalQueue.ae = null;
571
+ }
572
+ globalQueue.fe.push(e);
573
+ }
453
574
  function insertSubs(e, t = false) {
454
- const n = e.te || currentOptimisticLane;
455
- const i = e.de !== undefined;
456
- for (let r = e.I; r !== null; r = r.h) {
457
- if (i && r.p.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
458
- r.p.R |= REACTIVE_SNAPSHOT_STALE;
575
+ const n = e.G || currentOptimisticLane;
576
+ const i = e.pe !== undefined;
577
+ for (let r = e.I; r !== null; r = r.p) {
578
+ if (i && r.h._e & CONFIG_IN_SNAPSHOT_SCOPE) {
579
+ r.h._ |= REACTIVE_SNAPSHOT_STALE;
459
580
  continue;
460
581
  }
461
582
  if (t && n) {
462
- r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
463
- assignOrMergeLane(r.p, n);
583
+ r.h._ |= REACTIVE_OPTIMISTIC_DIRTY;
584
+ assignOrMergeLane(r.h, n);
464
585
  } else if (t) {
465
- r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
466
- r.p.te = undefined;
586
+ r.h._ |= REACTIVE_OPTIMISTIC_DIRTY;
587
+ r.h.G = undefined;
467
588
  }
468
- const e = r.p;
469
- if (e.M === EFFECT_TRACKED) {
470
- if (!e.j) {
471
- e.j = true;
472
- e.$.enqueue(EFFECT_USER, e.K);
589
+ const e = r.h;
590
+ if (e.J === EFFECT_TRACKED) {
591
+ if (!e.ee) {
592
+ e.ee = true;
593
+ e.te.enqueue(EFFECT_USER, e.ne);
473
594
  }
474
595
  continue;
475
596
  }
476
- const s = r.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
477
- if (s.P > r.p.o) s.P = r.p.o;
478
- insertIntoHeap(r.p, s);
597
+ const s = r.h._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
598
+ if (s.C > r.h.o) s.C = r.h.o;
599
+ insertIntoHeap(r.h, s);
479
600
  }
480
601
  }
602
+ function commitPendingNode(e) {
603
+ const t = e;
604
+ if (!t.L) {
605
+ if (e.B !== NOT_PENDING) {
606
+ e.ue = e.B;
607
+ e.B = NOT_PENDING;
608
+ }
609
+ return;
610
+ }
611
+ if (e.B !== NOT_PENDING) {
612
+ e.ue = e.B;
613
+ e.B = NOT_PENDING;
614
+ if (e.J && e.J !== EFFECT_TRACKED) e.ee = true;
615
+ }
616
+ t._ &= ~REACTIVE_MANUAL_WRITE;
617
+ if (!(t.he & STATUS_PENDING)) t.he &= ~STATUS_UNINITIALIZED;
618
+ if (t.Ne !== null || t.Ae !== null) GlobalQueue.Se(t, false, true);
619
+ }
481
620
  function commitPendingNodes() {
482
- const e = globalQueue.ue;
621
+ if (globalQueue.ae !== null) {
622
+ commitPendingNode(globalQueue.ae);
623
+ globalQueue.ae = null;
624
+ }
625
+ const e = globalQueue.fe;
483
626
  for (let t = 0; t < e.length; t++) {
484
- const n = e[t];
485
- if (n.U !== NOT_PENDING) {
486
- n.ne = n.U;
487
- n.U = NOT_PENDING;
488
- if (n.M && n.M !== EFFECT_TRACKED) n.j = true;
489
- }
490
- if (!(n.Oe & STATUS_PENDING)) n.Oe &= ~STATUS_UNINITIALIZED;
491
- if (n.L) GlobalQueue.ae(n, false, true);
627
+ commitPendingNode(e[t]);
492
628
  }
493
629
  e.length = 0;
494
630
  }
495
631
  function finalizePureQueue(e = null, t = false) {
496
632
  const n = !t;
497
633
  if (n) commitPendingNodes();
498
- if (!t) checkBoundaryChildren(globalQueue);
499
- if (dirtyQueue.O >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.ce);
634
+ if (!t && globalQueue.Y.length) checkBoundaryChildren(globalQueue);
635
+ const i = dirtyQueue.O >= dirtyQueue.C;
636
+ if (i) runHeap(dirtyQueue, GlobalQueue.Ee);
500
637
  if (n) {
501
- commitPendingNodes();
502
- resolveOptimisticNodes(e ? e.q : globalQueue.q);
503
- if (e && e.ee.size) {
504
- for (const t of e.ee) {
505
- if (t.R & REACTIVE_DISPOSED) continue;
506
- if (t.M === EFFECT_TRACKED) {
507
- if (!t.j) {
508
- t.j = true;
509
- t.$.enqueue(EFFECT_USER, t.K);
638
+ if (i) commitPendingNodes();
639
+ resolveOptimisticNodes(e ? e.Z : globalQueue.Z);
640
+ if (e && e.oe.size) {
641
+ for (const t of e.oe) {
642
+ if (t._ & REACTIVE_DISPOSED) continue;
643
+ if (t.J === EFFECT_TRACKED) {
644
+ if (!t.ee) {
645
+ t.ee = true;
646
+ t.te.enqueue(EFFECT_USER, t.ne);
510
647
  }
511
648
  continue;
512
649
  }
513
- const e = t.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
514
- if (e.P > t.o) e.P = t.o;
650
+ const e = t._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
651
+ if (e.C > t.o) e.C = t.o;
515
652
  insertIntoHeap(t, e);
516
653
  }
517
- e.ee.clear();
654
+ e.oe.clear();
518
655
  }
519
- const t = e ? e.X : globalQueue.X;
520
- if (GlobalQueue.le && t.size) {
656
+ const t = e ? e.q : globalQueue.q;
657
+ if (GlobalQueue.de && t.size) {
521
658
  for (const e of t) {
522
- GlobalQueue.le(e);
659
+ GlobalQueue.de(e);
523
660
  }
524
661
  t.clear();
525
662
  schedule();
@@ -529,23 +666,32 @@ function finalizePureQueue(e = null, t = false) {
529
666
  }
530
667
  }
531
668
  function checkBoundaryChildren(e) {
532
- for (const t of e.oe) {
669
+ for (const t of e.Y) {
533
670
  t.checkSources?.();
534
671
  checkBoundaryChildren(t);
535
672
  }
536
673
  }
537
674
  function trackOptimisticStore(e) {
538
- globalQueue.X.add(e);
675
+ globalQueue.q.add(e);
539
676
  schedule();
540
677
  }
541
678
  function reassignPendingTransition(e) {
542
679
  for (let t = 0; t < e.length; t++) {
543
- e[t].Z = activeTransition;
680
+ e[t].M = activeTransition;
544
681
  }
545
682
  }
546
683
  const globalQueue = new GlobalQueue();
547
- function flush() {
548
- if (globalQueue.re) {
684
+ function flush(e) {
685
+ if (e) {
686
+ syncDepth++;
687
+ try {
688
+ return e();
689
+ } finally {
690
+ flush();
691
+ syncDepth--;
692
+ }
693
+ }
694
+ if (globalQueue.le) {
549
695
  return;
550
696
  }
551
697
  while (scheduled || activeTransition) {
@@ -556,22 +702,22 @@ function runQueue(e, t) {
556
702
  for (let n = 0; n < e.length; n++) e[n](t);
557
703
  }
558
704
  function reporterBlocksSource(e, t) {
559
- if (e.R & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
560
- if (e.Re === t || e._e?.has(t)) return true;
561
- for (let n = e.C; n; n = n.D) {
705
+ if (e._ & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
706
+ if (e.Ce === t || e.Pe?.has(t)) return true;
707
+ for (let n = e.P; n; n = n.D) {
562
708
  let e = n.m;
563
709
  while (e) {
564
710
  if (e === t || e.V === t) return true;
565
- e = e.Ie;
711
+ e = e.U;
566
712
  }
567
713
  }
568
- return !!(e.Oe & STATUS_PENDING && e.Te instanceof NotReadyError && e.Te.source === t);
714
+ return !!(e.he & STATUS_PENDING && e.Re instanceof NotReadyError && e.Re.source === t);
569
715
  }
570
716
  function transitionComplete(e) {
571
- if (e.Y) return true;
572
- if (e.B.length) return false;
717
+ if (e.ie) return true;
718
+ if (e.re.length) return false;
573
719
  let t = true;
574
- for (const [n, i] of e.J) {
720
+ for (const [n, i] of e.se) {
575
721
  let r = false;
576
722
  for (const e of i) {
577
723
  if (reporterBlocksSource(e, n)) {
@@ -580,32 +726,32 @@ function transitionComplete(e) {
580
726
  }
581
727
  i.delete(e);
582
728
  }
583
- if (!r) e.J.delete(n);
584
- else if (n.Oe & STATUS_PENDING && n.Te?.source === n) {
729
+ if (!r) e.se.delete(n);
730
+ else if (n.he & STATUS_PENDING && n.Re?.source === n) {
585
731
  t = false;
586
732
  break;
587
733
  }
588
734
  }
589
735
  if (t) {
590
- for (let n = 0; n < e.q.length; n++) {
591
- const i = e.q[n];
736
+ for (let n = 0; n < e.Z.length; n++) {
737
+ const i = e.Z[n];
592
738
  if (
593
739
  hasActiveOverride(i) &&
594
- "Oe" in i &&
595
- i.Oe & STATUS_PENDING &&
596
- i.Te instanceof NotReadyError &&
597
- i.Te.source !== i
740
+ "he" in i &&
741
+ i.he & STATUS_PENDING &&
742
+ i.Re instanceof NotReadyError &&
743
+ i.Re.source !== i
598
744
  ) {
599
745
  t = false;
600
746
  break;
601
747
  }
602
748
  }
603
749
  }
604
- t && (e.Y = true);
750
+ t && (e.ie = true);
605
751
  return t;
606
752
  }
607
753
  function currentTransition(e) {
608
- while (e.Y && typeof e.Y === "object") e = e.Y;
754
+ while (e.ie && typeof e.ie === "object") e = e.ie;
609
755
  return e;
610
756
  }
611
757
  function setActiveTransition(e) {
@@ -620,182 +766,67 @@ function runInTransition(e, t) {
620
766
  activeTransition = n;
621
767
  }
622
768
  }
623
- const signalLanes = new WeakMap();
624
- const activeLanes = new Set();
625
- function getOrCreateLane(e) {
626
- let t = signalLanes.get(e);
627
- if (t) {
628
- return findLane(t);
629
- }
630
- const n = e.Ie;
631
- const i = n?.te ? findLane(n.te) : null;
632
- t = { ie: e, W: new Set(), H: [[], []], F: null, Z: activeTransition, he: i };
633
- signalLanes.set(e, t);
634
- activeLanes.add(t);
635
- e.pe = false;
636
- return t;
637
- }
638
- function findLane(e) {
639
- while (e.F) e = e.F;
640
- return e;
641
- }
642
- function mergeLanes(e, t) {
643
- e = findLane(e);
644
- t = findLane(t);
645
- if (e === t) return e;
646
- t.F = e;
647
- for (const n of t.W) e.W.add(n);
648
- e.H[0].push(...t.H[0]);
649
- e.H[1].push(...t.H[1]);
650
- return e;
651
- }
652
- function resolveLane(e) {
653
- const t = e.te;
654
- if (!t) return undefined;
655
- const n = findLane(t);
656
- if (activeLanes.has(n)) return n;
657
- e.te = undefined;
658
- return undefined;
659
- }
660
- function resolveTransition(e) {
661
- return resolveLane(e)?.Z ?? e.Z;
662
- }
663
- function hasActiveOverride(e) {
664
- return !!(e.G !== undefined && e.G !== NOT_PENDING);
665
- }
666
- function assignOrMergeLane(e, t) {
667
- const n = findLane(t);
668
- const i = e.te;
669
- if (i) {
670
- if (i.F) {
671
- e.te = t;
672
- return;
673
- }
674
- const r = findLane(i);
675
- if (activeLanes.has(r)) {
676
- if (r !== n && !hasActiveOverride(e)) {
677
- if (n.he && findLane(n.he) === r) {
678
- e.te = t;
679
- } else if (r.he && findLane(r.he) === n);
680
- else mergeLanes(n, r);
681
- }
682
- return;
683
- }
684
- }
685
- e.te = t;
686
- }
687
- function unlinkSubs(e) {
688
- const t = e.m;
689
- const n = e.D;
690
- const i = e.h;
691
- const r = e.Ne;
692
- if (i !== null) i.Ne = r;
693
- else t.Ae = r;
694
- if (r !== null) r.h = i;
695
- else {
696
- t.I = i;
697
- if (i === null) {
698
- t.k?.();
699
- const e = t;
700
- e.L && e.Ee & CONFIG_AUTO_DISPOSE && !(e.R & REACTIVE_ZOMBIE) && unobserved(e);
701
- }
702
- }
703
- return n;
704
- }
705
- function unobserved(e) {
706
- deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
707
- let t = e.C;
708
- while (t !== null) {
709
- t = unlinkSubs(t);
710
- }
711
- e.C = null;
712
- e.Pe = null;
713
- disposeChildren(e, true);
714
- }
715
- function link(e, t) {
716
- const n = t.Pe;
717
- if (n !== null && n.m === e) return;
718
- let i = null;
719
- const r = t.R & REACTIVE_RECOMPUTING_DEPS;
720
- if (r) {
721
- i = n !== null ? n.D : t.C;
722
- if (i !== null && i.m === e) {
723
- t.Pe = i;
724
- return;
725
- }
726
- }
727
- const s = e.Ae;
728
- if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
729
- const o = (t.Pe = e.Ae = { m: e, p: t, D: i, Ne: s, h: null });
730
- if (n !== null) n.D = o;
731
- else t.C = o;
732
- if (s !== null) s.h = o;
733
- else e.I = o;
734
- }
735
- function isValidLink(e, t) {
736
- const n = t.Pe;
737
- if (n !== null) {
738
- let i = t.C;
739
- do {
740
- if (i === e) return true;
741
- if (i === n) break;
742
- i = i.D;
743
- } while (i !== null);
744
- }
745
- return false;
746
- }
747
769
  const PENDING_OWNER = {};
748
770
  function markDisposal(e) {
749
- let t = e.Ce;
771
+ let t = e.ge;
750
772
  while (t) {
751
- t.R |= REACTIVE_ZOMBIE;
752
- if (t.R & REACTIVE_IN_HEAP) {
773
+ t._ |= REACTIVE_ZOMBIE;
774
+ if (t._ & REACTIVE_IN_HEAP) {
753
775
  deleteFromHeap(t, dirtyQueue);
754
776
  insertIntoHeap(t, zombieQueue);
755
777
  }
756
778
  markDisposal(t);
757
- t = t.ge;
779
+ t = t.De;
758
780
  }
759
781
  }
760
782
  function dispose(e) {
761
- let t = e.C || null;
783
+ let t = e.P || null;
762
784
  do {
763
785
  t = unlinkSubs(t);
764
786
  } while (t !== null);
765
- e.C = null;
766
- e.Pe = null;
787
+ e.P = null;
788
+ e.ye = null;
767
789
  disposeChildren(e, true);
768
790
  }
769
791
  function disposeChildren(e, t = false, n) {
770
- if (e.R & REACTIVE_DISPOSED) return;
771
- if (t) e.R = REACTIVE_DISPOSED;
772
- if (t && e.L) e.De = null;
773
- let i = n ? e.ye : e.Ce;
774
- while (i) {
775
- const e = i.ge;
776
- if (i.C) {
777
- const e = i;
778
- deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
779
- let t = e.C;
792
+ const i = e._;
793
+ if (i & REACTIVE_DISPOSED) return;
794
+ if (t) e._ = i | REACTIVE_DISPOSED;
795
+ if (t && e.L) e.ve = null;
796
+ let r = n ? e.Ne : e.ge;
797
+ while (r) {
798
+ const e = r.De;
799
+ if (r.P) {
800
+ const e = r;
801
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
802
+ let t = e.P;
780
803
  do {
781
804
  t = unlinkSubs(t);
782
805
  } while (t !== null);
783
- e.C = null;
784
- e.Pe = null;
806
+ e.P = null;
807
+ e.ye = null;
785
808
  }
786
- disposeChildren(i, true);
787
- i = e;
809
+ disposeChildren(r, true);
810
+ r = e;
788
811
  }
789
812
  if (n) {
790
- e.ye = null;
813
+ e.Ne = null;
791
814
  } else {
792
- e.Ce = null;
793
- e.ve = 0;
815
+ e.ge = null;
816
+ e.me = 0;
817
+ }
818
+ if (t && !n && !(i & REACTIVE_ZOMBIE) && e.i !== null && !(e.i._ & REACTIVE_DISPOSED)) {
819
+ const t = e.be;
820
+ const n = e.De;
821
+ if (t !== null) t.De = n;
822
+ else e.i.ge = n;
823
+ if (n !== null) n.be = t;
824
+ e.be = null;
794
825
  }
795
826
  runDisposal(e, n);
796
827
  }
797
828
  function runDisposal(e, t) {
798
- let n = t ? e.me : e.we;
829
+ let n = t ? e.Ae : e.we;
799
830
  if (!n) return;
800
831
  if (Array.isArray(n)) {
801
832
  for (let e = 0; e < n.length; e++) {
@@ -805,12 +836,12 @@ function runDisposal(e, t) {
805
836
  } else {
806
837
  n.call(n);
807
838
  }
808
- t ? (e.me = null) : (e.we = null);
839
+ t ? (e.Ae = null) : (e.we = null);
809
840
  }
810
841
  function childId(e, t) {
811
842
  let n = e;
812
- while (n.Ee & CONFIG_TRANSPARENT && n.i) n = n.i;
813
- if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
843
+ while (n._e & CONFIG_TRANSPARENT && n.i) n = n.i;
844
+ if (n.id != null) return formatId(n.id, t ? n.me++ : n.me);
814
845
  throw new Error("Cannot get child id from owner without an id");
815
846
  }
816
847
  function getNextChildId(e) {
@@ -839,96 +870,170 @@ function cleanup(e) {
839
870
  return e;
840
871
  }
841
872
  function isDisposed(e) {
842
- return !!(e.R & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
873
+ return !!(e._ & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
874
+ }
875
+ function disposeRootSelf(e = true) {
876
+ disposeChildren(this, e);
843
877
  }
844
878
  function createOwner(e) {
845
879
  const t = context;
846
880
  const n = e?.transparent ?? false;
847
881
  const i = {
848
882
  id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
849
- Ee: n ? CONFIG_TRANSPARENT : 0,
883
+ _e: n ? CONFIG_TRANSPARENT : 0,
850
884
  t: true,
851
885
  u: t?.t ? t.u : t,
852
- Ce: null,
853
886
  ge: null,
887
+ De: null,
888
+ be: null,
854
889
  we: null,
855
- $: t?.$ ?? globalQueue,
890
+ te: t?.te ?? globalQueue,
856
891
  Ve: t?.Ve || defaultContext,
857
- ve: 0,
858
- me: null,
859
- ye: null,
892
+ me: 0,
893
+ Ae: null,
894
+ Ne: null,
860
895
  i: t,
861
- dispose(e = true) {
862
- disposeChildren(i, e);
863
- }
896
+ dispose: disposeRootSelf
864
897
  };
865
898
  if (t) {
866
- const e = t.Ce;
899
+ const e = t.ge;
867
900
  if (e === null) {
868
- t.Ce = i;
901
+ t.ge = i;
869
902
  } else {
870
- i.ge = e;
871
- t.Ce = i;
903
+ i.De = e;
904
+ e.be = i;
905
+ t.ge = i;
872
906
  }
873
907
  }
874
908
  return i;
875
909
  }
876
910
  function createRoot(e, t) {
877
911
  const n = createOwner(t);
878
- return runWithOwner(n, () => e(n.dispose));
912
+ return runWithOwner(n, () => e(() => n.dispose()));
913
+ }
914
+ function unlinkSubs(e) {
915
+ const t = e.m;
916
+ const n = e.D;
917
+ const i = e.p;
918
+ const r = e.Le;
919
+ if (i !== null) i.Le = r;
920
+ else t.Ue = r;
921
+ if (r !== null) r.p = i;
922
+ else {
923
+ t.I = i;
924
+ if (i === null) {
925
+ t.X?.();
926
+ const e = t;
927
+ e.L && e._e & CONFIG_AUTO_DISPOSE && !(e._ & REACTIVE_ZOMBIE) && unobserved(e);
928
+ }
929
+ }
930
+ return n;
931
+ }
932
+ function trimStaleDeps(e) {
933
+ const t = e.ye;
934
+ let n = t !== null ? t.D : e.P;
935
+ if (n !== null) {
936
+ do {
937
+ n = unlinkSubs(n);
938
+ } while (n !== null);
939
+ if (t !== null) t.D = null;
940
+ else e.P = null;
941
+ }
942
+ }
943
+ function unobserved(e) {
944
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
945
+ let t = e.P;
946
+ while (t !== null) {
947
+ t = unlinkSubs(t);
948
+ }
949
+ e.P = null;
950
+ e.ye = null;
951
+ disposeChildren(e, true);
952
+ }
953
+ function link(e, t) {
954
+ const n = t.ye;
955
+ if (n !== null && n.m === e) return;
956
+ let i = null;
957
+ const r = t._ & REACTIVE_RECOMPUTING_DEPS;
958
+ if (r) {
959
+ i = n !== null ? n.D : t.P;
960
+ if (i !== null && i.m === e) {
961
+ t.ye = i;
962
+ return;
963
+ }
964
+ }
965
+ const s = e.Ue;
966
+ if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
967
+ const o = (t.ye = e.Ue = { m: e, h: t, D: i, Le: s, p: null });
968
+ if (n !== null) n.D = o;
969
+ else t.P = o;
970
+ if (s !== null) s.p = o;
971
+ else e.I = o;
972
+ }
973
+ function isValidLink(e, t) {
974
+ const n = t.ye;
975
+ if (n !== null) {
976
+ let i = t.P;
977
+ do {
978
+ if (i === e) return true;
979
+ if (i === n) break;
980
+ i = i.D;
981
+ } while (i !== null);
982
+ }
983
+ return false;
879
984
  }
880
985
  function addPendingSource(e, t) {
881
- if (e.Re === t || e._e?.has(t)) return false;
882
- if (!e.Re) {
883
- e.Re = t;
986
+ if (e.Ce === t || e.Pe?.has(t)) return false;
987
+ if (!e.Ce) {
988
+ e.Ce = t;
884
989
  return true;
885
990
  }
886
- if (!e._e) {
887
- e._e = new Set([e.Re, t]);
991
+ if (!e.Pe) {
992
+ e.Pe = new Set([e.Ce, t]);
888
993
  } else {
889
- e._e.add(t);
994
+ e.Pe.add(t);
890
995
  }
891
- e.Re = undefined;
996
+ e.Ce = undefined;
892
997
  return true;
893
998
  }
894
999
  function removePendingSource(e, t) {
895
- if (e.Re) {
896
- if (e.Re !== t) return false;
897
- e.Re = undefined;
1000
+ if (e.Ce) {
1001
+ if (e.Ce !== t) return false;
1002
+ e.Ce = undefined;
898
1003
  return true;
899
1004
  }
900
- if (!e._e?.delete(t)) return false;
901
- if (e._e.size === 1) {
902
- e.Re = e._e.values().next().value;
903
- e._e = undefined;
904
- } else if (e._e.size === 0) {
905
- e._e = undefined;
1005
+ if (!e.Pe?.delete(t)) return false;
1006
+ if (e.Pe.size === 1) {
1007
+ e.Ce = e.Pe.values().next().value;
1008
+ e.Pe = undefined;
1009
+ } else if (e.Pe.size === 0) {
1010
+ e.Pe = undefined;
906
1011
  }
907
1012
  return true;
908
1013
  }
909
1014
  function clearPendingSources(e) {
910
- e.Re = undefined;
911
- e._e?.clear();
912
- e._e = undefined;
1015
+ e.Ce = undefined;
1016
+ e.Pe?.clear();
1017
+ e.Pe = undefined;
913
1018
  }
914
1019
  function setPendingError(e, t, n) {
915
1020
  if (!t) {
916
- e.Te = null;
1021
+ e.Re = null;
917
1022
  return;
918
1023
  }
919
1024
  if (n instanceof NotReadyError && n.source === t) {
920
- e.Te = n;
1025
+ e.Re = n;
921
1026
  return;
922
1027
  }
923
- const i = e.Te;
1028
+ const i = e.Re;
924
1029
  if (!(i instanceof NotReadyError) || i.source !== t) {
925
- e.Te = new NotReadyError(t);
1030
+ e.Re = new NotReadyError(t);
926
1031
  }
927
1032
  }
928
1033
  function forEachDependent(e, t) {
929
- for (let n = e.I; n !== null; n = n.h) t(n.p);
1034
+ for (let n = e.I; n !== null; n = n.p) t(n.h);
930
1035
  for (let n = e.N; n !== null; n = n.A) {
931
- for (let e = n.I; e !== null; e = e.h) t(e.p);
1036
+ for (let e = n.I; e !== null; e = e.p) t(e.h);
932
1037
  }
933
1038
  }
934
1039
  function settlePendingSource(e) {
@@ -937,30 +1042,30 @@ function settlePendingSource(e) {
937
1042
  const settle = i => {
938
1043
  if (n.has(i) || !removePendingSource(i, e)) return;
939
1044
  n.add(i);
940
- i.Se = clock;
941
- const r = i.Re ?? i._e?.values().next().value;
1045
+ i.Ie = clock;
1046
+ const r = i.Ce ?? i.Pe?.values().next().value;
942
1047
  if (r) {
943
1048
  setPendingError(i, r);
944
1049
  updatePendingSignal(i);
945
1050
  } else {
946
- i.Oe &= ~STATUS_PENDING;
1051
+ i.he &= ~STATUS_PENDING;
947
1052
  setPendingError(i);
948
1053
  updatePendingSignal(i);
949
- if (i.be) {
950
- if (i.M === EFFECT_TRACKED) {
1054
+ if (i.Ge) {
1055
+ if (i.J === EFFECT_TRACKED) {
951
1056
  const e = i;
952
- if (!e.j) {
953
- e.j = true;
954
- e.$.enqueue(EFFECT_USER, e.K);
1057
+ if (!e.ee) {
1058
+ e.ee = true;
1059
+ e.te.enqueue(EFFECT_USER, e.ne);
955
1060
  }
956
1061
  } else {
957
- const e = i.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
958
- if (e.P > i.o) e.P = i.o;
1062
+ const e = i._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
1063
+ if (e.C > i.o) e.C = i.o;
959
1064
  insertIntoHeap(i, e);
960
1065
  }
961
1066
  t = true;
962
1067
  }
963
- i.be = false;
1068
+ i.Ge = false;
964
1069
  }
965
1070
  forEachDependent(i, settle);
966
1071
  };
@@ -968,46 +1073,52 @@ function settlePendingSource(e) {
968
1073
  if (t) schedule();
969
1074
  }
970
1075
  function handleAsync(e, t, n) {
971
- const i = typeof t === "object" && t !== null;
972
- const r = i && untrack(() => t[Symbol.asyncIterator]);
973
- const s = !r && i && untrack(() => typeof t.then === "function");
974
- if (!s && !r) {
975
- e.De = null;
1076
+ let i = false;
1077
+ let r = false;
1078
+ if (typeof t === "object" && t !== null) {
1079
+ untrack(() => {
1080
+ i = t[Symbol.asyncIterator];
1081
+ r = !i && typeof t.then === "function";
1082
+ });
1083
+ }
1084
+ if (!r && !i) {
1085
+ e.ve = null;
976
1086
  return t;
977
1087
  }
978
- e.De = t;
979
- let o;
1088
+ e.ve = t;
1089
+ let s;
980
1090
  const handleError = n => {
981
- if (e.De !== t) return;
1091
+ if (e.ve !== t) return;
982
1092
  globalQueue.initTransition(resolveTransition(e));
983
1093
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
984
- e.Se = clock;
1094
+ e.Ie = clock;
985
1095
  };
986
1096
  const asyncWrite = (i, r) => {
987
- if (e.De !== t) return;
988
- if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
1097
+ if (e.ve !== t) return;
1098
+ if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
989
1099
  globalQueue.initTransition(resolveTransition(e));
990
- const s = !!(e.Oe & STATUS_UNINITIALIZED);
1100
+ const s = !!(e.he & STATUS_UNINITIALIZED);
1101
+ trimStaleDeps(e);
991
1102
  clearStatus(e);
992
1103
  const o = resolveLane(e);
993
- if (o) o.W.delete(e);
1104
+ if (o) o.k.delete(e);
994
1105
  if (n) n(i);
995
- else if (e.G !== undefined) {
996
- if (e.G !== undefined && e.G !== NOT_PENDING) e.U = i;
1106
+ else if (e.K !== undefined) {
1107
+ if (e.K !== undefined && e.K !== NOT_PENDING) e.B = i;
997
1108
  else {
998
- e.ne = i;
1109
+ e.ue = i;
999
1110
  insertSubs(e);
1000
1111
  }
1001
- e.Se = clock;
1112
+ e.Ie = clock;
1002
1113
  } else if (o) {
1003
- const t = e.M;
1004
- const n = e.ne;
1005
- const r = e.Le;
1114
+ const t = e.J;
1115
+ const n = e.ue;
1116
+ const r = e.Fe;
1006
1117
  if ((!t && s) || !r || !r(i, n)) {
1007
- e.ne = i;
1008
- e.Se = clock;
1009
- if (e.Ue) {
1010
- setSignal(e.Ue, i);
1118
+ e.ue = i;
1119
+ e.Ie = clock;
1120
+ if (e.ke) {
1121
+ setSignal(e.ke, i);
1011
1122
  }
1012
1123
  insertSubs(e, true);
1013
1124
  }
@@ -1019,13 +1130,13 @@ function handleAsync(e, t, n) {
1019
1130
  flush();
1020
1131
  r?.();
1021
1132
  };
1022
- if (s) {
1133
+ if (r) {
1023
1134
  let n = false,
1024
1135
  i = true;
1025
1136
  t.then(
1026
1137
  e => {
1027
1138
  if (i) {
1028
- o = e;
1139
+ s = e;
1029
1140
  n = true;
1030
1141
  } else asyncWrite(e);
1031
1142
  },
@@ -1039,7 +1150,7 @@ function handleAsync(e, t, n) {
1039
1150
  throw new NotReadyError(context);
1040
1151
  }
1041
1152
  }
1042
- if (r) {
1153
+ if (i) {
1043
1154
  const n = t[Symbol.asyncIterator]();
1044
1155
  let i = false;
1045
1156
  let r = false;
@@ -1054,16 +1165,16 @@ function handleAsync(e, t, n) {
1054
1165
  } catch {}
1055
1166
  });
1056
1167
  const iterate = () => {
1057
- let s,
1168
+ let o,
1058
1169
  u = false,
1059
- c = true;
1170
+ l = true;
1060
1171
  n.next().then(
1061
1172
  n => {
1062
- if (c) {
1063
- s = n;
1173
+ if (l) {
1174
+ o = n;
1064
1175
  u = true;
1065
1176
  if (n.done) r = true;
1066
- } else if (e.De !== t) {
1177
+ } else if (e.ve !== t) {
1067
1178
  return;
1068
1179
  } else if (!n.done) asyncWrite(n.value, iterate);
1069
1180
  else {
@@ -1073,79 +1184,79 @@ function handleAsync(e, t, n) {
1073
1184
  }
1074
1185
  },
1075
1186
  n => {
1076
- if (!c && e.De === t) {
1187
+ if (!l && e.ve === t) {
1077
1188
  r = true;
1078
1189
  handleError(n);
1079
1190
  }
1080
1191
  }
1081
1192
  );
1082
- c = false;
1083
- if (u && !s.done) {
1084
- o = s.value;
1193
+ l = false;
1194
+ if (u && !o.done) {
1195
+ s = o.value;
1085
1196
  i = true;
1086
1197
  return iterate();
1087
1198
  }
1088
- return u && s.done;
1199
+ return u && o.done;
1089
1200
  };
1090
- const s = iterate();
1091
- if (!i && !s) {
1201
+ const o = iterate();
1202
+ if (!i && !o) {
1092
1203
  globalQueue.initTransition(resolveTransition(e));
1093
1204
  throw new NotReadyError(context);
1094
1205
  }
1095
1206
  }
1096
- return o;
1207
+ return s;
1097
1208
  }
1098
1209
  function clearStatus(e, t = false) {
1099
- clearPendingSources(e);
1100
- e.be = false;
1101
- e.Oe = t ? 0 : e.Oe & STATUS_UNINITIALIZED;
1102
- setPendingError(e);
1103
- updatePendingSignal(e);
1104
- e.Ge?.();
1210
+ if (e.Ce || e.Pe) clearPendingSources(e);
1211
+ if (e.Ge) e.Ge = false;
1212
+ e.he = t ? 0 : e.he & STATUS_UNINITIALIZED;
1213
+ if (e.Re) setPendingError(e);
1214
+ if (e.We) updatePendingSignal(e);
1215
+ if (e.xe) e.xe();
1105
1216
  }
1106
1217
  function notifyStatus(e, t, n, i, r) {
1107
1218
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
1108
1219
  n = new StatusError(e, n);
1109
1220
  const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
1110
1221
  const o = s === e;
1111
- const u = t === STATUS_PENDING && e.G !== undefined && !o;
1112
- const c = u && hasActiveOverride(e);
1222
+ const u = t === STATUS_PENDING && e.K !== undefined && !o;
1223
+ const l = u && hasActiveOverride(e);
1113
1224
  if (!i) {
1114
1225
  if (t === STATUS_PENDING && s) {
1115
1226
  addPendingSource(e, s);
1116
- e.Oe = STATUS_PENDING | (e.Oe & STATUS_UNINITIALIZED);
1227
+ e.he = STATUS_PENDING | (e.he & STATUS_UNINITIALIZED);
1117
1228
  setPendingError(e, s, n);
1118
1229
  } else {
1119
1230
  clearPendingSources(e);
1120
- e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
1121
- e.Te = n;
1231
+ e.he = t | (t !== STATUS_ERROR ? e.he & STATUS_UNINITIALIZED : 0);
1232
+ e.Re = n;
1122
1233
  }
1123
1234
  updatePendingSignal(e);
1124
1235
  }
1125
1236
  if (r && !i) {
1126
1237
  assignOrMergeLane(e, r);
1127
1238
  }
1128
- const a = i || c;
1129
- const l = i || u ? undefined : r;
1130
- if (e.Ge) {
1239
+ const c = i || l;
1240
+ const a = i || u ? undefined : r;
1241
+ if (e.xe) {
1131
1242
  if (i && t === STATUS_PENDING) {
1132
1243
  return;
1133
1244
  }
1134
- if (a) {
1135
- e.Ge(t, n);
1245
+ if (c) {
1246
+ e.xe(t, n);
1136
1247
  } else {
1137
- e.Ge();
1248
+ e.xe();
1138
1249
  }
1139
1250
  return;
1140
1251
  }
1141
1252
  forEachDependent(e, e => {
1142
- e.Se = clock;
1253
+ e.Ie = clock;
1143
1254
  if (
1144
- (t === STATUS_PENDING && s && e.Re !== s && !e._e?.has(s)) ||
1145
- (t !== STATUS_PENDING && (e.Te !== n || e.Re || e._e))
1255
+ (t === STATUS_PENDING && s && e.Ce !== s && !e.Pe?.has(s)) ||
1256
+ (t !== STATUS_PENDING && (e.Re !== n || e.Ce || e.Pe))
1146
1257
  ) {
1147
- if (!a && !e.Z) globalQueue.ue.push(e);
1148
- notifyStatus(e, t, n, a, l);
1258
+ if (!c && !e.M) queuePendingNode(e);
1259
+ notifyStatus(e, t, n, c, a);
1149
1260
  }
1150
1261
  });
1151
1262
  }
@@ -1172,8 +1283,8 @@ function enableExternalSource(e) {
1172
1283
  externalSourceConfig = { factory: t, untrack: n };
1173
1284
  }
1174
1285
  }
1175
- GlobalQueue.ce = recompute;
1176
- GlobalQueue.ae = disposeChildren;
1286
+ GlobalQueue.Ee = recompute;
1287
+ GlobalQueue.Se = disposeChildren;
1177
1288
  let tracking = false;
1178
1289
  let stale = false;
1179
1290
  let refreshing = false;
@@ -1186,7 +1297,7 @@ let snapshotCaptureActive = false;
1186
1297
  let snapshotSources = null;
1187
1298
  function ownerInSnapshotScope(e) {
1188
1299
  while (e) {
1189
- if (e.ke) return true;
1300
+ if (e.He) return true;
1190
1301
  e = e.i;
1191
1302
  }
1192
1303
  return false;
@@ -1196,38 +1307,38 @@ function setSnapshotCapture(e) {
1196
1307
  if (e && !snapshotSources) snapshotSources = new Set();
1197
1308
  }
1198
1309
  function markSnapshotScope(e) {
1199
- e.ke = true;
1310
+ e.He = true;
1200
1311
  }
1201
1312
  function releaseSnapshotScope(e) {
1202
- e.ke = false;
1313
+ e.He = false;
1203
1314
  releaseSubtree(e);
1204
1315
  schedule();
1205
1316
  }
1206
1317
  function releaseSubtree(e) {
1207
- let t = e.Ce;
1318
+ let t = e.ge;
1208
1319
  while (t) {
1209
- if (t.ke) {
1210
- t = t.ge;
1320
+ if (t.He) {
1321
+ t = t.De;
1211
1322
  continue;
1212
1323
  }
1213
1324
  if (t.L) {
1214
1325
  const e = t;
1215
- e.Ee &= ~CONFIG_IN_SNAPSHOT_SCOPE;
1216
- if (e.R & REACTIVE_SNAPSHOT_STALE) {
1217
- e.R &= ~REACTIVE_SNAPSHOT_STALE;
1218
- e.R |= REACTIVE_DIRTY;
1219
- if (dirtyQueue.P > e.o) dirtyQueue.P = e.o;
1326
+ e._e &= ~CONFIG_IN_SNAPSHOT_SCOPE;
1327
+ if (e._ & REACTIVE_SNAPSHOT_STALE) {
1328
+ e._ &= ~REACTIVE_SNAPSHOT_STALE;
1329
+ e._ |= REACTIVE_DIRTY;
1330
+ if (dirtyQueue.C > e.o) dirtyQueue.C = e.o;
1220
1331
  insertIntoHeap(e, dirtyQueue);
1221
1332
  }
1222
1333
  }
1223
1334
  releaseSubtree(t);
1224
- t = t.ge;
1335
+ t = t.De;
1225
1336
  }
1226
1337
  }
1227
1338
  function clearSnapshots() {
1228
1339
  if (snapshotSources) {
1229
1340
  for (const e of snapshotSources) {
1230
- delete e.de;
1341
+ delete e.pe;
1231
1342
  delete e[STORE_SNAPSHOT_PROPS];
1232
1343
  }
1233
1344
  snapshotSources = null;
@@ -1235,236 +1346,307 @@ function clearSnapshots() {
1235
1346
  snapshotCaptureActive = false;
1236
1347
  }
1237
1348
  function recompute(e, t = false) {
1238
- const n = e.M;
1349
+ const n = e.J;
1239
1350
  if (!t) {
1240
- if (e.Z && (!n || activeTransition) && activeTransition !== e.Z)
1241
- globalQueue.initTransition(e.Z);
1242
- deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1243
- e.De = null;
1244
- if (e.Z || n === EFFECT_TRACKED) disposeChildren(e);
1245
- else {
1351
+ if (e.M && (!n || activeTransition) && activeTransition !== e.M)
1352
+ globalQueue.initTransition(e.M);
1353
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1354
+ e.ve = null;
1355
+ if (e.M || n === EFFECT_TRACKED) disposeChildren(e);
1356
+ else if (e.ge !== null || e.we !== null) {
1246
1357
  markDisposal(e);
1247
- e.me = e.we;
1248
- e.ye = e.Ce;
1358
+ e.Ae = e.we;
1359
+ e.Ne = e.ge;
1249
1360
  e.we = null;
1250
- e.Ce = null;
1251
- e.ve = 0;
1252
- }
1253
- }
1254
- let i = !!(e.R & REACTIVE_OPTIMISTIC_DIRTY);
1255
- const r = e.G !== undefined && e.G !== NOT_PENDING;
1256
- const s = !!(e.Oe & STATUS_PENDING);
1257
- const o = !!(e.Oe & STATUS_UNINITIALIZED);
1361
+ e.ge = null;
1362
+ e.me = 0;
1363
+ } else;
1364
+ }
1365
+ let i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
1366
+ const r = e.K !== undefined && e.K !== NOT_PENDING;
1367
+ const s = !!(e.he & STATUS_PENDING);
1368
+ const o = !!(e.he & STATUS_UNINITIALIZED);
1258
1369
  const u = context;
1259
1370
  context = e;
1260
- e.Pe = null;
1261
- e.R = REACTIVE_RECOMPUTING_DEPS;
1262
- e.Se = clock;
1263
- let c = e.U === NOT_PENDING ? e.ne : e.U;
1264
- let a = e.o;
1265
- let l = tracking;
1371
+ e.ye = null;
1372
+ e._ = REACTIVE_RECOMPUTING_DEPS;
1373
+ e.Ie = clock;
1374
+ let l = e.B === NOT_PENDING ? e.ue : e.B;
1375
+ let c = e.o;
1376
+ let a = tracking;
1266
1377
  let f = currentOptimisticLane;
1267
1378
  tracking = true;
1268
1379
  if (i) {
1269
1380
  const t = resolveLane(e);
1270
1381
  if (t) currentOptimisticLane = t;
1271
- } else if (activeTransition && !t && activeTransition.q.length) {
1272
- for (let t = e.C; t; t = t.D) {
1382
+ } else if (activeTransition && !t && activeTransition.Z.length) {
1383
+ for (let t = e.P; t; t = t.D) {
1273
1384
  const n = t.m;
1274
- if (n.R & REACTIVE_OPTIMISTIC_DIRTY) {
1385
+ if (n._ & REACTIVE_OPTIMISTIC_DIRTY) {
1275
1386
  const t = resolveLane(n);
1276
1387
  if (t) {
1277
1388
  i = true;
1278
1389
  currentOptimisticLane = t;
1279
- e.R |= REACTIVE_OPTIMISTIC_DIRTY;
1390
+ e._ |= REACTIVE_OPTIMISTIC_DIRTY;
1280
1391
  assignOrMergeLane(e, t);
1281
1392
  break;
1282
1393
  }
1283
1394
  }
1284
1395
  }
1285
1396
  }
1397
+ const E = n && n !== EFFECT_USER;
1398
+ const S = stale;
1399
+ if (E) stale = true;
1286
1400
  try {
1287
- const n = e.De;
1288
- const i = e.L(c);
1289
- c = e.De !== n ? i : handleAsync(e, i);
1401
+ if (!false && e._e & CONFIG_SYNC) {
1402
+ l = e.L(l);
1403
+ e.ve = null;
1404
+ } else {
1405
+ const t = e.ve;
1406
+ const n = e.L(l);
1407
+ const i = typeof n === "object" && n !== null;
1408
+ const r = e.ve !== t;
1409
+ l = r || !i ? n : handleAsync(e, n);
1410
+ if (!r && !i) e.ve = null;
1411
+ }
1290
1412
  clearStatus(e, t);
1291
- const r = resolveLane(e);
1292
- if (r) {
1293
- r.W.delete(e);
1294
- updatePendingSignal(r.ie);
1413
+ if (e.G) {
1414
+ const t = resolveLane(e);
1415
+ if (t) {
1416
+ t.k.delete(e);
1417
+ updatePendingSignal(t.F);
1418
+ }
1295
1419
  }
1296
1420
  } catch (t) {
1297
1421
  if (t instanceof NotReadyError && currentOptimisticLane) {
1298
1422
  const t = findLane(currentOptimisticLane);
1299
- if (t.ie !== e) {
1300
- t.W.add(e);
1301
- e.te = t;
1302
- updatePendingSignal(t.ie);
1423
+ if (t.F !== e) {
1424
+ t.k.add(e);
1425
+ e.G = t;
1426
+ updatePendingSignal(t.F);
1303
1427
  }
1304
1428
  }
1305
- if (t instanceof NotReadyError) e.be = true;
1429
+ if (t instanceof NotReadyError) e.Ge = true;
1306
1430
  notifyStatus(
1307
1431
  e,
1308
1432
  t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
1309
1433
  t,
1310
1434
  undefined,
1311
- t instanceof NotReadyError ? e.te : undefined
1435
+ t instanceof NotReadyError ? e.G : undefined
1312
1436
  );
1313
1437
  } finally {
1314
- tracking = l;
1315
- e.R = REACTIVE_NONE | (t ? e.R & REACTIVE_SNAPSHOT_STALE : 0);
1438
+ tracking = a;
1439
+ if (E) stale = S;
1440
+ e._ = REACTIVE_NONE | (t ? e._ & REACTIVE_SNAPSHOT_STALE : 0);
1316
1441
  context = u;
1317
1442
  }
1318
- if (!e.Te) {
1319
- const u = e.Pe;
1320
- let l = u !== null ? u.D : e.C;
1321
- if (l !== null) {
1322
- do {
1323
- l = unlinkSubs(l);
1324
- } while (l !== null);
1325
- if (u !== null) u.D = null;
1326
- else e.C = null;
1327
- }
1328
- const f = r ? e.G : e.U === NOT_PENDING ? e.ne : e.U;
1329
- const E = (!n && o) || !e.Le || !e.Le(f, c);
1330
- if (E) {
1331
- const o = r ? e.G : undefined;
1332
- if (t || (n && activeTransition !== e.Z) || i) {
1333
- e.ne = c;
1443
+ if (!e.Re) {
1444
+ trimStaleDeps(e);
1445
+ const u = r ? e.K : e.B === NOT_PENDING ? e.ue : e.B;
1446
+ const a = (!n && o) || !e.Fe || !e.Fe(u, l);
1447
+ if (n && a) {
1448
+ e.ee = !e.Re;
1449
+ if (!t) e.te.enqueue(n, GlobalQueue.Te.bind(null, e));
1450
+ }
1451
+ if (a) {
1452
+ const o = r ? e.K : undefined;
1453
+ if (t || (n && activeTransition !== e.M) || i) {
1454
+ e.ue = l;
1334
1455
  if (r && i) {
1335
- e.G = c;
1336
- e.U = c;
1456
+ e.K = l;
1457
+ e.B = l;
1337
1458
  }
1338
- } else e.U = c;
1339
- if (r && !i && s && !e.pe) e.G = c;
1340
- if (!r || i || e.G !== o) insertSubs(e, i || r);
1459
+ } else e.B = l;
1460
+ if (r && !i && s && !e.$) e.K = l;
1461
+ if (!r || i || e.K !== o) insertSubs(e, i || r);
1341
1462
  } else if (r) {
1342
- e.U = c;
1343
- } else if (e.o != a) {
1344
- for (let t = e.I; t !== null; t = t.h) {
1345
- insertIntoHeapHeight(t.p, t.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1463
+ e.B = l;
1464
+ } else if (e.o != c) {
1465
+ for (let t = e.I; t !== null; t = t.p) {
1466
+ insertIntoHeapHeight(t.h, t.h._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1346
1467
  }
1347
1468
  }
1348
1469
  }
1349
1470
  currentOptimisticLane = f;
1350
- (!t || e.Oe & STATUS_PENDING) && !e.Z && !(activeTransition && r) && globalQueue.ue.push(e);
1351
- e.Z && n && activeTransition !== e.Z && runInTransition(e.Z, () => recompute(e));
1471
+ const T =
1472
+ e.B !== NOT_PENDING ||
1473
+ e.Ne !== null ||
1474
+ e.Ae !== null ||
1475
+ !!(e.he & (STATUS_PENDING | STATUS_UNINITIALIZED));
1476
+ T && (!t || e.he & STATUS_PENDING) && !e.M && !(activeTransition && r) && queuePendingNode(e);
1477
+ e.M && n && activeTransition !== e.M && runInTransition(e.M, () => recompute(e));
1352
1478
  }
1353
1479
  function updateIfNecessary(e) {
1354
- if (e.R & REACTIVE_CHECK) {
1355
- for (let t = e.C; t; t = t.D) {
1480
+ if (e._ & REACTIVE_CHECK) {
1481
+ for (let t = e.P; t; t = t.D) {
1356
1482
  const n = t.m;
1357
1483
  const i = n.V || n;
1358
1484
  if (i.L) {
1359
1485
  updateIfNecessary(i);
1360
1486
  }
1361
- if (e.R & REACTIVE_DIRTY) {
1487
+ if (e._ & REACTIVE_DIRTY) {
1362
1488
  break;
1363
1489
  }
1364
1490
  }
1365
1491
  }
1366
- if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Te && e.Se < clock && !e.De)) {
1492
+ if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Re && e.Ie < clock && !e.ve)) {
1367
1493
  recompute(e);
1368
1494
  }
1369
- e.R = e.R & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1495
+ e._ = e._ & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1370
1496
  }
1371
1497
  function computed(e, t) {
1372
1498
  const n = t?.transparent ?? false;
1373
1499
  const i = {
1374
1500
  id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1375
- Ee:
1501
+ _e:
1376
1502
  (n ? CONFIG_TRANSPARENT : 0) |
1377
1503
  (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
1378
1504
  (!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
1505
+ (t?.sync ? CONFIG_SYNC : 0) |
1379
1506
  (snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
1380
- Le: t?.equals != null ? t.equals : isEqual,
1381
- k: t?.unobserved,
1507
+ Fe: t?.equals != null ? t.equals : isEqual,
1508
+ X: t?.unobserved,
1382
1509
  we: null,
1383
- $: context?.$ ?? globalQueue,
1510
+ te: context?.te ?? globalQueue,
1384
1511
  Ve: context?.Ve ?? defaultContext,
1385
- ve: 0,
1512
+ me: 0,
1386
1513
  L: e,
1387
- ne: undefined,
1514
+ ue: undefined,
1388
1515
  o: 0,
1389
1516
  N: null,
1390
- S: undefined,
1391
- T: null,
1392
- C: null,
1393
- Pe: null,
1517
+ T: undefined,
1518
+ S: null,
1519
+ P: null,
1520
+ ye: null,
1394
1521
  I: null,
1395
- Ae: null,
1522
+ Ue: null,
1396
1523
  i: context,
1524
+ De: null,
1525
+ be: null,
1397
1526
  ge: null,
1398
- Ce: null,
1399
- R: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1400
- Oe: STATUS_UNINITIALIZED,
1401
- Se: clock,
1402
- U: NOT_PENDING,
1403
- me: null,
1527
+ _: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1528
+ he: STATUS_UNINITIALIZED,
1529
+ Ie: clock,
1530
+ B: NOT_PENDING,
1531
+ Ae: null,
1532
+ Ne: null,
1533
+ ve: null,
1534
+ M: null
1535
+ };
1536
+ setupComputedNode(i, t);
1537
+ return i;
1538
+ }
1539
+ function createEffectNode(e, t, n, i, r, s) {
1540
+ const o = s?.transparent ?? false;
1541
+ const u = {
1542
+ id: s?.id ?? (o ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1543
+ _e:
1544
+ (o ? CONFIG_TRANSPARENT : 0) |
1545
+ (s?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
1546
+ (s?.sync ? CONFIG_SYNC : 0) |
1547
+ (snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
1548
+ Fe: false,
1549
+ X: s?.unobserved,
1550
+ we: null,
1551
+ te: context?.te ?? globalQueue,
1552
+ Ve: context?.Ve ?? defaultContext,
1553
+ me: 0,
1554
+ L: e,
1555
+ ue: undefined,
1556
+ o: 0,
1557
+ N: null,
1558
+ T: undefined,
1559
+ S: null,
1560
+ P: null,
1404
1561
  ye: null,
1562
+ I: null,
1563
+ Ue: null,
1564
+ i: context,
1405
1565
  De: null,
1406
- Z: null
1566
+ be: null,
1567
+ ge: null,
1568
+ _: REACTIVE_LAZY,
1569
+ he: STATUS_UNINITIALIZED,
1570
+ Ie: clock,
1571
+ B: NOT_PENDING,
1572
+ Ae: null,
1573
+ Ne: null,
1574
+ ve: null,
1575
+ M: null,
1576
+ ee: false,
1577
+ Me: undefined,
1578
+ Qe: t,
1579
+ je: n,
1580
+ $e: undefined,
1581
+ Ke: false,
1582
+ J: i,
1583
+ xe: r
1407
1584
  };
1408
- i.T = i;
1409
- const r = context?.t ? context.u : context;
1585
+ setupComputedNode(u, lazyOptions);
1586
+ return u;
1587
+ }
1588
+ const lazyOptions = { lazy: true };
1589
+ function setupComputedNode(e, t) {
1590
+ e.S = e;
1591
+ const n = context?.t ? context.u : context;
1410
1592
  if (context) {
1411
- const e = context.Ce;
1412
- if (e === null) {
1413
- context.Ce = i;
1593
+ const t = context.ge;
1594
+ if (t === null) {
1595
+ context.ge = e;
1414
1596
  } else {
1415
- i.ge = e;
1416
- context.Ce = i;
1597
+ e.De = t;
1598
+ t.be = e;
1599
+ context.ge = e;
1417
1600
  }
1418
1601
  }
1419
- if (r) i.o = r.o + 1;
1602
+ if (n) e.o = n.o + 1;
1420
1603
  if (externalSourceConfig) {
1421
- const e = signal(undefined, { equals: false, ownedWrite: true });
1422
- const t = externalSourceConfig.factory(i.L, () => {
1423
- setSignal(e, undefined);
1604
+ const t = signal(undefined, { equals: false, ownedWrite: true });
1605
+ const n = externalSourceConfig.factory(e.L, () => {
1606
+ setSignal(t, undefined);
1424
1607
  });
1425
- cleanup(() => t.dispose());
1426
- i.L = n => {
1427
- read(e);
1428
- return t.track(n);
1608
+ cleanup(() => n.dispose());
1609
+ e.L = e => {
1610
+ read(t);
1611
+ return n.track(e);
1429
1612
  };
1430
1613
  }
1431
- !t?.lazy && recompute(i, true);
1614
+ !t?.lazy && recompute(e, true);
1432
1615
  if (snapshotCaptureActive && !t?.lazy) {
1433
- if (!(i.Oe & STATUS_PENDING)) {
1434
- i.de = i.ne === undefined ? NO_SNAPSHOT : i.ne;
1435
- snapshotSources.add(i);
1616
+ if (!(e.he & STATUS_PENDING)) {
1617
+ e.pe = e.ue === undefined ? NO_SNAPSHOT : e.ue;
1618
+ snapshotSources.add(e);
1436
1619
  }
1437
1620
  }
1438
- return i;
1439
1621
  }
1440
1622
  function signal(e, t, n = null) {
1441
1623
  const i = {
1442
- Le: t?.equals != null ? t.equals : isEqual,
1443
- Ee: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Fe ? CONFIG_NO_SNAPSHOT : 0),
1444
- k: t?.unobserved,
1445
- ne: e,
1624
+ Fe: t?.equals != null ? t.equals : isEqual,
1625
+ _e: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Ye ? CONFIG_NO_SNAPSHOT : 0),
1626
+ X: t?.unobserved,
1627
+ ue: e,
1446
1628
  I: null,
1447
- Ae: null,
1448
- Se: clock,
1629
+ Ue: null,
1630
+ Ie: clock,
1449
1631
  V: n,
1450
1632
  A: n?.N || null,
1451
- U: NOT_PENDING
1633
+ B: NOT_PENDING
1452
1634
  };
1453
1635
  n && (n.N = i);
1454
- if (snapshotCaptureActive && !(i.Ee & CONFIG_NO_SNAPSHOT) && !((n?.Oe ?? 0) & STATUS_PENDING)) {
1455
- i.de = e === undefined ? NO_SNAPSHOT : e;
1636
+ if (snapshotCaptureActive && !(i._e & CONFIG_NO_SNAPSHOT) && !((n?.he ?? 0) & STATUS_PENDING)) {
1637
+ i.pe = e === undefined ? NO_SNAPSHOT : e;
1456
1638
  snapshotSources.add(i);
1457
1639
  }
1458
1640
  return i;
1459
1641
  }
1460
1642
  function optimisticSignal(e, t) {
1461
1643
  const n = signal(e, t);
1462
- n.G = NOT_PENDING;
1644
+ n.K = NOT_PENDING;
1463
1645
  return n;
1464
1646
  }
1465
1647
  function optimisticComputed(e, t) {
1466
1648
  const n = computed(e, t);
1467
- n.G = NOT_PENDING;
1649
+ n.K = NOT_PENDING;
1468
1650
  return n;
1469
1651
  }
1470
1652
  function isEqual(e, t) {
@@ -1486,7 +1668,7 @@ function read(e) {
1486
1668
  const t = getLatestValueComputed(e);
1487
1669
  const n = latestReadActive;
1488
1670
  latestReadActive = false;
1489
- const i = e.G !== undefined && e.G !== NOT_PENDING ? e.G : e.ne;
1671
+ const i = e.K !== undefined && e.K !== NOT_PENDING ? e.K : e.ue;
1490
1672
  let r;
1491
1673
  try {
1492
1674
  r = read(t);
@@ -1496,11 +1678,11 @@ function read(e) {
1496
1678
  } finally {
1497
1679
  latestReadActive = n;
1498
1680
  }
1499
- if (t.Oe & STATUS_PENDING) return i;
1500
- if (stale && currentOptimisticLane && t.te) {
1501
- const e = findLane(t.te);
1681
+ if (t.he & STATUS_PENDING) return i;
1682
+ if (stale && currentOptimisticLane && t.G) {
1683
+ const e = findLane(t.G);
1502
1684
  const n = findLane(currentOptimisticLane);
1503
- if (e !== n && e.W.size > 0) {
1685
+ if (e !== n && e.k.size > 0) {
1504
1686
  return i;
1505
1687
  }
1506
1688
  }
@@ -1510,8 +1692,8 @@ function read(e) {
1510
1692
  const t = e.V;
1511
1693
  const n = pendingCheckActive;
1512
1694
  pendingCheckActive = false;
1513
- if (t && e.G !== undefined) {
1514
- if (e.G !== NOT_PENDING && (t.De || !!(t.Oe & STATUS_PENDING))) {
1695
+ if (t && e.K !== undefined) {
1696
+ if (e.K !== NOT_PENDING && (t.ve || !!(t.he & STATUS_PENDING))) {
1515
1697
  foundPending = true;
1516
1698
  }
1517
1699
  let n = context;
@@ -1524,27 +1706,39 @@ function read(e) {
1524
1706
  if (t && read(getPendingSignal(t))) foundPending = true;
1525
1707
  }
1526
1708
  pendingCheckActive = n;
1527
- return e.ne;
1709
+ return e.ue;
1528
1710
  }
1529
1711
  let t = context;
1530
1712
  if (t?.t) t = t.u;
1531
1713
  const n = e;
1532
1714
  if (typeof n.L === "function") {
1533
1715
  const t = e;
1534
- if (refreshing && !(t.R & REACTIVE_DISPOSED)) recompute(t);
1535
- if (t.R & REACTIVE_LAZY) {
1536
- t.R &= ~REACTIVE_LAZY;
1716
+ if (t._ & REACTIVE_LAZY) {
1717
+ t._ &= ~REACTIVE_LAZY;
1537
1718
  recompute(t, true);
1538
- } else if (t.R & REACTIVE_DISPOSED) {
1719
+ } else if (t._ & REACTIVE_DISPOSED) {
1539
1720
  recompute(t, true);
1540
1721
  }
1541
1722
  }
1542
1723
  const i = e.V || e;
1724
+ if (
1725
+ !n.L &&
1726
+ i === e &&
1727
+ e.K === undefined &&
1728
+ e.pe === undefined &&
1729
+ activeTransition === null &&
1730
+ currentOptimisticLane === null &&
1731
+ !snapshotCaptureActive &&
1732
+ true
1733
+ ) {
1734
+ if (t && tracking) link(e, t);
1735
+ return !t || e.B === NOT_PENDING ? e.ue : e.B;
1736
+ }
1543
1737
  if (t && tracking) {
1544
1738
  link(e, t);
1545
1739
  if (i.L) {
1546
- const n = e.R & REACTIVE_ZOMBIE;
1547
- if (i.o >= (n ? zombieQueue.P : dirtyQueue.P)) {
1740
+ const n = e._ & REACTIVE_ZOMBIE;
1741
+ if (i.o >= (n ? zombieQueue.C : dirtyQueue.C)) {
1548
1742
  markNode(t);
1549
1743
  markHeap(n ? zombieQueue : dirtyQueue);
1550
1744
  updateIfNecessary(i);
@@ -1555,71 +1749,71 @@ function read(e) {
1555
1749
  }
1556
1750
  }
1557
1751
  }
1558
- if (i.Oe & STATUS_PENDING) {
1559
- if (t && !(stale && i.Z && activeTransition !== i.Z)) {
1752
+ if (i.he & STATUS_PENDING) {
1753
+ if (t && !(stale && i.M && activeTransition !== i.M)) {
1560
1754
  if (currentOptimisticLane) {
1561
- const n = i.te;
1755
+ const n = i.G;
1562
1756
  const r = findLane(currentOptimisticLane);
1563
1757
  if (n && findLane(n) === r && !hasActiveOverride(i)) {
1564
1758
  if (!tracking && e !== t) link(e, t);
1565
- throw i.Te;
1759
+ throw i.Re;
1566
1760
  }
1567
1761
  } else {
1568
1762
  if (!tracking && e !== t) link(e, t);
1569
- throw i.Te;
1763
+ throw i.Re;
1570
1764
  }
1571
- } else if (t && i !== e && i.Oe & STATUS_UNINITIALIZED) {
1765
+ } else if (t && i !== e && i.he & STATUS_UNINITIALIZED) {
1572
1766
  if (!tracking && e !== t) link(e, t);
1573
- throw i.Te;
1574
- } else if (!t && i.Oe & STATUS_UNINITIALIZED) {
1575
- throw i.Te;
1767
+ throw i.Re;
1768
+ } else if (!t && i.he & STATUS_UNINITIALIZED) {
1769
+ throw i.Re;
1576
1770
  }
1577
1771
  }
1578
- if (e.L && e.Oe & STATUS_ERROR) {
1579
- if (e.Se < clock) {
1772
+ if (e.L && e.he & STATUS_ERROR) {
1773
+ if (e.Ie < clock) {
1580
1774
  recompute(e);
1581
1775
  return read(e);
1582
- } else throw e.Te;
1776
+ } else throw e.Re;
1583
1777
  }
1584
- if (snapshotCaptureActive && t && t.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
1585
- const n = e.de;
1778
+ if (snapshotCaptureActive && t && t._e & CONFIG_IN_SNAPSHOT_SCOPE) {
1779
+ const n = e.pe;
1586
1780
  if (n !== undefined) {
1587
1781
  const i = n === NO_SNAPSHOT ? undefined : n;
1588
- const r = e.U !== NOT_PENDING ? e.U : e.ne;
1589
- if (r !== i) t.R |= REACTIVE_SNAPSHOT_STALE;
1782
+ const r = e.B !== NOT_PENDING ? e.B : e.ue;
1783
+ if (r !== i) t._ |= REACTIVE_SNAPSHOT_STALE;
1590
1784
  return i;
1591
1785
  }
1592
1786
  }
1593
- if (e.G !== undefined && e.G !== NOT_PENDING) {
1594
- if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ne;
1595
- return e.G;
1787
+ if (e.K !== undefined && e.K !== NOT_PENDING) {
1788
+ if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ue;
1789
+ return e.K;
1596
1790
  }
1597
1791
  if (
1598
1792
  activeTransition !== null &&
1599
1793
  currentOptimisticLane !== null &&
1600
1794
  !latestReadActive &&
1601
- e.U !== NOT_PENDING &&
1795
+ e.B !== NOT_PENDING &&
1602
1796
  i === e &&
1603
1797
  !e.L &&
1604
1798
  t
1605
1799
  ) {
1606
- activeTransition.ee.add(t);
1607
- return e.ne;
1800
+ activeTransition.oe.add(t);
1801
+ return e.ue;
1608
1802
  }
1609
1803
  const r =
1610
1804
  !t ||
1611
1805
  (currentOptimisticLane !== null &&
1612
- (e.G !== undefined || e.te || (i === e && stale) || !!(i.Oe & STATUS_PENDING))) ||
1613
- e.U === NOT_PENDING ||
1614
- (stale && e.Z && activeTransition !== e.Z)
1615
- ? e.ne
1616
- : e.U;
1806
+ (e.K !== undefined || e.G || (i === e && stale) || !!(i.he & STATUS_PENDING))) ||
1807
+ e.B === NOT_PENDING ||
1808
+ (stale && e.M && activeTransition !== e.M)
1809
+ ? e.ue
1810
+ : e.B;
1617
1811
  if (
1618
1812
  !t &&
1619
1813
  i === e &&
1620
1814
  typeof n.L === "function" &&
1621
- e.Ee & CONFIG_AUTO_DISPOSE &&
1622
- !(i.Oe & STATUS_PENDING) &&
1815
+ e._e & CONFIG_AUTO_DISPOSE &&
1816
+ !(i.he & STATUS_PENDING) &&
1623
1817
  !e.I
1624
1818
  ) {
1625
1819
  unobserved(e);
@@ -1627,12 +1821,12 @@ function read(e) {
1627
1821
  return r;
1628
1822
  }
1629
1823
  function setSignal(e, t) {
1630
- if (e.Z && activeTransition !== e.Z) globalQueue.initTransition(e.Z);
1631
- const n = e.G !== undefined && !projectionWriteActive;
1632
- const i = e.G !== undefined && e.G !== NOT_PENDING;
1633
- const r = n ? (i ? e.G : e.ne) : e.U === NOT_PENDING ? e.ne : e.U;
1824
+ if (e.M && activeTransition !== e.M) globalQueue.initTransition(e.M);
1825
+ const n = e.K !== undefined && !projectionWriteActive;
1826
+ const i = e.K !== undefined && e.K !== NOT_PENDING;
1827
+ const r = n ? (i ? e.K : e.ue) : e.B === NOT_PENDING ? e.ue : e.B;
1634
1828
  if (typeof t === "function") t = t(r);
1635
- const s = !e.Le || !e.Le(r, t) || !!(e.Oe & STATUS_UNINITIALIZED);
1829
+ const s = !e.Fe || !e.Fe(r, t) || !!(e.he & STATUS_UNINITIALIZED);
1636
1830
  if (!s) {
1637
1831
  if (n && i && e.L) {
1638
1832
  insertSubs(e, true);
@@ -1641,29 +1835,39 @@ function setSignal(e, t) {
1641
1835
  return t;
1642
1836
  }
1643
1837
  if (n) {
1644
- const n = e.G === NOT_PENDING;
1838
+ const n = e.K === NOT_PENDING;
1645
1839
  if (!n) globalQueue.initTransition(resolveTransition(e));
1646
1840
  if (n) {
1647
- e.U = e.ne;
1648
- globalQueue.q.push(e);
1841
+ e.B = e.ue;
1842
+ globalQueue.Z.push(e);
1649
1843
  }
1650
- e.pe = true;
1844
+ e.$ = true;
1651
1845
  const i = getOrCreateLane(e);
1652
- e.te = i;
1653
- e.G = t;
1846
+ e.G = i;
1847
+ e.K = t;
1654
1848
  } else {
1655
- if (e.U === NOT_PENDING) globalQueue.ue.push(e);
1656
- e.U = t;
1849
+ if (e.B === NOT_PENDING) queuePendingNode(e);
1850
+ e.B = t;
1657
1851
  }
1658
- updatePendingSignal(e);
1659
- if (e.Ue) {
1660
- setSignal(e.Ue, t);
1852
+ if (e.We) updatePendingSignal(e);
1853
+ if (e.ke) {
1854
+ setSignal(e.ke, t);
1661
1855
  }
1662
- e.Se = clock;
1856
+ e.Ie = clock;
1663
1857
  insertSubs(e, n);
1664
1858
  schedule();
1665
1859
  return t;
1666
1860
  }
1861
+ function suppressComputedRecompute(e) {
1862
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1863
+ if (!(e._ & REACTIVE_MANUAL_WRITE) && e.B === NOT_PENDING) queuePendingNode(e);
1864
+ e._ = (e._ & -4) | REACTIVE_MANUAL_WRITE;
1865
+ }
1866
+ function setMemo(e, t) {
1867
+ const n = setSignal(e, t);
1868
+ suppressComputedRecompute(e);
1869
+ return n;
1870
+ }
1667
1871
  function runWithOwner(e, t) {
1668
1872
  const n = context;
1669
1873
  const i = tracking;
@@ -1679,8 +1883,8 @@ function runWithOwner(e, t) {
1679
1883
  function getPendingSignal(e) {
1680
1884
  if (!e.We) {
1681
1885
  e.We = optimisticSignal(false, { ownedWrite: true });
1682
- if (e.Ie) {
1683
- e.We.Ie = e;
1886
+ if (e.U) {
1887
+ e.We.U = e;
1684
1888
  }
1685
1889
  if (computePendingState(e)) setSignal(e.We, true);
1686
1890
  }
@@ -1689,56 +1893,56 @@ function getPendingSignal(e) {
1689
1893
  function computePendingState(e) {
1690
1894
  const t = e;
1691
1895
  const n = e.V;
1692
- if (n && e.U !== NOT_PENDING) {
1693
- return !n.De && !(n.Oe & STATUS_PENDING);
1896
+ if (n && e.B !== NOT_PENDING) {
1897
+ return !n.ve && !(n.he & STATUS_PENDING);
1694
1898
  }
1695
- if (e.G !== undefined && e.G !== NOT_PENDING) {
1696
- if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1697
- if (e.Ie) {
1698
- const t = e.te ? findLane(e.te) : null;
1699
- return !!(t && t.W.size > 0);
1899
+ if (e.K !== undefined && e.K !== NOT_PENDING) {
1900
+ if (t.he & STATUS_PENDING && !(t.he & STATUS_UNINITIALIZED)) return true;
1901
+ if (e.U) {
1902
+ const t = e.G ? findLane(e.G) : null;
1903
+ return !!(t && t.k.size > 0);
1700
1904
  }
1701
1905
  return true;
1702
1906
  }
1703
- if (e.G !== undefined && e.G === NOT_PENDING && !e.Ie) {
1907
+ if (e.K !== undefined && e.K === NOT_PENDING && !e.U) {
1704
1908
  return false;
1705
1909
  }
1706
- if (e.U !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1707
- return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
1910
+ if (e.B !== NOT_PENDING && !(t.he & STATUS_UNINITIALIZED)) return true;
1911
+ return !!(t.he & STATUS_PENDING && !(t.he & STATUS_UNINITIALIZED));
1708
1912
  }
1709
1913
  function updatePendingSignal(e) {
1710
1914
  if (e.We) {
1711
1915
  const t = computePendingState(e);
1712
1916
  const n = e.We;
1713
1917
  setSignal(n, t);
1714
- if (!t && n.te) {
1918
+ if (!t && n.G) {
1715
1919
  const t = resolveLane(e);
1716
- if (t && t.W.size > 0) {
1717
- const e = findLane(n.te);
1920
+ if (t && t.k.size > 0) {
1921
+ const e = findLane(n.G);
1718
1922
  if (e !== t) {
1719
1923
  mergeLanes(t, e);
1720
1924
  }
1721
1925
  }
1722
1926
  signalLanes.delete(n);
1723
- n.te = undefined;
1927
+ n.G = undefined;
1724
1928
  }
1725
1929
  }
1726
1930
  }
1727
1931
  function getLatestValueComputed(e) {
1728
- if (!e.Ue) {
1932
+ if (!e.ke) {
1729
1933
  const t = latestReadActive;
1730
1934
  latestReadActive = false;
1731
1935
  const n = pendingCheckActive;
1732
1936
  pendingCheckActive = false;
1733
1937
  const i = context;
1734
1938
  context = null;
1735
- e.Ue = optimisticComputed(() => read(e));
1736
- e.Ue.Ie = e;
1939
+ e.ke = optimisticComputed(() => read(e));
1940
+ e.ke.U = e;
1737
1941
  context = i;
1738
1942
  pendingCheckActive = n;
1739
1943
  latestReadActive = t;
1740
1944
  }
1741
- return e.Ue;
1945
+ return e.ke;
1742
1946
  }
1743
1947
  function staleValues(e, t = true) {
1744
1948
  const n = stale;
@@ -1777,11 +1981,11 @@ function refresh(e) {
1777
1981
  let t = refreshing;
1778
1982
  refreshing = true;
1779
1983
  try {
1780
- if (typeof e !== "function") {
1781
- recompute(e[$REFRESH]);
1782
- return e;
1984
+ const t = e?.[$REFRESH];
1985
+ if (false && !t);
1986
+ if (t && typeof t.L === "function" && !(t._ & REACTIVE_DISPOSED)) {
1987
+ recompute(t);
1783
1988
  }
1784
- return untrack(e);
1785
1989
  } finally {
1786
1990
  refreshing = t;
1787
1991
  if (!t) {
@@ -1818,102 +2022,92 @@ function isUndefined(e) {
1818
2022
  return typeof e === "undefined";
1819
2023
  }
1820
2024
  function effect(e, t, n, i) {
1821
- let r = false;
1822
- const s = !!i?.user;
1823
- const o = computed(s ? e : t => staleValues(() => e(t)), {
1824
- ...i,
1825
- equals: () => {
1826
- o.j = !o.Te;
1827
- if (r) o.$.enqueue(o.M, runEffect.bind(o));
1828
- return false;
1829
- },
1830
- lazy: true
1831
- });
1832
- o.Ee &= ~CONFIG_AUTO_DISPOSE;
1833
- o.xe = undefined;
1834
- o.He = t;
1835
- o.Me = n;
1836
- o.Qe = undefined;
1837
- o.M = s ? EFFECT_USER : EFFECT_RENDER;
1838
- o.Ge = (e, t) => {
1839
- const n = e !== undefined ? e : o.Oe;
1840
- const i = t !== undefined ? t : o.Te;
1841
- if (n & STATUS_ERROR) {
1842
- let e = i;
1843
- o.$.notify(o, STATUS_PENDING, 0);
1844
- if (o.M === EFFECT_USER) {
1845
- try {
1846
- return o.Me
1847
- ? o.Me(e, () => {
1848
- o.Qe?.();
1849
- o.Qe = undefined;
1850
- })
1851
- : console.error(e);
1852
- } catch (t) {
1853
- e = t;
1854
- }
2025
+ const r = !!i?.user;
2026
+ const s = createEffectNode(e, t, n, r ? EFFECT_USER : EFFECT_RENDER, notifyEffectStatus, i);
2027
+ recompute(s, true);
2028
+ !i?.defer &&
2029
+ (s.J === EFFECT_USER || i?.schedule
2030
+ ? s.te.enqueue(s.J, runEffect.bind(null, s))
2031
+ : runEffect(s));
2032
+ }
2033
+ function notifyEffectStatus(e, t) {
2034
+ const n = e !== undefined ? e : this.he;
2035
+ const i = t !== undefined ? t : this.Re;
2036
+ if (n & STATUS_ERROR) {
2037
+ let e = i;
2038
+ this.te.notify(this, STATUS_PENDING, 0);
2039
+ if (this.J === EFFECT_USER) {
2040
+ try {
2041
+ return this.je
2042
+ ? this.je(e, () => {
2043
+ this.$e?.();
2044
+ this.$e = undefined;
2045
+ })
2046
+ : console.error(e);
2047
+ } catch (t) {
2048
+ e = t;
1855
2049
  }
1856
- if (!o.$.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
1857
- } else if (o.M === EFFECT_RENDER) {
1858
- o.$.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
1859
2050
  }
1860
- };
1861
- recompute(o, true);
1862
- !i?.defer &&
1863
- (o.M === EFFECT_USER || i?.schedule ? o.$.enqueue(o.M, runEffect.bind(o)) : runEffect.call(o));
1864
- r = true;
1865
- cleanup(() => o.Qe?.());
1866
- }
1867
- function runEffect() {
1868
- if (!this.j || this.R & REACTIVE_DISPOSED) return;
1869
- this.Qe?.();
1870
- this.Qe = undefined;
2051
+ if (!this.te.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
2052
+ } else if (this.J === EFFECT_RENDER) {
2053
+ this.te.notify(this, STATUS_PENDING | STATUS_ERROR, n, i);
2054
+ }
2055
+ }
2056
+ function runEffect(e) {
2057
+ if (!e.ee || e._ & REACTIVE_DISPOSED) return;
2058
+ e.$e?.();
2059
+ e.$e = undefined;
1871
2060
  try {
1872
- const e = this.He(this.ne, this.xe);
1873
- if (false && e !== undefined && typeof e !== "function");
1874
- this.Qe = e;
1875
- } catch (e) {
1876
- this.Te = new StatusError(this, e);
1877
- this.Oe |= STATUS_ERROR;
1878
- if (!this.$.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
2061
+ const t = e.Qe(e.ue, e.Me);
2062
+ if (false && t !== undefined && typeof t !== "function");
2063
+ e.$e = t;
2064
+ if (e.$e && !e.Ke) {
2065
+ e.Ke = true;
2066
+ runWithOwner(e.i, () => cleanup(() => e.$e?.()));
2067
+ }
2068
+ } catch (t) {
2069
+ e.Re = new StatusError(e, t);
2070
+ e.he |= STATUS_ERROR;
2071
+ if (!e.te.notify(e, STATUS_ERROR, STATUS_ERROR)) throw t;
1879
2072
  } finally {
1880
- this.xe = this.ne;
1881
- this.j = false;
2073
+ e.Me = e.ue;
2074
+ e.ee = false;
1882
2075
  }
1883
2076
  }
2077
+ GlobalQueue.Te = runEffect;
1884
2078
  function trackedEffect(e, t) {
1885
2079
  const run = () => {
1886
- if (!n.j || n.R & REACTIVE_DISPOSED) return;
2080
+ if (!n.ee || n._ & REACTIVE_DISPOSED) return;
1887
2081
  try {
1888
- n.j = false;
2082
+ n.ee = false;
1889
2083
  recompute(n);
1890
2084
  } finally {
1891
2085
  }
1892
2086
  };
1893
2087
  const n = computed(
1894
2088
  () => {
1895
- n.Qe?.();
1896
- n.Qe = undefined;
2089
+ n.$e?.();
2090
+ n.$e = undefined;
1897
2091
  const t = staleValues(e);
1898
- n.Qe = t;
2092
+ n.$e = t;
1899
2093
  },
1900
2094
  { ...t, lazy: true }
1901
2095
  );
1902
- n.Qe = undefined;
1903
- n.Ee = (n.Ee & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
1904
- n.j = true;
1905
- n.M = EFFECT_TRACKED;
1906
- n.Ge = (e, t) => {
1907
- const i = e !== undefined ? e : n.Oe;
2096
+ n.$e = undefined;
2097
+ n._e = (n._e & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
2098
+ n.ee = true;
2099
+ n.J = EFFECT_TRACKED;
2100
+ n.xe = (e, t) => {
2101
+ const i = e !== undefined ? e : n.he;
1908
2102
  if (i & STATUS_ERROR) {
1909
- n.$.notify(n, STATUS_PENDING, 0);
1910
- const e = t !== undefined ? t : n.Te;
1911
- if (!n.$.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
2103
+ n.te.notify(n, STATUS_PENDING, 0);
2104
+ const e = t !== undefined ? t : n.Re;
2105
+ if (!n.te.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
1912
2106
  }
1913
2107
  };
1914
- n.K = run;
1915
- n.$.enqueue(EFFECT_USER, run);
1916
- cleanup(() => n.Qe?.());
2108
+ n.ne = run;
2109
+ n.te.enqueue(EFFECT_USER, run);
2110
+ cleanup(() => n.$e?.());
1917
2111
  }
1918
2112
  function restoreTransition(e, t) {
1919
2113
  globalQueue.initTransition(e);
@@ -1927,11 +2121,11 @@ function action(e) {
1927
2121
  const r = e(...t);
1928
2122
  globalQueue.initTransition();
1929
2123
  let s = activeTransition;
1930
- s.B.push(r);
2124
+ s.re.push(r);
1931
2125
  const done = (e, t) => {
1932
2126
  s = currentTransition(s);
1933
- const o = s.B.indexOf(r);
1934
- if (o >= 0) s.B.splice(o, 1);
2127
+ const o = s.re.indexOf(r);
2128
+ if (o >= 0) s.re.splice(o, 1);
1935
2129
  setActiveTransition(s);
1936
2130
  schedule();
1937
2131
  t ? i(t) : n(e);
@@ -1963,13 +2157,15 @@ function onCleanup(e) {
1963
2157
  return cleanup(e);
1964
2158
  }
1965
2159
  function accessor(e) {
1966
- return read.bind(null, e);
2160
+ const t = read.bind(null, e);
2161
+ t[$REFRESH] = e;
2162
+ return t;
1967
2163
  }
1968
2164
  function createSignal(e, t) {
1969
2165
  if (typeof e === "function") {
1970
2166
  const n = computed(e, t);
1971
- n.Ee &= ~CONFIG_AUTO_DISPOSE;
1972
- return [accessor(n), setSignal.bind(null, n)];
2167
+ n._e &= ~CONFIG_AUTO_DISPOSE;
2168
+ return [accessor(n), setMemo.bind(null, n)];
1973
2169
  }
1974
2170
  const n = signal(e, t);
1975
2171
  return [accessor(n), setSignal.bind(null, n)];
@@ -2025,7 +2221,7 @@ function resolve(e) {
2025
2221
  function createOptimistic(e, t) {
2026
2222
  if (typeof e === "function") {
2027
2223
  const n = optimisticComputed(e, t);
2028
- n.Ee &= ~CONFIG_AUTO_DISPOSE;
2224
+ n._e &= ~CONFIG_AUTO_DISPOSE;
2029
2225
  return [accessor(n), setSignal.bind(null, n)];
2030
2226
  }
2031
2227
  const n = optimisticSignal(e, t);
@@ -2033,7 +2229,7 @@ function createOptimistic(e, t) {
2033
2229
  }
2034
2230
  function onSettled(e) {
2035
2231
  const t = getOwner();
2036
- t && !(t.Ee & CONFIG_CHILDREN_FORBIDDEN)
2232
+ t && !(t._e & CONFIG_CHILDREN_FORBIDDEN)
2037
2233
  ? createTrackedEffect(() => untrack(e), undefined)
2038
2234
  : globalQueue.enqueue(EFFECT_USER, () => {
2039
2235
  const t = e();
@@ -2043,9 +2239,9 @@ function onSettled(e) {
2043
2239
  function unwrap(e) {
2044
2240
  return e?.[$TARGET]?.[STORE_NODE] ?? e;
2045
2241
  }
2046
- function getOverrideValue(e, t, n, i, r) {
2047
- if (r && i in r) return r[i];
2048
- return t && i in t ? t[i] : e[i];
2242
+ function getOverrideValue(e, t, n, i) {
2243
+ if (i && n in i) return i[n];
2244
+ return t && n in t ? t[n] : e[n];
2049
2245
  }
2050
2246
  function getAllKeys(e, t, n) {
2051
2247
  const i = getKeys(e, t);
@@ -2055,114 +2251,225 @@ function getAllKeys(e, t, n) {
2055
2251
  function applyState(e, t, n) {
2056
2252
  const i = t?.[$TARGET];
2057
2253
  if (!i) return;
2058
- const r = i[STORE_VALUE];
2059
- const s = i[STORE_OVERRIDE];
2060
- const o = i[STORE_OPTIMISTIC_OVERRIDE];
2061
- let u = i[STORE_NODE];
2062
- if (e === r && !s && !o) return;
2063
- (i[STORE_LOOKUP] || storeLookup).set(e, i[$PROXY]);
2064
- i[STORE_VALUE] = e;
2065
- i[STORE_OVERRIDE] = undefined;
2066
- if (Array.isArray(r)) {
2067
- let t = false;
2068
- const c = getOverrideValue(r, s, u, "length", o);
2069
- if (e.length && c && e[0] && n(e[0]) != null) {
2070
- let a, l, f, E, T, S, d, O;
2254
+ if (i[STORE_OVERRIDE] || i[STORE_OPTIMISTIC_OVERRIDE]) {
2255
+ applyStateSlow(e, i, n);
2256
+ } else {
2257
+ applyStateFast(e, i, n);
2258
+ }
2259
+ }
2260
+ function applyStateFast(e, t, n) {
2261
+ const i = t[STORE_VALUE];
2262
+ if (e === i) return;
2263
+ (t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
2264
+ t[STORE_VALUE] = e;
2265
+ if (Array.isArray(i)) {
2266
+ let r = false;
2267
+ const s = i.length;
2268
+ if (e.length && s && e[0] && n(e[0]) != null) {
2269
+ let o, u, l, c, a, f, E, S;
2270
+ for (
2271
+ l = 0, c = Math.min(s, e.length);
2272
+ l < c && ((f = i[l]) === e[l] || (f && e[l] && n(f) === n(e[l])));
2273
+ l++
2274
+ ) {
2275
+ applyState(e[l], wrap(f, t), n);
2276
+ }
2277
+ const T = new Array(e.length),
2278
+ d = new Map();
2279
+ for (
2280
+ c = s - 1, a = e.length - 1;
2281
+ c >= l && a >= l && ((f = i[c]) === e[a] || (f && e[a] && n(f) === n(e[a])));
2282
+ c--, a--
2283
+ ) {
2284
+ T[a] = f;
2285
+ }
2286
+ if (l > a || l > c) {
2287
+ for (u = l; u <= a; u++) {
2288
+ r = true;
2289
+ t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], wrap(e[u], t));
2290
+ }
2291
+ for (; u < e.length; u++) {
2292
+ r = true;
2293
+ const i = wrap(T[u], t);
2294
+ t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], i);
2295
+ applyState(e[u], i, n);
2296
+ }
2297
+ r && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
2298
+ s !== e.length && t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
2299
+ return;
2300
+ }
2301
+ E = new Array(a + 1);
2302
+ for (u = a; u >= l; u--) {
2303
+ f = e[u];
2304
+ S = f ? n(f) : f;
2305
+ o = d.get(S);
2306
+ E[u] = o === undefined ? -1 : o;
2307
+ d.set(S, u);
2308
+ }
2309
+ for (o = l; o <= c; o++) {
2310
+ f = i[o];
2311
+ S = f ? n(f) : f;
2312
+ u = d.get(S);
2313
+ if (u !== undefined && u !== -1) {
2314
+ T[u] = f;
2315
+ u = E[u];
2316
+ d.set(S, u);
2317
+ }
2318
+ }
2319
+ for (u = l; u < e.length; u++) {
2320
+ if (u in T) {
2321
+ const i = wrap(T[u], t);
2322
+ t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], i);
2323
+ applyState(e[u], i, n);
2324
+ } else t[STORE_NODE][u] && setSignal(t[STORE_NODE][u], wrap(e[u], t));
2325
+ }
2326
+ if (l < e.length) r = true;
2327
+ } else if (e.length) {
2328
+ for (let r = 0, s = e.length; r < s; r++) {
2329
+ const s = i[r];
2330
+ isWrappable(s)
2331
+ ? applyState(e[r], wrap(s, t), n)
2332
+ : t[STORE_NODE][r] && setSignal(t[STORE_NODE][r], e[r]);
2333
+ }
2334
+ }
2335
+ if (s !== e.length) {
2336
+ r = true;
2337
+ t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
2338
+ }
2339
+ r && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
2340
+ return;
2341
+ }
2342
+ let r = t[STORE_NODE];
2343
+ if (r) {
2344
+ const s = r[$TRACK];
2345
+ const o = s ? getAllKeys(i, undefined, e) : Object.keys(r);
2346
+ for (let u = 0, l = o.length; u < l; u++) {
2347
+ const l = o[u];
2348
+ const c = r[l];
2349
+ const a = unwrap(i[l]);
2350
+ let f = unwrap(e[l]);
2351
+ if (a === f) continue;
2352
+ if (!a || !isWrappable(a) || !isWrappable(f) || (n(a) != null && n(a) !== n(f))) {
2353
+ s && setSignal(s, void 0);
2354
+ c && setSignal(c, isWrappable(f) ? wrap(f, t) : f);
2355
+ } else applyState(f, wrap(a, t), n);
2356
+ }
2357
+ }
2358
+ if ((r = t[STORE_HAS])) {
2359
+ const t = Object.keys(r);
2360
+ for (let n = 0, i = t.length; n < i; n++) {
2361
+ const i = t[n];
2362
+ setSignal(r[i], i in e);
2363
+ }
2364
+ }
2365
+ }
2366
+ function applyStateSlow(e, t, n) {
2367
+ const i = t[STORE_VALUE];
2368
+ const r = t[STORE_OVERRIDE];
2369
+ const s = t[STORE_OPTIMISTIC_OVERRIDE];
2370
+ let o = t[STORE_NODE];
2371
+ (t[STORE_LOOKUP] || storeLookup).set(e, t[$PROXY]);
2372
+ t[STORE_VALUE] = e;
2373
+ t[STORE_OVERRIDE] = undefined;
2374
+ if (Array.isArray(i)) {
2375
+ let o = false;
2376
+ const u = getOverrideValue(i, r, "length", s);
2377
+ if (e.length && u && e[0] && n(e[0]) != null) {
2378
+ let l, c, a, f, E, S, T, d;
2071
2379
  for (
2072
- f = 0, E = Math.min(c, e.length);
2073
- f < E &&
2074
- ((S = getOverrideValue(r, s, u, f, o)) === e[f] || (S && e[f] && n(S) === n(e[f])));
2075
- f++
2380
+ a = 0, f = Math.min(u, e.length);
2381
+ a < f && ((S = getOverrideValue(i, r, a, s)) === e[a] || (S && e[a] && n(S) === n(e[a])));
2382
+ a++
2076
2383
  ) {
2077
- applyState(e[f], wrap(S, i), n);
2384
+ applyState(e[a], wrap(S, t), n);
2078
2385
  }
2079
- const R = new Array(e.length),
2386
+ const O = new Array(e.length),
2080
2387
  _ = new Map();
2081
2388
  for (
2082
- E = c - 1, T = e.length - 1;
2083
- E >= f &&
2084
- T >= f &&
2085
- ((S = getOverrideValue(r, s, u, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
2086
- E--, T--
2389
+ f = u - 1, E = e.length - 1;
2390
+ f >= a &&
2391
+ E >= a &&
2392
+ ((S = getOverrideValue(i, r, f, s)) === e[E] || (S && e[E] && n(S) === n(e[E])));
2393
+ f--, E--
2087
2394
  ) {
2088
- R[T] = S;
2395
+ O[E] = S;
2089
2396
  }
2090
- if (f > T || f > E) {
2091
- for (l = f; l <= T; l++) {
2092
- t = true;
2093
- i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
2397
+ if (a > E || a > f) {
2398
+ for (c = a; c <= E; c++) {
2399
+ o = true;
2400
+ t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], wrap(e[c], t));
2094
2401
  }
2095
- for (; l < e.length; l++) {
2096
- t = true;
2097
- const r = wrap(R[l], i);
2098
- i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], r);
2099
- applyState(e[l], r, n);
2402
+ for (; c < e.length; c++) {
2403
+ o = true;
2404
+ const i = wrap(O[c], t);
2405
+ t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], i);
2406
+ applyState(e[c], i, n);
2100
2407
  }
2101
- t && i[STORE_NODE][$TRACK] && setSignal(i[STORE_NODE][$TRACK], void 0);
2102
- c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
2408
+ o && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
2409
+ u !== e.length && t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
2103
2410
  return;
2104
2411
  }
2105
- d = new Array(T + 1);
2106
- for (l = T; l >= f; l--) {
2107
- S = e[l];
2108
- O = S ? n(S) : S;
2109
- a = _.get(O);
2110
- d[l] = a === undefined ? -1 : a;
2111
- _.set(O, l);
2112
- }
2113
- for (a = f; a <= E; a++) {
2114
- S = getOverrideValue(r, s, u, a, o);
2115
- O = S ? n(S) : S;
2116
- l = _.get(O);
2117
- if (l !== undefined && l !== -1) {
2118
- R[l] = S;
2119
- l = d[l];
2120
- _.set(O, l);
2412
+ T = new Array(E + 1);
2413
+ for (c = E; c >= a; c--) {
2414
+ S = e[c];
2415
+ d = S ? n(S) : S;
2416
+ l = _.get(d);
2417
+ T[c] = l === undefined ? -1 : l;
2418
+ _.set(d, c);
2419
+ }
2420
+ for (l = a; l <= f; l++) {
2421
+ S = getOverrideValue(i, r, l, s);
2422
+ d = S ? n(S) : S;
2423
+ c = _.get(d);
2424
+ if (c !== undefined && c !== -1) {
2425
+ O[c] = S;
2426
+ c = T[c];
2427
+ _.set(d, c);
2121
2428
  }
2122
2429
  }
2123
- for (l = f; l < e.length; l++) {
2124
- if (l in R) {
2125
- const t = wrap(R[l], i);
2126
- i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], t);
2127
- applyState(e[l], t, n);
2128
- } else i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
2430
+ for (c = a; c < e.length; c++) {
2431
+ if (c in O) {
2432
+ const i = wrap(O[c], t);
2433
+ t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], i);
2434
+ applyState(e[c], i, n);
2435
+ } else t[STORE_NODE][c] && setSignal(t[STORE_NODE][c], wrap(e[c], t));
2129
2436
  }
2130
- if (f < e.length) t = true;
2437
+ if (a < e.length) o = true;
2131
2438
  } else if (e.length) {
2132
- for (let t = 0, c = e.length; t < c; t++) {
2133
- const c = getOverrideValue(r, s, u, t, o);
2134
- isWrappable(c)
2135
- ? applyState(e[t], wrap(c, i), n)
2136
- : i[STORE_NODE][t] && setSignal(i[STORE_NODE][t], e[t]);
2439
+ for (let o = 0, u = e.length; o < u; o++) {
2440
+ const u = getOverrideValue(i, r, o, s);
2441
+ isWrappable(u)
2442
+ ? applyState(e[o], wrap(u, t), n)
2443
+ : t[STORE_NODE][o] && setSignal(t[STORE_NODE][o], e[o]);
2137
2444
  }
2138
2445
  }
2139
- if (c !== e.length) {
2140
- t = true;
2141
- i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
2446
+ if (u !== e.length) {
2447
+ o = true;
2448
+ t[STORE_NODE].length && setSignal(t[STORE_NODE].length, e.length);
2142
2449
  }
2143
- t && i[STORE_NODE][$TRACK] && setSignal(i[STORE_NODE][$TRACK], void 0);
2450
+ o && t[STORE_NODE][$TRACK] && setSignal(t[STORE_NODE][$TRACK], void 0);
2144
2451
  return;
2145
2452
  }
2146
- if (u) {
2147
- const t = u[$TRACK];
2148
- const c = t ? getAllKeys(r, s, e) : Object.keys(u);
2149
- for (let a = 0, l = c.length; a < l; a++) {
2150
- const l = c[a];
2151
- const f = u[l];
2152
- const E = unwrap(getOverrideValue(r, s, u, l, o));
2153
- let T = unwrap(e[l]);
2154
- if (E === T) continue;
2155
- if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
2156
- t && setSignal(t, void 0);
2157
- f && setSignal(f, isWrappable(T) ? wrap(T, i) : T);
2158
- } else applyState(T, wrap(E, i), n);
2159
- }
2160
- }
2161
- if ((u = i[STORE_HAS])) {
2162
- const t = Object.keys(u);
2453
+ if (o) {
2454
+ const u = o[$TRACK];
2455
+ const l = u ? getAllKeys(i, r, e) : Object.keys(o);
2456
+ for (let c = 0, a = l.length; c < a; c++) {
2457
+ const a = l[c];
2458
+ const f = o[a];
2459
+ const E = unwrap(getOverrideValue(i, r, a, s));
2460
+ let S = unwrap(e[a]);
2461
+ if (E === S) continue;
2462
+ if (!E || !isWrappable(E) || !isWrappable(S) || (n(E) != null && n(E) !== n(S))) {
2463
+ u && setSignal(u, void 0);
2464
+ f && setSignal(f, isWrappable(S) ? wrap(S, t) : S);
2465
+ } else applyState(S, wrap(E, t), n);
2466
+ }
2467
+ }
2468
+ if ((o = t[STORE_HAS])) {
2469
+ const t = Object.keys(o);
2163
2470
  for (let n = 0, i = t.length; n < i; n++) {
2164
2471
  const i = t[n];
2165
- setSignal(u[i], i in e);
2472
+ setSignal(o[i], i in e);
2166
2473
  }
2167
2474
  }
2168
2475
  }
@@ -2201,7 +2508,7 @@ function createProjectionInternal(e, t, n) {
2201
2508
  if (!i) i = getOwner();
2202
2509
  runProjectionComputed(s, e, n?.key || "id");
2203
2510
  }, undefined);
2204
- i.Ee &= ~CONFIG_AUTO_DISPOSE;
2511
+ i._e &= ~CONFIG_AUTO_DISPOSE;
2205
2512
  return { store: s, node: i };
2206
2513
  }
2207
2514
  function createProjection(e, t, n) {
@@ -2213,7 +2520,7 @@ function runProjectionComputed(e, t, n, i) {
2213
2520
  let o;
2214
2521
  const u = new Proxy(
2215
2522
  e,
2216
- createWriteTraps(() => !s || r.De === o)
2523
+ createWriteTraps(() => !s || r.ve === o)
2217
2524
  );
2218
2525
  storeSetter(u, u => {
2219
2526
  o = t(u);
@@ -2299,8 +2606,14 @@ function createStoreProxy(e, t = storeTraps, n) {
2299
2606
  if (Array.isArray(e)) {
2300
2607
  i = [];
2301
2608
  i.v = e;
2302
- } else i = { v: e };
2303
- i[STORE_CUSTOM_PROTO] = hasCustomPrototype(unwrapStoreValue(e));
2609
+ } else {
2610
+ i = { v: e };
2611
+ const t = e?.[$TARGET]?.[STORE_VALUE] ?? e;
2612
+ const n = Object.getPrototypeOf(t);
2613
+ if (n !== null && n !== Object.prototype) {
2614
+ i[STORE_CUSTOM_PROTO] = true;
2615
+ }
2616
+ }
2304
2617
  n && n(i);
2305
2618
  return (i[$PROXY] = new Proxy(i, t));
2306
2619
  }
@@ -2312,12 +2625,8 @@ function wrap(e, t) {
2312
2625
  return n;
2313
2626
  }
2314
2627
  function isWrappable(e) {
2315
- return (
2316
- e != null &&
2317
- typeof e === "object" &&
2318
- !Object.isFrozen(e) &&
2319
- !(typeof Node !== "undefined" && e instanceof Node)
2320
- );
2628
+ if (e == null || typeof e !== "object" || Object.isFrozen(e)) return false;
2629
+ return typeof Node === "undefined" || !(e instanceof Node);
2321
2630
  }
2322
2631
  let writeOverride = false;
2323
2632
  function setWriteOverride(e) {
@@ -2329,11 +2638,6 @@ function writeOnly(e) {
2329
2638
  function unwrapStoreValue(e) {
2330
2639
  return e?.[$TARGET]?.[STORE_VALUE] ?? e;
2331
2640
  }
2332
- function hasCustomPrototype(e) {
2333
- if (Array.isArray(e)) return false;
2334
- const t = Object.getPrototypeOf(e);
2335
- return t !== null && t !== Object.prototype;
2336
- }
2337
2641
  function hasInheritedAccessor(e, t) {
2338
2642
  let n = Object.getPrototypeOf(e);
2339
2643
  while (n && n !== Object.prototype) {
@@ -2361,11 +2665,11 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
2361
2665
  i
2362
2666
  );
2363
2667
  if (s) {
2364
- u.G = NOT_PENDING;
2668
+ u.K = NOT_PENDING;
2365
2669
  }
2366
2670
  if (o && t in o) {
2367
2671
  const e = o[t];
2368
- u.de = e === undefined ? NO_SNAPSHOT : e;
2672
+ u.pe = e === undefined ? NO_SNAPSHOT : e;
2369
2673
  snapshotSources?.add(u);
2370
2674
  }
2371
2675
  return (e[t] = u);
@@ -2398,8 +2702,8 @@ function getPropertyDescriptor(e, t, n) {
2398
2702
  function prepareStoreWrite(e, t, n) {
2399
2703
  if (e[STORE_OPTIMISTIC]) {
2400
2704
  const t = e[STORE_FIREWALL];
2401
- if (t?.Z) {
2402
- globalQueue.initTransition(t.Z);
2705
+ if (t?.M) {
2706
+ globalQueue.initTransition(t.M);
2403
2707
  }
2404
2708
  }
2405
2709
  const i = e[STORE_VALUE];
@@ -2407,7 +2711,7 @@ function prepareStoreWrite(e, t, n) {
2407
2711
  if (
2408
2712
  snapshotCaptureActive &&
2409
2713
  typeof n !== "symbol" &&
2410
- !((e[STORE_FIREWALL]?.Oe ?? 0) & STATUS_PENDING)
2714
+ !((e[STORE_FIREWALL]?.he ?? 0) & STATUS_PENDING)
2411
2715
  ) {
2412
2716
  if (!e[STORE_SNAPSHOT_PROPS]) {
2413
2717
  e[STORE_SNAPSHOT_PROPS] = Object.create(null);
@@ -2432,35 +2736,35 @@ function upsertStoreNode(e, t, n, i, r) {
2432
2736
  function notifyStoreProperty(e, t, n, i, r, s) {
2433
2737
  const o = projectionWriteActive || e[STORE_OPTIMISTIC];
2434
2738
  const u = n !== "delete";
2435
- const c = e[STORE_HAS]?.[t];
2436
- if (c) {
2437
- setSignal(c, u);
2739
+ const l = e[STORE_HAS]?.[t];
2740
+ if (l) {
2741
+ setSignal(l, u);
2438
2742
  } else if (!o && n !== "invalidate" && s !== u) {
2439
2743
  const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, s);
2440
2744
  setSignal(n, u);
2441
2745
  }
2442
- const a = getNodes(e, STORE_NODE);
2746
+ const c = getNodes(e, STORE_NODE);
2443
2747
  if (n === "set") {
2444
- if (a[t]) {
2445
- setSignal(a[t], () => (isWrappable(i) ? wrap(i, e) : i));
2748
+ if (c[t]) {
2749
+ setSignal(c[t], () => (isWrappable(i) ? wrap(i, e) : i));
2446
2750
  } else if (!o) {
2447
- const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
2751
+ const n = upsertStoreNode(e, c, t, r, e[STORE_SNAPSHOT_PROPS]);
2448
2752
  setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
2449
2753
  }
2450
2754
  } else if (n === "invalidate") {
2451
- if (a[t]) {
2452
- setSignal(a[t], {});
2453
- delete a[t];
2755
+ if (c[t]) {
2756
+ setSignal(c[t], {});
2757
+ delete c[t];
2454
2758
  }
2455
2759
  } else {
2456
- if (a[t]) {
2457
- setSignal(a[t], undefined);
2760
+ if (c[t]) {
2761
+ setSignal(c[t], undefined);
2458
2762
  } else if (!o) {
2459
- const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
2763
+ const n = upsertStoreNode(e, c, t, r, e[STORE_SNAPSHOT_PROPS]);
2460
2764
  setSignal(n, undefined);
2461
2765
  }
2462
2766
  }
2463
- a[$TRACK] && setSignal(a[$TRACK], undefined);
2767
+ c[$TRACK] && setSignal(c[$TRACK], undefined);
2464
2768
  }
2465
2769
  let Writing = null;
2466
2770
  const storeTraps = {
@@ -2474,10 +2778,25 @@ const storeTraps = {
2474
2778
  }
2475
2779
  const i = getNodes(e, STORE_NODE);
2476
2780
  const r = i[t];
2477
- const s = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
2478
- const o = s || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
2479
- const u = !!e[STORE_VALUE][$TARGET];
2480
- const c = s
2781
+ const s = e[STORE_VALUE];
2782
+ if (
2783
+ !r &&
2784
+ !e[STORE_OVERRIDE] &&
2785
+ !e[STORE_OPTIMISTIC_OVERRIDE] &&
2786
+ !e[STORE_CUSTOM_PROTO] &&
2787
+ !e[STORE_OPTIMISTIC] &&
2788
+ !e[STORE_SNAPSHOT_PROPS] &&
2789
+ !s[$TARGET] &&
2790
+ !(t in s) &&
2791
+ getObserver() &&
2792
+ !writeOnly(n)
2793
+ ) {
2794
+ return read(getNode(i, t, undefined, e[STORE_FIREWALL]));
2795
+ }
2796
+ const o = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
2797
+ const u = o || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
2798
+ const l = !!e[STORE_VALUE][$TARGET];
2799
+ const c = o
2481
2800
  ? e[STORE_OPTIMISTIC_OVERRIDE]
2482
2801
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2483
2802
  ? e[STORE_OVERRIDE]
@@ -2485,7 +2804,7 @@ const storeTraps = {
2485
2804
  if (!r) {
2486
2805
  const i = Object.getOwnPropertyDescriptor(c, t);
2487
2806
  if (i && i.get) return i.get.call(n);
2488
- if (!i && !o && e[STORE_CUSTOM_PROTO]) {
2807
+ if (!i && !u && e[STORE_CUSTOM_PROTO]) {
2489
2808
  const e = unwrapStoreValue(c);
2490
2809
  if (hasInheritedAccessor(e, t)) {
2491
2810
  return Reflect.get(c, t, n);
@@ -2494,12 +2813,12 @@ const storeTraps = {
2494
2813
  }
2495
2814
  if (writeOnly(n)) {
2496
2815
  let n =
2497
- r && (o || !u)
2498
- ? r.G !== undefined && r.G !== NOT_PENDING
2499
- ? r.G
2500
- : r.U !== NOT_PENDING
2501
- ? r.U
2502
- : r.ne
2816
+ r && (u || !l)
2817
+ ? r.K !== undefined && r.K !== NOT_PENDING
2818
+ ? r.K
2819
+ : r.B !== NOT_PENDING
2820
+ ? r.B
2821
+ : r.ue
2503
2822
  : c[t];
2504
2823
  n === $DELETED && (n = undefined);
2505
2824
  if (!isWrappable(n)) return n;
@@ -2507,10 +2826,10 @@ const storeTraps = {
2507
2826
  Writing?.add(i);
2508
2827
  return i;
2509
2828
  }
2510
- let a = r ? (o || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
2829
+ let a = r ? (u || !l ? read(i[t]) : (read(i[t]), c[t])) : c[t];
2511
2830
  a === $DELETED && (a = undefined);
2512
2831
  if (!r) {
2513
- if (!o && typeof a === "function" && !c.hasOwnProperty(t)) {
2832
+ if (!u && typeof a === "function" && !c.hasOwnProperty(t)) {
2514
2833
  let t;
2515
2834
  return !Array.isArray(e[STORE_VALUE]) &&
2516
2835
  (t = Object.getPrototypeOf(e[STORE_VALUE])) &&
@@ -2560,38 +2879,38 @@ const storeTraps = {
2560
2879
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2561
2880
  ? e[STORE_OVERRIDE][t]
2562
2881
  : r;
2563
- const c =
2882
+ const l =
2564
2883
  e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
2565
2884
  ? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
2566
2885
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2567
2886
  ? e[STORE_OVERRIDE][t] !== $DELETED
2568
2887
  : t in e[STORE_VALUE];
2569
- const a = unwrapStoreValue(n);
2570
- const l = Array.isArray(o) && t !== "length";
2571
- const f = l ? parseInt(t) + 1 : 0;
2888
+ const c = unwrapStoreValue(n);
2889
+ const a = Array.isArray(o) && t !== "length";
2890
+ const f = a ? parseInt(t) + 1 : 0;
2572
2891
  const E =
2573
- l &&
2892
+ a &&
2574
2893
  (e[STORE_OPTIMISTIC_OVERRIDE] && "length" in e[STORE_OPTIMISTIC_OVERRIDE]
2575
2894
  ? e[STORE_OPTIMISTIC_OVERRIDE].length
2576
2895
  : e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
2577
2896
  ? e[STORE_OVERRIDE].length
2578
2897
  : o.length);
2579
- const T = l && f > E ? f : undefined;
2580
- if (u === a && T === undefined) return true;
2581
- if (a !== undefined && a === r && T === undefined) delete e[s]?.[t];
2898
+ const S = a && f > E ? f : undefined;
2899
+ if (u === c && S === undefined) return true;
2900
+ if (c !== undefined && c === r && S === undefined) delete e[s]?.[t];
2582
2901
  else {
2583
2902
  const n = e[s] || (e[s] = Object.create(null));
2584
- n[t] = a;
2585
- if (T !== undefined) n.length = T;
2903
+ n[t] = c;
2904
+ if (S !== undefined) n.length = S;
2586
2905
  }
2587
- notifyStoreProperty(e, t, "set", a, u, c);
2588
- if (Array.isArray(o) && t !== "length" && T !== undefined) {
2906
+ notifyStoreProperty(e, t, "set", c, u, l);
2907
+ if (Array.isArray(o) && t !== "length" && S !== undefined) {
2589
2908
  const t = getNodes(e, STORE_NODE);
2590
2909
  if (t.length) {
2591
- setSignal(t.length, T);
2910
+ setSignal(t.length, S);
2592
2911
  } else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
2593
2912
  const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
2594
- setSignal(n, T);
2913
+ setSignal(n, S);
2595
2914
  }
2596
2915
  }
2597
2916
  if (false);
@@ -2698,10 +3017,13 @@ function storeSetter(e, t) {
2698
3017
  function createStore(e, t, n) {
2699
3018
  const i = typeof e === "function",
2700
3019
  r = i ? createProjectionInternal(e, t, n).store : wrap(e);
2701
- return [r, e => storeSetter(r, e)];
3020
+ return [
3021
+ r,
3022
+ i ? e => (storeSetter(r, e), suppressComputedRecompute(r[$REFRESH])) : e => storeSetter(r, e)
3023
+ ];
2702
3024
  }
2703
3025
  function createOptimisticStore(e, t, n) {
2704
- GlobalQueue.le ||= clearOptimisticStore;
3026
+ GlobalQueue.de ||= clearOptimisticStore;
2705
3027
  const i = typeof e === "function";
2706
3028
  const r = i ? t : e;
2707
3029
  const s = i ? e : undefined;
@@ -2718,7 +3040,7 @@ function clearOptimisticStore(e) {
2718
3040
  if (i) {
2719
3041
  for (const e of Reflect.ownKeys(n)) {
2720
3042
  if (i[e]) {
2721
- i[e].te = undefined;
3043
+ i[e].G = undefined;
2722
3044
  const n =
2723
3045
  t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
2724
3046
  const r = n === $DELETED ? undefined : n;
@@ -2726,7 +3048,7 @@ function clearOptimisticStore(e) {
2726
3048
  }
2727
3049
  }
2728
3050
  if (i[$TRACK]) {
2729
- i[$TRACK].te = undefined;
3051
+ i[$TRACK].G = undefined;
2730
3052
  setSignal(i[$TRACK], undefined);
2731
3053
  }
2732
3054
  }
@@ -2774,7 +3096,7 @@ function createOptimisticProjectionInternal(e, t, n) {
2774
3096
  setProjectionWriteActive(false);
2775
3097
  }
2776
3098
  }, undefined);
2777
- i.Ee &= ~CONFIG_AUTO_DISPOSE;
3099
+ i._e &= ~CONFIG_AUTO_DISPOSE;
2778
3100
  }
2779
3101
  return { store: s, node: i };
2780
3102
  }
@@ -2851,7 +3173,7 @@ const storePath = Object.assign(
2851
3173
  { DELETE: DELETE }
2852
3174
  );
2853
3175
  function snapshotImpl(e, t, n, i) {
2854
- let r, s, o, u, c, a;
3176
+ let r, s, o, u, l, c;
2855
3177
  if (!isWrappable(e)) return e;
2856
3178
  if (n && n.has(e)) return n.get(e);
2857
3179
  if (!n) n = new Map();
@@ -2871,29 +3193,29 @@ function snapshotImpl(e, t, n, i) {
2871
3193
  }
2872
3194
  if (s) {
2873
3195
  const s = o?.length || e.length;
2874
- for (let l = 0; l < s; l++) {
2875
- a = o && l in o ? o[l] : e[l];
2876
- if (a === $DELETED) continue;
2877
- if (t && isWrappable(a)) wrap(a, r);
2878
- if ((c = snapshotImpl(a, t, n, i)) !== a || u) {
3196
+ for (let a = 0; a < s; a++) {
3197
+ c = o && a in o ? o[a] : e[a];
3198
+ if (c === $DELETED) continue;
3199
+ if (t && isWrappable(c)) wrap(c, r);
3200
+ if ((l = snapshotImpl(c, t, n, i)) !== c || u) {
2879
3201
  if (!u) n.set(e, (u = [...e]));
2880
- u[l] = c;
3202
+ u[a] = l;
2881
3203
  }
2882
3204
  }
2883
3205
  } else {
2884
3206
  const s = getKeys(e, o);
2885
- for (let l = 0, f = s.length; l < f; l++) {
2886
- let f = s[l];
3207
+ for (let a = 0, f = s.length; a < f; a++) {
3208
+ let f = s[a];
2887
3209
  const E = getPropertyDescriptor(e, o, f);
2888
3210
  if (E.get) continue;
2889
- a = o && f in o ? o[f] : e[f];
2890
- if (t && isWrappable(a)) wrap(a, r);
2891
- if ((c = snapshotImpl(a, t, n, i)) !== e[f] || u) {
3211
+ c = o && f in o ? o[f] : e[f];
3212
+ if (t && isWrappable(c)) wrap(c, r);
3213
+ if ((l = snapshotImpl(c, t, n, i)) !== e[f] || u) {
2892
3214
  if (!u) {
2893
3215
  u = Object.create(Object.getPrototypeOf(e));
2894
3216
  Object.assign(u, e);
2895
3217
  }
2896
- u[f] = c;
3218
+ u[f] = l;
2897
3219
  }
2898
3220
  }
2899
3221
  }
@@ -2946,8 +3268,9 @@ function merge(...e) {
2946
3268
  const r = e[i];
2947
3269
  t = t || (!!r && $PROXY in r);
2948
3270
  const s = !!r && r[$SOURCES];
2949
- if (s) n.push(...s);
2950
- else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
3271
+ if (s) {
3272
+ for (let e = 0; e < s.length; e++) n.push(s[e]);
3273
+ } else n.push(typeof r === "function" ? ((t = true), createMemo(r)) : r);
2951
3274
  }
2952
3275
  if (SUPPORTS_PROXY && t) {
2953
3276
  return new Proxy(
@@ -2966,9 +3289,12 @@ function merge(...e) {
2966
3289
  return false;
2967
3290
  },
2968
3291
  keys() {
2969
- const e = [];
2970
- for (let t = 0; t < n.length; t++) e.push(...Object.keys(resolveSource(n[t])));
2971
- return [...new Set(e)];
3292
+ const e = new Set();
3293
+ for (let t = 0; t < n.length; t++) {
3294
+ const i = Object.keys(resolveSource(n[t]));
3295
+ for (let t = 0; t < i.length; t++) e.add(i[t]);
3296
+ }
3297
+ return [...e];
2972
3298
  }
2973
3299
  },
2974
3300
  propTraps
@@ -3007,261 +3333,268 @@ function merge(...e) {
3007
3333
  return o;
3008
3334
  }
3009
3335
  function omit(e, ...t) {
3010
- const n = new Set(t);
3011
3336
  if (SUPPORTS_PROXY && $PROXY in e) {
3012
3337
  return new Proxy(
3013
3338
  {
3014
- get(t) {
3015
- return n.has(t) ? undefined : e[t];
3339
+ get(n) {
3340
+ return t.includes(n) ? undefined : e[n];
3016
3341
  },
3017
- has(t) {
3018
- return !n.has(t) && t in e;
3342
+ has(n) {
3343
+ return !t.includes(n) && n in e;
3019
3344
  },
3020
3345
  keys() {
3021
- return Object.keys(e).filter(e => !n.has(e));
3346
+ return Object.keys(e).filter(e => !t.includes(e));
3022
3347
  }
3023
3348
  },
3024
3349
  propTraps
3025
3350
  );
3026
3351
  }
3027
- const i = {};
3028
- for (const t of Object.getOwnPropertyNames(e)) {
3029
- if (!n.has(t)) {
3030
- const n = Object.getOwnPropertyDescriptor(e, t);
3031
- !n.get && !n.set && n.enumerable && n.writable && n.configurable
3032
- ? (i[t] = n.value)
3033
- : Object.defineProperty(i, t, n);
3352
+ const n = {};
3353
+ const i = Object.getOwnPropertyNames(e);
3354
+ const r = t.length > 4 && i.length > t.length ? new Set(t) : undefined;
3355
+ for (const s of i) {
3356
+ if (r ? !r.has(s) : !t.includes(s)) {
3357
+ const t = Object.getOwnPropertyDescriptor(e, s);
3358
+ !t.get && !t.set && t.enumerable && t.writable && t.configurable
3359
+ ? (n[s] = t.value)
3360
+ : Object.defineProperty(n, s, t);
3034
3361
  }
3035
3362
  }
3036
- return i;
3363
+ return n;
3037
3364
  }
3038
3365
  function mapArray(e, t, n) {
3039
3366
  const i = typeof n?.keyed === "function" ? n.keyed : undefined;
3040
3367
  const r = t.length > 1;
3041
3368
  const s = t;
3042
3369
  const o = {
3043
- je: createOwner(),
3044
- $e: 0,
3045
- Ke: e,
3046
- Ye: [],
3047
- Be: s,
3048
- Ze: [],
3049
- qe: [],
3050
- ze: i,
3051
- Xe: i || n?.keyed === false ? [] : undefined,
3052
- Je: r ? [] : undefined,
3053
- et: n?.fallback
3370
+ Ze: createOwner(),
3371
+ qe: 0,
3372
+ Be: e,
3373
+ ze: [],
3374
+ Xe: s,
3375
+ Je: [],
3376
+ et: [],
3377
+ tt: i,
3378
+ nt: i || n?.keyed === false ? [] : undefined,
3379
+ it: r && n?.keyed !== false ? [] : undefined,
3380
+ rt: n?.keyed === false,
3381
+ st: n?.fallback
3054
3382
  };
3055
3383
  const u = computed(updateKeyedMap.bind(o));
3056
- o.je.u = u;
3057
- u.Ee &= ~CONFIG_AUTO_DISPOSE;
3384
+ o.Ze.u = u;
3385
+ u._e &= ~CONFIG_AUTO_DISPOSE;
3058
3386
  return accessor(u);
3059
3387
  }
3060
3388
  const pureOptions = { ownedWrite: true };
3061
3389
  function updateKeyedMap() {
3062
- const e = this.Ke() || [],
3390
+ const e = this.Be() || [],
3063
3391
  t = e.length;
3064
3392
  e[$TRACK];
3065
- runWithOwner(this.je, () => {
3393
+ runWithOwner(this.Ze, () => {
3066
3394
  let n,
3067
3395
  i,
3068
- r = this.Xe
3069
- ? () => {
3070
- this.Xe[i] = signal(e[i], pureOptions);
3071
- this.Je && (this.Je[i] = signal(i, pureOptions));
3072
- return this.Be(accessor(this.Xe[i]), this.Je ? accessor(this.Je[i]) : undefined);
3073
- }
3074
- : this.Je
3396
+ r = this.nt
3397
+ ? this.rt
3398
+ ? () => {
3399
+ this.nt[i] = signal(e[i], pureOptions);
3400
+ return this.Xe(accessor(this.nt[i]), i);
3401
+ }
3402
+ : () => {
3403
+ this.nt[i] = signal(e[i], pureOptions);
3404
+ this.it && (this.it[i] = signal(i, pureOptions));
3405
+ return this.Xe(accessor(this.nt[i]), this.it ? accessor(this.it[i]) : undefined);
3406
+ }
3407
+ : this.it
3075
3408
  ? () => {
3076
3409
  const t = e[i];
3077
- this.Je[i] = signal(i, pureOptions);
3078
- return this.Be(() => t, accessor(this.Je[i]));
3410
+ this.it[i] = signal(i, pureOptions);
3411
+ return this.Xe(t, accessor(this.it[i]));
3079
3412
  }
3080
3413
  : () => {
3081
3414
  const t = e[i];
3082
- return this.Be(() => t);
3415
+ return this.Xe(t);
3083
3416
  };
3084
3417
  if (t === 0) {
3085
- if (this.$e !== 0) {
3086
- this.je.dispose(false);
3087
- this.qe = [];
3088
- this.Ye = [];
3089
- this.Ze = [];
3090
- this.$e = 0;
3091
- this.Xe && (this.Xe = []);
3092
- this.Je && (this.Je = []);
3093
- }
3094
- if (this.et && !this.Ze[0]) {
3095
- this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
3096
- }
3097
- } else if (this.$e === 0) {
3098
- if (this.qe[0]) this.qe[0].dispose();
3099
- this.Ze = new Array(t);
3418
+ if (this.qe !== 0) {
3419
+ this.Ze.dispose(false);
3420
+ this.et = [];
3421
+ this.ze = [];
3422
+ this.Je = [];
3423
+ this.qe = 0;
3424
+ this.nt && (this.nt = []);
3425
+ this.it && (this.it = []);
3426
+ }
3427
+ if (this.st && !this.Je[0]) {
3428
+ this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.st);
3429
+ }
3430
+ } else if (this.qe === 0) {
3431
+ if (this.et[0]) this.et[0].dispose();
3432
+ this.Je = new Array(t);
3100
3433
  for (i = 0; i < t; i++) {
3101
- this.Ye[i] = e[i];
3102
- this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
3434
+ this.ze[i] = e[i];
3435
+ this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
3103
3436
  }
3104
- this.$e = t;
3437
+ this.qe = t;
3105
3438
  } else {
3106
3439
  let s,
3107
3440
  o,
3108
3441
  u,
3442
+ l,
3109
3443
  c,
3110
3444
  a,
3111
- l,
3112
3445
  f,
3113
3446
  E = new Array(t),
3114
- T = new Array(t),
3115
- S = this.Xe ? new Array(t) : undefined,
3116
- d = this.Je ? new Array(t) : undefined;
3447
+ S = new Array(t),
3448
+ T = this.nt ? new Array(t) : undefined,
3449
+ d = this.it ? new Array(t) : undefined;
3117
3450
  for (
3118
- s = 0, o = Math.min(this.$e, t);
3119
- s < o && (this.Ye[s] === e[s] || (this.Xe && compare(this.ze, this.Ye[s], e[s])));
3451
+ s = 0, o = Math.min(this.qe, t);
3452
+ s < o && (this.ze[s] === e[s] || (this.nt && compare(this.tt, this.ze[s], e[s])));
3120
3453
  s++
3121
3454
  ) {
3122
- if (this.Xe) setSignal(this.Xe[s], e[s]);
3455
+ if (this.nt) setSignal(this.nt[s], e[s]);
3123
3456
  }
3124
3457
  for (
3125
- o = this.$e - 1, u = t - 1;
3458
+ o = this.qe - 1, u = t - 1;
3126
3459
  o >= s &&
3127
3460
  u >= s &&
3128
- (this.Ye[o] === e[u] || (this.Xe && compare(this.ze, this.Ye[o], e[u])));
3461
+ (this.ze[o] === e[u] || (this.nt && compare(this.tt, this.ze[o], e[u])));
3129
3462
  o--, u--
3130
3463
  ) {
3131
- E[u] = this.Ze[o];
3132
- T[u] = this.qe[o];
3133
- S && (S[u] = this.Xe[o]);
3134
- d && (d[u] = this.Je[o]);
3464
+ E[u] = this.Je[o];
3465
+ S[u] = this.et[o];
3466
+ T && (T[u] = this.nt[o]);
3467
+ d && (d[u] = this.it[o]);
3135
3468
  }
3136
- l = new Map();
3469
+ a = new Map();
3137
3470
  f = new Array(u + 1);
3138
3471
  for (i = u; i >= s; i--) {
3139
- c = e[i];
3140
- a = this.ze ? this.ze(c) : c;
3141
- n = l.get(a);
3472
+ l = e[i];
3473
+ c = this.tt ? this.tt(l) : l;
3474
+ n = a.get(c);
3142
3475
  f[i] = n === undefined ? -1 : n;
3143
- l.set(a, i);
3476
+ a.set(c, i);
3144
3477
  }
3145
3478
  for (n = s; n <= o; n++) {
3146
- c = this.Ye[n];
3147
- a = this.ze ? this.ze(c) : c;
3148
- i = l.get(a);
3479
+ l = this.ze[n];
3480
+ c = this.tt ? this.tt(l) : l;
3481
+ i = a.get(c);
3149
3482
  if (i !== undefined && i !== -1) {
3150
- E[i] = this.Ze[n];
3151
- T[i] = this.qe[n];
3152
- S && (S[i] = this.Xe[n]);
3153
- d && (d[i] = this.Je[n]);
3483
+ E[i] = this.Je[n];
3484
+ S[i] = this.et[n];
3485
+ T && (T[i] = this.nt[n]);
3486
+ d && (d[i] = this.it[n]);
3154
3487
  i = f[i];
3155
- l.set(a, i);
3156
- } else this.qe[n].dispose();
3488
+ a.set(c, i);
3489
+ } else this.et[n].dispose();
3157
3490
  }
3158
3491
  for (i = s; i < t; i++) {
3159
3492
  if (i in E) {
3160
- this.Ze[i] = E[i];
3161
- this.qe[i] = T[i];
3162
- if (S) {
3163
- this.Xe[i] = S[i];
3164
- setSignal(this.Xe[i], e[i]);
3493
+ this.Je[i] = E[i];
3494
+ this.et[i] = S[i];
3495
+ if (T) {
3496
+ this.nt[i] = T[i];
3497
+ setSignal(this.nt[i], e[i]);
3165
3498
  }
3166
3499
  if (d) {
3167
- this.Je[i] = d[i];
3168
- setSignal(this.Je[i], i);
3500
+ this.it[i] = d[i];
3501
+ setSignal(this.it[i], i);
3169
3502
  }
3170
3503
  } else {
3171
- this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
3504
+ this.Je[i] = runWithOwner((this.et[i] = createOwner()), r);
3172
3505
  }
3173
3506
  }
3174
- this.Ze = this.Ze.slice(0, (this.$e = t));
3175
- this.Ye = e.slice(0);
3507
+ this.Je = this.Je.slice(0, (this.qe = t));
3508
+ this.ze = e.slice(0);
3176
3509
  }
3177
3510
  });
3178
- return this.Ze;
3511
+ return this.Je;
3179
3512
  }
3180
3513
  function repeat(e, t, n) {
3181
3514
  const i = t;
3182
3515
  const r = computed(
3183
3516
  updateRepeat.bind({
3184
- je: createOwner(),
3185
- $e: 0,
3186
- tt: 0,
3187
- nt: e,
3188
- Be: i,
3189
- qe: [],
3190
- Ze: [],
3191
- it: n?.from,
3192
- et: n?.fallback
3517
+ Ze: createOwner(),
3518
+ qe: 0,
3519
+ ot: 0,
3520
+ ut: e,
3521
+ Xe: i,
3522
+ et: [],
3523
+ Je: [],
3524
+ lt: n?.from,
3525
+ st: n?.fallback
3193
3526
  })
3194
3527
  );
3195
- r.Ee &= ~CONFIG_AUTO_DISPOSE;
3528
+ r._e &= ~CONFIG_AUTO_DISPOSE;
3196
3529
  return accessor(r);
3197
3530
  }
3198
3531
  function updateRepeat() {
3199
- const e = this.nt();
3200
- const t = this.it?.() || 0;
3201
- runWithOwner(this.je, () => {
3532
+ const e = this.ut();
3533
+ const t = this.lt?.() || 0;
3534
+ runWithOwner(this.Ze, () => {
3202
3535
  if (e === 0) {
3203
- if (this.$e !== 0) {
3204
- this.je.dispose(false);
3205
- this.qe = [];
3206
- this.Ze = [];
3207
- this.$e = 0;
3536
+ if (this.qe !== 0) {
3537
+ this.Ze.dispose(false);
3538
+ this.et = [];
3539
+ this.Je = [];
3540
+ this.qe = 0;
3208
3541
  }
3209
- if (this.et && !this.Ze[0]) {
3210
- this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
3542
+ if (this.st && !this.Je[0]) {
3543
+ this.Je[0] = runWithOwner((this.et[0] = createOwner()), this.st);
3211
3544
  }
3212
3545
  return;
3213
3546
  }
3214
3547
  const n = t + e;
3215
- const i = this.tt + this.$e;
3216
- if (this.$e === 0 && this.qe[0]) this.qe[0].dispose();
3217
- for (let e = n; e < i; e++) this.qe[e - this.tt].dispose();
3218
- if (this.tt < t) {
3219
- let e = this.tt;
3220
- while (e < t && e < this.$e) this.qe[e++].dispose();
3221
- this.qe.splice(0, t - this.tt);
3222
- this.Ze.splice(0, t - this.tt);
3223
- } else if (this.tt > t) {
3224
- let n = i - this.tt - 1;
3225
- let r = this.tt - t;
3226
- this.qe.length = this.Ze.length = e;
3548
+ const i = this.ot + this.qe;
3549
+ if (this.qe === 0 && this.et[0]) this.et[0].dispose();
3550
+ for (let e = n; e < i; e++) this.et[e - this.ot].dispose();
3551
+ if (this.ot < t) {
3552
+ let e = this.ot;
3553
+ while (e < t && e < this.qe) this.et[e++].dispose();
3554
+ this.et.splice(0, t - this.ot);
3555
+ this.Je.splice(0, t - this.ot);
3556
+ } else if (this.ot > t) {
3557
+ let n = i - this.ot - 1;
3558
+ let r = this.ot - t;
3559
+ this.et.length = this.Je.length = e;
3227
3560
  while (n >= r) {
3228
- this.qe[n] = this.qe[n - r];
3229
- this.Ze[n] = this.Ze[n - r];
3561
+ this.et[n] = this.et[n - r];
3562
+ this.Je[n] = this.Je[n - r];
3230
3563
  n--;
3231
3564
  }
3232
3565
  for (let e = 0; e < r; e++) {
3233
- this.Ze[e] = runWithOwner((this.qe[e] = createOwner()), () => this.Be(e + t));
3566
+ this.Je[e] = runWithOwner((this.et[e] = createOwner()), () => this.Xe(e + t));
3234
3567
  }
3235
3568
  }
3236
3569
  for (let e = i; e < n; e++) {
3237
- this.Ze[e - t] = runWithOwner((this.qe[e - t] = createOwner()), () => this.Be(e));
3570
+ this.Je[e - t] = runWithOwner((this.et[e - t] = createOwner()), () => this.Xe(e));
3238
3571
  }
3239
- this.Ze = this.Ze.slice(0, e);
3240
- this.tt = t;
3241
- this.$e = e;
3572
+ this.Je = this.Je.slice(0, e);
3573
+ this.ot = t;
3574
+ this.qe = e;
3242
3575
  });
3243
- return this.Ze;
3576
+ return this.Je;
3244
3577
  }
3245
3578
  function compare(e, t, n) {
3246
3579
  return e ? e(t) === e(n) : true;
3247
3580
  }
3248
3581
  function boundaryComputed(e, t) {
3249
3582
  const n = computed(e, { lazy: true });
3250
- n.Ge = (e, t) => {
3251
- const i = e !== undefined ? e : n.Oe;
3252
- const r = t !== undefined ? t : n.Te;
3253
- n.Oe &= ~n.rt;
3254
- n.$.notify(n, n.rt, i, r);
3583
+ n.xe = (e, t) => {
3584
+ const i = e !== undefined ? e : n.he;
3585
+ const r = t !== undefined ? t : n.Re;
3586
+ n.he &= ~n.ct;
3587
+ n.te.notify(n, n.ct, i, r);
3255
3588
  };
3256
- n.rt = t;
3257
- n.Ee &= ~CONFIG_AUTO_DISPOSE;
3589
+ n.ct = t;
3590
+ n._e &= ~CONFIG_AUTO_DISPOSE;
3258
3591
  recompute(n, true);
3259
3592
  return n;
3260
3593
  }
3261
3594
  function createBoundChildren(e, t, n, i) {
3262
- const r = e.$;
3263
- r.addChild((e.$ = n));
3264
- cleanup(() => r.removeChild(e.$));
3595
+ const r = e.te;
3596
+ r.addChild((e.te = n));
3597
+ cleanup(() => r.removeChild(e.te));
3265
3598
  return runWithOwner(e, () => {
3266
3599
  const e = computed(t);
3267
3600
  return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
@@ -3276,52 +3609,52 @@ function isRevealController(e) {
3276
3609
  return e instanceof RevealController;
3277
3610
  }
3278
3611
  function isSlotReady(e) {
3279
- return isRevealController(e) ? e.isReady() : e.st.size === 0 && !e.ot;
3612
+ return isRevealController(e) ? e.isReady() : e.ft.size === 0 && !e.Et;
3280
3613
  }
3281
3614
  function isSlotMinimallyReady(e) {
3282
3615
  return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
3283
3616
  }
3284
3617
  function setSlotState(e, t, n, i) {
3285
- setSignal(e.ut, n);
3286
- setSignal(e.ct, i);
3618
+ setSignal(e.St, n);
3619
+ setSignal(e.Tt, i);
3287
3620
  if (isRevealController(e)) {
3288
- if (!n && e.lt === t) e.lt = undefined;
3621
+ if (!n && e.dt === t) e.dt = undefined;
3289
3622
  return e.evaluate(n, i);
3290
3623
  }
3291
- if (!n && e.ft === t && e.Et) e.ft = undefined;
3624
+ if (!n && e.Ot === t && e._t) e.Ot = undefined;
3292
3625
  }
3293
3626
  class RevealController {
3294
- Tt;
3295
- St;
3296
- dt = [];
3297
- lt;
3298
- ut = signal(false, { ownedWrite: true, Fe: true });
3299
- ct = signal(false, { ownedWrite: true, Fe: true });
3300
- Ot = true;
3301
- Rt = true;
3302
- _t = false;
3627
+ Rt;
3628
+ It;
3629
+ ht = [];
3630
+ dt;
3631
+ St = signal(false, { ownedWrite: true, Ye: true });
3632
+ Tt = signal(false, { ownedWrite: true, Ye: true });
3633
+ Nt = true;
3634
+ At = true;
3635
+ Ct = false;
3303
3636
  constructor(e, t) {
3304
- this.Tt = e;
3305
- this.St = t;
3637
+ this.Rt = e;
3638
+ this.It = t;
3306
3639
  }
3307
- It(e) {
3308
- for (let t = 0; t < this.dt.length; t++) {
3309
- const n = this.dt[t];
3310
- if ((isRevealController(n) ? n.lt : n.ft) !== this) continue;
3640
+ Pt(e) {
3641
+ for (let t = 0; t < this.ht.length; t++) {
3642
+ const n = this.ht[t];
3643
+ if ((isRevealController(n) ? n.dt : n.Ot) !== this) continue;
3311
3644
  if (e(n) === false) return false;
3312
3645
  }
3313
3646
  return true;
3314
3647
  }
3315
3648
  isReady() {
3316
- return this.It(isSlotReady);
3649
+ return this.Pt(isSlotReady);
3317
3650
  }
3318
3651
  isMinimallyReady() {
3319
- const e = untrack(this.Tt);
3652
+ const e = untrack(this.Rt);
3320
3653
  if (e === "together") return this.isReady();
3321
3654
  if (e === "natural") {
3322
3655
  let e = false;
3323
3656
  let t = false;
3324
- this.It(n => {
3657
+ this.Pt(n => {
3325
3658
  e = true;
3326
3659
  if (isSlotMinimallyReady(n)) {
3327
3660
  t = true;
@@ -3331,58 +3664,58 @@ class RevealController {
3331
3664
  return !e || t;
3332
3665
  }
3333
3666
  let t = true;
3334
- this.It(e => {
3667
+ this.Pt(e => {
3335
3668
  t = isSlotMinimallyReady(e);
3336
3669
  return false;
3337
3670
  });
3338
3671
  return t;
3339
3672
  }
3340
3673
  register(e) {
3341
- if (this.dt.includes(e)) return;
3342
- this.dt.push(e);
3343
- const t = untrack(this.Tt);
3344
- (setSignal(e.ut, true), setSignal(e.ct, t === "sequential" ? !!untrack(this.St) : false));
3674
+ if (this.ht.includes(e)) return;
3675
+ this.ht.push(e);
3676
+ const t = untrack(this.Rt);
3677
+ (setSignal(e.St, true), setSignal(e.Tt, t === "sequential" ? !!untrack(this.It) : false));
3345
3678
  untrack(() => this.evaluate());
3346
3679
  }
3347
3680
  unregister(e) {
3348
- const t = this.dt.indexOf(e);
3349
- if (t >= 0) this.dt.splice(t, 1);
3681
+ const t = this.ht.indexOf(e);
3682
+ if (t >= 0) this.ht.splice(t, 1);
3350
3683
  untrack(() => this.evaluate());
3351
3684
  }
3352
3685
  evaluate(e, t) {
3353
- if (this._t) return;
3354
- this._t = true;
3355
- const n = this.Ot;
3356
- const i = this.Rt;
3686
+ if (this.Ct) return;
3687
+ this.Ct = true;
3688
+ const n = this.Nt;
3689
+ const i = this.At;
3357
3690
  try {
3358
- const n = e ?? read(this.ut),
3359
- i = untrack(this.Tt),
3360
- r = i === "sequential" && !!untrack(this.St),
3691
+ const n = e ?? read(this.St),
3692
+ i = untrack(this.Rt),
3693
+ r = i === "sequential" && !!untrack(this.It),
3361
3694
  s = t ?? r;
3362
3695
  if (n) {
3363
- this.It(e => setSlotState(e, this, true, s));
3696
+ this.Pt(e => setSlotState(e, this, true, s));
3364
3697
  } else if (i === "natural") {
3365
- this.It(e => {
3698
+ this.Pt(e => {
3366
3699
  if (isRevealController(e)) {
3367
- setSignal(e.ct, false);
3368
- setSignal(e.ut, false);
3700
+ setSignal(e.Tt, false);
3701
+ setSignal(e.St, false);
3369
3702
  e.evaluate(false, false);
3370
3703
  } else {
3371
3704
  setSlotState(e, this, !isSlotReady(e), false);
3372
3705
  }
3373
3706
  });
3374
3707
  } else if (i === "together") {
3375
- const e = this.It(isSlotMinimallyReady);
3376
- this.It(t => setSlotState(t, this, !e, false));
3708
+ const e = this.Pt(isSlotMinimallyReady);
3709
+ this.Pt(t => setSlotState(t, this, !e, false));
3377
3710
  } else {
3378
3711
  let e = false;
3379
- this.It(t => {
3712
+ this.Pt(t => {
3380
3713
  if (e) return setSlotState(t, this, true, r);
3381
3714
  if (isSlotReady(t)) return setSlotState(t, this, false, false);
3382
3715
  e = true;
3383
3716
  if (isRevealController(t)) {
3384
- setSignal(t.ct, false);
3385
- setSignal(t.ut, false);
3717
+ setSignal(t.Tt, false);
3718
+ setSignal(t.St, false);
3386
3719
  t.evaluate(false, false);
3387
3720
  } else {
3388
3721
  setSlotState(t, this, true, false);
@@ -3390,96 +3723,96 @@ class RevealController {
3390
3723
  });
3391
3724
  }
3392
3725
  } finally {
3393
- this.Ot = this.isReady();
3394
- this.Rt = this.isMinimallyReady();
3395
- this._t = false;
3726
+ this.Nt = this.isReady();
3727
+ this.At = this.isMinimallyReady();
3728
+ this.Ct = false;
3396
3729
  }
3397
- if (this.lt && (n !== this.Ot || i !== this.Rt)) this.lt.evaluate();
3730
+ if (this.dt && (n !== this.Nt || i !== this.At)) this.dt.evaluate();
3398
3731
  }
3399
3732
  }
3400
3733
  class CollectionQueue extends Queue {
3401
- ht;
3402
- st = new Set();
3403
- Nt;
3404
- ot = true;
3405
- ut = signal(false, { ownedWrite: true, Fe: true });
3406
- ct = signal(false, { ownedWrite: true, Fe: true });
3407
- ft;
3408
- Et = false;
3409
- At;
3410
- Pt = ON_INIT;
3734
+ gt;
3735
+ ft = new Set();
3736
+ Dt;
3737
+ Et = true;
3738
+ St = signal(false, { ownedWrite: true, Ye: true });
3739
+ Tt = signal(false, { ownedWrite: true, Ye: true });
3740
+ Ot;
3741
+ _t = false;
3742
+ yt;
3743
+ vt = ON_INIT;
3411
3744
  constructor(e) {
3412
3745
  super();
3413
- this.ht = e;
3746
+ this.gt = e;
3414
3747
  }
3415
3748
  run(e) {
3416
- if (!e || (read(this.ut) && (!_revealUsed || read(this.ct)))) return;
3749
+ if (!e || (read(this.St) && (!_revealUsed || read(this.Tt)))) return;
3417
3750
  return super.run(e);
3418
3751
  }
3419
3752
  notify(e, t, n, i) {
3420
- if (!(t & this.ht)) return super.notify(e, t, n, i);
3421
- if (this.Et && this.At) {
3753
+ if (!(t & this.gt)) return super.notify(e, t, n, i);
3754
+ if (this._t && this.yt) {
3422
3755
  const e = untrack(() => {
3423
3756
  try {
3424
- return this.At();
3757
+ return this.yt();
3425
3758
  } catch {
3426
3759
  return ON_INIT;
3427
3760
  }
3428
3761
  });
3429
- if (e !== this.Pt) {
3430
- this.Pt = e;
3431
- this.Et = false;
3432
- this.st.clear();
3762
+ if (e !== this.vt) {
3763
+ this.vt = e;
3764
+ this._t = false;
3765
+ this.ft.clear();
3433
3766
  }
3434
3767
  }
3435
- if (this.ht & STATUS_PENDING && this.Et) return super.notify(e, t, n, i);
3436
- if (this.ht & STATUS_PENDING && n & STATUS_ERROR) {
3768
+ if (this.gt & STATUS_PENDING && this._t) return super.notify(e, t, n, i);
3769
+ if (this.gt & STATUS_PENDING && n & STATUS_ERROR) {
3437
3770
  return super.notify(e, STATUS_ERROR, n, i);
3438
3771
  }
3439
- if (n & this.ht) {
3440
- this.ot = true;
3441
- const t = i?.source || e.Te?.source;
3772
+ if (n & this.gt) {
3773
+ this.Et = true;
3774
+ const t = i?.source || e.Re?.source;
3442
3775
  if (t) {
3443
- const e = this.st.size === 0;
3444
- this.st.add(t);
3445
- if (e) setSignal(this.ut, true);
3776
+ const e = this.ft.size === 0;
3777
+ this.ft.add(t);
3778
+ if (e) setSignal(this.St, true);
3446
3779
  }
3447
3780
  }
3448
- t &= ~this.ht;
3781
+ t &= ~this.gt;
3449
3782
  return t ? super.notify(e, t, n, i) : true;
3450
3783
  }
3451
3784
  checkSources() {
3452
- for (const e of this.st) {
3785
+ for (const e of this.ft) {
3453
3786
  if (
3454
- e.R & REACTIVE_DISPOSED ||
3455
- (!(e.Oe & this.ht) && !(this.ht & STATUS_ERROR && e.Oe & STATUS_PENDING))
3787
+ e._ & REACTIVE_DISPOSED ||
3788
+ (!(e.he & this.gt) && !(this.gt & STATUS_ERROR && e.he & STATUS_PENDING))
3456
3789
  )
3457
- this.st.delete(e);
3790
+ this.ft.delete(e);
3458
3791
  }
3459
- if (!this.st.size) {
3460
- if (this.ht & STATUS_PENDING && this.ot && !this.Et && this.Nt) {
3461
- this.ot = !!(this.Nt.Oe & this.ht);
3792
+ if (!this.ft.size) {
3793
+ if (this.gt & STATUS_PENDING && this.Et && !this._t && this.Dt) {
3794
+ this.Et = !!(this.Dt.he & this.gt);
3462
3795
  } else {
3463
- this.ot = false;
3796
+ this.Et = false;
3464
3797
  }
3465
- if (!this.ot) {
3466
- setSignal(this.ut, false);
3467
- if (this.At) {
3798
+ if (!this.Et) {
3799
+ setSignal(this.St, false);
3800
+ if (this.yt) {
3468
3801
  try {
3469
- this.Pt = untrack(() => this.At());
3802
+ this.vt = untrack(() => this.yt());
3470
3803
  } catch {}
3471
3804
  }
3472
3805
  }
3473
3806
  }
3474
- if (_revealUsed) this.ft?.evaluate();
3807
+ if (_revealUsed) this.Ot?.evaluate();
3475
3808
  }
3476
3809
  }
3477
3810
  function createCollectionBoundary(e, t, n, i) {
3478
3811
  const r = createOwner();
3479
3812
  if (_revealUsed) setContext(RevealControllerContext, null, r);
3480
3813
  const s = new CollectionQueue(e);
3481
- if (i) s.At = i;
3482
- const o = (s.Nt = createBoundChildren(r, t, s, e));
3814
+ if (i) s.yt = i;
3815
+ const o = (s.Dt = createBoundChildren(r, t, s, e));
3483
3816
  untrack(() => {
3484
3817
  let t = false;
3485
3818
  try {
@@ -3488,21 +3821,21 @@ function createCollectionBoundary(e, t, n, i) {
3488
3821
  if (e instanceof NotReadyError) t = true;
3489
3822
  else throw e;
3490
3823
  }
3491
- s.ot = t || !!(o.Oe & e) || o.Te instanceof NotReadyError;
3824
+ s.Et = t || !!(o.he & e) || o.Re instanceof NotReadyError;
3492
3825
  });
3493
3826
  const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
3494
3827
  if (u) {
3495
- s.ft = u;
3828
+ s.Ot = u;
3496
3829
  u.register(s);
3497
3830
  cleanup(() => u.unregister(s));
3498
3831
  }
3499
3832
  return accessor(
3500
3833
  computed(() => {
3501
- if (!read(s.ut)) {
3834
+ if (!read(s.St)) {
3502
3835
  const e = read(o);
3503
- if (!untrack(() => read(s.ut))) return ((s.Et = true), e);
3836
+ if (!untrack(() => read(s.St))) return ((s._t = true), e);
3504
3837
  }
3505
- if (_revealUsed && read(s.ct)) return undefined;
3838
+ if (_revealUsed && read(s.Tt)) return undefined;
3506
3839
  return n(s);
3507
3840
  })
3508
3841
  );
@@ -3512,10 +3845,10 @@ function createLoadingBoundary(e, t, n) {
3512
3845
  }
3513
3846
  function createErrorBoundary(e, t) {
3514
3847
  return createCollectionBoundary(STATUS_ERROR, e, e => {
3515
- let n = e.st.values().next().value;
3516
- const i = n.Te?.cause ?? n.Te;
3848
+ let n = e.ft.values().next().value;
3849
+ const i = n.Re?.cause ?? n.Re;
3517
3850
  return t(i, () => {
3518
- for (const t of e.st) recompute(t);
3851
+ for (const t of e.ft) recompute(t);
3519
3852
  schedule();
3520
3853
  });
3521
3854
  });
@@ -3536,7 +3869,7 @@ function createRevealOrder(e, t) {
3536
3869
  o.evaluate();
3537
3870
  });
3538
3871
  if (i) {
3539
- o.lt = i;
3872
+ o.dt = i;
3540
3873
  i.register(o);
3541
3874
  cleanup(() => i.unregister(o));
3542
3875
  }