@aiao/utils 0.0.5 → 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/{AsyncTaskExecutor.d.ts → AsyncQueueExecutor.d.ts} +15 -10
- package/dist/async/AsyncQueueExecutor.d.ts.map +1 -0
- package/dist/async/index.d.ts +1 -1
- package/dist/async/index.d.ts.map +1 -1
- package/dist/index.js +412 -383
- 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/async/AsyncTaskExecutor.d.ts.map +0 -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,10 +67,10 @@ const L = 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
|
|
73
|
+
#r = new G(!1);
|
|
49
74
|
idle$ = this.#r.asObservable().pipe(V());
|
|
50
75
|
constructor(t) {
|
|
51
76
|
this.#e = t?.timeout || this.#e;
|
|
@@ -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(V(),
|
|
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,13 +128,13 @@ 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
140
|
function Z(e) {
|
|
@@ -114,86 +146,84 @@ 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
152
|
if (Z(e)) return isNaN(e.getTime());
|
|
121
|
-
if (d(e) ||
|
|
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
|
-
const
|
|
131
|
-
function
|
|
132
|
-
return
|
|
162
|
+
const H = (e) => e == null;
|
|
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
|
-
function
|
|
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
|
-
class
|
|
200
|
+
}, Tt = (e, t) => e.filter(/* @__PURE__ */ ((r) => (n) => r.has(t(n)) ? !1 : r.add(t(n)))(/* @__PURE__ */ new Set()));
|
|
201
|
+
class Ct {
|
|
170
202
|
maxConcurrent;
|
|
171
203
|
running = 0;
|
|
172
204
|
queue = [];
|
|
205
|
+
queue_map = /* @__PURE__ */ new Map();
|
|
173
206
|
constructor(t = 3) {
|
|
174
207
|
this.maxConcurrent = t || 1;
|
|
175
208
|
}
|
|
176
209
|
/**
|
|
177
210
|
* 添加任务到执行器
|
|
178
211
|
* @param task - 返回 Promise 的异步任务函数
|
|
212
|
+
* @param id - 任务唯一标识符(可选),用于去重相同任务
|
|
179
213
|
* @returns 返回任务执行结果的 Promise
|
|
180
214
|
*/
|
|
181
|
-
addTask(t) {
|
|
182
|
-
|
|
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) => {
|
|
183
219
|
this.queue.push({
|
|
184
220
|
task: t,
|
|
185
|
-
resolve:
|
|
186
|
-
reject:
|
|
187
|
-
|
|
221
|
+
resolve: o,
|
|
222
|
+
reject: c,
|
|
223
|
+
id: r
|
|
224
|
+
}), this._run_next();
|
|
188
225
|
});
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* 批量添加多个任务
|
|
192
|
-
* @param tasks - 任务数组
|
|
193
|
-
* @returns 返回所有任务结果的 Promise 数组
|
|
194
|
-
*/
|
|
195
|
-
addTasks(t) {
|
|
196
|
-
return Promise.all(t.map((r) => this.addTask(r)));
|
|
226
|
+
return r !== void 0 && this.queue_map.set(r, n), n;
|
|
197
227
|
}
|
|
198
228
|
/**
|
|
199
229
|
* 获取当前状态
|
|
@@ -212,7 +242,7 @@ class St {
|
|
|
212
242
|
*/
|
|
213
243
|
setMaxConcurrent(t) {
|
|
214
244
|
for (t = t || 1, this.maxConcurrent = t; this.running < this.maxConcurrent && this.queue.length > 0; )
|
|
215
|
-
this.
|
|
245
|
+
this._run_next();
|
|
216
246
|
}
|
|
217
247
|
/**
|
|
218
248
|
* 清空队列(不影响正在执行的任务)
|
|
@@ -220,7 +250,7 @@ class St {
|
|
|
220
250
|
clearQueue() {
|
|
221
251
|
this.queue.forEach(({ reject: t }) => {
|
|
222
252
|
t(new Error("Task cancelled: queue cleared"));
|
|
223
|
-
}), this.queue = [];
|
|
253
|
+
}), this.queue = [], this.queue_map.clear();
|
|
224
254
|
}
|
|
225
255
|
/**
|
|
226
256
|
* 等待所有任务完成
|
|
@@ -249,31 +279,31 @@ class St {
|
|
|
249
279
|
/**
|
|
250
280
|
* 执行队列中的下一个任务
|
|
251
281
|
*/
|
|
252
|
-
|
|
282
|
+
_run_next() {
|
|
253
283
|
if (this.running >= this.maxConcurrent || this.queue.length === 0) return;
|
|
254
284
|
const t = this.queue.shift();
|
|
255
285
|
if (!t) return;
|
|
256
|
-
const { task: r, resolve: n, reject: o } = t;
|
|
257
|
-
this.running++, Promise.resolve().then(() => r()).then((
|
|
258
|
-
n(
|
|
259
|
-
}).catch((
|
|
260
|
-
o(
|
|
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);
|
|
261
291
|
}).finally(() => {
|
|
262
|
-
this.running--, this.
|
|
292
|
+
this.running--, c !== void 0 && this.queue_map.delete(c), this._run_next();
|
|
263
293
|
});
|
|
264
294
|
}
|
|
265
295
|
}
|
|
266
|
-
const
|
|
267
|
-
function
|
|
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) {
|
|
268
298
|
for (const r in e)
|
|
269
|
-
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));
|
|
270
300
|
}
|
|
271
|
-
const
|
|
272
|
-
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);
|
|
273
303
|
}, C = (e) => new Uint8Array(
|
|
274
304
|
atob(e).split("").map((t) => t.charCodeAt(0))
|
|
275
305
|
);
|
|
276
|
-
async function
|
|
306
|
+
async function Rt(e, t, r) {
|
|
277
307
|
const n = await crypto.subtle.importKey(
|
|
278
308
|
"raw",
|
|
279
309
|
C(t),
|
|
@@ -293,19 +323,19 @@ async function Mt(e, t, r) {
|
|
|
293
323
|
);
|
|
294
324
|
return new TextDecoder().decode(c);
|
|
295
325
|
}
|
|
296
|
-
const
|
|
297
|
-
if (
|
|
326
|
+
const S = (e) => {
|
|
327
|
+
if (O(e))
|
|
298
328
|
return btoa(e);
|
|
299
|
-
if (
|
|
329
|
+
if ($(e) || Array.isArray(e))
|
|
300
330
|
return btoa(String.fromCharCode(...e));
|
|
301
|
-
if (
|
|
331
|
+
if (ge(e)) {
|
|
302
332
|
const t = new Uint8Array(e);
|
|
303
333
|
return btoa(String.fromCharCode(...t));
|
|
304
334
|
}
|
|
305
335
|
throw new TypeError(`Unsupported type for base64 encoding: ${typeof e}`);
|
|
306
|
-
}, { subtle:
|
|
307
|
-
async function
|
|
308
|
-
return await
|
|
336
|
+
}, { subtle: Oe } = globalThis.crypto;
|
|
337
|
+
async function Te() {
|
|
338
|
+
return await Oe.generateKey(
|
|
309
339
|
{
|
|
310
340
|
name: "AES-GCM",
|
|
311
341
|
length: 256
|
|
@@ -314,12 +344,12 @@ async function Se() {
|
|
|
314
344
|
["encrypt", "decrypt"]
|
|
315
345
|
);
|
|
316
346
|
}
|
|
317
|
-
async function
|
|
347
|
+
async function Ce(e) {
|
|
318
348
|
const t = await crypto.subtle.exportKey("raw", e);
|
|
319
|
-
return
|
|
349
|
+
return S(t);
|
|
320
350
|
}
|
|
321
|
-
async function
|
|
322
|
-
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(
|
|
323
353
|
{
|
|
324
354
|
name: "AES-GCM",
|
|
325
355
|
iv: n
|
|
@@ -328,25 +358,25 @@ async function $t(e) {
|
|
|
328
358
|
t.encode(e)
|
|
329
359
|
);
|
|
330
360
|
return {
|
|
331
|
-
key: await
|
|
332
|
-
iv:
|
|
333
|
-
cipherText:
|
|
361
|
+
key: await Ce(r),
|
|
362
|
+
iv: S(n),
|
|
363
|
+
cipherText: S(o)
|
|
334
364
|
};
|
|
335
365
|
}
|
|
336
|
-
const
|
|
366
|
+
const Pe = (e) => atob(e.replace(/[-]/g, "+").replace(/[_]/g, "/")), Bt = (e) => {
|
|
337
367
|
const t = e.split(".");
|
|
338
368
|
if (t.length !== 3) throw new Error("JWT is not valid: not a JWT structure");
|
|
339
369
|
const r = t[1];
|
|
340
|
-
return JSON.parse(
|
|
370
|
+
return JSON.parse(Pe(r));
|
|
341
371
|
};
|
|
342
|
-
function
|
|
372
|
+
function R(e) {
|
|
343
373
|
const t = new ArrayBuffer(e.length), r = new Uint8Array(t);
|
|
344
374
|
for (let n = 0, o = e.length; n < o; n++)
|
|
345
375
|
r[n] = e.charCodeAt(n);
|
|
346
376
|
return t;
|
|
347
377
|
}
|
|
348
|
-
function
|
|
349
|
-
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);
|
|
350
380
|
return crypto.subtle.importKey(
|
|
351
381
|
"pkcs8",
|
|
352
382
|
n,
|
|
@@ -358,8 +388,8 @@ function Ce(e) {
|
|
|
358
388
|
["decrypt"]
|
|
359
389
|
);
|
|
360
390
|
}
|
|
361
|
-
async function
|
|
362
|
-
const r = await
|
|
391
|
+
async function It(e, t) {
|
|
392
|
+
const r = await $e(t), n = await crypto.subtle.decrypt(
|
|
363
393
|
{
|
|
364
394
|
name: "RSA-OAEP"
|
|
365
395
|
},
|
|
@@ -368,8 +398,8 @@ async function Nt(e, t) {
|
|
|
368
398
|
);
|
|
369
399
|
return new TextDecoder().decode(n);
|
|
370
400
|
}
|
|
371
|
-
function
|
|
372
|
-
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n =
|
|
401
|
+
function Me(e) {
|
|
402
|
+
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n = R(r);
|
|
373
403
|
return crypto.subtle.importKey(
|
|
374
404
|
"spki",
|
|
375
405
|
n,
|
|
@@ -381,22 +411,22 @@ function Pe(e) {
|
|
|
381
411
|
["encrypt"]
|
|
382
412
|
);
|
|
383
413
|
}
|
|
384
|
-
async function
|
|
385
|
-
const r = await
|
|
414
|
+
async function Lt(e, t) {
|
|
415
|
+
const r = await Me(t), n = await crypto.subtle.encrypt(
|
|
386
416
|
{
|
|
387
417
|
name: "RSA-OAEP"
|
|
388
418
|
},
|
|
389
419
|
r,
|
|
390
|
-
|
|
420
|
+
R(e)
|
|
391
421
|
);
|
|
392
|
-
return
|
|
422
|
+
return S(n);
|
|
393
423
|
}
|
|
394
|
-
const
|
|
424
|
+
const j = "PUBLIC KEY", N = "RAS PRIVATE KEY";
|
|
395
425
|
async function D(e, t = "pkcs8") {
|
|
396
426
|
const r = await crypto.subtle.exportKey(t, e);
|
|
397
|
-
return
|
|
427
|
+
return S(r);
|
|
398
428
|
}
|
|
399
|
-
async function
|
|
429
|
+
async function jt(e = 1024) {
|
|
400
430
|
const { publicKey: t, privateKey: r } = await crypto.subtle.generateKey(
|
|
401
431
|
{
|
|
402
432
|
name: "RSA-OAEP",
|
|
@@ -410,15 +440,15 @@ async function Bt(e = 1024) {
|
|
|
410
440
|
["encrypt", "decrypt"]
|
|
411
441
|
), n = await D(t, "spki"), o = await D(r, "pkcs8");
|
|
412
442
|
return {
|
|
413
|
-
publicKey: `-----BEGIN ${
|
|
443
|
+
publicKey: `-----BEGIN ${j}-----
|
|
414
444
|
${n}
|
|
415
|
-
-----END ${
|
|
416
|
-
privateKey: `-----BEGIN ${
|
|
445
|
+
-----END ${j}-----`,
|
|
446
|
+
privateKey: `-----BEGIN ${N}-----
|
|
417
447
|
${o}
|
|
418
|
-
-----END ${
|
|
448
|
+
-----END ${N}-----`
|
|
419
449
|
};
|
|
420
450
|
}
|
|
421
|
-
const
|
|
451
|
+
const Nt = (e) => p(e) || Z(e) ? !0 : H(e) ? !1 : new Date(e).getTime() > 0, _e = (e) => {
|
|
422
452
|
const t = e > 0 ? "+" : "-", r = Math.abs(e), n = `${Math.floor(r / 60)}`.padStart(2, "0"), o = `${r % 60}`.padStart(2, "0");
|
|
423
453
|
return {
|
|
424
454
|
flag: t,
|
|
@@ -426,25 +456,25 @@ const Lt = (e) => p(e) || Z(e) ? !0 : Q(e) ? !1 : new Date(e).getTime() > 0, Me
|
|
|
426
456
|
hour: n,
|
|
427
457
|
minute: o
|
|
428
458
|
};
|
|
429
|
-
},
|
|
430
|
-
const { flag: n, hour: o, minute: c } =
|
|
459
|
+
}, Re = (e, t, r) => {
|
|
460
|
+
const { flag: n, hour: o, minute: c } = _e(r);
|
|
431
461
|
return `${e}T${t}${n}${o}:${c}`;
|
|
432
|
-
},
|
|
462
|
+
}, Dt = (e, t, r) => new Date(Re(e, t, r)), J = (e, t) => {
|
|
433
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;
|
|
434
464
|
return { year: c, month: o, day: n, hour: s, minute: i, second: a };
|
|
435
|
-
}, Y = (e, t, r) => r ? `${t} ${r[e] || e}` : `${t} ${e}`, X = ["year", "month", "day", "hour", "minute", "second"],
|
|
465
|
+
}, Y = (e, t, r) => r ? `${t} ${r[e] || e}` : `${t} ${e}`, X = ["year", "month", "day", "hour", "minute", "second"], Ut = (e, t, r) => {
|
|
436
466
|
const n = J(e, t), o = X.find((s) => n[s] > 0) || "second", c = n[o];
|
|
437
467
|
return d(r) ? r({ key: o, value: c }) : Y(o, c, r);
|
|
438
|
-
},
|
|
468
|
+
}, kt = (e, t, r) => {
|
|
439
469
|
const n = J(e, t);
|
|
440
470
|
return d(r) ? r(n) : X.filter((o) => o).map((o) => Y(o, n[o], r)).join(" ");
|
|
441
|
-
},
|
|
442
|
-
function
|
|
443
|
-
return p(e) ? !0 :
|
|
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) {
|
|
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(
|
|
444
474
|
e
|
|
445
475
|
)?.groups : !1;
|
|
446
476
|
}
|
|
447
|
-
const
|
|
477
|
+
const Ft = (e) => fe(e), zt = () => Math.floor(Date.now() / 1e3), Wt = (e, t = 50) => {
|
|
448
478
|
let r;
|
|
449
479
|
return function(...n) {
|
|
450
480
|
const o = () => {
|
|
@@ -452,9 +482,9 @@ const Ut = (e) => ue(e), Kt = () => Math.floor(Date.now() / 1e3), zt = (e, t = 5
|
|
|
452
482
|
};
|
|
453
483
|
r !== void 0 && clearTimeout(r), r = setTimeout(o, t);
|
|
454
484
|
};
|
|
455
|
-
},
|
|
485
|
+
}, vt = () => {
|
|
456
486
|
};
|
|
457
|
-
function
|
|
487
|
+
function Gt(e) {
|
|
458
488
|
let t = !1, r;
|
|
459
489
|
return function() {
|
|
460
490
|
if (t)
|
|
@@ -463,7 +493,7 @@ function qt(e) {
|
|
|
463
493
|
return t = !0, r = n, n;
|
|
464
494
|
};
|
|
465
495
|
}
|
|
466
|
-
const
|
|
496
|
+
const Vt = (e, t) => {
|
|
467
497
|
let r = 0;
|
|
468
498
|
return function(...n) {
|
|
469
499
|
const o = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -473,201 +503,198 @@ const Gt = (e, t) => {
|
|
|
473
503
|
function w(e, t, r) {
|
|
474
504
|
const n = r[0];
|
|
475
505
|
if (t != null && e >= t)
|
|
476
|
-
throw new Error(e
|
|
477
|
-
if (e.
|
|
506
|
+
throw new Error(`${e} >= ${t}`);
|
|
507
|
+
if (e.endsWith(n) || t && t.endsWith(n))
|
|
478
508
|
throw new Error("trailing zero");
|
|
479
509
|
if (t) {
|
|
480
510
|
let s = 0;
|
|
481
|
-
for (; (e[s]
|
|
511
|
+
for (; (e[s] ?? n) === t[s]; )
|
|
482
512
|
s++;
|
|
483
513
|
if (s > 0)
|
|
484
514
|
return t.slice(0, s) + w(e.slice(s), t.slice(s), r);
|
|
485
515
|
}
|
|
486
516
|
const o = e ? r.indexOf(e[0]) : 0, c = t != null ? r.indexOf(t[0]) : r.length;
|
|
487
517
|
if (c - o > 1) {
|
|
488
|
-
const s = Math.round(
|
|
518
|
+
const s = Math.round((o + c) / 2);
|
|
489
519
|
return r[s];
|
|
490
|
-
}
|
|
491
|
-
|
|
520
|
+
}
|
|
521
|
+
return t && t.length > 1 ? t[0] : r[o] + w(e.slice(1), null, r);
|
|
492
522
|
}
|
|
493
523
|
function te(e) {
|
|
494
|
-
|
|
495
|
-
throw new Error("invalid integer part of order key: " + e);
|
|
496
|
-
}
|
|
497
|
-
function re(e) {
|
|
524
|
+
const t = e.charCodeAt(0), r = 97, n = 90;
|
|
498
525
|
if (e >= "a" && e <= "z")
|
|
499
|
-
return
|
|
526
|
+
return t - r + 2;
|
|
500
527
|
if (e >= "A" && e <= "Z")
|
|
501
|
-
return
|
|
502
|
-
throw new Error(
|
|
528
|
+
return n - t + 2;
|
|
529
|
+
throw new Error(`invalid order key head: ${e}`);
|
|
503
530
|
}
|
|
504
531
|
function E(e) {
|
|
505
|
-
const t =
|
|
532
|
+
const t = te(e[0]);
|
|
506
533
|
if (t > e.length)
|
|
507
|
-
throw new Error(
|
|
534
|
+
throw new Error(`invalid order key: ${e}`);
|
|
508
535
|
return e.slice(0, t);
|
|
509
536
|
}
|
|
510
|
-
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) {
|
|
511
542
|
if (e === "A" + t[0].repeat(26))
|
|
512
|
-
throw new Error(
|
|
543
|
+
throw new Error(`invalid order key: ${e}`);
|
|
513
544
|
const r = E(e);
|
|
514
|
-
if (e.slice(r.length).
|
|
515
|
-
throw new Error(
|
|
545
|
+
if (e.slice(r.length).endsWith(t[0]))
|
|
546
|
+
throw new Error(`invalid order key: ${e}`);
|
|
516
547
|
}
|
|
517
|
-
function
|
|
518
|
-
|
|
519
|
-
const [
|
|
548
|
+
function k(e, t) {
|
|
549
|
+
re(e);
|
|
550
|
+
const r = e[0], n = e.slice(1).split("");
|
|
520
551
|
let o = !0;
|
|
521
552
|
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
522
553
|
const s = t.indexOf(n[c]) + 1;
|
|
523
554
|
s === t.length ? n[c] = t[0] : (n[c] = t[s], o = !1);
|
|
524
555
|
}
|
|
525
556
|
if (o) {
|
|
526
|
-
if (r === "Z")
|
|
527
|
-
|
|
528
|
-
if (r === "z")
|
|
529
|
-
return null;
|
|
557
|
+
if (r === "Z") return "a" + t[0];
|
|
558
|
+
if (r === "z") return null;
|
|
530
559
|
const c = String.fromCharCode(r.charCodeAt(0) + 1);
|
|
531
560
|
return c > "a" ? n.push(t[0]) : n.pop(), c + n.join("");
|
|
532
|
-
}
|
|
533
|
-
|
|
561
|
+
}
|
|
562
|
+
return r + n.join("");
|
|
534
563
|
}
|
|
535
564
|
function xe(e, t) {
|
|
536
|
-
|
|
537
|
-
const [
|
|
565
|
+
re(e);
|
|
566
|
+
const r = e[0], n = e.slice(1).split("");
|
|
538
567
|
let o = !0;
|
|
539
568
|
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
540
569
|
const s = t.indexOf(n[c]) - 1;
|
|
541
|
-
s === -1 ? n[c] = t.
|
|
570
|
+
s === -1 ? n[c] = t[t.length - 1] : (n[c] = t[s], o = !1);
|
|
542
571
|
}
|
|
543
572
|
if (o) {
|
|
544
|
-
if (r === "a")
|
|
545
|
-
|
|
546
|
-
if (r === "A")
|
|
547
|
-
return null;
|
|
573
|
+
if (r === "a") return "Z" + t[t.length - 1];
|
|
574
|
+
if (r === "A") return null;
|
|
548
575
|
const c = String.fromCharCode(r.charCodeAt(0) - 1);
|
|
549
|
-
return c < "Z" ? n.push(t.
|
|
550
|
-
}
|
|
551
|
-
|
|
576
|
+
return c < "Z" ? n.push(t[t.length - 1]) : n.pop(), c + n.join("");
|
|
577
|
+
}
|
|
578
|
+
return r + n.join("");
|
|
552
579
|
}
|
|
553
580
|
function g(e, t, r = ee) {
|
|
554
|
-
if (e != null &&
|
|
555
|
-
throw new Error(e
|
|
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];
|
|
556
585
|
if (e == null) {
|
|
557
|
-
|
|
558
|
-
return "a" + r[0];
|
|
559
|
-
const a = E(t), u = t.slice(a.length);
|
|
586
|
+
const a = E(t), l = t.slice(a.length);
|
|
560
587
|
if (a === "A" + r[0].repeat(26))
|
|
561
|
-
return a + w("",
|
|
588
|
+
return a + w("", l, r);
|
|
562
589
|
if (a < t)
|
|
563
590
|
return a;
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
591
|
+
const u = xe(a, r);
|
|
592
|
+
if (u == null)
|
|
566
593
|
throw new Error("cannot decrement any more");
|
|
567
|
-
return
|
|
594
|
+
return u;
|
|
568
595
|
}
|
|
569
596
|
if (t == null) {
|
|
570
|
-
const a = E(e),
|
|
571
|
-
return
|
|
597
|
+
const a = E(e), l = e.slice(a.length);
|
|
598
|
+
return k(a, r) ?? a + w(l, null, r);
|
|
572
599
|
}
|
|
573
600
|
const n = E(e), o = e.slice(n.length), c = E(t), s = t.slice(c.length);
|
|
574
601
|
if (n === c)
|
|
575
602
|
return n + w(o, s, r);
|
|
576
|
-
const i =
|
|
603
|
+
const i = k(n, r);
|
|
577
604
|
if (i == null)
|
|
578
605
|
throw new Error("cannot increment any more");
|
|
579
606
|
return i < t ? i : n + w(o, null, r);
|
|
580
607
|
}
|
|
581
608
|
function K(e, t, r, n = ee) {
|
|
582
|
-
if (r === 0)
|
|
583
|
-
|
|
584
|
-
if (r === 1)
|
|
585
|
-
return [g(e, t, n)];
|
|
609
|
+
if (r === 0) return [];
|
|
610
|
+
if (r === 1) return [g(e, t, n)];
|
|
586
611
|
if (t == null) {
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
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;
|
|
592
618
|
}
|
|
593
619
|
if (e == null) {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
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();
|
|
599
626
|
}
|
|
600
627
|
const o = Math.floor(r / 2), c = g(e, t, n);
|
|
601
628
|
return [...K(e, c, o, n), c, ...K(c, t, r - o - 1, n)];
|
|
602
629
|
}
|
|
603
|
-
const
|
|
630
|
+
const Be = (e) => {
|
|
604
631
|
if (e == null || e === "") return !1;
|
|
605
632
|
const t = parseFloat(e);
|
|
606
633
|
return !(isNaN(t) || !isFinite(t));
|
|
607
|
-
},
|
|
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) => {
|
|
608
635
|
const t = Number(e);
|
|
609
636
|
return t < 0 ? Math.ceil(t) : Math.floor(t);
|
|
610
|
-
},
|
|
611
|
-
if (
|
|
637
|
+
}, Jt = (e) => {
|
|
638
|
+
if (Be(e)) {
|
|
612
639
|
const t = Number(e);
|
|
613
640
|
return isNaN(t) || !isFinite(t) ? e : t;
|
|
614
641
|
}
|
|
615
642
|
return e;
|
|
616
|
-
},
|
|
643
|
+
}, Le = (e) => {
|
|
617
644
|
for (const r of Object.getOwnPropertyNames(e)) {
|
|
618
645
|
const n = e[r];
|
|
619
|
-
!
|
|
646
|
+
!_(n) && !d(n) || n === null || Le(n);
|
|
620
647
|
}
|
|
621
648
|
return Object.isFrozen(e) ? e : Object.freeze(e);
|
|
622
|
-
},
|
|
649
|
+
}, je = (e) => e.replace(/\[/g, ".").replace(/\]/g, "").split(".");
|
|
623
650
|
function ne(e, t, r, n) {
|
|
624
651
|
const o = d(n) ? n : void 0;
|
|
625
|
-
return
|
|
626
|
-
if (a ===
|
|
652
|
+
return je(t).reduce((s, i, a, l) => {
|
|
653
|
+
if (a === l.length - 1)
|
|
627
654
|
return s[i] = r, s;
|
|
628
655
|
if (i in s)
|
|
629
656
|
return s[i];
|
|
630
657
|
if (!i) return s;
|
|
631
658
|
if (o) {
|
|
632
|
-
const
|
|
633
|
-
if (
|
|
659
|
+
const u = o(s[i], i, s);
|
|
660
|
+
if (u) return s[i] = u;
|
|
634
661
|
}
|
|
635
|
-
return s[i] = /^[0-9]{1,}$/.test(
|
|
662
|
+
return s[i] = /^[0-9]{1,}$/.test(l[a + 1]) ? [] : {};
|
|
636
663
|
}, e), e;
|
|
637
664
|
}
|
|
638
|
-
function
|
|
665
|
+
function Ne(e, t, r) {
|
|
639
666
|
return ne(e, t, r);
|
|
640
667
|
}
|
|
641
|
-
function
|
|
668
|
+
function De(e, t, r, n) {
|
|
642
669
|
const o = d(n) ? n : void 0;
|
|
643
670
|
return ne(e, t, r, o);
|
|
644
671
|
}
|
|
645
|
-
const
|
|
672
|
+
const Yt = (e) => {
|
|
646
673
|
const t = {};
|
|
647
674
|
return Object.keys(e).forEach((r) => {
|
|
648
|
-
r.match(/[^\]]*\[\d+\]/) ?
|
|
675
|
+
r.match(/[^\]]*\[\d+\]/) ? Ne(t, r, e[r]) : De(t, r, e[r], Object);
|
|
649
676
|
}), t;
|
|
650
|
-
},
|
|
677
|
+
}, Ue = (e, t, r) => {
|
|
651
678
|
const n = (c) => String.prototype.split.call(t, c).filter(Boolean).reduce((s, i) => s != null ? s[i] : s, e), o = n(/[,[\]]+?/) || n(/[,[\].]+?/);
|
|
652
679
|
return o === void 0 || o === e ? r : o;
|
|
653
|
-
},
|
|
680
|
+
}, ke = (e, t) => {
|
|
654
681
|
const r = t.split(".");
|
|
655
|
-
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));
|
|
656
683
|
};
|
|
657
|
-
function
|
|
684
|
+
function Ke(e, t) {
|
|
658
685
|
return e.length !== t.length ? !1 : e.every((r, n) => r === t[n]);
|
|
659
686
|
}
|
|
660
|
-
const
|
|
687
|
+
const q = (e, t) => {
|
|
661
688
|
if (e === t || Object.is(e, t)) return !0;
|
|
662
689
|
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
663
690
|
if (e.constructor !== t.constructor) return !1;
|
|
664
691
|
let r, n;
|
|
665
692
|
if (Array.isArray(e)) {
|
|
666
693
|
if (r = e.length, r != t.length) return !1;
|
|
667
|
-
for (n = r; n-- !== 0; ) if (!
|
|
694
|
+
for (n = r; n-- !== 0; ) if (!q(e[n], t[n])) return !1;
|
|
668
695
|
return !0;
|
|
669
696
|
}
|
|
670
|
-
if (
|
|
697
|
+
if ($(e) && $(t)) return Ke(e, t);
|
|
671
698
|
if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
|
|
672
699
|
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
|
|
673
700
|
if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
|
|
@@ -676,90 +703,90 @@ const z = (e, t) => {
|
|
|
676
703
|
for (n = r; n-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(t, o[n])) return !1;
|
|
677
704
|
for (n = r; n-- !== 0; ) {
|
|
678
705
|
const c = o[n];
|
|
679
|
-
if (!
|
|
706
|
+
if (!q(e[c], t[c])) return !1;
|
|
680
707
|
}
|
|
681
708
|
return !0;
|
|
682
709
|
}
|
|
683
710
|
return e !== e && t !== t;
|
|
684
|
-
},
|
|
711
|
+
}, Xt = (e, t) => +e == +t, er = (e, t) => e ? !t || t.length === 0 ? e : t.reduce(
|
|
685
712
|
(r, n) => (delete r[n], r),
|
|
686
713
|
{ ...e }
|
|
687
714
|
) : {};
|
|
688
|
-
function
|
|
715
|
+
function tr(e, t) {
|
|
689
716
|
return Object.keys(e).filter((r) => !t(e[r], r)).reduce((r, n) => (r[n] = e[n], r), {});
|
|
690
717
|
}
|
|
691
|
-
function
|
|
718
|
+
function rr(e, t) {
|
|
692
719
|
return e ? t.reduce(
|
|
693
720
|
(r, n) => (Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]), r),
|
|
694
721
|
{}
|
|
695
722
|
) : {};
|
|
696
723
|
}
|
|
697
|
-
function
|
|
724
|
+
function nr(e, t) {
|
|
698
725
|
return Object.keys(e).filter((r) => t(e[r], r)).reduce((r, n) => (r[n] = e[n], r), {});
|
|
699
726
|
}
|
|
700
|
-
const
|
|
701
|
-
(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)
|
|
702
729
|
) : r[`${t}`] = e, r);
|
|
703
|
-
function
|
|
704
|
-
return
|
|
730
|
+
function or(e) {
|
|
731
|
+
return M(e);
|
|
705
732
|
}
|
|
706
|
-
const
|
|
733
|
+
const sr = (e) => {
|
|
707
734
|
const t = {};
|
|
708
735
|
for (const r in e)
|
|
709
736
|
Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
|
|
710
737
|
return t;
|
|
711
738
|
};
|
|
712
|
-
function
|
|
739
|
+
function cr(e, t) {
|
|
713
740
|
if (!e || !e.length)
|
|
714
741
|
return {};
|
|
715
|
-
const r = d(t) ? t :
|
|
742
|
+
const r = d(t) ? t : b(t) ? (n, o) => t[o] : () => t;
|
|
716
743
|
return e.reduce(
|
|
717
744
|
(n, o, c) => (n[o] = r(o, c), n),
|
|
718
745
|
{}
|
|
719
746
|
);
|
|
720
747
|
}
|
|
721
|
-
const
|
|
722
|
-
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) {
|
|
723
750
|
return Math.floor(Math.random() * (t - e + 1) + e);
|
|
724
751
|
}
|
|
725
|
-
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) => {
|
|
726
753
|
let r = "";
|
|
727
754
|
const n = crypto.getRandomValues(new Uint8Array(e |= 0)), o = t.length - 1;
|
|
728
755
|
for (; e--; ) r += t[n[e] & o];
|
|
729
756
|
return r;
|
|
730
|
-
}, Ge = (e = 16) => F(1, oe) + F(e - 1, se),
|
|
757
|
+
}, Ge = (e = 16) => F(1, oe) + F(e - 1, se), fr = (e = 16) => parseInt(Ge(e), 10), ie = (e) => {
|
|
731
758
|
if (!e) return "";
|
|
732
759
|
const t = e.toLowerCase();
|
|
733
|
-
return
|
|
734
|
-
},
|
|
735
|
-
function
|
|
736
|
-
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);
|
|
737
764
|
if (t.length === 0)
|
|
738
765
|
return "";
|
|
739
766
|
const [r, ...n] = t;
|
|
740
767
|
return `${r.toLowerCase()}${n.map((o) => ie(o)).join("")}`;
|
|
741
768
|
}
|
|
742
|
-
const
|
|
769
|
+
const pr = async (e, t = "deflate") => {
|
|
743
770
|
try {
|
|
744
771
|
const n = new TextEncoder().encode(e), o = new CompressionStream(t), s = o.writable.getWriter();
|
|
745
772
|
await s.write(n), await s.close();
|
|
746
|
-
const a = o.readable.getReader(),
|
|
747
|
-
let
|
|
773
|
+
const a = o.readable.getReader(), l = [];
|
|
774
|
+
let u = 0;
|
|
748
775
|
for (; ; ) {
|
|
749
776
|
const { done: m, value: P } = await a.read();
|
|
750
777
|
if (m) break;
|
|
751
|
-
|
|
778
|
+
l.push(P), u += P.length;
|
|
752
779
|
}
|
|
753
|
-
const f = new Uint8Array(
|
|
780
|
+
const f = new Uint8Array(u);
|
|
754
781
|
let A = 0;
|
|
755
|
-
for (const m of
|
|
782
|
+
for (const m of l)
|
|
756
783
|
f.set(m, A), A += m.length;
|
|
757
784
|
let y = btoa(String.fromCharCode(...f));
|
|
758
785
|
return y = y.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), y;
|
|
759
786
|
} catch (r) {
|
|
760
787
|
throw console.error("压缩过程中出错:", r), r;
|
|
761
788
|
}
|
|
762
|
-
},
|
|
789
|
+
}, dr = async (e, t = "deflate") => {
|
|
763
790
|
try {
|
|
764
791
|
let r = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
765
792
|
const n = (4 - r.length % 4) % 4;
|
|
@@ -769,10 +796,10 @@ const ur = async (e, t = "deflate") => {
|
|
|
769
796
|
c[h] = o.charCodeAt(h);
|
|
770
797
|
const s = new DecompressionStream(t), a = s.writable.getWriter();
|
|
771
798
|
await a.write(c), await a.close();
|
|
772
|
-
const
|
|
799
|
+
const u = s.readable.getReader(), f = [];
|
|
773
800
|
let A = 0;
|
|
774
801
|
for (; ; ) {
|
|
775
|
-
const { done: h, value: B } = await
|
|
802
|
+
const { done: h, value: B } = await u.read();
|
|
776
803
|
if (h) break;
|
|
777
804
|
f.push(B), A += B.length;
|
|
778
805
|
}
|
|
@@ -784,7 +811,7 @@ const ur = async (e, t = "deflate") => {
|
|
|
784
811
|
} catch (r) {
|
|
785
812
|
throw console.error("解压过程中出错:", r), r;
|
|
786
813
|
}
|
|
787
|
-
},
|
|
814
|
+
}, He = (e) => x(e).map((r) => r.toLowerCase()).join("-"), Qe = {
|
|
788
815
|
"〇": 0,
|
|
789
816
|
一: 1,
|
|
790
817
|
二: 2,
|
|
@@ -823,10 +850,10 @@ const ur = async (e, t = "deflate") => {
|
|
|
823
850
|
8: 8,
|
|
824
851
|
9: 9
|
|
825
852
|
};
|
|
826
|
-
function
|
|
853
|
+
function mr(e) {
|
|
827
854
|
let t = 0, r = 0, n = 0, o = !1;
|
|
828
855
|
for (const c of e.split("").reverse()) {
|
|
829
|
-
if (r =
|
|
856
|
+
if (r = Qe[c], r === void 0)
|
|
830
857
|
throw new Error(`无法解析的数字: ${c}`);
|
|
831
858
|
switch (r) {
|
|
832
859
|
case 10: {
|
|
@@ -849,7 +876,7 @@ function hr(e) {
|
|
|
849
876
|
}
|
|
850
877
|
return o && (t += r), t;
|
|
851
878
|
}
|
|
852
|
-
const
|
|
879
|
+
const yr = (e) => {
|
|
853
880
|
const t = {};
|
|
854
881
|
return new URLSearchParams(e).forEach((n, o) => {
|
|
855
882
|
if (Object.prototype.hasOwnProperty.call(t, o)) {
|
|
@@ -858,7 +885,7 @@ const pr = (e) => {
|
|
|
858
885
|
} else
|
|
859
886
|
t[o] = n;
|
|
860
887
|
}), t;
|
|
861
|
-
},
|
|
888
|
+
}, gr = (e) => {
|
|
862
889
|
const t = new URLSearchParams();
|
|
863
890
|
for (const r in e)
|
|
864
891
|
if (Object.prototype.hasOwnProperty.call(e, r)) {
|
|
@@ -866,43 +893,43 @@ const pr = (e) => {
|
|
|
866
893
|
Array.isArray(n) ? n.forEach((o) => t.append(r, `${o}`)) : t.set(r, `${n}`);
|
|
867
894
|
}
|
|
868
895
|
return t.sort(), t.toString();
|
|
869
|
-
},
|
|
896
|
+
}, Je = ["角", "分", "厘"], z = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], T = [
|
|
870
897
|
["元", "万", "亿", "兆", "京", "垓"],
|
|
871
898
|
["", "拾", "佰", "仟"]
|
|
872
|
-
],
|
|
899
|
+
], W = Math.pow(10, 22), wr = (e) => {
|
|
873
900
|
const t = e < 0 ? "欠" : "";
|
|
874
901
|
let r = Math.abs(e);
|
|
875
|
-
if (r >
|
|
876
|
-
throw new Error(`max value is ${
|
|
902
|
+
if (r > W)
|
|
903
|
+
throw new Error(`max value is ${W}`);
|
|
877
904
|
let n = "";
|
|
878
905
|
if (e > Math.floor(e)) {
|
|
879
906
|
const o = +("0." + `${r}`.split(".")[1]);
|
|
880
|
-
n =
|
|
881
|
-
(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(/零./, ""),
|
|
882
909
|
""
|
|
883
910
|
);
|
|
884
911
|
}
|
|
885
912
|
n = n || "整", r = Math.floor(r);
|
|
886
|
-
for (let o = 0; o <
|
|
913
|
+
for (let o = 0; o < T[0].length && r > 0; o++) {
|
|
887
914
|
let c = "";
|
|
888
|
-
for (let s = 0; s <
|
|
889
|
-
c =
|
|
890
|
-
n = c.replace(/(零.)*零$/g, "").replace(/^$/, "零") +
|
|
915
|
+
for (let s = 0; s < T[1].length && r > 0; s++)
|
|
916
|
+
c = z[r % 10] + T[1][s] + c, r = Math.floor(r / 10);
|
|
917
|
+
n = c.replace(/(零.)*零$/g, "").replace(/^$/, "零") + T[0][o] + n;
|
|
891
918
|
}
|
|
892
919
|
return `${t}${n.replace(/(零.)*零元/, "元").replace(/(零.)+/g, "零").replace(/^整$/, "零元整")}`;
|
|
893
920
|
};
|
|
894
|
-
function
|
|
921
|
+
function Ar(e, t) {
|
|
895
922
|
const r = e || "", n = t || "", o = Math.max(r.length, n.length);
|
|
896
|
-
return o === 0 ? 1 : (o -
|
|
923
|
+
return o === 0 ? 1 : (o - he(r, n)) / o;
|
|
897
924
|
}
|
|
898
|
-
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) => {
|
|
899
926
|
if (!e) return "";
|
|
900
927
|
const t = e.toLowerCase();
|
|
901
|
-
return
|
|
902
|
-
}, v = /^([^/:]+):\/*/,
|
|
928
|
+
return Ye(t);
|
|
929
|
+
}, v = /^([^/:]+):\/*/, Cr = (...e) => {
|
|
903
930
|
if (e = e.filter((s) => s !== ""), e.length === 0)
|
|
904
931
|
return "";
|
|
905
|
-
if (e.findIndex((s) => !(
|
|
932
|
+
if (e.findIndex((s) => !(O(s) || p(s))) >= 0)
|
|
906
933
|
throw new Error("paths must be a string or number");
|
|
907
934
|
let r = "";
|
|
908
935
|
const n = `${e[0]}`;
|
|
@@ -921,7 +948,7 @@ const gr = (e) => R(e).map((r) => r.toLowerCase()).join("_"), wr = (e) => Ve(e).
|
|
|
921
948
|
}
|
|
922
949
|
return c.replace(/\/(\?|&|#[^!])/g, "$1");
|
|
923
950
|
};
|
|
924
|
-
class
|
|
951
|
+
class Pr {
|
|
925
952
|
#e = /* @__PURE__ */ new Map();
|
|
926
953
|
/**
|
|
927
954
|
* 添加事件监听器
|
|
@@ -975,9 +1002,9 @@ class Tr {
|
|
|
975
1002
|
}
|
|
976
1003
|
}
|
|
977
1004
|
}
|
|
978
|
-
const
|
|
1005
|
+
const $r = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", Mr = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", _r = (e, ...t) => {
|
|
979
1006
|
const r = [];
|
|
980
|
-
|
|
1007
|
+
_(e) ? Object.keys(e).sort().forEach((o) => {
|
|
981
1008
|
const c = e[o];
|
|
982
1009
|
r.push([o, c]);
|
|
983
1010
|
}) : r.push([e]), t.length && t.forEach((o) => {
|
|
@@ -985,126 +1012,128 @@ const Or = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBAD
|
|
|
985
1012
|
}), (console?.table ?? console.log)(r);
|
|
986
1013
|
};
|
|
987
1014
|
export {
|
|
988
|
-
|
|
1015
|
+
Ct as AsyncQueueExecutor,
|
|
989
1016
|
ee as BASE_62_DIGITS,
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
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,
|
|
998
1025
|
C as base64Decode,
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1026
|
+
S as base64Encode,
|
|
1027
|
+
hr as camelCase,
|
|
1028
|
+
Nt as canBeDate,
|
|
1029
|
+
Be as canBeNumber,
|
|
1003
1030
|
ie as capitalize,
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
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,
|
|
1021
1049
|
g as generateKeyBetween,
|
|
1022
1050
|
K as generateKeysBetween,
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1051
|
+
Ue as get,
|
|
1052
|
+
ke as has,
|
|
1053
|
+
ut as intersection,
|
|
1054
|
+
b as isArray,
|
|
1055
|
+
ge as isArrayBuffer,
|
|
1056
|
+
ft as isBoolean,
|
|
1029
1057
|
Z as isDate,
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1058
|
+
ht as isEmpty,
|
|
1059
|
+
q as isEqual,
|
|
1060
|
+
Xt as isEqualDate,
|
|
1061
|
+
Ke as isEqualUint8Array,
|
|
1062
|
+
pt as isFloat,
|
|
1035
1063
|
d as isFunction,
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1064
|
+
Kt as isISODateString,
|
|
1065
|
+
Ae as isInt,
|
|
1066
|
+
dt as isIntArray,
|
|
1067
|
+
qt as isMSTime,
|
|
1068
|
+
H as isNil,
|
|
1041
1069
|
p as isNumber,
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
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,
|
|
1078
|
+
O as isString,
|
|
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,
|
|
1068
1097
|
J as parseTime,
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
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,
|
|
1079
1108
|
F as randomString,
|
|
1080
|
-
|
|
1109
|
+
fr as randomUintByLength,
|
|
1081
1110
|
Ge as randomUintString,
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1111
|
+
wr as rmbUppercase,
|
|
1112
|
+
It as rsaDecrypt,
|
|
1113
|
+
Lt as rsaEncrypt,
|
|
1114
|
+
jt as rsaGenerateKey,
|
|
1115
|
+
Ne as set,
|
|
1087
1116
|
ne as setBase,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1117
|
+
De as setWith,
|
|
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,
|
|
1096
1125
|
Y as stringTime,
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
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
|
|
1110
1139
|
};
|