@agile-team/mach-report 0.7.0 → 0.9.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 (42) hide show
  1. package/LICENSE +107 -0
  2. package/dist/ReportPreview-BFTfls8h.js +923 -0
  3. package/dist/ReportPreview-D6VHDUvR.cjs +6 -0
  4. package/dist/format.d.ts +48 -0
  5. package/dist/grid-geometry-BXpOxznT.cjs +1 -0
  6. package/dist/grid-geometry-Bs8QXz1X.js +65 -0
  7. package/dist/index.cjs +6 -6
  8. package/dist/index.d.cts +1 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +858 -660
  11. package/dist/layout/paginate.d.ts +30 -2
  12. package/dist/pdf.cjs +46 -46
  13. package/dist/pdf.js +8 -7
  14. package/dist/{plugin-Cl-IqCqx.cjs → plugin-9eBK7khj.cjs} +1 -1
  15. package/dist/{plugin-Dp3kKWiQ.js → plugin-vi2GjP43.js} +3 -3
  16. package/dist/style-6ihHKVCM.js +192 -0
  17. package/dist/style-Xq08-IsV.cjs +3 -0
  18. package/dist/style.css +1 -1
  19. package/dist/vue/ReportPreview.d.ts +13 -0
  20. package/dist/vue/ReportToolbar.d.ts +20 -3
  21. package/dist/vue/async.d.cts +16 -0
  22. package/dist/vue/async.d.ts +16 -0
  23. package/dist/vue/composables/useHighlight.d.ts +8 -0
  24. package/dist/vue/composables/usePageWindow.d.ts +0 -3
  25. package/dist/vue/composables/usePrintExport.d.ts +8 -0
  26. package/dist/vue/composables/useReportSearch.d.ts +72 -0
  27. package/dist/vue/config.d.ts +17 -1
  28. package/dist/vue/plugin.d.ts +16 -0
  29. package/dist/vue-async.cjs +1 -1
  30. package/dist/vue-async.js +3 -3
  31. package/dist/vue.cjs +1 -1
  32. package/dist/vue.js +35 -33
  33. package/dist/xlsx/render-xlsx.d.ts +20 -0
  34. package/dist/xlsx.cjs +30 -0
  35. package/dist/xlsx.d.cts +5 -0
  36. package/dist/xlsx.d.ts +5 -0
  37. package/dist/xlsx.js +22648 -0
  38. package/package.json +15 -2
  39. package/dist/ReportPreview-CrVeTKu1.cjs +0 -6
  40. package/dist/ReportPreview-DgsOdO4y.js +0 -559
  41. package/dist/style-B3vxGDZd.cjs +0 -3
  42. package/dist/style-B7Xfo5I-.js +0 -255
package/dist/index.js CHANGED
@@ -1,6 +1,90 @@
1
- import { h as J, R as se, D as j, w as G, L as q, i as le, r as _, m as de, a as W, b as Z, c as F, d as V, p as O, e as he, f as Q, g as ce, j as me, P as K } from "./style-B7Xfo5I-.js";
2
- import { C as Ue, k as Ke, l as Ye, M as Xe, S as Ze, n as Qe, o as et, q as tt, s as nt, t as it, u as rt, v as ot, x as at, y as st } from "./style-B7Xfo5I-.js";
3
- const ge = /* @__PURE__ */ new Set([
1
+ import { h as ot, R as At, D as X, w as Z, L as Q, i as Et, r as G, m as $t, a as V, b as ut, c as O, d as tt, p as K, e as Ht, f as pt, g as Nt, P as ht } from "./style-6ihHKVCM.js";
2
+ import { C as be, j as ye, k as we, M as Se, S as Te, l as xe, n as ke, o as ve, q as Ce, s as Pe, t as Ae, u as Ee, v as $e, x as He } from "./style-6ihHKVCM.js";
3
+ import { r as Rt } from "./grid-geometry-Bs8QXz1X.js";
4
+ function Bt(t) {
5
+ const e = /^(\d{4})[-/](\d{1,2})[-/](\d{1,2})$/.exec(t.trim());
6
+ if (e) {
7
+ const n = new Date(Number(e[1]), Number(e[2]) - 1, Number(e[3]));
8
+ return Number.isNaN(n.getTime()) ? null : n;
9
+ }
10
+ const r = new Date(t);
11
+ return Number.isNaN(r.getTime()) ? null : r;
12
+ }
13
+ function nt(t, e) {
14
+ return t.toLocaleString("en-US", {
15
+ minimumFractionDigits: e,
16
+ maximumFractionDigits: e
17
+ });
18
+ }
19
+ function Lt(t, e) {
20
+ const r = (n) => String(n).padStart(2, "0");
21
+ return e.replace(/YYYY/g, String(t.getFullYear())).replace(/MM/g, r(t.getMonth() + 1)).replace(/DD/g, r(t.getDate())).replace(/hh/g, r(t.getHours())).replace(/mm/g, r(t.getMinutes())).replace(/ss/g, r(t.getSeconds()));
22
+ }
23
+ function Ft(t, e, r) {
24
+ return r != null ? e ? nt(t, r) : t.toFixed(r) : e ? nt(t) : String(t);
25
+ }
26
+ function rt(t) {
27
+ const e = typeof t == "number" ? t : Number(String(t).replace(/,/g, ""));
28
+ return Number.isFinite(e) ? e : null;
29
+ }
30
+ function Mt(t, e) {
31
+ if (t == null || t === "" || !e) return String(t ?? "");
32
+ switch (e.kind) {
33
+ case "number": {
34
+ const r = rt(t);
35
+ return r == null ? String(t) : Ft(r, e.thousands === !0, e.digits);
36
+ }
37
+ case "percent": {
38
+ const r = rt(t);
39
+ return r == null ? String(t) : `${nt(r * 100, e.digits ?? 2)}%`;
40
+ }
41
+ case "date": {
42
+ const r = e.pattern ?? "YYYY-MM-DD", n = t instanceof Date ? t : Bt(String(t));
43
+ return n ? Lt(n, r) : String(t);
44
+ }
45
+ default:
46
+ return String(t);
47
+ }
48
+ }
49
+ function zt(t, e) {
50
+ const r = t[e.field];
51
+ if (r == null || r === "") return !1;
52
+ if (typeof e.value == "number") {
53
+ const s = rt(r);
54
+ if (s == null) return !1;
55
+ switch (e.op) {
56
+ case ">":
57
+ return s > e.value;
58
+ case ">=":
59
+ return s >= e.value;
60
+ case "<":
61
+ return s < e.value;
62
+ case "<=":
63
+ return s <= e.value;
64
+ case "==":
65
+ return s === e.value;
66
+ case "!=":
67
+ return s !== e.value;
68
+ }
69
+ }
70
+ const n = String(r), o = String(e.value);
71
+ switch (e.op) {
72
+ case "==":
73
+ return n === o;
74
+ case "!=":
75
+ return n !== o;
76
+ case ">":
77
+ return n > o;
78
+ case ">=":
79
+ return n >= o;
80
+ case "<":
81
+ return n < o;
82
+ case "<=":
83
+ return n <= o;
84
+ }
85
+ return !1;
86
+ }
87
+ const Dt = /* @__PURE__ */ new Set([
4
88
  "text",
5
89
  "image",
6
90
  "barcode",
@@ -10,239 +94,349 @@ const ge = /* @__PURE__ */ new Set([
10
94
  "rect",
11
95
  "ellipse"
12
96
  ]);
13
- function L(e) {
14
- return typeof e == "object" && e !== null && !Array.isArray(e);
97
+ function I(t) {
98
+ return typeof t == "object" && t !== null && !Array.isArray(t);
15
99
  }
16
- function fe(e, n, i, t) {
17
- const r = e[n];
18
- r != null && (typeof r != "number" || !Number.isFinite(r)) && t.push({ path: `${i}.${n}`, message: `应为有限数字,实际 ${JSON.stringify(r)}` });
100
+ function _t(t, e, r, n) {
101
+ const o = t[e];
102
+ o != null && (typeof o != "number" || !Number.isFinite(o)) && n.push({ path: `${r}.${e}`, message: `应为有限数字,实际 ${JSON.stringify(o)}` });
19
103
  }
20
- function ee(e, n, i, t = []) {
21
- if (!L(e)) {
22
- i.push({ path: n, message: "组件应为对象" });
104
+ function bt(t, e, r, n = []) {
105
+ if (!I(t)) {
106
+ r.push({ path: e, message: "组件应为对象" });
23
107
  return;
24
108
  }
25
- const r = e.kind;
26
- typeof r != "string" ? i.push({ path: `${n}.kind`, message: "组件缺少 kind 字符串" }) : ge.has(r) || t.push({
27
- path: `${n}.kind`,
28
- message: `未知组件类型 ${JSON.stringify(r)},将以兜底方式渲染`
109
+ const o = t.kind;
110
+ typeof o != "string" ? r.push({ path: `${e}.kind`, message: "组件缺少 kind 字符串" }) : Dt.has(o) || n.push({
111
+ path: `${e}.kind`,
112
+ message: `未知组件类型 ${JSON.stringify(o)},将以兜底方式渲染`
29
113
  });
30
- for (const o of ["leftMm", "topMm", "widthMm", "heightMm"])
31
- fe(e, o, n, i);
32
- e.leftMm != null && e.widthMm != null && (e.leftMm < -100 || e.widthMm < 0) && i.push({ path: n, message: "几何数值异常(leftMm<-100 或 widthMm<0)" });
33
- const s = e.grid;
34
- s !== void 0 && (!L(s) || !Array.isArray(s.cells) ? i.push({ path: `${n}.grid.cells`, message: "grid.cells 应为二维数组" }) : s.cells.forEach((o, l) => {
35
- if (!Array.isArray(o)) {
36
- i.push({ path: `${n}.grid.cells.${l}`, message: "行应为数组" });
114
+ for (const i of ["leftMm", "topMm", "widthMm", "heightMm"])
115
+ _t(t, i, e, r);
116
+ t.leftMm != null && t.widthMm != null && (t.leftMm < -100 || t.widthMm < 0) && r.push({ path: e, message: "几何数值异常(leftMm<-100 或 widthMm<0)" });
117
+ const s = t.grid;
118
+ s !== void 0 && (!I(s) || !Array.isArray(s.cells) ? r.push({ path: `${e}.grid.cells`, message: "grid.cells 应为二维数组" }) : s.cells.forEach((i, d) => {
119
+ if (!Array.isArray(i)) {
120
+ r.push({ path: `${e}.grid.cells.${d}`, message: "行应为数组" });
37
121
  return;
38
122
  }
39
- o.forEach((d, h) => {
40
- d != null && L(d) && Array.isArray(d.children) && d.children.forEach((c, m) => {
41
- ee(c, `${n}.grid.cells.${l}.${h}.children.${m}`, i, t);
123
+ i.forEach((c, h) => {
124
+ c != null && I(c) && Array.isArray(c.children) && c.children.forEach((m, l) => {
125
+ bt(m, `${e}.grid.cells.${d}.${h}.children.${l}`, r, n);
42
126
  });
43
127
  });
44
128
  }));
45
- const a = e.richParagraphs;
46
- a !== void 0 && (Array.isArray(a) ? a.forEach((o, l) => {
47
- (!L(o) || !Array.isArray(o.segments)) && i.push({ path: `${n}.richParagraphs.${l}`, message: "段落缺少 segments 数组" });
48
- }) : i.push({ path: `${n}.richParagraphs`, message: "richParagraphs 应为数组" }));
49
- }
50
- function ue(e, n, i, t = []) {
51
- if (!L(e)) {
52
- i.push({ path: n, message: "页应为对象" });
129
+ const a = t.richParagraphs;
130
+ a !== void 0 && (Array.isArray(a) ? a.forEach((i, d) => {
131
+ (!I(i) || !Array.isArray(i.segments)) && r.push({ path: `${e}.richParagraphs.${d}`, message: "段落缺少 segments 数组" });
132
+ }) : r.push({ path: `${e}.richParagraphs`, message: "richParagraphs 应为数组" }));
133
+ }
134
+ function Wt(t, e, r, n = []) {
135
+ if (!I(t)) {
136
+ r.push({ path: e, message: "页应为对象" });
53
137
  return;
54
138
  }
55
- const r = e.pageWidthMm, s = e.pageHeightMm;
56
- (typeof r != "number" || !(r > 0 && r < 3e3)) && i.push({ path: `${n}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(r)}` }), (typeof s != "number" || !(s > 0 && s < 5e3)) && i.push({ path: `${n}.pageHeightMm`, message: `页高非法: ${JSON.stringify(s)}` });
57
- const a = e.components;
58
- a !== void 0 && !Array.isArray(a) ? i.push({ path: `${n}.components`, message: "components 应为数组" }) : Array.isArray(a) && a.forEach(
59
- (o, l) => ee(o, `${n}.components.${l}`, i, t)
139
+ const o = t.pageWidthMm, s = t.pageHeightMm;
140
+ (typeof o != "number" || !(o > 0 && o < 3e3)) && r.push({ path: `${e}.pageWidthMm`, message: `页宽非法: ${JSON.stringify(o)}` }), (typeof s != "number" || !(s > 0 && s < 5e3)) && r.push({ path: `${e}.pageHeightMm`, message: `页高非法: ${JSON.stringify(s)}` });
141
+ const a = t.components;
142
+ a !== void 0 && !Array.isArray(a) ? r.push({ path: `${e}.components`, message: "components 应为数组" }) : Array.isArray(a) && a.forEach(
143
+ (i, d) => bt(i, `${e}.components.${d}`, r, n)
60
144
  );
61
145
  }
62
- function pe(e) {
63
- const n = [], i = [], t = L(e) ? e.pages : void 0;
64
- if (!Array.isArray(t))
65
- n.push({
146
+ function It(t) {
147
+ const e = [], r = [], n = I(t) ? t.pages : void 0;
148
+ if (!Array.isArray(n))
149
+ e.push({
66
150
  path: "$.pages",
67
- message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
151
+ message: t == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
68
152
  });
69
153
  else {
70
- t.forEach((s, a) => ue(s, `$.pages.${a}`, n, i)), t.length > 2e3 && i.push({
154
+ n.forEach((s, a) => Wt(s, `$.pages.${a}`, e, r)), n.length > 2e3 && r.push({
71
155
  path: "$.pages",
72
- message: `页数异常大(${t.length} 页),渲染与打印耗时可能显著增加`
156
+ message: `页数异常大(${n.length} 页),渲染与打印耗时可能显著增加`
73
157
  });
74
- const r = t.reduce(
75
- (s, a) => s + (L(a) && Array.isArray(a.components) ? a.components.length : 0),
158
+ const o = n.reduce(
159
+ (s, a) => s + (I(a) && Array.isArray(a.components) ? a.components.length : 0),
76
160
  0
77
161
  );
78
- r > 5e4 && i.push({
162
+ o > 5e4 && r.push({
79
163
  path: "$.pages",
80
- message: `组件总数异常大(${r} 个),可能触发浏览器性能限制`
164
+ message: `组件总数异常大(${o} 个),可能触发浏览器性能限制`
81
165
  });
82
166
  }
83
- return { ok: n.length === 0, errors: n, warnings: i };
167
+ return { ok: e.length === 0, errors: e, warnings: r };
84
168
  }
85
- function _e(e) {
86
- const n = pe(e);
87
- if (!n.ok) {
88
- const i = n.errors.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ");
89
- throw new Error(`渲染计划校验失败(${n.errors.length} 处): ${i}`);
169
+ function le(t) {
170
+ const e = It(t);
171
+ if (!e.ok) {
172
+ const r = e.errors.slice(0, 3).map((n) => `${n.path}: ${n.message}`).join("; ");
173
+ throw new Error(`渲染计划校验失败(${e.errors.length} 处): ${r}`);
90
174
  }
91
- return e.pages;
175
+ return t.pages;
92
176
  }
93
- function Y(e) {
177
+ function mt(t) {
94
178
  return {
95
- widthMm: e.widthMm,
96
- heightMm: e.heightMm,
97
- marginTopMm: e.marginTopMm ?? 0,
98
- marginBottomMm: e.marginBottomMm ?? 0,
99
- marginLeftMm: e.marginLeftMm ?? 0,
100
- marginRightMm: e.marginRightMm ?? 0,
179
+ widthMm: t.widthMm,
180
+ heightMm: t.heightMm,
181
+ marginTopMm: t.marginTopMm ?? 0,
182
+ marginBottomMm: t.marginBottomMm ?? 0,
183
+ marginLeftMm: t.marginLeftMm ?? 0,
184
+ marginRightMm: t.marginRightMm ?? 0,
101
185
  components: []
102
186
  };
103
187
  }
104
- function Me(e, n) {
105
- return n.heightMm - (e.marginBottomMm ?? n.marginBottomMm);
188
+ function jt(t, e) {
189
+ return e.heightMm - (t.marginBottomMm ?? e.marginBottomMm);
106
190
  }
107
- function be(e, n) {
108
- const t = (e.fontSizePt ?? j) * q * 25.4 / 72, r = (e.paddingMm ?? 1) * 2;
109
- return Math.max(e.rowHeightMm ?? 0, n * t + r);
191
+ function Ot(t, e) {
192
+ const n = (t.fontSizePt ?? X) * Q * 25.4 / 72, o = (t.paddingMm ?? 1) * 2;
193
+ return Math.max(t.rowHeightMm ?? 0, e * n + o);
110
194
  }
111
- function ye(e) {
112
- if (e == null) return "";
113
- if (typeof e == "string") return e;
114
- if (typeof e == "number") return String(e);
115
- if (typeof e == "boolean") return e ? "是" : "否";
116
- if (e instanceof Date) return e.toISOString().slice(0, 10);
195
+ function yt(t) {
196
+ if (t == null) return "";
197
+ if (typeof t == "string") return t;
198
+ if (typeof t == "number") return String(t);
199
+ if (typeof t == "boolean") return t ? "是" : "否";
200
+ if (t instanceof Date) return t.toISOString().slice(0, 10);
117
201
  try {
118
- return JSON.stringify(e);
202
+ return JSON.stringify(t);
119
203
  } catch {
120
- return String(e);
204
+ return String(t);
121
205
  }
122
206
  }
123
- function we(e, n) {
124
- const i = e.fontSizePt ?? j, t = e.paddingMm ?? 1, r = e.columns.map(
125
- (m) => m.style ? { align: "left", verticalAlign: "middle", ...m.style } : { align: "left", verticalAlign: "middle" }
126
- ), s = e.columns.map(
127
- (m) => ({
128
- bold: e.headerBold ?? !0,
207
+ function Gt(t, e) {
208
+ const r = t.fontSizePt ?? X, n = t.paddingMm ?? 1, o = t.columns.map(
209
+ (l) => l.style ? { align: "left", verticalAlign: "middle", ...l.style } : { align: "left", verticalAlign: "middle" }
210
+ ), s = t.columns.map(
211
+ (l) => ({
212
+ bold: t.headerBold ?? !0,
129
213
  align: "center",
130
214
  verticalAlign: "middle",
131
- backgroundColor: e.headerBackgroundColor,
132
- ...m.style || {}
215
+ backgroundColor: t.headerBackgroundColor,
216
+ ...l.style || {}
133
217
  })
134
- ), a = e.columns.map((m) => m.header), o = a.map(
135
- (m, u) => G(
136
- m,
137
- e.columns[u].widthMm - t * 2,
138
- { fontSizePt: i, bold: e.headerBold ?? !0 },
139
- n
218
+ ), a = t.columns.map((l) => l.header), i = a.map(
219
+ (l, f) => Z(
220
+ l,
221
+ t.columns[f].widthMm - n * 2,
222
+ { fontSizePt: r, bold: t.headerBold ?? !0 },
223
+ e
140
224
  )
141
- ), l = Math.max(...o.map((m) => m.length), 1), d = be(e, l), h = a.map((m, u) => ({
142
- text: m,
143
- style: s[u]
144
- })), c = e.border === !1 ? { borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } : { borderBottom: !0, borderLeft: !0, borderRight: !0, borderTop: !0 };
225
+ ), d = Math.max(...i.map((l) => l.length), 1), c = Ot(t, d), h = a.map((l, f) => ({
226
+ text: l,
227
+ style: s[f]
228
+ })), m = t.border === !1 ? { borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } : { borderBottom: !0, borderLeft: !0, borderRight: !0, borderTop: !0 };
145
229
  return {
146
- fontSizePt: i,
147
- paddingMm: t,
148
- cellStyles: r,
149
- borderStyle: c,
150
- headerHeightMm: d,
151
- headerGrid: { cells: [h], rowHeightsMm: [d] },
152
- columns: e.columns
230
+ fontSizePt: r,
231
+ paddingMm: n,
232
+ cellStyles: o,
233
+ borderStyle: m,
234
+ headerHeightMm: c,
235
+ headerGrid: { cells: [h], rowHeightsMm: [c] },
236
+ columns: t.columns
153
237
  };
154
238
  }
155
- function Se(e, n, i) {
156
- const t = e.columns, r = new Array(t.length);
239
+ function gt(t, e, r) {
240
+ const n = t.columns, o = new Array(n.length);
157
241
  let s = 1;
158
- for (let h = 0; h < t.length; h++)
159
- r[h] = ye(n[t[h].field]);
160
- const a = new Array(t.length);
161
- for (let h = 0; h < t.length; h++) {
162
- const c = G(
163
- r[h],
164
- t[h].widthMm - e.paddingMm * 2,
165
- { fontSizePt: e.fontSizePt },
166
- i
242
+ for (let h = 0; h < n.length; h++) {
243
+ const m = n[h];
244
+ o[h] = m.format ? Mt(e[m.field], m.format) : yt(e[m.field]);
245
+ }
246
+ const a = new Array(n.length);
247
+ for (let h = 0; h < n.length; h++) {
248
+ const m = Z(
249
+ o[h],
250
+ n[h].widthMm - t.paddingMm * 2,
251
+ { fontSizePt: t.fontSizePt },
252
+ r
167
253
  );
168
- a[h] = c, c.length > s && (s = c.length);
169
- }
170
- const o = e.fontSizePt * q * 25.4 / 72, l = Math.max(
171
- e.rowHeightFloorMm,
172
- s * o + e.paddingMm * 2
173
- ), d = new Array(t.length);
174
- for (let h = 0; h < t.length; h++)
175
- d[h] = { text: r[h], style: e.cellStyles[h] };
176
- return { grid: { cells: [d], rowHeightsMm: [l] }, heightMm: l };
177
- }
178
- function We(e, n, i = {}) {
179
- const t = typeof i == "number" ? { mmPerRow: i } : i, r = t.mmPerRow ?? 0, s = t.measurer ?? J, a = [], o = [];
180
- let l = 0;
181
- const d = (h) => `${h}_${(++l).toString(36)}`;
182
- for (const h of e.pages) {
183
- const c = Y(h), m = () => Me(h, c), u = c.marginTopMm, g = () => {
184
- o.push({
185
- pageWidthMm: c.widthMm,
186
- pageHeightMm: c.heightMm,
187
- marginTopMm: c.marginTopMm,
188
- marginBottomMm: c.marginBottomMm,
189
- marginLeftMm: c.marginLeftMm,
190
- marginRightMm: c.marginRightMm,
191
- components: c.components
192
- });
254
+ a[h] = m, m.length > s && (s = m.length);
255
+ }
256
+ const i = t.fontSizePt * Q * 25.4 / 72, d = Math.max(
257
+ t.rowHeightFloorMm,
258
+ s * i + t.paddingMm * 2
259
+ ), c = new Array(n.length);
260
+ for (let h = 0; h < n.length; h++) {
261
+ const m = n[h];
262
+ let l = t.cellStyles[h];
263
+ if (m.rules) {
264
+ for (const f of m.rules)
265
+ if (zt(e, f.when)) {
266
+ l = { ...l ?? {}, ...f.style };
267
+ break;
268
+ }
269
+ }
270
+ c[h] = { text: o[h], style: l };
271
+ }
272
+ return { grid: { cells: [c], rowHeightsMm: [d] }, heightMm: d };
273
+ }
274
+ function de(t, e, r = {}) {
275
+ const n = typeof r == "number" ? { mmPerRow: r } : r, o = n.mmPerRow ?? 0, s = n.measurer ?? ot, a = [], i = [];
276
+ let d = 0;
277
+ const c = (m) => `${m}_${(++d).toString(36)}`, h = [];
278
+ for (const m of t.pages) {
279
+ const l = mt(m), f = () => jt(m, l), g = l.marginTopMm, w = [], E = () => {
280
+ if (i.push({
281
+ pageWidthMm: l.widthMm,
282
+ pageHeightMm: l.heightMm,
283
+ marginTopMm: l.marginTopMm,
284
+ marginBottomMm: l.marginBottomMm,
285
+ marginLeftMm: l.marginLeftMm,
286
+ marginRightMm: l.marginRightMm,
287
+ components: l.components
288
+ }), w.length > 0) {
289
+ const x = i.length;
290
+ for (const b of w) {
291
+ const C = {
292
+ ...b,
293
+ text: String(b.text ?? "").replace(/\{page\}/g, String(x))
294
+ };
295
+ i[i.length - 1].components.push(C), C.text.includes("{totalPages}") && h.push(C);
296
+ }
297
+ }
193
298
  };
194
- for (const M of h.components) {
195
- if (M.kind !== "list") {
196
- c.components.push(M);
299
+ for (const x of m.components) {
300
+ if (x.kind !== "list") {
301
+ if (x.kind === "text" && typeof x.text == "string") {
302
+ const p = x.text;
303
+ if (p.includes("{page}") || p.includes("{totalPages}")) {
304
+ w.push(x);
305
+ continue;
306
+ }
307
+ }
308
+ l.components.push(x);
197
309
  continue;
198
310
  }
199
- const p = M, k = n[p.dataset];
200
- Array.isArray(k) || a.push(`数据集 ${p.dataset} 未提供数据,列表 ${p.id ?? ""} 输出为空`);
201
- const T = Array.isArray(k) ? k : [], E = p.columns.reduce((f, b) => f + b.widthMm, 0), w = E > p.widthMm ? p.widthMm / E : 1, I = w === 1 ? p : { ...p, columns: p.columns.map((f) => ({ ...f, widthMm: f.widthMm * w })) }, R = {
202
- ...we(I, s),
203
- rowHeightFloorMm: I.rowHeightMm ?? 0
204
- }, D = {
311
+ const b = x, C = e[b.dataset];
312
+ Array.isArray(C) || a.push(`数据集 ${b.dataset} 未提供数据,列表 ${b.id ?? ""} 输出为空`);
313
+ const S = Array.isArray(C) ? C : [], J = b.columns.reduce((p, M) => p + M.widthMm, 0), q = J > b.widthMm ? b.widthMm / J : 1, k = q === 1 ? b : { ...b, columns: b.columns.map((p) => ({ ...p, widthMm: p.widthMm * q })) }, $ = {
314
+ ...Gt(k, s),
315
+ rowHeightFloorMm: k.rowHeightMm ?? 0
316
+ }, j = {
205
317
  kind: "rect",
206
- leftMm: p.leftMm,
318
+ leftMm: b.leftMm,
207
319
  topMm: 0,
208
- widthMm: p.widthMm,
209
- heightMm: R.headerHeightMm,
210
- grid: R.headerGrid,
211
- nid: d("listh"),
212
- style: R.borderStyle
320
+ widthMm: b.widthMm,
321
+ heightMm: $.headerHeightMm,
322
+ grid: $.headerGrid,
323
+ nid: c("listh"),
324
+ style: $.borderStyle
213
325
  };
214
- let $ = p.topMm;
215
- const B = (f, b) => {
216
- f.components.push({ ...D, topMm: b });
326
+ let u = b.topMm;
327
+ const H = (p, M) => {
328
+ p.components.push({ ...j, topMm: M });
217
329
  };
218
- B(c, $), $ += R.headerHeightMm + r;
219
- for (let f = 0; f < T.length; f++) {
220
- const b = Se(R, T[f], s);
221
- if ($ + b.heightMm > m()) {
222
- g();
223
- const P = Y(h);
224
- c.components = P.components, c.heightMm = P.heightMm, I.headerEveryPage !== !1 ? (B(c, p.topMm), $ = p.topMm + R.headerHeightMm) : $ = u;
330
+ H(l, u), u += $.headerHeightMm + o;
331
+ const L = (p) => {
332
+ if (u + p > f()) {
333
+ E();
334
+ const M = mt(m);
335
+ l.components = M.components, l.heightMm = M.heightMm, k.headerEveryPage !== !1 ? (H(l, b.topMm), u = b.topMm + $.headerHeightMm) : u = g;
225
336
  }
226
- c.components.push({
337
+ }, y = (p, M, T) => {
338
+ L(M), l.components.push({
227
339
  kind: "rect",
228
- leftMm: p.leftMm,
229
- topMm: $,
230
- widthMm: p.widthMm,
231
- heightMm: b.heightMm,
232
- grid: b.grid,
233
- nid: d("listr"),
234
- style: R.borderStyle
235
- }), $ += b.heightMm;
340
+ leftMm: b.leftMm,
341
+ topMm: u,
342
+ widthMm: b.widthMm,
343
+ heightMm: M,
344
+ grid: p,
345
+ nid: c(T),
346
+ style: $.borderStyle
347
+ }), u += M;
348
+ }, N = () => gt($, {}, s).heightMm, P = (p, M, T, v) => {
349
+ const D = [], dt = Math.max(1, Math.min(v, k.columns.length));
350
+ D.push({ text: p, colSpan: dt, style: { bold: !0, ...T } });
351
+ for (let et = dt; et < k.columns.length; et++) {
352
+ const Pt = k.columns[et];
353
+ D.push({ text: M.get(Pt.field) ?? "", style: T });
354
+ }
355
+ const Ct = $.fontSizePt * Q * 25.4 / 72, ct = Math.max($.rowHeightFloorMm, Ct + $.paddingMm * 2);
356
+ return { grid: { cells: [D], rowHeightsMm: [ct] }, heightMm: ct };
357
+ }, _ = (p, M) => {
358
+ let T = 0;
359
+ for (const v of p) {
360
+ const D = typeof v[M] == "number" ? v[M] : Number(v[M]);
361
+ Number.isFinite(D) && (T += D);
362
+ }
363
+ return T;
364
+ }, U = (p, M) => {
365
+ const T = k.columns.find((v) => v.field === M);
366
+ return Mt(_(p, M), T?.format ?? { kind: "number", thousands: !0 });
367
+ }, F = k.groupBy, vt = typeof k.grandTotal == "object" && k.grandTotal.fields || F?.subtotal || [], st = k.columns.findIndex((p) => vt.includes(p.field)), at = st > 0 ? st : 1, Y = [];
368
+ if (F) {
369
+ const p = /* @__PURE__ */ new Map();
370
+ for (const M of S) {
371
+ const T = yt(M[F.field]), v = p.get(T);
372
+ v ? v.push(M) : p.set(T, [M]);
373
+ }
374
+ for (const [M, T] of p) {
375
+ Y.push({
376
+ kind: "groupHeader",
377
+ label: (F.headerTemplate ?? "{value}").replace(/\{value\}/g, M)
378
+ });
379
+ for (const v of T) Y.push({ kind: "row", row: v });
380
+ F.subtotal && F.subtotal.length > 0 && Y.push({
381
+ kind: "subtotal",
382
+ label: F.subtotalLabel ?? "小计",
383
+ rows: T
384
+ });
385
+ }
386
+ } else
387
+ for (const p of S) Y.push({ kind: "row", row: p });
388
+ const lt = N();
389
+ for (const p of Y)
390
+ if (p.kind === "row") {
391
+ const M = gt($, p.row, s);
392
+ y(M.grid, M.heightMm, "listr");
393
+ } else if (p.kind === "groupHeader") {
394
+ const M = P(
395
+ p.label,
396
+ /* @__PURE__ */ new Map(),
397
+ F?.headerStyle ?? {},
398
+ k.columns.length
399
+ );
400
+ F?.keepWithNext !== !1 && u + M.heightMm + lt > f() && L(M.heightMm + lt), y(M.grid, M.heightMm, "listg");
401
+ } else if (p.kind === "subtotal") {
402
+ const M = /* @__PURE__ */ new Map();
403
+ for (const v of F.subtotal ?? []) M.set(v, U(p.rows, v));
404
+ const T = P(
405
+ p.label,
406
+ M,
407
+ F?.subtotalStyle ?? {},
408
+ at
409
+ );
410
+ y(T.grid, T.heightMm, "listst");
411
+ }
412
+ if (k.grandTotal) {
413
+ const p = typeof k.grandTotal == "object" ? k.grandTotal : void 0, M = p?.fields ?? F?.subtotal ?? [];
414
+ if (M.length > 0) {
415
+ const T = /* @__PURE__ */ new Map();
416
+ for (const D of M) T.set(D, U(S, D));
417
+ const v = P(
418
+ p?.label ?? "合计",
419
+ T,
420
+ p?.style ?? {},
421
+ at
422
+ );
423
+ y(v.grid, v.heightMm, "listgt");
424
+ } else
425
+ a.push(`列表 ${b.id ?? ""} 配置了 grandTotal 但未提供合计字段(groupBy.subtotal 或 grandTotal.fields)`);
236
426
  }
237
427
  }
238
- g();
428
+ E();
429
+ }
430
+ for (const m of h) {
431
+ const l = m.text;
432
+ typeof l == "string" && l.includes("{totalPages}") && (m.text = l.replace(/\{totalPages\}/g, String(i.length)));
239
433
  }
240
434
  return {
241
- plan: { schemaVersion: se, pages: o },
435
+ plan: { schemaVersion: At, pages: i },
242
436
  warnings: a
243
437
  };
244
438
  }
245
- const Te = {
439
+ const Vt = {
246
440
  root: "mr-root",
247
441
  page: "mr-page",
248
442
  comp: "mr-comp",
@@ -259,526 +453,526 @@ const Te = {
259
453
  cell: "mr-cell",
260
454
  unknown: "mr-unknown"
261
455
  };
262
- function C(e, n) {
263
- return n?.classNames?.[e] ?? Te[e];
456
+ function B(t, e) {
457
+ return e?.classNames?.[t] ?? Vt[t];
264
458
  }
265
- class H {
459
+ class z {
266
460
  constructor() {
267
461
  this.props = [];
268
462
  }
269
- add(n, i) {
270
- return i == null || i === !1 || i === "" ? this : (this.props.push([n, String(i)]), this);
463
+ add(e, r) {
464
+ return r == null || r === !1 || r === "" ? this : (this.props.push([e, String(r)]), this);
271
465
  }
272
- mm(n, i, t, r = 2) {
273
- return this.add(n, `${_(de(i, t), r)}px`);
466
+ mm(e, r, n, o = 2) {
467
+ return this.add(e, `${G($t(r, n), o)}px`);
274
468
  }
275
469
  toString() {
276
- let n = "";
277
- for (const [i, t] of this.props)
278
- n += `${i}:${t};`;
279
- return n;
280
- }
281
- applyTo(n) {
282
- const i = this.toString();
283
- i && (n.style.cssText = i);
284
- }
285
- }
286
- function te(e, n, i) {
287
- const t = n.style || {};
288
- e.add("color", t.color).add("background-color", t.backgroundColor).add("font-family", t.fontFamily).add("font-weight", t.bold ? "700" : void 0).add("font-style", t.italic ? "italic" : void 0).add("text-decoration", t.underline ? "underline" : void 0).add("letter-spacing", t.letterSpacing != null ? `${t.letterSpacing}pt` : void 0).add("opacity", t.opacity != null ? String(t.opacity) : void 0).add("transform", t.rotateDeg ? `rotate(${t.rotateDeg}deg)` : void 0);
289
- const r = W(t, i);
290
- e.add("font-size", `${_(r.fontSizePx, 2)}px`);
291
- }
292
- function ve(e, n, i, t, r) {
293
- const s = r.createElement("table");
294
- if (s.className = C("grid", t), new H().add("width", "100%").add("height", "100%").add("border-collapse", "collapse").add("table-layout", e.colWidthsMm ? "fixed" : "auto").applyTo(s), e.colWidthsMm) {
295
- const d = r.createElement("colgroup");
296
- for (const h of e.colWidthsMm) {
297
- const c = r.createElement("col");
298
- new H().mm("width", h, i).applyTo(c), d.appendChild(c);
470
+ let e = "";
471
+ for (const [r, n] of this.props)
472
+ e += `${r}:${n};`;
473
+ return e;
474
+ }
475
+ applyTo(e) {
476
+ const r = this.toString();
477
+ r && (e.style.cssText = r);
478
+ }
479
+ }
480
+ function wt(t, e, r) {
481
+ const n = e.style || {};
482
+ t.add("color", n.color).add("background-color", n.backgroundColor).add("font-family", n.fontFamily).add("font-weight", n.bold ? "700" : void 0).add("font-style", n.italic ? "italic" : void 0).add("text-decoration", n.underline ? "underline" : void 0).add("letter-spacing", n.letterSpacing != null ? `${n.letterSpacing}pt` : void 0).add("opacity", n.opacity != null ? String(n.opacity) : void 0).add("transform", n.rotateDeg ? `rotate(${n.rotateDeg}deg)` : void 0);
483
+ const o = V(n, r);
484
+ t.add("font-size", `${G(o.fontSizePx, 2)}px`);
485
+ }
486
+ function Yt(t, e, r, n, o) {
487
+ const s = o.createElement("table");
488
+ if (s.className = B("grid", n), new z().add("width", "100%").add("height", "100%").add("border-collapse", "collapse").add("table-layout", t.colWidthsMm ? "fixed" : "auto").applyTo(s), t.colWidthsMm) {
489
+ const c = o.createElement("colgroup");
490
+ for (const h of t.colWidthsMm) {
491
+ const m = o.createElement("col");
492
+ new z().mm("width", h, r).applyTo(m), c.appendChild(m);
299
493
  }
300
- s.appendChild(d);
301
- }
302
- const a = V(n.style), o = F(n.style), l = a.inner ? `${_(o.widthPt * i / 72, 2)}px solid ${o.color}` : "";
303
- return e.cells.forEach((d, h) => {
304
- const c = r.createElement("tr");
305
- c.className = C("row", t), e.rowHeightsMm?.[h] != null && new H().mm("height", e.rowHeightsMm[h], i).applyTo(c), (d || []).forEach((m) => {
306
- const u = r.createElement("td");
307
- u.className = C("cell", t), m?.colSpan && (u.colSpan = m.colSpan), m?.rowSpan && (u.rowSpan = m.rowSpan);
308
- const g = new H();
309
- if (l && g.add("border", l), m?.style) {
310
- const M = m.style;
311
- g.add("text-align", M.align).add("vertical-align", M.verticalAlign).add("background-color", M.backgroundColor).add("color", M.color).add("font-weight", M.bold ? "700" : void 0), g.add("font-size", `${_(W(M, i).fontSizePx, 2)}px`);
494
+ s.appendChild(c);
495
+ }
496
+ const a = tt(e.style), i = O(e.style), d = a.inner ? `${G(i.widthPt * r / 72, 2)}px solid ${i.color}` : "";
497
+ return t.cells.forEach((c, h) => {
498
+ const m = o.createElement("tr");
499
+ m.className = B("row", n), t.rowHeightsMm?.[h] != null && new z().mm("height", t.rowHeightsMm[h], r).applyTo(m), (c || []).forEach((l) => {
500
+ const f = o.createElement("td");
501
+ f.className = B("cell", n), l?.colSpan && (f.colSpan = l.colSpan), l?.rowSpan && (f.rowSpan = l.rowSpan);
502
+ const g = new z();
503
+ if (d && g.add("border", d), l?.style) {
504
+ const w = l.style;
505
+ g.add("text-align", w.align).add("vertical-align", w.verticalAlign).add("background-color", w.backgroundColor).add("color", w.color).add("font-weight", w.bold ? "700" : void 0), g.add("font-size", `${G(V(w, r).fontSizePx, 2)}px`);
312
506
  }
313
- if (g.applyTo(u), m?.text != null && (u.textContent = m.text), m?.children?.length)
314
- for (const M of m.children)
315
- u.appendChild(ne(M, i, t, r));
316
- c.appendChild(u);
317
- }), s.appendChild(c);
507
+ if (g.applyTo(f), l?.text != null && (f.textContent = l.text), l?.children?.length)
508
+ for (const w of l.children)
509
+ f.appendChild(St(w, r, n, o));
510
+ m.appendChild(f);
511
+ }), s.appendChild(m);
318
512
  }), s;
319
513
  }
320
- function Ce(e, n, i, t) {
321
- const r = t.createElement("div");
322
- r.className = C("text", i);
323
- const s = e.style || {}, a = new H().add("text-align", s.align).add("display", "flex").add("flex-direction", "column").add(
514
+ function Jt(t, e, r, n) {
515
+ const o = n.createElement("div");
516
+ o.className = B("text", r);
517
+ const s = t.style || {}, a = new z().add("text-align", s.align).add("display", "flex").add("flex-direction", "column").add(
324
518
  "justify-content",
325
519
  s.verticalAlign === "middle" ? "center" : s.verticalAlign === "bottom" ? "flex-end" : "flex-start"
326
520
  ).add("overflow", "hidden");
327
- if (te(a, e, n), a.applyTo(r), Z(e)) {
328
- const o = t.createElement("div");
329
- o.className = C("rich", i);
330
- for (const l of e.richParagraphs) {
331
- const d = t.createElement("div");
332
- d.className = C("paragraph", i), new H().add("text-align", l.align).add("line-height", l.lineHeight != null ? String(l.lineHeight) : void 0).mm("margin-top", l.spaceBeforeMm ?? 0, n).mm("margin-bottom", l.spaceAfterMm ?? 0, n).mm("text-indent", l.indentMm ?? 0, n).applyTo(d);
333
- for (const c of l.segments || []) {
334
- const m = t.createElement("span");
335
- if (m.className = C("segment", i), m.textContent = c.kind === "field" ? c.field ?? "" : c.text ?? "", c.style) {
336
- const u = new H().add("color", c.style.color).add("font-weight", c.style.bold ? "700" : void 0);
337
- u.add("font-size", `${_(W(c.style, n).fontSizePx, 2)}px`), u.applyTo(m);
521
+ if (wt(a, t, e), a.applyTo(o), ut(t)) {
522
+ const i = n.createElement("div");
523
+ i.className = B("rich", r);
524
+ for (const d of t.richParagraphs) {
525
+ const c = n.createElement("div");
526
+ c.className = B("paragraph", r), new z().add("text-align", d.align).add("line-height", d.lineHeight != null ? String(d.lineHeight) : void 0).mm("margin-top", d.spaceBeforeMm ?? 0, e).mm("margin-bottom", d.spaceAfterMm ?? 0, e).mm("text-indent", d.indentMm ?? 0, e).applyTo(c);
527
+ for (const m of d.segments || []) {
528
+ const l = n.createElement("span");
529
+ if (l.className = B("segment", r), l.textContent = m.kind === "field" ? m.field ?? "" : m.text ?? "", m.style) {
530
+ const f = new z().add("color", m.style.color).add("font-weight", m.style.bold ? "700" : void 0);
531
+ f.add("font-size", `${G(V(m.style, e).fontSizePx, 2)}px`), f.applyTo(l);
338
532
  }
339
- d.appendChild(m);
533
+ c.appendChild(l);
340
534
  }
341
- o.appendChild(d);
535
+ i.appendChild(c);
342
536
  }
343
- return r.appendChild(o), r;
344
- }
345
- if (Array.isArray(e.lines) && e.lines.length > 0) {
346
- const o = t.createElement("div");
347
- o.className = C("lines", i), s.lineHeight != null && new H().add("line-height", String(s.lineHeight)).applyTo(o);
348
- for (const l of e.lines) {
349
- const d = t.createElement("div");
350
- d.className = C("line", i), d.textContent = l, o.appendChild(d);
537
+ return o.appendChild(i), o;
538
+ }
539
+ if (Array.isArray(t.lines) && t.lines.length > 0) {
540
+ const i = n.createElement("div");
541
+ i.className = B("lines", r), s.lineHeight != null && new z().add("line-height", String(s.lineHeight)).applyTo(i);
542
+ for (const d of t.lines) {
543
+ const c = n.createElement("div");
544
+ c.className = B("line", r), c.textContent = d, i.appendChild(c);
351
545
  }
352
- return r.appendChild(o), r;
353
- }
354
- return r.textContent = e.text ?? "", r;
355
- }
356
- function ke(e, n, i) {
357
- const t = i.createElement("img");
358
- return t.className = C("image", n), t.src = e.imageData, new H().add("width", "100%").add("height", "100%").add("object-fit", "contain").add("display", "block").applyTo(t), t.alt = e.kind, t;
359
- }
360
- function X(e, n, i, t) {
361
- const r = t.createElement("div");
362
- r.className = C("shape", i);
363
- const s = e.style || {}, a = F(s), o = V(s), l = `${_(a.widthPt * n / 72, 2)}px solid ${a.color}`, d = new H();
364
- return e.grid || e.kind === "rect" ? (o.top && d.add("border-top", l), o.right && d.add("border-right", l), o.bottom && d.add("border-bottom", l), o.left && d.add("border-left", l)) : e.kind === "ellipse" ? (o.inner && d.add("border", l).add("border-radius", "50%"), s.backgroundColor && d.add("background-color", s.backgroundColor)) : e.kind === "line" && d.add("height", "0").add("border-top", l), d.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), d.applyTo(r), r;
365
- }
366
- function ne(e, n, i, t) {
367
- const r = t.createElement("div");
368
- r.className = `${C("comp", i)} mr-kind-${e.kind}`;
369
- const s = new H().add("position", "absolute").mm("left", e.leftMm, n).mm("top", e.topMm, n).mm("width", e.widthMm, n).mm("height", e.heightMm, n).add("box-sizing", "border-box");
370
- if (te(s, e, n), s.applyTo(r), le(e))
371
- return r.appendChild(ke(e, i, t)), r;
372
- if (e.kind === "text")
373
- return r.appendChild(Ce(e, n, i, t)), r;
374
- if (e.grid) {
375
- const o = X(e, n, i, t);
376
- return o.appendChild(ve(e.grid, e, n, i, t)), r.appendChild(o), r;
377
- }
378
- if (e.kind === "line" || e.kind === "rect" || e.kind === "ellipse" || e.kind === "chart")
379
- return r.appendChild(X(e, n, i, t)), r;
380
- const a = t.createElement("div");
381
- return a.className = C("unknown", i), a.textContent = e.fallbackText ?? "", r.appendChild(a), r;
382
- }
383
- function xe(e, n, i, t) {
384
- const r = t.createElement("div");
385
- r.className = C("page", i), new H().add("position", "relative").mm("width", e.pageWidthMm, n).mm("height", e.pageHeightMm, n).add("background-color", "#fff").add("overflow", "hidden").add("box-sizing", "border-box").applyTo(r);
386
- for (const s of e.components)
387
- r.appendChild(ne(s, n, i, t));
388
- return r;
389
- }
390
- function Ie(e, n, i = {}) {
391
- const t = i.dpi ?? 96, r = n.createElement("div");
392
- return r.className = C("root", i), r.dataset.schemaVersion = e.schemaVersion, e.pages.forEach((s) => {
393
- r.appendChild(xe(s, t, i, n));
394
- }), r;
395
- }
396
- function Pe(e) {
397
- const { pageHeightsPx: n, viewportHeightPx: i, scrollTopPx: t, overscan: r = 1, gapPx: s = 0 } = e, a = n.length;
546
+ return o.appendChild(i), o;
547
+ }
548
+ return o.textContent = t.text ?? "", o;
549
+ }
550
+ function qt(t, e, r) {
551
+ const n = r.createElement("img");
552
+ return n.className = B("image", e), n.src = t.imageData, new z().add("width", "100%").add("height", "100%").add("object-fit", "contain").add("display", "block").applyTo(n), n.alt = t.kind, n;
553
+ }
554
+ function ft(t, e, r, n) {
555
+ const o = n.createElement("div");
556
+ o.className = B("shape", r);
557
+ const s = t.style || {}, a = O(s), i = tt(s), d = `${G(a.widthPt * e / 72, 2)}px solid ${a.color}`, c = new z();
558
+ return t.grid || t.kind === "rect" ? (i.top && c.add("border-top", d), i.right && c.add("border-right", d), i.bottom && c.add("border-bottom", d), i.left && c.add("border-left", d)) : t.kind === "ellipse" ? (i.inner && c.add("border", d).add("border-radius", "50%"), s.backgroundColor && c.add("background-color", s.backgroundColor)) : t.kind === "line" && c.add("height", "0").add("border-top", d), c.add("box-sizing", "border-box").add("width", "100%").add("height", "100%"), c.applyTo(o), o;
559
+ }
560
+ function St(t, e, r, n) {
561
+ const o = n.createElement("div");
562
+ o.className = `${B("comp", r)} mr-kind-${t.kind}`;
563
+ const s = new z().add("position", "absolute").mm("left", t.leftMm, e).mm("top", t.topMm, e).mm("width", t.widthMm, e).mm("height", t.heightMm, e).add("box-sizing", "border-box");
564
+ if (wt(s, t, e), s.applyTo(o), Et(t))
565
+ return o.appendChild(qt(t, r, n)), o;
566
+ if (t.kind === "text")
567
+ return o.appendChild(Jt(t, e, r, n)), o;
568
+ if (t.grid) {
569
+ const i = ft(t, e, r, n);
570
+ return i.appendChild(Yt(t.grid, t, e, r, n)), o.appendChild(i), o;
571
+ }
572
+ if (t.kind === "line" || t.kind === "rect" || t.kind === "ellipse" || t.kind === "chart")
573
+ return o.appendChild(ft(t, e, r, n)), o;
574
+ const a = n.createElement("div");
575
+ return a.className = B("unknown", r), a.textContent = t.fallbackText ?? "", o.appendChild(a), o;
576
+ }
577
+ function Ut(t, e, r, n) {
578
+ const o = n.createElement("div");
579
+ o.className = B("page", r), new z().add("position", "relative").mm("width", t.pageWidthMm, e).mm("height", t.pageHeightMm, e).add("background-color", "#fff").add("overflow", "hidden").add("box-sizing", "border-box").applyTo(o);
580
+ for (const s of t.components)
581
+ o.appendChild(St(s, e, r, n));
582
+ return o;
583
+ }
584
+ function ce(t, e, r = {}) {
585
+ const n = r.dpi ?? 96, o = e.createElement("div");
586
+ return o.className = B("root", r), o.dataset.schemaVersion = t.schemaVersion, t.pages.forEach((s) => {
587
+ o.appendChild(Ut(s, n, r, e));
588
+ }), o;
589
+ }
590
+ function Kt(t) {
591
+ const { pageHeightsPx: e, viewportHeightPx: r, scrollTopPx: n, overscan: o = 1, gapPx: s = 0 } = t, a = e.length;
398
592
  if (a === 0)
399
593
  return { start: 0, end: -1, padTopPx: 0, padBottomPx: 0 };
400
- const o = Math.max(0, s), l = new Array(a + 1);
401
- l[0] = 0;
402
- for (let w = 0; w < a; w++)
403
- l[w + 1] = l[w] + Math.max(0, n[w] ?? 0) + o;
404
- const d = l[a], h = Math.max(0, t);
405
- let c = 0, m = 0, u = a - 1;
406
- for (; m <= u; ) {
407
- const w = m + u >> 1;
408
- l[w] <= h ? (c = w, m = w + 1) : u = w - 1;
409
- }
410
- const g = Math.max(0, Math.min(a - 1, c - r)), M = l[c] + Math.max(0, i);
411
- let p = a - 1;
412
- for (m = 0, u = a - 1; m <= u; ) {
413
- const w = m + u >> 1;
414
- l[w + 1] < M ? m = w + 1 : (p = w, u = w - 1);
415
- }
416
- const k = Math.min(a - 1, p + r), T = l[g], E = Math.max(0, d - l[k + 1]);
417
- return { start: g, end: k, padTopPx: T, padBottomPx: E };
418
- }
419
- const U = 96 / 25.4;
420
- function ie(e, n = 96) {
421
- const i = n / 96 * U;
594
+ const i = Math.max(0, s), d = new Array(a + 1);
595
+ d[0] = 0;
596
+ for (let S = 0; S < a; S++)
597
+ d[S + 1] = d[S] + Math.max(0, e[S] ?? 0) + i;
598
+ const c = d[a], h = Math.max(0, n);
599
+ let m = 0, l = 0, f = a - 1;
600
+ for (; l <= f; ) {
601
+ const S = l + f >> 1;
602
+ d[S] <= h ? (m = S, l = S + 1) : f = S - 1;
603
+ }
604
+ const g = Math.max(0, Math.min(a - 1, m - o)), w = d[m] + Math.max(0, r);
605
+ let E = a - 1;
606
+ for (l = 0, f = a - 1; l <= f; ) {
607
+ const S = l + f >> 1;
608
+ d[S + 1] < w ? l = S + 1 : (E = S, f = S - 1);
609
+ }
610
+ const x = Math.min(a - 1, E + o), b = d[g], C = Math.max(0, c - d[x + 1]);
611
+ return { start: g, end: x, padTopPx: b, padBottomPx: C };
612
+ }
613
+ const it = 96 / 25.4;
614
+ function Tt(t, e = 96) {
615
+ const r = e / 96 * it;
422
616
  return {
423
- widthPx: Math.max(1, Math.round(e.pageWidthMm * i)),
424
- heightPx: Math.max(1, Math.round(e.pageHeightMm * i))
617
+ widthPx: Math.max(1, Math.round(t.pageWidthMm * r)),
618
+ heightPx: Math.max(1, Math.round(t.pageHeightMm * r))
425
619
  };
426
620
  }
427
- function Ae(e, n, i) {
428
- const t = document.createElement("canvas"), { widthPx: r, heightPx: s } = ie(e, i);
429
- t.width = Math.round(r * n), t.height = Math.round(s * n), t.style.width = `${r}px`, t.style.height = `${s}px`;
430
- const a = t.getContext("2d");
621
+ function Xt(t, e, r) {
622
+ const n = document.createElement("canvas"), { widthPx: o, heightPx: s } = Tt(t, r);
623
+ n.width = Math.round(o * e), n.height = Math.round(s * e), n.style.width = `${o}px`, n.style.height = `${s}px`;
624
+ const a = n.getContext("2d");
431
625
  if (!a)
432
626
  throw new Error("当前环境不支持 Canvas 2D(测试需真浏览器,见 e2e/canvas.spec.ts)");
433
- return a.scale(n, n), a.fillStyle = "#ffffff", a.fillRect(0, 0, r, s), { canvas: t, ctx: a };
434
- }
435
- function De(e, n = 96) {
436
- return W(e, n).fontSizePx;
437
- }
438
- function re(e, n, i, t, r, s, a, o = "top") {
439
- e.font = `${n.bold ? "bold " : ""}${n.fontSizePx}px ${a}`, e.fillStyle = n.color, e.textBaseline = "alphabetic";
440
- const l = n.fontSizePx * n.lineHeight, d = n.text === "" ? [""] : n.text.split(`
441
- `), h = d.length * l;
442
- let c = t;
443
- o === "middle" ? c = t + (s - h) / 2 : o === "bottom" && (c = t + s - h), d.forEach((m, u) => {
444
- e.textAlign = n.align === "center" ? "center" : n.align === "right" ? "right" : "left";
445
- const g = n.align === "center" ? i + r / 2 : n.align === "right" ? i + r : i;
446
- e.fillText(m, g, c + u * l + n.fontSizePx * 0.8, r);
447
- }), e.textAlign = "left";
448
- }
449
- function Ee(e, n, i, t, r, s, a, o, l, d, h) {
450
- const c = ce(n, s / o, a / o), m = V(i.style), u = F(i.style);
451
- for (const g of c.cells) {
452
- const M = g.cell.style?.backgroundColor;
453
- M && (e.fillStyle = M, e.fillRect(
454
- t + g.xMm * o,
455
- r + g.yMm * o,
456
- g.widthMm * o,
457
- g.heightMm * o
627
+ return a.scale(e, e), a.fillStyle = "#ffffff", a.fillRect(0, 0, o, s), { canvas: n, ctx: a };
628
+ }
629
+ function he(t, e = 96) {
630
+ return V(t, e).fontSizePx;
631
+ }
632
+ function xt(t, e, r, n, o, s, a, i = "top") {
633
+ t.font = `${e.bold ? "bold " : ""}${e.fontSizePx}px ${a}`, t.fillStyle = e.color, t.textBaseline = "alphabetic";
634
+ const d = e.fontSizePx * e.lineHeight, c = e.text === "" ? [""] : e.text.split(`
635
+ `), h = c.length * d;
636
+ let m = n;
637
+ i === "middle" ? m = n + (s - h) / 2 : i === "bottom" && (m = n + s - h), c.forEach((l, f) => {
638
+ t.textAlign = e.align === "center" ? "center" : e.align === "right" ? "right" : "left";
639
+ const g = e.align === "center" ? r + o / 2 : e.align === "right" ? r + o : r;
640
+ t.fillText(l, g, m + f * d + e.fontSizePx * 0.8, o);
641
+ }), t.textAlign = "left";
642
+ }
643
+ function Zt(t, e, r, n, o, s, a, i, d, c, h) {
644
+ const m = Rt(e, s / i, a / i), l = tt(r.style), f = O(r.style);
645
+ for (const g of m.cells) {
646
+ const w = g.cell.style?.backgroundColor;
647
+ w && (t.fillStyle = w, t.fillRect(
648
+ n + g.xMm * i,
649
+ o + g.yMm * i,
650
+ g.widthMm * i,
651
+ g.heightMm * i
458
652
  ));
459
653
  }
460
- if (m.inner) {
461
- e.strokeStyle = u.color, e.lineWidth = O(u.widthPt, l);
462
- for (const g of c.edges)
463
- e.beginPath(), g.kind === "v" ? (e.moveTo(t + g.pos * o, r + g.from * o), e.lineTo(t + g.pos * o, r + g.to * o)) : (e.moveTo(t + g.from * o, r + g.pos * o), e.lineTo(t + g.to * o, r + g.pos * o)), e.stroke();
464
- e.beginPath(), m.top && (e.moveTo(t, r), e.lineTo(t + s, r)), m.right && (e.moveTo(t + s, r), e.lineTo(t + s, r + a)), m.bottom && (e.moveTo(t + s, r + a), e.lineTo(t, r + a)), m.left && (e.moveTo(t, r + a), e.lineTo(t, r)), e.stroke();
465
- }
466
- for (const g of c.cells) {
467
- const M = typeof g.cell.text == "string" ? g.cell.text : "";
468
- if (!M) continue;
469
- const p = g.cell.style, k = p?.fontSize ?? j, T = G(
470
- M,
654
+ if (l.inner) {
655
+ t.strokeStyle = f.color, t.lineWidth = K(f.widthPt, d);
656
+ for (const g of m.edges)
657
+ t.beginPath(), g.kind === "v" ? (t.moveTo(n + g.pos * i, o + g.from * i), t.lineTo(n + g.pos * i, o + g.to * i)) : (t.moveTo(n + g.from * i, o + g.pos * i), t.lineTo(n + g.to * i, o + g.pos * i)), t.stroke();
658
+ t.beginPath(), l.top && (t.moveTo(n, o), t.lineTo(n + s, o)), l.right && (t.moveTo(n + s, o), t.lineTo(n + s, o + a)), l.bottom && (t.moveTo(n + s, o + a), t.lineTo(n, o + a)), l.left && (t.moveTo(n, o + a), t.lineTo(n, o)), t.stroke();
659
+ }
660
+ for (const g of m.cells) {
661
+ const w = typeof g.cell.text == "string" ? g.cell.text : "";
662
+ if (!w) continue;
663
+ const E = g.cell.style, x = E?.fontSize ?? X, b = Z(
664
+ w,
471
665
  g.widthMm - 1,
472
- { fontSizePt: k },
666
+ { fontSizePt: x },
473
667
  h
474
668
  ).join(`
475
669
  `);
476
- re(
477
- e,
670
+ xt(
671
+ t,
478
672
  {
479
- text: T,
480
- fontSizePx: W(p, l).fontSizePx,
481
- bold: p?.bold ?? !1,
482
- color: p?.color ?? Q(i.style, me),
483
- align: p?.align ?? "left",
484
- lineHeight: q
673
+ text: b,
674
+ fontSizePx: V(E, d).fontSizePx,
675
+ bold: E?.bold ?? !1,
676
+ color: E?.color ?? pt(r.style, Nt),
677
+ align: E?.align ?? "left",
678
+ lineHeight: Q
485
679
  },
486
- t + (g.xMm + 0.5) * o,
487
- r + g.yMm * o,
488
- Math.max(0, (g.widthMm - 1) * o),
489
- g.heightMm * o,
490
- d,
491
- p?.verticalAlign ?? "middle"
680
+ n + (g.xMm + 0.5) * i,
681
+ o + g.yMm * i,
682
+ Math.max(0, (g.widthMm - 1) * i),
683
+ g.heightMm * i,
684
+ c,
685
+ E?.verticalAlign ?? "middle"
492
686
  );
493
687
  }
494
688
  }
495
- function oe(e, n, i, t, r, s) {
496
- const a = n.leftMm * i, o = n.topMm * i, l = n.widthMm * i, d = n.heightMm * i, h = n.style ?? {};
497
- if (n.grid) {
498
- Ee(e, n.grid, n, a, o, l, d, i, t, r, s);
689
+ function kt(t, e, r, n, o, s) {
690
+ const a = e.leftMm * r, i = e.topMm * r, d = e.widthMm * r, c = e.heightMm * r, h = e.style ?? {};
691
+ if (e.grid) {
692
+ Zt(t, e.grid, e, a, i, d, c, r, n, o, s);
499
693
  return;
500
694
  }
501
- switch (n.kind) {
695
+ switch (e.kind) {
502
696
  case "text": {
503
- const c = h.fontSize ?? j, m = Z(n) ? n.richParagraphs.map((u) => (u.segments ?? []).map((g) => g.text ?? g.field ?? "").join("")).join(`
504
- `) : Array.isArray(n.lines) && n.lines.length > 0 ? n.lines.join(`
505
- `) : G(n.text ?? "", n.widthMm, { fontSizePt: c }, s).join(`
697
+ const m = h.fontSize ?? X, l = ut(e) ? e.richParagraphs.map((f) => (f.segments ?? []).map((g) => g.text ?? g.field ?? "").join("")).join(`
698
+ `) : Array.isArray(e.lines) && e.lines.length > 0 ? e.lines.join(`
699
+ `) : Z(e.text ?? "", e.widthMm, { fontSizePt: m }, s).join(`
506
700
  `);
507
- re(
508
- e,
701
+ xt(
702
+ t,
509
703
  {
510
- text: m,
511
- fontSizePx: W(h, t).fontSizePx,
704
+ text: l,
705
+ fontSizePx: V(h, n).fontSizePx,
512
706
  bold: h.bold ?? !1,
513
- color: Q(h),
707
+ color: pt(h),
514
708
  align: h.align ?? "left",
515
- lineHeight: he(h)
709
+ lineHeight: Ht(h)
516
710
  },
517
711
  a,
518
- o,
519
- l,
712
+ i,
520
713
  d,
521
- r,
714
+ c,
715
+ o,
522
716
  h.verticalAlign
523
717
  );
524
718
  break;
525
719
  }
526
720
  case "rect": {
527
- const c = F(h), m = V(h);
528
- h.backgroundColor && (e.fillStyle = h.backgroundColor, e.fillRect(a, o, l, d)), m.inner && (e.strokeStyle = c.color, e.lineWidth = O(c.widthPt, t), e.beginPath(), m.top && (e.moveTo(a, o), e.lineTo(a + l, o)), m.right && (e.moveTo(a + l, o), e.lineTo(a + l, o + d)), m.bottom && (e.moveTo(a + l, o + d), e.lineTo(a, o + d)), m.left && (e.moveTo(a, o + d), e.lineTo(a, o)), e.stroke());
721
+ const m = O(h), l = tt(h);
722
+ h.backgroundColor && (t.fillStyle = h.backgroundColor, t.fillRect(a, i, d, c)), l.inner && (t.strokeStyle = m.color, t.lineWidth = K(m.widthPt, n), t.beginPath(), l.top && (t.moveTo(a, i), t.lineTo(a + d, i)), l.right && (t.moveTo(a + d, i), t.lineTo(a + d, i + c)), l.bottom && (t.moveTo(a + d, i + c), t.lineTo(a, i + c)), l.left && (t.moveTo(a, i + c), t.lineTo(a, i)), t.stroke());
529
723
  break;
530
724
  }
531
725
  case "line": {
532
- const c = F({ ...h, borderColor: h.lineColor ?? h.borderColor });
533
- e.strokeStyle = c.color, e.lineWidth = O(c.widthPt, t), e.beginPath(), e.moveTo(a, o + d / 2), e.lineTo(a + l, o + d / 2), e.stroke();
726
+ const m = O({ ...h, borderColor: h.lineColor ?? h.borderColor });
727
+ t.strokeStyle = m.color, t.lineWidth = K(m.widthPt, n), t.beginPath(), t.moveTo(a, i + c / 2), t.lineTo(a + d, i + c / 2), t.stroke();
534
728
  break;
535
729
  }
536
730
  case "ellipse": {
537
- const c = F(h);
538
- e.strokeStyle = c.color, e.lineWidth = O(c.widthPt, t), h.backgroundColor && (e.fillStyle = h.backgroundColor, e.beginPath(), e.ellipse(a + l / 2, o + d / 2, l / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(a + l / 2, o + d / 2, l / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
731
+ const m = O(h);
732
+ t.strokeStyle = m.color, t.lineWidth = K(m.widthPt, n), h.backgroundColor && (t.fillStyle = h.backgroundColor, t.beginPath(), t.ellipse(a + d / 2, i + c / 2, d / 2, c / 2, 0, 0, Math.PI * 2), t.fill()), t.beginPath(), t.ellipse(a + d / 2, i + c / 2, d / 2, c / 2, 0, 0, Math.PI * 2), t.stroke();
539
733
  break;
540
734
  }
541
735
  }
542
736
  }
543
- function Oe(e, n = {}) {
737
+ function me(t, e = {}) {
544
738
  if (typeof document > "u")
545
739
  throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");
546
- const i = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), t = n.dpi ?? 96, r = t / 96 * U, s = n.fontFamily ?? '"Microsoft YaHei", sans-serif', a = n.measurer ?? J, o = Math.max(0, n.start ?? 0), l = Math.min(e.pages.length - 1, n.end ?? e.pages.length - 1), d = [];
547
- for (let h = o; h <= l; h++) {
548
- const c = e.pages[h], { canvas: m, ctx: u } = Ae(c, i, t);
549
- for (const g of c.components)
550
- oe(u, g, r, t, s, a);
551
- d.push(m);
552
- }
553
- return { canvases: d };
554
- }
555
- function je(e, n = {}) {
556
- const i = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), t = n.dpi ?? 96, r = t / 96 * U, s = n.fontFamily ?? '"Microsoft YaHei", sans-serif', a = n.measurer ?? J, o = n.overscan ?? 1, l = n.gapPx ?? 18, d = n.pagesPerFrame ?? 1, h = e.pages.map((f) => f.pageHeightMm * r), c = Math.max(1, ...e.pages.map((f) => f.pageWidthMm * r)), m = { start: 0, end: -1 };
557
- let u = null, g = null, M = null, p = null, k = [], T = 0, E = [];
558
- function w() {
559
- const f = u;
560
- f.innerHTML = "", g = document.createElement("div"), g.style.cssText = `width:${c}px;margin:0 auto;`, M = document.createElement("div"), p = document.createElement("div"), g.appendChild(M), k = [];
561
- const b = Math.min(e.pages.length, 3 + o * 2);
562
- for (let P = 0; P < b; P++) {
740
+ const r = e.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), n = e.dpi ?? 96, o = n / 96 * it, s = e.fontFamily ?? '"Microsoft YaHei", sans-serif', a = e.measurer ?? ot, i = Math.max(0, e.start ?? 0), d = Math.min(t.pages.length - 1, e.end ?? t.pages.length - 1), c = [];
741
+ for (let h = i; h <= d; h++) {
742
+ const m = t.pages[h], { canvas: l, ctx: f } = Xt(m, r, n);
743
+ for (const g of m.components)
744
+ kt(f, g, o, n, s, a);
745
+ c.push(l);
746
+ }
747
+ return { canvases: c };
748
+ }
749
+ function ge(t, e = {}) {
750
+ const r = e.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), n = e.dpi ?? 96, o = n / 96 * it, s = e.fontFamily ?? '"Microsoft YaHei", sans-serif', a = e.measurer ?? ot, i = e.overscan ?? 1, d = e.gapPx ?? 18, c = e.pagesPerFrame ?? 1, h = t.pages.map((u) => u.pageHeightMm * o), m = Math.max(1, ...t.pages.map((u) => u.pageWidthMm * o)), l = { start: 0, end: -1 };
751
+ let f = null, g = null, w = null, E = null, x = [], b = 0, C = [];
752
+ function S() {
753
+ const u = f;
754
+ u.innerHTML = "", g = document.createElement("div"), g.style.cssText = `width:${m}px;margin:0 auto;`, w = document.createElement("div"), E = document.createElement("div"), g.appendChild(w), x = [];
755
+ const H = Math.min(t.pages.length, 3 + i * 2);
756
+ for (let L = 0; L < H; L++) {
563
757
  const y = document.createElement("div");
564
- y.style.cssText = `margin:0 auto ${l}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, g.appendChild(y), k.push(y);
758
+ y.style.cssText = `margin:0 auto ${d}px;box-shadow:0 2px 8px rgba(0,0,0,.35);background:#fff;`, g.appendChild(y), x.push(y);
565
759
  }
566
- g.appendChild(p), f.appendChild(g);
567
- }
568
- function I(f, b) {
569
- const P = e.pages[b], { widthPx: y, heightPx: x } = ie(P, t);
570
- let A = f.firstElementChild;
571
- (!A || A.tagName !== "CANVAS") && (A = document.createElement("canvas"), f.innerHTML = "", f.appendChild(A)), A.width = Math.round(y * i), A.height = Math.round(x * i), A.style.width = `${y}px`, A.style.height = `${x}px`;
572
- const z = A.getContext("2d");
573
- if (z) {
574
- z.setTransform(1, 0, 0, 1, 0, 0), z.scale(i, i), z.fillStyle = "#ffffff", z.fillRect(0, 0, y, x);
575
- for (const ae of P.components)
576
- oe(z, ae, r, t, s, a);
577
- A.dataset.canvasPage = String(b), f.style.height = `${x}px`, f.style.width = `${y}px`;
760
+ g.appendChild(E), u.appendChild(g);
761
+ }
762
+ function J(u, H) {
763
+ const L = t.pages[H], { widthPx: y, heightPx: N } = Tt(L, n);
764
+ let P = u.firstElementChild;
765
+ (!P || P.tagName !== "CANVAS") && (P = document.createElement("canvas"), u.innerHTML = "", u.appendChild(P)), P.width = Math.round(y * r), P.height = Math.round(N * r), P.style.width = `${y}px`, P.style.height = `${N}px`;
766
+ const _ = P.getContext("2d");
767
+ if (_) {
768
+ _.setTransform(1, 0, 0, 1, 0, 0), _.scale(r, r), _.fillStyle = "#ffffff", _.fillRect(0, 0, y, N);
769
+ for (const U of L.components)
770
+ kt(_, U, o, n, s, a);
771
+ P.dataset.canvasPage = String(H), u.style.height = `${N}px`, u.style.width = `${y}px`;
578
772
  }
579
773
  }
580
- function R(f) {
581
- m.start = f.start, m.end = f.end, M.style.height = `${f.start * l + h.slice(0, f.start).reduce((y, x) => y + x, 0)}px`;
582
- const b = e.pages.length - 1 - f.end;
583
- p.style.height = `${b * l + h.slice(f.end + 1).reduce((y, x) => y + x, 0)}px`;
584
- const P = f.end - f.start + 1;
585
- k.forEach((y, x) => {
586
- if (x < P) {
774
+ function q(u) {
775
+ l.start = u.start, l.end = u.end, w.style.height = `${u.start * d + h.slice(0, u.start).reduce((y, N) => y + N, 0)}px`;
776
+ const H = t.pages.length - 1 - u.end;
777
+ E.style.height = `${H * d + h.slice(u.end + 1).reduce((y, N) => y + N, 0)}px`;
778
+ const L = u.end - u.start + 1;
779
+ x.forEach((y, N) => {
780
+ if (N < L) {
587
781
  y.style.display = "";
588
- const A = f.start + x;
589
- y.style.height = `${h[A] ?? 0}px`;
782
+ const P = u.start + N;
783
+ y.style.height = `${h[P] ?? 0}px`;
590
784
  } else
591
785
  y.style.display = "none";
592
- }), E = [];
593
- for (let y = f.start; y <= f.end; y++) {
594
- const x = k[y - f.start];
595
- if (!x) continue;
596
- x.firstElementChild?.dataset?.canvasPage !== String(y) && E.push(y);
786
+ }), C = [];
787
+ for (let y = u.start; y <= u.end; y++) {
788
+ const N = x[y - u.start];
789
+ if (!N) continue;
790
+ N.firstElementChild?.dataset?.canvasPage !== String(y) && C.push(y);
597
791
  }
598
- D();
599
- }
600
- function D() {
601
- T || E.length === 0 || (T = requestAnimationFrame(() => {
602
- T = 0;
603
- let f = Math.max(1, d);
604
- for (; E.length > 0 && f-- > 0; ) {
605
- const b = E.shift(), P = k[b - m.start];
606
- P && I(P, b);
792
+ k();
793
+ }
794
+ function k() {
795
+ b || C.length === 0 || (b = requestAnimationFrame(() => {
796
+ b = 0;
797
+ let u = Math.max(1, c);
798
+ for (; C.length > 0 && u-- > 0; ) {
799
+ const H = C.shift(), L = x[H - l.start];
800
+ L && J(L, H);
607
801
  }
608
- E.length > 0 && D();
802
+ C.length > 0 && k();
609
803
  }));
610
804
  }
611
805
  function $() {
612
- T || (T = requestAnimationFrame(() => {
613
- T = 0;
614
- const f = u, b = Pe({
806
+ b || (b = requestAnimationFrame(() => {
807
+ b = 0;
808
+ const u = f, H = Kt({
615
809
  pageHeightsPx: h,
616
- viewportHeightPx: f.clientHeight,
617
- scrollTopPx: f.scrollTop,
618
- overscan: o,
619
- gapPx: l
810
+ viewportHeightPx: u.clientHeight,
811
+ scrollTopPx: u.scrollTop,
812
+ overscan: i,
813
+ gapPx: d
620
814
  });
621
- b.start !== m.start || b.end !== m.end ? R(b) : D();
815
+ H.start !== l.start || H.end !== l.end ? q(H) : k();
622
816
  }));
623
817
  }
624
- let B = null;
818
+ let j = null;
625
819
  return {
626
- attach(f) {
820
+ attach(u) {
627
821
  if (typeof document > "u")
628
822
  throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");
629
- u = f, w(), f.addEventListener("scroll", $, { passive: !0 }), typeof ResizeObserver < "u" && (B = new ResizeObserver(() => $()), B.observe(f)), $();
823
+ f = u, S(), u.addEventListener("scroll", $, { passive: !0 }), typeof ResizeObserver < "u" && (j = new ResizeObserver(() => $()), j.observe(u)), $();
630
824
  },
631
825
  destroy() {
632
- T && cancelAnimationFrame(T), T = 0, B?.disconnect(), B = null, u?.removeEventListener("scroll", $), E = [], g?.remove(), u = null;
826
+ b && cancelAnimationFrame(b), b = 0, j?.disconnect(), j = null, f?.removeEventListener("scroll", $), C = [], g?.remove(), f = null;
633
827
  },
634
828
  window() {
635
- return { ...m };
829
+ return { ...l };
636
830
  }
637
831
  };
638
832
  }
639
- function S(e, n) {
640
- return typeof e == "number" && Number.isFinite(e) ? e : n;
833
+ function A(t, e) {
834
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
641
835
  }
642
- function v(e, n = "") {
643
- return typeof e == "string" ? e : n;
836
+ function R(t, e = "") {
837
+ return typeof t == "string" ? t : e;
644
838
  }
645
- function N(e) {
646
- return typeof e == "object" && e !== null && !Array.isArray(e);
839
+ function W(t) {
840
+ return typeof t == "object" && t !== null && !Array.isArray(t);
647
841
  }
648
- function $e(e) {
649
- return e === "Center" ? "center" : e === "Right" ? "right" : "left";
842
+ function Qt(t) {
843
+ return t === "Center" ? "center" : t === "Right" ? "right" : "left";
650
844
  }
651
- function He(e) {
652
- return e === "Center" ? "middle" : e === "Bottom" ? "bottom" : "top";
845
+ function te(t) {
846
+ return t === "Center" ? "middle" : t === "Bottom" ? "bottom" : "top";
653
847
  }
654
- function Re(e) {
655
- const n = parseFloat(v(e.FontSize, "10.5"));
848
+ function ee(t) {
849
+ const e = parseFloat(R(t.FontSize, "10.5"));
656
850
  return {
657
- fontSize: Number.isFinite(n) ? n : 10.5,
658
- fontFamily: v(e.FontFamily, "黑体") || void 0,
659
- bold: v(e.FontWeight) === "bold" || void 0,
660
- italic: v(e.FontStyle) === "italic" || void 0,
661
- underline: e.Underline === !0 || void 0,
662
- color: v(e.FontColor) || void 0,
663
- backgroundColor: v(e.BackgroundColor) || void 0,
664
- align: $e(v(e.HorAlignment, "Left")),
665
- verticalAlign: He(v(e.VertAlignment, "Top")),
851
+ fontSize: Number.isFinite(e) ? e : 10.5,
852
+ fontFamily: R(t.FontFamily, "黑体") || void 0,
853
+ bold: R(t.FontWeight) === "bold" || void 0,
854
+ italic: R(t.FontStyle) === "italic" || void 0,
855
+ underline: t.Underline === !0 || void 0,
856
+ color: R(t.FontColor) || void 0,
857
+ backgroundColor: R(t.BackgroundColor) || void 0,
858
+ align: Qt(R(t.HorAlignment, "Left")),
859
+ verticalAlign: te(R(t.VertAlignment, "Top")),
666
860
  lineHeight: (() => {
667
- const i = parseFloat(v(e.RowSpace, "1"));
668
- return Number.isFinite(i) && i !== 1 ? i : void 0;
861
+ const r = parseFloat(R(t.RowSpace, "1"));
862
+ return Number.isFinite(r) && r !== 1 ? r : void 0;
669
863
  })(),
670
- borderColor: v(e.BorderColor) || void 0,
671
- borderTop: e.BorderTop !== !1,
672
- borderRight: e.BorderRight !== !1,
673
- borderBottom: e.BorderBottom !== !1,
674
- borderLeft: e.BorderLeft !== !1
864
+ borderColor: R(t.BorderColor) || void 0,
865
+ borderTop: t.BorderTop !== !1,
866
+ borderRight: t.BorderRight !== !1,
867
+ borderBottom: t.BorderBottom !== !1,
868
+ borderLeft: t.BorderLeft !== !1
675
869
  };
676
870
  }
677
- function Be(e, n) {
678
- const i = v(e.uitype), t = {
871
+ function ne(t, e) {
872
+ const r = R(t.uitype), n = {
679
873
  kind: "text",
680
- leftMm: S(e.left, 0),
681
- topMm: S(e.top, 0),
682
- widthMm: S(e.width, 40),
683
- heightMm: S(e.height, 8),
684
- nid: v(e.nid) || void 0,
685
- style: Re(e)
874
+ leftMm: A(t.left, 0),
875
+ topMm: A(t.top, 0),
876
+ widthMm: A(t.width, 40),
877
+ heightMm: A(t.height, 8),
878
+ nid: R(t.nid) || void 0,
879
+ style: ee(t)
686
880
  };
687
- switch (i) {
881
+ switch (r) {
688
882
  case "text": {
689
- t.kind = "text";
690
- const r = e.Text ?? e.text ?? e.Value;
691
- t.text = r == null ? "" : String(r);
692
- const s = e.Lines ?? e.lines;
693
- return Array.isArray(s) && (t.lines = s.map((a) => String(a))), t;
883
+ n.kind = "text";
884
+ const o = t.Text ?? t.text ?? t.Value;
885
+ n.text = o == null ? "" : String(o);
886
+ const s = t.Lines ?? t.lines;
887
+ return Array.isArray(s) && (n.lines = s.map((a) => String(a))), n;
694
888
  }
695
889
  case "richtext":
696
- return t.kind = "text", t.text = v(e.Text), n.push(`富文本 ${t.nid ?? ""} 导入为纯文本(版式细节可能损失)`), t;
890
+ return n.kind = "text", n.text = R(t.Text), e.push(`富文本 ${n.nid ?? ""} 导入为纯文本(版式细节可能损失)`), n;
697
891
  case "image":
698
892
  case "barcode":
699
893
  case "qrcode":
700
894
  case "chart":
701
- return t.kind = i === "image" ? "image" : i, t.fallbackText = `[${i}]`, n.push(`图片类组件 ${t.nid ?? ""} 需运行时数据(imageData),已导入为占位`), t;
895
+ return n.kind = r === "image" ? "image" : r, n.fallbackText = `[${r}]`, e.push(`图片类组件 ${n.nid ?? ""} 需运行时数据(imageData),已导入为占位`), n;
702
896
  case "table": {
703
- t.kind = "rect";
704
- const r = e.Cells ?? e.cells;
705
- if (Array.isArray(r)) {
897
+ n.kind = "rect";
898
+ const o = t.Cells ?? t.cells;
899
+ if (Array.isArray(o)) {
706
900
  const s = {
707
- cells: r.map(
708
- (a) => Array.isArray(a) ? a.map((o) => ({
709
- text: N(o) ? v(o.Text ?? o.text) : "",
710
- colSpan: N(o) ? S(o.ColSpan, 1) : 1
901
+ cells: o.map(
902
+ (a) => Array.isArray(a) ? a.map((i) => ({
903
+ text: W(i) ? R(i.Text ?? i.text) : "",
904
+ colSpan: W(i) ? A(i.ColSpan, 1) : 1
711
905
  })) : []
712
906
  )
713
907
  };
714
- t.grid = s;
908
+ n.grid = s;
715
909
  } else
716
- t.fallbackText = "[table]", n.push(`表格 ${t.nid ?? ""} 缺少 Cells,导入为空框`);
717
- return t;
910
+ n.fallbackText = "[table]", e.push(`表格 ${n.nid ?? ""} 缺少 Cells,导入为空框`);
911
+ return n;
718
912
  }
719
913
  case "subreport":
720
- return n.push(`子报表 ${t.nid ?? ""} 暂不支持导入,已跳过`), null;
914
+ return e.push(`子报表 ${n.nid ?? ""} 暂不支持导入,已跳过`), null;
721
915
  default:
722
- return v(e.ShapeType) === "hline" || i === "hline" || i === "vline" ? (t.kind = "line", t) : i === "rect" || i === "oval" || i === "shape" ? (t.kind = i === "oval" ? "ellipse" : "rect", t) : (n.push(`未知组件类型 ${i},已跳过`), null);
916
+ return R(t.ShapeType) === "hline" || r === "hline" || r === "vline" ? (n.kind = "line", n) : r === "rect" || r === "oval" || r === "shape" ? (n.kind = r === "oval" ? "ellipse" : "rect", n) : (e.push(`未知组件类型 ${r},已跳过`), null);
723
917
  }
724
918
  }
725
- function Ge(e) {
726
- const n = [];
727
- let i = null;
728
- if (typeof e == "string")
919
+ function fe(t) {
920
+ const e = [];
921
+ let r = null;
922
+ if (typeof t == "string")
729
923
  try {
730
- const d = JSON.parse(e);
731
- N(d) && (i = d);
924
+ const c = JSON.parse(t);
925
+ W(c) && (r = c);
732
926
  } catch {
733
927
  return {
734
928
  template: { pages: [] },
735
929
  warnings: ["content 不是合法 JSON"]
736
930
  };
737
931
  }
738
- else N(e) && (i = e);
739
- if (!i)
932
+ else W(t) && (r = t);
933
+ if (!r)
740
934
  return { template: { pages: [] }, warnings: ["content 为空"] };
741
- const t = N(i.GlobalConfig) ? i.GlobalConfig : {}, r = S(t.paperWidthMm, 210), s = S(t.paperHeightMm, 297), a = {
742
- top: S(t.marginTop, 10),
743
- bottom: S(t.marginBottom, 10),
744
- left: S(t.marginLeft, 10),
745
- right: S(t.marginRight, 10)
746
- }, o = Array.isArray(i.children) ? i.children.filter((d) => N(d) && v(d.uitype) === "page") : [];
747
- o.length === 0 && n.push("content 中没有 uitype=page 的页节点");
748
- const l = o.map((d) => {
749
- const h = d, c = Array.isArray(h.children) ? h.children : [], m = [];
750
- for (const u of c) {
751
- if (!N(u)) continue;
752
- const g = Be(u, n);
753
- g && m.push(g);
935
+ const n = W(r.GlobalConfig) ? r.GlobalConfig : {}, o = A(n.paperWidthMm, 210), s = A(n.paperHeightMm, 297), a = {
936
+ top: A(n.marginTop, 10),
937
+ bottom: A(n.marginBottom, 10),
938
+ left: A(n.marginLeft, 10),
939
+ right: A(n.marginRight, 10)
940
+ }, i = Array.isArray(r.children) ? r.children.filter((c) => W(c) && R(c.uitype) === "page") : [];
941
+ i.length === 0 && e.push("content 中没有 uitype=page 的页节点");
942
+ const d = i.map((c) => {
943
+ const h = c, m = Array.isArray(h.children) ? h.children : [], l = [];
944
+ for (const f of m) {
945
+ if (!W(f)) continue;
946
+ const g = ne(f, e);
947
+ g && l.push(g);
754
948
  }
755
949
  return {
756
- widthMm: S(h.width, r),
757
- heightMm: S(h.DesignHeight, s),
758
- marginTopMm: S(h.MarginTop, a.top),
759
- marginBottomMm: S(h.MarginBottom, a.bottom),
760
- marginLeftMm: S(h.MarginLeft, a.left),
761
- marginRightMm: S(h.MarginRight, a.right),
762
- components: m
950
+ widthMm: A(h.width, o),
951
+ heightMm: A(h.DesignHeight, s),
952
+ marginTopMm: A(h.MarginTop, a.top),
953
+ marginBottomMm: A(h.MarginBottom, a.bottom),
954
+ marginLeftMm: A(h.MarginLeft, a.left),
955
+ marginRightMm: A(h.MarginRight, a.right),
956
+ components: l
763
957
  };
764
958
  });
765
- return l.length === 0 && (n.push("转换结果为空页,已回退一张空白页"), l.push({
766
- widthMm: r,
959
+ return d.length === 0 && (e.push("转换结果为空页,已回退一张空白页"), d.push({
960
+ widthMm: o,
767
961
  heightMm: s,
768
962
  ...a,
769
963
  components: []
770
- })), { template: { pages: l }, warnings: n };
771
- }
772
- function Ne(e, n, i) {
773
- let t, r;
774
- if (typeof e == "string") {
775
- const s = K[e];
776
- if (!s) throw new Error(`未知纸张预设 "${e}"(可用:${Object.keys(K).join("/")})`);
777
- t = s.widthMm, r = s.heightMm;
778
- } else typeof e == "number" ? (t = e, r = n ?? 297) : (t = e.widthMm, r = e.heightMm);
779
- return i ? { widthMm: r, heightMm: t } : { widthMm: t, heightMm: r };
780
- }
781
- class Le {
964
+ })), { template: { pages: d }, warnings: e };
965
+ }
966
+ function re(t, e, r) {
967
+ let n, o;
968
+ if (typeof t == "string") {
969
+ const s = ht[t];
970
+ if (!s) throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(ht).join("/")})`);
971
+ n = s.widthMm, o = s.heightMm;
972
+ } else typeof t == "number" ? (n = t, o = e ?? 297) : (n = t.widthMm, o = t.heightMm);
973
+ return r ? { widthMm: o, heightMm: n } : { widthMm: n, heightMm: o };
974
+ }
975
+ class oe {
782
976
  constructor() {
783
977
  this.pages = [], this.pending = null;
784
978
  }
@@ -788,20 +982,20 @@ class Le {
788
982
  * - 数字:.page(210, 297)(第三参数兼容旧 margins 对象或新 options)
789
983
  * - 对象:.page({ widthMm: 210, heightMm: 297 })
790
984
  */
791
- page(n = "a4", i = {}, t) {
985
+ page(e = "a4", r = {}, n) {
792
986
  this.collect();
793
- const s = t != null && !("margins" in t) && !("landscape" in t) && ("marginTopMm" in t || "marginBottomMm" in t || "marginLeftMm" in t || "marginRightMm" in t) ? { margins: t } : t ?? {}, { widthMm: a, heightMm: o } = Ne(
794
- n,
795
- typeof i == "number" ? i : void 0,
987
+ const s = n != null && !("margins" in n) && !("landscape" in n) && ("marginTopMm" in n || "marginBottomMm" in n || "marginLeftMm" in n || "marginRightMm" in n) ? { margins: n } : n ?? {}, { widthMm: a, heightMm: i } = re(
988
+ e,
989
+ typeof r == "number" ? r : void 0,
796
990
  s.landscape
797
- ), l = s.margins ?? {};
798
- return this.pending = new ze(this, {
991
+ ), d = s.margins ?? {};
992
+ return this.pending = new ie(this, {
799
993
  widthMm: a,
800
- heightMm: o,
801
- marginTopMm: l.marginTopMm ?? 10,
802
- marginBottomMm: l.marginBottomMm ?? 10,
803
- marginLeftMm: l.marginLeftMm ?? 10,
804
- marginRightMm: l.marginRightMm ?? 10
994
+ heightMm: i,
995
+ marginTopMm: d.marginTopMm ?? 10,
996
+ marginBottomMm: d.marginBottomMm ?? 10,
997
+ marginLeftMm: d.marginLeftMm ?? 10,
998
+ marginRightMm: d.marginRightMm ?? 10
805
999
  }), this.pending;
806
1000
  }
807
1001
  collect() {
@@ -813,63 +1007,63 @@ class Le {
813
1007
  return { pages: this.pages };
814
1008
  }
815
1009
  }
816
- class ze {
817
- constructor(n, i) {
818
- this.parent = n, this.page = i, this.components = [];
1010
+ class ie {
1011
+ constructor(e, r) {
1012
+ this.parent = e, this.page = r, this.components = [];
819
1013
  }
820
- text(n, i = {}, t = {}) {
1014
+ text(e, r = {}, n = {}) {
821
1015
  return this.components.push({
822
1016
  kind: "text",
823
- leftMm: i.leftMm ?? 0,
824
- topMm: i.topMm ?? 0,
825
- widthMm: i.widthMm ?? 60,
826
- heightMm: i.heightMm ?? 8,
827
- text: n,
828
- style: t
1017
+ leftMm: r.leftMm ?? 0,
1018
+ topMm: r.topMm ?? 0,
1019
+ widthMm: r.widthMm ?? 60,
1020
+ heightMm: r.heightMm ?? 8,
1021
+ text: e,
1022
+ style: n
829
1023
  }), this;
830
1024
  }
831
- list(n, i, t, r = {}) {
1025
+ list(e, r, n, o = {}) {
832
1026
  return this.components.push({
833
1027
  kind: "list",
834
- leftMm: i.leftMm ?? 10,
835
- topMm: i.topMm ?? 30,
836
- widthMm: i.widthMm ?? 180,
837
- dataset: n,
838
- columns: t,
839
- ...r
1028
+ leftMm: r.leftMm ?? 10,
1029
+ topMm: r.topMm ?? 30,
1030
+ widthMm: r.widthMm ?? 180,
1031
+ dataset: e,
1032
+ columns: n,
1033
+ ...o
840
1034
  }), this;
841
1035
  }
842
- rect(n, i = {}) {
843
- return this.components.push({ kind: "rect", ...n, style: i }), this;
1036
+ rect(e, r = {}) {
1037
+ return this.components.push({ kind: "rect", ...e, style: r }), this;
844
1038
  }
845
- line(n, i, t, r = {}) {
1039
+ line(e, r, n, o = {}) {
846
1040
  return this.components.push({
847
1041
  kind: "line",
848
- leftMm: n,
849
- topMm: i,
850
- widthMm: t,
1042
+ leftMm: e,
1043
+ topMm: r,
1044
+ widthMm: n,
851
1045
  heightMm: 0.5,
852
- style: r
1046
+ style: o
853
1047
  }), this;
854
1048
  }
855
- barcode(n, i) {
1049
+ barcode(e, r) {
856
1050
  return this.components.push({
857
1051
  kind: "barcode",
858
- leftMm: i.leftMm ?? 0,
859
- topMm: i.topMm ?? 0,
860
- widthMm: i.widthMm ?? 40,
861
- heightMm: i.heightMm ?? 12,
862
- fallbackText: n
1052
+ leftMm: r.leftMm ?? 0,
1053
+ topMm: r.topMm ?? 0,
1054
+ widthMm: r.widthMm ?? 40,
1055
+ heightMm: r.heightMm ?? 12,
1056
+ fallbackText: e
863
1057
  }), this;
864
1058
  }
865
- qrcode(n, i, t, r) {
1059
+ qrcode(e, r, n, o) {
866
1060
  return this.components.push({
867
1061
  kind: "qrcode",
868
- leftMm: t,
869
- topMm: r,
870
- widthMm: i,
871
- heightMm: i,
872
- fallbackText: n
1062
+ leftMm: n,
1063
+ topMm: o,
1064
+ widthMm: r,
1065
+ heightMm: r,
1066
+ fallbackText: e
873
1067
  }), this;
874
1068
  }
875
1069
  buildPage() {
@@ -882,59 +1076,63 @@ class ze {
882
1076
  return this.done().build();
883
1077
  }
884
1078
  }
885
- function Ve() {
886
- return new Le();
1079
+ function ue() {
1080
+ return new oe();
887
1081
  }
888
1082
  export {
889
- Ue as CSS_DPI,
890
- Ke as DEFAULT_BORDER_PT,
891
- j as DEFAULT_FONT_PT,
892
- Ye as DEFAULT_STROKE_COLOR,
893
- me as DEFAULT_TEXT_COLOR,
894
- q as LINE_HEIGHT,
895
- Xe as MM_PER_INCH,
896
- K as PAPER_SIZES,
897
- ze as PageBuilder,
898
- se as RENDER_PLAN_SCHEMA_VERSION,
899
- Ze as SCHEMA_VERSION_JH4J,
900
- Qe as SCHEMA_VERSION_LOCAL,
901
- et as SCHEMA_VERSION_MACH,
902
- Le as TemplateBuilder,
903
- _e as assertRenderPlan,
904
- tt as charWidthEm,
905
- C as classOf,
906
- Pe as computePageWindow,
907
- nt as createCanvasMeasurer,
908
- je as createCanvasPager,
909
- it as createHeuristicMeasurer,
910
- Ve as createTemplate,
911
- J as heuristicMeasurer,
912
- Ge as importJh4jTemplateContent,
913
- le as isImageBackedComponent,
914
- Z as isRichText,
915
- ie as measurePageSizePx,
916
- rt as measureTextMm,
917
- de as mmToPx,
918
- ot as mmToPxFactor,
919
- We as paginateTemplate,
920
- De as planFontSizePx,
921
- O as ptToPx,
922
- at as pxToMm,
923
- ne as renderComponent,
924
- xe as renderPage,
925
- Ie as renderPlan,
926
- Oe as renderPlanToCanvas,
927
- V as resolveBoxBorders,
928
- W as resolveFontSize,
929
- ce as resolveGridLayout,
930
- he as resolveLineHeight,
931
- Ne as resolvePaper,
932
- F as resolveStroke,
933
- Q as resolveTextColor,
934
- _ as round,
935
- st as toRenderPlan,
936
- ee as validateComponent,
937
- ue as validatePage,
938
- pe as validateRenderPlan,
939
- G as wrapText
1083
+ be as CSS_DPI,
1084
+ ye as DEFAULT_BORDER_PT,
1085
+ X as DEFAULT_FONT_PT,
1086
+ we as DEFAULT_STROKE_COLOR,
1087
+ Nt as DEFAULT_TEXT_COLOR,
1088
+ Q as LINE_HEIGHT,
1089
+ Se as MM_PER_INCH,
1090
+ ht as PAPER_SIZES,
1091
+ ie as PageBuilder,
1092
+ At as RENDER_PLAN_SCHEMA_VERSION,
1093
+ Te as SCHEMA_VERSION_JH4J,
1094
+ xe as SCHEMA_VERSION_LOCAL,
1095
+ ke as SCHEMA_VERSION_MACH,
1096
+ oe as TemplateBuilder,
1097
+ le as assertRenderPlan,
1098
+ ve as charWidthEm,
1099
+ B as classOf,
1100
+ Kt as computePageWindow,
1101
+ Ce as createCanvasMeasurer,
1102
+ ge as createCanvasPager,
1103
+ Pe as createHeuristicMeasurer,
1104
+ ue as createTemplate,
1105
+ zt as evalStyleRule,
1106
+ Mt as formatValue,
1107
+ ot as heuristicMeasurer,
1108
+ fe as importJh4jTemplateContent,
1109
+ Et as isImageBackedComponent,
1110
+ ut as isRichText,
1111
+ Tt as measurePageSizePx,
1112
+ Ae as measureTextMm,
1113
+ $t as mmToPx,
1114
+ Ee as mmToPxFactor,
1115
+ de as paginateTemplate,
1116
+ Bt as parseDateLocal,
1117
+ he as planFontSizePx,
1118
+ K as ptToPx,
1119
+ $e as pxToMm,
1120
+ St as renderComponent,
1121
+ Ut as renderPage,
1122
+ ce as renderPlan,
1123
+ me as renderPlanToCanvas,
1124
+ tt as resolveBoxBorders,
1125
+ V as resolveFontSize,
1126
+ Rt as resolveGridLayout,
1127
+ Ht as resolveLineHeight,
1128
+ re as resolvePaper,
1129
+ O as resolveStroke,
1130
+ pt as resolveTextColor,
1131
+ G as round,
1132
+ rt as toNumber,
1133
+ He as toRenderPlan,
1134
+ bt as validateComponent,
1135
+ Wt as validatePage,
1136
+ It as validateRenderPlan,
1137
+ Z as wrapText
940
1138
  };