@solidjs/signals 0.4.8 → 0.4.10

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