@but212/atom-effect-jquery 0.22.0 → 0.22.2
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 +2 -1
- package/dist/atom-effect-jquery.min.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +972 -935
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { default as
|
|
1
|
+
import l from "jquery";
|
|
2
|
+
import { default as Ys } from "jquery";
|
|
3
3
|
const ut = {
|
|
4
4
|
IDLE: "idle",
|
|
5
5
|
PENDING: "pending",
|
|
6
6
|
RESOLVED: "resolved",
|
|
7
7
|
REJECTED: "rejected"
|
|
8
|
-
},
|
|
8
|
+
}, k = {
|
|
9
9
|
DISPOSED: 1,
|
|
10
10
|
EXECUTING: 8
|
|
11
|
-
},
|
|
11
|
+
}, ue = {
|
|
12
12
|
DISPOSED: 1,
|
|
13
13
|
/** Marker bit: identifies this node as a computed. */
|
|
14
14
|
IS_COMPUTED: 2,
|
|
@@ -19,7 +19,7 @@ const ut = {
|
|
|
19
19
|
REJECTED: 128,
|
|
20
20
|
RECOMPUTING: 256,
|
|
21
21
|
HAS_ERROR: 512
|
|
22
|
-
},
|
|
22
|
+
}, M = {
|
|
23
23
|
DISPOSED: 1,
|
|
24
24
|
SYNC: 8,
|
|
25
25
|
NOTIFICATION_SCHEDULED: 16
|
|
@@ -33,84 +33,84 @@ const ut = {
|
|
|
33
33
|
MIN_FLUSH_ITERATIONS: 10,
|
|
34
34
|
// Memory management
|
|
35
35
|
BATCH_QUEUE_SHRINK_THRESHOLD: 1e3
|
|
36
|
-
},
|
|
36
|
+
}, ke = {
|
|
37
37
|
WARN_INFINITE_LOOP: !0
|
|
38
|
-
},
|
|
38
|
+
}, Zt = {
|
|
39
39
|
MAX_ASYNC_RETRIES: 3,
|
|
40
40
|
MAX_PROMISE_ID: Number.MAX_SAFE_INTEGER - 1
|
|
41
|
-
},
|
|
42
|
-
class
|
|
43
|
-
constructor(t,
|
|
44
|
-
super(t), this.cause =
|
|
41
|
+
}, yt = 1073741823, xe = typeof process < "u" && process.env && !1 || !1, Pe = Object.freeze([]);
|
|
42
|
+
class et extends Error {
|
|
43
|
+
constructor(t, e = null, n = !0) {
|
|
44
|
+
super(t), this.cause = e, this.recoverable = n, this.name = "AtomError";
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
class
|
|
48
|
-
constructor(t,
|
|
49
|
-
super(t,
|
|
47
|
+
class j extends et {
|
|
48
|
+
constructor(t, e = null) {
|
|
49
|
+
super(t, e, !0), this.name = "ComputedError";
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
class
|
|
53
|
-
constructor(t,
|
|
54
|
-
super(t,
|
|
52
|
+
class Z extends et {
|
|
53
|
+
constructor(t, e = null) {
|
|
54
|
+
super(t, e, !1), this.name = "EffectError";
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
class
|
|
58
|
-
constructor(t,
|
|
59
|
-
super(t,
|
|
57
|
+
class Lt extends et {
|
|
58
|
+
constructor(t, e = null) {
|
|
59
|
+
super(t, e, !1), this.name = "SchedulerError";
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
const
|
|
62
|
+
const $e = /* @__PURE__ */ Symbol("AtomEffect.DebugName"), Me = /* @__PURE__ */ Symbol("AtomEffect.Type"), Ut = /* @__PURE__ */ Symbol("AtomEffect.NoDefaultValue"), Ct = {
|
|
63
63
|
// Dev mode flag
|
|
64
|
-
enabled:
|
|
65
|
-
warnInfiniteLoop:
|
|
66
|
-
warn(
|
|
64
|
+
enabled: xe,
|
|
65
|
+
warnInfiniteLoop: ke.WARN_INFINITE_LOOP,
|
|
66
|
+
warn(s, t) {
|
|
67
67
|
},
|
|
68
|
-
checkCircular(
|
|
69
|
-
if (
|
|
70
|
-
throw new
|
|
68
|
+
checkCircular(s, t) {
|
|
69
|
+
if (s === t)
|
|
70
|
+
throw new j("Direct circular dependency detected");
|
|
71
71
|
},
|
|
72
|
-
attachDebugInfo(
|
|
72
|
+
attachDebugInfo(s, t, e) {
|
|
73
73
|
},
|
|
74
|
-
getDebugName: (
|
|
75
|
-
getDebugType: (
|
|
74
|
+
getDebugName: (s) => s?.[$e],
|
|
75
|
+
getDebugType: (s) => s?.[Me]
|
|
76
76
|
};
|
|
77
|
-
let
|
|
78
|
-
const
|
|
79
|
-
function
|
|
77
|
+
let Fe = 1;
|
|
78
|
+
const Be = () => Fe++;
|
|
79
|
+
function fe(s, t, e) {
|
|
80
80
|
if (typeof t == "function") {
|
|
81
81
|
const i = t;
|
|
82
|
-
if (
|
|
83
|
-
|
|
82
|
+
if (e.some((o) => o && o.fn === i)) return;
|
|
83
|
+
e.push(new Mt(i, void 0));
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
if ("addDependency" in t) {
|
|
87
|
-
t.addDependency(
|
|
87
|
+
t.addDependency(s);
|
|
88
88
|
return;
|
|
89
89
|
}
|
|
90
90
|
const n = t;
|
|
91
|
-
|
|
91
|
+
e.some((i) => i && i.sub === n) || e.push(new Mt(void 0, n));
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function te(s, t, e) {
|
|
94
94
|
const n = /* @__PURE__ */ new Map();
|
|
95
95
|
t.forEach((i) => {
|
|
96
96
|
i?.unsub && n.set(i.node, i.unsub);
|
|
97
|
-
}),
|
|
97
|
+
}), s.forEach((i) => {
|
|
98
98
|
if (!i) return;
|
|
99
|
-
const
|
|
100
|
-
|
|
99
|
+
const o = i.node, r = n.get(o);
|
|
100
|
+
r !== void 0 ? (i.unsub = r, n.delete(o)) : (Ct.checkCircular(o, e), i.unsub = o.subscribe(e));
|
|
101
101
|
}), n.forEach((i) => i());
|
|
102
102
|
}
|
|
103
|
-
class
|
|
104
|
-
constructor(t,
|
|
105
|
-
this.node = t, this.version =
|
|
103
|
+
class $t {
|
|
104
|
+
constructor(t, e, n = void 0) {
|
|
105
|
+
this.node = t, this.version = e, this.unsub = n;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
class Mt {
|
|
109
|
-
constructor(t,
|
|
110
|
-
this.fn = t, this.sub =
|
|
109
|
+
constructor(t, e) {
|
|
110
|
+
this.fn = t, this.sub = e;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
const
|
|
113
|
+
const b = {
|
|
114
114
|
// Computed Errors
|
|
115
115
|
COMPUTED_MUST_BE_FUNCTION: "Computed target must be a function",
|
|
116
116
|
COMPUTED_ASYNC_PENDING_NO_DEFAULT: "Async computation pending with no default value",
|
|
@@ -127,7 +127,7 @@ const y = {
|
|
|
127
127
|
EFFECT_CLEANUP_FAILED: "Effect cleanup failed",
|
|
128
128
|
EFFECT_DISPOSED: "Attempted to run disposed effect",
|
|
129
129
|
// Scheduler Errors
|
|
130
|
-
SCHEDULER_FLUSH_OVERFLOW: (
|
|
130
|
+
SCHEDULER_FLUSH_OVERFLOW: (s, t) => `Maximum flush iterations (${s}) exceeded. ${t} jobs dropped. Possible infinite loop.`,
|
|
131
131
|
// System / Debug
|
|
132
132
|
CALLBACK_ERROR_IN_ERROR_HANDLER: "Exception encountered in onError handler",
|
|
133
133
|
// Effect frequency
|
|
@@ -135,72 +135,72 @@ const y = {
|
|
|
135
135
|
SCHEDULER_CALLBACK_MUST_BE_FUNCTION: "Scheduler callback must be a function",
|
|
136
136
|
SCHEDULER_END_BATCH_WITHOUT_START: "endBatch() called without matching startBatch(). Ignoring."
|
|
137
137
|
};
|
|
138
|
-
function
|
|
139
|
-
if (
|
|
140
|
-
return
|
|
141
|
-
const n =
|
|
142
|
-
return new t(
|
|
138
|
+
function tt(s, t, e) {
|
|
139
|
+
if (s instanceof et)
|
|
140
|
+
return s;
|
|
141
|
+
const n = s instanceof Error, i = n ? s.message : String(s), o = n ? s : void 0, r = `${n ? s.constructor.name : "Unexpected error"} (${e}): ${i}`;
|
|
142
|
+
return new t(r, o);
|
|
143
143
|
}
|
|
144
|
-
class
|
|
144
|
+
class de {
|
|
145
145
|
constructor() {
|
|
146
|
-
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this.id =
|
|
146
|
+
this.flags = 0, this.version = 0, this._lastSeenEpoch = -1, this.id = Be() & yt;
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
class
|
|
149
|
+
class _e extends de {
|
|
150
150
|
/**
|
|
151
151
|
* Adds subscriber.
|
|
152
152
|
*/
|
|
153
153
|
subscribe(t) {
|
|
154
|
-
const
|
|
155
|
-
if (!
|
|
156
|
-
throw
|
|
154
|
+
const e = typeof t == "function";
|
|
155
|
+
if (!e && (!t || typeof t.execute != "function"))
|
|
156
|
+
throw tt(
|
|
157
157
|
new TypeError("Invalid subscriber"),
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
et,
|
|
159
|
+
b.ATOM_SUBSCRIBER_MUST_BE_FUNCTION
|
|
160
160
|
);
|
|
161
|
-
if (this._subscribers.some((i) => i ?
|
|
161
|
+
if (this._subscribers.some((i) => i ? e ? i.fn === t : i.sub === t : !1))
|
|
162
162
|
return () => {
|
|
163
163
|
};
|
|
164
164
|
const n = new Mt(
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
e ? t : void 0,
|
|
166
|
+
e ? void 0 : t
|
|
167
167
|
);
|
|
168
168
|
return this._subscribers.push(n), () => this._unsubscribe(n);
|
|
169
169
|
}
|
|
170
170
|
_unsubscribe(t) {
|
|
171
|
-
const
|
|
171
|
+
const e = this._subscribers, n = e.indexOf(t);
|
|
172
172
|
if (n === -1) return;
|
|
173
|
-
const i =
|
|
174
|
-
n <
|
|
173
|
+
const i = e.pop();
|
|
174
|
+
n < e.length && i && (e[n] = i);
|
|
175
175
|
}
|
|
176
176
|
subscriberCount() {
|
|
177
177
|
return this._subscribers.length;
|
|
178
178
|
}
|
|
179
|
-
_notifySubscribers(t,
|
|
179
|
+
_notifySubscribers(t, e) {
|
|
180
180
|
this._subscribers.length !== 0 && this._subscribers.slice(0).forEach((n) => {
|
|
181
181
|
if (n)
|
|
182
182
|
try {
|
|
183
|
-
n.fn ? n.fn(t,
|
|
183
|
+
n.fn ? n.fn(t, e) : n.sub && n.sub.execute();
|
|
184
184
|
} catch (i) {
|
|
185
185
|
this._handleNotifyError(i);
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
_handleNotifyError(t) {
|
|
190
|
-
console.error(
|
|
190
|
+
console.error(tt(t, et, b.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED));
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
let
|
|
194
|
-
const
|
|
195
|
-
let
|
|
196
|
-
const
|
|
197
|
-
function
|
|
198
|
-
return
|
|
193
|
+
let wt = 0;
|
|
194
|
+
const zt = () => (wt = wt + 1 & yt || 1, wt), Ft = (s) => s + 1 & yt;
|
|
195
|
+
let jt = 0, gt = !1, Ee = 0;
|
|
196
|
+
const pe = () => Ee;
|
|
197
|
+
function ee() {
|
|
198
|
+
return gt ? !1 : (gt = !0, Ee = zt(), jt = 0, !0);
|
|
199
199
|
}
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
},
|
|
203
|
-
class
|
|
200
|
+
const se = () => {
|
|
201
|
+
gt = !1;
|
|
202
|
+
}, He = () => gt ? ++jt : 0;
|
|
203
|
+
class Ge {
|
|
204
204
|
constructor() {
|
|
205
205
|
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);
|
|
206
206
|
}
|
|
@@ -237,28 +237,28 @@ class He {
|
|
|
237
237
|
_runLoop() {
|
|
238
238
|
try {
|
|
239
239
|
if (this._size === 0) return;
|
|
240
|
-
const t =
|
|
241
|
-
this._drainQueue(), t &&
|
|
240
|
+
const t = ee();
|
|
241
|
+
this._drainQueue(), t && se();
|
|
242
242
|
} finally {
|
|
243
243
|
this._isProcessing = !1, this._size > 0 && !this._isBatching && this._flush();
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
_flushSync() {
|
|
247
247
|
this._isFlushingSync = !0;
|
|
248
|
-
const t =
|
|
248
|
+
const t = ee();
|
|
249
249
|
try {
|
|
250
250
|
this._mergeBatchQueue(), this._drainQueue();
|
|
251
251
|
} finally {
|
|
252
|
-
this._isFlushingSync = !1, t &&
|
|
252
|
+
this._isFlushingSync = !1, t && se();
|
|
253
253
|
}
|
|
254
254
|
}
|
|
255
255
|
_mergeBatchQueue() {
|
|
256
256
|
if (this._batchQueueSize === 0) return;
|
|
257
|
-
const t = ++this._epoch,
|
|
257
|
+
const t = ++this._epoch, e = this._batchQueue, n = this._queueBuffer[this._bufferIndex];
|
|
258
258
|
let i = this._size;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}), this._size = i, this._batchQueueSize = 0,
|
|
259
|
+
e.slice(0, this._batchQueueSize).forEach((o) => {
|
|
260
|
+
o._nextEpoch !== t && (o._nextEpoch = t, n[i++] = o);
|
|
261
|
+
}), this._size = i, this._batchQueueSize = 0, e.length > q.BATCH_QUEUE_SHRINK_THRESHOLD && (e.length = 0);
|
|
262
262
|
}
|
|
263
263
|
_drainQueue() {
|
|
264
264
|
let t = 0;
|
|
@@ -271,21 +271,21 @@ class He {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
_processQueue() {
|
|
274
|
-
const t = this._bufferIndex,
|
|
274
|
+
const t = this._bufferIndex, e = this._queueBuffer[t], n = this._size;
|
|
275
275
|
this._bufferIndex = t ^ 1, this._size = 0, this._epoch++;
|
|
276
276
|
for (let i = 0; i < n; i++)
|
|
277
277
|
try {
|
|
278
|
-
|
|
279
|
-
} catch (
|
|
280
|
-
console.error(new
|
|
278
|
+
e[i]();
|
|
279
|
+
} catch (o) {
|
|
280
|
+
console.error(new Lt("Error occurred during scheduler execution", o));
|
|
281
281
|
}
|
|
282
|
-
|
|
282
|
+
e.length = 0;
|
|
283
283
|
}
|
|
284
284
|
_handleFlushOverflow() {
|
|
285
285
|
const t = this._size + this._batchQueueSize;
|
|
286
286
|
if (console.error(
|
|
287
|
-
new
|
|
288
|
-
|
|
287
|
+
new Lt(
|
|
288
|
+
b.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations, t)
|
|
289
289
|
)
|
|
290
290
|
), this._size = 0, this._queueBuffer[this._bufferIndex].length = 0, this._batchQueueSize = 0, this.onOverflow)
|
|
291
291
|
try {
|
|
@@ -301,13 +301,13 @@ class He {
|
|
|
301
301
|
}
|
|
302
302
|
setMaxFlushIterations(t) {
|
|
303
303
|
if (t < q.MIN_FLUSH_ITERATIONS)
|
|
304
|
-
throw new
|
|
304
|
+
throw new Lt(
|
|
305
305
|
`Max flush iterations must be at least ${q.MIN_FLUSH_ITERATIONS}`
|
|
306
306
|
);
|
|
307
307
|
this._maxFlushIterations = t;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
const
|
|
310
|
+
const ot = new Ge(), Vt = /* @__PURE__ */ Symbol.for("atom-effect/atom"), ge = /* @__PURE__ */ Symbol.for("atom-effect/computed"), ze = /* @__PURE__ */ Symbol.for("atom-effect/effect"), P = {
|
|
311
311
|
/** Active listener. */
|
|
312
312
|
current: null,
|
|
313
313
|
/**
|
|
@@ -317,46 +317,46 @@ const rt = new He(), Vt = /* @__PURE__ */ Symbol.for("atom-effect/atom"), me = /
|
|
|
317
317
|
* @param fn - The logic to execute.
|
|
318
318
|
* @returns The result of `fn`.
|
|
319
319
|
*/
|
|
320
|
-
run(
|
|
321
|
-
const
|
|
322
|
-
this.current =
|
|
320
|
+
run(s, t) {
|
|
321
|
+
const e = this.current;
|
|
322
|
+
this.current = s;
|
|
323
323
|
try {
|
|
324
324
|
return t();
|
|
325
325
|
} finally {
|
|
326
|
-
this.current =
|
|
326
|
+
this.current = e;
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
};
|
|
330
|
-
function H(
|
|
331
|
-
const t =
|
|
332
|
-
if (t === null) return
|
|
333
|
-
|
|
330
|
+
function H(s) {
|
|
331
|
+
const t = P.current;
|
|
332
|
+
if (t === null) return s();
|
|
333
|
+
P.current = null;
|
|
334
334
|
try {
|
|
335
|
-
return
|
|
335
|
+
return s();
|
|
336
336
|
} finally {
|
|
337
|
-
|
|
337
|
+
P.current = t;
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
var
|
|
341
|
-
class je extends
|
|
342
|
-
constructor(t,
|
|
343
|
-
super(), this._pendingOldValue = void 0, this._notifyTask = () => this._flushNotifications(), this._subscribers = [], this[
|
|
340
|
+
var ne;
|
|
341
|
+
class je extends _e {
|
|
342
|
+
constructor(t, e) {
|
|
343
|
+
super(), this._pendingOldValue = void 0, this._notifyTask = () => this._flushNotifications(), this._subscribers = [], this[ne] = !0, this._value = t, e && (this.flags |= M.SYNC), Ct.attachDebugInfo(this, "atom", this.id);
|
|
344
344
|
}
|
|
345
345
|
get value() {
|
|
346
|
-
const t =
|
|
347
|
-
return t &&
|
|
346
|
+
const t = P.current;
|
|
347
|
+
return t && fe(this, t, this._subscribers), this._value;
|
|
348
348
|
}
|
|
349
349
|
set value(t) {
|
|
350
|
-
const
|
|
351
|
-
if (Object.is(
|
|
352
|
-
this._value = t, this.version =
|
|
350
|
+
const e = this._value;
|
|
351
|
+
if (Object.is(e, t)) return;
|
|
352
|
+
this._value = t, this.version = Ft(this.version);
|
|
353
353
|
const n = this.flags;
|
|
354
|
-
if (!(this._subscribers.length === 0 || n &
|
|
355
|
-
if (this._pendingOldValue =
|
|
354
|
+
if (!(this._subscribers.length === 0 || n & M.NOTIFICATION_SCHEDULED)) {
|
|
355
|
+
if (this._pendingOldValue = e, this.flags = n | M.NOTIFICATION_SCHEDULED, n & M.SYNC && !ot.isBatching) {
|
|
356
356
|
this._flushNotifications();
|
|
357
357
|
return;
|
|
358
358
|
}
|
|
359
|
-
|
|
359
|
+
ot.schedule(this._notifyTask);
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
/**
|
|
@@ -364,32 +364,32 @@ class je extends Ee {
|
|
|
364
364
|
*/
|
|
365
365
|
_flushNotifications() {
|
|
366
366
|
const t = this.flags;
|
|
367
|
-
if (!(t &
|
|
367
|
+
if (!(t & M.NOTIFICATION_SCHEDULED) || t & M.DISPOSED)
|
|
368
368
|
return;
|
|
369
|
-
const
|
|
370
|
-
this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(this._value,
|
|
369
|
+
const e = this._pendingOldValue;
|
|
370
|
+
this._pendingOldValue = void 0, this.flags &= -17, this._notifySubscribers(this._value, e);
|
|
371
371
|
}
|
|
372
372
|
peek() {
|
|
373
373
|
return this._value;
|
|
374
374
|
}
|
|
375
375
|
dispose() {
|
|
376
|
-
this.flags &
|
|
376
|
+
this.flags & M.DISPOSED || (this._subscribers.length = 0, this.flags |= M.DISPOSED, this._value = void 0, this._pendingOldValue = void 0);
|
|
377
377
|
}
|
|
378
|
-
[(
|
|
378
|
+
[(ne = Vt, Symbol.dispose)]() {
|
|
379
379
|
this.dispose();
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
function
|
|
383
|
-
return new je(
|
|
382
|
+
function Bt(s, t = {}) {
|
|
383
|
+
return new je(s, t.sync ?? !1);
|
|
384
384
|
}
|
|
385
|
-
class
|
|
385
|
+
class Ve {
|
|
386
386
|
/**
|
|
387
387
|
* @param limit - Max unique arrays to hold (default: 50). Prevents the pool itself from consuming too much memory.
|
|
388
388
|
* @param capacity - Max length of an array to accept (default: 256).
|
|
389
389
|
* @param enableStats - Force-enable stats even in production (default: false).
|
|
390
390
|
*/
|
|
391
|
-
constructor(t = 50,
|
|
392
|
-
this.limit = t, this.capacity =
|
|
391
|
+
constructor(t = 50, e = 256, n = !1) {
|
|
392
|
+
this.limit = t, this.capacity = e, this.pool = [], this.stats = null, this.stats = n ? {
|
|
393
393
|
acquired: 0,
|
|
394
394
|
released: 0,
|
|
395
395
|
rejected: { frozen: 0, tooLarge: 0, poolFull: 0 }
|
|
@@ -407,8 +407,8 @@ class ze {
|
|
|
407
407
|
* @param arr - Array to release.
|
|
408
408
|
* @param emptyConst - Optional empty constant.
|
|
409
409
|
*/
|
|
410
|
-
release(t,
|
|
411
|
-
if (!(
|
|
410
|
+
release(t, e) {
|
|
411
|
+
if (!(e && t === e)) {
|
|
412
412
|
if (t.length > this.capacity) {
|
|
413
413
|
this.stats && this.stats.rejected.tooLarge++;
|
|
414
414
|
return;
|
|
@@ -429,10 +429,10 @@ class ze {
|
|
|
429
429
|
*/
|
|
430
430
|
getStats() {
|
|
431
431
|
if (!this.stats) return null;
|
|
432
|
-
const { acquired: t, released:
|
|
432
|
+
const { acquired: t, released: e, rejected: n } = this.stats, i = t - e - (n.frozen + n.tooLarge + n.poolFull);
|
|
433
433
|
return {
|
|
434
434
|
acquired: t,
|
|
435
|
-
released:
|
|
435
|
+
released: e,
|
|
436
436
|
rejected: { ...n },
|
|
437
437
|
leaked: i,
|
|
438
438
|
poolSize: this.pool.length
|
|
@@ -449,58 +449,58 @@ class ze {
|
|
|
449
449
|
});
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
const
|
|
452
|
+
const A = Object.freeze(
|
|
453
453
|
[]
|
|
454
|
-
), B = new
|
|
455
|
-
function qt(
|
|
456
|
-
return
|
|
457
|
-
}
|
|
458
|
-
function
|
|
459
|
-
return
|
|
460
|
-
}
|
|
461
|
-
function
|
|
462
|
-
return
|
|
463
|
-
}
|
|
464
|
-
var
|
|
465
|
-
const { IDLE:
|
|
466
|
-
function
|
|
467
|
-
return
|
|
468
|
-
}
|
|
469
|
-
class
|
|
470
|
-
constructor(t,
|
|
471
|
-
if (typeof t != "function") throw new
|
|
472
|
-
super(), this[oe] = !0, this[
|
|
473
|
-
const n =
|
|
474
|
-
if (this._maxAsyncRetries = (n ??
|
|
454
|
+
), B = new Ve();
|
|
455
|
+
function qt(s) {
|
|
456
|
+
return s !== null && typeof s == "object" && Vt in s;
|
|
457
|
+
}
|
|
458
|
+
function qe(s) {
|
|
459
|
+
return s !== null && typeof s == "object" && ge in s;
|
|
460
|
+
}
|
|
461
|
+
function me(s) {
|
|
462
|
+
return s !== null && typeof s == "object" && typeof s.then == "function";
|
|
463
|
+
}
|
|
464
|
+
var ie, oe;
|
|
465
|
+
const { IDLE: ft, DIRTY: K, PENDING: Et, RESOLVED: V, REJECTED: nt, HAS_ERROR: dt, RECOMPUTING: st, DISPOSED: kt, IS_COMPUTED: Xe } = ue;
|
|
466
|
+
function Qe(s) {
|
|
467
|
+
return s & V ? ut.RESOLVED : s & Et ? ut.PENDING : s & nt ? ut.REJECTED : ut.IDLE;
|
|
468
|
+
}
|
|
469
|
+
class Ye extends _e {
|
|
470
|
+
constructor(t, e = {}) {
|
|
471
|
+
if (typeof t != "function") throw new j(b.COMPUTED_MUST_BE_FUNCTION);
|
|
472
|
+
super(), this[oe] = !0, this[ie] = !0, this._error = null, this._promiseId = 0, this._subscribers = [], this._links = A, this._asyncStartAggregateVersion = 0, this._asyncRetryCount = 0, this._lastDriftEpoch = -1, this._trackEpoch = -1, this._trackLinks = A, this._trackCount = 0, this._value = void 0, this.flags = Xe | K | ft, this._equal = e.equal ?? Object.is, this._fn = t, this._defaultValue = "defaultValue" in e ? e.defaultValue : Ut, this._onError = e.onError ?? null;
|
|
473
|
+
const n = e.maxAsyncRetries;
|
|
474
|
+
if (this._maxAsyncRetries = (n ?? Zt.MAX_ASYNC_RETRIES) & yt, Ct.attachDebugInfo(this, "computed", this.id), e.lazy === !1)
|
|
475
475
|
try {
|
|
476
476
|
this._recompute();
|
|
477
477
|
} catch {
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
480
|
_track() {
|
|
481
|
-
const t =
|
|
482
|
-
t &&
|
|
481
|
+
const t = P.current;
|
|
482
|
+
t && fe(this, t, this._subscribers);
|
|
483
483
|
}
|
|
484
484
|
get value() {
|
|
485
485
|
this._track();
|
|
486
486
|
const t = this.flags;
|
|
487
|
-
if ((t & (V | K |
|
|
487
|
+
if ((t & (V | K | ft)) === V)
|
|
488
488
|
return this._value;
|
|
489
|
-
if (t &
|
|
490
|
-
throw new
|
|
489
|
+
if (t & kt)
|
|
490
|
+
throw new j(b.COMPUTED_DISPOSED);
|
|
491
491
|
if (t & st) {
|
|
492
492
|
if (this._defaultValue !== Ut) return this._defaultValue;
|
|
493
|
-
throw new
|
|
493
|
+
throw new j(b.COMPUTED_CIRCULAR_DEPENDENCY);
|
|
494
494
|
}
|
|
495
|
-
if (t & (K |
|
|
495
|
+
if (t & (K | ft) && (this._recompute(), this.flags & V))
|
|
496
496
|
return this._value;
|
|
497
|
-
const
|
|
498
|
-
if (this.flags &
|
|
499
|
-
if (n) return
|
|
500
|
-
throw new
|
|
497
|
+
const e = this._defaultValue, n = e !== Ut;
|
|
498
|
+
if (this.flags & Et) {
|
|
499
|
+
if (n) return e;
|
|
500
|
+
throw new j(b.COMPUTED_ASYNC_PENDING_NO_DEFAULT);
|
|
501
501
|
}
|
|
502
502
|
if (this.flags & nt) {
|
|
503
|
-
if (n) return
|
|
503
|
+
if (n) return e;
|
|
504
504
|
throw this._error;
|
|
505
505
|
}
|
|
506
506
|
return this._value;
|
|
@@ -509,20 +509,20 @@ class Qe extends Ee {
|
|
|
509
509
|
return this._value;
|
|
510
510
|
}
|
|
511
511
|
get state() {
|
|
512
|
-
return this._track(),
|
|
512
|
+
return this._track(), Qe(this.flags);
|
|
513
513
|
}
|
|
514
514
|
get hasError() {
|
|
515
|
-
return this._track(), this.flags & (nt |
|
|
515
|
+
return this._track(), this.flags & (nt | dt) ? !0 : this._links.some((t) => t?.node?.flags & dt);
|
|
516
516
|
}
|
|
517
517
|
get isValid() {
|
|
518
518
|
return !this.hasError;
|
|
519
519
|
}
|
|
520
520
|
get errors() {
|
|
521
|
-
if (this._track(), !this.hasError) return
|
|
521
|
+
if (this._track(), !this.hasError) return Pe;
|
|
522
522
|
const t = [];
|
|
523
|
-
return this._error && t.push(this._error), this._links.forEach((
|
|
524
|
-
const n =
|
|
525
|
-
n.flags &
|
|
523
|
+
return this._error && t.push(this._error), this._links.forEach((e) => {
|
|
524
|
+
const n = e.node;
|
|
525
|
+
n.flags & dt && n.errors.forEach((i) => {
|
|
526
526
|
i && !t.includes(i) && t.push(i);
|
|
527
527
|
});
|
|
528
528
|
}), Object.freeze(t);
|
|
@@ -531,7 +531,7 @@ class Qe extends Ee {
|
|
|
531
531
|
return this._track(), this._error;
|
|
532
532
|
}
|
|
533
533
|
get isPending() {
|
|
534
|
-
return this._track(), (this.flags &
|
|
534
|
+
return this._track(), (this.flags & Et) !== 0;
|
|
535
535
|
}
|
|
536
536
|
get isResolved() {
|
|
537
537
|
return this._track(), (this.flags & V) !== 0;
|
|
@@ -540,20 +540,20 @@ class Qe extends Ee {
|
|
|
540
540
|
this._markDirty();
|
|
541
541
|
}
|
|
542
542
|
dispose() {
|
|
543
|
-
if (this.flags &
|
|
543
|
+
if (this.flags & kt) return;
|
|
544
544
|
const t = this._links;
|
|
545
|
-
t !==
|
|
545
|
+
t !== A && (t.forEach((e) => e.unsub?.()), B.release(t), this._links = A), this._subscribers.length = 0, this.flags = kt | K | ft, this._error = null, this._value = void 0;
|
|
546
546
|
}
|
|
547
|
-
[(oe = Vt,
|
|
547
|
+
[(oe = Vt, ie = ge, Symbol.dispose)]() {
|
|
548
548
|
this.dispose();
|
|
549
549
|
}
|
|
550
550
|
addDependency(t) {
|
|
551
551
|
if (t._lastSeenEpoch !== this._trackEpoch) {
|
|
552
552
|
if (t._lastSeenEpoch = this._trackEpoch, this._trackCount < this._trackLinks.length) {
|
|
553
|
-
const
|
|
554
|
-
|
|
553
|
+
const e = this._trackLinks[this._trackCount];
|
|
554
|
+
e.node = t, e.version = t.version;
|
|
555
555
|
} else
|
|
556
|
-
this._trackLinks.push(new
|
|
556
|
+
this._trackLinks.push(new $t(t, t.version));
|
|
557
557
|
this._trackCount++;
|
|
558
558
|
}
|
|
559
559
|
}
|
|
@@ -561,61 +561,63 @@ class Qe extends Ee {
|
|
|
561
561
|
if (this.flags & st) return;
|
|
562
562
|
this.flags |= st;
|
|
563
563
|
const t = this._links;
|
|
564
|
-
this._trackEpoch =
|
|
565
|
-
let
|
|
564
|
+
this._trackEpoch = zt(), this._trackLinks = B.acquire(), this._trackCount = 0;
|
|
565
|
+
let e = !1;
|
|
566
566
|
try {
|
|
567
|
-
const n =
|
|
568
|
-
this._trackLinks.length = this._trackCount,
|
|
567
|
+
const n = P.run(this, this._fn);
|
|
568
|
+
this._trackLinks.length = this._trackCount, te(this._trackLinks, t, this), this._links = this._trackLinks, e = !0, me(n) ? this._handleAsyncComputation(n) : this._finalizeResolution(n);
|
|
569
569
|
} catch (n) {
|
|
570
|
-
if (!
|
|
570
|
+
if (!e)
|
|
571
571
|
try {
|
|
572
|
-
this._trackLinks.length = this._trackCount,
|
|
572
|
+
this._trackLinks.length = this._trackCount, te(this._trackLinks, t, this), this._links = this._trackLinks, e = !0;
|
|
573
573
|
} catch {
|
|
574
574
|
}
|
|
575
|
-
this._handleError(n,
|
|
575
|
+
this._handleError(n, b.COMPUTED_COMPUTATION_FAILED, !0);
|
|
576
576
|
} finally {
|
|
577
|
-
|
|
577
|
+
e && t !== A ? B.release(t) : e || B.release(this._trackLinks), this._trackEpoch = -1, this._trackLinks = A, this._trackCount = 0, this.flags &= ~st;
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
_handleAsyncComputation(t) {
|
|
581
|
-
this.flags = (this.flags |
|
|
582
|
-
const
|
|
581
|
+
this.flags = (this.flags | Et) & -217, this._notifySubscribers(void 0, void 0), this._asyncStartAggregateVersion = this._captureVersionSnapshot(), this._asyncRetryCount = 0, this._promiseId = (this._promiseId + 1) % Zt.MAX_PROMISE_ID;
|
|
582
|
+
const e = this._promiseId;
|
|
583
583
|
t.then(
|
|
584
584
|
(n) => {
|
|
585
|
-
if (
|
|
586
|
-
if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion)
|
|
587
|
-
|
|
588
|
-
|
|
585
|
+
if (e === this._promiseId) {
|
|
586
|
+
if (this._captureVersionSnapshot() !== this._asyncStartAggregateVersion) {
|
|
587
|
+
const i = pe();
|
|
588
|
+
return this._lastDriftEpoch !== i && (this._lastDriftEpoch = i, this._asyncRetryCount = 0), this._asyncRetryCount++ < this._maxAsyncRetries ? this._markDirty() : this._handleError(
|
|
589
|
+
new j(
|
|
589
590
|
`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`
|
|
590
591
|
),
|
|
591
|
-
|
|
592
|
+
b.COMPUTED_ASYNC_COMPUTATION_FAILED
|
|
592
593
|
);
|
|
594
|
+
}
|
|
593
595
|
this._finalizeResolution(n), this._notifySubscribers(n, void 0);
|
|
594
596
|
}
|
|
595
597
|
},
|
|
596
|
-
(n) =>
|
|
598
|
+
(n) => e === this._promiseId && this._handleError(n, b.COMPUTED_ASYNC_COMPUTATION_FAILED)
|
|
597
599
|
);
|
|
598
600
|
}
|
|
599
601
|
_captureVersionSnapshot() {
|
|
600
602
|
let t = 0;
|
|
601
|
-
const
|
|
602
|
-
for (let n = 0, i =
|
|
603
|
-
t = (t << 5) - t +
|
|
603
|
+
const e = this._links;
|
|
604
|
+
for (let n = 0, i = e.length; n < i; n++)
|
|
605
|
+
t = (t << 5) - t + e[n].node.version | 0;
|
|
604
606
|
return t;
|
|
605
607
|
}
|
|
606
|
-
_handleError(t,
|
|
607
|
-
const i =
|
|
608
|
-
if (!n && !(this.flags & nt) && (this.version =
|
|
608
|
+
_handleError(t, e, n = !1) {
|
|
609
|
+
const i = tt(t, j, e);
|
|
610
|
+
if (!n && !(this.flags & nt) && (this.version = Ft(this.version)), this._error = i, this.flags = this.flags & -121 | nt | dt, this._onError)
|
|
609
611
|
try {
|
|
610
612
|
this._onError(i);
|
|
611
|
-
} catch (
|
|
612
|
-
console.error(
|
|
613
|
+
} catch (o) {
|
|
614
|
+
console.error(b.CALLBACK_ERROR_IN_ERROR_HANDLER, o);
|
|
613
615
|
}
|
|
614
616
|
if (n) throw i;
|
|
615
617
|
this._notifySubscribers(void 0, void 0);
|
|
616
618
|
}
|
|
617
619
|
_finalizeResolution(t) {
|
|
618
|
-
(!(this.flags & V) || !this._equal(this._value, t)) && (this.version =
|
|
620
|
+
(!(this.flags & V) || !this._equal(this._value, t)) && (this.version = Ft(this.version)), this._value = t, this._error = null, this.flags = (this.flags | V) & -697;
|
|
619
621
|
}
|
|
620
622
|
execute() {
|
|
621
623
|
this._markDirty();
|
|
@@ -625,98 +627,98 @@ class Qe extends Ee {
|
|
|
625
627
|
this.flags & (st | K) || (this.flags |= K, this._notifySubscribers(void 0, void 0));
|
|
626
628
|
}
|
|
627
629
|
}
|
|
628
|
-
function
|
|
629
|
-
return new
|
|
630
|
+
function St(s, t = {}) {
|
|
631
|
+
return new Ye(s, t);
|
|
630
632
|
}
|
|
631
|
-
var
|
|
632
|
-
class Ke extends
|
|
633
|
-
constructor(t,
|
|
634
|
-
super(), this[
|
|
633
|
+
var re;
|
|
634
|
+
class Ke extends de {
|
|
635
|
+
constructor(t, e = {}) {
|
|
636
|
+
super(), this[re] = !0, this._cleanup = null, this._links = A, this._nextLinks = null, this._prevLinks = A, this._currentEpoch = -1, this._lastFlushEpoch = -1, this._executionsInEpoch = 0, this._executionCount = 0, this._windowStart = 0, this._windowCount = 0, this._execId = 0, this._fn = t, this._onError = e.onError ?? null, this._sync = e.sync ?? !1, this._maxExecutions = e.maxExecutionsPerSecond ?? q.MAX_EXECUTIONS_PER_SECOND, this._maxExecutionsPerFlush = e.maxExecutionsPerFlush ?? q.MAX_EXECUTIONS_PER_EFFECT, this._sync ? (this._executeTask = void 0, this._notifyCallback = () => this.execute()) : (this._executeTask = () => this.execute(), this._notifyCallback = () => ot.schedule(this._executeTask)), Ct.attachDebugInfo(this, "effect", this.id);
|
|
635
637
|
}
|
|
636
638
|
run() {
|
|
637
|
-
if (this.flags &
|
|
638
|
-
throw new
|
|
639
|
+
if (this.flags & k.DISPOSED)
|
|
640
|
+
throw new Z(b.EFFECT_DISPOSED);
|
|
639
641
|
this.execute(!0);
|
|
640
642
|
}
|
|
641
643
|
dispose() {
|
|
642
|
-
this.flags &
|
|
644
|
+
this.flags & k.DISPOSED || (this.flags |= k.DISPOSED, this._execCleanup(), this._unsubLinks(this._links), this._links !== A && B.release(this._links), this._links = A, this._prevLinks = A);
|
|
643
645
|
}
|
|
644
|
-
[(
|
|
646
|
+
[(re = ze, Symbol.dispose)]() {
|
|
645
647
|
this.dispose();
|
|
646
648
|
}
|
|
647
649
|
addDependency(t) {
|
|
648
|
-
if (!(this.flags &
|
|
649
|
-
const
|
|
650
|
-
if (t._lastSeenEpoch ===
|
|
651
|
-
t._lastSeenEpoch =
|
|
652
|
-
const n = this._nextLinks, i = this._prevLinks,
|
|
653
|
-
if (
|
|
654
|
-
const
|
|
655
|
-
|
|
650
|
+
if (!(this.flags & k.EXECUTING)) return;
|
|
651
|
+
const e = this._currentEpoch;
|
|
652
|
+
if (t._lastSeenEpoch === e) return;
|
|
653
|
+
t._lastSeenEpoch = e;
|
|
654
|
+
const n = this._nextLinks, i = this._prevLinks, o = i.findIndex((r) => r && r.node === t && r.unsub);
|
|
655
|
+
if (o !== -1) {
|
|
656
|
+
const r = i[o];
|
|
657
|
+
r.version = t.version, n.push(r), i[o] = null;
|
|
656
658
|
return;
|
|
657
659
|
}
|
|
658
660
|
try {
|
|
659
|
-
const
|
|
660
|
-
n.push(new
|
|
661
|
-
} catch (
|
|
662
|
-
const
|
|
663
|
-
if (console.error(
|
|
661
|
+
const r = t.subscribe(this._notifyCallback);
|
|
662
|
+
n.push(new $t(t, t.version, r));
|
|
663
|
+
} catch (r) {
|
|
664
|
+
const c = tt(r, Z, b.EFFECT_EXECUTION_FAILED);
|
|
665
|
+
if (console.error(c), this._onError)
|
|
664
666
|
try {
|
|
665
|
-
this._onError(
|
|
667
|
+
this._onError(c);
|
|
666
668
|
} catch {
|
|
667
669
|
}
|
|
668
|
-
n.push(new
|
|
670
|
+
n.push(new $t(t, t.version, void 0));
|
|
669
671
|
}
|
|
670
672
|
}
|
|
671
673
|
/**
|
|
672
674
|
* Executes effect with tracking.
|
|
673
675
|
*/
|
|
674
676
|
execute(t = !1) {
|
|
675
|
-
if (this.flags & (
|
|
676
|
-
this._checkInfiniteLoops(), this.flags |=
|
|
677
|
-
const
|
|
678
|
-
this._nextLinks =
|
|
677
|
+
if (this.flags & (k.DISPOSED | k.EXECUTING) || !t && this._links.length > 0 && !this._isDirty()) return;
|
|
678
|
+
this._checkInfiniteLoops(), this.flags |= k.EXECUTING, this._execCleanup(), this._prevLinks = this._links;
|
|
679
|
+
const e = B.acquire();
|
|
680
|
+
this._nextLinks = e, this._currentEpoch = zt();
|
|
679
681
|
let n = !1;
|
|
680
682
|
try {
|
|
681
|
-
const i =
|
|
682
|
-
this._links =
|
|
683
|
+
const i = P.run(this, this._fn);
|
|
684
|
+
this._links = e, n = !0, me(i) ? this._handleAsyncResult(i) : this._cleanup = typeof i == "function" ? i : null;
|
|
683
685
|
} catch (i) {
|
|
684
|
-
this._links =
|
|
686
|
+
this._links = e, n = !0, this._handleExecutionError(i), this._cleanup = null;
|
|
685
687
|
} finally {
|
|
686
|
-
this._finalizeDependencies(n, this._prevLinks,
|
|
688
|
+
this._finalizeDependencies(n, this._prevLinks, e), this.flags &= -9;
|
|
687
689
|
}
|
|
688
690
|
}
|
|
689
691
|
_handleAsyncResult(t) {
|
|
690
|
-
const
|
|
692
|
+
const e = ++this._execId;
|
|
691
693
|
t.then(
|
|
692
694
|
(n) => {
|
|
693
|
-
if (
|
|
695
|
+
if (e !== this._execId || this.flags & k.DISPOSED) {
|
|
694
696
|
if (typeof n == "function")
|
|
695
697
|
try {
|
|
696
698
|
n();
|
|
697
699
|
} catch (i) {
|
|
698
|
-
this._handleExecutionError(i,
|
|
700
|
+
this._handleExecutionError(i, b.EFFECT_CLEANUP_FAILED);
|
|
699
701
|
}
|
|
700
702
|
return;
|
|
701
703
|
}
|
|
702
704
|
typeof n == "function" && (this._cleanup = n);
|
|
703
705
|
},
|
|
704
|
-
(n) =>
|
|
706
|
+
(n) => e === this._execId && this._handleExecutionError(n)
|
|
705
707
|
);
|
|
706
708
|
}
|
|
707
|
-
_finalizeDependencies(t,
|
|
708
|
-
this._nextLinks = null, this._prevLinks =
|
|
709
|
+
_finalizeDependencies(t, e, n) {
|
|
710
|
+
this._nextLinks = null, this._prevLinks = A, t ? (e.forEach((i) => i?.unsub?.()), e !== A && B.release(e)) : (this._unsubLinks(n), B.release(n));
|
|
709
711
|
}
|
|
710
712
|
_unsubLinks(t) {
|
|
711
|
-
t.forEach((
|
|
713
|
+
t.forEach((e) => e?.unsub?.());
|
|
712
714
|
}
|
|
713
715
|
_isDirty() {
|
|
714
|
-
const t = this._links,
|
|
715
|
-
|
|
716
|
+
const t = this._links, e = P.current;
|
|
717
|
+
P.current = null;
|
|
716
718
|
try {
|
|
717
719
|
return t.some((n) => {
|
|
718
720
|
const i = n.node;
|
|
719
|
-
if (i.flags &
|
|
721
|
+
if (i.flags & ue.IS_COMPUTED)
|
|
720
722
|
try {
|
|
721
723
|
i.value;
|
|
722
724
|
} catch {
|
|
@@ -725,7 +727,7 @@ class Ke extends _e {
|
|
|
725
727
|
return i.version !== n.version;
|
|
726
728
|
});
|
|
727
729
|
} finally {
|
|
728
|
-
|
|
730
|
+
P.current = e;
|
|
729
731
|
}
|
|
730
732
|
}
|
|
731
733
|
_execCleanup() {
|
|
@@ -733,57 +735,57 @@ class Ke extends _e {
|
|
|
733
735
|
try {
|
|
734
736
|
this._cleanup();
|
|
735
737
|
} catch (t) {
|
|
736
|
-
this._handleExecutionError(t,
|
|
738
|
+
this._handleExecutionError(t, b.EFFECT_CLEANUP_FAILED);
|
|
737
739
|
}
|
|
738
740
|
this._cleanup = null;
|
|
739
741
|
}
|
|
740
742
|
}
|
|
741
743
|
_checkInfiniteLoops() {
|
|
742
|
-
const t =
|
|
743
|
-
this._lastFlushEpoch !== t && (this._lastFlushEpoch = t, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"),
|
|
744
|
+
const t = pe();
|
|
745
|
+
this._lastFlushEpoch !== t && (this._lastFlushEpoch = t, this._executionsInEpoch = 0), ++this._executionsInEpoch > this._maxExecutionsPerFlush && this._throwInfiniteLoopError("per-effect"), He() > q.MAX_EXECUTIONS_PER_FLUSH && this._throwInfiniteLoopError("global"), this._executionCount++;
|
|
744
746
|
}
|
|
745
747
|
get isDisposed() {
|
|
746
|
-
return (this.flags &
|
|
748
|
+
return (this.flags & k.DISPOSED) !== 0;
|
|
747
749
|
}
|
|
748
750
|
get executionCount() {
|
|
749
751
|
return this._executionCount;
|
|
750
752
|
}
|
|
751
753
|
get isExecuting() {
|
|
752
|
-
return (this.flags &
|
|
754
|
+
return (this.flags & k.EXECUTING) !== 0;
|
|
753
755
|
}
|
|
754
756
|
_throwInfiniteLoopError(t) {
|
|
755
|
-
const
|
|
756
|
-
`Infinite loop detected (${t}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${
|
|
757
|
+
const e = new Z(
|
|
758
|
+
`Infinite loop detected (${t}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${jt}`
|
|
757
759
|
);
|
|
758
|
-
throw this.dispose(), console.error(
|
|
760
|
+
throw this.dispose(), console.error(e), e;
|
|
759
761
|
}
|
|
760
|
-
_handleExecutionError(t,
|
|
761
|
-
const n =
|
|
762
|
+
_handleExecutionError(t, e = b.EFFECT_EXECUTION_FAILED) {
|
|
763
|
+
const n = tt(t, Z, e);
|
|
762
764
|
if (console.error(n), this._onError)
|
|
763
765
|
try {
|
|
764
766
|
this._onError(n);
|
|
765
767
|
} catch (i) {
|
|
766
|
-
console.error(
|
|
768
|
+
console.error(tt(i, Z, b.CALLBACK_ERROR_IN_ERROR_HANDLER));
|
|
767
769
|
}
|
|
768
770
|
}
|
|
769
771
|
}
|
|
770
|
-
function X(
|
|
771
|
-
if (typeof
|
|
772
|
-
throw new
|
|
773
|
-
const
|
|
774
|
-
return
|
|
772
|
+
function X(s, t = {}) {
|
|
773
|
+
if (typeof s != "function")
|
|
774
|
+
throw new Z(b.EFFECT_MUST_BE_FUNCTION);
|
|
775
|
+
const e = new Ke(s, t);
|
|
776
|
+
return e.execute(), e;
|
|
775
777
|
}
|
|
776
|
-
function Ie(
|
|
777
|
-
if (typeof
|
|
778
|
+
function Ie(s) {
|
|
779
|
+
if (typeof s != "function")
|
|
778
780
|
throw new TypeError("Batch callback must be a function");
|
|
779
|
-
|
|
781
|
+
ot.startBatch();
|
|
780
782
|
try {
|
|
781
|
-
return
|
|
783
|
+
return s();
|
|
782
784
|
} finally {
|
|
783
|
-
|
|
785
|
+
ot.endBatch();
|
|
784
786
|
}
|
|
785
787
|
}
|
|
786
|
-
const
|
|
788
|
+
const g = {
|
|
787
789
|
/** Used by the SPA router ($.route). */
|
|
788
790
|
ROUTE: "[atom-route]",
|
|
789
791
|
/** Used by all reactive binding helpers (bindText, bindCss, bindAttr, …). */
|
|
@@ -792,57 +794,57 @@ const d = {
|
|
|
792
794
|
LIST: "[atom-list]",
|
|
793
795
|
/** Used by mount/unmount lifecycle helpers. */
|
|
794
796
|
MOUNT: "[atom-mount]"
|
|
795
|
-
},
|
|
797
|
+
}, _t = Object.freeze({
|
|
796
798
|
mode: "hash",
|
|
797
799
|
basePath: "",
|
|
798
800
|
autoBindLinks: !1,
|
|
799
801
|
activeClass: "active"
|
|
800
|
-
}),
|
|
802
|
+
}), We = {
|
|
801
803
|
EVENT: "input"
|
|
802
|
-
},
|
|
804
|
+
}, Je = /* @__PURE__ */ new Set(["input", "select", "textarea"]), Ze = /* @__PURE__ */ new Set([
|
|
803
805
|
"innerHTML",
|
|
804
806
|
"outerHTML",
|
|
805
807
|
"srcdoc",
|
|
806
808
|
"__proto__",
|
|
807
809
|
"constructor",
|
|
808
810
|
"prototype"
|
|
809
|
-
]),
|
|
810
|
-
ROUTE_NOT_FOUND: (
|
|
811
|
-
TEMPLATE_NOT_FOUND: (
|
|
812
|
-
TARGET_NOT_FOUND: (
|
|
813
|
-
MALFORMED_URI: (
|
|
811
|
+
]), T = {
|
|
812
|
+
ROUTE_NOT_FOUND: (s) => `Route "${s}" not found and no notFound route configured`,
|
|
813
|
+
TEMPLATE_NOT_FOUND: (s) => `Template "${s}" not found`,
|
|
814
|
+
TARGET_NOT_FOUND: (s) => `Target element "${s}" not found`,
|
|
815
|
+
MALFORMED_URI: (s) => `Malformed URI component: ${s}`,
|
|
814
816
|
/** Emitted when sanitizeHtml modifies the input. Prefixed at call site with LOG_PREFIXES.BINDING or LIST to identify the originating subsystem. */
|
|
815
817
|
UNSAFE_CONTENT: () => "Unsafe content neutralized during sanitization.",
|
|
816
818
|
/** Emitted by bindCss when a CSS style property value contains a dangerous protocol. */
|
|
817
|
-
BLOCKED_DANGEROUS_CSS_VALUE: (
|
|
818
|
-
BLOCKED_EVENT_HANDLER: (
|
|
819
|
-
BLOCKED_PROTOCOL: (
|
|
820
|
-
BLOCKED_DANGEROUS_PROP: (
|
|
821
|
-
INVALID_INPUT_ELEMENT: (
|
|
822
|
-
MISSING_SOURCE: (
|
|
823
|
-
MISSING_CONDITION: (
|
|
824
|
-
DUPLICATE_KEY: (
|
|
825
|
-
UPDATER_ERROR: (
|
|
819
|
+
BLOCKED_DANGEROUS_CSS_VALUE: (s) => `Blocked dangerous value in CSS style property "${s}".`,
|
|
820
|
+
BLOCKED_EVENT_HANDLER: (s) => `Blocked setting dangerous event handler attribute "${s}".`,
|
|
821
|
+
BLOCKED_PROTOCOL: (s) => `Blocked dangerous protocol in "${s}" attribute.`,
|
|
822
|
+
BLOCKED_DANGEROUS_PROP: (s) => `Blocked setting dangerous property "${s}". Use html binding for sanitized HTML.`,
|
|
823
|
+
INVALID_INPUT_ELEMENT: (s) => `Val binding used on non-input element <${s}>.`,
|
|
824
|
+
MISSING_SOURCE: (s) => `[${s}] source is required when prop/name is a string.`,
|
|
825
|
+
MISSING_CONDITION: (s) => `[${s}] condition is required when className is a string.`,
|
|
826
|
+
DUPLICATE_KEY: (s, t) => `Duplicate key "${s}" at index ${t}.`,
|
|
827
|
+
UPDATER_ERROR: (s) => `Updater threw in binding "${s}"`,
|
|
826
828
|
EFFECT_DISPOSE_ERROR: () => "Effect dispose error",
|
|
827
829
|
BINDING_CLEANUP_ERROR: () => "Binding cleanup error",
|
|
828
830
|
PARSE_ERROR: () => "parse() threw during DOM→Atom sync",
|
|
829
831
|
MOUNT_ERROR: () => "Mount error",
|
|
830
832
|
MOUNT_CLEANUP_ERROR: () => "Cleanup error"
|
|
831
833
|
};
|
|
832
|
-
function ye(
|
|
833
|
-
return qt(
|
|
834
|
+
function ye(s) {
|
|
835
|
+
return qt(s);
|
|
834
836
|
}
|
|
835
|
-
function Xt(
|
|
836
|
-
const t =
|
|
837
|
-
if (
|
|
838
|
-
const
|
|
837
|
+
function Xt(s) {
|
|
838
|
+
const t = s.tagName.toLowerCase();
|
|
839
|
+
if (s.id) return `${t}#${s.id}`;
|
|
840
|
+
const e = s.classList, n = e.length;
|
|
839
841
|
if (n === 0) return t;
|
|
840
842
|
let i = t;
|
|
841
|
-
for (let
|
|
842
|
-
i += `.${
|
|
843
|
+
for (let o = 0; o < n; o++)
|
|
844
|
+
i += `.${e[o]}`;
|
|
843
845
|
return i;
|
|
844
846
|
}
|
|
845
|
-
const
|
|
847
|
+
const ts = /* @__PURE__ */ new Set([
|
|
846
848
|
"href",
|
|
847
849
|
"src",
|
|
848
850
|
"action",
|
|
@@ -858,98 +860,106 @@ const Ze = /* @__PURE__ */ new Set([
|
|
|
858
860
|
"usemap",
|
|
859
861
|
"classid",
|
|
860
862
|
"codebase"
|
|
861
|
-
]),
|
|
863
|
+
]), rt = Object.prototype.hasOwnProperty, es = /^\s*(?:javascript|vbscript)\s*:/i, ss = (
|
|
862
864
|
// biome-ignore lint/suspicious/noControlCharactersInRegex: Intentionally matching control characters for XSS sanitization
|
|
863
|
-
/(?:expression\s*\(|behavior\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
|
|
864
|
-
), ns = /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i, is = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
865
|
+
/(?: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
|
|
866
|
+
), ns = /url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i, is = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, os = /&#x([0-9a-f]+);?|&#([0-9]+);?/gi, rs = {
|
|
867
|
+
colon: ":",
|
|
868
|
+
Tab: " ",
|
|
869
|
+
NewLine: `
|
|
870
|
+
`
|
|
871
|
+
}, cs = /&(colon|Tab|NewLine);/g, as = /<\?[\s\S]*?\?>/g, ls = /(<(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, hs = /(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, us = /data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi, fs = /\bon\w+\s*=/gim, ds = new RegExp(ss.source, "gim");
|
|
872
|
+
function Ht(s) {
|
|
873
|
+
let t = String(s ?? "");
|
|
874
|
+
t = t.replace(is, ""), t = t.replace(
|
|
875
|
+
os,
|
|
876
|
+
(n, i, o) => String.fromCodePoint(i ? parseInt(i, 16) : parseInt(o, 10))
|
|
877
|
+
), t = t.replace(cs, (n, i) => rs[i] ?? ""), t = t.replace(as, "");
|
|
878
|
+
let e;
|
|
869
879
|
do
|
|
870
|
-
|
|
871
|
-
while (t !==
|
|
872
|
-
return t = t.replace(
|
|
873
|
-
}
|
|
874
|
-
function
|
|
875
|
-
return
|
|
876
|
-
}
|
|
877
|
-
function
|
|
878
|
-
return
|
|
879
|
-
}
|
|
880
|
-
function
|
|
881
|
-
if (
|
|
882
|
-
if (
|
|
883
|
-
const
|
|
884
|
-
if (
|
|
885
|
-
const i =
|
|
886
|
-
for (let
|
|
887
|
-
const
|
|
888
|
-
if (!
|
|
880
|
+
e = t, t = t.replace(ls, "");
|
|
881
|
+
while (t !== e);
|
|
882
|
+
return t = t.replace(hs, "data-unsafe-protocol:"), t = t.replace(us, "data-unsafe-protocol:"), t = t.replace(fs, "data-unsafe-attr="), t = t.replace(ds, "data-unsafe-css:"), t;
|
|
883
|
+
}
|
|
884
|
+
function _s(s, t) {
|
|
885
|
+
return ts.has(s.toLowerCase()) ? es.test(t) : !1;
|
|
886
|
+
}
|
|
887
|
+
function Es(s) {
|
|
888
|
+
return s.toLowerCase().includes("url(") ? ns.test(s) : !1;
|
|
889
|
+
}
|
|
890
|
+
function ps(s, t) {
|
|
891
|
+
if (s === t) return !0;
|
|
892
|
+
if (s === null || t === null || typeof s != "object" || typeof t != "object") return !1;
|
|
893
|
+
const e = Object.keys(s), n = Object.keys(t);
|
|
894
|
+
if (e.length !== n.length) return !1;
|
|
895
|
+
const i = s, o = t;
|
|
896
|
+
for (let r = 0; r < e.length; r++) {
|
|
897
|
+
const c = e[r];
|
|
898
|
+
if (!rt.call(o, c) || i[c] !== o[c])
|
|
889
899
|
return !1;
|
|
890
900
|
}
|
|
891
901
|
return !0;
|
|
892
902
|
}
|
|
893
|
-
function
|
|
894
|
-
const t =
|
|
903
|
+
function gs(s) {
|
|
904
|
+
const t = s.length;
|
|
895
905
|
if (t === 0) return new Int32Array(0);
|
|
896
|
-
const
|
|
906
|
+
const e = new Int32Array(t).fill(-1), n = new Int32Array(t);
|
|
897
907
|
let i = 0;
|
|
898
|
-
for (let
|
|
899
|
-
const
|
|
900
|
-
if (
|
|
901
|
-
const
|
|
902
|
-
if (i === 0 ||
|
|
903
|
-
|
|
908
|
+
for (let r = 0; r < t; r++) {
|
|
909
|
+
const c = s[r];
|
|
910
|
+
if (c === void 0 || c === -1) continue;
|
|
911
|
+
const E = i > 0 ? n[i - 1] : void 0;
|
|
912
|
+
if (i === 0 || E !== void 0 && (s[E] ?? -1) < c) {
|
|
913
|
+
e[r] = E ?? -1, n[i++] = r;
|
|
904
914
|
continue;
|
|
905
915
|
}
|
|
906
|
-
let
|
|
907
|
-
for (;
|
|
908
|
-
const
|
|
909
|
-
|
|
916
|
+
let d = 0, m = i - 1;
|
|
917
|
+
for (; d < m; ) {
|
|
918
|
+
const p = d + m >>> 1, O = n[p];
|
|
919
|
+
O !== void 0 && (s[O] ?? -1) < c ? d = p + 1 : m = p;
|
|
910
920
|
}
|
|
911
|
-
const N = n[
|
|
912
|
-
N !== void 0 &&
|
|
921
|
+
const N = n[d];
|
|
922
|
+
N !== void 0 && c < (s[N] ?? Number.MAX_SAFE_INTEGER) && (d > 0 && (e[r] = n[d - 1] ?? -1), n[d] = r);
|
|
913
923
|
}
|
|
914
|
-
const
|
|
924
|
+
const o = new Int32Array(i);
|
|
915
925
|
if (i > 0) {
|
|
916
|
-
let
|
|
917
|
-
for (let
|
|
918
|
-
|
|
926
|
+
let r = n[i - 1];
|
|
927
|
+
for (let c = i - 1; c >= 0 && r !== void 0 && r !== -1; c--)
|
|
928
|
+
o[c] = r, r = e[r];
|
|
919
929
|
}
|
|
920
|
-
return
|
|
930
|
+
return o;
|
|
921
931
|
}
|
|
922
|
-
const
|
|
923
|
-
function
|
|
932
|
+
const ms = {}, Ce = 600, Is = `${Ce / 1e3}s`;
|
|
933
|
+
function ys() {
|
|
924
934
|
if (typeof window < "u") {
|
|
925
|
-
const
|
|
926
|
-
if (typeof
|
|
935
|
+
const s = window.__ATOM_DEBUG__;
|
|
936
|
+
if (typeof s == "boolean") return s;
|
|
927
937
|
}
|
|
928
|
-
return
|
|
938
|
+
return ms?.VITE_ATOM_DEBUG === "true";
|
|
929
939
|
}
|
|
930
|
-
let
|
|
940
|
+
let W = ys();
|
|
931
941
|
const f = {
|
|
932
942
|
get enabled() {
|
|
933
|
-
return
|
|
943
|
+
return W;
|
|
934
944
|
},
|
|
935
|
-
set enabled(
|
|
936
|
-
|
|
945
|
+
set enabled(s) {
|
|
946
|
+
W = s;
|
|
937
947
|
},
|
|
938
948
|
/**
|
|
939
949
|
* Logs a message only when debug mode is active.
|
|
940
950
|
*/
|
|
941
|
-
log(
|
|
942
|
-
|
|
951
|
+
log(s, ...t) {
|
|
952
|
+
W && console.log(`${g.MOUNT} ${s}:`, ...t);
|
|
943
953
|
},
|
|
944
954
|
/**
|
|
945
955
|
* Logs an atom value change only when debug mode is active.
|
|
946
956
|
*/
|
|
947
|
-
atomChanged(
|
|
948
|
-
|
|
949
|
-
`${
|
|
957
|
+
atomChanged(s, t, e) {
|
|
958
|
+
W && console.log(
|
|
959
|
+
`${g.MOUNT} Atom "${s ?? "anonymous"}" changed:`,
|
|
950
960
|
t,
|
|
951
961
|
"→",
|
|
952
|
-
|
|
962
|
+
e
|
|
953
963
|
);
|
|
954
964
|
},
|
|
955
965
|
/**
|
|
@@ -960,16 +970,16 @@ const f = {
|
|
|
960
970
|
* @param type - The binding type (e.g. 'text', 'checked', 'attr.href').
|
|
961
971
|
* @param value - The new value that was applied.
|
|
962
972
|
*/
|
|
963
|
-
domUpdated(
|
|
964
|
-
if (!
|
|
965
|
-
const n =
|
|
966
|
-
n instanceof HTMLElement && (console.log(`${
|
|
973
|
+
domUpdated(s, t, e) {
|
|
974
|
+
if (!W) return;
|
|
975
|
+
const n = s instanceof Element ? s : s[0];
|
|
976
|
+
n instanceof HTMLElement && (console.log(`${g.MOUNT} DOM updated: ${Xt(n)}.${t} =`, e), bs(n));
|
|
967
977
|
},
|
|
968
978
|
/**
|
|
969
979
|
* Logs a cleanup event only when debug mode is active.
|
|
970
980
|
*/
|
|
971
|
-
cleanup(
|
|
972
|
-
|
|
981
|
+
cleanup(s) {
|
|
982
|
+
W && console.log(`${g.MOUNT} Cleanup: ${s}`);
|
|
973
983
|
},
|
|
974
984
|
/**
|
|
975
985
|
* Unconditional warning for runtime errors and unexpected states.
|
|
@@ -981,46 +991,46 @@ const f = {
|
|
|
981
991
|
* originating subsystem appears in the log rather than the generic MOUNT tag.
|
|
982
992
|
* Pass an empty string to emit a prefix-free message.
|
|
983
993
|
*/
|
|
984
|
-
warn(
|
|
985
|
-
console.warn(`${
|
|
994
|
+
warn(s, t, ...e) {
|
|
995
|
+
console.warn(`${s} ${t}`, ...e);
|
|
986
996
|
},
|
|
987
997
|
/**
|
|
988
998
|
* Unconditional error for binding failures.
|
|
989
999
|
* Not gated by debugEnabled — binding errors are always surfaced because
|
|
990
1000
|
* they indicate a broken updater that silently stopped applying values.
|
|
991
1001
|
*/
|
|
992
|
-
error(
|
|
993
|
-
console.error(`${
|
|
994
|
-
}
|
|
995
|
-
},
|
|
996
|
-
let
|
|
997
|
-
function
|
|
998
|
-
if (
|
|
999
|
-
const
|
|
1000
|
-
|
|
1001
|
-
}
|
|
1002
|
-
const
|
|
1003
|
-
function
|
|
1004
|
-
if (!
|
|
1005
|
-
|
|
1006
|
-
const t =
|
|
1002
|
+
error(s, t, e) {
|
|
1003
|
+
console.error(`${s} ${t}`, e);
|
|
1004
|
+
}
|
|
1005
|
+
}, Gt = "atom-debug-highlight", Cs = "data-atom-debug";
|
|
1006
|
+
let ce;
|
|
1007
|
+
function Ss() {
|
|
1008
|
+
if (ce?.deref()?.isConnected) return;
|
|
1009
|
+
const s = document.createElement("style");
|
|
1010
|
+
s.setAttribute(Cs, ""), s.textContent = `.${Gt}{outline:2px solid rgba(255,68,68,0.8);outline-offset:1px;transition:outline ${Is} ease-out}`, document.head.appendChild(s), ce = new WeakRef(s);
|
|
1011
|
+
}
|
|
1012
|
+
const xt = /* @__PURE__ */ new WeakMap(), Pt = /* @__PURE__ */ new WeakMap();
|
|
1013
|
+
function bs(s) {
|
|
1014
|
+
if (!s.isConnected) return;
|
|
1015
|
+
Ss();
|
|
1016
|
+
const t = Pt.get(s);
|
|
1007
1017
|
t !== void 0 && cancelAnimationFrame(t);
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1018
|
+
const e = xt.get(s);
|
|
1019
|
+
e !== void 0 && clearTimeout(e);
|
|
1010
1020
|
const n = requestAnimationFrame(() => {
|
|
1011
|
-
|
|
1012
|
-
|
|
1021
|
+
Pt.delete(s), s.classList.add(Gt), xt.set(
|
|
1022
|
+
s,
|
|
1013
1023
|
setTimeout(() => {
|
|
1014
|
-
|
|
1024
|
+
s.classList.remove(Gt), xt.delete(s);
|
|
1015
1025
|
}, Ce)
|
|
1016
1026
|
);
|
|
1017
1027
|
});
|
|
1018
|
-
|
|
1028
|
+
Pt.set(s, n);
|
|
1019
1029
|
}
|
|
1020
|
-
function
|
|
1021
|
-
return
|
|
1030
|
+
function Se(s, t) {
|
|
1031
|
+
return Bt(s, t);
|
|
1022
1032
|
}
|
|
1023
|
-
Object.defineProperty(
|
|
1033
|
+
Object.defineProperty(Se, "debug", {
|
|
1024
1034
|
enumerable: !0,
|
|
1025
1035
|
// configurable: true allows tests and advanced consumers to redefine or
|
|
1026
1036
|
// delete the accessor if needed. The default (false) would permanently lock
|
|
@@ -1029,31 +1039,31 @@ Object.defineProperty(be, "debug", {
|
|
|
1029
1039
|
get() {
|
|
1030
1040
|
return f.enabled;
|
|
1031
1041
|
},
|
|
1032
|
-
set(
|
|
1033
|
-
f.enabled =
|
|
1042
|
+
set(s) {
|
|
1043
|
+
f.enabled = s;
|
|
1034
1044
|
}
|
|
1035
1045
|
});
|
|
1036
|
-
function
|
|
1037
|
-
return new Promise((
|
|
1046
|
+
function Ts() {
|
|
1047
|
+
return new Promise((s) => setTimeout(s, 0));
|
|
1038
1048
|
}
|
|
1039
|
-
const
|
|
1049
|
+
const Rs = {
|
|
1040
1050
|
// `atom` carries a runtime `debug` accessor added via Object.defineProperty.
|
|
1041
1051
|
// TypeScript cannot see it through the declared function type, so the double
|
|
1042
1052
|
// cast is unavoidable. The NamespaceExtensions annotation still verifies all
|
|
1043
1053
|
// other fields; only `atom`'s shape escapes static checking here.
|
|
1044
|
-
atom:
|
|
1045
|
-
computed:
|
|
1054
|
+
atom: Se,
|
|
1055
|
+
computed: St,
|
|
1046
1056
|
effect: X,
|
|
1047
1057
|
batch: Ie,
|
|
1048
1058
|
untracked: H,
|
|
1049
1059
|
isAtom: qt,
|
|
1050
|
-
isComputed:
|
|
1060
|
+
isComputed: qe,
|
|
1051
1061
|
isReactive: ye,
|
|
1052
|
-
nextTick:
|
|
1062
|
+
nextTick: Ts
|
|
1053
1063
|
};
|
|
1054
|
-
|
|
1055
|
-
const
|
|
1056
|
-
class
|
|
1064
|
+
l.extend(Rs);
|
|
1065
|
+
const J = "_aes-bound";
|
|
1066
|
+
class Ns {
|
|
1057
1067
|
constructor() {
|
|
1058
1068
|
this.records = /* @__PURE__ */ new WeakMap(), this.preservedNodes = /* @__PURE__ */ new WeakSet(), this.ignoredNodes = /* @__PURE__ */ new WeakSet();
|
|
1059
1069
|
}
|
|
@@ -1076,20 +1086,20 @@ class Ss {
|
|
|
1076
1086
|
// Tracking
|
|
1077
1087
|
// --------------------------------------------------------------------------
|
|
1078
1088
|
getOrCreateRecord(t) {
|
|
1079
|
-
let
|
|
1080
|
-
return
|
|
1089
|
+
let e = this.records.get(t);
|
|
1090
|
+
return e || (e = {}, this.records.set(t, e), t.classList.add(J)), e;
|
|
1081
1091
|
}
|
|
1082
|
-
trackEffect(t,
|
|
1092
|
+
trackEffect(t, e) {
|
|
1083
1093
|
const n = this.getOrCreateRecord(t);
|
|
1084
|
-
n.effects ??= [], n.effects.push(
|
|
1094
|
+
n.effects ??= [], n.effects.push(e);
|
|
1085
1095
|
}
|
|
1086
|
-
trackCleanup(t,
|
|
1096
|
+
trackCleanup(t, e) {
|
|
1087
1097
|
const n = this.getOrCreateRecord(t);
|
|
1088
|
-
n.cleanups ??= [], n.cleanups.push(
|
|
1098
|
+
n.cleanups ??= [], n.cleanups.push(e);
|
|
1089
1099
|
}
|
|
1090
|
-
setComponentCleanup(t,
|
|
1100
|
+
setComponentCleanup(t, e) {
|
|
1091
1101
|
const n = this.getOrCreateRecord(t);
|
|
1092
|
-
n.componentCleanup =
|
|
1102
|
+
n.componentCleanup = e;
|
|
1093
1103
|
}
|
|
1094
1104
|
hasBind(t) {
|
|
1095
1105
|
return this.records.has(t);
|
|
@@ -1098,160 +1108,171 @@ class Ss {
|
|
|
1098
1108
|
// Cleanup
|
|
1099
1109
|
// --------------------------------------------------------------------------
|
|
1100
1110
|
cleanup(t) {
|
|
1101
|
-
const
|
|
1102
|
-
if (!
|
|
1103
|
-
t.isConnected && t.classList.remove(
|
|
1111
|
+
const e = this.records.get(t);
|
|
1112
|
+
if (!e) {
|
|
1113
|
+
t.isConnected && t.classList.remove(J), this.preservedNodes.delete(t), this.ignoredNodes.delete(t);
|
|
1104
1114
|
return;
|
|
1105
1115
|
}
|
|
1106
|
-
if (this.records.delete(t), this.preservedNodes.delete(t), this.ignoredNodes.delete(t), t.isConnected && t.classList.remove(
|
|
1116
|
+
if (this.records.delete(t), this.preservedNodes.delete(t), this.ignoredNodes.delete(t), t.isConnected && t.classList.remove(J), f.enabled && f.cleanup(Xt(t)), e.componentCleanup)
|
|
1107
1117
|
try {
|
|
1108
|
-
|
|
1118
|
+
e.componentCleanup();
|
|
1109
1119
|
} catch (n) {
|
|
1110
|
-
f.error(
|
|
1111
|
-
}
|
|
1112
|
-
s.effects?.forEach((n) => {
|
|
1113
|
-
try {
|
|
1114
|
-
n.dispose();
|
|
1115
|
-
} catch (i) {
|
|
1116
|
-
f.error(d.BINDING, S.EFFECT_DISPOSE_ERROR(), i);
|
|
1120
|
+
f.error(g.MOUNT, T.MOUNT_CLEANUP_ERROR(), n);
|
|
1117
1121
|
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1122
|
+
if (e.effects) {
|
|
1123
|
+
const n = e.effects;
|
|
1124
|
+
for (let i = 0, o = n.length; i < o; i++)
|
|
1125
|
+
try {
|
|
1126
|
+
n[i].dispose();
|
|
1127
|
+
} catch (r) {
|
|
1128
|
+
f.error(g.BINDING, T.EFFECT_DISPOSE_ERROR(), r);
|
|
1129
|
+
}
|
|
1130
|
+
}
|
|
1131
|
+
if (e.cleanups) {
|
|
1132
|
+
const n = e.cleanups;
|
|
1133
|
+
for (let i = 0, o = n.length; i < o; i++)
|
|
1134
|
+
try {
|
|
1135
|
+
n[i]();
|
|
1136
|
+
} catch (r) {
|
|
1137
|
+
f.error(g.BINDING, T.BINDING_CLEANUP_ERROR(), r);
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1125
1140
|
}
|
|
1126
1141
|
cleanupDescendants(t) {
|
|
1127
|
-
const
|
|
1128
|
-
for (
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1142
|
+
const e = t.getElementsByClassName(J);
|
|
1143
|
+
for (let n = e.length - 1; n >= 0; n--) {
|
|
1144
|
+
const i = e[n];
|
|
1145
|
+
i && (this.records.has(i) ? this.cleanup(i) : (i.classList.remove(J), f.enabled && f.warn(
|
|
1146
|
+
g.BINDING,
|
|
1147
|
+
`${J} class found on unregistered element:`,
|
|
1148
|
+
i
|
|
1149
|
+
)));
|
|
1150
|
+
}
|
|
1134
1151
|
}
|
|
1135
1152
|
cleanupTree(t) {
|
|
1136
1153
|
this.cleanupDescendants(t), this.cleanup(t);
|
|
1137
1154
|
}
|
|
1138
1155
|
}
|
|
1139
|
-
const
|
|
1140
|
-
let it = null,
|
|
1141
|
-
function
|
|
1156
|
+
const y = new Ns();
|
|
1157
|
+
let it = null, pt = null;
|
|
1158
|
+
function Os(s) {
|
|
1142
1159
|
if (it !== null) {
|
|
1143
|
-
|
|
1144
|
-
|
|
1160
|
+
pt !== s && f.warn(
|
|
1161
|
+
g.BINDING,
|
|
1145
1162
|
"enableAutoCleanup() called with a different root while already active. Observation was NOT switched — call disableAutoCleanup() first.",
|
|
1146
|
-
{ current:
|
|
1163
|
+
{ current: pt, requested: s }
|
|
1147
1164
|
);
|
|
1148
1165
|
return;
|
|
1149
1166
|
}
|
|
1150
|
-
|
|
1151
|
-
for (
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1167
|
+
pt = s, it = new MutationObserver((t) => {
|
|
1168
|
+
for (let e = 0, n = t.length; e < n; e++) {
|
|
1169
|
+
const i = t[e].removedNodes;
|
|
1170
|
+
for (let o = 0, r = i.length; o < r; o++) {
|
|
1171
|
+
const c = i[o];
|
|
1172
|
+
c.nodeType === 1 && (c.isConnected || y.isKept(c) || y.isIgnored(c) || y.cleanupTree(c));
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
}), it.observe(s, { childList: !0, subtree: !0 });
|
|
1155
1176
|
}
|
|
1156
|
-
function
|
|
1157
|
-
it?.disconnect(), it = null,
|
|
1177
|
+
function Vs() {
|
|
1178
|
+
it?.disconnect(), it = null, pt = null;
|
|
1158
1179
|
}
|
|
1159
|
-
function Q(
|
|
1180
|
+
function Q(s, t, e, n) {
|
|
1160
1181
|
if (ye(t)) {
|
|
1161
1182
|
const i = t;
|
|
1162
|
-
|
|
1163
|
-
|
|
1183
|
+
y.trackEffect(
|
|
1184
|
+
s,
|
|
1164
1185
|
X(() => {
|
|
1165
|
-
const
|
|
1186
|
+
const o = i.value;
|
|
1166
1187
|
H(() => {
|
|
1167
1188
|
try {
|
|
1168
|
-
|
|
1169
|
-
} catch (
|
|
1170
|
-
f.error(
|
|
1189
|
+
e(o);
|
|
1190
|
+
} catch (r) {
|
|
1191
|
+
f.error(g.BINDING, `${T.UPDATER_ERROR(n)}:`, r);
|
|
1171
1192
|
return;
|
|
1172
1193
|
}
|
|
1173
|
-
f.enabled && f.domUpdated(
|
|
1194
|
+
f.enabled && f.domUpdated(s, n, o);
|
|
1174
1195
|
});
|
|
1175
1196
|
})
|
|
1176
1197
|
);
|
|
1177
1198
|
} else {
|
|
1178
1199
|
try {
|
|
1179
|
-
|
|
1200
|
+
e(t);
|
|
1180
1201
|
} catch (i) {
|
|
1181
|
-
f.error(
|
|
1202
|
+
f.error(g.BINDING, `${T.UPDATER_ERROR(n)} (static):`, i);
|
|
1182
1203
|
return;
|
|
1183
1204
|
}
|
|
1184
|
-
f.enabled && f.domUpdated(
|
|
1205
|
+
f.enabled && f.domUpdated(s, n, t);
|
|
1185
1206
|
}
|
|
1186
1207
|
}
|
|
1187
1208
|
const F = /* @__PURE__ */ Symbol("atom-effect-internal"), mt = /* @__PURE__ */ new WeakMap();
|
|
1188
|
-
let
|
|
1189
|
-
const
|
|
1190
|
-
if (
|
|
1191
|
-
let t = mt.get(
|
|
1192
|
-
return t || (t = function(...
|
|
1193
|
-
return Ie(() =>
|
|
1194
|
-
}, t[F] = !0, mt.set(
|
|
1209
|
+
let x = null;
|
|
1210
|
+
const be = (s) => {
|
|
1211
|
+
if (s[F]) return s;
|
|
1212
|
+
let t = mt.get(s);
|
|
1213
|
+
return t || (t = function(...e) {
|
|
1214
|
+
return Ie(() => s.apply(this, e));
|
|
1215
|
+
}, t[F] = !0, mt.set(s, t)), t;
|
|
1195
1216
|
};
|
|
1196
|
-
function
|
|
1217
|
+
function Ds(s) {
|
|
1197
1218
|
const t = {};
|
|
1198
|
-
return Object.keys(
|
|
1199
|
-
const n = e
|
|
1200
|
-
n && (t[
|
|
1219
|
+
return Object.keys(s).forEach((e) => {
|
|
1220
|
+
const n = s[e];
|
|
1221
|
+
n && (t[e] = be(n));
|
|
1201
1222
|
}), t;
|
|
1202
1223
|
}
|
|
1203
|
-
function
|
|
1224
|
+
function vs(s) {
|
|
1204
1225
|
const t = {};
|
|
1205
|
-
return Object.keys(
|
|
1206
|
-
const n = e
|
|
1207
|
-
t[
|
|
1226
|
+
return Object.keys(s).forEach((e) => {
|
|
1227
|
+
const n = s[e];
|
|
1228
|
+
t[e] = n ? mt.get(n) ?? n : void 0;
|
|
1208
1229
|
}), t;
|
|
1209
1230
|
}
|
|
1210
|
-
function
|
|
1211
|
-
if (
|
|
1212
|
-
|
|
1213
|
-
on:
|
|
1214
|
-
off:
|
|
1215
|
-
remove:
|
|
1216
|
-
empty:
|
|
1217
|
-
detach:
|
|
1231
|
+
function As() {
|
|
1232
|
+
if (x !== null) return;
|
|
1233
|
+
x = {
|
|
1234
|
+
on: l.fn.on,
|
|
1235
|
+
off: l.fn.off,
|
|
1236
|
+
remove: l.fn.remove,
|
|
1237
|
+
empty: l.fn.empty,
|
|
1238
|
+
detach: l.fn.detach
|
|
1218
1239
|
};
|
|
1219
|
-
const
|
|
1220
|
-
|
|
1221
|
-
const
|
|
1222
|
-
for (let n = 0, i =
|
|
1223
|
-
const
|
|
1224
|
-
|
|
1240
|
+
const s = x;
|
|
1241
|
+
l.fn.remove = function(t) {
|
|
1242
|
+
const e = t ? this.filter(t) : this;
|
|
1243
|
+
for (let n = 0, i = e.length; n < i; n++) {
|
|
1244
|
+
const o = e[n];
|
|
1245
|
+
o && (y.markIgnored(o), y.cleanupTree(o));
|
|
1225
1246
|
}
|
|
1226
|
-
return
|
|
1227
|
-
},
|
|
1228
|
-
for (let t = 0,
|
|
1247
|
+
return s.remove.call(this, t);
|
|
1248
|
+
}, l.fn.empty = function() {
|
|
1249
|
+
for (let t = 0, e = this.length; t < e; t++) {
|
|
1229
1250
|
const n = this[t];
|
|
1230
|
-
n &&
|
|
1251
|
+
n && y.cleanupDescendants(n);
|
|
1231
1252
|
}
|
|
1232
|
-
return
|
|
1233
|
-
},
|
|
1234
|
-
const
|
|
1235
|
-
for (let n = 0, i =
|
|
1236
|
-
const
|
|
1237
|
-
|
|
1253
|
+
return s.empty.call(this);
|
|
1254
|
+
}, l.fn.detach = function(t) {
|
|
1255
|
+
const e = t ? this.filter(t) : this;
|
|
1256
|
+
for (let n = 0, i = e.length; n < i; n++) {
|
|
1257
|
+
const o = e[n];
|
|
1258
|
+
o && y.keep(o);
|
|
1238
1259
|
}
|
|
1239
|
-
return
|
|
1240
|
-
},
|
|
1241
|
-
const
|
|
1242
|
-
if (
|
|
1243
|
-
t[0] =
|
|
1260
|
+
return s.detach.call(this, t);
|
|
1261
|
+
}, l.fn.on = function(...t) {
|
|
1262
|
+
const e = t[0];
|
|
1263
|
+
if (e && typeof e == "object")
|
|
1264
|
+
t[0] = Ds(e);
|
|
1244
1265
|
else
|
|
1245
1266
|
for (let n = t.length - 1; n >= 0; n--)
|
|
1246
1267
|
if (typeof t[n] == "function") {
|
|
1247
|
-
t[n] =
|
|
1268
|
+
t[n] = be(t[n]);
|
|
1248
1269
|
break;
|
|
1249
1270
|
}
|
|
1250
|
-
return
|
|
1251
|
-
},
|
|
1252
|
-
const
|
|
1253
|
-
if (
|
|
1254
|
-
t[0] =
|
|
1271
|
+
return s.on.apply(this, t);
|
|
1272
|
+
}, l.fn.off = function(...t) {
|
|
1273
|
+
const e = t[0];
|
|
1274
|
+
if (e && typeof e == "object")
|
|
1275
|
+
t[0] = vs(e);
|
|
1255
1276
|
else
|
|
1256
1277
|
for (let n = t.length - 1; n >= 0; n--)
|
|
1257
1278
|
if (typeof t[n] == "function") {
|
|
@@ -1259,483 +1280,497 @@ function Ns() {
|
|
|
1259
1280
|
t[n] = mt.get(i) ?? i;
|
|
1260
1281
|
break;
|
|
1261
1282
|
}
|
|
1262
|
-
return
|
|
1283
|
+
return s.off.apply(this, t);
|
|
1263
1284
|
};
|
|
1264
1285
|
}
|
|
1265
|
-
function
|
|
1266
|
-
|
|
1286
|
+
function qs() {
|
|
1287
|
+
x !== null && (l.fn.on = x.on, l.fn.off = x.off, l.fn.remove = x.remove, l.fn.empty = x.empty, l.fn.detach = x.detach, x = null);
|
|
1267
1288
|
}
|
|
1268
|
-
var
|
|
1269
|
-
let
|
|
1270
|
-
class
|
|
1271
|
-
constructor(t,
|
|
1272
|
-
this.flags = 0, this.timeoutId = void 0, this.
|
|
1273
|
-
this.flags |=
|
|
1289
|
+
var v = /* @__PURE__ */ ((s) => (s[s.None = 0] = "None", s[s.Focused = 1] = "Focused", s[s.Composing = 2] = "Composing", s[s.SyncingToAtom = 4] = "SyncingToAtom", s[s.SyncingToDom = 8] = "SyncingToDom", s[s.Busy = 14] = "Busy", s))(v || {});
|
|
1290
|
+
let Ls = 0;
|
|
1291
|
+
class Us {
|
|
1292
|
+
constructor(t, e, n) {
|
|
1293
|
+
this.flags = 0, this.timeoutId = void 0, this.handleCompositionStart = () => {
|
|
1294
|
+
this.flags |= v.Composing;
|
|
1274
1295
|
}, this.handleCompositionEnd = () => {
|
|
1275
|
-
this.flags &= ~
|
|
1296
|
+
this.flags &= ~v.Composing, this.handleInput();
|
|
1276
1297
|
}, this.handleFocus = () => {
|
|
1277
|
-
this.flags |=
|
|
1298
|
+
this.flags |= v.Focused;
|
|
1278
1299
|
}, this.handleBlur = () => {
|
|
1279
|
-
this.flags &= ~
|
|
1280
|
-
const r = this.
|
|
1300
|
+
this.flags &= ~v.Focused, this.timeoutId !== void 0 && (clearTimeout(this.timeoutId), this.timeoutId = void 0, this.syncAtomFromDom());
|
|
1301
|
+
const r = this.format(this.atom.peek());
|
|
1281
1302
|
this.el.value !== r && (this.el.value = r);
|
|
1282
1303
|
}, this.syncDomFromAtom = () => {
|
|
1283
1304
|
const r = this.atom.value;
|
|
1284
1305
|
H(() => {
|
|
1285
|
-
const
|
|
1286
|
-
if (
|
|
1287
|
-
const
|
|
1288
|
-
if (
|
|
1306
|
+
const c = this.format(r), E = this.el.value;
|
|
1307
|
+
if (E === c) return;
|
|
1308
|
+
const d = !!(this.flags & v.Focused);
|
|
1309
|
+
if (d)
|
|
1289
1310
|
try {
|
|
1290
|
-
if (this.
|
|
1311
|
+
if (this.equal(this.parse(E), r)) return;
|
|
1291
1312
|
} catch {
|
|
1292
1313
|
}
|
|
1293
|
-
this.flags |=
|
|
1314
|
+
this.flags |= v.SyncingToDom;
|
|
1294
1315
|
try {
|
|
1295
|
-
if (
|
|
1296
|
-
const
|
|
1297
|
-
this.el.value =
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1316
|
+
if (d && (this.el instanceof HTMLInputElement || this.el instanceof HTMLTextAreaElement)) {
|
|
1317
|
+
const m = this.el.selectionStart, N = this.el.selectionEnd;
|
|
1318
|
+
this.el.value = c;
|
|
1319
|
+
const p = c.length;
|
|
1320
|
+
m !== null && N !== null && this.el.setSelectionRange(m < p ? m : p, N < p ? N : p);
|
|
1300
1321
|
} else
|
|
1301
|
-
this.el.value =
|
|
1302
|
-
f.domUpdated(this.$el, "val",
|
|
1322
|
+
this.el.value = c;
|
|
1323
|
+
f.domUpdated(this.$el, "val", c);
|
|
1303
1324
|
} finally {
|
|
1304
|
-
this.flags &= ~
|
|
1325
|
+
this.flags &= ~v.SyncingToDom;
|
|
1305
1326
|
}
|
|
1306
1327
|
});
|
|
1307
1328
|
}, this.cleanup = () => {
|
|
1308
1329
|
this.$el.off(this.ns), clearTimeout(this.timeoutId), this.timeoutId = void 0;
|
|
1309
|
-
}, this.$el = t, this.el = t[0], this.atom =
|
|
1310
|
-
const i = n.debounce ?? 0;
|
|
1311
|
-
this.
|
|
1312
|
-
|
|
1313
|
-
event: n.event ?? Ye.EVENT,
|
|
1314
|
-
parse: n.parse ?? ((r) => r),
|
|
1315
|
-
format: n.format ?? ((r) => String(r ?? "")),
|
|
1316
|
-
equal: n.equal ?? Object.is
|
|
1317
|
-
}, i > 0 ? this.handleInput = () => {
|
|
1318
|
-
this.flags & R.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), i));
|
|
1330
|
+
}, this.$el = t, this.el = t[0], this.atom = e, this.ns = `.atomBind-${++Ls}`;
|
|
1331
|
+
const i = n.debounce ?? 0, o = n.event ?? We.EVENT;
|
|
1332
|
+
this.parse = n.parse ?? ((r) => r), this.format = n.format ?? ((r) => String(r ?? "")), this.equal = n.equal ?? Object.is, i > 0 ? this.handleInput = () => {
|
|
1333
|
+
this.flags & v.Composing || (clearTimeout(this.timeoutId), this.timeoutId = setTimeout(() => this.syncAtomFromDom(), i));
|
|
1319
1334
|
} : this.handleInput = () => {
|
|
1320
|
-
this.flags &
|
|
1321
|
-
}, this.handleFocus[F] = !0, this.handleBlur[F] = !0, this.handleCompositionStart[F] = !0, this.handleCompositionEnd[F] = !0, this.handleInput[F] = !0, this.bindEvents();
|
|
1335
|
+
this.flags & v.Composing || this.syncAtomFromDom();
|
|
1336
|
+
}, this.handleFocus[F] = !0, this.handleBlur[F] = !0, this.handleCompositionStart[F] = !0, this.handleCompositionEnd[F] = !0, this.handleInput[F] = !0, this.bindEvents(o);
|
|
1322
1337
|
}
|
|
1323
1338
|
// --- Sync Logic ---
|
|
1324
1339
|
syncAtomFromDom() {
|
|
1325
|
-
if (!(this.flags &
|
|
1326
|
-
this.flags |=
|
|
1340
|
+
if (!(this.flags & v.Busy)) {
|
|
1341
|
+
this.flags |= v.SyncingToAtom;
|
|
1327
1342
|
try {
|
|
1328
|
-
const t = this.
|
|
1329
|
-
this.
|
|
1343
|
+
const t = this.parse(this.el.value);
|
|
1344
|
+
this.equal(this.atom.peek(), t) || (this.atom.value = t);
|
|
1330
1345
|
} catch (t) {
|
|
1331
|
-
f.warn(
|
|
1346
|
+
f.warn(g.BINDING, `${T.PARSE_ERROR()}:`, t);
|
|
1332
1347
|
} finally {
|
|
1333
|
-
this.flags &= ~
|
|
1348
|
+
this.flags &= ~v.SyncingToAtom;
|
|
1334
1349
|
}
|
|
1335
1350
|
}
|
|
1336
1351
|
}
|
|
1337
|
-
bindEvents() {
|
|
1338
|
-
|
|
1352
|
+
bindEvents(t) {
|
|
1353
|
+
const e = this.ns;
|
|
1354
|
+
this.$el.on(`focus${e}`, this.handleFocus).on(`blur${e}`, this.handleBlur).on(`compositionstart${e}`, this.handleCompositionStart).on(`compositionend${e}`, this.handleCompositionEnd).on(`${t}${e}`, this.handleInput);
|
|
1339
1355
|
}
|
|
1340
1356
|
}
|
|
1341
|
-
function
|
|
1342
|
-
const n = new
|
|
1357
|
+
function ws(s, t, e) {
|
|
1358
|
+
const n = new Us(s, t, e);
|
|
1343
1359
|
return { fx: X(n.syncDomFromAtom), cleanup: n.cleanup };
|
|
1344
1360
|
}
|
|
1345
|
-
const
|
|
1346
|
-
function
|
|
1347
|
-
let t =
|
|
1348
|
-
return t !== void 0 || (t =
|
|
1361
|
+
const ae = /* @__PURE__ */ new Map();
|
|
1362
|
+
function ks(s) {
|
|
1363
|
+
let t = ae.get(s);
|
|
1364
|
+
return t !== void 0 || (t = s.includes("-") ? s.replace(/-./g, (e) => e[1].toUpperCase()) : s, ae.set(s, t)), t;
|
|
1349
1365
|
}
|
|
1350
|
-
const
|
|
1351
|
-
function
|
|
1352
|
-
let t =
|
|
1353
|
-
return t || (t =
|
|
1366
|
+
const le = /* @__PURE__ */ new WeakMap();
|
|
1367
|
+
function xs(s) {
|
|
1368
|
+
let t = le.get(s);
|
|
1369
|
+
return t || (t = St(() => Ht(s.value)), le.set(s, t)), t;
|
|
1354
1370
|
}
|
|
1355
|
-
function
|
|
1371
|
+
function U(s) {
|
|
1356
1372
|
return {
|
|
1357
|
-
$el:
|
|
1358
|
-
el:
|
|
1359
|
-
trackCleanup: (t) =>
|
|
1373
|
+
$el: l(s),
|
|
1374
|
+
el: s,
|
|
1375
|
+
trackCleanup: (t) => y.trackCleanup(s, t)
|
|
1360
1376
|
};
|
|
1361
1377
|
}
|
|
1362
|
-
function Te(
|
|
1363
|
-
const n =
|
|
1378
|
+
function Te(s, t, e) {
|
|
1379
|
+
const n = s.el;
|
|
1364
1380
|
Q(
|
|
1365
1381
|
n,
|
|
1366
1382
|
t,
|
|
1367
1383
|
(i) => {
|
|
1368
|
-
const
|
|
1369
|
-
n.textContent !==
|
|
1384
|
+
const o = e ? e(i) : typeof i == "string" ? i : String(i ?? "");
|
|
1385
|
+
n.textContent !== o && (n.textContent = o);
|
|
1370
1386
|
},
|
|
1371
1387
|
"text"
|
|
1372
1388
|
);
|
|
1373
1389
|
}
|
|
1374
|
-
function Re(
|
|
1375
|
-
const
|
|
1390
|
+
function Re(s, t) {
|
|
1391
|
+
const e = s.el, n = qt(t) ? xs(t) : t;
|
|
1376
1392
|
Q(
|
|
1377
|
-
|
|
1393
|
+
e,
|
|
1378
1394
|
n,
|
|
1379
1395
|
(i) => {
|
|
1380
|
-
|
|
1396
|
+
e.innerHTML !== i && (y.cleanupDescendants(e), e.innerHTML = i);
|
|
1381
1397
|
},
|
|
1382
1398
|
"html"
|
|
1383
1399
|
);
|
|
1384
1400
|
}
|
|
1385
|
-
function
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
e
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1401
|
+
function Ne(s, t) {
|
|
1402
|
+
for (const e in t)
|
|
1403
|
+
if (rt.call(t, e)) {
|
|
1404
|
+
const n = t[e];
|
|
1405
|
+
Q(
|
|
1406
|
+
s.el,
|
|
1407
|
+
n,
|
|
1408
|
+
(i) => {
|
|
1409
|
+
s.el.classList.toggle(e, !!i);
|
|
1410
|
+
},
|
|
1411
|
+
`class.${e}`
|
|
1412
|
+
);
|
|
1413
|
+
}
|
|
1396
1414
|
}
|
|
1397
|
-
function
|
|
1398
|
-
const
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1415
|
+
function Oe(s, t) {
|
|
1416
|
+
const e = s.el, n = e.style;
|
|
1417
|
+
for (const i in t)
|
|
1418
|
+
if (rt.call(t, i)) {
|
|
1419
|
+
const o = t[i], r = ks(i), [c, E] = Array.isArray(o) ? o : [o, ""];
|
|
1420
|
+
Q(
|
|
1421
|
+
e,
|
|
1422
|
+
c,
|
|
1423
|
+
(d) => {
|
|
1424
|
+
const m = E ? `${d}${E}` : String(d);
|
|
1425
|
+
Es(m) || (n[r] = m);
|
|
1426
|
+
},
|
|
1427
|
+
`css.${i}`
|
|
1428
|
+
);
|
|
1429
|
+
}
|
|
1411
1430
|
}
|
|
1412
|
-
function
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1431
|
+
function De(s, t) {
|
|
1432
|
+
const e = s.el;
|
|
1433
|
+
for (const n in t)
|
|
1434
|
+
if (rt.call(t, n)) {
|
|
1435
|
+
if (n.toLowerCase().startsWith("on")) continue;
|
|
1436
|
+
Q(
|
|
1437
|
+
e,
|
|
1438
|
+
t[n],
|
|
1439
|
+
(i) => {
|
|
1440
|
+
if (i == null || i === !1) {
|
|
1441
|
+
e.removeAttribute(n);
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
const o = i === !0 ? n : String(i);
|
|
1445
|
+
_s(n, o) || e.getAttribute(n) !== o && e.setAttribute(n, o);
|
|
1446
|
+
},
|
|
1447
|
+
`attr.${n}`
|
|
1448
|
+
);
|
|
1449
|
+
}
|
|
1429
1450
|
}
|
|
1430
|
-
function
|
|
1431
|
-
const
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1451
|
+
function ve(s, t) {
|
|
1452
|
+
const e = s.el;
|
|
1453
|
+
for (const n in t)
|
|
1454
|
+
if (rt.call(t, n)) {
|
|
1455
|
+
if (Ze.has(n)) continue;
|
|
1456
|
+
Q(
|
|
1457
|
+
s.el,
|
|
1458
|
+
t[n],
|
|
1459
|
+
(i) => {
|
|
1460
|
+
e[n] !== i && (e[n] = i);
|
|
1461
|
+
},
|
|
1462
|
+
`prop.${n}`
|
|
1463
|
+
);
|
|
1464
|
+
}
|
|
1442
1465
|
}
|
|
1443
|
-
function
|
|
1444
|
-
const n =
|
|
1466
|
+
function It(s, t, e) {
|
|
1467
|
+
const n = s.el;
|
|
1445
1468
|
Q(
|
|
1446
1469
|
n,
|
|
1447
1470
|
t,
|
|
1448
|
-
(
|
|
1449
|
-
const
|
|
1450
|
-
n.style.display =
|
|
1471
|
+
(o) => {
|
|
1472
|
+
const r = e !== !!o;
|
|
1473
|
+
n.style.display = r ? "" : "none";
|
|
1451
1474
|
},
|
|
1452
|
-
|
|
1475
|
+
e ? "hide" : "show"
|
|
1453
1476
|
);
|
|
1454
1477
|
}
|
|
1455
|
-
function
|
|
1456
|
-
const n =
|
|
1457
|
-
if (!
|
|
1458
|
-
console.warn(`${
|
|
1478
|
+
function Ae(s, t, e = {}) {
|
|
1479
|
+
const n = s.el.tagName.toLowerCase();
|
|
1480
|
+
if (!Je.has(n)) {
|
|
1481
|
+
console.warn(`${g.BINDING} ${T.INVALID_INPUT_ELEMENT(n)}`);
|
|
1459
1482
|
return;
|
|
1460
1483
|
}
|
|
1461
|
-
const { fx: i, cleanup:
|
|
1462
|
-
|
|
1484
|
+
const { fx: i, cleanup: o } = ws(s.$el, t, e);
|
|
1485
|
+
y.trackEffect(s.el, i), s.trackCleanup(o);
|
|
1463
1486
|
}
|
|
1464
|
-
function
|
|
1465
|
-
const
|
|
1466
|
-
const
|
|
1467
|
-
t.value !==
|
|
1487
|
+
function Le(s, t) {
|
|
1488
|
+
const e = s.el, n = s.$el, i = () => {
|
|
1489
|
+
const r = e.checked;
|
|
1490
|
+
t.value !== r && (t.value = r);
|
|
1468
1491
|
};
|
|
1469
|
-
i[F] = !0, n.on("change", i),
|
|
1470
|
-
const
|
|
1471
|
-
const
|
|
1492
|
+
i[F] = !0, n.on("change", i), s.trackCleanup(() => n.off("change", i));
|
|
1493
|
+
const o = X(() => {
|
|
1494
|
+
const r = !!t.value;
|
|
1472
1495
|
H(() => {
|
|
1473
|
-
|
|
1496
|
+
e.checked !== r && (e.checked = r, f.domUpdated(n, "checked", r));
|
|
1474
1497
|
});
|
|
1475
1498
|
});
|
|
1476
|
-
|
|
1499
|
+
y.trackEffect(e, o);
|
|
1477
1500
|
}
|
|
1478
|
-
function
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1501
|
+
function Ps(s, t) {
|
|
1502
|
+
const e = s.$el;
|
|
1503
|
+
e.on(t), s.trackCleanup(() => e.off(t));
|
|
1481
1504
|
}
|
|
1482
|
-
function
|
|
1483
|
-
const n =
|
|
1484
|
-
n.on(t,
|
|
1505
|
+
function $s(s, t, e) {
|
|
1506
|
+
const n = s.$el;
|
|
1507
|
+
n.on(t, e), s.trackCleanup(() => n.off(t, e));
|
|
1485
1508
|
}
|
|
1486
|
-
function Ue(
|
|
1487
|
-
|
|
1509
|
+
function Ue(s) {
|
|
1510
|
+
y.cleanupTree(s);
|
|
1488
1511
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
Te(
|
|
1492
|
-
|
|
1512
|
+
l.fn.atomText = function(s, t) {
|
|
1513
|
+
for (let e = 0, n = this.length; e < n; e++)
|
|
1514
|
+
Te(U(this[e]), s, t);
|
|
1515
|
+
return this;
|
|
1493
1516
|
};
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
Re(
|
|
1497
|
-
|
|
1517
|
+
l.fn.atomHtml = function(s) {
|
|
1518
|
+
for (let t = 0, e = this.length; t < e; t++)
|
|
1519
|
+
Re(U(this[t]), s);
|
|
1520
|
+
return this;
|
|
1498
1521
|
};
|
|
1499
|
-
|
|
1500
|
-
if (typeof
|
|
1501
|
-
return console.warn(`${
|
|
1502
|
-
const
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1522
|
+
l.fn.atomClass = function(s, t) {
|
|
1523
|
+
if (typeof s == "string" && t === void 0)
|
|
1524
|
+
return console.warn(`${g.BINDING} ${T.MISSING_CONDITION("atomClass")}`), this;
|
|
1525
|
+
const e = typeof s == "string" ? { [s]: t } : s;
|
|
1526
|
+
for (let n = 0, i = this.length; n < i; n++)
|
|
1527
|
+
Ne(U(this[n]), e);
|
|
1528
|
+
return this;
|
|
1506
1529
|
};
|
|
1507
|
-
|
|
1508
|
-
if (typeof
|
|
1509
|
-
return console.warn(`${
|
|
1510
|
-
const n = typeof
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1530
|
+
l.fn.atomCss = function(s, t, e) {
|
|
1531
|
+
if (typeof s == "string" && t === void 0)
|
|
1532
|
+
return console.warn(`${g.BINDING} ${T.MISSING_SOURCE("atomCss")}`), this;
|
|
1533
|
+
const n = typeof s == "string" ? { [s]: e ? [t, e] : t } : s;
|
|
1534
|
+
for (let i = 0, o = this.length; i < o; i++)
|
|
1535
|
+
Oe(U(this[i]), n);
|
|
1536
|
+
return this;
|
|
1514
1537
|
};
|
|
1515
|
-
|
|
1516
|
-
if (typeof
|
|
1517
|
-
return console.warn(`${
|
|
1518
|
-
const
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1538
|
+
l.fn.atomAttr = function(s, t) {
|
|
1539
|
+
if (typeof s == "string" && t === void 0)
|
|
1540
|
+
return console.warn(`${g.BINDING} ${T.MISSING_SOURCE("atomAttr")}`), this;
|
|
1541
|
+
const e = typeof s == "string" ? { [s]: t } : s;
|
|
1542
|
+
for (let n = 0, i = this.length; n < i; n++)
|
|
1543
|
+
De(U(this[n]), e);
|
|
1544
|
+
return this;
|
|
1522
1545
|
};
|
|
1523
|
-
|
|
1524
|
-
if (typeof
|
|
1525
|
-
return console.warn(`${
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1546
|
+
l.fn.atomProp = function(s, t) {
|
|
1547
|
+
if (typeof s == "string" && t === void 0)
|
|
1548
|
+
return console.warn(`${g.BINDING} ${T.MISSING_SOURCE("atomProp")}`), this;
|
|
1549
|
+
const e = typeof s == "string" ? { [s]: t } : s;
|
|
1550
|
+
for (let n = 0, i = this.length; n < i; n++)
|
|
1551
|
+
ve(U(this[n]), e);
|
|
1552
|
+
return this;
|
|
1530
1553
|
};
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1554
|
+
l.fn.atomShow = function(s) {
|
|
1555
|
+
for (let t = 0, e = this.length; t < e; t++)
|
|
1556
|
+
It(U(this[t]), s, !1);
|
|
1557
|
+
return this;
|
|
1535
1558
|
};
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1559
|
+
l.fn.atomHide = function(s) {
|
|
1560
|
+
for (let t = 0, e = this.length; t < e; t++)
|
|
1561
|
+
It(U(this[t]), s, !0);
|
|
1562
|
+
return this;
|
|
1540
1563
|
};
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1564
|
+
l.fn.atomVal = function(s, t = {}) {
|
|
1565
|
+
for (let e = 0, n = this.length; e < n; e++)
|
|
1566
|
+
Ae(U(this[e]), s, t);
|
|
1567
|
+
return this;
|
|
1545
1568
|
};
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1569
|
+
l.fn.atomChecked = function(s) {
|
|
1570
|
+
for (let t = 0, e = this.length; t < e; t++)
|
|
1571
|
+
Le(U(this[t]), s);
|
|
1572
|
+
return this;
|
|
1550
1573
|
};
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1574
|
+
l.fn.atomOn = function(s, t) {
|
|
1575
|
+
for (let e = 0, n = this.length; e < n; e++)
|
|
1576
|
+
$s(U(this[e]), s, t);
|
|
1577
|
+
return this;
|
|
1555
1578
|
};
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
e.checked !== void 0 && Ae(t, e.checked), e.on !== void 0 && ws(t, e.on);
|
|
1566
|
-
});
|
|
1579
|
+
l.fn.atomBind = function(s) {
|
|
1580
|
+
const { text: t, html: e, class: n, css: i, attr: o, prop: r, show: c, hide: E, val: d, checked: m, on: N } = s;
|
|
1581
|
+
let p, O;
|
|
1582
|
+
d !== void 0 && (Array.isArray(d) ? (p = d[0], O = d[1]) : p = d);
|
|
1583
|
+
for (let G = 0, C = this.length; G < C; G++) {
|
|
1584
|
+
const I = U(this[G]);
|
|
1585
|
+
t !== void 0 && Te(I, t), e !== void 0 && Re(I, e), n !== void 0 && Ne(I, n), i !== void 0 && Oe(I, i), o !== void 0 && De(I, o), r !== void 0 && ve(I, r), c !== void 0 && It(I, c, !1), E !== void 0 && It(I, E, !0), d !== void 0 && Ae(I, p, O), m !== void 0 && Le(I, m), N !== void 0 && Ps(I, N);
|
|
1586
|
+
}
|
|
1587
|
+
return this;
|
|
1567
1588
|
};
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
Ue(this);
|
|
1571
|
-
|
|
1589
|
+
l.fn.atomUnbind = function() {
|
|
1590
|
+
for (let s = 0, t = this.length; s < t; s++)
|
|
1591
|
+
Ue(this[s]);
|
|
1592
|
+
return this;
|
|
1572
1593
|
};
|
|
1573
|
-
function
|
|
1574
|
-
t?.isConnected ?
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
const { key:
|
|
1578
|
-
|
|
1579
|
-
const
|
|
1580
|
-
let
|
|
1581
|
-
const
|
|
1582
|
-
const
|
|
1583
|
-
bt?.isDisposed || (
|
|
1594
|
+
function Ms(s, t, e) {
|
|
1595
|
+
t?.isConnected ? s.insertBefore(t) : s.appendTo(e);
|
|
1596
|
+
}
|
|
1597
|
+
l.fn.atomList = function(s, t) {
|
|
1598
|
+
const { key: e, render: n, bind: i, update: o, onAdd: r, onRemove: c, empty: E } = t, d = typeof e == "function" ? e : (m, N) => m[e];
|
|
1599
|
+
for (let m = 0, N = this.length; m < N; m++) {
|
|
1600
|
+
const p = this[m], O = l(p), G = Xt(p), C = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Set();
|
|
1601
|
+
let R = [], Y = null;
|
|
1602
|
+
const we = (L, D) => {
|
|
1603
|
+
const z = () => {
|
|
1604
|
+
bt?.isDisposed || (D.$el.remove(), I.delete(L), f.log("list", `${G} removed item:`, L));
|
|
1584
1605
|
};
|
|
1585
|
-
if (
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1606
|
+
if (!c) {
|
|
1607
|
+
z();
|
|
1608
|
+
return;
|
|
1609
|
+
}
|
|
1610
|
+
const $ = c(D.$el);
|
|
1611
|
+
$ instanceof Promise ? $.then(z, z) : z();
|
|
1612
|
+
}, Qt = (L, D) => {
|
|
1613
|
+
C.delete(L), I.add(L), we(L, D);
|
|
1592
1614
|
};
|
|
1593
1615
|
let bt;
|
|
1594
1616
|
bt = X(() => {
|
|
1595
|
-
const
|
|
1617
|
+
const L = s.value, D = L.length;
|
|
1596
1618
|
H(() => {
|
|
1597
|
-
if (
|
|
1598
|
-
if (
|
|
1599
|
-
const a = typeof
|
|
1600
|
-
|
|
1619
|
+
if (Y && D > 0 && (Y.remove(), Y = null), D === 0) {
|
|
1620
|
+
if (E && !Y) {
|
|
1621
|
+
const a = typeof E == "string" ? Ht(E) : E;
|
|
1622
|
+
Y = l(a).appendTo(O);
|
|
1623
|
+
}
|
|
1624
|
+
for (let a = 0; a < R.length; a++) {
|
|
1625
|
+
const h = R[a], _ = C.get(h);
|
|
1626
|
+
_ && Qt(h, _);
|
|
1601
1627
|
}
|
|
1602
|
-
|
|
1603
|
-
m.has(h) || Qt(h, a);
|
|
1604
|
-
}), P = [];
|
|
1628
|
+
R.length = 0;
|
|
1605
1629
|
return;
|
|
1606
1630
|
}
|
|
1607
|
-
f.log("list", `${
|
|
1608
|
-
const
|
|
1609
|
-
for (let a = 0; a <
|
|
1610
|
-
|
|
1611
|
-
const
|
|
1612
|
-
for (let a = 0; a <
|
|
1613
|
-
const h =
|
|
1614
|
-
if (
|
|
1615
|
-
f.warn(
|
|
1631
|
+
f.log("list", `${G} updating with ${D} items`);
|
|
1632
|
+
const z = /* @__PURE__ */ new Map();
|
|
1633
|
+
for (let a = 0; a < R.length; a++)
|
|
1634
|
+
z.set(R[a], a);
|
|
1635
|
+
const $ = new Array(D), Tt = /* @__PURE__ */ new Set(), ct = new Int32Array(D), at = [], Rt = [], Nt = [];
|
|
1636
|
+
for (let a = 0; a < D; a++) {
|
|
1637
|
+
const h = L[a], _ = d(h, a);
|
|
1638
|
+
if ($[a] = _, Tt.has(_)) {
|
|
1639
|
+
f.warn(g.LIST, T.DUPLICATE_KEY(_, a)), ct[a] = -1;
|
|
1616
1640
|
continue;
|
|
1617
1641
|
}
|
|
1618
|
-
|
|
1619
|
-
const
|
|
1620
|
-
if (
|
|
1621
|
-
const u =
|
|
1622
|
-
!
|
|
1642
|
+
Tt.add(_);
|
|
1643
|
+
const S = C.get(_);
|
|
1644
|
+
if (S) {
|
|
1645
|
+
const u = S.item;
|
|
1646
|
+
!o && u !== h && !ps(u, h) && (at.push(_), Rt.push(h), Nt.push(a)), ct[a] = I.has(_) ? -1 : z.get(_) ?? -1;
|
|
1623
1647
|
} else
|
|
1624
|
-
|
|
1648
|
+
at.push(_), Rt.push(h), Nt.push(a), ct[a] = -1;
|
|
1625
1649
|
}
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1650
|
+
const lt = at.length, Yt = new Array(
|
|
1651
|
+
lt
|
|
1628
1652
|
), Ot = [];
|
|
1629
|
-
for (let a = 0; a <
|
|
1630
|
-
const h = n(
|
|
1653
|
+
for (let a = 0; a < lt; a++) {
|
|
1654
|
+
const h = n(Rt[a], Nt[a]);
|
|
1631
1655
|
Yt[a] = h, typeof h == "string" && Ot.push(h);
|
|
1632
1656
|
}
|
|
1633
1657
|
let ht = null;
|
|
1634
1658
|
if (Ot.length > 0) {
|
|
1635
|
-
const a =
|
|
1636
|
-
ht =
|
|
1659
|
+
const a = `<!--sep-${Math.random().toString(36).substring(2)}-${Date.now().toString(36)}-->`;
|
|
1660
|
+
ht = Ht(Ot.join(a)).split(a);
|
|
1637
1661
|
}
|
|
1638
|
-
let
|
|
1639
|
-
for (let a = 0; a <
|
|
1640
|
-
const h = Yt[a], _ = typeof h == "string" ?
|
|
1662
|
+
let Kt = 0;
|
|
1663
|
+
for (let a = 0; a < lt; a++) {
|
|
1664
|
+
const h = Yt[a], _ = typeof h == "string" ? l(ht[Kt++]) : l(h), S = at[a], u = C.get(S);
|
|
1641
1665
|
if (u) {
|
|
1642
|
-
const
|
|
1643
|
-
|
|
1666
|
+
const w = u.$el[0];
|
|
1667
|
+
w && y.cleanupTree(w), u.$el.replaceWith(_), u.$el = _, u.state = "replaced";
|
|
1644
1668
|
} else
|
|
1645
|
-
|
|
1669
|
+
C.set(S, { $el: _, item: null, state: "new" });
|
|
1646
1670
|
}
|
|
1647
|
-
for (
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1671
|
+
for (let a = 0; a < R.length; a++) {
|
|
1672
|
+
const h = R[a];
|
|
1673
|
+
if (!Tt.has(h)) {
|
|
1674
|
+
const _ = C.get(h);
|
|
1675
|
+
_ && Qt(h, _);
|
|
1676
|
+
}
|
|
1677
|
+
}
|
|
1678
|
+
const Wt = gs(ct);
|
|
1679
|
+
let Dt = Wt.length - 1, Jt = null;
|
|
1680
|
+
const vt = R.length === 0;
|
|
1681
|
+
if (vt && ht !== null && Kt === lt && !i && !r && !c && I.size === 0) {
|
|
1682
|
+
p.innerHTML = ht.join("");
|
|
1654
1683
|
let a = 0;
|
|
1655
|
-
for (let h = 0; h <
|
|
1656
|
-
const _ =
|
|
1684
|
+
for (let h = 0; h < D; h++) {
|
|
1685
|
+
const _ = $[h], S = L[h], u = C.get(_);
|
|
1657
1686
|
if (!u) continue;
|
|
1658
|
-
const
|
|
1659
|
-
|
|
1687
|
+
const w = p.children[a++];
|
|
1688
|
+
w && (u.$el = l(w), u.item = S, u.state = void 0, I.delete(_), f.domUpdated(u.$el, "list.add", S));
|
|
1660
1689
|
}
|
|
1661
1690
|
} else {
|
|
1662
1691
|
const a = vt ? document.createDocumentFragment() : null;
|
|
1663
1692
|
if (vt && a) {
|
|
1664
|
-
for (let h =
|
|
1665
|
-
const _ =
|
|
1693
|
+
for (let h = D - 1; h >= 0; h--) {
|
|
1694
|
+
const _ = $[h], S = L[h], u = C.get(_);
|
|
1666
1695
|
if (!u) continue;
|
|
1667
|
-
const
|
|
1668
|
-
u.item =
|
|
1669
|
-
for (let
|
|
1670
|
-
a.insertBefore(u.$el[
|
|
1671
|
-
|
|
1696
|
+
const w = u.state;
|
|
1697
|
+
u.item = S, u.state = void 0, u.$el[0] && (w === void 0 ? o && o(u.$el, S, h) : i && i(u.$el, S, h));
|
|
1698
|
+
for (let At = u.$el.length - 1; At >= 0; At--)
|
|
1699
|
+
a.insertBefore(u.$el[At], a.firstChild);
|
|
1700
|
+
w === "new" && (r && r(u.$el), I.delete(_), f.domUpdated(u.$el, "list.add", S));
|
|
1672
1701
|
}
|
|
1673
|
-
|
|
1702
|
+
p.appendChild(a);
|
|
1674
1703
|
} else
|
|
1675
|
-
for (let h =
|
|
1676
|
-
const _ =
|
|
1704
|
+
for (let h = D - 1; h >= 0; h--) {
|
|
1705
|
+
const _ = $[h], S = L[h], u = C.get(_);
|
|
1677
1706
|
if (!u) continue;
|
|
1678
|
-
const
|
|
1679
|
-
u.item =
|
|
1707
|
+
const w = u.state;
|
|
1708
|
+
u.item = S, u.state = void 0, u.$el[0] && (w === void 0 ? o && o(u.$el, S, h) : i && i(u.$el, S, h)), Dt >= 0 && Wt[Dt] === h ? Dt-- : Ms(u.$el, Jt, O), Jt = u.$el[0] ?? null, w === "new" && (r && r(u.$el), I.delete(_), f.domUpdated(u.$el, "list.add", S));
|
|
1680
1709
|
}
|
|
1681
1710
|
}
|
|
1682
|
-
|
|
1711
|
+
R = $;
|
|
1683
1712
|
});
|
|
1684
|
-
}),
|
|
1685
|
-
|
|
1713
|
+
}), y.trackEffect(p, bt), y.trackCleanup(p, () => {
|
|
1714
|
+
C.clear(), I.clear(), R.length = 0, Y?.remove();
|
|
1686
1715
|
});
|
|
1687
|
-
}
|
|
1716
|
+
}
|
|
1717
|
+
return this;
|
|
1688
1718
|
};
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1691
|
-
const
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1719
|
+
const Fs = Object.freeze({});
|
|
1720
|
+
l.fn.atomMount = function(s, t) {
|
|
1721
|
+
const e = t ?? Fs;
|
|
1722
|
+
for (let n = 0, i = this.length; n < i; n++) {
|
|
1723
|
+
const o = this[n];
|
|
1724
|
+
if (!o) continue;
|
|
1725
|
+
y.cleanupTree(o);
|
|
1726
|
+
const r = l(o);
|
|
1727
|
+
let c;
|
|
1696
1728
|
try {
|
|
1697
|
-
|
|
1698
|
-
} catch (
|
|
1699
|
-
f.error(
|
|
1700
|
-
|
|
1729
|
+
c = H(() => s(r, e));
|
|
1730
|
+
} catch (E) {
|
|
1731
|
+
f.error(g.MOUNT, T.MOUNT_ERROR(), E);
|
|
1732
|
+
continue;
|
|
1701
1733
|
}
|
|
1702
|
-
typeof
|
|
1703
|
-
}
|
|
1734
|
+
typeof c == "function" && y.setComponentCleanup(o, c);
|
|
1735
|
+
}
|
|
1736
|
+
return this;
|
|
1704
1737
|
};
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1738
|
+
l.fn.atomUnmount = function() {
|
|
1739
|
+
for (let s = 0, t = this.length; s < t; s++) {
|
|
1740
|
+
const e = this[s];
|
|
1741
|
+
e && Ue(e);
|
|
1742
|
+
}
|
|
1743
|
+
return this;
|
|
1709
1744
|
};
|
|
1710
|
-
function
|
|
1745
|
+
function he(s, t) {
|
|
1711
1746
|
try {
|
|
1712
|
-
return history.pushState(
|
|
1713
|
-
} catch (
|
|
1747
|
+
return history.pushState(s, "", t), !0;
|
|
1748
|
+
} catch (e) {
|
|
1714
1749
|
return f.warn(
|
|
1715
|
-
|
|
1750
|
+
g.ROUTE,
|
|
1716
1751
|
"PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.",
|
|
1717
|
-
|
|
1752
|
+
e
|
|
1718
1753
|
), !1;
|
|
1719
1754
|
}
|
|
1720
1755
|
}
|
|
1721
|
-
class
|
|
1756
|
+
class Bs {
|
|
1722
1757
|
constructor(t) {
|
|
1723
1758
|
this.isDestroyed = !1, this.previousRoute = "", this.cleanups = [], this.templateCache = /* @__PURE__ */ new Map(), this.config = {
|
|
1724
1759
|
...t,
|
|
1725
|
-
mode: t.mode ??
|
|
1726
|
-
basePath: t.basePath ??
|
|
1727
|
-
autoBindLinks: t.autoBindLinks ??
|
|
1728
|
-
activeClass: t.activeClass ??
|
|
1729
|
-
}, this.isHistoryMode = this.config.mode === "history", this.$target =
|
|
1760
|
+
mode: t.mode ?? _t.mode,
|
|
1761
|
+
basePath: t.basePath ?? _t.basePath,
|
|
1762
|
+
autoBindLinks: t.autoBindLinks ?? _t.autoBindLinks,
|
|
1763
|
+
activeClass: t.activeClass ?? _t.activeClass
|
|
1764
|
+
}, this.isHistoryMode = this.config.mode === "history", this.$target = l(this.config.target), this.normalizedBasePath = this.config.basePath?.replace(/\/$/, "") || "", this.previousUrl = this.isHistoryMode ? window.location.pathname + window.location.search : window.location.hash, this.currentRouteAtom = Bt(this.getRouteName()), this.currentRoute = this.currentRouteAtom, this.queryParamsAtom = Bt(this.getQueryParams()), this.queryParams = St(() => this.queryParamsAtom.value), this.handleUrlChange = this.handleUrlChange.bind(this), this.destroy = this.destroy.bind(this), this.init();
|
|
1730
1765
|
}
|
|
1731
1766
|
init() {
|
|
1732
1767
|
const t = this.isHistoryMode ? "popstate" : "hashchange";
|
|
1733
1768
|
window.addEventListener(t, this.handleUrlChange), this.cleanups.push(() => window.removeEventListener(t, this.handleUrlChange));
|
|
1734
|
-
const
|
|
1769
|
+
const e = X(() => {
|
|
1735
1770
|
const n = this.currentRouteAtom.value;
|
|
1736
1771
|
H(() => this.renderRoute(n));
|
|
1737
1772
|
});
|
|
1738
|
-
this.cleanups.push(() =>
|
|
1773
|
+
this.cleanups.push(() => e.dispose()), this.setupAutoBindLinks(), this.$target[0] && y.trackCleanup(this.$target[0], this.destroy);
|
|
1739
1774
|
}
|
|
1740
1775
|
// --- Mode-abstracted internal methods ---
|
|
1741
1776
|
/**
|
|
@@ -1745,11 +1780,11 @@ class Ms {
|
|
|
1745
1780
|
getRouteName() {
|
|
1746
1781
|
const { default: t } = this.config;
|
|
1747
1782
|
if (this.isHistoryMode) {
|
|
1748
|
-
let
|
|
1749
|
-
return this.normalizedBasePath &&
|
|
1783
|
+
let o = window.location.pathname;
|
|
1784
|
+
return this.normalizedBasePath && o.startsWith(this.normalizedBasePath) && (o = o.substring(this.normalizedBasePath.length)), o.charCodeAt(0) === 47 && (o = o.slice(1)), o || t;
|
|
1750
1785
|
}
|
|
1751
|
-
const
|
|
1752
|
-
return (n === -1 ?
|
|
1786
|
+
const e = window.location.hash, n = e.indexOf("?");
|
|
1787
|
+
return (n === -1 ? e.substring(1) : e.substring(1, n)) || t;
|
|
1753
1788
|
}
|
|
1754
1789
|
/**
|
|
1755
1790
|
* Parses query parameters from the current URL.
|
|
@@ -1764,16 +1799,16 @@ class Ms {
|
|
|
1764
1799
|
if (this.isHistoryMode) {
|
|
1765
1800
|
if (t = window.location.search.substring(1), !t) return {};
|
|
1766
1801
|
} else {
|
|
1767
|
-
const i = window.location.hash,
|
|
1768
|
-
if (
|
|
1769
|
-
t = i.substring(
|
|
1802
|
+
const i = window.location.hash, o = i.indexOf("?");
|
|
1803
|
+
if (o === -1) return {};
|
|
1804
|
+
t = i.substring(o + 1);
|
|
1770
1805
|
}
|
|
1771
|
-
const
|
|
1806
|
+
const e = new URLSearchParams(t), n = Object.fromEntries(e);
|
|
1772
1807
|
if (t.includes("%"))
|
|
1773
1808
|
try {
|
|
1774
1809
|
decodeURIComponent(t);
|
|
1775
1810
|
} catch {
|
|
1776
|
-
f.warn(
|
|
1811
|
+
f.warn(g.ROUTE, T.MALFORMED_URI(t));
|
|
1777
1812
|
}
|
|
1778
1813
|
return n;
|
|
1779
1814
|
}
|
|
@@ -1783,11 +1818,11 @@ class Ms {
|
|
|
1783
1818
|
*/
|
|
1784
1819
|
setUrl(t) {
|
|
1785
1820
|
if (this.isHistoryMode) {
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1821
|
+
const e = `${this.normalizedBasePath}/${t}`;
|
|
1822
|
+
he(null, e), this.previousUrl = e;
|
|
1788
1823
|
} else {
|
|
1789
|
-
const
|
|
1790
|
-
window.location.hash =
|
|
1824
|
+
const e = `#${t}`;
|
|
1825
|
+
window.location.hash = e, this.previousUrl = e;
|
|
1791
1826
|
}
|
|
1792
1827
|
}
|
|
1793
1828
|
/**
|
|
@@ -1796,7 +1831,7 @@ class Ms {
|
|
|
1796
1831
|
* that occur with replaceState during popstate events.
|
|
1797
1832
|
*/
|
|
1798
1833
|
restoreUrl() {
|
|
1799
|
-
this.isHistoryMode ?
|
|
1834
|
+
this.isHistoryMode ? he(null, this.previousUrl) : window.location.hash = this.previousUrl;
|
|
1800
1835
|
}
|
|
1801
1836
|
/**
|
|
1802
1837
|
* Returns the current full URL string for comparison purposes.
|
|
@@ -1809,9 +1844,9 @@ class Ms {
|
|
|
1809
1844
|
* Resolves route configuration, falling back to notFound route if needed.
|
|
1810
1845
|
*/
|
|
1811
1846
|
getRouteConfig(t) {
|
|
1812
|
-
const { routes:
|
|
1813
|
-
let i =
|
|
1814
|
-
return !i && n && (i =
|
|
1847
|
+
const { routes: e, notFound: n } = this.config;
|
|
1848
|
+
let i = e[t];
|
|
1849
|
+
return !i && n && (i = e[n]), i || (f.warn(g.ROUTE, T.ROUTE_NOT_FOUND(t)), null);
|
|
1815
1850
|
}
|
|
1816
1851
|
/**
|
|
1817
1852
|
* Appends cloned template content into the target container.
|
|
@@ -1819,14 +1854,14 @@ class Ms {
|
|
|
1819
1854
|
* before invoking this method if a clean slate is needed.
|
|
1820
1855
|
*/
|
|
1821
1856
|
renderTemplate(t) {
|
|
1822
|
-
let
|
|
1823
|
-
if (!
|
|
1857
|
+
let e = this.templateCache.get(t);
|
|
1858
|
+
if (!e) {
|
|
1824
1859
|
const i = document.querySelector(t);
|
|
1825
1860
|
if (!i || !(i instanceof HTMLTemplateElement))
|
|
1826
|
-
return f.warn(
|
|
1827
|
-
|
|
1861
|
+
return f.warn(g.ROUTE, T.TEMPLATE_NOT_FOUND(t)), !1;
|
|
1862
|
+
e = i, this.templateCache.set(t, e);
|
|
1828
1863
|
}
|
|
1829
|
-
const n =
|
|
1864
|
+
const n = e.content.cloneNode(!0);
|
|
1830
1865
|
return this.$target.append(n), !0;
|
|
1831
1866
|
}
|
|
1832
1867
|
/**
|
|
@@ -1844,21 +1879,21 @@ class Ms {
|
|
|
1844
1879
|
*/
|
|
1845
1880
|
renderRoute(t) {
|
|
1846
1881
|
if (this.isDestroyed) return;
|
|
1847
|
-
const
|
|
1848
|
-
if (!
|
|
1849
|
-
f.warn(
|
|
1882
|
+
const e = this.$target[0];
|
|
1883
|
+
if (!e) {
|
|
1884
|
+
f.warn(g.ROUTE, T.TARGET_NOT_FOUND(this.config.target));
|
|
1850
1885
|
return;
|
|
1851
1886
|
}
|
|
1852
1887
|
const n = this.getRouteConfig(t);
|
|
1853
1888
|
if (!n) return;
|
|
1854
|
-
const i = this.getQueryParams(),
|
|
1855
|
-
this.config.beforeTransition && this.config.beforeTransition(
|
|
1856
|
-
let
|
|
1889
|
+
const i = this.getQueryParams(), o = this.previousRoute;
|
|
1890
|
+
this.config.beforeTransition && this.config.beforeTransition(o, t), this.$target.empty();
|
|
1891
|
+
let r = i;
|
|
1857
1892
|
if (n.onEnter) {
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1893
|
+
const c = n.onEnter(i);
|
|
1894
|
+
c !== void 0 && (r = { ...i, ...c });
|
|
1860
1895
|
}
|
|
1861
|
-
n.render ? n.render(
|
|
1896
|
+
n.render ? n.render(e, t, r) : n.template && this.renderTemplate(n.template) && n.onMount && n.onMount(this.$target.children()), this.config.afterTransition && this.config.afterTransition(o, t), this.previousRoute = t;
|
|
1862
1897
|
}
|
|
1863
1898
|
/**
|
|
1864
1899
|
* Handles browser URL change events (hashchange or popstate).
|
|
@@ -1867,18 +1902,18 @@ class Ms {
|
|
|
1867
1902
|
if (this.isDestroyed) return;
|
|
1868
1903
|
const t = this.getCurrentUrl();
|
|
1869
1904
|
if (t === this.previousUrl) return;
|
|
1870
|
-
const
|
|
1871
|
-
if (n !==
|
|
1872
|
-
const
|
|
1873
|
-
if (
|
|
1905
|
+
const e = this.getRouteName(), n = this.currentRouteAtom.peek(), i = this.getQueryParams();
|
|
1906
|
+
if (n !== e) {
|
|
1907
|
+
const o = this.config.routes[n];
|
|
1908
|
+
if (o?.onLeave && o.onLeave() === !1) {
|
|
1874
1909
|
this.restoreUrl();
|
|
1875
1910
|
return;
|
|
1876
1911
|
}
|
|
1877
|
-
this.currentRouteAtom.value =
|
|
1912
|
+
this.currentRouteAtom.value = e, this.queryParamsAtom.value = i;
|
|
1878
1913
|
} else {
|
|
1879
1914
|
this.queryParamsAtom.value = i;
|
|
1880
|
-
const
|
|
1881
|
-
|
|
1915
|
+
const o = this.config.routes[n];
|
|
1916
|
+
o?.onParamsChange ? o.onParamsChange(i) : this.renderRoute(e);
|
|
1882
1917
|
}
|
|
1883
1918
|
this.previousUrl = t;
|
|
1884
1919
|
}
|
|
@@ -1897,19 +1932,19 @@ class Ms {
|
|
|
1897
1932
|
if (!this.config.autoBindLinks) return;
|
|
1898
1933
|
const t = (i) => {
|
|
1899
1934
|
i.preventDefault();
|
|
1900
|
-
const
|
|
1901
|
-
|
|
1935
|
+
const o = i.currentTarget.dataset.route;
|
|
1936
|
+
o != null && this.navigate(o);
|
|
1902
1937
|
};
|
|
1903
|
-
|
|
1904
|
-
|
|
1938
|
+
l(document).on("click", "[data-route]", t), this.cleanups.push(() => {
|
|
1939
|
+
l(document).off("click", "[data-route]", t);
|
|
1905
1940
|
});
|
|
1906
|
-
const { activeClass:
|
|
1941
|
+
const { activeClass: e } = this.config, n = X(() => {
|
|
1907
1942
|
const i = this.currentRouteAtom.value;
|
|
1908
1943
|
H(() => {
|
|
1909
|
-
const
|
|
1910
|
-
for (
|
|
1911
|
-
const
|
|
1912
|
-
|
|
1944
|
+
const o = document.querySelectorAll("[data-route]");
|
|
1945
|
+
for (let r = 0, c = o.length; r < c; r++) {
|
|
1946
|
+
const E = o[r], d = E.dataset.route, m = i === d;
|
|
1947
|
+
E.classList.toggle(e, m), m ? E.setAttribute("aria-current", "page") : E.removeAttribute("aria-current");
|
|
1913
1948
|
}
|
|
1914
1949
|
});
|
|
1915
1950
|
});
|
|
@@ -1925,13 +1960,13 @@ class Ms {
|
|
|
1925
1960
|
*/
|
|
1926
1961
|
navigate(t) {
|
|
1927
1962
|
if (this.isDestroyed) return;
|
|
1928
|
-
const
|
|
1963
|
+
const e = this.currentRouteAtom.peek(), n = this.config.routes[e];
|
|
1929
1964
|
if (n?.onLeave && n.onLeave() === !1)
|
|
1930
1965
|
return;
|
|
1931
1966
|
const i = t || this.config.default;
|
|
1932
1967
|
if (!i) {
|
|
1933
1968
|
f.warn(
|
|
1934
|
-
|
|
1969
|
+
g.ROUTE,
|
|
1935
1970
|
"navigate() called with empty routeName and no default configured."
|
|
1936
1971
|
);
|
|
1937
1972
|
return;
|
|
@@ -1944,73 +1979,75 @@ class Ms {
|
|
|
1944
1979
|
* cleanup does not prevent the remaining ones from running.
|
|
1945
1980
|
*/
|
|
1946
1981
|
destroy() {
|
|
1947
|
-
|
|
1982
|
+
if (this.isDestroyed) return;
|
|
1983
|
+
this.isDestroyed = !0;
|
|
1984
|
+
const t = this.cleanups;
|
|
1985
|
+
for (let e = 0, n = t.length; e < n; e++)
|
|
1948
1986
|
try {
|
|
1949
|
-
t();
|
|
1950
|
-
} catch (
|
|
1951
|
-
f.warn(
|
|
1987
|
+
t[e]();
|
|
1988
|
+
} catch (i) {
|
|
1989
|
+
f.warn(g.ROUTE, "Cleanup error during destroy:", i);
|
|
1952
1990
|
}
|
|
1953
|
-
|
|
1991
|
+
this.cleanups.length = 0, this.templateCache.clear();
|
|
1954
1992
|
}
|
|
1955
1993
|
}
|
|
1956
|
-
function
|
|
1957
|
-
return new
|
|
1994
|
+
function Hs(s) {
|
|
1995
|
+
return new Bs(s);
|
|
1958
1996
|
}
|
|
1959
|
-
|
|
1960
|
-
route:
|
|
1997
|
+
l.extend({
|
|
1998
|
+
route: Hs
|
|
1961
1999
|
});
|
|
1962
|
-
const
|
|
2000
|
+
const Gs = new Promise(() => {
|
|
1963
2001
|
});
|
|
1964
|
-
|
|
1965
|
-
atomFetch(
|
|
1966
|
-
const { defaultValue:
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
};
|
|
1971
|
-
let E = null;
|
|
1972
|
-
return Ct(
|
|
2002
|
+
l.extend({
|
|
2003
|
+
atomFetch(s, t) {
|
|
2004
|
+
const { defaultValue: e, transform: n, method: i, headers: o, ajaxOptions: r, onError: c, eager: E } = t, d = typeof s == "string", m = d ? s : void 0, N = d ? null : s, p = Object.assign({}, r);
|
|
2005
|
+
i !== void 0 && (p.method = i), o !== void 0 && (p.headers = o), d && (p.url = m);
|
|
2006
|
+
let O = null;
|
|
2007
|
+
return St(
|
|
1973
2008
|
async () => {
|
|
1974
|
-
|
|
1975
|
-
const
|
|
1976
|
-
|
|
2009
|
+
O?.abort(), O = new AbortController();
|
|
2010
|
+
const C = O.signal;
|
|
2011
|
+
d || (p.url = N());
|
|
2012
|
+
const I = l.ajax(p);
|
|
2013
|
+
C.onabort = () => I.abort(), C.aborted && I.abort();
|
|
1977
2014
|
try {
|
|
1978
|
-
const
|
|
1979
|
-
return n ? n(
|
|
1980
|
-
} catch (
|
|
1981
|
-
if (
|
|
1982
|
-
return
|
|
2015
|
+
const R = await I;
|
|
2016
|
+
return n ? n(R) : R;
|
|
2017
|
+
} catch (R) {
|
|
2018
|
+
if (C.aborted)
|
|
2019
|
+
return Gs;
|
|
1983
2020
|
try {
|
|
1984
|
-
|
|
2021
|
+
c?.(R);
|
|
1985
2022
|
} catch {
|
|
1986
2023
|
}
|
|
1987
|
-
throw
|
|
2024
|
+
throw R;
|
|
1988
2025
|
} finally {
|
|
1989
|
-
|
|
2026
|
+
C.onabort = null, O.signal === C && (O = null);
|
|
1990
2027
|
}
|
|
1991
2028
|
},
|
|
1992
|
-
{ defaultValue:
|
|
2029
|
+
{ defaultValue: e, lazy: !(E ?? !0) }
|
|
1993
2030
|
);
|
|
1994
2031
|
}
|
|
1995
2032
|
});
|
|
1996
|
-
|
|
1997
|
-
|
|
2033
|
+
l(() => {
|
|
2034
|
+
As(), Os(document.body);
|
|
1998
2035
|
});
|
|
1999
2036
|
export {
|
|
2000
|
-
|
|
2037
|
+
Bt as atom,
|
|
2001
2038
|
Ie as batch,
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2039
|
+
St as computed,
|
|
2040
|
+
Ys as default,
|
|
2041
|
+
Vs as disableAutoCleanup,
|
|
2042
|
+
qs as disablejQueryOverrides,
|
|
2006
2043
|
X as effect,
|
|
2007
|
-
|
|
2008
|
-
|
|
2044
|
+
Os as enableAutoCleanup,
|
|
2045
|
+
As as enablejQueryOverrides,
|
|
2009
2046
|
qt as isAtom,
|
|
2010
|
-
|
|
2047
|
+
qe as isComputed,
|
|
2011
2048
|
ye as isReactive,
|
|
2012
|
-
|
|
2013
|
-
|
|
2049
|
+
Ts as nextTick,
|
|
2050
|
+
y as registry,
|
|
2014
2051
|
H as untracked
|
|
2015
2052
|
};
|
|
2016
2053
|
//# sourceMappingURL=index.mjs.map
|