@solidjs/universal 2.0.0-beta.2 → 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
@@ -94,7 +94,7 @@ function markNode(e, t = REACTIVE_DIRTY) {
94
94
  markNode(t.h, REACTIVE_CHECK);
95
95
  }
96
96
  if (e.A !== null) {
97
- for (let t = e.A; t !== null; t = t.P) {
97
+ for (let t = e.A; t !== null; t = t.N) {
98
98
  for (let e = t.I; e !== null; e = e.p) {
99
99
  markNode(e.h, REACTIVE_CHECK);
100
100
  }
@@ -103,11 +103,11 @@ function markNode(e, t = REACTIVE_DIRTY) {
103
103
  }
104
104
  function runHeap(e, t) {
105
105
  e._ = false;
106
- for (e.N = 0; e.N <= e.R; e.N++) {
107
- let n = e.l[e.N];
106
+ for (e.P = 0; e.P <= e.R; e.P++) {
107
+ let n = e.l[e.P];
108
108
  while (n !== undefined) {
109
109
  if (n.O & REACTIVE_IN_HEAP) t(n);else adjustHeight(n, e);
110
- n = e.l[e.N];
110
+ n = e.l[e.P];
111
111
  }
112
112
  }
113
113
  e.R = 0;
@@ -116,8 +116,8 @@ function adjustHeight(e, t) {
116
116
  deleteFromHeap(e, t);
117
117
  let n = e.o;
118
118
  for (let t = e.C; t; t = t.D) {
119
- const e = t.V;
120
- const i = e.m || e;
119
+ const e = t.m;
120
+ const i = e.V || e;
121
121
  if (i.L && i.o >= n) n = i.o + 1;
122
122
  }
123
123
  if (e.o !== n) {
@@ -131,46 +131,106 @@ const transitions = new Set();
131
131
  const dirtyQueue = {
132
132
  l: new Array(2e3).fill(undefined),
133
133
  _: false,
134
- N: 0,
134
+ P: 0,
135
135
  R: 0
136
136
  };
137
137
  const zombieQueue = {
138
138
  l: new Array(2e3).fill(undefined),
139
139
  _: false,
140
- N: 0,
140
+ P: 0,
141
141
  R: 0
142
142
  };
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
- M = [];
223
+ ie = [[], []];
224
+ re = [];
165
225
  created = clock;
166
226
  addChild(e) {
167
- this.M.push(e);
227
+ this.re.push(e);
168
228
  e.i = this;
169
229
  }
170
230
  removeChild(e) {
171
- const t = this.M.indexOf(e);
231
+ const t = this.re.indexOf(e);
172
232
  if (t >= 0) {
173
- this.M.splice(t, 1);
233
+ this.re.splice(t, 1);
174
234
  e.i = null;
175
235
  }
176
236
  }
@@ -179,110 +239,126 @@ 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.M.length; t++) this.M[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.M.length; t++) {
205
- let n = this.M[t];
206
- let i = e.M[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
- M: []
269
+ ie: [[], []],
270
+ re: []
211
271
  };
212
- e.M[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.M.length; t++) {
221
- const n = e.M[t];
222
- let i = this.M[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
- F = [];
230
- $ = [];
231
- j = new Set();
232
- static K;
233
- static Y;
234
- static Z = 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.F = [];
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.B);
310
+ this.stashQueues(e.ae);
251
311
  clock++;
252
- scheduled = dirtyQueue.R >= dirtyQueue.N;
253
- reassignPendingTransition(activeTransition.F);
312
+ scheduled = dirtyQueue.R >= dirtyQueue.P;
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.F !== activeTransition.F && this.F.push(...activeTransition.F);
259
- this.restoreQueues(activeTransition.B);
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.F);
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++;
270
- scheduled = dirtyQueue.R >= dirtyQueue.N;
343
+ scheduled = dirtyQueue.R >= dirtyQueue.P;
271
344
  runLaneEffects(EFFECT_RENDER);
272
345
  this.run(EFFECT_RENDER);
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.X;
283
- if (activeTransition && t && !activeTransition.q.includes(t.source)) {
284
- activeTransition.q.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
- F: [],
300
- q: [],
301
- $: [],
302
- j: new Set(),
303
- ee: [],
304
- B: {
305
- G: [[], []],
306
- M: []
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.F.length; e++) {
327
- const t = this.F[e];
328
- t.ne = activeTransition;
329
- activeTransition.F.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.F = activeTransition.F;
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.se) {
423
+ if (i && r.h.de) {
350
424
  r.h.O |= REACTIVE_SNAPSHOT_STALE;
351
425
  continue;
352
426
  }
@@ -355,82 +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.oe === EFFECT_TRACKED) {
362
- if (!e.ue) {
363
- e.ue = true;
364
- e.ce.enqueue(EFFECT_USER, e.le);
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
442
  const s = r.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
369
- if (s.N > r.h.o) s.N = r.h.o;
443
+ if (s.P > r.h.o) s.P = r.h.o;
370
444
  insertIntoHeap(r.h, s);
371
445
  }
372
446
  }
447
+ function commitPendingNodes() {
448
+ const e = globalQueue.se;
449
+ for (let t = 0; t < e.length; t++) {
450
+ const n = e[t];
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;
455
+ }
456
+ if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
457
+ if (n.L) GlobalQueue.ue(n, false, true);
458
+ }
459
+ e.length = 0;
460
+ }
373
461
  function finalizePureQueue(e = null, t = false) {
374
- let n = !t;
462
+ const n = !t;
463
+ if (n) commitPendingNodes();
375
464
  if (!t) checkBoundaryChildren(globalQueue);
376
- if (dirtyQueue.R >= dirtyQueue.N) runHeap(dirtyQueue, GlobalQueue.K);
465
+ if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
377
466
  if (n) {
378
- const t = globalQueue.F;
379
- for (let e = 0; e < t.length; e++) {
380
- const n = t[e];
381
- if (n.ae !== NOT_PENDING) {
382
- n.fe = n.ae;
383
- n.ae = NOT_PENDING;
384
- if (n.oe && n.oe !== EFFECT_TRACKED) n.ue = true;
385
- }
386
- if (!(n.Ee & STATUS_PENDING)) n.Ee &= ~STATUS_UNINITIALIZED;
387
- if (n.L) GlobalQueue.Y(n, false, true);
388
- }
389
- t.length = 0;
390
- const n = e ? e.$ : globalQueue.$;
391
- for (let e = 0; e < n.length; e++) {
392
- const t = n[e];
393
- const i = t.ae;
394
- t.ie = undefined;
395
- if (i !== NOT_PENDING && t.fe !== i) {
396
- t.fe = i;
397
- insertSubs(t, true);
398
- }
399
- t.ae = NOT_PENDING;
400
- t.ne = null;
401
- }
402
- n.length = 0;
403
- e ? e.j : globalQueue.j;
404
- for (const t of activeLanes) {
405
- const n = e ? t.ne === e : !t.ne;
406
- if (!n) continue;
407
- if (!t.k) {
408
- if (t.W[0].length) runQueue(t.W[0], EFFECT_RENDER);
409
- if (t.W[1].length) runQueue(t.W[1], EFFECT_USER);
410
- }
411
- if (t.Te.ie === t) t.Te.ie = undefined;
412
- t.U.clear();
413
- t.W[0].length = 0;
414
- t.W[1].length = 0;
415
- activeLanes.delete(t);
416
- signalLanes.delete(t.Te);
417
- }
467
+ commitPendingNodes();
468
+ resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
469
+ e ? e.Z : globalQueue.Z;
470
+ cleanupCompletedLanes(e);
418
471
  }
419
472
  }
420
473
  function checkBoundaryChildren(e) {
421
- for (const t of e.M) {
474
+ for (const t of e.re) {
422
475
  t.checkSources?.();
423
476
  checkBoundaryChildren(t);
424
477
  }
425
478
  }
426
479
  function reassignPendingTransition(e) {
427
480
  for (let t = 0; t < e.length; t++) {
428
- e[t].ne = activeTransition;
481
+ e[t].K = activeTransition;
429
482
  }
430
483
  }
431
484
  const globalQueue = new GlobalQueue();
432
485
  function flush() {
433
- while (scheduled) {
486
+ if (globalQueue.ne) {
487
+ return;
488
+ }
489
+ while (scheduled || activeTransition) {
434
490
  globalQueue.flush();
435
491
  }
436
492
  }
@@ -438,21 +494,30 @@ function runQueue(e, t) {
438
494
  for (let n = 0; n < e.length; n++) e[n](t);
439
495
  }
440
496
  function transitionComplete(e) {
441
- if (e.te) return true;
442
- if (e.ee.length) return false;
497
+ if (e.$) return true;
498
+ if (e.j.length) return false;
443
499
  let t = true;
444
- for (let n = 0; n < e.q.length; n++) {
445
- const i = e.q[n];
446
- if (i.Ee & STATUS_PENDING && i.X?.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) {
447
503
  t = false;
448
504
  break;
449
505
  }
450
506
  }
451
- 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);
452
517
  return t;
453
518
  }
454
519
  function currentTransition(e) {
455
- while (e.te && typeof e.te === "object") e = e.te;
520
+ while (e.$ && typeof e.$ === "object") e = e.$;
456
521
  return e;
457
522
  }
458
523
  function runInTransition(e, t) {
@@ -471,111 +536,203 @@ function getOrCreateLane(e) {
471
536
  if (t) {
472
537
  return findLane(t);
473
538
  }
474
- const n = e.de;
475
- const i = n?.ie ? findLane(n.ie) : null;
539
+ const n = e.Re;
540
+ const i = n?.q ? findLane(n.q) : null;
476
541
  t = {
477
- Te: e,
478
- U: new Set(),
479
- W: [[], []],
480
- k: null,
481
- ne: activeTransition,
482
- Se: i
542
+ te: e,
543
+ k: new Set(),
544
+ G: [[], []],
545
+ U: null,
546
+ K: activeTransition,
547
+ Oe: i
483
548
  };
484
549
  signalLanes.set(e, t);
485
550
  activeLanes.add(t);
486
- e.Re = e.Oe || 0;
551
+ e._e = false;
487
552
  return t;
488
553
  }
489
554
  function findLane(e) {
490
- while (e.k) e = e.k;
555
+ while (e.U) e = e.U;
491
556
  return e;
492
557
  }
493
558
  function mergeLanes(e, t) {
494
559
  e = findLane(e);
495
560
  t = findLane(t);
496
561
  if (e === t) return e;
497
- t.k = e;
498
- for (const n of t.U) e.U.add(n);
499
- e.W[0].push(...t.W[0]);
500
- 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]);
501
566
  return e;
502
567
  }
503
568
  function resolveLane(e) {
504
- const t = e.ie;
569
+ const t = e.q;
505
570
  if (!t) return undefined;
506
571
  const n = findLane(t);
507
572
  if (activeLanes.has(n)) return n;
508
- e.ie = undefined;
573
+ e.q = undefined;
509
574
  return undefined;
510
575
  }
576
+ function resolveTransition(e) {
577
+ return resolveLane(e)?.K ?? e.K;
578
+ }
511
579
  function hasActiveOverride(e) {
512
- return !!(e._e && e.ae !== NOT_PENDING);
580
+ return !!(e.ee !== undefined && e.ee !== NOT_PENDING);
513
581
  }
514
582
  function assignOrMergeLane(e, t) {
515
583
  const n = findLane(t);
516
- const i = e.ie;
584
+ const i = e.q;
517
585
  if (i) {
518
- if (i.k) {
519
- e.ie = t;
586
+ if (i.U) {
587
+ e.q = t;
520
588
  return;
521
589
  }
522
590
  const r = findLane(i);
523
591
  if (activeLanes.has(r)) {
524
592
  if (r !== n && !hasActiveOverride(e)) {
525
- if (n.Se && findLane(n.Se) === r) {
526
- e.ie = t;
527
- } else if (r.Se && findLane(r.Se) === 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);
528
596
  }
529
597
  return;
530
598
  }
531
599
  }
532
- 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();
533
691
  }
534
692
  function handleAsync(e, t, n) {
535
693
  const i = typeof t === "object" && t !== null;
536
694
  const r = i && untrack(() => t[Symbol.asyncIterator]);
537
695
  const s = !r && i && untrack(() => typeof t.then === "function");
538
696
  if (!s && !r) {
539
- e.Ie = null;
697
+ e.Ae = null;
540
698
  return t;
541
699
  }
542
- e.Ie = t;
700
+ e.Ae = t;
543
701
  let o;
544
702
  const handleError = n => {
545
- if (e.Ie !== t) return;
546
- globalQueue.initTransition(e.ne);
703
+ if (e.Ae !== t) return;
704
+ globalQueue.initTransition(resolveTransition(e));
547
705
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
548
- e.J = clock;
706
+ e.Ee = clock;
549
707
  };
550
708
  const asyncWrite = (i, r) => {
551
- if (e.Ie !== t) return;
709
+ if (e.Ae !== t) return;
552
710
  if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
553
- globalQueue.initTransition(e.ne);
711
+ globalQueue.initTransition(resolveTransition(e));
554
712
  clearStatus(e);
555
713
  const s = resolveLane(e);
556
- if (s) s.U.delete(e);
557
- if (e._e) {
558
- const t = e.ae !== NOT_PENDING;
559
- if (e.L) e.ae = i;
560
- if (!t) {
561
- e.fe = i;
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;
562
718
  insertSubs(e);
563
719
  }
564
- e.J = clock;
720
+ e.Ee = clock;
565
721
  } else if (s) {
566
- const t = e.fe;
567
- const n = e.pe;
722
+ const t = e.J;
723
+ const n = e.Ne;
568
724
  if (!n || !n(i, t)) {
569
- e.fe = i;
570
- e.J = clock;
571
- if (e.he) {
572
- setSignal(e.he, i);
725
+ e.J = i;
726
+ e.Ee = clock;
727
+ if (e.Pe) {
728
+ setSignal(e.Pe, i);
573
729
  }
574
730
  insertSubs(e, true);
575
731
  }
576
732
  } else {
577
733
  setSignal(e, () => i);
578
734
  }
735
+ settlePendingSource(e);
579
736
  schedule();
580
737
  flush();
581
738
  r?.();
@@ -593,7 +750,7 @@ function handleAsync(e, t, n) {
593
750
  });
594
751
  i = false;
595
752
  if (!n) {
596
- globalQueue.initTransition(e.ne);
753
+ globalQueue.initTransition(resolveTransition(e));
597
754
  throw new NotReadyError(context);
598
755
  }
599
756
  }
@@ -625,75 +782,126 @@ function handleAsync(e, t, n) {
625
782
  };
626
783
  const r = iterate();
627
784
  if (!i && !r) {
628
- globalQueue.initTransition(e.ne);
785
+ globalQueue.initTransition(resolveTransition(e));
629
786
  throw new NotReadyError(context);
630
787
  }
631
788
  }
632
789
  return o;
633
790
  }
634
- function clearStatus(e) {
635
- e.Ee = e.Ee & STATUS_UNINITIALIZED;
636
- e.X = 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);
637
796
  updatePendingSignal(e);
638
- e.Ae?.();
797
+ e.ge?.();
639
798
  }
640
799
  function notifyStatus(e, t, n, i, r) {
641
800
  if (t === STATUS_ERROR && !(n instanceof StatusError) && !(n instanceof NotReadyError)) n = new StatusError(e, n);
642
- const s = n instanceof NotReadyError && n.source === e;
643
- const o = t === STATUS_PENDING && e._e && !s;
644
- const u = o && 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);
645
805
  if (!i) {
646
- e.Ee = t | (t !== STATUS_ERROR ? e.Ee & STATUS_UNINITIALIZED : 0);
647
- e.X = 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
+ }
648
815
  updatePendingSignal(e);
649
816
  }
650
817
  if (r && !i) {
651
818
  assignOrMergeLane(e, r);
652
819
  }
653
- if (u && activeTransition && n instanceof NotReadyError) {
654
- const e = n.source;
655
- if (!activeTransition.q.includes(e)) {
656
- activeTransition.q.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;
657
825
  }
658
- }
659
- const c = i || u;
660
- const l = i || o ? undefined : r;
661
- if (e.Ae) {
662
- if (c) {
663
- e.Ae(t, n);
826
+ if (a) {
827
+ e.ge(t, n);
664
828
  } else {
665
- e.Ae();
829
+ e.ge();
666
830
  }
667
831
  return;
668
832
  }
669
- for (let i = e.I; i !== null; i = i.p) {
670
- i.h.J = clock;
671
- if (i.h.X !== n) {
672
- !i.h.ne && globalQueue.F.push(i.h);
673
- notifyStatus(i.h, t, n, c, l);
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);
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);
674
849
  }
850
+ markDisposal(t);
851
+ t = t.De;
675
852
  }
676
- for (let i = e.A; i !== null; i = i.P) {
677
- for (let e = i.I; e !== null; e = e.p) {
678
- e.h.J = clock;
679
- if (e.h.X !== n) {
680
- !e.h.ne && globalQueue.F.push(e.h);
681
- notifyStatus(e.h, t, n, c, l);
682
- }
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);
683
888
  }
889
+ } else {
890
+ n.call(n);
684
891
  }
892
+ t ? e.we = null : e.be = null;
685
893
  }
686
894
  function unlinkSubs(e) {
687
- const t = e.V;
895
+ const t = e.m;
688
896
  const n = e.D;
689
897
  const i = e.p;
690
- const r = e.Pe;
691
- if (i !== null) i.Pe = r;else t.Ne = r;
898
+ const r = e.Ue;
899
+ if (i !== null) i.Ue = r;else t.ke = r;
692
900
  if (r !== null) r.p = i;else {
693
901
  t.I = i;
694
902
  if (i === null) {
695
- t.ge?.();
696
- t.L && !t.Ce && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
903
+ t.Ge?.();
904
+ t.L && !t.xe && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
697
905
  }
698
906
  }
699
907
  return n;
@@ -709,23 +917,23 @@ function unobserved(e) {
709
917
  }
710
918
  function link(e, t) {
711
919
  const n = t.ye;
712
- if (n !== null && n.V === e) return;
920
+ if (n !== null && n.m === e) return;
713
921
  let i = null;
714
922
  const r = t.O & REACTIVE_RECOMPUTING_DEPS;
715
923
  if (r) {
716
924
  i = n !== null ? n.D : t.C;
717
- if (i !== null && i.V === e) {
925
+ if (i !== null && i.m === e) {
718
926
  t.ye = i;
719
927
  return;
720
928
  }
721
929
  }
722
- const s = e.Ne;
930
+ const s = e.ke;
723
931
  if (s !== null && s.h === t && (!r || isValidLink(s, t))) return;
724
- const o = t.ye = e.Ne = {
725
- V: e,
932
+ const o = t.ye = e.ke = {
933
+ m: e,
726
934
  h: t,
727
935
  D: i,
728
- Pe: s,
936
+ Ue: s,
729
937
  p: null
730
938
  };
731
939
  if (n !== null) n.D = o;else t.C = o;
@@ -743,91 +951,38 @@ function isValidLink(e, t) {
743
951
  }
744
952
  return false;
745
953
  }
746
- function markDisposal(e) {
747
- let t = e.De;
748
- while (t) {
749
- t.O |= REACTIVE_ZOMBIE;
750
- if (t.O & REACTIVE_IN_HEAP) {
751
- deleteFromHeap(t, dirtyQueue);
752
- insertIntoHeap(t, zombieQueue);
753
- }
754
- markDisposal(t);
755
- t = t.ve;
756
- }
757
- }
758
- function disposeChildren(e, t = false, n) {
759
- if (e.O & REACTIVE_DISPOSED) return;
760
- if (t) e.O = REACTIVE_DISPOSED;
761
- let i = n ? e.be : e.De;
762
- while (i) {
763
- const e = i.ve;
764
- if (i.C) {
765
- const e = i;
766
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
767
- let t = e.C;
768
- do {
769
- t = unlinkSubs(t);
770
- } while (t !== null);
771
- e.C = null;
772
- e.ye = null;
773
- }
774
- disposeChildren(i, true);
775
- i = e;
776
- }
777
- if (n) {
778
- e.be = null;
779
- } else {
780
- e.De = null;
781
- e.ve = null;
782
- e.we = 0;
783
- }
784
- runDisposal(e, n);
785
- }
786
- function runDisposal(e, t) {
787
- let n = t ? e.Ve : e.me;
788
- if (!n) return;
789
- if (Array.isArray(n)) {
790
- for (let e = 0; e < n.length; e++) {
791
- const t = n[e];
792
- t.call(t);
793
- }
794
- } else {
795
- n.call(n);
796
- }
797
- t ? e.Ve = null : e.me = null;
798
- }
799
- GlobalQueue.K = recompute;
800
- GlobalQueue.Y = disposeChildren;
954
+ GlobalQueue.oe = recompute;
955
+ GlobalQueue.ue = disposeChildren;
801
956
  let tracking = false;
802
957
  let stale = false;
803
958
  let context = null;
804
959
  let currentOptimisticLane = null;
805
960
  function recompute(e, t = false) {
806
- const n = e.oe;
961
+ const n = e.W;
807
962
  if (!t) {
808
- 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);
809
964
  deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
810
- if (e.ne || n === EFFECT_TRACKED) disposeChildren(e);else {
965
+ if (e.K || n === EFFECT_TRACKED) disposeChildren(e);else {
811
966
  markDisposal(e);
812
- e.Ve = e.me;
813
- e.be = e.De;
814
- e.me = null;
815
- e.De = null;
816
- 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;
817
972
  }
818
973
  }
819
974
  const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
820
- const r = hasActiveOverride(e);
821
- const s = !!(e.Ee & STATUS_PENDING);
975
+ const r = e.ee !== undefined && e.ee !== NOT_PENDING;
976
+ const s = !!(e.Se & STATUS_PENDING);
822
977
  const o = context;
823
978
  context = e;
824
979
  e.ye = null;
825
980
  e.O = REACTIVE_RECOMPUTING_DEPS;
826
- e.J = clock;
827
- let u = e.ae === NOT_PENDING ? e.fe : e.ae;
981
+ e.Ee = clock;
982
+ let u = e.X === NOT_PENDING ? e.J : e.X;
828
983
  let c = e.o;
829
- let l = tracking;
830
- let a = currentOptimisticLane;
984
+ let a = tracking;
985
+ let f = currentOptimisticLane;
831
986
  tracking = true;
832
987
  if (i) {
833
988
  const t = resolveLane(e);
@@ -835,66 +990,67 @@ function recompute(e, t = false) {
835
990
  }
836
991
  try {
837
992
  u = handleAsync(e, e.L(u));
838
- clearStatus(e);
839
- const t = resolveLane(e);
840
- if (t) {
841
- t.U.delete(e);
842
- updatePendingSignal(t.Te);
993
+ clearStatus(e, t);
994
+ const n = resolveLane(e);
995
+ if (n) {
996
+ n.k.delete(e);
997
+ updatePendingSignal(n.te);
843
998
  }
844
999
  } catch (t) {
845
1000
  if (t instanceof NotReadyError && currentOptimisticLane) {
846
1001
  const t = findLane(currentOptimisticLane);
847
- if (t.Te !== e) {
848
- t.U.add(e);
849
- e.ie = t;
850
- updatePendingSignal(t.Te);
1002
+ if (t.te !== e) {
1003
+ t.k.add(e);
1004
+ e.q = t;
1005
+ updatePendingSignal(t.te);
851
1006
  }
852
1007
  }
853
- 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);
854
1010
  } finally {
855
- tracking = l;
1011
+ tracking = a;
856
1012
  e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
857
1013
  context = o;
858
1014
  }
859
- if (!e.X) {
1015
+ if (!e.le) {
860
1016
  const o = e.ye;
861
- let l = o !== null ? o.D : e.C;
862
- if (l !== null) {
1017
+ let a = o !== null ? o.D : e.C;
1018
+ if (a !== null) {
863
1019
  do {
864
- l = unlinkSubs(l);
865
- } while (l !== null);
1020
+ a = unlinkSubs(a);
1021
+ } while (a !== null);
866
1022
  if (o !== null) o.D = null;else e.C = null;
867
1023
  }
868
- const a = r ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
869
- const f = !e.pe || !e.pe(a, u);
870
- if (f) {
871
- const o = r ? e.fe : undefined;
872
- if (t || n && activeTransition !== e.ne || i) e.fe = u;else e.ae = u;
873
- if (r && !i && s) {
874
- const t = e.Oe || 0;
875
- const n = e.Re || 0;
876
- if (t <= n) e.fe = u;
877
- }
878
- if (!r || i || e.fe !== o) {
879
- insertSubs(e, i || r);
880
- }
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;
1030
+ if (r && i) {
1031
+ e.ee = u;
1032
+ e.X = u;
1033
+ }
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);
881
1037
  } else if (r) {
882
- e.ae = u;
1038
+ e.X = u;
883
1039
  } else if (e.o != c) {
884
1040
  for (let t = e.I; t !== null; t = t.p) {
885
1041
  insertIntoHeapHeight(t.h, t.h.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
886
1042
  }
887
1043
  }
888
1044
  }
889
- currentOptimisticLane = a;
890
- (!t || e.Ee & STATUS_PENDING) && !e.ne && !(activeTransition && e._e) && globalQueue.F.push(e);
891
- 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));
892
1048
  }
893
1049
  function updateIfNecessary(e) {
894
1050
  if (e.O & REACTIVE_CHECK) {
895
1051
  for (let t = e.C; t; t = t.D) {
896
- const n = t.V;
897
- const i = n.m || n;
1052
+ const n = t.m;
1053
+ const i = n.V || n;
898
1054
  if (i.L) {
899
1055
  updateIfNecessary(i);
900
1056
  }
@@ -903,7 +1059,7 @@ function updateIfNecessary(e) {
903
1059
  }
904
1060
  }
905
1061
  }
906
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.X && e.J < clock && !e.Ie) {
1062
+ if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || e.le && e.Ee < clock && !e.Ae) {
907
1063
  recompute(e);
908
1064
  }
909
1065
  e.O = REACTIVE_NONE | e.O & REACTIVE_SNAPSHOT_STALE;
@@ -912,16 +1068,16 @@ function computed(e, t, n) {
912
1068
  const i = n?.transparent;
913
1069
  const r = {
914
1070
  id: n?.id ?? (context?.id ),
915
- Le: i,
916
- pe: n?.equals != null ? n.equals : isEqual,
917
- Ge: !!n?.pureWrite,
918
- ge: n?.unobserved,
919
- me: null,
920
- ce: context?.ce ?? globalQueue,
921
- ke: context?.ke ?? defaultContext,
922
- we: 0,
1071
+ Ve: i,
1072
+ Ne: n?.equals != null ? n.equals : isEqual,
1073
+ fe: !!n?.pureWrite,
1074
+ Ge: n?.unobserved,
1075
+ be: null,
1076
+ F: context?.F ?? globalQueue,
1077
+ Le: context?.Le ?? defaultContext,
1078
+ ve: 0,
923
1079
  L: e,
924
- fe: t,
1080
+ J: t,
925
1081
  o: 0,
926
1082
  A: null,
927
1083
  S: undefined,
@@ -929,28 +1085,28 @@ function computed(e, t, n) {
929
1085
  C: null,
930
1086
  ye: null,
931
1087
  I: null,
932
- Ne: null,
1088
+ ke: null,
933
1089
  i: context,
934
- ve: null,
935
1090
  De: null,
1091
+ Ce: null,
936
1092
  O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
937
- Ee: STATUS_UNINITIALIZED,
938
- J: clock,
939
- ae: NOT_PENDING,
940
- Ve: null,
941
- be: null,
942
- Ie: null,
943
- 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
944
1100
  };
945
1101
  r.T = r;
946
1102
  const s = context?.t ? context.u : context;
947
1103
  if (context) {
948
- const e = context.De;
1104
+ const e = context.Ce;
949
1105
  if (e === null) {
950
- context.De = r;
1106
+ context.Ce = r;
951
1107
  } else {
952
- r.ve = e;
953
- context.De = r;
1108
+ r.De = e;
1109
+ context.Ce = r;
954
1110
  }
955
1111
  }
956
1112
  if (s) r.o = s.o + 1;
@@ -965,6 +1121,7 @@ function untrack(e, t) {
965
1121
  const n = tracking;
966
1122
  tracking = false;
967
1123
  try {
1124
+ if (externalSourceConfig) ;
968
1125
  return e();
969
1126
  } finally {
970
1127
  tracking = n;
@@ -977,13 +1134,13 @@ function read(e) {
977
1134
  e.O &= ~REACTIVE_LAZY;
978
1135
  recompute(e, true);
979
1136
  }
980
- const n = e.m || e;
1137
+ const n = e.V || e;
981
1138
  if (t && tracking) {
982
1139
  if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
983
1140
  link(e, t);
984
1141
  if (n.L) {
985
1142
  const i = e.O & REACTIVE_ZOMBIE;
986
- if (n.o >= (i ? zombieQueue.N : dirtyQueue.N)) {
1143
+ if (n.o >= (i ? zombieQueue.P : dirtyQueue.P)) {
987
1144
  markNode(t);
988
1145
  markHeap(i ? zombieQueue : dirtyQueue);
989
1146
  updateIfNecessary(n);
@@ -994,106 +1151,121 @@ function read(e) {
994
1151
  }
995
1152
  }
996
1153
  }
997
- if (n.Ee & STATUS_PENDING) {
1154
+ if (n.Se & STATUS_PENDING) {
998
1155
  if (t && true) {
999
1156
  if (currentOptimisticLane) {
1000
- const i = n.ie;
1157
+ const i = n.q;
1001
1158
  const r = findLane(currentOptimisticLane);
1002
1159
  if (i && findLane(i) === r && !hasActiveOverride(n)) {
1003
- if (!tracking) link(e, t);
1004
- throw n.X;
1160
+ if (!tracking && e !== t) link(e, t);
1161
+ throw n.le;
1005
1162
  }
1006
1163
  } else {
1007
- if (!tracking) link(e, t);
1008
- throw n.X;
1164
+ if (!tracking && e !== t) link(e, t);
1165
+ throw n.le;
1009
1166
  }
1010
- } else if (!t && n.Ee & STATUS_UNINITIALIZED) {
1011
- throw n.X;
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;
1012
1172
  }
1013
1173
  }
1014
- if (e.L && e.Ee & STATUS_ERROR) {
1015
- if (e.J < clock) {
1174
+ if (e.L && e.Se & STATUS_ERROR) {
1175
+ if (e.Ee < clock) {
1016
1176
  recompute(e, true);
1017
1177
  return read(e);
1018
- } else throw e.X;
1178
+ } else throw e.le;
1179
+ }
1180
+ if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1181
+ return e.ee;
1019
1182
  }
1020
- return !t || currentOptimisticLane !== null && (e._e || e.ie || n === e || !!(n.Ee & STATUS_PENDING)) || e.ae === NOT_PENDING || stale ? e.fe : e.ae;
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;
1021
1184
  }
1022
1185
  function setSignal(e, t) {
1023
- if (e.ne && activeTransition !== e.ne) globalQueue.initTransition(e.ne);
1024
- const n = e._e && true;
1025
- const i = n ? e.fe : e.ae === NOT_PENDING ? e.fe : e.ae;
1026
- if (typeof t === "function") t = t(i);
1027
- const r = !e.pe || !e.pe(i, t) || !!(e.Ee & STATUS_UNINITIALIZED);
1028
- if (!r) {
1029
- if (n && e.ae !== NOT_PENDING && e.L) {
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;
1190
+ if (typeof t === "function") t = t(r);
1191
+ const s = !e.Ne || !e.Ne(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1192
+ if (!s) {
1193
+ if (n && i && e.L) {
1030
1194
  insertSubs(e, true);
1031
1195
  schedule();
1032
1196
  }
1033
1197
  return t;
1034
1198
  }
1035
1199
  if (n) {
1036
- const n = globalQueue.$.includes(e);
1037
- if (e.ne && n) {
1038
- globalQueue.initTransition(e.ne);
1039
- }
1040
- if (e.ae === NOT_PENDING) {
1041
- e.ae = e.fe;
1042
- }
1043
- if (!n) {
1044
- globalQueue.$.push(e);
1200
+ const n = e.ee === NOT_PENDING;
1201
+ if (!n) globalQueue.initTransition(resolveTransition(e));
1202
+ if (n) {
1203
+ e.X = e.J;
1204
+ globalQueue.Y.push(e);
1045
1205
  }
1046
- e.Oe = (e.Oe || 0) + 1;
1206
+ e._e = true;
1047
1207
  const i = getOrCreateLane(e);
1048
- e.ie = i;
1049
- e.fe = t;
1208
+ e.q = i;
1209
+ e.ee = t;
1050
1210
  } else {
1051
- if (e.ae === NOT_PENDING) globalQueue.F.push(e);
1052
- e.ae = t;
1211
+ if (e.X === NOT_PENDING) globalQueue.se.push(e);
1212
+ e.X = t;
1053
1213
  }
1054
1214
  updatePendingSignal(e);
1055
- if (e.he) {
1056
- setSignal(e.he, t);
1215
+ if (e.Pe) {
1216
+ setSignal(e.Pe, t);
1057
1217
  }
1058
- e.J = clock;
1218
+ e.Ee = clock;
1059
1219
  insertSubs(e, n);
1060
1220
  schedule();
1061
1221
  return t;
1062
1222
  }
1063
1223
  function computePendingState(e) {
1064
1224
  const t = e;
1065
- if (e._e && e.ae !== NOT_PENDING) {
1066
- if (t.Ee & STATUS_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1067
- if (e.de) {
1068
- const t = e.ie ? findLane(e.ie) : null;
1069
- 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);
1070
1234
  }
1071
1235
  return true;
1072
1236
  }
1073
- if (e.ae !== NOT_PENDING && !(t.Ee & STATUS_UNINITIALIZED)) return true;
1074
- 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));
1075
1242
  }
1076
1243
  function updatePendingSignal(e) {
1077
- if (e.Me) {
1244
+ if (e.Qe) {
1078
1245
  const t = computePendingState(e);
1079
- const n = e.Me;
1246
+ const n = e.Qe;
1080
1247
  setSignal(n, t);
1081
- if (!t && n.ie) {
1248
+ if (!t && n.q) {
1082
1249
  const t = resolveLane(e);
1083
- if (t && t.U.size > 0) {
1084
- const e = findLane(n.ie);
1250
+ if (t && t.k.size > 0) {
1251
+ const e = findLane(n.q);
1085
1252
  if (e !== t) {
1086
1253
  mergeLanes(t, e);
1087
1254
  }
1088
1255
  }
1089
1256
  signalLanes.delete(n);
1090
- n.ie = undefined;
1257
+ n.q = undefined;
1091
1258
  }
1092
1259
  }
1093
1260
  }
1261
+ function accessor(e) {
1262
+ const t = read.bind(null, e);
1263
+ t.$r = true;
1264
+ return t;
1265
+ }
1094
1266
  function createMemo(e, t, n) {
1095
1267
  let i = computed(e, t, n);
1096
- return read.bind(null, i);
1268
+ return accessor(i);
1097
1269
  }
1098
1270
  function isWrappable(e) {
1099
1271
  return e != null && typeof e === "object" && !Object.isFrozen(e);