@solidjs/universal 2.0.0-beta.3 → 2.0.0-beta.4

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/dev.js CHANGED
@@ -70,9 +70,9 @@ function deleteFromHeap(e, t) {
70
70
  if (e.T === e) t.l[i] = undefined;else {
71
71
  const n = e.S;
72
72
  const r = t.l[i];
73
- const o = n ?? r;
73
+ const s = n ?? r;
74
74
  if (e === r) t.l[i] = n;else e.T.S = n;
75
- o.T = e.T;
75
+ s.T = e.T;
76
76
  }
77
77
  e.T = e;
78
78
  e.S = undefined;
@@ -143,34 +143,94 @@ const zombieQueue = {
143
143
  let clock = 0;
144
144
  let activeTransition = null;
145
145
  let scheduled = false;
146
+ let stashedOptimisticReads = null;
146
147
  function runLaneEffects(e) {
147
148
  for (const t of activeLanes) {
148
- if (t.k || t.U.size > 0) continue;
149
- const n = t.W[e - 1];
149
+ if (t.U || t.k.size > 0) continue;
150
+ const n = t.G[e - 1];
150
151
  if (n.length) {
151
- t.W[e - 1] = [];
152
+ t.G[e - 1] = [];
152
153
  runQueue(n, e);
153
154
  }
154
155
  }
155
156
  }
157
+ function queueStashedOptimisticEffects(e) {
158
+ for (let t = e.I; t !== null; t = t.p) {
159
+ const e = t.h;
160
+ if (!e.W) continue;
161
+ if (e.W === EFFECT_TRACKED) {
162
+ if (!e.H) {
163
+ e.H = true;
164
+ e.F.enqueue(EFFECT_USER, e.M);
165
+ }
166
+ continue;
167
+ }
168
+ const n = e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
169
+ if (n.P > e.o) n.P = e.o;
170
+ insertIntoHeap(e, n);
171
+ }
172
+ }
173
+ function mergeTransitionState(e, t) {
174
+ t.$ = e;
175
+ e.j.push(...t.j);
176
+ for (const n of activeLanes) {
177
+ if (n.K === t) n.K = e;
178
+ }
179
+ e.Y.push(...t.Y);
180
+ for (const n of t.Z) e.Z.add(n);
181
+ for (const n of t.B) {
182
+ if (!e.B.includes(n)) e.B.push(n);
183
+ }
184
+ }
185
+ function resolveOptimisticNodes(e) {
186
+ for (let t = 0; t < e.length; t++) {
187
+ const n = e[t];
188
+ n.q = undefined;
189
+ if (n.X !== NOT_PENDING) {
190
+ n.J = n.X;
191
+ n.X = NOT_PENDING;
192
+ }
193
+ const i = n.ee;
194
+ n.ee = NOT_PENDING;
195
+ if (i !== NOT_PENDING && n.J !== i) insertSubs(n, true);
196
+ n.K = null;
197
+ }
198
+ e.length = 0;
199
+ }
200
+ function cleanupCompletedLanes(e) {
201
+ for (const t of activeLanes) {
202
+ const n = e ? t.K === e : !t.K;
203
+ if (!n) continue;
204
+ if (!t.U) {
205
+ if (t.G[0].length) runQueue(t.G[0], EFFECT_RENDER);
206
+ if (t.G[1].length) runQueue(t.G[1], EFFECT_USER);
207
+ }
208
+ if (t.te.q === t) t.te.q = undefined;
209
+ t.k.clear();
210
+ t.G[0].length = 0;
211
+ t.G[1].length = 0;
212
+ activeLanes.delete(t);
213
+ signalLanes.delete(t.te);
214
+ }
215
+ }
156
216
  function schedule() {
157
217
  if (scheduled) return;
158
218
  scheduled = true;
159
- if (!globalQueue.H && true) queueMicrotask(flush);
219
+ if (!globalQueue.ne && true) queueMicrotask(flush);
160
220
  }
161
221
  class Queue {
162
222
  i = null;
163
- G = [[], []];
164
- F = [];
223
+ ie = [[], []];
224
+ re = [];
165
225
  created = clock;
166
226
  addChild(e) {
167
- this.F.push(e);
227
+ this.re.push(e);
168
228
  e.i = this;
169
229
  }
170
230
  removeChild(e) {
171
- const t = this.F.indexOf(e);
231
+ const t = this.re.indexOf(e);
172
232
  if (t >= 0) {
173
- this.F.splice(t, 1);
233
+ this.re.splice(t, 1);
174
234
  e.i = null;
175
235
  }
176
236
  }
@@ -179,91 +239,104 @@ class Queue {
179
239
  return false;
180
240
  }
181
241
  run(e) {
182
- if (this.G[e - 1].length) {
183
- const t = this.G[e - 1];
184
- this.G[e - 1] = [];
242
+ if (this.ie[e - 1].length) {
243
+ const t = this.ie[e - 1];
244
+ this.ie[e - 1] = [];
185
245
  runQueue(t, e);
186
246
  }
187
- for (let t = 0; t < this.F.length; t++) this.F[t].run?.(e);
247
+ for (let t = 0; t < this.re.length; t++) this.re[t].run?.(e);
188
248
  }
189
249
  enqueue(e, t) {
190
250
  if (e) {
191
251
  if (currentOptimisticLane) {
192
252
  const n = findLane(currentOptimisticLane);
193
- n.W[e - 1].push(t);
253
+ n.G[e - 1].push(t);
194
254
  } else {
195
- this.G[e - 1].push(t);
255
+ this.ie[e - 1].push(t);
196
256
  }
197
257
  }
198
258
  schedule();
199
259
  }
200
260
  stashQueues(e) {
201
- e.G[0].push(...this.G[0]);
202
- e.G[1].push(...this.G[1]);
203
- this.G = [[], []];
204
- for (let t = 0; t < this.F.length; t++) {
205
- let n = this.F[t];
206
- let i = e.F[t];
261
+ e.ie[0].push(...this.ie[0]);
262
+ e.ie[1].push(...this.ie[1]);
263
+ this.ie = [[], []];
264
+ for (let t = 0; t < this.re.length; t++) {
265
+ let n = this.re[t];
266
+ let i = e.re[t];
207
267
  if (!i) {
208
268
  i = {
209
- G: [[], []],
210
- F: []
269
+ ie: [[], []],
270
+ re: []
211
271
  };
212
- e.F[t] = i;
272
+ e.re[t] = i;
213
273
  }
214
274
  n.stashQueues(i);
215
275
  }
216
276
  }
217
277
  restoreQueues(e) {
218
- this.G[0].push(...e.G[0]);
219
- this.G[1].push(...e.G[1]);
220
- for (let t = 0; t < e.F.length; t++) {
221
- const n = e.F[t];
222
- let i = this.F[t];
278
+ this.ie[0].push(...e.ie[0]);
279
+ this.ie[1].push(...e.ie[1]);
280
+ for (let t = 0; t < e.re.length; t++) {
281
+ const n = e.re[t];
282
+ let i = this.re[t];
223
283
  if (i) i.restoreQueues(n);
224
284
  }
225
285
  }
226
286
  }
227
287
  class GlobalQueue extends Queue {
228
- H = false;
229
- M = [];
230
- $ = [];
231
- j = new Set();
232
- static K;
233
- static Y;
234
- static B = null;
288
+ ne = false;
289
+ se = [];
290
+ Y = [];
291
+ Z = new Set();
292
+ static oe;
293
+ static ue;
294
+ static ce = null;
235
295
  flush() {
236
- if (this.H) return;
237
- this.H = true;
296
+ if (this.ne) return;
297
+ this.ne = true;
238
298
  try {
239
- runHeap(dirtyQueue, GlobalQueue.K);
299
+ runHeap(dirtyQueue, GlobalQueue.oe);
240
300
  if (activeTransition) {
241
301
  const e = transitionComplete(activeTransition);
242
302
  if (!e) {
243
- let e = activeTransition;
244
- runHeap(zombieQueue, GlobalQueue.K);
245
- this.M = [];
246
- this.$ = [];
247
- this.j = new Set();
303
+ const e = activeTransition;
304
+ runHeap(zombieQueue, GlobalQueue.oe);
305
+ this.se = [];
306
+ this.Y = [];
307
+ this.Z = new Set();
248
308
  runLaneEffects(EFFECT_RENDER);
249
309
  runLaneEffects(EFFECT_USER);
250
- this.stashQueues(activeTransition.Z);
310
+ this.stashQueues(e.ae);
251
311
  clock++;
252
312
  scheduled = dirtyQueue.R >= dirtyQueue.P;
253
- reassignPendingTransition(activeTransition.M);
313
+ reassignPendingTransition(e.se);
254
314
  activeTransition = null;
255
- finalizePureQueue(null, true);
315
+ if (!e.j.length && e.Y.length) {
316
+ stashedOptimisticReads = new Set();
317
+ for (let t = 0; t < e.Y.length; t++) {
318
+ const n = e.Y[t];
319
+ if (n.L || n.fe) continue;
320
+ stashedOptimisticReads.add(n);
321
+ queueStashedOptimisticEffects(n);
322
+ }
323
+ }
324
+ try {
325
+ finalizePureQueue(null, true);
326
+ } finally {
327
+ stashedOptimisticReads = null;
328
+ }
256
329
  return;
257
330
  }
258
- this.M !== activeTransition.M && this.M.push(...activeTransition.M);
259
- this.restoreQueues(activeTransition.Z);
331
+ this.se !== activeTransition.se && this.se.push(...activeTransition.se);
332
+ this.restoreQueues(activeTransition.ae);
260
333
  transitions.delete(activeTransition);
261
334
  const t = activeTransition;
262
335
  activeTransition = null;
263
- reassignPendingTransition(this.M);
336
+ reassignPendingTransition(this.se);
264
337
  finalizePureQueue(t);
265
338
  } else {
266
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.K);
339
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.oe);
267
340
  finalizePureQueue();
268
341
  }
269
342
  clock++;
@@ -273,16 +346,19 @@ class GlobalQueue extends Queue {
273
346
  runLaneEffects(EFFECT_USER);
274
347
  this.run(EFFECT_USER);
275
348
  } finally {
276
- this.H = false;
349
+ this.ne = false;
277
350
  }
278
351
  }
279
352
  notify(e, t, n, i) {
280
353
  if (t & STATUS_PENDING) {
281
354
  if (n & STATUS_PENDING) {
282
- const t = i !== undefined ? i : e.q;
283
- if (activeTransition && t && !activeTransition.X.includes(t.source)) {
284
- activeTransition.X.push(t.source);
285
- schedule();
355
+ const t = i !== undefined ? i : e.le;
356
+ if (activeTransition && t) {
357
+ const e = t.source;
358
+ if (!activeTransition.B.includes(e)) {
359
+ activeTransition.B.push(e);
360
+ schedule();
361
+ }
286
362
  }
287
363
  }
288
364
  return true;
@@ -292,61 +368,59 @@ class GlobalQueue extends Queue {
292
368
  initTransition(e) {
293
369
  if (e) e = currentTransition(e);
294
370
  if (e && e === activeTransition) return;
295
- if (!e && activeTransition && activeTransition.J === clock) return;
371
+ if (!e && activeTransition && activeTransition.Ee === clock) return;
296
372
  if (!activeTransition) {
297
373
  activeTransition = e ?? {
298
- J: clock,
299
- M: [],
300
- X: [],
301
- $: [],
302
- j: new Set(),
303
- ee: [],
304
- Z: {
305
- G: [[], []],
306
- F: []
374
+ Ee: clock,
375
+ se: [],
376
+ B: [],
377
+ Y: [],
378
+ Z: new Set(),
379
+ j: [],
380
+ ae: {
381
+ ie: [[], []],
382
+ re: []
307
383
  },
308
- te: false
384
+ $: false
309
385
  };
310
386
  } else if (e) {
311
387
  const t = activeTransition;
312
- t.te = e;
313
- e.ee.push(...t.ee);
314
- for (const n of activeLanes) {
315
- if (n.ne === t) n.ne = e;
316
- }
317
- e.$.push(...t.$);
318
- for (const n of t.j) {
319
- e.j.add(n);
320
- }
388
+ mergeTransitionState(e, t);
321
389
  transitions.delete(t);
322
390
  activeTransition = e;
323
391
  }
324
392
  transitions.add(activeTransition);
325
- activeTransition.J = clock;
326
- for (let e = 0; e < this.M.length; e++) {
327
- const t = this.M[e];
328
- t.ne = activeTransition;
329
- activeTransition.M.push(t);
393
+ activeTransition.Ee = clock;
394
+ if (this.se !== activeTransition.se) {
395
+ for (let e = 0; e < this.se.length; e++) {
396
+ const t = this.se[e];
397
+ t.K = activeTransition;
398
+ activeTransition.se.push(t);
399
+ }
400
+ this.se = activeTransition.se;
330
401
  }
331
- this.M = activeTransition.M;
332
- for (let e = 0; e < this.$.length; e++) {
333
- const t = this.$[e];
334
- t.ne = activeTransition;
335
- activeTransition.$.push(t);
402
+ if (this.Y !== activeTransition.Y) {
403
+ for (let e = 0; e < this.Y.length; e++) {
404
+ const t = this.Y[e];
405
+ t.K = activeTransition;
406
+ activeTransition.Y.push(t);
407
+ }
408
+ this.Y = activeTransition.Y;
336
409
  }
337
- this.$ = activeTransition.$;
338
410
  for (const e of activeLanes) {
339
- if (!e.ne) e.ne = activeTransition;
411
+ if (!e.K) e.K = activeTransition;
412
+ }
413
+ if (this.Z !== activeTransition.Z) {
414
+ for (const e of this.Z) activeTransition.Z.add(e);
415
+ this.Z = activeTransition.Z;
340
416
  }
341
- for (const e of this.j) activeTransition.j.add(e);
342
- this.j = activeTransition.j;
343
417
  }
344
418
  }
345
419
  function insertSubs(e, t = false) {
346
- const n = e.ie || currentOptimisticLane;
347
- const i = e.re !== undefined;
420
+ const n = e.q || currentOptimisticLane;
421
+ const i = e.Te !== undefined;
348
422
  for (let r = e.I; r !== null; r = r.p) {
349
- if (i && r.h.oe) {
423
+ if (i && r.h.de) {
350
424
  r.h.O |= REACTIVE_SNAPSHOT_STALE;
351
425
  continue;
352
426
  }
@@ -355,93 +429,64 @@ function insertSubs(e, t = false) {
355
429
  assignOrMergeLane(r.h, n);
356
430
  } else if (t) {
357
431
  r.h.O |= REACTIVE_OPTIMISTIC_DIRTY;
358
- r.h.ie = undefined;
432
+ r.h.q = undefined;
359
433
  }
360
434
  const e = r.h;
361
- if (e.se === EFFECT_TRACKED) {
362
- if (!e.ue) {
363
- e.ue = true;
364
- e.ce.enqueue(EFFECT_USER, e.ae);
435
+ if (e.W === EFFECT_TRACKED) {
436
+ if (!e.H) {
437
+ e.H = true;
438
+ e.F.enqueue(EFFECT_USER, e.M);
365
439
  }
366
440
  continue;
367
441
  }
368
- const o = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
369
- if (o.P > r.h.o) o.P = r.h.o;
370
- insertIntoHeap(r.h, o);
442
+ const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
443
+ if (s.P > r.h.o) s.P = r.h.o;
444
+ insertIntoHeap(r.h, s);
371
445
  }
372
446
  }
373
447
  function commitPendingNodes() {
374
- const e = globalQueue.M;
448
+ const e = globalQueue.se;
375
449
  for (let t = 0; t < e.length; t++) {
376
450
  const n = e[t];
377
- if (n.le !== NOT_PENDING) {
378
- n.fe = n.le;
379
- n.le = NOT_PENDING;
380
- if (n.se && n.se !== EFFECT_TRACKED) n.ue = true;
451
+ if (n.X !== NOT_PENDING) {
452
+ n.J = n.X;
453
+ n.X = NOT_PENDING;
454
+ if (n.W && n.W !== EFFECT_TRACKED) n.H = true;
381
455
  }
382
- if (n.Ee & STATUS_PENDING) {
383
- const e = n.q?.source;
384
- if (e && !(e.Ee & STATUS_PENDING)) {
385
- n.Ee &= -6;
386
- n.q = null;
387
- }
388
- } else n.Ee &= ~STATUS_UNINITIALIZED;
389
- if (n.L) GlobalQueue.Y(n, false, true);
456
+ if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
457
+ if (n.L) GlobalQueue.ue(n, false, true);
390
458
  }
391
459
  e.length = 0;
392
460
  }
393
461
  function finalizePureQueue(e = null, t = false) {
394
- let n = !t;
462
+ const n = !t;
395
463
  if (n) commitPendingNodes();
396
464
  if (!t) checkBoundaryChildren(globalQueue);
397
- if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.K);
465
+ if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
398
466
  if (n) {
399
467
  commitPendingNodes();
400
- const t = e ? e.$ : globalQueue.$;
401
- for (let e = 0; e < t.length; e++) {
402
- const n = t[e];
403
- n.ie = undefined;
404
- if (n.le !== NOT_PENDING) {
405
- n.fe = n.le;
406
- n.le = NOT_PENDING;
407
- }
408
- const i = n.Te;
409
- n.Te = NOT_PENDING;
410
- if (i !== NOT_PENDING && n.fe !== i) insertSubs(n, true);
411
- n.ne = null;
412
- }
413
- t.length = 0;
414
- e ? e.j : globalQueue.j;
415
- for (const t of activeLanes) {
416
- const n = e ? t.ne === e : !t.ne;
417
- if (!n) continue;
418
- if (!t.k) {
419
- if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
420
- if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
421
- }
422
- if (t.de.ie === t) t.de.ie = undefined;
423
- t.U.clear();
424
- t.W[0].length = 0;
425
- t.W[1].length = 0;
426
- activeLanes.delete(t);
427
- signalLanes.delete(t.de);
428
- }
468
+ resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
469
+ e ? e.Z : globalQueue.Z;
470
+ cleanupCompletedLanes(e);
429
471
  }
430
472
  }
431
473
  function checkBoundaryChildren(e) {
432
- for (const t of e.F) {
474
+ for (const t of e.re) {
433
475
  t.checkSources?.();
434
476
  checkBoundaryChildren(t);
435
477
  }
436
478
  }
437
479
  function reassignPendingTransition(e) {
438
480
  for (let t = 0; t < e.length; t++) {
439
- e[t].ne = activeTransition;
481
+ e[t].K = activeTransition;
440
482
  }
441
483
  }
442
484
  const globalQueue = new GlobalQueue();
443
485
  function flush() {
444
- while (scheduled) {
486
+ if (globalQueue.ne) {
487
+ return;
488
+ }
489
+ while (scheduled || activeTransition) {
445
490
  globalQueue.flush();
446
491
  }
447
492
  }
@@ -449,21 +494,30 @@ function runQueue(e, t) {
449
494
  for (let n = 0; n < e.length; n++) e[n](t);
450
495
  }
451
496
  function transitionComplete(e) {
452
- if (e.te) return true;
453
- if (e.ee.length) return false;
497
+ if (e.$) return true;
498
+ if (e.j.length) return false;
454
499
  let t = true;
455
- for (let n = 0; n < e.X.length; n++) {
456
- const i = e.X[n];
457
- if (i.Ee & STATUS_PENDING && i.q?.source === i) {
500
+ for (let n = 0; n < e.B.length; n++) {
501
+ const i = e.B[n];
502
+ if (i.Se & STATUS_PENDING && i.le?.source === i) {
458
503
  t = false;
459
504
  break;
460
505
  }
461
506
  }
462
- t && (e.te = true);
507
+ if (t) {
508
+ for (let n = 0; n < e.Y.length; n++) {
509
+ const i = e.Y[n];
510
+ if (hasActiveOverride(i) && "Se" in i && i.Se & STATUS_PENDING && i.le instanceof NotReadyError && i.le.source !== i) {
511
+ t = false;
512
+ break;
513
+ }
514
+ }
515
+ }
516
+ t && (e.$ = true);
463
517
  return t;
464
518
  }
465
519
  function currentTransition(e) {
466
- while (e.te && typeof e.te === "object") e = e.te;
520
+ while (e.$ && typeof e.$ === "object") e = e.$;
467
521
  return e;
468
522
  }
469
523
  function runInTransition(e, t) {
@@ -482,119 +536,213 @@ function getOrCreateLane(e) {
482
536
  if (t) {
483
537
  return findLane(t);
484
538
  }
485
- const n = e.Se;
486
- const i = n?.ie ? findLane(n.ie) : null;
539
+ const n = e.Re;
540
+ const i = n?.q ? findLane(n.q) : null;
487
541
  t = {
488
- de: e,
489
- U: new Set(),
490
- W: [[], []],
491
- k: null,
492
- ne: activeTransition,
493
- Re: i
542
+ te: e,
543
+ k: new Set(),
544
+ G: [[], []],
545
+ U: null,
546
+ K: activeTransition,
547
+ Oe: i
494
548
  };
495
549
  signalLanes.set(e, t);
496
550
  activeLanes.add(t);
497
- e.Oe = false;
551
+ e._e = false;
498
552
  return t;
499
553
  }
500
554
  function findLane(e) {
501
- while (e.k) e = e.k;
555
+ while (e.U) e = e.U;
502
556
  return e;
503
557
  }
504
558
  function mergeLanes(e, t) {
505
559
  e = findLane(e);
506
560
  t = findLane(t);
507
561
  if (e === t) return e;
508
- t.k = e;
509
- for (const n of t.U) e.U.add(n);
510
- e.W[0].push(...t.W[0]);
511
- e.W[1].push(...t.W[1]);
562
+ t.U = e;
563
+ for (const n of t.k) e.k.add(n);
564
+ e.G[0].push(...t.G[0]);
565
+ e.G[1].push(...t.G[1]);
512
566
  return e;
513
567
  }
514
568
  function resolveLane(e) {
515
- const t = e.ie;
569
+ const t = e.q;
516
570
  if (!t) return undefined;
517
571
  const n = findLane(t);
518
572
  if (activeLanes.has(n)) return n;
519
- e.ie = undefined;
573
+ e.q = undefined;
520
574
  return undefined;
521
575
  }
576
+ function resolveTransition(e) {
577
+ return resolveLane(e)?.K ?? e.K;
578
+ }
522
579
  function hasActiveOverride(e) {
523
- return !!(e.Te !== undefined && e.Te !== NOT_PENDING);
580
+ return !!(e.ee !== undefined && e.ee !== NOT_PENDING);
524
581
  }
525
582
  function assignOrMergeLane(e, t) {
526
583
  const n = findLane(t);
527
- const i = e.ie;
584
+ const i = e.q;
528
585
  if (i) {
529
- if (i.k) {
530
- e.ie = t;
586
+ if (i.U) {
587
+ e.q = t;
531
588
  return;
532
589
  }
533
590
  const r = findLane(i);
534
591
  if (activeLanes.has(r)) {
535
592
  if (r !== n && !hasActiveOverride(e)) {
536
- if (n.Re && findLane(n.Re) === r) {
537
- e.ie = t;
538
- } else if (r.Re && findLane(r.Re) === n) ;else mergeLanes(n, r);
593
+ if (n.Oe && findLane(n.Oe) === r) {
594
+ e.q = t;
595
+ } else if (r.Oe && findLane(r.Oe) === n) ;else mergeLanes(n, r);
539
596
  }
540
597
  return;
541
598
  }
542
599
  }
543
- e.ie = t;
600
+ e.q = t;
601
+ }
602
+ function addPendingSource(e, t) {
603
+ if (e.Ie === t || e.pe?.has(t)) return false;
604
+ if (!e.Ie) {
605
+ e.Ie = t;
606
+ return true;
607
+ }
608
+ if (!e.pe) {
609
+ e.pe = new Set([e.Ie, t]);
610
+ } else {
611
+ e.pe.add(t);
612
+ }
613
+ e.Ie = undefined;
614
+ return true;
615
+ }
616
+ function removePendingSource(e, t) {
617
+ if (e.Ie) {
618
+ if (e.Ie !== t) return false;
619
+ e.Ie = undefined;
620
+ return true;
621
+ }
622
+ if (!e.pe?.delete(t)) return false;
623
+ if (e.pe.size === 1) {
624
+ e.Ie = e.pe.values().next().value;
625
+ e.pe = undefined;
626
+ } else if (e.pe.size === 0) {
627
+ e.pe = undefined;
628
+ }
629
+ return true;
630
+ }
631
+ function clearPendingSources(e) {
632
+ e.Ie = undefined;
633
+ e.pe?.clear();
634
+ e.pe = undefined;
635
+ }
636
+ function setPendingError(e, t, n) {
637
+ if (!t) {
638
+ e.le = null;
639
+ return;
640
+ }
641
+ if (n instanceof NotReadyError && n.source === t) {
642
+ e.le = n;
643
+ return;
644
+ }
645
+ const i = e.le;
646
+ if (!(i instanceof NotReadyError) || i.source !== t) {
647
+ e.le = new NotReadyError(t);
648
+ }
649
+ }
650
+ function forEachDependent(e, t) {
651
+ for (let n = e.I; n !== null; n = n.p) t(n.h);
652
+ for (let n = e.A; n !== null; n = n.N) {
653
+ for (let e = n.I; e !== null; e = e.p) t(e.h);
654
+ }
655
+ }
656
+ function settlePendingSource(e) {
657
+ let t = false;
658
+ const n = new Set();
659
+ const settle = i => {
660
+ if (n.has(i) || !removePendingSource(i, e)) return;
661
+ n.add(i);
662
+ i.Ee = clock;
663
+ const r = i.Ie ?? i.pe?.values().next().value;
664
+ if (r) {
665
+ setPendingError(i, r);
666
+ updatePendingSignal(i);
667
+ } else {
668
+ i.Se &= ~STATUS_PENDING;
669
+ setPendingError(i);
670
+ updatePendingSignal(i);
671
+ if (i.he) {
672
+ if (i.W === EFFECT_TRACKED) {
673
+ const e = i;
674
+ if (!e.H) {
675
+ e.H = true;
676
+ e.F.enqueue(EFFECT_USER, e.M);
677
+ }
678
+ } else {
679
+ const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
680
+ if (e.P > i.o) e.P = i.o;
681
+ insertIntoHeap(i, e);
682
+ }
683
+ t = true;
684
+ }
685
+ i.he = false;
686
+ }
687
+ forEachDependent(i, settle);
688
+ };
689
+ forEachDependent(e, settle);
690
+ if (t) schedule();
544
691
  }
545
692
  function handleAsync(e, t, n) {
546
693
  const i = typeof t === "object" && t !== null;
547
694
  const r = i && untrack(() => t[Symbol.asyncIterator]);
548
- const o = !r && i && untrack(() => typeof t.then === "function");
549
- if (!o && !r) {
550
- e._e = null;
695
+ const s = !r && i && untrack(() => typeof t.then === "function");
696
+ if (!s && !r) {
697
+ e.Ae = null;
551
698
  return t;
552
699
  }
553
- e._e = t;
554
- let s;
700
+ e.Ae = t;
701
+ let o;
555
702
  const handleError = n => {
556
- if (e._e !== t) return;
557
- globalQueue.initTransition(e.ne);
703
+ if (e.Ae !== t) return;
704
+ globalQueue.initTransition(resolveTransition(e));
558
705
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
559
- e.J = clock;
706
+ e.Ee = clock;
560
707
  };
561
708
  const asyncWrite = (i, r) => {
562
- if (e._e !== t) return;
709
+ if (e.Ae !== t) return;
563
710
  if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
564
- globalQueue.initTransition(e.ne);
711
+ globalQueue.initTransition(resolveTransition(e));
565
712
  clearStatus(e);
566
- const o = resolveLane(e);
567
- if (o) o.U.delete(e);
568
- if (e.Te !== undefined) {
569
- if (e.Te !== undefined && e.Te !== NOT_PENDING) e.le = i;else {
570
- e.fe = i;
713
+ const s = resolveLane(e);
714
+ if (s) s.k.delete(e);
715
+ if (e.ee !== undefined) {
716
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;else {
717
+ e.J = i;
571
718
  insertSubs(e);
572
719
  }
573
- e.J = clock;
574
- } else if (o) {
575
- const t = e.fe;
576
- const n = e.Ie;
720
+ e.Ee = clock;
721
+ } else if (s) {
722
+ const t = e.J;
723
+ const n = e.Ne;
577
724
  if (!n || !n(i, t)) {
578
- e.fe = i;
579
- e.J = clock;
580
- if (e.pe) {
581
- setSignal(e.pe, i);
725
+ e.J = i;
726
+ e.Ee = clock;
727
+ if (e.Pe) {
728
+ setSignal(e.Pe, i);
582
729
  }
583
730
  insertSubs(e, true);
584
731
  }
585
732
  } else {
586
733
  setSignal(e, () => i);
587
734
  }
735
+ settlePendingSource(e);
588
736
  schedule();
589
737
  flush();
590
738
  r?.();
591
739
  };
592
- if (o) {
740
+ if (s) {
593
741
  let n = false,
594
742
  i = true;
595
743
  t.then(e => {
596
744
  if (i) {
597
- s = e;
745
+ o = e;
598
746
  n = true;
599
747
  } else asyncWrite(e);
600
748
  }, e => {
@@ -602,7 +750,7 @@ function handleAsync(e, t, n) {
602
750
  });
603
751
  i = false;
604
752
  if (!n) {
605
- globalQueue.initTransition(e.ne);
753
+ globalQueue.initTransition(resolveTransition(e));
606
754
  throw new NotReadyError(context);
607
755
  }
608
756
  }
@@ -626,7 +774,7 @@ function handleAsync(e, t, n) {
626
774
  });
627
775
  r = false;
628
776
  if (t && !e.done) {
629
- s = e.value;
777
+ o = e.value;
630
778
  i = true;
631
779
  return iterate();
632
780
  }
@@ -634,75 +782,126 @@ function handleAsync(e, t, n) {
634
782
  };
635
783
  const r = iterate();
636
784
  if (!i && !r) {
637
- globalQueue.initTransition(e.ne);
785
+ globalQueue.initTransition(resolveTransition(e));
638
786
  throw new NotReadyError(context);
639
787
  }
640
788
  }
641
- return s;
789
+ return o;
642
790
  }
643
- function clearStatus(e) {
644
- e.Ee = e.Ee & STATUS_UNINITIALIZED;
645
- e.q = null;
791
+ function clearStatus(e, t = false) {
792
+ clearPendingSources(e);
793
+ e.he = false;
794
+ e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
795
+ setPendingError(e);
646
796
  updatePendingSignal(e);
647
- e.he?.();
797
+ e.ge?.();
648
798
  }
649
799
  function notifyStatus(e, t, n, i, r) {
650
800
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError)) n = new StatusError(e, n);
651
- const o = n instanceof NotReadyError && n.source === e;
652
- const s = t === STATUS_PENDING && e.Te !== undefined && !o;
653
- const u = s && hasActiveOverride(e);
801
+ const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
802
+ const o = s === e;
803
+ const u = t === STATUS_PENDING && e.ee !== undefined && !o;
804
+ const c = u && hasActiveOverride(e);
654
805
  if (!i) {
655
- e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
656
- e.q = n;
806
+ if (t === STATUS_PENDING && s) {
807
+ addPendingSource(e, s);
808
+ e.Se = STATUS_PENDING | e.Se & STATUS_UNINITIALIZED;
809
+ setPendingError(e, s, n);
810
+ } else {
811
+ clearPendingSources(e);
812
+ e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
813
+ e.le = n;
814
+ }
657
815
  updatePendingSignal(e);
658
816
  }
659
817
  if (r && !i) {
660
818
  assignOrMergeLane(e, r);
661
819
  }
662
- if (u && activeTransition && n instanceof NotReadyError) {
663
- const e = n.source;
664
- if (!activeTransition.X.includes(e)) {
665
- activeTransition.X.push(e);
820
+ const a = i || c;
821
+ const f = i || u ? undefined : r;
822
+ if (e.ge) {
823
+ if (i && t === STATUS_PENDING) {
824
+ return;
666
825
  }
667
- }
668
- const c = i || u;
669
- const a = i || s ? undefined : r;
670
- if (e.he) {
671
- if (c) {
672
- e.he(t, n);
826
+ if (a) {
827
+ e.ge(t, n);
673
828
  } else {
674
- e.he();
829
+ e.ge();
675
830
  }
676
831
  return;
677
832
  }
678
- for (let i = e.I; i !== null; i = i.p) {
679
- i.h.J = clock;
680
- if (i.h.q !== n) {
681
- !i.h.ne && globalQueue.M.push(i.h);
682
- notifyStatus(i.h, t, n, c, a);
833
+ forEachDependent(e, e => {
834
+ e.Ee = clock;
835
+ if (t === STATUS_PENDING && s && e.Ie !== s && !e.pe?.has(s) || t !== STATUS_PENDING && (e.le !== n || e.Ie || e.pe)) {
836
+ if (!a && !e.K) globalQueue.se.push(e);
837
+ notifyStatus(e, t, n, a, f);
683
838
  }
839
+ });
840
+ }
841
+ let externalSourceConfig = null;
842
+ function markDisposal(e) {
843
+ let t = e.Ce;
844
+ while (t) {
845
+ t.O |= REACTIVE_ZOMBIE;
846
+ if (t.O & REACTIVE_IN_HEAP) {
847
+ deleteFromHeap(t, dirtyQueue);
848
+ insertIntoHeap(t, zombieQueue);
849
+ }
850
+ markDisposal(t);
851
+ t = t.De;
684
852
  }
685
- for (let i = e.A; i !== null; i = i.N) {
686
- for (let e = i.I; e !== null; e = e.p) {
687
- e.h.J = clock;
688
- if (e.h.q !== n) {
689
- !e.h.ne && globalQueue.M.push(e.h);
690
- notifyStatus(e.h, t, n, c, a);
691
- }
853
+ }
854
+ function disposeChildren(e, t = false, n) {
855
+ if (e.O & REACTIVE_DISPOSED) return;
856
+ if (t) e.O = REACTIVE_DISPOSED;
857
+ let i = n ? e.me : e.Ce;
858
+ while (i) {
859
+ const e = i.De;
860
+ if (i.C) {
861
+ const e = i;
862
+ deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
863
+ let t = e.C;
864
+ do {
865
+ t = unlinkSubs(t);
866
+ } while (t !== null);
867
+ e.C = null;
868
+ e.ye = null;
869
+ }
870
+ disposeChildren(i, true);
871
+ i = e;
872
+ }
873
+ if (n) {
874
+ e.me = null;
875
+ } else {
876
+ e.Ce = null;
877
+ e.ve = 0;
878
+ }
879
+ runDisposal(e, n);
880
+ }
881
+ function runDisposal(e, t) {
882
+ let n = t ? e.we : e.be;
883
+ if (!n) return;
884
+ if (Array.isArray(n)) {
885
+ for (let e = 0; e < n.length; e++) {
886
+ const t = n[e];
887
+ t.call(t);
692
888
  }
889
+ } else {
890
+ n.call(n);
693
891
  }
892
+ t ? e.we = null : e.be = null;
694
893
  }
695
894
  function unlinkSubs(e) {
696
895
  const t = e.m;
697
896
  const n = e.D;
698
897
  const i = e.p;
699
- const r = e.Ae;
700
- if (i !== null) i.Ae = r;else t.Ne = r;
898
+ const r = e.Ue;
899
+ if (i !== null) i.Ue = r;else t.ke = r;
701
900
  if (r !== null) r.p = i;else {
702
901
  t.I = i;
703
902
  if (i === null) {
704
- t.ge?.();
705
- t.L && !t.Pe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
903
+ t.Ge?.();
904
+ t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
706
905
  }
707
906
  }
708
907
  return n;
@@ -717,31 +916,31 @@ function unobserved(e) {
717
916
  disposeChildren(e, true);
718
917
  }
719
918
  function link(e, t) {
720
- const n = t.Ce;
919
+ const n = t.ye;
721
920
  if (n !== null && n.m === e) return;
722
921
  let i = null;
723
922
  const r = t.O & REACTIVE_RECOMPUTING_DEPS;
724
923
  if (r) {
725
924
  i = n !== null ? n.D : t.C;
726
925
  if (i !== null && i.m === e) {
727
- t.Ce = i;
926
+ t.ye = i;
728
927
  return;
729
928
  }
730
929
  }
731
- const o = e.Ne;
732
- if (o !== null && o.h === t && (!r || isValidLink(o, t))) return;
733
- const s = t.Ce = e.Ne = {
930
+ const s = e.ke;
931
+ if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
932
+ const o = t.ye = e.ke = {
734
933
  m: e,
735
934
  h: t,
736
935
  D: i,
737
- Ae: o,
936
+ Ue: s,
738
937
  p: null
739
938
  };
740
- if (n !== null) n.D = s;else t.C = s;
741
- if (o !== null) o.p = s;else e.I = s;
939
+ if (n !== null) n.D = o;else t.C = o;
940
+ if (s !== null) s.p = o;else e.I = o;
742
941
  }
743
942
  function isValidLink(e, t) {
744
- const n = t.Ce;
943
+ const n = t.ye;
745
944
  if (n !== null) {
746
945
  let i = t.C;
747
946
  do {
@@ -752,91 +951,38 @@ function isValidLink(e, t) {
752
951
  }
753
952
  return false;
754
953
  }
755
- function markDisposal(e) {
756
- let t = e.De;
757
- while (t) {
758
- t.O |= REACTIVE_ZOMBIE;
759
- if (t.O & REACTIVE_IN_HEAP) {
760
- deleteFromHeap(t, dirtyQueue);
761
- insertIntoHeap(t, zombieQueue);
762
- }
763
- markDisposal(t);
764
- t = t.ye;
765
- }
766
- }
767
- function disposeChildren(e, t = false, n) {
768
- if (e.O & REACTIVE_DISPOSED) return;
769
- if (t) e.O = REACTIVE_DISPOSED;
770
- let i = n ? e.ve : e.De;
771
- while (i) {
772
- const e = i.ye;
773
- if (i.C) {
774
- const e = i;
775
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
776
- let t = e.C;
777
- do {
778
- t = unlinkSubs(t);
779
- } while (t !== null);
780
- e.C = null;
781
- e.Ce = null;
782
- }
783
- disposeChildren(i, true);
784
- i = e;
785
- }
786
- if (n) {
787
- e.ve = null;
788
- } else {
789
- e.De = null;
790
- e.we = 0;
791
- }
792
- runDisposal(e, n);
793
- }
794
- function runDisposal(e, t) {
795
- let n = t ? e.be : e.me;
796
- if (!n) return;
797
- if (Array.isArray(n)) {
798
- for (let e = 0; e < n.length; e++) {
799
- const t = n[e];
800
- t.call(t);
801
- }
802
- } else {
803
- n.call(n);
804
- }
805
- t ? e.be = null : e.me = null;
806
- }
807
- let externalSourceConfig = null;
808
- GlobalQueue.K = recompute;
809
- GlobalQueue.Y = disposeChildren;
954
+ GlobalQueue.oe = recompute;
955
+ GlobalQueue.ue = disposeChildren;
810
956
  let tracking = false;
811
957
  let stale = false;
812
958
  let context = null;
813
959
  let currentOptimisticLane = null;
814
960
  function recompute(e, t = false) {
815
- const n = e.se;
961
+ const n = e.W;
816
962
  if (!t) {
817
- if (e.ne && (!n || activeTransition) && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
963
+ if (e.K && (!n || activeTransition) && activeTransition !== e.K) globalQueue.initTransition(e.K);
818
964
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
819
- if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);else {
965
+ if (e.K || n === EFFECT_TRACKED) disposeChildren(e);else {
820
966
  markDisposal(e);
821
- e.be = e.me;
822
- e.ve = e.De;
823
- e.me = null;
824
- e.De = null;
825
- e.we = 0;
967
+ e.we = e.be;
968
+ e.me = e.Ce;
969
+ e.be = null;
970
+ e.Ce = null;
971
+ e.ve = 0;
826
972
  }
827
973
  }
828
974
  const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
829
- const r = e.Te !== undefined && e.Te !== NOT_PENDING;
830
- const o = !!(e.Ee & STATUS_PENDING);
831
- const s = context;
975
+ const r = e.ee !== undefined && e.ee !== NOT_PENDING;
976
+ const s = !!(e.Se & STATUS_PENDING);
977
+ const o = context;
832
978
  context = e;
833
- e.Ce = null;
979
+ e.ye = null;
834
980
  e.O = REACTIVE_RECOMPUTING_DEPS;
835
- e.J = clock;
836
- let u = e.le === NOT_PENDING ? e.fe : e.le;
981
+ e.Ee = clock;
982
+ let u = e.X === NOT_PENDING ? e.J : e.X;
837
983
  let c = e.o;
838
984
  let a = tracking;
839
- let l = currentOptimisticLane;
985
+ let f = currentOptimisticLane;
840
986
  tracking = true;
841
987
  if (i) {
842
988
  const t = resolveLane(e);
@@ -844,60 +990,61 @@ function recompute(e, t = false) {
844
990
  }
845
991
  try {
846
992
  u = handleAsync(e, e.L(u));
847
- clearStatus(e);
848
- const t = resolveLane(e);
849
- if (t) {
850
- t.U.delete(e);
851
- updatePendingSignal(t.de);
993
+ clearStatus(e, t);
994
+ const n = resolveLane(e);
995
+ if (n) {
996
+ n.k.delete(e);
997
+ updatePendingSignal(n.te);
852
998
  }
853
999
  } catch (t) {
854
1000
  if (t instanceof NotReadyError && currentOptimisticLane) {
855
1001
  const t = findLane(currentOptimisticLane);
856
- if (t.de !== e) {
857
- t.U.add(e);
858
- e.ie = t;
859
- updatePendingSignal(t.de);
1002
+ if (t.te !== e) {
1003
+ t.k.add(e);
1004
+ e.q = t;
1005
+ updatePendingSignal(t.te);
860
1006
  }
861
1007
  }
862
- notifyStatus(e, t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, t, undefined, t instanceof NotReadyError ? e.ie : undefined);
1008
+ if (t instanceof NotReadyError) e.he = true;
1009
+ notifyStatus(e, t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, t, undefined, t instanceof NotReadyError ? e.q : undefined);
863
1010
  } finally {
864
1011
  tracking = a;
865
1012
  e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
866
- context = s;
1013
+ context = o;
867
1014
  }
868
- if (!e.q) {
869
- const s = e.Ce;
870
- let a = s !== null ? s.D : e.C;
1015
+ if (!e.le) {
1016
+ const o = e.ye;
1017
+ let a = o !== null ? o.D : e.C;
871
1018
  if (a !== null) {
872
1019
  do {
873
1020
  a = unlinkSubs(a);
874
1021
  } while (a !== null);
875
- if (s !== null) s.D = null;else e.C = null;
1022
+ if (o !== null) o.D = null;else e.C = null;
876
1023
  }
877
- const l = r ? e.Te : e.le === NOT_PENDING ? e.fe : e.le;
878
- const f = !e.Ie || !e.Ie(l, u);
879
- if (f) {
880
- const s = r ? e.Te : undefined;
881
- if (t || n && activeTransition !== e.ne || i) {
882
- e.fe = u;
1024
+ const f = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
1025
+ const l = !e.Ne || !e.Ne(f, u);
1026
+ if (l) {
1027
+ const o = r ? e.ee : undefined;
1028
+ if (t || n && activeTransition !== e.K || i) {
1029
+ e.J = u;
883
1030
  if (r && i) {
884
- e.Te = u;
885
- e.le = u;
1031
+ e.ee = u;
1032
+ e.X = u;
886
1033
  }
887
- } else e.le = u;
888
- if (r && !i && o && !e.Oe) e.Te = u;
889
- if (!r || i || e.Te !== s) insertSubs(e, i || r);
1034
+ } else e.X = u;
1035
+ if (r && !i && s && !e._e) e.ee = u;
1036
+ if (!r || i || e.ee !== o) insertSubs(e, i || r);
890
1037
  } else if (r) {
891
- e.le = u;
1038
+ e.X = u;
892
1039
  } else if (e.o != c) {
893
1040
  for (let t = e.I; t !== null; t = t.p) {
894
1041
  insertIntoHeapHeight(t.h, t.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
895
1042
  }
896
1043
  }
897
1044
  }
898
- currentOptimisticLane = l;
899
- (!t || e.Ee & STATUS_PENDING) && !e.ne && !(activeTransition && r) && globalQueue.M.push(e);
900
- e.ne && n && activeTransition !== e.ne && runInTransition(e.ne, () => recompute(e));
1045
+ currentOptimisticLane = f;
1046
+ (!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
1047
+ e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
901
1048
  }
902
1049
  function updateIfNecessary(e) {
903
1050
  if (e.O & REACTIVE_CHECK) {
@@ -912,7 +1059,7 @@ function updateIfNecessary(e) {
912
1059
  }
913
1060
  }
914
1061
  }
915
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.q && e.J < clock && !e._e) {
1062
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.le && e.Ee < clock && !e.Ae) {
916
1063
  recompute(e);
917
1064
  }
918
1065
  e.O = REACTIVE_NONE | e.O & REACTIVE_SNAPSHOT_STALE;
@@ -922,47 +1069,47 @@ function computed(e, t, n) {
922
1069
  const r = {
923
1070
  id: n?.id ?? (context?.id ),
924
1071
  Ve: i,
925
- Ie: n?.equals != null ? n.equals : isEqual,
926
- Ge: !!n?.pureWrite,
927
- ge: n?.unobserved,
928
- me: null,
929
- ce: context?.ce ?? globalQueue,
1072
+ Ne: n?.equals != null ? n.equals : isEqual,
1073
+ fe: !!n?.pureWrite,
1074
+ Ge: n?.unobserved,
1075
+ be: null,
1076
+ F: context?.F ?? globalQueue,
930
1077
  Le: context?.Le ?? defaultContext,
931
- we: 0,
1078
+ ve: 0,
932
1079
  L: e,
933
- fe: t,
1080
+ J: t,
934
1081
  o: 0,
935
1082
  A: null,
936
1083
  S: undefined,
937
1084
  T: null,
938
1085
  C: null,
939
- Ce: null,
1086
+ ye: null,
940
1087
  I: null,
941
- Ne: null,
1088
+ ke: null,
942
1089
  i: context,
943
- ye: null,
944
1090
  De: null,
1091
+ Ce: null,
945
1092
  O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
946
- Ee: STATUS_UNINITIALIZED,
947
- J: clock,
948
- le: NOT_PENDING,
949
- be: null,
950
- ve: null,
951
- _e: null,
952
- ne: null
1093
+ Se: STATUS_UNINITIALIZED,
1094
+ Ee: clock,
1095
+ X: NOT_PENDING,
1096
+ we: null,
1097
+ me: null,
1098
+ Ae: null,
1099
+ K: null
953
1100
  };
954
1101
  r.T = r;
955
- const o = context?.t ? context.u : context;
1102
+ const s = context?.t ? context.u : context;
956
1103
  if (context) {
957
- const e = context.De;
1104
+ const e = context.Ce;
958
1105
  if (e === null) {
959
- context.De = r;
1106
+ context.Ce = r;
960
1107
  } else {
961
- r.ye = e;
962
- context.De = r;
1108
+ r.De = e;
1109
+ context.Ce = r;
963
1110
  }
964
1111
  }
965
- if (o) r.o = o.o + 1;
1112
+ if (s) r.o = s.o + 1;
966
1113
  !n?.lazy && recompute(r, true);
967
1114
  return r;
968
1115
  }
@@ -1004,41 +1151,45 @@ function read(e) {
1004
1151
  }
1005
1152
  }
1006
1153
  }
1007
- if (n.Ee & STATUS_PENDING) {
1008
- const i = n.q?.source;
1009
- if (i && !(i.Ee & STATUS_PENDING)) clearStatus(n);else if (t && true) {
1154
+ if (n.Se & STATUS_PENDING) {
1155
+ if (t && true) {
1010
1156
  if (currentOptimisticLane) {
1011
- const i = n.ie;
1157
+ const i = n.q;
1012
1158
  const r = findLane(currentOptimisticLane);
1013
1159
  if (i && findLane(i) === r && !hasActiveOverride(n)) {
1014
1160
  if (!tracking && e !== t) link(e, t);
1015
- throw n.q;
1161
+ throw n.le;
1016
1162
  }
1017
1163
  } else {
1018
1164
  if (!tracking && e !== t) link(e, t);
1019
- throw n.q;
1165
+ throw n.le;
1020
1166
  }
1021
- } else if (!t && n.Ee & STATUS_UNINITIALIZED) {
1022
- throw n.q;
1167
+ } else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
1168
+ if (!tracking && e !== t) link(e, t);
1169
+ throw n.le;
1170
+ } else if (!t && n.Se & STATUS_UNINITIALIZED) {
1171
+ throw n.le;
1023
1172
  }
1024
1173
  }
1025
- if (e.L && e.Ee & STATUS_ERROR) {
1026
- if (e.J < clock) {
1174
+ if (e.L && e.Se & STATUS_ERROR) {
1175
+ if (e.Ee < clock) {
1027
1176
  recompute(e, true);
1028
1177
  return read(e);
1029
- } else throw e.q;
1178
+ } else throw e.le;
1179
+ }
1180
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1181
+ return e.ee;
1030
1182
  }
1031
- if (e.Te !== undefined && e.Te !== NOT_PENDING) return e.Te;
1032
- return !t || currentOptimisticLane !== null && (e.Te !== undefined || e.ie || n === e && stale || !!(n.Ee & STATUS_PENDING)) || e.le === NOT_PENDING || stale ? e.fe : e.le;
1183
+ return !t || currentOptimisticLane !== null && (e.ee !== undefined || e.q || n === e && stale || !!(n.Se & STATUS_PENDING)) || e.X === NOT_PENDING || stale ? e.J : e.X;
1033
1184
  }
1034
1185
  function setSignal(e, t) {
1035
- if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
1036
- const n = e.Te !== undefined && true;
1037
- const i = e.Te !== undefined && e.Te !== NOT_PENDING;
1038
- const r = n ? i ? e.Te : e.fe : e.le === NOT_PENDING ? e.fe : e.le;
1186
+ if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
1187
+ const n = e.ee !== undefined && true;
1188
+ const i = e.ee !== undefined && e.ee !== NOT_PENDING;
1189
+ const r = n ? i ? e.ee : e.J : e.X === NOT_PENDING ? e.J : e.X;
1039
1190
  if (typeof t === "function") t = t(r);
1040
- const o = !e.Ie || !e.Ie(r, t) || !!(e.Ee & STATUS_UNINITIALIZED);
1041
- if (!o) {
1191
+ const s = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1192
+ if (!s) {
1042
1193
  if (n && i && e.L) {
1043
1194
  insertSubs(e, true);
1044
1195
  schedule();
@@ -1046,57 +1197,64 @@ function setSignal(e, t) {
1046
1197
  return t;
1047
1198
  }
1048
1199
  if (n) {
1049
- const n = e.Te === NOT_PENDING;
1050
- if (!n && e.ne) globalQueue.initTransition(e.ne);
1200
+ const n = e.ee === NOT_PENDING;
1201
+ if (!n) globalQueue.initTransition(resolveTransition(e));
1051
1202
  if (n) {
1052
- e.le = e.fe;
1053
- globalQueue.$.push(e);
1203
+ e.X = e.J;
1204
+ globalQueue.Y.push(e);
1054
1205
  }
1055
- e.Oe = true;
1206
+ e._e = true;
1056
1207
  const i = getOrCreateLane(e);
1057
- e.ie = i;
1058
- e.Te = t;
1208
+ e.q = i;
1209
+ e.ee = t;
1059
1210
  } else {
1060
- if (e.le === NOT_PENDING) globalQueue.M.push(e);
1061
- e.le = t;
1211
+ if (e.X === NOT_PENDING) globalQueue.se.push(e);
1212
+ e.X = t;
1062
1213
  }
1063
1214
  updatePendingSignal(e);
1064
- if (e.pe) {
1065
- setSignal(e.pe, t);
1215
+ if (e.Pe) {
1216
+ setSignal(e.Pe, t);
1066
1217
  }
1067
- e.J = clock;
1218
+ e.Ee = clock;
1068
1219
  insertSubs(e, n);
1069
1220
  schedule();
1070
1221
  return t;
1071
1222
  }
1072
1223
  function computePendingState(e) {
1073
1224
  const t = e;
1074
- if (e.Te !== undefined && e.Te !== NOT_PENDING) {
1075
- if (t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1076
- if (e.Se) {
1077
- const t = e.ie ? findLane(e.ie) : null;
1078
- return !!(t && t.U.size > 0);
1225
+ const n = e.V;
1226
+ if (n && e.X !== NOT_PENDING) {
1227
+ return !n.Ae && !(n.Se & STATUS_PENDING);
1228
+ }
1229
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1230
+ if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1231
+ if (e.Re) {
1232
+ const t = e.q ? findLane(e.q) : null;
1233
+ return !!(t && t.k.size > 0);
1079
1234
  }
1080
1235
  return true;
1081
1236
  }
1082
- if (e.le !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1083
- return !!(t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED));
1237
+ if (e.ee !== undefined && e.ee === NOT_PENDING && !e.Re) {
1238
+ return false;
1239
+ }
1240
+ if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1241
+ return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
1084
1242
  }
1085
1243
  function updatePendingSignal(e) {
1086
- if (e.Fe) {
1244
+ if (e.Qe) {
1087
1245
  const t = computePendingState(e);
1088
- const n = e.Fe;
1246
+ const n = e.Qe;
1089
1247
  setSignal(n, t);
1090
- if (!t && n.ie) {
1248
+ if (!t && n.q) {
1091
1249
  const t = resolveLane(e);
1092
- if (t && t.U.size > 0) {
1093
- const e = findLane(n.ie);
1250
+ if (t && t.k.size > 0) {
1251
+ const e = findLane(n.q);
1094
1252
  if (e !== t) {
1095
1253
  mergeLanes(t, e);
1096
1254
  }
1097
1255
  }
1098
1256
  signalLanes.delete(n);
1099
- n.ie = undefined;
1257
+ n.q = undefined;
1100
1258
  }
1101
1259
  }
1102
1260
  }
@@ -1118,8 +1276,8 @@ function updatePath(e, t, n = 0) {
1118
1276
  r = e;
1119
1277
  if (n < t.length - 1) {
1120
1278
  i = t[n];
1121
- const o = typeof i;
1122
- const s = Array.isArray(e);
1279
+ const s = typeof i;
1280
+ const o = Array.isArray(e);
1123
1281
  if (Array.isArray(i)) {
1124
1282
  for (let r = 0; r < i.length; r++) {
1125
1283
  t[n] = i[r];
@@ -1127,7 +1285,7 @@ function updatePath(e, t, n = 0) {
1127
1285
  }
1128
1286
  t[n] = i;
1129
1287
  return;
1130
- } else if (s && o === "function") {
1288
+ } else if (o && s === "function") {
1131
1289
  for (let r = 0; r < e.length; r++) {
1132
1290
  if (i(e[r], r)) {
1133
1291
  t[n] = r;
@@ -1136,13 +1294,13 @@ function updatePath(e, t, n = 0) {
1136
1294
  }
1137
1295
  t[n] = i;
1138
1296
  return;
1139
- } else if (s && o === "object") {
1297
+ } else if (o && s === "object") {
1140
1298
  const {
1141
1299
  from: r = 0,
1142
- to: o = e.length - 1,
1143
- by: s = 1
1300
+ to: s = e.length - 1,
1301
+ by: o = 1
1144
1302
  } = i;
1145
- for (let i = r; i <= o; i += s) {
1303
+ for (let i = r; i <= s; i += o) {
1146
1304
  t[n] = i;
1147
1305
  updatePath(e, t, n);
1148
1306
  }
@@ -1154,20 +1312,20 @@ function updatePath(e, t, n = 0) {
1154
1312
  }
1155
1313
  r = e[i];
1156
1314
  }
1157
- let o = t[t.length - 1];
1158
- if (typeof o === "function") {
1159
- o = o(r);
1160
- if (o === r) return;
1315
+ let s = t[t.length - 1];
1316
+ if (typeof s === "function") {
1317
+ s = s(r);
1318
+ if (s === r) return;
1161
1319
  }
1162
- if (i === undefined && o == undefined) return;
1163
- if (o === DELETE) {
1320
+ if (i === undefined && s == undefined) return;
1321
+ if (s === DELETE) {
1164
1322
  delete e[i];
1165
- } else if (i === undefined || isWrappable(r) && isWrappable(o) && !Array.isArray(o)) {
1323
+ } else if (i === undefined || isWrappable(r) && isWrappable(s) && !Array.isArray(s)) {
1166
1324
  const t = i !== undefined ? e[i] : e;
1167
- const n = Object.keys(o);
1168
- for (let e = 0; e < n.length; e++) t[n[e]] = o[n[e]];
1325
+ const n = Object.keys(s);
1326
+ for (let e = 0; e < n.length; e++) t[n[e]] = s[n[e]];
1169
1327
  } else {
1170
- e[i] = o;
1328
+ e[i] = s;
1171
1329
  }
1172
1330
  }
1173
1331
  Object.assign(function storePath(...e) {