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