@solidjs/signals 0.9.8 → 0.9.10

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.
package/dist/prod.js CHANGED
@@ -1,8 +1,15 @@
1
1
  class NotReadyError extends Error {
2
- cause;
2
+ t;
3
3
  constructor(e) {
4
4
  super();
5
- this.cause = e;
5
+ this.t = e;
6
+ }
7
+ }
8
+ class StatusError extends Error {
9
+ t;
10
+ constructor(e, t) {
11
+ super(t instanceof Error ? t.message : String(t), { cause: t });
12
+ this.t = e;
6
13
  }
7
14
  }
8
15
  class NoOwnerError extends Error {
@@ -24,7 +31,6 @@ const REACTIVE_IN_HEAP_HEIGHT = 1 << 4;
24
31
  const REACTIVE_ZOMBIE = 1 << 5;
25
32
  const REACTIVE_DISPOSED = 1 << 6;
26
33
  const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
27
- const STATUS_NONE = 0;
28
34
  const STATUS_PENDING = 1 << 0;
29
35
  const STATUS_ERROR = 1 << 1;
30
36
  const STATUS_UNINITIALIZED = 1 << 2;
@@ -36,111 +42,187 @@ const SUPPORTS_PROXY = typeof Proxy === "function";
36
42
  const defaultContext = {};
37
43
  const $REFRESH = Symbol("refresh");
38
44
  function actualInsertIntoHeap(e, t) {
39
- const n = (e.i?.t ? e.i.u?.o : e.i?.o) ?? -1;
40
- if (n >= e.o) e.o = n + 1;
41
- const i = e.o;
42
- const r = t.l[i];
43
- if (r === undefined) t.l[i] = e;
45
+ const n = (e.o?.i ? e.o.l?.u : e.o?.u) ?? -1;
46
+ if (n >= e.u) e.u = n + 1;
47
+ const i = e.u;
48
+ const r = t.T[i];
49
+ if (r === undefined) t.T[i] = e;
44
50
  else {
45
- const t = r.T;
46
- t.R = e;
47
- e.T = t;
48
- r.T = e;
51
+ const t = r.R;
52
+ t.O = e;
53
+ e.R = t;
54
+ r.R = e;
49
55
  }
50
- if (i > t.O) t.O = i;
56
+ if (i > t.S) t.S = i;
51
57
  }
52
58
  function insertIntoHeap(e, t) {
53
- let n = e.S;
59
+ let n = e._;
54
60
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
55
61
  if (n & REACTIVE_CHECK) {
56
- e.S = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
57
- } else e.S = n | REACTIVE_IN_HEAP;
62
+ e._ = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
63
+ } else e._ = n | REACTIVE_IN_HEAP;
58
64
  if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
59
65
  }
60
66
  function insertIntoHeapHeight(e, t) {
61
- let n = e.S;
67
+ let n = e._;
62
68
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
63
- e.S = n | REACTIVE_IN_HEAP_HEIGHT;
69
+ e._ = n | REACTIVE_IN_HEAP_HEIGHT;
64
70
  actualInsertIntoHeap(e, t);
65
71
  }
66
72
  function deleteFromHeap(e, t) {
67
- const n = e.S;
73
+ const n = e._;
68
74
  if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
69
- e.S = n & -25;
70
- const i = e.o;
71
- if (e.T === e) t.l[i] = undefined;
75
+ e._ = n & -25;
76
+ const i = e.u;
77
+ if (e.R === e) t.T[i] = undefined;
72
78
  else {
73
- const n = e.R;
74
- const r = t.l[i];
79
+ const n = e.O;
80
+ const r = t.T[i];
75
81
  const o = n ?? r;
76
- if (e === r) t.l[i] = n;
77
- else e.T.R = n;
78
- o.T = e.T;
82
+ if (e === r) t.T[i] = n;
83
+ else e.R.O = n;
84
+ o.R = e.R;
79
85
  }
80
- e.T = e;
81
- e.R = undefined;
86
+ e.R = e;
87
+ e.O = undefined;
82
88
  }
83
89
  function markHeap(e) {
84
- if (e._) return;
85
- e._ = true;
86
- for (let t = 0; t <= e.O; t++) {
87
- for (let n = e.l[t]; n !== undefined; n = n.R) {
88
- if (n.S & REACTIVE_IN_HEAP) markNode(n);
90
+ if (e.I) return;
91
+ e.I = true;
92
+ for (let t = 0; t <= e.S; t++) {
93
+ for (let n = e.T[t]; n !== undefined; n = n.O) {
94
+ if (n._ & REACTIVE_IN_HEAP) markNode(n);
89
95
  }
90
96
  }
91
97
  }
92
98
  function markNode(e, t = REACTIVE_DIRTY) {
93
- const n = e.S;
99
+ const n = e._;
94
100
  if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
95
- e.S = (n & -4) | t;
96
- for (let t = e.p; t !== null; t = t.I) {
97
- markNode(t.h, REACTIVE_CHECK);
98
- }
99
- if (e.A !== null) {
100
- for (let t = e.A; t !== null; t = t.P) {
101
- for (let e = t.p; e !== null; e = e.I) {
102
- markNode(e.h, REACTIVE_CHECK);
101
+ e._ = (n & -4) | t;
102
+ for (let t = e.p; t !== null; t = t.h) {
103
+ markNode(t.A, REACTIVE_CHECK);
104
+ }
105
+ if (e.N !== null) {
106
+ for (let t = e.N; t !== null; t = t.P) {
107
+ for (let e = t.p; e !== null; e = e.h) {
108
+ markNode(e.A, REACTIVE_CHECK);
103
109
  }
104
110
  }
105
111
  }
106
112
  }
107
113
  function runHeap(e, t) {
108
- e._ = false;
109
- for (e.N = 0; e.N <= e.O; e.N++) {
110
- let n = e.l[e.N];
114
+ e.I = false;
115
+ for (e.C = 0; e.C <= e.S; e.C++) {
116
+ let n = e.T[e.C];
111
117
  while (n !== undefined) {
112
- if (n.S & REACTIVE_IN_HEAP) t(n);
118
+ if (n._ & REACTIVE_IN_HEAP) t(n);
113
119
  else adjustHeight(n, e);
114
- n = e.l[e.N];
120
+ n = e.T[e.C];
115
121
  }
116
122
  }
117
- e.O = 0;
123
+ e.S = 0;
118
124
  }
119
125
  function adjustHeight(e, t) {
120
126
  deleteFromHeap(e, t);
121
- let n = e.o;
122
- for (let t = e.C; t; t = t.D) {
127
+ let n = e.u;
128
+ for (let t = e.D; t; t = t.m) {
123
129
  const e = t.V;
124
- const i = e.m || e;
125
- if (i.U && i.o >= n) n = i.o + 1;
130
+ const i = e.L || e;
131
+ if (i.U && i.u >= n) n = i.u + 1;
126
132
  }
127
- if (e.o !== n) {
128
- e.o = n;
129
- for (let n = e.p; n !== null; n = n.I) {
130
- insertIntoHeapHeight(n.h, t);
133
+ if (e.u !== n) {
134
+ e.u = n;
135
+ for (let n = e.p; n !== null; n = n.h) {
136
+ insertIntoHeapHeight(n.A, t);
131
137
  }
132
138
  }
133
139
  }
134
140
  const transitions = new Set();
135
- const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, N: 0, O: 0 };
136
- const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, N: 0, O: 0 };
141
+ const dirtyQueue = { T: new Array(2e3).fill(undefined), I: false, C: 0, S: 0 };
142
+ const zombieQueue = { T: new Array(2e3).fill(undefined), I: false, C: 0, S: 0 };
137
143
  let clock = 0;
138
144
  let activeTransition = null;
139
145
  let scheduled = false;
140
- let optimisticReadActive = false;
141
146
  let projectionWriteActive = false;
142
- function setOptimisticReadActive(e) {
143
- optimisticReadActive = e;
147
+ const signalLanes = new WeakMap();
148
+ const activeLanes = new Set();
149
+ let currentOptimisticLane = null;
150
+ function setCurrentOptimisticLane(e) {
151
+ currentOptimisticLane = e;
152
+ }
153
+ function getOrCreateLane(e) {
154
+ let t = signalLanes.get(e);
155
+ if (t) {
156
+ return findLane(t);
157
+ }
158
+ const n = e.k;
159
+ const i = n?.W ? findLane(n.W) : null;
160
+ t = { t: e, G: new Set(), M: [[], []], F: null, $: activeTransition, H: i };
161
+ signalLanes.set(e, t);
162
+ activeLanes.add(t);
163
+ e.j = e.K || 0;
164
+ return t;
165
+ }
166
+ function findLane(e) {
167
+ while (e.F) e = e.F;
168
+ return e;
169
+ }
170
+ function mergeLanes(e, t) {
171
+ e = findLane(e);
172
+ t = findLane(t);
173
+ if (e === t) return e;
174
+ t.F = e;
175
+ for (const n of t.G) e.G.add(n);
176
+ e.M[0].push(...t.M[0]);
177
+ e.M[1].push(...t.M[1]);
178
+ return e;
179
+ }
180
+ function clearLaneEntry(e) {
181
+ signalLanes.delete(e);
182
+ }
183
+ function resolveLane(e) {
184
+ const t = e.W;
185
+ if (!t) return undefined;
186
+ const n = findLane(t);
187
+ if (activeLanes.has(n)) return n;
188
+ e.W = undefined;
189
+ return undefined;
190
+ }
191
+ function hasActiveOverride(e) {
192
+ return !!(e.Y && e.B !== NOT_PENDING);
193
+ }
194
+ function assignOrMergeLane(e, t) {
195
+ const n = findLane(t);
196
+ const i = e.W;
197
+ if (i) {
198
+ if (i.F) {
199
+ e.W = t;
200
+ return;
201
+ }
202
+ const r = findLane(i);
203
+ if (activeLanes.has(r)) {
204
+ if (r !== n && !hasActiveOverride(e)) {
205
+ if (n.H && findLane(n.H) === r) {
206
+ e.W = t;
207
+ } else if (r.H && findLane(r.H) === n);
208
+ else {
209
+ mergeLanes(n, r);
210
+ }
211
+ }
212
+ return;
213
+ }
214
+ }
215
+ e.W = t;
216
+ }
217
+ function runLaneEffects(e) {
218
+ for (const t of activeLanes) {
219
+ if (t.F || t.G.size > 0) continue;
220
+ const n = t.M[e - 1];
221
+ if (n.length) {
222
+ t.M[e - 1] = [];
223
+ runQueue(n, e);
224
+ }
225
+ }
144
226
  }
145
227
  function setProjectionWriteActive(e) {
146
228
  projectionWriteActive = e;
@@ -148,133 +230,129 @@ function setProjectionWriteActive(e) {
148
230
  function schedule() {
149
231
  if (scheduled) return;
150
232
  scheduled = true;
151
- if (!globalQueue.k) queueMicrotask(flush);
233
+ if (!globalQueue.X) queueMicrotask(flush);
152
234
  }
153
235
  class Queue {
154
- i = null;
155
- W = [[], []];
156
- G = [[], []];
157
- M = [];
236
+ o = null;
237
+ q = [[], []];
238
+ Z = [];
158
239
  created = clock;
159
240
  addChild(e) {
160
- this.M.push(e);
161
- e.i = this;
241
+ this.Z.push(e);
242
+ e.o = this;
162
243
  }
163
244
  removeChild(e) {
164
- const t = this.M.indexOf(e);
245
+ const t = this.Z.indexOf(e);
165
246
  if (t >= 0) {
166
- this.M.splice(t, 1);
167
- e.i = null;
247
+ this.Z.splice(t, 1);
248
+ e.o = null;
168
249
  }
169
250
  }
170
- notify(e, t, n) {
171
- if (this.i) return this.i.notify(e, t, n);
251
+ notify(e, t, n, i) {
252
+ if (this.o) return this.o.notify(e, t, n, i);
172
253
  return false;
173
254
  }
174
- $(e, t, n) {
175
- if (t[e - 1].length) {
176
- const n = t[e - 1];
177
- t[e - 1] = [];
178
- runQueue(n, e);
179
- }
180
- for (let t = 0; t < this.M.length; t++) {
181
- this.M[t][n]?.(e);
182
- }
183
- }
184
255
  run(e) {
185
- this.$(e, this.W, "run");
186
- }
187
- runOptimistic(e) {
188
- this.$(e, this.G, "runOptimistic");
256
+ if (this.q[e - 1].length) {
257
+ const t = this.q[e - 1];
258
+ this.q[e - 1] = [];
259
+ runQueue(t, e);
260
+ }
261
+ for (let t = 0; t < this.Z.length; t++) this.Z[t].run?.(e);
189
262
  }
190
263
  enqueue(e, t) {
191
264
  if (e) {
192
- const n = optimisticReadActive ? this.G : this.W;
193
- n[e - 1].push(t);
265
+ if (currentOptimisticLane) {
266
+ const n = findLane(currentOptimisticLane);
267
+ n.M[e - 1].push(t);
268
+ } else {
269
+ this.q[e - 1].push(t);
270
+ }
194
271
  }
195
272
  schedule();
196
273
  }
197
274
  stashQueues(e) {
198
- e.W[0].push(...this.W[0]);
199
- e.W[1].push(...this.W[1]);
200
- this.W = [[], []];
201
- for (let t = 0; t < this.M.length; t++) {
202
- let n = this.M[t];
203
- let i = e.M[t];
275
+ e.q[0].push(...this.q[0]);
276
+ e.q[1].push(...this.q[1]);
277
+ this.q = [[], []];
278
+ for (let t = 0; t < this.Z.length; t++) {
279
+ let n = this.Z[t];
280
+ let i = e.Z[t];
204
281
  if (!i) {
205
- i = { W: [[], []], M: [] };
206
- e.M[t] = i;
282
+ i = { q: [[], []], Z: [] };
283
+ e.Z[t] = i;
207
284
  }
208
285
  n.stashQueues(i);
209
286
  }
210
287
  }
211
288
  restoreQueues(e) {
212
- this.W[0].push(...e.W[0]);
213
- this.W[1].push(...e.W[1]);
214
- for (let t = 0; t < e.M.length; t++) {
215
- const n = e.M[t];
216
- let i = this.M[t];
289
+ this.q[0].push(...e.q[0]);
290
+ this.q[1].push(...e.q[1]);
291
+ for (let t = 0; t < e.Z.length; t++) {
292
+ const n = e.Z[t];
293
+ let i = this.Z[t];
217
294
  if (i) i.restoreQueues(n);
218
295
  }
219
296
  }
220
297
  }
221
298
  class GlobalQueue extends Queue {
222
- k = false;
223
- L = [];
224
- H = [];
225
- F = new Set();
226
- static j;
227
- static K;
228
- static Y = null;
299
+ X = false;
300
+ J = [];
301
+ ee = [];
302
+ te = new Set();
303
+ static ne;
304
+ static ie;
305
+ static re = null;
229
306
  flush() {
230
- if (this.k) return;
231
- this.k = true;
307
+ if (this.X) return;
308
+ this.X = true;
232
309
  try {
233
- runHeap(dirtyQueue, GlobalQueue.j);
310
+ runHeap(dirtyQueue, GlobalQueue.ne);
234
311
  if (activeTransition) {
235
312
  const e = transitionComplete(activeTransition);
236
313
  if (!e) {
237
314
  let e = activeTransition;
238
- runHeap(zombieQueue, GlobalQueue.j);
239
- this.L = [];
240
- this.H = [];
241
- this.F = new Set();
242
- this.runOptimistic(EFFECT_RENDER);
243
- this.runOptimistic(EFFECT_USER);
244
- this.stashQueues(activeTransition.queueStash);
315
+ runHeap(zombieQueue, GlobalQueue.ne);
316
+ this.J = [];
317
+ this.ee = [];
318
+ this.te = new Set();
319
+ runLaneEffects(EFFECT_RENDER);
320
+ runLaneEffects(EFFECT_USER);
321
+ this.stashQueues(activeTransition.oe);
245
322
  clock++;
246
- scheduled = false;
247
- runTransitionPending(activeTransition.pendingNodes);
323
+ scheduled = dirtyQueue.S >= dirtyQueue.C;
324
+ reassignPendingTransition(activeTransition.J);
248
325
  activeTransition = null;
249
326
  finalizePureQueue(null, true);
250
327
  return;
251
328
  }
252
- this.L !== activeTransition.pendingNodes && this.L.push(...activeTransition.pendingNodes);
253
- this.restoreQueues(activeTransition.queueStash);
329
+ this.J !== activeTransition.J && this.J.push(...activeTransition.J);
330
+ this.restoreQueues(activeTransition.oe);
254
331
  transitions.delete(activeTransition);
255
332
  const t = activeTransition;
256
333
  activeTransition = null;
257
- runTransitionPending(this.L);
334
+ reassignPendingTransition(this.J);
258
335
  finalizePureQueue(t);
259
336
  } else {
260
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.j);
337
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.ne);
261
338
  finalizePureQueue();
262
339
  }
263
340
  clock++;
264
- scheduled = dirtyQueue.O >= dirtyQueue.N;
265
- this.runOptimistic(EFFECT_RENDER);
341
+ scheduled = dirtyQueue.S >= dirtyQueue.C;
342
+ runLaneEffects(EFFECT_RENDER);
266
343
  this.run(EFFECT_RENDER);
267
- this.runOptimistic(EFFECT_USER);
344
+ runLaneEffects(EFFECT_USER);
268
345
  this.run(EFFECT_USER);
269
346
  } finally {
270
- this.k = false;
347
+ this.X = false;
271
348
  }
272
349
  }
273
- notify(e, t, n) {
350
+ notify(e, t, n, i) {
274
351
  if (t & STATUS_PENDING) {
275
352
  if (n & STATUS_PENDING) {
276
- if (activeTransition && e.B && !activeTransition.asyncNodes.includes(e.B.cause)) {
277
- activeTransition.asyncNodes.push(e.B.cause);
353
+ const t = i !== undefined ? i : e.se;
354
+ if (activeTransition && t && !activeTransition.ue.includes(t.t)) {
355
+ activeTransition.ue.push(t.t);
278
356
  schedule();
279
357
  }
280
358
  }
@@ -285,106 +363,143 @@ class GlobalQueue extends Queue {
285
363
  initTransition(e) {
286
364
  if (e) e = currentTransition(e);
287
365
  if (e && e === activeTransition) return;
288
- if (!e && activeTransition && activeTransition.time === clock) return;
366
+ if (!e && activeTransition && activeTransition.ce === clock) return;
289
367
  if (!activeTransition) {
290
368
  activeTransition = e ?? {
291
- time: clock,
292
- pendingNodes: [],
293
- asyncNodes: [],
294
- optimisticNodes: [],
295
- optimisticStores: new Set(),
296
- actions: [],
297
- queueStash: { W: [[], []], M: [] },
298
- done: false
369
+ ce: clock,
370
+ J: [],
371
+ ue: [],
372
+ ee: [],
373
+ te: new Set(),
374
+ le: [],
375
+ oe: { q: [[], []], Z: [] },
376
+ ae: false
299
377
  };
300
378
  } else if (e) {
301
- activeTransition.done = e;
302
- e.actions.push(...activeTransition.actions);
303
- transitions.delete(activeTransition);
379
+ const t = activeTransition;
380
+ t.ae = e;
381
+ e.le.push(...t.le);
382
+ for (const n of activeLanes) {
383
+ if (n.$ === t) n.$ = e;
384
+ }
385
+ e.ee.push(...t.ee);
386
+ for (const n of t.te) {
387
+ e.te.add(n);
388
+ }
389
+ transitions.delete(t);
304
390
  activeTransition = e;
305
391
  }
306
392
  transitions.add(activeTransition);
307
- activeTransition.time = clock;
308
- for (let e = 0; e < this.L.length; e++) {
309
- const t = this.L[e];
310
- t.X = activeTransition;
311
- activeTransition.pendingNodes.push(t);
393
+ activeTransition.ce = clock;
394
+ for (let e = 0; e < this.J.length; e++) {
395
+ const t = this.J[e];
396
+ t.$ = activeTransition;
397
+ activeTransition.J.push(t);
312
398
  }
313
- this.L = activeTransition.pendingNodes;
314
- for (let e = 0; e < this.H.length; e++) {
315
- const t = this.H[e];
316
- t.X = activeTransition;
317
- activeTransition.optimisticNodes.push(t);
399
+ this.J = activeTransition.J;
400
+ for (let e = 0; e < this.ee.length; e++) {
401
+ const t = this.ee[e];
402
+ t.$ = activeTransition;
403
+ activeTransition.ee.push(t);
318
404
  }
319
- this.H = activeTransition.optimisticNodes;
320
- for (const e of this.F) {
321
- activeTransition.optimisticStores.add(e);
405
+ this.ee = activeTransition.ee;
406
+ for (const e of activeLanes) {
407
+ if (!e.$) e.$ = activeTransition;
322
408
  }
323
- this.F = activeTransition.optimisticStores;
409
+ for (const e of this.te) activeTransition.te.add(e);
410
+ this.te = activeTransition.te;
324
411
  }
325
412
  }
326
413
  function insertSubs(e, t = false) {
327
- for (let n = e.p; n !== null; n = n.I) {
328
- if (t) n.h.S |= REACTIVE_OPTIMISTIC_DIRTY;
329
- const e = n.h;
330
- if (e.q === EFFECT_TRACKED) {
331
- if (!e.Z) {
332
- e.Z = true;
333
- e.J.enqueue(EFFECT_USER, e.ee);
414
+ const n = e.W || currentOptimisticLane;
415
+ for (let i = e.p; i !== null; i = i.h) {
416
+ if (t && n) {
417
+ i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
418
+ assignOrMergeLane(i.A, n);
419
+ } else if (t) {
420
+ i.A._ |= REACTIVE_OPTIMISTIC_DIRTY;
421
+ i.A.W = undefined;
422
+ }
423
+ const e = i.A;
424
+ if (e.fe === EFFECT_TRACKED) {
425
+ if (!e.Ee) {
426
+ e.Ee = true;
427
+ e.Te.enqueue(EFFECT_USER, e.de);
334
428
  }
335
429
  continue;
336
430
  }
337
- const i = n.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
338
- if (i.N > n.h.o) i.N = n.h.o;
339
- insertIntoHeap(n.h, i);
431
+ const r = i.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
432
+ if (r.C > i.A.u) r.C = i.A.u;
433
+ insertIntoHeap(i.A, r);
340
434
  }
341
435
  }
342
436
  function finalizePureQueue(e = null, t = false) {
343
437
  let n = !t;
344
- if (dirtyQueue.O >= dirtyQueue.N) {
345
- runHeap(dirtyQueue, GlobalQueue.j);
346
- }
438
+ if (!t) checkBoundaryChildren(globalQueue);
439
+ if (dirtyQueue.S >= dirtyQueue.C) runHeap(dirtyQueue, GlobalQueue.ne);
347
440
  if (n) {
348
- const t = globalQueue.L;
441
+ const t = globalQueue.J;
349
442
  for (let e = 0; e < t.length; e++) {
350
443
  const n = t[e];
351
- if (n.te !== NOT_PENDING) {
352
- n.ne = n.te;
353
- n.te = NOT_PENDING;
354
- if (n.q && n.q !== EFFECT_TRACKED) n.Z = true;
444
+ if (n.B !== NOT_PENDING) {
445
+ n.Re = n.B;
446
+ n.B = NOT_PENDING;
447
+ if (n.fe && n.fe !== EFFECT_TRACKED) n.Ee = true;
355
448
  }
356
- if (n.U) GlobalQueue.K(n, false, true);
449
+ n.Oe &= ~STATUS_UNINITIALIZED;
450
+ if (n.U) GlobalQueue.ie(n, false, true);
357
451
  }
358
452
  t.length = 0;
359
- const n = e ? e.optimisticNodes : globalQueue.H;
453
+ const n = e ? e.ee : globalQueue.ee;
360
454
  for (let e = 0; e < n.length; e++) {
361
455
  const t = n[e];
362
- const i = t.te;
363
- if (i !== NOT_PENDING && t.ne !== i) {
364
- t.ne = i;
456
+ const i = t.B;
457
+ t.W = undefined;
458
+ if (i !== NOT_PENDING && t.Re !== i) {
459
+ t.Re = i;
365
460
  insertSubs(t, true);
366
461
  }
367
- t.te = NOT_PENDING;
368
- t.X = null;
462
+ t.B = NOT_PENDING;
463
+ t.$ = null;
369
464
  }
370
465
  n.length = 0;
371
- const i = e ? e.optimisticStores : globalQueue.F;
372
- if (GlobalQueue.Y && i.size) {
466
+ const i = e ? e.te : globalQueue.te;
467
+ if (GlobalQueue.re && i.size) {
373
468
  for (const e of i) {
374
- GlobalQueue.Y(e);
469
+ GlobalQueue.re(e);
375
470
  }
376
471
  i.clear();
377
472
  schedule();
378
473
  }
474
+ for (const t of activeLanes) {
475
+ const n = e ? t.$ === e : !t.$;
476
+ if (!n) continue;
477
+ if (!t.F) {
478
+ if (t.M[0].length) runQueue(t.M[0], EFFECT_RENDER);
479
+ if (t.M[1].length) runQueue(t.M[1], EFFECT_USER);
480
+ }
481
+ if (t.t.W === t) t.t.W = undefined;
482
+ t.G.clear();
483
+ t.M[0].length = 0;
484
+ t.M[1].length = 0;
485
+ activeLanes.delete(t);
486
+ signalLanes.delete(t.t);
487
+ }
488
+ }
489
+ }
490
+ function checkBoundaryChildren(e) {
491
+ for (const t of e.Z) {
492
+ t.checkSources?.();
493
+ checkBoundaryChildren(t);
379
494
  }
380
495
  }
381
496
  function trackOptimisticStore(e) {
382
- globalQueue.F.add(e);
497
+ globalQueue.te.add(e);
383
498
  schedule();
384
499
  }
385
- function runTransitionPending(e) {
500
+ function reassignPendingTransition(e) {
386
501
  for (let t = 0; t < e.length; t++) {
387
- e[t].X = activeTransition;
502
+ e[t].$ = activeTransition;
388
503
  }
389
504
  }
390
505
  const globalQueue = new GlobalQueue();
@@ -397,20 +512,21 @@ function runQueue(e, t) {
397
512
  for (let n = 0; n < e.length; n++) e[n](t);
398
513
  }
399
514
  function transitionComplete(e) {
400
- if (e.done) return true;
401
- if (e.actions.length) return false;
515
+ if (e.ae) return true;
516
+ if (e.le.length) return false;
402
517
  let t = true;
403
- for (let n = 0; n < e.asyncNodes.length; n++) {
404
- if (e.asyncNodes[n].ie & STATUS_PENDING) {
518
+ for (let n = 0; n < e.ue.length; n++) {
519
+ const i = e.ue[n];
520
+ if (i.Oe & STATUS_PENDING && i.se?.t === i) {
405
521
  t = false;
406
522
  break;
407
523
  }
408
524
  }
409
- t && (e.done = true);
525
+ t && (e.ae = true);
410
526
  return t;
411
527
  }
412
528
  function currentTransition(e) {
413
- while (e.done && typeof e.done === "object") e = e.done;
529
+ while (e.ae && typeof e.ae === "object") e = e.ae;
414
530
  return e;
415
531
  }
416
532
  function runInTransition(e, t) {
@@ -434,11 +550,11 @@ function action(e) {
434
550
  const r = e(...t);
435
551
  globalQueue.initTransition();
436
552
  let o = activeTransition;
437
- o.actions.push(r);
553
+ o.le.push(r);
438
554
  const done = (e, t) => {
439
555
  o = currentTransition(o);
440
- const s = o.actions.indexOf(r);
441
- if (s >= 0) o.actions.splice(s, 1);
556
+ const s = o.le.indexOf(r);
557
+ if (s >= 0) o.le.splice(s, 1);
442
558
  activeTransition = o;
443
559
  schedule();
444
560
  t ? i(t) : n(e);
@@ -466,8 +582,8 @@ function action(e) {
466
582
  step();
467
583
  });
468
584
  }
469
- GlobalQueue.j = recompute;
470
- GlobalQueue.K = disposeChildren;
585
+ GlobalQueue.ne = recompute;
586
+ GlobalQueue.ie = disposeChildren;
471
587
  let tracking = false;
472
588
  let stale = false;
473
589
  let refreshing = false;
@@ -476,105 +592,149 @@ let foundPending = false;
476
592
  let pendingReadActive = false;
477
593
  let context = null;
478
594
  function recompute(e, t = false) {
479
- const n = e.q;
595
+ const n = e.fe;
480
596
  if (!t) {
481
- if (e.X && (!n || activeTransition) && activeTransition !== e.X)
482
- globalQueue.initTransition(e.X);
483
- deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
484
- if (e.X) disposeChildren(e);
597
+ if (e.$ && (!n || activeTransition) && activeTransition !== e.$)
598
+ globalQueue.initTransition(e.$);
599
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
600
+ if (e.$ || n === EFFECT_TRACKED) disposeChildren(e);
485
601
  else {
486
602
  markDisposal(e);
487
- e.re = e.oe;
488
- e.se = e.ue;
489
- e.oe = null;
490
- e.ue = null;
603
+ e.Se = e._e;
604
+ e.Ie = e.pe;
605
+ e._e = null;
606
+ e.pe = null;
491
607
  }
492
608
  }
493
- const i = !!(e.S & REACTIVE_OPTIMISTIC_DIRTY);
494
- const r = e.le && e.te !== NOT_PENDING;
495
- const o = context;
609
+ const i = !!(e._ & REACTIVE_OPTIMISTIC_DIRTY);
610
+ const r = hasActiveOverride(e);
611
+ const o = !!(e.Oe & STATUS_PENDING);
612
+ const s = context;
496
613
  context = e;
497
- e.ce = null;
498
- e.S = REACTIVE_RECOMPUTING_DEPS;
499
- e.ae = clock;
500
- let s = e.te === NOT_PENDING ? e.ne : e.te;
501
- let u = e.o;
614
+ e.he = null;
615
+ e._ = REACTIVE_RECOMPUTING_DEPS;
616
+ e.ce = clock;
617
+ let u = e.B === NOT_PENDING ? e.Re : e.B;
618
+ let c = e.u;
502
619
  let l = tracking;
503
- let c = optimisticReadActive;
620
+ let a = currentOptimisticLane;
504
621
  tracking = true;
505
- if (i) setOptimisticReadActive(true);
622
+ if (i) {
623
+ const t = resolveLane(e);
624
+ if (t) setCurrentOptimisticLane(t);
625
+ }
506
626
  try {
507
- s = handleAsync(e, e.U(s));
627
+ u = handleAsync(e, e.U(u));
508
628
  clearStatus(e);
629
+ const t = resolveLane(e);
630
+ if (t) {
631
+ t.G.delete(e);
632
+ updatePendingSignal(t.t);
633
+ }
509
634
  } catch (t) {
510
- if (t instanceof NotReadyError) {
511
- if (t.cause !== e) link(t.cause, e);
512
- notifyStatus(e, STATUS_PENDING, t);
513
- } else notifyStatus(e, STATUS_ERROR, t);
635
+ if (t instanceof NotReadyError && currentOptimisticLane) {
636
+ const t = findLane(currentOptimisticLane);
637
+ if (t.t !== e) {
638
+ t.G.add(e);
639
+ e.W = t;
640
+ updatePendingSignal(t.t);
641
+ }
642
+ }
643
+ notifyStatus(
644
+ e,
645
+ t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
646
+ t,
647
+ undefined,
648
+ t instanceof NotReadyError ? e.W : undefined
649
+ );
514
650
  } finally {
515
651
  tracking = l;
516
- e.S = REACTIVE_NONE;
517
- context = o;
652
+ e._ = REACTIVE_NONE;
653
+ context = s;
518
654
  }
519
- if (!e.B) {
520
- const o = e.ce;
521
- let l = o !== null ? o.D : e.C;
655
+ if (!e.se) {
656
+ const s = e.he;
657
+ let l = s !== null ? s.m : e.D;
522
658
  if (l !== null) {
523
659
  do {
524
660
  l = unlinkSubs(l);
525
661
  } while (l !== null);
526
- if (o !== null) o.D = null;
527
- else e.C = null;
528
- }
529
- const c = !e.fe || !e.fe(e.te === NOT_PENDING ? e.ne : e.te, s);
530
- if (c) {
531
- if (t || (n && activeTransition !== e.X) || i) e.ne = s;
532
- else e.te = s;
533
- insertSubs(e, i || r);
534
- } else if (e.o != u) {
535
- for (let t = e.p; t !== null; t = t.I) {
536
- insertIntoHeapHeight(t.h, t.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
662
+ if (s !== null) s.m = null;
663
+ else e.D = null;
664
+ }
665
+ const a = r ? e.Re : e.B === NOT_PENDING ? e.Re : e.B;
666
+ const f = !e.Ae || !e.Ae(a, u);
667
+ if (f) {
668
+ const s = r ? e.Re : undefined;
669
+ if (t || (n && activeTransition !== e.$) || i) e.Re = u;
670
+ else e.B = u;
671
+ if (r && !i && o) {
672
+ const t = e.K || 0;
673
+ const n = e.j || 0;
674
+ if (t <= n) e.Re = u;
675
+ }
676
+ if (!r || i || e.Re !== s) {
677
+ insertSubs(e, i || r);
678
+ }
679
+ } else if (r) {
680
+ e.B = u;
681
+ } else if (e.u != c) {
682
+ for (let t = e.p; t !== null; t = t.h) {
683
+ insertIntoHeapHeight(t.A, t.A._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
537
684
  }
538
685
  }
539
686
  }
540
- setOptimisticReadActive(c);
541
- (!t || e.ie & STATUS_PENDING) && !e.X && !(activeTransition && e.le) && globalQueue.L.push(e);
542
- e.X && n && activeTransition !== e.X && runInTransition(e.X, () => recompute(e));
687
+ setCurrentOptimisticLane(a);
688
+ (!t || e.Oe & STATUS_PENDING) && !e.$ && !(activeTransition && e.Y) && globalQueue.J.push(e);
689
+ e.$ && n && activeTransition !== e.$ && runInTransition(e.$, () => recompute(e));
543
690
  }
544
691
  function handleAsync(e, t, n) {
545
692
  const i = typeof t === "object" && t !== null;
546
693
  const r = i && untrack(() => t[Symbol.asyncIterator]);
547
694
  const o = !r && i && untrack(() => typeof t.then === "function");
548
695
  if (!o && !r) {
549
- e.Ee = null;
696
+ e.ge = null;
550
697
  return t;
551
698
  }
552
- e.Ee = t;
699
+ e.ge = t;
553
700
  let s;
554
701
  const handleError = n => {
555
- if (e.Ee !== t) return;
556
- globalQueue.initTransition(e.X);
557
- if (n instanceof NotReadyError) {
558
- if (n.cause !== e) link(n.cause, e);
559
- notifyStatus(e, STATUS_PENDING, n);
560
- } else notifyStatus(e, STATUS_ERROR, n);
561
- e.ae = clock;
702
+ if (e.ge !== t) return;
703
+ globalQueue.initTransition(e.$);
704
+ notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
705
+ e.ce = clock;
562
706
  };
563
707
  const asyncWrite = (i, r) => {
564
- if (e.Ee !== t) return;
565
- globalQueue.initTransition(e.X);
708
+ if (e.ge !== t) return;
709
+ if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
710
+ globalQueue.initTransition(e.$);
566
711
  clearStatus(e);
712
+ const o = resolveLane(e);
713
+ if (o) o.G.delete(e);
567
714
  if (n) n(i);
568
- else if (e.le) {
569
- const t = e.te !== NOT_PENDING;
570
- if (e.U) e.te = i;
715
+ else if (e.Y) {
716
+ const t = e.B !== NOT_PENDING;
717
+ if (e.U) e.B = i;
571
718
  if (!t) {
572
- e.ne = i;
719
+ e.Re = i;
573
720
  insertSubs(e);
574
721
  }
575
- e.ae = clock;
576
- schedule();
577
- } else setSignal(e, () => i);
722
+ e.ce = clock;
723
+ } else if (o) {
724
+ const t = e.Re;
725
+ const n = e.Ae;
726
+ if (!n || !n(i, t)) {
727
+ e.Re = i;
728
+ e.ce = clock;
729
+ if (e.Ne) {
730
+ setSignal(e.Ne, i);
731
+ }
732
+ insertSubs(e, true);
733
+ }
734
+ } else {
735
+ setSignal(e, () => i);
736
+ }
737
+ schedule();
578
738
  flush();
579
739
  r?.();
580
740
  };
@@ -594,7 +754,7 @@ function handleAsync(e, t, n) {
594
754
  );
595
755
  i = false;
596
756
  if (!n) {
597
- globalQueue.initTransition(e.X);
757
+ globalQueue.initTransition(e.$);
598
758
  throw new NotReadyError(context);
599
759
  }
600
760
  }
@@ -626,177 +786,191 @@ function handleAsync(e, t, n) {
626
786
  };
627
787
  const r = iterate();
628
788
  if (!i && !r) {
629
- globalQueue.initTransition(e.X);
789
+ globalQueue.initTransition(e.$);
630
790
  throw new NotReadyError(context);
631
791
  }
632
792
  }
633
793
  return s;
634
794
  }
635
795
  function clearStatus(e) {
636
- e.ie = STATUS_NONE;
637
- e.B = null;
796
+ e.Oe = e.Oe & STATUS_UNINITIALIZED;
797
+ e.se = null;
638
798
  updatePendingSignal(e);
639
- if (e.Te) {
640
- e.Te();
641
- } else {
642
- if (!e.X) {
643
- for (let t = e.p; t !== null; t = t.I) {
644
- if (t.h.ie & STATUS_PENDING) {
645
- insertIntoHeap(t.h, t.h.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
646
- }
647
- }
799
+ e.Pe?.();
800
+ }
801
+ function notifyStatus(e, t, n, i, r) {
802
+ if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError))
803
+ n = new StatusError(e, n);
804
+ const o = n instanceof NotReadyError && n.t === e;
805
+ const s = t === STATUS_PENDING && e.Y && !o;
806
+ const u = s && hasActiveOverride(e);
807
+ if (!i) {
808
+ e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
809
+ e.se = n;
810
+ updatePendingSignal(e);
811
+ }
812
+ if (r && !i) {
813
+ assignOrMergeLane(e, r);
814
+ }
815
+ if (u && activeTransition && n instanceof NotReadyError) {
816
+ const e = n.t;
817
+ if (!activeTransition.ue.includes(e)) {
818
+ activeTransition.ue.push(e);
819
+ }
820
+ }
821
+ const c = i || u;
822
+ const l = i || s ? undefined : r;
823
+ if (e.Pe) {
824
+ if (c) {
825
+ e.Pe(t, n);
826
+ } else {
827
+ e.Pe();
648
828
  }
649
- schedule();
829
+ return;
650
830
  }
651
- }
652
- function notifyStatus(e, t, n) {
653
- e.ie = t | (t !== STATUS_ERROR ? e.ie & STATUS_UNINITIALIZED : 0);
654
- e.B = n;
655
- updatePendingSignal(e);
656
- if (e.Te) return e.Te();
657
- for (let i = e.p; i !== null; i = i.I) {
658
- i.h.ae = clock;
659
- if (i.h.B !== n) {
660
- !i.h.X && globalQueue.L.push(i.h);
661
- notifyStatus(i.h, t, n);
831
+ for (let i = e.p; i !== null; i = i.h) {
832
+ i.A.ce = clock;
833
+ if (i.A.se !== n) {
834
+ !i.A.$ && globalQueue.J.push(i.A);
835
+ notifyStatus(i.A, t, n, c, l);
662
836
  }
663
837
  }
664
- for (let i = e.A; i !== null; i = i.P) {
665
- for (let e = i.p; e !== null; e = e.I) {
666
- e.h.ae = clock;
667
- if (e.h.B !== n) {
668
- !e.h.X && globalQueue.L.push(e.h);
669
- notifyStatus(e.h, t, n);
838
+ for (let i = e.N; i !== null; i = i.P) {
839
+ for (let e = i.p; e !== null; e = e.h) {
840
+ e.A.ce = clock;
841
+ if (e.A.se !== n) {
842
+ !e.A.$ && globalQueue.J.push(e.A);
843
+ notifyStatus(e.A, t, n, c, l);
670
844
  }
671
845
  }
672
846
  }
673
847
  }
674
848
  function updateIfNecessary(e) {
675
- if (e.S & REACTIVE_CHECK) {
676
- for (let t = e.C; t; t = t.D) {
849
+ if (e._ & REACTIVE_CHECK) {
850
+ for (let t = e.D; t; t = t.m) {
677
851
  const n = t.V;
678
- const i = n.m || n;
852
+ const i = n.L || n;
679
853
  if (i.U) {
680
854
  updateIfNecessary(i);
681
855
  }
682
- if (e.S & REACTIVE_DIRTY) {
856
+ if (e._ & REACTIVE_DIRTY) {
683
857
  break;
684
858
  }
685
859
  }
686
860
  }
687
- if (e.S & REACTIVE_DIRTY) {
861
+ if (e._ & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.se && e.ce < clock)) {
688
862
  recompute(e);
689
863
  }
690
- e.S = REACTIVE_NONE;
864
+ e._ = REACTIVE_NONE;
691
865
  }
692
866
  function unlinkSubs(e) {
693
867
  const t = e.V;
694
- const n = e.D;
695
- const i = e.I;
696
- const r = e.Re;
697
- if (i !== null) i.Re = r;
698
- else t.de = r;
699
- if (r !== null) r.I = i;
868
+ const n = e.m;
869
+ const i = e.h;
870
+ const r = e.Ce;
871
+ if (i !== null) i.Ce = r;
872
+ else t.ye = r;
873
+ if (r !== null) r.h = i;
700
874
  else {
701
875
  t.p = i;
702
876
  if (i === null) {
703
- t.Oe?.();
704
- t.U && !t.Se && unobserved(t);
877
+ t.De?.();
878
+ t.U && !t.ve && unobserved(t);
705
879
  }
706
880
  }
707
881
  return n;
708
882
  }
709
883
  function unobserved(e) {
710
- deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
711
- let t = e.C;
884
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
885
+ let t = e.D;
712
886
  while (t !== null) {
713
887
  t = unlinkSubs(t);
714
888
  }
715
- e.C = null;
889
+ e.D = null;
716
890
  disposeChildren(e, true);
717
891
  }
718
892
  function link(e, t) {
719
- const n = t.ce;
893
+ const n = t.he;
720
894
  if (n !== null && n.V === e) return;
721
895
  let i = null;
722
- const r = t.S & REACTIVE_RECOMPUTING_DEPS;
896
+ const r = t._ & REACTIVE_RECOMPUTING_DEPS;
723
897
  if (r) {
724
- i = n !== null ? n.D : t.C;
898
+ i = n !== null ? n.m : t.D;
725
899
  if (i !== null && i.V === e) {
726
- t.ce = i;
900
+ t.he = i;
727
901
  return;
728
902
  }
729
903
  }
730
- const o = e.de;
731
- if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
732
- const s = (t.ce = e.de = { V: e, h: t, D: i, Re: o, I: null });
733
- if (n !== null) n.D = s;
734
- else t.C = s;
735
- if (o !== null) o.I = s;
904
+ const o = e.ye;
905
+ if (o !== null && o.A === t && (!r || isValidLink(o, t))) return;
906
+ const s = (t.he = e.ye = { V: e, A: t, m: i, Ce: o, h: null });
907
+ if (n !== null) n.m = s;
908
+ else t.D = s;
909
+ if (o !== null) o.h = s;
736
910
  else e.p = s;
737
911
  }
738
912
  function isValidLink(e, t) {
739
- const n = t.ce;
913
+ const n = t.he;
740
914
  if (n !== null) {
741
- let i = t.C;
915
+ let i = t.D;
742
916
  do {
743
917
  if (i === e) return true;
744
918
  if (i === n) break;
745
- i = i.D;
919
+ i = i.m;
746
920
  } while (i !== null);
747
921
  }
748
922
  return false;
749
923
  }
750
924
  function markDisposal(e) {
751
- let t = e.ue;
925
+ let t = e.pe;
752
926
  while (t) {
753
- t.S |= REACTIVE_ZOMBIE;
754
- if (t.S & REACTIVE_IN_HEAP) {
927
+ t._ |= REACTIVE_ZOMBIE;
928
+ if (t._ & REACTIVE_IN_HEAP) {
755
929
  deleteFromHeap(t, dirtyQueue);
756
930
  insertIntoHeap(t, zombieQueue);
757
931
  }
758
932
  markDisposal(t);
759
- t = t._e;
933
+ t = t.we;
760
934
  }
761
935
  }
762
936
  function dispose(e) {
763
- let t = e.C || null;
937
+ let t = e.D || null;
764
938
  do {
765
939
  t = unlinkSubs(t);
766
940
  } while (t !== null);
767
- e.C = null;
768
- e.ce = null;
941
+ e.D = null;
942
+ e.he = null;
769
943
  disposeChildren(e, true);
770
944
  }
771
945
  function disposeChildren(e, t = false, n) {
772
- if (e.S & REACTIVE_DISPOSED) return;
773
- if (t) e.S = REACTIVE_DISPOSED;
774
- let i = n ? e.se : e.ue;
946
+ if (e._ & REACTIVE_DISPOSED) return;
947
+ if (t) e._ = REACTIVE_DISPOSED;
948
+ let i = n ? e.Ie : e.pe;
775
949
  while (i) {
776
- const e = i._e;
777
- if (i.C) {
950
+ const e = i.we;
951
+ if (i.D) {
778
952
  const e = i;
779
- deleteFromHeap(e, e.S & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
780
- let t = e.C;
953
+ deleteFromHeap(e, e._ & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
954
+ let t = e.D;
781
955
  do {
782
956
  t = unlinkSubs(t);
783
957
  } while (t !== null);
784
- e.C = null;
785
- e.ce = null;
958
+ e.D = null;
959
+ e.he = null;
786
960
  }
787
961
  disposeChildren(i, true);
788
962
  i = e;
789
963
  }
790
964
  if (n) {
791
- e.se = null;
965
+ e.Ie = null;
792
966
  } else {
793
- e.ue = null;
794
- e._e = null;
967
+ e.pe = null;
968
+ e.we = null;
795
969
  }
796
970
  runDisposal(e, n);
797
971
  }
798
972
  function runDisposal(e, t) {
799
- let n = t ? e.re : e.oe;
973
+ let n = t ? e.Se : e._e;
800
974
  if (!n) return;
801
975
  if (Array.isArray(n)) {
802
976
  for (let e = 0; e < n.length; e++) {
@@ -806,10 +980,10 @@ function runDisposal(e, t) {
806
980
  } else {
807
981
  n.call(n);
808
982
  }
809
- t ? (e.re = null) : (e.oe = null);
983
+ t ? (e.Se = null) : (e._e = null);
810
984
  }
811
985
  function getNextChildId(e) {
812
- if (e.id != null) return formatId(e.id, e.pe++);
986
+ if (e.id != null) return formatId(e.id, e.be++);
813
987
  throw new Error("Cannot get child id from owner without an id");
814
988
  }
815
989
  function formatId(e, t) {
@@ -820,102 +994,132 @@ function formatId(e, t) {
820
994
  function computed(e, t, n) {
821
995
  const i = {
822
996
  id: n?.id ?? (context?.id != null ? getNextChildId(context) : undefined),
823
- fe: n?.equals != null ? n.equals : isEqual,
824
- Ie: !!n?.pureWrite,
825
- Oe: n?.unobserved,
826
- oe: null,
827
- J: context?.J ?? globalQueue,
828
- he: context?.he ?? defaultContext,
829
- pe: 0,
997
+ Ae: n?.equals != null ? n.equals : isEqual,
998
+ me: !!n?.pureWrite,
999
+ De: n?.unobserved,
1000
+ _e: null,
1001
+ Te: context?.Te ?? globalQueue,
1002
+ Ve: context?.Ve ?? defaultContext,
1003
+ be: 0,
830
1004
  U: e,
831
- ne: t,
832
- o: 0,
833
- A: null,
834
- R: undefined,
835
- T: null,
836
- C: null,
837
- ce: null,
1005
+ Re: t,
1006
+ u: 0,
1007
+ N: null,
1008
+ O: undefined,
1009
+ R: null,
1010
+ D: null,
1011
+ he: null,
838
1012
  p: null,
839
- de: null,
840
- i: context,
841
- _e: null,
842
- ue: null,
843
- S: REACTIVE_NONE,
844
- ie: STATUS_UNINITIALIZED,
845
- ae: clock,
846
- te: NOT_PENDING,
847
- re: null,
848
- se: null,
849
- Ee: null,
850
- X: null
1013
+ ye: null,
1014
+ o: context,
1015
+ we: null,
1016
+ pe: null,
1017
+ _: REACTIVE_NONE,
1018
+ Oe: STATUS_UNINITIALIZED,
1019
+ ce: clock,
1020
+ B: NOT_PENDING,
1021
+ Se: null,
1022
+ Ie: null,
1023
+ ge: null,
1024
+ $: null
851
1025
  };
852
- i.T = i;
853
- const r = context?.t ? context.u : context;
1026
+ i.R = i;
1027
+ const r = context?.i ? context.l : context;
854
1028
  if (context) {
855
- const e = context.ue;
1029
+ const e = context.pe;
856
1030
  if (e === null) {
857
- context.ue = i;
1031
+ context.pe = i;
858
1032
  } else {
859
- i._e = e;
860
- context.ue = i;
1033
+ i.we = e;
1034
+ context.pe = i;
861
1035
  }
862
1036
  }
863
- if (r) i.o = r.o + 1;
1037
+ if (r) i.u = r.u + 1;
864
1038
  !n?.lazy && recompute(i, true);
865
1039
  return i;
866
1040
  }
867
1041
  function signal(e, t, n = null) {
868
1042
  const i = {
869
- fe: t?.equals != null ? t.equals : isEqual,
870
- Ie: !!t?.pureWrite,
871
- Oe: t?.unobserved,
872
- ne: e,
1043
+ Ae: t?.equals != null ? t.equals : isEqual,
1044
+ me: !!t?.pureWrite,
1045
+ De: t?.unobserved,
1046
+ Re: e,
873
1047
  p: null,
874
- de: null,
875
- ae: clock,
876
- m: n,
877
- P: n?.A || null,
878
- te: NOT_PENDING
1048
+ ye: null,
1049
+ ce: clock,
1050
+ L: n,
1051
+ P: n?.N || null,
1052
+ B: NOT_PENDING
879
1053
  };
880
- n && (n.A = i);
1054
+ n && (n.N = i);
881
1055
  return i;
882
1056
  }
883
1057
  function optimisticSignal(e, t) {
884
1058
  const n = signal(e, t);
885
- n.le = true;
1059
+ n.Y = true;
886
1060
  return n;
887
1061
  }
888
1062
  function optimisticComputed(e, t, n) {
889
1063
  const i = computed(e, t, n);
890
- i.le = true;
1064
+ i.Y = true;
891
1065
  return i;
892
1066
  }
893
1067
  function getPendingSignal(e) {
894
- if (!e.Ae) {
895
- e.Ae = optimisticSignal(false, { pureWrite: true });
896
- if (computePendingState(e)) setSignal(e.Ae, true);
1068
+ if (!e.Le) {
1069
+ e.Le = optimisticSignal(false, { pureWrite: true });
1070
+ if (e.k) {
1071
+ e.Le.k = e;
1072
+ }
1073
+ if (computePendingState(e)) setSignal(e.Le, true);
897
1074
  }
898
- return e.Ae;
1075
+ return e.Le;
899
1076
  }
900
1077
  function computePendingState(e) {
901
- if (e.te !== NOT_PENDING) return true;
902
1078
  const t = e;
903
- return !!(t.ie & STATUS_PENDING && !(t.ie & STATUS_UNINITIALIZED));
1079
+ if (e.Y && e.B !== NOT_PENDING) {
1080
+ if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1081
+ if (e.k) {
1082
+ const t = e.W ? findLane(e.W) : null;
1083
+ return !!(t && t.G.size > 0);
1084
+ }
1085
+ return true;
1086
+ }
1087
+ if (e.B !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1088
+ return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
904
1089
  }
905
1090
  function getPendingValueComputed(e) {
906
- if (!e.ge) {
1091
+ if (!e.Ne) {
907
1092
  const t = pendingReadActive;
908
1093
  pendingReadActive = false;
909
- const n = context;
1094
+ const n = pendingCheckActive;
1095
+ pendingCheckActive = false;
1096
+ const i = context;
910
1097
  context = null;
911
- e.ge = optimisticComputed(() => read(e));
912
- context = n;
1098
+ e.Ne = optimisticComputed(() => read(e));
1099
+ e.Ne.k = e;
1100
+ context = i;
1101
+ pendingCheckActive = n;
913
1102
  pendingReadActive = t;
914
1103
  }
915
- return e.ge;
1104
+ return e.Ne;
916
1105
  }
917
1106
  function updatePendingSignal(e) {
918
- if (e.Ae) setSignal(e.Ae, computePendingState(e));
1107
+ if (e.Le) {
1108
+ const t = computePendingState(e);
1109
+ const n = e.Le;
1110
+ setSignal(n, t);
1111
+ if (!t && n.W) {
1112
+ const t = resolveLane(e);
1113
+ if (t && t.G.size > 0) {
1114
+ const e = findLane(n.W);
1115
+ if (e !== t) {
1116
+ mergeLanes(t, e);
1117
+ }
1118
+ }
1119
+ clearLaneEntry(n);
1120
+ n.W = undefined;
1121
+ }
1122
+ }
919
1123
  }
920
1124
  function isEqual(e, t) {
921
1125
  return e === t;
@@ -930,8 +1134,24 @@ function untrack(e) {
930
1134
  }
931
1135
  }
932
1136
  function read(e) {
1137
+ if (pendingReadActive) {
1138
+ const t = getPendingValueComputed(e);
1139
+ const n = pendingReadActive;
1140
+ pendingReadActive = false;
1141
+ const i = read(t);
1142
+ pendingReadActive = n;
1143
+ if (t.Oe & STATUS_PENDING) return e.Re;
1144
+ if (stale && currentOptimisticLane && t.W) {
1145
+ const n = findLane(t.W);
1146
+ const i = findLane(currentOptimisticLane);
1147
+ if (n !== i && n.G.size > 0) {
1148
+ return e.Re;
1149
+ }
1150
+ }
1151
+ return i;
1152
+ }
933
1153
  if (pendingCheckActive) {
934
- const t = e.m || e;
1154
+ const t = e.L || e;
935
1155
  const n = getPendingSignal(t);
936
1156
  const i = pendingCheckActive;
937
1157
  pendingCheckActive = false;
@@ -939,86 +1159,92 @@ function read(e) {
939
1159
  foundPending = true;
940
1160
  }
941
1161
  pendingCheckActive = i;
942
- return e.ne;
943
- }
944
- if (pendingReadActive) {
945
- const t = getPendingValueComputed(e);
946
- const n = pendingReadActive;
947
- pendingReadActive = false;
948
- const i = read(t);
949
- pendingReadActive = n;
950
- if (t.ie & STATUS_PENDING) return e.ne;
951
- return i;
1162
+ return e.Re;
952
1163
  }
953
1164
  let t = context;
954
- if (t?.t) t = t.u;
1165
+ if (t?.i) t = t.l;
955
1166
  if (refreshing && e.U) recompute(e);
956
1167
  if (t && tracking) {
957
- if (e.U && e.S & REACTIVE_DISPOSED) recompute(e);
1168
+ if (e.U && e._ & REACTIVE_DISPOSED) recompute(e);
958
1169
  link(e, t);
959
- const n = e.m || e;
1170
+ const n = e.L || e;
960
1171
  if (n.U) {
961
- const i = e.S & REACTIVE_ZOMBIE;
962
- if (n.o >= (i ? zombieQueue.N : dirtyQueue.N)) {
1172
+ const i = e._ & REACTIVE_ZOMBIE;
1173
+ if (n.u >= (i ? zombieQueue.C : dirtyQueue.C)) {
963
1174
  markNode(t);
964
1175
  markHeap(i ? zombieQueue : dirtyQueue);
965
1176
  updateIfNecessary(n);
966
1177
  }
967
- const r = n.o;
968
- if (r >= t.o && e.i !== t) {
969
- t.o = r + 1;
1178
+ const r = n.u;
1179
+ if (r >= t.u && e.o !== t) {
1180
+ t.u = r + 1;
1181
+ }
1182
+ }
1183
+ }
1184
+ const n = e.L || e;
1185
+ if (t && n.Oe & STATUS_PENDING && !(stale && n.$ && activeTransition !== n.$)) {
1186
+ if (currentOptimisticLane) {
1187
+ const i = n.W;
1188
+ const r = findLane(currentOptimisticLane);
1189
+ if (i && findLane(i) === r && !hasActiveOverride(n)) {
1190
+ if (!tracking) link(e, t);
1191
+ throw n.se;
970
1192
  }
1193
+ } else {
1194
+ if (!tracking) link(e, t);
1195
+ throw n.se;
971
1196
  }
972
1197
  }
973
- const n = e.m || e;
974
- if (
975
- t &&
976
- !optimisticReadActive &&
977
- n.ie & STATUS_PENDING &&
978
- !(stale && n.X && activeTransition !== n.X)
979
- )
980
- throw n.B;
981
- if (e.U && e.ie & STATUS_ERROR) {
982
- if (e.ae < clock) {
1198
+ if (e.U && e.Oe & STATUS_ERROR) {
1199
+ if (e.ce < clock) {
983
1200
  recompute(e, true);
984
1201
  return read(e);
985
- } else throw e.B;
1202
+ } else throw e.se;
986
1203
  }
987
1204
  return !t ||
988
- optimisticReadActive ||
989
- e.te === NOT_PENDING ||
990
- (stale && e.X && activeTransition !== e.X)
991
- ? e.ne
992
- : e.te;
1205
+ currentOptimisticLane !== null ||
1206
+ e.B === NOT_PENDING ||
1207
+ (stale && e.$ && activeTransition !== e.$)
1208
+ ? e.Re
1209
+ : e.B;
993
1210
  }
994
1211
  function setSignal(e, t) {
995
- if (e.X && activeTransition !== e.X) globalQueue.initTransition(e.X);
996
- const n = e.le && !projectionWriteActive;
997
- const i = n ? e.ne : e.te === NOT_PENDING ? e.ne : e.te;
1212
+ if (e.$ && activeTransition !== e.$) globalQueue.initTransition(e.$);
1213
+ const n = e.Y && !projectionWriteActive;
1214
+ const i = n ? e.Re : e.B === NOT_PENDING ? e.Re : e.B;
998
1215
  if (typeof t === "function") t = t(i);
999
- const r = !e.fe || !e.fe(i, t);
1000
- if (!r) return t;
1216
+ const r = !e.Ae || !e.Ae(i, t);
1217
+ if (!r) {
1218
+ if (n && e.B !== NOT_PENDING && e.U) {
1219
+ insertSubs(e, true);
1220
+ schedule();
1221
+ }
1222
+ return t;
1223
+ }
1001
1224
  if (n) {
1002
- const n = globalQueue.H.includes(e);
1003
- if (e.X && n) {
1004
- globalQueue.initTransition(e.X);
1225
+ const n = globalQueue.ee.includes(e);
1226
+ if (e.$ && n) {
1227
+ globalQueue.initTransition(e.$);
1005
1228
  }
1006
- if (e.te === NOT_PENDING) {
1007
- e.te = e.ne;
1229
+ if (e.B === NOT_PENDING) {
1230
+ e.B = e.Re;
1008
1231
  }
1009
1232
  if (!n) {
1010
- globalQueue.H.push(e);
1233
+ globalQueue.ee.push(e);
1011
1234
  }
1012
- e.ne = t;
1235
+ e.K = (e.K || 0) + 1;
1236
+ const i = getOrCreateLane(e);
1237
+ e.W = i;
1238
+ e.Re = t;
1013
1239
  } else {
1014
- if (e.te === NOT_PENDING) globalQueue.L.push(e);
1015
- e.te = t;
1240
+ if (e.B === NOT_PENDING) globalQueue.J.push(e);
1241
+ e.B = t;
1016
1242
  }
1017
1243
  updatePendingSignal(e);
1018
- if (e.ge) {
1019
- setSignal(e.ge, t);
1244
+ if (e.Ne) {
1245
+ setSignal(e.Ne, t);
1020
1246
  }
1021
- e.ae = clock;
1247
+ e.ce = clock;
1022
1248
  insertSubs(e, n);
1023
1249
  schedule();
1024
1250
  return t;
@@ -1033,37 +1259,37 @@ function getOwner() {
1033
1259
  }
1034
1260
  function onCleanup(e) {
1035
1261
  if (!context) return e;
1036
- if (!context.oe) context.oe = e;
1037
- else if (Array.isArray(context.oe)) context.oe.push(e);
1038
- else context.oe = [context.oe, e];
1262
+ if (!context._e) context._e = e;
1263
+ else if (Array.isArray(context._e)) context._e.push(e);
1264
+ else context._e = [context._e, e];
1039
1265
  return e;
1040
1266
  }
1041
1267
  function createOwner(e) {
1042
1268
  const t = context;
1043
1269
  const n = {
1044
1270
  id: e?.id ?? (t?.id != null ? getNextChildId(t) : undefined),
1045
- t: true,
1046
- u: t?.t ? t.u : t,
1047
- ue: null,
1271
+ i: true,
1272
+ l: t?.i ? t.l : t,
1273
+ pe: null,
1274
+ we: null,
1048
1275
  _e: null,
1049
- oe: null,
1050
- J: t?.J ?? globalQueue,
1051
- he: t?.he || defaultContext,
1052
- pe: 0,
1053
- re: null,
1054
- se: null,
1055
- i: t,
1276
+ Te: t?.Te ?? globalQueue,
1277
+ Ve: t?.Ve || defaultContext,
1278
+ be: 0,
1279
+ Se: null,
1280
+ Ie: null,
1281
+ o: t,
1056
1282
  dispose(e = true) {
1057
1283
  disposeChildren(n, e);
1058
1284
  }
1059
1285
  };
1060
1286
  if (t) {
1061
- const e = t.ue;
1287
+ const e = t.pe;
1062
1288
  if (e === null) {
1063
- t.ue = n;
1289
+ t.pe = n;
1064
1290
  } else {
1065
- n._e = e;
1066
- t.ue = n;
1291
+ n.we = e;
1292
+ t.pe = n;
1067
1293
  }
1068
1294
  }
1069
1295
  return n;
@@ -1110,6 +1336,8 @@ function isPending(e) {
1110
1336
  try {
1111
1337
  e();
1112
1338
  return foundPending;
1339
+ } catch {
1340
+ return foundPending;
1113
1341
  } finally {
1114
1342
  pendingCheckActive = t;
1115
1343
  foundPending = n;
@@ -1141,7 +1369,7 @@ function getContext(e, t = getOwner()) {
1141
1369
  if (!t) {
1142
1370
  throw new NoOwnerError();
1143
1371
  }
1144
- const n = hasContext(e, t) ? t.he[e.id] : e.defaultValue;
1372
+ const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
1145
1373
  if (isUndefined(n)) {
1146
1374
  throw new ContextNotFoundError();
1147
1375
  }
@@ -1151,10 +1379,10 @@ function setContext(e, t, n = getOwner()) {
1151
1379
  if (!n) {
1152
1380
  throw new NoOwnerError();
1153
1381
  }
1154
- n.he = { ...n.he, [e.id]: isUndefined(t) ? e.defaultValue : t };
1382
+ n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
1155
1383
  }
1156
1384
  function hasContext(e, t) {
1157
- return !isUndefined(t?.he[e.id]);
1385
+ return !isUndefined(t?.Ve[e.id]);
1158
1386
  }
1159
1387
  function isUndefined(e) {
1160
1388
  return typeof e === "undefined";
@@ -1164,78 +1392,80 @@ function effect(e, t, n, i, r) {
1164
1392
  const s = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
1165
1393
  ...r,
1166
1394
  equals: () => {
1167
- s.Z = !s.B;
1168
- if (o) s.J.enqueue(s.q, runEffect.bind(s));
1395
+ s.Ee = !s.se;
1396
+ if (o) s.Te.enqueue(s.fe, runEffect.bind(s));
1169
1397
  return false;
1170
1398
  },
1171
1399
  lazy: true
1172
1400
  });
1173
- s.Pe = i;
1174
- s.Ne = t;
1175
- s.Ce = n;
1176
- s.ye = undefined;
1177
- s.q = r?.render ? EFFECT_RENDER : EFFECT_USER;
1178
- s.Te = () => {
1179
- if (s.ie & STATUS_ERROR) {
1180
- let e = s.B;
1181
- s.J.notify(s, STATUS_PENDING, 0);
1182
- if (s.q === EFFECT_USER) {
1401
+ s.Ue = i;
1402
+ s.ke = t;
1403
+ s.We = n;
1404
+ s.Qe = undefined;
1405
+ s.fe = r?.render ? EFFECT_RENDER : EFFECT_USER;
1406
+ s.Pe = (e, t) => {
1407
+ const n = e !== undefined ? e : s.Oe;
1408
+ const i = t !== undefined ? t : s.se;
1409
+ if (n & STATUS_ERROR) {
1410
+ let e = i;
1411
+ s.Te.notify(s, STATUS_PENDING, 0);
1412
+ if (s.fe === EFFECT_USER) {
1183
1413
  try {
1184
- return s.Ce
1185
- ? s.Ce(e, () => {
1186
- s.ye?.();
1187
- s.ye = undefined;
1414
+ return s.We
1415
+ ? s.We(e, () => {
1416
+ s.Qe?.();
1417
+ s.Qe = undefined;
1188
1418
  })
1189
1419
  : console.error(e);
1190
1420
  } catch (t) {
1191
1421
  e = t;
1192
1422
  }
1193
1423
  }
1194
- if (!s.J.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
1195
- } else if (s.q === EFFECT_RENDER) s.J.notify(s, STATUS_PENDING | STATUS_ERROR, s.ie);
1424
+ if (!s.Te.notify(s, STATUS_ERROR, STATUS_ERROR)) throw e;
1425
+ } else if (s.fe === EFFECT_RENDER) s.Te.notify(s, STATUS_PENDING | STATUS_ERROR, n, i);
1196
1426
  };
1197
1427
  recompute(s, true);
1198
- !r?.defer && (s.q === EFFECT_USER ? s.J.enqueue(s.q, runEffect.bind(s)) : runEffect.call(s));
1428
+ !r?.defer && (s.fe === EFFECT_USER ? s.Te.enqueue(s.fe, runEffect.bind(s)) : runEffect.call(s));
1199
1429
  o = true;
1200
- onCleanup(() => s.ye?.());
1430
+ onCleanup(() => s.Qe?.());
1201
1431
  }
1202
1432
  function runEffect() {
1203
- if (!this.Z || this.S & REACTIVE_DISPOSED) return;
1204
- this.ye?.();
1205
- this.ye = undefined;
1433
+ if (!this.Ee || this._ & REACTIVE_DISPOSED) return;
1434
+ this.Qe?.();
1435
+ this.Qe = undefined;
1206
1436
  try {
1207
- this.ye = this.Ne(this.ne, this.Pe);
1437
+ this.Qe = this.ke(this.Re, this.Ue);
1208
1438
  } catch (e) {
1209
- if (!this.J.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1439
+ if (!this.Te.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1210
1440
  } finally {
1211
- this.Pe = this.ne;
1212
- this.Z = false;
1441
+ this.Ue = this.Re;
1442
+ this.Ee = false;
1213
1443
  }
1214
1444
  }
1215
1445
  function trackedEffect(e, t) {
1216
1446
  const run = () => {
1217
- if (!n.Z || n.S & REACTIVE_DISPOSED) return;
1218
- n.Z = false;
1447
+ if (!n.Ee || n._ & REACTIVE_DISPOSED) return;
1448
+ n.Ee = false;
1219
1449
  recompute(n);
1220
1450
  };
1221
1451
  const n = computed(
1222
1452
  () => {
1223
1453
  try {
1224
- n.ye?.();
1225
- n.ye = undefined;
1226
- n.ye = staleValues(e) || undefined;
1454
+ n.Qe?.();
1455
+ n.Qe = undefined;
1456
+ n.Qe = staleValues(e) || undefined;
1227
1457
  } finally {
1228
1458
  }
1229
1459
  },
1230
1460
  undefined,
1231
1461
  { ...t, lazy: true, pureWrite: true }
1232
1462
  );
1233
- n.ye = undefined;
1234
- n.Z = true;
1235
- n.q = EFFECT_TRACKED;
1236
- n.ee = run;
1237
- n.J.enqueue(EFFECT_USER, run);
1238
- onCleanup(() => n.ye?.());
1463
+ n.Qe = undefined;
1464
+ n.Ee = true;
1465
+ n.fe = EFFECT_TRACKED;
1466
+ n.de = run;
1467
+ n.Te.enqueue(EFFECT_USER, run);
1468
+ onCleanup(() => n.Qe?.());
1239
1469
  }
1240
1470
  function createSignal(e, t, n) {
1241
1471
  if (typeof e === "function") {
@@ -1328,26 +1558,26 @@ function applyState(e, t, n, i) {
1328
1558
  r[STORE_OVERRIDE] = undefined;
1329
1559
  if (Array.isArray(o)) {
1330
1560
  let t = false;
1331
- const l = getOverrideValue(o, s, u, "length");
1332
- if (e.length && l && e[0] && n(e[0]) != null) {
1333
- let c, a, f, E, T, R, d, O;
1561
+ const c = getOverrideValue(o, s, u, "length");
1562
+ if (e.length && c && e[0] && n(e[0]) != null) {
1563
+ let l, a, f, E, T, d, R, O;
1334
1564
  for (
1335
- f = 0, E = Math.min(l, e.length);
1336
- f < E && ((R = getOverrideValue(o, s, u, f)) === e[f] || (R && e[f] && n(R) === n(e[f])));
1565
+ f = 0, E = Math.min(c, e.length);
1566
+ f < E && ((d = getOverrideValue(o, s, u, f)) === e[f] || (d && e[f] && n(d) === n(e[f])));
1337
1567
  f++
1338
1568
  ) {
1339
- applyState(e[f], wrap(R, r), n, i);
1569
+ applyState(e[f], wrap(d, r), n, i);
1340
1570
  }
1341
1571
  const S = new Array(e.length),
1342
1572
  _ = new Map();
1343
1573
  for (
1344
- E = l - 1, T = e.length - 1;
1574
+ E = c - 1, T = e.length - 1;
1345
1575
  E >= f &&
1346
1576
  T >= f &&
1347
- ((R = getOverrideValue(o, s, u, E)) === e[T] || (R && e[T] && n(R) === n(e[T])));
1577
+ ((d = getOverrideValue(o, s, u, E)) === e[T] || (d && e[T] && n(d) === n(e[T])));
1348
1578
  E--, T--
1349
1579
  ) {
1350
- S[T] = R;
1580
+ S[T] = d;
1351
1581
  }
1352
1582
  if (f > T || f > E) {
1353
1583
  for (a = f; a <= T; a++) {
@@ -1361,24 +1591,24 @@ function applyState(e, t, n, i) {
1361
1591
  applyState(e[a], o, n, i);
1362
1592
  }
1363
1593
  t && r[STORE_NODE][$TRACK] && setSignal(r[STORE_NODE][$TRACK], void 0);
1364
- l !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
1594
+ c !== e.length && r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
1365
1595
  return;
1366
1596
  }
1367
- d = new Array(T + 1);
1597
+ R = new Array(T + 1);
1368
1598
  for (a = T; a >= f; a--) {
1369
- R = e[a];
1370
- O = R ? n(R) : R;
1371
- c = _.get(O);
1372
- d[a] = c === undefined ? -1 : c;
1599
+ d = e[a];
1600
+ O = d ? n(d) : d;
1601
+ l = _.get(O);
1602
+ R[a] = l === undefined ? -1 : l;
1373
1603
  _.set(O, a);
1374
1604
  }
1375
- for (c = f; c <= E; c++) {
1376
- R = getOverrideValue(o, s, u, c);
1377
- O = R ? n(R) : R;
1605
+ for (l = f; l <= E; l++) {
1606
+ d = getOverrideValue(o, s, u, l);
1607
+ O = d ? n(d) : d;
1378
1608
  a = _.get(O);
1379
1609
  if (a !== undefined && a !== -1) {
1380
- S[a] = R;
1381
- a = d[a];
1610
+ S[a] = d;
1611
+ a = R[a];
1382
1612
  _.set(O, a);
1383
1613
  }
1384
1614
  }
@@ -1391,14 +1621,14 @@ function applyState(e, t, n, i) {
1391
1621
  }
1392
1622
  if (f < e.length) t = true;
1393
1623
  } else if (e.length) {
1394
- for (let t = 0, l = e.length; t < l; t++) {
1395
- const l = getOverrideValue(o, s, u, t);
1396
- isWrappable(l)
1397
- ? applyState(e[t], wrap(l, r), n, i)
1624
+ for (let t = 0, c = e.length; t < c; t++) {
1625
+ const c = getOverrideValue(o, s, u, t);
1626
+ isWrappable(c)
1627
+ ? applyState(e[t], wrap(c, r), n, i)
1398
1628
  : r[STORE_NODE][t] && setSignal(r[STORE_NODE][t], e[t]);
1399
1629
  }
1400
1630
  }
1401
- if (l !== e.length) {
1631
+ if (c !== e.length) {
1402
1632
  t = true;
1403
1633
  r[STORE_NODE].length && setSignal(r[STORE_NODE].length, e.length);
1404
1634
  }
@@ -1407,9 +1637,9 @@ function applyState(e, t, n, i) {
1407
1637
  }
1408
1638
  if (u) {
1409
1639
  const t = u[$TRACK];
1410
- const l = t || i ? getAllKeys(o, s, e) : Object.keys(u);
1411
- for (let c = 0, a = l.length; c < a; c++) {
1412
- const a = l[c];
1640
+ const c = t || i ? getAllKeys(o, s, e) : Object.keys(u);
1641
+ for (let l = 0, a = c.length; l < a; l++) {
1642
+ const a = c[l];
1413
1643
  const f = u[a];
1414
1644
  const E = unwrap(getOverrideValue(o, s, u, a));
1415
1645
  let T = unwrap(e[a]);
@@ -1469,7 +1699,7 @@ function createProjectionInternal(e, t = {}, n) {
1469
1699
  r !== i && r !== undefined && reconcile(r, n?.key || "id", n?.all)(o);
1470
1700
  });
1471
1701
  });
1472
- i.Se = true;
1702
+ i.ve = true;
1473
1703
  return { store: o, node: i };
1474
1704
  }
1475
1705
  function createProjection(e, t = {}, n) {
@@ -1569,7 +1799,7 @@ function getNode(e, t, n, i, r = isEqual, o) {
1569
1799
  },
1570
1800
  i
1571
1801
  );
1572
- if (o) s.le = true;
1802
+ if (o) s.Y = true;
1573
1803
  return (e[t] = s);
1574
1804
  }
1575
1805
  function trackSelf(e, t = $TRACK) {
@@ -1612,39 +1842,39 @@ const storeTraps = {
1612
1842
  const o = e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE];
1613
1843
  const s = o || (e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]);
1614
1844
  const u = !!e[STORE_VALUE][$TARGET];
1615
- const l = o
1845
+ const c = o
1616
1846
  ? e[STORE_OPTIMISTIC_OVERRIDE]
1617
1847
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
1618
1848
  ? e[STORE_OVERRIDE]
1619
1849
  : e[STORE_VALUE];
1620
1850
  if (!r) {
1621
- const e = Object.getOwnPropertyDescriptor(l, t);
1851
+ const e = Object.getOwnPropertyDescriptor(c, t);
1622
1852
  if (e && e.get) return e.get.call(n);
1623
1853
  }
1624
1854
  if (writeOnly(n)) {
1625
- let n = r && (s || !u) ? (r.te !== NOT_PENDING ? (r.le ? r.ne : r.te) : r.ne) : l[t];
1855
+ let n = r && (s || !u) ? (r.B !== NOT_PENDING ? (r.Y ? r.Re : r.B) : r.Re) : c[t];
1626
1856
  n === $DELETED && (n = undefined);
1627
1857
  if (!isWrappable(n)) return n;
1628
1858
  const i = wrap(n, e);
1629
1859
  Writing?.add(i);
1630
1860
  return i;
1631
1861
  }
1632
- let c = r ? (s || !u ? read(i[t]) : (read(i[t]), l[t])) : l[t];
1633
- c === $DELETED && (c = undefined);
1862
+ let l = r ? (s || !u ? read(i[t]) : (read(i[t]), c[t])) : c[t];
1863
+ l === $DELETED && (l = undefined);
1634
1864
  if (!r) {
1635
- if (!s && typeof c === "function" && !l.hasOwnProperty(t)) {
1865
+ if (!s && typeof l === "function" && !c.hasOwnProperty(t)) {
1636
1866
  let t;
1637
1867
  return !Array.isArray(e[STORE_VALUE]) &&
1638
1868
  (t = Object.getPrototypeOf(e[STORE_VALUE])) &&
1639
1869
  t !== Object.prototype
1640
- ? c.bind(l)
1641
- : c;
1870
+ ? l.bind(c)
1871
+ : l;
1642
1872
  } else if (getObserver()) {
1643
1873
  return read(
1644
1874
  getNode(
1645
1875
  i,
1646
1876
  t,
1647
- isWrappable(c) ? wrap(c, e) : c,
1877
+ isWrappable(l) ? wrap(l, e) : l,
1648
1878
  e[STORE_FIREWALL],
1649
1879
  isEqual,
1650
1880
  e[STORE_OPTIMISTIC]
@@ -1652,7 +1882,7 @@ const storeTraps = {
1652
1882
  );
1653
1883
  }
1654
1884
  }
1655
- return isWrappable(c) ? wrap(c, e) : c;
1885
+ return isWrappable(l) ? wrap(l, e) : l;
1656
1886
  },
1657
1887
  has(e, t) {
1658
1888
  if (t === $PROXY || t === $TRACK || t === "__proto__") return true;
@@ -1671,8 +1901,8 @@ const storeTraps = {
1671
1901
  if (writeOnly(i)) {
1672
1902
  if (e[STORE_OPTIMISTIC]) {
1673
1903
  const t = e[STORE_FIREWALL];
1674
- if (t?.X) {
1675
- globalQueue.initTransition(t.X);
1904
+ if (t?.$) {
1905
+ globalQueue.initTransition(t.$);
1676
1906
  }
1677
1907
  }
1678
1908
  untrack(() => {
@@ -1681,29 +1911,29 @@ const storeTraps = {
1681
1911
  const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
1682
1912
  const u = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
1683
1913
  if (s) trackOptimisticStore(i);
1684
- const l =
1914
+ const c =
1685
1915
  e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
1686
1916
  ? e[STORE_OPTIMISTIC_OVERRIDE][t]
1687
1917
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
1688
1918
  ? e[STORE_OVERRIDE][t]
1689
1919
  : o;
1690
- const c = n?.[$TARGET]?.[STORE_VALUE] ?? n;
1691
- if (l === c) return true;
1920
+ const l = n?.[$TARGET]?.[STORE_VALUE] ?? n;
1921
+ if (c === l) return true;
1692
1922
  const a = e[STORE_OPTIMISTIC_OVERRIDE]?.length || e[STORE_OVERRIDE]?.length || r.length;
1693
- if (c !== undefined && c === o) delete e[u][t];
1694
- else (e[u] || (e[u] = Object.create(null)))[t] = c;
1695
- const f = isWrappable(c);
1696
- if (isWrappable(l)) {
1697
- const e = PARENTS.get(l);
1698
- e && (e instanceof Set ? e.delete(i) : PARENTS.delete(l));
1923
+ if (l !== undefined && l === o) delete e[u][t];
1924
+ else (e[u] || (e[u] = Object.create(null)))[t] = l;
1925
+ const f = isWrappable(l);
1926
+ if (isWrappable(c)) {
1927
+ const e = PARENTS.get(c);
1928
+ e && (e instanceof Set ? e.delete(i) : PARENTS.delete(c));
1699
1929
  }
1700
- if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(c, i);
1930
+ if (recursivelyNotify(i, storeLookup) && f) recursivelyAddParent(l, i);
1701
1931
  e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
1702
1932
  const E = getNodes(e, STORE_NODE);
1703
- E[t] && setSignal(E[t], () => (f ? wrap(c, e) : c));
1933
+ E[t] && setSignal(E[t], () => (f ? wrap(l, e) : l));
1704
1934
  if (Array.isArray(r)) {
1705
1935
  if (t === "length") {
1706
- E.length && setSignal(E.length, c);
1936
+ E.length && setSignal(E.length, l);
1707
1937
  } else {
1708
1938
  const e = parseInt(t) + 1;
1709
1939
  if (e > a) E.length && setSignal(E.length, e);
@@ -1861,7 +2091,7 @@ function deep(e) {
1861
2091
  return e[$DEEP];
1862
2092
  }
1863
2093
  function createOptimisticStore(e, t, n) {
1864
- GlobalQueue.Y ||= clearOptimisticStore;
2094
+ GlobalQueue.re ||= clearOptimisticStore;
1865
2095
  const i = typeof e === "function";
1866
2096
  const r = (i ? t : e) ?? {};
1867
2097
  const o = i ? e : undefined;
@@ -1873,16 +2103,25 @@ function clearOptimisticStore(e) {
1873
2103
  if (!t || !t[STORE_OPTIMISTIC_OVERRIDE]) return;
1874
2104
  const n = t[STORE_OPTIMISTIC_OVERRIDE];
1875
2105
  const i = t[STORE_NODE];
1876
- if (i) {
1877
- for (const e of Reflect.ownKeys(n)) {
1878
- if (i[e]) {
1879
- const n =
1880
- t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
1881
- const r = n === $DELETED ? undefined : n;
1882
- setSignal(i[e], isWrappable(r) ? wrap(r, t) : r);
2106
+ setProjectionWriteActive(true);
2107
+ try {
2108
+ if (i) {
2109
+ for (const e of Reflect.ownKeys(n)) {
2110
+ if (i[e]) {
2111
+ i[e].W = undefined;
2112
+ const n =
2113
+ t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
2114
+ const r = n === $DELETED ? undefined : n;
2115
+ setSignal(i[e], isWrappable(r) ? wrap(r, t) : r);
2116
+ }
2117
+ }
2118
+ if (i[$TRACK]) {
2119
+ i[$TRACK].W = undefined;
2120
+ setSignal(i[$TRACK], undefined);
1883
2121
  }
1884
2122
  }
1885
- i[$TRACK] && setSignal(i[$TRACK], undefined);
2123
+ } finally {
2124
+ setProjectionWriteActive(false);
1886
2125
  }
1887
2126
  delete t[STORE_OPTIMISTIC_OVERRIDE];
1888
2127
  }
@@ -1928,12 +2167,12 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
1928
2167
  setProjectionWriteActive(false);
1929
2168
  }
1930
2169
  });
1931
- i.Se = true;
2170
+ i.ve = true;
1932
2171
  }
1933
2172
  return { store: o, node: i };
1934
2173
  }
1935
2174
  function snapshot(e, t, n) {
1936
- let i, r, o, s, u, l;
2175
+ let i, r, o, s, u, c;
1937
2176
  if (!isWrappable(e)) return e;
1938
2177
  if (t && t.has(e)) return t.get(e);
1939
2178
  if (!t) t = new Map();
@@ -1953,26 +2192,26 @@ function snapshot(e, t, n) {
1953
2192
  if (r) {
1954
2193
  const i = o?.length || e.length;
1955
2194
  for (let r = 0; r < i; r++) {
1956
- l = o && r in o ? o[r] : e[r];
1957
- if (l === $DELETED) continue;
1958
- if ((u = snapshot(l, t, n)) !== l || s) {
2195
+ c = o && r in o ? o[r] : e[r];
2196
+ if (c === $DELETED) continue;
2197
+ if ((u = snapshot(c, t, n)) !== c || s) {
1959
2198
  if (!s) t.set(e, (s = [...e]));
1960
2199
  s[r] = u;
1961
2200
  }
1962
2201
  }
1963
2202
  } else {
1964
2203
  const i = getKeys(e, o);
1965
- for (let r = 0, c = i.length; r < c; r++) {
1966
- let c = i[r];
1967
- const a = getPropertyDescriptor(e, o, c);
2204
+ for (let r = 0, l = i.length; r < l; r++) {
2205
+ let l = i[r];
2206
+ const a = getPropertyDescriptor(e, o, l);
1968
2207
  if (a.get) continue;
1969
- l = o && c in o ? o[c] : e[c];
1970
- if ((u = snapshot(l, t, n)) !== e[c] || s) {
2208
+ c = o && l in o ? o[l] : e[l];
2209
+ if ((u = snapshot(c, t, n)) !== e[l] || s) {
1971
2210
  if (!s) {
1972
2211
  s = Object.create(Object.getPrototypeOf(e));
1973
2212
  Object.assign(s, e);
1974
2213
  }
1975
- s[c] = u;
2214
+ s[l] = u;
1976
2215
  }
1977
2216
  }
1978
2217
  }
@@ -2112,281 +2351,289 @@ function mapArray(e, t, n) {
2112
2351
  const i = typeof n?.keyed === "function" ? n.keyed : undefined;
2113
2352
  return createMemo(
2114
2353
  updateKeyedMap.bind({
2115
- De: createOwner(),
2116
- we: 0,
2117
- be: e,
2118
- ve: [],
2119
- Ve: t,
2120
- me: [],
2121
- Ue: [],
2122
- ke: i,
2123
- We: i || n?.keyed === false ? [] : undefined,
2124
- Qe: t.length > 1 ? [] : undefined,
2125
- xe: n?.fallback
2354
+ xe: createOwner(),
2355
+ Ge: 0,
2356
+ Me: e,
2357
+ Fe: [],
2358
+ $e: t,
2359
+ He: [],
2360
+ je: [],
2361
+ Ke: i,
2362
+ Ye: i || n?.keyed === false ? [] : undefined,
2363
+ Be: t.length > 1 ? [] : undefined,
2364
+ Xe: n?.fallback
2126
2365
  })
2127
2366
  );
2128
2367
  }
2129
2368
  const pureOptions = { pureWrite: true };
2130
2369
  function updateKeyedMap() {
2131
- const e = this.be() || [],
2370
+ const e = this.Me() || [],
2132
2371
  t = e.length;
2133
2372
  e[$TRACK];
2134
- runWithOwner(this.De, () => {
2373
+ runWithOwner(this.xe, () => {
2135
2374
  let n,
2136
2375
  i,
2137
- r = this.We
2376
+ r = this.Ye
2138
2377
  ? () => {
2139
- this.We[i] = signal(e[i], pureOptions);
2140
- this.Qe && (this.Qe[i] = signal(i, pureOptions));
2141
- return this.Ve(
2142
- read.bind(null, this.We[i]),
2143
- this.Qe ? read.bind(null, this.Qe[i]) : undefined
2378
+ this.Ye[i] = signal(e[i], pureOptions);
2379
+ this.Be && (this.Be[i] = signal(i, pureOptions));
2380
+ return this.$e(
2381
+ read.bind(null, this.Ye[i]),
2382
+ this.Be ? read.bind(null, this.Be[i]) : undefined
2144
2383
  );
2145
2384
  }
2146
- : this.Qe
2385
+ : this.Be
2147
2386
  ? () => {
2148
2387
  const t = e[i];
2149
- this.Qe[i] = signal(i, pureOptions);
2150
- return this.Ve(() => t, read.bind(null, this.Qe[i]));
2388
+ this.Be[i] = signal(i, pureOptions);
2389
+ return this.$e(() => t, read.bind(null, this.Be[i]));
2151
2390
  }
2152
2391
  : () => {
2153
2392
  const t = e[i];
2154
- return this.Ve(() => t);
2393
+ return this.$e(() => t);
2155
2394
  };
2156
2395
  if (t === 0) {
2157
- if (this.we !== 0) {
2158
- this.De.dispose(false);
2159
- this.Ue = [];
2160
- this.ve = [];
2161
- this.me = [];
2162
- this.we = 0;
2163
- this.We && (this.We = []);
2164
- this.Qe && (this.Qe = []);
2165
- }
2166
- if (this.xe && !this.me[0]) {
2167
- this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.xe);
2168
- }
2169
- } else if (this.we === 0) {
2170
- if (this.Ue[0]) this.Ue[0].dispose();
2171
- this.me = new Array(t);
2396
+ if (this.Ge !== 0) {
2397
+ this.xe.dispose(false);
2398
+ this.je = [];
2399
+ this.Fe = [];
2400
+ this.He = [];
2401
+ this.Ge = 0;
2402
+ this.Ye && (this.Ye = []);
2403
+ this.Be && (this.Be = []);
2404
+ }
2405
+ if (this.Xe && !this.He[0]) {
2406
+ this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
2407
+ }
2408
+ } else if (this.Ge === 0) {
2409
+ if (this.je[0]) this.je[0].dispose();
2410
+ this.He = new Array(t);
2172
2411
  for (i = 0; i < t; i++) {
2173
- this.ve[i] = e[i];
2174
- this.me[i] = runWithOwner((this.Ue[i] = createOwner()), r);
2412
+ this.Fe[i] = e[i];
2413
+ this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
2175
2414
  }
2176
- this.we = t;
2415
+ this.Ge = t;
2177
2416
  } else {
2178
2417
  let o,
2179
2418
  s,
2180
2419
  u,
2181
- l,
2182
2420
  c,
2421
+ l,
2183
2422
  a,
2184
2423
  f,
2185
2424
  E = new Array(t),
2186
2425
  T = new Array(t),
2187
- R = this.We ? new Array(t) : undefined,
2188
- d = this.Qe ? new Array(t) : undefined;
2426
+ d = this.Ye ? new Array(t) : undefined,
2427
+ R = this.Be ? new Array(t) : undefined;
2189
2428
  for (
2190
- o = 0, s = Math.min(this.we, t);
2191
- o < s && (this.ve[o] === e[o] || (this.We && compare(this.ke, this.ve[o], e[o])));
2429
+ o = 0, s = Math.min(this.Ge, t);
2430
+ o < s && (this.Fe[o] === e[o] || (this.Ye && compare(this.Ke, this.Fe[o], e[o])));
2192
2431
  o++
2193
2432
  ) {
2194
- if (this.We) setSignal(this.We[o], e[o]);
2433
+ if (this.Ye) setSignal(this.Ye[o], e[o]);
2195
2434
  }
2196
2435
  for (
2197
- s = this.we - 1, u = t - 1;
2436
+ s = this.Ge - 1, u = t - 1;
2198
2437
  s >= o &&
2199
2438
  u >= o &&
2200
- (this.ve[s] === e[u] || (this.We && compare(this.ke, this.ve[s], e[u])));
2439
+ (this.Fe[s] === e[u] || (this.Ye && compare(this.Ke, this.Fe[s], e[u])));
2201
2440
  s--, u--
2202
2441
  ) {
2203
- E[u] = this.me[s];
2204
- T[u] = this.Ue[s];
2205
- R && (R[u] = this.We[s]);
2206
- d && (d[u] = this.Qe[s]);
2442
+ E[u] = this.He[s];
2443
+ T[u] = this.je[s];
2444
+ d && (d[u] = this.Ye[s]);
2445
+ R && (R[u] = this.Be[s]);
2207
2446
  }
2208
2447
  a = new Map();
2209
2448
  f = new Array(u + 1);
2210
2449
  for (i = u; i >= o; i--) {
2211
- l = e[i];
2212
- c = this.ke ? this.ke(l) : l;
2213
- n = a.get(c);
2450
+ c = e[i];
2451
+ l = this.Ke ? this.Ke(c) : c;
2452
+ n = a.get(l);
2214
2453
  f[i] = n === undefined ? -1 : n;
2215
- a.set(c, i);
2454
+ a.set(l, i);
2216
2455
  }
2217
2456
  for (n = o; n <= s; n++) {
2218
- l = this.ve[n];
2219
- c = this.ke ? this.ke(l) : l;
2220
- i = a.get(c);
2457
+ c = this.Fe[n];
2458
+ l = this.Ke ? this.Ke(c) : c;
2459
+ i = a.get(l);
2221
2460
  if (i !== undefined && i !== -1) {
2222
- E[i] = this.me[n];
2223
- T[i] = this.Ue[n];
2224
- R && (R[i] = this.We[n]);
2225
- d && (d[i] = this.Qe[n]);
2461
+ E[i] = this.He[n];
2462
+ T[i] = this.je[n];
2463
+ d && (d[i] = this.Ye[n]);
2464
+ R && (R[i] = this.Be[n]);
2226
2465
  i = f[i];
2227
- a.set(c, i);
2228
- } else this.Ue[n].dispose();
2466
+ a.set(l, i);
2467
+ } else this.je[n].dispose();
2229
2468
  }
2230
2469
  for (i = o; i < t; i++) {
2231
2470
  if (i in E) {
2232
- this.me[i] = E[i];
2233
- this.Ue[i] = T[i];
2234
- if (R) {
2235
- this.We[i] = R[i];
2236
- setSignal(this.We[i], e[i]);
2237
- }
2471
+ this.He[i] = E[i];
2472
+ this.je[i] = T[i];
2238
2473
  if (d) {
2239
- this.Qe[i] = d[i];
2240
- setSignal(this.Qe[i], i);
2474
+ this.Ye[i] = d[i];
2475
+ setSignal(this.Ye[i], e[i]);
2476
+ }
2477
+ if (R) {
2478
+ this.Be[i] = R[i];
2479
+ setSignal(this.Be[i], i);
2241
2480
  }
2242
2481
  } else {
2243
- this.me[i] = runWithOwner((this.Ue[i] = createOwner()), r);
2482
+ this.He[i] = runWithOwner((this.je[i] = createOwner()), r);
2244
2483
  }
2245
2484
  }
2246
- this.me = this.me.slice(0, (this.we = t));
2247
- this.ve = e.slice(0);
2485
+ this.He = this.He.slice(0, (this.Ge = t));
2486
+ this.Fe = e.slice(0);
2248
2487
  }
2249
2488
  });
2250
- return this.me;
2489
+ return this.He;
2251
2490
  }
2252
2491
  function repeat(e, t, n) {
2253
2492
  return updateRepeat.bind({
2254
- De: createOwner(),
2255
- we: 0,
2493
+ xe: createOwner(),
2256
2494
  Ge: 0,
2257
- Me: e,
2258
- Ve: t,
2259
- Ue: [],
2260
- me: [],
2261
- $e: n?.from,
2262
- xe: n?.fallback
2495
+ qe: 0,
2496
+ ze: e,
2497
+ $e: t,
2498
+ je: [],
2499
+ He: [],
2500
+ Ze: n?.from,
2501
+ Xe: n?.fallback
2263
2502
  });
2264
2503
  }
2265
2504
  function updateRepeat() {
2266
- const e = this.Me();
2267
- const t = this.$e?.() || 0;
2268
- runWithOwner(this.De, () => {
2505
+ const e = this.ze();
2506
+ const t = this.Ze?.() || 0;
2507
+ runWithOwner(this.xe, () => {
2269
2508
  if (e === 0) {
2270
- if (this.we !== 0) {
2271
- this.De.dispose(false);
2272
- this.Ue = [];
2273
- this.me = [];
2274
- this.we = 0;
2509
+ if (this.Ge !== 0) {
2510
+ this.xe.dispose(false);
2511
+ this.je = [];
2512
+ this.He = [];
2513
+ this.Ge = 0;
2275
2514
  }
2276
- if (this.xe && !this.me[0]) {
2277
- this.me[0] = runWithOwner((this.Ue[0] = createOwner()), this.xe);
2515
+ if (this.Xe && !this.He[0]) {
2516
+ this.He[0] = runWithOwner((this.je[0] = createOwner()), this.Xe);
2278
2517
  }
2279
2518
  return;
2280
2519
  }
2281
2520
  const n = t + e;
2282
- const i = this.Ge + this.we;
2283
- if (this.we === 0 && this.Ue[0]) this.Ue[0].dispose();
2284
- for (let e = n; e < i; e++) this.Ue[e - this.Ge].dispose();
2285
- if (this.Ge < t) {
2286
- let e = this.Ge;
2287
- while (e < t && e < this.we) this.Ue[e++].dispose();
2288
- this.Ue.splice(0, t - this.Ge);
2289
- this.me.splice(0, t - this.Ge);
2290
- } else if (this.Ge > t) {
2291
- let n = i - this.Ge - 1;
2292
- let r = this.Ge - t;
2293
- this.Ue.length = this.me.length = e;
2521
+ const i = this.qe + this.Ge;
2522
+ if (this.Ge === 0 && this.je[0]) this.je[0].dispose();
2523
+ for (let e = n; e < i; e++) this.je[e - this.qe].dispose();
2524
+ if (this.qe < t) {
2525
+ let e = this.qe;
2526
+ while (e < t && e < this.Ge) this.je[e++].dispose();
2527
+ this.je.splice(0, t - this.qe);
2528
+ this.He.splice(0, t - this.qe);
2529
+ } else if (this.qe > t) {
2530
+ let n = i - this.qe - 1;
2531
+ let r = this.qe - t;
2532
+ this.je.length = this.He.length = e;
2294
2533
  while (n >= r) {
2295
- this.Ue[n] = this.Ue[n - r];
2296
- this.me[n] = this.me[n - r];
2534
+ this.je[n] = this.je[n - r];
2535
+ this.He[n] = this.He[n - r];
2297
2536
  n--;
2298
2537
  }
2299
2538
  for (let e = 0; e < r; e++) {
2300
- this.me[e] = runWithOwner((this.Ue[e] = createOwner()), () => this.Ve(e + t));
2539
+ this.He[e] = runWithOwner((this.je[e] = createOwner()), () => this.$e(e + t));
2301
2540
  }
2302
2541
  }
2303
2542
  for (let e = i; e < n; e++) {
2304
- this.me[e - t] = runWithOwner((this.Ue[e - t] = createOwner()), () => this.Ve(e));
2543
+ this.He[e - t] = runWithOwner((this.je[e - t] = createOwner()), () => this.$e(e));
2305
2544
  }
2306
- this.me = this.me.slice(0, e);
2307
- this.Ge = t;
2308
- this.we = e;
2545
+ this.He = this.He.slice(0, e);
2546
+ this.qe = t;
2547
+ this.Ge = e;
2309
2548
  });
2310
- return this.me;
2549
+ return this.He;
2311
2550
  }
2312
2551
  function compare(e, t, n) {
2313
2552
  return e ? e(t) === e(n) : true;
2314
2553
  }
2315
2554
  function boundaryComputed(e, t) {
2316
2555
  const n = computed(e, undefined, { lazy: true });
2317
- n.Te = () => {
2318
- const e = n.ie;
2319
- n.ie &= ~n.Le;
2320
- n.J.notify(n, n.Le, e);
2556
+ n.Pe = (e, t) => {
2557
+ const i = e !== undefined ? e : n.Oe;
2558
+ const r = t !== undefined ? t : n.se;
2559
+ n.Oe &= ~n.Je;
2560
+ n.Te.notify(n, n.Je, i, r);
2321
2561
  };
2322
- n.Le = t;
2323
- n.Se = true;
2562
+ n.Je = t;
2563
+ n.ve = true;
2324
2564
  recompute(n, true);
2325
2565
  return n;
2326
2566
  }
2327
2567
  function createBoundChildren(e, t, n, i) {
2328
- const r = e.J;
2329
- r.addChild((e.J = n));
2330
- onCleanup(() => r.removeChild(e.J));
2568
+ const r = e.Te;
2569
+ r.addChild((e.Te = n));
2570
+ onCleanup(() => r.removeChild(e.Te));
2331
2571
  return runWithOwner(e, () => {
2332
2572
  const e = computed(t);
2333
2573
  return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
2334
2574
  });
2335
2575
  }
2336
2576
  class ConditionalQueue extends Queue {
2337
- He;
2338
- Fe = new Set();
2339
- L = new Set();
2577
+ et;
2578
+ tt = new Set();
2579
+ J = new Set();
2340
2580
  constructor(e) {
2341
2581
  super();
2342
- this.He = e;
2582
+ this.et = e;
2343
2583
  }
2344
2584
  run(e) {
2345
- if (!e || read(this.He)) return;
2585
+ if (!e || read(this.et)) return;
2346
2586
  return super.run(e);
2347
2587
  }
2348
- notify(e, t, n) {
2349
- if (read(this.He)) {
2588
+ notify(e, t, n, i) {
2589
+ if (read(this.et)) {
2350
2590
  if (t & STATUS_PENDING) {
2351
2591
  if (n & STATUS_PENDING) {
2352
- this.L.add(e);
2592
+ this.J.add(e);
2353
2593
  t &= ~STATUS_PENDING;
2354
- } else if (this.L.delete(e)) t &= ~STATUS_PENDING;
2594
+ } else if (this.J.delete(e)) t &= ~STATUS_PENDING;
2355
2595
  }
2356
2596
  if (t & STATUS_ERROR) {
2357
2597
  if (n & STATUS_ERROR) {
2358
- this.Fe.add(e);
2598
+ this.tt.add(e);
2359
2599
  t &= ~STATUS_ERROR;
2360
- } else if (this.Fe.delete(e)) t &= ~STATUS_ERROR;
2600
+ } else if (this.tt.delete(e)) t &= ~STATUS_ERROR;
2361
2601
  }
2362
2602
  }
2363
- return t ? super.notify(e, t, n) : true;
2603
+ return t ? super.notify(e, t, n, i ?? e.se) : true;
2364
2604
  }
2365
2605
  }
2366
2606
  class CollectionQueue extends Queue {
2367
- je;
2368
- Ue = new Set();
2369
- He = signal(false, { pureWrite: true });
2370
- Ke = false;
2607
+ nt;
2608
+ it = new Set();
2609
+ et = signal(false, { pureWrite: true });
2610
+ rt = false;
2371
2611
  constructor(e) {
2372
2612
  super();
2373
- this.je = e;
2613
+ this.nt = e;
2374
2614
  }
2375
2615
  run(e) {
2376
- if (!e || read(this.He)) return;
2616
+ if (!e || read(this.et)) return;
2377
2617
  return super.run(e);
2378
2618
  }
2379
- notify(e, t, n) {
2380
- if (!(t & this.je) || (this.je & STATUS_PENDING && this.Ke)) return super.notify(e, t, n);
2381
- if (n & this.je) {
2382
- this.Ue.add(e);
2383
- if (this.Ue.size === 1) setSignal(this.He, true);
2384
- } else if (this.Ue.size > 0) {
2385
- this.Ue.delete(e);
2386
- if (this.Ue.size === 0) setSignal(this.He, false);
2619
+ notify(e, t, n, i) {
2620
+ if (!(t & this.nt) || (this.nt & STATUS_PENDING && this.rt)) return super.notify(e, t, n, i);
2621
+ if (n & this.nt) {
2622
+ const t = i?.t || e.se?.t;
2623
+ if (t) {
2624
+ const e = this.it.size === 0;
2625
+ this.it.add(t);
2626
+ if (e) setSignal(this.et, true);
2627
+ }
2628
+ }
2629
+ t &= ~this.nt;
2630
+ return t ? super.notify(e, t, n, i) : true;
2631
+ }
2632
+ checkSources() {
2633
+ for (const e of this.it) {
2634
+ if (!(e.Oe & this.nt)) this.it.delete(e);
2387
2635
  }
2388
- t &= ~this.je;
2389
- return t ? super.notify(e, t, n) : true;
2636
+ if (!this.it.size) setSignal(this.et, false);
2390
2637
  }
2391
2638
  }
2392
2639
  var BoundaryMode;
@@ -2399,26 +2646,26 @@ function createBoundary(e, t) {
2399
2646
  const i = new ConditionalQueue(computed(() => t() === BoundaryMode.HIDDEN));
2400
2647
  const r = createBoundChildren(n, e, i, 0);
2401
2648
  computed(() => {
2402
- const e = read(i.He);
2403
- r.Le = e ? STATUS_ERROR | STATUS_PENDING : 0;
2649
+ const e = read(i.et);
2650
+ r.Je = e ? STATUS_ERROR | STATUS_PENDING : 0;
2404
2651
  if (!e) {
2405
- i.L.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING));
2406
- i.Fe.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR));
2407
- i.L.clear();
2408
- i.Fe.clear();
2652
+ i.J.forEach(e => i.notify(e, STATUS_PENDING, STATUS_PENDING, e.se));
2653
+ i.tt.forEach(e => i.notify(e, STATUS_ERROR, STATUS_ERROR, e.se));
2654
+ i.J.clear();
2655
+ i.tt.clear();
2409
2656
  }
2410
2657
  });
2411
- return () => (read(i.He) ? undefined : read(r));
2658
+ return () => (read(i.et) ? undefined : read(r));
2412
2659
  }
2413
2660
  function createCollectionBoundary(e, t, n) {
2414
2661
  const i = createOwner();
2415
2662
  const r = new CollectionQueue(e);
2416
2663
  const o = createBoundChildren(i, t, r, e);
2417
2664
  const s = computed(() => {
2418
- if (!read(r.He)) {
2665
+ if (!read(r.et)) {
2419
2666
  const e = read(o);
2420
- if (!untrack(() => read(r.He))) {
2421
- r.Ke = true;
2667
+ if (!untrack(() => read(r.et))) {
2668
+ r.rt = true;
2422
2669
  return e;
2423
2670
  }
2424
2671
  }
@@ -2429,26 +2676,12 @@ function createCollectionBoundary(e, t, n) {
2429
2676
  function createLoadBoundary(e, t) {
2430
2677
  return createCollectionBoundary(STATUS_PENDING, e, () => t());
2431
2678
  }
2432
- function collectErrorSources(e, t) {
2433
- let n = true;
2434
- let i = e.C;
2435
- while (i !== null) {
2436
- const e = i.V;
2437
- if (e.C && e.ie & STATUS_ERROR) {
2438
- n = false;
2439
- collectErrorSources(e, t);
2440
- }
2441
- i = i.D;
2442
- }
2443
- n && t.push(e);
2444
- }
2445
2679
  function createErrorBoundary(e, t) {
2446
2680
  return createCollectionBoundary(STATUS_ERROR, e, e => {
2447
- let n = e.Ue.values().next().value;
2448
- return t(n.B, () => {
2449
- const t = [];
2450
- for (const n of e.Ue) collectErrorSources(n, t);
2451
- for (const e of t) recompute(e);
2681
+ let n = e.it.values().next().value;
2682
+ const i = n.se?.cause ?? n.se;
2683
+ return t(i, () => {
2684
+ for (const t of e.it) recompute(t);
2452
2685
  schedule();
2453
2686
  });
2454
2687
  });