atom-effect-jquery 0.2.0 → 0.3.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,19 +1,19 @@
1
1
  import c from "jquery";
2
- import { default as st } from "jquery";
3
- const Te = {
2
+ import { default as ht } from "jquery";
3
+ const Le = {
4
4
  /** One second in milliseconds */
5
5
  ONE_SECOND_MS: 1e3
6
- }, J = {
6
+ }, W = {
7
7
  IDLE: "idle",
8
8
  PENDING: "pending",
9
9
  RESOLVED: "resolved",
10
10
  REJECTED: "rejected"
11
- }, K = {
11
+ }, J = {
12
12
  DISPOSED: 1,
13
13
  // 0001 - Effect has been disposed
14
14
  EXECUTING: 2
15
15
  // 0010 - Effect is currently executing
16
- }, _ = {
16
+ }, p = {
17
17
  DIRTY: 1,
18
18
  // 0001 - Needs recomputation
19
19
  IDLE: 2,
@@ -28,7 +28,7 @@ const Te = {
28
28
  // 100000 - Currently recomputing
29
29
  HAS_ERROR: 64
30
30
  // 1000000 - Has error state
31
- }, P = {
31
+ }, $ = {
32
32
  /** Maximum effect executions per second to detect infinite loops (Legacy/Fallback) */
33
33
  MAX_EXECUTIONS_PER_SECOND: 1e3,
34
34
  /**
@@ -45,13 +45,13 @@ const Te = {
45
45
  MAX_FLUSH_ITERATIONS: 1e3,
46
46
  /** Minimum allowed value for max flush iterations */
47
47
  MIN_FLUSH_ITERATIONS: 10
48
- }, le = {
48
+ }, _e = {
49
49
  /** Maximum dependencies before warning about large dependency graphs */
50
50
  MAX_DEPENDENCIES: 1e3,
51
51
  /** Enable infinite loop detection warnings */
52
52
  WARN_INFINITE_LOOP: !0
53
- }, z = 1073741823, C = typeof process < "u" && process.env && process.env.NODE_ENV !== "production";
54
- class w extends Error {
53
+ }, Q = 1073741823, v = typeof process < "u" && process.env && process.env.NODE_ENV !== "production";
54
+ class F extends Error {
55
55
  /**
56
56
  * Creates a new AtomError
57
57
  * @param message - Error message describing what went wrong
@@ -62,7 +62,7 @@ class w extends Error {
62
62
  super(e), this.name = "AtomError", this.cause = n, this.recoverable = s, this.timestamp = /* @__PURE__ */ new Date();
63
63
  }
64
64
  }
65
- class B extends w {
65
+ class X extends F {
66
66
  /**
67
67
  * Creates a new ComputedError
68
68
  * @param message - Error message
@@ -72,7 +72,7 @@ class B extends w {
72
72
  super(e, n, !0), this.name = "ComputedError";
73
73
  }
74
74
  }
75
- class F extends w {
75
+ class L extends F {
76
76
  /**
77
77
  * Creates a new EffectError
78
78
  * @param message - Error message
@@ -82,7 +82,7 @@ class F extends w {
82
82
  super(e, n, !1), this.name = "EffectError";
83
83
  }
84
84
  }
85
- class Z extends w {
85
+ class Z extends F {
86
86
  /**
87
87
  * Creates a new SchedulerError
88
88
  * @param message - Error message
@@ -92,7 +92,7 @@ class Z extends w {
92
92
  super(e, n, !1), this.name = "SchedulerError";
93
93
  }
94
94
  }
95
- const b = {
95
+ const E = {
96
96
  // ─────────────────────────────────────────────────────────────────
97
97
  // Computed errors
98
98
  // ─────────────────────────────────────────────────────────────────
@@ -176,28 +176,28 @@ const b = {
176
176
  * @remarks This prevents cascading failures from masking the original error.
177
177
  */
178
178
  CALLBACK_ERROR_IN_ERROR_HANDLER: "Error occurred during onError callback execution"
179
- }, ie = /* @__PURE__ */ Symbol("debugName"), Ae = /* @__PURE__ */ Symbol("id"), re = /* @__PURE__ */ Symbol("type"), fe = /* @__PURE__ */ Symbol("noDefaultValue");
180
- function Oe(t) {
179
+ }, re = /* @__PURE__ */ Symbol("debugName"), Pe = /* @__PURE__ */ Symbol("id"), oe = /* @__PURE__ */ Symbol("type"), pe = /* @__PURE__ */ Symbol("noDefaultValue");
180
+ function je(t) {
181
181
  return "dependencies" in t && Array.isArray(t.dependencies);
182
182
  }
183
- let de = 0;
184
- function me(t, e, n) {
183
+ let be = 0;
184
+ function ye(t, e, n) {
185
185
  if (t._visitedEpoch !== n) {
186
186
  if (t._visitedEpoch = n, t === e)
187
- throw new B("Indirect circular dependency detected");
188
- if (Oe(t)) {
187
+ throw new X("Indirect circular dependency detected");
188
+ if (je(t)) {
189
189
  const s = t.dependencies;
190
190
  for (let i = 0; i < s.length; i++) {
191
191
  const r = s[i];
192
- r && me(r, e, n);
192
+ r && ye(r, e, n);
193
193
  }
194
194
  }
195
195
  }
196
196
  }
197
- const U = {
197
+ const O = {
198
198
  enabled: typeof process < "u" && process.env?.NODE_ENV === "development",
199
- maxDependencies: le.MAX_DEPENDENCIES,
200
- warnInfiniteLoop: le.WARN_INFINITE_LOOP,
199
+ maxDependencies: _e.MAX_DEPENDENCIES,
200
+ warnInfiniteLoop: _e.WARN_INFINITE_LOOP,
201
201
  warn(t, e) {
202
202
  this.enabled && t && console.warn(`[Atom Effect] ${e}`);
203
203
  },
@@ -208,32 +208,32 @@ const U = {
208
208
  */
209
209
  checkCircular(t, e) {
210
210
  if (t === e)
211
- throw new B("Direct circular dependency detected");
212
- this.enabled && (de++, me(t, e, de));
211
+ throw new X("Direct circular dependency detected");
212
+ this.enabled && (be++, ye(t, e, be));
213
213
  },
214
214
  attachDebugInfo(t, e, n) {
215
215
  if (!this.enabled)
216
216
  return;
217
217
  const s = t;
218
- s[ie] = `${e}_${n}`, s[Ae] = n, s[re] = e;
218
+ s[re] = `${e}_${n}`, s[Pe] = n, s[oe] = e;
219
219
  },
220
220
  getDebugName(t) {
221
- if (t != null && ie in t)
222
- return t[ie];
223
- },
224
- getDebugType(t) {
225
221
  if (t != null && re in t)
226
222
  return t[re];
223
+ },
224
+ getDebugType(t) {
225
+ if (t != null && oe in t)
226
+ return t[oe];
227
227
  }
228
228
  };
229
- let we = 1;
230
- const Fe = () => we++;
231
- class ge {
229
+ let Ve = 1;
230
+ const $e = () => Ve++;
231
+ class De {
232
232
  constructor() {
233
- this.id = Fe() & z, this.flags = 0;
233
+ this.id = $e() & Q, this.flags = 0;
234
234
  }
235
235
  }
236
- class Se extends ge {
236
+ class Ie extends De {
237
237
  constructor() {
238
238
  super(), this.version = 0, this._lastSeenEpoch = -1;
239
239
  }
@@ -248,7 +248,7 @@ class Se extends ge {
248
248
  if (typeof e == "object" && e !== null && "execute" in e)
249
249
  return this._objectSubscribers.add(e);
250
250
  if (typeof e != "function")
251
- throw new w(b.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
251
+ throw new F(E.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
252
252
  return this._functionSubscribers.add(e);
253
253
  }
254
254
  /**
@@ -266,32 +266,32 @@ class Se extends ge {
266
266
  _notifySubscribers(e, n) {
267
267
  this._functionSubscribers.forEachSafe(
268
268
  (s) => s(e, n),
269
- (s) => console.error(new w(b.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, s))
269
+ (s) => console.error(new F(E.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, s))
270
270
  ), this._objectSubscribers.forEachSafe(
271
271
  (s) => s.execute(),
272
- (s) => console.error(new w(b.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, s))
272
+ (s) => console.error(new F(E.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED, s))
273
273
  );
274
274
  }
275
275
  }
276
- let oe = 0;
277
- function ye() {
278
- return oe = (oe + 1 | 0) & z, oe;
276
+ let ce = 0;
277
+ function xe() {
278
+ return ce = (ce + 1 | 0) & Q, ce;
279
279
  }
280
- let te = 0, ue = 0, se = !1;
281
- function _e() {
282
- return se ? (C && console.warn(
280
+ let te = 0, he = 0, se = !1;
281
+ function Ee() {
282
+ return se ? (v && console.warn(
283
283
  "Warning: startFlush() called during flush - ignored to prevent infinite loop detection bypass"
284
- ), !1) : (se = !0, te = te + 1 & z, ue = 0, !0);
284
+ ), !1) : (se = !0, te = te + 1 & Q, he = 0, !0);
285
285
  }
286
- function pe() {
286
+ function ge() {
287
287
  se = !1;
288
288
  }
289
- function ke() {
290
- return se ? ++ue : 0;
289
+ function Be() {
290
+ return se ? ++he : 0;
291
291
  }
292
- class Me {
292
+ class qe {
293
293
  constructor() {
294
- 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 = P.MAX_FLUSH_ITERATIONS;
294
+ 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 = $.MAX_FLUSH_ITERATIONS;
295
295
  }
296
296
  get phase() {
297
297
  return this.isProcessing || this.isFlushingSync ? 2 : this.isBatching ? 1 : 0;
@@ -312,17 +312,17 @@ class Me {
312
312
  this.isProcessing = !0;
313
313
  const e = this.queue, n = this.queueSize;
314
314
  this.queue = this.queue === this.queueA ? this.queueB : this.queueA, this.queueSize = 0, this._epoch++, queueMicrotask(() => {
315
- const s = _e();
316
- this._processJobs(e, n), this.isProcessing = !1, s && pe(), this.queueSize > 0 && !this.isBatching && this.flush();
315
+ const s = Ee();
316
+ this._processJobs(e, n), this.isProcessing = !1, s && ge(), this.queueSize > 0 && !this.isBatching && this.flush();
317
317
  });
318
318
  }
319
319
  flushSync() {
320
320
  this.isFlushingSync = !0;
321
- const e = _e();
321
+ const e = Ee();
322
322
  try {
323
323
  this._mergeBatchQueue(), this._drainQueue();
324
324
  } finally {
325
- this.isFlushingSync = !1, e && pe();
325
+ this.isFlushingSync = !1, e && ge();
326
326
  }
327
327
  }
328
328
  _mergeBatchQueue() {
@@ -382,25 +382,25 @@ class Me {
382
382
  * @param max - Maximum iterations count.
383
383
  */
384
384
  setMaxFlushIterations(e) {
385
- if (e < P.MIN_FLUSH_ITERATIONS)
385
+ if (e < $.MIN_FLUSH_ITERATIONS)
386
386
  throw new Z(
387
- `Max flush iterations must be at least ${P.MIN_FLUSH_ITERATIONS}`
387
+ `Max flush iterations must be at least ${$.MIN_FLUSH_ITERATIONS}`
388
388
  );
389
389
  this.maxFlushIterations = e;
390
390
  }
391
391
  }
392
- const H = new Me();
393
- function O(t) {
392
+ const K = new qe();
393
+ function w(t) {
394
394
  if (typeof t != "function")
395
- throw new w("Batch callback must be a function");
396
- H.startBatch();
395
+ throw new F("Batch callback must be a function");
396
+ K.startBatch();
397
397
  try {
398
398
  return t();
399
399
  } finally {
400
- H.endBatch();
400
+ K.endBatch();
401
401
  }
402
402
  }
403
- const V = {
403
+ const q = {
404
404
  current: null,
405
405
  run(t, e) {
406
406
  const n = this.current;
@@ -415,15 +415,15 @@ const V = {
415
415
  return this.current;
416
416
  }
417
417
  };
418
- function De(t) {
418
+ function Ce(t) {
419
419
  if (typeof t != "function")
420
- throw new w("Untracked callback must be a function");
421
- const e = V.current;
422
- V.current = null;
420
+ throw new F("Untracked callback must be a function");
421
+ const e = q.current;
422
+ q.current = null;
423
423
  try {
424
424
  return t();
425
425
  } finally {
426
- V.current = e;
426
+ q.current = e;
427
427
  }
428
428
  }
429
429
  class ne {
@@ -482,35 +482,35 @@ class ne {
482
482
  return this.subscribers ? [...this.subscribers] : [];
483
483
  }
484
484
  }
485
- function ce(t) {
485
+ function ue(t) {
486
486
  return t !== null && typeof t == "object" && "value" in t && "subscribe" in t && typeof t.subscribe == "function";
487
487
  }
488
- function be(t) {
489
- if (U.enabled && (t == null || typeof t == "object")) {
490
- const e = U.getDebugType(t);
488
+ function me(t) {
489
+ if (O.enabled && (t == null || typeof t == "object")) {
490
+ const e = O.getDebugType(t);
491
491
  if (e)
492
492
  return e === "computed";
493
493
  }
494
- return ce(t) && "invalidate" in t && typeof t.invalidate == "function";
494
+ return ue(t) && "invalidate" in t && typeof t.invalidate == "function";
495
495
  }
496
- function Ce(t) {
496
+ function ve(t) {
497
497
  return t != null && typeof t.then == "function";
498
498
  }
499
- function Le(t) {
499
+ function ze(t) {
500
500
  return typeof t == "object" && t !== null;
501
501
  }
502
- function Ie(t) {
502
+ function Ne(t) {
503
503
  return (typeof t == "object" || typeof t == "function") && t !== null && typeof t.addDependency == "function";
504
504
  }
505
- function xe(t) {
505
+ function Ue(t) {
506
506
  return typeof t == "function" && typeof t.addDependency != "function";
507
507
  }
508
- function ve(t) {
509
- return Le(t) && typeof t.execute == "function";
508
+ function Re(t) {
509
+ return ze(t) && typeof t.execute == "function";
510
510
  }
511
- class Pe extends Se {
511
+ class Xe extends Ie {
512
512
  constructor(e, n) {
513
- super(), this._isNotificationScheduled = !1, this._value = e, this._functionSubscribersStore = new ne(), this._objectSubscribersStore = new ne(), this._sync = n, this._notifyTask = this._flushNotifications.bind(this), U.attachDebugInfo(this, "atom", this.id);
513
+ super(), this._isNotificationScheduled = !1, this._value = e, this._functionSubscribersStore = new ne(), this._objectSubscribersStore = new ne(), this._sync = n, this._notifyTask = this._flushNotifications.bind(this), O.attachDebugInfo(this, "atom", this.id);
514
514
  }
515
515
  /** Gets the manager for function-based subscribers. */
516
516
  get _functionSubscribers() {
@@ -524,7 +524,7 @@ class Pe extends Se {
524
524
  * Returns the current value and registers the atom as a dependency in the current tracking context.
525
525
  */
526
526
  get value() {
527
- const e = V.getCurrent();
527
+ const e = q.getCurrent();
528
528
  return e && this._track(e), this._value;
529
529
  }
530
530
  /**
@@ -534,21 +534,21 @@ class Pe extends Se {
534
534
  set value(e) {
535
535
  if (Object.is(this._value, e)) return;
536
536
  const n = this._value;
537
- this.version = this.version + 1 & z, this._value = e, !(!this._functionSubscribersStore.hasSubscribers && !this._objectSubscribersStore.hasSubscribers) && this._scheduleNotification(n);
537
+ this.version = this.version + 1 & Q, this._value = e, !(!this._functionSubscribersStore.hasSubscribers && !this._objectSubscribersStore.hasSubscribers) && this._scheduleNotification(n);
538
538
  }
539
539
  _track(e) {
540
- if (Ie(e)) {
540
+ if (Ne(e)) {
541
541
  e.addDependency(this);
542
542
  return;
543
543
  }
544
- if (xe(e)) {
544
+ if (Ue(e)) {
545
545
  this._functionSubscribersStore.add(e);
546
546
  return;
547
547
  }
548
- ve(e) && this._objectSubscribersStore.add(e);
548
+ Re(e) && this._objectSubscribersStore.add(e);
549
549
  }
550
550
  _scheduleNotification(e) {
551
- this._isNotificationScheduled || (this._pendingOldValue = e, this._isNotificationScheduled = !0), this._sync && !H.isBatching ? this._flushNotifications() : H.schedule(this._notifyTask);
551
+ this._isNotificationScheduled || (this._pendingOldValue = e, this._isNotificationScheduled = !0), this._sync && !K.isBatching ? this._flushNotifications() : K.schedule(this._notifyTask);
552
552
  }
553
553
  _flushNotifications() {
554
554
  if (!this._isNotificationScheduled) return;
@@ -568,12 +568,12 @@ class Pe extends Se {
568
568
  this._functionSubscribersStore.clear(), this._objectSubscribersStore.clear(), this._value = void 0;
569
569
  }
570
570
  }
571
- function je(t, e = {}) {
572
- return new Pe(t, e.sync ?? !1);
571
+ function Ge(t, e = {}) {
572
+ return new Xe(t, e.sync ?? !1);
573
573
  }
574
- class he {
574
+ class ae {
575
575
  constructor() {
576
- this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = C ? {
576
+ this.pool = [], this.maxPoolSize = 50, this.maxReusableCapacity = 256, this.stats = v ? {
577
577
  acquired: 0,
578
578
  released: 0,
579
579
  rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
@@ -581,7 +581,7 @@ class he {
581
581
  }
582
582
  /** Acquires an array from the pool or creates a new one if the pool is empty. */
583
583
  acquire() {
584
- return C && this.stats && this.stats.acquired++, this.pool.pop() ?? [];
584
+ return v && this.stats && this.stats.acquired++, this.pool.pop() ?? [];
585
585
  }
586
586
  /**
587
587
  * Releases an array back to the pool.
@@ -592,23 +592,23 @@ class he {
592
592
  release(e, n) {
593
593
  if (!(n && e === n)) {
594
594
  if (Object.isFrozen(e)) {
595
- C && this.stats && this.stats.rejected.frozen++;
595
+ v && this.stats && this.stats.rejected.frozen++;
596
596
  return;
597
597
  }
598
598
  if (e.length > this.maxReusableCapacity) {
599
- C && this.stats && this.stats.rejected.tooLarge++;
599
+ v && this.stats && this.stats.rejected.tooLarge++;
600
600
  return;
601
601
  }
602
602
  if (this.pool.length >= this.maxPoolSize) {
603
- C && this.stats && this.stats.rejected.poolFull++;
603
+ v && this.stats && this.stats.rejected.poolFull++;
604
604
  return;
605
605
  }
606
- e.length = 0, this.pool.push(e), C && this.stats && this.stats.released++;
606
+ e.length = 0, this.pool.push(e), v && this.stats && this.stats.released++;
607
607
  }
608
608
  }
609
609
  /** Returns current stats for the pool (dev mode only). */
610
610
  getStats() {
611
- if (!C || !this.stats) return null;
611
+ if (!v || !this.stats) return null;
612
612
  const { acquired: e, released: n, rejected: s } = this.stats, i = s.frozen + s.tooLarge + s.poolFull;
613
613
  return {
614
614
  acquired: e,
@@ -620,44 +620,44 @@ class he {
620
620
  }
621
621
  /** Resets the pool and its stats. */
622
622
  reset() {
623
- this.pool.length = 0, C && this.stats && (this.stats.acquired = 0, this.stats.released = 0, this.stats.rejected = { frozen: 0, tooLarge: 0, poolFull: 0 });
623
+ this.pool.length = 0, v && this.stats && (this.stats.acquired = 0, this.stats.released = 0, this.stats.rejected = { frozen: 0, tooLarge: 0, poolFull: 0 });
624
624
  }
625
625
  }
626
- const m = Object.freeze([]), v = Object.freeze([]), g = Object.freeze([]), k = new he(), j = new he(), N = new he();
627
- function Ve(t, e, n, s) {
628
- if (e !== m && n !== v)
626
+ const y = Object.freeze([]), R = Object.freeze([]), D = Object.freeze([]), P = new ae(), B = new ae(), T = new ae();
627
+ function Qe(t, e, n, s) {
628
+ if (e !== y && n !== R)
629
629
  for (let r = 0; r < e.length; r++) {
630
630
  const o = e[r];
631
631
  o && (o._tempUnsub = n[r]);
632
632
  }
633
- const i = j.acquire();
633
+ const i = B.acquire();
634
634
  i.length = t.length;
635
635
  for (let r = 0; r < t.length; r++) {
636
636
  const o = t[r];
637
- o && (o._tempUnsub ? (i[r] = o._tempUnsub, o._tempUnsub = void 0) : (U.checkCircular(o, s), i[r] = o.subscribe(s)));
637
+ o && (o._tempUnsub ? (i[r] = o._tempUnsub, o._tempUnsub = void 0) : (O.checkCircular(o, s), i[r] = o.subscribe(s)));
638
638
  }
639
- if (e !== m)
639
+ if (e !== y)
640
640
  for (let r = 0; r < e.length; r++) {
641
641
  const o = e[r];
642
642
  o?._tempUnsub && (o._tempUnsub(), o._tempUnsub = void 0);
643
643
  }
644
- return n !== v && j.release(n), i;
644
+ return n !== R && B.release(n), i;
645
645
  }
646
- function q(t, e, n) {
646
+ function G(t, e, n) {
647
647
  if (t instanceof TypeError)
648
648
  return new e(`Type error (${n}): ${t.message}`, t);
649
649
  if (t instanceof ReferenceError)
650
650
  return new e(`Reference error (${n}): ${t.message}`, t);
651
- if (t instanceof w)
651
+ if (t instanceof F)
652
652
  return t;
653
653
  const s = t instanceof Error ? t.message : String(t), i = t instanceof Error ? t : null;
654
654
  return new e(`Unexpected error (${n}): ${s}`, i);
655
655
  }
656
- class Ne extends Se {
656
+ class Te extends Ie {
657
657
  constructor(e, n = {}) {
658
658
  if (typeof e != "function")
659
- throw new B(b.COMPUTED_MUST_BE_FUNCTION);
660
- if (super(), this._value = void 0, this.flags = _.DIRTY | _.IDLE, this._error = null, this._promiseId = 0, this._equal = n.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in n ? n.defaultValue : fe, this._hasDefaultValue = this._defaultValue !== fe, this._onError = n.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._functionSubscribersStore = new ne(), this._objectSubscribersStore = new ne(), this._dependencies = m, this._dependencyVersions = g, this._unsubscribes = v, this._notifyJob = () => {
659
+ throw new X(E.COMPUTED_MUST_BE_FUNCTION);
660
+ if (super(), this._value = void 0, this.flags = p.DIRTY | p.IDLE, this._error = null, this._promiseId = 0, this._equal = n.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in n ? n.defaultValue : pe, this._hasDefaultValue = this._defaultValue !== pe, this._onError = n.onError ?? null, this.MAX_PROMISE_ID = Number.MAX_SAFE_INTEGER - 1, this._functionSubscribersStore = new ne(), this._objectSubscribersStore = new ne(), this._dependencies = y, this._dependencyVersions = D, this._unsubscribes = R, this._notifyJob = () => {
661
661
  this._functionSubscribersStore.forEachSafe(
662
662
  (s) => s(),
663
663
  (s) => console.error(s)
@@ -668,7 +668,7 @@ class Ne extends Se {
668
668
  }, this._trackable = Object.assign(() => this._markDirty(), {
669
669
  addDependency: (s) => {
670
670
  }
671
- }), U.attachDebugInfo(this, "computed", this.id), U.enabled) {
671
+ }), O.attachDebugInfo(this, "computed", this.id), O.enabled) {
672
672
  const s = this;
673
673
  s.subscriberCount = () => this._functionSubscribersStore.size + this._objectSubscribersStore.size, s.isDirty = () => this._isDirty(), s.dependencies = this._dependencies, s.stateFlags = this._getFlagsAsString();
674
674
  }
@@ -707,61 +707,61 @@ class Ne extends Se {
707
707
  return this._isResolved();
708
708
  }
709
709
  invalidate() {
710
- this._markDirty(), this._dependencyVersions !== g && (N.release(this._dependencyVersions), this._dependencyVersions = g);
710
+ this._markDirty(), this._dependencyVersions !== D && (T.release(this._dependencyVersions), this._dependencyVersions = D);
711
711
  }
712
712
  dispose() {
713
- if (this._unsubscribes !== v) {
713
+ if (this._unsubscribes !== R) {
714
714
  for (let e = 0; e < this._unsubscribes.length; e++) {
715
715
  const n = this._unsubscribes[e];
716
716
  n && n();
717
717
  }
718
- j.release(this._unsubscribes), this._unsubscribes = v;
718
+ B.release(this._unsubscribes), this._unsubscribes = R;
719
719
  }
720
- this._dependencies !== m && (k.release(this._dependencies), this._dependencies = m), this._dependencyVersions !== g && (N.release(this._dependencyVersions), this._dependencyVersions = g), this._functionSubscribersStore.clear(), this._objectSubscribersStore.clear(), this.flags = _.DIRTY | _.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID;
720
+ this._dependencies !== y && (P.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== D && (T.release(this._dependencyVersions), this._dependencyVersions = D), this._functionSubscribersStore.clear(), this._objectSubscribersStore.clear(), this.flags = p.DIRTY | p.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % this.MAX_PROMISE_ID;
721
721
  }
722
722
  // State flag operations
723
723
  _isDirty() {
724
- return (this.flags & _.DIRTY) !== 0;
724
+ return (this.flags & p.DIRTY) !== 0;
725
725
  }
726
726
  _setDirty() {
727
- this.flags |= _.DIRTY;
727
+ this.flags |= p.DIRTY;
728
728
  }
729
729
  _clearDirty() {
730
730
  this.flags &= -2;
731
731
  }
732
732
  _isIdle() {
733
- return (this.flags & _.IDLE) !== 0;
733
+ return (this.flags & p.IDLE) !== 0;
734
734
  }
735
735
  _setIdle() {
736
- this.flags |= _.IDLE, this.flags &= -29;
736
+ this.flags |= p.IDLE, this.flags &= -29;
737
737
  }
738
738
  _isPending() {
739
- return (this.flags & _.PENDING) !== 0;
739
+ return (this.flags & p.PENDING) !== 0;
740
740
  }
741
741
  _setPending() {
742
- this.flags |= _.PENDING, this.flags &= -27;
742
+ this.flags |= p.PENDING, this.flags &= -27;
743
743
  }
744
744
  _isResolved() {
745
- return (this.flags & _.RESOLVED) !== 0;
745
+ return (this.flags & p.RESOLVED) !== 0;
746
746
  }
747
747
  _setResolved() {
748
- this.flags |= _.RESOLVED, this.flags &= -87;
748
+ this.flags |= p.RESOLVED, this.flags &= -87;
749
749
  }
750
750
  _isRejected() {
751
- return (this.flags & _.REJECTED) !== 0;
751
+ return (this.flags & p.REJECTED) !== 0;
752
752
  }
753
753
  _setRejected() {
754
- this.flags |= _.REJECTED | _.HAS_ERROR, this.flags &= -15;
754
+ this.flags |= p.REJECTED | p.HAS_ERROR, this.flags &= -15;
755
755
  }
756
756
  _isRecomputing() {
757
- return (this.flags & _.RECOMPUTING) !== 0;
757
+ return (this.flags & p.RECOMPUTING) !== 0;
758
758
  }
759
759
  _setRecomputing(e) {
760
- const n = _.RECOMPUTING;
760
+ const n = p.RECOMPUTING;
761
761
  this.flags = this.flags & ~n | -Number(e) & n;
762
762
  }
763
763
  _getAsyncState() {
764
- return this._isResolved() ? J.RESOLVED : this._isPending() ? J.PENDING : this._isRejected() ? J.REJECTED : J.IDLE;
764
+ return this._isResolved() ? W.RESOLVED : this._isPending() ? W.PENDING : this._isRejected() ? W.REJECTED : W.IDLE;
765
765
  }
766
766
  _getFlagsAsString() {
767
767
  const e = [];
@@ -776,8 +776,8 @@ class Ne extends Se {
776
776
  const e = this._prepareComputationContext();
777
777
  let n = !1;
778
778
  try {
779
- const s = V.run(this._trackable, this._fn);
780
- Ce(s) ? (this._commitDependencies(e), n = !0, this._handleAsyncComputation(s)) : (this._commitDependencies(e), n = !0, this._handleSyncResult(s));
779
+ const s = q.run(this._trackable, this._fn);
780
+ ve(s) ? (this._commitDependencies(e), n = !0, this._handleAsyncComputation(s)) : (this._commitDependencies(e), n = !0, this._handleSyncResult(s));
781
781
  } catch (s) {
782
782
  this._commitDependencies(e), n = !0, this._handleComputationError(s);
783
783
  } finally {
@@ -785,20 +785,20 @@ class Ne extends Se {
785
785
  }
786
786
  }
787
787
  _prepareComputationContext() {
788
- const e = this._dependencies, n = this._dependencyVersions, s = k.acquire(), i = N.acquire(), r = ye(), o = { depCount: 0 }, u = (f) => {
788
+ const e = this._dependencies, n = this._dependencyVersions, s = P.acquire(), i = T.acquire(), r = xe(), o = { depCount: 0 }, u = (f) => {
789
789
  f._lastSeenEpoch !== r && (f._lastSeenEpoch = r, o.depCount < s.length ? (s[o.depCount] = f, i[o.depCount] = f.version) : (s.push(f), i.push(f.version)), o.depCount++);
790
790
  }, l = this._trackable.addDependency;
791
791
  return this._trackable.addDependency = u, { prevDeps: e, prevVersions: n, nextDeps: s, nextVersions: i, originalAdd: l, state: o };
792
792
  }
793
793
  _commitDependencies(e) {
794
794
  const { nextDeps: n, nextVersions: s, state: i, prevDeps: r } = e;
795
- n.length = i.depCount, s.length = i.depCount, this._unsubscribes = Ve(n, r, this._unsubscribes, this), this._dependencies = n, this._dependencyVersions = s;
795
+ n.length = i.depCount, s.length = i.depCount, this._unsubscribes = Qe(n, r, this._unsubscribes, this), this._dependencies = n, this._dependencyVersions = s;
796
796
  }
797
797
  _cleanupContext(e, n) {
798
- this._trackable.addDependency = e.originalAdd, n ? (e.prevDeps !== m && k.release(e.prevDeps), e.prevVersions !== g && N.release(e.prevVersions)) : (k.release(e.nextDeps), N.release(e.nextVersions));
798
+ this._trackable.addDependency = e.originalAdd, n ? (e.prevDeps !== y && P.release(e.prevDeps), e.prevVersions !== D && T.release(e.prevVersions)) : (P.release(e.nextDeps), T.release(e.nextVersions));
799
799
  }
800
800
  _handleSyncResult(e) {
801
- (!this._isResolved() || !this._equal(this._value, e)) && (this.version = this.version + 1 & z), this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1);
801
+ (!this._isResolved() || !this._equal(this._value, e)) && (this.version = this.version + 1 & Q), this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1);
802
802
  }
803
803
  _handleAsyncComputation(e) {
804
804
  this._setPending(), this._clearDirty(), this._promiseId = this._promiseId >= this.MAX_PROMISE_ID ? 1 : this._promiseId + 1;
@@ -810,32 +810,32 @@ class Ne extends Se {
810
810
  });
811
811
  }
812
812
  _handleAsyncResolution(e) {
813
- (!this._isResolved() || !this._equal(this._value, e)) && (this.version = this.version + 1 & z), this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1);
813
+ (!this._isResolved() || !this._equal(this._value, e)) && (this.version = this.version + 1 & Q), this._value = e, this._clearDirty(), this._setResolved(), this._error = null, this._setRecomputing(!1);
814
814
  }
815
815
  _handleAsyncRejection(e) {
816
- const n = q(e, B, b.COMPUTED_ASYNC_COMPUTATION_FAILED);
816
+ const n = G(e, X, E.COMPUTED_ASYNC_COMPUTATION_FAILED);
817
817
  if (this._error = n, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
818
818
  try {
819
819
  this._onError(n);
820
820
  } catch (s) {
821
- console.error(b.CALLBACK_ERROR_IN_ERROR_HANDLER, s);
821
+ console.error(E.CALLBACK_ERROR_IN_ERROR_HANDLER, s);
822
822
  }
823
823
  this._notifySubscribers(void 0, void 0);
824
824
  }
825
825
  _handleComputationError(e) {
826
- const n = q(e, B, b.COMPUTED_COMPUTATION_FAILED);
826
+ const n = G(e, X, E.COMPUTED_COMPUTATION_FAILED);
827
827
  if (this._error = n, this._setRejected(), this._clearDirty(), this._setRecomputing(!1), this._onError)
828
828
  try {
829
829
  this._onError(n);
830
830
  } catch (s) {
831
- console.error(b.CALLBACK_ERROR_IN_ERROR_HANDLER, s);
831
+ console.error(E.CALLBACK_ERROR_IN_ERROR_HANDLER, s);
832
832
  }
833
833
  throw n;
834
834
  }
835
835
  _handlePending() {
836
836
  if (this._hasDefaultValue)
837
837
  return this._defaultValue;
838
- throw new B(b.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
838
+ throw new X(E.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
839
839
  }
840
840
  _handleRejected() {
841
841
  if (this._error?.recoverable && this._hasDefaultValue)
@@ -850,25 +850,25 @@ class Ne extends Se {
850
850
  this._isRecomputing() || this._isDirty() || (this._setDirty(), this._notifyJob());
851
851
  }
852
852
  _registerTracking() {
853
- const e = V.getCurrent();
853
+ const e = q.getCurrent();
854
854
  if (e) {
855
- if (Ie(e)) {
855
+ if (Ne(e)) {
856
856
  e.addDependency(this);
857
857
  return;
858
858
  }
859
- if (xe(e)) {
859
+ if (Ue(e)) {
860
860
  this._functionSubscribersStore.add(e);
861
861
  return;
862
862
  }
863
- ve(e) && this._objectSubscribersStore.add(e);
863
+ Re(e) && this._objectSubscribersStore.add(e);
864
864
  }
865
865
  }
866
866
  }
867
- Object.freeze(Ne.prototype);
868
- function $e(t, e = {}) {
869
- return new Ne(t, e);
867
+ Object.freeze(Te.prototype);
868
+ function He(t, e = {}) {
869
+ return new Te(t, e);
870
870
  }
871
- class Be extends ge {
871
+ class Ye extends De {
872
872
  /**
873
873
  * Creates a new EffectImpl instance.
874
874
  * @param fn - The effect function to run.
@@ -877,18 +877,18 @@ class Be extends ge {
877
877
  constructor(e, n = {}) {
878
878
  super(), this.run = () => {
879
879
  if (this.isDisposed)
880
- throw new F(b.EFFECT_MUST_BE_FUNCTION);
881
- this._dependencyVersions !== g && (N.release(this._dependencyVersions), this._dependencyVersions = g), this.execute();
880
+ throw new L(E.EFFECT_MUST_BE_FUNCTION);
881
+ this._dependencyVersions !== D && (T.release(this._dependencyVersions), this._dependencyVersions = D), this.execute();
882
882
  }, this.dispose = () => {
883
883
  if (!this.isDisposed) {
884
- if (this._setDisposed(), this._safeCleanup(), this._unsubscribes !== v) {
884
+ if (this._setDisposed(), this._safeCleanup(), this._unsubscribes !== R) {
885
885
  for (let s = 0; s < this._unsubscribes.length; s++) {
886
886
  const i = this._unsubscribes[s];
887
887
  i && i();
888
888
  }
889
- j.release(this._unsubscribes), this._unsubscribes = v;
889
+ B.release(this._unsubscribes), this._unsubscribes = R;
890
890
  }
891
- this._dependencies !== m && (k.release(this._dependencies), this._dependencies = m), this._dependencyVersions !== g && (N.release(this._dependencyVersions), this._dependencyVersions = g);
891
+ this._dependencies !== y && (P.release(this._dependencies), this._dependencies = y), this._dependencyVersions !== D && (T.release(this._dependencyVersions), this._dependencyVersions = D);
892
892
  }
893
893
  }, this.addDependency = (s) => {
894
894
  if (this.isExecuting && this._nextDeps && this._nextUnsubs && this._nextVersions) {
@@ -902,26 +902,26 @@ class Be extends ge {
902
902
  const s = this._prepareEffectContext();
903
903
  let i = !1;
904
904
  try {
905
- const r = V.run(this, this._fn);
906
- this._commitEffect(s), i = !0, this._checkLoopWarnings(), Ce(r) ? r.then((o) => {
905
+ const r = q.run(this, this._fn);
906
+ this._commitEffect(s), i = !0, this._checkLoopWarnings(), ve(r) ? r.then((o) => {
907
907
  !this.isDisposed && typeof o == "function" && (this._cleanup = o);
908
908
  }).catch((o) => {
909
- console.error(q(o, F, b.EFFECT_EXECUTION_FAILED));
909
+ console.error(G(o, L, E.EFFECT_EXECUTION_FAILED));
910
910
  }) : this._cleanup = typeof r == "function" ? r : null;
911
911
  } catch (r) {
912
- i = !0, console.error(q(r, F, b.EFFECT_EXECUTION_FAILED)), this._cleanup = null;
912
+ i = !0, console.error(G(r, L, E.EFFECT_EXECUTION_FAILED)), this._cleanup = null;
913
913
  } finally {
914
914
  this._cleanupEffect(s, i), this._setExecuting(!1);
915
915
  }
916
- }, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = n.sync ?? !1, this._maxExecutions = n.maxExecutionsPerSecond ?? P.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = n.maxExecutionsPerFlush ?? P.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = n.trackModifications ?? !1, this._cleanup = null, this._dependencies = m, this._dependencyVersions = g, this._unsubscribes = v, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._history = C ? [] : null, this._executionCount = 0, U.attachDebugInfo(this, "effect", this.id);
916
+ }, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._fn = e, this._sync = n.sync ?? !1, this._maxExecutions = n.maxExecutionsPerSecond ?? $.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = n.maxExecutionsPerFlush ?? $.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = n.trackModifications ?? !1, this._cleanup = null, this._dependencies = y, this._dependencyVersions = D, this._unsubscribes = R, this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, this._history = v ? [] : null, this._executionCount = 0, O.attachDebugInfo(this, "effect", this.id);
917
917
  }
918
918
  /**
919
919
  * Prepares the execution context by acquiring pools and setting up epoch.
920
920
  * @returns The prepared EffectContext.
921
921
  */
922
922
  _prepareEffectContext() {
923
- const e = this._dependencies, n = this._dependencyVersions, s = this._unsubscribes, i = k.acquire(), r = N.acquire(), o = j.acquire(), u = ye();
924
- if (e !== m && s !== v)
923
+ const e = this._dependencies, n = this._dependencyVersions, s = this._unsubscribes, i = P.acquire(), r = T.acquire(), o = B.acquire(), u = xe();
924
+ if (e !== y && s !== R)
925
925
  for (let l = 0; l < e.length; l++) {
926
926
  const f = e[l];
927
927
  f && (f._tempUnsub = s[l]);
@@ -943,19 +943,19 @@ class Be extends ge {
943
943
  */
944
944
  _cleanupEffect(e, n) {
945
945
  if (this._nextDeps = null, this._nextVersions = null, this._nextUnsubs = null, n) {
946
- if (e.prevDeps !== m) {
946
+ if (e.prevDeps !== y) {
947
947
  for (let s = 0; s < e.prevDeps.length; s++) {
948
948
  const i = e.prevDeps[s];
949
949
  i?._tempUnsub && (i._tempUnsub(), i._tempUnsub = void 0);
950
950
  }
951
- k.release(e.prevDeps);
951
+ P.release(e.prevDeps);
952
952
  }
953
- e.prevUnsubs !== v && j.release(e.prevUnsubs), e.prevVersions !== g && N.release(e.prevVersions);
953
+ e.prevUnsubs !== R && B.release(e.prevUnsubs), e.prevVersions !== D && T.release(e.prevVersions);
954
954
  } else {
955
- k.release(e.nextDeps), N.release(e.nextVersions);
955
+ P.release(e.nextDeps), T.release(e.nextVersions);
956
956
  for (let s = 0; s < e.nextUnsubs.length; s++)
957
957
  e.nextUnsubs[s]?.();
958
- if (j.release(e.nextUnsubs), e.prevDeps !== m)
958
+ if (B.release(e.nextUnsubs), e.prevDeps !== y)
959
959
  for (let s = 0; s < e.prevDeps.length; s++) {
960
960
  const i = e.prevDeps[s];
961
961
  i && (i._tempUnsub = void 0);
@@ -969,11 +969,11 @@ class Be extends ge {
969
969
  _subscribeTo(e) {
970
970
  try {
971
971
  const n = e.subscribe(() => {
972
- this._trackModifications && this.isExecuting && (e._modifiedAtEpoch = this._currentEpoch), this._sync ? this.execute() : H.schedule(this.execute);
972
+ this._trackModifications && this.isExecuting && (e._modifiedAtEpoch = this._currentEpoch), this._sync ? this.execute() : K.schedule(this.execute);
973
973
  });
974
974
  this._nextUnsubs && this._nextUnsubs.push(n);
975
975
  } catch (n) {
976
- console.error(q(n, F, b.EFFECT_EXECUTION_FAILED)), this._nextUnsubs && this._nextUnsubs.push(() => {
976
+ console.error(G(n, L, E.EFFECT_EXECUTION_FAILED)), this._nextUnsubs && this._nextUnsubs.push(() => {
977
977
  });
978
978
  }
979
979
  }
@@ -981,7 +981,7 @@ class Be extends ge {
981
981
  * Whether the effect has been disposed.
982
982
  */
983
983
  get isDisposed() {
984
- return (this.flags & K.DISPOSED) !== 0;
984
+ return (this.flags & J.DISPOSED) !== 0;
985
985
  }
986
986
  /**
987
987
  * Total number of times this effect has executed.
@@ -993,13 +993,13 @@ class Be extends ge {
993
993
  * Whether the effect is currently executing.
994
994
  */
995
995
  get isExecuting() {
996
- return (this.flags & K.EXECUTING) !== 0;
996
+ return (this.flags & J.EXECUTING) !== 0;
997
997
  }
998
998
  _setDisposed() {
999
- this.flags |= K.DISPOSED;
999
+ this.flags |= J.DISPOSED;
1000
1000
  }
1001
1001
  _setExecuting(e) {
1002
- const n = K.EXECUTING;
1002
+ const n = J.EXECUTING;
1003
1003
  this.flags = this.flags & ~n | -Number(e) & n;
1004
1004
  }
1005
1005
  /**
@@ -1010,7 +1010,7 @@ class Be extends ge {
1010
1010
  try {
1011
1011
  this._cleanup();
1012
1012
  } catch (e) {
1013
- console.error(q(e, F, b.EFFECT_CLEANUP_FAILED));
1013
+ console.error(G(e, L, E.EFFECT_CLEANUP_FAILED));
1014
1014
  }
1015
1015
  this._cleanup = null;
1016
1016
  }
@@ -1020,29 +1020,29 @@ class Be extends ge {
1020
1020
  * @throws {EffectError} If an infinite loop is detected.
1021
1021
  */
1022
1022
  _checkInfiniteLoop() {
1023
- if (this._lastFlushEpoch !== te && (this._lastFlushEpoch = te, this._executionsInEpoch = 0), this._executionsInEpoch++, this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), ke() > P.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history) {
1023
+ if (this._lastFlushEpoch !== te && (this._lastFlushEpoch = te, this._executionsInEpoch = 0), this._executionsInEpoch++, this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), Be() > $.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history) {
1024
1024
  const e = Date.now();
1025
- this._history.push(e), this._history.length > P.MAX_EXECUTIONS_PER_SECOND + 10 && this._history.shift(), this._checkTimestampLoop(e);
1025
+ this._history.push(e), this._history.length > $.MAX_EXECUTIONS_PER_SECOND + 10 && this._history.shift(), this._checkTimestampLoop(e);
1026
1026
  }
1027
1027
  }
1028
1028
  _checkTimestampLoop(e) {
1029
1029
  const n = this._history;
1030
1030
  if (!n || this._maxExecutions <= 0) return;
1031
- const s = e - Te.ONE_SECOND_MS;
1031
+ const s = e - Le.ONE_SECOND_MS;
1032
1032
  let i = 0;
1033
1033
  for (let r = n.length - 1; r >= 0 && !(n[r] < s); r--)
1034
1034
  i++;
1035
1035
  if (i > this._maxExecutions) {
1036
- const r = new F(
1036
+ const r = new L(
1037
1037
  `Effect executed ${i} times within 1 second. Infinite loop suspected`
1038
1038
  );
1039
- if (this.dispose(), console.error(r), C)
1039
+ if (this.dispose(), console.error(r), v)
1040
1040
  throw r;
1041
1041
  }
1042
1042
  }
1043
1043
  _throwInfiniteLoopError(e) {
1044
- const n = new F(
1045
- `Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${ue}`
1044
+ const n = new L(
1045
+ `Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${he}`
1046
1046
  );
1047
1047
  throw this.dispose(), console.error(n), n;
1048
1048
  }
@@ -1051,14 +1051,14 @@ class Be extends ge {
1051
1051
  * @returns true if any dependency has changed or if it's the first run.
1052
1052
  */
1053
1053
  _shouldExecute() {
1054
- if (this._dependencies === m || this._dependencyVersions === g)
1054
+ if (this._dependencies === y || this._dependencyVersions === D)
1055
1055
  return !0;
1056
1056
  for (let e = 0; e < this._dependencies.length; e++) {
1057
1057
  const n = this._dependencies[e];
1058
1058
  if (n) {
1059
1059
  if ("value" in n)
1060
1060
  try {
1061
- De(() => n.value);
1061
+ Ce(() => n.value);
1062
1062
  } catch {
1063
1063
  return !0;
1064
1064
  }
@@ -1073,25 +1073,25 @@ class Be extends ge {
1073
1073
  * Only active if trackModifications is enabled and debug is on.
1074
1074
  */
1075
1075
  _checkLoopWarnings() {
1076
- if (this._trackModifications && U.enabled) {
1076
+ if (this._trackModifications && O.enabled) {
1077
1077
  const e = this._dependencies;
1078
1078
  for (let n = 0; n < e.length; n++) {
1079
1079
  const s = e[n];
1080
- s && s._modifiedAtEpoch === this._currentEpoch && U.warn(
1080
+ s && s._modifiedAtEpoch === this._currentEpoch && O.warn(
1081
1081
  !0,
1082
- `Effect is reading a dependency (${U.getDebugName(s) || "unknown"}) that it just modified. Infinite loop may occur`
1082
+ `Effect is reading a dependency (${O.getDebugName(s) || "unknown"}) that it just modified. Infinite loop may occur`
1083
1083
  );
1084
1084
  }
1085
1085
  }
1086
1086
  }
1087
1087
  }
1088
- function S(t, e = {}) {
1088
+ function I(t, e = {}) {
1089
1089
  if (typeof t != "function")
1090
- throw new F(b.EFFECT_MUST_BE_FUNCTION);
1091
- const n = new Be(t, e);
1090
+ throw new L(E.EFFECT_MUST_BE_FUNCTION);
1091
+ const n = new Ye(t, e);
1092
1092
  return n.execute(), n;
1093
1093
  }
1094
- function qe() {
1094
+ function Ke() {
1095
1095
  if (typeof window < "u") {
1096
1096
  const t = window.__ATOM_DEBUG__;
1097
1097
  if (typeof t == "boolean")
@@ -1104,19 +1104,19 @@ function qe() {
1104
1104
  }
1105
1105
  return !1;
1106
1106
  }
1107
- let L = qe();
1107
+ let V = Ke();
1108
1108
  const h = {
1109
1109
  get enabled() {
1110
- return L;
1110
+ return V;
1111
1111
  },
1112
1112
  set enabled(t) {
1113
- L = t;
1113
+ V = t;
1114
1114
  },
1115
1115
  log(t, ...e) {
1116
- L && console.log(`[atom-effect-jquery] ${t}:`, ...e);
1116
+ V && console.log(`[atom-effect-jquery] ${t}:`, ...e);
1117
1117
  },
1118
1118
  atomChanged(t, e, n) {
1119
- L && console.log(
1119
+ V && console.log(
1120
1120
  `[atom-effect-jquery] Atom "${t || "anonymous"}" changed:`,
1121
1121
  e,
1122
1122
  "→",
@@ -1127,21 +1127,21 @@ const h = {
1127
1127
  * Logs DOM updates and triggers visual highlight.
1128
1128
  */
1129
1129
  domUpdated(t, e, n) {
1130
- if (!L) return;
1131
- const s = ze(t);
1130
+ if (!V) return;
1131
+ const s = We(t);
1132
1132
  console.log(
1133
1133
  `[atom-effect-jquery] DOM updated: ${s}.${e} =`,
1134
1134
  n
1135
- ), Xe(t);
1135
+ ), Je(t);
1136
1136
  },
1137
1137
  cleanup(t) {
1138
- L && console.log(`[atom-effect-jquery] Cleanup: ${t}`);
1138
+ V && console.log(`[atom-effect-jquery] Cleanup: ${t}`);
1139
1139
  },
1140
1140
  warn(...t) {
1141
- L && console.warn("[atom-effect-jquery]", ...t);
1141
+ V && console.warn("[atom-effect-jquery]", ...t);
1142
1142
  }
1143
1143
  };
1144
- function ze(t) {
1144
+ function We(t) {
1145
1145
  const e = t[0];
1146
1146
  if (!e) return "unknown";
1147
1147
  if (e.id) return `#${e.id}`;
@@ -1151,7 +1151,7 @@ function ze(t) {
1151
1151
  }
1152
1152
  return e.tagName.toLowerCase();
1153
1153
  }
1154
- function Xe(t) {
1154
+ function Je(t) {
1155
1155
  const e = t[0];
1156
1156
  if (!e || !document.contains(e)) return;
1157
1157
  const n = "atom_debug_timer", s = "atom_debug_cleanup_timer", i = "atom_debug_org_style";
@@ -1180,12 +1180,12 @@ function Xe(t) {
1180
1180
  }, 100);
1181
1181
  t.data(n, r);
1182
1182
  }
1183
- const Ge = /* @__PURE__ */ new WeakMap();
1184
- function Ue(t, e = {}) {
1185
- const n = je(t, e);
1186
- return e.name && Ge.set(n, { name: e.name }), n;
1183
+ const Ze = /* @__PURE__ */ new WeakMap();
1184
+ function Oe(t, e = {}) {
1185
+ const n = Ge(t, e);
1186
+ return e.name && Ze.set(n, { name: e.name }), n;
1187
1187
  }
1188
- Object.defineProperty(Ue, "debug", {
1188
+ Object.defineProperty(Oe, "debug", {
1189
1189
  get() {
1190
1190
  return h.enabled;
1191
1191
  },
@@ -1193,27 +1193,27 @@ Object.defineProperty(Ue, "debug", {
1193
1193
  h.enabled = t;
1194
1194
  }
1195
1195
  });
1196
- function Qe() {
1196
+ function et() {
1197
1197
  return new Promise((t) => setTimeout(t, 0));
1198
1198
  }
1199
1199
  c.extend({
1200
- atom: Ue,
1201
- computed: $e,
1202
- effect: S,
1203
- batch: O,
1204
- untracked: De,
1205
- isAtom: ce,
1206
- isComputed: be,
1207
- isReactive: (t) => ce(t) || be(t),
1208
- nextTick: Qe
1200
+ atom: Oe,
1201
+ computed: He,
1202
+ effect: I,
1203
+ batch: w,
1204
+ untracked: Ce,
1205
+ isAtom: ue,
1206
+ isComputed: me,
1207
+ isReactive: (t) => ue(t) || me(t),
1208
+ nextTick: et
1209
1209
  });
1210
- function d(t) {
1210
+ function _(t) {
1211
1211
  return t !== null && typeof t == "object" && "value" in t && "subscribe" in t;
1212
1212
  }
1213
- function p(t) {
1214
- return d(t) ? t.value : t;
1213
+ function b(t) {
1214
+ return _(t) ? t.value : t;
1215
1215
  }
1216
- function ae(t) {
1216
+ function le(t) {
1217
1217
  if (t.id) return `#${t.id}`;
1218
1218
  if (t.className) {
1219
1219
  const e = String(t.className).split(/\s+/).filter(Boolean).join(".");
@@ -1221,7 +1221,7 @@ function ae(t) {
1221
1221
  }
1222
1222
  return t.tagName.toLowerCase();
1223
1223
  }
1224
- class He {
1224
+ class tt {
1225
1225
  // DOM Element -> Effect Array (for disposal)
1226
1226
  effects = /* @__PURE__ */ new WeakMap();
1227
1227
  // DOM Element -> Custom Cleanup Function Array
@@ -1266,7 +1266,7 @@ class He {
1266
1266
  */
1267
1267
  cleanup(e) {
1268
1268
  if (!this.boundElements.has(e)) return;
1269
- h.cleanup(ae(e));
1269
+ h.cleanup(le(e));
1270
1270
  const n = this.effects.get(e);
1271
1271
  n && (this.effects.delete(e), n.forEach((i) => {
1272
1272
  try {
@@ -1294,25 +1294,25 @@ class He {
1294
1294
  }), this.cleanup(e);
1295
1295
  }
1296
1296
  }
1297
- const a = new He();
1298
- let Q = null;
1299
- function Ye(t = document.body) {
1300
- Q || (Q = new MutationObserver((e) => {
1297
+ const a = new tt();
1298
+ let Y = null;
1299
+ function st(t = document.body) {
1300
+ Y || (Y = new MutationObserver((e) => {
1301
1301
  for (const n of e)
1302
1302
  n.removedNodes.forEach((s) => {
1303
- a.isKept(s) || s instanceof Element && a.cleanupTree(s);
1303
+ a.isKept(s) || s.nodeType === 1 && a.cleanupTree(s);
1304
1304
  });
1305
- }), Q.observe(t, { childList: !0, subtree: !0 }));
1305
+ }), Y.observe(t, { childList: !0, subtree: !0 }));
1306
1306
  }
1307
- function Ke() {
1308
- Q?.disconnect(), Q = null;
1307
+ function rt() {
1308
+ Y?.disconnect(), Y = null;
1309
1309
  }
1310
1310
  c.fn.atomText = function(t, e) {
1311
1311
  return this.each(function() {
1312
1312
  const n = c(this);
1313
- if (d(t)) {
1314
- const s = S(() => {
1315
- const i = p(t), r = e ? e(i) : String(i ?? "");
1313
+ if (_(t)) {
1314
+ const s = I(() => {
1315
+ const i = b(t), r = e ? e(i) : String(i ?? "");
1316
1316
  n.text(r), h.domUpdated(n, "text", r);
1317
1317
  });
1318
1318
  a.trackEffect(this, s);
@@ -1325,9 +1325,9 @@ c.fn.atomText = function(t, e) {
1325
1325
  c.fn.atomHtml = function(t) {
1326
1326
  return this.each(function() {
1327
1327
  const e = c(this);
1328
- if (d(t)) {
1329
- const n = S(() => {
1330
- const s = String(p(t) ?? "");
1328
+ if (_(t)) {
1329
+ const n = I(() => {
1330
+ const s = String(b(t) ?? "");
1331
1331
  e.html(s), h.domUpdated(e, "html", s);
1332
1332
  });
1333
1333
  a.trackEffect(this, n);
@@ -1338,9 +1338,9 @@ c.fn.atomHtml = function(t) {
1338
1338
  c.fn.atomClass = function(t, e) {
1339
1339
  return this.each(function() {
1340
1340
  const n = c(this);
1341
- if (d(e)) {
1342
- const s = S(() => {
1343
- const i = !!p(e);
1341
+ if (_(e)) {
1342
+ const s = I(() => {
1343
+ const i = !!b(e);
1344
1344
  n.toggleClass(t, i), h.domUpdated(n, `class.${t}`, i);
1345
1345
  });
1346
1346
  a.trackEffect(this, s);
@@ -1351,9 +1351,9 @@ c.fn.atomClass = function(t, e) {
1351
1351
  c.fn.atomCss = function(t, e, n) {
1352
1352
  return this.each(function() {
1353
1353
  const s = c(this);
1354
- if (d(e)) {
1355
- const i = S(() => {
1356
- const r = p(e), o = n ? `${r}${n}` : r;
1354
+ if (_(e)) {
1355
+ const i = I(() => {
1356
+ const r = b(e), o = n ? `${r}${n}` : r;
1357
1357
  s.css(t, o), h.domUpdated(s, `css.${t}`, o);
1358
1358
  });
1359
1359
  a.trackEffect(this, i);
@@ -1366,8 +1366,8 @@ c.fn.atomAttr = function(t, e) {
1366
1366
  const n = c(this), s = (i) => {
1367
1367
  i == null || i === !1 ? n.removeAttr(t) : i === !0 ? n.attr(t, t) : n.attr(t, String(i)), h.domUpdated(n, `attr.${t}`, i);
1368
1368
  };
1369
- if (d(e)) {
1370
- const i = S(() => s(p(e)));
1369
+ if (_(e)) {
1370
+ const i = I(() => s(b(e)));
1371
1371
  a.trackEffect(this, i);
1372
1372
  } else
1373
1373
  s(e);
@@ -1376,9 +1376,9 @@ c.fn.atomAttr = function(t, e) {
1376
1376
  c.fn.atomProp = function(t, e) {
1377
1377
  return this.each(function() {
1378
1378
  const n = c(this);
1379
- if (d(e)) {
1380
- const s = S(() => {
1381
- const i = p(e);
1379
+ if (_(e)) {
1380
+ const s = I(() => {
1381
+ const i = b(e);
1382
1382
  n.prop(t, i), h.domUpdated(n, `prop.${t}`, i);
1383
1383
  });
1384
1384
  a.trackEffect(this, s);
@@ -1389,9 +1389,9 @@ c.fn.atomProp = function(t, e) {
1389
1389
  c.fn.atomShow = function(t) {
1390
1390
  return this.each(function() {
1391
1391
  const e = c(this);
1392
- if (d(t)) {
1393
- const n = S(() => {
1394
- const s = !!p(t);
1392
+ if (_(t)) {
1393
+ const n = I(() => {
1394
+ const s = !!b(t);
1395
1395
  e.toggle(s), h.domUpdated(e, "show", s);
1396
1396
  });
1397
1397
  a.trackEffect(this, n);
@@ -1402,9 +1402,9 @@ c.fn.atomShow = function(t) {
1402
1402
  c.fn.atomHide = function(t) {
1403
1403
  return this.each(function() {
1404
1404
  const e = c(this);
1405
- if (d(t)) {
1406
- const n = S(() => {
1407
- const s = !p(t);
1405
+ if (_(t)) {
1406
+ const n = I(() => {
1407
+ const s = !b(t);
1408
1408
  e.toggle(s), h.domUpdated(e, "hide", !s);
1409
1409
  });
1410
1410
  a.trackEffect(this, n);
@@ -1421,27 +1421,27 @@ c.fn.atomVal = function(t, e = {}) {
1421
1421
  } = e;
1422
1422
  return this.each(function() {
1423
1423
  const o = c(this);
1424
- let u = null, l = !1, f = !1, R = !1;
1425
- const I = () => {
1424
+ let u = null, l = !1, f = !1, g = !1;
1425
+ const m = () => {
1426
1426
  f = !0;
1427
- }, x = () => {
1428
- f = !1, X();
1427
+ }, j = () => {
1428
+ f = !1, x();
1429
1429
  };
1430
- o.on("compositionstart", I), o.on("compositionend", x);
1431
- const X = () => {
1432
- l || R || O(() => {
1430
+ o.on("compositionstart", m), o.on("compositionend", j);
1431
+ const x = () => {
1432
+ l || g || w(() => {
1433
1433
  t.value = i(o.val());
1434
1434
  });
1435
- }, D = () => {
1436
- f || R || l || (n ? (u && clearTimeout(u), u = window.setTimeout(X, n)) : X());
1435
+ }, z = () => {
1436
+ f || g || l || (n ? (u && clearTimeout(u), u = window.setTimeout(x, n)) : x());
1437
1437
  };
1438
- o.on(s, D), o.on("change", D);
1439
- const Y = S(() => {
1440
- const y = r(t.value);
1441
- o.val() !== y && (l = !0, R = !0, o.val(y), h.domUpdated(o, "val", y), R = !1, l = !1);
1438
+ o.on(s, z), o.on("change", z);
1439
+ const N = I(() => {
1440
+ const k = r(t.value);
1441
+ o.val() !== k && (l = !0, g = !0, o.val(k), h.domUpdated(o, "val", k), g = !1, l = !1);
1442
1442
  });
1443
- a.trackEffect(this, Y), a.trackCleanup(this, () => {
1444
- o.off(s, D), o.off("change", D), o.off("compositionstart", I), o.off("compositionend", x), u && clearTimeout(u);
1443
+ a.trackEffect(this, N), a.trackCleanup(this, () => {
1444
+ o.off(s, z), o.off("change", z), o.off("compositionstart", m), o.off("compositionend", j), u && clearTimeout(u);
1445
1445
  });
1446
1446
  });
1447
1447
  };
@@ -1450,12 +1450,12 @@ c.fn.atomChecked = function(t) {
1450
1450
  const e = c(this);
1451
1451
  let n = !1;
1452
1452
  const s = () => {
1453
- n || O(() => {
1453
+ n || w(() => {
1454
1454
  t.value = e.prop("checked");
1455
1455
  });
1456
1456
  };
1457
1457
  e.on("change", s), a.trackCleanup(this, () => e.off("change", s));
1458
- const i = S(() => {
1458
+ const i = I(() => {
1459
1459
  n = !0, e.prop("checked", t.value), h.domUpdated(e, "checked", t.value), n = !1;
1460
1460
  });
1461
1461
  a.trackEffect(this, i);
@@ -1464,7 +1464,7 @@ c.fn.atomChecked = function(t) {
1464
1464
  c.fn.atomOn = function(t, e) {
1465
1465
  return this.each(function() {
1466
1466
  const n = c(this), s = function(i) {
1467
- O(() => e.call(this, i));
1467
+ w(() => e.call(this, i));
1468
1468
  };
1469
1469
  n.on(t, s), a.trackCleanup(this, () => n.off(t, s));
1470
1470
  });
@@ -1477,28 +1477,28 @@ c.fn.atomUnbind = function() {
1477
1477
  c.fn.atomBind = function(t) {
1478
1478
  return this.each(function() {
1479
1479
  const e = c(this), n = [];
1480
- if (t.text !== void 0 && (d(t.text) ? n.push(() => {
1481
- const s = String(p(t.text) ?? "");
1480
+ if (t.text !== void 0 && (_(t.text) ? n.push(() => {
1481
+ const s = String(b(t.text) ?? "");
1482
1482
  e.text(s), h.domUpdated(e, "text", s);
1483
- }) : e.text(String(t.text ?? ""))), t.html !== void 0 && (d(t.html) ? n.push(() => {
1484
- const s = String(p(t.html) ?? "");
1483
+ }) : e.text(String(t.text ?? ""))), t.html !== void 0 && (_(t.html) ? n.push(() => {
1484
+ const s = String(b(t.html) ?? "");
1485
1485
  e.html(s), h.domUpdated(e, "html", s);
1486
1486
  }) : e.html(String(t.html ?? ""))), t.class)
1487
1487
  for (const [s, i] of Object.entries(t.class))
1488
- d(i) ? n.push(() => {
1489
- const r = !!p(i);
1488
+ _(i) ? n.push(() => {
1489
+ const r = !!b(i);
1490
1490
  e.toggleClass(s, r), h.domUpdated(e, `class.${s}`, r);
1491
1491
  }) : e.toggleClass(s, !!i);
1492
1492
  if (t.css)
1493
1493
  for (const [s, i] of Object.entries(t.css))
1494
1494
  if (Array.isArray(i)) {
1495
1495
  const [r, o] = i;
1496
- d(r) ? n.push(() => {
1497
- const u = `${p(r)}${o}`;
1496
+ _(r) ? n.push(() => {
1497
+ const u = `${b(r)}${o}`;
1498
1498
  e.css(s, u), h.domUpdated(e, `css.${s}`, u);
1499
1499
  }) : e.css(s, `${r}${o}`);
1500
- } else d(i) ? n.push(() => {
1501
- const r = p(i);
1500
+ } else _(i) ? n.push(() => {
1501
+ const r = b(i);
1502
1502
  e.css(s, r), h.domUpdated(e, `css.${s}`, r);
1503
1503
  }) : e.css(s, i);
1504
1504
  if (t.attr)
@@ -1506,19 +1506,19 @@ c.fn.atomBind = function(t) {
1506
1506
  const r = (o) => {
1507
1507
  o == null || o === !1 ? e.removeAttr(s) : o === !0 ? e.attr(s, s) : e.attr(s, String(o)), h.domUpdated(e, `attr.${s}`, o);
1508
1508
  };
1509
- d(i) ? n.push(() => r(p(i))) : r(i);
1509
+ _(i) ? n.push(() => r(b(i))) : r(i);
1510
1510
  }
1511
1511
  if (t.prop)
1512
1512
  for (const [s, i] of Object.entries(t.prop))
1513
- d(i) ? n.push(() => {
1514
- const r = p(i);
1513
+ _(i) ? n.push(() => {
1514
+ const r = b(i);
1515
1515
  e.prop(s, r), h.domUpdated(e, `prop.${s}`, r);
1516
1516
  }) : e.prop(s, i);
1517
- if (t.show !== void 0 && (d(t.show) ? n.push(() => {
1518
- const s = !!p(t.show);
1517
+ if (t.show !== void 0 && (_(t.show) ? n.push(() => {
1518
+ const s = !!b(t.show);
1519
1519
  e.toggle(s), h.domUpdated(e, "show", s);
1520
- }) : e.toggle(!!t.show)), t.hide !== void 0 && (d(t.hide) ? n.push(() => {
1521
- const s = !p(t.hide);
1520
+ }) : e.toggle(!!t.show)), t.hide !== void 0 && (_(t.hide) ? n.push(() => {
1521
+ const s = !b(t.hide);
1522
1522
  e.toggle(s), h.domUpdated(e, "hide", !s);
1523
1523
  }) : e.toggle(!t.hide)), t.val !== void 0) {
1524
1524
  const s = t.val;
@@ -1526,13 +1526,13 @@ c.fn.atomBind = function(t) {
1526
1526
  const o = () => {
1527
1527
  r = !0;
1528
1528
  }, u = () => {
1529
- r = !1, i || O(() => {
1529
+ r = !1, i || w(() => {
1530
1530
  s.value = e.val();
1531
1531
  });
1532
1532
  };
1533
1533
  e.on("compositionstart", o), e.on("compositionend", u);
1534
1534
  const l = () => {
1535
- r || i || O(() => {
1535
+ r || i || w(() => {
1536
1536
  s.value = e.val();
1537
1537
  });
1538
1538
  };
@@ -1547,7 +1547,7 @@ c.fn.atomBind = function(t) {
1547
1547
  const s = t.checked;
1548
1548
  let i = !1;
1549
1549
  const r = () => {
1550
- i || O(() => {
1550
+ i || w(() => {
1551
1551
  s.value = e.prop("checked");
1552
1552
  });
1553
1553
  };
@@ -1558,59 +1558,96 @@ c.fn.atomBind = function(t) {
1558
1558
  if (t.on)
1559
1559
  for (const [s, i] of Object.entries(t.on)) {
1560
1560
  const r = function(o) {
1561
- O(() => i.call(this, o));
1561
+ w(() => i.call(this, o));
1562
1562
  };
1563
1563
  e.on(s, r), a.trackCleanup(this, () => e.off(s, r));
1564
1564
  }
1565
1565
  n.forEach((s) => {
1566
- const i = S(s);
1566
+ const i = I(s);
1567
1567
  a.trackEffect(this, i);
1568
1568
  });
1569
1569
  });
1570
1570
  };
1571
+ function nt(t) {
1572
+ if (t.length === 0) return [];
1573
+ const e = t.slice(), n = [0];
1574
+ let s, i, r, o;
1575
+ const u = t.length;
1576
+ for (s = 0; s < u; s++) {
1577
+ const g = t[s];
1578
+ if (g !== -1) {
1579
+ const m = n[n.length - 1];
1580
+ if (t[m] < g) {
1581
+ e[s] = m, n.push(s);
1582
+ continue;
1583
+ }
1584
+ for (i = 0, r = n.length - 1; i < r; )
1585
+ o = (i + r) / 2 | 0, t[n[o]] < g ? i = o + 1 : r = o;
1586
+ g < t[n[i]] && (i > 0 && (e[s] = n[i - 1]), n[i] = s);
1587
+ }
1588
+ }
1589
+ let l = n.length, f = n[l - 1];
1590
+ for (; l-- > 0; )
1591
+ n[l] = f, f = e[f];
1592
+ return n;
1593
+ }
1571
1594
  c.fn.atomList = function(t, e) {
1572
1595
  return this.each(function() {
1573
- const n = c(this), s = ae(this), { key: i, render: r, bind: o, onAdd: u, onRemove: l, empty: f } = e, R = typeof i == "function" ? i : (D) => D[i], I = /* @__PURE__ */ new Map();
1574
- let x = null;
1575
- const X = S(() => {
1576
- const D = t.value, Y = /* @__PURE__ */ new Set();
1577
- if (h.log("list", `${s} updating with ${D.length} items`), D.length === 0 && f) {
1596
+ const n = c(this), s = le(this), { key: i, render: r, bind: o, onAdd: u, onRemove: l, empty: f } = e, g = typeof i == "function" ? i : (N) => N[i], m = /* @__PURE__ */ new Map();
1597
+ let j = [], x = null;
1598
+ const z = I(() => {
1599
+ const N = t.value, k = [], fe = /* @__PURE__ */ new Set();
1600
+ for (let d = 0; d < N.length; d++) {
1601
+ const S = g(N[d], d);
1602
+ k.push(S), fe.add(S);
1603
+ }
1604
+ if (h.log("list", `${s} updating with ${N.length} items`), N.length === 0 && f) {
1578
1605
  x || (x = c(f), n.append(x));
1579
- for (const [, E] of I)
1580
- E.$el.remove(), a.cleanup(E.$el[0]);
1581
- I.clear();
1606
+ for (const [, d] of m)
1607
+ d.$el.remove(), a.cleanup(d.$el[0]);
1608
+ m.clear(), j = [];
1582
1609
  return;
1583
1610
  } else x && (x.remove(), x = null);
1584
- let y = null;
1585
- for (let E = 0; E < D.length; E++) {
1586
- const T = D[E], M = R(T, E);
1587
- Y.add(M);
1588
- const $ = I.get(M);
1589
- if ($) {
1590
- const W = $.$el[0], A = y ? y[0] : null;
1591
- (A ? W.previousSibling === A : W === n[0].firstChild) || (y ? y.after($.$el) : n.prepend($.$el)), $.item = T, y = $.$el;
1592
- } else {
1593
- const W = r(T, E), A = c(W);
1594
- y ? y.after(A) : n.prepend(A), I.set(M, { $el: A, item: T }), o && o(A, T, E), u && u(A), h.log("list", `${s} added item:`, M), y = A;
1595
- }
1596
- }
1597
- for (const [E, T] of I)
1598
- if (!Y.has(E)) {
1611
+ for (const [d, S] of m)
1612
+ if (!fe.has(d)) {
1599
1613
  const M = () => {
1600
- T.$el.remove(), a.cleanup(T.$el[0]), I.delete(E), h.log("list", `${s} removed item:`, E);
1614
+ S.$el.remove(), a.cleanup(S.$el[0]), h.log("list", `${s} removed item:`, d);
1601
1615
  };
1602
- l ? Promise.resolve(l(T.$el)).then(M) : M();
1616
+ m.delete(d), l ? Promise.resolve(l(S.$el)).then(M) : M();
1617
+ }
1618
+ const ie = /* @__PURE__ */ new Map();
1619
+ j.forEach((d, S) => ie.set(d, S));
1620
+ const we = k.map((d) => ie.has(d) ? ie.get(d) : -1), Fe = nt(we), ke = new Set(Fe);
1621
+ let U = null;
1622
+ for (let d = N.length - 1; d >= 0; d--) {
1623
+ const S = k[d], M = N[d], Me = ke.has(d);
1624
+ if (m.has(S)) {
1625
+ const C = m.get(S);
1626
+ C.item = M;
1627
+ const A = C.$el[0];
1628
+ if (e.update && e.update(C.$el, M, d), !Me)
1629
+ U ? C.$el.insertBefore(U) : C.$el.appendTo(n);
1630
+ else {
1631
+ const de = A.nextSibling;
1632
+ U && de !== U ? C.$el.insertBefore(U) : !U && de && C.$el.appendTo(n);
1633
+ }
1634
+ U = A;
1635
+ } else {
1636
+ const C = r(M, d), A = C instanceof Element ? c(C) : c(C);
1637
+ m.set(S, { $el: A, item: M }), U ? A.insertBefore(U) : A.appendTo(n), o && o(A, M, d), u && u(A), h.log("list", `${s} added item:`, S), U = A[0];
1603
1638
  }
1639
+ }
1640
+ j = k;
1604
1641
  });
1605
- a.trackEffect(this, X), a.trackCleanup(this, () => {
1606
- I.clear(), x?.remove();
1642
+ a.trackEffect(this, z), a.trackCleanup(this, () => {
1643
+ m.clear(), j = [], x?.remove();
1607
1644
  });
1608
1645
  });
1609
1646
  };
1610
1647
  const ee = /* @__PURE__ */ new WeakMap();
1611
1648
  c.fn.atomMount = function(t, e = {}) {
1612
1649
  return this.each(function() {
1613
- const n = c(this), s = ae(this), i = ee.get(this);
1650
+ const n = c(this), s = le(this), i = ee.get(this);
1614
1651
  i && (h.log("mount", `${s} unmounting existing component`), i()), h.log("mount", `${s} mounting component`);
1615
1652
  let r;
1616
1653
  try {
@@ -1638,11 +1675,11 @@ c.fn.atomUnmount = function() {
1638
1675
  ee.get(this)?.();
1639
1676
  });
1640
1677
  };
1641
- const G = /* @__PURE__ */ new WeakMap();
1642
- let Ee = !1;
1643
- function Re() {
1644
- if (Ee) return;
1645
- Ee = !0;
1678
+ const H = /* @__PURE__ */ new WeakMap();
1679
+ let Se = !1;
1680
+ function Ae() {
1681
+ if (Se) return;
1682
+ Se = !0;
1646
1683
  const t = c.fn.on, e = c.fn.off, n = c.fn.remove, s = c.fn.empty, i = c.fn.detach;
1647
1684
  c.fn.remove = function(r) {
1648
1685
  return (r ? this.filter(r) : this).each(function() {
@@ -1666,12 +1703,12 @@ function Re() {
1666
1703
  if (o !== -1) {
1667
1704
  const u = r[o];
1668
1705
  let l;
1669
- G.has(u) ? l = G.get(u) : (l = function(...f) {
1670
- let R;
1671
- return O(() => {
1672
- R = u.apply(this, f);
1673
- }), R;
1674
- }, G.set(u, l)), r[o] = l;
1706
+ H.has(u) ? l = H.get(u) : (l = function(...f) {
1707
+ let g;
1708
+ return w(() => {
1709
+ g = u.apply(this, f);
1710
+ }), g;
1711
+ }, H.set(u, l)), r[o] = l;
1675
1712
  }
1676
1713
  return t.apply(this, r);
1677
1714
  }, c.fn.off = function(...r) {
@@ -1683,26 +1720,27 @@ function Re() {
1683
1720
  }
1684
1721
  if (o !== -1) {
1685
1722
  const u = r[o];
1686
- G.has(u) && (r[o] = G.get(u));
1723
+ H.has(u) && (r[o] = H.get(u));
1687
1724
  }
1688
1725
  return e.apply(this, r);
1689
1726
  };
1690
1727
  }
1691
- const Ze = Re;
1728
+ const ot = Ae;
1729
+ Ae();
1692
1730
  c(() => {
1693
- Ye(document.body), Re();
1731
+ st(document.body);
1694
1732
  });
1695
1733
  export {
1696
- je as atom,
1697
- O as batch,
1698
- $e as computed,
1699
- st as default,
1700
- Ke as disableAutoCleanup,
1701
- S as effect,
1702
- Ye as enableAutoCleanup,
1703
- Ze as enablejQueryBatching,
1704
- Re as enablejQueryOverrides,
1734
+ Ge as atom,
1735
+ w as batch,
1736
+ He as computed,
1737
+ ht as default,
1738
+ rt as disableAutoCleanup,
1739
+ I as effect,
1740
+ st as enableAutoCleanup,
1741
+ ot as enablejQueryBatching,
1742
+ Ae as enablejQueryOverrides,
1705
1743
  a as registry,
1706
- De as untracked
1744
+ Ce as untracked
1707
1745
  };
1708
1746
  //# sourceMappingURL=index.mjs.map