@solidjs/signals 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/node.cjs CHANGED
@@ -27,21 +27,21 @@ var SUPPORTS_PROXY = typeof Proxy === "function";
27
27
  // src/core/heap.ts
28
28
  function actualInsertIntoHeap(n, heap) {
29
29
  var _a, _b, _c;
30
- const parentHeight = (((_a = n.q) == null ? void 0 : _a._) ? (_b = n.q.$) == null ? void 0 : _b.c : (_c = n.q) == null ? void 0 : _c.c) ?? -1;
30
+ const parentHeight = (((_a = n.w) == null ? void 0 : _a.$) ? (_b = n.w.aa) == null ? void 0 : _b.c : (_c = n.w) == null ? void 0 : _c.c) ?? -1;
31
31
  if (parentHeight >= n.c)
32
32
  n.c = parentHeight + 1;
33
33
  const height = n.c;
34
- const heapAtHeight = heap.p[height];
34
+ const heapAtHeight = heap.s[height];
35
35
  if (heapAtHeight === void 0) {
36
- heap.p[height] = n;
36
+ heap.s[height] = n;
37
37
  } else {
38
- const tail = heapAtHeight.x;
39
- tail.P = n;
40
- n.x = tail;
41
- heapAtHeight.x = n;
38
+ const tail = heapAtHeight.z;
39
+ tail.Q = n;
40
+ n.z = tail;
41
+ heapAtHeight.z = n;
42
42
  }
43
- if (height > heap.J) {
44
- heap.J = height;
43
+ if (height > heap.L) {
44
+ heap.L = height;
45
45
  }
46
46
  }
47
47
  function insertIntoHeap(n, heap) {
@@ -69,28 +69,28 @@ function deleteFromHeap(n, heap) {
69
69
  return;
70
70
  n.b = flags & ~(8 /* InHeap */ | 16 /* InHeapHeight */);
71
71
  const height = n.c;
72
- if (n.x === n) {
73
- heap.p[height] = void 0;
72
+ if (n.z === n) {
73
+ heap.s[height] = void 0;
74
74
  } else {
75
- const next = n.P;
76
- const dhh = heap.p[height];
75
+ const next = n.Q;
76
+ const dhh = heap.s[height];
77
77
  const end = next ?? dhh;
78
78
  if (n === dhh) {
79
- heap.p[height] = next;
79
+ heap.s[height] = next;
80
80
  } else {
81
- n.x.P = next;
81
+ n.z.Q = next;
82
82
  }
83
- end.x = n.x;
83
+ end.z = n.z;
84
84
  }
85
- n.x = n;
86
- n.P = void 0;
85
+ n.z = n;
86
+ n.Q = void 0;
87
87
  }
88
88
  function markHeap(heap) {
89
- if (heap.aa)
89
+ if (heap.ba)
90
90
  return;
91
- heap.aa = true;
92
- for (let i = 0; i <= heap.J; i++) {
93
- for (let el = heap.p[i]; el !== void 0; el = el.P) {
91
+ heap.ba = true;
92
+ for (let i = 0; i <= heap.L; i++) {
93
+ for (let el = heap.s[i]; el !== void 0; el = el.Q) {
94
94
  if (el.b & 8 /* InHeap */)
95
95
  markNode(el);
96
96
  }
@@ -101,39 +101,39 @@ function markNode(el, newState = 2 /* Dirty */) {
101
101
  if ((flags & (1 /* Check */ | 2 /* Dirty */)) >= newState)
102
102
  return;
103
103
  el.b = flags & ~(1 /* Check */ | 2 /* Dirty */) | newState;
104
- for (let link2 = el.r; link2 !== null; link2 = link2.y) {
104
+ for (let link2 = el.x; link2 !== null; link2 = link2.A) {
105
105
  markNode(link2.j, 1 /* Check */);
106
106
  }
107
- if (el.ba !== null) {
108
- for (let child = el.ba; child !== null; child = child.ra) {
109
- for (let link2 = child.r; link2 !== null; link2 = link2.y) {
107
+ if (el.ca !== null) {
108
+ for (let child = el.ca; child !== null; child = child.sa) {
109
+ for (let link2 = child.x; link2 !== null; link2 = link2.A) {
110
110
  markNode(link2.j, 1 /* Check */);
111
111
  }
112
112
  }
113
113
  }
114
114
  }
115
115
  function runHeap(heap, recompute2) {
116
- heap.aa = false;
117
- for (heap.n = 0; heap.n <= heap.J; heap.n++) {
118
- let el = heap.p[heap.n];
116
+ heap.ba = false;
117
+ for (heap.q = 0; heap.q <= heap.L; heap.q++) {
118
+ let el = heap.s[heap.q];
119
119
  while (el !== void 0) {
120
120
  if (el.b & 8 /* InHeap */)
121
121
  recompute2(el);
122
122
  else {
123
123
  adjustHeight(el, heap);
124
124
  }
125
- el = heap.p[heap.n];
125
+ el = heap.s[heap.q];
126
126
  }
127
127
  }
128
- heap.J = 0;
128
+ heap.L = 0;
129
129
  }
130
130
  function adjustHeight(el, heap) {
131
131
  deleteFromHeap(el, heap);
132
132
  let newHeight = el.c;
133
- for (let d = el.u; d; d = d.E) {
134
- const dep1 = d.Q;
135
- const dep = "_owner" in dep1 ? dep1.z : dep1;
136
- if ("_fn" in dep) {
133
+ for (let d = el.l; d; d = d.E) {
134
+ const dep1 = d.R;
135
+ const dep = dep1.ia || dep1;
136
+ if (dep.H) {
137
137
  if (dep.c >= newHeight) {
138
138
  newHeight = dep.c + 1;
139
139
  }
@@ -141,7 +141,7 @@ function adjustHeight(el, heap) {
141
141
  }
142
142
  if (el.c !== newHeight) {
143
143
  el.c = newHeight;
144
- for (let s = el.r; s !== null; s = s.y) {
144
+ for (let s = el.x; s !== null; s = s.A) {
145
145
  insertIntoHeapHeight(s.j, heap);
146
146
  }
147
147
  }
@@ -150,83 +150,104 @@ function adjustHeight(el, heap) {
150
150
  // src/core/scheduler.ts
151
151
  var clock = 0;
152
152
  var activeTransition = null;
153
- var unobserved = [];
154
153
  var transitions = /* @__PURE__ */ new Set();
155
154
  var scheduled = false;
156
155
  function schedule() {
157
156
  if (scheduled)
158
157
  return;
159
158
  scheduled = true;
160
- if (!globalQueue.ca)
159
+ if (!globalQueue.da)
161
160
  queueMicrotask(flush);
162
161
  }
163
162
  var dirtyQueue = {
164
- p: new Array(2e3).fill(void 0),
165
- aa: false,
166
- n: 0,
167
- J: 0
163
+ s: new Array(2e3).fill(void 0),
164
+ ba: false,
165
+ q: 0,
166
+ L: 0
168
167
  };
169
168
  var zombieQueue = {
170
- p: new Array(2e3).fill(void 0),
171
- aa: false,
172
- n: 0,
173
- J: 0
169
+ s: new Array(2e3).fill(void 0),
170
+ ba: false,
171
+ q: 0,
172
+ L: 0
174
173
  };
175
174
  var Queue = class {
176
- q = null;
177
- A = [[], []];
178
- R = [];
175
+ w = null;
176
+ k = [[], []];
177
+ m = [];
179
178
  created = clock;
180
179
  addChild(child) {
181
- this.R.push(child);
182
- child.q = this;
180
+ this.m.push(child);
181
+ child.w = this;
183
182
  }
184
183
  removeChild(child) {
185
- const index = this.R.indexOf(child);
184
+ const index = this.m.indexOf(child);
186
185
  if (index >= 0) {
187
- this.R.splice(index, 1);
188
- child.q = null;
186
+ this.m.splice(index, 1);
187
+ child.w = null;
189
188
  }
190
189
  }
191
190
  notify(node, mask, flags) {
192
- if (this.q)
193
- return this.q.notify(node, mask, flags);
191
+ if (this.w)
192
+ return this.w.notify(node, mask, flags);
194
193
  return false;
195
194
  }
196
195
  run(type) {
197
- if (this.A[type - 1].length) {
198
- const effects = this.A[type - 1];
199
- this.A[type - 1] = [];
196
+ if (this.k[type - 1].length) {
197
+ const effects = this.k[type - 1];
198
+ this.k[type - 1] = [];
200
199
  runQueue(effects, type);
201
200
  }
202
- for (let i = 0; i < this.R.length; i++) {
203
- this.R[i].run(type);
201
+ for (let i = 0; i < this.m.length; i++) {
202
+ this.m[i].run(type);
204
203
  }
205
204
  }
206
205
  enqueue(type, fn) {
207
206
  if (type)
208
- this.A[type - 1].push(fn);
207
+ this.k[type - 1].push(fn);
209
208
  schedule();
210
209
  }
210
+ stashQueues(stub) {
211
+ stub.k[0].push(...this.k[0]);
212
+ stub.k[1].push(...this.k[1]);
213
+ this.k = [[], []];
214
+ for (let i = 0; i < this.m.length; i++) {
215
+ let child = this.m[i];
216
+ let childStub = stub.m[i];
217
+ if (!childStub) {
218
+ childStub = { k: [[], []], m: [] };
219
+ stub.m[i] = childStub;
220
+ }
221
+ child.stashQueues(childStub);
222
+ }
223
+ }
224
+ restoreQueues(stub) {
225
+ this.k[0].push(...stub.k[0]);
226
+ this.k[1].push(...stub.k[1]);
227
+ for (let i = 0; i < stub.m.length; i++) {
228
+ const childStub = stub.m[i];
229
+ let child = this.m[i];
230
+ if (child)
231
+ child.restoreQueues(childStub);
232
+ }
233
+ }
211
234
  };
212
235
  var GlobalQueue = class _GlobalQueue extends Queue {
213
- ca = false;
236
+ da = false;
214
237
  h = [];
215
238
  static S;
216
239
  static la;
217
240
  flush() {
218
- if (this.ca)
241
+ if (this.da)
219
242
  return;
220
- this.ca = true;
243
+ this.da = true;
221
244
  try {
222
245
  runHeap(dirtyQueue, _GlobalQueue.S);
223
246
  if (activeTransition) {
224
247
  if (!transitionComplete(activeTransition)) {
225
248
  runHeap(zombieQueue, _GlobalQueue.S);
226
249
  globalQueue.h = [];
227
- activeTransition.queues[0].push(...globalQueue.A[0]);
228
- activeTransition.queues[1].push(...globalQueue.A[1]);
229
- globalQueue.A = [[], []];
250
+ globalQueue.stashQueues(activeTransition.queueStash);
230
251
  clock++;
231
252
  scheduled = false;
232
253
  runPending(activeTransition.pendingNodes, true);
@@ -234,8 +255,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
234
255
  return;
235
256
  }
236
257
  globalQueue.h.push(...activeTransition.pendingNodes);
237
- globalQueue.A[0].push(...activeTransition.queues[0]);
238
- globalQueue.A[1].push(...activeTransition.queues[1]);
258
+ globalQueue.restoreQueues(activeTransition.queueStash);
239
259
  transitions.delete(activeTransition);
240
260
  activeTransition = null;
241
261
  if (runPending(globalQueue.h, false))
@@ -248,7 +268,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
248
268
  n.g = n.e;
249
269
  n.e = NOT_PENDING;
250
270
  }
251
- if (n.ha)
271
+ if (n.H)
252
272
  _GlobalQueue.la(n, false, true);
253
273
  }
254
274
  globalQueue.h.length = 0;
@@ -257,8 +277,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
257
277
  this.run(1 /* Render */);
258
278
  this.run(2 /* User */);
259
279
  } finally {
260
- this.ca = false;
261
- unobserved.length && notifyUnobserved();
280
+ this.da = false;
262
281
  }
263
282
  }
264
283
  notify(node, mask, flags) {
@@ -279,7 +298,7 @@ var GlobalQueue = class _GlobalQueue extends Queue {
279
298
  time: clock,
280
299
  pendingNodes: [],
281
300
  asyncNodes: [],
282
- queues: [[], []]
301
+ queueStash: { k: [[], []], m: [] }
283
302
  };
284
303
  }
285
304
  transitions.add(activeTransition);
@@ -298,8 +317,8 @@ function runPending(pendingNodes, value) {
298
317
  for (let i = 0; i < p.length; i++) {
299
318
  const n = p[i];
300
319
  n.T = activeTransition;
301
- if (n.G) {
302
- n.G.da(value);
320
+ if (n.I) {
321
+ n.I.ea(value);
303
322
  needsReset = true;
304
323
  }
305
324
  }
@@ -325,15 +344,6 @@ function transitionComplete(transition) {
325
344
  }
326
345
  return done;
327
346
  }
328
- function notifyUnobserved() {
329
- var _a, _b;
330
- for (let i = 0; i < unobserved.length; i++) {
331
- const source = unobserved[i];
332
- if (!source.r)
333
- (_b = (_a = unobserved[i]).sa) == null ? void 0 : _b.call(_a);
334
- }
335
- unobserved = [];
336
- }
337
347
 
338
348
  // src/core/core.ts
339
349
  GlobalQueue.S = recompute;
@@ -344,6 +354,14 @@ var pendingValueCheck = false;
344
354
  var pendingCheck = null;
345
355
  var context = null;
346
356
  var defaultContext = {};
357
+ function notifySubs(node) {
358
+ for (let s = node.x; s !== null; s = s.A) {
359
+ const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
360
+ if (queue.q > s.j.c)
361
+ queue.q = s.j.c;
362
+ insertIntoHeap(s.j, queue);
363
+ }
364
+ }
347
365
  function recompute(el, create = false) {
348
366
  var _a;
349
367
  deleteFromHeap(el, el.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
@@ -352,16 +370,16 @@ function recompute(el, create = false) {
352
370
  else {
353
371
  markDisposal(el);
354
372
  globalQueue.h.push(el);
355
- el.V = el.s;
356
- el.U = el.o;
357
- el.s = null;
358
- el.o = null;
373
+ el.V = el.t;
374
+ el.U = el.r;
375
+ el.t = null;
376
+ el.r = null;
359
377
  }
360
378
  const oldcontext = context;
361
379
  context = el;
362
- el.H = null;
380
+ el.F = null;
363
381
  el.b = 4 /* RecomputingDeps */;
364
- el.W = clock;
382
+ el.J = clock;
365
383
  let value = el.e === NOT_PENDING ? el.g : el.e;
366
384
  let oldHeight = el.c;
367
385
  let prevStatusFlags = el.f;
@@ -370,7 +388,7 @@ function recompute(el, create = false) {
370
388
  clearStatusFlags(el);
371
389
  tracking = true;
372
390
  try {
373
- value = el.ha(value);
391
+ value = el.H(value);
374
392
  } catch (e) {
375
393
  if (e instanceof NotReadyError) {
376
394
  if (e.cause !== el)
@@ -384,8 +402,8 @@ function recompute(el, create = false) {
384
402
  }
385
403
  el.b = 0 /* None */;
386
404
  context = oldcontext;
387
- const depsTail = el.H;
388
- let toRemove = depsTail !== null ? depsTail.E : el.u;
405
+ const depsTail = el.F;
406
+ let toRemove = depsTail !== null ? depsTail.E : el.l;
389
407
  if (toRemove !== null) {
390
408
  do {
391
409
  toRemove = unlinkSubs(toRemove);
@@ -393,15 +411,15 @@ function recompute(el, create = false) {
393
411
  if (depsTail !== null) {
394
412
  depsTail.E = null;
395
413
  } else {
396
- el.u = null;
414
+ el.l = null;
397
415
  }
398
416
  }
399
- const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, value);
417
+ const valueChanged = !el.fa || !el.fa(el.e === NOT_PENDING ? el.g : el.e, value);
400
418
  const statusFlagsChanged = el.f !== prevStatusFlags || el.B !== prevError;
401
419
  (_a = el.ma) == null ? void 0 : _a.call(el, statusFlagsChanged, prevStatusFlags);
402
420
  if (valueChanged || statusFlagsChanged) {
403
421
  if (valueChanged) {
404
- if (create || el.ia || el.I)
422
+ if (create || el.ja || el.K)
405
423
  el.g = value;
406
424
  else {
407
425
  if (el.e === NOT_PENDING)
@@ -409,26 +427,26 @@ function recompute(el, create = false) {
409
427
  el.e = value;
410
428
  }
411
429
  if (el.C)
412
- el.C.da(value);
430
+ el.C.ea(value);
413
431
  }
414
- for (let s = el.r; s !== null; s = s.y) {
432
+ for (let s = el.x; s !== null; s = s.A) {
415
433
  const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
416
- if (s.j.c < el.c && queue.n > s.j.c)
417
- queue.n = s.j.c;
434
+ if (s.j.c < el.c && queue.q > s.j.c)
435
+ queue.q = s.j.c;
418
436
  insertIntoHeap(s.j, queue);
419
437
  }
420
438
  } else if (el.c != oldHeight) {
421
- for (let s = el.r; s !== null; s = s.y) {
439
+ for (let s = el.x; s !== null; s = s.A) {
422
440
  insertIntoHeapHeight(s.j, s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
423
441
  }
424
442
  }
425
443
  }
426
444
  function updateIfNecessary(el) {
427
445
  if (el.b & 1 /* Check */) {
428
- for (let d = el.u; d; d = d.E) {
429
- const dep1 = d.Q;
430
- const dep = "_owner" in dep1 ? dep1.z : dep1;
431
- if ("_fn" in dep) {
446
+ for (let d = el.l; d; d = d.E) {
447
+ const dep1 = d.R;
448
+ const dep = dep1.ia || dep1;
449
+ if (dep.H) {
432
450
  updateIfNecessary(dep);
433
451
  }
434
452
  if (el.b & 2 /* Dirty */) {
@@ -442,62 +460,76 @@ function updateIfNecessary(el) {
442
460
  el.b = 0 /* None */;
443
461
  }
444
462
  function unlinkSubs(link2) {
445
- const dep = link2.Q;
463
+ var _a;
464
+ const dep = link2.R;
446
465
  const nextDep = link2.E;
447
- const nextSub = link2.y;
466
+ const nextSub = link2.A;
448
467
  const prevSub = link2.na;
449
468
  if (nextSub !== null) {
450
469
  nextSub.na = prevSub;
451
470
  } else {
452
- dep.X = prevSub;
471
+ dep.W = prevSub;
453
472
  }
454
473
  if (prevSub !== null) {
455
- prevSub.y = nextSub;
474
+ prevSub.A = nextSub;
456
475
  } else {
457
- dep.r = nextSub;
476
+ dep.x = nextSub;
477
+ if (nextSub === null) {
478
+ (_a = dep.ta) == null ? void 0 : _a.call(dep);
479
+ dep.H && unobserved(dep);
480
+ }
458
481
  }
459
482
  return nextDep;
460
483
  }
484
+ function unobserved(el) {
485
+ deleteFromHeap(el, el.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
486
+ let dep = el.l;
487
+ while (dep !== null) {
488
+ dep = unlinkSubs(dep);
489
+ }
490
+ el.l = null;
491
+ runDisposal(el);
492
+ }
461
493
  function link(dep, sub) {
462
- const prevDep = sub.H;
463
- if (prevDep !== null && prevDep.Q === dep) {
494
+ const prevDep = sub.F;
495
+ if (prevDep !== null && prevDep.R === dep) {
464
496
  return;
465
497
  }
466
498
  let nextDep = null;
467
499
  const isRecomputing = sub.b & 4 /* RecomputingDeps */;
468
500
  if (isRecomputing) {
469
- nextDep = prevDep !== null ? prevDep.E : sub.u;
470
- if (nextDep !== null && nextDep.Q === dep) {
471
- sub.H = nextDep;
501
+ nextDep = prevDep !== null ? prevDep.E : sub.l;
502
+ if (nextDep !== null && nextDep.R === dep) {
503
+ sub.F = nextDep;
472
504
  return;
473
505
  }
474
506
  }
475
- const prevSub = dep.X;
507
+ const prevSub = dep.W;
476
508
  if (prevSub !== null && prevSub.j === sub && (!isRecomputing || isValidLink(prevSub, sub))) {
477
509
  return;
478
510
  }
479
- const newLink = sub.H = dep.X = {
480
- Q: dep,
511
+ const newLink = sub.F = dep.W = {
512
+ R: dep,
481
513
  j: sub,
482
514
  E: nextDep,
483
515
  na: prevSub,
484
- y: null
516
+ A: null
485
517
  };
486
518
  if (prevDep !== null) {
487
519
  prevDep.E = newLink;
488
520
  } else {
489
- sub.u = newLink;
521
+ sub.l = newLink;
490
522
  }
491
523
  if (prevSub !== null) {
492
- prevSub.y = newLink;
524
+ prevSub.A = newLink;
493
525
  } else {
494
- dep.r = newLink;
526
+ dep.x = newLink;
495
527
  }
496
528
  }
497
529
  function isValidLink(checkLink, sub) {
498
- const depsTail = sub.H;
530
+ const depsTail = sub.F;
499
531
  if (depsTail !== null) {
500
- let link2 = sub.u;
532
+ let link2 = sub.l;
501
533
  do {
502
534
  if (link2 === checkLink) {
503
535
  return true;
@@ -515,13 +547,13 @@ function setStatusFlags(signal2, flags, error = null) {
515
547
  signal2.B = error;
516
548
  }
517
549
  function setError(signal2, error) {
518
- setStatusFlags(signal2, 2 /* Error */ | 4 /* Uninitialized */, error);
550
+ setStatusFlags(signal2, 2 /* Error */, error);
519
551
  }
520
552
  function clearStatusFlags(signal2) {
521
553
  setStatusFlags(signal2, 0 /* None */);
522
554
  }
523
555
  function markDisposal(el) {
524
- let child = el.o;
556
+ let child = el.r;
525
557
  while (child) {
526
558
  child.b |= 32 /* Zombie */;
527
559
  const inHeap = child.b & 8 /* InHeap */;
@@ -530,26 +562,35 @@ function markDisposal(el) {
530
562
  insertIntoHeap(child, zombieQueue);
531
563
  }
532
564
  markDisposal(child);
533
- child = child.K;
565
+ child = child.M;
534
566
  }
535
567
  }
568
+ function dispose(node) {
569
+ let toRemove = node.l || null;
570
+ do {
571
+ toRemove = unlinkSubs(toRemove);
572
+ } while (toRemove !== null);
573
+ node.l = null;
574
+ node.F = null;
575
+ disposeChildren(node, true);
576
+ }
536
577
  function disposeChildren(node, self = false, zombie) {
537
578
  if (node.b & 64 /* Disposed */)
538
579
  return;
539
580
  if (self)
540
581
  node.b = 64 /* Disposed */;
541
- let child = zombie ? node.U : node.o;
582
+ let child = zombie ? node.U : node.r;
542
583
  while (child) {
543
- const nextChild = child.K;
544
- if (child.u) {
584
+ const nextChild = child.M;
585
+ if (child.l) {
545
586
  const n = child;
546
587
  deleteFromHeap(n, n.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue);
547
- let toRemove = n.u;
588
+ let toRemove = n.l;
548
589
  do {
549
590
  toRemove = unlinkSubs(toRemove);
550
591
  } while (toRemove !== null);
551
- n.u = null;
552
- n.H = null;
592
+ n.l = null;
593
+ n.F = null;
553
594
  }
554
595
  disposeChildren(child, true);
555
596
  child = nextChild;
@@ -557,13 +598,13 @@ function disposeChildren(node, self = false, zombie) {
557
598
  if (zombie) {
558
599
  node.U = null;
559
600
  } else {
560
- node.o = null;
561
- node.K = null;
601
+ node.r = null;
602
+ node.M = null;
562
603
  }
563
604
  runDisposal(node, zombie);
564
605
  }
565
606
  function runDisposal(node, zombie) {
566
- let disposal = zombie ? node.V : node.s;
607
+ let disposal = zombie ? node.V : node.t;
567
608
  if (!disposal)
568
609
  return;
569
610
  if (Array.isArray(disposal)) {
@@ -574,15 +615,15 @@ function runDisposal(node, zombie) {
574
615
  } else {
575
616
  disposal.call(disposal);
576
617
  }
577
- zombie ? node.V = null : node.s = null;
618
+ zombie ? node.V = null : node.t = null;
578
619
  }
579
620
  function withOptions(obj, options) {
580
621
  obj.id = (options == null ? void 0 : options.id) ?? ((context == null ? void 0 : context.id) != null ? getNextChildId(context) : void 0);
581
- obj.ea = (options == null ? void 0 : options.equals) != null ? options.equals : isEqual;
582
- obj.ya = !!(options == null ? void 0 : options.pureWrite);
583
- obj.sa = options == null ? void 0 : options.unobserved;
584
- if (options == null ? void 0 : options.ja)
585
- Object.assign(obj, options.ja);
622
+ obj.fa = (options == null ? void 0 : options.equals) != null ? options.equals : isEqual;
623
+ obj.za = !!(options == null ? void 0 : options.pureWrite);
624
+ obj.ta = options == null ? void 0 : options.unobserved;
625
+ if (options == null ? void 0 : options.ka)
626
+ Object.assign(obj, options.ka);
586
627
  return obj;
587
628
  }
588
629
  function getNextChildId(owner) {
@@ -597,43 +638,43 @@ function formatId(prefix, id) {
597
638
  function computed(fn, initialValue, options) {
598
639
  const self = withOptions(
599
640
  {
600
- s: null,
641
+ t: null,
601
642
  i: globalQueue,
602
643
  D: defaultContext,
603
644
  oa: 0,
604
- ha: fn,
645
+ H: fn,
605
646
  g: initialValue,
606
647
  c: 0,
607
- ba: null,
608
- P: void 0,
648
+ ca: null,
649
+ Q: void 0,
650
+ z: null,
651
+ l: null,
652
+ F: null,
609
653
  x: null,
610
- u: null,
611
- H: null,
654
+ W: null,
655
+ w: context,
656
+ M: null,
612
657
  r: null,
613
- X: null,
614
- q: context,
615
- K: null,
616
- o: null,
617
658
  b: 0 /* None */,
618
659
  f: 4 /* Uninitialized */,
619
- W: clock,
660
+ J: clock,
620
661
  e: NOT_PENDING,
621
662
  V: null,
622
663
  U: null
623
664
  },
624
665
  options
625
666
  );
626
- self.x = self;
627
- const parent = (context == null ? void 0 : context._) ? context.$ : context;
667
+ self.z = self;
668
+ const parent = (context == null ? void 0 : context.$) ? context.aa : context;
628
669
  if (context) {
629
670
  context.i && (self.i = context.i);
630
671
  context.D && (self.D = context.D);
631
- const lastChild = context.o;
672
+ const lastChild = context.r;
632
673
  if (lastChild === null) {
633
- context.o = self;
674
+ context.r = self;
634
675
  } else {
635
- self.K = lastChild;
636
- context.o = self;
676
+ self.M = lastChild;
677
+ context.r = self;
637
678
  }
638
679
  }
639
680
  if (parent)
@@ -665,6 +706,9 @@ function asyncComputed(asyncFn, initialValue, options) {
665
706
  return;
666
707
  globalQueue.initTransition(self);
667
708
  setError(self, e);
709
+ self.J = clock;
710
+ notifySubs(self);
711
+ schedule();
668
712
  flush();
669
713
  });
670
714
  } else {
@@ -682,6 +726,9 @@ function asyncComputed(asyncFn, initialValue, options) {
682
726
  return;
683
727
  globalQueue.initTransition(self);
684
728
  setError(self, error);
729
+ self.J = clock;
730
+ notifySubs(self);
731
+ schedule();
685
732
  flush();
686
733
  }
687
734
  })();
@@ -690,7 +737,7 @@ function asyncComputed(asyncFn, initialValue, options) {
690
737
  throw new NotReadyError(context);
691
738
  };
692
739
  const self = computed(fn, initialValue, options);
693
- self.ta = () => {
740
+ self.ua = () => {
694
741
  refreshing = true;
695
742
  recompute(self);
696
743
  flush();
@@ -699,15 +746,15 @@ function asyncComputed(asyncFn, initialValue, options) {
699
746
  }
700
747
  function signal(v, options, firewall = null) {
701
748
  if (firewall !== null) {
702
- return firewall.ba = withOptions(
749
+ return firewall.ca = withOptions(
703
750
  {
704
751
  g: v,
705
- r: null,
706
- X: null,
707
- z: firewall,
708
- ra: firewall.ba,
752
+ x: null,
753
+ W: null,
754
+ ia: firewall,
755
+ sa: firewall.ca,
709
756
  f: 0 /* None */,
710
- W: clock,
757
+ J: clock,
711
758
  e: NOT_PENDING
712
759
  },
713
760
  options
@@ -716,10 +763,10 @@ function signal(v, options, firewall = null) {
716
763
  return withOptions(
717
764
  {
718
765
  g: v,
719
- r: null,
720
- X: null,
766
+ x: null,
767
+ W: null,
721
768
  f: 0 /* None */,
722
- W: clock,
769
+ J: clock,
723
770
  e: NOT_PENDING
724
771
  },
725
772
  options
@@ -741,34 +788,34 @@ function untrack(fn) {
741
788
  }
742
789
  function read(el) {
743
790
  let c = context;
744
- if (c == null ? void 0 : c._)
745
- c = c.$;
791
+ if (c == null ? void 0 : c.$)
792
+ c = c.aa;
746
793
  if (c && tracking) {
747
794
  link(el, c);
748
- const owner = "_owner" in el ? el.z : el;
749
- if ("_fn" in owner) {
795
+ const owner = el.ia || el;
796
+ if (owner.H) {
750
797
  const isZombie = el.b & 32 /* Zombie */;
751
- if (owner.c >= (isZombie ? zombieQueue.n : dirtyQueue.n)) {
798
+ if (owner.c >= (isZombie ? zombieQueue.q : dirtyQueue.q)) {
752
799
  markNode(c);
753
800
  markHeap(isZombie ? zombieQueue : dirtyQueue);
754
801
  updateIfNecessary(owner);
755
802
  }
756
803
  const height = owner.c;
757
- if (height >= c.c && el.q !== c) {
804
+ if (height >= c.c && el.w !== c) {
758
805
  c.c = height + 1;
759
806
  }
760
807
  }
761
808
  }
762
809
  if (pendingCheck) {
763
810
  const pendingResult = (el.f & 1 /* Pending */) !== 0 || !!el.T || false;
764
- if (!el.G) {
765
- el.G = signal(pendingResult);
766
- el.G.ia = true;
767
- el.G.da = (v) => setSignal(el.G, v);
811
+ if (!el.I) {
812
+ el.I = signal(pendingResult);
813
+ el.I.ja = true;
814
+ el.I.ea = (v) => setSignal(el.I, v);
768
815
  }
769
816
  const prev = pendingCheck;
770
817
  pendingCheck = null;
771
- read(el.G);
818
+ read(el.I);
772
819
  pendingCheck = prev;
773
820
  prev.g = pendingResult || prev.g;
774
821
  }
@@ -777,8 +824,8 @@ function read(el) {
777
824
  el.C = signal(
778
825
  el.e === NOT_PENDING ? el.g : el.e
779
826
  );
780
- el.C.ia = true;
781
- el.C.da = (v) => queueMicrotask(() => queueMicrotask(() => setSignal(el.C, v)));
827
+ el.C.ja = true;
828
+ el.C.ea = (v) => queueMicrotask(() => queueMicrotask(() => setSignal(el.C, v)));
782
829
  }
783
830
  pendingValueCheck = false;
784
831
  try {
@@ -799,7 +846,7 @@ function read(el) {
799
846
  }
800
847
  }
801
848
  if (el.f & 2 /* Error */) {
802
- if (el.W < clock) {
849
+ if (el.J < clock) {
803
850
  recompute(el, true);
804
851
  return read(el);
805
852
  } else {
@@ -814,11 +861,11 @@ function setSignal(el, v) {
814
861
  el.e === NOT_PENDING ? el.g : el.e
815
862
  );
816
863
  }
817
- const valueChanged = !el.ea || !el.ea(el.e === NOT_PENDING ? el.g : el.e, v);
864
+ const valueChanged = !el.fa || !el.fa(el.e === NOT_PENDING ? el.g : el.e, v);
818
865
  if (!valueChanged && !el.f)
819
866
  return v;
820
867
  if (valueChanged) {
821
- if (el.ia)
868
+ if (el.ja)
822
869
  el.g = v;
823
870
  else {
824
871
  if (el.e === NOT_PENDING)
@@ -826,16 +873,11 @@ function setSignal(el, v) {
826
873
  el.e = v;
827
874
  }
828
875
  if (el.C)
829
- el.C.da(v);
876
+ el.C.ea(v);
830
877
  }
831
878
  clearStatusFlags(el);
832
- el.W = clock;
833
- for (let s = el.r; s !== null; s = s.y) {
834
- const queue = s.j.b & 32 /* Zombie */ ? zombieQueue : dirtyQueue;
835
- if (queue.n > s.j.c)
836
- queue.n = s.j.c;
837
- insertIntoHeap(s.j, queue);
838
- }
879
+ el.J = clock;
880
+ notifySubs(el);
839
881
  schedule();
840
882
  return v;
841
883
  }
@@ -849,41 +891,41 @@ function onCleanup(fn) {
849
891
  if (!context)
850
892
  return fn;
851
893
  const node = context;
852
- if (!node.s) {
853
- node.s = fn;
854
- } else if (Array.isArray(node.s)) {
855
- node.s.push(fn);
894
+ if (!node.t) {
895
+ node.t = fn;
896
+ } else if (Array.isArray(node.t)) {
897
+ node.t.push(fn);
856
898
  } else {
857
- node.s = [node.s, fn];
899
+ node.t = [node.t, fn];
858
900
  }
859
901
  return fn;
860
902
  }
861
903
  function createOwner(options) {
862
904
  const parent = context;
863
905
  const owner = {
864
- _: true,
865
- $: (parent == null ? void 0 : parent._) ? parent.$ : parent,
866
- o: null,
867
- K: null,
868
- s: null,
906
+ $: true,
907
+ aa: (parent == null ? void 0 : parent.$) ? parent.aa : parent,
908
+ r: null,
909
+ M: null,
910
+ t: null,
869
911
  id: (options == null ? void 0 : options.id) ?? ((parent == null ? void 0 : parent.id) != null ? getNextChildId(parent) : void 0),
870
912
  i: (parent == null ? void 0 : parent.i) ?? globalQueue,
871
913
  D: (parent == null ? void 0 : parent.D) || defaultContext,
872
914
  oa: 0,
873
915
  V: null,
874
916
  U: null,
875
- q: parent,
917
+ w: parent,
876
918
  dispose(self = true) {
877
919
  disposeChildren(owner, self);
878
920
  }
879
921
  };
880
922
  if (parent) {
881
- const lastChild = parent.o;
923
+ const lastChild = parent.r;
882
924
  if (lastChild === null) {
883
- parent.o = owner;
925
+ parent.r = owner;
884
926
  } else {
885
- owner.K = lastChild;
886
- parent.o = owner;
927
+ owner.M = lastChild;
928
+ parent.r = owner;
887
929
  }
888
930
  }
889
931
  return owner;
@@ -972,30 +1014,30 @@ function effect(compute, effect2, error, initialValue, options) {
972
1014
  let initialized = false;
973
1015
  const node = computed(compute, initialValue, {
974
1016
  ...options,
975
- ja: {
976
- fa: true,
1017
+ ka: {
1018
+ ga: true,
977
1019
  pa: initialValue,
978
- ua: effect2,
1020
+ va: effect2,
979
1021
  qa: error,
980
- L: void 0,
1022
+ N: void 0,
981
1023
  i: ((_a = getOwner()) == null ? void 0 : _a.i) ?? globalQueue,
982
- I: (options == null ? void 0 : options.render) ? 1 /* Render */ : 2 /* User */,
1024
+ K: (options == null ? void 0 : options.render) ? 1 /* Render */ : 2 /* User */,
983
1025
  ma(statusFlagsChanged, prevStatusFlags) {
984
1026
  if (initialized) {
985
1027
  const errorChanged = this.f && this.f === prevStatusFlags && statusFlagsChanged;
986
- this.fa = !(this.f & 2 /* Error */) && !(this.f & 1 /* Pending */ & ~prevStatusFlags) && !errorChanged;
987
- if (this.fa)
988
- this.i.enqueue(this.I, runEffect.bind(this));
1028
+ this.ga = !(this.f & 2 /* Error */) && !(this.f & 1 /* Pending */ & ~prevStatusFlags) && !errorChanged;
1029
+ if (this.ga)
1030
+ this.i.enqueue(this.K, runEffect.bind(this));
989
1031
  }
990
1032
  if (this.f & 2 /* Error */) {
991
1033
  let error2 = this.B;
992
1034
  this.i.notify(this, 1 /* Pending */, 0);
993
- if (this.I === 2 /* User */) {
1035
+ if (this.K === 2 /* User */) {
994
1036
  try {
995
1037
  return this.qa ? this.qa(error2, () => {
996
1038
  var _a2;
997
- (_a2 = this.L) == null ? void 0 : _a2.call(this);
998
- this.L = void 0;
1039
+ (_a2 = this.N) == null ? void 0 : _a2.call(this);
1040
+ this.N = void 0;
999
1041
  }) : console.error(error2);
1000
1042
  } catch (e) {
1001
1043
  error2 = e;
@@ -1003,7 +1045,7 @@ function effect(compute, effect2, error, initialValue, options) {
1003
1045
  }
1004
1046
  if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
1005
1047
  throw error2;
1006
- } else if (this.I === 1 /* Render */) {
1048
+ } else if (this.K === 1 /* Render */) {
1007
1049
  this.i.notify(
1008
1050
  this,
1009
1051
  1 /* Pending */ | 2 /* Error */,
@@ -1014,29 +1056,28 @@ function effect(compute, effect2, error, initialValue, options) {
1014
1056
  }
1015
1057
  });
1016
1058
  initialized = true;
1017
- if (node.I === 1 /* Render */) {
1018
- node.ha = (p) => !(node.f & 2 /* Error */) ? staleValues(() => compute(p)) : compute(p);
1019
- }
1020
- !(options == null ? void 0 : options.defer) && !(node.f & (2 /* Error */ | 1 /* Pending */)) && (node.I === 2 /* User */ ? node.i.enqueue(node.I, runEffect.bind(node)) : runEffect.call(node));
1059
+ if (node.K === 1 /* Render */)
1060
+ node.H = (p) => staleValues(() => compute(p));
1061
+ !(options == null ? void 0 : options.defer) && !(node.f & (2 /* Error */ | 1 /* Pending */)) && (node.K === 2 /* User */ ? node.i.enqueue(node.K, runEffect.bind(node)) : runEffect.call(node));
1021
1062
  onCleanup(() => {
1022
1063
  var _a2;
1023
- return (_a2 = node.L) == null ? void 0 : _a2.call(node);
1064
+ return (_a2 = node.N) == null ? void 0 : _a2.call(node);
1024
1065
  });
1025
1066
  }
1026
1067
  function runEffect() {
1027
1068
  var _a;
1028
- if (!this.fa || this.b & 64 /* Disposed */)
1069
+ if (!this.ga || this.b & 64 /* Disposed */)
1029
1070
  return;
1030
- (_a = this.L) == null ? void 0 : _a.call(this);
1031
- this.L = void 0;
1071
+ (_a = this.N) == null ? void 0 : _a.call(this);
1072
+ this.N = void 0;
1032
1073
  try {
1033
- this.L = this.ua(this.g, this.pa);
1074
+ this.N = this.va(this.g, this.pa);
1034
1075
  } catch (error) {
1035
1076
  if (!this.i.notify(this, 2 /* Error */, 2 /* Error */))
1036
1077
  throw error;
1037
1078
  } finally {
1038
1079
  this.pa = this.g;
1039
- this.fa = false;
1080
+ this.ga = false;
1040
1081
  }
1041
1082
  }
1042
1083
 
@@ -1067,7 +1108,7 @@ function createMemo(compute, value, options) {
1067
1108
  function createAsync(compute, value, options) {
1068
1109
  const node = asyncComputed(compute, value, options);
1069
1110
  const ret = read.bind(null, node);
1070
- ret.refresh = node.ta;
1111
+ ret.refresh = node.ua;
1071
1112
  return ret;
1072
1113
  }
1073
1114
  function createEffect(compute, effectFn, value, options) {
@@ -1087,11 +1128,30 @@ function createRenderEffect(compute, effectFn, value, options) {
1087
1128
  }
1088
1129
  function createTrackedEffect(compute, options) {
1089
1130
  }
1090
- function createReaction(effect2, options) {
1131
+ function createReaction(effectFn, options) {
1132
+ let cleanup = void 0;
1133
+ onCleanup(() => cleanup == null ? void 0 : cleanup());
1134
+ return (tracking2) => {
1135
+ effect(
1136
+ () => (tracking2(), getOwner()),
1137
+ (node) => {
1138
+ var _a;
1139
+ cleanup == null ? void 0 : cleanup();
1140
+ cleanup = (_a = effectFn.effect || effectFn) == null ? void 0 : _a();
1141
+ dispose(node);
1142
+ },
1143
+ effectFn.error,
1144
+ void 0,
1145
+ {
1146
+ defer: true,
1147
+ ...options
1148
+ }
1149
+ );
1150
+ };
1091
1151
  }
1092
1152
  function resolve(fn) {
1093
1153
  return new Promise((res, rej) => {
1094
- createRoot((dispose) => {
1154
+ createRoot((dispose2) => {
1095
1155
  computed(() => {
1096
1156
  try {
1097
1157
  res(fn());
@@ -1100,7 +1160,7 @@ function resolve(fn) {
1100
1160
  throw err;
1101
1161
  rej(err);
1102
1162
  }
1103
- dispose();
1163
+ dispose2();
1104
1164
  });
1105
1165
  });
1106
1166
  });
@@ -1109,6 +1169,14 @@ function createOptimistic(first, second, third) {
1109
1169
  return {};
1110
1170
  }
1111
1171
  function onSettled(callback) {
1172
+ let cleanup;
1173
+ const o = getOwner();
1174
+ if (o)
1175
+ onCleanup(() => cleanup == null ? void 0 : cleanup());
1176
+ globalQueue.enqueue(2 /* User */, () => {
1177
+ cleanup = callback();
1178
+ !o && (cleanup == null ? void 0 : cleanup());
1179
+ });
1112
1180
  }
1113
1181
 
1114
1182
  // src/store/reconcile.ts
@@ -1245,24 +1313,18 @@ function reconcile(value, key, all = false) {
1245
1313
  function createProjectionInternal(fn, initialValue = {}, options) {
1246
1314
  let node;
1247
1315
  const wrappedMap = /* @__PURE__ */ new WeakMap();
1248
- const traps = {
1249
- ...storeTraps,
1250
- get(target, property, receiver) {
1251
- const o = getOwner();
1252
- const n = node;
1253
- (!o || o !== n) && n && read(n);
1254
- return storeTraps.get(target, property, receiver);
1255
- }
1256
- };
1257
1316
  const wrapProjection = (source) => {
1258
1317
  var _a;
1259
1318
  if (wrappedMap.has(source))
1260
1319
  return wrappedMap.get(source);
1261
1320
  if (((_a = source[$TARGET]) == null ? void 0 : _a[STORE_WRAP]) === wrapProjection)
1262
1321
  return source;
1263
- const wrapped = createStoreProxy(source, traps, {
1322
+ const wrapped = createStoreProxy(source, storeTraps, {
1264
1323
  [STORE_WRAP]: wrapProjection,
1265
- [STORE_LOOKUP]: wrappedMap
1324
+ [STORE_LOOKUP]: wrappedMap,
1325
+ [STORE_FIREWALL]() {
1326
+ return node;
1327
+ }
1266
1328
  });
1267
1329
  wrappedMap.set(source, wrapped);
1268
1330
  return wrapped;
@@ -1295,6 +1357,7 @@ var STORE_NODE = "n";
1295
1357
  var STORE_HAS = "h";
1296
1358
  var STORE_WRAP = "w";
1297
1359
  var STORE_LOOKUP = "l";
1360
+ var STORE_FIREWALL = "f";
1298
1361
  function createStoreProxy(value, traps = storeTraps, extend) {
1299
1362
  let newTarget;
1300
1363
  if (Array.isArray(value)) {
@@ -1323,18 +1386,25 @@ function getNodes(target, type) {
1323
1386
  target[type] = nodes = /* @__PURE__ */ Object.create(null);
1324
1387
  return nodes;
1325
1388
  }
1326
- function getNode(nodes, property, value, equals = isEqual) {
1389
+ function getNode(nodes, property, value, firewall, equals = isEqual) {
1327
1390
  if (nodes[property])
1328
1391
  return nodes[property];
1329
- return nodes[property] = signal(value, {
1330
- equals,
1331
- unobserved() {
1332
- delete nodes[property];
1333
- }
1334
- });
1392
+ return nodes[property] = signal(
1393
+ value,
1394
+ {
1395
+ equals,
1396
+ unobserved() {
1397
+ delete nodes[property];
1398
+ }
1399
+ },
1400
+ firewall
1401
+ );
1335
1402
  }
1336
1403
  function trackSelf(target, symbol = $TRACK) {
1337
- getObserver() && read(getNode(getNodes(target, STORE_NODE), symbol, void 0, false));
1404
+ var _a;
1405
+ getObserver() && read(
1406
+ getNode(getNodes(target, STORE_NODE), symbol, void 0, (_a = target[STORE_FIREWALL]) == null ? void 0 : _a.call(target), false)
1407
+ );
1338
1408
  }
1339
1409
  function getKeys(source, override, enumerable = true) {
1340
1410
  const baseKeys = untrack(() => enumerable ? Object.keys(source) : Reflect.ownKeys(source));
@@ -1363,6 +1433,7 @@ function getPropertyDescriptor(source, override, property) {
1363
1433
  var Writing = null;
1364
1434
  var storeTraps = {
1365
1435
  get(target, property, receiver) {
1436
+ var _a;
1366
1437
  if (property === $TARGET)
1367
1438
  return target;
1368
1439
  if (property === $PROXY)
@@ -1397,16 +1468,24 @@ var storeTraps = {
1397
1468
  let proto;
1398
1469
  return !Array.isArray(target[STORE_VALUE]) && (proto = Object.getPrototypeOf(target[STORE_VALUE])) && proto !== Object.prototype ? value.bind(storeValue) : value;
1399
1470
  } else if (getObserver()) {
1400
- return read(getNode(nodes, property, isWrappable(value) ? wrap(value, target) : value));
1471
+ return read(
1472
+ getNode(
1473
+ nodes,
1474
+ property,
1475
+ isWrappable(value) ? wrap(value, target) : value,
1476
+ (_a = target[STORE_FIREWALL]) == null ? void 0 : _a.call(target)
1477
+ )
1478
+ );
1401
1479
  }
1402
1480
  }
1403
1481
  return isWrappable(value) ? wrap(value, target) : value;
1404
1482
  },
1405
1483
  has(target, property) {
1484
+ var _a;
1406
1485
  if (property === $PROXY || property === $TRACK || property === "__proto__")
1407
1486
  return true;
1408
1487
  const has = target[STORE_OVERRIDE] && property in target[STORE_OVERRIDE] ? target[STORE_OVERRIDE][property] !== $DELETED : property in target[STORE_VALUE];
1409
- getObserver() && read(getNode(getNodes(target, STORE_HAS), property, has));
1488
+ getObserver() && read(getNode(getNodes(target, STORE_HAS), property, has, (_a = target[STORE_FIREWALL]) == null ? void 0 : _a.call(target)));
1410
1489
  return has;
1411
1490
  },
1412
1491
  set(target, property, rawValue) {
@@ -1786,52 +1865,52 @@ function mapArray(list, map, options) {
1786
1865
  const keyFn = typeof (options == null ? void 0 : options.keyed) === "function" ? options.keyed : void 0;
1787
1866
  return createMemo(
1788
1867
  updateKeyedMap.bind({
1789
- z: createOwner(),
1790
- k: 0,
1791
- va: list,
1792
- F: [],
1793
- M: map,
1868
+ X: createOwner(),
1869
+ n: 0,
1870
+ wa: list,
1871
+ G: [],
1872
+ O: map,
1794
1873
  d: [],
1795
1874
  a: [],
1796
- N: keyFn,
1797
- l: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
1798
- m: map.length > 1 ? [] : void 0,
1875
+ P: keyFn,
1876
+ o: keyFn || (options == null ? void 0 : options.keyed) === false ? [] : void 0,
1877
+ p: map.length > 1 ? [] : void 0,
1799
1878
  Y: options == null ? void 0 : options.fallback
1800
1879
  })
1801
1880
  );
1802
1881
  }
1803
1882
  var pureOptions = { pureWrite: true };
1804
1883
  function updateKeyedMap() {
1805
- const newItems = this.va() || [], newLen = newItems.length;
1884
+ const newItems = this.wa() || [], newLen = newItems.length;
1806
1885
  newItems[$TRACK];
1807
- runWithOwner(this.z, () => {
1808
- let i, j, mapper = this.l ? () => {
1809
- this.l[j] = signal(newItems[j], pureOptions);
1810
- this.m && (this.m[j] = signal(j, pureOptions));
1811
- return this.M(
1812
- read.bind(null, this.l[j]),
1813
- this.m ? read.bind(null, this.m[j]) : void 0
1886
+ runWithOwner(this.X, () => {
1887
+ let i, j, mapper = this.o ? () => {
1888
+ this.o[j] = signal(newItems[j], pureOptions);
1889
+ this.p && (this.p[j] = signal(j, pureOptions));
1890
+ return this.O(
1891
+ read.bind(null, this.o[j]),
1892
+ this.p ? read.bind(null, this.p[j]) : void 0
1814
1893
  );
1815
- } : this.m ? () => {
1894
+ } : this.p ? () => {
1816
1895
  const item = newItems[j];
1817
- this.m[j] = signal(j, pureOptions);
1818
- return this.M(
1896
+ this.p[j] = signal(j, pureOptions);
1897
+ return this.O(
1819
1898
  () => item,
1820
- read.bind(null, this.m[j])
1899
+ read.bind(null, this.p[j])
1821
1900
  );
1822
1901
  } : () => {
1823
1902
  const item = newItems[j];
1824
- return this.M(() => item);
1903
+ return this.O(() => item);
1825
1904
  };
1826
1905
  if (newLen === 0) {
1827
- if (this.k !== 0) {
1828
- this.z.dispose(false);
1906
+ if (this.n !== 0) {
1907
+ this.X.dispose(false);
1829
1908
  this.a = [];
1830
- this.F = [];
1909
+ this.G = [];
1831
1910
  this.d = [];
1832
- this.k = 0;
1833
- this.l && (this.l = []);
1834
- this.m && (this.m = []);
1911
+ this.n = 0;
1912
+ this.o && (this.o = []);
1913
+ this.p && (this.p = []);
1835
1914
  }
1836
1915
  if (this.Y && !this.d[0]) {
1837
1916
  this.d[0] = runWithOwner(
@@ -1839,45 +1918,45 @@ function updateKeyedMap() {
1839
1918
  this.Y
1840
1919
  );
1841
1920
  }
1842
- } else if (this.k === 0) {
1921
+ } else if (this.n === 0) {
1843
1922
  if (this.a[0])
1844
1923
  this.a[0].dispose();
1845
1924
  this.d = new Array(newLen);
1846
1925
  for (j = 0; j < newLen; j++) {
1847
- this.F[j] = newItems[j];
1926
+ this.G[j] = newItems[j];
1848
1927
  this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
1849
1928
  }
1850
- this.k = newLen;
1929
+ this.n = newLen;
1851
1930
  } else {
1852
- let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.l ? new Array(newLen) : void 0, tempIndexes = this.m ? new Array(newLen) : void 0;
1853
- for (start = 0, end = Math.min(this.k, newLen); start < end && (this.F[start] === newItems[start] || this.l && compare(this.N, this.F[start], newItems[start])); start++) {
1854
- if (this.l)
1855
- setSignal(this.l[start], newItems[start]);
1931
+ let start, end, newEnd, item, key, newIndices, newIndicesNext, temp = new Array(newLen), tempNodes = new Array(newLen), tempRows = this.o ? new Array(newLen) : void 0, tempIndexes = this.p ? new Array(newLen) : void 0;
1932
+ for (start = 0, end = Math.min(this.n, newLen); start < end && (this.G[start] === newItems[start] || this.o && compare(this.P, this.G[start], newItems[start])); start++) {
1933
+ if (this.o)
1934
+ setSignal(this.o[start], newItems[start]);
1856
1935
  }
1857
- for (end = this.k - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.F[end] === newItems[newEnd] || this.l && compare(this.N, this.F[end], newItems[newEnd])); end--, newEnd--) {
1936
+ for (end = this.n - 1, newEnd = newLen - 1; end >= start && newEnd >= start && (this.G[end] === newItems[newEnd] || this.o && compare(this.P, this.G[end], newItems[newEnd])); end--, newEnd--) {
1858
1937
  temp[newEnd] = this.d[end];
1859
1938
  tempNodes[newEnd] = this.a[end];
1860
- tempRows && (tempRows[newEnd] = this.l[end]);
1861
- tempIndexes && (tempIndexes[newEnd] = this.m[end]);
1939
+ tempRows && (tempRows[newEnd] = this.o[end]);
1940
+ tempIndexes && (tempIndexes[newEnd] = this.p[end]);
1862
1941
  }
1863
1942
  newIndices = /* @__PURE__ */ new Map();
1864
1943
  newIndicesNext = new Array(newEnd + 1);
1865
1944
  for (j = newEnd; j >= start; j--) {
1866
1945
  item = newItems[j];
1867
- key = this.N ? this.N(item) : item;
1946
+ key = this.P ? this.P(item) : item;
1868
1947
  i = newIndices.get(key);
1869
1948
  newIndicesNext[j] = i === void 0 ? -1 : i;
1870
1949
  newIndices.set(key, j);
1871
1950
  }
1872
1951
  for (i = start; i <= end; i++) {
1873
- item = this.F[i];
1874
- key = this.N ? this.N(item) : item;
1952
+ item = this.G[i];
1953
+ key = this.P ? this.P(item) : item;
1875
1954
  j = newIndices.get(key);
1876
1955
  if (j !== void 0 && j !== -1) {
1877
1956
  temp[j] = this.d[i];
1878
1957
  tempNodes[j] = this.a[i];
1879
- tempRows && (tempRows[j] = this.l[i]);
1880
- tempIndexes && (tempIndexes[j] = this.m[i]);
1958
+ tempRows && (tempRows[j] = this.o[i]);
1959
+ tempIndexes && (tempIndexes[j] = this.p[i]);
1881
1960
  j = newIndicesNext[j];
1882
1961
  newIndices.set(key, j);
1883
1962
  } else
@@ -1888,47 +1967,47 @@ function updateKeyedMap() {
1888
1967
  this.d[j] = temp[j];
1889
1968
  this.a[j] = tempNodes[j];
1890
1969
  if (tempRows) {
1891
- this.l[j] = tempRows[j];
1892
- setSignal(this.l[j], newItems[j]);
1970
+ this.o[j] = tempRows[j];
1971
+ setSignal(this.o[j], newItems[j]);
1893
1972
  }
1894
1973
  if (tempIndexes) {
1895
- this.m[j] = tempIndexes[j];
1896
- setSignal(this.m[j], j);
1974
+ this.p[j] = tempIndexes[j];
1975
+ setSignal(this.p[j], j);
1897
1976
  }
1898
1977
  } else {
1899
1978
  this.d[j] = runWithOwner(this.a[j] = createOwner(), mapper);
1900
1979
  }
1901
1980
  }
1902
- this.d = this.d.slice(0, this.k = newLen);
1903
- this.F = newItems.slice(0);
1981
+ this.d = this.d.slice(0, this.n = newLen);
1982
+ this.G = newItems.slice(0);
1904
1983
  }
1905
1984
  });
1906
1985
  return this.d;
1907
1986
  }
1908
1987
  function repeat(count, map, options) {
1909
1988
  return updateRepeat.bind({
1910
- z: createOwner(),
1911
- k: 0,
1912
- w: 0,
1913
- wa: count,
1914
- M: map,
1989
+ X: createOwner(),
1990
+ n: 0,
1991
+ y: 0,
1992
+ xa: count,
1993
+ O: map,
1915
1994
  a: [],
1916
1995
  d: [],
1917
- xa: options == null ? void 0 : options.from,
1996
+ ya: options == null ? void 0 : options.from,
1918
1997
  Y: options == null ? void 0 : options.fallback
1919
1998
  });
1920
1999
  }
1921
2000
  function updateRepeat() {
1922
2001
  var _a;
1923
- const newLen = this.wa();
1924
- const from = ((_a = this.xa) == null ? void 0 : _a.call(this)) || 0;
1925
- runWithOwner(this.z, () => {
2002
+ const newLen = this.xa();
2003
+ const from = ((_a = this.ya) == null ? void 0 : _a.call(this)) || 0;
2004
+ runWithOwner(this.X, () => {
1926
2005
  if (newLen === 0) {
1927
- if (this.k !== 0) {
1928
- this.z.dispose(false);
2006
+ if (this.n !== 0) {
2007
+ this.X.dispose(false);
1929
2008
  this.a = [];
1930
2009
  this.d = [];
1931
- this.k = 0;
2010
+ this.n = 0;
1932
2011
  }
1933
2012
  if (this.Y && !this.d[0]) {
1934
2013
  this.d[0] = runWithOwner(
@@ -1939,20 +2018,20 @@ function updateRepeat() {
1939
2018
  return;
1940
2019
  }
1941
2020
  const to = from + newLen;
1942
- const prevTo = this.w + this.k;
1943
- if (this.k === 0 && this.a[0])
2021
+ const prevTo = this.y + this.n;
2022
+ if (this.n === 0 && this.a[0])
1944
2023
  this.a[0].dispose();
1945
2024
  for (let i = to; i < prevTo; i++)
1946
- this.a[i - this.w].dispose();
1947
- if (this.w < from) {
1948
- let i = this.w;
1949
- while (i < from && i < this.k)
2025
+ this.a[i - this.y].dispose();
2026
+ if (this.y < from) {
2027
+ let i = this.y;
2028
+ while (i < from && i < this.n)
1950
2029
  this.a[i++].dispose();
1951
- this.a.splice(0, from - this.w);
1952
- this.d.splice(0, from - this.w);
1953
- } else if (this.w > from) {
1954
- let i = prevTo - this.w - 1;
1955
- let difference = this.w - from;
2030
+ this.a.splice(0, from - this.y);
2031
+ this.d.splice(0, from - this.y);
2032
+ } else if (this.y > from) {
2033
+ let i = prevTo - this.y - 1;
2034
+ let difference = this.y - from;
1956
2035
  this.a.length = this.d.length = newLen;
1957
2036
  while (i >= difference) {
1958
2037
  this.a[i] = this.a[i - difference];
@@ -1962,19 +2041,19 @@ function updateRepeat() {
1962
2041
  for (let i2 = 0; i2 < difference; i2++) {
1963
2042
  this.d[i2] = runWithOwner(
1964
2043
  this.a[i2] = createOwner(),
1965
- () => this.M(i2 + from)
2044
+ () => this.O(i2 + from)
1966
2045
  );
1967
2046
  }
1968
2047
  }
1969
2048
  for (let i = prevTo; i < to; i++) {
1970
2049
  this.d[i - from] = runWithOwner(
1971
2050
  this.a[i - from] = createOwner(),
1972
- () => this.M(i)
2051
+ () => this.O(i)
1973
2052
  );
1974
2053
  }
1975
2054
  this.d = this.d.slice(0, newLen);
1976
- this.w = from;
1977
- this.k = newLen;
2055
+ this.y = from;
2056
+ this.n = newLen;
1978
2057
  });
1979
2058
  return this.d;
1980
2059
  }
@@ -1985,7 +2064,7 @@ function compare(key, a, b) {
1985
2064
  // src/boundaries.ts
1986
2065
  function boundaryComputed(fn, propagationMask) {
1987
2066
  const node = computed(fn, void 0, {
1988
- ja: {
2067
+ ka: {
1989
2068
  ma() {
1990
2069
  let flags = this.f;
1991
2070
  this.f &= ~this.Z;
@@ -2010,20 +2089,20 @@ function createBoundChildren(owner, fn, queue, mask) {
2010
2089
  });
2011
2090
  }
2012
2091
  var ConditionalQueue = class extends Queue {
2013
- t;
2014
- ga = /* @__PURE__ */ new Set();
2092
+ u;
2093
+ ha = /* @__PURE__ */ new Set();
2015
2094
  h = /* @__PURE__ */ new Set();
2016
2095
  constructor(disabled) {
2017
2096
  super();
2018
- this.t = disabled;
2097
+ this.u = disabled;
2019
2098
  }
2020
2099
  run(type) {
2021
- if (!type || read(this.t))
2100
+ if (!type || read(this.u))
2022
2101
  return;
2023
2102
  return super.run(type);
2024
2103
  }
2025
2104
  notify(node, type, flags) {
2026
- if (read(this.t)) {
2105
+ if (read(this.u)) {
2027
2106
  if (type & 1 /* Pending */) {
2028
2107
  if (flags & 1 /* Pending */) {
2029
2108
  this.h.add(node);
@@ -2033,9 +2112,9 @@ var ConditionalQueue = class extends Queue {
2033
2112
  }
2034
2113
  if (type & 2 /* Error */) {
2035
2114
  if (flags & 2 /* Error */) {
2036
- this.ga.add(node);
2115
+ this.ha.add(node);
2037
2116
  type &= ~2 /* Error */;
2038
- } else if (this.ga.delete(node))
2117
+ } else if (this.ha.delete(node))
2039
2118
  type &= ~2 /* Error */;
2040
2119
  }
2041
2120
  }
@@ -2043,39 +2122,32 @@ var ConditionalQueue = class extends Queue {
2043
2122
  }
2044
2123
  };
2045
2124
  var CollectionQueue = class extends Queue {
2046
- O;
2125
+ _;
2047
2126
  a = /* @__PURE__ */ new Set();
2048
- t = signal(false, { pureWrite: true });
2049
- ka = false;
2127
+ u = signal(false, { pureWrite: true });
2128
+ ra = false;
2050
2129
  constructor(type) {
2051
2130
  super();
2052
- this.O = type;
2131
+ this._ = type;
2053
2132
  }
2054
2133
  run(type) {
2055
- if (!type || read(this.t))
2134
+ if (!type || read(this.u))
2056
2135
  return;
2057
2136
  return super.run(type);
2058
2137
  }
2059
- enqueue(type, fn) {
2060
- var _a;
2061
- if (this.O & 1 /* Pending */ && this.ka) {
2062
- return (_a = this.q) == null ? void 0 : _a.enqueue(type, fn);
2063
- }
2064
- return super.enqueue(type, fn);
2065
- }
2066
2138
  notify(node, type, flags) {
2067
- if (!(type & this.O) || this.O & 1 /* Pending */ && this.ka)
2139
+ if (!(type & this._) || this._ & 1 /* Pending */ && this.ra)
2068
2140
  return super.notify(node, type, flags);
2069
- if (flags & this.O) {
2141
+ if (flags & this._) {
2070
2142
  this.a.add(node);
2071
2143
  if (this.a.size === 1)
2072
- setSignal(this.t, true);
2144
+ setSignal(this.u, true);
2073
2145
  } else if (this.a.size > 0) {
2074
2146
  this.a.delete(node);
2075
2147
  if (this.a.size === 0)
2076
- setSignal(this.t, false);
2148
+ setSignal(this.u, false);
2077
2149
  }
2078
- type &= ~this.O;
2150
+ type &= ~this._;
2079
2151
  return type ? super.notify(node, type, flags) : true;
2080
2152
  }
2081
2153
  };
@@ -2084,28 +2156,28 @@ function createBoundary(fn, condition) {
2084
2156
  const queue = new ConditionalQueue(computed(() => condition() === "hidden" /* HIDDEN */));
2085
2157
  const tree = createBoundChildren(owner, fn, queue, 0);
2086
2158
  computed(() => {
2087
- const disabled = read(queue.t);
2159
+ const disabled = read(queue.u);
2088
2160
  tree.Z = disabled ? 2 /* Error */ | 1 /* Pending */ : 0;
2089
2161
  if (!disabled) {
2090
2162
  queue.h.forEach(
2091
2163
  (node) => queue.notify(node, 1 /* Pending */, 1 /* Pending */)
2092
2164
  );
2093
- queue.ga.forEach((node) => queue.notify(node, 2 /* Error */, 2 /* Error */));
2165
+ queue.ha.forEach((node) => queue.notify(node, 2 /* Error */, 2 /* Error */));
2094
2166
  queue.h.clear();
2095
- queue.ga.clear();
2167
+ queue.ha.clear();
2096
2168
  }
2097
2169
  });
2098
- return () => read(queue.t) ? void 0 : read(tree);
2170
+ return () => read(queue.u) ? void 0 : read(tree);
2099
2171
  }
2100
2172
  function createCollectionBoundary(type, fn, fallback) {
2101
2173
  const owner = createOwner();
2102
2174
  const queue = new CollectionQueue(type);
2103
2175
  const tree = createBoundChildren(owner, fn, queue, type);
2104
2176
  const decision = computed(() => {
2105
- if (!read(queue.t)) {
2177
+ if (!read(queue.u)) {
2106
2178
  const resolved = read(tree);
2107
- if (!untrack(() => read(queue.t)))
2108
- queue.ka = true;
2179
+ if (!untrack(() => read(queue.u)))
2180
+ queue.ra = true;
2109
2181
  return resolved;
2110
2182
  }
2111
2183
  return fallback(queue);