@but212/atom-effect 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const N = {
1
+ var R = {
2
2
  IDLE: "idle",
3
3
  PENDING: "pending",
4
4
  RESOLVED: "resolved",
@@ -6,9 +6,8 @@ const N = {
6
6
  }, _ = {
7
7
  DISPOSED: 1,
8
8
  EXECUTING: 8
9
- }, W = {
9
+ }, x = {
10
10
  DISPOSED: 1,
11
- /** Marker bit: identifies this node as a computed. */
12
11
  IS_COMPUTED: 2,
13
12
  DIRTY: 8,
14
13
  IDLE: 16,
@@ -16,233 +15,342 @@ const N = {
16
15
  RESOLVED: 64,
17
16
  REJECTED: 128,
18
17
  RECOMPUTING: 256,
19
- HAS_ERROR: 512
18
+ HAS_ERROR: 512,
19
+ FORCE_COMPUTE: 1024
20
20
  }, a = {
21
21
  DISPOSED: 1,
22
22
  SYNC: 8,
23
23
  NOTIFICATION_SCHEDULED: 16
24
- }, d = {
25
- // Infinite loop protection
24
+ }, C = {
26
25
  MAX_EXECUTIONS_PER_SECOND: 1e3,
27
26
  MAX_EXECUTIONS_PER_EFFECT: 100,
28
- // Batch processing limits to prevent blocking the main thread for too long
29
27
  MAX_EXECUTIONS_PER_FLUSH: 1e4,
30
28
  MAX_FLUSH_ITERATIONS: 1e3,
31
29
  MIN_FLUSH_ITERATIONS: 10,
32
- // Memory management
33
30
  BATCH_QUEUE_SHRINK_THRESHOLD: 1e3
34
- }, ht = {
31
+ }, J = {
35
32
  WARN_INFINITE_LOOP: !0,
36
33
  EFFECT_FREQUENCY_WINDOW: 1e3
37
- }, V = {
34
+ }, $ = {
38
35
  MAX_ASYNC_RETRIES: 3,
39
36
  MAX_PROMISE_ID: Number.MAX_SAFE_INTEGER - 1
40
- }, g = {
41
- /** Uninitialized epoch marker. Used as initial value before any flush has occurred. */
42
- UNINITIALIZED: -1
43
- }, F = 1073741823, Z = typeof process < "u" && process.env && !1 || !1, ot = Object.freeze([]);
44
- function X(n, t, s) {
45
- const e = /* @__PURE__ */ new Map();
46
- for (let i = 0; i < t.length; i++) {
47
- const r = t[i];
48
- r?.unsub && e.set(r.node, r.unsub);
49
- }
50
- for (let i = 0; i < n.length; i++) {
51
- const r = n[i];
52
- if (!r) continue;
53
- const h = r.node, o = e.get(h);
54
- o !== void 0 ? (r.unsub = o, e.delete(h)) : r.unsub || (r.unsub = h.subscribe(s));
55
- }
56
- for (const i of e.values())
57
- i();
58
- }
59
- class y {
37
+ }, S = {
38
+ UNINITIALIZED: -1,
39
+ MIN: 1
40
+ }, V = 1073741823, q = { VERSION_BITS: 16 }, Ct = (typeof process < "u" && process.env, !1), ht = Object.freeze([]), H = class {
60
41
  constructor(t, s, e = void 0) {
61
42
  this.node = t, this.version = s, this.unsub = e;
62
43
  }
63
- }
64
- class ct {
44
+ }, ut = class {
65
45
  constructor(t, s) {
66
46
  this.fn = t, this.sub = s;
67
47
  }
68
48
  notify(t, s) {
69
49
  this.fn ? this.fn(t, s) : this.sub && this.sub.execute();
70
50
  }
71
- }
72
- class k extends Error {
51
+ }, A = class extends Error {
73
52
  constructor(t, s = null, e = !0) {
74
53
  super(t), this.cause = s, this.recoverable = e, this.name = "AtomError";
75
54
  }
76
- }
77
- class I extends k {
55
+ }, D = class extends A {
78
56
  constructor(t, s = null) {
79
57
  super(t, s, !0), this.name = "ComputedError";
80
58
  }
81
- }
82
- class C extends k {
59
+ }, I = class extends A {
83
60
  constructor(t, s = null) {
84
61
  super(t, s, !1), this.name = "EffectError";
85
62
  }
86
- }
87
- class m extends k {
63
+ }, b = class extends A {
88
64
  constructor(t, s = null) {
89
65
  super(t, s, !1), this.name = "SchedulerError";
90
66
  }
91
- }
92
- const c = {
93
- // Computed Errors
67
+ }, u = {
94
68
  COMPUTED_MUST_BE_FUNCTION: "Computed target must be a function",
95
69
  COMPUTED_ASYNC_PENDING_NO_DEFAULT: "Async computation pending with no default value",
96
70
  COMPUTED_COMPUTATION_FAILED: "Computation execution failed",
97
71
  COMPUTED_ASYNC_COMPUTATION_FAILED: "Async computation execution failed",
98
72
  COMPUTED_CIRCULAR_DEPENDENCY: "Circular dependency detected",
99
73
  COMPUTED_DISPOSED: "Attempted to access disposed computed",
100
- // Atom Errors
101
74
  ATOM_SUBSCRIBER_MUST_BE_FUNCTION: "Subscriber must be a function or Subscriber object",
102
75
  ATOM_INDIVIDUAL_SUBSCRIBER_FAILED: "Subscriber execution failed",
103
- // Effect Errors
104
76
  EFFECT_MUST_BE_FUNCTION: "Effect target must be a function",
105
77
  EFFECT_EXECUTION_FAILED: "Effect execution failed",
106
78
  EFFECT_CLEANUP_FAILED: "Effect cleanup failed",
107
79
  EFFECT_DISPOSED: "Attempted to run disposed effect",
108
- // Scheduler Errors
109
- SCHEDULER_FLUSH_OVERFLOW: (n, t) => `Maximum flush iterations (${n}) exceeded. ${t} jobs dropped. Possible infinite loop.`,
110
- // System / Debug
80
+ SCHEDULER_FLUSH_OVERFLOW: (t, s) => `Maximum flush iterations (${t}) exceeded. ${s} jobs dropped. Possible infinite loop.`,
111
81
  CALLBACK_ERROR_IN_ERROR_HANDLER: "Exception encountered in onError handler",
112
- // Effect frequency
113
82
  EFFECT_FREQUENCY_LIMIT_EXCEEDED: "Effect executed too frequently within 1 second. Suspected infinite loop.",
114
83
  SCHEDULER_CALLBACK_MUST_BE_FUNCTION: "Scheduler callback must be a function",
115
84
  SCHEDULER_END_BATCH_WITHOUT_START: "endBatch() called without matching startBatch(). Ignoring.",
116
85
  BATCH_CALLBACK_MUST_BE_FUNCTION: "Batch callback must be a function"
117
- }, ut = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), _t = /* @__PURE__ */ Symbol("AtomEffect.Type"), x = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), B = {
118
- // Dev mode flag
119
- enabled: Z,
120
- warnInfiniteLoop: ht.WARN_INFINITE_LOOP,
121
- warn(n, t) {
122
- },
123
- attachDebugInfo(n, t, s) {
124
- },
125
- getDebugName: (n) => n?.[ut],
126
- getDebugType: (n) => n?.[_t]
127
- };
128
- let lt = 1;
129
- const at = () => lt++;
130
- function S(n, t, s) {
131
- if (n instanceof k)
132
- return n;
133
- const e = n instanceof Error, i = e ? n.message : String(n), r = e ? n : void 0, o = `${e ? n.constructor.name : "Unexpected error"} (${s}): ${i}`;
134
- return new t(o, r);
135
- }
136
- class J {
86
+ }, tt = class {
137
87
  constructor() {
138
- this.flags = 0, this.version = 0, this._lastSeenEpoch = g.UNINITIALIZED, this.id = at() & F;
88
+ this._s0 = null, this._s1 = null, this._s2 = null, this._s3 = null, this._count = 0, this._epoch = S.UNINITIALIZED, this._overflow = null;
89
+ }
90
+ get size() {
91
+ return this._count;
92
+ }
93
+ getAt(t) {
94
+ if (t === 0) return this._s0;
95
+ if (t === 1) return this._s1;
96
+ if (t === 2) return this._s2;
97
+ if (t === 3) return this._s3;
98
+ const s = this._overflow;
99
+ if (s !== null && t >= 4) {
100
+ const e = t - 4;
101
+ if (e < s.length) return s[e] || null;
102
+ }
103
+ return null;
104
+ }
105
+ setAt(t, s) {
106
+ if (t === 0) this._s0 = s;
107
+ else if (t === 1) this._s1 = s;
108
+ else if (t === 2) this._s2 = s;
109
+ else if (t === 3) this._s3 = s;
110
+ else {
111
+ this._overflow ??= [];
112
+ const e = this._overflow;
113
+ e[t - 4] = s;
114
+ }
115
+ t >= this._count && (this._count = t + 1);
116
+ }
117
+ truncateFrom(t) {
118
+ const s = this._count;
119
+ if (t >= s) return;
120
+ if (t <= 0) {
121
+ const i = this._s0;
122
+ i != null && (this._onItemRemoved(i), this._s0 = null);
123
+ }
124
+ if (t <= 1) {
125
+ const i = this._s1;
126
+ i != null && (this._onItemRemoved(i), this._s1 = null);
127
+ }
128
+ if (t <= 2) {
129
+ const i = this._s2;
130
+ i != null && (this._onItemRemoved(i), this._s2 = null);
131
+ }
132
+ if (t <= 3) {
133
+ const i = this._s3;
134
+ i != null && (this._onItemRemoved(i), this._s3 = null);
135
+ }
136
+ const e = this._overflow;
137
+ if (e !== null && s > 4) {
138
+ const i = t > 4 ? t - 4 : 0, n = e.length;
139
+ for (let r = i; r < n; r++) {
140
+ const o = e[r];
141
+ o != null && (this._onItemRemoved(o), e[r] = null);
142
+ }
143
+ t <= 4 ? (e.length = 0, this._overflow = null) : e.length = t - 4;
144
+ }
145
+ this._count = t;
146
+ }
147
+ _onItemRemoved(t) {
148
+ }
149
+ add(t) {
150
+ if (this._s0 === null) {
151
+ this._s0 = t, this._count++;
152
+ return;
153
+ }
154
+ if (this._s1 === null) {
155
+ this._s1 = t, this._count++;
156
+ return;
157
+ }
158
+ if (this._s2 === null) {
159
+ this._s2 = t, this._count++;
160
+ return;
161
+ }
162
+ if (this._s3 === null) {
163
+ this._s3 = t, this._count++;
164
+ return;
165
+ }
166
+ if (this._overflow === null) this._overflow = [t];
167
+ else {
168
+ const s = this._overflow;
169
+ for (let e = 0, i = s.length; e < i; e++) if (s[e] === null) {
170
+ s[e] = t, this._count++;
171
+ return;
172
+ }
173
+ s.push(t);
174
+ }
175
+ this._count++;
176
+ }
177
+ remove(t) {
178
+ if (this._s0 === t)
179
+ return this._s0 = null, this._count--, !0;
180
+ if (this._s1 === t)
181
+ return this._s1 = null, this._count--, !0;
182
+ if (this._s2 === t)
183
+ return this._s2 = null, this._count--, !0;
184
+ if (this._s3 === t)
185
+ return this._s3 = null, this._count--, !0;
186
+ const s = this._overflow;
187
+ if (s == null) return !1;
188
+ for (let e = 0, i = s.length; e < i; e++) if (s[e] === t)
189
+ return s[e] = null, this._count--, !0;
190
+ return !1;
191
+ }
192
+ has(t) {
193
+ const s = this._count;
194
+ if (s === 0) return !1;
195
+ if (this._s0 === t || this._s1 === t || this._s2 === t || this._s3 === t) return !0;
196
+ if (s <= 4) return !1;
197
+ const e = this._overflow;
198
+ if (e != null) {
199
+ let i = 0;
200
+ this._s0 != null && i++, this._s1 != null && i++, this._s2 != null && i++, this._s3 != null && i++;
201
+ for (let n = 0, r = e.length; n < r; n++) {
202
+ const o = e[n];
203
+ if (o != null) {
204
+ if (o === t) return !0;
205
+ if (++i === s) break;
206
+ }
207
+ }
208
+ }
209
+ return !1;
210
+ }
211
+ forEach(t) {
212
+ const s = this._count;
213
+ if (s === 0) return;
214
+ const e = this._s0;
215
+ e != null && t(e);
216
+ const i = this._s1;
217
+ i != null && t(i);
218
+ const n = this._s2;
219
+ n != null && t(n);
220
+ const r = this._s3;
221
+ if (r != null && t(r), s <= 4) return;
222
+ const o = this._overflow;
223
+ if (o != null) {
224
+ let l = 0;
225
+ e != null && l++, i != null && l++, n != null && l++, r != null && l++;
226
+ for (let h = 0, v = o.length; h < v; h++) {
227
+ const m = o[h];
228
+ if (m != null && (t(m), ++l === s))
229
+ return;
230
+ }
231
+ }
232
+ }
233
+ forEachIndexed(t) {
234
+ const s = this._count;
235
+ if (s === 0) return 0;
236
+ let e = 0;
237
+ const i = this._s0;
238
+ i != null && (t(i), e++);
239
+ const n = this._s1;
240
+ n != null && (t(n), e++);
241
+ const r = this._s2;
242
+ r != null && (t(r), e++);
243
+ const o = this._s3;
244
+ if (o != null && (t(o), e++), s <= 4 || e === s) return e;
245
+ const l = this._overflow;
246
+ if (l != null) for (let h = 0, v = l.length; h < v; h++) {
247
+ const m = l[h];
248
+ if (m != null && (t(m), ++e === s))
249
+ break;
250
+ }
251
+ return e;
252
+ }
253
+ compact() {
254
+ const t = this._overflow;
255
+ if (t === null || t.length === 0) return;
256
+ let s = 0;
257
+ for (; s < t.length; ) if (t[s] === null) {
258
+ const e = t.pop();
259
+ s < t.length && e != null && (t[s] = e);
260
+ } else s++;
261
+ t.length === 0 && (this._overflow = null);
262
+ }
263
+ clear() {
264
+ this._s0 = null, this._s1 = null, this._s2 = null, this._s3 = null, this._count = 0, this._overflow !== null && (this._overflow.length = 0, this._overflow = null);
265
+ }
266
+ dispose() {
267
+ this.clear();
139
268
  }
269
+ }, W = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), lt = /* @__PURE__ */ Symbol("AtomEffect.Id"), j = /* @__PURE__ */ Symbol("AtomEffect.Type"), U = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), G = {
270
+ enabled: !1,
271
+ warnInfiniteLoop: J.WARN_INFINITE_LOOP,
272
+ warn(t, s) {
273
+ },
274
+ attachDebugInfo(t, s, e) {
275
+ },
276
+ getDebugName: (t) => t?.[W],
277
+ getDebugType: (t) => t?.[j]
278
+ }, ct = 1, _t = () => ct++;
279
+ function T(t, s, e) {
280
+ if (t instanceof A) return t;
281
+ const i = t instanceof Error, n = i ? t.message : String(t), r = i ? t : void 0;
282
+ return new s(`${i ? t.constructor.name : "Unexpected error"} (${e}): ${n}`, r);
140
283
  }
141
- class tt extends J {
284
+ var k = class {
142
285
  constructor() {
143
- super(...arguments), this._notifying = 0;
286
+ this.flags = 0, this.version = 0, this._lastSeenEpoch = S.UNINITIALIZED, this.id = _t() & V, this._slots = null, this._notifying = 0, this._deps = null, this._hotIndex = -1;
144
287
  }
145
- /**
146
- * Adds subscriber.
147
- */
148
288
  subscribe(t) {
149
289
  const s = typeof t == "function";
150
- if (!s && (!t || typeof t.execute != "function"))
151
- throw S(
152
- new TypeError("Invalid subscriber"),
153
- k,
154
- c.ATOM_SUBSCRIBER_MUST_BE_FUNCTION
155
- );
156
- const e = this._subscribers, i = e.length;
157
- let r = !1;
158
- for (let o = 0; o < i; o++) {
159
- const U = e[o];
160
- if (U != null && (s ? U.fn === t : U.sub === t)) {
161
- r = !0;
162
- break;
163
- }
164
- }
165
- if (r)
290
+ if (!s && (!t || typeof t.execute != "function")) throw T(/* @__PURE__ */ new TypeError("Invalid subscriber"), A, u.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
291
+ let e = this._slots;
292
+ e || (e = new tt(), this._slots = e);
293
+ let i = !1;
294
+ if (e.forEach((r) => {
295
+ (s ? r.fn === t : r.sub === t) && (i = !0);
296
+ }), i)
166
297
  return () => {
167
298
  };
168
- const h = new ct(
169
- s ? t : void 0,
170
- s ? void 0 : t
171
- );
172
- return e.push(h), () => this._unsubscribe(h);
299
+ const n = new ut(s ? t : void 0, s ? void 0 : t);
300
+ return e.add(n), () => this._unsubscribe(n);
173
301
  }
174
302
  _unsubscribe(t) {
175
- const s = this._subscribers;
176
- let e = -1;
177
- for (let r = 0; r < s.length; r++)
178
- if (s[r] === t) {
179
- e = r;
180
- break;
303
+ if (this._slots) {
304
+ if (this._notifying > 0) {
305
+ this._slots.remove(t);
306
+ return;
181
307
  }
182
- if (e === -1) return;
183
- if (this._notifying > 0) {
184
- s[e] = null;
185
- return;
308
+ this._slots.remove(t), this._slots.compact();
186
309
  }
187
- const i = s.pop();
188
- e < s.length && i !== void 0 && (s[e] = i);
189
310
  }
190
311
  subscriberCount() {
191
- let t = 0;
192
- const s = this._subscribers;
193
- for (let e = 0; e < s.length; e++)
194
- s[e] != null && t++;
195
- return t;
312
+ return this._slots ? this._slots.size : 0;
196
313
  }
197
314
  _notifySubscribers(t, s) {
198
- const e = this._subscribers, i = e.length;
199
- if (i !== 0) {
315
+ const e = this._slots;
316
+ if (!(!e || e.size === 0)) {
200
317
  this._notifying++;
201
318
  try {
202
- for (let r = 0; r < i; r++) {
203
- const h = e[r];
204
- if (h != null)
205
- try {
206
- h.notify(t, s);
207
- } catch (o) {
208
- this._handleNotifyError(o);
209
- }
210
- }
319
+ e.forEach((i) => {
320
+ try {
321
+ i.notify(t, s);
322
+ } catch (n) {
323
+ console.error(T(n, A, u.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
324
+ }
325
+ });
211
326
  } finally {
212
- this._notifying--, this._notifying === 0 && this._cleanupTombstones();
327
+ this._notifying--, this._notifying === 0 && e.compact();
213
328
  }
214
329
  }
215
330
  }
216
- _cleanupTombstones() {
217
- const t = this._subscribers;
218
- let s = 0;
219
- for (; s < t.length; )
220
- if (t[s] === null) {
221
- const e = t.pop();
222
- s < t.length && e !== void 0 && (t[s] = e);
223
- } else
224
- s++;
225
- }
226
- _handleNotifyError(t) {
227
- console.error(S(t, k, c.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
331
+ _isDirty() {
332
+ const t = this._deps;
333
+ if (!t || t.size === 0) return !1;
334
+ if (this._hotIndex !== -1) {
335
+ const s = t.getAt(this._hotIndex);
336
+ if (s != null && s.node.version !== s.version) return !0;
337
+ }
338
+ return !t.hasComputeds && !t.isDirtyFast() ? !1 : this._deepDirtyCheck();
228
339
  }
340
+ }, w = 0, X = () => (w = w + 1 & 1073741823 || 1, w), z = (t) => t + 1 & V, Q = 0, F = !1, st = 0, et = () => st;
341
+ function K() {
342
+ return F ? !1 : (F = !0, st = X(), Q = 0, !0);
229
343
  }
230
- let v = 0;
231
- const w = () => (v = v + 1 & F || 1, v), M = (n) => n + 1 & F;
232
- let z = 0, R = !1, st = 0;
233
- const et = () => st;
234
- function G() {
235
- return R ? !1 : (R = !0, st = w(), z = 0, !0);
236
- }
237
- const Q = () => {
238
- R = !1;
239
- }, ft = () => R ? ++z : 0;
240
- class Et {
344
+ var Z = () => {
345
+ F = !1;
346
+ }, ft = () => F ? ++Q : 0, L = /* @__PURE__ */ (function(t) {
347
+ return t[t.IDLE = 0] = "IDLE", t[t.BATCHING = 1] = "BATCHING", t[t.FLUSHING = 2] = "FLUSHING", t;
348
+ })({}), at = class {
241
349
  constructor() {
242
- this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isBatching = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = d.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
350
+ this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isBatching = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = C.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
243
351
  }
244
352
  get phase() {
245
- return this._isProcessing || this._isFlushingSync ? 2 : this._isBatching ? 1 : 0;
353
+ return this._isProcessing || this._isFlushingSync ? L.FLUSHING : this._isBatching ? L.BATCHING : L.IDLE;
246
354
  }
247
355
  get queueSize() {
248
356
  return this._size;
@@ -250,9 +358,6 @@ class Et {
250
358
  get isBatching() {
251
359
  return this._isBatching;
252
360
  }
253
- /**
254
- * Schedules job.
255
- */
256
361
  schedule(t) {
257
362
  if (t._nextEpoch !== this._epoch) {
258
363
  if (t._nextEpoch = this._epoch, this._isBatching || this._isFlushingSync) {
@@ -262,40 +367,34 @@ class Et {
262
367
  this._queueBuffer[this._bufferIndex][this._size++] = t, this._isProcessing || this._flush();
263
368
  }
264
369
  }
265
- /**
266
- * Triggers flush.
267
- */
268
370
  _flush() {
269
371
  this._isProcessing || this._size === 0 || (this._isProcessing = !0, queueMicrotask(this._boundRunLoop));
270
372
  }
271
- /**
272
- * Scheduler loop.
273
- */
274
373
  _runLoop() {
275
374
  try {
276
375
  if (this._size === 0) return;
277
- const t = G();
278
- this._drainQueue(), t && Q();
376
+ const t = K();
377
+ this._drainQueue(), t && Z();
279
378
  } finally {
280
379
  this._isProcessing = !1, this._size > 0 && !this._isBatching && this._flush();
281
380
  }
282
381
  }
283
382
  _flushSync() {
284
383
  this._isFlushingSync = !0;
285
- const t = G();
384
+ const t = K();
286
385
  try {
287
386
  this._mergeBatchQueue(), this._drainQueue();
288
387
  } finally {
289
- this._isFlushingSync = !1, t && Q();
388
+ this._isFlushingSync = !1, t && Z();
290
389
  }
291
390
  }
292
391
  _mergeBatchQueue() {
293
392
  if (this._batchQueueSize === 0) return;
294
393
  const t = ++this._epoch, s = this._batchQueue, e = this._queueBuffer[this._bufferIndex];
295
394
  let i = this._size;
296
- s.slice(0, this._batchQueueSize).forEach((r) => {
297
- r._nextEpoch !== t && (r._nextEpoch = t, e[i++] = r);
298
- }), this._size = i, this._batchQueueSize = 0, s.length > d.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
395
+ s.slice(0, this._batchQueueSize).forEach((n) => {
396
+ n._nextEpoch !== t && (n._nextEpoch = t, e[i++] = n);
397
+ }), this._size = i, this._batchQueueSize = 0, s.length > C.BATCH_QUEUE_SHRINK_THRESHOLD && (s.length = 0);
299
398
  }
300
399
  _drainQueue() {
301
400
  let t = 0;
@@ -310,26 +409,20 @@ class Et {
310
409
  _processQueue() {
311
410
  const t = this._bufferIndex, s = this._queueBuffer[t], e = this._size;
312
411
  this._bufferIndex = t ^ 1, this._size = 0, this._epoch++;
313
- for (let i = 0; i < e; i++)
314
- try {
315
- const r = s[i];
316
- typeof r == "function" ? r() : r.execute();
317
- } catch (r) {
318
- console.error(new m("Error occurred during scheduler execution", r));
319
- }
412
+ for (let i = 0; i < e; i++) try {
413
+ const n = s[i];
414
+ typeof n == "function" ? n() : n.execute();
415
+ } catch (n) {
416
+ console.error(new b("Error occurred during scheduler execution", n));
417
+ }
320
418
  s.length = 0;
321
419
  }
322
420
  _handleFlushOverflow() {
323
421
  const t = this._size + this._batchQueueSize;
324
- if (console.error(
325
- new m(
326
- c.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, t)
327
- )
328
- ), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this._batchQueueSize = 0, this.onOverflow)
329
- try {
330
- this.onOverflow(t);
331
- } catch {
332
- }
422
+ if (console.error(new b(u.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, t))), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this._batchQueueSize = 0, this.onOverflow) try {
423
+ this.onOverflow(t);
424
+ } catch {
425
+ }
333
426
  }
334
427
  startBatch() {
335
428
  this._batchDepth++, this._isBatching = !0;
@@ -338,214 +431,303 @@ class Et {
338
431
  this._batchDepth !== 0 && --this._batchDepth === 0 && (this._flushSync(), this._isBatching = !1);
339
432
  }
340
433
  setMaxFlushIterations(t) {
341
- if (t < d.MIN_FLUSH_ITERATIONS)
342
- throw new m(
343
- `Max flush iterations must be at least ${d.MIN_FLUSH_ITERATIONS}`
344
- );
434
+ if (t < C.MIN_FLUSH_ITERATIONS) throw new b(`Max flush iterations must be at least ${C.MIN_FLUSH_ITERATIONS}`);
345
435
  this._maxFlushIterations = t;
346
436
  }
347
- }
348
- const T = new Et(), H = /* @__PURE__ */ Symbol.for("atom-effect/atom"), it = /* @__PURE__ */ Symbol.for("atom-effect/computed"), nt = /* @__PURE__ */ Symbol.for("atom-effect/effect"), dt = /* @__PURE__ */ Symbol.for("atom-effect/writable"), l = {
349
- /** Active listener. */
437
+ }, y = new at(), Y = /* @__PURE__ */ Symbol.for("atom-effect/atom"), it = /* @__PURE__ */ Symbol.for("atom-effect/computed"), nt = /* @__PURE__ */ Symbol.for("atom-effect/effect"), Et = /* @__PURE__ */ Symbol.for("atom-effect/writable"), c = {
350
438
  current: null,
351
- /**
352
- * Executes in context.
353
- *
354
- * @param listener - The subscriber.
355
- * @param fn - The logic to execute.
356
- * @returns The result of `fn`.
357
- */
358
- run(n, t) {
359
- const s = this.current;
360
- this.current = n;
439
+ run(t, s) {
440
+ const e = this.current;
441
+ this.current = t;
361
442
  try {
362
- return t();
443
+ return s();
363
444
  } finally {
364
- this.current = s;
445
+ this.current = e;
365
446
  }
366
447
  }
367
448
  };
368
- function Dt(n) {
369
- const t = l.current;
370
- if (t === null) return n();
371
- l.current = null;
449
+ function St(t) {
450
+ const s = c.current;
451
+ if (s === null) return t();
452
+ c.current = null;
372
453
  try {
373
- return n();
454
+ return t();
374
455
  } finally {
375
- l.current = t;
456
+ c.current = s;
376
457
  }
377
458
  }
378
- var Y, q;
379
- class It extends tt {
459
+ var dt = class extends k {
380
460
  constructor(t, s) {
381
- super(), this._pendingOldValue = void 0, this._subscribers = [], this[q] = !0, this[Y] = !0, this._value = t, s && (this.flags |= a.SYNC), B.attachDebugInfo(this, "atom", this.id);
461
+ super(), this._pendingOldValue = void 0, this[Y] = !0, this[Et] = !0, this._value = t, s && (this.flags |= a.SYNC), G.attachDebugInfo(this, "atom", this.id);
382
462
  }
383
463
  get value() {
384
- return l.current?.addDependency(this), this._value;
464
+ const t = c.current;
465
+ return t?.addDependency(this), this._value;
385
466
  }
386
467
  set value(t) {
387
468
  const s = this._value;
388
469
  if (Object.is(s, t)) return;
389
- this._value = t, this.version = M(this.version);
390
- const e = this.flags;
391
- if (!(this._subscribers.length === 0 || e & a.NOTIFICATION_SCHEDULED)) {
392
- if (this._pendingOldValue = s, this.flags = e | a.NOTIFICATION_SCHEDULED, e & a.SYNC && !T.isBatching) {
393
- this._flushNotifications();
394
- return;
395
- }
396
- T.schedule(this);
470
+ this._value = t, this.version = z(this.version);
471
+ const e = this._slots, i = this.flags;
472
+ if (e == null || e.size === 0 || i & a.NOTIFICATION_SCHEDULED) return;
473
+ this._pendingOldValue = s;
474
+ const n = i | a.NOTIFICATION_SCHEDULED;
475
+ if (this.flags = n, (n & a.SYNC) !== 0 && !y.isBatching) {
476
+ this._flushNotifications();
477
+ return;
397
478
  }
479
+ y.schedule(this);
398
480
  }
399
- /**
400
- * Executes scheduled notification.
401
- * @internal
402
- */
403
481
  execute() {
404
482
  this._flushNotifications();
405
483
  }
406
- /**
407
- * Triggers subscribers.
408
- */
409
484
  _flushNotifications() {
410
485
  const t = this.flags;
411
- if (!(t & a.NOTIFICATION_SCHEDULED) || t & a.DISPOSED)
412
- return;
486
+ if (!(t & a.NOTIFICATION_SCHEDULED) || t & a.DISPOSED) return;
413
487
  const s = this._pendingOldValue;
414
- this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(this._value, s);
488
+ this._pendingOldValue = void 0, this.flags &= ~a.NOTIFICATION_SCHEDULED, this._notifySubscribers(this._value, s);
415
489
  }
416
490
  peek() {
417
491
  return this._value;
418
492
  }
419
493
  dispose() {
420
- this.flags & a.DISPOSED || (this._subscribers.length = 0, this.flags |= a.DISPOSED, this._value = void 0, this._pendingOldValue = void 0);
494
+ this.flags & a.DISPOSED || (this._slots?.clear(), this.flags |= a.DISPOSED, this._value = void 0, this._pendingOldValue = void 0);
421
495
  }
422
- [(q = H, Y = dt, Symbol.dispose)]() {
496
+ _deepDirtyCheck() {
497
+ return !1;
498
+ }
499
+ [Symbol.dispose]() {
423
500
  this.dispose();
424
501
  }
502
+ };
503
+ function vt(t, s = {}) {
504
+ return new dt(t, s.sync ?? !1);
425
505
  }
426
- function bt(n, t = {}) {
427
- return new It(n, t.sync ?? !1);
428
- }
429
- class pt {
430
- /**
431
- * @param limit - Max unique arrays to hold (default: 50). Prevents the pool itself from consuming too much memory.
432
- * @param capacity - Max length of an array to accept (default: 256).
433
- * @param enableStats - Force-enable stats even in production (default: false).
434
- */
435
- constructor(t = 50, s = 256, e = !1) {
436
- this.limit = t, this.capacity = s, this.pool = [], this.stats = null, this.stats = e ? {
437
- acquired: 0,
438
- released: 0,
439
- rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
440
- } : null;
441
- }
442
- /**
443
- * Acquires array.
444
- */
445
- acquire() {
446
- return this.stats && this.stats.acquired++, this.pool.pop() ?? [];
447
- }
448
- /**
449
- * Releases array.
450
- *
451
- * @param arr - Array to release.
452
- * @param emptyConst - Optional empty constant.
453
- */
454
- release(t, s) {
455
- if (!(s && t === s)) {
456
- if (t.length > this.capacity) {
457
- this.stats && this.stats.rejected.tooLarge++;
458
- return;
506
+ var rt = class extends tt {
507
+ constructor() {
508
+ super(), this._map = null, this._SCAN_THRESHOLD = 32, this.hasComputeds = !1, this._depsHash = 0, this._map = null, this.hasComputeds = !1, this._depsHash = 0;
509
+ }
510
+ prepareTracking() {
511
+ this.hasComputeds = !1;
512
+ }
513
+ _onItemRemoved(t) {
514
+ const s = t.unsub;
515
+ s && s();
516
+ }
517
+ claimExisting(t, s) {
518
+ const e = this._count;
519
+ if (s >= e) return !1;
520
+ const i = e - s;
521
+ if (this._map !== null || i > this._SCAN_THRESHOLD) return this._claimViaMap(t, s);
522
+ if (s < 4) {
523
+ if (s <= 0) {
524
+ const o = this._s0;
525
+ if (o && o.node === t && o.unsub)
526
+ return o.version = t.version, !0;
459
527
  }
460
- if (this.pool.length >= this.limit) {
461
- this.stats && this.stats.rejected.poolFull++;
462
- return;
528
+ if (s <= 1 && e > 1) {
529
+ const o = this._s1;
530
+ if (o && o.node === t && o.unsub)
531
+ return o.version = t.version, s !== 1 && (this._s1 = this._s0, this._s0 = o), !0;
463
532
  }
464
- if (Object.isFrozen(t)) {
465
- this.stats && this.stats.rejected.frozen++;
466
- return;
533
+ if (s <= 2 && e > 2) {
534
+ const o = this._s2;
535
+ if (o && o.node === t && o.unsub)
536
+ return o.version = t.version, s !== 2 && this._swapInline(2, s, o), !0;
537
+ }
538
+ if (s <= 3 && e > 3) {
539
+ const o = this._s3;
540
+ if (o && o.node === t && o.unsub)
541
+ return o.version = t.version, s !== 3 && this._swapInline(3, s, o), !0;
542
+ }
543
+ }
544
+ const n = s > 4 ? s : 4, r = this._overflow;
545
+ if (r) for (let o = n - 4, l = r.length; o < l; o++) {
546
+ const h = r[o];
547
+ if (h && h.node === t && h.unsub)
548
+ return h.version = t.version, this._swapGeneral(o + 4, s, h), !0;
549
+ }
550
+ return !1;
551
+ }
552
+ _claimViaMap(t, s) {
553
+ if (this._map === null) {
554
+ this._map = /* @__PURE__ */ new Map();
555
+ const n = this._count;
556
+ for (let r = s; r < n; r++) {
557
+ const o = this.getAt(r);
558
+ o?.unsub && this._map.set(o.node, r);
467
559
  }
468
- t.length = 0, this.pool.push(t), this.stats && this.stats.released++;
469
- }
470
- }
471
- /**
472
- * Pool stats.
473
- */
474
- getStats() {
475
- if (!this.stats) return null;
476
- const { acquired: t, released: s, rejected: e } = this.stats, i = t - s - (e.frozen + e.tooLarge + e.poolFull);
477
- return {
478
- acquired: t,
479
- released: s,
480
- rejected: { ...e },
481
- leaked: i,
482
- poolSize: this.pool.length
483
- };
484
- }
485
- /**
486
- * Resets pool.
487
- */
488
- reset() {
489
- this.pool.length = 0, this.stats && (this.stats = {
490
- acquired: 0,
491
- released: 0,
492
- rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
493
- });
560
+ }
561
+ const e = this._map.get(t);
562
+ if (e === void 0 || e < s) return !1;
563
+ const i = this.getAt(e);
564
+ if (i == null || !i.unsub) return !1;
565
+ if (i.version = t.version, e !== s) {
566
+ const n = this.getAt(s);
567
+ this.setAt(s, i), this.setAt(e, n), n?.unsub && this._map.set(n.node, e), this._map.set(t, s);
568
+ }
569
+ return !0;
570
+ }
571
+ _swapInline(t, s, e) {
572
+ const i = this.getAt(s);
573
+ this.setAt(s, e), this.setAt(t, i);
574
+ }
575
+ _swapGeneral(t, s, e) {
576
+ if (t === s) return;
577
+ const i = this.getAt(s);
578
+ this.setAt(s, e), this.setAt(t, i);
579
+ }
580
+ insertNew(t, s) {
581
+ const e = this._count;
582
+ if (t < e) {
583
+ const i = this.getAt(t);
584
+ i != null && (this.add(i), this._map !== null && i.unsub && this._map.set(i.node, this._count - 1));
585
+ }
586
+ t === 0 ? this._s0 = s : t === 1 ? this._s1 = s : t === 2 ? this._s2 = s : t === 3 ? this._s3 = s : this.setAt(t, s), t >= e && (this._count = t + 1);
494
587
  }
588
+ truncateFrom(t) {
589
+ t >= this._count || (super.truncateFrom(t), this._map !== null && (this._map.clear(), this._map = null));
590
+ }
591
+ seal() {
592
+ const t = this._count;
593
+ if (t <= 0) {
594
+ this._depsHash = 0;
595
+ return;
596
+ }
597
+ let s = 0;
598
+ const e = q.VERSION_BITS, i = this._s0;
599
+ if (i && (s = s + (i.version << e) + i.node.id | 0), t > 1) {
600
+ const n = this._s1;
601
+ n && (s = s + (n.version << e) + n.node.id | 0);
602
+ }
603
+ if (t > 2) {
604
+ const n = this._s2;
605
+ n && (s = s + (n.version << e) + n.node.id | 0);
606
+ }
607
+ if (t > 3) {
608
+ const n = this._s3;
609
+ n && (s = s + (n.version << e) + n.node.id | 0);
610
+ const r = this._overflow;
611
+ if (r) for (let o = 0, l = r.length; o < l; o++) {
612
+ const h = r[o];
613
+ h && (s = s + (h.version << e) + h.node.id | 0);
614
+ }
615
+ }
616
+ this._depsHash = s;
617
+ }
618
+ isDirtyFast() {
619
+ const t = this._count;
620
+ if (t <= 0) return !1;
621
+ let s = 0;
622
+ const e = q.VERSION_BITS, i = this._s0;
623
+ if (i) {
624
+ const n = i.node;
625
+ s = s + (n.version << e) + n.id | 0;
626
+ }
627
+ if (t > 1) {
628
+ const n = this._s1;
629
+ if (n) {
630
+ const r = n.node;
631
+ s = s + (r.version << e) + r.id | 0;
632
+ }
633
+ }
634
+ if (t > 2) {
635
+ const n = this._s2;
636
+ if (n) {
637
+ const r = n.node;
638
+ s = s + (r.version << e) + r.id | 0;
639
+ }
640
+ }
641
+ if (t > 3) {
642
+ const n = this._s3;
643
+ if (n) {
644
+ const o = n.node;
645
+ s = s + (o.version << e) + o.id | 0;
646
+ }
647
+ const r = this._overflow;
648
+ if (r) for (let o = 0, l = r.length; o < l; o++) {
649
+ const h = r[o];
650
+ if (h) {
651
+ const v = h.node;
652
+ s = s + (v.version << e) + v.id | 0;
653
+ }
654
+ }
655
+ }
656
+ return s !== this._depsHash;
657
+ }
658
+ captureVersionSnapshot() {
659
+ const t = this._count;
660
+ if (t <= 0) return 0;
661
+ let s = 0;
662
+ const e = this._s0;
663
+ if (e && (s = (s << 5) - s + e.node.version | 0), t > 1) {
664
+ const i = this._s1;
665
+ i && (s = (s << 5) - s + i.node.version | 0);
666
+ }
667
+ if (t > 2) {
668
+ const i = this._s2;
669
+ i && (s = (s << 5) - s + i.node.version | 0);
670
+ }
671
+ if (t > 3) {
672
+ const i = this._s3;
673
+ i && (s = (s << 5) - s + i.node.version | 0);
674
+ const n = this._overflow;
675
+ if (n) for (let r = 0, o = n.length; r < o; r++) {
676
+ const l = n[r];
677
+ l && (s = (s << 5) - s + l.node.version | 0);
678
+ }
679
+ }
680
+ return s;
681
+ }
682
+ disposeAll() {
683
+ this._count > 0 && this.truncateFrom(0), this.hasComputeds = !1, this._map !== null && (this._map.clear(), this._map = null);
684
+ }
685
+ remove(t) {
686
+ throw new Error("remove() is strictly prohibited in DepSlotBuffer to preserve sequential cache paths.");
687
+ }
688
+ compact() {
689
+ }
690
+ };
691
+ function Dt(t) {
692
+ return t !== null && typeof t == "object" && Y in t;
495
693
  }
496
- const u = Object.freeze(
497
- []
498
- ), f = new pt();
499
- function Tt(n) {
500
- return n !== null && typeof n == "object" && H in n;
501
- }
502
- function Nt(n) {
503
- return n !== null && typeof n == "object" && it in n;
504
- }
505
- function Lt(n) {
506
- return n !== null && typeof n == "object" && nt in n;
694
+ function gt(t) {
695
+ return t !== null && typeof t == "object" && it in t;
507
696
  }
508
- function rt(n) {
509
- return n !== null && typeof n == "object" && typeof n.then == "function";
697
+ function Tt(t) {
698
+ return t !== null && typeof t == "object" && nt in t;
510
699
  }
511
- var j, $;
512
- const { IDLE: L, DIRTY: p, PENDING: O, RESOLVED: E, REJECTED: b, HAS_ERROR: A, RECOMPUTING: D, DISPOSED: P, IS_COMPUTED: Ct } = W;
513
- function gt(n) {
514
- return n & E ? N.RESOLVED : n & O ? N.PENDING : n & b ? N.REJECTED : N.IDLE;
700
+ function ot(t) {
701
+ return t !== null && typeof t == "object" && typeof t.then == "function";
515
702
  }
516
- class St extends tt {
703
+ var { IDLE: d, DIRTY: f, PENDING: g, RESOLVED: E, REJECTED: p, HAS_ERROR: N, RECOMPUTING: O, DISPOSED: M, IS_COMPUTED: P, FORCE_COMPUTE: B } = x, pt = class extends k {
517
704
  constructor(t, s = {}) {
518
- if (typeof t != "function") throw new I(c.COMPUTED_MUST_BE_FUNCTION);
519
- super(), this[$] = !0, this[j] = !0, this._error = null, this._promiseId = 0, this._subscribers = [], this._links = u, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._lastDriftEpoch = g.UNINITIALIZED, this._trackEpoch = g.UNINITIALIZED, this._trackLinks = u, this._trackCount = 0, this._value = void 0, this.flags = Ct | p | L, this._equal = s.equal ?? Object.is, this._fn = t, this._defaultValue = "defaultValue" in s ? s.defaultValue : x, this._onError = s.onError ?? null;
520
- const e = s.maxAsyncRetries;
521
- if (this._maxAsyncRetries = (e ?? V.MAX_ASYNC_RETRIES) & F, B.attachDebugInfo(this, "computed", this.id), s.lazy === !1)
522
- try {
523
- this._recompute();
524
- } catch {
525
- }
705
+ if (typeof t != "function") throw new D(u.COMPUTED_MUST_BE_FUNCTION);
706
+ if (super(), this[Y] = !0, this[it] = !0, this._error = null, this._promiseId = 0, this._deps = new rt(), this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._lastDriftEpoch = S.UNINITIALIZED, this._trackEpoch = S.UNINITIALIZED, this._trackCount = 0, this._value = void 0, this.flags = P | f | d, this._equal = s.equal ?? Object.is, this._fn = t, this._defaultValue = "defaultValue" in s ? s.defaultValue : U, this._onError = s.onError ?? null, this._maxAsyncRetries = (s.maxAsyncRetries ?? $.MAX_ASYNC_RETRIES) & V, G.attachDebugInfo(this, "computed", this.id), s.lazy === !1) try {
707
+ this._recompute();
708
+ } catch {
709
+ }
526
710
  }
527
711
  _track() {
528
- l.current?.addDependency(this);
712
+ c.current?.addDependency(this);
529
713
  }
530
714
  get value() {
531
715
  this._track();
532
716
  const t = this.flags;
533
- if ((t & (E | p | L)) === E)
534
- return this._value;
535
- if (t & P)
536
- throw new I(c.COMPUTED_DISPOSED);
537
- if (t & D) {
538
- if (this._defaultValue !== x) return this._defaultValue;
539
- throw new I(c.COMPUTED_CIRCULAR_DEPENDENCY);
717
+ if ((t & (E | f | d)) === E) return this._value;
718
+ if (t & M) throw new D(u.COMPUTED_DISPOSED);
719
+ if (t & O) {
720
+ if (this._defaultValue !== U) return this._defaultValue;
721
+ throw new D(u.COMPUTED_CIRCULAR_DEPENDENCY);
540
722
  }
541
- if (t & (p | L) && (this._recompute(), this.flags & E))
723
+ if (t & (f | d) && ((t & d) === 0 && (t & B) === 0 && this._deps.size > 0 && !this._isDirty() ? this.flags &= ~f : this._recompute(), this.flags & E))
542
724
  return this._value;
543
- const s = this._defaultValue, e = s !== x;
544
- if (this.flags & O) {
725
+ const s = this._defaultValue, e = s !== U;
726
+ if (this.flags & g) {
545
727
  if (e) return s;
546
- throw new I(c.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
728
+ throw new D(u.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
547
729
  }
548
- if (this.flags & b) {
730
+ if (this.flags & p) {
549
731
  if (e) return s;
550
732
  throw this._error;
551
733
  }
@@ -555,161 +737,160 @@ class St extends tt {
555
737
  return this._value;
556
738
  }
557
739
  get state() {
558
- return this._track(), gt(this.flags);
740
+ this._track();
741
+ const t = this.flags;
742
+ return t & E ? R.RESOLVED : t & g ? R.PENDING : t & p ? R.REJECTED : R.IDLE;
559
743
  }
560
744
  get hasError() {
561
- return this._track(), this.flags & (b | A) ? !0 : this._links.some((t) => t?.node?.flags & A);
745
+ if (this._track(), this.flags & (p | N)) return !0;
746
+ const t = this._deps, s = t.size;
747
+ for (let e = 0; e < s; e++) {
748
+ const i = t.getAt(e);
749
+ if (i != null && i.node.flags & N) return !0;
750
+ }
751
+ return !1;
562
752
  }
563
753
  get isValid() {
564
754
  return !this.hasError;
565
755
  }
566
756
  get errors() {
567
- if (this._track(), !this.hasError) return ot;
757
+ this._track();
568
758
  const t = [];
569
- return this._error && t.push(this._error), this._links.forEach((e) => {
570
- const i = e.node;
571
- i.flags & A && i.errors.forEach((h) => {
572
- h && !t.includes(h) && t.push(h);
573
- });
574
- }), Object.freeze(t);
759
+ this._error && t.push(this._error);
760
+ const s = this._deps, e = s.size;
761
+ for (let i = 0; i < e; i++) {
762
+ const n = s.getAt(i);
763
+ if (n == null) continue;
764
+ const r = n.node;
765
+ r.flags & N && this._collectErrorsFromDep(r, t);
766
+ }
767
+ return t.length === 0 ? ht : Object.freeze(t);
768
+ }
769
+ _collectErrorsFromDep(t, s) {
770
+ const e = t.errors, i = e.length;
771
+ for (let n = 0; n < i; n++) {
772
+ const r = e[n];
773
+ r != null && !s.includes(r) && s.push(r);
774
+ }
575
775
  }
576
776
  get lastError() {
577
777
  return this._track(), this._error;
578
778
  }
579
779
  get isPending() {
580
- return this._track(), (this.flags & O) !== 0;
780
+ return this._track(), (this.flags & g) !== 0;
581
781
  }
582
782
  get isResolved() {
583
783
  return this._track(), (this.flags & E) !== 0;
584
784
  }
585
785
  invalidate() {
586
- this._markDirty();
786
+ this.flags |= B, this._markDirty();
587
787
  }
588
788
  dispose() {
589
- if (this.flags & P) return;
590
- const t = this._links;
591
- t !== u && (t.forEach((s) => s.unsub?.()), f.release(t), this._links = u), this._subscribers.length = 0, this.flags = P | p | L, this._error = null, this._value = void 0;
789
+ this.flags & M || (this._deps.disposeAll(), this._slots?.clear(), this.flags = M | f | d, this._error = null, this._value = void 0, this._hotIndex = -1);
592
790
  }
593
- [($ = H, j = it, Symbol.dispose)]() {
791
+ [Symbol.dispose]() {
594
792
  this.dispose();
595
793
  }
596
794
  addDependency(t) {
597
- if (t._lastSeenEpoch !== this._trackEpoch) {
598
- if (t._lastSeenEpoch = this._trackEpoch, this._trackLinks === this._links && this._trackCount < this._links.length && this._links[this._trackCount].node === t) {
599
- this._links[this._trackCount].version = t.version, this._trackCount++;
600
- return;
601
- }
602
- if (this._trackLinks === this._links) {
603
- const s = f.acquire();
604
- for (let e = 0; e < this._trackCount; e++)
605
- s[e] = this._links[e];
606
- this._trackLinks = s;
607
- }
608
- this._trackCount < this._trackLinks.length ? this._trackLinks[this._trackCount] = new y(t, t.version) : this._trackLinks.push(new y(t, t.version)), this._trackCount++;
795
+ if (t._lastSeenEpoch === this._trackEpoch) return;
796
+ t._lastSeenEpoch = this._trackEpoch;
797
+ const s = this._trackCount, e = this._deps.getAt(s);
798
+ if (e != null && e.node === t) e.version = t.version;
799
+ else if (!this._deps.claimExisting(t, s)) {
800
+ const i = new H(t, t.version, t.subscribe(this));
801
+ this._deps.insertNew(s, i);
609
802
  }
803
+ t.flags & P && (this._deps.hasComputeds = !0), this._trackCount = s + 1;
610
804
  }
611
805
  _recompute() {
612
- if (this.flags & D) return;
613
- this.flags |= D;
614
- const t = this._links;
615
- this._trackEpoch = w(), this._trackLinks = t, this._trackCount = 0;
616
- let s = !1;
806
+ if (this.flags & O) return;
807
+ this.flags = (this.flags | O) & ~B, this._trackEpoch = X(), this._trackCount = 0, this._deps.prepareTracking(), this._hotIndex = -1;
808
+ let t = !1;
617
809
  try {
618
- const e = l.run(this, this._fn);
619
- if (this._trackLinks === t)
620
- if (this._trackCount === t.length)
621
- s = !0;
622
- else {
623
- for (let i = this._trackCount; i < t.length; i++)
624
- t[i].unsub?.();
625
- t.length = this._trackCount, s = !0;
626
- }
627
- else
628
- this._trackLinks.length = this._trackCount, X(this._trackLinks, t, this), this._links = this._trackLinks, s = !0;
629
- rt(e) ? this._handleAsyncComputation(e) : this._finalizeResolution(e);
630
- } catch (e) {
631
- if (!s)
632
- try {
633
- if (this._trackLinks === t) {
634
- for (let i = this._trackCount; i < t.length; i++)
635
- t[i].unsub?.();
636
- t.length = this._trackCount, s = !0;
637
- } else
638
- this._trackLinks.length = this._trackCount, X(this._trackLinks, t, this), this._links = this._trackLinks, s = !0;
639
- } catch {
640
- }
641
- this._handleError(e, c.COMPUTED_COMPUTATION_FAILED, !0);
810
+ const s = c.run(this, this._fn);
811
+ this._deps.truncateFrom(this._trackCount), this._deps.seal(), t = !0, ot(s) ? this._handleAsyncComputation(s) : this._finalizeResolution(s);
812
+ } catch (s) {
813
+ if (!t) try {
814
+ this._deps.truncateFrom(this._trackCount);
815
+ } catch {
816
+ }
817
+ this._handleError(s, u.COMPUTED_COMPUTATION_FAILED, !0);
642
818
  } finally {
643
- s ? this._links !== t && t !== u && f.release(t) : this._trackLinks !== t && this._trackLinks !== u && f.release(this._trackLinks), this._trackEpoch = g.UNINITIALIZED, this._trackLinks = u, this._trackCount = 0, this.flags &= ~D;
819
+ this._trackEpoch = S.UNINITIALIZED, this._trackCount = 0, this.flags &= ~O;
644
820
  }
645
821
  }
646
822
  _handleAsyncComputation(t) {
647
- this.flags = (this.flags | O) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % V.MAX_PROMISE_ID;
823
+ this.flags = (this.flags | g) & ~(d | f | E | p), this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % $.MAX_PROMISE_ID;
648
824
  const s = this._promiseId;
649
- t.then(
650
- (e) => {
651
- if (s === this._promiseId) {
652
- if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion) {
653
- const i = et();
654
- return this._lastDriftEpoch !== i && (this._lastDriftEpoch = i, this._asyncRetryCount = 0), this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(
655
- new I(
656
- `Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`
657
- ),
658
- c.COMPUTED_ASYNC_COMPUTATION_FAILED
659
- );
660
- }
661
- this._finalizeResolution(e), this._notifySubscribers(e, void 0);
825
+ t.then((e) => {
826
+ if (s === this._promiseId) {
827
+ if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion) {
828
+ const i = et();
829
+ return this._lastDriftEpoch !== i && (this._lastDriftEpoch = i, this._asyncRetryCount = 0), this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(new D(`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`), u.COMPUTED_ASYNC_COMPUTATION_FAILED);
662
830
  }
663
- },
664
- (e) => s === this._promiseId && this._handleError(e, c.COMPUTED_ASYNC_COMPUTATION_FAILED)
665
- );
831
+ this._finalizeResolution(e), this._notifySubscribers(e, void 0);
832
+ }
833
+ }, (e) => s === this._promiseId && this._handleError(e, u.COMPUTED_ASYNC_COMPUTATION_FAILED));
666
834
  }
667
835
  _captureVersionSnapshot() {
668
- let t = 0;
669
- const s = this._links;
670
- for (let e = 0, i = s.length; e < i; e++)
671
- t = (t << 5) - t + s[e].node.version | 0;
672
- return t;
836
+ return this._deps.captureVersionSnapshot();
673
837
  }
674
838
  _handleError(t, s, e = !1) {
675
- const i = S(t, I, s);
676
- if (!e && !(this.flags & b) && (this.version = M(this.version)), this._error = i, this.flags = this.flags & -121 | b | A, this._onError)
677
- try {
678
- this._onError(i);
679
- } catch (r) {
680
- console.error(c.CALLBACK_ERROR_IN_ERROR_HANDLER, r);
681
- }
839
+ const i = T(t, D, s);
840
+ if (!e && !(this.flags & p) && (this.version = z(this.version)), this._error = i, this.flags = this.flags & ~(d | f | g | E) | p | N, this._onError) try {
841
+ this._onError(i);
842
+ } catch (n) {
843
+ console.error(u.CALLBACK_ERROR_IN_ERROR_HANDLER, n);
844
+ }
682
845
  if (e) throw i;
683
846
  this._notifySubscribers(void 0, void 0);
684
847
  }
685
848
  _finalizeResolution(t) {
686
- (!(this.flags & E) || !this._equal(this._value, t)) && (this.version = M(this.version)), this._value = t, this._error = null, this.flags = (this.flags | E) & -697;
849
+ (!(this.flags & E) || !this._equal(this._value, t)) && (this.version = z(this.version)), this._value = t, this._error = null, this.flags = (this.flags | E) & ~(d | f | g | p | N);
687
850
  }
688
851
  execute() {
689
852
  this._markDirty();
690
853
  }
691
- /** @internal */
692
854
  _markDirty() {
693
- this.flags & (D | p) || (this.flags |= p, this._notifySubscribers(void 0, void 0));
855
+ this.flags & (O | f) || (this.flags |= f, this._notifySubscribers(void 0, void 0));
694
856
  }
857
+ _deepDirtyCheck() {
858
+ const t = this._deps, s = c.current;
859
+ c.current = null;
860
+ try {
861
+ const e = t.size;
862
+ for (let i = 0; i < e; i++) {
863
+ const n = t.getAt(i);
864
+ if (n == null) continue;
865
+ const r = n.node;
866
+ if (r.flags & P) try {
867
+ r.value;
868
+ } catch {
869
+ }
870
+ if (r.version !== n.version)
871
+ return this._hotIndex = i, !0;
872
+ }
873
+ return this._hotIndex = -1, !1;
874
+ } finally {
875
+ c.current = s;
876
+ }
877
+ }
878
+ };
879
+ function At(t, s = {}) {
880
+ return new pt(t, s);
695
881
  }
696
- function At(n, t = {}) {
697
- return new St(n, t);
698
- }
699
- var K;
700
- class kt extends J {
882
+ var It = class extends k {
701
883
  constructor(t, s = {}) {
702
- super(), this[K] = !0, this._cleanup = null, this._links = u, this._nextLinks = null, this._prevLinks = u, this._currentEpoch = g.UNINITIALIZED, this._lastFlushEpoch = g.UNINITIALIZED, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._trackCount = 0, this._fn = t, this._onError = s.onError ?? null, this._sync = s.sync ?? !1, this._maxExecutions = s.maxExecutionsPerSecond ?? d.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = s.maxExecutionsPerFlush ?? d.MAX_EXECUTIONS_PER_EFFECT, this._sync ? this._notifyCallback = () => this.execute() : this._notifyCallback = () => T.schedule(this), B.attachDebugInfo(this, "effect", this.id);
884
+ super(), this[nt] = !0, this._cleanup = null, this._deps = new rt(), this._currentEpoch = S.UNINITIALIZED, this._lastFlushEpoch = S.UNINITIALIZED, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._trackCount = 0, this._fn = t, this._onError = s.onError ?? null, this._sync = s.sync ?? !1, this._maxExecutions = s.maxExecutionsPerSecond ?? C.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = s.maxExecutionsPerFlush ?? C.MAX_EXECUTIONS_PER_EFFECT, this._sync ? this._notifyCallback = () => this.execute() : this._notifyCallback = () => y.schedule(this), G.attachDebugInfo(this, "effect", this.id);
703
885
  }
704
886
  run() {
705
- if (this.flags & _.DISPOSED)
706
- throw new C(c.EFFECT_DISPOSED);
887
+ if (this.flags & _.DISPOSED) throw new I(u.EFFECT_DISPOSED);
707
888
  this.execute(!0);
708
889
  }
709
890
  dispose() {
710
- this.flags & _.DISPOSED || (this.flags |= _.DISPOSED, this._execCleanup(), this._unsubLinks(this._links), this._links !== u && f.release(this._links), this._links = u, this._prevLinks = u);
891
+ this.flags & _.DISPOSED || (this.flags |= _.DISPOSED, this._execCleanup(), this._deps?.disposeAll());
711
892
  }
712
- [(K = nt, Symbol.dispose)]() {
893
+ [Symbol.dispose]() {
713
894
  this.dispose();
714
895
  }
715
896
  addDependency(t) {
@@ -717,117 +898,79 @@ class kt extends J {
717
898
  const s = this._currentEpoch;
718
899
  if (t._lastSeenEpoch === s) return;
719
900
  t._lastSeenEpoch = s;
720
- const e = this._prevLinks;
721
- if (this._nextLinks === e && this._trackCount < e.length && e[this._trackCount].node === t) {
722
- e[this._trackCount].version = t.version, this._trackCount++;
723
- return;
724
- }
725
- if (this._nextLinks === e) {
726
- const h = f.acquire();
727
- for (let o = 0; o < this._trackCount; o++)
728
- h[o] = e[o];
729
- this._nextLinks = h;
730
- }
731
- const i = this._nextLinks;
732
- let r = -1;
733
- for (let h = this._trackCount; h < e.length; h++) {
734
- const o = e[h];
735
- if (o && o.node === t && o.unsub) {
736
- r = h;
737
- break;
901
+ const e = this._trackCount, i = this._deps, n = i.getAt(e);
902
+ n != null && n.node === t ? n.version = t.version : i.claimExisting(t, e) || this._insertNewDependency(t, e), t.flags & x.IS_COMPUTED && (i.hasComputeds = !0), this._trackCount = e + 1;
903
+ }
904
+ _insertNewDependency(t, s) {
905
+ let e;
906
+ try {
907
+ const i = t.subscribe(this._notifyCallback);
908
+ e = new H(t, t.version, i);
909
+ } catch (i) {
910
+ const n = T(i, I, u.EFFECT_EXECUTION_FAILED);
911
+ if (console.error(n), this._onError) try {
912
+ this._onError(n);
913
+ } catch {
738
914
  }
915
+ e = new H(t, t.version, void 0);
739
916
  }
740
- if (r !== -1) {
741
- const h = e[r];
742
- h.version = t.version, i[this._trackCount] = h, e[r] = null;
743
- } else
744
- try {
745
- const h = t.subscribe(this._notifyCallback);
746
- i[this._trackCount] = new y(t, t.version, h);
747
- } catch (h) {
748
- const o = S(h, C, c.EFFECT_EXECUTION_FAILED);
749
- if (console.error(o), this._onError)
750
- try {
751
- this._onError(o);
752
- } catch {
753
- }
754
- i[this._trackCount] = new y(t, t.version, void 0);
755
- }
756
- this._trackCount++;
917
+ this._deps.insertNew(s, e);
757
918
  }
758
- /**
759
- * Executes effect with tracking.
760
- */
761
919
  execute(t = !1) {
762
- if (this.flags & (_.DISPOSED | _.EXECUTING) || !t && this._links.length > 0 && !this._isDirty()) return;
763
- this._checkInfiniteLoops(), this.flags |= _.EXECUTING, this._execCleanup(), this._prevLinks = this._links, this._nextLinks = this._links, this._currentEpoch = w(), this._trackCount = 0;
764
- let s = !1;
920
+ if (this.flags & (_.DISPOSED | _.EXECUTING)) return;
921
+ const s = this._deps;
922
+ if (!t && s.size > 0 && !this._isDirty()) return;
923
+ this._checkInfiniteLoops(), this.flags |= _.EXECUTING, this._execCleanup(), this._currentEpoch = X(), this._trackCount = 0, s.prepareTracking(), this._hotIndex = -1;
924
+ let e = !1;
765
925
  try {
766
- const e = l.run(this, this._fn);
767
- if (this._nextLinks === this._prevLinks)
768
- if (this._trackCount === this._prevLinks.length)
769
- s = !0;
770
- else {
771
- for (let i = this._trackCount; i < this._prevLinks.length; i++)
772
- this._prevLinks[i]?.unsub?.();
773
- this._prevLinks.length = this._trackCount, s = !0;
774
- }
775
- else
776
- this._nextLinks.length = this._trackCount, s = !0;
777
- this._links = this._nextLinks, rt(e) ? this._handleAsyncResult(e) : this._cleanup = typeof e == "function" ? e : null;
778
- } catch (e) {
779
- if (!s)
780
- if (this._nextLinks === this._prevLinks) {
781
- for (let i = this._trackCount; i < this._prevLinks.length; i++)
782
- this._prevLinks[i]?.unsub?.();
783
- this._prevLinks.length = this._trackCount, s = !0;
784
- } else
785
- this._nextLinks.length = this._trackCount, s = !0;
786
- this._links = this._nextLinks, this._handleExecutionError(e), this._cleanup = null;
926
+ const i = c.run(this, this._fn);
927
+ s.truncateFrom(this._trackCount), s.seal(), e = !0, ot(i) ? this._handleAsyncResult(i) : this._cleanup = typeof i == "function" ? i : null;
928
+ } catch (i) {
929
+ if (!e) try {
930
+ s.truncateFrom(this._trackCount);
931
+ } catch {
932
+ }
933
+ this._handleExecutionError(i), this._cleanup = null;
787
934
  } finally {
788
- this._finalizeDependencies(s, this._prevLinks, this._nextLinks), this.flags &= -9;
935
+ this.flags &= ~_.EXECUTING;
789
936
  }
790
937
  }
791
938
  _handleAsyncResult(t) {
792
939
  const s = ++this._execId;
793
- t.then(
794
- (e) => {
795
- if (s !== this._execId || this.flags & _.DISPOSED) {
796
- if (typeof e == "function")
797
- try {
798
- e();
799
- } catch (i) {
800
- this._handleExecutionError(i, c.EFFECT_CLEANUP_FAILED);
801
- }
802
- return;
940
+ t.then((e) => {
941
+ if (s !== this._execId || this.flags & _.DISPOSED) {
942
+ if (typeof e == "function") try {
943
+ e();
944
+ } catch (i) {
945
+ this._handleExecutionError(i, u.EFFECT_CLEANUP_FAILED);
803
946
  }
804
- typeof e == "function" && (this._cleanup = e);
805
- },
806
- (e) => s === this._execId && this._handleExecutionError(e)
807
- );
808
- }
809
- _finalizeDependencies(t, s, e) {
810
- this._nextLinks = null, this._prevLinks = u, t ? e !== s && s !== u && (s.forEach((i) => i?.unsub?.()), f.release(s)) : e !== s && e !== u && e && (this._unsubLinks(e), f.release(e));
811
- }
812
- _unsubLinks(t) {
813
- t.forEach((s) => s?.unsub?.());
947
+ return;
948
+ }
949
+ typeof e == "function" && (this._cleanup = e);
950
+ }, (e) => s === this._execId && this._handleExecutionError(e));
814
951
  }
815
- _isDirty() {
816
- const t = this._links, s = l.current;
817
- l.current = null;
952
+ _deepDirtyCheck() {
953
+ const t = c.current;
954
+ c.current = null;
955
+ const s = this._deps;
818
956
  try {
819
- return t.some((e) => {
820
- const i = e.node;
821
- if (i.flags & W.IS_COMPUTED)
822
- try {
823
- i.value;
824
- } catch {
825
- return !0;
826
- }
827
- return i.version !== e.version;
828
- });
957
+ const e = s.size;
958
+ for (let i = 0; i < e; i++) {
959
+ const n = s.getAt(i);
960
+ if (n == null) continue;
961
+ const r = n.node;
962
+ if (r.flags & x.IS_COMPUTED && this._tryPullComputed(r), r.version !== n.version)
963
+ return this._hotIndex = i, !0;
964
+ }
965
+ return !1;
829
966
  } finally {
830
- l.current = s;
967
+ c.current = t;
968
+ }
969
+ }
970
+ _tryPullComputed(t) {
971
+ try {
972
+ t.value;
973
+ } catch {
831
974
  }
832
975
  }
833
976
  _execCleanup() {
@@ -835,14 +978,26 @@ class kt extends J {
835
978
  try {
836
979
  this._cleanup();
837
980
  } catch (t) {
838
- this._handleExecutionError(t, c.EFFECT_CLEANUP_FAILED);
981
+ this._handleExecutionError(t, u.EFFECT_CLEANUP_FAILED);
839
982
  }
840
983
  this._cleanup = null;
841
984
  }
842
985
  }
843
986
  _checkInfiniteLoops() {
844
987
  const t = et();
845
- this._lastFlushEpoch !== t && (this._lastFlushEpoch = t, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), ft() > d.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
988
+ this._lastFlushEpoch !== t && (this._lastFlushEpoch = t, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), ft() > C.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
989
+ }
990
+ _checkFrequencyLimit() {
991
+ if (!Number.isFinite(this._maxExecutions)) return;
992
+ const t = Date.now();
993
+ if (t - this._windowStart >= J.EFFECT_FREQUENCY_WINDOW) {
994
+ this._windowStart = t, this._windowCount = 1;
995
+ return;
996
+ }
997
+ if (++this._windowCount > this._maxExecutions) {
998
+ const s = new I(u.EFFECT_FREQUENCY_LIMIT_EXCEEDED);
999
+ throw this.dispose(), this._handleExecutionError(s), s;
1000
+ }
846
1001
  }
847
1002
  get isDisposed() {
848
1003
  return (this.flags & _.DISPOSED) !== 0;
@@ -854,54 +1009,50 @@ class kt extends J {
854
1009
  return (this.flags & _.EXECUTING) !== 0;
855
1010
  }
856
1011
  _throwInfiniteLoopError(t) {
857
- const s = new C(
858
- `Infinite loop detected (${t}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${z}`
859
- );
1012
+ const s = new I(`Infinite loop detected (${t}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${Q}`);
860
1013
  throw this.dispose(), console.error(s), s;
861
1014
  }
862
- _handleExecutionError(t, s = c.EFFECT_EXECUTION_FAILED) {
863
- const e = S(t, C, s);
864
- if (console.error(e), this._onError)
865
- try {
866
- this._onError(e);
867
- } catch (i) {
868
- console.error(S(i, C, c.CALLBACK_ERROR_IN_ERROR_HANDLER));
869
- }
1015
+ _handleExecutionError(t, s = u.EFFECT_EXECUTION_FAILED) {
1016
+ const e = T(t, I, s);
1017
+ if (console.error(e), this._onError) try {
1018
+ this._onError(e);
1019
+ } catch (i) {
1020
+ console.error(T(i, I, u.CALLBACK_ERROR_IN_ERROR_HANDLER));
1021
+ }
870
1022
  }
1023
+ };
1024
+ function mt(t, s = {}) {
1025
+ if (typeof t != "function") throw new I(u.EFFECT_MUST_BE_FUNCTION);
1026
+ const e = new It(t, s);
1027
+ return e.execute(), e;
871
1028
  }
872
- function Ot(n, t = {}) {
873
- if (typeof n != "function")
874
- throw new C(c.EFFECT_MUST_BE_FUNCTION);
875
- const s = new kt(n, t);
876
- return s.execute(), s;
877
- }
878
- function yt(n) {
879
- if (typeof n != "function")
880
- throw new TypeError(c.BATCH_CALLBACK_MUST_BE_FUNCTION);
881
- T.startBatch();
1029
+ function Nt(t) {
1030
+ if (typeof t != "function") throw new TypeError(u.BATCH_CALLBACK_MUST_BE_FUNCTION);
1031
+ y.startBatch();
882
1032
  try {
883
- return n();
1033
+ return t();
884
1034
  } finally {
885
- T.endBatch();
1035
+ y.endBatch();
886
1036
  }
887
1037
  }
888
1038
  export {
889
- N as AsyncState,
890
- k as AtomError,
891
- I as ComputedError,
892
- ht as DEBUG_CONFIG,
893
- B as DEBUG_RUNTIME,
894
- C as EffectError,
895
- d as SCHEDULER_CONFIG,
896
- m as SchedulerError,
897
- bt as atom,
898
- yt as batch,
1039
+ R as AsyncState,
1040
+ A as AtomError,
1041
+ D as ComputedError,
1042
+ J as DEBUG_CONFIG,
1043
+ G as DEBUG_RUNTIME,
1044
+ I as EffectError,
1045
+ C as SCHEDULER_CONFIG,
1046
+ b as SchedulerError,
1047
+ vt as atom,
1048
+ Nt as batch,
899
1049
  At as computed,
900
- Ot as effect,
901
- Tt as isAtom,
902
- Nt as isComputed,
903
- Lt as isEffect,
904
- T as scheduler,
905
- Dt as untracked
1050
+ mt as effect,
1051
+ Dt as isAtom,
1052
+ gt as isComputed,
1053
+ Tt as isEffect,
1054
+ y as scheduler,
1055
+ St as untracked
906
1056
  };
907
- //# sourceMappingURL=index.mjs.map
1057
+
1058
+ //# sourceMappingURL=index.mjs.map