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