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