nhanh-pure-function 2.0.1 → 2.0.3
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/Constant.d.ts +4 -1
- package/dist/User/index.d.ts +16 -0
- package/dist/Utility/index.d.ts +54 -10
- package/dist/index.cjs.js +2 -1
- package/dist/index.d.ts +33 -0
- package/dist/index.es.js +600 -366
- package/package.json +2 -1
- package/dist/nhanh-pure-function.css +0 -1
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".nhanh-pure-function{--nhanh: 2233}.no-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}")),document.head.appendChild(e)}}catch(n){console.error("vite-plugin-css-injected-by-js",n)}})();
|
|
2
|
+
var K = Object.defineProperty;
|
|
3
|
+
var H = (n) => {
|
|
3
4
|
throw TypeError(n);
|
|
4
5
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
const
|
|
6
|
+
var ee = (n, t, e) => t in n ? K(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
7
|
+
var y = (n, t, e) => ee(n, typeof t != "symbol" ? t + "" : t, e), X = (n, t, e) => t.has(n) || H("Cannot " + e);
|
|
8
|
+
var c = (n, t, e) => (X(n, t, "read from private field"), e ? e.call(n) : t.get(n)), d = (n, t, e) => t.has(n) ? H("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), l = (n, t, e, o) => (X(n, t, "write to private field"), o ? o.call(n, e) : t.set(n, e), e);
|
|
9
|
+
const te = {
|
|
9
10
|
/* 常见扩展名映射 */
|
|
10
11
|
".mp3": "audio/mpeg",
|
|
11
12
|
".mp4": "video/mp4",
|
|
@@ -69,7 +70,7 @@ const V = {
|
|
|
69
70
|
".eot": "application/vnd.ms-fontobject",
|
|
70
71
|
".map": "application/json"
|
|
71
72
|
// 可根据需要继续扩展
|
|
72
|
-
},
|
|
73
|
+
}, $ = {
|
|
73
74
|
image: [
|
|
74
75
|
".jpg",
|
|
75
76
|
".jpeg",
|
|
@@ -249,7 +250,7 @@ const V = {
|
|
|
249
250
|
".awk",
|
|
250
251
|
".php"
|
|
251
252
|
]
|
|
252
|
-
},
|
|
253
|
+
}, W = [
|
|
253
254
|
"",
|
|
254
255
|
"万",
|
|
255
256
|
"亿",
|
|
@@ -264,177 +265,171 @@ const V = {
|
|
|
264
265
|
"载",
|
|
265
266
|
"极"
|
|
266
267
|
];
|
|
267
|
-
function
|
|
268
|
+
function le(n) {
|
|
268
269
|
return n != null;
|
|
269
270
|
}
|
|
270
|
-
function
|
|
271
|
+
function ue(n) {
|
|
271
272
|
return !(n === null || typeof n != "object" || Array.isArray(n));
|
|
272
273
|
}
|
|
273
|
-
function
|
|
274
|
+
function me(n) {
|
|
274
275
|
if (typeof n != "function")
|
|
275
276
|
return console.error("非函数:", n);
|
|
276
|
-
const
|
|
277
|
-
|
|
277
|
+
const t = function(e) {
|
|
278
|
+
e.didTimeout || e.timeRemaining() <= 0 ? requestIdleCallback(t) : n();
|
|
278
279
|
};
|
|
279
|
-
requestIdleCallback(
|
|
280
|
+
requestIdleCallback(t);
|
|
280
281
|
}
|
|
281
|
-
function
|
|
282
|
-
const
|
|
283
|
-
return new Promise((o,
|
|
284
|
-
const
|
|
285
|
-
if (+/* @__PURE__ */ new Date() -
|
|
282
|
+
function de(n, t) {
|
|
283
|
+
const e = +/* @__PURE__ */ new Date();
|
|
284
|
+
return new Promise((o, r) => {
|
|
285
|
+
const i = () => {
|
|
286
|
+
if (+/* @__PURE__ */ new Date() - e >= t) return r("超时");
|
|
286
287
|
if (n()) return o("完成");
|
|
287
|
-
requestIdleCallback(
|
|
288
|
+
requestIdleCallback(i);
|
|
288
289
|
};
|
|
289
|
-
|
|
290
|
+
i();
|
|
290
291
|
});
|
|
291
292
|
}
|
|
292
|
-
function
|
|
293
|
+
function fe(n, t, e = ",") {
|
|
293
294
|
const o = new RegExp(
|
|
294
|
-
`(^|${
|
|
295
|
+
`(^|${e})${t}(${e}|$)`,
|
|
295
296
|
"g"
|
|
296
297
|
);
|
|
297
|
-
return n.replace(o, function(
|
|
298
|
-
return
|
|
298
|
+
return n.replace(o, function(r, i, s) {
|
|
299
|
+
return i === s ? e : "";
|
|
299
300
|
});
|
|
300
301
|
}
|
|
301
|
-
function
|
|
302
|
+
function he(n) {
|
|
302
303
|
return n.charAt(0).toUpperCase() + n.slice(1);
|
|
303
304
|
}
|
|
304
|
-
function
|
|
305
|
-
if (o < +/* @__PURE__ */ new Date() -
|
|
305
|
+
function Y(n, t, e = [], o = +/* @__PURE__ */ new Date()) {
|
|
306
|
+
if (o < +/* @__PURE__ */ new Date() - 50) {
|
|
306
307
|
console.error("_MergeObjects 合并异常:疑似死循环");
|
|
307
308
|
return;
|
|
308
309
|
}
|
|
309
|
-
const
|
|
310
|
-
if (r !=
|
|
310
|
+
const r = G(n), i = G(t);
|
|
311
|
+
if (r != i) return t;
|
|
311
312
|
if (r == "object" || r == "array") {
|
|
312
|
-
if (
|
|
313
|
-
if (
|
|
314
|
-
for (const
|
|
315
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
316
|
-
const
|
|
317
|
-
n[
|
|
313
|
+
if (e.some(([s, a]) => s == n && a == t)) return n;
|
|
314
|
+
if (e.push([n, t]), r == "object") {
|
|
315
|
+
for (const s in t)
|
|
316
|
+
if (Object.prototype.hasOwnProperty.call(t, s)) {
|
|
317
|
+
const a = t[s], m = n[s], u = Y(m, a, e, o);
|
|
318
|
+
n[s] = u;
|
|
318
319
|
}
|
|
319
320
|
return n;
|
|
320
321
|
} else if (r == "array")
|
|
321
|
-
return
|
|
322
|
-
const
|
|
323
|
-
n[
|
|
322
|
+
return t.forEach((s, a) => {
|
|
323
|
+
const m = s, u = n[a], f = Y(u, m, e, o);
|
|
324
|
+
n[a] = f;
|
|
324
325
|
}), n;
|
|
325
|
-
} else return
|
|
326
|
+
} else return t;
|
|
326
327
|
}
|
|
327
|
-
function
|
|
328
|
+
function pe(n, t = "YYYY-MM-DD hh:mm:ss", e = !0) {
|
|
328
329
|
const o = new Date(n);
|
|
329
330
|
if (isNaN(o.getTime()))
|
|
330
331
|
return console.error("Invalid date"), "";
|
|
331
|
-
const
|
|
332
|
-
YYYY: (
|
|
333
|
-
MM: (
|
|
332
|
+
const r = {
|
|
333
|
+
YYYY: (i) => i.getFullYear(),
|
|
334
|
+
MM: (i) => i.getMonth() + 1,
|
|
334
335
|
// Adjust for 0-based month
|
|
335
|
-
DD: (
|
|
336
|
-
hh: (
|
|
337
|
-
mm: (
|
|
338
|
-
ss: (
|
|
339
|
-
ms: (
|
|
336
|
+
DD: (i) => i.getDate(),
|
|
337
|
+
hh: (i) => i.getHours(),
|
|
338
|
+
mm: (i) => i.getMinutes(),
|
|
339
|
+
ss: (i) => i.getSeconds(),
|
|
340
|
+
ms: (i) => i.getMilliseconds()
|
|
340
341
|
};
|
|
341
|
-
return
|
|
342
|
-
const
|
|
343
|
-
return
|
|
342
|
+
return t.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (i) => {
|
|
343
|
+
const s = r[i](o);
|
|
344
|
+
return e ? String(s).padStart(2, "0") : String(s);
|
|
344
345
|
});
|
|
345
346
|
}
|
|
346
|
-
function
|
|
347
|
-
return new Promise((
|
|
348
|
-
fetch(n).then((o) =>
|
|
349
|
-
console.error("Error fetching :", o),
|
|
347
|
+
function ge(n) {
|
|
348
|
+
return new Promise((t, e) => {
|
|
349
|
+
fetch(n).then((o) => t(o.text())).catch((o) => {
|
|
350
|
+
console.error("Error fetching :", o), e(o);
|
|
350
351
|
});
|
|
351
352
|
});
|
|
352
353
|
}
|
|
353
|
-
function
|
|
354
|
-
if (!n || (n = String(n).trim(), n === "")) return
|
|
355
|
-
const
|
|
356
|
-
return
|
|
354
|
+
function B(n, t = "file") {
|
|
355
|
+
if (!n || (n = String(n).trim(), n === "")) return t;
|
|
356
|
+
const e = n.split("/");
|
|
357
|
+
return e[e.length - 1].split("?")[0];
|
|
357
358
|
}
|
|
358
|
-
function
|
|
359
|
-
return new Promise((
|
|
359
|
+
function we(n, t) {
|
|
360
|
+
return new Promise((e, o) => {
|
|
360
361
|
try {
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
|
|
362
|
+
t = t || B(n, "downloaded_file"), fetch(n).then((r) => (r.ok || o(`文件下载失败,状态码: ${r.status}`), r.blob())).then((r) => {
|
|
363
|
+
const i = URL.createObjectURL(r), s = document.createElement("a");
|
|
364
|
+
s.href = i, s.download = decodeURIComponent(t), document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(i), e(r);
|
|
364
365
|
}).catch(o);
|
|
365
|
-
} catch (
|
|
366
|
-
o(
|
|
366
|
+
} catch (r) {
|
|
367
|
+
o(r);
|
|
367
368
|
}
|
|
368
369
|
});
|
|
369
370
|
}
|
|
370
|
-
function
|
|
371
|
-
let
|
|
372
|
-
function
|
|
371
|
+
function xe(n, t = 10) {
|
|
372
|
+
let e = 0, o = t;
|
|
373
|
+
function r() {
|
|
373
374
|
if (o > 0)
|
|
374
|
-
o--, requestAnimationFrame(
|
|
375
|
+
o--, requestAnimationFrame(r);
|
|
375
376
|
else {
|
|
376
|
-
const
|
|
377
|
-
n(Number(a.toFixed(2)), Number(
|
|
377
|
+
const s = (+/* @__PURE__ */ new Date() - e) / t, a = 1e3 / s;
|
|
378
|
+
n(Number(a.toFixed(2)), Number(s.toFixed(2)));
|
|
378
379
|
}
|
|
379
380
|
}
|
|
380
381
|
requestAnimationFrame(() => {
|
|
381
|
-
|
|
382
|
+
e = +/* @__PURE__ */ new Date(), r();
|
|
382
383
|
});
|
|
383
384
|
}
|
|
384
|
-
function
|
|
385
|
-
return n = n.replace(/([^a-zA-Z][a-z])/g, (
|
|
385
|
+
function ve(n, t) {
|
|
386
|
+
return n = n.replace(/([^a-zA-Z][a-z])/g, (e) => e.toUpperCase()), t ? n.replace(/[^a-zA-Z]+/g, "") : n;
|
|
386
387
|
}
|
|
387
|
-
function
|
|
388
|
-
if (!
|
|
389
|
-
let
|
|
390
|
-
|
|
388
|
+
function be(n, t, e) {
|
|
389
|
+
if (!e) {
|
|
390
|
+
let s = t.replace(/^[^.]+./, "");
|
|
391
|
+
s = s == t ? "text/plain" : "application/" + s, e = { type: s };
|
|
391
392
|
}
|
|
392
|
-
const o = new Blob(n,
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
function ft(n) {
|
|
396
|
-
const e = n.split("?")[1] || "", t = new URLSearchParams(e), o = {};
|
|
397
|
-
return t.forEach((i, r) => {
|
|
398
|
-
o[r] = i;
|
|
399
|
-
}), o;
|
|
393
|
+
const o = new Blob(n, e), r = URL.createObjectURL(o), i = document.createElement("a");
|
|
394
|
+
i.href = r, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r);
|
|
400
395
|
}
|
|
401
|
-
function
|
|
402
|
-
return n + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(
|
|
403
|
-
const
|
|
404
|
-
return (
|
|
396
|
+
function ye(n = "") {
|
|
397
|
+
return n + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
|
398
|
+
const e = Math.random() * 16 | 0;
|
|
399
|
+
return (t === "x" ? e : e & 3 | 8).toString(16);
|
|
405
400
|
});
|
|
406
401
|
}
|
|
407
|
-
function
|
|
408
|
-
let
|
|
402
|
+
function ne(n, t) {
|
|
403
|
+
let e;
|
|
409
404
|
return function(...o) {
|
|
410
|
-
clearTimeout(
|
|
411
|
-
n(...o),
|
|
412
|
-
},
|
|
405
|
+
clearTimeout(e), e = setTimeout(() => {
|
|
406
|
+
n(...o), e = void 0;
|
|
407
|
+
}, t);
|
|
413
408
|
};
|
|
414
409
|
}
|
|
415
|
-
function
|
|
416
|
-
let
|
|
410
|
+
function Ee(n, t) {
|
|
411
|
+
let e = -1 / 0;
|
|
417
412
|
return function(...o) {
|
|
418
|
-
const
|
|
419
|
-
if (
|
|
420
|
-
|
|
413
|
+
const r = performance.now();
|
|
414
|
+
if (r - e > t) {
|
|
415
|
+
e = r;
|
|
421
416
|
try {
|
|
422
417
|
n(...o);
|
|
423
|
-
} catch (
|
|
424
|
-
console.error("Throttled function execution failed:",
|
|
418
|
+
} catch (i) {
|
|
419
|
+
console.error("Throttled function execution failed:", i);
|
|
425
420
|
}
|
|
426
421
|
}
|
|
427
422
|
};
|
|
428
423
|
}
|
|
429
|
-
function
|
|
424
|
+
function G(n) {
|
|
430
425
|
return Array.isArray(n) ? "array" : n === null ? "null" : typeof n;
|
|
431
426
|
}
|
|
432
|
-
function
|
|
433
|
-
const
|
|
427
|
+
function Ce(n) {
|
|
428
|
+
const t = () => Promise.resolve(), e = (a) => (console.error(a), Promise.reject(a));
|
|
434
429
|
function o() {
|
|
435
|
-
return navigator.clipboard.writeText(n).then(
|
|
430
|
+
return navigator.clipboard.writeText(n).then(t).catch(e);
|
|
436
431
|
}
|
|
437
|
-
function
|
|
432
|
+
function r() {
|
|
438
433
|
const a = document.createElement("div");
|
|
439
434
|
a.innerText = n, document.body.appendChild(a);
|
|
440
435
|
const m = document.createRange();
|
|
@@ -443,59 +438,59 @@ function xt(n) {
|
|
|
443
438
|
let f = !1;
|
|
444
439
|
return u && (u.removeAllRanges(), u.addRange(m), f = document.execCommand("copy")), document.body.removeChild(a), f ? Promise.resolve() : Promise.reject();
|
|
445
440
|
}
|
|
446
|
-
function
|
|
441
|
+
function i() {
|
|
447
442
|
const a = document.createElement("textarea");
|
|
448
443
|
a.value = n, document.body.appendChild(a), a.select(), a.setSelectionRange(0, n.length);
|
|
449
444
|
let m = !1;
|
|
450
445
|
return document.activeElement === a && (m = document.execCommand("Copy", !0)), document.body.removeChild(a), m ? Promise.resolve() : Promise.reject();
|
|
451
446
|
}
|
|
452
|
-
function
|
|
453
|
-
return
|
|
454
|
-
|
|
447
|
+
function s() {
|
|
448
|
+
return r().then(t).catch(() => {
|
|
449
|
+
i().then(t).catch(() => e("复制方式尽皆失效"));
|
|
455
450
|
});
|
|
456
451
|
}
|
|
457
|
-
return navigator.clipboard ? o().catch(
|
|
452
|
+
return navigator.clipboard ? o().catch(s) : s();
|
|
458
453
|
}
|
|
459
|
-
function
|
|
460
|
-
const
|
|
461
|
-
return
|
|
454
|
+
function Fe(n, t) {
|
|
455
|
+
const e = t.split(".");
|
|
456
|
+
return e.reduce((o, r, i) => (r in o || (i === e.length - 1 ? o[r] = void 0 : o[r] = {}), o[r]), n);
|
|
462
457
|
}
|
|
463
|
-
function
|
|
464
|
-
const
|
|
465
|
-
return
|
|
458
|
+
function Le(n, t) {
|
|
459
|
+
const e = t.split(".");
|
|
460
|
+
return e.reduce((o, r, i) => o.hasOwnProperty(r) ? o[r] : o[r] = i == e.length - 1 ? void 0 : {}, n);
|
|
466
461
|
}
|
|
467
|
-
function
|
|
468
|
-
const o =
|
|
469
|
-
return o.reduce((
|
|
462
|
+
function je(n, t, e) {
|
|
463
|
+
const o = t.split(".");
|
|
464
|
+
return o.reduce((r, i, s) => (s === o.length - 1 && (r[i] = e), r[i]), n);
|
|
470
465
|
}
|
|
471
|
-
function
|
|
472
|
-
return new Promise((
|
|
466
|
+
function Me(n) {
|
|
467
|
+
return new Promise((t, e) => {
|
|
473
468
|
if (typeof n != "string" || n.trim() === "" || !n.includes("://")) {
|
|
474
|
-
|
|
469
|
+
e(new Error("Invalid URL: Must be a non-empty string"));
|
|
475
470
|
return;
|
|
476
471
|
}
|
|
477
472
|
try {
|
|
478
473
|
new XMLHttpRequest().open("HEAD", n, !0);
|
|
479
|
-
} catch (
|
|
480
|
-
|
|
474
|
+
} catch (i) {
|
|
475
|
+
e(new Error(`Invalid URL format: ${i.message}`));
|
|
481
476
|
return;
|
|
482
477
|
}
|
|
483
478
|
const o = new XMLHttpRequest();
|
|
484
479
|
o.open("HEAD", n, !0);
|
|
485
|
-
const
|
|
486
|
-
|
|
480
|
+
const r = (i) => {
|
|
481
|
+
e(new Error(`Request failed: ${i.type}`));
|
|
487
482
|
};
|
|
488
483
|
o.onreadystatechange = function() {
|
|
489
|
-
o.readyState === XMLHttpRequest.DONE && (o.status === 0 ?
|
|
490
|
-
}, o.onerror =
|
|
484
|
+
o.readyState === XMLHttpRequest.DONE && (o.status === 0 ? e(new Error("Network error or CORS blocked")) : o.status >= 200 && o.status < 300 ? t(!0) : e(new Error(`HTTP Error: ${o.status}`)));
|
|
485
|
+
}, o.onerror = r, o.onabort = r, o.ontimeout = r;
|
|
491
486
|
try {
|
|
492
487
|
o.send();
|
|
493
|
-
} catch (
|
|
494
|
-
|
|
488
|
+
} catch (i) {
|
|
489
|
+
e(new Error(`Request send failed: ${i.message}`));
|
|
495
490
|
}
|
|
496
491
|
});
|
|
497
492
|
}
|
|
498
|
-
function
|
|
493
|
+
function Re(n) {
|
|
499
494
|
return [
|
|
500
495
|
"https:",
|
|
501
496
|
// HTTPS协议,用于安全地浏览网页
|
|
@@ -517,20 +512,24 @@ function Et(n) {
|
|
|
517
512
|
// Remote Desktop Protocol,用于安全的远程桌面连接
|
|
518
513
|
"vpn:"
|
|
519
514
|
// VPN协议,用于创建安全的网络连接
|
|
520
|
-
].some((
|
|
521
|
-
}
|
|
522
|
-
const
|
|
523
|
-
|
|
524
|
-
if (
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
515
|
+
].some((e) => n.startsWith(e));
|
|
516
|
+
}
|
|
517
|
+
const F = class F {
|
|
518
|
+
constructor() {
|
|
519
|
+
if (new.target === F)
|
|
520
|
+
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
521
|
+
}
|
|
522
|
+
static check(t, e) {
|
|
523
|
+
if (!t || typeof t != "string")
|
|
524
|
+
return console.error("Invalid URL provided"), e ? !1 : "unknown";
|
|
525
|
+
const o = B(t).toLowerCase();
|
|
526
|
+
if (e) {
|
|
527
|
+
if (!$.hasOwnProperty(e))
|
|
528
|
+
return console.error(`Unknown file type: ${e}`), "unknown";
|
|
529
|
+
const r = $[e];
|
|
530
|
+
return F._checkExtension(o, r);
|
|
532
531
|
}
|
|
533
|
-
return
|
|
532
|
+
return F._detectFileType(o);
|
|
534
533
|
}
|
|
535
534
|
/**
|
|
536
535
|
* 静态方法,用于解析地址信息
|
|
@@ -540,10 +539,10 @@ const C = class C {
|
|
|
540
539
|
* @param {string} url - 以逗号分隔的URL字符串,每个URL代表一个资源的位置
|
|
541
540
|
* @returns {Array} - 包含每个URL及其相关信息(名称和类型)的对象数组
|
|
542
541
|
*/
|
|
543
|
-
static parseAddresses(
|
|
544
|
-
return !
|
|
545
|
-
const o =
|
|
546
|
-
return { url:
|
|
542
|
+
static parseAddresses(t) {
|
|
543
|
+
return !t || typeof t != "string" ? (console.error("Invalid URL provided"), []) : t.split(",").map((e) => {
|
|
544
|
+
const o = B(e), r = this.check(e);
|
|
545
|
+
return { url: e, name: o, type: r };
|
|
547
546
|
});
|
|
548
547
|
}
|
|
549
548
|
/**
|
|
@@ -552,13 +551,13 @@ const C = class C {
|
|
|
552
551
|
* @param {string} [accept] - 可接受的 MIME 类型模式(如 "image/*, text/plain")
|
|
553
552
|
* @returns {boolean} - 如果类型匹配,则返回 true,否则返回 false
|
|
554
553
|
*/
|
|
555
|
-
static matchesMimeType(
|
|
556
|
-
if (!
|
|
557
|
-
if (typeof
|
|
558
|
-
const o =
|
|
559
|
-
return
|
|
554
|
+
static matchesMimeType(t, e) {
|
|
555
|
+
if (!e) return !0;
|
|
556
|
+
if (typeof t != "string" || typeof e != "string") return !1;
|
|
557
|
+
const o = F._normalizeType(t), r = e.split(",").map((a) => F._normalizeType(a.trim())), [i, s = "*"] = o.split("/");
|
|
558
|
+
return r.some((a) => {
|
|
560
559
|
const [m, u = "*"] = a.split("/");
|
|
561
|
-
return (m === "*" ||
|
|
560
|
+
return (m === "*" || i === "*" || m === i) && (u === "*" || s === "*" || u === s);
|
|
562
561
|
});
|
|
563
562
|
}
|
|
564
563
|
/**
|
|
@@ -569,8 +568,8 @@ const C = class C {
|
|
|
569
568
|
* @param {string} type - 文件类型或MIME类型字符串
|
|
570
569
|
* @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
|
|
571
570
|
*/
|
|
572
|
-
static _normalizeType(
|
|
573
|
-
return
|
|
571
|
+
static _normalizeType(t) {
|
|
572
|
+
return t.startsWith(".") && !t.includes("/") ? te[t.toLowerCase()] || t : t.includes("/") ? t : `${t}/*`;
|
|
574
573
|
}
|
|
575
574
|
/**
|
|
576
575
|
* 检查URL是否具有任何指定的文件扩展名
|
|
@@ -578,69 +577,172 @@ const C = class C {
|
|
|
578
577
|
* @param {string[]} validExtensions - 有效文件扩展名的数组
|
|
579
578
|
* @returns {boolean} - 如果URL具有任何指定的文件扩展名,则返回true,否则返回false
|
|
580
579
|
*/
|
|
581
|
-
static _checkExtension(
|
|
582
|
-
return
|
|
580
|
+
static _checkExtension(t, e) {
|
|
581
|
+
return e.some((o) => t.endsWith(o));
|
|
583
582
|
}
|
|
584
583
|
/**
|
|
585
584
|
* 检测文件URL的类型
|
|
586
585
|
* @param {string} url - 文件的URL
|
|
587
586
|
* @returns {string} - 如果URL与任何已知类型匹配,则返回文件类型,否则返回"unknown"
|
|
588
587
|
*/
|
|
589
|
-
static _detectFileType(
|
|
590
|
-
for (const [
|
|
591
|
-
if (o.some((
|
|
592
|
-
return
|
|
588
|
+
static _detectFileType(t) {
|
|
589
|
+
for (const [e, o] of F.cachedEntries)
|
|
590
|
+
if (o.some((r) => t.endsWith(r)))
|
|
591
|
+
return e;
|
|
593
592
|
return "unknown";
|
|
594
593
|
}
|
|
595
594
|
};
|
|
596
595
|
// 缓存文件扩展名的条目,以提高性能
|
|
597
|
-
|
|
598
|
-
let
|
|
599
|
-
function
|
|
600
|
-
return n.map((
|
|
596
|
+
y(F, "cachedEntries", Object.entries($));
|
|
597
|
+
let V = F;
|
|
598
|
+
function Te(n) {
|
|
599
|
+
return n.map((t, e) => n.slice(e).concat(n.slice(0, e)));
|
|
601
600
|
}
|
|
602
|
-
function
|
|
603
|
-
const
|
|
601
|
+
function ke(n) {
|
|
602
|
+
const t = window.structuredClone, e = (o) => o === null || typeof o != "object" ? o : Y(Array.isArray(o) ? [] : {}, o);
|
|
604
603
|
try {
|
|
605
|
-
return
|
|
604
|
+
return t ? t(n) : e(n);
|
|
606
605
|
} catch (o) {
|
|
607
|
-
return console.error("structuredClone error:", o),
|
|
606
|
+
return console.error("structuredClone error:", o), t && e(n);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
const N = class N {
|
|
610
|
+
/**
|
|
611
|
+
* 构造函数
|
|
612
|
+
* @throws 如果尝试实例化该类,则抛出错误,因为应该使用静态方法
|
|
613
|
+
*/
|
|
614
|
+
constructor() {
|
|
615
|
+
if (new.target === N)
|
|
616
|
+
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* 根据键打开或聚焦窗口
|
|
620
|
+
* @param key 窗口的唯一键
|
|
621
|
+
* @param url 要打开的URL
|
|
622
|
+
* @param target 窗口的目标
|
|
623
|
+
* @param windowFeatures 新窗口的特性
|
|
624
|
+
* @returns 返回已打开或新打开的窗口
|
|
625
|
+
*/
|
|
626
|
+
static open(t, e, o, r) {
|
|
627
|
+
const i = this.keys.get(t);
|
|
628
|
+
if (i && !i.closed)
|
|
629
|
+
return i.focus(), i;
|
|
630
|
+
{
|
|
631
|
+
const s = window.open(e, o, r);
|
|
632
|
+
if (s)
|
|
633
|
+
return this.keys.set(t, s), s.addEventListener("unload", () => this.keys.delete(t)), s;
|
|
634
|
+
console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(t);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
/**
|
|
638
|
+
* 关闭与指定键关联的窗口
|
|
639
|
+
* @param key 窗口的唯一键
|
|
640
|
+
*/
|
|
641
|
+
static close(t) {
|
|
642
|
+
const e = this.keys.get(t);
|
|
643
|
+
e && !e.closed && (e.close(), this.keys.delete(t));
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* 检查指定键的窗口是否打开
|
|
647
|
+
* @param key 窗口的唯一键
|
|
648
|
+
* @returns 如果窗口打开则返回true,否则返回false
|
|
649
|
+
*/
|
|
650
|
+
static isOpen(t) {
|
|
651
|
+
const e = this.keys.get(t);
|
|
652
|
+
return !!e && !e.closed;
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* 获取与指定键关联的窗口
|
|
656
|
+
* @param key 窗口的唯一键
|
|
657
|
+
* @returns 返回对应的窗口,如果窗口已关闭则返回undefined
|
|
658
|
+
*/
|
|
659
|
+
static getWindow(t) {
|
|
660
|
+
const e = this.keys.get(t);
|
|
661
|
+
if (e && !e.closed) return e;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* 关闭所有打开的窗口并清空Map
|
|
665
|
+
*/
|
|
666
|
+
static closeAll() {
|
|
667
|
+
this.keys.forEach((t, e) => {
|
|
668
|
+
t.closed || t.close(), this.keys.delete(e);
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
};
|
|
672
|
+
// 存储键与对应窗口的Map
|
|
673
|
+
y(N, "keys", /* @__PURE__ */ new Map());
|
|
674
|
+
let Z = N;
|
|
675
|
+
function Ue(n, t = "image/png") {
|
|
676
|
+
try {
|
|
677
|
+
let e, o = t;
|
|
678
|
+
if (n instanceof File)
|
|
679
|
+
return URL.createObjectURL(n);
|
|
680
|
+
if (typeof n == "string") {
|
|
681
|
+
let i = n;
|
|
682
|
+
const s = i.match(/^data:([^;]*)(;base64)?,(.*)$/i);
|
|
683
|
+
if (s) {
|
|
684
|
+
if (!s[2])
|
|
685
|
+
throw new Error("无效的数据 URL:缺少 base64 编码声明");
|
|
686
|
+
if (o = s[1] || o, i = s[3], !i)
|
|
687
|
+
throw new Error("数据 URL 包含空有效负载");
|
|
688
|
+
}
|
|
689
|
+
i = i.replace(/[^A-Za-z0-9+/=]/g, "");
|
|
690
|
+
const a = atob(i);
|
|
691
|
+
e = new Uint8Array(a.length);
|
|
692
|
+
for (let m = 0; m < a.length; m++)
|
|
693
|
+
e[m] = a.charCodeAt(m);
|
|
694
|
+
} else if (n instanceof ArrayBuffer)
|
|
695
|
+
e = new Uint8Array(n);
|
|
696
|
+
else if (n instanceof Uint8Array)
|
|
697
|
+
e = n;
|
|
698
|
+
else
|
|
699
|
+
throw new Error(
|
|
700
|
+
"不支持的数据类型。应为 Base64 字符串、ArrayBuffer 或 Uint8Array"
|
|
701
|
+
);
|
|
702
|
+
const r = new Blob([e], { type: o });
|
|
703
|
+
return URL.createObjectURL(r);
|
|
704
|
+
} catch (e) {
|
|
705
|
+
return console.error(
|
|
706
|
+
"数据到 ImageURL 的转换失败:",
|
|
707
|
+
e.message,
|
|
708
|
+
e.stack || "没有可用的堆栈跟踪"
|
|
709
|
+
), null;
|
|
608
710
|
}
|
|
609
711
|
}
|
|
610
|
-
function
|
|
611
|
-
const
|
|
612
|
-
let
|
|
613
|
-
return function(
|
|
614
|
-
const
|
|
615
|
-
if (!
|
|
712
|
+
function Pe(n) {
|
|
713
|
+
const t = ne(n, 100);
|
|
714
|
+
let e = 0, o = 0;
|
|
715
|
+
return function(r) {
|
|
716
|
+
const i = r.target;
|
|
717
|
+
if (!i || !(i instanceof HTMLElement)) return;
|
|
616
718
|
const {
|
|
617
|
-
scrollTop:
|
|
719
|
+
scrollTop: s,
|
|
618
720
|
scrollHeight: a,
|
|
619
721
|
clientHeight: m,
|
|
620
722
|
scrollLeft: u,
|
|
621
723
|
scrollWidth: f,
|
|
622
|
-
clientWidth:
|
|
623
|
-
} =
|
|
624
|
-
function
|
|
625
|
-
if (
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
628
|
-
a -
|
|
724
|
+
clientWidth: g
|
|
725
|
+
} = i;
|
|
726
|
+
function A() {
|
|
727
|
+
if (e == s) return;
|
|
728
|
+
const q = e > s;
|
|
729
|
+
if (e = s, q) return;
|
|
730
|
+
a - s - m <= 1 && t("vertical");
|
|
629
731
|
}
|
|
630
|
-
function
|
|
732
|
+
function J() {
|
|
631
733
|
if (o == u) return;
|
|
632
|
-
const
|
|
633
|
-
if (o = u,
|
|
634
|
-
f - u -
|
|
734
|
+
const q = o > u;
|
|
735
|
+
if (o = u, q) return;
|
|
736
|
+
f - u - g <= 1 && t("horizontal");
|
|
635
737
|
}
|
|
636
|
-
|
|
738
|
+
A(), J();
|
|
637
739
|
};
|
|
638
740
|
}
|
|
639
|
-
function
|
|
640
|
-
const { isClickAllowed: o, uiLibrary:
|
|
741
|
+
function ze(n, t, e) {
|
|
742
|
+
const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } = e || {}, i = function(m) {
|
|
641
743
|
const u = [];
|
|
642
744
|
for (const f in m)
|
|
643
|
-
Object.hasOwnProperty.call(m, f) &&
|
|
745
|
+
Object.hasOwnProperty.call(m, f) && r.includes(f) && u.push(...m[f]);
|
|
644
746
|
return u;
|
|
645
747
|
}({
|
|
646
748
|
naiveUI: [
|
|
@@ -651,38 +753,38 @@ function Mt(n, e, t) {
|
|
|
651
753
|
ElementPlus: [".el-popper"],
|
|
652
754
|
Element: [".el-popper"]
|
|
653
755
|
});
|
|
654
|
-
function
|
|
655
|
-
|
|
756
|
+
function s() {
|
|
757
|
+
t(), document.removeEventListener("mousedown", a);
|
|
656
758
|
}
|
|
657
759
|
function a(m) {
|
|
658
760
|
if (o) {
|
|
659
|
-
const
|
|
660
|
-
if (
|
|
661
|
-
if (
|
|
761
|
+
const g = o(m);
|
|
762
|
+
if (g) return;
|
|
763
|
+
if (g === !1) return s();
|
|
662
764
|
}
|
|
663
765
|
const u = m.target;
|
|
664
766
|
if (!(u instanceof HTMLElement) || !(u != null && u.closest("body"))) return;
|
|
665
|
-
n.concat(
|
|
767
|
+
n.concat(i).some((g) => !!(u != null && u.closest(g))) || s();
|
|
666
768
|
}
|
|
667
769
|
requestAnimationFrame(
|
|
668
770
|
() => document.addEventListener("mousedown", a)
|
|
669
771
|
);
|
|
670
772
|
}
|
|
671
|
-
var
|
|
672
|
-
class
|
|
773
|
+
var w, j, M, U, P, E, C, L, z;
|
|
774
|
+
class De {
|
|
673
775
|
constructor() {
|
|
674
|
-
d(this,
|
|
675
|
-
d(this,
|
|
676
|
-
d(this,
|
|
677
|
-
d(this,
|
|
776
|
+
d(this, w);
|
|
777
|
+
d(this, j, !1);
|
|
778
|
+
d(this, M, {});
|
|
779
|
+
d(this, U, 0);
|
|
678
780
|
d(this, P, 0);
|
|
679
|
-
d(this,
|
|
680
|
-
d(this,
|
|
681
|
-
d(this,
|
|
682
|
-
d(this,
|
|
781
|
+
d(this, E, 0);
|
|
782
|
+
d(this, C, 0);
|
|
783
|
+
d(this, L);
|
|
784
|
+
d(this, z);
|
|
683
785
|
}
|
|
684
|
-
init(
|
|
685
|
-
l(this,
|
|
786
|
+
init(t, e) {
|
|
787
|
+
l(this, w, t), l(this, L, e == null ? void 0 : e.limit), l(this, z, e == null ? void 0 : e.dragDom), l(this, M, {
|
|
686
788
|
mousedown: this.mousedown.bind(this),
|
|
687
789
|
mousemove: this.mousemove.bind(this),
|
|
688
790
|
mouseup: this.mouseup.bind(this)
|
|
@@ -691,47 +793,47 @@ class Lt {
|
|
|
691
793
|
finish() {
|
|
692
794
|
this.bindOrUnbindEvent("unbind");
|
|
693
795
|
}
|
|
694
|
-
bindOrUnbindEvent(
|
|
695
|
-
const
|
|
696
|
-
if (!
|
|
697
|
-
|
|
796
|
+
bindOrUnbindEvent(t) {
|
|
797
|
+
const e = t === "bind" ? "addEventListener" : "removeEventListener";
|
|
798
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
799
|
+
c(this, w)[e]("mousedown", c(this, M).mousedown), document[e]("mousemove", c(this, M).mousemove), document[e]("mouseup", c(this, M).mouseup);
|
|
698
800
|
}
|
|
699
801
|
alterLocation() {
|
|
700
|
-
if (!
|
|
701
|
-
|
|
802
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
803
|
+
c(this, L) && (l(this, E, Math.min(c(this, E), c(this, L).max.top)), l(this, E, Math.max(c(this, E), c(this, L).min.top)), l(this, C, Math.min(c(this, C), c(this, L).max.left)), l(this, C, Math.max(c(this, C), c(this, L).min.left))), c(this, w).style.setProperty("--top", c(this, E) + "px"), c(this, w).style.setProperty("--left", c(this, C) + "px");
|
|
702
804
|
}
|
|
703
|
-
mousedown(
|
|
704
|
-
if (!
|
|
705
|
-
if (
|
|
706
|
-
document.body.classList.add("no-select"), l(this,
|
|
707
|
-
const
|
|
708
|
-
l(this,
|
|
805
|
+
mousedown(t) {
|
|
806
|
+
if (!c(this, w)) return console.error("No DOM");
|
|
807
|
+
if (c(this, z) && t.target != c(this, z)) return;
|
|
808
|
+
document.body.classList.add("no-select"), l(this, j, !0);
|
|
809
|
+
const e = c(this, w).getBoundingClientRect(), { pageX: o, pageY: r } = t;
|
|
810
|
+
l(this, U, o), l(this, P, r), l(this, E, e.y), l(this, C, e.x);
|
|
709
811
|
}
|
|
710
|
-
mousemove(
|
|
711
|
-
const { pageX:
|
|
712
|
-
|
|
812
|
+
mousemove(t) {
|
|
813
|
+
const { pageX: e, pageY: o } = t;
|
|
814
|
+
c(this, j) && (l(this, E, c(this, E) + (o - c(this, P))), l(this, C, c(this, C) + (e - c(this, U))), l(this, U, e), l(this, P, o), this.alterLocation());
|
|
713
815
|
}
|
|
714
816
|
mouseup() {
|
|
715
|
-
|
|
817
|
+
c(this, j) && (l(this, j, !1), document.body.classList.remove("no-select"));
|
|
716
818
|
}
|
|
717
819
|
}
|
|
718
|
-
|
|
719
|
-
var x,
|
|
720
|
-
class
|
|
820
|
+
w = new WeakMap(), j = new WeakMap(), M = new WeakMap(), U = new WeakMap(), P = new WeakMap(), E = new WeakMap(), C = new WeakMap(), L = new WeakMap(), z = new WeakMap();
|
|
821
|
+
var x, R, T, D, I, v, b, p, O, _;
|
|
822
|
+
class Ie {
|
|
721
823
|
constructor() {
|
|
722
824
|
d(this, x);
|
|
723
|
-
d(this,
|
|
724
|
-
d(this,
|
|
725
|
-
d(this,
|
|
726
|
-
d(this,
|
|
727
|
-
d(this, b, 0);
|
|
825
|
+
d(this, R, !1);
|
|
826
|
+
d(this, T, {});
|
|
827
|
+
d(this, D, 0);
|
|
828
|
+
d(this, I, 0);
|
|
728
829
|
d(this, v, 0);
|
|
729
|
-
d(this,
|
|
730
|
-
d(this,
|
|
731
|
-
d(this,
|
|
830
|
+
d(this, b, 0);
|
|
831
|
+
d(this, p);
|
|
832
|
+
d(this, O);
|
|
833
|
+
d(this, _);
|
|
732
834
|
}
|
|
733
|
-
init(
|
|
734
|
-
l(this, x,
|
|
835
|
+
init(t, e = {}) {
|
|
836
|
+
l(this, x, t), l(this, p, e.limit), l(this, O, e.update_move), l(this, _, e.update_up), l(this, T, {
|
|
735
837
|
mousedown: this.mousedown.bind(this),
|
|
736
838
|
mousemove: this.mousemove.bind(this),
|
|
737
839
|
mouseup: this.mouseup.bind(this)
|
|
@@ -740,172 +842,304 @@ class Rt {
|
|
|
740
842
|
finish() {
|
|
741
843
|
this.bindOrUnbindEvent("unbind");
|
|
742
844
|
}
|
|
743
|
-
bindOrUnbindEvent(
|
|
744
|
-
const
|
|
745
|
-
if (!
|
|
746
|
-
|
|
845
|
+
bindOrUnbindEvent(t) {
|
|
846
|
+
const e = t === "bind" ? "addEventListener" : "removeEventListener";
|
|
847
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
848
|
+
c(this, x)[e]("mousedown", c(this, T).mousedown), document[e]("mousemove", c(this, T).mousemove), document[e]("mouseup", c(this, T).mouseup);
|
|
747
849
|
}
|
|
748
850
|
updateValue() {
|
|
749
|
-
const
|
|
750
|
-
top:
|
|
751
|
-
left:
|
|
851
|
+
const t = {
|
|
852
|
+
top: c(this, v),
|
|
853
|
+
left: c(this, b),
|
|
752
854
|
percentage: { top: 0, left: 0 }
|
|
753
855
|
};
|
|
754
|
-
if (
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
top:
|
|
758
|
-
left:
|
|
856
|
+
if (c(this, p)) {
|
|
857
|
+
const e = (o) => c(this, p) ? (t[o] - c(this, p).min[o]) / (c(this, p).max[o] - c(this, p).min[o]) : 0;
|
|
858
|
+
t.percentage = {
|
|
859
|
+
top: e("top") || 0,
|
|
860
|
+
left: e("left") || 0
|
|
759
861
|
};
|
|
760
862
|
}
|
|
761
|
-
return
|
|
863
|
+
return t;
|
|
762
864
|
}
|
|
763
865
|
alterLocation() {
|
|
764
|
-
if (!
|
|
765
|
-
|
|
866
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
867
|
+
c(this, p) && (l(this, v, Math.min(c(this, v), c(this, p).max.top)), l(this, v, Math.max(c(this, v), c(this, p).min.top)), l(this, b, Math.min(c(this, b), c(this, p).max.left)), l(this, b, Math.max(c(this, b), c(this, p).min.left))), c(this, O) && c(this, O).call(this, this.updateValue()), c(this, x).style.setProperty("--top", c(this, v) + "px"), c(this, x).style.setProperty("--left", c(this, b) + "px");
|
|
766
868
|
}
|
|
767
|
-
mousedown(
|
|
768
|
-
if (!
|
|
769
|
-
document.body.classList.add("no-select"), l(this,
|
|
770
|
-
const
|
|
771
|
-
l(this,
|
|
772
|
-
const { pageX: o, pageY:
|
|
773
|
-
l(this,
|
|
869
|
+
mousedown(t) {
|
|
870
|
+
if (!c(this, x)) return console.error("No DOM");
|
|
871
|
+
document.body.classList.add("no-select"), l(this, R, !0);
|
|
872
|
+
const e = c(this, x).getBoundingClientRect();
|
|
873
|
+
l(this, I, e.y), l(this, D, e.x);
|
|
874
|
+
const { pageX: o, pageY: r } = t;
|
|
875
|
+
l(this, v, r - c(this, I)), l(this, b, o - c(this, D)), this.alterLocation();
|
|
774
876
|
}
|
|
775
|
-
mousemove(
|
|
776
|
-
const { pageX:
|
|
777
|
-
|
|
877
|
+
mousemove(t) {
|
|
878
|
+
const { pageX: e, pageY: o } = t;
|
|
879
|
+
c(this, R) && (l(this, v, o - c(this, I)), l(this, b, e - c(this, D)), this.alterLocation());
|
|
778
880
|
}
|
|
779
881
|
mouseup() {
|
|
780
|
-
|
|
882
|
+
c(this, R) && (l(this, R, !1), document.body.classList.remove("no-select"), c(this, _) && c(this, _).call(this, this.updateValue()));
|
|
781
883
|
}
|
|
782
884
|
}
|
|
783
|
-
x = new WeakMap(),
|
|
784
|
-
function
|
|
785
|
-
const
|
|
885
|
+
x = new WeakMap(), R = new WeakMap(), T = new WeakMap(), D = new WeakMap(), I = new WeakMap(), v = new WeakMap(), b = new WeakMap(), p = new WeakMap(), O = new WeakMap(), _ = new WeakMap();
|
|
886
|
+
function oe(n) {
|
|
887
|
+
const t = n;
|
|
786
888
|
if (n) {
|
|
787
889
|
if (n.requestFullscreen)
|
|
788
890
|
return n.requestFullscreen();
|
|
789
|
-
if (
|
|
790
|
-
return
|
|
791
|
-
if (
|
|
792
|
-
return
|
|
793
|
-
if (
|
|
794
|
-
return
|
|
891
|
+
if (t.mozRequestFullScreen)
|
|
892
|
+
return t.mozRequestFullScreen();
|
|
893
|
+
if (t.webkitRequestFullscreen)
|
|
894
|
+
return t.webkitRequestFullscreen();
|
|
895
|
+
if (t.msRequestFullscreen)
|
|
896
|
+
return t.msRequestFullscreen();
|
|
795
897
|
} else return Promise.reject("No DOM");
|
|
796
898
|
return Promise.reject("No Fullscreen API");
|
|
797
899
|
}
|
|
798
|
-
function
|
|
900
|
+
function re() {
|
|
799
901
|
const n = document;
|
|
800
902
|
return document.exitFullscreen ? document.exitFullscreen() : n.mozCancelFullScreen ? n.mozCancelFullScreen() : n.webkitExitFullscreen ? n.webkitExitFullscreen() : n.msExitFullscreen ? n.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
801
903
|
}
|
|
802
|
-
function
|
|
904
|
+
function ie() {
|
|
803
905
|
const n = document;
|
|
804
906
|
return document.fullscreenElement || n.webkitFullscreenElement || n.mozFullScreenElement || n.msFullscreenElement;
|
|
805
907
|
}
|
|
806
|
-
function
|
|
908
|
+
function Oe(n) {
|
|
807
909
|
return function() {
|
|
808
|
-
|
|
910
|
+
ie() ? re() : oe(n);
|
|
809
911
|
};
|
|
810
912
|
}
|
|
811
|
-
function
|
|
913
|
+
function _e(n, t) {
|
|
812
914
|
if (typeof n == "number") return n;
|
|
813
915
|
if (/px/.test(n)) return Number(n.replace(/px/, "")) || 0;
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
const o =
|
|
817
|
-
return
|
|
916
|
+
const e = document.createElement("div");
|
|
917
|
+
e.style.width = n, t = t || document.body, t.appendChild(e);
|
|
918
|
+
const o = e.getBoundingClientRect().width;
|
|
919
|
+
return t.removeChild(e), o;
|
|
920
|
+
}
|
|
921
|
+
function Se(n, t) {
|
|
922
|
+
if (!n) return;
|
|
923
|
+
let e, o;
|
|
924
|
+
if (typeof t == "string") {
|
|
925
|
+
const i = document.querySelector(t);
|
|
926
|
+
if (!i) return;
|
|
927
|
+
const s = i.getBoundingClientRect();
|
|
928
|
+
e = s.width, o = s.height;
|
|
929
|
+
} else if (Array.isArray(t))
|
|
930
|
+
e = t[0], o = t[1];
|
|
931
|
+
else {
|
|
932
|
+
const i = t.getBoundingClientRect();
|
|
933
|
+
e = i.width, o = i.height;
|
|
934
|
+
}
|
|
935
|
+
const r = e / o;
|
|
936
|
+
return r > n ? [n * o, o] : r < n ? [e, e / n] : [e, o];
|
|
937
|
+
}
|
|
938
|
+
function Ae(n, t = 5e3) {
|
|
939
|
+
return new Promise((e, o) => {
|
|
940
|
+
const r = new Image();
|
|
941
|
+
r.src = n;
|
|
942
|
+
const i = setTimeout(() => {
|
|
943
|
+
o(new Error("图片加载超时")), r.onload = null, r.onerror = null;
|
|
944
|
+
}, t);
|
|
945
|
+
r.onload = () => {
|
|
946
|
+
clearTimeout(i);
|
|
947
|
+
const s = r.naturalWidth, a = r.naturalHeight, m = s / a;
|
|
948
|
+
e([r, m]);
|
|
949
|
+
}, r.onerror = () => {
|
|
950
|
+
clearTimeout(i), o(new Error("图片加载失败"));
|
|
951
|
+
}, r.crossOrigin = "Anonymous";
|
|
952
|
+
});
|
|
818
953
|
}
|
|
819
|
-
function
|
|
820
|
-
return !Number.isFinite(n) || !Number.isFinite(
|
|
954
|
+
function Ne(n, t, e = 2) {
|
|
955
|
+
return !Number.isFinite(n) || !Number.isFinite(t) || !Number.isFinite(e) ? (console.error("所有参数必须是有限的数字"), "") : t === 0 ? (console.error("分母不能为零"), "") : e < 0 ? (console.error("小数位数不能为负数"), "") : (n / t * 100).toFixed(e) + "%";
|
|
821
956
|
}
|
|
822
|
-
function
|
|
823
|
-
return Math.abs(n -
|
|
957
|
+
function qe(n, t, e) {
|
|
958
|
+
return Math.abs(n - t) <= e;
|
|
824
959
|
}
|
|
825
|
-
function
|
|
826
|
-
let
|
|
827
|
-
function o(
|
|
828
|
-
|
|
829
|
-
let
|
|
830
|
-
n(
|
|
960
|
+
function $e(n, t = 500) {
|
|
961
|
+
let e;
|
|
962
|
+
function o(r) {
|
|
963
|
+
e || (e = r);
|
|
964
|
+
let i = Math.min((r - e) / t, 1);
|
|
965
|
+
n(i), r - e < t && requestAnimationFrame(o);
|
|
831
966
|
}
|
|
832
967
|
requestAnimationFrame(o);
|
|
833
968
|
}
|
|
834
|
-
function
|
|
969
|
+
function Ye(n) {
|
|
835
970
|
return n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
836
971
|
}
|
|
837
|
-
function
|
|
838
|
-
const
|
|
972
|
+
function Be(n, t) {
|
|
973
|
+
const e = {
|
|
839
974
|
join: !0,
|
|
840
975
|
suffix: "",
|
|
841
976
|
decimalPlaces: 2
|
|
842
|
-
}, { join: o, suffix:
|
|
843
|
-
...
|
|
844
|
-
...
|
|
845
|
-
},
|
|
846
|
-
if (isNaN(
|
|
847
|
-
const a = Math.abs(
|
|
848
|
-
return o ? `${
|
|
849
|
-
}
|
|
850
|
-
function
|
|
851
|
-
let
|
|
852
|
-
const { x: o, y:
|
|
853
|
-
for (let
|
|
854
|
-
const m =
|
|
855
|
-
u >
|
|
856
|
-
}
|
|
857
|
-
return
|
|
858
|
-
}
|
|
859
|
-
function
|
|
860
|
-
const
|
|
861
|
-
let
|
|
977
|
+
}, { join: o, suffix: r, decimalPlaces: i } = {
|
|
978
|
+
...e,
|
|
979
|
+
...t || {}
|
|
980
|
+
}, s = Number(n);
|
|
981
|
+
if (isNaN(s)) return o ? `0${r}` : [0, r];
|
|
982
|
+
const a = Math.abs(s), m = s >= 0, u = Math.max(0, Math.floor(Math.log10(a) / 4)), f = Math.pow(1e4, u), g = a / f, A = (m ? 1 : -1) * parseFloat(g.toFixed(Math.max(0, i)));
|
|
983
|
+
return o ? `${A}${W[u]}${r}` : [A, W[u] + r];
|
|
984
|
+
}
|
|
985
|
+
function He(n, t) {
|
|
986
|
+
let e = !1;
|
|
987
|
+
const { x: o, y: r } = n, i = t.length;
|
|
988
|
+
for (let s = 0, a = i - 1; s < i; a = s++) {
|
|
989
|
+
const m = t[s].x, u = t[s].y, f = t[a].x, g = t[a].y;
|
|
990
|
+
u > r != g > r && o < (f - m) * (r - u) / (g - u) + m && (e = !e);
|
|
991
|
+
}
|
|
992
|
+
return e;
|
|
993
|
+
}
|
|
994
|
+
function Xe(n) {
|
|
995
|
+
const t = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
996
|
+
let e = 0;
|
|
862
997
|
for (; n > 1024; )
|
|
863
|
-
n /= 1024,
|
|
864
|
-
return `${Math.round(n * 100) / 100} ${e
|
|
998
|
+
n /= 1024, e++;
|
|
999
|
+
return `${Math.round(n * 100) / 100} ${t[e]}`;
|
|
1000
|
+
}
|
|
1001
|
+
class k {
|
|
1002
|
+
constructor(t, e) {
|
|
1003
|
+
y(this, "resolve");
|
|
1004
|
+
y(this, "reject");
|
|
1005
|
+
this.resolve = t, this.reject = e;
|
|
1006
|
+
}
|
|
1007
|
+
run(t) {
|
|
1008
|
+
var e, o;
|
|
1009
|
+
return t instanceof Promise ? t.then((r) => {
|
|
1010
|
+
var i;
|
|
1011
|
+
return (i = this.resolve) == null || i.call(this), r;
|
|
1012
|
+
}).catch((r) => {
|
|
1013
|
+
var i;
|
|
1014
|
+
return (i = this.reject) == null || i.call(this), Promise.reject(r);
|
|
1015
|
+
}) : t ? (e = this.resolve) == null || e.call(this) : (o = this.reject) == null || o.call(this), t;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
class se extends k {
|
|
1019
|
+
constructor(t) {
|
|
1020
|
+
super(), this.resolve = t;
|
|
1021
|
+
}
|
|
1022
|
+
warning(...t) {
|
|
1023
|
+
const e = () => {
|
|
1024
|
+
var o, r;
|
|
1025
|
+
return (r = (o = S.tips).warning) == null ? void 0 : r.call(o, ...t);
|
|
1026
|
+
};
|
|
1027
|
+
return new k(this.resolve, e);
|
|
1028
|
+
}
|
|
1029
|
+
error(...t) {
|
|
1030
|
+
const e = () => {
|
|
1031
|
+
var o, r;
|
|
1032
|
+
return (r = (o = S.tips).error) == null ? void 0 : r.call(o, ...t);
|
|
1033
|
+
};
|
|
1034
|
+
return new k(this.resolve, e);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
class ce extends k {
|
|
1038
|
+
constructor(t) {
|
|
1039
|
+
super(), this.reject = t;
|
|
1040
|
+
}
|
|
1041
|
+
info(...t) {
|
|
1042
|
+
const e = () => {
|
|
1043
|
+
var o, r;
|
|
1044
|
+
return (r = (o = S.tips).info) == null ? void 0 : r.call(o, ...t);
|
|
1045
|
+
};
|
|
1046
|
+
return new k(e, this.reject);
|
|
1047
|
+
}
|
|
1048
|
+
success(...t) {
|
|
1049
|
+
const e = () => {
|
|
1050
|
+
var o, r;
|
|
1051
|
+
return (r = (o = S.tips).success) == null ? void 0 : r.call(o, ...t);
|
|
1052
|
+
};
|
|
1053
|
+
return new k(e, this.reject);
|
|
1054
|
+
}
|
|
865
1055
|
}
|
|
1056
|
+
const h = class h {
|
|
1057
|
+
/**
|
|
1058
|
+
* 构造函数
|
|
1059
|
+
* @throws 如果尝试实例化该类,则抛出错误,因为应该使用静态方法
|
|
1060
|
+
*/
|
|
1061
|
+
constructor() {
|
|
1062
|
+
if (new.target === h)
|
|
1063
|
+
throw new Error("请直接使用静态方法,而不是实例化此类");
|
|
1064
|
+
}
|
|
1065
|
+
static register(t, e) {
|
|
1066
|
+
if (typeof e != "function")
|
|
1067
|
+
return console.error("TipHandler must be a function");
|
|
1068
|
+
h.tips[t] = e;
|
|
1069
|
+
}
|
|
1070
|
+
static resolveTip(t) {
|
|
1071
|
+
return function(...e) {
|
|
1072
|
+
const o = () => {
|
|
1073
|
+
var r, i;
|
|
1074
|
+
return (i = (r = h.tips)[t]) == null ? void 0 : i.call(r, ...e);
|
|
1075
|
+
};
|
|
1076
|
+
return new se(o);
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
static rejectTip(t) {
|
|
1080
|
+
return function(...e) {
|
|
1081
|
+
const o = () => {
|
|
1082
|
+
var r, i;
|
|
1083
|
+
return (i = (r = h.tips)[t]) == null ? void 0 : i.call(r, ...e);
|
|
1084
|
+
};
|
|
1085
|
+
return new ce(o);
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
y(h, "tips", {
|
|
1090
|
+
info: void 0,
|
|
1091
|
+
success: void 0,
|
|
1092
|
+
warning: void 0,
|
|
1093
|
+
error: void 0
|
|
1094
|
+
}), y(h, "info", h.resolveTip("info")), y(h, "success", h.resolveTip("success")), y(h, "warning", h.rejectTip("warning")), y(h, "error", h.rejectTip("error"));
|
|
1095
|
+
let S = h;
|
|
866
1096
|
export {
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1097
|
+
Se as _CalculateCanvasSize,
|
|
1098
|
+
he as _CapitalizeFirstLetter,
|
|
1099
|
+
Me as _CheckConnectionWithXHR,
|
|
1100
|
+
ke as _Clone,
|
|
1101
|
+
ze as _CloseOnOutsideClick,
|
|
1102
|
+
ve as _ConvertToCamelCase,
|
|
1103
|
+
Ne as _ConvertToPercentage,
|
|
1104
|
+
Ce as _CopyToClipboard,
|
|
1105
|
+
be as _CreateAndDownloadFile,
|
|
1106
|
+
Ue as _Danger_ConvertDataToImageUrl,
|
|
1107
|
+
G as _DataType,
|
|
1108
|
+
ne as _Debounce,
|
|
1109
|
+
we as _DownloadFile,
|
|
1110
|
+
De as _Drag,
|
|
1111
|
+
oe as _EnterFullscreen,
|
|
1112
|
+
fe as _ExcludeSubstring,
|
|
1113
|
+
me as _ExecuteWhenIdle,
|
|
1114
|
+
re as _ExitFullscreen,
|
|
1115
|
+
V as _FileTypeChecker,
|
|
1116
|
+
Xe as _FormatFileSize,
|
|
1117
|
+
Ye as _FormatNumber,
|
|
1118
|
+
Be as _FormatNumberWithUnit,
|
|
1119
|
+
Oe as _Fullscreen,
|
|
1120
|
+
ye as _GenerateUUID,
|
|
1121
|
+
xe as _GetFrameRate,
|
|
1122
|
+
B as _GetHrefName,
|
|
1123
|
+
_e as _GetOtherSizeInPixels,
|
|
1124
|
+
Le as _GetTargetByPath,
|
|
1125
|
+
Fe as _InitTargetByPath,
|
|
1126
|
+
ie as _IsFullscreen,
|
|
1127
|
+
ue as _IsObject,
|
|
1128
|
+
He as _IsPointInPolygon,
|
|
1129
|
+
Re as _IsSecureContext,
|
|
1130
|
+
qe as _IsWithinErrorMargin,
|
|
1131
|
+
Z as _KeyedWindowManager,
|
|
1132
|
+
Ae as _LoadImage,
|
|
1133
|
+
Ie as _LocalDrag,
|
|
1134
|
+
Y as _MergeObjects,
|
|
1135
|
+
le as _NotNull,
|
|
1136
|
+
ge as _ReadFile,
|
|
1137
|
+
Te as _RotateList,
|
|
1138
|
+
$e as _Schedule,
|
|
1139
|
+
Pe as _ScrollEndListener,
|
|
1140
|
+
Ee as _Throttle,
|
|
1141
|
+
pe as _TimeTransition,
|
|
1142
|
+
S as _Tip,
|
|
1143
|
+
je as _UpdateTargetByPath,
|
|
1144
|
+
de as _WaitForCondition
|
|
911
1145
|
};
|