nhanh-pure-function 4.0.0 → 4.1.0
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/Animate/index.d.ts +11 -1
- package/dist/Browser/Runtime/index.d.ts +2 -0
- package/dist/Browser/Runtime/soundEffects.d.ts +47 -0
- package/dist/Browser/Runtime/webSocketClient.d.ts +68 -0
- package/dist/Browser/index.d.ts +34 -0
- package/dist/Browser/type.d.ts +16 -0
- package/dist/Canvas/TimeAxis/index.d.ts +9 -21
- package/dist/Canvas/TimeAxis/type.d.ts +39 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +854 -572
- package/package.json +1 -1
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 je = Object.defineProperty;
|
|
3
|
+
var ve = (r) => {
|
|
4
4
|
throw TypeError(r);
|
|
5
5
|
};
|
|
6
|
-
var
|
|
7
|
-
var d = (r, s, t) =>
|
|
8
|
-
var x = (r, s, t) => (
|
|
9
|
-
const
|
|
6
|
+
var qe = (r, s, t) => s in r ? je(r, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[s] = t;
|
|
7
|
+
var d = (r, s, t) => qe(r, typeof s != "symbol" ? s + "" : s, t), ye = (r, s, t) => s.has(r) || ve("Cannot " + t);
|
|
8
|
+
var x = (r, s, t) => (ye(r, s, "read from private field"), t ? t.call(r) : s.get(r)), T = (r, s, t) => s.has(r) ? ve("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(r) : s.set(r, t), M = (r, s, t, e) => (ye(r, s, "write to private field"), e ? e.call(r, t) : s.set(r, t), t);
|
|
9
|
+
const $e = {
|
|
10
10
|
".mp3": "audio/mpeg",
|
|
11
11
|
".mp4": "video/mp4",
|
|
12
12
|
".m4a": "audio/mp4",
|
|
@@ -68,7 +68,7 @@ const We = {
|
|
|
68
68
|
".otf": "font/otf",
|
|
69
69
|
".eot": "application/vnd.ms-fontobject",
|
|
70
70
|
".map": "application/json"
|
|
71
|
-
},
|
|
71
|
+
}, ie = {
|
|
72
72
|
image: [
|
|
73
73
|
".jpg",
|
|
74
74
|
".jpeg",
|
|
@@ -248,7 +248,7 @@ const We = {
|
|
|
248
248
|
".awk",
|
|
249
249
|
".php"
|
|
250
250
|
]
|
|
251
|
-
},
|
|
251
|
+
}, we = [
|
|
252
252
|
"",
|
|
253
253
|
"万",
|
|
254
254
|
"亿",
|
|
@@ -262,7 +262,7 @@ const We = {
|
|
|
262
262
|
"正",
|
|
263
263
|
"载",
|
|
264
264
|
"极"
|
|
265
|
-
],
|
|
265
|
+
], Os = ["_self", "_blank", "_parent", "_top"], Me = {
|
|
266
266
|
// 北美标准尺寸 (毫米)
|
|
267
267
|
Letter: { width: 215.9, height: 279.4 },
|
|
268
268
|
// 8.5 × 11 英寸
|
|
@@ -315,10 +315,10 @@ const We = {
|
|
|
315
315
|
C6: { width: 114, height: 162 },
|
|
316
316
|
C7: { width: 81, height: 114 },
|
|
317
317
|
C8: { width: 57, height: 81 }
|
|
318
|
-
},
|
|
318
|
+
}, As = Object.keys(Me).map(
|
|
319
319
|
(r) => ({ value: r, label: r })
|
|
320
320
|
);
|
|
321
|
-
function
|
|
321
|
+
function zt(r, s = 500) {
|
|
322
322
|
let t, e = !0;
|
|
323
323
|
function i(n) {
|
|
324
324
|
if (!e) return;
|
|
@@ -328,19 +328,19 @@ function Ut(r, s = 500) {
|
|
|
328
328
|
}
|
|
329
329
|
return requestAnimationFrame(i), () => e = !1;
|
|
330
330
|
}
|
|
331
|
-
function
|
|
331
|
+
function Ts(r, s, t, e, i = 2) {
|
|
332
332
|
let n = r, o = !1, a = 1, l = r, c = s, h = t;
|
|
333
333
|
const u = () => {
|
|
334
334
|
const b = (c - l) / h;
|
|
335
335
|
return Number(b.toFixed(i));
|
|
336
336
|
};
|
|
337
337
|
let f = u();
|
|
338
|
-
const m = (b) => Math.min(Math.max(b, l), c), p = (b) => Number(b.toFixed(i)), g = (b, C,
|
|
338
|
+
const m = (b) => Math.min(Math.max(b, l), c), p = (b) => Number(b.toFixed(i)), g = (b, C, E) => {
|
|
339
339
|
const A = [];
|
|
340
|
-
return b >= C && A.push("最小值必须小于最大值"),
|
|
341
|
-
}, y = (b, C,
|
|
342
|
-
const A = g(b, C,
|
|
343
|
-
return A.length > 0 ? (console.error(`参数更新失败: ${A.join("; ")}`), !1) : (l = b, c = C, h =
|
|
340
|
+
return b >= C && A.push("最小值必须小于最大值"), E <= 0 ? A.push("分段数必须为正数") : u() == 0 && A.push("数值精度过低,致使动画步长为 0"), A;
|
|
341
|
+
}, y = (b, C, E) => {
|
|
342
|
+
const A = g(b, C, E);
|
|
343
|
+
return A.length > 0 ? (console.error(`参数更新失败: ${A.join("; ")}`), !1) : (l = b, c = C, 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(p(n)), requestAnimationFrame(w));
|
|
346
346
|
};
|
|
@@ -365,7 +365,7 @@ function Os(r, s, t, e, i = 2) {
|
|
|
365
365
|
getParams: () => ({ min: l, max: c, steps: h, precision: i, stepSize: f })
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function Ze(r, s, t, e, i = 4) {
|
|
369
369
|
if (t <= 0) return console.error("动画步数 必须为正数");
|
|
370
370
|
const n = (u) => Number(u.toFixed(i)), o = s - r, a = n(Math.abs(o) / t);
|
|
371
371
|
if (a === 0) return console.error("数值精度过低,致使动画步长为 0");
|
|
@@ -376,7 +376,35 @@ function qe(r, s, t, e, i = 2) {
|
|
|
376
376
|
};
|
|
377
377
|
h();
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function Ls(r, s, t, e) {
|
|
380
|
+
const i = (l) => 3 * (1 - l) ** 2 * l * r + 3 * (1 - l) * l ** 2 * t + l ** 3, n = (l) => 3 * (1 - l) ** 2 * l * s + 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
|
+
if (l <= 0) return 0;
|
|
382
|
+
if (l >= 1) return 1;
|
|
383
|
+
let c = l;
|
|
384
|
+
for (let f = 0; f < 8; f++) {
|
|
385
|
+
const m = i(c) - l;
|
|
386
|
+
if (Math.abs(m) < 1e-6) return c;
|
|
387
|
+
const p = o(c);
|
|
388
|
+
if (Math.abs(p) < 1e-6) break;
|
|
389
|
+
const g = c - m / p;
|
|
390
|
+
if (g < 0 || g > 1) break;
|
|
391
|
+
c = g;
|
|
392
|
+
}
|
|
393
|
+
let h = 0, u = 1;
|
|
394
|
+
c = l;
|
|
395
|
+
for (let f = 0; f < 24; f++) {
|
|
396
|
+
const m = i(c) - l;
|
|
397
|
+
if (Math.abs(m) < 1e-6) return c;
|
|
398
|
+
m > 0 ? u = c : h = c, c = (h + u) / 2;
|
|
399
|
+
}
|
|
400
|
+
return c;
|
|
401
|
+
};
|
|
402
|
+
return (l) => {
|
|
403
|
+
const c = Math.min(1, Math.max(0, l));
|
|
404
|
+
return n(a(c));
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function Is(r, s = "image/png") {
|
|
380
408
|
try {
|
|
381
409
|
let t, e = s;
|
|
382
410
|
if (r instanceof File)
|
|
@@ -416,14 +444,14 @@ function As(r, s = "image/png") {
|
|
|
416
444
|
function Ns(r) {
|
|
417
445
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
418
446
|
}
|
|
419
|
-
function
|
|
447
|
+
function Hs(r, s, t = 2) {
|
|
420
448
|
return !Number.isFinite(r) || !Number.isFinite(s) || !Number.isFinite(t) ? (console.error("所有参数必须是有限的数字"), "") : s === 0 ? (console.error("分母不能为零"), "") : t < 0 ? (console.error("小数位数不能为负数"), "") : (r / s * 100).toFixed(t) + "%";
|
|
421
449
|
}
|
|
422
|
-
function
|
|
450
|
+
function ne(r) {
|
|
423
451
|
const t = r.toString().split("."), e = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
424
452
|
return t.length > 1 ? e + "." + t[1] : e;
|
|
425
453
|
}
|
|
426
|
-
function
|
|
454
|
+
function Fs(r, s) {
|
|
427
455
|
const t = {
|
|
428
456
|
join: !0,
|
|
429
457
|
suffix: "",
|
|
@@ -434,16 +462,16 @@ function Ls(r, s) {
|
|
|
434
462
|
}, o = Number(r);
|
|
435
463
|
if (isNaN(o)) return e ? `0${i}` : [0, i];
|
|
436
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)));
|
|
437
|
-
return e ? `${f}${
|
|
465
|
+
return e ? `${f}${we[c]}${i}` : [f, we[c] + i];
|
|
438
466
|
}
|
|
439
|
-
function
|
|
467
|
+
function Bs(r) {
|
|
440
468
|
const s = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
441
469
|
let t = 0;
|
|
442
470
|
for (; r > 1024; )
|
|
443
471
|
r /= 1024, t++;
|
|
444
472
|
return `${Math.round(r * 100) / 100} ${s[t]}`;
|
|
445
473
|
}
|
|
446
|
-
function
|
|
474
|
+
function Qe(r, s = "YYYY-MM-DD hh:mm:ss", t = !0) {
|
|
447
475
|
const e = new Date(r);
|
|
448
476
|
if (isNaN(e.getTime()))
|
|
449
477
|
return console.error("Invalid date"), "";
|
|
@@ -462,15 +490,15 @@ function $e(r, s = "YYYY-MM-DD hh:mm:ss", t = !0) {
|
|
|
462
490
|
return t ? String(o).padStart(2, "0") : String(o);
|
|
463
491
|
});
|
|
464
492
|
}
|
|
465
|
-
function
|
|
493
|
+
function re(r, s = "file") {
|
|
466
494
|
if (!r || (r = String(r).trim(), r === "")) return s;
|
|
467
495
|
const t = r.split("/");
|
|
468
496
|
return t[t.length - 1].split("?")[0];
|
|
469
497
|
}
|
|
470
|
-
function
|
|
498
|
+
function Us(r, s) {
|
|
471
499
|
return r = r.replace(/([^a-zA-Z][a-z])/g, (t) => t.toUpperCase()), s ? r.replace(/[^a-zA-Z]+/g, "") : r;
|
|
472
500
|
}
|
|
473
|
-
function
|
|
501
|
+
function Xs(r, s, t = ",") {
|
|
474
502
|
const e = new RegExp(
|
|
475
503
|
`(^|${t})${s}(${t}|$)`,
|
|
476
504
|
"g"
|
|
@@ -479,7 +507,7 @@ function Fs(r, s, t = ",") {
|
|
|
479
507
|
return n === o ? t : "";
|
|
480
508
|
});
|
|
481
509
|
}
|
|
482
|
-
function
|
|
510
|
+
function Gs(r, s = !0) {
|
|
483
511
|
const t = {
|
|
484
512
|
"\b": "\\b",
|
|
485
513
|
" ": "\\t",
|
|
@@ -496,7 +524,7 @@ function Bs(r, s = !0) {
|
|
|
496
524
|
(i) => t[i]
|
|
497
525
|
) : r.replace(/\\[btnvfrs]/g, (i) => e[i] || i);
|
|
498
526
|
}
|
|
499
|
-
const
|
|
527
|
+
const Lt = [
|
|
500
528
|
["年", 365 * 24 * 60 * 60 * 1e3],
|
|
501
529
|
["月", 30 * 24 * 60 * 60 * 1e3],
|
|
502
530
|
["周", 7 * 24 * 60 * 60 * 1e3],
|
|
@@ -506,21 +534,21 @@ const Nt = [
|
|
|
506
534
|
["秒", 1e3],
|
|
507
535
|
["毫秒", 1]
|
|
508
536
|
];
|
|
509
|
-
function
|
|
537
|
+
function zs(r, s) {
|
|
510
538
|
if (!Number.isFinite(r) || r < 0) return "0毫秒";
|
|
511
539
|
r = Math.round(r);
|
|
512
|
-
const t = s ?
|
|
513
|
-
for (let i = e; i <
|
|
514
|
-
const [n, o] =
|
|
540
|
+
const t = s ? Lt.findIndex(([i]) => i === s) : 0, e = t === -1 ? 0 : t;
|
|
541
|
+
for (let i = e; i < Lt.length; i++) {
|
|
542
|
+
const [n, o] = Lt[i];
|
|
515
543
|
if (r >= o) {
|
|
516
544
|
const a = o === 1 ? r : Math.round(r / o * 10) / 10;
|
|
517
545
|
let l = Number.isInteger(a) ? a : a.toFixed(1).replace(/\.0$/, "");
|
|
518
|
-
return n ===
|
|
546
|
+
return n === Lt[e][0] && (l = ne(Number(l))), `${l}${n}`;
|
|
519
547
|
}
|
|
520
548
|
}
|
|
521
549
|
return "0毫秒";
|
|
522
550
|
}
|
|
523
|
-
function
|
|
551
|
+
function Ys(r, s) {
|
|
524
552
|
if (s < 1)
|
|
525
553
|
return console.error("分割大小必须大于0"), [];
|
|
526
554
|
const t = [];
|
|
@@ -530,24 +558,24 @@ function Gs(r, s) {
|
|
|
530
558
|
}
|
|
531
559
|
return t;
|
|
532
560
|
}
|
|
533
|
-
function
|
|
561
|
+
function ge(r, s = 2) {
|
|
534
562
|
if (Array.isArray(r) && r.length >= s) {
|
|
535
563
|
for (let e = 0; e < r.length; e++)
|
|
536
564
|
if (typeof r[e] != "number" || !Number.isFinite(r[e])) return !1;
|
|
537
565
|
} else return !1;
|
|
538
566
|
return !0;
|
|
539
567
|
}
|
|
540
|
-
function
|
|
568
|
+
function Yt(r, s = 1, t = 2) {
|
|
541
569
|
if (Array.isArray(r) && r.length >= s) {
|
|
542
570
|
for (let i = 0; i < r.length; i++)
|
|
543
|
-
if (!
|
|
571
|
+
if (!ge(r[i], t)) return !1;
|
|
544
572
|
} else return !1;
|
|
545
573
|
return !0;
|
|
546
574
|
}
|
|
547
|
-
function
|
|
575
|
+
function Ws(r, s, t) {
|
|
548
576
|
return Math.abs(r - s) <= t;
|
|
549
577
|
}
|
|
550
|
-
function
|
|
578
|
+
function js(r, s) {
|
|
551
579
|
let t = !1;
|
|
552
580
|
const { x: e, y: i } = r, n = s.length;
|
|
553
581
|
for (let o = 0, a = n - 1; o < n; a = o++) {
|
|
@@ -556,7 +584,7 @@ function zs(r, s) {
|
|
|
556
584
|
}
|
|
557
585
|
return t;
|
|
558
586
|
}
|
|
559
|
-
function
|
|
587
|
+
function qs(r, s, t, e) {
|
|
560
588
|
const i = Math.min(r[0], s[0]), n = Math.max(r[0], s[0]), o = Math.min(r[1], s[1]), a = Math.max(r[1], s[1]), l = [
|
|
561
589
|
[i, o],
|
|
562
590
|
// 左上
|
|
@@ -580,10 +608,10 @@ function Ys(r, s, t, e) {
|
|
|
580
608
|
}
|
|
581
609
|
return m && p;
|
|
582
610
|
}
|
|
583
|
-
function
|
|
611
|
+
function oe(r) {
|
|
584
612
|
return Object.prototype.toString.call(r).slice(8, -1).toLowerCase();
|
|
585
613
|
}
|
|
586
|
-
function
|
|
614
|
+
function $s(r) {
|
|
587
615
|
return [
|
|
588
616
|
"https:",
|
|
589
617
|
// HTTPS协议,用于安全地浏览网页
|
|
@@ -607,7 +635,7 @@ function js(r) {
|
|
|
607
635
|
// VPN协议,用于创建安全的网络连接
|
|
608
636
|
].some((t) => r.startsWith(t));
|
|
609
637
|
}
|
|
610
|
-
function
|
|
638
|
+
function Zs(r) {
|
|
611
639
|
return new Promise((s, t) => {
|
|
612
640
|
if (typeof r != "string" || r.trim() === "" || !r.includes("://")) {
|
|
613
641
|
t(new Error("Invalid URL: Must be a non-empty string"));
|
|
@@ -642,11 +670,11 @@ const tt = class tt {
|
|
|
642
670
|
static check(s, t) {
|
|
643
671
|
if (!s || typeof s != "string")
|
|
644
672
|
return console.error("Invalid URL provided"), t ? !1 : "unknown";
|
|
645
|
-
const e =
|
|
673
|
+
const e = re(s).toLowerCase();
|
|
646
674
|
if (t) {
|
|
647
|
-
if (!
|
|
675
|
+
if (!ie.hasOwnProperty(t))
|
|
648
676
|
return console.error(`Unknown file type: ${t}`), "unknown";
|
|
649
|
-
const i =
|
|
677
|
+
const i = ie[t];
|
|
650
678
|
return tt._checkExtension(e, i);
|
|
651
679
|
}
|
|
652
680
|
return tt._detectFileType(e);
|
|
@@ -661,7 +689,7 @@ const tt = class tt {
|
|
|
661
689
|
*/
|
|
662
690
|
static parseAddresses(s) {
|
|
663
691
|
return !s || typeof s != "string" ? (console.error("Invalid URL provided"), []) : s.split(",").map((t) => {
|
|
664
|
-
const e =
|
|
692
|
+
const e = re(t), i = this.check(t);
|
|
665
693
|
return { url: t, name: e, type: i };
|
|
666
694
|
});
|
|
667
695
|
}
|
|
@@ -689,7 +717,7 @@ const tt = class tt {
|
|
|
689
717
|
* @returns {string} 标准化的MIME类型字符串,如果无法识别则返回原始输入
|
|
690
718
|
*/
|
|
691
719
|
static _normalizeType(s) {
|
|
692
|
-
return s.startsWith(".") && !s.includes("/") ?
|
|
720
|
+
return s.startsWith(".") && !s.includes("/") ? $e[s.toLowerCase()] || s : s.includes("/") ? s : `${s}/*`;
|
|
693
721
|
}
|
|
694
722
|
/**
|
|
695
723
|
* 检查URL是否具有任何指定的文件扩展名
|
|
@@ -713,13 +741,13 @@ const tt = class tt {
|
|
|
713
741
|
}
|
|
714
742
|
};
|
|
715
743
|
// 缓存文件扩展名的条目,以提高性能
|
|
716
|
-
d(tt, "cachedEntries", Object.entries(
|
|
717
|
-
let
|
|
718
|
-
const
|
|
744
|
+
d(tt, "cachedEntries", Object.entries(ie));
|
|
745
|
+
let xe = tt;
|
|
746
|
+
const Je = /\w*(?:\[\d+\])+|\w+/g, De = /^\w*(?:\[\d+\])+$/, Re = /\w+|(\[\d+\])/g, ke = /\[(\d+)\]/;
|
|
719
747
|
function Ve(r) {
|
|
720
|
-
return r ? r.match(
|
|
748
|
+
return r ? r.match(Je) || [] : [];
|
|
721
749
|
}
|
|
722
|
-
function
|
|
750
|
+
function Qs(r, s = 3e3) {
|
|
723
751
|
if (typeof r != "function")
|
|
724
752
|
return console.error("非函数:", r);
|
|
725
753
|
const t = window.requestIdleCallback, e = function(i) {
|
|
@@ -727,7 +755,7 @@ function qs(r, s = 3e3) {
|
|
|
727
755
|
};
|
|
728
756
|
t ? t(e, { timeout: s }) : requestAnimationFrame(() => r());
|
|
729
757
|
}
|
|
730
|
-
function
|
|
758
|
+
function Ke(r, s) {
|
|
731
759
|
const t = Date.now();
|
|
732
760
|
return new Promise((e, i) => {
|
|
733
761
|
const n = () => {
|
|
@@ -744,7 +772,7 @@ function pt(r, s, t = [], e = Date.now()) {
|
|
|
744
772
|
console.error("_MergeObjects 合并异常:疑似死循环");
|
|
745
773
|
return;
|
|
746
774
|
}
|
|
747
|
-
const i =
|
|
775
|
+
const i = oe(r), n = oe(s);
|
|
748
776
|
if (i != n) return s;
|
|
749
777
|
if (i == "object" || i == "array") {
|
|
750
778
|
if (t.some(([o, a]) => o == r && a == s)) return r;
|
|
@@ -772,13 +800,13 @@ function pt(r, s, t = [], e = Date.now()) {
|
|
|
772
800
|
}), r;
|
|
773
801
|
} else return s;
|
|
774
802
|
}
|
|
775
|
-
function
|
|
803
|
+
function ae(r = "") {
|
|
776
804
|
return r + "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(s) {
|
|
777
805
|
const t = Math.random() * 16 | 0;
|
|
778
806
|
return (s === "x" ? t : t & 3 | 8).toString(16);
|
|
779
807
|
});
|
|
780
808
|
}
|
|
781
|
-
function
|
|
809
|
+
function Oe(r, s) {
|
|
782
810
|
let t;
|
|
783
811
|
return function(...e) {
|
|
784
812
|
clearTimeout(t), t = setTimeout(() => {
|
|
@@ -786,7 +814,7 @@ function Re(r, s) {
|
|
|
786
814
|
}, s);
|
|
787
815
|
};
|
|
788
816
|
}
|
|
789
|
-
function
|
|
817
|
+
function Js(r, s) {
|
|
790
818
|
let t = -1 / 0;
|
|
791
819
|
return function(...e) {
|
|
792
820
|
const i = performance.now();
|
|
@@ -800,52 +828,52 @@ function $s(r, s) {
|
|
|
800
828
|
}
|
|
801
829
|
};
|
|
802
830
|
}
|
|
803
|
-
function
|
|
831
|
+
function Ks(r, s) {
|
|
804
832
|
if (!r || !s) return r;
|
|
805
833
|
const t = Ve(s);
|
|
806
834
|
return t.length ? t.reduce((e, i, n) => {
|
|
807
835
|
const o = n === t.length - 1;
|
|
808
|
-
if (
|
|
809
|
-
const a = i.match(
|
|
836
|
+
if (De.test(i)) {
|
|
837
|
+
const a = i.match(Re) || [];
|
|
810
838
|
return a.reduce((l, c, h) => {
|
|
811
839
|
if (/^\w+$/.test(c))
|
|
812
840
|
return l[c] || (h < a.length - 1 ? [] : {});
|
|
813
|
-
const u = c.match(
|
|
841
|
+
const u = c.match(ke), f = u ? parseInt(u[1], 10) : 0, m = h === a.length - 1;
|
|
814
842
|
return m && o ? l[f] : l[f] || (m ? {} : []);
|
|
815
843
|
}, e);
|
|
816
844
|
}
|
|
817
845
|
return o ? e[i] : e[i] || {};
|
|
818
846
|
}, r) : r;
|
|
819
847
|
}
|
|
820
|
-
function
|
|
848
|
+
function tn(r, s, t, e) {
|
|
821
849
|
if (!r || !s) return t;
|
|
822
850
|
const i = Ve(s);
|
|
823
851
|
return i.length ? i.reduce((n, o, a) => {
|
|
824
852
|
const l = a === i.length - 1;
|
|
825
|
-
if (
|
|
826
|
-
const c = o.match(
|
|
853
|
+
if (De.test(o)) {
|
|
854
|
+
const c = o.match(Re) || [];
|
|
827
855
|
return c.reduce((h, u, f) => {
|
|
828
856
|
const m = f === c.length - 1;
|
|
829
857
|
if (/^\w+$/.test(u))
|
|
830
858
|
return h.hasOwnProperty(u) || (h[u] = []), h[u];
|
|
831
|
-
const p = u.match(
|
|
859
|
+
const p = u.match(ke), g = p ? parseInt(p[1], 10) : 0, y = m && l;
|
|
832
860
|
return h.hasOwnProperty(g) ? y && !e && (h[g] = t) : h[g] = y ? t : m ? {} : [], h[g];
|
|
833
861
|
}, n);
|
|
834
862
|
}
|
|
835
863
|
return l ? ((!e || !n.hasOwnProperty(o)) && (n[o] = t), n[o]) : (n.hasOwnProperty(o) || (n[o] = {}), n[o]);
|
|
836
864
|
}, r) : t;
|
|
837
865
|
}
|
|
838
|
-
function
|
|
866
|
+
function en(r) {
|
|
839
867
|
return r.map((s, t) => r.slice(t).concat(r.slice(0, t)));
|
|
840
868
|
}
|
|
841
|
-
function
|
|
869
|
+
function ti(r) {
|
|
842
870
|
const s = window.structuredClone, t = (e, i = /* @__PURE__ */ new WeakMap()) => {
|
|
843
871
|
const n = e;
|
|
844
872
|
if (n === null || typeof n != "object")
|
|
845
873
|
return n;
|
|
846
874
|
if (i.has(n))
|
|
847
875
|
return i.get(n);
|
|
848
|
-
switch (
|
|
876
|
+
switch (oe(n)) {
|
|
849
877
|
case "array": {
|
|
850
878
|
const a = [];
|
|
851
879
|
i.set(n, a);
|
|
@@ -929,7 +957,7 @@ function Je(r) {
|
|
|
929
957
|
return console.warn("structuredClone error:", e), s && t(r);
|
|
930
958
|
}
|
|
931
959
|
}
|
|
932
|
-
function
|
|
960
|
+
function ei(r, s) {
|
|
933
961
|
const t = [
|
|
934
962
|
[11, "#d03050"],
|
|
935
963
|
[8, "#f0a020"],
|
|
@@ -961,7 +989,7 @@ function Ke(r, s) {
|
|
|
961
989
|
), f;
|
|
962
990
|
};
|
|
963
991
|
}
|
|
964
|
-
function
|
|
992
|
+
function sn(r) {
|
|
965
993
|
const s = Date.now();
|
|
966
994
|
let t = performance.now();
|
|
967
995
|
for (; Date.now() - s < r; ) {
|
|
@@ -974,7 +1002,193 @@ function Ks(r) {
|
|
|
974
1002
|
}
|
|
975
1003
|
return Date.now() - s;
|
|
976
1004
|
}
|
|
977
|
-
|
|
1005
|
+
var yt = /* @__PURE__ */ ((r) => (r.RESPONSE = "response", r.QUERY = "query", r))(yt || {});
|
|
1006
|
+
class nn {
|
|
1007
|
+
constructor(s, t) {
|
|
1008
|
+
/** 音效资源地址映射(preload 成功后对应项会替换为 blob: URL) */
|
|
1009
|
+
d(this, "soundSources");
|
|
1010
|
+
/** 各 key 下载任务,避免重复发起 */
|
|
1011
|
+
d(this, "preloadTasks", /* @__PURE__ */ new Map());
|
|
1012
|
+
this.soundSources = { ...s };
|
|
1013
|
+
const e = t == null ? void 0 : t.holdKeys;
|
|
1014
|
+
if (e != null && e.length)
|
|
1015
|
+
for (const i of e)
|
|
1016
|
+
this.fetchAndReplaceSource(i);
|
|
1017
|
+
}
|
|
1018
|
+
preload(s) {
|
|
1019
|
+
const t = Array.isArray(s) ? s : [s];
|
|
1020
|
+
return Promise.all(t.map((e) => this.fetchAndReplaceSource(e))).then(
|
|
1021
|
+
() => {
|
|
1022
|
+
}
|
|
1023
|
+
);
|
|
1024
|
+
}
|
|
1025
|
+
fetchAndReplaceSource(s) {
|
|
1026
|
+
const t = this.preloadTasks.get(s);
|
|
1027
|
+
if (t) return t;
|
|
1028
|
+
const e = this.soundSources[s];
|
|
1029
|
+
if (!e)
|
|
1030
|
+
return Promise.reject(new Error(`未找到对应音效资源: ${String(s)}`));
|
|
1031
|
+
if (e.startsWith("blob:")) {
|
|
1032
|
+
const n = Promise.resolve();
|
|
1033
|
+
return this.preloadTasks.set(s, n), n;
|
|
1034
|
+
}
|
|
1035
|
+
const i = fetch(e).then((n) => {
|
|
1036
|
+
if (!n.ok)
|
|
1037
|
+
throw new Error(`音效下载失败: ${n.status} ${e}`);
|
|
1038
|
+
return n.blob();
|
|
1039
|
+
}).then((n) => {
|
|
1040
|
+
const o = this.soundSources[s], a = URL.createObjectURL(n);
|
|
1041
|
+
this.soundSources[s] = a, o.startsWith("blob:") && o !== a && URL.revokeObjectURL(o);
|
|
1042
|
+
}).catch((n) => {
|
|
1043
|
+
throw this.preloadTasks.delete(s), n instanceof Error ? n : new Error(String(n));
|
|
1044
|
+
});
|
|
1045
|
+
return this.preloadTasks.set(s, i), i;
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* 根据 key 播放音效
|
|
1049
|
+
* @param key 资源 key
|
|
1050
|
+
* @param options 播放配置(循环等)
|
|
1051
|
+
*/
|
|
1052
|
+
play(s, t) {
|
|
1053
|
+
const e = this.soundSources[s];
|
|
1054
|
+
return e ? this.playUrl(e, t) : (console.warn(`未找到对应音效资源: ${String(s)}`), () => {
|
|
1055
|
+
});
|
|
1056
|
+
}
|
|
1057
|
+
/**
|
|
1058
|
+
* 根据 URL 播放音效
|
|
1059
|
+
* @param url 音频地址
|
|
1060
|
+
* @param options 播放配置(循环等)
|
|
1061
|
+
* @returns 停止播放的方法
|
|
1062
|
+
*/
|
|
1063
|
+
playUrl(s, t) {
|
|
1064
|
+
if (!s) {
|
|
1065
|
+
console.error("音效资源地址为空");
|
|
1066
|
+
return;
|
|
1067
|
+
}
|
|
1068
|
+
const e = new Audio(s), i = (t == null ? void 0 : t.loopCount) !== void 0 && t.loopCount > 0 ? t.loopCount : void 0, n = (t == null ? void 0 : t.loop) && i === void 0;
|
|
1069
|
+
let o = 0, a = !1;
|
|
1070
|
+
const l = () => {
|
|
1071
|
+
a || (a = !0, e.pause(), e.currentTime = 0, e.removeEventListener("ended", c), e.onerror = null);
|
|
1072
|
+
}, c = () => {
|
|
1073
|
+
if (!a) {
|
|
1074
|
+
if (n) {
|
|
1075
|
+
e.currentTime = 0, e.play().catch((h) => {
|
|
1076
|
+
console.warn("循环音效再次播放失败:", h), l();
|
|
1077
|
+
});
|
|
1078
|
+
return;
|
|
1079
|
+
}
|
|
1080
|
+
if (i !== void 0 && o + 1 < i) {
|
|
1081
|
+
o += 1, e.currentTime = 0, e.play().catch((h) => {
|
|
1082
|
+
console.warn("循环音效再次播放失败:", h), l();
|
|
1083
|
+
});
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
l();
|
|
1087
|
+
}
|
|
1088
|
+
};
|
|
1089
|
+
return e.addEventListener("ended", c), e.onerror = () => {
|
|
1090
|
+
a || (console.error(`音效资源加载失败: ${s}`), l());
|
|
1091
|
+
}, e.play().catch((h) => {
|
|
1092
|
+
a || (console.warn("音效播放失败(可能是自动播放策略限制):", h), l());
|
|
1093
|
+
}), l;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
function Pe(r, s) {
|
|
1097
|
+
for (const t of Object.keys(s))
|
|
1098
|
+
s[t] !== void 0 && (r[t] = s[t]);
|
|
1099
|
+
}
|
|
1100
|
+
class rn {
|
|
1101
|
+
constructor(s) {
|
|
1102
|
+
/** WebSocket地址 */
|
|
1103
|
+
d(this, "url");
|
|
1104
|
+
/** WebSocket实例 */
|
|
1105
|
+
d(this, "socket");
|
|
1106
|
+
/** 连接回调 */
|
|
1107
|
+
d(this, "onopen");
|
|
1108
|
+
/** 接收消息回调 */
|
|
1109
|
+
d(this, "onmessage");
|
|
1110
|
+
/** 错误回调 */
|
|
1111
|
+
d(this, "onerror");
|
|
1112
|
+
/** 关闭回调 */
|
|
1113
|
+
d(this, "onclose");
|
|
1114
|
+
/** ping 配置 */
|
|
1115
|
+
d(this, "pingConfig", {
|
|
1116
|
+
/** 是否启用 */
|
|
1117
|
+
enabled: !1,
|
|
1118
|
+
/** 间隔(毫秒) */
|
|
1119
|
+
interval: 1e3 * 30,
|
|
1120
|
+
/** 发送内容 */
|
|
1121
|
+
content: "ping"
|
|
1122
|
+
});
|
|
1123
|
+
/** ping 定时器 */
|
|
1124
|
+
d(this, "pingTimer");
|
|
1125
|
+
/** 重试配置 */
|
|
1126
|
+
d(this, "retryConfig", {
|
|
1127
|
+
/** 最大次数 */
|
|
1128
|
+
maxCount: 3,
|
|
1129
|
+
/** 当前次数 */
|
|
1130
|
+
currentCount: 0,
|
|
1131
|
+
/** 间隔(毫秒) */
|
|
1132
|
+
interval: 1e3
|
|
1133
|
+
});
|
|
1134
|
+
/** 发送信息 */
|
|
1135
|
+
d(this, "send", (s) => {
|
|
1136
|
+
var t;
|
|
1137
|
+
return this.ready ? ((t = this.socket) == null || t.send(s), !0) : !1;
|
|
1138
|
+
});
|
|
1139
|
+
if (!s) return;
|
|
1140
|
+
const { url: t, ping: e, maxRetryCount: i, retryInterval: n } = s;
|
|
1141
|
+
e !== void 0 && (typeof e == "boolean" ? this.pingConfig.enabled = e : Pe(this.pingConfig, e)), Pe(this.retryConfig, {
|
|
1142
|
+
maxCount: i,
|
|
1143
|
+
interval: n
|
|
1144
|
+
}), t && this.start(t);
|
|
1145
|
+
}
|
|
1146
|
+
/** 是否准备完毕 */
|
|
1147
|
+
get ready() {
|
|
1148
|
+
var s;
|
|
1149
|
+
return ((s = this.socket) == null ? void 0 : s.readyState) === WebSocket.OPEN;
|
|
1150
|
+
}
|
|
1151
|
+
/** 开始ping */
|
|
1152
|
+
startPing() {
|
|
1153
|
+
const { interval: s, content: t, enabled: e } = this.pingConfig;
|
|
1154
|
+
e && (this.pingTimer = setInterval(() => {
|
|
1155
|
+
var i;
|
|
1156
|
+
this.ready ? (i = this.socket) == null || i.send(t) : console.warn("WebSocket未就绪,无法发送ping");
|
|
1157
|
+
}, s));
|
|
1158
|
+
}
|
|
1159
|
+
/** 开始重试 */
|
|
1160
|
+
startRetry() {
|
|
1161
|
+
const { maxCount: s, interval: t, currentCount: e } = this.retryConfig;
|
|
1162
|
+
if (s <= e) {
|
|
1163
|
+
console.error("WebSocket重试次数已用完"), this.retryConfig.currentCount = 0;
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
this.retryConfig.currentCount++, setTimeout(() => this.start(this.url), t);
|
|
1167
|
+
}
|
|
1168
|
+
/** 开始 */
|
|
1169
|
+
start(s) {
|
|
1170
|
+
const t = new WebSocket(s);
|
|
1171
|
+
this.socket = t, this.url = s, t.onopen = (e) => {
|
|
1172
|
+
var i;
|
|
1173
|
+
console.log("WebSocket已连接"), this.startPing(), this.retryConfig.currentCount = 0, (i = this.onopen) == null || i.call(this, e);
|
|
1174
|
+
}, t.onmessage = (e) => {
|
|
1175
|
+
var i;
|
|
1176
|
+
(i = this.onmessage) == null || i.call(this, e);
|
|
1177
|
+
}, t.onerror = (e) => {
|
|
1178
|
+
var i;
|
|
1179
|
+
console.error("WebSocket错误:", e), clearInterval(this.pingTimer), this.startRetry(), (i = this.onerror) == null || i.call(this, e);
|
|
1180
|
+
}, t.onclose = (e) => {
|
|
1181
|
+
var i;
|
|
1182
|
+
console.log("WebSocket已关闭"), clearInterval(this.pingTimer), (i = this.onclose) == null || i.call(this, e);
|
|
1183
|
+
};
|
|
1184
|
+
}
|
|
1185
|
+
/** 停止 */
|
|
1186
|
+
stop() {
|
|
1187
|
+
var s;
|
|
1188
|
+
(s = this.socket) == null || s.close(), this.socket = void 0;
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
function on(r, s = 10) {
|
|
978
1192
|
let t = 0, e = s;
|
|
979
1193
|
function i() {
|
|
980
1194
|
if (e > 0)
|
|
@@ -988,7 +1202,7 @@ function tn(r, s = 10) {
|
|
|
988
1202
|
t = Date.now(), i();
|
|
989
1203
|
});
|
|
990
1204
|
}
|
|
991
|
-
function
|
|
1205
|
+
function an(r) {
|
|
992
1206
|
const s = () => Promise.resolve(), t = (a) => (console.error(a), Promise.reject(a));
|
|
993
1207
|
function e() {
|
|
994
1208
|
return navigator.clipboard.writeText(r).then(s).catch(t);
|
|
@@ -1015,8 +1229,8 @@ function en(r) {
|
|
|
1015
1229
|
}
|
|
1016
1230
|
return navigator.clipboard ? e().catch(o) : o();
|
|
1017
1231
|
}
|
|
1018
|
-
function
|
|
1019
|
-
const t =
|
|
1232
|
+
function ln(r, s) {
|
|
1233
|
+
const t = Me[r];
|
|
1020
1234
|
if (!t) return console.error(`未知纸张类型: ${r}`);
|
|
1021
1235
|
const { width: e, height: i } = t, n = (p) => p / 25.4, a = typeof window < "u" ? window.devicePixelRatio * 96 : 300, l = (p) => Math.round(n(p) * a), c = l(e), h = l(i), u = l(s), f = Math.max(0, c - 2 * u), m = Math.max(0, h - 2 * u);
|
|
1022
1236
|
return {
|
|
@@ -1052,13 +1266,13 @@ class It {
|
|
|
1052
1266
|
/** 处理BroadcastChannel消息 */
|
|
1053
1267
|
static handleChannelMessage(s) {
|
|
1054
1268
|
const { type: t, responseKey: e, name: i } = s.data;
|
|
1055
|
-
if (t ===
|
|
1269
|
+
if (t === yt.RESPONSE) {
|
|
1056
1270
|
const n = this.pendingQueries.get(e);
|
|
1057
1271
|
n == null || n.forEach((o) => o(i));
|
|
1058
|
-
} else if (t ===
|
|
1272
|
+
} else if (t === yt.QUERY) {
|
|
1059
1273
|
if (this.pendingQueries.has(e) || i != "*" && i != window.name) return;
|
|
1060
1274
|
const n = {
|
|
1061
|
-
type:
|
|
1275
|
+
type: yt.RESPONSE,
|
|
1062
1276
|
responseKey: e,
|
|
1063
1277
|
name: window.name
|
|
1064
1278
|
};
|
|
@@ -1074,16 +1288,16 @@ class It {
|
|
|
1074
1288
|
const o = "请先初始化标签页管理器";
|
|
1075
1289
|
return console.error(o), Promise.reject(o);
|
|
1076
1290
|
}
|
|
1077
|
-
const t =
|
|
1291
|
+
const t = ae();
|
|
1078
1292
|
let e = !1;
|
|
1079
1293
|
const i = this.pendingQueries.get(t) || [];
|
|
1080
1294
|
i.push(() => e = !0), this.pendingQueries.set(t, i);
|
|
1081
1295
|
const n = {
|
|
1082
|
-
type:
|
|
1296
|
+
type: yt.QUERY,
|
|
1083
1297
|
responseKey: t,
|
|
1084
1298
|
name: s
|
|
1085
1299
|
};
|
|
1086
|
-
return this.channel.postMessage(n),
|
|
1300
|
+
return this.channel.postMessage(n), Ke(() => e, this.timeout).finally(
|
|
1087
1301
|
() => this.pendingQueries.delete(t)
|
|
1088
1302
|
);
|
|
1089
1303
|
}
|
|
@@ -1105,10 +1319,10 @@ class It {
|
|
|
1105
1319
|
const n = "请先初始化标签页管理器";
|
|
1106
1320
|
return console.error(n), Promise.reject(n);
|
|
1107
1321
|
}
|
|
1108
|
-
const s =
|
|
1322
|
+
const s = ae(), t = [], e = this.pendingQueries.get(s) || [];
|
|
1109
1323
|
e.push((n) => t.push(n)), this.pendingQueries.set(s, e);
|
|
1110
1324
|
const i = {
|
|
1111
|
-
type:
|
|
1325
|
+
type: yt.QUERY,
|
|
1112
1326
|
responseKey: s,
|
|
1113
1327
|
name: "*"
|
|
1114
1328
|
};
|
|
@@ -1128,6 +1342,48 @@ d(It, "timeout", 150), /**
|
|
|
1128
1342
|
* @param callback 匹配标签页的回调函数
|
|
1129
1343
|
*/
|
|
1130
1344
|
d(It, "pendingQueries", /* @__PURE__ */ new Map());
|
|
1345
|
+
class cn {
|
|
1346
|
+
constructor() {
|
|
1347
|
+
/** 用户状态:active(活跃) / idle(闲置) */
|
|
1348
|
+
d(this, "status", "active");
|
|
1349
|
+
/** 活跃状态回调通知集合(key: 回调标识,value: 回调函数) */
|
|
1350
|
+
d(this, "activeCallbacks", /* @__PURE__ */ new Map());
|
|
1351
|
+
/** 闲置状态回调通知集合(key: 回调标识,value: 回调函数) */
|
|
1352
|
+
d(this, "idleCallbacks", /* @__PURE__ */ new Map());
|
|
1353
|
+
/** 闲置时间(分钟) */
|
|
1354
|
+
d(this, "idleTime", 5);
|
|
1355
|
+
/** 闲置判定定时器(5分钟无操作触发闲置状态) */
|
|
1356
|
+
d(this, "timeoutTimer");
|
|
1357
|
+
/**
|
|
1358
|
+
* 激活为活跃状态
|
|
1359
|
+
* 触发活跃回调,并重置定时器
|
|
1360
|
+
*/
|
|
1361
|
+
d(this, "activate", () => {
|
|
1362
|
+
this.status === "idle" && (this.status = "active", console.log(
|
|
1363
|
+
"%c已进入活跃状态",
|
|
1364
|
+
"background: #4CAF50; color: white; padding: 2px 4px; border-radius: 4px; font-weight: bold;"
|
|
1365
|
+
), this.activeCallbacks.forEach((s) => s())), this.resetTimeoutTimer();
|
|
1366
|
+
});
|
|
1367
|
+
/**
|
|
1368
|
+
* 标记为闲置状态
|
|
1369
|
+
* 触发闲置回调,并清除定时器
|
|
1370
|
+
*/
|
|
1371
|
+
d(this, "markAsIdle", () => {
|
|
1372
|
+
this.timeoutTimer && clearTimeout(this.timeoutTimer), this.status === "active" && (this.status = "idle", console.log(
|
|
1373
|
+
"%c已进入闲置状态",
|
|
1374
|
+
"background: #9E9E9E; color: white; padding: 2px 4px; border-radius: 4px; font-weight: bold;"
|
|
1375
|
+
), this.idleCallbacks.forEach((s) => s()));
|
|
1376
|
+
});
|
|
1377
|
+
window.addEventListener("keypress", this.activate), window.addEventListener("mousemove", this.activate), window.addEventListener("mousedown", this.activate), window.addEventListener("wheel", this.activate), this.resetTimeoutTimer();
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* 重置闲置判定定时器
|
|
1381
|
+
* 每次用户操作时重置,重新开始5分钟计时
|
|
1382
|
+
*/
|
|
1383
|
+
resetTimeoutTimer() {
|
|
1384
|
+
this.timeoutTimer && clearTimeout(this.timeoutTimer), this.timeoutTimer = setTimeout(this.markAsIdle, 1e3 * 60 * this.idleTime);
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1131
1387
|
/*!
|
|
1132
1388
|
* decimal.js v10.5.0
|
|
1133
1389
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
@@ -1135,7 +1391,7 @@ d(It, "pendingQueries", /* @__PURE__ */ new Map());
|
|
|
1135
1391
|
* Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
|
|
1136
1392
|
* MIT Licence
|
|
1137
1393
|
*/
|
|
1138
|
-
var
|
|
1394
|
+
var le = 9e15, ht = 1e9, ce = "0123456789abcdef", Wt = "2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058", jt = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789", he = {
|
|
1139
1395
|
// These values must be integers within the stated ranges (inclusive).
|
|
1140
1396
|
// Most of these values can be changed at run-time using the `Decimal.config` method.
|
|
1141
1397
|
// The maximum number of significant digits of the result of a calculation or base conversion.
|
|
@@ -1188,12 +1444,12 @@ var ae = 9e15, ht = 1e9, le = "0123456789abcdef", Yt = "2.3025850929940456840179
|
|
|
1188
1444
|
// -1 to -EXP_LIMIT
|
|
1189
1445
|
// The maximum exponent value, above which overflow to Infinity occurs.
|
|
1190
1446
|
// JavaScript numbers: 308 (1.7976931348623157e+308)
|
|
1191
|
-
maxE:
|
|
1447
|
+
maxE: le,
|
|
1192
1448
|
// 1 to EXP_LIMIT
|
|
1193
1449
|
// Whether to use cryptographically-secure random number generation, if available.
|
|
1194
1450
|
crypto: !1
|
|
1195
1451
|
// true/false
|
|
1196
|
-
},
|
|
1452
|
+
}, Ae, nt, _ = !0, Qt = "[DecimalError] ", ct = Qt + "Invalid argument: ", Te = Qt + "Precision limit exceeded", Le = Qt + "crypto unavailable", Ie = "[object Decimal]", F = Math.floor, L = Math.pow, ii = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i, si = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i, ni = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i, Ne = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i, $ = 1e7, S = 7, ri = 9007199254740991, oi = Wt.length - 1, ue = jt.length - 1, v = { toStringTag: Ie };
|
|
1197
1453
|
v.absoluteValue = v.abs = function() {
|
|
1198
1454
|
var r = new this.constructor(this);
|
|
1199
1455
|
return r.s < 0 && (r.s = 1), P(r);
|
|
@@ -1220,13 +1476,13 @@ v.comparedTo = v.cmp = function(r) {
|
|
|
1220
1476
|
};
|
|
1221
1477
|
v.cosine = v.cos = function() {
|
|
1222
1478
|
var r, s, t = this, e = t.constructor;
|
|
1223
|
-
return t.d ? t.d[0] ? (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t =
|
|
1479
|
+
return t.d ? t.d[0] ? (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = ai(e, Xe(e, t)), e.precision = r, e.rounding = s, P(nt == 2 || nt == 3 ? t.neg() : t, r, s, !0)) : new e(1) : new e(NaN);
|
|
1224
1480
|
};
|
|
1225
1481
|
v.cubeRoot = v.cbrt = function() {
|
|
1226
1482
|
var r, s, t, e, i, n, o, a, l, c, h = this, u = h.constructor;
|
|
1227
1483
|
if (!h.isFinite() || h.isZero()) return new u(h);
|
|
1228
|
-
for (_ = !1, n = h.s *
|
|
1229
|
-
if (a = e, l = a.times(a).times(a), c = l.plus(h), e =
|
|
1484
|
+
for (_ = !1, n = h.s * L(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 = L(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; ; )
|
|
1485
|
+
if (a = e, l = a.times(a).times(a), c = l.plus(h), e = k(c.plus(h).times(a), c.plus(l), o + 2, 1), N(a.d).slice(0, o) === (t = N(e.d)).slice(0, o))
|
|
1230
1486
|
if (t = t.slice(o - 3, o + 1), t == "9999" || !i && t == "4999") {
|
|
1231
1487
|
if (!i && (P(a, r + 1, 0), a.times(a).times(a).eq(h))) {
|
|
1232
1488
|
e = a;
|
|
@@ -1248,11 +1504,11 @@ v.decimalPlaces = v.dp = function() {
|
|
|
1248
1504
|
return t;
|
|
1249
1505
|
};
|
|
1250
1506
|
v.dividedBy = v.div = function(r) {
|
|
1251
|
-
return
|
|
1507
|
+
return k(this, new this.constructor(r));
|
|
1252
1508
|
};
|
|
1253
1509
|
v.dividedToIntegerBy = v.divToInt = function(r) {
|
|
1254
1510
|
var s = this, t = s.constructor;
|
|
1255
|
-
return P(
|
|
1511
|
+
return P(k(s, new t(r), 0, 1, 1), t.precision, t.rounding);
|
|
1256
1512
|
};
|
|
1257
1513
|
v.equals = v.eq = function(r) {
|
|
1258
1514
|
return this.cmp(r) === 0;
|
|
@@ -1271,7 +1527,7 @@ v.hyperbolicCosine = v.cosh = function() {
|
|
|
1271
1527
|
var r, s, t, e, i, n = this, o = n.constructor, a = new o(1);
|
|
1272
1528
|
if (!n.isFinite()) return new o(n.s ? 1 / 0 : NaN);
|
|
1273
1529
|
if (n.isZero()) return a;
|
|
1274
|
-
t = o.precision, e = o.rounding, o.precision = t + Math.max(n.e, n.sd()) + 4, o.rounding = 1, i = n.d.length, i < 32 ? (r = Math.ceil(i / 3), s = (1 /
|
|
1530
|
+
t = o.precision, e = o.rounding, o.precision = t + Math.max(n.e, n.sd()) + 4, o.rounding = 1, i = n.d.length, i < 32 ? (r = Math.ceil(i / 3), s = (1 / Kt(4, r)).toString()) : (r = 16, s = "2.3283064365386962890625e-10"), n = Mt(o, 1, n.times(s), new o(1), !0);
|
|
1275
1531
|
for (var l, c = r, h = new o(8); c--; )
|
|
1276
1532
|
l = n.times(n), n = a.minus(l.times(h.minus(l.times(h))));
|
|
1277
1533
|
return P(n, o.precision = t, o.rounding = e, !0);
|
|
@@ -1282,7 +1538,7 @@ v.hyperbolicSine = v.sinh = function() {
|
|
|
1282
1538
|
if (s = n.precision, t = n.rounding, n.precision = s + Math.max(i.e, i.sd()) + 4, n.rounding = 1, e = i.d.length, e < 3)
|
|
1283
1539
|
i = Mt(n, 2, i, i, !0);
|
|
1284
1540
|
else {
|
|
1285
|
-
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, i = i.times(1 /
|
|
1541
|
+
r = 1.4 * Math.sqrt(e), r = r > 16 ? 16 : r | 0, i = i.times(1 / Kt(5, r)), i = Mt(n, 2, i, i, !0);
|
|
1286
1542
|
for (var o, a = new n(5), l = new n(16), c = new n(20); r--; )
|
|
1287
1543
|
o = i.times(i), i = i.times(a.plus(o.times(l.times(o).plus(c))));
|
|
1288
1544
|
}
|
|
@@ -1290,7 +1546,7 @@ v.hyperbolicSine = v.sinh = function() {
|
|
|
1290
1546
|
};
|
|
1291
1547
|
v.hyperbolicTangent = v.tanh = function() {
|
|
1292
1548
|
var r, s, t = this, e = t.constructor;
|
|
1293
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 7, e.rounding = 1,
|
|
1549
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 7, e.rounding = 1, k(t.sinh(), t.cosh(), e.precision = r, e.rounding = s)) : new e(t.s);
|
|
1294
1550
|
};
|
|
1295
1551
|
v.inverseCosine = v.acos = function() {
|
|
1296
1552
|
var r = this, s = r.constructor, t = r.abs().cmp(1), e = s.precision, i = s.rounding;
|
|
@@ -1306,7 +1562,7 @@ v.inverseHyperbolicSine = v.asinh = function() {
|
|
|
1306
1562
|
};
|
|
1307
1563
|
v.inverseHyperbolicTangent = v.atanh = function() {
|
|
1308
1564
|
var r, s, t, e, i = this, n = i.constructor;
|
|
1309
|
-
return i.isFinite() ? i.e >= 0 ? new n(i.abs().eq(1) ? i.s / 0 : i.isZero() ? i : NaN) : (r = n.precision, s = n.rounding, e = i.sd(), Math.max(e, r) < 2 * -i.e - 1 ? P(new n(i), r, s, !0) : (n.precision = t = e - i.e, i =
|
|
1565
|
+
return i.isFinite() ? i.e >= 0 ? new n(i.abs().eq(1) ? i.s / 0 : i.isZero() ? i : NaN) : (r = n.precision, s = n.rounding, e = i.sd(), Math.max(e, r) < 2 * -i.e - 1 ? P(new n(i), r, s, !0) : (n.precision = t = e - i.e, i = k(i.plus(1), new n(1).minus(i), t + r, 1), n.precision = r + 4, n.rounding = 1, i = i.ln(), n.precision = r, n.rounding = s, i.times(0.5))) : new n(NaN);
|
|
1310
1566
|
};
|
|
1311
1567
|
v.inverseSine = v.asin = function() {
|
|
1312
1568
|
var r, s, t, e, i = this, n = i.constructor;
|
|
@@ -1317,11 +1573,11 @@ v.inverseTangent = v.atan = function() {
|
|
|
1317
1573
|
if (c.isFinite()) {
|
|
1318
1574
|
if (c.isZero())
|
|
1319
1575
|
return new h(c);
|
|
1320
|
-
if (c.abs().eq(1) && u + 4 <=
|
|
1576
|
+
if (c.abs().eq(1) && u + 4 <= ue)
|
|
1321
1577
|
return o = J(h, u + 4, f).times(0.25), o.s = c.s, o;
|
|
1322
1578
|
} else {
|
|
1323
1579
|
if (!c.s) return new h(NaN);
|
|
1324
|
-
if (u + 4 <=
|
|
1580
|
+
if (u + 4 <= ue)
|
|
1325
1581
|
return o = J(h, u + 4, f).times(0.5), o.s = c.s, o;
|
|
1326
1582
|
}
|
|
1327
1583
|
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));
|
|
@@ -1370,13 +1626,13 @@ v.logarithm = v.log = function(r) {
|
|
|
1370
1626
|
for (i = t[0]; i % 10 === 0; ) i /= 10;
|
|
1371
1627
|
n = i !== 1;
|
|
1372
1628
|
}
|
|
1373
|
-
if (_ = !1, a = u + m, o = at(c, a), e = s ?
|
|
1629
|
+
if (_ = !1, a = u + m, o = at(c, a), e = s ? qt(h, a + 10) : at(r, a), l = k(o, e, a, 1), kt(l.d, i = u, f))
|
|
1374
1630
|
do
|
|
1375
|
-
if (a += 10, o = at(c, a), e = s ?
|
|
1376
|
-
+
|
|
1631
|
+
if (a += 10, o = at(c, a), e = s ? qt(h, a + 10) : at(r, a), l = k(o, e, a, 1), !n) {
|
|
1632
|
+
+N(l.d).slice(i + 1, i + 15) + 1 == 1e14 && (l = P(l, u + 1, 0));
|
|
1377
1633
|
break;
|
|
1378
1634
|
}
|
|
1379
|
-
while (
|
|
1635
|
+
while (kt(l.d, i += 10, f));
|
|
1380
1636
|
return _ = !0, P(l, u, f);
|
|
1381
1637
|
};
|
|
1382
1638
|
v.minus = v.sub = function(r) {
|
|
@@ -1412,14 +1668,14 @@ v.minus = v.sub = function(r) {
|
|
|
1412
1668
|
}
|
|
1413
1669
|
for (; c[--o] === 0; ) c.pop();
|
|
1414
1670
|
for (; c[0] === 0; c.shift()) --t;
|
|
1415
|
-
return c[0] ? (r.d = c, r.e =
|
|
1671
|
+
return c[0] ? (r.d = c, r.e = Jt(c, t), _ ? P(r, a, l) : r) : new p(l === 3 ? -0 : 0);
|
|
1416
1672
|
};
|
|
1417
1673
|
v.modulo = v.mod = function(r) {
|
|
1418
1674
|
var s, t = this, e = t.constructor;
|
|
1419
|
-
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? P(new e(t), e.precision, e.rounding) : (_ = !1, e.modulo == 9 ? (s =
|
|
1675
|
+
return r = new e(r), !t.d || !r.s || r.d && !r.d[0] ? new e(NaN) : !r.d || t.d && !t.d[0] ? P(new e(t), e.precision, e.rounding) : (_ = !1, e.modulo == 9 ? (s = k(t, r.abs(), 0, 3, 1), s.s *= r.s) : s = k(t, r, 0, e.modulo, 1), s = s.times(r), _ = !0, t.minus(s));
|
|
1420
1676
|
};
|
|
1421
1677
|
v.naturalExponential = v.exp = function() {
|
|
1422
|
-
return
|
|
1678
|
+
return de(this);
|
|
1423
1679
|
};
|
|
1424
1680
|
v.naturalLogarithm = v.ln = function() {
|
|
1425
1681
|
return at(this);
|
|
@@ -1443,12 +1699,12 @@ v.plus = v.add = function(r) {
|
|
|
1443
1699
|
for (o = c.length, i = h.length, o - i < 0 && (i = o, t = h, h = c, c = t), s = 0; i; )
|
|
1444
1700
|
s = (c[--i] = c[i] + h[i] + s) / $ | 0, c[i] %= $;
|
|
1445
1701
|
for (s && (c.unshift(s), ++e), o = c.length; c[--o] == 0; ) c.pop();
|
|
1446
|
-
return r.d = c, r.e =
|
|
1702
|
+
return r.d = c, r.e = Jt(c, e), _ ? P(r, a, l) : r;
|
|
1447
1703
|
};
|
|
1448
1704
|
v.precision = v.sd = function(r) {
|
|
1449
1705
|
var s, t = this;
|
|
1450
1706
|
if (r !== void 0 && r !== !!r && r !== 1 && r !== 0) throw Error(ct + r);
|
|
1451
|
-
return t.d ? (s =
|
|
1707
|
+
return t.d ? (s = He(t.d), r && t.e + 1 > s && (s = t.e + 1)) : s = NaN, s;
|
|
1452
1708
|
};
|
|
1453
1709
|
v.round = function() {
|
|
1454
1710
|
var r = this, s = r.constructor;
|
|
@@ -1456,14 +1712,14 @@ v.round = function() {
|
|
|
1456
1712
|
};
|
|
1457
1713
|
v.sine = v.sin = function() {
|
|
1458
1714
|
var r, s, t = this, e = t.constructor;
|
|
1459
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t =
|
|
1715
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + Math.max(t.e, t.sd()) + S, e.rounding = 1, t = ci(e, Xe(e, t)), e.precision = r, e.rounding = s, P(nt > 2 ? t.neg() : t, r, s, !0)) : new e(NaN);
|
|
1460
1716
|
};
|
|
1461
1717
|
v.squareRoot = v.sqrt = function() {
|
|
1462
1718
|
var r, s, t, e, i, n, o = this, a = o.d, l = o.e, c = o.s, h = o.constructor;
|
|
1463
1719
|
if (c !== 1 || !a || !a[0])
|
|
1464
1720
|
return new h(!c || c < 0 && (!a || a[0]) ? NaN : a ? o : 1 / 0);
|
|
1465
|
-
for (_ = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (s =
|
|
1466
|
-
if (n = e, e = n.plus(
|
|
1721
|
+
for (_ = !1, c = Math.sqrt(+o), c == 0 || c == 1 / 0 ? (s = N(a), (s.length + l) % 2 == 0 && (s += "0"), c = Math.sqrt(s), l = F((l + 1) / 2) - (l < 0 || l % 2), c == 1 / 0 ? s = "5e" + l : (s = c.toExponential(), s = s.slice(0, s.indexOf("e") + 1) + l), e = new h(s)) : e = new h(c.toString()), t = (l = h.precision) + 3; ; )
|
|
1722
|
+
if (n = e, e = n.plus(k(o, n, t + 2, 1)).times(0.5), N(n.d).slice(0, t) === (s = N(e.d)).slice(0, t))
|
|
1467
1723
|
if (s = s.slice(t - 3, t + 1), s == "9999" || !i && s == "4999") {
|
|
1468
1724
|
if (!i && (P(n, l + 1, 0), n.times(n).eq(o))) {
|
|
1469
1725
|
e = n;
|
|
@@ -1478,7 +1734,7 @@ v.squareRoot = v.sqrt = function() {
|
|
|
1478
1734
|
};
|
|
1479
1735
|
v.tangent = v.tan = function() {
|
|
1480
1736
|
var r, s, t = this, e = t.constructor;
|
|
1481
|
-
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 10, e.rounding = 1, t = t.sin(), t.s = 1, t =
|
|
1737
|
+
return t.isFinite() ? t.isZero() ? new e(t) : (r = e.precision, s = e.rounding, e.precision = r + 10, e.rounding = 1, t = t.sin(), t.s = 1, t = k(t, new e(1).minus(t.times(t)).sqrt(), r + 10, 0), e.precision = r, e.rounding = s, P(nt == 2 || nt == 4 ? t.neg() : t, r, s, !0)) : new e(NaN);
|
|
1482
1738
|
};
|
|
1483
1739
|
v.times = v.mul = function(r) {
|
|
1484
1740
|
var s, t, e, i, n, o, a, l, c, h = this, u = h.constructor, f = h.d, m = (r = new u(r)).d;
|
|
@@ -1491,38 +1747,38 @@ v.times = v.mul = function(r) {
|
|
|
1491
1747
|
n[i] = (n[i] + s) % $ | 0;
|
|
1492
1748
|
}
|
|
1493
1749
|
for (; !n[--o]; ) n.pop();
|
|
1494
|
-
return s ? ++t : n.shift(), r.d = n, r.e =
|
|
1750
|
+
return s ? ++t : n.shift(), r.d = n, r.e = Jt(n, t), _ ? P(r, u.precision, u.rounding) : r;
|
|
1495
1751
|
};
|
|
1496
1752
|
v.toBinary = function(r, s) {
|
|
1497
|
-
return
|
|
1753
|
+
return pe(this, 2, r, s);
|
|
1498
1754
|
};
|
|
1499
1755
|
v.toDecimalPlaces = v.toDP = function(r, s) {
|
|
1500
1756
|
var t = this, e = t.constructor;
|
|
1501
|
-
return t = new e(t), r === void 0 ? t : (
|
|
1757
|
+
return t = new e(t), r === void 0 ? t : (X(r, 0, ht), s === void 0 ? s = e.rounding : X(s, 0, 8), P(t, r + t.e + 1, s));
|
|
1502
1758
|
};
|
|
1503
1759
|
v.toExponential = function(r, s) {
|
|
1504
1760
|
var t, e = this, i = e.constructor;
|
|
1505
|
-
return r === void 0 ? t = K(e, !0) : (
|
|
1761
|
+
return r === void 0 ? t = K(e, !0) : (X(r, 0, ht), s === void 0 ? s = i.rounding : X(s, 0, 8), e = P(new i(e), r + 1, s), t = K(e, !0, r + 1)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
1506
1762
|
};
|
|
1507
1763
|
v.toFixed = function(r, s) {
|
|
1508
1764
|
var t, e, i = this, n = i.constructor;
|
|
1509
|
-
return r === void 0 ? t = K(i) : (
|
|
1765
|
+
return r === void 0 ? t = K(i) : (X(r, 0, ht), s === void 0 ? s = n.rounding : X(s, 0, 8), e = P(new n(i), r + i.e + 1, s), t = K(e, !1, r + e.e + 1)), i.isNeg() && !i.isZero() ? "-" + t : t;
|
|
1510
1766
|
};
|
|
1511
1767
|
v.toFraction = function(r) {
|
|
1512
1768
|
var s, t, e, i, n, o, a, l, c, h, u, f, m = this, p = m.d, g = m.constructor;
|
|
1513
1769
|
if (!p) return new g(m);
|
|
1514
|
-
if (c = t = new g(1), e = l = new g(0), s = new g(e), n = s.e =
|
|
1770
|
+
if (c = t = new g(1), e = l = new g(0), s = new g(e), n = s.e = He(p) - m.e - 1, o = n % S, s.d[0] = L(10, o < 0 ? S + o : o), r == null)
|
|
1515
1771
|
r = n > 0 ? s : c;
|
|
1516
1772
|
else {
|
|
1517
1773
|
if (a = new g(r), !a.isInt() || a.lt(c)) throw Error(ct + a);
|
|
1518
1774
|
r = a.gt(s) ? n > 0 ? s : c : a;
|
|
1519
1775
|
}
|
|
1520
|
-
for (_ = !1, a = new g(
|
|
1776
|
+
for (_ = !1, a = new g(N(p)), h = g.precision, g.precision = n = p.length * S * 2; u = k(a, s, 0, 1, 1), i = t.plus(u.times(e)), i.cmp(r) != 1; )
|
|
1521
1777
|
t = e, e = i, i = c, c = l.plus(u.times(i)), l = i, i = s, s = a.minus(u.times(i)), a = i;
|
|
1522
|
-
return i =
|
|
1778
|
+
return i = k(r.minus(t), e, 0, 1, 1), l = l.plus(i.times(c)), t = t.plus(i.times(e)), l.s = c.s = m.s, f = k(c, e, n, 1).minus(m).abs().cmp(k(l, t, n, 1).minus(m).abs()) < 1 ? [c, e] : [l, t], g.precision = h, _ = !0, f;
|
|
1523
1779
|
};
|
|
1524
1780
|
v.toHexadecimal = v.toHex = function(r, s) {
|
|
1525
|
-
return
|
|
1781
|
+
return pe(this, 16, r, s);
|
|
1526
1782
|
};
|
|
1527
1783
|
v.toNearest = function(r, s) {
|
|
1528
1784
|
var t = this, e = t.constructor;
|
|
@@ -1530,39 +1786,39 @@ v.toNearest = function(r, s) {
|
|
|
1530
1786
|
if (!t.d) return t;
|
|
1531
1787
|
r = new e(1), s = e.rounding;
|
|
1532
1788
|
} else {
|
|
1533
|
-
if (r = new e(r), s === void 0 ? s = e.rounding :
|
|
1789
|
+
if (r = new e(r), s === void 0 ? s = e.rounding : X(s, 0, 8), !t.d) return r.s ? t : r;
|
|
1534
1790
|
if (!r.d)
|
|
1535
1791
|
return r.s && (r.s = t.s), r;
|
|
1536
1792
|
}
|
|
1537
|
-
return r.d[0] ? (_ = !1, t =
|
|
1793
|
+
return r.d[0] ? (_ = !1, t = k(t, r, 0, s, 1).times(r), _ = !0, P(t)) : (r.s = t.s, t = r), t;
|
|
1538
1794
|
};
|
|
1539
1795
|
v.toNumber = function() {
|
|
1540
1796
|
return +this;
|
|
1541
1797
|
};
|
|
1542
1798
|
v.toOctal = function(r, s) {
|
|
1543
|
-
return
|
|
1799
|
+
return pe(this, 8, r, s);
|
|
1544
1800
|
};
|
|
1545
1801
|
v.toPower = v.pow = function(r) {
|
|
1546
1802
|
var s, t, e, i, n, o, a = this, l = a.constructor, c = +(r = new l(r));
|
|
1547
|
-
if (!a.d || !r.d || !a.d[0] || !r.d[0]) return new l(
|
|
1803
|
+
if (!a.d || !r.d || !a.d[0] || !r.d[0]) return new l(L(+a, c));
|
|
1548
1804
|
if (a = new l(a), a.eq(1)) return a;
|
|
1549
1805
|
if (e = l.precision, n = l.rounding, r.eq(1)) return P(a, e, n);
|
|
1550
|
-
if (s = F(r.e / S), s >= r.d.length - 1 && (t = c < 0 ? -c : c) <=
|
|
1551
|
-
return i =
|
|
1806
|
+
if (s = F(r.e / S), s >= r.d.length - 1 && (t = c < 0 ? -c : c) <= ri)
|
|
1807
|
+
return i = Fe(l, a, t, e), r.s < 0 ? new l(1).div(i) : P(i, e, n);
|
|
1552
1808
|
if (o = a.s, o < 0) {
|
|
1553
1809
|
if (s < r.d.length - 1) return new l(NaN);
|
|
1554
1810
|
if (r.d[s] & 1 || (o = 1), a.e == 0 && a.d[0] == 1 && a.d.length == 1)
|
|
1555
1811
|
return a.s = o, a;
|
|
1556
1812
|
}
|
|
1557
|
-
return t =
|
|
1813
|
+
return t = L(+a, c), s = t == 0 || !isFinite(t) ? F(c * (Math.log("0." + N(a.d)) / Math.LN10 + a.e + 1)) : new l(t + "").e, s > l.maxE + 1 || s < l.minE - 1 ? new l(s > 0 ? o / 0 : 0) : (_ = !1, l.rounding = a.s = 1, t = Math.min(12, (s + "").length), i = de(r.times(at(a, e + t)), e), i.d && (i = P(i, e + 5, 1), kt(i.d, e, n) && (s = e + 10, i = P(de(r.times(at(a, s + t)), s), s + 5, 1), +N(i.d).slice(e + 1, e + 15) + 1 == 1e14 && (i = P(i, e + 1, 0)))), i.s = o, _ = !0, l.rounding = n, P(i, e, n));
|
|
1558
1814
|
};
|
|
1559
1815
|
v.toPrecision = function(r, s) {
|
|
1560
1816
|
var t, e = this, i = e.constructor;
|
|
1561
|
-
return r === void 0 ? t = K(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (
|
|
1817
|
+
return r === void 0 ? t = K(e, e.e <= i.toExpNeg || e.e >= i.toExpPos) : (X(r, 1, ht), s === void 0 ? s = i.rounding : X(s, 0, 8), e = P(new i(e), r, s), t = K(e, r <= e.e || e.e <= i.toExpNeg, r)), e.isNeg() && !e.isZero() ? "-" + t : t;
|
|
1562
1818
|
};
|
|
1563
1819
|
v.toSignificantDigits = v.toSD = function(r, s) {
|
|
1564
1820
|
var t = this, e = t.constructor;
|
|
1565
|
-
return r === void 0 ? (r = e.precision, s = e.rounding) : (
|
|
1821
|
+
return r === void 0 ? (r = e.precision, s = e.rounding) : (X(r, 1, ht), s === void 0 ? s = e.rounding : X(s, 0, 8)), P(new e(t), r, s);
|
|
1566
1822
|
};
|
|
1567
1823
|
v.toString = function() {
|
|
1568
1824
|
var r = this, s = r.constructor, t = K(r, r.e <= s.toExpNeg || r.e >= s.toExpPos);
|
|
@@ -1575,7 +1831,7 @@ v.valueOf = v.toJSON = function() {
|
|
|
1575
1831
|
var r = this, s = r.constructor, t = K(r, r.e <= s.toExpNeg || r.e >= s.toExpPos);
|
|
1576
1832
|
return r.isNeg() ? "-" + t : t;
|
|
1577
1833
|
};
|
|
1578
|
-
function
|
|
1834
|
+
function N(r) {
|
|
1579
1835
|
var s, t, e, i = r.length - 1, n = "", o = r[0];
|
|
1580
1836
|
if (i > 0) {
|
|
1581
1837
|
for (n += o, s = 1; s < i; s++)
|
|
@@ -1586,34 +1842,34 @@ function T(r) {
|
|
|
1586
1842
|
for (; o % 10 === 0; ) o /= 10;
|
|
1587
1843
|
return n + o;
|
|
1588
1844
|
}
|
|
1589
|
-
function
|
|
1845
|
+
function X(r, s, t) {
|
|
1590
1846
|
if (r !== ~~r || r < s || r > t)
|
|
1591
1847
|
throw Error(ct + r);
|
|
1592
1848
|
}
|
|
1593
|
-
function
|
|
1849
|
+
function kt(r, s, t, e) {
|
|
1594
1850
|
var i, n, o, a;
|
|
1595
1851
|
for (n = r[0]; n >= 10; n /= 10) --s;
|
|
1596
|
-
return --s < 0 ? (s += S, i = 0) : (i = Math.ceil((s + 1) / S), s %= S), n =
|
|
1852
|
+
return --s < 0 ? (s += S, i = 0) : (i = Math.ceil((s + 1) / S), s %= S), n = L(10, S - s), a = r[i] % n | 0, e == null ? s < 3 ? (s == 0 ? a = a / 100 | 0 : s == 1 && (a = a / 10 | 0), o = t < 4 && a == 99999 || t > 3 && a == 49999 || a == 5e4 || a == 0) : o = (t < 4 && a + 1 == n || t > 3 && a + 1 == n / 2) && (r[i + 1] / n / 100 | 0) == L(10, s - 2) - 1 || (a == n / 2 || a == 0) && (r[i + 1] / n / 100 | 0) == 0 : s < 4 ? (s == 0 ? a = a / 1e3 | 0 : s == 1 ? a = a / 100 | 0 : s == 2 && (a = a / 10 | 0), o = (e || t < 4) && a == 9999 || !e && t > 3 && a == 4999) : o = ((e || t < 4) && a + 1 == n || !e && t > 3 && a + 1 == n / 2) && (r[i + 1] / n / 1e3 | 0) == L(10, s - 3) - 1, o;
|
|
1597
1853
|
}
|
|
1598
|
-
function
|
|
1854
|
+
function Ht(r, s, t) {
|
|
1599
1855
|
for (var e, i = [0], n, o = 0, a = r.length; o < a; ) {
|
|
1600
1856
|
for (n = i.length; n--; ) i[n] *= s;
|
|
1601
|
-
for (i[0] +=
|
|
1857
|
+
for (i[0] += ce.indexOf(r.charAt(o++)), e = 0; e < i.length; e++)
|
|
1602
1858
|
i[e] > t - 1 && (i[e + 1] === void 0 && (i[e + 1] = 0), i[e + 1] += i[e] / t | 0, i[e] %= t);
|
|
1603
1859
|
}
|
|
1604
1860
|
return i.reverse();
|
|
1605
1861
|
}
|
|
1606
|
-
function
|
|
1862
|
+
function ai(r, s) {
|
|
1607
1863
|
var t, e, i;
|
|
1608
1864
|
if (s.isZero()) return s;
|
|
1609
|
-
e = s.d.length, e < 32 ? (t = Math.ceil(e / 3), i = (1 /
|
|
1865
|
+
e = s.d.length, e < 32 ? (t = Math.ceil(e / 3), i = (1 / Kt(4, t)).toString()) : (t = 16, i = "2.3283064365386962890625e-10"), r.precision += t, s = Mt(r, 1, s.times(i), new r(1));
|
|
1610
1866
|
for (var n = t; n--; ) {
|
|
1611
1867
|
var o = s.times(s);
|
|
1612
1868
|
s = o.times(o).minus(o).times(8).plus(1);
|
|
1613
1869
|
}
|
|
1614
1870
|
return r.precision -= t, s;
|
|
1615
1871
|
}
|
|
1616
|
-
var
|
|
1872
|
+
var k = /* @__PURE__ */ function() {
|
|
1617
1873
|
function r(e, i, n) {
|
|
1618
1874
|
var o, a = 0, l = e.length;
|
|
1619
1875
|
for (e = e.slice(); l--; )
|
|
@@ -1638,35 +1894,35 @@ var R = /* @__PURE__ */ function() {
|
|
|
1638
1894
|
for (; !e[0] && e.length > 1; ) e.shift();
|
|
1639
1895
|
}
|
|
1640
1896
|
return function(e, i, n, o, a, l) {
|
|
1641
|
-
var c, h, u, f, m, p, g, y, w, b, C,
|
|
1642
|
-
if (!H || !H[0] || !
|
|
1643
|
-
return new
|
|
1897
|
+
var c, h, u, f, m, p, g, y, w, b, C, E, A, G, Ot, ut, rt, vt, z, At, Tt = e.constructor, ee = e.s == i.s ? 1 : -1, H = e.d, V = i.d;
|
|
1898
|
+
if (!H || !H[0] || !V || !V[0])
|
|
1899
|
+
return new Tt(
|
|
1644
1900
|
// Return NaN if either NaN, or both Infinity or 0.
|
|
1645
|
-
!e.s || !i.s || (H ?
|
|
1901
|
+
!e.s || !i.s || (H ? V && H[0] == V[0] : !V) ? NaN : (
|
|
1646
1902
|
// Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
|
|
1647
|
-
H && H[0] == 0 || !
|
|
1903
|
+
H && H[0] == 0 || !V ? ee * 0 : ee / 0
|
|
1648
1904
|
)
|
|
1649
1905
|
);
|
|
1650
|
-
for (l ? (m = 1, h = e.e - i.e) : (l = $, m = S, h = F(e.e / m) - F(i.e / m)), z =
|
|
1651
|
-
if (
|
|
1906
|
+
for (l ? (m = 1, h = e.e - i.e) : (l = $, m = S, h = F(e.e / m) - F(i.e / m)), z = V.length, rt = H.length, w = new Tt(ee), b = w.d = [], u = 0; V[u] == (H[u] || 0); u++) ;
|
|
1907
|
+
if (V[u] > (H[u] || 0) && h--, n == null ? (G = n = Tt.precision, o = Tt.rounding) : a ? G = n + (e.e - i.e) + 1 : G = n, G < 0)
|
|
1652
1908
|
b.push(1), p = !0;
|
|
1653
1909
|
else {
|
|
1654
|
-
if (
|
|
1655
|
-
for (f = 0,
|
|
1656
|
-
|
|
1910
|
+
if (G = G / m + 2 | 0, u = 0, z == 1) {
|
|
1911
|
+
for (f = 0, V = V[0], G++; (u < rt || f) && G--; u++)
|
|
1912
|
+
Ot = f * l + (H[u] || 0), b[u] = Ot / V | 0, f = Ot % V | 0;
|
|
1657
1913
|
p = f || u < rt;
|
|
1658
1914
|
} else {
|
|
1659
|
-
for (f = l / (
|
|
1660
|
-
|
|
1915
|
+
for (f = l / (V[0] + 1) | 0, f > 1 && (V = r(V, f, l), H = r(H, f, l), z = V.length, rt = H.length), ut = z, C = H.slice(0, z), E = C.length; E < z; ) C[E++] = 0;
|
|
1916
|
+
At = V.slice(), At.unshift(0), vt = V[0], V[1] >= l / 2 && ++vt;
|
|
1661
1917
|
do
|
|
1662
|
-
f = 0, c = s(
|
|
1663
|
-
while ((ut++ < rt || C[0] !== void 0) &&
|
|
1918
|
+
f = 0, c = s(V, C, z, E), c < 0 ? (A = C[0], z != E && (A = A * l + (C[1] || 0)), f = A / vt | 0, f > 1 ? (f >= l && (f = l - 1), g = r(V, f, l), y = g.length, E = C.length, c = s(g, C, y, E), c == 1 && (f--, t(g, z < y ? At : V, y, l))) : (f == 0 && (c = f = 1), g = V.slice()), y = g.length, y < E && g.unshift(0), t(C, g, E, l), c == -1 && (E = C.length, c = s(V, C, z, E), c < 1 && (f++, t(C, z < E ? At : V, E, l))), E = C.length) : c === 0 && (f++, C = [0]), b[u++] = f, c && C[0] ? C[E++] = H[ut] || 0 : (C = [H[ut]], E = 1);
|
|
1919
|
+
while ((ut++ < rt || C[0] !== void 0) && G--);
|
|
1664
1920
|
p = C[0] !== void 0;
|
|
1665
1921
|
}
|
|
1666
1922
|
b[0] || b.shift();
|
|
1667
1923
|
}
|
|
1668
1924
|
if (m == 1)
|
|
1669
|
-
w.e = h,
|
|
1925
|
+
w.e = h, Ae = p;
|
|
1670
1926
|
else {
|
|
1671
1927
|
for (u = 1, f = b[0]; f >= 10; f /= 10) u++;
|
|
1672
1928
|
w.e = u + h * m - 1, P(w, a ? n + w.e + 1 : n, o, p);
|
|
@@ -1680,7 +1936,7 @@ function P(r, s, t, e) {
|
|
|
1680
1936
|
if (u = r.d, !u) return r;
|
|
1681
1937
|
for (i = 1, a = u[0]; a >= 10; a /= 10) i++;
|
|
1682
1938
|
if (n = s - i, n < 0)
|
|
1683
|
-
n += S, o = s, h = u[f = 0], l = h /
|
|
1939
|
+
n += S, o = s, h = u[f = 0], l = h / L(10, i - o - 1) % 10 | 0;
|
|
1684
1940
|
else if (f = Math.ceil((n + 1) / S), a = u.length, f >= a)
|
|
1685
1941
|
if (e) {
|
|
1686
1942
|
for (; a++ <= f; ) u.push(0);
|
|
@@ -1689,12 +1945,12 @@ function P(r, s, t, e) {
|
|
|
1689
1945
|
break t;
|
|
1690
1946
|
else {
|
|
1691
1947
|
for (h = a = u[f], i = 1; a >= 10; a /= 10) i++;
|
|
1692
|
-
n %= S, o = n - S + i, l = o < 0 ? 0 : h /
|
|
1948
|
+
n %= S, o = n - S + i, l = o < 0 ? 0 : h / L(10, i - o - 1) % 10 | 0;
|
|
1693
1949
|
}
|
|
1694
|
-
if (e = e || s < 0 || u[f + 1] !== void 0 || (o < 0 ? h : h %
|
|
1695
|
-
(n > 0 ? o > 0 ? h /
|
|
1696
|
-
return u.length = 0, c ? (s -= r.e + 1, u[0] =
|
|
1697
|
-
if (n == 0 ? (u.length = f, a = 1, f--) : (u.length = f + 1, a =
|
|
1950
|
+
if (e = e || s < 0 || u[f + 1] !== void 0 || (o < 0 ? h : h % L(10, i - o - 1)), c = t < 4 ? (l || e) && (t == 0 || t == (r.s < 0 ? 3 : 2)) : l > 5 || l == 5 && (t == 4 || e || t == 6 && // Check whether the digit to the left of the rounding digit is odd.
|
|
1951
|
+
(n > 0 ? o > 0 ? h / L(10, i - o) : 0 : u[f - 1]) % 10 & 1 || t == (r.s < 0 ? 8 : 7)), s < 1 || !u[0])
|
|
1952
|
+
return u.length = 0, c ? (s -= r.e + 1, u[0] = L(10, (S - s % S) % S), r.e = -s || 0) : u[0] = r.e = 0, r;
|
|
1953
|
+
if (n == 0 ? (u.length = f, a = 1, f--) : (u.length = f + 1, a = L(10, S - n), u[f] = o > 0 ? (h / L(10, i - o) % L(10, o) | 0) * a : 0), c)
|
|
1698
1954
|
for (; ; )
|
|
1699
1955
|
if (f == 0) {
|
|
1700
1956
|
for (n = 1, o = u[0]; o >= 10; o /= 10) n++;
|
|
@@ -1710,25 +1966,25 @@ function P(r, s, t, e) {
|
|
|
1710
1966
|
return _ && (r.e > m.maxE ? (r.d = null, r.e = NaN) : r.e < m.minE && (r.e = 0, r.d = [0])), r;
|
|
1711
1967
|
}
|
|
1712
1968
|
function K(r, s, t) {
|
|
1713
|
-
if (!r.isFinite()) return
|
|
1714
|
-
var e, i = r.e, n =
|
|
1969
|
+
if (!r.isFinite()) return Ue(r);
|
|
1970
|
+
var e, i = r.e, n = N(r.d), o = n.length;
|
|
1715
1971
|
return s ? (t && (e = t - o) > 0 ? n = n.charAt(0) + "." + n.slice(1) + ot(e) : o > 1 && (n = n.charAt(0) + "." + n.slice(1)), n = n + (r.e < 0 ? "e" : "e+") + r.e) : i < 0 ? (n = "0." + ot(-i - 1) + n, t && (e = t - o) > 0 && (n += ot(e))) : i >= o ? (n += ot(i + 1 - o), t && (e = t - i - 1) > 0 && (n = n + "." + ot(e))) : ((e = i + 1) < o && (n = n.slice(0, e) + "." + n.slice(e)), t && (e = t - o) > 0 && (i + 1 === o && (n += "."), n += ot(e))), n;
|
|
1716
1972
|
}
|
|
1717
|
-
function
|
|
1973
|
+
function Jt(r, s) {
|
|
1718
1974
|
var t = r[0];
|
|
1719
1975
|
for (s *= S; t >= 10; t /= 10) s++;
|
|
1720
1976
|
return s;
|
|
1721
1977
|
}
|
|
1722
|
-
function
|
|
1723
|
-
if (s >
|
|
1724
|
-
throw _ = !0, t && (r.precision = t), Error(
|
|
1725
|
-
return P(new r(
|
|
1978
|
+
function qt(r, s, t) {
|
|
1979
|
+
if (s > oi)
|
|
1980
|
+
throw _ = !0, t && (r.precision = t), Error(Te);
|
|
1981
|
+
return P(new r(Wt), s, 1, !0);
|
|
1726
1982
|
}
|
|
1727
1983
|
function J(r, s, t) {
|
|
1728
|
-
if (s >
|
|
1984
|
+
if (s > ue) throw Error(Te);
|
|
1729
1985
|
return P(new r(jt), s, t, !0);
|
|
1730
1986
|
}
|
|
1731
|
-
function
|
|
1987
|
+
function He(r) {
|
|
1732
1988
|
var s = r.length - 1, t = s * S + 1;
|
|
1733
1989
|
if (s = r[s], s) {
|
|
1734
1990
|
for (; s % 10 == 0; s /= 10) t--;
|
|
@@ -1740,21 +1996,21 @@ function ot(r) {
|
|
|
1740
1996
|
for (var s = ""; r--; ) s += "0";
|
|
1741
1997
|
return s;
|
|
1742
1998
|
}
|
|
1743
|
-
function
|
|
1999
|
+
function Fe(r, s, t, e) {
|
|
1744
2000
|
var i, n = new r(1), o = Math.ceil(e / S + 4);
|
|
1745
2001
|
for (_ = !1; ; ) {
|
|
1746
|
-
if (t % 2 && (n = n.times(s),
|
|
2002
|
+
if (t % 2 && (n = n.times(s), Ce(n.d, o) && (i = !0)), t = F(t / 2), t === 0) {
|
|
1747
2003
|
t = n.d.length - 1, i && n.d[t] === 0 && ++n.d[t];
|
|
1748
2004
|
break;
|
|
1749
2005
|
}
|
|
1750
|
-
s = s.times(s),
|
|
2006
|
+
s = s.times(s), Ce(s.d, o);
|
|
1751
2007
|
}
|
|
1752
2008
|
return _ = !0, n;
|
|
1753
2009
|
}
|
|
1754
|
-
function
|
|
2010
|
+
function be(r) {
|
|
1755
2011
|
return r.d[r.d.length - 1] & 1;
|
|
1756
2012
|
}
|
|
1757
|
-
function
|
|
2013
|
+
function Be(r, s, t) {
|
|
1758
2014
|
for (var e, i, n = new r(s[0]), o = 0; ++o < s.length; ) {
|
|
1759
2015
|
if (i = new r(s[o]), !i.s) {
|
|
1760
2016
|
n = i;
|
|
@@ -1764,17 +2020,17 @@ function He(r, s, t) {
|
|
|
1764
2020
|
}
|
|
1765
2021
|
return n;
|
|
1766
2022
|
}
|
|
1767
|
-
function
|
|
2023
|
+
function de(r, s) {
|
|
1768
2024
|
var t, e, i, n, o, a, l, c = 0, h = 0, u = 0, f = r.constructor, m = f.rounding, p = f.precision;
|
|
1769
2025
|
if (!r.d || !r.d[0] || r.e > 17)
|
|
1770
2026
|
return new f(r.d ? r.d[0] ? r.s < 0 ? 0 : 1 / 0 : 1 : r.s ? r.s < 0 ? 0 : r : NaN);
|
|
1771
2027
|
for (s == null ? (_ = !1, l = p) : l = s, a = new f(0.03125); r.e > -2; )
|
|
1772
2028
|
r = r.times(a), u += 5;
|
|
1773
|
-
for (e = Math.log(
|
|
1774
|
-
if (n = P(n.times(r), l, 1), t = t.times(++h), a = o.plus(
|
|
2029
|
+
for (e = Math.log(L(2, u)) / Math.LN10 * 2 + 5 | 0, l += e, t = n = o = new f(1), f.precision = l; ; ) {
|
|
2030
|
+
if (n = P(n.times(r), l, 1), t = t.times(++h), a = o.plus(k(n, t, l, 1)), N(a.d).slice(0, l) === N(o.d).slice(0, l)) {
|
|
1775
2031
|
for (i = u; i--; ) o = P(o.times(o), l, 1);
|
|
1776
2032
|
if (s == null)
|
|
1777
|
-
if (c < 3 &&
|
|
2033
|
+
if (c < 3 && kt(o.d, l - e, m, c))
|
|
1778
2034
|
f.precision = l += 10, t = n = a = new f(1), h = 0, c++;
|
|
1779
2035
|
else
|
|
1780
2036
|
return P(o, f.precision = p, m, _ = !0);
|
|
@@ -1788,17 +2044,17 @@ function at(r, s) {
|
|
|
1788
2044
|
var t, e, i, n, o, a, l, c, h, u, f, m = 1, p = 10, g = r, y = g.d, w = g.constructor, b = w.rounding, C = w.precision;
|
|
1789
2045
|
if (g.s < 0 || !y || !y[0] || !g.e && y[0] == 1 && y.length == 1)
|
|
1790
2046
|
return new w(y && !y[0] ? -1 / 0 : g.s != 1 ? NaN : y ? 0 : g);
|
|
1791
|
-
if (s == null ? (_ = !1, h = C) : h = s, w.precision = h += p, t =
|
|
2047
|
+
if (s == null ? (_ = !1, h = C) : h = s, w.precision = h += p, t = N(y), e = t.charAt(0), Math.abs(n = g.e) < 15e14) {
|
|
1792
2048
|
for (; e < 7 && e != 1 || e == 1 && t.charAt(1) > 3; )
|
|
1793
|
-
g = g.times(r), t =
|
|
2049
|
+
g = g.times(r), t = N(g.d), e = t.charAt(0), m++;
|
|
1794
2050
|
n = g.e, e > 1 ? (g = new w("0." + t), n++) : g = new w(e + "." + t.slice(1));
|
|
1795
2051
|
} else
|
|
1796
|
-
return c =
|
|
1797
|
-
for (u = g, l = o = g =
|
|
1798
|
-
if (o = P(o.times(f), h, 1), c = l.plus(
|
|
1799
|
-
if (l = l.times(2), n !== 0 && (l = l.plus(
|
|
1800
|
-
if (
|
|
1801
|
-
w.precision = h += p, c = o = g =
|
|
2052
|
+
return c = qt(w, h + 2, C).times(n + ""), g = at(new w(e + "." + t.slice(1)), h - p).plus(c), w.precision = C, s == null ? P(g, C, b, _ = !0) : g;
|
|
2053
|
+
for (u = g, l = o = g = k(g.minus(1), g.plus(1), h, 1), f = P(g.times(g), h, 1), i = 3; ; ) {
|
|
2054
|
+
if (o = P(o.times(f), h, 1), c = l.plus(k(o, new w(i), h, 1)), N(c.d).slice(0, h) === N(l.d).slice(0, h))
|
|
2055
|
+
if (l = l.times(2), n !== 0 && (l = l.plus(qt(w, h + 2, C).times(n + ""))), l = k(l, new w(m), h, 1), s == null)
|
|
2056
|
+
if (kt(l.d, h - p, b, a))
|
|
2057
|
+
w.precision = h += p, c = o = g = k(u.minus(1), u.plus(1), h, 1), f = P(g.times(g), h, 1), i = a = 1;
|
|
1802
2058
|
else
|
|
1803
2059
|
return P(l, w.precision = C, b, _ = !0);
|
|
1804
2060
|
else
|
|
@@ -1806,10 +2062,10 @@ function at(r, s) {
|
|
|
1806
2062
|
l = c, i += 2;
|
|
1807
2063
|
}
|
|
1808
2064
|
}
|
|
1809
|
-
function
|
|
2065
|
+
function Ue(r) {
|
|
1810
2066
|
return String(r.s * r.s / 0);
|
|
1811
2067
|
}
|
|
1812
|
-
function
|
|
2068
|
+
function Ft(r, s) {
|
|
1813
2069
|
var t, e, i;
|
|
1814
2070
|
for ((t = s.indexOf(".")) > -1 && (s = s.replace(".", "")), (e = s.search(/e/i)) > 0 ? (t < 0 && (t = e), t += +s.slice(e + 1), s = s.substring(0, e)) : t < 0 && (t = s.length), e = 0; s.charCodeAt(e) === 48; e++) ;
|
|
1815
2071
|
for (i = s.length; s.charCodeAt(i - 1) === 48; --i) ;
|
|
@@ -1825,28 +2081,28 @@ function Ht(r, s) {
|
|
|
1825
2081
|
r.e = 0, r.d = [0];
|
|
1826
2082
|
return r;
|
|
1827
2083
|
}
|
|
1828
|
-
function
|
|
2084
|
+
function li(r, s) {
|
|
1829
2085
|
var t, e, i, n, o, a, l, c, h;
|
|
1830
2086
|
if (s.indexOf("_") > -1) {
|
|
1831
|
-
if (s = s.replace(/(\d)_(?=\d)/g, "$1"),
|
|
2087
|
+
if (s = s.replace(/(\d)_(?=\d)/g, "$1"), Ne.test(s)) return Ft(r, s);
|
|
1832
2088
|
} else if (s === "Infinity" || s === "NaN")
|
|
1833
2089
|
return +s || (r.s = NaN), r.e = NaN, r.d = null, r;
|
|
1834
|
-
if (
|
|
2090
|
+
if (si.test(s))
|
|
1835
2091
|
t = 16, s = s.toLowerCase();
|
|
1836
|
-
else if (ti.test(s))
|
|
1837
|
-
t = 2;
|
|
1838
2092
|
else if (ii.test(s))
|
|
2093
|
+
t = 2;
|
|
2094
|
+
else if (ni.test(s))
|
|
1839
2095
|
t = 8;
|
|
1840
2096
|
else
|
|
1841
2097
|
throw Error(ct + s);
|
|
1842
|
-
for (n = s.search(/p/i), n > 0 ? (l = +s.slice(n + 1), s = s.substring(2, n)) : s = s.slice(2), n = s.indexOf("."), o = n >= 0, e = r.constructor, o && (s = s.replace(".", ""), a = s.length, n = a - n, i =
|
|
1843
|
-
return n < 0 ? new e(r.s * 0) : (r.e =
|
|
2098
|
+
for (n = s.search(/p/i), n > 0 ? (l = +s.slice(n + 1), s = s.substring(2, n)) : s = s.slice(2), n = s.indexOf("."), o = n >= 0, e = r.constructor, o && (s = s.replace(".", ""), a = s.length, n = a - n, i = Fe(e, new e(t), n, n * 2)), c = Ht(s, t, $), h = c.length - 1, n = h; c[n] === 0; --n) c.pop();
|
|
2099
|
+
return n < 0 ? new e(r.s * 0) : (r.e = Jt(c, h), r.d = c, _ = !1, o && (r = k(r, i, a * 4)), l && (r = r.times(Math.abs(l) < 54 ? L(2, l) : D.pow(2, l))), _ = !0, r);
|
|
1844
2100
|
}
|
|
1845
|
-
function
|
|
2101
|
+
function ci(r, s) {
|
|
1846
2102
|
var t, e = s.d.length;
|
|
1847
2103
|
if (e < 3)
|
|
1848
2104
|
return s.isZero() ? s : Mt(r, 2, s, s);
|
|
1849
|
-
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0, s = s.times(1 /
|
|
2105
|
+
t = 1.4 * Math.sqrt(e), t = t > 16 ? 16 : t | 0, s = s.times(1 / Kt(5, t)), s = Mt(r, 2, s, s);
|
|
1850
2106
|
for (var i, n = new r(5), o = new r(16), a = new r(20); t--; )
|
|
1851
2107
|
i = s.times(s), s = s.times(n.plus(i.times(o.times(i).minus(a))));
|
|
1852
2108
|
return s;
|
|
@@ -1854,7 +2110,7 @@ function ai(r, s) {
|
|
|
1854
2110
|
function Mt(r, s, t, e, i) {
|
|
1855
2111
|
var n, o, a, l, c = r.precision, h = Math.ceil(c / S);
|
|
1856
2112
|
for (_ = !1, l = t.times(t), a = new r(e); ; ) {
|
|
1857
|
-
if (o =
|
|
2113
|
+
if (o = k(a.times(l), new r(s++ * s++), c, 1), a = i ? e.plus(o) : e.minus(o), e = k(o.times(l), new r(s++ * s++), c, 1), o = a.plus(e), o.d[h] !== void 0) {
|
|
1858
2114
|
for (n = h; o.d[n] === a.d[n] && n--; ) ;
|
|
1859
2115
|
if (n == -1) break;
|
|
1860
2116
|
}
|
|
@@ -1862,11 +2118,11 @@ function Mt(r, s, t, e, i) {
|
|
|
1862
2118
|
}
|
|
1863
2119
|
return _ = !0, o.d.length = h + 1, o;
|
|
1864
2120
|
}
|
|
1865
|
-
function
|
|
2121
|
+
function Kt(r, s) {
|
|
1866
2122
|
for (var t = r; --s; ) t *= r;
|
|
1867
2123
|
return t;
|
|
1868
2124
|
}
|
|
1869
|
-
function
|
|
2125
|
+
function Xe(r, s) {
|
|
1870
2126
|
var t, e = s.s < 0, i = J(r, r.precision, 1), n = i.times(0.5);
|
|
1871
2127
|
if (s = s.abs(), s.lte(n))
|
|
1872
2128
|
return nt = e ? 4 : 1, s;
|
|
@@ -1874,31 +2130,31 @@ function Be(r, s) {
|
|
|
1874
2130
|
nt = e ? 3 : 2;
|
|
1875
2131
|
else {
|
|
1876
2132
|
if (s = s.minus(t.times(i)), s.lte(n))
|
|
1877
|
-
return nt =
|
|
1878
|
-
nt =
|
|
2133
|
+
return nt = be(t) ? e ? 2 : 3 : e ? 4 : 1, s;
|
|
2134
|
+
nt = be(t) ? e ? 1 : 4 : e ? 3 : 2;
|
|
1879
2135
|
}
|
|
1880
2136
|
return s.minus(i).abs();
|
|
1881
2137
|
}
|
|
1882
|
-
function
|
|
2138
|
+
function pe(r, s, t, e) {
|
|
1883
2139
|
var i, n, o, a, l, c, h, u, f, m = r.constructor, p = t !== void 0;
|
|
1884
|
-
if (p ? (
|
|
1885
|
-
h =
|
|
2140
|
+
if (p ? (X(t, 1, ht), e === void 0 ? e = m.rounding : X(e, 0, 8)) : (t = m.precision, e = m.rounding), !r.isFinite())
|
|
2141
|
+
h = Ue(r);
|
|
1886
2142
|
else {
|
|
1887
|
-
for (h = K(r), o = h.indexOf("."), p ? (i = 2, s == 16 ? t = t * 4 - 3 : s == 8 && (t = t * 3 - 2)) : i = s, o >= 0 && (h = h.replace(".", ""), f = new m(1), f.e = h.length - o, f.d =
|
|
2143
|
+
for (h = K(r), o = h.indexOf("."), p ? (i = 2, s == 16 ? t = t * 4 - 3 : s == 8 && (t = t * 3 - 2)) : i = s, o >= 0 && (h = h.replace(".", ""), f = new m(1), f.e = h.length - o, f.d = Ht(K(f), 10, i), f.e = f.d.length), u = Ht(h, 10, i), n = l = u.length; u[--l] == 0; ) u.pop();
|
|
1888
2144
|
if (!u[0])
|
|
1889
2145
|
h = p ? "0p+0" : "0";
|
|
1890
2146
|
else {
|
|
1891
|
-
if (o < 0 ? n-- : (r = new m(r), r.d = u, r.e = n, r =
|
|
2147
|
+
if (o < 0 ? n-- : (r = new m(r), r.d = u, r.e = n, r = k(r, f, t, e, 0, i), u = r.d, n = r.e, c = Ae), o = u[t], a = i / 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)
|
|
1892
2148
|
for (; ++u[--t] > i - 1; )
|
|
1893
2149
|
u[t] = 0, t || (++n, u.unshift(1));
|
|
1894
2150
|
for (l = u.length; !u[l - 1]; --l) ;
|
|
1895
|
-
for (o = 0, h = ""; o < l; o++) h +=
|
|
2151
|
+
for (o = 0, h = ""; o < l; o++) h += ce.charAt(u[o]);
|
|
1896
2152
|
if (p) {
|
|
1897
2153
|
if (l > 1)
|
|
1898
2154
|
if (s == 16 || s == 8) {
|
|
1899
2155
|
for (o = s == 16 ? 4 : 3, --l; l % o; l++) h += "0";
|
|
1900
|
-
for (u =
|
|
1901
|
-
for (o = 1, h = "1."; o < l; o++) h +=
|
|
2156
|
+
for (u = Ht(h, i, s), l = u.length; !u[l - 1]; --l) ;
|
|
2157
|
+
for (o = 1, h = "1."; o < l; o++) h += ce.charAt(u[o]);
|
|
1902
2158
|
} else
|
|
1903
2159
|
h = h.charAt(0) + "." + h.slice(1);
|
|
1904
2160
|
h = h + (n < 0 ? "p" : "p+") + n;
|
|
@@ -1912,50 +2168,50 @@ function ge(r, s, t, e) {
|
|
|
1912
2168
|
}
|
|
1913
2169
|
return r.s < 0 ? "-" + h : h;
|
|
1914
2170
|
}
|
|
1915
|
-
function
|
|
2171
|
+
function Ce(r, s) {
|
|
1916
2172
|
if (r.length > s)
|
|
1917
2173
|
return r.length = s, !0;
|
|
1918
2174
|
}
|
|
1919
|
-
function
|
|
2175
|
+
function hi(r) {
|
|
1920
2176
|
return new this(r).abs();
|
|
1921
2177
|
}
|
|
1922
|
-
function
|
|
2178
|
+
function ui(r) {
|
|
1923
2179
|
return new this(r).acos();
|
|
1924
2180
|
}
|
|
1925
|
-
function
|
|
2181
|
+
function di(r) {
|
|
1926
2182
|
return new this(r).acosh();
|
|
1927
2183
|
}
|
|
1928
|
-
function
|
|
2184
|
+
function fi(r, s) {
|
|
1929
2185
|
return new this(r).plus(s);
|
|
1930
2186
|
}
|
|
1931
|
-
function
|
|
2187
|
+
function mi(r) {
|
|
1932
2188
|
return new this(r).asin();
|
|
1933
2189
|
}
|
|
1934
|
-
function
|
|
2190
|
+
function gi(r) {
|
|
1935
2191
|
return new this(r).asinh();
|
|
1936
2192
|
}
|
|
1937
|
-
function
|
|
2193
|
+
function pi(r) {
|
|
1938
2194
|
return new this(r).atan();
|
|
1939
2195
|
}
|
|
1940
|
-
function
|
|
2196
|
+
function vi(r) {
|
|
1941
2197
|
return new this(r).atanh();
|
|
1942
2198
|
}
|
|
1943
|
-
function
|
|
2199
|
+
function yi(r, s) {
|
|
1944
2200
|
r = new this(r), s = new this(s);
|
|
1945
2201
|
var t, e = this.precision, i = this.rounding, n = e + 4;
|
|
1946
|
-
return !r.s || !s.s ? t = new this(NaN) : !r.d && !s.d ? (t = J(this, n, 1).times(s.s > 0 ? 0.25 : 0.75), t.s = r.s) : !s.d || r.isZero() ? (t = s.s < 0 ? J(this, e, i) : new this(0), t.s = r.s) : !r.d || s.isZero() ? (t = J(this, n, 1).times(0.5), t.s = r.s) : s.s < 0 ? (this.precision = n, this.rounding = 1, t = this.atan(
|
|
2202
|
+
return !r.s || !s.s ? t = new this(NaN) : !r.d && !s.d ? (t = J(this, n, 1).times(s.s > 0 ? 0.25 : 0.75), t.s = r.s) : !s.d || r.isZero() ? (t = s.s < 0 ? J(this, e, i) : new this(0), t.s = r.s) : !r.d || s.isZero() ? (t = J(this, n, 1).times(0.5), t.s = r.s) : s.s < 0 ? (this.precision = n, this.rounding = 1, t = this.atan(k(r, s, n, 1)), s = J(this, n, 1), this.precision = e, this.rounding = i, t = r.s < 0 ? t.minus(s) : t.plus(s)) : t = this.atan(k(r, s, n, 1)), t;
|
|
1947
2203
|
}
|
|
1948
|
-
function
|
|
2204
|
+
function wi(r) {
|
|
1949
2205
|
return new this(r).cbrt();
|
|
1950
2206
|
}
|
|
1951
|
-
function
|
|
2207
|
+
function xi(r) {
|
|
1952
2208
|
return P(r = new this(r), r.e + 1, 2);
|
|
1953
2209
|
}
|
|
1954
|
-
function
|
|
2210
|
+
function Pi(r, s, t) {
|
|
1955
2211
|
return new this(r).clamp(s, t);
|
|
1956
2212
|
}
|
|
1957
|
-
function
|
|
1958
|
-
if (!r || typeof r != "object") throw Error(
|
|
2213
|
+
function bi(r) {
|
|
2214
|
+
if (!r || typeof r != "object") throw Error(Qt + "Object expected");
|
|
1959
2215
|
var s, t, e, i = r.defaults === !0, n = [
|
|
1960
2216
|
"precision",
|
|
1961
2217
|
1,
|
|
@@ -1968,10 +2224,10 @@ function xi(r) {
|
|
|
1968
2224
|
0,
|
|
1969
2225
|
"toExpPos",
|
|
1970
2226
|
0,
|
|
1971
|
-
|
|
2227
|
+
le,
|
|
1972
2228
|
"maxE",
|
|
1973
2229
|
0,
|
|
1974
|
-
|
|
2230
|
+
le,
|
|
1975
2231
|
"minE",
|
|
1976
2232
|
-9e15,
|
|
1977
2233
|
0,
|
|
@@ -1980,34 +2236,34 @@ function xi(r) {
|
|
|
1980
2236
|
9
|
|
1981
2237
|
];
|
|
1982
2238
|
for (s = 0; s < n.length; s += 3)
|
|
1983
|
-
if (t = n[s], i && (this[t] =
|
|
2239
|
+
if (t = n[s], i && (this[t] = he[t]), (e = r[t]) !== void 0)
|
|
1984
2240
|
if (F(e) === e && e >= n[s + 1] && e <= n[s + 2]) this[t] = e;
|
|
1985
2241
|
else throw Error(ct + t + ": " + e);
|
|
1986
|
-
if (t = "crypto", i && (this[t] =
|
|
2242
|
+
if (t = "crypto", i && (this[t] = he[t]), (e = r[t]) !== void 0)
|
|
1987
2243
|
if (e === !0 || e === !1 || e === 0 || e === 1)
|
|
1988
2244
|
if (e)
|
|
1989
2245
|
if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
|
|
1990
2246
|
this[t] = !0;
|
|
1991
2247
|
else
|
|
1992
|
-
throw Error(
|
|
2248
|
+
throw Error(Le);
|
|
1993
2249
|
else
|
|
1994
2250
|
this[t] = !1;
|
|
1995
2251
|
else
|
|
1996
2252
|
throw Error(ct + t + ": " + e);
|
|
1997
2253
|
return this;
|
|
1998
2254
|
}
|
|
1999
|
-
function
|
|
2255
|
+
function Ci(r) {
|
|
2000
2256
|
return new this(r).cos();
|
|
2001
2257
|
}
|
|
2002
|
-
function
|
|
2258
|
+
function Si(r) {
|
|
2003
2259
|
return new this(r).cosh();
|
|
2004
2260
|
}
|
|
2005
|
-
function
|
|
2261
|
+
function Ge(r) {
|
|
2006
2262
|
var s, t, e;
|
|
2007
2263
|
function i(n) {
|
|
2008
2264
|
var o, a, l, c = this;
|
|
2009
2265
|
if (!(c instanceof i)) return new i(n);
|
|
2010
|
-
if (c.constructor = i,
|
|
2266
|
+
if (c.constructor = i, Se(n)) {
|
|
2011
2267
|
c.s = n.s, _ ? !n.d || n.e > i.maxE ? (c.e = NaN, c.d = null) : n.e < i.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);
|
|
2012
2268
|
return;
|
|
2013
2269
|
}
|
|
@@ -2025,28 +2281,28 @@ function Xe(r) {
|
|
|
2025
2281
|
n || (c.s = NaN), c.e = NaN, c.d = null;
|
|
2026
2282
|
return;
|
|
2027
2283
|
}
|
|
2028
|
-
return
|
|
2284
|
+
return Ft(c, n.toString());
|
|
2029
2285
|
}
|
|
2030
2286
|
if (l === "string")
|
|
2031
|
-
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1),
|
|
2287
|
+
return (a = n.charCodeAt(0)) === 45 ? (n = n.slice(1), c.s = -1) : (a === 43 && (n = n.slice(1)), c.s = 1), Ne.test(n) ? Ft(c, n) : li(c, n);
|
|
2032
2288
|
if (l === "bigint")
|
|
2033
|
-
return n < 0 ? (n = -n, c.s = -1) : c.s = 1,
|
|
2289
|
+
return n < 0 ? (n = -n, c.s = -1) : c.s = 1, Ft(c, n.toString());
|
|
2034
2290
|
throw Error(ct + n);
|
|
2035
2291
|
}
|
|
2036
|
-
if (i.prototype = v, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set =
|
|
2292
|
+
if (i.prototype = v, i.ROUND_UP = 0, i.ROUND_DOWN = 1, i.ROUND_CEIL = 2, i.ROUND_FLOOR = 3, i.ROUND_HALF_UP = 4, i.ROUND_HALF_DOWN = 5, i.ROUND_HALF_EVEN = 6, i.ROUND_HALF_CEIL = 7, i.ROUND_HALF_FLOOR = 8, i.EUCLID = 9, i.config = i.set = bi, i.clone = Ge, i.isDecimal = Se, i.abs = hi, i.acos = ui, i.acosh = di, i.add = fi, i.asin = mi, i.asinh = gi, i.atan = pi, i.atanh = vi, i.atan2 = yi, i.cbrt = wi, i.ceil = xi, i.clamp = Pi, i.cos = Ci, i.cosh = Si, i.div = _i, i.exp = Ei, i.floor = Mi, i.hypot = Di, i.ln = Ri, i.log = ki, i.log10 = Oi, i.log2 = Vi, i.max = Ai, i.min = Ti, i.mod = Li, i.mul = Ii, i.pow = Ni, i.random = Hi, i.round = Fi, i.sign = Bi, i.sin = Ui, i.sinh = Xi, i.sqrt = Gi, i.sub = zi, i.sum = Yi, i.tan = Wi, i.tanh = ji, i.trunc = qi, r === void 0 && (r = {}), r && r.defaults !== !0)
|
|
2037
2293
|
for (e = ["precision", "rounding", "toExpNeg", "toExpPos", "maxE", "minE", "modulo", "crypto"], s = 0; s < e.length; ) r.hasOwnProperty(t = e[s++]) || (r[t] = this[t]);
|
|
2038
2294
|
return i.config(r), i;
|
|
2039
2295
|
}
|
|
2040
|
-
function
|
|
2296
|
+
function _i(r, s) {
|
|
2041
2297
|
return new this(r).div(s);
|
|
2042
2298
|
}
|
|
2043
|
-
function
|
|
2299
|
+
function Ei(r) {
|
|
2044
2300
|
return new this(r).exp();
|
|
2045
2301
|
}
|
|
2046
|
-
function
|
|
2302
|
+
function Mi(r) {
|
|
2047
2303
|
return P(r = new this(r), r.e + 1, 3);
|
|
2048
2304
|
}
|
|
2049
|
-
function
|
|
2305
|
+
function Di() {
|
|
2050
2306
|
var r, s, t = new this(0);
|
|
2051
2307
|
for (_ = !1, r = 0; r < arguments.length; )
|
|
2052
2308
|
if (s = new this(arguments[r++]), s.d)
|
|
@@ -2058,39 +2314,39 @@ function Mi() {
|
|
|
2058
2314
|
}
|
|
2059
2315
|
return _ = !0, t.sqrt();
|
|
2060
2316
|
}
|
|
2061
|
-
function
|
|
2062
|
-
return r instanceof D || r && r.toStringTag ===
|
|
2317
|
+
function Se(r) {
|
|
2318
|
+
return r instanceof D || r && r.toStringTag === Ie || !1;
|
|
2063
2319
|
}
|
|
2064
|
-
function
|
|
2320
|
+
function Ri(r) {
|
|
2065
2321
|
return new this(r).ln();
|
|
2066
2322
|
}
|
|
2067
|
-
function
|
|
2323
|
+
function ki(r, s) {
|
|
2068
2324
|
return new this(r).log(s);
|
|
2069
2325
|
}
|
|
2070
2326
|
function Vi(r) {
|
|
2071
2327
|
return new this(r).log(2);
|
|
2072
2328
|
}
|
|
2073
|
-
function
|
|
2329
|
+
function Oi(r) {
|
|
2074
2330
|
return new this(r).log(10);
|
|
2075
2331
|
}
|
|
2076
|
-
function
|
|
2077
|
-
return
|
|
2332
|
+
function Ai() {
|
|
2333
|
+
return Be(this, arguments, -1);
|
|
2078
2334
|
}
|
|
2079
|
-
function
|
|
2080
|
-
return
|
|
2335
|
+
function Ti() {
|
|
2336
|
+
return Be(this, arguments, 1);
|
|
2081
2337
|
}
|
|
2082
|
-
function
|
|
2338
|
+
function Li(r, s) {
|
|
2083
2339
|
return new this(r).mod(s);
|
|
2084
2340
|
}
|
|
2085
|
-
function
|
|
2341
|
+
function Ii(r, s) {
|
|
2086
2342
|
return new this(r).mul(s);
|
|
2087
2343
|
}
|
|
2088
|
-
function
|
|
2344
|
+
function Ni(r, s) {
|
|
2089
2345
|
return new this(r).pow(s);
|
|
2090
2346
|
}
|
|
2091
|
-
function
|
|
2347
|
+
function Hi(r) {
|
|
2092
2348
|
var s, t, e, i, n = 0, o = new this(1), a = [];
|
|
2093
|
-
if (r === void 0 ? r = this.precision :
|
|
2349
|
+
if (r === void 0 ? r = this.precision : X(r, 1, ht), e = Math.ceil(r / S), this.crypto)
|
|
2094
2350
|
if (crypto.getRandomValues)
|
|
2095
2351
|
for (s = crypto.getRandomValues(new Uint32Array(e)); n < e; )
|
|
2096
2352
|
i = s[n], i >= 429e7 ? s[n] = crypto.getRandomValues(new Uint32Array(1))[0] : a[n++] = i % 1e7;
|
|
@@ -2099,9 +2355,9 @@ function Li(r) {
|
|
|
2099
2355
|
i = s[n] + (s[n + 1] << 8) + (s[n + 2] << 16) + ((s[n + 3] & 127) << 24), i >= 214e7 ? crypto.randomBytes(4).copy(s, n) : (a.push(i % 1e7), n += 4);
|
|
2100
2356
|
n = e / 4;
|
|
2101
2357
|
} else
|
|
2102
|
-
throw Error(
|
|
2358
|
+
throw Error(Le);
|
|
2103
2359
|
else for (; n < e; ) a[n++] = Math.random() * 1e7 | 0;
|
|
2104
|
-
for (e = a[--n], r %= S, e && r && (i =
|
|
2360
|
+
for (e = a[--n], r %= S, e && r && (i = L(10, S - r), a[n] = (e / i | 0) * i); a[n] === 0; n--) a.pop();
|
|
2105
2361
|
if (n < 0)
|
|
2106
2362
|
t = 0, a = [0];
|
|
2107
2363
|
else {
|
|
@@ -2111,44 +2367,44 @@ function Li(r) {
|
|
|
2111
2367
|
}
|
|
2112
2368
|
return o.e = t, o.d = a, o;
|
|
2113
2369
|
}
|
|
2114
|
-
function
|
|
2370
|
+
function Fi(r) {
|
|
2115
2371
|
return P(r = new this(r), r.e + 1, this.rounding);
|
|
2116
2372
|
}
|
|
2117
|
-
function
|
|
2373
|
+
function Bi(r) {
|
|
2118
2374
|
return r = new this(r), r.d ? r.d[0] ? r.s : 0 * r.s : r.s || NaN;
|
|
2119
2375
|
}
|
|
2120
|
-
function
|
|
2376
|
+
function Ui(r) {
|
|
2121
2377
|
return new this(r).sin();
|
|
2122
2378
|
}
|
|
2123
|
-
function
|
|
2379
|
+
function Xi(r) {
|
|
2124
2380
|
return new this(r).sinh();
|
|
2125
2381
|
}
|
|
2126
|
-
function
|
|
2382
|
+
function Gi(r) {
|
|
2127
2383
|
return new this(r).sqrt();
|
|
2128
2384
|
}
|
|
2129
|
-
function
|
|
2385
|
+
function zi(r, s) {
|
|
2130
2386
|
return new this(r).sub(s);
|
|
2131
2387
|
}
|
|
2132
|
-
function
|
|
2388
|
+
function Yi() {
|
|
2133
2389
|
var r = 0, s = arguments, t = new this(s[r]);
|
|
2134
2390
|
for (_ = !1; t.s && ++r < s.length; ) t = t.plus(s[r]);
|
|
2135
2391
|
return _ = !0, P(t, this.precision, this.rounding);
|
|
2136
2392
|
}
|
|
2137
|
-
function
|
|
2393
|
+
function Wi(r) {
|
|
2138
2394
|
return new this(r).tan();
|
|
2139
2395
|
}
|
|
2140
|
-
function
|
|
2396
|
+
function ji(r) {
|
|
2141
2397
|
return new this(r).tanh();
|
|
2142
2398
|
}
|
|
2143
|
-
function
|
|
2399
|
+
function qi(r) {
|
|
2144
2400
|
return P(r = new this(r), r.e + 1, 1);
|
|
2145
2401
|
}
|
|
2146
2402
|
v[Symbol.for("nodejs.util.inspect.custom")] = v.toString;
|
|
2147
2403
|
v[Symbol.toStringTag] = "Decimal";
|
|
2148
|
-
var D = v.constructor =
|
|
2149
|
-
|
|
2404
|
+
var D = v.constructor = Ge(he);
|
|
2405
|
+
Wt = new D(Wt);
|
|
2150
2406
|
jt = new D(jt);
|
|
2151
|
-
class
|
|
2407
|
+
class $i {
|
|
2152
2408
|
constructor() {
|
|
2153
2409
|
/** 父级 */
|
|
2154
2410
|
d(this, "parent");
|
|
@@ -2178,7 +2434,7 @@ class Wi {
|
|
|
2178
2434
|
this.mainCanvas = s;
|
|
2179
2435
|
}
|
|
2180
2436
|
}
|
|
2181
|
-
class
|
|
2437
|
+
class Zi extends $i {
|
|
2182
2438
|
constructor() {
|
|
2183
2439
|
super(...arguments);
|
|
2184
2440
|
d(this, "_isVisible", !0);
|
|
@@ -2224,12 +2480,12 @@ class qi extends Wi {
|
|
|
2224
2480
|
return !0;
|
|
2225
2481
|
}
|
|
2226
2482
|
}
|
|
2227
|
-
let
|
|
2483
|
+
let Qi = class extends Zi {
|
|
2228
2484
|
constructor(s) {
|
|
2229
|
-
super(), s.name = s.name ||
|
|
2485
|
+
super(), s.name = s.name || ae("default-name-"), Object.assign(this, { ...s });
|
|
2230
2486
|
}
|
|
2231
2487
|
};
|
|
2232
|
-
class
|
|
2488
|
+
class Ji extends Qi {
|
|
2233
2489
|
constructor(t) {
|
|
2234
2490
|
super(t);
|
|
2235
2491
|
d(this, "_isInteractive", !0);
|
|
@@ -2308,7 +2564,7 @@ class Zi extends $i {
|
|
|
2308
2564
|
return (this.parent ? this.parent[t] : !0) && e && (i ? this.isInteractive : !0);
|
|
2309
2565
|
}
|
|
2310
2566
|
}
|
|
2311
|
-
class
|
|
2567
|
+
class Ki {
|
|
2312
2568
|
constructor(s) {
|
|
2313
2569
|
d(this, "propagationStopped", !1);
|
|
2314
2570
|
this.data = s;
|
|
@@ -2320,7 +2576,7 @@ class Qi {
|
|
|
2320
2576
|
return !this.propagationStopped;
|
|
2321
2577
|
}
|
|
2322
2578
|
}
|
|
2323
|
-
class
|
|
2579
|
+
class Vt extends Ji {
|
|
2324
2580
|
constructor() {
|
|
2325
2581
|
super(...arguments);
|
|
2326
2582
|
//#region 4. 添加事件管理器
|
|
@@ -2438,7 +2694,7 @@ class Rt extends Zi {
|
|
|
2438
2694
|
var c, h;
|
|
2439
2695
|
if (!this[n]) return;
|
|
2440
2696
|
this.updateStates(t, e);
|
|
2441
|
-
const o = new
|
|
2697
|
+
const o = new Ki(e);
|
|
2442
2698
|
this.listeners[t].forEach((u) => u(o, i));
|
|
2443
2699
|
const a = "notify" + (t.charAt(0).toUpperCase() + t.slice(1)), l = ["notifyDragg", "notifyWheel"].includes(a) ? e : e.state;
|
|
2444
2700
|
o.canPropagate && ((c = this.parent) == null || c[a](l, i)), (h = this.sharedControllers[t]) == null || h.forEach(
|
|
@@ -2494,7 +2750,7 @@ class Rt extends Zi {
|
|
|
2494
2750
|
}
|
|
2495
2751
|
//#region 6. 添加事件通知方法
|
|
2496
2752
|
}
|
|
2497
|
-
class
|
|
2753
|
+
class ts extends Vt {
|
|
2498
2754
|
constructor(t) {
|
|
2499
2755
|
super(t);
|
|
2500
2756
|
/** 画布元素 */
|
|
@@ -2765,7 +3021,7 @@ class Ji extends Rt {
|
|
|
2765
3021
|
) : l(t);
|
|
2766
3022
|
}
|
|
2767
3023
|
}
|
|
2768
|
-
class
|
|
3024
|
+
class es extends ts {
|
|
2769
3025
|
constructor(t) {
|
|
2770
3026
|
super(t);
|
|
2771
3027
|
/** 主题 */
|
|
@@ -2989,7 +3245,7 @@ class Ki extends Ji {
|
|
|
2989
3245
|
setStyle(t) {
|
|
2990
3246
|
for (const e in t)
|
|
2991
3247
|
if (Object.prototype.hasOwnProperty.call(t, e)) {
|
|
2992
|
-
const i =
|
|
3248
|
+
const i = ti(
|
|
2993
3249
|
this.style[e] || this.style[this.theme]
|
|
2994
3250
|
);
|
|
2995
3251
|
pt(i, t[e]), this.style[e] = i;
|
|
@@ -3001,7 +3257,7 @@ class Ki extends Ji {
|
|
|
3001
3257
|
t in this.style && (this.theme = t, this.isThemeUpdated = !0);
|
|
3002
3258
|
}
|
|
3003
3259
|
}
|
|
3004
|
-
class
|
|
3260
|
+
class R extends Vt {
|
|
3005
3261
|
constructor(t) {
|
|
3006
3262
|
t = { ...t }, t.isDraggable = t.isDraggable ?? !1;
|
|
3007
3263
|
const { mainCanvas: e, notifyReload: i } = t;
|
|
@@ -3267,7 +3523,7 @@ class V extends Rt {
|
|
|
3267
3523
|
handleValuePosition(t, e) {
|
|
3268
3524
|
let { value: i, position: n, mainCanvas: o } = this;
|
|
3269
3525
|
if (!o) return !1;
|
|
3270
|
-
const a = t === "array1D" ?
|
|
3526
|
+
const a = t === "array1D" ? ge : Yt, [l, c] = [
|
|
3271
3527
|
a(i) && (!e || i.length >= e),
|
|
3272
3528
|
a(n) && (!e || n.length >= e)
|
|
3273
3529
|
], h = {
|
|
@@ -3324,8 +3580,8 @@ class V extends Rt {
|
|
|
3324
3580
|
return this.isInteractive ? this.isDraggable ? "_nhanh_canvas_hover_overlay_draggable" : "_nhanh_canvas_hover_overlay" : void 0;
|
|
3325
3581
|
}
|
|
3326
3582
|
}
|
|
3327
|
-
d(
|
|
3328
|
-
class
|
|
3583
|
+
d(R, "ctx", document.createElement("canvas").getContext("2d"));
|
|
3584
|
+
class Bt extends R {
|
|
3329
3585
|
constructor(t) {
|
|
3330
3586
|
super(t);
|
|
3331
3587
|
d(this, "_draw");
|
|
@@ -3433,7 +3689,7 @@ class O {
|
|
|
3433
3689
|
return new D(s).div(t).toNumber();
|
|
3434
3690
|
}
|
|
3435
3691
|
}
|
|
3436
|
-
class
|
|
3692
|
+
class Ut extends R {
|
|
3437
3693
|
constructor(t) {
|
|
3438
3694
|
super(t);
|
|
3439
3695
|
/** 文字偏差 */
|
|
@@ -3482,7 +3738,7 @@ class Bt extends V {
|
|
|
3482
3738
|
});
|
|
3483
3739
|
}
|
|
3484
3740
|
isPointInPath(t, e) {
|
|
3485
|
-
return this.path ?
|
|
3741
|
+
return this.path ? R.ctx.isPointInPath(this.path, t, e) : !1;
|
|
3486
3742
|
}
|
|
3487
3743
|
isPointInStroke(t, e) {
|
|
3488
3744
|
return !1;
|
|
@@ -3491,7 +3747,7 @@ class Bt extends V {
|
|
|
3491
3747
|
if (!this.mainCanvas) return;
|
|
3492
3748
|
if (!this.text || this.text.length == 0)
|
|
3493
3749
|
return this.internalUpdate({ dynamicPosition: void 0 });
|
|
3494
|
-
const t =
|
|
3750
|
+
const t = R.ctx;
|
|
3495
3751
|
this.setOverlayStyles(t);
|
|
3496
3752
|
const e = t.measureText(this.text);
|
|
3497
3753
|
this.textOffset = {
|
|
@@ -3533,7 +3789,7 @@ class Bt extends V {
|
|
|
3533
3789
|
}
|
|
3534
3790
|
}
|
|
3535
3791
|
}
|
|
3536
|
-
class lt extends
|
|
3792
|
+
class lt extends R {
|
|
3537
3793
|
constructor(t) {
|
|
3538
3794
|
super(t);
|
|
3539
3795
|
d(this, "angle", 2 * Math.PI);
|
|
@@ -3578,7 +3834,7 @@ class lt extends V {
|
|
|
3578
3834
|
cancelAndRestartAnimation(t, e, i) {
|
|
3579
3835
|
this.fillProgress.scheduleCallback();
|
|
3580
3836
|
let n = 0;
|
|
3581
|
-
this.fillProgress.scheduleCallback =
|
|
3837
|
+
this.fillProgress.scheduleCallback = zt((o) => {
|
|
3582
3838
|
!this.fillProgress || !o || (this.fillProgress.progress += (o - n) * (t ? 1 : -1), n = o, this.fillProgress.progress = Math.min(
|
|
3583
3839
|
1,
|
|
3584
3840
|
Math.max(0, this.fillProgress.progress)
|
|
@@ -3590,7 +3846,7 @@ class lt extends V {
|
|
|
3590
3846
|
this.fillProgress = {
|
|
3591
3847
|
lineWidthOffset: 0,
|
|
3592
3848
|
progress: 0,
|
|
3593
|
-
scheduleCallback:
|
|
3849
|
+
scheduleCallback: zt((i) => {
|
|
3594
3850
|
this.fillProgress && (this.fillProgress.progress = i, this.updateLineWidthOffset(t));
|
|
3595
3851
|
}, e)
|
|
3596
3852
|
};
|
|
@@ -3603,13 +3859,13 @@ class lt extends V {
|
|
|
3603
3859
|
e !== this.fillProgress.lineWidthOffset && (this.fillProgress.lineWidthOffset = e, (i = this.notifyReload) == null || i.call(this));
|
|
3604
3860
|
}
|
|
3605
3861
|
isPointInPath(t, e) {
|
|
3606
|
-
return this.path ?
|
|
3862
|
+
return this.path ? R.ctx.isPointInPath(this.path, t, e) : !1;
|
|
3607
3863
|
}
|
|
3608
3864
|
isPointInStroke(t, e) {
|
|
3609
3865
|
var i;
|
|
3610
3866
|
if (this.path && this.mainCanvas) {
|
|
3611
|
-
const { width: n } = this.setOverlayStyles(
|
|
3612
|
-
return ((i = this.fillProgress) == null ? void 0 : i.lineWidthOffset) == n ? !1 :
|
|
3867
|
+
const { width: n } = this.setOverlayStyles(R.ctx);
|
|
3868
|
+
return ((i = this.fillProgress) == null ? void 0 : i.lineWidthOffset) == n ? !1 : R.ctx.isPointInStroke(this.path, t, e);
|
|
3613
3869
|
}
|
|
3614
3870
|
return !1;
|
|
3615
3871
|
}
|
|
@@ -3649,7 +3905,7 @@ class lt extends V {
|
|
|
3649
3905
|
}
|
|
3650
3906
|
}
|
|
3651
3907
|
}
|
|
3652
|
-
class
|
|
3908
|
+
class ze extends R {
|
|
3653
3909
|
constructor(t) {
|
|
3654
3910
|
super(t);
|
|
3655
3911
|
/** 控制点 */
|
|
@@ -3745,7 +4001,7 @@ class Ge extends V {
|
|
|
3745
4001
|
tryCreateNewHandlePoint(t, e) {
|
|
3746
4002
|
var c;
|
|
3747
4003
|
if (!this.isPointInStroke(t, e)) return;
|
|
3748
|
-
const i = this.getExtendedDynamicPositions(), n =
|
|
4004
|
+
const i = this.getExtendedDynamicPositions(), n = is([t, e], i);
|
|
3749
4005
|
if (n === -1) return;
|
|
3750
4006
|
const [o, a] = this.getAdjacentIndices(n), l = this.createNewHandlePoint(o, a);
|
|
3751
4007
|
this.insertHandlePoint(n, l), this.lockHandlePointCreationTemporarily(), (c = this.notifyReload) == null || c.call(this);
|
|
@@ -3766,13 +4022,13 @@ class Ge extends V {
|
|
|
3766
4022
|
}
|
|
3767
4023
|
/** 创建新的控制点 */
|
|
3768
4024
|
createNewHandlePoint(t, e) {
|
|
3769
|
-
const i =
|
|
4025
|
+
const i = se(
|
|
3770
4026
|
this.value[t],
|
|
3771
4027
|
this.value[e]
|
|
3772
|
-
), n =
|
|
4028
|
+
), n = se(
|
|
3773
4029
|
this.position[t],
|
|
3774
4030
|
this.position[e]
|
|
3775
|
-
), o =
|
|
4031
|
+
), o = se(
|
|
3776
4032
|
this.dynamicPosition[t],
|
|
3777
4033
|
this.dynamicPosition[e]
|
|
3778
4034
|
);
|
|
@@ -3844,12 +4100,12 @@ class Ge extends V {
|
|
|
3844
4100
|
});
|
|
3845
4101
|
}
|
|
3846
4102
|
}
|
|
3847
|
-
function
|
|
4103
|
+
function is(r, s, t = 10) {
|
|
3848
4104
|
if (s.length === 0) return 0;
|
|
3849
4105
|
if (s.length === 1) return 1;
|
|
3850
4106
|
let e = 1 / 0, i = -1;
|
|
3851
4107
|
for (let n = 0; n < s.length - 1; n++) {
|
|
3852
|
-
const o =
|
|
4108
|
+
const o = Ms(
|
|
3853
4109
|
r,
|
|
3854
4110
|
s[n],
|
|
3855
4111
|
s[n + 1]
|
|
@@ -3860,11 +4116,11 @@ function ts(r, s, t = 10) {
|
|
|
3860
4116
|
}
|
|
3861
4117
|
return i;
|
|
3862
4118
|
}
|
|
3863
|
-
function
|
|
3864
|
-
const { x: t, y: e } =
|
|
4119
|
+
function se(r, s) {
|
|
4120
|
+
const { x: t, y: e } = We(...r, ...s);
|
|
3865
4121
|
return [t, e];
|
|
3866
4122
|
}
|
|
3867
|
-
class Xt extends
|
|
4123
|
+
class Xt extends ze {
|
|
3868
4124
|
constructor(t) {
|
|
3869
4125
|
super(t);
|
|
3870
4126
|
d(this, "_isInfinite");
|
|
@@ -3888,7 +4144,7 @@ class Xt extends Ge {
|
|
|
3888
4144
|
return !1;
|
|
3889
4145
|
}
|
|
3890
4146
|
isPointInStroke(t, e) {
|
|
3891
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
4147
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
3892
4148
|
}
|
|
3893
4149
|
isPointInAnywhere(t, e) {
|
|
3894
4150
|
return ((n) => {
|
|
@@ -3905,7 +4161,7 @@ class Xt extends Ge {
|
|
|
3905
4161
|
if (this.isInfinite) {
|
|
3906
4162
|
this.isRecalculate && this.updateDynamicPosition();
|
|
3907
4163
|
const { width: t, height: e } = this.mainCanvas.rect;
|
|
3908
|
-
return
|
|
4164
|
+
return ss(
|
|
3909
4165
|
[0, 0],
|
|
3910
4166
|
[t, e],
|
|
3911
4167
|
this.finalDynamicPosition[0],
|
|
@@ -3955,12 +4211,12 @@ class Xt extends Ge {
|
|
|
3955
4211
|
const { rect: n } = e, [o, a] = i, l = [a[0] - o[0], a[1] - o[1]];
|
|
3956
4212
|
if (l[0] === 0 && l[1] === 0)
|
|
3957
4213
|
return console.error("重合点无法确定方向");
|
|
3958
|
-
const c =
|
|
4214
|
+
const c = _e(
|
|
3959
4215
|
o,
|
|
3960
4216
|
[-l[0], -l[1]],
|
|
3961
4217
|
n.width,
|
|
3962
4218
|
n.height
|
|
3963
|
-
), h =
|
|
4219
|
+
), h = _e(
|
|
3964
4220
|
a,
|
|
3965
4221
|
l,
|
|
3966
4222
|
n.width,
|
|
@@ -3975,7 +4231,7 @@ class Xt extends Ge {
|
|
|
3975
4231
|
}
|
|
3976
4232
|
}
|
|
3977
4233
|
}
|
|
3978
|
-
function
|
|
4234
|
+
function _e(r, s, t, e) {
|
|
3979
4235
|
const [i, n] = r, [o, a] = s;
|
|
3980
4236
|
let l = 1 / 0;
|
|
3981
4237
|
if (o !== 0) {
|
|
@@ -3988,7 +4244,7 @@ function Ce(r, s, t, e) {
|
|
|
3988
4244
|
}
|
|
3989
4245
|
return l === 1 / 0 ? r : [i + o * l, n + a * l];
|
|
3990
4246
|
}
|
|
3991
|
-
function
|
|
4247
|
+
function ss(r, s, t, e) {
|
|
3992
4248
|
const i = Math.min(r[0], s[0]), n = Math.max(r[0], s[0]), o = Math.min(r[1], s[1]), a = Math.max(r[1], s[1]), l = [
|
|
3993
4249
|
[i, o],
|
|
3994
4250
|
// 左上
|
|
@@ -4012,7 +4268,7 @@ function es(r, s, t, e) {
|
|
|
4012
4268
|
}
|
|
4013
4269
|
return m && p;
|
|
4014
4270
|
}
|
|
4015
|
-
class Gt extends
|
|
4271
|
+
class Gt extends ze {
|
|
4016
4272
|
constructor(t) {
|
|
4017
4273
|
super(t);
|
|
4018
4274
|
d(this, "_isRect", !1);
|
|
@@ -4054,10 +4310,10 @@ class Gt extends Ge {
|
|
|
4054
4310
|
this.initValueScope();
|
|
4055
4311
|
}
|
|
4056
4312
|
isPointInPath(t, e) {
|
|
4057
|
-
return this.path ?
|
|
4313
|
+
return this.path ? R.ctx.isPointInPath(this.path, t, e) : !1;
|
|
4058
4314
|
}
|
|
4059
4315
|
isPointInStroke(t, e) {
|
|
4060
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
4316
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
4061
4317
|
}
|
|
4062
4318
|
isPointInAnywhere(t, e) {
|
|
4063
4319
|
return ((n) => {
|
|
@@ -4149,7 +4405,7 @@ class Gt extends Ge {
|
|
|
4149
4405
|
}
|
|
4150
4406
|
}
|
|
4151
4407
|
}
|
|
4152
|
-
class
|
|
4408
|
+
class fe extends R {
|
|
4153
4409
|
constructor(t) {
|
|
4154
4410
|
super(t);
|
|
4155
4411
|
d(this, "_isFill", !1);
|
|
@@ -4321,10 +4577,10 @@ class de extends V {
|
|
|
4321
4577
|
}));
|
|
4322
4578
|
}
|
|
4323
4579
|
isPointInPath(t, e) {
|
|
4324
|
-
return this.isFill && this.path ?
|
|
4580
|
+
return this.isFill && this.path ? R.ctx.isPointInPath(this.path, t, e) : !1;
|
|
4325
4581
|
}
|
|
4326
4582
|
isPointInStroke(t, e) {
|
|
4327
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
4583
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
4328
4584
|
}
|
|
4329
4585
|
isPointInAnywhere(t, e) {
|
|
4330
4586
|
return ((n) => {
|
|
@@ -4373,7 +4629,7 @@ class de extends V {
|
|
|
4373
4629
|
offset: c
|
|
4374
4630
|
} = this;
|
|
4375
4631
|
if (!t || !a || !l) return;
|
|
4376
|
-
const [h, u] =
|
|
4632
|
+
const [h, u] = ns(
|
|
4377
4633
|
...e,
|
|
4378
4634
|
i,
|
|
4379
4635
|
n,
|
|
@@ -4477,14 +4733,14 @@ class de extends V {
|
|
|
4477
4733
|
}
|
|
4478
4734
|
}
|
|
4479
4735
|
}
|
|
4480
|
-
function
|
|
4736
|
+
function ns(r, s, t, e, i, n = 1, o = 1) {
|
|
4481
4737
|
const a = r + t * Math.cos(e) * n, l = s + t * Math.sin(e) * o, c = r + t * Math.cos(i) * n, h = s + t * Math.sin(i) * o;
|
|
4482
4738
|
return [
|
|
4483
4739
|
[a, l],
|
|
4484
4740
|
[c, h]
|
|
4485
4741
|
];
|
|
4486
4742
|
}
|
|
4487
|
-
class
|
|
4743
|
+
class me extends R {
|
|
4488
4744
|
constructor(t) {
|
|
4489
4745
|
super(t);
|
|
4490
4746
|
/** 控制点 */
|
|
@@ -4549,7 +4805,7 @@ class fe extends V {
|
|
|
4549
4805
|
return !1;
|
|
4550
4806
|
}
|
|
4551
4807
|
isPointInStroke(t, e) {
|
|
4552
|
-
return this.path && this.mainCanvas ? (this.setOverlayStyles(
|
|
4808
|
+
return this.path && this.mainCanvas ? (this.setOverlayStyles(R.ctx), this.isDraggable && (R.ctx.lineWidth = Math.max(R.ctx.lineWidth, 20)), R.ctx.isPointInStroke(this.path, t, e)) : !1;
|
|
4553
4809
|
}
|
|
4554
4810
|
isPointInAnywhere(t, e) {
|
|
4555
4811
|
return ((n) => {
|
|
@@ -4608,8 +4864,8 @@ class fe extends V {
|
|
|
4608
4864
|
if (!this.mainCanvas) return;
|
|
4609
4865
|
let { value: t, position: e } = this;
|
|
4610
4866
|
const [i, n] = [
|
|
4611
|
-
|
|
4612
|
-
|
|
4867
|
+
Yt(t) && t.length > 1,
|
|
4868
|
+
Yt(e) && e.length > 1
|
|
4613
4869
|
];
|
|
4614
4870
|
if (!i && !n)
|
|
4615
4871
|
return this.handlePoints = void 0, this.internalUpdate({ dynamicPosition: void 0 });
|
|
@@ -4651,7 +4907,7 @@ class fe extends V {
|
|
|
4651
4907
|
}
|
|
4652
4908
|
}
|
|
4653
4909
|
}
|
|
4654
|
-
class
|
|
4910
|
+
class rs extends es {
|
|
4655
4911
|
constructor(t) {
|
|
4656
4912
|
super(t);
|
|
4657
4913
|
/** 监听元素大小 */
|
|
@@ -4668,7 +4924,7 @@ class ss extends Ki {
|
|
|
4668
4924
|
maxYV: 0
|
|
4669
4925
|
});
|
|
4670
4926
|
/** 测量重绘性能 */
|
|
4671
|
-
d(this, "measureRedrawPerformance",
|
|
4927
|
+
d(this, "measureRedrawPerformance", ei(
|
|
4672
4928
|
() => {
|
|
4673
4929
|
this.isRendering = !0, this.redraw(), this.redrawInNextRenderFrame = !1, this.isRendering = !1;
|
|
4674
4930
|
},
|
|
@@ -4681,7 +4937,7 @@ class ss extends Ki {
|
|
|
4681
4937
|
}
|
|
4682
4938
|
));
|
|
4683
4939
|
this.canvas && (this.resizeObserver = new ResizeObserver(
|
|
4684
|
-
|
|
4940
|
+
Oe(() => {
|
|
4685
4941
|
[this.canvas.width, this.canvas.height] = [
|
|
4686
4942
|
this.rect.width,
|
|
4687
4943
|
this.rect.height
|
|
@@ -4728,7 +4984,7 @@ class ss extends Ki {
|
|
|
4728
4984
|
if (a !== h) return h - a;
|
|
4729
4985
|
if (l !== u)
|
|
4730
4986
|
return u - l;
|
|
4731
|
-
const m = (p) => p instanceof
|
|
4987
|
+
const m = (p) => p instanceof Bt ? 5 : p instanceof Ut ? 4 : p instanceof lt ? 3 : p instanceof Xt || p instanceof fe || p instanceof me ? 2 : p instanceof Gt ? 1 : 0;
|
|
4732
4988
|
return m(f) - m(c);
|
|
4733
4989
|
}
|
|
4734
4990
|
), this.currentDrawOverlays = t.map(
|
|
@@ -4763,7 +5019,7 @@ class ss extends Ki {
|
|
|
4763
5019
|
(t = this.resizeObserver) == null || t.disconnect();
|
|
4764
5020
|
}
|
|
4765
5021
|
}
|
|
4766
|
-
class
|
|
5022
|
+
class os extends rs {
|
|
4767
5023
|
constructor(t) {
|
|
4768
5024
|
super(t);
|
|
4769
5025
|
/** 鼠标是否在画布内 */
|
|
@@ -4866,16 +5122,16 @@ class ns extends ss {
|
|
|
4866
5122
|
keydown(t) {
|
|
4867
5123
|
const { mouseInCanvas: e, offset: i, delta: n, axisConfig: o } = this, a = t.key;
|
|
4868
5124
|
if (!e || !this.isDraggable || this.isAuto) return;
|
|
4869
|
-
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (
|
|
5125
|
+
const l = this.getStep(a), c = this.lastClickedOverlay, u = (c == null ? void 0 : c.isDraggable) && this.currentDrawOverlays.includes(c) && (Yt(c.value) ? "Matrix" : ge(c.value) ? "Single" : !1), f = (y, w) => {
|
|
4870
5126
|
if (!u)
|
|
4871
5127
|
return i.x += y * l, i.y += w * l, !0;
|
|
4872
|
-
const b = this.getAxisValueByPoint(l, 0).xV, [C,
|
|
5128
|
+
const b = this.getAxisValueByPoint(l, 0).xV, [C, E] = [b * o.x, b * o.y];
|
|
4873
5129
|
if (u === "Single") {
|
|
4874
5130
|
const A = c.value;
|
|
4875
|
-
A[0] += y * C, A[1] += w *
|
|
5131
|
+
A[0] += y * C, A[1] += w * E;
|
|
4876
5132
|
} else
|
|
4877
5133
|
c.value.forEach((A) => {
|
|
4878
|
-
A[0] += y * C, A[1] += w *
|
|
5134
|
+
A[0] += y * C, A[1] += w * E;
|
|
4879
5135
|
});
|
|
4880
5136
|
return c.value = [...c.value], !0;
|
|
4881
5137
|
}, m = (y) => (this.setScale("center", y * n), !0), g = {
|
|
@@ -4987,17 +5243,17 @@ class ns extends ss {
|
|
|
4987
5243
|
} else if (e.length === 2) {
|
|
4988
5244
|
const { clientX: h, clientY: u } = e[0], { clientX: f, clientY: m } = e[1];
|
|
4989
5245
|
if (i.length == 2) {
|
|
4990
|
-
const p =
|
|
5246
|
+
const p = Ee(
|
|
4991
5247
|
i[0],
|
|
4992
5248
|
n[0],
|
|
4993
5249
|
i[1],
|
|
4994
5250
|
n[1]
|
|
4995
|
-
), g =
|
|
5251
|
+
), g = Ee(
|
|
4996
5252
|
h,
|
|
4997
5253
|
u,
|
|
4998
5254
|
f,
|
|
4999
5255
|
m
|
|
5000
|
-
), { x: y, y: w } =
|
|
5256
|
+
), { x: y, y: w } = We(
|
|
5001
5257
|
h,
|
|
5002
5258
|
u,
|
|
5003
5259
|
f,
|
|
@@ -5018,7 +5274,7 @@ class ns extends ss {
|
|
|
5018
5274
|
super.destroy(), (t = this.unBind) == null || t.call(this);
|
|
5019
5275
|
}
|
|
5020
5276
|
}
|
|
5021
|
-
class et extends
|
|
5277
|
+
class et extends Vt {
|
|
5022
5278
|
constructor(t) {
|
|
5023
5279
|
super(t);
|
|
5024
5280
|
/** 覆盖物集合 */
|
|
@@ -5077,7 +5333,7 @@ class et extends Rt {
|
|
|
5077
5333
|
}), t;
|
|
5078
5334
|
}
|
|
5079
5335
|
}
|
|
5080
|
-
class it extends
|
|
5336
|
+
class it extends Vt {
|
|
5081
5337
|
constructor(t) {
|
|
5082
5338
|
super(t);
|
|
5083
5339
|
d(this, "_zIndex", 4);
|
|
@@ -5162,7 +5418,7 @@ class it extends Rt {
|
|
|
5162
5418
|
}
|
|
5163
5419
|
}
|
|
5164
5420
|
}
|
|
5165
|
-
class
|
|
5421
|
+
class Rt extends Vt {
|
|
5166
5422
|
constructor(t) {
|
|
5167
5423
|
super(t);
|
|
5168
5424
|
/** 图层群组 */
|
|
@@ -5226,7 +5482,7 @@ class Dt extends Rt {
|
|
|
5226
5482
|
return [];
|
|
5227
5483
|
}
|
|
5228
5484
|
}
|
|
5229
|
-
class
|
|
5485
|
+
class as extends os {
|
|
5230
5486
|
/** 获取默认覆盖物群组 */
|
|
5231
5487
|
getDefaultOverlayGroup() {
|
|
5232
5488
|
var a, l, c, h, u;
|
|
@@ -5249,7 +5505,7 @@ class rs extends ns {
|
|
|
5249
5505
|
const t = [], e = s !== void 0 ? Array.isArray(s) ? [...s] : [s] : Array.from(this.layerGroups.values());
|
|
5250
5506
|
for (; e.length > 0; ) {
|
|
5251
5507
|
const i = e.pop();
|
|
5252
|
-
if (i instanceof
|
|
5508
|
+
if (i instanceof Rt) {
|
|
5253
5509
|
if (!i.isVisible) continue;
|
|
5254
5510
|
e.push(...i.layers.values());
|
|
5255
5511
|
} else if (i instanceof it) {
|
|
@@ -5264,7 +5520,7 @@ class rs extends ns {
|
|
|
5264
5520
|
return t;
|
|
5265
5521
|
}
|
|
5266
5522
|
}
|
|
5267
|
-
class
|
|
5523
|
+
class ls extends as {
|
|
5268
5524
|
/** 缩放画布 */
|
|
5269
5525
|
zoom(s) {
|
|
5270
5526
|
const { canvas: t, rect: e } = this;
|
|
@@ -5297,7 +5553,7 @@ class os extends rs {
|
|
|
5297
5553
|
super.setDefaultCenter(s), this.redrawOnce();
|
|
5298
5554
|
}
|
|
5299
5555
|
}
|
|
5300
|
-
class
|
|
5556
|
+
class cs extends ls {
|
|
5301
5557
|
/**
|
|
5302
5558
|
* 调整视图以适应指定覆盖层
|
|
5303
5559
|
* @param overlays 目标覆盖层数组,默认使用全部可见覆盖层
|
|
@@ -5355,11 +5611,11 @@ class as extends os {
|
|
|
5355
5611
|
const m = s / u, p = t / f, g = Math.max(m, p), y = a.count, w = y / a.min, b = n * o;
|
|
5356
5612
|
let C;
|
|
5357
5613
|
if (g > w) {
|
|
5358
|
-
const
|
|
5359
|
-
C = 1 - ((y *
|
|
5614
|
+
const E = Math.ceil(g / w);
|
|
5615
|
+
C = 1 - ((y * E / g - a.min) / a.min + (E - 2)) * b;
|
|
5360
5616
|
} else {
|
|
5361
|
-
const
|
|
5362
|
-
C = 1 + ((y /
|
|
5617
|
+
const E = (ut, rt, vt) => ut < rt ? vt - 1 : E(ut / 2, rt, vt + 1), A = E(w, g, 0), G = Math.pow(2, A);
|
|
5618
|
+
C = 1 + ((y / G / g - a.min) / a.min + A) * b;
|
|
5363
5619
|
}
|
|
5364
5620
|
return i !== void 0 && (C = Math.min(i, C)), C = new D(C).div(o).round().mul(o).toNumber(), C;
|
|
5365
5621
|
}
|
|
@@ -5409,13 +5665,13 @@ class as extends os {
|
|
|
5409
5665
|
animateScale(s, t, e, i) {
|
|
5410
5666
|
const n = t - s;
|
|
5411
5667
|
let o = 0;
|
|
5412
|
-
|
|
5668
|
+
zt((a) => {
|
|
5413
5669
|
!this.isAuto || !this.canvas || !this.isInteractive || (this.setScale("center", (a - o) * n), o = a, this.redrawOnce(), a === 1 && i());
|
|
5414
5670
|
}, e);
|
|
5415
5671
|
}
|
|
5416
5672
|
/** 执行偏移动画 */
|
|
5417
5673
|
animateOffset(s, t, e, i) {
|
|
5418
|
-
|
|
5674
|
+
zt((n) => {
|
|
5419
5675
|
!this.isAuto || !this.canvas || !this.isInteractive || (this.offset = {
|
|
5420
5676
|
x: Number((s.x + t.x * n).toFixed(0)),
|
|
5421
5677
|
y: Number((s.y + t.y * n).toFixed(0))
|
|
@@ -5440,7 +5696,7 @@ class as extends os {
|
|
|
5440
5696
|
});
|
|
5441
5697
|
}
|
|
5442
5698
|
}
|
|
5443
|
-
class
|
|
5699
|
+
class hs extends cs {
|
|
5444
5700
|
/** 开关坐标轴 */
|
|
5445
5701
|
toggleAxis(s) {
|
|
5446
5702
|
this.drawAxis.toggleAxis(s), this.redrawOnce();
|
|
@@ -5465,7 +5721,7 @@ class ls extends as {
|
|
|
5465
5721
|
return this.isInteractive = s ?? !this.isInteractive, this.isInteractive;
|
|
5466
5722
|
}
|
|
5467
5723
|
}
|
|
5468
|
-
class
|
|
5724
|
+
class us extends hs {
|
|
5469
5725
|
/**
|
|
5470
5726
|
* 清除指定区域的像素点
|
|
5471
5727
|
* @param ctx - Canvas 2D绘图上下文
|
|
@@ -5476,9 +5732,9 @@ class cs extends ls {
|
|
|
5476
5732
|
s.save(), s.beginPath(), s.clip(t), s.clearRect(0, 0, e, i), s.restore();
|
|
5477
5733
|
}
|
|
5478
5734
|
}
|
|
5479
|
-
class
|
|
5735
|
+
class ds extends us {
|
|
5480
5736
|
}
|
|
5481
|
-
class
|
|
5737
|
+
class fs {
|
|
5482
5738
|
constructor(s) {
|
|
5483
5739
|
/** 画布 */
|
|
5484
5740
|
d(this, "canvas");
|
|
@@ -5593,33 +5849,33 @@ class us {
|
|
|
5593
5849
|
const y = i.y > c || i.y < 0;
|
|
5594
5850
|
let w = i.x > 0 ? i.x % p : i.x < 0 ? p + i.x % p : 0, b = s.getAxisValueByPoint((w - i.x) * n.x, 0).xV;
|
|
5595
5851
|
for (; w <= l; ) {
|
|
5596
|
-
const C =
|
|
5597
|
-
b !== 0 && this.drawText(C, w -
|
|
5852
|
+
const C = ne(b), E = h(C);
|
|
5853
|
+
b !== 0 && this.drawText(C, w - E / 2, g, y), w += p, b = new D(m).mul(n.x).add(b).toNumber();
|
|
5598
5854
|
}
|
|
5599
5855
|
}
|
|
5600
5856
|
{
|
|
5601
5857
|
const g = i.x > l || i.x < 0;
|
|
5602
5858
|
let y = i.y > 0 ? i.y % p : i.y < 0 ? p + i.y % p : 0, w = s.getAxisValueByPoint(0, (y - i.y) * n.y).yV;
|
|
5603
5859
|
for (; y <= c; ) {
|
|
5604
|
-
const b =
|
|
5605
|
-
let
|
|
5606
|
-
|
|
5860
|
+
const b = ne(w), C = h(b);
|
|
5861
|
+
let E = i.x - C - u;
|
|
5862
|
+
E = Math.max(Math.min(E, l - C - u), u), w != 0 && this.drawText(b, E, y + f / 2, g), y += p, w = new D(m).mul(n.y).add(w).toNumber();
|
|
5607
5863
|
}
|
|
5608
5864
|
}
|
|
5609
5865
|
}
|
|
5610
5866
|
}
|
|
5611
|
-
class
|
|
5867
|
+
class ms {
|
|
5612
5868
|
constructor(s) {
|
|
5613
5869
|
/** 绑定的画布实例 */
|
|
5614
5870
|
d(this, "canvas");
|
|
5615
|
-
d(this, "layerGroup", new
|
|
5871
|
+
d(this, "layerGroup", new I.LayerGroup({ name: "创建覆盖物图层群组" }));
|
|
5616
5872
|
/** 创建中覆盖物的绘制层(置顶以保证可见) */
|
|
5617
|
-
d(this, "overlayLayer", new
|
|
5873
|
+
d(this, "overlayLayer", new I.Layer({
|
|
5618
5874
|
name: "creator-layer",
|
|
5619
5875
|
zIndex: 9999
|
|
5620
5876
|
}));
|
|
5621
5877
|
/** 该层内的覆盖物分组,便于统一增删 */
|
|
5622
|
-
d(this, "overlayGroup", new
|
|
5878
|
+
d(this, "overlayGroup", new I.OverlayGroup({ name: "creator-group" }));
|
|
5623
5879
|
/** 当前正在创建的覆盖物(多边形或线),其顶点通过 overlay.value 即坐标轴上的值表示 */
|
|
5624
5880
|
d(this, "overlay");
|
|
5625
5881
|
/** 已确定的顶点在坐标轴上的值列表 [x, y][],对应 overlay.value */
|
|
@@ -5682,10 +5938,10 @@ class ds {
|
|
|
5682
5938
|
}), this.savedLayerGroupInteractive.clear();
|
|
5683
5939
|
}
|
|
5684
5940
|
createLine() {
|
|
5685
|
-
return this.disableOtherLayerGroups(), this.overlay && this.overlayGroup.removeOverlays(this.overlay), this.axisValueList = [], this.overlay = new
|
|
5941
|
+
return this.disableOtherLayerGroups(), this.overlay && this.overlayGroup.removeOverlays(this.overlay), this.axisValueList = [], this.overlay = new I.Line({}), this.overlayGroup.addOverlays(this.overlay), this.overlay;
|
|
5686
5942
|
}
|
|
5687
5943
|
createPolygon() {
|
|
5688
|
-
return this.disableOtherLayerGroups(), this.overlay && this.overlayGroup.removeOverlays(this.overlay), this.axisValueList = [], this.overlay = new
|
|
5944
|
+
return this.disableOtherLayerGroups(), this.overlay && this.overlayGroup.removeOverlays(this.overlay), this.axisValueList = [], this.overlay = new I.Polygon({}), this.overlayGroup.addOverlays(this.overlay), this.overlay;
|
|
5689
5945
|
}
|
|
5690
5946
|
/** 从创建层中移除指定覆盖物,不传则清空该层全部 */
|
|
5691
5947
|
removeOverlays(s) {
|
|
@@ -5701,7 +5957,7 @@ class ds {
|
|
|
5701
5957
|
}
|
|
5702
5958
|
/** 当前类型完成绘制所需的最少顶点数(多边形 3,线 2) */
|
|
5703
5959
|
get minPointCount() {
|
|
5704
|
-
return this.overlay instanceof
|
|
5960
|
+
return this.overlay instanceof I.Polygon ? 3 : this.overlay instanceof I.Line ? 2 : 0;
|
|
5705
5961
|
}
|
|
5706
5962
|
/** 从鼠标事件得到坐标轴上的 [x, y],若设置了限位器则先限位再返回 */
|
|
5707
5963
|
getAxisValueFromEvent(s) {
|
|
@@ -5713,7 +5969,7 @@ class ds {
|
|
|
5713
5969
|
}
|
|
5714
5970
|
}
|
|
5715
5971
|
}
|
|
5716
|
-
class
|
|
5972
|
+
class gs {
|
|
5717
5973
|
/**
|
|
5718
5974
|
* 计算默认缩放比例,使图像适配视图容器
|
|
5719
5975
|
* @param naturalWidth 图像原始宽度
|
|
@@ -5748,15 +6004,15 @@ class fs {
|
|
|
5748
6004
|
};
|
|
5749
6005
|
}
|
|
5750
6006
|
}
|
|
5751
|
-
function
|
|
6007
|
+
function Nt(r) {
|
|
5752
6008
|
return [r].flat(1 / 0);
|
|
5753
6009
|
}
|
|
5754
|
-
class
|
|
6010
|
+
class I extends ds {
|
|
5755
6011
|
constructor(t) {
|
|
5756
6012
|
super(t);
|
|
5757
6013
|
/** 按坐标轴值创建覆盖物(多边形/线)的交互管理 */
|
|
5758
6014
|
d(this, "overlayCreator");
|
|
5759
|
-
this.drawAxis = new
|
|
6015
|
+
this.drawAxis = new fs(this), "axisShow" in t && this.toggleAxis(t.axisShow), this.overlayCreator = new ms(this), this.initLayerGroups(), this.updateCenter();
|
|
5760
6016
|
}
|
|
5761
6017
|
initLayerGroups() {
|
|
5762
6018
|
const t = new it({ name: "多边形图层", zIndex: 1 });
|
|
@@ -5769,7 +6025,7 @@ class L extends hs {
|
|
|
5769
6025
|
n.addGroup(new et({ name: "文字覆盖物群组" }));
|
|
5770
6026
|
const o = new it({ name: "自定义绘制图层", zIndex: 5 });
|
|
5771
6027
|
o.addGroup(new et({ name: "自定义绘制覆盖物群组" }));
|
|
5772
|
-
const a = new
|
|
6028
|
+
const a = new Rt({ name: "默认图层群组" });
|
|
5773
6029
|
a.addLayer([
|
|
5774
6030
|
n,
|
|
5775
6031
|
i,
|
|
@@ -5784,21 +6040,21 @@ class L extends hs {
|
|
|
5784
6040
|
}
|
|
5785
6041
|
/** 设置图层群组 */
|
|
5786
6042
|
setLayerGroup(t) {
|
|
5787
|
-
t instanceof
|
|
6043
|
+
t instanceof Rt && (this.layerGroups.set(t.name, t), t.setNotifyReload(() => this.redrawOnce()), t.setMainCanvas(this), t.parent = this);
|
|
5788
6044
|
}
|
|
5789
6045
|
/** 移除图层群组 */
|
|
5790
6046
|
removeLayerGroup(t) {
|
|
5791
|
-
t instanceof
|
|
6047
|
+
t instanceof Rt && (this.layerGroups.delete(t.name), t.setNotifyReload(), t.setMainCanvas(), t.parent = void 0, this.redrawOnce());
|
|
5792
6048
|
}
|
|
5793
6049
|
/** 添加图层 */
|
|
5794
6050
|
addLayer(t) {
|
|
5795
6051
|
const e = this.layerGroups.get("默认图层群组");
|
|
5796
|
-
e && e.addLayer(
|
|
6052
|
+
e && e.addLayer(Nt(t));
|
|
5797
6053
|
}
|
|
5798
6054
|
/** 移除图层 */
|
|
5799
6055
|
removeLayer(t) {
|
|
5800
6056
|
const e = this.layerGroups.get("默认图层群组");
|
|
5801
|
-
e && e.removeLayer(
|
|
6057
|
+
e && e.removeLayer(Nt(t));
|
|
5802
6058
|
}
|
|
5803
6059
|
/** 添加覆盖物 */
|
|
5804
6060
|
addOverlay(t) {
|
|
@@ -5809,8 +6065,8 @@ class L extends hs {
|
|
|
5809
6065
|
overlays_polygon: o,
|
|
5810
6066
|
overlays_custom: a
|
|
5811
6067
|
} = this.getDefaultOverlayGroup() || {};
|
|
5812
|
-
|
|
5813
|
-
l instanceof
|
|
6068
|
+
Nt(t).forEach((l) => {
|
|
6069
|
+
l instanceof Ut ? e == null || e.addOverlays(l) : l instanceof lt ? i == null || i.addOverlays(l) : l instanceof Xt || l instanceof fe || l instanceof me ? n == null || n.addOverlays(l) : l instanceof Gt ? o == null || o.addOverlays(l) : l instanceof Bt && (a == null || a.addOverlays(l));
|
|
5814
6070
|
});
|
|
5815
6071
|
}
|
|
5816
6072
|
/** 移除覆盖物 */
|
|
@@ -5822,8 +6078,8 @@ class L extends hs {
|
|
|
5822
6078
|
overlays_polygon: o,
|
|
5823
6079
|
overlays_custom: a
|
|
5824
6080
|
} = this.getDefaultOverlayGroup() || {};
|
|
5825
|
-
|
|
5826
|
-
l instanceof
|
|
6081
|
+
Nt(t).forEach((l) => {
|
|
6082
|
+
l instanceof Ut ? e == null || e.removeOverlays(l) : l instanceof lt ? i == null || i.removeOverlays(l) : l instanceof Xt ? n == null || n.removeOverlays(l) : l instanceof Gt ? o == null || o.removeOverlays(l) : l instanceof Bt && (a == null || a.addOverlays(l));
|
|
5827
6083
|
});
|
|
5828
6084
|
}
|
|
5829
6085
|
/** 销毁 */
|
|
@@ -5832,18 +6088,18 @@ class L extends hs {
|
|
|
5832
6088
|
}
|
|
5833
6089
|
}
|
|
5834
6090
|
/** 视图适配工具:默认缩放、居中计算 */
|
|
5835
|
-
d(
|
|
5836
|
-
d(
|
|
5837
|
-
d(
|
|
5838
|
-
d(
|
|
5839
|
-
d(
|
|
5840
|
-
d(
|
|
5841
|
-
d(
|
|
5842
|
-
d(
|
|
5843
|
-
d(
|
|
5844
|
-
d(
|
|
5845
|
-
d(
|
|
5846
|
-
class
|
|
6091
|
+
d(I, "ViewFit", gs), /** 图层群组 */
|
|
6092
|
+
d(I, "LayerGroup", Rt), /** 图层 */
|
|
6093
|
+
d(I, "Layer", it), /** 覆盖物群组 */
|
|
6094
|
+
d(I, "OverlayGroup", et), /** 文字 */
|
|
6095
|
+
d(I, "Text", Ut), /** 点位 */
|
|
6096
|
+
d(I, "Point", lt), /** 线段 */
|
|
6097
|
+
d(I, "Line", Xt), /** 多边形 */
|
|
6098
|
+
d(I, "Polygon", Gt), /** 自定义绘制 */
|
|
6099
|
+
d(I, "Custom", Bt), /** 圆弧 */
|
|
6100
|
+
d(I, "Arc", fe), /** 圆角 */
|
|
6101
|
+
d(I, "ArcTo", me);
|
|
6102
|
+
class ps {
|
|
5847
6103
|
/** @param id canvas DOM id(通过 getElementById 定位) */
|
|
5848
6104
|
constructor(s) {
|
|
5849
6105
|
/** Canvas DOM id(用于 `document.getElementById` 定位) */
|
|
@@ -5897,7 +6153,7 @@ class ms {
|
|
|
5897
6153
|
this.resizeObserver && (this.resizeObserver.disconnect(), this.resizeObserver = void 0);
|
|
5898
6154
|
}
|
|
5899
6155
|
}
|
|
5900
|
-
class
|
|
6156
|
+
class vs {
|
|
5901
6157
|
/**
|
|
5902
6158
|
* @param canvas 绑定 mousedown 的 canvas
|
|
5903
6159
|
* @param onOffsetDelta 拖拽时的 dx 回调(由外部映射到时间偏移)
|
|
@@ -5936,7 +6192,7 @@ class gs {
|
|
|
5936
6192
|
this.canvas.removeEventListener("mousedown", this.handleMouseDown), window.removeEventListener("mousemove", this.handleMouseMove), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
5937
6193
|
}
|
|
5938
6194
|
}
|
|
5939
|
-
class
|
|
6195
|
+
class ys {
|
|
5940
6196
|
/**
|
|
5941
6197
|
* @param canvas 绑定 wheel 事件的 canvas
|
|
5942
6198
|
* @param getTimeSpacing 读取当前 timeSpacing 的函数
|
|
@@ -5971,7 +6227,7 @@ class ps {
|
|
|
5971
6227
|
this.canvas.removeEventListener("wheel", this.handleWheel);
|
|
5972
6228
|
}
|
|
5973
6229
|
}
|
|
5974
|
-
class
|
|
6230
|
+
class ws {
|
|
5975
6231
|
/**
|
|
5976
6232
|
* 只负责计算鼠标所在 x/y 对应的时间,并把结果通知给 TimeAxis(不直接操作 DOM)。
|
|
5977
6233
|
*/
|
|
@@ -6008,10 +6264,10 @@ class vs {
|
|
|
6008
6264
|
this.canvas.removeEventListener("mousemove", this.handleMouseMove), this.canvas.removeEventListener("mouseleave", this.handleMouseLeave);
|
|
6009
6265
|
}
|
|
6010
6266
|
}
|
|
6011
|
-
const
|
|
6267
|
+
const xs = {
|
|
6012
6268
|
easeInOutQuad: (r) => r < 0.5 ? 2 * r * r : 1 - Math.pow(-2 * r + 2, 2) / 2
|
|
6013
6269
|
};
|
|
6014
|
-
class
|
|
6270
|
+
class Ps {
|
|
6015
6271
|
/**
|
|
6016
6272
|
* 创建时间轴引擎:会在构造后 `requestAnimationFrame` 初始化并开始渲染。
|
|
6017
6273
|
* @param id canvas DOM id
|
|
@@ -6057,13 +6313,13 @@ class ws {
|
|
|
6057
6313
|
* 可用于叠加额外图形(如指示线、事件点等)
|
|
6058
6314
|
*/
|
|
6059
6315
|
d(this, "onDrawOverlay");
|
|
6060
|
-
this.canvasManager = new
|
|
6316
|
+
this.canvasManager = new ps(s), this.onMouseTimeChange = t, requestAnimationFrame(() => this.init());
|
|
6061
6317
|
}
|
|
6062
6318
|
/** 初始化交互:拖拽平移、滚轮缩放、鼠标时间通知,并触发首次绘制 */
|
|
6063
6319
|
init() {
|
|
6064
6320
|
if (!this.canvasManager.init(() => this.render())) return;
|
|
6065
6321
|
const t = this.canvasManager.getCanvas();
|
|
6066
|
-
t && (this.offsetDrag = new
|
|
6322
|
+
t && (this.offsetDrag = new vs(
|
|
6067
6323
|
t,
|
|
6068
6324
|
(e) => {
|
|
6069
6325
|
this.currentTime -= Math.round(
|
|
@@ -6073,14 +6329,14 @@ class ws {
|
|
|
6073
6329
|
() => {
|
|
6074
6330
|
this.stopCenterTimeAnimation();
|
|
6075
6331
|
}
|
|
6076
|
-
), this.wheelZoom = new
|
|
6332
|
+
), this.wheelZoom = new ys(
|
|
6077
6333
|
t,
|
|
6078
6334
|
() => this.timeSpacing,
|
|
6079
6335
|
(e, i) => {
|
|
6080
6336
|
const n = this.getTimeAtCanvasX(i);
|
|
6081
6337
|
this.timeSpacing = e, this.setTimeAtCanvasX(n, i), this.render();
|
|
6082
6338
|
}
|
|
6083
|
-
), this.centerTime = Date.now(), this.mouseTimeReporter = new
|
|
6339
|
+
), this.centerTime = Date.now(), this.mouseTimeReporter = new ws(
|
|
6084
6340
|
t,
|
|
6085
6341
|
(e) => this.getTimeAtCanvasX(e),
|
|
6086
6342
|
(e) => {
|
|
@@ -6124,7 +6380,7 @@ class ws {
|
|
|
6124
6380
|
for (; y <= f; ) {
|
|
6125
6381
|
const w = g % o === 0, b = w ? a : l;
|
|
6126
6382
|
if (s.fillRect(y, 0, 1, b), w) {
|
|
6127
|
-
const C =
|
|
6383
|
+
const C = Qe(p, "MM-DD hh:mm:ss");
|
|
6128
6384
|
s.fillText(C, y, c), p += t;
|
|
6129
6385
|
}
|
|
6130
6386
|
y += m, g++;
|
|
@@ -6179,8 +6435,8 @@ class ws {
|
|
|
6179
6435
|
Math.max(0.5, h)
|
|
6180
6436
|
);
|
|
6181
6437
|
return Math.max(1, Math.round(u * 60));
|
|
6182
|
-
})(), a = (t == null ? void 0 : t.curve) ??
|
|
6183
|
-
|
|
6438
|
+
})(), a = (t == null ? void 0 : t.curve) ?? xs.easeInOutQuad;
|
|
6439
|
+
Ze(
|
|
6184
6440
|
0,
|
|
6185
6441
|
1,
|
|
6186
6442
|
o,
|
|
@@ -6201,7 +6457,27 @@ class ws {
|
|
|
6201
6457
|
(s = this.offsetDrag) == null || s.destroy(), (t = this.wheelZoom) == null || t.destroy(), (e = this.mouseTimeReporter) == null || e.destroy(), this.canvasManager.destroy();
|
|
6202
6458
|
}
|
|
6203
6459
|
}
|
|
6204
|
-
class
|
|
6460
|
+
class un extends Ps {
|
|
6461
|
+
/**
|
|
6462
|
+
* 将填充样式解析为 ctx.fillStyle 可用的值(纯色或线性渐变)
|
|
6463
|
+
* @param rect 矩形区域,用于计算渐变起止点
|
|
6464
|
+
* @param fillStyle 纯色字符串或渐变配置
|
|
6465
|
+
*/
|
|
6466
|
+
resolveFillStyle(s, t) {
|
|
6467
|
+
if (!t) return;
|
|
6468
|
+
const e = this.canvasManager.getContext();
|
|
6469
|
+
if (!e) return;
|
|
6470
|
+
if (typeof t == "string") return t;
|
|
6471
|
+
const i = e.createLinearGradient(
|
|
6472
|
+
s.x + s.width * t.x1,
|
|
6473
|
+
s.y + s.height * t.y1,
|
|
6474
|
+
s.x + s.width * t.x2,
|
|
6475
|
+
s.y + s.height * t.y2
|
|
6476
|
+
);
|
|
6477
|
+
return t.colorStops.forEach(
|
|
6478
|
+
({ color: n, offset: o }) => i.addColorStop(o, n)
|
|
6479
|
+
), i;
|
|
6480
|
+
}
|
|
6205
6481
|
/**
|
|
6206
6482
|
* 按时间范围绘制圆角矩形(常用于高亮某段时间区间)
|
|
6207
6483
|
*/
|
|
@@ -6218,11 +6494,13 @@ class rn extends ws {
|
|
|
6218
6494
|
strokeStyle: h = "#2080f0",
|
|
6219
6495
|
lineWidth: u = 1
|
|
6220
6496
|
} = s, f = this.getCanvasXAtTime(i), p = this.getCanvasXAtTime(n) - f;
|
|
6221
|
-
|
|
6497
|
+
if (!p) return;
|
|
6498
|
+
const g = this.resolveFillStyle({ x: f, y: o, width: p, height: a }, c);
|
|
6499
|
+
g && (t.fillStyle = g), h && (t.strokeStyle = h), t.lineWidth = u, t.beginPath(), typeof t.roundRect == "function" ? t.roundRect(f, o, p, a + o, l) : t.rect(f, o, p, a + o), c && t.fill(), h && t.stroke();
|
|
6222
6500
|
}
|
|
6223
6501
|
}
|
|
6224
|
-
function
|
|
6225
|
-
const s =
|
|
6502
|
+
function dn(r) {
|
|
6503
|
+
const s = Oe(r, 100);
|
|
6226
6504
|
let t = 0, e = 0;
|
|
6227
6505
|
return function(i) {
|
|
6228
6506
|
const n = i.target;
|
|
@@ -6250,7 +6528,7 @@ function on(r) {
|
|
|
6250
6528
|
f(), m();
|
|
6251
6529
|
};
|
|
6252
6530
|
}
|
|
6253
|
-
function
|
|
6531
|
+
function fn(r, s, t) {
|
|
6254
6532
|
const { isClickAllowed: e, uiLibrary: i = ["naiveUI", "ElementPlus", "Element"] } = t || {}, n = function(l) {
|
|
6255
6533
|
const c = [];
|
|
6256
6534
|
for (const h in l)
|
|
@@ -6282,21 +6560,21 @@ function an(r, s, t) {
|
|
|
6282
6560
|
() => document.addEventListener("mousedown", a)
|
|
6283
6561
|
);
|
|
6284
6562
|
}
|
|
6285
|
-
var Y, dt, ft,
|
|
6286
|
-
class
|
|
6563
|
+
var Y, dt, ft, xt, Pt, Z, Q, st, bt;
|
|
6564
|
+
class mn {
|
|
6287
6565
|
constructor() {
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6566
|
+
T(this, Y);
|
|
6567
|
+
T(this, dt, !1);
|
|
6568
|
+
T(this, ft, {});
|
|
6569
|
+
T(this, xt, 0);
|
|
6570
|
+
T(this, Pt, 0);
|
|
6571
|
+
T(this, Z, 0);
|
|
6572
|
+
T(this, Q, 0);
|
|
6573
|
+
T(this, st);
|
|
6574
|
+
T(this, bt);
|
|
6297
6575
|
}
|
|
6298
6576
|
init(s, t) {
|
|
6299
|
-
|
|
6577
|
+
M(this, Y, s), M(this, st, t == null ? void 0 : t.limit), M(this, bt, t == null ? void 0 : t.dragDom), M(this, ft, {
|
|
6300
6578
|
mousedown: this.mousedown.bind(this),
|
|
6301
6579
|
mousemove: this.mousemove.bind(this),
|
|
6302
6580
|
mouseup: this.mouseup.bind(this)
|
|
@@ -6312,40 +6590,40 @@ class ln {
|
|
|
6312
6590
|
}
|
|
6313
6591
|
alterLocation() {
|
|
6314
6592
|
if (!x(this, Y)) return console.error("No DOM");
|
|
6315
|
-
x(this, st) && (
|
|
6593
|
+
x(this, st) && (M(this, Z, Math.min(x(this, Z), x(this, st).max.top)), M(this, Z, Math.max(x(this, Z), x(this, st).min.top)), M(this, Q, Math.min(x(this, Q), x(this, st).max.left)), M(this, Q, Math.max(x(this, Q), x(this, st).min.left))), x(this, Y).style.setProperty("--top", x(this, Z) + "px"), x(this, Y).style.setProperty("--left", x(this, Q) + "px");
|
|
6316
6594
|
}
|
|
6317
6595
|
mousedown(s) {
|
|
6318
6596
|
if (!x(this, Y)) return console.error("No DOM");
|
|
6319
|
-
if (x(this,
|
|
6320
|
-
document.body.classList.add("no-select"),
|
|
6597
|
+
if (x(this, bt) && s.target != x(this, bt)) return;
|
|
6598
|
+
document.body.classList.add("no-select"), M(this, dt, !0);
|
|
6321
6599
|
const t = x(this, Y).getBoundingClientRect(), { pageX: e, pageY: i } = s;
|
|
6322
|
-
|
|
6600
|
+
M(this, xt, e), M(this, Pt, i), M(this, Z, t.y), M(this, Q, t.x);
|
|
6323
6601
|
}
|
|
6324
6602
|
mousemove(s) {
|
|
6325
6603
|
const { pageX: t, pageY: e } = s;
|
|
6326
|
-
x(this, dt) && (
|
|
6604
|
+
x(this, dt) && (M(this, Z, x(this, Z) + (e - x(this, Pt))), M(this, Q, x(this, Q) + (t - x(this, xt))), M(this, xt, t), M(this, Pt, e), this.alterLocation());
|
|
6327
6605
|
}
|
|
6328
6606
|
mouseup() {
|
|
6329
|
-
x(this, dt) && (
|
|
6607
|
+
x(this, dt) && (M(this, dt, !1), document.body.classList.remove("no-select"));
|
|
6330
6608
|
}
|
|
6331
6609
|
}
|
|
6332
|
-
Y = new WeakMap(), dt = new WeakMap(), ft = new WeakMap(),
|
|
6333
|
-
var
|
|
6334
|
-
class
|
|
6610
|
+
Y = new WeakMap(), dt = new WeakMap(), ft = new WeakMap(), xt = new WeakMap(), Pt = new WeakMap(), Z = new WeakMap(), Q = new WeakMap(), st = new WeakMap(), bt = new WeakMap();
|
|
6611
|
+
var W, mt, gt, Ct, St, j, q, U, _t, Et;
|
|
6612
|
+
class gn {
|
|
6335
6613
|
constructor() {
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6614
|
+
T(this, W);
|
|
6615
|
+
T(this, mt, !1);
|
|
6616
|
+
T(this, gt, {});
|
|
6617
|
+
T(this, Ct, 0);
|
|
6618
|
+
T(this, St, 0);
|
|
6619
|
+
T(this, j, 0);
|
|
6620
|
+
T(this, q, 0);
|
|
6621
|
+
T(this, U);
|
|
6622
|
+
T(this, _t);
|
|
6623
|
+
T(this, Et);
|
|
6346
6624
|
}
|
|
6347
6625
|
init(s, t = {}) {
|
|
6348
|
-
|
|
6626
|
+
M(this, W, s), M(this, U, t.limit), M(this, _t, t.update_move), M(this, Et, t.update_up), M(this, gt, {
|
|
6349
6627
|
mousedown: this.mousedown.bind(this),
|
|
6350
6628
|
mousemove: this.mousemove.bind(this),
|
|
6351
6629
|
mouseup: this.mouseup.bind(this)
|
|
@@ -6356,17 +6634,17 @@ class cn {
|
|
|
6356
6634
|
}
|
|
6357
6635
|
bindOrUnbindEvent(s) {
|
|
6358
6636
|
const t = s === "bind" ? "addEventListener" : "removeEventListener";
|
|
6359
|
-
if (!x(this,
|
|
6360
|
-
x(this,
|
|
6637
|
+
if (!x(this, W)) return console.error("No DOM");
|
|
6638
|
+
x(this, W)[t]("mousedown", x(this, gt).mousedown), document[t]("mousemove", x(this, gt).mousemove), document[t]("mouseup", x(this, gt).mouseup);
|
|
6361
6639
|
}
|
|
6362
6640
|
updateValue() {
|
|
6363
6641
|
const s = {
|
|
6364
|
-
top: x(this,
|
|
6642
|
+
top: x(this, j),
|
|
6365
6643
|
left: x(this, q),
|
|
6366
6644
|
percentage: { top: 0, left: 0 }
|
|
6367
6645
|
};
|
|
6368
|
-
if (x(this,
|
|
6369
|
-
const t = (e) => x(this,
|
|
6646
|
+
if (x(this, U)) {
|
|
6647
|
+
const t = (e) => x(this, U) ? (s[e] - x(this, U).min[e]) / (x(this, U).max[e] - x(this, U).min[e]) : 0;
|
|
6370
6648
|
s.percentage = {
|
|
6371
6649
|
top: t("top") || 0,
|
|
6372
6650
|
left: t("left") || 0
|
|
@@ -6375,27 +6653,27 @@ class cn {
|
|
|
6375
6653
|
return s;
|
|
6376
6654
|
}
|
|
6377
6655
|
alterLocation() {
|
|
6378
|
-
if (!x(this,
|
|
6379
|
-
x(this,
|
|
6656
|
+
if (!x(this, W)) return console.error("No DOM");
|
|
6657
|
+
x(this, U) && (M(this, j, Math.min(x(this, j), x(this, U).max.top)), M(this, j, Math.max(x(this, j), x(this, U).min.top)), M(this, q, Math.min(x(this, q), x(this, U).max.left)), M(this, q, Math.max(x(this, q), x(this, U).min.left))), x(this, _t) && x(this, _t).call(this, this.updateValue()), x(this, W).style.setProperty("--top", x(this, j) + "px"), x(this, W).style.setProperty("--left", x(this, q) + "px");
|
|
6380
6658
|
}
|
|
6381
6659
|
mousedown(s) {
|
|
6382
|
-
if (!x(this,
|
|
6383
|
-
document.body.classList.add("no-select"),
|
|
6384
|
-
const t = x(this,
|
|
6385
|
-
|
|
6660
|
+
if (!x(this, W)) return console.error("No DOM");
|
|
6661
|
+
document.body.classList.add("no-select"), M(this, mt, !0);
|
|
6662
|
+
const t = x(this, W).getBoundingClientRect();
|
|
6663
|
+
M(this, St, t.y), M(this, Ct, t.x);
|
|
6386
6664
|
const { pageX: e, pageY: i } = s;
|
|
6387
|
-
|
|
6665
|
+
M(this, j, i - x(this, St)), M(this, q, e - x(this, Ct)), this.alterLocation();
|
|
6388
6666
|
}
|
|
6389
6667
|
mousemove(s) {
|
|
6390
6668
|
const { pageX: t, pageY: e } = s;
|
|
6391
|
-
x(this, mt) && (
|
|
6669
|
+
x(this, mt) && (M(this, j, e - x(this, St)), M(this, q, t - x(this, Ct)), this.alterLocation());
|
|
6392
6670
|
}
|
|
6393
6671
|
mouseup() {
|
|
6394
|
-
x(this, mt) && (
|
|
6672
|
+
x(this, mt) && (M(this, mt, !1), document.body.classList.remove("no-select"), x(this, Et) && x(this, Et).call(this, this.updateValue()));
|
|
6395
6673
|
}
|
|
6396
6674
|
}
|
|
6397
|
-
|
|
6398
|
-
function
|
|
6675
|
+
W = new WeakMap(), mt = new WeakMap(), gt = new WeakMap(), Ct = new WeakMap(), St = new WeakMap(), j = new WeakMap(), q = new WeakMap(), U = new WeakMap(), _t = new WeakMap(), Et = new WeakMap();
|
|
6676
|
+
function te(r) {
|
|
6399
6677
|
if (typeof r == "string") {
|
|
6400
6678
|
const s = document.querySelector(r);
|
|
6401
6679
|
if (s)
|
|
@@ -6404,35 +6682,35 @@ function Kt(r) {
|
|
|
6404
6682
|
} else
|
|
6405
6683
|
return r || document.documentElement;
|
|
6406
6684
|
}
|
|
6407
|
-
function
|
|
6408
|
-
const s =
|
|
6685
|
+
function bs(r) {
|
|
6686
|
+
const s = te(r);
|
|
6409
6687
|
return s ? s.requestFullscreen ? s.requestFullscreen() : s.mozRequestFullScreen ? s.mozRequestFullScreen() : s.webkitRequestFullscreen ? s.webkitRequestFullscreen() : s.msRequestFullscreen ? s.msRequestFullscreen() : Promise.reject("No Fullscreen API") : Promise.reject("No Element");
|
|
6410
6688
|
}
|
|
6411
|
-
function
|
|
6689
|
+
function Cs() {
|
|
6412
6690
|
const r = document;
|
|
6413
6691
|
return document.exitFullscreen ? document.exitFullscreen() : r.mozCancelFullScreen ? r.mozCancelFullScreen() : r.webkitExitFullscreen ? r.webkitExitFullscreen() : r.msExitFullscreen ? r.msExitFullscreen() : Promise.reject("No ExitFullscreen API");
|
|
6414
6692
|
}
|
|
6415
|
-
function
|
|
6416
|
-
const s =
|
|
6693
|
+
function Ye(r) {
|
|
6694
|
+
const s = te(r), t = document, e = document.fullscreenElement || t.webkitFullscreenElement || t.mozFullScreenElement || t.msFullscreenElement;
|
|
6417
6695
|
return s == e || !r && window.innerWidth == screen.width && window.innerHeight == screen.height;
|
|
6418
6696
|
}
|
|
6419
|
-
function
|
|
6420
|
-
if (r =
|
|
6697
|
+
function pn(r) {
|
|
6698
|
+
if (r = te(r), !!r)
|
|
6421
6699
|
return function() {
|
|
6422
|
-
|
|
6700
|
+
Ye(r) ? Cs() : bs(r);
|
|
6423
6701
|
};
|
|
6424
6702
|
}
|
|
6425
|
-
function
|
|
6426
|
-
const t =
|
|
6703
|
+
function vn(r, s) {
|
|
6704
|
+
const t = te(s);
|
|
6427
6705
|
if (!t) return;
|
|
6428
6706
|
const e = () => {
|
|
6429
|
-
r(
|
|
6707
|
+
r(Ye(t));
|
|
6430
6708
|
};
|
|
6431
6709
|
return document.addEventListener("fullscreenchange", e), document.addEventListener("webkitfullscreenchange", e), document.addEventListener("mozfullscreenchange", e), document.addEventListener("MSFullscreenChange", e), e(), () => {
|
|
6432
6710
|
document.removeEventListener("fullscreenchange", e), document.removeEventListener("webkitfullscreenchange", e), document.removeEventListener("mozfullscreenchange", e), document.removeEventListener("MSFullscreenChange", e);
|
|
6433
6711
|
};
|
|
6434
6712
|
}
|
|
6435
|
-
function
|
|
6713
|
+
function yn(r, s) {
|
|
6436
6714
|
if (typeof r == "number") return r;
|
|
6437
6715
|
if (/px/.test(r)) return Number(r.replace(/px/, "")) || 0;
|
|
6438
6716
|
const t = document.createElement("div");
|
|
@@ -6440,7 +6718,7 @@ function dn(r, s) {
|
|
|
6440
6718
|
const e = t.getBoundingClientRect().width;
|
|
6441
6719
|
return s.removeChild(t), e;
|
|
6442
6720
|
}
|
|
6443
|
-
function
|
|
6721
|
+
function wn(r, s) {
|
|
6444
6722
|
if (!r) return;
|
|
6445
6723
|
let t, e;
|
|
6446
6724
|
if (typeof s == "string") {
|
|
@@ -6457,7 +6735,7 @@ function fn(r, s) {
|
|
|
6457
6735
|
const i = t / e;
|
|
6458
6736
|
return i > r ? [r * e, e] : i < r ? [t, t / r] : [t, e];
|
|
6459
6737
|
}
|
|
6460
|
-
function
|
|
6738
|
+
function xn(r, s = 5e3) {
|
|
6461
6739
|
return new Promise((t, e) => {
|
|
6462
6740
|
const i = new Image();
|
|
6463
6741
|
i.src = r;
|
|
@@ -6473,7 +6751,7 @@ function mn(r, s = 5e3) {
|
|
|
6473
6751
|
}, i.crossOrigin = "Anonymous";
|
|
6474
6752
|
});
|
|
6475
6753
|
}
|
|
6476
|
-
function
|
|
6754
|
+
function Pn(r) {
|
|
6477
6755
|
const t = document.getElementById(r).querySelectorAll("img"), e = t.length, i = [];
|
|
6478
6756
|
let n = 0;
|
|
6479
6757
|
return e === 0 ? Promise.resolve({
|
|
@@ -6515,14 +6793,14 @@ function gn(r) {
|
|
|
6515
6793
|
});
|
|
6516
6794
|
});
|
|
6517
6795
|
}
|
|
6518
|
-
function
|
|
6796
|
+
function bn(r) {
|
|
6519
6797
|
return new Promise((s, t) => {
|
|
6520
6798
|
fetch(r).then((e) => s(e.text())).catch((e) => {
|
|
6521
6799
|
console.error("Error fetching :", e), t(e);
|
|
6522
6800
|
});
|
|
6523
6801
|
});
|
|
6524
6802
|
}
|
|
6525
|
-
function
|
|
6803
|
+
function Ss(r) {
|
|
6526
6804
|
const {
|
|
6527
6805
|
href: s,
|
|
6528
6806
|
fileName: t,
|
|
@@ -6531,7 +6809,7 @@ function bs(r) {
|
|
|
6531
6809
|
autoDownload: n = !0
|
|
6532
6810
|
} = r;
|
|
6533
6811
|
let o, a = !1, l = null, c;
|
|
6534
|
-
const h = t ||
|
|
6812
|
+
const h = t || re(s, "downloaded_file");
|
|
6535
6813
|
c = decodeURIComponent(h);
|
|
6536
6814
|
const u = () => {
|
|
6537
6815
|
if (!l) return;
|
|
@@ -6561,24 +6839,24 @@ function bs(r) {
|
|
|
6561
6839
|
!a && l && u();
|
|
6562
6840
|
} };
|
|
6563
6841
|
}
|
|
6564
|
-
function
|
|
6842
|
+
function Cn(r, s, t) {
|
|
6565
6843
|
if (!t) {
|
|
6566
6844
|
let n = s.replace(/^[^.]+./, "");
|
|
6567
6845
|
n = n == s ? "text/plain" : "application/" + n, t = { type: n };
|
|
6568
6846
|
}
|
|
6569
6847
|
const e = new Blob(r, t), i = URL.createObjectURL(e);
|
|
6570
|
-
|
|
6848
|
+
Ss({ href: i, fileName: s });
|
|
6571
6849
|
}
|
|
6572
|
-
const
|
|
6573
|
-
function
|
|
6574
|
-
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(s,
|
|
6850
|
+
const _s = Math.PI / 2, $t = Math.PI / 180, Zt = 6378137, Es = 85.05112878;
|
|
6851
|
+
function Sn(r, s) {
|
|
6852
|
+
const t = Math.max(Math.min(r, 180), -180), e = Math.max(Math.min(s, Es), -85.05112878), i = t * $t * Zt, n = e * $t, o = Math.log(Math.tan(Math.PI / 4 + n / 2)) * Zt;
|
|
6575
6853
|
return [i, o];
|
|
6576
6854
|
}
|
|
6577
|
-
function
|
|
6578
|
-
const t = r /
|
|
6855
|
+
function _n(r, s) {
|
|
6856
|
+
const t = r / Zt / $t, e = (2 * Math.atan(Math.exp(s / Zt)) - _s) / $t;
|
|
6579
6857
|
return [t, e];
|
|
6580
6858
|
}
|
|
6581
|
-
function
|
|
6859
|
+
function Ms(r, s, t) {
|
|
6582
6860
|
const [e, i] = r, [n, o] = s, [a, l] = t, c = (a - n) ** 2 + (l - o) ** 2;
|
|
6583
6861
|
if (c === 0) return Math.sqrt((e - n) ** 2 + (i - o) ** 2);
|
|
6584
6862
|
let h = ((e - n) * (a - n) + (i - o) * (l - o)) / c;
|
|
@@ -6586,21 +6864,21 @@ function _s(r, s, t) {
|
|
|
6586
6864
|
(e - (n + h * (a - n))) ** 2 + (i - (o + h * (l - o))) ** 2
|
|
6587
6865
|
);
|
|
6588
6866
|
}
|
|
6589
|
-
function
|
|
6867
|
+
function En(r, s, t, e, i, n = 1, o = 1) {
|
|
6590
6868
|
const a = r + t * Math.cos(e) * n, l = s + t * Math.sin(e) * o, c = r + t * Math.cos(i) * n, h = s + t * Math.sin(i) * o;
|
|
6591
6869
|
return [
|
|
6592
6870
|
[a, l],
|
|
6593
6871
|
[c, h]
|
|
6594
6872
|
];
|
|
6595
6873
|
}
|
|
6596
|
-
function
|
|
6874
|
+
function Ee(r, s, t, e) {
|
|
6597
6875
|
return Math.hypot(Math.abs(t - r), Math.abs(e - s));
|
|
6598
6876
|
}
|
|
6599
|
-
function
|
|
6877
|
+
function We(r, s, t, e) {
|
|
6600
6878
|
const i = (r + t) / 2, n = (s + e) / 2;
|
|
6601
6879
|
return { x: i, y: n };
|
|
6602
6880
|
}
|
|
6603
|
-
function
|
|
6881
|
+
function Mn(r, s, t, e) {
|
|
6604
6882
|
const [i, n] = r, [o, a] = s;
|
|
6605
6883
|
let l = 1 / 0;
|
|
6606
6884
|
if (o !== 0) {
|
|
@@ -6613,7 +6891,7 @@ function Pn(r, s, t, e) {
|
|
|
6613
6891
|
}
|
|
6614
6892
|
return l === 1 / 0 ? r : [i + o * l, n + a * l];
|
|
6615
6893
|
}
|
|
6616
|
-
const
|
|
6894
|
+
const Ds = /* @__PURE__ */ new Set([
|
|
6617
6895
|
"sin",
|
|
6618
6896
|
"cos",
|
|
6619
6897
|
"tan",
|
|
@@ -6621,9 +6899,9 @@ const Ms = /* @__PURE__ */ new Set([
|
|
|
6621
6899
|
"acos",
|
|
6622
6900
|
"atan",
|
|
6623
6901
|
"atan2"
|
|
6624
|
-
]),
|
|
6902
|
+
]), Dn = new Proxy(Math, {
|
|
6625
6903
|
get(r, s) {
|
|
6626
|
-
return
|
|
6904
|
+
return Ds.has(s) ? function(...t) {
|
|
6627
6905
|
const e = t.map((i) => i / 180 * Math.PI);
|
|
6628
6906
|
return r[s](...e);
|
|
6629
6907
|
} : r[s];
|
|
@@ -6637,7 +6915,7 @@ const Ms = /* @__PURE__ */ new Set([
|
|
|
6637
6915
|
throw new Error("DegreeMath 是只读的,不能删除属性");
|
|
6638
6916
|
}
|
|
6639
6917
|
});
|
|
6640
|
-
class
|
|
6918
|
+
class wt {
|
|
6641
6919
|
constructor(s, t) {
|
|
6642
6920
|
d(this, "resolve");
|
|
6643
6921
|
d(this, "reject");
|
|
@@ -6654,42 +6932,42 @@ class yt {
|
|
|
6654
6932
|
}) : s ? (t = this.resolve) == null || t.call(this) : (e = this.reject) == null || e.call(this), s;
|
|
6655
6933
|
}
|
|
6656
6934
|
}
|
|
6657
|
-
class
|
|
6935
|
+
class Rs extends wt {
|
|
6658
6936
|
constructor(s) {
|
|
6659
6937
|
super(), this.resolve = s;
|
|
6660
6938
|
}
|
|
6661
6939
|
warning(...s) {
|
|
6662
6940
|
const t = () => {
|
|
6663
6941
|
var e, i;
|
|
6664
|
-
return (i = (e =
|
|
6942
|
+
return (i = (e = Dt.tips).warning) == null ? void 0 : i.call(e, ...s);
|
|
6665
6943
|
};
|
|
6666
|
-
return new
|
|
6944
|
+
return new wt(this.resolve, t);
|
|
6667
6945
|
}
|
|
6668
6946
|
error(...s) {
|
|
6669
6947
|
const t = () => {
|
|
6670
6948
|
var e, i;
|
|
6671
|
-
return (i = (e =
|
|
6949
|
+
return (i = (e = Dt.tips).error) == null ? void 0 : i.call(e, ...s);
|
|
6672
6950
|
};
|
|
6673
|
-
return new
|
|
6951
|
+
return new wt(this.resolve, t);
|
|
6674
6952
|
}
|
|
6675
6953
|
}
|
|
6676
|
-
class
|
|
6954
|
+
class ks extends wt {
|
|
6677
6955
|
constructor(s) {
|
|
6678
6956
|
super(), this.reject = s;
|
|
6679
6957
|
}
|
|
6680
6958
|
info(...s) {
|
|
6681
6959
|
const t = () => {
|
|
6682
6960
|
var e, i;
|
|
6683
|
-
return (i = (e =
|
|
6961
|
+
return (i = (e = Dt.tips).info) == null ? void 0 : i.call(e, ...s);
|
|
6684
6962
|
};
|
|
6685
|
-
return new
|
|
6963
|
+
return new wt(t, this.reject);
|
|
6686
6964
|
}
|
|
6687
6965
|
success(...s) {
|
|
6688
6966
|
const t = () => {
|
|
6689
6967
|
var e, i;
|
|
6690
|
-
return (i = (e =
|
|
6968
|
+
return (i = (e = Dt.tips).success) == null ? void 0 : i.call(e, ...s);
|
|
6691
6969
|
};
|
|
6692
|
-
return new
|
|
6970
|
+
return new wt(t, this.reject);
|
|
6693
6971
|
}
|
|
6694
6972
|
}
|
|
6695
6973
|
const B = class B {
|
|
@@ -6712,7 +6990,7 @@ const B = class B {
|
|
|
6712
6990
|
var i, n;
|
|
6713
6991
|
return (n = (i = B.tips)[s]) == null ? void 0 : n.call(i, ...t);
|
|
6714
6992
|
};
|
|
6715
|
-
return new
|
|
6993
|
+
return new Rs(e);
|
|
6716
6994
|
};
|
|
6717
6995
|
}
|
|
6718
6996
|
static rejectTip(s) {
|
|
@@ -6721,7 +6999,7 @@ const B = class B {
|
|
|
6721
6999
|
var i, n;
|
|
6722
7000
|
return (n = (i = B.tips)[s]) == null ? void 0 : n.call(i, ...t);
|
|
6723
7001
|
};
|
|
6724
|
-
return new
|
|
7002
|
+
return new ks(e);
|
|
6725
7003
|
};
|
|
6726
7004
|
}
|
|
6727
7005
|
};
|
|
@@ -6731,80 +7009,84 @@ d(B, "tips", {
|
|
|
6731
7009
|
warning: void 0,
|
|
6732
7010
|
error: void 0
|
|
6733
7011
|
}), d(B, "info", B.resolveTip("info")), d(B, "success", B.resolveTip("success")), d(B, "warning", B.rejectTip("warning")), d(B, "error", B.rejectTip("error"));
|
|
6734
|
-
let
|
|
7012
|
+
let Dt = B;
|
|
6735
7013
|
export {
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6744
|
-
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
7014
|
+
$e as EXTENSION_TO_MIME,
|
|
7015
|
+
ie as FILE_EXTENSIONS,
|
|
7016
|
+
Me as PAPER_SIZE_DEFINITIONS,
|
|
7017
|
+
As as PAPER_SIZE_OPTIONS,
|
|
7018
|
+
we as UNIT_LABELS,
|
|
7019
|
+
Os as WINDOW_TARGET,
|
|
7020
|
+
Ts as _Animate_CreateOscillator,
|
|
7021
|
+
Ls as _Animate_CubicBezier,
|
|
7022
|
+
Ze as _Animate_NumericTransition,
|
|
7023
|
+
zt as _Animate_Schedule,
|
|
7024
|
+
Is as _Blob_ConvertDataToImageUrl,
|
|
7025
|
+
ln as _Browser_CalculatePrintableArea,
|
|
7026
|
+
an as _Browser_CopyToClipboard,
|
|
7027
|
+
on as _Browser_GetFrameRate,
|
|
7028
|
+
cn as _Browser_IdleDetection,
|
|
6749
7029
|
It as _Browser_SameOriginTabManager,
|
|
6750
|
-
|
|
6751
|
-
rn as
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6756
|
-
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6760
|
-
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
7030
|
+
nn as _Browser_SoundEffects,
|
|
7031
|
+
rn as _Browser_WebSocketClient,
|
|
7032
|
+
I as _Canvas_Axis,
|
|
7033
|
+
un as _Canvas_TimeAxis,
|
|
7034
|
+
wn as _Element_CalculateCanvasSize,
|
|
7035
|
+
Pn as _Element_CheckImagesLoaded,
|
|
7036
|
+
fn as _Element_CloseOnOutsideClick,
|
|
7037
|
+
mn as _Element_Drag,
|
|
7038
|
+
bs as _Element_EnterFullscreen,
|
|
7039
|
+
Cs as _Element_ExitFullscreen,
|
|
7040
|
+
pn as _Element_Fullscreen,
|
|
7041
|
+
vn as _Element_FullscreenObserver,
|
|
7042
|
+
yn as _Element_GetOtherSizeInPixels,
|
|
7043
|
+
Ye as _Element_IsFullscreen,
|
|
7044
|
+
xn as _Element_LoadImage,
|
|
7045
|
+
gn as _Element_LocalDrag,
|
|
7046
|
+
dn as _Element_ScrollEndListener,
|
|
7047
|
+
Cn as _File_CreateAndDownload,
|
|
7048
|
+
Ss as _File_Download,
|
|
7049
|
+
bn as _File_Read,
|
|
7050
|
+
Us as _Format_CamelCase,
|
|
6769
7051
|
Ns as _Format_CapitalizeFirstLetter,
|
|
6770
|
-
|
|
6771
|
-
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
7052
|
+
Ys as _Format_ChunkArray,
|
|
7053
|
+
Xs as _Format_ExcludeSubstring,
|
|
7054
|
+
Bs as _Format_FileSize,
|
|
7055
|
+
re as _Format_HrefName,
|
|
7056
|
+
zs as _Format_MillisecondToReadable,
|
|
7057
|
+
ne as _Format_NumberWithCommas,
|
|
7058
|
+
Fs as _Format_NumberWithUnit,
|
|
7059
|
+
Hs as _Format_Percentage,
|
|
7060
|
+
Qe as _Format_Timestamp,
|
|
7061
|
+
Gs as _Format_ToggleInvisibleChars,
|
|
7062
|
+
Ee as _Math_CalculateDistance2D,
|
|
7063
|
+
Dn as _Math_Degree,
|
|
7064
|
+
En as _Math_GetArcPoints,
|
|
7065
|
+
Mn as _Math_GetBoundaryIntersection,
|
|
7066
|
+
We as _Math_GetMidpoint,
|
|
7067
|
+
Sn as _Math_LngLatToPlane,
|
|
7068
|
+
_n as _Math_PlaneToLngLat,
|
|
7069
|
+
Ms as _Math_PointToLineDistance,
|
|
7070
|
+
Dt as _Tip,
|
|
7071
|
+
ti as _Utility_Clone,
|
|
7072
|
+
Oe as _Utility_Debounce,
|
|
7073
|
+
Qs as _Utility_ExecuteWhenIdle,
|
|
7074
|
+
ae as _Utility_GenerateUUID,
|
|
7075
|
+
Ks as _Utility_GetTargetByPath,
|
|
6794
7076
|
pt as _Utility_MergeObjects,
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
6803
|
-
|
|
6804
|
-
|
|
6805
|
-
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
7077
|
+
en as _Utility_RotateList,
|
|
7078
|
+
tn as _Utility_SetTargetByPath,
|
|
7079
|
+
sn as _Utility_Sleep,
|
|
7080
|
+
Js as _Utility_Throttle,
|
|
7081
|
+
ei as _Utility_TimeConsumption,
|
|
7082
|
+
Ke as _Utility_WaitForCondition,
|
|
7083
|
+
Zs as _Valid_CheckConnectionWithXHR,
|
|
7084
|
+
oe as _Valid_DataType,
|
|
7085
|
+
qs as _Valid_DoesInfiniteLineIntersectRectangle,
|
|
7086
|
+
xe as _Valid_FileTypeChecker,
|
|
7087
|
+
Yt as _Valid_Is2DNumberArray,
|
|
7088
|
+
Ws as _Valid_IsInMargin,
|
|
7089
|
+
ge as _Valid_IsNumberArray,
|
|
7090
|
+
js as _Valid_IsPointInPolygon,
|
|
7091
|
+
$s as _Valid_IsSecureContext
|
|
6810
7092
|
};
|