@solidjs/signals 0.13.12 → 2.0.0-beta.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.
Files changed (55) hide show
  1. package/README.md +8 -7
  2. package/dist/dev.js +590 -275
  3. package/dist/node.cjs +1549 -1320
  4. package/dist/prod.js +1217 -976
  5. package/dist/types/boundaries.d.ts +124 -3
  6. package/dist/types/core/action.d.ts +34 -0
  7. package/dist/types/core/constants.d.ts +24 -0
  8. package/dist/types/core/context.d.ts +10 -2
  9. package/dist/types/core/core.d.ts +108 -9
  10. package/dist/types/core/dev.d.ts +1 -1
  11. package/dist/types/core/effect.d.ts +3 -2
  12. package/dist/types/core/error.d.ts +24 -0
  13. package/dist/types/core/external.d.ts +19 -0
  14. package/dist/types/core/graph.d.ts +1 -0
  15. package/dist/types/core/owner.d.ts +93 -3
  16. package/dist/types/core/scheduler.d.ts +27 -2
  17. package/dist/types/core/types.d.ts +3 -6
  18. package/dist/types/index.d.ts +2 -2
  19. package/dist/types/map.d.ts +32 -3
  20. package/dist/types/signals.d.ts +338 -39
  21. package/dist/types/store/optimistic.d.ts +38 -12
  22. package/dist/types/store/projection.d.ts +55 -15
  23. package/dist/types/store/reconcile.d.ts +22 -0
  24. package/dist/types/store/store.d.ts +72 -15
  25. package/dist/types/store/storePath.d.ts +28 -0
  26. package/dist/types/store/utils.d.ts +78 -7
  27. package/dist/types-cjs/boundaries.d.cts +173 -0
  28. package/dist/types-cjs/core/action.d.cts +35 -0
  29. package/dist/types-cjs/core/async.d.cts +6 -0
  30. package/dist/types-cjs/core/constants.d.cts +49 -0
  31. package/dist/types-cjs/core/context.d.cts +36 -0
  32. package/dist/types-cjs/core/core.d.cts +153 -0
  33. package/dist/types-cjs/core/dev.d.cts +49 -0
  34. package/dist/types-cjs/core/effect.d.cts +31 -0
  35. package/dist/types-cjs/core/error.d.cts +38 -0
  36. package/dist/types-cjs/core/external.d.cts +45 -0
  37. package/dist/types-cjs/core/graph.d.cts +4 -0
  38. package/dist/types-cjs/core/heap.d.cts +14 -0
  39. package/dist/types-cjs/core/index.d.cts +12 -0
  40. package/dist/types-cjs/core/lanes.d.cts +54 -0
  41. package/dist/types-cjs/core/owner.d.cts +116 -0
  42. package/dist/types-cjs/core/scheduler.d.cts +106 -0
  43. package/dist/types-cjs/core/types.d.cts +83 -0
  44. package/dist/types-cjs/index.d.cts +9 -0
  45. package/dist/types-cjs/map.d.cts +53 -0
  46. package/dist/types-cjs/package.json +3 -0
  47. package/dist/types-cjs/signals.d.cts +491 -0
  48. package/dist/types-cjs/store/index.d.cts +9 -0
  49. package/dist/types-cjs/store/optimistic.d.cts +45 -0
  50. package/dist/types-cjs/store/projection.d.cts +66 -0
  51. package/dist/types-cjs/store/reconcile.d.cts +23 -0
  52. package/dist/types-cjs/store/store.d.cts +125 -0
  53. package/dist/types-cjs/store/storePath.d.cts +58 -0
  54. package/dist/types-cjs/store/utils.d.cts +114 -0
  55. package/package.json +32 -24
package/dist/prod.js CHANGED
@@ -33,6 +33,12 @@ const REACTIVE_DISPOSED = 1 << 6;
33
33
  const REACTIVE_OPTIMISTIC_DIRTY = 1 << 7;
34
34
  const REACTIVE_SNAPSHOT_STALE = 1 << 8;
35
35
  const REACTIVE_LAZY = 1 << 9;
36
+ const CONFIG_OWNED_WRITE = 1 << 0;
37
+ const CONFIG_NO_SNAPSHOT = 1 << 1;
38
+ const CONFIG_TRANSPARENT = 1 << 2;
39
+ const CONFIG_IN_SNAPSHOT_SCOPE = 1 << 3;
40
+ const CONFIG_CHILDREN_FORBIDDEN = 1 << 4;
41
+ const CONFIG_AUTO_DISPOSE = 1 << 5;
36
42
  const STATUS_PENDING = 1 << 0;
37
43
  const STATUS_ERROR = 1 << 1;
38
44
  const STATUS_UNINITIALIZED = 1 << 2;
@@ -57,26 +63,26 @@ function actualInsertIntoHeap(e, t) {
57
63
  e.T = t;
58
64
  r.T = e;
59
65
  }
60
- if (i > t.R) t.R = i;
66
+ if (i > t.O) t.O = i;
61
67
  }
62
68
  function insertIntoHeap(e, t) {
63
- let n = e.O;
69
+ let n = e.R;
64
70
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS)) return;
65
71
  if (n & REACTIVE_CHECK) {
66
- e.O = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
67
- } else e.O = n | REACTIVE_IN_HEAP;
72
+ e.R = (n & -4) | REACTIVE_DIRTY | REACTIVE_IN_HEAP;
73
+ } else e.R = n | REACTIVE_IN_HEAP;
68
74
  if (!(n & REACTIVE_IN_HEAP_HEIGHT)) actualInsertIntoHeap(e, t);
69
75
  }
70
76
  function insertIntoHeapHeight(e, t) {
71
- let n = e.O;
77
+ let n = e.R;
72
78
  if (n & (REACTIVE_IN_HEAP | REACTIVE_RECOMPUTING_DEPS | REACTIVE_IN_HEAP_HEIGHT)) return;
73
- e.O = n | REACTIVE_IN_HEAP_HEIGHT;
79
+ e.R = n | REACTIVE_IN_HEAP_HEIGHT;
74
80
  actualInsertIntoHeap(e, t);
75
81
  }
76
82
  function deleteFromHeap(e, t) {
77
- const n = e.O;
83
+ const n = e.R;
78
84
  if (!(n & (REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT))) return;
79
- e.O = n & -25;
85
+ e.R = n & -25;
80
86
  const i = e.o;
81
87
  if (e.T === e) t.l[i] = undefined;
82
88
  else {
@@ -93,22 +99,22 @@ function deleteFromHeap(e, t) {
93
99
  function markHeap(e) {
94
100
  if (e._) return;
95
101
  e._ = true;
96
- for (let t = 0; t <= e.R; t++) {
102
+ for (let t = 0; t <= e.O; t++) {
97
103
  for (let n = e.l[t]; n !== undefined; n = n.S) {
98
- if (n.O & REACTIVE_IN_HEAP) markNode(n);
104
+ if (n.R & REACTIVE_IN_HEAP) markNode(n);
99
105
  }
100
106
  }
101
107
  }
102
108
  function markNode(e, t = REACTIVE_DIRTY) {
103
- const n = e.O;
109
+ const n = e.R;
104
110
  if ((n & (REACTIVE_CHECK | REACTIVE_DIRTY)) >= t) return;
105
- e.O = (n & -4) | t;
106
- for (let t = e.h; t !== null; t = t.I) {
111
+ e.R = (n & -4) | t;
112
+ for (let t = e.I; t !== null; t = t.h) {
107
113
  markNode(t.p, REACTIVE_CHECK);
108
114
  }
109
- if (e.A !== null) {
110
- for (let t = e.A; t !== null; t = t.N) {
111
- for (let e = t.h; e !== null; e = e.I) {
115
+ if (e.N !== null) {
116
+ for (let t = e.N; t !== null; t = t.A) {
117
+ for (let e = t.I; e !== null; e = e.h) {
112
118
  markNode(e.p, REACTIVE_CHECK);
113
119
  }
114
120
  }
@@ -116,15 +122,15 @@ function markNode(e, t = REACTIVE_DIRTY) {
116
122
  }
117
123
  function runHeap(e, t) {
118
124
  e._ = false;
119
- for (e.P = 0; e.P <= e.R; e.P++) {
125
+ for (e.P = 0; e.P <= e.O; e.P++) {
120
126
  let n = e.l[e.P];
121
127
  while (n !== undefined) {
122
- if (n.O & REACTIVE_IN_HEAP) t(n);
128
+ if (n.R & REACTIVE_IN_HEAP) t(n);
123
129
  else adjustHeight(n, e);
124
130
  n = e.l[e.P];
125
131
  }
126
132
  }
127
- e.R = 0;
133
+ e.O = 0;
128
134
  }
129
135
  function adjustHeight(e, t) {
130
136
  deleteFromHeap(e, t);
@@ -136,46 +142,63 @@ function adjustHeight(e, t) {
136
142
  }
137
143
  if (e.o !== n) {
138
144
  e.o = n;
139
- for (let n = e.h; n !== null; n = n.I) {
145
+ for (let n = e.I; n !== null; n = n.h) {
140
146
  insertIntoHeapHeight(n.p, t);
141
147
  }
142
148
  }
143
149
  }
144
150
  const DEV$1 = undefined;
145
151
  const transitions = new Set();
146
- const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
147
- const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, R: 0 };
152
+ const dirtyQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
153
+ const zombieQueue = { l: new Array(2e3).fill(undefined), _: false, P: 0, O: 0 };
148
154
  let clock = 0;
149
155
  let activeTransition = null;
150
156
  let scheduled = false;
151
157
  let projectionWriteActive = false;
152
158
  let stashedOptimisticReads = null;
159
+ const transientStoreNodes = new Set();
160
+ function registerTransientStoreNode(e) {
161
+ transientStoreNodes.add(e);
162
+ }
163
+ function sweepTransientStoreNodes() {
164
+ if (transientStoreNodes.size === 0) return;
165
+ for (const e of transientStoreNodes) {
166
+ if (e.I !== null) {
167
+ transientStoreNodes.delete(e);
168
+ continue;
169
+ }
170
+ if (e.U !== NOT_PENDING) continue;
171
+ if (e.G !== undefined && e.G !== NOT_PENDING) continue;
172
+ transientStoreNodes.delete(e);
173
+ e.k?.();
174
+ }
175
+ }
153
176
  function enforceLoadingBoundary(e) {}
154
177
  function shouldReadStashedOptimisticValue(e) {
155
178
  return !!stashedOptimisticReads?.has(e);
156
179
  }
157
180
  function runLaneEffects(e) {
158
181
  for (const t of activeLanes) {
159
- if (t.U || t.k.size > 0) continue;
160
- const n = t.G[e - 1];
182
+ if (t.F || t.W.size > 0) continue;
183
+ const n = t.H[e - 1];
161
184
  if (n.length) {
162
- t.G[e - 1] = [];
185
+ t.H[e - 1] = [];
163
186
  runQueue(n, e);
164
187
  }
165
188
  }
166
189
  }
167
190
  function queueStashedOptimisticEffects(e) {
168
- for (let t = e.h; t !== null; t = t.I) {
191
+ for (let t = e.I; t !== null; t = t.h) {
169
192
  const e = t.p;
170
- if (!e.W) continue;
171
- if (e.W === EFFECT_TRACKED) {
172
- if (!e.H) {
173
- e.H = true;
174
- e.F.enqueue(EFFECT_USER, e.M);
193
+ if (!e.M) continue;
194
+ if (e.M === EFFECT_TRACKED) {
195
+ if (!e.j) {
196
+ e.j = true;
197
+ e.$.enqueue(EFFECT_USER, e.K);
175
198
  }
176
199
  continue;
177
200
  }
178
- const n = e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
201
+ const n = e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
179
202
  if (n.P > e.o) n.P = e.o;
180
203
  insertIntoHeap(e, n);
181
204
  }
@@ -184,66 +207,67 @@ function setProjectionWriteActive(e) {
184
207
  projectionWriteActive = e;
185
208
  }
186
209
  function mergeTransitionState(e, t) {
187
- t.$ = e;
188
- e.j.push(...t.j);
189
- for (const n of activeLanes) if (n.K === t) n.K = e;
190
- e.Y.push(...t.Y);
191
- for (const n of t.B) e.B.add(n);
192
- for (const [n, i] of t.Z) {
193
- let t = e.Z.get(n);
194
- if (!t) e.Z.set(n, (t = new Set()));
210
+ t.Y = e;
211
+ e.B.push(...t.B);
212
+ for (const n of activeLanes) if (n.Z === t) n.Z = e;
213
+ e.q.push(...t.q);
214
+ for (const n of t.X) e.X.add(n);
215
+ for (const [n, i] of t.J) {
216
+ let t = e.J.get(n);
217
+ if (!t) e.J.set(n, (t = new Set()));
195
218
  for (const e of i) t.add(e);
196
219
  }
220
+ for (const n of t.ee) e.ee.add(n);
197
221
  }
198
222
  function resolveOptimisticNodes(e) {
199
223
  for (let t = 0; t < e.length; t++) {
200
224
  const n = e[t];
201
- n.q = undefined;
202
- if (n.X !== NOT_PENDING) {
203
- n.J = n.X;
204
- n.X = NOT_PENDING;
225
+ n.te = undefined;
226
+ if (n.U !== NOT_PENDING) {
227
+ n.ne = n.U;
228
+ n.U = NOT_PENDING;
205
229
  }
206
- const i = n.ee;
207
- n.ee = NOT_PENDING;
208
- if (i !== NOT_PENDING && n.J !== i) insertSubs(n, true);
209
- n.K = null;
230
+ const i = n.G;
231
+ n.G = NOT_PENDING;
232
+ if (i !== NOT_PENDING && n.ne !== i) insertSubs(n, true);
233
+ n.Z = null;
210
234
  }
211
235
  e.length = 0;
212
236
  }
213
237
  function cleanupCompletedLanes(e) {
214
238
  for (const t of activeLanes) {
215
- const n = e ? t.K === e : !t.K;
239
+ const n = e ? t.Z === e : !t.Z;
216
240
  if (!n) continue;
217
- if (!t.U) {
218
- if (t.G[0].length) runQueue(t.G[0], EFFECT_RENDER);
219
- if (t.G[1].length) runQueue(t.G[1], EFFECT_USER);
220
- }
221
- if (t.te.q === t) t.te.q = undefined;
222
- t.k.clear();
223
- t.G[0].length = 0;
224
- t.G[1].length = 0;
241
+ if (!t.F) {
242
+ if (t.H[0].length) runQueue(t.H[0], EFFECT_RENDER);
243
+ if (t.H[1].length) runQueue(t.H[1], EFFECT_USER);
244
+ }
245
+ if (t.ie.te === t) t.ie.te = undefined;
246
+ t.W.clear();
247
+ t.H[0].length = 0;
248
+ t.H[1].length = 0;
225
249
  activeLanes.delete(t);
226
- signalLanes.delete(t.te);
250
+ signalLanes.delete(t.ie);
227
251
  }
228
252
  }
229
253
  function schedule() {
230
254
  if (scheduled) return;
231
255
  scheduled = true;
232
- if (!globalQueue.ne && !projectionWriteActive) queueMicrotask(flush);
256
+ if (!globalQueue.re && !projectionWriteActive) queueMicrotask(flush);
233
257
  }
234
258
  class Queue {
235
259
  i = null;
236
- ie = [[], []];
237
- re = [];
260
+ se = [[], []];
261
+ oe = [];
238
262
  created = clock;
239
263
  addChild(e) {
240
- this.re.push(e);
264
+ this.oe.push(e);
241
265
  e.i = this;
242
266
  }
243
267
  removeChild(e) {
244
- const t = this.re.indexOf(e);
268
+ const t = this.oe.indexOf(e);
245
269
  if (t >= 0) {
246
- this.re.splice(t, 1);
270
+ this.oe.splice(t, 1);
247
271
  e.i = null;
248
272
  }
249
273
  }
@@ -252,81 +276,81 @@ class Queue {
252
276
  return false;
253
277
  }
254
278
  run(e) {
255
- if (this.ie[e - 1].length) {
256
- const t = this.ie[e - 1];
257
- this.ie[e - 1] = [];
279
+ if (this.se[e - 1].length) {
280
+ const t = this.se[e - 1];
281
+ this.se[e - 1] = [];
258
282
  runQueue(t, e);
259
283
  }
260
- for (let t = 0; t < this.re.length; t++) this.re[t].run?.(e);
284
+ for (let t = 0; t < this.oe.length; t++) this.oe[t].run?.(e);
261
285
  }
262
286
  enqueue(e, t) {
263
287
  if (e) {
264
288
  if (currentOptimisticLane) {
265
289
  const n = findLane(currentOptimisticLane);
266
- n.G[e - 1].push(t);
290
+ n.H[e - 1].push(t);
267
291
  } else {
268
- this.ie[e - 1].push(t);
292
+ this.se[e - 1].push(t);
269
293
  }
270
294
  }
271
295
  schedule();
272
296
  }
273
297
  stashQueues(e) {
274
- e.ie[0].push(...this.ie[0]);
275
- e.ie[1].push(...this.ie[1]);
276
- this.ie = [[], []];
277
- for (let t = 0; t < this.re.length; t++) {
278
- let n = this.re[t];
279
- let i = e.re[t];
298
+ e.se[0].push(...this.se[0]);
299
+ e.se[1].push(...this.se[1]);
300
+ this.se = [[], []];
301
+ for (let t = 0; t < this.oe.length; t++) {
302
+ let n = this.oe[t];
303
+ let i = e.oe[t];
280
304
  if (!i) {
281
- i = { ie: [[], []], re: [] };
282
- e.re[t] = i;
305
+ i = { se: [[], []], oe: [] };
306
+ e.oe[t] = i;
283
307
  }
284
308
  n.stashQueues(i);
285
309
  }
286
310
  }
287
311
  restoreQueues(e) {
288
- this.ie[0].push(...e.ie[0]);
289
- this.ie[1].push(...e.ie[1]);
290
- for (let t = 0; t < e.re.length; t++) {
291
- const n = e.re[t];
292
- let i = this.re[t];
312
+ this.se[0].push(...e.se[0]);
313
+ this.se[1].push(...e.se[1]);
314
+ for (let t = 0; t < e.oe.length; t++) {
315
+ const n = e.oe[t];
316
+ let i = this.oe[t];
293
317
  if (i) i.restoreQueues(n);
294
318
  }
295
319
  }
296
320
  }
297
321
  class GlobalQueue extends Queue {
298
- ne = false;
299
- se = [];
300
- Y = [];
301
- B = new Set();
302
- static oe;
303
- static ue;
304
- static ce = null;
322
+ re = false;
323
+ ue = [];
324
+ q = [];
325
+ X = new Set();
326
+ static ce;
327
+ static ae;
328
+ static le = null;
305
329
  flush() {
306
- if (this.ne) return;
307
- this.ne = true;
330
+ if (this.re) return;
331
+ this.re = true;
308
332
  try {
309
- runHeap(dirtyQueue, GlobalQueue.oe);
333
+ runHeap(dirtyQueue, GlobalQueue.ce);
310
334
  if (activeTransition) {
311
335
  const e = transitionComplete(activeTransition);
312
336
  if (!e) {
313
337
  const e = activeTransition;
314
- runHeap(zombieQueue, GlobalQueue.oe);
315
- this.se = [];
316
- this.Y = [];
317
- this.B = new Set();
338
+ runHeap(zombieQueue, GlobalQueue.ce);
339
+ this.ue = [];
340
+ this.q = [];
341
+ this.X = new Set();
318
342
  runLaneEffects(EFFECT_RENDER);
319
343
  runLaneEffects(EFFECT_USER);
320
- this.stashQueues(e.ae);
344
+ this.stashQueues(e.fe);
321
345
  clock++;
322
- scheduled = dirtyQueue.R >= dirtyQueue.P;
323
- reassignPendingTransition(e.se);
346
+ scheduled = dirtyQueue.O >= dirtyQueue.P;
347
+ reassignPendingTransition(e.ue);
324
348
  activeTransition = null;
325
- if (!e.j.length && e.Y.length) {
349
+ if (!e.B.length && !e.J.size && e.q.length) {
326
350
  stashedOptimisticReads = new Set();
327
- for (let t = 0; t < e.Y.length; t++) {
328
- const n = e.Y[t];
329
- if (n.L || n.le) continue;
351
+ for (let t = 0; t < e.q.length; t++) {
352
+ const n = e.q[t];
353
+ if (n.L || n.Ee & CONFIG_OWNED_WRITE) continue;
330
354
  stashedOptimisticReads.add(n);
331
355
  queueStashedOptimisticEffects(n);
332
356
  }
@@ -338,36 +362,36 @@ class GlobalQueue extends Queue {
338
362
  }
339
363
  return;
340
364
  }
341
- this.se !== activeTransition.se && this.se.push(...activeTransition.se);
342
- this.restoreQueues(activeTransition.ae);
365
+ this.ue !== activeTransition.ue && this.ue.push(...activeTransition.ue);
366
+ this.restoreQueues(activeTransition.fe);
343
367
  transitions.delete(activeTransition);
344
368
  const t = activeTransition;
345
369
  activeTransition = null;
346
- reassignPendingTransition(this.se);
370
+ reassignPendingTransition(this.ue);
347
371
  finalizePureQueue(t);
348
372
  } else {
349
- if (transitions.size) runHeap(zombieQueue, GlobalQueue.oe);
373
+ if (transitions.size) runHeap(zombieQueue, GlobalQueue.ce);
350
374
  finalizePureQueue();
351
375
  }
352
376
  clock++;
353
- scheduled = dirtyQueue.R >= dirtyQueue.P;
377
+ scheduled = dirtyQueue.O >= dirtyQueue.P;
354
378
  runLaneEffects(EFFECT_RENDER);
355
379
  this.run(EFFECT_RENDER);
356
380
  runLaneEffects(EFFECT_USER);
357
381
  this.run(EFFECT_USER);
358
382
  if (false);
359
383
  } finally {
360
- this.ne = false;
384
+ this.re = false;
361
385
  }
362
386
  }
363
387
  notify(e, t, n, i) {
364
388
  if (t & STATUS_PENDING) {
365
389
  if (n & STATUS_PENDING) {
366
- const t = i !== undefined ? i : e.fe;
390
+ const t = i !== undefined ? i : e.Te;
367
391
  if (activeTransition && t) {
368
392
  const n = t.source;
369
- let i = activeTransition.Z.get(n);
370
- if (!i) activeTransition.Z.set(n, (i = new Set()));
393
+ let i = activeTransition.J.get(n);
394
+ if (!i) activeTransition.J.set(n, (i = new Set()));
371
395
  const r = i.size;
372
396
  i.add(e);
373
397
  if (i.size !== r) schedule();
@@ -380,17 +404,18 @@ class GlobalQueue extends Queue {
380
404
  initTransition(e) {
381
405
  if (e) e = currentTransition(e);
382
406
  if (e && e === activeTransition) return;
383
- if (!e && activeTransition && activeTransition.Ee === clock) return;
407
+ if (!e && activeTransition && activeTransition.Se === clock) return;
384
408
  if (!activeTransition) {
385
409
  activeTransition = e ?? {
386
- Ee: clock,
387
- se: [],
388
- Z: new Map(),
389
- Y: [],
390
- B: new Set(),
391
- j: [],
392
- ae: { ie: [[], []], re: [] },
393
- $: false
410
+ Se: clock,
411
+ ue: [],
412
+ J: new Map(),
413
+ q: [],
414
+ X: new Set(),
415
+ B: [],
416
+ fe: { se: [[], []], oe: [] },
417
+ Y: false,
418
+ ee: new Set()
394
419
  };
395
420
  } else if (e) {
396
421
  const t = activeTransition;
@@ -399,71 +424,71 @@ class GlobalQueue extends Queue {
399
424
  activeTransition = e;
400
425
  }
401
426
  transitions.add(activeTransition);
402
- activeTransition.Ee = clock;
403
- if (this.se !== activeTransition.se) {
404
- for (let e = 0; e < this.se.length; e++) {
405
- const t = this.se[e];
406
- t.K = activeTransition;
407
- activeTransition.se.push(t);
427
+ activeTransition.Se = clock;
428
+ if (this.ue !== activeTransition.ue) {
429
+ for (let e = 0; e < this.ue.length; e++) {
430
+ const t = this.ue[e];
431
+ t.Z = activeTransition;
432
+ activeTransition.ue.push(t);
408
433
  }
409
- this.se = activeTransition.se;
434
+ this.ue = activeTransition.ue;
410
435
  }
411
- if (this.Y !== activeTransition.Y) {
412
- for (let e = 0; e < this.Y.length; e++) {
413
- const t = this.Y[e];
414
- t.K = activeTransition;
415
- activeTransition.Y.push(t);
436
+ if (this.q !== activeTransition.q) {
437
+ for (let e = 0; e < this.q.length; e++) {
438
+ const t = this.q[e];
439
+ t.Z = activeTransition;
440
+ activeTransition.q.push(t);
416
441
  }
417
- this.Y = activeTransition.Y;
442
+ this.q = activeTransition.q;
418
443
  }
419
444
  for (const e of activeLanes) {
420
- if (!e.K) e.K = activeTransition;
445
+ if (!e.Z) e.Z = activeTransition;
421
446
  }
422
- if (this.B !== activeTransition.B) {
423
- for (const e of this.B) activeTransition.B.add(e);
424
- this.B = activeTransition.B;
447
+ if (this.X !== activeTransition.X) {
448
+ for (const e of this.X) activeTransition.X.add(e);
449
+ this.X = activeTransition.X;
425
450
  }
426
451
  }
427
452
  }
428
453
  function insertSubs(e, t = false) {
429
- const n = e.q || currentOptimisticLane;
454
+ const n = e.te || currentOptimisticLane;
430
455
  const i = e.de !== undefined;
431
- for (let r = e.h; r !== null; r = r.I) {
432
- if (i && r.p.Te) {
433
- r.p.O |= REACTIVE_SNAPSHOT_STALE;
456
+ for (let r = e.I; r !== null; r = r.h) {
457
+ if (i && r.p.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
458
+ r.p.R |= REACTIVE_SNAPSHOT_STALE;
434
459
  continue;
435
460
  }
436
461
  if (t && n) {
437
- r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
462
+ r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
438
463
  assignOrMergeLane(r.p, n);
439
464
  } else if (t) {
440
- r.p.O |= REACTIVE_OPTIMISTIC_DIRTY;
441
- r.p.q = undefined;
465
+ r.p.R |= REACTIVE_OPTIMISTIC_DIRTY;
466
+ r.p.te = undefined;
442
467
  }
443
468
  const e = r.p;
444
- if (e.W === EFFECT_TRACKED) {
445
- if (!e.H) {
446
- e.H = true;
447
- e.F.enqueue(EFFECT_USER, e.M);
469
+ if (e.M === EFFECT_TRACKED) {
470
+ if (!e.j) {
471
+ e.j = true;
472
+ e.$.enqueue(EFFECT_USER, e.K);
448
473
  }
449
474
  continue;
450
475
  }
451
- const s = r.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
476
+ const s = r.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
452
477
  if (s.P > r.p.o) s.P = r.p.o;
453
478
  insertIntoHeap(r.p, s);
454
479
  }
455
480
  }
456
481
  function commitPendingNodes() {
457
- const e = globalQueue.se;
482
+ const e = globalQueue.ue;
458
483
  for (let t = 0; t < e.length; t++) {
459
484
  const n = e[t];
460
- if (n.X !== NOT_PENDING) {
461
- n.J = n.X;
462
- n.X = NOT_PENDING;
463
- if (n.W && n.W !== EFFECT_TRACKED) n.H = true;
485
+ if (n.U !== NOT_PENDING) {
486
+ n.ne = n.U;
487
+ n.U = NOT_PENDING;
488
+ if (n.M && n.M !== EFFECT_TRACKED) n.j = true;
464
489
  }
465
- if (!(n.Se & STATUS_PENDING)) n.Se &= ~STATUS_UNINITIALIZED;
466
- if (n.L) GlobalQueue.ue(n, false, true);
490
+ if (!(n.Oe & STATUS_PENDING)) n.Oe &= ~STATUS_UNINITIALIZED;
491
+ if (n.L) GlobalQueue.ae(n, false, true);
467
492
  }
468
493
  e.length = 0;
469
494
  }
@@ -471,39 +496,56 @@ function finalizePureQueue(e = null, t = false) {
471
496
  const n = !t;
472
497
  if (n) commitPendingNodes();
473
498
  if (!t) checkBoundaryChildren(globalQueue);
474
- if (dirtyQueue.R >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.oe);
499
+ if (dirtyQueue.O >= dirtyQueue.P) runHeap(dirtyQueue, GlobalQueue.ce);
475
500
  if (n) {
476
501
  commitPendingNodes();
477
- resolveOptimisticNodes(e ? e.Y : globalQueue.Y);
478
- const t = e ? e.B : globalQueue.B;
479
- if (GlobalQueue.ce && t.size) {
502
+ resolveOptimisticNodes(e ? e.q : globalQueue.q);
503
+ if (e && e.ee.size) {
504
+ for (const t of e.ee) {
505
+ if (t.R & REACTIVE_DISPOSED) continue;
506
+ if (t.M === EFFECT_TRACKED) {
507
+ if (!t.j) {
508
+ t.j = true;
509
+ t.$.enqueue(EFFECT_USER, t.K);
510
+ }
511
+ continue;
512
+ }
513
+ const e = t.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
514
+ if (e.P > t.o) e.P = t.o;
515
+ insertIntoHeap(t, e);
516
+ }
517
+ e.ee.clear();
518
+ }
519
+ const t = e ? e.X : globalQueue.X;
520
+ if (GlobalQueue.le && t.size) {
480
521
  for (const e of t) {
481
- GlobalQueue.ce(e);
522
+ GlobalQueue.le(e);
482
523
  }
483
524
  t.clear();
484
525
  schedule();
485
526
  }
527
+ sweepTransientStoreNodes();
486
528
  cleanupCompletedLanes(e);
487
529
  }
488
530
  }
489
531
  function checkBoundaryChildren(e) {
490
- for (const t of e.re) {
532
+ for (const t of e.oe) {
491
533
  t.checkSources?.();
492
534
  checkBoundaryChildren(t);
493
535
  }
494
536
  }
495
537
  function trackOptimisticStore(e) {
496
- globalQueue.B.add(e);
538
+ globalQueue.X.add(e);
497
539
  schedule();
498
540
  }
499
541
  function reassignPendingTransition(e) {
500
542
  for (let t = 0; t < e.length; t++) {
501
- e[t].K = activeTransition;
543
+ e[t].Z = activeTransition;
502
544
  }
503
545
  }
504
546
  const globalQueue = new GlobalQueue();
505
547
  function flush() {
506
- if (globalQueue.ne) {
548
+ if (globalQueue.re) {
507
549
  return;
508
550
  }
509
551
  while (scheduled || activeTransition) {
@@ -514,22 +556,22 @@ function runQueue(e, t) {
514
556
  for (let n = 0; n < e.length; n++) e[n](t);
515
557
  }
516
558
  function reporterBlocksSource(e, t) {
517
- if (e.O & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
518
- if (e.Re === t || e.Oe?.has(t)) return true;
559
+ if (e.R & (REACTIVE_ZOMBIE | REACTIVE_DISPOSED)) return false;
560
+ if (e.Re === t || e._e?.has(t)) return true;
519
561
  for (let n = e.C; n; n = n.D) {
520
562
  let e = n.m;
521
563
  while (e) {
522
564
  if (e === t || e.V === t) return true;
523
- e = e._e;
565
+ e = e.Ie;
524
566
  }
525
567
  }
526
- return !!(e.Se & STATUS_PENDING && e.fe instanceof NotReadyError && e.fe.source === t);
568
+ return !!(e.Oe & STATUS_PENDING && e.Te instanceof NotReadyError && e.Te.source === t);
527
569
  }
528
570
  function transitionComplete(e) {
529
- if (e.$) return true;
530
- if (e.j.length) return false;
571
+ if (e.Y) return true;
572
+ if (e.B.length) return false;
531
573
  let t = true;
532
- for (const [n, i] of e.Z) {
574
+ for (const [n, i] of e.J) {
533
575
  let r = false;
534
576
  for (const e of i) {
535
577
  if (reporterBlocksSource(e, n)) {
@@ -538,32 +580,32 @@ function transitionComplete(e) {
538
580
  }
539
581
  i.delete(e);
540
582
  }
541
- if (!r) e.Z.delete(n);
542
- else if (n.Se & STATUS_PENDING && n.fe?.source === n) {
583
+ if (!r) e.J.delete(n);
584
+ else if (n.Oe & STATUS_PENDING && n.Te?.source === n) {
543
585
  t = false;
544
586
  break;
545
587
  }
546
588
  }
547
589
  if (t) {
548
- for (let n = 0; n < e.Y.length; n++) {
549
- const i = e.Y[n];
590
+ for (let n = 0; n < e.q.length; n++) {
591
+ const i = e.q[n];
550
592
  if (
551
593
  hasActiveOverride(i) &&
552
- "Se" in i &&
553
- i.Se & STATUS_PENDING &&
554
- i.fe instanceof NotReadyError &&
555
- i.fe.source !== i
594
+ "Oe" in i &&
595
+ i.Oe & STATUS_PENDING &&
596
+ i.Te instanceof NotReadyError &&
597
+ i.Te.source !== i
556
598
  ) {
557
599
  t = false;
558
600
  break;
559
601
  }
560
602
  }
561
603
  }
562
- t && (e.$ = true);
604
+ t && (e.Y = true);
563
605
  return t;
564
606
  }
565
607
  function currentTransition(e) {
566
- while (e.$ && typeof e.$ === "object") e = e.$;
608
+ while (e.Y && typeof e.Y === "object") e = e.Y;
567
609
  return e;
568
610
  }
569
611
  function setActiveTransition(e) {
@@ -585,94 +627,96 @@ function getOrCreateLane(e) {
585
627
  if (t) {
586
628
  return findLane(t);
587
629
  }
588
- const n = e._e;
589
- const i = n?.q ? findLane(n.q) : null;
590
- t = { te: e, k: new Set(), G: [[], []], U: null, K: activeTransition, he: i };
630
+ const n = e.Ie;
631
+ const i = n?.te ? findLane(n.te) : null;
632
+ t = { ie: e, W: new Set(), H: [[], []], F: null, Z: activeTransition, he: i };
591
633
  signalLanes.set(e, t);
592
634
  activeLanes.add(t);
593
- e.Ie = false;
635
+ e.pe = false;
594
636
  return t;
595
637
  }
596
638
  function findLane(e) {
597
- while (e.U) e = e.U;
639
+ while (e.F) e = e.F;
598
640
  return e;
599
641
  }
600
642
  function mergeLanes(e, t) {
601
643
  e = findLane(e);
602
644
  t = findLane(t);
603
645
  if (e === t) return e;
604
- t.U = e;
605
- for (const n of t.k) e.k.add(n);
606
- e.G[0].push(...t.G[0]);
607
- e.G[1].push(...t.G[1]);
646
+ t.F = e;
647
+ for (const n of t.W) e.W.add(n);
648
+ e.H[0].push(...t.H[0]);
649
+ e.H[1].push(...t.H[1]);
608
650
  return e;
609
651
  }
610
652
  function resolveLane(e) {
611
- const t = e.q;
653
+ const t = e.te;
612
654
  if (!t) return undefined;
613
655
  const n = findLane(t);
614
656
  if (activeLanes.has(n)) return n;
615
- e.q = undefined;
657
+ e.te = undefined;
616
658
  return undefined;
617
659
  }
618
660
  function resolveTransition(e) {
619
- return resolveLane(e)?.K ?? e.K;
661
+ return resolveLane(e)?.Z ?? e.Z;
620
662
  }
621
663
  function hasActiveOverride(e) {
622
- return !!(e.ee !== undefined && e.ee !== NOT_PENDING);
664
+ return !!(e.G !== undefined && e.G !== NOT_PENDING);
623
665
  }
624
666
  function assignOrMergeLane(e, t) {
625
667
  const n = findLane(t);
626
- const i = e.q;
668
+ const i = e.te;
627
669
  if (i) {
628
- if (i.U) {
629
- e.q = t;
670
+ if (i.F) {
671
+ e.te = t;
630
672
  return;
631
673
  }
632
674
  const r = findLane(i);
633
675
  if (activeLanes.has(r)) {
634
676
  if (r !== n && !hasActiveOverride(e)) {
635
677
  if (n.he && findLane(n.he) === r) {
636
- e.q = t;
678
+ e.te = t;
637
679
  } else if (r.he && findLane(r.he) === n);
638
680
  else mergeLanes(n, r);
639
681
  }
640
682
  return;
641
683
  }
642
684
  }
643
- e.q = t;
685
+ e.te = t;
644
686
  }
645
687
  function unlinkSubs(e) {
646
688
  const t = e.m;
647
689
  const n = e.D;
648
- const i = e.I;
649
- const r = e.pe;
650
- if (i !== null) i.pe = r;
690
+ const i = e.h;
691
+ const r = e.Ne;
692
+ if (i !== null) i.Ne = r;
651
693
  else t.Ae = r;
652
- if (r !== null) r.I = i;
694
+ if (r !== null) r.h = i;
653
695
  else {
654
- t.h = i;
696
+ t.I = i;
655
697
  if (i === null) {
656
- t.Ne?.();
657
- t.L && !t.ge && !(t.O & REACTIVE_ZOMBIE) && unobserved(t);
698
+ t.k?.();
699
+ const e = t;
700
+ e.L && e.Ee & CONFIG_AUTO_DISPOSE && !(e.R & REACTIVE_ZOMBIE) && unobserved(e);
658
701
  }
659
702
  }
660
703
  return n;
661
704
  }
662
705
  function unobserved(e) {
663
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
706
+ deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
664
707
  let t = e.C;
665
708
  while (t !== null) {
666
709
  t = unlinkSubs(t);
667
710
  }
668
711
  e.C = null;
712
+ e.Pe = null;
669
713
  disposeChildren(e, true);
670
714
  }
671
715
  function link(e, t) {
672
716
  const n = t.Pe;
673
717
  if (n !== null && n.m === e) return;
674
718
  let i = null;
675
- const r = t.O & REACTIVE_RECOMPUTING_DEPS;
719
+ const r = t.R & REACTIVE_RECOMPUTING_DEPS;
676
720
  if (r) {
677
721
  i = n !== null ? n.D : t.C;
678
722
  if (i !== null && i.m === e) {
@@ -682,11 +726,11 @@ function link(e, t) {
682
726
  }
683
727
  const s = e.Ae;
684
728
  if (s !== null && s.p === t && (!r || isValidLink(s, t))) return;
685
- const o = (t.Pe = e.Ae = { m: e, p: t, D: i, pe: s, I: null });
729
+ const o = (t.Pe = e.Ae = { m: e, p: t, D: i, Ne: s, h: null });
686
730
  if (n !== null) n.D = o;
687
731
  else t.C = o;
688
- if (s !== null) s.I = o;
689
- else e.h = o;
732
+ if (s !== null) s.h = o;
733
+ else e.I = o;
690
734
  }
691
735
  function isValidLink(e, t) {
692
736
  const n = t.Pe;
@@ -704,13 +748,13 @@ const PENDING_OWNER = {};
704
748
  function markDisposal(e) {
705
749
  let t = e.Ce;
706
750
  while (t) {
707
- t.O |= REACTIVE_ZOMBIE;
708
- if (t.O & REACTIVE_IN_HEAP) {
751
+ t.R |= REACTIVE_ZOMBIE;
752
+ if (t.R & REACTIVE_IN_HEAP) {
709
753
  deleteFromHeap(t, dirtyQueue);
710
754
  insertIntoHeap(t, zombieQueue);
711
755
  }
712
756
  markDisposal(t);
713
- t = t.De;
757
+ t = t.ge;
714
758
  }
715
759
  }
716
760
  function dispose(e) {
@@ -723,15 +767,15 @@ function dispose(e) {
723
767
  disposeChildren(e, true);
724
768
  }
725
769
  function disposeChildren(e, t = false, n) {
726
- if (e.O & REACTIVE_DISPOSED) return;
727
- if (t) e.O = REACTIVE_DISPOSED;
728
- if (t && e.L) e.ye = null;
729
- let i = n ? e.ve : e.Ce;
770
+ if (e.R & REACTIVE_DISPOSED) return;
771
+ if (t) e.R = REACTIVE_DISPOSED;
772
+ if (t && e.L) e.De = null;
773
+ let i = n ? e.ye : e.Ce;
730
774
  while (i) {
731
- const e = i.De;
775
+ const e = i.ge;
732
776
  if (i.C) {
733
777
  const e = i;
734
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
778
+ deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
735
779
  let t = e.C;
736
780
  do {
737
781
  t = unlinkSubs(t);
@@ -743,15 +787,15 @@ function disposeChildren(e, t = false, n) {
743
787
  i = e;
744
788
  }
745
789
  if (n) {
746
- e.ve = null;
790
+ e.ye = null;
747
791
  } else {
748
792
  e.Ce = null;
749
- e.me = 0;
793
+ e.ve = 0;
750
794
  }
751
795
  runDisposal(e, n);
752
796
  }
753
797
  function runDisposal(e, t) {
754
- let n = t ? e.we : e.Ve;
798
+ let n = t ? e.me : e.we;
755
799
  if (!n) return;
756
800
  if (Array.isArray(n)) {
757
801
  for (let e = 0; e < n.length; e++) {
@@ -761,12 +805,12 @@ function runDisposal(e, t) {
761
805
  } else {
762
806
  n.call(n);
763
807
  }
764
- t ? (e.we = null) : (e.Ve = null);
808
+ t ? (e.me = null) : (e.we = null);
765
809
  }
766
810
  function childId(e, t) {
767
811
  let n = e;
768
- while (n.be && n.i) n = n.i;
769
- if (n.id != null) return formatId(n.id, t ? n.me++ : n.me);
812
+ while (n.Ee & CONFIG_TRANSPARENT && n.i) n = n.i;
813
+ if (n.id != null) return formatId(n.id, t ? n.ve++ : n.ve);
770
814
  throw new Error("Cannot get child id from owner without an id");
771
815
  }
772
816
  function getNextChildId(e) {
@@ -789,30 +833,30 @@ function getOwner() {
789
833
  }
790
834
  function cleanup(e) {
791
835
  if (!context) return e;
792
- if (!context.Ve) context.Ve = e;
793
- else if (Array.isArray(context.Ve)) context.Ve.push(e);
794
- else context.Ve = [context.Ve, e];
836
+ if (!context.we) context.we = e;
837
+ else if (Array.isArray(context.we)) context.we.push(e);
838
+ else context.we = [context.we, e];
795
839
  return e;
796
840
  }
797
841
  function isDisposed(e) {
798
- return !!(e.O & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
842
+ return !!(e.R & (REACTIVE_DISPOSED | REACTIVE_ZOMBIE));
799
843
  }
800
844
  function createOwner(e) {
801
845
  const t = context;
802
846
  const n = e?.transparent ?? false;
803
847
  const i = {
804
848
  id: e?.id ?? (n ? t?.id : t?.id != null ? getNextChildId(t) : undefined),
805
- be: n || undefined,
849
+ Ee: n ? CONFIG_TRANSPARENT : 0,
806
850
  t: true,
807
851
  u: t?.t ? t.u : t,
808
852
  Ce: null,
809
- De: null,
810
- Ve: null,
811
- F: t?.F ?? globalQueue,
812
- Le: t?.Le || defaultContext,
813
- me: 0,
853
+ ge: null,
814
854
  we: null,
815
- ve: null,
855
+ $: t?.$ ?? globalQueue,
856
+ Ve: t?.Ve || defaultContext,
857
+ ve: 0,
858
+ me: null,
859
+ ye: null,
816
860
  i: t,
817
861
  dispose(e = true) {
818
862
  disposeChildren(i, e);
@@ -823,7 +867,7 @@ function createOwner(e) {
823
867
  if (e === null) {
824
868
  t.Ce = i;
825
869
  } else {
826
- i.De = e;
870
+ i.ge = e;
827
871
  t.Ce = i;
828
872
  }
829
873
  }
@@ -834,15 +878,15 @@ function createRoot(e, t) {
834
878
  return runWithOwner(n, () => e(n.dispose));
835
879
  }
836
880
  function addPendingSource(e, t) {
837
- if (e.Re === t || e.Oe?.has(t)) return false;
881
+ if (e.Re === t || e._e?.has(t)) return false;
838
882
  if (!e.Re) {
839
883
  e.Re = t;
840
884
  return true;
841
885
  }
842
- if (!e.Oe) {
843
- e.Oe = new Set([e.Re, t]);
886
+ if (!e._e) {
887
+ e._e = new Set([e.Re, t]);
844
888
  } else {
845
- e.Oe.add(t);
889
+ e._e.add(t);
846
890
  }
847
891
  e.Re = undefined;
848
892
  return true;
@@ -853,38 +897,38 @@ function removePendingSource(e, t) {
853
897
  e.Re = undefined;
854
898
  return true;
855
899
  }
856
- if (!e.Oe?.delete(t)) return false;
857
- if (e.Oe.size === 1) {
858
- e.Re = e.Oe.values().next().value;
859
- e.Oe = undefined;
860
- } else if (e.Oe.size === 0) {
861
- e.Oe = undefined;
900
+ if (!e._e?.delete(t)) return false;
901
+ if (e._e.size === 1) {
902
+ e.Re = e._e.values().next().value;
903
+ e._e = undefined;
904
+ } else if (e._e.size === 0) {
905
+ e._e = undefined;
862
906
  }
863
907
  return true;
864
908
  }
865
909
  function clearPendingSources(e) {
866
910
  e.Re = undefined;
867
- e.Oe?.clear();
868
- e.Oe = undefined;
911
+ e._e?.clear();
912
+ e._e = undefined;
869
913
  }
870
914
  function setPendingError(e, t, n) {
871
915
  if (!t) {
872
- e.fe = null;
916
+ e.Te = null;
873
917
  return;
874
918
  }
875
919
  if (n instanceof NotReadyError && n.source === t) {
876
- e.fe = n;
920
+ e.Te = n;
877
921
  return;
878
922
  }
879
- const i = e.fe;
923
+ const i = e.Te;
880
924
  if (!(i instanceof NotReadyError) || i.source !== t) {
881
- e.fe = new NotReadyError(t);
925
+ e.Te = new NotReadyError(t);
882
926
  }
883
927
  }
884
928
  function forEachDependent(e, t) {
885
- for (let n = e.h; n !== null; n = n.I) t(n.p);
886
- for (let n = e.A; n !== null; n = n.N) {
887
- for (let e = n.h; e !== null; e = e.I) t(e.p);
929
+ for (let n = e.I; n !== null; n = n.h) t(n.p);
930
+ for (let n = e.N; n !== null; n = n.A) {
931
+ for (let e = n.I; e !== null; e = e.h) t(e.p);
888
932
  }
889
933
  }
890
934
  function settlePendingSource(e) {
@@ -893,30 +937,30 @@ function settlePendingSource(e) {
893
937
  const settle = i => {
894
938
  if (n.has(i) || !removePendingSource(i, e)) return;
895
939
  n.add(i);
896
- i.Ee = clock;
897
- const r = i.Re ?? i.Oe?.values().next().value;
940
+ i.Se = clock;
941
+ const r = i.Re ?? i._e?.values().next().value;
898
942
  if (r) {
899
943
  setPendingError(i, r);
900
944
  updatePendingSignal(i);
901
945
  } else {
902
- i.Se &= ~STATUS_PENDING;
946
+ i.Oe &= ~STATUS_PENDING;
903
947
  setPendingError(i);
904
948
  updatePendingSignal(i);
905
- if (i.Ue) {
906
- if (i.W === EFFECT_TRACKED) {
949
+ if (i.be) {
950
+ if (i.M === EFFECT_TRACKED) {
907
951
  const e = i;
908
- if (!e.H) {
909
- e.H = true;
910
- e.F.enqueue(EFFECT_USER, e.M);
952
+ if (!e.j) {
953
+ e.j = true;
954
+ e.$.enqueue(EFFECT_USER, e.K);
911
955
  }
912
956
  } else {
913
- const e = i.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
957
+ const e = i.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue;
914
958
  if (e.P > i.o) e.P = i.o;
915
959
  insertIntoHeap(i, e);
916
960
  }
917
961
  t = true;
918
962
  }
919
- i.Ue = false;
963
+ i.be = false;
920
964
  }
921
965
  forEachDependent(i, settle);
922
966
  };
@@ -928,40 +972,42 @@ function handleAsync(e, t, n) {
928
972
  const r = i && untrack(() => t[Symbol.asyncIterator]);
929
973
  const s = !r && i && untrack(() => typeof t.then === "function");
930
974
  if (!s && !r) {
931
- e.ye = null;
975
+ e.De = null;
932
976
  return t;
933
977
  }
934
- e.ye = t;
978
+ e.De = t;
935
979
  let o;
936
980
  const handleError = n => {
937
- if (e.ye !== t) return;
981
+ if (e.De !== t) return;
938
982
  globalQueue.initTransition(resolveTransition(e));
939
983
  notifyStatus(e, n instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR, n);
940
- e.Ee = clock;
984
+ e.Se = clock;
941
985
  };
942
986
  const asyncWrite = (i, r) => {
943
- if (e.ye !== t) return;
944
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
987
+ if (e.De !== t) return;
988
+ if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY)) return;
945
989
  globalQueue.initTransition(resolveTransition(e));
990
+ const s = !!(e.Oe & STATUS_UNINITIALIZED);
946
991
  clearStatus(e);
947
- const s = resolveLane(e);
948
- if (s) s.k.delete(e);
992
+ const o = resolveLane(e);
993
+ if (o) o.W.delete(e);
949
994
  if (n) n(i);
950
- else if (e.ee !== undefined) {
951
- if (e.ee !== undefined && e.ee !== NOT_PENDING) e.X = i;
995
+ else if (e.G !== undefined) {
996
+ if (e.G !== undefined && e.G !== NOT_PENDING) e.U = i;
952
997
  else {
953
- e.J = i;
998
+ e.ne = i;
954
999
  insertSubs(e);
955
1000
  }
956
- e.Ee = clock;
957
- } else if (s) {
958
- const t = e.J;
959
- const n = e.ke;
960
- if (!n || !n(i, t)) {
961
- e.J = i;
962
- e.Ee = clock;
963
- if (e.xe) {
964
- setSignal(e.xe, i);
1001
+ e.Se = clock;
1002
+ } else if (o) {
1003
+ const t = e.M;
1004
+ const n = e.ne;
1005
+ const r = e.Le;
1006
+ if ((!t && s) || !r || !r(i, n)) {
1007
+ e.ne = i;
1008
+ e.Se = clock;
1009
+ if (e.Ue) {
1010
+ setSignal(e.Ue, i);
965
1011
  }
966
1012
  insertSubs(e, true);
967
1013
  }
@@ -1017,7 +1063,7 @@ function handleAsync(e, t, n) {
1017
1063
  s = n;
1018
1064
  u = true;
1019
1065
  if (n.done) r = true;
1020
- } else if (e.ye !== t) {
1066
+ } else if (e.De !== t) {
1021
1067
  return;
1022
1068
  } else if (!n.done) asyncWrite(n.value, iterate);
1023
1069
  else {
@@ -1027,7 +1073,7 @@ function handleAsync(e, t, n) {
1027
1073
  }
1028
1074
  },
1029
1075
  n => {
1030
- if (!c && e.ye === t) {
1076
+ if (!c && e.De === t) {
1031
1077
  r = true;
1032
1078
  handleError(n);
1033
1079
  }
@@ -1051,8 +1097,8 @@ function handleAsync(e, t, n) {
1051
1097
  }
1052
1098
  function clearStatus(e, t = false) {
1053
1099
  clearPendingSources(e);
1054
- e.Ue = false;
1055
- e.Se = t ? 0 : e.Se & STATUS_UNINITIALIZED;
1100
+ e.be = false;
1101
+ e.Oe = t ? 0 : e.Oe & STATUS_UNINITIALIZED;
1056
1102
  setPendingError(e);
1057
1103
  updatePendingSignal(e);
1058
1104
  e.Ge?.();
@@ -1062,17 +1108,17 @@ function notifyStatus(e, t, n, i, r) {
1062
1108
  n = new StatusError(e, n);
1063
1109
  const s = t === STATUS_PENDING && n instanceof NotReadyError ? n.source : undefined;
1064
1110
  const o = s === e;
1065
- const u = t === STATUS_PENDING && e.ee !== undefined && !o;
1111
+ const u = t === STATUS_PENDING && e.G !== undefined && !o;
1066
1112
  const c = u && hasActiveOverride(e);
1067
1113
  if (!i) {
1068
1114
  if (t === STATUS_PENDING && s) {
1069
1115
  addPendingSource(e, s);
1070
- e.Se = STATUS_PENDING | (e.Se & STATUS_UNINITIALIZED);
1116
+ e.Oe = STATUS_PENDING | (e.Oe & STATUS_UNINITIALIZED);
1071
1117
  setPendingError(e, s, n);
1072
1118
  } else {
1073
1119
  clearPendingSources(e);
1074
- e.Se = t | (t !== STATUS_ERROR ? e.Se & STATUS_UNINITIALIZED : 0);
1075
- e.fe = n;
1120
+ e.Oe = t | (t !== STATUS_ERROR ? e.Oe & STATUS_UNINITIALIZED : 0);
1121
+ e.Te = n;
1076
1122
  }
1077
1123
  updatePendingSignal(e);
1078
1124
  }
@@ -1093,12 +1139,12 @@ function notifyStatus(e, t, n, i, r) {
1093
1139
  return;
1094
1140
  }
1095
1141
  forEachDependent(e, e => {
1096
- e.Ee = clock;
1142
+ e.Se = clock;
1097
1143
  if (
1098
- (t === STATUS_PENDING && s && e.Re !== s && !e.Oe?.has(s)) ||
1099
- (t !== STATUS_PENDING && (e.fe !== n || e.Re || e.Oe))
1144
+ (t === STATUS_PENDING && s && e.Re !== s && !e._e?.has(s)) ||
1145
+ (t !== STATUS_PENDING && (e.Te !== n || e.Re || e._e))
1100
1146
  ) {
1101
- if (!a && !e.K) globalQueue.se.push(e);
1147
+ if (!a && !e.Z) globalQueue.ue.push(e);
1102
1148
  notifyStatus(e, t, n, a, l);
1103
1149
  }
1104
1150
  });
@@ -1126,8 +1172,8 @@ function enableExternalSource(e) {
1126
1172
  externalSourceConfig = { factory: t, untrack: n };
1127
1173
  }
1128
1174
  }
1129
- GlobalQueue.oe = recompute;
1130
- GlobalQueue.ue = disposeChildren;
1175
+ GlobalQueue.ce = recompute;
1176
+ GlobalQueue.ae = disposeChildren;
1131
1177
  let tracking = false;
1132
1178
  let stale = false;
1133
1179
  let refreshing = false;
@@ -1140,7 +1186,7 @@ let snapshotCaptureActive = false;
1140
1186
  let snapshotSources = null;
1141
1187
  function ownerInSnapshotScope(e) {
1142
1188
  while (e) {
1143
- if (e.We) return true;
1189
+ if (e.ke) return true;
1144
1190
  e = e.i;
1145
1191
  }
1146
1192
  return false;
@@ -1150,32 +1196,32 @@ function setSnapshotCapture(e) {
1150
1196
  if (e && !snapshotSources) snapshotSources = new Set();
1151
1197
  }
1152
1198
  function markSnapshotScope(e) {
1153
- e.We = true;
1199
+ e.ke = true;
1154
1200
  }
1155
1201
  function releaseSnapshotScope(e) {
1156
- e.We = false;
1202
+ e.ke = false;
1157
1203
  releaseSubtree(e);
1158
1204
  schedule();
1159
1205
  }
1160
1206
  function releaseSubtree(e) {
1161
1207
  let t = e.Ce;
1162
1208
  while (t) {
1163
- if (t.We) {
1164
- t = t.De;
1209
+ if (t.ke) {
1210
+ t = t.ge;
1165
1211
  continue;
1166
1212
  }
1167
1213
  if (t.L) {
1168
1214
  const e = t;
1169
- e.Te = false;
1170
- if (e.O & REACTIVE_SNAPSHOT_STALE) {
1171
- e.O &= ~REACTIVE_SNAPSHOT_STALE;
1172
- e.O |= REACTIVE_DIRTY;
1215
+ e.Ee &= ~CONFIG_IN_SNAPSHOT_SCOPE;
1216
+ if (e.R & REACTIVE_SNAPSHOT_STALE) {
1217
+ e.R &= ~REACTIVE_SNAPSHOT_STALE;
1218
+ e.R |= REACTIVE_DIRTY;
1173
1219
  if (dirtyQueue.P > e.o) dirtyQueue.P = e.o;
1174
1220
  insertIntoHeap(e, dirtyQueue);
1175
1221
  }
1176
1222
  }
1177
1223
  releaseSubtree(t);
1178
- t = t.De;
1224
+ t = t.ge;
1179
1225
  }
1180
1226
  }
1181
1227
  function clearSnapshots() {
@@ -1189,205 +1235,223 @@ function clearSnapshots() {
1189
1235
  snapshotCaptureActive = false;
1190
1236
  }
1191
1237
  function recompute(e, t = false) {
1192
- const n = e.W;
1238
+ const n = e.M;
1193
1239
  if (!t) {
1194
- if (e.K && (!n || activeTransition) && activeTransition !== e.K)
1195
- globalQueue.initTransition(e.K);
1196
- deleteFromHeap(e, e.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1197
- e.ye = null;
1198
- if (e.K || n === EFFECT_TRACKED) disposeChildren(e);
1240
+ if (e.Z && (!n || activeTransition) && activeTransition !== e.Z)
1241
+ globalQueue.initTransition(e.Z);
1242
+ deleteFromHeap(e, e.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1243
+ e.De = null;
1244
+ if (e.Z || n === EFFECT_TRACKED) disposeChildren(e);
1199
1245
  else {
1200
1246
  markDisposal(e);
1201
- e.we = e.Ve;
1202
- e.ve = e.Ce;
1203
- e.Ve = null;
1247
+ e.me = e.we;
1248
+ e.ye = e.Ce;
1249
+ e.we = null;
1204
1250
  e.Ce = null;
1205
- e.me = 0;
1251
+ e.ve = 0;
1206
1252
  }
1207
1253
  }
1208
- const i = !!(e.O & REACTIVE_OPTIMISTIC_DIRTY);
1209
- const r = e.ee !== undefined && e.ee !== NOT_PENDING;
1210
- const s = !!(e.Se & STATUS_PENDING);
1211
- const o = context;
1254
+ let i = !!(e.R & REACTIVE_OPTIMISTIC_DIRTY);
1255
+ const r = e.G !== undefined && e.G !== NOT_PENDING;
1256
+ const s = !!(e.Oe & STATUS_PENDING);
1257
+ const o = !!(e.Oe & STATUS_UNINITIALIZED);
1258
+ const u = context;
1212
1259
  context = e;
1213
1260
  e.Pe = null;
1214
- e.O = REACTIVE_RECOMPUTING_DEPS;
1215
- e.Ee = clock;
1216
- let u = e.X === NOT_PENDING ? e.J : e.X;
1217
- let c = e.o;
1218
- let a = tracking;
1219
- let l = currentOptimisticLane;
1261
+ e.R = REACTIVE_RECOMPUTING_DEPS;
1262
+ e.Se = clock;
1263
+ let c = e.U === NOT_PENDING ? e.ne : e.U;
1264
+ let a = e.o;
1265
+ let l = tracking;
1266
+ let f = currentOptimisticLane;
1220
1267
  tracking = true;
1221
1268
  if (i) {
1222
1269
  const t = resolveLane(e);
1223
1270
  if (t) currentOptimisticLane = t;
1271
+ } else if (activeTransition && !t && activeTransition.q.length) {
1272
+ for (let t = e.C; t; t = t.D) {
1273
+ const n = t.m;
1274
+ if (n.R & REACTIVE_OPTIMISTIC_DIRTY) {
1275
+ const t = resolveLane(n);
1276
+ if (t) {
1277
+ i = true;
1278
+ currentOptimisticLane = t;
1279
+ e.R |= REACTIVE_OPTIMISTIC_DIRTY;
1280
+ assignOrMergeLane(e, t);
1281
+ break;
1282
+ }
1283
+ }
1284
+ }
1224
1285
  }
1225
1286
  try {
1226
- u = handleAsync(e, e.L(u));
1287
+ const n = e.De;
1288
+ const i = e.L(c);
1289
+ c = e.De !== n ? i : handleAsync(e, i);
1227
1290
  clearStatus(e, t);
1228
- const n = resolveLane(e);
1229
- if (n) {
1230
- n.k.delete(e);
1231
- updatePendingSignal(n.te);
1291
+ const r = resolveLane(e);
1292
+ if (r) {
1293
+ r.W.delete(e);
1294
+ updatePendingSignal(r.ie);
1232
1295
  }
1233
1296
  } catch (t) {
1234
1297
  if (t instanceof NotReadyError && currentOptimisticLane) {
1235
1298
  const t = findLane(currentOptimisticLane);
1236
- if (t.te !== e) {
1237
- t.k.add(e);
1238
- e.q = t;
1239
- updatePendingSignal(t.te);
1299
+ if (t.ie !== e) {
1300
+ t.W.add(e);
1301
+ e.te = t;
1302
+ updatePendingSignal(t.ie);
1240
1303
  }
1241
1304
  }
1242
- if (t instanceof NotReadyError) e.Ue = true;
1305
+ if (t instanceof NotReadyError) e.be = true;
1243
1306
  notifyStatus(
1244
1307
  e,
1245
1308
  t instanceof NotReadyError ? STATUS_PENDING : STATUS_ERROR,
1246
1309
  t,
1247
1310
  undefined,
1248
- t instanceof NotReadyError ? e.q : undefined
1311
+ t instanceof NotReadyError ? e.te : undefined
1249
1312
  );
1250
1313
  } finally {
1251
- tracking = a;
1252
- e.O = REACTIVE_NONE | (t ? e.O & REACTIVE_SNAPSHOT_STALE : 0);
1253
- context = o;
1254
- }
1255
- if (!e.fe) {
1256
- const o = e.Pe;
1257
- let a = o !== null ? o.D : e.C;
1258
- if (a !== null) {
1314
+ tracking = l;
1315
+ e.R = REACTIVE_NONE | (t ? e.R & REACTIVE_SNAPSHOT_STALE : 0);
1316
+ context = u;
1317
+ }
1318
+ if (!e.Te) {
1319
+ const u = e.Pe;
1320
+ let l = u !== null ? u.D : e.C;
1321
+ if (l !== null) {
1259
1322
  do {
1260
- a = unlinkSubs(a);
1261
- } while (a !== null);
1262
- if (o !== null) o.D = null;
1323
+ l = unlinkSubs(l);
1324
+ } while (l !== null);
1325
+ if (u !== null) u.D = null;
1263
1326
  else e.C = null;
1264
1327
  }
1265
- const l = r ? e.ee : e.X === NOT_PENDING ? e.J : e.X;
1266
- const f = !e.ke || !e.ke(l, u);
1267
- if (f) {
1268
- const o = r ? e.ee : undefined;
1269
- if (t || (n && activeTransition !== e.K) || i) {
1270
- e.J = u;
1328
+ const f = r ? e.G : e.U === NOT_PENDING ? e.ne : e.U;
1329
+ const E = (!n && o) || !e.Le || !e.Le(f, c);
1330
+ if (E) {
1331
+ const o = r ? e.G : undefined;
1332
+ if (t || (n && activeTransition !== e.Z) || i) {
1333
+ e.ne = c;
1271
1334
  if (r && i) {
1272
- e.ee = u;
1273
- e.X = u;
1335
+ e.G = c;
1336
+ e.U = c;
1274
1337
  }
1275
- } else e.X = u;
1276
- if (r && !i && s && !e.Ie) e.ee = u;
1277
- if (!r || i || e.ee !== o) insertSubs(e, i || r);
1338
+ } else e.U = c;
1339
+ if (r && !i && s && !e.pe) e.G = c;
1340
+ if (!r || i || e.G !== o) insertSubs(e, i || r);
1278
1341
  } else if (r) {
1279
- e.X = u;
1280
- } else if (e.o != c) {
1281
- for (let t = e.h; t !== null; t = t.I) {
1282
- insertIntoHeapHeight(t.p, t.p.O & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1342
+ e.U = c;
1343
+ } else if (e.o != a) {
1344
+ for (let t = e.I; t !== null; t = t.h) {
1345
+ insertIntoHeapHeight(t.p, t.p.R & REACTIVE_ZOMBIE ? zombieQueue : dirtyQueue);
1283
1346
  }
1284
1347
  }
1285
1348
  }
1286
- currentOptimisticLane = l;
1287
- (!t || e.Se & STATUS_PENDING) && !e.K && !(activeTransition && r) && globalQueue.se.push(e);
1288
- e.K && n && activeTransition !== e.K && runInTransition(e.K, () => recompute(e));
1349
+ currentOptimisticLane = f;
1350
+ (!t || e.Oe & STATUS_PENDING) && !e.Z && !(activeTransition && r) && globalQueue.ue.push(e);
1351
+ e.Z && n && activeTransition !== e.Z && runInTransition(e.Z, () => recompute(e));
1289
1352
  }
1290
1353
  function updateIfNecessary(e) {
1291
- if (e.O & REACTIVE_CHECK) {
1354
+ if (e.R & REACTIVE_CHECK) {
1292
1355
  for (let t = e.C; t; t = t.D) {
1293
1356
  const n = t.m;
1294
1357
  const i = n.V || n;
1295
1358
  if (i.L) {
1296
1359
  updateIfNecessary(i);
1297
1360
  }
1298
- if (e.O & REACTIVE_DIRTY) {
1361
+ if (e.R & REACTIVE_DIRTY) {
1299
1362
  break;
1300
1363
  }
1301
1364
  }
1302
1365
  }
1303
- if (e.O & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.fe && e.Ee < clock && !e.ye)) {
1366
+ if (e.R & (REACTIVE_DIRTY | REACTIVE_OPTIMISTIC_DIRTY) || (e.Te && e.Se < clock && !e.De)) {
1304
1367
  recompute(e);
1305
1368
  }
1306
- e.O = e.O & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1307
- }
1308
- function computed(e, t, n) {
1309
- const i = n?.transparent ?? false;
1310
- const r = {
1311
- id: n?.id ?? (i ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1312
- be: i || undefined,
1313
- ke: n?.equals != null ? n.equals : isEqual,
1314
- le: !!n?.pureWrite,
1315
- Ne: n?.unobserved,
1316
- Ve: null,
1317
- F: context?.F ?? globalQueue,
1318
- Le: context?.Le ?? defaultContext,
1319
- me: 0,
1369
+ e.R = e.R & (REACTIVE_SNAPSHOT_STALE | REACTIVE_IN_HEAP | REACTIVE_IN_HEAP_HEIGHT);
1370
+ }
1371
+ function computed(e, t) {
1372
+ const n = t?.transparent ?? false;
1373
+ const i = {
1374
+ id: t?.id ?? (n ? context?.id : context?.id != null ? getNextChildId(context) : undefined),
1375
+ Ee:
1376
+ (n ? CONFIG_TRANSPARENT : 0) |
1377
+ (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) |
1378
+ (!context || t?.lazy ? CONFIG_AUTO_DISPOSE : 0) |
1379
+ (snapshotCaptureActive && ownerInSnapshotScope(context) ? CONFIG_IN_SNAPSHOT_SCOPE : 0),
1380
+ Le: t?.equals != null ? t.equals : isEqual,
1381
+ k: t?.unobserved,
1382
+ we: null,
1383
+ $: context?.$ ?? globalQueue,
1384
+ Ve: context?.Ve ?? defaultContext,
1385
+ ve: 0,
1320
1386
  L: e,
1321
- J: t,
1387
+ ne: undefined,
1322
1388
  o: 0,
1323
- A: null,
1389
+ N: null,
1324
1390
  S: undefined,
1325
1391
  T: null,
1326
1392
  C: null,
1327
1393
  Pe: null,
1328
- h: null,
1394
+ I: null,
1329
1395
  Ae: null,
1330
1396
  i: context,
1331
- De: null,
1397
+ ge: null,
1332
1398
  Ce: null,
1333
- O: n?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1334
- Se: STATUS_UNINITIALIZED,
1335
- Ee: clock,
1336
- X: NOT_PENDING,
1337
- we: null,
1338
- ve: null,
1399
+ R: t?.lazy ? REACTIVE_LAZY : REACTIVE_NONE,
1400
+ Oe: STATUS_UNINITIALIZED,
1401
+ Se: clock,
1402
+ U: NOT_PENDING,
1403
+ me: null,
1339
1404
  ye: null,
1340
- K: null
1405
+ De: null,
1406
+ Z: null
1341
1407
  };
1342
- r.T = r;
1343
- const s = context?.t ? context.u : context;
1408
+ i.T = i;
1409
+ const r = context?.t ? context.u : context;
1344
1410
  if (context) {
1345
1411
  const e = context.Ce;
1346
1412
  if (e === null) {
1347
- context.Ce = r;
1413
+ context.Ce = i;
1348
1414
  } else {
1349
- r.De = e;
1350
- context.Ce = r;
1415
+ i.ge = e;
1416
+ context.Ce = i;
1351
1417
  }
1352
1418
  }
1353
- if (s) r.o = s.o + 1;
1354
- if (snapshotCaptureActive && ownerInSnapshotScope(context)) r.Te = true;
1419
+ if (r) i.o = r.o + 1;
1355
1420
  if (externalSourceConfig) {
1356
- const e = signal(undefined, { equals: false, pureWrite: true });
1357
- const t = externalSourceConfig.factory(r.L, () => {
1421
+ const e = signal(undefined, { equals: false, ownedWrite: true });
1422
+ const t = externalSourceConfig.factory(i.L, () => {
1358
1423
  setSignal(e, undefined);
1359
1424
  });
1360
1425
  cleanup(() => t.dispose());
1361
- r.L = n => {
1426
+ i.L = n => {
1362
1427
  read(e);
1363
1428
  return t.track(n);
1364
1429
  };
1365
1430
  }
1366
- !n?.lazy && recompute(r, true);
1367
- if (snapshotCaptureActive && !n?.lazy) {
1368
- if (!(r.Se & STATUS_PENDING)) {
1369
- r.de = r.J === undefined ? NO_SNAPSHOT : r.J;
1370
- snapshotSources.add(r);
1431
+ !t?.lazy && recompute(i, true);
1432
+ if (snapshotCaptureActive && !t?.lazy) {
1433
+ if (!(i.Oe & STATUS_PENDING)) {
1434
+ i.de = i.ne === undefined ? NO_SNAPSHOT : i.ne;
1435
+ snapshotSources.add(i);
1371
1436
  }
1372
1437
  }
1373
- return r;
1438
+ return i;
1374
1439
  }
1375
1440
  function signal(e, t, n = null) {
1376
1441
  const i = {
1377
- ke: t?.equals != null ? t.equals : isEqual,
1378
- le: !!t?.pureWrite,
1379
- He: !!t?.He,
1380
- Ne: t?.unobserved,
1381
- J: e,
1382
- h: null,
1442
+ Le: t?.equals != null ? t.equals : isEqual,
1443
+ Ee: (t?.ownedWrite ? CONFIG_OWNED_WRITE : 0) | (t?.Fe ? CONFIG_NO_SNAPSHOT : 0),
1444
+ k: t?.unobserved,
1445
+ ne: e,
1446
+ I: null,
1383
1447
  Ae: null,
1384
- Ee: clock,
1448
+ Se: clock,
1385
1449
  V: n,
1386
- N: n?.A || null,
1387
- X: NOT_PENDING
1450
+ A: n?.N || null,
1451
+ U: NOT_PENDING
1388
1452
  };
1389
- n && (n.A = i);
1390
- if (snapshotCaptureActive && !i.He && !((n?.Se ?? 0) & STATUS_PENDING)) {
1453
+ n && (n.N = i);
1454
+ if (snapshotCaptureActive && !(i.Ee & CONFIG_NO_SNAPSHOT) && !((n?.Oe ?? 0) & STATUS_PENDING)) {
1391
1455
  i.de = e === undefined ? NO_SNAPSHOT : e;
1392
1456
  snapshotSources.add(i);
1393
1457
  }
@@ -1395,13 +1459,13 @@ function signal(e, t, n = null) {
1395
1459
  }
1396
1460
  function optimisticSignal(e, t) {
1397
1461
  const n = signal(e, t);
1398
- n.ee = NOT_PENDING;
1462
+ n.G = NOT_PENDING;
1399
1463
  return n;
1400
1464
  }
1401
- function optimisticComputed(e, t, n) {
1402
- const i = computed(e, t, n);
1403
- i.ee = NOT_PENDING;
1404
- return i;
1465
+ function optimisticComputed(e, t) {
1466
+ const n = computed(e, t);
1467
+ n.G = NOT_PENDING;
1468
+ return n;
1405
1469
  }
1406
1470
  function isEqual(e, t) {
1407
1471
  return e === t;
@@ -1422,7 +1486,7 @@ function read(e) {
1422
1486
  const t = getLatestValueComputed(e);
1423
1487
  const n = latestReadActive;
1424
1488
  latestReadActive = false;
1425
- const i = e.ee !== undefined && e.ee !== NOT_PENDING ? e.ee : e.J;
1489
+ const i = e.G !== undefined && e.G !== NOT_PENDING ? e.G : e.ne;
1426
1490
  let r;
1427
1491
  try {
1428
1492
  r = read(t);
@@ -1432,11 +1496,11 @@ function read(e) {
1432
1496
  } finally {
1433
1497
  latestReadActive = n;
1434
1498
  }
1435
- if (t.Se & STATUS_PENDING) return i;
1436
- if (stale && currentOptimisticLane && t.q) {
1437
- const e = findLane(t.q);
1499
+ if (t.Oe & STATUS_PENDING) return i;
1500
+ if (stale && currentOptimisticLane && t.te) {
1501
+ const e = findLane(t.te);
1438
1502
  const n = findLane(currentOptimisticLane);
1439
- if (e !== n && e.k.size > 0) {
1503
+ if (e !== n && e.W.size > 0) {
1440
1504
  return i;
1441
1505
  }
1442
1506
  }
@@ -1446,8 +1510,8 @@ function read(e) {
1446
1510
  const t = e.V;
1447
1511
  const n = pendingCheckActive;
1448
1512
  pendingCheckActive = false;
1449
- if (t && e.ee !== undefined) {
1450
- if (e.ee !== NOT_PENDING && (t.ye || !!(t.Se & STATUS_PENDING))) {
1513
+ if (t && e.G !== undefined) {
1514
+ if (e.G !== NOT_PENDING && (t.De || !!(t.Oe & STATUS_PENDING))) {
1451
1515
  foundPending = true;
1452
1516
  }
1453
1517
  let n = context;
@@ -1460,86 +1524,115 @@ function read(e) {
1460
1524
  if (t && read(getPendingSignal(t))) foundPending = true;
1461
1525
  }
1462
1526
  pendingCheckActive = n;
1463
- return e.J;
1527
+ return e.ne;
1464
1528
  }
1465
1529
  let t = context;
1466
1530
  if (t?.t) t = t.u;
1467
- if (refreshing && e.L) recompute(e);
1468
- if (e.O & REACTIVE_LAZY) {
1469
- e.O &= ~REACTIVE_LAZY;
1470
- recompute(e, true);
1471
- }
1472
- const n = e.V || e;
1531
+ const n = e;
1532
+ if (typeof n.L === "function") {
1533
+ const t = e;
1534
+ if (refreshing && !(t.R & REACTIVE_DISPOSED)) recompute(t);
1535
+ if (t.R & REACTIVE_LAZY) {
1536
+ t.R &= ~REACTIVE_LAZY;
1537
+ recompute(t, true);
1538
+ } else if (t.R & REACTIVE_DISPOSED) {
1539
+ recompute(t, true);
1540
+ }
1541
+ }
1542
+ const i = e.V || e;
1473
1543
  if (t && tracking) {
1474
- if (e.L && e.O & REACTIVE_DISPOSED) recompute(e);
1475
1544
  link(e, t);
1476
- if (n.L) {
1477
- const i = e.O & REACTIVE_ZOMBIE;
1478
- if (n.o >= (i ? zombieQueue.P : dirtyQueue.P)) {
1545
+ if (i.L) {
1546
+ const n = e.R & REACTIVE_ZOMBIE;
1547
+ if (i.o >= (n ? zombieQueue.P : dirtyQueue.P)) {
1479
1548
  markNode(t);
1480
- markHeap(i ? zombieQueue : dirtyQueue);
1481
- updateIfNecessary(n);
1549
+ markHeap(n ? zombieQueue : dirtyQueue);
1550
+ updateIfNecessary(i);
1482
1551
  }
1483
- const r = n.o;
1552
+ const r = i.o;
1484
1553
  if (r >= t.o && e.i !== t) {
1485
1554
  t.o = r + 1;
1486
1555
  }
1487
1556
  }
1488
1557
  }
1489
- if (n.Se & STATUS_PENDING) {
1490
- if (t && !(stale && n.K && activeTransition !== n.K)) {
1558
+ if (i.Oe & STATUS_PENDING) {
1559
+ if (t && !(stale && i.Z && activeTransition !== i.Z)) {
1491
1560
  if (currentOptimisticLane) {
1492
- const i = n.q;
1561
+ const n = i.te;
1493
1562
  const r = findLane(currentOptimisticLane);
1494
- if (i && findLane(i) === r && !hasActiveOverride(n)) {
1563
+ if (n && findLane(n) === r && !hasActiveOverride(i)) {
1495
1564
  if (!tracking && e !== t) link(e, t);
1496
- throw n.fe;
1565
+ throw i.Te;
1497
1566
  }
1498
1567
  } else {
1499
1568
  if (!tracking && e !== t) link(e, t);
1500
- throw n.fe;
1569
+ throw i.Te;
1501
1570
  }
1502
- } else if (t && n !== e && n.Se & STATUS_UNINITIALIZED) {
1571
+ } else if (t && i !== e && i.Oe & STATUS_UNINITIALIZED) {
1503
1572
  if (!tracking && e !== t) link(e, t);
1504
- throw n.fe;
1505
- } else if (!t && n.Se & STATUS_UNINITIALIZED) {
1506
- throw n.fe;
1573
+ throw i.Te;
1574
+ } else if (!t && i.Oe & STATUS_UNINITIALIZED) {
1575
+ throw i.Te;
1507
1576
  }
1508
1577
  }
1509
- if (e.L && e.Se & STATUS_ERROR) {
1510
- if (e.Ee < clock) {
1578
+ if (e.L && e.Oe & STATUS_ERROR) {
1579
+ if (e.Se < clock) {
1511
1580
  recompute(e);
1512
1581
  return read(e);
1513
- } else throw e.fe;
1582
+ } else throw e.Te;
1514
1583
  }
1515
- if (snapshotCaptureActive && t && t.Te) {
1584
+ if (snapshotCaptureActive && t && t.Ee & CONFIG_IN_SNAPSHOT_SCOPE) {
1516
1585
  const n = e.de;
1517
1586
  if (n !== undefined) {
1518
1587
  const i = n === NO_SNAPSHOT ? undefined : n;
1519
- const r = e.X !== NOT_PENDING ? e.X : e.J;
1520
- if (r !== i) t.O |= REACTIVE_SNAPSHOT_STALE;
1588
+ const r = e.U !== NOT_PENDING ? e.U : e.ne;
1589
+ if (r !== i) t.R |= REACTIVE_SNAPSHOT_STALE;
1521
1590
  return i;
1522
1591
  }
1523
1592
  }
1524
- if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1525
- if (t && stale && shouldReadStashedOptimisticValue(e)) return e.J;
1526
- return e.ee;
1527
- }
1528
- return !t ||
1593
+ if (e.G !== undefined && e.G !== NOT_PENDING) {
1594
+ if (t && stale && shouldReadStashedOptimisticValue(e)) return e.ne;
1595
+ return e.G;
1596
+ }
1597
+ if (
1598
+ activeTransition !== null &&
1599
+ currentOptimisticLane !== null &&
1600
+ !latestReadActive &&
1601
+ e.U !== NOT_PENDING &&
1602
+ i === e &&
1603
+ !e.L &&
1604
+ t
1605
+ ) {
1606
+ activeTransition.ee.add(t);
1607
+ return e.ne;
1608
+ }
1609
+ const r =
1610
+ !t ||
1529
1611
  (currentOptimisticLane !== null &&
1530
- (e.ee !== undefined || e.q || (n === e && stale) || !!(n.Se & STATUS_PENDING))) ||
1531
- e.X === NOT_PENDING ||
1532
- (stale && e.K && activeTransition !== e.K)
1533
- ? e.J
1534
- : e.X;
1612
+ (e.G !== undefined || e.te || (i === e && stale) || !!(i.Oe & STATUS_PENDING))) ||
1613
+ e.U === NOT_PENDING ||
1614
+ (stale && e.Z && activeTransition !== e.Z)
1615
+ ? e.ne
1616
+ : e.U;
1617
+ if (
1618
+ !t &&
1619
+ i === e &&
1620
+ typeof n.L === "function" &&
1621
+ e.Ee & CONFIG_AUTO_DISPOSE &&
1622
+ !(i.Oe & STATUS_PENDING) &&
1623
+ !e.I
1624
+ ) {
1625
+ unobserved(e);
1626
+ }
1627
+ return r;
1535
1628
  }
1536
1629
  function setSignal(e, t) {
1537
- if (e.K && activeTransition !== e.K) globalQueue.initTransition(e.K);
1538
- const n = e.ee !== undefined && !projectionWriteActive;
1539
- const i = e.ee !== undefined && e.ee !== NOT_PENDING;
1540
- const r = n ? (i ? e.ee : e.J) : e.X === NOT_PENDING ? e.J : e.X;
1630
+ if (e.Z && activeTransition !== e.Z) globalQueue.initTransition(e.Z);
1631
+ const n = e.G !== undefined && !projectionWriteActive;
1632
+ const i = e.G !== undefined && e.G !== NOT_PENDING;
1633
+ const r = n ? (i ? e.G : e.ne) : e.U === NOT_PENDING ? e.ne : e.U;
1541
1634
  if (typeof t === "function") t = t(r);
1542
- const s = !e.ke || !e.ke(r, t) || !!(e.Se & STATUS_UNINITIALIZED);
1635
+ const s = !e.Le || !e.Le(r, t) || !!(e.Oe & STATUS_UNINITIALIZED);
1543
1636
  if (!s) {
1544
1637
  if (n && i && e.L) {
1545
1638
  insertSubs(e, true);
@@ -1548,25 +1641,25 @@ function setSignal(e, t) {
1548
1641
  return t;
1549
1642
  }
1550
1643
  if (n) {
1551
- const n = e.ee === NOT_PENDING;
1644
+ const n = e.G === NOT_PENDING;
1552
1645
  if (!n) globalQueue.initTransition(resolveTransition(e));
1553
1646
  if (n) {
1554
- e.X = e.J;
1555
- globalQueue.Y.push(e);
1647
+ e.U = e.ne;
1648
+ globalQueue.q.push(e);
1556
1649
  }
1557
- e.Ie = true;
1650
+ e.pe = true;
1558
1651
  const i = getOrCreateLane(e);
1559
- e.q = i;
1560
- e.ee = t;
1652
+ e.te = i;
1653
+ e.G = t;
1561
1654
  } else {
1562
- if (e.X === NOT_PENDING) globalQueue.se.push(e);
1563
- e.X = t;
1655
+ if (e.U === NOT_PENDING) globalQueue.ue.push(e);
1656
+ e.U = t;
1564
1657
  }
1565
1658
  updatePendingSignal(e);
1566
- if (e.xe) {
1567
- setSignal(e.xe, t);
1659
+ if (e.Ue) {
1660
+ setSignal(e.Ue, t);
1568
1661
  }
1569
- e.Ee = clock;
1662
+ e.Se = clock;
1570
1663
  insertSubs(e, n);
1571
1664
  schedule();
1572
1665
  return t;
@@ -1584,68 +1677,68 @@ function runWithOwner(e, t) {
1584
1677
  }
1585
1678
  }
1586
1679
  function getPendingSignal(e) {
1587
- if (!e.Fe) {
1588
- e.Fe = optimisticSignal(false, { pureWrite: true });
1589
- if (e._e) {
1590
- e.Fe._e = e;
1680
+ if (!e.We) {
1681
+ e.We = optimisticSignal(false, { ownedWrite: true });
1682
+ if (e.Ie) {
1683
+ e.We.Ie = e;
1591
1684
  }
1592
- if (computePendingState(e)) setSignal(e.Fe, true);
1685
+ if (computePendingState(e)) setSignal(e.We, true);
1593
1686
  }
1594
- return e.Fe;
1687
+ return e.We;
1595
1688
  }
1596
1689
  function computePendingState(e) {
1597
1690
  const t = e;
1598
1691
  const n = e.V;
1599
- if (n && e.X !== NOT_PENDING) {
1600
- return !n.ye && !(n.Se & STATUS_PENDING);
1692
+ if (n && e.U !== NOT_PENDING) {
1693
+ return !n.De && !(n.Oe & STATUS_PENDING);
1601
1694
  }
1602
- if (e.ee !== undefined && e.ee !== NOT_PENDING) {
1603
- if (t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1604
- if (e._e) {
1605
- const t = e.q ? findLane(e.q) : null;
1606
- return !!(t && t.k.size > 0);
1695
+ if (e.G !== undefined && e.G !== NOT_PENDING) {
1696
+ if (t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1697
+ if (e.Ie) {
1698
+ const t = e.te ? findLane(e.te) : null;
1699
+ return !!(t && t.W.size > 0);
1607
1700
  }
1608
1701
  return true;
1609
1702
  }
1610
- if (e.ee !== undefined && e.ee === NOT_PENDING && !e._e) {
1703
+ if (e.G !== undefined && e.G === NOT_PENDING && !e.Ie) {
1611
1704
  return false;
1612
1705
  }
1613
- if (e.X !== NOT_PENDING && !(t.Se & STATUS_UNINITIALIZED)) return true;
1614
- return !!(t.Se & STATUS_PENDING && !(t.Se & STATUS_UNINITIALIZED));
1706
+ if (e.U !== NOT_PENDING && !(t.Oe & STATUS_UNINITIALIZED)) return true;
1707
+ return !!(t.Oe & STATUS_PENDING && !(t.Oe & STATUS_UNINITIALIZED));
1615
1708
  }
1616
1709
  function updatePendingSignal(e) {
1617
- if (e.Fe) {
1710
+ if (e.We) {
1618
1711
  const t = computePendingState(e);
1619
- const n = e.Fe;
1712
+ const n = e.We;
1620
1713
  setSignal(n, t);
1621
- if (!t && n.q) {
1714
+ if (!t && n.te) {
1622
1715
  const t = resolveLane(e);
1623
- if (t && t.k.size > 0) {
1624
- const e = findLane(n.q);
1716
+ if (t && t.W.size > 0) {
1717
+ const e = findLane(n.te);
1625
1718
  if (e !== t) {
1626
1719
  mergeLanes(t, e);
1627
1720
  }
1628
1721
  }
1629
1722
  signalLanes.delete(n);
1630
- n.q = undefined;
1723
+ n.te = undefined;
1631
1724
  }
1632
1725
  }
1633
1726
  }
1634
1727
  function getLatestValueComputed(e) {
1635
- if (!e.xe) {
1728
+ if (!e.Ue) {
1636
1729
  const t = latestReadActive;
1637
1730
  latestReadActive = false;
1638
1731
  const n = pendingCheckActive;
1639
1732
  pendingCheckActive = false;
1640
1733
  const i = context;
1641
1734
  context = null;
1642
- e.xe = optimisticComputed(() => read(e));
1643
- e.xe._e = e;
1735
+ e.Ue = optimisticComputed(() => read(e));
1736
+ e.Ue.Ie = e;
1644
1737
  context = i;
1645
1738
  pendingCheckActive = n;
1646
1739
  latestReadActive = t;
1647
1740
  }
1648
- return e.xe;
1741
+ return e.Ue;
1649
1742
  }
1650
1743
  function staleValues(e, t = true) {
1651
1744
  const n = stale;
@@ -1706,7 +1799,7 @@ function getContext(e, t = getOwner()) {
1706
1799
  if (!t) {
1707
1800
  throw new NoOwnerError();
1708
1801
  }
1709
- const n = hasContext(e, t) ? t.Le[e.id] : e.defaultValue;
1802
+ const n = hasContext(e, t) ? t.Ve[e.id] : e.defaultValue;
1710
1803
  if (isUndefined(n)) {
1711
1804
  throw new ContextNotFoundError();
1712
1805
  }
@@ -1716,109 +1809,111 @@ function setContext(e, t, n = getOwner()) {
1716
1809
  if (!n) {
1717
1810
  throw new NoOwnerError();
1718
1811
  }
1719
- n.Le = { ...n.Le, [e.id]: isUndefined(t) ? e.defaultValue : t };
1812
+ n.Ve = { ...n.Ve, [e.id]: isUndefined(t) ? e.defaultValue : t };
1720
1813
  }
1721
1814
  function hasContext(e, t) {
1722
- return !isUndefined(t?.Le[e.id]);
1815
+ return !isUndefined(t?.Ve[e.id]);
1723
1816
  }
1724
1817
  function isUndefined(e) {
1725
1818
  return typeof e === "undefined";
1726
1819
  }
1727
- function effect(e, t, n, i, r) {
1728
- let s = false;
1729
- const o = computed(r?.render ? t => staleValues(() => e(t)) : e, i, {
1730
- ...r,
1820
+ function effect(e, t, n, i) {
1821
+ let r = false;
1822
+ const s = !!i?.user;
1823
+ const o = computed(s ? e : t => staleValues(() => e(t)), {
1824
+ ...i,
1731
1825
  equals: () => {
1732
- o.H = !o.fe;
1733
- if (s) o.F.enqueue(o.W, runEffect.bind(o));
1826
+ o.j = !o.Te;
1827
+ if (r) o.$.enqueue(o.M, runEffect.bind(o));
1734
1828
  return false;
1735
1829
  },
1736
1830
  lazy: true
1737
1831
  });
1738
- o.Qe = i;
1739
- o.Me = t;
1740
- o.$e = n;
1741
- o.je = undefined;
1742
- o.W = r?.render ? EFFECT_RENDER : EFFECT_USER;
1832
+ o.Ee &= ~CONFIG_AUTO_DISPOSE;
1833
+ o.xe = undefined;
1834
+ o.He = t;
1835
+ o.Me = n;
1836
+ o.Qe = undefined;
1837
+ o.M = s ? EFFECT_USER : EFFECT_RENDER;
1743
1838
  o.Ge = (e, t) => {
1744
- const n = e !== undefined ? e : o.Se;
1745
- const i = t !== undefined ? t : o.fe;
1839
+ const n = e !== undefined ? e : o.Oe;
1840
+ const i = t !== undefined ? t : o.Te;
1746
1841
  if (n & STATUS_ERROR) {
1747
1842
  let e = i;
1748
- o.F.notify(o, STATUS_PENDING, 0);
1749
- if (o.W === EFFECT_USER) {
1843
+ o.$.notify(o, STATUS_PENDING, 0);
1844
+ if (o.M === EFFECT_USER) {
1750
1845
  try {
1751
- return o.$e
1752
- ? o.$e(e, () => {
1753
- o.je?.();
1754
- o.je = undefined;
1846
+ return o.Me
1847
+ ? o.Me(e, () => {
1848
+ o.Qe?.();
1849
+ o.Qe = undefined;
1755
1850
  })
1756
1851
  : console.error(e);
1757
1852
  } catch (t) {
1758
1853
  e = t;
1759
1854
  }
1760
1855
  }
1761
- if (!o.F.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
1762
- } else if (o.W === EFFECT_RENDER) {
1763
- o.F.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
1856
+ if (!o.$.notify(o, STATUS_ERROR, STATUS_ERROR)) throw e;
1857
+ } else if (o.M === EFFECT_RENDER) {
1858
+ o.$.notify(o, STATUS_PENDING | STATUS_ERROR, n, i);
1764
1859
  }
1765
1860
  };
1766
1861
  recompute(o, true);
1767
- !r?.defer && (o.W === EFFECT_USER ? o.F.enqueue(o.W, runEffect.bind(o)) : runEffect.call(o));
1768
- s = true;
1769
- cleanup(() => o.je?.());
1862
+ !i?.defer &&
1863
+ (o.M === EFFECT_USER || i?.schedule ? o.$.enqueue(o.M, runEffect.bind(o)) : runEffect.call(o));
1864
+ r = true;
1865
+ cleanup(() => o.Qe?.());
1770
1866
  }
1771
1867
  function runEffect() {
1772
- if (!this.H || this.O & REACTIVE_DISPOSED) return;
1773
- this.je?.();
1774
- this.je = undefined;
1868
+ if (!this.j || this.R & REACTIVE_DISPOSED) return;
1869
+ this.Qe?.();
1870
+ this.Qe = undefined;
1775
1871
  try {
1776
- const e = this.Me(this.J, this.Qe);
1872
+ const e = this.He(this.ne, this.xe);
1777
1873
  if (false && e !== undefined && typeof e !== "function");
1778
- this.je = e;
1874
+ this.Qe = e;
1779
1875
  } catch (e) {
1780
- this.fe = new StatusError(this, e);
1781
- this.Se |= STATUS_ERROR;
1782
- if (!this.F.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1876
+ this.Te = new StatusError(this, e);
1877
+ this.Oe |= STATUS_ERROR;
1878
+ if (!this.$.notify(this, STATUS_ERROR, STATUS_ERROR)) throw e;
1783
1879
  } finally {
1784
- this.Qe = this.J;
1785
- this.H = false;
1880
+ this.xe = this.ne;
1881
+ this.j = false;
1786
1882
  }
1787
1883
  }
1788
1884
  function trackedEffect(e, t) {
1789
1885
  const run = () => {
1790
- if (!n.H || n.O & REACTIVE_DISPOSED) return;
1886
+ if (!n.j || n.R & REACTIVE_DISPOSED) return;
1791
1887
  try {
1792
- n.H = false;
1888
+ n.j = false;
1793
1889
  recompute(n);
1794
1890
  } finally {
1795
1891
  }
1796
1892
  };
1797
1893
  const n = computed(
1798
1894
  () => {
1799
- n.je?.();
1800
- n.je = undefined;
1895
+ n.Qe?.();
1896
+ n.Qe = undefined;
1801
1897
  const t = staleValues(e);
1802
- n.je = t;
1898
+ n.Qe = t;
1803
1899
  },
1804
- undefined,
1805
1900
  { ...t, lazy: true }
1806
1901
  );
1807
- n.je = undefined;
1808
- n.Ke = true;
1809
- n.H = true;
1810
- n.W = EFFECT_TRACKED;
1902
+ n.Qe = undefined;
1903
+ n.Ee = (n.Ee & ~CONFIG_AUTO_DISPOSE) | CONFIG_CHILDREN_FORBIDDEN;
1904
+ n.j = true;
1905
+ n.M = EFFECT_TRACKED;
1811
1906
  n.Ge = (e, t) => {
1812
- const i = e !== undefined ? e : n.Se;
1907
+ const i = e !== undefined ? e : n.Oe;
1813
1908
  if (i & STATUS_ERROR) {
1814
- n.F.notify(n, STATUS_PENDING, 0);
1815
- const e = t !== undefined ? t : n.fe;
1816
- if (!n.F.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
1909
+ n.$.notify(n, STATUS_PENDING, 0);
1910
+ const e = t !== undefined ? t : n.Te;
1911
+ if (!n.$.notify(n, STATUS_ERROR, STATUS_ERROR)) throw e;
1817
1912
  }
1818
1913
  };
1819
- n.M = run;
1820
- n.F.enqueue(EFFECT_USER, run);
1821
- cleanup(() => n.je?.());
1914
+ n.K = run;
1915
+ n.$.enqueue(EFFECT_USER, run);
1916
+ cleanup(() => n.Qe?.());
1822
1917
  }
1823
1918
  function restoreTransition(e, t) {
1824
1919
  globalQueue.initTransition(e);
@@ -1832,11 +1927,11 @@ function action(e) {
1832
1927
  const r = e(...t);
1833
1928
  globalQueue.initTransition();
1834
1929
  let s = activeTransition;
1835
- s.j.push(r);
1930
+ s.B.push(r);
1836
1931
  const done = (e, t) => {
1837
1932
  s = currentTransition(s);
1838
- const o = s.j.indexOf(r);
1839
- if (o >= 0) s.j.splice(o, 1);
1933
+ const o = s.B.indexOf(r);
1934
+ if (o >= 0) s.B.splice(o, 1);
1840
1935
  setActiveTransition(s);
1841
1936
  schedule();
1842
1937
  t ? i(t) : n(e);
@@ -1868,27 +1963,25 @@ function onCleanup(e) {
1868
1963
  return cleanup(e);
1869
1964
  }
1870
1965
  function accessor(e) {
1871
- const t = read.bind(null, e);
1872
- t.$r = true;
1873
- return t;
1966
+ return read.bind(null, e);
1874
1967
  }
1875
- function createSignal(e, t, n) {
1968
+ function createSignal(e, t) {
1876
1969
  if (typeof e === "function") {
1877
- const i = computed(e, t, n);
1878
- return [accessor(i), setSignal.bind(null, i)];
1970
+ const n = computed(e, t);
1971
+ n.Ee &= ~CONFIG_AUTO_DISPOSE;
1972
+ return [accessor(n), setSignal.bind(null, n)];
1879
1973
  }
1880
- const i = signal(e, t);
1881
- return [accessor(i), setSignal.bind(null, i)];
1974
+ const n = signal(e, t);
1975
+ return [accessor(n), setSignal.bind(null, n)];
1882
1976
  }
1883
- function createMemo(e, t, n) {
1884
- let i = computed(e, t, n);
1885
- return accessor(i);
1977
+ function createMemo(e, t) {
1978
+ return accessor(computed(e, t));
1886
1979
  }
1887
- function createEffect(e, t, n, i) {
1888
- effect(e, t.effect || t, t.error, n, i);
1980
+ function createEffect(e, t, n) {
1981
+ effect(e, t.effect || t, t.error, { user: true, ...n });
1889
1982
  }
1890
- function createRenderEffect(e, t, n, i) {
1891
- effect(e, t, undefined, n, { render: true, ...i });
1983
+ function createRenderEffect(e, t, n) {
1984
+ effect(e, t, undefined, n);
1892
1985
  }
1893
1986
  function createTrackedEffect(e, t) {
1894
1987
  trackedEffect(e, t);
@@ -1909,8 +2002,7 @@ function createReaction(e, t) {
1909
2002
  dispose(t);
1910
2003
  },
1911
2004
  e.error,
1912
- undefined,
1913
- { defer: true, ...(false ? { ...t, name: t?.name ?? "effect" } : t) }
2005
+ { ...(false ? { ...t, name: t?.name ?? "effect" } : t), user: true, defer: true }
1914
2006
  );
1915
2007
  });
1916
2008
  };
@@ -1930,17 +2022,18 @@ function resolve(e) {
1930
2022
  });
1931
2023
  });
1932
2024
  }
1933
- function createOptimistic(e, t, n) {
2025
+ function createOptimistic(e, t) {
1934
2026
  if (typeof e === "function") {
1935
- const i = optimisticComputed(e, t, n);
1936
- return [accessor(i), setSignal.bind(null, i)];
2027
+ const n = optimisticComputed(e, t);
2028
+ n.Ee &= ~CONFIG_AUTO_DISPOSE;
2029
+ return [accessor(n), setSignal.bind(null, n)];
1937
2030
  }
1938
- const i = optimisticSignal(e, t);
1939
- return [accessor(i), setSignal.bind(null, i)];
2031
+ const n = optimisticSignal(e, t);
2032
+ return [accessor(n), setSignal.bind(null, n)];
1940
2033
  }
1941
2034
  function onSettled(e) {
1942
2035
  const t = getOwner();
1943
- t && !t.Ke
2036
+ t && !(t.Ee & CONFIG_CHILDREN_FORBIDDEN)
1944
2037
  ? createTrackedEffect(() => untrack(e), undefined)
1945
2038
  : globalQueue.enqueue(EFFECT_USER, () => {
1946
2039
  const t = e();
@@ -1974,34 +2067,34 @@ function applyState(e, t, n) {
1974
2067
  let t = false;
1975
2068
  const c = getOverrideValue(r, s, u, "length", o);
1976
2069
  if (e.length && c && e[0] && n(e[0]) != null) {
1977
- let a, l, f, E, d, T, S, R;
2070
+ let a, l, f, E, T, S, d, O;
1978
2071
  for (
1979
2072
  f = 0, E = Math.min(c, e.length);
1980
2073
  f < E &&
1981
- ((T = getOverrideValue(r, s, u, f, o)) === e[f] || (T && e[f] && n(T) === n(e[f])));
2074
+ ((S = getOverrideValue(r, s, u, f, o)) === e[f] || (S && e[f] && n(S) === n(e[f])));
1982
2075
  f++
1983
2076
  ) {
1984
- applyState(e[f], wrap(T, i), n);
2077
+ applyState(e[f], wrap(S, i), n);
1985
2078
  }
1986
- const O = new Array(e.length),
2079
+ const R = new Array(e.length),
1987
2080
  _ = new Map();
1988
2081
  for (
1989
- E = c - 1, d = e.length - 1;
2082
+ E = c - 1, T = e.length - 1;
1990
2083
  E >= f &&
1991
- d >= f &&
1992
- ((T = getOverrideValue(r, s, u, E, o)) === e[d] || (T && e[d] && n(T) === n(e[d])));
1993
- E--, d--
2084
+ T >= f &&
2085
+ ((S = getOverrideValue(r, s, u, E, o)) === e[T] || (S && e[T] && n(S) === n(e[T])));
2086
+ E--, T--
1994
2087
  ) {
1995
- O[d] = T;
2088
+ R[T] = S;
1996
2089
  }
1997
- if (f > d || f > E) {
1998
- for (l = f; l <= d; l++) {
2090
+ if (f > T || f > E) {
2091
+ for (l = f; l <= T; l++) {
1999
2092
  t = true;
2000
2093
  i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
2001
2094
  }
2002
2095
  for (; l < e.length; l++) {
2003
2096
  t = true;
2004
- const r = wrap(O[l], i);
2097
+ const r = wrap(R[l], i);
2005
2098
  i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], r);
2006
2099
  applyState(e[l], r, n);
2007
2100
  }
@@ -2009,27 +2102,27 @@ function applyState(e, t, n) {
2009
2102
  c !== e.length && i[STORE_NODE].length && setSignal(i[STORE_NODE].length, e.length);
2010
2103
  return;
2011
2104
  }
2012
- S = new Array(d + 1);
2013
- for (l = d; l >= f; l--) {
2014
- T = e[l];
2015
- R = T ? n(T) : T;
2016
- a = _.get(R);
2017
- S[l] = a === undefined ? -1 : a;
2018
- _.set(R, l);
2105
+ d = new Array(T + 1);
2106
+ for (l = T; l >= f; l--) {
2107
+ S = e[l];
2108
+ O = S ? n(S) : S;
2109
+ a = _.get(O);
2110
+ d[l] = a === undefined ? -1 : a;
2111
+ _.set(O, l);
2019
2112
  }
2020
2113
  for (a = f; a <= E; a++) {
2021
- T = getOverrideValue(r, s, u, a, o);
2022
- R = T ? n(T) : T;
2023
- l = _.get(R);
2114
+ S = getOverrideValue(r, s, u, a, o);
2115
+ O = S ? n(S) : S;
2116
+ l = _.get(O);
2024
2117
  if (l !== undefined && l !== -1) {
2025
- O[l] = T;
2026
- l = S[l];
2027
- _.set(R, l);
2118
+ R[l] = S;
2119
+ l = d[l];
2120
+ _.set(O, l);
2028
2121
  }
2029
2122
  }
2030
2123
  for (l = f; l < e.length; l++) {
2031
- if (l in O) {
2032
- const t = wrap(O[l], i);
2124
+ if (l in R) {
2125
+ const t = wrap(R[l], i);
2033
2126
  i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], t);
2034
2127
  applyState(e[l], t, n);
2035
2128
  } else i[STORE_NODE][l] && setSignal(i[STORE_NODE][l], wrap(e[l], i));
@@ -2057,12 +2150,12 @@ function applyState(e, t, n) {
2057
2150
  const l = c[a];
2058
2151
  const f = u[l];
2059
2152
  const E = unwrap(getOverrideValue(r, s, u, l, o));
2060
- let d = unwrap(e[l]);
2061
- if (E === d) continue;
2062
- if (!E || !isWrappable(E) || !isWrappable(d) || (n(E) != null && n(E) !== n(d))) {
2153
+ let T = unwrap(e[l]);
2154
+ if (E === T) continue;
2155
+ if (!E || !isWrappable(E) || !isWrappable(T) || (n(E) != null && n(E) !== n(T))) {
2063
2156
  t && setSignal(t, void 0);
2064
- f && setSignal(f, isWrappable(d) ? wrap(d, i) : d);
2065
- } else applyState(d, wrap(E, i), n);
2157
+ f && setSignal(f, isWrappable(T) ? wrap(T, i) : T);
2158
+ } else applyState(T, wrap(E, i), n);
2066
2159
  }
2067
2160
  }
2068
2161
  if ((u = i[STORE_HAS])) {
@@ -2083,7 +2176,7 @@ function reconcile(e, t) {
2083
2176
  applyState(e, n, i);
2084
2177
  };
2085
2178
  }
2086
- function createProjectionInternal(e, t = {}, n) {
2179
+ function createProjectionInternal(e, t, n) {
2087
2180
  let i;
2088
2181
  const r = new WeakMap();
2089
2182
  const wrapper = e => {
@@ -2105,28 +2198,35 @@ function createProjectionInternal(e, t = {}, n) {
2105
2198
  };
2106
2199
  const s = wrapProjection(t);
2107
2200
  i = computed(() => {
2108
- const t = getOwner();
2109
- let i = false;
2110
- let r;
2111
- const o = new Proxy(
2112
- s,
2113
- createWriteTraps(() => !i || t.ye === r)
2114
- );
2115
- storeSetter(o, o => {
2116
- r = e(o);
2117
- i = true;
2118
- const u = handleAsync(t, r, e => {
2119
- e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
2120
- });
2121
- u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
2122
- });
2123
- });
2124
- i.ge = true;
2201
+ if (!i) i = getOwner();
2202
+ runProjectionComputed(s, e, n?.key || "id");
2203
+ }, undefined);
2204
+ i.Ee &= ~CONFIG_AUTO_DISPOSE;
2125
2205
  return { store: s, node: i };
2126
2206
  }
2127
- function createProjection(e, t = {}, n) {
2207
+ function createProjection(e, t, n) {
2128
2208
  return createProjectionInternal(e, t, n).store;
2129
2209
  }
2210
+ function runProjectionComputed(e, t, n, i) {
2211
+ const r = getOwner();
2212
+ let s = false;
2213
+ let o;
2214
+ const u = new Proxy(
2215
+ e,
2216
+ createWriteTraps(() => !s || r.De === o)
2217
+ );
2218
+ storeSetter(u, u => {
2219
+ o = t(u);
2220
+ s = true;
2221
+ const commit = t => {
2222
+ if (t === u || t === undefined) return;
2223
+ const write = () => storeSetter(e, reconcile(t, n));
2224
+ i ? i(write) : write();
2225
+ };
2226
+ commit(handleAsync(r, o, commit));
2227
+ });
2228
+ return r;
2229
+ }
2130
2230
  function createWriteTraps(e) {
2131
2231
  const t = {
2132
2232
  get(e, n) {
@@ -2189,6 +2289,7 @@ const STORE_VALUE = "v",
2189
2289
  STORE_OPTIMISTIC_OVERRIDE = "x",
2190
2290
  STORE_NODE = "n",
2191
2291
  STORE_HAS = "h",
2292
+ STORE_CUSTOM_PROTO = "c",
2192
2293
  STORE_WRAP = "w",
2193
2294
  STORE_LOOKUP = "l",
2194
2295
  STORE_FIREWALL = "f",
@@ -2199,6 +2300,7 @@ function createStoreProxy(e, t = storeTraps, n) {
2199
2300
  i = [];
2200
2301
  i.v = e;
2201
2302
  } else i = { v: e };
2303
+ i[STORE_CUSTOM_PROTO] = hasCustomPrototype(unwrapStoreValue(e));
2202
2304
  n && n(i);
2203
2305
  return (i[$PROXY] = new Proxy(i, t));
2204
2306
  }
@@ -2224,6 +2326,23 @@ function setWriteOverride(e) {
2224
2326
  function writeOnly(e) {
2225
2327
  return writeOverride || !!Writing?.has(e);
2226
2328
  }
2329
+ function unwrapStoreValue(e) {
2330
+ return e?.[$TARGET]?.[STORE_VALUE] ?? e;
2331
+ }
2332
+ function hasCustomPrototype(e) {
2333
+ if (Array.isArray(e)) return false;
2334
+ const t = Object.getPrototypeOf(e);
2335
+ return t !== null && t !== Object.prototype;
2336
+ }
2337
+ function hasInheritedAccessor(e, t) {
2338
+ let n = Object.getPrototypeOf(e);
2339
+ while (n && n !== Object.prototype) {
2340
+ const e = Reflect.getOwnPropertyDescriptor(n, t);
2341
+ if (e) return !!e.get;
2342
+ n = Object.getPrototypeOf(n);
2343
+ }
2344
+ return false;
2345
+ }
2227
2346
  function getNodes(e, t) {
2228
2347
  let n = e[t];
2229
2348
  if (!n) e[t] = n = Object.create(null);
@@ -2236,13 +2355,13 @@ function getNode(e, t, n, i, r = isEqual, s, o) {
2236
2355
  {
2237
2356
  equals: r,
2238
2357
  unobserved() {
2239
- delete e[t];
2358
+ if (e[t] === u) delete e[t];
2240
2359
  }
2241
2360
  },
2242
2361
  i
2243
2362
  );
2244
2363
  if (s) {
2245
- u.ee = NOT_PENDING;
2364
+ u.G = NOT_PENDING;
2246
2365
  }
2247
2366
  if (o && t in o) {
2248
2367
  const e = o[t];
@@ -2269,12 +2388,79 @@ function getKeys(e, t, n = true) {
2269
2388
  return Array.from(r);
2270
2389
  }
2271
2390
  function getPropertyDescriptor(e, t, n) {
2272
- let i = e;
2273
2391
  if (t && n in t) {
2274
- if (i[n] === $DELETED) return void 0;
2275
- if (!(n in i)) i = t;
2392
+ if (t[n] === $DELETED) return void 0;
2393
+ const i = Reflect.getOwnPropertyDescriptor(t, n);
2394
+ if (i?.get || i?.set || !(n in e)) return i;
2395
+ }
2396
+ return Reflect.getOwnPropertyDescriptor(e, n);
2397
+ }
2398
+ function prepareStoreWrite(e, t, n) {
2399
+ if (e[STORE_OPTIMISTIC]) {
2400
+ const t = e[STORE_FIREWALL];
2401
+ if (t?.Z) {
2402
+ globalQueue.initTransition(t.Z);
2403
+ }
2404
+ }
2405
+ const i = e[STORE_VALUE];
2406
+ const r = i[n];
2407
+ if (
2408
+ snapshotCaptureActive &&
2409
+ typeof n !== "symbol" &&
2410
+ !((e[STORE_FIREWALL]?.Oe ?? 0) & STATUS_PENDING)
2411
+ ) {
2412
+ if (!e[STORE_SNAPSHOT_PROPS]) {
2413
+ e[STORE_SNAPSHOT_PROPS] = Object.create(null);
2414
+ snapshotSources?.add(e);
2415
+ }
2416
+ if (!(n in e[STORE_SNAPSHOT_PROPS])) {
2417
+ e[STORE_SNAPSHOT_PROPS][n] = r;
2418
+ }
2419
+ }
2420
+ const s = e[STORE_OPTIMISTIC] && !projectionWriteActive;
2421
+ const o = s ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
2422
+ if (s) trackOptimisticStore(t);
2423
+ return { base: r, overrideKey: o, state: i };
2424
+ }
2425
+ function upsertStoreNode(e, t, n, i, r) {
2426
+ if (t[n]) return t[n];
2427
+ const s = isWrappable(i) ? wrap(i, e) : i;
2428
+ const o = getNode(t, n, s, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC], r);
2429
+ registerTransientStoreNode(o);
2430
+ return o;
2431
+ }
2432
+ function notifyStoreProperty(e, t, n, i, r, s) {
2433
+ const o = projectionWriteActive || e[STORE_OPTIMISTIC];
2434
+ const u = n !== "delete";
2435
+ const c = e[STORE_HAS]?.[t];
2436
+ if (c) {
2437
+ setSignal(c, u);
2438
+ } else if (!o && n !== "invalidate" && s !== u) {
2439
+ const n = upsertStoreNode(e, getNodes(e, STORE_HAS), t, s);
2440
+ setSignal(n, u);
2441
+ }
2442
+ const a = getNodes(e, STORE_NODE);
2443
+ if (n === "set") {
2444
+ if (a[t]) {
2445
+ setSignal(a[t], () => (isWrappable(i) ? wrap(i, e) : i));
2446
+ } else if (!o) {
2447
+ const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
2448
+ setSignal(n, () => (isWrappable(i) ? wrap(i, e) : i));
2449
+ }
2450
+ } else if (n === "invalidate") {
2451
+ if (a[t]) {
2452
+ setSignal(a[t], {});
2453
+ delete a[t];
2454
+ }
2455
+ } else {
2456
+ if (a[t]) {
2457
+ setSignal(a[t], undefined);
2458
+ } else if (!o) {
2459
+ const n = upsertStoreNode(e, a, t, r, e[STORE_SNAPSHOT_PROPS]);
2460
+ setSignal(n, undefined);
2461
+ }
2276
2462
  }
2277
- return Reflect.getOwnPropertyDescriptor(i, n);
2463
+ a[$TRACK] && setSignal(a[$TRACK], undefined);
2278
2464
  }
2279
2465
  let Writing = null;
2280
2466
  const storeTraps = {
@@ -2297,17 +2483,23 @@ const storeTraps = {
2297
2483
  ? e[STORE_OVERRIDE]
2298
2484
  : e[STORE_VALUE];
2299
2485
  if (!r) {
2300
- const e = Object.getOwnPropertyDescriptor(c, t);
2301
- if (e && e.get) return e.get.call(n);
2486
+ const i = Object.getOwnPropertyDescriptor(c, t);
2487
+ if (i && i.get) return i.get.call(n);
2488
+ if (!i && !o && e[STORE_CUSTOM_PROTO]) {
2489
+ const e = unwrapStoreValue(c);
2490
+ if (hasInheritedAccessor(e, t)) {
2491
+ return Reflect.get(c, t, n);
2492
+ }
2493
+ }
2302
2494
  }
2303
2495
  if (writeOnly(n)) {
2304
2496
  let n =
2305
2497
  r && (o || !u)
2306
- ? r.ee !== undefined && r.ee !== NOT_PENDING
2307
- ? r.ee
2308
- : r.X !== NOT_PENDING
2309
- ? r.X
2310
- : r.J
2498
+ ? r.G !== undefined && r.G !== NOT_PENDING
2499
+ ? r.G
2500
+ : r.U !== NOT_PENDING
2501
+ ? r.U
2502
+ : r.ne
2311
2503
  : c[t];
2312
2504
  n === $DELETED && (n = undefined);
2313
2505
  if (!isWrappable(n)) return n;
@@ -2349,50 +2541,33 @@ const storeTraps = {
2349
2541
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2350
2542
  ? e[STORE_OVERRIDE][t] !== $DELETED
2351
2543
  : t in e[STORE_VALUE];
2352
- if (!writeOnly(e[$PROXY])) {
2353
- getObserver() &&
2354
- read(
2355
- getNode(getNodes(e, STORE_HAS), t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC])
2356
- );
2544
+ if (writeOnly(e[$PROXY])) return n;
2545
+ const i = getNodes(e, STORE_HAS);
2546
+ if (i[t]) return read(i[t]);
2547
+ if (getObserver()) {
2548
+ return read(getNode(i, t, n, e[STORE_FIREWALL], isEqual, e[STORE_OPTIMISTIC]));
2357
2549
  }
2358
2550
  return n;
2359
2551
  },
2360
2552
  set(e, t, n) {
2361
2553
  const i = e[$PROXY];
2362
2554
  if (writeOnly(i)) {
2363
- if (e[STORE_OPTIMISTIC]) {
2364
- const t = e[STORE_FIREWALL];
2365
- if (t?.K) {
2366
- globalQueue.initTransition(t.K);
2367
- }
2368
- }
2369
2555
  untrack(() => {
2370
- const r = e[STORE_VALUE];
2371
- const s = r[t];
2372
- if (
2373
- snapshotCaptureActive &&
2374
- typeof t !== "symbol" &&
2375
- !((e[STORE_FIREWALL]?.Se ?? 0) & STATUS_PENDING)
2376
- ) {
2377
- if (!e[STORE_SNAPSHOT_PROPS]) {
2378
- e[STORE_SNAPSHOT_PROPS] = Object.create(null);
2379
- snapshotSources?.add(e);
2380
- }
2381
- if (!(t in e[STORE_SNAPSHOT_PROPS])) {
2382
- e[STORE_SNAPSHOT_PROPS][t] = s;
2383
- }
2384
- }
2385
- const o = e[STORE_OPTIMISTIC] && !projectionWriteActive;
2386
- const u = o ? STORE_OPTIMISTIC_OVERRIDE : STORE_OVERRIDE;
2387
- if (o) trackOptimisticStore(i);
2388
- const c =
2556
+ const { base: r, overrideKey: s, state: o } = prepareStoreWrite(e, i, t);
2557
+ const u =
2389
2558
  e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
2390
2559
  ? e[STORE_OPTIMISTIC_OVERRIDE][t]
2391
2560
  : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2392
2561
  ? e[STORE_OVERRIDE][t]
2393
- : s;
2394
- const a = n?.[$TARGET]?.[STORE_VALUE] ?? n;
2395
- const l = Array.isArray(r) && t !== "length";
2562
+ : r;
2563
+ const c =
2564
+ e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]
2565
+ ? e[STORE_OPTIMISTIC_OVERRIDE][t] !== $DELETED
2566
+ : e[STORE_OVERRIDE] && t in e[STORE_OVERRIDE]
2567
+ ? e[STORE_OVERRIDE][t] !== $DELETED
2568
+ : t in e[STORE_VALUE];
2569
+ const a = unwrapStoreValue(n);
2570
+ const l = Array.isArray(o) && t !== "length";
2396
2571
  const f = l ? parseInt(t) + 1 : 0;
2397
2572
  const E =
2398
2573
  l &&
@@ -2400,24 +2575,38 @@ const storeTraps = {
2400
2575
  ? e[STORE_OPTIMISTIC_OVERRIDE].length
2401
2576
  : e[STORE_OVERRIDE] && "length" in e[STORE_OVERRIDE]
2402
2577
  ? e[STORE_OVERRIDE].length
2403
- : r.length);
2404
- const d = l && f > E ? f : undefined;
2405
- if (c === a && d === undefined) return true;
2406
- if (a !== undefined && a === s && d === undefined) delete e[u]?.[t];
2578
+ : o.length);
2579
+ const T = l && f > E ? f : undefined;
2580
+ if (u === a && T === undefined) return true;
2581
+ if (a !== undefined && a === r && T === undefined) delete e[s]?.[t];
2407
2582
  else {
2408
- const n = e[u] || (e[u] = Object.create(null));
2583
+ const n = e[s] || (e[s] = Object.create(null));
2409
2584
  n[t] = a;
2410
- if (d !== undefined) n.length = d;
2585
+ if (T !== undefined) n.length = T;
2411
2586
  }
2412
- const T = isWrappable(a);
2413
- e[STORE_HAS]?.[t] && setSignal(e[STORE_HAS][t], true);
2414
- const S = getNodes(e, STORE_NODE);
2415
- S[t] && setSignal(S[t], () => (T ? wrap(a, e) : a));
2416
- if (Array.isArray(r)) {
2417
- const e = t === "length" ? a : d;
2418
- e !== undefined && S.length && setSignal(S.length, e);
2587
+ notifyStoreProperty(e, t, "set", a, u, c);
2588
+ if (Array.isArray(o) && t !== "length" && T !== undefined) {
2589
+ const t = getNodes(e, STORE_NODE);
2590
+ if (t.length) {
2591
+ setSignal(t.length, T);
2592
+ } else if (!projectionWriteActive && !e[STORE_OPTIMISTIC]) {
2593
+ const n = upsertStoreNode(e, t, "length", E, e[STORE_SNAPSHOT_PROPS]);
2594
+ setSignal(n, T);
2595
+ }
2419
2596
  }
2420
- S[$TRACK] && setSignal(S[$TRACK], undefined);
2597
+ if (false);
2598
+ });
2599
+ }
2600
+ return true;
2601
+ },
2602
+ defineProperty(e, t, n) {
2603
+ const i = e[$PROXY];
2604
+ if (writeOnly(i)) {
2605
+ untrack(() => {
2606
+ const { base: r, overrideKey: s } = prepareStoreWrite(e, i, t);
2607
+ const o = "value" in n ? { ...n, value: unwrapStoreValue(n.value) } : n;
2608
+ Object.defineProperty(e[s] || (e[s] = Object.create(null)), t, o);
2609
+ notifyStoreProperty(e, t, "invalidate");
2421
2610
  if (false);
2422
2611
  });
2423
2612
  }
@@ -2442,10 +2631,7 @@ const storeTraps = {
2442
2631
  } else if (e[i] && t in e[i]) {
2443
2632
  delete e[i][t];
2444
2633
  } else return true;
2445
- if (e[STORE_HAS]?.[t]) setSignal(e[STORE_HAS][t], false);
2446
- const s = getNodes(e, STORE_NODE);
2447
- s[t] && setSignal(s[t], undefined);
2448
- s[$TRACK] && setSignal(s[$TRACK], undefined);
2634
+ notifyStoreProperty(e, t, "delete", undefined, r, true);
2449
2635
  });
2450
2636
  }
2451
2637
  return true;
@@ -2467,9 +2653,11 @@ const storeTraps = {
2467
2653
  if (t === $PROXY) return { value: e[$PROXY], writable: true, configurable: true };
2468
2654
  if (e[STORE_OPTIMISTIC_OVERRIDE] && t in e[STORE_OPTIMISTIC_OVERRIDE]) {
2469
2655
  if (e[STORE_OPTIMISTIC_OVERRIDE][t] === $DELETED) return undefined;
2470
- const n = getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
2471
- if (n) {
2472
- return { ...n, value: e[STORE_OPTIMISTIC_OVERRIDE][t] };
2656
+ const n = Reflect.getOwnPropertyDescriptor(e[STORE_OPTIMISTIC_OVERRIDE], t);
2657
+ if (n?.get || n?.set || !(t in e[STORE_VALUE])) return n;
2658
+ const i = getPropertyDescriptor(e[STORE_VALUE], e[STORE_OVERRIDE], t);
2659
+ if (i) {
2660
+ return { ...i, value: e[STORE_OPTIMISTIC_OVERRIDE][t] };
2473
2661
  }
2474
2662
  return {
2475
2663
  value: e[STORE_OPTIMISTIC_OVERRIDE][t],
@@ -2513,9 +2701,9 @@ function createStore(e, t, n) {
2513
2701
  return [r, e => storeSetter(r, e)];
2514
2702
  }
2515
2703
  function createOptimisticStore(e, t, n) {
2516
- GlobalQueue.ce ||= clearOptimisticStore;
2704
+ GlobalQueue.le ||= clearOptimisticStore;
2517
2705
  const i = typeof e === "function";
2518
- const r = (i ? t : e) ?? {};
2706
+ const r = i ? t : e;
2519
2707
  const s = i ? e : undefined;
2520
2708
  const { store: o } = createOptimisticProjectionInternal(s, r, n);
2521
2709
  return [o, e => storeSetter(o, e)];
@@ -2530,7 +2718,7 @@ function clearOptimisticStore(e) {
2530
2718
  if (i) {
2531
2719
  for (const e of Reflect.ownKeys(n)) {
2532
2720
  if (i[e]) {
2533
- i[e].q = undefined;
2721
+ i[e].te = undefined;
2534
2722
  const n =
2535
2723
  t[STORE_OVERRIDE] && e in t[STORE_OVERRIDE] ? t[STORE_OVERRIDE][e] : t[STORE_VALUE][e];
2536
2724
  const r = n === $DELETED ? undefined : n;
@@ -2538,7 +2726,7 @@ function clearOptimisticStore(e) {
2538
2726
  }
2539
2727
  }
2540
2728
  if (i[$TRACK]) {
2541
- i[$TRACK].q = undefined;
2729
+ i[$TRACK].te = undefined;
2542
2730
  setSignal(i[$TRACK], undefined);
2543
2731
  }
2544
2732
  }
@@ -2547,7 +2735,7 @@ function clearOptimisticStore(e) {
2547
2735
  }
2548
2736
  delete t[STORE_OPTIMISTIC_OVERRIDE];
2549
2737
  }
2550
- function createOptimisticProjectionInternal(e, t = {}, n) {
2738
+ function createOptimisticProjectionInternal(e, t, n) {
2551
2739
  let i;
2552
2740
  const r = new WeakMap();
2553
2741
  const wrapper = e => {
@@ -2570,38 +2758,30 @@ function createOptimisticProjectionInternal(e, t = {}, n) {
2570
2758
  };
2571
2759
  const s = wrapProjection(t);
2572
2760
  if (e) {
2761
+ const wrapCommit = e => {
2762
+ setProjectionWriteActive(true);
2763
+ try {
2764
+ e();
2765
+ } finally {
2766
+ setProjectionWriteActive(false);
2767
+ }
2768
+ };
2573
2769
  i = computed(() => {
2574
- const t = getOwner();
2575
- let i = false;
2576
- let r;
2577
- const o = new Proxy(
2578
- s,
2579
- createWriteTraps(() => !i || t.ye === r)
2580
- );
2581
2770
  setProjectionWriteActive(true);
2582
2771
  try {
2583
- storeSetter(o, o => {
2584
- r = e(o);
2585
- i = true;
2586
- const u = handleAsync(t, r, e => {
2587
- setProjectionWriteActive(true);
2588
- try {
2589
- e !== o && e !== undefined && storeSetter(s, reconcile(e, n?.key || "id"));
2590
- } finally {
2591
- setProjectionWriteActive(false);
2592
- }
2593
- });
2594
- u !== o && u !== undefined && reconcile(u, n?.key || "id")(s);
2595
- });
2772
+ runProjectionComputed(s, e, n?.key || "id", wrapCommit);
2596
2773
  } finally {
2597
2774
  setProjectionWriteActive(false);
2598
2775
  }
2599
- });
2600
- i.ge = true;
2776
+ }, undefined);
2777
+ i.Ee &= ~CONFIG_AUTO_DISPOSE;
2601
2778
  }
2602
2779
  return { store: s, node: i };
2603
2780
  }
2604
2781
  const DELETE = Symbol(0);
2782
+ function isPrototypePollutionKey(e) {
2783
+ return e === "__proto__" || e === "constructor" || e === "prototype";
2784
+ }
2605
2785
  function updatePath(e, t, n = 0) {
2606
2786
  let i,
2607
2787
  r = e;
@@ -2609,6 +2789,7 @@ function updatePath(e, t, n = 0) {
2609
2789
  i = t[n];
2610
2790
  const s = typeof i;
2611
2791
  const o = Array.isArray(e);
2792
+ if (s === "string" && isPrototypePollutionKey(i)) return;
2612
2793
  if (Array.isArray(i)) {
2613
2794
  for (let r = 0; r < i.length; r++) {
2614
2795
  t[n] = i[r];
@@ -2650,7 +2831,13 @@ function updatePath(e, t, n = 0) {
2650
2831
  } else if (i === undefined || (isWrappable(r) && isWrappable(s) && !Array.isArray(s))) {
2651
2832
  const t = i !== undefined ? e[i] : e;
2652
2833
  const n = Object.keys(s);
2653
- for (let e = 0; e < n.length; e++) t[n[e]] = s[n[e]];
2834
+ for (let e = 0; e < n.length; e++) {
2835
+ const i = n[e];
2836
+ if (isPrototypePollutionKey(i)) continue;
2837
+ const r = Object.getOwnPropertyDescriptor(s, i);
2838
+ if (r.get || r.set) Object.defineProperty(t, i, r);
2839
+ else t[i] = r.value;
2840
+ }
2654
2841
  } else {
2655
2842
  e[i] = s;
2656
2843
  }
@@ -2852,67 +3039,69 @@ function mapArray(e, t, n) {
2852
3039
  const i = typeof n?.keyed === "function" ? n.keyed : undefined;
2853
3040
  const r = t.length > 1;
2854
3041
  const s = t;
2855
- return createMemo(
2856
- updateKeyedMap.bind({
2857
- Ye: createOwner(),
2858
- Be: 0,
2859
- Ze: e,
2860
- qe: [],
2861
- ze: s,
2862
- Xe: [],
2863
- Je: [],
2864
- et: i,
2865
- tt: i || n?.keyed === false ? [] : undefined,
2866
- nt: r ? [] : undefined,
2867
- it: n?.fallback
2868
- })
2869
- );
3042
+ const o = {
3043
+ je: createOwner(),
3044
+ $e: 0,
3045
+ Ke: e,
3046
+ Ye: [],
3047
+ Be: s,
3048
+ Ze: [],
3049
+ qe: [],
3050
+ ze: i,
3051
+ Xe: i || n?.keyed === false ? [] : undefined,
3052
+ Je: r ? [] : undefined,
3053
+ et: n?.fallback
3054
+ };
3055
+ const u = computed(updateKeyedMap.bind(o));
3056
+ o.je.u = u;
3057
+ u.Ee &= ~CONFIG_AUTO_DISPOSE;
3058
+ return accessor(u);
2870
3059
  }
2871
- const pureOptions = { pureWrite: true };
3060
+ const pureOptions = { ownedWrite: true };
2872
3061
  function updateKeyedMap() {
2873
- const e = this.Ze() || [],
3062
+ const e = this.Ke() || [],
2874
3063
  t = e.length;
2875
3064
  e[$TRACK];
2876
- runWithOwner(this.Ye, () => {
3065
+ runWithOwner(this.je, () => {
2877
3066
  let n,
2878
3067
  i,
2879
- r = this.tt
3068
+ r = this.Xe
2880
3069
  ? () => {
2881
- this.tt[i] = signal(e[i], pureOptions);
2882
- this.nt && (this.nt[i] = signal(i, pureOptions));
2883
- return this.ze(accessor(this.tt[i]), this.nt ? accessor(this.nt[i]) : undefined);
3070
+ this.Xe[i] = signal(e[i], pureOptions);
3071
+ this.Je && (this.Je[i] = signal(i, pureOptions));
3072
+ return this.Be(accessor(this.Xe[i]), this.Je ? accessor(this.Je[i]) : undefined);
2884
3073
  }
2885
- : this.nt
3074
+ : this.Je
2886
3075
  ? () => {
2887
3076
  const t = e[i];
2888
- this.nt[i] = signal(i, pureOptions);
2889
- return this.ze(() => t, accessor(this.nt[i]));
3077
+ this.Je[i] = signal(i, pureOptions);
3078
+ return this.Be(() => t, accessor(this.Je[i]));
2890
3079
  }
2891
3080
  : () => {
2892
3081
  const t = e[i];
2893
- return this.ze(() => t);
3082
+ return this.Be(() => t);
2894
3083
  };
2895
3084
  if (t === 0) {
2896
- if (this.Be !== 0) {
2897
- this.Ye.dispose(false);
2898
- this.Je = [];
3085
+ if (this.$e !== 0) {
3086
+ this.je.dispose(false);
2899
3087
  this.qe = [];
2900
- this.Xe = [];
2901
- this.Be = 0;
2902
- this.tt && (this.tt = []);
2903
- this.nt && (this.nt = []);
2904
- }
2905
- if (this.it && !this.Xe[0]) {
2906
- this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
2907
- }
2908
- } else if (this.Be === 0) {
2909
- if (this.Je[0]) this.Je[0].dispose();
2910
- this.Xe = new Array(t);
3088
+ this.Ye = [];
3089
+ this.Ze = [];
3090
+ this.$e = 0;
3091
+ this.Xe && (this.Xe = []);
3092
+ this.Je && (this.Je = []);
3093
+ }
3094
+ if (this.et && !this.Ze[0]) {
3095
+ this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
3096
+ }
3097
+ } else if (this.$e === 0) {
3098
+ if (this.qe[0]) this.qe[0].dispose();
3099
+ this.Ze = new Array(t);
2911
3100
  for (i = 0; i < t; i++) {
2912
- this.qe[i] = e[i];
2913
- this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
3101
+ this.Ye[i] = e[i];
3102
+ this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
2914
3103
  }
2915
- this.Be = t;
3104
+ this.$e = t;
2916
3105
  } else {
2917
3106
  let s,
2918
3107
  o,
@@ -2922,153 +3111,157 @@ function updateKeyedMap() {
2922
3111
  l,
2923
3112
  f,
2924
3113
  E = new Array(t),
2925
- d = new Array(t),
2926
- T = this.tt ? new Array(t) : undefined,
2927
- S = this.nt ? new Array(t) : undefined;
3114
+ T = new Array(t),
3115
+ S = this.Xe ? new Array(t) : undefined,
3116
+ d = this.Je ? new Array(t) : undefined;
2928
3117
  for (
2929
- s = 0, o = Math.min(this.Be, t);
2930
- s < o && (this.qe[s] === e[s] || (this.tt && compare(this.et, this.qe[s], e[s])));
3118
+ s = 0, o = Math.min(this.$e, t);
3119
+ s < o && (this.Ye[s] === e[s] || (this.Xe && compare(this.ze, this.Ye[s], e[s])));
2931
3120
  s++
2932
3121
  ) {
2933
- if (this.tt) setSignal(this.tt[s], e[s]);
3122
+ if (this.Xe) setSignal(this.Xe[s], e[s]);
2934
3123
  }
2935
3124
  for (
2936
- o = this.Be - 1, u = t - 1;
3125
+ o = this.$e - 1, u = t - 1;
2937
3126
  o >= s &&
2938
3127
  u >= s &&
2939
- (this.qe[o] === e[u] || (this.tt && compare(this.et, this.qe[o], e[u])));
3128
+ (this.Ye[o] === e[u] || (this.Xe && compare(this.ze, this.Ye[o], e[u])));
2940
3129
  o--, u--
2941
3130
  ) {
2942
- E[u] = this.Xe[o];
2943
- d[u] = this.Je[o];
2944
- T && (T[u] = this.tt[o]);
2945
- S && (S[u] = this.nt[o]);
3131
+ E[u] = this.Ze[o];
3132
+ T[u] = this.qe[o];
3133
+ S && (S[u] = this.Xe[o]);
3134
+ d && (d[u] = this.Je[o]);
2946
3135
  }
2947
3136
  l = new Map();
2948
3137
  f = new Array(u + 1);
2949
3138
  for (i = u; i >= s; i--) {
2950
3139
  c = e[i];
2951
- a = this.et ? this.et(c) : c;
3140
+ a = this.ze ? this.ze(c) : c;
2952
3141
  n = l.get(a);
2953
3142
  f[i] = n === undefined ? -1 : n;
2954
3143
  l.set(a, i);
2955
3144
  }
2956
3145
  for (n = s; n <= o; n++) {
2957
- c = this.qe[n];
2958
- a = this.et ? this.et(c) : c;
3146
+ c = this.Ye[n];
3147
+ a = this.ze ? this.ze(c) : c;
2959
3148
  i = l.get(a);
2960
3149
  if (i !== undefined && i !== -1) {
2961
- E[i] = this.Xe[n];
2962
- d[i] = this.Je[n];
2963
- T && (T[i] = this.tt[n]);
2964
- S && (S[i] = this.nt[n]);
3150
+ E[i] = this.Ze[n];
3151
+ T[i] = this.qe[n];
3152
+ S && (S[i] = this.Xe[n]);
3153
+ d && (d[i] = this.Je[n]);
2965
3154
  i = f[i];
2966
3155
  l.set(a, i);
2967
- } else this.Je[n].dispose();
3156
+ } else this.qe[n].dispose();
2968
3157
  }
2969
3158
  for (i = s; i < t; i++) {
2970
3159
  if (i in E) {
2971
- this.Xe[i] = E[i];
2972
- this.Je[i] = d[i];
2973
- if (T) {
2974
- this.tt[i] = T[i];
2975
- setSignal(this.tt[i], e[i]);
2976
- }
3160
+ this.Ze[i] = E[i];
3161
+ this.qe[i] = T[i];
2977
3162
  if (S) {
2978
- this.nt[i] = S[i];
2979
- setSignal(this.nt[i], i);
3163
+ this.Xe[i] = S[i];
3164
+ setSignal(this.Xe[i], e[i]);
3165
+ }
3166
+ if (d) {
3167
+ this.Je[i] = d[i];
3168
+ setSignal(this.Je[i], i);
2980
3169
  }
2981
3170
  } else {
2982
- this.Xe[i] = runWithOwner((this.Je[i] = createOwner()), r);
3171
+ this.Ze[i] = runWithOwner((this.qe[i] = createOwner()), r);
2983
3172
  }
2984
3173
  }
2985
- this.Xe = this.Xe.slice(0, (this.Be = t));
2986
- this.qe = e.slice(0);
3174
+ this.Ze = this.Ze.slice(0, (this.$e = t));
3175
+ this.Ye = e.slice(0);
2987
3176
  }
2988
3177
  });
2989
- return this.Xe;
3178
+ return this.Ze;
2990
3179
  }
2991
3180
  function repeat(e, t, n) {
2992
3181
  const i = t;
2993
- return updateRepeat.bind({
2994
- Ye: createOwner(),
2995
- Be: 0,
2996
- rt: 0,
2997
- st: e,
2998
- ze: i,
2999
- Je: [],
3000
- Xe: [],
3001
- ot: n?.from,
3002
- it: n?.fallback
3003
- });
3182
+ const r = computed(
3183
+ updateRepeat.bind({
3184
+ je: createOwner(),
3185
+ $e: 0,
3186
+ tt: 0,
3187
+ nt: e,
3188
+ Be: i,
3189
+ qe: [],
3190
+ Ze: [],
3191
+ it: n?.from,
3192
+ et: n?.fallback
3193
+ })
3194
+ );
3195
+ r.Ee &= ~CONFIG_AUTO_DISPOSE;
3196
+ return accessor(r);
3004
3197
  }
3005
3198
  function updateRepeat() {
3006
- const e = this.st();
3007
- const t = this.ot?.() || 0;
3008
- runWithOwner(this.Ye, () => {
3199
+ const e = this.nt();
3200
+ const t = this.it?.() || 0;
3201
+ runWithOwner(this.je, () => {
3009
3202
  if (e === 0) {
3010
- if (this.Be !== 0) {
3011
- this.Ye.dispose(false);
3012
- this.Je = [];
3013
- this.Xe = [];
3014
- this.Be = 0;
3203
+ if (this.$e !== 0) {
3204
+ this.je.dispose(false);
3205
+ this.qe = [];
3206
+ this.Ze = [];
3207
+ this.$e = 0;
3015
3208
  }
3016
- if (this.it && !this.Xe[0]) {
3017
- this.Xe[0] = runWithOwner((this.Je[0] = createOwner()), this.it);
3209
+ if (this.et && !this.Ze[0]) {
3210
+ this.Ze[0] = runWithOwner((this.qe[0] = createOwner()), this.et);
3018
3211
  }
3019
3212
  return;
3020
3213
  }
3021
3214
  const n = t + e;
3022
- const i = this.rt + this.Be;
3023
- if (this.Be === 0 && this.Je[0]) this.Je[0].dispose();
3024
- for (let e = n; e < i; e++) this.Je[e - this.rt].dispose();
3025
- if (this.rt < t) {
3026
- let e = this.rt;
3027
- while (e < t && e < this.Be) this.Je[e++].dispose();
3028
- this.Je.splice(0, t - this.rt);
3029
- this.Xe.splice(0, t - this.rt);
3030
- } else if (this.rt > t) {
3031
- let n = i - this.rt - 1;
3032
- let r = this.rt - t;
3033
- this.Je.length = this.Xe.length = e;
3215
+ const i = this.tt + this.$e;
3216
+ if (this.$e === 0 && this.qe[0]) this.qe[0].dispose();
3217
+ for (let e = n; e < i; e++) this.qe[e - this.tt].dispose();
3218
+ if (this.tt < t) {
3219
+ let e = this.tt;
3220
+ while (e < t && e < this.$e) this.qe[e++].dispose();
3221
+ this.qe.splice(0, t - this.tt);
3222
+ this.Ze.splice(0, t - this.tt);
3223
+ } else if (this.tt > t) {
3224
+ let n = i - this.tt - 1;
3225
+ let r = this.tt - t;
3226
+ this.qe.length = this.Ze.length = e;
3034
3227
  while (n >= r) {
3035
- this.Je[n] = this.Je[n - r];
3036
- this.Xe[n] = this.Xe[n - r];
3228
+ this.qe[n] = this.qe[n - r];
3229
+ this.Ze[n] = this.Ze[n - r];
3037
3230
  n--;
3038
3231
  }
3039
3232
  for (let e = 0; e < r; e++) {
3040
- this.Xe[e] = runWithOwner((this.Je[e] = createOwner()), () => this.ze(e + t));
3233
+ this.Ze[e] = runWithOwner((this.qe[e] = createOwner()), () => this.Be(e + t));
3041
3234
  }
3042
3235
  }
3043
3236
  for (let e = i; e < n; e++) {
3044
- this.Xe[e - t] = runWithOwner((this.Je[e - t] = createOwner()), () => this.ze(e));
3237
+ this.Ze[e - t] = runWithOwner((this.qe[e - t] = createOwner()), () => this.Be(e));
3045
3238
  }
3046
- this.Xe = this.Xe.slice(0, e);
3047
- this.rt = t;
3048
- this.Be = e;
3239
+ this.Ze = this.Ze.slice(0, e);
3240
+ this.tt = t;
3241
+ this.$e = e;
3049
3242
  });
3050
- return this.Xe;
3243
+ return this.Ze;
3051
3244
  }
3052
3245
  function compare(e, t, n) {
3053
3246
  return e ? e(t) === e(n) : true;
3054
3247
  }
3055
3248
  function boundaryComputed(e, t) {
3056
- const n = computed(e, undefined, { lazy: true });
3249
+ const n = computed(e, { lazy: true });
3057
3250
  n.Ge = (e, t) => {
3058
- const i = e !== undefined ? e : n.Se;
3059
- const r = t !== undefined ? t : n.fe;
3060
- n.Se &= ~n.ut;
3061
- n.F.notify(n, n.ut, i, r);
3251
+ const i = e !== undefined ? e : n.Oe;
3252
+ const r = t !== undefined ? t : n.Te;
3253
+ n.Oe &= ~n.rt;
3254
+ n.$.notify(n, n.rt, i, r);
3062
3255
  };
3063
- n.ut = t;
3064
- n.ge = true;
3256
+ n.rt = t;
3257
+ n.Ee &= ~CONFIG_AUTO_DISPOSE;
3065
3258
  recompute(n, true);
3066
3259
  return n;
3067
3260
  }
3068
3261
  function createBoundChildren(e, t, n, i) {
3069
- const r = e.F;
3070
- r.addChild((e.F = n));
3071
- cleanup(() => r.removeChild(e.F));
3262
+ const r = e.$;
3263
+ r.addChild((e.$ = n));
3264
+ cleanup(() => r.removeChild(e.$));
3072
3265
  return runWithOwner(e, () => {
3073
3266
  const e = computed(t);
3074
3267
  return boundaryComputed(() => staleValues(() => flatten(read(e))), i);
@@ -3078,168 +3271,215 @@ const ON_INIT = Symbol();
3078
3271
  const RevealControllerContext = createContext(null);
3079
3272
  let _revealUsed = false;
3080
3273
  const FALSE_ACCESSOR = () => false;
3274
+ const SEQUENTIAL_ACCESSOR = () => "sequential";
3081
3275
  function isRevealController(e) {
3082
3276
  return e instanceof RevealController;
3083
3277
  }
3084
3278
  function isSlotReady(e) {
3085
- return isRevealController(e) ? e.isReady() : e.ct.size === 0 && !e.lt;
3279
+ return isRevealController(e) ? e.isReady() : e.st.size === 0 && !e.ot;
3280
+ }
3281
+ function isSlotMinimallyReady(e) {
3282
+ return isRevealController(e) ? e.isMinimallyReady() : isSlotReady(e);
3086
3283
  }
3087
3284
  function setSlotState(e, t, n, i) {
3088
- setSignal(e.ft, n);
3089
- setSignal(e.Et, i);
3285
+ setSignal(e.ut, n);
3286
+ setSignal(e.ct, i);
3090
3287
  if (isRevealController(e)) {
3091
- if (!n && e.dt === t) e.dt = undefined;
3288
+ if (!n && e.lt === t) e.lt = undefined;
3092
3289
  return e.evaluate(n, i);
3093
3290
  }
3094
- if (!n && e.Tt === t && e.St) e.Tt = undefined;
3291
+ if (!n && e.ft === t && e.Et) e.ft = undefined;
3095
3292
  }
3096
3293
  class RevealController {
3097
- Rt;
3098
- Ot;
3099
- _t = [];
3100
- dt;
3101
- ft = signal(false, { pureWrite: true, He: true });
3102
- Et = signal(false, { pureWrite: true, He: true });
3103
- ht = true;
3104
- It = false;
3294
+ Tt;
3295
+ St;
3296
+ dt = [];
3297
+ lt;
3298
+ ut = signal(false, { ownedWrite: true, Fe: true });
3299
+ ct = signal(false, { ownedWrite: true, Fe: true });
3300
+ Ot = true;
3301
+ Rt = true;
3302
+ _t = false;
3105
3303
  constructor(e, t) {
3106
- this.Rt = e;
3107
- this.Ot = t;
3304
+ this.Tt = e;
3305
+ this.St = t;
3108
3306
  }
3109
- At(e) {
3110
- for (let t = 0; t < this._t.length; t++) {
3111
- const n = this._t[t];
3112
- if ((isRevealController(n) ? n.dt : n.Tt) !== this) continue;
3307
+ It(e) {
3308
+ for (let t = 0; t < this.dt.length; t++) {
3309
+ const n = this.dt[t];
3310
+ if ((isRevealController(n) ? n.lt : n.ft) !== this) continue;
3113
3311
  if (e(n) === false) return false;
3114
3312
  }
3115
3313
  return true;
3116
3314
  }
3117
3315
  isReady() {
3118
- return this.At(isSlotReady);
3316
+ return this.It(isSlotReady);
3317
+ }
3318
+ isMinimallyReady() {
3319
+ const e = untrack(this.Tt);
3320
+ if (e === "together") return this.isReady();
3321
+ if (e === "natural") {
3322
+ let e = false;
3323
+ let t = false;
3324
+ this.It(n => {
3325
+ e = true;
3326
+ if (isSlotMinimallyReady(n)) {
3327
+ t = true;
3328
+ return false;
3329
+ }
3330
+ });
3331
+ return !e || t;
3332
+ }
3333
+ let t = true;
3334
+ this.It(e => {
3335
+ t = isSlotMinimallyReady(e);
3336
+ return false;
3337
+ });
3338
+ return t;
3119
3339
  }
3120
3340
  register(e) {
3121
- if (this._t.includes(e)) return;
3122
- this._t.push(e);
3123
- const t = !!untrack(this.Rt);
3124
- setSignal(e.ft, true), setSignal(e.Et, t ? false : !!untrack(this.Ot));
3341
+ if (this.dt.includes(e)) return;
3342
+ this.dt.push(e);
3343
+ const t = untrack(this.Tt);
3344
+ (setSignal(e.ut, true), setSignal(e.ct, t === "sequential" ? !!untrack(this.St) : false));
3125
3345
  untrack(() => this.evaluate());
3126
3346
  }
3127
3347
  unregister(e) {
3128
- const t = this._t.indexOf(e);
3129
- if (t >= 0) this._t.splice(t, 1);
3348
+ const t = this.dt.indexOf(e);
3349
+ if (t >= 0) this.dt.splice(t, 1);
3130
3350
  untrack(() => this.evaluate());
3131
3351
  }
3132
3352
  evaluate(e, t) {
3133
- if (this.It) return;
3134
- this.It = true;
3135
- const n = this.ht;
3353
+ if (this._t) return;
3354
+ this._t = true;
3355
+ const n = this.Ot;
3356
+ const i = this.Rt;
3136
3357
  try {
3137
- const n = e ?? read(this.ft),
3138
- i = !!untrack(this.Ot),
3139
- r = t ?? i;
3140
- if (n && r) this.At(e => setSlotState(e, this, true, true));
3141
- else if (!!untrack(this.Rt)) {
3142
- const e = this.isReady();
3143
- this.At(t => setSlotState(t, this, !e, false));
3358
+ const n = e ?? read(this.ut),
3359
+ i = untrack(this.Tt),
3360
+ r = i === "sequential" && !!untrack(this.St),
3361
+ s = t ?? r;
3362
+ if (n) {
3363
+ this.It(e => setSlotState(e, this, true, s));
3364
+ } else if (i === "natural") {
3365
+ this.It(e => {
3366
+ if (isRevealController(e)) {
3367
+ setSignal(e.ct, false);
3368
+ setSignal(e.ut, false);
3369
+ e.evaluate(false, false);
3370
+ } else {
3371
+ setSlotState(e, this, !isSlotReady(e), false);
3372
+ }
3373
+ });
3374
+ } else if (i === "together") {
3375
+ const e = this.It(isSlotMinimallyReady);
3376
+ this.It(t => setSlotState(t, this, !e, false));
3144
3377
  } else {
3145
3378
  let e = false;
3146
- this.At(t => {
3147
- if (e) return setSlotState(t, this, true, i);
3379
+ this.It(t => {
3380
+ if (e) return setSlotState(t, this, true, r);
3148
3381
  if (isSlotReady(t)) return setSlotState(t, this, false, false);
3149
3382
  e = true;
3150
- setSlotState(t, this, true, false);
3383
+ if (isRevealController(t)) {
3384
+ setSignal(t.ct, false);
3385
+ setSignal(t.ut, false);
3386
+ t.evaluate(false, false);
3387
+ } else {
3388
+ setSlotState(t, this, true, false);
3389
+ }
3151
3390
  });
3152
3391
  }
3153
3392
  } finally {
3154
- this.ht = this.isReady();
3155
- this.It = false;
3393
+ this.Ot = this.isReady();
3394
+ this.Rt = this.isMinimallyReady();
3395
+ this._t = false;
3156
3396
  }
3157
- if (this.dt && n !== this.ht) this.dt.evaluate();
3397
+ if (this.lt && (n !== this.Ot || i !== this.Rt)) this.lt.evaluate();
3158
3398
  }
3159
3399
  }
3160
3400
  class CollectionQueue extends Queue {
3401
+ ht;
3402
+ st = new Set();
3161
3403
  Nt;
3162
- ct = new Set();
3163
- gt;
3164
- lt = true;
3165
- ft = signal(false, { pureWrite: true, He: true });
3166
- Et = signal(false, { pureWrite: true, He: true });
3167
- Tt;
3168
- St = false;
3169
- Pt;
3170
- Ct = ON_INIT;
3404
+ ot = true;
3405
+ ut = signal(false, { ownedWrite: true, Fe: true });
3406
+ ct = signal(false, { ownedWrite: true, Fe: true });
3407
+ ft;
3408
+ Et = false;
3409
+ At;
3410
+ Pt = ON_INIT;
3171
3411
  constructor(e) {
3172
3412
  super();
3173
- this.Nt = e;
3413
+ this.ht = e;
3174
3414
  }
3175
3415
  run(e) {
3176
- if (!e || (read(this.ft) && (!_revealUsed || read(this.Et)))) return;
3416
+ if (!e || (read(this.ut) && (!_revealUsed || read(this.ct)))) return;
3177
3417
  return super.run(e);
3178
3418
  }
3179
3419
  notify(e, t, n, i) {
3180
- if (!(t & this.Nt)) return super.notify(e, t, n, i);
3181
- if (this.St && this.Pt) {
3420
+ if (!(t & this.ht)) return super.notify(e, t, n, i);
3421
+ if (this.Et && this.At) {
3182
3422
  const e = untrack(() => {
3183
3423
  try {
3184
- return this.Pt();
3424
+ return this.At();
3185
3425
  } catch {
3186
3426
  return ON_INIT;
3187
3427
  }
3188
3428
  });
3189
- if (e !== this.Ct) {
3190
- this.Ct = e;
3191
- this.St = false;
3192
- this.ct.clear();
3429
+ if (e !== this.Pt) {
3430
+ this.Pt = e;
3431
+ this.Et = false;
3432
+ this.st.clear();
3193
3433
  }
3194
3434
  }
3195
- if (this.Nt & STATUS_PENDING && this.St) return super.notify(e, t, n, i);
3196
- if (this.Nt & STATUS_PENDING && n & STATUS_ERROR) {
3435
+ if (this.ht & STATUS_PENDING && this.Et) return super.notify(e, t, n, i);
3436
+ if (this.ht & STATUS_PENDING && n & STATUS_ERROR) {
3197
3437
  return super.notify(e, STATUS_ERROR, n, i);
3198
3438
  }
3199
- if (n & this.Nt) {
3200
- this.lt = true;
3201
- const t = i?.source || e.fe?.source;
3439
+ if (n & this.ht) {
3440
+ this.ot = true;
3441
+ const t = i?.source || e.Te?.source;
3202
3442
  if (t) {
3203
- const e = this.ct.size === 0;
3204
- this.ct.add(t);
3205
- if (e) setSignal(this.ft, true);
3443
+ const e = this.st.size === 0;
3444
+ this.st.add(t);
3445
+ if (e) setSignal(this.ut, true);
3206
3446
  }
3207
3447
  }
3208
- t &= ~this.Nt;
3448
+ t &= ~this.ht;
3209
3449
  return t ? super.notify(e, t, n, i) : true;
3210
3450
  }
3211
3451
  checkSources() {
3212
- for (const e of this.ct) {
3452
+ for (const e of this.st) {
3213
3453
  if (
3214
- e.O & REACTIVE_DISPOSED ||
3215
- (!(e.Se & this.Nt) && !(this.Nt & STATUS_ERROR && e.Se & STATUS_PENDING))
3454
+ e.R & REACTIVE_DISPOSED ||
3455
+ (!(e.Oe & this.ht) && !(this.ht & STATUS_ERROR && e.Oe & STATUS_PENDING))
3216
3456
  )
3217
- this.ct.delete(e);
3457
+ this.st.delete(e);
3218
3458
  }
3219
- if (!this.ct.size) {
3220
- if (this.Nt & STATUS_PENDING && this.lt && !this.St && this.gt) {
3221
- this.lt = !!(this.gt.Se & this.Nt);
3459
+ if (!this.st.size) {
3460
+ if (this.ht & STATUS_PENDING && this.ot && !this.Et && this.Nt) {
3461
+ this.ot = !!(this.Nt.Oe & this.ht);
3222
3462
  } else {
3223
- this.lt = false;
3463
+ this.ot = false;
3224
3464
  }
3225
- if (!this.lt) {
3226
- setSignal(this.ft, false);
3227
- if (this.Pt) {
3465
+ if (!this.ot) {
3466
+ setSignal(this.ut, false);
3467
+ if (this.At) {
3228
3468
  try {
3229
- this.Ct = untrack(() => this.Pt());
3469
+ this.Pt = untrack(() => this.At());
3230
3470
  } catch {}
3231
3471
  }
3232
3472
  }
3233
3473
  }
3234
- if (_revealUsed) this.Tt?.evaluate();
3474
+ if (_revealUsed) this.ft?.evaluate();
3235
3475
  }
3236
3476
  }
3237
3477
  function createCollectionBoundary(e, t, n, i) {
3238
3478
  const r = createOwner();
3239
3479
  if (_revealUsed) setContext(RevealControllerContext, null, r);
3240
3480
  const s = new CollectionQueue(e);
3241
- if (i) s.Pt = i;
3242
- const o = (s.gt = createBoundChildren(r, t, s, e));
3481
+ if (i) s.At = i;
3482
+ const o = (s.Nt = createBoundChildren(r, t, s, e));
3243
3483
  untrack(() => {
3244
3484
  let t = false;
3245
3485
  try {
@@ -3248,33 +3488,34 @@ function createCollectionBoundary(e, t, n, i) {
3248
3488
  if (e instanceof NotReadyError) t = true;
3249
3489
  else throw e;
3250
3490
  }
3251
- s.lt = t || !!(o.Se & e) || o.fe instanceof NotReadyError;
3491
+ s.ot = t || !!(o.Oe & e) || o.Te instanceof NotReadyError;
3252
3492
  });
3253
3493
  const u = _revealUsed && e === STATUS_PENDING ? getContext(RevealControllerContext) : null;
3254
3494
  if (u) {
3255
- s.Tt = u;
3495
+ s.ft = u;
3256
3496
  u.register(s);
3257
3497
  cleanup(() => u.unregister(s));
3258
3498
  }
3259
- const c = computed(() => {
3260
- if (!read(s.ft)) {
3261
- const e = read(o);
3262
- if (!untrack(() => read(s.ft))) return (s.St = true), e;
3263
- }
3264
- if (_revealUsed && read(s.Et)) return undefined;
3265
- return n(s);
3266
- });
3267
- return accessor(c);
3499
+ return accessor(
3500
+ computed(() => {
3501
+ if (!read(s.ut)) {
3502
+ const e = read(o);
3503
+ if (!untrack(() => read(s.ut))) return ((s.Et = true), e);
3504
+ }
3505
+ if (_revealUsed && read(s.ct)) return undefined;
3506
+ return n(s);
3507
+ })
3508
+ );
3268
3509
  }
3269
3510
  function createLoadingBoundary(e, t, n) {
3270
3511
  return createCollectionBoundary(STATUS_PENDING, e, () => t(), n?.on);
3271
3512
  }
3272
3513
  function createErrorBoundary(e, t) {
3273
3514
  return createCollectionBoundary(STATUS_ERROR, e, e => {
3274
- let n = e.ct.values().next().value;
3275
- const i = n.fe?.cause ?? n.fe;
3515
+ let n = e.st.values().next().value;
3516
+ const i = n.Te?.cause ?? n.Te;
3276
3517
  return t(i, () => {
3277
- for (const t of e.ct) recompute(t);
3518
+ for (const t of e.st) recompute(t);
3278
3519
  schedule();
3279
3520
  });
3280
3521
  });
@@ -3283,7 +3524,7 @@ function createRevealOrder(e, t) {
3283
3524
  _revealUsed = true;
3284
3525
  const n = createOwner();
3285
3526
  const i = getContext(RevealControllerContext);
3286
- const r = t?.together || FALSE_ACCESSOR,
3527
+ const r = t?.order || SEQUENTIAL_ACCESSOR,
3287
3528
  s = t?.collapsed || FALSE_ACCESSOR;
3288
3529
  const o = new RevealController(r, s);
3289
3530
  setContext(RevealControllerContext, o, n);
@@ -3295,7 +3536,7 @@ function createRevealOrder(e, t) {
3295
3536
  o.evaluate();
3296
3537
  });
3297
3538
  if (i) {
3298
- o.dt = i;
3539
+ o.lt = i;
3299
3540
  i.register(o);
3300
3541
  cleanup(() => i.unregister(o));
3301
3542
  }