@but212/atom-effect-jquery 0.19.0 → 0.19.1
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/README.md +1 -1
- package/dist/atom-effect-jquery.min.js +1 -1
- package/dist/atom-effect-jquery.min.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +769 -725
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
3
|
-
const
|
|
1
|
+
import l from "jquery";
|
|
2
|
+
import { default as Qt } from "jquery";
|
|
3
|
+
const et = {
|
|
4
4
|
ONE_SECOND_MS: 1e3
|
|
5
|
-
},
|
|
5
|
+
}, me = {
|
|
6
6
|
IDLE: "idle",
|
|
7
7
|
PENDING: "pending",
|
|
8
8
|
RESOLVED: "resolved",
|
|
9
9
|
REJECTED: "rejected"
|
|
10
|
-
},
|
|
10
|
+
}, Oe = {
|
|
11
11
|
DISPOSED: 1
|
|
12
12
|
}, P = {
|
|
13
|
-
...
|
|
13
|
+
...Oe,
|
|
14
14
|
EXECUTING: 8
|
|
15
15
|
}, d = {
|
|
16
|
-
...
|
|
16
|
+
...Oe,
|
|
17
|
+
/** Marker bit: identifies this node as a computed. */
|
|
18
|
+
IS_COMPUTED: 2,
|
|
17
19
|
DIRTY: 8,
|
|
18
20
|
IDLE: 16,
|
|
19
21
|
PENDING: 32,
|
|
@@ -21,8 +23,8 @@ const Je = {
|
|
|
21
23
|
REJECTED: 128,
|
|
22
24
|
RECOMPUTING: 256,
|
|
23
25
|
HAS_ERROR: 512
|
|
24
|
-
},
|
|
25
|
-
...
|
|
26
|
+
}, j = {
|
|
27
|
+
...Oe,
|
|
26
28
|
SYNC: 8,
|
|
27
29
|
NOTIFICATION_SCHEDULED: 16
|
|
28
30
|
}, q = {
|
|
@@ -34,9 +36,9 @@ const Je = {
|
|
|
34
36
|
MAX_FLUSH_ITERATIONS: 1e3,
|
|
35
37
|
MIN_FLUSH_ITERATIONS: 10,
|
|
36
38
|
BATCH_QUEUE_SHRINK_THRESHOLD: 1e3
|
|
37
|
-
},
|
|
39
|
+
}, tt = {
|
|
38
40
|
WARN_INFINITE_LOOP: !0
|
|
39
|
-
},
|
|
41
|
+
}, oe = 1073741823, L = typeof process < "u" && process.env && process.env.NODE_ENV !== "production" || typeof __DEV__ < "u" && !!__DEV__, nt = Object.freeze([]);
|
|
40
42
|
class ee extends Error {
|
|
41
43
|
constructor(e, t = null, s = !0) {
|
|
42
44
|
super(e), this.cause = t, this.recoverable = s, this.timestamp = /* @__PURE__ */ new Date(), this.name = "AtomError";
|
|
@@ -47,60 +49,60 @@ class z extends ee {
|
|
|
47
49
|
super(e, t, !0), this.name = "ComputedError";
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
|
-
class
|
|
52
|
+
class Y extends ee {
|
|
51
53
|
constructor(e, t = null) {
|
|
52
54
|
super(e, t, !1), this.name = "EffectError";
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
|
-
class
|
|
57
|
+
class le extends ee {
|
|
56
58
|
constructor(e, t = null) {
|
|
57
59
|
super(e, t, !1), this.name = "SchedulerError";
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
const
|
|
61
|
-
function
|
|
62
|
+
const Ae = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), st = /* @__PURE__ */ Symbol("AtomEffect.Id"), Le = /* @__PURE__ */ Symbol("AtomEffect.Type"), Ce = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), it = (n) => "dependencies" in n && Array.isArray(n.dependencies);
|
|
63
|
+
function Ve(n, e, t) {
|
|
62
64
|
if (n === e)
|
|
63
65
|
throw new z(
|
|
64
66
|
"Circular dependency detected: The computation refers to itself explicitly or implicitly."
|
|
65
67
|
);
|
|
66
|
-
if (!t.has(n.id) && (t.add(n.id),
|
|
68
|
+
if (!t.has(n.id) && (t.add(n.id), it(n))) {
|
|
67
69
|
const s = n.dependencies;
|
|
68
70
|
for (let i = 0; i < s.length; i++) {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
+
const r = s[i];
|
|
72
|
+
r && Ve(r, e, t);
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
|
-
const
|
|
76
|
+
const W = {
|
|
75
77
|
// Dev mode flag
|
|
76
|
-
enabled:
|
|
77
|
-
warnInfiniteLoop:
|
|
78
|
+
enabled: L,
|
|
79
|
+
warnInfiniteLoop: tt.WARN_INFINITE_LOOP,
|
|
78
80
|
warn(n, e) {
|
|
79
|
-
|
|
81
|
+
L && this.enabled && n && console.warn(`[Atom Effect] ${e}`);
|
|
80
82
|
},
|
|
81
83
|
checkCircular(n, e) {
|
|
82
84
|
if (n === e)
|
|
83
85
|
throw new z("Direct circular dependency detected");
|
|
84
|
-
|
|
86
|
+
L && this.enabled && Ve(n, e, /* @__PURE__ */ new Set());
|
|
85
87
|
},
|
|
86
88
|
attachDebugInfo(n, e, t) {
|
|
87
|
-
if (!
|
|
89
|
+
if (!L || !this.enabled) return;
|
|
88
90
|
const s = n;
|
|
89
|
-
s[
|
|
91
|
+
s[Ae] = `${e}_${t}`, s[st] = t, s[Le] = e;
|
|
90
92
|
},
|
|
91
|
-
getDebugName: (n) => n?.[
|
|
92
|
-
getDebugType: (n) => n?.[
|
|
93
|
+
getDebugName: (n) => n?.[Ae],
|
|
94
|
+
getDebugType: (n) => n?.[Le]
|
|
93
95
|
};
|
|
94
|
-
let
|
|
95
|
-
const
|
|
96
|
-
function
|
|
96
|
+
let rt = 1;
|
|
97
|
+
const ot = () => rt++;
|
|
98
|
+
function He(n, e, t) {
|
|
97
99
|
if (typeof e == "function") {
|
|
98
100
|
const i = e;
|
|
99
|
-
for (let
|
|
100
|
-
const c = t[
|
|
101
|
+
for (let r = 0, o = t.length; r < o; r++) {
|
|
102
|
+
const c = t[r];
|
|
101
103
|
if (c && c.fn === i) return;
|
|
102
104
|
}
|
|
103
|
-
t.push(new
|
|
105
|
+
t.push(new Se(i, void 0));
|
|
104
106
|
return;
|
|
105
107
|
}
|
|
106
108
|
if ("addDependency" in e) {
|
|
@@ -108,42 +110,38 @@ function Be(n, e, t) {
|
|
|
108
110
|
return;
|
|
109
111
|
}
|
|
110
112
|
const s = e;
|
|
111
|
-
for (let i = 0,
|
|
112
|
-
const
|
|
113
|
-
if (
|
|
113
|
+
for (let i = 0, r = t.length; i < r; i++) {
|
|
114
|
+
const o = t[i];
|
|
115
|
+
if (o && o.sub === s) return;
|
|
114
116
|
}
|
|
115
|
-
t.push(new
|
|
117
|
+
t.push(new Se(void 0, s));
|
|
116
118
|
}
|
|
117
|
-
function
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
function ct(n, e, t) {
|
|
120
|
+
const s = /* @__PURE__ */ new Map();
|
|
121
|
+
for (let i = 0, r = e.length; i < r; i++) {
|
|
122
|
+
const o = e[i];
|
|
123
|
+
o?.unsub && (s.set(o.node, o.unsub), o.unsub = void 0);
|
|
121
124
|
}
|
|
122
|
-
for (let
|
|
123
|
-
const o = n[
|
|
125
|
+
for (let i = 0, r = n.length; i < r; i++) {
|
|
126
|
+
const o = n[i];
|
|
124
127
|
if (!o) continue;
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
}
|
|
128
|
-
for (let s = 0, i = e.length; s < i; s++) {
|
|
129
|
-
const o = e[s];
|
|
130
|
-
if (o) {
|
|
131
|
-
const r = o.node;
|
|
132
|
-
r._tempUnsub !== void 0 && (r._tempUnsub(), r._tempUnsub = void 0), o.unsub = void 0;
|
|
133
|
-
}
|
|
128
|
+
const c = o.node, a = s.get(c);
|
|
129
|
+
a !== void 0 ? (o.unsub = a, s.delete(c)) : (W.checkCircular(c, t), o.unsub = c.subscribe(t));
|
|
134
130
|
}
|
|
131
|
+
for (const i of s.values())
|
|
132
|
+
i();
|
|
135
133
|
}
|
|
136
|
-
class
|
|
134
|
+
class de {
|
|
137
135
|
constructor(e, t, s = void 0) {
|
|
138
136
|
this.node = e, this.version = t, this.unsub = s;
|
|
139
137
|
}
|
|
140
138
|
}
|
|
141
|
-
class
|
|
139
|
+
class Se {
|
|
142
140
|
constructor(e, t) {
|
|
143
141
|
this.fn = e, this.sub = t;
|
|
144
142
|
}
|
|
145
143
|
}
|
|
146
|
-
const
|
|
144
|
+
const T = {
|
|
147
145
|
// Computed Errors
|
|
148
146
|
COMPUTED_MUST_BE_FUNCTION: "Computed target must be a function",
|
|
149
147
|
COMPUTED_ASYNC_PENDING_NO_DEFAULT: "Async computation pending with no default value",
|
|
@@ -169,18 +167,18 @@ const D = {
|
|
|
169
167
|
function Z(n, e, t) {
|
|
170
168
|
if (n instanceof ee)
|
|
171
169
|
return n;
|
|
172
|
-
const s = n instanceof Error, i = s ? n.message : String(n),
|
|
173
|
-
let
|
|
174
|
-
n instanceof TypeError ?
|
|
175
|
-
const c = `${
|
|
176
|
-
return new e(c,
|
|
170
|
+
const s = n instanceof Error, i = s ? n.message : String(n), r = s ? n : void 0;
|
|
171
|
+
let o = "Unexpected error";
|
|
172
|
+
n instanceof TypeError ? o = "Type error" : n instanceof ReferenceError && (o = "Reference error");
|
|
173
|
+
const c = `${o} (${t}): ${i}`;
|
|
174
|
+
return new e(c, r);
|
|
177
175
|
}
|
|
178
176
|
class je {
|
|
179
177
|
constructor() {
|
|
180
|
-
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this._modifiedAtEpoch = -1, this.id =
|
|
178
|
+
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this._modifiedAtEpoch = -1, this.id = ot() & oe;
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
|
-
class
|
|
181
|
+
class ze extends je {
|
|
184
182
|
/**
|
|
185
183
|
* Adds subscriber.
|
|
186
184
|
*/
|
|
@@ -190,16 +188,16 @@ class Ve extends je {
|
|
|
190
188
|
throw Z(
|
|
191
189
|
new TypeError("Invalid subscriber"),
|
|
192
190
|
ee,
|
|
193
|
-
|
|
191
|
+
T.ATOM_SUBSCRIBER_MUST_BE_FUNCTION
|
|
194
192
|
);
|
|
195
193
|
const s = this._subscribers;
|
|
196
|
-
for (let
|
|
197
|
-
const c = s[
|
|
194
|
+
for (let r = 0, o = s.length; r < o; r++) {
|
|
195
|
+
const c = s[r];
|
|
198
196
|
if (c && (t ? c.fn === e : c.sub === e))
|
|
199
|
-
return
|
|
197
|
+
return L && console.warn("Duplicate subscription ignored."), () => {
|
|
200
198
|
};
|
|
201
199
|
}
|
|
202
|
-
const i = new
|
|
200
|
+
const i = new Se(
|
|
203
201
|
t ? e : void 0,
|
|
204
202
|
t ? void 0 : e
|
|
205
203
|
);
|
|
@@ -217,158 +215,145 @@ class Ve extends je {
|
|
|
217
215
|
_notifySubscribers(e, t) {
|
|
218
216
|
if (this._subscribers.length === 0) return;
|
|
219
217
|
const s = this._subscribers.slice(0), i = s.length;
|
|
220
|
-
for (let
|
|
221
|
-
const
|
|
222
|
-
if (
|
|
218
|
+
for (let r = 0; r < i; r++) {
|
|
219
|
+
const o = s[r];
|
|
220
|
+
if (o)
|
|
223
221
|
try {
|
|
224
|
-
|
|
222
|
+
o.fn ? o.fn(e, t) : o.sub && o.sub.execute();
|
|
225
223
|
} catch (c) {
|
|
226
224
|
this._handleNotifyError(c);
|
|
227
225
|
}
|
|
228
226
|
}
|
|
229
227
|
}
|
|
230
228
|
_handleNotifyError(e) {
|
|
231
|
-
console.error(Z(e, ee,
|
|
229
|
+
console.error(Z(e, ee, T.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
|
|
232
230
|
}
|
|
233
231
|
}
|
|
234
|
-
let
|
|
235
|
-
const
|
|
236
|
-
let
|
|
232
|
+
let _e = 0;
|
|
233
|
+
const qe = () => (_e = _e + 1 & oe || 1, _e), at = () => _e, De = (n) => n + 1 & oe;
|
|
234
|
+
let Te = 0, we = 0, Ee = !1;
|
|
237
235
|
function xe() {
|
|
238
|
-
return
|
|
236
|
+
return Ee ? (L && console.warn("startFlush() called during flush - ignored"), !1) : (Ee = !0, Te = Te + 1 & oe || 1, we = 0, !0);
|
|
239
237
|
}
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
/** Epoch counter */
|
|
248
|
-
_epoch: 0,
|
|
249
|
-
/** State flags */
|
|
250
|
-
_isProcessing: !1,
|
|
251
|
-
_isBatching: !1,
|
|
252
|
-
_isFlushingSync: !1,
|
|
253
|
-
/** Batching state */
|
|
254
|
-
_batchDepth: 0,
|
|
255
|
-
_batchQueue: [],
|
|
256
|
-
_batchQueueSize: 0,
|
|
257
|
-
/** Config */
|
|
258
|
-
_maxFlushIterations: q.MAX_FLUSH_ITERATIONS,
|
|
238
|
+
const Ue = () => {
|
|
239
|
+
Ee = !1;
|
|
240
|
+
}, ut = () => Ee ? ++we : 0;
|
|
241
|
+
class lt {
|
|
242
|
+
constructor() {
|
|
243
|
+
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 = q.MAX_FLUSH_ITERATIONS, this.onOverflow = null, this._boundRunLoop = this._runLoop.bind(this);
|
|
244
|
+
}
|
|
259
245
|
get phase() {
|
|
260
246
|
return this._isProcessing || this._isFlushingSync ? 2 : this._isBatching ? 1 : 0;
|
|
261
|
-
}
|
|
247
|
+
}
|
|
262
248
|
get queueSize() {
|
|
263
249
|
return this._size;
|
|
264
|
-
}
|
|
250
|
+
}
|
|
265
251
|
get isBatching() {
|
|
266
252
|
return this._isBatching;
|
|
267
|
-
}
|
|
253
|
+
}
|
|
268
254
|
/**
|
|
269
255
|
* Schedules job.
|
|
270
256
|
*/
|
|
271
|
-
schedule(
|
|
272
|
-
if (
|
|
273
|
-
throw new
|
|
274
|
-
if (
|
|
275
|
-
if (
|
|
276
|
-
this._batchQueue[this._batchQueueSize++] =
|
|
257
|
+
schedule(e) {
|
|
258
|
+
if (L && typeof e != "function")
|
|
259
|
+
throw new le("Scheduler callback must be a function");
|
|
260
|
+
if (e._nextEpoch !== this._epoch) {
|
|
261
|
+
if (e._nextEpoch = this._epoch, this._isBatching || this._isFlushingSync) {
|
|
262
|
+
this._batchQueue[this._batchQueueSize++] = e;
|
|
277
263
|
return;
|
|
278
264
|
}
|
|
279
|
-
this._queueBuffer[this._bufferIndex][this._size++] =
|
|
265
|
+
this._queueBuffer[this._bufferIndex][this._size++] = e, this._isProcessing || this._flush();
|
|
280
266
|
}
|
|
281
|
-
}
|
|
267
|
+
}
|
|
282
268
|
/**
|
|
283
269
|
* Triggers flush.
|
|
284
270
|
*/
|
|
285
271
|
_flush() {
|
|
286
|
-
this._isProcessing || this._size === 0 || (this._isProcessing = !0, queueMicrotask(this.
|
|
287
|
-
}
|
|
272
|
+
this._isProcessing || this._size === 0 || (this._isProcessing = !0, queueMicrotask(this._boundRunLoop));
|
|
273
|
+
}
|
|
288
274
|
/**
|
|
289
275
|
* Scheduler loop.
|
|
290
276
|
*/
|
|
291
|
-
_runLoop
|
|
277
|
+
_runLoop() {
|
|
292
278
|
try {
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
|
|
279
|
+
if (this._size === 0) return;
|
|
280
|
+
const e = xe();
|
|
281
|
+
this._drainQueue(), e && Ue();
|
|
296
282
|
} finally {
|
|
297
|
-
|
|
283
|
+
this._isProcessing = !1, this._size > 0 && !this._isBatching && this._flush();
|
|
298
284
|
}
|
|
299
|
-
}
|
|
285
|
+
}
|
|
300
286
|
_flushSync() {
|
|
301
287
|
this._isFlushingSync = !0;
|
|
302
|
-
const
|
|
288
|
+
const e = xe();
|
|
303
289
|
try {
|
|
304
290
|
this._mergeBatchQueue(), this._drainQueue();
|
|
305
291
|
} finally {
|
|
306
|
-
this._isFlushingSync = !1,
|
|
292
|
+
this._isFlushingSync = !1, e && Ue();
|
|
307
293
|
}
|
|
308
|
-
}
|
|
294
|
+
}
|
|
309
295
|
_mergeBatchQueue() {
|
|
310
296
|
if (this._batchQueueSize === 0) return;
|
|
311
|
-
const
|
|
312
|
-
let
|
|
313
|
-
for (let
|
|
314
|
-
const o =
|
|
315
|
-
o._nextEpoch !==
|
|
297
|
+
const e = ++this._epoch, t = this._batchQueue, s = this._queueBuffer[this._bufferIndex];
|
|
298
|
+
let i = this._size;
|
|
299
|
+
for (let r = 0; r < this._batchQueueSize; r++) {
|
|
300
|
+
const o = t[r];
|
|
301
|
+
o._nextEpoch !== e && (o._nextEpoch = e, s[i++] = o);
|
|
316
302
|
}
|
|
317
|
-
this._size =
|
|
318
|
-
}
|
|
303
|
+
this._size = i, this._batchQueueSize = 0, t.length > q.BATCH_QUEUE_SHRINK_THRESHOLD && (t.length = 0);
|
|
304
|
+
}
|
|
319
305
|
_drainQueue() {
|
|
320
|
-
let
|
|
306
|
+
let e = 0;
|
|
321
307
|
for (; this._size > 0; ) {
|
|
322
|
-
if (++
|
|
308
|
+
if (++e > this._maxFlushIterations) {
|
|
323
309
|
this._handleFlushOverflow();
|
|
324
310
|
return;
|
|
325
311
|
}
|
|
326
312
|
this._processQueue(), this._mergeBatchQueue();
|
|
327
313
|
}
|
|
328
|
-
}
|
|
314
|
+
}
|
|
329
315
|
_processQueue() {
|
|
330
|
-
const
|
|
331
|
-
this._bufferIndex =
|
|
332
|
-
for (let
|
|
316
|
+
const e = this._bufferIndex, t = this._queueBuffer[e], s = this._size;
|
|
317
|
+
this._bufferIndex = e ^ 1, this._size = 0, this._epoch++;
|
|
318
|
+
for (let i = 0; i < s; i++)
|
|
333
319
|
try {
|
|
334
|
-
|
|
335
|
-
} catch (
|
|
336
|
-
console.error(new
|
|
320
|
+
t[i]();
|
|
321
|
+
} catch (r) {
|
|
322
|
+
console.error(new le("Error occurred during scheduler execution", r));
|
|
337
323
|
}
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
/** Overflow callback */
|
|
341
|
-
onOverflow: null,
|
|
324
|
+
t.length = 0;
|
|
325
|
+
}
|
|
342
326
|
_handleFlushOverflow() {
|
|
343
|
-
const
|
|
327
|
+
const e = this._size + this._batchQueueSize;
|
|
344
328
|
if (console.error(
|
|
345
|
-
new
|
|
346
|
-
|
|
329
|
+
new le(
|
|
330
|
+
T.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, e)
|
|
347
331
|
)
|
|
348
332
|
), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this._batchQueueSize = 0, this.onOverflow)
|
|
349
333
|
try {
|
|
350
|
-
this.onOverflow(
|
|
334
|
+
this.onOverflow(e);
|
|
351
335
|
} catch {
|
|
352
336
|
}
|
|
353
|
-
}
|
|
337
|
+
}
|
|
354
338
|
startBatch() {
|
|
355
339
|
this._batchDepth++, this._isBatching = !0;
|
|
356
|
-
}
|
|
340
|
+
}
|
|
357
341
|
endBatch() {
|
|
358
342
|
if (this._batchDepth === 0) {
|
|
359
|
-
|
|
343
|
+
L && console.warn("endBatch() called without matching startBatch(). Ignoring.");
|
|
360
344
|
return;
|
|
361
345
|
}
|
|
362
346
|
--this._batchDepth === 0 && (this._flushSync(), this._isBatching = !1);
|
|
363
|
-
}
|
|
364
|
-
setMaxFlushIterations(
|
|
365
|
-
if (
|
|
366
|
-
throw new
|
|
347
|
+
}
|
|
348
|
+
setMaxFlushIterations(e) {
|
|
349
|
+
if (e < q.MIN_FLUSH_ITERATIONS)
|
|
350
|
+
throw new le(
|
|
367
351
|
`Max flush iterations must be at least ${q.MIN_FLUSH_ITERATIONS}`
|
|
368
352
|
);
|
|
369
|
-
this._maxFlushIterations =
|
|
353
|
+
this._maxFlushIterations = e;
|
|
370
354
|
}
|
|
371
|
-
}
|
|
355
|
+
}
|
|
356
|
+
const re = new lt(), M = {
|
|
372
357
|
/** Active listener. */
|
|
373
358
|
current: null,
|
|
374
359
|
/**
|
|
@@ -388,35 +373,35 @@ const Ae = () => {
|
|
|
388
373
|
}
|
|
389
374
|
}
|
|
390
375
|
};
|
|
391
|
-
function
|
|
392
|
-
const e =
|
|
376
|
+
function ht(n) {
|
|
377
|
+
const e = M.current;
|
|
393
378
|
if (e === null) return n();
|
|
394
|
-
|
|
379
|
+
M.current = null;
|
|
395
380
|
try {
|
|
396
381
|
return n();
|
|
397
382
|
} finally {
|
|
398
|
-
|
|
383
|
+
M.current = e;
|
|
399
384
|
}
|
|
400
385
|
}
|
|
401
|
-
class
|
|
386
|
+
class ft extends ze {
|
|
402
387
|
constructor(e, t) {
|
|
403
|
-
super(), this._pendingOldValue = void 0, this._notifyTask = void 0, this._subscribers = [], this._value = e, t && (this.flags |=
|
|
388
|
+
super(), this._pendingOldValue = void 0, this._notifyTask = void 0, this._subscribers = [], this._value = e, t && (this.flags |= j.SYNC), W.attachDebugInfo(this, "atom", this.id);
|
|
404
389
|
}
|
|
405
390
|
get value() {
|
|
406
|
-
const e =
|
|
407
|
-
return e &&
|
|
391
|
+
const e = M.current;
|
|
392
|
+
return e && He(this, e, this._subscribers), this._value;
|
|
408
393
|
}
|
|
409
394
|
set value(e) {
|
|
410
395
|
const t = this._value;
|
|
411
396
|
if (Object.is(t, e)) return;
|
|
412
|
-
this._value = e, this.version =
|
|
397
|
+
this._value = e, this.version = De(this.version);
|
|
413
398
|
const s = this.flags;
|
|
414
|
-
if (!(this._subscribers.length === 0 || s &
|
|
415
|
-
if (this._pendingOldValue = t, this.flags = s |
|
|
399
|
+
if (!(this._subscribers.length === 0 || s & j.NOTIFICATION_SCHEDULED)) {
|
|
400
|
+
if (this._pendingOldValue = t, this.flags = s | j.NOTIFICATION_SCHEDULED, s & j.SYNC && !re.isBatching) {
|
|
416
401
|
this._flushNotifications();
|
|
417
402
|
return;
|
|
418
403
|
}
|
|
419
|
-
this._notifyTask || (this._notifyTask = () => this._flushNotifications()),
|
|
404
|
+
this._notifyTask || (this._notifyTask = () => this._flushNotifications()), re.schedule(this._notifyTask);
|
|
420
405
|
}
|
|
421
406
|
}
|
|
422
407
|
/**
|
|
@@ -424,7 +409,7 @@ class ut extends Ve {
|
|
|
424
409
|
*/
|
|
425
410
|
_flushNotifications() {
|
|
426
411
|
const e = this.flags;
|
|
427
|
-
if (!(e &
|
|
412
|
+
if (!(e & j.NOTIFICATION_SCHEDULED) || e & j.DISPOSED)
|
|
428
413
|
return;
|
|
429
414
|
const t = this._pendingOldValue;
|
|
430
415
|
this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(this._value, t);
|
|
@@ -433,20 +418,20 @@ class ut extends Ve {
|
|
|
433
418
|
return this._value;
|
|
434
419
|
}
|
|
435
420
|
dispose() {
|
|
436
|
-
this.flags &
|
|
421
|
+
this.flags & j.DISPOSED || (this._subscribers.length = 0, this.flags |= j.DISPOSED, this._value = void 0, this._pendingOldValue = void 0, this._notifyTask = void 0);
|
|
437
422
|
}
|
|
438
423
|
}
|
|
439
|
-
function
|
|
440
|
-
return new
|
|
424
|
+
function Xe(n, e = {}) {
|
|
425
|
+
return new ft(n, e.sync ?? !1);
|
|
441
426
|
}
|
|
442
|
-
class
|
|
427
|
+
class dt {
|
|
443
428
|
/**
|
|
444
429
|
* @param limit - Max unique arrays to hold (default: 50). Prevents the pool itself from consuming too much memory.
|
|
445
430
|
* @param capacity - Max length of an array to accept (default: 256).
|
|
446
431
|
* @param enableStats - Force-enable stats even in production (default: false).
|
|
447
432
|
*/
|
|
448
433
|
constructor(e = 50, t = 256, s = !1) {
|
|
449
|
-
this.limit = e, this.capacity = t, this.pool = [], this.stats = null, this.stats =
|
|
434
|
+
this.limit = e, this.capacity = t, this.pool = [], this.stats = null, this.stats = L || s ? {
|
|
450
435
|
acquired: 0,
|
|
451
436
|
released: 0,
|
|
452
437
|
rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
|
|
@@ -506,40 +491,40 @@ class lt {
|
|
|
506
491
|
});
|
|
507
492
|
}
|
|
508
493
|
}
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
const
|
|
515
|
-
function
|
|
494
|
+
const ce = (n) => Object.freeze(n);
|
|
495
|
+
ce([]);
|
|
496
|
+
ce([]);
|
|
497
|
+
ce([]);
|
|
498
|
+
ce([]);
|
|
499
|
+
const F = ce([]), X = new dt();
|
|
500
|
+
function ve(n) {
|
|
516
501
|
return n !== null && typeof n == "object" && "value" in n && typeof n.subscribe == "function";
|
|
517
502
|
}
|
|
518
|
-
function
|
|
519
|
-
return
|
|
503
|
+
function Pe(n) {
|
|
504
|
+
return ve(n) && typeof n.invalidate == "function";
|
|
520
505
|
}
|
|
521
|
-
function
|
|
506
|
+
function Ge(n) {
|
|
522
507
|
return n !== null && typeof n == "object" && typeof n.then == "function";
|
|
523
508
|
}
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
class
|
|
509
|
+
const Qe = d.RESOLVED | d.PENDING | d.REJECTED, ye = Array(Qe + 1).fill(me.IDLE);
|
|
510
|
+
ye[d.RESOLVED] = me.RESOLVED;
|
|
511
|
+
ye[d.PENDING] = me.PENDING;
|
|
512
|
+
ye[d.REJECTED] = me.REJECTED;
|
|
513
|
+
const _t = 3, Fe = Number.MAX_SAFE_INTEGER - 1, pt = d.REJECTED | d.HAS_ERROR;
|
|
514
|
+
class Ye extends ze {
|
|
530
515
|
constructor(e, t = {}) {
|
|
531
|
-
if (typeof e != "function") throw new z(
|
|
532
|
-
super(), this._error = null, this._promiseId = 0, this._subscribers = [], this._links =
|
|
516
|
+
if (typeof e != "function") throw new z(T.COMPUTED_MUST_BE_FUNCTION);
|
|
517
|
+
super(), this._error = null, this._promiseId = 0, this._subscribers = [], this._links = F, this._cachedErrors = null, this._errorCacheEpoch = -1, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._errorDepCount = 0, this._trackEpoch = -1, this._trackLinks = F, this._trackCount = 0, this._value = void 0, this.flags = d.IS_COMPUTED | d.DIRTY | d.IDLE, this._equal = t.equal ?? Object.is, this._fn = e, this._defaultValue = "defaultValue" in t ? t.defaultValue : Ce, this._onError = t.onError ?? null;
|
|
533
518
|
const s = t.maxAsyncRetries;
|
|
534
|
-
if (this._maxAsyncRetries = s != null && s >= 0 ? s :
|
|
519
|
+
if (this._maxAsyncRetries = s != null && s >= 0 ? s : _t, W.attachDebugInfo(this, "computed", this.id), t.lazy === !1)
|
|
535
520
|
try {
|
|
536
521
|
this._recompute();
|
|
537
522
|
} catch {
|
|
538
523
|
}
|
|
539
524
|
}
|
|
540
525
|
_track() {
|
|
541
|
-
const e =
|
|
542
|
-
e &&
|
|
526
|
+
const e = M.current;
|
|
527
|
+
e && He(this, e, this._subscribers);
|
|
543
528
|
}
|
|
544
529
|
get value() {
|
|
545
530
|
this._track();
|
|
@@ -547,17 +532,17 @@ class Qe extends Ve {
|
|
|
547
532
|
if ((e & (d.RESOLVED | d.DIRTY | d.IDLE)) === d.RESOLVED)
|
|
548
533
|
return this._value;
|
|
549
534
|
if (e & d.DISPOSED)
|
|
550
|
-
throw new z(
|
|
535
|
+
throw new z(T.COMPUTED_DISPOSED);
|
|
551
536
|
if (e & d.RECOMPUTING) {
|
|
552
|
-
if (this._defaultValue !==
|
|
553
|
-
throw new z(
|
|
537
|
+
if (this._defaultValue !== Ce) return this._defaultValue;
|
|
538
|
+
throw new z(T.COMPUTED_CIRCULAR_DEPENDENCY);
|
|
554
539
|
}
|
|
555
540
|
if (e & (d.DIRTY | d.IDLE) && (this._recompute(), this.flags & d.RESOLVED))
|
|
556
541
|
return this._value;
|
|
557
|
-
const t = this._defaultValue, s = t !==
|
|
542
|
+
const t = this._defaultValue, s = t !== Ce;
|
|
558
543
|
if (this.flags & d.PENDING) {
|
|
559
544
|
if (s) return t;
|
|
560
|
-
throw new z(
|
|
545
|
+
throw new z(T.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
|
|
561
546
|
}
|
|
562
547
|
if (this.flags & d.REJECTED) {
|
|
563
548
|
if (this._error?.recoverable && s) return t;
|
|
@@ -569,7 +554,7 @@ class Qe extends Ve {
|
|
|
569
554
|
return this._value;
|
|
570
555
|
}
|
|
571
556
|
get state() {
|
|
572
|
-
return this._track(),
|
|
557
|
+
return this._track(), ye[this.flags & Qe];
|
|
573
558
|
}
|
|
574
559
|
get hasError() {
|
|
575
560
|
if (this._track(), this.flags & (d.REJECTED | d.HAS_ERROR) || this._errorDepCount > 0) return !0;
|
|
@@ -585,18 +570,18 @@ class Qe extends Ve {
|
|
|
585
570
|
return !this.hasError;
|
|
586
571
|
}
|
|
587
572
|
get errors() {
|
|
588
|
-
if (this._track(), !this.hasError) return
|
|
589
|
-
const e =
|
|
573
|
+
if (this._track(), !this.hasError) return nt;
|
|
574
|
+
const e = at();
|
|
590
575
|
if (this._errorCacheEpoch === e && this._cachedErrors) return this._cachedErrors;
|
|
591
576
|
const t = [];
|
|
592
577
|
this._error && t.push(this._error);
|
|
593
578
|
const s = this._links;
|
|
594
|
-
for (let
|
|
595
|
-
const c = s[
|
|
579
|
+
for (let r = 0, o = s.length; r < o; r++) {
|
|
580
|
+
const c = s[r].node;
|
|
596
581
|
if (c.flags & d.HAS_ERROR) {
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
599
|
-
const _ =
|
|
582
|
+
const a = c;
|
|
583
|
+
if (a.errors) {
|
|
584
|
+
const _ = a.errors;
|
|
600
585
|
for (let g = 0; g < _.length; g++) {
|
|
601
586
|
const v = _[g];
|
|
602
587
|
v && t.indexOf(v) === -1 && t.push(v);
|
|
@@ -622,12 +607,12 @@ class Qe extends Ve {
|
|
|
622
607
|
dispose() {
|
|
623
608
|
if (this.flags & d.DISPOSED) return;
|
|
624
609
|
const e = this._links;
|
|
625
|
-
if (e !==
|
|
610
|
+
if (e !== F) {
|
|
626
611
|
for (let t = 0, s = e.length; t < s; t++)
|
|
627
612
|
e[t].unsub?.();
|
|
628
|
-
X.release(e), this._links =
|
|
613
|
+
X.release(e), this._links = F;
|
|
629
614
|
}
|
|
630
|
-
this._subscribers.length = 0, this.flags = d.DISPOSED | d.DIRTY | d.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) %
|
|
615
|
+
this._subscribers.length = 0, this.flags = d.DISPOSED | d.DIRTY | d.IDLE, this._error = null, this._value = void 0, this._promiseId = (this._promiseId + 1) % Fe, this._cachedErrors = null, this._errorCacheEpoch = -1;
|
|
631
616
|
}
|
|
632
617
|
addDependency(e) {
|
|
633
618
|
if (e._lastSeenEpoch !== this._trackEpoch) {
|
|
@@ -635,19 +620,19 @@ class Qe extends Ve {
|
|
|
635
620
|
const t = this._trackLinks[this._trackCount];
|
|
636
621
|
t.node = e, t.version = e.version;
|
|
637
622
|
} else
|
|
638
|
-
this._trackLinks.push(new
|
|
623
|
+
this._trackLinks.push(new de(e, e.version));
|
|
639
624
|
this._trackCount++;
|
|
640
625
|
}
|
|
641
626
|
}
|
|
642
627
|
_commitDeps(e) {
|
|
643
|
-
this._trackLinks.length = this._trackCount,
|
|
628
|
+
this._trackLinks.length = this._trackCount, ct(this._trackLinks, e, this), this._links = this._trackLinks;
|
|
644
629
|
}
|
|
645
630
|
_updateErrorDepCount() {
|
|
646
631
|
let e = 0;
|
|
647
632
|
const t = this._links;
|
|
648
633
|
for (let s = 0, i = t.length; s < i; s++) {
|
|
649
|
-
const
|
|
650
|
-
|
|
634
|
+
const r = t[s]?.node;
|
|
635
|
+
r && r.flags & d.HAS_ERROR && e++;
|
|
651
636
|
}
|
|
652
637
|
this._errorDepCount = e;
|
|
653
638
|
}
|
|
@@ -655,25 +640,25 @@ class Qe extends Ve {
|
|
|
655
640
|
if (this.flags & d.RECOMPUTING) return;
|
|
656
641
|
this.flags |= d.RECOMPUTING;
|
|
657
642
|
const e = this._links;
|
|
658
|
-
this._trackEpoch =
|
|
643
|
+
this._trackEpoch = qe(), this._trackLinks = X.acquire(), this._trackCount = 0;
|
|
659
644
|
let t = !1;
|
|
660
645
|
try {
|
|
661
|
-
const s =
|
|
662
|
-
this._commitDeps(e), t = !0, this._updateErrorDepCount(),
|
|
646
|
+
const s = M.run(this, this._fn);
|
|
647
|
+
this._commitDeps(e), t = !0, this._updateErrorDepCount(), Ge(s) ? this._handleAsyncComputation(s) : this._finalizeResolution(s);
|
|
663
648
|
} catch (s) {
|
|
664
649
|
if (!t)
|
|
665
650
|
try {
|
|
666
651
|
this._commitDeps(e), t = !0, this._updateErrorDepCount();
|
|
667
652
|
} catch (i) {
|
|
668
|
-
|
|
653
|
+
L && console.warn("[atom-effect] _commitDeps failed during error recovery:", i);
|
|
669
654
|
}
|
|
670
|
-
this._handleError(s,
|
|
655
|
+
this._handleError(s, T.COMPUTED_COMPUTATION_FAILED, !0);
|
|
671
656
|
} finally {
|
|
672
|
-
t && e !==
|
|
657
|
+
t && e !== F ? X.release(e) : t || X.release(this._trackLinks), this._trackEpoch = -1, this._trackLinks = F, this._trackCount = 0, this.flags &= -257;
|
|
673
658
|
}
|
|
674
659
|
}
|
|
675
660
|
_handleAsyncComputation(e) {
|
|
676
|
-
this.flags = (this.flags | d.PENDING) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) %
|
|
661
|
+
this.flags = (this.flags | d.PENDING) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % Fe;
|
|
677
662
|
const t = this._promiseId;
|
|
678
663
|
e.then(
|
|
679
664
|
(s) => {
|
|
@@ -683,34 +668,34 @@ class Qe extends Ve {
|
|
|
683
668
|
new z(
|
|
684
669
|
`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`
|
|
685
670
|
),
|
|
686
|
-
|
|
671
|
+
T.COMPUTED_ASYNC_COMPUTATION_FAILED
|
|
687
672
|
);
|
|
688
673
|
this._finalizeResolution(s), this._notifySubscribers(s, void 0);
|
|
689
674
|
}
|
|
690
675
|
},
|
|
691
|
-
(s) => t === this._promiseId && this._handleError(s,
|
|
676
|
+
(s) => t === this._promiseId && this._handleError(s, T.COMPUTED_ASYNC_COMPUTATION_FAILED)
|
|
692
677
|
);
|
|
693
678
|
}
|
|
694
679
|
_captureVersionSnapshot() {
|
|
695
680
|
let e = 0;
|
|
696
681
|
const t = this._links;
|
|
697
682
|
for (let s = 0, i = t.length; s < i; s++)
|
|
698
|
-
e = ((e << 5) - e | 0) + t[s].node.version &
|
|
683
|
+
e = ((e << 5) - e | 0) + t[s].node.version & oe;
|
|
699
684
|
return e;
|
|
700
685
|
}
|
|
701
686
|
_handleError(e, t, s = !1) {
|
|
702
687
|
const i = Z(e, z, t);
|
|
703
|
-
if (!s && !(this.flags & d.REJECTED) && (this.version =
|
|
688
|
+
if (!s && !(this.flags & d.REJECTED) && (this.version = De(this.version)), this._error = i, this.flags = this.flags & -121 | pt, this._onError)
|
|
704
689
|
try {
|
|
705
690
|
this._onError(i);
|
|
706
|
-
} catch (
|
|
707
|
-
console.error(
|
|
691
|
+
} catch (r) {
|
|
692
|
+
console.error(T.CALLBACK_ERROR_IN_ERROR_HANDLER, r);
|
|
708
693
|
}
|
|
709
694
|
if (s) throw i;
|
|
710
695
|
this._notifySubscribers(void 0, void 0);
|
|
711
696
|
}
|
|
712
697
|
_finalizeResolution(e) {
|
|
713
|
-
(!(this.flags & d.RESOLVED) || !this._equal(this._value, e)) && (this.version =
|
|
698
|
+
(!(this.flags & d.RESOLVED) || !this._equal(this._value, e)) && (this.version = De(this.version)), this._value = e, this._error = null, this.flags = (this.flags | d.RESOLVED) & -697, this._cachedErrors = null, this._errorCacheEpoch = -1;
|
|
714
699
|
}
|
|
715
700
|
execute() {
|
|
716
701
|
this._markDirty();
|
|
@@ -720,46 +705,46 @@ class Qe extends Ve {
|
|
|
720
705
|
this.flags & (d.RECOMPUTING | d.DIRTY) || (this.flags |= d.DIRTY, this._notifySubscribers(void 0, void 0));
|
|
721
706
|
}
|
|
722
707
|
}
|
|
723
|
-
Object.freeze(
|
|
724
|
-
function
|
|
725
|
-
return new
|
|
708
|
+
Object.freeze(Ye.prototype);
|
|
709
|
+
function Et(n, e = {}) {
|
|
710
|
+
return new Ye(n, e);
|
|
726
711
|
}
|
|
727
|
-
class
|
|
712
|
+
class gt extends je {
|
|
728
713
|
constructor(e, t = {}) {
|
|
729
|
-
super(), this._cleanup = null, this._links =
|
|
714
|
+
super(), this._cleanup = null, this._links = F, this._nextLinks = null, this._parkedUnsubs = null, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._executionCount = 0, this._historyPtr = 0, this._execId = 0, this._fn = e, this._onError = t.onError ?? null, this._sync = t.sync ?? !1, this._maxExecutions = t.maxExecutionsPerSecond ?? q.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = t.maxExecutionsPerFlush ?? q.MAX_EXECUTIONS_PER_EFFECT, this._trackModifications = t.trackModifications ?? !1;
|
|
730
715
|
const s = Number.isFinite(this._maxExecutions), i = s ? Math.min(this._maxExecutions + 1, q.MAX_EXECUTIONS_PER_SECOND + 1) : 0;
|
|
731
|
-
this._historyCapacity = i, this._history =
|
|
716
|
+
this._historyCapacity = i, this._history = L && s && i > 0 ? new Array(i).fill(0) : null, W.attachDebugInfo(this, "effect", this.id);
|
|
732
717
|
}
|
|
733
718
|
run() {
|
|
734
719
|
if (this.flags & P.DISPOSED)
|
|
735
|
-
throw new
|
|
720
|
+
throw new Y(T.EFFECT_DISPOSED);
|
|
736
721
|
this.execute(!0);
|
|
737
722
|
}
|
|
738
723
|
dispose() {
|
|
739
|
-
this.flags & P.DISPOSED || (this.flags |= P.DISPOSED, this._execCleanup(), this._releaseLinks(this._links), this._links =
|
|
724
|
+
this.flags & P.DISPOSED || (this.flags |= P.DISPOSED, this._execCleanup(), this._releaseLinks(this._links), this._links = F, this._executeTask = void 0);
|
|
740
725
|
}
|
|
741
726
|
addDependency(e) {
|
|
742
727
|
if (!(this.flags & P.EXECUTING) || e._lastSeenEpoch === this._currentEpoch) return;
|
|
743
728
|
e._lastSeenEpoch = this._currentEpoch;
|
|
744
|
-
const t = this._nextLinks;
|
|
745
|
-
if (
|
|
746
|
-
t.push(new
|
|
729
|
+
const t = this._nextLinks, s = this._parkedUnsubs?.get(e);
|
|
730
|
+
if (s) {
|
|
731
|
+
t.push(new de(e, e.version, s)), this._parkedUnsubs.delete(e);
|
|
747
732
|
return;
|
|
748
733
|
}
|
|
749
734
|
try {
|
|
750
|
-
const
|
|
735
|
+
const i = e.subscribe(() => {
|
|
751
736
|
if (this._trackModifications && this.flags & P.EXECUTING && (e._modifiedAtEpoch = this._currentEpoch), this._sync) return this.execute();
|
|
752
|
-
this._executeTask || (this._executeTask = () => this.execute()),
|
|
737
|
+
this._executeTask || (this._executeTask = () => this.execute()), re.schedule(this._executeTask);
|
|
753
738
|
});
|
|
754
|
-
t.push(new
|
|
755
|
-
} catch (
|
|
756
|
-
const
|
|
757
|
-
if (console.error(
|
|
739
|
+
t.push(new de(e, e.version, i));
|
|
740
|
+
} catch (i) {
|
|
741
|
+
const r = Z(i, Y, T.EFFECT_EXECUTION_FAILED);
|
|
742
|
+
if (console.error(r), this._onError)
|
|
758
743
|
try {
|
|
759
|
-
this._onError(
|
|
744
|
+
this._onError(r);
|
|
760
745
|
} catch {
|
|
761
746
|
}
|
|
762
|
-
t.push(new
|
|
747
|
+
t.push(new de(e, e.version, void 0));
|
|
763
748
|
}
|
|
764
749
|
}
|
|
765
750
|
/**
|
|
@@ -769,19 +754,22 @@ class _t extends je {
|
|
|
769
754
|
if (this.flags & (P.DISPOSED | P.EXECUTING) || !e && this._links.length > 0 && !this._isDirty()) return;
|
|
770
755
|
this._checkInfiniteLoops(), this.flags |= P.EXECUTING, this._execCleanup();
|
|
771
756
|
const t = this._links;
|
|
772
|
-
if (t !==
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
757
|
+
if (t !== F) {
|
|
758
|
+
const r = /* @__PURE__ */ new Map();
|
|
759
|
+
for (let o = 0, c = t.length; o < c; o++) {
|
|
760
|
+
const a = t[o];
|
|
761
|
+
a?.unsub && r.set(a.node, a.unsub);
|
|
776
762
|
}
|
|
763
|
+
this._parkedUnsubs = r;
|
|
764
|
+
}
|
|
777
765
|
const s = X.acquire();
|
|
778
|
-
this._nextLinks = s, this._currentEpoch =
|
|
766
|
+
this._nextLinks = s, this._currentEpoch = qe();
|
|
779
767
|
let i = !1;
|
|
780
768
|
try {
|
|
781
|
-
const
|
|
782
|
-
this._links = s, i = !0, this._checkLoopWarnings(),
|
|
783
|
-
} catch (
|
|
784
|
-
i = !0, this._handleExecutionError(
|
|
769
|
+
const r = M.run(this, this._fn);
|
|
770
|
+
this._links = s, i = !0, this._checkLoopWarnings(), Ge(r) ? this._handleAsyncResult(r) : this._cleanup = typeof r == "function" ? r : null;
|
|
771
|
+
} catch (r) {
|
|
772
|
+
i = !0, this._handleExecutionError(r), this._cleanup = null;
|
|
785
773
|
} finally {
|
|
786
774
|
this._finalizeDependencies(i, t, s), this.flags &= -9;
|
|
787
775
|
}
|
|
@@ -795,7 +783,7 @@ class _t extends je {
|
|
|
795
783
|
try {
|
|
796
784
|
s();
|
|
797
785
|
} catch (i) {
|
|
798
|
-
this._handleExecutionError(i,
|
|
786
|
+
this._handleExecutionError(i, T.EFFECT_CLEANUP_FAILED);
|
|
799
787
|
}
|
|
800
788
|
return;
|
|
801
789
|
}
|
|
@@ -806,41 +794,38 @@ class _t extends je {
|
|
|
806
794
|
}
|
|
807
795
|
_finalizeDependencies(e, t, s) {
|
|
808
796
|
if (this._nextLinks = null, e) {
|
|
809
|
-
if (
|
|
810
|
-
for (
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
} else if (this._releaseLinks(s), X.release(s), t !== U)
|
|
817
|
-
for (let i = 0, o = t.length; i < o; i++)
|
|
818
|
-
t[i] && (t[i].node._tempUnsub = void 0);
|
|
797
|
+
if (this._parkedUnsubs)
|
|
798
|
+
for (const i of this._parkedUnsubs.values())
|
|
799
|
+
i();
|
|
800
|
+
t !== F && X.release(t);
|
|
801
|
+
} else
|
|
802
|
+
this._releaseLinks(s), X.release(s);
|
|
803
|
+
this._parkedUnsubs = null;
|
|
819
804
|
}
|
|
820
805
|
_releaseLinks(e) {
|
|
821
|
-
if (e !==
|
|
806
|
+
if (e !== F) {
|
|
822
807
|
for (let t = 0, s = e.length; t < s; t++)
|
|
823
808
|
e[t]?.unsub?.();
|
|
824
809
|
X.release(e);
|
|
825
810
|
}
|
|
826
811
|
}
|
|
827
812
|
_isDirty() {
|
|
828
|
-
const e = this._links, t =
|
|
829
|
-
|
|
813
|
+
const e = this._links, t = M.current;
|
|
814
|
+
M.current = null;
|
|
830
815
|
try {
|
|
831
816
|
for (let s = 0, i = e.length; s < i; s++) {
|
|
832
|
-
const
|
|
833
|
-
if (
|
|
817
|
+
const r = e[s], o = r.node;
|
|
818
|
+
if (o.flags & d.IS_COMPUTED)
|
|
834
819
|
try {
|
|
835
|
-
|
|
820
|
+
o.value;
|
|
836
821
|
} catch {
|
|
837
|
-
return
|
|
822
|
+
return L && console.warn(`[atom-effect] Dependency #${o.id} threw during dirty check`), !0;
|
|
838
823
|
}
|
|
839
|
-
if (
|
|
824
|
+
if (o.version !== r.version) return !0;
|
|
840
825
|
}
|
|
841
826
|
return !1;
|
|
842
827
|
} finally {
|
|
843
|
-
|
|
828
|
+
M.current = t;
|
|
844
829
|
}
|
|
845
830
|
}
|
|
846
831
|
_execCleanup() {
|
|
@@ -848,20 +833,20 @@ class _t extends je {
|
|
|
848
833
|
try {
|
|
849
834
|
this._cleanup();
|
|
850
835
|
} catch (e) {
|
|
851
|
-
this._handleExecutionError(e,
|
|
836
|
+
this._handleExecutionError(e, T.EFFECT_CLEANUP_FAILED);
|
|
852
837
|
}
|
|
853
838
|
this._cleanup = null;
|
|
854
839
|
}
|
|
855
840
|
}
|
|
856
841
|
_checkInfiniteLoops() {
|
|
857
|
-
const e =
|
|
858
|
-
if (this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"),
|
|
842
|
+
const e = Te;
|
|
843
|
+
if (this._lastFlushEpoch !== e && (this._lastFlushEpoch = e, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), ut() > q.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++, this._history) {
|
|
859
844
|
const t = Date.now();
|
|
860
845
|
this._history[this._historyPtr] = t, this._historyPtr = (this._historyPtr + 1) % this._historyCapacity;
|
|
861
846
|
const s = this._history[this._historyPtr] || 0;
|
|
862
|
-
if (s > 0 && t - s <
|
|
863
|
-
const i = new
|
|
864
|
-
if (this.dispose(), this._handleExecutionError(i),
|
|
847
|
+
if (s > 0 && t - s < et.ONE_SECOND_MS) {
|
|
848
|
+
const i = new Y(T.EFFECT_FREQUENCY_LIMIT_EXCEEDED);
|
|
849
|
+
if (this.dispose(), this._handleExecutionError(i), L) throw i;
|
|
865
850
|
}
|
|
866
851
|
}
|
|
867
852
|
}
|
|
@@ -875,53 +860,53 @@ class _t extends je {
|
|
|
875
860
|
return (this.flags & P.EXECUTING) !== 0;
|
|
876
861
|
}
|
|
877
862
|
_throwInfiniteLoopError(e) {
|
|
878
|
-
const t = new
|
|
879
|
-
`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${
|
|
863
|
+
const t = new Y(
|
|
864
|
+
`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${we}`
|
|
880
865
|
);
|
|
881
866
|
throw this.dispose(), console.error(t), t;
|
|
882
867
|
}
|
|
883
|
-
_handleExecutionError(e, t =
|
|
884
|
-
const s = Z(e,
|
|
868
|
+
_handleExecutionError(e, t = T.EFFECT_EXECUTION_FAILED) {
|
|
869
|
+
const s = Z(e, Y, t);
|
|
885
870
|
if (console.error(s), this._onError)
|
|
886
871
|
try {
|
|
887
872
|
this._onError(s);
|
|
888
873
|
} catch (i) {
|
|
889
|
-
console.error(Z(i,
|
|
874
|
+
console.error(Z(i, Y, T.CALLBACK_ERROR_IN_ERROR_HANDLER));
|
|
890
875
|
}
|
|
891
876
|
}
|
|
892
877
|
_checkLoopWarnings() {
|
|
893
|
-
if (this._trackModifications &&
|
|
878
|
+
if (this._trackModifications && W.enabled) {
|
|
894
879
|
const e = this._currentEpoch, t = this._links;
|
|
895
880
|
for (let s = 0, i = t.length; s < i; s++) {
|
|
896
|
-
const
|
|
897
|
-
|
|
881
|
+
const r = t[s].node;
|
|
882
|
+
r._modifiedAtEpoch === e && W.warn(
|
|
898
883
|
!0,
|
|
899
|
-
`Effect is reading a dependency (${
|
|
884
|
+
`Effect is reading a dependency (${W.getDebugName(r) || "unknown"}) that it just modified. Infinite loop may occur`
|
|
900
885
|
);
|
|
901
886
|
}
|
|
902
887
|
}
|
|
903
888
|
}
|
|
904
889
|
}
|
|
905
|
-
function
|
|
890
|
+
function B(n, e = {}) {
|
|
906
891
|
if (typeof n != "function")
|
|
907
|
-
throw new
|
|
908
|
-
const t = new
|
|
892
|
+
throw new Y(T.EFFECT_MUST_BE_FUNCTION);
|
|
893
|
+
const t = new gt(n, e);
|
|
909
894
|
return t.execute(), t;
|
|
910
895
|
}
|
|
911
|
-
function
|
|
896
|
+
function Re(n) {
|
|
912
897
|
if (typeof n != "function")
|
|
913
898
|
throw new TypeError("Batch callback must be a function");
|
|
914
|
-
|
|
899
|
+
re.startBatch();
|
|
915
900
|
try {
|
|
916
901
|
return n();
|
|
917
902
|
} finally {
|
|
918
|
-
|
|
903
|
+
re.endBatch();
|
|
919
904
|
}
|
|
920
905
|
}
|
|
921
|
-
function
|
|
906
|
+
function mt(n) {
|
|
922
907
|
return n !== null && typeof n == "object" && "value" in n && "subscribe" in n;
|
|
923
908
|
}
|
|
924
|
-
function
|
|
909
|
+
function be(n) {
|
|
925
910
|
if (!n) return "unknown";
|
|
926
911
|
const e = "jquery" in n ? n[0] : n;
|
|
927
912
|
if (!e) return "unknown";
|
|
@@ -929,69 +914,81 @@ function me(n) {
|
|
|
929
914
|
if (t && typeof t == "string") return `#${t}`;
|
|
930
915
|
const s = e.tagName.toLowerCase(), i = e.classList;
|
|
931
916
|
if (i && i.length > 0) {
|
|
932
|
-
let
|
|
933
|
-
for (let
|
|
934
|
-
const
|
|
935
|
-
|
|
917
|
+
let r = s;
|
|
918
|
+
for (let o = 0, c = i.length; o < c; o++) {
|
|
919
|
+
const a = i[o];
|
|
920
|
+
a && (r += `.${a}`);
|
|
936
921
|
}
|
|
937
|
-
return
|
|
922
|
+
return r;
|
|
938
923
|
}
|
|
939
924
|
return s;
|
|
940
925
|
}
|
|
941
|
-
function
|
|
926
|
+
function se(n) {
|
|
942
927
|
let e = String(n ?? "");
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
return `(?:${c}|�*${l};?|�*${l.toString(16)};?)`;
|
|
954
|
-
}).join("\\s*")}\\s*(?::|:|&#x?0*((58)|(3a));?|%3a)`,
|
|
955
|
-
"gi"
|
|
956
|
-
);
|
|
957
|
-
e = e.replace(o("javascript"), "data-unsafe-protocol:").replace(o("vbscript"), "data-unsafe-protocol:");
|
|
958
|
-
} else {
|
|
959
|
-
const o = /((?: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*(?::|:|&#x?0*((58)|(3a));?|%3a))/gim;
|
|
960
|
-
e = e.replace(o, "data-unsafe-protocol:");
|
|
961
|
-
}
|
|
962
|
-
const i = /data\s*:\s*(?:text\/html|application\/javascript|text\/javascript|text\/vbscript)/gim;
|
|
963
|
-
return e = e.replace(i, "data-unsafe-protocol:"), e = e.replace(/\bon\w+\s*=/gim, "data-unsafe-attr="), e = e.replace(/expression\s*\(/gim, "data-unsafe-css(").replace(/behavior\s*:/gim, "data-unsafe-css:"), e;
|
|
928
|
+
e = e.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, ""), e = e.replace(/<\?[\s\S]*?\?>/g, "");
|
|
929
|
+
const t = /(<(script|iframe|object|embed|base|meta|applet|noscript)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript)\b[^>]*\/?>)/gim;
|
|
930
|
+
let s;
|
|
931
|
+
do
|
|
932
|
+
s = e, e = e.replace(t, "");
|
|
933
|
+
while (e !== s);
|
|
934
|
+
const i = /(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;
|
|
935
|
+
e = e.replace(i, "data-unsafe-protocol:");
|
|
936
|
+
const r = /data\s*:\s*(?:text\/html|application\/javascript|text\/javascript|text\/vbscript|text\/xml|application\/xhtml\+xml)/gim;
|
|
937
|
+
return e = e.replace(r, "data-unsafe-protocol:"), e = e.replace(/\bon\w+\s*=/gim, "data-unsafe-attr="), e = e.replace(/expression\s*\(/gim, "data-unsafe-css(").replace(/behavior\s*:/gim, "data-unsafe-css:"), e;
|
|
964
938
|
}
|
|
965
|
-
|
|
939
|
+
const yt = /* @__PURE__ */ new Set([
|
|
940
|
+
"href",
|
|
941
|
+
"src",
|
|
942
|
+
"action",
|
|
943
|
+
"formaction",
|
|
944
|
+
"xlink:href",
|
|
945
|
+
"data",
|
|
946
|
+
"poster",
|
|
947
|
+
"srcset",
|
|
948
|
+
"background",
|
|
949
|
+
"cite",
|
|
950
|
+
"longdesc",
|
|
951
|
+
"profile",
|
|
952
|
+
"usemap",
|
|
953
|
+
"classid",
|
|
954
|
+
"codebase"
|
|
955
|
+
]), bt = /^\s*(?:javascript|vbscript)\s*:/i;
|
|
956
|
+
function We(n, e) {
|
|
957
|
+
return yt.has(n.toLowerCase()) ? bt.test(e) : !1;
|
|
958
|
+
}
|
|
959
|
+
function ke(n) {
|
|
960
|
+
return n.toLowerCase().includes("url(") ? /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i.test(n) : !1;
|
|
961
|
+
}
|
|
962
|
+
function Ct(n) {
|
|
966
963
|
const e = n.length;
|
|
967
964
|
if (e === 0) return new Int32Array(0);
|
|
968
965
|
const t = new Int32Array(e), s = new Int32Array(e);
|
|
969
966
|
let i = 0;
|
|
970
|
-
for (let
|
|
971
|
-
const c = n[
|
|
967
|
+
for (let o = 0; o < e; o++) {
|
|
968
|
+
const c = n[o];
|
|
972
969
|
if (c === void 0 || c === -1) continue;
|
|
973
|
-
const
|
|
974
|
-
if (i === 0 ||
|
|
975
|
-
t[
|
|
970
|
+
const a = i > 0 ? s[i - 1] : void 0;
|
|
971
|
+
if (i === 0 || a !== void 0 && (n[a] ?? -1) < c) {
|
|
972
|
+
t[o] = a ?? -1, s[i++] = o;
|
|
976
973
|
continue;
|
|
977
974
|
}
|
|
978
975
|
let _ = 0, g = i - 1;
|
|
979
976
|
for (; _ < g; ) {
|
|
980
|
-
const
|
|
981
|
-
|
|
977
|
+
const I = _ + g >>> 1, O = s[I];
|
|
978
|
+
O !== void 0 && (n[O] ?? -1) < c ? _ = I + 1 : g = I;
|
|
982
979
|
}
|
|
983
980
|
const v = s[_];
|
|
984
|
-
v !== void 0 && c < (n[v] ?? Number.MAX_SAFE_INTEGER) && (_ > 0 && (t[
|
|
981
|
+
v !== void 0 && c < (n[v] ?? Number.MAX_SAFE_INTEGER) && (_ > 0 && (t[o] = s[_ - 1] ?? -1), s[_] = o);
|
|
985
982
|
}
|
|
986
|
-
const
|
|
983
|
+
const r = new Int32Array(i);
|
|
987
984
|
if (i > 0) {
|
|
988
|
-
let
|
|
989
|
-
for (let c = i - 1; c >= 0 &&
|
|
990
|
-
|
|
985
|
+
let o = s[i - 1];
|
|
986
|
+
for (let c = i - 1; c >= 0 && o !== void 0 && o !== -1; c--)
|
|
987
|
+
r[c] = o, o = t[o];
|
|
991
988
|
}
|
|
992
|
-
return
|
|
989
|
+
return r;
|
|
993
990
|
}
|
|
994
|
-
function
|
|
991
|
+
function It() {
|
|
995
992
|
if (typeof window < "u") {
|
|
996
993
|
const n = window.__ATOM_DEBUG__;
|
|
997
994
|
if (typeof n == "boolean") return n;
|
|
@@ -1002,7 +999,7 @@ function gt() {
|
|
|
1002
999
|
}
|
|
1003
1000
|
return !1;
|
|
1004
1001
|
}
|
|
1005
|
-
let Q =
|
|
1002
|
+
let Q = It();
|
|
1006
1003
|
const b = {
|
|
1007
1004
|
get enabled() {
|
|
1008
1005
|
return Q;
|
|
@@ -1025,7 +1022,7 @@ const b = {
|
|
|
1025
1022
|
* Logs DOM updates and triggers visual highlight.
|
|
1026
1023
|
*/
|
|
1027
1024
|
domUpdated(n, e, t) {
|
|
1028
|
-
Q && (console.log(`[atom-effect-jquery] DOM updated: ${
|
|
1025
|
+
Q && (console.log(`[atom-effect-jquery] DOM updated: ${be(n)}.${e} =`, t), St(n));
|
|
1029
1026
|
},
|
|
1030
1027
|
cleanup(n) {
|
|
1031
1028
|
Q && console.log(`[atom-effect-jquery] Cleanup: ${n}`);
|
|
@@ -1033,12 +1030,12 @@ const b = {
|
|
|
1033
1030
|
warn(...n) {
|
|
1034
1031
|
Q && console.warn("[atom-effect-jquery]", ...n);
|
|
1035
1032
|
}
|
|
1036
|
-
},
|
|
1037
|
-
function
|
|
1033
|
+
}, Ie = /* @__PURE__ */ new WeakMap();
|
|
1034
|
+
function St(n) {
|
|
1038
1035
|
const e = "jquery" in n ? n[0] : n;
|
|
1039
1036
|
if (!e || !e.isConnected) return;
|
|
1040
|
-
let t =
|
|
1041
|
-
if (t || (t = {},
|
|
1037
|
+
let t = Ie.get(e);
|
|
1038
|
+
if (t || (t = {}, Ie.set(e, t)), t.timer && clearTimeout(t.timer), t.cleanupTimer && clearTimeout(t.cleanupTimer), !t.orgStyle) {
|
|
1042
1039
|
const i = e.style;
|
|
1043
1040
|
t.orgStyle = {
|
|
1044
1041
|
outline: i.outline,
|
|
@@ -1052,17 +1049,17 @@ function mt(n) {
|
|
|
1052
1049
|
if (!e.isConnected) return;
|
|
1053
1050
|
const i = t?.orgStyle;
|
|
1054
1051
|
i && (s.outline = i.outline, s.outlineOffset = i.outlineOffset), t.cleanupTimer = setTimeout(() => {
|
|
1055
|
-
e.isConnected && t?.orgStyle && (s.transition = t.orgStyle.transition),
|
|
1052
|
+
e.isConnected && t?.orgStyle && (s.transition = t.orgStyle.transition), Ie.delete(e);
|
|
1056
1053
|
}, 500);
|
|
1057
1054
|
}));
|
|
1058
1055
|
}, 100);
|
|
1059
1056
|
}
|
|
1060
|
-
const
|
|
1061
|
-
function
|
|
1062
|
-
const t =
|
|
1063
|
-
return e.name &&
|
|
1057
|
+
const Dt = /* @__PURE__ */ new WeakMap();
|
|
1058
|
+
function Ke(n, e = {}) {
|
|
1059
|
+
const t = Xe(n, e);
|
|
1060
|
+
return e.name && Dt.set(t, { name: e.name }), t;
|
|
1064
1061
|
}
|
|
1065
|
-
Object.defineProperty(
|
|
1062
|
+
Object.defineProperty(Ke, "debug", {
|
|
1066
1063
|
get() {
|
|
1067
1064
|
return b.enabled;
|
|
1068
1065
|
},
|
|
@@ -1070,22 +1067,22 @@ Object.defineProperty(Ye, "debug", {
|
|
|
1070
1067
|
b.enabled = n;
|
|
1071
1068
|
}
|
|
1072
1069
|
});
|
|
1073
|
-
function
|
|
1070
|
+
function Tt() {
|
|
1074
1071
|
return new Promise((n) => setTimeout(n, 0));
|
|
1075
1072
|
}
|
|
1076
|
-
|
|
1077
|
-
atom:
|
|
1078
|
-
computed:
|
|
1079
|
-
effect:
|
|
1080
|
-
batch:
|
|
1081
|
-
untracked:
|
|
1082
|
-
isAtom:
|
|
1083
|
-
isComputed:
|
|
1084
|
-
isReactive: (n) =>
|
|
1085
|
-
nextTick:
|
|
1073
|
+
l.extend({
|
|
1074
|
+
atom: Ke,
|
|
1075
|
+
computed: Et,
|
|
1076
|
+
effect: B,
|
|
1077
|
+
batch: Re,
|
|
1078
|
+
untracked: ht,
|
|
1079
|
+
isAtom: ve,
|
|
1080
|
+
isComputed: Pe,
|
|
1081
|
+
isReactive: (n) => ve(n) || Pe(n),
|
|
1082
|
+
nextTick: Tt
|
|
1086
1083
|
});
|
|
1087
|
-
const
|
|
1088
|
-
class
|
|
1084
|
+
const he = "_aes-bound";
|
|
1085
|
+
class vt {
|
|
1089
1086
|
records = /* @__PURE__ */ new WeakMap();
|
|
1090
1087
|
boundElements = /* @__PURE__ */ new WeakSet();
|
|
1091
1088
|
preservedNodes = /* @__PURE__ */ new WeakSet();
|
|
@@ -1105,7 +1102,7 @@ class Ct {
|
|
|
1105
1102
|
}
|
|
1106
1103
|
_getOrCreateRecord(e) {
|
|
1107
1104
|
let t = this.records.get(e);
|
|
1108
|
-
return t || (t = {}, this.records.set(e, t), this.boundElements.has(e) || (this.boundElements.add(e), e.classList.add(
|
|
1105
|
+
return t || (t = {}, this.records.set(e, t), this.boundElements.has(e) || (this.boundElements.add(e), e.classList.add(he))), t;
|
|
1109
1106
|
}
|
|
1110
1107
|
trackEffect(e, t) {
|
|
1111
1108
|
const s = this._getOrCreateRecord(e);
|
|
@@ -1122,153 +1119,153 @@ class Ct {
|
|
|
1122
1119
|
if (!this.boundElements.delete(e)) return;
|
|
1123
1120
|
const t = this.records.get(e);
|
|
1124
1121
|
if (!t) return;
|
|
1125
|
-
this.records.delete(e), this.preservedNodes.delete(e), this.ignoredNodes.delete(e), e.classList.remove(
|
|
1122
|
+
this.records.delete(e), this.preservedNodes.delete(e), this.ignoredNodes.delete(e), e.classList.remove(he), b.enabled && b.cleanup(be(e));
|
|
1126
1123
|
const s = t.effects;
|
|
1127
1124
|
if (s)
|
|
1128
|
-
for (let
|
|
1125
|
+
for (let r = 0, o = s.length; r < o; r++)
|
|
1129
1126
|
try {
|
|
1130
|
-
s[
|
|
1127
|
+
s[r]?.dispose();
|
|
1131
1128
|
} catch (c) {
|
|
1132
1129
|
b.warn("Effect dispose error:", c);
|
|
1133
1130
|
}
|
|
1134
1131
|
const i = t.cleanups;
|
|
1135
1132
|
if (i)
|
|
1136
|
-
for (let
|
|
1133
|
+
for (let r = 0, o = i.length; r < o; r++)
|
|
1137
1134
|
try {
|
|
1138
|
-
i[
|
|
1135
|
+
i[r]?.();
|
|
1139
1136
|
} catch (c) {
|
|
1140
1137
|
b.warn("Cleanup error:", c);
|
|
1141
1138
|
}
|
|
1142
1139
|
}
|
|
1143
1140
|
cleanupDescendants(e) {
|
|
1144
|
-
const t = e.querySelectorAll(`.${
|
|
1141
|
+
const t = e.querySelectorAll(`.${he}`);
|
|
1145
1142
|
for (let s = 0, i = t.length; s < i; s++) {
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1143
|
+
const r = t[s];
|
|
1144
|
+
r && this.boundElements.has(r) ? this.cleanup(r) : r && r.classList.remove(he);
|
|
1148
1145
|
}
|
|
1149
1146
|
}
|
|
1150
1147
|
cleanupTree(e) {
|
|
1151
1148
|
this.cleanupDescendants(e), this.cleanup(e);
|
|
1152
1149
|
}
|
|
1153
1150
|
}
|
|
1154
|
-
const y = new
|
|
1155
|
-
let
|
|
1156
|
-
function
|
|
1157
|
-
|
|
1151
|
+
const y = new vt();
|
|
1152
|
+
let ie = null;
|
|
1153
|
+
function kt(n = document.body) {
|
|
1154
|
+
ie || (ie = new MutationObserver((e) => {
|
|
1158
1155
|
for (let t = 0, s = e.length; t < s; t++) {
|
|
1159
1156
|
const i = e[t]?.removedNodes;
|
|
1160
1157
|
if (!i) continue;
|
|
1161
|
-
const
|
|
1162
|
-
if (
|
|
1163
|
-
for (let
|
|
1164
|
-
const c = i[
|
|
1158
|
+
const r = i.length;
|
|
1159
|
+
if (r !== 0)
|
|
1160
|
+
for (let o = 0; o < r; o++) {
|
|
1161
|
+
const c = i[o];
|
|
1165
1162
|
c.nodeType === 1 && (c.isConnected || y.isKept(c) || y.isIgnored(c) || y.cleanupTree(c));
|
|
1166
1163
|
}
|
|
1167
1164
|
}
|
|
1168
|
-
}),
|
|
1165
|
+
}), ie.observe(n, { childList: !0, subtree: !0 }));
|
|
1169
1166
|
}
|
|
1170
|
-
function
|
|
1171
|
-
|
|
1167
|
+
function zt() {
|
|
1168
|
+
ie?.disconnect(), ie = null;
|
|
1172
1169
|
}
|
|
1173
|
-
function
|
|
1174
|
-
|
|
1170
|
+
function k(n, e, t, s) {
|
|
1171
|
+
mt(e) ? y.trackEffect(
|
|
1175
1172
|
n,
|
|
1176
|
-
|
|
1173
|
+
B(() => {
|
|
1177
1174
|
const i = e.value;
|
|
1178
|
-
t(i), b.domUpdated(
|
|
1175
|
+
t(i), b.domUpdated(l(n), s, i);
|
|
1179
1176
|
})
|
|
1180
|
-
) : (t(e), b.domUpdated(
|
|
1177
|
+
) : (t(e), b.domUpdated(l(n), s, e));
|
|
1181
1178
|
}
|
|
1182
|
-
var
|
|
1183
|
-
function
|
|
1179
|
+
var D = /* @__PURE__ */ ((n) => (n[n.None = 0] = "None", n[n.Focused = 1] = "Focused", n[n.Composing = 2] = "Composing", n[n.SyncingToAtom = 4] = "SyncingToAtom", n[n.SyncingToDom = 8] = "SyncingToDom", n[n.Busy = 14] = "Busy", n))(D || {});
|
|
1180
|
+
function Ne() {
|
|
1184
1181
|
return {
|
|
1185
1182
|
timeoutId: null,
|
|
1186
1183
|
flags: 0
|
|
1187
1184
|
/* None */
|
|
1188
1185
|
};
|
|
1189
1186
|
}
|
|
1190
|
-
function
|
|
1187
|
+
function Je(n, e, t = {}) {
|
|
1191
1188
|
const {
|
|
1192
1189
|
debounce: s,
|
|
1193
1190
|
event: i = "input",
|
|
1194
|
-
parse:
|
|
1195
|
-
format:
|
|
1191
|
+
parse: r = (w) => w,
|
|
1192
|
+
format: o = (w) => String(w ?? ""),
|
|
1196
1193
|
equal: c = Object.is
|
|
1197
|
-
} = t,
|
|
1198
|
-
if (!(
|
|
1199
|
-
|
|
1194
|
+
} = t, a = Ne(), _ = n[0], g = () => {
|
|
1195
|
+
if (!(a.flags & D.Busy)) {
|
|
1196
|
+
a.flags |= D.SyncingToAtom;
|
|
1200
1197
|
try {
|
|
1201
|
-
const w = _.value,
|
|
1202
|
-
c(e.value,
|
|
1198
|
+
const w = _.value, R = r(w);
|
|
1199
|
+
c(e.value, R) || (e.value = R);
|
|
1203
1200
|
} finally {
|
|
1204
|
-
|
|
1201
|
+
a.flags &= ~D.SyncingToAtom;
|
|
1205
1202
|
}
|
|
1206
1203
|
}
|
|
1207
1204
|
}, v = () => {
|
|
1208
|
-
|
|
1209
|
-
const w =
|
|
1205
|
+
a.timeoutId && (clearTimeout(a.timeoutId), a.timeoutId = null, g()), a.flags &= ~D.Focused;
|
|
1206
|
+
const w = o(e.value);
|
|
1210
1207
|
_.value !== w && (_.value = w);
|
|
1211
|
-
},
|
|
1212
|
-
|
|
1213
|
-
},
|
|
1208
|
+
}, I = () => {
|
|
1209
|
+
a.flags & D.Busy || (s ? (a.timeoutId && clearTimeout(a.timeoutId), a.timeoutId = setTimeout(g, s)) : g());
|
|
1210
|
+
}, O = {
|
|
1214
1211
|
compositionstart: () => {
|
|
1215
|
-
|
|
1212
|
+
a.flags |= D.Composing;
|
|
1216
1213
|
},
|
|
1217
1214
|
compositionend: () => {
|
|
1218
|
-
|
|
1215
|
+
a.flags &= ~D.Composing, g();
|
|
1219
1216
|
},
|
|
1220
1217
|
focus: () => {
|
|
1221
|
-
|
|
1218
|
+
a.flags |= D.Focused;
|
|
1222
1219
|
},
|
|
1223
1220
|
blur: v,
|
|
1224
|
-
[i]:
|
|
1225
|
-
change:
|
|
1221
|
+
[i]: I,
|
|
1222
|
+
change: I
|
|
1226
1223
|
};
|
|
1227
|
-
return n.on(
|
|
1228
|
-
const w = e.value,
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1224
|
+
return n.on(O), { effect: () => {
|
|
1225
|
+
const w = e.value, R = o(w), A = _.value;
|
|
1226
|
+
if (A !== R && !(a.flags & D.Focused && c(r(A), w))) {
|
|
1227
|
+
a.flags |= D.SyncingToDom;
|
|
1231
1228
|
try {
|
|
1232
|
-
if (
|
|
1233
|
-
const { selectionStart:
|
|
1234
|
-
_.value =
|
|
1235
|
-
const
|
|
1236
|
-
_.setSelectionRange(Math.min(
|
|
1229
|
+
if (a.flags & D.Focused) {
|
|
1230
|
+
const { selectionStart: x, selectionEnd: K } = _;
|
|
1231
|
+
_.value = R;
|
|
1232
|
+
const U = R.length;
|
|
1233
|
+
_.setSelectionRange(Math.min(x ?? U, U), Math.min(K ?? U, U));
|
|
1237
1234
|
} else
|
|
1238
|
-
_.value =
|
|
1239
|
-
b.domUpdated(n, "val",
|
|
1235
|
+
_.value = R;
|
|
1236
|
+
b.domUpdated(n, "val", R);
|
|
1240
1237
|
} finally {
|
|
1241
|
-
|
|
1238
|
+
a.flags &= ~D.SyncingToDom;
|
|
1242
1239
|
}
|
|
1243
1240
|
}
|
|
1244
1241
|
}, cleanup: () => {
|
|
1245
|
-
n.off(
|
|
1242
|
+
n.off(O), a.timeoutId && clearTimeout(a.timeoutId);
|
|
1246
1243
|
} };
|
|
1247
1244
|
}
|
|
1248
|
-
|
|
1245
|
+
l.fn.atomText = function(n, e) {
|
|
1249
1246
|
return this.each(function() {
|
|
1250
|
-
const t =
|
|
1251
|
-
|
|
1247
|
+
const t = l(this);
|
|
1248
|
+
k(this, n, e ? (i) => t.text(e(i)) : (i) => t.text(String(i ?? "")), "text");
|
|
1252
1249
|
});
|
|
1253
1250
|
};
|
|
1254
|
-
|
|
1251
|
+
l.fn.atomHtml = function(n) {
|
|
1255
1252
|
return this.each(function() {
|
|
1256
|
-
const e =
|
|
1257
|
-
|
|
1253
|
+
const e = l(this);
|
|
1254
|
+
k(
|
|
1258
1255
|
this,
|
|
1259
1256
|
n,
|
|
1260
1257
|
(t) => {
|
|
1261
|
-
const s = String(t ?? ""), i =
|
|
1258
|
+
const s = String(t ?? ""), i = se(s);
|
|
1262
1259
|
i !== s && console.warn("[atomHtml] Unsafe content neutralized during sanitization."), e.html(i);
|
|
1263
1260
|
},
|
|
1264
1261
|
"html"
|
|
1265
1262
|
);
|
|
1266
1263
|
});
|
|
1267
1264
|
};
|
|
1268
|
-
|
|
1265
|
+
l.fn.atomClass = function(n, e) {
|
|
1269
1266
|
return this.each(function() {
|
|
1270
|
-
const t =
|
|
1271
|
-
|
|
1267
|
+
const t = l(this);
|
|
1268
|
+
k(
|
|
1272
1269
|
this,
|
|
1273
1270
|
e,
|
|
1274
1271
|
(s) => t.toggleClass(n, !!s),
|
|
@@ -1276,16 +1273,23 @@ u.fn.atomClass = function(n, e) {
|
|
|
1276
1273
|
);
|
|
1277
1274
|
});
|
|
1278
1275
|
};
|
|
1279
|
-
|
|
1276
|
+
l.fn.atomCss = function(n, e, t) {
|
|
1280
1277
|
return this.each(function() {
|
|
1281
|
-
const s =
|
|
1282
|
-
|
|
1278
|
+
const s = l(this);
|
|
1279
|
+
k(this, e, (r) => {
|
|
1280
|
+
const o = t ? `${r}${t}` : r, c = String(o);
|
|
1281
|
+
if (ke(c)) {
|
|
1282
|
+
console.warn(`[atomCss] Blocked dangerous value in "${n}" property.`);
|
|
1283
|
+
return;
|
|
1284
|
+
}
|
|
1285
|
+
s.css(n, o);
|
|
1286
|
+
}, `css.${n}`);
|
|
1283
1287
|
});
|
|
1284
1288
|
};
|
|
1285
|
-
|
|
1286
|
-
return this.each(function() {
|
|
1287
|
-
const t =
|
|
1288
|
-
|
|
1289
|
+
l.fn.atomAttr = function(n, e) {
|
|
1290
|
+
return /^on/i.test(n) ? (console.warn(`[atomAttr] Blocked setting dangerous event handler attribute "${n}".`), this) : this.each(function() {
|
|
1291
|
+
const t = l(this);
|
|
1292
|
+
k(
|
|
1289
1293
|
this,
|
|
1290
1294
|
e,
|
|
1291
1295
|
(s) => {
|
|
@@ -1293,76 +1297,83 @@ u.fn.atomAttr = function(n, e) {
|
|
|
1293
1297
|
t.removeAttr(n);
|
|
1294
1298
|
return;
|
|
1295
1299
|
}
|
|
1296
|
-
|
|
1300
|
+
const i = s === !0 ? n : String(s);
|
|
1301
|
+
if (We(n, i)) {
|
|
1302
|
+
console.warn(`[atomAttr] Blocked dangerous protocol in "${n}" attribute.`);
|
|
1303
|
+
return;
|
|
1304
|
+
}
|
|
1305
|
+
t.attr(n, i);
|
|
1297
1306
|
},
|
|
1298
1307
|
`attr.${n}`
|
|
1299
1308
|
);
|
|
1300
1309
|
});
|
|
1301
1310
|
};
|
|
1302
|
-
|
|
1303
|
-
return
|
|
1304
|
-
|
|
1305
|
-
|
|
1311
|
+
l.fn.atomProp = function(n, e) {
|
|
1312
|
+
return ["innerHTML", "outerHTML"].includes(n) ? (console.warn(
|
|
1313
|
+
`[atomProp] Blocked setting dangerous property "${n}". Use atomHtml for sanitized HTML binding.`
|
|
1314
|
+
), this) : this.each(function() {
|
|
1315
|
+
const s = l(this);
|
|
1316
|
+
k(this, e, (i) => s.prop(n, i), `prop.${n}`);
|
|
1306
1317
|
});
|
|
1307
1318
|
};
|
|
1308
|
-
|
|
1319
|
+
l.fn.atomShow = function(n) {
|
|
1309
1320
|
return this.each(function() {
|
|
1310
|
-
const e =
|
|
1311
|
-
|
|
1321
|
+
const e = l(this);
|
|
1322
|
+
k(this, n, (t) => e.toggle(!!t), "show");
|
|
1312
1323
|
});
|
|
1313
1324
|
};
|
|
1314
|
-
|
|
1325
|
+
l.fn.atomHide = function(n) {
|
|
1315
1326
|
return this.each(function() {
|
|
1316
|
-
const e =
|
|
1317
|
-
|
|
1327
|
+
const e = l(this);
|
|
1328
|
+
k(this, n, (t) => e.toggle(!t), "hide");
|
|
1318
1329
|
});
|
|
1319
1330
|
};
|
|
1320
|
-
|
|
1331
|
+
l.fn.atomVal = function(n, e = {}) {
|
|
1321
1332
|
return this.each(function() {
|
|
1322
1333
|
const t = this.tagName.toLowerCase();
|
|
1323
1334
|
if (!["input", "select", "textarea"].includes(t)) {
|
|
1324
1335
|
console.warn(`[atomVal] Element <${t}> is not a valid input element.`);
|
|
1325
1336
|
return;
|
|
1326
1337
|
}
|
|
1327
|
-
const { effect: s, cleanup: i } =
|
|
1328
|
-
y.trackEffect(this,
|
|
1338
|
+
const { effect: s, cleanup: i } = Je(l(this), n, e);
|
|
1339
|
+
y.trackEffect(this, B(s)), y.trackCleanup(this, i);
|
|
1329
1340
|
});
|
|
1330
1341
|
};
|
|
1331
|
-
|
|
1342
|
+
l.fn.atomChecked = function(n) {
|
|
1332
1343
|
return this.each(function() {
|
|
1333
|
-
const e =
|
|
1334
|
-
if (s.flags &
|
|
1335
|
-
const
|
|
1336
|
-
n.value !==
|
|
1344
|
+
const e = l(this), t = this, s = Ne(), i = () => {
|
|
1345
|
+
if (s.flags & D.Busy) return;
|
|
1346
|
+
const o = t.checked;
|
|
1347
|
+
n.value !== o && (n.value = o);
|
|
1337
1348
|
};
|
|
1338
1349
|
e.on("change", i), y.trackCleanup(this, () => e.off("change", i));
|
|
1339
|
-
const
|
|
1340
|
-
s.flags |=
|
|
1341
|
-
const
|
|
1342
|
-
t.checked !==
|
|
1350
|
+
const r = B(() => {
|
|
1351
|
+
s.flags |= D.SyncingToDom;
|
|
1352
|
+
const o = !!n.value;
|
|
1353
|
+
t.checked !== o && (t.checked = o, b.domUpdated(e, "checked", o)), s.flags &= ~D.SyncingToDom;
|
|
1343
1354
|
});
|
|
1344
|
-
y.trackEffect(this,
|
|
1355
|
+
y.trackEffect(this, r);
|
|
1345
1356
|
});
|
|
1346
1357
|
};
|
|
1347
|
-
|
|
1358
|
+
l.fn.atomOn = function(n, e) {
|
|
1348
1359
|
return this.each(function() {
|
|
1349
|
-
const t =
|
|
1360
|
+
const t = l(this);
|
|
1350
1361
|
t.on(n, e), y.trackCleanup(this, () => t.off(n, e));
|
|
1351
1362
|
});
|
|
1352
1363
|
};
|
|
1353
|
-
|
|
1364
|
+
l.fn.atomUnbind = function() {
|
|
1354
1365
|
return this.each(function() {
|
|
1355
1366
|
y.cleanupTree(this);
|
|
1356
1367
|
});
|
|
1357
1368
|
};
|
|
1358
|
-
const
|
|
1359
|
-
function
|
|
1360
|
-
let e =
|
|
1361
|
-
return e || (e = n.includes("-") ? n.replace(/-./g, (t) => t[1].toUpperCase()) : n,
|
|
1369
|
+
const $e = /* @__PURE__ */ Object.create(null);
|
|
1370
|
+
function Ot(n) {
|
|
1371
|
+
let e = $e[n];
|
|
1372
|
+
return e || (e = n.includes("-") ? n.replace(/-./g, (t) => t[1].toUpperCase()) : n, $e[n] = e, e);
|
|
1362
1373
|
}
|
|
1363
|
-
function
|
|
1374
|
+
function wt(n, e) {
|
|
1364
1375
|
const t = n.el;
|
|
1365
|
-
|
|
1376
|
+
k(
|
|
1366
1377
|
t,
|
|
1367
1378
|
e,
|
|
1368
1379
|
(s) => {
|
|
@@ -1372,23 +1383,23 @@ function Dt(n, e) {
|
|
|
1372
1383
|
"text"
|
|
1373
1384
|
);
|
|
1374
1385
|
}
|
|
1375
|
-
function
|
|
1386
|
+
function Rt(n, e) {
|
|
1376
1387
|
const t = n.el;
|
|
1377
|
-
|
|
1388
|
+
k(
|
|
1378
1389
|
t,
|
|
1379
1390
|
e,
|
|
1380
1391
|
(s) => {
|
|
1381
|
-
const i = String(s ?? ""),
|
|
1382
|
-
|
|
1383
|
-
const
|
|
1384
|
-
t.innerHTML !==
|
|
1392
|
+
const i = String(s ?? ""), r = se(i);
|
|
1393
|
+
r !== i && console.warn("[atomBind] Unsafe content neutralized during sanitization.");
|
|
1394
|
+
const o = r;
|
|
1395
|
+
t.innerHTML !== o && (t.innerHTML = o);
|
|
1385
1396
|
},
|
|
1386
1397
|
"html"
|
|
1387
1398
|
);
|
|
1388
1399
|
}
|
|
1389
|
-
function
|
|
1400
|
+
function Nt(n, e) {
|
|
1390
1401
|
for (const t in e)
|
|
1391
|
-
|
|
1402
|
+
k(
|
|
1392
1403
|
n.el,
|
|
1393
1404
|
e[t],
|
|
1394
1405
|
(s) => {
|
|
@@ -1397,33 +1408,47 @@ function Tt(n, e) {
|
|
|
1397
1408
|
`class.${t}`
|
|
1398
1409
|
);
|
|
1399
1410
|
}
|
|
1400
|
-
function
|
|
1411
|
+
function At(n, e) {
|
|
1401
1412
|
const t = n.el, s = t.style;
|
|
1402
1413
|
for (const i in e) {
|
|
1403
|
-
const
|
|
1404
|
-
if (
|
|
1405
|
-
const
|
|
1406
|
-
Array.isArray(
|
|
1414
|
+
const r = e[i];
|
|
1415
|
+
if (r === void 0) continue;
|
|
1416
|
+
const o = Ot(i);
|
|
1417
|
+
Array.isArray(r) ? k(
|
|
1407
1418
|
t,
|
|
1408
|
-
|
|
1419
|
+
r[0],
|
|
1409
1420
|
(c) => {
|
|
1410
|
-
|
|
1421
|
+
const a = `${c}${r[1]}`;
|
|
1422
|
+
if (ke(a)) {
|
|
1423
|
+
console.warn(`[atomBind] Blocked dangerous value in "${i}" property.`);
|
|
1424
|
+
return;
|
|
1425
|
+
}
|
|
1426
|
+
s[o] = a;
|
|
1411
1427
|
},
|
|
1412
1428
|
`css.${i}`
|
|
1413
|
-
) :
|
|
1429
|
+
) : k(
|
|
1414
1430
|
t,
|
|
1415
|
-
|
|
1431
|
+
r,
|
|
1416
1432
|
(c) => {
|
|
1417
|
-
|
|
1433
|
+
const a = String(c);
|
|
1434
|
+
if (ke(a)) {
|
|
1435
|
+
console.warn(`[atomBind] Blocked dangerous value in "${i}" property.`);
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
s[o] = a;
|
|
1418
1439
|
},
|
|
1419
1440
|
`css.${i}`
|
|
1420
1441
|
);
|
|
1421
1442
|
}
|
|
1422
1443
|
}
|
|
1423
|
-
function
|
|
1444
|
+
function Lt(n, e) {
|
|
1424
1445
|
const t = n.el;
|
|
1425
|
-
for (const s in e)
|
|
1426
|
-
|
|
1446
|
+
for (const s in e) {
|
|
1447
|
+
if (/^on/i.test(s)) {
|
|
1448
|
+
console.warn(`[atomBind] Blocked setting dangerous event handler attribute "${s}".`);
|
|
1449
|
+
continue;
|
|
1450
|
+
}
|
|
1451
|
+
k(
|
|
1427
1452
|
t,
|
|
1428
1453
|
e[s],
|
|
1429
1454
|
(i) => {
|
|
@@ -1431,16 +1456,28 @@ function kt(n, e) {
|
|
|
1431
1456
|
t.removeAttribute(s);
|
|
1432
1457
|
return;
|
|
1433
1458
|
}
|
|
1434
|
-
const
|
|
1435
|
-
|
|
1459
|
+
const r = i === !0 ? s : String(i);
|
|
1460
|
+
if (We(s, r)) {
|
|
1461
|
+
console.warn(`[atomBind] Blocked dangerous protocol in "${s}" attribute.`);
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1464
|
+
t.getAttribute(s) !== r && t.setAttribute(s, r);
|
|
1436
1465
|
},
|
|
1437
1466
|
`attr.${s}`
|
|
1438
1467
|
);
|
|
1468
|
+
}
|
|
1439
1469
|
}
|
|
1440
|
-
|
|
1470
|
+
const xt = ["innerHTML", "outerHTML"];
|
|
1471
|
+
function Ut(n, e) {
|
|
1441
1472
|
const t = n.el;
|
|
1442
|
-
for (const s in e)
|
|
1443
|
-
|
|
1473
|
+
for (const s in e) {
|
|
1474
|
+
if (xt.includes(s)) {
|
|
1475
|
+
console.warn(
|
|
1476
|
+
`[atomBind] Blocked setting dangerous property "${s}". Use html binding for sanitized HTML.`
|
|
1477
|
+
);
|
|
1478
|
+
continue;
|
|
1479
|
+
}
|
|
1480
|
+
k(
|
|
1444
1481
|
n.el,
|
|
1445
1482
|
e[s],
|
|
1446
1483
|
(i) => {
|
|
@@ -1448,10 +1485,11 @@ function wt(n, e) {
|
|
|
1448
1485
|
},
|
|
1449
1486
|
`prop.${s}`
|
|
1450
1487
|
);
|
|
1488
|
+
}
|
|
1451
1489
|
}
|
|
1452
|
-
function
|
|
1490
|
+
function Pt(n, e) {
|
|
1453
1491
|
const t = n.el;
|
|
1454
|
-
|
|
1492
|
+
k(
|
|
1455
1493
|
t,
|
|
1456
1494
|
e,
|
|
1457
1495
|
(s) => {
|
|
@@ -1460,9 +1498,9 @@ function Nt(n, e) {
|
|
|
1460
1498
|
"show"
|
|
1461
1499
|
);
|
|
1462
1500
|
}
|
|
1463
|
-
function
|
|
1501
|
+
function Ft(n, e) {
|
|
1464
1502
|
const t = n.el;
|
|
1465
|
-
|
|
1503
|
+
k(
|
|
1466
1504
|
t,
|
|
1467
1505
|
e,
|
|
1468
1506
|
(s) => {
|
|
@@ -1471,407 +1509,413 @@ function Rt(n, e) {
|
|
|
1471
1509
|
"hide"
|
|
1472
1510
|
);
|
|
1473
1511
|
}
|
|
1474
|
-
function
|
|
1512
|
+
function $t(n, e) {
|
|
1475
1513
|
const t = n.el.tagName.toLowerCase();
|
|
1476
1514
|
if (!["input", "select", "textarea"].includes(t)) {
|
|
1477
1515
|
console.warn(`[atomBind] Val binding used on non-input element <${t}>.`);
|
|
1478
1516
|
return;
|
|
1479
1517
|
}
|
|
1480
|
-
const s = Array.isArray(e), { effect: i, cleanup:
|
|
1518
|
+
const s = Array.isArray(e), { effect: i, cleanup: r } = Je(
|
|
1481
1519
|
n.$el,
|
|
1482
1520
|
s ? e[0] : e,
|
|
1483
1521
|
s ? e[1] : {}
|
|
1484
1522
|
);
|
|
1485
|
-
y.trackEffect(n.el,
|
|
1523
|
+
y.trackEffect(n.el, B(i)), n.trackCleanup(r);
|
|
1486
1524
|
}
|
|
1487
|
-
function
|
|
1488
|
-
const t = n.el, s =
|
|
1489
|
-
if (s.flags &
|
|
1490
|
-
const
|
|
1491
|
-
e.value !==
|
|
1525
|
+
function Mt(n, e) {
|
|
1526
|
+
const t = n.el, s = Ne(), i = () => {
|
|
1527
|
+
if (s.flags & D.Busy) return;
|
|
1528
|
+
const o = t.checked;
|
|
1529
|
+
e.value !== o && (e.value = o);
|
|
1492
1530
|
};
|
|
1493
1531
|
t.addEventListener("change", i), n.trackCleanup(() => t.removeEventListener("change", i));
|
|
1494
|
-
const
|
|
1495
|
-
s.flags |=
|
|
1496
|
-
const
|
|
1497
|
-
t.checked !==
|
|
1532
|
+
const r = B(() => {
|
|
1533
|
+
s.flags |= D.SyncingToDom;
|
|
1534
|
+
const o = !!e.value;
|
|
1535
|
+
t.checked !== o && (t.checked = o, b.enabled && b.domUpdated(t, "checked", o)), s.flags &= ~D.SyncingToDom;
|
|
1498
1536
|
});
|
|
1499
|
-
y.trackEffect(t,
|
|
1537
|
+
y.trackEffect(t, r);
|
|
1500
1538
|
}
|
|
1501
|
-
function
|
|
1539
|
+
function Bt(n, e) {
|
|
1502
1540
|
for (const t in e) {
|
|
1503
1541
|
const s = e[t];
|
|
1504
1542
|
if (typeof s != "function") continue;
|
|
1505
|
-
const i = (
|
|
1506
|
-
|
|
1543
|
+
const i = (r) => {
|
|
1544
|
+
Re(
|
|
1507
1545
|
() => s.call(
|
|
1508
1546
|
n.el,
|
|
1509
|
-
|
|
1547
|
+
l.Event(r.type, { originalEvent: r })
|
|
1510
1548
|
)
|
|
1511
1549
|
);
|
|
1512
1550
|
};
|
|
1513
1551
|
n.el.addEventListener(t, i), n.trackCleanup(() => n.el.removeEventListener(t, i));
|
|
1514
1552
|
}
|
|
1515
1553
|
}
|
|
1516
|
-
|
|
1554
|
+
l.fn.atomBind = function(n) {
|
|
1517
1555
|
return this.each(function() {
|
|
1518
1556
|
const e = this;
|
|
1519
1557
|
let t = null;
|
|
1520
1558
|
const s = {
|
|
1521
1559
|
get $el() {
|
|
1522
|
-
return t || (t =
|
|
1560
|
+
return t || (t = l(e)), t;
|
|
1523
1561
|
},
|
|
1524
1562
|
el: e,
|
|
1525
1563
|
trackCleanup: (i) => y.trackCleanup(e, i)
|
|
1526
1564
|
};
|
|
1527
|
-
n.text !== void 0 &&
|
|
1565
|
+
n.text !== void 0 && wt(s, n.text), n.html !== void 0 && Rt(s, n.html), n.class && Nt(s, n.class), n.css && At(s, n.css), n.attr && Lt(s, n.attr), n.prop && Ut(s, n.prop), n.show !== void 0 && Pt(s, n.show), n.hide !== void 0 && Ft(s, n.hide), n.val !== void 0 && $t(s, n.val), n.checked !== void 0 && Mt(s, n.checked), n.on && Bt(s, n.on);
|
|
1528
1566
|
});
|
|
1529
1567
|
};
|
|
1530
|
-
|
|
1531
|
-
const { key: t, render: s, bind: i, update:
|
|
1568
|
+
l.fn.atomList = function(n, e) {
|
|
1569
|
+
const { key: t, render: s, bind: i, update: r, onAdd: o, onRemove: c, empty: a } = e, _ = typeof t == "function" ? t : (g, v) => g[t];
|
|
1532
1570
|
return this.each(function() {
|
|
1533
|
-
const g =
|
|
1534
|
-
let
|
|
1535
|
-
const w =
|
|
1536
|
-
const
|
|
1537
|
-
if (
|
|
1538
|
-
|
|
1571
|
+
const g = l(this), v = be(this), I = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Set();
|
|
1572
|
+
let N = [], $ = null;
|
|
1573
|
+
const w = B(() => {
|
|
1574
|
+
const R = n.value, A = R.length;
|
|
1575
|
+
if (A === 0) {
|
|
1576
|
+
if (a && !$) {
|
|
1577
|
+
const u = typeof a == "string" ? se(a) : a;
|
|
1578
|
+
$ = l(u).appendTo(g);
|
|
1579
|
+
}
|
|
1580
|
+
} else $ && ($.remove(), $ = null);
|
|
1581
|
+
if (A === 0 && I.size === 0) {
|
|
1582
|
+
N = [];
|
|
1539
1583
|
return;
|
|
1540
1584
|
}
|
|
1541
|
-
b.log("list", `${v} updating with ${
|
|
1542
|
-
const
|
|
1543
|
-
for (let
|
|
1544
|
-
|
|
1545
|
-
const
|
|
1546
|
-
for (let
|
|
1547
|
-
const E =
|
|
1548
|
-
|
|
1585
|
+
b.log("list", `${v} updating with ${A} items`);
|
|
1586
|
+
const x = /* @__PURE__ */ new Map(), K = N.length;
|
|
1587
|
+
for (let u = 0; u < K; u++)
|
|
1588
|
+
x.set(N[u], u);
|
|
1589
|
+
const U = new Array(A), J = /* @__PURE__ */ new Set(), ae = new Int32Array(A);
|
|
1590
|
+
for (let u = 0; u < A; u++) {
|
|
1591
|
+
const E = R[u], f = _(E, u);
|
|
1592
|
+
J.has(f) && console.warn(`[atomList] Duplicate key "${f}" at index ${u}.`), U[u] = f, J.add(f), ae[u] = x.get(f) ?? -1;
|
|
1549
1593
|
}
|
|
1550
|
-
if (
|
|
1551
|
-
for (const [
|
|
1552
|
-
if (
|
|
1594
|
+
if (I.size > 0)
|
|
1595
|
+
for (const [u, E] of I) {
|
|
1596
|
+
if (J.has(u) || O.has(u)) continue;
|
|
1553
1597
|
const f = () => {
|
|
1554
|
-
E.$el.remove(), E.$el[0] && y.cleanup(E.$el[0]),
|
|
1598
|
+
E.$el.remove(), E.$el[0] && y.cleanup(E.$el[0]), O.delete(u), b.log("list", `${v} removed item:`, u);
|
|
1555
1599
|
};
|
|
1556
|
-
if (
|
|
1600
|
+
if (I.delete(u), O.add(u), c) {
|
|
1557
1601
|
const p = c(E.$el);
|
|
1558
1602
|
p instanceof Promise ? p.then(f) : f();
|
|
1559
1603
|
} else
|
|
1560
1604
|
f();
|
|
1561
1605
|
}
|
|
1562
|
-
if (
|
|
1563
|
-
|
|
1606
|
+
if (A === 0) {
|
|
1607
|
+
N = [];
|
|
1564
1608
|
return;
|
|
1565
1609
|
}
|
|
1566
|
-
const te =
|
|
1610
|
+
const te = Ct(ae);
|
|
1567
1611
|
let ne = te.length - 1, h = null;
|
|
1568
|
-
for (let
|
|
1569
|
-
const E =
|
|
1612
|
+
for (let u = A - 1; u >= 0; u--) {
|
|
1613
|
+
const E = U[u], f = R[u], p = I.get(E);
|
|
1570
1614
|
if (p) {
|
|
1571
|
-
const
|
|
1615
|
+
const S = p.item;
|
|
1572
1616
|
p.item = f;
|
|
1573
|
-
const
|
|
1574
|
-
if (!
|
|
1575
|
-
if (
|
|
1576
|
-
|
|
1577
|
-
else if (
|
|
1578
|
-
let
|
|
1579
|
-
if (typeof
|
|
1580
|
-
|
|
1581
|
-
let
|
|
1582
|
-
const
|
|
1583
|
-
for (const
|
|
1584
|
-
if (
|
|
1585
|
-
|
|
1617
|
+
const C = p.$el[0];
|
|
1618
|
+
if (!C) continue;
|
|
1619
|
+
if (r)
|
|
1620
|
+
r(p.$el, f, u), b.domUpdated(p.$el, "list.update", f);
|
|
1621
|
+
else if (S !== f) {
|
|
1622
|
+
let m = !0;
|
|
1623
|
+
if (typeof S == "object" && S !== null && typeof f == "object" && f !== null) {
|
|
1624
|
+
m = !1;
|
|
1625
|
+
let G = 0;
|
|
1626
|
+
const ue = S, V = f;
|
|
1627
|
+
for (const H in ue) {
|
|
1628
|
+
if (ue[H] !== V[H]) {
|
|
1629
|
+
m = !0;
|
|
1586
1630
|
break;
|
|
1587
1631
|
}
|
|
1588
|
-
|
|
1632
|
+
G++;
|
|
1589
1633
|
}
|
|
1590
|
-
if (!
|
|
1591
|
-
let
|
|
1592
|
-
for (const
|
|
1593
|
-
if (
|
|
1594
|
-
|
|
1634
|
+
if (!m) {
|
|
1635
|
+
let H = 0;
|
|
1636
|
+
for (const Ht in V)
|
|
1637
|
+
if (H++, H > G) {
|
|
1638
|
+
m = !0;
|
|
1595
1639
|
break;
|
|
1596
1640
|
}
|
|
1597
|
-
|
|
1641
|
+
G !== H && (m = !0);
|
|
1598
1642
|
}
|
|
1599
1643
|
}
|
|
1600
|
-
if (
|
|
1601
|
-
const
|
|
1602
|
-
p.$el.replaceWith(
|
|
1644
|
+
if (m) {
|
|
1645
|
+
const G = s(f, u), ue = typeof G == "string" ? se(G) : G, V = l(ue), H = h === C;
|
|
1646
|
+
p.$el.replaceWith(V), p.$el = V, i && i(V, f, u), b.domUpdated(V, "list.render", f), H && (h = V[0] || null);
|
|
1603
1647
|
}
|
|
1604
1648
|
}
|
|
1605
|
-
if (ne >= 0 && te[ne] ===
|
|
1649
|
+
if (ne >= 0 && te[ne] === u)
|
|
1606
1650
|
ne--;
|
|
1607
1651
|
else {
|
|
1608
|
-
const
|
|
1609
|
-
h?.isConnected ? h !==
|
|
1652
|
+
const m = p.$el[0];
|
|
1653
|
+
h?.isConnected ? h !== m && p.$el.insertBefore(h) : p.$el.appendTo(g);
|
|
1610
1654
|
}
|
|
1611
1655
|
h = p.$el[0] || null;
|
|
1612
1656
|
} else {
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1657
|
+
const S = s(f, u), C = typeof S == "string" ? se(S) : S, m = l(C);
|
|
1658
|
+
I.set(E, { $el: m, item: f }), h?.isConnected ? m.insertBefore(h) : m.appendTo(g), i && i(m, f, u), o && o(m), b.domUpdated(m, "list.add", f), h = m[0] || null;
|
|
1615
1659
|
}
|
|
1616
1660
|
}
|
|
1617
|
-
|
|
1661
|
+
N = U;
|
|
1618
1662
|
});
|
|
1619
1663
|
y.trackEffect(this, w), y.trackCleanup(this, () => {
|
|
1620
|
-
|
|
1664
|
+
I.clear(), O.clear(), N = [], $?.remove();
|
|
1621
1665
|
});
|
|
1622
1666
|
});
|
|
1623
1667
|
};
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1668
|
+
const pe = /* @__PURE__ */ new WeakMap();
|
|
1669
|
+
l.fn.atomMount = function(n, e = {}) {
|
|
1626
1670
|
return this.each(function() {
|
|
1627
|
-
const t = b.enabled, s = t ?
|
|
1671
|
+
const t = b.enabled, s = t ? be(this) : "", i = pe.get(this);
|
|
1628
1672
|
i && (t && b.log("mount", `${s} unmounting existing component`), i()), t && b.log("mount", `${s} mounting component`);
|
|
1629
|
-
let
|
|
1673
|
+
let r;
|
|
1630
1674
|
try {
|
|
1631
|
-
|
|
1675
|
+
r = n(l(this), e);
|
|
1632
1676
|
} catch (c) {
|
|
1633
1677
|
console.error("[atom-effect-jquery] Mount error:", c);
|
|
1634
1678
|
return;
|
|
1635
1679
|
}
|
|
1636
|
-
const
|
|
1637
|
-
if (
|
|
1638
|
-
if (t && b.log("mount", `${s} full cleanup`), typeof
|
|
1680
|
+
const o = () => {
|
|
1681
|
+
if (pe.delete(this)) {
|
|
1682
|
+
if (t && b.log("mount", `${s} full cleanup`), typeof r == "function")
|
|
1639
1683
|
try {
|
|
1640
|
-
|
|
1684
|
+
r();
|
|
1641
1685
|
} catch (c) {
|
|
1642
1686
|
console.error("[atom-effect-jquery] Cleanup error:", c);
|
|
1643
1687
|
}
|
|
1644
1688
|
y.cleanupTree(this);
|
|
1645
1689
|
}
|
|
1646
1690
|
};
|
|
1647
|
-
|
|
1691
|
+
pe.set(this, o), y.trackCleanup(this, o);
|
|
1648
1692
|
});
|
|
1649
1693
|
};
|
|
1650
|
-
|
|
1694
|
+
l.fn.atomUnmount = function() {
|
|
1651
1695
|
return this.each(function() {
|
|
1652
|
-
const n =
|
|
1696
|
+
const n = pe.get(this);
|
|
1653
1697
|
n && n();
|
|
1654
1698
|
});
|
|
1655
1699
|
};
|
|
1656
|
-
const
|
|
1657
|
-
function
|
|
1700
|
+
const fe = "[$.route]";
|
|
1701
|
+
function Vt(n) {
|
|
1658
1702
|
const {
|
|
1659
1703
|
target: e,
|
|
1660
1704
|
default: t,
|
|
1661
1705
|
routes: s,
|
|
1662
1706
|
notFound: i,
|
|
1663
|
-
autoBindLinks:
|
|
1664
|
-
activeClass:
|
|
1707
|
+
autoBindLinks: r = !1,
|
|
1708
|
+
activeClass: o = "active",
|
|
1665
1709
|
beforeTransition: c,
|
|
1666
|
-
afterTransition:
|
|
1710
|
+
afterTransition: a
|
|
1667
1711
|
} = n;
|
|
1668
1712
|
let _ = !1, g = null, v = window.location.hash;
|
|
1669
|
-
const
|
|
1670
|
-
const h = window.location.hash,
|
|
1671
|
-
return (
|
|
1713
|
+
const I = [], O = /* @__PURE__ */ new Set(), N = l(e), $ = () => {
|
|
1714
|
+
const h = window.location.hash, u = h.indexOf("?");
|
|
1715
|
+
return (u === -1 ? h.substring(1) : h.substring(1, u)) || t;
|
|
1672
1716
|
}, w = (h) => {
|
|
1673
|
-
const
|
|
1674
|
-
if (
|
|
1717
|
+
const u = h.indexOf("?");
|
|
1718
|
+
if (u === -1) return {};
|
|
1675
1719
|
const E = {}, f = h.length;
|
|
1676
|
-
let p =
|
|
1677
|
-
const
|
|
1720
|
+
let p = u + 1;
|
|
1721
|
+
const S = (C) => {
|
|
1678
1722
|
try {
|
|
1679
|
-
return decodeURIComponent(
|
|
1723
|
+
return decodeURIComponent(C);
|
|
1680
1724
|
} catch {
|
|
1681
|
-
return console.warn(`${
|
|
1725
|
+
return console.warn(`${fe} Malformed URI component: ${C}`), C;
|
|
1682
1726
|
}
|
|
1683
1727
|
};
|
|
1684
1728
|
for (; p < f; ) {
|
|
1685
|
-
let
|
|
1686
|
-
if (
|
|
1687
|
-
const
|
|
1688
|
-
|
|
1689
|
-
h.substring(
|
|
1690
|
-
) : E[
|
|
1729
|
+
let C = h.indexOf("&", p);
|
|
1730
|
+
if (C === -1 && (C = f), C > p) {
|
|
1731
|
+
const m = h.indexOf("=", p);
|
|
1732
|
+
m !== -1 && m < C ? E[S(h.substring(p, m))] = S(
|
|
1733
|
+
h.substring(m + 1, C)
|
|
1734
|
+
) : E[S(h.substring(p, C))] = "";
|
|
1691
1735
|
}
|
|
1692
|
-
p =
|
|
1736
|
+
p = C + 1;
|
|
1693
1737
|
}
|
|
1694
1738
|
return E;
|
|
1695
|
-
},
|
|
1696
|
-
let
|
|
1697
|
-
return !
|
|
1698
|
-
},
|
|
1699
|
-
const
|
|
1700
|
-
if (!
|
|
1701
|
-
return console.warn(`${
|
|
1702
|
-
const E =
|
|
1703
|
-
return
|
|
1704
|
-
},
|
|
1739
|
+
}, R = (h) => {
|
|
1740
|
+
let u = s[h];
|
|
1741
|
+
return !u && i && (u = s[i]), u || (console.warn(`${fe} Route "${h}" not found and no notFound route configured`), null);
|
|
1742
|
+
}, A = (h) => {
|
|
1743
|
+
const u = document.querySelector(h);
|
|
1744
|
+
if (!u?.content)
|
|
1745
|
+
return console.warn(`${fe} Template "${h}" not found`), !1;
|
|
1746
|
+
const E = u.content.cloneNode(!0);
|
|
1747
|
+
return N.append(E), !0;
|
|
1748
|
+
}, x = Xe($()), K = (h) => {
|
|
1705
1749
|
if (_) return;
|
|
1706
|
-
const
|
|
1707
|
-
if (!
|
|
1708
|
-
console.warn(`${
|
|
1750
|
+
const u = N[0];
|
|
1751
|
+
if (!u) {
|
|
1752
|
+
console.warn(`${fe} Target element "${e}" not found`);
|
|
1709
1753
|
return;
|
|
1710
1754
|
}
|
|
1711
|
-
const E =
|
|
1755
|
+
const E = R(h);
|
|
1712
1756
|
if (!E) return;
|
|
1713
1757
|
const f = w(window.location.hash);
|
|
1714
|
-
c && c(g || h, h),
|
|
1758
|
+
c && c(g || h, h), N.empty();
|
|
1715
1759
|
let p = f;
|
|
1716
1760
|
if (E.onEnter) {
|
|
1717
|
-
const
|
|
1718
|
-
|
|
1761
|
+
const S = E.onEnter(f);
|
|
1762
|
+
S !== void 0 && (p = { ...f, ...S });
|
|
1719
1763
|
}
|
|
1720
|
-
E.render ? E.render(
|
|
1721
|
-
},
|
|
1764
|
+
E.render ? E.render(u, h, p) : E.template && A(E.template), a && a(g || h, h), g = h;
|
|
1765
|
+
}, U = (h) => {
|
|
1722
1766
|
if (_) return;
|
|
1723
|
-
const
|
|
1724
|
-
E?.onLeave && E.onLeave() === !1 || (v = `#${h}`, window.location.hash = v,
|
|
1725
|
-
},
|
|
1767
|
+
const u = x.value, E = s[u];
|
|
1768
|
+
E?.onLeave && E.onLeave() === !1 || (v = `#${h}`, window.location.hash = v, x.value = h);
|
|
1769
|
+
}, J = () => {
|
|
1726
1770
|
if (_) return;
|
|
1727
1771
|
const h = window.location.hash;
|
|
1728
1772
|
if (h === v) return;
|
|
1729
|
-
const
|
|
1730
|
-
if (E !==
|
|
1773
|
+
const u = $(), E = x.value;
|
|
1774
|
+
if (E !== u) {
|
|
1731
1775
|
const f = s[E];
|
|
1732
1776
|
if (f?.onLeave && f.onLeave() === !1) {
|
|
1733
1777
|
window.location.hash = v;
|
|
1734
1778
|
return;
|
|
1735
1779
|
}
|
|
1736
|
-
|
|
1780
|
+
x.value = u;
|
|
1737
1781
|
} else
|
|
1738
|
-
|
|
1782
|
+
K(u);
|
|
1739
1783
|
v = h;
|
|
1740
|
-
},
|
|
1741
|
-
if (!
|
|
1784
|
+
}, ae = () => {
|
|
1785
|
+
if (!r) return;
|
|
1742
1786
|
const h = (f) => {
|
|
1743
1787
|
f.preventDefault();
|
|
1744
|
-
const p =
|
|
1745
|
-
|
|
1788
|
+
const p = l(f.currentTarget).data("route");
|
|
1789
|
+
U(p);
|
|
1746
1790
|
};
|
|
1747
|
-
|
|
1748
|
-
|
|
1791
|
+
l(document).on("click", "[data-route]", h), I.push(() => {
|
|
1792
|
+
l(document).off("click", "[data-route]", h);
|
|
1749
1793
|
});
|
|
1750
|
-
const
|
|
1751
|
-
if (
|
|
1752
|
-
const p =
|
|
1753
|
-
|
|
1754
|
-
const
|
|
1755
|
-
const
|
|
1756
|
-
p.toggleClass(
|
|
1794
|
+
const u = (f) => {
|
|
1795
|
+
if (O.has(f)) return;
|
|
1796
|
+
const p = l(f), S = p.data("route");
|
|
1797
|
+
O.add(f);
|
|
1798
|
+
const C = B(() => {
|
|
1799
|
+
const m = x.value === S;
|
|
1800
|
+
p.toggleClass(o, m), m ? p.attr("aria-current", "page") : p.removeAttr("aria-current");
|
|
1757
1801
|
});
|
|
1758
|
-
y.trackEffect(f,
|
|
1759
|
-
|
|
1802
|
+
y.trackEffect(f, C), y.trackCleanup(f, () => {
|
|
1803
|
+
O.delete(f);
|
|
1760
1804
|
});
|
|
1761
1805
|
};
|
|
1762
|
-
|
|
1763
|
-
|
|
1806
|
+
l("[data-route]").each(function() {
|
|
1807
|
+
u(this);
|
|
1764
1808
|
});
|
|
1765
1809
|
const E = new MutationObserver((f) => {
|
|
1766
1810
|
for (const p of f)
|
|
1767
|
-
p.type === "childList" && p.addedNodes.forEach((
|
|
1768
|
-
if (
|
|
1769
|
-
const
|
|
1770
|
-
|
|
1771
|
-
(
|
|
1811
|
+
p.type === "childList" && p.addedNodes.forEach((S) => {
|
|
1812
|
+
if (S.nodeType === 1) {
|
|
1813
|
+
const C = S;
|
|
1814
|
+
C.matches?.("[data-route]") && u(C), C.querySelectorAll && C.querySelectorAll("[data-route]").forEach(
|
|
1815
|
+
(m) => u(m)
|
|
1772
1816
|
);
|
|
1773
1817
|
}
|
|
1774
1818
|
});
|
|
1775
1819
|
});
|
|
1776
|
-
E.observe(document.body, { childList: !0, subtree: !0 }),
|
|
1820
|
+
E.observe(document.body, { childList: !0, subtree: !0 }), I.push(() => E.disconnect());
|
|
1777
1821
|
}, te = () => {
|
|
1778
|
-
_ || (_ = !0,
|
|
1822
|
+
_ || (_ = !0, I.forEach((h) => h()), I.length = 0, O.forEach((h) => y.cleanup(h)), O.clear());
|
|
1779
1823
|
};
|
|
1780
|
-
window.addEventListener("hashchange",
|
|
1781
|
-
const ne =
|
|
1782
|
-
|
|
1824
|
+
window.addEventListener("hashchange", J), I.push(() => window.removeEventListener("hashchange", J));
|
|
1825
|
+
const ne = B(() => {
|
|
1826
|
+
K(x.value);
|
|
1783
1827
|
});
|
|
1784
|
-
return
|
|
1785
|
-
currentRoute:
|
|
1786
|
-
navigate:
|
|
1828
|
+
return I.push(() => ne.dispose()), ae(), N[0] && y.trackCleanup(N[0], te), {
|
|
1829
|
+
currentRoute: x,
|
|
1830
|
+
navigate: U,
|
|
1787
1831
|
destroy: te
|
|
1788
1832
|
};
|
|
1789
1833
|
}
|
|
1790
|
-
|
|
1791
|
-
route:
|
|
1834
|
+
l.extend({
|
|
1835
|
+
route: Vt
|
|
1792
1836
|
});
|
|
1793
|
-
const
|
|
1794
|
-
let
|
|
1795
|
-
const
|
|
1796
|
-
let e =
|
|
1837
|
+
const ge = /* @__PURE__ */ new WeakMap();
|
|
1838
|
+
let Me = !1;
|
|
1839
|
+
const Be = (n) => {
|
|
1840
|
+
let e = ge.get(n);
|
|
1797
1841
|
return e || (e = function(...t) {
|
|
1798
|
-
return
|
|
1799
|
-
},
|
|
1842
|
+
return Re(() => n.apply(this, t));
|
|
1843
|
+
}, ge.set(n, e)), e;
|
|
1800
1844
|
};
|
|
1801
|
-
function
|
|
1802
|
-
if (
|
|
1803
|
-
|
|
1804
|
-
const n =
|
|
1805
|
-
|
|
1806
|
-
const
|
|
1807
|
-
for (let c = 0,
|
|
1808
|
-
const _ =
|
|
1845
|
+
function Ze() {
|
|
1846
|
+
if (Me) return;
|
|
1847
|
+
Me = !0;
|
|
1848
|
+
const n = l.fn.on, e = l.fn.off, t = l.fn.remove, s = l.fn.empty, i = l.fn.detach;
|
|
1849
|
+
l.fn.remove = function(r) {
|
|
1850
|
+
const o = r ? this.filter(r) : this;
|
|
1851
|
+
for (let c = 0, a = o.length; c < a; c++) {
|
|
1852
|
+
const _ = o[c];
|
|
1809
1853
|
_ && (y.cleanupTree(_), y.markIgnored(_));
|
|
1810
1854
|
}
|
|
1811
|
-
return t.call(this,
|
|
1812
|
-
},
|
|
1813
|
-
for (let
|
|
1814
|
-
const c = this[
|
|
1855
|
+
return t.call(this, r);
|
|
1856
|
+
}, l.fn.empty = function() {
|
|
1857
|
+
for (let r = 0, o = this.length; r < o; r++) {
|
|
1858
|
+
const c = this[r];
|
|
1815
1859
|
c && y.cleanupDescendants(c);
|
|
1816
1860
|
}
|
|
1817
1861
|
return s.call(this);
|
|
1818
|
-
},
|
|
1819
|
-
const
|
|
1820
|
-
for (let c = 0,
|
|
1821
|
-
const _ =
|
|
1862
|
+
}, l.fn.detach = function(r) {
|
|
1863
|
+
const o = r ? this.filter(r) : this;
|
|
1864
|
+
for (let c = 0, a = o.length; c < a; c++) {
|
|
1865
|
+
const _ = o[c];
|
|
1822
1866
|
_ && y.keep(_);
|
|
1823
1867
|
}
|
|
1824
|
-
return i.call(this,
|
|
1825
|
-
},
|
|
1826
|
-
const
|
|
1827
|
-
if (
|
|
1828
|
-
const c =
|
|
1868
|
+
return i.call(this, r);
|
|
1869
|
+
}, l.fn.on = function(...r) {
|
|
1870
|
+
const o = r[0];
|
|
1871
|
+
if (o && typeof o == "object") {
|
|
1872
|
+
const c = o, a = {};
|
|
1829
1873
|
for (const _ in c) {
|
|
1830
1874
|
const g = c[_];
|
|
1831
|
-
g && (
|
|
1875
|
+
g && (a[_] = Be(g));
|
|
1832
1876
|
}
|
|
1833
|
-
|
|
1877
|
+
r[0] = a;
|
|
1834
1878
|
} else
|
|
1835
|
-
for (let c =
|
|
1836
|
-
if (typeof
|
|
1837
|
-
|
|
1879
|
+
for (let c = r.length - 1; c >= 0; c--)
|
|
1880
|
+
if (typeof r[c] == "function") {
|
|
1881
|
+
r[c] = Be(r[c]);
|
|
1838
1882
|
break;
|
|
1839
1883
|
}
|
|
1840
|
-
return n.apply(this,
|
|
1841
|
-
},
|
|
1842
|
-
const
|
|
1843
|
-
if (
|
|
1844
|
-
const c =
|
|
1884
|
+
return n.apply(this, r);
|
|
1885
|
+
}, l.fn.off = function(...r) {
|
|
1886
|
+
const o = r[0];
|
|
1887
|
+
if (o && typeof o == "object") {
|
|
1888
|
+
const c = o, a = {};
|
|
1845
1889
|
for (const _ in c) {
|
|
1846
1890
|
const g = c[_];
|
|
1847
|
-
g && (
|
|
1891
|
+
g && (a[_] = ge.get(g) || g);
|
|
1848
1892
|
}
|
|
1849
|
-
|
|
1893
|
+
r[0] = a;
|
|
1850
1894
|
} else
|
|
1851
|
-
for (let c =
|
|
1852
|
-
if (typeof
|
|
1853
|
-
|
|
1895
|
+
for (let c = r.length - 1; c >= 0; c--)
|
|
1896
|
+
if (typeof r[c] == "function") {
|
|
1897
|
+
r[c] = ge.get(r[c]) || r[c];
|
|
1854
1898
|
break;
|
|
1855
1899
|
}
|
|
1856
|
-
return e.apply(this,
|
|
1900
|
+
return e.apply(this, r);
|
|
1857
1901
|
};
|
|
1858
1902
|
}
|
|
1859
|
-
const
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1903
|
+
const qt = Ze;
|
|
1904
|
+
Ze();
|
|
1905
|
+
l(() => {
|
|
1906
|
+
kt(document.body);
|
|
1863
1907
|
});
|
|
1864
1908
|
export {
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1909
|
+
Xe as atom,
|
|
1910
|
+
Re as batch,
|
|
1911
|
+
Et as computed,
|
|
1912
|
+
Qt as default,
|
|
1913
|
+
zt as disableAutoCleanup,
|
|
1914
|
+
B as effect,
|
|
1915
|
+
kt as enableAutoCleanup,
|
|
1916
|
+
qt as enablejQueryBatching,
|
|
1917
|
+
Ze as enablejQueryOverrides,
|
|
1874
1918
|
y as registry,
|
|
1875
|
-
|
|
1919
|
+
ht as untracked
|
|
1876
1920
|
};
|
|
1877
1921
|
//# sourceMappingURL=index.mjs.map
|