@agile-team/mach-report 2.21.1 → 2.22.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 (110) hide show
  1. package/README.md +16 -2
  2. package/dist/{ExcelBindingWizard-Bu0LUlzl.cjs → ExcelBindingWizard-CW79I6Gl.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-mnAO2qOX.js → ExcelBindingWizard-CZyppD7I.js} +3 -3
  4. package/dist/{ParamEditor-38ZfNrPU.cjs → ParamEditor-CiYCJI0b.cjs} +1 -1
  5. package/dist/{ParamEditor-C8l0EC8m.js → ParamEditor-DQit-Gdf.js} +2 -2
  6. package/dist/{ReportBatchPanel-CfUVhvkO.js → ReportBatchPanel-DKTpV7MU.js} +2 -2
  7. package/dist/{ReportBatchPanel-nCC06Nfp.cjs → ReportBatchPanel-Db6TAfG5.cjs} +1 -1
  8. package/dist/ReportLabelStudio-B0i9ohQj.cjs +1 -0
  9. package/dist/ReportLabelStudio-BYnRqmje.js +780 -0
  10. package/dist/{ReportParamPanel-peB-KEmm.js → ReportParamPanel-BHSKVL8k.js} +231 -224
  11. package/dist/ReportParamPanel-lngONOEz.cjs +1 -0
  12. package/dist/ReportPreview-BDgKssYR.js +5887 -0
  13. package/dist/ReportPreview-Dw-4icG6.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-B5t_EcIs.js → ReportTemplateLibrary-BZuKn0YK.js} +1 -1
  15. package/dist/{ReportTemplateLibrary-DVlsf72p.cjs → ReportTemplateLibrary-DEXH07ND.cjs} +1 -1
  16. package/dist/{RuleEditor-kT1JsZ9f.js → RuleEditor-CIQn547x.js} +3 -3
  17. package/dist/{RuleEditor-xFkCVlii.cjs → RuleEditor-zSUmPjKa.cjs} +1 -1
  18. package/dist/{TemplateOutlinePanel-CDI6mfWx.cjs → TemplateOutlinePanel-B5SfGYVN.cjs} +1 -1
  19. package/dist/{TemplateOutlinePanel-BesgGR1P.js → TemplateOutlinePanel-D0PgOSQE.js} +2 -2
  20. package/dist/{TemplateReusePanel-BNFU6V-W.js → TemplateReusePanel-BKlAEF8-.js} +2 -2
  21. package/dist/{TemplateReusePanel-BG9Or5-P.cjs → TemplateReusePanel-DAy_Hwqz.cjs} +1 -1
  22. package/dist/TemplateReviewPanel-CowmHaQQ.cjs +1 -0
  23. package/dist/{TemplateReviewPanel-CwvwyCSs.js → TemplateReviewPanel-div-EH_m.js} +2 -2
  24. package/dist/artifact-integrity.json +76 -76
  25. package/dist/{auto-Tq7ReIC1.cjs → auto-DcUHlKob.cjs} +1 -1
  26. package/dist/{auto-BkdGiNtr.js → auto-moShblh1.js} +4 -4
  27. package/dist/{designer-HQi-03R6.js → designer-B7jJeAeG.js} +1500 -1455
  28. package/dist/{designer-DU3yDWgs.cjs → designer-BWQVpJeN.cjs} +2 -2
  29. package/dist/designer.cjs +1 -1
  30. package/dist/designer.d.cts +149 -2
  31. package/dist/designer.d.ts +149 -2
  32. package/dist/designer.js +13 -12
  33. package/dist/{encoding-BSeUwrN7.js → encoding-DbnhbwI8.js} +2 -2
  34. package/dist/{encoding-B79hW4zq.cjs → encoding-ncQAvyOv.cjs} +1 -1
  35. package/dist/index.cjs +5 -5
  36. package/dist/index.d.cts +38 -0
  37. package/dist/index.d.ts +38 -0
  38. package/dist/index.js +299 -279
  39. package/dist/{json-snapshot-Kgn459Oj.js → json-snapshot-DvQbZlD7.js} +2 -2
  40. package/dist/{json-snapshot-I5VI84Vp.cjs → json-snapshot-nyV63AbB.cjs} +1 -1
  41. package/dist/{plugin-BaRUGORD.cjs → plugin-AcAQ2m9X.cjs} +1 -1
  42. package/dist/{plugin-D4kAxfLG.js → plugin-w5Nyt08U.js} +1 -1
  43. package/dist/{prefill-CJSazcVY.js → prefill-BXBxx5We.js} +1 -1
  44. package/dist/{prefill-Bpyn58AZ.cjs → prefill-DUvejVt1.cjs} +1 -1
  45. package/dist/prepared-YXy-fVLw.cjs +1 -0
  46. package/dist/{prepared-BwjwEzFz.js → prepared-rXCKqdHY.js} +35 -34
  47. package/dist/{protocol-C8VWF9An.cjs → protocol-C9ZaylID.cjs} +1 -1
  48. package/dist/{protocol-Bs9-ohHN.js → protocol-fjaeKkjf.js} +3 -3
  49. package/dist/{region-binding-workflow-JNowHd0A.cjs → region-binding-workflow-BiJQ7NU6.cjs} +1 -1
  50. package/dist/{region-binding-workflow-Cy4GIOUo.js → region-binding-workflow-aA8nxmkZ.js} +1 -1
  51. package/dist/report-encoding-worker.cjs +1 -1
  52. package/dist/report-encoding-worker.js +1 -1
  53. package/dist/{runtime-BDf5x1i1.js → runtime-BTtpjF3D.js} +4 -4
  54. package/dist/{runtime-DsJt1PIf.cjs → runtime-Dq0LUsyS.cjs} +1 -1
  55. package/dist/sbom.cdx.json +1 -1
  56. package/dist/server/node.d.cts +9 -0
  57. package/dist/server/node.d.ts +9 -0
  58. package/dist/server-node.cjs +5 -4
  59. package/dist/server-node.js +1838 -1760
  60. package/dist/server.cjs +1 -1
  61. package/dist/server.d.cts +81 -0
  62. package/dist/server.d.ts +81 -0
  63. package/dist/server.js +6 -6
  64. package/dist/style.css +1 -1
  65. package/dist/template-catalog-CLAM4w7H.cjs +1 -0
  66. package/dist/{template-catalog-DFwIS9aN.js → template-catalog-JSxSqk5y.js} +3 -3
  67. package/dist/template-fragments-Ca25Jt7e.cjs +1 -0
  68. package/dist/{template-fragments-Dng-AlHk.js → template-fragments-D2JFj7Du.js} +18 -18
  69. package/dist/{template-outline-DiADphlq.js → template-outline-CDWXptuj.js} +1 -1
  70. package/dist/template-outline-K4jGhATu.cjs +1 -0
  71. package/dist/template-registry-CWnuGqyP.cjs +1 -0
  72. package/dist/{template-registry-DhBqoD7W.js → template-registry-Do1Uav2Z.js} +333 -261
  73. package/dist/template-serialization-CU4n_Miu.js +307 -0
  74. package/dist/template-serialization-CgqBo6s-.cjs +1 -0
  75. package/dist/vue/async.d.cts +97 -2
  76. package/dist/vue/async.d.ts +97 -2
  77. package/dist/vue/index.d.cts +197 -4
  78. package/dist/vue/index.d.ts +197 -4
  79. package/dist/vue-async.cjs +1 -1
  80. package/dist/vue-async.js +3 -3
  81. package/dist/vue.cjs +1 -1
  82. package/dist/vue.js +75 -70
  83. package/dist/{workbook-session-NYv01LHe.cjs → workbook-session-BvEBRRMz.cjs} +1 -1
  84. package/dist/{workbook-session-oinxX3qo.js → workbook-session-f0wVlzst.js} +1 -1
  85. package/dist/workbook-sheets-CaPAulQ6.cjs +2 -0
  86. package/dist/workbook-sheets-D4M7XXBh.js +44 -0
  87. package/dist/worker.cjs +1 -1
  88. package/dist/worker.d.cts +9 -0
  89. package/dist/worker.d.ts +9 -0
  90. package/dist/worker.js +4 -4
  91. package/dist/xlsx.cjs +4 -4
  92. package/dist/xlsx.d.cts +39 -2
  93. package/dist/xlsx.d.ts +39 -2
  94. package/dist/xlsx.js +290 -270
  95. package/package.json +1 -1
  96. package/dist/ReportLabelStudio-CaEvYuSK.cjs +0 -1
  97. package/dist/ReportLabelStudio-DQPBmh4v.js +0 -765
  98. package/dist/ReportParamPanel-CVpK8mFc.cjs +0 -1
  99. package/dist/ReportPreview-BBJNlu2U.js +0 -5740
  100. package/dist/ReportPreview-nf4Dk1Jc.cjs +0 -6
  101. package/dist/TemplateReviewPanel-BmBrjt6P.cjs +0 -1
  102. package/dist/prepared-BiSz_9vN.cjs +0 -1
  103. package/dist/template-bindings-Cg5oBLFT.cjs +0 -1
  104. package/dist/template-bindings-TKnXM7ll.js +0 -62
  105. package/dist/template-catalog-D_2jdnkL.cjs +0 -1
  106. package/dist/template-fragments-DZVUBhuB.cjs +0 -1
  107. package/dist/template-outline-DWkzZXVC.cjs +0 -1
  108. package/dist/template-registry-DpLUSLwF.cjs +0 -1
  109. package/dist/template-serialization-Cc3h-miv.js +0 -247
  110. package/dist/template-serialization-D1R5oAqh.cjs +0 -1
package/dist/index.js CHANGED
@@ -1,30 +1,30 @@
1
1
  import { r as ye, D as le, b as J, a as _, c as q, d as Ge, e as Y, f as Je, m as ue, g as Ke, h as Me, p as V, P as ie } from "./grid-geometry-D3SJgWFv.js";
2
- import { C as Br, i as _r, j as Wr, k as Ur, L as Vr, M as qr, S as Gr, l as Jr, n as Kr } from "./grid-geometry-D3SJgWFv.js";
3
- import { R as Xr, e as Zr, f as Qr, p as eo, b as to, t as no, d as ro } from "./record-bindings-VZGS-Qd8.js";
2
+ import { C as _r, i as Wr, j as Ur, k as Vr, L as qr, M as Gr, S as Jr, l as Kr, n as Yr } from "./grid-geometry-D3SJgWFv.js";
3
+ import { R as Zr, e as Qr, f as eo, p as to, b as no, t as ro, d as oo } from "./record-bindings-VZGS-Qd8.js";
4
4
  import { i as ce, a as Ye } from "./component-tree-1_QCiQJX.js";
5
- import { R as io } from "./component-tree-1_QCiQJX.js";
6
- import { v as Xe, R as Ze, a as pe, p as re, b as Et } from "./template-registry-DhBqoD7W.js";
7
- import { c as so, d as lo, e as co, s as mo, f as ho, g as fo, h as go } from "./template-registry-DhBqoD7W.js";
5
+ import { R as ao } from "./component-tree-1_QCiQJX.js";
6
+ import { v as Xe, R as Ze, a as pe, p as re, b as Et } from "./template-registry-Do1Uav2Z.js";
7
+ import { c as lo, d as co, e as mo, i as fo, s as ho, f as go, g as uo, h as po } from "./template-registry-Do1Uav2Z.js";
8
8
  import { v as Ct } from "./dataset-DL83majE.js";
9
- import { d as po } from "./dataset-DL83majE.js";
9
+ import { d as bo } from "./dataset-DL83majE.js";
10
10
  import { h as ve, w as Qe } from "./textwrap-CkGjRFT3.js";
11
- import { c as bo, a as yo, b as Mo, m as vo } from "./textwrap-CkGjRFT3.js";
12
- import { R as xe, d as Tt, s as et, a as Rt, p as Pt } from "./json-snapshot-Kgn459Oj.js";
13
- import { D as So, P as Eo, b as Co, c as To, e as Ro, f as Po, g as $o, h as ko, i as Ao, j as Io, k as Oo, l as No, m as Do, n as Lo, o as Fo, q as jo, r as zo, t as Ho, u as Bo, v as _o, w as Wo, x as Uo, y as Vo, z as qo, A as Go, B as Jo, C as Ko, E as Yo, F as Xo, G as Zo, H as Qo, I as ei } from "./json-snapshot-Kgn459Oj.js";
11
+ import { c as Mo, a as vo, b as xo, m as So } from "./textwrap-CkGjRFT3.js";
12
+ import { R as xe, d as Tt, s as et, a as Rt, p as Pt } from "./json-snapshot-DvQbZlD7.js";
13
+ import { D as Co, P as To, b as Ro, c as Po, e as $o, f as ko, g as Ao, h as Oo, i as Io, j as No, k as Do, l as Lo, m as Fo, n as jo, o as zo, q as Ho, r as Bo, t as _o, u as Wo, v as Uo, w as Vo, x as qo, y as Go, z as Jo, A as Ko, B as Yo, C as Xo, E as Zo, F as Qo, G as ei, H as ti, I as ni } from "./json-snapshot-DvQbZlD7.js";
14
14
  import { d as tt } from "./data-bar-8baGYEZ9.js";
15
15
  import { r as Se, d as $t } from "./rich-text-layout-wxBhnAS7.js";
16
16
  import { r as Z, n as nt, O as kt, a as Ee } from "./assets-CxHunY_9.js";
17
- import { b as ni, i as ri } from "./assets-CxHunY_9.js";
17
+ import { b as oi, i as ii } from "./assets-CxHunY_9.js";
18
18
  import { o as At, w as De } from "./progress-Hc2vxoCs.js";
19
- import { c as It } from "./prefill-CJSazcVY.js";
20
- import { R as ii, a as ai, b as si, d as li, e as ci, m as di, r as mi, f as hi, g as fi, v as gi } from "./prefill-CJSazcVY.js";
21
- import { R as pi, a as wi, f as bi, b as yi, c as Mi, d as vi, i as xi, e as Si, g as Ei, p as Ci, h as Ti, j as Ri, k as Pi, r as $i, v as ki, l as Ai } from "./param-validation-CnDEd2l-.js";
22
- import { b as Oi, d as Ni } from "./matrix-Dy-tyY7E.js";
23
- import { k as Li, l as Fi, r as ji } from "./computed-C8NRZQss.js";
24
- import { c as Hi, a as Bi, d as _i, r as Wi, b as Ui } from "./template-catalog-DFwIS9aN.js";
25
- import { c as qi, i as Gi, t as Ji } from "./template-outline-DiADphlq.js";
26
- import { a as Yi, c as Xi, i as Zi, b as Qi } from "./template-fragments-Dng-AlHk.js";
27
- import { T as ta, c as na, a as ra } from "./template-serialization-Cc3h-miv.js";
19
+ import { c as Ot } from "./prefill-BXBxx5We.js";
20
+ import { R as si, a as li, b as ci, d as di, e as mi, m as fi, r as hi, f as gi, g as ui, v as pi } from "./prefill-BXBxx5We.js";
21
+ import { R as bi, a as yi, f as Mi, b as vi, c as xi, d as Si, i as Ei, e as Ci, g as Ti, p as Ri, h as Pi, j as $i, k as ki, r as Ai, v as Oi, l as Ii } from "./param-validation-CnDEd2l-.js";
22
+ import { b as Di, d as Li } from "./matrix-Dy-tyY7E.js";
23
+ import { k as ji, l as zi, r as Hi } from "./computed-C8NRZQss.js";
24
+ import { c as _i, a as Wi, d as Ui, r as Vi, b as qi } from "./template-catalog-JSxSqk5y.js";
25
+ import { c as Ji, i as Ki, t as Yi } from "./template-outline-CDWXptuj.js";
26
+ import { a as Zi, c as Qi, i as ea, b as ta } from "./template-fragments-D2JFj7Du.js";
27
+ import { T as ra, c as oa, a as ia } from "./template-serialization-CU4n_Miu.js";
28
28
  function we(e, t, n) {
29
29
  let r = 0, o = e.length;
30
30
  for (; r < o; ) {
@@ -37,7 +37,7 @@ function rt(e) {
37
37
  if (![e.leftMm, e.topMm, e.widthMm, e.heightMm].every(Number.isFinite) || e.widthMm < 0 || e.heightMm < 0) throw new RangeError("Preview viewport must have finite coordinates and nonnegative dimensions.");
38
38
  return e;
39
39
  }
40
- function Ot(e) {
40
+ function It(e) {
41
41
  const t = e.rows.map(() => []);
42
42
  for (const n of e.cells) {
43
43
  const r = Math.min(t.length, n.ri + (n.cell.rowSpan ?? 1));
@@ -123,14 +123,14 @@ function Le(e, t) {
123
123
  r === n ? n = n.nextElementSibling : e.insertBefore(r, n);
124
124
  }
125
125
  function zt(e) {
126
- const t = ye(e.grid, e.component.widthMm, e.component.heightMm), n = new Map(t.cells.map((c) => [`${c.ri}:${c.ci}`, c])), r = Ot(t), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), l = Nt(Se(t, e.component));
126
+ const t = ye(e.grid, e.component.widthMm, e.component.heightMm), n = new Map(t.cells.map((c) => [`${c.ri}:${c.ci}`, c])), r = It(t), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), l = Nt(Se(t, e.component));
127
127
  e.table.setAttribute("aria-rowcount", String(t.rows.length)), e.table.setAttribute("aria-colcount", String(t.columns.length));
128
128
  let s = "", a = "";
129
129
  return { component: e.component, update(c, d) {
130
- const m = Lt(c, e.component), h = r.cells(m), f = d && n.get(`${d.rowIndex}:${d.columnIndex}`);
131
- f && !h.includes(f) && h.push(f), h.sort((w, N) => w.ri - N.ri || w.ci - N.ci);
132
- const g = h.map((w) => `${w.ri}:${w.ci}`).join(";"), C = l(m), S = C.map((w) => `${w.kind}:${w.pos}:${w.from}:${w.to}`).join(";"), b = g !== s, M = S !== a;
133
- return b && (s = g, jt(e, h, o, i)), M && (a = S, e.edgeHost.replaceChildren(...e.drawEdges(C))), b || M;
130
+ const m = Lt(c, e.component), f = r.cells(m), h = d && n.get(`${d.rowIndex}:${d.columnIndex}`);
131
+ h && !f.includes(h) && f.push(h), f.sort((w, N) => w.ri - N.ri || w.ci - N.ci);
132
+ const g = f.map((w) => `${w.ri}:${w.ci}`).join(";"), C = l(m), S = C.map((w) => `${w.kind}:${w.pos}:${w.from}:${w.to}`).join(";"), b = g !== s, M = S !== a;
133
+ return b && (s = g, jt(e, f, o, i)), M && (a = S, e.edgeHost.replaceChildren(...e.drawEdges(C))), b || M;
134
134
  } };
135
135
  }
136
136
  const ot = /* @__PURE__ */ new WeakMap(), Ht = {
@@ -193,12 +193,12 @@ function Fe(e, t, n, r, o, i) {
193
193
  it(c, a, r), c.applyTo(s);
194
194
  const d = tt(l.dataBar, e.widthMm, e.heightMm, n);
195
195
  if (d) {
196
- const h = i.createElement("div");
197
- h.className = "mr-cell-data-bar", h.setAttribute("aria-hidden", "true"), x("block").add("position", "absolute").mm("left", d.x, r).mm("top", d.y, r).mm("width", d.width, r).mm("height", d.height, r).add("background-color", d.color).add("opacity", "0.35").add("pointer-events", "none").applyTo(h), s.appendChild(h);
196
+ const f = i.createElement("div");
197
+ f.className = "mr-cell-data-bar", f.setAttribute("aria-hidden", "true"), x("block").add("position", "absolute").mm("left", d.x, r).mm("top", d.y, r).mm("width", d.width, r).mm("height", d.height, r).add("background-color", d.color).add("opacity", "0.35").add("pointer-events", "none").applyTo(f), s.appendChild(f);
198
198
  }
199
199
  const m = i.createElement("div");
200
200
  m.className = "mr-cell-content", x("flex").add("position", "absolute").mm("left", n + (l.indentMm ?? 0), r).mm("right", n, r).mm("top", n, r).mm("bottom", n, r).add("flex-direction", "column").add("justify-content", a.verticalAlign === "top" ? "flex-start" : a.verticalAlign === "bottom" ? "flex-end" : "center").add("overflow-wrap", "anywhere").add("overflow", "hidden").applyTo(m), l.richParagraphs?.length ? m.appendChild(st({ ...t, kind: "text", richParagraphs: l.richParagraphs }, r, o, i)) : l.text != null && m.append(l.text);
201
- for (const h of l.children ?? []) m.appendChild(lt(h, r, o, i));
201
+ for (const f of l.children ?? []) m.appendChild(lt(f, r, o, i));
202
202
  return s.insertBefore(m, s.firstChild), s;
203
203
  }
204
204
  function Wt(e, t, n, r) {
@@ -221,17 +221,17 @@ function Ut(e, t, n, r, o) {
221
221
  if (s) {
222
222
  const m = o.createElement("div");
223
223
  x("block").add("position", "relative").add("width", "100%").add("height", "100%").applyTo(m);
224
- const h = o.createElement("div");
225
- return x("contents").applyTo(h), h.setAttribute("aria-hidden", "true"), s.mount({
224
+ const f = o.createElement("div");
225
+ return x("contents").applyTo(f), f.setAttribute("aria-hidden", "true"), s.mount({
226
226
  grid: e,
227
227
  component: t,
228
228
  table: i,
229
229
  rowClass: P("row", r),
230
230
  body: l,
231
- edgeHost: h,
232
- drawCell: (f) => Fe(f, t, e.paddingMm ?? 0.5, n, { ...r }, o),
233
- drawEdges: (f) => at(f, n, o)
234
- }), m.append(i, h), m;
231
+ edgeHost: f,
232
+ drawCell: (h) => Fe(h, t, e.paddingMm ?? 0.5, n, { ...r }, o),
233
+ drawEdges: (h) => at(h, n, o)
234
+ }), m.append(i, f), m;
235
235
  }
236
236
  const a = ye(e, t.widthMm, t.heightMm), c = e.cells.map(() => {
237
237
  const m = o.createElement("tr");
@@ -344,9 +344,9 @@ function Ce(e, t, n, r, o, i, l, s = "top") {
344
344
  const a = t.fontSizePx * t.lineHeight, c = t.text === "" ? [""] : t.text.split(`
345
345
  `), d = c.length * a;
346
346
  let m = r;
347
- s === "middle" ? m = r + (i - d) / 2 : s === "bottom" && (m = r + i - d), c.forEach((h, f) => {
348
- const g = m + f * a + t.fontSizePx * 0.8;
349
- Kt(e, h, t, n, g, o), t.underline && h && Yt(e, h, t, n, g, o);
347
+ s === "middle" ? m = r + (i - d) / 2 : s === "bottom" && (m = r + i - d), c.forEach((f, h) => {
348
+ const g = m + h * a + t.fontSizePx * 0.8;
349
+ Kt(e, f, t, n, g, o), t.underline && f && Yt(e, f, t, n, g, o);
350
350
  }), e.textAlign = "left";
351
351
  }
352
352
  function Kt(e, t, n, r, o, i) {
@@ -360,8 +360,8 @@ function Kt(e, t, n, r, o, i) {
360
360
  const a = e.measureText(t).width + Math.max(0, l.length - 1) * s, c = n.align === "center" ? r + (i - a) / 2 : n.align === "right" ? r + i - a : r;
361
361
  e.textAlign = "left";
362
362
  let d = "";
363
- l.forEach((m, h) => {
364
- e.fillText(m, c + e.measureText(d).width + h * s, o), d += m;
363
+ l.forEach((m, f) => {
364
+ e.fillText(m, c + e.measureText(d).width + f * s, o), d += m;
365
365
  });
366
366
  }
367
367
  function Yt(e, t, n, r, o, i) {
@@ -377,8 +377,8 @@ function dt(e, t, n, r, o) {
377
377
  return l(a), e.measureText(s).width / i + (a.letterSpacing ?? 0);
378
378
  },
379
379
  draw(s, a, c, d, m) {
380
- const h = _(a, r).fontSizePx, f = -d * i - h * 0.8;
381
- a.backgroundColor && (e.fillStyle = a.backgroundColor, e.fillRect(c * i, f, m * i, h * q(a))), Ce(e, { text: s, fontSizePx: h, bold: !!a.bold, italic: a.italic, underline: a.underline, color: Me(a), align: "left", lineHeight: q(a), letterSpacingPx: (a.letterSpacing ?? 0) * i }, c * i, f, m * i, h, a.fontFamily ?? o);
380
+ const f = _(a, r).fontSizePx, h = -d * i - f * 0.8;
381
+ a.backgroundColor && (e.fillStyle = a.backgroundColor, e.fillRect(c * i, h, m * i, f * q(a))), Ce(e, { text: s, fontSizePx: f, bold: !!a.bold, italic: a.italic, underline: a.underline, color: Me(a), align: "left", lineHeight: q(a), letterSpacingPx: (a.letterSpacing ?? 0) * i }, c * i, h, m * i, f, a.fontFamily ?? o);
382
382
  }
383
383
  });
384
384
  }
@@ -408,7 +408,7 @@ function* Te(e) {
408
408
  if (i.has(n)) throw new TypeError("Cyclic grid children cannot be rendered.");
409
409
  ce(n) && (yield { component: n, componentIndex: r, componentPath: o });
410
410
  const l = new Set(i).add(n);
411
- for (const [s, a] of (n.grid?.cells ?? []).entries()) for (const [c, d] of a.entries()) for (const [m, h] of (d?.children ?? []).entries()) yield* t(h, r, [...o, s, c, m], l);
411
+ for (const [s, a] of (n.grid?.cells ?? []).entries()) for (const [c, d] of a.entries()) for (const [m, f] of (d?.children ?? []).entries()) yield* t(f, r, [...o, s, c, m], l);
412
412
  }
413
413
  for (const [n, r] of e.components.entries()) yield* t(r, n, [], /* @__PURE__ */ new Set());
414
414
  }
@@ -425,7 +425,7 @@ function en(e, t, n, r, o, i) {
425
425
  e.drawImage(t, n + (o - d) / 2, r + (i - m) / 2, d, m);
426
426
  }
427
427
  function tn(e) {
428
- return It(e.pageHeightsPx, e.gapPx).window(e.viewportHeightPx, e.scrollTopPx, e.overscan);
428
+ return Ot(e.pageHeightsPx, e.gapPx).window(e.viewportHeightPx, e.scrollTopPx, e.overscan);
429
429
  }
430
430
  const Re = 96 / 25.4;
431
431
  function Pe(e, t = 96) {
@@ -442,7 +442,7 @@ function mt(e, t, n, r = 64e6) {
442
442
  if (!Number.isSafeInteger(i) || !Number.isSafeInteger(l) || i * l > r) throw new RangeError("Canvas page exceeds maxCanvasPixels; reduce resolution or split the report.");
443
443
  return { width: i, height: l };
444
444
  }
445
- function ht(e, t, n, r) {
445
+ function ft(e, t, n, r) {
446
446
  const o = document.createElement("canvas"), { widthPx: i, heightPx: l } = Pe(e, n), s = mt(e, t, n, r);
447
447
  o.width = s.width, o.height = s.height, o.style.width = `${i}px`, o.style.height = `${l}px`;
448
448
  const a = o.getContext("2d");
@@ -461,36 +461,36 @@ function rn(e, t, n, r, o, i) {
461
461
  e.beginPath(), t.top && (e.moveTo(n, r), e.lineTo(n + o, r)), t.right && (e.moveTo(n + o, r), e.lineTo(n + o, r + i)), t.bottom && (e.moveTo(n + o, r + i), e.lineTo(n, r + i)), t.left && (e.moveTo(n, r + i), e.lineTo(n, r)), e.stroke();
462
462
  }
463
463
  function on(e, t, n, r, o, i, l, s, a, c, d, m) {
464
- const h = ye(t, i / s, l / s);
465
- for (const f of h.cells) {
466
- const g = f.cell.style?.backgroundColor ?? n.style?.backgroundColor;
467
- g && (e.fillStyle = g, e.fillRect(r + f.xMm * s, o + f.yMm * s, f.widthMm * s, f.heightMm * s));
464
+ const f = ye(t, i / s, l / s);
465
+ for (const h of f.cells) {
466
+ const g = h.cell.style?.backgroundColor ?? n.style?.backgroundColor;
467
+ g && (e.fillStyle = g, e.fillRect(r + h.xMm * s, o + h.yMm * s, h.widthMm * s, h.heightMm * s));
468
468
  }
469
- nn(e, h, n, r, o, s, a);
470
- for (const f of h.cells) an(e, f, n, r, o, s, a, c, d, m);
469
+ nn(e, f, n, r, o, s, a);
470
+ for (const h of f.cells) an(e, h, n, r, o, s, a, c, d, m);
471
471
  }
472
472
  function an(e, t, n, r, o, i, l, s, a, c) {
473
- const d = n.grid?.paddingMm ?? 0.5, m = t.cell.text ?? "", h = Ke(n.style, t.cell.style), f = _(h, l), g = t.cell.indentMm ?? 0, C = Math.max(0, t.widthMm - 2 * d - g), S = Qe(m, C, { fontSizePt: f.fontSizePt, bold: h.bold, italic: h.italic, fontFamily: h.fontFamily ?? s, letterSpacingPt: h.letterSpacing }, a).join(`
473
+ const d = n.grid?.paddingMm ?? 0.5, m = t.cell.text ?? "", f = Ke(n.style, t.cell.style), h = _(f, l), g = t.cell.indentMm ?? 0, C = Math.max(0, t.widthMm - 2 * d - g), S = Qe(m, C, { fontSizePt: h.fontSizePt, bold: f.bold, italic: f.italic, fontFamily: f.fontFamily ?? s, letterSpacingPt: f.letterSpacing }, a).join(`
474
474
  `), b = { x: r + (t.xMm + d + g) * i, y: o + (t.yMm + d) * i, width: C * i, height: Math.max(0, t.heightMm - 2 * d) * i };
475
- e.save(), e.beginPath(), e.rect(b.x, b.y, b.width, b.height), e.clip(), t.cell.richParagraphs?.length ? dt(e, { ...n, richParagraphs: t.cell.richParagraphs, style: { verticalAlign: "middle", ...h } }, b, l, s) : Ce(
475
+ e.save(), e.beginPath(), e.rect(b.x, b.y, b.width, b.height), e.clip(), t.cell.richParagraphs?.length ? dt(e, { ...n, richParagraphs: t.cell.richParagraphs, style: { verticalAlign: "middle", ...f } }, b, l, s) : Ce(
476
476
  e,
477
477
  {
478
478
  text: S,
479
- fontSizePx: f.fontSizePx,
480
- bold: h.bold ?? !1,
481
- italic: h.italic,
482
- underline: h.underline,
483
- color: Me(h, Ge),
484
- align: h.align ?? "left",
485
- lineHeight: q(h),
486
- letterSpacingPx: V(h.letterSpacing ?? 0, l)
479
+ fontSizePx: h.fontSizePx,
480
+ bold: f.bold ?? !1,
481
+ italic: f.italic,
482
+ underline: f.underline,
483
+ color: Me(f, Ge),
484
+ align: f.align ?? "left",
485
+ lineHeight: q(f),
486
+ letterSpacingPx: V(f.letterSpacing ?? 0, l)
487
487
  },
488
488
  r + (t.xMm + d + g) * i,
489
489
  o + (t.yMm + d) * i,
490
490
  C * i,
491
491
  Math.max(0, t.heightMm - 2 * d) * i,
492
- h.fontFamily ?? s,
493
- h.verticalAlign ?? "middle"
492
+ f.fontFamily ?? s,
493
+ f.verticalAlign ?? "middle"
494
494
  );
495
495
  for (const w of t.cell.children ?? []) de(e, { ...w, leftMm: w.leftMm + b.x / i, topMm: w.topMm + b.y / i }, i, l, s, a, c);
496
496
  e.restore();
@@ -521,8 +521,8 @@ function sn(e, t, n, r, o, i, l, s, a) {
521
521
  function de(e, t, n, r, o, i, l) {
522
522
  const s = t.leftMm * n, a = t.topMm * n, c = t.widthMm * n, d = t.heightMm * n, m = t.style ?? {};
523
523
  if (ce(t)) {
524
- const h = l?.get(t.imageData);
525
- h ? en(e, h, s, a, c, d) : ze(e, t, s, a, c, d);
524
+ const f = l?.get(t.imageData);
525
+ f ? en(e, f, s, a, c, d) : ze(e, t, s, a, c, d);
526
526
  return;
527
527
  }
528
528
  if (t.grid) {
@@ -535,20 +535,20 @@ function de(e, t, n, r, o, i, l) {
535
535
  break;
536
536
  }
537
537
  case "rect": {
538
- const h = Y(m), f = Je(m);
539
- m.backgroundColor && (e.fillStyle = m.backgroundColor, e.fillRect(s, a, c, d)), f.inner && (e.strokeStyle = h.color, e.lineWidth = V(h.widthPt, r), rn(e, f, s, a, c, d));
538
+ const f = Y(m), h = Je(m);
539
+ m.backgroundColor && (e.fillStyle = m.backgroundColor, e.fillRect(s, a, c, d)), h.inner && (e.strokeStyle = f.color, e.lineWidth = V(f.widthPt, r), rn(e, h, s, a, c, d));
540
540
  break;
541
541
  }
542
542
  case "line": {
543
- const h = Y({ ...m, borderColor: m.lineColor ?? m.borderColor });
544
- e.strokeStyle = h.color, e.lineWidth = V(h.widthPt, r), e.beginPath();
545
- const f = t.lineDirection === "up" ? a + d : t.lineDirection === "down" ? a : a + d / 2, g = t.lineDirection === "up" ? a : t.lineDirection === "down" ? a + d : a + d / 2;
546
- e.moveTo(s, f), e.lineTo(s + c, g), e.stroke();
543
+ const f = Y({ ...m, borderColor: m.lineColor ?? m.borderColor });
544
+ e.strokeStyle = f.color, e.lineWidth = V(f.widthPt, r), e.beginPath();
545
+ const h = t.lineDirection === "up" ? a + d : t.lineDirection === "down" ? a : a + d / 2, g = t.lineDirection === "up" ? a : t.lineDirection === "down" ? a + d : a + d / 2;
546
+ e.moveTo(s, h), e.lineTo(s + c, g), e.stroke();
547
547
  break;
548
548
  }
549
549
  case "ellipse": {
550
- const h = Y(m);
551
- e.strokeStyle = h.color, e.lineWidth = V(h.widthPt, r), m.backgroundColor && (e.fillStyle = m.backgroundColor, e.beginPath(), e.ellipse(s + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(s + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
550
+ const f = Y(m);
551
+ e.strokeStyle = f.color, e.lineWidth = V(f.widthPt, r), m.backgroundColor && (e.fillStyle = m.backgroundColor, e.beginPath(), e.ellipse(s + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.fill()), e.beginPath(), e.ellipse(s + c / 2, a + d / 2, c / 2, d / 2, 0, 0, Math.PI * 2), e.stroke();
552
552
  break;
553
553
  }
554
554
  default:
@@ -571,7 +571,7 @@ async function Mr(e, t = {}) {
571
571
  const l = [...i.diagnostics, ...Z(e, "canvas", t)], s = n === "jpeg" ? "image/jpeg" : "image/png", a = [], c = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
572
572
  for (let d = Math.max(0, t.start ?? 0); d <= c; d++) {
573
573
  A(t.signal);
574
- const m = await ft(e.pages[d], d, o, l);
574
+ const m = await ht(e.pages[d], d, o, l);
575
575
  try {
576
576
  a.push(await ln(m, s, r, t.signal));
577
577
  } finally {
@@ -598,13 +598,13 @@ function vr(e, t = {}) {
598
598
  if (A(t.signal), typeof document > "u")
599
599
  throw new Error("renderPlanToCanvas 需要浏览器环境(SSR 请在客户端钩子中调用)");
600
600
  const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, o = r / 96 * Re, i = t.fontFamily ?? le, l = t.measurer ?? ve, s = Math.max(0, t.start ?? 0), a = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1), c = [], d = Z(e, "canvas", t), m = cn(e, s, a);
601
- for (const h of m)
602
- nt(h, t), d.push(h);
601
+ for (const f of m)
602
+ nt(f, t), d.push(f);
603
603
  if (t.fidelity === "strict" && m.length) throw new kt(d);
604
- for (let h = s; h <= a; h++) {
604
+ for (let f = s; f <= a; f++) {
605
605
  A(t.signal);
606
- const f = e.pages[h], { canvas: g, ctx: C } = ht(f, n, r, t.maxCanvasPixels);
607
- for (const S of f.components)
606
+ const h = e.pages[f], { canvas: g, ctx: C } = ft(h, n, r, t.maxCanvasPixels);
607
+ for (const S of h.components)
608
608
  de(C, S, o, r, i, l);
609
609
  c.push(g);
610
610
  }
@@ -630,13 +630,13 @@ async function xr(e, t = {}) {
630
630
  e = n.plan;
631
631
  const r = [...n.diagnostics, ...Z(e, "canvas", t)], o = [], i = Math.min(e.pages.length - 1, t.end ?? e.pages.length - 1);
632
632
  for (let l = Math.max(0, t.start ?? 0); l <= i; l++)
633
- o.push(await ft(e.pages[l], l, t, r));
633
+ o.push(await ht(e.pages[l], l, t, r));
634
634
  return { canvases: o, diagnostics: r };
635
635
  }
636
- async function ft(e, t, n, r) {
636
+ async function ht(e, t, n, r) {
637
637
  const o = n.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), i = n.dpi ?? 96, l = n.fontFamily ?? le, s = await gt(e, t, n, r);
638
638
  A(n.signal);
639
- const { canvas: a, ctx: c } = ht(e, o, i, n.maxCanvasPixels);
639
+ const { canvas: a, ctx: c } = ft(e, o, i, n.maxCanvasPixels);
640
640
  for (const d of e.components) de(c, d, i / 25.4, i, l, n.measurer ?? ve, s);
641
641
  return a;
642
642
  }
@@ -647,17 +647,17 @@ async function gt(e, t, n, r) {
647
647
  return await o(i, l);
648
648
  } catch (s) {
649
649
  if (l?.aborted) throw s;
650
- const a = [...Te(e)].find(({ component: f }) => f.imageData === i), { component: c, componentIndex: d, componentPath: m } = a, h = { code: "image-decode-failed", severity: "warning", format: "canvas", pageIndex: t, componentIndex: d, componentPath: m, kind: c.kind, nid: c.nid, message: "Image decoding failed; raster output was cancelled instead of omitting the image." };
651
- throw r.push(h), nt(h, n), s;
650
+ const a = [...Te(e)].find(({ component: h }) => h.imageData === i), { component: c, componentIndex: d, componentPath: m } = a, f = { code: "image-decode-failed", severity: "warning", format: "canvas", pageIndex: t, componentIndex: d, componentPath: m, kind: c.kind, nid: c.nid, message: "Image decoding failed; raster output was cancelled instead of omitting the image." };
651
+ throw r.push(f), nt(f, n), s;
652
652
  }
653
653
  }, n.signal);
654
654
  }
655
655
  function Sr(e, t = {}) {
656
- const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, o = r / 96 * Re, i = t.fontFamily ?? le, l = t.measurer ?? ve, s = t.overscan ?? 1, a = t.gapPx ?? 18, c = t.pagesPerFrame ?? 1, d = e.pages.map((p) => p.pageHeightMm * o), m = Math.max(1, ...e.pages.map((p) => p.pageWidthMm * o)), h = { start: 0, end: -1 };
657
- let f = null, g = null, C = null, S = null, b = [], M = 0, w = [], N = 0, D = new AbortController();
658
- const Ie = [];
656
+ const n = t.dpr ?? (typeof devicePixelRatio == "number" ? devicePixelRatio : 1), r = t.dpi ?? 96, o = r / 96 * Re, i = t.fontFamily ?? le, l = t.measurer ?? ve, s = t.overscan ?? 1, a = t.gapPx ?? 18, c = t.pagesPerFrame ?? 1, d = e.pages.map((p) => p.pageHeightMm * o), m = Math.max(1, ...e.pages.map((p) => p.pageWidthMm * o)), f = { start: 0, end: -1 };
657
+ let h = null, g = null, C = null, S = null, b = [], M = 0, w = [], N = 0, D = new AbortController();
658
+ const Oe = [];
659
659
  function Mt() {
660
- const p = f;
660
+ const p = h;
661
661
  p.innerHTML = "", g = document.createElement("div"), g.style.cssText = `width:${m}px;margin:0 auto;`, C = document.createElement("div"), S = document.createElement("div"), g.appendChild(C), b = [];
662
662
  const R = Math.min(e.pages.length, 3 + s * 2);
663
663
  for (let z = 0; z < R; z++) {
@@ -668,24 +668,24 @@ function Sr(e, t = {}) {
668
668
  }
669
669
  async function vt(p, R) {
670
670
  const z = N, E = await Ee(e, { ...t, signal: D.signal, format: "canvas", start: R, end: R });
671
- Ie.push(...E.diagnostics);
672
- const $ = E.plan.pages[R], ne = await gt($, R, { ...t, signal: D.signal }, Ie);
673
- if (z !== N || !f) return;
674
- const { widthPx: fe, heightPx: ge } = Pe($, r);
671
+ Oe.push(...E.diagnostics);
672
+ const $ = E.plan.pages[R], ne = await gt($, R, { ...t, signal: D.signal }, Oe);
673
+ if (z !== N || !h) return;
674
+ const { widthPx: he, heightPx: ge } = Pe($, r);
675
675
  let L = p.firstElementChild;
676
676
  (!L || L.tagName !== "CANVAS") && (L = document.createElement("canvas"), p.innerHTML = "", p.appendChild(L));
677
677
  const Ne = mt($, n, r, t.maxCanvasPixels);
678
- L.width = Ne.width, L.height = Ne.height, L.style.width = `${fe}px`, L.style.height = `${ge}px`;
678
+ L.width = Ne.width, L.height = Ne.height, L.style.width = `${he}px`, L.style.height = `${ge}px`;
679
679
  const W = L.getContext("2d");
680
680
  if (W) {
681
- W.setTransform(1, 0, 0, 1, 0, 0), W.scale(n, n), W.fillStyle = "#ffffff", W.fillRect(0, 0, fe, ge);
681
+ W.setTransform(1, 0, 0, 1, 0, 0), W.scale(n, n), W.fillStyle = "#ffffff", W.fillRect(0, 0, he, ge);
682
682
  for (const St of $.components)
683
683
  de(W, St, o, r, i, l, ne);
684
- L.dataset.canvasPage = String(R), p.style.height = `${ge}px`, p.style.width = `${fe}px`;
684
+ L.dataset.canvasPage = String(R), p.style.height = `${ge}px`, p.style.width = `${he}px`;
685
685
  }
686
686
  }
687
687
  function xt(p) {
688
- N++, h.start = p.start, h.end = p.end, C.style.height = `${p.start * a + d.slice(0, p.start).reduce((E, $) => E + $, 0)}px`;
688
+ N++, f.start = p.start, f.end = p.end, C.style.height = `${p.start * a + d.slice(0, p.start).reduce((E, $) => E + $, 0)}px`;
689
689
  const R = e.pages.length - 1 - p.end;
690
690
  S.style.height = `${R * a + d.slice(p.end + 1).reduce((E, $) => E + $, 0)}px`;
691
691
  const z = p.end - p.start + 1;
@@ -702,31 +702,31 @@ function Sr(e, t = {}) {
702
702
  if (!$) continue;
703
703
  $.firstElementChild?.dataset?.canvasPage !== String(E) && w.push(E);
704
704
  }
705
- he();
705
+ fe();
706
706
  }
707
- function he() {
707
+ function fe() {
708
708
  M || w.length === 0 || (M = requestAnimationFrame(() => {
709
709
  M = 0;
710
710
  let p = Math.max(1, c);
711
711
  for (; w.length > 0 && p-- > 0; ) {
712
- const R = w.shift(), z = b[R - h.start];
712
+ const R = w.shift(), z = b[R - f.start];
713
713
  z && vt(z, R).catch(() => {
714
714
  });
715
715
  }
716
- w.length > 0 && he();
716
+ w.length > 0 && fe();
717
717
  }));
718
718
  }
719
719
  function ee() {
720
720
  M || (M = requestAnimationFrame(() => {
721
721
  M = 0;
722
- const p = f, R = tn({
722
+ const p = h, R = tn({
723
723
  pageHeightsPx: d,
724
724
  viewportHeightPx: p.clientHeight,
725
725
  scrollTopPx: p.scrollTop,
726
726
  overscan: s,
727
727
  gapPx: a
728
728
  });
729
- R.start !== h.start || R.end !== h.end ? xt(R) : he();
729
+ R.start !== f.start || R.end !== f.end ? xt(R) : fe();
730
730
  }));
731
731
  }
732
732
  let te = null;
@@ -734,16 +734,16 @@ function Sr(e, t = {}) {
734
734
  attach(p) {
735
735
  if (typeof document > "u")
736
736
  throw new Error("createCanvasPager 需要浏览器环境(SSR 请在客户端钩子中调用 attach)");
737
- A(t.signal), D = new AbortController(), t.signal?.addEventListener("abort", Oe, { once: !0 }), Z(e, "canvas", t), f = p, Mt(), p.addEventListener("scroll", ee, { passive: !0 }), typeof ResizeObserver < "u" && (te = new ResizeObserver(() => ee()), te.observe(p)), ee();
737
+ A(t.signal), D = new AbortController(), t.signal?.addEventListener("abort", Ie, { once: !0 }), Z(e, "canvas", t), h = p, Mt(), p.addEventListener("scroll", ee, { passive: !0 }), typeof ResizeObserver < "u" && (te = new ResizeObserver(() => ee()), te.observe(p)), ee();
738
738
  },
739
739
  destroy() {
740
- N++, D.abort(), t.signal?.removeEventListener("abort", Oe), M && cancelAnimationFrame(M), M = 0, te?.disconnect(), te = null, f?.removeEventListener("scroll", ee), w = [], g?.remove(), f = null;
740
+ N++, D.abort(), t.signal?.removeEventListener("abort", Ie), M && cancelAnimationFrame(M), M = 0, te?.disconnect(), te = null, h?.removeEventListener("scroll", ee), w = [], g?.remove(), h = null;
741
741
  },
742
742
  window() {
743
- return { ...h };
743
+ return { ...f };
744
744
  }
745
745
  };
746
- function Oe() {
746
+ function Ie() {
747
747
  D.abort(t.signal?.reason);
748
748
  }
749
749
  }
@@ -897,7 +897,7 @@ function Cr(e, t = {}) {
897
897
  ...t[n.field]
898
898
  }));
899
899
  }
900
- function I(e, t, n = !1) {
900
+ function O(e, t, n = !1) {
901
901
  if (!Number.isFinite(e) || (n ? e < 0 : e <= 0))
902
902
  throw new Error(`${t} 必须是有限${n ? "非负" : "正"}数`);
903
903
  }
@@ -905,7 +905,7 @@ function ae(e, t, n) {
905
905
  if (e !== void 0 && !["left", "center", "right", "justify", ...n ? ["auto"] : []].includes(e))
906
906
  throw new Error(`${t} 必须是 left/center/right/justify${n ? "/auto" : ""}`);
907
907
  }
908
- function hn(e) {
908
+ function fn(e) {
909
909
  const t = e.layout ?? "page";
910
910
  if (t !== "page" && t !== "wide")
911
911
  throw new Error("layout 必须是 page 或 wide");
@@ -914,16 +914,16 @@ function hn(e) {
914
914
  if (t !== "wide" && e.columnWidthMm !== void 0)
915
915
  throw new Error('columnWidthMm 仅适用于 layout: "wide"');
916
916
  const n = e.columnWidthMm ?? 30;
917
- return I(n, "columnWidthMm"), { layout: t, columnWidthMm: n };
917
+ return O(n, "columnWidthMm"), { layout: t, columnWidthMm: n };
918
918
  }
919
- function fn(e) {
919
+ function hn(e) {
920
920
  const t = e.paper === void 0 ? "a4" : e.paper;
921
921
  if (typeof t != "string" && (typeof t != "object" || t === null) || e.landscape !== void 0 && typeof e.landscape != "boolean")
922
922
  throw new Error("paper 必须是纸张预设名或 { widthMm, heightMm } 对象,landscape 必须是布尔值");
923
923
  if (typeof t == "string" && !Object.prototype.hasOwnProperty.call(ie, t))
924
924
  throw new Error(`未知纸张预设 "${t}"(可用:${Object.keys(ie).join("/")})`);
925
925
  const n = ut(t, void 0, e.landscape), r = n.widthMm, o = n.heightMm;
926
- return I(r, "纸张 widthMm"), I(o, "纸张 heightMm"), { widthMm: r, heightMm: o };
926
+ return O(r, "纸张 widthMm"), O(o, "纸张 heightMm"), { widthMm: r, heightMm: o };
927
927
  }
928
928
  function gn(e) {
929
929
  if (e.margins !== void 0 && (!e.margins || typeof e.margins != "object" || Array.isArray(e.margins)))
@@ -934,7 +934,7 @@ function gn(e) {
934
934
  marginLeftMm: t.marginLeftMm === void 0 ? 10 : t.marginLeftMm,
935
935
  marginRightMm: t.marginRightMm === void 0 ? 10 : t.marginRightMm
936
936
  };
937
- for (const [r, o] of Object.entries(n)) I(o, r, !0);
937
+ for (const [r, o] of Object.entries(n)) O(o, r, !0);
938
938
  return n;
939
939
  }
940
940
  function un(e, t) {
@@ -944,7 +944,7 @@ function un(e, t) {
944
944
  if (e.title !== void 0 && typeof e.title != "string")
945
945
  throw new Error("title 必须是字符串");
946
946
  const r = e.titleHeightMm === void 0 ? 10 : e.titleHeightMm, o = e.titleGapMm === void 0 ? 4 : e.titleGapMm;
947
- I(r, "titleHeightMm"), I(o, "titleGapMm", !0);
947
+ O(r, "titleHeightMm"), O(o, "titleGapMm", !0);
948
948
  const i = e.title !== void 0 && e.title.length > 0, l = i ? r + o : 0;
949
949
  if (l >= t)
950
950
  throw new Error("标题高度与间距占满页面,必须为表格保留可用高度");
@@ -957,7 +957,7 @@ function pn(e) {
957
957
  ae(t.align, "listOptions.align", !0), ae(t.headerAlign, "listOptions.headerAlign", !1);
958
958
  for (const n of ["fontSizePt", "rowHeightMm", "paddingMm"]) {
959
959
  const r = t[n];
960
- r !== void 0 && I(r, `listOptions.${n}`, n === "paddingMm");
960
+ r !== void 0 && O(r, `listOptions.${n}`, n === "paddingMm");
961
961
  }
962
962
  return t;
963
963
  }
@@ -966,7 +966,7 @@ function wn(e) {
966
966
  for (const [r, o] of e.entries()) {
967
967
  if (!o || typeof o.header != "string" || typeof o.field != "string" || !o.field.trim())
968
968
  throw new Error(`columns[${r}] 需要字符串 header 与非空 field`);
969
- ae(o.align, `columns[${r}].align`, !0), ae(o.headerAlign, `columns[${r}].headerAlign`, !1), o.flex !== void 0 && I(o.flex, `columns[${r}].flex`), o.widthMm !== void 0 ? (I(o.widthMm, `columns[${r}].widthMm`), t += o.widthMm) : n = Math.max(n, o.flex ?? 1);
969
+ ae(o.align, `columns[${r}].align`, !0), ae(o.headerAlign, `columns[${r}].headerAlign`, !1), o.flex !== void 0 && O(o.flex, `columns[${r}].flex`), o.widthMm !== void 0 ? (O(o.widthMm, `columns[${r}].widthMm`), t += o.widthMm) : n = Math.max(n, o.flex ?? 1);
970
970
  }
971
971
  return { fixedWidthMm: t, maxFlex: n };
972
972
  }
@@ -978,9 +978,9 @@ function bn(e, t, n, r) {
978
978
  if (t === "page" && i > 0 && l <= 0)
979
979
  throw new Error("固定列占满页面可用宽度,自动列需要正的剩余宽度");
980
980
  const s = i > 0 ? e.columns.reduce((c, d) => c + (d.widthMm === void 0 ? (d.flex ?? 1) / i : 0), 0) : 0;
981
- return { columns: e.columns.map(({ widthMm: c, flex: d, ...m }, h) => {
982
- const f = c ?? (t === "wide" ? n * (d ?? 1) : l * ((d ?? 1) / i) / s);
983
- return I(f, `columns[${h}] 分配后的 widthMm`), { ...m, widthMm: f };
981
+ return { columns: e.columns.map(({ widthMm: c, flex: d, ...m }, f) => {
982
+ const h = c ?? (t === "wide" ? n * (d ?? 1) : l * ((d ?? 1) / i) / s);
983
+ return O(h, `columns[${f}] 分配后的 widthMm`), { ...m, widthMm: h };
984
984
  }), fixedWidthMm: o, maxFlex: i };
985
985
  }
986
986
  function Tr(e) {
@@ -988,15 +988,15 @@ function Tr(e) {
988
988
  throw new Error("标准明细模板需要 options 对象");
989
989
  if (!Array.isArray(e.columns) || e.columns.length === 0)
990
990
  throw new Error("columns 至少需要一列");
991
- const { layout: t, columnWidthMm: n } = hn(e), r = fn(e);
991
+ const { layout: t, columnWidthMm: n } = fn(e), r = hn(e);
992
992
  let o = r.widthMm;
993
993
  const i = r.heightMm, l = gn(e);
994
994
  let s = o - l.marginLeftMm - l.marginRightMm;
995
995
  const a = i - l.marginTopMm - l.marginBottomMm;
996
996
  if (t === "page" && s <= 0 || a <= 0)
997
997
  throw new Error("页边距占满纸张,必须保留正的可用宽度和高度");
998
- const { dataset: c, titleHeightMm: d, hasTitle: m, titleSpaceMm: h } = un(e, a), f = pn(e), { columns: g, fixedWidthMm: C, maxFlex: S } = bn(e, t, n, s);
999
- t === "wide" && (s = g.reduce((M, w) => M + w.widthMm, 0), I(s, "宽表总列宽"), o = s + l.marginLeftMm + l.marginRightMm, I(o, "宽表总宽度"));
998
+ const { dataset: c, titleHeightMm: d, hasTitle: m, titleSpaceMm: f } = un(e, a), h = pn(e), { columns: g, fixedWidthMm: C, maxFlex: S } = bn(e, t, n, s);
999
+ t === "wide" && (s = g.reduce((M, w) => M + w.widthMm, 0), O(s, "宽表总列宽"), o = s + l.marginLeftMm + l.marginRightMm, O(o, "宽表总宽度"));
1000
1000
  const b = { widthMm: o, heightMm: i, ...l, components: [], ...t === "wide" ? { layout: t } : {} };
1001
1001
  return m && b.components.push({
1002
1002
  kind: "text",
@@ -1009,14 +1009,14 @@ function Tr(e) {
1009
1009
  }), b.components.push({
1010
1010
  align: "auto",
1011
1011
  headerAlign: "center",
1012
- ...f,
1012
+ ...h,
1013
1013
  kind: "list",
1014
1014
  ...t === "wide" ? { layout: t } : {},
1015
1015
  ...m ? { title: e.title } : {},
1016
1016
  dataset: c,
1017
1017
  columns: g,
1018
1018
  leftMm: l.marginLeftMm,
1019
- topMm: l.marginTopMm + h,
1019
+ topMm: l.marginTopMm + f,
1020
1020
  widthMm: t === "wide" || S > 0 ? s : C
1021
1021
  }), e.params === void 0 ? { pages: [b] } : { params: e.params, pages: [b] };
1022
1022
  }
@@ -1117,7 +1117,7 @@ class F extends Error {
1117
1117
  super(n), this.code = t, this.name = "ReportTemplateStoreError";
1118
1118
  }
1119
1119
  }
1120
- function O(e) {
1120
+ function I(e) {
1121
1121
  return JSON.parse(JSON.stringify(e));
1122
1122
  }
1123
1123
  function T(e) {
@@ -1134,14 +1134,14 @@ function kr(e, t = {}) {
1134
1134
  const n = t.migrations ? vn(t.migrations) : void 0, r = async (a) => n ? (await n(a)).document : re(a), o = async (a, c) => {
1135
1135
  T(c);
1136
1136
  const d = await e.read(a, c);
1137
- return T(c), d ? O(d) : void 0;
1137
+ return T(c), d ? I(d) : void 0;
1138
1138
  }, i = async (a, c) => {
1139
1139
  const d = await o(a, c.signal);
1140
1140
  if ((d?.revision ?? null) !== c.expectedRevision) throw new F("conflict", "模板已变化,请重新读取后提交");
1141
1141
  return d;
1142
1142
  }, l = async (a, c, d) => {
1143
- if (T(c.signal), !await e.compareAndSwap(a.id, c.expectedRevision, O(a), { signal: c.signal, ...d ? { publication: O(d) } : {} })) throw new F("conflict", "模板已被其他请求更新");
1144
- return O(a);
1143
+ if (T(c.signal), !await e.compareAndSwap(a.id, c.expectedRevision, I(a), { signal: c.signal, ...d ? { publication: I(d) } : {} })) throw new F("conflict", "模板已被其他请求更新");
1144
+ return I(a);
1145
1145
  }, s = async (a, c, d, m) => {
1146
1146
  if (t.beforePublish) {
1147
1147
  T(d.signal);
@@ -1151,31 +1151,31 @@ function kr(e, t = {}) {
1151
1151
  if (!S || S.ok !== !0) throw new F("review", S?.issues?.find((b) => b.severity === "error")?.message ?? "模板发布检查未通过");
1152
1152
  T(d.signal);
1153
1153
  }
1154
- const h = _e(a), f = re({ ...c, revision: h }), g = { revision: h, document: f, publishedAt: (t.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
1155
- return m !== void 0 && (g.restoredFrom = m), l({ id: a.id, revision: h, publishedRevision: h, published: f }, d, g);
1154
+ const f = _e(a), h = re({ ...c, revision: f }), g = { revision: f, document: h, publishedAt: (t.now?.() ?? /* @__PURE__ */ new Date()).toISOString() };
1155
+ return m !== void 0 && (g.restoredFrom = m), l({ id: a.id, revision: f, publishedRevision: f, published: h }, d, g);
1156
1156
  };
1157
1157
  return {
1158
1158
  list: async (a) => {
1159
1159
  T(a);
1160
1160
  const c = await e.list(a);
1161
- return T(a), O(c);
1161
+ return T(a), I(c);
1162
1162
  },
1163
1163
  get: async (a, c = {}) => {
1164
- const d = await o(a, c.signal), m = c.draft ? d?.draft : d?.published, h = m ? await r(m) : void 0;
1165
- return T(c.signal), h;
1164
+ const d = await o(a, c.signal), m = c.draft ? d?.draft : d?.published, f = m ? await r(m) : void 0;
1165
+ return T(c.signal), f;
1166
1166
  },
1167
1167
  history: async (a, c) => {
1168
1168
  T(c);
1169
1169
  const d = await e.history(a, c);
1170
- return T(c), O(d);
1170
+ return T(c), I(d);
1171
1171
  },
1172
1172
  saveDraft: async (a, c) => {
1173
1173
  c = { ...c }, T(c.signal);
1174
- const d = await r(t.migrate ? await t.migrate(a) : a), m = await i(d.id, c), h = _e(m);
1174
+ const d = await r(t.migrate ? await t.migrate(a) : a), m = await i(d.id, c), f = _e(m);
1175
1175
  return l({
1176
1176
  id: d.id,
1177
- revision: h,
1178
- draft: { ...d, revision: h },
1177
+ revision: f,
1178
+ draft: { ...d, revision: f },
1179
1179
  ...m?.publishedRevision ? { publishedRevision: m.publishedRevision, published: m.published } : {}
1180
1180
  }, c);
1181
1181
  },
@@ -1191,9 +1191,9 @@ function kr(e, t = {}) {
1191
1191
  const m = await i(a, d);
1192
1192
  if (!m) throw new F("missing", "模板不存在");
1193
1193
  T(d.signal);
1194
- const h = await e.getVersion(a, c, d.signal);
1195
- if (!h) throw new F("history", "历史修订不存在");
1196
- return s(m, await r(h.document), d, c);
1194
+ const f = await e.getVersion(a, c, d.signal);
1195
+ if (!f) throw new F("history", "历史修订不存在");
1196
+ return s(m, await r(f.document), d, c);
1197
1197
  }
1198
1198
  };
1199
1199
  }
@@ -1203,23 +1203,23 @@ function Ar() {
1203
1203
  read: async (n, r) => {
1204
1204
  T(r);
1205
1205
  const o = e.get(n);
1206
- return o ? O(o) : void 0;
1206
+ return o ? I(o) : void 0;
1207
1207
  },
1208
1208
  list: async (n) => (T(n), Array.from(e.values(), ({ id: r, revision: o, publishedRevision: i }) => ({ id: r, revision: o, ...i ? { publishedRevision: i } : {} }))),
1209
- history: async (n, r) => (T(r), Array.from(t.get(n)?.values() ?? [], (o) => O(o))),
1209
+ history: async (n, r) => (T(r), Array.from(t.get(n)?.values() ?? [], (o) => I(o))),
1210
1210
  getVersion: async (n, r, o) => {
1211
1211
  T(o);
1212
1212
  const i = t.get(n)?.get(r);
1213
- return i ? O(i) : void 0;
1213
+ return i ? I(i) : void 0;
1214
1214
  },
1215
1215
  compareAndSwap: async (n, r, o, i) => {
1216
1216
  if (T(i.signal), (e.get(n)?.revision ?? null) !== r) return !1;
1217
1217
  if (o.id !== n) throw new F("history", "状态 ID 与存储 ID 不一致");
1218
- const l = O(o), s = i.publication;
1218
+ const l = I(o), s = i.publication;
1219
1219
  if (s) {
1220
1220
  const a = t.get(n) ?? /* @__PURE__ */ new Map();
1221
1221
  if (a.has(s.revision) || s.revision !== o.revision || s.document.id !== n) throw new F("history", "发布修订不可覆盖,且必须与状态修订和模板 ID 一致");
1222
- a.set(s.revision, O(s)), t.set(n, a);
1222
+ a.set(s.revision, I(s)), t.set(n, a);
1223
1223
  }
1224
1224
  return e.set(n, l), !0;
1225
1225
  }
@@ -1369,13 +1369,13 @@ function An(e, t) {
1369
1369
  throw new u("load", "Component loader must return render and optional dispose methods.", "$.load", t);
1370
1370
  }
1371
1371
  }
1372
- function In(e, t) {
1372
+ function On(e, t) {
1373
1373
  const n = new AbortController(), r = () => n.abort(e.reason), o = () => n.abort(t.reason);
1374
1374
  return e.aborted ? r() : e.addEventListener("abort", r, { once: !0 }), t.aborted ? o() : t.addEventListener("abort", o, { once: !0 }), { signal: n.signal, dispose() {
1375
1375
  e.removeEventListener("abort", r), t.removeEventListener("abort", o);
1376
1376
  } };
1377
1377
  }
1378
- function Ir(e) {
1378
+ function Or(e) {
1379
1379
  if (!Array.isArray(e) || e.length > 128) throw new u("definition", "Register at most 128 component extensions.");
1380
1380
  const t = /* @__PURE__ */ new Map(), n = new AbortController();
1381
1381
  let r = !1, o;
@@ -1391,10 +1391,10 @@ function Ir(e) {
1391
1391
  }
1392
1392
  const l = async (a) => {
1393
1393
  U(r);
1394
- const { entry: c, extension: d } = $n(t, a.component), m = In(a.signal, n.signal);
1394
+ const { entry: c, extension: d } = $n(t, a.component), m = On(a.signal, n.signal);
1395
1395
  try {
1396
- const h = await De(i(c), m.signal);
1397
- return await De(h.render({ ...a, signal: m.signal, extension: d }), m.signal);
1396
+ const f = await De(i(c), m.signal);
1397
+ return await De(f.render({ ...a, signal: m.signal, extension: d }), m.signal);
1398
1398
  } finally {
1399
1399
  m.dispose();
1400
1400
  }
@@ -1419,8 +1419,8 @@ function Ir(e) {
1419
1419
  if (!d) throw new u("binding", "Component extension is not registered in this runtime.", "$.id", a);
1420
1420
  const m = Q(K(c), "$");
1421
1421
  me(m, ["props", "binding"], "$");
1422
- const h = { id: a, version: d.metadata.version, props: wt(d.metadata, m.props), ...m.binding === void 0 ? {} : { binding: m.binding } };
1423
- return { kind: d.metadata.kind, meta: { [H]: Object.freeze(h) } };
1422
+ const f = { id: a, version: d.metadata.version, props: wt(d.metadata, m.props), ...m.binding === void 0 ? {} : { binding: m.binding } };
1423
+ return { kind: d.metadata.kind, meta: { [H]: Object.freeze(f) } };
1424
1424
  },
1425
1425
  dispose() {
1426
1426
  return o || (r = !0, n.abort(new u("disposed", "Component registry has been disposed.")), o = Promise.allSettled([...t.values()].filter((a) => a.renderer).map(We)).then((a) => {
@@ -1431,11 +1431,11 @@ function Ir(e) {
1431
1431
  };
1432
1432
  return s;
1433
1433
  }
1434
- function Or(e) {
1434
+ function Ir(e) {
1435
1435
  return e.map((t) => t.map((n) => /[\t\r\n"]/.test(n) ? `"${n.replace(/"/g, '""')}"` : n).join(" ")).join(`\r
1436
1436
  `);
1437
1437
  }
1438
- function On(e, t) {
1438
+ function In(e, t) {
1439
1439
  const n = e[e.length - 1];
1440
1440
  e.length > 1 && n?.length === 1 && n[0] === "" && /[\r\n]$/.test(t) && e.pop();
1441
1441
  }
@@ -1479,7 +1479,7 @@ function Nr(e, t = 1e4) {
1479
1479
  r += c;
1480
1480
  }
1481
1481
  if (o) throw new Error("Unclosed clipboard quote");
1482
- return s(), On(n, e), n;
1482
+ return s(), In(n, e), n;
1483
1483
  }
1484
1484
  class Nn extends Error {
1485
1485
  constructor(t, n, r) {
@@ -1622,11 +1622,11 @@ async function Xn(e, t, n, r, o) {
1622
1622
  for (const d of i.cells[a]) {
1623
1623
  for (await se(r); c < l && (s.get(c) ?? 0) > a; ) c++;
1624
1624
  if (c >= l) break;
1625
- const m = Math.max(1, Math.min(d?.colSpan ?? 1, l - c)), h = Math.min(i.cells.length, a + Math.max(1, d?.rowSpan ?? 1));
1625
+ const m = Math.max(1, Math.min(d?.colSpan ?? 1, l - c)), f = Math.min(i.cells.length, a + Math.max(1, d?.rowSpan ?? 1));
1626
1626
  m > 1 && await se(r, m - 1);
1627
- for (let g = c; g < c + m; g++) s.set(g, h);
1628
- const f = Kn(e, a, c, n);
1629
- f && qn(o, d, f), c += m;
1627
+ for (let g = c; g < c + m; g++) s.set(g, f);
1628
+ const h = Kn(e, a, c, n);
1629
+ h && qn(o, d, h), c += m;
1630
1630
  }
1631
1631
  }
1632
1632
  }
@@ -1702,9 +1702,9 @@ function tr(e, t) {
1702
1702
  const d = n[r], m = d === "+" || d === "-" ? 1 : d === "*" || d === "/" ? 2 : 0;
1703
1703
  if (!m || m < s) break;
1704
1704
  r++;
1705
- const h = i(m + 1, a + 1);
1706
- if (d === "/" && h === 0) throw new v("division");
1707
- c = X(d === "+" ? c + h : d === "-" ? c - h : d === "*" ? c * h : c / h);
1705
+ const f = i(m + 1, a + 1);
1706
+ if (d === "/" && f === 0) throw new v("division");
1707
+ c = X(d === "+" ? c + f : d === "-" ? c - f : d === "*" ? c * f : c / f);
1708
1708
  }
1709
1709
  return c;
1710
1710
  }
@@ -1779,10 +1779,10 @@ function ir(e, t, n) {
1779
1779
  const { paper: o, columns: i, rows: l, margin: s, gap: a, offset: c } = n;
1780
1780
  if (s.left + c.x < 0 || s.top + c.y < 0 || s.left + c.x + i * r.pageWidthMm + (i - 1) * a.horizontal + s.right > o.widthMm + 1e-6 || s.top + c.y + l * r.pageHeightMm + (l - 1) * a.vertical + s.bottom > o.heightMm + 1e-6) throw new k("标签、间距、边距及校准偏移超过纸张尺寸;不会自动缩小标签", "$.paper");
1781
1781
  let d = 0;
1782
- for (const [m, h] of e.pages.entries()) {
1783
- if (oe(t.signal), h.layout === "wide" || h.pageWidthMm !== r.pageWidthMm || h.pageHeightMm !== r.pageHeightMm) throw new k("拼版需要尺寸相同的固定标签页面", `$.pages.${m}`);
1784
- if (d += h.components.reduce((f, g) => f + yt(g), 0), d > B(t.maxComponents ?? 25e4, "$.maxComponents", !0)) throw new k("拼版组件总量超过预算", "$.maxComponents");
1785
- for (const f of h.components) if (f.leftMm < 0 || f.topMm < 0 || f.leftMm + f.widthMm > h.pageWidthMm + 1e-6 || f.topMm + f.heightMm > h.pageHeightMm + 1e-6) throw new k("标签内容超出标签边界", `$.pages.${m}.components`);
1782
+ for (const [m, f] of e.pages.entries()) {
1783
+ if (oe(t.signal), f.layout === "wide" || f.pageWidthMm !== r.pageWidthMm || f.pageHeightMm !== r.pageHeightMm) throw new k("拼版需要尺寸相同的固定标签页面", `$.pages.${m}`);
1784
+ if (d += f.components.reduce((h, g) => h + yt(g), 0), d > B(t.maxComponents ?? 25e4, "$.maxComponents", !0)) throw new k("拼版组件总量超过预算", "$.maxComponents");
1785
+ for (const h of f.components) if (h.leftMm < 0 || h.topMm < 0 || h.leftMm + h.widthMm > f.pageWidthMm + 1e-6 || h.topMm + h.heightMm > f.pageHeightMm + 1e-6) throw new k("标签内容超出标签边界", `$.pages.${m}.components`);
1786
1786
  }
1787
1787
  }
1788
1788
  function Fr(e, t) {
@@ -1790,13 +1790,13 @@ function Fr(e, t) {
1790
1790
  const n = or(t), { paper: r, columns: o, capacity: i, margin: l, gap: s, startSlot: a, offset: c } = n, d = e.pages.length ? Math.ceil((a + e.pages.length) / i) : 0;
1791
1791
  if (d > B(t.maxSheets ?? 1e4, "$.maxSheets", !0)) throw new k("拼版纸张数量超过预算", "$.maxSheets");
1792
1792
  B(t.maxComponents ?? 25e4, "$.maxComponents", !0), ir(e, t, n);
1793
- const m = et(e, { maxBytes: B(t.maxSnapshotBytes ?? 64e6, "$.maxSnapshotBytes", !0), check: () => oe(t.signal), error: (f, g) => new k(g, "$.maxSnapshotBytes") }), h = Array.from({ length: d }, () => ({ pageWidthMm: r.widthMm, pageHeightMm: r.heightMm, components: [], meta: { labelSheet: { columns: o, rows: n.rows, slots: [] } } }));
1794
- for (const [f, g] of m.pages.entries()) {
1793
+ const m = et(e, { maxBytes: B(t.maxSnapshotBytes ?? 64e6, "$.maxSnapshotBytes", !0), check: () => oe(t.signal), error: (h, g) => new k(g, "$.maxSnapshotBytes") }), f = Array.from({ length: d }, () => ({ pageWidthMm: r.widthMm, pageHeightMm: r.heightMm, components: [], meta: { labelSheet: { columns: o, rows: n.rows, slots: [] } } }));
1794
+ for (const [h, g] of m.pages.entries()) {
1795
1795
  oe(t.signal);
1796
- const C = a + f, S = C % i, b = h[Math.floor(C / i)], M = l.left + c.x + S % o * (g.pageWidthMm + s.horizontal), w = l.top + c.y + Math.floor(S / o) * (g.pageHeightMm + s.vertical), N = { sourcePageIndex: f, slotIndex: S, xMm: M, yMm: w, widthMm: g.pageWidthMm, heightMm: g.pageHeightMm, ...g.meta ? { sourceMeta: g.meta } : {} };
1796
+ const C = a + h, S = C % i, b = f[Math.floor(C / i)], M = l.left + c.x + S % o * (g.pageWidthMm + s.horizontal), w = l.top + c.y + Math.floor(S / o) * (g.pageHeightMm + s.vertical), N = { sourcePageIndex: h, slotIndex: S, xMm: M, yMm: w, widthMm: g.pageWidthMm, heightMm: g.pageHeightMm, ...g.meta ? { sourceMeta: g.meta } : {} };
1797
1797
  b.meta.labelSheet.slots.push(N), b.components.push(...g.components.map((D) => ({ ...D, leftMm: D.leftMm + M, topMm: D.topMm + w, meta: { ...D.meta, labelSheet: N } })));
1798
1798
  }
1799
- return { ...m, pages: h };
1799
+ return { ...m, pages: f };
1800
1800
  }
1801
1801
  function jr(e) {
1802
1802
  if (!e || !["today", "yesterday", "month-start", "month-end"].includes(e.preset)) throw new TypeError("未知日期默认值");
@@ -1808,183 +1808,203 @@ function jr(e) {
1808
1808
  if (o.setUTCFullYear(r("year"), r("month") - 1, r("day")), o.setUTCHours(0, 0, 0, 0), e.preset === "yesterday" && o.setUTCDate(o.getUTCDate() - 1), e.preset === "month-start" && o.setUTCDate(1), e.preset === "month-end" && o.setUTCMonth(o.getUTCMonth() + 1, 0), o.setUTCDate(o.getUTCDate() + (e.offsetDays ?? 0)), o.getUTCFullYear() < 1 || o.getUTCFullYear() > 9999) throw new RangeError("业务日期超出 0001–9999 范围");
1809
1809
  return o.toISOString().slice(0, 10);
1810
1810
  }
1811
+ function zr(e, t) {
1812
+ const n = JSON.parse(JSON.stringify(e));
1813
+ function r(o) {
1814
+ if (!o || typeof o != "object") return;
1815
+ if (Array.isArray(o)) {
1816
+ o.forEach(r);
1817
+ return;
1818
+ }
1819
+ const i = o, l = i.meta?.contextKey;
1820
+ if (i.kind === "text" && typeof l == "string" && Object.prototype.hasOwnProperty.call(t, l)) {
1821
+ const s = t[l];
1822
+ if (typeof s != "string") throw new TypeError("Report template context values must be strings");
1823
+ i.text = s, delete i.lines, delete i.rawText, delete i.richParagraphs;
1824
+ }
1825
+ Object.values(i).forEach(r);
1826
+ }
1827
+ return r(n.pages), n;
1828
+ }
1811
1829
  export {
1812
- Br as CSS_DPI,
1813
- _r as DEFAULT_BORDER_PT,
1830
+ _r as CSS_DPI,
1831
+ Wr as DEFAULT_BORDER_PT,
1814
1832
  le as DEFAULT_FONT_FAMILY,
1815
- Wr as DEFAULT_FONT_PT,
1816
- So as DEFAULT_LABEL_PAGE_LIMIT,
1817
- Ur as DEFAULT_STROKE_COLOR,
1833
+ Ur as DEFAULT_FONT_PT,
1834
+ Co as DEFAULT_LABEL_PAGE_LIMIT,
1835
+ Vr as DEFAULT_STROKE_COLOR,
1818
1836
  Ge as DEFAULT_TEXT_COLOR,
1819
- Vr as LINE_HEIGHT,
1837
+ qr as LINE_HEIGHT,
1820
1838
  k as LabelSheetError,
1821
- qr as MM_PER_INCH,
1822
- ni as OutputAssetError,
1839
+ Gr as MM_PER_INCH,
1840
+ oi as OutputAssetError,
1823
1841
  kt as OutputFidelityError,
1824
1842
  ie as PAPER_SIZES,
1825
1843
  mn as PageBuilder,
1826
- Eo as PaginateCellLimitError,
1827
- Co as PaginateChartComponentLimitError,
1828
- To as PaginatePageLimitError,
1829
- io as RENDER_PLAN_SCHEMA_VERSION,
1844
+ To as PaginateCellLimitError,
1845
+ Ro as PaginateChartComponentLimitError,
1846
+ Po as PaginatePageLimitError,
1847
+ ao as RENDER_PLAN_SCHEMA_VERSION,
1830
1848
  pe as REPORT_TEMPLATE_DOCUMENT_VERSION,
1831
- Xr as ReportBindingError,
1849
+ Zr as ReportBindingError,
1832
1850
  v as ReportCalculationError,
1833
1851
  Rt as ReportCellEditError,
1834
1852
  Nn as ReportCellFieldError,
1835
1853
  u as ReportComponentExtensionError,
1836
- ii as ReportDataError,
1837
- ai as ReportDrillError,
1838
- pi as ReportParamValidationError,
1854
+ si as ReportDataError,
1855
+ li as ReportDrillError,
1856
+ bi as ReportParamValidationError,
1839
1857
  xe as ReportSourceError,
1840
1858
  Ze as ReportTemplateError,
1841
1859
  j as ReportTemplateMigrationError,
1842
1860
  F as ReportTemplateStoreError,
1843
- Ro as ReportValidationError,
1844
- Gr as SCHEMA_VERSION_MACH,
1861
+ $o as ReportValidationError,
1862
+ Jr as SCHEMA_VERSION_MACH,
1845
1863
  dn as TemplateBuilder,
1846
- ta as TreeRowLimitError,
1847
- Po as applyReportCellEdit,
1848
- $o as applyReportCellEditBatch,
1849
- Yi as applyReportDocumentStyle,
1850
- ko as applyReportEditResult,
1851
- Ao as applyReportSourceMetadata,
1852
- so as assertRenderPlan,
1853
- wi as assertReportParams,
1854
- Io as assertReportValidation,
1864
+ ra as TreeRowLimitError,
1865
+ ko as applyReportCellEdit,
1866
+ Ao as applyReportCellEditBatch,
1867
+ Zi as applyReportDocumentStyle,
1868
+ Oo as applyReportEditResult,
1869
+ Io as applyReportSourceMetadata,
1870
+ lo as assertRenderPlan,
1871
+ yi as assertReportParams,
1872
+ No as assertReportValidation,
1873
+ zr as bindReportTemplateContext,
1855
1874
  Lr as calculateReportSelection,
1856
- Xi as captureTemplateFragment,
1857
- bo as charWidthEm,
1875
+ Qi as captureTemplateFragment,
1876
+ Mo as charWidthEm,
1858
1877
  P as classOf,
1859
- Hi as cloneReportTemplate,
1860
- qi as collectTemplateOutline,
1878
+ _i as cloneReportTemplate,
1879
+ Ji as collectTemplateOutline,
1861
1880
  Cr as columnsFromContract,
1862
- si as compareReportData,
1863
- Li as compileReportPredicate,
1881
+ ci as compareReportData,
1882
+ ji as compileReportPredicate,
1864
1883
  tn as computePageWindow,
1865
- Oo as countTemplatePages,
1866
- yo as createCanvasMeasurer,
1884
+ Do as countTemplatePages,
1885
+ vo as createCanvasMeasurer,
1867
1886
  Sr as createCanvasPager,
1868
- Mo as createHeuristicMeasurer,
1887
+ xo as createHeuristicMeasurer,
1869
1888
  Rr as createLabelTemplate,
1870
- Bi as createLocalTemplateCatalog,
1889
+ Wi as createLocalTemplateCatalog,
1871
1890
  Ar as createMemoryTemplateStore,
1872
1891
  br as createPageViewportRenderer,
1873
1892
  $r as createProviderReport,
1874
- No as createReportCellEdit,
1875
- Do as createReportCellEditBatch,
1876
- Lo as createReportCellResolver,
1877
- Oi as createReportChartData,
1878
- Ir as createReportComponentRegistry,
1879
- li as createReportDrillRequest,
1880
- Fo as createReportEditSession,
1881
- ci as createReportPrefill,
1882
- jo as createReportSource,
1893
+ Lo as createReportCellEdit,
1894
+ Fo as createReportCellEditBatch,
1895
+ jo as createReportCellResolver,
1896
+ Di as createReportChartData,
1897
+ Or as createReportComponentRegistry,
1898
+ di as createReportDrillRequest,
1899
+ zo as createReportEditSession,
1900
+ mi as createReportPrefill,
1901
+ Ho as createReportSource,
1883
1902
  Tr as createTableTemplate,
1884
1903
  Er as createTemplate,
1885
1904
  kr as createTemplateManager,
1886
1905
  vn as createTemplateMigrator,
1887
- lo as createTemplateRegistry,
1888
- na as createTreeTable,
1889
- po as datasetJsonSchema,
1906
+ co as createTemplateRegistry,
1907
+ oa as createTreeTable,
1908
+ bo as datasetJsonSchema,
1890
1909
  Pr as defineLabelReport,
1891
1910
  Tt as defineReport,
1892
- co as defineReportTemplate,
1893
- _i as diffReportTemplates,
1894
- zo as estimateListLayoutCells,
1895
- Zr as evalStyleRule,
1911
+ mo as defineReportTemplate,
1912
+ Ui as diffReportTemplates,
1913
+ Bo as estimateListLayoutCells,
1914
+ Qr as evalStyleRule,
1896
1915
  tr as evaluateReportAggregateExpression,
1897
- Fi as evaluateReportPredicate,
1898
- Ho as explainDatasetField,
1899
- bi as formatReportCascaderPath,
1900
- Bo as formatReportCellEdit,
1901
- Or as formatReportClipboard,
1902
- yi as formatReportDateRange,
1903
- Mi as formatReportNumberRange,
1904
- vi as formatReportParamSelection,
1905
- Qr as formatValue,
1906
- _o as getReportCellContext,
1907
- Wo as getReportEditSession,
1908
- Uo as hasValidDataExplanation,
1916
+ zi as evaluateReportPredicate,
1917
+ _o as explainDatasetField,
1918
+ Mi as formatReportCascaderPath,
1919
+ Wo as formatReportCellEdit,
1920
+ Ir as formatReportClipboard,
1921
+ vi as formatReportDateRange,
1922
+ xi as formatReportNumberRange,
1923
+ Si as formatReportParamSelection,
1924
+ eo as formatValue,
1925
+ Uo as getReportCellContext,
1926
+ Vo as getReportEditSession,
1927
+ qo as hasValidDataExplanation,
1909
1928
  ve as heuristicMeasurer,
1910
1929
  Fr as imposeLabelSheets,
1911
- Zi as insertTemplateFragment,
1912
- ri as inspectOutputCapabilities,
1913
- Gi as inspectTemplateFieldUsage,
1914
- Qi as inspectTemplateFragmentBindings,
1930
+ ea as insertTemplateFragment,
1931
+ ii as inspectOutputCapabilities,
1932
+ fo as inspectReportTemplateCompatibility,
1933
+ Ki as inspectTemplateFieldUsage,
1934
+ ta as inspectTemplateFragmentBindings,
1915
1935
  ce as isImageBackedComponent,
1916
- Vo as isReportDataTarget,
1917
- xi as isReportDate,
1918
- Si as isReportMonth,
1919
- qo as isReportValueState,
1920
- Ei as isReportYear,
1936
+ Go as isReportDataTarget,
1937
+ Ei as isReportDate,
1938
+ Ci as isReportMonth,
1939
+ Jo as isReportValueState,
1940
+ Ti as isReportYear,
1921
1941
  Ye as isRichText,
1922
- di as matchReportDrillActions,
1942
+ fi as matchReportDrillActions,
1923
1943
  Pe as measurePageSizePx,
1924
- vo as measureTextMm,
1944
+ So as measureTextMm,
1925
1945
  Ke as mergeComponentStyles,
1926
1946
  ue as mmToPx,
1927
- Jr as mmToPxFactor,
1928
- Go as paginateTemplate,
1929
- Jo as paginateTemplatePages,
1930
- eo as parseDateLocal,
1931
- Ci as parseReportCascaderPath,
1947
+ Kr as mmToPxFactor,
1948
+ Ko as paginateTemplate,
1949
+ Yo as paginateTemplatePages,
1950
+ to as parseDateLocal,
1951
+ Ri as parseReportCascaderPath,
1932
1952
  Dr as parseReportCellFieldInput,
1933
1953
  Pt as parseReportCellInput,
1934
1954
  Nr as parseReportClipboard,
1935
- Ti as parseReportDateRange,
1936
- Ri as parseReportNumberRange,
1937
- Pi as parseReportParamSelection,
1955
+ Pi as parseReportDateRange,
1956
+ $i as parseReportNumberRange,
1957
+ ki as parseReportParamSelection,
1938
1958
  re as parseReportTemplate,
1939
1959
  yr as planFontSizePx,
1940
- Ko as projectListColumns,
1960
+ Xo as projectListColumns,
1941
1961
  V as ptToPx,
1942
- Kr as pxToMm,
1943
- Yo as registerReportEditSession,
1944
- Xo as relocateReportCellEdits,
1962
+ Yr as pxToMm,
1963
+ Zo as registerReportEditSession,
1964
+ Qo as relocateReportCellEdits,
1945
1965
  lt as renderComponent,
1946
1966
  ct as renderPage,
1947
1967
  wr as renderPlan,
1948
1968
  vr as renderPlanToCanvas,
1949
1969
  xr as renderPlanToCanvasAsync,
1950
1970
  Mr as renderPlanToImages,
1951
- Zo as reportCellEditKey,
1952
- mi as reportDataSnapshotFromPlan,
1971
+ ei as reportCellEditKey,
1972
+ hi as reportDataSnapshotFromPlan,
1953
1973
  jr as reportDateDefault,
1954
1974
  Z as reportOutputDiagnostics,
1955
- $i as reportParamsJsonSchema,
1956
- ji as reportPredicateFields,
1957
- hi as reportPrefillInputs,
1975
+ Ai as reportParamsJsonSchema,
1976
+ Hi as reportPredicateFields,
1977
+ gi as reportPrefillInputs,
1958
1978
  Je as resolveBoxBorders,
1959
- to as resolveComponentBinding,
1979
+ no as resolveComponentBinding,
1960
1980
  _ as resolveFontSize,
1961
1981
  ye as resolveGridLayout,
1962
1982
  q as resolveLineHeight,
1963
1983
  ut as resolvePaper,
1964
1984
  Ee as resolvePlanAssets,
1965
- fi as resolveReportDrillReturn,
1985
+ ui as resolveReportDrillReturn,
1966
1986
  Y as resolveStroke,
1967
1987
  Me as resolveTextColor,
1968
- Wi as reviewReportTemplate,
1969
- Ui as reviewReportTemplateAsync,
1988
+ Vi as reviewReportTemplate,
1989
+ qi as reviewReportTemplateAsync,
1970
1990
  J as round,
1971
- mo as serializeReportTemplate,
1972
- Qo as summarizeReportCellEdits,
1973
- Ji as templatePathLocation,
1974
- no as toExcelNumberFormat,
1975
- ro as toNumber,
1976
- ho as validateComponent,
1991
+ ho as serializeReportTemplate,
1992
+ ti as summarizeReportCellEdits,
1993
+ Yi as templatePathLocation,
1994
+ ro as toExcelNumberFormat,
1995
+ oo as toNumber,
1996
+ go as validateComponent,
1977
1997
  Ct as validateDatasetRows,
1978
- fo as validatePage,
1998
+ uo as validatePage,
1979
1999
  Et as validateRenderPlan,
1980
2000
  _n as validateReportCellFieldDefinition,
1981
- Ni as validateReportChartBinding,
1982
- ei as validateReportDataset,
1983
- gi as validateReportDrillActions,
1984
- ki as validateReportParamDefinitions,
1985
- Ai as validateReportParams,
2001
+ Li as validateReportChartBinding,
2002
+ ni as validateReportDataset,
2003
+ pi as validateReportDrillActions,
2004
+ Oi as validateReportParamDefinitions,
2005
+ Ii as validateReportParams,
1986
2006
  Xe as validateReportTemplate,
1987
- go as validateReportTemplateDocument,
1988
- ra as validateTreeOptions,
2007
+ po as validateReportTemplateDocument,
2008
+ ia as validateTreeOptions,
1989
2009
  Qe as wrapText
1990
2010
  };