@solidjs/signals 0.9.7 → 0.9.9

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