nhanh-pure-function 4.5.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Browser/index.d.ts +1 -1
- package/dist/Element/index.d.ts +1 -1
- package/dist/Math/index.d.ts +87 -0
- package/dist/Utility/index.d.ts +1 -84
- package/dist/Utility/modules/colorConverter.d.ts +137 -0
- package/dist/Utility/{Runtime → modules}/index.d.ts +1 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +723 -594
- package/package.json +1 -1
- /package/dist/Browser/{Runtime → modules}/index.d.ts +0 -0
- /package/dist/Browser/{Runtime → modules}/soundEffects.d.ts +0 -0
- /package/dist/Browser/{Runtime → modules}/webSocketClient.d.ts +0 -0
- /package/dist/Element/{Runtime → modules}/drop.d.ts +0 -0
- /package/dist/Element/{Runtime → modules}/fullscreen.d.ts +0 -0
- /package/dist/Element/{Runtime → modules}/index.d.ts +0 -0
- /package/dist/Utility/{Runtime → modules}/shortcutKey.d.ts +0 -0
- /package/dist/Utility/{Runtime → modules}/undoRedoHistory.d.ts +0 -0
package/dist/index.es.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
(function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode(".no-select{-webkit-user-select:none;-ms-user-select:none;user-select:none}._nhanh_canvas{cursor:initial}._nhanh_canvas:active{cursor:pointer}._nhanh_canvas._nhanh_canvas_draggable{cursor:grab}._nhanh_canvas._nhanh_canvas_draggable:active{cursor:grabbing}._nhanh_canvas_hover_overlay{cursor:pointer!important}._nhanh_canvas_hover_overlay:active{cursor:grabbing!important}._nhanh_canvas_hover_overlay_draggable{cursor:pointer!important}._nhanh_canvas_hover_overlay_draggable:active{cursor:move!important}._nhanh_canvas_hover_overlay_draggable_ew{cursor:pointer!important}._nhanh_canvas_hover_overlay_draggable_ew:active{cursor:e-resize!important;cursor:ew-resize!important}._nhanh_canvas_hover_overlay_draggable_ns{cursor:pointer!important}._nhanh_canvas_hover_overlay_draggable_ns:active{cursor:n-resize!important;cursor:ns-resize!important}")),document.head.appendChild(a)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
2
|
-
var
|
|
3
|
-
var
|
|
2
|
+
var si = Object.defineProperty;
|
|
3
|
+
var Pe = (r) => {
|
|
4
4
|
throw TypeError(r);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
var d = (r, i, t) =>
|
|
8
|
-
var x = (r, i, t) => (
|
|
9
|
-
const
|
|
6
|
+
var ni = (r, i, t) => i in r ? si(r, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[i] = t;
|
|
7
|
+
var d = (r, i, t) => ni(r, typeof i != "symbol" ? i + "" : i, t), Ce = (r, i, t) => i.has(r) || Pe("Cannot " + t);
|
|
8
|
+
var x = (r, i, t) => (Ce(r, i, "read from private field"), t ? t.call(r) : i.get(r)), L = (r, i, t) => i.has(r) ? Pe("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(r) : i.set(r, t), M = (r, i, t, e) => (Ce(r, i, "write to private field"), e ? e.call(r, t) : i.set(r, t), t);
|
|
9
|
+
const ri = {
|
|
10
10
|
".mp3": "audio/mpeg",
|
|
11
11
|
".mp4": "video/mp4",
|
|
12
12
|
".m4a": "audio/mp4",
|
|
@@ -248,7 +248,7 @@ const ni = {
|
|
|
248
248
|
".awk",
|
|
249
249
|
".php"
|
|
250
250
|
]
|
|
251
|
-
},
|
|
251
|
+
}, Se = [
|
|
252
252
|
"",
|
|
253
253
|
"万",
|
|
254
254
|
"亿",
|
|
@@ -262,7 +262,7 @@ const ni = {
|
|
|
262
262
|
"正",
|
|
263
263
|
"载",
|
|
264
264
|
"极"
|
|
265
|
-
],
|
|
265
|
+
], qs = ["_self", "_blank", "_parent", "_top"], Te = {
|
|
266
266
|
// 北美标准尺寸 (毫米)
|
|
267
267
|
Letter: { width: 215.9, height: 279.4 },
|
|
268
268
|
// 8.5 × 11 英寸
|
|
@@ -315,7 +315,7 @@ const ni = {
|
|
|
315
315
|
C6: { width: 114, height: 162 },
|
|
316
316
|
C7: { width: 81, height: 114 },
|
|
317
317
|
C8: { width: 57, height: 81 }
|
|
318
|
-
},
|
|
318
|
+
}, Ks = Object.keys(Te).map(
|
|
319
319
|
(r) => ({ value: r, label: r })
|
|
320
320
|
);
|
|
321
321
|
function Ut(r, i = 500) {
|
|
@@ -328,19 +328,19 @@ function Ut(r, i = 500) {
|
|
|
328
328
|
}
|
|
329
329
|
return requestAnimationFrame(s), () => e = !1;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function Zs(r, i, t, e, s = 4) {
|
|
332
332
|
let n = r, o = !1, a = 1, l = r, c = i, h = t;
|
|
333
333
|
const u = () => {
|
|
334
334
|
const b = (c - l) / h;
|
|
335
335
|
return Number(b.toFixed(s));
|
|
336
336
|
};
|
|
337
337
|
let f = u();
|
|
338
|
-
const m = (b) => Math.min(Math.max(b, l), c), g = (b) => Number(b.toFixed(s)), p = (b, P,
|
|
338
|
+
const m = (b) => Math.min(Math.max(b, l), c), g = (b) => Number(b.toFixed(s)), p = (b, P, E) => {
|
|
339
339
|
const O = [];
|
|
340
|
-
return b >= P && O.push("最小值必须小于最大值"),
|
|
341
|
-
}, y = (b, P,
|
|
342
|
-
const O = p(b, P,
|
|
343
|
-
return O.length > 0 ? (console.error(`参数更新失败: ${O.join("; ")}`), !1) : (l = b, c = P, h =
|
|
340
|
+
return b >= P && O.push("最小值必须小于最大值"), E <= 0 ? O.push("分段数必须为正数") : u() == 0 && O.push("数值精度过低,致使动画步长为 0"), O;
|
|
341
|
+
}, y = (b, P, E) => {
|
|
342
|
+
const O = p(b, P, E);
|
|
343
|
+
return O.length > 0 ? (console.error(`参数更新失败: ${O.join("; ")}`), !1) : (l = b, c = P, h = E, f = u(), n = m(n), !0);
|
|
344
344
|
}, w = () => {
|
|
345
345
|
o && (a = n >= c ? -1 : n <= l ? 1 : a, n = m(n + f * a), e(g(n), a), requestAnimationFrame(w));
|
|
346
346
|
};
|
|
@@ -365,7 +365,7 @@ function Ws(r, i, t, e, s = 4) {
|
|
|
365
365
|
getParams: () => ({ min: l, max: c, steps: h, precision: s, stepSize: f })
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function oi(r, i, t, e, s = 4) {
|
|
369
369
|
if (t <= 0) return console.error("动画步数 必须为正数");
|
|
370
370
|
const n = (u) => Number(u.toFixed(s)), o = i - r, a = n(Math.abs(o) / t);
|
|
371
371
|
if (a === 0) return console.error("数值精度过低,致使动画步长为 0");
|
|
@@ -376,7 +376,7 @@ function ri(r, i, t, e, s = 4) {
|
|
|
376
376
|
};
|
|
377
377
|
h();
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Qs(r, i, t, e) {
|
|
380
380
|
const s = (l) => 3 * (1 - l) ** 2 * l * r + 3 * (1 - l) * l ** 2 * t + l ** 3, n = (l) => 3 * (1 - l) ** 2 * l * i + 3 * (1 - l) * l ** 2 * e + l ** 3, o = (l) => 3 * r * (1 - l) * (1 - 3 * l) + 3 * t * (2 * l - 3 * l ** 2) + 3 * l ** 2, a = (l) => {
|
|
381
381
|
if (l <= 0) return 0;
|
|
382
382
|
if (l >= 1) return 1;
|
|
@@ -404,7 +404,7 @@ function qs(r, i, t, e) {
|
|
|
404
404
|
return n(a(c));
|
|
405
405
|
};
|
|
406
406
|
}
|
|
407
|
-
function
|
|
407
|
+
function Js(r, i = "image/png") {
|
|
408
408
|
try {
|
|
409
409
|
let t, e = i;
|
|
410
410
|
if (r instanceof File)
|
|
@@ -441,17 +441,17 @@ function Ks(r, i = "image/png") {
|
|
|
441
441
|
), null;
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
function
|
|
444
|
+
function tn(r) {
|
|
445
445
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
446
446
|
}
|
|
447
|
-
function
|
|
447
|
+
function en(r, i, t = 2) {
|
|
448
448
|
return !Number.isFinite(r) || !Number.isFinite(i) || !Number.isFinite(t) ? (console.error("所有参数必须是有限的数字"), "") : i === 0 ? (console.error("分母不能为零"), "") : t < 0 ? (console.error("小数位数不能为负数"), "") : (r / i * 100).toFixed(t) + "%";
|
|
449
449
|
}
|
|
450
450
|
function se(r) {
|
|
451
451
|
const t = r.toString().split("."), e = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
452
452
|
return t.length > 1 ? e + "." + t[1] : e;
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function sn(r, i) {
|
|
455
455
|
const t = {
|
|
456
456
|
join: !0,
|
|
457
457
|
suffix: "",
|
|
@@ -462,16 +462,16 @@ function Js(r, i) {
|
|
|
462
462
|
}, o = Number(r);
|
|
463
463
|
if (isNaN(o)) return e ? `0${s}` : [0, s];
|
|
464
464
|
const a = Math.abs(o), l = o >= 0, c = Math.max(0, Math.floor(Math.log10(a) / 4)), h = Math.pow(1e4, c), u = a / h, f = (l ? 1 : -1) * parseFloat(u.toFixed(Math.max(0, n)));
|
|
465
|
-
return e ? `${f}${
|
|
465
|
+
return e ? `${f}${Se[c]}${s}` : [f, Se[c] + s];
|
|
466
466
|
}
|
|
467
|
-
function
|
|
467
|
+
function nn(r) {
|
|
468
468
|
const i = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
469
469
|
let t = 0;
|
|
470
470
|
for (; r > 1024; )
|
|
471
471
|
r /= 1024, t++;
|
|
472
472
|
return `${Math.round(r * 100) / 100} ${i[t]}`;
|
|
473
473
|
}
|
|
474
|
-
function
|
|
474
|
+
function ai(r, i = "YYYY-MM-DD hh:mm:ss", t = !0) {
|
|
475
475
|
const e = new Date(r);
|
|
476
476
|
if (isNaN(e.getTime()))
|
|
477
477
|
return console.error("Invalid date"), "";
|
|
@@ -495,10 +495,10 @@ function ne(r, i = "file") {
|
|
|
495
495
|
const t = r.split("/");
|
|
496
496
|
return t[t.length - 1].split("?")[0];
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function rn(r, i) {
|
|
499
499
|
return r = r.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), i ? r.replace(/[^a-zA-Z]+/g, "") : r;
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function on(r, i, t = ",") {
|
|
502
502
|
const e = new RegExp(
|
|
503
503
|
`(^|${t})${i}(${t}|$)`,
|
|
504
504
|
"g"
|
|
@@ -507,7 +507,7 @@ function sn(r, i, t = ",") {
|
|
|
507
507
|
return n === o ? t : "";
|
|
508
508
|
});
|
|
509
509
|
}
|
|
510
|
-
function
|
|
510
|
+
function an(r, i = !0) {
|
|
511
511
|
const t = {
|
|
512
512
|
"\b": "\\b",
|
|
513
513
|
" ": "\\t",
|
|
@@ -534,7 +534,7 @@ const Nt = [
|
|
|
534
534
|
["秒", 1e3],
|
|
535
535
|
["毫秒", 1]
|
|
536
536
|
];
|
|
537
|
-
function
|
|
537
|
+
function ln(r, i) {
|
|
538
538
|
if (!Number.isFinite(r) || r < 0) return "0毫秒";
|
|
539
539
|
r = Math.round(r);
|
|
540
540
|
const t = i ? Nt.findIndex(([s]) => s === i) : 0, e = t === -1 ? 0 : t;
|
|
@@ -548,7 +548,7 @@ function rn(r, i) {
|
|
|
548
548
|
}
|
|
549
549
|
return "0毫秒";
|
|
550
550
|
}
|
|
551
|
-
function
|
|
551
|
+
function cn(r, i) {
|
|
552
552
|
if (i < 1)
|
|
553
553
|
return console.error("分割大小必须大于0"), [];
|
|
554
554
|
const t = [];
|
|
@@ -558,7 +558,7 @@ function on(r, i) {
|
|
|
558
558
|
}
|
|
559
559
|
return t;
|
|
560
560
|
}
|
|
561
|
-
function
|
|
561
|
+
function xe(r, i = 2) {
|
|
562
562
|
if (Array.isArray(r) && r.length >= i) {
|
|
563
563
|
for (let e = 0; e < r.length; e++)
|
|
564
564
|
if (typeof r[e] != "number" || !Number.isFinite(r[e])) return !1;
|
|
@@ -568,14 +568,14 @@ function we(r, i = 2) {
|
|
|
568
568
|
function Gt(r, i = 1, t = 2) {
|
|
569
569
|
if (Array.isArray(r) && r.length >= i) {
|
|
570
570
|
for (let s = 0; s < r.length; s++)
|
|
571
|
-
if (!
|
|
571
|
+
if (!xe(r[s], t)) return !1;
|
|
572
572
|
} else return !1;
|
|
573
573
|
return !0;
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function hn(r, i, t) {
|
|
576
576
|
return Math.abs(r - i) <= t;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function un(r, i) {
|
|
579
579
|
let t = !1;
|
|
580
580
|
const { x: e, y: s } = r, n = i.length;
|
|
581
581
|
for (let o = 0, a = n - 1; o < n; a = o++) {
|
|
@@ -584,7 +584,7 @@ function ln(r, i) {
|
|
|
584
584
|
}
|
|
585
585
|
return t;
|
|
586
586
|
}
|
|
587
|
-
function
|
|
587
|
+
function dn(r, i, t, e) {
|
|
588
588
|
const s = Math.min(r[0], i[0]), n = Math.max(r[0], i[0]), o = Math.min(r[1], i[1]), a = Math.max(r[1], i[1]), l = [
|
|
589
589
|
[s, o],
|
|
590
590
|
// 左上
|
|
@@ -611,7 +611,7 @@ function cn(r, i, t, e) {
|
|
|
611
611
|
function re(r) {
|
|
612
612
|
return Object.prototype.toString.call(r).slice(8, -1).toLowerCase();
|
|
613
613
|
}
|
|
614
|
-
function
|
|
614
|
+
function fn(r) {
|
|
615
615
|
return [
|
|
616
616
|
"https:",
|
|
617
617
|
// HTTPS协议,用于安全地浏览网页
|
|
@@ -635,7 +635,7 @@ function hn(r) {
|
|
|
635
635
|
// VPN协议,用于创建安全的网络连接
|
|
636
636
|
].some((t) => r.startsWith(t));
|
|
637
637
|
}
|
|
638
|
-
function
|
|
638
|
+
function mn(r) {
|
|
639
639
|
return new Promise((i, t) => {
|
|
640
640
|
if (typeof r != "string" || r.trim() === "" || !r.includes("://")) {
|
|
641
641
|
t(new Error("Invalid URL: Must be a non-empty string"));
|
|
@@ -715,7 +715,7 @@ const ot = class ot {
|
|
|
715
715
|
* @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
|
|
716
716
|
*/
|
|
717
717
|
static _normalizeType(i) {
|
|
718
|
-
return i.startsWith(".") && !i.includes("/") ?
|
|
718
|
+
return i.startsWith(".") && !i.includes("/") ? ri[i.toLowerCase()] || i : i.includes("/") ? i : `${i}/*`;
|
|
719
719
|
}
|
|
720
720
|
/**
|
|
721
721
|
* 检查URL是否具有任何指定的文件扩展名
|
|
@@ -740,12 +740,12 @@ const ot = class ot {
|
|
|
740
740
|
};
|
|
741
741
|
// 缓存文件扩展名的条目,以提高性能
|
|
742
742
|
d(ot, "cachedEntries", Object.entries(te));
|
|
743
|
-
let
|
|
744
|
-
const
|
|
745
|
-
function
|
|
746
|
-
return r ? r.match(
|
|
743
|
+
let _e = ot;
|
|
744
|
+
const li = /\w*(?:\[\d+\])+|\w+/g, Ie = /^\w*(?:\[\d+\])+$/, Ne = /\w+|(\[\d+\])/g, He = /\[(\d+)\]/;
|
|
745
|
+
function Fe(r) {
|
|
746
|
+
return r ? r.match(li) || [] : [];
|
|
747
747
|
}
|
|
748
|
-
class
|
|
748
|
+
class pn {
|
|
749
749
|
constructor(i = {}) {
|
|
750
750
|
d(this, "stack", []);
|
|
751
751
|
d(this, "_index", 0);
|
|
@@ -874,7 +874,7 @@ class dn {
|
|
|
874
874
|
e(t);
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
|
-
const
|
|
877
|
+
const ci = {
|
|
878
878
|
// 修饰键
|
|
879
879
|
ctrl: "control",
|
|
880
880
|
ctl: "control",
|
|
@@ -1042,7 +1042,7 @@ const li = {
|
|
|
1042
1042
|
*/
|
|
1043
1043
|
normalizeKey(i) {
|
|
1044
1044
|
const t = i.toLowerCase();
|
|
1045
|
-
return
|
|
1045
|
+
return ci[t] ?? t;
|
|
1046
1046
|
}
|
|
1047
1047
|
/** 当前按下键与预期组合键在长度与顺序上完全一致 */
|
|
1048
1048
|
isExactMatch(i, t) {
|
|
@@ -1059,7 +1059,275 @@ const li = {
|
|
|
1059
1059
|
// 静态计数器:记录当前活跃的实例数量
|
|
1060
1060
|
d(at, "activeInstances", 0);
|
|
1061
1061
|
let Ee = at;
|
|
1062
|
-
|
|
1062
|
+
class hi {
|
|
1063
|
+
constructor() {
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* 数值钳制,确保在合法区间内。
|
|
1067
|
+
*/
|
|
1068
|
+
static clamp(i, t, e) {
|
|
1069
|
+
return Math.min(Math.max(i, t), e);
|
|
1070
|
+
}
|
|
1071
|
+
static normalizeHue(i) {
|
|
1072
|
+
return (i % 360 + 360) % 360;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* 根据色相分段与色度参数生成 RGB(0-255)。
|
|
1076
|
+
*/
|
|
1077
|
+
static chromaToRgb(i, t, e) {
|
|
1078
|
+
const s = t * (1 - Math.abs(i / 60 % 2 - 1));
|
|
1079
|
+
let n = 0, o = 0, a = 0;
|
|
1080
|
+
return i < 60 ? [n, o, a] = [t, s, 0] : i < 120 ? [n, o, a] = [s, t, 0] : i < 180 ? [n, o, a] = [0, t, s] : i < 240 ? [n, o, a] = [0, s, t] : i < 300 ? [n, o, a] = [s, 0, t] : [n, o, a] = [t, 0, s], {
|
|
1081
|
+
r: (n + e) * 255,
|
|
1082
|
+
g: (o + e) * 255,
|
|
1083
|
+
b: (a + e) * 255
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
static resolveAlpha(i, t) {
|
|
1087
|
+
return Number.isFinite(i) ? this.clamp(i, 0, 1) : t;
|
|
1088
|
+
}
|
|
1089
|
+
static toRoundedRgbString(i, t, e) {
|
|
1090
|
+
return `rgb(${Math.round(i)}, ${Math.round(t)}, ${Math.round(e)})`;
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* HSL 转 RGB。
|
|
1094
|
+
* h: 0-360, s/l: 0-100
|
|
1095
|
+
*/
|
|
1096
|
+
static hslToRgb(i, t, e) {
|
|
1097
|
+
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = (1 - Math.abs(2 * o - 1)) * n, l = o - a / 2;
|
|
1098
|
+
return this.chromaToRgb(s, a, l);
|
|
1099
|
+
}
|
|
1100
|
+
/**
|
|
1101
|
+
* HSV 转 RGB。
|
|
1102
|
+
* h: 0-360, s/v: 0-100
|
|
1103
|
+
*/
|
|
1104
|
+
static hsvToRgb(i, t, e) {
|
|
1105
|
+
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = o * n, l = o - a;
|
|
1106
|
+
return this.chromaToRgb(s, a, l);
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* 解析任意受支持的颜色格式并标准化为 RGBA。
|
|
1110
|
+
*/
|
|
1111
|
+
static parseColor(i) {
|
|
1112
|
+
const t = i.trim().toLowerCase();
|
|
1113
|
+
if (t.startsWith("#")) {
|
|
1114
|
+
const o = t.slice(1);
|
|
1115
|
+
if (o.length === 3 || o.length === 4) {
|
|
1116
|
+
const [a, l, c, h = "f"] = o.split("");
|
|
1117
|
+
return {
|
|
1118
|
+
r: parseInt(`${a}${a}`, 16),
|
|
1119
|
+
g: parseInt(`${l}${l}`, 16),
|
|
1120
|
+
b: parseInt(`${c}${c}`, 16),
|
|
1121
|
+
a: parseInt(`${h}${h}`, 16) / 255
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
if (o.length === 6 || o.length === 8) {
|
|
1125
|
+
const a = parseInt(o.slice(0, 2), 16), l = parseInt(o.slice(2, 4), 16), c = parseInt(o.slice(4, 6), 16), h = o.length === 8 ? parseInt(o.slice(6, 8), 16) / 255 : this.DEFAULT_ALPHA;
|
|
1126
|
+
return { r: a, g: l, b: c, a: h };
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
const e = t.match(/^rgba?\(([^)]+)\)$/);
|
|
1130
|
+
if (e) {
|
|
1131
|
+
const o = e[1].split(",").map((a) => a.trim());
|
|
1132
|
+
if (o.length >= 3) {
|
|
1133
|
+
const a = this.clamp(Number(o[0]), 0, 255), l = this.clamp(Number(o[1]), 0, 255), c = this.clamp(Number(o[2]), 0, 255), h = o.length >= 4 ? this.clamp(Number(o[3]), 0, 1) : this.DEFAULT_ALPHA;
|
|
1134
|
+
return { r: a, g: l, b: c, a: h };
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
const s = t.match(/^hsl\(([^)]+)\)$/);
|
|
1138
|
+
if (s) {
|
|
1139
|
+
const o = s[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1140
|
+
if (o.length >= 3) {
|
|
1141
|
+
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1142
|
+
return { ...this.hslToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
const n = t.match(/^hsv\(([^)]+)\)$/);
|
|
1146
|
+
if (n) {
|
|
1147
|
+
const o = n[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1148
|
+
if (o.length >= 3) {
|
|
1149
|
+
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1150
|
+
return { ...this.hsvToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
return console.error("Invalid color format", i), { r: 0, g: 0, b: 0, a: this.DEFAULT_ALPHA };
|
|
1154
|
+
}
|
|
1155
|
+
/**
|
|
1156
|
+
* 十进制颜色分量转两位十六进制字符串。
|
|
1157
|
+
*/
|
|
1158
|
+
static toHexPart(i) {
|
|
1159
|
+
return Math.round(this.clamp(i, 0, 255)).toString(16).padStart(2, "0");
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* RGB 转 HSL。
|
|
1163
|
+
* 返回 h:0-360, s/l:0-100
|
|
1164
|
+
*/
|
|
1165
|
+
static rgbToHsl(i, t, e) {
|
|
1166
|
+
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1167
|
+
let h = 0;
|
|
1168
|
+
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1169
|
+
const u = (a + l) / 2, f = c === 0 ? 0 : c / (1 - Math.abs(2 * u - 1));
|
|
1170
|
+
return { h, s: f * 100, l: u * 100 };
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* RGB 转 HSV。
|
|
1174
|
+
* 返回 h:0-360, s/v:0-100
|
|
1175
|
+
*/
|
|
1176
|
+
static rgbToHsv(i, t, e) {
|
|
1177
|
+
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1178
|
+
let h = 0;
|
|
1179
|
+
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1180
|
+
const u = a === 0 ? 0 : c / a, f = a;
|
|
1181
|
+
return { h, s: u * 100, v: f * 100 };
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* 转换为 HEX(#RRGGBB)。
|
|
1185
|
+
*/
|
|
1186
|
+
static toHex(i) {
|
|
1187
|
+
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1188
|
+
return `#${this.toHexPart(t)}${this.toHexPart(e)}${this.toHexPart(s)}`;
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* 转换为 HEXA(#RRGGBBAA)。
|
|
1192
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1193
|
+
*/
|
|
1194
|
+
static toHexa(i, t) {
|
|
1195
|
+
const { r: e, g: s, b: n, a: o } = this.parseColor(i), a = this.resolveAlpha(t, o);
|
|
1196
|
+
return `#${this.toHexPart(e)}${this.toHexPart(s)}${this.toHexPart(
|
|
1197
|
+
n
|
|
1198
|
+
)}${this.toHexPart(a * 255)}`;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* 转换为 RGB(rgb(r, g, b))。
|
|
1202
|
+
*/
|
|
1203
|
+
static toRgb(i) {
|
|
1204
|
+
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1205
|
+
return this.toRoundedRgbString(t, e, s);
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* 转换为 RGBA(rgba(r, g, b, a))。
|
|
1209
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1210
|
+
*/
|
|
1211
|
+
static toRgba(i, t) {
|
|
1212
|
+
const e = this.parseColor(i), s = this.resolveAlpha(t, e.a);
|
|
1213
|
+
return `rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(
|
|
1214
|
+
e.b
|
|
1215
|
+
)}, ${s})`;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* 转换为 HSL(hsl(h, s%, l%))。
|
|
1219
|
+
*/
|
|
1220
|
+
static toHsl(i) {
|
|
1221
|
+
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, l: a } = this.rgbToHsl(t, e, s);
|
|
1222
|
+
return `hsl(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* 转换为 HSLA(hsla(h, s%, l%, a))。
|
|
1226
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1227
|
+
*/
|
|
1228
|
+
static toHsla(i, t) {
|
|
1229
|
+
const e = this.parseColor(i), { h: s, s: n, l: o } = this.rgbToHsl(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1230
|
+
return `hsla(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(
|
|
1231
|
+
o
|
|
1232
|
+
)}%, ${a})`;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* 转换为 HSV(hsv(h, s%, v%))。
|
|
1236
|
+
*/
|
|
1237
|
+
static toHsv(i) {
|
|
1238
|
+
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, v: a } = this.rgbToHsv(t, e, s);
|
|
1239
|
+
return `hsv(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* 转换为 HSVA(hsva(h, s%, v%, a))。
|
|
1243
|
+
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1244
|
+
*/
|
|
1245
|
+
static toHsva(i, t) {
|
|
1246
|
+
const e = this.parseColor(i), { h: s, s: n, v: o } = this.rgbToHsv(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1247
|
+
return `hsva(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(
|
|
1248
|
+
o
|
|
1249
|
+
)}%, ${a})`;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
* 返回解析后的 RGBA 对象。
|
|
1253
|
+
* @param color 任意受支持的颜色字符串(hex/rgb/hsl/hsv)
|
|
1254
|
+
* @returns {{ r: number; g: number; b: number; a: number }} RGBA 分量,r/g/b 范围 0-255,a 范围 0-1
|
|
1255
|
+
*/
|
|
1256
|
+
static toRgbaObject(i) {
|
|
1257
|
+
return this.parseColor(i);
|
|
1258
|
+
}
|
|
1259
|
+
/**
|
|
1260
|
+
* 判断两个颜色是否在允许的色差范围内(基于 RGB 欧几里得距离)。
|
|
1261
|
+
* @param colorA 第一个颜色字符串
|
|
1262
|
+
* @param colorB 第二个颜色字符串
|
|
1263
|
+
* @param threshold 允许的最大色差值,范围约 0(完全相同)到 442(黑白最大距离),含 alpha 时上限约 510
|
|
1264
|
+
* @param includeAlpha 是否将 alpha 差值纳入计算,默认 true;启用时 alpha 差值会缩放到 0-255 参与距离
|
|
1265
|
+
* @returns true 表示在允许色差内
|
|
1266
|
+
*/
|
|
1267
|
+
static isWithinColorDifference(i, t, e, s = !0) {
|
|
1268
|
+
const n = this.parseColor(i), o = this.parseColor(t), a = n.r - o.r, l = n.g - o.g, c = n.b - o.b;
|
|
1269
|
+
let h = a * a + l * l + c * c;
|
|
1270
|
+
if (s) {
|
|
1271
|
+
const u = (n.a - o.a) * 255;
|
|
1272
|
+
h += u * u;
|
|
1273
|
+
}
|
|
1274
|
+
return Math.sqrt(h) <= e;
|
|
1275
|
+
}
|
|
1276
|
+
/**
|
|
1277
|
+
* 混合两个颜色(在 RGBA 空间线性插值)。
|
|
1278
|
+
* @param colorA 起始颜色
|
|
1279
|
+
* @param colorB 终点颜色
|
|
1280
|
+
* @param ratio 混合比例,0 = 完全 A,1 = 完全 B
|
|
1281
|
+
* @returns 混合后的 rgba 字符串
|
|
1282
|
+
*/
|
|
1283
|
+
static mix(i, t, e) {
|
|
1284
|
+
const s = this.clamp(e, 0, 1), n = this.parseColor(i), o = this.parseColor(t), a = n.r + (o.r - n.r) * s, l = n.g + (o.g - n.g) * s, c = n.b + (o.b - n.b) * s, h = n.a + (o.a - n.a) * s;
|
|
1285
|
+
return `rgba(${Math.round(a)}, ${Math.round(l)}, ${Math.round(c)}, ${h})`;
|
|
1286
|
+
}
|
|
1287
|
+
/**
|
|
1288
|
+
* 转换为灰度(基于 ITU-R BT.709 权重)。
|
|
1289
|
+
* @param color 任意受支持的颜色字符串
|
|
1290
|
+
* @returns 灰度 rgb 字符串
|
|
1291
|
+
*/
|
|
1292
|
+
static toGrayscale(i) {
|
|
1293
|
+
const { r: t, g: e, b: s } = this.parseColor(i), n = Math.round(t * 0.2126 + e * 0.7152 + s * 0.0722);
|
|
1294
|
+
return this.toRoundedRgbString(n, n, n);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* 计算 WCAG 2.0 相对亮度。
|
|
1298
|
+
* @param color 任意受支持的颜色字符串
|
|
1299
|
+
* @returns 相对亮度值,范围 [0, 1]
|
|
1300
|
+
*/
|
|
1301
|
+
static luminance(i) {
|
|
1302
|
+
const { r: t, g: e, b: s } = this.parseColor(i), n = (o) => {
|
|
1303
|
+
const a = o / 255;
|
|
1304
|
+
return a <= 0.03928 ? a / 12.92 : Math.pow((a + 0.055) / 1.055, 2.4);
|
|
1305
|
+
};
|
|
1306
|
+
return n(t) * 0.2126 + n(e) * 0.7152 + n(s) * 0.0722;
|
|
1307
|
+
}
|
|
1308
|
+
/**
|
|
1309
|
+
* 计算 WCAG 2.0 对比度。
|
|
1310
|
+
* @param colorA 第一个颜色
|
|
1311
|
+
* @param colorB 第二个颜色
|
|
1312
|
+
* @returns 对比度值,范围 [1, 21]
|
|
1313
|
+
*/
|
|
1314
|
+
static contrastRatio(i, t) {
|
|
1315
|
+
const e = this.luminance(i), s = this.luminance(t), n = Math.max(e, s), o = Math.min(e, s);
|
|
1316
|
+
return (n + 0.05) / (o + 0.05);
|
|
1317
|
+
}
|
|
1318
|
+
/**
|
|
1319
|
+
* 设置透明度并返回 rgba 字符串。
|
|
1320
|
+
* @param color 任意受支持的颜色字符串
|
|
1321
|
+
* @param alpha 目标透明度,范围 [0, 1]
|
|
1322
|
+
* @returns rgba 字符串
|
|
1323
|
+
*/
|
|
1324
|
+
static withAlpha(i, t) {
|
|
1325
|
+
const { r: e, g: s, b: n } = this.parseColor(i), o = this.clamp(t, 0, 1);
|
|
1326
|
+
return `rgba(${Math.round(e)}, ${Math.round(s)}, ${Math.round(n)}, ${o})`;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
d(hi, "DEFAULT_ALPHA", 1);
|
|
1330
|
+
function gn(r, i = 3e3) {
|
|
1063
1331
|
if (typeof r != "function")
|
|
1064
1332
|
return console.error("非函数:", r);
|
|
1065
1333
|
const t = window.requestIdleCallback, e = function(s) {
|
|
@@ -1067,7 +1335,7 @@ function fn(r, i = 3e3) {
|
|
|
1067
1335
|
};
|
|
1068
1336
|
t ? t(e, { timeout: i }) : requestAnimationFrame(() => r());
|
|
1069
1337
|
}
|
|
1070
|
-
function
|
|
1338
|
+
function ui(r, i) {
|
|
1071
1339
|
const t = Date.now();
|
|
1072
1340
|
return new Promise((e, s) => {
|
|
1073
1341
|
const n = () => {
|
|
@@ -1118,7 +1386,7 @@ function oe(r = "") {
|
|
|
1118
1386
|
return (i === "x" ? t : t & 3 | 8).toString(16);
|
|
1119
1387
|
});
|
|
1120
1388
|
}
|
|
1121
|
-
function
|
|
1389
|
+
function ze(r, i) {
|
|
1122
1390
|
let t;
|
|
1123
1391
|
return function(...e) {
|
|
1124
1392
|
clearTimeout(t), t = setTimeout(() => {
|
|
@@ -1126,7 +1394,7 @@ function Fe(r, i) {
|
|
|
1126
1394
|
}, i);
|
|
1127
1395
|
};
|
|
1128
1396
|
}
|
|
1129
|
-
function
|
|
1397
|
+
function vn(r, i) {
|
|
1130
1398
|
let t = -1 / 0;
|
|
1131
1399
|
return function(...e) {
|
|
1132
1400
|
const s = performance.now();
|
|
@@ -1140,45 +1408,45 @@ function mn(r, i) {
|
|
|
1140
1408
|
}
|
|
1141
1409
|
};
|
|
1142
1410
|
}
|
|
1143
|
-
function
|
|
1411
|
+
function yn(r, i) {
|
|
1144
1412
|
if (!r || !i) return r;
|
|
1145
|
-
const t =
|
|
1413
|
+
const t = Fe(i);
|
|
1146
1414
|
return t.length ? t.reduce((e, s, n) => {
|
|
1147
1415
|
const o = n === t.length - 1;
|
|
1148
|
-
if (
|
|
1149
|
-
const a = s.match(
|
|
1416
|
+
if (Ie.test(s)) {
|
|
1417
|
+
const a = s.match(Ne) || [];
|
|
1150
1418
|
return a.reduce((l, c, h) => {
|
|
1151
1419
|
if (/^\w+$/.test(c))
|
|
1152
1420
|
return l[c] || (h < a.length - 1 ? [] : {});
|
|
1153
|
-
const u = c.match(
|
|
1421
|
+
const u = c.match(He), f = u ? parseInt(u[1], 10) : 0, m = h === a.length - 1;
|
|
1154
1422
|
return m && o ? l[f] : l[f] || (m ? {} : []);
|
|
1155
1423
|
}, e);
|
|
1156
1424
|
}
|
|
1157
1425
|
return o ? e[s] : e[s] || {};
|
|
1158
1426
|
}, r) : r;
|
|
1159
1427
|
}
|
|
1160
|
-
function
|
|
1428
|
+
function wn(r, i, t, e) {
|
|
1161
1429
|
if (!r || !i) return t;
|
|
1162
|
-
const s =
|
|
1430
|
+
const s = Fe(i);
|
|
1163
1431
|
return s.length ? s.reduce((n, o, a) => {
|
|
1164
1432
|
const l = a === s.length - 1;
|
|
1165
|
-
if (
|
|
1166
|
-
const c = o.match(
|
|
1433
|
+
if (Ie.test(o)) {
|
|
1434
|
+
const c = o.match(Ne) || [];
|
|
1167
1435
|
return c.reduce((h, u, f) => {
|
|
1168
1436
|
const m = f === c.length - 1;
|
|
1169
1437
|
if (/^\w+$/.test(u))
|
|
1170
1438
|
return h.hasOwnProperty(u) || (h[u] = []), h[u];
|
|
1171
|
-
const g = u.match(
|
|
1439
|
+
const g = u.match(He), p = g ? parseInt(g[1], 10) : 0, y = m && l;
|
|
1172
1440
|
return h.hasOwnProperty(p) ? y && !e && (h[p] = t) : h[p] = y ? t : m ? {} : [], h[p];
|
|
1173
1441
|
}, n);
|
|
1174
1442
|
}
|
|
1175
1443
|
return l ? ((!e || !n.hasOwnProperty(o)) && (n[o] = t), n[o]) : (n.hasOwnProperty(o) || (n[o] = {}), n[o]);
|
|
1176
1444
|
}, r) : t;
|
|
1177
1445
|
}
|
|
1178
|
-
function
|
|
1446
|
+
function xn(r) {
|
|
1179
1447
|
return r.map((i, t) => r.slice(t).concat(r.slice(0, t)));
|
|
1180
1448
|
}
|
|
1181
|
-
function
|
|
1449
|
+
function di(r) {
|
|
1182
1450
|
const i = window.structuredClone, t = (e, s = /* @__PURE__ */ new WeakMap()) => {
|
|
1183
1451
|
const n = e;
|
|
1184
1452
|
if (n === null || typeof n != "object")
|
|
@@ -1269,7 +1537,7 @@ function hi(r) {
|
|
|
1269
1537
|
return console.warn("structuredClone error:", e), i && t(r);
|
|
1270
1538
|
}
|
|
1271
1539
|
}
|
|
1272
|
-
function
|
|
1540
|
+
function fi(r, i) {
|
|
1273
1541
|
const t = [
|
|
1274
1542
|
[11, "#d03050"],
|
|
1275
1543
|
[8, "#f0a020"],
|
|
@@ -1301,7 +1569,7 @@ function ui(r, i) {
|
|
|
1301
1569
|
), f;
|
|
1302
1570
|
};
|
|
1303
1571
|
}
|
|
1304
|
-
function
|
|
1572
|
+
function bn(r) {
|
|
1305
1573
|
const i = Date.now();
|
|
1306
1574
|
let t = performance.now();
|
|
1307
1575
|
for (; Date.now() - i < r; ) {
|
|
@@ -1314,191 +1582,8 @@ function yn(r) {
|
|
|
1314
1582
|
}
|
|
1315
1583
|
return Date.now() - i;
|
|
1316
1584
|
}
|
|
1317
|
-
class di {
|
|
1318
|
-
constructor() {
|
|
1319
|
-
}
|
|
1320
|
-
/**
|
|
1321
|
-
* 数值钳制,确保在合法区间内。
|
|
1322
|
-
*/
|
|
1323
|
-
static clamp(i, t, e) {
|
|
1324
|
-
return Math.min(Math.max(i, t), e);
|
|
1325
|
-
}
|
|
1326
|
-
static normalizeHue(i) {
|
|
1327
|
-
return (i % 360 + 360) % 360;
|
|
1328
|
-
}
|
|
1329
|
-
/**
|
|
1330
|
-
* 根据色相分段与色度参数生成 RGB(0-255)。
|
|
1331
|
-
*/
|
|
1332
|
-
static chromaToRgb(i, t, e) {
|
|
1333
|
-
const s = t * (1 - Math.abs(i / 60 % 2 - 1));
|
|
1334
|
-
let n = 0, o = 0, a = 0;
|
|
1335
|
-
return i < 60 ? [n, o, a] = [t, s, 0] : i < 120 ? [n, o, a] = [s, t, 0] : i < 180 ? [n, o, a] = [0, t, s] : i < 240 ? [n, o, a] = [0, s, t] : i < 300 ? [n, o, a] = [s, 0, t] : [n, o, a] = [t, 0, s], {
|
|
1336
|
-
r: (n + e) * 255,
|
|
1337
|
-
g: (o + e) * 255,
|
|
1338
|
-
b: (a + e) * 255
|
|
1339
|
-
};
|
|
1340
|
-
}
|
|
1341
|
-
static resolveAlpha(i, t) {
|
|
1342
|
-
return Number.isFinite(i) ? this.clamp(i, 0, 1) : t;
|
|
1343
|
-
}
|
|
1344
|
-
static toRoundedRgbString(i, t, e) {
|
|
1345
|
-
return `rgb(${Math.round(i)}, ${Math.round(t)}, ${Math.round(e)})`;
|
|
1346
|
-
}
|
|
1347
|
-
/**
|
|
1348
|
-
* HSL 转 RGB。
|
|
1349
|
-
* h: 0-360, s/l: 0-100
|
|
1350
|
-
*/
|
|
1351
|
-
static hslToRgb(i, t, e) {
|
|
1352
|
-
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = (1 - Math.abs(2 * o - 1)) * n, l = o - a / 2;
|
|
1353
|
-
return this.chromaToRgb(s, a, l);
|
|
1354
|
-
}
|
|
1355
|
-
/**
|
|
1356
|
-
* HSV 转 RGB。
|
|
1357
|
-
* h: 0-360, s/v: 0-100
|
|
1358
|
-
*/
|
|
1359
|
-
static hsvToRgb(i, t, e) {
|
|
1360
|
-
const s = this.normalizeHue(i), n = this.clamp(t, 0, 100) / 100, o = this.clamp(e, 0, 100) / 100, a = o * n, l = o - a;
|
|
1361
|
-
return this.chromaToRgb(s, a, l);
|
|
1362
|
-
}
|
|
1363
|
-
/**
|
|
1364
|
-
* 解析任意受支持的颜色格式并标准化为 RGBA。
|
|
1365
|
-
*/
|
|
1366
|
-
static parseColor(i) {
|
|
1367
|
-
const t = i.trim().toLowerCase();
|
|
1368
|
-
if (t.startsWith("#")) {
|
|
1369
|
-
const o = t.slice(1);
|
|
1370
|
-
if (o.length === 3 || o.length === 4) {
|
|
1371
|
-
const [a, l, c, h = "f"] = o.split("");
|
|
1372
|
-
return {
|
|
1373
|
-
r: parseInt(`${a}${a}`, 16),
|
|
1374
|
-
g: parseInt(`${l}${l}`, 16),
|
|
1375
|
-
b: parseInt(`${c}${c}`, 16),
|
|
1376
|
-
a: parseInt(`${h}${h}`, 16) / 255
|
|
1377
|
-
};
|
|
1378
|
-
}
|
|
1379
|
-
if (o.length === 6 || o.length === 8) {
|
|
1380
|
-
const a = parseInt(o.slice(0, 2), 16), l = parseInt(o.slice(2, 4), 16), c = parseInt(o.slice(4, 6), 16), h = o.length === 8 ? parseInt(o.slice(6, 8), 16) / 255 : this.DEFAULT_ALPHA;
|
|
1381
|
-
return { r: a, g: l, b: c, a: h };
|
|
1382
|
-
}
|
|
1383
|
-
}
|
|
1384
|
-
const e = t.match(/^rgba?\(([^)]+)\)$/);
|
|
1385
|
-
if (e) {
|
|
1386
|
-
const o = e[1].split(",").map((a) => a.trim());
|
|
1387
|
-
if (o.length >= 3) {
|
|
1388
|
-
const a = this.clamp(Number(o[0]), 0, 255), l = this.clamp(Number(o[1]), 0, 255), c = this.clamp(Number(o[2]), 0, 255), h = o.length >= 4 ? this.clamp(Number(o[3]), 0, 1) : this.DEFAULT_ALPHA;
|
|
1389
|
-
return { r: a, g: l, b: c, a: h };
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
const s = t.match(/^hsl\(([^)]+)\)$/);
|
|
1393
|
-
if (s) {
|
|
1394
|
-
const o = s[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1395
|
-
if (o.length >= 3) {
|
|
1396
|
-
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1397
|
-
return { ...this.hslToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
const n = t.match(/^hsv\(([^)]+)\)$/);
|
|
1401
|
-
if (n) {
|
|
1402
|
-
const o = n[1].split(",").map((a) => a.trim().replace("%", ""));
|
|
1403
|
-
if (o.length >= 3) {
|
|
1404
|
-
const a = Number(o[0]), l = Number(o[1]), c = Number(o[2]);
|
|
1405
|
-
return { ...this.hsvToRgb(a, l, c), a: this.DEFAULT_ALPHA };
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
return console.error("Invalid color format", i), { r: 0, g: 0, b: 0, a: this.DEFAULT_ALPHA };
|
|
1409
|
-
}
|
|
1410
|
-
/**
|
|
1411
|
-
* 十进制颜色分量转两位十六进制字符串。
|
|
1412
|
-
*/
|
|
1413
|
-
static toHexPart(i) {
|
|
1414
|
-
return Math.round(this.clamp(i, 0, 255)).toString(16).padStart(2, "0");
|
|
1415
|
-
}
|
|
1416
|
-
/**
|
|
1417
|
-
* RGB 转 HSL。
|
|
1418
|
-
* 返回 h:0-360, s/l:0-100
|
|
1419
|
-
*/
|
|
1420
|
-
static rgbToHsl(i, t, e) {
|
|
1421
|
-
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1422
|
-
let h = 0;
|
|
1423
|
-
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1424
|
-
const u = (a + l) / 2, f = c === 0 ? 0 : c / (1 - Math.abs(2 * u - 1));
|
|
1425
|
-
return { h, s: f * 100, l: u * 100 };
|
|
1426
|
-
}
|
|
1427
|
-
/**
|
|
1428
|
-
* RGB 转 HSV。
|
|
1429
|
-
* 返回 h:0-360, s/v:0-100
|
|
1430
|
-
*/
|
|
1431
|
-
static rgbToHsv(i, t, e) {
|
|
1432
|
-
const s = this.clamp(i, 0, 255) / 255, n = this.clamp(t, 0, 255) / 255, o = this.clamp(e, 0, 255) / 255, a = Math.max(s, n, o), l = Math.min(s, n, o), c = a - l;
|
|
1433
|
-
let h = 0;
|
|
1434
|
-
c !== 0 && (a === s ? h = 60 * ((n - o) / c % 6) : a === n ? h = 60 * ((o - s) / c + 2) : h = 60 * ((s - n) / c + 4)), h < 0 && (h += 360);
|
|
1435
|
-
const u = a === 0 ? 0 : c / a, f = a;
|
|
1436
|
-
return { h, s: u * 100, v: f * 100 };
|
|
1437
|
-
}
|
|
1438
|
-
/**
|
|
1439
|
-
* 转换为 HEX(#RRGGBB)。
|
|
1440
|
-
*/
|
|
1441
|
-
static toHex(i) {
|
|
1442
|
-
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1443
|
-
return `#${this.toHexPart(t)}${this.toHexPart(e)}${this.toHexPart(s)}`;
|
|
1444
|
-
}
|
|
1445
|
-
/**
|
|
1446
|
-
* 转换为 HEXA(#RRGGBBAA)。
|
|
1447
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1448
|
-
*/
|
|
1449
|
-
static toHexa(i, t) {
|
|
1450
|
-
const { r: e, g: s, b: n, a: o } = this.parseColor(i), a = this.resolveAlpha(t, o);
|
|
1451
|
-
return `#${this.toHexPart(e)}${this.toHexPart(s)}${this.toHexPart(n)}${this.toHexPart(a * 255)}`;
|
|
1452
|
-
}
|
|
1453
|
-
/**
|
|
1454
|
-
* 转换为 RGB(rgb(r, g, b))。
|
|
1455
|
-
*/
|
|
1456
|
-
static toRgb(i) {
|
|
1457
|
-
const { r: t, g: e, b: s } = this.parseColor(i);
|
|
1458
|
-
return this.toRoundedRgbString(t, e, s);
|
|
1459
|
-
}
|
|
1460
|
-
/**
|
|
1461
|
-
* 转换为 RGBA(rgba(r, g, b, a))。
|
|
1462
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1463
|
-
*/
|
|
1464
|
-
static toRgba(i, t) {
|
|
1465
|
-
const e = this.parseColor(i), s = this.resolveAlpha(t, e.a);
|
|
1466
|
-
return `rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)}, ${s})`;
|
|
1467
|
-
}
|
|
1468
|
-
/**
|
|
1469
|
-
* 转换为 HSL(hsl(h, s%, l%))。
|
|
1470
|
-
*/
|
|
1471
|
-
static toHsl(i) {
|
|
1472
|
-
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, l: a } = this.rgbToHsl(t, e, s);
|
|
1473
|
-
return `hsl(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1474
|
-
}
|
|
1475
|
-
/**
|
|
1476
|
-
* 转换为 HSLA(hsla(h, s%, l%, a))。
|
|
1477
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1478
|
-
*/
|
|
1479
|
-
static toHsla(i, t) {
|
|
1480
|
-
const e = this.parseColor(i), { h: s, s: n, l: o } = this.rgbToHsl(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1481
|
-
return `hsla(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(o)}%, ${a})`;
|
|
1482
|
-
}
|
|
1483
|
-
/**
|
|
1484
|
-
* 转换为 HSV(hsv(h, s%, v%))。
|
|
1485
|
-
*/
|
|
1486
|
-
static toHsv(i) {
|
|
1487
|
-
const { r: t, g: e, b: s } = this.parseColor(i), { h: n, s: o, v: a } = this.rgbToHsv(t, e, s);
|
|
1488
|
-
return `hsv(${Math.round(n)}, ${Math.round(o)}%, ${Math.round(a)}%)`;
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* 转换为 HSVA(hsva(h, s%, v%, a))。
|
|
1492
|
-
* alpha 不传时保留输入颜色中的透明度(默认 1)。
|
|
1493
|
-
*/
|
|
1494
|
-
static toHsva(i, t) {
|
|
1495
|
-
const e = this.parseColor(i), { h: s, s: n, v: o } = this.rgbToHsv(e.r, e.g, e.b), a = this.resolveAlpha(t, e.a);
|
|
1496
|
-
return `hsva(${Math.round(s)}, ${Math.round(n)}%, ${Math.round(o)}%, ${a})`;
|
|
1497
|
-
}
|
|
1498
|
-
}
|
|
1499
|
-
d(di, "DEFAULT_ALPHA", 1);
|
|
1500
1585
|
var wt = /* @__PURE__ */ ((r) => (r.RESPONSE = "response", r.QUERY = "query", r))(wt || {});
|
|
1501
|
-
class
|
|
1586
|
+
class Pn {
|
|
1502
1587
|
constructor(i, t) {
|
|
1503
1588
|
/** 音效资源地址映射(preload 成功后对应项会替换为 blob: URL) */
|
|
1504
1589
|
d(this, "soundSources");
|
|
@@ -1588,11 +1673,11 @@ class wn {
|
|
|
1588
1673
|
}), l;
|
|
1589
1674
|
}
|
|
1590
1675
|
}
|
|
1591
|
-
function
|
|
1676
|
+
function Me(r, i) {
|
|
1592
1677
|
for (const t of Object.keys(i))
|
|
1593
1678
|
i[t] !== void 0 && (r[t] = i[t]);
|
|
1594
1679
|
}
|
|
1595
|
-
class
|
|
1680
|
+
class Cn {
|
|
1596
1681
|
constructor(i) {
|
|
1597
1682
|
/** WebSocket地址 */
|
|
1598
1683
|
d(this, "url");
|
|
@@ -1633,7 +1718,7 @@ class xn {
|
|
|
1633
1718
|
});
|
|
1634
1719
|
if (!i) return;
|
|
1635
1720
|
const { url: t, ping: e, maxRetryCount: s, retryInterval: n } = i;
|
|
1636
|
-
e !== void 0 && (typeof e == "boolean" ? this.pingConfig.enabled = e :
|
|
1721
|
+
e !== void 0 && (typeof e == "boolean" ? this.pingConfig.enabled = e : Me(this.pingConfig, e)), Me(this.retryConfig, {
|
|
1637
1722
|
maxCount: s,
|
|
1638
1723
|
interval: n
|
|
1639
1724
|
}), t && this.start(t);
|
|
@@ -1684,7 +1769,7 @@ class xn {
|
|
|
1684
1769
|
(i = this.socket) == null || i.close(), this.socket = void 0;
|
|
1685
1770
|
}
|
|
1686
1771
|
}
|
|
1687
|
-
function
|
|
1772
|
+
function Sn(r, i = 10) {
|
|
1688
1773
|
let t = 0, e = i;
|
|
1689
1774
|
function s() {
|
|
1690
1775
|
if (e > 0)
|
|
@@ -1698,7 +1783,7 @@ function bn(r, i = 10) {
|
|
|
1698
1783
|
t = Date.now(), s();
|
|
1699
1784
|
});
|
|
1700
1785
|
}
|
|
1701
|
-
function
|
|
1786
|
+
function _n(r) {
|
|
1702
1787
|
const i = () => Promise.resolve(), t = (a) => (console.error(a), Promise.reject(a));
|
|
1703
1788
|
function e() {
|
|
1704
1789
|
return navigator.clipboard.writeText(r).then(i).catch(t);
|
|
@@ -1725,8 +1810,8 @@ function Pn(r) {
|
|
|
1725
1810
|
}
|
|
1726
1811
|
return navigator.clipboard ? e().catch(o) : o();
|
|
1727
1812
|
}
|
|
1728
|
-
function
|
|
1729
|
-
const t =
|
|
1813
|
+
function En(r, i) {
|
|
1814
|
+
const t = Te[r];
|
|
1730
1815
|
if (!t) return console.error(`未知纸张类型: ${r}`);
|
|
1731
1816
|
const { width: e, height: s } = t, n = (g) => g / 25.4, a = typeof window < "u" ? window.devicePixelRatio * 96 : 300, l = (g) => Math.round(n(g) * a), c = l(e), h = l(s), u = l(i), f = Math.max(0, c - 2 * u), m = Math.max(0, h - 2 * u);
|
|
1732
1817
|
return {
|
|
@@ -1793,7 +1878,7 @@ class Ht {
|
|
|
1793
1878
|
responseKey: t,
|
|
1794
1879
|
name: i
|
|
1795
1880
|
};
|
|
1796
|
-
return this.channel.postMessage(n),
|
|
1881
|
+
return this.channel.postMessage(n), ui(() => e, this.timeout).finally(
|
|
1797
1882
|
() => this.pendingQueries.delete(t)
|
|
1798
1883
|
);
|
|
1799
1884
|
}
|
|
@@ -1838,7 +1923,7 @@ d(Ht, "timeout", 150), /**
|
|
|
1838
1923
|
* @param callback 匹配标签页的回调函数
|
|
1839
1924
|
*/
|
|
1840
1925
|
d(Ht, "pendingQueries", /* @__PURE__ */ new Map());
|
|
1841
|
-
class
|
|
1926
|
+
class Mn {
|
|
1842
1927
|
constructor() {
|
|
1843
1928
|
/** 用户状态:active(活跃) / idle(闲置) */
|
|
1844
1929
|
d(this, "status", "active");
|
|
@@ -1945,7 +2030,7 @@ var ae = 9e15, ut = 1e9, le = "0123456789abcdef", Xt = "2.3025850929940456840179
|
|
|
1945
2030
|
// Whether to use cryptographically-secure random number generation, if available.
|
|
1946
2031
|
crypto: !1
|
|
1947
2032
|
// true/false
|
|
1948
|
-
},
|
|
2033
|
+
}, Be, st, _ = !0, Kt = "[DecimalError] ", ht = Kt + "Invalid argument: ", Ue = Kt + "Precision limit exceeded", Ge = Kt + "crypto unavailable", Xe = "[object Decimal]", F = Math.floor, I = Math.pow, mi = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, pi = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, gi = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Ye = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, Z = 1e7, S = 7, vi = 9007199254740991, yi = Xt.length - 1, he = Yt.length - 1, v = { toStringTag: Xe };
|
|
1949
2034
|
v.absoluteValue = v.abs = function() {
|
|
1950
2035
|
var r = new this.constructor(this);
|
|
1951
2036
|
return r.s < 0 && (r.s = 1), C(r);
|
|
@@ -1972,12 +2057,12 @@ v.comparedTo = v.cmp = function(r) {
|
|
|
1972
2057
|
};
|
|
1973
2058
|
v.cosine = v.cos = function() {
|
|
1974
2059
|
var r, i, t = this, e = t.constructor;
|
|
1975
|
-
return t.d ? t.d[0] ? (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t =
|
|
2060
|
+
return t.d ? t.d[0] ? (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = wi(e, Ke(e, t)), e.precision = r, e.rounding = i, C(st == 2 || st == 3 ? t.neg() : t, r, i, !0)) : new e(1) : new e(NaN);
|
|
1976
2061
|
};
|
|
1977
2062
|
v.cubeRoot = v.cbrt = function() {
|
|
1978
2063
|
var r, i, t, e, s, n, o, a, l, c, h = this, u = h.constructor;
|
|
1979
2064
|
if (!h.isFinite() || h.isZero()) return new u(h);
|
|
1980
|
-
for (
|
|
2065
|
+
for (_ = !1, n = h.s * I(h.s * h, 1 / 3), !n || Math.abs(n) == 1 / 0 ? (t = N(h.d), r = h.e, (n = (r - t.length + 1) % 3) && (t += n == 1 || n == -2 ? "0" : "00"), n = I(t, 1 / 3), r = F((r + 1) / 3) - (r % 3 == (r < 0 ? -1 : 2)), n == 1 / 0 ? t = "5e" + r : (t = n.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + r), e = new u(t), e.s = h.s) : e = new u(n.toString()), o = (r = u.precision) + 3; ; )
|
|
1981
2066
|
if (a = e, l = a.times(a).times(a), c = l.plus(h), e = A(c.plus(h).times(a), c.plus(l), o + 2, 1), N(a.d).slice(0, o) === (t = N(e.d)).slice(0, o))
|
|
1982
2067
|
if (t = t.slice(o - 3, o + 1), t == "9999" || !s && t == "4999") {
|
|
1983
2068
|
if (!s && (C(a, r + 1, 0), a.times(a).times(a).eq(h))) {
|
|
@@ -1989,7 +2074,7 @@ v.cubeRoot = v.cbrt = function() {
|
|
|
1989
2074
|
(!+t || !+t.slice(1) && t.charAt(0) == "5") && (C(e, r + 1, 1), i = !e.times(e).times(e).eq(h));
|
|
1990
2075
|
break;
|
|
1991
2076
|
}
|
|
1992
|
-
return
|
|
2077
|
+
return _ = !0, C(e, r, u.rounding, i);
|
|
1993
2078
|
};
|
|
1994
2079
|
v.decimalPlaces = v.dp = function() {
|
|
1995
2080
|
var r, i = this.d, t = NaN;
|
|
@@ -2050,11 +2135,11 @@ v.inverseCosine = v.acos = function() {
|
|
|
2050
2135
|
};
|
|
2051
2136
|
v.inverseHyperbolicCosine = v.acosh = function() {
|
|
2052
2137
|
var r, i, t = this, e = t.constructor;
|
|
2053
|
-
return t.lte(1) ? new e(t.eq(1) ? 0 : NaN) : t.isFinite() ? (r = e.precision, i = e.rounding, e.precision = r + Math.max(Math.abs(t.e), t.sd()) + 4, e.rounding = 1,
|
|
2138
|
+
return t.lte(1) ? new e(t.eq(1) ? 0 : NaN) : t.isFinite() ? (r = e.precision, i = e.rounding, e.precision = r + Math.max(Math.abs(t.e), t.sd()) + 4, e.rounding = 1, _ = !1, t = t.times(t).minus(1).sqrt().plus(t), _ = !0, e.precision = r, e.rounding = i, t.ln()) : new e(t);
|
|
2054
2139
|
};
|
|
2055
2140
|
v.inverseHyperbolicSine = v.asinh = function() {
|
|
2056
2141
|
var r, i, t = this, e = t.constructor;
|
|
2057
|
-
return !t.isFinite() || t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + 2 * Math.max(Math.abs(t.e), t.sd()) + 6, e.rounding = 1,
|
|
2142
|
+
return !t.isFinite() || t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + 2 * Math.max(Math.abs(t.e), t.sd()) + 6, e.rounding = 1, _ = !1, t = t.times(t).plus(1).sqrt().plus(t), _ = !0, e.precision = r, e.rounding = i, t.ln());
|
|
2058
2143
|
};
|
|
2059
2144
|
v.inverseHyperbolicTangent = v.atanh = function() {
|
|
2060
2145
|
var r, i, t, e, s = this, n = s.constructor;
|
|
@@ -2077,9 +2162,9 @@ v.inverseTangent = v.atan = function() {
|
|
|
2077
2162
|
return o = tt(h, u + 4, f).times(0.5), o.s = c.s, o;
|
|
2078
2163
|
}
|
|
2079
2164
|
for (h.precision = a = u + 10, h.rounding = 1, t = Math.min(28, a / S + 2 | 0), r = t; r; --r) c = c.div(c.times(c).plus(1).sqrt().plus(1));
|
|
2080
|
-
for (
|
|
2165
|
+
for (_ = !1, i = Math.ceil(a / S), e = 1, l = c.times(c), o = new h(c), s = c; r !== -1; )
|
|
2081
2166
|
if (s = s.times(l), n = o.minus(s.div(e += 2)), s = s.times(l), o = n.plus(s.div(e += 2)), o.d[i] !== void 0) for (r = i; o.d[r] === n.d[r] && r--; ) ;
|
|
2082
|
-
return t && (o = o.times(2 << t - 1)),
|
|
2167
|
+
return t && (o = o.times(2 << t - 1)), _ = !0, C(o, h.precision = u, h.rounding = f, !0);
|
|
2083
2168
|
};
|
|
2084
2169
|
v.isFinite = function() {
|
|
2085
2170
|
return !!this.d;
|
|
@@ -2122,14 +2207,14 @@ v.logarithm = v.log = function(r) {
|
|
|
2122
2207
|
for (s = t[0]; s % 10 === 0; ) s /= 10;
|
|
2123
2208
|
n = s !== 1;
|
|
2124
2209
|
}
|
|
2125
|
-
if (
|
|
2210
|
+
if (_ = !1, a = u + m, o = lt(c, a), e = i ? $t(h, a + 10) : lt(r, a), l = A(o, e, a, 1), At(l.d, s = u, f))
|
|
2126
2211
|
do
|
|
2127
2212
|
if (a += 10, o = lt(c, a), e = i ? $t(h, a + 10) : lt(r, a), l = A(o, e, a, 1), !n) {
|
|
2128
2213
|
+N(l.d).slice(s + 1, s + 15) + 1 == 1e14 && (l = C(l, u + 1, 0));
|
|
2129
2214
|
break;
|
|
2130
2215
|
}
|
|
2131
2216
|
while (At(l.d, s += 10, f));
|
|
2132
|
-
return
|
|
2217
|
+
return _ = !0, C(l, u, f);
|
|
2133
2218
|
};
|
|
2134
2219
|
v.minus = v.sub = function(r) {
|
|
2135
2220
|
var i, t, e, s, n, o, a, l, c, h, u, f, m = this, g = m.constructor;
|
|
@@ -2141,7 +2226,7 @@ v.minus = v.sub = function(r) {
|
|
|
2141
2226
|
if (f[0]) r.s = -r.s;
|
|
2142
2227
|
else if (c[0]) r = new g(m);
|
|
2143
2228
|
else return new g(l === 3 ? -0 : 0);
|
|
2144
|
-
return
|
|
2229
|
+
return _ ? C(r, a, l) : r;
|
|
2145
2230
|
}
|
|
2146
2231
|
if (t = F(r.e / S), h = F(m.e / S), c = c.slice(), n = h - t, n) {
|
|
2147
2232
|
for (u = n < 0, u ? (i = c, n = -n, o = f.length) : (i = f, t = h, o = c.length), e = Math.max(Math.ceil(a / S), o) + 2, n > e && (n = e, i.length = 1), i.reverse(), e = n; e--; ) i.push(0);
|
|
@@ -2164,11 +2249,11 @@ v.minus = v.sub = function(r) {
|
|
|
2164
2249
|
}
|
|
2165
2250
|
for (; c[--o] === 0; ) c.pop();
|
|
2166
2251
|
for (; c[0] === 0; c.shift()) --t;
|
|
2167
|
-
return c[0] ? (r.d = c, r.e = Zt(c, t),
|
|
2252
|
+
return c[0] ? (r.d = c, r.e = Zt(c, t), _ ? C(r, a, l) : r) : new g(l === 3 ? -0 : 0);
|
|
2168
2253
|
};
|
|
2169
2254
|
v.modulo = v.mod = function(r) {
|
|
2170
2255
|
var i, t = this, e = t.constructor;
|
|
2171
|
-
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? C(new e(t), e.precision, e.rounding) : (
|
|
2256
|
+
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? C(new e(t), e.precision, e.rounding) : (_ = !1, e.modulo == 9 ? (i = A(t, r.abs(), 0, 3, 1), i.s *= r.s) : i = A(t, r, 0, e.modulo, 1), i = i.times(r), _ = !0, t.minus(i));
|
|
2172
2257
|
};
|
|
2173
2258
|
v.naturalExponential = v.exp = function() {
|
|
2174
2259
|
return ue(this);
|
|
@@ -2187,7 +2272,7 @@ v.plus = v.add = function(r) {
|
|
|
2187
2272
|
if (u.s != r.s)
|
|
2188
2273
|
return r.s = -r.s, u.minus(r);
|
|
2189
2274
|
if (c = u.d, h = r.d, a = f.precision, l = f.rounding, !c[0] || !h[0])
|
|
2190
|
-
return h[0] || (r = new f(u)),
|
|
2275
|
+
return h[0] || (r = new f(u)), _ ? C(r, a, l) : r;
|
|
2191
2276
|
if (n = F(u.e / S), e = F(r.e / S), c = c.slice(), s = n - e, s) {
|
|
2192
2277
|
for (s < 0 ? (t = c, s = -s, o = h.length) : (t = h, e = n, o = c.length), n = Math.ceil(a / S), o = n > o ? n + 1 : o + 1, s > o && (s = o, t.length = 1), t.reverse(); s--; ) t.push(0);
|
|
2193
2278
|
t.reverse();
|
|
@@ -2195,12 +2280,12 @@ v.plus = v.add = function(r) {
|
|
|
2195
2280
|
for (o = c.length, s = h.length, o - s < 0 && (s = o, t = h, h = c, c = t), i = 0; s; )
|
|
2196
2281
|
i = (c[--s] = c[s] + h[s] + i) / Z | 0, c[s] %= Z;
|
|
2197
2282
|
for (i && (c.unshift(i), ++e), o = c.length; c[--o] == 0; ) c.pop();
|
|
2198
|
-
return r.d = c, r.e = Zt(c, e),
|
|
2283
|
+
return r.d = c, r.e = Zt(c, e), _ ? C(r, a, l) : r;
|
|
2199
2284
|
};
|
|
2200
2285
|
v.precision = v.sd = function(r) {
|
|
2201
2286
|
var i, t = this;
|
|
2202
2287
|
if (r !== void 0 && r !== !!r && r !== 1 && r !== 0) throw Error(ht + r);
|
|
2203
|
-
return t.d ? (i =
|
|
2288
|
+
return t.d ? (i = $e(t.d), r && t.e + 1 > i && (i = t.e + 1)) : i = NaN, i;
|
|
2204
2289
|
};
|
|
2205
2290
|
v.round = function() {
|
|
2206
2291
|
var r = this, i = r.constructor;
|
|
@@ -2208,13 +2293,13 @@ v.round = function() {
|
|
|
2208
2293
|
};
|
|
2209
2294
|
v.sine = v.sin = function() {
|
|
2210
2295
|
var r, i, t = this, e = t.constructor;
|
|
2211
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t =
|
|
2296
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, i = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = bi(e, Ke(e, t)), e.precision = r, e.rounding = i, C(st > 2 ? t.neg() : t, r, i, !0)) : new e(NaN);
|
|
2212
2297
|
};
|
|
2213
2298
|
v.squareRoot = v.sqrt = function() {
|
|
2214
2299
|
var r, i, t, e, s, n, o = this, a = o.d, l = o.e, c = o.s, h = o.constructor;
|
|
2215
2300
|
if (c !== 1 || !a || !a[0])
|
|
2216
2301
|
return new h(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
|
|
2217
|
-
for (
|
|
2302
|
+
for (_ = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (i = N(a), (i.length + l) % 2 == 0 && (i += "0"), c = Math.sqrt(i), l = F((l + 1) / 2) - (l < 0 || l % 2), c == 1 / 0 ? i = "5e" + l : (i = c.toExponential(), i = i.slice(0, i.indexOf("e") + 1) + l), e = new h(i)) : e = new h(c.toString()), t = (l = h.precision) + 3; ; )
|
|
2218
2303
|
if (n = e, e = n.plus(A(o, n, t + 2, 1)).times(0.5), N(n.d).slice(0, t) === (i = N(e.d)).slice(0, t))
|
|
2219
2304
|
if (i = i.slice(t - 3, t + 1), i == "9999" || !s && i == "4999") {
|
|
2220
2305
|
if (!s && (C(n, l + 1, 0), n.times(n).eq(o))) {
|
|
@@ -2226,7 +2311,7 @@ v.squareRoot = v.sqrt = function() {
|
|
|
2226
2311
|
(!+i || !+i.slice(1) && i.charAt(0) == "5") && (C(e, l + 1, 1), r = !e.times(e).eq(o));
|
|
2227
2312
|
break;
|
|
2228
2313
|
}
|
|
2229
|
-
return
|
|
2314
|
+
return _ = !0, C(e, l, h.rounding, r);
|
|
2230
2315
|
};
|
|
2231
2316
|
v.tangent = v.tan = function() {
|
|
2232
2317
|
var r, i, t = this, e = t.constructor;
|
|
@@ -2243,10 +2328,10 @@ v.times = v.mul = function(r) {
|
|
|
2243
2328
|
n[s] = (n[s] + i) % Z | 0;
|
|
2244
2329
|
}
|
|
2245
2330
|
for (; !n[--o]; ) n.pop();
|
|
2246
|
-
return i ? ++t : n.shift(), r.d = n, r.e = Zt(n, t),
|
|
2331
|
+
return i ? ++t : n.shift(), r.d = n, r.e = Zt(n, t), _ ? C(r, u.precision, u.rounding) : r;
|
|
2247
2332
|
};
|
|
2248
2333
|
v.toBinary = function(r, i) {
|
|
2249
|
-
return
|
|
2334
|
+
return be(this, 2, r, i);
|
|
2250
2335
|
};
|
|
2251
2336
|
v.toDecimalPlaces = v.toDP = function(r, i) {
|
|
2252
2337
|
var t = this, e = t.constructor;
|
|
@@ -2263,18 +2348,18 @@ v.toFixed = function(r, i) {
|
|
|
2263
2348
|
v.toFraction = function(r) {
|
|
2264
2349
|
var i, t, e, s, n, o, a, l, c, h, u, f, m = this, g = m.d, p = m.constructor;
|
|
2265
2350
|
if (!g) return new p(m);
|
|
2266
|
-
if (c = t = new p(1), e = l = new p(0), i = new p(e), n = i.e =
|
|
2351
|
+
if (c = t = new p(1), e = l = new p(0), i = new p(e), n = i.e = $e(g) - m.e - 1, o = n % S, i.d[0] = I(10, o < 0 ? S + o : o), r == null)
|
|
2267
2352
|
r = n > 0 ? i : c;
|
|
2268
2353
|
else {
|
|
2269
2354
|
if (a = new p(r), !a.isInt() || a.lt(c)) throw Error(ht + a);
|
|
2270
2355
|
r = a.gt(i) ? n > 0 ? i : c : a;
|
|
2271
2356
|
}
|
|
2272
|
-
for (
|
|
2357
|
+
for (_ = !1, a = new p(N(g)), h = p.precision, p.precision = n = g.length * S * 2; u = A(a, i, 0, 1, 1), s = t.plus(u.times(e)), s.cmp(r) != 1; )
|
|
2273
2358
|
t = e, e = s, s = c, c = l.plus(u.times(s)), l = s, s = i, i = a.minus(u.times(s)), a = s;
|
|
2274
|
-
return s = A(r.minus(t), e, 0, 1, 1), l = l.plus(s.times(c)), t = t.plus(s.times(e)), l.s = c.s = m.s, f = A(c, e, n, 1).minus(m).abs().cmp(A(l, t, n, 1).minus(m).abs()) < 1 ? [c, e] : [l, t], p.precision = h,
|
|
2359
|
+
return s = A(r.minus(t), e, 0, 1, 1), l = l.plus(s.times(c)), t = t.plus(s.times(e)), l.s = c.s = m.s, f = A(c, e, n, 1).minus(m).abs().cmp(A(l, t, n, 1).minus(m).abs()) < 1 ? [c, e] : [l, t], p.precision = h, _ = !0, f;
|
|
2275
2360
|
};
|
|
2276
2361
|
v.toHexadecimal = v.toHex = function(r, i) {
|
|
2277
|
-
return
|
|
2362
|
+
return be(this, 16, r, i);
|
|
2278
2363
|
};
|
|
2279
2364
|
v.toNearest = function(r, i) {
|
|
2280
2365
|
var t = this, e = t.constructor;
|
|
@@ -2286,27 +2371,27 @@ v.toNearest = function(r, i) {
|
|
|
2286
2371
|
if (!r.d)
|
|
2287
2372
|
return r.s && (r.s = t.s), r;
|
|
2288
2373
|
}
|
|
2289
|
-
return r.d[0] ? (
|
|
2374
|
+
return r.d[0] ? (_ = !1, t = A(t, r, 0, i, 1).times(r), _ = !0, C(t)) : (r.s = t.s, t = r), t;
|
|
2290
2375
|
};
|
|
2291
2376
|
v.toNumber = function() {
|
|
2292
2377
|
return +this;
|
|
2293
2378
|
};
|
|
2294
2379
|
v.toOctal = function(r, i) {
|
|
2295
|
-
return
|
|
2380
|
+
return be(this, 8, r, i);
|
|
2296
2381
|
};
|
|
2297
2382
|
v.toPower = v.pow = function(r) {
|
|
2298
2383
|
var i, t, e, s, n, o, a = this, l = a.constructor, c = +(r = new l(r));
|
|
2299
2384
|
if (!a.d || !r.d || !a.d[0] || !r.d[0]) return new l(I(+a, c));
|
|
2300
2385
|
if (a = new l(a), a.eq(1)) return a;
|
|
2301
2386
|
if (e = l.precision, n = l.rounding, r.eq(1)) return C(a, e, n);
|
|
2302
|
-
if (i = F(r.e / S), i >= r.d.length - 1 && (t = c < 0 ? -c : c) <=
|
|
2303
|
-
return s =
|
|
2387
|
+
if (i = F(r.e / S), i >= r.d.length - 1 && (t = c < 0 ? -c : c) <= vi)
|
|
2388
|
+
return s = je(l, a, t, e), r.s < 0 ? new l(1).div(s) : C(s, e, n);
|
|
2304
2389
|
if (o = a.s, o < 0) {
|
|
2305
2390
|
if (i < r.d.length - 1) return new l(NaN);
|
|
2306
2391
|
if (r.d[i] & 1 || (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
|
|
2307
2392
|
return a.s = o, a;
|
|
2308
2393
|
}
|
|
2309
|
-
return t = I(+a, c), i = t == 0 || !isFinite(t) ? F(c * (Math.log("0." + N(a.d)) / Math.LN10 + a.e + 1)) : new l(t + "").e, i > l.maxE + 1 || i < l.minE - 1 ? new l(i > 0 ? o / 0 : 0) : (
|
|
2394
|
+
return t = I(+a, c), i = t == 0 || !isFinite(t) ? F(c * (Math.log("0." + N(a.d)) / Math.LN10 + a.e + 1)) : new l(t + "").e, i > l.maxE + 1 || i < l.minE - 1 ? new l(i > 0 ? o / 0 : 0) : (_ = !1, l.rounding = a.s = 1, t = Math.min(12, (i + "").length), s = ue(r.times(lt(a, e + t)), e), s.d && (s = C(s, e + 5, 1), At(s.d, e, n) && (i = e + 10, s = C(ue(r.times(lt(a, i + t)), i), i + 5, 1), +N(s.d).slice(e + 1, e + 15) + 1 == 1e14 && (s = C(s, e + 1, 0)))), s.s = o, _ = !0, l.rounding = n, C(s, e, n));
|
|
2310
2395
|
};
|
|
2311
2396
|
v.toPrecision = function(r, i) {
|
|
2312
2397
|
var t, e = this, s = e.constructor;
|
|
@@ -2355,7 +2440,7 @@ function zt(r, i, t) {
|
|
|
2355
2440
|
}
|
|
2356
2441
|
return s.reverse();
|
|
2357
2442
|
}
|
|
2358
|
-
function
|
|
2443
|
+
function wi(r, i) {
|
|
2359
2444
|
var t, e, s;
|
|
2360
2445
|
if (i.isZero()) return i;
|
|
2361
2446
|
e = i.d.length, e < 32 ? (t = Math.ceil(e / 3), s = (1 / Qt(4, t)).toString()) : (t = 16, s = "2.3283064365386962890625e-10"), r.precision += t, i = Dt(r, 1, i.times(s), new r(1));
|
|
@@ -2390,7 +2475,7 @@ var A = /* @__PURE__ */ function() {
|
|
|
2390
2475
|
for (; !e[0] && e.length > 1; ) e.shift();
|
|
2391
2476
|
}
|
|
2392
2477
|
return function(e, s, n, o, a, l) {
|
|
2393
|
-
var c, h, u, f, m, g, p, y, w, b, P,
|
|
2478
|
+
var c, h, u, f, m, g, p, y, w, b, P, E, O, G, Lt, dt, nt, yt, X, Tt, It = e.constructor, Jt = e.s == s.s ? 1 : -1, H = e.d, V = s.d;
|
|
2394
2479
|
if (!H || !H[0] || !V || !V[0])
|
|
2395
2480
|
return new It(
|
|
2396
2481
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
@@ -2408,17 +2493,17 @@ var A = /* @__PURE__ */ function() {
|
|
|
2408
2493
|
Lt = f * l + (H[u] || 0), b[u] = Lt / V | 0, f = Lt % V | 0;
|
|
2409
2494
|
g = f || u < nt;
|
|
2410
2495
|
} else {
|
|
2411
|
-
for (f = l / (V[0] + 1) | 0, f > 1 && (V = r(V, f, l), H = r(H, f, l), X = V.length, nt = H.length), dt = X, P = H.slice(0, X),
|
|
2496
|
+
for (f = l / (V[0] + 1) | 0, f > 1 && (V = r(V, f, l), H = r(H, f, l), X = V.length, nt = H.length), dt = X, P = H.slice(0, X), E = P.length; E < X; ) P[E++] = 0;
|
|
2412
2497
|
Tt = V.slice(), Tt.unshift(0), yt = V[0], V[1] >= l / 2 && ++yt;
|
|
2413
2498
|
do
|
|
2414
|
-
f = 0, c = i(V, P, X,
|
|
2499
|
+
f = 0, c = i(V, P, X, E), c < 0 ? (O = P[0], X != E && (O = O * l + (P[1] || 0)), f = O / yt | 0, f > 1 ? (f >= l && (f = l - 1), p = r(V, f, l), y = p.length, E = P.length, c = i(p, P, y, E), c == 1 && (f--, t(p, X < y ? Tt : V, y, l))) : (f == 0 && (c = f = 1), p = V.slice()), y = p.length, y < E && p.unshift(0), t(P, p, E, l), c == -1 && (E = P.length, c = i(V, P, X, E), c < 1 && (f++, t(P, X < E ? Tt : V, E, l))), E = P.length) : c === 0 && (f++, P = [0]), b[u++] = f, c && P[0] ? P[E++] = H[dt] || 0 : (P = [H[dt]], E = 1);
|
|
2415
2500
|
while ((dt++ < nt || P[0] !== void 0) && G--);
|
|
2416
2501
|
g = P[0] !== void 0;
|
|
2417
2502
|
}
|
|
2418
2503
|
b[0] || b.shift();
|
|
2419
2504
|
}
|
|
2420
2505
|
if (m == 1)
|
|
2421
|
-
w.e = h,
|
|
2506
|
+
w.e = h, Be = g;
|
|
2422
2507
|
else {
|
|
2423
2508
|
for (u = 1, f = b[0]; f >= 10; f /= 10) u++;
|
|
2424
2509
|
w.e = u + h * m - 1, C(w, a ? n + w.e + 1 : n, o, g);
|
|
@@ -2459,10 +2544,10 @@ function C(r, i, t, e) {
|
|
|
2459
2544
|
}
|
|
2460
2545
|
for (n = u.length; u[--n] === 0; ) u.pop();
|
|
2461
2546
|
}
|
|
2462
|
-
return
|
|
2547
|
+
return _ && (r.e > m.maxE ? (r.d = null, r.e = NaN) : r.e < m.minE && (r.e = 0, r.d = [0])), r;
|
|
2463
2548
|
}
|
|
2464
2549
|
function et(r, i, t) {
|
|
2465
|
-
if (!r.isFinite()) return
|
|
2550
|
+
if (!r.isFinite()) return qe(r);
|
|
2466
2551
|
var e, s = r.e, n = N(r.d), o = n.length;
|
|
2467
2552
|
return i ? (t && (e = t - o) > 0 ? n = n.charAt(0) + "." + n.slice(1) + rt(e) : o > 1 && (n = n.charAt(0) + "." + n.slice(1)), n = n + (r.e < 0 ? "e" : "e+") + r.e) : s < 0 ? (n = "0." + rt(-s - 1) + n, t && (e = t - o) > 0 && (n += rt(e))) : s >= o ? (n += rt(s + 1 - o), t && (e = t - s - 1) > 0 && (n = n + "." + rt(e))) : ((e = s + 1) < o && (n = n.slice(0, e) + "." + n.slice(e)), t && (e = t - o) > 0 && (s + 1 === o && (n += "."), n += rt(e))), n;
|
|
2468
2553
|
}
|
|
@@ -2472,15 +2557,15 @@ function Zt(r, i) {
|
|
|
2472
2557
|
return i;
|
|
2473
2558
|
}
|
|
2474
2559
|
function $t(r, i, t) {
|
|
2475
|
-
if (i >
|
|
2476
|
-
throw
|
|
2560
|
+
if (i > yi)
|
|
2561
|
+
throw _ = !0, t && (r.precision = t), Error(Ue);
|
|
2477
2562
|
return C(new r(Xt), i, 1, !0);
|
|
2478
2563
|
}
|
|
2479
2564
|
function tt(r, i, t) {
|
|
2480
|
-
if (i > he) throw Error(
|
|
2565
|
+
if (i > he) throw Error(Ue);
|
|
2481
2566
|
return C(new r(Yt), i, t, !0);
|
|
2482
2567
|
}
|
|
2483
|
-
function
|
|
2568
|
+
function $e(r) {
|
|
2484
2569
|
var i = r.length - 1, t = i * S + 1;
|
|
2485
2570
|
if (i = r[i], i) {
|
|
2486
2571
|
for (; i % 10 == 0; i /= 10) t--;
|
|
@@ -2492,21 +2577,21 @@ function rt(r) {
|
|
|
2492
2577
|
for (var i = ""; r--; ) i += "0";
|
|
2493
2578
|
return i;
|
|
2494
2579
|
}
|
|
2495
|
-
function
|
|
2580
|
+
function je(r, i, t, e) {
|
|
2496
2581
|
var s, n = new r(1), o = Math.ceil(e / S + 4);
|
|
2497
|
-
for (
|
|
2498
|
-
if (t % 2 && (n = n.times(i),
|
|
2582
|
+
for (_ = !1; ; ) {
|
|
2583
|
+
if (t % 2 && (n = n.times(i), ke(n.d, o) && (s = !0)), t = F(t / 2), t === 0) {
|
|
2499
2584
|
t = n.d.length - 1, s && n.d[t] === 0 && ++n.d[t];
|
|
2500
2585
|
break;
|
|
2501
2586
|
}
|
|
2502
|
-
i = i.times(i),
|
|
2587
|
+
i = i.times(i), ke(i.d, o);
|
|
2503
2588
|
}
|
|
2504
|
-
return
|
|
2589
|
+
return _ = !0, n;
|
|
2505
2590
|
}
|
|
2506
|
-
function
|
|
2591
|
+
function De(r) {
|
|
2507
2592
|
return r.d[r.d.length - 1] & 1;
|
|
2508
2593
|
}
|
|
2509
|
-
function
|
|
2594
|
+
function We(r, i, t) {
|
|
2510
2595
|
for (var e, s, n = new r(i[0]), o = 0; ++o < i.length; ) {
|
|
2511
2596
|
if (s = new r(i[o]), !s.s) {
|
|
2512
2597
|
n = s;
|
|
@@ -2520,7 +2605,7 @@ function ue(r, i) {
|
|
|
2520
2605
|
var t, e, s, n, o, a, l, c = 0, h = 0, u = 0, f = r.constructor, m = f.rounding, g = f.precision;
|
|
2521
2606
|
if (!r.d || !r.d[0] || r.e > 17)
|
|
2522
2607
|
return new f(r.d ? r.d[0] ? r.s < 0 ? 0 : 1 / 0 : 1 : r.s ? r.s < 0 ? 0 : r : NaN);
|
|
2523
|
-
for (i == null ? (
|
|
2608
|
+
for (i == null ? (_ = !1, l = g) : l = i, a = new f(0.03125); r.e > -2; )
|
|
2524
2609
|
r = r.times(a), u += 5;
|
|
2525
2610
|
for (e = Math.log(I(2, u)) / Math.LN10 * 2 + 5 | 0, l += e, t = n = o = new f(1), f.precision = l; ; ) {
|
|
2526
2611
|
if (n = C(n.times(r), l, 1), t = t.times(++h), a = o.plus(A(n, t, l, 1)), N(a.d).slice(0, l) === N(o.d).slice(0, l)) {
|
|
@@ -2529,7 +2614,7 @@ function ue(r, i) {
|
|
|
2529
2614
|
if (c < 3 && At(o.d, l - e, m, c))
|
|
2530
2615
|
f.precision = l += 10, t = n = a = new f(1), h = 0, c++;
|
|
2531
2616
|
else
|
|
2532
|
-
return C(o, f.precision = g, m,
|
|
2617
|
+
return C(o, f.precision = g, m, _ = !0);
|
|
2533
2618
|
else
|
|
2534
2619
|
return f.precision = g, o;
|
|
2535
2620
|
}
|
|
@@ -2540,25 +2625,25 @@ function lt(r, i) {
|
|
|
2540
2625
|
var t, e, s, n, o, a, l, c, h, u, f, m = 1, g = 10, p = r, y = p.d, w = p.constructor, b = w.rounding, P = w.precision;
|
|
2541
2626
|
if (p.s < 0 || !y || !y[0] || !p.e && y[0] == 1 && y.length == 1)
|
|
2542
2627
|
return new w(y && !y[0] ? -1 / 0 : p.s != 1 ? NaN : y ? 0 : p);
|
|
2543
|
-
if (i == null ? (
|
|
2628
|
+
if (i == null ? (_ = !1, h = P) : h = i, w.precision = h += g, t = N(y), e = t.charAt(0), Math.abs(n = p.e) < 15e14) {
|
|
2544
2629
|
for (; e < 7 && e != 1 || e == 1 && t.charAt(1) > 3; )
|
|
2545
2630
|
p = p.times(r), t = N(p.d), e = t.charAt(0), m++;
|
|
2546
2631
|
n = p.e, e > 1 ? (p = new w("0." + t), n++) : p = new w(e + "." + t.slice(1));
|
|
2547
2632
|
} else
|
|
2548
|
-
return c = $t(w, h + 2, P).times(n + ""), p = lt(new w(e + "." + t.slice(1)), h - g).plus(c), w.precision = P, i == null ? C(p, P, b,
|
|
2633
|
+
return c = $t(w, h + 2, P).times(n + ""), p = lt(new w(e + "." + t.slice(1)), h - g).plus(c), w.precision = P, i == null ? C(p, P, b, _ = !0) : p;
|
|
2549
2634
|
for (u = p, l = o = p = A(p.minus(1), p.plus(1), h, 1), f = C(p.times(p), h, 1), s = 3; ; ) {
|
|
2550
2635
|
if (o = C(o.times(f), h, 1), c = l.plus(A(o, new w(s), h, 1)), N(c.d).slice(0, h) === N(l.d).slice(0, h))
|
|
2551
2636
|
if (l = l.times(2), n !== 0 && (l = l.plus($t(w, h + 2, P).times(n + ""))), l = A(l, new w(m), h, 1), i == null)
|
|
2552
2637
|
if (At(l.d, h - g, b, a))
|
|
2553
2638
|
w.precision = h += g, c = o = p = A(u.minus(1), u.plus(1), h, 1), f = C(p.times(p), h, 1), s = a = 1;
|
|
2554
2639
|
else
|
|
2555
|
-
return C(l, w.precision = P, b,
|
|
2640
|
+
return C(l, w.precision = P, b, _ = !0);
|
|
2556
2641
|
else
|
|
2557
2642
|
return w.precision = P, l;
|
|
2558
2643
|
l = c, s += 2;
|
|
2559
2644
|
}
|
|
2560
2645
|
}
|
|
2561
|
-
function
|
|
2646
|
+
function qe(r) {
|
|
2562
2647
|
return String(r.s * r.s / 0);
|
|
2563
2648
|
}
|
|
2564
2649
|
function Bt(r, i) {
|
|
@@ -2572,29 +2657,29 @@ function Bt(r, i) {
|
|
|
2572
2657
|
} else
|
|
2573
2658
|
e -= s;
|
|
2574
2659
|
for (; e--; ) i += "0";
|
|
2575
|
-
r.d.push(+i),
|
|
2660
|
+
r.d.push(+i), _ && (r.e > r.constructor.maxE ? (r.d = null, r.e = NaN) : r.e < r.constructor.minE && (r.e = 0, r.d = [0]));
|
|
2576
2661
|
} else
|
|
2577
2662
|
r.e = 0, r.d = [0];
|
|
2578
2663
|
return r;
|
|
2579
2664
|
}
|
|
2580
|
-
function
|
|
2665
|
+
function xi(r, i) {
|
|
2581
2666
|
var t, e, s, n, o, a, l, c, h;
|
|
2582
2667
|
if (i.indexOf("_") > -1) {
|
|
2583
|
-
if (i = i.replace(/(\d)_(?=\d)/g, "$1"),
|
|
2668
|
+
if (i = i.replace(/(\d)_(?=\d)/g, "$1"), Ye.test(i)) return Bt(r, i);
|
|
2584
2669
|
} else if (i === "Infinity" || i === "NaN")
|
|
2585
2670
|
return +i || (r.s = NaN), r.e = NaN, r.d = null, r;
|
|
2586
|
-
if (
|
|
2671
|
+
if (pi.test(i))
|
|
2587
2672
|
t = 16, i = i.toLowerCase();
|
|
2588
|
-
else if (
|
|
2673
|
+
else if (mi.test(i))
|
|
2589
2674
|
t = 2;
|
|
2590
|
-
else if (
|
|
2675
|
+
else if (gi.test(i))
|
|
2591
2676
|
t = 8;
|
|
2592
2677
|
else
|
|
2593
2678
|
throw Error(ht + i);
|
|
2594
|
-
for (n = i.search(/p/i), n > 0 ? (l = +i.slice(n + 1), i = i.substring(2, n)) : i = i.slice(2), n = i.indexOf("."), o = n >= 0, e = r.constructor, o && (i = i.replace(".", ""), a = i.length, n = a - n, s =
|
|
2595
|
-
return n < 0 ? new e(r.s * 0) : (r.e = Zt(c, h), r.d = c,
|
|
2679
|
+
for (n = i.search(/p/i), n > 0 ? (l = +i.slice(n + 1), i = i.substring(2, n)) : i = i.slice(2), n = i.indexOf("."), o = n >= 0, e = r.constructor, o && (i = i.replace(".", ""), a = i.length, n = a - n, s = je(e, new e(t), n, n * 2)), c = zt(i, t, Z), h = c.length - 1, n = h; c[n] === 0; --n) c.pop();
|
|
2680
|
+
return n < 0 ? new e(r.s * 0) : (r.e = Zt(c, h), r.d = c, _ = !1, o && (r = A(r, s, a * 4)), l && (r = r.times(Math.abs(l) < 54 ? I(2, l) : k.pow(2, l))), _ = !0, r);
|
|
2596
2681
|
}
|
|
2597
|
-
function
|
|
2682
|
+
function bi(r, i) {
|
|
2598
2683
|
var t, e = i.d.length;
|
|
2599
2684
|
if (e < 3)
|
|
2600
2685
|
return i.isZero() ? i : Dt(r, 2, i, i);
|
|
@@ -2605,20 +2690,20 @@ function xi(r, i) {
|
|
|
2605
2690
|
}
|
|
2606
2691
|
function Dt(r, i, t, e, s) {
|
|
2607
2692
|
var n, o, a, l, c = r.precision, h = Math.ceil(c / S);
|
|
2608
|
-
for (
|
|
2693
|
+
for (_ = !1, l = t.times(t), a = new r(e); ; ) {
|
|
2609
2694
|
if (o = A(a.times(l), new r(i++ * i++), c, 1), a = s ? e.plus(o) : e.minus(o), e = A(o.times(l), new r(i++ * i++), c, 1), o = a.plus(e), o.d[h] !== void 0) {
|
|
2610
2695
|
for (n = h; o.d[n] === a.d[n] && n--; ) ;
|
|
2611
2696
|
if (n == -1) break;
|
|
2612
2697
|
}
|
|
2613
2698
|
n = a, a = e, e = o, o = n;
|
|
2614
2699
|
}
|
|
2615
|
-
return
|
|
2700
|
+
return _ = !0, o.d.length = h + 1, o;
|
|
2616
2701
|
}
|
|
2617
2702
|
function Qt(r, i) {
|
|
2618
2703
|
for (var t = r; --i; ) t *= r;
|
|
2619
2704
|
return t;
|
|
2620
2705
|
}
|
|
2621
|
-
function
|
|
2706
|
+
function Ke(r, i) {
|
|
2622
2707
|
var t, e = i.s < 0, s = tt(r, r.precision, 1), n = s.times(0.5);
|
|
2623
2708
|
if (i = i.abs(), i.lte(n))
|
|
2624
2709
|
return st = e ? 4 : 1, i;
|
|
@@ -2626,21 +2711,21 @@ function qe(r, i) {
|
|
|
2626
2711
|
st = e ? 3 : 2;
|
|
2627
2712
|
else {
|
|
2628
2713
|
if (i = i.minus(t.times(s)), i.lte(n))
|
|
2629
|
-
return st =
|
|
2630
|
-
st =
|
|
2714
|
+
return st = De(t) ? e ? 2 : 3 : e ? 4 : 1, i;
|
|
2715
|
+
st = De(t) ? e ? 1 : 4 : e ? 3 : 2;
|
|
2631
2716
|
}
|
|
2632
2717
|
return i.minus(s).abs();
|
|
2633
2718
|
}
|
|
2634
|
-
function
|
|
2719
|
+
function be(r, i, t, e) {
|
|
2635
2720
|
var s, n, o, a, l, c, h, u, f, m = r.constructor, g = t !== void 0;
|
|
2636
2721
|
if (g ? (U(t, 1, ut), e === void 0 ? e = m.rounding : U(e, 0, 8)) : (t = m.precision, e = m.rounding), !r.isFinite())
|
|
2637
|
-
h =
|
|
2722
|
+
h = qe(r);
|
|
2638
2723
|
else {
|
|
2639
2724
|
for (h = et(r), o = h.indexOf("."), g ? (s = 2, i == 16 ? t = t * 4 - 3 : i == 8 && (t = t * 3 - 2)) : s = i, o >= 0 && (h = h.replace(".", ""), f = new m(1), f.e = h.length - o, f.d = zt(et(f), 10, s), f.e = f.d.length), u = zt(h, 10, s), n = l = u.length; u[--l] == 0; ) u.pop();
|
|
2640
2725
|
if (!u[0])
|
|
2641
2726
|
h = g ? "0p+0" : "0";
|
|
2642
2727
|
else {
|
|
2643
|
-
if (o < 0 ? n-- : (r = new m(r), r.d = u, r.e = n, r = A(r, f, t, e, 0, s), u = r.d, n = r.e, c =
|
|
2728
|
+
if (o < 0 ? n-- : (r = new m(r), r.d = u, r.e = n, r = A(r, f, t, e, 0, s), u = r.d, n = r.e, c = Be), o = u[t], a = s / 2, c = c || u[t + 1] !== void 0, c = e < 4 ? (o !== void 0 || c) && (e === 0 || e === (r.s < 0 ? 3 : 2)) : o > a || o === a && (e === 4 || c || e === 6 && u[t - 1] & 1 || e === (r.s < 0 ? 8 : 7)), u.length = t, c)
|
|
2644
2729
|
for (; ++u[--t] > s - 1; )
|
|
2645
2730
|
u[t] = 0, t || (++n, u.unshift(1));
|
|
2646
2731
|
for (l = u.length; !u[l - 1]; --l) ;
|
|
@@ -2664,49 +2749,49 @@ function xe(r, i, t, e) {
|
|
|
2664
2749
|
}
|
|
2665
2750
|
return r.s < 0 ? "-" + h : h;
|
|
2666
2751
|
}
|
|
2667
|
-
function
|
|
2752
|
+
function ke(r, i) {
|
|
2668
2753
|
if (r.length > i)
|
|
2669
2754
|
return r.length = i, !0;
|
|
2670
2755
|
}
|
|
2671
|
-
function
|
|
2756
|
+
function Pi(r) {
|
|
2672
2757
|
return new this(r).abs();
|
|
2673
2758
|
}
|
|
2674
|
-
function
|
|
2759
|
+
function Ci(r) {
|
|
2675
2760
|
return new this(r).acos();
|
|
2676
2761
|
}
|
|
2677
|
-
function
|
|
2762
|
+
function Si(r) {
|
|
2678
2763
|
return new this(r).acosh();
|
|
2679
2764
|
}
|
|
2680
|
-
function
|
|
2765
|
+
function _i(r, i) {
|
|
2681
2766
|
return new this(r).plus(i);
|
|
2682
2767
|
}
|
|
2683
2768
|
function Ei(r) {
|
|
2684
2769
|
return new this(r).asin();
|
|
2685
2770
|
}
|
|
2686
|
-
function
|
|
2771
|
+
function Mi(r) {
|
|
2687
2772
|
return new this(r).asinh();
|
|
2688
2773
|
}
|
|
2689
|
-
function
|
|
2774
|
+
function Di(r) {
|
|
2690
2775
|
return new this(r).atan();
|
|
2691
2776
|
}
|
|
2692
|
-
function
|
|
2777
|
+
function ki(r) {
|
|
2693
2778
|
return new this(r).atanh();
|
|
2694
2779
|
}
|
|
2695
|
-
function
|
|
2780
|
+
function Ri(r, i) {
|
|
2696
2781
|
r = new this(r), i = new this(i);
|
|
2697
2782
|
var t, e = this.precision, s = this.rounding, n = e + 4;
|
|
2698
2783
|
return !r.s || !i.s ? t = new this(NaN) : !r.d && !i.d ? (t = tt(this, n, 1).times(i.s > 0 ? 0.25 : 0.75), t.s = r.s) : !i.d || r.isZero() ? (t = i.s < 0 ? tt(this, e, s) : new this(0), t.s = r.s) : !r.d || i.isZero() ? (t = tt(this, n, 1).times(0.5), t.s = r.s) : i.s < 0 ? (this.precision = n, this.rounding = 1, t = this.atan(A(r, i, n, 1)), i = tt(this, n, 1), this.precision = e, this.rounding = s, t = r.s < 0 ? t.minus(i) : t.plus(i)) : t = this.atan(A(r, i, n, 1)), t;
|
|
2699
2784
|
}
|
|
2700
|
-
function
|
|
2785
|
+
function Ai(r) {
|
|
2701
2786
|
return new this(r).cbrt();
|
|
2702
2787
|
}
|
|
2703
|
-
function
|
|
2788
|
+
function Vi(r) {
|
|
2704
2789
|
return C(r = new this(r), r.e + 1, 2);
|
|
2705
2790
|
}
|
|
2706
|
-
function
|
|
2791
|
+
function Oi(r, i, t) {
|
|
2707
2792
|
return new this(r).clamp(i, t);
|
|
2708
2793
|
}
|
|
2709
|
-
function
|
|
2794
|
+
function Li(r) {
|
|
2710
2795
|
if (!r || typeof r != "object") throw Error(Kt + "Object expected");
|
|
2711
2796
|
var i, t, e, s = r.defaults === !0, n = [
|
|
2712
2797
|
"precision",
|
|
@@ -2741,26 +2826,26 @@ function Oi(r) {
|
|
|
2741
2826
|
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
2742
2827
|
this[t] = !0;
|
|
2743
2828
|
else
|
|
2744
|
-
throw Error(
|
|
2829
|
+
throw Error(Ge);
|
|
2745
2830
|
else
|
|
2746
2831
|
this[t] = !1;
|
|
2747
2832
|
else
|
|
2748
2833
|
throw Error(ht + t + ": " + e);
|
|
2749
2834
|
return this;
|
|
2750
2835
|
}
|
|
2751
|
-
function
|
|
2836
|
+
function Ti(r) {
|
|
2752
2837
|
return new this(r).cos();
|
|
2753
2838
|
}
|
|
2754
|
-
function
|
|
2839
|
+
function Ii(r) {
|
|
2755
2840
|
return new this(r).cosh();
|
|
2756
2841
|
}
|
|
2757
|
-
function
|
|
2842
|
+
function Ze(r) {
|
|
2758
2843
|
var i, t, e;
|
|
2759
2844
|
function s(n) {
|
|
2760
2845
|
var o, a, l, c = this;
|
|
2761
2846
|
if (!(c instanceof s)) return new s(n);
|
|
2762
|
-
if (c.constructor = s,
|
|
2763
|
-
c.s = n.s,
|
|
2847
|
+
if (c.constructor = s, Re(n)) {
|
|
2848
|
+
c.s = n.s, _ ? !n.d || n.e > s.maxE ? (c.e = NaN, c.d = null) : n.e < s.minE ? (c.e = 0, c.d = [0]) : (c.e = n.e, c.d = n.d.slice()) : (c.e = n.e, c.d = n.d ? n.d.slice() : n.d);
|
|
2764
2849
|
return;
|
|
2765
2850
|
}
|
|
2766
2851
|
if (l = typeof n, l === "number") {
|
|
@@ -2770,7 +2855,7 @@ function Ke(r) {
|
|
|
2770
2855
|
}
|
|
2771
2856
|
if (n < 0 ? (n = -n, c.s = -1) : c.s = 1, n === ~~n && n < 1e7) {
|
|
2772
2857
|
for (o = 0, a = n; a >= 10; a /= 10) o++;
|
|
2773
|
-
|
|
2858
|
+
_ ? o > s.maxE ? (c.e = NaN, c.d = null) : o < s.minE ? (c.e = 0, c.d = [0]) : (c.e = o, c.d = [n]) : (c.e = o, c.d = [n]);
|
|
2774
2859
|
return;
|
|
2775
2860
|
}
|
|
2776
2861
|
if (n * 0 !== 0) {
|
|
@@ -2780,67 +2865,67 @@ function Ke(r) {
|
|
|
2780
2865
|
return Bt(c, n.toString());
|
|
2781
2866
|
}
|
|
2782
2867
|
if (l === "string")
|
|
2783
|
-
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1),
|
|
2868
|
+
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1), Ye.test(n) ? Bt(c, n) : xi(c, n);
|
|
2784
2869
|
if (l === "bigint")
|
|
2785
2870
|
return n < 0 ? (n = -n, c.s = -1) : c.s = 1, Bt(c, n.toString());
|
|
2786
2871
|
throw Error(ht + n);
|
|
2787
2872
|
}
|
|
2788
|
-
if (s.prototype = v, s.ROUND_UP = 0, s.ROUND_DOWN = 1, s.ROUND_CEIL = 2, s.ROUND_FLOOR = 3, s.ROUND_HALF_UP = 4, s.ROUND_HALF_DOWN = 5, s.ROUND_HALF_EVEN = 6, s.ROUND_HALF_CEIL = 7, s.ROUND_HALF_FLOOR = 8, s.EUCLID = 9, s.config = s.set =
|
|
2873
|
+
if (s.prototype = v, s.ROUND_UP = 0, s.ROUND_DOWN = 1, s.ROUND_CEIL = 2, s.ROUND_FLOOR = 3, s.ROUND_HALF_UP = 4, s.ROUND_HALF_DOWN = 5, s.ROUND_HALF_EVEN = 6, s.ROUND_HALF_CEIL = 7, s.ROUND_HALF_FLOOR = 8, s.EUCLID = 9, s.config = s.set = Li, s.clone = Ze, s.isDecimal = Re, s.abs = Pi, s.acos = Ci, s.acosh = Si, s.add = _i, s.asin = Ei, s.asinh = Mi, s.atan = Di, s.atanh = ki, s.atan2 = Ri, s.cbrt = Ai, s.ceil = Vi, s.clamp = Oi, s.cos = Ti, s.cosh = Ii, s.div = Ni, s.exp = Hi, s.floor = Fi, s.hypot = zi, s.ln = Bi, s.log = Ui, s.log10 = Xi, s.log2 = Gi, s.max = Yi, s.min = $i, s.mod = ji, s.mul = Wi, s.pow = qi, s.random = Ki, s.round = Zi, s.sign = Qi, s.sin = Ji, s.sinh = ts, s.sqrt = es, s.sub = is, s.sum = ss, s.tan = ns, s.tanh = rs, s.trunc = os, r === void 0 && (r = {}), r && r.defaults !== !0)
|
|
2789
2874
|
for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], i = 0; i < e.length; ) r.hasOwnProperty(t = e[i++]) || (r[t] = this[t]);
|
|
2790
2875
|
return s.config(r), s;
|
|
2791
2876
|
}
|
|
2792
|
-
function
|
|
2877
|
+
function Ni(r, i) {
|
|
2793
2878
|
return new this(r).div(i);
|
|
2794
2879
|
}
|
|
2795
|
-
function
|
|
2880
|
+
function Hi(r) {
|
|
2796
2881
|
return new this(r).exp();
|
|
2797
2882
|
}
|
|
2798
|
-
function
|
|
2883
|
+
function Fi(r) {
|
|
2799
2884
|
return C(r = new this(r), r.e + 1, 3);
|
|
2800
2885
|
}
|
|
2801
|
-
function
|
|
2886
|
+
function zi() {
|
|
2802
2887
|
var r, i, t = new this(0);
|
|
2803
|
-
for (
|
|
2888
|
+
for (_ = !1, r = 0; r < arguments.length; )
|
|
2804
2889
|
if (i = new this(arguments[r++]), i.d)
|
|
2805
2890
|
t.d && (t = t.plus(i.times(i)));
|
|
2806
2891
|
else {
|
|
2807
2892
|
if (i.s)
|
|
2808
|
-
return
|
|
2893
|
+
return _ = !0, new this(1 / 0);
|
|
2809
2894
|
t = i;
|
|
2810
2895
|
}
|
|
2811
|
-
return
|
|
2896
|
+
return _ = !0, t.sqrt();
|
|
2812
2897
|
}
|
|
2813
|
-
function
|
|
2814
|
-
return r instanceof k || r && r.toStringTag ===
|
|
2898
|
+
function Re(r) {
|
|
2899
|
+
return r instanceof k || r && r.toStringTag === Xe || !1;
|
|
2815
2900
|
}
|
|
2816
|
-
function
|
|
2901
|
+
function Bi(r) {
|
|
2817
2902
|
return new this(r).ln();
|
|
2818
2903
|
}
|
|
2819
|
-
function
|
|
2904
|
+
function Ui(r, i) {
|
|
2820
2905
|
return new this(r).log(i);
|
|
2821
2906
|
}
|
|
2822
|
-
function
|
|
2907
|
+
function Gi(r) {
|
|
2823
2908
|
return new this(r).log(2);
|
|
2824
2909
|
}
|
|
2825
|
-
function
|
|
2910
|
+
function Xi(r) {
|
|
2826
2911
|
return new this(r).log(10);
|
|
2827
2912
|
}
|
|
2828
|
-
function Xi() {
|
|
2829
|
-
return je(this, arguments, -1);
|
|
2830
|
-
}
|
|
2831
2913
|
function Yi() {
|
|
2832
|
-
return
|
|
2914
|
+
return We(this, arguments, -1);
|
|
2833
2915
|
}
|
|
2834
|
-
function $i(
|
|
2835
|
-
return
|
|
2916
|
+
function $i() {
|
|
2917
|
+
return We(this, arguments, 1);
|
|
2836
2918
|
}
|
|
2837
2919
|
function ji(r, i) {
|
|
2838
|
-
return new this(r).
|
|
2920
|
+
return new this(r).mod(i);
|
|
2839
2921
|
}
|
|
2840
2922
|
function Wi(r, i) {
|
|
2923
|
+
return new this(r).mul(i);
|
|
2924
|
+
}
|
|
2925
|
+
function qi(r, i) {
|
|
2841
2926
|
return new this(r).pow(i);
|
|
2842
2927
|
}
|
|
2843
|
-
function
|
|
2928
|
+
function Ki(r) {
|
|
2844
2929
|
var i, t, e, s, n = 0, o = new this(1), a = [];
|
|
2845
2930
|
if (r === void 0 ? r = this.precision : U(r, 1, ut), e = Math.ceil(r / S), this.crypto)
|
|
2846
2931
|
if (crypto.getRandomValues)
|
|
@@ -2851,7 +2936,7 @@ function qi(r) {
|
|
|
2851
2936
|
s = i[n] + (i[n + 1] << 8) + (i[n + 2] << 16) + ((i[n + 3] & 127) << 24), s >= 214e7 ? crypto.randomBytes(4).copy(i, n) : (a.push(s % 1e7), n += 4);
|
|
2852
2937
|
n = e / 4;
|
|
2853
2938
|
} else
|
|
2854
|
-
throw Error(
|
|
2939
|
+
throw Error(Ge);
|
|
2855
2940
|
else for (; n < e; ) a[n++] = Math.random() * 1e7 | 0;
|
|
2856
2941
|
for (e = a[--n], r %= S, e && r && (s = I(10, S - r), a[n] = (e / s | 0) * s); a[n] === 0; n--) a.pop();
|
|
2857
2942
|
if (n < 0)
|
|
@@ -2863,44 +2948,44 @@ function qi(r) {
|
|
|
2863
2948
|
}
|
|
2864
2949
|
return o.e = t, o.d = a, o;
|
|
2865
2950
|
}
|
|
2866
|
-
function
|
|
2951
|
+
function Zi(r) {
|
|
2867
2952
|
return C(r = new this(r), r.e + 1, this.rounding);
|
|
2868
2953
|
}
|
|
2869
|
-
function
|
|
2954
|
+
function Qi(r) {
|
|
2870
2955
|
return r = new this(r), r.d ? r.d[0] ? r.s : 0 * r.s : r.s || NaN;
|
|
2871
2956
|
}
|
|
2872
|
-
function
|
|
2957
|
+
function Ji(r) {
|
|
2873
2958
|
return new this(r).sin();
|
|
2874
2959
|
}
|
|
2875
|
-
function
|
|
2960
|
+
function ts(r) {
|
|
2876
2961
|
return new this(r).sinh();
|
|
2877
2962
|
}
|
|
2878
|
-
function
|
|
2963
|
+
function es(r) {
|
|
2879
2964
|
return new this(r).sqrt();
|
|
2880
2965
|
}
|
|
2881
|
-
function
|
|
2966
|
+
function is(r, i) {
|
|
2882
2967
|
return new this(r).sub(i);
|
|
2883
2968
|
}
|
|
2884
|
-
function
|
|
2969
|
+
function ss() {
|
|
2885
2970
|
var r = 0, i = arguments, t = new this(i[r]);
|
|
2886
|
-
for (
|
|
2887
|
-
return
|
|
2971
|
+
for (_ = !1; t.s && ++r < i.length; ) t = t.plus(i[r]);
|
|
2972
|
+
return _ = !0, C(t, this.precision, this.rounding);
|
|
2888
2973
|
}
|
|
2889
|
-
function
|
|
2974
|
+
function ns(r) {
|
|
2890
2975
|
return new this(r).tan();
|
|
2891
2976
|
}
|
|
2892
|
-
function
|
|
2977
|
+
function rs(r) {
|
|
2893
2978
|
return new this(r).tanh();
|
|
2894
2979
|
}
|
|
2895
|
-
function
|
|
2980
|
+
function os(r) {
|
|
2896
2981
|
return C(r = new this(r), r.e + 1, 1);
|
|
2897
2982
|
}
|
|
2898
2983
|
v[Symbol.for("nodejs.util.inspect.custom")] = v.toString;
|
|
2899
2984
|
v[Symbol.toStringTag] = "Decimal";
|
|
2900
|
-
var k = v.constructor =
|
|
2985
|
+
var k = v.constructor = Ze(ce);
|
|
2901
2986
|
Xt = new k(Xt);
|
|
2902
2987
|
Yt = new k(Yt);
|
|
2903
|
-
class
|
|
2988
|
+
class as {
|
|
2904
2989
|
constructor() {
|
|
2905
2990
|
/** 父级 */
|
|
2906
2991
|
d(this, "parent");
|
|
@@ -2935,7 +3020,7 @@ class os {
|
|
|
2935
3020
|
(i = this.parent) == null || i.removeChild(this);
|
|
2936
3021
|
}
|
|
2937
3022
|
}
|
|
2938
|
-
class
|
|
3023
|
+
class ls extends as {
|
|
2939
3024
|
constructor() {
|
|
2940
3025
|
super(...arguments);
|
|
2941
3026
|
d(this, "_isVisible", !0);
|
|
@@ -2981,12 +3066,12 @@ class as extends os {
|
|
|
2981
3066
|
return !0;
|
|
2982
3067
|
}
|
|
2983
3068
|
}
|
|
2984
|
-
let
|
|
3069
|
+
let cs = class extends ls {
|
|
2985
3070
|
constructor(i) {
|
|
2986
3071
|
super(), i.name = i.name || oe("default-name-"), Object.assign(this, { ...i });
|
|
2987
3072
|
}
|
|
2988
3073
|
};
|
|
2989
|
-
class
|
|
3074
|
+
class hs extends cs {
|
|
2990
3075
|
constructor(t) {
|
|
2991
3076
|
super(t);
|
|
2992
3077
|
d(this, "_isInteractive", !0);
|
|
@@ -3065,7 +3150,7 @@ class cs extends ls {
|
|
|
3065
3150
|
return (this.parent ? this.parent[t] : !0) && e && (s ? this.isInteractive : !0);
|
|
3066
3151
|
}
|
|
3067
3152
|
}
|
|
3068
|
-
class
|
|
3153
|
+
class us {
|
|
3069
3154
|
constructor(i) {
|
|
3070
3155
|
d(this, "propagationStopped", !1);
|
|
3071
3156
|
this.data = i;
|
|
@@ -3077,7 +3162,7 @@ class hs {
|
|
|
3077
3162
|
return !this.propagationStopped;
|
|
3078
3163
|
}
|
|
3079
3164
|
}
|
|
3080
|
-
class Vt extends
|
|
3165
|
+
class Vt extends hs {
|
|
3081
3166
|
constructor() {
|
|
3082
3167
|
super(...arguments);
|
|
3083
3168
|
//#region 4. 添加事件管理器
|
|
@@ -3195,7 +3280,7 @@ class Vt extends cs {
|
|
|
3195
3280
|
var c, h;
|
|
3196
3281
|
if (!this[n]) return;
|
|
3197
3282
|
this.updateStates(t, e);
|
|
3198
|
-
const o = new
|
|
3283
|
+
const o = new us(e);
|
|
3199
3284
|
this.listeners[t].forEach((u) => u(o, s));
|
|
3200
3285
|
const a = "notify" + (t.charAt(0).toUpperCase() + t.slice(1)), l = ["notifyDrag", "notifyWheel"].includes(a) ? e : e.state;
|
|
3201
3286
|
o.canPropagate && ((c = this.parent) == null || c[a](l, s)), (h = this.sharedControllers[t]) == null || h.forEach(
|
|
@@ -3251,7 +3336,7 @@ class Vt extends cs {
|
|
|
3251
3336
|
}
|
|
3252
3337
|
//#region 6. 添加事件通知方法
|
|
3253
3338
|
}
|
|
3254
|
-
class
|
|
3339
|
+
class ds extends Vt {
|
|
3255
3340
|
constructor(t) {
|
|
3256
3341
|
super(t);
|
|
3257
3342
|
/** 画布元素 */
|
|
@@ -3525,7 +3610,7 @@ class us extends Vt {
|
|
|
3525
3610
|
) : l(t);
|
|
3526
3611
|
}
|
|
3527
3612
|
}
|
|
3528
|
-
class
|
|
3613
|
+
class fs extends ds {
|
|
3529
3614
|
constructor(t) {
|
|
3530
3615
|
super(t);
|
|
3531
3616
|
/** 主题 */
|
|
@@ -3773,7 +3858,7 @@ class ds extends us {
|
|
|
3773
3858
|
setStyle(t) {
|
|
3774
3859
|
for (const e in t)
|
|
3775
3860
|
if (Object.prototype.hasOwnProperty.call(t, e)) {
|
|
3776
|
-
const s =
|
|
3861
|
+
const s = di(
|
|
3777
3862
|
this.style[e] || this.style[this.theme]
|
|
3778
3863
|
);
|
|
3779
3864
|
ct(s, t[e]), this.style[e] = s;
|
|
@@ -4051,7 +4136,7 @@ class D extends Vt {
|
|
|
4051
4136
|
handleValuePosition(t, e) {
|
|
4052
4137
|
let { value: s, position: n, mainCanvas: o } = this;
|
|
4053
4138
|
if (!o) return !1;
|
|
4054
|
-
const a = t === "array1D" ?
|
|
4139
|
+
const a = t === "array1D" ? xe : Gt, [l, c] = [
|
|
4055
4140
|
a(s) && (!e || s.length >= e),
|
|
4056
4141
|
a(n) && (!e || n.length >= e)
|
|
4057
4142
|
], h = {
|
|
@@ -4436,7 +4521,7 @@ class vt extends D {
|
|
|
4436
4521
|
}
|
|
4437
4522
|
}
|
|
4438
4523
|
}
|
|
4439
|
-
class
|
|
4524
|
+
class Qe extends D {
|
|
4440
4525
|
constructor(t) {
|
|
4441
4526
|
super(t);
|
|
4442
4527
|
/** 控制点 */
|
|
@@ -4535,7 +4620,7 @@ class Ze extends D {
|
|
|
4535
4620
|
tryCreateNewHandlePoint(t, e) {
|
|
4536
4621
|
var c;
|
|
4537
4622
|
if (!this.isPointInStroke(t, e)) return;
|
|
4538
|
-
const s = this.getExtendedDynamicPositions(), n =
|
|
4623
|
+
const s = this.getExtendedDynamicPositions(), n = ms([t, e], s);
|
|
4539
4624
|
if (n === -1) return;
|
|
4540
4625
|
const [o, a] = this.getAdjacentIndices(n), l = this.createNewHandlePoint(o, a);
|
|
4541
4626
|
this.insertHandlePoint(n, l), this.lockHandlePointCreationTemporarily(), (c = this.notifyReload) == null || c.call(this);
|
|
@@ -4634,12 +4719,12 @@ class Ze extends D {
|
|
|
4634
4719
|
});
|
|
4635
4720
|
}
|
|
4636
4721
|
}
|
|
4637
|
-
function
|
|
4722
|
+
function ms(r, i, t = 10) {
|
|
4638
4723
|
if (i.length === 0) return 0;
|
|
4639
4724
|
if (i.length === 1) return 1;
|
|
4640
4725
|
let e = 1 / 0, s = -1;
|
|
4641
4726
|
for (let n = 0; n < i.length - 1; n++) {
|
|
4642
|
-
const o =
|
|
4727
|
+
const o = Us(
|
|
4643
4728
|
r,
|
|
4644
4729
|
i[n],
|
|
4645
4730
|
i[n + 1]
|
|
@@ -4651,10 +4736,10 @@ function fs(r, i, t = 10) {
|
|
|
4651
4736
|
return s;
|
|
4652
4737
|
}
|
|
4653
4738
|
function ee(r, i) {
|
|
4654
|
-
const { x: t, y: e } =
|
|
4739
|
+
const { x: t, y: e } = ii(...r, ...i);
|
|
4655
4740
|
return [t, e];
|
|
4656
4741
|
}
|
|
4657
|
-
class me extends
|
|
4742
|
+
class me extends Qe {
|
|
4658
4743
|
constructor(t) {
|
|
4659
4744
|
super(t);
|
|
4660
4745
|
d(this, "_isInfinite");
|
|
@@ -4695,7 +4780,7 @@ class me extends Ze {
|
|
|
4695
4780
|
if (this.isInfinite) {
|
|
4696
4781
|
this.isRecalculate && this.updateDynamicPosition();
|
|
4697
4782
|
const { width: t, height: e } = this.mainCanvas.rect;
|
|
4698
|
-
return
|
|
4783
|
+
return ps(
|
|
4699
4784
|
[0, 0],
|
|
4700
4785
|
[t, e],
|
|
4701
4786
|
this.finalDynamicPosition[0],
|
|
@@ -4745,12 +4830,12 @@ class me extends Ze {
|
|
|
4745
4830
|
const { rect: n } = e, [o, a] = s, l = [a[0] - o[0], a[1] - o[1]];
|
|
4746
4831
|
if (l[0] === 0 && l[1] === 0)
|
|
4747
4832
|
return console.error("重合点无法确定方向");
|
|
4748
|
-
const c =
|
|
4833
|
+
const c = Ae(
|
|
4749
4834
|
o,
|
|
4750
4835
|
[-l[0], -l[1]],
|
|
4751
4836
|
n.width,
|
|
4752
4837
|
n.height
|
|
4753
|
-
), h =
|
|
4838
|
+
), h = Ae(
|
|
4754
4839
|
a,
|
|
4755
4840
|
l,
|
|
4756
4841
|
n.width,
|
|
@@ -4765,7 +4850,7 @@ class me extends Ze {
|
|
|
4765
4850
|
}
|
|
4766
4851
|
}
|
|
4767
4852
|
}
|
|
4768
|
-
function
|
|
4853
|
+
function Ae(r, i, t, e) {
|
|
4769
4854
|
const [s, n] = r, [o, a] = i;
|
|
4770
4855
|
let l = 1 / 0;
|
|
4771
4856
|
if (o !== 0) {
|
|
@@ -4778,7 +4863,7 @@ function Re(r, i, t, e) {
|
|
|
4778
4863
|
}
|
|
4779
4864
|
return l === 1 / 0 ? r : [s + o * l, n + a * l];
|
|
4780
4865
|
}
|
|
4781
|
-
function
|
|
4866
|
+
function ps(r, i, t, e) {
|
|
4782
4867
|
const s = Math.min(r[0], i[0]), n = Math.max(r[0], i[0]), o = Math.min(r[1], i[1]), a = Math.max(r[1], i[1]), l = [
|
|
4783
4868
|
[s, o],
|
|
4784
4869
|
// 左上
|
|
@@ -4802,7 +4887,7 @@ function ms(r, i, t, e) {
|
|
|
4802
4887
|
}
|
|
4803
4888
|
return m && g;
|
|
4804
4889
|
}
|
|
4805
|
-
class pe extends
|
|
4890
|
+
class pe extends Qe {
|
|
4806
4891
|
constructor(t) {
|
|
4807
4892
|
super(t);
|
|
4808
4893
|
d(this, "_isRect", !1);
|
|
@@ -5163,7 +5248,7 @@ class ge extends D {
|
|
|
5163
5248
|
offset: c
|
|
5164
5249
|
} = this;
|
|
5165
5250
|
if (!t || !a || !l) return;
|
|
5166
|
-
const [h, u] =
|
|
5251
|
+
const [h, u] = gs(
|
|
5167
5252
|
...e,
|
|
5168
5253
|
s,
|
|
5169
5254
|
n,
|
|
@@ -5267,7 +5352,7 @@ class ge extends D {
|
|
|
5267
5352
|
}
|
|
5268
5353
|
}
|
|
5269
5354
|
}
|
|
5270
|
-
function
|
|
5355
|
+
function gs(r, i, t, e, s, n = 1, o = 1) {
|
|
5271
5356
|
const a = r + t * Math.cos(e) * n, l = i + t * Math.sin(e) * o, c = r + t * Math.cos(s) * n, h = i + t * Math.sin(s) * o;
|
|
5272
5357
|
return [
|
|
5273
5358
|
[a, l],
|
|
@@ -5441,7 +5526,7 @@ class ve extends D {
|
|
|
5441
5526
|
}
|
|
5442
5527
|
}
|
|
5443
5528
|
}
|
|
5444
|
-
class
|
|
5529
|
+
class vs extends fs {
|
|
5445
5530
|
constructor(t) {
|
|
5446
5531
|
super(t);
|
|
5447
5532
|
/** 监听元素大小 */
|
|
@@ -5458,7 +5543,7 @@ class gs extends ds {
|
|
|
5458
5543
|
maxYV: 0
|
|
5459
5544
|
});
|
|
5460
5545
|
/** 测量重绘性能 */
|
|
5461
|
-
d(this, "measureRedrawPerformance",
|
|
5546
|
+
d(this, "measureRedrawPerformance", fi(
|
|
5462
5547
|
() => {
|
|
5463
5548
|
this.isRendering = !0, this.redraw(), this.redrawInNextRenderFrame = !1, this.isRendering = !1;
|
|
5464
5549
|
},
|
|
@@ -5471,7 +5556,7 @@ class gs extends ds {
|
|
|
5471
5556
|
}
|
|
5472
5557
|
));
|
|
5473
5558
|
this.canvas && (this.resizeObserver = new ResizeObserver(
|
|
5474
|
-
|
|
5559
|
+
ze(() => {
|
|
5475
5560
|
[this.canvas.width, this.canvas.height] = [
|
|
5476
5561
|
this.rect.width,
|
|
5477
5562
|
this.rect.height
|
|
@@ -5553,7 +5638,7 @@ class gs extends ds {
|
|
|
5553
5638
|
(t = this.resizeObserver) == null || t.disconnect();
|
|
5554
5639
|
}
|
|
5555
5640
|
}
|
|
5556
|
-
class
|
|
5641
|
+
class ys extends vs {
|
|
5557
5642
|
constructor(t) {
|
|
5558
5643
|
super(t);
|
|
5559
5644
|
/** 鼠标是否在画布内 */
|
|
@@ -5663,16 +5748,16 @@ class vs extends gs {
|
|
|
5663
5748
|
keydown(t) {
|
|
5664
5749
|
const { mouseInCanvas: e, offset: s, delta: n, axisConfig: o } = this, a = t.key;
|
|
5665
5750
|
if (!e || !this.isDraggable || this.isAuto) return;
|
|
5666
|
-
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (Gt(c.value) ? "Matrix" :
|
|
5751
|
+
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (Gt(c.value) ? "Matrix" : xe(c.value) ? "Single" : !1), f = (y, w) => {
|
|
5667
5752
|
if (!u)
|
|
5668
5753
|
return s.x += y * l, s.y += w * l, !0;
|
|
5669
|
-
const b = this.getAxisValueByPoint(l, 0).xV, [P,
|
|
5754
|
+
const b = this.getAxisValueByPoint(l, 0).xV, [P, E] = [b * o.x, b * o.y];
|
|
5670
5755
|
if (u === "Single") {
|
|
5671
5756
|
const O = c.value;
|
|
5672
|
-
O[0] += y * P, O[1] += w *
|
|
5757
|
+
O[0] += y * P, O[1] += w * E;
|
|
5673
5758
|
} else
|
|
5674
5759
|
c.value.forEach((O) => {
|
|
5675
|
-
O[0] += y * P, O[1] += w *
|
|
5760
|
+
O[0] += y * P, O[1] += w * E;
|
|
5676
5761
|
});
|
|
5677
5762
|
return c.value = [...c.value], !0;
|
|
5678
5763
|
}, m = (y) => (this.setScale("center", y * n), !0), p = {
|
|
@@ -5798,17 +5883,17 @@ class vs extends gs {
|
|
|
5798
5883
|
} else if (e.length === 2) {
|
|
5799
5884
|
const { clientX: h, clientY: u } = e[0], { clientX: f, clientY: m } = e[1];
|
|
5800
5885
|
if (s.length == 2) {
|
|
5801
|
-
const g =
|
|
5886
|
+
const g = we(
|
|
5802
5887
|
s[0],
|
|
5803
5888
|
n[0],
|
|
5804
5889
|
s[1],
|
|
5805
5890
|
n[1]
|
|
5806
|
-
), p =
|
|
5891
|
+
), p = we(
|
|
5807
5892
|
h,
|
|
5808
5893
|
u,
|
|
5809
5894
|
f,
|
|
5810
5895
|
m
|
|
5811
|
-
), { x: y, y: w } =
|
|
5896
|
+
), { x: y, y: w } = ii(
|
|
5812
5897
|
h,
|
|
5813
5898
|
u,
|
|
5814
5899
|
f,
|
|
@@ -6064,7 +6149,7 @@ class Rt extends Vt {
|
|
|
6064
6149
|
return [];
|
|
6065
6150
|
}
|
|
6066
6151
|
}
|
|
6067
|
-
class
|
|
6152
|
+
class ws extends ys {
|
|
6068
6153
|
/** 获取默认覆盖物群组 */
|
|
6069
6154
|
getDefaultOverlayGroup() {
|
|
6070
6155
|
var c, h, u, f, m, g, p;
|
|
@@ -6104,7 +6189,7 @@ class ys extends vs {
|
|
|
6104
6189
|
return t;
|
|
6105
6190
|
}
|
|
6106
6191
|
}
|
|
6107
|
-
class
|
|
6192
|
+
class xs extends ws {
|
|
6108
6193
|
/** 缩放画布 */
|
|
6109
6194
|
zoom(i) {
|
|
6110
6195
|
const { canvas: t, rect: e } = this;
|
|
@@ -6137,7 +6222,7 @@ class ws extends ys {
|
|
|
6137
6222
|
super.setDefaultCenter(i), this.redrawOnce();
|
|
6138
6223
|
}
|
|
6139
6224
|
}
|
|
6140
|
-
class
|
|
6225
|
+
class bs extends xs {
|
|
6141
6226
|
/**
|
|
6142
6227
|
* 调整视图以适应指定覆盖层
|
|
6143
6228
|
* @param overlays 目标覆盖层数组,默认使用全部可见覆盖层
|
|
@@ -6195,10 +6280,10 @@ class xs extends ws {
|
|
|
6195
6280
|
const m = i / u, g = t / f, p = Math.max(m, g), y = a.count, w = y / a.min, b = n * o;
|
|
6196
6281
|
let P;
|
|
6197
6282
|
if (p > w) {
|
|
6198
|
-
const
|
|
6199
|
-
P = 1 - ((y *
|
|
6283
|
+
const E = Math.ceil(p / w);
|
|
6284
|
+
P = 1 - ((y * E / p - a.min) / a.min + (E - 2)) * b;
|
|
6200
6285
|
} else {
|
|
6201
|
-
const
|
|
6286
|
+
const E = (dt, nt, yt) => dt < nt ? yt - 1 : E(dt / 2, nt, yt + 1), O = E(w, p, 0), G = Math.pow(2, O);
|
|
6202
6287
|
P = 1 + ((y / G / p - a.min) / a.min + O) * b;
|
|
6203
6288
|
}
|
|
6204
6289
|
return s !== void 0 && (P = Math.min(s, P)), P = new k(P).div(o).round().mul(o).toNumber(), P;
|
|
@@ -6280,7 +6365,7 @@ class xs extends ws {
|
|
|
6280
6365
|
});
|
|
6281
6366
|
}
|
|
6282
6367
|
}
|
|
6283
|
-
class
|
|
6368
|
+
class Ps extends bs {
|
|
6284
6369
|
/** 开关坐标轴 */
|
|
6285
6370
|
toggleAxis(i) {
|
|
6286
6371
|
this.drawAxis.toggleAxis(i), this.redrawOnce();
|
|
@@ -6305,7 +6390,7 @@ class bs extends xs {
|
|
|
6305
6390
|
return this.isInteractive = i ?? !this.isInteractive, this.isInteractive;
|
|
6306
6391
|
}
|
|
6307
6392
|
}
|
|
6308
|
-
class
|
|
6393
|
+
class Cs extends Ps {
|
|
6309
6394
|
/**
|
|
6310
6395
|
* 清除指定区域的像素点
|
|
6311
6396
|
* @param ctx - Canvas 2D绘图上下文
|
|
@@ -6316,9 +6401,9 @@ class Ps extends bs {
|
|
|
6316
6401
|
i.save(), i.beginPath(), i.clip(t), i.clearRect(0, 0, e, s), i.restore();
|
|
6317
6402
|
}
|
|
6318
6403
|
}
|
|
6319
|
-
class
|
|
6404
|
+
class Ss extends Cs {
|
|
6320
6405
|
}
|
|
6321
|
-
class
|
|
6406
|
+
class _s {
|
|
6322
6407
|
constructor(i) {
|
|
6323
6408
|
/** 画布 */
|
|
6324
6409
|
d(this, "canvas");
|
|
@@ -6433,8 +6518,8 @@ class Ss {
|
|
|
6433
6518
|
const y = s.y > c || s.y < 0;
|
|
6434
6519
|
let w = s.x > 0 ? s.x % g : s.x < 0 ? g + s.x % g : 0, b = i.getAxisValueByPoint((w - s.x) * n.x, 0).xV;
|
|
6435
6520
|
for (; w <= l; ) {
|
|
6436
|
-
const P = se(b),
|
|
6437
|
-
b !== 0 && this.drawText(P, w -
|
|
6521
|
+
const P = se(b), E = h(P);
|
|
6522
|
+
b !== 0 && this.drawText(P, w - E / 2, p, y), w += g, b = new k(m).mul(n.x).add(b).toNumber();
|
|
6438
6523
|
}
|
|
6439
6524
|
}
|
|
6440
6525
|
{
|
|
@@ -6442,8 +6527,8 @@ class Ss {
|
|
|
6442
6527
|
let y = s.y > 0 ? s.y % g : s.y < 0 ? g + s.y % g : 0, w = i.getAxisValueByPoint(0, (y - s.y) * n.y).yV;
|
|
6443
6528
|
for (; y <= c; ) {
|
|
6444
6529
|
const b = se(w), P = h(b);
|
|
6445
|
-
let
|
|
6446
|
-
|
|
6530
|
+
let E = s.x - P - u;
|
|
6531
|
+
E = Math.max(Math.min(E, l - P - u), u), w != 0 && this.drawText(b, E, y + f / 2, p), y += g, w = new k(m).mul(n.y).add(w).toNumber();
|
|
6447
6532
|
}
|
|
6448
6533
|
}
|
|
6449
6534
|
}
|
|
@@ -6552,7 +6637,7 @@ class Es {
|
|
|
6552
6637
|
}
|
|
6553
6638
|
}
|
|
6554
6639
|
}
|
|
6555
|
-
class
|
|
6640
|
+
class Ms {
|
|
6556
6641
|
/**
|
|
6557
6642
|
* 计算默认缩放比例,使图像适配视图容器
|
|
6558
6643
|
* @param naturalWidth 图像原始宽度
|
|
@@ -6587,7 +6672,7 @@ class _s {
|
|
|
6587
6672
|
};
|
|
6588
6673
|
}
|
|
6589
6674
|
}
|
|
6590
|
-
class
|
|
6675
|
+
class Ds extends D {
|
|
6591
6676
|
constructor(t) {
|
|
6592
6677
|
super(t);
|
|
6593
6678
|
d(this, "_ready", !1);
|
|
@@ -6645,11 +6730,11 @@ class Ms extends D {
|
|
|
6645
6730
|
const g = u.w / u.h, p = f / m;
|
|
6646
6731
|
if (o === "fill") return u;
|
|
6647
6732
|
if (o === "contain" || o === "scale-down") {
|
|
6648
|
-
const b = Math.min(u.w / f, u.h / m), P = o === "scale-down" ? Math.min(1, b) : b,
|
|
6733
|
+
const b = Math.min(u.w / f, u.h / m), P = o === "scale-down" ? Math.min(1, b) : b, E = f * P, O = m * P;
|
|
6649
6734
|
return {
|
|
6650
|
-
x: u.x + (u.w -
|
|
6735
|
+
x: u.x + (u.w - E) / 2,
|
|
6651
6736
|
y: u.y + (u.h - O) / 2,
|
|
6652
|
-
w:
|
|
6737
|
+
w: E,
|
|
6653
6738
|
h: O
|
|
6654
6739
|
};
|
|
6655
6740
|
}
|
|
@@ -6676,7 +6761,7 @@ class Ms extends D {
|
|
|
6676
6761
|
this.mainCanvas && (this.ready = !1, this.url && (this.image.src = this.url), this.handleValuePosition("array2D", 1));
|
|
6677
6762
|
}
|
|
6678
6763
|
}
|
|
6679
|
-
class
|
|
6764
|
+
class Ve extends Ds {
|
|
6680
6765
|
constructor(t) {
|
|
6681
6766
|
super(t);
|
|
6682
6767
|
d(this, "defaultDrag", (t, e) => {
|
|
@@ -6742,12 +6827,12 @@ class Ae extends Ms {
|
|
|
6742
6827
|
function Ft(r) {
|
|
6743
6828
|
return [r].flat(1 / 0);
|
|
6744
6829
|
}
|
|
6745
|
-
class T extends
|
|
6830
|
+
class T extends Ss {
|
|
6746
6831
|
constructor(t) {
|
|
6747
6832
|
super(t);
|
|
6748
6833
|
/** 按坐标轴值创建覆盖物(多边形/线)的交互管理 */
|
|
6749
6834
|
d(this, "overlayCreator");
|
|
6750
|
-
this.drawAxis = new
|
|
6835
|
+
this.drawAxis = new _s(this), "axisShow" in t && this.toggleAxis(t.axisShow), this.overlayCreator = new Es(this), this.initLayerGroups(), this.updateCenter();
|
|
6751
6836
|
}
|
|
6752
6837
|
initLayerGroups() {
|
|
6753
6838
|
const t = new $({ name: "其他图层", zIndex: 1 });
|
|
@@ -6811,7 +6896,7 @@ class T extends Cs {
|
|
|
6811
6896
|
overlays_other: c
|
|
6812
6897
|
} = this.getDefaultOverlayGroup() || {};
|
|
6813
6898
|
Ft(t).forEach((h) => {
|
|
6814
|
-
h instanceof fe ? e == null || e.addOverlay(h) : h instanceof vt ? s == null || s.addOverlay(h) : h instanceof me || h instanceof ge || h instanceof ve ? n == null || n.addOverlay(h) : h instanceof pe ? o == null || o.addOverlay(h) : h instanceof de ? a == null || a.addOverlay(h) : h instanceof
|
|
6899
|
+
h instanceof fe ? e == null || e.addOverlay(h) : h instanceof vt ? s == null || s.addOverlay(h) : h instanceof me || h instanceof ge || h instanceof ve ? n == null || n.addOverlay(h) : h instanceof pe ? o == null || o.addOverlay(h) : h instanceof de ? a == null || a.addOverlay(h) : h instanceof Ve ? l == null || l.addOverlay(h) : c == null || c.addOverlay(h);
|
|
6815
6900
|
});
|
|
6816
6901
|
}
|
|
6817
6902
|
/** 移除覆盖物 */
|
|
@@ -6824,7 +6909,7 @@ class T extends Cs {
|
|
|
6824
6909
|
}
|
|
6825
6910
|
}
|
|
6826
6911
|
/** 视图适配工具:默认缩放、居中计算 */
|
|
6827
|
-
d(T, "ViewFit",
|
|
6912
|
+
d(T, "ViewFit", Ms), /** 图层群组 */
|
|
6828
6913
|
d(T, "LayerGroup", Rt), /** 图层 */
|
|
6829
6914
|
d(T, "Layer", $), /** 覆盖物群组 */
|
|
6830
6915
|
d(T, "OverlayGroup", Y), /** 文字 */
|
|
@@ -6835,8 +6920,8 @@ d(T, "Polygon", pe), /** 自定义绘制 */
|
|
|
6835
6920
|
d(T, "Custom", de), /** 圆弧 */
|
|
6836
6921
|
d(T, "Arc", ge), /** 圆角 */
|
|
6837
6922
|
d(T, "ArcTo", ve), /** 图片 */
|
|
6838
|
-
d(T, "Billboard",
|
|
6839
|
-
class
|
|
6923
|
+
d(T, "Billboard", Ve);
|
|
6924
|
+
class ks {
|
|
6840
6925
|
/** @param id canvas DOM id(通过 getElementById 定位) */
|
|
6841
6926
|
constructor(i) {
|
|
6842
6927
|
/** Canvas DOM id(用于 `document.getElementById` 定位) */
|
|
@@ -6890,7 +6975,7 @@ class Ds {
|
|
|
6890
6975
|
this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0);
|
|
6891
6976
|
}
|
|
6892
6977
|
}
|
|
6893
|
-
class
|
|
6978
|
+
class Rs {
|
|
6894
6979
|
/**
|
|
6895
6980
|
* @param canvas 绑定 mousedown 的 canvas
|
|
6896
6981
|
* @param onOffsetDelta 拖拽时的 dx 回调(由外部映射到时间偏移)
|
|
@@ -6929,7 +7014,7 @@ class ks {
|
|
|
6929
7014
|
this.canvas.removeEventListener("mousedown", this.handleMouseDown), window.removeEventListener("mousemove", this.handleMouseMove), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
6930
7015
|
}
|
|
6931
7016
|
}
|
|
6932
|
-
class
|
|
7017
|
+
class As {
|
|
6933
7018
|
/**
|
|
6934
7019
|
* @param canvas 绑定 wheel 事件的 canvas
|
|
6935
7020
|
* @param getTimeSpacing 读取当前 timeSpacing 的函数
|
|
@@ -6964,7 +7049,7 @@ class Rs {
|
|
|
6964
7049
|
this.canvas.removeEventListener("wheel", this.handleWheel);
|
|
6965
7050
|
}
|
|
6966
7051
|
}
|
|
6967
|
-
class
|
|
7052
|
+
class Vs {
|
|
6968
7053
|
/**
|
|
6969
7054
|
* 只负责计算鼠标所在 x/y 对应的时间,并把结果通知给 TimeAxis(不直接操作 DOM)。
|
|
6970
7055
|
*/
|
|
@@ -7001,10 +7086,10 @@ class As {
|
|
|
7001
7086
|
this.canvas.removeEventListener("mousemove", this.handleMouseMove), this.canvas.removeEventListener("mouseleave", this.handleMouseLeave);
|
|
7002
7087
|
}
|
|
7003
7088
|
}
|
|
7004
|
-
const
|
|
7089
|
+
const Os = {
|
|
7005
7090
|
easeInOutQuad: (r) => r < 0.5 ? 2 * r * r : 1 - Math.pow(-2 * r + 2, 2) / 2
|
|
7006
7091
|
};
|
|
7007
|
-
class
|
|
7092
|
+
class Ls {
|
|
7008
7093
|
/**
|
|
7009
7094
|
* 创建时间轴引擎:会在构造后 `requestAnimationFrame` 初始化并开始渲染。
|
|
7010
7095
|
* @param id canvas DOM id
|
|
@@ -7050,13 +7135,13 @@ class Os {
|
|
|
7050
7135
|
* 可用于叠加额外图形(如指示线、事件点等)
|
|
7051
7136
|
*/
|
|
7052
7137
|
d(this, "onDrawOverlay");
|
|
7053
|
-
this.canvasManager = new
|
|
7138
|
+
this.canvasManager = new ks(i), this.onMouseTimeChange = t, requestAnimationFrame(() => this.init());
|
|
7054
7139
|
}
|
|
7055
7140
|
/** 初始化交互:拖拽平移、滚轮缩放、鼠标时间通知,并触发首次绘制 */
|
|
7056
7141
|
init() {
|
|
7057
7142
|
if (!this.canvasManager.init(() => this.render())) return;
|
|
7058
7143
|
const t = this.canvasManager.getCanvas();
|
|
7059
|
-
t && (this.offsetDrag = new
|
|
7144
|
+
t && (this.offsetDrag = new Rs(
|
|
7060
7145
|
t,
|
|
7061
7146
|
(e) => {
|
|
7062
7147
|
this.currentTime -= Math.round(
|
|
@@ -7066,14 +7151,14 @@ class Os {
|
|
|
7066
7151
|
() => {
|
|
7067
7152
|
this.stopCenterTimeAnimation();
|
|
7068
7153
|
}
|
|
7069
|
-
), this.wheelZoom = new
|
|
7154
|
+
), this.wheelZoom = new As(
|
|
7070
7155
|
t,
|
|
7071
7156
|
() => this.timeSpacing,
|
|
7072
7157
|
(e, s) => {
|
|
7073
7158
|
const n = this.getTimeAtCanvasX(s);
|
|
7074
7159
|
this.timeSpacing = e, this.setTimeAtCanvasX(n, s), this.render();
|
|
7075
7160
|
}
|
|
7076
|
-
), this.centerTime = Date.now(), this.mouseTimeReporter = new
|
|
7161
|
+
), this.centerTime = Date.now(), this.mouseTimeReporter = new Vs(
|
|
7077
7162
|
t,
|
|
7078
7163
|
(e) => this.getTimeAtCanvasX(e),
|
|
7079
7164
|
(e) => {
|
|
@@ -7117,7 +7202,7 @@ class Os {
|
|
|
7117
7202
|
for (; y <= f; ) {
|
|
7118
7203
|
const w = p % o === 0, b = w ? a : l;
|
|
7119
7204
|
if (i.fillRect(y, 0, 1, b), w) {
|
|
7120
|
-
const P =
|
|
7205
|
+
const P = ai(g, "MM-DD hh:mm:ss");
|
|
7121
7206
|
i.fillText(P, y, c), g += t;
|
|
7122
7207
|
}
|
|
7123
7208
|
y += m, p++;
|
|
@@ -7172,8 +7257,8 @@ class Os {
|
|
|
7172
7257
|
Math.max(0.5, h)
|
|
7173
7258
|
);
|
|
7174
7259
|
return Math.max(1, Math.round(u * 60));
|
|
7175
|
-
})(), a = (t == null ? void 0 : t.curve) ??
|
|
7176
|
-
|
|
7260
|
+
})(), a = (t == null ? void 0 : t.curve) ?? Os.easeInOutQuad;
|
|
7261
|
+
oi(
|
|
7177
7262
|
0,
|
|
7178
7263
|
1,
|
|
7179
7264
|
o,
|
|
@@ -7194,7 +7279,7 @@ class Os {
|
|
|
7194
7279
|
(i = this.offsetDrag) == null || i.destroy(), (t = this.wheelZoom) == null || t.destroy(), (e = this.mouseTimeReporter) == null || e.destroy(), this.canvasManager.destroy();
|
|
7195
7280
|
}
|
|
7196
7281
|
}
|
|
7197
|
-
class
|
|
7282
|
+
class kn extends Ls {
|
|
7198
7283
|
/**
|
|
7199
7284
|
* 将填充样式解析为 ctx.fillStyle 可用的值(纯色或线性渐变)
|
|
7200
7285
|
* @param rect 矩形区域,用于计算渐变起止点
|
|
@@ -7245,21 +7330,21 @@ const ye = {
|
|
|
7245
7330
|
audio: "audio/",
|
|
7246
7331
|
application: "application/"
|
|
7247
7332
|
};
|
|
7248
|
-
function
|
|
7333
|
+
function Oe(r) {
|
|
7249
7334
|
return typeof r == "string" ? document.querySelector(r) : r;
|
|
7250
7335
|
}
|
|
7251
|
-
function
|
|
7336
|
+
function Ts(r) {
|
|
7252
7337
|
return r.some(
|
|
7253
7338
|
(i) => i === "text/plain" || i.startsWith("text/")
|
|
7254
7339
|
);
|
|
7255
7340
|
}
|
|
7256
|
-
function
|
|
7341
|
+
function Is(r) {
|
|
7257
7342
|
return r.includes("Files");
|
|
7258
7343
|
}
|
|
7259
|
-
function
|
|
7344
|
+
function Je(r) {
|
|
7260
7345
|
return typeof r == "string" && (r.includes(".") || r.includes("/"));
|
|
7261
7346
|
}
|
|
7262
|
-
function
|
|
7347
|
+
function Ns(r, i) {
|
|
7263
7348
|
if (!i) return !0;
|
|
7264
7349
|
const t = i.split(",").map((n) => n.trim().toLowerCase()), e = r.name.toLowerCase(), s = r.type.toLowerCase();
|
|
7265
7350
|
return t.some((n) => {
|
|
@@ -7273,9 +7358,9 @@ function Is(r, i) {
|
|
|
7273
7358
|
});
|
|
7274
7359
|
}
|
|
7275
7360
|
function ie(r, i) {
|
|
7276
|
-
return r ? (Array.isArray(r) ? r : [r]).some((e) => typeof e == "object" && e !== null && "matchTypes" in e ? e.matchTypes(i) : e === "text" ?
|
|
7361
|
+
return r ? (Array.isArray(r) ? r : [r]).some((e) => typeof e == "object" && e !== null && "matchTypes" in e ? e.matchTypes(i) : e === "text" ? Ts(i) : Je(e) || e === "file" || e in ye ? Is(i) : !1) : !0;
|
|
7277
7362
|
}
|
|
7278
|
-
async function
|
|
7363
|
+
async function Hs(r, i) {
|
|
7279
7364
|
if (!i) return [];
|
|
7280
7365
|
const t = Array.from(i.files), e = Array.from(i.items);
|
|
7281
7366
|
if (!r) return [...t, ...e];
|
|
@@ -7295,9 +7380,9 @@ async function Ns(r, i) {
|
|
|
7295
7380
|
});
|
|
7296
7381
|
else if (l === "file")
|
|
7297
7382
|
t.forEach((c) => n.add(c));
|
|
7298
|
-
else if (
|
|
7383
|
+
else if (Je(l))
|
|
7299
7384
|
t.forEach((c) => {
|
|
7300
|
-
|
|
7385
|
+
Ns(c, l) && n.add(c);
|
|
7301
7386
|
});
|
|
7302
7387
|
else if (l in ye) {
|
|
7303
7388
|
const c = ye[l];
|
|
@@ -7314,7 +7399,7 @@ async function Ns(r, i) {
|
|
|
7314
7399
|
}
|
|
7315
7400
|
return a;
|
|
7316
7401
|
}
|
|
7317
|
-
class
|
|
7402
|
+
class Rn {
|
|
7318
7403
|
constructor() {
|
|
7319
7404
|
d(this, "entries", /* @__PURE__ */ new Map());
|
|
7320
7405
|
d(this, "onDragEnter", (i) => {
|
|
@@ -7356,7 +7441,7 @@ class Mn {
|
|
|
7356
7441
|
var l;
|
|
7357
7442
|
return (l = a.activeCallback) == null ? void 0 : l.call(a, !1);
|
|
7358
7443
|
}), e.activeRules.clear(), n.forEach(async (a) => {
|
|
7359
|
-
const l = await
|
|
7444
|
+
const l = await Hs(a.targetType, i.dataTransfer);
|
|
7360
7445
|
a.dropCallback(l);
|
|
7361
7446
|
}));
|
|
7362
7447
|
});
|
|
@@ -7374,7 +7459,7 @@ class Mn {
|
|
|
7374
7459
|
];
|
|
7375
7460
|
}
|
|
7376
7461
|
add(i) {
|
|
7377
|
-
const t =
|
|
7462
|
+
const t = Oe(i.dom);
|
|
7378
7463
|
if (!t || this.entries.has(t)) return;
|
|
7379
7464
|
const e = this.extractRules(i);
|
|
7380
7465
|
t.addEventListener("dragenter", this.onDragEnter), t.addEventListener("dragleave", this.onDragLeave), t.addEventListener("dragover", this.onDragOver), t.addEventListener("drop", this.onDrop), this.entries.set(t, {
|
|
@@ -7387,7 +7472,7 @@ class Mn {
|
|
|
7387
7472
|
});
|
|
7388
7473
|
}
|
|
7389
7474
|
delete(i) {
|
|
7390
|
-
const t =
|
|
7475
|
+
const t = Oe(i);
|
|
7391
7476
|
!t || !this.entries.has(t) || (t.removeEventListener("dragenter", this.onDragEnter), t.removeEventListener("dragleave", this.onDragLeave), t.removeEventListener("dragover", this.onDragOver), t.removeEventListener("drop", this.onDrop), this.entries.delete(t));
|
|
7392
7477
|
}
|
|
7393
7478
|
destroy() {
|
|
@@ -7403,11 +7488,11 @@ function Ot(r) {
|
|
|
7403
7488
|
} else
|
|
7404
7489
|
return r || document.documentElement;
|
|
7405
7490
|
}
|
|
7406
|
-
function
|
|
7491
|
+
function ti(r) {
|
|
7407
7492
|
const i = Ot(r);
|
|
7408
7493
|
return i ? i.requestFullscreen ? i.requestFullscreen() : i.mozRequestFullScreen ? i.mozRequestFullScreen() : i.webkitRequestFullscreen ? i.webkitRequestFullscreen() : i.msRequestFullscreen ? i.msRequestFullscreen() : Promise.reject("No Fullscreen API") : Promise.reject("No Element");
|
|
7409
7494
|
}
|
|
7410
|
-
function
|
|
7495
|
+
function ei() {
|
|
7411
7496
|
const r = document;
|
|
7412
7497
|
return document.exitFullscreen ? document.exitFullscreen() : r.mozCancelFullScreen ? r.mozCancelFullScreen() : r.webkitExitFullscreen ? r.webkitExitFullscreen() : r.msExitFullscreen ? r.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
7413
7498
|
}
|
|
@@ -7415,13 +7500,13 @@ function jt(r) {
|
|
|
7415
7500
|
const i = Ot(r), t = document, e = document.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement;
|
|
7416
7501
|
return i == e || !r && window.innerWidth == screen.width && window.innerHeight == screen.height;
|
|
7417
7502
|
}
|
|
7418
|
-
function
|
|
7503
|
+
function An(r) {
|
|
7419
7504
|
if (r = Ot(r), !!r)
|
|
7420
7505
|
return function() {
|
|
7421
|
-
jt(r) ?
|
|
7506
|
+
jt(r) ? ei() : ti(r);
|
|
7422
7507
|
};
|
|
7423
7508
|
}
|
|
7424
|
-
function
|
|
7509
|
+
function Vn(r, i) {
|
|
7425
7510
|
const t = Ot(i);
|
|
7426
7511
|
if (!t) return;
|
|
7427
7512
|
const e = () => {
|
|
@@ -7431,7 +7516,7 @@ function kn(r, i) {
|
|
|
7431
7516
|
document.removeEventListener("fullscreenchange", e), document.removeEventListener("webkitfullscreenchange", e), document.removeEventListener("mozfullscreenchange", e), document.removeEventListener("MSFullscreenChange", e);
|
|
7432
7517
|
};
|
|
7433
7518
|
}
|
|
7434
|
-
class
|
|
7519
|
+
class On {
|
|
7435
7520
|
constructor(i, t) {
|
|
7436
7521
|
/** 要全屏展示的目标元素 */
|
|
7437
7522
|
d(this, "targetElement");
|
|
@@ -7451,11 +7536,11 @@ class Rn {
|
|
|
7451
7536
|
}
|
|
7452
7537
|
/** 使目标元素进入浏览器全屏 */
|
|
7453
7538
|
enter() {
|
|
7454
|
-
this.targetElement &&
|
|
7539
|
+
this.targetElement && ti(this.targetElement);
|
|
7455
7540
|
}
|
|
7456
7541
|
/** 退出浏览器全屏(不区分由哪个元素进入) */
|
|
7457
7542
|
exit() {
|
|
7458
|
-
this.targetElement &&
|
|
7543
|
+
this.targetElement && ei();
|
|
7459
7544
|
}
|
|
7460
7545
|
/** 若当前已为该目标全屏则退出,否则进入全屏 */
|
|
7461
7546
|
toggle() {
|
|
@@ -7493,8 +7578,8 @@ class Rn {
|
|
|
7493
7578
|
(i = this.detachFullscreenListeners) == null || i.call(this), this.detachFullscreenListeners = void 0, this.targetElement = void 0, this.onFullscreenChange = void 0;
|
|
7494
7579
|
}
|
|
7495
7580
|
}
|
|
7496
|
-
function
|
|
7497
|
-
const i =
|
|
7581
|
+
function Ln(r) {
|
|
7582
|
+
const i = ze(r, 100);
|
|
7498
7583
|
let t = 0, e = 0;
|
|
7499
7584
|
return function(s) {
|
|
7500
7585
|
const n = s.target;
|
|
@@ -7522,7 +7607,7 @@ function An(r) {
|
|
|
7522
7607
|
f(), m();
|
|
7523
7608
|
};
|
|
7524
7609
|
}
|
|
7525
|
-
function
|
|
7610
|
+
function Tn(r, i, t) {
|
|
7526
7611
|
const { isClickAllowed: e, uiLibrary: s = ["naiveUI", "ElementPlus", "Element"] } = t || {}, n = function(l) {
|
|
7527
7612
|
const c = [];
|
|
7528
7613
|
for (const h in l)
|
|
@@ -7555,7 +7640,7 @@ function Vn(r, i, t) {
|
|
|
7555
7640
|
);
|
|
7556
7641
|
}
|
|
7557
7642
|
var j, ft, mt, bt, Pt, Q, J, it, Ct;
|
|
7558
|
-
class
|
|
7643
|
+
class In {
|
|
7559
7644
|
constructor() {
|
|
7560
7645
|
L(this, j);
|
|
7561
7646
|
L(this, ft, !1);
|
|
@@ -7602,22 +7687,22 @@ class On {
|
|
|
7602
7687
|
}
|
|
7603
7688
|
}
|
|
7604
7689
|
j = new WeakMap(), ft = new WeakMap(), mt = new WeakMap(), bt = new WeakMap(), Pt = new WeakMap(), Q = new WeakMap(), J = new WeakMap(), it = new WeakMap(), Ct = new WeakMap();
|
|
7605
|
-
var W, pt, gt, St,
|
|
7606
|
-
class
|
|
7690
|
+
var W, pt, gt, St, _t, q, K, B, Et, Mt;
|
|
7691
|
+
class Nn {
|
|
7607
7692
|
constructor() {
|
|
7608
7693
|
L(this, W);
|
|
7609
7694
|
L(this, pt, !1);
|
|
7610
7695
|
L(this, gt, {});
|
|
7611
7696
|
L(this, St, 0);
|
|
7612
|
-
L(this,
|
|
7697
|
+
L(this, _t, 0);
|
|
7613
7698
|
L(this, q, 0);
|
|
7614
7699
|
L(this, K, 0);
|
|
7615
7700
|
L(this, B);
|
|
7616
|
-
L(this,
|
|
7701
|
+
L(this, Et);
|
|
7617
7702
|
L(this, Mt);
|
|
7618
7703
|
}
|
|
7619
7704
|
init(i, t = {}) {
|
|
7620
|
-
this.finish(), M(this, W, i), M(this, B, t.limit), M(this,
|
|
7705
|
+
this.finish(), M(this, W, i), M(this, B, t.limit), M(this, Et, t.update_move), M(this, Mt, t.update_up), M(this, gt, {
|
|
7621
7706
|
mousedown: this.mousedown.bind(this),
|
|
7622
7707
|
mousemove: this.mousemove.bind(this),
|
|
7623
7708
|
mouseup: this.mouseup.bind(this)
|
|
@@ -7648,26 +7733,26 @@ class Ln {
|
|
|
7648
7733
|
}
|
|
7649
7734
|
alterLocation() {
|
|
7650
7735
|
if (!x(this, W)) return console.error("No DOM");
|
|
7651
|
-
x(this, B) && (M(this, q, Math.min(x(this, q), x(this, B).max.top)), M(this, q, Math.max(x(this, q), x(this, B).min.top)), M(this, K, Math.min(x(this, K), x(this, B).max.left)), M(this, K, Math.max(x(this, K), x(this, B).min.left))), x(this,
|
|
7736
|
+
x(this, B) && (M(this, q, Math.min(x(this, q), x(this, B).max.top)), M(this, q, Math.max(x(this, q), x(this, B).min.top)), M(this, K, Math.min(x(this, K), x(this, B).max.left)), M(this, K, Math.max(x(this, K), x(this, B).min.left))), x(this, Et) && x(this, Et).call(this, this.updateValue()), x(this, W).style.setProperty("--top", x(this, q) + "px"), x(this, W).style.setProperty("--left", x(this, K) + "px");
|
|
7652
7737
|
}
|
|
7653
7738
|
mousedown(i) {
|
|
7654
7739
|
if (!x(this, W)) return console.error("No DOM");
|
|
7655
7740
|
document.body.classList.add("no-select"), M(this, pt, !0);
|
|
7656
7741
|
const t = x(this, W).getBoundingClientRect();
|
|
7657
|
-
M(this,
|
|
7742
|
+
M(this, _t, t.y), M(this, St, t.x);
|
|
7658
7743
|
const { pageX: e, pageY: s } = i;
|
|
7659
|
-
M(this, q, s - x(this,
|
|
7744
|
+
M(this, q, s - x(this, _t)), M(this, K, e - x(this, St)), this.alterLocation();
|
|
7660
7745
|
}
|
|
7661
7746
|
mousemove(i) {
|
|
7662
7747
|
const { pageX: t, pageY: e } = i;
|
|
7663
|
-
x(this, pt) && (M(this, q, e - x(this,
|
|
7748
|
+
x(this, pt) && (M(this, q, e - x(this, _t)), M(this, K, t - x(this, St)), this.alterLocation());
|
|
7664
7749
|
}
|
|
7665
7750
|
mouseup() {
|
|
7666
7751
|
x(this, pt) && (M(this, pt, !1), document.body.classList.remove("no-select"), x(this, Mt) && x(this, Mt).call(this, this.updateValue()));
|
|
7667
7752
|
}
|
|
7668
7753
|
}
|
|
7669
|
-
W = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), St = new WeakMap(),
|
|
7670
|
-
function
|
|
7754
|
+
W = new WeakMap(), pt = new WeakMap(), gt = new WeakMap(), St = new WeakMap(), _t = new WeakMap(), q = new WeakMap(), K = new WeakMap(), B = new WeakMap(), Et = new WeakMap(), Mt = new WeakMap();
|
|
7755
|
+
function Hn(r, i) {
|
|
7671
7756
|
if (typeof r == "number") return r;
|
|
7672
7757
|
if (/px/.test(r)) return Number(r.replace(/px/, "")) || 0;
|
|
7673
7758
|
const t = document.createElement("div");
|
|
@@ -7675,7 +7760,7 @@ function Tn(r, i) {
|
|
|
7675
7760
|
const e = t.getBoundingClientRect().width;
|
|
7676
7761
|
return i.removeChild(t), e;
|
|
7677
7762
|
}
|
|
7678
|
-
function
|
|
7763
|
+
function Fn(r, i) {
|
|
7679
7764
|
if (!r) return;
|
|
7680
7765
|
let t, e;
|
|
7681
7766
|
if (typeof i == "string") {
|
|
@@ -7692,7 +7777,7 @@ function In(r, i) {
|
|
|
7692
7777
|
const s = t / e;
|
|
7693
7778
|
return s > r ? [r * e, e] : s < r ? [t, t / r] : [t, e];
|
|
7694
7779
|
}
|
|
7695
|
-
function
|
|
7780
|
+
function zn(r, i = 5e3) {
|
|
7696
7781
|
return new Promise((t, e) => {
|
|
7697
7782
|
const s = new Image();
|
|
7698
7783
|
s.src = r;
|
|
@@ -7708,7 +7793,7 @@ function Nn(r, i = 5e3) {
|
|
|
7708
7793
|
}, s.crossOrigin = "Anonymous";
|
|
7709
7794
|
});
|
|
7710
7795
|
}
|
|
7711
|
-
function
|
|
7796
|
+
function Bn(r) {
|
|
7712
7797
|
const t = document.getElementById(r).querySelectorAll("img"), e = t.length, s = [];
|
|
7713
7798
|
let n = 0;
|
|
7714
7799
|
return e === 0 ? Promise.resolve({
|
|
@@ -7750,14 +7835,14 @@ function Hn(r) {
|
|
|
7750
7835
|
});
|
|
7751
7836
|
});
|
|
7752
7837
|
}
|
|
7753
|
-
function
|
|
7838
|
+
function Un(r) {
|
|
7754
7839
|
return new Promise((i, t) => {
|
|
7755
7840
|
fetch(r).then((e) => i(e.text())).catch((e) => {
|
|
7756
7841
|
console.error("Error fetching :", e), t(e);
|
|
7757
7842
|
});
|
|
7758
7843
|
});
|
|
7759
7844
|
}
|
|
7760
|
-
function
|
|
7845
|
+
function Gn(r) {
|
|
7761
7846
|
const i = document.createElement("input");
|
|
7762
7847
|
return i.type = "file", i.accept = (r == null ? void 0 : r.accept) || "", i.multiple = (r == null ? void 0 : r.multiple) || !1, new Promise((t, e) => {
|
|
7763
7848
|
i.addEventListener("change", (s) => {
|
|
@@ -7766,7 +7851,7 @@ function zn(r) {
|
|
|
7766
7851
|
}), i.click();
|
|
7767
7852
|
});
|
|
7768
7853
|
}
|
|
7769
|
-
function
|
|
7854
|
+
function Fs(r) {
|
|
7770
7855
|
const {
|
|
7771
7856
|
href: i,
|
|
7772
7857
|
fileName: t,
|
|
@@ -7805,24 +7890,24 @@ function Hs(r) {
|
|
|
7805
7890
|
!a && l && u();
|
|
7806
7891
|
} };
|
|
7807
7892
|
}
|
|
7808
|
-
function
|
|
7893
|
+
function Xn(r, i, t) {
|
|
7809
7894
|
if (!t) {
|
|
7810
7895
|
let n = i.replace(/^[^.]+./, "");
|
|
7811
7896
|
n = n == i ? "text/plain" : "application/" + n, t = { type: n };
|
|
7812
7897
|
}
|
|
7813
7898
|
const e = new Blob(r, t), s = URL.createObjectURL(e);
|
|
7814
|
-
|
|
7899
|
+
Fs({ href: s, fileName: i });
|
|
7815
7900
|
}
|
|
7816
|
-
const
|
|
7817
|
-
function
|
|
7818
|
-
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(i,
|
|
7901
|
+
const zs = Math.PI / 2, Wt = Math.PI / 180, qt = 6378137, Bs = 85.05112878;
|
|
7902
|
+
function Le(r, i) {
|
|
7903
|
+
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(i, Bs), -85.05112878), s = t * Wt * qt, n = e * Wt, o = Math.log(Math.tan(Math.PI / 4 + n / 2)) * qt;
|
|
7819
7904
|
return [s, o];
|
|
7820
7905
|
}
|
|
7821
|
-
function
|
|
7822
|
-
const t = r / qt / Wt, e = (2 * Math.atan(Math.exp(i / qt)) -
|
|
7906
|
+
function Yn(r, i) {
|
|
7907
|
+
const t = r / qt / Wt, e = (2 * Math.atan(Math.exp(i / qt)) - zs) / Wt;
|
|
7823
7908
|
return [t, e];
|
|
7824
7909
|
}
|
|
7825
|
-
function
|
|
7910
|
+
function Us(r, i, t) {
|
|
7826
7911
|
const [e, s] = r, [n, o] = i, [a, l] = t, c = (a - n) ** 2 + (l - o) ** 2;
|
|
7827
7912
|
if (c === 0) return Math.sqrt((e - n) ** 2 + (s - o) ** 2);
|
|
7828
7913
|
let h = ((e - n) * (a - n) + (s - o) * (l - o)) / c;
|
|
@@ -7830,21 +7915,25 @@ function Bs(r, i, t) {
|
|
|
7830
7915
|
(e - (n + h * (a - n))) ** 2 + (s - (o + h * (l - o))) ** 2
|
|
7831
7916
|
);
|
|
7832
7917
|
}
|
|
7833
|
-
function
|
|
7918
|
+
function $n(r, i, t, e, s, n = 1, o = 1) {
|
|
7834
7919
|
const a = r + t * Math.cos(e) * n, l = i + t * Math.sin(e) * o, c = r + t * Math.cos(s) * n, h = i + t * Math.sin(s) * o;
|
|
7835
7920
|
return [
|
|
7836
7921
|
[a, l],
|
|
7837
7922
|
[c, h]
|
|
7838
7923
|
];
|
|
7839
7924
|
}
|
|
7840
|
-
function
|
|
7925
|
+
function jn(r, i, t, e) {
|
|
7926
|
+
const [s, n] = Le(r, i), [o, a] = Le(t, e);
|
|
7927
|
+
return we(s, n, o, a);
|
|
7928
|
+
}
|
|
7929
|
+
function we(r, i, t, e) {
|
|
7841
7930
|
return Math.hypot(Math.abs(t - r), Math.abs(e - i));
|
|
7842
7931
|
}
|
|
7843
|
-
function
|
|
7932
|
+
function ii(r, i, t, e) {
|
|
7844
7933
|
const s = (r + t) / 2, n = (i + e) / 2;
|
|
7845
7934
|
return { x: s, y: n };
|
|
7846
7935
|
}
|
|
7847
|
-
function
|
|
7936
|
+
function Wn(r, i, t, e) {
|
|
7848
7937
|
const [s, n] = r, [o, a] = i;
|
|
7849
7938
|
let l = 1 / 0;
|
|
7850
7939
|
if (o !== 0) {
|
|
@@ -7857,7 +7946,7 @@ function Yn(r, i, t, e) {
|
|
|
7857
7946
|
}
|
|
7858
7947
|
return l === 1 / 0 ? r : [s + o * l, n + a * l];
|
|
7859
7948
|
}
|
|
7860
|
-
const
|
|
7949
|
+
const Gs = /* @__PURE__ */ new Set([
|
|
7861
7950
|
"sin",
|
|
7862
7951
|
"cos",
|
|
7863
7952
|
"tan",
|
|
@@ -7865,9 +7954,9 @@ const Us = /* @__PURE__ */ new Set([
|
|
|
7865
7954
|
"acos",
|
|
7866
7955
|
"atan",
|
|
7867
7956
|
"atan2"
|
|
7868
|
-
]),
|
|
7957
|
+
]), qn = new Proxy(Math, {
|
|
7869
7958
|
get(r, i) {
|
|
7870
|
-
return
|
|
7959
|
+
return Gs.has(i) ? function(...t) {
|
|
7871
7960
|
const e = t.map((s) => s / 180 * Math.PI);
|
|
7872
7961
|
return r[i](...e);
|
|
7873
7962
|
} : r[i];
|
|
@@ -7881,7 +7970,7 @@ const Us = /* @__PURE__ */ new Set([
|
|
|
7881
7970
|
throw new Error("DegreeMath 是只读的,不能删除属性");
|
|
7882
7971
|
}
|
|
7883
7972
|
});
|
|
7884
|
-
function
|
|
7973
|
+
function Kn(r, i) {
|
|
7885
7974
|
const t = r.length;
|
|
7886
7975
|
if (t === 0) return [0, 0, 0];
|
|
7887
7976
|
if (t === 1) return [r[0][0], r[0][1], 0];
|
|
@@ -7899,10 +7988,40 @@ function jn(r, i) {
|
|
|
7899
7988
|
const n = s[0], o = s[1], a = (1 - e) * n[0] + e * o[0], l = (1 - e) * n[1] + e * o[1], c = o[0] - n[0], h = o[1] - n[1], u = Math.atan2(h, c);
|
|
7900
7989
|
return [a, l, u];
|
|
7901
7990
|
}
|
|
7902
|
-
function
|
|
7991
|
+
function Zn(r, i, t) {
|
|
7903
7992
|
const e = Math.abs(r) || 1, s = i * Math.PI * 2, n = e * Math.cos(s), o = Math.sin(s);
|
|
7904
7993
|
return t ? [(n + e) / (2 * e), (o + 1) / 2] : [n, o];
|
|
7905
7994
|
}
|
|
7995
|
+
function Qn(r, i, t) {
|
|
7996
|
+
return Math.min(Math.max(r, i), t);
|
|
7997
|
+
}
|
|
7998
|
+
function Xs(r, i, t) {
|
|
7999
|
+
return r + (i - r) * t;
|
|
8000
|
+
}
|
|
8001
|
+
function Ys(r, i, t) {
|
|
8002
|
+
return r === i ? 0 : (t - r) / (i - r);
|
|
8003
|
+
}
|
|
8004
|
+
function Jn(r, i, t, e, s) {
|
|
8005
|
+
const n = Ys(i, t, r);
|
|
8006
|
+
return Xs(e, s, n);
|
|
8007
|
+
}
|
|
8008
|
+
function tr(r) {
|
|
8009
|
+
return r / 180 * Math.PI;
|
|
8010
|
+
}
|
|
8011
|
+
function er(r) {
|
|
8012
|
+
return r / Math.PI * 180;
|
|
8013
|
+
}
|
|
8014
|
+
function ir(r, i = !1) {
|
|
8015
|
+
let t = r % 360;
|
|
8016
|
+
return t < 0 && (t += 360), i && t >= 180 && (t -= 360), t;
|
|
8017
|
+
}
|
|
8018
|
+
function sr(r, i, t, e, s, n) {
|
|
8019
|
+
return r >= t && r <= t + s && i >= e && i <= e + n;
|
|
8020
|
+
}
|
|
8021
|
+
function nr(r, i, t, e, s) {
|
|
8022
|
+
const n = r - t, o = i - e;
|
|
8023
|
+
return n * n + o * o <= s * s;
|
|
8024
|
+
}
|
|
7906
8025
|
class xt {
|
|
7907
8026
|
constructor(i, t) {
|
|
7908
8027
|
d(this, "resolve");
|
|
@@ -7920,7 +8039,7 @@ class xt {
|
|
|
7920
8039
|
}) : i ? (t = this.resolve) == null || t.call(this) : (e = this.reject) == null || e.call(this), i;
|
|
7921
8040
|
}
|
|
7922
8041
|
}
|
|
7923
|
-
class
|
|
8042
|
+
class $s extends xt {
|
|
7924
8043
|
constructor(i) {
|
|
7925
8044
|
super(), this.resolve = i;
|
|
7926
8045
|
}
|
|
@@ -7939,7 +8058,7 @@ class Gs extends xt {
|
|
|
7939
8058
|
return new xt(this.resolve, t);
|
|
7940
8059
|
}
|
|
7941
8060
|
}
|
|
7942
|
-
class
|
|
8061
|
+
class js extends xt {
|
|
7943
8062
|
constructor(i) {
|
|
7944
8063
|
super(), this.reject = i;
|
|
7945
8064
|
}
|
|
@@ -7972,7 +8091,7 @@ const z = class z {
|
|
|
7972
8091
|
var s, n;
|
|
7973
8092
|
return (n = (s = z.tips)[i]) == null ? void 0 : n.call(s, ...t);
|
|
7974
8093
|
};
|
|
7975
|
-
return new
|
|
8094
|
+
return new $s(e);
|
|
7976
8095
|
};
|
|
7977
8096
|
}
|
|
7978
8097
|
static rejectTip(i) {
|
|
@@ -7981,7 +8100,7 @@ const z = class z {
|
|
|
7981
8100
|
var s, n;
|
|
7982
8101
|
return (n = (s = z.tips)[i]) == null ? void 0 : n.call(s, ...t);
|
|
7983
8102
|
};
|
|
7984
|
-
return new
|
|
8103
|
+
return new js(e);
|
|
7985
8104
|
};
|
|
7986
8105
|
}
|
|
7987
8106
|
};
|
|
@@ -7993,90 +8112,100 @@ d(z, "tips", {
|
|
|
7993
8112
|
}), d(z, "info", z.resolveTip("info")), d(z, "success", z.resolveTip("success")), d(z, "warning", z.rejectTip("warning")), d(z, "error", z.rejectTip("error"));
|
|
7994
8113
|
let kt = z;
|
|
7995
8114
|
export {
|
|
7996
|
-
|
|
8115
|
+
ri as EXTENSION_TO_MIME,
|
|
7997
8116
|
te as FILE_EXTENSIONS,
|
|
7998
|
-
|
|
7999
|
-
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
|
|
8003
|
-
|
|
8004
|
-
|
|
8117
|
+
Te as PAPER_SIZE_DEFINITIONS,
|
|
8118
|
+
Ks as PAPER_SIZE_OPTIONS,
|
|
8119
|
+
Se as UNIT_LABELS,
|
|
8120
|
+
qs as WINDOW_TARGET,
|
|
8121
|
+
Zs as _Animate_CreateOscillator,
|
|
8122
|
+
Qs as _Animate_CubicBezier,
|
|
8123
|
+
oi as _Animate_NumericTransition,
|
|
8005
8124
|
Ut as _Animate_Schedule,
|
|
8006
|
-
|
|
8007
|
-
|
|
8008
|
-
|
|
8009
|
-
|
|
8010
|
-
|
|
8125
|
+
Js as _Blob_ConvertDataToImageUrl,
|
|
8126
|
+
En as _Browser_CalculatePrintableArea,
|
|
8127
|
+
_n as _Browser_CopyToClipboard,
|
|
8128
|
+
Sn as _Browser_GetFrameRate,
|
|
8129
|
+
Mn as _Browser_IdleDetection,
|
|
8011
8130
|
Ht as _Browser_SameOriginTabManager,
|
|
8012
|
-
|
|
8013
|
-
|
|
8131
|
+
Pn as _Browser_SoundEffects,
|
|
8132
|
+
Cn as _Browser_WebSocketClient,
|
|
8014
8133
|
T as _Canvas_Axis,
|
|
8015
|
-
|
|
8016
|
-
|
|
8017
|
-
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8026
|
-
|
|
8134
|
+
kn as _Canvas_TimeAxis,
|
|
8135
|
+
Fn as _Element_CalculateCanvasSize,
|
|
8136
|
+
Bn as _Element_CheckImagesLoaded,
|
|
8137
|
+
Tn as _Element_CloseOnOutsideClick,
|
|
8138
|
+
In as _Element_Drag,
|
|
8139
|
+
Rn as _Element_DropZoneManager,
|
|
8140
|
+
ti as _Element_EnterFullscreen,
|
|
8141
|
+
ei as _Element_ExitFullscreen,
|
|
8142
|
+
An as _Element_Fullscreen,
|
|
8143
|
+
On as _Element_FullscreenController,
|
|
8144
|
+
Vn as _Element_FullscreenObserver,
|
|
8145
|
+
Hn as _Element_GetOtherSizeInPixels,
|
|
8027
8146
|
jt as _Element_IsFullscreen,
|
|
8028
|
-
|
|
8029
|
-
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8147
|
+
zn as _Element_LoadImage,
|
|
8148
|
+
Nn as _Element_LocalDrag,
|
|
8149
|
+
Ln as _Element_ScrollEndListener,
|
|
8150
|
+
Xn as _File_CreateAndDownload,
|
|
8151
|
+
Fs as _File_Download,
|
|
8152
|
+
Un as _File_Read,
|
|
8153
|
+
Gn as _File_Select,
|
|
8154
|
+
rn as _Format_CamelCase,
|
|
8155
|
+
tn as _Format_CapitalizeFirstLetter,
|
|
8156
|
+
cn as _Format_ChunkArray,
|
|
8157
|
+
on as _Format_ExcludeSubstring,
|
|
8158
|
+
nn as _Format_FileSize,
|
|
8040
8159
|
ne as _Format_HrefName,
|
|
8041
|
-
|
|
8160
|
+
ln as _Format_MillisecondToReadable,
|
|
8042
8161
|
se as _Format_NumberWithCommas,
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
|
|
8056
|
-
|
|
8162
|
+
sn as _Format_NumberWithUnit,
|
|
8163
|
+
en as _Format_Percentage,
|
|
8164
|
+
ai as _Format_Timestamp,
|
|
8165
|
+
an as _Format_ToggleInvisibleChars,
|
|
8166
|
+
we as _Math_CalculateDistance2D,
|
|
8167
|
+
jn as _Math_CalculateDistanceLngLat,
|
|
8168
|
+
Qn as _Math_Clamp,
|
|
8169
|
+
tr as _Math_DegToRad,
|
|
8170
|
+
qn as _Math_Degree,
|
|
8171
|
+
$n as _Math_GetArcPoints,
|
|
8172
|
+
Kn as _Math_GetBezierCurveNodes,
|
|
8173
|
+
Wn as _Math_GetBoundaryIntersection,
|
|
8174
|
+
Zn as _Math_GetEllipsePoints,
|
|
8175
|
+
ii as _Math_GetMidpoint,
|
|
8176
|
+
Ys as _Math_InverseLerp,
|
|
8177
|
+
nr as _Math_IsPointInCircle,
|
|
8178
|
+
sr as _Math_IsPointInRect,
|
|
8179
|
+
Xs as _Math_Lerp,
|
|
8180
|
+
Le as _Math_LngLatToPlane,
|
|
8181
|
+
ir as _Math_NormalizeAngle,
|
|
8182
|
+
Yn as _Math_PlaneToLngLat,
|
|
8183
|
+
Us as _Math_PointToLineDistance,
|
|
8184
|
+
er as _Math_RadToDeg,
|
|
8185
|
+
Jn as _Math_Remap,
|
|
8057
8186
|
kt as _Tip,
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8187
|
+
di as _Utility_Clone,
|
|
8188
|
+
hi as _Utility_ColorConverter,
|
|
8189
|
+
ze as _Utility_Debounce,
|
|
8190
|
+
gn as _Utility_ExecuteWhenIdle,
|
|
8062
8191
|
oe as _Utility_GenerateUUID,
|
|
8063
|
-
|
|
8192
|
+
yn as _Utility_GetTargetByPath,
|
|
8064
8193
|
ct as _Utility_MergeObjects,
|
|
8065
|
-
|
|
8066
|
-
|
|
8194
|
+
xn as _Utility_RotateList,
|
|
8195
|
+
wn as _Utility_SetTargetByPath,
|
|
8067
8196
|
Ee as _Utility_ShortcutManager,
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8197
|
+
bn as _Utility_Sleep,
|
|
8198
|
+
vn as _Utility_Throttle,
|
|
8199
|
+
fi as _Utility_TimeConsumption,
|
|
8200
|
+
pn as _Utility_UndoRedoHistory,
|
|
8201
|
+
ui as _Utility_WaitForCondition,
|
|
8202
|
+
mn as _Valid_CheckConnectionWithXHR,
|
|
8074
8203
|
re as _Valid_DataType,
|
|
8075
|
-
|
|
8076
|
-
|
|
8204
|
+
dn as _Valid_DoesInfiniteLineIntersectRectangle,
|
|
8205
|
+
_e as _Valid_FileTypeChecker,
|
|
8077
8206
|
Gt as _Valid_Is2DNumberArray,
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8207
|
+
hn as _Valid_IsInMargin,
|
|
8208
|
+
xe as _Valid_IsNumberArray,
|
|
8209
|
+
un as _Valid_IsPointInPolygon,
|
|
8210
|
+
fn as _Valid_IsSecureContext
|
|
8082
8211
|
};
|