@agile-team/mach-report 2.11.2 → 2.12.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 (73) hide show
  1. package/README.md +14 -5
  2. package/THIRD_PARTY_NOTICES.md +270 -0
  3. package/dist/{ExcelBindingWizard-LWX6G1A2.js → ExcelBindingWizard-CeAf4QSE.js} +2 -2
  4. package/dist/{ExcelBindingWizard-a4kslPHF.cjs → ExcelBindingWizard-y0mT-AHR.cjs} +1 -1
  5. package/dist/{RuleEditor-C2QsOHOs.cjs → RuleEditor-ChRzNQuF.cjs} +1 -1
  6. package/dist/{RuleEditor-D9wQHrkf.js → RuleEditor-DzAmW5YH.js} +1 -1
  7. package/dist/analytics.d.cts +28 -0
  8. package/dist/analytics.d.ts +28 -0
  9. package/dist/assets-C2U-e-Sz.cjs +4 -0
  10. package/dist/assets-Q0wUwNrV.js +217 -0
  11. package/dist/code-options-BKXXY7NI.js +18 -0
  12. package/dist/code-options-BUTChiZZ.cjs +1 -0
  13. package/dist/codes.cjs +9 -0
  14. package/dist/codes.d.cts +223 -0
  15. package/dist/codes.d.ts +223 -0
  16. package/dist/codes.js +26917 -0
  17. package/dist/designer.cjs +2 -2
  18. package/dist/designer.d.cts +267 -0
  19. package/dist/designer.d.ts +267 -0
  20. package/dist/designer.js +2737 -1941
  21. package/dist/grid-strokes-Cr7DwUux.cjs +1 -0
  22. package/dist/grid-strokes-DyyG1q_o.js +53 -0
  23. package/dist/index.cjs +7 -7
  24. package/dist/index.d.cts +80 -1
  25. package/dist/index.d.ts +80 -1
  26. package/dist/index.js +404 -374
  27. package/dist/pdf.cjs +76 -59
  28. package/dist/pdf.d.cts +51 -0
  29. package/dist/pdf.d.ts +51 -0
  30. package/dist/pdf.js +32128 -32048
  31. package/dist/record-bindings-By_UKZ2g.cjs +1 -0
  32. package/dist/{list-cell-ClFra1zS.js → record-bindings-D-5jQlTj.js} +67 -44
  33. package/dist/{region-binding-workflow-DhQvu1co.cjs → region-binding-workflow-BzfbxRiR.cjs} +1 -1
  34. package/dist/{region-binding-workflow-CXDmt9Bs.js → region-binding-workflow-CcUq8W2Q.js} +1 -1
  35. package/dist/server/node.d.cts +52 -1
  36. package/dist/server/node.d.ts +52 -1
  37. package/dist/server-node.cjs +1 -1
  38. package/dist/server-node.js +239 -210
  39. package/dist/server.cjs +1 -1
  40. package/dist/server.d.cts +95 -3
  41. package/dist/server.d.ts +95 -3
  42. package/dist/server.js +456 -433
  43. package/dist/style.css +1 -1
  44. package/dist/{template-registry-WNXdkiET.js → template-registry-BjE1VS6g.js} +221 -157
  45. package/dist/template-registry-D3SjENi6.cjs +1 -0
  46. package/dist/template-review-BfCC8Ng9.cjs +2 -0
  47. package/dist/{template-review-BdcXSYbx.js → template-review-BzpcI-tR.js} +772 -666
  48. package/dist/validate-BJ5HIWY8.cjs +1 -0
  49. package/dist/validate-DbgEM1Hh.js +163 -0
  50. package/dist/vue/async.d.cts +121 -2
  51. package/dist/vue/async.d.ts +121 -2
  52. package/dist/vue/index.d.cts +114 -6
  53. package/dist/vue/index.d.ts +114 -6
  54. package/dist/{workbook-session-BKOTwcoq.js → workbook-session-BPb3TMnT.js} +1 -1
  55. package/dist/{workbook-session-CLYLhZWu.cjs → workbook-session-DNa2RHNG.cjs} +1 -1
  56. package/dist/worker.cjs +1 -1
  57. package/dist/worker.d.cts +52 -1
  58. package/dist/worker.d.ts +52 -1
  59. package/dist/worker.js +2 -2
  60. package/dist/xlsx.cjs +1 -1
  61. package/dist/xlsx.d.cts +40 -0
  62. package/dist/xlsx.d.ts +40 -0
  63. package/dist/xlsx.js +3 -3
  64. package/package.json +16 -3
  65. package/dist/assets-Bu6UohJx.cjs +0 -1
  66. package/dist/assets-DegqDNqY.js +0 -160
  67. package/dist/list-cell-BuYn4tGF.cjs +0 -1
  68. package/dist/template-registry-ukBGlm8N.cjs +0 -1
  69. package/dist/template-review-BXp2oyqg.cjs +0 -1
  70. package/dist/textwrap-CWHyzkBH.cjs +0 -4
  71. package/dist/textwrap-DE1kgcJB.js +0 -110
  72. package/dist/validate-7s0yn6ii.js +0 -148
  73. package/dist/validate-DsRiNw8h.cjs +0 -1
@@ -1,44 +1,44 @@
1
- import { v as I } from "./matrix-yZsGnldA.js";
2
- import { v as P, e as V } from "./computed-Bvk0W15F.js";
3
- import { R as C } from "./render-plan-Ck6koX9L.js";
4
- import { v as O, d as J } from "./validate-7s0yn6ii.js";
5
- import { v as D, e as H } from "./param-validation-BlHHXs6u.js";
6
- import { v as j, a as W } from "./tree-CqcQ99NM.js";
7
- function S(e) {
1
+ import { v as J } from "./matrix-yZsGnldA.js";
2
+ import { v as j, e as D } from "./computed-Bvk0W15F.js";
3
+ import { R as H } from "./render-plan-Ck6koX9L.js";
4
+ import { v as L, d as K } from "./validate-DbgEM1Hh.js";
5
+ import { v as U, e as W } from "./param-validation-BlHHXs6u.js";
6
+ import { v as G, a as z } from "./tree-CqcQ99NM.js";
7
+ function x(e) {
8
8
  return e.kind === "list" ? e.id : e.nid;
9
9
  }
10
- function K(e) {
10
+ function B(e) {
11
11
  return e.kind === "list" ? !1 : e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && /\{(?:page|totalPages)\}/.test(e.text);
12
12
  }
13
- function U(e, i) {
14
- const t = e.filter((n) => i.componentIds.includes(S(n) ?? ""));
13
+ function X(e, i) {
14
+ const t = e.filter((n) => i.componentIds.includes(x(n) ?? ""));
15
15
  if (t.filter((n) => n.kind === "list" && n.cardinality !== "record").length && t.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
16
16
  for (const n of t) {
17
17
  const a = n.kind === "list" ? n.topMm + (n.rowHeightMm ?? 0) : n.topMm + n.heightMm;
18
18
  if (n.topMm < i.topMm - 1e-3 || a > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
19
19
  }
20
20
  }
21
- function Ae(e, i) {
21
+ function Oe(e, i) {
22
22
  if (!i) return e.map((s) => ({ components: [s] }));
23
- const t = new Map(e.map((s) => [S(s), s]));
23
+ const t = new Map(e.map((s) => [x(s), s]));
24
24
  return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
25
25
  const a = t.get(n);
26
26
  if (!a) throw new Error(`流式区域引用不存在的组件:${n}`);
27
27
  return a;
28
28
  }) }));
29
29
  }
30
- function G(e, i) {
30
+ function Y(e, i) {
31
31
  if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
32
32
  const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
33
33
  for (const n of e) {
34
- if (K(n)) continue;
35
- const a = S(n);
34
+ if (B(n)) continue;
35
+ const a = x(n);
36
36
  if (!a || t.has(a)) throw new Error("流式排版组件应具有唯一标识");
37
37
  t.add(a);
38
38
  }
39
- if (z(e, i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
39
+ if (q(e, i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
40
40
  }
41
- function z(e, i, t, s) {
41
+ function q(e, i, t, s) {
42
42
  let n = -1 / 0;
43
43
  for (const a of i.bands) {
44
44
  if (!Number.isFinite(a.topMm) || !Number.isFinite(a.heightMm) || a.topMm < 0 || a.heightMm <= 0 || a.topMm < n - 1e-3) throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");
@@ -47,15 +47,78 @@ function z(e, i, t, s) {
47
47
  if (!t.has(o) || s.has(o)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${o}`);
48
48
  s.add(o);
49
49
  }
50
- U(e, a), n = a.topMm + a.heightMm;
50
+ X(e, a), n = a.topMm + a.heightMm;
51
+ }
52
+ }
53
+ const Q = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
54
+ function y(e) {
55
+ return !!e && typeof e == "object" && !Array.isArray(e);
56
+ }
57
+ function M(e) {
58
+ return typeof e == "string" && !!e.trim() && !Q.has(e);
59
+ }
60
+ function E(e, i, t, s) {
61
+ for (const n of Object.keys(e)) i.includes(n) || s.push({ path: `${t}.${n}`, message: "存在未知配置字段" });
62
+ }
63
+ function Z(e, i, t) {
64
+ if (e !== void 0) {
65
+ if (!y(e) || !["number", "percent", "date"].includes(String(e.kind))) {
66
+ t.push({ path: i, message: "绑定格式应为 number、percent 或 date" });
67
+ return;
68
+ }
69
+ E(e, e.kind === "date" ? ["kind", "pattern"] : e.kind === "number" ? ["kind", "digits", "thousands"] : ["kind", "digits"], i, t), e.digits !== void 0 && (!Number.isInteger(e.digits) || Number(e.digits) < 0 || Number(e.digits) > 100) && t.push({ path: `${i}.digits`, message: "精度应为 0..100 整数" }), e.thousands !== void 0 && typeof e.thousands != "boolean" && t.push({ path: `${i}.thousands`, message: "千分位开关应为布尔值" }), e.pattern !== void 0 && typeof e.pattern != "string" && t.push({ path: `${i}.pattern`, message: "日期格式应为字符串" });
70
+ }
71
+ }
72
+ function ee(e, i, t) {
73
+ const s = e.binding;
74
+ if (s === void 0) return;
75
+ const n = `${i}.binding`;
76
+ if (!y(s)) {
77
+ t.push({ path: n, message: "字段绑定应为对象" });
78
+ return;
51
79
  }
80
+ (!["text", "image", "barcode", "qrcode"].includes(String(e.kind)) || e.grid !== void 0) && t.push({ path: n, message: "绑定仅支持独立文本、图片、条码与二维码组件" }), E(s, ["field", "format", "prefix", "suffix", "emptyText"], n, t), M(s.field) || t.push({ path: `${n}.field`, message: "绑定字段应为安全的非空字段名(按字面读取自有字段)" });
81
+ for (const a of ["prefix", "suffix", "emptyText"]) s[a] !== void 0 && typeof s[a] != "string" && t.push({ path: `${n}.${a}`, message: "应为字符串" });
82
+ Z(s.format, `${n}.format`, t), e.kind === "image" && ["format", "prefix", "suffix"].some((a) => s[a] !== void 0) && t.push({ path: n, message: "图片绑定直接读取 PNG/JPEG data URL,不支持文本格式或前后缀" });
83
+ }
84
+ function te(e, i) {
85
+ if (!y(e)) {
86
+ i.push({ path: "$.repeat", message: "逐记录配置应为对象" });
87
+ return;
88
+ }
89
+ E(e, ["dataset", "rowKey", "copies"], "$.repeat", i), M(e.dataset) || i.push({ path: "$.repeat.dataset", message: "数据集应为安全的非空名称" }), e.rowKey !== void 0 && !M(e.rowKey) && i.push({ path: "$.repeat.rowKey", message: "业务主键应为安全的非空字段名" });
90
+ const t = e.copies;
91
+ t !== void 0 && (y(t) ? (E(t, ["field"], "$.repeat.copies", i), M(t.field) || i.push({ path: "$.repeat.copies.field", message: "复制数字段应为安全的非空字段名" })) : (!Number.isSafeInteger(t) || Number(t) < 1 || Number(t) > 1e3) && i.push({ path: "$.repeat.copies", message: "每条记录复制数应为 1..1000 整数" }));
92
+ }
93
+ function _(e, i, t, s) {
94
+ if (!y(e)) return;
95
+ ee(e, i, s), e.binding !== void 0 && !t && s.push({ path: `${i}.binding`, message: "字段绑定需要模板 repeat 数据集;普通报表请使用列表字段" }), t && e.kind === "list" && s.push({ path: i, message: "逐记录标签使用固定组件;动态列表请使用普通报表模板" });
96
+ const n = e.grid;
97
+ y(n) && Array.isArray(n.cells) && n.cells.forEach((a, o) => {
98
+ Array.isArray(a) && a.forEach((f, r) => {
99
+ y(f) && Array.isArray(f.children) && f.children.forEach((h, m) => _(h, `${i}.grid.cells.${o}.${r}.children.${m}`, t, s));
100
+ });
101
+ });
52
102
  }
53
- function R(e) {
103
+ function ie(e, i) {
104
+ const t = e.repeat !== void 0;
105
+ t && te(e.repeat, i), Array.isArray(e.pages) && e.pages.forEach((s, n) => {
106
+ if (!y(s)) return;
107
+ const a = `$.pages.${n}`;
108
+ t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path: a, message: "逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区" }), Array.isArray(s.components) && s.components.forEach((o, f) => {
109
+ const r = `${a}.components.${f}`;
110
+ if (_(o, r, t, i), !t || !y(o)) return;
111
+ const { leftMm: h, topMm: m, widthMm: g, heightMm: p } = o;
112
+ [h, m, g, p, s.widthMm, s.heightMm].every((b) => typeof b == "number" && Number.isFinite(b)) && (Number(h) < 0 || Number(m) < 0 || Number(h) + Number(g) > Number(s.widthMm) + 1e-3 || Number(m) + Number(p) > Number(s.heightMm) + 1e-3) && i.push({ path: r, message: "标签组件超出纸张边界,请调整位置或尺寸" });
113
+ });
114
+ });
115
+ }
116
+ function T(e) {
54
117
  return !!e && typeof e == "object" && !Array.isArray(e);
55
118
  }
56
- function E(e, i, t) {
119
+ function v(e, i, t) {
57
120
  if (e !== void 0) {
58
- if (!R(e)) {
121
+ if (!T(e)) {
59
122
  t.push({ path: i, message: "条件应为对象" });
60
123
  return;
61
124
  }
@@ -65,7 +128,7 @@ function E(e, i, t) {
65
128
  });
66
129
  }
67
130
  }
68
- function L(e, i, t) {
131
+ function I(e, i, t) {
69
132
  if (e === void 0) return;
70
133
  if (!Array.isArray(e) || e.length > 2048) {
71
134
  t.push({ path: i, message: "聚合应为数组且最多 2048 项" });
@@ -74,7 +137,7 @@ function L(e, i, t) {
74
137
  const s = /* @__PURE__ */ new Set();
75
138
  e.forEach((n, a) => {
76
139
  const o = `${i}.${a}`;
77
- if (!R(n)) {
140
+ if (!T(n)) {
78
141
  t.push({ path: o, message: "聚合应为对象" });
79
142
  return;
80
143
  }
@@ -90,7 +153,7 @@ function L(e, i, t) {
90
153
  message: "小数位应为 0–100 的整数"
91
154
  });
92
155
  try {
93
- V({
156
+ D({
94
157
  ...n,
95
158
  field: n.valueField ?? f
96
159
  });
@@ -102,15 +165,15 @@ function L(e, i, t) {
102
165
  }
103
166
  });
104
167
  }
105
- function B(e, i, t) {
168
+ function se(e, i, t) {
106
169
  if (e === void 0) return;
107
- const s = P(e);
170
+ const s = j(e);
108
171
  for (const n of s.errors) t.push({ path: i, message: n });
109
172
  }
110
- function X(e, i, t) {
173
+ function ne(e, i, t) {
111
174
  if (e !== void 0)
112
175
  try {
113
- I(e);
176
+ J(e);
114
177
  } catch (s) {
115
178
  t.push({
116
179
  path: i,
@@ -118,31 +181,31 @@ function X(e, i, t) {
118
181
  });
119
182
  }
120
183
  }
121
- function Y(e, i, t) {
184
+ function ae(e, i, t) {
122
185
  if (e.tree === void 0) return;
123
186
  const s = `${i}.tree`;
124
187
  try {
125
- j(e.tree);
188
+ G(e.tree);
126
189
  const n = e.tree;
127
190
  if (e.matrix || e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
128
191
  if (e.rowKey !== void 0 && e.rowKey !== n.idField) throw new Error("树形 rowKey 应与 idField 一致");
129
192
  if (!Array.isArray(e.columns) || !e.columns.some((a) => a && a.field === n.labelField && !a.hidden)) throw new Error("树形布局需要可见的标签列");
130
- Array.isArray(e.computed) && W(n, e.computed);
193
+ Array.isArray(e.computed) && z(n, e.computed);
131
194
  } catch (n) {
132
195
  t.push({ path: s, message: n instanceof Error ? n.message : String(n) });
133
196
  }
134
197
  }
135
- const F = "1.0";
136
- class $ extends Error {
198
+ const P = "1.0";
199
+ class A extends Error {
137
200
  constructor(i) {
138
201
  super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
139
202
  }
140
203
  }
141
- const Q = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), Z = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), q = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), w = 2e5, ee = 64, N = 1e7;
142
- function m(e) {
204
+ const oe = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), fe = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), re = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), N = 2e5, he = 64, O = 1e7;
205
+ function d(e) {
143
206
  return !!e && typeof e == "object" && !Array.isArray(e);
144
207
  }
145
- function te(e, i, t) {
208
+ function me(e, i, t) {
146
209
  const s = Object.getPrototypeOf(e), n = Array.isArray(e);
147
210
  if (n ? s !== Array.prototype : s !== Object.prototype && s !== null)
148
211
  return t.push({ path: i, message: "模板对象必须使用普通 JSON 对象原型" }), !1;
@@ -153,30 +216,30 @@ function te(e, i, t) {
153
216
  }
154
217
  return Object.getOwnPropertySymbols(e).length > 0 ? (t.push({ path: i, message: "模板不能包含 Symbol 键" }), !1) : !0;
155
218
  }
156
- function ie(e, i, t, s) {
157
- return Q.has(e) ? (s.push({ path: t, message: "模板不能包含可能污染原型的键" }), !1) : i.get || i.set || !i.enumerable ? (s.push({ path: t, message: "模板不能包含访问器或不可枚举字段" }), !1) : !0;
219
+ function de(e, i, t, s) {
220
+ return oe.has(e) ? (s.push({ path: t, message: "模板不能包含可能污染原型的键" }), !1) : i.get || i.set || !i.enumerable ? (s.push({ path: t, message: "模板不能包含访问器或不可枚举字段" }), !1) : !0;
158
221
  }
159
- function se(e) {
222
+ function ue(e) {
160
223
  return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
161
224
  }
162
- function k(e, i) {
225
+ function R(e, i) {
163
226
  const t = /* @__PURE__ */ new Set();
164
227
  let s = 0, n = 0, a = !1;
165
228
  const o = (f, r, h) => {
166
229
  if (!a) {
167
- if (++s > w) {
168
- s === w + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
230
+ if (++s > N) {
231
+ s === N + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
169
232
  return;
170
233
  }
171
- if (h > ee) {
234
+ if (h > he) {
172
235
  i.push({ path: r, message: "模板嵌套层级过深" });
173
236
  return;
174
237
  }
175
238
  if (typeof f == "string") {
176
- n += f.length, n > N && (a = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
239
+ n += f.length, n > O && (a = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
177
240
  return;
178
241
  }
179
- if (!se(f)) {
242
+ if (!ue(f)) {
180
243
  if (!f || typeof f != "object") {
181
244
  i.push({ path: r, message: "模板只允许 JSON 值,不允许函数、undefined 或非有限数字" });
182
245
  return;
@@ -185,12 +248,12 @@ function k(e, i) {
185
248
  i.push({ path: r, message: "模板不能包含循环引用" });
186
249
  return;
187
250
  }
188
- if (te(f, r, i)) {
251
+ if (me(f, r, i)) {
189
252
  t.add(f);
190
- for (const [d, l] of Object.entries(Object.getOwnPropertyDescriptors(f))) {
191
- if (Array.isArray(f) && d === "length") continue;
192
- const y = `${r}.${d}`;
193
- if (ie(d, l, y, i) && o(l.value, y, h + 1), s > w || a) break;
253
+ for (const [m, g] of Object.entries(Object.getOwnPropertyDescriptors(f))) {
254
+ if (Array.isArray(f) && m === "length") continue;
255
+ const p = `${r}.${m}`;
256
+ if (de(m, g, p, i) && o(g.value, p, h + 1), s > N || a) break;
194
257
  }
195
258
  t.delete(f);
196
259
  }
@@ -207,27 +270,27 @@ function c(e, i, t, s, n = 0, a = !1) {
207
270
  const o = e[i];
208
271
  o === void 0 && !a || (typeof o != "number" || !Number.isFinite(o) || o < n) && s.push({ path: `${t}.${i}`, message: `应为大于等于 ${n} 的有限数字` });
209
272
  }
210
- function p(e, i, t, s) {
273
+ function $(e, i, t, s) {
211
274
  e[i] !== void 0 && typeof e[i] != "boolean" && s.push({ path: `${t}.${i}`, message: "应为布尔值" });
212
275
  }
213
- function b(e, i, t, s = !1) {
214
- e !== void 0 && !q.has(e) && !(s && e === "auto") && t.push({ path: i, message: `未知对齐方式${s ? "(支持 auto)" : ""}` });
276
+ function w(e, i, t, s = !1) {
277
+ e !== void 0 && !re.has(e) && !(s && e === "auto") && t.push({ path: i, message: `未知对齐方式${s ? "(支持 auto)" : ""}` });
215
278
  }
216
- function g(e, i, t) {
279
+ function l(e, i, t) {
217
280
  if (e !== void 0) {
218
- if (!m(e)) {
281
+ if (!d(e)) {
219
282
  t.push({ path: i, message: "样式应为对象" });
220
283
  return;
221
284
  }
222
- b(e.align, `${i}.align`, t), e.verticalAlign !== void 0 && !["top", "middle", "bottom"].includes(e.verticalAlign) && t.push({ path: `${i}.verticalAlign`, message: "未知垂直对齐方式" });
285
+ w(e.align, `${i}.align`, t), e.verticalAlign !== void 0 && !["top", "middle", "bottom"].includes(e.verticalAlign) && t.push({ path: `${i}.verticalAlign`, message: "未知垂直对齐方式" });
223
286
  for (const s of ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight"]) c(e, s, i, t);
224
287
  for (const s of ["letterSpacing", "rotateDeg"]) c(e, s, i, t, -1 / 0);
225
288
  c(e, "opacity", i, t), typeof e.opacity == "number" && e.opacity > 1 && t.push({ path: `${i}.opacity`, message: "透明度不能大于 1" });
226
- for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"]) p(e, s, i, t);
289
+ for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"]) $(e, s, i, t);
227
290
  for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) u(e, s, i, t);
228
291
  }
229
292
  }
230
- function ne(e, i, t) {
293
+ function ce(e, i, t) {
231
294
  if (e === void 0) return;
232
295
  if (!Array.isArray(e)) {
233
296
  t.push({ path: i, message: "参数定义应为数组" });
@@ -236,149 +299,149 @@ function ne(e, i, t) {
236
299
  const s = /* @__PURE__ */ new Set(), n = t.length;
237
300
  e.forEach((a, o) => {
238
301
  const f = `${i}.${o}`;
239
- if (!m(a)) {
302
+ if (!d(a)) {
240
303
  t.push({ path: f, message: "参数定义应为对象" });
241
304
  return;
242
305
  }
243
306
  u(a, "field", f, t, !0), typeof a.field == "string" && (s.has(a.field) && t.push({ path: `${f}.field`, message: "参数名重复" }), s.add(a.field)), a.type !== void 0 && !["text", "number", "date", "month", "year", "dateRange", "select"].includes(a.type) && t.push({ path: `${f}.type`, message: "未知参数类型" });
244
307
  for (const r of ["label", "defaultValue", "placeholder"]) u(a, r, f, t);
245
- p(a, "required", f, t);
308
+ $(a, "required", f, t);
246
309
  for (const r of ["minLength", "maxLength"]) {
247
310
  const h = a[r];
248
311
  h !== void 0 && (typeof h != "number" || !Number.isSafeInteger(h) || h < 0) && t.push({ path: `${f}.${r}`, message: "长度边界应为非负整数" });
249
312
  }
250
- ae(a, f, t), a.options !== void 0 && (Array.isArray(a.options) ? a.options.forEach((r, h) => {
251
- const d = `${f}.options.${h}`;
252
- if (!m(r)) t.push({ path: d, message: "选项应为对象" });
313
+ ge(a, f, t), a.options !== void 0 && (Array.isArray(a.options) ? a.options.forEach((r, h) => {
314
+ const m = `${f}.options.${h}`;
315
+ if (!d(r)) t.push({ path: m, message: "选项应为对象" });
253
316
  else
254
- for (const l of ["label", "value"]) typeof r[l] != "string" && t.push({ path: `${d}.${l}`, message: "选项标签与值应为字符串(允许空白选项)" });
317
+ for (const g of ["label", "value"]) typeof r[g] != "string" && t.push({ path: `${m}.${g}`, message: "选项标签与值应为字符串(允许空白选项)" });
255
318
  }) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
256
- }), t.length === n && t.push(...D(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
319
+ }), t.length === n && t.push(...U(e).map((a) => ({ path: a.path.replace("$.paramDefs", i), message: a.message })));
257
320
  }
258
- function ae(e, i, t) {
321
+ function ge(e, i, t) {
259
322
  for (const a of ["min", "max"]) {
260
323
  const o = e[a];
261
324
  if (o === void 0) continue;
262
- H(e.type, o) || e.type === "number" && typeof o == "number" && Number.isFinite(o) || t.push({ path: `${i}.${a}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
325
+ W(e.type, o) || e.type === "number" && typeof o == "number" && Number.isFinite(o) || t.push({ path: `${i}.${a}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
263
326
  }
264
327
  const s = typeof e.min == "number" && typeof e.max == "number" && e.min > e.max, n = typeof e.min == "string" && typeof e.max == "string" && e.min > e.max;
265
328
  (s || n) && t.push({ path: i, message: "最小边界不能大于最大边界" }), typeof e.minLength == "number" && typeof e.maxLength == "number" && e.minLength > e.maxLength && t.push({ path: i, message: "最小长度不能大于最大长度" });
266
329
  }
267
- function T(e, i, t) {
330
+ function C(e, i, t) {
268
331
  if (!Array.isArray(e) || e.length === 0) {
269
332
  t.push({ path: i, message: "列表至少需要一列" });
270
333
  return;
271
334
  }
272
- e.every((s) => m(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
335
+ e.every((s) => d(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
273
336
  const a = `${i}.${n}`;
274
- if (!m(s)) {
337
+ if (!d(s)) {
275
338
  t.push({ path: a, message: "列应为对象" });
276
339
  return;
277
340
  }
278
- if (J(s, a, t), p(s, "hidden", a, t), E(s.visibleWhen, `${a}.visibleWhen`, t), typeof s.header != "string" && t.push({ path: `${a}.header`, message: "表头应为字符串(允许空白表头)" }), u(s, "field", a, t, !0), c(s, "widthMm", a, t, Number.MIN_VALUE, !0), g(s.style, `${a}.style`, t), g(s.headerStyle, `${a}.headerStyle`, t), b(s.align, `${a}.align`, t, !0), b(s.headerAlign, `${a}.headerAlign`, t), s.semanticRole !== void 0 && !["identifier", "dimension", "measure", "date", "text"].includes(s.semanticRole) && t.push({ path: `${a}.semanticRole`, message: "未知列语义" }), s.format !== void 0)
279
- if (!m(s.format) || !["number", "percent", "date"].includes(s.format.kind))
341
+ if (K(s, a, t), $(s, "hidden", a, t), v(s.visibleWhen, `${a}.visibleWhen`, t), typeof s.header != "string" && t.push({ path: `${a}.header`, message: "表头应为字符串(允许空白表头)" }), u(s, "field", a, t, !0), c(s, "widthMm", a, t, Number.MIN_VALUE, !0), l(s.style, `${a}.style`, t), l(s.headerStyle, `${a}.headerStyle`, t), w(s.align, `${a}.align`, t, !0), w(s.headerAlign, `${a}.headerAlign`, t), s.semanticRole !== void 0 && !["identifier", "dimension", "measure", "date", "text"].includes(s.semanticRole) && t.push({ path: `${a}.semanticRole`, message: "未知列语义" }), s.format !== void 0)
342
+ if (!d(s.format) || !["number", "percent", "date"].includes(s.format.kind))
280
343
  t.push({ path: `${a}.format`, message: "未知列格式" });
281
344
  else {
282
345
  const o = s.format.digits;
283
- o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }), p(s.format, "thousands", `${a}.format`, t), u(s.format, "pattern", `${a}.format`, t);
346
+ o !== void 0 && (typeof o != "number" || !Number.isInteger(o) || o < 0 || o > 100) && t.push({ path: `${a}.format.digits`, message: "小数位应为 0–100 的整数" }), $(s.format, "thousands", `${a}.format`, t), u(s.format, "pattern", `${a}.format`, t);
284
347
  }
285
348
  s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((o, f) => {
286
349
  const r = `${a}.rules.${f}`;
287
- if (!m(o) || !m(o.when)) {
350
+ if (!d(o) || !d(o.when)) {
288
351
  t.push({ path: r, message: "条件格式缺少 when 对象" });
289
352
  return;
290
353
  }
291
- E(o.when, `${r}.when`, t), u(o.when, "field", `${r}.when`, t, !0), [">", ">=", "<", "<=", "==", "!="].includes(o.when.op) || t.push({ path: `${r}.when.op`, message: "未知条件运算符" }), typeof o.when.value != "number" && typeof o.when.value != "string" && t.push({ path: `${r}.when.value`, message: "条件值应为数字或字符串" }), g(o.style, `${r}.style`, t);
354
+ v(o.when, `${r}.when`, t), u(o.when, "field", `${r}.when`, t, !0), [">", ">=", "<", "<=", "==", "!="].includes(o.when.op) || t.push({ path: `${r}.when.op`, message: "未知条件运算符" }), typeof o.when.value != "number" && typeof o.when.value != "string" && t.push({ path: `${r}.when.value`, message: "条件值应为数字或字符串" }), l(o.style, `${r}.style`, t);
292
355
  }) : t.push({ path: `${a}.rules`, message: "条件格式应为数组" }));
293
356
  });
294
357
  }
295
- function _(e, i, t) {
358
+ function V(e, i, t) {
296
359
  if (e !== void 0) {
297
- if (!m(e)) {
360
+ if (!d(e)) {
298
361
  t.push({ path: i, message: "分组应为对象" });
299
362
  return;
300
363
  }
301
364
  u(e, "field", i, t, !0);
302
365
  for (const s of ["headerTemplate", "subtotalLabel"]) u(e, s, i, t);
303
- for (const s of ["headerStyle", "subtotalStyle"]) g(e[s], `${i}.${s}`, t);
304
- p(e, "keepWithNext", i, t), p(e, "repeatHeader", i, t), L(e.aggregates, `${i}.aggregates`, t), e.subtotal !== void 0 && (!Array.isArray(e.subtotal) || e.subtotal.some((s) => typeof s != "string")) && t.push({ path: `${i}.subtotal`, message: "小计字段应为字符串数组" });
366
+ for (const s of ["headerStyle", "subtotalStyle"]) l(e[s], `${i}.${s}`, t);
367
+ $(e, "keepWithNext", i, t), $(e, "repeatHeader", i, t), I(e.aggregates, `${i}.aggregates`, t), e.subtotal !== void 0 && (!Array.isArray(e.subtotal) || e.subtotal.some((s) => typeof s != "string")) && t.push({ path: `${i}.subtotal`, message: "小计字段应为字符串数组" });
305
368
  }
306
369
  }
307
- function oe(e, i, t) {
370
+ function pe(e, i, t) {
308
371
  if (!(e === void 0 || typeof e == "boolean")) {
309
- if (!m(e)) {
372
+ if (!d(e)) {
310
373
  t.push({ path: i, message: "合计应为布尔值或对象" });
311
374
  return;
312
375
  }
313
- u(e, "label", i, t), L(e.aggregates, `${i}.aggregates`, t), g(e.style, `${i}.style`, t), e.fields !== void 0 && (!Array.isArray(e.fields) || e.fields.some((s) => typeof s != "string")) && t.push({ path: `${i}.fields`, message: "合计字段应为字符串数组" });
376
+ u(e, "label", i, t), I(e.aggregates, `${i}.aggregates`, t), l(e.style, `${i}.style`, t), e.fields !== void 0 && (!Array.isArray(e.fields) || e.fields.some((s) => typeof s != "string")) && t.push({ path: `${i}.fields`, message: "合计字段应为字符串数组" });
314
377
  }
315
378
  }
316
- function fe(e, i, t, s) {
379
+ function ye(e, i, t, s) {
317
380
  const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
318
- if (O(n, t, s, []), x(n, t, s), !m(e) || !Array.isArray(e.cells)) return;
381
+ if (L(n, t, s, []), F(n, t, s), !d(e) || !Array.isArray(e.cells)) return;
319
382
  const a = e.cells, o = Array.isArray(i) ? i.length : 0;
320
- if (a.length * o > w) {
383
+ if (a.length * o > N) {
321
384
  s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
322
385
  return;
323
386
  }
324
- e.cells.length || s.push({ path: `${t}.cells`, message: "表头至少需要一行" }), Array.isArray(e.colWidthsMm) && e.colWidthsMm.length !== o && s.push({ path: `${t}.colWidthsMm`, message: "表头列宽数量应与列表列数一致" }), Array.isArray(e.rowHeightsMm) && e.rowHeightsMm.length !== e.cells.length && s.push({ path: `${t}.rowHeightsMm`, message: "表头行高数量应与行数一致" }), re(a, o, t, s);
387
+ e.cells.length || s.push({ path: `${t}.cells`, message: "表头至少需要一行" }), Array.isArray(e.colWidthsMm) && e.colWidthsMm.length !== o && s.push({ path: `${t}.colWidthsMm`, message: "表头列宽数量应与列表列数一致" }), Array.isArray(e.rowHeightsMm) && e.rowHeightsMm.length !== e.cells.length && s.push({ path: `${t}.rowHeightsMm`, message: "表头行高数量应与行数一致" }), le(a, o, t, s);
325
388
  }
326
- function re(e, i, t, s) {
389
+ function le(e, i, t, s) {
327
390
  const n = /* @__PURE__ */ new Set();
328
391
  e.forEach((a, o) => {
329
392
  if (!Array.isArray(a)) return;
330
393
  let f = 0;
331
394
  a.forEach((r, h) => {
332
395
  for (; n.has(`${o}:${f}`); ) f++;
333
- const d = m(r) && typeof r.colSpan == "number" ? r.colSpan : 1, l = m(r) && typeof r.rowSpan == "number" ? r.rowSpan : 1;
334
- (f + d > i || o + l > e.length) && s.push({ path: `${t}.cells.${o}.${h}`, message: "表头合并区域超出表头边界" });
335
- for (let y = o; y < Math.min(e.length, o + l); y++)
336
- for (let A = f; A < Math.min(i, f + d); A++)
337
- n.has(`${y}:${A}`) && s.push({ path: `${t}.cells.${o}.${h}`, message: "表头合并区域重叠" }), n.add(`${y}:${A}`);
338
- f += d;
396
+ const m = d(r) && typeof r.colSpan == "number" ? r.colSpan : 1, g = d(r) && typeof r.rowSpan == "number" ? r.rowSpan : 1;
397
+ (f + m > i || o + g > e.length) && s.push({ path: `${t}.cells.${o}.${h}`, message: "表头合并区域超出表头边界" });
398
+ for (let p = o; p < Math.min(e.length, o + g); p++)
399
+ for (let b = f; b < Math.min(i, f + m); b++)
400
+ n.has(`${p}:${b}`) && s.push({ path: `${t}.cells.${o}.${h}`, message: "表头合并区域重叠" }), n.add(`${p}:${b}`);
401
+ f += m;
339
402
  });
340
403
  });
341
404
  }
342
- function he(e, i, t) {
343
- if (Y(e, i, t), B(e.computed, `${i}.computed`, t), X(e.matrix, `${i}.matrix`, t), e.matrix && (e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.grandTotal) && t.push({ path: `${i}.matrix`, message: "矩阵请使用自身 totals 汇总,不能同时配置普通分组、总计或主从明细" }), E(e.rowVisibleWhen, `${i}.rowVisibleWhen`, t), e.groups !== void 0 && (!Array.isArray(e.groups) || e.groups.length > 16 ? t.push({ path: `${i}.groups`, message: "分组应为数组,最多 16 级" }) : e.groups.forEach((a, o) => _(a, `${i}.groups.${o}`, t))), e.detail === void 0) return;
405
+ function $e(e, i, t) {
406
+ if (ae(e, i, t), se(e.computed, `${i}.computed`, t), ne(e.matrix, `${i}.matrix`, t), e.matrix && (e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.grandTotal) && t.push({ path: `${i}.matrix`, message: "矩阵请使用自身 totals 汇总,不能同时配置普通分组、总计或主从明细" }), v(e.rowVisibleWhen, `${i}.rowVisibleWhen`, t), e.groups !== void 0 && (!Array.isArray(e.groups) || e.groups.length > 16 ? t.push({ path: `${i}.groups`, message: "分组应为数组,最多 16 级" }) : e.groups.forEach((a, o) => V(a, `${i}.groups.${o}`, t))), e.detail === void 0) return;
344
407
  const s = e.detail, n = `${i}.detail`;
345
- if (!m(s)) {
408
+ if (!d(s)) {
346
409
  t.push({ path: n, message: "主从关联应为对象" });
347
410
  return;
348
411
  }
349
412
  for (const a of ["dataset", "parentKey", "foreignKey"]) u(s, a, n, t, !0);
350
413
  for (const a of ["rowKey", "revisionField", "sourceTokenField"]) u(s, a, n, t, s[a] !== void 0);
351
- u(s, "label", n, t), p(s, "header", n, t), c(s, "rowHeightMm", n, t, Number.MIN_VALUE), T(s.columns, `${n}.columns`, t), s.unmatched !== void 0 && s.unmatched !== "error" && s.unmatched !== "ignore" && t.push({ path: `${n}.unmatched`, message: "未关联明细策略应为 error 或 ignore" });
414
+ u(s, "label", n, t), $(s, "header", n, t), c(s, "rowHeightMm", n, t, Number.MIN_VALUE), C(s.columns, `${n}.columns`, t), s.unmatched !== void 0 && s.unmatched !== "error" && s.unmatched !== "ignore" && t.push({ path: `${n}.unmatched`, message: "未关联明细策略应为 error 或 ignore" });
352
415
  }
353
- function me(e, i, t) {
416
+ function be(e, i, t) {
354
417
  for (const s of ["leftMm", "topMm"]) c(e, s, i, t, -1 / 0, !0);
355
418
  c(e, "widthMm", i, t, Number.MIN_VALUE, !0), u(e, "dataset", i, t, !0), u(e, "title", i, t);
356
419
  for (const s of ["rowKey", "revisionField", "sourceTokenField"]) u(e, s, i, t, e[s] !== void 0);
357
- e.headerGrid !== void 0 && fe(e.headerGrid, e.columns, `${i}.headerGrid`, t), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" }), T(e.columns, `${i}.columns`, t);
420
+ e.headerGrid !== void 0 && ye(e.headerGrid, e.columns, `${i}.headerGrid`, t), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" }), C(e.columns, `${i}.columns`, t);
358
421
  for (const s of ["fontSizePt", "rowHeightMm"]) c(e, s, i, t, Number.MIN_VALUE);
359
422
  c(e, "paddingMm", i, t);
360
- for (const s of ["header", "headerBold", "headerEveryPage", "border"]) p(e, s, i, t);
361
- e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), u(e, "headerBackgroundColor", i, t), b(e.align, `${i}.align`, t, !0), b(e.headerAlign, `${i}.headerAlign`, t), g(e.headerStyle, `${i}.headerStyle`, t), he(e, i, t), _(e.groupBy, `${i}.groupBy`, t), oe(e.grandTotal, `${i}.grandTotal`, t);
423
+ for (const s of ["header", "headerBold", "headerEveryPage", "border"]) $(e, s, i, t);
424
+ e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), u(e, "headerBackgroundColor", i, t), w(e.align, `${i}.align`, t, !0), w(e.headerAlign, `${i}.headerAlign`, t), l(e.headerStyle, `${i}.headerStyle`, t), $e(e, i, t), V(e.groupBy, `${i}.groupBy`, t), pe(e.grandTotal, `${i}.grandTotal`, t);
362
425
  }
363
- function x(e, i, t) {
364
- g(e.style, `${i}.style`, t);
426
+ function F(e, i, t) {
427
+ l(e.style, `${i}.style`, t);
365
428
  for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"]) u(e, n, i, t);
366
429
  if (e.lines !== void 0 && (!Array.isArray(e.lines) || e.lines.some((n) => typeof n != "string")) && t.push({ path: `${i}.lines`, message: "文本行应为字符串数组" }), Array.isArray(e.richParagraphs) && e.richParagraphs.forEach((n, a) => {
367
- if (!m(n)) return;
430
+ if (!d(n)) return;
368
431
  const o = `${i}.richParagraphs.${a}`;
369
- b(n.align, `${o}.align`, t);
432
+ w(n.align, `${o}.align`, t);
370
433
  for (const f of ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"]) c(n, f, o, t);
371
434
  Array.isArray(n.segments) && n.segments.forEach((f, r) => {
372
435
  const h = `${o}.segments.${r}`;
373
- if (!m(f)) {
436
+ if (!d(f)) {
374
437
  t.push({ path: h, message: "富文本片段应为对象" });
375
438
  return;
376
439
  }
377
440
  f.kind !== void 0 && f.kind !== "text" && f.kind !== "field" && t.push({ path: `${h}.kind`, message: "未知富文本片段类型" });
378
- for (const d of ["text", "field"]) u(f, d, h, t);
379
- g(f.style, `${h}.style`, t);
441
+ for (const m of ["text", "field"]) u(f, m, h, t);
442
+ l(f.style, `${h}.style`, t);
380
443
  });
381
- }), !m(e.grid)) return;
444
+ }), !d(e.grid)) return;
382
445
  const s = e.grid;
383
446
  c(s, "gapMm", `${i}.grid`, t), c(s, "paddingMm", `${i}.grid`, t);
384
447
  for (const n of ["colWidthsMm", "rowHeightsMm"]) {
@@ -389,35 +452,35 @@ function x(e, i, t) {
389
452
  Array.isArray(n) && n.forEach((o, f) => {
390
453
  const r = `${i}.grid.cells.${a}.${f}`;
391
454
  if (o !== null) {
392
- if (!m(o)) {
455
+ if (!d(o)) {
393
456
  t.push({ path: r, message: "网格单元格应为对象或 null" });
394
457
  return;
395
458
  }
396
459
  for (const h of ["text", "rawText", "numberFormat"]) u(o, h, r, t);
397
460
  for (const h of ["colSpan", "rowSpan"]) {
398
- const d = o[h];
399
- d !== void 0 && (typeof d != "number" || !Number.isInteger(d) || d <= 0) && t.push({ path: `${r}.${h}`, message: "跨度应为正整数" });
461
+ const m = o[h];
462
+ m !== void 0 && (typeof m != "number" || !Number.isInteger(m) || m <= 0) && t.push({ path: `${r}.${h}`, message: "跨度应为正整数" });
400
463
  }
401
- o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }), g(o.style, `${r}.style`, t), o.children !== void 0 && (Array.isArray(o.children) ? o.children.forEach((h, d) => {
402
- m(h) && x(h, `${r}.children.${d}`, t);
464
+ o.value !== void 0 && o.value !== null && !["string", "number", "boolean"].includes(typeof o.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }), l(o.style, `${r}.style`, t), o.children !== void 0 && (Array.isArray(o.children) ? o.children.forEach((h, m) => {
465
+ d(h) && F(h, `${r}.children.${m}`, t);
403
466
  }) : t.push({ path: `${r}.children`, message: "嵌套组件应为数组" }));
404
467
  }
405
468
  });
406
469
  });
407
470
  }
408
- function ue(e, i, t) {
471
+ function Ae(e, i, t) {
409
472
  if (!(e.flow === void 0 || !Array.isArray(e.components)))
410
473
  try {
411
- G(e.components, e.flow);
474
+ Y(e.components, e.flow);
412
475
  } catch (s) {
413
476
  t.push({ path: `${i}.flow`, message: s instanceof Error ? s.message : String(s) });
414
477
  }
415
478
  }
416
- function de(e) {
479
+ function we(e) {
417
480
  const i = [], t = [];
418
- return k(e, i), i.length ? { ok: !1, errors: i, warnings: t } : (m(e) ? (e.schemaVersion !== void 0 && e.schemaVersion !== C && i.push({ path: "$.schemaVersion", message: "不支持的模板 schemaVersion" }), ne(e.params, "$.params", i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
481
+ return R(e, i), i.length ? { ok: !1, errors: i, warnings: t } : (d(e) ? (e.schemaVersion !== void 0 && e.schemaVersion !== H && i.push({ path: "$.schemaVersion", message: "不支持的模板 schemaVersion" }), ce(e.params, "$.params", i), ie(e, i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
419
482
  const a = `$.pages.${n}`;
420
- if (!m(s)) {
483
+ if (!d(s)) {
421
484
  i.push({ path: a, message: "页应为对象" });
422
485
  return;
423
486
  }
@@ -425,67 +488,67 @@ function de(e) {
425
488
  for (const o of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) c(s, o, a, i);
426
489
  typeof s.widthMm == "number" && Number(s.marginLeftMm ?? 0) + Number(s.marginRightMm ?? 0) >= s.widthMm && i.push({ path: a, message: "横向页边距占满页面" }), typeof s.heightMm == "number" && Number(s.marginTopMm ?? 0) + Number(s.marginBottomMm ?? 0) >= s.heightMm && i.push({ path: a, message: "纵向页边距占满页面" }), Array.isArray(s.components) ? s.components.forEach((o, f) => {
427
490
  const r = `${a}.components.${f}`;
428
- m(o) && o.kind === "list" ? me(o, r, i) : (O(o, r, i, t), m(o) && x(o, r, i));
429
- }) : i.push({ path: `${a}.components`, message: "组件应为数组" }), ue(s, a, i);
491
+ d(o) && o.kind === "list" ? be(o, r, i) : (L(o, r, i, t), d(o) && F(o, r, i));
492
+ }) : i.push({ path: `${a}.components`, message: "组件应为数组" }), Ae(s, a, i);
430
493
  })) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
431
494
  }
432
- function ce(e) {
495
+ function Me(e) {
433
496
  const i = [], t = [];
434
- if (k(e, i), i.length) return { ok: !1, errors: i, warnings: t };
435
- if (!m(e)) i.push({ path: "$", message: "模板文档应为对象" });
497
+ if (R(e, i), i.length) return { ok: !1, errors: i, warnings: t };
498
+ if (!d(e)) i.push({ path: "$", message: "模板文档应为对象" });
436
499
  else {
437
500
  for (const n of Object.keys(e))
438
- Z.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
439
- e.schemaVersion !== F && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
501
+ fe.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
502
+ e.schemaVersion !== P && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
440
503
  for (const n of ["id", "name"]) u(e, n, "$", i, !0);
441
504
  for (const n of ["revision", "description"]) u(e, n, "$", i);
442
- const s = de(e.template);
505
+ const s = we(e.template);
443
506
  i.push(...s.errors.map((n) => ({ ...n, path: `$.template${n.path.slice(1)}` }))), t.push(...s.warnings.map((n) => ({ ...n, path: `$.template${n.path.slice(1)}` })));
444
507
  }
445
508
  return { ok: i.length === 0, errors: i, warnings: t };
446
509
  }
447
- function v(e) {
448
- const i = ce(e);
449
- if (!i.ok) throw new $(i.errors);
510
+ function k(e) {
511
+ const i = Me(e);
512
+ if (!i.ok) throw new A(i.errors);
450
513
  }
451
- function we(e) {
514
+ function Re(e) {
452
515
  const i = [];
453
- if (k(e, i), i.length) throw new $(i);
454
- const t = { ...e, schemaVersion: e.schemaVersion ?? F };
455
- return v(t), M(t);
516
+ if (R(e, i), i.length) throw new A(i);
517
+ const t = { ...e, schemaVersion: e.schemaVersion ?? P };
518
+ return k(t), S(t);
456
519
  }
457
- function Me(e) {
520
+ function Fe(e) {
458
521
  let i = e;
459
522
  if (typeof e == "string") {
460
- if (e.length > N)
461
- throw new $([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
523
+ if (e.length > O)
524
+ throw new A([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
462
525
  try {
463
526
  i = JSON.parse(e);
464
527
  } catch {
465
- throw new $([{ path: "$", message: "模板 JSON 语法无效" }]);
528
+ throw new A([{ path: "$", message: "模板 JSON 语法无效" }]);
466
529
  }
467
530
  }
468
- return v(i), M(i);
531
+ return k(i), S(i);
469
532
  }
470
- function ve(e) {
471
- v(e);
533
+ function Le(e) {
534
+ k(e);
472
535
  const i = JSON.stringify(e, null, 2);
473
- if (i.length > N) throw new $([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
536
+ if (i.length > O) throw new A([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
474
537
  return i;
475
538
  }
476
- function M(e) {
539
+ function S(e) {
477
540
  return JSON.parse(JSON.stringify(e));
478
541
  }
479
- function Ee(e = []) {
542
+ function _e(e = []) {
480
543
  const i = /* @__PURE__ */ new Map(), t = {
481
544
  get: (s) => {
482
545
  const n = i.get(s);
483
- return n ? M(n) : void 0;
546
+ return n ? S(n) : void 0;
484
547
  },
485
548
  list: () => Array.from(i.values(), ({ template: s, ...n }) => ({ ...n })),
486
549
  register: (s, n = {}) => {
487
- if (v(s), i.has(s.id) && !n.replace) throw new $([{ path: "$.id", message: `模板 ID ${s.id} 已注册;更新需显式 replace:true` }]);
488
- i.set(s.id, M(s));
550
+ if (k(s), i.has(s.id) && !n.replace) throw new A([{ path: "$.id", message: `模板 ID ${s.id} 已注册;更新需显式 replace:true` }]);
551
+ i.set(s.id, S(s));
489
552
  },
490
553
  remove: (s) => i.delete(s)
491
554
  };
@@ -493,14 +556,15 @@ function Ee(e = []) {
493
556
  return t;
494
557
  }
495
558
  export {
496
- F as R,
497
- $ as a,
498
- ce as b,
499
- Ee as c,
500
- we as d,
501
- G as e,
502
- Me as p,
503
- Ae as r,
504
- ve as s,
505
- de as v
559
+ A as R,
560
+ P as a,
561
+ Me as b,
562
+ _e as c,
563
+ Re as d,
564
+ Y as e,
565
+ ie as f,
566
+ Fe as p,
567
+ Oe as r,
568
+ Le as s,
569
+ we as v
506
570
  };