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