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