@solidjs/signals 0.13.13 → 2.0.0-beta.11

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