@agile-team/mach-report 2.6.1 → 2.8.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.
Files changed (61) hide show
  1. package/README.md +59 -8
  2. package/dist/ReportPreview-BKKDAv8e.js +4481 -0
  3. package/dist/ReportPreview-E3cm67Tk.cjs +6 -0
  4. package/dist/{assets-NVA_sftu.js → assets-B9qJku3V.js} +54 -57
  5. package/dist/assets-RZan7EyL.cjs +1 -0
  6. package/dist/capabilities-joSutDF8.js +63 -0
  7. package/dist/capabilities-xGTpnPjJ.cjs +1 -0
  8. package/dist/designer.cjs +1 -1
  9. package/dist/designer.d.cts +922 -753
  10. package/dist/designer.d.ts +922 -753
  11. package/dist/designer.js +490 -234
  12. package/dist/index.cjs +8 -8
  13. package/dist/index.d.cts +128 -3
  14. package/dist/index.d.ts +128 -3
  15. package/dist/index.js +971 -699
  16. package/dist/pdf.cjs +30 -30
  17. package/dist/pdf.d.cts +11 -3
  18. package/dist/pdf.d.ts +11 -3
  19. package/dist/pdf.js +1501 -1500
  20. package/dist/{plugin-Ds10VnQO.js → plugin-PCgxBVB2.js} +1 -1
  21. package/dist/{plugin-BqBkn_kI.cjs → plugin-mAfvgSey.cjs} +1 -1
  22. package/dist/progress-DD964VAB.js +102 -0
  23. package/dist/progress-KvhwXZ1Q.cjs +1 -0
  24. package/dist/{report-source-B9bENO0F.js → report-source-BXHNy_AD.js} +337 -332
  25. package/dist/report-source-CCAvFE3t.cjs +1 -0
  26. package/dist/server/node.d.cts +26 -3
  27. package/dist/server/node.d.ts +26 -3
  28. package/dist/server-node.cjs +1 -1
  29. package/dist/server-node.js +125 -92
  30. package/dist/server.cjs +1 -1
  31. package/dist/server.d.cts +28 -3
  32. package/dist/server.d.ts +28 -3
  33. package/dist/server.js +172 -164
  34. package/dist/style.css +1 -1
  35. package/dist/task-events-DQ276fn2.cjs +1 -0
  36. package/dist/task-events-Dpsvf_t2.js +47 -0
  37. package/dist/vue/async.d.cts +1553 -2083
  38. package/dist/vue/async.d.ts +1553 -2083
  39. package/dist/vue/index.d.cts +2465 -3310
  40. package/dist/vue/index.d.ts +2465 -3310
  41. package/dist/vue-async.cjs +1 -1
  42. package/dist/vue-async.js +3 -3
  43. package/dist/vue.cjs +1 -1
  44. package/dist/vue.js +159 -132
  45. package/dist/worker.cjs +1 -1
  46. package/dist/worker.d.cts +26 -3
  47. package/dist/worker.d.ts +26 -3
  48. package/dist/worker.js +110 -85
  49. package/dist/xlsx.cjs +14 -14
  50. package/dist/xlsx.d.cts +11 -3
  51. package/dist/xlsx.d.ts +11 -3
  52. package/dist/xlsx.js +656 -652
  53. package/package.json +2 -2
  54. package/dist/ReportPreview-Dk-28QAi.js +0 -2946
  55. package/dist/ReportPreview-FSvcBLjH.cjs +0 -6
  56. package/dist/assets-66UBlhES.cjs +0 -1
  57. package/dist/capabilities-CNjIirfo.js +0 -36
  58. package/dist/capabilities-D4xeVYSR.cjs +0 -1
  59. package/dist/grid-geometry-BNptEcMm.js +0 -65
  60. package/dist/grid-geometry-CZ_cYB6O.cjs +0 -1
  61. package/dist/report-source-BbNkkBDy.cjs +0 -1
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import { i as J, D as q, a as ve, b as ye } from "./render-plan-uzZYYSy1.js";
2
- import { c as Mn, d as xn, e as En, L as Tn, R as Sn, S as Cn } from "./render-plan-uzZYYSy1.js";
3
- import { v as Ke } from "./report-source-B9bENO0F.js";
4
- import { P as kn, R as Rn, c as In, d as An, a as $n, e as Nn, f as Ln, p as On, b as Fn, t as Dn, g as zn } from "./report-source-B9bENO0F.js";
5
- import { r as F, a as D, b as X, c as j, d as Me, m as ne, e as xe, p as O, f as Ee, P as G } from "./style-Dv5o_x6b.js";
6
- import { C as Hn, M as Wn, g as Bn, h as _n } from "./style-Dv5o_x6b.js";
7
- import { a as Vn, v as Gn, b as Un, c as Jn } from "./validate-S6CgIm5d.js";
8
- import { h as re, w as Te } from "./textwrap-DOl04hCQ.js";
9
- import { c as Xn, a as Yn, b as Qn, m as Zn } from "./textwrap-DOl04hCQ.js";
10
- import { r as H } from "./grid-geometry-BNptEcMm.js";
11
- import { r as Se, a as ie } from "./assets-NVA_sftu.js";
12
- import { O as tr } from "./assets-NVA_sftu.js";
13
- import { r as W } from "./capabilities-CNjIirfo.js";
14
- import { i as rr } from "./capabilities-CNjIirfo.js";
15
- import { c as Ve } from "./page-window-index-CIuT4BAv.js";
16
- import { p as te } from "./template-registry-NpOakidD.js";
17
- import { R as or, a as ar, c as sr, d as lr, s as cr, v as dr, b as ur } from "./template-registry-NpOakidD.js";
18
- import { R as fr, a as hr, i as gr, r as pr, v as wr, b as br } from "./param-validation-BWNjLcN0.js";
19
- import { f as Ge, i as Ue } from "./number-format-BA_KwrZe.js";
20
- const Je = {
1
+ import { i as Q, D as ee, a as Pe, b as Re } from "./render-plan-uzZYYSy1.js";
2
+ import { c as or, d as ar, e as sr, L as lr, R as cr, S as dr } from "./render-plan-uzZYYSy1.js";
3
+ import { v as et } from "./report-source-BXHNy_AD.js";
4
+ import { P as mr, R as fr, c as hr, d as gr, a as pr, e as wr, f as br, p as vr, b as yr, t as xr, g as Mr } from "./report-source-BXHNy_AD.js";
5
+ import { r as H, a as j, b as te, c as B, d as Ae, m as se, e as ke, p as L, f as $e, P as Y } from "./style-Dv5o_x6b.js";
6
+ import { C as Sr, M as Tr, g as Cr, h as Ir } from "./style-Dv5o_x6b.js";
7
+ import { a as Rr, v as Ar, b as kr, c as $r } from "./validate-S6CgIm5d.js";
8
+ import { h as le, w as Ne } from "./textwrap-DOl04hCQ.js";
9
+ import { c as Fr, a as Or, b as Dr, m as Lr } from "./textwrap-DOl04hCQ.js";
10
+ import { r as K, o as tt } from "./progress-DD964VAB.js";
11
+ import { r as Fe, a as ce } from "./assets-B9qJku3V.js";
12
+ import { O as Hr } from "./assets-B9qJku3V.js";
13
+ import { r as V, n as Oe, O as nt } from "./capabilities-joSutDF8.js";
14
+ import { i as Wr } from "./capabilities-joSutDF8.js";
15
+ import { c as rt } from "./page-window-index-CIuT4BAv.js";
16
+ import { p as ae } from "./template-registry-NpOakidD.js";
17
+ import { R as _r, a as Kr, c as Vr, d as Gr, s as Ur, v as qr, b as Jr } from "./template-registry-NpOakidD.js";
18
+ import { R as Xr, a as Zr, i as Qr, r as ei, v as ti, b as ni } from "./param-validation-BWNjLcN0.js";
19
+ import { f as it, i as ot } from "./number-format-BA_KwrZe.js";
20
+ const at = {
21
21
  root: "mr-root",
22
22
  page: "mr-page",
23
23
  comp: "mr-comp",
@@ -34,10 +34,10 @@ const Je = {
34
34
  cell: "mr-cell",
35
35
  unknown: "mr-unknown"
36
36
  };
37
- function T(e, t) {
38
- return t?.classNames?.[e] ?? Je[e];
37
+ function C(e, t) {
38
+ return t?.classNames?.[e] ?? at[e];
39
39
  }
40
- class qe {
40
+ class st {
41
41
  constructor() {
42
42
  this.props = [];
43
43
  }
@@ -45,7 +45,7 @@ class qe {
45
45
  return n == null || n === !1 || n === "" ? this : (this.props.push([t, String(n)]), this);
46
46
  }
47
47
  mm(t, n, r, i = 2) {
48
- return this.add(t, `${F(ne(n, r), i)}px`);
48
+ return this.add(t, `${H(se(n, r), i)}px`);
49
49
  }
50
50
  toString() {
51
51
  let t = "";
@@ -58,510 +58,522 @@ class qe {
58
58
  n && (t.style.cssText = n);
59
59
  }
60
60
  }
61
- function v(e, t = "unset") {
62
- return new qe().add("all", t).add("display", e).add("box-sizing", "border-box");
61
+ function x(e, t = "unset") {
62
+ return new st().add("all", t).add("display", e).add("box-sizing", "border-box");
63
63
  }
64
- function Ce(e, t, n) {
65
- e.add("color", t.color).add("font-family", t.fontFamily).add("font-weight", t.bold != null ? t.bold ? "700" : "400" : void 0).add("font-style", t.italic != null ? t.italic ? "italic" : "normal" : void 0).add("text-decoration", t.underline != null ? t.underline ? "underline" : "none" : void 0).add("letter-spacing", t.letterSpacing != null ? `${t.letterSpacing}pt` : void 0).add("line-height", String(X(t))).add("text-align", t.align);
66
- const r = D(t, n);
67
- e.add("font-size", `${F(r.fontSizePx, 2)}px`);
64
+ function De(e, t, n) {
65
+ e.add("color", t.color).add("font-family", t.fontFamily).add("font-weight", t.bold != null ? t.bold ? "700" : "400" : void 0).add("font-style", t.italic != null ? t.italic ? "italic" : "normal" : void 0).add("text-decoration", t.underline != null ? t.underline ? "underline" : "none" : void 0).add("letter-spacing", t.letterSpacing != null ? `${t.letterSpacing}pt` : void 0).add("line-height", String(te(t))).add("text-align", t.align);
66
+ const r = j(t, n);
67
+ e.add("font-size", `${H(r.fontSizePx, 2)}px`);
68
68
  }
69
- function Xe(e, t, n) {
69
+ function lt(e, t, n) {
70
70
  const r = t.style ?? {};
71
- Ce(e, r, n), e.add("background-color", r.backgroundColor).add("opacity", r.opacity != null ? String(r.opacity) : void 0).add("transform", r.rotateDeg ? `rotate(${r.rotateDeg}deg)` : void 0);
72
- }
73
- function Ye(e, t, n, r, i, l) {
74
- const o = e.cell, a = l.createElement("td");
75
- a.className = T("cell", i), a.dataset.mrRowIndex = String(e.ri), a.dataset.mrColumnIndex = String(e.ci), a.setAttribute("role", t.table?.role === "header" ? "columnheader" : "cell"), o.colSpan && (a.colSpan = o.colSpan), o.rowSpan && (a.rowSpan = o.rowSpan);
76
- const s = xe(t.style, o.style), c = v("block").add("position", "absolute").mm("left", e.xMm, r).mm("top", e.yMm, r).mm("width", e.widthMm, r).mm("height", e.heightMm, r).add("background-color", s.backgroundColor).add("vertical-align", s.verticalAlign ?? "middle");
77
- Ce(c, s, r), c.applyTo(a);
78
- const d = l.createElement("div");
79
- d.className = "mr-cell-content", v("flex").add("position", "absolute").mm("left", n, r).mm("right", n, r).mm("top", n, r).mm("bottom", n, r).add("flex-direction", "column").add("justify-content", s.verticalAlign === "top" ? "flex-start" : s.verticalAlign === "bottom" ? "flex-end" : "center").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(d), o.text != null && d.append(o.text);
80
- for (const u of o.children ?? []) d.appendChild(Pe(u, r, i, l));
81
- return a.appendChild(d), a;
82
- }
83
- function Qe(e, t, n, r) {
84
- return Se(e, t).map((i) => {
85
- const l = `${F(i.widthPt * n / 72, 2)}px solid ${i.color}`, o = r.createElement("div");
86
- o.className = "mr-grid-edge", o.setAttribute("aria-hidden", "true");
87
- const a = i.kind === "h";
88
- return v("block").add("position", "absolute").add("pointer-events", "none").mm("left", a ? i.from : i.pos, n).mm("top", a ? i.pos : i.from, n).mm("width", a ? i.to - i.from : 0, n).mm("height", a ? 0 : i.to - i.from, n).add(a ? "border-top" : "border-left", l).applyTo(o), o;
71
+ De(e, r, n), e.add("background-color", r.backgroundColor).add("opacity", r.opacity != null ? String(r.opacity) : void 0).add("transform", r.rotateDeg ? `rotate(${r.rotateDeg}deg)` : void 0);
72
+ }
73
+ function ct(e, t, n, r, i, s) {
74
+ const l = e.cell, o = s.createElement("td");
75
+ o.className = C("cell", i), o.dataset.mrRowIndex = String(e.ri), o.dataset.mrColumnIndex = String(e.ci), o.setAttribute("role", t.table?.role === "header" ? "columnheader" : "cell"), l.colSpan && (o.colSpan = l.colSpan), l.rowSpan && (o.rowSpan = l.rowSpan);
76
+ const a = ke(t.style, l.style), c = x("block").add("position", "absolute").mm("left", e.xMm, r).mm("top", e.yMm, r).mm("width", e.widthMm, r).mm("height", e.heightMm, r).add("background-color", a.backgroundColor).add("vertical-align", a.verticalAlign ?? "middle");
77
+ De(c, a, r), c.applyTo(o);
78
+ const d = s.createElement("div");
79
+ d.className = "mr-cell-content", x("flex").add("position", "absolute").mm("left", n, r).mm("right", n, r).mm("top", n, r).mm("bottom", n, r).add("flex-direction", "column").add("justify-content", a.verticalAlign === "top" ? "flex-start" : a.verticalAlign === "bottom" ? "flex-end" : "center").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(d), l.text != null && d.append(l.text);
80
+ for (const u of l.children ?? []) d.appendChild(Le(u, r, i, s));
81
+ return o.appendChild(d), o;
82
+ }
83
+ function dt(e, t, n, r) {
84
+ return Fe(e, t).map((i) => {
85
+ const s = `${H(i.widthPt * n / 72, 2)}px solid ${i.color}`, l = r.createElement("div");
86
+ l.className = "mr-grid-edge", l.setAttribute("aria-hidden", "true");
87
+ const o = i.kind === "h";
88
+ return x("block").add("position", "absolute").add("pointer-events", "none").mm("left", o ? i.from : i.pos, n).mm("top", o ? i.pos : i.from, n).mm("width", o ? i.to - i.from : 0, n).mm("height", o ? 0 : i.to - i.from, n).add(o ? "border-top" : "border-left", s).applyTo(l), l;
89
89
  });
90
90
  }
91
- function Ze(e, t, n, r, i) {
92
- const l = i.createElement("table");
93
- l.className = T("grid", r), l.setAttribute("role", "table"), v("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(l);
94
- const o = H(e, t.widthMm, t.heightMm), a = i.createElement("tbody");
95
- v("contents").applyTo(a), l.appendChild(a);
96
- const s = e.cells.map(() => {
91
+ function ut(e, t, n, r, i) {
92
+ const s = i.createElement("table");
93
+ s.className = C("grid", r), s.setAttribute("role", "table"), x("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(s);
94
+ const l = K(e, t.widthMm, t.heightMm), o = i.createElement("tbody");
95
+ x("contents").applyTo(o), s.appendChild(o);
96
+ const a = e.cells.map(() => {
97
97
  const d = i.createElement("tr");
98
- return d.className = T("row", r), d.setAttribute("role", "row"), v("contents").applyTo(d), a.appendChild(d), d;
98
+ return d.className = C("row", r), d.setAttribute("role", "row"), x("contents").applyTo(d), o.appendChild(d), d;
99
99
  });
100
- for (const d of o.cells)
101
- s[d.ri].appendChild(Ye(d, t, e.paddingMm ?? 0.5, n, r, i));
100
+ for (const d of l.cells)
101
+ a[d.ri].appendChild(ct(d, t, e.paddingMm ?? 0.5, n, r, i));
102
102
  const c = i.createElement("div");
103
- return v("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(c), c.append(l, ...Qe(o, t, n, i)), c;
103
+ return x("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(c), c.append(s, ...dt(l, t, n, i)), c;
104
104
  }
105
- function et(e, t, n, r) {
105
+ function mt(e, t, n, r) {
106
106
  const i = r.createElement("div");
107
- i.className = T("paragraph", n), v("block").add("text-align", e.align).add("line-height", e.lineHeight != null ? String(e.lineHeight) : void 0).mm("margin-top", e.spaceBeforeMm ?? 0, t).mm("margin-bottom", e.spaceAfterMm ?? 0, t).mm("text-indent", e.indentMm ?? 0, t).applyTo(i);
108
- for (const l of e.segments || []) {
109
- const o = r.createElement("span");
110
- o.className = T("segment", n), o.textContent = l.kind === "field" ? l.field ?? "" : l.text ?? "";
111
- const a = v("inline");
112
- if (l.style) {
113
- const s = l.style;
114
- a.add("color", s.color).add("font-family", s.fontFamily).add("font-weight", s.bold != null ? s.bold ? "700" : "400" : void 0).add("font-style", s.italic != null ? s.italic ? "italic" : "normal" : void 0).add("text-decoration", s.underline != null ? s.underline ? "underline" : "none" : void 0), (s.fontSize != null || s.fontSizePx != null) && a.add("font-size", `${F(D(s, t).fontSizePx, 2)}px`);
107
+ i.className = C("paragraph", n), x("block").add("text-align", e.align).add("line-height", e.lineHeight != null ? String(e.lineHeight) : void 0).mm("margin-top", e.spaceBeforeMm ?? 0, t).mm("margin-bottom", e.spaceAfterMm ?? 0, t).mm("text-indent", e.indentMm ?? 0, t).applyTo(i);
108
+ for (const s of e.segments || []) {
109
+ const l = r.createElement("span");
110
+ l.className = C("segment", n), l.textContent = s.kind === "field" ? s.field ?? "" : s.text ?? "";
111
+ const o = x("inline");
112
+ if (s.style) {
113
+ const a = s.style;
114
+ o.add("color", a.color).add("font-family", a.fontFamily).add("font-weight", a.bold != null ? a.bold ? "700" : "400" : void 0).add("font-style", a.italic != null ? a.italic ? "italic" : "normal" : void 0).add("text-decoration", a.underline != null ? a.underline ? "underline" : "none" : void 0), (a.fontSize != null || a.fontSizePx != null) && o.add("font-size", `${H(j(a, t).fontSizePx, 2)}px`);
115
115
  }
116
- a.applyTo(o), i.appendChild(o);
116
+ o.applyTo(l), i.appendChild(l);
117
117
  }
118
118
  return i;
119
119
  }
120
- function tt(e, t, n, r) {
121
- if (ye(e)) {
120
+ function ft(e, t, n, r) {
121
+ if (Re(e)) {
122
122
  const i = r.createElement("div");
123
- i.className = T("rich", n), v("block").applyTo(i);
124
- for (const l of e.richParagraphs) i.appendChild(et(l, t, n, r));
123
+ i.className = C("rich", n), x("block").applyTo(i);
124
+ for (const s of e.richParagraphs) i.appendChild(mt(s, t, n, r));
125
125
  return i;
126
126
  }
127
127
  if (Array.isArray(e.lines) && e.lines.length > 0) {
128
128
  const i = r.createElement("div");
129
- i.className = T("lines", n), v("block").applyTo(i);
130
- for (const l of e.lines) {
131
- const o = r.createElement("div");
132
- o.className = T("line", n), o.textContent = l, v("block").add("white-space", "pre").add("min-height", "1lh").applyTo(o), i.appendChild(o);
129
+ i.className = C("lines", n), x("block").applyTo(i);
130
+ for (const s of e.lines) {
131
+ const l = r.createElement("div");
132
+ l.className = C("line", n), l.textContent = s, x("block").add("white-space", "pre").add("min-height", "1lh").applyTo(l), i.appendChild(l);
133
133
  }
134
134
  return i;
135
135
  }
136
136
  return e.text ?? "";
137
137
  }
138
- function nt(e, t, n, r) {
138
+ function ht(e, t, n, r) {
139
139
  const i = r.createElement("div");
140
- i.className = T("text", n);
141
- const l = e.style || {};
142
- return v("flex").add("width", "100%").add("height", "100%").add("flex-direction", "column").add("justify-content", l.verticalAlign === "middle" ? "center" : l.verticalAlign === "bottom" ? "flex-end" : "flex-start").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(i), i.append(tt(e, t, n, r)), i;
140
+ i.className = C("text", n);
141
+ const s = e.style || {};
142
+ return x("flex").add("width", "100%").add("height", "100%").add("flex-direction", "column").add("justify-content", s.verticalAlign === "middle" ? "center" : s.verticalAlign === "bottom" ? "flex-end" : "flex-start").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(i), i.append(ft(e, t, n, r)), i;
143
143
  }
144
- function rt(e, t, n) {
144
+ function gt(e, t, n) {
145
145
  const r = n.createElement("img");
146
- return r.className = T("image", t), r.src = e.imageData, v("block").add("width", "100%").add("height", "100%").add("object-fit", "contain").applyTo(r), r.alt = e.kind, r;
146
+ return r.className = C("image", t), r.src = e.imageData, x("block").add("width", "100%").add("height", "100%").add("object-fit", "contain").applyTo(r), r.alt = e.kind, r;
147
147
  }
148
- function ge(e, t, n, r) {
148
+ function Me(e, t, n, r) {
149
149
  const i = r.createElement("div");
150
- i.className = T("shape", n);
151
- const l = e.style || {}, o = j(l), a = Me(l), s = `${F(o.widthPt * t / 72, 2)}px solid ${o.color}`, c = v("block");
152
- return e.grid ? c.add("position", "relative") : e.kind === "rect" ? (a.top && c.add("border-top", s), a.right && c.add("border-right", s), a.bottom && c.add("border-bottom", s), a.left && c.add("border-left", s)) : e.kind === "ellipse" ? (a.inner && c.add("border", s).add("border-radius", "50%"), l.backgroundColor && c.add("background-color", l.backgroundColor)) : e.kind === "line" && c.add("height", "0").add("border-top", s), c.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), c.applyTo(i), i;
153
- }
154
- function it(e, t, n) {
155
- const r = n.createElementNS("http://www.w3.org/2000/svg", "svg"), i = ne(e.widthMm, t), l = ne(e.heightMm, t);
156
- r.setAttribute("width", String(Math.max(1, i))), r.setAttribute("height", String(Math.max(1, l))), r.setAttribute("aria-hidden", "true"), r.style.overflow = "visible", r.style.display = "block";
157
- const o = n.createElementNS("http://www.w3.org/2000/svg", "line");
158
- o.setAttribute("x1", "0"), o.setAttribute("x2", String(i)), o.setAttribute("y1", e.lineDirection === "up" ? String(l) : "0"), o.setAttribute("y2", e.lineDirection === "up" ? "0" : String(l));
159
- const a = j({ ...e.style, borderColor: e.style?.lineColor ?? e.style?.borderColor });
160
- return o.setAttribute("stroke", a.color), o.setAttribute("stroke-width", String(a.widthPt * t / 72)), r.appendChild(o), r;
161
- }
162
- function Pe(e, t, n, r) {
150
+ i.className = C("shape", n);
151
+ const s = e.style || {}, l = B(s), o = Ae(s), a = `${H(l.widthPt * t / 72, 2)}px solid ${l.color}`, c = x("block");
152
+ return e.grid ? c.add("position", "relative") : e.kind === "rect" ? (o.top && c.add("border-top", a), o.right && c.add("border-right", a), o.bottom && c.add("border-bottom", a), o.left && c.add("border-left", a)) : e.kind === "ellipse" ? (o.inner && c.add("border", a).add("border-radius", "50%"), s.backgroundColor && c.add("background-color", s.backgroundColor)) : e.kind === "line" && c.add("height", "0").add("border-top", a), c.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), c.applyTo(i), i;
153
+ }
154
+ function pt(e, t, n) {
155
+ const r = n.createElementNS("http://www.w3.org/2000/svg", "svg"), i = se(e.widthMm, t), s = se(e.heightMm, t);
156
+ r.setAttribute("width", String(Math.max(1, i))), r.setAttribute("height", String(Math.max(1, s))), r.setAttribute("aria-hidden", "true"), r.style.overflow = "visible", r.style.display = "block";
157
+ const l = n.createElementNS("http://www.w3.org/2000/svg", "line");
158
+ l.setAttribute("x1", "0"), l.setAttribute("x2", String(i)), l.setAttribute("y1", e.lineDirection === "up" ? String(s) : "0"), l.setAttribute("y2", e.lineDirection === "up" ? "0" : String(s));
159
+ const o = B({ ...e.style, borderColor: e.style?.lineColor ?? e.style?.borderColor });
160
+ return l.setAttribute("stroke", o.color), l.setAttribute("stroke-width", String(o.widthPt * t / 72)), r.appendChild(l), r;
161
+ }
162
+ function Le(e, t, n, r) {
163
163
  const i = r.createElement("div");
164
- i.className = `${T("comp", n)} mr-kind-${e.kind}`;
165
- const l = v("block").add("position", "absolute").mm("left", e.leftMm, t).mm("top", e.topMm, t).mm("width", e.widthMm, t).mm("height", e.heightMm, t).add("box-sizing", "border-box");
166
- if (Xe(l, e, t), l.applyTo(i), J(e))
167
- return i.appendChild(rt(e, n, r)), i;
164
+ i.className = `${C("comp", n)} mr-kind-${e.kind}`;
165
+ const s = x("block").add("position", "absolute").mm("left", e.leftMm, t).mm("top", e.topMm, t).mm("width", e.widthMm, t).mm("height", e.heightMm, t).add("box-sizing", "border-box");
166
+ if (lt(s, e, t), s.applyTo(i), Q(e))
167
+ return i.appendChild(gt(e, n, r)), i;
168
168
  if (e.kind === "text")
169
- return i.appendChild(nt(e, t, n, r)), i;
169
+ return i.appendChild(ht(e, t, n, r)), i;
170
170
  if (e.grid) {
171
- const a = ge(e, t, n, r);
172
- return a.appendChild(Ze(e.grid, e, t, n, r)), i.appendChild(a), i;
171
+ const o = Me(e, t, n, r);
172
+ return o.appendChild(ut(e.grid, e, t, n, r)), i.appendChild(o), i;
173
173
  }
174
174
  if (e.kind === "line" && e.lineDirection)
175
- return i.appendChild(it(e, t, r)), i;
175
+ return i.appendChild(pt(e, t, r)), i;
176
176
  if (e.kind === "line" || e.kind === "rect" || e.kind === "ellipse")
177
- return i.appendChild(ge(e, t, n, r)), i;
178
- const o = r.createElement("div");
179
- return o.className = T("unknown", n), v("block").applyTo(o), o.textContent = e.fallbackText ?? `[${e.kind}]`, o.dataset.mrUnsupported = e.kind, o.setAttribute("role", "note"), i.appendChild(o), i;
177
+ return i.appendChild(Me(e, t, n, r)), i;
178
+ const l = r.createElement("div");
179
+ return l.className = C("unknown", n), x("block").applyTo(l), l.textContent = e.fallbackText ?? `[${e.kind}]`, l.dataset.mrUnsupported = e.kind, l.setAttribute("role", "note"), i.appendChild(l), i;
180
180
  }
181
- function ot(e, t, n, r) {
181
+ function wt(e, t, n, r) {
182
182
  const i = r.createElement("div");
183
- return i.className = T("page", n), v("block", "initial").add("position", "relative").add("font-family", q).add("font-size", `${F(D(void 0, t).fontSizePx, 2)}px`).add("line-height", String(X(void 0))).add("white-space", "pre-wrap").add("direction", "ltr").mm("width", e.pageWidthMm, t).mm("height", e.pageHeightMm, t).add("background-color", "#fff").add("color", ve).add("overflow", "hidden").add("box-sizing", "border-box").applyTo(i), e.components.forEach((l, o) => {
184
- const a = Pe(l, t, n, r);
185
- a.dataset.mrComponentIndex = String(o), i.appendChild(a);
183
+ return i.className = C("page", n), x("block", "initial").add("position", "relative").add("font-family", ee).add("font-size", `${H(j(void 0, t).fontSizePx, 2)}px`).add("line-height", String(te(void 0))).add("white-space", "pre-wrap").add("direction", "ltr").mm("width", e.pageWidthMm, t).mm("height", e.pageHeightMm, t).add("background-color", "#fff").add("color", Pe).add("overflow", "hidden").add("box-sizing", "border-box").applyTo(i), e.components.forEach((s, l) => {
184
+ const o = Le(s, t, n, r);
185
+ o.dataset.mrComponentIndex = String(l), i.appendChild(o);
186
186
  }), i;
187
187
  }
188
- function Qt(e, t, n = {}) {
188
+ function On(e, t, n = {}) {
189
189
  const r = n.dpi ?? 96;
190
- W(e, "dom", n);
190
+ V(e, "dom", n);
191
191
  const i = t.createElement("div");
192
- return i.className = T("root", n), v("block").applyTo(i), i.dataset.schemaVersion = e.schemaVersion, e.pages.forEach((l) => {
193
- i.appendChild(ot(l, r, n, t));
192
+ return i.className = C("root", n), x("block").applyTo(i), i.dataset.schemaVersion = e.schemaVersion, e.pages.forEach((s) => {
193
+ i.appendChild(wt(s, r, n, t));
194
194
  }), i;
195
195
  }
196
196
  function A(e) {
197
197
  if (e?.aborted) throw e.reason ?? new DOMException("The operation was aborted.", "AbortError");
198
198
  }
199
- const at = (e, t) => (A(t), /^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e) ? new Promise((n, r) => {
200
- const i = new Image(), l = () => {
201
- i.onload = null, i.onerror = null, t?.removeEventListener("abort", o);
202
- }, o = () => {
203
- l(), i.src = "", r(t?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
199
+ const bt = (e, t) => (A(t), /^data:image\/(?:png|jpe?g|webp|gif|svg\+xml)[;,]/i.test(e) ? new Promise((n, r) => {
200
+ const i = new Image(), s = () => {
201
+ i.onload = null, i.onerror = null, t?.removeEventListener("abort", l);
202
+ }, l = () => {
203
+ s(), i.src = "", r(t?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
204
204
  };
205
205
  i.onload = () => {
206
- l(), n(i);
206
+ s(), n(i);
207
207
  }, i.onerror = () => {
208
- l(), r(new Error("Image could not be decoded for Canvas output."));
209
- }, t?.addEventListener("abort", o, { once: !0 }), i.src = e;
208
+ s(), r(new Error("Image could not be decoded for Canvas output."));
209
+ }, t?.addEventListener("abort", l, { once: !0 }), i.src = e;
210
210
  }) : Promise.reject(new TypeError("Canvas imageData must be an image data URL; provide imageLoader for other sources.")));
211
- function st(e, t, n) {
211
+ function vt(e, t, n) {
212
212
  return A(n), n ? new Promise((r, i) => {
213
- const l = () => i(n.reason ?? new DOMException("The operation was aborted.", "AbortError"));
214
- n.addEventListener("abort", l, { once: !0 }), Promise.resolve().then(() => e(t, n)).then(r, i).finally(() => n.removeEventListener("abort", l));
213
+ const s = () => i(n.reason ?? new DOMException("The operation was aborted.", "AbortError"));
214
+ n.addEventListener("abort", s, { once: !0 }), Promise.resolve().then(() => e(t, n)).then(r, i).finally(() => n.removeEventListener("abort", s));
215
215
  }) : e(t);
216
216
  }
217
- async function lt(e, t, n) {
217
+ async function yt(e, t, n) {
218
218
  const r = /* @__PURE__ */ new Map();
219
219
  for (const i of e.components)
220
- !J(i) || r.has(i.imageData) || r.set(i.imageData, await st(t, i.imageData, n));
220
+ !Q(i) || r.has(i.imageData) || r.set(i.imageData, await vt(t, i.imageData, n));
221
221
  return A(n), r;
222
222
  }
223
- function ct(e, t, n, r, i, l) {
224
- const o = t, a = o.naturalWidth ?? o.width ?? i, s = o.naturalHeight ?? o.height ?? l;
225
- if (a <= 0 || s <= 0) throw new RangeError("Decoded Canvas image dimensions must be positive.");
226
- const c = Math.min(i / a, l / s), d = a * c, u = s * c;
227
- e.drawImage(t, n + (i - d) / 2, r + (l - u) / 2, d, u);
223
+ function xt(e, t, n, r, i, s) {
224
+ const l = t, o = l.naturalWidth ?? l.width ?? i, a = l.naturalHeight ?? l.height ?? s;
225
+ if (o <= 0 || a <= 0) throw new RangeError("Decoded Canvas image dimensions must be positive.");
226
+ const c = Math.min(i / o, s / a), d = o * c, u = a * c;
227
+ e.drawImage(t, n + (i - d) / 2, r + (s - u) / 2, d, u);
228
228
  }
229
- function dt(e) {
230
- return Ve(e.pageHeightsPx, e.gapPx).window(e.viewportHeightPx, e.scrollTopPx, e.overscan);
229
+ function Mt(e) {
230
+ return rt(e.pageHeightsPx, e.gapPx).window(e.viewportHeightPx, e.scrollTopPx, e.overscan);
231
231
  }
232
- const oe = 96 / 25.4;
233
- function ae(e, t = 96) {
234
- const n = t / 96 * oe;
232
+ const de = 96 / 25.4;
233
+ function ue(e, t = 96) {
234
+ const n = t / 96 * de;
235
235
  return {
236
236
  widthPx: Math.max(1, Math.round(e.pageWidthMm * n)),
237
237
  heightPx: Math.max(1, Math.round(e.pageHeightMm * n))
238
238
  };
239
239
  }
240
- function ke(e, t, n, r = 64e6) {
240
+ function ze(e, t, n, r = 64e6) {
241
241
  if (!Number.isFinite(t) || t <= 0 || !Number.isFinite(n) || n <= 0) throw new RangeError("Canvas dpr and dpi must be positive finite numbers.");
242
242
  if (!Number.isFinite(r) || r <= 0) throw new RangeError("maxCanvasPixels must be positive and finite.");
243
- const i = ae(e, n), l = Math.round(i.widthPx * t), o = Math.round(i.heightPx * t);
244
- if (!Number.isSafeInteger(l) || !Number.isSafeInteger(o) || l * o > r) throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");
245
- return { width: l, height: o };
246
- }
247
- function Re(e, t, n, r) {
248
- const i = document.createElement("canvas"), { widthPx: l, heightPx: o } = ae(e, n), a = ke(e, t, n, r);
249
- i.width = a.width, i.height = a.height, i.style.width = `${l}px`, i.style.height = `${o}px`;
250
- const s = i.getContext("2d");
251
- if (!s)
243
+ const i = ue(e, n), s = Math.round(i.widthPx * t), l = Math.round(i.heightPx * t);
244
+ if (!Number.isSafeInteger(s) || !Number.isSafeInteger(l) || s * l > r) throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");
245
+ return { width: s, height: l };
246
+ }
247
+ function He(e, t, n, r) {
248
+ const i = document.createElement("canvas"), { widthPx: s, heightPx: l } = ue(e, n), o = ze(e, t, n, r);
249
+ i.width = o.width, i.height = o.height, i.style.width = `${s}px`, i.style.height = `${l}px`;
250
+ const a = i.getContext("2d");
251
+ if (!a)
252
252
  throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");
253
- return s.scale(t, t), s.fillStyle = "#ffffff", s.fillRect(0, 0, l, o), { canvas: i, ctx: s };
253
+ return a.scale(t, t), a.fillStyle = "#ffffff", a.fillRect(0, 0, s, l), { canvas: i, ctx: a };
254
254
  }
255
- function Zt(e, t = 96) {
256
- return D(e, t).fontSizePx;
255
+ function Dn(e, t = 96) {
256
+ return j(e, t).fontSizePx;
257
257
  }
258
- function Ie(e, t, n, r, i, l, o, a = "top") {
259
- e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSizePx}px ${o}`, "letterSpacing" in e && (e.letterSpacing = "0px"), e.fillStyle = t.color, e.textBaseline = "alphabetic";
260
- const s = t.fontSizePx * t.lineHeight, c = t.text === "" ? [""] : t.text.split(`
261
- `), d = c.length * s;
258
+ function je(e, t, n, r, i, s, l, o = "top") {
259
+ e.font = `${t.italic ? "italic " : ""}${t.bold ? "bold " : ""}${t.fontSizePx}px ${l}`, "letterSpacing" in e && (e.letterSpacing = "0px"), e.fillStyle = t.color, e.textBaseline = "alphabetic";
260
+ const a = t.fontSizePx * t.lineHeight, c = t.text === "" ? [""] : t.text.split(`
261
+ `), d = c.length * a;
262
262
  let u = r;
263
- a === "middle" ? u = r + (l - d) / 2 : a === "bottom" && (u = r + l - d), c.forEach((m, f) => {
264
- ut(e, m, t, n, u + f * s + t.fontSizePx * 0.8, i);
263
+ o === "middle" ? u = r + (s - d) / 2 : o === "bottom" && (u = r + s - d), c.forEach((m, f) => {
264
+ Et(e, m, t, n, u + f * a + t.fontSizePx * 0.8, i);
265
265
  }), e.textAlign = "left";
266
266
  }
267
- function ut(e, t, n, r, i, l) {
268
- const o = Array.from(t), a = n.letterSpacingPx ?? 0;
269
- if (!a) {
267
+ function Et(e, t, n, r, i, s) {
268
+ const l = Array.from(t), o = n.letterSpacingPx ?? 0;
269
+ if (!o) {
270
270
  e.textAlign = n.align === "center" ? "center" : n.align === "right" ? "right" : "left";
271
- const u = n.align === "center" ? r + l / 2 : n.align === "right" ? r + l : r;
271
+ const u = n.align === "center" ? r + s / 2 : n.align === "right" ? r + s : r;
272
272
  e.fillText(t, u, i);
273
273
  return;
274
274
  }
275
- const s = e.measureText(t).width + Math.max(0, o.length - 1) * a, c = n.align === "center" ? r + (l - s) / 2 : n.align === "right" ? r + l - s : r;
275
+ const a = e.measureText(t).width + Math.max(0, l.length - 1) * o, c = n.align === "center" ? r + (s - a) / 2 : n.align === "right" ? r + s - a : r;
276
276
  e.textAlign = "left";
277
277
  let d = "";
278
- o.forEach((u, m) => {
279
- e.fillText(u, c + e.measureText(d).width + m * a, i), d += u;
278
+ l.forEach((u, m) => {
279
+ e.fillText(u, c + e.measureText(d).width + m * o, i), d += u;
280
280
  });
281
281
  }
282
- function mt(e, t, n, r, i, l, o) {
283
- for (const a of Se(t, n))
284
- e.strokeStyle = a.color, e.lineWidth = O(a.widthPt, o), e.beginPath(), a.kind === "v" ? (e.moveTo(r + a.pos * l, i + a.from * l), e.lineTo(r + a.pos * l, i + a.to * l)) : (e.moveTo(r + a.from * l, i + a.pos * l), e.lineTo(r + a.to * l, i + a.pos * l)), e.stroke();
282
+ function St(e, t, n, r, i, s, l) {
283
+ for (const o of Fe(t, n))
284
+ e.strokeStyle = o.color, e.lineWidth = L(o.widthPt, l), e.beginPath(), o.kind === "v" ? (e.moveTo(r + o.pos * s, i + o.from * s), e.lineTo(r + o.pos * s, i + o.to * s)) : (e.moveTo(r + o.from * s, i + o.pos * s), e.lineTo(r + o.to * s, i + o.pos * s)), e.stroke();
285
285
  }
286
- function ft(e, t, n, r, i, l) {
287
- e.beginPath(), t.top && (e.moveTo(n, r), e.lineTo(n + i, r)), t.right && (e.moveTo(n + i, r), e.lineTo(n + i, r + l)), t.bottom && (e.moveTo(n + i, r + l), e.lineTo(n, r + l)), t.left && (e.moveTo(n, r + l), e.lineTo(n, r)), e.stroke();
286
+ function Tt(e, t, n, r, i, s) {
287
+ e.beginPath(), t.top && (e.moveTo(n, r), e.lineTo(n + i, r)), t.right && (e.moveTo(n + i, r), e.lineTo(n + i, r + s)), t.bottom && (e.moveTo(n + i, r + s), e.lineTo(n, r + s)), t.left && (e.moveTo(n, r + s), e.lineTo(n, r)), e.stroke();
288
288
  }
289
- function ht(e, t, n, r, i, l, o, a, s, c, d) {
290
- const u = H(t, l / a, o / a);
289
+ function Ct(e, t, n, r, i, s, l, o, a, c, d) {
290
+ const u = K(t, s / o, l / o);
291
291
  for (const f of u.cells) {
292
- const g = f.cell.style?.backgroundColor ?? n.style?.backgroundColor;
293
- g && (e.fillStyle = g, e.fillRect(r + f.xMm * a, i + f.yMm * a, f.widthMm * a, f.heightMm * a));
292
+ const h = f.cell.style?.backgroundColor ?? n.style?.backgroundColor;
293
+ h && (e.fillStyle = h, e.fillRect(r + f.xMm * o, i + f.yMm * o, f.widthMm * o, f.heightMm * o));
294
294
  }
295
- mt(e, u, n, r, i, a, s);
295
+ St(e, u, n, r, i, o, a);
296
296
  const m = t.paddingMm ?? 0.5;
297
297
  for (const f of u.cells) {
298
- const g = f.cell.text ?? "";
299
- if (!g) continue;
300
- const h = xe(n.style, f.cell.style), w = D(h, s), y = Math.max(0, f.widthMm - 2 * m), x = Te(g, y, { fontSizePt: w.fontSizePt, bold: h.bold, italic: h.italic, fontFamily: h.fontFamily ?? c, letterSpacingPt: h.letterSpacing }, d).join(`
298
+ const h = f.cell.text ?? "";
299
+ if (!h) continue;
300
+ const g = ke(n.style, f.cell.style), b = j(g, a), E = Math.max(0, f.widthMm - 2 * m), S = Ne(h, E, { fontSizePt: b.fontSizePt, bold: g.bold, italic: g.italic, fontFamily: g.fontFamily ?? c, letterSpacingPt: g.letterSpacing }, d).join(`
301
301
  `);
302
- Ie(
302
+ je(
303
303
  e,
304
304
  {
305
- text: x,
306
- fontSizePx: w.fontSizePx,
307
- bold: h.bold ?? !1,
308
- italic: h.italic,
309
- color: Ee(h, ve),
310
- align: h.align ?? "left",
311
- lineHeight: X(h),
312
- letterSpacingPx: O(h.letterSpacing ?? 0, s)
305
+ text: S,
306
+ fontSizePx: b.fontSizePx,
307
+ bold: g.bold ?? !1,
308
+ italic: g.italic,
309
+ color: $e(g, Pe),
310
+ align: g.align ?? "left",
311
+ lineHeight: te(g),
312
+ letterSpacingPx: L(g.letterSpacing ?? 0, a)
313
313
  },
314
- r + (f.xMm + m) * a,
315
- i + (f.yMm + m) * a,
316
- y * a,
317
- Math.max(0, f.heightMm - 2 * m) * a,
318
- h.fontFamily ?? c,
319
- h.verticalAlign ?? "middle"
314
+ r + (f.xMm + m) * o,
315
+ i + (f.yMm + m) * o,
316
+ E * o,
317
+ Math.max(0, f.heightMm - 2 * m) * o,
318
+ g.fontFamily ?? c,
319
+ g.verticalAlign ?? "middle"
320
320
  );
321
321
  }
322
322
  }
323
- function gt(e, t, n, r, i, l, o, a, s) {
324
- const c = t.style ?? {}, d = D(c, o), u = ye(t) ? t.richParagraphs.map((m) => m.segments.map((f) => f.text ?? f.field ?? "").join("")).join(`
323
+ function It(e, t, n, r, i, s, l, o, a) {
324
+ const c = t.style ?? {}, d = j(c, l), u = Re(t) ? t.richParagraphs.map((m) => m.segments.map((f) => f.text ?? f.field ?? "").join("")).join(`
325
325
  `) : t.lines?.length ? t.lines.join(`
326
- `) : Te(t.text ?? "", t.widthMm, { fontSizePt: d.fontSizePt, bold: c.bold, italic: c.italic, fontFamily: c.fontFamily ?? a, letterSpacingPt: c.letterSpacing }, s).join(`
326
+ `) : Ne(t.text ?? "", t.widthMm, { fontSizePt: d.fontSizePt, bold: c.bold, italic: c.italic, fontFamily: c.fontFamily ?? o, letterSpacingPt: c.letterSpacing }, a).join(`
327
327
  `);
328
- Ie(e, {
328
+ je(e, {
329
329
  text: u,
330
330
  fontSizePx: d.fontSizePx,
331
331
  bold: c.bold ?? !1,
332
332
  italic: c.italic,
333
- color: Ee(c),
333
+ color: $e(c),
334
334
  align: c.align ?? "left",
335
- lineHeight: X(c),
336
- letterSpacingPx: O(c.letterSpacing ?? 0, o)
337
- }, n, r, i, l, c.fontFamily ?? a, c.verticalAlign);
338
- }
339
- function se(e, t, n, r, i, l, o) {
340
- const a = t.leftMm * n, s = t.topMm * n, c = t.widthMm * n, d = t.heightMm * n, u = t.style ?? {};
341
- if (J(t)) {
342
- const m = o?.get(t.imageData);
343
- m ? ct(e, m, a, s, c, d) : pe(e, t, a, s, c, d);
335
+ lineHeight: te(c),
336
+ letterSpacingPx: L(c.letterSpacing ?? 0, l)
337
+ }, n, r, i, s, c.fontFamily ?? o, c.verticalAlign);
338
+ }
339
+ function me(e, t, n, r, i, s, l) {
340
+ const o = t.leftMm * n, a = t.topMm * n, c = t.widthMm * n, d = t.heightMm * n, u = t.style ?? {};
341
+ if (Q(t)) {
342
+ const m = l?.get(t.imageData);
343
+ m ? xt(e, m, o, a, c, d) : Ee(e, t, o, a, c, d);
344
344
  return;
345
345
  }
346
346
  if (t.grid) {
347
- ht(e, t.grid, t, a, s, c, d, n, r, i, l);
347
+ Ct(e, t.grid, t, o, a, c, d, n, r, i, s);
348
348
  return;
349
349
  }
350
350
  switch (t.kind) {
351
351
  case "text": {
352
- gt(e, t, a, s, c, d, r, i, l);
352
+ It(e, t, o, a, c, d, r, i, s);
353
353
  break;
354
354
  }
355
355
  case "rect": {
356
- const m = j(u), f = Me(u);
357
- u.backgroundColor && (e.fillStyle = u.backgroundColor, e.fillRect(a, s, c, d)), f.inner && (e.strokeStyle = m.color, e.lineWidth = O(m.widthPt, r), ft(e, f, a, s, c, d));
356
+ const m = B(u), f = Ae(u);
357
+ u.backgroundColor && (e.fillStyle = u.backgroundColor, e.fillRect(o, a, c, d)), f.inner && (e.strokeStyle = m.color, e.lineWidth = L(m.widthPt, r), Tt(e, f, o, a, c, d));
358
358
  break;
359
359
  }
360
360
  case "line": {
361
- const m = j({ ...u, borderColor: u.lineColor ?? u.borderColor });
362
- e.strokeStyle = m.color, e.lineWidth = O(m.widthPt, r), e.beginPath();
363
- const f = t.lineDirection === "up" ? s + d : t.lineDirection === "down" ? s : s + d / 2, g = t.lineDirection === "up" ? s : t.lineDirection === "down" ? s + d : s + d / 2;
364
- e.moveTo(a, f), e.lineTo(a + c, g), e.stroke();
361
+ const m = B({ ...u, borderColor: u.lineColor ?? u.borderColor });
362
+ e.strokeStyle = m.color, e.lineWidth = L(m.widthPt, r), e.beginPath();
363
+ const f = t.lineDirection === "up" ? a + d : t.lineDirection === "down" ? a : a + d / 2, h = t.lineDirection === "up" ? a : t.lineDirection === "down" ? a + d : a + d / 2;
364
+ e.moveTo(o, f), e.lineTo(o + c, h), e.stroke();
365
365
  break;
366
366
  }
367
367
  case "ellipse": {
368
- const m = j(u);
369
- e.strokeStyle = m.color, e.lineWidth = O(m.widthPt, r), u.backgroundColor && (e.fillStyle = u.backgroundColor, e.beginPath(), e.ellipse(a + c / 2, s + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(a + c / 2, s + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
368
+ const m = B(u);
369
+ e.strokeStyle = m.color, e.lineWidth = L(m.widthPt, r), u.backgroundColor && (e.fillStyle = u.backgroundColor, e.beginPath(), e.ellipse(o + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(o + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
370
370
  break;
371
371
  }
372
372
  default:
373
- pe(e, t, a, s, c, d);
373
+ Ee(e, t, o, a, c, d);
374
374
  break;
375
375
  }
376
376
  }
377
- function pe(e, t, n, r, i, l) {
378
- e.save(), e.strokeStyle = "#94a3b8", e.strokeRect(n, r, i, l), e.fillStyle = "#64748b", e.font = "12px sans-serif", e.fillText(t.fallbackText ?? `[${t.kind}]`, n + 3, r + 14), e.restore();
377
+ function Ee(e, t, n, r, i, s) {
378
+ e.save(), e.strokeStyle = "#94a3b8", e.strokeRect(n, r, i, s), e.fillStyle = "#64748b", e.font = "12px sans-serif", e.fillText(t.fallbackText ?? `[${t.kind}]`, n + 3, r + 14), e.restore();
379
379
  }
380
- async function en(e, t = {}) {
380
+ async function Ln(e, t = {}) {
381
381
  if (typeof document > "u")
382
382
  throw new Error("renderPlanToImages 需要浏览器环境(SSR/Node 请在客户端钩子中调用)");
383
383
  const { format: n = "png", quality: r = 0.92, ...i } = t;
384
384
  if (n !== "png" && n !== "jpeg") throw new TypeError("Image format must be png or jpeg.");
385
385
  if (!Number.isFinite(r) || r < 0 || r > 1) throw new RangeError("Image quality must be between 0 and 1.");
386
386
  A(t.signal);
387
- const l = await ie(e, { ...t, format: "canvas" });
388
- e = l.plan;
389
- const o = [...l.diagnostics, ...W(e, "canvas", t)], a = n === "jpeg" ? "image/jpeg" : "image/png", s = [], c = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
387
+ const s = await ce(e, { ...t, format: "canvas" });
388
+ e = s.plan;
389
+ const l = [...s.diagnostics, ...V(e, "canvas", t)], o = n === "jpeg" ? "image/jpeg" : "image/png", a = [], c = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
390
390
  for (let d = Math.max(0, t.start ?? 0); d <= c; d++) {
391
391
  A(t.signal);
392
- const u = await Ae(e.pages[d], d, i, o);
392
+ const u = await We(e.pages[d], d, i, l);
393
393
  try {
394
- s.push(await pt(u, a, r, t.signal));
394
+ a.push(await Pt(u, o, r, t.signal));
395
395
  } finally {
396
396
  u.width = 0, u.height = 0;
397
397
  }
398
+ await tt(t, a.length, c - Math.max(0, t.start ?? 0) + 1);
398
399
  }
399
- return A(t.signal), { blobs: s, diagnostics: o };
400
+ return A(t.signal), { blobs: a, diagnostics: l };
400
401
  }
401
- function pt(e, t, n, r) {
402
- return A(r), new Promise((i, l) => {
403
- const o = () => l(r?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
404
- r?.addEventListener("abort", o, { once: !0 });
402
+ function Pt(e, t, n, r) {
403
+ return A(r), new Promise((i, s) => {
404
+ const l = () => s(r?.reason ?? new DOMException("The operation was aborted.", "AbortError"));
405
+ r?.addEventListener("abort", l, { once: !0 });
405
406
  try {
406
- e.toBlob((a) => {
407
- r?.removeEventListener("abort", o), a ? i(a) : l(new Error("Canvas encoding failed; no empty image was emitted."));
407
+ e.toBlob((o) => {
408
+ r?.removeEventListener("abort", l), o ? i(o) : s(new Error("Canvas encoding failed; no empty image was emitted."));
408
409
  }, t, n);
409
- } catch (a) {
410
- r?.removeEventListener("abort", o), l(a);
410
+ } catch (o) {
411
+ r?.removeEventListener("abort", l), s(o);
411
412
  }
412
413
  });
413
414
  }
414
- function tn(e, t = {}) {
415
- if (typeof document > "u")
415
+ function zn(e, t = {}) {
416
+ if (A(t.signal), typeof document > "u")
416
417
  throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");
417
- const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, i = r / 96 * oe, l = t.fontFamily ?? q, o = t.measurer ?? re, a = Math.max(0, t.start ?? 0), s = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1), c = [], d = W(e, "canvas", t);
418
- for (let u = a; u <= s; u++) {
419
- const m = e.pages[u], { canvas: f, ctx: g } = Re(m, n, r, t.maxCanvasPixels);
420
- for (const h of m.components) {
421
- if (J(h)) {
422
- const w = { code: "async-image-required", severity: "warning", format: "canvas", pageIndex: u, componentIndex: m.components.indexOf(h), kind: h.kind, nid: h.nid, message: "Use renderPlanToCanvasAsync or renderPlanToImages to decode and include images." };
423
- d.push(w), t.onDiagnostic?.(w);
424
- }
425
- se(g, h, i, r, l, o);
426
- }
427
- c.push(f);
418
+ const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, i = r / 96 * de, s = t.fontFamily ?? ee, l = t.measurer ?? le, o = Math.max(0, t.start ?? 0), a = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1), c = [], d = V(e, "canvas", t), u = Rt(e, o, a);
419
+ for (const m of u)
420
+ Oe(m, t), d.push(m);
421
+ if (t.fidelity === "strict" && u.length) throw new nt(d);
422
+ for (let m = o; m <= a; m++) {
423
+ A(t.signal);
424
+ const f = e.pages[m], { canvas: h, ctx: g } = He(f, n, r, t.maxCanvasPixels);
425
+ for (const b of f.components)
426
+ me(g, b, i, r, s, l);
427
+ c.push(h);
428
428
  }
429
429
  return { canvases: c, diagnostics: d };
430
430
  }
431
- async function nn(e, t = {}) {
431
+ function Rt(e, t, n) {
432
+ return n < t ? [] : e.pages.slice(t, n + 1).flatMap((r, i) => r.components.flatMap((s, l) => Q(s) ? [{
433
+ code: "async-image-required",
434
+ severity: "warning",
435
+ format: "canvas",
436
+ pageIndex: t + i,
437
+ componentIndex: l,
438
+ kind: s.kind,
439
+ nid: s.nid,
440
+ message: "Use renderPlanToCanvasAsync or renderPlanToImages to decode and include images."
441
+ }] : []));
442
+ }
443
+ async function Hn(e, t = {}) {
432
444
  if (typeof document > "u") throw new Error("renderPlanToCanvasAsync 需要浏览器环境(Node 请使用 PDF 或 XLSX 输出)");
433
445
  A(t.signal);
434
- const n = await ie(e, { ...t, format: "canvas" });
446
+ const n = await ce(e, { ...t, format: "canvas" });
435
447
  e = n.plan;
436
- const r = [...n.diagnostics, ...W(e, "canvas", t)], i = [], l = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
437
- for (let o = Math.max(0, t.start ?? 0); o <= l; o++)
438
- i.push(await Ae(e.pages[o], o, t, r));
448
+ const r = [...n.diagnostics, ...V(e, "canvas", t)], i = [], s = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
449
+ for (let l = Math.max(0, t.start ?? 0); l <= s; l++)
450
+ i.push(await We(e.pages[l], l, t, r));
439
451
  return { canvases: i, diagnostics: r };
440
452
  }
441
- async function Ae(e, t, n, r) {
442
- const i = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), l = n.dpi ?? 96, o = n.fontFamily ?? q, a = await $e(e, t, n, r);
453
+ async function We(e, t, n, r) {
454
+ const i = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), s = n.dpi ?? 96, l = n.fontFamily ?? ee, o = await Be(e, t, n, r);
443
455
  A(n.signal);
444
- const { canvas: s, ctx: c } = Re(e, i, l, n.maxCanvasPixels);
445
- for (const d of e.components) se(c, d, l / 25.4, l, o, n.measurer ?? re, a);
446
- return s;
456
+ const { canvas: a, ctx: c } = He(e, i, s, n.maxCanvasPixels);
457
+ for (const d of e.components) me(c, d, s / 25.4, s, l, n.measurer ?? le, o);
458
+ return a;
447
459
  }
448
- async function $e(e, t, n, r) {
449
- const i = n.imageLoader ?? at;
450
- return lt(e, async (l, o) => {
460
+ async function Be(e, t, n, r) {
461
+ const i = n.imageLoader ?? bt;
462
+ return yt(e, async (s, l) => {
451
463
  try {
452
- return await i(l, o);
453
- } catch (a) {
454
- if (o?.aborted) throw a;
455
- const s = e.components.findIndex((u) => u.imageData === l), c = e.components[s], d = { code: "image-decode-failed", severity: "warning", format: "canvas", pageIndex: t, componentIndex: s, kind: c.kind, nid: c.nid, message: "Image decoding failed; raster output was cancelled instead of omitting the image." };
456
- throw r.push(d), n.onDiagnostic?.(d), a;
464
+ return await i(s, l);
465
+ } catch (o) {
466
+ if (l?.aborted) throw o;
467
+ const a = e.components.findIndex((u) => u.imageData === s), c = e.components[a], d = { code: "image-decode-failed", severity: "warning", format: "canvas", pageIndex: t, componentIndex: a, kind: c.kind, nid: c.nid, message: "Image decoding failed; raster output was cancelled instead of omitting the image." };
468
+ throw r.push(d), Oe(d, n), o;
457
469
  }
458
470
  }, n.signal);
459
471
  }
460
- function rn(e, t = {}) {
461
- const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, i = r / 96 * oe, l = t.fontFamily ?? q, o = t.measurer ?? re, a = t.overscan ?? 1, s = t.gapPx ?? 18, c = t.pagesPerFrame ?? 1, d = e.pages.map((p) => p.pageHeightMm * i), u = Math.max(1, ...e.pages.map((p) => p.pageWidthMm * i)), m = { start: 0, end: -1 };
462
- let f = null, g = null, h = null, w = null, y = [], x = 0, P = [], B = 0, z = new AbortController();
463
- const me = [];
464
- function He() {
472
+ function jn(e, t = {}) {
473
+ const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, i = r / 96 * de, s = t.fontFamily ?? ee, l = t.measurer ?? le, o = t.overscan ?? 1, a = t.gapPx ?? 18, c = t.pagesPerFrame ?? 1, d = e.pages.map((p) => p.pageHeightMm * i), u = Math.max(1, ...e.pages.map((p) => p.pageWidthMm * i)), m = { start: 0, end: -1 };
474
+ let f = null, h = null, g = null, b = null, E = [], S = 0, R = [], G = 0, W = new AbortController();
475
+ const ve = [];
476
+ function Ye() {
465
477
  const p = f;
466
- p.innerHTML = "", g = document.createElement("div"), g.style.cssText = `width:${u}px;margin:0 auto;`, h = document.createElement("div"), w = document.createElement("div"), g.appendChild(h), y = [];
467
- const E = Math.min(e.pages.length, 3 + a * 2);
468
- for (let $ = 0; $ < E; $++) {
469
- const b = document.createElement("div");
470
- b.style.cssText = `margin:0 auto ${s}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, g.appendChild(b), y.push(b);
478
+ p.innerHTML = "", h = document.createElement("div"), h.style.cssText = `width:${u}px;margin:0 auto;`, g = document.createElement("div"), b = document.createElement("div"), h.appendChild(g), E = [];
479
+ const T = Math.min(e.pages.length, 3 + o * 2);
480
+ for (let F = 0; F < T; F++) {
481
+ const y = document.createElement("div");
482
+ y.style.cssText = `margin:0 auto ${a}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, h.appendChild(y), E.push(y);
471
483
  }
472
- g.appendChild(w), p.appendChild(g);
484
+ h.appendChild(b), p.appendChild(h);
473
485
  }
474
- async function We(p, E) {
475
- const $ = B, b = await ie(e, { ...t, signal: z.signal, format: "canvas", start: E, end: E });
476
- me.push(...b.diagnostics);
477
- const S = b.plan.pages[E], V = await $e(S, E, { ...t, signal: z.signal }, me);
478
- if ($ !== B || !f) return;
479
- const { widthPx: Z, heightPx: ee } = ae(S, r);
480
- let I = p.firstElementChild;
481
- (!I || I.tagName !== "CANVAS") && (I = document.createElement("canvas"), p.innerHTML = "", p.appendChild(I));
482
- const he = ke(S, n, r, t.maxCanvasPixels);
483
- I.width = he.width, I.height = he.height, I.style.width = `${Z}px`, I.style.height = `${ee}px`;
484
- const L = I.getContext("2d");
485
- if (L) {
486
- L.setTransform(1, 0, 0, 1, 0, 0), L.scale(n, n), L.fillStyle = "#ffffff", L.fillRect(0, 0, Z, ee);
487
- for (const _e of S.components)
488
- se(L, _e, i, r, l, o, V);
489
- I.dataset.canvasPage = String(E), p.style.height = `${ee}px`, p.style.width = `${Z}px`;
486
+ async function Xe(p, T) {
487
+ const F = G, y = await ce(e, { ...t, signal: W.signal, format: "canvas", start: T, end: T });
488
+ ve.push(...y.diagnostics);
489
+ const I = y.plan.pages[T], J = await Be(I, T, { ...t, signal: W.signal }, ve);
490
+ if (F !== G || !f) return;
491
+ const { widthPx: ie, heightPx: oe } = ue(I, r);
492
+ let N = p.firstElementChild;
493
+ (!N || N.tagName !== "CANVAS") && (N = document.createElement("canvas"), p.innerHTML = "", p.appendChild(N));
494
+ const xe = ze(I, n, r, t.maxCanvasPixels);
495
+ N.width = xe.width, N.height = xe.height, N.style.width = `${ie}px`, N.style.height = `${oe}px`;
496
+ const D = N.getContext("2d");
497
+ if (D) {
498
+ D.setTransform(1, 0, 0, 1, 0, 0), D.scale(n, n), D.fillStyle = "#ffffff", D.fillRect(0, 0, ie, oe);
499
+ for (const Qe of I.components)
500
+ me(D, Qe, i, r, s, l, J);
501
+ N.dataset.canvasPage = String(T), p.style.height = `${oe}px`, p.style.width = `${ie}px`;
490
502
  }
491
503
  }
492
- function Be(p) {
493
- B++, m.start = p.start, m.end = p.end, h.style.height = `${p.start * s + d.slice(0, p.start).reduce((b, S) => b + S, 0)}px`;
494
- const E = e.pages.length - 1 - p.end;
495
- w.style.height = `${E * s + d.slice(p.end + 1).reduce((b, S) => b + S, 0)}px`;
496
- const $ = p.end - p.start + 1;
497
- y.forEach((b, S) => {
498
- if (S < $) {
499
- b.style.display = "";
500
- const V = p.start + S;
501
- b.style.height = `${d[V] ?? 0}px`;
504
+ function Ze(p) {
505
+ G++, m.start = p.start, m.end = p.end, g.style.height = `${p.start * a + d.slice(0, p.start).reduce((y, I) => y + I, 0)}px`;
506
+ const T = e.pages.length - 1 - p.end;
507
+ b.style.height = `${T * a + d.slice(p.end + 1).reduce((y, I) => y + I, 0)}px`;
508
+ const F = p.end - p.start + 1;
509
+ E.forEach((y, I) => {
510
+ if (I < F) {
511
+ y.style.display = "";
512
+ const J = p.start + I;
513
+ y.style.height = `${d[J] ?? 0}px`;
502
514
  } else
503
- b.style.display = "none";
504
- }), P = [];
505
- for (let b = p.start; b <= p.end; b++) {
506
- const S = y[b - p.start];
507
- if (!S) continue;
508
- S.firstElementChild?.dataset?.canvasPage !== String(b) && P.push(b);
515
+ y.style.display = "none";
516
+ }), R = [];
517
+ for (let y = p.start; y <= p.end; y++) {
518
+ const I = E[y - p.start];
519
+ if (!I) continue;
520
+ I.firstElementChild?.dataset?.canvasPage !== String(y) && R.push(y);
509
521
  }
510
- Q();
522
+ re();
511
523
  }
512
- function Q() {
513
- x || P.length === 0 || (x = requestAnimationFrame(() => {
514
- x = 0;
524
+ function re() {
525
+ S || R.length === 0 || (S = requestAnimationFrame(() => {
526
+ S = 0;
515
527
  let p = Math.max(1, c);
516
- for (; P.length > 0 && p-- > 0; ) {
517
- const E = P.shift(), $ = y[E - m.start];
518
- $ && We($, E).catch(() => {
528
+ for (; R.length > 0 && p-- > 0; ) {
529
+ const T = R.shift(), F = E[T - m.start];
530
+ F && Xe(F, T).catch(() => {
519
531
  });
520
532
  }
521
- P.length > 0 && Q();
533
+ R.length > 0 && re();
522
534
  }));
523
535
  }
524
- function _() {
525
- x || (x = requestAnimationFrame(() => {
526
- x = 0;
527
- const p = f, E = dt({
536
+ function U() {
537
+ S || (S = requestAnimationFrame(() => {
538
+ S = 0;
539
+ const p = f, T = Mt({
528
540
  pageHeightsPx: d,
529
541
  viewportHeightPx: p.clientHeight,
530
542
  scrollTopPx: p.scrollTop,
531
- overscan: a,
532
- gapPx: s
543
+ overscan: o,
544
+ gapPx: a
533
545
  });
534
- E.start !== m.start || E.end !== m.end ? Be(E) : Q();
546
+ T.start !== m.start || T.end !== m.end ? Ze(T) : re();
535
547
  }));
536
548
  }
537
- let K = null;
549
+ let q = null;
538
550
  return {
539
551
  attach(p) {
540
552
  if (typeof document > "u")
541
553
  throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");
542
- A(t.signal), z = new AbortController(), t.signal?.addEventListener("abort", fe, { once: !0 }), W(e, "canvas", t), f = p, He(), p.addEventListener("scroll", _, { passive: !0 }), typeof ResizeObserver < "u" && (K = new ResizeObserver(() => _()), K.observe(p)), _();
554
+ A(t.signal), W = new AbortController(), t.signal?.addEventListener("abort", ye, { once: !0 }), V(e, "canvas", t), f = p, Ye(), p.addEventListener("scroll", U, { passive: !0 }), typeof ResizeObserver < "u" && (q = new ResizeObserver(() => U()), q.observe(p)), U();
543
555
  },
544
556
  destroy() {
545
- B++, z.abort(), t.signal?.removeEventListener("abort", fe), x && cancelAnimationFrame(x), x = 0, K?.disconnect(), K = null, f?.removeEventListener("scroll", _), P = [], g?.remove(), f = null;
557
+ G++, W.abort(), t.signal?.removeEventListener("abort", ye), S && cancelAnimationFrame(S), S = 0, q?.disconnect(), q = null, f?.removeEventListener("scroll", U), R = [], h?.remove(), f = null;
546
558
  },
547
559
  window() {
548
560
  return { ...m };
549
561
  }
550
562
  };
551
- function fe() {
552
- z.abort(t.signal?.reason);
563
+ function ye() {
564
+ W.abort(t.signal?.reason);
553
565
  }
554
566
  }
555
- function Ne(e, t, n) {
567
+ function _e(e, t, n) {
556
568
  let r, i;
557
569
  if (typeof e == "string") {
558
- const l = G[e];
559
- if (!l) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(G).join("/")})`);
560
- r = l.widthMm, i = l.heightMm;
570
+ const s = Y[e];
571
+ if (!s) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(Y).join("/")})`);
572
+ r = s.widthMm, i = s.heightMm;
561
573
  } else typeof e == "number" ? (r = e, i = t ?? 297) : (r = e.widthMm, i = e.heightMm);
562
574
  return n ? { widthMm: i, heightMm: r } : { widthMm: r, heightMm: i };
563
575
  }
564
- class wt {
576
+ class At {
565
577
  constructor() {
566
578
  this.pages = [], this.pending = null, this.templateParams = void 0;
567
579
  }
@@ -590,18 +602,18 @@ class wt {
590
602
  */
591
603
  page(t = "a4", n = {}, r) {
592
604
  this.collect();
593
- const l = r != null && !("margins" in r) && !("landscape" in r) && ("marginTopMm" in r || "marginBottomMm" in r || "marginLeftMm" in r || "marginRightMm" in r) ? { margins: r } : typeof n == "number" ? r ?? {} : n, { widthMm: o, heightMm: a } = Ne(
605
+ const s = r != null && !("margins" in r) && !("landscape" in r) && ("marginTopMm" in r || "marginBottomMm" in r || "marginLeftMm" in r || "marginRightMm" in r) ? { margins: r } : typeof n == "number" ? r ?? {} : n, { widthMm: l, heightMm: o } = _e(
594
606
  t,
595
607
  typeof n == "number" ? n : void 0,
596
- l.landscape
597
- ), s = l.margins ?? {};
598
- return this.pending = new bt(this, {
599
- widthMm: o,
600
- heightMm: a,
601
- marginTopMm: s.marginTopMm ?? 10,
602
- marginBottomMm: s.marginBottomMm ?? 10,
603
- marginLeftMm: s.marginLeftMm ?? 10,
604
- marginRightMm: s.marginRightMm ?? 10
608
+ s.landscape
609
+ ), a = s.margins ?? {};
610
+ return this.pending = new kt(this, {
611
+ widthMm: l,
612
+ heightMm: o,
613
+ marginTopMm: a.marginTopMm ?? 10,
614
+ marginBottomMm: a.marginBottomMm ?? 10,
615
+ marginLeftMm: a.marginLeftMm ?? 10,
616
+ marginRightMm: a.marginRightMm ?? 10
605
617
  }), this.pending;
606
618
  }
607
619
  collect() {
@@ -613,7 +625,7 @@ class wt {
613
625
  return this.templateParams ? { params: this.templateParams, pages: this.pages } : { pages: this.pages };
614
626
  }
615
627
  }
616
- class bt {
628
+ class kt {
617
629
  constructor(t, n) {
618
630
  this.parent = t, this.page = n, this.components = [];
619
631
  }
@@ -682,11 +694,11 @@ class bt {
682
694
  return this.done().build();
683
695
  }
684
696
  }
685
- function on() {
686
- return new wt();
697
+ function Wn() {
698
+ return new At();
687
699
  }
688
- function an(e, t = {}) {
689
- return Ke([], e), e.fields.map((n) => ({
700
+ function Bn(e, t = {}) {
701
+ return et([], e), e.fields.map((n) => ({
690
702
  field: n.field,
691
703
  header: `${n.label ?? n.field}${n.unit ? ` (${n.unit})` : ""}`,
692
704
  semanticRole: n.semanticRole ?? (n.type === "number" || n.type === "decimal" ? "measure" : n.type === "date" ? "date" : n.enum ? "dimension" : "text"),
@@ -697,11 +709,11 @@ function k(e, t, n = !1) {
697
709
  if (!Number.isFinite(e) || (n ? e < 0 : e <= 0))
698
710
  throw new Error(`${t} 必须是有限${n ? "非负" : "正"}数`);
699
711
  }
700
- function U(e, t, n) {
712
+ function X(e, t, n) {
701
713
  if (e !== void 0 && !["left", "center", "right", "justify", ...n ? ["auto"] : []].includes(e))
702
714
  throw new Error(`${t} 必须是 left/center/right/justify${n ? "/auto" : ""}`);
703
715
  }
704
- function vt(e) {
716
+ function $t(e) {
705
717
  const t = e.layout ?? "page";
706
718
  if (t !== "page" && t !== "wide")
707
719
  throw new Error("layout 必须是 page 或 wide");
@@ -712,16 +724,16 @@ function vt(e) {
712
724
  const n = e.columnWidthMm ?? 30;
713
725
  return k(n, "columnWidthMm"), { layout: t, columnWidthMm: n };
714
726
  }
715
- function yt(e) {
727
+ function Nt(e) {
716
728
  const t = e.paper === void 0 ? "a4" : e.paper;
717
729
  if (typeof t != "string" && (typeof t != "object" || t === null) || e.landscape !== void 0 && typeof e.landscape != "boolean")
718
730
  throw new Error("paper 必须是纸张预设名或 { widthMm, heightMm } 对象,landscape 必须是布尔值");
719
- if (typeof t == "string" && !Object.prototype.hasOwnProperty.call(G, t))
720
- throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(G).join("/")})`);
721
- const n = Ne(t, void 0, e.landscape), r = n.widthMm, i = n.heightMm;
731
+ if (typeof t == "string" && !Object.prototype.hasOwnProperty.call(Y, t))
732
+ throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(Y).join("/")})`);
733
+ const n = _e(t, void 0, e.landscape), r = n.widthMm, i = n.heightMm;
722
734
  return k(r, "纸张 widthMm"), k(i, "纸张 heightMm"), { widthMm: r, heightMm: i };
723
735
  }
724
- function Mt(e) {
736
+ function Ft(e) {
725
737
  if (e.margins !== void 0 && (!e.margins || typeof e.margins != "object" || Array.isArray(e.margins)))
726
738
  throw new Error("margins 必须是页边距对象");
727
739
  const t = e.margins ?? {}, n = {
@@ -733,7 +745,7 @@ function Mt(e) {
733
745
  for (const [r, i] of Object.entries(n)) k(i, r, !0);
734
746
  return n;
735
747
  }
736
- function xt(e, t) {
748
+ function Ot(e, t) {
737
749
  const n = e.dataset === void 0 ? "detail" : e.dataset;
738
750
  if (typeof n != "string" || !n.trim())
739
751
  throw new Error("dataset 必须是非空字符串");
@@ -741,68 +753,68 @@ function xt(e, t) {
741
753
  throw new Error("title 必须是字符串");
742
754
  const r = e.titleHeightMm === void 0 ? 10 : e.titleHeightMm, i = e.titleGapMm === void 0 ? 4 : e.titleGapMm;
743
755
  k(r, "titleHeightMm"), k(i, "titleGapMm", !0);
744
- const l = e.title !== void 0 && e.title.length > 0, o = l ? r + i : 0;
745
- if (o >= t)
756
+ const s = e.title !== void 0 && e.title.length > 0, l = s ? r + i : 0;
757
+ if (l >= t)
746
758
  throw new Error("标题高度与间距占满页面,必须为表格保留可用高度");
747
- return { dataset: n, titleHeightMm: r, hasTitle: l, titleSpaceMm: o };
759
+ return { dataset: n, titleHeightMm: r, hasTitle: s, titleSpaceMm: l };
748
760
  }
749
- function Et(e) {
761
+ function Dt(e) {
750
762
  if (e.listOptions !== void 0 && (!e.listOptions || typeof e.listOptions != "object" || Array.isArray(e.listOptions)))
751
763
  throw new Error("listOptions 必须是列表配置对象");
752
764
  const t = e.listOptions ?? {};
753
- U(t.align, "listOptions.align", !0), U(t.headerAlign, "listOptions.headerAlign", !1);
765
+ X(t.align, "listOptions.align", !0), X(t.headerAlign, "listOptions.headerAlign", !1);
754
766
  for (const n of ["fontSizePt", "rowHeightMm", "paddingMm"]) {
755
767
  const r = t[n];
756
768
  r !== void 0 && k(r, `listOptions.${n}`, n === "paddingMm");
757
769
  }
758
770
  return t;
759
771
  }
760
- function Tt(e) {
772
+ function Lt(e) {
761
773
  let t = 0, n = 0;
762
774
  for (const [r, i] of e.entries()) {
763
775
  if (!i || typeof i.header != "string" || typeof i.field != "string" || !i.field.trim())
764
776
  throw new Error(`columns[${r}] 需要字符串 header 与非空 field`);
765
- U(i.align, `columns[${r}].align`, !0), U(i.headerAlign, `columns[${r}].headerAlign`, !1), i.flex !== void 0 && k(i.flex, `columns[${r}].flex`), i.widthMm !== void 0 ? (k(i.widthMm, `columns[${r}].widthMm`), t += i.widthMm) : n = Math.max(n, i.flex ?? 1);
777
+ X(i.align, `columns[${r}].align`, !0), X(i.headerAlign, `columns[${r}].headerAlign`, !1), i.flex !== void 0 && k(i.flex, `columns[${r}].flex`), i.widthMm !== void 0 ? (k(i.widthMm, `columns[${r}].widthMm`), t += i.widthMm) : n = Math.max(n, i.flex ?? 1);
766
778
  }
767
779
  return { fixedWidthMm: t, maxFlex: n };
768
780
  }
769
- function St(e, t, n, r) {
770
- const { fixedWidthMm: i, maxFlex: l } = Tt(e.columns);
781
+ function zt(e, t, n, r) {
782
+ const { fixedWidthMm: i, maxFlex: s } = Lt(e.columns);
771
783
  if (t === "page" && i > r)
772
784
  throw new Error(`固定列宽 ${i}mm 超出页面可用宽度 ${r}mm`);
773
- const o = r - i;
774
- if (t === "page" && l > 0 && o <= 0)
785
+ const l = r - i;
786
+ if (t === "page" && s > 0 && l <= 0)
775
787
  throw new Error("固定列占满页面可用宽度,自动列需要正的剩余宽度");
776
- const a = l > 0 ? e.columns.reduce((c, d) => c + (d.widthMm === void 0 ? (d.flex ?? 1) / l : 0), 0) : 0;
788
+ const o = s > 0 ? e.columns.reduce((c, d) => c + (d.widthMm === void 0 ? (d.flex ?? 1) / s : 0), 0) : 0;
777
789
  return { columns: e.columns.map(({ widthMm: c, flex: d, ...u }, m) => {
778
- const f = c ?? (t === "wide" ? n * (d ?? 1) : o * ((d ?? 1) / l) / a);
790
+ const f = c ?? (t === "wide" ? n * (d ?? 1) : l * ((d ?? 1) / s) / o);
779
791
  return k(f, `columns[${m}] 分配后的 widthMm`), { ...u, widthMm: f };
780
- }), fixedWidthMm: i, maxFlex: l };
792
+ }), fixedWidthMm: i, maxFlex: s };
781
793
  }
782
- function sn(e) {
794
+ function _n(e) {
783
795
  if (!e || typeof e != "object")
784
796
  throw new Error("标准明细模板需要 options 对象");
785
797
  if (!Array.isArray(e.columns) || e.columns.length === 0)
786
798
  throw new Error("columns 至少需要一列");
787
- const { layout: t, columnWidthMm: n } = vt(e), r = yt(e);
799
+ const { layout: t, columnWidthMm: n } = $t(e), r = Nt(e);
788
800
  let i = r.widthMm;
789
- const l = r.heightMm, o = Mt(e);
790
- let a = i - o.marginLeftMm - o.marginRightMm;
791
- const s = l - o.marginTopMm - o.marginBottomMm;
792
- if (t === "page" && a <= 0 || s <= 0)
801
+ const s = r.heightMm, l = Ft(e);
802
+ let o = i - l.marginLeftMm - l.marginRightMm;
803
+ const a = s - l.marginTopMm - l.marginBottomMm;
804
+ if (t === "page" && o <= 0 || a <= 0)
793
805
  throw new Error("页边距占满纸张,必须保留正的可用宽度和高度");
794
- const { dataset: c, titleHeightMm: d, hasTitle: u, titleSpaceMm: m } = xt(e, s), f = Et(e), { columns: g, fixedWidthMm: h, maxFlex: w } = St(e, t, n, a);
795
- t === "wide" && (a = g.reduce((x, P) => x + P.widthMm, 0), k(a, "宽表总列宽"), i = a + o.marginLeftMm + o.marginRightMm, k(i, "宽表总宽度"));
796
- const y = { widthMm: i, heightMm: l, ...o, components: [], ...t === "wide" ? { layout: t } : {} };
797
- return u && y.components.push({
806
+ const { dataset: c, titleHeightMm: d, hasTitle: u, titleSpaceMm: m } = Ot(e, a), f = Dt(e), { columns: h, fixedWidthMm: g, maxFlex: b } = zt(e, t, n, o);
807
+ t === "wide" && (o = h.reduce((S, R) => S + R.widthMm, 0), k(o, "宽表总列宽"), i = o + l.marginLeftMm + l.marginRightMm, k(i, "宽表总宽度"));
808
+ const E = { widthMm: i, heightMm: s, ...l, components: [], ...t === "wide" ? { layout: t } : {} };
809
+ return u && E.components.push({
798
810
  kind: "text",
799
811
  text: e.title,
800
- leftMm: o.marginLeftMm,
801
- topMm: o.marginTopMm,
802
- widthMm: a,
812
+ leftMm: l.marginLeftMm,
813
+ topMm: l.marginTopMm,
814
+ widthMm: o,
803
815
  heightMm: d,
804
816
  style: { fontSize: 16, bold: !0, align: "center", verticalAlign: "middle", ...e.titleStyle }
805
- }), y.components.push({
817
+ }), E.components.push({
806
818
  align: "auto",
807
819
  headerAlign: "center",
808
820
  ...f,
@@ -810,142 +822,142 @@ function sn(e) {
810
822
  ...t === "wide" ? { layout: t } : {},
811
823
  ...u ? { title: e.title } : {},
812
824
  dataset: c,
813
- columns: g,
814
- leftMm: o.marginLeftMm,
815
- topMm: o.marginTopMm + m,
816
- widthMm: t === "wide" || w > 0 ? a : h
817
- }), e.params === void 0 ? { pages: [y] } : { params: e.params, pages: [y] };
825
+ columns: h,
826
+ leftMm: l.marginLeftMm,
827
+ topMm: l.marginTopMm + m,
828
+ widthMm: t === "wide" || b > 0 ? o : g
829
+ }), e.params === void 0 ? { pages: [E] } : { params: e.params, pages: [E] };
818
830
  }
819
- function ln(e) {
831
+ function Kn(e) {
820
832
  return e;
821
833
  }
822
- class N extends Error {
834
+ class O extends Error {
823
835
  constructor(t, n) {
824
836
  super(n), this.code = t, this.name = "ReportTemplateStoreError";
825
837
  }
826
838
  }
827
- function R(e) {
839
+ function $(e) {
828
840
  return JSON.parse(JSON.stringify(e));
829
841
  }
830
- function C(e) {
842
+ function P(e) {
831
843
  if (!e?.aborted) return;
832
844
  const t = new Error("模板操作已取消");
833
845
  throw t.name = "AbortError", t;
834
846
  }
835
- function we(e) {
847
+ function Se(e) {
836
848
  const t = e ? Number(e.revision) : 0;
837
- if (!Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER) throw new N("history", "修订号无效或已达上限");
849
+ if (!Number.isSafeInteger(t) || t < 0 || t >= Number.MAX_SAFE_INTEGER) throw new O("history", "修订号无效或已达上限");
838
850
  return String(t + 1);
839
851
  }
840
- function cn(e, t = {}) {
841
- const n = async (o, a) => {
842
- C(a);
843
- const s = await e.read(o, a);
844
- return C(a), s ? R(s) : void 0;
845
- }, r = async (o, a) => {
846
- const s = await n(o, a.signal);
847
- if ((s?.revision ?? null) !== a.expectedRevision) throw new N("conflict", "模板已变化,请重新读取后提交");
848
- return s;
849
- }, i = async (o, a, s) => {
850
- if (C(a.signal), !await e.compareAndSwap(o.id, a.expectedRevision, R(o), { signal: a.signal, ...s ? { publication: R(s) } : {} })) throw new N("conflict", "模板已被其他请求更新");
851
- return R(o);
852
- }, l = (o, a, s, c) => {
853
- const d = we(o), u = te({ ...a, revision: d }), m = { revision: d, document: u, publishedAt: (t.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
854
- return c !== void 0 && (m.restoredFrom = c), i({ id: o.id, revision: d, publishedRevision: d, published: u }, s, m);
852
+ function Vn(e, t = {}) {
853
+ const n = async (l, o) => {
854
+ P(o);
855
+ const a = await e.read(l, o);
856
+ return P(o), a ? $(a) : void 0;
857
+ }, r = async (l, o) => {
858
+ const a = await n(l, o.signal);
859
+ if ((a?.revision ?? null) !== o.expectedRevision) throw new O("conflict", "模板已变化,请重新读取后提交");
860
+ return a;
861
+ }, i = async (l, o, a) => {
862
+ if (P(o.signal), !await e.compareAndSwap(l.id, o.expectedRevision, $(l), { signal: o.signal, ...a ? { publication: $(a) } : {} })) throw new O("conflict", "模板已被其他请求更新");
863
+ return $(l);
864
+ }, s = (l, o, a, c) => {
865
+ const d = Se(l), u = ae({ ...o, revision: d }), m = { revision: d, document: u, publishedAt: (t.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
866
+ return c !== void 0 && (m.restoredFrom = c), i({ id: l.id, revision: d, publishedRevision: d, published: u }, a, m);
855
867
  };
856
868
  return {
857
- list: async (o) => {
858
- C(o);
859
- const a = await e.list(o);
860
- return C(o), R(a);
869
+ list: async (l) => {
870
+ P(l);
871
+ const o = await e.list(l);
872
+ return P(l), $(o);
861
873
  },
862
- get: async (o, a = {}) => {
863
- const s = await n(o, a.signal), c = a.draft ? s?.draft : s?.published;
864
- return c ? te(c) : void 0;
874
+ get: async (l, o = {}) => {
875
+ const a = await n(l, o.signal), c = o.draft ? a?.draft : a?.published;
876
+ return c ? ae(c) : void 0;
865
877
  },
866
- history: async (o, a) => {
867
- C(a);
868
- const s = await e.history(o, a);
869
- return C(a), R(s);
878
+ history: async (l, o) => {
879
+ P(o);
880
+ const a = await e.history(l, o);
881
+ return P(o), $(a);
870
882
  },
871
- saveDraft: async (o, a) => {
872
- C(a.signal);
873
- const s = te(t.migrate ? await t.migrate(o) : o), c = await r(s.id, a), d = we(c);
883
+ saveDraft: async (l, o) => {
884
+ P(o.signal);
885
+ const a = ae(t.migrate ? await t.migrate(l) : l), c = await r(a.id, o), d = Se(c);
874
886
  return i({
875
- id: s.id,
887
+ id: a.id,
876
888
  revision: d,
877
- draft: { ...s, revision: d },
889
+ draft: { ...a, revision: d },
878
890
  ...c?.publishedRevision ? { publishedRevision: c.publishedRevision, published: c.published } : {}
879
- }, a);
891
+ }, o);
880
892
  },
881
- publish: async (o, a) => {
882
- const s = await r(o, a);
883
- if (!s) throw new N("missing", "模板不存在");
884
- if (!s.draft) throw new N("draft", "没有可发布的草稿");
885
- return l(s, s.draft, a);
893
+ publish: async (l, o) => {
894
+ const a = await r(l, o);
895
+ if (!a) throw new O("missing", "模板不存在");
896
+ if (!a.draft) throw new O("draft", "没有可发布的草稿");
897
+ return s(a, a.draft, o);
886
898
  },
887
- rollback: async (o, a, s) => {
888
- const c = await r(o, s);
889
- if (!c) throw new N("missing", "模板不存在");
890
- C(s.signal);
891
- const d = await e.getVersion(o, a, s.signal);
892
- if (!d) throw new N("history", "历史修订不存在");
893
- return l(c, d.document, s, a);
899
+ rollback: async (l, o, a) => {
900
+ const c = await r(l, a);
901
+ if (!c) throw new O("missing", "模板不存在");
902
+ P(a.signal);
903
+ const d = await e.getVersion(l, o, a.signal);
904
+ if (!d) throw new O("history", "历史修订不存在");
905
+ return s(c, d.document, a, o);
894
906
  }
895
907
  };
896
908
  }
897
- function dn() {
909
+ function Gn() {
898
910
  const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
899
911
  return {
900
912
  read: async (n, r) => {
901
- C(r);
913
+ P(r);
902
914
  const i = e.get(n);
903
- return i ? R(i) : void 0;
915
+ return i ? $(i) : void 0;
904
916
  },
905
- list: async (n) => (C(n), Array.from(e.values(), ({ id: r, revision: i, publishedRevision: l }) => ({ id: r, revision: i, ...l ? { publishedRevision: l } : {} }))),
906
- history: async (n, r) => (C(r), Array.from(t.get(n)?.values() ?? [], (i) => R(i))),
917
+ list: async (n) => (P(n), Array.from(e.values(), ({ id: r, revision: i, publishedRevision: s }) => ({ id: r, revision: i, ...s ? { publishedRevision: s } : {} }))),
918
+ history: async (n, r) => (P(r), Array.from(t.get(n)?.values() ?? [], (i) => $(i))),
907
919
  getVersion: async (n, r, i) => {
908
- C(i);
909
- const l = t.get(n)?.get(r);
910
- return l ? R(l) : void 0;
920
+ P(i);
921
+ const s = t.get(n)?.get(r);
922
+ return s ? $(s) : void 0;
911
923
  },
912
- compareAndSwap: async (n, r, i, l) => {
913
- if (C(l.signal), (e.get(n)?.revision ?? null) !== r) return !1;
914
- if (i.id !== n) throw new N("history", "状态 ID 与存储 ID 不一致");
915
- const o = R(i), a = l.publication;
916
- if (a) {
917
- const s = t.get(n) ?? /* @__PURE__ */ new Map();
918
- if (s.has(a.revision) || a.revision !== i.revision || a.document.id !== n) throw new N("history", "发布修订不可覆盖,且必须与状态修订和模板 ID 一致");
919
- s.set(a.revision, R(a)), t.set(n, s);
924
+ compareAndSwap: async (n, r, i, s) => {
925
+ if (P(s.signal), (e.get(n)?.revision ?? null) !== r) return !1;
926
+ if (i.id !== n) throw new O("history", "状态 ID 与存储 ID 不一致");
927
+ const l = $(i), o = s.publication;
928
+ if (o) {
929
+ const a = t.get(n) ?? /* @__PURE__ */ new Map();
930
+ if (a.has(o.revision) || o.revision !== i.revision || o.document.id !== n) throw new O("history", "发布修订不可覆盖,且必须与状态修订和模板 ID 一致");
931
+ a.set(o.revision, $(o)), t.set(n, a);
920
932
  }
921
- return e.set(n, o), !0;
933
+ return e.set(n, l), !0;
922
934
  }
923
935
  };
924
936
  }
925
- function Le(e) {
937
+ function Ke(e) {
926
938
  return !e || typeof e != "object" ? !1 : [e.pageIndex, e.componentIndex, e.rowIndex, e.columnIndex].every((t) => Number.isInteger(t) && t >= 0);
927
939
  }
928
- function Oe(e, t, n) {
940
+ function Ve(e, t, n) {
929
941
  const r = e.grid;
930
942
  if (!r) return null;
931
943
  const i = r.cells[t];
932
944
  if (!i) return null;
933
- const o = H(r, e.widthMm, e.heightMm).cells.filter((s) => s.ri === t).findIndex((s) => s.ci === n), a = i[o];
934
- return a ? { cell: a, sourceColumnIndex: o } : null;
945
+ const l = K(r, e.widthMm, e.heightMm).cells.filter((a) => a.ri === t).findIndex((a) => a.ci === n), o = i[l];
946
+ return o ? { cell: o, sourceColumnIndex: l } : null;
935
947
  }
936
- function Ct(e) {
948
+ function Ht(e) {
937
949
  return e.value !== void 0 ? e.value : e.rawText ?? e.text ?? null;
938
950
  }
939
- function Pt(e, t) {
951
+ function jt(e, t) {
940
952
  return e.valueType ? e.valueType : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t === null && e.numberFormat && /[0#?]/.test(e.numberFormat) ? "number" : "text";
941
953
  }
942
- function kt(e, t) {
954
+ function Wt(e, t) {
943
955
  if (e.editable === !1) return "cell";
944
956
  if (e.formula !== void 0) return "formula";
945
957
  if (e.children?.length) return "complex";
946
958
  if (t.table && t.table.role !== "body" && e.editable !== !0) return "structure";
947
959
  }
948
- function Rt(e, t) {
960
+ function Bt(e, t) {
949
961
  const n = e.table;
950
962
  if (n)
951
963
  return {
@@ -955,53 +967,53 @@ function Rt(e, t) {
955
967
  columnKey: n.columnKeys[t.columnIndex]
956
968
  };
957
969
  }
958
- function It(e, t, n) {
970
+ function _t(e, t, n) {
959
971
  if (e.source) return { ...e.source };
960
972
  const r = t.table?.source, i = t.table?.columnKeys[n.columnIndex];
961
973
  if (!(!r || r.rowKey === void 0 || i === void 0))
962
974
  return { ...r, rowKey: r.rowKey, field: i };
963
975
  }
964
- function Fe(e, t, n) {
965
- const r = Ct(n), i = kt(n, e);
976
+ function Ge(e, t, n) {
977
+ const r = Ht(n), i = Wt(n, e);
966
978
  return {
967
979
  address: { ...t },
968
980
  cell: n,
969
981
  component: e,
970
982
  value: r,
971
- valueType: Pt(n, r),
972
- table: Rt(e, t),
973
- source: It(n, e, t),
983
+ valueType: jt(n, r),
984
+ table: Bt(e, t),
985
+ source: _t(n, e, t),
974
986
  editable: i === void 0,
975
987
  readOnlyReason: i
976
988
  };
977
989
  }
978
- function le(e, t) {
979
- if (!Le(t)) return null;
990
+ function fe(e, t) {
991
+ if (!Ke(t)) return null;
980
992
  const n = e.pages[t.pageIndex]?.components[t.componentIndex];
981
993
  if (!n) return null;
982
- const r = Oe(n, t.rowIndex, t.columnIndex);
983
- return r ? Fe(n, t, r.cell) : null;
994
+ const r = Ve(n, t.rowIndex, t.columnIndex);
995
+ return r ? Ge(n, t, r.cell) : null;
984
996
  }
985
- function ce(e) {
997
+ function he(e) {
986
998
  const t = /* @__PURE__ */ new Map();
987
999
  return (n) => {
988
- if (!Le(n)) return null;
1000
+ if (!Ke(n)) return null;
989
1001
  const r = e.pages[n.pageIndex]?.components[n.componentIndex];
990
1002
  if (!r?.grid) return null;
991
1003
  let i = t.get(r);
992
1004
  if (!i) {
993
- const o = /* @__PURE__ */ new Map();
1005
+ const l = /* @__PURE__ */ new Map();
994
1006
  i = /* @__PURE__ */ new Map();
995
- for (const a of H(r.grid, r.widthMm, r.heightMm).cells) {
996
- const s = o.get(a.ri) ?? 0;
997
- o.set(a.ri, s + 1);
998
- const c = r.grid.cells[a.ri]?.[s];
999
- c && i.set(`${a.ri}:${a.ci}`, c);
1007
+ for (const o of K(r.grid, r.widthMm, r.heightMm).cells) {
1008
+ const a = l.get(o.ri) ?? 0;
1009
+ l.set(o.ri, a + 1);
1010
+ const c = r.grid.cells[o.ri]?.[a];
1011
+ c && i.set(`${o.ri}:${o.ci}`, c);
1000
1012
  }
1001
1013
  t.set(r, i);
1002
1014
  }
1003
- const l = i.get(`${n.rowIndex}:${n.columnIndex}`);
1004
- return l ? Fe(r, n, l) : null;
1015
+ const s = i.get(`${n.rowIndex}:${n.columnIndex}`);
1016
+ return s ? Ge(r, n, s) : null;
1005
1017
  };
1006
1018
  }
1007
1019
  class M extends Error {
@@ -1009,20 +1021,20 @@ class M extends Error {
1009
1021
  super(`Invalid report cell edit: ${t}`), this.code = t, this.name = "ReportCellEditError";
1010
1022
  }
1011
1023
  }
1012
- function At(e, t) {
1024
+ function Kt(e, t) {
1013
1025
  let n = e.trim();
1014
1026
  const r = t && n.endsWith("%");
1015
1027
  if (r && (n = n.slice(0, -1).trim()), /^[+-]?\d{1,3}(?:,\d{3})+(?:\.\d*)?(?:[eE][+-]?\d+)?$/.test(n) && (n = n.replace(/,/g, "")), !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(n)) throw new M("number");
1016
1028
  return Number(n) / (r ? 100 : 1);
1017
1029
  }
1018
- function $t(e, t) {
1030
+ function Vt(e, t) {
1019
1031
  if (e === null || typeof e == "string" && e.trim() === "") return null;
1020
1032
  if (typeof e != "string" && typeof e != "number") throw new M("number");
1021
- const n = typeof e == "number" ? e : At(e, Ue(t.cell.numberFormat));
1033
+ const n = typeof e == "number" ? e : Kt(e, ot(t.cell.numberFormat));
1022
1034
  if (!Number.isFinite(n) || Number.isInteger(n) && !Number.isSafeInteger(n)) throw new M("number");
1023
1035
  return n;
1024
1036
  }
1025
- function Nt(e) {
1037
+ function Gt(e) {
1026
1038
  if (e === null || typeof e == "string" && e.trim() === "") return null;
1027
1039
  if (typeof e == "boolean") return e;
1028
1040
  const t = String(e).trim().toLowerCase();
@@ -1030,24 +1042,24 @@ function Nt(e) {
1030
1042
  if (["false", "no", "否", "0"].includes(t)) return !1;
1031
1043
  throw new M("boolean");
1032
1044
  }
1033
- function De(e, t) {
1034
- return e.valueType === "number" ? $t(t, e) : e.valueType === "boolean" ? Nt(t) : t === null ? null : String(t);
1045
+ function ge(e, t) {
1046
+ return e.valueType === "number" ? Vt(t, e) : e.valueType === "boolean" ? Gt(t) : t === null ? null : String(t);
1035
1047
  }
1036
- function Lt(e, t) {
1037
- const n = t.cell.text, i = [["是", "否"], ["TRUE", "FALSE"], ["True", "False"], ["true", "false"], ["1", "0"]].find((l) => l.includes(n ?? ""));
1048
+ function Ut(e, t) {
1049
+ const n = t.cell.text, i = [["是", "否"], ["TRUE", "FALSE"], ["True", "False"], ["true", "false"], ["1", "0"]].find((s) => s.includes(n ?? ""));
1038
1050
  return i ? i[e ? 0 : 1] : String(e);
1039
1051
  }
1040
- function Y(e, t) {
1041
- return t === null ? "" : typeof t == "boolean" ? Lt(t, e) : typeof t == "number" ? Ge(t, e.cell.numberFormat) : String(t);
1052
+ function ne(e, t) {
1053
+ return t === null ? "" : typeof t == "boolean" ? Ut(t, e) : typeof t == "number" ? it(t, e.cell.numberFormat) : String(t);
1042
1054
  }
1043
- function un(e, t, n) {
1044
- const r = le(e, t);
1055
+ function Un(e, t, n) {
1056
+ const r = fe(e, t);
1045
1057
  if (!r) throw new M("missing");
1046
- return de(r, n);
1058
+ return pe(r, n);
1047
1059
  }
1048
- function de(e, t) {
1060
+ function pe(e, t) {
1049
1061
  if (!e.editable) throw new M("readonly");
1050
- const n = De(e, t);
1062
+ const n = ge(e, t);
1051
1063
  return {
1052
1064
  address: { ...e.address },
1053
1065
  table: e.table,
@@ -1055,88 +1067,88 @@ function de(e, t) {
1055
1067
  previousValue: e.value,
1056
1068
  previousText: e.cell.text ?? "",
1057
1069
  value: n,
1058
- text: Y(e, n)
1070
+ text: ne(e, n)
1059
1071
  };
1060
1072
  }
1061
- function Ot(e, t) {
1073
+ function qt(e, t) {
1062
1074
  const n = e.table, r = t.table;
1063
1075
  return !n || !r || n.columnKey === void 0 ? !1 : n.id === r.id && n.rowIndex === r.rowIndex && n.role === r.role && n.columnKey === r.columnKey;
1064
1076
  }
1065
- function ze(e, t, n) {
1066
- const r = e.grid, { rowIndex: i, columnIndex: l } = t.address, o = Oe(e, i, l), a = [...r.cells], s = [...a[i]], c = Y(t, n.value), d = { ...o.cell, value: n.value, text: c, rawText: c };
1067
- return s[o.sourceColumnIndex] = d, a[i] = s, { ...e, grid: { ...r, cells: a } };
1077
+ function Ue(e, t, n) {
1078
+ const r = e.grid, { rowIndex: i, columnIndex: s } = t.address, l = Ve(e, i, s), o = [...r.cells], a = [...o[i]], c = ne(t, n.value), d = { ...l.cell, value: n.value, text: c, rawText: c };
1079
+ return a[l.sourceColumnIndex] = d, o[i] = a, { ...e, grid: { ...r, cells: o } };
1068
1080
  }
1069
- function Ft(e, t) {
1081
+ function Jt(e, t) {
1070
1082
  const n = e.table?.columnKeys, r = t.table?.columnKey;
1071
- return n && r !== void 0 ? n.flatMap((i, l) => i === r ? [l] : []) : [];
1083
+ return n && r !== void 0 ? n.flatMap((i, s) => i === r ? [s] : []) : [];
1072
1084
  }
1073
- function Dt(e, t, n, r, i, l) {
1074
- const o = t.table, a = i.table;
1075
- if (!o || !a || o.id !== a.id || o.role !== a.role || !t.grid) return t;
1076
- const s = a.rowIndex - o.rowIndex;
1077
- if (s < 0 || s >= t.grid.cells.length) return t;
1085
+ function Yt(e, t, n, r, i, s) {
1086
+ const l = t.table, o = i.table;
1087
+ if (!l || !o || l.id !== o.id || l.role !== o.role || !t.grid) return t;
1088
+ const a = o.rowIndex - l.rowIndex;
1089
+ if (a < 0 || a >= t.grid.cells.length) return t;
1078
1090
  let c = t;
1079
- for (const d of Ft(t, i)) {
1080
- const u = le(e, { pageIndex: n, componentIndex: r, rowIndex: s, columnIndex: d });
1081
- u?.editable && Ot(i, u) && (c = ze(c, u, l));
1091
+ for (const d of Jt(t, i)) {
1092
+ const u = fe(e, { pageIndex: n, componentIndex: r, rowIndex: a, columnIndex: d });
1093
+ u?.editable && qt(i, u) && (c = Ue(c, u, s));
1082
1094
  }
1083
1095
  return c;
1084
1096
  }
1085
- function zt(e, t, n, r, i, l) {
1086
- const o = i.address;
1087
- return i.table?.columnKey !== void 0 ? Dt(e, t, n, r, i, l) : o.pageIndex === n && o.componentIndex === r ? ze(t, i, l) : t;
1097
+ function Xt(e, t, n, r, i, s) {
1098
+ const l = i.address;
1099
+ return i.table?.columnKey !== void 0 ? Yt(e, t, n, r, i, s) : l.pageIndex === n && l.componentIndex === r ? Ue(t, i, s) : t;
1088
1100
  }
1089
- function je(e, t) {
1101
+ function qe(e, t) {
1090
1102
  const n = t.source;
1091
1103
  if (!n) return !1;
1092
1104
  const r = e.source;
1093
1105
  return !r || ["datasetId", "rowKey", "field", "revision", "sourceToken"].some((i) => !Object.is(r[i], n[i]));
1094
1106
  }
1095
- function mn(e, t) {
1096
- const n = le(e, t.address);
1107
+ function qn(e, t) {
1108
+ const n = fe(e, t.address);
1097
1109
  if (!n) throw new M("missing");
1098
1110
  if (!n.editable) throw new M("readonly");
1099
- if (je(n, t)) throw new M("conflict");
1111
+ if (qe(n, t)) throw new M("conflict");
1100
1112
  if (!Object.is(n.value, t.previousValue) || (n.cell.text ?? "") !== t.previousText) throw new M("conflict");
1101
- const r = De(n, t.value), i = { ...t, value: r, text: Y(n, r) };
1113
+ const r = ge(n, t.value), i = { ...t, value: r, text: ne(n, r) };
1102
1114
  if (Object.is(r, n.value) && i.text === n.cell.text) return e;
1103
- const l = e.pages.map((o, a) => {
1104
- const s = o.components.map((c, d) => zt(e, c, a, d, n, i));
1105
- return s.every((c, d) => c === o.components[d]) ? o : { ...o, components: s };
1115
+ const s = e.pages.map((l, o) => {
1116
+ const a = l.components.map((c, d) => Xt(e, c, o, d, n, i));
1117
+ return a.every((c, d) => c === l.components[d]) ? l : { ...l, components: a };
1106
1118
  });
1107
- return { ...e, pages: l };
1119
+ return { ...e, pages: s };
1108
1120
  }
1109
- function jt(e) {
1121
+ function Zt(e) {
1110
1122
  return JSON.stringify([e.pageIndex, e.componentIndex, e.rowIndex, e.columnIndex]);
1111
1123
  }
1112
- function be(e) {
1124
+ function Te(e) {
1113
1125
  const t = e.table;
1114
- return t?.columnKey !== void 0 ? JSON.stringify([t.id, t.role, t.rowIndex, t.columnKey]) : jt(e.address);
1126
+ return t?.columnKey !== void 0 ? JSON.stringify([t.id, t.role, t.rowIndex, t.columnKey]) : Zt(e.address);
1115
1127
  }
1116
- function Ht(e, t) {
1128
+ function Qt(e, t) {
1117
1129
  if (!t.length) return e;
1118
- const n = new Map(t.map((s) => [be(s), s])), r = new Set(t.flatMap((s) => s.table ? [s.table.id] : [])), i = new Set(t.map((s) => `${s.address.pageIndex}:${s.address.componentIndex}`)), l = ce(e);
1119
- function o(s, c, d) {
1120
- const u = s.grid;
1121
- if (!u || !i.has(`${c}:${d}`) && !r.has(s.table?.id ?? "")) return s;
1130
+ const n = new Map(t.map((a) => [Te(a), a])), r = new Set(t.flatMap((a) => a.table ? [a.table.id] : [])), i = new Set(t.map((a) => `${a.address.pageIndex}:${a.address.componentIndex}`)), s = he(e);
1131
+ function l(a, c, d) {
1132
+ const u = a.grid;
1133
+ if (!u || !i.has(`${c}:${d}`) && !r.has(a.table?.id ?? "")) return a;
1122
1134
  const m = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
1123
- for (const g of H(u, s.widthMm, s.heightMm).cells) {
1124
- const h = f.get(g.ri) ?? 0;
1125
- f.set(g.ri, h + 1);
1126
- const w = l({ pageIndex: c, componentIndex: d, rowIndex: g.ri, columnIndex: g.ci }), y = w && n.get(be(w));
1127
- if (!y || !w.editable) continue;
1128
- const x = m.get(g.ri) ?? [...u.cells[g.ri]], P = Y(w, y.value);
1129
- Object.is(w.value, y.value) && P === w.cell.text || (x[h] = { ...g.cell, value: y.value, text: P, rawText: P }, m.set(g.ri, x));
1135
+ for (const h of K(u, a.widthMm, a.heightMm).cells) {
1136
+ const g = f.get(h.ri) ?? 0;
1137
+ f.set(h.ri, g + 1);
1138
+ const b = s({ pageIndex: c, componentIndex: d, rowIndex: h.ri, columnIndex: h.ci }), E = b && n.get(Te(b));
1139
+ if (!E || !b.editable) continue;
1140
+ const S = m.get(h.ri) ?? [...u.cells[h.ri]], R = ne(b, E.value);
1141
+ Object.is(b.value, E.value) && R === b.cell.text || (S[g] = { ...h.cell, value: E.value, text: R, rawText: R }, m.set(h.ri, S));
1130
1142
  }
1131
- return m.size ? { ...s, grid: { ...u, cells: u.cells.map((g, h) => m.get(h) ?? g) } } : s;
1143
+ return m.size ? { ...a, grid: { ...u, cells: u.cells.map((h, g) => m.get(g) ?? h) } } : a;
1132
1144
  }
1133
- const a = e.pages.map((s, c) => {
1134
- const d = s.components.map((u, m) => o(u, c, m));
1135
- return d.every((u, m) => u === s.components[m]) ? s : { ...s, components: d };
1145
+ const o = e.pages.map((a, c) => {
1146
+ const d = a.components.map((u, m) => l(u, c, m));
1147
+ return d.every((u, m) => u === a.components[m]) ? a : { ...a, components: d };
1136
1148
  });
1137
- return a.every((s, c) => s === e.pages[c]) ? e : { ...e, pages: a };
1149
+ return o.every((a, c) => a === e.pages[c]) ? e : { ...e, pages: o };
1138
1150
  }
1139
- function ue(e) {
1151
+ function we(e) {
1140
1152
  const t = e.source;
1141
1153
  if (t) return JSON.stringify([t.datasetId, t.rowKey, t.field]);
1142
1154
  const n = e.table;
@@ -1144,210 +1156,470 @@ function ue(e) {
1144
1156
  const r = e.address;
1145
1157
  return JSON.stringify([r.pageIndex, r.componentIndex, r.rowIndex, r.columnIndex]);
1146
1158
  }
1147
- function fn(e, t, n) {
1159
+ function Jn(e, t, n) {
1148
1160
  if (typeof n != "string" || !n.trim() || !Array.isArray(t)) throw new M("missing");
1149
1161
  if (t.length > 1e4) throw new M("limit");
1150
- const r = /* @__PURE__ */ new Set(), i = ce(e), l = t.map(({ address: o, value: a }) => {
1151
- const s = i(o);
1152
- if (!s) throw new M("missing");
1153
- const c = de(s, a), d = ue(c);
1162
+ const r = /* @__PURE__ */ new Set(), i = he(e), s = t.map(({ address: l, value: o }) => {
1163
+ const a = i(l);
1164
+ if (!a) throw new M("missing");
1165
+ const c = pe(a, o), d = we(c);
1154
1166
  if (r.has(d)) throw new M("duplicate");
1155
1167
  return r.add(d), c;
1156
1168
  });
1157
- return { requestId: n, edits: l };
1169
+ return { requestId: n, edits: s };
1158
1170
  }
1159
- function hn(e, t) {
1171
+ function Yn(e, t) {
1160
1172
  if (t.edits.length > 1e4) throw new M("limit");
1161
- const n = ce(e), r = /* @__PURE__ */ new Set(), i = t.edits.map((l) => {
1162
- const o = n(l.address);
1163
- if (!o) throw new M("missing");
1164
- const a = ue(l);
1165
- if (r.has(a)) throw new M("duplicate");
1166
- if (r.add(a), je(o, l) || !Object.is(o.value, l.previousValue) || (o.cell.text ?? "") !== l.previousText) throw new M("conflict");
1167
- return de(o, l.value);
1173
+ const n = he(e), r = /* @__PURE__ */ new Set(), i = t.edits.map((s) => {
1174
+ const l = n(s.address);
1175
+ if (!l) throw new M("missing");
1176
+ const o = we(s);
1177
+ if (r.has(o)) throw new M("duplicate");
1178
+ if (r.add(o), qe(l, s) || !Object.is(l.value, s.previousValue) || (l.cell.text ?? "") !== s.previousText) throw new M("conflict");
1179
+ return pe(l, s.value);
1168
1180
  });
1169
- return Ht(e, i);
1181
+ return Qt(e, i);
1170
1182
  }
1171
- function gn(e) {
1183
+ function Xn(e) {
1172
1184
  const t = /* @__PURE__ */ new Map();
1173
1185
  for (const n of e) {
1174
- const r = ue(n), i = t.get(r), l = i ? { ...n, previousValue: i.previousValue, previousText: i.previousText } : { ...n };
1175
- Object.is(l.previousValue, l.value) ? t.delete(r) : t.set(r, l);
1186
+ const r = we(n), i = t.get(r), s = i ? { ...n, previousValue: i.previousValue, previousText: i.previousText } : { ...n };
1187
+ Object.is(s.previousValue, s.value) ? t.delete(r) : t.set(r, s);
1176
1188
  }
1177
1189
  return [...t.values()];
1178
1190
  }
1179
- function pn(e) {
1191
+ function Zn(e) {
1180
1192
  return e.map((t) => t.map((n) => /[\t\r\n"]/.test(n) ? `"${n.replace(/"/g, '""')}"` : n).join(" ")).join(`\r
1181
1193
  `);
1182
1194
  }
1183
- function Wt(e, t) {
1195
+ function en(e, t) {
1184
1196
  const n = e[e.length - 1];
1185
1197
  e.length > 1 && n?.length === 1 && n[0] === "" && /[\r\n]$/.test(t) && e.pop();
1186
1198
  }
1187
- function wn(e, t = 1e4) {
1199
+ function Qn(e, t = 1e4) {
1188
1200
  if (e.length > 4 * 1024 * 1024) throw new Error("Clipboard text limit exceeded");
1189
1201
  const n = [[]];
1190
- let r = "", i = !1, l = !1, o = 0;
1191
- function a() {
1192
- if (++o > t) throw new Error("Clipboard cell limit exceeded");
1193
- n[n.length - 1].push(r), r = "", l = !1;
1202
+ let r = "", i = !1, s = !1, l = 0;
1203
+ function o() {
1204
+ if (++l > t) throw new Error("Clipboard cell limit exceeded");
1205
+ n[n.length - 1].push(r), r = "", s = !1;
1194
1206
  }
1195
- for (let s = 0; s < e.length; s++) {
1196
- const c = e[s];
1207
+ for (let a = 0; a < e.length; a++) {
1208
+ const c = e[a];
1197
1209
  if (i) {
1198
1210
  if (c !== '"') {
1199
1211
  r += c;
1200
1212
  continue;
1201
1213
  }
1202
- if (e[s + 1] === '"') {
1203
- r += '"', s++;
1214
+ if (e[a + 1] === '"') {
1215
+ r += '"', a++;
1204
1216
  continue;
1205
1217
  }
1206
- i = !1, l = !0;
1218
+ i = !1, s = !0;
1207
1219
  continue;
1208
1220
  }
1209
- if (c === '"' && !r && !l) {
1221
+ if (c === '"' && !r && !s) {
1210
1222
  i = !0;
1211
1223
  continue;
1212
1224
  }
1213
1225
  if (c === " ") {
1214
- a();
1226
+ o();
1215
1227
  continue;
1216
1228
  }
1217
1229
  if (c === "\r" || c === `
1218
1230
  `) {
1219
- a(), n.push([]), c === "\r" && e[s + 1] === `
1220
- ` && s++;
1231
+ o(), n.push([]), c === "\r" && e[a + 1] === `
1232
+ ` && a++;
1221
1233
  continue;
1222
1234
  }
1223
- if (l) throw new Error("Invalid quoted clipboard value");
1235
+ if (s) throw new Error("Invalid quoted clipboard value");
1224
1236
  r += c;
1225
1237
  }
1226
1238
  if (i) throw new Error("Unclosed clipboard quote");
1227
- return a(), Wt(n, e), n;
1239
+ return o(), en(n, e), n;
1228
1240
  }
1229
- function bn(e, t, n) {
1241
+ function er(e, t, n) {
1230
1242
  if (!n || n.revision === void 0 && n.sourceToken === void 0) return e;
1231
- const r = new Set(t.edits.flatMap((o) => o.source ? [o.source.datasetId] : []));
1243
+ const r = new Set(t.edits.flatMap((l) => l.source ? [l.source.datasetId] : []));
1232
1244
  if (!r.size) return e;
1233
- function i(o) {
1234
- return !o.datasetId || !r.has(o.datasetId) || (n.revision === void 0 || Object.is(n.revision, o.revision)) && (n.sourceToken === void 0 || n.sourceToken === o.sourceToken) ? o : { ...o, ...n.revision !== void 0 ? { revision: n.revision } : {}, ...n.sourceToken !== void 0 ? { sourceToken: n.sourceToken } : {} };
1245
+ function i(l) {
1246
+ return !l.datasetId || !r.has(l.datasetId) || (n.revision === void 0 || Object.is(n.revision, l.revision)) && (n.sourceToken === void 0 || n.sourceToken === l.sourceToken) ? l : { ...l, ...n.revision !== void 0 ? { revision: n.revision } : {}, ...n.sourceToken !== void 0 ? { sourceToken: n.sourceToken } : {} };
1235
1247
  }
1236
- const l = e.pages.map((o) => {
1237
- const a = o.components.map((s) => {
1238
- const c = s.table?.source ? i(s.table.source) : void 0, d = s.table && c !== s.table.source ? { ...s.table, source: c } : s.table, u = s.grid?.cells.map((f) => {
1239
- const g = f.map((h) => {
1240
- if (!h?.source) return h;
1241
- const w = i(h.source);
1242
- return w === h.source ? h : { ...h, source: w };
1248
+ const s = e.pages.map((l) => {
1249
+ const o = l.components.map((a) => {
1250
+ const c = a.table?.source ? i(a.table.source) : void 0, d = a.table && c !== a.table.source ? { ...a.table, source: c } : a.table, u = a.grid?.cells.map((f) => {
1251
+ const h = f.map((g) => {
1252
+ if (!g?.source) return g;
1253
+ const b = i(g.source);
1254
+ return b === g.source ? g : { ...g, source: b };
1243
1255
  });
1244
- return g.some((h, w) => h !== f[w]) ? g : f;
1245
- }), m = s.grid && u?.some((f, g) => f !== s.grid.cells[g]) ? { ...s.grid, cells: u } : s.grid;
1246
- return d !== s.table || m !== s.grid ? { ...s, table: d, grid: m } : s;
1256
+ return h.some((g, b) => g !== f[b]) ? h : f;
1257
+ }), m = a.grid && u?.some((f, h) => f !== a.grid.cells[h]) ? { ...a.grid, cells: u } : a.grid;
1258
+ return d !== a.table || m !== a.grid ? { ...a, table: d, grid: m } : a;
1247
1259
  });
1248
- return a.some((s, c) => s !== o.components[c]) ? { ...o, components: a } : o;
1260
+ return o.some((a, c) => a !== l.components[c]) ? { ...l, components: o } : l;
1249
1261
  });
1250
- return l.some((o, a) => o !== e.pages[a]) ? { ...e, pages: l } : e;
1262
+ return s.some((l, o) => l !== e.pages[o]) ? { ...e, pages: s } : e;
1263
+ }
1264
+ class tn extends Error {
1265
+ constructor(t, n, r) {
1266
+ const i = typeof n.label == "string" ? n.label : "单元格", s = {
1267
+ definition: `${i}的编辑器配置无效`,
1268
+ type: `${i}的编辑器与数据类型不一致`,
1269
+ required: `${i}不能为空`,
1270
+ min: `${i}不能小于 ${r}`,
1271
+ max: `${i}不能大于 ${r}`,
1272
+ precision: `${i}最多保留 ${r} 位小数`,
1273
+ length: `${i}最多允许 ${r} 个字符`,
1274
+ choice: `${i}请选择有效选项`,
1275
+ date: `${i}请输入有效日期(YYYY-MM-DD)`
1276
+ };
1277
+ super(s[t]), this.code = t, this.field = n, this.expected = r, this.name = "ReportCellFieldError";
1278
+ }
1279
+ }
1280
+ function w(e, t, n) {
1281
+ throw new tn(t, e, n);
1282
+ }
1283
+ function Je(e) {
1284
+ if (typeof e != "string" || !/^\d{4}-\d{2}-\d{2}$/.test(e) || e.startsWith("0000-")) return !1;
1285
+ const t = /* @__PURE__ */ new Date(`${e}T00:00:00.000Z`);
1286
+ return Number.isFinite(t.getTime()) && t.toISOString().slice(0, 10) === e;
1287
+ }
1288
+ function nn(e) {
1289
+ const [t = "", n = "0"] = String(e).toLowerCase().split("e");
1290
+ return Math.max(0, (t.split(".")[1]?.length ?? 0) - Number(n));
1291
+ }
1292
+ function rn(e, t) {
1293
+ e.min !== void 0 && t < e.min && w(e, "min", e.min), e.max !== void 0 && t > e.max && w(e, "max", e.max), e.precision !== void 0 && nn(t) > e.precision && w(e, "precision", e.precision);
1294
+ }
1295
+ function on(e, t) {
1296
+ Je(t) || w(e, "date"), e.min !== void 0 && t < e.min && w(e, "min", e.min), e.max !== void 0 && t > e.max && w(e, "max", e.max);
1297
+ }
1298
+ function an(e) {
1299
+ [e.min, e.max].some((t) => t !== void 0 && !Number.isFinite(t)) && w(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && w(e, "definition"), e.precision !== void 0 && (!Number.isInteger(e.precision) || e.precision < 0 || e.precision > 15) && w(e, "definition");
1300
+ }
1301
+ function sn(e) {
1302
+ [e.min, e.max].some((t) => t !== void 0 && !Je(t)) && w(e, "definition"), e.min !== void 0 && e.max !== void 0 && e.min > e.max && w(e, "definition");
1303
+ }
1304
+ function ln(e, t) {
1305
+ (!Array.isArray(t.options) || !t.options.length) && w(t, "definition");
1306
+ const n = e.valueType === "text" ? "string" : e.valueType, r = /* @__PURE__ */ new Set();
1307
+ for (const i of t.options)
1308
+ (!i || typeof i.value !== n || typeof i.value == "number" && !Number.isFinite(i.value)) && w(t, "definition"), i.label !== void 0 && typeof i.label != "string" && w(t, "definition"), r.has(i.value) && w(t, "definition"), r.add(i.value);
1309
+ }
1310
+ function cn(e) {
1311
+ e.required !== void 0 && typeof e.required != "boolean" && w(e, "definition"), [e.label, e.hint, e.unit].some((t) => t !== void 0 && typeof t != "string") && w(e, "definition"), e.type === "boolean" && [e.trueLabel, e.falseLabel].some((t) => t !== void 0 && typeof t != "string") && w(e, "definition");
1312
+ }
1313
+ function dn(e, t) {
1314
+ (!t || typeof t != "object" || Array.isArray(t) || !["text", "number", "boolean", "enum", "date"].includes(t.type)) && w(t ?? { type: "text" }, "definition"), cn(t), (t.type === "number" || t.type === "boolean") && e.valueType !== t.type && w(t, "type"), (t.type === "text" || t.type === "date") && e.valueType !== "text" && w(t, "type"), t.type === "number" && an(t), t.type === "text" && t.maxLength !== void 0 && (!Number.isInteger(t.maxLength) || t.maxLength < 0) && w(t, "definition"), t.type === "date" && sn(t), t.type === "enum" && ln(e, t);
1315
+ }
1316
+ function tr(e, t, n) {
1317
+ if (!e.editable) throw new M("readonly");
1318
+ n && dn(e, n);
1319
+ const r = ge(e, t);
1320
+ return n ? (n.required && typeof r == "string" && !r.trim() && w(n, "required"), r === null || r === "" ? (n.required && w(n, "required"), r) : (n.type === "number" && rn(n, r), n.type === "date" && on(n, r), n.type === "text" && n.maxLength !== void 0 && [...String(r)].length > n.maxLength && w(n, "length", n.maxLength), n.type === "enum" && !n.options.some((i) => Object.is(i.value, r)) && w(n, "choice"), r)) : r;
1321
+ }
1322
+ class v extends Error {
1323
+ constructor(t) {
1324
+ super(`Report calculation: ${t}`), this.code = t, this.name = "ReportCalculationError";
1325
+ }
1326
+ }
1327
+ function z(e) {
1328
+ if (!e?.aborted) return;
1329
+ const t = new Error("Calculation cancelled");
1330
+ throw t.name = "AbortError", t;
1331
+ }
1332
+ async function Z(e, t = 1) {
1333
+ const n = Math.floor(e.scanned / 2048);
1334
+ if (e.scanned += t, e.scanned > e.maxScanned) throw new v("limit");
1335
+ z(e.signal), Math.floor(e.scanned / 2048) > n && (await e.yieldToHost(), z(e.signal));
1336
+ }
1337
+ function be(e) {
1338
+ return e.table?.role === "header" ? -Math.max(1, e.grid?.cells.length ?? 1) : e.table?.rowIndex ?? 0;
1339
+ }
1340
+ function Ce(e, t, n) {
1341
+ if (![t.pageIndex, t.componentIndex, t.rowIndex, t.columnIndex].every((o) => Number.isSafeInteger(o) && o >= 0)) throw new v("selection");
1342
+ const r = e.pages[t.pageIndex]?.components[t.componentIndex];
1343
+ if (!r?.grid || t.rowIndex >= r.grid.cells.length) throw new v("selection");
1344
+ const i = r.grid.colWidthsMm?.length ?? r.grid.cells.reduce((o, a) => Math.max(o, a.length), 1);
1345
+ if (t.columnIndex >= i) throw new v("selection");
1346
+ const s = r.table, l = e.pages[n.pageIndex]?.components[n.componentIndex]?.table;
1347
+ if (s && l && s.id === l.id) {
1348
+ const o = l.columnKeys.indexOf(s.columnKeys[t.columnIndex] ?? "");
1349
+ if (o < 0) throw new v("selection");
1350
+ return { grid: s.id, row: be(r) + t.rowIndex, column: o };
1351
+ }
1352
+ return { grid: `${t.pageIndex}:${t.componentIndex}`, row: t.rowIndex, column: t.columnIndex };
1353
+ }
1354
+ function un(e, t, n) {
1355
+ const r = Ce(e, t.anchor, t.anchor), i = Ce(e, t.focus, t.anchor);
1356
+ if (r.grid !== i.grid) throw new v("selection");
1357
+ const s = (Math.abs(r.row - i.row) + 1) * (Math.abs(r.column - i.column) + 1);
1358
+ if (!Number.isSafeInteger(s) || s > n) throw new v("limit");
1359
+ return { grid: r.grid, rowStart: Math.min(r.row, i.row), rowEnd: Math.max(r.row, i.row), columnStart: Math.min(r.column, i.column), columnEnd: Math.max(r.column, i.column), origin: e.pages[t.anchor.pageIndex].components[t.anchor.componentIndex].table };
1360
+ }
1361
+ function mn(e) {
1362
+ if (!e) return !1;
1363
+ const t = e.replace(/"[^"]*"|\\.|\[(?![hms]+\])[^\]]*\]/gi, "");
1364
+ return /[ymdhs]/i.test(t);
1365
+ }
1366
+ function fn(e) {
1367
+ if (e.valueType === "text" || e.valueType === "boolean" || mn(e.numberFormat)) return null;
1368
+ const t = e.value;
1369
+ if (typeof t != "number" || !Number.isFinite(t)) return null;
1370
+ if (Number.isInteger(t) && !Number.isSafeInteger(t)) throw new v("precision");
1371
+ return t;
1372
+ }
1373
+ function hn(e, t, n) {
1374
+ if (e.seen.has(n)) return;
1375
+ e.seen.add(n), e.selected++;
1376
+ const r = t ? fn(t) : null;
1377
+ r === null ? e.excluded++ : e.values.push(r);
1378
+ }
1379
+ function gn(e, t, n, r) {
1380
+ return r.origin ? e.table?.id === r.origin.id : `${t}:${n}` === r.grid;
1381
+ }
1382
+ function pn(e, t, n) {
1383
+ return n.origin ? n.origin.columnKeys.indexOf(e.table.columnKeys[t] ?? "") : t;
1384
+ }
1385
+ function wn(e, t, n, r) {
1386
+ const i = r.origin ? be(e) + t : t, s = pn(e, n, r);
1387
+ return i < r.rowStart || i > r.rowEnd || s < r.columnStart || s > r.columnEnd ? null : `${r.grid}:${i}:${s}`;
1388
+ }
1389
+ function bn(e, t) {
1390
+ const n = t.origin ? be(e) : 0, r = Math.max(0, t.rowStart - n), i = Math.min(e.grid.cells.length, t.rowEnd - n + 1);
1391
+ return i > r ? i : 0;
1392
+ }
1393
+ async function vn(e, t, n, r, i) {
1394
+ const s = e.grid;
1395
+ if (t > r.maxScanned) throw new v("limit");
1396
+ const l = s.colWidthsMm?.length ?? s.cells.reduce((a, c) => Math.max(a, c.length), 1);
1397
+ if (l > r.maxScanned) throw new v("limit");
1398
+ const o = /* @__PURE__ */ new Map();
1399
+ for (let a = 0; a < t; a++) {
1400
+ a > 0 && a % 2048 === 0 && (await r.yieldToHost(), z(r.signal));
1401
+ let c = 0;
1402
+ for (const d of s.cells[a]) {
1403
+ for (await Z(r); c < l && (o.get(c) ?? 0) > a; ) c++;
1404
+ if (c >= l) break;
1405
+ const u = Math.max(1, Math.min(d?.colSpan ?? 1, l - c)), m = Math.min(s.cells.length, a + Math.max(1, d?.rowSpan ?? 1));
1406
+ u > 1 && await Z(r, u - 1);
1407
+ for (let h = c; h < c + u; h++) o.set(h, m);
1408
+ const f = wn(e, a, c, n);
1409
+ f && hn(i, d, f), c += u;
1410
+ }
1411
+ }
1412
+ }
1413
+ async function yn(e, t, n) {
1414
+ const r = { values: [], seen: /* @__PURE__ */ new Set(), excluded: 0, selected: 0 };
1415
+ for (let i = 0; i < e.pages.length; i++) {
1416
+ await Z(n);
1417
+ const s = e.pages[i];
1418
+ for (let l = 0; l < s.components.length; l++) {
1419
+ await Z(n);
1420
+ const o = s.components[l];
1421
+ if (!o.grid || !gn(o, i, l, t) || o.table && o.table.role !== "body") continue;
1422
+ const a = bn(o, t);
1423
+ a && await vn(o, a, t, n, r);
1424
+ }
1425
+ }
1426
+ return r;
1427
+ }
1428
+ function _(e) {
1429
+ if (!Number.isFinite(e)) throw new v("overflow");
1430
+ return e;
1431
+ }
1432
+ function xn(e) {
1433
+ let t = 0, n = 0;
1434
+ for (const r of e) {
1435
+ const i = r - n, s = _(t + i);
1436
+ n = s - t - i, t = s;
1437
+ }
1438
+ return t;
1439
+ }
1440
+ async function Ie(e, t) {
1441
+ let n = [...e], r = new Array(e.length);
1442
+ for (let s = 1; s < e.length; s *= 2) {
1443
+ for (let l = 0; l < e.length; l += s * 2) {
1444
+ const o = Math.min(l + s, e.length), a = Math.min(l + s * 2, e.length);
1445
+ let c = l, d = o;
1446
+ for (let u = l; u < a; u++)
1447
+ r[u] = d >= a || c < o && n[c] <= n[d] ? n[c++] : n[d++], u % 2048 === 0 && (await t.yieldToHost(), z(t.signal));
1448
+ }
1449
+ [n, r] = [r, n];
1450
+ }
1451
+ const i = Math.floor(n.length / 2);
1452
+ return n.length % 2 ? n[i] : _(n[i - 1] / 2 + n[i] / 2);
1453
+ }
1454
+ function Mn(e) {
1455
+ const t = xn(e);
1456
+ let n = 1 / 0, r = -1 / 0;
1457
+ for (const i of e)
1458
+ n = Math.min(n, i), r = Math.max(r, i);
1459
+ return { SUM: t, AVERAGE: t / e.length, AVG: t / e.length, MIN: n, MAX: r, COUNT: e.length };
1460
+ }
1461
+ function En(e, t) {
1462
+ if (typeof e != "string" || e.length > 256) throw new v("expression");
1463
+ const n = e.toUpperCase().match(/(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?|[A-Z_]+|[()+\-*/]|\S/g) ?? [];
1464
+ if (!n.length || n.length > 64) throw new v("expression");
1465
+ let r = 0;
1466
+ function i(o) {
1467
+ if (o > 16) throw new v("expression");
1468
+ const a = n[r++];
1469
+ if (a === "+" || a === "-") return (a === "-" ? -1 : 1) * i(o + 1);
1470
+ if (a === "(") {
1471
+ const c = s(0, o + 1);
1472
+ if (n[r++] !== ")") throw new v("expression");
1473
+ return c;
1474
+ }
1475
+ if (a && /^(?:SUM|AVERAGE|AVG|MIN|MAX|COUNT|MEDIAN)$/.test(a) && Object.prototype.hasOwnProperty.call(t, a)) return _(t[a]);
1476
+ if (a && /^(?:\d+(?:\.\d*)?|\.\d+)(?:E[+-]?\d+)?$/.test(a)) return _(Number(a));
1477
+ throw new v("expression");
1478
+ }
1479
+ function s(o, a) {
1480
+ let c = i(a);
1481
+ for (; r < n.length; ) {
1482
+ const d = n[r], u = d === "+" || d === "-" ? 1 : d === "*" || d === "/" ? 2 : 0;
1483
+ if (!u || u < o) break;
1484
+ r++;
1485
+ const m = s(u + 1, a + 1);
1486
+ if (d === "/" && m === 0) throw new v("division");
1487
+ c = _(d === "+" ? c + m : d === "-" ? c - m : d === "*" ? c * m : c / m);
1488
+ }
1489
+ return c;
1490
+ }
1491
+ const l = s(1, 0);
1492
+ if (r !== n.length) throw new v("expression");
1493
+ return l;
1494
+ }
1495
+ function Sn(e) {
1496
+ const t = e.maxCells ?? 1e5, n = e.maxScannedCells ?? 2e5, r = e.precision ?? 2;
1497
+ if (![t, n].every((i) => Number.isSafeInteger(i) && i >= 1 && i <= 2e6)) throw new v("limit");
1498
+ if (!Number.isInteger(r) || r < 0 || r > 12) throw new v("precision");
1499
+ return { maxCells: t, maxScanned: n, precision: r };
1500
+ }
1501
+ async function nr(e, t, n = {}) {
1502
+ const r = Sn(n), i = { scanned: 0, maxScanned: r.maxScanned, signal: n.signal, yieldToHost: n.yieldToHost ?? (() => new Promise((a) => setTimeout(a, 0))) };
1503
+ z(i.signal);
1504
+ const s = await yn(e, un(e, t, r.maxCells), i), l = n.operation ?? "sum";
1505
+ if (!["sum", "average", "min", "max", "count", "median", "expression"].includes(l)) throw new v("expression");
1506
+ let o = null;
1507
+ if (l === "count") o = s.values.length;
1508
+ else if (s.values.length)
1509
+ if (l === "median") o = await Ie(s.values, i);
1510
+ else {
1511
+ const a = Mn(s.values);
1512
+ l === "expression" ? (/\bMEDIAN\b/i.test(n.expression ?? "") && (a.MEDIAN = await Ie(s.values, i)), o = En(n.expression ?? "", a)) : o = a[l.toUpperCase()];
1513
+ }
1514
+ if (z(i.signal), o !== null && Number.isInteger(o) && !Number.isSafeInteger(o)) throw new v("precision");
1515
+ return { value: o, formatted: o === null ? "—" : o.toFixed(r.precision), numericCells: s.values.length, excludedCells: s.excluded, selectedCells: s.selected, precision: r.precision };
1251
1516
  }
1252
1517
  export {
1253
- Hn as CSS_DPI,
1254
- Mn as DEFAULT_BORDER_PT,
1255
- q as DEFAULT_FONT_FAMILY,
1256
- xn as DEFAULT_FONT_PT,
1257
- En as DEFAULT_STROKE_COLOR,
1258
- ve as DEFAULT_TEXT_COLOR,
1259
- Tn as LINE_HEIGHT,
1260
- Wn as MM_PER_INCH,
1261
- tr as OutputAssetError,
1262
- G as PAPER_SIZES,
1263
- bt as PageBuilder,
1264
- kn as PaginatePageLimitError,
1265
- Sn as RENDER_PLAN_SCHEMA_VERSION,
1266
- or as REPORT_TEMPLATE_DOCUMENT_VERSION,
1518
+ Sr as CSS_DPI,
1519
+ or as DEFAULT_BORDER_PT,
1520
+ ee as DEFAULT_FONT_FAMILY,
1521
+ ar as DEFAULT_FONT_PT,
1522
+ sr as DEFAULT_STROKE_COLOR,
1523
+ Pe as DEFAULT_TEXT_COLOR,
1524
+ lr as LINE_HEIGHT,
1525
+ Tr as MM_PER_INCH,
1526
+ Hr as OutputAssetError,
1527
+ nt as OutputFidelityError,
1528
+ Y as PAPER_SIZES,
1529
+ kt as PageBuilder,
1530
+ mr as PaginatePageLimitError,
1531
+ cr as RENDER_PLAN_SCHEMA_VERSION,
1532
+ _r as REPORT_TEMPLATE_DOCUMENT_VERSION,
1533
+ v as ReportCalculationError,
1267
1534
  M as ReportCellEditError,
1268
- fr as ReportParamValidationError,
1269
- Rn as ReportSourceError,
1270
- ar as ReportTemplateError,
1271
- N as ReportTemplateStoreError,
1272
- Cn as SCHEMA_VERSION_MACH,
1273
- wt as TemplateBuilder,
1274
- mn as applyReportCellEdit,
1275
- hn as applyReportCellEditBatch,
1276
- bn as applyReportEditResult,
1277
- Vn as assertRenderPlan,
1278
- hr as assertReportParams,
1279
- Xn as charWidthEm,
1280
- T as classOf,
1281
- an as columnsFromContract,
1282
- dt as computePageWindow,
1283
- Yn as createCanvasMeasurer,
1284
- rn as createCanvasPager,
1285
- Qn as createHeuristicMeasurer,
1286
- dn as createMemoryTemplateStore,
1287
- ln as createProviderReport,
1288
- un as createReportCellEdit,
1289
- fn as createReportCellEditBatch,
1290
- ce as createReportCellResolver,
1291
- In as createReportSource,
1292
- sn as createTableTemplate,
1293
- on as createTemplate,
1294
- cn as createTemplateManager,
1295
- sr as createTemplateRegistry,
1296
- An as datasetJsonSchema,
1297
- $n as defineReport,
1298
- lr as defineReportTemplate,
1299
- Nn as evalStyleRule,
1300
- Y as formatReportCellEdit,
1301
- pn as formatReportClipboard,
1302
- Ln as formatValue,
1303
- le as getReportCellContext,
1304
- re as heuristicMeasurer,
1305
- rr as inspectOutputCapabilities,
1306
- J as isImageBackedComponent,
1307
- gr as isReportDate,
1308
- ye as isRichText,
1309
- ae as measurePageSizePx,
1310
- Zn as measureTextMm,
1311
- xe as mergeComponentStyles,
1312
- ne as mmToPx,
1313
- Bn as mmToPxFactor,
1314
- On as paginateTemplate,
1315
- Fn as parseDateLocal,
1316
- De as parseReportCellInput,
1317
- wn as parseReportClipboard,
1318
- te as parseReportTemplate,
1319
- Zt as planFontSizePx,
1320
- O as ptToPx,
1321
- _n as pxToMm,
1322
- Pe as renderComponent,
1323
- ot as renderPage,
1324
- Qt as renderPlan,
1325
- tn as renderPlanToCanvas,
1326
- nn as renderPlanToCanvasAsync,
1327
- en as renderPlanToImages,
1328
- ue as reportCellEditKey,
1329
- W as reportOutputDiagnostics,
1330
- pr as reportParamsJsonSchema,
1331
- Me as resolveBoxBorders,
1332
- D as resolveFontSize,
1333
- H as resolveGridLayout,
1334
- X as resolveLineHeight,
1335
- Ne as resolvePaper,
1336
- ie as resolvePlanAssets,
1337
- j as resolveStroke,
1338
- Ee as resolveTextColor,
1339
- F as round,
1340
- cr as serializeReportTemplate,
1341
- gn as summarizeReportCellEdits,
1342
- Dn as toExcelNumberFormat,
1343
- zn as toNumber,
1344
- Gn as validateComponent,
1345
- Ke as validateDatasetRows,
1346
- Un as validatePage,
1347
- Jn as validateRenderPlan,
1348
- wr as validateReportParamDefinitions,
1349
- br as validateReportParams,
1350
- dr as validateReportTemplate,
1351
- ur as validateReportTemplateDocument,
1352
- Te as wrapText
1535
+ tn as ReportCellFieldError,
1536
+ Xr as ReportParamValidationError,
1537
+ fr as ReportSourceError,
1538
+ Kr as ReportTemplateError,
1539
+ O as ReportTemplateStoreError,
1540
+ dr as SCHEMA_VERSION_MACH,
1541
+ At as TemplateBuilder,
1542
+ qn as applyReportCellEdit,
1543
+ Yn as applyReportCellEditBatch,
1544
+ er as applyReportEditResult,
1545
+ Rr as assertRenderPlan,
1546
+ Zr as assertReportParams,
1547
+ nr as calculateReportSelection,
1548
+ Fr as charWidthEm,
1549
+ C as classOf,
1550
+ Bn as columnsFromContract,
1551
+ Mt as computePageWindow,
1552
+ Or as createCanvasMeasurer,
1553
+ jn as createCanvasPager,
1554
+ Dr as createHeuristicMeasurer,
1555
+ Gn as createMemoryTemplateStore,
1556
+ Kn as createProviderReport,
1557
+ Un as createReportCellEdit,
1558
+ Jn as createReportCellEditBatch,
1559
+ he as createReportCellResolver,
1560
+ hr as createReportSource,
1561
+ _n as createTableTemplate,
1562
+ Wn as createTemplate,
1563
+ Vn as createTemplateManager,
1564
+ Vr as createTemplateRegistry,
1565
+ gr as datasetJsonSchema,
1566
+ pr as defineReport,
1567
+ Gr as defineReportTemplate,
1568
+ wr as evalStyleRule,
1569
+ En as evaluateReportAggregateExpression,
1570
+ ne as formatReportCellEdit,
1571
+ Zn as formatReportClipboard,
1572
+ br as formatValue,
1573
+ fe as getReportCellContext,
1574
+ le as heuristicMeasurer,
1575
+ Wr as inspectOutputCapabilities,
1576
+ Q as isImageBackedComponent,
1577
+ Qr as isReportDate,
1578
+ Re as isRichText,
1579
+ ue as measurePageSizePx,
1580
+ Lr as measureTextMm,
1581
+ ke as mergeComponentStyles,
1582
+ se as mmToPx,
1583
+ Cr as mmToPxFactor,
1584
+ vr as paginateTemplate,
1585
+ yr as parseDateLocal,
1586
+ tr as parseReportCellFieldInput,
1587
+ ge as parseReportCellInput,
1588
+ Qn as parseReportClipboard,
1589
+ ae as parseReportTemplate,
1590
+ Dn as planFontSizePx,
1591
+ L as ptToPx,
1592
+ Ir as pxToMm,
1593
+ Le as renderComponent,
1594
+ wt as renderPage,
1595
+ On as renderPlan,
1596
+ zn as renderPlanToCanvas,
1597
+ Hn as renderPlanToCanvasAsync,
1598
+ Ln as renderPlanToImages,
1599
+ we as reportCellEditKey,
1600
+ V as reportOutputDiagnostics,
1601
+ ei as reportParamsJsonSchema,
1602
+ Ae as resolveBoxBorders,
1603
+ j as resolveFontSize,
1604
+ K as resolveGridLayout,
1605
+ te as resolveLineHeight,
1606
+ _e as resolvePaper,
1607
+ ce as resolvePlanAssets,
1608
+ B as resolveStroke,
1609
+ $e as resolveTextColor,
1610
+ H as round,
1611
+ Ur as serializeReportTemplate,
1612
+ Xn as summarizeReportCellEdits,
1613
+ xr as toExcelNumberFormat,
1614
+ Mr as toNumber,
1615
+ Ar as validateComponent,
1616
+ et as validateDatasetRows,
1617
+ kr as validatePage,
1618
+ $r as validateRenderPlan,
1619
+ dn as validateReportCellFieldDefinition,
1620
+ ti as validateReportParamDefinitions,
1621
+ ni as validateReportParams,
1622
+ qr as validateReportTemplate,
1623
+ Jr as validateReportTemplateDocument,
1624
+ Ne as wrapText
1353
1625
  };