@agile-team/mach-report 2.9.1 → 2.11.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 (115) hide show
  1. package/README.md +11 -7
  2. package/dist/ExcelBindingWizard-CjIiVox-.cjs +1 -0
  3. package/dist/ExcelBindingWizard-Dxm-K5HL.js +1240 -0
  4. package/dist/ParamEditor-D-Hf5xfO.cjs +1 -0
  5. package/dist/ParamEditor-DRGxzxeO.js +381 -0
  6. package/dist/ReportBatchPanel-BYgg0EDB.cjs +1 -0
  7. package/dist/ReportBatchPanel-Bby5yLzU.js +287 -0
  8. package/dist/ReportPreview-DWXROHBP.cjs +6 -0
  9. package/dist/ReportPreview-DiNXhQI0.js +4138 -0
  10. package/dist/ReportTemplateLibrary-C6CO7YCT.cjs +1 -0
  11. package/dist/ReportTemplateLibrary-DfzDXRvr.js +260 -0
  12. package/dist/RuleEditor-C2QsOHOs.cjs +1 -0
  13. package/dist/RuleEditor-D9wQHrkf.js +2024 -0
  14. package/dist/TemplateReviewPanel-BKofGrV9.js +222 -0
  15. package/dist/TemplateReviewPanel-DwtOcLue.cjs +1 -0
  16. package/dist/analytics.cjs +1 -1
  17. package/dist/analytics.d.cts +4 -0
  18. package/dist/analytics.d.ts +4 -0
  19. package/dist/analytics.js +40 -39
  20. package/dist/{assets-ahTRUXRk.cjs → assets-Bu6UohJx.cjs} +1 -1
  21. package/dist/{assets-DDsfEi8R.js → assets-DegqDNqY.js} +1 -1
  22. package/dist/batch-Bt3Fd27Z.cjs +1 -0
  23. package/dist/batch-mRqhhhjt.js +364 -0
  24. package/dist/{capabilities-Cm9hZ3uV.js → capabilities-CK_7hizc.js} +16 -16
  25. package/dist/capabilities-CsZ-pNHR.cjs +1 -0
  26. package/dist/computed-Bvk0W15F.js +521 -0
  27. package/dist/computed-CGV2a809.cjs +1 -0
  28. package/dist/config-B612mw0x.js +525 -0
  29. package/dist/config-BRoLo2oj.cjs +1 -0
  30. package/dist/designer.cjs +2 -2
  31. package/dist/designer.d.cts +695 -50
  32. package/dist/designer.d.ts +695 -50
  33. package/dist/designer.js +2213 -1748
  34. package/dist/index.cjs +8 -8
  35. package/dist/index.d.cts +205 -6
  36. package/dist/index.d.ts +205 -6
  37. package/dist/index.js +808 -1033
  38. package/dist/injection-keys-Db_DyLkm.cjs +1 -0
  39. package/dist/injection-keys-e85udZCp.js +7 -0
  40. package/dist/list-cell-BuYn4tGF.cjs +1 -0
  41. package/dist/list-cell-ClFra1zS.js +173 -0
  42. package/dist/matrix-DVyWiYsd.cjs +1 -0
  43. package/dist/matrix-yZsGnldA.js +227 -0
  44. package/dist/param-validation-BlHHXs6u.js +153 -0
  45. package/dist/param-validation-DCK039V1.cjs +1 -0
  46. package/dist/pdf.cjs +49 -49
  47. package/dist/pdf.d.cts +31 -1
  48. package/dist/pdf.d.ts +31 -1
  49. package/dist/pdf.js +4797 -4650
  50. package/dist/plugin-BDTU4D94.cjs +1 -0
  51. package/dist/plugin-Cd5G2QQn.js +22 -0
  52. package/dist/region-binding-workflow-CXDmt9Bs.js +977 -0
  53. package/dist/region-binding-workflow-DhQvu1co.cjs +3 -0
  54. package/dist/{report-params-B_VCihAh.js → report-params-B44imUd4.js} +1 -1
  55. package/dist/{report-params-CjWrjPl6.cjs → report-params-SJfhKgaX.cjs} +1 -1
  56. package/dist/server/node.d.cts +48 -5
  57. package/dist/server/node.d.ts +48 -5
  58. package/dist/server-node.cjs +1 -1
  59. package/dist/server-node.js +503 -317
  60. package/dist/server.cjs +1 -1
  61. package/dist/server.d.cts +252 -4
  62. package/dist/server.d.ts +252 -4
  63. package/dist/server.js +567 -469
  64. package/dist/style.css +1 -1
  65. package/dist/template-registry-WNXdkiET.js +506 -0
  66. package/dist/template-registry-ukBGlm8N.cjs +1 -0
  67. package/dist/template-review-BXp2oyqg.cjs +1 -0
  68. package/dist/template-review-BdcXSYbx.js +1616 -0
  69. package/dist/tree-BX380Rr7.cjs +1 -0
  70. package/dist/tree-CqcQ99NM.js +172 -0
  71. package/dist/useLocalDraft-C07SYRnC.js +11 -0
  72. package/dist/useLocalDraft-Yiw1wFgI.cjs +1 -0
  73. package/dist/{validate-DWPF7icl.js → validate-7s0yn6ii.js} +26 -26
  74. package/dist/validate-DsRiNw8h.cjs +1 -0
  75. package/dist/vue/async.d.cts +118 -6
  76. package/dist/vue/async.d.ts +118 -6
  77. package/dist/vue/index.d.cts +177 -11
  78. package/dist/vue/index.d.ts +177 -11
  79. package/dist/vue-async.cjs +1 -1
  80. package/dist/vue-async.js +5 -5
  81. package/dist/vue.cjs +1 -1
  82. package/dist/vue.js +116 -113
  83. package/dist/{import-template-CNMLJSQw.js → workbook-session-BKOTwcoq.js} +4290 -4227
  84. package/dist/{import-template-CpxunKVp.cjs → workbook-session-CLYLhZWu.cjs} +17 -17
  85. package/dist/worker.cjs +1 -1
  86. package/dist/worker.d.cts +9 -2
  87. package/dist/worker.d.ts +9 -2
  88. package/dist/worker.js +1 -1
  89. package/dist/xlsx.cjs +4 -2
  90. package/dist/xlsx.d.cts +159 -3
  91. package/dist/xlsx.d.ts +159 -3
  92. package/dist/xlsx.js +354 -192
  93. package/package.json +1 -1
  94. package/dist/ExcelBindingWizard-DiaxvWpQ.cjs +0 -1
  95. package/dist/ExcelBindingWizard-RLJIXKKG.js +0 -816
  96. package/dist/ReportPreview-B5ZNEasW.js +0 -4439
  97. package/dist/ReportPreview-DRtVPUYo.cjs +0 -6
  98. package/dist/RuleEditor-CskN5Fr3.cjs +0 -1
  99. package/dist/RuleEditor-CtJFzKuY.js +0 -1578
  100. package/dist/TemplateReviewPanel-C_Lmzis6.cjs +0 -1
  101. package/dist/TemplateReviewPanel-Cn32OY4_.js +0 -173
  102. package/dist/binding-preview-B5834rml.cjs +0 -2
  103. package/dist/binding-preview-ChXjN5L5.js +0 -649
  104. package/dist/capabilities-DYzWL7KS.cjs +0 -1
  105. package/dist/matrix-CNPDJxED.js +0 -745
  106. package/dist/matrix-Div9Ilh3.cjs +0 -1
  107. package/dist/param-validation-BWNjLcN0.js +0 -116
  108. package/dist/param-validation-CiTxFeZ8.cjs +0 -1
  109. package/dist/plugin-BWwIgZXV.js +0 -25
  110. package/dist/plugin-Dg-J1Rbm.cjs +0 -1
  111. package/dist/template-registry-CHMYZ7SD.cjs +0 -1
  112. package/dist/template-registry-R61AMCr0.js +0 -433
  113. package/dist/template-review-hvWWQFsi.js +0 -1027
  114. package/dist/template-review-jEcOfmGr.cjs +0 -1
  115. package/dist/validate-BDiMqkJC.cjs +0 -1
@@ -0,0 +1,364 @@
1
+ class m extends Error {
2
+ constructor(t, n, r) {
3
+ super(n), this.code = t, this.path = r, this.name = "ReportRuntimeError";
4
+ }
5
+ }
6
+ function S(e) {
7
+ if (!e?.aborted) return;
8
+ if (e.reason instanceof m) throw e.reason;
9
+ const t = new Error("报表执行已取消");
10
+ throw t.name = "AbortError", Object.defineProperty(t, "cause", { value: e.reason }), t;
11
+ }
12
+ function Z(e, t, n) {
13
+ if (!Number.isFinite(n) || n < 0) throw new m("budget", `${t} 的执行统计无效`, `$.budget.${t}`);
14
+ const r = e[t];
15
+ if (r !== void 0 && n > r) throw new m("budget", `${t} 超出预算 ${r}(实际 ${n})`, `$.budget.${t}`);
16
+ }
17
+ function F(e) {
18
+ for (const [t, n] of Object.entries(e)) {
19
+ if (n !== void 0 && (!Number.isFinite(n) || n <= 0)) throw new m("budget", `${t} 应为正有限数字`, `$.budget.${t}`);
20
+ if (t !== "maxDurationMs" && n !== void 0 && !Number.isSafeInteger(n)) throw new m("budget", `${t} 应为正安全整数`, `$.budget.${t}`);
21
+ if (t === "maxDurationMs" && n !== void 0 && n > 2147483647) throw new m("budget", "maxDurationMs 不能超过 2147483647", `$.budget.${t}`);
22
+ }
23
+ }
24
+ async function V(e, t, n) {
25
+ const r = new AbortController(), s = () => r.abort(e?.reason);
26
+ e?.addEventListener("abort", s, { once: !0 }), e?.aborted && s();
27
+ const a = Date.now(), c = t === void 0 ? void 0 : setTimeout(() => r.abort(new m("timeout", `报表执行超过 ${t}ms`)), t);
28
+ let d;
29
+ try {
30
+ S(r.signal);
31
+ const g = new Promise((u, i) => {
32
+ d = () => {
33
+ try {
34
+ S(r.signal);
35
+ } catch (w) {
36
+ i(w);
37
+ }
38
+ }, r.signal.addEventListener("abort", d, { once: !0 });
39
+ }), o = await Promise.race([n(r.signal), g]);
40
+ if (S(r.signal), t !== void 0 && Date.now() - a > t) throw new m("timeout", `报表执行超过 ${t}ms`);
41
+ return o;
42
+ } finally {
43
+ c !== void 0 && clearTimeout(c), d && r.signal.removeEventListener("abort", d), e?.removeEventListener("abort", s);
44
+ }
45
+ }
46
+ const B = new Uint32Array([
47
+ 1116352408,
48
+ 1899447441,
49
+ 3049323471,
50
+ 3921009573,
51
+ 961987163,
52
+ 1508970993,
53
+ 2453635748,
54
+ 2870763221,
55
+ 3624381080,
56
+ 310598401,
57
+ 607225278,
58
+ 1426881987,
59
+ 1925078388,
60
+ 2162078206,
61
+ 2614888103,
62
+ 3248222580,
63
+ 3835390401,
64
+ 4022224774,
65
+ 264347078,
66
+ 604807628,
67
+ 770255983,
68
+ 1249150122,
69
+ 1555081692,
70
+ 1996064986,
71
+ 2554220882,
72
+ 2821834349,
73
+ 2952996808,
74
+ 3210313671,
75
+ 3336571891,
76
+ 3584528711,
77
+ 113926993,
78
+ 338241895,
79
+ 666307205,
80
+ 773529912,
81
+ 1294757372,
82
+ 1396182291,
83
+ 1695183700,
84
+ 1986661051,
85
+ 2177026350,
86
+ 2456956037,
87
+ 2730485921,
88
+ 2820302411,
89
+ 3259730800,
90
+ 3345764771,
91
+ 3516065817,
92
+ 3600352804,
93
+ 4094571909,
94
+ 275423344,
95
+ 430227734,
96
+ 506948616,
97
+ 659060556,
98
+ 883997877,
99
+ 958139571,
100
+ 1322822218,
101
+ 1537002063,
102
+ 1747873779,
103
+ 1955562222,
104
+ 2024104815,
105
+ 2227730452,
106
+ 2361852424,
107
+ 2428436474,
108
+ 2756734187,
109
+ 3204031479,
110
+ 3329325298
111
+ ]), y = (e, t) => e >>> t | e << 32 - t;
112
+ function E(e, t, n) {
113
+ const r = new DataView(e.buffer, e.byteOffset + t, 64);
114
+ for (let s = 0; s < 16; s++) n[s] = r.getUint32(s * 4);
115
+ for (let s = 16; s < 64; s++) {
116
+ const a = n[s - 15], c = n[s - 2], d = y(a, 7) ^ y(a, 18) ^ a >>> 3, g = y(c, 17) ^ y(c, 19) ^ c >>> 10;
117
+ n[s] = n[s - 16] + d + n[s - 7] + g;
118
+ }
119
+ }
120
+ function O(e, t) {
121
+ let n = e[0], r = e[1], s = e[2], a = e[3], c = e[4], d = e[5], g = e[6], o = e[7];
122
+ for (let u = 0; u < 64; u++) {
123
+ const i = y(c, 6) ^ y(c, 11) ^ y(c, 25), w = c & d ^ ~c & g, f = o + i + w + B[u] + t[u] >>> 0, b = y(n, 2) ^ y(n, 13) ^ y(n, 22), h = n & r ^ n & s ^ r & s, A = b + h >>> 0;
124
+ o = g, g = d, d = c, c = a + f >>> 0, a = s, s = r, r = n, n = f + A >>> 0;
125
+ }
126
+ e[0] = e[0] + n, e[1] = e[1] + r, e[2] = e[2] + s, e[3] = e[3] + a, e[4] = e[4] + c, e[5] = e[5] + d, e[6] = e[6] + g, e[7] = e[7] + o;
127
+ }
128
+ function j(e) {
129
+ const t = new Uint8Array(Math.ceil((e.byteLength + 9) / 64) * 64);
130
+ t.set(e), t[e.byteLength] = 128;
131
+ const n = new DataView(t.buffer);
132
+ return n.setUint32(t.length - 8, Math.floor(e.byteLength / 536870912)), n.setUint32(t.length - 4, e.byteLength * 8 >>> 0), t;
133
+ }
134
+ const J = () => new Uint32Array([1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225]), $ = (e) => Array.from(e, (t) => t.toString(16).padStart(8, "0")).join("");
135
+ async function I(e) {
136
+ const t = j(e), n = J(), r = new Uint32Array(64);
137
+ for (let s = 0; s < t.length; s += 64)
138
+ s > 0 && s % 262144 === 0 && await new Promise((a) => setTimeout(a, 0)), E(t, s, r), O(n, r);
139
+ return $(n);
140
+ }
141
+ function q(e = {}) {
142
+ const t = {
143
+ maxRecords: e.maxRecords ?? 1e4,
144
+ maxBytes: e.maxBytes ?? 67108864,
145
+ maxResultBytes: e.maxResultBytes ?? 262144,
146
+ controlReserveBytes: e.controlReserveBytes ?? 4096,
147
+ maxTombstones: e.maxTombstones ?? 1e4,
148
+ maxTombstoneBytes: e.maxTombstoneBytes ?? 16777216
149
+ };
150
+ if (!Object.values(t).every((n) => Number.isSafeInteger(n) && n > 0) || t.controlReserveBytes < 4096) throw new l("input", "任务容量应为正整数,控制状态预留至少4096字节");
151
+ return t;
152
+ }
153
+ function v(e) {
154
+ return new TextEncoder().encode(p(e)).byteLength;
155
+ }
156
+ function N(e, t) {
157
+ const n = { scope: e.scope, id: e.id, revision: 1, request: e.request, status: "queued", createdAt: e.createdAt, updatedAt: e.createdAt, attempt: 0 }, r = { ...e };
158
+ delete r.result;
159
+ const s = e.result === void 0 ? 0 : v(e.result);
160
+ if (s > t.maxResultBytes) throw new l("capacity", "任务结果超过独立预算,请保存文件引用");
161
+ return Math.max(v(n) + t.controlReserveBytes, v(r)) + s;
162
+ }
163
+ function R(e) {
164
+ return e.status !== "queued" && e.status !== "running";
165
+ }
166
+ function T(e) {
167
+ const t = { ...e, tombstoneRetentionMs: e.tombstoneRetentionMs ?? 6048e5, limit: e.limit ?? 100 };
168
+ if (![t.now, t.terminalBefore].every((n) => Number.isSafeInteger(n) && n >= 0) || t.terminalBefore > t.now) throw new l("input", "终态清理时间应为不超过当前时间的非负整数");
169
+ if (![t.tombstoneRetentionMs, t.limit].every((n) => Number.isSafeInteger(n) && n > 0) || !Number.isSafeInteger(t.now + t.tombstoneRetentionMs)) throw new l("input", "幂等保留期与清理批量应为正整数");
170
+ return t;
171
+ }
172
+ async function D(e) {
173
+ const t = new TextEncoder().encode(p(e)), n = globalThis.crypto?.subtle;
174
+ if (!n) return I(t);
175
+ const r = await n.digest("SHA-256", t);
176
+ return Array.from(new Uint8Array(r), (s) => s.toString(16).padStart(2, "0")).join("");
177
+ }
178
+ async function L(e, t) {
179
+ if (!R(e)) throw new l("input", "只能归档终态任务");
180
+ return { scope: e.scope, id: e.id, revision: e.revision, status: e.status, createdAt: e.createdAt, updatedAt: e.updatedAt, attempt: e.attempt, requestHash: await D(e.request), expiresAt: t };
181
+ }
182
+ class l extends Error {
183
+ constructor(t, n) {
184
+ super(n), this.code = t, this.name = "ReportJobError";
185
+ }
186
+ }
187
+ function P(e, t) {
188
+ if (typeof e != "string" || !e.trim() || e.length > 256 || typeof t != "string" || t !== t.trim() || !/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t)) throw new l("input", "任务范围应非空,ID应为1–128位安全标识");
189
+ }
190
+ function M(e) {
191
+ const t = Array.isArray(e), n = Object.getPrototypeOf(e), r = Object.keys(e);
192
+ if (n !== (t ? Array.prototype : Object.prototype) && !(n === null && !t)) throw new l("input", "任务对象应为普通 JSON 对象");
193
+ if (Object.getOwnPropertySymbols(e).length) throw new l("input", "任务不能包含Symbol");
194
+ if (Object.getOwnPropertyNames(e).filter((a) => !(t && a === "length")).length !== r.length) throw new l("input", "任务不能包含不可枚举属性");
195
+ if (t && (r.length !== e.length || r.some((a) => a !== String(Number(a)) || !Number.isSafeInteger(Number(a)) || Number(a) < 0 || Number(a) >= e.length))) throw new l("input", "任务数组不能稀疏或包含额外属性");
196
+ return r.sort();
197
+ }
198
+ function C(e, t) {
199
+ const n = Object.getOwnPropertyDescriptor(e, t);
200
+ if (["__proto__", "prototype", "constructor"].includes(t) || n.get || n.set) throw new l("input", "任务不能包含危险键或访问器");
201
+ return n.value;
202
+ }
203
+ function p(e, t = {}) {
204
+ const n = t.maxNodes ?? 2e4, r = t.maxCharacters ?? 1e6;
205
+ if (!Number.isSafeInteger(n) || n < 1 || n > 2e4 || !Number.isSafeInteger(r) || r < 1 || r > 1e6) throw new l("input", "任务JSON预算无效");
206
+ let s = 0, a = 0;
207
+ const c = /* @__PURE__ */ new Set();
208
+ function d(o, u) {
209
+ if (++s > n || u > 32) throw new l("input", "任务数据超过节点或深度预算");
210
+ if (typeof o == "string") {
211
+ if (a += o.length, a > r) throw new l("input", "任务文本超过预算");
212
+ return o;
213
+ }
214
+ if (o === null || typeof o == "boolean" || typeof o == "number" && Number.isFinite(o)) return o;
215
+ if (!o || typeof o != "object" || c.has(o)) throw new l("input", "任务只允许无循环的有限 JSON 值");
216
+ const i = Array.isArray(o), w = M(o);
217
+ c.add(o);
218
+ const f = /* @__PURE__ */ Object.create(null);
219
+ for (const b of w) {
220
+ if (a += b.length, a > r) throw new l("input", "任务文本超过预算");
221
+ f[b] = d(C(o, b), u + 1);
222
+ }
223
+ return c.delete(o), i ? Array.from({ length: o.length }, (b, h) => f[String(h)]) : f;
224
+ }
225
+ const g = JSON.stringify(d(e, 0));
226
+ if (g.length > r) throw new l("input", "任务序列化数据超过字符预算");
227
+ return g;
228
+ }
229
+ function x(e) {
230
+ return JSON.parse(JSON.stringify(e));
231
+ }
232
+ function U(e, t, n, r) {
233
+ if (P(t, n), e.scope !== t || e.id !== n || e.revision !== (r ?? 0) + 1 || !Number.isSafeInteger(e.revision)) throw new l("input", "任务身份或修订不匹配");
234
+ if (![e.createdAt, e.updatedAt, e.attempt].every((s) => Number.isSafeInteger(s) && s >= 0) || !["queued", "running", "completed", "failed", "cancelled"].includes(e.status)) throw new l("input", "任务状态无效");
235
+ if (e.lease && (!e.lease.owner || !Number.isSafeInteger(e.lease.expiresAt))) throw new l("input", "任务租约无效");
236
+ if (!e.request || typeof e.request.kind != "string" || !e.request.kind.trim() || e.request.kind.length > 128) throw new l("input", "任务类型无效");
237
+ p(e.request.payload, { maxNodes: 19e3, maxCharacters: 75e4 }), p(e);
238
+ }
239
+ function z(e, t) {
240
+ if (e && (e.createdAt !== t.createdAt || p(e.request) !== p(t.request))) throw new l("input", "任务创建时间与请求不可变更,请使用新任务ID");
241
+ }
242
+ function _(e, t) {
243
+ return e.status === "queued" || e.status === "running" && (e.lease?.expiresAt ?? 0) <= t;
244
+ }
245
+ function K(e = {}) {
246
+ const t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), r = q(e);
247
+ let s = 0, a = 0, c = Promise.resolve();
248
+ const d = (o, u) => JSON.stringify([o, u]), g = (o) => {
249
+ const u = c.then(o);
250
+ return c = u.then(() => {
251
+ }, () => {
252
+ }), u;
253
+ };
254
+ return {
255
+ read: async (o, u) => {
256
+ await c;
257
+ const i = t.get(d(o, u));
258
+ return i ? x(i) : void 0;
259
+ },
260
+ readTombstone: async (o, u) => {
261
+ await c;
262
+ const i = n.get(d(o, u));
263
+ return i ? x(i) : void 0;
264
+ },
265
+ candidates: async (o, u) => (await c, Array.from(t.values()).filter((i) => _(i, o)).sort((i, w) => i.createdAt - w.createdAt).slice(0, u).map(x)),
266
+ compareAndSwap: async (o, u, i, w) => {
267
+ U(w, o, u, i);
268
+ const f = x(w);
269
+ return g(async () => {
270
+ const b = d(o, u), h = t.get(b);
271
+ if ((h?.revision ?? null) !== i || n.has(b)) return !1;
272
+ z(h, f);
273
+ const A = s - (h ? N(h, r) : 0) + N(f, r);
274
+ if (A > r.maxBytes || !h && t.size >= r.maxRecords) throw new l("capacity", "任务容量已满,请清理终态任务或扩大显式预算");
275
+ return t.set(b, f), s = A, !0;
276
+ });
277
+ },
278
+ prune: async (o) => {
279
+ const u = T(o);
280
+ return g(async () => {
281
+ const i = { archived: 0, expired: 0 };
282
+ for (const [w, f] of n)
283
+ f.expiresAt > u.now || i.expired >= u.limit || (n.delete(w), a -= v(f), i.expired++);
284
+ for (const [w, f] of t) {
285
+ if (!R(f) || f.updatedAt > u.terminalBefore || i.archived + i.expired >= u.limit) continue;
286
+ const b = await L(f, u.now + u.tombstoneRetentionMs), h = v(b);
287
+ if (n.size >= r.maxTombstones || a + h > r.maxTombstoneBytes) break;
288
+ n.set(w, b), a += h, t.delete(w), s -= N(f, r), i.archived++;
289
+ }
290
+ return i;
291
+ });
292
+ }
293
+ };
294
+ }
295
+ function k(e, t = 100) {
296
+ if (!Number.isSafeInteger(t) || t < 1 || t > 1e3 || !Array.isArray(e) || e.length > t) throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");
297
+ const n = JSON.parse(p(e)), r = /* @__PURE__ */ new Set();
298
+ for (const s of n) {
299
+ if (!s || typeof s.id != "string" || s.id !== s.id.trim() || !/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(s.id) || r.has(s.id)) throw new TypeError("批量行 ID 应唯一且为安全标识");
300
+ if (!s.params || Array.isArray(s.params) || typeof s.params != "object" || Object.values(s.params).some((a) => typeof a != "string")) throw new TypeError("批量参数应为字符串字典");
301
+ r.add(s.id);
302
+ }
303
+ return n;
304
+ }
305
+ function H(e, t) {
306
+ if (!t) return;
307
+ const n = { completed: 0, total: e.length, failed: 0, cancelled: 0 };
308
+ for (const r of e)
309
+ r && (n.completed++, r.status === "failed" && n.failed++, r.status === "cancelled" && n.cancelled++);
310
+ try {
311
+ t(n);
312
+ } catch {
313
+ }
314
+ }
315
+ async function W(e, t, n = {}) {
316
+ const r = n.concurrency ?? 2;
317
+ if (!Number.isSafeInteger(r) || r < 1 || r > 16) throw new RangeError("批量并发应为 1–16");
318
+ if (n.failure !== void 0 && n.failure !== "continue" && n.failure !== "stop") throw new TypeError("批量失败策略无效");
319
+ const s = k(e, n.maxCases ?? 100);
320
+ if (!s.length) throw new RangeError("批量生成至少需要一组参数");
321
+ const a = Array.from({ length: s.length }), c = new AbortController(), d = () => c.abort(n.signal?.reason);
322
+ n.signal?.addEventListener("abort", d, { once: !0 }), n.signal?.aborted && d();
323
+ let g = 0, o = !1;
324
+ async function u() {
325
+ for (; g < s.length; ) {
326
+ const i = g++, w = s[i], f = { id: w.id, index: i };
327
+ if (o || c.signal.aborted) a[i] = { ...f, status: "cancelled" };
328
+ else
329
+ try {
330
+ S(c.signal);
331
+ const b = await t(w, { index: i, signal: c.signal });
332
+ a[i] = { ...f, status: "completed", value: b };
333
+ } catch (b) {
334
+ c.signal.aborted ? a[i] = { ...f, status: "cancelled" } : (a[i] = { ...f, status: "failed", error: { name: b instanceof Error ? b.name : "Error", message: b instanceof Error ? b.message : String(b) } }, n.failure === "stop" && (o = !0));
335
+ }
336
+ H(a, n.onProgress);
337
+ }
338
+ }
339
+ try {
340
+ await Promise.all(Array.from({ length: Math.min(r, s.length) }, u));
341
+ } finally {
342
+ n.signal?.removeEventListener("abort", d);
343
+ }
344
+ return a;
345
+ }
346
+ export {
347
+ m as R,
348
+ Z as a,
349
+ l as b,
350
+ V as c,
351
+ P as d,
352
+ x as e,
353
+ D as f,
354
+ K as g,
355
+ _ as h,
356
+ k as i,
357
+ v as j,
358
+ U as k,
359
+ z as l,
360
+ W as r,
361
+ p as s,
362
+ S as t,
363
+ F as v
364
+ };
@@ -1,5 +1,5 @@
1
1
  import { a as l } from "./progress-7OSZbFok.js";
2
- import { a as S, i as w } from "./render-plan-Ck6koX9L.js";
2
+ import { a as w, i as D } from "./render-plan-Ck6koX9L.js";
3
3
  function E(e, t) {
4
4
  l(t.signal);
5
5
  try {
@@ -14,10 +14,10 @@ class O extends Error {
14
14
  }
15
15
  }
16
16
  const $ = /* @__PURE__ */ new Set(["text", "rect", "line", "ellipse"]), b = /* @__PURE__ */ new Set(["image", "chart", "barcode", "qrcode"]);
17
- function N(e, t) {
17
+ function C(e, t) {
18
18
  if (!e.grid) {
19
- if (w(e))
20
- return t === "xlsx" ? { code: "unsupported-component", message: "XLSX data export omits image-backed components; use PDF or PNG for visual output." } : t === "pdf" && !/^data:image\/(png|jpe?g);base64,/i.test(e.imageData) ? { code: "unsupported-image-format", message: "PDF accepts PNG or JPEG data URLs; convert this image before exporting." } : void 0;
19
+ if (D(e))
20
+ 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;
21
21
  if (b.has(e.kind)) return { code: "missing-image", message: `${e.kind} requires imageData or a renderer adapter before output.` };
22
22
  if (!$.has(e.kind)) return { code: "unsupported-component", message: `Unsupported component kind: ${e.kind}.` };
23
23
  if (t === "xlsx" && e.kind !== "text") return { code: "unsupported-component", message: `XLSX data export omits ${e.kind} geometry.` };
@@ -26,28 +26,28 @@ function N(e, t) {
26
26
  function u(e, t, i, s, n) {
27
27
  return { ...n, severity: "warning", format: t, pageIndex: i, componentIndex: s, kind: e.kind, nid: e.nid };
28
28
  }
29
- function h(e, t) {
29
+ function f(e, t) {
30
30
  if (!e || t === "dom") return;
31
31
  const i = [];
32
32
  return e.rotateDeg && i.push("rotateDeg"), e.opacity !== void 0 && e.opacity !== 1 && i.push("opacity"), t !== "xlsx" && e.align === "justify" && i.push("justify"), t === "canvas" && e.underline && i.push("underline"), t === "xlsx" && e.letterSpacing && i.push("letterSpacing"), i.length ? `${t} does not preserve these styles: ${i.join(", ")}.` : void 0;
33
33
  }
34
- function y(e, t, i, s, n, r, o) {
35
- if (o.has(e)) return;
36
- const v = new Set(o).add(e), p = N(e, t);
34
+ function y(e, t, i, s, n, r, d) {
35
+ if (d.has(e)) return;
36
+ const v = new Set(d).add(e), p = C(e, t);
37
37
  p && r.push({ ...u(e, t, i, s, p), componentPath: n });
38
- const g = h(e.style, t);
39
- g && r.push({ ...u(e, t, i, s, { code: "unsupported-style", message: g }), componentPath: n }), S(e) && t !== "dom" && r.push(u(e, t, i, s, { code: "rich-text-flattened", message: "Rich text is exported as plain text; inline styles are not preserved." }));
40
- for (const [d, x] of (e.grid?.cells ?? []).entries()) for (const [a, c] of x.entries()) {
41
- const f = h(c?.style, t);
42
- if (f && r.push({ ...u(e, t, i, s, { code: "unsupported-style", message: f }), componentPath: [...n, d, a] }), c?.children?.length && t !== "dom")
43
- r.push({ ...u(e, t, i, s, { code: "nested-components-omitted", message: "Nested grid components are omitted; cell text is preserved." }), componentPath: [...n, d, a] });
38
+ const g = f(e.style, t);
39
+ g && r.push({ ...u(e, t, i, s, { code: "unsupported-style", message: g }), componentPath: n }), w(e) && t !== "dom" && r.push(u(e, t, i, s, { code: "rich-text-flattened", message: "Rich text is exported as plain text; inline styles are not preserved." }));
40
+ for (const [o, x] of (e.grid?.cells ?? []).entries()) for (const [a, c] of x.entries()) {
41
+ const h = f(c?.style, t);
42
+ if (h && r.push({ ...u(e, t, i, s, { code: "unsupported-style", message: h }), componentPath: [...n, o, a] }), c?.children?.length && t !== "dom")
43
+ r.push({ ...u(e, t, i, s, { code: "nested-components-omitted", message: "Nested grid components are omitted; cell text is preserved." }), componentPath: [...n, o, a] });
44
44
  else if (t === "dom")
45
- for (const [k, D] of (c?.children ?? []).entries()) y(D, t, i, s, [...n, d, a, k], r, v);
45
+ for (const [k, S] of (c?.children ?? []).entries()) y(S, t, i, s, [...n, o, a, k], r, v);
46
46
  }
47
47
  }
48
48
  function j(e, t) {
49
49
  const i = [];
50
- return e.pages.forEach((s, n) => s.components.forEach((r, o) => y(r, t, n, o, [], i, /* @__PURE__ */ new Set()))), i;
50
+ return e.pages.forEach((s, n) => s.components.forEach((r, d) => y(r, t, n, d, [], i, /* @__PURE__ */ new Set()))), i;
51
51
  }
52
52
  function G(e, t, i) {
53
53
  l(i.signal);
@@ -0,0 +1 @@
1
+ "use strict";const l=require("./progress-BnLiS5eH.cjs"),y=require("./render-plan-7xpGrCEl.cjs");function v(e,t){l.assertOutputActive(t.signal);try{t.onDiagnostic?.(e)}catch{}l.assertOutputActive(t.signal)}class O extends Error{constructor(t){super(`Output contains ${t.length} known fidelity issue(s): ${t[0]?.code}`),this.diagnostics=t,this.code="output-fidelity",this.name="OutputFidelityError"}}const $=new Set(["text","rect","line","ellipse"]),b=new Set(["image","chart","barcode","qrcode"]);function C(e,t){if(!e.grid){if(y.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(b.has(e.kind))return{code:"missing-image",message:`${e.kind} requires imageData or a renderer adapter before output.`};if(!$.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 u(e,t,i,s,n){return{...n,severity:"warning",format:t,pageIndex:i,componentIndex:s,kind:e.kind,nid:e.nid}}function f(e,t){if(!e||t==="dom")return;const i=[];return e.rotateDeg&&i.push("rotateDeg"),e.opacity!==void 0&&e.opacity!==1&&i.push("opacity"),t!=="xlsx"&&e.align==="justify"&&i.push("justify"),t==="canvas"&&e.underline&&i.push("underline"),t==="xlsx"&&e.letterSpacing&&i.push("letterSpacing"),i.length?`${t} does not preserve these styles: ${i.join(", ")}.`:void 0}function x(e,t,i,s,n,r,d){if(d.has(e))return;const k=new Set(d).add(e),p=C(e,t);p&&r.push({...u(e,t,i,s,p),componentPath:n});const g=f(e.style,t);g&&r.push({...u(e,t,i,s,{code:"unsupported-style",message:g}),componentPath:n}),y.isRichText(e)&&t!=="dom"&&r.push(u(e,t,i,s,{code:"rich-text-flattened",message:"Rich text is exported as plain text; inline styles are not preserved."}));for(const[o,S]of(e.grid?.cells??[]).entries())for(const[c,a]of S.entries()){const h=f(a?.style,t);if(h&&r.push({...u(e,t,i,s,{code:"unsupported-style",message:h}),componentPath:[...n,o,c]}),a?.children?.length&&t!=="dom")r.push({...u(e,t,i,s,{code:"nested-components-omitted",message:"Nested grid components are omitted; cell text is preserved."}),componentPath:[...n,o,c]});else if(t==="dom")for(const[w,E]of(a?.children??[]).entries())x(E,t,i,s,[...n,o,c,w],r,k)}}function D(e,t){const i=[];return e.pages.forEach((s,n)=>s.components.forEach((r,d)=>x(r,t,n,d,[],i,new Set))),i}function j(e,t,i){l.assertOutputActive(i.signal);const s=D(e,t);if(s.forEach(n=>v(n,i)),i.fidelity==="strict"&&s.length)throw new O(s);return s}exports.OutputFidelityError=O;exports.inspectOutputCapabilities=D;exports.notifyOutputDiagnostic=v;exports.reportOutputDiagnostics=j;