nhanh-pure-function 2.0.5 → 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 X = (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), W = (n, t, e) => t.has(n) || X("Cannot " + e);
8
- var c = (n, t, e) => (W(n, t, "read from private field"), e ? e.call(n) : t.get(n)), d = (n, t, e) => t.has(n) ? X("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), m = (n, t, e, o) => (W(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
- }, Y = {
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
- }, G = [
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
298
  return n.replace(o, function(r, i, s) {
299
- return i === s ? e : "";
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 B(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 = V(n), i = V(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(([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], u = n[s], l = B(u, a, e, o);
318
- n[s] = l;
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((s, a) => {
323
- const u = s, l = n[a], f = B(l, u, 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) => {
342
+ return e.replace(/YYYY|MM|DD|hh|mm|ss|ms/g, (i) => {
343
343
  const s = r[i](o);
344
- return e ? String(s).padStart(2, "0") : String(s);
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 H(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 || H(n, "downloaded_file"), fetch(n).then((r) => (r.ok || o(`文件下载失败,状态码: ${r.status}`), r.blob())).then((r) => {
362
+ e = e || X(n, "downloaded_file"), fetch(n).then((r) => (r.ok || o(`文件下载失败,状态码: ${r.status}`), r.blob())).then((r) => {
363
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
+ 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 s = (+/* @__PURE__ */ new Date() - e) / t, a = 1e3 / s;
377
+ const s = (+/* @__PURE__ */ new Date() - t) / e, a = 1e3 / s;
378
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 s = t.replace(/^[^.]+./, "");
391
- s = s == t ? "text/plain" : "application/" + s, e = { type: s };
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 V(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 u = document.createRange();
436
- u.selectNodeContents(a);
437
- const l = window.getSelection();
438
- let f = !1;
439
- return l && (l.removeAllRanges(), l.addRange(u), f = document.execCommand("copy")), document.body.removeChild(a), f ? Promise.resolve() : Promise.reject();
435
+ const l = document.createRange();
436
+ l.selectNodeContents(a);
437
+ const u = window.getSelection();
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 u = !1;
445
- return document.activeElement === a && (u = document.execCommand("Copy", !0)), document.body.removeChild(a), u ? 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
447
  function s() {
448
- return r().then(t).catch(() => {
449
- i().then(t).catch(() => e("复制方式尽皆失效"));
448
+ return r().then(e).catch(() => {
449
+ i().then(e).catch(() => t("复制方式尽皆失效"));
450
450
  });
451
451
  }
452
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 Me(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 Te(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);
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 Le(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 je(n) {
493
+ function kt(n) {
494
494
  return [
495
495
  "https:",
496
496
  // HTTPS协议,用于安全地浏览网页
@@ -512,24 +512,24 @@ function je(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 = H(t).toLowerCase();
526
- if (e) {
527
- if (!Y.hasOwnProperty(e))
528
- return console.error(`Unknown file type: ${e}`), "unknown";
529
- const r = Y[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 = H(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, s = "*"] = 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 [u, l = "*"] = a.split("/");
560
- return (u === "*" || i === "*" || u === i) && (l === "*" || s === "*" || l === s);
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(Y));
597
- let Z = F;
598
- function Re(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 : B(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 s = window.open(e, o, r);
630
+ const s = window.open(t, o, r);
632
631
  if (s)
633
- return this.keys.set(t, s), s;
634
- console.error("window.open failed: 可能是浏览器阻止了弹出窗口"), this.keys.delete(t);
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,39 +638,38 @@ 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 J = 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") {
@@ -685,86 +683,86 @@ function Ue(n, t = "image/png") {
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 u = 0; u < a.length; u++)
690
- e[u] = a.charCodeAt(u);
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, t) {
707
+ function It(n, e, t = 30) {
710
708
  if (typeof n != "function")
711
709
  throw new Error("The first argument must be a function.");
712
- if (!Array.isArray(t))
710
+ if (!Array.isArray(e))
713
711
  throw new Error("The second argument must be an array.");
714
- let e = [], o = 100, r = 0;
712
+ let o = [], r = 0;
715
713
  const i = (s, a) => {
716
- for (const [u, l] of a)
717
- if (s >= u)
718
- return l;
714
+ for (const [l, u] of a)
715
+ if (s >= l)
716
+ return u;
719
717
  return "black";
720
718
  };
721
719
  return function(...s) {
722
- const a = performance.now(), u = n(...s), l = performance.now() - a;
723
- e.push(l), e.length > o && e.shift(), r = e.reduce((T, q) => T + q, 0) / e.length || 0;
724
- const f = i(l, t), p = i(r, t);
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);
725
723
  return console.log(
726
- `%c单次耗时:${l.toFixed(2)}ms
727
- %c平均耗时(${e.length}次):${r.toFixed(2)}ms`,
728
- `color: ${f}; padding: 2px 0;`,
724
+ `%c单次耗时:${u.toFixed(2)}ms
725
+ %c平均耗时(${o.length}次):${r.toFixed(2)}ms`,
726
+ `color: ${d}; padding: 2px 0;`,
729
727
  `color: ${p}; padding: 2px 0;`
730
- ), u;
728
+ ), l;
731
729
  };
732
730
  }
733
- function De(n) {
734
- const t = ne(n, 100);
735
- let e = 0, o = 0;
731
+ function St(n) {
732
+ const e = nt(n, 100);
733
+ let t = 0, o = 0;
736
734
  return function(r) {
737
735
  const i = r.target;
738
- if (!i || !(i instanceof HTMLElement)) return;
736
+ if (!i || !(i instanceof Element)) return;
739
737
  const {
740
738
  scrollTop: s,
741
739
  scrollHeight: a,
742
- clientHeight: u,
743
- scrollLeft: l,
744
- scrollWidth: f,
740
+ clientHeight: l,
741
+ scrollLeft: u,
742
+ scrollWidth: d,
745
743
  clientWidth: p
746
744
  } = i;
747
- function T() {
748
- if (e == s) return;
749
- const $ = e > s;
750
- if (e = s, $) return;
751
- a - s - u <= 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");
752
750
  }
753
- function q() {
754
- if (o == l) return;
755
- const $ = o > l;
756
- if (o = l, $) return;
757
- f - l - p <= 1 && t("horizontal");
751
+ function $() {
752
+ if (o == u) return;
753
+ const Y = o > u;
754
+ if (o = u, Y) return;
755
+ d - u - p <= 1 && e("horizontal");
758
756
  }
759
- T(), q();
757
+ L(), $();
760
758
  };
761
759
  }
762
- function _e(n, t, e) {
763
- const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } = e || {}, i = function(u) {
764
- const l = [];
765
- for (const f in u)
766
- Object.hasOwnProperty.call(u, f) && r.includes(f) && l.push(...u[f]);
767
- return l;
760
+ function Ot(n, e, t) {
761
+ const { isClickAllowed: o, uiLibrary: r = ["naiveUI", "ElementPlus", "Element"] } = t || {}, i = function(l) {
762
+ const u = [];
763
+ for (const d in l)
764
+ Object.hasOwnProperty.call(l, d) && r.includes(d) && u.push(...l[d]);
765
+ return u;
768
766
  }({
769
767
  naiveUI: [
770
768
  ".v-binder-follower-container",
@@ -775,37 +773,37 @@ function _e(n, t, e) {
775
773
  Element: [".el-popper"]
776
774
  });
777
775
  function s() {
778
- t(), document.removeEventListener("mousedown", a);
776
+ e(), document.removeEventListener("mousedown", a);
779
777
  }
780
- function a(u) {
778
+ function a(l) {
781
779
  if (o) {
782
- const p = o(u);
780
+ const p = o(l);
783
781
  if (p) return;
784
782
  if (p === !1) return s();
785
783
  }
786
- const l = u.target;
787
- if (!(l instanceof HTMLElement) || !(l != null && l.closest("body"))) return;
788
- n.concat(i).some((p) => !!(l != null && l.closest(p))) || s();
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();
789
787
  }
790
788
  requestAnimationFrame(
791
789
  () => document.addEventListener("mousedown", a)
792
790
  );
793
791
  }
794
- var w, L, j, P, D, E, C, M, _;
795
- class ze {
792
+ var w, T, R, k, A, E, M, F, U;
793
+ class zt {
796
794
  constructor() {
797
- d(this, w);
798
- d(this, L, !1);
799
- d(this, j, {});
800
- d(this, P, 0);
801
- d(this, D, 0);
802
- d(this, E, 0);
803
- d(this, C, 0);
804
- d(this, M);
805
- d(this, _);
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);
806
804
  }
807
- init(t, e) {
808
- m(this, w, t), m(this, M, e == null ? void 0 : e.limit), m(this, _, e == null ? void 0 : e.dragDom), m(this, j, {
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, {
809
807
  mousedown: this.mousedown.bind(this),
810
808
  mousemove: this.mousemove.bind(this),
811
809
  mouseup: this.mouseup.bind(this)
@@ -814,47 +812,47 @@ class ze {
814
812
  finish() {
815
813
  this.bindOrUnbindEvent("unbind");
816
814
  }
817
- bindOrUnbindEvent(t) {
818
- const e = t === "bind" ? "addEventListener" : "removeEventListener";
815
+ bindOrUnbindEvent(e) {
816
+ const t = e === "bind" ? "addEventListener" : "removeEventListener";
819
817
  if (!c(this, w)) return console.error("No DOM");
820
- c(this, w)[e]("mousedown", c(this, j).mousedown), document[e]("mousemove", c(this, j).mousemove), document[e]("mouseup", c(this, j).mouseup);
818
+ c(this, w)[t]("mousedown", c(this, R).mousedown), document[t]("mousemove", c(this, R).mousemove), document[t]("mouseup", c(this, R).mouseup);
821
819
  }
822
820
  alterLocation() {
823
821
  if (!c(this, w)) return console.error("No DOM");
824
- c(this, M) && (m(this, E, Math.min(c(this, E), c(this, M).max.top)), m(this, E, Math.max(c(this, E), c(this, M).min.top)), m(this, C, Math.min(c(this, C), c(this, M).max.left)), m(this, C, Math.max(c(this, C), c(this, M).min.left))), c(this, w).style.setProperty("--top", c(this, E) + "px"), c(this, w).style.setProperty("--left", c(this, C) + "px");
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");
825
823
  }
826
- mousedown(t) {
824
+ mousedown(e) {
827
825
  if (!c(this, w)) return console.error("No DOM");
828
- if (c(this, _) && t.target != c(this, _)) return;
829
- document.body.classList.add("no-select"), m(this, L, !0);
830
- const e = c(this, w).getBoundingClientRect(), { pageX: o, pageY: r } = t;
831
- m(this, P, o), m(this, D, r), m(this, E, e.y), m(this, C, e.x);
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);
832
830
  }
833
- mousemove(t) {
834
- const { pageX: e, pageY: o } = t;
835
- c(this, L) && (m(this, E, c(this, E) + (o - c(this, D))), m(this, C, c(this, C) + (e - c(this, P))), m(this, P, e), m(this, D, 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());
836
834
  }
837
835
  mouseup() {
838
- c(this, L) && (m(this, L, !1), document.body.classList.remove("no-select"));
836
+ c(this, T) && (m(this, T, !1), document.body.classList.remove("no-select"));
839
837
  }
840
838
  }
841
- w = new WeakMap(), L = new WeakMap(), j = new WeakMap(), P = new WeakMap(), D = new WeakMap(), E = new WeakMap(), C = new WeakMap(), M = new WeakMap(), _ = new WeakMap();
842
- var x, R, k, z, I, v, b, g, O, A;
843
- 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 {
844
842
  constructor() {
845
- d(this, x);
846
- d(this, R, !1);
847
- d(this, k, {});
848
- d(this, z, 0);
849
- d(this, I, 0);
850
- d(this, v, 0);
851
- d(this, b, 0);
852
- d(this, g);
853
- d(this, O);
854
- d(this, A);
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);
855
853
  }
856
- init(t, e = {}) {
857
- m(this, x, t), m(this, g, e.limit), m(this, O, e.update_move), m(this, A, e.update_up), m(this, k, {
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, {
858
856
  mousedown: this.mousedown.bind(this),
859
857
  mousemove: this.mousemove.bind(this),
860
858
  mouseup: this.mouseup.bind(this)
@@ -863,223 +861,261 @@ class Ie {
863
861
  finish() {
864
862
  this.bindOrUnbindEvent("unbind");
865
863
  }
866
- bindOrUnbindEvent(t) {
867
- const e = t === "bind" ? "addEventListener" : "removeEventListener";
864
+ bindOrUnbindEvent(e) {
865
+ const t = e === "bind" ? "addEventListener" : "removeEventListener";
868
866
  if (!c(this, x)) return console.error("No DOM");
869
- c(this, x)[e]("mousedown", c(this, k).mousedown), document[e]("mousemove", c(this, k).mousemove), document[e]("mouseup", c(this, k).mouseup);
867
+ c(this, x)[t]("mousedown", c(this, P).mousedown), document[t]("mousemove", c(this, P).mousemove), document[t]("mouseup", c(this, P).mouseup);
870
868
  }
871
869
  updateValue() {
872
- const t = {
870
+ const e = {
873
871
  top: c(this, v),
874
872
  left: c(this, b),
875
873
  percentage: { top: 0, left: 0 }
876
874
  };
877
875
  if (c(this, g)) {
878
- const e = (o) => c(this, g) ? (t[o] - c(this, g).min[o]) / (c(this, g).max[o] - c(this, g).min[o]) : 0;
879
- t.percentage = {
880
- top: e("top") || 0,
881
- left: e("left") || 0
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
882
880
  };
883
881
  }
884
- return t;
882
+ return e;
885
883
  }
886
884
  alterLocation() {
887
885
  if (!c(this, x)) return console.error("No DOM");
888
- 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, 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");
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");
889
887
  }
890
- mousedown(t) {
888
+ mousedown(e) {
891
889
  if (!c(this, x)) return console.error("No DOM");
892
- document.body.classList.add("no-select"), m(this, R, !0);
893
- const e = c(this, x).getBoundingClientRect();
894
- m(this, I, e.y), m(this, z, e.x);
895
- const { pageX: o, pageY: r } = t;
896
- m(this, v, r - c(this, I)), m(this, b, o - c(this, z)), this.alterLocation();
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();
897
895
  }
898
- mousemove(t) {
899
- const { pageX: e, pageY: o } = t;
900
- c(this, R) && (m(this, v, o - c(this, I)), m(this, b, e - c(this, z)), 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());
901
899
  }
902
900
  mouseup() {
903
- c(this, R) && (m(this, R, !1), document.body.classList.remove("no-select"), c(this, A) && c(this, A).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()));
904
902
  }
905
903
  }
906
- x = new WeakMap(), R = new WeakMap(), k = new WeakMap(), z = new WeakMap(), I = new WeakMap(), v = new WeakMap(), b = new WeakMap(), g = new WeakMap(), O = new WeakMap(), A = new WeakMap();
907
- function oe(n) {
908
- 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;
909
907
  if (n) {
910
908
  if (n.requestFullscreen)
911
909
  return n.requestFullscreen();
912
- if (t.mozRequestFullScreen)
913
- return t.mozRequestFullScreen();
914
- if (t.webkitRequestFullscreen)
915
- return t.webkitRequestFullscreen();
916
- if (t.msRequestFullscreen)
917
- 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();
918
916
  } else return Promise.reject("No DOM");
919
917
  return Promise.reject("No Fullscreen API");
920
918
  }
921
- function re() {
919
+ function it() {
922
920
  const n = document;
923
921
  return document.exitFullscreen ? document.exitFullscreen() : n.mozCancelFullScreen ? n.mozCancelFullScreen() : n.webkitExitFullscreen ? n.webkitExitFullscreen() : n.msExitFullscreen ? n.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
924
922
  }
925
- function ie() {
926
- const n = document;
927
- 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;
928
927
  }
929
- function Oe(n) {
928
+ function qt(n) {
930
929
  return function() {
931
- ie() ? re() : oe(n);
930
+ st(n) ? it() : rt(n);
932
931
  };
933
932
  }
934
- function Ae(n, t) {
933
+ function $t(n, e) {
935
934
  if (typeof n == "number") return n;
936
935
  if (/px/.test(n)) return Number(n.replace(/px/, "")) || 0;
937
- const e = document.createElement("div");
938
- e.style.width = n, t = t || document.body, t.appendChild(e);
939
- const o = e.getBoundingClientRect().width;
940
- 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;
941
940
  }
942
- function Se(n, t) {
941
+ function Yt(n, e) {
943
942
  if (!n) return;
944
- let e, o;
945
- if (typeof t == "string") {
946
- const i = document.querySelector(t);
943
+ let t, o;
944
+ if (typeof e == "string") {
945
+ const i = document.querySelector(e);
947
946
  if (!i) return;
948
947
  const s = i.getBoundingClientRect();
949
- e = s.width, o = s.height;
950
- } else if (Array.isArray(t))
951
- e = t[0], o = t[1];
948
+ t = s.width, o = s.height;
949
+ } else if (Array.isArray(e))
950
+ t = e[0], o = e[1];
952
951
  else {
953
- const i = t.getBoundingClientRect();
954
- e = i.width, o = i.height;
952
+ const i = e.getBoundingClientRect();
953
+ t = i.width, o = i.height;
955
954
  }
956
- const r = e / o;
957
- 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];
958
957
  }
959
- function Ne(n, t = 5e3) {
960
- return new Promise((e, o) => {
958
+ function Bt(n, e = 5e3) {
959
+ return new Promise((t, o) => {
961
960
  const r = new Image();
962
961
  r.src = n;
963
962
  const i = setTimeout(() => {
964
963
  o(new Error("图片加载超时")), r.onload = null, r.onerror = null;
965
- }, t);
964
+ }, e);
966
965
  r.onload = () => {
967
966
  clearTimeout(i);
968
- const s = r.naturalWidth, a = r.naturalHeight, u = s / a;
969
- e([r, u]);
967
+ const s = r.naturalWidth, a = r.naturalHeight, l = s / a;
968
+ t([r, l]);
970
969
  }, r.onerror = () => {
971
970
  clearTimeout(i), o(new Error("图片加载失败"));
972
971
  }, r.crossOrigin = "Anonymous";
973
972
  });
974
973
  }
975
- function qe(n, t, e = 2) {
976
- 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));
1009
+ }
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) + "%";
977
1012
  }
978
- function $e(n, t, e) {
979
- return Math.abs(n - t) <= e;
1013
+ function Kt(n, e, t) {
1014
+ return Math.abs(n - e) <= t;
980
1015
  }
981
- function Ye(n, t = 500) {
982
- let e, o = !0;
1016
+ function Jt(n, e = 500) {
1017
+ let t, o = !0;
983
1018
  function r(i) {
984
1019
  if (!o) return;
985
- e || (e = i);
986
- let s = Math.min((i - e) / t, 1);
987
- n(s), i - e < t && requestAnimationFrame(r);
1020
+ t || (t = i);
1021
+ let s = Math.min((i - t) / e, 1);
1022
+ n(s), i - t < e && requestAnimationFrame(r);
988
1023
  }
989
1024
  return requestAnimationFrame(r), () => o = !1;
990
1025
  }
991
- function Be(n) {
992
- 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;
993
1029
  }
994
- function He(n, t) {
995
- const e = {
1030
+ function te(n, e) {
1031
+ const t = {
996
1032
  join: !0,
997
1033
  suffix: "",
998
1034
  decimalPlaces: 2
999
1035
  }, { join: o, suffix: r, decimalPlaces: i } = {
1000
- ...e,
1001
- ...t || {}
1036
+ ...t,
1037
+ ...e || {}
1002
1038
  }, s = Number(n);
1003
1039
  if (isNaN(s)) return o ? `0${r}` : [0, r];
1004
- const a = Math.abs(s), u = s >= 0, l = Math.max(0, Math.floor(Math.log10(a) / 4)), f = Math.pow(1e4, l), p = a / f, T = (u ? 1 : -1) * parseFloat(p.toFixed(Math.max(0, i)));
1005
- return o ? `${T}${G[l]}${r}` : [T, G[l] + 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];
1006
1042
  }
1007
- function Xe(n, t) {
1008
- let e = !1;
1009
- const { x: o, y: r } = n, i = t.length;
1043
+ function ee(n, e) {
1044
+ let t = !1;
1045
+ const { x: o, y: r } = n, i = e.length;
1010
1046
  for (let s = 0, a = i - 1; s < i; a = s++) {
1011
- const u = t[s].x, l = t[s].y, f = t[a].x, p = t[a].y;
1012
- l > r != p > r && o < (f - u) * (r - l) / (p - l) + u && (e = !e);
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);
1013
1049
  }
1014
- return e;
1050
+ return t;
1015
1051
  }
1016
- function We(n) {
1017
- const t = ["B", "KB", "MB", "GB", "TB", "PB"];
1018
- let e = 0;
1052
+ function ne(n) {
1053
+ const e = ["B", "KB", "MB", "GB", "TB", "PB"];
1054
+ let t = 0;
1019
1055
  for (; n > 1024; )
1020
- n /= 1024, e++;
1021
- return `${Math.round(n * 100) / 100} ${t[e]}`;
1056
+ n /= 1024, t++;
1057
+ return `${Math.round(n * 100) / 100} ${e[t]}`;
1022
1058
  }
1023
- function Ge(n, t, e, o) {
1024
- return Math.sqrt(Math.pow(e - n, 2) + Math.pow(o - t, 2));
1059
+ function oe(n, e, t, o) {
1060
+ return Math.sqrt(Math.pow(t - n, 2) + Math.pow(o - e, 2));
1025
1061
  }
1026
- function Ve(n, t, e, o) {
1027
- const r = (n + e) / 2, i = (t + o) / 2;
1062
+ function re(n, e, t, o) {
1063
+ const r = (n + t) / 2, i = (e + o) / 2;
1028
1064
  return { x: r, y: i };
1029
1065
  }
1030
- class U {
1031
- constructor(t, e) {
1066
+ class _ {
1067
+ constructor(e, t) {
1032
1068
  y(this, "resolve");
1033
1069
  y(this, "reject");
1034
- this.resolve = t, this.reject = e;
1070
+ this.resolve = e, this.reject = t;
1035
1071
  }
1036
- run(t) {
1037
- var e, o;
1038
- return t instanceof Promise ? t.then((r) => {
1072
+ run(e) {
1073
+ var t, o;
1074
+ return e instanceof Promise ? e.then((r) => {
1039
1075
  var i;
1040
1076
  return (i = this.resolve) == null || i.call(this), r;
1041
1077
  }).catch((r) => {
1042
1078
  var i;
1043
1079
  return (i = this.reject) == null || i.call(this), Promise.reject(r);
1044
- }) : 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;
1045
1081
  }
1046
1082
  }
1047
- class se extends U {
1048
- constructor(t) {
1049
- super(), this.resolve = t;
1083
+ class ut extends _ {
1084
+ constructor(e) {
1085
+ super(), this.resolve = e;
1050
1086
  }
1051
- warning(...t) {
1052
- const e = () => {
1087
+ warning(...e) {
1088
+ const t = () => {
1053
1089
  var o, r;
1054
- 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);
1055
1091
  };
1056
- return new U(this.resolve, e);
1092
+ return new _(this.resolve, t);
1057
1093
  }
1058
- error(...t) {
1059
- const e = () => {
1094
+ error(...e) {
1095
+ const t = () => {
1060
1096
  var o, r;
1061
- 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);
1062
1098
  };
1063
- return new U(this.resolve, e);
1099
+ return new _(this.resolve, t);
1064
1100
  }
1065
1101
  }
1066
- class ce extends U {
1067
- constructor(t) {
1068
- super(), this.reject = t;
1102
+ class mt extends _ {
1103
+ constructor(e) {
1104
+ super(), this.reject = e;
1069
1105
  }
1070
- info(...t) {
1071
- const e = () => {
1106
+ info(...e) {
1107
+ const t = () => {
1072
1108
  var o, r;
1073
- 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);
1074
1110
  };
1075
- return new U(e, this.reject);
1111
+ return new _(t, this.reject);
1076
1112
  }
1077
- success(...t) {
1078
- const e = () => {
1113
+ success(...e) {
1114
+ const t = () => {
1079
1115
  var o, r;
1080
- 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);
1081
1117
  };
1082
- return new U(e, this.reject);
1118
+ return new _(t, this.reject);
1083
1119
  }
1084
1120
  }
1085
1121
  const h = class h {
@@ -1091,27 +1127,27 @@ const h = class h {
1091
1127
  if (new.target === h)
1092
1128
  throw new Error("请直接使用静态方法,而不是实例化此类");
1093
1129
  }
1094
- static register(t, e) {
1095
- if (typeof e != "function")
1130
+ static register(e, t) {
1131
+ if (typeof t != "function")
1096
1132
  return console.error("TipHandler must be a function");
1097
- h.tips[t] = e;
1133
+ h.tips[e] = t;
1098
1134
  }
1099
- static resolveTip(t) {
1100
- return function(...e) {
1135
+ static resolveTip(e) {
1136
+ return function(...t) {
1101
1137
  const o = () => {
1102
1138
  var r, i;
1103
- 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);
1104
1140
  };
1105
- return new se(o);
1141
+ return new ut(o);
1106
1142
  };
1107
1143
  }
1108
- static rejectTip(t) {
1109
- return function(...e) {
1144
+ static rejectTip(e) {
1145
+ return function(...t) {
1110
1146
  const o = () => {
1111
1147
  var r, i;
1112
- 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);
1113
1149
  };
1114
- return new ce(o);
1150
+ return new mt(o);
1115
1151
  };
1116
1152
  }
1117
1153
  };
@@ -1121,57 +1157,63 @@ y(h, "tips", {
1121
1157
  warning: void 0,
1122
1158
  error: void 0
1123
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"));
1124
- let S = h;
1160
+ let z = h;
1125
1161
  export {
1126
- Se as _CalculateCanvasSize,
1127
- Ge as _CalculateDistance2D,
1128
- he as _CapitalizeFirstLetter,
1129
- Le as _CheckConnectionWithXHR,
1130
- ke as _Clone,
1131
- _e as _CloseOnOutsideClick,
1132
- ve as _ConvertToCamelCase,
1133
- qe as _ConvertToPercentage,
1134
- Ce as _CopyToClipboard,
1135
- be as _CreateAndDownloadFile,
1136
- Ue as _Danger_ConvertDataToImageUrl,
1137
- V as _DataType,
1138
- ne as _Debounce,
1139
- we as _DownloadFile,
1140
- ze as _Drag,
1141
- oe as _EnterFullscreen,
1142
- fe as _ExcludeSubstring,
1143
- me as _ExecuteWhenIdle,
1144
- re as _ExitFullscreen,
1145
- Z as _FileTypeChecker,
1146
- We as _FormatFileSize,
1147
- Be as _FormatNumber,
1148
- He as _FormatNumberWithUnit,
1149
- Oe as _Fullscreen,
1150
- ye as _GenerateUUID,
1151
- xe as _GetFrameRate,
1152
- H as _GetHrefName,
1153
- Ve as _GetMidpoint,
1154
- Ae as _GetOtherSizeInPixels,
1155
- Me as _GetTargetByPath,
1156
- Fe as _InitTargetByPath,
1157
- ie as _IsFullscreen,
1158
- ue as _IsObject,
1159
- Xe as _IsPointInPolygon,
1160
- je as _IsSecureContext,
1161
- $e as _IsWithinErrorMargin,
1162
- J as _KeyedWindowManager,
1163
- Ne as _LoadImage,
1164
- Ie as _LocalDrag,
1165
- B as _MergeObjects,
1166
- le as _NotNull,
1167
- ge as _ReadFile,
1168
- Re as _RotateList,
1169
- Ye as _Schedule,
1170
- De as _ScrollEndListener,
1171
- Ee as _Throttle,
1172
- Pe as _TimeConsumption,
1173
- pe as _TimeTransition,
1174
- S as _Tip,
1175
- Te as _UpdateTargetByPath,
1176
- 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
1177
1219
  };