@but212/atom-effect-jquery 0.27.0 → 0.29.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
@@ -33,48 +33,28 @@ var t = {
33
33
  }, o = {
34
34
  WARN_INFINITE_LOOP: !0,
35
35
  EFFECT_FREQUENCY_WINDOW: 1e3
36
- }, s = {
37
- MAX_ASYNC_RETRIES: 3,
38
- MAX_PROMISE_ID: 2 ** 53 - 1 - 1
39
- }, c = {
36
+ }, s = { MAX_PROMISE_ID: 2 ** 53 - 1 - 1 }, c = {
40
37
  UNINITIALIZED: -1,
41
38
  MIN: 1
42
- }, l = 1073741823, u = { VERSION_BITS: 16 };
39
+ }, l = 1073741823;
43
40
  typeof process < "u" && process.env;
44
- var d = Object.freeze([]), f = class {
45
- constructor(e, t, n = void 0) {
46
- this.node = e, this.version = t, this.unsub = n;
47
- }
48
- }, p = class {
49
- constructor(e, t) {
50
- this.fn = e, this.sub = t;
51
- }
52
- notify(e, t) {
53
- let n = this.fn;
54
- if (n !== void 0) {
55
- n(e, t);
56
- return;
57
- }
58
- let r = this.sub;
59
- r !== void 0 && r.execute();
60
- }
61
- }, m = class extends Error {
41
+ var u = Object.freeze([]), d = class extends Error {
62
42
  constructor(e, t = null, n = !0) {
63
43
  super(e), this.cause = t, this.recoverable = n, this.name = "AtomError";
64
44
  }
65
- }, h = class extends m {
45
+ }, f = class extends d {
66
46
  constructor(e, t = null) {
67
47
  super(e, t, !0), this.name = "ComputedError";
68
48
  }
69
- }, g = class extends m {
49
+ }, p = class extends d {
70
50
  constructor(e, t = null) {
71
51
  super(e, t, !1), this.name = "EffectError";
72
52
  }
73
- }, _ = class extends m {
53
+ }, m = class extends d {
74
54
  constructor(e, t = null) {
75
55
  super(e, t, !1), this.name = "SchedulerError";
76
56
  }
77
- }, v = {
57
+ }, h = {
78
58
  COMPUTED_MUST_BE_FUNCTION: "Computed target must be a function",
79
59
  COMPUTED_ASYNC_PENDING_NO_DEFAULT: "Async computation pending with no default value",
80
60
  COMPUTED_COMPUTATION_FAILED: "Computation execution failed",
@@ -93,7 +73,23 @@ var d = Object.freeze([]), f = class {
93
73
  SCHEDULER_CALLBACK_MUST_BE_FUNCTION: "Scheduler callback must be a function",
94
74
  SCHEDULER_END_BATCH_WITHOUT_START: "endBatch() called without matching startBatch(). Ignoring.",
95
75
  BATCH_CALLBACK_MUST_BE_FUNCTION: "Batch callback must be a function"
96
- }, y = class {
76
+ };
77
+ function g(e, t, n) {
78
+ return e instanceof d ? e : e instanceof Error ? new t(`${e.name || e.constructor.name || "Error"} (${n}): ${e.message}`, e) : new t(`Unexpected error (${n}): ${String(e)}`);
79
+ }
80
+ var ee = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), _ = /* @__PURE__ */ Symbol("AtomEffect.Type"), v = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), y = new class {
81
+ constructor() {
82
+ this.enabled = !1, this.warnInfiniteLoop = o.WARN_INFINITE_LOOP;
83
+ }
84
+ warn(e, t) {}
85
+ attachDebugInfo(e, t, n) {}
86
+ getDebugName(e) {
87
+ if (e != null) return e[ee];
88
+ }
89
+ getDebugType(e) {
90
+ if (e != null) return e[_];
91
+ }
92
+ }(), b = 1, x = () => b++ | 0, S = class {
97
93
  constructor() {
98
94
  this._s0 = null, this._s1 = null, this._s2 = null, this._s3 = null, this._count = 0, this._overflow = null, this._freeIndices = null;
99
95
  }
@@ -269,25 +265,179 @@ var d = Object.freeze([]), f = class {
269
265
  dispose() {
270
266
  this.clear();
271
267
  }
272
- }, b = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), x = /* @__PURE__ */ Symbol("AtomEffect.Type"), S = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), C = new class {
268
+ }, C = class extends S {
269
+ constructor(...e) {
270
+ super(...e), this._map = null, this._SCAN_THRESHOLD = 32, this.hasComputeds = !1;
271
+ }
272
+ prepareTracking() {
273
+ this.hasComputeds = !1;
274
+ }
275
+ _onItemRemoved(e) {
276
+ let t = e.unsub;
277
+ t && t();
278
+ }
279
+ claimExisting(e, t) {
280
+ let n = this._count;
281
+ if (t >= n) return !1;
282
+ let r = n - t;
283
+ if (this._map !== null || r > this._SCAN_THRESHOLD) return this._claimViaMap(e, t);
284
+ if (t < 4) switch (t) {
285
+ case 0: {
286
+ let t = this._s0;
287
+ if (t && t.node === e && t.unsub) return t.version = e.version, !0;
288
+ }
289
+ case 1: if (n > 1) {
290
+ let n = this._s1;
291
+ if (n && n.node === e && n.unsub) return n.version = e.version, t !== 1 && (this._s1 = this._s0, this._s0 = n), !0;
292
+ }
293
+ case 2: if (n > 2) {
294
+ let n = this._s2;
295
+ if (n && n.node === e && n.unsub) {
296
+ if (n.version = e.version, t !== 2) {
297
+ let e = t === 0 ? this._s0 : this._s1;
298
+ t === 0 ? this._s0 = n : this._s1 = n, this._s2 = e;
299
+ }
300
+ return !0;
301
+ }
302
+ }
303
+ case 3: if (n > 3) {
304
+ let n = this._s3;
305
+ if (n && n.node === e && n.unsub) {
306
+ if (n.version = e.version, t !== 3) {
307
+ let e;
308
+ t === 0 ? (e = this._s0, this._s0 = n) : t === 1 ? (e = this._s1, this._s1 = n) : (e = this._s2, this._s2 = n), this._s3 = e;
309
+ }
310
+ return !0;
311
+ }
312
+ }
313
+ }
314
+ let i = this._overflow;
315
+ if (i) {
316
+ let n = e.version, r = t > 4 ? t : 4, a = i.length;
317
+ for (let o = r - 4; o < a; o++) {
318
+ let r = i[o];
319
+ if (r && r.node === e && r.unsub) return r.version = n, this._swapGeneral(o + 4, t, r), !0;
320
+ }
321
+ }
322
+ return !1;
323
+ }
324
+ _claimViaMap(e, t) {
325
+ let n = this._map;
326
+ if (n === null) {
327
+ n = this._map = /* @__PURE__ */ new Map();
328
+ let e = this._count;
329
+ if (t < 4) {
330
+ let e = this._s0;
331
+ t <= 0 && e?.unsub && n.set(e.node, 0);
332
+ let r = this._s1;
333
+ t <= 1 && r?.unsub && n.set(r.node, 1);
334
+ let i = this._s2;
335
+ t <= 2 && i?.unsub && n.set(i.node, 2);
336
+ let a = this._s3;
337
+ t <= 3 && a?.unsub && n.set(a.node, 3);
338
+ }
339
+ let r = this._overflow;
340
+ if (r && e > 4) {
341
+ let e = t > 4 ? t : 4, i = r.length;
342
+ for (let t = e - 4; t < i; t++) {
343
+ let e = r[t];
344
+ e?.unsub && n.set(e.node, t + 4);
345
+ }
346
+ }
347
+ }
348
+ let r = n.get(e);
349
+ if (r === void 0 || r < t) return !1;
350
+ let i = this.getAt(r);
351
+ if (i == null || !i.unsub) return !1;
352
+ if (i.version = e.version, r !== t) {
353
+ let a;
354
+ a = t === 0 ? this._s0 : t === 1 ? this._s1 : t === 2 ? this._s2 : t === 3 ? this._s3 : this._overflow[t - 4] ?? null, this.setAt(t, i), this.setAt(r, a), a?.unsub && n.set(a.node, r), n.set(e, t);
355
+ }
356
+ return !0;
357
+ }
358
+ _swapGeneral(e, t, n) {
359
+ if (e === t) return;
360
+ let r;
361
+ if (r = t === 0 ? this._s0 : t === 1 ? this._s1 : t === 2 ? this._s2 : t === 3 ? this._s3 : this._overflow[t - 4] ?? null, this.setAt(t, n), e === 0) this._s0 = r;
362
+ else if (e === 1) this._s1 = r;
363
+ else if (e === 2) this._s2 = r;
364
+ else if (e === 3) this._s3 = r;
365
+ else {
366
+ let t = this._overflow;
367
+ t[e - 4] = r;
368
+ }
369
+ }
370
+ insertNew(e, t) {
371
+ let n = this._count;
372
+ if (e < n) {
373
+ let t;
374
+ t = e === 0 ? this._s0 : e === 1 ? this._s1 : e === 2 ? this._s2 : e === 3 ? this._s3 : this._overflow[e - 4] ?? null, t != null && (this._addToOverflow(t), this._map !== null && t.unsub && this._map.set(t.node, this._count - 1));
375
+ }
376
+ if (e === 0) this._s0 = t;
377
+ else if (e === 1) this._s1 = t;
378
+ else if (e === 2) this._s2 = t;
379
+ else if (e === 3) this._s3 = t;
380
+ else {
381
+ let n = this._overflow;
382
+ n || (n = [], this._overflow = n), n[e - 4] = t;
383
+ }
384
+ e >= n && (this._count = e + 1);
385
+ }
386
+ truncateFrom(e) {
387
+ e >= this._count || (super.truncateFrom(e), this._map !== null && (this._map.clear(), this._map = null));
388
+ }
389
+ disposeAll() {
390
+ this._count > 0 && this.truncateFrom(0), this.hasComputeds = !1;
391
+ }
392
+ remove(e) {
393
+ throw Error("remove() is strictly prohibited in DepSlotBuffer to preserve sequential cache paths.");
394
+ }
395
+ compact() {}
396
+ }, w = class {
397
+ constructor(e, t, n = void 0) {
398
+ this.node = e, this.version = t, this.unsub = n;
399
+ }
400
+ }, te = class {
401
+ constructor(e, t) {
402
+ this.fn = e, this.sub = t;
403
+ }
404
+ notify(e, t) {
405
+ let n = this.fn;
406
+ if (n !== void 0) {
407
+ n(e, t);
408
+ return;
409
+ }
410
+ let r = this.sub;
411
+ r !== void 0 && r.execute();
412
+ }
413
+ }, T = new class {
273
414
  constructor() {
274
- this.enabled = !1, this.warnInfiniteLoop = o.WARN_INFINITE_LOOP;
415
+ this.current = null;
275
416
  }
276
- warn(e, t) {}
277
- attachDebugInfo(e, t, n) {}
278
- getDebugName(e) {
279
- if (e != null) return e[b];
417
+ run(e, t) {
418
+ if (this.current === e) return t();
419
+ let n = this.current;
420
+ this.current = e;
421
+ try {
422
+ return t();
423
+ } finally {
424
+ this.current = n;
425
+ }
280
426
  }
281
- getDebugType(e) {
282
- if (e != null) return e[x];
427
+ }();
428
+ function E(e) {
429
+ let t = T, n = t.current;
430
+ if (n === null) return e();
431
+ t.current = null;
432
+ try {
433
+ return e();
434
+ } finally {
435
+ t.current = n;
283
436
  }
284
- }(), ee = 1, w = () => ee++ | 0;
285
- function T(e, t, n) {
286
- return e instanceof m ? e : e instanceof Error ? new t(`${e.name || e.constructor.name || "Error"} (${n}): ${e.message}`, e) : new t(`Unexpected error (${n}): ${String(e)}`);
287
437
  }
288
- var te = class {
438
+ var ne = class {
289
439
  constructor() {
290
- this.flags = 0, this.version = 0, this._lastSeenEpoch = c.UNINITIALIZED, this._notifying = 0, this._hotIndex = -1, this._slots = null, this._deps = null, this.id = w() & l;
440
+ this.flags = 0, this.version = 0, this._lastSeenEpoch = c.UNINITIALIZED, this._notifying = 0, this._hotIndex = -1, this._slots = null, this._deps = null, this.id = x() & l;
291
441
  }
292
442
  get isDisposed() {
293
443
  return (this.flags & r.DISPOSED) !== 0;
@@ -300,9 +450,9 @@ var te = class {
300
450
  }
301
451
  subscribe(e) {
302
452
  let t = typeof e == "function";
303
- if (!t && (!e || typeof e.execute != "function")) throw T(/* @__PURE__ */ TypeError("Invalid subscriber"), m, v.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
453
+ if (!t && (!e || typeof e.execute != "function")) throw g(/* @__PURE__ */ TypeError("Invalid subscriber"), d, h.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);
304
454
  let n = this._slots;
305
- n || (n = new y(), this._slots = n);
455
+ n || (n = new S(), this._slots = n);
306
456
  let r = !1;
307
457
  if (n._s0 != null && (t ? n._s0.fn === e : n._s0.sub === e)) r = !0;
308
458
  else if (n._s1 != null && (t ? n._s1.fn === e : n._s1.sub === e)) r = !0;
@@ -319,7 +469,7 @@ var te = class {
319
469
  }
320
470
  }
321
471
  if (r) return () => {};
322
- let i = new p(t ? e : void 0, t ? void 0 : e);
472
+ let i = new te(t ? e : void 0, t ? void 0 : e);
323
473
  return n.add(i), () => this._unsubscribe(i);
324
474
  }
325
475
  _unsubscribe(e) {
@@ -371,7 +521,7 @@ var te = class {
371
521
  }
372
522
  }
373
523
  _logNotifyError(e) {
374
- console.error(T(e, m, v.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
524
+ console.error(g(e, d, h.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
375
525
  }
376
526
  _isDirty() {
377
527
  let e = this._deps;
@@ -381,34 +531,34 @@ var te = class {
381
531
  let n = e.getAt(t);
382
532
  if (n != null && n.node.version !== n.version) return !0;
383
533
  }
384
- return !e.hasComputeds && !e.isDirtyFast() ? !1 : this._deepDirtyCheck();
534
+ return this._deepDirtyCheck();
385
535
  }
386
- }, ne = 0;
387
- function re() {
388
- let e = ne + 1 & l;
389
- return ne = e === 0 ? 1 : e, ne;
536
+ }, re = /* @__PURE__ */ Symbol.for("atom-effect/atom"), ie = /* @__PURE__ */ Symbol.for("atom-effect/computed"), ae = /* @__PURE__ */ Symbol.for("atom-effect/effect"), oe = /* @__PURE__ */ Symbol.for("atom-effect/writable"), se = 0;
537
+ function ce() {
538
+ let e = se + 1 & l;
539
+ return se = e === 0 ? 1 : e, se;
390
540
  }
391
- function ie(e) {
541
+ function le(e) {
392
542
  let t = e + 1 & l;
393
543
  return t === 0 ? 1 : t;
394
544
  }
395
- var ae = 0, E = !1, oe = 0;
396
- function se() {
397
- return oe;
545
+ var ue = 0, de = !1, fe = 0;
546
+ function pe() {
547
+ return fe;
398
548
  }
399
- function ce() {
400
- return E ? !1 : (E = !0, oe = re(), ae = 0, !0);
549
+ function me() {
550
+ return de ? !1 : (de = !0, fe = ce(), ue = 0, !0);
401
551
  }
402
- function le() {
403
- E = !1;
552
+ function he() {
553
+ de = !1;
404
554
  }
405
- function ue() {
406
- if (!E) return 0;
407
- let e = ++ae;
555
+ function ge() {
556
+ if (!de) return 0;
557
+ let e = ++ue;
408
558
  if (e <= a.MAX_EXECUTIONS_PER_FLUSH) return e;
409
559
  throw Error(`[atom-effect] Infinite loop detected: flush execution count exceeded ${a.MAX_EXECUTIONS_PER_FLUSH}`);
410
560
  }
411
- var de = new class {
561
+ var D = new class {
412
562
  constructor() {
413
563
  this._queueBuffer = [[], []], this._bufferIndex = 0, this._size = 0, this._epoch = 0, this._isProcessing = !1, this._isFlushingSync = !1, this._batchDepth = 0, this._batchQueue = [], this._batchQueueSize = 0, this._maxFlushIterations = a.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
414
564
  }
@@ -434,19 +584,19 @@ var de = new class {
434
584
  _runLoop() {
435
585
  try {
436
586
  if (this._size === 0) return;
437
- let e = ce();
438
- this._drainQueue(), e && le();
587
+ let e = me();
588
+ this._drainQueue(), e && he();
439
589
  } finally {
440
590
  this._isProcessing = !1, this._size > 0 && this._batchDepth === 0 && this._flush();
441
591
  }
442
592
  }
443
593
  _flushSync() {
444
594
  this._isFlushingSync = !0;
445
- let e = ce();
595
+ let e = me();
446
596
  try {
447
597
  this._mergeBatchQueue(), this._drainQueue();
448
598
  } finally {
449
- this._isFlushingSync = !1, e && le();
599
+ this._isFlushingSync = !1, e && he();
450
600
  }
451
601
  }
452
602
  _mergeBatchQueue() {
@@ -477,14 +627,14 @@ var de = new class {
477
627
  try {
478
628
  typeof n == "function" ? n() : n.execute();
479
629
  } catch (e) {
480
- console.error(new _("Error occurred during scheduler execution", e));
630
+ console.error(new m("Error occurred during scheduler execution", e));
481
631
  }
482
632
  }
483
633
  t.length = 0;
484
634
  }
485
635
  _handleFlushOverflow() {
486
636
  let e = this._size + this._batchQueueSize, t = this._maxFlushIterations;
487
- console.error(new _(v.SCHEDULER_FLUSH_OVERFLOW(t, e))), this._size = 0;
637
+ console.error(new m(h.SCHEDULER_FLUSH_OVERFLOW(t, e))), this._size = 0;
488
638
  let n = this._bufferIndex;
489
639
  this._queueBuffer[n].length = 0, this._batchQueueSize = 0;
490
640
  let r = this.onOverflow;
@@ -499,36 +649,23 @@ var de = new class {
499
649
  this._batchDepth !== 0 && --this._batchDepth === 0 && this._flushSync();
500
650
  }
501
651
  setMaxFlushIterations(e) {
502
- if (e < a.MIN_FLUSH_ITERATIONS) throw new _(`Max flush iterations must be at least ${a.MIN_FLUSH_ITERATIONS}`);
652
+ if (e < a.MIN_FLUSH_ITERATIONS) throw new m(`Max flush iterations must be at least ${a.MIN_FLUSH_ITERATIONS}`);
503
653
  this._maxFlushIterations = e;
504
654
  }
505
- }(), fe = /* @__PURE__ */ Symbol.for("atom-effect/atom"), pe = /* @__PURE__ */ Symbol.for("atom-effect/computed"), me = /* @__PURE__ */ Symbol.for("atom-effect/effect"), he = /* @__PURE__ */ Symbol.for("atom-effect/writable"), D = new class {
506
- constructor() {
507
- this.current = null;
508
- }
509
- run(e, t) {
510
- let n = this.current;
511
- this.current = e;
512
- try {
513
- return t();
514
- } finally {
515
- this.current = n;
516
- }
517
- }
518
655
  }();
519
- function O(e) {
520
- let t = D, n = t.current;
521
- if (n === null) return e();
522
- t.current = null;
656
+ function _e(e) {
657
+ if (typeof e != "function") throw TypeError(h.BATCH_CALLBACK_MUST_BE_FUNCTION);
658
+ let t = D;
659
+ t.startBatch();
523
660
  try {
524
661
  return e();
525
662
  } finally {
526
- t.current = n;
663
+ t.endBatch();
527
664
  }
528
665
  }
529
- var ge = class extends te {
666
+ var ve = class extends ne {
530
667
  constructor(e, t) {
531
- super(), this[fe] = !0, this[he] = !0, this._value = e, t && (this.flags |= i.SYNC), C.attachDebugInfo(this, "atom", this.id);
668
+ super(), this[re] = !0, this[oe] = !0, this._value = e, t && (this.flags |= i.SYNC), y.attachDebugInfo(this, "atom", this.id);
532
669
  }
533
670
  get isNotificationScheduled() {
534
671
  return (this.flags & i.NOTIFICATION_SCHEDULED) !== 0;
@@ -537,16 +674,16 @@ var ge = class extends te {
537
674
  return (this.flags & i.SYNC) !== 0;
538
675
  }
539
676
  get value() {
540
- return D.current?.addDependency(this), this._value;
677
+ return T.current?.addDependency(this), this._value;
541
678
  }
542
679
  set value(e) {
543
680
  let t = this._value;
544
681
  if (Object.is(t, e)) return;
545
- this._value = e, this.version = ie(this.version);
682
+ this._value = e, this.version = le(this.version);
546
683
  let n = this.flags;
547
684
  if ((n & i.NOTIFICATION_SCHEDULED) !== 0) return;
548
685
  let r = this._slots;
549
- r == null || r.size === 0 || (this._pendingOldValue = t, this.flags = n | i.NOTIFICATION_SCHEDULED, (n & i.SYNC) !== 0 && !de.isBatching ? this._flushNotifications() : de.schedule(this));
686
+ r == null || r.size === 0 || (this._pendingOldValue = t, this.flags = n | i.NOTIFICATION_SCHEDULED, (n & i.SYNC) !== 0 && !D.isBatching ? this._flushNotifications() : D.schedule(this));
550
687
  }
551
688
  execute() {
552
689
  this._flushNotifications();
@@ -571,227 +708,60 @@ var ge = class extends te {
571
708
  this.dispose();
572
709
  }
573
710
  };
574
- function k(e, t = {}) {
575
- return new ge(e, t.sync ?? !1);
576
- }
577
- var _e = class extends y {
578
- constructor(...e) {
579
- super(...e), this._map = null, this._SCAN_THRESHOLD = 32, this.hasComputeds = !1, this._depsHash = 0;
580
- }
581
- prepareTracking() {
582
- this.hasComputeds = !1;
583
- }
584
- _onItemRemoved(e) {
585
- let t = e.unsub;
586
- t && t();
587
- }
588
- claimExisting(e, t) {
589
- let n = this._count;
590
- if (t >= n) return !1;
591
- let r = n - t;
592
- if (this._map !== null || r > this._SCAN_THRESHOLD) return this._claimViaMap(e, t);
593
- if (t < 4) switch (t) {
594
- case 0: {
595
- let t = this._s0;
596
- if (t && t.node === e && t.unsub) return t.version = e.version, !0;
597
- }
598
- case 1: if (n > 1) {
599
- let n = this._s1;
600
- if (n && n.node === e && n.unsub) return n.version = e.version, t !== 1 && (this._s1 = this._s0, this._s0 = n), !0;
601
- }
602
- case 2: if (n > 2) {
603
- let n = this._s2;
604
- if (n && n.node === e && n.unsub) {
605
- if (n.version = e.version, t !== 2) {
606
- let e = t === 0 ? this._s0 : this._s1;
607
- t === 0 ? this._s0 = n : this._s1 = n, this._s2 = e;
608
- }
609
- return !0;
610
- }
611
- }
612
- case 3: if (n > 3) {
613
- let n = this._s3;
614
- if (n && n.node === e && n.unsub) {
615
- if (n.version = e.version, t !== 3) {
616
- let e;
617
- t === 0 ? (e = this._s0, this._s0 = n) : t === 1 ? (e = this._s1, this._s1 = n) : (e = this._s2, this._s2 = n), this._s3 = e;
618
- }
619
- return !0;
620
- }
621
- }
622
- }
623
- let i = this._overflow;
624
- if (i) {
625
- let n = e.version, r = t > 4 ? t : 4, a = i.length;
626
- for (let o = r - 4; o < a; o++) {
627
- let r = i[o];
628
- if (r && r.node === e && r.unsub) return r.version = n, this._swapGeneral(o + 4, t, r), !0;
629
- }
630
- }
631
- return !1;
632
- }
633
- _claimViaMap(e, t) {
634
- let n = this._map;
635
- if (n === null) {
636
- n = this._map = /* @__PURE__ */ new Map();
637
- let e = this._count;
638
- if (t < 4) {
639
- let e = this._s0;
640
- t <= 0 && e?.unsub && n.set(e.node, 0);
641
- let r = this._s1;
642
- t <= 1 && r?.unsub && n.set(r.node, 1);
643
- let i = this._s2;
644
- t <= 2 && i?.unsub && n.set(i.node, 2);
645
- let a = this._s3;
646
- t <= 3 && a?.unsub && n.set(a.node, 3);
647
- }
648
- let r = this._overflow;
649
- if (r && e > 4) {
650
- let e = t > 4 ? t : 4, i = r.length;
651
- for (let t = e - 4; t < i; t++) {
652
- let e = r[t];
653
- e?.unsub && n.set(e.node, t + 4);
654
- }
655
- }
656
- }
657
- let r = n.get(e);
658
- if (r === void 0 || r < t) return !1;
659
- let i = this.getAt(r);
660
- if (i == null || !i.unsub) return !1;
661
- if (i.version = e.version, r !== t) {
662
- let a;
663
- a = t === 0 ? this._s0 : t === 1 ? this._s1 : t === 2 ? this._s2 : t === 3 ? this._s3 : this._overflow[t - 4] ?? null, this.setAt(t, i), this.setAt(r, a), a?.unsub && n.set(a.node, r), n.set(e, t);
664
- }
665
- return !0;
666
- }
667
- _swapGeneral(e, t, n) {
668
- if (e === t) return;
669
- let r;
670
- if (r = t === 0 ? this._s0 : t === 1 ? this._s1 : t === 2 ? this._s2 : t === 3 ? this._s3 : this._overflow[t - 4] ?? null, this.setAt(t, n), e === 0) this._s0 = r;
671
- else if (e === 1) this._s1 = r;
672
- else if (e === 2) this._s2 = r;
673
- else if (e === 3) this._s3 = r;
674
- else {
675
- let t = this._overflow;
676
- t[e - 4] = r;
677
- }
678
- }
679
- insertNew(e, t) {
680
- let n = this._count;
681
- if (e < n) {
682
- let t;
683
- t = e === 0 ? this._s0 : e === 1 ? this._s1 : e === 2 ? this._s2 : e === 3 ? this._s3 : this._overflow[e - 4] ?? null, t != null && (this._addToOverflow(t), this._map !== null && t.unsub && this._map.set(t.node, this._count - 1));
684
- }
685
- if (e === 0) this._s0 = t;
686
- else if (e === 1) this._s1 = t;
687
- else if (e === 2) this._s2 = t;
688
- else if (e === 3) this._s3 = t;
689
- else {
690
- let n = this._overflow;
691
- n || (n = [], this._overflow = n), n[e - 4] = t;
692
- }
693
- e >= n && (this._count = e + 1);
694
- }
695
- truncateFrom(e) {
696
- e >= this._count || (super.truncateFrom(e), this._map !== null && (this._map.clear(), this._map = null));
697
- }
698
- seal() {
699
- this._depsHash = this._calculateHash(!1);
700
- }
701
- isDirtyFast() {
702
- return this._calculateHash(!0) !== this._depsHash;
703
- }
704
- _calculateHash(e) {
705
- let t = this._count;
706
- if (t === 0) return 0;
707
- let n = u.VERSION_BITS, r = 0, i = this._s0;
708
- if (i != null) {
709
- let a = i.node, o = e ? a.version : i.version;
710
- r = r + (o << n) + a.id | 0;
711
- let s = this._s1;
712
- if (t > 1 && s != null) {
713
- let i = s.node, a = e ? i.version : s.version;
714
- r = r + (a << n) + i.id | 0;
715
- let o = this._s2;
716
- if (t > 2 && o != null) {
717
- let i = o.node, a = e ? i.version : o.version;
718
- r = r + (a << n) + i.id | 0;
719
- let s = this._s3;
720
- if (t > 3 && s != null) {
721
- let t = s.node, i = e ? t.version : s.version;
722
- r = r + (i << n) + t.id | 0;
723
- }
724
- }
725
- }
726
- }
727
- if (t > 4) {
728
- let t = this._overflow;
729
- for (let i = 0, a = t.length; i < a; i++) {
730
- let a = t[i], o = a.node, s = e ? o.version : a.version;
731
- r = r + (s << n) + o.id | 0;
732
- }
733
- }
734
- return r;
735
- }
736
- disposeAll() {
737
- this._count > 0 && this.truncateFrom(0), this.hasComputeds = !1;
738
- }
739
- remove(e) {
740
- throw Error("remove() is strictly prohibited in DepSlotBuffer to preserve sequential cache paths.");
741
- }
742
- compact() {}
743
- };
744
- function ve(e) {
745
- return typeof e == "object" && !!e && fe in e;
711
+ function O(e, t = {}) {
712
+ return new ve(e, t.sync ?? !1);
746
713
  }
747
714
  function ye(e) {
748
- return typeof e == "object" && !!e && pe in e;
715
+ return typeof e == "object" && !!e && re in e;
749
716
  }
750
717
  function be(e) {
718
+ return typeof e == "object" && !!e && ie in e;
719
+ }
720
+ function xe(e) {
751
721
  return typeof e == "object" && !!e && typeof e.then == "function";
752
722
  }
753
- var { IDLE: A, DIRTY: j, PENDING: M, RESOLVED: N, REJECTED: P, HAS_ERROR: xe, RECOMPUTING: F, DISPOSED: Se, IS_COMPUTED: I, FORCE_COMPUTE: Ce } = r, we = class extends te {
723
+ var { IDLE: k, DIRTY: A, PENDING: j, RESOLVED: M, REJECTED: N, HAS_ERROR: Se, RECOMPUTING: P, DISPOSED: Ce, IS_COMPUTED: we, FORCE_COMPUTE: Te } = r, Ee = class extends ne {
754
724
  constructor(e, t = {}) {
755
- if (typeof e != "function") throw new h(v.COMPUTED_MUST_BE_FUNCTION);
756
- if (super(), this[fe] = !0, this[pe] = !0, this._error = null, this._promiseId = 0, this._deps = new _e(), this._asyncRetryCount = 0, this._lastDriftEpoch = c.UNINITIALIZED, this._trackEpoch = c.UNINITIALIZED, this._trackCount = 0, this._value = void 0, this.flags = I | j | A, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : S, this._onError = t.onError ?? null, this._maxAsyncRetries = (t.maxAsyncRetries ?? s.MAX_ASYNC_RETRIES) & l, C.attachDebugInfo(this, "computed", this.id), t.lazy === !1) try {
725
+ if (typeof e != "function") throw new f(h.COMPUTED_MUST_BE_FUNCTION);
726
+ if (super(), this[re] = !0, this[ie] = !0, this._error = null, this._promiseId = 0, this._deps = new C(), this._trackEpoch = c.UNINITIALIZED, this._trackCount = 0, this._value = void 0, this.flags = we | A | k, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : v, this._onError = t.onError ?? null, y.attachDebugInfo(this, "computed", this.id), t.lazy === !1) try {
757
727
  this._recompute();
758
728
  } catch {}
759
729
  }
760
730
  get isDirty() {
761
- return (this.flags & j) !== 0;
731
+ return (this.flags & A) !== 0;
762
732
  }
763
733
  get isRejected() {
764
- return (this.flags & P) !== 0;
734
+ return (this.flags & N) !== 0;
765
735
  }
766
736
  get isRecomputing() {
767
- return (this.flags & F) !== 0;
737
+ return (this.flags & P) !== 0;
768
738
  }
769
739
  get _hasErrorInternal() {
770
- return (this.flags & xe) !== 0;
740
+ return (this.flags & Se) !== 0;
771
741
  }
772
742
  _track() {
773
- D.current?.addDependency(this);
743
+ T.current?.addDependency(this);
774
744
  }
775
745
  get value() {
776
- D.current?.addDependency(this);
746
+ T.current?.addDependency(this);
777
747
  let e = this.flags;
778
- if ((e & (N | j | A)) === N) return this._value;
779
- if ((e & Se) !== 0) throw new h(v.COMPUTED_DISPOSED);
780
- if ((e & F) !== 0) {
748
+ if ((e & (M | A | k)) === M) return this._value;
749
+ if ((e & Ce) !== 0) throw new f(h.COMPUTED_DISPOSED);
750
+ if ((e & P) !== 0) {
781
751
  let e = this._defaultValue;
782
- if (e !== S) return e;
783
- throw new h(v.COMPUTED_CIRCULAR_DEPENDENCY);
752
+ if (e !== v) return e;
753
+ throw new f(h.COMPUTED_CIRCULAR_DEPENDENCY);
784
754
  }
785
- if ((e & (j | A)) !== 0) {
755
+ if ((e & (A | k)) !== 0) {
786
756
  let t = this._deps;
787
- if ((e & A) === 0 && (e & Ce) === 0 && t.size > 0 && !this._isDirty() ? e = this.flags &= ~j : (this._recompute(), e = this.flags), (e & N) !== 0) return this._value;
757
+ if ((e & k) === 0 && (e & Te) === 0 && t.size > 0 && !this._isDirty() ? e = this.flags &= ~A : (this._recompute(), e = this.flags), (e & M) !== 0) return this._value;
788
758
  }
789
- let t = this._defaultValue, n = t !== S;
790
- if ((e & M) !== 0) {
759
+ let t = this._defaultValue, n = t !== v;
760
+ if ((e & j) !== 0) {
791
761
  if (n) return t;
792
- throw new h(v.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
762
+ throw new f(h.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
793
763
  }
794
- if ((e & P) !== 0) {
764
+ if ((e & N) !== 0) {
795
765
  if (n) return t;
796
766
  throw this._error;
797
767
  }
@@ -801,12 +771,12 @@ var { IDLE: A, DIRTY: j, PENDING: M, RESOLVED: N, REJECTED: P, HAS_ERROR: xe, RE
801
771
  return this._value;
802
772
  }
803
773
  get state() {
804
- D.current?.addDependency(this);
774
+ T.current?.addDependency(this);
805
775
  let e = this.flags;
806
- return (e & N) === 0 ? (e & M) === 0 ? (e & P) === 0 ? t.IDLE : t.REJECTED : t.PENDING : t.RESOLVED;
776
+ return (e & M) === 0 ? (e & j) === 0 ? (e & N) === 0 ? t.IDLE : t.REJECTED : t.PENDING : t.RESOLVED;
807
777
  }
808
778
  get hasError() {
809
- if (D.current?.addDependency(this), (this.flags & (P | xe)) !== 0) return !0;
779
+ if (T.current?.addDependency(this), (this.flags & (N | Se)) !== 0) return !0;
810
780
  let e = this._deps;
811
781
  if (!e.hasComputeds) return !1;
812
782
  let t = e.size;
@@ -817,9 +787,9 @@ var { IDLE: A, DIRTY: j, PENDING: M, RESOLVED: N, REJECTED: P, HAS_ERROR: xe, RE
817
787
  return !this.hasError;
818
788
  }
819
789
  get errors() {
820
- D.current?.addDependency(this);
790
+ T.current?.addDependency(this);
821
791
  let e = this._error, t = this._deps;
822
- if (!t.hasComputeds) return e == null ? d : Object.freeze([e]);
792
+ if (!t.hasComputeds) return e == null ? u : Object.freeze([e]);
823
793
  let n = [];
824
794
  e != null && n.push(e);
825
795
  let r = t.size;
@@ -827,9 +797,9 @@ var { IDLE: A, DIRTY: j, PENDING: M, RESOLVED: N, REJECTED: P, HAS_ERROR: xe, RE
827
797
  let r = t.getAt(e);
828
798
  if (r == null) continue;
829
799
  let i = r.node;
830
- (i.flags & I) !== 0 && i.hasError && this._collectErrorsFromDep(i, n);
800
+ (i.flags & we) !== 0 && i.hasError && this._collectErrorsFromDep(i, n);
831
801
  }
832
- return n.length === 0 ? d : Object.freeze(n);
802
+ return n.length === 0 ? u : Object.freeze(n);
833
803
  }
834
804
  _collectErrorsFromDep(e, t) {
835
805
  let n = e.errors, r = n.length;
@@ -839,19 +809,19 @@ var { IDLE: A, DIRTY: j, PENDING: M, RESOLVED: N, REJECTED: P, HAS_ERROR: xe, RE
839
809
  }
840
810
  }
841
811
  get lastError() {
842
- return D.current?.addDependency(this), this._error;
812
+ return T.current?.addDependency(this), this._error;
843
813
  }
844
814
  get isPending() {
845
- return D.current?.addDependency(this), (this.flags & M) !== 0;
815
+ return T.current?.addDependency(this), (this.flags & j) !== 0;
846
816
  }
847
817
  get isResolved() {
848
- return D.current?.addDependency(this), (this.flags & N) !== 0;
818
+ return T.current?.addDependency(this), (this.flags & M) !== 0;
849
819
  }
850
820
  invalidate() {
851
- this.flags |= Ce, this._markDirty();
821
+ this.flags |= Te, this._markDirty();
852
822
  }
853
823
  dispose() {
854
- (this.flags & Se) === 0 && (this._deps.disposeAll(), this._slots != null && this._slots.clear(), this.flags = Se | j | A, this._error = null, this._value = void 0, this._hotIndex = -1);
824
+ (this.flags & Ce) === 0 && (this._deps.disposeAll(), this._slots != null && this._slots.clear(), this.flags = Ce | A | k, this._error = null, this._value = void 0, this._hotIndex = -1);
855
825
  }
856
826
  [Symbol.dispose]() {
857
827
  this.dispose();
@@ -863,94 +833,87 @@ var { IDLE: A, DIRTY: j, PENDING: M, RESOLVED: N, REJECTED: P, HAS_ERROR: xe, RE
863
833
  let n = this._trackCount++, r = this._deps, i = r.getAt(n);
864
834
  if (i != null && i.node === e) i.version = e.version;
865
835
  else if (!r.claimExisting(e, n)) {
866
- let t = new f(e, e.version, e.subscribe(this));
836
+ let t = new w(e, e.version, e.subscribe(this));
867
837
  r.insertNew(n, t);
868
838
  }
869
- (e.flags & I) !== 0 && (r.hasComputeds = !0);
839
+ (e.flags & we) !== 0 && (r.hasComputeds = !0);
870
840
  }
871
841
  _recompute() {
872
842
  if (this.isRecomputing) return;
873
- this.flags = (this.flags | F) & ~Ce, this._trackEpoch = re(), this._trackCount = 0, this._deps.prepareTracking(), this._hotIndex = -1;
843
+ this.flags = (this.flags | P) & ~Te, this._trackEpoch = ce(), this._trackCount = 0, this._deps.prepareTracking(), this._hotIndex = -1;
874
844
  let e = !1;
875
845
  try {
876
- let t = D.run(this, this._fn);
877
- this._deps.truncateFrom(this._trackCount), this._deps.seal(), e = !0, be(t) ? this._handleAsyncComputation(t) : this._finalizeResolution(t);
846
+ let t = T.run(this, this._fn);
847
+ this._deps.truncateFrom(this._trackCount), e = !0, xe(t) ? this._handleAsyncComputation(t) : this._finalizeResolution(t);
878
848
  } catch (t) {
879
849
  if (!e) try {
880
850
  this._deps.truncateFrom(this._trackCount);
881
851
  } catch {}
882
- this._handleError(t, v.COMPUTED_COMPUTATION_FAILED, !0);
852
+ this._handleError(t, h.COMPUTED_COMPUTATION_FAILED, !0);
883
853
  } finally {
884
- this._trackEpoch = c.UNINITIALIZED, this._trackCount = 0, this.flags &= ~F;
854
+ this._trackEpoch = c.UNINITIALIZED, this._trackCount = 0, this.flags &= ~P;
885
855
  }
886
856
  }
887
857
  _handleAsyncComputation(e) {
888
- this.flags = (this.flags | M) & ~(A | j | N | P), this._notifySubscribers(void 0, void 0), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % s.MAX_PROMISE_ID;
858
+ this.flags = (this.flags | j) & ~(k | A | M | N), this._notifySubscribers(void 0, void 0), this._promiseId = (this._promiseId + 1) % s.MAX_PROMISE_ID;
889
859
  let t = this._promiseId;
890
860
  e.then((e) => {
891
861
  if (t === this._promiseId) {
892
- if (this._isDirty()) {
893
- let e = se();
894
- return this._lastDriftEpoch !== e && (this._lastDriftEpoch = e, this._asyncRetryCount = 0), this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(new h(`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`), v.COMPUTED_ASYNC_COMPUTATION_FAILED);
895
- }
862
+ if (this._isDirty()) return this._markDirty();
896
863
  this._finalizeResolution(e), this._notifySubscribers(e, void 0);
897
864
  }
898
- }, (e) => t === this._promiseId && this._handleError(e, v.COMPUTED_ASYNC_COMPUTATION_FAILED));
865
+ }, (e) => t === this._promiseId && this._handleError(e, h.COMPUTED_ASYNC_COMPUTATION_FAILED));
899
866
  }
900
867
  _handleError(e, t, n = !1) {
901
- let r = T(e, h, t);
902
- if (!n && !this.isRejected && (this.version = ie(this.version)), this._error = r, this.flags = this.flags & ~(A | j | M | N) | P | xe, this._onError) try {
868
+ let r = g(e, f, t);
869
+ if (!n && !this.isRejected && (this.version = le(this.version)), this._error = r, this.flags = this.flags & ~(k | A | j | M) | N | Se, this._onError) try {
903
870
  this._onError(r);
904
871
  } catch (e) {
905
- console.error(v.CALLBACK_ERROR_IN_ERROR_HANDLER, e);
872
+ console.error(h.CALLBACK_ERROR_IN_ERROR_HANDLER, e);
906
873
  }
907
874
  if (n) throw r;
908
875
  this._notifySubscribers(void 0, void 0);
909
876
  }
910
877
  _finalizeResolution(e) {
911
878
  let t = this.flags;
912
- ((t & N) === 0 || !this._equal(this._value, e)) && (this.version = ie(this.version)), this._value = e, this._error = null, this.flags = (t | N) & ~(A | j | M | P | xe);
879
+ ((t & M) === 0 || !this._equal(this._value, e)) && (this.version = le(this.version)), this._value = e, this._error = null, this.flags = (t | M) & ~(k | A | j | N | Se);
913
880
  }
914
881
  execute() {
915
882
  this._markDirty();
916
883
  }
917
884
  _markDirty() {
918
885
  let e = this.flags;
919
- (e & (F | j)) === 0 && (this.flags = e | j, this._notifySubscribers(void 0, void 0));
920
- }
921
- _isDirty() {
922
- let e = this._deps;
923
- return e.hasComputeds ? this._deepDirtyCheck() : e.isDirtyFast();
886
+ (e & (P | A)) === 0 && (this.flags = e | A, this._notifySubscribers(void 0, void 0));
924
887
  }
925
888
  _deepDirtyCheck() {
926
- let e = this._deps, t = D.current;
927
- D.current = null;
889
+ let e = this._deps, t = T.current;
890
+ T.current = null;
928
891
  try {
929
892
  let t = e.size;
930
893
  for (let n = 0; n < t; n++) {
931
894
  let t = e.getAt(n);
932
895
  if (t == null) continue;
933
896
  let r = t.node;
934
- if ((r.flags & I) !== 0) try {
897
+ if ((r.flags & we) !== 0) try {
935
898
  r.value;
936
899
  } catch {}
937
900
  if (r.version !== t.version) return this._hotIndex = n, !0;
938
901
  }
939
902
  return this._hotIndex = -1, !1;
940
903
  } finally {
941
- D.current = t;
904
+ T.current = t;
942
905
  }
943
906
  }
944
907
  };
945
- function L(e, t = {}) {
946
- return new we(e, t);
908
+ function F(e, t = {}) {
909
+ return new Ee(e, t);
947
910
  }
948
- var Te = class extends te {
911
+ var De = class extends ne {
949
912
  constructor(e, t = {}) {
950
- super(), this[me] = !0, this._cleanup = null, this._deps = new _e(), this._currentEpoch = c.UNINITIALIZED, this._lastFlushEpoch = c.UNINITIALIZED, this._fn = e, this._onError = t.onError ?? null, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? a.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? a.MAX_EXECUTIONS_PER_EFFECT, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._trackCount = 0, this._sync ? this._notifyCallback = () => this.execute() : this._notifyCallback = () => de.schedule(this), C.attachDebugInfo(this, "effect", this.id);
913
+ super(), this[ae] = !0, this._cleanup = null, this._deps = new C(), this._currentEpoch = c.UNINITIALIZED, this._lastFlushEpoch = c.UNINITIALIZED, this._fn = e, this._onError = t.onError ?? null, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? a.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? a.MAX_EXECUTIONS_PER_EFFECT, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._trackCount = 0, this._sync ? this._notifyCallback = () => this.execute() : this._notifyCallback = () => D.schedule(this), y.attachDebugInfo(this, "effect", this.id);
951
914
  }
952
915
  run() {
953
- if (this.isDisposed) throw new g(v.EFFECT_DISPOSED);
916
+ if (this.isDisposed) throw new p(h.EFFECT_DISPOSED);
954
917
  this.execute(!0);
955
918
  }
956
919
  dispose() {
@@ -986,13 +949,13 @@ var Te = class extends te {
986
949
  let n;
987
950
  try {
988
951
  let t = e.subscribe(this._notifyCallback);
989
- n = new f(e, e.version, t);
952
+ n = new w(e, e.version, t);
990
953
  } catch (t) {
991
- let r = T(t, g, v.EFFECT_EXECUTION_FAILED);
954
+ let r = g(t, p, h.EFFECT_EXECUTION_FAILED);
992
955
  if (console.error(r), this._onError) try {
993
956
  this._onError(r);
994
957
  } catch {}
995
- n = new f(e, e.version, void 0);
958
+ n = new w(e, e.version, void 0);
996
959
  }
997
960
  this._deps.insertNew(t, n);
998
961
  }
@@ -1001,11 +964,11 @@ var Te = class extends te {
1001
964
  if ((t & (n.DISPOSED | n.EXECUTING)) !== 0) return;
1002
965
  let r = this._deps;
1003
966
  if (!e && r.size > 0 && !this._isDirty()) return;
1004
- this._checkInfiniteLoops(), this.flags = t | n.EXECUTING, this._execCleanup(), this._currentEpoch = re(), this._trackCount = 0, r.prepareTracking(), this._hotIndex = -1;
967
+ this._checkInfiniteLoops(), this.flags = t | n.EXECUTING, this._execCleanup(), this._currentEpoch = ce(), this._trackCount = 0, r.prepareTracking(), this._hotIndex = -1;
1005
968
  let i = !1;
1006
969
  try {
1007
- let e = D.run(this, this._fn);
1008
- r.truncateFrom(this._trackCount), r.seal(), i = !0, be(e) ? this._handleAsyncResult(e) : this._cleanup = typeof e == "function" ? e : null;
970
+ let e = T.run(this, this._fn);
971
+ r.truncateFrom(this._trackCount), i = !0, xe(e) ? this._handleAsyncResult(e) : this._cleanup = typeof e == "function" ? e : null;
1009
972
  } catch (e) {
1010
973
  if (!i) try {
1011
974
  r.truncateFrom(this._trackCount);
@@ -1015,10 +978,6 @@ var Te = class extends te {
1015
978
  this.flags &= ~n.EXECUTING;
1016
979
  }
1017
980
  }
1018
- _isDirty() {
1019
- let e = this._deps;
1020
- return e.hasComputeds ? this._deepDirtyCheck() : e.isDirtyFast();
1021
- }
1022
981
  _handleAsyncResult(e) {
1023
982
  let t = ++this._execId;
1024
983
  e.then((e) => {
@@ -1026,7 +985,7 @@ var Te = class extends te {
1026
985
  if (typeof e == "function") try {
1027
986
  e();
1028
987
  } catch (e) {
1029
- this._handleExecutionError(e, v.EFFECT_CLEANUP_FAILED);
988
+ this._handleExecutionError(e, h.EFFECT_CLEANUP_FAILED);
1030
989
  }
1031
990
  return;
1032
991
  }
@@ -1034,8 +993,8 @@ var Te = class extends te {
1034
993
  }, (e) => t === this._execId && this._handleExecutionError(e));
1035
994
  }
1036
995
  _deepDirtyCheck() {
1037
- let e = D.current;
1038
- D.current = null;
996
+ let e = T.current;
997
+ T.current = null;
1039
998
  let t = this._deps;
1040
999
  try {
1041
1000
  let e = t.size;
@@ -1047,7 +1006,7 @@ var Te = class extends te {
1047
1006
  }
1048
1007
  return !1;
1049
1008
  } finally {
1050
- D.current = e;
1009
+ T.current = e;
1051
1010
  }
1052
1011
  }
1053
1012
  _tryPullComputed(e) {
@@ -1062,13 +1021,13 @@ var Te = class extends te {
1062
1021
  try {
1063
1022
  e();
1064
1023
  } catch (e) {
1065
- this._handleExecutionError(e, v.EFFECT_CLEANUP_FAILED);
1024
+ this._handleExecutionError(e, h.EFFECT_CLEANUP_FAILED);
1066
1025
  }
1067
1026
  }
1068
1027
  }
1069
1028
  _checkInfiniteLoops() {
1070
- let e = se();
1071
- this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), ue() > a.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
1029
+ let e = pe();
1030
+ this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), ge() > a.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
1072
1031
  }
1073
1032
  _checkFrequencyLimit() {
1074
1033
  if (!Number.isFinite(this._maxExecutions)) return;
@@ -1078,7 +1037,7 @@ var Te = class extends te {
1078
1037
  return;
1079
1038
  }
1080
1039
  if (++this._windowCount > this._maxExecutions) {
1081
- let e = new g(v.EFFECT_FREQUENCY_LIMIT_EXCEEDED);
1040
+ let e = new p(h.EFFECT_FREQUENCY_LIMIT_EXCEEDED);
1082
1041
  throw this.dispose(), this._handleExecutionError(e), e;
1083
1042
  }
1084
1043
  }
@@ -1089,37 +1048,76 @@ var Te = class extends te {
1089
1048
  return (this.flags & n.EXECUTING) !== 0;
1090
1049
  }
1091
1050
  _throwInfiniteLoopError(e) {
1092
- let t = new g(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${ae}`);
1051
+ let t = new p(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${ue}`);
1093
1052
  throw this.dispose(), console.error(t), t;
1094
1053
  }
1095
- _handleExecutionError(e, t = v.EFFECT_EXECUTION_FAILED) {
1096
- let n = T(e, g, t);
1054
+ _handleExecutionError(e, t = h.EFFECT_EXECUTION_FAILED) {
1055
+ let n = g(e, p, t);
1097
1056
  if (console.error(n), this._onError) try {
1098
1057
  this._onError(n);
1099
1058
  } catch (e) {
1100
- console.error(T(e, g, v.CALLBACK_ERROR_IN_ERROR_HANDLER));
1059
+ console.error(g(e, p, h.CALLBACK_ERROR_IN_ERROR_HANDLER));
1101
1060
  }
1102
1061
  }
1103
1062
  };
1104
- function R(e, t = {}) {
1105
- if (typeof e != "function") throw new g(v.EFFECT_MUST_BE_FUNCTION);
1106
- let n = new Te(e, t);
1063
+ function I(e, t = {}) {
1064
+ if (typeof e != "function") throw new p(h.EFFECT_MUST_BE_FUNCTION);
1065
+ let n = new De(e, t);
1107
1066
  return n.execute(), n;
1108
1067
  }
1109
- function Ee(e) {
1110
- if (typeof e != "function") throw TypeError(v.BATCH_CALLBACK_MUST_BE_FUNCTION);
1111
- let t = de;
1112
- t.startBatch();
1113
- try {
1114
- return e();
1115
- } finally {
1116
- t.endBatch();
1068
+ var Oe = /* @__PURE__ */ Symbol.for("atom-effect/atom"), ke = /* @__PURE__ */ Symbol.for("atom-effect/writable");
1069
+ function Ae(e, t, n, r) {
1070
+ if (n === t.length) return r;
1071
+ let i = t[n], a = typeof e == "object" && e ? e : {}, o = a[i], s = Ae(o, t, n + 1, r);
1072
+ if (Object.is(o, s)) return e;
1073
+ if (Array.isArray(a)) {
1074
+ let e = a.slice(), t = Number.parseInt(i, 10);
1075
+ return Number.isNaN(t) ? e[i] = s : e[t] = s, e;
1117
1076
  }
1077
+ return {
1078
+ ...a,
1079
+ [i]: s
1080
+ };
1118
1081
  }
1119
- //#endregion
1120
- //#region src/utils/index.ts
1121
- var z = (e) => ve(e), De = (e) => typeof e == "object" && !!e && typeof e.then == "function";
1122
- function B(e) {
1082
+ function L(e, t) {
1083
+ let n = e, r = t.length;
1084
+ for (let e = 0; e < r; e++) {
1085
+ if (n == null) return;
1086
+ n = n[t[e]];
1087
+ }
1088
+ return n;
1089
+ }
1090
+ function je(e, t) {
1091
+ let n = t.includes(".") ? t.split(".") : [t], r = /* @__PURE__ */ new Set(), i = () => {
1092
+ r.forEach((e) => e()), r.clear();
1093
+ };
1094
+ return {
1095
+ get value() {
1096
+ return L(e.value, n);
1097
+ },
1098
+ set value(t) {
1099
+ let r = e.peek(), i = Ae(r, n, 0, t);
1100
+ i !== r && (e.value = i);
1101
+ },
1102
+ peek: () => L(e.peek(), n),
1103
+ subscribe(t) {
1104
+ let i = e.subscribe((e, r) => {
1105
+ let i = L(e, n), a = L(r, n);
1106
+ Object.is(i, a) || t(i, a);
1107
+ });
1108
+ return r.add(i), () => {
1109
+ i(), r.delete(i);
1110
+ };
1111
+ },
1112
+ subscriberCount: () => r.size,
1113
+ dispose: i,
1114
+ [Symbol.dispose]: i,
1115
+ [Oe]: !0,
1116
+ [ke]: !0
1117
+ };
1118
+ }
1119
+ var Me = (e, t) => je(e, t), Ne = (e) => (t) => je(e, t), R = (e) => ye(e), Pe = (e) => typeof e == "object" && !!e && typeof e.then == "function";
1120
+ function Fe(e) {
1123
1121
  let t = e.localName, n = e.id;
1124
1122
  if (n) return `${t}#${n}`;
1125
1123
  let r = e.className;
@@ -1129,46 +1127,46 @@ function B(e) {
1129
1127
  }
1130
1128
  return t;
1131
1129
  }
1132
- var V = Object.prototype.hasOwnProperty;
1133
- function Oe(e, t) {
1130
+ var z = Object.prototype.hasOwnProperty;
1131
+ function Ie(e, t) {
1134
1132
  if (e === t) return !0;
1135
1133
  if (typeof e != "object" || !e || typeof t != "object" || !t) return !1;
1136
1134
  let n = e, r = t, i = 0;
1137
- for (let e in n) if (V.call(n, e)) {
1138
- if (!V.call(r, e) || n[e] !== r[e]) return !1;
1135
+ for (let e in n) if (z.call(n, e)) {
1136
+ if (!z.call(r, e) || n[e] !== r[e]) return !1;
1139
1137
  i++;
1140
1138
  }
1141
1139
  let a = 0;
1142
- for (let e in r) V.call(r, e) && a++;
1140
+ for (let e in r) z.call(r, e) && a++;
1143
1141
  return i === a;
1144
1142
  }
1145
1143
  //#endregion
1146
1144
  //#region src/constants.ts
1147
- var H = {
1145
+ var B = {
1148
1146
  ROUTE: "[atom-route]",
1149
1147
  BINDING: "[atom-binding]",
1150
1148
  LIST: "[atom-list]",
1151
1149
  MOUNT: "[atom-mount]"
1152
- }, U = Object.freeze({
1150
+ }, Le = Object.freeze({
1153
1151
  mode: "hash",
1154
1152
  basePath: "",
1155
1153
  autoBindLinks: !1,
1156
1154
  activeClass: "active"
1157
- }), ke = {
1155
+ }), Re = {
1158
1156
  EVENT: "input",
1159
1157
  DEBOUNCE: 0
1160
- }, Ae = { HIGHLIGHT_DURATION_MS: 500 }, je = new Set([
1158
+ }, ze = { HIGHLIGHT_DURATION_MS: 500 }, Be = new Set([
1161
1159
  "input",
1162
1160
  "select",
1163
1161
  "textarea"
1164
- ]), Me = new Set([
1162
+ ]), Ve = new Set([
1165
1163
  "innerHTML",
1166
1164
  "outerHTML",
1167
1165
  "srcdoc",
1168
1166
  "__proto__",
1169
1167
  "constructor",
1170
1168
  "prototype"
1171
- ]), W = {
1169
+ ]), V = {
1172
1170
  ROUTE: {
1173
1171
  NOT_FOUND: (e) => `Route "${e}" not found and no notFound route configured`,
1174
1172
  TEMPLATE_NOT_FOUND: (e) => `Template "${e}" not found`,
@@ -1196,34 +1194,24 @@ var H = {
1196
1194
  CLEANUP_ERROR: (e) => `Cleanup error${e ? ` in component <${e}>` : ""}`
1197
1195
  },
1198
1196
  CORE: { EFFECT_DISPOSE_ERROR: (e) => `Effect dispose error${e ? `: ${e}` : ""}` }
1199
- }, Ne = typeof window < "u", Pe = `${Ae.HIGHLIGHT_DURATION_MS / 1e3}s`;
1200
- function Fe() {
1201
- if (Ne && window.__ATOM_DEBUG__ === !0) return !0;
1197
+ }, He = typeof window < "u", Ue = `${ze.HIGHLIGHT_DURATION_MS / 1e3}s`;
1198
+ function We() {
1199
+ let e = globalThis;
1200
+ if (He && e.window?.__ATOM_DEBUG__ === !0) return !0;
1202
1201
  try {
1203
- if (globalThis.process?.env?.VITE_ATOM_DEBUG === "true") return !0;
1202
+ if (e.process?.env?.VITE_ATOM_DEBUG === "true") return !0;
1204
1203
  } catch {}
1205
1204
  return !1;
1206
1205
  }
1207
- var Ie = Fe(), G = new class {
1206
+ var H = new class {
1207
+ constructor() {
1208
+ this._enabled = !1, this._lastState = !1, this.log = () => {}, this.atomChanged = () => {}, this.domUpdated = () => {}, this.cleanup = () => {}, this._enabled = We(), this._lastState = this._enabled, this._applyMethods(this._enabled);
1209
+ }
1208
1210
  get enabled() {
1209
- return Ne && window.__ATOM_DEBUG__ === !0 || Ie;
1211
+ return this._enabled;
1210
1212
  }
1211
1213
  set enabled(e) {
1212
- Ie = e;
1213
- }
1214
- log(e, ...t) {
1215
- this.enabled && console.log(e, ...t);
1216
- }
1217
- atomChanged(e, t, n, r) {
1218
- this.enabled && console.log(`${e} Atom "${t ?? "anonymous"}" changed:`, n, "→", r);
1219
- }
1220
- domUpdated(e, t, n, r) {
1221
- if (!this.enabled) return;
1222
- let i = t instanceof Element ? t : t[0];
1223
- i?.isConnected && (console.log(`${e} DOM updated: ${B(i)}.${n} =`, r), Ue(i));
1224
- }
1225
- cleanup(e, t) {
1226
- this.enabled && console.log(`${e} Cleanup: ${t}`);
1214
+ this._enabled !== e && (this._enabled = e, this._applyMethods(e));
1227
1215
  }
1228
1216
  warn(e, t, ...n) {
1229
1217
  console.warn(`${e} ${t}`, ...n);
@@ -1231,112 +1219,64 @@ var Ie = Fe(), G = new class {
1231
1219
  error(e, t, n) {
1232
1220
  console.error(`${e} ${t}`, n);
1233
1221
  }
1234
- }(), Le = "atom-debug-highlight", Re = "data-atom-debug", ze = !1;
1235
- function Be() {
1236
- if (ze || !Ne) return;
1237
- if (document.querySelector(`style[${Re}]`)) {
1238
- ze = !0;
1222
+ _applyMethods(e) {
1223
+ e ? (this.log = (e, ...t) => console.log(e, ...t), this.atomChanged = (e, t, n, r) => console.log(`${e} Atom "${t ?? "anonymous"}" changed:`, n, "→", r), this.domUpdated = (e, t, n, r) => {
1224
+ let i = t instanceof Element ? t : t[0];
1225
+ i?.isConnected && (console.log(`${e} DOM updated: ${Fe(i)}.${n} =`, r), this._highlightElement(i));
1226
+ }, this.cleanup = (e, t) => console.log(`${e} Cleanup: ${t}`)) : (this.log = () => {}, this.atomChanged = () => {}, this.domUpdated = () => {}, this.cleanup = () => {});
1227
+ }
1228
+ _highlightElement(e) {
1229
+ if (!e.isConnected) return;
1230
+ Je();
1231
+ let t = Xe.get(e), n = Ye.get(e);
1232
+ t !== void 0 && cancelAnimationFrame(t), n !== void 0 && (clearTimeout(n), Ye.delete(e)), Xe.set(e, requestAnimationFrame(() => {
1233
+ Xe.delete(e), e.isConnected && (e.classList.add(Ge), Ye.set(e, setTimeout(() => {
1234
+ e.isConnected && e.classList.remove(Ge), Ye.delete(e);
1235
+ }, ze.HIGHLIGHT_DURATION_MS)));
1236
+ }));
1237
+ }
1238
+ }(), Ge = "atom-debug-highlight", Ke = "data-atom-debug", qe = !1;
1239
+ function Je() {
1240
+ if (qe || !He) return;
1241
+ if (document.querySelector(`style[${Ke}]`)) {
1242
+ qe = !0;
1239
1243
  return;
1240
1244
  }
1241
- let e = Object.assign(document.createElement("style"), { textContent: `.${Le}{outline:2px solid rgba(255,68,68,0.8);outline-offset:1px;transition:outline ${Pe} ease-out}` });
1242
- e.setAttribute(Re, ""), document.head.appendChild(e), ze = !0;
1243
- }
1244
- var Ve = /* @__PURE__ */ new WeakMap(), He = /* @__PURE__ */ new WeakMap();
1245
- function Ue(e) {
1246
- if (!G.enabled || !e.isConnected) return;
1247
- Be();
1248
- let t = He.get(e), n = Ve.get(e);
1249
- t !== void 0 && cancelAnimationFrame(t), n !== void 0 && (clearTimeout(n), Ve.delete(e)), He.set(e, requestAnimationFrame(() => {
1250
- He.delete(e), e.isConnected && (e.classList.add(Le), Ve.set(e, setTimeout(() => {
1251
- e.isConnected && e.classList.remove(Le), Ve.delete(e);
1252
- }, Ae.HIGHLIGHT_DURATION_MS)));
1253
- }));
1254
- }
1255
- //#endregion
1256
- //#region src/core/lens.ts
1257
- var We = Symbol.for("atom-effect/atom"), Ge = Symbol.for("atom-effect/writable");
1258
- function Ke(e, t, n, r) {
1259
- if (n === t.length) return r;
1260
- let i = t[n], a = typeof e == "object" && e ? e : {}, o = a[i], s = Ke(o, t, n + 1, r);
1261
- if (Object.is(o, s)) return e;
1262
- if (Array.isArray(a)) {
1263
- let e = a.slice(), t = Number.parseInt(i, 10);
1264
- return Number.isNaN(t) ? e[i] = s : e[t] = s, e;
1265
- }
1266
- return {
1267
- ...a,
1268
- [i]: s
1269
- };
1270
- }
1271
- function K(e, t) {
1272
- let n = e, r = t.length;
1273
- for (let e = 0; e < r; e++) {
1274
- if (n == null) return;
1275
- n = n[t[e]];
1276
- }
1277
- return n;
1278
- }
1279
- function qe(e, t) {
1280
- let n = t.includes(".") ? t.split(".") : [t], r = /* @__PURE__ */ new Set(), i = () => {
1281
- r.forEach((e) => e()), r.clear();
1282
- };
1283
- return {
1284
- get value() {
1285
- return K(e.value, n);
1286
- },
1287
- set value(t) {
1288
- let r = e.peek(), i = Ke(r, n, 0, t);
1289
- i !== r && (e.value = i);
1290
- },
1291
- peek: () => K(e.peek(), n),
1292
- subscribe(t) {
1293
- let i = e.subscribe((e, r) => {
1294
- let i = K(e, n), a = K(r, n);
1295
- Object.is(i, a) || t(i, a);
1296
- });
1297
- return r.add(i), () => {
1298
- i(), r.delete(i);
1299
- };
1300
- },
1301
- subscriberCount: () => r.size,
1302
- dispose: i,
1303
- [Symbol.dispose]: i,
1304
- [We]: !0,
1305
- [Ge]: !0
1306
- };
1245
+ let e = Object.assign(document.createElement("style"), { textContent: `.${Ge}{outline:2px solid rgba(255,68,68,0.8);outline-offset:1px;transition:outline ${Ue} ease-out}` });
1246
+ e.setAttribute(Ke, ""), document.head.appendChild(e), qe = !0;
1307
1247
  }
1308
- var Je = (e, t) => qe(e, t), Ye = (e) => (t) => qe(e, t);
1248
+ var Ye = /* @__PURE__ */ new WeakMap(), Xe = /* @__PURE__ */ new WeakMap();
1309
1249
  //#endregion
1310
1250
  //#region src/core/namespace.ts
1311
- function Xe(e, t) {
1312
- return k(e, t);
1251
+ function Ze(e, t) {
1252
+ return O(e, t);
1313
1253
  }
1314
- Object.defineProperty(Xe, "debug", {
1254
+ Object.defineProperty(Ze, "debug", {
1315
1255
  enumerable: !0,
1316
1256
  configurable: !0,
1317
- get: () => G.enabled,
1257
+ get: () => H.enabled,
1318
1258
  set: (e) => {
1319
- G.enabled = e;
1259
+ H.enabled = e;
1320
1260
  }
1321
1261
  });
1322
- var Ze = () => Promise.resolve();
1262
+ var Qe = () => Promise.resolve();
1323
1263
  e.extend({
1324
- atom: Xe,
1325
- computed: L,
1326
- effect: R,
1327
- batch: Ee,
1328
- untracked: O,
1329
- isAtom: ve,
1330
- isComputed: ye,
1331
- isReactive: z,
1332
- nextTick: Ze,
1333
- atomLens: qe,
1334
- composeLens: Je,
1335
- lensFor: Ye
1264
+ atom: Ze,
1265
+ computed: F,
1266
+ effect: I,
1267
+ batch: _e,
1268
+ untracked: E,
1269
+ isAtom: ye,
1270
+ isComputed: be,
1271
+ isReactive: R,
1272
+ nextTick: Qe,
1273
+ atomLens: je,
1274
+ composeLens: Me,
1275
+ lensFor: Ne
1336
1276
  });
1337
1277
  //#endregion
1338
- //#region src/utils/array-pool.ts
1339
- var Qe = class {
1278
+ //#region src/utils/pool.ts
1279
+ var $e = class {
1340
1280
  constructor(e = 50, t = 256) {
1341
1281
  this.limit = e, this.capacity = t, this.pool = [];
1342
1282
  }
@@ -1349,7 +1289,7 @@ var Qe = class {
1349
1289
  reset() {
1350
1290
  this.pool.length = 0;
1351
1291
  }
1352
- }, $e = class {
1292
+ }, et = class {
1353
1293
  constructor(e, t, n = 64) {
1354
1294
  this.factory = e, this.reset = t, this.limit = n, this.pool = [];
1355
1295
  }
@@ -1365,17 +1305,17 @@ var Qe = class {
1365
1305
  get size() {
1366
1306
  return this.pool.length;
1367
1307
  }
1368
- }, et = new Qe(), tt = new Qe(), nt = new $e(() => ({
1308
+ }, tt = new $e(), nt = new $e(), rt = new et(() => ({
1369
1309
  effects: void 0,
1370
1310
  cleanups: void 0,
1371
1311
  componentCleanup: void 0
1372
1312
  }), (e) => {
1373
1313
  e.effects = void 0, e.cleanups = void 0, e.componentCleanup = void 0;
1374
- }, 128), rt = !1;
1375
- function it() {
1376
- rt || (rt = !0, typeof document < "u" && document.body && ot(document.body));
1314
+ }, 128), it = !1;
1315
+ function at() {
1316
+ it || (it = !0, typeof document < "u" && document.body && ot(document.body));
1377
1317
  }
1378
- var q = "_aes-bound", J = new class {
1318
+ var U = "_aes-bound", W = new class {
1379
1319
  constructor() {
1380
1320
  this.records = /* @__PURE__ */ new WeakMap(), this.preservedNodes = /* @__PURE__ */ new WeakSet(), this.ignoredNodes = /* @__PURE__ */ new WeakSet();
1381
1321
  }
@@ -1392,17 +1332,17 @@ var q = "_aes-bound", J = new class {
1392
1332
  return this.ignoredNodes.has(e);
1393
1333
  }
1394
1334
  getOrCreateRecord(e) {
1395
- it();
1335
+ at();
1396
1336
  let t = this.records.get(e);
1397
- return t || (t = nt.acquire(), this.records.set(e, t), e.classList.add(q)), t;
1337
+ return t || (t = rt.acquire(), this.records.set(e, t), e.classList.add(U)), t;
1398
1338
  }
1399
1339
  trackEffect(e, t) {
1400
1340
  let n = this.getOrCreateRecord(e);
1401
- n.effects ||= et.acquire(), n.effects.push(t);
1341
+ n.effects ||= tt.acquire(), n.effects.push(t);
1402
1342
  }
1403
1343
  trackCleanup(e, t) {
1404
1344
  let n = this.getOrCreateRecord(e);
1405
- n.cleanups ||= tt.acquire(), n.cleanups.push(t);
1345
+ n.cleanups ||= nt.acquire(), n.cleanups.push(t);
1406
1346
  }
1407
1347
  setComponentCleanup(e, t) {
1408
1348
  this.getOrCreateRecord(e).componentCleanup = t;
@@ -1413,201 +1353,205 @@ var q = "_aes-bound", J = new class {
1413
1353
  cleanup(e) {
1414
1354
  let t = e.nodeType === 1, n = this.records.get(e);
1415
1355
  if (this.preservedNodes.delete(e), this.ignoredNodes.delete(e), !n) {
1416
- t && e.classList.remove(q);
1356
+ t && e.classList.remove(U);
1417
1357
  return;
1418
1358
  }
1419
- if (this.records.delete(e), t && e.classList.remove(q), G.enabled) {
1420
- let n = t ? B(e) : e.nodeName || "Node";
1421
- G.cleanup(H.BINDING, n);
1422
- }
1423
- let r = t ? B(e) : "Node";
1424
- if (n.componentCleanup) try {
1359
+ this.records.delete(e), t && e.classList.remove(U);
1360
+ let r = t ? Fe(e) : e.nodeName || "Node";
1361
+ if (H.cleanup(B.BINDING, r), n.componentCleanup) try {
1425
1362
  n.componentCleanup();
1426
1363
  } catch (e) {
1427
- G.error(H.MOUNT, W.MOUNT.CLEANUP_ERROR(r), e);
1364
+ H.error(B.MOUNT, V.MOUNT.CLEANUP_ERROR(r), e);
1428
1365
  }
1429
1366
  if (n.effects) {
1430
1367
  for (let e of n.effects) try {
1431
1368
  e.dispose();
1432
1369
  } catch (e) {
1433
- G.error(H.BINDING, W.CORE.EFFECT_DISPOSE_ERROR(r), e);
1370
+ H.error(B.BINDING, V.CORE.EFFECT_DISPOSE_ERROR(r), e);
1434
1371
  }
1435
- et.release(n.effects), n.effects = void 0;
1372
+ tt.release(n.effects), n.effects = void 0;
1436
1373
  }
1437
1374
  if (n.cleanups) {
1438
1375
  for (let e of n.cleanups) try {
1439
1376
  e();
1440
1377
  } catch (e) {
1441
- G.error(H.BINDING, W.BINDING.CLEANUP_ERROR(r), e);
1378
+ H.error(B.BINDING, V.BINDING.CLEANUP_ERROR(r), e);
1442
1379
  }
1443
- tt.release(n.cleanups), n.cleanups = void 0;
1380
+ nt.release(n.cleanups), n.cleanups = void 0;
1444
1381
  }
1445
- nt.release(n);
1382
+ rt.release(n);
1446
1383
  }
1447
1384
  cleanupDescendants(e) {
1448
- let t = e.getElementsByClassName ? e.getElementsByClassName(q) : e.querySelectorAll(`.${q}`), n = t.length;
1449
- if (n !== 0) for (let e = n - 1; e >= 0; e--) {
1450
- let n = t[e];
1451
- this.records.has(n) ? this.cleanup(n) : n.classList.remove(q);
1385
+ let t = e.getElementsByClassName ? e.getElementsByClassName(U) : e.querySelectorAll(`.${U}`), n = t.length;
1386
+ if (n === 0) return;
1387
+ let r = Array(n);
1388
+ for (let e = 0; e < n; e++) r[e] = t[e];
1389
+ for (let e = n - 1; e >= 0; e--) {
1390
+ let t = r[e];
1391
+ this.records.has(t) ? this.cleanup(t) : t.classList.remove(U);
1452
1392
  }
1453
1393
  }
1454
1394
  cleanupTree(e) {
1455
1395
  (e.nodeType === 1 || e.nodeType === 11) && this.cleanupDescendants(e), this.cleanup(e);
1456
1396
  }
1457
- }(), at = /* @__PURE__ */ new Map();
1397
+ }(), G = /* @__PURE__ */ new Map();
1458
1398
  function ot(e) {
1459
- if (at.has(e)) return;
1399
+ if (G.has(e)) return;
1460
1400
  let t = new MutationObserver((e) => {
1461
- let t = J;
1401
+ let t = W;
1462
1402
  for (let n = 0, r = e.length; n < r; n++) {
1463
1403
  let r = e[n].removedNodes;
1464
1404
  for (let e = 0, n = r.length; e < n; e++) {
1465
1405
  let n = r[e];
1466
- if (n.nodeType !== 1) continue;
1406
+ if (n.nodeType !== 1 || n.isConnected) continue;
1467
1407
  let i = n;
1468
- i.isConnected || t.isKept(i) || t.isIgnored(i) || t.cleanupTree(i);
1408
+ t.isKept(i) || t.isIgnored(i) || t.cleanupTree(i);
1469
1409
  }
1470
1410
  }
1471
1411
  });
1472
1412
  t.observe(e, {
1473
1413
  childList: !0,
1474
1414
  subtree: !0
1475
- }), at.set(e, t);
1415
+ }), G.set(e, t);
1476
1416
  }
1477
1417
  function st() {
1478
- at.forEach((e) => e.disconnect()), at.clear();
1418
+ G.forEach((e) => e.disconnect()), G.clear();
1479
1419
  }
1480
1420
  //#endregion
1481
1421
  //#region src/core/jquery-patch.ts
1482
- var ct = Symbol("atom-effect-internal"), lt = /* @__PURE__ */ new WeakMap(), Y = null, ut = (e) => {
1483
- if (e[ct]) return e;
1484
- let t = lt.get(e);
1422
+ var K = Symbol("atom-effect-internal"), q = /* @__PURE__ */ new WeakMap(), J = null, ct = (e) => {
1423
+ if (e[K]) return e;
1424
+ let t = q.get(e);
1485
1425
  return t || (t = function(...t) {
1486
- return Ee(() => e.apply(this, t));
1487
- }, t[ct] = !0, lt.set(e, t)), t;
1426
+ return _e(() => e.apply(this, t));
1427
+ }, t[K] = !0, q.set(e, t)), t;
1488
1428
  };
1489
- function dt(e) {
1429
+ function lt(e) {
1490
1430
  let t = {};
1491
- for (let n in e) e[n] && (t[n] = ut(e[n]));
1431
+ for (let n in e) e[n] && (t[n] = ct(e[n]));
1492
1432
  return t;
1493
1433
  }
1494
- function ft(e) {
1434
+ function ut(e) {
1495
1435
  let t = {};
1496
1436
  for (let n in e) {
1497
1437
  let r = e[n];
1498
- t[n] = r ? lt.get(r) ?? r : void 0;
1438
+ t[n] = r ? q.get(r) ?? r : void 0;
1499
1439
  }
1500
1440
  return t;
1501
1441
  }
1502
- function pt() {
1503
- if (Y !== null) return;
1504
- Y = {
1442
+ function dt() {
1443
+ if (J !== null) return;
1444
+ J = {
1505
1445
  on: e.fn.on,
1506
1446
  off: e.fn.off,
1507
1447
  remove: e.fn.remove,
1508
1448
  empty: e.fn.empty,
1509
1449
  detach: e.fn.detach
1510
1450
  };
1511
- let t = Y;
1451
+ let t = J;
1512
1452
  e.fn.remove = function(e) {
1513
1453
  let n = e ? this.filter(e) : this, r = n.length;
1514
1454
  for (let e = 0; e < r; e++) {
1515
1455
  let t = n[e];
1516
- t && (J.markIgnored(t), J.cleanupTree(t));
1456
+ t && (W.markIgnored(t), W.cleanupTree(t));
1517
1457
  }
1518
1458
  return t.remove.call(this, e) ?? this;
1519
1459
  }, e.fn.empty = function() {
1520
1460
  let e = this.length;
1521
1461
  for (let t = 0; t < e; t++) {
1522
1462
  let e = this[t];
1523
- e?.hasChildNodes() && J.cleanupDescendants(e);
1463
+ e?.hasChildNodes() && W.cleanupDescendants(e);
1524
1464
  }
1525
1465
  return t.empty.call(this) ?? this;
1526
1466
  }, e.fn.detach = function(e) {
1527
1467
  let n = e ? this.filter(e) : this, r = n.length;
1528
1468
  for (let e = 0; e < r; e++) {
1529
1469
  let t = n[e];
1530
- t && J.keep(t);
1470
+ t && W.keep(t);
1531
1471
  }
1532
1472
  return t.detach.call(this, e) ?? this;
1533
1473
  }, e.fn.on = function(...e) {
1534
1474
  let n = e[0];
1535
- if (n && typeof n == "object") e[0] = dt(n);
1475
+ if (n && typeof n == "object") e[0] = lt(n);
1536
1476
  else {
1537
1477
  let t = e.length - 1;
1538
- t >= 0 && typeof e[t] == "function" && (e[t] = ut(e[t]));
1478
+ t >= 0 && typeof e[t] == "function" && (e[t] = ct(e[t]));
1539
1479
  }
1540
1480
  return t.on.apply(this, e) ?? this;
1541
1481
  }, e.fn.off = function(...e) {
1542
1482
  let n = e[0];
1543
- if (n && typeof n == "object") e[0] = ft(n);
1483
+ if (n && typeof n == "object") e[0] = ut(n);
1544
1484
  else {
1545
1485
  let t = e.length - 1;
1546
1486
  if (t >= 0 && typeof e[t] == "function") {
1547
1487
  let n = e[t];
1548
- e[t] = lt.get(n) ?? n;
1488
+ e[t] = q.get(n) ?? n;
1549
1489
  }
1550
1490
  }
1551
1491
  return t.off.apply(this, e) ?? this;
1552
1492
  };
1553
1493
  }
1554
- function mt() {
1555
- Y !== null && (e.fn.on = Y.on, e.fn.off = Y.off, e.fn.remove = Y.remove, e.fn.empty = Y.empty, e.fn.detach = Y.detach, Y = null);
1494
+ function ft() {
1495
+ J !== null && (e.fn.on = J.on, e.fn.off = J.off, e.fn.remove = J.remove, e.fn.empty = J.empty, e.fn.detach = J.detach, J = null);
1556
1496
  }
1557
1497
  //#endregion
1558
1498
  //#region src/types.ts
1559
- var X = /* @__PURE__ */ function(e) {
1499
+ var Y = /* @__PURE__ */ function(e) {
1560
1500
  return e[e.None = 0] = "None", e[e.Focused = 1] = "Focused", e[e.Composing = 2] = "Composing", e[e.SyncingToAtom = 4] = "SyncingToAtom", e[e.SyncingToDom = 8] = "SyncingToDom", e[e.Busy = 14] = "Busy", e;
1561
- }({}), ht = 0;
1562
- function gt(e) {
1563
- e[ct] = !0;
1501
+ }({}), pt = 0;
1502
+ function mt(e) {
1503
+ e[K] = !0;
1564
1504
  }
1565
- var _t = class {
1505
+ var ht = class {
1566
1506
  constructor(e, t, n) {
1567
1507
  this.flags = 0, this.timeoutId = void 0, this.handleCompositionStart = () => {
1568
- this.flags |= X.Composing;
1508
+ this.flags |= Y.Composing;
1569
1509
  }, this.handleCompositionEnd = () => {
1570
- this.flags &= ~X.Composing, this.handleInput();
1510
+ this.flags &= ~Y.Composing, this.handleInput();
1571
1511
  }, this.handleFocus = () => {
1572
- this.flags |= X.Focused;
1512
+ this.flags |= Y.Focused;
1573
1513
  }, this.handleBlur = () => {
1574
- this.flags &= ~X.Focused;
1575
- let e = !!(this.flags & X.Composing);
1576
- this.flags &= ~X.Composing, this.flushPendingDebounce(), e && this.timeoutId === void 0 && this.syncAtomFromDom(), this.normalizeDomValue();
1514
+ this.flags &= ~Y.Focused;
1515
+ let e = !!(this.flags & Y.Composing);
1516
+ this.flags &= ~Y.Composing, this.flushPendingDebounce(), e && this.timeoutId === void 0 && this.syncAtomFromDom(), this.normalizeDomValue();
1577
1517
  }, this.syncDomFromAtom = () => {
1578
1518
  let e = this.atom.value;
1579
- O(() => {
1580
- let t = this.isMultipleSelect, n = this.format(e), r = t ? this.$el.val() || [] : this.el.value;
1581
- if (this.equal(r, e)) return;
1582
- let i = !!(this.flags & X.Focused);
1583
- if (i) try {
1584
- let n = t ? r : this.parse(this.el.value);
1519
+ E(() => {
1520
+ let t = this.format(e), n = this.getRawDom();
1521
+ if (this.isMultipleSelect) {
1585
1522
  if (this.equal(n, e)) return;
1523
+ } else if (n === t) return;
1524
+ if (this.flags & Y.Focused) try {
1525
+ if (this.equal(this.readDom(), e)) return;
1586
1526
  } catch {}
1587
- this.flags |= X.SyncingToDom;
1527
+ this.flags |= Y.SyncingToDom;
1588
1528
  try {
1589
- if (t) this.$el.val(e);
1590
- else if (i && this.isTextControl) try {
1591
- let e = this.el, t = e.selectionStart, r = e.selectionEnd;
1592
- e.value = n;
1593
- let i = n.length;
1594
- t !== null && r !== null && e.setSelectionRange(t < i ? t : i, r < i ? r : i);
1595
- } catch {
1596
- this.el.value = n;
1597
- }
1598
- else this.el.value = n;
1599
- G.enabled && G.domUpdated(H.BINDING, this.$el, "val", n);
1529
+ this.writeDom(e, t), H.domUpdated(B.BINDING, this.$el, "val", t);
1600
1530
  } finally {
1601
- this.flags &= ~X.SyncingToDom;
1531
+ this.flags &= ~Y.SyncingToDom;
1602
1532
  }
1603
1533
  });
1604
1534
  }, this.cleanup = () => {
1605
1535
  this.$el.off(this.ns), clearTimeout(this.timeoutId), this.timeoutId = void 0;
1606
1536
  }, this.$el = e, this.el = e[0], this.atom = t;
1607
1537
  let r = this.el.tagName, i = r === "SELECT" && this.el.multiple;
1608
- this.isMultipleSelect = i, this.isTextControl = r === "INPUT" || r === "TEXTAREA", this.ns = `.atomBind-${++ht}`;
1538
+ this.isMultipleSelect = i, this.isTextControl = r === "INPUT" || r === "TEXTAREA", this.ns = `.atomBind-${++pt}`;
1609
1539
  let a = n.debounce ?? 0;
1610
- this.parse = n.parse ?? ((e) => e), i ? this.format = n.format ?? ((e) => (Array.isArray(e) ? e : e ? [String(e)] : []).join(",")) : this.format = n.format ?? ((e) => String(e ?? ""));
1540
+ this.parse = n.parse ?? ((e) => e), i ? (this.format = n.format ?? ((e) => (Array.isArray(e) ? e : e ? [String(e)] : []).join(",")), this.getRawDom = () => this.$el.val() || [], this.readDom = () => this.getRawDom(), this.writeDom = (e) => {
1541
+ this.$el.val(e);
1542
+ }) : (this.format = n.format ?? ((e) => String(e ?? "")), this.getRawDom = () => this.el.value, this.readDom = () => this.parse(this.el.value), this.isTextControl ? this.writeDom = (e, t) => {
1543
+ if (this.flags & Y.Focused) try {
1544
+ let e = this.el, n = e.selectionStart, r = e.selectionEnd;
1545
+ e.value = t;
1546
+ let i = t.length;
1547
+ n !== null && r !== null && e.setSelectionRange(n < i ? n : i, r < i ? r : i);
1548
+ } catch {
1549
+ this.el.value = t;
1550
+ }
1551
+ else this.el.value = t;
1552
+ } : this.writeDom = (e, t) => {
1553
+ this.el.value = t;
1554
+ });
1611
1555
  let o = n.equal ?? Object.is;
1612
1556
  i ? this.equal = (e, t) => {
1613
1557
  if (o(e, t)) return !0;
@@ -1619,37 +1563,34 @@ var _t = class {
1619
1563
  }
1620
1564
  return !1;
1621
1565
  } : this.equal = o, a > 0 ? this.handleInput = () => {
1622
- this.flags & X.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), a));
1566
+ this.flags & Y.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), a));
1623
1567
  } : this.handleInput = () => {
1624
- this.flags & X.Composing || this.syncAtomFromDom();
1568
+ this.flags & Y.Composing || this.syncAtomFromDom();
1625
1569
  }, [
1626
1570
  this.handleFocus,
1627
1571
  this.handleBlur,
1628
1572
  this.handleCompositionStart,
1629
1573
  this.handleCompositionEnd,
1630
1574
  this.handleInput
1631
- ].forEach(gt), this.bindEvents(n.event ?? ke.EVENT);
1575
+ ].forEach(mt), this.bindEvents(n.event ?? Re.EVENT);
1632
1576
  }
1633
1577
  flushPendingDebounce() {
1634
1578
  this.timeoutId !== void 0 && (clearTimeout(this.timeoutId), this.timeoutId = void 0, this.syncAtomFromDom());
1635
1579
  }
1636
1580
  normalizeDomValue() {
1637
- let e = this.atom.peek(), t = this.format(e);
1638
- if (this.isMultipleSelect) {
1639
- let t = this.$el.val() || [], n = Array.isArray(e) ? e : [];
1640
- this.equal(t, n) || this.$el.val(n);
1641
- } else this.el.value !== t && (this.el.value = t);
1581
+ let e = this.atom.peek(), t = this.format(e), n = this.getRawDom();
1582
+ this.isMultipleSelect ? this.equal(n, e) || this.writeDom(e, t) : n !== t && this.writeDom(e, t);
1642
1583
  }
1643
1584
  syncAtomFromDom() {
1644
- if (!(this.flags & X.Busy)) {
1645
- this.flags |= X.SyncingToAtom;
1585
+ if (!(this.flags & Y.Busy)) {
1586
+ this.flags |= Y.SyncingToAtom;
1646
1587
  try {
1647
- let e = this.isMultipleSelect, t = e ? this.$el.val() || [] : this.el.value, n = e ? t : this.parse(t);
1648
- this.equal(this.atom.peek(), n) || (this.atom.value = n);
1588
+ let e = this.readDom();
1589
+ this.equal(this.atom.peek(), e) || (this.atom.value = e);
1649
1590
  } catch (e) {
1650
- G.warn(H.BINDING, W.BINDING.PARSE_ERROR(e instanceof Error ? e.message : String(e)), e);
1591
+ H.warn(B.BINDING, V.BINDING.PARSE_ERROR(e instanceof Error ? e.message : String(e)), e);
1651
1592
  } finally {
1652
- this.flags &= ~X.SyncingToAtom;
1593
+ this.flags &= ~Y.SyncingToAtom;
1653
1594
  }
1654
1595
  }
1655
1596
  }
@@ -1658,10 +1599,10 @@ var _t = class {
1658
1599
  this.$el.on(`focus${t}`, this.handleFocus).on(`blur${t}`, this.handleBlur).on(`compositionstart${t}`, this.handleCompositionStart).on(`compositionend${t}`, this.handleCompositionEnd).on(n, this.handleInput);
1659
1600
  }
1660
1601
  };
1661
- function vt(e, t, n) {
1662
- let r = new _t(e, t, n);
1602
+ function gt(e, t, n) {
1603
+ let r = new ht(e, t, n);
1663
1604
  return {
1664
- fx: R(r.syncDomFromAtom),
1605
+ fx: I(r.syncDomFromAtom),
1665
1606
  cleanup: () => {
1666
1607
  r &&= (r.cleanup(), null);
1667
1608
  }
@@ -1669,88 +1610,88 @@ function vt(e, t, n) {
1669
1610
  }
1670
1611
  //#endregion
1671
1612
  //#region src/core/effect-factory.ts
1672
- function yt(e, t, n, r) {
1613
+ function _t(e, t, n, r) {
1673
1614
  let i = null, a = (t) => {
1674
- if (!De(t)) {
1615
+ if (!Pe(t)) {
1675
1616
  i = null;
1676
1617
  try {
1677
- n(t), G.enabled && G.domUpdated(H.BINDING, e, r, t);
1618
+ n(t), H.domUpdated(B.BINDING, e, r, t);
1678
1619
  } catch (e) {
1679
- G.error(H.BINDING, W.BINDING.UPDATER_ERROR(r, !0), e);
1620
+ H.error(B.BINDING, V.BINDING.UPDATER_ERROR(r, !0), e);
1680
1621
  }
1681
1622
  return;
1682
1623
  }
1683
1624
  i = t, t.then((a) => {
1684
- i === t && O(() => {
1625
+ i === t && E(() => {
1685
1626
  try {
1686
- n(a), G.enabled && G.domUpdated(H.BINDING, e, `${r} (async)`, a);
1627
+ n(a), H.domUpdated(B.BINDING, e, `${r} (async)`, a);
1687
1628
  } catch (e) {
1688
- G.error(H.BINDING, W.BINDING.UPDATER_ERROR(r), e);
1629
+ H.error(B.BINDING, V.BINDING.UPDATER_ERROR(r), e);
1689
1630
  }
1690
1631
  });
1691
1632
  }).catch((e) => {
1692
- i === t && G.error(H.BINDING, W.BINDING.UPDATER_ERROR(r), e);
1633
+ i === t && H.error(B.BINDING, V.BINDING.UPDATER_ERROR(r), e);
1693
1634
  });
1694
- }, o = z(t);
1695
- o || typeof t == "function" ? J.trackEffect(e, R(() => {
1635
+ }, o = R(t);
1636
+ o || typeof t == "function" ? W.trackEffect(e, I(() => {
1696
1637
  let e = o ? t.value : t();
1697
- O(() => a(e));
1698
- }, { name: r })) : O(() => a(t));
1638
+ E(() => a(e));
1639
+ }, { name: r })) : E(() => a(t));
1699
1640
  }
1700
- function bt(e, t, n, r) {
1701
- let i = Object.keys(t), a = [], o = {};
1641
+ function X(e, t, n, r) {
1642
+ let i = Object.keys(t), a = [], o = [], s = [], c = {};
1702
1643
  for (let e = 0, n = i.length; e < n; e++) {
1703
- let n = i[e], r = t[n];
1704
- z(r) || typeof r == "function" ? a.push(n) : o[n] = r;
1644
+ let n = i[e], r = t[n], l = R(r);
1645
+ l || typeof r == "function" ? (a.push(n), o.push(r), s.push(l)) : c[n] = r;
1705
1646
  }
1706
- let s = 0, c = (t) => {
1707
- let a = [], o = {}, c = i.length;
1708
- for (let e = 0; e < c; e++) {
1647
+ let l = 0, u = (t) => {
1648
+ let a = [], o = {}, s = i.length;
1649
+ for (let e = 0; e < s; e++) {
1709
1650
  let n = i[e], r = t[n];
1710
- De(r) ? a.push(r.then((e) => ({
1651
+ Pe(r) ? a.push(r.then((e) => ({
1711
1652
  key: n,
1712
1653
  val: e
1713
1654
  }))) : o[n] = r;
1714
1655
  }
1715
- let l = a.length;
1716
- if (l > 0) {
1717
- let t = ++s;
1656
+ let c = a.length;
1657
+ if (c > 0) {
1658
+ let t = ++l;
1718
1659
  Promise.all(a).then((i) => {
1719
- if (t === s) {
1720
- for (let e = 0; e < l; e++) {
1660
+ if (t === l) {
1661
+ for (let e = 0; e < c; e++) {
1721
1662
  let t = i[e];
1722
1663
  o[t.key] = t.val;
1723
1664
  }
1724
- O(() => {
1665
+ E(() => {
1725
1666
  try {
1726
- n(o), G.enabled && G.domUpdated(H.BINDING, e, `${r} (async)`, o);
1667
+ n(o), H.domUpdated(B.BINDING, e, `${r} (async)`, o);
1727
1668
  } catch (e) {
1728
- G.error(H.BINDING, W.BINDING.UPDATER_ERROR(r), e);
1669
+ H.error(B.BINDING, V.BINDING.UPDATER_ERROR(r), e);
1729
1670
  }
1730
1671
  });
1731
1672
  }
1732
1673
  });
1733
1674
  } else {
1734
- s++;
1675
+ l++;
1735
1676
  try {
1736
- n(o), G.enabled && G.domUpdated(H.BINDING, e, r, o);
1677
+ n(o), H.domUpdated(B.BINDING, e, r, o);
1737
1678
  } catch (e) {
1738
- G.error(H.BINDING, W.BINDING.UPDATER_ERROR(r, !0), e);
1679
+ H.error(B.BINDING, V.BINDING.UPDATER_ERROR(r, !0), e);
1739
1680
  }
1740
1681
  }
1741
1682
  };
1742
- a.length > 0 ? J.trackEffect(e, R(() => {
1743
- let e = { ...o };
1744
- for (let n = 0, r = a.length; n < r; n++) {
1745
- let r = a[n], i = t[r];
1746
- e[r] = z(i) ? i.value : i();
1747
- }
1748
- O(() => c(e));
1749
- }, { name: r })) : O(() => c(o));
1683
+ a.length > 0 ? W.trackEffect(e, I(() => {
1684
+ let e = { ...c };
1685
+ for (let t = 0, n = a.length; t < n; t++) {
1686
+ let n = o[t];
1687
+ e[a[t]] = s[t] ? n.value : n();
1688
+ }
1689
+ E(() => u(e));
1690
+ }, { name: r })) : E(() => u(c));
1750
1691
  }
1751
1692
  //#endregion
1752
1693
  //#region src/utils/sanitize.ts
1753
- var xt = new Set([
1694
+ var vt = new Set([
1754
1695
  "href",
1755
1696
  "src",
1756
1697
  "action",
@@ -1765,99 +1706,115 @@ var xt = new Set([
1765
1706
  "usemap",
1766
1707
  "classid",
1767
1708
  "codebase"
1768
- ]), St = /^\s*(?:javascript|vbscript)\s*:/i, Ct = /(?:expression\s*\(|behavior\s*:|-moz-binding\s*:|(?:\\[0-9a-f]{1,6}\s*|[\s\x00-\x20/'"])*(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t|d\s*a\s*t\s*a)\s*:(?!image\/))/i, wt = /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i, Tt = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, Et = /&#x([0-9a-f]+);?|&#([0-9]+);?/gi, Dt = {
1709
+ ]), yt = /^\s*(?:javascript|vbscript)\s*:/i, bt = /(?:expression\s*\(|behavior\s*:|-moz-binding\s*:|(?:\\[0-9a-f]{1,6}\s*|[\s\x00-\x20/'"])*(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t|d\s*a\s*t\s*a)\s*:(?!image\/))/i, xt = /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i, St = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, Ct = /&#x([0-9a-f]+);?|&#([0-9]+);?/gi, wt = {
1769
1710
  colon: ":",
1770
1711
  Tab: " ",
1771
1712
  NewLine: "\n"
1772
- }, Ot = /&(colon|Tab|NewLine);/g, kt = /<\?[\s\S]*?\?>/g, At = /(<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*\/?>)/gi, jt = /(j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t)\s*:/gi, Mt = /data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi, Nt = /\bon\w+\s*=/gim, Pt = new RegExp(Ct.source, "gim");
1713
+ }, Tt = /&(colon|Tab|NewLine);/g, Et = /<\?[\s\S]*?\?>/g, Dt = /(<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*\/?>)/gi, Ot = /(j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t)\s*:/gi, kt = /data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi, At = /\bon\w+\s*=/gim, jt = new RegExp(bt.source, "gim");
1714
+ function Mt(e) {
1715
+ let t = e.length;
1716
+ for (let n = 0; n < t; n++) {
1717
+ let t = e.charCodeAt(n);
1718
+ if (t === 60 || t === 38 || t <= 31 && t !== 9 && t !== 10 && t !== 13) return !0;
1719
+ }
1720
+ if (e.indexOf(":") !== -1) return !0;
1721
+ let n = e.toLowerCase(), r = n.indexOf("on");
1722
+ if (r !== -1 && r < t - 2) {
1723
+ let e = n.charCodeAt(r + 2);
1724
+ if (e >= 97 && e <= 122) return !0;
1725
+ }
1726
+ return !1;
1727
+ }
1773
1728
  function Z(e) {
1774
1729
  if (!e) return "";
1775
- let t = String(e).replace(Tt, "").replace(Et, (e, t, n) => String.fromCodePoint(t ? parseInt(t, 16) : parseInt(n, 10))).replace(Ot, (e, t) => Dt[t] ?? "");
1776
- if (t.indexOf("<") !== -1) {
1777
- t = t.replace(kt, "");
1730
+ let t = String(e);
1731
+ if (!Mt(t)) return t;
1732
+ let n = t.replace(St, "").replace(Ct, (e, t, n) => String.fromCodePoint(t ? parseInt(t, 16) : parseInt(n, 10))).replace(Tt, (e, t) => wt[t] ?? "");
1733
+ if (n.indexOf("<") !== -1) {
1734
+ n = n.replace(Et, "");
1778
1735
  let e;
1779
1736
  do
1780
- e = t, t = t.replace(At, "");
1781
- while (t !== e);
1737
+ e = n, n = n.replace(Dt, "");
1738
+ while (n !== e);
1782
1739
  }
1783
- return t.replace(jt, "data-unsafe-protocol:").replace(Mt, "data-unsafe-protocol:").replace(Nt, "data-unsafe-attr=").replace(Pt, "data-unsafe-css:");
1740
+ return n.replace(Ot, "data-unsafe-protocol:").replace(kt, "data-unsafe-protocol:").replace(At, "data-unsafe-attr=").replace(jt, "data-unsafe-css:");
1741
+ }
1742
+ var Nt = (e) => e.length < 15 ? !1 : e.toLowerCase().includes("url(") && xt.test(e), Pt = /* @__PURE__ */ new Map();
1743
+ function Ft(e) {
1744
+ let t = Pt.get(e);
1745
+ return t === void 0 ? (t = e.includes("-") ? e.replace(/-./g, (e) => e[1].toUpperCase()) : e, Pt.set(e, t), t) : t;
1784
1746
  }
1785
- var Ft = (e) => e.length < 15 ? !1 : e.toLowerCase().includes("url(") && wt.test(e), It = /* @__PURE__ */ new Map();
1747
+ var It = /* @__PURE__ */ new WeakMap();
1786
1748
  function Lt(e) {
1787
1749
  let t = It.get(e);
1788
- return t === void 0 ? (t = e.includes("-") ? e.replace(/-./g, (e) => e[1].toUpperCase()) : e, It.set(e, t), t) : t;
1789
- }
1790
- var Rt = /* @__PURE__ */ new WeakMap();
1791
- function zt(e) {
1792
- let t = Rt.get(e);
1793
- return t || (t = L(() => {
1750
+ return t || (t = F(() => {
1794
1751
  let t = e.value;
1795
- return De(t) ? t.then((e) => Z(e)) : Z(t);
1796
- }), Rt.set(e, t)), t;
1752
+ return Pe(t) ? t.then((e) => Z(e)) : Z(t);
1753
+ }), It.set(e, t)), t;
1797
1754
  }
1798
- function Bt(e) {
1755
+ function Rt(e) {
1799
1756
  return {
1800
1757
  el: e,
1801
- trackCleanup: (t) => J.trackCleanup(e, t)
1758
+ trackCleanup: (t) => W.trackCleanup(e, t)
1802
1759
  };
1803
1760
  }
1804
- function Vt({ el: e }, t, n) {
1805
- yt(e, t, (t) => {
1761
+ function zt({ el: e }, t, n) {
1762
+ _t(e, t, (t) => {
1806
1763
  let r = n ? n(t) : String(t ?? "");
1807
1764
  e.textContent !== r && (e.textContent = r);
1808
1765
  }, "text");
1809
1766
  }
1810
- function Ht({ el: e }, t) {
1811
- let n = ve(t) ? zt(t) : t;
1812
- yt(e, n, (r) => {
1767
+ function Bt({ el: e }, t) {
1768
+ let n = ye(t) ? Lt(t) : t;
1769
+ _t(e, n, (r) => {
1813
1770
  let i = n === t ? Z(r) : r;
1814
- e.innerHTML !== i && (J.cleanupDescendants(e), e.innerHTML = i);
1771
+ e.innerHTML !== i && (W.cleanupDescendants(e), e.innerHTML = i);
1815
1772
  }, "html");
1816
1773
  }
1817
- function Ut({ el: e }, t) {
1774
+ function Vt({ el: e }, t) {
1818
1775
  let n = {};
1819
- for (let e in t) if (V.call(t, e)) {
1776
+ for (let e in t) if (z.call(t, e)) {
1820
1777
  let t = e.trim();
1821
1778
  n[e] = t.indexOf(" ") === -1 ? [t] : t.split(/\s+/).filter(Boolean);
1822
1779
  }
1823
- bt(e, t, (t) => {
1780
+ X(e, t, (t) => {
1824
1781
  for (let r in t) {
1825
1782
  let i = n[r];
1826
1783
  t[r] ? e.classList.add(...i) : e.classList.remove(...i);
1827
1784
  }
1828
1785
  }, "class");
1829
1786
  }
1830
- function Wt({ el: e }, t) {
1787
+ function Ht({ el: e }, t) {
1831
1788
  let n = e.style, r = {}, i = {};
1832
- for (let e in t) if (V.call(t, e)) {
1789
+ for (let e in t) if (z.call(t, e)) {
1833
1790
  let n = t[e], [a, o] = Array.isArray(n) ? n : [n, ""];
1834
1791
  r[e] = a, i[e] = {
1835
- camel: Lt(e),
1792
+ camel: Ft(e),
1836
1793
  unit: o
1837
1794
  };
1838
1795
  }
1839
- bt(e, r, (e) => {
1796
+ X(e, r, (e) => {
1840
1797
  for (let t in e) {
1841
1798
  let r = i[t], a = e[t], o = r.unit ? `${a}${r.unit}` : String(a), s = r.camel;
1842
- !Ft(o) && n[s] !== o && (n[s] = o);
1799
+ !Nt(o) && n[s] !== o && (n[s] = o);
1843
1800
  }
1844
1801
  }, "css");
1845
1802
  }
1846
- function Gt({ el: e }, t) {
1803
+ function Ut({ el: e }, t) {
1847
1804
  let n = {}, r = {}, i = {};
1848
1805
  for (let a in t) {
1849
- if (!V.call(t, a)) continue;
1806
+ if (!z.call(t, a)) continue;
1850
1807
  let o = a.toLowerCase();
1851
1808
  if (o.startsWith("on")) {
1852
- console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_EVENT_HANDLER(a)}`);
1809
+ console.warn(`${B.BINDING} ${V.SECURITY.BLOCKED_EVENT_HANDLER(a)}`);
1853
1810
  continue;
1854
1811
  }
1855
1812
  n[a] = t[a], r[a] = {
1856
1813
  isAria: o.startsWith("aria-"),
1857
- isUrl: xt.has(o)
1814
+ isUrl: vt.has(o)
1858
1815
  }, i[a] = e.getAttribute(a);
1859
1816
  }
1860
- bt(e, n, (t) => {
1817
+ X(e, n, (t) => {
1861
1818
  for (let n in t) {
1862
1819
  let a = r[n], o = t[n];
1863
1820
  if (o == null || o === !1 && !a.isAria) {
@@ -1865,129 +1822,175 @@ function Gt({ el: e }, t) {
1865
1822
  continue;
1866
1823
  }
1867
1824
  let s = o === !0 ? a.isAria ? "true" : n : String(o);
1868
- if (a.isUrl && St.test(s)) {
1869
- console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROTOCOL(n)}`);
1825
+ if (a.isUrl && yt.test(s)) {
1826
+ console.warn(`${B.BINDING} ${V.SECURITY.BLOCKED_PROTOCOL(n)}`);
1870
1827
  continue;
1871
1828
  }
1872
1829
  i[n] !== s && (e.setAttribute(n, s), i[n] = s);
1873
1830
  }
1874
1831
  }, "attr");
1875
1832
  }
1876
- function Kt(e, t) {
1833
+ function Wt(e, t) {
1877
1834
  let n = e.el, r = {}, i = {};
1878
1835
  for (let e in t) {
1879
- if (!V.call(t, e)) continue;
1836
+ if (!z.call(t, e)) continue;
1880
1837
  let n = e.toLowerCase();
1881
- if (n.startsWith("on") || Me.has(e)) {
1882
- console.warn(`${H.BINDING} ${n.startsWith("on") ? W.SECURITY.BLOCKED_EVENT_HANDLER(e) : W.SECURITY.BLOCKED_PROP(e)}`);
1838
+ if (n.startsWith("on") || Ve.has(e)) {
1839
+ console.warn(`${B.BINDING} ${n.startsWith("on") ? V.SECURITY.BLOCKED_EVENT_HANDLER(e) : V.SECURITY.BLOCKED_PROP(e)}`);
1883
1840
  continue;
1884
1841
  }
1885
- r[e] = t[e], i[e] = { isUrl: xt.has(n) };
1842
+ r[e] = t[e], i[e] = { isUrl: vt.has(n) };
1886
1843
  }
1887
- bt(e.el, r, (e) => {
1844
+ X(e.el, r, (e) => {
1888
1845
  for (let t in e) {
1889
1846
  let r = e[t];
1890
- if (i[t].isUrl && typeof r == "string" && St.test(r)) {
1891
- console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROTOCOL(t)}`);
1847
+ if (i[t].isUrl && typeof r == "string" && yt.test(r)) {
1848
+ console.warn(`${B.BINDING} ${V.SECURITY.BLOCKED_PROTOCOL(t)}`);
1892
1849
  continue;
1893
1850
  }
1894
1851
  n[t] !== r && (n[t] = r);
1895
1852
  }
1896
1853
  }, "prop");
1897
1854
  }
1898
- function qt({ el: e }, t, n) {
1855
+ function Gt({ el: e }, t, n) {
1899
1856
  let r = e.style.display === "none" ? "" : e.style.display;
1900
- yt(e, t, (t) => {
1857
+ _t(e, t, (t) => {
1901
1858
  let i = n === !!t ? "none" : r;
1902
1859
  e.style.display !== i && (e.style.display = i);
1903
1860
  }, n ? "hide" : "show");
1904
1861
  }
1905
- function Jt(t, n, r = {}) {
1862
+ function Kt(t, n, r = {}) {
1906
1863
  let i = t.el.tagName.toLowerCase();
1907
- if (!je.has(i)) {
1908
- console.warn(`${H.BINDING} ${W.BINDING.INVALID_INPUT_ELEMENT(i)}`);
1864
+ if (!Be.has(i)) {
1865
+ console.warn(`${B.BINDING} ${V.BINDING.INVALID_INPUT_ELEMENT(i)}`);
1909
1866
  return;
1910
1867
  }
1911
- let { fx: a, cleanup: o } = vt(e(t.el), n, r);
1912
- J.trackEffect(t.el, a), t.trackCleanup(o);
1868
+ let { fx: a, cleanup: o } = gt(e(t.el), n, r);
1869
+ W.trackEffect(t.el, a), t.trackCleanup(o);
1913
1870
  }
1914
- function Yt(t, n) {
1871
+ function qt(t, n) {
1915
1872
  let r = t.el, i = e(r), a = () => {
1916
1873
  n.peek() !== r.checked && (n.value = r.checked, r.type === "radio" && r.checked && r.name && (r.form ? e(r.form) : e(document)).find(`input[type="radio"][name="${r.name.replace(/"/g, "\\\"")}"]`).not(r).trigger("change.atomRadioSync"));
1917
1874
  };
1918
- a[ct] = !0, i.on("change change.atomRadioSync", a), t.trackCleanup(() => i.off("change change.atomRadioSync", a)), J.trackEffect(r, R(() => {
1875
+ a[K] = !0, i.on("change change.atomRadioSync", a), t.trackCleanup(() => i.off("change change.atomRadioSync", a)), W.trackEffect(r, I(() => {
1919
1876
  let e = !!n.value;
1920
- O(() => {
1921
- r.checked !== e && (r.checked = e, G.enabled && G.domUpdated(H.BINDING, r, "checked", e));
1877
+ E(() => {
1878
+ r.checked !== e && (r.checked = e, H.domUpdated(B.BINDING, r, "checked", e));
1922
1879
  });
1923
1880
  }));
1924
1881
  }
1925
- function Xt(t, n) {
1882
+ function Jt(t, n) {
1926
1883
  let r = e(t.el);
1927
1884
  r.on(n), t.trackCleanup(() => r.off(n));
1928
1885
  }
1929
- function Zt({ el: t, trackCleanup: n }, r, i) {
1886
+ function Yt({ el: t, trackCleanup: n }, r, i) {
1930
1887
  let a = e(t);
1931
1888
  a.on(r, i), n(() => a.off(r, i));
1932
1889
  }
1933
- function Qt(e) {
1934
- J.cleanupTree(e);
1890
+ function Xt(e) {
1891
+ W.cleanupTree(e);
1935
1892
  }
1936
1893
  //#endregion
1937
1894
  //#region src/bindings/form.ts
1938
- function $t(e, t, n = {}) {
1939
- let r = /* @__PURE__ */ new Map(), i = [], a = R(() => {
1940
- let e = t.value, n = i.length;
1941
- n !== 0 && O(() => {
1942
- for (let t = 0; t < n; t++) {
1943
- let n = i[t], r = K(e, n.parts);
1944
- Object.is(n.atom.peek(), r) || (n.atom.value = r);
1945
- }
1895
+ var Zt = "input, select, textarea", Qt = class {
1896
+ constructor(e, t, n = {}) {
1897
+ this.form = e, this.atom = t, this.options = n, this.fieldMap = /* @__PURE__ */ new Map(), this.fields = [], this.elementNames = /* @__PURE__ */ new WeakMap(), this.isSyncingFromLeaf = !1, this.init();
1898
+ }
1899
+ init() {
1900
+ let e = I(() => {
1901
+ let e = this.atom.value;
1902
+ this.isSyncingFromLeaf || !this.fields.length || _e(() => {
1903
+ E(() => {
1904
+ for (let t = 0; t < this.fields.length; t++) {
1905
+ let n = this.fields[t], r = L(e, n.parts);
1906
+ Object.is(n.atom.peek(), r) || (n.atom.value = r);
1907
+ }
1908
+ });
1909
+ });
1946
1910
  });
1947
- });
1948
- J.trackEffect(e, a);
1949
- let o = (n) => {
1950
- let a = r.get(n);
1951
- if (!a) {
1952
- let o = n.includes(".") ? n.split(".") : [n];
1953
- a = k(K(t.peek(), o)), i.push({
1954
- atom: a,
1955
- parts: o
1956
- }), J.trackEffect(e, R(() => {
1957
- let e = a.value, n = t.peek(), r = Ke(n, o, 0, e);
1958
- r !== n && (t.value = r);
1959
- })), r.set(n, a);
1960
- }
1961
- return a;
1962
- }, s = (e) => {
1963
- if (!(e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)) return;
1964
- let t = e.name;
1965
- if (!t || J.hasBind(e)) return;
1966
- let r = o(t), i = Bt(e);
1967
- e instanceof HTMLInputElement && (e.type === "checkbox" || e.type === "radio") ? Yt(i, r) : Jt(i, r, n);
1968
- };
1969
- for (let t = 0, n = e.elements.length; t < n; t++) s(e.elements[t]);
1970
- let c = new MutationObserver((e) => {
1971
- for (let t = 0, n = e.length; t < n; t++) {
1972
- let n = e[t];
1973
- if (n.type === "childList") for (let e = 0, t = n.addedNodes.length; e < t; e++) {
1974
- let t = n.addedNodes[e];
1975
- if (t.nodeType === 1) {
1976
- let e = t;
1977
- s(e);
1978
- let n = e.matches?.("input, select, textarea") ? [e] : e.querySelectorAll("input, select, textarea");
1979
- for (let e = 0, t = n.length; e < t; e++) s(n[e]);
1911
+ W.trackEffect(this.form, e), this.bindElement(this.form), this.setupObserver();
1912
+ }
1913
+ bindElement(e) {
1914
+ let t = e.matches?.(Zt) ? [e] : e.querySelectorAll?.(Zt) || [];
1915
+ for (let e = 0, n = t.length; e < n; e++) this.bindControl(t[e]);
1916
+ }
1917
+ bindControl(e) {
1918
+ if (!(e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement)) return;
1919
+ let t = e, n = t.name;
1920
+ if (!n) return;
1921
+ let r = this.elementNames.get(t);
1922
+ if (r !== void 0 && r !== n && W.cleanup(t), this.elementNames.has(t) && r === n) return;
1923
+ let i = this.acquireField(n);
1924
+ this.elementNames.set(t, n);
1925
+ let a = Rt(t);
1926
+ a.trackCleanup(() => this.releaseField(t, n)), t instanceof HTMLInputElement && (t.type === "radio" || t.type === "checkbox") ? this.bindToggle(a, i.atom, t.value, t.type === "checkbox") : Kt(a, i.atom, this.options);
1927
+ }
1928
+ bindToggle(t, n, r, i) {
1929
+ let a = t.el, o = () => {
1930
+ let e = n.peek();
1931
+ if (i && Array.isArray(e)) {
1932
+ let t = new Set(e.map(String));
1933
+ a.checked ? t.add(r) : t.delete(r), n.value = Array.from(t);
1934
+ } else n.value = i ? a.checked : r;
1935
+ };
1936
+ o[K] = !0, e(a).on("change", o), t.trackCleanup(() => e(a).off("change", o)), W.trackEffect(a, I(() => {
1937
+ let e = n.value, t = i ? Array.isArray(e) ? e.some((e) => String(e) === r) : !!e : String(e) === r;
1938
+ a.checked !== t && (a.checked = t);
1939
+ }));
1940
+ }
1941
+ acquireField(e) {
1942
+ let t = this.fieldMap.get(e);
1943
+ if (t) return t.refCount++, t;
1944
+ let n = e.replace(/\[(\w+)\]/g, ".$1").split(".").filter(Boolean), r = O(L(this.atom.peek(), n));
1945
+ return t = {
1946
+ atom: r,
1947
+ parts: n,
1948
+ name: e,
1949
+ refCount: 1,
1950
+ effect: null
1951
+ }, t.effect = I(() => {
1952
+ let t = r.value;
1953
+ this.options.transform && (t = this.options.transform(e, t));
1954
+ let i = this.atom.peek(), a = Ae(i, n, 0, t);
1955
+ if (a !== i) {
1956
+ this.isSyncingFromLeaf = !0;
1957
+ try {
1958
+ this.atom.value = a, this.options.onChange && E(() => this.options.onChange(e, t));
1959
+ } finally {
1960
+ this.isSyncingFromLeaf = !1;
1980
1961
  }
1981
1962
  }
1982
- else n.type === "attributes" && n.attributeName === "name" && s(n.target);
1963
+ }), this.fieldMap.set(e, t), this.fields.push(t), t;
1964
+ }
1965
+ releaseField(e, t) {
1966
+ let n = this.fieldMap.get(t);
1967
+ if (n && --n.refCount <= 0) {
1968
+ let e = this.fields.indexOf(n);
1969
+ e !== -1 && this.fields.splice(e, 1), n.effect?.dispose(), this.fieldMap.delete(t);
1983
1970
  }
1984
- });
1985
- c.observe(e, {
1986
- childList: !0,
1987
- subtree: !0,
1988
- attributes: !0,
1989
- attributeFilter: ["name"]
1990
- }), J.trackCleanup(e, () => c.disconnect());
1971
+ W.cleanup(e);
1972
+ }
1973
+ setupObserver() {
1974
+ let e = new MutationObserver((e) => {
1975
+ for (let t = 0, n = e.length; t < n; t++) {
1976
+ let n = e[t];
1977
+ if (n.type === "childList") for (let e = 0; e < n.addedNodes.length; e++) {
1978
+ let t = n.addedNodes[e];
1979
+ t.nodeType === 1 && this.bindElement(t);
1980
+ }
1981
+ else n.attributeName === "name" && this.bindElement(n.target);
1982
+ }
1983
+ });
1984
+ e.observe(this.form, {
1985
+ childList: !0,
1986
+ subtree: !0,
1987
+ attributes: !0,
1988
+ attributeFilter: ["name"]
1989
+ }), W.trackCleanup(this.form, () => e.disconnect());
1990
+ }
1991
+ };
1992
+ function $t(e, t, n = {}) {
1993
+ new Qt(e, t, n);
1991
1994
  }
1992
1995
  //#endregion
1993
1996
  //#region src/bindings/chainable.ts
@@ -1997,80 +2000,101 @@ function Q(e, t) {
1997
2000
  let n = e[r];
1998
2001
  if (n?.nodeType === 1) {
1999
2002
  let e = n;
2000
- t(Bt(e), e);
2001
- } else G.enabled && n && G.log(H.BINDING, `Skipping non-Element node (nodeType=${n.nodeType})`);
2003
+ t(Rt(e), e);
2004
+ } else n && H.log(B.BINDING, `Skipping non-Element node (nodeType=${n.nodeType})`);
2002
2005
  }
2003
2006
  return e;
2004
2007
  }
2005
2008
  e.fn.atomText = function(e, t) {
2006
- return Q(this, (n) => Vt(n, e, t));
2009
+ return Q(this, (n) => zt(n, e, t));
2007
2010
  }, e.fn.atomHtml = function(e) {
2008
- return Q(this, (t) => Ht(t, e));
2011
+ return Q(this, (t) => Bt(t, e));
2009
2012
  }, e.fn.atomClass = function(e, t) {
2010
2013
  if (typeof e == "string") {
2011
- if (t === void 0) return console.warn(`${H.BINDING} ${W.BINDING.MISSING_CONDITION("atomClass")}`), this;
2014
+ if (t === void 0) return console.warn(`${B.BINDING} ${V.BINDING.MISSING_CONDITION("atomClass")}`), this;
2012
2015
  let n = { [e]: t };
2013
- return Q(this, (e) => Ut(e, n));
2016
+ return Q(this, (e) => Vt(e, n));
2014
2017
  }
2015
- return Q(this, (t) => Ut(t, e));
2018
+ return Q(this, (t) => Vt(t, e));
2016
2019
  }, e.fn.atomCss = function(e, t, n) {
2017
2020
  if (typeof e == "string") {
2018
- if (t === void 0) return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE("atomCss")}`), this;
2021
+ if (t === void 0) return console.warn(`${B.BINDING} ${V.BINDING.MISSING_SOURCE("atomCss")}`), this;
2019
2022
  let r = { [e]: n ? [t, n] : t };
2020
- return Q(this, (e) => Wt(e, r));
2023
+ return Q(this, (e) => Ht(e, r));
2021
2024
  }
2022
- return Q(this, (t) => Wt(t, e));
2025
+ return Q(this, (t) => Ht(t, e));
2023
2026
  }, e.fn.atomAttr = function(e, t) {
2024
2027
  if (typeof e == "string") {
2025
- if (t === void 0) return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE("atomAttr")}`), this;
2028
+ if (t === void 0) return console.warn(`${B.BINDING} ${V.BINDING.MISSING_SOURCE("atomAttr")}`), this;
2026
2029
  let n = { [e]: t };
2027
- return Q(this, (e) => Gt(e, n));
2030
+ return Q(this, (e) => Ut(e, n));
2028
2031
  }
2029
- return Q(this, (t) => Gt(t, e));
2032
+ return Q(this, (t) => Ut(t, e));
2030
2033
  }, e.fn.atomProp = function(e, t) {
2031
2034
  if (typeof e == "string") {
2032
- if (t === void 0) return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE("atomProp")}`), this;
2035
+ if (t === void 0) return console.warn(`${B.BINDING} ${V.BINDING.MISSING_SOURCE("atomProp")}`), this;
2033
2036
  let n = { [e]: t };
2034
- return Q(this, (e) => Kt(e, n));
2037
+ return Q(this, (e) => Wt(e, n));
2035
2038
  }
2036
- return Q(this, (t) => Kt(t, e));
2039
+ return Q(this, (t) => Wt(t, e));
2037
2040
  }, e.fn.atomShow = function(e) {
2038
- return Q(this, (t) => qt(t, e, !1));
2041
+ return Q(this, (t) => Gt(t, e, !1));
2039
2042
  }, e.fn.atomHide = function(e) {
2040
- return Q(this, (t) => qt(t, e, !0));
2043
+ return Q(this, (t) => Gt(t, e, !0));
2041
2044
  }, e.fn.atomVal = function(e, t = {}) {
2042
- return Q(this, (n) => Jt(n, e, t));
2045
+ return Q(this, (n) => Kt(n, e, t));
2043
2046
  }, e.fn.atomChecked = function(e) {
2044
- return Q(this, (t) => Yt(t, e));
2047
+ return Q(this, (t) => qt(t, e));
2045
2048
  }, e.fn.atomForm = function(e, t = {}) {
2046
2049
  return Q(this, (n, r) => {
2047
2050
  r instanceof HTMLFormElement && $t(r, e, t);
2048
2051
  });
2049
2052
  }, e.fn.atomOn = function(e, t) {
2050
- return Q(this, (n) => Zt(n, e, t));
2051
- }, e.fn.atomBind = function(e) {
2052
- let { text: t, html: n, class: r, css: i, attr: a, prop: o, show: s, hide: c, val: l, checked: u, form: d, on: f } = e, p = l === void 0 ? null : Array.isArray(l) ? {
2053
- atom: l[0],
2054
- options: l[1]
2055
- } : {
2056
- atom: l,
2057
- options: void 0
2058
- };
2059
- return Q(this, (e) => {
2060
- t !== void 0 && Vt(e, t), n !== void 0 && Ht(e, n), r !== void 0 && Ut(e, r), i !== void 0 && Wt(e, i), a !== void 0 && Gt(e, a), o !== void 0 && Kt(e, o), s !== void 0 && qt(e, s, !1), c !== void 0 && qt(e, c, !0), p && Jt(e, p.atom, p.options), u !== void 0 && Yt(e, u), d !== void 0 && e.el instanceof HTMLFormElement && $t(e.el, d), f !== void 0 && Xt(e, f);
2053
+ return Q(this, (n) => Yt(n, e, t));
2054
+ };
2055
+ var en = [
2056
+ (e, t) => zt(e, t.text),
2057
+ (e, t) => Bt(e, t.html),
2058
+ (e, t) => Vt(e, t.class),
2059
+ (e, t) => Ht(e, t.css),
2060
+ (e, t) => Ut(e, t.attr),
2061
+ (e, t) => Wt(e, t.prop),
2062
+ (e, t) => Gt(e, t.show, !1),
2063
+ (e, t) => Gt(e, t.hide, !0),
2064
+ (e, t) => {
2065
+ let n = t.val;
2066
+ Array.isArray(n) ? Kt(e, n[0], n[1]) : Kt(e, n);
2067
+ },
2068
+ (e, t) => qt(e, t.checked),
2069
+ (e, t) => {
2070
+ if (e.el instanceof HTMLFormElement) {
2071
+ let n = t.form;
2072
+ Array.isArray(n) ? $t(e.el, n[0], n[1]) : $t(e.el, n);
2073
+ }
2074
+ },
2075
+ (e, t) => Jt(e, t.on)
2076
+ ];
2077
+ e.fn.atomBind = function(e) {
2078
+ let t = 0;
2079
+ return e.text !== void 0 && (t |= 1), e.html !== void 0 && (t |= 2), e.class !== void 0 && (t |= 4), e.css !== void 0 && (t |= 8), e.attr !== void 0 && (t |= 16), e.prop !== void 0 && (t |= 32), e.show !== void 0 && (t |= 64), e.hide !== void 0 && (t |= 128), e.val !== void 0 && (t |= 256), e.checked !== void 0 && (t |= 512), e.form !== void 0 && (t |= 1024), e.on !== void 0 && (t |= 2048), t === 0 ? this : Q(this, (n) => {
2080
+ let r = t;
2081
+ for (; r > 0;) {
2082
+ let t = r & -r;
2083
+ en[31 - Math.clz32(t)](n, e), r ^= t;
2084
+ }
2061
2085
  });
2062
2086
  }, e.fn.atomUnbind = function() {
2063
2087
  let e = this.length;
2064
2088
  for (let t = 0; t < e; t++) {
2065
2089
  let e = this[t];
2066
- e?.nodeType === 1 && Qt(e);
2090
+ e?.nodeType === 1 && Xt(e);
2067
2091
  }
2068
2092
  return this;
2069
2093
  };
2070
2094
  //#endregion
2071
2095
  //#region src/bindings/list.ts
2072
- var en = /* @__PURE__ */ new WeakMap(), tn = 0, nn = new $e(() => /* @__PURE__ */ new Map(), (e) => e.clear()), rn = new $e(() => /* @__PURE__ */ new Set(), (e) => e.clear()), $ = new Qe(100, 1024);
2073
- function an(e, t, n) {
2096
+ var tn = /* @__PURE__ */ new WeakMap(), nn = 0, rn = new et(() => /* @__PURE__ */ new Map(), (e) => e.clear()), an = new et(() => /* @__PURE__ */ new Set(), (e) => e.clear()), $ = new $e(100, 1024);
2097
+ function on(e, t, n) {
2074
2098
  if (e instanceof Element) {
2075
2099
  n.insertBefore(e, t);
2076
2100
  return;
@@ -2081,16 +2105,16 @@ function an(e, t, n) {
2081
2105
  r && n.insertBefore(r, t);
2082
2106
  }
2083
2107
  }
2084
- function on(t) {
2108
+ function sn(t) {
2085
2109
  return t instanceof Element ? e(t) : t;
2086
2110
  }
2087
- var sn = class {
2111
+ var cn = class {
2088
2112
  constructor(e, t, n) {
2089
2113
  this.$container = e, this.containerSelector = t, this.onRemove = n, this.oldKeys = [], this.oldItems = [], this.oldNodes = [], this.removingKeys = /* @__PURE__ */ new Set(), this.$emptyEl = null, this.keyToIndex = /* @__PURE__ */ new Map(), this.statesBuffer = new Uint8Array(256), this.indicesBuffer = new Int32Array(256);
2090
2114
  }
2091
2115
  scheduleRemoval(e, t) {
2092
2116
  let n = () => {
2093
- this.fx?.isDisposed || (t[0]?.isConnected && t.remove(), this.removingKeys.delete(e), G.enabled && G.log(H.LIST, `${this.containerSelector} removed item:`, e));
2117
+ this.fx?.isDisposed || (t[0]?.isConnected && t.remove(), this.removingKeys.delete(e), H.log(B.LIST, `${this.containerSelector} removed item:`, e));
2094
2118
  }, r = this.onRemove?.(t);
2095
2119
  r instanceof Promise ? r.then(n, n) : n();
2096
2120
  }
@@ -2105,12 +2129,12 @@ var sn = class {
2105
2129
  this.statesBuffer.length < e && (this.statesBuffer = new Uint8Array(Math.max(e, this.statesBuffer.length * 2))), this.indicesBuffer.length < e && (this.indicesBuffer = new Int32Array(Math.max(e, this.indicesBuffer.length * 2)));
2106
2130
  }
2107
2131
  };
2108
- function cn(t, n, r, i) {
2132
+ function ln(t, n, r, i) {
2109
2133
  if (t.$emptyEl && n > 0 && (t.$emptyEl.remove(), t.$emptyEl = null), n !== 0) return;
2110
2134
  let { oldKeys: a, oldNodes: o, onRemove: s } = t;
2111
2135
  if (s) for (let e = 0, n = a.length; e < n; e++) {
2112
2136
  let n = a[e];
2113
- o[e] && t.removeItem(n, on(o[e]));
2137
+ o[e] && t.removeItem(n, sn(o[e]));
2114
2138
  }
2115
2139
  else {
2116
2140
  for (let e = 0, n = a.length; e < n; e++) t.removingKeys.delete(a[e]);
@@ -2118,8 +2142,8 @@ function cn(t, n, r, i) {
2118
2142
  }
2119
2143
  i && !t.$emptyEl && (t.$emptyEl = e(typeof i == "string" ? Z(i) : i), t.$emptyEl.appendTo(r)), $.release(t.oldKeys), $.release(t.oldItems), $.release(t.oldNodes), t.oldKeys = [], t.oldItems = [], t.oldNodes = [];
2120
2144
  }
2121
- function ln(e, t, n, r, i, a) {
2122
- let { oldKeys: o, oldItems: s, oldNodes: c, removingKeys: l, keyToIndex: u } = e, d = o.length, f = 0, p = d - 1, m = n - 1, h = a || Oe;
2145
+ function un(e, t, n, r, i, a) {
2146
+ let { oldKeys: o, oldItems: s, oldNodes: c, removingKeys: l, keyToIndex: u } = e, d = o.length, f = 0, p = d - 1, m = n - 1, h = a || Ie;
2123
2147
  for (; f <= p && f <= m;) {
2124
2148
  let e = t[f], n = r(e, f);
2125
2149
  if (o[f] !== n || !h(s[f], e)) break;
@@ -2130,50 +2154,50 @@ function ln(e, t, n, r, i, a) {
2130
2154
  if (o[p] !== n || !h(s[p], e)) break;
2131
2155
  u.set(n, m--), p--;
2132
2156
  }
2133
- let g = nn.acquire();
2157
+ let g = rn.acquire();
2134
2158
  for (let e = f; e <= p; e++) g.set(o[e], e);
2135
- let _ = rn.acquire();
2159
+ let ee = an.acquire();
2136
2160
  e.ensureBuffers(n);
2161
+ let _ = $.acquire();
2162
+ _.length = n;
2137
2163
  let v = $.acquire();
2138
2164
  v.length = n;
2139
2165
  let y = $.acquire();
2140
2166
  y.length = n;
2141
- let b = $.acquire();
2142
- b.length = n;
2143
- let x = e.statesBuffer, S = e.indicesBuffer, C = $.acquire(), ee = $.acquire(), w = $.acquire();
2144
- for (let e = 0; e < f; e++) v[e] = o[e], y[e] = t[e], b[e] = c[e], x[e] = 3, S[e] = e;
2145
- for (let e = d - 1, r = n - 1; r > m; r--, e--) v[r] = o[e], y[r] = t[r], b[r] = c[e], x[r] = 3, S[r] = e;
2167
+ let b = e.statesBuffer, x = e.indicesBuffer, S = $.acquire(), C = $.acquire(), w = $.acquire();
2168
+ for (let e = 0; e < f; e++) _[e] = o[e], v[e] = t[e], y[e] = c[e], b[e] = 3, x[e] = e;
2169
+ for (let e = d - 1, r = n - 1; r > m; r--, e--) _[r] = o[e], v[r] = t[r], y[r] = c[e], b[r] = 3, x[r] = e;
2146
2170
  for (let n = f; n <= m; n++) {
2147
2171
  let o = t[n], d = r(o, n);
2148
- if (v[n] = d, y[n] = o, u.set(d, n), _.has(d)) {
2149
- G.warn(H.LIST, W.LIST.DUPLICATE_KEY(d, n, e.containerSelector)), S[n] = -1;
2172
+ if (_[n] = d, v[n] = o, u.set(d, n), ee.has(d)) {
2173
+ H.warn(B.LIST, V.LIST.DUPLICATE_KEY(d, n, e.containerSelector)), x[n] = -1;
2150
2174
  continue;
2151
2175
  }
2152
- _.add(d);
2176
+ ee.add(d);
2153
2177
  let f = g.get(d);
2154
2178
  if (f === void 0) {
2155
- C.push(d), ee.push(o), w.push(n), S[n] = -1, x[n] = 1;
2179
+ S.push(d), C.push(o), w.push(n), x[n] = -1, b[n] = 1;
2156
2180
  continue;
2157
2181
  }
2158
2182
  let p = s[f];
2159
- b[n] = c[f], !i && p !== o && !(a ? a(p, o) : Oe(p, o)) ? (C.push(d), ee.push(o), w.push(n), x[n] = 2) : x[n] = 0, S[n] = l.has(d) ? -1 : f;
2160
- }
2161
- return nn.release(g), {
2162
- newKeys: v,
2163
- newKeySet: _,
2164
- newItems: y,
2165
- newNodes: b,
2166
- newStates: x,
2167
- newIndices: S,
2168
- trKeys: C,
2169
- trItems: ee,
2183
+ y[n] = c[f], !i && p !== o && !(a ? a(p, o) : Ie(p, o)) ? (S.push(d), C.push(o), w.push(n), b[n] = 2) : b[n] = 0, x[n] = l.has(d) ? -1 : f;
2184
+ }
2185
+ return rn.release(g), {
2186
+ newKeys: _,
2187
+ newKeySet: ee,
2188
+ newItems: v,
2189
+ newNodes: y,
2190
+ newStates: b,
2191
+ newIndices: x,
2192
+ trKeys: S,
2193
+ trItems: C,
2170
2194
  trIdxs: w,
2171
2195
  startIndex: f,
2172
2196
  oldEndIndex: p,
2173
2197
  newEndIndex: m
2174
2198
  };
2175
2199
  }
2176
- function un(t, n, r) {
2200
+ function dn(t, n, r) {
2177
2201
  let { trKeys: i, trItems: a, trIdxs: o, newNodes: s, newStates: c } = t, l = i.length, u = Array(l), d = [], f = 0;
2178
2202
  for (let e = 0; e < l; e++) {
2179
2203
  let t = n.render(a[e], o[e]);
@@ -2182,7 +2206,7 @@ function un(t, n, r) {
2182
2206
  let p = null;
2183
2207
  if (d.length > 0) if (d.length === 1) p = [Z(d[0])];
2184
2208
  else {
2185
- let e = `<template data-atom-sep="${(tn++).toString(36)}"></template>`;
2209
+ let e = `<template data-atom-sep="${(nn++).toString(36)}"></template>`;
2186
2210
  p = Z(d.join(e)).split(e);
2187
2211
  }
2188
2212
  if (r && p && f === l && !n.bind && !n.onAdd && !n.onRemove && !n.events) return p;
@@ -2195,30 +2219,30 @@ function un(t, n, r) {
2195
2219
  }
2196
2220
  if (c[a] === 2 && s[a]) {
2197
2221
  let e = s[a];
2198
- if (e instanceof Element) J.cleanupTree(e);
2222
+ if (e instanceof Element) W.cleanupTree(e);
2199
2223
  else for (let t = 0, n = e.length; t < n; t++) {
2200
2224
  let n = e[t];
2201
- n instanceof Element && J.cleanupTree(n);
2225
+ n instanceof Element && W.cleanupTree(n);
2202
2226
  }
2203
- on(e).replaceWith(r);
2227
+ sn(e).replaceWith(r);
2204
2228
  }
2205
2229
  s[a] = r.length === 1 ? r[0] : r;
2206
2230
  }
2207
2231
  return null;
2208
2232
  }
2209
- function dn(e, t) {
2233
+ function fn(e, t) {
2210
2234
  let { startIndex: n, oldEndIndex: r, newKeySet: i } = t;
2211
2235
  for (let t = n; t <= r; t++) {
2212
2236
  let n = e.oldKeys[t];
2213
- !i.has(n) && e.oldNodes[t] && e.removeItem(n, on(e.oldNodes[t]));
2237
+ !i.has(n) && e.oldNodes[t] && e.removeItem(n, sn(e.oldNodes[t]));
2214
2238
  }
2215
2239
  }
2216
- function fn(t, n, r, i, a) {
2240
+ function pn(t, n, r, i, a) {
2217
2241
  let { newKeys: o, newItems: s, newNodes: c, newStates: l, newIndices: u } = n, d = o.length;
2218
2242
  if (a !== null) {
2219
2243
  r.innerHTML = a.join("");
2220
2244
  let n = r.firstElementChild;
2221
- for (let r = 0; r < d && n; r++) n.setAttribute("data-atom-key", String(o[r])), c[r] = n, l[r] = 0, t.removingKeys.delete(o[r]), G.enabled && G.domUpdated(H.LIST, e(n), "list.add", s[r]), n = n.nextElementSibling;
2245
+ for (let r = 0; r < d && n; r++) n.setAttribute("data-atom-key", String(o[r])), c[r] = n, l[r] = 0, t.removingKeys.delete(o[r]), H.domUpdated(B.LIST, e(n), "list.add", s[r]), n = n.nextElementSibling;
2222
2246
  return;
2223
2247
  }
2224
2248
  if (t.oldKeys.length === 0) {
@@ -2233,7 +2257,7 @@ function fn(t, n, r, i, a) {
2233
2257
  let e = null, t = 2147483647;
2234
2258
  for (let n = d - 1; n >= 0; n--) {
2235
2259
  let i = u[n];
2236
- i !== -1 && i < t ? t = i : an(c[n], e, r);
2260
+ i !== -1 && i < t ? t = i : on(c[n], e, r);
2237
2261
  let a = c[n];
2238
2262
  e = a instanceof Element ? a : a[0] ?? null;
2239
2263
  }
@@ -2241,8 +2265,8 @@ function fn(t, n, r, i, a) {
2241
2265
  for (let e = 0; e < d; e++) {
2242
2266
  let n = l[e];
2243
2267
  if (n !== 3) {
2244
- let r = on(c[e]), a = s[e];
2245
- n === 0 ? i.update?.(r, a, e) : i.bind?.(r, a, e), n === 1 && (i.onAdd?.(r), t.removingKeys.delete(o[e]), G.enabled && G.domUpdated(H.LIST, r, "list.add", a));
2268
+ let r = sn(c[e]), a = s[e];
2269
+ n === 0 ? i.update?.(r, a, e) : i.bind?.(r, a, e), n === 1 && (i.onAdd?.(r), t.removingKeys.delete(o[e]), H.domUpdated(B.LIST, r, "list.add", a));
2246
2270
  }
2247
2271
  }
2248
2272
  }
@@ -2257,20 +2281,20 @@ e.fn.atomList = function(t, n) {
2257
2281
  for (let a = 0, o = this.length; a < o; a++) {
2258
2282
  let o = this[a], s = e(o);
2259
2283
  s.off(".atomList");
2260
- let c = en.get(o);
2284
+ let c = tn.get(o);
2261
2285
  c && (c.fx.dispose(), c.ctx.dispose());
2262
- let l = new sn(s, B(o), n.onRemove), u = R(() => {
2286
+ let l = new cn(s, Fe(o), n.onRemove), u = I(() => {
2263
2287
  let e = t.value, a = e.length;
2264
- O(() => {
2265
- if (cn(l, a, s, n.empty), a === 0) return;
2266
- G.enabled && G.log(H.LIST, `${l.containerSelector} updating with ${a} items`);
2267
- let t = ln(l, e, a, r, n.update, n.isEqual), c = un(t, n, l.oldKeys.length === 0);
2268
- if (dn(l, t), fn(l, t, o, i, c), n.events) for (let e = t.startIndex; e <= t.oldEndIndex; e++) t.newKeySet.has(l.oldKeys[e]) || l.keyToIndex.delete(l.oldKeys[e]);
2269
- $.release(l.oldKeys), $.release(l.oldItems), $.release(l.oldNodes), l.oldKeys = t.newKeys, l.oldItems = t.newItems, l.oldNodes = t.newNodes, rn.release(t.newKeySet), $.release(t.trKeys), $.release(t.trItems), $.release(t.trIdxs);
2288
+ E(() => {
2289
+ if (ln(l, a, s, n.empty), a === 0) return;
2290
+ H.log(B.LIST, `${l.containerSelector} updating with ${a} items`);
2291
+ let t = un(l, e, a, r, n.update, n.isEqual), c = dn(t, n, l.oldKeys.length === 0);
2292
+ if (fn(l, t), pn(l, t, o, i, c), n.events) for (let e = t.startIndex; e <= t.oldEndIndex; e++) t.newKeySet.has(l.oldKeys[e]) || l.keyToIndex.delete(l.oldKeys[e]);
2293
+ $.release(l.oldKeys), $.release(l.oldItems), $.release(l.oldNodes), l.oldKeys = t.newKeys, l.oldItems = t.newItems, l.oldNodes = t.newNodes, an.release(t.newKeySet), $.release(t.trKeys), $.release(t.trItems), $.release(t.trIdxs);
2270
2294
  });
2271
2295
  });
2272
2296
  if (l.fx = u, n.events) for (let e in n.events) {
2273
- if (!V.call(n.events, e)) continue;
2297
+ if (!z.call(n.events, e)) continue;
2274
2298
  let t = e.indexOf(" "), r = t === -1 ? e : e.slice(0, t), i = t === -1 ? "> *" : e.slice(t + 1).trim(), a = n.events[e];
2275
2299
  s.on(`${r}.atomList`, i, function(e) {
2276
2300
  let t = e.target.closest?.("[data-atom-key]"), n = t?.getAttribute("data-atom-key");
@@ -2284,29 +2308,29 @@ e.fn.atomList = function(t, n) {
2284
2308
  i !== void 0 && a.call(t, l.oldItems[i], i, e);
2285
2309
  });
2286
2310
  }
2287
- J.trackEffect(o, u), en.set(o, {
2311
+ W.trackEffect(o, u), tn.set(o, {
2288
2312
  fx: u,
2289
2313
  ctx: l
2290
- }), J.trackCleanup(o, () => {
2291
- l.dispose(), en.delete(o);
2314
+ }), W.trackCleanup(o, () => {
2315
+ l.dispose(), tn.delete(o);
2292
2316
  });
2293
2317
  }
2294
2318
  return this;
2295
2319
  };
2296
2320
  //#endregion
2297
2321
  //#region src/bindings/mount.ts
2298
- var pn = Object.freeze({});
2322
+ var mn = Object.freeze({});
2299
2323
  e.fn.atomMount = function(t, n) {
2300
- let r = n ?? pn, i = t.name || "Component";
2324
+ let r = n ?? mn, i = t.name || "Component";
2301
2325
  for (let n = 0, a = this.length; n < a; n++) {
2302
2326
  let a = this[n];
2303
2327
  if (a) {
2304
- J.cleanupTree(a);
2328
+ W.cleanupTree(a);
2305
2329
  try {
2306
- let n = O(() => t(e(a), r));
2307
- typeof n == "function" && J.setComponentCleanup(a, n);
2330
+ let n = E(() => t(e(a), r));
2331
+ typeof n == "function" && W.setComponentCleanup(a, n);
2308
2332
  } catch (e) {
2309
- G.error(H.MOUNT, W.MOUNT.ERROR(i), e);
2333
+ H.error(B.MOUNT, V.MOUNT.ERROR(i), e);
2310
2334
  }
2311
2335
  }
2312
2336
  }
@@ -2314,42 +2338,42 @@ e.fn.atomMount = function(t, n) {
2314
2338
  }, e.fn.atomUnmount = function() {
2315
2339
  for (let e = 0, t = this.length; e < t; e++) {
2316
2340
  let t = this[e];
2317
- t && Qt(t);
2341
+ t && Xt(t);
2318
2342
  }
2319
2343
  return this;
2320
2344
  };
2321
2345
  //#endregion
2322
2346
  //#region src/features/route.ts
2323
- function mn(e, t) {
2347
+ function hn(e, t) {
2324
2348
  try {
2325
2349
  history.pushState(e, "", t);
2326
2350
  } catch (e) {
2327
- G.warn(H.ROUTE, "PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.", e);
2351
+ H.warn(B.ROUTE, "PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.", e);
2328
2352
  }
2329
2353
  }
2330
- var hn = class {
2354
+ var gn = class {
2331
2355
  constructor(t) {
2332
2356
  this.isDestroyed = !1, this.previousRoute = "", this.cleanups = [], this.templateCache = /* @__PURE__ */ new Map(), this.routeCleanups = [], this.lastRawQuery = "", this.cachedParams = {}, this.config = {
2333
- mode: U.mode,
2334
- basePath: U.basePath,
2335
- autoBindLinks: U.autoBindLinks,
2336
- activeClass: U.activeClass,
2357
+ mode: Le.mode,
2358
+ basePath: Le.basePath,
2359
+ autoBindLinks: Le.autoBindLinks,
2360
+ activeClass: Le.activeClass,
2337
2361
  ...t
2338
- }, this.isHistoryMode = this.config.mode === "history", this.basePath = this.config.basePath.replace(/\/$/, ""), this.activeClass = this.config.activeClass, this.$target = e(this.config.target), this.previousUrl = this.isHistoryMode ? location.pathname + location.search : location.hash, this.currentRouteAtom = k(this.getRouteName()), this.currentRoute = this.currentRouteAtom, this.queryParamsAtom = k(this.getQueryParams()), this.queryParams = L(() => this.queryParamsAtom.value), this.init();
2362
+ }, this.isHistoryMode = this.config.mode === "history", this.basePath = this.config.basePath.replace(/\/$/, ""), this.activeClass = this.config.activeClass, this.$target = e(this.config.target), this.previousUrl = this.isHistoryMode ? location.pathname + location.search : location.hash, this.currentRouteAtom = O(this.getRouteName()), this.currentRoute = this.currentRouteAtom, this.queryParamsAtom = O(this.getQueryParams()), this.queryParams = F(() => this.queryParamsAtom.value), this.init();
2339
2363
  }
2340
2364
  init() {
2341
2365
  let e = this.isHistoryMode ? "popstate" : "hashchange", t = this.handleUrlChange.bind(this);
2342
2366
  window.addEventListener(e, t), this.cleanups.push(() => window.removeEventListener(e, t));
2343
- let n = R(() => {
2367
+ let n = I(() => {
2344
2368
  let e = this.currentRouteAtom.value;
2345
- O(() => {
2369
+ E(() => {
2346
2370
  for (let e of this.routeCleanups) try {
2347
2371
  e();
2348
2372
  } catch {}
2349
2373
  this.routeCleanups.length = 0;
2350
2374
  }), this.renderRoute(e);
2351
2375
  });
2352
- this.cleanups.push(() => n.dispose()), this.setupAutoBindLinks(), this.$target[0] && J.trackCleanup(this.$target[0], () => this.destroy());
2376
+ this.cleanups.push(() => n.dispose()), this.setupAutoBindLinks(), this.$target[0] && W.trackCleanup(this.$target[0], () => this.destroy());
2353
2377
  }
2354
2378
  getRouteName() {
2355
2379
  let { default: e } = this.config;
@@ -2380,23 +2404,23 @@ var hn = class {
2380
2404
  }
2381
2405
  setUrl(e) {
2382
2406
  let t = this.isHistoryMode ? `${this.basePath}/${e}` : `#${e}`;
2383
- this.isHistoryMode ? mn(null, t) : location.hash = t, this.previousUrl = this.isHistoryMode ? t : location.hash;
2407
+ this.isHistoryMode ? hn(null, t) : location.hash = t, this.previousUrl = this.isHistoryMode ? t : location.hash;
2384
2408
  }
2385
2409
  restoreUrl() {
2386
- this.isHistoryMode ? mn(null, this.previousUrl) : location.hash = this.previousUrl;
2410
+ this.isHistoryMode ? hn(null, this.previousUrl) : location.hash = this.previousUrl;
2387
2411
  }
2388
2412
  renderRoute(e) {
2389
2413
  if (this.isDestroyed || !this.$target[0]) return;
2390
2414
  let { routes: t, notFound: n, beforeTransition: r, afterTransition: i } = this.config, a = t[e] ?? (n ? t[n] : void 0);
2391
2415
  if (!a) {
2392
- G.warn(H.ROUTE, W.ROUTE.NOT_FOUND(e));
2416
+ H.warn(B.ROUTE, V.ROUTE.NOT_FOUND(e));
2393
2417
  return;
2394
2418
  }
2395
2419
  let o = this.getQueryParams(), s = this.previousRoute;
2396
- r && O(() => r(s, e)), this.$target.empty();
2420
+ r && E(() => r(s, e)), this.$target.empty();
2397
2421
  let c = o;
2398
2422
  if (a.onEnter) {
2399
- let e = O(() => a.onEnter(o, this));
2423
+ let e = E(() => a.onEnter(o, this));
2400
2424
  e && (c = {
2401
2425
  ...o,
2402
2426
  ...e
@@ -2410,13 +2434,13 @@ var hn = class {
2410
2434
  let t = document.querySelector(a.template);
2411
2435
  if (t instanceof HTMLTemplateElement) e = t, this.templateCache.set(a.template, e);
2412
2436
  else {
2413
- G.warn(H.ROUTE, W.ROUTE.TEMPLATE_NOT_FOUND(a.template));
2437
+ H.warn(B.ROUTE, V.ROUTE.TEMPLATE_NOT_FOUND(a.template));
2414
2438
  return;
2415
2439
  }
2416
2440
  }
2417
2441
  this.$target.append(e.content.cloneNode(!0)), a.onMount && a.onMount(this.$target.children(), l, this);
2418
2442
  }
2419
- i && O(() => i(s, e)), this.previousRoute = e;
2443
+ i && E(() => i(s, e)), this.previousRoute = e;
2420
2444
  }
2421
2445
  handleUrlChange() {
2422
2446
  if (this.isDestroyed) return;
@@ -2424,7 +2448,7 @@ var hn = class {
2424
2448
  if (e === this.previousUrl) return;
2425
2449
  let t = this.getRouteName(), n = this.currentRouteAtom.peek();
2426
2450
  if (n !== t) {
2427
- if (O(() => this.config.routes[n]?.onLeave?.(this)) === !1) {
2451
+ if (E(() => this.config.routes[n]?.onLeave?.(this)) === !1) {
2428
2452
  this.restoreUrl();
2429
2453
  return;
2430
2454
  }
@@ -2440,9 +2464,9 @@ var hn = class {
2440
2464
  t != null && this.navigate(t);
2441
2465
  };
2442
2466
  e(document).on("click", "[data-route]", t), this.cleanups.push(() => e(document).off("click", "[data-route]", t));
2443
- let n = [], r = R(() => {
2467
+ let n = [], r = I(() => {
2444
2468
  let e = this.currentRouteAtom.value, t = this.activeClass;
2445
- O(() => {
2469
+ E(() => {
2446
2470
  let r = n.length;
2447
2471
  for (let e = 0; e < r; e++) {
2448
2472
  let r = n[e];
@@ -2479,13 +2503,13 @@ var hn = class {
2479
2503
  }
2480
2504
  }
2481
2505
  };
2482
- function gn(e) {
2483
- return new hn(e);
2506
+ function _n(e) {
2507
+ return new gn(e);
2484
2508
  }
2485
- e.extend({ route: gn });
2509
+ e.extend({ route: _n });
2486
2510
  //#endregion
2487
2511
  //#region src/features/fetch.ts
2488
- var _n = class {
2512
+ var vn = class {
2489
2513
  constructor(t, n) {
2490
2514
  this.abortController = null, this.execute = async () => {
2491
2515
  this.abortController?.abort(), this.abortController = new AbortController();
@@ -2545,16 +2569,16 @@ var _n = class {
2545
2569
  //#endregion
2546
2570
  //#region src/index.ts
2547
2571
  e.extend({ atomFetch(e, t) {
2548
- let n = new _n(e, t), r = L(n.execute, {
2572
+ let n = new vn(e, t), r = F(n.execute, {
2549
2573
  defaultValue: t.defaultValue,
2550
2574
  lazy: t.eager === !1
2551
2575
  });
2552
2576
  return Object.assign(r, { abort: () => n.abort() });
2553
2577
  } }), e(() => {
2554
- pt(), ot(document.body);
2578
+ dt(), ot(document.body);
2555
2579
  });
2556
- var vn = e;
2580
+ var yn = e;
2557
2581
  //#endregion
2558
- export { k as atom, qe as atomLens, Ee as batch, Je as composeLens, L as computed, vn as default, st as disableAutoCleanup, mt as disablejQueryOverrides, R as effect, ot as enableAutoCleanup, pt as enablejQueryOverrides, ve as isAtom, ye as isComputed, z as isReactive, Ye as lensFor, Ze as nextTick, J as registry, O as untracked };
2582
+ export { yn as default, st as disableAutoCleanup, ft as disablejQueryOverrides, ot as enableAutoCleanup, dt as enablejQueryOverrides, R as isReactive, Qe as nextTick, W as registry };
2559
2583
 
2560
2584
  //# sourceMappingURL=index.mjs.map