@solidjs/signals 0.4.3 → 0.4.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/node.cjs CHANGED
@@ -47,7 +47,7 @@ function schedule() {
47
47
  if (scheduled)
48
48
  return;
49
49
  scheduled = true;
50
- if (!globalQueue.x)
50
+ if (!globalQueue.z)
51
51
  queueMicrotask(flush);
52
52
  }
53
53
  function notifyUnobserved() {
@@ -55,23 +55,23 @@ function notifyUnobserved() {
55
55
  for (let i = 0; i < unobserved.length; i++) {
56
56
  const source = unobserved[i];
57
57
  if (!source.d || !source.d.length)
58
- (_b = (_a = unobserved[i]).ca) == null ? void 0 : _b.call(_a);
58
+ (_b = (_a = unobserved[i]).da) == null ? void 0 : _b.call(_a);
59
59
  }
60
60
  unobserved = [];
61
61
  }
62
62
  var pureQueue = [];
63
63
  var Queue = class {
64
- p = null;
65
- x = false;
66
- o = [[], []];
67
- q = [];
64
+ m = null;
65
+ z = false;
66
+ f = [[], []];
67
+ e = [];
68
68
  created = clock;
69
69
  enqueue(type, fn) {
70
- if (ActiveTransition)
71
- return ActiveTransition.enqueue(type, fn);
70
+ if (ActiveTransition && ActiveTransition.w.has(this))
71
+ return ActiveTransition.w.get(this).enqueue(type, fn);
72
72
  pureQueue.push(fn);
73
73
  if (type)
74
- this.o[type - 1].push(fn);
74
+ this.f[type - 1].push(fn);
75
75
  schedule();
76
76
  }
77
77
  run(type) {
@@ -79,19 +79,19 @@ var Queue = class {
79
79
  pureQueue.length && runQueue(pureQueue, type);
80
80
  pureQueue = [];
81
81
  return;
82
- } else if (this.o[type - 1].length) {
83
- const effects = this.o[type - 1];
84
- this.o[type - 1] = [];
82
+ } else if (this.f[type - 1].length) {
83
+ const effects = this.f[type - 1];
84
+ this.f[type - 1] = [];
85
85
  runQueue(effects, type);
86
86
  }
87
- for (let i = 0; i < this.q.length; i++) {
88
- this.q[i].run(type);
87
+ for (let i = 0; i < this.e.length; i++) {
88
+ this.e[i].run(type);
89
89
  }
90
90
  }
91
91
  flush() {
92
- if (this.x)
92
+ if (this.z)
93
93
  return;
94
- this.x = true;
94
+ this.z = true;
95
95
  try {
96
96
  this.run(EFFECT_PURE);
97
97
  incrementClock();
@@ -99,24 +99,37 @@ var Queue = class {
99
99
  this.run(EFFECT_RENDER);
100
100
  this.run(EFFECT_USER);
101
101
  } finally {
102
- this.x = false;
102
+ this.z = false;
103
103
  unobserved.length && notifyUnobserved();
104
104
  }
105
105
  }
106
106
  addChild(child) {
107
- this.q.push(child);
108
- child.p = this;
107
+ this.e.push(child);
108
+ child.m = this;
109
109
  }
110
110
  removeChild(child) {
111
- const index = this.q.indexOf(child);
111
+ const index = this.e.indexOf(child);
112
112
  if (index >= 0)
113
- this.q.splice(index, 1);
113
+ this.e.splice(index, 1);
114
114
  }
115
115
  notify(...args) {
116
- if (this.p)
117
- return this.p.notify(...args);
116
+ if (ActiveTransition && ActiveTransition.w.has(this))
117
+ return ActiveTransition.w.get(this).notify(...args);
118
+ if (this.m)
119
+ return this.m.notify(...args);
118
120
  return false;
119
121
  }
122
+ merge(queue) {
123
+ this.f[0].push.apply(this.f[0], queue.f[0]);
124
+ this.f[1].push.apply(this.f[1], queue.f[1]);
125
+ for (let i = 0; i < queue.e.length; i++) {
126
+ const og = this.e.find((c) => c.j === queue.e[i].j);
127
+ if (og)
128
+ og.merge(queue.e[i]);
129
+ else
130
+ this.addChild(queue.e[i]);
131
+ }
132
+ }
120
133
  };
121
134
  var globalQueue = new Queue();
122
135
  function flush() {
@@ -131,61 +144,68 @@ function runQueue(queue, type) {
131
144
  var Transition = class _Transition {
132
145
  a = /* @__PURE__ */ new Map();
133
146
  t = /* @__PURE__ */ new Set();
134
- M = /* @__PURE__ */ new Set();
135
- T = /* @__PURE__ */ new Set();
136
- E = false;
137
- o = [[], []];
138
- F = [];
139
- q = [];
140
- p = null;
141
- x = false;
142
- U = false;
147
+ Q = /* @__PURE__ */ new Set();
148
+ W = /* @__PURE__ */ new Set();
149
+ I = false;
150
+ f = [[], []];
151
+ w = /* @__PURE__ */ new Map();
152
+ E = [];
153
+ e = [];
154
+ m = null;
155
+ z = false;
156
+ X = false;
143
157
  created = clock;
158
+ constructor() {
159
+ this.w.set(globalQueue, this);
160
+ for (const child of globalQueue.e) {
161
+ cloneQueue(child, this, this.w);
162
+ }
163
+ }
144
164
  enqueue(type, fn) {
145
- this.F.push(fn);
165
+ this.E.push(fn);
146
166
  if (type)
147
- this.o[type - 1].push(fn);
167
+ this.f[type - 1].push(fn);
148
168
  this.schedule();
149
169
  }
150
170
  run(type) {
151
171
  if (type === EFFECT_PURE) {
152
- this.F.length && runQueue(this.F, type);
153
- this.F = [];
172
+ this.E.length && runQueue(this.E, type);
173
+ this.E = [];
154
174
  return;
155
- } else if (this.o[type - 1].length) {
156
- const effects = this.o[type - 1];
157
- this.o[type - 1] = [];
175
+ } else if (this.f[type - 1].length) {
176
+ const effects = this.f[type - 1];
177
+ this.f[type - 1] = [];
158
178
  runQueue(effects, type);
159
179
  }
160
- for (let i = 0; i < this.q.length; i++) {
161
- this.q[i].run(type);
180
+ for (let i = 0; i < this.e.length; i++) {
181
+ this.e[i].run(type);
162
182
  }
163
183
  }
164
184
  flush() {
165
- if (this.x)
185
+ if (this.z)
166
186
  return;
167
- this.x = true;
187
+ this.z = true;
168
188
  let currentTransition = ActiveTransition;
169
189
  ActiveTransition = this;
170
190
  try {
171
191
  this.run(EFFECT_PURE);
172
192
  incrementClock();
173
- this.U = false;
193
+ this.X = false;
174
194
  ActiveTransition = currentTransition;
175
195
  finishTransition(this);
176
196
  } finally {
177
- this.x = false;
197
+ this.z = false;
178
198
  ActiveTransition = currentTransition;
179
199
  }
180
200
  }
181
201
  addChild(child) {
182
- this.q.push(child);
183
- child.p = this;
202
+ this.e.push(child);
203
+ child.m = this;
184
204
  }
185
205
  removeChild(child) {
186
- const index = this.q.indexOf(child);
206
+ const index = this.e.indexOf(child);
187
207
  if (index >= 0)
188
- this.q.splice(index, 1);
208
+ this.e.splice(index, 1);
189
209
  }
190
210
  notify(node, type, flags) {
191
211
  if (!(type & LOADING_BIT))
@@ -197,17 +217,29 @@ var Transition = class _Transition {
197
217
  }
198
218
  return true;
199
219
  }
220
+ merge(queue) {
221
+ this.f[0].push.apply(this.f[0], queue.f[0]);
222
+ this.f[1].push.apply(this.f[1], queue.f[1]);
223
+ this.E.push.apply(this.E, queue.E);
224
+ for (let i = 0; i < queue.e.length; i++) {
225
+ const og = this.e.find((c) => c.j === queue.e[i].j);
226
+ if (og)
227
+ og.merge(queue.e[i]);
228
+ else
229
+ this.addChild(queue.e[i]);
230
+ }
231
+ }
200
232
  schedule() {
201
- if (this.U)
233
+ if (this.X)
202
234
  return;
203
- this.U = true;
204
- if (!this.x)
235
+ this.X = true;
236
+ if (!this.z)
205
237
  queueMicrotask(() => this.flush());
206
238
  }
207
239
  runTransition(fn, force = false) {
208
- if (this.E) {
209
- if (this.E instanceof _Transition)
210
- return this.E.runTransition(fn, force);
240
+ if (this.I) {
241
+ if (this.I instanceof _Transition)
242
+ return this.I.runTransition(fn, force);
211
243
  if (!force)
212
244
  throw new Error("Transition already completed");
213
245
  fn();
@@ -218,9 +250,9 @@ var Transition = class _Transition {
218
250
  const result = fn();
219
251
  const transition2 = ActiveTransition;
220
252
  if (result instanceof Promise) {
221
- transition2.M.add(result);
253
+ transition2.Q.add(result);
222
254
  result.finally(() => {
223
- transition2.M.delete(result);
255
+ transition2.Q.delete(result);
224
256
  finishTransition(transition2);
225
257
  });
226
258
  }
@@ -231,33 +263,31 @@ var Transition = class _Transition {
231
263
  }
232
264
  }
233
265
  addOptimistic(fn) {
234
- if (fn.h && fn.h !== this) {
235
- mergeTransitions(fn.h, this);
236
- ActiveTransition = fn.h;
266
+ if (fn.k && fn.k !== this) {
267
+ mergeTransitions(fn.k, this);
268
+ ActiveTransition = fn.k;
237
269
  return;
238
270
  }
239
- fn.h = this;
240
- this.T.add(fn);
271
+ fn.k = this;
272
+ this.W.add(fn);
241
273
  }
242
274
  };
243
- var Transitions = /* @__PURE__ */ new Set();
244
275
  function transition(fn) {
245
276
  let t = new Transition();
246
- Transitions.add(t);
247
277
  queueMicrotask(() => t.runTransition(() => fn((fn2) => t.runTransition(fn2))));
248
278
  }
249
279
  function cloneGraph(node) {
250
- if (node.h) {
251
- if (node.h !== ActiveTransition) {
252
- mergeTransitions(node.h, ActiveTransition);
253
- ActiveTransition = node.h;
280
+ if (node.k) {
281
+ if (node.k !== ActiveTransition) {
282
+ mergeTransitions(node.k, ActiveTransition);
283
+ ActiveTransition = node.k;
254
284
  }
255
- return node.h.a.get(node);
285
+ return node.k.a.get(node);
256
286
  }
257
287
  const clone = Object.create(Object.getPrototypeOf(node));
258
- Object.assign(clone, node, { j: null, r: null, N: node });
288
+ Object.assign(clone, node, { n: null, s: null, j: node });
259
289
  ActiveTransition.a.set(node, clone);
260
- node.h = ActiveTransition;
290
+ node.k = ActiveTransition;
261
291
  if (node.d) {
262
292
  for (let i = 0, length = node.d.length; i < length; i++) {
263
293
  const o = node.d[i];
@@ -281,44 +311,84 @@ function removeSourceObservers(node, index) {
281
311
  }
282
312
  }
283
313
  }
314
+ function cloneQueue(queue, parent, clonedQueues) {
315
+ const clone = Object.create(Object.getPrototypeOf(queue));
316
+ Object.assign(clone, queue, {
317
+ j: queue,
318
+ m: parent,
319
+ e: [],
320
+ enqueue(type, fn) {
321
+ ActiveTransition == null ? void 0 : ActiveTransition.enqueue(type, fn);
322
+ },
323
+ notify(node, type, flags) {
324
+ node = node.j || node;
325
+ if (!clone.F || type & LOADING_BIT) {
326
+ type &= ~LOADING_BIT;
327
+ ActiveTransition == null ? void 0 : ActiveTransition.notify(node, LOADING_BIT, flags);
328
+ if (!type)
329
+ return true;
330
+ }
331
+ return queue.notify.call(this, node, type, flags);
332
+ }
333
+ });
334
+ parent.e.push(clone);
335
+ clonedQueues.set(queue, clone);
336
+ for (const child of queue.e) {
337
+ cloneQueue(child, clone, clonedQueues);
338
+ }
339
+ }
340
+ function resolveQueues(children) {
341
+ for (const child of children) {
342
+ const og = child.j;
343
+ if (og) {
344
+ const clonedChildren = child.e;
345
+ delete child.enqueue;
346
+ delete child.notify;
347
+ delete child.m;
348
+ delete child.e;
349
+ Object.assign(og, child);
350
+ delete og.j;
351
+ resolveQueues(clonedChildren);
352
+ } else if (child.m.j) {
353
+ child.m.j.addChild(child);
354
+ }
355
+ }
356
+ }
284
357
  function mergeTransitions(t1, t2) {
285
358
  t2.a.forEach((value, key) => {
286
- key.h = t1;
359
+ key.k = t1;
287
360
  t1.a.set(key, value);
288
361
  });
289
- t2.T.forEach((c) => {
290
- c.h = t1;
291
- t1.T.add(c);
362
+ t2.W.forEach((c) => {
363
+ c.k = t1;
364
+ t1.W.add(c);
292
365
  });
293
- t2.M.forEach((p) => t1.M.add(p));
366
+ t2.Q.forEach((p) => t1.Q.add(p));
294
367
  t2.t.forEach((n) => t1.t.add(n));
295
- t2.o[0].forEach((f) => t1.o[0].push(f));
296
- t2.o[1].forEach((f) => t1.o[1].push(f));
297
- t2.F.forEach((f) => t1.F.push(f));
298
- t2.q.forEach((c) => t1.addChild(c));
299
- t2.E = t1;
300
- Transitions.delete(t2);
368
+ t1.merge(t2);
369
+ t2.I = t1;
301
370
  }
302
371
  function finishTransition(transition2) {
303
- if (transition2.E || transition2.U || transition2.M.size || transition2.t.size)
372
+ if (transition2.I || transition2.X || transition2.Q.size || transition2.t.size)
304
373
  return;
305
374
  for (const [source, clone] of transition2.a) {
306
- if (source === clone || source.h !== transition2)
375
+ if (source === clone || source.k !== transition2)
307
376
  continue;
308
377
  if (clone.a)
309
378
  removeSourceObservers(clone, 0);
310
379
  source.dispose(false);
311
380
  source.emptyDisposal();
312
381
  Object.assign(source, clone);
313
- delete source.N;
314
- delete source.h;
315
- }
316
- transition2.E = true;
317
- Transitions.delete(transition2);
318
- transition2.run(EFFECT_RENDER);
319
- transition2.run(EFFECT_USER);
320
- for (const reset of transition2.T) {
321
- delete reset.h;
382
+ delete source.j;
383
+ delete source.k;
384
+ }
385
+ globalQueue.f[0].push.apply(globalQueue.f[0], transition2.f[0]);
386
+ globalQueue.f[1].push.apply(globalQueue.f[1], transition2.f[1]);
387
+ resolveQueues(transition2.e);
388
+ transition2.I = true;
389
+ globalQueue.flush();
390
+ for (const reset of transition2.W) {
391
+ delete reset.k;
322
392
  reset();
323
393
  }
324
394
  }
@@ -338,14 +408,14 @@ var Owner = class {
338
408
  // We flatten the owner tree into a linked list so that we don't need a pointer to .firstChild
339
409
  // However, the children are actually added in reverse creation order
340
410
  // See comment at the top of the file for an example of the _nextSibling traversal
341
- p = null;
342
- r = null;
343
- z = null;
411
+ m = null;
412
+ s = null;
413
+ B = null;
344
414
  b = STATE_CLEAN;
345
- j = null;
346
- u = defaultContext;
347
- i = globalQueue;
348
- da = 0;
415
+ n = null;
416
+ x = defaultContext;
417
+ l = globalQueue;
418
+ ea = 0;
349
419
  id = null;
350
420
  constructor(id = null, skipAppend = false) {
351
421
  this.id = id;
@@ -354,64 +424,64 @@ var Owner = class {
354
424
  }
355
425
  }
356
426
  append(child) {
357
- child.p = this;
358
- child.z = this;
359
- if (this.r)
360
- this.r.z = child;
361
- child.r = this.r;
362
- this.r = child;
427
+ child.m = this;
428
+ child.B = this;
429
+ if (this.s)
430
+ this.s.B = child;
431
+ child.s = this.s;
432
+ this.s = child;
363
433
  if (this.id != null && child.id == null)
364
434
  child.id = this.getNextChildId();
365
- if (child.u !== this.u) {
366
- child.u = { ...this.u, ...child.u };
435
+ if (child.x !== this.x) {
436
+ child.x = { ...this.x, ...child.x };
367
437
  }
368
- if (this.i)
369
- child.i = this.i;
438
+ if (this.l)
439
+ child.l = this.l;
370
440
  }
371
441
  dispose(self = true) {
372
442
  if (this.b === STATE_DISPOSED)
373
443
  return;
374
- let head = self ? this.z || this.p : this, current = this.r, next = null;
375
- while (current && current.p === this) {
444
+ let head = self ? this.B || this.m : this, current = this.s, next = null;
445
+ while (current && current.m === this) {
376
446
  current.dispose(true);
377
- current.G();
378
- next = current.r;
379
- current.r = null;
447
+ current.J();
448
+ next = current.s;
449
+ current.s = null;
380
450
  current = next;
381
451
  }
382
- this.da = 0;
452
+ this.ea = 0;
383
453
  if (self)
384
- this.G();
454
+ this.J();
385
455
  if (current)
386
- current.z = !self ? this : this.z;
456
+ current.B = !self ? this : this.B;
387
457
  if (head)
388
- head.r = current;
389
- }
390
- G() {
391
- if (this.z)
392
- this.z.r = null;
393
- this.p = null;
394
- this.z = null;
395
- this.u = defaultContext;
458
+ head.s = current;
459
+ }
460
+ J() {
461
+ if (this.B)
462
+ this.B.s = null;
463
+ this.m = null;
464
+ this.B = null;
465
+ this.x = defaultContext;
396
466
  this.b = STATE_DISPOSED;
397
467
  this.emptyDisposal();
398
468
  }
399
469
  emptyDisposal() {
400
- if (!this.j)
470
+ if (!this.n)
401
471
  return;
402
- if (Array.isArray(this.j)) {
403
- for (let i = 0; i < this.j.length; i++) {
404
- const callable = this.j[i];
472
+ if (Array.isArray(this.n)) {
473
+ for (let i = 0; i < this.n.length; i++) {
474
+ const callable = this.n[i];
405
475
  callable.call(callable);
406
476
  }
407
477
  } else {
408
- this.j.call(this.j);
478
+ this.n.call(this.n);
409
479
  }
410
- this.j = null;
480
+ this.n = null;
411
481
  }
412
482
  getNextChildId() {
413
483
  if (this.id != null)
414
- return formatId(this.id, this.da++);
484
+ return formatId(this.id, this.ea++);
415
485
  throw new Error("Cannot get child id from owner without an id");
416
486
  }
417
487
  };
@@ -422,7 +492,7 @@ function getContext(context, owner = currentOwner) {
422
492
  if (!owner) {
423
493
  throw new NoOwnerError();
424
494
  }
425
- const value = hasContext(context, owner) ? owner.u[context.id] : context.defaultValue;
495
+ const value = hasContext(context, owner) ? owner.x[context.id] : context.defaultValue;
426
496
  if (isUndefined(value)) {
427
497
  throw new ContextNotFoundError();
428
498
  }
@@ -432,24 +502,24 @@ function setContext(context, value, owner = currentOwner) {
432
502
  if (!owner) {
433
503
  throw new NoOwnerError();
434
504
  }
435
- owner.u = {
436
- ...owner.u,
505
+ owner.x = {
506
+ ...owner.x,
437
507
  [context.id]: isUndefined(value) ? context.defaultValue : value
438
508
  };
439
509
  }
440
510
  function hasContext(context, owner = currentOwner) {
441
- return !isUndefined(owner == null ? void 0 : owner.u[context.id]);
511
+ return !isUndefined(owner == null ? void 0 : owner.x[context.id]);
442
512
  }
443
513
  function onCleanup(fn) {
444
514
  if (!currentOwner)
445
515
  return fn;
446
516
  const node = currentOwner;
447
- if (!node.j) {
448
- node.j = fn;
449
- } else if (Array.isArray(node.j)) {
450
- node.j.push(fn);
517
+ if (!node.n) {
518
+ node.n = fn;
519
+ } else if (Array.isArray(node.n)) {
520
+ node.n.push(fn);
451
521
  } else {
452
- node.j = [node.j, fn];
522
+ node.n = [node.n, fn];
453
523
  }
454
524
  return fn;
455
525
  }
@@ -477,48 +547,48 @@ var UNCHANGED = Symbol(0);
477
547
  var Computation = class extends Owner {
478
548
  a = null;
479
549
  d = null;
480
- g;
481
- O;
482
- H;
550
+ i;
551
+ R;
552
+ K;
483
553
  // Used in __DEV__ mode, hopefully removed in production
484
- ja;
554
+ ka;
485
555
  // Using false is an optimization as an alternative to _equals: () => false
486
556
  // which could enable more efficient DIRTY notification
487
- _ = isEqual;
488
- ca;
489
- fa = false;
557
+ $ = isEqual;
558
+ da;
559
+ ga = false;
490
560
  /** Whether the computation is an error or has ancestors that are unresolved */
491
- f = 0;
561
+ h = 0;
492
562
  /** Which flags raised by sources are handled, vs. being passed through. */
493
- $ = DEFAULT_FLAGS;
494
- I = -1;
495
- C = false;
496
- h;
497
- N;
563
+ aa = DEFAULT_FLAGS;
564
+ L = -1;
565
+ G = false;
566
+ k;
567
+ j;
498
568
  constructor(initialValue, compute2, options) {
499
569
  super(options == null ? void 0 : options.id, compute2 === null);
500
- this.H = compute2;
570
+ this.K = compute2;
501
571
  this.b = compute2 ? STATE_DIRTY : STATE_CLEAN;
502
- this.f = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
503
- this.g = initialValue;
572
+ this.h = compute2 && initialValue === void 0 ? UNINITIALIZED_BIT : 0;
573
+ this.i = initialValue;
504
574
  if ((options == null ? void 0 : options.equals) !== void 0)
505
- this._ = options.equals;
575
+ this.$ = options.equals;
506
576
  if (options == null ? void 0 : options.pureWrite)
507
- this.fa = true;
577
+ this.ga = true;
508
578
  if (options == null ? void 0 : options.unobserved)
509
- this.ca = options == null ? void 0 : options.unobserved;
579
+ this.da = options == null ? void 0 : options.unobserved;
510
580
  if (ActiveTransition) {
511
- this.h = ActiveTransition;
581
+ this.k = ActiveTransition;
512
582
  ActiveTransition.a.set(this, this);
513
583
  }
514
584
  }
515
- ea() {
585
+ fa() {
516
586
  track(this);
517
- newFlags |= this.f & ~currentMask;
518
- if (this.f & ERROR_BIT) {
519
- throw this.O;
587
+ newFlags |= this.h & ~currentMask;
588
+ if (this.h & ERROR_BIT) {
589
+ throw this.R;
520
590
  } else {
521
- return this.g;
591
+ return this.i;
522
592
  }
523
593
  }
524
594
  /**
@@ -531,13 +601,13 @@ var Computation = class extends Owner {
531
601
  if (clone !== this)
532
602
  return clone.read();
533
603
  }
534
- if (this.H) {
535
- if (this.f & ERROR_BIT && this.I <= clock)
604
+ if (this.K) {
605
+ if (this.h & ERROR_BIT && this.L <= clock)
536
606
  update(this);
537
607
  else
538
- this.D();
608
+ this.H();
539
609
  }
540
- return this.ea();
610
+ return this.fa();
541
611
  }
542
612
  /**
543
613
  * Return the current value of this computation
@@ -552,64 +622,65 @@ var Computation = class extends Owner {
552
622
  if (clone !== this)
553
623
  return clone.wait();
554
624
  }
555
- if (this.H) {
556
- if (this.f & ERROR_BIT && this.I <= clock)
625
+ if (this.K) {
626
+ if (this.h & ERROR_BIT && this.L <= clock)
557
627
  update(this);
558
628
  else
559
- this.D();
629
+ this.H();
560
630
  }
561
- if ((notStale || this.f & UNINITIALIZED_BIT) && this.f & LOADING_BIT) {
631
+ if ((notStale || this.h & UNINITIALIZED_BIT) && this.h & LOADING_BIT) {
562
632
  track(this);
563
633
  throw new NotReadyError();
564
634
  }
565
- if (staleCheck && this.f & LOADING_BIT) {
566
- staleCheck.g = true;
635
+ if (staleCheck && this.h & LOADING_BIT) {
636
+ staleCheck.i = true;
567
637
  }
568
- return this.ea();
638
+ return this.fa();
569
639
  }
570
640
  /** Update the computation with a new value. */
571
641
  write(value, flags = 0, raw = false) {
572
- if (ActiveTransition && !this.N) {
642
+ if (ActiveTransition && !this.j) {
573
643
  const clone = cloneGraph(this);
574
- return clone.write(value, flags, raw);
644
+ if (clone !== this)
645
+ return clone.write(value, flags, raw);
575
646
  }
576
- const newValue = !raw && typeof value === "function" ? value(this.g) : value;
577
- const valueChanged = newValue !== UNCHANGED && (!!(this.f & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
578
- this._ === false || !this._(this.g, newValue));
647
+ const newValue = !raw && typeof value === "function" ? value(this.i) : value;
648
+ const valueChanged = newValue !== UNCHANGED && (!!(this.h & UNINITIALIZED_BIT) || // this._stateFlags & LOADING_BIT & ~flags ||
649
+ this.$ === false || !this.$(this.i, newValue));
579
650
  if (valueChanged) {
580
- this.g = newValue;
581
- this.O = void 0;
651
+ this.i = newValue;
652
+ this.R = void 0;
582
653
  }
583
- const changedFlagsMask = this.f ^ flags, changedFlags = changedFlagsMask & flags;
584
- this.f = flags;
585
- this.I = clock + 1;
654
+ const changedFlagsMask = this.h ^ flags, changedFlags = changedFlagsMask & flags;
655
+ this.h = flags;
656
+ this.L = clock + 1;
586
657
  if (this.d) {
587
658
  for (let i = 0; i < this.d.length; i++) {
588
659
  if (valueChanged) {
589
- this.d[i].k(STATE_DIRTY);
660
+ this.d[i].o(STATE_DIRTY);
590
661
  } else if (changedFlagsMask) {
591
- this.d[i].V(changedFlagsMask, changedFlags);
662
+ this.d[i].Y(changedFlagsMask, changedFlags);
592
663
  }
593
664
  }
594
665
  }
595
- return this.g;
666
+ return this.i;
596
667
  }
597
668
  /**
598
669
  * Set the current node's state, and recursively mark all of this node's observers as STATE_CHECK
599
670
  */
600
- k(state, skipQueue) {
671
+ o(state, skipQueue) {
601
672
  if (ActiveTransition && ActiveTransition.a.has(this)) {
602
673
  const clone = ActiveTransition.a.get(this);
603
674
  if (clone !== this)
604
- return clone.k(state, skipQueue);
675
+ return clone.o(state, skipQueue);
605
676
  }
606
- if (this.b >= state && !this.C)
677
+ if (this.b >= state && !this.G)
607
678
  return;
608
- this.C = !!skipQueue;
679
+ this.G = !!skipQueue;
609
680
  this.b = state;
610
681
  if (this.d) {
611
682
  for (let i = 0; i < this.d.length; i++) {
612
- this.d[i].k(STATE_CHECK, skipQueue);
683
+ this.d[i].o(STATE_CHECK, skipQueue);
613
684
  }
614
685
  }
615
686
  }
@@ -619,31 +690,36 @@ var Computation = class extends Owner {
619
690
  * @param mask A bitmask for which flag(s) were changed.
620
691
  * @param newFlags The source's new flags, masked to just the changed ones.
621
692
  */
622
- V(mask, newFlags2) {
693
+ Y(mask, newFlags2) {
623
694
  if (this.b >= STATE_DIRTY)
624
695
  return;
625
- if (mask & this.$) {
626
- this.k(STATE_DIRTY);
696
+ if (mask & this.aa) {
697
+ this.o(STATE_DIRTY);
627
698
  return;
628
699
  }
629
700
  if (this.b >= STATE_CHECK)
630
701
  return;
631
- const prevFlags = this.f & mask;
702
+ const prevFlags = this.h & mask;
632
703
  const deltaFlags = prevFlags ^ newFlags2;
633
704
  if (newFlags2 === prevFlags) ; else if (deltaFlags & prevFlags & mask) {
634
- this.k(STATE_CHECK);
705
+ this.o(STATE_CHECK);
635
706
  } else {
636
- this.f ^= deltaFlags;
707
+ this.h ^= deltaFlags;
637
708
  if (this.d) {
638
709
  for (let i = 0; i < this.d.length; i++) {
639
- this.d[i].V(mask, newFlags2);
710
+ this.d[i].Y(mask, newFlags2);
640
711
  }
641
712
  }
642
713
  }
643
714
  }
644
- P(error) {
645
- this.O = error;
646
- this.write(UNCHANGED, this.f & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
715
+ M(error) {
716
+ if (ActiveTransition && !this.j) {
717
+ const clone = cloneGraph(this);
718
+ if (clone !== this)
719
+ return clone.M(error);
720
+ }
721
+ this.R = error;
722
+ this.write(UNCHANGED, this.h & ~LOADING_BIT | ERROR_BIT | UNINITIALIZED_BIT);
647
723
  }
648
724
  /**
649
725
  * This is the core part of the reactivity system, which makes sure that the values are updated
@@ -652,8 +728,8 @@ var Computation = class extends Owner {
652
728
  *
653
729
  * This function will ensure that the value and states we read from the computation are up to date
654
730
  */
655
- D() {
656
- if (!this.H) {
731
+ H() {
732
+ if (!this.K) {
657
733
  return;
658
734
  }
659
735
  if (this.b === STATE_DISPOSED) {
@@ -666,8 +742,8 @@ var Computation = class extends Owner {
666
742
  if (this.b === STATE_CHECK) {
667
743
  for (let i = 0; i < this.a.length; i++) {
668
744
  const source = ActiveTransition && ActiveTransition.a.get(this.a[i]) || this.a[i];
669
- source.D();
670
- observerFlags |= source.f;
745
+ source.H();
746
+ observerFlags |= source.h;
671
747
  if (this.b === STATE_DIRTY) {
672
748
  break;
673
749
  }
@@ -683,17 +759,17 @@ var Computation = class extends Owner {
683
759
  /**
684
760
  * Remove ourselves from the owner graph and the computation graph
685
761
  */
686
- G() {
762
+ J() {
687
763
  if (this.b === STATE_DISPOSED)
688
764
  return;
689
765
  if (this.a)
690
766
  removeSourceObservers(this, 0);
691
- super.G();
767
+ super.J();
692
768
  }
693
769
  };
694
770
  function track(computation) {
695
- if (ActiveTransition && computation.N)
696
- computation = computation.N;
771
+ if (ActiveTransition && computation.j)
772
+ computation = computation.j;
697
773
  if (currentObserver) {
698
774
  if (!newSources && currentObserver.a && currentObserver.a[newSourcesIndex] === computation) {
699
775
  newSourcesIndex++;
@@ -703,7 +779,7 @@ function track(computation) {
703
779
  newSources.push(computation);
704
780
  }
705
781
  if (updateCheck) {
706
- updateCheck.g = computation.I > currentObserver.I;
782
+ updateCheck.i = computation.L > currentObserver.L;
707
783
  }
708
784
  }
709
785
  }
@@ -715,13 +791,13 @@ function update(node) {
715
791
  try {
716
792
  node.dispose(false);
717
793
  node.emptyDisposal();
718
- const result = compute(node, node.H, node);
794
+ const result = compute(node, node.K, node);
719
795
  node.write(result, newFlags, true);
720
796
  } catch (error) {
721
797
  if (error instanceof NotReadyError) {
722
- node.write(UNCHANGED, newFlags | LOADING_BIT | node.f & UNINITIALIZED_BIT);
798
+ node.write(UNCHANGED, newFlags | LOADING_BIT | node.h & UNINITIALIZED_BIT);
723
799
  } else {
724
- node.P(error);
800
+ node.M(error);
725
801
  }
726
802
  } finally {
727
803
  if (newSources) {
@@ -750,7 +826,7 @@ function update(node) {
750
826
  newSources = prevSources;
751
827
  newSourcesIndex = prevSourcesIndex;
752
828
  newFlags = prevFlags;
753
- node.I = clock + 1;
829
+ node.L = clock + 1;
754
830
  node.b = STATE_CLEAN;
755
831
  }
756
832
  }
@@ -764,20 +840,20 @@ function untrack(fn) {
764
840
  }
765
841
  function hasUpdated(fn) {
766
842
  const current = updateCheck;
767
- updateCheck = { g: false };
843
+ updateCheck = { i: false };
768
844
  try {
769
845
  fn();
770
- return updateCheck.g;
846
+ return updateCheck.i;
771
847
  } finally {
772
848
  updateCheck = current;
773
849
  }
774
850
  }
775
851
  function pendingCheck(fn, loadingValue) {
776
852
  const current = staleCheck;
777
- staleCheck = { g: false };
853
+ staleCheck = { i: false };
778
854
  try {
779
855
  latest(fn);
780
- return staleCheck.g;
856
+ return staleCheck.i;
781
857
  } catch (err) {
782
858
  if (!(err instanceof NotReadyError))
783
859
  return false;
@@ -792,7 +868,7 @@ function isPending(fn, loadingValue) {
792
868
  if (!currentObserver)
793
869
  return pendingCheck(fn, loadingValue);
794
870
  const c = new Computation(void 0, () => pendingCheck(fn, loadingValue));
795
- c.$ |= LOADING_BIT;
871
+ c.aa |= LOADING_BIT;
796
872
  return c.read();
797
873
  }
798
874
  function latest(fn, fallback) {
@@ -822,10 +898,10 @@ function runWithObserver(observer, run) {
822
898
  if (error instanceof NotReadyError) {
823
899
  observer.write(
824
900
  UNCHANGED,
825
- newFlags | LOADING_BIT | observer.f & UNINITIALIZED_BIT
901
+ newFlags | LOADING_BIT | observer.h & UNINITIALIZED_BIT
826
902
  );
827
903
  } else {
828
- observer.P(error);
904
+ observer.M(error);
829
905
  }
830
906
  } finally {
831
907
  if (newSources) {
@@ -854,10 +930,10 @@ function runWithObserver(observer, run) {
854
930
  function compute(owner, fn, observer) {
855
931
  const prevOwner = setOwner(owner), prevObserver = currentObserver, prevMask = currentMask, prevNotStale = notStale;
856
932
  currentObserver = observer;
857
- currentMask = (observer == null ? void 0 : observer.$) ?? DEFAULT_FLAGS;
933
+ currentMask = (observer == null ? void 0 : observer.aa) ?? DEFAULT_FLAGS;
858
934
  notStale = true;
859
935
  try {
860
- return fn(observer ? observer.g : void 0);
936
+ return fn(observer ? observer.i : void 0);
861
937
  } finally {
862
938
  setOwner(prevOwner);
863
939
  currentObserver = prevObserver;
@@ -868,100 +944,101 @@ function compute(owner, fn, observer) {
868
944
 
869
945
  // src/core/effect.ts
870
946
  var Effect = class extends Computation {
871
- aa;
872
- W;
873
- J;
874
- ba = false;
875
- X;
876
- y;
947
+ ba;
948
+ Z;
949
+ N;
950
+ ca = false;
951
+ _;
952
+ A;
877
953
  constructor(initialValue, compute2, effect, error, options) {
878
954
  super(initialValue, compute2, options);
879
- this.aa = effect;
880
- this.W = error;
881
- this.X = initialValue;
882
- this.y = (options == null ? void 0 : options.render) ? EFFECT_RENDER : EFFECT_USER;
883
- if (this.y === EFFECT_RENDER) {
884
- this.H = (p) => !ActiveTransition && clock > this.i.created && !(this.f & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
955
+ this.ba = effect;
956
+ this.Z = error;
957
+ this._ = initialValue;
958
+ this.A = (options == null ? void 0 : options.render) ? EFFECT_RENDER : EFFECT_USER;
959
+ if (this.A === EFFECT_RENDER) {
960
+ this.K = (p) => !ActiveTransition && clock > this.l.created && !(this.h & ERROR_BIT) ? latest(() => compute2(p)) : compute2(p);
885
961
  }
886
- this.D();
887
- !(options == null ? void 0 : options.defer) && (this.y === EFFECT_USER ? (ActiveTransition || this.i).enqueue(this.y, this.A.bind(this)) : this.A(this.y));
962
+ this.H();
963
+ !(options == null ? void 0 : options.defer) && (this.A === EFFECT_USER ? this.l.enqueue(this.A, this.C.bind(this)) : this.C(this.A));
888
964
  }
889
965
  write(value, flags = 0) {
890
966
  if (this.b == STATE_DIRTY) {
891
- this.f = flags;
892
- if (this.y === EFFECT_RENDER) {
893
- (ActiveTransition || this.i).notify(this, LOADING_BIT | ERROR_BIT, flags);
967
+ this.h = flags;
968
+ if (this.A === EFFECT_RENDER) {
969
+ this.l.notify(this, LOADING_BIT | ERROR_BIT, flags);
894
970
  }
895
971
  }
896
972
  if (value === UNCHANGED)
897
- return this.g;
898
- this.g = value;
899
- this.ba = true;
973
+ return this.i;
974
+ this.i = value;
975
+ this.ca = true;
900
976
  return value;
901
977
  }
902
- k(state, skipQueue) {
978
+ o(state, skipQueue) {
903
979
  if (ActiveTransition && ActiveTransition.a.has(this)) {
904
- return ActiveTransition.a.get(this).k(state, skipQueue);
980
+ return ActiveTransition.a.get(this).o(state, skipQueue);
905
981
  }
906
982
  if (this.b >= state || skipQueue)
907
983
  return;
908
984
  if (this.b === STATE_CLEAN)
909
- (ActiveTransition || this.i).enqueue(this.y, this.A.bind(this));
985
+ this.l.enqueue(this.A, this.C.bind(this));
910
986
  this.b = state;
911
987
  }
912
- V(mask, newFlags2) {
988
+ Y(mask, newFlags2) {
913
989
  if (ActiveTransition && ActiveTransition.a.has(this)) {
914
990
  if (this.b >= STATE_CHECK)
915
991
  return;
916
992
  if (mask & 3) {
917
- this.k(STATE_DIRTY);
993
+ this.o(STATE_DIRTY);
918
994
  return;
919
995
  }
920
996
  }
921
- super.V(mask, newFlags2);
997
+ super.Y(mask, newFlags2);
922
998
  }
923
- P(error) {
924
- this.O = error;
925
- (ActiveTransition || this.i).notify(this, LOADING_BIT, 0);
926
- this.f = ERROR_BIT;
927
- if (this.y === EFFECT_USER) {
999
+ M(error) {
1000
+ this.R = error;
1001
+ this.l.notify(this, LOADING_BIT, 0);
1002
+ this.h = ERROR_BIT;
1003
+ if (this.A === EFFECT_USER) {
928
1004
  try {
929
- return this.W ? this.W(error, () => {
1005
+ return this.Z ? this.Z(error, () => {
930
1006
  var _a;
931
- (_a = this.J) == null ? void 0 : _a.call(this);
932
- this.J = void 0;
1007
+ (_a = this.N) == null ? void 0 : _a.call(this);
1008
+ this.N = void 0;
933
1009
  }) : console.error(error);
934
1010
  } catch (e) {
935
1011
  error = e;
936
1012
  }
937
1013
  }
938
- if (!(ActiveTransition || this.i).notify(this, ERROR_BIT, ERROR_BIT))
1014
+ if (!this.l.notify(this, ERROR_BIT, ERROR_BIT))
939
1015
  throw error;
940
1016
  }
941
- G() {
1017
+ J() {
942
1018
  var _a;
943
1019
  if (this.b === STATE_DISPOSED)
944
1020
  return;
945
- this.aa = void 0;
946
- this.X = void 0;
947
- this.W = void 0;
948
- (_a = this.J) == null ? void 0 : _a.call(this);
949
- this.J = void 0;
950
- super.G();
951
- }
952
- A(type) {
1021
+ this.ba = void 0;
1022
+ this._ = void 0;
1023
+ this.Z = void 0;
1024
+ (_a = this.N) == null ? void 0 : _a.call(this);
1025
+ this.N = void 0;
1026
+ super.J();
1027
+ }
1028
+ C(type) {
953
1029
  var _a;
954
1030
  if (type) {
955
- if (this.ba && this.b !== STATE_DISPOSED) {
956
- (_a = this.J) == null ? void 0 : _a.call(this);
1031
+ const effect = this.j || this;
1032
+ if (effect.ca && effect.b !== STATE_DISPOSED) {
1033
+ (_a = effect.N) == null ? void 0 : _a.call(effect);
957
1034
  try {
958
- this.J = this.aa(this.g, this.X);
1035
+ effect.N = effect.ba(effect.i, effect._);
959
1036
  } catch (e) {
960
- if (!(ActiveTransition || this.i).notify(this, ERROR_BIT, ERROR_BIT))
1037
+ if (!effect.l.notify(effect, ERROR_BIT, ERROR_BIT))
961
1038
  throw e;
962
1039
  } finally {
963
- this.X = this.g;
964
- this.ba = false;
1040
+ effect._ = effect.i;
1041
+ effect.ca = false;
965
1042
  }
966
1043
  }
967
1044
  } else
@@ -971,19 +1048,19 @@ var Effect = class extends Computation {
971
1048
  var EagerComputation = class extends Computation {
972
1049
  constructor(initialValue, compute2, options) {
973
1050
  super(initialValue, compute2, options);
974
- !(options == null ? void 0 : options.defer) && this.D();
1051
+ !(options == null ? void 0 : options.defer) && this.H();
975
1052
  }
976
- k(state, skipQueue) {
1053
+ o(state, skipQueue) {
977
1054
  if (ActiveTransition && ActiveTransition.a.has(this)) {
978
- return ActiveTransition.a.get(this).k(state, skipQueue);
1055
+ return ActiveTransition.a.get(this).o(state, skipQueue);
979
1056
  }
980
- if (this.b >= state && !this.C)
1057
+ if (this.b >= state && !this.G)
981
1058
  return;
982
- if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.C))
983
- (ActiveTransition || this.i).enqueue(EFFECT_PURE, this.A.bind(this));
984
- super.k(state, skipQueue);
1059
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.G))
1060
+ this.l.enqueue(EFFECT_PURE, this.C.bind(this));
1061
+ super.o(state, skipQueue);
985
1062
  }
986
- A() {
1063
+ C() {
987
1064
  this.b !== STATE_CLEAN && runTop(this);
988
1065
  }
989
1066
  };
@@ -992,31 +1069,31 @@ var FirewallComputation = class extends Computation {
992
1069
  constructor(compute2) {
993
1070
  super(void 0, compute2);
994
1071
  }
995
- k(state, skipQueue) {
1072
+ o(state, skipQueue) {
996
1073
  if (ActiveTransition && ActiveTransition.a.has(this)) {
997
- return ActiveTransition.a.get(this).k(state, skipQueue);
1074
+ return ActiveTransition.a.get(this).o(state, skipQueue);
998
1075
  }
999
- if (this.b >= state && !this.C)
1076
+ if (this.b >= state && !this.G)
1000
1077
  return;
1001
- if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.C))
1002
- (ActiveTransition || this.i).enqueue(EFFECT_PURE, this.A.bind(this));
1003
- super.k(state, true);
1004
- this.C = !!skipQueue;
1078
+ if (!skipQueue && (this.b === STATE_CLEAN || this.b === STATE_CHECK && this.G))
1079
+ this.l.enqueue(EFFECT_PURE, this.C.bind(this));
1080
+ super.o(state, true);
1081
+ this.G = !!skipQueue;
1005
1082
  }
1006
- A() {
1083
+ C() {
1007
1084
  this.b !== STATE_CLEAN && runTop(this);
1008
1085
  }
1009
1086
  };
1010
1087
  function runTop(node) {
1011
1088
  const ancestors = [];
1012
- for (let current = node; current !== null; current = current.p) {
1089
+ for (let current = node; current !== null; current = current.m) {
1013
1090
  if (current.b !== STATE_CLEAN) {
1014
1091
  ancestors.push(current);
1015
1092
  }
1016
1093
  }
1017
1094
  for (let i = ancestors.length - 1; i >= 0; i--) {
1018
1095
  if (ancestors[i].b !== STATE_DISPOSED)
1019
- ancestors[i].D();
1096
+ ancestors[i].H();
1020
1097
  }
1021
1098
  }
1022
1099
 
@@ -1151,7 +1228,7 @@ var storeTraps = {
1151
1228
  return desc.get.call(receiver);
1152
1229
  }
1153
1230
  if (Writing == null ? void 0 : Writing.has(receiver)) {
1154
- let value2 = tracked && (overridden || !proxySource) ? tracked.g : storeValue[property];
1231
+ let value2 = tracked && (overridden || !proxySource) ? tracked.i : storeValue[property];
1155
1232
  value2 === $DELETED && (value2 = void 0);
1156
1233
  if (!isWrappable(value2))
1157
1234
  return value2;
@@ -1694,7 +1771,7 @@ function createMemo(compute2, value, options) {
1694
1771
  return resolvedValue;
1695
1772
  }
1696
1773
  resolvedValue = node.wait();
1697
- if (!((_a = node.a) == null ? void 0 : _a.length) && ((_b = node.r) == null ? void 0 : _b.p) !== node) {
1774
+ if (!((_a = node.a) == null ? void 0 : _a.length) && ((_b = node.s) == null ? void 0 : _b.m) !== node) {
1698
1775
  node.dispose();
1699
1776
  node = void 0;
1700
1777
  }
@@ -1730,8 +1807,8 @@ function createAsync(compute2, value, options) {
1730
1807
  if (abort)
1731
1808
  return;
1732
1809
  if (transition2)
1733
- return transition2.runTransition(() => node.P(error), true);
1734
- node.P(error);
1810
+ return transition2.runTransition(() => node.M(error), true);
1811
+ node.M(error);
1735
1812
  }
1736
1813
  );
1737
1814
  } else {
@@ -1757,7 +1834,7 @@ function createAsync(compute2, value, options) {
1757
1834
  read.refresh = () => {
1758
1835
  node.b = STATE_DIRTY;
1759
1836
  refreshing = true;
1760
- node.D();
1837
+ node.H();
1761
1838
  };
1762
1839
  return read;
1763
1840
  }
@@ -1869,95 +1946,95 @@ function createOptimistic(initial, compute2, key) {
1869
1946
  function mapArray(list, map, options) {
1870
1947
  const keyFn = typeof (options == null ? void 0 : options.keyed) === "function" ? options.keyed : void 0;
1871
1948
  return updateKeyedMap.bind({
1872
- Q: new Owner(),
1873
- l: 0,
1874
- ga: list,
1875
- B: [],
1876
- K: map,
1877
- e: [],
1949
+ S: new Owner(),
1950
+ p: 0,
1951
+ ha: list,
1952
+ D: [],
1953
+ O: map,
1954
+ g: [],
1878
1955
  c: [],
1879
- L: keyFn,
1880
- m: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
1881
- n: map.length > 1 ? [] : void 0,
1882
- R: options == null ? void 0 : options.fallback
1956
+ P: keyFn,
1957
+ q: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
1958
+ r: map.length > 1 ? [] : void 0,
1959
+ T: options == null ? void 0 : options.fallback
1883
1960
  });
1884
1961
  }
1885
1962
  var pureOptions = { pureWrite: true };
1886
1963
  function updateKeyedMap() {
1887
- const newItems = this.ga() || [], newLen = newItems.length;
1964
+ const newItems = this.ha() || [], newLen = newItems.length;
1888
1965
  newItems[$TRACK];
1889
- runWithOwner(this.Q, () => {
1890
- let i, j, mapper = this.m ? () => {
1891
- this.m[j] = new Computation(newItems[j], null, pureOptions);
1892
- this.n && (this.n[j] = new Computation(j, null, pureOptions));
1893
- return this.K(
1894
- Computation.prototype.read.bind(this.m[j]),
1895
- this.n ? Computation.prototype.read.bind(this.n[j]) : void 0
1966
+ runWithOwner(this.S, () => {
1967
+ let i, j, mapper = this.q ? () => {
1968
+ this.q[j] = new Computation(newItems[j], null, pureOptions);
1969
+ this.r && (this.r[j] = new Computation(j, null, pureOptions));
1970
+ return this.O(
1971
+ Computation.prototype.read.bind(this.q[j]),
1972
+ this.r ? Computation.prototype.read.bind(this.r[j]) : void 0
1896
1973
  );
1897
- } : this.n ? () => {
1974
+ } : this.r ? () => {
1898
1975
  const item = newItems[j];
1899
- this.n[j] = new Computation(j, null, pureOptions);
1900
- return this.K(() => item, Computation.prototype.read.bind(this.n[j]));
1976
+ this.r[j] = new Computation(j, null, pureOptions);
1977
+ return this.O(() => item, Computation.prototype.read.bind(this.r[j]));
1901
1978
  } : () => {
1902
1979
  const item = newItems[j];
1903
- return this.K(() => item);
1980
+ return this.O(() => item);
1904
1981
  };
1905
1982
  if (newLen === 0) {
1906
- if (this.l !== 0) {
1907
- this.Q.dispose(false);
1983
+ if (this.p !== 0) {
1984
+ this.S.dispose(false);
1908
1985
  this.c = [];
1909
- this.B = [];
1910
- this.e = [];
1911
- this.l = 0;
1912
- this.m && (this.m = []);
1913
- this.n && (this.n = []);
1986
+ this.D = [];
1987
+ this.g = [];
1988
+ this.p = 0;
1989
+ this.q && (this.q = []);
1990
+ this.r && (this.r = []);
1914
1991
  }
1915
- if (this.R && !this.e[0]) {
1916
- this.e[0] = compute(
1992
+ if (this.T && !this.g[0]) {
1993
+ this.g[0] = compute(
1917
1994
  this.c[0] = new Owner(),
1918
- this.R,
1995
+ this.T,
1919
1996
  null
1920
1997
  );
1921
1998
  }
1922
- } else if (this.l === 0) {
1999
+ } else if (this.p === 0) {
1923
2000
  if (this.c[0])
1924
2001
  this.c[0].dispose();
1925
- this.e = new Array(newLen);
2002
+ this.g = new Array(newLen);
1926
2003
  for (j = 0; j < newLen; j++) {
1927
- this.B[j] = newItems[j];
1928
- this.e[j] = compute(this.c[j] = new Owner(), mapper, null);
2004
+ this.D[j] = newItems[j];
2005
+ this.g[j] = compute(this.c[j] = new Owner(), mapper, null);
1929
2006
  }
1930
- this.l = newLen;
2007
+ this.p = newLen;
1931
2008
  } else {
1932
- let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.m ? new Array(newLen) : void 0, tempIndexes = this.n ? new Array(newLen) : void 0;
1933
- for (start = 0, end = Math.min(this.l, newLen); start < end && (this.B[start] === newItems[start] || this.m && compare(this.L, this.B[start], newItems[start])); start++) {
1934
- if (this.m)
1935
- this.m[start].write(newItems[start]);
2009
+ let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.q ? new Array(newLen) : void 0, tempIndexes = this.r ? new Array(newLen) : void 0;
2010
+ for (start = 0, end = Math.min(this.p, newLen); start < end && (this.D[start] === newItems[start] || this.q && compare(this.P, this.D[start], newItems[start])); start++) {
2011
+ if (this.q)
2012
+ this.q[start].write(newItems[start]);
1936
2013
  }
1937
- for (end = this.l - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.B[end] === newItems[newEnd] || this.m && compare(this.L, this.B[end], newItems[newEnd])); end--, newEnd--) {
1938
- temp[newEnd] = this.e[end];
2014
+ for (end = this.p - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.D[end] === newItems[newEnd] || this.q && compare(this.P, this.D[end], newItems[newEnd])); end--, newEnd--) {
2015
+ temp[newEnd] = this.g[end];
1939
2016
  tempNodes[newEnd] = this.c[end];
1940
- tempRows && (tempRows[newEnd] = this.m[end]);
1941
- tempIndexes && (tempIndexes[newEnd] = this.n[end]);
2017
+ tempRows && (tempRows[newEnd] = this.q[end]);
2018
+ tempIndexes && (tempIndexes[newEnd] = this.r[end]);
1942
2019
  }
1943
2020
  newIndices = /* @__PURE__ */ new Map();
1944
2021
  newIndicesNext = new Array(newEnd + 1);
1945
2022
  for (j = newEnd; j >= start; j--) {
1946
2023
  item = newItems[j];
1947
- key = this.L ? this.L(item) : item;
2024
+ key = this.P ? this.P(item) : item;
1948
2025
  i = newIndices.get(key);
1949
2026
  newIndicesNext[j] = i === void 0 ? -1 : i;
1950
2027
  newIndices.set(key, j);
1951
2028
  }
1952
2029
  for (i = start; i <= end; i++) {
1953
- item = this.B[i];
1954
- key = this.L ? this.L(item) : item;
2030
+ item = this.D[i];
2031
+ key = this.P ? this.P(item) : item;
1955
2032
  j = newIndices.get(key);
1956
2033
  if (j !== void 0 && j !== -1) {
1957
- temp[j] = this.e[i];
2034
+ temp[j] = this.g[i];
1958
2035
  tempNodes[j] = this.c[i];
1959
- tempRows && (tempRows[j] = this.m[i]);
1960
- tempIndexes && (tempIndexes[j] = this.n[i]);
2036
+ tempRows && (tempRows[j] = this.q[i]);
2037
+ tempIndexes && (tempIndexes[j] = this.r[i]);
1961
2038
  j = newIndicesNext[j];
1962
2039
  newIndices.set(key, j);
1963
2040
  } else
@@ -1965,101 +2042,101 @@ function updateKeyedMap() {
1965
2042
  }
1966
2043
  for (j = start; j < newLen; j++) {
1967
2044
  if (j in temp) {
1968
- this.e[j] = temp[j];
2045
+ this.g[j] = temp[j];
1969
2046
  this.c[j] = tempNodes[j];
1970
2047
  if (tempRows) {
1971
- this.m[j] = tempRows[j];
1972
- this.m[j].write(newItems[j]);
2048
+ this.q[j] = tempRows[j];
2049
+ this.q[j].write(newItems[j]);
1973
2050
  }
1974
2051
  if (tempIndexes) {
1975
- this.n[j] = tempIndexes[j];
1976
- this.n[j].write(j);
2052
+ this.r[j] = tempIndexes[j];
2053
+ this.r[j].write(j);
1977
2054
  }
1978
2055
  } else {
1979
- this.e[j] = compute(this.c[j] = new Owner(), mapper, null);
2056
+ this.g[j] = compute(this.c[j] = new Owner(), mapper, null);
1980
2057
  }
1981
2058
  }
1982
- this.e = this.e.slice(0, this.l = newLen);
1983
- this.B = newItems.slice(0);
2059
+ this.g = this.g.slice(0, this.p = newLen);
2060
+ this.D = newItems.slice(0);
1984
2061
  }
1985
2062
  });
1986
- return this.e;
2063
+ return this.g;
1987
2064
  }
1988
2065
  function repeat(count, map, options) {
1989
2066
  return updateRepeat.bind({
1990
- Q: new Owner(),
1991
- l: 0,
1992
- w: 0,
1993
- ha: count,
1994
- K: map,
2067
+ S: new Owner(),
2068
+ p: 0,
2069
+ y: 0,
2070
+ ia: count,
2071
+ O: map,
1995
2072
  c: [],
1996
- e: [],
1997
- ia: options == null ? void 0 : options.from,
1998
- R: options == null ? void 0 : options.fallback
2073
+ g: [],
2074
+ ja: options == null ? void 0 : options.from,
2075
+ T: options == null ? void 0 : options.fallback
1999
2076
  });
2000
2077
  }
2001
2078
  function updateRepeat() {
2002
2079
  var _a;
2003
- const newLen = this.ha();
2004
- const from = ((_a = this.ia) == null ? void 0 : _a.call(this)) || 0;
2005
- runWithOwner(this.Q, () => {
2080
+ const newLen = this.ia();
2081
+ const from = ((_a = this.ja) == null ? void 0 : _a.call(this)) || 0;
2082
+ runWithOwner(this.S, () => {
2006
2083
  if (newLen === 0) {
2007
- if (this.l !== 0) {
2008
- this.Q.dispose(false);
2084
+ if (this.p !== 0) {
2085
+ this.S.dispose(false);
2009
2086
  this.c = [];
2010
- this.e = [];
2011
- this.l = 0;
2087
+ this.g = [];
2088
+ this.p = 0;
2012
2089
  }
2013
- if (this.R && !this.e[0]) {
2014
- this.e[0] = compute(
2090
+ if (this.T && !this.g[0]) {
2091
+ this.g[0] = compute(
2015
2092
  this.c[0] = new Owner(),
2016
- this.R,
2093
+ this.T,
2017
2094
  null
2018
2095
  );
2019
2096
  }
2020
2097
  return;
2021
2098
  }
2022
2099
  const to = from + newLen;
2023
- const prevTo = this.w + this.l;
2024
- if (this.l === 0 && this.c[0])
2100
+ const prevTo = this.y + this.p;
2101
+ if (this.p === 0 && this.c[0])
2025
2102
  this.c[0].dispose();
2026
2103
  for (let i = to; i < prevTo; i++)
2027
- this.c[i - this.w].dispose();
2028
- if (this.w < from) {
2029
- let i = this.w;
2030
- while (i < from && i < this.l)
2104
+ this.c[i - this.y].dispose();
2105
+ if (this.y < from) {
2106
+ let i = this.y;
2107
+ while (i < from && i < this.p)
2031
2108
  this.c[i++].dispose();
2032
- this.c.splice(0, from - this.w);
2033
- this.e.splice(0, from - this.w);
2034
- } else if (this.w > from) {
2035
- let i = prevTo - this.w - 1;
2036
- let difference = this.w - from;
2037
- this.c.length = this.e.length = newLen;
2109
+ this.c.splice(0, from - this.y);
2110
+ this.g.splice(0, from - this.y);
2111
+ } else if (this.y > from) {
2112
+ let i = prevTo - this.y - 1;
2113
+ let difference = this.y - from;
2114
+ this.c.length = this.g.length = newLen;
2038
2115
  while (i >= difference) {
2039
2116
  this.c[i] = this.c[i - difference];
2040
- this.e[i] = this.e[i - difference];
2117
+ this.g[i] = this.g[i - difference];
2041
2118
  i--;
2042
2119
  }
2043
2120
  for (let i2 = 0; i2 < difference; i2++) {
2044
- this.e[i2] = compute(
2121
+ this.g[i2] = compute(
2045
2122
  this.c[i2] = new Owner(),
2046
- () => this.K(i2 + from),
2123
+ () => this.O(i2 + from),
2047
2124
  null
2048
2125
  );
2049
2126
  }
2050
2127
  }
2051
2128
  for (let i = prevTo; i < to; i++) {
2052
- this.e[i - from] = compute(
2129
+ this.g[i - from] = compute(
2053
2130
  this.c[i - from] = new Owner(),
2054
- () => this.K(i),
2131
+ () => this.O(i),
2055
2132
  null
2056
2133
  );
2057
2134
  }
2058
- this.e = this.e.slice(0, newLen);
2059
- this.w = from;
2060
- this.l = newLen;
2135
+ this.g = this.g.slice(0, newLen);
2136
+ this.y = from;
2137
+ this.p = newLen;
2061
2138
  });
2062
- return this.e;
2139
+ return this.g;
2063
2140
  }
2064
2141
  function compare(key, a, b) {
2065
2142
  return key ? key(a) === key(b) : true;
@@ -2067,24 +2144,24 @@ function compare(key, a, b) {
2067
2144
 
2068
2145
  // src/boundaries.ts
2069
2146
  var BoundaryComputation = class extends EagerComputation {
2070
- S;
2147
+ U;
2071
2148
  constructor(compute2, propagationMask) {
2072
2149
  super(void 0, compute2, { defer: true });
2073
- this.S = propagationMask;
2150
+ this.U = propagationMask;
2074
2151
  }
2075
2152
  write(value, flags) {
2076
- super.write(value, flags & ~this.S);
2077
- if (this.S & LOADING_BIT && !(this.f & UNINITIALIZED_BIT)) {
2153
+ super.write(value, flags & ~this.U);
2154
+ if (this.U & LOADING_BIT && !(this.h & UNINITIALIZED_BIT)) {
2078
2155
  flags &= ~LOADING_BIT;
2079
2156
  }
2080
- this.i.notify(this, this.S, flags);
2081
- return this.g;
2157
+ this.l.notify(this, this.U, flags);
2158
+ return this.i;
2082
2159
  }
2083
2160
  };
2084
2161
  function createBoundChildren(owner, fn, queue, mask) {
2085
- const parentQueue = owner.i;
2086
- parentQueue.addChild(owner.i = queue);
2087
- onCleanup(() => parentQueue.removeChild(owner.i));
2162
+ const parentQueue = owner.l;
2163
+ parentQueue.addChild(owner.l = queue);
2164
+ onCleanup(() => parentQueue.removeChild(owner.l));
2088
2165
  return compute(
2089
2166
  owner,
2090
2167
  () => {
@@ -2095,20 +2172,22 @@ function createBoundChildren(owner, fn, queue, mask) {
2095
2172
  );
2096
2173
  }
2097
2174
  var ConditionalQueue = class extends Queue {
2098
- s;
2099
- Y = /* @__PURE__ */ new Set();
2175
+ u;
2176
+ V = /* @__PURE__ */ new Set();
2100
2177
  t = /* @__PURE__ */ new Set();
2101
2178
  constructor(disabled) {
2102
2179
  super();
2103
- this.s = disabled;
2180
+ this.u = disabled;
2104
2181
  }
2105
2182
  run(type) {
2106
- if (!type || this.s.read())
2183
+ if (!type || this.u.read())
2107
2184
  return;
2108
2185
  return super.run(type);
2109
2186
  }
2110
2187
  notify(node, type, flags) {
2111
- if (this.s.read()) {
2188
+ if (ActiveTransition && ActiveTransition.w.has(this))
2189
+ return ActiveTransition.w.get(this).notify(node, type, flags);
2190
+ if (this.u.read()) {
2112
2191
  if (type & LOADING_BIT) {
2113
2192
  if (flags & LOADING_BIT) {
2114
2193
  this.t.add(node);
@@ -2118,43 +2197,54 @@ var ConditionalQueue = class extends Queue {
2118
2197
  }
2119
2198
  if (type & ERROR_BIT) {
2120
2199
  if (flags & ERROR_BIT) {
2121
- this.Y.add(node);
2200
+ this.V.add(node);
2122
2201
  type &= ~ERROR_BIT;
2123
- } else if (this.Y.delete(node))
2202
+ } else if (this.V.delete(node))
2124
2203
  type &= ~ERROR_BIT;
2125
2204
  }
2126
2205
  }
2127
2206
  return type ? super.notify(node, type, flags) : true;
2128
2207
  }
2208
+ merge(queue) {
2209
+ queue.t.forEach((n) => this.notify(n, LOADING_BIT, LOADING_BIT));
2210
+ queue.V.forEach((n) => this.notify(n, ERROR_BIT, ERROR_BIT));
2211
+ super.merge(queue);
2212
+ }
2129
2213
  };
2130
2214
  var CollectionQueue = class extends Queue {
2131
- Z;
2215
+ F;
2132
2216
  c = /* @__PURE__ */ new Set();
2133
- s = new Computation(false, null, { pureWrite: true });
2217
+ u = new Computation(false, null, { pureWrite: true });
2134
2218
  constructor(type) {
2135
2219
  super();
2136
- this.Z = type;
2220
+ this.F = type;
2137
2221
  }
2138
2222
  run(type) {
2139
- if (!type || this.s.read())
2223
+ if (!type || this.u.read())
2140
2224
  return;
2141
2225
  return super.run(type);
2142
2226
  }
2143
2227
  notify(node, type, flags) {
2144
- if (!(type & this.Z))
2228
+ if (ActiveTransition && ActiveTransition.w.has(this))
2229
+ return ActiveTransition.w.get(this).notify(node, type, flags);
2230
+ if (!(type & this.F))
2145
2231
  return super.notify(node, type, flags);
2146
- if (flags & this.Z) {
2232
+ if (flags & this.F) {
2147
2233
  this.c.add(node);
2148
2234
  if (this.c.size === 1)
2149
- this.s.write(true);
2235
+ this.u.write(true);
2150
2236
  } else {
2151
2237
  this.c.delete(node);
2152
2238
  if (this.c.size === 0)
2153
- this.s.write(false);
2239
+ this.u.write(false);
2154
2240
  }
2155
- type &= ~this.Z;
2241
+ type &= ~this.F;
2156
2242
  return type ? super.notify(node, type, flags) : true;
2157
2243
  }
2244
+ merge(queue) {
2245
+ queue.c.forEach((n) => this.notify(n, this.F, this.F));
2246
+ super.merge(queue);
2247
+ }
2158
2248
  };
2159
2249
  function createBoundary(fn, condition) {
2160
2250
  const owner = new Owner();
@@ -2163,25 +2253,25 @@ function createBoundary(fn, condition) {
2163
2253
  );
2164
2254
  const tree = createBoundChildren(owner, fn, queue, 0);
2165
2255
  new EagerComputation(void 0, () => {
2166
- const disabled = queue.s.read();
2167
- tree.S = disabled ? ERROR_BIT | LOADING_BIT : 0;
2256
+ const disabled = queue.u.read();
2257
+ tree.U = disabled ? ERROR_BIT | LOADING_BIT : 0;
2168
2258
  if (!disabled) {
2169
2259
  queue.t.forEach((node) => queue.notify(node, LOADING_BIT, LOADING_BIT));
2170
- queue.Y.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2260
+ queue.V.forEach((node) => queue.notify(node, ERROR_BIT, ERROR_BIT));
2171
2261
  queue.t.clear();
2172
- queue.Y.clear();
2262
+ queue.V.clear();
2173
2263
  }
2174
2264
  });
2175
- return () => queue.s.read() ? void 0 : tree.read();
2265
+ return () => queue.u.read() ? void 0 : tree.read();
2176
2266
  }
2177
2267
  function createCollectionBoundary(type, fn, fallback) {
2178
2268
  const owner = new Owner();
2179
2269
  const queue = new CollectionQueue(type);
2180
2270
  const tree = createBoundChildren(owner, fn, queue, type);
2181
2271
  const decision = new Computation(void 0, () => {
2182
- if (!queue.s.read()) {
2272
+ if (!queue.u.read()) {
2183
2273
  const resolved = tree.read();
2184
- if (!queue.s.read())
2274
+ if (!queue.u.read())
2185
2275
  return resolved;
2186
2276
  }
2187
2277
  return fallback(queue);
@@ -2192,18 +2282,18 @@ function createSuspense(fn, fallback) {
2192
2282
  return createCollectionBoundary(LOADING_BIT, fn, () => fallback());
2193
2283
  }
2194
2284
  function createErrorBoundary(fn, fallback) {
2195
- return createCollectionBoundary(
2196
- ERROR_BIT,
2197
- fn,
2198
- (queue) => fallback(queue.c.values().next().value.O, () => {
2285
+ return createCollectionBoundary(ERROR_BIT, fn, (queue) => {
2286
+ let node = queue.c.values().next().value;
2287
+ ActiveTransition && ActiveTransition.a.has(node) && (node = ActiveTransition.a.get(node));
2288
+ return fallback(node.R, () => {
2199
2289
  var _a;
2200
2290
  incrementClock();
2201
- for (let node of queue.c) {
2202
- node.b = STATE_DIRTY;
2203
- (_a = node.i) == null ? void 0 : _a.enqueue(node.y, node.A.bind(node));
2291
+ for (let node2 of queue.c) {
2292
+ node2.b = STATE_DIRTY;
2293
+ (_a = node2.l) == null ? void 0 : _a.enqueue(node2.A, node2.C.bind(node2));
2204
2294
  }
2205
- })
2206
- );
2295
+ });
2296
+ });
2207
2297
  }
2208
2298
  function flatten(children, options) {
2209
2299
  if (typeof children === "function" && !children.length) {