@agile-team/mach-report 2.16.0 → 2.17.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 (128) hide show
  1. package/README.md +10 -6
  2. package/dist/{ExcelBindingWizard-CP6h2x1f.cjs → ExcelBindingWizard-Bq6FYME6.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-HhB3hAJE.js → ExcelBindingWizard-Co1svTsw.js} +3 -3
  4. package/dist/{ParamEditor-CUQLgoxa.cjs → ParamEditor-B5UZRgxv.cjs} +1 -1
  5. package/dist/{ParamEditor-OKesP_nO.js → ParamEditor-DNNARyeB.js} +1 -1
  6. package/dist/{ReportBatchPanel-cZCAMAwH.cjs → ReportBatchPanel-Ctvs2t_9.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-ruxcbfY6.js → ReportBatchPanel-uQh06usx.js} +1 -1
  8. package/dist/ReportPreview-BdQawRh0.js +4879 -0
  9. package/dist/ReportPreview-CJC_-j2I.cjs +6 -0
  10. package/dist/{ReportTemplateLibrary-BDlNT8JN.cjs → ReportTemplateLibrary-CnP7_1pH.cjs} +1 -1
  11. package/dist/{ReportTemplateLibrary-DcwrH-63.js → ReportTemplateLibrary-TIL_Oj2l.js} +1 -1
  12. package/dist/RuleEditor-DkRjOLlr.js +2141 -0
  13. package/dist/RuleEditor-h5anGsDB.cjs +1 -0
  14. package/dist/{TemplateOutlinePanel-CGrT5DFN.cjs → TemplateOutlinePanel-BlLxRrfu.cjs} +1 -1
  15. package/dist/{TemplateOutlinePanel-SXCjaPKR.js → TemplateOutlinePanel-BouxsuqQ.js} +1 -1
  16. package/dist/{TemplateReusePanel-lHLOS9Wn.js → TemplateReusePanel-BEACLPaN.js} +2 -2
  17. package/dist/{TemplateReusePanel-6Z3wRFz8.cjs → TemplateReusePanel-yxsHSO40.cjs} +1 -1
  18. package/dist/{TemplateReviewPanel-CJ9PLc48.js → TemplateReviewPanel-B1OGRY2i.js} +1 -1
  19. package/dist/{TemplateReviewPanel-Dpk7sLcF.cjs → TemplateReviewPanel-D9Cx0m2N.cjs} +1 -1
  20. package/dist/analytics.cjs +1 -1
  21. package/dist/analytics.d.cts +63 -1
  22. package/dist/analytics.d.ts +63 -1
  23. package/dist/analytics.js +4 -4
  24. package/dist/artifact-integrity.json +86 -90
  25. package/dist/assets-BIMVwjQe.js +231 -0
  26. package/dist/assets-Dfs2ElxI.cjs +1 -0
  27. package/dist/{auto-YR7a4BtF.js → auto-BIOmtVhk.js} +14 -14
  28. package/dist/{auto-uVBjX1j5.cjs → auto-DDHflI9v.cjs} +1 -1
  29. package/dist/computed-BW5a8QFk.js +612 -0
  30. package/dist/computed-C2GD3XcE.cjs +1 -0
  31. package/dist/dataset-DL83majE.js +161 -0
  32. package/dist/dataset-IrlXbUvh.cjs +1 -0
  33. package/dist/{designer-BfQSahxq.js → designer-D9XAxqSc.js} +1194 -1179
  34. package/dist/designer-uCDo5XSK.cjs +2 -0
  35. package/dist/designer.cjs +1 -1
  36. package/dist/designer.d.cts +125 -3
  37. package/dist/designer.d.ts +125 -3
  38. package/dist/designer.js +1 -1
  39. package/dist/{drill-CsdjgkRM.cjs → drill-ByN8COs_.cjs} +1 -1
  40. package/dist/{drill-DIGsZfyB.js → drill-CKW3Xtfa.js} +11 -11
  41. package/dist/{encoding-BYF9ZTl9.cjs → encoding-BFMFIc4r.cjs} +1 -1
  42. package/dist/{encoding-BOGq4qYL.js → encoding-DP_Eaf0A.js} +2 -2
  43. package/dist/{font-loader-EKLzOJxf.cjs → font-loader-7FWVlykp.cjs} +1 -1
  44. package/dist/{font-loader-CzI1GuBc.js → font-loader-CQZowp0I.js} +1 -1
  45. package/dist/index.cjs +8 -8
  46. package/dist/index.d.cts +173 -1
  47. package/dist/index.d.ts +173 -1
  48. package/dist/index.js +1205 -808
  49. package/dist/json-snapshot-D7PE1NsU.cjs +2 -0
  50. package/dist/{json-snapshot-D6ioHth9.js → json-snapshot-DYmEe3sO.js} +769 -692
  51. package/dist/matrix-JLAXlux-.js +302 -0
  52. package/dist/matrix-gTHpDTGm.cjs +1 -0
  53. package/dist/{pdf-ByVCb1i6.cjs → pdf-B8JouyYv.cjs} +47 -47
  54. package/dist/{pdf-DJ5S6ukC.js → pdf-l3ea86di.js} +13 -15
  55. package/dist/pdf.cjs +1 -1
  56. package/dist/pdf.d.cts +12 -0
  57. package/dist/pdf.d.ts +12 -0
  58. package/dist/pdf.js +2 -2
  59. package/dist/{plugin-C2j5_mhx.js → plugin-BBp74CQZ.js} +1 -1
  60. package/dist/{plugin-Dr39GBRG.cjs → plugin-CtFX9PFG.cjs} +1 -1
  61. package/dist/{prepared-DqtpvRTn.js → prepared-CARicKYh.js} +1 -1
  62. package/dist/{prepared-DdrjLC7L.cjs → prepared-Ch1x_Gog.cjs} +1 -1
  63. package/dist/{protocol-BzwMP4Vw.cjs → protocol-B5A2uom4.cjs} +1 -1
  64. package/dist/{protocol-kt4Iy6-3.js → protocol-BaiWjq5w.js} +3 -3
  65. package/dist/{record-bindings-DUX1VMlR.cjs → record-bindings-B86Sur_y.cjs} +1 -1
  66. package/dist/{record-bindings-CZWBJ1fU.js → record-bindings-D4TuMzHs.js} +1 -1
  67. package/dist/{region-binding-workflow-CWNvIjkV.js → region-binding-workflow-BNasF5kz.js} +2 -2
  68. package/dist/{region-binding-workflow-CqSMxQ4p.cjs → region-binding-workflow-O2Cni3mF.cjs} +1 -1
  69. package/dist/report-encoding-worker.cjs +1 -1
  70. package/dist/report-encoding-worker.js +1 -1
  71. package/dist/runtime-DakRXui3.js +170 -0
  72. package/dist/runtime-dL5ygIfa.cjs +1 -0
  73. package/dist/sbom.cdx.json +1 -1
  74. package/dist/server/node.d.cts +46 -0
  75. package/dist/server/node.d.ts +46 -0
  76. package/dist/server-node.cjs +4 -4
  77. package/dist/server-node.js +2540 -1911
  78. package/dist/server.cjs +1 -1
  79. package/dist/server.d.cts +174 -1
  80. package/dist/server.d.ts +174 -1
  81. package/dist/server.js +787 -544
  82. package/dist/style.css +1 -1
  83. package/dist/template-catalog-Dua8h9ZA.cjs +1 -0
  84. package/dist/{template-catalog-BtR2JmCL.js → template-catalog-wT1fNeAP.js} +4 -4
  85. package/dist/{template-fragments-BVsbxs4a.cjs → template-fragments-BajTajb4.cjs} +1 -1
  86. package/dist/{template-fragments-By0aZC1D.js → template-fragments-DmX5XK4N.js} +1 -1
  87. package/dist/{template-registry-C62vpv4a.cjs → template-registry-CpysHAxy.cjs} +1 -1
  88. package/dist/{template-registry-Cw3vRTX2.js → template-registry-u11fPd8D.js} +5 -5
  89. package/dist/{tree-BX380Rr7.cjs → tree-CLpxYbKa.cjs} +1 -1
  90. package/dist/{tree-CjVZLRw7.js → tree-DNJorJUf.js} +1 -1
  91. package/dist/vue/async.d.cts +108 -2
  92. package/dist/vue/async.d.ts +108 -2
  93. package/dist/vue/index.d.cts +130 -3
  94. package/dist/vue/index.d.ts +130 -3
  95. package/dist/vue-async.cjs +1 -1
  96. package/dist/vue-async.js +3 -3
  97. package/dist/vue.cjs +1 -1
  98. package/dist/vue.js +4 -4
  99. package/dist/{workbook-session-BeSO8PFB.js → workbook-session-B8pNW24X.js} +1 -1
  100. package/dist/{workbook-session-Cbts-22R.cjs → workbook-session-DN5LSA5C.cjs} +1 -1
  101. package/dist/worker.cjs +1 -1
  102. package/dist/worker.js +4 -4
  103. package/dist/xlsx.cjs +4 -4
  104. package/dist/xlsx.d.cts +88 -2
  105. package/dist/xlsx.d.ts +88 -2
  106. package/dist/xlsx.js +232 -230
  107. package/package.json +1 -1
  108. package/dist/ReportPreview-BcDKCLiK.js +0 -4834
  109. package/dist/ReportPreview-Bk9nLfO9.cjs +0 -6
  110. package/dist/RuleEditor-BX5S8RSF.cjs +0 -1
  111. package/dist/RuleEditor-CGl9XY2s.js +0 -2037
  112. package/dist/assets-CqIbfbTr.js +0 -126
  113. package/dist/assets-e4YSke8n.cjs +0 -1
  114. package/dist/capabilities-DDwXr_cA.js +0 -103
  115. package/dist/capabilities-DNLyZdNw.cjs +0 -1
  116. package/dist/computed-C-4C2S5h.js +0 -521
  117. package/dist/computed-CGV2a809.cjs +0 -1
  118. package/dist/dataset-BkRmwgeJ.cjs +0 -1
  119. package/dist/dataset-H5pFuQGU.js +0 -121
  120. package/dist/designer-CPPdeM5_.cjs +0 -2
  121. package/dist/diagnostic-notification-B9K9We3h.cjs +0 -1
  122. package/dist/diagnostic-notification-qGAYZdkB.js +0 -7
  123. package/dist/json-snapshot-DknkjvxP.cjs +0 -2
  124. package/dist/matrix-CGRGkn5s.js +0 -112
  125. package/dist/matrix-gEO7ZM_u.cjs +0 -1
  126. package/dist/runtime-BjKBI530.js +0 -168
  127. package/dist/runtime-CBFEPKEs.cjs +0 -1
  128. package/dist/template-catalog-C2NLdrwB.cjs +0 -1
@@ -1,36 +1,96 @@
1
- import { R as X } from "./component-tree-Ca6YYfHq.js";
2
- import { r as ue, b as xt, i as Tt, f as A, D as Ie, L as Ee } from "./style-67OqfNed.js";
3
- import { w as Y, h as Ce } from "./textwrap-BEIg2w8y.js";
4
- import { R as E, g as Oe, b as Pt, i as $t, e as H, l as fe, c as kt, t as Fe, h as Ke, f as Ae, j as Rt, k as It } from "./record-bindings-CZWBJ1fU.js";
5
- import { e as Ne, b as Et } from "./computed-C-4C2S5h.js";
6
- import { e as Ct, c as Ot } from "./matrix-CGRGkn5s.js";
7
- import { f as je, a as Ft, c as Kt } from "./tree-CjVZLRw7.js";
8
- import { i as At, r as Nt, j as jt, a as Le, v as Lt, R as Ht } from "./template-registry-Cw3vRTX2.js";
9
- import { g as Dt } from "./report-params-B1RzkhJj.js";
10
- import { a as xe } from "./param-validation-Do7Eg8Zv.js";
11
- import { r as me } from "./grid-geometry-BNptEcMm.js";
12
- import { f as Bt, i as Gt } from "./number-format-BA_KwrZe.js";
13
- import { d as Wt, v as Vt } from "./dataset-H5pFuQGU.js";
14
- function Jt(e, t, r) {
1
+ import { R as Q } from "./component-tree-Ca6YYfHq.js";
2
+ import { r as Z, L as ge, b as $t, i as Rt, f as N, D as Ce } from "./style-67OqfNed.js";
3
+ import { w as J, h as Oe } from "./textwrap-BEIg2w8y.js";
4
+ import { c as Fe, R as E, g as Ae, b as It, i as Et, e as H, l as he, t as Ne, h as Ke, f as je, j as Ct, k as Ot } from "./record-bindings-D4TuMzHs.js";
5
+ import { e as Le, b as Ft, k as At, r as Nt } from "./computed-BW5a8QFk.js";
6
+ import { c as Kt, e as jt } from "./matrix-JLAXlux-.js";
7
+ import { r as ee } from "./grid-geometry-BNptEcMm.js";
8
+ import { f as He, a as Lt, c as Ht } from "./tree-DNJorJUf.js";
9
+ import { i as Dt, r as Gt, j as Bt, b as De, v as Wt, R as Vt } from "./template-registry-u11fPd8D.js";
10
+ import { g as Jt } from "./report-params-B1RzkhJj.js";
11
+ import { a as Te } from "./param-validation-Do7Eg8Zv.js";
12
+ import { f as zt, i as _t } from "./number-format-BA_KwrZe.js";
13
+ import { v as Ge, d as qt } from "./dataset-DL83majE.js";
14
+ const Ut = 4096, Pe = 128 * 1024;
15
+ function Xt(e) {
16
+ const t = /* @__PURE__ */ new Map();
17
+ let r = 0;
18
+ return { measureMm(o, n) {
19
+ const a = JSON.stringify([o, n.fontSizePt, n.fontFamily, n.bold, n.italic, n.letterSpacingPt]), s = t.get(a);
20
+ if (s !== void 0)
21
+ return t.delete(a), t.set(a, s), s;
22
+ const i = e.measureMm(o, n);
23
+ if (Number.isFinite(i) && a.length <= Pe) {
24
+ for (; t.size >= Ut || r + a.length > Pe; ) {
25
+ const c = t.keys().next().value;
26
+ r -= c.length, t.delete(c);
27
+ }
28
+ t.set(a, i), r += a.length;
29
+ }
30
+ return i;
31
+ } };
32
+ }
33
+ function Yt(e, t) {
34
+ return { member: "body", subtotal: "subtotal", total: "grand-total" }[e?.rows.get(t)?.kind ?? "member"];
35
+ }
36
+ function Qt(e) {
37
+ const t = e.matrix;
38
+ if (!t.hierarchy) return t;
39
+ const r = new Map(e.columns.map((n) => [n.field, n.header])), o = { sum: "求和", count: "计数", avg: "平均", min: "最小", max: "最大", weightedAvg: "加权平均" };
40
+ return { ...t, hierarchy: {
41
+ ...t.hierarchy,
42
+ row: { ...t.hierarchy.row, labels: t.hierarchy.row?.labels ?? t.rowFields.map((n) => r.get(n) ?? n) },
43
+ column: { ...t.hierarchy.column, labels: t.hierarchy.column?.labels ?? t.columnFields.map((n) => r.get(n) ?? n) }
44
+ }, measures: t.measures.map((n) => {
45
+ const a = r.get(n.field) ?? r.get(n.valueField ?? n.field);
46
+ return n.label === void 0 && a ? { ...n, label: `${a}(${o[n.op]})` } : n;
47
+ }) };
48
+ }
49
+ function Zt(e, t) {
50
+ if (!e.matrix) return { list: e, rows: t };
51
+ if (e.detail || e.groupBy || e.groups?.length || e.grandTotal) throw new Error("矩阵不能同时配置普通分组、总计或主从明细");
52
+ const r = Kt(t, Qt(e)), o = r.columns.map((i) => ({ ...i, widthMm: i.semanticRole === "dimension" ? e.matrix.rowWidthMm ?? 40 : e.matrix.columnWidthMm ?? 28, editable: !1, align: i.semanticRole === "dimension" ? "center" : "right" })), n = { ...e, columns: o, headerGrid: r.headerGrid, rowKey: void 0, revisionField: void 0, sourceTokenField: void 0 };
53
+ e.layout === "wide" && (n.widthMm = o.reduce((i, c) => i + c.widthMm, 0));
54
+ const a = r.metadata, s = a ? { rows: new WeakMap(r.rows.map((i, c) => [i, a.rows[c]])), header: {
55
+ columns: a.columns,
56
+ rowFields: a.rowFields,
57
+ rowLabels: a.rowLabels,
58
+ columnFields: a.columnFields,
59
+ columnLabels: a.columnLabels
60
+ } } : void 0;
61
+ return { list: n, rows: r.rows, ...s ? { matrix: s } : {} };
62
+ }
63
+ function er(e, t) {
64
+ if (!e.matrix?.hierarchy || !e.headerGrid) return e.headerGrid;
65
+ const r = e.paddingMm ?? 1, o = e.headerGrid.cells.map(() => e.rowHeightMm ?? 0), n = e.columns.map((c) => c.widthMm), a = ee({ ...e.headerGrid, colWidthsMm: n }, n.reduce((c, l) => c + l, 0), o.length), s = /* @__PURE__ */ new WeakMap();
66
+ for (const { cell: c, ci: l, ri: d, widthMm: f } of a.cells) {
67
+ const u = { ...Fe(e, e.columns[l]), ...c.style }, m = Z(u).fontSizePt, g = (J(c.text ?? "", Math.max(1, f - r * 2), { fontSizePt: m, fontFamily: u.fontFamily, bold: u.bold, italic: u.italic, letterSpacingPt: u.letterSpacing }, t).length * m * (u.lineHeight ?? ge) * 25.4 / 72 + r * 2) / (c.rowSpan ?? 1);
68
+ for (let p = d; p < d + (c.rowSpan ?? 1); p++) o[p] = Math.max(o[p] ?? 0, g);
69
+ s.set(c, u);
70
+ }
71
+ const i = e.headerGrid.cells.map((c) => c.map((l) => l ? { ...l, style: s.get(l) } : null));
72
+ return { ...e.headerGrid, cells: i, rowHeightsMm: o };
73
+ }
74
+ function tr(e, t, r) {
15
75
  const o = /* @__PURE__ */ new Set(), n = e.cells.map((a, s) => {
16
76
  const i = [];
17
77
  let c = 0;
18
- for (const d of a) {
78
+ for (const l of a) {
19
79
  for (; o.has(`${s}:${c}`); ) c++;
20
- const l = d?.colSpan ?? 1, f = d?.rowSpan ?? 1;
80
+ const d = l?.colSpan ?? 1, f = l?.rowSpan ?? 1;
21
81
  let u = 0;
22
- for (let m = c; m < c + l; m++) {
82
+ for (let m = c; m < c + d; m++) {
23
83
  t.has(m) && u++;
24
84
  for (let h = s + 1; h < s + f; h++)
25
85
  o.add(`${h}:${m}`);
26
86
  }
27
- u && i.push(d ? { ...d, colSpan: u } : null), c += l;
87
+ u && i.push(l ? { ...l, colSpan: u } : null), c += d;
28
88
  }
29
89
  return i;
30
90
  });
31
91
  return { ...e, cells: n, colWidthsMm: r };
32
92
  }
33
- function zt(e) {
93
+ function rr(e) {
34
94
  if (!e.columns.some((o) => o.hidden)) return e;
35
95
  const t = /* @__PURE__ */ new Set(), r = e.columns.filter((o, n) => o.hidden ? !1 : (t.add(n), !0));
36
96
  if (!r.length) throw new Error("列表至少需要一列可见列");
@@ -38,7 +98,7 @@ function zt(e) {
38
98
  ...e,
39
99
  columns: r,
40
100
  ...e.headerGrid ? {
41
- headerGrid: Jt(
101
+ headerGrid: tr(
42
102
  e.headerGrid,
43
103
  t,
44
104
  r.map((o) => o.widthMm)
@@ -46,34 +106,34 @@ function zt(e) {
46
106
  } : {}
47
107
  };
48
108
  }
49
- function* _t(e) {
109
+ function* or(e) {
50
110
  const { page: t } = e;
51
- At(t.components, t.flow);
111
+ Dt(t.components, t.flow);
52
112
  let r = 0, o = 0;
53
- for (const n of Nt(t.components, t.flow)) {
113
+ for (const n of Gt(t.components, t.flow)) {
54
114
  e.active();
55
- const a = n.band, s = n.components.some((l) => l.kind === "list" && l.cardinality !== "record"), i = s ? 0 : n.components.reduce((l, f) => Math.max(l, f.topMm - a.topMm + (f.kind === "list" ? e.height(f) : f.heightMm)), a.heightMm);
115
+ const a = n.band, s = n.components.some((d) => d.kind === "list" && d.cardinality !== "record"), i = s ? 0 : n.components.reduce((d, f) => Math.max(d, f.topMm - a.topMm + (f.kind === "list" ? e.height(f) : f.heightMm)), a.heightMm);
56
116
  let c = Math.max(e.top(), o + a.topMm - r);
57
117
  if (!s && i > e.bottom() - e.top() + 1e-3) throw new Error(`静态区域 ${a.componentIds.join(",")} 高度超出单页可用范围`);
58
118
  !s && c + i > e.bottom() + 1e-3 && (e.nextPage(), yield* e.takePages(), e.active(), c = e.top());
59
- let d = c + i;
60
- for (const l of n.components) {
61
- const f = c + l.topMm - a.topMm;
62
- l.kind === "list" ? (yield* e.list(l, f, (u) => {
63
- d = s ? u : Math.max(d, u);
64
- }), e.active()) : e.append({ ...l, topMm: f });
119
+ let l = c + i;
120
+ for (const d of n.components) {
121
+ const f = c + d.topMm - a.topMm;
122
+ d.kind === "list" ? (yield* e.list(d, f, (u) => {
123
+ l = s ? u : Math.max(l, u);
124
+ }), e.active()) : e.append({ ...d, topMm: f });
65
125
  }
66
- o = d, r = a.topMm + a.heightMm;
126
+ o = l, r = a.topMm + a.heightMm;
67
127
  }
68
128
  }
69
- function qt(e) {
129
+ function nr(e) {
70
130
  return !!(e.computed?.length || e.groups?.length || e.groupBy || e.grandTotal || e.rowVisibleWhen || e.matrix || e.tree || e.detail || e.columns.some((t) => t.rules?.length || t.visibleWhen));
71
131
  }
72
- function Q(e) {
73
- return e.pages.some((t) => t.components.some((r) => r.kind === "list" && qt(r)));
132
+ function te(e) {
133
+ return e.pages.some((t) => t.components.some((r) => r.kind === "list" && nr(r)));
74
134
  }
75
- const Ut = 512, Te = 256 * 1024;
76
- function Xt() {
135
+ const ar = 512, ke = 256 * 1024;
136
+ function sr() {
77
137
  const e = /* @__PURE__ */ new Map();
78
138
  let t = 0, r;
79
139
  return (o, n, a, s) => {
@@ -81,18 +141,18 @@ function Xt() {
81
141
  const i = JSON.stringify([o, n, a.fontSizePt, a.fontFamily, a.bold, a.italic, a.letterSpacingPt]), c = e.get(i);
82
142
  if (c)
83
143
  return e.delete(i), e.set(i, c), c.lines.slice();
84
- const d = Y(o, n, a, s), l = i.length + d.reduce((f, u) => f + u.length, 0);
85
- if (l <= Te) {
86
- for (; e.size >= Ut || t + l > Te; ) {
144
+ const l = J(o, n, a, s), d = i.length + l.reduce((f, u) => f + u.length, 0);
145
+ if (d <= ke) {
146
+ for (; e.size >= ar || t + d > ke; ) {
87
147
  const f = e.keys().next().value;
88
148
  t -= e.get(f).units, e.delete(f);
89
149
  }
90
- e.set(i, { lines: d.slice(), units: l }), t += l;
150
+ e.set(i, { lines: l.slice(), units: d }), t += d;
91
151
  }
92
- return d;
152
+ return l;
93
153
  };
94
154
  }
95
- class N extends Error {
155
+ class K extends Error {
96
156
  constructor(t, r) {
97
157
  super(`报表页数超出上限 ${t}(至少 ${r} 页)`), this.limit = t, this.actual = r, this.code = "page-limit", this.name = "PaginatePageLimitError";
98
158
  }
@@ -102,98 +162,98 @@ class D extends Error {
102
162
  super(`报表单元格数量超出上限 ${t}(至少 ${r} 格)`), this.limit = t, this.actual = r, this.code = "cell-limit", this.name = "PaginateCellLimitError";
103
163
  }
104
164
  }
105
- const Yt = 1e4, Pe = 25e4;
106
- function ge(e) {
165
+ const ir = 1e4, $e = 25e4;
166
+ function pe(e) {
107
167
  if (e?.aborted) throw e.reason ?? new DOMException("标签生成已取消", "AbortError");
108
168
  }
109
- function He(e, t, r) {
110
- const o = typeof e.copies == "object" ? Oe(t, e.copies.field, r) : e.copies ?? 1;
169
+ function Be(e, t, r) {
170
+ const o = typeof e.copies == "object" ? Ae(t, e.copies.field, r) : e.copies ?? 1;
111
171
  if (typeof o != "number" || !Number.isSafeInteger(o) || o < 1 || o > 1e3) throw new E(`$.datasets.${r.dataset}[${r.rowIndex}]`, "每条记录复制数必须是 1..1000 的数值型整数", r.rowIndex, typeof e.copies == "object" ? e.copies.field : void 0);
112
172
  return o;
113
173
  }
114
- function De(e, t, r) {
174
+ function We(e, t, r) {
115
175
  if (e.rowKey === void 0) return;
116
- const o = Oe(t, e.rowKey, r);
176
+ const o = Ae(t, e.rowKey, r);
117
177
  if (typeof o == "string" && o.trim() || typeof o == "number" && Number.isFinite(o)) return o;
118
178
  throw new E(`$.datasets.${r.dataset}[${r.rowIndex}].${e.rowKey}`, "业务主键必须是非空字符串或有限数字", r.rowIndex, e.rowKey);
119
179
  }
120
- function Qt(e) {
180
+ function cr(e) {
121
181
  const t = (r) => 1 + (r.grid?.cells.reduce((o, n) => o + 1 + n.length + n.reduce((a, s) => a + (s?.children?.reduce((i, c) => i + t(c), 0) ?? 0), 0), 0) ?? 0);
122
182
  return e.pages.reduce((r, o) => r + o.components.reduce((n, a) => n + t(a), 0), 0);
123
183
  }
124
- function Zt(e, t, r) {
184
+ function lr(e, t, r) {
125
185
  const o = e.repeat, n = Object.prototype.hasOwnProperty.call(t, o.dataset) ? t[o.dataset] : void 0;
126
186
  if (!Array.isArray(n)) throw new E(`$.datasets.${o.dataset}`, "逐记录标签数据集缺失,应提供对象数组(允许空数组)");
127
- const a = /* @__PURE__ */ new Set(), s = r.maxPages ?? Yt, i = Qt(e);
128
- let c = 0, d = 0;
129
- for (const [l, f] of n.entries()) {
130
- if (ge(r.signal), !f || typeof f != "object" || Array.isArray(f)) throw new E(`$.datasets.${o.dataset}[${l}]`, "标签记录应为对象", l);
131
- const u = { rowIndex: l, dataset: o.dataset }, m = De(o, f, u);
187
+ const a = /* @__PURE__ */ new Set(), s = r.maxPages ?? ir, i = cr(e);
188
+ let c = 0, l = 0;
189
+ for (const [d, f] of n.entries()) {
190
+ if (pe(r.signal), !f || typeof f != "object" || Array.isArray(f)) throw new E(`$.datasets.${o.dataset}[${d}]`, "标签记录应为对象", d);
191
+ const u = { rowIndex: d, dataset: o.dataset }, m = We(o, f, u);
132
192
  if (m !== void 0) {
133
193
  const g = JSON.stringify([typeof m, m]);
134
- if (a.has(g)) throw new E(`$.datasets.${o.dataset}[${l}].${o.rowKey}`, "业务主键重复;请先确认记录来源,避免重复打印标签", l, o.rowKey);
194
+ if (a.has(g)) throw new E(`$.datasets.${o.dataset}[${d}].${o.rowKey}`, "业务主键重复;请先确认记录来源,避免重复打印标签", d, o.rowKey);
135
195
  a.add(g);
136
196
  }
137
- const h = He(o, f, u);
138
- if (c += h * e.pages.length, d += h * i, c > s) throw new N(s, c);
139
- if (d > Pe) throw new E("$.repeat", `标签组件总量(含网格行、槽位及嵌套组件)超过安全预算 ${Pe},请分批生成`, l);
197
+ const h = Be(o, f, u);
198
+ if (c += h * e.pages.length, l += h * i, c > s) throw new K(s, c);
199
+ if (l > $e) throw new E("$.repeat", `标签组件总量(含网格行、槽位及嵌套组件)超过安全预算 ${$e},请分批生成`, d);
140
200
  }
141
201
  return n;
142
202
  }
143
- function er(e, t, r) {
203
+ function dr(e, t, r) {
144
204
  if (!e.binding) return e;
145
- const { binding: o, ...n } = e, a = Pt(o, t.row, t);
205
+ const { binding: o, ...n } = e, a = It(o, t.row, t);
146
206
  if (e.kind === "image") {
147
207
  if (!a) return;
148
- if (!$t(a)) throw new E(`${r}.binding`, "图片字段只接受 PNG/JPEG base64 data URL;业务 URL 应由宿主安全加载后转换", t.rowIndex, o.field);
208
+ if (!Et(a)) throw new E(`${r}.binding`, "图片字段只接受 PNG/JPEG base64 data URL;业务 URL 应由宿主安全加载后转换", t.rowIndex, o.field);
149
209
  return { ...n, imageData: a };
150
210
  }
151
211
  return e.kind === "barcode" || e.kind === "qrcode" ? (delete n.imageData, { ...n, code: { ...n.code, value: a }, fallbackText: a }) : (delete n.lines, delete n.richParagraphs, { ...n, text: a });
152
212
  }
153
- function tr(e, t, r) {
213
+ function ur(e, t, r) {
154
214
  if (e.kind !== "text" || e.grid || e.richParagraphs?.length) return e;
155
- const o = e.style ?? {}, n = ue(o).fontSizePt, a = e.text ?? e.lines?.join(`
215
+ const o = e.style ?? {}, n = Z(o).fontSizePt, a = e.text ?? e.lines?.join(`
156
216
  `) ?? "";
157
217
  if (a.length > 16384) throw new E(r, "标签文本超过 16384 字符预算,请缩小字段内容", t.rowIndex);
158
- const s = t.wrapText(a, e.widthMm, { fontSizePt: n, bold: o.bold, italic: o.italic, fontFamily: o.fontFamily, letterSpacingPt: o.letterSpacing }, t.options.measurer ?? Ce), i = s.length * n * xt(o) * 25.4 / 72;
218
+ const s = t.wrapText(a, e.widthMm, { fontSizePt: n, bold: o.bold, italic: o.italic, fontFamily: o.fontFamily, letterSpacingPt: o.letterSpacing }, t.options.measurer ?? Oe), i = s.length * n * $t(o) * 25.4 / 72;
159
219
  if (i > e.heightMm + 0.05) throw new E(r, `标签文字需要约 ${i.toFixed(2)}mm 高,超出 ${e.heightMm}mm;请增大文本区域、减少内容或调整字号`, t.rowIndex, e.binding?.field);
160
220
  return { ...e, lines: s };
161
221
  }
162
- function Be(e, t, r) {
163
- ge(t.options.signal);
164
- const o = er(e, t, r);
222
+ function Ve(e, t, r) {
223
+ pe(t.options.signal);
224
+ const o = dr(e, t, r);
165
225
  if (!o) return;
166
226
  let n = o.grid;
167
- return n && (n = { ...n, cells: n.cells.map((a, s) => a.map((i, c) => i?.children?.length ? { ...i, children: i.children.flatMap((d, l) => {
168
- const f = Be(d, t, `${r}.grid.cells.${s}.${c}.children.${l}`);
227
+ return n && (n = { ...n, cells: n.cells.map((a, s) => a.map((i, c) => i?.children?.length ? { ...i, children: i.children.flatMap((l, d) => {
228
+ const f = Ve(l, t, `${r}.grid.cells.${s}.${c}.children.${d}`);
169
229
  return f ? [f] : [];
170
- }) } : i)) }), tr(n === o.grid ? o : { ...o, grid: n }, t, r);
230
+ }) } : i)) }), ur(n === o.grid ? o : { ...o, grid: n }, t, r);
171
231
  }
172
- function rr(e, t, r, o, n, a) {
232
+ function fr(e, t, r, o, n, a) {
173
233
  return {
174
234
  ...e,
175
235
  components: e.components.flatMap((s, i) => {
176
- const c = Be(s, r, `$.pages.${t}.components.${i}`);
236
+ const c = Ve(s, r, `$.pages.${t}.components.${i}`);
177
237
  return c ? [{ ...c, meta: { ...c.meta, labelSource: { pageIndex: t, componentIndex: i } } }] : [];
178
238
  }),
179
239
  meta: { ...e.meta, record: { dataset: r.dataset, rowIndex: r.rowIndex, ...a === void 0 ? {} : { rowKey: a }, copyIndex: o, copyCount: n, templatePageIndex: t } }
180
240
  };
181
241
  }
182
- function* or(e, t, r) {
242
+ function* mr(e, t, r) {
183
243
  const o = [];
184
- if (jt(e, o), o.length) throw new E(o[0].path, o[0].message);
244
+ if (Bt(e, o), o.length) throw new E(o[0].path, o[0].message);
185
245
  if (!e.repeat) {
186
246
  for (const [i, c] of e.pages.entries()) yield { page: c, pageIndex: i };
187
247
  return;
188
248
  }
189
- const n = e.repeat, a = Zt(e, t, r), s = Xt();
249
+ const n = e.repeat, a = lr(e, t, r), s = sr();
190
250
  for (const [i, c] of a.entries()) {
191
- const d = { row: c, rowIndex: i, dataset: n.dataset, options: r, wrapText: s }, l = He(n, c, d), f = De(n, c, d);
192
- for (let u = 0; u < l; u++) for (const [m, h] of e.pages.entries())
193
- ge(r.signal), yield { page: rr(h, m, d, u, l, f), pageIndex: m };
251
+ const l = { row: c, rowIndex: i, dataset: n.dataset, options: r, wrapText: s }, d = Be(n, c, l), f = We(n, c, l);
252
+ for (let u = 0; u < d; u++) for (const [m, h] of e.pages.entries())
253
+ pe(r.signal), yield { page: fr(h, m, l, u, d, f), pageIndex: m };
194
254
  }
195
255
  }
196
- function nr(e) {
256
+ function gr(e) {
197
257
  return {
198
258
  widthMm: e.widthMm,
199
259
  heightMm: e.heightMm,
@@ -204,67 +264,67 @@ function nr(e) {
204
264
  components: []
205
265
  };
206
266
  }
207
- function q(e, t) {
267
+ function U(e, t) {
208
268
  const r = t.heightMm - (e.layout === "wide" ? t.marginBottomMm : e.marginBottomMm ?? t.marginBottomMm);
209
269
  return e.components.reduce((o, n) => n.kind !== "list" && n.pageAnchor === "footer" ? Math.min(o, n.topMm) : o, r);
210
270
  }
211
- function G(e) {
271
+ function B(e) {
212
272
  return e.components.reduce((t, r) => r.kind !== "list" && r.pageAnchor === "header" ? Math.max(t, r.topMm + r.heightMm) : t, 0);
213
273
  }
214
- function Ge(e, t) {
274
+ function Je(e, t) {
215
275
  let r = e.textMetrics.get(t);
216
276
  if (!r) {
217
- const o = ue(t).fontSizePt;
277
+ const o = Z(t).fontSizePt;
218
278
  r = {
219
279
  measureOptions: {
220
280
  fontSizePt: o,
221
- fontFamily: t.fontFamily ?? Ie,
281
+ fontFamily: t.fontFamily ?? Ce,
222
282
  italic: t.italic,
223
283
  bold: t.bold,
224
284
  letterSpacingPt: t.letterSpacing
225
285
  },
226
- lineMm: o * (t.lineHeight ?? Ee) * 25.4 / 72
286
+ lineMm: o * (t.lineHeight ?? ge) * 25.4 / 72
227
287
  }, e.textMetrics.set(t, r);
228
288
  }
229
289
  return r;
230
290
  }
231
- function ar(e) {
291
+ function hr(e) {
232
292
  if (e === null || typeof e == "string" || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e)) return e;
233
293
  }
234
- function he(e, t) {
235
- const r = e.fontSizePt ?? Tt, o = e.paddingMm ?? 1, n = e.columns.map((g) => g.align ?? g.style?.align ?? e.align ?? "left"), a = e.columns.map((g, w) => ({
236
- ...A({
294
+ function we(e, t) {
295
+ const r = e.fontSizePt ?? Rt, o = e.paddingMm ?? 1, n = e.columns.map((g) => g.align ?? g.style?.align ?? e.align ?? "left"), a = e.columns.map((g, p) => ({
296
+ ...N({
237
297
  fontSize: r,
238
298
  verticalAlign: "middle"
239
299
  }, g.style),
240
- align: n[w] === "auto" ? "left" : n[w]
241
- })), s = a.map((g, w) => n[w] === "auto" ? { left: g, center: { ...g, align: "center" }, right: { ...g, align: "right" } } : void 0), i = e.columns.map((g, w) => g.rules?.map((y) => {
242
- const v = s[w];
243
- if (v) return {
244
- left: A(v.left, y.style),
245
- center: A(v.center, y.style),
246
- right: A(v.right, y.style)
300
+ align: n[p] === "auto" ? "left" : n[p]
301
+ })), s = a.map((g, p) => n[p] === "auto" ? { left: g, center: { ...g, align: "center" }, right: { ...g, align: "right" } } : void 0), i = e.columns.map((g, p) => g.rules?.map((b) => {
302
+ const M = s[p];
303
+ if (M) return {
304
+ left: N(M.left, b.style),
305
+ center: N(M.center, b.style),
306
+ right: N(M.right, b.style)
247
307
  };
248
- const T = A(a[w], y.style);
308
+ const T = N(a[p], b.style);
249
309
  return { left: T, center: T, right: T };
250
- })), c = e.columns.map((g) => kt(e, g)), d = e.columns.map((g) => g.header);
251
- let l = e.rowHeightMm ?? 0;
252
- for (let g = 0; g < d.length; g++) {
253
- const w = c[g], y = ue(w).fontSizePt, v = Y(
254
- d[g],
310
+ })), c = e.columns.map((g) => Fe(e, g)), l = e.columns.map((g) => g.header);
311
+ let d = e.rowHeightMm ?? 0;
312
+ for (let g = 0; g < l.length; g++) {
313
+ const p = c[g], b = Z(p).fontSizePt, M = J(
314
+ l[g],
255
315
  e.columns[g].widthMm - o * 2,
256
- { fontSizePt: y, fontFamily: w.fontFamily ?? Ie, italic: w.italic, bold: w.bold, letterSpacingPt: w.letterSpacing },
316
+ { fontSizePt: b, fontFamily: p.fontFamily ?? Ce, italic: p.italic, bold: p.bold, letterSpacingPt: p.letterSpacing },
257
317
  t
258
- ), T = y * (w.lineHeight ?? Ee) * 25.4 / 72;
259
- l = Math.max(l, Math.max(v.length, 1) * T + o * 2);
318
+ ), T = b * (p.lineHeight ?? ge) * 25.4 / 72;
319
+ d = Math.max(d, Math.max(M.length, 1) * T + o * 2);
260
320
  }
261
- const f = d.map((g, w) => ({
321
+ const f = l.map((g, p) => ({
262
322
  text: g,
263
- style: c[w]
264
- })), u = e.border === !1 ? { borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } : { borderBottom: !0, borderLeft: !0, borderRight: !0, borderTop: !0 }, m = e.columns.map((g) => g.widthMm), h = sr(e.headerGrid, m, {
323
+ style: c[p]
324
+ })), u = e.border === !1 ? { borderTop: !1, borderRight: !1, borderBottom: !1, borderLeft: !1 } : { borderBottom: !0, borderLeft: !0, borderRight: !0, borderTop: !0 }, m = e.columns.map((g) => g.widthMm), h = pr(er(e, t), m, {
265
325
  cells: [f],
266
326
  colWidthsMm: m,
267
- rowHeightsMm: [l],
327
+ rowHeightsMm: [d],
268
328
  paddingMm: o
269
329
  });
270
330
  return {
@@ -274,23 +334,23 @@ function he(e, t) {
274
334
  autoStyles: s,
275
335
  ruleStyles: i,
276
336
  textMetrics: /* @__PURE__ */ new WeakMap(),
277
- numberFormats: e.columns.map((g) => Fe(g.format)),
337
+ numberFormats: e.columns.map((g) => Ne(g.format)),
278
338
  derivedFields: new Set(e.computed?.map((g) => g.field)),
279
339
  borderStyle: u,
280
- headerHeightMm: h.rowHeightsMm.reduce((g, w) => g + w, 0),
340
+ headerHeightMm: h.rowHeightsMm.reduce((g, p) => g + p, 0),
281
341
  headerGrid: h,
282
342
  colWidthsMm: m,
283
343
  columns: e.columns
284
344
  };
285
345
  }
286
- function sr(e, t, r) {
346
+ function pr(e, t, r) {
287
347
  if (!e) return r;
288
348
  if (!e.cells.length) throw new Error("自定义列表表头至少需要一行");
289
349
  const o = e.rowHeightsMm ?? e.cells.map(() => r.rowHeightsMm[0]);
290
350
  if (o.length !== e.cells.length || o.some((n) => !Number.isFinite(n) || n <= 0)) throw new Error("自定义列表表头行高无效");
291
351
  return { ...e, colWidthsMm: t, rowHeightsMm: o };
292
352
  }
293
- function ir(e, t, r) {
353
+ function wr(e, t, r) {
294
354
  const o = t.format?.kind === "number" || t.format?.kind === "percent";
295
355
  t.valueType !== void 0 ? e.valueType = t.valueType : o && (e.valueType = "number"), t.editable !== void 0 && (e.editable = t.editable), (typeof e.value == "number" || e.value == null) && r !== void 0 && (e.numberFormat = r);
296
356
  }
@@ -299,42 +359,43 @@ function W(e, t, r) {
299
359
  let a = e.rowHeightFloorMm;
300
360
  const s = new Array(o.length);
301
361
  for (let i = 0; i < o.length; i++) {
302
- const c = o[i], d = c.visibleWhen && !H(t, c.visibleWhen) ? null : t[c.field], l = e.autoStyles[i] ? Ke(d, c.format, c.semanticRole) : "left";
303
- let f = e.autoStyles[i]?.[l] ?? e.cellStyles[i];
362
+ const c = o[i], l = c.visibleWhen && !H(t, c.visibleWhen) ? null : t[c.field], d = e.autoStyles[i] ? Ke(l, c.format, c.semanticRole) : "left";
363
+ let f = e.autoStyles[i]?.[d] ?? e.cellStyles[i];
304
364
  if (c.rules)
305
- for (let v = 0; v < c.rules.length; v++) {
306
- const T = c.rules[v];
365
+ for (let M = 0; M < c.rules.length; M++) {
366
+ const T = c.rules[M];
307
367
  if (H(t, T.when)) {
308
- f = e.ruleStyles[i][v][l];
368
+ f = e.ruleStyles[i][M][d];
309
369
  break;
310
370
  }
311
371
  }
312
- const u = c.format ? Ae(d, c.format) : fe(d), m = cr(e, c, n);
313
- f = lr(e, c, f, n);
314
- const h = Ge(e, f), g = Y(u, Math.max(1, c.widthMm - e.paddingMm * 2 - m), h.measureOptions, r);
372
+ const u = c.format ? je(l, c.format) : he(l), m = yr(e, c, n);
373
+ f = br(e, c, f, n);
374
+ const h = Je(e, f), g = J(u, Math.max(1, c.widthMm - e.paddingMm * 2 - m), h.measureOptions, r);
315
375
  a = Math.max(a, g.length * h.lineMm + e.paddingMm * 2);
316
- const w = ar(d), y = { text: u, style: f };
317
- w !== void 0 && (y.value = w), ir(y, c, e.numberFormats[i]), dr(y, c, e, n, m), e.derivedFields.has(c.field) && (y.derived = !0, y.editable = !1), c.visibleWhen && d === null && !H(t, c.visibleWhen) && (y.editable = !1), s[i] = y;
376
+ const p = hr(l), b = { text: u, style: f };
377
+ p !== void 0 && (b.value = p), wr(b, c, e.numberFormats[i]), Mr(b, c, e, n, m), e.derivedFields.has(c.field) && (b.derived = !0, b.editable = !1), c.visibleWhen && l === null && !H(t, c.visibleWhen) && (b.editable = !1), s[i] = b;
318
378
  }
319
379
  return {
320
380
  grid: { cells: [s], colWidthsMm: e.colWidthsMm, rowHeightsMm: [a], paddingMm: e.paddingMm },
321
- heightMm: a
381
+ heightMm: a,
382
+ ...e.matrix ? { meta: { matrix: { row: e.matrix.rows.get(t) } } } : {}
322
383
  };
323
384
  }
324
- function cr(e, t, r) {
325
- return !r || t.field !== e.tree.list.tree.labelField ? 0 : Rt(e.tree.list, t, r, e.paddingMm);
385
+ function yr(e, t, r) {
386
+ return !r || t.field !== e.tree.list.tree.labelField ? 0 : Ct(e.tree.list, t, r, e.paddingMm);
326
387
  }
327
- function lr(e, t, r, o) {
388
+ function br(e, t, r, o) {
328
389
  return !o || t.field !== e.tree.list.tree.labelField || r.align === "left" ? r : { ...r, align: "left" };
329
390
  }
330
- function dr(e, t, r, o, n = 0) {
331
- o && (n && (e.indentMm = n), It(e, t, o, r.tree.list));
391
+ function Mr(e, t, r, o, n = 0) {
392
+ o && (n && (e.indentMm = n), Ot(e, t, o, r.tree.list));
332
393
  }
333
- function We(e) {
394
+ function ze(e) {
334
395
  if (e != null && typeof e != "string" && typeof e != "boolean" && !(typeof e == "number" && Number.isFinite(e))) throw new Error("分组字段应为有限 JSON 标量");
335
396
  return JSON.stringify([typeof e, e ?? null]);
336
397
  }
337
- function* Ve(e, t, r = 0) {
398
+ function* _e(e, t, r = 0) {
338
399
  const o = t[r];
339
400
  if (!o) {
340
401
  for (const a of e) yield { kind: "row", row: a };
@@ -342,51 +403,51 @@ function* Ve(e, t, r = 0) {
342
403
  }
343
404
  const n = /* @__PURE__ */ new Map();
344
405
  for (const a of e) {
345
- const s = We(a[o.field]), i = n.get(s);
406
+ const s = ze(a[o.field]), i = n.get(s);
346
407
  i ? i.push(a) : n.set(s, [a]);
347
408
  }
348
409
  for (const a of n.values())
349
- yield { kind: "groupHeader", label: (o.headerTemplate ?? "{value}").replace(/\{value\}/g, fe(a[0][o.field])), firstRow: a[0], group: o, depth: r, rows: a }, yield* Ve(a, t, r + 1), (o.subtotal?.length || o.aggregates?.length) && (yield { kind: "subtotal", label: o.subtotalLabel ?? "小计", rows: a, group: o, depth: r }), yield { kind: "groupEnd", depth: r };
410
+ yield { kind: "groupHeader", label: (o.headerTemplate ?? "{value}").replace(/\{value\}/g, he(a[0][o.field])), firstRow: a[0], group: o, depth: r, rows: a }, yield* _e(a, t, r + 1), (o.subtotal?.length || o.aggregates?.length) && (yield { kind: "subtotal", label: o.subtotalLabel ?? "小计", rows: a, group: o, depth: r }), yield { kind: "groupEnd", depth: r };
350
411
  }
351
- function Je(e, t, r, o = []) {
412
+ function qe(e, t, r, o = []) {
352
413
  const n = [...r.filter((a) => !o.some((s) => s.field === a)).map((a) => ({ field: a, op: "sum" })), ...o];
353
414
  return new Map(n.map((a) => {
354
- const s = e.find((c) => c.field === a.field)?.format ?? { kind: "number", thousands: !0 }, i = Et(t, { ...a, field: a.valueField ?? a.field });
355
- return [a.field, { text: Ae(i, s), ...i === null ? {} : { value: i }, ...typeof i == "number" ? { numberFormat: Fe(s) } : {} }];
415
+ const s = e.find((c) => c.field === a.field)?.format ?? { kind: "number", thousands: !0 }, i = Ft(t, { ...a, field: a.valueField ?? a.field });
416
+ return [a.field, { text: je(i, s), ...i === null ? {} : { value: i }, ...typeof i == "number" ? { numberFormat: Ne(s) } : {} }];
356
417
  }));
357
418
  }
358
- function ze(e, t) {
419
+ function Ue(e, t) {
359
420
  const r = e.findIndex((o) => t.includes(o.field));
360
421
  return r < 0 ? 1 : r;
361
422
  }
362
- function B(e, t, r, o, n, a) {
363
- const s = [], i = Math.max(0, Math.min(a, e.columns.length)), c = A({ fontSize: e.fontSizePt }, n);
423
+ function G(e, t, r, o, n, a) {
424
+ const s = [], i = Math.max(0, Math.min(a, e.columns.length)), c = N({ fontSize: e.fontSizePt }, n);
364
425
  i && s.push({ text: r, colSpan: i, style: { bold: !0, ...c } });
365
426
  for (let u = i; u < e.columns.length; u++) {
366
427
  const m = e.columns[u], h = o.get(m.field), g = e.autoStyles[u]?.[Ke(h?.value, m.format)] ?? e.cellStyles[u];
367
- s.push({ ...h, text: h?.text ?? "", style: A(g, n) });
428
+ s.push({ ...h, text: h?.text ?? "", style: N(g, n) });
368
429
  }
369
- const d = { text: r, colSpan: e.columns.length, style: { bold: !0, ...c } }, l = i ? [s] : [[d], s], f = l.map((u) => ur(e, u, t));
430
+ const l = { text: r, colSpan: e.columns.length, style: { bold: !0, ...c } }, d = i ? [s] : [[l], s], f = d.map((u) => vr(e, u, t));
370
431
  return {
371
- grid: { cells: l, colWidthsMm: e.colWidthsMm, rowHeightsMm: f, paddingMm: e.paddingMm },
432
+ grid: { cells: d, colWidthsMm: e.colWidthsMm, rowHeightsMm: f, paddingMm: e.paddingMm },
372
433
  heightMm: f.reduce((u, m) => u + m, 0)
373
434
  };
374
435
  }
375
- function ur(e, t, r) {
436
+ function vr(e, t, r) {
376
437
  let o = e.rowHeightFloorMm, n = 0;
377
438
  for (const a of t) {
378
439
  let s = 0;
379
440
  const i = n + (a.colSpan ?? 1);
380
441
  for (; n < i; n++) s += e.colWidthsMm[n] ?? 0;
381
- const c = Ge(e, a.style), d = Y(a.text ?? "", s - e.paddingMm * 2, c.measureOptions, r);
382
- o = Math.max(o, d.length * c.lineMm + e.paddingMm * 2);
442
+ const c = Je(e, a.style), l = J(a.text ?? "", s - e.paddingMm * 2, c.measureOptions, r);
443
+ o = Math.max(o, l.length * c.lineMm + e.paddingMm * 2);
383
444
  }
384
445
  return o;
385
446
  }
386
- function fr(e, t, r) {
387
- const { templatePage: o, current: n, warnings: a, nextId: s, pushCurrent: i } = r, c = () => q(o, n), d = Math.max(n.marginTopMm, G(o)), l = o.layout === "wide" ? G(o) : d, f = {
447
+ function Sr(e, t, r) {
448
+ const { templatePage: o, current: n, warnings: a, nextId: s, pushCurrent: i } = r, c = () => U(o, n), l = Math.max(n.marginTopMm, B(o)), d = o.layout === "wide" ? B(o) : l, f = {
388
449
  id: r.tableId,
389
- columnKeys: e.columns.map((p) => p.field),
450
+ columnKeys: e.columns.map((w) => w.field),
390
451
  ...e.layout === void 0 ? {} : { layout: e.layout },
391
452
  ...e.title === void 0 ? {} : { title: e.title }
392
453
  }, u = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), h = {
@@ -399,54 +460,54 @@ function fr(e, t, r) {
399
460
  nid: s("listh"),
400
461
  table: { ...f, role: "header", rowIndex: -1 },
401
462
  style: t.borderStyle,
402
- ...e.meta ? { meta: e.meta } : {}
403
- }, g = (p) => n.components.push({ ...h, topMm: p });
404
- if (r.flow && e.header !== !1 && t.headerHeightMm > c() - d + 1e-3) throw new Error(`流式列表 ${e.id ?? e.dataset} 的表头高度超出单页可用范围`);
405
- let w = Math.max(r.startTop ?? e.topMm, d);
406
- e.header !== !1 && (g(w), w += t.headerHeightMm + r.mmPerRow);
407
- function y() {
408
- const p = Math.max(r.flow || o.layout === "wide" ? 0 : e.topMm, l);
409
- return (e.header !== !1 && e.headerEveryPage !== !1 ? p + t.headerHeightMm : l) + [...m.values()].reduce((x, $) => x + $.heightMm, 0);
463
+ ...e.meta || t.matrix ? { meta: { ...e.meta, ...t.matrix ? { matrix: t.matrix.header } : {} } } : {}
464
+ }, g = (w) => n.components.push({ ...h, topMm: w });
465
+ if (r.flow && e.header !== !1 && t.headerHeightMm > c() - l + 1e-3) throw new Error(`流式列表 ${e.id ?? e.dataset} 的表头高度超出单页可用范围`);
466
+ let p = Math.max(r.startTop ?? e.topMm, l);
467
+ e.header !== !1 && (g(p), p += t.headerHeightMm + r.mmPerRow);
468
+ function b() {
469
+ const w = Math.max(r.flow || o.layout === "wide" ? 0 : e.topMm, d);
470
+ return (e.header !== !1 && e.headerEveryPage !== !1 ? w + t.headerHeightMm : d) + [...m.values()].reduce((x, k) => x + k.heightMm, 0);
410
471
  }
411
- function v() {
412
- const p = o.layout === "wide" ? 0 : n.marginBottomMm;
413
- return Math.min(o.heightMm - p, q(o, n)) - y();
472
+ function M() {
473
+ const w = o.layout === "wide" ? 0 : n.marginBottomMm;
474
+ return Math.min(o.heightMm - w, U(o, n)) - b();
414
475
  }
415
- function T(p) {
416
- if (w + p <= c()) return;
476
+ function T(w) {
477
+ if (p + w <= c()) return;
417
478
  i(), n.components = [], n.heightMm = o.heightMm, o.layout === "wide" && (n.marginTopMm = 0, n.marginBottomMm = 0);
418
- const M = Math.max(r.flow || o.layout === "wide" ? 0 : e.topMm, l);
419
- e.header !== !1 && e.headerEveryPage !== !1 ? (g(M), w = M + t.headerHeightMm) : w = l;
420
- for (const x of m.values()) K(x, "listgr", "group-header");
479
+ const v = Math.max(r.flow || o.layout === "wide" ? 0 : e.topMm, d);
480
+ e.header !== !1 && e.headerEveryPage !== !1 ? (g(v), p = v + t.headerHeightMm) : p = d;
481
+ for (const x of m.values()) A(x, "listgr", "group-header");
421
482
  }
422
- function S(p, M, x, $) {
423
- const k = v();
424
- if (r.flow && p.heightMm > k + 1e-3) throw new Error(`流式列表 ${e.id ?? e.dataset} 的单行高度超出单页可用范围`);
425
- p.heightMm > k && a.push(`列表 ${e.id ?? e.dataset} 行高 ${p.heightMm.toFixed(2)}mm 超出单页可用高度 ${k.toFixed(2)}mm,预览与打印可能截断内容`), T(p.heightMm), K(p, M, x, $);
483
+ function S(w, v, x, k) {
484
+ const $ = M();
485
+ if (r.flow && w.heightMm > $ + 1e-3) throw new Error(`流式列表 ${e.id ?? e.dataset} 的单行高度超出单页可用范围`);
486
+ w.heightMm > $ && a.push(`列表 ${e.id ?? e.dataset} 行高 ${w.heightMm.toFixed(2)}mm 超出单页可用高度 ${$.toFixed(2)}mm,预览与打印可能截断内容`), T(w.heightMm), A(w, v, x, k);
426
487
  }
427
- function K(p, M, x, $) {
428
- const k = p.table?.id ?? f.id, F = x === "header" ? -1 : u.get(k) ?? 0;
429
- x !== "header" && u.set(k, F + p.grid.cells.length), n.components.push({
488
+ function A(w, v, x, k) {
489
+ const $ = w.table?.id ?? f.id, F = x === "header" ? -1 : u.get($) ?? 0;
490
+ x !== "header" && u.set($, F + w.grid.cells.length), n.components.push({
430
491
  kind: "rect",
431
492
  leftMm: e.leftMm,
432
- topMm: w,
493
+ topMm: p,
433
494
  widthMm: e.widthMm,
434
- heightMm: p.heightMm,
435
- grid: p.grid,
436
- nid: s(M),
437
- table: { ...f, ...p.table, role: x, rowIndex: F, ...$ ? { source: $ } : {} },
495
+ heightMm: w.heightMm,
496
+ grid: w.grid,
497
+ nid: s(v),
498
+ table: { ...f, ...w.table, role: x, rowIndex: F, ...k ? { source: k } : {} },
438
499
  style: t.borderStyle,
439
- ...e.meta ? { meta: e.meta } : {}
440
- }), w += p.heightMm;
500
+ ...e.meta || w.meta ? { meta: { ...e.meta, ...w.meta } } : {}
501
+ }), p += w.heightMm;
441
502
  }
442
- function O(p) {
443
- p <= v() && T(p);
503
+ function O(w) {
504
+ w <= M() && T(w);
444
505
  }
445
- return { keepTogether: O, placeGridRow: S, setGroupHeader: (p, M) => {
446
- M ? m.set(p, M) : m.delete(p);
447
- }, bottom: () => w };
506
+ return { keepTogether: O, placeGridRow: S, setGroupHeader: (w, v) => {
507
+ v ? m.set(w, v) : m.delete(w);
508
+ }, bottom: () => p };
448
509
  }
449
- function mr(e, t) {
510
+ function xr(e, t) {
450
511
  if (!e.rowKey) return;
451
512
  const r = t[e.rowKey];
452
513
  if ((typeof r != "string" || !r.trim()) && !(typeof r == "number" && Number.isFinite(r)))
@@ -456,26 +517,26 @@ function mr(e, t) {
456
517
  if (n !== void 0 && typeof n != "string") throw new Error("来源令牌应为字符串");
457
518
  return { datasetId: e.dataset, rowKey: r, ...o === void 0 ? {} : { revision: o }, ...n === void 0 ? {} : { sourceToken: n } };
458
519
  }
459
- function Z(e, t) {
520
+ function re(e, t) {
460
521
  const r = /* @__PURE__ */ new Map();
461
522
  if (!e.rowKey) return r;
462
523
  const o = /* @__PURE__ */ new Set();
463
524
  for (const n of t) {
464
- const a = mr(e, n), s = JSON.stringify(a.rowKey);
525
+ const a = xr(e, n), s = JSON.stringify(a.rowKey);
465
526
  if (o.has(s)) throw new Error(`数据集 ${e.dataset} 的业务主键重复:${String(a.rowKey)}`);
466
527
  o.add(s), r.set(n, a);
467
528
  }
468
529
  return r;
469
530
  }
470
- function gr(e, t, r, o, n) {
531
+ function Tr(e, t, r, o, n) {
471
532
  if (!e.grandTotal) return;
472
- const a = typeof e.grandTotal == "object" ? e.grandTotal : void 0, s = ee(e)[0], i = a?.fields ?? s?.subtotal ?? [], c = a?.aggregates ?? s?.aggregates ?? [];
533
+ const a = typeof e.grandTotal == "object" ? e.grandTotal : void 0, s = oe(e)[0], i = a?.fields ?? s?.subtotal ?? [], c = a?.aggregates ?? s?.aggregates ?? [];
473
534
  if (i.length === 0 && c.length === 0) {
474
535
  o.warnings.push(`列表 ${e.id ?? ""} 配置了 grandTotal 但未提供合计字段(groupBy.subtotal 或 grandTotal.fields)`);
475
536
  return;
476
537
  }
477
- const d = B(r, o.measurer, a?.label ?? "合计", Je(e.columns, t, i, c), a?.style ?? {}, ze(e.columns, [...i, ...c.map((l) => l.field)]));
478
- n.placeGridRow(d, "listgt", "grand-total");
538
+ const l = G(r, o.measurer, a?.label ?? "合计", qe(e.columns, t, i, c), a?.style ?? {}, Ue(e.columns, [...i, ...c.map((d) => d.field)]));
539
+ n.placeGridRow(l, "listgt", "grand-total");
479
540
  }
480
541
  function V(e) {
481
542
  if (e?.aborted) {
@@ -483,147 +544,141 @@ function V(e) {
483
544
  throw t.name = "AbortError", t;
484
545
  }
485
546
  }
486
- function ee(e) {
547
+ function oe(e) {
487
548
  const t = e.groups ?? (e.groupBy ? [e.groupBy] : []);
488
549
  if (t.length > 16) throw new Error("列表最多支持 16 级分组");
489
550
  return t;
490
551
  }
491
- function pe(e) {
492
- const t = zt(e), r = t.columns.reduce((n, a) => n + a.widthMm, 0), o = r > t.widthMm ? t.widthMm / r : 1;
552
+ function ye(e) {
553
+ const t = rr(e), r = t.columns.reduce((n, a) => n + a.widthMm, 0), o = r > t.widthMm ? t.widthMm / r : 1;
493
554
  return o === 1 ? t : { ...t, columns: t.columns.map((n) => ({ ...n, widthMm: n.widthMm * o })) };
494
555
  }
495
- function hr(e, t, r) {
556
+ function Pr(e, t, r) {
496
557
  const o = e.detail;
497
558
  if (!o) return;
498
559
  const n = /* @__PURE__ */ new Set();
499
- for (const d of t) {
500
- const l = ie(d[o.parentKey]);
501
- if (n.has(l)) throw new Error("主从明细的主表关联键重复");
502
- n.add(l);
560
+ for (const l of t) {
561
+ const d = de(l[o.parentKey]);
562
+ if (n.has(d)) throw new Error("主从明细的主表关联键重复");
563
+ n.add(d);
503
564
  }
504
565
  const a = r.datasets[o.dataset] ?? [], s = /* @__PURE__ */ new Map(), i = [];
505
- for (const d of a) {
506
- const l = d[o.foreignKey];
507
- if (!_e(l) && o.unmatched === "ignore") continue;
508
- const f = ie(l);
566
+ for (const l of a) {
567
+ const d = l[o.foreignKey];
568
+ if (!Xe(d) && o.unmatched === "ignore") continue;
569
+ const f = de(d);
509
570
  if (!n.has(f)) {
510
571
  if (o.unmatched !== "ignore") throw new Error(`明细数据集 ${o.dataset} 存在未关联的业务键`);
511
572
  continue;
512
573
  }
513
574
  const u = s.get(f);
514
- u ? u.push(d) : s.set(f, [d]), i.push(d);
575
+ u ? u.push(l) : s.set(f, [l]), i.push(l);
515
576
  }
516
- const c = pe({ ...e, id: `${e.id ?? e.dataset}:detail`, dataset: o.dataset, rowKey: o.rowKey, revisionField: o.revisionField, sourceTokenField: o.sourceTokenField, computed: void 0, columns: o.columns, headerGrid: void 0, rowHeightMm: o.rowHeightMm ?? e.rowHeightMm, detail: void 0 });
517
- return { list: c, inter: { ...he(c, r.measurer), rowHeightFloorMm: c.rowHeightMm ?? 0 }, rows: s, sources: Z(c, i) };
577
+ const c = ye({ ...e, id: `${e.id ?? e.dataset}:detail`, dataset: o.dataset, rowKey: o.rowKey, revisionField: o.revisionField, sourceTokenField: o.sourceTokenField, computed: void 0, columns: o.columns, headerGrid: void 0, rowHeightMm: o.rowHeightMm ?? e.rowHeightMm, detail: void 0 });
578
+ return { list: c, inter: { ...we(c, r.measurer), rowHeightFloorMm: c.rowHeightMm ?? 0 }, rows: s, sources: re(c, i) };
518
579
  }
519
- function _e(e) {
580
+ function Xe(e) {
520
581
  return typeof e == "string" && !!e.trim() || typeof e == "number" && Number.isFinite(e);
521
582
  }
522
- function ie(e) {
523
- if (!_e(e)) throw new Error("主从关联键必须是非空字符串或有限数字");
524
- return We(e);
583
+ function de(e) {
584
+ if (!Xe(e)) throw new Error("主从关联键必须是非空字符串或有限数字");
585
+ return ze(e);
525
586
  }
526
- function* pr(e, t, r, o, n) {
587
+ function* kr(e, t, r, o, n) {
527
588
  if (!r) return;
528
- const a = r.rows.get(ie(t[e.detail.parentKey])) ?? [];
589
+ const a = r.rows.get(de(t[e.detail.parentKey])) ?? [];
529
590
  if (!a.length) return;
530
591
  const s = { id: `${o.tableId}:detail`, columnKeys: r.list.columns.map((i) => i.field), title: e.detail.label };
531
- e.detail.label && n.placeGridRow({ ...B(r.inter, o.measurer, e.detail.label, /* @__PURE__ */ new Map(), {}, r.list.columns.length), table: s }, "listdl", "group-header"), e.detail.header !== !1 && n.placeGridRow({ grid: r.inter.headerGrid, heightMm: r.inter.headerHeightMm, table: s }, "listdh", "header"), yield* o.takePages();
592
+ e.detail.label && n.placeGridRow({ ...G(r.inter, o.measurer, e.detail.label, /* @__PURE__ */ new Map(), {}, r.list.columns.length), table: s }, "listdl", "group-header"), e.detail.header !== !1 && n.placeGridRow({ grid: r.inter.headerGrid, heightMm: r.inter.headerHeightMm, table: s }, "listdh", "header"), yield* o.takePages();
532
593
  for (const i of a)
533
594
  V(o.signal), n.placeGridRow({ ...W(r.inter, i, o.measurer), table: s }, "listdr", "body", r.sources.get(i)), yield* o.takePages();
534
595
  }
535
- function wr(e, t) {
536
- if (!e.matrix) return { list: e, rows: t };
537
- if (e.detail || e.groupBy || e.groups?.length || e.grandTotal) throw new Error("矩阵不能同时配置普通分组、总计或主从明细");
538
- const r = Ot(t, e.matrix), o = r.columns.map((a, s) => ({ ...a, widthMm: s === 0 ? e.matrix.rowWidthMm ?? 40 : e.matrix.columnWidthMm ?? 28, editable: !1, align: s === 0 ? "center" : "right" })), n = { ...e, columns: o, headerGrid: void 0, rowKey: void 0, revisionField: void 0, sourceTokenField: void 0 };
539
- return e.layout === "wide" && (n.widthMm = o.reduce((a, s) => a + s.widthMm, 0)), { list: n, rows: r.rows };
540
- }
541
- function qe(e) {
596
+ function Ye(e) {
542
597
  if (e.matrix || e.detail || e.groups?.length || e.groupBy || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
543
598
  if (e.rowKey && e.rowKey !== e.tree.idField) throw new Error("树形布局的 rowKey 应与 idField 一致");
544
599
  if (!e.columns.some((t) => t.field === e.tree.labelField && !t.hidden)) throw new Error("树形布局需要可见的标签列");
545
- Ft(e.tree, e.computed);
600
+ Lt(e.tree, e.computed);
546
601
  }
547
- function yr(e, t, r) {
548
- qe(e);
549
- const o = Kt(t, e.tree, { signal: r.signal, computed: e.computed?.length ? { fields: e.computed, formula: r.formula } : void 0 }), n = { ...e, rowKey: e.tree.idField }, a = Z(n, o.entries.map((c) => c.original)), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new WeakMap();
602
+ function $r(e, t, r) {
603
+ Ye(e);
604
+ const o = Ht(t, e.tree, { signal: r.signal, computed: e.computed?.length ? { fields: e.computed, formula: r.formula } : void 0 }), n = { ...e, rowKey: e.tree.idField }, a = re(n, o.entries.map((c) => c.original)), s = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new WeakMap();
550
605
  for (const c of o.entries)
551
606
  s.set(c.row, a.get(c.original)), i.set(c.row, c);
552
607
  return { list: n, rows: o.rows, sources: s, treeRows: i, totalRows: o.leaves };
553
608
  }
554
- function br(e, t) {
609
+ function Rr(e, t) {
555
610
  if (e.cardinality === "record") {
556
611
  if (t.length > 1) throw new Error(`单记录区域 ${e.id ?? e.dataset} 仅允许 0 或 1 行数据`);
557
612
  if (e.tree || e.matrix || e.detail || e.groups?.length || e.groupBy || e.grandTotal || e.rowVisibleWhen) throw new Error("单记录区域不能配置树、矩阵、主从、分组、总计或行过滤");
558
613
  if (!t.length) return { list: { ...e, columns: e.columns.map((r) => ({ ...r, editable: !1 })) }, rows: [{}], sources: /* @__PURE__ */ new Map() };
559
614
  }
560
615
  }
561
- function Ue(e, t, r) {
616
+ function Qe(e, t, r) {
562
617
  const o = r.prepared.get(e);
563
618
  if (o) return o;
564
- const n = br(e, t);
619
+ const n = Rr(e, t);
565
620
  if (n)
566
621
  return r.prepared.set(e, n), n;
567
622
  if (e.tree) {
568
- const c = yr(e, t, r);
623
+ const c = $r(e, t, r);
569
624
  return r.prepared.set(e, c), c;
570
625
  }
571
- let a = e.computed?.length ? Ne(t, { fields: e.computed, signal: r.signal, formula: r.formula }).rows : t;
572
- const s = a === t ? void 0 : new Map(a.map((c, d) => [c, t[d]]));
626
+ let a = e.computed?.length ? Le(t, { fields: e.computed, signal: r.signal, formula: r.formula }).rows : t;
627
+ const s = a === t ? void 0 : new Map(a.map((c, l) => [c, t[l]]));
573
628
  e.rowVisibleWhen && (a = a.filter((c) => H(c, e.rowVisibleWhen)));
574
- const i = wr(e, a);
629
+ const i = Zt(e, a);
575
630
  if (!e.matrix) {
576
- const c = Z(e, s ? a.map((d) => s.get(d)) : a);
577
- i.sources = s ? new Map(a.map((d) => [d, c.get(s.get(d))])) : c;
631
+ const c = re(e, s ? a.map((l) => s.get(l)) : a);
632
+ i.sources = s ? new Map(a.map((l) => [l, c.get(s.get(l))])) : c;
578
633
  }
579
634
  return r.prepared.set(e, i), i;
580
635
  }
581
- function Mr(e, t, r, o) {
636
+ function Ir(e, t, r, o) {
582
637
  if (!o.flow) return;
583
- const { current: n, templatePage: a } = o, s = Math.max(n.marginTopMm, G(a)), i = Math.max(o.startTop ?? e.topMm, s), c = (e.header === !1 ? 0 : t.headerHeightMm) + (r[0] ? W(t, r[0], o.measurer).heightMm : 0);
584
- i + c <= q(a, n) + 1e-3 || i <= s + 1e-3 || (o.pushCurrent(), n.components = [], n.heightMm = a.heightMm, a.layout === "wide" && (n.marginTopMm = 0, n.marginBottomMm = 0), o.startTop = Math.max(n.marginTopMm, G(a)));
638
+ const { current: n, templatePage: a } = o, s = Math.max(n.marginTopMm, B(a)), i = Math.max(o.startTop ?? e.topMm, s), c = (e.header === !1 ? 0 : t.headerHeightMm) + (r[0] ? W(t, r[0], o.measurer).heightMm : 0);
639
+ i + c <= U(a, n) + 1e-3 || i <= s + 1e-3 || (o.pushCurrent(), n.components = [], n.heightMm = a.heightMm, a.layout === "wide" && (n.marginTopMm = 0, n.marginBottomMm = 0), o.startTop = Math.max(n.marginTopMm, B(a)));
585
640
  }
586
- function* vr(e, t, r) {
587
- const o = Ue(e, t, r), n = o.rows;
641
+ function* Er(e, t, r) {
642
+ const o = Qe(e, t, r), n = o.rows;
588
643
  e = o.list, e.layout === "wide" && (r.current.widthMm = Math.max(r.current.widthMm, e.leftMm + e.widthMm + r.current.marginRightMm));
589
- const a = o.sources ?? Z(e, n), s = pe(e), i = ee(s), c = { ...he(s, r.measurer), rowHeightFloorMm: s.rowHeightMm ?? 0, ...o.treeRows ? { tree: { list: s, rows: o.treeRows } } : {} };
590
- Mr(s, c, n, r);
591
- const d = fr(s, c, r), l = hr(s, n, r);
644
+ const a = o.sources ?? re(e, n), s = ye(e), i = oe(s), c = { ...we(s, r.measurer), rowHeightFloorMm: s.rowHeightMm ?? 0, matrix: o.matrix, ...o.treeRows ? { tree: { list: s, rows: o.treeRows } } : {} };
645
+ Ir(s, c, n, r);
646
+ const l = Sr(s, c, r), d = Pr(s, n, r);
592
647
  let f;
593
- for (const u of Ve(n, i)) {
648
+ for (const u of _e(n, i)) {
594
649
  if (V(r.signal), u.kind === "row")
595
- d.placeGridRow(f ?? W(c, u.row, r.measurer), "listr", "body", a.get(u.row)), f = void 0, yield* r.takePages(), yield* pr(s, u.row, l, r, d);
650
+ l.placeGridRow(f ?? W(c, u.row, r.measurer), "listr", Yt(o.matrix, u.row), a.get(u.row)), f = void 0, yield* r.takePages(), yield* kr(s, u.row, d, r, l);
596
651
  else if (u.kind === "groupHeader") {
597
- const m = B(c, r.measurer, u.label, /* @__PURE__ */ new Map(), u.group.headerStyle ?? {}, s.columns.length);
652
+ const m = G(c, r.measurer, u.label, /* @__PURE__ */ new Map(), u.group.headerStyle ?? {}, s.columns.length);
598
653
  f ??= W(c, u.firstRow, r.measurer);
599
- const h = i.slice(u.depth + 1).reduce((g, w) => g + B(c, r.measurer, (w.headerTemplate ?? "{value}").replace(/\{value\}/g, fe(u.firstRow[w.field])), /* @__PURE__ */ new Map(), w.headerStyle ?? {}, s.columns.length).heightMm, 0);
600
- u.group.keepWithNext !== !1 && d.keepTogether(m.heightMm + h + f.heightMm), d.placeGridRow(m, "listg", "group-header"), u.group.repeatHeader && d.setGroupHeader(u.depth, m);
654
+ const h = i.slice(u.depth + 1).reduce((g, p) => g + G(c, r.measurer, (p.headerTemplate ?? "{value}").replace(/\{value\}/g, he(u.firstRow[p.field])), /* @__PURE__ */ new Map(), p.headerStyle ?? {}, s.columns.length).heightMm, 0);
655
+ u.group.keepWithNext !== !1 && l.keepTogether(m.heightMm + h + f.heightMm), l.placeGridRow(m, "listg", "group-header"), u.group.repeatHeader && l.setGroupHeader(u.depth, m);
601
656
  } else if (u.kind === "subtotal") {
602
- const m = u.group.subtotal ?? [], h = u.group.aggregates ?? [], g = B(c, r.measurer, u.label, Je(s.columns, u.rows, m, h), u.group.subtotalStyle ?? {}, ze(s.columns, [...m, ...h.map((w) => w.field)]));
603
- d.placeGridRow(g, "listst", "subtotal");
604
- } else d.setGroupHeader(u.depth);
657
+ const m = u.group.subtotal ?? [], h = u.group.aggregates ?? [], g = G(c, r.measurer, u.label, qe(s.columns, u.rows, m, h), u.group.subtotalStyle ?? {}, Ue(s.columns, [...m, ...h.map((p) => p.field)]));
658
+ l.placeGridRow(g, "listst", "subtotal");
659
+ } else l.setGroupHeader(u.depth);
605
660
  yield* r.takePages();
606
661
  }
607
- gr(s, o.totalRows ?? n, c, r, d), r.finished?.(d.bottom()), yield* r.takePages();
662
+ Tr(s, o.totalRows ?? n, c, r, l), r.finished?.(l.bottom()), yield* r.takePages();
608
663
  }
609
- function te(e) {
664
+ function ne(e) {
610
665
  return e.kind !== "list" && (e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && (e.text.includes("{page}") || e.text.includes("{totalPages}")));
611
666
  }
612
- function re(e, t) {
667
+ function ae(e, t) {
613
668
  return {
614
669
  ...e,
615
670
  ...e.text === void 0 ? {} : { text: t(e.text) },
616
671
  ...e.lines ? { lines: e.lines.map(t) } : {},
617
672
  ...e.richParagraphs ? { richParagraphs: e.richParagraphs.map((r) => ({ ...r, segments: r.segments.map((o) => ({ ...o, ...o.text === void 0 ? {} : { text: t(o.text) } })) })) } : {},
618
- ...e.grid ? { grid: { ...e.grid, cells: e.grid.cells.map((r) => r.map((o) => o ? { ...o, ...o.text === void 0 ? {} : { text: t(o.text) }, ...o.children ? { children: o.children.map((n) => re(n, t)) } : {} } : null)) } } : {}
673
+ ...e.grid ? { grid: { ...e.grid, cells: e.grid.cells.map((r) => r.map((o) => o ? { ...o, ...o.text === void 0 ? {} : { text: t(o.text) }, ...o.children ? { children: o.children.map((n) => ae(n, t)) } : {} } : null)) } } : {}
619
674
  };
620
675
  }
621
- function Sr(e) {
676
+ function Cr(e) {
622
677
  let t = !1;
623
- for (const r of e.pages) for (const o of r.components) te(o) && re(o, (n) => (n.includes("{totalPages}") && (t = !0), n));
678
+ for (const r of e.pages) for (const o of r.components) ne(o) && ae(o, (n) => (n.includes("{totalPages}") && (t = !0), n));
624
679
  return t;
625
680
  }
626
- function xr(e, t, r, o, n, a) {
681
+ function Or(e, t, r, o, n, a) {
627
682
  const s = {
628
683
  pageWidthMm: t.widthMm,
629
684
  pageHeightMm: t.heightMm,
@@ -635,40 +690,40 @@ function xr(e, t, r, o, n, a) {
635
690
  components: t.components,
636
691
  ...e.meta ? { meta: e.meta } : {}
637
692
  }, i = (c) => {
638
- const d = c.replace(/\{page\}/g, String(o));
639
- return a === void 0 ? d : d.replace(/\{totalPages\}/g, String(a));
693
+ const l = c.replace(/\{page\}/g, String(o));
694
+ return a === void 0 ? l : l.replace(/\{totalPages\}/g, String(a));
640
695
  };
641
- for (const c of r) s.components.push(re(c, i));
696
+ for (const c of r) s.components.push(ae(c, i));
642
697
  if (e.layout === "wide") {
643
- const c = s.components.reduce((d, l) => Math.max(d, l.topMm + l.heightMm), 0);
698
+ const c = s.components.reduce((l, d) => Math.max(l, d.topMm + d.heightMm), 0);
644
699
  s.marginBottomMm = n ? e.marginBottomMm ?? 0 : 0, s.pageHeightMm = Math.max(1, c + s.marginBottomMm);
645
700
  }
646
701
  return s;
647
702
  }
648
- function we(e) {
649
- return e.cells.reduce((t, r) => t + r.reduce((o, n) => o + (n ? 1 + (n.children?.reduce((a, s) => a + Xe(s), 0) ?? 0) : 0), 0), 0);
703
+ function be(e) {
704
+ return e.cells.reduce((t, r) => t + r.reduce((o, n) => o + (n ? 1 + (n.children?.reduce((a, s) => a + Ze(s), 0) ?? 0) : 0), 0), 0);
650
705
  }
651
- function Xe(e) {
652
- return e.grid ? we(e.grid) : 0;
706
+ function Ze(e) {
707
+ return e.grid ? be(e.grid) : 0;
653
708
  }
654
- function ye(e) {
709
+ function Me(e) {
655
710
  for (const t of ["maxPages", "maxCells", "knownTotalPages"]) if (e[t] !== void 0 && (!Number.isSafeInteger(e[t]) || e[t] < 1)) throw new RangeError(`${t} 应为正安全整数`);
656
711
  }
657
- function Tr(e, t) {
658
- const r = Ue(e, t.datasets[e.dataset] ?? [], t), o = pe(r.list), n = { ...he(o, t.measurer), rowHeightFloorMm: o.rowHeightMm ?? 0 };
712
+ function Fr(e, t) {
713
+ const r = Qe(e, t.datasets[e.dataset] ?? [], t), o = ye(r.list), n = { ...we(o, t.measurer), rowHeightFloorMm: o.rowHeightMm ?? 0 };
659
714
  return (o.header === !1 ? 0 : n.headerHeightMm) + r.rows.reduce((a, s) => a + W(n, s, t.measurer).heightMm, 0);
660
715
  }
661
- function* Pr(e) {
716
+ function* Ar(e) {
662
717
  const { templatePage: t, current: r } = e, o = new Map(t.components.map((a, s) => [a, s])), n = (a, s, i) => {
663
718
  const c = e.datasets[a.dataset];
664
- return Array.isArray(c) || e.warnings.push(`数据集 ${a.dataset} 未提供数据,列表 ${a.id ?? ""} 输出为空`), vr(a, Array.isArray(c) ? c : [], { ...e, tableId: `${e.tableId}:${o.get(a)}`, startTop: s, finished: i, flow: !!t.flow });
719
+ return Array.isArray(c) || e.warnings.push(`数据集 ${a.dataset} 未提供数据,列表 ${a.id ?? ""} 输出为空`), Er(a, Array.isArray(c) ? c : [], { ...e, tableId: `${e.tableId}:${o.get(a)}`, startTop: s, finished: i, flow: !!t.flow });
665
720
  };
666
721
  if (t.flow) {
667
- yield* _t({
722
+ yield* or({
668
723
  page: t,
669
724
  active: () => V(e.signal),
670
- top: () => Math.max(r.marginTopMm, G(t)),
671
- bottom: () => q(t, r),
725
+ top: () => Math.max(r.marginTopMm, B(t)),
726
+ bottom: () => U(t, r),
672
727
  append: (a) => {
673
728
  r.components.push(a);
674
729
  },
@@ -676,128 +731,128 @@ function* Pr(e) {
676
731
  e.pushCurrent(), r.components = [], r.heightMm = t.heightMm, t.layout === "wide" && (r.marginTopMm = 0, r.marginBottomMm = 0);
677
732
  },
678
733
  takePages: e.takePages,
679
- height: (a) => Tr(a, e),
734
+ height: (a) => Fr(a, e),
680
735
  list: n
681
736
  });
682
737
  return;
683
738
  }
684
739
  for (const a of t.components)
685
- te(a) || (a.kind === "list" ? yield* n(a) : r.components.push(a));
740
+ ne(a) || (a.kind === "list" ? yield* n(a) : r.components.push(a));
686
741
  }
687
- function* U(e, t, r, o, n, a = /* @__PURE__ */ new WeakMap()) {
742
+ function* X(e, t, r, o, n, a = /* @__PURE__ */ new WeakMap()) {
688
743
  let s = 0, i = 0, c = 0;
689
- const d = (l) => `${l}_${(++s).toString(36)}`;
690
- for (const { pageIndex: l, page: f } of or(e, t, r)) {
744
+ const l = Xt(r.measurer ?? Oe), d = (f) => `${f}_${(++s).toString(36)}`;
745
+ for (const { pageIndex: f, page: u } of mr(e, t, r)) {
691
746
  V(r.signal);
692
- const u = nr(f), m = f.components.filter(te);
693
- let h = [];
694
- const g = (y = !1) => {
695
- if (V(r.signal), r.maxPages !== void 0 && i >= r.maxPages) throw new N(r.maxPages, i + 1);
696
- if (r.maxCells !== void 0 && (c += [...u.components, ...m].reduce((v, T) => v + Xe(T), 0), c > r.maxCells))
747
+ const m = gr(u), h = u.components.filter(ne);
748
+ let g = [];
749
+ const p = (M = !1) => {
750
+ if (V(r.signal), r.maxPages !== void 0 && i >= r.maxPages) throw new K(r.maxPages, i + 1);
751
+ if (r.maxCells !== void 0 && (c += [...m.components, ...h].reduce((T, S) => T + Ze(S), 0), c > r.maxCells))
697
752
  throw new D(r.maxCells, c);
698
- h.push(xr(f, u, m, ++i, y, n));
699
- }, w = () => {
700
- const y = h;
701
- return h = [], y;
753
+ g.push(Or(u, m, h, ++i, M, n));
754
+ }, b = () => {
755
+ const M = g;
756
+ return g = [], M;
702
757
  };
703
- yield* Pr({
704
- templatePage: f,
705
- current: u,
758
+ yield* Ar({
759
+ templatePage: u,
760
+ current: m,
706
761
  warnings: o,
707
762
  nextId: d,
708
- pushCurrent: g,
709
- takePages: w,
763
+ pushCurrent: p,
764
+ takePages: b,
710
765
  datasets: t,
711
766
  signal: r.signal,
712
767
  formula: r.formula,
713
768
  prepared: a,
714
- measurer: r.measurer ?? Ce,
769
+ measurer: l,
715
770
  mmPerRow: r.mmPerRow ?? 0,
716
- tableId: `table:${l}`
717
- }), g(!0), yield* w();
771
+ tableId: `table:${f}`
772
+ }), p(!0), yield* b();
718
773
  }
719
774
  }
720
- function $o(e, t, r = {}) {
721
- ye(r);
775
+ function Ao(e, t, r = {}) {
776
+ Me(r);
722
777
  let o = 0;
723
- for (const n of U(e, t, { ...r, onWarning: void 0 }, [])) o++;
778
+ for (const n of X(e, t, { ...r, onWarning: void 0 }, [])) o++;
724
779
  return o;
725
780
  }
726
- function* $r(e, t, r = {}) {
727
- ye(r);
728
- const o = Sr(e), n = /* @__PURE__ */ new WeakMap();
781
+ function* Nr(e, t, r = {}) {
782
+ Me(r);
783
+ const o = Cr(e), n = /* @__PURE__ */ new WeakMap();
729
784
  let a = r.knownTotalPages;
730
785
  if (o && a === void 0) {
731
786
  a = 0;
732
- for (const c of U(e, t, r, [], void 0, n)) a++;
787
+ for (const c of X(e, t, r, [], void 0, n)) a++;
733
788
  }
734
789
  const s = [];
735
790
  let i = 0;
736
- for (const c of U(e, t, r, s, a, n)) {
791
+ for (const c of X(e, t, r, s, a, n)) {
737
792
  for (; i < s.length; i++) r.onWarning?.(s[i]);
738
793
  yield c;
739
794
  }
740
795
  }
741
- function Ye(e, t, r = {}) {
796
+ function et(e, t, r = {}) {
742
797
  const o = typeof r == "number" ? { mmPerRow: r } : r;
743
- ye(o);
744
- const n = [], a = [...U(e, t, o, n, o.knownTotalPages)];
745
- for (const s of a) s.components = s.components.map((i) => te(i) ? re(i, (c) => c.replace(/\{totalPages\}/g, String(a.length))) : i);
746
- return n.forEach((s) => o.onWarning?.(s)), { plan: { schemaVersion: X, ...Q(e) ? { requiresRecalculation: !0 } : {}, pages: a }, warnings: n };
798
+ Me(o);
799
+ const n = [], a = [...X(e, t, o, n, o.knownTotalPages)];
800
+ for (const s of a) s.components = s.components.map((i) => ne(i) ? ae(i, (c) => c.replace(/\{totalPages\}/g, String(a.length))) : i);
801
+ return n.forEach((s) => o.onWarning?.(s)), { plan: { schemaVersion: Q, ...te(e) ? { requiresRecalculation: !0 } : {}, pages: a }, warnings: n };
747
802
  }
748
- function kr(e) {
803
+ function Kr(e) {
749
804
  const t = e.columns.find((a) => !a.hidden)?.field;
750
805
  if (!t) return { groups: 0, total: 0 };
751
- const r = ee(e), o = (a = [], s = []) => a.includes(t) || s.some((i) => i.field === t), n = typeof e.grandTotal == "object" ? e.grandTotal : void 0;
806
+ const r = oe(e), o = (a = [], s = []) => a.includes(t) || s.some((i) => i.field === t), n = typeof e.grandTotal == "object" ? e.grandTotal : void 0;
752
807
  return { groups: r.filter((a) => o(a.subtotal, a.aggregates)).length, total: Number(o(n?.fields ?? r[0]?.subtotal, n?.aggregates ?? r[0]?.aggregates)) };
753
808
  }
754
- function Rr(e, t, r) {
755
- qe(e);
756
- const o = je(t[e.dataset] ?? [], e.tree, r), n = e.columns.filter((s) => !s.hidden).length, a = e.header === !1 ? 0 : e.headerGrid ? we(e.headerGrid) : n;
809
+ function jr(e, t, r) {
810
+ Ye(e);
811
+ const o = He(t[e.dataset] ?? [], e.tree, r), n = e.columns.filter((s) => !s.hidden).length, a = e.header === !1 ? 0 : e.headerGrid ? be(e.headerGrid) : n;
757
812
  return o.length * n + a + +!!e.grandTotal * 2 * n;
758
813
  }
759
- function ko(e, t, r = {}) {
760
- if (e.tree) return Rr(e, t, r.signal);
814
+ function No(e, t, r = {}) {
815
+ if (e.tree) return jr(e, t, r.signal);
761
816
  if (e.matrix) {
762
817
  let c = t[e.dataset] ?? [];
763
- e.computed?.length && (c = Ne(c, { fields: e.computed, ...r }).rows), e.rowVisibleWhen && (c = c.filter((l) => H(l, e.rowVisibleWhen)));
764
- const d = Ct(c, e.matrix);
765
- return d.cells + d.columnCount;
818
+ e.computed?.length && (c = Le(c, { fields: e.computed, ...r }).rows), e.rowVisibleWhen && (c = c.filter((d) => H(d, e.rowVisibleWhen)));
819
+ const l = jt(c, e.matrix);
820
+ return l.cells + (e.header === !1 ? 0 : l.columnCount * (e.matrix.hierarchy ? e.matrix.columnFields.length + 1 : 1));
766
821
  }
767
- const o = t[e.dataset]?.length ?? 0, n = e.columns.filter((c) => !c.hidden).length, a = ee(e).length, s = kr(e);
822
+ const o = t[e.dataset]?.length ?? 0, n = e.columns.filter((c) => !c.hidden).length, a = oe(e).length, s = Kr(e);
768
823
  let i = (o * (1 + 2 * a + s.groups) + +!!e.grandTotal * (1 + s.total)) * n;
769
- if (i += e.header === !1 ? 0 : e.headerGrid ? we(e.headerGrid) : n, e.cardinality === "record" && o === 0 && (i += n), e.detail) {
770
- const c = t[e.detail.dataset]?.length ?? 0, d = e.detail.columns.filter((l) => !l.hidden).length;
771
- i += (c + o * (+(e.detail.header !== !1) + +!!e.detail.label)) * d;
824
+ if (i += e.header === !1 ? 0 : e.headerGrid ? be(e.headerGrid) : n, e.cardinality === "record" && o === 0 && (i += n), e.detail) {
825
+ const c = t[e.detail.dataset]?.length ?? 0, l = e.detail.columns.filter((d) => !d.hidden).length;
826
+ i += (c + o * (+(e.detail.header !== !1) + +!!e.detail.label)) * l;
772
827
  }
773
828
  if (!Number.isSafeInteger(i)) throw new RangeError("报表单元格估算超出安全整数预算");
774
829
  return i;
775
830
  }
776
- function Qe(e) {
831
+ function tt(e) {
777
832
  return !e || typeof e != "object" ? !1 : [e.pageIndex, e.componentIndex, e.rowIndex, e.columnIndex].every((t) => Number.isInteger(t) && t >= 0);
778
833
  }
779
- function Ze(e, t, r) {
834
+ function rt(e, t, r) {
780
835
  const o = e.grid;
781
836
  if (!o) return null;
782
837
  const n = o.cells[t];
783
838
  if (!n) return null;
784
- const s = me(o, e.widthMm, e.heightMm).cells.filter((c) => c.ri === t).findIndex((c) => c.ci === r), i = n[s];
839
+ const s = ee(o, e.widthMm, e.heightMm).cells.filter((c) => c.ri === t).findIndex((c) => c.ci === r), i = n[s];
785
840
  return i ? { cell: i, sourceColumnIndex: s } : null;
786
841
  }
787
- function Ir(e) {
842
+ function Lr(e) {
788
843
  return e.value !== void 0 ? e.value : e.rawText ?? e.text ?? null;
789
844
  }
790
- function Er(e, t) {
845
+ function Hr(e, t) {
791
846
  return e.valueType ? e.valueType : typeof t == "number" ? "number" : typeof t == "boolean" ? "boolean" : t === null && e.numberFormat && /[0#?]/.test(e.numberFormat) ? "number" : "text";
792
847
  }
793
- function Cr(e, t) {
848
+ function Dr(e, t) {
794
849
  if (e.derived) return "derived";
795
850
  if (e.editable === !1) return "cell";
796
851
  if (e.formula !== void 0) return "formula";
797
852
  if (e.children?.length || e.richParagraphs?.length) return "complex";
798
853
  if (t.table && t.table.role !== "body" && e.editable !== !0) return "structure";
799
854
  }
800
- function Or(e, t) {
855
+ function Gr(e, t) {
801
856
  const r = e.table;
802
857
  if (r)
803
858
  return {
@@ -807,100 +862,100 @@ function Or(e, t) {
807
862
  columnKey: r.columnKeys[t.columnIndex]
808
863
  };
809
864
  }
810
- function Fr(e, t, r) {
865
+ function Br(e, t, r) {
811
866
  if (e.derived) return;
812
867
  if (e.source) return { ...e.source };
813
868
  const o = t.table?.source, n = t.table?.columnKeys[r.columnIndex];
814
869
  if (!(!o || o.rowKey === void 0 || n === void 0))
815
870
  return { ...o, rowKey: o.rowKey, field: n };
816
871
  }
817
- function et(e, t, r) {
818
- const o = Ir(r), n = Cr(r, e);
872
+ function ot(e, t, r) {
873
+ const o = Lr(r), n = Dr(r, e);
819
874
  return {
820
875
  address: { ...t },
821
876
  cell: r,
822
877
  component: e,
823
878
  value: o,
824
- valueType: Er(r, o),
825
- table: Or(e, t),
826
- source: Fr(r, e, t),
879
+ valueType: Hr(r, o),
880
+ table: Gr(e, t),
881
+ source: Br(r, e, t),
827
882
  editable: n === void 0,
828
883
  readOnlyReason: n
829
884
  };
830
885
  }
831
- function be(e, t) {
832
- if (!Qe(t)) return null;
886
+ function ve(e, t) {
887
+ if (!tt(t)) return null;
833
888
  const r = e.pages[t.pageIndex]?.components[t.componentIndex];
834
889
  if (!r) return null;
835
- const o = Ze(r, t.rowIndex, t.columnIndex);
836
- return o ? et(r, t, o.cell) : null;
890
+ const o = rt(r, t.rowIndex, t.columnIndex);
891
+ return o ? ot(r, t, o.cell) : null;
837
892
  }
838
893
  function j(e) {
839
894
  const t = /* @__PURE__ */ new Map();
840
895
  return (r) => {
841
- if (!Qe(r)) return null;
896
+ if (!tt(r)) return null;
842
897
  const o = e.pages[r.pageIndex]?.components[r.componentIndex];
843
898
  if (!o?.grid) return null;
844
899
  let n = t.get(o);
845
900
  if (!n) {
846
901
  const s = /* @__PURE__ */ new Map();
847
902
  n = /* @__PURE__ */ new Map();
848
- for (const i of me(o.grid, o.widthMm, o.heightMm).cells) {
903
+ for (const i of ee(o.grid, o.widthMm, o.heightMm).cells) {
849
904
  const c = s.get(i.ri) ?? 0;
850
905
  s.set(i.ri, c + 1);
851
- const d = o.grid.cells[i.ri]?.[c];
852
- d && n.set(`${i.ri}:${i.ci}`, d);
906
+ const l = o.grid.cells[i.ri]?.[c];
907
+ l && n.set(`${i.ri}:${i.ci}`, l);
853
908
  }
854
909
  t.set(o, n);
855
910
  }
856
911
  const a = n.get(`${r.rowIndex}:${r.columnIndex}`);
857
- return a ? et(o, r, a) : null;
912
+ return a ? ot(o, r, a) : null;
858
913
  };
859
914
  }
860
- class b extends Error {
915
+ class y extends Error {
861
916
  constructor(t) {
862
917
  super(`Invalid report cell edit: ${t}`), this.code = t, this.name = "ReportCellEditError";
863
918
  }
864
919
  }
865
- function Kr(e, t) {
920
+ function Wr(e, t) {
866
921
  let r = e.trim();
867
922
  const o = t && r.endsWith("%");
868
- if (o && (r = r.slice(0, -1).trim()), /^[+-]?\d{1,3}(?:,\d{3})+(?:\.\d*)?(?:[eE][+-]?\d+)?$/.test(r) && (r = r.replace(/,/g, "")), !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(r)) throw new b("number");
923
+ if (o && (r = r.slice(0, -1).trim()), /^[+-]?\d{1,3}(?:,\d{3})+(?:\.\d*)?(?:[eE][+-]?\d+)?$/.test(r) && (r = r.replace(/,/g, "")), !/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/.test(r)) throw new y("number");
869
924
  return Number(r) / (o ? 100 : 1);
870
925
  }
871
- function Ar(e, t) {
926
+ function Vr(e, t) {
872
927
  if (e === null || typeof e == "string" && e.trim() === "") return null;
873
- if (typeof e != "string" && typeof e != "number") throw new b("number");
874
- const r = typeof e == "number" ? e : Kr(e, Gt(t.cell.numberFormat));
875
- if (!Number.isFinite(r) || Number.isInteger(r) && !Number.isSafeInteger(r)) throw new b("number");
928
+ if (typeof e != "string" && typeof e != "number") throw new y("number");
929
+ const r = typeof e == "number" ? e : Wr(e, _t(t.cell.numberFormat));
930
+ if (!Number.isFinite(r) || Number.isInteger(r) && !Number.isSafeInteger(r)) throw new y("number");
876
931
  return r;
877
932
  }
878
- function Nr(e) {
933
+ function Jr(e) {
879
934
  if (e === null || typeof e == "string" && e.trim() === "") return null;
880
935
  if (typeof e == "boolean") return e;
881
936
  const t = String(e).trim().toLowerCase();
882
937
  if (["true", "yes", "是", "1"].includes(t)) return !0;
883
938
  if (["false", "no", "否", "0"].includes(t)) return !1;
884
- throw new b("boolean");
939
+ throw new y("boolean");
885
940
  }
886
- function tt(e, t) {
887
- return e.valueType === "number" ? Ar(t, e) : e.valueType === "boolean" ? Nr(t) : t === null ? null : String(t);
941
+ function nt(e, t) {
942
+ return e.valueType === "number" ? Vr(t, e) : e.valueType === "boolean" ? Jr(t) : t === null ? null : String(t);
888
943
  }
889
- function jr(e, t) {
944
+ function zr(e, t) {
890
945
  const r = t.cell.text, n = [["是", "否"], ["TRUE", "FALSE"], ["True", "False"], ["true", "false"], ["1", "0"]].find((a) => a.includes(r ?? ""));
891
946
  return n ? n[e ? 0 : 1] : String(e);
892
947
  }
893
- function J(e, t) {
894
- return t === null ? "" : typeof t == "boolean" ? jr(t, e) : typeof t == "number" ? Bt(t, e.cell.numberFormat) : String(t);
948
+ function z(e, t) {
949
+ return t === null ? "" : typeof t == "boolean" ? zr(t, e) : typeof t == "number" ? zt(t, e.cell.numberFormat) : String(t);
895
950
  }
896
- function Ro(e, t, r) {
897
- const o = be(e, t);
898
- if (!o) throw new b("missing");
899
- return z(o, r);
951
+ function Ko(e, t, r) {
952
+ const o = ve(e, t);
953
+ if (!o) throw new y("missing");
954
+ return _(o, r);
900
955
  }
901
- function z(e, t) {
902
- if (!e.editable) throw new b("readonly");
903
- const r = tt(e, t);
956
+ function _(e, t) {
957
+ if (!e.editable) throw new y("readonly");
958
+ const r = nt(e, t);
904
959
  return {
905
960
  address: { ...e.address },
906
961
  table: e.table,
@@ -908,58 +963,58 @@ function z(e, t) {
908
963
  previousValue: e.value,
909
964
  previousText: e.cell.text ?? "",
910
965
  value: r,
911
- text: J(e, r)
966
+ text: z(e, r)
912
967
  };
913
968
  }
914
- function Lr(e, t) {
969
+ function _r(e, t) {
915
970
  const r = e.table, o = t.table;
916
971
  return !r || !o || r.columnKey === void 0 ? !1 : r.id === o.id && r.rowIndex === o.rowIndex && r.role === o.role && r.columnKey === o.columnKey;
917
972
  }
918
- function rt(e, t, r) {
919
- const o = e.grid, { rowIndex: n, columnIndex: a } = t.address, s = Ze(e, n, a), i = [...o.cells], c = [...i[n]], d = J(t, r.value), l = { ...s.cell, value: r.value, text: d, rawText: d };
920
- return c[s.sourceColumnIndex] = l, i[n] = c, { ...e, grid: { ...o, cells: i } };
973
+ function at(e, t, r) {
974
+ const o = e.grid, { rowIndex: n, columnIndex: a } = t.address, s = rt(e, n, a), i = [...o.cells], c = [...i[n]], l = z(t, r.value), d = { ...s.cell, value: r.value, text: l, rawText: l };
975
+ return c[s.sourceColumnIndex] = d, i[n] = c, { ...e, grid: { ...o, cells: i } };
921
976
  }
922
- function Hr(e, t) {
977
+ function qr(e, t) {
923
978
  const r = e.table?.columnKeys, o = t.table?.columnKey;
924
979
  return r && o !== void 0 ? r.flatMap((n, a) => n === o ? [a] : []) : [];
925
980
  }
926
- function Dr(e, t, r, o, n, a) {
981
+ function Ur(e, t, r, o, n, a) {
927
982
  const s = t.table, i = n.table;
928
983
  if (!s || !i || s.id !== i.id || s.role !== i.role || !t.grid) return t;
929
984
  const c = i.rowIndex - s.rowIndex;
930
985
  if (c < 0 || c >= t.grid.cells.length) return t;
931
- let d = t;
932
- for (const l of Hr(t, n)) {
933
- const f = be(e, { pageIndex: r, componentIndex: o, rowIndex: c, columnIndex: l });
934
- f?.editable && Lr(n, f) && (d = rt(d, f, a));
986
+ let l = t;
987
+ for (const d of qr(t, n)) {
988
+ const f = ve(e, { pageIndex: r, componentIndex: o, rowIndex: c, columnIndex: d });
989
+ f?.editable && _r(n, f) && (l = at(l, f, a));
935
990
  }
936
- return d;
991
+ return l;
937
992
  }
938
- function Br(e, t, r, o, n, a) {
993
+ function Xr(e, t, r, o, n, a) {
939
994
  const s = n.address;
940
- return n.table?.columnKey !== void 0 ? Dr(e, t, r, o, n, a) : s.pageIndex === r && s.componentIndex === o ? rt(t, n, a) : t;
995
+ return n.table?.columnKey !== void 0 ? Ur(e, t, r, o, n, a) : s.pageIndex === r && s.componentIndex === o ? at(t, n, a) : t;
941
996
  }
942
- function Me(e, t) {
997
+ function Se(e, t) {
943
998
  const r = t.source;
944
999
  if (!r) return !1;
945
1000
  const o = e.source;
946
1001
  return !o || ["sourceScope", "datasetId", "rowKey", "field", "revision", "sourceToken"].some((n) => !Object.is(o[n], r[n]));
947
1002
  }
948
- function Io(e, t) {
949
- const r = be(e, t.address);
950
- if (!r) throw new b("missing");
951
- if (!r.editable) throw new b("readonly");
952
- if (Me(r, t)) throw new b("conflict");
953
- if (!Object.is(r.value, t.previousValue) || (r.cell.text ?? "") !== t.previousText) throw new b("conflict");
954
- const o = tt(r, t.value), n = { ...t, value: o, text: J(r, o) };
1003
+ function jo(e, t) {
1004
+ const r = ve(e, t.address);
1005
+ if (!r) throw new y("missing");
1006
+ if (!r.editable) throw new y("readonly");
1007
+ if (Se(r, t)) throw new y("conflict");
1008
+ if (!Object.is(r.value, t.previousValue) || (r.cell.text ?? "") !== t.previousText) throw new y("conflict");
1009
+ const o = nt(r, t.value), n = { ...t, value: o, text: z(r, o) };
955
1010
  if (Object.is(o, r.value) && n.text === r.cell.text) return e;
956
1011
  const a = e.pages.map((s, i) => {
957
- const c = s.components.map((d, l) => Br(e, d, i, l, r, n));
958
- return c.every((d, l) => d === s.components[l]) ? s : { ...s, components: c };
1012
+ const c = s.components.map((l, d) => Xr(e, l, i, d, r, n));
1013
+ return c.every((l, d) => l === s.components[d]) ? s : { ...s, components: c };
959
1014
  });
960
1015
  return { ...e, pages: a };
961
1016
  }
962
- function ot(e) {
1017
+ function st(e) {
963
1018
  const t = [];
964
1019
  for (const r of e.template.pages) for (const o of r.components)
965
1020
  o.kind === "list" && (t.push(o.tree ? { ...o, rowKey: o.tree.idField } : o), o.detail && t.push({ ...o.detail, relation: { detail: o.detail, parentRows: e.datasets[o.dataset] ?? [] } }));
@@ -968,61 +1023,65 @@ function ot(e) {
968
1023
  function L(e) {
969
1024
  return JSON.stringify([e.sourceScope, e.datasetId]);
970
1025
  }
971
- function $e(e) {
1026
+ function Re(e) {
972
1027
  return JSON.stringify([e.sourceScope, e.datasetId, e.rowKey]);
973
1028
  }
974
- function nt(e) {
1029
+ function it(e) {
975
1030
  const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
976
1031
  return e.forEach((o, n) => {
977
- for (const a of ot(o)) {
1032
+ for (const a of st(o)) {
978
1033
  if (!a.rowKey) continue;
979
1034
  const s = a.relation, i = s ? new Set(s.parentRows.map((c) => JSON.stringify(c[s.detail.parentKey]))) : void 0;
980
- (o.datasets[a.dataset] ?? []).forEach((c, d) => {
1035
+ (o.datasets[a.dataset] ?? []).forEach((c, l) => {
981
1036
  if (s && !i.has(JSON.stringify(c[s.detail.foreignKey]))) return;
982
- const l = c[a.rowKey];
983
- if (typeof l != "string" && typeof l != "number") return;
984
- const f = `${n}:${a.dataset}:${d}:${a.rowKey}`;
1037
+ const d = c[a.rowKey];
1038
+ if (typeof d != "string" && typeof d != "number") return;
1039
+ const f = `${n}:${a.dataset}:${l}:${a.rowKey}`;
985
1040
  if (r.has(f)) return;
986
1041
  r.add(f);
987
- const u = $e({ sourceScope: o.sourceScope, datasetId: a.dataset, rowKey: l }), m = t.get(u) ?? [];
988
- m.push({ partIndex: n, dataset: a.dataset, rowIndex: d, row: c, binding: a }), t.set(u, m);
1042
+ const u = Re({ sourceScope: o.sourceScope, datasetId: a.dataset, rowKey: d }), m = t.get(u) ?? [];
1043
+ m.push({ partIndex: n, dataset: a.dataset, rowIndex: l, row: c, binding: a }), t.set(u, m);
989
1044
  });
990
1045
  }
991
1046
  }), (o) => {
992
- const n = t.get($e(o));
993
- if (!n?.length) throw new b("missing");
994
- if (new Set(n.map((a) => `${a.partIndex}:${a.dataset}`)).size !== n.length) throw new b("conflict");
1047
+ const n = t.get(Re(o));
1048
+ if (!n?.length) throw new y("missing");
1049
+ if (new Set(n.map((a) => `${a.partIndex}:${a.dataset}`)).size !== n.length) throw new y("conflict");
995
1050
  return n;
996
1051
  };
997
1052
  }
998
- function at(e, t) {
1053
+ function ct(e, t) {
999
1054
  const r = e.map((n) => ({ ...n, datasets: { ...n.datasets } })), o = /* @__PURE__ */ new Set();
1000
1055
  for (const { row: n, field: a, value: s } of t) {
1001
- const i = r[n.partIndex], c = `${n.partIndex}:${n.dataset}`;
1056
+ const i = r[n.partIndex], c = JSON.stringify([n.partIndex, n.dataset]);
1002
1057
  o.has(c) || (i.datasets[n.dataset] = [...i.datasets[n.dataset]], o.add(c)), i.datasets[n.dataset][n.rowIndex] = { ...i.datasets[n.dataset][n.rowIndex], [a]: s };
1003
1058
  }
1059
+ for (const n of o) {
1060
+ const [a, s] = JSON.parse(n);
1061
+ At(e[a].datasets[s], r[a].datasets[s]);
1062
+ }
1004
1063
  return r;
1005
1064
  }
1006
- function Gr(e, t, r) {
1065
+ function Yr(e, t, r) {
1007
1066
  const o = [], n = /* @__PURE__ */ new Set();
1008
1067
  return e.forEach((a, s) => {
1009
- for (const i of ot(a))
1010
- t.has(L({ sourceScope: a.sourceScope, datasetId: i.dataset })) && (a.datasets[i.dataset] ?? []).forEach((c, d) => {
1011
- const l = { partIndex: s, dataset: i.dataset, rowIndex: d, row: c, binding: i };
1068
+ for (const i of st(a))
1069
+ t.has(L({ sourceScope: a.sourceScope, datasetId: i.dataset })) && (a.datasets[i.dataset] ?? []).forEach((c, l) => {
1070
+ const d = { partIndex: s, dataset: i.dataset, rowIndex: l, row: c, binding: i };
1012
1071
  for (const [f, u] of [[i.revisionField, r.revision], [i.sourceTokenField, r.sourceToken]]) {
1013
1072
  if (!f || u === void 0) continue;
1014
- const m = `${s}:${i.dataset}:${d}:${f}`;
1015
- n.has(m) || (n.add(m), o.push({ row: l, field: f, value: u }));
1073
+ const m = `${s}:${i.dataset}:${l}:${f}`;
1074
+ n.has(m) || (n.add(m), o.push({ row: d, field: f, value: u }));
1016
1075
  }
1017
1076
  });
1018
1077
  }), o;
1019
1078
  }
1020
- function Wr(e, t, r) {
1079
+ function Qr(e, t, r) {
1021
1080
  if (!r || r.revision === void 0 && r.sourceToken === void 0) return e;
1022
1081
  const o = new Set(t.edits.flatMap((n) => n.source ? [L(n.source)] : []));
1023
- return st(e, new Map([...o].map((n) => [n, r])));
1082
+ return lt(e, new Map([...o].map((n) => [n, r])));
1024
1083
  }
1025
- function st(e, t) {
1084
+ function lt(e, t) {
1026
1085
  if (!t.size) return e;
1027
1086
  function r(a) {
1028
1087
  const s = a.datasetId && t.get(L({ ...a, datasetId: a.datasetId }));
@@ -1030,15 +1089,15 @@ function st(e, t) {
1030
1089
  }
1031
1090
  function o(a) {
1032
1091
  const s = a.map((i) => {
1033
- const c = i.table?.source ? r(i.table.source) : void 0, d = i.table && c !== i.table.source ? { ...i.table, source: c } : i.table, l = i.grid?.cells.map((u) => {
1092
+ const c = i.table?.source ? r(i.table.source) : void 0, l = i.table && c !== i.table.source ? { ...i.table, source: c } : i.table, d = i.grid?.cells.map((u) => {
1034
1093
  const m = u.map((h) => {
1035
1094
  if (!h) return h;
1036
- const g = h.source ? r(h.source) : void 0, w = h.children ? o(h.children) : void 0;
1037
- return g === h.source && w === h.children ? h : { ...h, source: g, children: w };
1095
+ const g = h.source ? r(h.source) : void 0, p = h.children ? o(h.children) : void 0;
1096
+ return g === h.source && p === h.children ? h : { ...h, source: g, children: p };
1038
1097
  });
1039
1098
  return m.some((h, g) => h !== u[g]) ? m : u;
1040
- }), f = i.grid && l?.some((u, m) => u !== i.grid.cells[m]) ? { ...i.grid, cells: l } : i.grid;
1041
- return d !== i.table || f !== i.grid ? { ...i, table: d, grid: f } : i;
1099
+ }), f = i.grid && d?.some((u, m) => u !== i.grid.cells[m]) ? { ...i.grid, cells: d } : i.grid;
1100
+ return l !== i.table || f !== i.grid ? { ...i, table: l, grid: f } : i;
1042
1101
  });
1043
1102
  return s.some((i, c) => i !== a[c]) ? s : a;
1044
1103
  }
@@ -1048,35 +1107,35 @@ function st(e, t) {
1048
1107
  });
1049
1108
  return n.some((a, s) => a !== e.pages[s]) ? { ...e, pages: n } : e;
1050
1109
  }
1051
- function Vr(e) {
1110
+ function Zr(e) {
1052
1111
  return JSON.stringify([e.pageIndex, e.componentIndex, e.rowIndex, e.columnIndex]);
1053
1112
  }
1054
- function ke(e) {
1113
+ function Ie(e) {
1055
1114
  const t = e.table;
1056
- return t?.columnKey !== void 0 ? JSON.stringify([t.id, t.role, t.rowIndex, t.columnKey]) : Vr(e.address);
1115
+ return t?.columnKey !== void 0 ? JSON.stringify([t.id, t.role, t.rowIndex, t.columnKey]) : Zr(e.address);
1057
1116
  }
1058
- function Jr(e, t) {
1117
+ function eo(e, t) {
1059
1118
  if (!t.length) return e;
1060
- const r = new Map(t.map((c) => [ke(c), c])), o = new Set(t.flatMap((c) => c.table ? [c.table.id] : [])), n = new Set(t.map((c) => `${c.address.pageIndex}:${c.address.componentIndex}`)), a = j(e);
1061
- function s(c, d, l) {
1119
+ const r = new Map(t.map((c) => [Ie(c), c])), o = new Set(t.flatMap((c) => c.table ? [c.table.id] : [])), n = new Set(t.map((c) => `${c.address.pageIndex}:${c.address.componentIndex}`)), a = j(e);
1120
+ function s(c, l, d) {
1062
1121
  const f = c.grid;
1063
- if (!f || !n.has(`${d}:${l}`) && !o.has(c.table?.id ?? "")) return c;
1122
+ if (!f || !n.has(`${l}:${d}`) && !o.has(c.table?.id ?? "")) return c;
1064
1123
  const u = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
1065
- for (const h of me(f, c.widthMm, c.heightMm).cells) {
1124
+ for (const h of ee(f, c.widthMm, c.heightMm).cells) {
1066
1125
  const g = m.get(h.ri) ?? 0;
1067
1126
  m.set(h.ri, g + 1);
1068
- const w = a({ pageIndex: d, componentIndex: l, rowIndex: h.ri, columnIndex: h.ci }), y = w && r.get(ke(w));
1069
- if (!y || !w.editable) continue;
1070
- const v = u.get(h.ri) ?? [...f.cells[h.ri]], T = J(w, y.value);
1071
- Object.is(w.value, y.value) && T === w.cell.text || (v[g] = { ...h.cell, value: y.value, text: T, rawText: T }, u.set(h.ri, v));
1127
+ const p = a({ pageIndex: l, componentIndex: d, rowIndex: h.ri, columnIndex: h.ci }), b = p && r.get(Ie(p));
1128
+ if (!b || !p.editable) continue;
1129
+ const M = u.get(h.ri) ?? [...f.cells[h.ri]], T = z(p, b.value);
1130
+ Object.is(p.value, b.value) && T === p.cell.text || (M[g] = { ...h.cell, value: b.value, text: T, rawText: T }, u.set(h.ri, M));
1072
1131
  }
1073
1132
  return u.size ? { ...c, grid: { ...f, cells: f.cells.map((h, g) => u.get(g) ?? h) } } : c;
1074
1133
  }
1075
- const i = e.pages.map((c, d) => {
1076
- const l = c.components.map((f, u) => s(f, d, u));
1077
- return l.every((f, u) => f === c.components[u]) ? c : { ...c, components: l };
1134
+ const i = e.pages.map((c, l) => {
1135
+ const d = c.components.map((f, u) => s(f, l, u));
1136
+ return d.every((f, u) => f === c.components[u]) ? c : { ...c, components: d };
1078
1137
  });
1079
- return i.every((c, d) => c === e.pages[d]) ? e : { ...e, pages: i };
1138
+ return i.every((c, l) => c === e.pages[l]) ? e : { ...e, pages: i };
1080
1139
  }
1081
1140
  function C(e) {
1082
1141
  const t = e.source;
@@ -1086,31 +1145,31 @@ function C(e) {
1086
1145
  const o = e.address;
1087
1146
  return JSON.stringify([o.pageIndex, o.componentIndex, o.rowIndex, o.columnIndex]);
1088
1147
  }
1089
- function Eo(e, t, r) {
1090
- if (typeof r != "string" || !r.trim() || !Array.isArray(t)) throw new b("missing");
1091
- if (t.length > 1e4) throw new b("limit");
1148
+ function Lo(e, t, r) {
1149
+ if (typeof r != "string" || !r.trim() || !Array.isArray(t)) throw new y("missing");
1150
+ if (t.length > 1e4) throw new y("limit");
1092
1151
  const o = /* @__PURE__ */ new Set(), n = j(e), a = t.map(({ address: s, value: i }) => {
1093
1152
  const c = n(s);
1094
- if (!c) throw new b("missing");
1095
- const d = z(c, i), l = C(d);
1096
- if (o.has(l)) throw new b("duplicate");
1097
- return o.add(l), d;
1153
+ if (!c) throw new y("missing");
1154
+ const l = _(c, i), d = C(l);
1155
+ if (o.has(d)) throw new y("duplicate");
1156
+ return o.add(d), l;
1098
1157
  });
1099
1158
  return { requestId: r, edits: a };
1100
1159
  }
1101
- function Co(e, t) {
1102
- if (t.edits.length > 1e4) throw new b("limit");
1160
+ function Ho(e, t) {
1161
+ if (t.edits.length > 1e4) throw new y("limit");
1103
1162
  const r = j(e), o = /* @__PURE__ */ new Set(), n = t.edits.map((a) => {
1104
1163
  const s = r(a.address);
1105
- if (!s) throw new b("missing");
1164
+ if (!s) throw new y("missing");
1106
1165
  const i = C(a);
1107
- if (o.has(i)) throw new b("duplicate");
1108
- if (o.add(i), Me(s, a) || !Object.is(s.value, a.previousValue) || (s.cell.text ?? "") !== a.previousText) throw new b("conflict");
1109
- return z(s, a.value);
1166
+ if (o.has(i)) throw new y("duplicate");
1167
+ if (o.add(i), Se(s, a) || !Object.is(s.value, a.previousValue) || (s.cell.text ?? "") !== a.previousText) throw new y("conflict");
1168
+ return _(s, a.value);
1110
1169
  });
1111
- return Jr(e, n);
1170
+ return eo(e, n);
1112
1171
  }
1113
- function Oo(e) {
1172
+ function Do(e) {
1114
1173
  const t = /* @__PURE__ */ new Map();
1115
1174
  for (const r of e) {
1116
1175
  const o = C(r), n = t.get(o), a = n ? { ...r, previousValue: n.previousValue, previousText: n.previousText } : { ...r };
@@ -1118,48 +1177,49 @@ function Oo(e) {
1118
1177
  }
1119
1178
  return [...t.values()];
1120
1179
  }
1121
- function it(e) {
1180
+ function dt(e) {
1122
1181
  const t = /* @__PURE__ */ new Map(), r = j(e);
1123
1182
  return e.pages.forEach((o, n) => o.components.forEach((a, s) => {
1124
1183
  if (!(!a.grid || a.table?.role !== "body"))
1125
1184
  for (let i = 0; i < a.grid.cells.length; i++) for (let c = 0; c < a.table.columnKeys.length; c++) {
1126
- const d = r({ pageIndex: n, componentIndex: s, rowIndex: i, columnIndex: c });
1127
- d?.source && d.editable && t.set(C(d), d);
1185
+ const l = r({ pageIndex: n, componentIndex: s, rowIndex: i, columnIndex: c });
1186
+ l?.source && l.editable && t.set(C(l), l);
1128
1187
  }
1129
1188
  })), t;
1130
1189
  }
1131
- function Fo(e, t, r) {
1132
- const o = it(e), n = j(e);
1190
+ function Go(e, t, r) {
1191
+ const o = dt(e), n = j(e);
1133
1192
  return t.map((a) => {
1134
1193
  const s = a.source ? o.get(C(a)) : n(a.address);
1135
- if (!s || C(s) !== C(a)) throw new b("missing");
1194
+ if (!s || C(s) !== C(a)) throw new y("missing");
1136
1195
  return { address: { ...s.address }, value: a[r] };
1137
1196
  });
1138
1197
  }
1139
- function ct(e, t) {
1140
- if (++e.nodes > 1e6 || t > 128) throw new b("limit");
1198
+ function ut(e, t) {
1199
+ if (++e.nodes > 1e6 || t > 128) throw new y("limit");
1141
1200
  }
1142
- function ve(e, t) {
1201
+ function Y(e, t) {
1143
1202
  const r = Object.getOwnPropertyDescriptor(e, t);
1144
- if (!r || r.get || r.set) throw new b("conflict");
1203
+ if (!r || r.get || r.set) throw new y("conflict");
1145
1204
  return r.value;
1146
1205
  }
1147
- function lt(e) {
1148
- if (Object.getOwnPropertyDescriptor(e, "toJSON")) throw new b("conflict");
1206
+ function ft(e) {
1207
+ if (Object.getOwnPropertyDescriptor(e, "toJSON")) throw new y("conflict");
1149
1208
  const t = Object.getPrototypeOf(e);
1150
- if (!(e instanceof Date) && !Array.isArray(e) && t !== Object.prototype && t !== null) throw new b("conflict");
1209
+ if (Array.isArray(e) && (t !== Array.prototype || Object.keys(e).length !== e.length)) throw new y("conflict");
1210
+ if (!(e instanceof Date) && !Array.isArray(e) && t !== Object.prototype && t !== null) throw new y("conflict");
1151
1211
  for (const r of Reflect.ownKeys(e))
1152
1212
  if (!(Array.isArray(e) && r === "length")) {
1153
- if (typeof r == "symbol" || !Object.getOwnPropertyDescriptor(e, r)?.enumerable) throw new b("conflict");
1154
- if (e instanceof Date || Array.isArray(e) && !/^(0|[1-9]\d*)$/.test(r)) throw new b("conflict");
1213
+ if (typeof r == "symbol" || !Object.getOwnPropertyDescriptor(e, r)?.enumerable) throw new y("conflict");
1214
+ if (e instanceof Date || Array.isArray(e) && !/^(0|[1-9]\d*)$/.test(r)) throw new y("conflict");
1155
1215
  }
1156
1216
  }
1157
- function dt(e, t, r, o, n) {
1158
- if (ct(o, n), typeof e == "function" || typeof e == "symbol") throw new b("conflict");
1217
+ function mt(e, t, r, o, n) {
1218
+ if (ut(o, n), typeof e == "function" || typeof e == "symbol") throw new y("conflict");
1159
1219
  if (e === null || typeof e != "object") return;
1160
- if (lt(e), r.has(e)) throw new b("conflict");
1220
+ if (ft(e), r.has(e)) throw new y("conflict");
1161
1221
  r.add(e);
1162
- const a = Object.keys(e), s = a.map((i) => ve(e, i));
1222
+ const a = Object.keys(e), s = a.map((i) => Y(e, i));
1163
1223
  t.push({
1164
1224
  object: e,
1165
1225
  prototype: Object.getPrototypeOf(e),
@@ -1168,87 +1228,96 @@ function dt(e, t, r, o, n) {
1168
1228
  ...e instanceof Date ? { date: Date.prototype.getTime.call(e) } : {},
1169
1229
  ...Array.isArray(e) ? { length: e.length } : {}
1170
1230
  });
1171
- for (const i of s) dt(i, t, r, o, n + 1);
1231
+ for (const i of s) mt(i, t, r, o, n + 1);
1172
1232
  r.delete(e);
1173
1233
  }
1174
- function zr(e) {
1234
+ function to(e) {
1175
1235
  const { object: t, keys: r, values: o } = e;
1176
- if (lt(t), Object.getPrototypeOf(t) !== e.prototype || Object.getOwnPropertyDescriptor(t, "toJSON") || e.date !== void 0 && !Object.is(Date.prototype.getTime.call(t), e.date) || e.length !== void 0 && t.length !== e.length) return !1;
1236
+ if (ft(t), Object.getPrototypeOf(t) !== e.prototype || Object.getOwnPropertyDescriptor(t, "toJSON") || e.date !== void 0 && !Object.is(Date.prototype.getTime.call(t), e.date) || e.length !== void 0 && t.length !== e.length) return !1;
1177
1237
  const n = Object.keys(t);
1178
- return n.length === r.length && r.every((a, s) => n[s] === a && Object.is(ve(t, a), o[s]));
1238
+ return n.length === r.length && r.every((a, s) => n[s] === a && Object.is(Y(t, a), o[s]));
1179
1239
  }
1180
- function _r(e) {
1240
+ function ro(e) {
1181
1241
  const t = [];
1182
- return dt(e, t, /* @__PURE__ */ new Set(), { nodes: 0 }, 0), () => {
1242
+ return mt(e, t, /* @__PURE__ */ new Set(), { nodes: 0 }, 0), () => {
1183
1243
  try {
1184
- return t.every(zr);
1244
+ return t.every(to);
1185
1245
  } catch {
1186
1246
  return !1;
1187
1247
  }
1188
1248
  };
1189
1249
  }
1190
- function ce(e, t, r) {
1191
- return ct(t, r), e === null || typeof e != "object" ? e : e instanceof Date ? new Date(Date.prototype.getTime.call(e)) : Array.isArray(e) ? e.map((o) => ce(o, t, r + 1)) : Object.fromEntries(Object.keys(e).map((o) => [o, ce(ve(e, o), t, r + 1)]));
1250
+ function ue(e, t, r) {
1251
+ if (ut(t, r), e === null || typeof e != "object") return e;
1252
+ if (e instanceof Date) return new Date(Date.prototype.getTime.call(e));
1253
+ if (Array.isArray(e)) {
1254
+ const o = [];
1255
+ for (let n = 0; n < e.length; n++) o[n] = ue(Y(e, String(n)), t, r + 1);
1256
+ return o;
1257
+ }
1258
+ return Object.fromEntries(Object.keys(e).map((o) => [o, ue(Y(e, o), t, r + 1)]));
1192
1259
  }
1193
- function qr(e) {
1194
- return ce(e, { nodes: 0 }, 0);
1260
+ function oo(e) {
1261
+ const t = ue(e, { nodes: 0 }, 0);
1262
+ for (const r of t) for (const o of Object.values(r.datasets)) Nt(o);
1263
+ return t;
1195
1264
  }
1196
- async function ut(e, t, r = {}) {
1265
+ async function gt(e, t, r = {}) {
1197
1266
  const o = [], n = { ...r, knownTotalPages: void 0 };
1198
- for (const a of $r(e, t, n))
1267
+ for (const a of Nr(e, t, n))
1199
1268
  o.push(a), o.length % 8 === 0 && await new Promise((s) => setTimeout(s, 0));
1200
1269
  if (r.signal?.aborted) {
1201
1270
  const a = new Error("报表重算已取消");
1202
1271
  throw a.name = "AbortError", a;
1203
1272
  }
1204
- return { schemaVersion: X, ...Q(e) ? { requiresRecalculation: !0 } : {}, pages: o };
1273
+ return { schemaVersion: Q, ...te(e) ? { requiresRecalculation: !0 } : {}, pages: o };
1205
1274
  }
1206
- const le = /* @__PURE__ */ new WeakMap();
1207
- function Ko(e) {
1208
- return le.get(e);
1275
+ const fe = /* @__PURE__ */ new WeakMap();
1276
+ function Bo(e) {
1277
+ return fe.get(e);
1209
1278
  }
1210
- function _(e) {
1279
+ function q(e) {
1211
1280
  if (e?.aborted) {
1212
1281
  const t = new Error("报表重算已取消");
1213
1282
  throw t.name = "AbortError", t;
1214
1283
  }
1215
1284
  }
1216
- function ft(e, t) {
1285
+ function ht(e, t) {
1217
1286
  return e[t] === void 0 ? "" : e[t];
1218
1287
  }
1219
- function Ur(e, t) {
1220
- if (t.edits.length > 1e4) throw new b("limit");
1288
+ function no(e, t) {
1289
+ if (t.edits.length > 1e4) throw new y("limit");
1221
1290
  const r = j(e), o = /* @__PURE__ */ new Set(), n = [], a = t.edits.map((s) => {
1222
1291
  const i = r(s.address);
1223
- if (!i?.source) throw new b("missing");
1292
+ if (!i?.source) throw new y("missing");
1224
1293
  const c = C(s);
1225
- if (o.has(c)) throw new b("duplicate");
1226
- if (o.add(c), Me(i, s) || !Object.is(i.value, s.previousValue) || (i.cell.text ?? "") !== s.previousText) throw new b("conflict");
1227
- return n.push(i), z(i, s.value);
1294
+ if (o.has(c)) throw new y("duplicate");
1295
+ if (o.add(c), Se(i, s) || !Object.is(i.value, s.previousValue) || (i.cell.text ?? "") !== s.previousText) throw new y("conflict");
1296
+ return n.push(i), _(i, s.value);
1228
1297
  });
1229
1298
  return { batch: { requestId: t.requestId, edits: a }, contexts: n };
1230
1299
  }
1231
- function Xr(e, t) {
1232
- const r = nt(e);
1300
+ function ao(e, t) {
1301
+ const r = it(e);
1233
1302
  return t.flatMap((o) => {
1234
- if (!o.source) throw new b("missing");
1303
+ if (!o.source) throw new y("missing");
1235
1304
  return r(o.source).map((n) => {
1236
- if (!Object.is(ft(n.row, o.source.field), o.previousValue)) throw new b("conflict");
1237
- if (n.binding.rowKey === o.source.field) throw new b("readonly");
1305
+ if (!Object.is(ht(n.row, o.source.field), o.previousValue)) throw new y("conflict");
1306
+ if (n.binding.rowKey === o.source.field) throw new y("readonly");
1238
1307
  return { row: n, field: o.source.field, value: o.value };
1239
1308
  });
1240
1309
  });
1241
1310
  }
1242
- function se(e, t, r) {
1311
+ function le(e, t, r) {
1243
1312
  const o = { ...e, value: t, source: { ...e.source, ...r?.revision === void 0 ? {} : { revision: r.revision }, ...r?.sourceToken === void 0 ? {} : { sourceToken: r.sourceToken } } };
1244
- return o.cell = { ...e.cell, value: o.value, text: J(o, o.value) }, o;
1313
+ return o.cell = { ...e.cell, value: o.value, text: z(o, o.value) }, o;
1245
1314
  }
1246
- function Yr(e, t, r) {
1315
+ function so(e, t, r) {
1247
1316
  if (!r || r.revision === void 0 && r.sourceToken === void 0) return [...e];
1248
1317
  const o = new Set(t.edits.flatMap((n) => n.source ? [L(n.source)] : []));
1249
- return at(e, Gr(e, o, r));
1318
+ return ct(e, Yr(e, o, r));
1250
1319
  }
1251
- function Qr(e, t, r) {
1320
+ function io(e, t, r) {
1252
1321
  const o = new Set(t.edits.map((n) => L(n.source)));
1253
1322
  for (const n of o) e.set(n, {
1254
1323
  ...e.get(n),
@@ -1257,31 +1326,31 @@ function Qr(e, t, r) {
1257
1326
  });
1258
1327
  return o;
1259
1328
  }
1260
- function mt(e, t) {
1329
+ function pt(e, t) {
1261
1330
  let r = t.parts;
1262
1331
  const o = t.rebuild;
1263
- let n = _r(r), a = e, s;
1332
+ let n = ro(r), a = e, s;
1264
1333
  const i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
1265
- function d(u) {
1266
- if (u !== a) throw new b("conflict");
1334
+ function l(u) {
1335
+ if (u !== a) throw new y("conflict");
1267
1336
  if (s) return s;
1268
- if (!n?.()) throw new b("conflict");
1269
- return qr(r);
1337
+ if (!n?.()) throw new y("conflict");
1338
+ return oo(r);
1270
1339
  }
1271
- async function l(u, m, h, g = {}) {
1272
- _(g.signal), m = { requestId: m.requestId, edits: m.edits.map((S) => ({ ...S, address: { ...S.address }, source: S.source ? { ...S.source } : void 0, table: S.table ? { ...S.table } : void 0 })) }, h = h.map((S) => ({ ...S, address: { ...S.address }, source: S.source ? { ...S.source } : void 0, table: S.table ? { ...S.table } : void 0, cell: { ...S.cell } })), await new Promise((S) => setTimeout(S, 0)), _(g.signal);
1273
- const w = d(u), y = at(w, Xr(w, m.edits)), v = st(await o(y, g.signal), c);
1274
- _(g.signal);
1340
+ async function d(u, m, h, g = {}) {
1341
+ q(g.signal), m = { requestId: m.requestId, edits: m.edits.map((S) => ({ ...S, address: { ...S.address }, source: S.source ? { ...S.source } : void 0, table: S.table ? { ...S.table } : void 0 })) }, h = h.map((S) => ({ ...S, address: { ...S.address }, source: S.source ? { ...S.source } : void 0, table: S.table ? { ...S.table } : void 0, cell: { ...S.cell } })), await new Promise((S) => setTimeout(S, 0)), q(g.signal);
1342
+ const p = l(u), b = ct(p, ao(p, m.edits)), M = lt(await o(b, g.signal), c);
1343
+ q(g.signal);
1275
1344
  let T = !1;
1276
- return { plan: v, commit(S) {
1277
- if (_(g.signal), T || a !== u) throw new b("conflict");
1278
- if (S?.conflicts?.length) throw new b("conflict");
1279
- const K = Yr(y, m, S), O = Wr(v, m, S);
1345
+ return { plan: M, commit(S) {
1346
+ if (q(g.signal), T || a !== u) throw new y("conflict");
1347
+ if (S?.conflicts?.length) throw new y("conflict");
1348
+ const A = so(b, m, S), O = Qr(M, m, S);
1280
1349
  if (S) {
1281
- const I = Qr(c, m, S);
1282
- for (const [p, M] of i) I.has(L(M.source)) && i.set(p, se(M, M.value, S));
1350
+ const I = io(c, m, S);
1351
+ for (const [w, v] of i) I.has(L(v.source)) && i.set(w, le(v, v.value, S));
1283
1352
  }
1284
- return h.forEach((I, p) => i.set(C(I), se(I, m.edits[p].value, S))), T = !0, s = K, r = void 0, n = void 0, a = O, le.set(a, f), a;
1353
+ return h.forEach((I, w) => i.set(C(I), le(I, m.edits[w].value, S))), T = !0, s = A, r = void 0, n = void 0, a = O, fe.set(a, f), a;
1285
1354
  } };
1286
1355
  }
1287
1356
  const f = {
@@ -1289,35 +1358,35 @@ function mt(e, t) {
1289
1358
  return a;
1290
1359
  },
1291
1360
  async prepare(u, m, h) {
1292
- const g = Ur(u, m);
1293
- return l(u, g.batch, g.contexts, h);
1361
+ const g = no(u, m);
1362
+ return d(u, g.batch, g.contexts, h);
1294
1363
  },
1295
- async prepareHistory(u, m, h, g, w) {
1296
- if (!g.trim() || m.length > 1e4) throw new b("limit");
1297
- const y = d(u), v = nt(y), T = it(u), S = /* @__PURE__ */ new Set(), O = m.map((M) => {
1298
- if (!M.source) throw new b("missing");
1299
- const x = C(M);
1300
- if (S.has(x)) throw new b("duplicate");
1364
+ async prepareHistory(u, m, h, g, p) {
1365
+ if (!g.trim() || m.length > 1e4) throw new y("limit");
1366
+ const b = l(u), M = it(b), T = dt(u), S = /* @__PURE__ */ new Set(), O = m.map((v) => {
1367
+ if (!v.source) throw new y("missing");
1368
+ const x = C(v);
1369
+ if (S.has(x)) throw new y("duplicate");
1301
1370
  S.add(x);
1302
- const $ = T.get(x) ?? i.get(x);
1303
- if (!$?.source) throw new b("missing");
1304
- const k = v($.source)[0];
1305
- return se($, ft(k.row, $.source.field));
1306
- }).map((M, x) => ({ context: M, edit: z(M, m[x][h]) })).filter(({ edit: M }) => !Object.is(M.previousValue, M.value)), I = { requestId: g, edits: O.map(({ edit: M }) => M) }, p = O.map(({ context: M }) => M);
1307
- return { batch: I, contexts: p, prepared: await l(u, I, p, w) };
1371
+ const k = T.get(x) ?? i.get(x);
1372
+ if (!k?.source) throw new y("missing");
1373
+ const $ = M(k.source)[0];
1374
+ return le(k, ht($.row, k.source.field));
1375
+ }).map((v, x) => ({ context: v, edit: _(v, m[x][h]) })).filter(({ edit: v }) => !Object.is(v.previousValue, v.value)), I = { requestId: g, edits: O.map(({ edit: v }) => v) }, w = O.map(({ context: v }) => v);
1376
+ return { batch: I, contexts: w, prepared: await d(u, I, w, p) };
1308
1377
  }
1309
1378
  };
1310
- return le.set(e, f), f;
1379
+ return fe.set(e, f), f;
1311
1380
  }
1312
- function Ao(e) {
1313
- const t = Ye(e.template, e.datasets, e.pagination).plan;
1314
- return mt(t, { parts: [{ template: e.template, datasets: e.datasets }], rebuild: (r, o) => ut(r[0].template, r[0].datasets, { ...e.pagination, signal: o }) });
1381
+ function Wo(e) {
1382
+ const t = et(e.template, e.datasets, e.pagination).plan;
1383
+ return pt(t, { parts: [{ template: e.template, datasets: e.datasets }], rebuild: (r, o) => gt(r[0].template, r[0].datasets, { ...e.pagination, signal: o }) });
1315
1384
  }
1316
- let Zr = 0;
1317
- function eo() {
1318
- return `report-${Date.now()}-${++Zr}`;
1385
+ let co = 0;
1386
+ function lo() {
1387
+ return `report-${Date.now()}-${++co}`;
1319
1388
  }
1320
- function Re(e, t, r) {
1389
+ function Ee(e, t, r) {
1321
1390
  if (!r?.aborted)
1322
1391
  try {
1323
1392
  const o = e?.({ ...t });
@@ -1326,14 +1395,14 @@ function Re(e, t, r) {
1326
1395
  } catch {
1327
1396
  }
1328
1397
  }
1329
- function to(e) {
1330
- const t = e.taskId ?? eo(), r = (o, n, a) => {
1331
- Re(e.onEvent, { taskId: t, ...e.correlationId === void 0 ? {} : { correlationId: e.correlationId }, stage: o, status: n, ...a === void 0 ? {} : { reportId: a } }, e.signal);
1398
+ function uo(e) {
1399
+ const t = e.taskId ?? lo(), r = (o, n, a) => {
1400
+ Ee(e.onEvent, { taskId: t, ...e.correlationId === void 0 ? {} : { correlationId: e.correlationId }, stage: o, status: n, ...a === void 0 ? {} : { reportId: a } }, e.signal);
1332
1401
  };
1333
1402
  return {
1334
1403
  taskId: t,
1335
1404
  progress(o, n, a) {
1336
- Re(e.onEvent, { taskId: t, ...e.correlationId === void 0 ? {} : { correlationId: e.correlationId }, stage: o, status: "started", completed: n, total: a }, e.signal);
1405
+ Ee(e.onEvent, { taskId: t, ...e.correlationId === void 0 ? {} : { correlationId: e.correlationId }, stage: o, status: "started", completed: n, total: a }, e.signal);
1337
1406
  },
1338
1407
  async run(o, n, a) {
1339
1408
  r(o, "started", a);
@@ -1355,18 +1424,25 @@ function to(e) {
1355
1424
  }
1356
1425
  };
1357
1426
  }
1358
- function ro(e) {
1427
+ function wt(e) {
1359
1428
  if (!e || typeof e != "object" || Array.isArray(e)) return !1;
1360
1429
  const t = e, r = (o) => typeof o == "string" && o.trim().length > 0 && o.length <= 256;
1361
1430
  return !r(t.datasetId) || !r(t.field) || t.tableId !== void 0 && !r(t.tableId) || t.reportScope !== void 0 && (typeof t.reportScope != "string" || !t.reportScope.trim() || t.reportScope.length > 4096) ? !1 : t.rowKey === void 0 ? !0 : typeof t.rowKey == "string" ? t.rowKey.trim().length > 0 && t.rowKey.length <= 1024 : typeof t.rowKey == "number" && Number.isFinite(t.rowKey);
1362
1431
  }
1363
- function oo(e) {
1432
+ function fo(e) {
1364
1433
  return e === "missing-source" || e === "not-applicable" || e === "not-calculable";
1365
1434
  }
1366
- function no(e) {
1367
- return e.target !== void 0 && !ro(e.target) ? !1 : e.valueState === void 0 || oo(e.valueState) && e.target !== void 0;
1435
+ function mo(e) {
1436
+ return e.target !== void 0 && !wt(e.target) ? !1 : e.valueState === void 0 || fo(e.valueState) && e.target !== void 0;
1437
+ }
1438
+ function Vo(e, t) {
1439
+ if (Ge([], e), !wt(t)) throw new Error("数据说明目标无效");
1440
+ const r = e.fields.find((n) => n.field === t.field);
1441
+ if (!r) throw new Error("数据说明字段未在契约中声明");
1442
+ const o = [];
1443
+ return r.description && o.push({ code: "field-definition", severity: "info", message: r.description, target: { ...t } }), r.calculation && o.push({ code: "field-calculation", severity: "info", message: r.calculation.description, target: { ...t } }), o;
1368
1444
  }
1369
- function gt(e, t, r = {}) {
1445
+ function yt(e, t, r = {}) {
1370
1446
  const o = /* @__PURE__ */ new Map();
1371
1447
  for (const a of e.pages) for (const s of a.components) {
1372
1448
  if (s.kind !== "list" || s.tree?.input !== "nested") continue;
@@ -1378,26 +1454,26 @@ function gt(e, t, r = {}) {
1378
1454
  const n = { ...t };
1379
1455
  for (const [a, s] of o) {
1380
1456
  const i = Math.min(s.maxRows ?? 1e5, r.maxRows ?? 1 / 0);
1381
- n[a] = je(t[a] ?? [], { ...s, maxRows: i }, r.signal);
1457
+ n[a] = He(t[a] ?? [], { ...s, maxRows: i }, r.signal);
1382
1458
  }
1383
1459
  return n;
1384
1460
  }
1385
- function No(e, t, r = {}) {
1386
- return Object.values(gt(e, t, r)).reduce((o, n) => o + n.length, 0);
1461
+ function Jo(e, t, r = {}) {
1462
+ return Object.values(yt(e, t, r)).reduce((o, n) => o + n.length, 0);
1387
1463
  }
1388
- function jo(e, t, r) {
1389
- const o = Wt(r), n = e?.pages.flatMap((i) => i.components).find((i) => i.kind === "list" && i.dataset === t && i.tree?.input === "nested");
1464
+ function zo(e, t, r) {
1465
+ const o = qt(r), n = e?.pages.flatMap((i) => i.components).find((i) => i.kind === "list" && i.dataset === t && i.tree?.input === "nested");
1390
1466
  if (!n || n.kind !== "list" || !n.tree) return o;
1391
1467
  const a = o.items, s = n.tree.childrenField ?? "children";
1392
1468
  return { ...o, items: { $ref: "#/$defs/treeNode" }, $defs: { treeNode: { ...a, properties: { ...a.properties, [s]: { anyOf: [{ type: "null" }, { type: "array", items: { $ref: "#/$defs/treeNode" } }] } } } } };
1393
1469
  }
1394
- function ht(e, t) {
1470
+ function bt(e, t) {
1395
1471
  return JSON.stringify([e, t]);
1396
1472
  }
1397
- function pt(e, t, r) {
1398
- return r === void 0 ? ht(e, t) : JSON.stringify(["shared", r]);
1473
+ function Mt(e, t, r) {
1474
+ return r === void 0 ? bt(e, t) : JSON.stringify(["shared", r]);
1399
1475
  }
1400
- function wt(e, t, r) {
1476
+ function vt(e, t, r) {
1401
1477
  return e.map((o) => {
1402
1478
  const n = o.table ? {
1403
1479
  ...o.table,
@@ -1406,7 +1482,7 @@ function wt(e, t, r) {
1406
1482
  } : void 0, a = o.grid?.cells.map((s) => s.map((i) => !i || !i.source && !i.children ? i : {
1407
1483
  ...i,
1408
1484
  ...i.source ? { source: { ...i.source, sourceScope: t } } : {},
1409
- ...i.children ? { children: wt(i.children, t, r) } : {}
1485
+ ...i.children ? { children: vt(i.children, t, r) } : {}
1410
1486
  }));
1411
1487
  return n || a ? {
1412
1488
  ...o,
@@ -1415,7 +1491,7 @@ function wt(e, t, r) {
1415
1491
  } : o;
1416
1492
  });
1417
1493
  }
1418
- function Lo(e) {
1494
+ function _o(e) {
1419
1495
  if (!("mapData" in e)) return e;
1420
1496
  const { load: t, mapData: r, ...o } = e;
1421
1497
  return { ...o, load: async (n) => {
@@ -1433,17 +1509,17 @@ class P extends Error {
1433
1509
  super(r), this.name = "ReportSourceError", this.code = t, this.cause = o;
1434
1510
  }
1435
1511
  }
1436
- function oe(e) {
1512
+ function se(e) {
1437
1513
  const t = new Error("报表加载已取消");
1438
1514
  return t.name = "AbortError", Object.defineProperty(t, "cause", { value: e.reason }), t;
1439
1515
  }
1440
1516
  function R(e) {
1441
- if (e?.aborted) throw oe(e);
1517
+ if (e?.aborted) throw se(e);
1442
1518
  }
1443
- function de(e, t) {
1519
+ function me(e, t) {
1444
1520
  return t ? new Promise((r, o) => {
1445
1521
  const n = () => t.removeEventListener("abort", a), a = () => {
1446
- n(), o(oe(t));
1522
+ n(), o(se(t));
1447
1523
  };
1448
1524
  t.addEventListener("abort", a, { once: !0 }), t.aborted && a(), Promise.resolve(e).then(
1449
1525
  (s) => {
@@ -1455,75 +1531,75 @@ function de(e, t) {
1455
1531
  );
1456
1532
  }) : Promise.resolve(e);
1457
1533
  }
1458
- function ao(e, t) {
1534
+ function go(e, t) {
1459
1535
  if (!e || typeof e != "object" || Array.isArray(e))
1460
1536
  throw new P("validate", `报表 ${t} 的数据集应为对象`);
1461
1537
  for (const [r, o] of Object.entries(e))
1462
1538
  if (!Array.isArray(o) || o.some((n) => !n || typeof n != "object" || Array.isArray(n)))
1463
1539
  throw new P("validate", `报表 ${t} 的数据集 ${r} 应为对象数组`);
1464
1540
  }
1465
- async function so(e, t, r) {
1541
+ async function ho(e, t, r) {
1466
1542
  const { reportId: o, signal: n } = t;
1467
1543
  try {
1468
- const a = await de(e(t), n);
1544
+ const a = await me(e(t), n);
1469
1545
  R(n);
1470
- const s = Lt(a);
1546
+ const s = Wt(a);
1471
1547
  if (!s.ok)
1472
1548
  throw new P("validate", `报表 ${o} 模板校验失败:${s.errors.slice(0, 3).map((i) => `${i.path}: ${i.message}`).join("; ")}`);
1473
1549
  return r.push(...s.warnings.map((i) => `${o}: ${i.path}: ${i.message}`)), a;
1474
1550
  } catch (a) {
1475
- throw n?.aborted ? oe(n) : a instanceof P ? a : a instanceof Ht ? new P("validate", `报表 ${o} 模板校验失败:${a.message}`, a) : new P("fetch", `报表 ${o} 模板加载失败:${a instanceof Error ? a.message : String(a)}`, a);
1551
+ throw n?.aborted ? se(n) : a instanceof P ? a : a instanceof Vt ? new P("validate", `报表 ${o} 模板校验失败:${a.message}`, a) : new P("fetch", `报表 ${o} 模板加载失败:${a instanceof Error ? a.message : String(a)}`, a);
1476
1552
  }
1477
1553
  }
1478
- async function io(e, t, r, o) {
1554
+ async function po(e, t, r, o) {
1479
1555
  const n = t.signal;
1480
1556
  let a;
1481
1557
  try {
1482
- if (e.load) a = await de(e.load(t), n);
1558
+ if (e.load) a = await me(e.load(t), n);
1483
1559
  else if (e.provider) {
1484
- const s = await de(e.provider.query(t), n);
1485
- R(n), co(s, r), a = s.datasets, o?.(r, s);
1560
+ const s = await me(e.provider.query(t), n);
1561
+ R(n), wo(s, r), a = s.datasets, o?.(r, s);
1486
1562
  } else a = e.datasets ?? {};
1487
1563
  } catch (s) {
1488
- throw n?.aborted ? oe(n) : s instanceof P ? s : new P("fetch", `报表 ${r} 取数失败:${s instanceof Error ? s.message : String(s)}`, s);
1564
+ throw n?.aborted ? se(n) : s instanceof P ? s : new P("fetch", `报表 ${r} 取数失败:${s instanceof Error ? s.message : String(s)}`, s);
1489
1565
  }
1490
1566
  return R(n), a;
1491
1567
  }
1492
- function co(e, t) {
1568
+ function wo(e, t) {
1493
1569
  if (!e || typeof e != "object" || Array.isArray(e)) throw new P("validate", `报表 ${t} Provider 应返回 datasets 结果对象`);
1494
1570
  for (const r of ["revision", "sourceToken"])
1495
1571
  if (e[r] !== void 0 && typeof e[r] != "string") throw new P("validate", `报表 ${t} Provider ${r} 应为字符串`);
1496
1572
  if (e.diagnostics !== void 0 && (!Array.isArray(e.diagnostics) || e.diagnostics.some((r) => !r || typeof r.code != "string" || typeof r.message != "string" || !["info", "warning", "error"].includes(r.severity))))
1497
1573
  throw new P("validate", `报表 ${t} Provider diagnostics 不符合结构化诊断契约`);
1498
- if (e.diagnostics?.some((r) => !no(r)))
1574
+ if (e.diagnostics?.some((r) => !mo(r)))
1499
1575
  throw new P("validate", `报表 ${t} Provider 数据说明缺少有效的字段身份或值状态`);
1500
1576
  }
1501
- function lo(e, t, r, o, n) {
1577
+ function yo(e, t, r, o, n) {
1502
1578
  try {
1503
- t = gt(o, t, { maxRows: e.dataValidation?.maxRows, signal: n });
1579
+ t = yt(o, t, { maxRows: e.dataValidation?.maxRows, signal: n });
1504
1580
  } catch (a) {
1505
1581
  throw new P("validate", `报表 ${r} 树形数据无效:${a instanceof Error ? a.message : String(a)}`, a);
1506
1582
  }
1507
1583
  for (const [a, s] of Object.entries(e.dataSchema ?? {})) {
1508
1584
  let i;
1509
1585
  try {
1510
- i = Vt(Object.prototype.hasOwnProperty.call(t, a) ? t[a] : void 0, s, { ...e.dataValidation, path: `$.datasets.${a}` });
1586
+ i = Ge(Object.prototype.hasOwnProperty.call(t, a) ? t[a] : void 0, s, { ...e.dataValidation, path: `$.datasets.${a}` });
1511
1587
  } catch (c) {
1512
1588
  throw new P("config", `报表 ${r} 数据集 ${a} 字段契约配置无效`, c);
1513
1589
  }
1514
1590
  if (!i.ok) throw new P("validate", `报表 ${r} 数据集 ${a} 不符合字段契约:${i.issues[0]?.message}`, { issues: i.issues });
1515
1591
  }
1516
1592
  }
1517
- function yt(e, t) {
1593
+ function St(e, t) {
1518
1594
  if (!e.repeat) return !1;
1519
1595
  const r = Object.prototype.hasOwnProperty.call(t, e.repeat.dataset) ? t[e.repeat.dataset] : void 0;
1520
1596
  return Array.isArray(r) && r.length === 0;
1521
1597
  }
1522
- function bt(e) {
1598
+ function xt(e) {
1523
1599
  const t = (r) => r.grid?.cells.reduce((o, n) => o + n.reduce((a, s) => a + (s ? 1 + (s.children?.reduce((i, c) => i + t(c), 0) ?? 0) : 0), 0), 0) ?? 0;
1524
1600
  return e.pages.reduce((r, o) => r + o.components.reduce((n, a) => n + t(a), 0), 0);
1525
1601
  }
1526
- function Mt(e, t, r, o) {
1602
+ function Tt(e, t, r, o) {
1527
1603
  return {
1528
1604
  ...e,
1529
1605
  signal: o ?? e?.signal,
@@ -1531,45 +1607,45 @@ function Mt(e, t, r, o) {
1531
1607
  ...r === void 0 ? {} : { maxCells: Math.max(1, Math.min(r, e?.maxCells ?? r)) }
1532
1608
  };
1533
1609
  }
1534
- function uo(e, t, r, o, n, a) {
1610
+ function bo(e, t, r, o, n, a) {
1535
1611
  const s = n.maxPages === void 0 ? void 0 : n.maxPages - n.usedPages, i = n.maxCells === void 0 ? void 0 : n.maxCells - n.usedCells;
1536
1612
  try {
1537
- if (s !== void 0 && s < 1 && e.pages.length && !yt(e, t)) throw new N(0, 1);
1538
- const c = Mt(r.pagination, s, i, a), d = Ye(e, t, c), l = bt(d.plan);
1539
- if (i !== void 0 && l > i) throw new D(i, l);
1540
- return { ...d, cells: l };
1613
+ if (s !== void 0 && s < 1 && e.pages.length && !St(e, t)) throw new K(0, 1);
1614
+ const c = Tt(r.pagination, s, i, a), l = et(e, t, c), d = xt(l.plan);
1615
+ if (i !== void 0 && d > i) throw new D(i, d);
1616
+ return { ...l, cells: d };
1541
1617
  } catch (c) {
1542
- let d = c;
1543
- throw c instanceof N && n.maxPages !== void 0 && c.limit === s && (d = new N(n.maxPages, n.usedPages + c.actual)), c instanceof D && n.maxCells !== void 0 && (d = new D(n.maxCells, n.usedCells + c.actual)), new P("validate", `报表 ${o} 排版失败:${d instanceof Error ? d.message : String(d)}`, d);
1618
+ let l = c;
1619
+ throw c instanceof K && n.maxPages !== void 0 && c.limit === s && (l = new K(n.maxPages, n.usedPages + c.actual)), c instanceof D && n.maxCells !== void 0 && (l = new D(n.maxCells, n.usedCells + c.actual)), new P("validate", `报表 ${o} 排版失败:${l instanceof Error ? l.message : String(l)}`, l);
1544
1620
  }
1545
1621
  }
1546
- function vt(e, t, r, o, n) {
1622
+ function Pt(e, t, r, o, n) {
1547
1623
  const a = /* @__PURE__ */ new Map(), s = (i) => {
1548
1624
  let c = a.get(i);
1549
1625
  return c === void 0 && (c = JSON.stringify([r, o, i]), a.set(i, c)), c;
1550
1626
  };
1551
1627
  for (const i of t.pages) e.push({
1552
1628
  ...i,
1553
- meta: { ...i.meta, reportScope: ht(r, o) },
1554
- components: wt(i.components, n ?? pt(r, o), s)
1629
+ meta: { ...i.meta, reportScope: bt(r, o) },
1630
+ components: vt(i.components, n ?? Mt(r, o), s)
1555
1631
  });
1556
1632
  }
1557
- async function fo(e, t, r, o, n) {
1633
+ async function Mo(e, t, r, o, n) {
1558
1634
  const a = [];
1559
1635
  let s = 0;
1560
- for (const [d, l] of e.entries()) {
1636
+ for (const [l, d] of e.entries()) {
1561
1637
  R(n);
1562
1638
  const f = o.maxPages === void 0 ? void 0 : o.maxPages - a.length, u = o.maxCells === void 0 ? void 0 : o.maxCells - s;
1563
- if (f !== void 0 && f < 1 && l.template.pages.length && !yt(l.template, l.datasets)) throw new N(o.maxPages, a.length + 1);
1564
- const m = await ut(l.template, l.datasets, Mt(t[d]?.pagination, f, u, n));
1565
- if (s += bt(m), o.maxCells !== void 0 && s > o.maxCells) throw new D(o.maxCells, s);
1566
- vt(a, m, d, r[d], l.sourceScope);
1639
+ if (f !== void 0 && f < 1 && d.template.pages.length && !St(d.template, d.datasets)) throw new K(o.maxPages, a.length + 1);
1640
+ const m = await gt(d.template, d.datasets, Tt(t[l]?.pagination, f, u, n));
1641
+ if (s += xt(m), o.maxCells !== void 0 && s > o.maxCells) throw new D(o.maxCells, s);
1642
+ Pt(a, m, l, r[l], d.sourceScope);
1567
1643
  }
1568
- const i = { schemaVersion: X, ...e.some((d) => Q(d.template)) ? { requiresRecalculation: !0 } : {}, pages: a }, c = Le(i);
1644
+ const i = { schemaVersion: Q, ...e.some((l) => te(l.template)) ? { requiresRecalculation: !0 } : {}, pages: a }, c = De(i);
1569
1645
  if (!c.ok) throw new P("validate", `重算渲染计划校验失败:${c.errors[0]?.message}`);
1570
1646
  return i;
1571
1647
  }
1572
- function Ho(e, t = {}) {
1648
+ function qo(e, t = {}) {
1573
1649
  if (t.maxPages !== void 0 && (!Number.isSafeInteger(t.maxPages) || t.maxPages < 1)) throw new P("config", "maxPages 应为正安全整数");
1574
1650
  if (t.maxCells !== void 0 && (!Number.isSafeInteger(t.maxCells) || t.maxCells < 1)) throw new P("config", "maxCells 应为正安全整数");
1575
1651
  function r(n) {
@@ -1578,125 +1654,126 @@ function Ho(e, t = {}) {
1578
1654
  if (a.sourceScope !== void 0 && (typeof a.sourceScope != "string" || !a.sourceScope.trim() || a.sourceScope.length > 512)) throw new P("config", "sourceScope 应为不超过 512 字符的非空字符串");
1579
1655
  return a;
1580
1656
  }
1581
- return Object.assign(async ({ reportIds: n, params: a, signal: s, onWarning: i, onQueryResult: c, ...d }) => {
1657
+ return Object.assign(async ({ reportIds: n, params: a, signal: s, onWarning: i, onQueryResult: c, ...l }) => {
1582
1658
  R(s);
1583
- const l = to({ ...d, signal: s }), f = [...n], u = { ...a };
1659
+ const d = uo({ ...l, signal: s }), f = [...n], u = { ...a };
1584
1660
  if (f.length === 0) throw new P("config", "缺少报表 ID");
1585
- const m = f.map(r), h = l.runSync("validate", () => m.map((p) => xe(
1586
- p.params ?? (typeof p.template == "function" ? [] : p.template.params) ?? [],
1661
+ const m = f.map(r), h = d.runSync("validate", () => m.map((w) => Te(
1662
+ w.params ?? (typeof w.template == "function" ? [] : w.template.params) ?? [],
1587
1663
  u
1588
- ))), g = [], w = [];
1589
- let y = 0;
1590
- const v = [];
1591
- for (const [p, M] of m.entries()) {
1664
+ ))), g = [], p = [];
1665
+ let b = 0;
1666
+ const M = [];
1667
+ for (const [w, v] of m.entries()) {
1592
1668
  R(s);
1593
- const x = f[p], $ = { reportId: x, params: h[p], signal: s }, k = typeof M.template == "function" ? await l.run("query", () => so(M.template, $, v), x) : M.template;
1594
- $.params = l.runSync("validate", () => xe(M.params ?? k.params ?? [], $.params), x);
1595
- const F = await l.run("query", () => io(M, $, x, (ae, St) => c?.(ae, St, p)), x);
1596
- l.runSync("validate", () => {
1597
- ao(F, x), t.onDatasets?.(x, F, k), lo(M, F, x, k, s);
1669
+ const x = f[w], k = { reportId: x, params: h[w], signal: s }, $ = typeof v.template == "function" ? await d.run("query", () => ho(v.template, k, M), x) : v.template;
1670
+ k.params = d.runSync("validate", () => Te(v.params ?? $.params ?? [], k.params), x);
1671
+ const F = await d.run("query", () => po(v, k, x, (ce, kt) => c?.(ce, kt, w)), x);
1672
+ d.runSync("validate", () => {
1673
+ go(F, x), t.onDatasets?.(x, F, $), yo(v, F, x, $, s);
1598
1674
  }, x), R(s);
1599
- const ne = l.runSync("layout", () => uo(k, F, M, x, { maxPages: t.maxPages, usedPages: g.length, maxCells: t.maxCells, usedCells: y }, s), x);
1600
- y += ne.cells;
1601
- const Se = pt(p, x, M.sourceScope);
1602
- w.push({ template: k, datasets: F, sourceScope: Se }), vt(g, ne.plan, p, x, Se), v.push(...ne.warnings.map((ae) => `${x}: ${ae}`));
1675
+ const ie = d.runSync("layout", () => bo($, F, v, x, { maxPages: t.maxPages, usedPages: g.length, maxCells: t.maxCells, usedCells: b }, s), x);
1676
+ b += ie.cells;
1677
+ const xe = Mt(w, x, v.sourceScope);
1678
+ p.push({ template: $, datasets: F, sourceScope: xe }), Pt(g, ie.plan, w, x, xe), M.push(...ie.warnings.map((ce) => `${x}: ${ce}`));
1603
1679
  }
1604
1680
  R(s);
1605
- const T = { schemaVersion: X, ...w.some((p) => Q(p.template)) ? { requiresRecalculation: !0 } : {}, pages: g }, S = l.runSync("validate", () => {
1606
- const p = Le(T);
1607
- if (!p.ok) throw new P("validate", `渲染计划校验失败:${p.errors.slice(0, 3).map((M) => `${M.path}: ${M.message}`).join("; ")}`);
1608
- return p;
1681
+ const T = { schemaVersion: Q, ...p.some((w) => te(w.template)) ? { requiresRecalculation: !0 } : {}, pages: g }, S = d.runSync("validate", () => {
1682
+ const w = De(T);
1683
+ if (!w.ok) throw new P("validate", `渲染计划校验失败:${w.errors.slice(0, 3).map((v) => `${v.path}: ${v.message}`).join("; ")}`);
1684
+ return w;
1609
1685
  });
1610
- v.push(...S.warnings.map((p) => `${p.path}: ${p.message}`));
1611
- const K = m.map((p) => ({ ...p, pagination: { ...p.pagination } })), O = { maxPages: t.maxPages, maxCells: t.maxCells };
1686
+ M.push(...S.warnings.map((w) => `${w.path}: ${w.message}`));
1687
+ const A = m.map((w) => ({ ...w, pagination: { ...w.pagination } })), O = { maxPages: t.maxPages, maxCells: t.maxCells };
1612
1688
  try {
1613
- mt(T, { parts: w, rebuild: (p, M) => fo(p, K, f, O, M) });
1689
+ pt(T, { parts: p, rebuild: (w, v) => Mo(w, A, f, O, v) });
1614
1690
  } catch {
1615
- v.push("来源数据无法建立本地重算口径;当前预览仅支持计划内编辑,请使用可序列化模板数据启用规则重算");
1691
+ M.push("来源数据无法建立本地重算口径;当前预览仅支持计划内编辑,请使用可序列化模板数据启用规则重算");
1616
1692
  }
1617
- const I = i ?? t.onWarning ?? ((p) => console.warn("[mach-report]", p));
1618
- for (const p of v)
1619
- R(s), I(p);
1693
+ const I = i ?? t.onWarning ?? ((w) => console.warn("[mach-report]", w));
1694
+ for (const w of M)
1695
+ R(s), I(w);
1620
1696
  return R(s), T;
1621
1697
  }, {
1622
- getParamDefs: (n) => Dt(e, n)
1698
+ getParamDefs: (n) => Jt(e, n)
1623
1699
  });
1624
1700
  }
1625
- function Do(e, t) {
1701
+ function Uo(e, t) {
1626
1702
  const r = t.maxNodes ?? 1e6;
1627
- if (![t.maxBytes, r].every((l) => Number.isSafeInteger(l) && l > 0)) throw t.error("budget", "快照预算应为正安全整数");
1703
+ if (![t.maxBytes, r].every((d) => Number.isSafeInteger(d) && d > 0)) throw t.error("budget", "快照预算应为正安全整数");
1628
1704
  let o = 0, n = 0;
1629
1705
  const a = /* @__PURE__ */ new Set();
1630
- function s(l) {
1631
- if (n += l, n > t.maxBytes) throw t.error("budget", "快照超过字节预算");
1706
+ function s(d) {
1707
+ if (n += d, n > t.maxBytes) throw t.error("budget", "快照超过字节预算");
1632
1708
  }
1633
- function i(l, f) {
1709
+ function i(d, f) {
1634
1710
  if (++o > r || f > 64) throw t.error("budget", "快照节点或深度超过预算");
1635
- if (o % 1024 === 0 && t.check?.(), typeof l == "string")
1636
- return s(l.length + 2), l;
1637
- if (l === null || typeof l == "boolean" || typeof l == "number" && Number.isFinite(l))
1638
- return s(String(l).length), l;
1639
- if (!l || typeof l != "object" || a.has(l)) throw t.error("input", "快照应为无循环的有限 JSON 值");
1640
- return c(l, f);
1711
+ if (o % 1024 === 0 && t.check?.(), typeof d == "string")
1712
+ return s(d.length + 2), d;
1713
+ if (d === null || typeof d == "boolean" || typeof d == "number" && Number.isFinite(d))
1714
+ return s(String(d).length), d;
1715
+ if (!d || typeof d != "object" || a.has(d)) throw t.error("input", "快照应为无循环的有限 JSON 值");
1716
+ return c(d, f);
1641
1717
  }
1642
- function c(l, f) {
1643
- const u = Array.isArray(l), m = Object.getPrototypeOf(l);
1644
- if (m !== (u ? Array.prototype : Object.prototype) && !(m === null && !u) || Object.getOwnPropertySymbols(l).length) throw t.error("input", "快照应为普通 JSON 对象");
1645
- const h = Object.getOwnPropertyNames(l).filter((y) => !(u && y === "length"));
1646
- if (u && (h.length !== l.length || h.some((y, v) => y !== String(v)))) throw t.error("input", "快照数组应为连续数组");
1647
- a.add(l), s(2);
1718
+ function c(d, f) {
1719
+ const u = Array.isArray(d), m = Object.getPrototypeOf(d);
1720
+ if (m !== (u ? Array.prototype : Object.prototype) && !(m === null && !u) || Object.getOwnPropertySymbols(d).length) throw t.error("input", "快照应为普通 JSON 对象");
1721
+ const h = Object.getOwnPropertyNames(d).filter((b) => !(u && b === "length"));
1722
+ if (u && (h.length !== d.length || h.some((b, M) => b !== String(M)))) throw t.error("input", "快照数组应为连续数组");
1723
+ a.add(d), s(2);
1648
1724
  const g = /* @__PURE__ */ Object.create(null);
1649
- let w = 0;
1650
- for (const y of h) {
1651
- const v = Object.getOwnPropertyDescriptor(l, y);
1652
- if (v.get || v.set || !v.enumerable || ["__proto__", "constructor", "prototype"].includes(y)) throw t.error("input", "快照不允许访问器或危险键");
1653
- v.value === void 0 && !u || (s((w++ ? 1 : 0) + (u ? 0 : y.length + 3)), g[y] = i(v.value === void 0 ? null : v.value, f + 1));
1725
+ let p = 0;
1726
+ for (const b of h) {
1727
+ const M = Object.getOwnPropertyDescriptor(d, b);
1728
+ if (M.get || M.set || !M.enumerable || ["__proto__", "constructor", "prototype"].includes(b)) throw t.error("input", "快照不允许访问器或危险键");
1729
+ M.value === void 0 && !u || (s((p++ ? 1 : 0) + (u ? 0 : b.length + 3)), g[b] = i(M.value === void 0 ? null : M.value, f + 1));
1654
1730
  }
1655
- return a.delete(l), u ? h.map((y) => g[y]) : g;
1731
+ return a.delete(d), u ? h.map((b) => g[b]) : g;
1656
1732
  }
1657
1733
  t.check?.();
1658
- const d = JSON.stringify(i(e, 0));
1659
- if (new TextEncoder().encode(d).byteLength > t.maxBytes) throw t.error("budget", "快照超过字节预算");
1660
- return JSON.parse(d);
1734
+ const l = JSON.stringify(i(e, 0));
1735
+ if (new TextEncoder().encode(l).byteLength > t.maxBytes) throw t.error("budget", "快照超过字节预算");
1736
+ return JSON.parse(l);
1661
1737
  }
1662
1738
  export {
1663
- Fo as A,
1664
- C as B,
1665
- Oo as C,
1666
- Yt as D,
1667
- Re as E,
1668
- gt as F,
1669
- No as G,
1670
- to as H,
1671
- jo as I,
1672
- eo as J,
1673
- ht as K,
1739
+ pt as A,
1740
+ Go as B,
1741
+ C,
1742
+ ir as D,
1743
+ Do as E,
1744
+ Ee as F,
1745
+ yt as G,
1746
+ Jo as H,
1747
+ uo as I,
1748
+ zo as J,
1749
+ lo as K,
1750
+ bt as L,
1674
1751
  D as P,
1675
1752
  P as R,
1676
- b as a,
1677
- N as b,
1678
- Io as c,
1679
- Lo as d,
1680
- Co as e,
1681
- Wr as f,
1682
- st as g,
1683
- $o as h,
1684
- Ro as i,
1685
- Eo as j,
1753
+ y as a,
1754
+ K as b,
1755
+ jo as c,
1756
+ _o as d,
1757
+ Ho as e,
1758
+ Qr as f,
1759
+ lt as g,
1760
+ Ao as h,
1761
+ Ko as i,
1762
+ Lo as j,
1686
1763
  j as k,
1687
- Ao as l,
1688
- Ho as m,
1689
- ko as n,
1690
- J as o,
1691
- tt as p,
1692
- be as q,
1693
- Ko as r,
1694
- Do as s,
1695
- no as t,
1696
- ro as u,
1697
- oo as v,
1698
- Ye as w,
1699
- $r as x,
1700
- zt as y,
1701
- mt as z
1764
+ Wo as l,
1765
+ qo as m,
1766
+ No as n,
1767
+ Vo as o,
1768
+ nt as p,
1769
+ z as q,
1770
+ ve as r,
1771
+ Uo as s,
1772
+ Bo as t,
1773
+ mo as u,
1774
+ wt as v,
1775
+ fo as w,
1776
+ et as x,
1777
+ Nr as y,
1778
+ rr as z
1702
1779
  };