@but212/atom-effect-jquery 0.8.3 → 0.9.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,6 +1,6 @@
1
1
  import u from "jquery";
2
- import { default as Tt } from "jquery";
3
- const Ve = {
2
+ import { default as xt } from "jquery";
3
+ const Le = {
4
4
  /** One second in milliseconds */
5
5
  ONE_SECOND_MS: 1e3
6
6
  }, oe = {
@@ -28,7 +28,7 @@ const Ve = {
28
28
  // 100000 - Currently recomputing
29
29
  HAS_ERROR: 64
30
30
  // 1000000 - Has error state
31
- }, V = {
31
+ }, L = {
32
32
  /** Maximum effect executions per second to detect infinite loops (Legacy/Fallback) */
33
33
  MAX_EXECUTIONS_PER_SECOND: 1e3,
34
34
  /**
@@ -50,7 +50,7 @@ const Ve = {
50
50
  MAX_DEPENDENCIES: 1e3,
51
51
  /** Enable infinite loop detection warnings */
52
52
  WARN_INFINITE_LOOP: !0
53
- }, B = 1073741823, R = typeof process < "u" && process.env && process.env.NODE_ENV !== "production", je = Object.freeze([]);
53
+ }, B = 1073741823, T = typeof process < "u" && process.env && process.env.NODE_ENV !== "production", je = Object.freeze([]);
54
54
  class k extends Error {
55
55
  /**
56
56
  * Creates a new AtomError
@@ -58,8 +58,8 @@ class k extends Error {
58
58
  * @param cause - Original error that caused this error
59
59
  * @param recoverable - Whether the operation can be retried
60
60
  */
61
- constructor(e, s = null, n = !0) {
62
- super(e), this.name = "AtomError", this.cause = s, this.recoverable = n, this.timestamp = /* @__PURE__ */ new Date();
61
+ constructor(e, s = null, i = !0) {
62
+ super(e), this.name = "AtomError", this.cause = s, this.recoverable = i, this.timestamp = /* @__PURE__ */ new Date();
63
63
  }
64
64
  }
65
65
  class X extends k {
@@ -72,7 +72,7 @@ class X extends k {
72
72
  super(e, s, !0), this.name = "ComputedError";
73
73
  }
74
74
  }
75
- class M extends k {
75
+ class V extends k {
76
76
  /**
77
77
  * Creates a new EffectError
78
78
  * @param message - Error message
@@ -92,7 +92,7 @@ class ee extends k {
92
92
  super(e, s, !1), this.name = "SchedulerError";
93
93
  }
94
94
  }
95
- const m = {
95
+ const y = {
96
96
  // ─────────────────────────────────────────────────────────────────
97
97
  // Computed errors
98
98
  // ─────────────────────────────────────────────────────────────────
@@ -100,10 +100,6 @@ const m = {
100
100
  * Error thrown when computed() receives a non-function argument.
101
101
  */
102
102
  COMPUTED_MUST_BE_FUNCTION: "Computed function must be a function",
103
- /**
104
- * Error thrown when subscribe() receives an invalid listener.
105
- */
106
- COMPUTED_SUBSCRIBER_MUST_BE_FUNCTION: "Subscriber listener must be a function or Subscriber object",
107
103
  /**
108
104
  * Error thrown when accessing a pending async computed without a default value.
109
105
  */
@@ -116,10 +112,6 @@ const m = {
116
112
  * Error thrown when an asynchronous computed computation fails.
117
113
  */
118
114
  COMPUTED_ASYNC_COMPUTATION_FAILED: "Async computed computation failed",
119
- /**
120
- * Error thrown when subscribing to a dependency fails.
121
- */
122
- COMPUTED_DEPENDENCY_SUBSCRIPTION_FAILED: "Failed to subscribe to dependency",
123
115
  // ─────────────────────────────────────────────────────────────────
124
116
  // Atom errors
125
117
  // ─────────────────────────────────────────────────────────────────
@@ -127,10 +119,6 @@ const m = {
127
119
  * Error thrown when atom.subscribe() receives an invalid listener.
128
120
  */
129
121
  ATOM_SUBSCRIBER_MUST_BE_FUNCTION: "Subscription listener must be a function or Subscriber object",
130
- /**
131
- * Error thrown when the atom subscriber notification process fails.
132
- */
133
- ATOM_SUBSCRIBER_EXECUTION_FAILED: "Error occurred while executing atom subscribers",
134
122
  /**
135
123
  * Error logged when an individual subscriber throws during notification.
136
124
  * @remarks This error is caught and logged to prevent cascading failures.
@@ -151,26 +139,6 @@ const m = {
151
139
  * Error thrown when an effect's cleanup function fails.
152
140
  */
153
141
  EFFECT_CLEANUP_FAILED: "Effect cleanup function execution failed",
154
- // ─────────────────────────────────────────────────────────────────
155
- // Debug warnings
156
- // ─────────────────────────────────────────────────────────────────
157
- /**
158
- * Warning message for large dependency graphs.
159
- *
160
- * @param count - The number of dependencies detected
161
- * @returns Formatted warning message with dependency count
162
- *
163
- * @example
164
- * ```ts
165
- * console.warn(ERROR_MESSAGES.LARGE_DEPENDENCY_GRAPH(150));
166
- * // Output: "Large dependency graph detected: 150 dependencies"
167
- * ```
168
- */
169
- LARGE_DEPENDENCY_GRAPH: (t) => `Large dependency graph detected: ${t} dependencies`,
170
- /**
171
- * Warning logged when attempting to unsubscribe a non-existent listener.
172
- */
173
- UNSUBSCRIBE_NON_EXISTENT: "Attempted to unsubscribe a non-existent listener",
174
142
  /**
175
143
  * Error logged when the onError callback itself throws an error.
176
144
  * @remarks This prevents cascading failures from masking the original error.
@@ -186,9 +154,9 @@ function Ce(t, e, s) {
186
154
  if (t._visitedEpoch = s, t === e)
187
155
  throw new X("Indirect circular dependency detected");
188
156
  if (qe(t)) {
189
- const n = t.dependencies;
190
- for (let i = 0; i < n.length; i++) {
191
- const r = n[i];
157
+ const i = t.dependencies;
158
+ for (let n = 0; n < i.length; n++) {
159
+ const r = i[n];
192
160
  r && Ce(r, e, s);
193
161
  }
194
162
  }
@@ -214,8 +182,8 @@ const w = {
214
182
  attachDebugInfo(t, e, s) {
215
183
  if (!this.enabled)
216
184
  return;
217
- const n = t;
218
- n[he] = `${e}_${s}`, n[Be] = s, n[ae] = e;
185
+ const i = t;
186
+ i[he] = `${e}_${s}`, i[Be] = s, i[ae] = e;
219
187
  },
220
188
  getDebugName(t) {
221
189
  if (t != null && he in t)
@@ -248,7 +216,7 @@ class Ne extends ve {
248
216
  if (typeof e == "object" && e !== null && "execute" in e)
249
217
  return this._objectSubscribers.add(e);
250
218
  if (typeof e != "function")
251
- throw new k(m.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
219
+ throw new k(y.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
252
220
  return this._functionSubscribers.add(e);
253
221
  }
254
222
  /**
@@ -265,36 +233,36 @@ class Ne extends ve {
265
233
  */
266
234
  _notifySubscribers(e, s) {
267
235
  this._functionSubscribers.forEachSafe(
268
- (n) => n(e, s),
269
- (n) => console.error(new k(m.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, n))
236
+ (i) => i(e, s),
237
+ (i) => console.error(new k(y.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, i))
270
238
  ), this._objectSubscribers.forEachSafe(
271
- (n) => n.execute(),
272
- (n) => console.error(new k(m.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, n))
239
+ (i) => i.execute(),
240
+ (i) => console.error(new k(y.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, i))
273
241
  );
274
242
  }
275
243
  }
276
244
  let te = 0;
277
- function Te() {
278
- return te = (te + 1 | 0) & B, te;
245
+ function xe() {
246
+ return te = te + 1 & B || 1, te;
279
247
  }
280
248
  function Ge() {
281
249
  return te;
282
250
  }
283
- let ne = 0, fe = 0, ie = !1;
284
- function Se() {
285
- return ie ? (R && console.warn(
251
+ let ie = 0, fe = 0, ne = !1;
252
+ function ye() {
253
+ return ne ? (T && console.warn(
286
254
  "Warning: startFlush() called during flush - ignored to prevent infinite loop detection bypass"
287
- ), !1) : (ie = !0, ne = ne + 1 & B, fe = 0, !0);
255
+ ), !1) : (ne = !0, ie = ie + 1 & B, fe = 0, !0);
288
256
  }
289
- function ye() {
290
- ie = !1;
257
+ function Se() {
258
+ ne = !1;
291
259
  }
292
260
  function Qe() {
293
- return ie ? ++fe : 0;
261
+ return ne ? ++fe : 0;
294
262
  }
295
263
  class He {
296
264
  constructor() {
297
- this.queueA = [], this.queueB = [], this.queue = this.queueA, this.queueSize = 0, this._epoch = 0, this.isProcessing = !1, this.isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = V.MAX_FLUSH_ITERATIONS;
265
+ this.queueA = [], this.queueB = [], this.queue = this.queueA, this.queueSize = 0, this._epoch = 0, this.isProcessing = !1, this.isBatching = !1, this.batchDepth = 0, this.batchQueue = [], this.batchQueueSize = 0, this.isFlushingSync = !1, this.maxFlushIterations = L.MAX_FLUSH_ITERATIONS;
298
266
  }
299
267
  get phase() {
300
268
  return this.isProcessing || this.isFlushingSync ? 2 : this.isBatching ? 1 : 0;
@@ -315,17 +283,17 @@ class He {
315
283
  this.isProcessing = !0;
316
284
  const e = this.queue, s = this.queueSize;
317
285
  this.queue = this.queue === this.queueA ? this.queueB : this.queueA, this.queueSize = 0, this._epoch++, queueMicrotask(() => {
318
- const n = Se();
319
- this._processJobs(e, s), this.isProcessing = !1, n && ye(), this.queueSize > 0 && !this.isBatching && this.flush();
286
+ const i = ye();
287
+ this._processJobs(e, s), this.isProcessing = !1, i && Se(), this.queueSize > 0 && !this.isBatching && this.flush();
320
288
  });
321
289
  }
322
290
  flushSync() {
323
291
  this.isFlushingSync = !0;
324
- const e = Se();
292
+ const e = ye();
325
293
  try {
326
294
  this._mergeBatchQueue(), this._drainQueue();
327
295
  } finally {
328
- this.isFlushingSync = !1, e && ye();
296
+ this.isFlushingSync = !1, e && Se();
329
297
  }
330
298
  }
331
299
  _mergeBatchQueue() {
@@ -359,12 +327,12 @@ class He {
359
327
  ), this.queueSize = 0, this.queue.length = 0, this.batchQueueSize = 0;
360
328
  }
361
329
  _processJobs(e, s) {
362
- for (let n = 0; n < s; n++)
330
+ for (let i = 0; i < s; i++)
363
331
  try {
364
- e[n]?.();
365
- } catch (i) {
332
+ e[i]?.();
333
+ } catch (n) {
366
334
  console.error(
367
- new ee("Error occurred during scheduler execution", i)
335
+ new ee("Error occurred during scheduler execution", n)
368
336
  );
369
337
  }
370
338
  e.length = 0;
@@ -385,9 +353,9 @@ class He {
385
353
  * @param max - Maximum iterations count.
386
354
  */
387
355
  setMaxFlushIterations(e) {
388
- if (e < V.MIN_FLUSH_ITERATIONS)
356
+ if (e < L.MIN_FLUSH_ITERATIONS)
389
357
  throw new ee(
390
- `Max flush iterations must be at least ${V.MIN_FLUSH_ITERATIONS}`
358
+ `Max flush iterations must be at least ${L.MIN_FLUSH_ITERATIONS}`
391
359
  );
392
360
  this.maxFlushIterations = e;
393
361
  }
@@ -418,7 +386,7 @@ const q = {
418
386
  return this.current;
419
387
  }
420
388
  };
421
- function Re(t) {
389
+ function Te(t) {
422
390
  if (typeof t != "function")
423
391
  throw new k("Untracked callback must be a function");
424
392
  const e = q.current;
@@ -451,8 +419,8 @@ class re {
451
419
  const s = this.subscribers.indexOf(e);
452
420
  if (s === -1)
453
421
  return !1;
454
- const n = this.subscribers.length - 1;
455
- return s !== n && (this.subscribers[s] = this.subscribers[n]), this.subscribers.pop(), !0;
422
+ const i = this.subscribers.length - 1;
423
+ return s !== i && (this.subscribers[s] = this.subscribers[i]), this.subscribers.pop(), !0;
456
424
  }
457
425
  has(e) {
458
426
  return this.subscribers ? this.subscribers.indexOf(e) !== -1 : !1;
@@ -465,11 +433,11 @@ class re {
465
433
  /** Iterates with error handling to prevent one failure from breaking the chain */
466
434
  forEachSafe(e, s) {
467
435
  if (this.subscribers)
468
- for (let n = 0; n < this.subscribers.length; n++)
436
+ for (let i = 0; i < this.subscribers.length; i++)
469
437
  try {
470
- e(this.subscribers[n], n);
471
- } catch (i) {
472
- s ? s(i) : console.error("[SubscriberManager] Error in subscriber callback:", i);
438
+ e(this.subscribers[i], i);
439
+ } catch (n) {
440
+ s ? s(n) : console.error("[SubscriberManager] Error in subscriber callback:", n);
473
441
  }
474
442
  }
475
443
  get size() {
@@ -487,7 +455,7 @@ class re {
487
455
  }
488
456
  class de {
489
457
  constructor() {
490
- this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = R ? {
458
+ this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = T ? {
491
459
  acquired: 0,
492
460
  released: 0,
493
461
  rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
@@ -495,7 +463,7 @@ class de {
495
463
  }
496
464
  /** Acquires an array from the pool or creates a new one if the pool is empty. */
497
465
  acquire() {
498
- return R && this.stats && this.stats.acquired++, this.pool.pop() ?? [];
466
+ return T && this.stats && this.stats.acquired++, this.pool.pop() ?? [];
499
467
  }
500
468
  /**
501
469
  * Releases an array back to the pool.
@@ -506,38 +474,38 @@ class de {
506
474
  release(e, s) {
507
475
  if (!(s && e === s)) {
508
476
  if (Object.isFrozen(e)) {
509
- R && this.stats && this.stats.rejected.frozen++;
477
+ T && this.stats && this.stats.rejected.frozen++;
510
478
  return;
511
479
  }
512
480
  if (e.length > this.maxReusableCapacity) {
513
- R && this.stats && this.stats.rejected.tooLarge++;
481
+ T && this.stats && this.stats.rejected.tooLarge++;
514
482
  return;
515
483
  }
516
484
  if (this.pool.length >= this.maxPoolSize) {
517
- R && this.stats && this.stats.rejected.poolFull++;
485
+ T && this.stats && this.stats.rejected.poolFull++;
518
486
  return;
519
487
  }
520
- e.length = 0, this.pool.push(e), R && this.stats && this.stats.released++;
488
+ e.length = 0, this.pool.push(e), T && this.stats && this.stats.released++;
521
489
  }
522
490
  }
523
491
  /** Returns current stats for the pool (dev mode only). */
524
492
  getStats() {
525
- if (!R || !this.stats) return null;
526
- const { acquired: e, released: s, rejected: n } = this.stats, i = n.frozen + n.tooLarge + n.poolFull;
493
+ if (!T || !this.stats) return null;
494
+ const { acquired: e, released: s, rejected: i } = this.stats, n = i.frozen + i.tooLarge + i.poolFull;
527
495
  return {
528
496
  acquired: e,
529
497
  released: s,
530
- rejected: n,
531
- leaked: e - s - i,
498
+ rejected: i,
499
+ leaked: e - s - n,
532
500
  poolSize: this.pool.length
533
501
  };
534
502
  }
535
503
  /** Resets the pool and its stats. */
536
504
  reset() {
537
- this.pool.length = 0, R && this.stats && (this.stats.acquired = 0, this.stats.released = 0, this.stats.rejected = { frozen: 0, tooLarge: 0, poolFull: 0 });
505
+ this.pool.length = 0, T && this.stats && (this.stats.acquired = 0, this.stats.released = 0, this.stats.rejected = { frozen: 0, tooLarge: 0, poolFull: 0 });
538
506
  }
539
507
  }
540
- const y = Object.freeze([]), O = Object.freeze([]), D = Object.freeze([]), $ = new de(), j = new de(), A = new de();
508
+ const S = Object.freeze([]), O = Object.freeze([]), D = Object.freeze([]), M = new de(), j = new de(), A = new de();
541
509
  function le(t) {
542
510
  return t !== null && typeof t == "object" && "value" in t && "subscribe" in t && typeof t.subscribe == "function";
543
511
  }
@@ -549,7 +517,7 @@ function De(t) {
549
517
  }
550
518
  return le(t) && "invalidate" in t && typeof t.invalidate == "function";
551
519
  }
552
- function Ue(t) {
520
+ function Re(t) {
553
521
  return t != null && typeof t.then == "function";
554
522
  }
555
523
  function Je(t) {
@@ -564,7 +532,7 @@ function Ke(t) {
564
532
  function We(t) {
565
533
  return Je(t) && typeof t.execute == "function";
566
534
  }
567
- function xe(t, e, s, n) {
535
+ function Ue(t, e, s, i) {
568
536
  if (e) {
569
537
  if (Ye(e)) {
570
538
  e.addDependency(t);
@@ -574,27 +542,27 @@ function xe(t, e, s, n) {
574
542
  s.add(e);
575
543
  return;
576
544
  }
577
- We(e) && n.add(e);
545
+ We(e) && i.add(e);
578
546
  }
579
547
  }
580
- function Ze(t, e, s, n) {
581
- if (e !== y && s !== O)
548
+ function Ze(t, e, s, i) {
549
+ if (e !== S && s !== O)
582
550
  for (let r = 0; r < e.length; r++) {
583
551
  const o = e[r];
584
552
  o && (o._tempUnsub = s[r]);
585
553
  }
586
- const i = j.acquire();
587
- i.length = t.length;
554
+ const n = j.acquire();
555
+ n.length = t.length;
588
556
  for (let r = 0; r < t.length; r++) {
589
557
  const o = t[r];
590
- o && (o._tempUnsub ? (i[r] = o._tempUnsub, o._tempUnsub = void 0) : (w.checkCircular(o, n), i[r] = o.subscribe(n)));
558
+ o && (o._tempUnsub ? (n[r] = o._tempUnsub, o._tempUnsub = void 0) : (w.checkCircular(o, i), n[r] = o.subscribe(i)));
591
559
  }
592
- if (e !== y)
560
+ if (e !== S)
593
561
  for (let r = 0; r < e.length; r++) {
594
562
  const o = e[r];
595
563
  o?._tempUnsub && (o._tempUnsub(), o._tempUnsub = void 0);
596
564
  }
597
- return s !== O && j.release(s), i;
565
+ return s !== O && j.release(s), n;
598
566
  }
599
567
  class et extends Ne {
600
568
  constructor(e, s) {
@@ -625,7 +593,7 @@ class et extends Ne {
625
593
  this.version = this.version + 1 & B, this._value = e, !(!this._functionSubscribersStore.hasSubscribers && !this._objectSubscribersStore.hasSubscribers) && this._scheduleNotification(s);
626
594
  }
627
595
  _track(e) {
628
- xe(this, e, this._functionSubscribersStore, this._objectSubscribersStore);
596
+ Ue(this, e, this._functionSubscribersStore, this._objectSubscribersStore);
629
597
  }
630
598
  _scheduleNotification(e) {
631
599
  this._isNotificationScheduled || (this._pendingOldValue = e, this._isNotificationScheduled = !0), this._sync && !Y.isBatching ? this._flushNotifications() : Y.schedule(this._notifyTask);
@@ -651,15 +619,15 @@ class et extends Ne {
651
619
  function tt(t, e = {}) {
652
620
  return new et(t, e.sync ?? !1);
653
621
  }
654
- function G(t, e, s) {
622
+ function H(t, e, s) {
655
623
  if (t instanceof TypeError)
656
624
  return new e(`Type error (${s}): ${t.message}`, t);
657
625
  if (t instanceof ReferenceError)
658
626
  return new e(`Reference error (${s}): ${t.message}`, t);
659
627
  if (t instanceof k)
660
628
  return t;
661
- const n = t instanceof Error ? t.message : String(t), i = t instanceof Error ? t : null;
662
- return new e(`Unexpected error (${s}): ${n}`, i);
629
+ const i = t instanceof Error ? t.message : String(t), n = t instanceof Error ? t : null;
630
+ return new e(`Unexpected error (${s}): ${i}`, n);
663
631
  }
664
632
  const Oe = d.RESOLVED | d.PENDING | d.REJECTED, ce = Array(Oe + 1).fill(oe.IDLE);
665
633
  ce[d.RESOLVED] = oe.RESOLVED;
@@ -668,21 +636,21 @@ ce[d.REJECTED] = oe.REJECTED;
668
636
  class Ae extends Ne {
669
637
  constructor(e, s = {}) {
670
638
  if (typeof e != "function")
671
- throw new X(m.COMPUTED_MUST_BE_FUNCTION);
672
- if (super(), this._cachedErrors = null, this._errorCacheEpoch = -1, this._value = void 0, this.flags = d.DIRTY | d.IDLE, this._error = null, this._promiseId = 0, this._equal = s.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in s ? s.defaultValue : ge, this._hasDefaultValue = this._defaultValue !== ge, this._onError = s.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._functionSubscribersStore = new re(), this._objectSubscribersStore = new re(), this._dependencies = y, this._dependencyVersions = D, this._unsubscribes = O, this._notifyJob = () => {
639
+ throw new X(y.COMPUTED_MUST_BE_FUNCTION);
640
+ if (super(), this._cachedErrors = null, this._errorCacheEpoch = -1, this._value = void 0, this.flags = d.DIRTY | d.IDLE, this._error = null, this._promiseId = 0, this._equal = s.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in s ? s.defaultValue : ge, this._hasDefaultValue = this._defaultValue !== ge, this._onError = s.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._functionSubscribersStore = new re(), this._objectSubscribersStore = new re(), this._dependencies = S, this._dependencyVersions = D, this._unsubscribes = O, this._notifyJob = () => {
673
641
  this._functionSubscribersStore.forEachSafe(
674
- (n) => n(),
675
- (n) => console.error(n)
642
+ (i) => i(),
643
+ (i) => console.error(i)
676
644
  ), this._objectSubscribersStore.forEachSafe(
677
- (n) => n.execute(),
678
- (n) => console.error(n)
645
+ (i) => i.execute(),
646
+ (i) => console.error(i)
679
647
  );
680
648
  }, this._trackable = Object.assign(() => this._markDirty(), {
681
- addDependency: (n) => {
649
+ addDependency: (i) => {
682
650
  }
683
651
  }), w.attachDebugInfo(this, "computed", this.id), w.enabled) {
684
- const n = this;
685
- n.subscriberCount = () => this._functionSubscribersStore.size + this._objectSubscribersStore.size, n.isDirty = () => this._isDirty(), n.dependencies = this._dependencies, n.stateFlags = this._getFlagsAsString();
652
+ const i = this;
653
+ i.subscriberCount = () => this._functionSubscribersStore.size + this._objectSubscribersStore.size, i.isDirty = () => this._isDirty(), i.dependencies = this._dependencies, i.stateFlags = this._getFlagsAsString();
686
654
  }
687
655
  if (s.lazy === !1)
688
656
  try {
@@ -726,10 +694,10 @@ class Ae extends Ne {
726
694
  return this._cachedErrors;
727
695
  const s = /* @__PURE__ */ new Set();
728
696
  this._error && s.add(this._error);
729
- for (let n = 0; n < this._dependencies.length; n++) {
730
- const i = this._dependencies[n];
731
- if (i && "errors" in i) {
732
- const r = i.errors;
697
+ for (let i = 0; i < this._dependencies.length; i++) {
698
+ const n = this._dependencies[i];
699
+ if (n && "errors" in n) {
700
+ const r = n.errors;
733
701
  for (let o = 0; o < r.length; o++) {
734
702
  const c = r[o];
735
703
  c && s.add(c);
@@ -758,7 +726,7 @@ class Ae extends Ne {
758
726
  }
759
727
  j.release(this._unsubscribes), this._unsubscribes = O;
760
728
  }
761
- this._dependencies !== y && ($.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== D && (A.release(this._dependencyVersions), this._dependencyVersions = D), this._functionSubscribersStore.clear(), this._objectSubscribersStore.clear(), this.flags = d.DIRTY | d.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID, this._cachedErrors = null, this._errorCacheEpoch = -1;
729
+ this._dependencies !== S && (M.release(this._dependencies), this._dependencies = S), this._dependencyVersions !== D && (A.release(this._dependencyVersions), this._dependencyVersions = D), this._functionSubscribersStore.clear(), this._objectSubscribersStore.clear(), this.flags = d.DIRTY | d.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID, this._cachedErrors = null, this._errorCacheEpoch = -1;
762
730
  }
763
731
  // State flag operations
764
732
  _isDirty() {
@@ -817,32 +785,32 @@ class Ae extends Ne {
817
785
  const e = this._prepareComputationContext();
818
786
  let s = !1;
819
787
  try {
820
- const n = q.run(this._trackable, this._fn);
821
- this._commitDependencies(e), s = !0, Ue(n) ? this._handleAsyncComputation(n) : this._handleSyncResult(n);
822
- } catch (n) {
788
+ const i = q.run(this._trackable, this._fn);
789
+ this._commitDependencies(e), s = !0, Re(i) ? this._handleAsyncComputation(i) : this._handleSyncResult(i);
790
+ } catch (i) {
823
791
  if (!s)
824
792
  try {
825
793
  this._commitDependencies(e), s = !0;
826
- } catch (i) {
827
- this._handleComputationError(i);
794
+ } catch (n) {
795
+ this._handleComputationError(n);
828
796
  }
829
- this._handleComputationError(n);
797
+ this._handleComputationError(i);
830
798
  } finally {
831
799
  this._cleanupContext(e, s), this._setRecomputing(!1);
832
800
  }
833
801
  }
834
802
  _prepareComputationContext() {
835
- const e = this._dependencies, s = this._dependencyVersions, n = $.acquire(), i = A.acquire(), r = Te(), o = { depCount: 0 }, c = (_) => {
836
- _._lastSeenEpoch !== r && (_._lastSeenEpoch = r, o.depCount < n.length ? (n[o.depCount] = _, i[o.depCount] = _.version) : (n.push(_), i.push(_.version)), o.depCount++);
803
+ const e = this._dependencies, s = this._dependencyVersions, i = M.acquire(), n = A.acquire(), r = xe(), o = { depCount: 0 }, c = (_) => {
804
+ _._lastSeenEpoch !== r && (_._lastSeenEpoch = r, o.depCount < i.length ? (i[o.depCount] = _, n[o.depCount] = _.version) : (i.push(_), n.push(_.version)), o.depCount++);
837
805
  }, f = this._trackable.addDependency;
838
- return this._trackable.addDependency = c, { prevDeps: e, prevVersions: s, nextDeps: n, nextVersions: i, originalAdd: f, state: o };
806
+ return this._trackable.addDependency = c, { prevDeps: e, prevVersions: s, nextDeps: i, nextVersions: n, originalAdd: f, state: o };
839
807
  }
840
808
  _commitDependencies(e) {
841
- const { nextDeps: s, nextVersions: n, state: i, prevDeps: r } = e;
842
- s.length = i.depCount, n.length = i.depCount, this._unsubscribes = Ze(s, r, this._unsubscribes, this), this._dependencies = s, this._dependencyVersions = n;
809
+ const { nextDeps: s, nextVersions: i, state: n, prevDeps: r } = e;
810
+ s.length = n.depCount, i.length = n.depCount, this._unsubscribes = Ze(s, r, this._unsubscribes, this), this._dependencies = s, this._dependencyVersions = i;
843
811
  }
844
812
  _cleanupContext(e, s) {
845
- this._trackable.addDependency = e.originalAdd, s ? (e.prevDeps !== y && $.release(e.prevDeps), e.prevVersions !== D && A.release(e.prevVersions)) : ($.release(e.nextDeps), A.release(e.nextVersions));
813
+ this._trackable.addDependency = e.originalAdd, s ? (e.prevDeps !== S && M.release(e.prevDeps), e.prevVersions !== D && A.release(e.prevVersions)) : (M.release(e.nextDeps), A.release(e.nextVersions));
846
814
  }
847
815
  _handleSyncResult(e) {
848
816
  const s = !this._isResolved() || !this._equal(this._value, e);
@@ -851,10 +819,10 @@ class Ae extends Ne {
851
819
  _handleAsyncComputation(e) {
852
820
  this._setPending(), this._clearDirty(), this._notifyJob(), this._promiseId = this._promiseId >= this.MAX_PROMISE_ID ? 1 : this._promiseId + 1;
853
821
  const s = this._promiseId;
854
- e.then((n) => {
855
- s === this._promiseId && this._handleAsyncResolution(n);
856
- }).catch((n) => {
857
- s === this._promiseId && this._handleAsyncRejection(n);
822
+ e.then((i) => {
823
+ s === this._promiseId && this._handleAsyncResolution(i);
824
+ }).catch((i) => {
825
+ s === this._promiseId && this._handleAsyncRejection(i);
858
826
  });
859
827
  }
860
828
  _handleAsyncResolution(e) {
@@ -862,29 +830,29 @@ class Ae extends Ne {
862
830
  this.version = this.version + Number(s) & B, this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1), this._cachedErrors = null, this._errorCacheEpoch = -1, this._notifyJob();
863
831
  }
864
832
  _handleAsyncRejection(e) {
865
- const s = G(e, X, m.COMPUTED_ASYNC_COMPUTATION_FAILED), n = !this._isRejected();
866
- if (this.version = this.version + Number(n) & B, this._error = s, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
833
+ const s = H(e, X, y.COMPUTED_ASYNC_COMPUTATION_FAILED), i = !this._isRejected();
834
+ if (this.version = this.version + Number(i) & B, this._error = s, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
867
835
  try {
868
836
  this._onError(s);
869
- } catch (i) {
870
- console.error(m.CALLBACK_ERROR_IN_ERROR_HANDLER, i);
837
+ } catch (n) {
838
+ console.error(y.CALLBACK_ERROR_IN_ERROR_HANDLER, n);
871
839
  }
872
840
  this._notifyJob();
873
841
  }
874
842
  _handleComputationError(e) {
875
- const s = G(e, X, m.COMPUTED_COMPUTATION_FAILED);
843
+ const s = H(e, X, y.COMPUTED_COMPUTATION_FAILED);
876
844
  if (this._error = s, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
877
845
  try {
878
846
  this._onError(s);
879
- } catch (n) {
880
- console.error(m.CALLBACK_ERROR_IN_ERROR_HANDLER, n);
847
+ } catch (i) {
848
+ console.error(y.CALLBACK_ERROR_IN_ERROR_HANDLER, i);
881
849
  }
882
850
  throw s;
883
851
  }
884
852
  _handlePending() {
885
853
  if (this._hasDefaultValue)
886
854
  return this._defaultValue;
887
- throw new X(m.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
855
+ throw new X(y.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
888
856
  }
889
857
  _handleRejected() {
890
858
  if (this._error?.recoverable && this._hasDefaultValue)
@@ -899,7 +867,7 @@ class Ae extends Ne {
899
867
  this._isRecomputing() || this._isDirty() || (this._setDirty(), this._notifyJob());
900
868
  }
901
869
  _registerTracking() {
902
- xe(
870
+ Ue(
903
871
  this,
904
872
  q.getCurrent(),
905
873
  this._functionSubscribersStore,
@@ -911,7 +879,7 @@ Object.freeze(Ae.prototype);
911
879
  function st(t, e = {}) {
912
880
  return new Ae(t, e);
913
881
  }
914
- class nt extends ve {
882
+ class it extends ve {
915
883
  /**
916
884
  * Creates a new EffectImpl instance.
917
885
  * @param fn - The effect function to run.
@@ -920,56 +888,58 @@ class nt extends ve {
920
888
  constructor(e, s = {}) {
921
889
  super(), this.run = () => {
922
890
  if (this.isDisposed)
923
- throw new M(m.EFFECT_MUST_BE_FUNCTION);
891
+ throw new V(y.EFFECT_MUST_BE_FUNCTION);
924
892
  this._dependencyVersions !== D && (A.release(this._dependencyVersions), this._dependencyVersions = D), this.execute();
925
893
  }, this.dispose = () => {
926
894
  if (!this.isDisposed) {
927
895
  if (this._setDisposed(), this._safeCleanup(), this._unsubscribes !== O) {
928
896
  for (let n = 0; n < this._unsubscribes.length; n++) {
929
- const i = this._unsubscribes[n];
930
- i && i();
897
+ const r = this._unsubscribes[n];
898
+ r && r();
931
899
  }
932
900
  j.release(this._unsubscribes), this._unsubscribes = O;
933
901
  }
934
- this._dependencies !== y && ($.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== D && (A.release(this._dependencyVersions), this._dependencyVersions = D);
902
+ this._dependencies !== S && (M.release(this._dependencies), this._dependencies = S), this._dependencyVersions !== D && (A.release(this._dependencyVersions), this._dependencyVersions = D);
935
903
  }
936
904
  }, this.addDependency = (n) => {
937
905
  if (this.isExecuting && this._nextDeps && this._nextUnsubs && this._nextVersions) {
938
- const i = this._currentEpoch;
939
- if (n._lastSeenEpoch === i) return;
940
- n._lastSeenEpoch = i, this._nextDeps.push(n), this._nextVersions.push(n.version), n._tempUnsub ? (this._nextUnsubs.push(n._tempUnsub), n._tempUnsub = void 0) : this._subscribeTo(n);
906
+ const r = this._currentEpoch;
907
+ if (n._lastSeenEpoch === r) return;
908
+ n._lastSeenEpoch = r, this._nextDeps.push(n), this._nextVersions.push(n.version), n._tempUnsub ? (this._nextUnsubs.push(n._tempUnsub), n._tempUnsub = void 0) : this._subscribeTo(n);
941
909
  }
942
910
  }, this.execute = () => {
943
911
  if (this.isDisposed || this.isExecuting || !this._shouldExecute()) return;
944
912
  this._checkInfiniteLoop(), this._setExecuting(!0), this._safeCleanup();
945
913
  const n = this._prepareEffectContext();
946
- let i = !1;
914
+ let r = !1;
947
915
  try {
948
- const r = q.run(this, this._fn);
949
- this._commitEffect(n), i = !0, this._checkLoopWarnings(), Ue(r) ? r.then((o) => {
950
- !this.isDisposed && typeof o == "function" && (this._cleanup = o);
951
- }).catch((o) => {
952
- console.error(G(o, M, m.EFFECT_EXECUTION_FAILED));
953
- }) : this._cleanup = typeof r == "function" ? r : null;
954
- } catch (r) {
955
- i = !0, console.error(G(r, M, m.EFFECT_EXECUTION_FAILED)), this._cleanup = null;
916
+ const o = q.run(this, this._fn);
917
+ this._commitEffect(n), r = !0, this._checkLoopWarnings(), Re(o) ? o.then((c) => {
918
+ !this.isDisposed && typeof c == "function" && (this._cleanup = c);
919
+ }).catch((c) => {
920
+ this._handleExecutionError(c);
921
+ }) : this._cleanup = typeof o == "function" ? o : null;
922
+ } catch (o) {
923
+ r = !0, this._handleExecutionError(o), this._cleanup = null;
956
924
  } finally {
957
- this._cleanupEffect(n, i), this._setExecuting(!1);
925
+ this._cleanupEffect(n, r), this._setExecuting(!1);
958
926
  }
959
- }, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = s.sync ?? !1, this._maxExecutions = s.maxExecutionsPerSecond ?? V.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = s.maxExecutionsPerFlush ?? V.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = s.trackModifications ?? !1, this._cleanup = null, this._dependencies = y, this._dependencyVersions = D, this._unsubscribes = O, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._history = R ? [] : null, this._executionCount = 0, w.attachDebugInfo(this, "effect", this.id);
927
+ }, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = s.sync ?? !1, this._maxExecutions = s.maxExecutionsPerSecond ?? L.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = s.maxExecutionsPerFlush ?? L.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = s.trackModifications ?? !1, this._cleanup = null, this._dependencies = S, this._dependencyVersions = D, this._unsubscribes = O, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._onError = s.onError ?? null, this._historyPtr = 0;
928
+ const i = Number.isFinite(this._maxExecutions);
929
+ this._historyCapacity = i ? Math.min(this._maxExecutions + 1, L.MAX_EXECUTIONS_PER_SECOND + 1) : 0, this._history = T && i && this._historyCapacity > 0 ? new Array(this._historyCapacity).fill(0) : null, this._executionCount = 0, w.attachDebugInfo(this, "effect", this.id);
960
930
  }
961
931
  /**
962
932
  * Prepares the execution context by acquiring pools and setting up epoch.
963
933
  * @returns The prepared EffectContext.
964
934
  */
965
935
  _prepareEffectContext() {
966
- const e = this._dependencies, s = this._dependencyVersions, n = this._unsubscribes, i = $.acquire(), r = A.acquire(), o = j.acquire(), c = Te();
967
- if (e !== y && n !== O)
936
+ const e = this._dependencies, s = this._dependencyVersions, i = this._unsubscribes, n = M.acquire(), r = A.acquire(), o = j.acquire(), c = xe();
937
+ if (e !== S && i !== O)
968
938
  for (let f = 0; f < e.length; f++) {
969
939
  const _ = e[f];
970
- _ && (_._tempUnsub = n[f]);
940
+ _ && (_._tempUnsub = i[f]);
971
941
  }
972
- return this._nextDeps = i, this._nextVersions = r, this._nextUnsubs = o, this._currentEpoch = c, { prevDeps: e, prevVersions: s, prevUnsubs: n, nextDeps: i, nextVersions: r, nextUnsubs: o };
942
+ return this._nextDeps = n, this._nextVersions = r, this._nextUnsubs = o, this._currentEpoch = c, { prevDeps: e, prevVersions: s, prevUnsubs: i, nextDeps: n, nextVersions: r, nextUnsubs: o };
973
943
  }
974
944
  /**
975
945
  * Commits the tracked dependencies as the current active dependencies.
@@ -986,22 +956,22 @@ class nt extends ve {
986
956
  */
987
957
  _cleanupEffect(e, s) {
988
958
  if (this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, s) {
989
- if (e.prevDeps !== y) {
990
- for (let n = 0; n < e.prevDeps.length; n++) {
991
- const i = e.prevDeps[n];
992
- i?._tempUnsub && (i._tempUnsub(), i._tempUnsub = void 0);
959
+ if (e.prevDeps !== S) {
960
+ for (let i = 0; i < e.prevDeps.length; i++) {
961
+ const n = e.prevDeps[i];
962
+ n?._tempUnsub && (n._tempUnsub(), n._tempUnsub = void 0);
993
963
  }
994
- $.release(e.prevDeps);
964
+ M.release(e.prevDeps);
995
965
  }
996
966
  e.prevUnsubs !== O && j.release(e.prevUnsubs), e.prevVersions !== D && A.release(e.prevVersions);
997
967
  } else {
998
- $.release(e.nextDeps), A.release(e.nextVersions);
999
- for (let n = 0; n < e.nextUnsubs.length; n++)
1000
- e.nextUnsubs[n]?.();
1001
- if (j.release(e.nextUnsubs), e.prevDeps !== y)
1002
- for (let n = 0; n < e.prevDeps.length; n++) {
1003
- const i = e.prevDeps[n];
1004
- i && (i._tempUnsub = void 0);
968
+ M.release(e.nextDeps), A.release(e.nextVersions);
969
+ for (let i = 0; i < e.nextUnsubs.length; i++)
970
+ e.nextUnsubs[i]?.();
971
+ if (j.release(e.nextUnsubs), e.prevDeps !== S)
972
+ for (let i = 0; i < e.prevDeps.length; i++) {
973
+ const n = e.prevDeps[i];
974
+ n && (n._tempUnsub = void 0);
1005
975
  }
1006
976
  }
1007
977
  }
@@ -1016,7 +986,7 @@ class nt extends ve {
1016
986
  });
1017
987
  this._nextUnsubs && this._nextUnsubs.push(s);
1018
988
  } catch (s) {
1019
- console.error(G(s, M, m.EFFECT_EXECUTION_FAILED)), this._nextUnsubs && this._nextUnsubs.push(() => {
989
+ console.error(H(s, V, y.EFFECT_EXECUTION_FAILED)), this._nextUnsubs && this._nextUnsubs.push(() => {
1020
990
  });
1021
991
  }
1022
992
  }
@@ -1053,7 +1023,7 @@ class nt extends ve {
1053
1023
  try {
1054
1024
  this._cleanup();
1055
1025
  } catch (e) {
1056
- console.error(G(e, M, m.EFFECT_CLEANUP_FAILED));
1026
+ console.error(H(e, V, y.EFFECT_CLEANUP_FAILED));
1057
1027
  }
1058
1028
  this._cleanup = null;
1059
1029
  }
@@ -1063,28 +1033,21 @@ class nt extends ve {
1063
1033
  * @throws {EffectError} If an infinite loop is detected.
1064
1034
  */
1065
1035
  _checkInfiniteLoop() {
1066
- if (this._lastFlushEpoch !== ne && (this._lastFlushEpoch = ne, this._executionsInEpoch = 0), this._executionsInEpoch++, this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Qe() > V.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history) {
1067
- const e = Date.now();
1068
- this._history.push(e), this._history.length > V.MAX_EXECUTIONS_PER_SECOND + 10 && this._history.shift(), this._checkTimestampLoop(e);
1069
- }
1070
- }
1071
- _checkTimestampLoop(e) {
1072
- const s = this._history;
1073
- if (!s || this._maxExecutions <= 0) return;
1074
- const n = e - Ve.ONE_SECOND_MS;
1075
- let i = 0;
1076
- for (let r = s.length - 1; r >= 0 && !(s[r] < n); r--)
1077
- i++;
1078
- if (i > this._maxExecutions) {
1079
- const r = new M(
1080
- `Effect executed ${i} times within 1 second. Infinite loop suspected`
1081
- );
1082
- if (this.dispose(), console.error(r), R)
1083
- throw r;
1036
+ if (this._lastFlushEpoch !== ie && (this._lastFlushEpoch = ie, this._executionsInEpoch = 0), this._executionsInEpoch++, this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Qe() > L.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history && this._maxExecutions > 0) {
1037
+ const e = Date.now(), s = this._historyPtr, i = this._historyCapacity;
1038
+ this._history[s] = e;
1039
+ const n = (s + 1) % i, r = this._history[n] ?? 0;
1040
+ if (this._historyPtr = n, r > 0 && e - r < Le.ONE_SECOND_MS) {
1041
+ const o = new V(
1042
+ `Effect executed ${i} times within 1 second. Infinite loop suspected`
1043
+ );
1044
+ if (this.dispose(), console.error(o), this._onError && this._onError(o), T)
1045
+ throw o;
1046
+ }
1084
1047
  }
1085
1048
  }
1086
1049
  _throwInfiniteLoopError(e) {
1087
- const s = new M(
1050
+ const s = new V(
1088
1051
  `Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${fe}`
1089
1052
  );
1090
1053
  throw this.dispose(), console.error(s), s;
@@ -1094,14 +1057,14 @@ class nt extends ve {
1094
1057
  * @returns true if any dependency has changed or if it's the first run.
1095
1058
  */
1096
1059
  _shouldExecute() {
1097
- if (this._dependencies === y || this._dependencyVersions === D)
1060
+ if (this._dependencies === S || this._dependencyVersions === D)
1098
1061
  return !0;
1099
1062
  for (let e = 0; e < this._dependencies.length; e++) {
1100
1063
  const s = this._dependencies[e];
1101
1064
  if (s) {
1102
1065
  if ("value" in s)
1103
1066
  try {
1104
- Re(() => s.value);
1067
+ Te(() => s.value);
1105
1068
  } catch {
1106
1069
  return !0;
1107
1070
  }
@@ -1111,6 +1074,14 @@ class nt extends ve {
1111
1074
  }
1112
1075
  return !1;
1113
1076
  }
1077
+ /**
1078
+ * Handles errors occurring during effect execution.
1079
+ * Wraps the error, logs it to console, and calls onError callback if provided.
1080
+ */
1081
+ _handleExecutionError(e) {
1082
+ const s = H(e, V, y.EFFECT_EXECUTION_FAILED);
1083
+ console.error(s), this._onError && this._onError(s);
1084
+ }
1114
1085
  /**
1115
1086
  * Checks for potential infinite loops where an effect modifies its own dependencies.
1116
1087
  * Only active if trackModifications is enabled and debug is on.
@@ -1119,10 +1090,10 @@ class nt extends ve {
1119
1090
  if (this._trackModifications && w.enabled) {
1120
1091
  const e = this._dependencies;
1121
1092
  for (let s = 0; s < e.length; s++) {
1122
- const n = e[s];
1123
- n && n._modifiedAtEpoch === this._currentEpoch && w.warn(
1093
+ const i = e[s];
1094
+ i && i._modifiedAtEpoch === this._currentEpoch && w.warn(
1124
1095
  !0,
1125
- `Effect is reading a dependency (${w.getDebugName(n) || "unknown"}) that it just modified. Infinite loop may occur`
1096
+ `Effect is reading a dependency (${w.getDebugName(i) || "unknown"}) that it just modified. Infinite loop may occur`
1126
1097
  );
1127
1098
  }
1128
1099
  }
@@ -1130,8 +1101,8 @@ class nt extends ve {
1130
1101
  }
1131
1102
  function I(t, e = {}) {
1132
1103
  if (typeof t != "function")
1133
- throw new M(m.EFFECT_MUST_BE_FUNCTION);
1134
- const s = new nt(t, e);
1104
+ throw new V(y.EFFECT_MUST_BE_FUNCTION);
1105
+ const s = new it(t, e);
1135
1106
  return s.execute(), s;
1136
1107
  }
1137
1108
  function b(t) {
@@ -1150,7 +1121,7 @@ function ue(t) {
1150
1121
  }
1151
1122
  return e.tagName.toLowerCase();
1152
1123
  }
1153
- function it() {
1124
+ function nt() {
1154
1125
  if (typeof window < "u") {
1155
1126
  const t = window.__ATOM_DEBUG__;
1156
1127
  if (typeof t == "boolean")
@@ -1163,7 +1134,7 @@ function it() {
1163
1134
  }
1164
1135
  return !1;
1165
1136
  }
1166
- let P = it();
1137
+ let P = nt();
1167
1138
  const h = {
1168
1139
  get enabled() {
1169
1140
  return P;
@@ -1182,8 +1153,8 @@ const h = {
1182
1153
  */
1183
1154
  domUpdated(t, e, s) {
1184
1155
  if (!P) return;
1185
- const n = ue(t);
1186
- console.log(`[atom-effect-jquery] DOM updated: ${n}.${e} =`, s), rt(t);
1156
+ const i = ue(t);
1157
+ console.log(`[atom-effect-jquery] DOM updated: ${i}.${e} =`, s), rt(t);
1187
1158
  },
1188
1159
  cleanup(t) {
1189
1160
  P && console.log(`[atom-effect-jquery] Cleanup: ${t}`);
@@ -1195,8 +1166,8 @@ const h = {
1195
1166
  function rt(t) {
1196
1167
  const e = t[0];
1197
1168
  if (!e || !document.contains(e)) return;
1198
- const s = "atom_debug_timer", n = "atom_debug_cleanup_timer", i = "atom_debug_org_style";
1199
- clearTimeout(t.data(s)), clearTimeout(t.data(n)), t.data(i) || t.data(i, {
1169
+ const s = "atom_debug_timer", i = "atom_debug_cleanup_timer", n = "atom_debug_org_style";
1170
+ clearTimeout(t.data(s)), clearTimeout(t.data(i)), t.data(n) || t.data(n, {
1200
1171
  outline: t.css("outline"),
1201
1172
  outlineOffset: t.css("outline-offset"),
1202
1173
  transition: t.css("transition")
@@ -1207,16 +1178,16 @@ function rt(t) {
1207
1178
  // Remove transition for instant feedback on update
1208
1179
  });
1209
1180
  const r = setTimeout(() => {
1210
- const o = t.data(i);
1181
+ const o = t.data(n);
1211
1182
  t.css("transition", "outline 0.5s ease-out"), requestAnimationFrame(() => {
1212
1183
  t.css({
1213
1184
  outline: o?.outline || "",
1214
1185
  "outline-offset": o?.outlineOffset || ""
1215
1186
  });
1216
1187
  const c = setTimeout(() => {
1217
- t.css("transition", o?.transition || ""), t.removeData(s), t.removeData(n), t.removeData(i);
1188
+ t.css("transition", o?.transition || ""), t.removeData(s), t.removeData(i), t.removeData(n);
1218
1189
  }, 500);
1219
- t.data(n, c);
1190
+ t.data(i, c);
1220
1191
  });
1221
1192
  }, 100);
1222
1193
  t.data(s, r);
@@ -1242,7 +1213,7 @@ u.extend({
1242
1213
  computed: st,
1243
1214
  effect: I,
1244
1215
  batch: z,
1245
- untracked: Re,
1216
+ untracked: Te,
1246
1217
  isAtom: le,
1247
1218
  isComputed: De,
1248
1219
  isReactive: (t) => le(t) || De(t),
@@ -1253,8 +1224,8 @@ function ke() {
1253
1224
  }
1254
1225
  function Fe(t, e, s = {}) {
1255
1226
  const {
1256
- debounce: n,
1257
- event: i = "input",
1227
+ debounce: i,
1228
+ event: n = "input",
1258
1229
  parse: r = (p) => p,
1259
1230
  format: o = (p) => String(p ?? "")
1260
1231
  } = s, c = ke(), f = () => {
@@ -1265,28 +1236,28 @@ function Fe(t, e, s = {}) {
1265
1236
  t.on("compositionstart", f), t.on("compositionend", _);
1266
1237
  const C = () => {
1267
1238
  c.hasFocus = !0;
1268
- }, S = () => {
1239
+ }, m = () => {
1269
1240
  c.hasFocus = !1;
1270
1241
  const p = o(e.value);
1271
1242
  t.val() !== p && t.val(p);
1272
1243
  };
1273
- t.on("focus", C), t.on("blur", S);
1244
+ t.on("focus", C), t.on("blur", m);
1274
1245
  const F = () => {
1275
1246
  c.phase === "idle" && (c.phase = "syncing-to-atom", z(() => {
1276
1247
  e.value = r(t.val());
1277
1248
  }), c.phase = "idle");
1278
1249
  }, v = () => {
1279
- c.phase === "idle" && (n ? (c.timeoutId && clearTimeout(c.timeoutId), c.timeoutId = window.setTimeout(F, n)) : F());
1250
+ c.phase === "idle" && (i ? (c.timeoutId && clearTimeout(c.timeoutId), c.timeoutId = window.setTimeout(F, i)) : F());
1280
1251
  };
1281
- return t.on(i, v), t.on("change", v), { effect: () => {
1282
- const p = o(e.value), L = t.val();
1283
- if (L !== p) {
1284
- if (c.hasFocus && r(L) === e.value)
1252
+ return t.on(n, v), t.on("change", v), { effect: () => {
1253
+ const p = o(e.value), $ = t.val();
1254
+ if ($ !== p) {
1255
+ if (c.hasFocus && r($) === e.value)
1285
1256
  return;
1286
1257
  c.phase = "syncing-to-dom", t.val(p), h.domUpdated(t, "val", p), c.phase = "idle";
1287
1258
  }
1288
1259
  }, cleanup: () => {
1289
- t.off(i, v), t.off("change", v), t.off("compositionstart", f), t.off("compositionend", _), t.off("focus", C), t.off("blur", S), c.timeoutId && clearTimeout(c.timeoutId);
1260
+ t.off(n, v), t.off("change", v), t.off("compositionstart", f), t.off("compositionend", _), t.off("focus", C), t.off("blur", m), c.timeoutId && clearTimeout(c.timeoutId);
1290
1261
  } };
1291
1262
  }
1292
1263
  class ut {
@@ -1311,15 +1282,15 @@ class ut {
1311
1282
  * Registers an Effect to be disposed later.
1312
1283
  */
1313
1284
  trackEffect(e, s) {
1314
- const n = this.effects.get(e) || [];
1315
- n.push(s), this.effects.set(e, n), this.boundElements.add(e);
1285
+ const i = this.effects.get(e) || [];
1286
+ i.push(s), this.effects.set(e, i), this.boundElements.add(e);
1316
1287
  }
1317
1288
  /**
1318
1289
  * Registers a custom cleanup function (e.g., event listener removal).
1319
1290
  */
1320
1291
  trackCleanup(e, s) {
1321
- const n = this.cleanups.get(e) || [];
1322
- n.push(s), this.cleanups.set(e, n), this.boundElements.add(e);
1292
+ const i = this.cleanups.get(e) || [];
1293
+ i.push(s), this.cleanups.set(e, i), this.boundElements.add(e);
1323
1294
  }
1324
1295
  /**
1325
1296
  * Checks if an element has bindings (Fast check).
@@ -1336,17 +1307,17 @@ class ut {
1336
1307
  if (!this.boundElements.has(e)) return;
1337
1308
  h.cleanup(ue(e));
1338
1309
  const s = this.effects.get(e);
1339
- s && (this.effects.delete(e), s.forEach((i) => {
1310
+ s && (this.effects.delete(e), s.forEach((n) => {
1340
1311
  try {
1341
- i.dispose();
1312
+ n.dispose();
1342
1313
  } catch (r) {
1343
1314
  h.warn("Effect dispose error:", r);
1344
1315
  }
1345
1316
  }));
1346
- const n = this.cleanups.get(e);
1347
- n && (this.cleanups.delete(e), n.forEach((i) => {
1317
+ const i = this.cleanups.get(e);
1318
+ i && (this.cleanups.delete(e), i.forEach((n) => {
1348
1319
  try {
1349
- i();
1320
+ n();
1350
1321
  } catch (r) {
1351
1322
  h.warn("Cleanup error:", r);
1352
1323
  }
@@ -1357,8 +1328,8 @@ class ut {
1357
1328
  * - Essential for deep removal (empty(), remove(), etc.).
1358
1329
  */
1359
1330
  cleanupTree(e) {
1360
- e.querySelectorAll("*").forEach((n) => {
1361
- this.boundElements.has(n) && this.cleanup(n);
1331
+ e.querySelectorAll("*").forEach((i) => {
1332
+ this.boundElements.has(i) && this.cleanup(i);
1362
1333
  }), this.cleanup(e);
1363
1334
  }
1364
1335
  }
@@ -1367,8 +1338,8 @@ let J = null;
1367
1338
  function ht(t = document.body) {
1368
1339
  J || (J = new MutationObserver((e) => {
1369
1340
  for (const s of e)
1370
- s.removedNodes.forEach((n) => {
1371
- l.isKept(n) || n.isConnected || n.nodeType === 1 && l.cleanupTree(n);
1341
+ s.removedNodes.forEach((i) => {
1342
+ l.isKept(i) || i.isConnected || i.nodeType === 1 && l.cleanupTree(i);
1372
1343
  });
1373
1344
  }), J.observe(t, { childList: !0, subtree: !0 }));
1374
1345
  }
@@ -1379,14 +1350,14 @@ u.fn.atomText = function(t, e) {
1379
1350
  return this.each(function() {
1380
1351
  const s = u(this);
1381
1352
  if (b(t)) {
1382
- const n = I(() => {
1383
- const i = E(t), r = e ? e(i) : String(i ?? "");
1353
+ const i = I(() => {
1354
+ const n = E(t), r = e ? e(n) : String(n ?? "");
1384
1355
  s.text(r), h.domUpdated(s, "text", r);
1385
1356
  });
1386
- l.trackEffect(this, n);
1357
+ l.trackEffect(this, i);
1387
1358
  } else {
1388
- const n = e ? e(t) : String(t ?? "");
1389
- s.text(n);
1359
+ const i = e ? e(t) : String(t ?? "");
1360
+ s.text(i);
1390
1361
  }
1391
1362
  });
1392
1363
  };
@@ -1395,8 +1366,8 @@ u.fn.atomHtml = function(t) {
1395
1366
  const e = u(this);
1396
1367
  if (b(t)) {
1397
1368
  const s = I(() => {
1398
- const n = String(E(t) ?? "");
1399
- e.html(n), h.domUpdated(e, "html", n);
1369
+ const i = String(E(t) ?? "");
1370
+ e.html(i), h.domUpdated(e, "html", i);
1400
1371
  });
1401
1372
  l.trackEffect(this, s);
1402
1373
  } else
@@ -1407,49 +1378,49 @@ u.fn.atomClass = function(t, e) {
1407
1378
  return this.each(function() {
1408
1379
  const s = u(this);
1409
1380
  if (b(e)) {
1410
- const n = I(() => {
1411
- const i = !!E(e);
1412
- s.toggleClass(t, i), h.domUpdated(s, `class.${t}`, i);
1381
+ const i = I(() => {
1382
+ const n = !!E(e);
1383
+ s.toggleClass(t, n), h.domUpdated(s, `class.${t}`, n);
1413
1384
  });
1414
- l.trackEffect(this, n);
1385
+ l.trackEffect(this, i);
1415
1386
  } else
1416
1387
  s.toggleClass(t, !!e);
1417
1388
  });
1418
1389
  };
1419
1390
  u.fn.atomCss = function(t, e, s) {
1420
1391
  return this.each(function() {
1421
- const n = u(this);
1392
+ const i = u(this);
1422
1393
  if (b(e)) {
1423
- const i = I(() => {
1394
+ const n = I(() => {
1424
1395
  const r = E(e), o = s ? `${r}${s}` : r;
1425
- n.css(t, o), h.domUpdated(n, `css.${t}`, o);
1396
+ i.css(t, o), h.domUpdated(i, `css.${t}`, o);
1426
1397
  });
1427
- l.trackEffect(this, i);
1398
+ l.trackEffect(this, n);
1428
1399
  } else
1429
- n.css(t, s ? `${e}${s}` : e);
1400
+ i.css(t, s ? `${e}${s}` : e);
1430
1401
  });
1431
1402
  };
1432
1403
  u.fn.atomAttr = function(t, e) {
1433
1404
  return this.each(function() {
1434
- const s = u(this), n = (i) => {
1435
- i == null || i === !1 ? s.removeAttr(t) : i === !0 ? s.attr(t, t) : s.attr(t, String(i)), h.domUpdated(s, `attr.${t}`, i);
1405
+ const s = u(this), i = (n) => {
1406
+ n == null || n === !1 ? s.removeAttr(t) : n === !0 ? s.attr(t, t) : s.attr(t, String(n)), h.domUpdated(s, `attr.${t}`, n);
1436
1407
  };
1437
1408
  if (b(e)) {
1438
- const i = I(() => n(E(e)));
1439
- l.trackEffect(this, i);
1409
+ const n = I(() => i(E(e)));
1410
+ l.trackEffect(this, n);
1440
1411
  } else
1441
- n(e);
1412
+ i(e);
1442
1413
  });
1443
1414
  };
1444
1415
  u.fn.atomProp = function(t, e) {
1445
1416
  return this.each(function() {
1446
1417
  const s = u(this);
1447
1418
  if (b(e)) {
1448
- const n = I(() => {
1449
- const i = E(e);
1450
- s.prop(t, i), h.domUpdated(s, `prop.${t}`, i);
1419
+ const i = I(() => {
1420
+ const n = E(e);
1421
+ s.prop(t, n), h.domUpdated(s, `prop.${t}`, n);
1451
1422
  });
1452
- l.trackEffect(this, n);
1423
+ l.trackEffect(this, i);
1453
1424
  } else
1454
1425
  s.prop(t, e);
1455
1426
  });
@@ -1459,8 +1430,8 @@ u.fn.atomShow = function(t) {
1459
1430
  const e = u(this);
1460
1431
  if (b(t)) {
1461
1432
  const s = I(() => {
1462
- const n = !!E(t);
1463
- e.toggle(n), h.domUpdated(e, "show", n);
1433
+ const i = !!E(t);
1434
+ e.toggle(i), h.domUpdated(e, "show", i);
1464
1435
  });
1465
1436
  l.trackEffect(this, s);
1466
1437
  } else
@@ -1472,8 +1443,8 @@ u.fn.atomHide = function(t) {
1472
1443
  const e = u(this);
1473
1444
  if (b(t)) {
1474
1445
  const s = I(() => {
1475
- const n = !E(t);
1476
- e.toggle(n), h.domUpdated(e, "hide", !n);
1446
+ const i = !E(t);
1447
+ e.toggle(i), h.domUpdated(e, "hide", !i);
1477
1448
  });
1478
1449
  l.trackEffect(this, s);
1479
1450
  } else
@@ -1482,32 +1453,32 @@ u.fn.atomHide = function(t) {
1482
1453
  };
1483
1454
  u.fn.atomVal = function(t, e = {}) {
1484
1455
  return this.each(function() {
1485
- const { effect: s, cleanup: n } = Fe(u(this), t, e), i = I(s);
1486
- l.trackEffect(this, i), l.trackCleanup(this, n);
1456
+ const { effect: s, cleanup: i } = Fe(u(this), t, e), n = I(s);
1457
+ l.trackEffect(this, n), l.trackCleanup(this, i);
1487
1458
  });
1488
1459
  };
1489
1460
  u.fn.atomChecked = function(t) {
1490
1461
  return this.each(function() {
1491
1462
  const e = u(this);
1492
1463
  let s = !1;
1493
- const n = () => {
1464
+ const i = () => {
1494
1465
  s || z(() => {
1495
1466
  t.value = e.prop("checked");
1496
1467
  });
1497
1468
  };
1498
- e.on("change", n), l.trackCleanup(this, () => e.off("change", n));
1499
- const i = I(() => {
1469
+ e.on("change", i), l.trackCleanup(this, () => e.off("change", i));
1470
+ const n = I(() => {
1500
1471
  s = !0, e.prop("checked", t.value), h.domUpdated(e, "checked", t.value), s = !1;
1501
1472
  });
1502
- l.trackEffect(this, i);
1473
+ l.trackEffect(this, n);
1503
1474
  });
1504
1475
  };
1505
1476
  u.fn.atomOn = function(t, e) {
1506
1477
  return this.each(function() {
1507
- const s = u(this), n = function(i) {
1508
- z(() => e.call(this, i));
1478
+ const s = u(this), i = function(n) {
1479
+ z(() => e.call(this, n));
1509
1480
  };
1510
- s.on(t, n), l.trackCleanup(this, () => s.off(t, n));
1481
+ s.on(t, i), l.trackCleanup(this, () => s.off(t, i));
1511
1482
  });
1512
1483
  };
1513
1484
  u.fn.atomUnbind = function() {
@@ -1528,39 +1499,39 @@ function lt(t, e) {
1528
1499
  }) : t.$el.html(String(e ?? ""));
1529
1500
  }
1530
1501
  function ft(t, e) {
1531
- for (const [s, n] of Object.entries(e))
1532
- b(n) ? t.effects.push(() => {
1533
- const i = !!E(n);
1534
- t.$el.toggleClass(s, i), h.domUpdated(t.$el, `class.${s}`, i);
1535
- }) : t.$el.toggleClass(s, !!n);
1502
+ for (const [s, i] of Object.entries(e))
1503
+ b(i) ? t.effects.push(() => {
1504
+ const n = !!E(i);
1505
+ t.$el.toggleClass(s, n), h.domUpdated(t.$el, `class.${s}`, n);
1506
+ }) : t.$el.toggleClass(s, !!i);
1536
1507
  }
1537
1508
  function dt(t, e) {
1538
- for (const [s, n] of Object.entries(e))
1539
- if (Array.isArray(n)) {
1540
- const [i, r] = n;
1541
- b(i) ? t.effects.push(() => {
1542
- const o = `${E(i)}${r}`;
1509
+ for (const [s, i] of Object.entries(e))
1510
+ if (Array.isArray(i)) {
1511
+ const [n, r] = i;
1512
+ b(n) ? t.effects.push(() => {
1513
+ const o = `${E(n)}${r}`;
1543
1514
  t.$el.css(s, o), h.domUpdated(t.$el, `css.${s}`, o);
1544
- }) : t.$el.css(s, `${i}${r}`);
1545
- } else b(n) ? t.effects.push(() => {
1546
- const i = E(n);
1547
- t.$el.css(s, i), h.domUpdated(t.$el, `css.${s}`, i);
1548
- }) : t.$el.css(s, n);
1515
+ }) : t.$el.css(s, `${n}${r}`);
1516
+ } else b(i) ? t.effects.push(() => {
1517
+ const n = E(i);
1518
+ t.$el.css(s, n), h.domUpdated(t.$el, `css.${s}`, n);
1519
+ }) : t.$el.css(s, i);
1549
1520
  }
1550
1521
  function _t(t, e) {
1551
- for (const [s, n] of Object.entries(e)) {
1552
- const i = (r) => {
1522
+ for (const [s, i] of Object.entries(e)) {
1523
+ const n = (r) => {
1553
1524
  r == null || r === !1 ? t.$el.removeAttr(s) : r === !0 ? t.$el.attr(s, s) : t.$el.attr(s, String(r)), h.domUpdated(t.$el, `attr.${s}`, r);
1554
1525
  };
1555
- b(n) ? t.effects.push(() => i(E(n))) : i(n);
1526
+ b(i) ? t.effects.push(() => n(E(i))) : n(i);
1556
1527
  }
1557
1528
  }
1558
1529
  function pt(t, e) {
1559
- for (const [s, n] of Object.entries(e))
1560
- b(n) ? t.effects.push(() => {
1561
- const i = E(n);
1562
- t.$el.prop(s, i), h.domUpdated(t.$el, `prop.${s}`, i);
1563
- }) : t.$el.prop(s, n);
1530
+ for (const [s, i] of Object.entries(e))
1531
+ b(i) ? t.effects.push(() => {
1532
+ const n = E(i);
1533
+ t.$el.prop(s, n), h.domUpdated(t.$el, `prop.${s}`, n);
1534
+ }) : t.$el.prop(s, i);
1564
1535
  }
1565
1536
  function bt(t, e) {
1566
1537
  b(e) ? t.effects.push(() => {
@@ -1575,57 +1546,57 @@ function Et(t, e) {
1575
1546
  }) : t.$el.toggle(!e);
1576
1547
  }
1577
1548
  function gt(t, e) {
1578
- const s = Array.isArray(e) ? e[0] : e, n = Array.isArray(e) ? e[1] : {}, { effect: i, cleanup: r } = Fe(t.$el, s, n);
1579
- t.effects.push(i), t.trackCleanup(r);
1549
+ const s = Array.isArray(e) ? e[0] : e, i = Array.isArray(e) ? e[1] : {}, { effect: n, cleanup: r } = Fe(t.$el, s, i);
1550
+ t.effects.push(n), t.trackCleanup(r);
1580
1551
  }
1581
1552
  function mt(t, e) {
1582
- const s = ke(), n = () => {
1553
+ const s = ke(), i = () => {
1583
1554
  s.phase === "idle" && z(() => {
1584
1555
  e.value = t.$el.prop("checked");
1585
1556
  });
1586
1557
  };
1587
- t.$el.on("change", n), t.trackCleanup(() => t.$el.off("change", n)), t.effects.push(() => {
1558
+ t.$el.on("change", i), t.trackCleanup(() => t.$el.off("change", i)), t.effects.push(() => {
1588
1559
  s.phase = "syncing-to-dom", t.$el.prop("checked", e.value), h.domUpdated(t.$el, "checked", e.value), s.phase = "idle";
1589
1560
  });
1590
1561
  }
1591
- function St(t, e) {
1592
- for (const [s, n] of Object.entries(e)) {
1593
- const i = function(r) {
1594
- z(() => n.call(this, r));
1562
+ function yt(t, e) {
1563
+ for (const [s, i] of Object.entries(e)) {
1564
+ const n = function(r) {
1565
+ z(() => i.call(this, r));
1595
1566
  };
1596
- t.$el.on(s, i), t.trackCleanup(() => t.$el.off(s, i));
1567
+ t.$el.on(s, n), t.trackCleanup(() => t.$el.off(s, n));
1597
1568
  }
1598
1569
  }
1599
1570
  u.fn.atomBind = function(t) {
1600
1571
  return this.each(function() {
1601
- const e = u(this), s = [], n = {
1572
+ const e = u(this), s = [], i = {
1602
1573
  $el: e,
1603
1574
  el: this,
1604
1575
  effects: s,
1605
- trackCleanup: (i) => l.trackCleanup(this, i)
1576
+ trackCleanup: (n) => l.trackCleanup(this, n)
1606
1577
  };
1607
- t.text !== void 0 && at(n, t.text), t.html !== void 0 && lt(n, t.html), t.class && ft(n, t.class), t.css && dt(n, t.css), t.attr && _t(n, t.attr), t.prop && pt(n, t.prop), t.show !== void 0 && bt(n, t.show), t.hide !== void 0 && Et(n, t.hide), t.val !== void 0 && gt(n, t.val), t.checked !== void 0 && mt(n, t.checked), t.on && St(n, t.on), s.forEach((i) => {
1608
- const r = I(i);
1578
+ t.text !== void 0 && at(i, t.text), t.html !== void 0 && lt(i, t.html), t.class && ft(i, t.class), t.css && dt(i, t.css), t.attr && _t(i, t.attr), t.prop && pt(i, t.prop), t.show !== void 0 && bt(i, t.show), t.hide !== void 0 && Et(i, t.hide), t.val !== void 0 && gt(i, t.val), t.checked !== void 0 && mt(i, t.checked), t.on && yt(i, t.on), s.forEach((n) => {
1579
+ const r = I(n);
1609
1580
  l.trackEffect(this, r);
1610
1581
  });
1611
1582
  });
1612
1583
  };
1613
- function yt(t) {
1584
+ function St(t) {
1614
1585
  if (t.length === 0) return [];
1615
1586
  const e = t.slice(), s = [0];
1616
- let n, i, r, o;
1587
+ let i, n, r, o;
1617
1588
  const c = t.length;
1618
- for (n = 0; n < c; n++) {
1619
- const C = t[n];
1589
+ for (i = 0; i < c; i++) {
1590
+ const C = t[i];
1620
1591
  if (C !== -1) {
1621
- const S = s[s.length - 1];
1622
- if (t[S] < C) {
1623
- e[n] = S, s.push(n);
1592
+ const m = s[s.length - 1];
1593
+ if (t[m] < C) {
1594
+ e[i] = m, s.push(i);
1624
1595
  continue;
1625
1596
  }
1626
- for (i = 0, r = s.length - 1; i < r; )
1627
- o = (i + r) / 2 | 0, t[s[o]] < C ? i = o + 1 : r = o;
1628
- C < t[s[i]] && (i > 0 && (e[n] = s[i - 1]), s[i] = n);
1597
+ for (n = 0, r = s.length - 1; n < r; )
1598
+ o = (n + r) / 2 | 0, t[s[o]] < C ? n = o + 1 : r = o;
1599
+ C < t[s[n]] && (n > 0 && (e[i] = s[n - 1]), s[n] = i);
1629
1600
  }
1630
1601
  }
1631
1602
  let f = s.length, _ = s[f - 1];
@@ -1635,72 +1606,72 @@ function yt(t) {
1635
1606
  }
1636
1607
  u.fn.atomList = function(t, e) {
1637
1608
  return this.each(function() {
1638
- const s = u(this), n = ue(this), { key: i, render: r, bind: o, onAdd: c, onRemove: f, empty: _ } = e, C = typeof i == "function" ? i : (p) => p[i], S = /* @__PURE__ */ new Map();
1609
+ const s = u(this), i = ue(this), { key: n, render: r, bind: o, onAdd: c, onRemove: f, empty: _ } = e, C = typeof n == "function" ? n : (p) => p[n], m = /* @__PURE__ */ new Map();
1639
1610
  let F = [], v = null;
1640
1611
  const K = /* @__PURE__ */ new Set(), _e = I(() => {
1641
- const p = t.value, L = [], pe = /* @__PURE__ */ new Set();
1612
+ const p = t.value, $ = [], pe = /* @__PURE__ */ new Set();
1642
1613
  for (let a = 0; a < p.length; a++) {
1643
- const g = p[a], T = C(g, a);
1644
- L.push(T), pe.add(T);
1614
+ const g = p[a], x = C(g, a);
1615
+ $.push(x), pe.add(x);
1645
1616
  }
1646
- if (h.log("list", `${n} updating with ${p.length} items`), p.length === 0 && _) {
1617
+ if (h.log("list", `${i} updating with ${p.length} items`), p.length === 0 && _) {
1647
1618
  v || (v = u(_), s.append(v));
1648
- for (const [, a] of S) {
1619
+ for (const [, a] of m) {
1649
1620
  a.$el.remove();
1650
1621
  const g = a.$el[0];
1651
1622
  g && l.cleanup(g);
1652
1623
  }
1653
- S.clear(), F = [];
1624
+ m.clear(), F = [];
1654
1625
  return;
1655
1626
  } else v && (v.remove(), v = null);
1656
- for (const [a, g] of S)
1627
+ for (const [a, g] of m)
1657
1628
  if (!pe.has(a)) {
1658
1629
  if (K.has(a)) continue;
1659
- const T = () => {
1630
+ const x = () => {
1660
1631
  g.$el.remove();
1661
1632
  const W = g.$el[0];
1662
- W && l.cleanup(W), K.delete(a), h.log("list", `${n} removed item:`, a);
1633
+ W && l.cleanup(W), K.delete(a), h.log("list", `${i} removed item:`, a);
1663
1634
  };
1664
- S.delete(a), K.add(a), f ? Promise.resolve(f(g.$el)).then(T) : T();
1635
+ m.delete(a), K.add(a), f ? Promise.resolve(f(g.$el)).then(x) : x();
1665
1636
  }
1666
1637
  const be = /* @__PURE__ */ new Map();
1667
1638
  F.forEach((a, g) => be.set(a, g));
1668
- const $e = L.map((a) => be.get(a) ?? -1), Le = yt($e), Pe = new Set(Le);
1669
- let U = null;
1639
+ const $e = $.map((a) => be.get(a) ?? -1), Pe = St($e), Ve = new Set(Pe);
1640
+ let R = null;
1670
1641
  for (let a = p.length - 1; a >= 0; a--) {
1671
- const g = L[a], T = p[a], W = Pe.has(a);
1672
- if (S.has(g)) {
1673
- const N = S.get(g);
1642
+ const g = $[a], x = p[a], W = Ve.has(a);
1643
+ if (m.has(g)) {
1644
+ const N = m.get(g);
1674
1645
  if (!N) continue;
1675
- N.item = T;
1676
- const x = N.$el[0];
1677
- if (!x) continue;
1678
- if (e.update && e.update(N.$el, T, a), !W)
1679
- U ? N.$el.insertBefore(U) : N.$el.appendTo(s);
1646
+ N.item = x;
1647
+ const U = N.$el[0];
1648
+ if (!U) continue;
1649
+ if (e.update && e.update(N.$el, x, a), !W)
1650
+ R ? N.$el.insertBefore(R) : N.$el.appendTo(s);
1680
1651
  else {
1681
- const Q = x.nextSibling;
1682
- U && Q !== U ? N.$el.insertBefore(U) : !U && Q && N.$el.appendTo(s);
1652
+ const G = U.nextSibling;
1653
+ R && G !== R ? N.$el.insertBefore(R) : !R && G && N.$el.appendTo(s);
1683
1654
  }
1684
- U = x;
1655
+ R = U;
1685
1656
  } else {
1686
- const N = r(T, a), x = N instanceof Element ? u(N) : u(N);
1687
- S.set(g, { $el: x, item: T }), U ? x.insertBefore(U) : x.appendTo(s), o && o(x, T, a), c && c(x), h.log("list", `${n} added item:`, g);
1688
- const Q = x[0];
1689
- Q && (U = Q);
1657
+ const N = r(x, a), U = N instanceof Element ? u(N) : u(N);
1658
+ m.set(g, { $el: U, item: x }), R ? U.insertBefore(R) : U.appendTo(s), o && o(U, x, a), c && c(U), h.log("list", `${i} added item:`, g);
1659
+ const G = U[0];
1660
+ G && (R = G);
1690
1661
  }
1691
1662
  }
1692
- F = L;
1663
+ F = $;
1693
1664
  });
1694
1665
  l.trackEffect(this, _e), l.trackCleanup(this, () => {
1695
- S.clear(), F = [], v?.remove();
1666
+ m.clear(), F = [], v?.remove();
1696
1667
  });
1697
1668
  });
1698
1669
  };
1699
1670
  const se = /* @__PURE__ */ new WeakMap();
1700
1671
  u.fn.atomMount = function(t, e = {}) {
1701
1672
  return this.each(function() {
1702
- const s = u(this), n = ue(this), i = se.get(this);
1703
- i && (h.log("mount", `${n} unmounting existing component`), i()), h.log("mount", `${n} mounting component`);
1673
+ const s = u(this), i = ue(this), n = se.get(this);
1674
+ n && (h.log("mount", `${i} unmounting existing component`), n()), h.log("mount", `${i} mounting component`);
1704
1675
  let r;
1705
1676
  try {
1706
1677
  r = t(s, e);
@@ -1711,7 +1682,7 @@ u.fn.atomMount = function(t, e = {}) {
1711
1682
  let o = !1;
1712
1683
  const c = () => {
1713
1684
  if (!o) {
1714
- if (o = !0, h.log("mount", `${n} full cleanup`), typeof r == "function")
1685
+ if (o = !0, h.log("mount", `${i} full cleanup`), typeof r == "function")
1715
1686
  try {
1716
1687
  r();
1717
1688
  } catch {
@@ -1727,12 +1698,12 @@ u.fn.atomUnmount = function() {
1727
1698
  se.get(this)?.();
1728
1699
  });
1729
1700
  };
1730
- const H = /* @__PURE__ */ new WeakMap();
1701
+ const Q = /* @__PURE__ */ new WeakMap();
1731
1702
  let Ie = !1;
1732
1703
  function Me() {
1733
1704
  if (Ie) return;
1734
1705
  Ie = !0;
1735
- const t = u.fn.on, e = u.fn.off, s = u.fn.remove, n = u.fn.empty, i = u.fn.detach;
1706
+ const t = u.fn.on, e = u.fn.off, s = u.fn.remove, i = u.fn.empty, n = u.fn.detach;
1736
1707
  u.fn.remove = function(r) {
1737
1708
  return (r ? this.filter(r) : this).each(function() {
1738
1709
  l.cleanupTree(this);
@@ -1740,11 +1711,11 @@ function Me() {
1740
1711
  }, u.fn.empty = function() {
1741
1712
  return this.each(function() {
1742
1713
  this.querySelectorAll("*").forEach((o) => l.cleanup(o));
1743
- }), n.call(this);
1714
+ }), i.call(this);
1744
1715
  }, u.fn.detach = function(r) {
1745
1716
  return (r ? this.filter(r) : this).each(function() {
1746
1717
  l.keep(this);
1747
- }), i.call(this, r);
1718
+ }), n.call(this, r);
1748
1719
  }, u.fn.on = function(...r) {
1749
1720
  let o = -1;
1750
1721
  for (let c = r.length - 1; c >= 0; c--)
@@ -1755,12 +1726,12 @@ function Me() {
1755
1726
  if (o !== -1) {
1756
1727
  const c = r[o];
1757
1728
  let f;
1758
- H.has(c) ? f = H.get(c) : (f = function(..._) {
1729
+ Q.has(c) ? f = Q.get(c) : (f = function(..._) {
1759
1730
  let C;
1760
1731
  return z(() => {
1761
1732
  C = c.apply(this, _);
1762
1733
  }), C;
1763
- }, H.set(c, f)), r[o] = f;
1734
+ }, Q.set(c, f)), r[o] = f;
1764
1735
  }
1765
1736
  return t.apply(this, r);
1766
1737
  }, u.fn.off = function(...r) {
@@ -1772,7 +1743,7 @@ function Me() {
1772
1743
  }
1773
1744
  if (o !== -1) {
1774
1745
  const c = r[o];
1775
- H.has(c) && (r[o] = H.get(c));
1746
+ Q.has(c) && (r[o] = Q.get(c));
1776
1747
  }
1777
1748
  return e.apply(this, r);
1778
1749
  };
@@ -1786,13 +1757,13 @@ export {
1786
1757
  tt as atom,
1787
1758
  z as batch,
1788
1759
  st as computed,
1789
- Tt as default,
1760
+ xt as default,
1790
1761
  It as disableAutoCleanup,
1791
1762
  I as effect,
1792
1763
  ht as enableAutoCleanup,
1793
1764
  Ct as enablejQueryBatching,
1794
1765
  Me as enablejQueryOverrides,
1795
1766
  l as registry,
1796
- Re as untracked
1767
+ Te as untracked
1797
1768
  };
1798
1769
  //# sourceMappingURL=index.mjs.map