@silurus/ooxml 0.21.0 → 0.21.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{xlsx-CBXAuvaH.cjs → xlsx-B74GLWQT.cjs} +7 -7
- package/dist/{xlsx-C5GMzRNJ.js → xlsx-B7AEM-Ke.js} +371 -349
- package/dist/xlsx.cjs +1 -1
- package/dist/xlsx.mjs +1 -1
- package/package.json +1 -1
|
@@ -311,7 +311,7 @@ function j(e, t) {
|
|
|
311
311
|
function te(e) {
|
|
312
312
|
if (!e) return null;
|
|
313
313
|
let t = e.trim().replace(/^=/, "").toUpperCase().replace(/\s+/g, "");
|
|
314
|
-
return t === "TODAY()" ?
|
|
314
|
+
return t === "TODAY()" ? Ye() : t === "NOW()" ? Xe() : null;
|
|
315
315
|
}
|
|
316
316
|
var ne = {
|
|
317
317
|
14: "m/d/yyyy",
|
|
@@ -350,7 +350,7 @@ var ne = {
|
|
|
350
350
|
"October",
|
|
351
351
|
"November",
|
|
352
352
|
"December"
|
|
353
|
-
],
|
|
353
|
+
], N = [
|
|
354
354
|
"Sunday",
|
|
355
355
|
"Monday",
|
|
356
356
|
"Tuesday",
|
|
@@ -358,7 +358,7 @@ var ne = {
|
|
|
358
358
|
"Thursday",
|
|
359
359
|
"Friday",
|
|
360
360
|
"Saturday"
|
|
361
|
-
],
|
|
361
|
+
], P = [
|
|
362
362
|
"日",
|
|
363
363
|
"月",
|
|
364
364
|
"火",
|
|
@@ -366,7 +366,7 @@ var ne = {
|
|
|
366
366
|
"木",
|
|
367
367
|
"金",
|
|
368
368
|
"土"
|
|
369
|
-
],
|
|
369
|
+
], re = [
|
|
370
370
|
"日曜日",
|
|
371
371
|
"月曜日",
|
|
372
372
|
"火曜日",
|
|
@@ -457,7 +457,7 @@ function R(e, t) {
|
|
|
457
457
|
} else if (t === "d" || t === "D") {
|
|
458
458
|
let e = 0;
|
|
459
459
|
for (; h < u.length && u[h].toLowerCase() === "d";) e++, h++;
|
|
460
|
-
e === 1 ? m += String(a) : e === 2 ? m += String(a).padStart(2, "0") : e === 3 ? m +=
|
|
460
|
+
e === 1 ? m += String(a) : e === 2 ? m += String(a).padStart(2, "0") : e === 3 ? m += N[o].slice(0, 3) : m += N[o], g = !1;
|
|
461
461
|
} else if (t === "h" || t === "H") {
|
|
462
462
|
let e = 0;
|
|
463
463
|
for (; h < u.length && u[h].toLowerCase() === "h";) e++, h++;
|
|
@@ -484,7 +484,7 @@ function R(e, t) {
|
|
|
484
484
|
m += e >= 2 ? String(t).padStart(2, "0") : String(t), g = !1;
|
|
485
485
|
} else if (t === "A" || t === "a") {
|
|
486
486
|
let e = u.slice(h).toUpperCase();
|
|
487
|
-
e.startsWith("AAAA") ? (m +=
|
|
487
|
+
e.startsWith("AAAA") ? (m += re[o], h += 4) : e.startsWith("AAA") ? (m += P[o], h += 3) : e.startsWith("AM/PM") ? (m += s < 12 ? "AM" : "PM", h += 5) : e.startsWith("A/P") ? (m += s < 12 ? "A" : "P", h += 3) : (m += t, h++), g = !1;
|
|
488
488
|
} else m += t, h++, t !== ":" && t !== "/" && t !== "-" && t !== "." && t !== " " && (g = !1);
|
|
489
489
|
}
|
|
490
490
|
return m;
|
|
@@ -497,35 +497,35 @@ function z(e) {
|
|
|
497
497
|
function ie(e, t, n) {
|
|
498
498
|
let r = ne[t];
|
|
499
499
|
if (r) return R(e, r);
|
|
500
|
-
if (n) return z(n) ? R(e, n) :
|
|
500
|
+
if (n) return z(n) ? R(e, n) : H(e, n);
|
|
501
501
|
switch (t) {
|
|
502
502
|
case 0: return String(e);
|
|
503
503
|
case 1: return Math.round(e).toString();
|
|
504
504
|
case 2: return e.toFixed(2);
|
|
505
|
-
case 3: return
|
|
506
|
-
case 4: return
|
|
505
|
+
case 3: return B(e, 0);
|
|
506
|
+
case 4: return B(e, 2);
|
|
507
507
|
case 9: return Math.round(e * 100) + "%";
|
|
508
508
|
case 10: return (e * 100).toFixed(2) + "%";
|
|
509
509
|
case 11: return e.toExponential(2);
|
|
510
510
|
case 37:
|
|
511
|
-
case 38: return
|
|
511
|
+
case 38: return B(e, 0);
|
|
512
512
|
case 39:
|
|
513
|
-
case 40: return
|
|
513
|
+
case 40: return B(e, 2);
|
|
514
514
|
case 49: return String(e);
|
|
515
515
|
default: return String(e);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function B(e, t) {
|
|
519
519
|
return e.toLocaleString("en-US", {
|
|
520
520
|
minimumFractionDigits: t,
|
|
521
521
|
maximumFractionDigits: t
|
|
522
522
|
});
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function ae(e) {
|
|
525
525
|
let t = e.match(/\.([0#]+)/);
|
|
526
526
|
return t ? t[1].length : 0;
|
|
527
527
|
}
|
|
528
|
-
function
|
|
528
|
+
function oe(e) {
|
|
529
529
|
let t = [], n = "", r = !1, i = !1, a = (e) => {
|
|
530
530
|
if (!e) return;
|
|
531
531
|
let n = t[t.length - 1];
|
|
@@ -562,39 +562,39 @@ function V(e) {
|
|
|
562
562
|
numSpec: n
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
let n = t.includes(",") && /[#0]/.test(t), r =
|
|
567
|
-
return n ?
|
|
565
|
+
function V(e, t) {
|
|
566
|
+
let n = t.includes(",") && /[#0]/.test(t), r = ae(t);
|
|
567
|
+
return n ? B(e, r) : t.includes(".") ? e.toFixed(r) : /[#0?]/.test(t) ? Math.round(e).toString() : String(e);
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function H(e, t) {
|
|
570
570
|
let n = t.split(";"), r;
|
|
571
571
|
r = e > 0 ? n[0] : e < 0 ? n.length > 1 ? n[1] : n[0] : n.length > 2 ? n[2] : n[0];
|
|
572
|
-
let { tokens: i, numSpec: a } =
|
|
572
|
+
let { tokens: i, numSpec: a } = oe(r), o = i.some((e) => e.kind === "percent"), s = i.find((e) => e.kind === "sci"), c = e;
|
|
573
573
|
o && (c *= 100);
|
|
574
574
|
let l, u = "";
|
|
575
575
|
if (s) {
|
|
576
|
-
let e =
|
|
576
|
+
let e = ae(a), [t, n] = c.toExponential(e).split("e");
|
|
577
577
|
l = t;
|
|
578
578
|
let r = parseInt(n, 10);
|
|
579
579
|
u = (r < 0 ? "-" : s.expSign ? "+" : "") + String(Math.abs(r)).padStart(2, "0");
|
|
580
|
-
} else l =
|
|
580
|
+
} else l = V(c, a);
|
|
581
581
|
let d = "", f = !1;
|
|
582
582
|
for (let e of i) e.kind === "lit" ? d += e.text : e.kind === "percent" ? d += "%" : e.kind === "num" ? (d += l, f = !0) : e.kind === "sci" && (d += "E" + u);
|
|
583
583
|
return !f && (a.length > 0 || s) && (d += l), d;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function se(e, t, n) {
|
|
586
586
|
let r = [];
|
|
587
|
-
for (let i of t.split("\n")) r.push(...
|
|
587
|
+
for (let i of t.split("\n")) r.push(...W(e, i, n));
|
|
588
588
|
return r;
|
|
589
589
|
}
|
|
590
|
-
function
|
|
590
|
+
function U(e) {
|
|
591
591
|
return e >= 12288 && e <= 40959 || e >= 63744 && e <= 64255 || e >= 44032 && e <= 55215 || e >= 65280 && e <= 65519;
|
|
592
592
|
}
|
|
593
|
-
function
|
|
593
|
+
function W(e, t, n) {
|
|
594
594
|
let r = [], i = [], a = 0;
|
|
595
595
|
for (; a < t.length;) {
|
|
596
596
|
let e = t[a], n = e.codePointAt(0) ?? 0;
|
|
597
|
-
if (
|
|
597
|
+
if (U(n)) i.push(e), a += n > 65535 ? 2 : 1;
|
|
598
598
|
else if (e === " ") {
|
|
599
599
|
let e = a;
|
|
600
600
|
for (; e < t.length && t[e] === " ";) e++;
|
|
@@ -603,7 +603,7 @@ function se(e, t, n) {
|
|
|
603
603
|
let e = a;
|
|
604
604
|
for (; e < t.length;) {
|
|
605
605
|
let n = t[e], r = n.codePointAt(0) ?? 0;
|
|
606
|
-
if (n === " " ||
|
|
606
|
+
if (n === " " || U(r)) break;
|
|
607
607
|
e += r > 65535 ? 2 : 1;
|
|
608
608
|
}
|
|
609
609
|
i.push(t.slice(a, e)), a = e;
|
|
@@ -668,22 +668,22 @@ function le(e) {
|
|
|
668
668
|
}
|
|
669
669
|
return t;
|
|
670
670
|
}
|
|
671
|
-
function
|
|
671
|
+
function ue(e, t, n) {
|
|
672
672
|
for (let r of e) if (t >= r.top && t <= r.bottom && n >= r.left && n <= r.right) return !0;
|
|
673
673
|
return !1;
|
|
674
674
|
}
|
|
675
|
-
function
|
|
675
|
+
function de(e) {
|
|
676
676
|
return e && e.value.type === "number" ? e.value.number : null;
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function G(e) {
|
|
679
679
|
return e && e.value.type === "text" ? e.value.text : null;
|
|
680
680
|
}
|
|
681
|
-
function
|
|
681
|
+
function K(e, t) {
|
|
682
682
|
let n = [];
|
|
683
|
-
for (let r of e.rows) for (let e of r.cells) e.value.type === "number" &&
|
|
683
|
+
for (let r of e.rows) for (let e of r.cells) e.value.type === "number" && ue(t, e.row, e.col) && n.push(e.value.number);
|
|
684
684
|
return n;
|
|
685
685
|
}
|
|
686
|
-
function
|
|
686
|
+
function fe(e, t) {
|
|
687
687
|
let n = t.length ? Math.min(...t) : 0, r = t.length ? Math.max(...t) : 0, i = e.value == null ? NaN : parseFloat(e.value);
|
|
688
688
|
switch (e.kind) {
|
|
689
689
|
case "min": return n;
|
|
@@ -701,20 +701,20 @@ function pe(e, t) {
|
|
|
701
701
|
default: return isNaN(i) ? 0 : i;
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
|
-
function
|
|
704
|
+
function pe(e) {
|
|
705
705
|
let t = [], n = /* @__PURE__ */ new Map();
|
|
706
706
|
for (let t of e.rows) for (let e of t.cells) n.set(`${e.row}:${e.col}`, e);
|
|
707
707
|
let r = /* @__PURE__ */ new Map();
|
|
708
708
|
for (let t of e.definedNames ?? []) r.set(t.name, t);
|
|
709
709
|
for (let n of e.conditionalFormats ?? []) {
|
|
710
|
-
let r =
|
|
710
|
+
let r = K(e, n.sqref);
|
|
711
711
|
for (let e of n.rules) {
|
|
712
712
|
let i = {
|
|
713
713
|
rule: e,
|
|
714
714
|
sqref: n.sqref
|
|
715
715
|
};
|
|
716
|
-
if (e.type === "colorScale") i.scaleStops = e.stops.map((e) =>
|
|
717
|
-
else if (e.type === "dataBar") i.barMin =
|
|
716
|
+
if (e.type === "colorScale") i.scaleStops = e.stops.map((e) => fe(e, r));
|
|
717
|
+
else if (e.type === "dataBar") i.barMin = fe(e.min, r), i.barMax = fe(e.max, r);
|
|
718
718
|
else if (e.type === "top10") {
|
|
719
719
|
let t = [...r].sort((e, t) => e - t), n = t.length;
|
|
720
720
|
if (n > 0) {
|
|
@@ -725,7 +725,7 @@ function me(e) {
|
|
|
725
725
|
} else i.top10Threshold = e.top ? t[Math.max(0, n - r)] : t[Math.min(n - 1, r - 1)];
|
|
726
726
|
i.top10IsTop = e.top;
|
|
727
727
|
}
|
|
728
|
-
} else e.type === "aboveAverage" ? r.length > 0 && (i.avgValue = r.reduce((e, t) => e + t, 0) / r.length, i.avgIsAbove = e.aboveAverage) : e.type === "iconSet" && (i.iconThresholds = e.cfvos.map((e) =>
|
|
728
|
+
} else e.type === "aboveAverage" ? r.length > 0 && (i.avgValue = r.reduce((e, t) => e + t, 0) / r.length, i.avgIsAbove = e.aboveAverage) : e.type === "iconSet" && (i.iconThresholds = e.cfvos.map((e) => fe(e, r)));
|
|
729
729
|
t.push(i);
|
|
730
730
|
}
|
|
731
731
|
}
|
|
@@ -736,7 +736,7 @@ function me(e) {
|
|
|
736
736
|
definedNames: r
|
|
737
737
|
};
|
|
738
738
|
}
|
|
739
|
-
function
|
|
739
|
+
function me(e, t, n) {
|
|
740
740
|
switch (t) {
|
|
741
741
|
case "greaterThan": return e > (n[0] ?? 0);
|
|
742
742
|
case "greaterThanOrEqual": return e >= (n[0] ?? 0);
|
|
@@ -749,13 +749,13 @@ function he(e, t, n) {
|
|
|
749
749
|
default: return !1;
|
|
750
750
|
}
|
|
751
751
|
}
|
|
752
|
-
function
|
|
752
|
+
function he(e) {
|
|
753
753
|
let t = e.trim();
|
|
754
754
|
if (t.length >= 2 && t.startsWith("\"") && t.endsWith("\"")) return { text: t.slice(1, -1).replace(/""/g, "\"") };
|
|
755
755
|
let n = parseFloat(t);
|
|
756
756
|
return isNaN(n) ? { text: t } : { num: n };
|
|
757
757
|
}
|
|
758
|
-
function
|
|
758
|
+
function ge(e, t, n) {
|
|
759
759
|
let r = n[0] ?? "", i = n[1] ?? "", a = (e) => e.toLowerCase();
|
|
760
760
|
switch (t) {
|
|
761
761
|
case "equal": return a(e) === a(r);
|
|
@@ -769,21 +769,21 @@ function _e(e, t, n) {
|
|
|
769
769
|
default: return !1;
|
|
770
770
|
}
|
|
771
771
|
}
|
|
772
|
-
function
|
|
772
|
+
function _e(e, t, n) {
|
|
773
773
|
let r = e.replace("#", ""), i = t.replace("#", ""), a = parseInt(r.slice(0, 2), 16), o = parseInt(r.slice(2, 4), 16), s = parseInt(r.slice(4, 6), 16), c = parseInt(i.slice(0, 2), 16), l = parseInt(i.slice(2, 4), 16), u = parseInt(i.slice(4, 6), 16), d = Math.round(a + (c - a) * n), f = Math.round(o + (l - o) * n), p = Math.round(s + (u - s) * n);
|
|
774
774
|
return `#${d.toString(16).padStart(2, "0").toUpperCase()}${f.toString(16).padStart(2, "0").toUpperCase()}${p.toString(16).padStart(2, "0").toUpperCase()}`;
|
|
775
775
|
}
|
|
776
|
-
function
|
|
776
|
+
function ve(e, t, n) {
|
|
777
777
|
if (!t.length) return "#FFFFFF";
|
|
778
778
|
if (e <= n[0]) return t[0].color;
|
|
779
779
|
if (e >= n[n.length - 1]) return t[t.length - 1].color;
|
|
780
780
|
for (let r = 1; r < n.length; r++) if (e <= n[r]) {
|
|
781
781
|
let i = n[r - 1], a = n[r], o = a === i ? 0 : (e - i) / (a - i);
|
|
782
|
-
return
|
|
782
|
+
return _e(t[r - 1].color, t[r].color, o);
|
|
783
783
|
}
|
|
784
784
|
return t[t.length - 1].color;
|
|
785
785
|
}
|
|
786
|
-
function
|
|
786
|
+
function ye(e, t) {
|
|
787
787
|
if (t && (t.fill && !e.fill && (e.fill = t.fill), t.font?.color && e.fontColor == null && (e.fontColor = t.font.color), t.font?.bold && e.fontBold == null && (e.fontBold = !0), t.font?.italic && e.fontItalic == null && (e.fontItalic = !0), t.font?.underline && e.fontUnderline == null && (e.fontUnderline = !0), t.font?.strike && e.fontStrike == null && (e.fontStrike = !0), t.numFmt && e.numFmt == null && (e.numFmt = {
|
|
788
788
|
numFmtId: t.numFmt.numFmtId,
|
|
789
789
|
formatCode: t.numFmt.formatCode || null
|
|
@@ -799,16 +799,16 @@ function be(e, t) {
|
|
|
799
799
|
};
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
|
-
function
|
|
802
|
+
function be(e, t, n, r, i) {
|
|
803
803
|
let a = {};
|
|
804
804
|
if (!r.compiled.length) return a;
|
|
805
805
|
for (let o of r.compiled) {
|
|
806
|
-
if (!
|
|
807
|
-
let s = o.rule, c =
|
|
806
|
+
if (!ue(o.sqref, t, n)) continue;
|
|
807
|
+
let s = o.rule, c = de(e);
|
|
808
808
|
if (s.type === "expression") {
|
|
809
809
|
let e = o.sqref[0];
|
|
810
810
|
if (!e) continue;
|
|
811
|
-
if (
|
|
811
|
+
if (Se(s.formula, {
|
|
812
812
|
row: t,
|
|
813
813
|
col: n,
|
|
814
814
|
anchorRow: e.top,
|
|
@@ -816,18 +816,18 @@ function xe(e, t, n, r, i) {
|
|
|
816
816
|
cellIndex: r.cellIndex,
|
|
817
817
|
definedNames: r.definedNames,
|
|
818
818
|
depth: 0
|
|
819
|
-
}) && (
|
|
819
|
+
}) && (ye(a, s.dxfId == null ? null : i[s.dxfId]), s.stopIfTrue)) break;
|
|
820
820
|
continue;
|
|
821
821
|
}
|
|
822
822
|
if (s.type === "cellIs") {
|
|
823
|
-
let t = s.formulas.map(
|
|
824
|
-
c != null && t.every((e) => e.num != null) ? r =
|
|
823
|
+
let t = s.formulas.map(he), n = G(e), r = !1;
|
|
824
|
+
c != null && t.every((e) => e.num != null) ? r = me(c, s.operator, t.map((e) => e.num)) : n != null && t.every((e) => e.text != null) && (r = ge(n, s.operator, t.map((e) => e.text))), r && ye(a, s.dxfId == null ? null : i[s.dxfId]);
|
|
825
825
|
} else if (s.type === "top10") {
|
|
826
826
|
if (c == null || o.top10Threshold == null) continue;
|
|
827
|
-
(o.top10IsTop ? c >= o.top10Threshold : c <= o.top10Threshold) &&
|
|
827
|
+
(o.top10IsTop ? c >= o.top10Threshold : c <= o.top10Threshold) && ye(a, s.dxfId == null ? null : i[s.dxfId]);
|
|
828
828
|
} else if (s.type === "aboveAverage") {
|
|
829
829
|
if (c == null || o.avgValue == null) continue;
|
|
830
|
-
(o.avgIsAbove ? c > o.avgValue : c < o.avgValue) &&
|
|
830
|
+
(o.avgIsAbove ? c > o.avgValue : c < o.avgValue) && ye(a, s.dxfId == null ? null : i[s.dxfId]);
|
|
831
831
|
} else if (s.type === "iconSet") {
|
|
832
832
|
if (c == null || !o.iconThresholds?.length) continue;
|
|
833
833
|
let e = o.iconThresholds, t = e.length, n = 0;
|
|
@@ -844,7 +844,7 @@ function xe(e, t, n, r, i) {
|
|
|
844
844
|
};
|
|
845
845
|
} else if (s.type === "colorScale") {
|
|
846
846
|
if (c == null || !o.scaleStops || a.fill) continue;
|
|
847
|
-
let e =
|
|
847
|
+
let e = ve(c, s.stops, o.scaleStops);
|
|
848
848
|
a.fill = {
|
|
849
849
|
patternType: "solid",
|
|
850
850
|
fgColor: e,
|
|
@@ -862,37 +862,37 @@ function xe(e, t, n, r, i) {
|
|
|
862
862
|
}
|
|
863
863
|
return a;
|
|
864
864
|
}
|
|
865
|
-
function
|
|
865
|
+
function q(e) {
|
|
866
866
|
return Array.isArray(e) ? e : [e];
|
|
867
867
|
}
|
|
868
|
-
function
|
|
868
|
+
function J(e) {
|
|
869
869
|
return Array.isArray(e) ? e[0] ?? 0 : e;
|
|
870
870
|
}
|
|
871
|
-
var
|
|
872
|
-
function
|
|
871
|
+
var xe = 8;
|
|
872
|
+
function Se(e, t) {
|
|
873
873
|
try {
|
|
874
|
-
return
|
|
874
|
+
return Ce(ke(e, t));
|
|
875
875
|
} catch {
|
|
876
876
|
return !1;
|
|
877
877
|
}
|
|
878
878
|
}
|
|
879
|
-
function
|
|
880
|
-
let t =
|
|
879
|
+
function Ce(e) {
|
|
880
|
+
let t = J(e);
|
|
881
881
|
return typeof t == "boolean" ? t : typeof t == "number" ? t !== 0 : typeof t == "string" ? t.length > 0 && t.toUpperCase() !== "FALSE" : !1;
|
|
882
882
|
}
|
|
883
|
-
function
|
|
884
|
-
let t =
|
|
883
|
+
function Y(e) {
|
|
884
|
+
let t = J(e);
|
|
885
885
|
if (typeof t == "number") return t;
|
|
886
886
|
if (typeof t == "boolean") return +!!t;
|
|
887
887
|
if (t == null) return 0;
|
|
888
888
|
let n = parseFloat(String(t));
|
|
889
889
|
return isNaN(n) ? 0 : n;
|
|
890
890
|
}
|
|
891
|
-
function
|
|
892
|
-
let t =
|
|
891
|
+
function X(e) {
|
|
892
|
+
let t = J(e);
|
|
893
893
|
return t == null ? "" : typeof t == "boolean" ? t ? "TRUE" : "FALSE" : String(t);
|
|
894
894
|
}
|
|
895
|
-
var
|
|
895
|
+
var we = new Set([
|
|
896
896
|
"<",
|
|
897
897
|
">",
|
|
898
898
|
"=",
|
|
@@ -904,7 +904,7 @@ var Te = new Set([
|
|
|
904
904
|
"^",
|
|
905
905
|
"%"
|
|
906
906
|
]);
|
|
907
|
-
function
|
|
907
|
+
function Te(e) {
|
|
908
908
|
let t = [], n = 0, r = e;
|
|
909
909
|
for (; n < r.length;) {
|
|
910
910
|
let e = r[n];
|
|
@@ -965,7 +965,7 @@ function Ee(e) {
|
|
|
965
965
|
}), n = e;
|
|
966
966
|
continue;
|
|
967
967
|
}
|
|
968
|
-
if (
|
|
968
|
+
if (we.has(e)) {
|
|
969
969
|
(e === "<" || e === ">") && (r[n + 1] === "=" || e === "<" && r[n + 1] === ">") ? (t.push({
|
|
970
970
|
kind: "op",
|
|
971
971
|
text: r.slice(n, n + 2)
|
|
@@ -975,12 +975,12 @@ function Ee(e) {
|
|
|
975
975
|
}), n++);
|
|
976
976
|
continue;
|
|
977
977
|
}
|
|
978
|
-
if (e === "$" ||
|
|
978
|
+
if (e === "$" || Ee(e)) {
|
|
979
979
|
let e = n;
|
|
980
|
-
for (; e < r.length && (r[e] === "$" ||
|
|
980
|
+
for (; e < r.length && (r[e] === "$" || De(r[e]));) e++;
|
|
981
981
|
let i = r.slice(n, e);
|
|
982
982
|
n = e;
|
|
983
|
-
let a =
|
|
983
|
+
let a = Oe(i);
|
|
984
984
|
if (a) t.push({
|
|
985
985
|
kind: "ref",
|
|
986
986
|
text: i,
|
|
@@ -1002,13 +1002,13 @@ function Ee(e) {
|
|
|
1002
1002
|
}
|
|
1003
1003
|
return t;
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function Ee(e) {
|
|
1006
1006
|
return e >= "A" && e <= "Z" || e >= "a" && e <= "z" || e === "_";
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1009
|
-
return
|
|
1008
|
+
function De(e) {
|
|
1009
|
+
return Ee(e) || e >= "0" && e <= "9" || e === ".";
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function Oe(e) {
|
|
1012
1012
|
let t = 0, n = !1, r = !1;
|
|
1013
1013
|
e[t] === "$" && (n = !0, t++);
|
|
1014
1014
|
let i = t;
|
|
@@ -1028,43 +1028,43 @@ function ke(e) {
|
|
|
1028
1028
|
row: s
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
|
-
function
|
|
1032
|
-
return
|
|
1033
|
-
toks:
|
|
1031
|
+
function ke(e, t) {
|
|
1032
|
+
return je({
|
|
1033
|
+
toks: Te(e),
|
|
1034
1034
|
pos: 0
|
|
1035
1035
|
}, t);
|
|
1036
1036
|
}
|
|
1037
|
-
function
|
|
1037
|
+
function Ae(e) {
|
|
1038
1038
|
return e.toks[e.pos];
|
|
1039
1039
|
}
|
|
1040
|
-
function
|
|
1040
|
+
function Z(e) {
|
|
1041
1041
|
return e.toks[e.pos++];
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1043
|
+
function je(e, t) {
|
|
1044
|
+
return Me(e, t);
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1047
|
-
let n =
|
|
1046
|
+
function Me(e, t) {
|
|
1047
|
+
let n = Ne(e, t), r = Ae(e);
|
|
1048
1048
|
if (r && r.kind === "op" && (r.text === "<" || r.text === ">" || r.text === "<=" || r.text === ">=" || r.text === "=" || r.text === "<>")) {
|
|
1049
|
-
|
|
1050
|
-
let i =
|
|
1051
|
-
return
|
|
1049
|
+
Z(e);
|
|
1050
|
+
let i = Ne(e, t);
|
|
1051
|
+
return Pe(r.text, n, i);
|
|
1052
1052
|
}
|
|
1053
1053
|
return n;
|
|
1054
1054
|
}
|
|
1055
|
-
function
|
|
1056
|
-
let n =
|
|
1055
|
+
function Ne(e, t) {
|
|
1056
|
+
let n = Fe(e, t);
|
|
1057
1057
|
for (;;) {
|
|
1058
|
-
let r =
|
|
1058
|
+
let r = Ae(e);
|
|
1059
1059
|
if (!r || r.kind !== "op" || r.text !== "&") break;
|
|
1060
|
-
|
|
1061
|
-
let i =
|
|
1062
|
-
n =
|
|
1060
|
+
Z(e);
|
|
1061
|
+
let i = Fe(e, t);
|
|
1062
|
+
n = X(n) + X(i);
|
|
1063
1063
|
}
|
|
1064
1064
|
return n;
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1067
|
-
let r = typeof t == "string" && isNaN(parseFloat(t)) ? null :
|
|
1066
|
+
function Pe(e, t, n) {
|
|
1067
|
+
let r = typeof t == "string" && isNaN(parseFloat(t)) ? null : Y(t), i = typeof n == "string" && isNaN(parseFloat(n)) ? null : Y(n);
|
|
1068
1068
|
if (r !== null && i !== null) switch (e) {
|
|
1069
1069
|
case "<": return r < i;
|
|
1070
1070
|
case ">": return r > i;
|
|
@@ -1084,67 +1084,67 @@ function Fe(e, t, n) {
|
|
|
1084
1084
|
}
|
|
1085
1085
|
return !1;
|
|
1086
1086
|
}
|
|
1087
|
-
function
|
|
1088
|
-
let n =
|
|
1087
|
+
function Fe(e, t) {
|
|
1088
|
+
let n = Ie(e, t);
|
|
1089
1089
|
for (;;) {
|
|
1090
|
-
let r =
|
|
1090
|
+
let r = Ae(e);
|
|
1091
1091
|
if (!r || r.kind !== "op" || r.text !== "+" && r.text !== "-") break;
|
|
1092
|
-
|
|
1093
|
-
let i =
|
|
1094
|
-
n = r.text === "+" ?
|
|
1092
|
+
Z(e);
|
|
1093
|
+
let i = Ie(e, t);
|
|
1094
|
+
n = r.text === "+" ? Y(n) + Y(i) : Y(n) - Y(i);
|
|
1095
1095
|
}
|
|
1096
1096
|
return n;
|
|
1097
1097
|
}
|
|
1098
|
-
function
|
|
1099
|
-
let n =
|
|
1098
|
+
function Ie(e, t) {
|
|
1099
|
+
let n = Le(e, t);
|
|
1100
1100
|
for (;;) {
|
|
1101
|
-
let r =
|
|
1101
|
+
let r = Ae(e);
|
|
1102
1102
|
if (!r || r.kind !== "op" || r.text !== "*" && r.text !== "/") break;
|
|
1103
|
-
|
|
1104
|
-
let i =
|
|
1105
|
-
if (r.text === "*") n =
|
|
1103
|
+
Z(e);
|
|
1104
|
+
let i = Le(e, t);
|
|
1105
|
+
if (r.text === "*") n = Y(n) * Y(i);
|
|
1106
1106
|
else {
|
|
1107
|
-
let e =
|
|
1108
|
-
n = e === 0 ? 0 :
|
|
1107
|
+
let e = Y(i);
|
|
1108
|
+
n = e === 0 ? 0 : Y(n) / e;
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
1111
|
return n;
|
|
1112
1112
|
}
|
|
1113
|
-
function
|
|
1114
|
-
let n =
|
|
1115
|
-
return n && n.kind === "op" && n.text === "-" ? (
|
|
1113
|
+
function Le(e, t) {
|
|
1114
|
+
let n = Ae(e);
|
|
1115
|
+
return n && n.kind === "op" && n.text === "-" ? (Z(e), -Y(Le(e, t))) : n && n.kind === "op" && n.text === "+" ? (Z(e), Y(Le(e, t))) : Re(e, t);
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1118
|
-
let n =
|
|
1117
|
+
function Re(e, t) {
|
|
1118
|
+
let n = Z(e);
|
|
1119
1119
|
if (!n) return 0;
|
|
1120
1120
|
if (n.kind === "num") return parseFloat(n.text);
|
|
1121
1121
|
if (n.kind === "str") return n.text;
|
|
1122
1122
|
if (n.kind === "bool") return n.text === "TRUE";
|
|
1123
1123
|
if (n.kind === "lparen") {
|
|
1124
|
-
let n =
|
|
1124
|
+
let n = je(e, t), r = Z(e);
|
|
1125
1125
|
if (!r || r.kind !== "rparen") throw Error("missing )");
|
|
1126
1126
|
return n;
|
|
1127
1127
|
}
|
|
1128
1128
|
if (n.kind === "ref") {
|
|
1129
|
-
if (
|
|
1130
|
-
|
|
1131
|
-
let r =
|
|
1129
|
+
if (Ae(e)?.kind === "colon") {
|
|
1130
|
+
Z(e);
|
|
1131
|
+
let r = Z(e);
|
|
1132
1132
|
if (r?.kind !== "ref" || !r.ref) throw Error("range: expected ref after :");
|
|
1133
|
-
return
|
|
1133
|
+
return Ve(n.ref, r.ref, t);
|
|
1134
1134
|
}
|
|
1135
|
-
return
|
|
1135
|
+
return Be(n.ref, t);
|
|
1136
1136
|
}
|
|
1137
1137
|
if (n.kind === "name") {
|
|
1138
|
-
if (
|
|
1139
|
-
|
|
1138
|
+
if (Ae(e)?.kind === "lparen") {
|
|
1139
|
+
Z(e);
|
|
1140
1140
|
let r = [];
|
|
1141
|
-
if (
|
|
1142
|
-
let i =
|
|
1141
|
+
if (Ae(e)?.kind !== "rparen") for (r.push(je(e, t)); Ae(e)?.kind === "comma";) Z(e), r.push(je(e, t));
|
|
1142
|
+
let i = Z(e);
|
|
1143
1143
|
if (!i || i.kind !== "rparen") throw Error("missing )");
|
|
1144
|
-
return
|
|
1144
|
+
return Ue(n.text, r, t);
|
|
1145
1145
|
}
|
|
1146
1146
|
let r = t.definedNames.get(n.text);
|
|
1147
|
-
return r && t.depth <
|
|
1147
|
+
return r && t.depth < xe ? ke(ze(r.formula), {
|
|
1148
1148
|
...t,
|
|
1149
1149
|
anchorRow: 1,
|
|
1150
1150
|
anchorCol: 1,
|
|
@@ -1153,20 +1153,20 @@ function ze(e, t) {
|
|
|
1153
1153
|
}
|
|
1154
1154
|
return 0;
|
|
1155
1155
|
}
|
|
1156
|
-
function
|
|
1156
|
+
function ze(e) {
|
|
1157
1157
|
let t = e.match(/^(?:'[^']*'|[A-Za-z_][A-Za-z0-9_.]*)!(.*)$/);
|
|
1158
1158
|
return t ? t[1] : e;
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1160
|
+
function Be(e, t) {
|
|
1161
1161
|
let n = e.colAbs ? e.col : e.col + (t.col - t.anchorCol), r = e.rowAbs ? e.row : e.row + (t.row - t.anchorRow);
|
|
1162
|
-
return
|
|
1162
|
+
return He(t.cellIndex.get(`${r}:${n}`));
|
|
1163
1163
|
}
|
|
1164
|
-
function
|
|
1164
|
+
function Ve(e, t, n) {
|
|
1165
1165
|
let r = e.colAbs ? e.col : e.col + (n.col - n.anchorCol), i = e.rowAbs ? e.row : e.row + (n.row - n.anchorRow), a = t.colAbs ? t.col : t.col + (n.col - n.anchorCol), o = t.rowAbs ? t.row : t.row + (n.row - n.anchorRow), s = Math.min(r, a), c = Math.max(r, a), l = Math.min(i, o), u = Math.max(i, o), d = [], f = 4096;
|
|
1166
|
-
for (let e = l; e <= u && d.length < f; e++) for (let t = s; t <= c && d.length < f; t++) d.push(
|
|
1166
|
+
for (let e = l; e <= u && d.length < f; e++) for (let t = s; t <= c && d.length < f; t++) d.push(He(n.cellIndex.get(`${e}:${t}`)));
|
|
1167
1167
|
return d;
|
|
1168
1168
|
}
|
|
1169
|
-
function
|
|
1169
|
+
function He(e) {
|
|
1170
1170
|
if (!e) return null;
|
|
1171
1171
|
switch (e.value.type) {
|
|
1172
1172
|
case "number": return e.value.number;
|
|
@@ -1176,162 +1176,162 @@ function Ue(e) {
|
|
|
1176
1176
|
default: return null;
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function Ue(e, t, n) {
|
|
1180
1180
|
switch (e.toUpperCase()) {
|
|
1181
|
-
case "AND": return t.flatMap(
|
|
1182
|
-
case "OR": return t.flatMap(
|
|
1183
|
-
case "NOT": return !
|
|
1184
|
-
case "IF": return
|
|
1181
|
+
case "AND": return t.flatMap(q).every((e) => Ce(e));
|
|
1182
|
+
case "OR": return t.flatMap(q).some((e) => Ce(e));
|
|
1183
|
+
case "NOT": return !Ce(t[0]);
|
|
1184
|
+
case "IF": return Ce(t[0]) ? t[1] ?? !0 : t[2] ?? !1;
|
|
1185
1185
|
case "IFERROR": return t[0] == null ? t[1] ?? 0 : t[0];
|
|
1186
1186
|
case "IFS":
|
|
1187
|
-
for (let e = 0; e + 1 < t.length; e += 2) if (
|
|
1187
|
+
for (let e = 0; e + 1 < t.length; e += 2) if (Ce(t[e])) return t[e + 1];
|
|
1188
1188
|
return null;
|
|
1189
1189
|
case "TRUE": return !0;
|
|
1190
1190
|
case "FALSE": return !1;
|
|
1191
1191
|
case "ISBLANK": {
|
|
1192
|
-
let e =
|
|
1192
|
+
let e = J(t[0]);
|
|
1193
1193
|
return e == null || e === "";
|
|
1194
1194
|
}
|
|
1195
|
-
case "ISNUMBER": return typeof
|
|
1196
|
-
case "ISTEXT": return typeof
|
|
1197
|
-
case "ISNONTEXT": return typeof
|
|
1195
|
+
case "ISNUMBER": return typeof J(t[0]) == "number";
|
|
1196
|
+
case "ISTEXT": return typeof J(t[0]) == "string";
|
|
1197
|
+
case "ISNONTEXT": return typeof J(t[0]) != "string";
|
|
1198
1198
|
case "ISERROR":
|
|
1199
1199
|
case "ISERR":
|
|
1200
|
-
case "ISNA": return
|
|
1201
|
-
case "ISLOGICAL": return typeof
|
|
1200
|
+
case "ISNA": return J(t[0]) == null;
|
|
1201
|
+
case "ISLOGICAL": return typeof J(t[0]) == "boolean";
|
|
1202
1202
|
case "ROUNDDOWN": {
|
|
1203
|
-
let e =
|
|
1203
|
+
let e = Y(t[0]), n = 10 ** Y(t[1]);
|
|
1204
1204
|
return (e >= 0 ? Math.floor(e * n) : Math.ceil(e * n)) / n;
|
|
1205
1205
|
}
|
|
1206
1206
|
case "ROUNDUP": {
|
|
1207
|
-
let e =
|
|
1207
|
+
let e = Y(t[0]), n = 10 ** Y(t[1]);
|
|
1208
1208
|
return (e >= 0 ? Math.ceil(e * n) : Math.floor(e * n)) / n;
|
|
1209
1209
|
}
|
|
1210
1210
|
case "ROUND": {
|
|
1211
|
-
let e =
|
|
1211
|
+
let e = Y(t[0]), n = 10 ** Y(t[1]);
|
|
1212
1212
|
return Math.round(e * n) / n;
|
|
1213
1213
|
}
|
|
1214
|
-
case "INT": return Math.floor(
|
|
1214
|
+
case "INT": return Math.floor(Y(t[0]));
|
|
1215
1215
|
case "TRUNC": {
|
|
1216
|
-
let e =
|
|
1216
|
+
let e = Y(t[0]), n = 10 ** Y(t[1] ?? 0);
|
|
1217
1217
|
return (e >= 0 ? Math.floor(e * n) : Math.ceil(e * n)) / n;
|
|
1218
1218
|
}
|
|
1219
1219
|
case "CEILING": {
|
|
1220
|
-
let e =
|
|
1220
|
+
let e = Y(t[0]), n = Y(t[1] ?? 1);
|
|
1221
1221
|
return n === 0 ? 0 : Math.ceil(e / n) * n;
|
|
1222
1222
|
}
|
|
1223
1223
|
case "FLOOR": {
|
|
1224
|
-
let e =
|
|
1224
|
+
let e = Y(t[0]), n = Y(t[1] ?? 1);
|
|
1225
1225
|
return n === 0 ? 0 : Math.floor(e / n) * n;
|
|
1226
1226
|
}
|
|
1227
1227
|
case "MOD": {
|
|
1228
|
-
let e =
|
|
1228
|
+
let e = Y(t[0]), n = Y(t[1]);
|
|
1229
1229
|
return n === 0 ? null : e - Math.floor(e / n) * n;
|
|
1230
1230
|
}
|
|
1231
|
-
case "POWER": return
|
|
1231
|
+
case "POWER": return Y(t[0]) ** +Y(t[1]);
|
|
1232
1232
|
case "SQRT": {
|
|
1233
|
-
let e =
|
|
1233
|
+
let e = Y(t[0]);
|
|
1234
1234
|
return e < 0 ? null : Math.sqrt(e);
|
|
1235
1235
|
}
|
|
1236
|
-
case "ABS": return Math.abs(
|
|
1236
|
+
case "ABS": return Math.abs(Y(t[0]));
|
|
1237
1237
|
case "SIGN": {
|
|
1238
|
-
let e =
|
|
1238
|
+
let e = Y(t[0]);
|
|
1239
1239
|
return e > 0 ? 1 : e < 0 ? -1 : 0;
|
|
1240
1240
|
}
|
|
1241
|
-
case "EXP": return Math.exp(
|
|
1241
|
+
case "EXP": return Math.exp(Y(t[0]));
|
|
1242
1242
|
case "LN": {
|
|
1243
|
-
let e =
|
|
1243
|
+
let e = Y(t[0]);
|
|
1244
1244
|
return e <= 0 ? null : Math.log(e);
|
|
1245
1245
|
}
|
|
1246
1246
|
case "LOG10": {
|
|
1247
|
-
let e =
|
|
1247
|
+
let e = Y(t[0]);
|
|
1248
1248
|
return e <= 0 ? null : Math.log10(e);
|
|
1249
1249
|
}
|
|
1250
1250
|
case "MIN": {
|
|
1251
|
-
let e = t.flatMap(
|
|
1251
|
+
let e = t.flatMap(q).filter((e) => typeof e == "number");
|
|
1252
1252
|
return e.length ? Math.min(...e) : 0;
|
|
1253
1253
|
}
|
|
1254
1254
|
case "MAX": {
|
|
1255
|
-
let e = t.flatMap(
|
|
1255
|
+
let e = t.flatMap(q).filter((e) => typeof e == "number");
|
|
1256
1256
|
return e.length ? Math.max(...e) : 0;
|
|
1257
1257
|
}
|
|
1258
|
-
case "SUM": return t.flatMap(
|
|
1258
|
+
case "SUM": return t.flatMap(q).reduce((e, t) => e + (typeof t == "number" ? t : 0), 0);
|
|
1259
1259
|
case "AVERAGE": {
|
|
1260
|
-
let e = t.flatMap(
|
|
1260
|
+
let e = t.flatMap(q).filter((e) => typeof e == "number");
|
|
1261
1261
|
return e.length ? e.reduce((e, t) => e + t, 0) / e.length : null;
|
|
1262
1262
|
}
|
|
1263
|
-
case "COUNT": return t.flatMap(
|
|
1264
|
-
case "COUNTA": return t.flatMap(
|
|
1265
|
-
case "COUNTBLANK": return t.flatMap(
|
|
1266
|
-
case "COUNTIF": return
|
|
1267
|
-
case "SUMIF": return
|
|
1263
|
+
case "COUNT": return t.flatMap(q).filter((e) => typeof e == "number").length;
|
|
1264
|
+
case "COUNTA": return t.flatMap(q).filter((e) => e != null && e !== "").length;
|
|
1265
|
+
case "COUNTBLANK": return t.flatMap(q).filter((e) => e == null || e === "").length;
|
|
1266
|
+
case "COUNTIF": return We(q(t[0]), t[1]);
|
|
1267
|
+
case "SUMIF": return Ge(q(t[0]), t[1], t[2] === void 0 ? null : q(t[2]));
|
|
1268
1268
|
case "AVERAGEIF": {
|
|
1269
|
-
let e =
|
|
1270
|
-
return r === 0 ? null :
|
|
1269
|
+
let e = q(t[0]), n = Ge(e, t[1], t[2] === void 0 ? null : q(t[2])), r = We(e, t[1]);
|
|
1270
|
+
return r === 0 ? null : Y(n) / r;
|
|
1271
1271
|
}
|
|
1272
|
-
case "LEN": return
|
|
1273
|
-
case "LEFT": return
|
|
1272
|
+
case "LEN": return X(t[0]).length;
|
|
1273
|
+
case "LEFT": return X(t[0]).slice(0, Math.max(0, Y(t[1] ?? 1)));
|
|
1274
1274
|
case "RIGHT": {
|
|
1275
|
-
let e =
|
|
1275
|
+
let e = X(t[0]), n = Math.max(0, Y(t[1] ?? 1));
|
|
1276
1276
|
return n >= e.length ? e : e.slice(e.length - n);
|
|
1277
1277
|
}
|
|
1278
1278
|
case "MID": {
|
|
1279
|
-
let e =
|
|
1279
|
+
let e = X(t[0]), n = Math.max(1, Y(t[1])) - 1, r = Math.max(0, Y(t[2]));
|
|
1280
1280
|
return e.slice(n, n + r);
|
|
1281
1281
|
}
|
|
1282
|
-
case "UPPER": return
|
|
1283
|
-
case "LOWER": return
|
|
1284
|
-
case "TRIM": return
|
|
1285
|
-
case "EXACT": return
|
|
1282
|
+
case "UPPER": return X(t[0]).toUpperCase();
|
|
1283
|
+
case "LOWER": return X(t[0]).toLowerCase();
|
|
1284
|
+
case "TRIM": return X(t[0]).replace(/\s+/g, " ").trim();
|
|
1285
|
+
case "EXACT": return X(t[0]) === X(t[1]);
|
|
1286
1286
|
case "FIND": {
|
|
1287
|
-
let e =
|
|
1287
|
+
let e = X(t[0]), n = X(t[1]), r = Math.max(1, Y(t[2] ?? 1)) - 1, i = n.indexOf(e, r);
|
|
1288
1288
|
return i < 0 ? null : i + 1;
|
|
1289
1289
|
}
|
|
1290
1290
|
case "SEARCH": {
|
|
1291
|
-
let e =
|
|
1291
|
+
let e = X(t[0]).toLowerCase(), n = X(t[1]).toLowerCase(), r = Math.max(1, Y(t[2] ?? 1)) - 1, i = n.indexOf(e, r);
|
|
1292
1292
|
return i < 0 ? null : i + 1;
|
|
1293
1293
|
}
|
|
1294
1294
|
case "CONCATENATE":
|
|
1295
|
-
case "CONCAT": return t.flatMap(
|
|
1295
|
+
case "CONCAT": return t.flatMap(q).map((e) => e == null ? "" : typeof e == "boolean" ? e ? "TRUE" : "FALSE" : String(e)).join("");
|
|
1296
1296
|
case "T": {
|
|
1297
|
-
let e =
|
|
1297
|
+
let e = J(t[0]);
|
|
1298
1298
|
return typeof e == "string" ? e : "";
|
|
1299
1299
|
}
|
|
1300
1300
|
case "N": {
|
|
1301
|
-
let e =
|
|
1301
|
+
let e = J(t[0]);
|
|
1302
1302
|
return typeof e == "number" ? e : typeof e == "boolean" ? +!!e : 0;
|
|
1303
1303
|
}
|
|
1304
|
-
case "VALUE": return
|
|
1304
|
+
case "VALUE": return Y(t[0]);
|
|
1305
1305
|
case "ROW": return n.row;
|
|
1306
1306
|
case "COLUMN": return n.col;
|
|
1307
|
-
case "TODAY": return
|
|
1308
|
-
case "NOW": return
|
|
1309
|
-
case "DATE": return
|
|
1310
|
-
case "YEAR": return
|
|
1311
|
-
case "MONTH": return
|
|
1312
|
-
case "DAY": return
|
|
1307
|
+
case "TODAY": return Ye();
|
|
1308
|
+
case "NOW": return Xe();
|
|
1309
|
+
case "DATE": return Ze(Y(t[0]), Y(t[1]), Y(t[2]));
|
|
1310
|
+
case "YEAR": return $e(Y(t[0])).y;
|
|
1311
|
+
case "MONTH": return $e(Y(t[0])).m;
|
|
1312
|
+
case "DAY": return $e(Y(t[0])).d;
|
|
1313
1313
|
case "WEEKDAY": {
|
|
1314
|
-
let e =
|
|
1314
|
+
let e = Qe(Y(t[0])).getUTCDay(), n = Y(t[1] ?? 1);
|
|
1315
1315
|
return n === 2 ? e === 0 ? 7 : e : n === 3 ? e === 0 ? 6 : e - 1 : e + 1;
|
|
1316
1316
|
}
|
|
1317
1317
|
default: return 0;
|
|
1318
1318
|
}
|
|
1319
1319
|
}
|
|
1320
|
-
function
|
|
1321
|
-
let n =
|
|
1320
|
+
function We(e, t) {
|
|
1321
|
+
let n = Ke(t), r = 0;
|
|
1322
1322
|
for (let t of e) n(t) && r++;
|
|
1323
1323
|
return r;
|
|
1324
1324
|
}
|
|
1325
|
-
function
|
|
1326
|
-
let r =
|
|
1325
|
+
function Ge(e, t, n) {
|
|
1326
|
+
let r = Ke(t), i = n ?? e, a = 0;
|
|
1327
1327
|
for (let t = 0; t < e.length; t++) if (r(e[t])) {
|
|
1328
1328
|
let e = i[t];
|
|
1329
1329
|
typeof e == "number" && (a += e);
|
|
1330
1330
|
}
|
|
1331
1331
|
return a;
|
|
1332
1332
|
}
|
|
1333
|
-
function
|
|
1334
|
-
let t =
|
|
1333
|
+
function Ke(e) {
|
|
1334
|
+
let t = J(e);
|
|
1335
1335
|
if (typeof t != "string") {
|
|
1336
1336
|
let e = typeof t == "number" ? t : null;
|
|
1337
1337
|
return (n) => e !== null && typeof n == "number" ? n === e : n === t;
|
|
@@ -1357,62 +1357,62 @@ function qe(e) {
|
|
|
1357
1357
|
}
|
|
1358
1358
|
};
|
|
1359
1359
|
}
|
|
1360
|
-
var
|
|
1361
|
-
function
|
|
1360
|
+
var qe = 25569, Je = 864e5;
|
|
1361
|
+
function Ye() {
|
|
1362
1362
|
let e = /* @__PURE__ */ new Date(), t = Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
|
|
1363
|
-
return Math.floor(t /
|
|
1363
|
+
return Math.floor(t / Je) + qe;
|
|
1364
1364
|
}
|
|
1365
|
-
function
|
|
1366
|
-
return Date.now() /
|
|
1365
|
+
function Xe() {
|
|
1366
|
+
return Date.now() / Je + qe;
|
|
1367
1367
|
}
|
|
1368
|
-
function
|
|
1368
|
+
function Ze(e, t, n) {
|
|
1369
1369
|
let r = Date.UTC(e, t - 1, n);
|
|
1370
|
-
return Math.floor(r /
|
|
1370
|
+
return Math.floor(r / Je) + qe;
|
|
1371
1371
|
}
|
|
1372
|
-
function
|
|
1373
|
-
let t = (Math.floor(e) -
|
|
1372
|
+
function Qe(e) {
|
|
1373
|
+
let t = (Math.floor(e) - qe) * Je;
|
|
1374
1374
|
return new Date(t);
|
|
1375
1375
|
}
|
|
1376
|
-
function
|
|
1377
|
-
let t =
|
|
1376
|
+
function $e(e) {
|
|
1377
|
+
let t = Qe(e);
|
|
1378
1378
|
return {
|
|
1379
1379
|
y: t.getUTCFullYear(),
|
|
1380
1380
|
m: t.getUTCMonth() + 1,
|
|
1381
1381
|
d: t.getUTCDate()
|
|
1382
1382
|
};
|
|
1383
1383
|
}
|
|
1384
|
-
var
|
|
1384
|
+
var et = [
|
|
1385
1385
|
"#FF0000",
|
|
1386
1386
|
"#FFFF00",
|
|
1387
1387
|
"#00B050"
|
|
1388
|
-
],
|
|
1388
|
+
], tt = [
|
|
1389
1389
|
"#FF0000",
|
|
1390
1390
|
"#FF6600",
|
|
1391
1391
|
"#FFFF00",
|
|
1392
1392
|
"#00B050"
|
|
1393
|
-
],
|
|
1393
|
+
], nt = [
|
|
1394
1394
|
"#FF0000",
|
|
1395
1395
|
"#FF6600",
|
|
1396
1396
|
"#FFFF00",
|
|
1397
1397
|
"#92D050",
|
|
1398
1398
|
"#00B050"
|
|
1399
1399
|
];
|
|
1400
|
-
function
|
|
1400
|
+
function rt(e, t, n, r, i, a) {
|
|
1401
1401
|
if (t === "NoIcons") return;
|
|
1402
|
-
let o = t || "3TrafficLights1", s = parseInt(o[0]) || 3, c = s === 5 ?
|
|
1402
|
+
let o = t || "3TrafficLights1", s = parseInt(o[0]) || 3, c = s === 5 ? nt : s === 4 ? tt : et, l = c[Math.max(0, Math.min(n, c.length - 1))];
|
|
1403
1403
|
if (e.save(), e.fillStyle = l, o.includes("Arrow")) {
|
|
1404
1404
|
let t = a / 2;
|
|
1405
1405
|
e.beginPath(), n === s - 1 ? (e.moveTo(r + t, i), e.lineTo(r + a, i + a), e.lineTo(r, i + a)) : n === 0 ? (e.moveTo(r, i), e.lineTo(r + a, i), e.lineTo(r + t, i + a)) : (e.moveTo(r, i + a * .3), e.lineTo(r + a, i + t), e.lineTo(r, i + a * .7)), e.closePath(), e.fill();
|
|
1406
1406
|
} else o.includes("Flag") ? (e.beginPath(), e.moveTo(r, i), e.lineTo(r + a, i), e.lineTo(r, i + a), e.closePath(), e.fill()) : (e.beginPath(), e.arc(r + a / 2, i + a / 2, a / 2, 0, Math.PI * 2), e.fill());
|
|
1407
1407
|
e.restore();
|
|
1408
1408
|
}
|
|
1409
|
-
function
|
|
1409
|
+
function it(e, t, n, r, i) {
|
|
1410
1410
|
let a = Math.max(6, Math.round(Math.min(r, i) * .45)), o = t + r - a - 1, s = n + i - a - 1;
|
|
1411
1411
|
e.save(), e.fillStyle = "#D0D0D0", e.fillRect(o, s, a, a), e.fillStyle = "#444444";
|
|
1412
1412
|
let c = a * .55, l = o + (a - c) / 2, u = s + (a - c * .5) / 2;
|
|
1413
1413
|
e.beginPath(), e.moveTo(l, u), e.lineTo(l + c, u), e.lineTo(l + c / 2, u + c * .5), e.closePath(), e.fill(), e.restore();
|
|
1414
1414
|
}
|
|
1415
|
-
function
|
|
1415
|
+
function at(e) {
|
|
1416
1416
|
let t = /* @__PURE__ */ new Map();
|
|
1417
1417
|
for (let n of e.tables ?? []) {
|
|
1418
1418
|
let e = n.accentColor || "#808080", r = Math.max(0, n.headerRowCount ?? 1), i = Math.max(0, n.totalsRowCount ?? 0), { top: a, bottom: o, left: s, right: c } = n.range, l = a + r - 1, u = o - i + 1;
|
|
@@ -1434,7 +1434,7 @@ function ot(e) {
|
|
|
1434
1434
|
}
|
|
1435
1435
|
return t;
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function ot(e) {
|
|
1438
1438
|
let t = /* @__PURE__ */ new Map();
|
|
1439
1439
|
for (let n of e.sparklineGroups ?? []) {
|
|
1440
1440
|
let e = Infinity, r = -Infinity;
|
|
@@ -1471,27 +1471,27 @@ function st(e) {
|
|
|
1471
1471
|
}
|
|
1472
1472
|
return t;
|
|
1473
1473
|
}
|
|
1474
|
-
function
|
|
1474
|
+
function st(e) {
|
|
1475
1475
|
let t = e.replace("#", "");
|
|
1476
1476
|
if (t.length < 6) return "#F2F2F2";
|
|
1477
1477
|
let n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), a = (e) => Math.round(e * .2 + 255 * .8), o = (e) => e.toString(16).padStart(2, "0").toUpperCase();
|
|
1478
1478
|
return `#${o(a(n))}${o(a(r))}${o(a(i))}`;
|
|
1479
1479
|
}
|
|
1480
|
-
function
|
|
1480
|
+
function ct(e, t, n, i, a, o, s, c, l, u, d, f, p, h) {
|
|
1481
1481
|
if (p <= 0 || h <= 0) return;
|
|
1482
|
-
let { styles: x, cellMap: w, mergeAnchorMap: A, mergeSkipSet: j, cfContext: te, cs: ne, dpr: M } = t,
|
|
1483
|
-
for (let e = 0; e <
|
|
1482
|
+
let { styles: x, cellMap: w, mergeAnchorMap: A, mergeSkipSet: j, cfContext: te, cs: ne, dpr: M } = t, N = a.length, P = o.length, re = [], F = -s;
|
|
1483
|
+
for (let e = 0; e < N; e++) re.push(F), F += a[e];
|
|
1484
1484
|
let I = [], L = -c;
|
|
1485
|
-
for (let e = 0; e <
|
|
1485
|
+
for (let e = 0; e < P; e++) I.push(L), L += o[e];
|
|
1486
1486
|
e.save(), e.beginPath(), e.rect(d, f, p, h), e.clip();
|
|
1487
1487
|
let R = [];
|
|
1488
1488
|
for (let r of t.worksheet.mergeCells ?? []) {
|
|
1489
1489
|
let a = r.top, o = r.left;
|
|
1490
|
-
if (a >= n && a < n +
|
|
1490
|
+
if (a >= n && a < n + P && o >= i && o < i + N || r.bottom < n || r.top >= n + P || r.right < i || r.left >= i + N) continue;
|
|
1491
1491
|
let d = t.mergeAnchorMap.get(`${a}:${o}`);
|
|
1492
1492
|
if (!d) continue;
|
|
1493
1493
|
let f;
|
|
1494
|
-
if (o >= i) f = l +
|
|
1494
|
+
if (o >= i) f = l + re[o - i];
|
|
1495
1495
|
else {
|
|
1496
1496
|
let e = 0;
|
|
1497
1497
|
for (let n = o; n < i; n++) e += Math.round(g(t.worksheet.colWidths[n] ?? t.worksheet.defaultColWidth) * ne);
|
|
@@ -1504,7 +1504,7 @@ function lt(e, t, n, i, a, o, s, c, l, u, d, f, p, h) {
|
|
|
1504
1504
|
for (let r = a; r < n; r++) e += Math.round(_(t.worksheet.rowHeights[r] ?? t.worksheet.defaultRowHeight) * ne);
|
|
1505
1505
|
p = u - c - e;
|
|
1506
1506
|
}
|
|
1507
|
-
let h = d.totalW, b = d.totalH, S = `${a}:${o}`, C = t.cellMap.get(S), { font: w, fill: T, border: E, xf: O } = k(x, C?.styleIndex ?? 0), A =
|
|
1507
|
+
let h = d.totalW, b = d.totalH, S = `${a}:${o}`, C = t.cellMap.get(S), { font: w, fill: T, border: E, xf: O } = k(x, C?.styleIndex ?? 0), A = be(C, a, o, te, x.dxfs ?? []), j = A.fill ?? T;
|
|
1508
1508
|
if (j.patternType !== "none" && j.patternType !== "" && j.fgColor && (e.fillStyle = v(j.fgColor), e.fillRect(f, p, h, b)), A.dataBar && A.dataBar.ratio > 0) {
|
|
1509
1509
|
let t = Math.max(0, (h - 4) * A.dataBar.ratio);
|
|
1510
1510
|
y(e, A.dataBar.color, f + 2, p + 2, t, b - 4, A.dataBar.gradient);
|
|
@@ -1522,47 +1522,69 @@ function lt(e, t, n, i, a, o, s, c, l, u, d, f, p, h) {
|
|
|
1522
1522
|
} : w, ne);
|
|
1523
1523
|
let ie = t.hyperlinkMap.get(S) ? "#0563C1" : A.fontColor ?? w.color;
|
|
1524
1524
|
e.fillStyle = ie ? v(ie) : "#000000";
|
|
1525
|
-
let
|
|
1525
|
+
let B = C.value.type === "number", ae = O.alignH ?? (B ? "right" : "left"), oe = O.alignV ?? "bottom", V = O.indent ? Math.round(O.indent * w.size * m * .5) : 0, H = 3 + (ae === "left" || !O.alignH ? V : 0);
|
|
1526
1526
|
e.save(), e.beginPath(), e.rect(f, p, h, b), e.clip();
|
|
1527
|
-
let
|
|
1528
|
-
|
|
1529
|
-
let
|
|
1530
|
-
|
|
1527
|
+
let se;
|
|
1528
|
+
ae === "right" ? (se = f + h - 3, e.textAlign = "right") : ae === "center" ? (se = f + h / 2, e.textAlign = "center") : (se = f + H, e.textAlign = "left");
|
|
1529
|
+
let U;
|
|
1530
|
+
oe === "top" ? (e.textBaseline = "top", U = p + 2) : oe === "center" ? (e.textBaseline = "middle", U = p + b / 2) : (e.textBaseline = "bottom", U = p + b - 2), e.fillText(M, se, U), e.restore();
|
|
1531
1531
|
}
|
|
1532
|
-
for (let s = 0; s <
|
|
1532
|
+
for (let s = 0; s < P; s++) {
|
|
1533
1533
|
let c = n + s, g = u + I[s], _ = o[s];
|
|
1534
|
-
if (
|
|
1535
|
-
|
|
1534
|
+
if (g + _ <= f || g >= f + h) continue;
|
|
1535
|
+
let P = /* @__PURE__ */ new Set(), F = /* @__PURE__ */ new Set(), L = -1;
|
|
1536
|
+
for (let e = 0; e <= N; e++) {
|
|
1537
|
+
let t = !1;
|
|
1538
|
+
if (e < N) {
|
|
1539
|
+
let n = `${c}:${i + e}`;
|
|
1540
|
+
!j.has(n) && !A.has(n) && (t = k(x, w.get(n)?.styleIndex ?? 0).xf.alignH === "centerContinuous");
|
|
1541
|
+
}
|
|
1542
|
+
if (t) L < 0 && (L = e);
|
|
1543
|
+
else {
|
|
1544
|
+
if (L >= 0 && e - L >= 2) {
|
|
1545
|
+
for (let t = L; t < e - 1; t++) P.add(t);
|
|
1546
|
+
for (let t = L + 1; t < e; t++) F.add(t);
|
|
1547
|
+
}
|
|
1548
|
+
L = -1;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
for (let n = 0; n < N; n++) {
|
|
1552
|
+
let o = i + n, u = l + re[n], f = a[n];
|
|
1536
1553
|
if (u + f <= d || u >= d + p) continue;
|
|
1537
1554
|
let h = `${c}:${o}`;
|
|
1538
1555
|
if (j.has(h)) continue;
|
|
1539
|
-
let
|
|
1540
|
-
if (
|
|
1541
|
-
else if (
|
|
1542
|
-
let t =
|
|
1556
|
+
let I = A.get(h), L = I ? I.totalW : f, z = I ? I.totalH : _, ie = w.get(h), { font: B, fill: ae, border: oe, xf: V } = k(x, ie?.styleIndex ?? 0), H = be(ie, c, o, te, x.dxfs ?? []), U = H.fill ?? ae, W = t.tableStyleMap.get(h), le = W?.wholeTableDxf == null ? void 0 : (x.dxfs ?? [])[W.wholeTableDxf], ue = W?.headerRowDxf == null ? void 0 : (x.dxfs ?? [])[W.headerRowDxf];
|
|
1557
|
+
if (U.gradient && U.gradient.stops.length > 0) e.fillStyle = C(e, U.gradient, u, g, L, z), e.fillRect(u, g, L, z);
|
|
1558
|
+
else if (U.patternType && U.patternType !== "none" && U.fgColor) {
|
|
1559
|
+
let t = U.patternType, n = U.bgColor ?? "FFFFFF", r = S(e, t, U.fgColor, n);
|
|
1543
1560
|
if (r) e.fillStyle = r;
|
|
1544
1561
|
else {
|
|
1545
1562
|
let r = b(t);
|
|
1546
|
-
e.fillStyle = r >= 1 ? v(
|
|
1563
|
+
e.fillStyle = r >= 1 ? v(U.fgColor) : E(U.fgColor, n, r);
|
|
1547
1564
|
}
|
|
1548
|
-
e.fillRect(u, g,
|
|
1549
|
-
} else
|
|
1550
|
-
if (t.commentCells.has(h) && T(e, u, g,
|
|
1551
|
-
let t = Math.max(0, (
|
|
1552
|
-
y(e,
|
|
1565
|
+
e.fillRect(u, g, L, z);
|
|
1566
|
+
} else W && W.isHeader && ue?.fill?.fgColor ? (e.fillStyle = v(ue.fill.fgColor), e.fillRect(u, g, L, z)) : W && !W.isHeader && !W.isTotals && le?.fill?.fgColor ? (e.fillStyle = v(le.fill.fgColor), e.fillRect(u, g, L, z)) : W && W.isBanded && (e.fillStyle = st(W.accent), e.fillRect(u, g, L, z));
|
|
1567
|
+
if (t.commentCells.has(h) && T(e, u, g, L, z), H.dataBar && H.dataBar.ratio > 0) {
|
|
1568
|
+
let t = Math.max(0, (L - 4) * H.dataBar.ratio);
|
|
1569
|
+
y(e, H.dataBar.color, u + 2, g + 2, t, z - 4, H.dataBar.gradient);
|
|
1553
1570
|
}
|
|
1554
|
-
let
|
|
1555
|
-
if (
|
|
1571
|
+
let de = t.sparklineMap.get(h);
|
|
1572
|
+
if (de && r(e, {
|
|
1556
1573
|
x: u,
|
|
1557
1574
|
y: g,
|
|
1558
|
-
w:
|
|
1559
|
-
h:
|
|
1560
|
-
},
|
|
1575
|
+
w: L,
|
|
1576
|
+
h: z
|
|
1577
|
+
}, de), t.worksheet.showGridlines !== !1) {
|
|
1561
1578
|
let t = .5 / M;
|
|
1562
|
-
e.strokeStyle = "#d0d0d0", e.lineWidth = .5, e.beginPath(), e.moveTo(u +
|
|
1579
|
+
e.strokeStyle = "#d0d0d0", e.lineWidth = .5, e.beginPath(), P.has(n) || (e.moveTo(u + L + t, g), e.lineTo(u + L + t, g + z)), e.moveTo(u, g + z + t), e.lineTo(u + L, g + z + t), s === 0 && (e.moveTo(u, g + t), e.lineTo(u + L, g + t)), n === 0 && (e.moveTo(u + t, g), e.lineTo(u + t, g + z)), e.stroke();
|
|
1563
1580
|
}
|
|
1564
|
-
|
|
1565
|
-
|
|
1581
|
+
let G = _t(I ? gt(oe, c, o, I.right, I.bottom, w, x) : oe, H.border);
|
|
1582
|
+
if ((P.has(n) || F.has(n)) && (G = {
|
|
1583
|
+
...G,
|
|
1584
|
+
left: F.has(n) ? null : G.left,
|
|
1585
|
+
right: P.has(n) ? null : G.right
|
|
1586
|
+
}), vt(e, G, u, g, L, z), W) {
|
|
1587
|
+
let t = le?.border?.horizontal, n = le?.border?.vertical, r = le?.border?.top, i = le?.border?.bottom, a = le?.border?.left, s = le?.border?.right, c = ue?.border?.bottom, l = ue?.border?.top;
|
|
1566
1588
|
if (t || n || r || i || a || s || c || l) {
|
|
1567
1589
|
let n = {
|
|
1568
1590
|
left: null,
|
|
@@ -1570,46 +1592,46 @@ function lt(e, t, n, i, a, o, s, c, l, u, d, f, p, h) {
|
|
|
1570
1592
|
top: null,
|
|
1571
1593
|
bottom: null
|
|
1572
1594
|
};
|
|
1573
|
-
|
|
1595
|
+
W.isTopEdge ? n.top = r ?? null : t && (n.top = t), W.isHeader && c ? n.bottom = c : W.isBottomEdge ? n.bottom = i ?? null : t && (n.bottom = t), (W.isFirstCol || o === 0) && (n.left = a ?? null), W.isLastCol && (n.right = s ?? null), vt(e, n, u, g, L, z);
|
|
1574
1596
|
} else {
|
|
1575
1597
|
let t = .5 / M;
|
|
1576
|
-
e.strokeStyle =
|
|
1598
|
+
e.strokeStyle = W.accent, e.lineWidth = W.isHeader ? 1.5 : 1, e.beginPath(), e.moveTo(u, g + z - t), e.lineTo(u + L, g + z - t), W.isTopEdge && (e.moveTo(u, g + t), e.lineTo(u + L, g + t)), e.stroke();
|
|
1577
1599
|
}
|
|
1578
1600
|
}
|
|
1579
|
-
if (t.autoFilterCells.has(h) &&
|
|
1580
|
-
let
|
|
1581
|
-
!
|
|
1582
|
-
let r = !!(
|
|
1583
|
-
...
|
|
1601
|
+
if (t.autoFilterCells.has(h) && it(e, u, g, f, z), !ie) continue;
|
|
1602
|
+
let K = ee(ie, x, H.numFmt);
|
|
1603
|
+
!K || K === "0" && t.worksheet.showZeros === !1 || R.push(() => {
|
|
1604
|
+
let r = !!(W && (W.isHeader || W.isTotals)), s = B.bold || !!H.fontBold || r, l = B.italic || !!H.fontItalic, d = B.underline || !!H.fontUnderline, f = B.strike || !!H.fontStrike, p = s !== B.bold || l !== B.italic || d !== B.underline || f !== B.strike ? {
|
|
1605
|
+
...B,
|
|
1584
1606
|
bold: s,
|
|
1585
1607
|
italic: l,
|
|
1586
1608
|
underline: d,
|
|
1587
1609
|
strike: f
|
|
1588
|
-
} :
|
|
1610
|
+
} : B;
|
|
1589
1611
|
e.font = D(p, ne);
|
|
1590
|
-
let _ = t.hyperlinkMap.get(h), y =
|
|
1612
|
+
let _ = t.hyperlinkMap.get(h), y = W?.isHeader && ue?.font?.color ? ue.font.color : W && !W.isHeader && !W.isTotals && le?.font?.color ? le.font.color : null, b = _ ? "#0563C1" : H.fontColor ?? y ?? B.color;
|
|
1591
1613
|
e.fillStyle = b ? v(b) : "#000000";
|
|
1592
|
-
let S =
|
|
1593
|
-
if (C === "centerContinuous" && !
|
|
1614
|
+
let S = ie.value.type === "number", C = V.alignH ?? (S ? "right" : "left"), T = V.alignV ?? "bottom", E = V.indent ? Math.round(V.indent * B.size * m * .5) : 0, ee = H.iconSet ? Math.max(8, Math.round(Math.min(L, z) * .55)) : 0, te = ee > 0 ? ee + 4 : 0, M = 3 + (C === "left" || !V.alignH ? E : 0) + te, P = L, re = u, F = n;
|
|
1615
|
+
if (C === "centerContinuous" && !I) for (let e = n + 1; e < N; e++) {
|
|
1594
1616
|
let t = `${c}:${i + e}`;
|
|
1595
1617
|
if (j.has(t) || A.has(t)) break;
|
|
1596
1618
|
let n = w.get(t);
|
|
1597
1619
|
if (n && n.value.type !== "empty" || k(x, n?.styleIndex ?? 0).xf.alignH !== "centerContinuous") break;
|
|
1598
|
-
P += a[e],
|
|
1620
|
+
P += a[e], F = e;
|
|
1599
1621
|
}
|
|
1600
|
-
let
|
|
1601
|
-
if (!
|
|
1602
|
-
let t = e.measureText(
|
|
1622
|
+
let R = C === "centerContinuous" ? re : u, ae = C === "centerContinuous" ? P : L, oe = K.includes("\n");
|
|
1623
|
+
if (!I && !V.wrapText && !V.textRotation && !S && !oe) {
|
|
1624
|
+
let t = e.measureText(K).width, r = C === "centerContinuous", o = r ? t + 6 : t + M + 3, s = r ? P : L;
|
|
1603
1625
|
if (o > s) {
|
|
1604
1626
|
let e = o - s, t = 0, l = 0;
|
|
1605
1627
|
if (C === "right" ? l = e : C === "center" || r ? (l = e / 2, t = e / 2) : t = e, t > 0) {
|
|
1606
|
-
let e = t, o = r ?
|
|
1607
|
-
for (let t = o; t <
|
|
1628
|
+
let e = t, o = r ? F + 1 : n + 1;
|
|
1629
|
+
for (let t = o; t < N && e > 0; t++) {
|
|
1608
1630
|
let n = `${c}:${i + t}`;
|
|
1609
1631
|
if (j.has(n) || A.has(n)) break;
|
|
1610
1632
|
let r = w.get(n);
|
|
1611
1633
|
if (r && r.value.type !== "empty") break;
|
|
1612
|
-
|
|
1634
|
+
ae += a[t], e -= a[t];
|
|
1613
1635
|
}
|
|
1614
1636
|
}
|
|
1615
1637
|
if (l > 0) {
|
|
@@ -1619,64 +1641,64 @@ function lt(e, t, n, i, a, o, s, c, l, u, d, f, p, h) {
|
|
|
1619
1641
|
if (j.has(n) || A.has(n)) break;
|
|
1620
1642
|
let r = w.get(n);
|
|
1621
1643
|
if (r && r.value.type !== "empty") break;
|
|
1622
|
-
|
|
1644
|
+
R -= a[t], ae += a[t], e -= a[t];
|
|
1623
1645
|
}
|
|
1624
1646
|
}
|
|
1625
1647
|
}
|
|
1626
1648
|
}
|
|
1627
|
-
let
|
|
1628
|
-
if (C === "fill" && !S &&
|
|
1629
|
-
let t = Math.max(1,
|
|
1649
|
+
let U = K, de = 0;
|
|
1650
|
+
if (C === "fill" && !S && K.length > 0) {
|
|
1651
|
+
let t = Math.max(1, L - 6), n = e.measureText(K).width;
|
|
1630
1652
|
if (n > 0 && n < t) {
|
|
1631
1653
|
let e = Math.max(1, Math.floor(t / n));
|
|
1632
|
-
|
|
1654
|
+
U = K.repeat(e);
|
|
1633
1655
|
}
|
|
1634
1656
|
}
|
|
1635
|
-
if (C === "distributed" || C === "justify" && !
|
|
1636
|
-
let t = Math.max(1,
|
|
1657
|
+
if (C === "distributed" || C === "justify" && !V.wrapText && !oe) {
|
|
1658
|
+
let t = Math.max(1, L - 6), n = e.measureText(U).width, r = Math.max(1, [...U].length - 1);
|
|
1637
1659
|
n < t && (de = Math.max(0, (t - n) / r));
|
|
1638
1660
|
}
|
|
1639
|
-
let
|
|
1640
|
-
C === "right" ? (
|
|
1641
|
-
let
|
|
1642
|
-
if (
|
|
1643
|
-
let t = Math.round(
|
|
1661
|
+
let G, fe;
|
|
1662
|
+
C === "right" ? (G = u + L - 3, fe = "right") : C === "center" ? (G = u + L / 2, fe = "center") : C === "centerContinuous" ? (G = re + P / 2, fe = "center") : C === "distributed" || C === "justify" && !V.wrapText && !oe ? (G = u + 3, fe = "left") : (G = u + M, fe = "left");
|
|
1663
|
+
let pe = V.textRotation ?? 0, me = pe === 255, he = pe > 0 && pe !== 255;
|
|
1664
|
+
if (H.iconSet && ee > 0 && (e.save(), e.beginPath(), e.rect(u, g, L, z), e.clip(), rt(e, H.iconSet.name, H.iconSet.index, u + 2, g + (z - ee) / 2, ee), e.restore()), e.save(), e.beginPath(), e.rect(R, g, ae, z), e.clip(), me) {
|
|
1665
|
+
let t = Math.round(B.size * m * 1.1), n = K.length * t, r = T === "top" ? g + 2 : T === "center" ? g + (z - n) / 2 : g + z - n - 2;
|
|
1644
1666
|
e.textAlign = "center", e.textBaseline = "top";
|
|
1645
|
-
for (let n of
|
|
1667
|
+
for (let n of K) e.fillText(n, u + L / 2, r), r += t;
|
|
1646
1668
|
e.restore();
|
|
1647
1669
|
return;
|
|
1648
1670
|
}
|
|
1649
|
-
if (
|
|
1650
|
-
let t =
|
|
1651
|
-
e.translate(u +
|
|
1671
|
+
if (he) {
|
|
1672
|
+
let t = pe <= 90 ? -(pe * Math.PI / 180) : (pe - 90) * Math.PI / 180;
|
|
1673
|
+
e.translate(u + L / 2, g + z / 2), e.rotate(t), e.textAlign = "center", e.textBaseline = "middle", e.fillText(K, 0, 0), e.restore();
|
|
1652
1674
|
return;
|
|
1653
1675
|
}
|
|
1654
|
-
if (
|
|
1655
|
-
let t = e.measureText(
|
|
1676
|
+
if (V.shrinkToFit) {
|
|
1677
|
+
let t = e.measureText(K).width, n = L - M - 3;
|
|
1656
1678
|
if (t > n && t > 0) {
|
|
1657
|
-
let r = n / t, i = C === "right" ? u +
|
|
1679
|
+
let r = n / t, i = C === "right" ? u + L - 3 : C === "center" ? u + L / 2 : u + M;
|
|
1658
1680
|
e.transform(r, 0, 0, 1, i * (1 - r), 0);
|
|
1659
1681
|
}
|
|
1660
1682
|
}
|
|
1661
|
-
if (e.textAlign =
|
|
1683
|
+
if (e.textAlign = fe, de > 0) try {
|
|
1662
1684
|
e.letterSpacing = `${de}px`;
|
|
1663
1685
|
} catch {}
|
|
1664
|
-
if (
|
|
1686
|
+
if (V.readingOrder === 2) try {
|
|
1665
1687
|
e.direction = "rtl";
|
|
1666
1688
|
} catch {}
|
|
1667
|
-
else if (
|
|
1689
|
+
else if (V.readingOrder === 1) try {
|
|
1668
1690
|
e.direction = "ltr";
|
|
1669
1691
|
} catch {}
|
|
1670
|
-
let
|
|
1671
|
-
if (
|
|
1672
|
-
let t = ce(e,
|
|
1673
|
-
r = T === "top" ? g + 2 : T === "center" ? g + (
|
|
1692
|
+
let ge = ie.value.type === "text" ? ie.value.runs : void 0, _e = ge && ge.length > 0;
|
|
1693
|
+
if (V.wrapText && _e) {
|
|
1694
|
+
let t = ce(e, ge, p, ne, L - M - 3), n = t.reduce((e, t) => e + Math.round(t.maxFontSize * m * 1.2), 0), r;
|
|
1695
|
+
r = T === "top" ? g + 2 : T === "center" ? g + (z - n) / 2 : g + z - n - 2, e.textAlign = "left", e.textBaseline = "top";
|
|
1674
1696
|
for (let n of t) {
|
|
1675
1697
|
let t = Math.round(n.maxFontSize * m * 1.2), i = n.segments.reduce((e, t) => e + t.width, 0), a;
|
|
1676
|
-
a = C === "right" ? u +
|
|
1698
|
+
a = C === "right" ? u + L - 3 - i : C === "center" ? u + L / 2 - i / 2 : u + M;
|
|
1677
1699
|
for (let t of n.segments) {
|
|
1678
1700
|
e.font = D(t.font, ne);
|
|
1679
|
-
let n =
|
|
1701
|
+
let n = H.fontColor ?? t.font.color;
|
|
1680
1702
|
e.fillStyle = n ? v(n) : "#000000", e.fillText(t.text, a, r);
|
|
1681
1703
|
let i = Math.round(t.font.size * m);
|
|
1682
1704
|
if (t.font.underline && (e.save(), e.strokeStyle = n ? v(n) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(a, r + i + 1), e.lineTo(a + t.width, r + i + 1), e.stroke(), e.restore()), t.font.strike) {
|
|
@@ -1688,63 +1710,63 @@ function lt(e, t, n, i, a, o, s, c, l, u, d, f, p, h) {
|
|
|
1688
1710
|
}
|
|
1689
1711
|
r += t;
|
|
1690
1712
|
}
|
|
1691
|
-
} else if (
|
|
1692
|
-
let t =
|
|
1693
|
-
T === "top" ? (i = g + 2, e.textBaseline = "top") : T === "center" ? (i = g + (
|
|
1694
|
-
for (let r = 0; r < t.length; r++) e.fillText(t[r],
|
|
1695
|
-
} else if (
|
|
1696
|
-
let t =
|
|
1697
|
-
i = C === "right" ? u +
|
|
1713
|
+
} else if (V.wrapText) {
|
|
1714
|
+
let t = se(e, K, L - M - 3), n = Math.round(B.size * m * 1.2), r = t.length * n, i;
|
|
1715
|
+
T === "top" ? (i = g + 2, e.textBaseline = "top") : T === "center" ? (i = g + (z - r) / 2, e.textBaseline = "top") : (i = g + z - r - 2, e.textBaseline = "top");
|
|
1716
|
+
for (let r = 0; r < t.length; r++) e.fillText(t[r], G, i + r * n);
|
|
1717
|
+
} else if (_e) {
|
|
1718
|
+
let t = ge.map((e) => O(p, e)), n = ge.map((n, r) => (e.font = D(t[r], ne), e.measureText(n.text).width)), r = n.reduce((e, t) => e + t, 0), i;
|
|
1719
|
+
i = C === "right" ? u + L - 3 - r : C === "center" ? u + L / 2 - r / 2 : u + M, e.textAlign = "left";
|
|
1698
1720
|
let a;
|
|
1699
|
-
T === "top" ? (e.textBaseline = "top", a = g + 2) : T === "center" ? (e.textBaseline = "middle", a = g +
|
|
1721
|
+
T === "top" ? (e.textBaseline = "top", a = g + 2) : T === "center" ? (e.textBaseline = "middle", a = g + z / 2) : (e.textBaseline = "bottom", a = g + z - 2);
|
|
1700
1722
|
let o = i;
|
|
1701
|
-
for (let r = 0; r <
|
|
1723
|
+
for (let r = 0; r < ge.length; r++) {
|
|
1702
1724
|
let i = t[r];
|
|
1703
1725
|
e.font = D(i, ne);
|
|
1704
|
-
let s =
|
|
1705
|
-
e.fillStyle = s ? v(s) : "#000000", e.fillText(
|
|
1726
|
+
let s = H.fontColor ?? i.color;
|
|
1727
|
+
e.fillStyle = s ? v(s) : "#000000", e.fillText(ge[r].text, o, a);
|
|
1706
1728
|
let c = Math.round(i.size * m);
|
|
1707
1729
|
if (i.underline) {
|
|
1708
|
-
let t = T === "top" ? g + 2 + c + 1 : T === "center" ? g +
|
|
1730
|
+
let t = T === "top" ? g + 2 + c + 1 : T === "center" ? g + z / 2 + Math.round(c * .55) : g + z - 2 + 1;
|
|
1709
1731
|
e.save(), e.strokeStyle = s ? v(s) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(o, t), e.lineTo(o + n[r], t), e.stroke(), e.restore();
|
|
1710
1732
|
}
|
|
1711
1733
|
if (i.strike) {
|
|
1712
|
-
let t = T === "top" ? g + 2 + Math.round(c * .5) : T === "center" ? g +
|
|
1734
|
+
let t = T === "top" ? g + 2 + Math.round(c * .5) : T === "center" ? g + z / 2 : g + z - 2 - Math.round(c * .35);
|
|
1713
1735
|
e.save(), e.strokeStyle = s ? v(s) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(o, t), e.lineTo(o + n[r], t), e.stroke(), e.restore();
|
|
1714
1736
|
}
|
|
1715
1737
|
o += n[r];
|
|
1716
1738
|
}
|
|
1717
1739
|
} else {
|
|
1718
|
-
let t = null, n = () => t ??= e.measureText(
|
|
1719
|
-
let e = Math.min(n().width,
|
|
1740
|
+
let t = null, n = () => t ??= e.measureText(K), r = () => {
|
|
1741
|
+
let e = Math.min(n().width, ae - M - 3);
|
|
1720
1742
|
return {
|
|
1721
|
-
x: C === "right" ? u +
|
|
1743
|
+
x: C === "right" ? u + L - 3 - e : C === "center" ? u + L / 2 - e / 2 : u + M,
|
|
1722
1744
|
width: e
|
|
1723
1745
|
};
|
|
1724
|
-
}, i = Math.round(
|
|
1746
|
+
}, i = Math.round(B.size * m);
|
|
1725
1747
|
if (p.underline || _) {
|
|
1726
|
-
let { x: t, width: n } = r(), a = T === "top" ? g + 2 + i + 1 : T === "center" ? g +
|
|
1748
|
+
let { x: t, width: n } = r(), a = T === "top" ? g + 2 + i + 1 : T === "center" ? g + z / 2 + Math.round(i * .55) : g + z - 2 + 1;
|
|
1727
1749
|
e.save(), e.strokeStyle = _ ? "#0563C1" : b ? v(b) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(t, a), e.lineTo(t + n, a), e.stroke(), e.restore();
|
|
1728
1750
|
}
|
|
1729
1751
|
if (p.strike) {
|
|
1730
|
-
let { x: t, width: n } = r(), a = T === "top" ? g + 2 + Math.round(i * .5) : T === "center" ? g +
|
|
1752
|
+
let { x: t, width: n } = r(), a = T === "top" ? g + 2 + Math.round(i * .5) : T === "center" ? g + z / 2 : g + z - 2 - Math.round(i * .35);
|
|
1731
1753
|
e.save(), e.strokeStyle = b ? v(b) : "#000000", e.lineWidth = .5, e.beginPath(), e.moveTo(t, a), e.lineTo(t + n, a), e.stroke(), e.restore();
|
|
1732
1754
|
}
|
|
1733
|
-
if (
|
|
1734
|
-
let t =
|
|
1735
|
-
T === "top" ? (i = g + 2, e.textBaseline = "top") : T === "center" ? (i = g + (
|
|
1736
|
-
for (let r = 0; r < t.length; r++) e.fillText(t[r],
|
|
1755
|
+
if (K.includes("\n")) {
|
|
1756
|
+
let t = K.split("\n"), n = Math.round(B.size * m * 1.2), r = t.length * n, i;
|
|
1757
|
+
T === "top" ? (i = g + 2, e.textBaseline = "top") : T === "center" ? (i = g + (z - r) / 2, e.textBaseline = "top") : (i = g + z - r - 2, e.textBaseline = "top");
|
|
1758
|
+
for (let r = 0; r < t.length; r++) e.fillText(t[r], G, i + r * n);
|
|
1737
1759
|
} else {
|
|
1738
1760
|
let t;
|
|
1739
|
-
T === "top" ? (e.textBaseline = "top", t = g + 2) : T === "center" ? (e.textBaseline = "middle", t = g +
|
|
1761
|
+
T === "top" ? (e.textBaseline = "top", t = g + 2) : T === "center" ? (e.textBaseline = "middle", t = g + z / 2) : (e.textBaseline = "bottom", t = g + z - 2), e.fillText(U, G, t);
|
|
1740
1762
|
}
|
|
1741
1763
|
}
|
|
1742
|
-
e.restore(),
|
|
1743
|
-
text:
|
|
1764
|
+
e.restore(), K && t.onTextRun && t.onTextRun({
|
|
1765
|
+
text: K,
|
|
1744
1766
|
x: u,
|
|
1745
1767
|
y: g,
|
|
1746
|
-
width:
|
|
1747
|
-
height:
|
|
1768
|
+
width: L,
|
|
1769
|
+
height: z,
|
|
1748
1770
|
row: c,
|
|
1749
1771
|
col: o
|
|
1750
1772
|
});
|
|
@@ -1754,7 +1776,7 @@ function lt(e, t, n, i, a, o, s, c, l, u, d, f, p, h) {
|
|
|
1754
1776
|
for (let e of R) e();
|
|
1755
1777
|
e.restore();
|
|
1756
1778
|
}
|
|
1757
|
-
function
|
|
1779
|
+
function lt(e, t, n, r, i = {}) {
|
|
1758
1780
|
let a = i.dpr ?? 1, o = i.cellScale ?? 1, s = e.canvas.width / a, c = e.canvas.height / a;
|
|
1759
1781
|
e.clearRect(0, 0, s, c), e.fillStyle = "#ffffff", e.fillRect(0, 0, s, c);
|
|
1760
1782
|
let l = (e) => Math.round(e * o), u = l(50), d = l(22), { row: f, col: p, rows: m, cols: v } = r, y = (i.scrollOffsetX ?? 0) * o, b = (i.scrollOffsetY ?? 0) * o, x = i.freezeRows ?? 0, S = i.freezeCols ?? 0, C = [];
|
|
@@ -1781,19 +1803,19 @@ function ut(e, t, n, r, i = {}) {
|
|
|
1781
1803
|
});
|
|
1782
1804
|
for (let t = e.top; t <= e.bottom; t++) for (let n = e.left; n <= e.right; n++) t === e.top && n === e.left || j.add(`${t}:${n}`);
|
|
1783
1805
|
}
|
|
1784
|
-
let te =
|
|
1806
|
+
let te = pe(t), ne = /* @__PURE__ */ new Set();
|
|
1785
1807
|
if (t.autoFilter) {
|
|
1786
1808
|
let e = t.autoFilter;
|
|
1787
1809
|
for (let t = e.left; t <= e.right; t++) ne.add(`${e.top}:${t}`);
|
|
1788
1810
|
}
|
|
1789
1811
|
let M = /* @__PURE__ */ new Map();
|
|
1790
1812
|
for (let e of t.hyperlinks ?? []) e.url && M.set(`${e.row}:${e.col}`, e.url);
|
|
1791
|
-
let
|
|
1813
|
+
let N = /* @__PURE__ */ new Set();
|
|
1792
1814
|
for (let e of t.commentRefs ?? []) {
|
|
1793
1815
|
let t = w(e);
|
|
1794
|
-
t &&
|
|
1816
|
+
t && N.add(`${t.row}:${t.col}`);
|
|
1795
1817
|
}
|
|
1796
|
-
let
|
|
1818
|
+
let P = {
|
|
1797
1819
|
worksheet: t,
|
|
1798
1820
|
styles: n,
|
|
1799
1821
|
cellMap: A,
|
|
@@ -1812,14 +1834,14 @@ function ut(e, t, n, r, i = {}) {
|
|
|
1812
1834
|
dpr: a,
|
|
1813
1835
|
autoFilterCells: ne,
|
|
1814
1836
|
hyperlinkMap: M,
|
|
1815
|
-
commentCells:
|
|
1816
|
-
tableStyleMap:
|
|
1817
|
-
sparklineMap:
|
|
1837
|
+
commentCells: N,
|
|
1838
|
+
tableStyleMap: at(t),
|
|
1839
|
+
sparklineMap: ot(t),
|
|
1818
1840
|
onTextRun: i.onTextRun
|
|
1819
|
-
},
|
|
1820
|
-
x > 0 && S > 0 &&
|
|
1841
|
+
}, re = u, F = d, I = re + E, L = F + D, R = Math.max(0, s - I), z = Math.max(0, c - L);
|
|
1842
|
+
x > 0 && S > 0 && ct(e, P, 1, 1, C, T, 0, 0, re, F, re, F, E, D), x > 0 && ct(e, P, 1, p, O, T, y, 0, I, F, I, F, R, D), S > 0 && ct(e, P, f, 1, C, k, 0, b, re, L, re, L, E, z), ct(e, P, f, p, O, k, y, b, I, L, I, L, R, z), t.images && t.images.length > 0 && i.loadedImages && ft(e, t, i.loadedImages, o, f, p, y, b, I, L, R, z), t.shapeGroups && t.shapeGroups.length > 0 && pt(e, t, o, f, p, y, b, I, L, R, z, i.loadedImages), t.charts && t.charts.length > 0 && Ct(e, t, o, f, p, y, b, I, L, R, z), t.slicers && t.slicers.length > 0 && It(e, t, o, f, p, y, b, I, L, R, z), ut(e, s, c, f, p, m, v, O, k, y, b, C, T, E, D, u, d, o, a), x > 0 && (e.save(), e.strokeStyle = h, e.lineWidth = .5, e.beginPath(), e.moveTo(u, L + .5), e.lineTo(s, L + .5), e.stroke(), e.restore()), S > 0 && (e.save(), e.strokeStyle = h, e.lineWidth = .5, e.beginPath(), e.moveTo(I + .5, d), e.lineTo(I + .5, c), e.stroke(), e.restore());
|
|
1821
1843
|
}
|
|
1822
|
-
function
|
|
1844
|
+
function ut(e, t, n, r, i, a, o, s, c, l, u, f, p, m, h, g, _, v, y) {
|
|
1823
1845
|
let b = "#f8f9fa", x = "#c8ccd0", S = "#444", C = `${Math.max(1, Math.round(11 * v))}px ${d}`, w = g + m, T = _ + h, E = .5 / y;
|
|
1824
1846
|
e.fillStyle = b, e.fillRect(0, 0, g, _), e.strokeStyle = x, e.lineWidth = .5, e.beginPath(), e.moveTo(E, 0), e.lineTo(E, _), e.moveTo(0, E), e.lineTo(g, E), e.moveTo(g - E, 0), e.lineTo(g - E, _), e.moveTo(0, _ - E), e.lineTo(g, _ - E), e.stroke(), e.font = C, e.fillStyle = S;
|
|
1825
1847
|
let D = (t, n, r) => {
|
|
@@ -1853,25 +1875,25 @@ function dt(e, t, n, r, i, a, o, s, c, l, u, f, p, m, h, g, _, v, y) {
|
|
|
1853
1875
|
}
|
|
1854
1876
|
e.restore();
|
|
1855
1877
|
}
|
|
1856
|
-
var
|
|
1857
|
-
function
|
|
1878
|
+
var Q = 9525;
|
|
1879
|
+
function $(e, t, n) {
|
|
1858
1880
|
let r = 0;
|
|
1859
1881
|
for (let i = 1; i < t; i++) r += Math.round(g(e.colWidths[i] ?? e.defaultColWidth) * n);
|
|
1860
1882
|
return r;
|
|
1861
1883
|
}
|
|
1862
|
-
function
|
|
1884
|
+
function dt(e, t, n) {
|
|
1863
1885
|
let r = 0;
|
|
1864
1886
|
for (let i = 1; i < t; i++) r += Math.round(_(e.rowHeights[i] ?? e.defaultRowHeight) * n);
|
|
1865
1887
|
return r;
|
|
1866
1888
|
}
|
|
1867
1889
|
function ft(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
1868
1890
|
if (u <= 0 || d <= 0) return;
|
|
1869
|
-
let f =
|
|
1891
|
+
let f = $(t, a, r), p = dt(t, i, r);
|
|
1870
1892
|
e.save(), e.beginPath(), e.rect(c, l, u, d), e.clip();
|
|
1871
1893
|
for (let i of t.images) {
|
|
1872
1894
|
let a = n.get(i.dataUrl);
|
|
1873
1895
|
if (!a) continue;
|
|
1874
|
-
let m = i.fromCol + 1, h = i.fromRow + 1, g = i.toCol + 1, _ = i.toRow + 1, v =
|
|
1896
|
+
let m = i.fromCol + 1, h = i.fromRow + 1, g = i.toCol + 1, _ = i.toRow + 1, v = $(t, m, r) + i.fromColOff * r / Q, y = dt(t, h, r) + i.fromRowOff * r / Q, b = $(t, g, r) + i.toColOff * r / Q, x = dt(t, _, r) + i.toRowOff * r / Q, S = b - v, C = x - y;
|
|
1875
1897
|
if (S <= 0 || C <= 0) continue;
|
|
1876
1898
|
let w = c + (v - f) - o, T = l + (y - p) - s;
|
|
1877
1899
|
w + S < c || w > c + u || T + C < l || T > l + d || e.drawImage(a, w, T, S, C);
|
|
@@ -1882,10 +1904,10 @@ function pt(e, t, n, r, i, a, o, s, c, l, u, d) {
|
|
|
1882
1904
|
if (l <= 0 || u <= 0) return;
|
|
1883
1905
|
let f = t.shapeGroups;
|
|
1884
1906
|
if (!f || f.length === 0) return;
|
|
1885
|
-
let p =
|
|
1907
|
+
let p = $(t, i, n), m = dt(t, r, n);
|
|
1886
1908
|
e.save(), e.beginPath(), e.rect(s, c, l, u), e.clip();
|
|
1887
1909
|
for (let r of f) {
|
|
1888
|
-
let i = r.fromCol + 1, f = r.fromRow + 1, h = r.toCol + 1, g = r.toRow + 1, _ =
|
|
1910
|
+
let i = r.fromCol + 1, f = r.fromRow + 1, h = r.toCol + 1, g = r.toRow + 1, _ = $(t, i, n) + r.fromColOff * n / Q, v = dt(t, f, n) + r.fromRowOff * n / Q, y = $(t, h, n) + r.toColOff * n / Q, b = dt(t, g, n) + r.toRowOff * n / Q, x = y - _, S = b - v;
|
|
1889
1911
|
if (x <= 0 || S <= 0) continue;
|
|
1890
1912
|
let C = s + (_ - p) - a, w = c + (v - m) - o;
|
|
1891
1913
|
if (!(C + x < s || C > s + l) && !(w + S < c || w > c + u)) for (let t of r.shapes) {
|
|
@@ -1953,7 +1975,7 @@ function mt(e, t, n, r, i, a, o) {
|
|
|
1953
1975
|
e.restore();
|
|
1954
1976
|
}
|
|
1955
1977
|
function ht(e, t) {
|
|
1956
|
-
t.fillColor && (e.fillStyle = t.fillColor, e.fill()), t.strokeColor && t.strokeWidth > 0 && (e.strokeStyle = t.strokeColor, e.lineWidth = Math.max(.5, t.strokeWidth /
|
|
1978
|
+
t.fillColor && (e.fillStyle = t.fillColor, e.fill()), t.strokeColor && t.strokeWidth > 0 && (e.strokeStyle = t.strokeColor, e.lineWidth = Math.max(.5, t.strokeWidth / Q), e.stroke());
|
|
1957
1979
|
}
|
|
1958
1980
|
function gt(e, t, n, r, i, a, o) {
|
|
1959
1981
|
if (r === n && i === t) return e;
|
|
@@ -2161,9 +2183,9 @@ function St(e) {
|
|
|
2161
2183
|
}
|
|
2162
2184
|
function Ct(e, t, r, i, a, o, s, c, l, u, d) {
|
|
2163
2185
|
if (u <= 0 || d <= 0) return;
|
|
2164
|
-
let f =
|
|
2186
|
+
let f = $(t, a, r), p = dt(t, i, r);
|
|
2165
2187
|
for (let i of t.charts) {
|
|
2166
|
-
let a = i.fromCol + 1, m = i.fromRow + 1, h = i.toCol + 1, g = i.toRow + 1, _ =
|
|
2188
|
+
let a = i.fromCol + 1, m = i.fromRow + 1, h = i.toCol + 1, g = i.toRow + 1, _ = $(t, a, r) + i.fromColOff * r / Q, v = dt(t, m, r) + i.fromRowOff * r / Q, y = $(t, h, r) + i.toColOff * r / Q, b = dt(t, g, r) + i.toRowOff * r / Q, x = y - _, S = b - v;
|
|
2167
2189
|
if (x <= 0 || S <= 0) continue;
|
|
2168
2190
|
let C = c + (_ - f) - o, w = l + (v - p) - s;
|
|
2169
2191
|
if (C + x < c || C > c + u || w + S < l || w > l + d) continue;
|
|
@@ -2182,9 +2204,9 @@ function It(e, t, n, r, i, a, o, s, c, l, u) {
|
|
|
2182
2204
|
if (l <= 0 || u <= 0) return;
|
|
2183
2205
|
let d = t.slicers;
|
|
2184
2206
|
if (!d) return;
|
|
2185
|
-
let f =
|
|
2207
|
+
let f = $(t, i, n), p = dt(t, r, n);
|
|
2186
2208
|
for (let r of d) {
|
|
2187
|
-
let i = r.fromCol + 1, d = r.fromRow + 1, m = r.toCol + 1, h = r.toRow + 1, g =
|
|
2209
|
+
let i = r.fromCol + 1, d = r.fromRow + 1, m = r.toCol + 1, h = r.toRow + 1, g = $(t, i, n) + r.fromColOff * n / Q, _ = dt(t, d, n) + r.fromRowOff * n / Q, v = $(t, m, n) + r.toColOff * n / Q, y = dt(t, h, n) + r.toRowOff * n / Q, b = v - g, x = y - _;
|
|
2188
2210
|
if (b <= 0 || x <= 0) continue;
|
|
2189
2211
|
let S = s + (g - f) - a, C = c + (_ - p) - o;
|
|
2190
2212
|
S + b < s || S > s + l || C + x < c || C > c + u || (e.save(), e.beginPath(), e.rect(s, c, l, u), e.clip(), Lt(e, r.caption, r.items, S, C, b, x, n), e.restore());
|
|
@@ -2304,7 +2326,7 @@ var Ht = class {
|
|
|
2304
2326
|
let s = r.dpr ?? (typeof window < "u" ? window.devicePixelRatio : 1), c = e instanceof HTMLCanvasElement ? e.clientWidth || 800 : e.width, l = e instanceof HTMLCanvasElement ? e.clientHeight || 600 : e.height, u = r.width ?? c, d = r.height ?? l;
|
|
2305
2327
|
e.width = Math.round(u * s), e.height = Math.round(d * s), e instanceof HTMLCanvasElement && (e.style.width = `${u}px`, e.style.height = `${d}px`);
|
|
2306
2328
|
let f = e.getContext("2d");
|
|
2307
|
-
f.scale(s, s),
|
|
2329
|
+
f.scale(s, s), lt(f, i, a, n, {
|
|
2308
2330
|
...r,
|
|
2309
2331
|
dpr: s,
|
|
2310
2332
|
loadedImages: this.imageCache
|