@agile-team/mach-report 2.26.0 → 2.26.2

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 (150) hide show
  1. package/README.md +16 -5
  2. package/dist/ExcelBindingWizard-CnjjpYxD.cjs +1 -0
  3. package/dist/{ExcelBindingWizard-B418l44t.js → ExcelBindingWizard-DAprCgn-.js} +4 -4
  4. package/dist/{ParamEditor-XvMtf_XQ.js → ParamEditor-CY9d8QZD.js} +3 -3
  5. package/dist/ParamEditor-CiVjpbc-.cjs +1 -0
  6. package/dist/ReportBatchPanel-0-Oymcdm.cjs +1 -0
  7. package/dist/{ReportBatchPanel-Ds0R_uXn.js → ReportBatchPanel-CDp7xRHp.js} +4 -4
  8. package/dist/ReportLabelStudio-CsyHqBco.cjs +1 -0
  9. package/dist/{ReportLabelStudio-ZFy79eRv.js → ReportLabelStudio-DtKxk9n0.js} +183 -183
  10. package/dist/ReportParamPanel-CoKcXzSy.cjs +1 -0
  11. package/dist/{ReportParamPanel-Czm3OPo_.js → ReportParamPanel-jKDJVar2.js} +2 -2
  12. package/dist/{ReportPreview-C9c0Rp7Y.js → ReportPreview-DJqt40zA.js} +2863 -2836
  13. package/dist/ReportPreview-s7c2nrfo.cjs +6 -0
  14. package/dist/ReportTemplateLibrary-CsUm6edm.cjs +1 -0
  15. package/dist/{ReportTemplateLibrary-XJVoTDIz.js → ReportTemplateLibrary-qPQX0Dt_.js} +2 -2
  16. package/dist/RuleEditor-CJBibiLY.cjs +1 -0
  17. package/dist/{RuleEditor-CeNFPeOc.js → RuleEditor-Di-JZ2Lb.js} +6 -6
  18. package/dist/{TemplateOutlinePanel-BWN4Y9iz.js → TemplateOutlinePanel-D0mKfVWf.js} +3 -3
  19. package/dist/TemplateOutlinePanel-RiRgXnnH.cjs +1 -0
  20. package/dist/TemplateReusePanel-BdK91T7z.cjs +1 -0
  21. package/dist/{TemplateReusePanel-CR-4OHoU.js → TemplateReusePanel-J6PvD2Sf.js} +3 -3
  22. package/dist/TemplateReviewPanel-B5yUgOgb.cjs +1 -0
  23. package/dist/{TemplateReviewPanel-BkWzyNL4.js → TemplateReviewPanel-BlUbD2GY.js} +3 -3
  24. package/dist/analytics.cjs +1 -1
  25. package/dist/analytics.js +5 -5
  26. package/dist/artifact-integrity.json +112 -114
  27. package/dist/assets-CylgPA6P.cjs +1 -0
  28. package/dist/assets-Vt10jCtl.js +136 -0
  29. package/dist/auto-D3UNXBrM.cjs +1 -0
  30. package/dist/{auto-C7udkeAa.js → auto-Hq-xgrvS.js} +28 -25
  31. package/dist/{batch-DGCt44XM.js → batch-Be_NbW7U.js} +1 -1
  32. package/dist/{batch-DYcokH4v.cjs → batch-CI4ZpuoX.cjs} +1 -1
  33. package/dist/{charts-D-Vg-ak9.cjs → charts-Cy7muNWi.cjs} +1 -1
  34. package/dist/{charts-D48XCefN.js → charts-DLTz0OEG.js} +1 -1
  35. package/dist/{computed-BQgBrma-.cjs → computed-8nFyVnok.cjs} +1 -1
  36. package/dist/{computed-CH3NYPOW.js → computed-BR_O8uAv.js} +14 -20
  37. package/dist/{data-bar-DzceAVeR.cjs → data-bar--_aPWr-W.cjs} +1 -1
  38. package/dist/{data-bar-DjOgTLqu.js → data-bar-BVnzVbE9.js} +1 -1
  39. package/dist/designer-Bc5AXS38.cjs +2 -0
  40. package/dist/designer-CZqnLTyE.js +8350 -0
  41. package/dist/designer.cjs +1 -1
  42. package/dist/designer.d.cts +108 -1
  43. package/dist/designer.d.ts +108 -1
  44. package/dist/designer.js +1 -1
  45. package/dist/{diagnostic-collector-C-JBA016.js → diagnostic-collector-CZ8DV6wA.js} +208 -186
  46. package/dist/diagnostic-collector-DwMJWEHo.cjs +1 -0
  47. package/dist/{dom-DgWc-DY1.js → dom-CbOWY7KE.js} +5 -5
  48. package/dist/dom-VuLh_fhL.cjs +1 -0
  49. package/dist/{encoding-tWc2Wn89.cjs → encoding-D0ITsCCp.cjs} +1 -1
  50. package/dist/{encoding-D480EM2r.js → encoding-TbA3oQLr.js} +2 -2
  51. package/dist/{execution-result-Ba65gieT.js → execution-result-BUPPNlaS.js} +3 -3
  52. package/dist/{execution-result-7sG_mdcD.cjs → execution-result-BgZtqlOT.cjs} +1 -1
  53. package/dist/{font-loader-CHmEwkHl.js → font-loader-BSRR-a0C.js} +1 -1
  54. package/dist/{font-loader-BIxme_9g.cjs → font-loader-BZ4CRPys.cjs} +1 -1
  55. package/dist/{grid-strokes-DsoICRjZ.js → grid-strokes-CovSH3A2.js} +1 -1
  56. package/dist/{grid-strokes-RFMR91jn.cjs → grid-strokes-G5omPT3s.cjs} +1 -1
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.js +23 -23
  59. package/dist/{json-snapshot-BZ0CIQln.js → json-snapshot-DRQmh_k5.js} +718 -683
  60. package/dist/json-snapshot-HR8bez8j.cjs +2 -0
  61. package/dist/{matrix-CB9TqTEy.js → matrix-6wjFVN0Z.js} +149 -142
  62. package/dist/matrix-DeA6__cd.cjs +1 -0
  63. package/dist/media-IV_r4Sp7.cjs +1 -0
  64. package/dist/media-jiLdCn3i.js +208 -0
  65. package/dist/{pdf-DTR7fAIr.js → pdf-BqnoP1L_.js} +14 -15
  66. package/dist/{pdf-d9oJ6V0P.cjs → pdf-Ddm0HCuT.cjs} +48 -48
  67. package/dist/pdf.cjs +1 -1
  68. package/dist/pdf.js +2 -2
  69. package/dist/{plugin-B7Bi-1te.cjs → plugin-BFBLxfsq.cjs} +1 -1
  70. package/dist/{plugin-OKDFQFS4.js → plugin-BnRcXQzg.js} +1 -1
  71. package/dist/{prefill-C8fF91JB.js → prefill-BqbuktRt.js} +3 -3
  72. package/dist/{prefill-C_Bf_AMo.cjs → prefill-DPLV68I7.cjs} +1 -1
  73. package/dist/prepared-Cl7C69N7.cjs +1 -0
  74. package/dist/{prepared-DhgQ0d-h.js → prepared-V7tYf1qj.js} +68 -64
  75. package/dist/{protocol-CZ-BILne.cjs → protocol-BVhKnBmX.cjs} +1 -1
  76. package/dist/{protocol-DHO91-Jt.js → protocol-Bf33Gu9J.js} +3 -3
  77. package/dist/{record-bindings-KEs-DKCS.cjs → record-bindings-DVs_g_No.cjs} +1 -1
  78. package/dist/{record-bindings-DBrCu6zO.js → record-bindings-hxJqcLSK.js} +3 -3
  79. package/dist/{region-binding-workflow-ikpY1Kbw.cjs → region-binding-workflow-Bu31bqCr.cjs} +1 -1
  80. package/dist/{region-binding-workflow-FSyIZge8.js → region-binding-workflow-DRvX25XH.js} +2 -2
  81. package/dist/report-encoding-worker.cjs +1 -1
  82. package/dist/report-encoding-worker.js +1 -1
  83. package/dist/{rich-text-layout-BYbIc3eJ.cjs → rich-text-layout-6VphrIcj.cjs} +1 -1
  84. package/dist/{rich-text-layout-BtygMWZC.js → rich-text-layout-BCdxMT4m.js} +1 -1
  85. package/dist/{runtime-BsvAqz4a.js → runtime-ChdUbPvs.js} +9 -9
  86. package/dist/{runtime-B5HG8poy.cjs → runtime-D2noLfgC.cjs} +1 -1
  87. package/dist/sbom.cdx.json +1 -1
  88. package/dist/server-node.cjs +5 -5
  89. package/dist/server-node.js +2099 -1959
  90. package/dist/server.cjs +1 -1
  91. package/dist/server.js +17 -13
  92. package/dist/sha256-C26wdjDi.cjs +1 -0
  93. package/dist/sha256-D-msitGX.js +166 -0
  94. package/dist/style.css +1 -1
  95. package/dist/{template-catalog-BbrN9dgu.js → template-catalog-CZfnMXKc.js} +4 -4
  96. package/dist/template-catalog-Dv4sOYaB.cjs +1 -0
  97. package/dist/{template-fragments-CUTE8-_I.js → template-fragments-BO6i19kt.js} +3 -3
  98. package/dist/{template-fragments-cyAQu7aw.cjs → template-fragments-CTfJeHoM.cjs} +1 -1
  99. package/dist/{template-registry-PSuLsnyq.js → template-registry-CIaC6qBW.js} +168 -171
  100. package/dist/template-registry-CKo-bogM.cjs +1 -0
  101. package/dist/template-serialization-Cb1ospyK.js +367 -0
  102. package/dist/template-serialization-D4Fofl9c.cjs +1 -0
  103. package/dist/{textwrap-LhJkHWb1.cjs → textwrap-BYSqmGGV.cjs} +1 -1
  104. package/dist/{textwrap-Bt_tnI6V.js → textwrap-CGjFy7gf.js} +1 -1
  105. package/dist/usePopoverBounds-C3hn7F1s.js +84 -0
  106. package/dist/usePopoverBounds-mJhJ-VqG.cjs +1 -0
  107. package/dist/vue-async.cjs +1 -1
  108. package/dist/vue-async.js +3 -3
  109. package/dist/vue.cjs +1 -1
  110. package/dist/vue.js +13 -10
  111. package/dist/{workbook-session-BJfZVp4q.cjs → workbook-session-DL3uBAl8.cjs} +1 -1
  112. package/dist/{workbook-session-DRnMjIFK.js → workbook-session-nkvroJUE.js} +2 -2
  113. package/dist/worker.cjs +1 -1
  114. package/dist/worker.js +4 -4
  115. package/dist/xlsx.cjs +4 -4
  116. package/dist/xlsx.js +28 -29
  117. package/package.json +1 -1
  118. package/dist/ExcelBindingWizard-C4FGVsY_.cjs +0 -1
  119. package/dist/ParamEditor-BemJE8n8.cjs +0 -1
  120. package/dist/ReportBatchPanel-CbY4fvXD.cjs +0 -1
  121. package/dist/ReportLabelStudio-DuTwN5er.cjs +0 -1
  122. package/dist/ReportParamPanel-Chxu4MTx.cjs +0 -1
  123. package/dist/ReportPreview-CIMR4ERo.cjs +0 -6
  124. package/dist/ReportTemplateLibrary-C6lByc69.cjs +0 -1
  125. package/dist/RuleEditor-gggUkEwB.cjs +0 -1
  126. package/dist/TemplateOutlinePanel-B0e-umq2.cjs +0 -1
  127. package/dist/TemplateReusePanel-Cthig1S1.cjs +0 -1
  128. package/dist/TemplateReviewPanel-D8o2gDaK.cjs +0 -1
  129. package/dist/_plugin-vue_export-helper-8SL1F89S.js +0 -53
  130. package/dist/_plugin-vue_export-helper-BLmdZLlg.cjs +0 -1
  131. package/dist/assets-BFTP-0WR.js +0 -137
  132. package/dist/assets-CZiZhTf2.cjs +0 -1
  133. package/dist/auto-CXd2E2aZ.cjs +0 -1
  134. package/dist/capabilities-D8UU2clQ.cjs +0 -1
  135. package/dist/capabilities-g0a2j9Yy.js +0 -125
  136. package/dist/designer-COuSUxZ1.cjs +0 -2
  137. package/dist/designer-CT4mlrr0.js +0 -7997
  138. package/dist/diagnostic-collector-wASg6Fzs.cjs +0 -1
  139. package/dist/dom-Fk4NF-gN.cjs +0 -1
  140. package/dist/json-snapshot-DGFeI30h.cjs +0 -2
  141. package/dist/matrix-CcqYOuq_.cjs +0 -1
  142. package/dist/media-B7vnpD8k.cjs +0 -1
  143. package/dist/media-Y90dHK9z.js +0 -70
  144. package/dist/prepared-BLhV7vdE.cjs +0 -1
  145. package/dist/sha256-BDQ1Qk7A.js +0 -158
  146. package/dist/sha256-DgZAKXqI.cjs +0 -1
  147. package/dist/template-catalog-DDH-5J57.cjs +0 -1
  148. package/dist/template-registry-D24Z8aQf.cjs +0 -1
  149. package/dist/template-serialization-BOUidUlh.cjs +0 -1
  150. package/dist/template-serialization-BgGWYV_1.js +0 -307
@@ -1,22 +1,22 @@
1
- import { c as m } from "./computed-CH3NYPOW.js";
2
- function x(e, r) {
3
- const l = () => r.measures.map((c) => m(c)), t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), n = r.totals ? l() : void 0, s = (c, u) => c?.forEach((i) => i.add(u));
1
+ import { c as g } from "./computed-BR_O8uAv.js";
2
+ function L(e, r) {
3
+ const l = () => r.measures.map((c) => g(c)), t = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = r.totals ? l() : void 0, s = (c, i) => c?.forEach((u) => u.add(i));
4
4
  for (const c of e) {
5
- const u = r.row(c), i = r.column(c);
6
- a.has(i.key) || a.set(i.key, i.label);
7
- let f = t.get(u.key);
8
- f || (f = { label: u.label, cells: /* @__PURE__ */ new Map(), ...r.totals ? { totals: l() } : {} }, t.set(u.key, f)), r.check(t.size, a.size);
9
- let d = f.cells.get(i.key);
10
- if (d || (d = l(), f.cells.set(i.key, d)), s(d, c), !r.totals) continue;
11
- let h = o.get(i.key);
12
- h || (h = l(), o.set(i.key, h)), s(f.totals, c), s(h, c), s(n, c);
5
+ const i = r.row(c), u = r.column(c);
6
+ a.has(u.key) || a.set(u.key, u.label);
7
+ let f = t.get(i.key);
8
+ f || (f = { label: i.label, cells: /* @__PURE__ */ new Map(), ...r.totals ? { totals: l() } : {} }, t.set(i.key, f)), r.check(t.size, a.size);
9
+ let d = f.cells.get(u.key);
10
+ if (d || (d = l(), f.cells.set(u.key, d)), s(d, c), !r.totals) continue;
11
+ let h = n.get(u.key);
12
+ h || (h = l(), n.set(u.key, h)), s(f.totals, c), s(h, c), s(o, c);
13
13
  }
14
- return { groups: t, columns: a, columnTotals: o, totals: n };
14
+ return { groups: t, columns: a, columnTotals: n, totals: o };
15
15
  }
16
- function E(e, r) {
16
+ function $(e, r) {
17
17
  return JSON.stringify([e.slice(0, r.length), r.map((l) => [l === null ? "null" : typeof l, l])]);
18
18
  }
19
- function M(e, r) {
19
+ function x(e, r) {
20
20
  return r.map((l) => {
21
21
  const t = Object.prototype.hasOwnProperty.call(e, l) ? e[l] : null;
22
22
  if (t == null) return null;
@@ -24,12 +24,12 @@ function M(e, r) {
24
24
  throw new Error("矩阵维度必须是有限 JSON 标量");
25
25
  });
26
26
  }
27
- function C(e, r, l) {
27
+ function R(e, r, l) {
28
28
  if (!e || typeof e != "object" || Array.isArray(e)) throw new Error("矩阵层级应为对象");
29
29
  for (const t of [e.emptyLabel, e.subtotalLabel, e.totalLabel]) if (t !== void 0 && typeof t != "string") throw new Error("矩阵层级标签应为字符串");
30
- g(e.row, r.length), g(e.column, l.length);
30
+ b(e.row, r.length), b(e.column, l.length);
31
31
  }
32
- function g(e, r) {
32
+ function b(e, r) {
33
33
  if (e !== void 0) {
34
34
  if (!e || typeof e != "object" || Array.isArray(e)) throw new Error("矩阵轴配置应为对象");
35
35
  if (e.labels !== void 0 && (!Array.isArray(e.labels) || e.labels.length !== r || e.labels.some((l) => typeof l != "string"))) throw new Error("矩阵维度标签必须与维度字段一一对应");
@@ -37,23 +37,23 @@ function g(e, r) {
37
37
  if (e.subtotals !== void 0 && (!Array.isArray(e.subtotals) || new Set(e.subtotals).size !== e.subtotals.length || e.subtotals.some((l) => !Number.isInteger(l) || l < 1 || l >= r))) throw new Error("矩阵小计深度应唯一且位于 1 至末级之前");
38
38
  }
39
39
  }
40
- function b(e, r, l) {
41
- return { fields: e, options: r ?? {}, hierarchy: l, root: { key: E(e, []), values: [], children: /* @__PURE__ */ new Map() }, leaves: 0, expanded: 0 };
40
+ function k(e, r, l) {
41
+ return { fields: e, options: r ?? {}, hierarchy: l, root: { key: $(e, []), values: [], children: /* @__PURE__ */ new Map() }, leaves: 0, expanded: 0 };
42
42
  }
43
- function k(e, r) {
44
- const l = M(r, e.fields);
43
+ function F(e, r) {
44
+ const l = x(r, e.fields);
45
45
  let t = e.root;
46
46
  for (let a = 1; a <= l.length; a++) {
47
- const o = l[a - 1];
48
- let n = t.children.get(o);
49
- if (!n) {
47
+ const n = l[a - 1];
48
+ let o = t.children.get(n);
49
+ if (!o) {
50
50
  const s = l.slice(0, a);
51
- n = { key: E(e.fields, s), values: s, children: /* @__PURE__ */ new Map(), parent: t }, t.children.set(o, n), a === l.length ? (e.leaves++, e.expanded++) : e.options.subtotals?.includes(a) && e.expanded++;
51
+ o = { key: $(e.fields, s), values: s, children: /* @__PURE__ */ new Map(), parent: t }, t.children.set(n, o), a === l.length ? (e.leaves++, e.expanded++) : e.options.subtotals?.includes(a) && e.expanded++;
52
52
  }
53
- t = n;
53
+ t = o;
54
54
  }
55
55
  }
56
- function N(e, r) {
56
+ function p(e, r) {
57
57
  if (e === r) return 0;
58
58
  if (e === null) return -1;
59
59
  if (r === null) return 1;
@@ -61,11 +61,11 @@ function N(e, r) {
61
61
  const l = `${typeof e}:${e}`, t = `${typeof r}:${r}`;
62
62
  return l < t ? -1 : 1;
63
63
  }
64
- function L(e, r) {
64
+ function z(e, r) {
65
65
  const l = [...e.children.values()];
66
- return r && r !== "source" && l.sort((t, a) => N(t.values[t.values.length - 1], a.values[a.values.length - 1]) * (r === "desc" ? -1 : 1)), l;
66
+ return r && r !== "source" && l.sort((t, a) => p(t.values[t.values.length - 1], a.values[a.values.length - 1]) * (r === "desc" ? -1 : 1)), l;
67
67
  }
68
- function y(e, r, l) {
68
+ function w(e, r, l) {
69
69
  const { key: t, values: a } = r;
70
70
  return {
71
71
  key: t,
@@ -73,139 +73,139 @@ function y(e, r, l) {
73
73
  depth: a.length,
74
74
  fields: e.fields.slice(0, a.length),
75
75
  values: a,
76
- labels: a.map((o) => o === null ? e.hierarchy.emptyLabel ?? "(空)" : String(o))
76
+ labels: a.map((n) => n === null ? e.hierarchy.emptyLabel ?? "(空)" : String(n))
77
77
  };
78
78
  }
79
- function F(e, r) {
79
+ function v(e, r) {
80
80
  const l = [];
81
81
  function t(a) {
82
- for (const o of L(a, e.options.sort?.[a.values.length]))
83
- o.children.size ? (t(o), e.options.subtotals?.includes(o.values.length) && l.push(y(e, o, "subtotal"))) : l.push(y(e, o, "member"));
82
+ for (const n of z(a, e.options.sort?.[a.values.length]))
83
+ n.children.size ? (t(n), e.options.subtotals?.includes(n.values.length) && l.push(w(e, n, "subtotal"))) : l.push(w(e, n, "member"));
84
84
  }
85
- return t(e.root), r && e.leaves && l.push(y(e, e.root, "total")), l;
85
+ return t(e.root), r && e.leaves && l.push(w(e, e.root, "total")), l;
86
86
  }
87
87
  function A(e, r, l) {
88
- const t = M(r, e.fields);
88
+ const t = x(r, e.fields);
89
89
  let a = e.root;
90
90
  for (const c of t) {
91
- const u = a.children.get(c);
92
- if (!u) throw new Error("矩阵维度在预算检查后发生变化");
93
- a = u;
91
+ const i = a.children.get(c);
92
+ if (!i) throw new Error("矩阵维度在预算检查后发生变化");
93
+ a = i;
94
94
  }
95
- const o = l ? a.totalKeys : a.keys;
96
- if (o) return o;
97
- const n = [];
98
- for (let c = a; c; c = c.parent) n[c.values.length] = c.key;
99
- const s = [a.key, ...(e.options.subtotals ?? []).map((c) => n[c])];
95
+ const n = l ? a.totalKeys : a.keys;
96
+ if (n) return n;
97
+ const o = [];
98
+ for (let c = a; c; c = c.parent) o[c.values.length] = c.key;
99
+ const s = [a.key, ...(e.options.subtotals ?? []).map((c) => o[c])];
100
100
  return l ? (s.push(e.root.key), a.totalKeys = s) : a.keys = s, s;
101
101
  }
102
- function R(e, r, l) {
102
+ function j(e, r, l) {
103
103
  if (!(e.kind !== "member" && r > e.depth))
104
104
  return e.kind === "total" ? { key: "total", text: l.totalLabel ?? "合计", rowSpan: 0 } : e.kind === "subtotal" && r === e.depth ? { key: e.key, text: l.subtotalLabel ?? "小计", rowSpan: 0 } : { key: JSON.stringify(e.values.slice(0, r + 1).map((t) => [typeof t, t])), text: e.labels[r], rowSpan: 1 };
105
105
  }
106
- function z(e, r) {
106
+ function O(e, r) {
107
107
  const l = e.columnFields.length + 1, t = e.rowFields.length, a = Array.from({ length: l }, () => Array(t + r.length).fill(null));
108
- for (let o = 0; o < e.columnFields.length; o++) {
109
- let n;
108
+ for (let n = 0; n < e.columnFields.length; n++) {
109
+ let o;
110
110
  r.forEach((s, c) => {
111
- const u = R(s, o, e.hierarchy);
112
- if (!u) {
113
- n = void 0;
111
+ const i = j(s, n, e.hierarchy);
112
+ if (!i) {
113
+ o = void 0;
114
114
  return;
115
115
  }
116
- if (n?.key === u.key) {
117
- n.cell.colSpan = (n.cell.colSpan ?? 1) + 1;
116
+ if (o?.key === i.key) {
117
+ o.cell.colSpan = (o.cell.colSpan ?? 1) + 1;
118
118
  return;
119
119
  }
120
- const i = { text: u.text, rowSpan: u.rowSpan || e.columnFields.length - o, editable: !1, derived: !0 };
121
- a[o][t + c] = i, n = { key: u.key, cell: i };
120
+ const u = { text: i.text, rowSpan: i.rowSpan || e.columnFields.length - n, editable: !1, derived: !0 };
121
+ a[n][t + c] = u, o = { key: i.key, cell: u };
122
122
  });
123
123
  }
124
- return e.rowFields.forEach((o, n) => {
125
- a[0][n] = { text: e.hierarchy.row?.labels?.[n] ?? o, rowSpan: l, editable: !1, derived: !0 };
126
- }), r.forEach((o, n) => {
127
- const s = e.measures[o.measure];
128
- a[l - 1][t + n] = { text: s.label ?? `${s.field} (${s.op})`, editable: !1, derived: !0 };
124
+ return e.rowFields.forEach((n, o) => {
125
+ a[0][o] = { text: e.hierarchy.row?.labels?.[o] ?? n, rowSpan: l, editable: !1, derived: !0 };
126
+ }), r.forEach((n, o) => {
127
+ const s = e.measures[n.measure];
128
+ a[l - 1][t + o] = { text: s.label ?? `${s.field} (${s.op})`, editable: !1, derived: !0 };
129
129
  }), {
130
- cells: a.map((o) => o.filter((n) => n !== null)),
130
+ cells: a.map((n) => n.filter((o) => o !== null)),
131
131
  colWidthsMm: [...e.rowFields.map(() => e.rowWidthMm ?? 40), ...r.map(() => e.columnWidthMm ?? 28)]
132
132
  };
133
133
  }
134
- function v(e, r, l, t) {
135
- const a = +(!!r.totals && e > 0), o = l.expanded + a, n = (t.expanded + a) * r.measures.length + r.rowFields.length;
136
- if (o > (r.maxRows ?? 1e3) || t.expanded + a > (r.maxColumns ?? 200)) throw new Error("矩阵层级展开数量超出预算(包含小计/总计)");
137
- if (o * n > (r.maxCells ?? 2e6)) throw new Error("矩阵输出超出 maxCells 预算");
138
- return { rowCount: o, columnCount: n, cells: o * n };
134
+ function E(e, r, l, t) {
135
+ const a = +(!!r.totals && e > 0), n = l.expanded + a, o = (t.expanded + a) * r.measures.length + r.rowFields.length;
136
+ if (n > (r.maxRows ?? 1e3) || t.expanded + a > (r.maxColumns ?? 200)) throw new Error("矩阵层级展开数量超出预算(包含小计/总计)");
137
+ if (n * o > (r.maxCells ?? 2e6)) throw new Error("矩阵输出超出 maxCells 预算");
138
+ return { rowCount: n, columnCount: o, cells: n * o };
139
139
  }
140
- function $(e, r) {
140
+ function S(e, r) {
141
141
  if (!Array.isArray(e) || e.length > (r.maxInputRows ?? 1e5)) throw new Error("矩阵输入超出预算");
142
- const l = b(r.rowFields, r.hierarchy.row, r.hierarchy), t = b(r.columnFields, r.hierarchy.column, r.hierarchy);
142
+ const l = k(r.rowFields, r.hierarchy.row, r.hierarchy), t = k(r.columnFields, r.hierarchy.column, r.hierarchy);
143
143
  if (e.length * (1 + (l.options.subtotals?.length ?? 0) + +!!r.totals) * (1 + (t.options.subtotals?.length ?? 0) + +!!r.totals) * r.measures.length > (r.maxAggregateUpdates ?? 1e7)) throw new Error("矩阵聚合更新超出 maxAggregateUpdates 预算");
144
- let o = v(0, r, l, t);
145
- for (const n of e) {
146
- if (!n || typeof n != "object" || Array.isArray(n)) throw new Error("矩阵数据行应为对象");
147
- k(l, n), k(t, n), o = v(e.length, r, l, t);
144
+ let n = E(0, r, l, t);
145
+ for (const o of e) {
146
+ if (!o || typeof o != "object" || Array.isArray(o)) throw new Error("矩阵数据行应为对象");
147
+ F(l, o), F(t, o), n = E(e.length, r, l, t);
148
148
  }
149
- return { row: l, column: t, shape: o };
149
+ return { row: l, column: t, shape: n };
150
150
  }
151
- function j(e, r) {
152
- return $(e, r).shape;
151
+ function K(e, r) {
152
+ return S(e, r).shape;
153
153
  }
154
- function O(e, r, l) {
154
+ function I(e, r, l) {
155
155
  const t = /* @__PURE__ */ new Map();
156
156
  for (const a of e) {
157
- const o = A(l.row, a, !!r.totals), n = A(l.column, a, !!r.totals);
158
- for (const s of o) {
157
+ const n = A(l.row, a, !!r.totals), o = A(l.column, a, !!r.totals);
158
+ for (const s of n) {
159
159
  let c = t.get(s);
160
160
  c || (c = /* @__PURE__ */ new Map(), t.set(s, c));
161
- for (const u of n) {
162
- let i = c.get(u);
163
- i || (i = r.measures.map((f) => m({ ...f, field: f.valueField ?? f.field })), c.set(u, i)), i.forEach((f) => f.add(a));
161
+ for (const i of o) {
162
+ let u = c.get(i);
163
+ u || (u = r.measures.map((f) => g({ ...f, field: f.valueField ?? f.field })), c.set(i, u)), u.forEach((f) => f.add(a));
164
164
  }
165
165
  }
166
166
  }
167
167
  return t;
168
168
  }
169
- function p(e, r) {
170
- return e.flatMap((l, t) => r.measures.map((a, o) => ({
169
+ function H(e, r) {
170
+ return e.flatMap((l, t) => r.measures.map((a, n) => ({
171
171
  ...l,
172
- field: l.kind === "total" ? `total_${o}` : `c${t}_${o}`,
173
- measure: o,
172
+ field: l.kind === "total" ? `total_${n}` : `c${t}_${n}`,
173
+ measure: n,
174
174
  measureField: a.field,
175
175
  valueField: a.valueField ?? a.field,
176
176
  operation: a.op
177
177
  })));
178
178
  }
179
- function K(e, r) {
179
+ function _(e, r) {
180
180
  return e.kind === "total" ? r.hierarchy.totalLabel ?? "合计" : [...e.labels, ...e.kind === "subtotal" ? [r.hierarchy.subtotalLabel ?? "小计"] : []].join(" / ");
181
181
  }
182
- function H(e, r) {
182
+ function J(e, r) {
183
183
  return [
184
184
  ...r.rowFields.map((l, t) => ({ field: `r${t}`, header: r.hierarchy.row?.labels?.[t] ?? l, semanticRole: "dimension" })),
185
185
  ...e.map((l) => {
186
186
  const t = r.measures[l.measure];
187
187
  return {
188
188
  field: l.field,
189
- header: `${K(l, r)} · ${t.label ?? `${t.field} (${t.op})`}`,
189
+ header: `${_(l, r)} · ${t.label ?? `${t.field} (${t.op})`}`,
190
190
  semanticRole: "measure",
191
191
  ...t.digits === void 0 ? {} : { format: { kind: "number", digits: t.digits } }
192
192
  };
193
193
  })
194
194
  ];
195
195
  }
196
- function I(e, r, l, t) {
196
+ function W(e, r, l, t) {
197
197
  return e.map((a) => {
198
- const o = {};
199
- l.rowFields.forEach((n, s) => {
200
- o[`r${s}`] = a.kind === "total" ? s === 0 ? l.hierarchy.totalLabel ?? "合计" : null : a.labels[s] ?? (s === a.depth ? l.hierarchy.subtotalLabel ?? "小计" : null);
198
+ const n = {};
199
+ l.rowFields.forEach((o, s) => {
200
+ n[`r${s}`] = a.kind === "total" ? s === 0 ? l.hierarchy.totalLabel ?? "合计" : null : a.labels[s] ?? (s === a.depth ? l.hierarchy.subtotalLabel ?? "小计" : null);
201
201
  });
202
- for (const n of r) o[n.field] = t.get(a.key)?.get(n.key)?.[n.measure]?.value() ?? (l.measures[n.measure].op === "count" ? 0 : null);
203
- return o;
202
+ for (const o of r) n[o.field] = t.get(a.key)?.get(o.key)?.[o.measure]?.value() ?? (l.measures[o.measure].op === "count" ? 0 : null);
203
+ return n;
204
204
  });
205
205
  }
206
- function _(e, r) {
207
- const l = $(e, r), t = F(l.row, !!r.totals), a = p(F(l.column, !!r.totals), r), o = O(e, r, l);
208
- return { columns: H(a, r), rows: I(t, a, r, o), headerGrid: z(r, a), metadata: {
206
+ function P(e, r) {
207
+ const l = S(e, r), t = v(l.row, !!r.totals), a = H(v(l.column, !!r.totals), r), n = I(e, r, l);
208
+ return { columns: J(a, r), rows: W(t, a, r, n), headerGrid: O(r, a), metadata: {
209
209
  rowFields: [...r.rowFields],
210
210
  rowLabels: [...r.hierarchy.row?.labels ?? r.rowFields],
211
211
  columnFields: [...r.columnFields],
@@ -214,7 +214,7 @@ function _(e, r) {
214
214
  columns: a
215
215
  } };
216
216
  }
217
- function w(e, r) {
217
+ function m(e, r) {
218
218
  const l = r.map(
219
219
  (t) => Object.prototype.hasOwnProperty.call(e, t) ? e[t] : null
220
220
  );
@@ -222,12 +222,19 @@ function w(e, r) {
222
222
  (t) => t != null && typeof t != "string" && typeof t != "boolean" && !(typeof t == "number" && Number.isFinite(t))
223
223
  ))
224
224
  throw new Error("矩阵维度必须是有限 JSON 标量");
225
- return {
226
- key: JSON.stringify(l.map((t) => [typeof t, t ?? null])),
227
- label: l.map((t) => t == null ? "" : String(t)).join(" / ")
228
- };
225
+ return l;
226
+ }
227
+ function y(e) {
228
+ return JSON.stringify(e.map((r) => [typeof r, r ?? null]));
229
229
  }
230
- function J(e) {
230
+ function M(e, r, l) {
231
+ const t = m(e, r), a = y(t), n = l.get(a);
232
+ if (n) return n;
233
+ if (!l.has(a)) throw new Error("矩阵维度在预算检查后发生变化");
234
+ const o = { key: a, label: t.map((s) => s == null ? "" : String(s)).join(" / ") };
235
+ return l.set(a, o), o;
236
+ }
237
+ function T(e) {
231
238
  for (const r of [
232
239
  "maxRows",
233
240
  "maxColumns",
@@ -241,19 +248,19 @@ function J(e) {
241
248
  if (e[r] !== void 0 && (!Number.isFinite(e[r]) || e[r] <= 0))
242
249
  throw new Error("矩阵列宽应为正数");
243
250
  }
244
- function S(e) {
251
+ function C(e) {
245
252
  if (!e || !Array.isArray(e.rowFields) || !Array.isArray(e.columnFields) || !Array.isArray(e.measures))
246
253
  throw new Error("矩阵需要行维度、列维度和度量数组");
247
254
  for (const l of [e.rowFields, e.columnFields])
248
255
  if (l.some((t) => typeof t != "string" || !t.trim()) || new Set(l).size !== l.length)
249
256
  throw new Error("矩阵维度字段应非空且唯一");
250
- if (J(e), !e.rowFields.length || !e.columnFields.length || e.rowFields.length > 16 || e.columnFields.length > 16)
257
+ if (T(e), !e.rowFields.length || !e.columnFields.length || e.rowFields.length > 16 || e.columnFields.length > 16)
251
258
  throw new Error("矩阵需要 1–16 个行/列维度");
252
259
  if (!e.measures.length || e.measures.length > 32)
253
260
  throw new Error("矩阵需要 1–32 个度量");
254
261
  if (e.measures.map((l) => {
255
262
  if (!l || typeof l != "object") throw new Error("矩阵度量应为对象");
256
- if (m({
263
+ if (g({
257
264
  ...l,
258
265
  field: l.valueField ?? l.field
259
266
  }), l.label !== void 0 && typeof l.label != "string")
@@ -261,58 +268,58 @@ function S(e) {
261
268
  return l.field;
262
269
  }).some((l) => typeof l != "string" || !l.trim()))
263
270
  throw new Error("矩阵度量字段应非空");
264
- e.hierarchy !== void 0 && C(e.hierarchy, e.rowFields, e.columnFields);
271
+ e.hierarchy !== void 0 && R(e.hierarchy, e.rowFields, e.columnFields);
272
+ }
273
+ function U(e, r) {
274
+ return C(r), r.hierarchy ? K(e, r) : N(e, r).shape;
265
275
  }
266
- function W(e, r) {
267
- if (S(r), r.hierarchy) return j(e, r);
276
+ function N(e, r) {
268
277
  if (!Array.isArray(e) || e.length > (r.maxInputRows ?? 1e5))
269
278
  throw new Error("矩阵输入超出预算");
270
- const l = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
271
- for (const n of e) {
272
- if (!n || typeof n != "object" || Array.isArray(n))
279
+ const l = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
280
+ for (const o of e) {
281
+ if (!o || typeof o != "object" || Array.isArray(o))
273
282
  throw new Error("矩阵数据行应为对象");
274
- if (l.add(w(n, r.rowFields).key), t.add(w(n, r.columnFields).key), l.size > (r.maxRows ?? 1e3) || t.size > (r.maxColumns ?? 200))
283
+ if (l.set(y(m(o, r.rowFields)), void 0), t.set(y(m(o, r.columnFields)), void 0), l.size > (r.maxRows ?? 1e3) || t.size > (r.maxColumns ?? 200))
275
284
  throw new Error("矩阵维度数量超出预算");
276
285
  if ((l.size + +!!r.totals) * ((t.size + +!!r.totals) * r.measures.length + 1) > (r.maxCells ?? 2e6))
277
286
  throw new Error("矩阵输出超出 maxCells 预算");
278
287
  }
279
- const a = l.size + +(!!r.totals && e.length > 0), o = (t.size + +!!r.totals) * r.measures.length + 1;
280
- return { rowCount: a, columnCount: o, cells: a * o };
288
+ const a = l.size + +(!!r.totals && e.length > 0), n = (t.size + +!!r.totals) * r.measures.length + 1;
289
+ return { rows: l, columns: t, shape: { rowCount: a, columnCount: n, cells: a * n } };
281
290
  }
282
- function T(e, r) {
283
- if (r?.hierarchy)
284
- return S(r), _(e, r);
285
- W(e, r);
286
- const l = x(e, {
287
- row: (n) => w(n, r.rowFields),
288
- column: (n) => w(n, r.columnFields),
289
- measures: r.measures.map((n) => ({ ...n, field: n.valueField ?? n.field })),
291
+ function V(e, r) {
292
+ if (C(r), r.hierarchy) return P(e, r);
293
+ const l = N(e, r), t = L(e, {
294
+ row: (s) => M(s, r.rowFields, l.rows),
295
+ column: (s) => M(s, r.columnFields, l.columns),
296
+ measures: r.measures.map((s) => ({ ...s, field: s.valueField ?? s.field })),
290
297
  totals: r.totals,
291
298
  check: () => {
292
299
  }
293
- // Cardinality/budgets were checked before allocating accumulators.
294
- }), t = [...l.groups.values()].map((n) => ({ rowLabel: n.label })), a = [{ field: "rowLabel", header: r.rowHeader ?? r.rowFields.join(" / "), semanticRole: "dimension" }], o = { rowLabel: "合计" };
295
- return r.measures.forEach((n, s) => {
296
- const c = [...l.columns.entries()].map(([u, i], f) => ({ key: u, label: i, field: `c${f}_${s}` }));
297
- r.totals && c.push({ key: "", label: "合计", field: `total_${s}` });
298
- for (const u of c) {
299
- const i = u.field === `total_${s}`;
300
- a.push({
300
+ // Only preflight-budgeted member identities reach the shared accumulator.
301
+ }), a = [...t.groups.values()].map((s) => ({ rowLabel: s.label })), n = [{ field: "rowLabel", header: r.rowHeader ?? r.rowFields.join(" / "), semanticRole: "dimension" }], o = { rowLabel: "合计" };
302
+ return r.measures.forEach((s, c) => {
303
+ const i = [...t.columns.entries()].map(([u, f], d) => ({ key: u, label: f, field: `c${d}_${c}` }));
304
+ r.totals && i.push({ key: "", label: "合计", field: `total_${c}` });
305
+ for (const u of i) {
306
+ const f = u.field === `total_${c}`;
307
+ n.push({
301
308
  field: u.field,
302
- header: `${u.label} · ${n.label ?? `${n.field} (${n.op})`}`,
309
+ header: `${u.label} · ${s.label ?? `${s.field} (${s.op})`}`,
303
310
  semanticRole: "measure",
304
- ...n.digits === void 0 ? {} : { format: { kind: "number", digits: n.digits } }
311
+ ...s.digits === void 0 ? {} : { format: { kind: "number", digits: s.digits } }
305
312
  });
306
- let f = 0;
307
- for (const d of l.groups.values())
308
- t[f++][u.field] = (i ? d.totals?.[s] : d.cells.get(u.key)?.[s])?.value() ?? (n.op === "count" ? 0 : null);
309
- o[u.field] = (i ? l.totals?.[s] : l.columnTotals.get(u.key)?.[s])?.value() ?? (n.op === "count" ? 0 : null);
313
+ let d = 0;
314
+ for (const h of t.groups.values())
315
+ a[d++][u.field] = (f ? h.totals?.[c] : h.cells.get(u.key)?.[c])?.value() ?? (s.op === "count" ? 0 : null);
316
+ o[u.field] = (f ? t.totals?.[c] : t.columnTotals.get(u.key)?.[c])?.value() ?? (s.op === "count" ? 0 : null);
310
317
  }
311
- }), r.totals && e.length && t.push(o), { rows: t, columns: a };
318
+ }), r.totals && e.length && a.push(o), { rows: a, columns: n };
312
319
  }
313
320
  export {
314
- x as a,
315
- T as c,
316
- W as e,
317
- S as v
321
+ L as a,
322
+ V as c,
323
+ U as e,
324
+ C as v
318
325
  };
@@ -0,0 +1 @@
1
+ "use strict";const g=require("./computed-8nFyVnok.cjs");function x(e,r){const t=()=>r.measures.map(c=>g.createAggregateAccumulator(c)),l=new Map,a=new Map,n=new Map,o=r.totals?t():void 0,s=(c,i)=>c?.forEach(u=>u.add(i));for(const c of e){const i=r.row(c),u=r.column(c);a.has(u.key)||a.set(u.key,u.label);let f=l.get(i.key);f||(f={label:i.label,cells:new Map,...r.totals?{totals:t()}:{}},l.set(i.key,f)),r.check(l.size,a.size);let d=f.cells.get(u.key);if(d||(d=t(),f.cells.set(u.key,d)),s(d,c),!r.totals)continue;let h=n.get(u.key);h||(h=t(),n.set(u.key,h)),s(f.totals,c),s(h,c),s(o,c)}return{groups:l,columns:a,columnTotals:n,totals:o}}function S(e,r){return JSON.stringify([e.slice(0,r.length),r.map(t=>[t===null?"null":typeof t,t])])}function C(e,r){return r.map(t=>{const l=Object.prototype.hasOwnProperty.call(e,t)?e[t]:null;if(l==null)return null;if(typeof l=="string"||typeof l=="boolean"||typeof l=="number"&&Number.isFinite(l))return l;throw new Error("矩阵维度必须是有限 JSON 标量")})}function R(e,r,t){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("矩阵层级应为对象");for(const l of[e.emptyLabel,e.subtotalLabel,e.totalLabel])if(l!==void 0&&typeof l!="string")throw new Error("矩阵层级标签应为字符串");k(e.row,r.length),k(e.column,t.length)}function k(e,r){if(e!==void 0){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("矩阵轴配置应为对象");if(e.labels!==void 0&&(!Array.isArray(e.labels)||e.labels.length!==r||e.labels.some(t=>typeof t!="string")))throw new Error("矩阵维度标签必须与维度字段一一对应");if(e.sort!==void 0&&(!Array.isArray(e.sort)||e.sort.length>r||e.sort.some(t=>!["source","asc","desc"].includes(t))))throw new Error("矩阵维度排序应为 source、asc 或 desc");if(e.subtotals!==void 0&&(!Array.isArray(e.subtotals)||new Set(e.subtotals).size!==e.subtotals.length||e.subtotals.some(t=>!Number.isInteger(t)||t<1||t>=r)))throw new Error("矩阵小计深度应唯一且位于 1 至末级之前")}}function v(e,r,t){return{fields:e,options:r??{},hierarchy:t,root:{key:S(e,[]),values:[],children:new Map},leaves:0,expanded:0}}function A(e,r){const t=C(r,e.fields);let l=e.root;for(let a=1;a<=t.length;a++){const n=t[a-1];let o=l.children.get(n);if(!o){const s=t.slice(0,a);o={key:S(e.fields,s),values:s,children:new Map,parent:l},l.children.set(n,o),a===t.length?(e.leaves++,e.expanded++):e.options.subtotals?.includes(a)&&e.expanded++}l=o}}function p(e,r){if(e===r)return 0;if(e===null)return-1;if(r===null)return 1;if(typeof e=="number"&&typeof r=="number")return e-r;const t=`${typeof e}:${e}`,l=`${typeof r}:${r}`;return t<l?-1:1}function z(e,r){const t=[...e.children.values()];return r&&r!=="source"&&t.sort((l,a)=>p(l.values[l.values.length-1],a.values[a.values.length-1])*(r==="desc"?-1:1)),t}function w(e,r,t){const{key:l,values:a}=r;return{key:l,kind:t,depth:a.length,fields:e.fields.slice(0,a.length),values:a,labels:a.map(n=>n===null?e.hierarchy.emptyLabel??"(空)":String(n))}}function F(e,r){const t=[];function l(a){for(const n of z(a,e.options.sort?.[a.values.length]))n.children.size?(l(n),e.options.subtotals?.includes(n.values.length)&&t.push(w(e,n,"subtotal"))):t.push(w(e,n,"member"))}return l(e.root),r&&e.leaves&&t.push(w(e,e.root,"total")),t}function E(e,r,t){const l=C(r,e.fields);let a=e.root;for(const c of l){const i=a.children.get(c);if(!i)throw new Error("矩阵维度在预算检查后发生变化");a=i}const n=t?a.totalKeys:a.keys;if(n)return n;const o=[];for(let c=a;c;c=c.parent)o[c.values.length]=c.key;const s=[a.key,...(e.options.subtotals??[]).map(c=>o[c])];return t?(s.push(e.root.key),a.totalKeys=s):a.keys=s,s}function O(e,r,t){if(!(e.kind!=="member"&&r>e.depth))return e.kind==="total"?{key:"total",text:t.totalLabel??"合计",rowSpan:0}:e.kind==="subtotal"&&r===e.depth?{key:e.key,text:t.subtotalLabel??"小计",rowSpan:0}:{key:JSON.stringify(e.values.slice(0,r+1).map(l=>[typeof l,l])),text:e.labels[r],rowSpan:1}}function j(e,r){const t=e.columnFields.length+1,l=e.rowFields.length,a=Array.from({length:t},()=>Array(l+r.length).fill(null));for(let n=0;n<e.columnFields.length;n++){let o;r.forEach((s,c)=>{const i=O(s,n,e.hierarchy);if(!i){o=void 0;return}if(o?.key===i.key){o.cell.colSpan=(o.cell.colSpan??1)+1;return}const u={text:i.text,rowSpan:i.rowSpan||e.columnFields.length-n,editable:!1,derived:!0};a[n][l+c]=u,o={key:i.key,cell:u}})}return e.rowFields.forEach((n,o)=>{a[0][o]={text:e.hierarchy.row?.labels?.[o]??n,rowSpan:t,editable:!1,derived:!0}}),r.forEach((n,o)=>{const s=e.measures[n.measure];a[t-1][l+o]={text:s.label??`${s.field} (${s.op})`,editable:!1,derived:!0}}),{cells:a.map(n=>n.filter(o=>o!==null)),colWidthsMm:[...e.rowFields.map(()=>e.rowWidthMm??40),...r.map(()=>e.columnWidthMm??28)]}}function M(e,r,t,l){const a=+(!!r.totals&&e>0),n=t.expanded+a,o=(l.expanded+a)*r.measures.length+r.rowFields.length;if(n>(r.maxRows??1e3)||l.expanded+a>(r.maxColumns??200))throw new Error("矩阵层级展开数量超出预算(包含小计/总计)");if(n*o>(r.maxCells??2e6))throw new Error("矩阵输出超出 maxCells 预算");return{rowCount:n,columnCount:o,cells:n*o}}function N(e,r){if(!Array.isArray(e)||e.length>(r.maxInputRows??1e5))throw new Error("矩阵输入超出预算");const t=v(r.rowFields,r.hierarchy.row,r.hierarchy),l=v(r.columnFields,r.hierarchy.column,r.hierarchy);if(e.length*(1+(t.options.subtotals?.length??0)+ +!!r.totals)*(1+(l.options.subtotals?.length??0)+ +!!r.totals)*r.measures.length>(r.maxAggregateUpdates??1e7))throw new Error("矩阵聚合更新超出 maxAggregateUpdates 预算");let n=M(0,r,t,l);for(const o of e){if(!o||typeof o!="object"||Array.isArray(o))throw new Error("矩阵数据行应为对象");A(t,o),A(l,o),n=M(e.length,r,t,l)}return{row:t,column:l,shape:n}}function K(e,r){return N(e,r).shape}function I(e,r,t){const l=new Map;for(const a of e){const n=E(t.row,a,!!r.totals),o=E(t.column,a,!!r.totals);for(const s of n){let c=l.get(s);c||(c=new Map,l.set(s,c));for(const i of o){let u=c.get(i);u||(u=r.measures.map(f=>g.createAggregateAccumulator({...f,field:f.valueField??f.field})),c.set(i,u)),u.forEach(f=>f.add(a))}}}return l}function H(e,r){return e.flatMap((t,l)=>r.measures.map((a,n)=>({...t,field:t.kind==="total"?`total_${n}`:`c${l}_${n}`,measure:n,measureField:a.field,valueField:a.valueField??a.field,operation:a.op})))}function T(e,r){return e.kind==="total"?r.hierarchy.totalLabel??"合计":[...e.labels,...e.kind==="subtotal"?[r.hierarchy.subtotalLabel??"小计"]:[]].join(" / ")}function _(e,r){return[...r.rowFields.map((t,l)=>({field:`r${l}`,header:r.hierarchy.row?.labels?.[l]??t,semanticRole:"dimension"})),...e.map(t=>{const l=r.measures[t.measure];return{field:t.field,header:`${T(t,r)} · ${l.label??`${l.field} (${l.op})`}`,semanticRole:"measure",...l.digits===void 0?{}:{format:{kind:"number",digits:l.digits}}}})]}function J(e,r,t,l){return e.map(a=>{const n={};t.rowFields.forEach((o,s)=>{n[`r${s}`]=a.kind==="total"?s===0?t.hierarchy.totalLabel??"合计":null:a.labels[s]??(s===a.depth?t.hierarchy.subtotalLabel??"小计":null)});for(const o of r)n[o.field]=l.get(a.key)?.get(o.key)?.[o.measure]?.value()??(t.measures[o.measure].op==="count"?0:null);return n})}function P(e,r){const t=N(e,r),l=F(t.row,!!r.totals),a=H(F(t.column,!!r.totals),r),n=I(e,r,t);return{columns:_(a,r),rows:J(l,a,r,n),headerGrid:j(r,a),metadata:{rowFields:[...r.rowFields],rowLabels:[...r.hierarchy.row?.labels??r.rowFields],columnFields:[...r.columnFields],columnLabels:[...r.hierarchy.column?.labels??r.columnFields],rows:l,columns:a}}}function m(e,r){const t=r.map(l=>Object.prototype.hasOwnProperty.call(e,l)?e[l]:null);if(t.some(l=>l!=null&&typeof l!="string"&&typeof l!="boolean"&&!(typeof l=="number"&&Number.isFinite(l))))throw new Error("矩阵维度必须是有限 JSON 标量");return t}function y(e){return JSON.stringify(e.map(r=>[typeof r,r??null]))}function $(e,r,t){const l=m(e,r),a=y(l),n=t.get(a);if(n)return n;if(!t.has(a))throw new Error("矩阵维度在预算检查后发生变化");const o={key:a,label:l.map(s=>s==null?"":String(s)).join(" / ")};return t.set(a,o),o}function W(e){for(const r of["maxRows","maxColumns","maxInputRows","maxCells","maxAggregateUpdates"])if(e[r]!==void 0&&(!Number.isSafeInteger(e[r])||e[r]<1))throw new Error("矩阵预算应为正安全整数");for(const r of["columnWidthMm","rowWidthMm"])if(e[r]!==void 0&&(!Number.isFinite(e[r])||e[r]<=0))throw new Error("矩阵列宽应为正数")}function b(e){if(!e||!Array.isArray(e.rowFields)||!Array.isArray(e.columnFields)||!Array.isArray(e.measures))throw new Error("矩阵需要行维度、列维度和度量数组");for(const t of[e.rowFields,e.columnFields])if(t.some(l=>typeof l!="string"||!l.trim())||new Set(t).size!==t.length)throw new Error("矩阵维度字段应非空且唯一");if(W(e),!e.rowFields.length||!e.columnFields.length||e.rowFields.length>16||e.columnFields.length>16)throw new Error("矩阵需要 1–16 个行/列维度");if(!e.measures.length||e.measures.length>32)throw new Error("矩阵需要 1–32 个度量");if(e.measures.map(t=>{if(!t||typeof t!="object")throw new Error("矩阵度量应为对象");if(g.createAggregateAccumulator({...t,field:t.valueField??t.field}),t.label!==void 0&&typeof t.label!="string")throw new Error("矩阵度量标签应为字符串");return t.field}).some(t=>typeof t!="string"||!t.trim()))throw new Error("矩阵度量字段应非空");e.hierarchy!==void 0&&R(e.hierarchy,e.rowFields,e.columnFields)}function D(e,r){return b(r),r.hierarchy?K(e,r):L(e,r).shape}function L(e,r){if(!Array.isArray(e)||e.length>(r.maxInputRows??1e5))throw new Error("矩阵输入超出预算");const t=new Map,l=new Map;for(const o of e){if(!o||typeof o!="object"||Array.isArray(o))throw new Error("矩阵数据行应为对象");if(t.set(y(m(o,r.rowFields)),void 0),l.set(y(m(o,r.columnFields)),void 0),t.size>(r.maxRows??1e3)||l.size>(r.maxColumns??200))throw new Error("矩阵维度数量超出预算");if((t.size+ +!!r.totals)*((l.size+ +!!r.totals)*r.measures.length+1)>(r.maxCells??2e6))throw new Error("矩阵输出超出 maxCells 预算")}const a=t.size+ +(!!r.totals&&e.length>0),n=(l.size+ +!!r.totals)*r.measures.length+1;return{rows:t,columns:l,shape:{rowCount:a,columnCount:n,cells:a*n}}}function U(e,r){if(b(r),r.hierarchy)return P(e,r);const t=L(e,r),l=x(e,{row:s=>$(s,r.rowFields,t.rows),column:s=>$(s,r.columnFields,t.columns),measures:r.measures.map(s=>({...s,field:s.valueField??s.field})),totals:r.totals,check:()=>{}}),a=[...l.groups.values()].map(s=>({rowLabel:s.label})),n=[{field:"rowLabel",header:r.rowHeader??r.rowFields.join(" / "),semanticRole:"dimension"}],o={rowLabel:"合计"};return r.measures.forEach((s,c)=>{const i=[...l.columns.entries()].map(([u,f],d)=>({key:u,label:f,field:`c${d}_${c}`}));r.totals&&i.push({key:"",label:"合计",field:`total_${c}`});for(const u of i){const f=u.field===`total_${c}`;n.push({field:u.field,header:`${u.label} · ${s.label??`${s.field} (${s.op})`}`,semanticRole:"measure",...s.digits===void 0?{}:{format:{kind:"number",digits:s.digits}}});let d=0;for(const h of l.groups.values())a[d++][u.field]=(f?h.totals?.[c]:h.cells.get(u.key)?.[c])?.value()??(s.op==="count"?0:null);o[u.field]=(f?l.totals?.[c]:l.columnTotals.get(u.key)?.[c])?.value()??(s.op==="count"?0:null)}}),r.totals&&e.length&&a.push(o),{rows:a,columns:n}}exports.accumulatePivotRows=x;exports.createMatrixTable=U;exports.estimateMatrixTable=D;exports.validateMatrixOptions=b;
@@ -0,0 +1 @@
1
+ "use strict";const d=require("./diagnostic-collector-DwMJWEHo.cjs");function I(e,t){d.assertOutputActive(t.signal),d.observeOutput(()=>t.onDiagnostic?.(e)),d.assertOutputActive(t.signal)}class O extends Error{constructor(t,i){super(`Output contains ${i?.total??t.length} known fidelity issue(s): ${t[0]?.code??Object.keys(i?.counts??{})[0]??"unknown"}`),this.diagnostics=t,this.diagnosticSummary=i,this.code="output-fidelity",this.name="OutputFidelityError"}}const B=new Set(["text","rect","line","ellipse"]),A=new Set(["image","chart","barcode","qrcode"]);function N(e,t){if(!e.grid){if(d.isImageBackedComponent(e))return(t==="pdf"||t==="xlsx")&&!/^data:image\/(png|jpe?g);base64,/i.test(e.imageData)?{code:"unsupported-image-format",message:`${t.toUpperCase()} accepts PNG or JPEG data URLs; convert this image before exporting.`}:void 0;if(A.has(e.kind))return{code:"missing-image",message:`${e.kind} requires imageData or a renderer adapter before output.`};if(!B.has(e.kind))return{code:"unsupported-component",message:`Unsupported component kind: ${e.kind}.`};if(t==="xlsx"&&e.kind!=="text")return{code:"unsupported-component",message:`XLSX data export omits ${e.kind} geometry.`}}}function h(e,t,i,n,r){const a=Object.getOwnPropertyDescriptor(e,"meta")?.value,o=a&&Object.getOwnPropertyDescriptor(a,"componentExtension")?.value,c=o&&Object.getOwnPropertyDescriptor(o,"id")?.value,s=o&&Object.getOwnPropertyDescriptor(o,"version")?.value,u=typeof c=="string"&&c.length<=128&&typeof s=="string"&&s.length<=64?{id:c,version:s}:void 0;return{...r,severity:"warning",format:t,pageIndex:i,componentIndex:n,kind:e.kind,nid:e.nid,...u?{extension:u}:{}}}function T(e,t){const i=[];return e.rotateDeg&&(t||!Number.isFinite(e.rotateDeg))&&i.push("rotateDeg"),e.opacity!==void 0&&e.opacity!==1&&(t||!Number.isFinite(e.opacity)||e.opacity<0||e.opacity>1)&&i.push("opacity"),i}function x(e,t,i=!1){if(!e||t==="dom")return;const n=t==="pdf"?T(e,i):[];return t!=="pdf"&&(e.rotateDeg&&n.push("rotateDeg"),e.opacity!==void 0&&e.opacity!==1&&n.push("opacity"),t!=="xlsx"&&e.align==="justify"&&n.push("justify")),t==="xlsx"&&e.letterSpacing&&n.push("letterSpacing"),n.length?`${t} does not preserve these styles: ${n.join(", ")}.`:void 0}function S(e){if(!e)return;const t=["backgroundColor","align","verticalAlign","lineHeight","borderTop","borderRight","borderBottom","borderLeft","borderColor","lineColor","lineWidthPt"].filter(i=>e[i]!==void 0);return t.length?`XLSX rich text does not retain independent run styles: ${t.join(", ")}.`:void 0}function X(e){if(e.kind!=="text")return;const t=S(e.style);if(e.leftMm||e.topMm||t)return{code:"unsupported-style",message:`Nested XLSX text is retained as rich text in component order; absolute child offsets and independent paragraph styles are not retained.${t?` ${t}`:""}`}}function P(e,t,i,n,r,a){const o=c=>{r.push({...h(e,t,i,n,{code:"unsupported-style",message:c}),componentPath:a})};for(const c of e.richParagraphs??[]){t==="xlsx"&&(c.spaceBeforeMm||c.spaceAfterMm||c.indentMm||c.align||c.lineHeight)&&o("XLSX rich text preserves fonts and paragraph newlines; paragraph spacing, indentation and alignment are not retained.");const s=x({align:c.align},t);s&&o(s);for(const u of c.segments){const g=x(u.style,t,!0)??(t==="xlsx"?S(u.style):void 0);g&&o(g)}}}function C(e,t,i,n,r,a,o){if(o.has(e))return;const c=new Set(o).add(e),s=N(e,t);s&&a.push({...h(e,t,i,n,s),componentPath:r});const u=x(e.style,t);u&&a.push({...h(e,t,i,n,{code:"unsupported-style",message:u}),componentPath:r}),P(e,t,i,n,a,r),J(e,t,i,n,r,a,c)}function U(e){return e.grid?{code:"nested-components-omitted",message:"XLSX cannot place a nested grid inside a single cell; the nested grid is omitted."}:X(e)}function R(e){let t;return(i,n,r,a)=>{const o=U(i);if(o||!d.isImageBackedComponent(i))return o;t??=new Map(d.resolveGridLayout(e.grid,e.widthMm,e.heightMm).cells.map(l=>[`${l.ri}:${l.ci}`,l]));const c=t.get(`${n}:${r}`),s=2*(e.grid?.paddingMm??.5),u=(c?.widthMm??0)-s-(a?.indentMm??0),g=(c?.heightMm??0)-s;if(i.leftMm<0||i.topMm<0||i.leftMm+i.widthMm>u+.001||i.topMm+i.heightMm>g+.001)return{code:"unsupported-style",message:"XLSX cannot clip a child image to a cell; it retains the original image dimensions."}}}function J(e,t,i,n,r,a,o){const c=R(e);for(const[s,u]of(e.grid?.cells??[]).entries())for(const[g,l]of u.entries()){l?.dataBar!==void 0&&!d.validDataBar(l.dataBar)&&a.push({...h(e,t,i,n,{code:"unsupported-style",message:"Invalid resolved data-bar geometry or color; visual data bars require ordered 0–1 ratios and #RRGGBB colors."}),componentPath:[...r,s,g]});const D=x(l?.style,t);D&&a.push({...h(e,t,i,n,{code:"unsupported-style",message:D}),componentPath:[...r,s,g]}),l?.richParagraphs?.length&&P({...e,richParagraphs:l.richParagraphs},t,i,n,a,[...r,s,g]);for(const[j,m]of(l?.children??[]).entries()){const M=[...r,s,g,j];if(t==="xlsx"){const E=c(m,s,g,l);if(E&&a.push({...h(m,t,i,n,E),componentPath:M}),m.grid)continue}C(m,t,i,n,M,a,o)}}}function w(e,t,i){d.assertBoundedRenderTree(e),e.pages.forEach((n,r)=>n.components.forEach((a,o)=>C(a,t,r,o,[],i,new Set)))}function F(e,t){const i=[];return w(e,t,i),i}function _(e,t,i=d.DEFAULT_DIAGNOSTIC_LIMIT){const n=d.createDiagnosticCollector(i);return w(e,t,n),n.snapshot()}function k(e,t,i,n){d.assertOutputActive(i.signal);const r=d.createDiagnosticCollector(i.diagnosticLimit);n?.diagnosticSummary?r.merge(n.diagnosticSummary):n?.diagnostics.forEach(s=>r.push(s));const a=r.entries.length,o=i.diagnosticLimit===void 0?void 0:new Set(r.entries);if(w(e,t,{push:s=>{d.assertOutputActive(i.signal),r.push(s)}}),(o?r.entries.filter(s=>!o.has(s)):r.entries.slice(a)).forEach(s=>I(s,i)),i.fidelity==="strict"&&r.total)throw new O(r.entries,i.diagnosticLimit===void 0?void 0:r.snapshot());return r}function q(e,t,i){return k(e,t,i).entries}class b extends Error{constructor(t,i){super(i),this.code=t,this.name="ImageMediaError"}}const y={maxImageBytes:16*1024*1024,maxTotalImageBytes:32*1024*1024,maxImages:1e3,maxImagePixels:16e6,maxTotalImagePixels:64e6,maxImageDimension:16384};function p(e){throw new b("invalid-image-data",e)}function f(e){throw new b("image-budget-exceeded",e)}function $(e){const t={...y};for(const i of Object.keys(y)){const n=e[i]??y[i];if(!Number.isSafeInteger(n)||n<=0||n>2147483647)throw new RangeError(`${i} 图片预算须为1至2147483647的整数。`);t[i]=n}return t}function z(e){if(e.length<33||![137,80,78,71,13,10,26,10].every((i,n)=>e[n]===i))return p("图片内容与 PNG/JPEG 类型不一致。");const t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.getUint32(8)!==13||String.fromCharCode(...e.subarray(12,16))!=="IHDR"?p("PNG must begin with an IHDR header."):[t.getUint32(16),t.getUint32(20)]}const H=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);function W(e){if(e[0]!==255||e[1]!==216)return p("图片内容与 PNG/JPEG 类型不一致。");let t=2;for(;t+3<e.length;){if(e[t++]!==255)return p("JPEG marker is malformed.");for(;e[t]===255;)t++;const i=e[t++];if(i===217||i===218)break;if(i===1||i>=208&&i<=215)continue;const n=e[t]*256+e[t+1];if(n<2||t+n>e.length)return p("JPEG segment exceeds its data boundary.");if(H.has(i))return n<8?p("JPEG frame header is incomplete."):[e[t+5]*256+e[t+6],e[t+3]*256+e[t+4]];t+=n}return p("JPEG has no supported dimension header.")}function G(e,t){if(e.length>Math.ceil(t.maxImageBytes/3)*4+64)return f("单张图片超过字节预算。");const i=/^data:image\/(png|jpe?g);base64,([A-Za-z0-9+/]+={0,2})$/i.exec(e);if(!i||i[2].length%4)return p("Image must contain valid PNG/JPEG base64 data.");const n=i[2],r=n.length/4*3-(n.endsWith("==")?2:n.endsWith("=")?1:0);if(r>t.maxImageBytes)return f("单张图片超过字节预算。");const a=i[1].toLowerCase()==="png"?"png":"jpeg";return{encoded:n,byteLength:r,extension:a}}function v(e,t){const i=atob(e),n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=i.charCodeAt(r);return n}function L(e,t,i){const[n,r]=t==="png"?z(e):W(e);return!n||!r?p("Image dimensions must be positive."):n>i.maxImageDimension||r>i.maxImageDimension||n*r>i.maxImagePixels?f("Image exceeds its decoded dimension or pixel budget."):[n,r]}function K(e,t){const{encoded:i,byteLength:n,extension:r}=G(e,t),a=v(i,n),[o,c]=L(a,r,t);return{dataUrl:`data:image/${r};base64,${i}`,bytes:a,extension:r,width:o,height:c}}function V(e){const t=$({}),{encoded:i,byteLength:n,extension:r}=G(e,t),a=r==="png"?v(i.slice(0,44),Math.min(n,33)):v(i,n),[o,c]=L(a,r,t);return{dataUrl:`data:image/${r};base64,${i}`,extension:r,width:o,height:c,byteLength:n}}function Z(e={}){const t=$(e),i=new Map;let n=0,r=0;return a=>{const o=a.replace(/^data:image\/(png|jpe?g);base64,/i,(u,g)=>`data:image/${g.toLowerCase()==="png"?"png":"jpeg"};base64,`),c=i.get(o);if(c)return c;if(i.size>=t.maxImages)return f("唯一图片数量超过预算。");const s=K(a,t);return n+s.bytes.length>t.maxTotalImageBytes||r+s.width*s.height>t.maxTotalImagePixels?f("图片总字节或总像素超过预算。"):(n+=s.bytes.length,r+=s.width*s.height,i.set(o,s),s)}}exports.ImageMediaError=b;exports.OutputFidelityError=O;exports.collectOutputDiagnostics=k;exports.createImageMediaInspector=Z;exports.inspectImageMediaMetadata=V;exports.inspectOutputCapabilities=F;exports.inspectOutputCapabilitiesSummary=_;exports.notifyOutputDiagnostic=I;exports.reportOutputDiagnostics=q;