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