@aiao/utils 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@browser/broadcast-channel-pool.d.ts +26 -6
- package/dist/@browser/broadcast-channel-pool.d.ts.map +1 -1
- package/dist/@browser/index.d.ts +1 -0
- package/dist/@browser/index.d.ts.map +1 -1
- package/dist/@browser/opfs-detection.d.ts +12 -0
- package/dist/@browser/opfs-detection.d.ts.map +1 -0
- package/dist/array/sortBy.d.ts +1 -1
- package/dist/async/AsyncQueueExecutor.d.ts +68 -0
- package/dist/async/AsyncQueueExecutor.d.ts.map +1 -0
- package/dist/async/index.d.ts +1 -0
- package/dist/async/index.d.ts.map +1 -1
- package/dist/index.js +490 -362
- package/dist/indexing/fractional-indexing.d.ts +6 -3
- package/dist/indexing/fractional-indexing.d.ts.map +1 -1
- package/dist/tools/event.d.ts +8 -1
- package/dist/tools/event.d.ts.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,34 +1,59 @@
|
|
|
1
|
-
import { Observable as ae, BehaviorSubject as
|
|
2
|
-
import
|
|
3
|
-
import { distance as
|
|
4
|
-
class
|
|
5
|
-
|
|
1
|
+
import { Observable as ae, shareReplay as le, BehaviorSubject as G, distinctUntilChanged as V, skip as ue } from "rxjs";
|
|
2
|
+
import fe from "ms";
|
|
3
|
+
import { distance as he } from "fastest-levenshtein";
|
|
4
|
+
class pe {
|
|
5
|
+
cache = /* @__PURE__ */ new Map();
|
|
6
|
+
/**
|
|
7
|
+
* 发送消息到指定频道
|
|
8
|
+
* @param event 频道名称
|
|
9
|
+
* @param data 消息数据
|
|
10
|
+
* @throws 如果频道不存在则抛出错误
|
|
11
|
+
*/
|
|
6
12
|
emit(t, r) {
|
|
7
|
-
const n = this
|
|
8
|
-
if (n
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
throw new Error("broadcast-channel not found");
|
|
13
|
+
const n = this.cache.get(t);
|
|
14
|
+
if (!n)
|
|
15
|
+
throw new Error(`BroadcastChannel "${t}" not found`);
|
|
16
|
+
n.channel.postMessage(r);
|
|
12
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* 订阅指定频道的消息
|
|
20
|
+
* @param event 频道名称
|
|
21
|
+
* @returns Observable 消息流
|
|
22
|
+
*/
|
|
13
23
|
on(t) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const r = this.cache.get(t);
|
|
25
|
+
if (r)
|
|
26
|
+
return r.refCount++, r.observable;
|
|
27
|
+
const n = new BroadcastChannel(t), o = new ae((s) => {
|
|
28
|
+
const i = (a) => {
|
|
29
|
+
try {
|
|
30
|
+
s.next(a.data);
|
|
31
|
+
} catch (l) {
|
|
32
|
+
s.error(l);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
return n.addEventListener("message", i), () => {
|
|
36
|
+
n.removeEventListener("message", i), this.decrementRef(t);
|
|
37
|
+
};
|
|
38
|
+
}).pipe(le(1)), c = {
|
|
39
|
+
observable: o,
|
|
40
|
+
channel: n,
|
|
41
|
+
refCount: 1
|
|
42
|
+
};
|
|
43
|
+
return this.cache.set(t, c), o;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 减少引用计数,当计数为 0 时关闭频道
|
|
47
|
+
*/
|
|
48
|
+
decrementRef(t) {
|
|
49
|
+
const r = this.cache.get(t);
|
|
50
|
+
r && (r.refCount--, r.refCount <= 0 && (r.channel.close(), this.cache.delete(t)));
|
|
26
51
|
}
|
|
27
52
|
}
|
|
28
|
-
const
|
|
29
|
-
message$:
|
|
30
|
-
emit: (n) =>
|
|
31
|
-
}),
|
|
53
|
+
const I = new pe(), rt = (e) => ({
|
|
54
|
+
message$: I.on(e),
|
|
55
|
+
emit: (n) => I.emit(e, n)
|
|
56
|
+
}), de = [
|
|
32
57
|
"mousemove",
|
|
33
58
|
"keydown",
|
|
34
59
|
"wheel",
|
|
@@ -42,11 +67,11 @@ const N = new he(), et = (e) => ({
|
|
|
42
67
|
"visibilitychange",
|
|
43
68
|
"focus"
|
|
44
69
|
];
|
|
45
|
-
class
|
|
70
|
+
class nt {
|
|
46
71
|
#e = 1e3 * 2;
|
|
47
72
|
#t;
|
|
48
|
-
#r = new
|
|
49
|
-
idle$ = this.#r.asObservable().pipe(
|
|
73
|
+
#r = new G(!1);
|
|
74
|
+
idle$ = this.#r.asObservable().pipe(V());
|
|
50
75
|
constructor(t) {
|
|
51
76
|
this.#e = t?.timeout || this.#e;
|
|
52
77
|
}
|
|
@@ -59,7 +84,7 @@ class tt {
|
|
|
59
84
|
}, this.#e);
|
|
60
85
|
};
|
|
61
86
|
#o() {
|
|
62
|
-
|
|
87
|
+
de.forEach(
|
|
63
88
|
(t) => document.addEventListener(t, this.#n, {
|
|
64
89
|
capture: !0,
|
|
65
90
|
passive: !0
|
|
@@ -67,12 +92,12 @@ class tt {
|
|
|
67
92
|
);
|
|
68
93
|
}
|
|
69
94
|
}
|
|
70
|
-
class
|
|
95
|
+
class ot {
|
|
71
96
|
constructor(t) {
|
|
72
97
|
this.name = t, window.addEventListener("beforeunload", () => this.#n && this.#n(!0));
|
|
73
98
|
}
|
|
74
|
-
#e = new
|
|
75
|
-
#t = this.#e.asObservable().pipe(
|
|
99
|
+
#e = new G(!1);
|
|
100
|
+
#t = this.#e.asObservable().pipe(V(), ue(1));
|
|
76
101
|
#r;
|
|
77
102
|
#n;
|
|
78
103
|
get isLeader() {
|
|
@@ -84,7 +109,14 @@ class rt {
|
|
|
84
109
|
})))), this.#t;
|
|
85
110
|
}
|
|
86
111
|
}
|
|
87
|
-
|
|
112
|
+
const me = () => "storage" in navigator && "getDirectory" in navigator.storage, st = async () => {
|
|
113
|
+
try {
|
|
114
|
+
return me() ? !!await navigator.storage.getDirectory() : !1;
|
|
115
|
+
} catch (e) {
|
|
116
|
+
return console.error("OPFS not available:", e), !1;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
function ct(e, t) {
|
|
88
120
|
if (e.length === 0) return;
|
|
89
121
|
let r = 0;
|
|
90
122
|
function n() {
|
|
@@ -96,16 +128,16 @@ function nt(e, t) {
|
|
|
96
128
|
}
|
|
97
129
|
n();
|
|
98
130
|
}
|
|
99
|
-
const
|
|
131
|
+
const it = (e, t) => {
|
|
100
132
|
const r = Math.floor(t), n = [];
|
|
101
133
|
for (let o = 0; o < e.length; o += r)
|
|
102
134
|
n.push(e.slice(o, o + r));
|
|
103
135
|
return n;
|
|
104
|
-
},
|
|
105
|
-
function
|
|
136
|
+
}, at = (e, t) => e.filter((r) => !t.includes(r)), lt = (e) => Array.prototype.concat([], ...e), ye = (e) => e.flatMap((t) => Array.isArray(t) ? ye(t) : t), ut = (...e) => e.reduce((t, r) => t.filter((n) => r.includes(n))), b = Array.isArray, ge = (e) => e instanceof ArrayBuffer;
|
|
137
|
+
function ft(e) {
|
|
106
138
|
return e === !0 || e === !1 || e != null && typeof e.valueOf() == "boolean";
|
|
107
139
|
}
|
|
108
|
-
function
|
|
140
|
+
function Z(e) {
|
|
109
141
|
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
|
|
110
142
|
}
|
|
111
143
|
const d = (e) => !!(e && e.constructor && e.call && e.apply), p = (e) => {
|
|
@@ -114,68 +146,164 @@ const d = (e) => !!(e && e.constructor && e.call && e.apply), p = (e) => {
|
|
|
114
146
|
} catch {
|
|
115
147
|
return !1;
|
|
116
148
|
}
|
|
117
|
-
},
|
|
149
|
+
}, we = (e) => e && e.constructor === Symbol, ht = (e) => {
|
|
118
150
|
if (e === !0 || e === !1 || e === null || e === void 0) return !0;
|
|
119
151
|
if (p(e)) return e === 0;
|
|
120
|
-
if (
|
|
121
|
-
if (d(e) ||
|
|
152
|
+
if (Z(e)) return isNaN(e.getTime());
|
|
153
|
+
if (d(e) || we(e)) return !1;
|
|
122
154
|
const t = e.length;
|
|
123
155
|
if (p(t)) return t === 0;
|
|
124
156
|
const r = e.size;
|
|
125
157
|
return p(r) ? r === 0 : Object.keys(e).length === 0;
|
|
126
|
-
},
|
|
127
|
-
function
|
|
128
|
-
return
|
|
158
|
+
}, pt = (e) => p(e) && e % 1 !== 0, Ae = (e) => Number.isInteger(e);
|
|
159
|
+
function dt(e) {
|
|
160
|
+
return b(e) && e.every(Ae);
|
|
129
161
|
}
|
|
130
162
|
const H = (e) => e == null;
|
|
131
|
-
function
|
|
132
|
-
return
|
|
163
|
+
function mt(e) {
|
|
164
|
+
return b(e) && e.every(p);
|
|
133
165
|
}
|
|
134
|
-
const
|
|
135
|
-
function
|
|
166
|
+
const _ = (e) => !!e && e.constructor === Object, yt = (e) => typeof e == "object" && e !== null;
|
|
167
|
+
function Ee(e) {
|
|
136
168
|
if (Object.prototype.toString.call(e) !== "[object Object]")
|
|
137
169
|
return !1;
|
|
138
170
|
const t = Object.getPrototypeOf(e);
|
|
139
171
|
return t === null || t === Object.prototype;
|
|
140
172
|
}
|
|
141
|
-
function
|
|
173
|
+
function gt(e) {
|
|
142
174
|
return e == null || typeof e != "object" && typeof e != "function";
|
|
143
175
|
}
|
|
144
|
-
const
|
|
145
|
-
function
|
|
176
|
+
const wt = (e) => !(!e || !e.then || !d(e.then));
|
|
177
|
+
function At(e) {
|
|
146
178
|
return e instanceof RegExp;
|
|
147
179
|
}
|
|
148
180
|
function O(e) {
|
|
149
181
|
return typeof e == "string";
|
|
150
182
|
}
|
|
151
|
-
const
|
|
183
|
+
const Et = (e) => b(e) ? e.every(O) : !1, $ = (e) => e instanceof Uint8Array, St = (e) => Array.isArray(e) ? e : H(e) ? [] : [e], bt = (e, t = [], r = []) => {
|
|
152
184
|
const n = [...e];
|
|
153
185
|
return n.sort((o, c) => {
|
|
154
186
|
for (let s = 0; s < t.length; s++) {
|
|
155
|
-
const i = t[s], a = r[s] || "asc",
|
|
156
|
-
if (
|
|
157
|
-
if (
|
|
158
|
-
if (
|
|
187
|
+
const i = t[s], a = r[s] || "asc", l = o[i], u = c[i];
|
|
188
|
+
if (l == null && u == null) continue;
|
|
189
|
+
if (l == null) return a === "desc" ? 1 : -1;
|
|
190
|
+
if (u == null) return a === "desc" ? -1 : 1;
|
|
159
191
|
let f = 0;
|
|
160
|
-
if (
|
|
192
|
+
if (l < u ? f = -1 : l > u && (f = 1), a === "desc" && (f = -f), f !== 0)
|
|
161
193
|
return f;
|
|
162
194
|
}
|
|
163
195
|
return 0;
|
|
164
196
|
}), n;
|
|
165
|
-
},
|
|
197
|
+
}, Ot = (e) => (t, r) => {
|
|
166
198
|
const n = t[e], o = r[e];
|
|
167
199
|
return n == null && o == null ? 0 : n == null ? 1 : o == null ? -1 : n > o ? 1 : n < o ? -1 : 0;
|
|
168
|
-
},
|
|
169
|
-
|
|
200
|
+
}, Tt = (e, t) => e.filter(/* @__PURE__ */ ((r) => (n) => r.has(t(n)) ? !1 : r.add(t(n)))(/* @__PURE__ */ new Set()));
|
|
201
|
+
class Ct {
|
|
202
|
+
maxConcurrent;
|
|
203
|
+
running = 0;
|
|
204
|
+
queue = [];
|
|
205
|
+
queue_map = /* @__PURE__ */ new Map();
|
|
206
|
+
constructor(t = 3) {
|
|
207
|
+
this.maxConcurrent = t || 1;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* 添加任务到执行器
|
|
211
|
+
* @param task - 返回 Promise 的异步任务函数
|
|
212
|
+
* @param id - 任务唯一标识符(可选),用于去重相同任务
|
|
213
|
+
* @returns 返回任务执行结果的 Promise
|
|
214
|
+
*/
|
|
215
|
+
addTask(t, r) {
|
|
216
|
+
if (r && this.queue_map.has(r))
|
|
217
|
+
return this.queue_map.get(r);
|
|
218
|
+
const n = new Promise((o, c) => {
|
|
219
|
+
this.queue.push({
|
|
220
|
+
task: t,
|
|
221
|
+
resolve: o,
|
|
222
|
+
reject: c,
|
|
223
|
+
id: r
|
|
224
|
+
}), this._run_next();
|
|
225
|
+
});
|
|
226
|
+
return r !== void 0 && this.queue_map.set(r, n), n;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* 获取当前状态
|
|
230
|
+
* @returns 包含运行中任务数、队列长度和最大并发数
|
|
231
|
+
*/
|
|
232
|
+
getStatus() {
|
|
233
|
+
return {
|
|
234
|
+
running: this.running,
|
|
235
|
+
queued: this.queue.length,
|
|
236
|
+
maxConcurrent: this.maxConcurrent
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* 动态修改最大并发数
|
|
241
|
+
* @param newMax - 新的最大并发数
|
|
242
|
+
*/
|
|
243
|
+
setMaxConcurrent(t) {
|
|
244
|
+
for (t = t || 1, this.maxConcurrent = t; this.running < this.maxConcurrent && this.queue.length > 0; )
|
|
245
|
+
this._run_next();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 清空队列(不影响正在执行的任务)
|
|
249
|
+
*/
|
|
250
|
+
clearQueue() {
|
|
251
|
+
this.queue.forEach(({ reject: t }) => {
|
|
252
|
+
t(new Error("Task cancelled: queue cleared"));
|
|
253
|
+
}), this.queue = [], this.queue_map.clear();
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* 等待所有任务完成
|
|
257
|
+
* @returns 当所有任务完成时 resolve
|
|
258
|
+
*/
|
|
259
|
+
waitForAll() {
|
|
260
|
+
return new Promise((t) => {
|
|
261
|
+
const r = () => {
|
|
262
|
+
this.running === 0 && this.queue.length === 0 ? t() : setTimeout(r, 50);
|
|
263
|
+
};
|
|
264
|
+
r();
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* 获取当前运行中的任务数
|
|
269
|
+
*/
|
|
270
|
+
getRunningCount() {
|
|
271
|
+
return this.running;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* 获取队列中等待的任务数
|
|
275
|
+
*/
|
|
276
|
+
getQueuedCount() {
|
|
277
|
+
return this.queue.length;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* 执行队列中的下一个任务
|
|
281
|
+
*/
|
|
282
|
+
_run_next() {
|
|
283
|
+
if (this.running >= this.maxConcurrent || this.queue.length === 0) return;
|
|
284
|
+
const t = this.queue.shift();
|
|
285
|
+
if (!t) return;
|
|
286
|
+
const { task: r, resolve: n, reject: o, id: c } = t;
|
|
287
|
+
this.running++, Promise.resolve().then(() => r()).then((s) => {
|
|
288
|
+
n(s);
|
|
289
|
+
}).catch((s) => {
|
|
290
|
+
o(s);
|
|
291
|
+
}).finally(() => {
|
|
292
|
+
this.running--, c !== void 0 && this.queue_map.delete(c), this._run_next();
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const Pt = (e) => setTimeout(() => e(), 0), L = /* @__PURE__ */ Promise.resolve(), $t = (e) => e ? L.then(e) : L, Mt = (e) => new Promise((t) => setTimeout(t, e)), Se = new TextDecoder(), _t = (e) => Se.decode(e);
|
|
297
|
+
function be(e, t) {
|
|
170
298
|
for (const r in e)
|
|
171
|
-
Object.prototype.hasOwnProperty.call(e, r) && (t(r, e[r], e),
|
|
299
|
+
Object.prototype.hasOwnProperty.call(e, r) && (t(r, e[r], e), Q(e[r], t));
|
|
172
300
|
}
|
|
173
|
-
const
|
|
174
|
-
Array.isArray(e) ? e.forEach((r) =>
|
|
301
|
+
const Q = (e, t) => {
|
|
302
|
+
Array.isArray(e) ? e.forEach((r) => Q(r, t)) : _(e) && be(e, t);
|
|
175
303
|
}, C = (e) => new Uint8Array(
|
|
176
304
|
atob(e).split("").map((t) => t.charCodeAt(0))
|
|
177
305
|
);
|
|
178
|
-
async function
|
|
306
|
+
async function Rt(e, t, r) {
|
|
179
307
|
const n = await crypto.subtle.importKey(
|
|
180
308
|
"raw",
|
|
181
309
|
C(t),
|
|
@@ -195,19 +323,19 @@ async function Mt(e, t, r) {
|
|
|
195
323
|
);
|
|
196
324
|
return new TextDecoder().decode(c);
|
|
197
325
|
}
|
|
198
|
-
const
|
|
326
|
+
const S = (e) => {
|
|
199
327
|
if (O(e))
|
|
200
328
|
return btoa(e);
|
|
201
|
-
if (
|
|
329
|
+
if ($(e) || Array.isArray(e))
|
|
202
330
|
return btoa(String.fromCharCode(...e));
|
|
203
|
-
if (
|
|
331
|
+
if (ge(e)) {
|
|
204
332
|
const t = new Uint8Array(e);
|
|
205
333
|
return btoa(String.fromCharCode(...t));
|
|
206
334
|
}
|
|
207
335
|
throw new TypeError(`Unsupported type for base64 encoding: ${typeof e}`);
|
|
208
|
-
}, { subtle:
|
|
209
|
-
async function
|
|
210
|
-
return await
|
|
336
|
+
}, { subtle: Oe } = globalThis.crypto;
|
|
337
|
+
async function Te() {
|
|
338
|
+
return await Oe.generateKey(
|
|
211
339
|
{
|
|
212
340
|
name: "AES-GCM",
|
|
213
341
|
length: 256
|
|
@@ -216,12 +344,12 @@ async function Se() {
|
|
|
216
344
|
["encrypt", "decrypt"]
|
|
217
345
|
);
|
|
218
346
|
}
|
|
219
|
-
async function
|
|
347
|
+
async function Ce(e) {
|
|
220
348
|
const t = await crypto.subtle.exportKey("raw", e);
|
|
221
|
-
return
|
|
349
|
+
return S(t);
|
|
222
350
|
}
|
|
223
|
-
async function
|
|
224
|
-
const t = new TextEncoder(), r = await
|
|
351
|
+
async function xt(e) {
|
|
352
|
+
const t = new TextEncoder(), r = await Te(), n = crypto.getRandomValues(new Uint8Array(16)), o = await crypto.subtle.encrypt(
|
|
225
353
|
{
|
|
226
354
|
name: "AES-GCM",
|
|
227
355
|
iv: n
|
|
@@ -230,25 +358,25 @@ async function Pt(e) {
|
|
|
230
358
|
t.encode(e)
|
|
231
359
|
);
|
|
232
360
|
return {
|
|
233
|
-
key: await
|
|
234
|
-
iv:
|
|
235
|
-
cipherText:
|
|
361
|
+
key: await Ce(r),
|
|
362
|
+
iv: S(n),
|
|
363
|
+
cipherText: S(o)
|
|
236
364
|
};
|
|
237
365
|
}
|
|
238
|
-
const
|
|
366
|
+
const Pe = (e) => atob(e.replace(/[-]/g, "+").replace(/[_]/g, "/")), Bt = (e) => {
|
|
239
367
|
const t = e.split(".");
|
|
240
368
|
if (t.length !== 3) throw new Error("JWT is not valid: not a JWT structure");
|
|
241
369
|
const r = t[1];
|
|
242
|
-
return JSON.parse(
|
|
370
|
+
return JSON.parse(Pe(r));
|
|
243
371
|
};
|
|
244
|
-
function
|
|
372
|
+
function R(e) {
|
|
245
373
|
const t = new ArrayBuffer(e.length), r = new Uint8Array(t);
|
|
246
374
|
for (let n = 0, o = e.length; n < o; n++)
|
|
247
375
|
r[n] = e.charCodeAt(n);
|
|
248
376
|
return t;
|
|
249
377
|
}
|
|
250
|
-
function
|
|
251
|
-
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n =
|
|
378
|
+
function $e(e) {
|
|
379
|
+
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n = R(r);
|
|
252
380
|
return crypto.subtle.importKey(
|
|
253
381
|
"pkcs8",
|
|
254
382
|
n,
|
|
@@ -260,8 +388,8 @@ function Ce(e) {
|
|
|
260
388
|
["decrypt"]
|
|
261
389
|
);
|
|
262
390
|
}
|
|
263
|
-
async function
|
|
264
|
-
const r = await
|
|
391
|
+
async function It(e, t) {
|
|
392
|
+
const r = await $e(t), n = await crypto.subtle.decrypt(
|
|
265
393
|
{
|
|
266
394
|
name: "RSA-OAEP"
|
|
267
395
|
},
|
|
@@ -271,7 +399,7 @@ async function Rt(e, t) {
|
|
|
271
399
|
return new TextDecoder().decode(n);
|
|
272
400
|
}
|
|
273
401
|
function Me(e) {
|
|
274
|
-
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n =
|
|
402
|
+
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n = R(r);
|
|
275
403
|
return crypto.subtle.importKey(
|
|
276
404
|
"spki",
|
|
277
405
|
n,
|
|
@@ -283,22 +411,22 @@ function Me(e) {
|
|
|
283
411
|
["encrypt"]
|
|
284
412
|
);
|
|
285
413
|
}
|
|
286
|
-
async function
|
|
414
|
+
async function Lt(e, t) {
|
|
287
415
|
const r = await Me(t), n = await crypto.subtle.encrypt(
|
|
288
416
|
{
|
|
289
417
|
name: "RSA-OAEP"
|
|
290
418
|
},
|
|
291
419
|
r,
|
|
292
|
-
|
|
420
|
+
R(e)
|
|
293
421
|
);
|
|
294
|
-
return
|
|
422
|
+
return S(n);
|
|
295
423
|
}
|
|
296
|
-
const
|
|
297
|
-
async function
|
|
424
|
+
const j = "PUBLIC KEY", N = "RAS PRIVATE KEY";
|
|
425
|
+
async function D(e, t = "pkcs8") {
|
|
298
426
|
const r = await crypto.subtle.exportKey(t, e);
|
|
299
|
-
return
|
|
427
|
+
return S(r);
|
|
300
428
|
}
|
|
301
|
-
async function
|
|
429
|
+
async function jt(e = 1024) {
|
|
302
430
|
const { publicKey: t, privateKey: r } = await crypto.subtle.generateKey(
|
|
303
431
|
{
|
|
304
432
|
name: "RSA-OAEP",
|
|
@@ -310,17 +438,17 @@ async function Lt(e = 1024) {
|
|
|
310
438
|
},
|
|
311
439
|
!0,
|
|
312
440
|
["encrypt", "decrypt"]
|
|
313
|
-
), n = await
|
|
441
|
+
), n = await D(t, "spki"), o = await D(r, "pkcs8");
|
|
314
442
|
return {
|
|
315
|
-
publicKey: `-----BEGIN ${
|
|
443
|
+
publicKey: `-----BEGIN ${j}-----
|
|
316
444
|
${n}
|
|
317
|
-
-----END ${
|
|
318
|
-
privateKey: `-----BEGIN ${
|
|
445
|
+
-----END ${j}-----`,
|
|
446
|
+
privateKey: `-----BEGIN ${N}-----
|
|
319
447
|
${o}
|
|
320
|
-
-----END ${
|
|
448
|
+
-----END ${N}-----`
|
|
321
449
|
};
|
|
322
450
|
}
|
|
323
|
-
const
|
|
451
|
+
const Nt = (e) => p(e) || Z(e) ? !0 : H(e) ? !1 : new Date(e).getTime() > 0, _e = (e) => {
|
|
324
452
|
const t = e > 0 ? "+" : "-", r = Math.abs(e), n = `${Math.floor(r / 60)}`.padStart(2, "0"), o = `${r % 60}`.padStart(2, "0");
|
|
325
453
|
return {
|
|
326
454
|
flag: t,
|
|
@@ -328,25 +456,25 @@ const It = (e) => p(e) || q(e) ? !0 : H(e) ? !1 : new Date(e).getTime() > 0, Pe
|
|
|
328
456
|
hour: n,
|
|
329
457
|
minute: o
|
|
330
458
|
};
|
|
331
|
-
},
|
|
332
|
-
const { flag: n, hour: o, minute: c } =
|
|
459
|
+
}, Re = (e, t, r) => {
|
|
460
|
+
const { flag: n, hour: o, minute: c } = _e(r);
|
|
333
461
|
return `${e}T${t}${n}${o}:${c}`;
|
|
334
|
-
},
|
|
462
|
+
}, Dt = (e, t, r) => new Date(Re(e, t, r)), J = (e, t) => {
|
|
335
463
|
const r = t.getTime() - e.getTime(), n = Math.floor(r / 864e5), o = Math.floor(n / 30), c = Math.floor(o / 12), s = Math.floor(r / 36e5) % 24, i = Math.floor(r / 6e4) % 60, a = Math.floor(r / 1e3) % 60;
|
|
336
464
|
return { year: c, month: o, day: n, hour: s, minute: i, second: a };
|
|
337
|
-
}, Y = (e, t, r) => r ? `${t} ${r[e] || e}` : `${t} ${e}`, X = ["year", "month", "day", "hour", "minute", "second"],
|
|
338
|
-
const n =
|
|
465
|
+
}, Y = (e, t, r) => r ? `${t} ${r[e] || e}` : `${t} ${e}`, X = ["year", "month", "day", "hour", "minute", "second"], Ut = (e, t, r) => {
|
|
466
|
+
const n = J(e, t), o = X.find((s) => n[s] > 0) || "second", c = n[o];
|
|
339
467
|
return d(r) ? r({ key: o, value: c }) : Y(o, c, r);
|
|
340
|
-
},
|
|
341
|
-
const n =
|
|
468
|
+
}, kt = (e, t, r) => {
|
|
469
|
+
const n = J(e, t);
|
|
342
470
|
return d(r) ? r(n) : X.filter((o) => o).map((o) => Y(o, n[o], r)).join(" ");
|
|
343
|
-
},
|
|
344
|
-
function
|
|
471
|
+
}, Kt = (e) => O(e) && /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|\+[0-2]\d(?:\\:[0-5]\d)?)?/g.test(e);
|
|
472
|
+
function qt(e) {
|
|
345
473
|
return p(e) ? !0 : O(e) ? !!/^(?<value>-?(?:\d+)?\.?\d+) *(?<type>milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
346
474
|
e
|
|
347
475
|
)?.groups : !1;
|
|
348
476
|
}
|
|
349
|
-
const
|
|
477
|
+
const Ft = (e) => fe(e), zt = () => Math.floor(Date.now() / 1e3), Wt = (e, t = 50) => {
|
|
350
478
|
let r;
|
|
351
479
|
return function(...n) {
|
|
352
480
|
const o = () => {
|
|
@@ -354,9 +482,9 @@ const _t = (e) => ue(e), Kt = () => Math.floor(Date.now() / 1e3), kt = (e, t = 5
|
|
|
354
482
|
};
|
|
355
483
|
r !== void 0 && clearTimeout(r), r = setTimeout(o, t);
|
|
356
484
|
};
|
|
357
|
-
},
|
|
485
|
+
}, vt = () => {
|
|
358
486
|
};
|
|
359
|
-
function
|
|
487
|
+
function Gt(e) {
|
|
360
488
|
let t = !1, r;
|
|
361
489
|
return function() {
|
|
362
490
|
if (t)
|
|
@@ -365,211 +493,208 @@ function Ft(e) {
|
|
|
365
493
|
return t = !0, r = n, n;
|
|
366
494
|
};
|
|
367
495
|
}
|
|
368
|
-
const
|
|
496
|
+
const Vt = (e, t) => {
|
|
369
497
|
let r = 0;
|
|
370
498
|
return function(...n) {
|
|
371
499
|
const o = (/* @__PURE__ */ new Date()).getTime();
|
|
372
500
|
o - r >= t && (e.apply(this, n), r = o);
|
|
373
501
|
};
|
|
374
502
|
}, ee = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
375
|
-
function
|
|
503
|
+
function w(e, t, r) {
|
|
376
504
|
const n = r[0];
|
|
377
505
|
if (t != null && e >= t)
|
|
378
|
-
throw new Error(e
|
|
379
|
-
if (e.
|
|
506
|
+
throw new Error(`${e} >= ${t}`);
|
|
507
|
+
if (e.endsWith(n) || t && t.endsWith(n))
|
|
380
508
|
throw new Error("trailing zero");
|
|
381
509
|
if (t) {
|
|
382
510
|
let s = 0;
|
|
383
|
-
for (; (e[s]
|
|
511
|
+
for (; (e[s] ?? n) === t[s]; )
|
|
384
512
|
s++;
|
|
385
513
|
if (s > 0)
|
|
386
|
-
return t.slice(0, s) +
|
|
514
|
+
return t.slice(0, s) + w(e.slice(s), t.slice(s), r);
|
|
387
515
|
}
|
|
388
516
|
const o = e ? r.indexOf(e[0]) : 0, c = t != null ? r.indexOf(t[0]) : r.length;
|
|
389
517
|
if (c - o > 1) {
|
|
390
|
-
const s = Math.round(
|
|
518
|
+
const s = Math.round((o + c) / 2);
|
|
391
519
|
return r[s];
|
|
392
|
-
}
|
|
393
|
-
|
|
520
|
+
}
|
|
521
|
+
return t && t.length > 1 ? t[0] : r[o] + w(e.slice(1), null, r);
|
|
394
522
|
}
|
|
395
523
|
function te(e) {
|
|
396
|
-
|
|
397
|
-
throw new Error("invalid integer part of order key: " + e);
|
|
398
|
-
}
|
|
399
|
-
function re(e) {
|
|
524
|
+
const t = e.charCodeAt(0), r = 97, n = 90;
|
|
400
525
|
if (e >= "a" && e <= "z")
|
|
401
|
-
return
|
|
526
|
+
return t - r + 2;
|
|
402
527
|
if (e >= "A" && e <= "Z")
|
|
403
|
-
return
|
|
404
|
-
throw new Error(
|
|
528
|
+
return n - t + 2;
|
|
529
|
+
throw new Error(`invalid order key head: ${e}`);
|
|
405
530
|
}
|
|
406
531
|
function E(e) {
|
|
407
|
-
const t =
|
|
532
|
+
const t = te(e[0]);
|
|
408
533
|
if (t > e.length)
|
|
409
|
-
throw new Error(
|
|
534
|
+
throw new Error(`invalid order key: ${e}`);
|
|
410
535
|
return e.slice(0, t);
|
|
411
536
|
}
|
|
412
|
-
function
|
|
537
|
+
function re(e) {
|
|
538
|
+
if (e.length !== te(e[0]))
|
|
539
|
+
throw new Error(`invalid integer part of order key: ${e}`);
|
|
540
|
+
}
|
|
541
|
+
function U(e, t) {
|
|
413
542
|
if (e === "A" + t[0].repeat(26))
|
|
414
|
-
throw new Error(
|
|
543
|
+
throw new Error(`invalid order key: ${e}`);
|
|
415
544
|
const r = E(e);
|
|
416
|
-
if (e.slice(r.length).
|
|
417
|
-
throw new Error(
|
|
545
|
+
if (e.slice(r.length).endsWith(t[0]))
|
|
546
|
+
throw new Error(`invalid order key: ${e}`);
|
|
418
547
|
}
|
|
419
|
-
function
|
|
420
|
-
|
|
421
|
-
const [
|
|
548
|
+
function k(e, t) {
|
|
549
|
+
re(e);
|
|
550
|
+
const r = e[0], n = e.slice(1).split("");
|
|
422
551
|
let o = !0;
|
|
423
552
|
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
424
553
|
const s = t.indexOf(n[c]) + 1;
|
|
425
554
|
s === t.length ? n[c] = t[0] : (n[c] = t[s], o = !1);
|
|
426
555
|
}
|
|
427
556
|
if (o) {
|
|
428
|
-
if (r === "Z")
|
|
429
|
-
|
|
430
|
-
if (r === "z")
|
|
431
|
-
return null;
|
|
557
|
+
if (r === "Z") return "a" + t[0];
|
|
558
|
+
if (r === "z") return null;
|
|
432
559
|
const c = String.fromCharCode(r.charCodeAt(0) + 1);
|
|
433
560
|
return c > "a" ? n.push(t[0]) : n.pop(), c + n.join("");
|
|
434
|
-
}
|
|
435
|
-
|
|
561
|
+
}
|
|
562
|
+
return r + n.join("");
|
|
436
563
|
}
|
|
437
|
-
function
|
|
438
|
-
|
|
439
|
-
const [
|
|
564
|
+
function xe(e, t) {
|
|
565
|
+
re(e);
|
|
566
|
+
const r = e[0], n = e.slice(1).split("");
|
|
440
567
|
let o = !0;
|
|
441
568
|
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
442
569
|
const s = t.indexOf(n[c]) - 1;
|
|
443
|
-
s === -1 ? n[c] = t.
|
|
570
|
+
s === -1 ? n[c] = t[t.length - 1] : (n[c] = t[s], o = !1);
|
|
444
571
|
}
|
|
445
572
|
if (o) {
|
|
446
|
-
if (r === "a")
|
|
447
|
-
|
|
448
|
-
if (r === "A")
|
|
449
|
-
return null;
|
|
573
|
+
if (r === "a") return "Z" + t[t.length - 1];
|
|
574
|
+
if (r === "A") return null;
|
|
450
575
|
const c = String.fromCharCode(r.charCodeAt(0) - 1);
|
|
451
|
-
return c < "Z" ? n.push(t.
|
|
452
|
-
}
|
|
453
|
-
|
|
576
|
+
return c < "Z" ? n.push(t[t.length - 1]) : n.pop(), c + n.join("");
|
|
577
|
+
}
|
|
578
|
+
return r + n.join("");
|
|
454
579
|
}
|
|
455
|
-
function
|
|
456
|
-
if (e != null &&
|
|
457
|
-
throw new Error(e
|
|
580
|
+
function g(e, t, r = ee) {
|
|
581
|
+
if (e != null && U(e, r), t != null && U(t, r), e != null && t != null && e >= t)
|
|
582
|
+
throw new Error(`${e} >= ${t}`);
|
|
583
|
+
if (e == null && t == null)
|
|
584
|
+
return "a" + r[0];
|
|
458
585
|
if (e == null) {
|
|
459
|
-
|
|
460
|
-
return "a" + r[0];
|
|
461
|
-
const a = E(t), u = t.slice(a.length);
|
|
586
|
+
const a = E(t), l = t.slice(a.length);
|
|
462
587
|
if (a === "A" + r[0].repeat(26))
|
|
463
|
-
return a +
|
|
588
|
+
return a + w("", l, r);
|
|
464
589
|
if (a < t)
|
|
465
590
|
return a;
|
|
466
|
-
const
|
|
467
|
-
if (
|
|
591
|
+
const u = xe(a, r);
|
|
592
|
+
if (u == null)
|
|
468
593
|
throw new Error("cannot decrement any more");
|
|
469
|
-
return
|
|
594
|
+
return u;
|
|
470
595
|
}
|
|
471
596
|
if (t == null) {
|
|
472
|
-
const a = E(e),
|
|
473
|
-
return
|
|
597
|
+
const a = E(e), l = e.slice(a.length);
|
|
598
|
+
return k(a, r) ?? a + w(l, null, r);
|
|
474
599
|
}
|
|
475
600
|
const n = E(e), o = e.slice(n.length), c = E(t), s = t.slice(c.length);
|
|
476
601
|
if (n === c)
|
|
477
|
-
return n +
|
|
478
|
-
const i =
|
|
602
|
+
return n + w(o, s, r);
|
|
603
|
+
const i = k(n, r);
|
|
479
604
|
if (i == null)
|
|
480
605
|
throw new Error("cannot increment any more");
|
|
481
|
-
return i < t ? i : n +
|
|
606
|
+
return i < t ? i : n + w(o, null, r);
|
|
482
607
|
}
|
|
483
|
-
function
|
|
484
|
-
if (r === 0)
|
|
485
|
-
|
|
486
|
-
if (r === 1)
|
|
487
|
-
return [w(e, t, n)];
|
|
608
|
+
function K(e, t, r, n = ee) {
|
|
609
|
+
if (r === 0) return [];
|
|
610
|
+
if (r === 1) return [g(e, t, n)];
|
|
488
611
|
if (t == null) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
612
|
+
const s = [];
|
|
613
|
+
let i = g(e, t, n);
|
|
614
|
+
s.push(i);
|
|
615
|
+
for (let a = 1; a < r; a++)
|
|
616
|
+
i = g(i, t, n), s.push(i);
|
|
617
|
+
return s;
|
|
494
618
|
}
|
|
495
619
|
if (e == null) {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
620
|
+
const s = [];
|
|
621
|
+
let i = g(e, t, n);
|
|
622
|
+
s.push(i);
|
|
623
|
+
for (let a = 1; a < r; a++)
|
|
624
|
+
i = g(e, i, n), s.push(i);
|
|
625
|
+
return s.reverse();
|
|
501
626
|
}
|
|
502
|
-
const o = Math.floor(r / 2), c =
|
|
503
|
-
return [...
|
|
627
|
+
const o = Math.floor(r / 2), c = g(e, t, n);
|
|
628
|
+
return [...K(e, c, o, n), c, ...K(c, t, r - o - 1, n)];
|
|
504
629
|
}
|
|
505
630
|
const Be = (e) => {
|
|
506
631
|
if (e == null || e === "") return !1;
|
|
507
632
|
const t = parseFloat(e);
|
|
508
633
|
return !(isNaN(t) || !isFinite(t));
|
|
509
|
-
},
|
|
634
|
+
}, Ie = (e, t) => Math.ceil(e / t) * t, Zt = (e, t = 80, r = 1) => Ie(e * r, t), Ht = (e, t = 12) => parseFloat(e.toPrecision(t)), Qt = (e) => {
|
|
510
635
|
const t = Number(e);
|
|
511
636
|
return t < 0 ? Math.ceil(t) : Math.floor(t);
|
|
512
|
-
},
|
|
637
|
+
}, Jt = (e) => {
|
|
513
638
|
if (Be(e)) {
|
|
514
639
|
const t = Number(e);
|
|
515
640
|
return isNaN(t) || !isFinite(t) ? e : t;
|
|
516
641
|
}
|
|
517
642
|
return e;
|
|
518
|
-
},
|
|
643
|
+
}, Le = (e) => {
|
|
519
644
|
for (const r of Object.getOwnPropertyNames(e)) {
|
|
520
645
|
const n = e[r];
|
|
521
|
-
!
|
|
646
|
+
!_(n) && !d(n) || n === null || Le(n);
|
|
522
647
|
}
|
|
523
648
|
return Object.isFrozen(e) ? e : Object.freeze(e);
|
|
524
|
-
},
|
|
649
|
+
}, je = (e) => e.replace(/\[/g, ".").replace(/\]/g, "").split(".");
|
|
525
650
|
function ne(e, t, r, n) {
|
|
526
651
|
const o = d(n) ? n : void 0;
|
|
527
|
-
return
|
|
528
|
-
if (a ===
|
|
652
|
+
return je(t).reduce((s, i, a, l) => {
|
|
653
|
+
if (a === l.length - 1)
|
|
529
654
|
return s[i] = r, s;
|
|
530
655
|
if (i in s)
|
|
531
656
|
return s[i];
|
|
532
657
|
if (!i) return s;
|
|
533
658
|
if (o) {
|
|
534
|
-
const
|
|
535
|
-
if (
|
|
659
|
+
const u = o(s[i], i, s);
|
|
660
|
+
if (u) return s[i] = u;
|
|
536
661
|
}
|
|
537
|
-
return s[i] = /^[0-9]{1,}$/.test(
|
|
662
|
+
return s[i] = /^[0-9]{1,}$/.test(l[a + 1]) ? [] : {};
|
|
538
663
|
}, e), e;
|
|
539
664
|
}
|
|
540
|
-
function
|
|
665
|
+
function Ne(e, t, r) {
|
|
541
666
|
return ne(e, t, r);
|
|
542
667
|
}
|
|
543
668
|
function De(e, t, r, n) {
|
|
544
669
|
const o = d(n) ? n : void 0;
|
|
545
670
|
return ne(e, t, r, o);
|
|
546
671
|
}
|
|
547
|
-
const
|
|
672
|
+
const Yt = (e) => {
|
|
548
673
|
const t = {};
|
|
549
674
|
return Object.keys(e).forEach((r) => {
|
|
550
|
-
r.match(/[^\]]*\[\d+\]/) ?
|
|
675
|
+
r.match(/[^\]]*\[\d+\]/) ? Ne(t, r, e[r]) : De(t, r, e[r], Object);
|
|
551
676
|
}), t;
|
|
552
|
-
},
|
|
677
|
+
}, Ue = (e, t, r) => {
|
|
553
678
|
const n = (c) => String.prototype.split.call(t, c).filter(Boolean).reduce((s, i) => s != null ? s[i] : s, e), o = n(/[,[\]]+?/) || n(/[,[\].]+?/);
|
|
554
679
|
return o === void 0 || o === e ? r : o;
|
|
555
|
-
},
|
|
680
|
+
}, ke = (e, t) => {
|
|
556
681
|
const r = t.split(".");
|
|
557
|
-
return !!e && (r.length > 1 ?
|
|
682
|
+
return !!e && (r.length > 1 ? ke(e[t.split(".")[0]], r.slice(1).join(".")) : Object.hasOwnProperty.call(e, t));
|
|
558
683
|
};
|
|
559
|
-
function
|
|
684
|
+
function Ke(e, t) {
|
|
560
685
|
return e.length !== t.length ? !1 : e.every((r, n) => r === t[n]);
|
|
561
686
|
}
|
|
562
|
-
const
|
|
687
|
+
const q = (e, t) => {
|
|
563
688
|
if (e === t || Object.is(e, t)) return !0;
|
|
564
689
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
565
690
|
if (e.constructor !== t.constructor) return !1;
|
|
566
691
|
let r, n;
|
|
567
692
|
if (Array.isArray(e)) {
|
|
568
693
|
if (r = e.length, r != t.length) return !1;
|
|
569
|
-
for (n = r; n-- !== 0; ) if (!
|
|
694
|
+
for (n = r; n-- !== 0; ) if (!q(e[n], t[n])) return !1;
|
|
570
695
|
return !0;
|
|
571
696
|
}
|
|
572
|
-
if (
|
|
697
|
+
if ($(e) && $(t)) return Ke(e, t);
|
|
573
698
|
if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
|
|
574
699
|
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
|
|
575
700
|
if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
|
|
@@ -578,90 +703,90 @@ const z = (e, t) => {
|
|
|
578
703
|
for (n = r; n-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(t, o[n])) return !1;
|
|
579
704
|
for (n = r; n-- !== 0; ) {
|
|
580
705
|
const c = o[n];
|
|
581
|
-
if (!
|
|
706
|
+
if (!q(e[c], t[c])) return !1;
|
|
582
707
|
}
|
|
583
708
|
return !0;
|
|
584
709
|
}
|
|
585
710
|
return e !== e && t !== t;
|
|
586
|
-
},
|
|
711
|
+
}, Xt = (e, t) => +e == +t, er = (e, t) => e ? !t || t.length === 0 ? e : t.reduce(
|
|
587
712
|
(r, n) => (delete r[n], r),
|
|
588
713
|
{ ...e }
|
|
589
714
|
) : {};
|
|
590
|
-
function
|
|
715
|
+
function tr(e, t) {
|
|
591
716
|
return Object.keys(e).filter((r) => !t(e[r], r)).reduce((r, n) => (r[n] = e[n], r), {});
|
|
592
717
|
}
|
|
593
|
-
function
|
|
718
|
+
function rr(e, t) {
|
|
594
719
|
return e ? t.reduce(
|
|
595
720
|
(r, n) => (Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]), r),
|
|
596
721
|
{}
|
|
597
722
|
) : {};
|
|
598
723
|
}
|
|
599
|
-
function
|
|
724
|
+
function nr(e, t) {
|
|
600
725
|
return Object.keys(e).filter((r) => t(e[r], r)).reduce((r, n) => (r[n] = e[n], r), {});
|
|
601
726
|
}
|
|
602
|
-
const
|
|
603
|
-
(n) =>
|
|
727
|
+
const M = (e, t = "", r = {}) => (b(e) ? e.forEach((n, o) => M(n, `${t}[${o}]`, r)) : Ee(e) ? Object.keys(e).forEach(
|
|
728
|
+
(n) => M(e[n], `${t ? t + "." : ""}${n}`, r)
|
|
604
729
|
) : r[`${t}`] = e, r);
|
|
605
|
-
function
|
|
606
|
-
return
|
|
730
|
+
function or(e) {
|
|
731
|
+
return M(e);
|
|
607
732
|
}
|
|
608
|
-
const
|
|
733
|
+
const sr = (e) => {
|
|
609
734
|
const t = {};
|
|
610
735
|
for (const r in e)
|
|
611
736
|
Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
|
|
612
737
|
return t;
|
|
613
738
|
};
|
|
614
|
-
function
|
|
739
|
+
function cr(e, t) {
|
|
615
740
|
if (!e || !e.length)
|
|
616
741
|
return {};
|
|
617
|
-
const r = d(t) ? t :
|
|
742
|
+
const r = d(t) ? t : b(t) ? (n, o) => t[o] : () => t;
|
|
618
743
|
return e.reduce(
|
|
619
744
|
(n, o, c) => (n[o] = r(o, c), n),
|
|
620
745
|
{}
|
|
621
746
|
);
|
|
622
747
|
}
|
|
623
|
-
const
|
|
624
|
-
function
|
|
748
|
+
const ir = typeof window == "object", ar = (e) => e[Math.floor(Math.random() * e.length)], lr = (e = Number.MIN_SAFE_INTEGER, t = Number.MAX_SAFE_INTEGER) => Math.random() * (t - e) + e;
|
|
749
|
+
function ur(e = Number.MIN_SAFE_INTEGER, t = Number.MAX_SAFE_INTEGER) {
|
|
625
750
|
return Math.floor(Math.random() * (t - e + 1) + e);
|
|
626
751
|
}
|
|
627
|
-
const
|
|
752
|
+
const qe = "0", oe = "123456789", se = qe + oe, ce = "abcdefghijklmnopqrstuvwxyz", Fe = ce.toUpperCase(), ze = ce + Fe, We = "_-", ve = se + ze + We, F = (e = 16, t = ve) => {
|
|
628
753
|
let r = "";
|
|
629
754
|
const n = crypto.getRandomValues(new Uint8Array(e |= 0)), o = t.length - 1;
|
|
630
755
|
for (; e--; ) r += t[n[e] & o];
|
|
631
756
|
return r;
|
|
632
|
-
},
|
|
757
|
+
}, Ge = (e = 16) => F(1, oe) + F(e - 1, se), fr = (e = 16) => parseInt(Ge(e), 10), ie = (e) => {
|
|
633
758
|
if (!e) return "";
|
|
634
759
|
const t = e.toLowerCase();
|
|
635
|
-
return
|
|
636
|
-
},
|
|
637
|
-
function
|
|
638
|
-
const t =
|
|
760
|
+
return Ve(t);
|
|
761
|
+
}, Ve = (e) => e ? e.substring(0, 1).toUpperCase() + e.substring(1, e.length) : "", Ze = /[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g, x = (e) => Array.from(e.match(Ze) ?? []);
|
|
762
|
+
function hr(e) {
|
|
763
|
+
const t = x(e);
|
|
639
764
|
if (t.length === 0)
|
|
640
765
|
return "";
|
|
641
766
|
const [r, ...n] = t;
|
|
642
767
|
return `${r.toLowerCase()}${n.map((o) => ie(o)).join("")}`;
|
|
643
768
|
}
|
|
644
|
-
const
|
|
769
|
+
const pr = async (e, t = "deflate") => {
|
|
645
770
|
try {
|
|
646
771
|
const n = new TextEncoder().encode(e), o = new CompressionStream(t), s = o.writable.getWriter();
|
|
647
772
|
await s.write(n), await s.close();
|
|
648
|
-
const a = o.readable.getReader(),
|
|
649
|
-
let
|
|
773
|
+
const a = o.readable.getReader(), l = [];
|
|
774
|
+
let u = 0;
|
|
650
775
|
for (; ; ) {
|
|
651
|
-
const { done: m, value:
|
|
776
|
+
const { done: m, value: P } = await a.read();
|
|
652
777
|
if (m) break;
|
|
653
|
-
|
|
778
|
+
l.push(P), u += P.length;
|
|
654
779
|
}
|
|
655
|
-
const f = new Uint8Array(
|
|
780
|
+
const f = new Uint8Array(u);
|
|
656
781
|
let A = 0;
|
|
657
|
-
for (const m of
|
|
782
|
+
for (const m of l)
|
|
658
783
|
f.set(m, A), A += m.length;
|
|
659
784
|
let y = btoa(String.fromCharCode(...f));
|
|
660
785
|
return y = y.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), y;
|
|
661
786
|
} catch (r) {
|
|
662
787
|
throw console.error("压缩过程中出错:", r), r;
|
|
663
788
|
}
|
|
664
|
-
},
|
|
789
|
+
}, dr = async (e, t = "deflate") => {
|
|
665
790
|
try {
|
|
666
791
|
let r = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
667
792
|
const n = (4 - r.length % 4) % 4;
|
|
@@ -671,12 +796,12 @@ const lr = async (e, t = "deflate") => {
|
|
|
671
796
|
c[h] = o.charCodeAt(h);
|
|
672
797
|
const s = new DecompressionStream(t), a = s.writable.getWriter();
|
|
673
798
|
await a.write(c), await a.close();
|
|
674
|
-
const
|
|
799
|
+
const u = s.readable.getReader(), f = [];
|
|
675
800
|
let A = 0;
|
|
676
801
|
for (; ; ) {
|
|
677
|
-
const { done: h, value:
|
|
802
|
+
const { done: h, value: B } = await u.read();
|
|
678
803
|
if (h) break;
|
|
679
|
-
f.push(
|
|
804
|
+
f.push(B), A += B.length;
|
|
680
805
|
}
|
|
681
806
|
const y = new Uint8Array(A);
|
|
682
807
|
let m = 0;
|
|
@@ -686,7 +811,7 @@ const lr = async (e, t = "deflate") => {
|
|
|
686
811
|
} catch (r) {
|
|
687
812
|
throw console.error("解压过程中出错:", r), r;
|
|
688
813
|
}
|
|
689
|
-
},
|
|
814
|
+
}, He = (e) => x(e).map((r) => r.toLowerCase()).join("-"), Qe = {
|
|
690
815
|
"〇": 0,
|
|
691
816
|
一: 1,
|
|
692
817
|
二: 2,
|
|
@@ -725,10 +850,10 @@ const lr = async (e, t = "deflate") => {
|
|
|
725
850
|
8: 8,
|
|
726
851
|
9: 9
|
|
727
852
|
};
|
|
728
|
-
function
|
|
853
|
+
function mr(e) {
|
|
729
854
|
let t = 0, r = 0, n = 0, o = !1;
|
|
730
855
|
for (const c of e.split("").reverse()) {
|
|
731
|
-
if (r =
|
|
856
|
+
if (r = Qe[c], r === void 0)
|
|
732
857
|
throw new Error(`无法解析的数字: ${c}`);
|
|
733
858
|
switch (r) {
|
|
734
859
|
case 10: {
|
|
@@ -751,7 +876,7 @@ function fr(e) {
|
|
|
751
876
|
}
|
|
752
877
|
return o && (t += r), t;
|
|
753
878
|
}
|
|
754
|
-
const
|
|
879
|
+
const yr = (e) => {
|
|
755
880
|
const t = {};
|
|
756
881
|
return new URLSearchParams(e).forEach((n, o) => {
|
|
757
882
|
if (Object.prototype.hasOwnProperty.call(t, o)) {
|
|
@@ -760,7 +885,7 @@ const hr = (e) => {
|
|
|
760
885
|
} else
|
|
761
886
|
t[o] = n;
|
|
762
887
|
}), t;
|
|
763
|
-
},
|
|
888
|
+
}, gr = (e) => {
|
|
764
889
|
const t = new URLSearchParams();
|
|
765
890
|
for (const r in e)
|
|
766
891
|
if (Object.prototype.hasOwnProperty.call(e, r)) {
|
|
@@ -768,10 +893,10 @@ const hr = (e) => {
|
|
|
768
893
|
Array.isArray(n) ? n.forEach((o) => t.append(r, `${o}`)) : t.set(r, `${n}`);
|
|
769
894
|
}
|
|
770
895
|
return t.sort(), t.toString();
|
|
771
|
-
},
|
|
896
|
+
}, Je = ["角", "分", "厘"], z = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], T = [
|
|
772
897
|
["元", "万", "亿", "兆", "京", "垓"],
|
|
773
898
|
["", "拾", "佰", "仟"]
|
|
774
|
-
], W = Math.pow(10, 22),
|
|
899
|
+
], W = Math.pow(10, 22), wr = (e) => {
|
|
775
900
|
const t = e < 0 ? "欠" : "";
|
|
776
901
|
let r = Math.abs(e);
|
|
777
902
|
if (r > W)
|
|
@@ -779,8 +904,8 @@ const hr = (e) => {
|
|
|
779
904
|
let n = "";
|
|
780
905
|
if (e > Math.floor(e)) {
|
|
781
906
|
const o = +("0." + `${r}`.split(".")[1]);
|
|
782
|
-
n =
|
|
783
|
-
(c, s, i) => c + (
|
|
907
|
+
n = Je.reduce(
|
|
908
|
+
(c, s, i) => c + (z[Math.floor(o * 10 * Math.pow(10, i)) % 10] + s).replace(/零./, ""),
|
|
784
909
|
""
|
|
785
910
|
);
|
|
786
911
|
}
|
|
@@ -788,20 +913,20 @@ const hr = (e) => {
|
|
|
788
913
|
for (let o = 0; o < T[0].length && r > 0; o++) {
|
|
789
914
|
let c = "";
|
|
790
915
|
for (let s = 0; s < T[1].length && r > 0; s++)
|
|
791
|
-
c =
|
|
916
|
+
c = z[r % 10] + T[1][s] + c, r = Math.floor(r / 10);
|
|
792
917
|
n = c.replace(/(零.)*零$/g, "").replace(/^$/, "零") + T[0][o] + n;
|
|
793
918
|
}
|
|
794
919
|
return `${t}${n.replace(/(零.)*零元/, "元").replace(/(零.)+/g, "零").replace(/^整$/, "零元整")}`;
|
|
795
920
|
};
|
|
796
|
-
function
|
|
921
|
+
function Ar(e, t) {
|
|
797
922
|
const r = e || "", n = t || "", o = Math.max(r.length, n.length);
|
|
798
|
-
return o === 0 ? 1 : (o -
|
|
923
|
+
return o === 0 ? 1 : (o - he(r, n)) / o;
|
|
799
924
|
}
|
|
800
|
-
const
|
|
925
|
+
const Er = (e) => x(e).map((r) => r.toLowerCase()).join("_"), Sr = (e) => He(e).split("-").filter((t) => !!t).map((t) => ie(t.toLowerCase())).join(" "), br = (e) => e.trim().replace(/\s+/g, " "), Or = (e, t) => e.replace(/\${([^}]+)}/g, (r, n) => Ue(t, n.trim(), "")), Ye = (e) => e ? e.substring(0, 1).toLowerCase() + e.substring(1, e.length) : "", Tr = (e) => {
|
|
801
926
|
if (!e) return "";
|
|
802
927
|
const t = e.toLowerCase();
|
|
803
|
-
return
|
|
804
|
-
}, v = /^([^/:]+):\/*/,
|
|
928
|
+
return Ye(t);
|
|
929
|
+
}, v = /^([^/:]+):\/*/, Cr = (...e) => {
|
|
805
930
|
if (e = e.filter((s) => s !== ""), e.length === 0)
|
|
806
931
|
return "";
|
|
807
932
|
if (e.findIndex((s) => !(O(s) || p(s))) >= 0)
|
|
@@ -823,7 +948,7 @@ const yr = (e) => L(e).map((r) => r.toLowerCase()).join("_"), wr = (e) => Ze(e).
|
|
|
823
948
|
}
|
|
824
949
|
return c.replace(/\/(\?|&|#[^!])/g, "$1");
|
|
825
950
|
};
|
|
826
|
-
class
|
|
951
|
+
class Pr {
|
|
827
952
|
#e = /* @__PURE__ */ new Map();
|
|
828
953
|
/**
|
|
829
954
|
* 添加事件监听器
|
|
@@ -877,9 +1002,9 @@ class Sr {
|
|
|
877
1002
|
}
|
|
878
1003
|
}
|
|
879
1004
|
}
|
|
880
|
-
const
|
|
1005
|
+
const $r = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", Mr = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", _r = (e, ...t) => {
|
|
881
1006
|
const r = [];
|
|
882
|
-
|
|
1007
|
+
_(e) ? Object.keys(e).sort().forEach((o) => {
|
|
883
1008
|
const c = e[o];
|
|
884
1009
|
r.push([o, c]);
|
|
885
1010
|
}) : r.push([e]), t.length && t.forEach((o) => {
|
|
@@ -887,125 +1012,128 @@ const Or = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBAD
|
|
|
887
1012
|
}), (console?.table ?? console.log)(r);
|
|
888
1013
|
};
|
|
889
1014
|
export {
|
|
1015
|
+
Ct as AsyncQueueExecutor,
|
|
890
1016
|
ee as BASE_62_DIGITS,
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
1017
|
+
Pr as EventDispatcher,
|
|
1018
|
+
$r as IMAGE_MIN_BASE64_BLACK,
|
|
1019
|
+
Mr as IMAGE_MIN_BASE64_TRANSPARENT,
|
|
1020
|
+
ir as IS_BROWSER,
|
|
1021
|
+
nt as IdleTimer,
|
|
1022
|
+
ot as LeaderElection,
|
|
1023
|
+
Rt as aesDecrypt,
|
|
1024
|
+
xt as aesEncrypt,
|
|
899
1025
|
C as base64Decode,
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
1026
|
+
S as base64Encode,
|
|
1027
|
+
hr as camelCase,
|
|
1028
|
+
Nt as canBeDate,
|
|
903
1029
|
Be as canBeNumber,
|
|
904
1030
|
ie as capitalize,
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
Ue as
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1031
|
+
Ve as capitalizeFirst,
|
|
1032
|
+
st as checkOPFSAvailable,
|
|
1033
|
+
it as chunk,
|
|
1034
|
+
pr as compressToBase64Url,
|
|
1035
|
+
rt as createBroadcastTopic,
|
|
1036
|
+
Dt as dateStringToDate,
|
|
1037
|
+
Re as dateStringWithTimezone,
|
|
1038
|
+
Wt as debounce,
|
|
1039
|
+
Bt as decodeJWTPayload,
|
|
1040
|
+
dr as decompressFromBase64Url,
|
|
1041
|
+
Le as deepFreeze,
|
|
1042
|
+
at as difference,
|
|
1043
|
+
vt as emptyFunction,
|
|
1044
|
+
lt as flatten,
|
|
1045
|
+
ye as flattenDeep,
|
|
1046
|
+
Yt as flattenPathObjectToPlainObject,
|
|
1047
|
+
kt as formatCountdown,
|
|
1048
|
+
Ut as formatPassTime,
|
|
1049
|
+
g as generateKeyBetween,
|
|
1050
|
+
K as generateKeysBetween,
|
|
1051
|
+
Ue as get,
|
|
1052
|
+
ke as has,
|
|
1053
|
+
ut as intersection,
|
|
1054
|
+
b as isArray,
|
|
1055
|
+
ge as isArrayBuffer,
|
|
1056
|
+
ft as isBoolean,
|
|
1057
|
+
Z as isDate,
|
|
1058
|
+
ht as isEmpty,
|
|
1059
|
+
q as isEqual,
|
|
1060
|
+
Xt as isEqualDate,
|
|
1061
|
+
Ke as isEqualUint8Array,
|
|
1062
|
+
pt as isFloat,
|
|
936
1063
|
d as isFunction,
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
1064
|
+
Kt as isISODateString,
|
|
1065
|
+
Ae as isInt,
|
|
1066
|
+
dt as isIntArray,
|
|
1067
|
+
qt as isMSTime,
|
|
941
1068
|
H as isNil,
|
|
942
1069
|
p as isNumber,
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
1070
|
+
mt as isNumberArray,
|
|
1071
|
+
me as isOPFSSupported,
|
|
1072
|
+
_ as isObject,
|
|
1073
|
+
yt as isObjectLike,
|
|
1074
|
+
Ee as isPlainObject,
|
|
1075
|
+
gt as isPrimitive,
|
|
1076
|
+
wt as isPromise,
|
|
1077
|
+
At as isRegExp,
|
|
950
1078
|
O as isString,
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
1079
|
+
Et as isStringArray,
|
|
1080
|
+
we as isSymbol,
|
|
1081
|
+
$ as isUint8Array,
|
|
1082
|
+
He as kebabCase,
|
|
1083
|
+
_r as logError,
|
|
1084
|
+
Ft as msTimeToMilliseconds,
|
|
1085
|
+
St as needArray,
|
|
1086
|
+
Pt as nextMacroTask,
|
|
1087
|
+
$t as nextMicroTask,
|
|
1088
|
+
vt as noop,
|
|
1089
|
+
Ie as numberStep,
|
|
1090
|
+
Zt as numberStepScreenSize,
|
|
1091
|
+
Ht as numberStrip,
|
|
1092
|
+
er as omit,
|
|
1093
|
+
tr as omitBy,
|
|
1094
|
+
Gt as once,
|
|
1095
|
+
bt as orderBy,
|
|
1096
|
+
mr as parseChineseNumber,
|
|
1097
|
+
J as parseTime,
|
|
1098
|
+
ct as performChunk,
|
|
1099
|
+
rr as pick,
|
|
1100
|
+
nr as pickBy,
|
|
1101
|
+
or as plainObjectToFlattenPathObject,
|
|
1102
|
+
I as pool,
|
|
1103
|
+
yr as queryParse,
|
|
1104
|
+
gr as queryStringify,
|
|
1105
|
+
ar as randomArrayItem,
|
|
1106
|
+
lr as randomFloat,
|
|
1107
|
+
ur as randomInt,
|
|
980
1108
|
F as randomString,
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1109
|
+
fr as randomUintByLength,
|
|
1110
|
+
Ge as randomUintString,
|
|
1111
|
+
wr as rmbUppercase,
|
|
1112
|
+
It as rsaDecrypt,
|
|
1113
|
+
Lt as rsaEncrypt,
|
|
1114
|
+
jt as rsaGenerateKey,
|
|
1115
|
+
Ne as set,
|
|
988
1116
|
ne as setBase,
|
|
989
1117
|
De as setWith,
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1118
|
+
Ar as similarity,
|
|
1119
|
+
Mt as sleep,
|
|
1120
|
+
Er as snakeCase,
|
|
1121
|
+
Ot as sortBy,
|
|
1122
|
+
Sr as startCase,
|
|
1123
|
+
br as stringSingleline,
|
|
1124
|
+
Or as stringTemplate,
|
|
997
1125
|
Y as stringTime,
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1126
|
+
R as stringToArrayBuffer,
|
|
1127
|
+
Vt as throttle,
|
|
1128
|
+
Qt as toInt,
|
|
1129
|
+
sr as toPlainObject,
|
|
1130
|
+
Q as traverseObjectKeys,
|
|
1131
|
+
Jt as tryToNumber,
|
|
1132
|
+
_t as uint8ArrayToString,
|
|
1133
|
+
Tr as uncapitalize,
|
|
1134
|
+
Ye as uncapitalizeFirst,
|
|
1135
|
+
Tt as unionBy,
|
|
1136
|
+
zt as unixTimestamp,
|
|
1137
|
+
Cr as urlJoin,
|
|
1138
|
+
cr as zipObject
|
|
1011
1139
|
};
|