@aiao/utils 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@browser/IdleTimer.d.ts +18 -0
- package/@browser/broadcast-channel-pool.d.ts +17 -0
- package/@browser/index.d.ts +4 -0
- package/@browser/leader-election.d.ts +7 -0
- package/@browser/perform-chunk.d.ts +9 -0
- package/README.md +1 -0
- package/array/chunk.d.ts +24 -0
- package/array/difference.d.ts +30 -0
- package/array/flatten.d.ts +24 -0
- package/array/flattenDeep.d.ts +25 -0
- package/array/index.d.ts +8 -0
- package/array/intersection.d.ts +29 -0
- package/array/needArray.d.ts +37 -0
- package/array/sortBy.d.ts +36 -0
- package/async/index.d.ts +2 -0
- package/async/next-tick.d.ts +28 -0
- package/async/sleep.d.ts +5 -0
- package/binary/index.d.ts +1 -0
- package/binary/uint8ArrayToString.d.ts +12 -0
- package/collection/index.d.ts +1 -0
- package/collection/traverseObjectKeys.d.ts +3 -0
- package/crypto/aesDecrypt.d.ts +8 -0
- package/crypto/aesEncrypt.d.ts +10 -0
- package/crypto/base64Decode.d.ts +6 -0
- package/crypto/base64Encode.d.ts +6 -0
- package/crypto/decodeJWTPayload.d.ts +6 -0
- package/crypto/index.d.ts +8 -0
- package/crypto/rsaDecrypt.d.ts +7 -0
- package/crypto/rsaEncrypt.d.ts +8 -0
- package/crypto/rsaGenerateKey.d.ts +5 -0
- package/date/canBeDate.d.ts +5 -0
- package/date/dateStringToDate.d.ts +7 -0
- package/date/dateStringWithTimezone.d.ts +11 -0
- package/date/formatCountdown.d.ts +12 -0
- package/date/formatPassTime.d.ts +10 -0
- package/date/index.d.ts +12 -0
- package/date/isISODateString.d.ts +6 -0
- package/date/isMSTime.d.ts +7 -0
- package/date/msTimeToMilliseconds.d.ts +12 -0
- package/date/parseTime.d.ts +9 -0
- package/date/stringTime.d.ts +3 -0
- package/date/unixTimestamp.d.ts +5 -0
- package/function/debounce.d.ts +2 -0
- package/function/emptyFunction.d.ts +4 -0
- package/function/index.d.ts +4 -0
- package/function/once.d.ts +27 -0
- package/function/throttle.d.ts +30 -0
- package/index.d.ts +18 -0
- package/index.js +955 -0
- package/indexing/fractional-indexing.d.ts +26 -0
- package/number/canBeNumber.d.ts +27 -0
- package/number/index.d.ts +6 -0
- package/number/numberStep.d.ts +19 -0
- package/number/numberStepScreenSize.d.ts +1 -0
- package/number/numberStrip.d.ts +21 -0
- package/number/toInt.d.ts +1 -0
- package/number/tryToNumber.d.ts +1 -0
- package/object/deepFreeze.d.ts +5 -0
- package/object/flattenPathObjectToPlainObject.d.ts +7 -0
- package/object/get.d.ts +23 -0
- package/object/getTag.d.ts +1 -0
- package/object/has.d.ts +20 -0
- package/object/index.d.ts +15 -0
- package/object/isEqual.d.ts +25 -0
- package/object/isEqualUint8Array.d.ts +1 -0
- package/object/omit.d.ts +24 -0
- package/object/omitBy.d.ts +7 -0
- package/object/pick.d.ts +24 -0
- package/object/pickBy.d.ts +1 -0
- package/object/plainObjectToFlattenPathObject.d.ts +8 -0
- package/object/set.d.ts +27 -0
- package/object/setWith.d.ts +12 -0
- package/object/toPlainObject.d.ts +1 -0
- package/object/zipObject.d.ts +9 -0
- package/package.json +20 -0
- package/platform/index.d.ts +1 -0
- package/platform/is-browser.d.ts +4 -0
- package/random/index.d.ts +6 -0
- package/random/randomArrayItem.d.ts +1 -0
- package/random/randomFloat.d.ts +1 -0
- package/random/randomInt.d.ts +7 -0
- package/random/randomString.d.ts +9 -0
- package/random/randomUintByLength.d.ts +1 -0
- package/random/randomUintString.d.ts +1 -0
- package/string/camelCase.d.ts +22 -0
- package/string/capitalize.d.ts +7 -0
- package/string/compressToBase64Url.d.ts +4 -0
- package/string/decompressFromBase64Url.d.ts +4 -0
- package/string/getWords.d.ts +1 -0
- package/string/index.d.ts +17 -0
- package/string/kebabCase.d.ts +9 -0
- package/string/parseChineseNumber.d.ts +1 -0
- package/string/queryParse.d.ts +1 -0
- package/string/queryStringify.d.ts +5 -0
- package/string/rmb.d.ts +6 -0
- package/string/similarity.d.ts +1 -0
- package/string/snakeCase.d.ts +10 -0
- package/string/startCase.d.ts +7 -0
- package/string/stringSingleline.d.ts +4 -0
- package/string/stringTemplate.d.ts +7 -0
- package/string/stringToArrayBuffer.d.ts +7 -0
- package/string/uncapitalize.d.ts +7 -0
- package/string/urlJoin.d.ts +1 -0
- package/tools/event.d.ts +18 -0
- package/tools/image.d.ts +2 -0
- package/tools/index.d.ts +3 -0
- package/tools/log.d.ts +4 -0
- package/type-definition/index.d.ts +1 -0
- package/type-definition/result-types.d.ts +11 -0
- package/types/AnyFunction.d.ts +20 -0
- package/types/DeepPartial.d.ts +48 -0
- package/types/index.d.ts +24 -0
- package/types/isArray.d.ts +19 -0
- package/types/isArrayBuffer.d.ts +23 -0
- package/types/isBoolean.d.ts +27 -0
- package/types/isDate.d.ts +25 -0
- package/types/isEmpty.d.ts +40 -0
- package/types/isFloat.d.ts +1 -0
- package/types/isFunction.d.ts +2 -0
- package/types/isInt.d.ts +1 -0
- package/types/isIntArray.d.ts +1 -0
- package/types/isNil.d.ts +20 -0
- package/types/isNumber.d.ts +29 -0
- package/types/isNumberArray.d.ts +1 -0
- package/types/isObject.d.ts +22 -0
- package/types/isObjectLike.d.ts +1 -0
- package/types/isPlainObject.d.ts +27 -0
- package/types/isPrimitive.d.ts +33 -0
- package/types/isPromise.d.ts +1 -0
- package/types/isRegExp.d.ts +23 -0
- package/types/isString.d.ts +22 -0
- package/types/isStringArray.d.ts +1 -0
- package/types/isSymbol.d.ts +1 -0
- package/types/isUint8Array.d.ts +25 -0
package/index.js
ADDED
|
@@ -0,0 +1,955 @@
|
|
|
1
|
+
import { Observable as ae, BehaviorSubject as Z, distinctUntilChanged as V, skip as le } from "rxjs";
|
|
2
|
+
import ue from "ms";
|
|
3
|
+
import { distance as fe } from "fastest-levenshtein";
|
|
4
|
+
class he {
|
|
5
|
+
#e = /* @__PURE__ */ new Map();
|
|
6
|
+
emit(t, r) {
|
|
7
|
+
const n = this.#e.get(t);
|
|
8
|
+
if (n?.channel)
|
|
9
|
+
n.channel.postMessage(r);
|
|
10
|
+
else
|
|
11
|
+
throw new Error("broadcast-channel not found");
|
|
12
|
+
}
|
|
13
|
+
on(t) {
|
|
14
|
+
if (!this.#e.has(t)) {
|
|
15
|
+
const r = new ae((n) => {
|
|
16
|
+
const o = this.#e.get(t);
|
|
17
|
+
o.observerCount++, o.observer = n;
|
|
18
|
+
const c = (i) => n.next(i.data), s = new BroadcastChannel(t);
|
|
19
|
+
return s.addEventListener("message", c), o.channel = s, () => {
|
|
20
|
+
o.observerCount--, o.observerCount <= 0 && (s.removeEventListener("message", c), this.#e.delete(t));
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
return this.#e.set(t, { observable: r, observerCount: 0 }), r;
|
|
24
|
+
}
|
|
25
|
+
return this.#e.get(t).observable;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const j = new he(), et = (e) => ({
|
|
29
|
+
message$: j.on(e),
|
|
30
|
+
emit: (n) => j.emit(e, n)
|
|
31
|
+
}), pe = [
|
|
32
|
+
"mousemove",
|
|
33
|
+
"keydown",
|
|
34
|
+
"wheel",
|
|
35
|
+
"DOMMouseScroll",
|
|
36
|
+
"mousewheel",
|
|
37
|
+
"mousedown",
|
|
38
|
+
"touchstart",
|
|
39
|
+
"touchmove",
|
|
40
|
+
"MSPointerDown",
|
|
41
|
+
"MSPointerMove",
|
|
42
|
+
"visibilitychange",
|
|
43
|
+
"focus"
|
|
44
|
+
];
|
|
45
|
+
class tt {
|
|
46
|
+
constructor(t) {
|
|
47
|
+
this.options = t, this.#e = t?.timeout || this.#e;
|
|
48
|
+
}
|
|
49
|
+
#e = 1e3 * 2;
|
|
50
|
+
#t;
|
|
51
|
+
#r = new Z(!1);
|
|
52
|
+
idle$ = this.#r.asObservable().pipe(V());
|
|
53
|
+
start() {
|
|
54
|
+
clearTimeout(this.#t), this.#o(), this.#n();
|
|
55
|
+
}
|
|
56
|
+
#n = () => {
|
|
57
|
+
this.#r.next(!1), clearTimeout(this.#t), this.#t = setTimeout(() => {
|
|
58
|
+
this.#r.next(!0);
|
|
59
|
+
}, this.#e);
|
|
60
|
+
};
|
|
61
|
+
#o() {
|
|
62
|
+
pe.forEach(
|
|
63
|
+
(t) => document.addEventListener(t, this.#n, {
|
|
64
|
+
capture: !0,
|
|
65
|
+
passive: !0
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
class rt {
|
|
71
|
+
constructor(t) {
|
|
72
|
+
this.name = t, window.addEventListener("beforeunload", () => this.#n && this.#n(!0));
|
|
73
|
+
}
|
|
74
|
+
#e = new Z(!1);
|
|
75
|
+
#t = this.#e.asObservable().pipe(V(), le(1));
|
|
76
|
+
#r;
|
|
77
|
+
#n;
|
|
78
|
+
get isLeader() {
|
|
79
|
+
return this.#e.value;
|
|
80
|
+
}
|
|
81
|
+
leadership() {
|
|
82
|
+
return this.#r || (this.#r = navigator.locks.request(this.name, async () => (this.#e.next(!0), new Promise((t) => {
|
|
83
|
+
this.#n = t;
|
|
84
|
+
})))), this.#t;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function nt(e, t) {
|
|
88
|
+
if (e.length === 0) return;
|
|
89
|
+
let r = 0;
|
|
90
|
+
function n() {
|
|
91
|
+
r >= e.length || requestIdleCallback((o) => {
|
|
92
|
+
for (; o.timeRemaining() > 0 && r < e.length; )
|
|
93
|
+
t(e[r], r), r++;
|
|
94
|
+
n();
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
n();
|
|
98
|
+
}
|
|
99
|
+
const ot = (e, t) => e.reduce(
|
|
100
|
+
(r, n, o) => o % t === 0 ? [...r, [n]] : [...r.slice(0, -1), [...r.slice(-1)[0], n]],
|
|
101
|
+
[]
|
|
102
|
+
), st = (e, t) => e.filter((r) => !t.includes(r)), ct = (e) => Array.prototype.concat([], ...e), de = (e) => e.flatMap((t) => Array.isArray(t) ? de(t) : t), it = (...e) => e.reduce((t, r) => t.filter((n) => r.includes(n))), b = Array.isArray, me = (e) => e instanceof ArrayBuffer;
|
|
103
|
+
function at(e) {
|
|
104
|
+
return e === !0 || e === !1 || e != null && typeof e.valueOf() == "boolean";
|
|
105
|
+
}
|
|
106
|
+
function q(e) {
|
|
107
|
+
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
|
|
108
|
+
}
|
|
109
|
+
const p = (e) => !!(e && e.constructor && e.call && e.apply), h = (e) => {
|
|
110
|
+
try {
|
|
111
|
+
return Number(e) === e;
|
|
112
|
+
} catch {
|
|
113
|
+
return !1;
|
|
114
|
+
}
|
|
115
|
+
}, ye = (e) => e && e.constructor === Symbol, lt = (e) => {
|
|
116
|
+
if (e === !0 || e === !1 || e === null || e === void 0) return !0;
|
|
117
|
+
if (h(e)) return e === 0;
|
|
118
|
+
if (q(e)) return isNaN(e.getTime());
|
|
119
|
+
if (p(e) || ye(e)) return !1;
|
|
120
|
+
const t = e.length;
|
|
121
|
+
if (h(t)) return t === 0;
|
|
122
|
+
const r = e.size;
|
|
123
|
+
return h(r) ? r === 0 : Object.keys(e).length === 0;
|
|
124
|
+
}, ut = (e) => h(e) && e % 1 !== 0, we = (e) => Number.isInteger(e);
|
|
125
|
+
function ft(e) {
|
|
126
|
+
return b(e) && e.every(we);
|
|
127
|
+
}
|
|
128
|
+
const H = (e) => e == null;
|
|
129
|
+
function ht(e) {
|
|
130
|
+
return b(e) && e.every(h);
|
|
131
|
+
}
|
|
132
|
+
const R = (e) => !!e && e.constructor === Object, pt = (e) => typeof e == "object" && e !== null;
|
|
133
|
+
function ge(e) {
|
|
134
|
+
if (Object.prototype.toString.call(e) !== "[object Object]")
|
|
135
|
+
return !1;
|
|
136
|
+
const t = Object.getPrototypeOf(e);
|
|
137
|
+
return t === null || t === Object.prototype;
|
|
138
|
+
}
|
|
139
|
+
function dt(e) {
|
|
140
|
+
return e == null || typeof e != "object" && typeof e != "function";
|
|
141
|
+
}
|
|
142
|
+
const mt = (e) => !(!e || !e.then || !p(e.then));
|
|
143
|
+
function yt(e) {
|
|
144
|
+
return e instanceof RegExp;
|
|
145
|
+
}
|
|
146
|
+
function O(e) {
|
|
147
|
+
return typeof e == "string";
|
|
148
|
+
}
|
|
149
|
+
const wt = (e) => b(e) ? e.every(O) : !1, M = (e) => e instanceof Uint8Array, gt = (e) => Array.isArray(e) ? e : H(e) ? [] : [e], At = (e) => (t, r) => t[e] > r[e] ? 1 : r[e] > t[e] ? -1 : 0, B = /* @__PURE__ */ Promise.resolve(), Et = (e) => e ? B.then(e) : B, St = (e) => new Promise((t) => setTimeout(t, e)), Ae = new TextDecoder(), bt = (e) => Ae.decode(e);
|
|
150
|
+
function Ee(e, t) {
|
|
151
|
+
for (const r in e)
|
|
152
|
+
Object.prototype.hasOwnProperty.call(e, r) && (t(r, e[r], e), J(e[r], t));
|
|
153
|
+
}
|
|
154
|
+
const J = (e, t) => {
|
|
155
|
+
Array.isArray(e) ? e.forEach((r) => J(r, t)) : R(e) && Ee(e, t);
|
|
156
|
+
}, C = (e) => new Uint8Array(
|
|
157
|
+
atob(e).split("").map((t) => t.charCodeAt(0))
|
|
158
|
+
);
|
|
159
|
+
async function Ot(e, t, r) {
|
|
160
|
+
const n = await crypto.subtle.importKey(
|
|
161
|
+
"raw",
|
|
162
|
+
C(t),
|
|
163
|
+
{
|
|
164
|
+
name: "AES-GCM",
|
|
165
|
+
length: 256
|
|
166
|
+
},
|
|
167
|
+
!0,
|
|
168
|
+
["decrypt"]
|
|
169
|
+
), o = C(r), c = await crypto.subtle.decrypt(
|
|
170
|
+
{
|
|
171
|
+
name: "AES-GCM",
|
|
172
|
+
iv: o
|
|
173
|
+
},
|
|
174
|
+
n,
|
|
175
|
+
C(e)
|
|
176
|
+
);
|
|
177
|
+
return new TextDecoder().decode(c);
|
|
178
|
+
}
|
|
179
|
+
const S = (e) => {
|
|
180
|
+
if (O(e))
|
|
181
|
+
return btoa(e);
|
|
182
|
+
if (M(e))
|
|
183
|
+
return btoa(String.fromCharCode.apply(null, e));
|
|
184
|
+
if (me(e)) {
|
|
185
|
+
const t = new Uint8Array(e);
|
|
186
|
+
return btoa(String.fromCharCode.apply(null, t));
|
|
187
|
+
}
|
|
188
|
+
return btoa(String.fromCharCode.apply(null, e));
|
|
189
|
+
}, { subtle: Se } = globalThis.crypto;
|
|
190
|
+
async function be() {
|
|
191
|
+
return await Se.generateKey(
|
|
192
|
+
{
|
|
193
|
+
name: "AES-GCM",
|
|
194
|
+
length: 256
|
|
195
|
+
},
|
|
196
|
+
!0,
|
|
197
|
+
["encrypt", "decrypt"]
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
async function Oe(e) {
|
|
201
|
+
const t = await crypto.subtle.exportKey("raw", e);
|
|
202
|
+
return S(t);
|
|
203
|
+
}
|
|
204
|
+
async function Tt(e) {
|
|
205
|
+
const t = new TextEncoder(), r = await be(), n = crypto.getRandomValues(new Uint8Array(16)), o = await crypto.subtle.encrypt(
|
|
206
|
+
{
|
|
207
|
+
name: "AES-GCM",
|
|
208
|
+
iv: n
|
|
209
|
+
},
|
|
210
|
+
r,
|
|
211
|
+
t.encode(e)
|
|
212
|
+
);
|
|
213
|
+
return {
|
|
214
|
+
key: await Oe(r),
|
|
215
|
+
iv: S(n),
|
|
216
|
+
cipherText: S(o)
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
const Te = (e) => atob(e.replace(/[-]/g, "+").replace(/[_]/g, "/")), Ct = (e) => {
|
|
220
|
+
const t = e.split(".");
|
|
221
|
+
if (t.length !== 3) throw new Error("JWT is not valid: not a JWT structure");
|
|
222
|
+
const r = t[1];
|
|
223
|
+
return JSON.parse(Te(r));
|
|
224
|
+
};
|
|
225
|
+
function N(e) {
|
|
226
|
+
const t = new ArrayBuffer(e.length), r = new Uint8Array(t);
|
|
227
|
+
for (let n = 0, o = e.length; n < o; n++)
|
|
228
|
+
r[n] = e.charCodeAt(n);
|
|
229
|
+
return t;
|
|
230
|
+
}
|
|
231
|
+
function Ce(e) {
|
|
232
|
+
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n = N(r);
|
|
233
|
+
return crypto.subtle.importKey(
|
|
234
|
+
"pkcs8",
|
|
235
|
+
n,
|
|
236
|
+
{
|
|
237
|
+
name: "RSA-OAEP",
|
|
238
|
+
hash: "SHA-256"
|
|
239
|
+
},
|
|
240
|
+
!0,
|
|
241
|
+
["decrypt"]
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
async function Pt(e, t) {
|
|
245
|
+
const r = await Ce(t), n = await crypto.subtle.decrypt(
|
|
246
|
+
{
|
|
247
|
+
name: "RSA-OAEP"
|
|
248
|
+
},
|
|
249
|
+
r,
|
|
250
|
+
C(e)
|
|
251
|
+
);
|
|
252
|
+
return new TextDecoder().decode(n);
|
|
253
|
+
}
|
|
254
|
+
function Pe(e) {
|
|
255
|
+
const t = e.replace(/-----.*-----/g, "").trim(), r = atob(t), n = N(r);
|
|
256
|
+
return crypto.subtle.importKey(
|
|
257
|
+
"spki",
|
|
258
|
+
n,
|
|
259
|
+
{
|
|
260
|
+
name: "RSA-OAEP",
|
|
261
|
+
hash: "SHA-256"
|
|
262
|
+
},
|
|
263
|
+
!0,
|
|
264
|
+
["encrypt"]
|
|
265
|
+
);
|
|
266
|
+
}
|
|
267
|
+
async function Mt(e, t) {
|
|
268
|
+
const r = await Pe(t), n = await crypto.subtle.encrypt(
|
|
269
|
+
{
|
|
270
|
+
name: "RSA-OAEP"
|
|
271
|
+
},
|
|
272
|
+
r,
|
|
273
|
+
N(e)
|
|
274
|
+
);
|
|
275
|
+
return S(n);
|
|
276
|
+
}
|
|
277
|
+
const D = "PUBLIC KEY", x = "RAS PRIVATE KEY";
|
|
278
|
+
async function _(e, t = "pkcs8") {
|
|
279
|
+
const r = await crypto.subtle.exportKey(t, e);
|
|
280
|
+
return S(r);
|
|
281
|
+
}
|
|
282
|
+
async function $t(e = 1024) {
|
|
283
|
+
const { publicKey: t, privateKey: r } = await crypto.subtle.generateKey(
|
|
284
|
+
{
|
|
285
|
+
name: "RSA-OAEP",
|
|
286
|
+
modulusLength: e,
|
|
287
|
+
//can be 1024, 2048, or 4096
|
|
288
|
+
publicExponent: new Uint8Array([1, 0, 1]),
|
|
289
|
+
hash: { name: "SHA-512" }
|
|
290
|
+
//can be "SHA-1", "SHA-256", "SHA-384", or "SHA-512"
|
|
291
|
+
},
|
|
292
|
+
!0,
|
|
293
|
+
["encrypt", "decrypt"]
|
|
294
|
+
), n = await _(t, "spki"), o = await _(r, "pkcs8");
|
|
295
|
+
return {
|
|
296
|
+
publicKey: `-----BEGIN ${D}-----
|
|
297
|
+
${n}
|
|
298
|
+
-----END ${D}-----`,
|
|
299
|
+
privateKey: `-----BEGIN ${x}-----
|
|
300
|
+
${o}
|
|
301
|
+
-----END ${x}-----`
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
const Rt = (e) => h(e) || q(e) ? !0 : H(e) ? !1 : new Date(e).getTime() > 0, Me = (e) => {
|
|
305
|
+
const t = e > 0 ? "+" : "-", r = Math.abs(e), n = `${Math.floor(r / 60)}`.padStart(2, "0"), o = `${r % 60}`.padStart(2, "0");
|
|
306
|
+
return {
|
|
307
|
+
flag: t,
|
|
308
|
+
absOffset: r,
|
|
309
|
+
hour: n,
|
|
310
|
+
minute: o
|
|
311
|
+
};
|
|
312
|
+
}, $e = (e, t, r) => {
|
|
313
|
+
const { flag: n, hour: o, minute: c } = Me(r);
|
|
314
|
+
return `${e}T${t}${n}${o}:${c}`;
|
|
315
|
+
}, Nt = (e, t, r) => new Date($e(e, t, r)), Q = (e, t) => {
|
|
316
|
+
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;
|
|
317
|
+
return { year: c, month: o, day: n, hour: s, minute: i, second: a };
|
|
318
|
+
}, Y = (e, t, r) => r ? `${t} ${r[e] || e}` : `${t} ${e}`, X = ["year", "month", "day", "hour", "minute", "second"], Lt = (e, t, r) => {
|
|
319
|
+
const n = Q(e, t), o = X.find((s) => n[s] > 0) || "second", c = n[o];
|
|
320
|
+
return p(r) ? r({ key: o, value: c }) : Y(o, c, r);
|
|
321
|
+
}, It = (e, t, r) => {
|
|
322
|
+
const n = Q(e, t);
|
|
323
|
+
return p(r) ? r(n) : X.filter((o) => o).map((o) => Y(o, n[o], r)).join(" ");
|
|
324
|
+
}, jt = (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);
|
|
325
|
+
function Bt(e) {
|
|
326
|
+
return h(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(
|
|
327
|
+
e
|
|
328
|
+
)?.groups : !1;
|
|
329
|
+
}
|
|
330
|
+
function Dt(e) {
|
|
331
|
+
return ue(e);
|
|
332
|
+
}
|
|
333
|
+
const xt = () => Math.floor(Date.now() / 1e3), _t = (e, t = 50) => {
|
|
334
|
+
let r;
|
|
335
|
+
return function(...n) {
|
|
336
|
+
const o = () => {
|
|
337
|
+
r = void 0, e.apply(this, n);
|
|
338
|
+
};
|
|
339
|
+
r !== void 0 && clearTimeout(r), r = setTimeout(o, t);
|
|
340
|
+
};
|
|
341
|
+
}, Ut = () => {
|
|
342
|
+
};
|
|
343
|
+
function Kt(e) {
|
|
344
|
+
let t = !1, r;
|
|
345
|
+
return function() {
|
|
346
|
+
if (t)
|
|
347
|
+
return r;
|
|
348
|
+
const n = e();
|
|
349
|
+
return t = !0, r = n, n;
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
const kt = (e, t) => {
|
|
353
|
+
let r = 0;
|
|
354
|
+
return function(...n) {
|
|
355
|
+
const o = (/* @__PURE__ */ new Date()).getTime();
|
|
356
|
+
o - r >= t && (e.apply(this, n), r = o);
|
|
357
|
+
};
|
|
358
|
+
}, ee = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
359
|
+
function w(e, t, r) {
|
|
360
|
+
const n = r[0];
|
|
361
|
+
if (t != null && e >= t)
|
|
362
|
+
throw new Error(e + " >= " + t);
|
|
363
|
+
if (e.slice(-1) === n || t && t.slice(-1) === n)
|
|
364
|
+
throw new Error("trailing zero");
|
|
365
|
+
if (t) {
|
|
366
|
+
let s = 0;
|
|
367
|
+
for (; (e[s] || n) === t[s]; )
|
|
368
|
+
s++;
|
|
369
|
+
if (s > 0)
|
|
370
|
+
return t.slice(0, s) + w(e.slice(s), t.slice(s), r);
|
|
371
|
+
}
|
|
372
|
+
const o = e ? r.indexOf(e[0]) : 0, c = t != null ? r.indexOf(t[0]) : r.length;
|
|
373
|
+
if (c - o > 1) {
|
|
374
|
+
const s = Math.round(0.5 * (o + c));
|
|
375
|
+
return r[s];
|
|
376
|
+
} else
|
|
377
|
+
return t && t.length > 1 ? t.slice(0, 1) : r[o] + w(e.slice(1), null, r);
|
|
378
|
+
}
|
|
379
|
+
function te(e) {
|
|
380
|
+
if (e.length !== re(e[0]))
|
|
381
|
+
throw new Error("invalid integer part of order key: " + e);
|
|
382
|
+
}
|
|
383
|
+
function re(e) {
|
|
384
|
+
if (e >= "a" && e <= "z")
|
|
385
|
+
return e.charCodeAt(0) - 97 + 2;
|
|
386
|
+
if (e >= "A" && e <= "Z")
|
|
387
|
+
return 90 - e.charCodeAt(0) + 2;
|
|
388
|
+
throw new Error("invalid order key head: " + e);
|
|
389
|
+
}
|
|
390
|
+
function E(e) {
|
|
391
|
+
const t = re(e[0]);
|
|
392
|
+
if (t > e.length)
|
|
393
|
+
throw new Error("invalid order key: " + e);
|
|
394
|
+
return e.slice(0, t);
|
|
395
|
+
}
|
|
396
|
+
function U(e, t) {
|
|
397
|
+
if (e === "A" + t[0].repeat(26))
|
|
398
|
+
throw new Error("invalid order key: " + e);
|
|
399
|
+
const r = E(e);
|
|
400
|
+
if (e.slice(r.length).slice(-1) === t[0])
|
|
401
|
+
throw new Error("invalid order key: " + e);
|
|
402
|
+
}
|
|
403
|
+
function K(e, t) {
|
|
404
|
+
te(e);
|
|
405
|
+
const [r, ...n] = e.split("");
|
|
406
|
+
let o = !0;
|
|
407
|
+
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
408
|
+
const s = t.indexOf(n[c]) + 1;
|
|
409
|
+
s === t.length ? n[c] = t[0] : (n[c] = t[s], o = !1);
|
|
410
|
+
}
|
|
411
|
+
if (o) {
|
|
412
|
+
if (r === "Z")
|
|
413
|
+
return "a" + t[0];
|
|
414
|
+
if (r === "z")
|
|
415
|
+
return null;
|
|
416
|
+
const c = String.fromCharCode(r.charCodeAt(0) + 1);
|
|
417
|
+
return c > "a" ? n.push(t[0]) : n.pop(), c + n.join("");
|
|
418
|
+
} else
|
|
419
|
+
return r + n.join("");
|
|
420
|
+
}
|
|
421
|
+
function Re(e, t) {
|
|
422
|
+
te(e);
|
|
423
|
+
const [r, ...n] = e.split("");
|
|
424
|
+
let o = !0;
|
|
425
|
+
for (let c = n.length - 1; o && c >= 0; c--) {
|
|
426
|
+
const s = t.indexOf(n[c]) - 1;
|
|
427
|
+
s === -1 ? n[c] = t.slice(-1) : (n[c] = t[s], o = !1);
|
|
428
|
+
}
|
|
429
|
+
if (o) {
|
|
430
|
+
if (r === "a")
|
|
431
|
+
return "Z" + t.slice(-1);
|
|
432
|
+
if (r === "A")
|
|
433
|
+
return null;
|
|
434
|
+
const c = String.fromCharCode(r.charCodeAt(0) - 1);
|
|
435
|
+
return c < "Z" ? n.push(t.slice(-1)) : n.pop(), c + n.join("");
|
|
436
|
+
} else
|
|
437
|
+
return r + n.join("");
|
|
438
|
+
}
|
|
439
|
+
function y(e, t, r = ee) {
|
|
440
|
+
if (e != null && U(e, r), t != null && U(t, r), e != null && t != null && e >= t)
|
|
441
|
+
throw new Error(e + " >= " + t);
|
|
442
|
+
if (e == null) {
|
|
443
|
+
if (t == null)
|
|
444
|
+
return "a" + r[0];
|
|
445
|
+
const a = E(t), u = t.slice(a.length);
|
|
446
|
+
if (a === "A" + r[0].repeat(26))
|
|
447
|
+
return a + w("", u, r);
|
|
448
|
+
if (a < t)
|
|
449
|
+
return a;
|
|
450
|
+
const l = Re(a, r);
|
|
451
|
+
if (l == null)
|
|
452
|
+
throw new Error("cannot decrement any more");
|
|
453
|
+
return l;
|
|
454
|
+
}
|
|
455
|
+
if (t == null) {
|
|
456
|
+
const a = E(e), u = e.slice(a.length), l = K(a, r);
|
|
457
|
+
return l ?? a + w(u, null, r);
|
|
458
|
+
}
|
|
459
|
+
const n = E(e), o = e.slice(n.length), c = E(t), s = t.slice(c.length);
|
|
460
|
+
if (n === c)
|
|
461
|
+
return n + w(o, s, r);
|
|
462
|
+
const i = K(n, r);
|
|
463
|
+
if (i == null)
|
|
464
|
+
throw new Error("cannot increment any more");
|
|
465
|
+
return i < t ? i : n + w(o, null, r);
|
|
466
|
+
}
|
|
467
|
+
function k(e, t, r, n = ee) {
|
|
468
|
+
if (r === 0)
|
|
469
|
+
return [];
|
|
470
|
+
if (r === 1)
|
|
471
|
+
return [y(e, t, n)];
|
|
472
|
+
if (t == null) {
|
|
473
|
+
let s = y(e, t, n);
|
|
474
|
+
const i = [s];
|
|
475
|
+
for (let a = 0; a < r - 1; a++)
|
|
476
|
+
s = y(s, t, n), i.push(s);
|
|
477
|
+
return i;
|
|
478
|
+
}
|
|
479
|
+
if (e == null) {
|
|
480
|
+
let s = y(e, t, n);
|
|
481
|
+
const i = [s];
|
|
482
|
+
for (let a = 0; a < r - 1; a++)
|
|
483
|
+
s = y(e, s, n), i.push(s);
|
|
484
|
+
return i.reverse(), i;
|
|
485
|
+
}
|
|
486
|
+
const o = Math.floor(r / 2), c = y(e, t, n);
|
|
487
|
+
return [...k(e, c, o, n), c, ...k(c, t, r - o - 1, n)];
|
|
488
|
+
}
|
|
489
|
+
const Ne = (e) => !isNaN(parseFloat(e)), Le = (e, t) => Math.ceil(e / t) * t, zt = (e, t = 80, r = 1) => Le(e * r, t), Ft = (e, t = 12) => parseFloat(e.toPrecision(t)), Gt = (e) => {
|
|
490
|
+
if (e == null || e === !0 || e === !1)
|
|
491
|
+
return NaN;
|
|
492
|
+
const t = Number(e);
|
|
493
|
+
return isNaN(t) ? t : t < 0 ? Math.ceil(t) : Math.floor(t);
|
|
494
|
+
}, Wt = (e) => Ne(e) ? Number(e) : e, Ie = (e) => {
|
|
495
|
+
for (const r of Object.getOwnPropertyNames(e)) {
|
|
496
|
+
const n = e[r];
|
|
497
|
+
!R(n) && !p(n) || n === null || Ie(n);
|
|
498
|
+
}
|
|
499
|
+
return Object.isFrozen(e) ? e : Object.freeze(e);
|
|
500
|
+
}, je = (e) => e.replace(/\[/g, ".").replace(/\]/g, "").split(".");
|
|
501
|
+
function ne(e, t, r, n) {
|
|
502
|
+
const o = p(n) ? n : void 0;
|
|
503
|
+
return je(t).reduce((s, i, a, u) => {
|
|
504
|
+
if (a === u.length - 1)
|
|
505
|
+
return s[i] = r, s;
|
|
506
|
+
if (i in s)
|
|
507
|
+
return s[i];
|
|
508
|
+
if (!i) return s;
|
|
509
|
+
if (o) {
|
|
510
|
+
const l = o(s[i], i, s);
|
|
511
|
+
if (l) return s[i] = l;
|
|
512
|
+
}
|
|
513
|
+
return s[i] = /^[0-9]{1,}$/.test(u[a + 1]) ? [] : {};
|
|
514
|
+
}, e), e;
|
|
515
|
+
}
|
|
516
|
+
function Be(e, t, r) {
|
|
517
|
+
return ne(e, t, r);
|
|
518
|
+
}
|
|
519
|
+
function De(e, t, r, n) {
|
|
520
|
+
const o = p(n) ? n : void 0;
|
|
521
|
+
return ne(e, t, r, o);
|
|
522
|
+
}
|
|
523
|
+
const vt = (e) => {
|
|
524
|
+
const t = {};
|
|
525
|
+
return Object.keys(e).forEach((r) => {
|
|
526
|
+
r.match(/[^\]]*\[\d+\]/) ? Be(t, r, e[r]) : De(t, r, e[r], Object);
|
|
527
|
+
}), t;
|
|
528
|
+
}, xe = (e, t, r) => {
|
|
529
|
+
const n = (c) => String.prototype.split.call(t, c).filter(Boolean).reduce((s, i) => s != null ? s[i] : s, e), o = n(/[,[\]]+?/) || n(/[,[\].]+?/);
|
|
530
|
+
return o === void 0 || o === e ? r : o;
|
|
531
|
+
}, _e = (e, t) => {
|
|
532
|
+
const r = t.split(".");
|
|
533
|
+
return !!e && (r.length > 1 ? _e(e[t.split(".")[0]], r.slice(1).join(".")) : Object.hasOwnProperty.call(e, t));
|
|
534
|
+
};
|
|
535
|
+
function Ue(e, t) {
|
|
536
|
+
return e.length !== t.length ? !1 : e.every((r, n) => r === t[n]);
|
|
537
|
+
}
|
|
538
|
+
const z = (e, t) => {
|
|
539
|
+
if (e === t || Object.is(e, t)) return !0;
|
|
540
|
+
if (e && t && typeof e == "object" && typeof t == "object") {
|
|
541
|
+
if (e.constructor !== t.constructor) return !1;
|
|
542
|
+
let r, n;
|
|
543
|
+
if (Array.isArray(e)) {
|
|
544
|
+
if (r = e.length, r != t.length) return !1;
|
|
545
|
+
for (n = r; n-- !== 0; ) if (!z(e[n], t[n])) return !1;
|
|
546
|
+
return !0;
|
|
547
|
+
}
|
|
548
|
+
if (M(e) && M(t)) return Ue(e, t);
|
|
549
|
+
if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
|
|
550
|
+
if (e.valueOf !== Object.prototype.valueOf) return e.valueOf() === t.valueOf();
|
|
551
|
+
if (e.toString !== Object.prototype.toString) return e.toString() === t.toString();
|
|
552
|
+
const o = Object.keys(e);
|
|
553
|
+
if (r = o.length, r !== Object.keys(t).length) return !1;
|
|
554
|
+
for (n = r; n-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(t, o[n])) return !1;
|
|
555
|
+
for (n = r; n-- !== 0; ) {
|
|
556
|
+
const c = o[n];
|
|
557
|
+
if (!z(e[c], t[c])) return !1;
|
|
558
|
+
}
|
|
559
|
+
return !0;
|
|
560
|
+
}
|
|
561
|
+
return e !== e && t !== t;
|
|
562
|
+
}, Zt = (e, t) => e ? !t || t.length === 0 ? e : t.reduce(
|
|
563
|
+
(r, n) => (delete r[n], r),
|
|
564
|
+
{ ...e }
|
|
565
|
+
) : {};
|
|
566
|
+
function Vt(e, t) {
|
|
567
|
+
return Object.keys(e).filter((r) => !t(e[r], r)).reduce((r, n) => (r[n] = e[n], r), {});
|
|
568
|
+
}
|
|
569
|
+
function qt(e, t) {
|
|
570
|
+
return e ? t.reduce(
|
|
571
|
+
(r, n) => (Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]), r),
|
|
572
|
+
{}
|
|
573
|
+
) : {};
|
|
574
|
+
}
|
|
575
|
+
function Ht(e, t) {
|
|
576
|
+
return Object.keys(e).filter((r) => t(e[r], r)).reduce((r, n) => (r[n] = e[n], r), {});
|
|
577
|
+
}
|
|
578
|
+
const $ = (e, t = "", r = {}) => (b(e) ? e.forEach((n, o) => $(n, `${t}[${o}]`, r)) : ge(e) ? Object.keys(e).forEach(
|
|
579
|
+
(n) => $(e[n], `${t ? t + "." : ""}${n}`, r)
|
|
580
|
+
) : r[`${t}`] = e, r);
|
|
581
|
+
function Jt(e) {
|
|
582
|
+
return $(e);
|
|
583
|
+
}
|
|
584
|
+
const Qt = (e) => {
|
|
585
|
+
const t = {};
|
|
586
|
+
for (const r in e)
|
|
587
|
+
Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]);
|
|
588
|
+
return t;
|
|
589
|
+
};
|
|
590
|
+
function Yt(e, t) {
|
|
591
|
+
if (!e || !e.length)
|
|
592
|
+
return {};
|
|
593
|
+
const r = p(t) ? t : b(t) ? (n, o) => t[o] : () => t;
|
|
594
|
+
return e.reduce(
|
|
595
|
+
(n, o, c) => (n[o] = r(o, c), n),
|
|
596
|
+
{}
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
const Xt = (typeof window > "u" ? "undefined" : typeof window) == "object", er = (e) => e[Math.floor(Math.random() * e.length)], tr = (e = Number.MIN_SAFE_INTEGER, t = Number.MAX_SAFE_INTEGER) => Math.random() * (t - e) + e;
|
|
600
|
+
function rr(e = Number.MIN_SAFE_INTEGER, t = Number.MAX_SAFE_INTEGER) {
|
|
601
|
+
return Math.floor(Math.random() * (t - e + 1) + e);
|
|
602
|
+
}
|
|
603
|
+
const Ke = "0", oe = "123456789", se = Ke + oe, ce = "abcdefghijklmnopqrstuvwxyz", ke = ce.toUpperCase(), ze = ce + ke, Fe = "_-", Ge = se + ze + Fe, F = (e = 16, t = Ge) => {
|
|
604
|
+
let r = "";
|
|
605
|
+
const n = crypto.getRandomValues(new Uint8Array(e |= 0)), o = t.length - 1;
|
|
606
|
+
for (; e--; ) r += t[n[e] & o];
|
|
607
|
+
return r;
|
|
608
|
+
}, We = (e = 16) => F(1, oe) + F(e - 1, se), nr = (e = 16) => parseInt(We(e), 10), ie = (e) => {
|
|
609
|
+
if (!e) return "";
|
|
610
|
+
const t = e.toLowerCase();
|
|
611
|
+
return ve(t);
|
|
612
|
+
}, 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, L = (e) => Array.from(e.match(Ze) ?? []);
|
|
613
|
+
function or(e) {
|
|
614
|
+
const t = L(e);
|
|
615
|
+
if (t.length === 0)
|
|
616
|
+
return "";
|
|
617
|
+
const [r, ...n] = t;
|
|
618
|
+
return `${r.toLowerCase()}${n.map((o) => ie(o)).join("")}`;
|
|
619
|
+
}
|
|
620
|
+
const sr = async (e, t = "deflate") => {
|
|
621
|
+
try {
|
|
622
|
+
const n = new TextEncoder().encode(e), o = new CompressionStream(t), s = o.writable.getWriter();
|
|
623
|
+
await s.write(n), await s.close();
|
|
624
|
+
const a = o.readable.getReader(), u = [];
|
|
625
|
+
let l = 0;
|
|
626
|
+
for (; ; ) {
|
|
627
|
+
const { done: d, value: P } = await a.read();
|
|
628
|
+
if (d) break;
|
|
629
|
+
u.push(P), l += P.length;
|
|
630
|
+
}
|
|
631
|
+
const g = new Uint8Array(l);
|
|
632
|
+
let A = 0;
|
|
633
|
+
for (const d of u)
|
|
634
|
+
g.set(d, A), A += d.length;
|
|
635
|
+
let m = btoa(String.fromCharCode(...g));
|
|
636
|
+
return m = m.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, ""), m;
|
|
637
|
+
} catch (r) {
|
|
638
|
+
throw console.error("压缩过程中出错:", r), r;
|
|
639
|
+
}
|
|
640
|
+
}, cr = async (e, t = "deflate") => {
|
|
641
|
+
try {
|
|
642
|
+
let r = e.replace(/-/g, "+").replace(/_/g, "/");
|
|
643
|
+
const n = (4 - r.length % 4) % 4;
|
|
644
|
+
r += "=".repeat(n);
|
|
645
|
+
const o = atob(r), c = new Uint8Array(o.length);
|
|
646
|
+
for (let f = 0; f < o.length; f++)
|
|
647
|
+
c[f] = o.charCodeAt(f);
|
|
648
|
+
const s = new DecompressionStream(t), a = s.writable.getWriter();
|
|
649
|
+
await a.write(c), await a.close();
|
|
650
|
+
const l = s.readable.getReader(), g = [];
|
|
651
|
+
let A = 0;
|
|
652
|
+
for (; ; ) {
|
|
653
|
+
const { done: f, value: I } = await l.read();
|
|
654
|
+
if (f) break;
|
|
655
|
+
g.push(I), A += I.length;
|
|
656
|
+
}
|
|
657
|
+
const m = new Uint8Array(A);
|
|
658
|
+
let d = 0;
|
|
659
|
+
for (const f of g)
|
|
660
|
+
m.set(f, d), d += f.length;
|
|
661
|
+
return new TextDecoder().decode(m);
|
|
662
|
+
} catch (r) {
|
|
663
|
+
throw console.error("解压过程中出错:", r), r;
|
|
664
|
+
}
|
|
665
|
+
}, Ve = (e) => L(e).map((r) => r.toLowerCase()).join("-"), qe = {
|
|
666
|
+
"〇": 0,
|
|
667
|
+
一: 1,
|
|
668
|
+
二: 2,
|
|
669
|
+
三: 3,
|
|
670
|
+
四: 4,
|
|
671
|
+
五: 5,
|
|
672
|
+
六: 6,
|
|
673
|
+
七: 7,
|
|
674
|
+
八: 8,
|
|
675
|
+
九: 9,
|
|
676
|
+
十: 10,
|
|
677
|
+
百: 100,
|
|
678
|
+
千: 1e3,
|
|
679
|
+
万: 1e4,
|
|
680
|
+
零: 0,
|
|
681
|
+
壹: 1,
|
|
682
|
+
贰: 2,
|
|
683
|
+
叁: 3,
|
|
684
|
+
肆: 4,
|
|
685
|
+
伍: 5,
|
|
686
|
+
陆: 6,
|
|
687
|
+
柒: 7,
|
|
688
|
+
捌: 8,
|
|
689
|
+
玖: 9,
|
|
690
|
+
拾: 10,
|
|
691
|
+
佰: 100,
|
|
692
|
+
仟: 1e3,
|
|
693
|
+
0: 0,
|
|
694
|
+
1: 1,
|
|
695
|
+
2: 2,
|
|
696
|
+
3: 3,
|
|
697
|
+
4: 4,
|
|
698
|
+
5: 5,
|
|
699
|
+
6: 6,
|
|
700
|
+
7: 7,
|
|
701
|
+
8: 8,
|
|
702
|
+
9: 9
|
|
703
|
+
};
|
|
704
|
+
function ir(e) {
|
|
705
|
+
let t = 0, r = 0, n = 0, o = !1;
|
|
706
|
+
for (const c of e.split("").reverse()) {
|
|
707
|
+
if (r = qe[c], r === void 0)
|
|
708
|
+
throw new Error(`无法解析的数字: ${c}`);
|
|
709
|
+
switch (r) {
|
|
710
|
+
case 10: {
|
|
711
|
+
n = 1;
|
|
712
|
+
break;
|
|
713
|
+
}
|
|
714
|
+
case 100:
|
|
715
|
+
n = 2;
|
|
716
|
+
break;
|
|
717
|
+
case 1e3: {
|
|
718
|
+
n = 3;
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
case 1e4: {
|
|
722
|
+
n = 4;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
r < 10 ? (t += r * 10 ** n, n++, o = !1) : o = !0;
|
|
727
|
+
}
|
|
728
|
+
return o && (t += r), t;
|
|
729
|
+
}
|
|
730
|
+
const ar = (e) => {
|
|
731
|
+
const t = {};
|
|
732
|
+
return new URLSearchParams(e).forEach((n, o) => {
|
|
733
|
+
if (Object.prototype.hasOwnProperty.call(t, o)) {
|
|
734
|
+
const c = t[o];
|
|
735
|
+
Array.isArray(c) ? c.push(n) : t[o] = [c, n];
|
|
736
|
+
} else
|
|
737
|
+
t[o] = n;
|
|
738
|
+
}), t;
|
|
739
|
+
}, lr = (e) => {
|
|
740
|
+
const t = new URLSearchParams();
|
|
741
|
+
for (const r in e)
|
|
742
|
+
if (Object.prototype.hasOwnProperty.call(e, r)) {
|
|
743
|
+
const n = e[r];
|
|
744
|
+
Array.isArray(n) ? n.forEach((o) => t.append(r, `${o}`)) : t.set(r, `${n}`);
|
|
745
|
+
}
|
|
746
|
+
return t.sort(), t.toString();
|
|
747
|
+
}, He = ["角", "分", "厘"], G = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"], T = [
|
|
748
|
+
["元", "万", "亿", "兆", "京", "垓"],
|
|
749
|
+
["", "拾", "佰", "仟"]
|
|
750
|
+
], W = Math.pow(10, 22), ur = (e) => {
|
|
751
|
+
const t = e < 0 ? "欠" : "";
|
|
752
|
+
let r = Math.abs(e);
|
|
753
|
+
if (r > W)
|
|
754
|
+
throw new Error(`max value is ${W}`);
|
|
755
|
+
let n = "";
|
|
756
|
+
if (e > Math.floor(e)) {
|
|
757
|
+
const o = +("0." + `${r}`.split(".")[1]);
|
|
758
|
+
n = He.reduce(
|
|
759
|
+
(c, s, i) => c + (G[Math.floor(o * 10 * Math.pow(10, i)) % 10] + s).replace(/零./, ""),
|
|
760
|
+
""
|
|
761
|
+
);
|
|
762
|
+
}
|
|
763
|
+
n = n || "整", r = Math.floor(r);
|
|
764
|
+
for (let o = 0; o < T[0].length && r > 0; o++) {
|
|
765
|
+
let c = "";
|
|
766
|
+
for (let s = 0; s < T[1].length && r > 0; s++)
|
|
767
|
+
c = G[r % 10] + T[1][s] + c, r = Math.floor(r / 10);
|
|
768
|
+
n = c.replace(/(零.)*零$/g, "").replace(/^$/, "零") + T[0][o] + n;
|
|
769
|
+
}
|
|
770
|
+
return `${t}${n.replace(/(零.)*零元/, "元").replace(/(零.)+/g, "零").replace(/^整$/, "零元整")}`;
|
|
771
|
+
};
|
|
772
|
+
function fr(e, t) {
|
|
773
|
+
const r = e || "", n = t || "", o = Math.max(r.length, n.length);
|
|
774
|
+
return o === 0 ? 1 : (o - fe(r, n)) / o;
|
|
775
|
+
}
|
|
776
|
+
const hr = (e) => L(e).map((r) => r.toLowerCase()).join("_"), pr = (e) => Ve(e).split("-").filter((t) => !!t).map((t) => ie(t.toLowerCase())).join(" "), dr = (e) => e.trim().replace(/\s+/g, " "), mr = (e, t) => e.replace(/\${([^}]+)}/g, (r, n) => xe(t, n.trim(), "")), Je = (e) => e ? e.substring(0, 1).toLowerCase() + e.substring(1, e.length) : "", yr = (e) => {
|
|
777
|
+
if (!e) return "";
|
|
778
|
+
const t = e.toLowerCase();
|
|
779
|
+
return Je(t);
|
|
780
|
+
}, v = /^([^/:]+):\/*/, wr = (...e) => {
|
|
781
|
+
if (e = e.filter((s) => s !== ""), e.length === 0)
|
|
782
|
+
return "";
|
|
783
|
+
if (e.findIndex((s) => !(O(s) || h(s))) >= 0)
|
|
784
|
+
throw new Error("paths must be a string or number");
|
|
785
|
+
let r = "";
|
|
786
|
+
const n = `${e[0]}`;
|
|
787
|
+
n.startsWith("//") ? r = "//" : n.startsWith("/") ? r = "/" : (n.startsWith("file:") && e.length > 1 && (n + e[1]).match(/^file:\/\/\//) ? r = n.replace(v, "$1:///") : r = n.replace(v, "$1://"), e.shift()), r && !r.endsWith("/") && (r += "/");
|
|
788
|
+
let o = e.map(
|
|
789
|
+
(s) => `${s}`.replace(/^\/+/, "").replace(/^\.\/+/, "").replace(/\/+$/, "")
|
|
790
|
+
).filter((s) => s !== "").join("/");
|
|
791
|
+
for (; o.includes("/../"); ) {
|
|
792
|
+
const s = o.split("/"), i = s.findIndex((a) => a === "..");
|
|
793
|
+
s.splice(i - 1, 2), o = s.join("/");
|
|
794
|
+
}
|
|
795
|
+
let c = r + o;
|
|
796
|
+
if (c.includes("?")) {
|
|
797
|
+
const s = c.split("?").filter((i) => i !== "");
|
|
798
|
+
c = s.shift() + "?", s.length > 0 && (c += s.join("&"));
|
|
799
|
+
}
|
|
800
|
+
return c.replace(/\/(\?|&|#[^!])/g, "$1");
|
|
801
|
+
};
|
|
802
|
+
class gr {
|
|
803
|
+
#e = /* @__PURE__ */ new Map();
|
|
804
|
+
addEventListener(t, r) {
|
|
805
|
+
this.#t(t).add(r);
|
|
806
|
+
}
|
|
807
|
+
hasEventListener(t, r) {
|
|
808
|
+
return this.#e.has(t) && this.#t(t).has(r);
|
|
809
|
+
}
|
|
810
|
+
removeEventListener(t, r) {
|
|
811
|
+
this.#t(t).delete(r);
|
|
812
|
+
}
|
|
813
|
+
dispatchEvent(t) {
|
|
814
|
+
this.#t(t.type).forEach((r) => r.call(this, t));
|
|
815
|
+
}
|
|
816
|
+
removeAllEventListener() {
|
|
817
|
+
this.#e.clear();
|
|
818
|
+
}
|
|
819
|
+
#t(t) {
|
|
820
|
+
if (this.#e.has(t))
|
|
821
|
+
return this.#e.get(t);
|
|
822
|
+
{
|
|
823
|
+
const n = /* @__PURE__ */ new Set();
|
|
824
|
+
return this.#e.set(t, n), n;
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
const Ar = "data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", Er = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==", Sr = (e, ...t) => {
|
|
829
|
+
const r = [];
|
|
830
|
+
R(e) ? Object.keys(e).sort().forEach((o) => {
|
|
831
|
+
const c = e[o];
|
|
832
|
+
r.push([o, c]);
|
|
833
|
+
}) : r.push([e]), t.length && t.forEach((o) => {
|
|
834
|
+
console.log(o);
|
|
835
|
+
}), (console?.table ?? console.log)(r);
|
|
836
|
+
};
|
|
837
|
+
export {
|
|
838
|
+
ee as BASE_62_DIGITS,
|
|
839
|
+
gr as EventDispatcher,
|
|
840
|
+
Ar as IMAGE_MIN_BASE64_BLACK,
|
|
841
|
+
Er as IMAGE_MIN_BASE64_TRANSPARENT,
|
|
842
|
+
Xt as IS_BROWSER,
|
|
843
|
+
tt as IdleTimer,
|
|
844
|
+
rt as LeaderElection,
|
|
845
|
+
Ot as aesDecrypt,
|
|
846
|
+
Tt as aesEncrypt,
|
|
847
|
+
C as base64Decode,
|
|
848
|
+
S as base64Encode,
|
|
849
|
+
or as camelCase,
|
|
850
|
+
Rt as canBeDate,
|
|
851
|
+
Ne as canBeNumber,
|
|
852
|
+
ie as capitalize,
|
|
853
|
+
ve as capitalizeFirst,
|
|
854
|
+
ot as chunk,
|
|
855
|
+
sr as compressToBase64Url,
|
|
856
|
+
et as createBroadcastTopic,
|
|
857
|
+
Nt as dateStringToDate,
|
|
858
|
+
$e as dateStringWithTimezone,
|
|
859
|
+
_t as debounce,
|
|
860
|
+
Ct as decodeJWTPayload,
|
|
861
|
+
cr as decompressFromBase64Url,
|
|
862
|
+
Ie as deepFreeze,
|
|
863
|
+
st as difference,
|
|
864
|
+
Ut as emptyFunction,
|
|
865
|
+
ct as flatten,
|
|
866
|
+
de as flattenDeep,
|
|
867
|
+
vt as flattenPathObjectToPlainObject,
|
|
868
|
+
It as formatCountdown,
|
|
869
|
+
Lt as formatPassTime,
|
|
870
|
+
y as generateKeyBetween,
|
|
871
|
+
k as generateKeysBetween,
|
|
872
|
+
xe as get,
|
|
873
|
+
_e as has,
|
|
874
|
+
it as intersection,
|
|
875
|
+
b as isArray,
|
|
876
|
+
me as isArrayBuffer,
|
|
877
|
+
at as isBoolean,
|
|
878
|
+
q as isDate,
|
|
879
|
+
lt as isEmpty,
|
|
880
|
+
z as isEqual,
|
|
881
|
+
Ue as isEqualUint8Array,
|
|
882
|
+
ut as isFloat,
|
|
883
|
+
p as isFunction,
|
|
884
|
+
jt as isISODateString,
|
|
885
|
+
we as isInt,
|
|
886
|
+
ft as isIntArray,
|
|
887
|
+
Bt as isMSTime,
|
|
888
|
+
H as isNil,
|
|
889
|
+
h as isNumber,
|
|
890
|
+
ht as isNumberArray,
|
|
891
|
+
R as isObject,
|
|
892
|
+
pt as isObjectLike,
|
|
893
|
+
ge as isPlainObject,
|
|
894
|
+
dt as isPrimitive,
|
|
895
|
+
mt as isPromise,
|
|
896
|
+
yt as isRegExp,
|
|
897
|
+
O as isString,
|
|
898
|
+
wt as isStringArray,
|
|
899
|
+
ye as isSymbol,
|
|
900
|
+
M as isUint8Array,
|
|
901
|
+
Ve as kebabCase,
|
|
902
|
+
Sr as logError,
|
|
903
|
+
Dt as msTimeToMilliseconds,
|
|
904
|
+
gt as needArray,
|
|
905
|
+
Et as nextTick,
|
|
906
|
+
Ut as noop,
|
|
907
|
+
Le as numberStep,
|
|
908
|
+
zt as numberStepScreenSize,
|
|
909
|
+
Ft as numberStrip,
|
|
910
|
+
Zt as omit,
|
|
911
|
+
Vt as omitBy,
|
|
912
|
+
Kt as once,
|
|
913
|
+
ir as parseChineseNumber,
|
|
914
|
+
Q as parseTime,
|
|
915
|
+
nt as performChunk,
|
|
916
|
+
qt as pick,
|
|
917
|
+
Ht as pickBy,
|
|
918
|
+
Jt as plainObjectToFlattenPathObject,
|
|
919
|
+
j as pool,
|
|
920
|
+
ar as queryParse,
|
|
921
|
+
lr as queryStringify,
|
|
922
|
+
er as randomArrayItem,
|
|
923
|
+
tr as randomFloat,
|
|
924
|
+
rr as randomInt,
|
|
925
|
+
F as randomString,
|
|
926
|
+
nr as randomUintByLength,
|
|
927
|
+
We as randomUintString,
|
|
928
|
+
ur as rmbUppercase,
|
|
929
|
+
Pt as rsaDecrypt,
|
|
930
|
+
Mt as rsaEncrypt,
|
|
931
|
+
$t as rsaGenerateKey,
|
|
932
|
+
Be as set,
|
|
933
|
+
ne as setBase,
|
|
934
|
+
De as setWith,
|
|
935
|
+
fr as similarity,
|
|
936
|
+
St as sleep,
|
|
937
|
+
hr as snakeCase,
|
|
938
|
+
At as sortBy,
|
|
939
|
+
pr as startCase,
|
|
940
|
+
dr as stringSingleline,
|
|
941
|
+
mr as stringTemplate,
|
|
942
|
+
Y as stringTime,
|
|
943
|
+
N as stringToArrayBuffer,
|
|
944
|
+
kt as throttle,
|
|
945
|
+
Gt as toInt,
|
|
946
|
+
Qt as toPlainObject,
|
|
947
|
+
J as traverseObjectKeys,
|
|
948
|
+
Wt as tryToNumber,
|
|
949
|
+
bt as uint8ArrayToString,
|
|
950
|
+
yr as uncapitalize,
|
|
951
|
+
Je as uncapitalizeFirst,
|
|
952
|
+
xt as unixTimestamp,
|
|
953
|
+
wr as urlJoin,
|
|
954
|
+
Yt as zipObject
|
|
955
|
+
};
|