@agile-team/mach-report 2.25.2 → 2.26.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 (140) hide show
  1. package/README.md +12 -8
  2. package/dist/ExcelBindingWizard-B418l44t.js +1578 -0
  3. package/dist/ExcelBindingWizard-C4FGVsY_.cjs +1 -0
  4. package/dist/{ParamEditor-CGfaweYX.cjs → ParamEditor-BemJE8n8.cjs} +1 -1
  5. package/dist/{ParamEditor-B7YVD28E.js → ParamEditor-XvMtf_XQ.js} +2 -2
  6. package/dist/{ReportBatchPanel-BRJt0TXp.cjs → ReportBatchPanel-CbY4fvXD.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-BTKHtLTW.js → ReportBatchPanel-Ds0R_uXn.js} +37 -37
  8. package/dist/{ReportLabelStudio-BvK_WBke.cjs → ReportLabelStudio-DuTwN5er.cjs} +1 -1
  9. package/dist/{ReportLabelStudio-CZwqyO3t.js → ReportLabelStudio-ZFy79eRv.js} +26 -26
  10. package/dist/ReportParamPanel-Chxu4MTx.cjs +1 -0
  11. package/dist/{ReportParamPanel-DGXzBzl2.js → ReportParamPanel-Czm3OPo_.js} +216 -205
  12. package/dist/{ReportPreview-D1ZC5kzz.js → ReportPreview-C9c0Rp7Y.js} +2938 -2875
  13. package/dist/ReportPreview-CIMR4ERo.cjs +6 -0
  14. package/dist/{ReportTemplateLibrary-ClwxhnC0.cjs → ReportTemplateLibrary-C6lByc69.cjs} +1 -1
  15. package/dist/{ReportTemplateLibrary-C7sB0Jay.js → ReportTemplateLibrary-XJVoTDIz.js} +1 -1
  16. package/dist/{RuleEditor-CsDGFaWz.js → RuleEditor-CeNFPeOc.js} +5 -5
  17. package/dist/{RuleEditor-D-OdaGdR.cjs → RuleEditor-gggUkEwB.cjs} +1 -1
  18. package/dist/{TemplateOutlinePanel-DAqR9zQi.cjs → TemplateOutlinePanel-B0e-umq2.cjs} +1 -1
  19. package/dist/{TemplateOutlinePanel-CXOT7d1r.js → TemplateOutlinePanel-BWN4Y9iz.js} +2 -2
  20. package/dist/{TemplateReusePanel-Dcfx3Hba.js → TemplateReusePanel-CR-4OHoU.js} +2 -2
  21. package/dist/{TemplateReusePanel-ygIi-Ajz.cjs → TemplateReusePanel-Cthig1S1.cjs} +1 -1
  22. package/dist/{TemplateReviewPanel-COU8FqPq.js → TemplateReviewPanel-BkWzyNL4.js} +2 -2
  23. package/dist/{TemplateReviewPanel-DyGULVxr.cjs → TemplateReviewPanel-D8o2gDaK.cjs} +1 -1
  24. package/dist/analytics.cjs +1 -1
  25. package/dist/analytics.js +5 -5
  26. package/dist/artifact-integrity.json +106 -102
  27. package/dist/{assets-C4MIvzQ4.js → assets-BFTP-0WR.js} +2 -2
  28. package/dist/{assets-BYdpkTIt.cjs → assets-CZiZhTf2.cjs} +1 -1
  29. package/dist/{auto-j7mr8Kvc.js → auto-C7udkeAa.js} +20 -19
  30. package/dist/auto-CXd2E2aZ.cjs +1 -0
  31. package/dist/capabilities-D8UU2clQ.cjs +1 -0
  32. package/dist/{capabilities-CN_kSVjO.js → capabilities-g0a2j9Yy.js} +50 -46
  33. package/dist/{charts-Cjw5AYkg.cjs → charts-D-Vg-ak9.cjs} +1 -1
  34. package/dist/{charts-CxJZ0XaY.js → charts-D48XCefN.js} +1 -1
  35. package/dist/computed-BQgBrma-.cjs +1 -0
  36. package/dist/{computed-f3pOqWLX.js → computed-CH3NYPOW.js} +198 -188
  37. package/dist/{data-bar-Bfh54sT4.js → data-bar-DjOgTLqu.js} +1 -1
  38. package/dist/{dataset-DL83majE.js → dataset-B8oTsC6o.js} +69 -66
  39. package/dist/dataset-D3OsyzG1.cjs +1 -0
  40. package/dist/designer-COuSUxZ1.cjs +2 -0
  41. package/dist/designer-CT4mlrr0.js +7997 -0
  42. package/dist/designer.cjs +1 -1
  43. package/dist/designer.d.cts +83 -4
  44. package/dist/designer.d.ts +83 -4
  45. package/dist/designer.js +4 -4
  46. package/dist/{diagnostic-collector-gB07PHy2.js → diagnostic-collector-C-JBA016.js} +2 -2
  47. package/dist/dom-DgWc-DY1.js +452 -0
  48. package/dist/dom-Fk4NF-gN.cjs +1 -0
  49. package/dist/{encoding-BWEMdzFG.js → encoding-D480EM2r.js} +2 -2
  50. package/dist/{encoding-DVea2qIR.cjs → encoding-tWc2Wn89.cjs} +1 -1
  51. package/dist/execution-result-7sG_mdcD.cjs +1 -0
  52. package/dist/execution-result-Ba65gieT.js +39 -0
  53. package/dist/{font-loader-p_SyTvqt.cjs → font-loader-BIxme_9g.cjs} +1 -1
  54. package/dist/{font-loader-D4NLIKJL.js → font-loader-CHmEwkHl.js} +1 -1
  55. package/dist/{grid-strokes-DkZEZvcI.js → grid-strokes-DsoICRjZ.js} +1 -1
  56. package/dist/import-range-BwT86Z3j.cjs +1 -0
  57. package/dist/import-range-D9p_blcb.js +98 -0
  58. package/dist/index.cjs +1 -1
  59. package/dist/index.js +25 -25
  60. package/dist/{json-snapshot-DdzALe8q.js → json-snapshot-BZ0CIQln.js} +1041 -887
  61. package/dist/json-snapshot-DGFeI30h.cjs +2 -0
  62. package/dist/{matrix-b6T291xo.js → matrix-CB9TqTEy.js} +1 -1
  63. package/dist/{matrix-DUYPRL7t.cjs → matrix-CcqYOuq_.cjs} +1 -1
  64. package/dist/{pdf-DU8HelKd.js → pdf-DTR7fAIr.js} +3596 -3517
  65. package/dist/{pdf-C060D5UY.cjs → pdf-d9oJ6V0P.cjs} +49 -49
  66. package/dist/pdf.cjs +1 -1
  67. package/dist/pdf.js +2 -2
  68. package/dist/{plugin-D5BRHlne.cjs → plugin-B7Bi-1te.cjs} +1 -1
  69. package/dist/{plugin-FWhTnjr0.js → plugin-OKDFQFS4.js} +1 -1
  70. package/dist/{prefill-m01IM1hl.js → prefill-C8fF91JB.js} +3 -3
  71. package/dist/{prefill-DZymomY6.cjs → prefill-C_Bf_AMo.cjs} +1 -1
  72. package/dist/{prepared-BHu8bIdj.cjs → prepared-BLhV7vdE.cjs} +1 -1
  73. package/dist/{prepared-DO5pe6Ed.js → prepared-DhgQ0d-h.js} +7 -7
  74. package/dist/protocol-CZ-BILne.cjs +1 -0
  75. package/dist/{protocol-CZddmu2n.js → protocol-DHO91-Jt.js} +3 -3
  76. package/dist/{record-bindings-Cv7lFiof.js → record-bindings-DBrCu6zO.js} +3 -3
  77. package/dist/{record-bindings-B7djSjNs.cjs → record-bindings-KEs-DKCS.cjs} +1 -1
  78. package/dist/region-binding-workflow-FSyIZge8.js +882 -0
  79. package/dist/region-binding-workflow-ikpY1Kbw.cjs +3 -0
  80. package/dist/report-encoding-worker.cjs +1 -1
  81. package/dist/report-encoding-worker.js +1 -1
  82. package/dist/rich-text-layout-BYbIc3eJ.cjs +3 -0
  83. package/dist/rich-text-layout-BtygMWZC.js +96 -0
  84. package/dist/runtime-B5HG8poy.cjs +1 -0
  85. package/dist/runtime-BsvAqz4a.js +204 -0
  86. package/dist/sbom.cdx.json +1 -1
  87. package/dist/server-node.cjs +5 -5
  88. package/dist/server-node.js +2049 -1889
  89. package/dist/server.cjs +1 -1
  90. package/dist/server.d.cts +35 -0
  91. package/dist/server.d.ts +35 -0
  92. package/dist/server.js +340 -328
  93. package/dist/style.css +1 -1
  94. package/dist/{template-catalog-DLu814zA.js → template-catalog-BbrN9dgu.js} +5 -5
  95. package/dist/{template-catalog-Lil5Ryt-.cjs → template-catalog-DDH-5J57.cjs} +1 -1
  96. package/dist/{template-fragments-BDxdCuMD.js → template-fragments-CUTE8-_I.js} +3 -3
  97. package/dist/{template-fragments-DbKdxI1z.cjs → template-fragments-cyAQu7aw.cjs} +1 -1
  98. package/dist/{template-registry-B-AK1oam.cjs → template-registry-D24Z8aQf.cjs} +1 -1
  99. package/dist/{template-registry-DeVgwEZj.js → template-registry-PSuLsnyq.js} +4 -4
  100. package/dist/{template-serialization-CqQY4zDg.cjs → template-serialization-BOUidUlh.cjs} +1 -1
  101. package/dist/{template-serialization-CWmHq7lX.js → template-serialization-BgGWYV_1.js} +1 -1
  102. package/dist/{textwrap-BywMBMXM.js → textwrap-Bt_tnI6V.js} +1 -1
  103. package/dist/vue/async.d.cts +46 -3
  104. package/dist/vue/async.d.ts +46 -3
  105. package/dist/vue/index.d.cts +215 -24
  106. package/dist/vue/index.d.ts +215 -24
  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 +433 -202
  111. package/dist/workbook-session-BJfZVp4q.cjs +29 -0
  112. package/dist/{workbook-session-B6hRjTyX.js → workbook-session-DRnMjIFK.js} +2377 -2350
  113. package/dist/worker.cjs +1 -1
  114. package/dist/worker.js +4 -4
  115. package/dist/xlsx.cjs +1 -1
  116. package/dist/xlsx.d.cts +27 -2
  117. package/dist/xlsx.d.ts +27 -2
  118. package/dist/xlsx.js +15 -15
  119. package/package.json +1 -1
  120. package/dist/ExcelBindingWizard-bs3F4dD8.js +0 -1486
  121. package/dist/ExcelBindingWizard-jSdjBtWw.cjs +0 -1
  122. package/dist/ReportParamPanel-B27IGJjk.cjs +0 -1
  123. package/dist/ReportPreview-DAU-V3Ov.cjs +0 -6
  124. package/dist/auto-DjmvmcX-.cjs +0 -1
  125. package/dist/capabilities-D4nfhcvB.cjs +0 -1
  126. package/dist/computed-DK6BruFz.cjs +0 -1
  127. package/dist/dataset-IrlXbUvh.cjs +0 -1
  128. package/dist/designer-B597ZdC0.js +0 -7595
  129. package/dist/designer-DFIdv_n7.cjs +0 -2
  130. package/dist/dom-CXWMmwh-.cjs +0 -1
  131. package/dist/dom-DxdCMLzs.js +0 -452
  132. package/dist/json-snapshot-L_gJ7KRS.cjs +0 -2
  133. package/dist/protocol-CymmHWmL.cjs +0 -1
  134. package/dist/region-binding-workflow-EYxvUYJ-.js +0 -977
  135. package/dist/region-binding-workflow-NdkMSFCh.cjs +0 -3
  136. package/dist/rich-text-layout-Ch_N0Ubu.js +0 -52
  137. package/dist/rich-text-layout-yJGuThtC.cjs +0 -3
  138. package/dist/runtime-D8AlfJ6S.js +0 -234
  139. package/dist/runtime-ywf3oLBR.cjs +0 -1
  140. package/dist/workbook-session-BclW7KKH.cjs +0 -29
package/dist/server.js CHANGED
@@ -1,23 +1,23 @@
1
- import { c as W } from "./runtime-D8AlfJ6S.js";
1
+ import { c as W } from "./runtime-BsvAqz4a.js";
2
2
  import { R as A, t as h, c as T, p as Re } from "./sha256-BDQ1Qk7A.js";
3
- import { H as Se, s as Y, I as Ie } from "./json-snapshot-DdzALe8q.js";
3
+ import { H as Se, s as Y, I as Ie } from "./json-snapshot-BZ0CIQln.js";
4
4
  import { R, c as X, s as P, a as H, j as Ee, b as ke, r as Oe } from "./batch-DGCt44XM.js";
5
- import { d as rr, e as nr, f as sr, v as ar, g as or } from "./batch-DGCt44XM.js";
6
- import { r as Ae, a as Pe } from "./template-catalog-DLu814zA.js";
7
- import { p as $, b as le, v as je } from "./template-registry-DeVgwEZj.js";
8
- import { v as pe, s as ee, a as Te } from "./prepared-DO5pe6Ed.js";
5
+ import { d as nr, e as sr, f as or, v as ar, g as ir } from "./batch-DGCt44XM.js";
6
+ import { r as Ae, a as Pe } from "./template-catalog-BbrN9dgu.js";
7
+ import { p as $, b as le, v as je } from "./template-registry-PSuLsnyq.js";
8
+ import { v as pe, s as ee, a as Te } from "./prepared-DhgQ0d-h.js";
9
9
  import { R as Ne, l as Be } from "./param-validation-CnDEd2l-.js";
10
- import { k as we } from "./record-bindings-Cv7lFiof.js";
11
- import { v as ye } from "./dataset-DL83majE.js";
12
- import { c as me } from "./media-Y90dHK9z.js";
13
- import { R as $e } from "./diagnostic-collector-gB07PHy2.js";
14
- function zt(e = {}) {
10
+ import { k as we } from "./record-bindings-DBrCu6zO.js";
11
+ import { v as me } from "./dataset-B8oTsC6o.js";
12
+ import { c as ye } from "./media-Y90dHK9z.js";
13
+ import { R as $e } from "./diagnostic-collector-C-JBA016.js";
14
+ function _t(e = {}) {
15
15
  const t = e.concurrency ?? 1, r = e.maxQueued ?? 20;
16
16
  if (!Number.isSafeInteger(t) || t < 1 || !Number.isSafeInteger(r) || r < 0) throw new A("budget", "队列并发应为正整数,排队上限应为非负整数");
17
- const n = [], s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
18
- let o = !1, u = 0;
17
+ const n = [], s = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set();
18
+ let a = !1, u = 0;
19
19
  const f = () => {
20
- for (; !o && s.size < t && n.length; ) n.shift().start();
20
+ for (; !a && s.size < t && n.length; ) n.shift().start();
21
21
  };
22
22
  return {
23
23
  get active() {
@@ -27,16 +27,16 @@ function zt(e = {}) {
27
27
  return n.length;
28
28
  },
29
29
  enqueue: (i, d = {}) => {
30
- if (o) throw new A("closed", "任务队列已关闭");
30
+ if (a) throw new A("closed", "任务队列已关闭");
31
31
  if (h(d.signal), s.size >= t && n.length >= r) throw new A("queue-full", "报表任务队列已满");
32
32
  const l = d.id ?? `report-${++u}`;
33
- if (a.has(l)) throw new A("queue-full", "任务 ID 正在执行或排队");
33
+ if (o.has(l)) throw new A("queue-full", "任务 ID 正在执行或排队");
34
34
  const p = new AbortController();
35
- let w = "queued", g, y, m, v;
35
+ let w = "queued", g, m, y, v;
36
36
  const N = new Promise((S, k) => {
37
- m = S, v = k;
37
+ y = S, v = k;
38
38
  }), M = () => {
39
- d.signal?.removeEventListener("abort", C), a.delete(l);
39
+ d.signal?.removeEventListener("abort", C), o.delete(l);
40
40
  }, E = (S) => {
41
41
  if (w !== "queued" && w !== "running") return;
42
42
  const k = w === "queued";
@@ -53,13 +53,13 @@ function zt(e = {}) {
53
53
  }, C = () => E(d.signal?.reason), Z = (S, k) => {
54
54
  w === "running" && (!Number.isFinite(S) || S < 0 || k !== void 0 && (!Number.isFinite(k) || k < S) || (g = { completed: S, ...k === void 0 ? {} : { total: k } }));
55
55
  }, B = (S) => {
56
- w !== "running" || p.signal.aborted || (y = { ...S, taskId: l }, S.completed !== void 0 && Z(S.completed, S.total), Se(d.onEvent, y, p.signal));
56
+ w !== "running" || p.signal.aborted || (m = { ...S, taskId: l }, S.completed !== void 0 && Z(S.completed, S.total), Se(d.onEvent, m, p.signal));
57
57
  }, I = {
58
58
  cancel: E,
59
59
  start: () => {
60
60
  w === "queued" && (w = "running", s.add(I), Promise.resolve().then(() => (h(p.signal), i({ taskId: l, signal: p.signal, reportProgress: Z, onEvent: B }))).then(
61
61
  (S) => {
62
- w === "running" && (w = "completed", m(S));
62
+ w === "running" && (w = "completed", y(S));
63
63
  },
64
64
  (S) => {
65
65
  w === "running" && (w = "failed", v(S));
@@ -69,16 +69,16 @@ function zt(e = {}) {
69
69
  }));
70
70
  }
71
71
  };
72
- return a.add(l), d.signal?.addEventListener("abort", C, { once: !0 }), d.signal?.aborted ? E(d.signal.reason) : s.size < t ? I.start() : n.push(I), { id: l, get status() {
72
+ return o.add(l), d.signal?.addEventListener("abort", C, { once: !0 }), d.signal?.aborted ? E(d.signal.reason) : s.size < t ? I.start() : n.push(I), { id: l, get status() {
73
73
  return w;
74
74
  }, get progress() {
75
75
  return g;
76
76
  }, get event() {
77
- return y;
77
+ return m;
78
78
  }, result: N, cancel: E };
79
79
  },
80
80
  close: (i = {}) => {
81
- o = !0;
81
+ a = !0;
82
82
  for (const d of [...n]) d.cancel(new A("closed", "任务队列已关闭"));
83
83
  if (i.cancelRunning) for (const d of s) d.cancel(new A("closed", "任务队列已关闭"));
84
84
  }
@@ -86,8 +86,8 @@ function zt(e = {}) {
86
86
  }
87
87
  function Me(e) {
88
88
  let t, r;
89
- const n = new Promise((s, a) => {
90
- t = s, r = a;
89
+ const n = new Promise((s, o) => {
90
+ t = s, r = o;
91
91
  });
92
92
  return n.catch(() => {
93
93
  }), { progress: e, promise: n, resolve: t, reject: r };
@@ -98,23 +98,23 @@ function te(e) {
98
98
  }), t;
99
99
  }
100
100
  function De(e, t) {
101
- let r, n, s = !0, a;
102
- function o(c) {
103
- a ??= c ?? new Error("任务心跳更新失败"), n?.reject(a), n = void 0, t(a);
101
+ let r, n, s = !0, o;
102
+ function a(c) {
103
+ o ??= c ?? new Error("任务心跳更新失败"), n?.reject(o), n = void 0, t(o);
104
104
  }
105
105
  function u(c) {
106
106
  const i = Promise.resolve().then(() => e(c?.progress)).then(
107
107
  () => c?.resolve(),
108
108
  (d) => {
109
- c?.reject(d), o(d);
109
+ c?.reject(d), a(d);
110
110
  }
111
111
  ).finally(() => {
112
112
  r = void 0;
113
113
  const d = n;
114
- n = void 0, d && a === void 0 && u(d);
114
+ n = void 0, d && o === void 0 && u(d);
115
115
  });
116
116
  r = i, i.catch((d) => {
117
- o(d);
117
+ a(d);
118
118
  });
119
119
  }
120
120
  function f(c) {
@@ -122,7 +122,7 @@ function De(e, t) {
122
122
  return te(
123
123
  new R("closed", "任务进度上报已结束")
124
124
  );
125
- if (a !== void 0) return te(a);
125
+ if (o !== void 0) return te(o);
126
126
  n ? n.progress = c : n = Me(c);
127
127
  const i = n;
128
128
  return r || (n = void 0, u(i)), i.promise;
@@ -130,11 +130,11 @@ function De(e, t) {
130
130
  return {
131
131
  progress: f,
132
132
  pulse() {
133
- s && !r && a === void 0 && u();
133
+ s && !r && o === void 0 && u();
134
134
  },
135
135
  async finish() {
136
136
  for (s = !1; r; ) await r;
137
- if (a !== void 0) throw a;
137
+ if (o !== void 0) throw o;
138
138
  }
139
139
  };
140
140
  }
@@ -146,7 +146,7 @@ class re extends R {
146
146
  function Je(e) {
147
147
  const t = e.concurrency ?? 1, r = e.leaseMs ?? 3e4, n = e.heartbeatMs ?? 1e4, s = e.maxResultBytes ?? 256 * 1024;
148
148
  if (![t, r, n, s].every(
149
- (o) => Number.isSafeInteger(o) && o > 0
149
+ (a) => Number.isSafeInteger(a) && a > 0
150
150
  ) || n * 2 > r)
151
151
  throw new R(
152
152
  "input",
@@ -158,10 +158,10 @@ function Je(e) {
158
158
  "心跳间隔超过平台定时器上限(2147483647毫秒)"
159
159
  );
160
160
  return { concurrency: t, leaseMs: r, heartbeatMs: n, maxResultBytes: s, now: () => {
161
- const o = (e.now ?? Date.now)();
162
- if (!Number.isSafeInteger(o) || o < 0)
161
+ const a = (e.now ?? Date.now)();
162
+ if (!Number.isSafeInteger(a) || a < 0)
163
163
  throw new R("input", "任务时钟应返回非负整数毫秒");
164
- return o;
164
+ return a;
165
165
  } };
166
166
  }
167
167
  async function F(e, t, r) {
@@ -172,7 +172,7 @@ async function F(e, t, r) {
172
172
  }
173
173
  async function q(e, t, r, n = []) {
174
174
  const s = { ...t, ...r, revision: t.revision + 1 };
175
- for (const a of n) delete s[a];
175
+ for (const o of n) delete s[o];
176
176
  if (!await e.compareAndSwap(
177
177
  t.scope,
178
178
  t.id,
@@ -186,7 +186,7 @@ async function Ce(e, t, r, n) {
186
186
  if (!t.trim() || t.length > 128)
187
187
  throw new R("input", "workerId应为1–128位标识");
188
188
  for (const s of await e.store.candidates(n, 100)) {
189
- const a = s.cancelRequested ? {
189
+ const o = s.cancelRequested ? {
190
190
  ...s,
191
191
  revision: s.revision + 1,
192
192
  status: "cancelled",
@@ -199,71 +199,71 @@ async function Ce(e, t, r, n) {
199
199
  updatedAt: n,
200
200
  lease: { owner: t, expiresAt: n + r }
201
201
  };
202
- if (a.status === "cancelled" && delete a.lease, await e.store.compareAndSwap(
202
+ if (o.status === "cancelled" && delete o.lease, await e.store.compareAndSwap(
203
203
  s.scope,
204
204
  s.id,
205
205
  s.revision,
206
- a
206
+ o
207
207
  ))
208
- return a;
208
+ return o;
209
209
  }
210
210
  }
211
211
  function ne(e, t, r, n) {
212
212
  return e.status === "running" && e.attempt === n && e.lease?.owner === t && e.lease.expiresAt > r;
213
213
  }
214
214
  async function qe(e, t, r, n) {
215
- const { scope: s, id: a } = r, o = r.lease.owner;
215
+ const { scope: s, id: o } = r, a = r.lease.owner;
216
216
  let u;
217
217
  const f = De(
218
- async (y) => {
219
- const m = await F(e.store, s, a), v = t.now();
220
- if (!ne(m, o, v, r.attempt))
218
+ async (m) => {
219
+ const y = await F(e.store, s, o), v = t.now();
220
+ if (!ne(y, a, v, r.attempt))
221
221
  throw new R("lease", "报表任务租约已失效");
222
- if (m.cancelRequested) {
222
+ if (y.cancelRequested) {
223
223
  n.abort(new R("closed", "任务已请求取消"));
224
224
  return;
225
225
  }
226
- await q(e.store, m, {
226
+ await q(e.store, y, {
227
227
  updatedAt: v,
228
- lease: { owner: o, expiresAt: v + t.leaseMs },
229
- ...y ? { progress: y } : {}
228
+ lease: { owner: a, expiresAt: v + t.leaseMs },
229
+ ...m ? { progress: m } : {}
230
230
  });
231
231
  },
232
- (y) => {
233
- u = y, n.abort(y);
232
+ (m) => {
233
+ u = m, n.abort(m);
234
234
  }
235
- ), c = (y, m) => !Number.isFinite(y) || y < 0 || m !== void 0 && (!Number.isFinite(m) || m < y) ? Promise.reject(new R("input", "任务进度无效")) : f.progress({
236
- completed: y,
237
- ...m === void 0 ? {} : { total: m }
235
+ ), c = (m, y) => !Number.isFinite(m) || m < 0 || y !== void 0 && (!Number.isFinite(y) || y < m) ? Promise.reject(new R("input", "任务进度无效")) : f.progress({
236
+ completed: m,
237
+ ...y === void 0 ? {} : { total: y }
238
238
  }), i = setInterval(() => {
239
239
  f.pulse();
240
240
  }, t.heartbeatMs);
241
241
  let d, l;
242
242
  try {
243
- const y = Object.prototype.hasOwnProperty.call(
243
+ const m = Object.prototype.hasOwnProperty.call(
244
244
  e.handlers,
245
245
  r.request.kind
246
246
  ) ? e.handlers[r.request.kind] : void 0;
247
- if (!y) throw new R("input", "报表任务处理器未注册");
247
+ if (!m) throw new R("input", "报表任务处理器未注册");
248
248
  if (!n.signal.aborted) {
249
- const m = await y(H(r.request.payload), {
249
+ const y = await m(H(r.request.payload), {
250
250
  scope: s,
251
- taskId: a,
251
+ taskId: o,
252
252
  attempt: r.attempt,
253
- executionToken: JSON.stringify([s, a, r.attempt]),
253
+ executionToken: JSON.stringify([s, o, r.attempt]),
254
254
  signal: n.signal,
255
255
  reportProgress: c
256
256
  });
257
- if (d = JSON.parse(P(m)), Ee(d) > t.maxResultBytes) throw new re();
257
+ if (d = JSON.parse(P(y)), Ee(d) > t.maxResultBytes) throw new re();
258
258
  }
259
- } catch (y) {
260
- l = y ?? new Error("报表任务执行失败");
259
+ } catch (m) {
260
+ l = m ?? new Error("报表任务执行失败");
261
261
  } finally {
262
262
  clearInterval(i), await f.finish().catch(() => {
263
263
  });
264
264
  }
265
- const p = await F(e.store, s, a), w = t.now();
266
- if (!ne(p, o, w, r.attempt))
265
+ const p = await F(e.store, s, o), w = t.now();
266
+ if (!ne(p, a, w, r.attempt))
267
267
  throw new R("lease", "任务租约已失效,迟到结果不会写回");
268
268
  const g = { ...p, updatedAt: w };
269
269
  delete g.lease, l ??= u, p.cancelRequested || n.signal.aborted && u === void 0 ? g.status = "cancelled" : l !== void 0 ? (g.status = "failed", g.error = {
@@ -295,11 +295,11 @@ async function se(e, t, r, n) {
295
295
  return { scope: t, id: r, revision: s.revision, request: H(n), status: s.status, createdAt: s.createdAt, updatedAt: s.updatedAt, attempt: s.attempt, archived: !0 };
296
296
  }
297
297
  }
298
- function _t(e) {
298
+ function Lt(e) {
299
299
  e = { ...e, handlers: { ...e.handlers } };
300
300
  const t = Je(e), r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
301
- let s = !1, a = 0;
302
- const o = (c, i) => (X(c, i), e.store.read(c, i));
301
+ let s = !1, o = 0;
302
+ const a = (c, i) => (X(c, i), e.store.read(c, i));
303
303
  return {
304
304
  submit: async (c) => {
305
305
  if (c = { ...c }, X(c.scope, c.id), !Object.prototype.hasOwnProperty.call(e.handlers, c.kind) || typeof e.handlers[c.kind] != "function")
@@ -312,7 +312,7 @@ function _t(e) {
312
312
  maxCharacters: 75e4
313
313
  })
314
314
  )
315
- }, d = await o(c.scope, c.id);
315
+ }, d = await a(c.scope, c.id);
316
316
  if (d) {
317
317
  if (P(d.request) !== P(i))
318
318
  throw new R("conflict", "相同任务ID不能提交不同内容");
@@ -331,24 +331,24 @@ function _t(e) {
331
331
  attempt: 0
332
332
  };
333
333
  if (!await e.store.compareAndSwap(c.scope, c.id, null, w)) {
334
- const g = await o(c.scope, c.id);
334
+ const g = await a(c.scope, c.id);
335
335
  if (g && P(g.request) === P(i))
336
336
  return g;
337
- const y = await se(e.store, c.scope, c.id, i);
338
- if (y) return y;
337
+ const m = await se(e.store, c.scope, c.id, i);
338
+ if (m) return m;
339
339
  throw new R("conflict", "报表任务提交发生冲突");
340
340
  }
341
341
  return H(w);
342
342
  },
343
- get: o,
343
+ get: a,
344
344
  runNext: (c) => {
345
345
  if (s)
346
346
  return Promise.reject(new R("closed", "报表任务服务已关闭"));
347
- if (a >= t.concurrency)
347
+ if (o >= t.concurrency)
348
348
  return Promise.reject(
349
349
  new R("capacity", "报表任务执行槽位已满")
350
350
  );
351
- a++;
351
+ o++;
352
352
  const i = new AbortController();
353
353
  r.add(i);
354
354
  const d = (async () => {
@@ -361,7 +361,7 @@ function _t(e) {
361
361
  );
362
362
  return l?.status === "running" ? await qe(e, t, l, i) : l;
363
363
  } finally {
364
- a--, r.delete(i);
364
+ o--, r.delete(i);
365
365
  }
366
366
  })();
367
367
  return n.add(d), d.then(
@@ -370,7 +370,7 @@ function _t(e) {
370
370
  ), d;
371
371
  },
372
372
  get active() {
373
- return a;
373
+ return o;
374
374
  },
375
375
  cancel: async (c, i) => {
376
376
  const d = await F(e.store, c, i);
@@ -414,17 +414,17 @@ function ge(e, t) {
414
414
  assetBudget: { ...r?.assetBudget, ...n?.assetBudget }
415
415
  };
416
416
  }
417
- function ae(e, t) {
417
+ function oe(e, t) {
418
418
  if (!e || e.code !== "missing-image" || e.format !== "pdf" && e.format !== "xlsx") return !1;
419
419
  const r = ge(t, e.format);
420
420
  return typeof r?.assetRenderers?.[e.kind] == "function" || !!(e.extension && r?.assetRegistry?.hasExtension(e.extension.id, e.extension.version, e.kind));
421
421
  }
422
422
  function _e(e, t) {
423
- const r = Ae(e, t), n = r.issues.filter((a) => !ae(a.diagnostic, t)), s = r.samples.map((a) => ({ ...a, diagnostics: a.diagnostics.filter((o) => !ae(o, t)) }));
424
- return { ...r, issues: n, samples: s, ok: n.every((a) => a.severity !== "error"), artifacts: [] };
423
+ const r = Ae(e, t), n = r.issues.filter((o) => !oe(o.diagnostic, t)), s = r.samples.map((o) => ({ ...o, diagnostics: o.diagnostics.filter((a) => !oe(a, t)) }));
424
+ return { ...r, issues: n, samples: s, ok: n.every((o) => o.severity !== "error"), artifacts: [] };
425
425
  }
426
426
  async function Le(e, t, r, n, s) {
427
- const a = W({ reports: { sample: { template: r, datasets: e.datasets } }, assets: ge(n, t), budget: {
427
+ const o = W({ reports: { sample: { template: r, datasets: e.datasets } }, assets: ge(n, t), budget: {
428
428
  maxRows: n.maxSampleRows ?? 1e3,
429
429
  maxPages: n.maxPages ?? 100,
430
430
  maxCells: n.maxCells ?? 25e4,
@@ -432,28 +432,28 @@ async function Le(e, t, r, n, s) {
432
432
  maxDurationMs: n.maxDurationMs ?? 3e4
433
433
  } });
434
434
  try {
435
- const { result: o, digest: u } = await T(n.signal, n.maxDurationMs ?? 3e4, async (f) => {
436
- const c = await a.export({ reportIds: ["sample"], params: e.params, format: t, signal: f, fidelity: n.strictOutputs ? "strict" : "warn", pdf: n.pdf, xlsx: n.xlsx }), i = c.diagnostics.filter((l) => l.severity !== "info");
435
+ const { result: a, digest: u } = await T(n.signal, n.maxDurationMs ?? 3e4, async (f) => {
436
+ const c = await o.export({ reportIds: ["sample"], params: e.params, format: t, signal: f, fidelity: n.strictOutputs ? "strict" : "warn", pdf: n.pdf, xlsx: n.xlsx }), i = c.diagnostics.filter((l) => l.severity !== "info");
437
437
  if (n.strictOutputs && i.length) throw new Error(`Strict ${t} encoding found fidelity issues: ${i.slice(0, 3).map((l) => l.message).join("; ")}`);
438
438
  const d = await n.digest?.(c.bytes);
439
439
  return h(f), await n.onArtifact?.(e.name, c), h(f), { result: c, digest: d };
440
440
  });
441
- s.artifacts.push({ fixture: e.name, format: t, bytes: o.bytes.byteLength, pages: o.stats.pages, ...u ? { digest: u } : {} }), s.issues.push(...o.diagnostics.map((f) => ({ code: "output", severity: n.strictOutputs || f.severity === "error" ? "error" : "warning", path: "$.template", fixture: e.name, message: `${t}: ${f.message}` })));
442
- } catch (o) {
443
- h(n.signal), s.issues.push({ code: "output", severity: "error", path: "$.template", fixture: e.name, message: `${t}: ${o instanceof Error ? o.message : String(o)}` });
441
+ s.artifacts.push({ fixture: e.name, format: t, bytes: a.bytes.byteLength, pages: a.stats.pages, ...u ? { digest: u } : {} }), s.issues.push(...a.diagnostics.map((f) => ({ code: "output", severity: n.strictOutputs || f.severity === "error" ? "error" : "warning", path: "$.template", fixture: e.name, message: `${t}: ${f.message}` })));
442
+ } catch (a) {
443
+ h(n.signal), s.issues.push({ code: "output", severity: "error", path: "$.template", fixture: e.name, message: `${t}: ${a instanceof Error ? a.message : String(a)}` });
444
444
  }
445
445
  }
446
- async function Lt(e, t = {}) {
446
+ async function Ft(e, t = {}) {
447
447
  h(t.signal);
448
448
  const r = _e(e, t);
449
449
  if (!r.ok) return r;
450
450
  const n = $(e).template, s = [...new Set(t.formats ?? ["pdf", "xlsx"])];
451
- if (!s.length || s.some((a) => a !== "pdf" && a !== "xlsx"))
451
+ if (!s.length || s.some((o) => o !== "pdf" && o !== "xlsx"))
452
452
  return r.issues.push({ code: "output", severity: "error", path: "$.formats", message: "真实文件验收应至少选择PDF/XLSX之一" }), r.ok = !1, r;
453
- for (const a of t.fixtures ?? [])
454
- for (const o of s)
455
- h(t.signal), !(o !== "pdf" && o !== "xlsx") && await Le(a, o, n, t, r);
456
- return r.ok = r.issues.every((a) => a.severity !== "error"), r;
453
+ for (const o of t.fixtures ?? [])
454
+ for (const a of s)
455
+ h(t.signal), !(a !== "pdf" && a !== "xlsx") && await Le(o, a, n, t, r);
456
+ return r.ok = r.issues.every((o) => o.severity !== "error"), r;
457
457
  }
458
458
  class b extends Error {
459
459
  constructor(t, r) {
@@ -481,7 +481,7 @@ function he(e, t) {
481
481
  if (!Number.isSafeInteger(t) || t < 1) throw new b("input", "实例快照字节预算应为正安全整数");
482
482
  let r = 0, n = 0;
483
483
  const s = /* @__PURE__ */ new Set();
484
- function a(u, f) {
484
+ function o(u, f) {
485
485
  if (++r > 1e6 || f > 64) throw new b("capacity", "实例节点或嵌套深度超过预算");
486
486
  if (typeof u == "string" && (n += u.length, n > t))
487
487
  throw new b("capacity", "实例文本超过预算");
@@ -494,7 +494,7 @@ function he(e, t) {
494
494
  if (n += d.length, n > t) throw new b("capacity", "实例文本超过预算");
495
495
  const l = Object.getOwnPropertyDescriptor(u, d);
496
496
  if (l.get || l.set || ["__proto__", "constructor", "prototype"].includes(d)) throw new b("input", "实例不能包含访问器或危险键");
497
- l.value !== void 0 && (i[d] = a(l.value, f + 1));
497
+ l.value !== void 0 && (i[d] = o(l.value, f + 1));
498
498
  }
499
499
  if (s.delete(u), c) {
500
500
  if (Object.keys(i).length !== u.length) throw new b("input", "实例数组不能稀疏或包含额外属性");
@@ -502,24 +502,24 @@ function he(e, t) {
502
502
  }
503
503
  return i;
504
504
  }
505
- const o = JSON.stringify(a(e, 0));
506
- if (new TextEncoder().encode(o).byteLength > t) throw new b("capacity", "实例快照超过单条字节预算");
507
- return o;
505
+ const a = JSON.stringify(o(e, 0));
506
+ if (new TextEncoder().encode(a).byteLength > t) throw new b("capacity", "实例快照超过单条字节预算");
507
+ return a;
508
508
  }
509
509
  function G(e, t = 8e6) {
510
510
  const r = JSON.parse(he(e, t));
511
511
  J(r.scope, r.id);
512
512
  const n = /* @__PURE__ */ new Set(["scope", "id", "revision", "title", "generatedAt", "reportIds", "params", "templateRevisions", "sourceRevisions", "plan", "artifacts", "output"]);
513
- if (Object.keys(r).some((a) => !n.has(a))) throw new b("input", "实例包含未知字段");
513
+ if (Object.keys(r).some((o) => !n.has(o))) throw new b("input", "实例包含未知字段");
514
514
  Ve(r);
515
- for (const a of [r.params, r.templateRevisions, r.sourceRevisions])
516
- if (!a || typeof a != "object" || Array.isArray(a) || Object.values(a).some((o) => typeof o != "string")) throw new b("input", "实例参数和修订应为字符串字典");
517
- if (r.reportIds.some((a) => !r.templateRevisions[a])) throw new b("input", "每张报表都应记录生成时的模板修订");
515
+ for (const o of [r.params, r.templateRevisions, r.sourceRevisions])
516
+ if (!o || typeof o != "object" || Array.isArray(o) || Object.values(o).some((a) => typeof a != "string")) throw new b("input", "实例参数和修订应为字符串字典");
517
+ if (r.reportIds.some((o) => !r.templateRevisions[o])) throw new b("input", "每张报表都应记录生成时的模板修订");
518
518
  const s = le(r.plan);
519
519
  if (!s.ok) throw new b("input", `实例渲染计划无效:${s.errors[0]?.path}`);
520
520
  if (r.output !== void 0) {
521
- if (!r.output || Object.keys(r.output).some((a) => !["stats", "diagnostics", "layout", "sources"].includes(a))) throw new b("input", "实例输出元数据只允许统计、诊断和字体度量;不保存来源令牌");
522
- if (pe({ ...r.output, plan: r.plan, revisions: {} }), r.output.sources?.some((a) => "sourceToken" in a)) throw new b("input", "实例来源清单不保存来源令牌");
521
+ if (!r.output || Object.keys(r.output).some((o) => !["stats", "diagnostics", "layout", "sources"].includes(o))) throw new b("input", "实例输出元数据只允许统计、诊断和字体度量;不保存来源令牌");
522
+ if (pe({ ...r.output, plan: r.plan, revisions: {} }), r.output.sources?.some((o) => "sourceToken" in o)) throw new b("input", "实例来源清单不保存来源令牌");
523
523
  }
524
524
  return r.artifacts !== void 0 && Ue(r.artifacts), r;
525
525
  }
@@ -532,36 +532,36 @@ function Ue(e) {
532
532
  }
533
533
  }
534
534
  function Ze(e) {
535
- const { scope: t, id: r, revision: n, title: s, generatedAt: a, reportIds: o, params: u, templateRevisions: f, sourceRevisions: c } = e;
536
- return JSON.parse(JSON.stringify({ scope: t, id: r, revision: n, title: s, generatedAt: a, reportIds: o, params: u, templateRevisions: f, sourceRevisions: c }));
535
+ const { scope: t, id: r, revision: n, title: s, generatedAt: o, reportIds: a, params: u, templateRevisions: f, sourceRevisions: c } = e;
536
+ return JSON.parse(JSON.stringify({ scope: t, id: r, revision: n, title: s, generatedAt: o, reportIds: a, params: u, templateRevisions: f, sourceRevisions: c }));
537
537
  }
538
538
  function Ke(e) {
539
539
  const t = { maxInstances: 100, maxRevisions: 20, maxBytes: 64e6, maxSnapshotBytes: 8e6, ...e };
540
540
  if (Object.values(t).some((r) => !Number.isSafeInteger(r) || r < 1)) throw new b("input", "实例存储预算应为正安全整数");
541
541
  return t;
542
542
  }
543
- function Ft(e = {}) {
543
+ function Vt(e = {}) {
544
544
  const t = Ke(e), r = /* @__PURE__ */ new Map();
545
545
  let n = 0;
546
546
  return {
547
- read: async (s, a, o, u) => {
548
- h(u), J(s, a);
549
- const f = r.get(JSON.stringify([s, a])), c = f?.get(o ?? f.size);
547
+ read: async (s, o, a, u) => {
548
+ h(u), J(s, o);
549
+ const f = r.get(JSON.stringify([s, o])), c = f?.get(a ?? f.size);
550
550
  return c ? G(c, t.maxSnapshotBytes) : void 0;
551
551
  },
552
- list: async (s, a = {}) => {
553
- h(a.signal), J(s, "list");
554
- const o = a.limit ?? 25;
555
- if (!Number.isSafeInteger(o) || o < 1 || o > 100) throw new b("input", "实例每页数量应为 1–100");
556
- const u = Array.from(r.values(), (f) => f.get(f.size)).filter((f) => f.scope === s && (!a.after || f.id > a.after) && (!a.reportId || f.reportIds.includes(a.reportId))).sort((f, c) => f.id < c.id ? -1 : 1).slice(0, o + 1);
557
- return { items: u.slice(0, o).map(Ze), ...u.length > o ? { next: u[o - 1].id } : {} };
552
+ list: async (s, o = {}) => {
553
+ h(o.signal), J(s, "list");
554
+ const a = o.limit ?? 25;
555
+ if (!Number.isSafeInteger(a) || a < 1 || a > 100) throw new b("input", "实例每页数量应为 1–100");
556
+ const u = Array.from(r.values(), (f) => f.get(f.size)).filter((f) => f.scope === s && (!o.after || f.id > o.after) && (!o.reportId || f.reportIds.includes(o.reportId))).sort((f, c) => f.id < c.id ? -1 : 1).slice(0, a + 1);
557
+ return { items: u.slice(0, a).map(Ze), ...u.length > a ? { next: u[a - 1].id } : {} };
558
558
  },
559
- compareAndSwap: async (s, a, o, u, f) => {
560
- h(f), J(s, a);
559
+ compareAndSwap: async (s, o, a, u, f) => {
560
+ h(f), J(s, o);
561
561
  const c = G(u, t.maxSnapshotBytes);
562
- if (c.scope !== s || c.id !== a || c.revision !== (o ?? 0) + 1) throw new b("input", "实例身份或修订不一致");
563
- const i = JSON.stringify([s, a]), d = r.get(i) ?? /* @__PURE__ */ new Map();
564
- if ((d.size || null) !== o) return !1;
562
+ if (c.scope !== s || c.id !== o || c.revision !== (a ?? 0) + 1) throw new b("input", "实例身份或修订不一致");
563
+ const i = JSON.stringify([s, o]), d = r.get(i) ?? /* @__PURE__ */ new Map();
564
+ if ((d.size || null) !== a) return !1;
565
565
  const l = new TextEncoder().encode(JSON.stringify(c)).byteLength;
566
566
  if (d.size >= t.maxRevisions || n + l > t.maxBytes || !d.size && r.size >= t.maxInstances) throw new b("capacity", "实例存储达到预算,请使用持久化归档策略或显式调整容量");
567
567
  return d.set(c.revision, c), r.set(i, d), n += l, !0;
@@ -575,15 +575,15 @@ function Xe(e, t = {}) {
575
575
  read: e.read.bind(e),
576
576
  list: e.list.bind(e),
577
577
  save: async (n, s) => {
578
- const a = s.expectedRevision;
579
- if (a !== null && (!Number.isSafeInteger(a) || a < 1 || a >= Number.MAX_SAFE_INTEGER)) throw new b("input", "实例预期修订无效");
580
- const o = JSON.parse(he(n, r)), u = G({ ...o, revision: (a ?? 0) + 1 }, r);
581
- if (h(s.signal), !await e.compareAndSwap(u.scope, u.id, a, u, s.signal)) throw new b("conflict", "实例已存在或已变化,请显式确认修订后保存");
578
+ const o = s.expectedRevision;
579
+ if (o !== null && (!Number.isSafeInteger(o) || o < 1 || o >= Number.MAX_SAFE_INTEGER)) throw new b("input", "实例预期修订无效");
580
+ const a = JSON.parse(he(n, r)), u = G({ ...a, revision: (o ?? 0) + 1 }, r);
581
+ if (h(s.signal), !await e.compareAndSwap(u.scope, u.id, o, u, s.signal)) throw new b("conflict", "实例已存在或已变化,请显式确认修订后保存");
582
582
  return u;
583
583
  }
584
584
  };
585
585
  }
586
- function Vt(e, t) {
586
+ function Ht(e, t) {
587
587
  return P({ reportIds: e, params: t });
588
588
  }
589
589
  function Ge(e) {
@@ -592,9 +592,9 @@ function Ge(e) {
592
592
  let r;
593
593
  const n = /* @__PURE__ */ new Set(["scope", "id", "title", "reportIds", "params", "expectedRevision", "signal"]);
594
594
  for (const s of Object.getOwnPropertyNames(e)) {
595
- const a = Object.getOwnPropertyDescriptor(e, s);
596
- if (!n.has(s) || !a.enumerable || a.get || a.set) throw new b("input", "生成请求不能包含未知字段或访问器");
597
- s === "signal" ? r = a.value : a.value !== void 0 && (t[s] = a.value);
595
+ const o = Object.getOwnPropertyDescriptor(e, s);
596
+ if (!n.has(s) || !o.enumerable || o.get || o.set) throw new b("input", "生成请求不能包含未知字段或访问器");
597
+ s === "signal" ? r = o.value : o.value !== void 0 && (t[s] = o.value);
598
598
  }
599
599
  return { signal: r, request: JSON.parse(P(t)) };
600
600
  }
@@ -602,51 +602,51 @@ function Qe(e) {
602
602
  const t = JSON.parse(P(e.templateRevisions)), r = ee(e.pdf), n = Xe(e.instances, { maxSnapshotBytes: e.maxSnapshotBytes });
603
603
  return {
604
604
  async generate(s) {
605
- const { signal: a, request: o } = Ge(s);
606
- if (J(o.scope, o.id), o.expectedRevision !== null && (!Number.isSafeInteger(o.expectedRevision) || o.expectedRevision < 1)) throw new b("input", "实例预期修订无效");
607
- const u = e.runtime.validate(o);
605
+ const { signal: o, request: a } = Ge(s);
606
+ if (J(a.scope, a.id), a.expectedRevision !== null && (!Number.isSafeInteger(a.expectedRevision) || a.expectedRevision < 1)) throw new b("input", "实例预期修订无效");
607
+ const u = e.runtime.validate(a);
608
608
  if (!u.ok) throw new Ne(u.issues);
609
609
  const f = /* @__PURE__ */ Object.create(null);
610
- for (const m of o.reportIds) {
611
- if (typeof t[m] != "string" || !t[m]) throw new TypeError(`报表 ${m} 缺少生成时的模板修订`);
612
- f[m] = t[m];
610
+ for (const y of a.reportIds) {
611
+ if (typeof t[y] != "string" || !t[y]) throw new TypeError(`报表 ${y} 缺少生成时的模板修订`);
612
+ f[y] = t[y];
613
613
  }
614
- if (h(a), ((await e.instances.read(o.scope, o.id, void 0, a))?.revision ?? null) !== o.expectedRevision)
614
+ if (h(o), ((await e.instances.read(a.scope, a.id, void 0, o))?.revision ?? null) !== a.expectedRevision)
615
615
  throw new b("conflict", "实例已存在或已变化,请显式确认修订后生成");
616
- const i = await e.runtime.prepare({ reportIds: o.reportIds, params: u.values, pdf: r, signal: a });
617
- h(a);
616
+ const i = await e.runtime.prepare({ reportIds: a.reportIds, params: u.values, pdf: r, signal: o });
617
+ h(o);
618
618
  const d = /* @__PURE__ */ Object.create(null);
619
- for (const [m, v] of Object.entries(i.revisions)) v.revision !== void 0 && (d[m] = v.revision);
620
- const { plan: l, revisions: p, sources: w, ...g } = i, y = { ...g, ...w ? { sources: w.map(({ sourceToken: m, ...v }) => v) } : {} };
619
+ for (const [y, v] of Object.entries(i.revisions)) v.revision !== void 0 && (d[y] = v.revision);
620
+ const { plan: l, revisions: p, sources: w, ...g } = i, m = { ...g, ...w ? { sources: w.map(({ sourceToken: y, ...v }) => v) } : {} };
621
621
  return n.save({
622
- scope: o.scope,
623
- id: o.id,
624
- title: o.title,
625
- reportIds: o.reportIds,
622
+ scope: a.scope,
623
+ id: a.id,
624
+ title: a.title,
625
+ reportIds: a.reportIds,
626
626
  params: u.values,
627
627
  templateRevisions: f,
628
628
  sourceRevisions: d,
629
629
  generatedAt: (e.now?.() ?? /* @__PURE__ */ new Date()).toISOString(),
630
630
  plan: l,
631
- output: y
632
- }, { expectedRevision: o.expectedRevision, signal: a });
631
+ output: m
632
+ }, { expectedRevision: a.expectedRevision, signal: o });
633
633
  },
634
634
  read: n.read,
635
635
  list: n.list,
636
636
  /** Read an immutable saved revision and encode its plan, never re-query the business source. */
637
637
  async exportInstance(s) {
638
- const { scope: a, id: o, revision: u, signal: f, format: c, fidelity: i, taskId: d, correlationId: l, onEvent: p } = s, w = ee(s.pdf ?? r), g = Te(s.xlsx);
639
- J(a, o), h(f);
640
- const y = await n.read(a, o, u, f);
641
- if (!y) throw new b("input", "报表实例不存在");
642
- const m = {
643
- plan: y.plan,
644
- revisions: Object.fromEntries(y.reportIds.map((v) => [v, { revision: y.sourceRevisions[v] }])),
638
+ const { scope: o, id: a, revision: u, signal: f, format: c, fidelity: i, taskId: d, correlationId: l, onEvent: p } = s, w = ee(s.pdf ?? r), g = Te(s.xlsx);
639
+ J(o, a), h(f);
640
+ const m = await n.read(o, a, u, f);
641
+ if (!m) throw new b("input", "报表实例不存在");
642
+ const y = {
643
+ plan: m.plan,
644
+ revisions: Object.fromEntries(m.reportIds.map((v) => [v, { revision: m.sourceRevisions[v] }])),
645
645
  diagnostics: [{ code: "instance-row-count", severity: "info", message: "历史实例未保存原始取数行数;本次 rows 统计为 0,页面及单元格数由已保存计划校验。" }],
646
- stats: { rows: 0, pages: y.plan.pages.length, cells: 0, durationMs: 0 },
647
- ...y.output
646
+ stats: { rows: 0, pages: m.plan.pages.length, cells: 0, durationMs: 0 },
647
+ ...m.output
648
648
  };
649
- return e.runtime.exportPrepared({ prepared: m, format: c, fidelity: i, pdf: w, xlsx: g, signal: f, taskId: d, correlationId: l, onEvent: p });
649
+ return e.runtime.exportPrepared({ prepared: y, format: c, fidelity: i, pdf: w, xlsx: g, signal: f, taskId: d, correlationId: l, onEvent: p });
650
650
  },
651
651
  /** Instance edits are explicit snapshots; source business persistence remains the Provider.save responsibility. */
652
652
  save: n.save
@@ -656,7 +656,7 @@ function _(e, t, r) {
656
656
  if (!Number.isSafeInteger(e) || e < 1 || e > t) throw new RangeError(`${r} 应为 1–${t} 的安全整数`);
657
657
  return e;
658
658
  }
659
- function oe(e) {
659
+ function ae(e) {
660
660
  if (!e || typeof e.key != "string" || !e.key.trim() || e.key.length > 1024 || !["pdf", "xlsx"].includes(e.format) || !Number.isSafeInteger(e.bytes) || e.bytes < 0 || e.sha256 !== void 0 && !/^[a-f0-9]{64}$/i.test(e.sha256)) throw new TypeError("分批归档回执应包含存储键、格式、大小和可选 SHA256");
661
661
  return { key: e.key, format: e.format, bytes: e.bytes, ...e.sha256 ? { sha256: e.sha256 } : {} };
662
662
  }
@@ -669,28 +669,28 @@ function Ye(e) {
669
669
  r.rowKey && t.add(r.rowKey), typeof r.copies == "object" && t.add(r.copies.field);
670
670
  const n = (s) => {
671
671
  s.binding && t.add(s.binding.field);
672
- for (const a of s.grid?.cells ?? []) for (const o of a) o?.children?.forEach(n);
672
+ for (const o of s.grid?.cells ?? []) for (const a of o) a?.children?.forEach(n);
673
673
  };
674
- return e.pages.forEach((s) => s.components.forEach((a) => n(a))), [...t];
674
+ return e.pages.forEach((s) => s.components.forEach((o) => n(o))), [...t];
675
675
  }
676
676
  function et(e, t, r, n) {
677
677
  if (!e || typeof e != "object" || Array.isArray(e)) throw new TypeError(`标签记录 ${n} 应为对象`);
678
678
  const s = /* @__PURE__ */ Object.create(null);
679
- for (const a of t) {
680
- const o = we(e, a, { dataset: r, rowIndex: n });
681
- if (typeof o == "string" && o.length > 1e6) throw new A("budget", "标签字段超过 1 MB 字符预算", `$.datasets.${r}[${n}].${a}`);
682
- o !== void 0 && (s[a] = o);
679
+ for (const o of t) {
680
+ const a = we(e, o, { dataset: r, rowIndex: n });
681
+ if (typeof a == "string" && a.length > 1e6) throw new A("budget", "标签字段超过 1 MB 字符预算", `$.datasets.${r}[${n}].${o}`);
682
+ a !== void 0 && (s[o] = a);
683
683
  }
684
684
  return s;
685
685
  }
686
686
  function tt(e, t, r, n) {
687
687
  const s = t.repeat;
688
688
  if (!s.rowKey) return;
689
- const a = we(e, s.rowKey, { rowIndex: n, dataset: s.dataset });
690
- if (!(typeof a == "string" && a.trim() || typeof a == "number" && Number.isFinite(a))) throw new TypeError(`标签记录 ${n} 的业务主键无效`);
691
- const o = JSON.stringify([typeof a, a]);
692
- if (r.keys.has(o)) throw new TypeError(`标签记录 ${n} 的业务主键重复(包含先前批次)`);
693
- r.bytes += o.length * 2 + 64, r.keys.add(o);
689
+ const o = we(e, s.rowKey, { rowIndex: n, dataset: s.dataset });
690
+ if (!(typeof o == "string" && o.trim() || typeof o == "number" && Number.isFinite(o))) throw new TypeError(`标签记录 ${n} 的业务主键无效`);
691
+ const a = JSON.stringify([typeof o, o]);
692
+ if (r.keys.has(a)) throw new TypeError(`标签记录 ${n} 的业务主键重复(包含先前批次)`);
693
+ r.bytes += a.length * 2 + 64, r.keys.add(a);
694
694
  }
695
695
  function rt(e) {
696
696
  return Object.entries(e).reduce((t, [r, n]) => t + 64 + r.length * 2 + (typeof n == "string" ? n.length * 2 : 8), 0);
@@ -718,15 +718,15 @@ async function ie(e, t, r) {
718
718
  n.catch(() => {
719
719
  }), await T(r.signal, void 0, () => n);
720
720
  }
721
- function at(e, t, r) {
721
+ function ot(e, t, r) {
722
722
  return new Promise((n, s) => {
723
- let a = !1, o = !1, u;
723
+ let o = !1, a = !1, u;
724
724
  const f = () => {
725
725
  clearTimeout(u), t.removeEventListener("abort", c);
726
726
  }, c = () => {
727
- a || u !== void 0 || (u = setTimeout(() => {
728
- if (!a) {
729
- a = !0, o = !0, f();
727
+ o || u !== void 0 || (u = setTimeout(() => {
728
+ if (!o) {
729
+ o = !0, a = !0, f();
730
730
  try {
731
731
  h(t);
732
732
  } catch (i) {
@@ -736,52 +736,52 @@ function at(e, t, r) {
736
736
  }, 0));
737
737
  };
738
738
  e.then((i) => {
739
- if (o) {
739
+ if (a) {
740
740
  Promise.resolve().then(() => r(i)).catch(() => {
741
741
  });
742
742
  return;
743
743
  }
744
- a || (a = !0, f(), n(i));
744
+ o || (o = !0, f(), n(i));
745
745
  }, (i) => {
746
- a || (a = !0, f(), s(i));
746
+ o || (o = !0, f(), s(i));
747
747
  }), t.addEventListener("abort", c, { once: !0 }), t.aborted && c();
748
748
  });
749
749
  }
750
- async function Ht(e, t) {
751
- const r = _(t.batchSize ?? 100, 1e3, "batchSize"), n = _(t.maxRows ?? 1e5, 1e6, "maxRows"), s = _(t.maxChunks ?? 1e3, 1e4, "maxChunks"), a = _(t.maxRetainedBytes ?? 16e6, 64e6, "maxRetainedBytes"), o = We(t.template), u = Ye(o);
750
+ async function Ut(e, t) {
751
+ const r = _(t.batchSize ?? 100, 1e3, "batchSize"), n = _(t.maxRows ?? 1e5, 1e6, "maxRows"), s = _(t.maxChunks ?? 1e3, 1e4, "maxChunks"), o = _(t.maxRetainedBytes ?? 16e6, 64e6, "maxRetainedBytes"), a = We(t.template), u = Ye(a);
752
752
  if (!e || typeof e[Symbol.asyncIterator] != "function") throw new TypeError("标签来源应为 AsyncIterable");
753
753
  return T(t.signal, t.runtime?.budget?.maxDurationMs ?? 12e4, async (f) => {
754
754
  const c = { rows: 0, chunks: [] }, i = { keys: /* @__PURE__ */ new Set(), bytes: 0 }, d = e[Symbol.asyncIterator]();
755
755
  let l = !1, p = !1, w;
756
- const g = () => w ??= st(d, f), y = () => {
756
+ const g = () => w ??= st(d, f), m = () => {
757
757
  l || g().catch(() => {
758
758
  });
759
759
  };
760
- f.addEventListener("abort", y, { once: !0 });
760
+ f.addEventListener("abort", m, { once: !0 });
761
761
  try {
762
762
  for (; !l; ) {
763
763
  h(f);
764
- const m = [];
764
+ const y = [];
765
765
  let v = 0;
766
- for (; m.length < r; ) {
766
+ for (; y.length < r; ) {
767
767
  const I = await T(f, void 0, () => Promise.resolve(d.next()));
768
768
  if (I.done) {
769
769
  l = !0;
770
770
  break;
771
771
  }
772
- if (c.rows + m.length >= n) throw new A("budget", "标签来源行数超过预算", "$.maxRows");
772
+ if (c.rows + y.length >= n) throw new A("budget", "标签来源行数超过预算", "$.maxRows");
773
773
  if (c.chunks.length >= s) throw new A("budget", "标签分块数量超过预算", "$.maxChunks");
774
- const S = et(I.value, u, o.repeat.dataset, c.rows + m.length);
775
- if (tt(S, o, i, c.rows + m.length), v += rt(S), i.bytes + v > a) throw new A("budget", "标签当前块字段与全局主键索引超过内存预算", "$.maxRetainedBytes");
776
- m.push(S);
774
+ const S = et(I.value, u, a.repeat.dataset, c.rows + y.length);
775
+ if (tt(S, a, i, c.rows + y.length), v += rt(S), i.bytes + v > o) throw new A("budget", "标签当前块字段与全局主键索引超过内存预算", "$.maxRetainedBytes");
776
+ y.push(S);
777
777
  }
778
- if (!m.length) break;
779
- const N = W({ ...t.runtime, reports: { labels: { template: o, datasets: { [o.repeat.dataset]: m } } } });
778
+ if (!y.length) break;
779
+ const N = W({ ...t.runtime, reports: { labels: { template: a, datasets: { [a.repeat.dataset]: y } } } });
780
780
  let M;
781
781
  const E = {
782
782
  index: c.chunks.length,
783
783
  rowOffset: c.rows,
784
- rowCount: m.length,
784
+ rowCount: y.length,
785
785
  signal: f,
786
786
  export: (I) => N.exportPrepared({ pdf: t.pdf, ...I, prepared: M, signal: f })
787
787
  };
@@ -789,8 +789,8 @@ async function Ht(e, t) {
789
789
  const B = (await Oe([{ id: `labels-${E.index}`, params: {} }], async () => {
790
790
  try {
791
791
  M = nt(await N.prepare({ reportIds: ["labels"], pdf: t.pdf, signal: f }), E.rowOffset), h(f);
792
- const I = Promise.resolve(t.execute(M, E)), S = await at(I, f, (k) => ie(t, oe(k), E));
793
- return oe(S);
792
+ const I = Promise.resolve(t.execute(M, E)), S = await ot(I, f, (k) => ie(t, ae(k), E));
793
+ return ae(S);
794
794
  } catch (I) {
795
795
  throw C = I, I;
796
796
  }
@@ -798,24 +798,24 @@ async function Ht(e, t) {
798
798
  if (B.status === "cancelled")
799
799
  throw h(f), new Error("标签分批任务已取消");
800
800
  if (B.status === "failed") throw C ?? new Error(B.error.message);
801
- c.chunks.push({ ...B.value, index: E.index, rowOffset: E.rowOffset, rowCount: E.rowCount }), c.rows += m.length, await ie(t, B.value, E);
801
+ c.chunks.push({ ...B.value, index: E.index, rowOffset: E.rowOffset, rowCount: E.rowCount }), c.rows += y.length, await ie(t, B.value, E);
802
802
  }
803
803
  return c;
804
- } catch (m) {
805
- throw p = !0, m;
804
+ } catch (y) {
805
+ throw p = !0, y;
806
806
  } finally {
807
- f.removeEventListener("abort", y), l || await g().catch((m) => {
808
- if (!p) throw m;
807
+ f.removeEventListener("abort", m), l || await g().catch((y) => {
808
+ if (!p) throw y;
809
809
  });
810
810
  }
811
811
  });
812
812
  }
813
- async function ot(e, t) {
813
+ async function at(e, t) {
814
814
  const r = t.document().id, n = () => t.editor.saving || t.editor.blocked;
815
815
  if (n()) throw new Error("草稿尚未保存,请处理设计器提示后再发布");
816
816
  if (t.editor.pendingLocalChanges) {
817
- const a = t.successfulSaves();
818
- if (await t.editor.save(), await t.afterSave(), t.successfulSaves() === a || t.editor.pendingLocalChanges || n()) throw new Error("草稿尚未保存,请处理设计器提示后再发布");
817
+ const o = t.successfulSaves();
818
+ if (await t.editor.save(), await t.afterSave(), t.successfulSaves() === o || t.editor.pendingLocalChanges || n()) throw new Error("草稿尚未保存,请处理设计器提示后再发布");
819
819
  }
820
820
  const s = t.document();
821
821
  if (s.id !== r) throw new b("conflict", "当前模板已切换,请重新确认后发布");
@@ -828,10 +828,10 @@ function it(e, t) {
828
828
  const n = await e.list(r.signal);
829
829
  if (n.length > 1e3) throw new RangeError("本地模板连接目录最多 1000 项;更大目录请使用宿主分页查询适配器");
830
830
  const s = [];
831
- for (const a of n) {
831
+ for (const o of n) {
832
832
  h(r.signal);
833
- const [o, u] = await Promise.all([e.get(a.id, { draft: !0, signal: r.signal }), e.get(a.id, { signal: r.signal })]), f = o ?? u;
834
- f && s.push({ document: f, published: u, draftRevision: o?.revision, publishedRevision: u?.revision, ...t?.($(f)) });
833
+ const [a, u] = await Promise.all([e.get(o.id, { draft: !0, signal: r.signal }), e.get(o.id, { signal: r.signal })]), f = a ?? u;
834
+ f && s.push({ document: f, published: u, draftRevision: a?.revision, publishedRevision: u?.revision, ...t?.($(f)) });
835
835
  }
836
836
  return Pe(s).search(r);
837
837
  },
@@ -846,11 +846,11 @@ function ct(e = 1e3) {
846
846
  return {
847
847
  forCase(n, s) {
848
848
  if (![n, s].every((f) => typeof f == "string" && f.length > 0 && f.length <= 256)) throw new TypeError("模板与参数组标识无效");
849
- const a = JSON.stringify([n, s]), o = t.get(a);
850
- if (o) return o;
849
+ const o = JSON.stringify([n, s]), a = t.get(o);
850
+ if (a) return a;
851
851
  if (t.size >= e) throw new RangeError("本地生成意图已达上限,请使用持久化任务服务");
852
852
  const u = `instance-${r}-${(t.size + 1).toString(36)}`;
853
- return t.set(a, u), u;
853
+ return t.set(o, u), u;
854
854
  }
855
855
  };
856
856
  }
@@ -864,7 +864,7 @@ function ce(e) {
864
864
  function dt(e, t, r) {
865
865
  const n = $(e);
866
866
  if (!n.revision) throw new Error("请先发布该模板");
867
- const s = typeof t.data == "function" ? t.data($(n)) : t.data, a = W({ ...t.runtime, reports: { [n.id]: { ...s, template: n.template } } }), o = Qe({ runtime: a, instances: t.instances, templateRevisions: { [n.id]: n.revision }, pdf: t.pdf });
867
+ const s = typeof t.data == "function" ? t.data($(n)) : t.data, o = W({ ...t.runtime, reports: { [n.id]: { ...s, template: n.template } } }), a = Qe({ runtime: o, instances: t.instances, templateRevisions: { [n.id]: n.revision }, pdf: t.pdf });
868
868
  async function u(f, c, i) {
869
869
  h(i);
870
870
  const d = await t.instances.read(t.scope, f, void 0, i);
@@ -877,12 +877,12 @@ function dt(e, t, r) {
877
877
  document: $(n),
878
878
  async execute(f, { signal: c }) {
879
879
  h(c);
880
- const i = a.validate({ reportIds: [n.id], params: f.params });
880
+ const i = o.validate({ reportIds: [n.id], params: f.params });
881
881
  if (!i.ok) throw new Error(i.issues[0]?.message ?? "生成参数无效");
882
882
  const d = r(n.id, f.id), l = await u(d, i.values, c);
883
883
  if (l) return l;
884
884
  try {
885
- return ce(await o.generate({
885
+ return ce(await a.generate({
886
886
  scope: t.scope,
887
887
  id: d,
888
888
  title: (t.title?.($(n), f, i.values) ?? `${n.name} · ${f.id}`).slice(0, 512),
@@ -901,22 +901,22 @@ function dt(e, t, r) {
901
901
  }
902
902
  };
903
903
  }
904
- function Ut(e) {
904
+ function Zt(e) {
905
905
  e = { ...e };
906
906
  const t = ct(), r = e.instanceId ?? t.forCase;
907
907
  return {
908
908
  catalog: e.catalog ?? it(e.templates, e.catalogMetadata),
909
- publish: (n) => ot(e.templates, n),
909
+ publish: (n) => at(e.templates, n),
910
910
  /** Resolve only a manager-owned publication, then keep that exact revision for this batch. */
911
911
  async batch(n, s = {}) {
912
- const { expectedRevision: a, signal: o } = s, u = await e.templates.get(n, { signal: o });
913
- if (h(o), !u?.revision) throw new Error("请先发布该模板");
914
- if (a !== void 0 && u.revision !== a) throw new b("conflict", "模板发布版本已变化,请重新打开后生成");
912
+ const { expectedRevision: o, signal: a } = s, u = await e.templates.get(n, { signal: a });
913
+ if (h(a), !u?.revision) throw new Error("请先发布该模板");
914
+ if (o !== void 0 && u.revision !== o) throw new b("conflict", "模板发布版本已变化,请重新打开后生成");
915
915
  return dt(u, e, r);
916
916
  }
917
917
  };
918
918
  }
919
- const be = "2.25.2";
919
+ const be = "2.26.0";
920
920
  function U(e, t) {
921
921
  const r = t?.componentPath;
922
922
  if (!Number.isSafeInteger(t?.pageIndex) || t.pageIndex < 0 || !Array.isArray(r) || r.length < 1 || r.length > 31 || r.length % 3 !== 1 || r.some((s) => !Number.isSafeInteger(s) || s < 0)) throw new TypeError("模板包图片位置无效");
@@ -947,47 +947,47 @@ function lt(e, t) {
947
947
  }
948
948
  }
949
949
  function pt(e, t) {
950
- const r = (n) => n.every((s, a) => e[a] === s);
950
+ const r = (n) => n.every((s, o) => e[o] === s);
951
951
  return t === "image/png" ? r([137, 80, 78, 71, 13, 10, 26, 10]) : t === "image/jpeg" ? r([255, 216, 255]) : t === "font/otf" ? r([79, 84, 84, 79]) : r([0, 1, 0, 0]) || r([116, 114, 117, 101]);
952
952
  }
953
953
  function wt(e) {
954
954
  if (!(e instanceof Uint8Array) || !e.byteLength || e.byteLength > 32e6) throw new RangeError("资源摘要只接受1–32MB字节");
955
955
  return Re(e);
956
956
  }
957
- function ve(e, t, r = me()) {
958
- const n = new Set(t.flatMap((o) => (o.targets ?? []).map((u) => U(e, u)))), s = /* @__PURE__ */ new Map(), a = (o) => {
959
- if (o.imageData && !n.has(o)) {
960
- const u = r(o.imageData);
957
+ function ve(e, t, r = ye()) {
958
+ const n = new Set(t.flatMap((a) => (a.targets ?? []).map((u) => U(e, u)))), s = /* @__PURE__ */ new Map(), o = (a) => {
959
+ if (a.imageData && !n.has(a)) {
960
+ const u = r(a.imageData);
961
961
  s.set(u.dataUrl, u.bytes.byteLength);
962
962
  }
963
- for (const u of o.grid?.cells ?? []) for (const f of u) for (const c of f?.children ?? []) a(c);
963
+ for (const u of a.grid?.cells ?? []) for (const f of u) for (const c of f?.children ?? []) o(c);
964
964
  };
965
- for (const o of e.template.pages) for (const u of o.components) a(u);
966
- return [...s.values()].reduce((o, u) => o + u, 0);
965
+ for (const a of e.template.pages) for (const u of a.components) o(u);
966
+ return [...s.values()].reduce((a, u) => a + u, 0);
967
967
  }
968
- function yt(e, t) {
968
+ function mt(e, t) {
969
969
  let r = "";
970
970
  for (let n = 0; n < e.length; n += 16384) r += String.fromCharCode(...e.subarray(n, n + 16384));
971
971
  return `data:${t};base64,${btoa(r)}`;
972
972
  }
973
- async function mt(e, t, r, n, s = 3e4) {
973
+ async function yt(e, t, r, n, s = 3e4) {
974
974
  if (!Number.isFinite(s) || s < 1 || s > 2147483647) throw new RangeError("模板资源加载超时应为1–2147483647毫秒");
975
- return T(n, s, async (a) => {
976
- const o = [], u = me();
975
+ return T(n, s, async (o) => {
976
+ const a = [], u = ye();
977
977
  ve(e, t, u);
978
978
  for (const f of t) {
979
- h(a);
980
- const c = await T(a, void 0, () => Promise.resolve(r(JSON.parse(JSON.stringify(f)), { signal: a })));
981
- if (h(a), !c || !(c.bytes instanceof Uint8Array) || c.mediaType !== f.mediaType || c.bytes.byteLength !== f.bytes) throw new TypeError(`资源 ${f.id} 的类型或大小与清单不一致`);
979
+ h(o);
980
+ const c = await T(o, void 0, () => Promise.resolve(r(JSON.parse(JSON.stringify(f)), { signal: o })));
981
+ if (h(o), !c || !(c.bytes instanceof Uint8Array) || c.mediaType !== f.mediaType || c.bytes.byteLength !== f.bytes) throw new TypeError(`资源 ${f.id} 的类型或大小与清单不一致`);
982
982
  const i = new Uint8Array(c.bytes);
983
983
  if (!pt(i, f.mediaType) || wt(i) !== f.sha256) throw new TypeError(`资源 ${f.id} 的文件标识或SHA256与清单不一致`);
984
- if (f.kind === "font") o.push({ id: f.id, family: f.font.family, face: f.font.face, bytes: i });
984
+ if (f.kind === "font") a.push({ id: f.id, family: f.font.family, face: f.font.face, bytes: i });
985
985
  else {
986
- const d = u(yt(i, f.mediaType)).dataUrl;
986
+ const d = u(mt(i, f.mediaType)).dataUrl;
987
987
  for (const l of f.targets) U(e, l).imageData = d;
988
988
  }
989
989
  }
990
- return o;
990
+ return a;
991
991
  });
992
992
  }
993
993
  function fe(e) {
@@ -1011,7 +1011,7 @@ function ht(e) {
1011
1011
  if (!e.contracts || typeof e.contracts != "object" || Array.isArray(e.contracts) || Object.keys(e.contracts).length > 100) throw new TypeError("模板包字段契约应为最多100个数据集");
1012
1012
  for (const [t, r] of Object.entries(e.contracts)) {
1013
1013
  if (!t.trim() || t.length > 256) throw new TypeError("模板包数据集名称无效");
1014
- ye([], r);
1014
+ me([], r);
1015
1015
  }
1016
1016
  }
1017
1017
  }
@@ -1024,12 +1024,12 @@ function bt(e, t) {
1024
1024
  function vt(e, t) {
1025
1025
  let r = 0;
1026
1026
  for (const s of Object.values(e.datasets))
1027
- if (!Array.isArray(s) || s.some((a) => !a || typeof a != "object" || Array.isArray(a))) throw new TypeError("模板包样例应为对象行数组");
1027
+ if (!Array.isArray(s) || s.some((o) => !o || typeof o != "object" || Array.isArray(o))) throw new TypeError("模板包样例应为对象行数组");
1028
1028
  const n = Ie(t.document.template, e.datasets, { maxRows: 1e3 });
1029
- for (const [s, a] of Object.entries(n)) {
1030
- if (r += a.length, r > 1e3) throw new RangeError("模板包每个样例最多1000行");
1031
- const o = t.contracts?.[s];
1032
- if (o && !ye(a, o).ok) throw new TypeError(`样例 ${e.name} 不符合 ${s} 字段契约`);
1029
+ for (const [s, o] of Object.entries(n)) {
1030
+ if (r += o.length, r > 1e3) throw new RangeError("模板包每个样例最多1000行");
1031
+ const a = t.contracts?.[s];
1032
+ if (a && !me(o, a).ok) throw new TypeError(`样例 ${e.name} 不符合 ${s} 字段契约`);
1033
1033
  }
1034
1034
  for (const s of Object.keys(t.contracts ?? {})) if (!Object.prototype.hasOwnProperty.call(e.datasets, s)) throw new TypeError(`样例 ${e.name} 缺少 ${s} 数据集`);
1035
1035
  }
@@ -1045,20 +1045,20 @@ function xt(e) {
1045
1045
  function Rt(e, t) {
1046
1046
  if (!Array.isArray(e.resources) || e.resources.length > 64) throw new RangeError("模板包最多64个资源依赖");
1047
1047
  const r = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
1048
- let a = 0;
1049
- for (const o of e.resources) {
1050
- if (lt(o, e.document), r.has(o.id)) throw new TypeError("模板资源ID重复");
1051
- if (r.add(o.id), a += o.bytes, a > t) throw new RangeError("模板包资源总大小超过预算");
1052
- const u = o.font && JSON.stringify([o.font.family, o.font.face]);
1048
+ let o = 0;
1049
+ for (const a of e.resources) {
1050
+ if (lt(a, e.document), r.has(a.id)) throw new TypeError("模板资源ID重复");
1051
+ if (r.add(a.id), o += a.bytes, o > t) throw new RangeError("模板包资源总大小超过预算");
1052
+ const u = a.font && JSON.stringify([a.font.family, a.font.face]);
1053
1053
  if (u && s.has(u)) throw new TypeError("模板包字体family/face重复");
1054
1054
  u && s.add(u);
1055
- for (const f of o.targets ?? []) {
1055
+ for (const f of a.targets ?? []) {
1056
1056
  const c = JSON.stringify([f.pageIndex, f.componentPath]);
1057
1057
  if (n.has(c)) throw new TypeError("同一图片位置不能绑定多个资源");
1058
1058
  n.add(c);
1059
1059
  }
1060
1060
  }
1061
- if (a + ve(e.document, e.resources) > t) throw new RangeError("模板包内嵌与外部资源总大小超过预算");
1061
+ if (o + ve(e.document, e.resources) > t) throw new RangeError("模板包内嵌与外部资源总大小超过预算");
1062
1062
  }
1063
1063
  function xe(e, t = {}) {
1064
1064
  h(t.signal);
@@ -1067,18 +1067,18 @@ function xe(e, t = {}) {
1067
1067
  if (e.length > r || new TextEncoder().encode(e).byteLength > r) throw new RangeError("模板包JSON超过预算");
1068
1068
  e = JSON.parse(e);
1069
1069
  }
1070
- const n = Y(e, { maxBytes: r, check: () => h(t.signal), error: (s, a) => new TypeError(a) });
1070
+ const n = Y(e, { maxBytes: r, check: () => h(t.signal), error: (s, o) => new TypeError(o) });
1071
1071
  if (!n || typeof n != "object" || Array.isArray(n) || n.schemaVersion !== "1.0" || Object.keys(n).some((s) => !["schemaVersion", "minimumVersion", "document", "contracts", "resources", "fixtures"].includes(s))) throw new TypeError("模板包结构或版本无效");
1072
1072
  return gt(n.minimumVersion, t.runtimeVersion ?? be), n.document = $(n.document), ht(n), xt(n), Rt(n, Q(t.maxResourceBytes, 32e6, 64e6)), n;
1073
1073
  }
1074
- function Zt(e, t = {}) {
1075
- const r = Y(e, { maxBytes: Q(t.maxBytes, 8e6, 32e6), check: () => h(t.signal), error: (s, a) => new TypeError(a) }), n = xe({ schemaVersion: "1.0", ...r, minimumVersion: r.minimumVersion ?? be, resources: r.resources ?? [] }, t);
1076
- for (const s of n.resources) for (const a of s.targets ?? []) delete U(n.document, a).imageData;
1074
+ function Kt(e, t = {}) {
1075
+ const r = Y(e, { maxBytes: Q(t.maxBytes, 8e6, 32e6), check: () => h(t.signal), error: (s, o) => new TypeError(o) }), n = xe({ schemaVersion: "1.0", ...r, minimumVersion: r.minimumVersion ?? be, resources: r.resources ?? [] }, t);
1076
+ for (const s of n.resources) for (const o of s.targets ?? []) delete U(n.document, o).imageData;
1077
1077
  return n;
1078
1078
  }
1079
- async function Kt(e, t) {
1080
- const { resolve: r, signal: n, maxDurationMs: s } = t, a = xe(e, t), o = await mt(a.document, a.resources, r, n, s);
1081
- return { document: a.document, fonts: o, contracts: a.contracts, fixtures: a.fixtures ?? [] };
1079
+ async function Xt(e, t) {
1080
+ const { resolve: r, signal: n, maxDurationMs: s } = t, o = xe(e, t), a = await yt(o.document, o.resources, r, n, s);
1081
+ return { document: o.document, fonts: a, contracts: o.contracts, fixtures: o.fixtures ?? [] };
1082
1082
  }
1083
1083
  class x extends Error {
1084
1084
  constructor(t, r) {
@@ -1114,19 +1114,19 @@ function L(e, t) {
1114
1114
  }
1115
1115
  function It(e, t, r = []) {
1116
1116
  const n = /* @__PURE__ */ new Map();
1117
- let s = 0, a = Promise.resolve();
1117
+ let s = 0, o = Promise.resolve();
1118
1118
  for (const i of r) {
1119
1119
  const d = j(i.scope, i.id, i.version);
1120
1120
  if (de(i.plan), n.has(d) || !Number.isSafeInteger(i.bytes) || i.bytes < 0 || !Number.isSafeInteger(i.pageCount) || i.pageCount < 0 || i.pageCount > t.maxPages || !["building", "complete", "failed"].includes(i.state) || i.revision !== i.pageCount + (i.state === "building" ? 0 : 1)) throw new x("input", "文档清单无效");
1121
1121
  n.set(d, O(i, t.maxManifestBytes)), s += i.bytes;
1122
1122
  }
1123
- function o(i, d) {
1123
+ function a(i, d) {
1124
1124
  if (s - (d?.bytes ?? 0) + i.bytes > t.maxBytes || !d && n.size >= t.maxDocuments) throw new x("capacity", "文档存储容量已满,请显式清理旧文档");
1125
1125
  }
1126
1126
  if (n.size > t.maxDocuments || s > t.maxBytes) throw new x("capacity", "已存文档超过预算");
1127
1127
  const u = (i) => {
1128
- const d = a.then(i);
1129
- return a = d.then(() => {
1128
+ const d = o.then(i);
1129
+ return o = d.then(() => {
1130
1130
  }, () => {
1131
1131
  }), d;
1132
1132
  }, f = (i, d, l, p) => {
@@ -1136,7 +1136,7 @@ function It(e, t, r = []) {
1136
1136
  return w;
1137
1137
  }, c = async (i, d, l) => {
1138
1138
  const p = O(i, t.maxManifestBytes);
1139
- return o(p, d), await e.write(p, l), n.set(j(i.scope, i.id), p), s += i.bytes - (d?.bytes ?? 0), O(p, t.maxManifestBytes);
1139
+ return a(p, d), await e.write(p, l), n.set(j(i.scope, i.id), p), s += i.bytes - (d?.bytes ?? 0), O(p, t.maxManifestBytes);
1140
1140
  };
1141
1141
  return {
1142
1142
  create: (i, d) => {
@@ -1148,42 +1148,42 @@ function It(e, t, r = []) {
1148
1148
  });
1149
1149
  },
1150
1150
  append: (i, d, l, p, w, g) => {
1151
- const y = O(w, t.maxPageBytes, g), m = le({ pages: [y] });
1152
- if (!m.ok) throw new x("input", m.errors[0].message);
1151
+ const m = O(w, t.maxPageBytes, g), y = le({ pages: [m] });
1152
+ if (!y.ok) throw new x("input", y.errors[0].message);
1153
1153
  return u(async () => {
1154
1154
  h(g);
1155
1155
  const v = f(i, d, l, p);
1156
1156
  if (v.state !== "building") throw new x("conflict", "已完成文档不可追加");
1157
1157
  if (v.pageCount >= t.maxPages) throw new x("capacity", "文档页数超过预算");
1158
1158
  const N = { ...v, revision: p + 1, pageCount: v.pageCount + 1 };
1159
- return L(N, v.bytes - D(v) + D(y)), c(N, v, { index: v.pageCount, value: y });
1159
+ return L(N, v.bytes - D(v) + D(m)), c(N, v, { index: v.pageCount, value: m });
1160
1160
  });
1161
1161
  },
1162
1162
  complete: (i, d, l, p, w, g) => {
1163
- const y = w === void 0 ? void 0 : O(w, t.maxManifestBytes, g);
1164
- return y && pe({ ...y }), u(async () => {
1163
+ const m = w === void 0 ? void 0 : O(w, t.maxManifestBytes, g);
1164
+ return m && pe({ ...m }), u(async () => {
1165
1165
  h(g);
1166
- const m = f(i, d, l, p);
1167
- if (m.state !== "building") throw new x("conflict", "文档已完成");
1168
- if (y && y.stats.pages !== m.pageCount) throw new x("input", "准备结果页数与文档页数不一致");
1169
- const v = { ...m, revision: p + 1, state: "complete", ...y ? { metadata: y } : {} };
1170
- return L(v, m.bytes - D(m)), c(v, m);
1166
+ const y = f(i, d, l, p);
1167
+ if (y.state !== "building") throw new x("conflict", "文档已完成");
1168
+ if (m && m.stats.pages !== y.pageCount) throw new x("input", "准备结果页数与文档页数不一致");
1169
+ const v = { ...y, revision: p + 1, state: "complete", ...m ? { metadata: m } : {} };
1170
+ return L(v, y.bytes - D(y)), c(v, y);
1171
1171
  });
1172
1172
  },
1173
1173
  fail: (i, d, l, p, w) => {
1174
1174
  const g = O(w, 4096);
1175
1175
  if (!g || !["cancelled", "generation"].includes(g.code) || typeof g.message != "string" || !g.message.trim() || g.message.length > 1024) throw new x("input", "文档失败状态无效");
1176
1176
  return u(async () => {
1177
- const y = f(i, d, l, p);
1178
- if (y.state !== "building") throw new x("conflict", "终态文档不可变更");
1179
- const m = { ...y, state: "failed", revision: p + 1, failure: g };
1180
- return L(m, y.bytes - D(y)), c(m, y);
1177
+ const m = f(i, d, l, p);
1178
+ if (m.state !== "building") throw new x("conflict", "终态文档不可变更");
1179
+ const y = { ...m, state: "failed", revision: p + 1, failure: g };
1180
+ return L(y, m.bytes - D(m)), c(y, m);
1181
1181
  });
1182
1182
  },
1183
1183
  read: async (i, d, l) => {
1184
1184
  h(l);
1185
1185
  const p = j(i, d);
1186
- await a, h(l);
1186
+ await o, h(l);
1187
1187
  const w = n.get(p);
1188
1188
  return w ? O(w, t.maxManifestBytes) : void 0;
1189
1189
  },
@@ -1192,9 +1192,9 @@ function It(e, t, r = []) {
1192
1192
  const g = f(i, d, l);
1193
1193
  if (!Number.isSafeInteger(p) || p < 0) throw new x("input", "页索引应为非负安全整数");
1194
1194
  if (p >= g.pageCount) return;
1195
- const y = await e.readPage(i, d, p);
1196
- if (h(w), !y) throw new x("missing", "已提交的文档页缺失");
1197
- return O(y, t.maxPageBytes, w);
1195
+ const m = await e.readPage(i, d, p);
1196
+ if (h(w), !m) throw new x("missing", "已提交的文档页缺失");
1197
+ return O(m, t.maxPageBytes, w);
1198
1198
  }),
1199
1199
  remove: (i, d, l, p) => u(async () => {
1200
1200
  h(p);
@@ -1203,13 +1203,13 @@ function It(e, t, r = []) {
1203
1203
  })
1204
1204
  };
1205
1205
  }
1206
- function Xt(e = {}) {
1206
+ function Gt(e = {}) {
1207
1207
  const t = /* @__PURE__ */ new Map();
1208
1208
  return It({
1209
1209
  write: async (r, n) => {
1210
1210
  if (!n) return;
1211
- const s = j(r.scope, r.id), a = t.get(s) ?? [];
1212
- a[n.index] = n.value, t.set(s, a);
1211
+ const s = j(r.scope, r.id), o = t.get(s) ?? [];
1212
+ o[n.index] = n.value, t.set(s, o);
1213
1213
  },
1214
1214
  readPage: async (r, n, s) => t.get(j(r, n))?.[s],
1215
1215
  remove: async (r) => {
@@ -1217,65 +1217,65 @@ function Xt(e = {}) {
1217
1217
  }
1218
1218
  }, St(e));
1219
1219
  }
1220
- async function Gt(e, t) {
1220
+ async function Et(e, t) {
1221
1221
  const r = t.fromPage ?? 0, n = t.limit ?? 4, s = t.maxBytes ?? 8e6;
1222
1222
  if (!Number.isSafeInteger(r) || r < 0 || !Number.isSafeInteger(n) || n < 1 || n > 32 || !Number.isSafeInteger(s) || s < 1) throw new x("input", "页窗口参数无效;每次最多读取 32 页");
1223
- const a = await e.read(t.scope, t.id, t.signal);
1224
- if (!a) throw new x("missing", "文档不存在");
1225
- if (a.version !== t.version) throw new x("conflict", "文档版本已变化");
1226
- const o = [];
1227
- let u = 0, f = Math.min(r, a.pageCount);
1228
- for (; f < Math.min(a.pageCount, r + n); f++) {
1223
+ const o = await e.read(t.scope, t.id, t.signal);
1224
+ if (!o) throw new x("missing", "文档不存在");
1225
+ if (o.version !== t.version) throw new x("conflict", "文档版本已变化");
1226
+ const a = [];
1227
+ let u = 0, f = Math.min(r, o.pageCount);
1228
+ for (; f < Math.min(o.pageCount, r + n); f++) {
1229
1229
  const c = await e.readPage(t.scope, t.id, t.version, f, t.signal);
1230
1230
  if (!c) throw new x("missing", "文档页缺失");
1231
1231
  const i = D(c);
1232
1232
  if (u + i > s) {
1233
- if (!o.length) throw new x("capacity", "单页超过读取窗口预算");
1233
+ if (!a.length) throw new x("capacity", "单页超过读取窗口预算");
1234
1234
  break;
1235
1235
  }
1236
- o.push(c), u += i;
1236
+ a.push(c), u += i;
1237
1237
  }
1238
- return { manifest: a, pages: o, nextPage: f };
1238
+ return { manifest: o, pages: a, nextPage: f };
1239
1239
  }
1240
1240
  async function Qt(e, t) {
1241
- const { scope: r, id: n, version: s, signal: a, pages: o } = t, u = t.metadata === void 0 ? void 0 : O(t.metadata, 1e6, a);
1242
- let f = await e.create({ scope: r, id: n, version: s, plan: t.plan }, a), c;
1241
+ const { scope: r, id: n, version: s, signal: o, pages: a } = t, u = t.metadata === void 0 ? void 0 : O(t.metadata, 1e6, o);
1242
+ let f = await e.create({ scope: r, id: n, version: s, plan: t.plan }, o), c;
1243
1243
  try {
1244
- const i = Symbol.asyncIterator in o ? o[Symbol.asyncIterator]() : o[Symbol.iterator]();
1244
+ const i = Symbol.asyncIterator in a ? a[Symbol.asyncIterator]() : a[Symbol.iterator]();
1245
1245
  for (c = i; ; ) {
1246
- const d = await T(a, void 0, () => Promise.resolve(i.next()));
1246
+ const d = await T(o, void 0, () => Promise.resolve(i.next()));
1247
1247
  if (d.done) break;
1248
- f = await e.append(r, n, s, f.revision, d.value, a);
1248
+ f = await e.append(r, n, s, f.revision, d.value, o);
1249
1249
  }
1250
- return await e.complete(r, n, s, f.revision, u, a);
1250
+ return await e.complete(r, n, s, f.revision, u, o);
1251
1251
  } catch (i) {
1252
1252
  throw Promise.resolve(c?.return?.()).catch(() => {
1253
- }), await e.fail(r, n, s, f.revision, a?.aborted ? { code: "cancelled", message: "报表文档生成已取消" } : { code: "generation", message: "报表文档生成失败" }).catch(() => {
1253
+ }), await e.fail(r, n, s, f.revision, o?.aborted ? { code: "cancelled", message: "报表文档生成已取消" } : { code: "generation", message: "报表文档生成失败" }).catch(() => {
1254
1254
  }), i;
1255
1255
  }
1256
1256
  }
1257
- const Et = "1.0", ue = Object.freeze({ params: 422, validate: 422, fetch: 502, config: 400, input: 400, budget: 413, capacity: 413, timeout: 504, "queue-full": 429, closed: 503, cancelled: 499, "output-fidelity": 422, conflict: 409, missing: 404 });
1257
+ const kt = "1.0", ue = Object.freeze({ params: 422, validate: 422, fetch: 502, config: 400, input: 400, budget: 413, capacity: 413, timeout: 504, "queue-full": 429, closed: 503, cancelled: 499, "output-fidelity": 422, conflict: 409, missing: 404 });
1258
1258
  function V(e) {
1259
1259
  return e && typeof e == "object" ? e : {};
1260
1260
  }
1261
- function kt(e) {
1261
+ function Ot(e) {
1262
1262
  if (Array.isArray(e))
1263
1263
  return e.slice(0, 100).map((t) => Object.fromEntries(["code", "path", "field", "message"].flatMap((r) => typeof V(t)[r] == "string" ? [[r, V(t)[r].slice(0, 4096)]] : [])));
1264
1264
  }
1265
1265
  function Wt(e, t) {
1266
- const r = V(e), n = r.name === "AbortError" ? "cancelled" : r.code, s = typeof n == "string" && Object.prototype.hasOwnProperty.call(ue, n) ? n : "internal", a = s === "internal" ? void 0 : kt(r.issues ?? V(r.cause).issues);
1266
+ const r = V(e), n = r.name === "AbortError" ? "cancelled" : r.code, s = typeof n == "string" && Object.prototype.hasOwnProperty.call(ue, n) ? n : "internal", o = s === "internal" ? void 0 : Ot(r.issues ?? V(r.cause).issues);
1267
1267
  return { status: ue[s] ?? 500, body: { error: {
1268
1268
  code: s,
1269
1269
  message: s === "internal" ? "Report execution failed" : typeof r.message == "string" ? r.message.slice(0, 4096) : "Report request failed",
1270
1270
  correlationId: t.slice(0, 128),
1271
1271
  ...s !== "internal" && typeof r.path == "string" ? { path: r.path.slice(0, 4096) } : {},
1272
- ...a ? { issues: a } : {}
1272
+ ...o ? { issues: o } : {}
1273
1273
  } } };
1274
1274
  }
1275
1275
  function K(e, t, r) {
1276
1276
  return { description: r, headers: { "X-Request-Id": { schema: { type: "string" }, description: "Request correlation identity" } }, content: { [e]: { schema: t } } };
1277
1277
  }
1278
- function Ot(e) {
1278
+ function At(e) {
1279
1279
  return {
1280
1280
  type: "object",
1281
1281
  additionalProperties: !1,
@@ -1290,30 +1290,41 @@ function Yt(e, t = {}) {
1290
1290
  const n = {
1291
1291
  [r]: { get: { operationId: "describeReports", responses: { 200: K("application/json", { type: "array", items: { type: "object" } }, "Authorized report descriptions") } } }
1292
1292
  }, s = /* @__PURE__ */ new Set();
1293
- for (const a of e) {
1294
- if (!a.id.trim() || s.has(a.id) || [".", ".."].includes(a.id)) throw new Error("OpenAPI 报表 ID 应非空、唯一且不是路径跳转段");
1295
- s.add(a.id);
1296
- for (const o of ["prepare", "pdf", "xlsx"]) {
1297
- const u = o === "prepare" ? "prepare" : `export/${o}`, f = o !== "prepare", c = { 200: K(f ? o === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : "application/json", f ? { type: "string", format: "binary" } : { type: "object", required: ["plan", "stats", "diagnostics", "revisions"] }, f ? "Report file" : "Prepared report snapshot") };
1293
+ for (const o of e) {
1294
+ if (!o.id.trim() || s.has(o.id) || [".", ".."].includes(o.id)) throw new Error("OpenAPI 报表 ID 应非空、唯一且不是路径跳转段");
1295
+ s.add(o.id);
1296
+ for (const a of ["prepare", "pdf", "xlsx"]) {
1297
+ const u = a === "prepare" ? "prepare" : `export/${a}`, f = a !== "prepare", c = { 200: K(f ? a === "pdf" ? "application/pdf" : "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : "application/json", f ? { type: "string", format: "binary" } : { type: "object", required: ["plan", "stats", "diagnostics", "revisions"] }, f ? "Report file" : "Prepared report snapshot") };
1298
1298
  for (const i of [400, 413, 422, 429, 499, 500, 502, 503, 504]) c[String(i)] = K("application/json", { $ref: "#/components/schemas/ReportError" }, "Structured report error");
1299
- n[`${r}/${encodeURIComponent(a.id)}/${u}`] = { post: {
1300
- operationId: `report_${s.size}_${o}`,
1299
+ n[`${r}/${encodeURIComponent(o.id)}/${u}`] = { post: {
1300
+ operationId: `report_${s.size}_${a}`,
1301
1301
  parameters: [{ in: "header", name: "X-Request-Id", schema: { type: "string", pattern: "^[A-Za-z0-9._-]{1,80}$" } }],
1302
- requestBody: { required: !0, content: { "application/json": { schema: { type: "object", required: ["params"], additionalProperties: !1, properties: { params: Ot(a) } } } } },
1302
+ requestBody: { required: !0, content: { "application/json": { schema: { type: "object", required: ["params"], additionalProperties: !1, properties: { params: At(o) } } } } },
1303
1303
  responses: c,
1304
- "x-report-datasets": a.datasetsSchema
1304
+ "x-report-datasets": o.datasetsSchema
1305
1305
  } };
1306
1306
  }
1307
1307
  }
1308
1308
  return {
1309
1309
  openapi: "3.1.0",
1310
- info: { title: t.title ?? "MachReport HTTP", version: t.version ?? Et },
1310
+ info: { title: t.title ?? "MachReport HTTP", version: t.version ?? kt },
1311
1311
  paths: n,
1312
1312
  components: { schemas: { ReportError: { type: "object", required: ["error"], properties: { error: { type: "object", required: ["code", "message", "correlationId"], properties: { code: { type: "string" }, message: { type: "string" }, correlationId: { type: "string" }, path: { type: "string" }, issues: { type: "array", items: { type: "object", additionalProperties: { type: "string" } } } } } } } } }
1313
1313
  };
1314
1314
  }
1315
+ function er(e, t, r = {}) {
1316
+ const { scope: n, id: s } = t;
1317
+ return {
1318
+ async load(o) {
1319
+ const a = { ...o }, u = a.version ?? (await e.read(n, s, a.signal))?.version;
1320
+ if (!u) throw new x("missing", "文档不存在");
1321
+ return Et(e, { ...a, scope: n, id: s, version: u });
1322
+ },
1323
+ ...r.export ? { export: r.export } : {}
1324
+ };
1325
+ }
1315
1326
  export {
1316
- Et as REPORT_HTTP_CONTRACT_VERSION,
1327
+ kt as REPORT_HTTP_CONTRACT_VERSION,
1317
1328
  x as ReportDocumentError,
1318
1329
  b as ReportInstanceError,
1319
1330
  R as ReportJobError,
@@ -1322,34 +1333,35 @@ export {
1322
1333
  X as checkJobIdentity,
1323
1334
  H as cloneJob,
1324
1335
  it as createManagerTemplateCatalog,
1325
- Xt as createMemoryReportDocumentStore,
1336
+ Gt as createMemoryReportDocumentStore,
1326
1337
  ct as createMemoryReportInstanceIds,
1327
- Ft as createMemoryReportInstanceStore,
1328
- rr as createMemoryReportJobStore,
1338
+ Vt as createMemoryReportInstanceStore,
1339
+ nr as createMemoryReportJobStore,
1340
+ er as createReportDocumentSource,
1329
1341
  Qe as createReportGenerationService,
1330
1342
  Xe as createReportInstanceManager,
1331
- _t as createReportJobService,
1343
+ Lt as createReportJobService,
1332
1344
  Yt as createReportOpenApi,
1333
1345
  W as createReportRuntime,
1334
- zt as createReportTaskQueue,
1335
- Zt as createReportTemplatePackage,
1336
- Ut as createReportWorkflow,
1346
+ _t as createReportTaskQueue,
1347
+ Kt as createReportTemplatePackage,
1348
+ Zt as createReportWorkflow,
1337
1349
  xe as parseReportTemplatePackage,
1338
- Gt as readReportDocumentPages,
1350
+ Et as readReportDocumentPages,
1339
1351
  Wt as reportHttpError,
1340
- Vt as reportInstanceParameterKey,
1352
+ Ht as reportInstanceParameterKey,
1341
1353
  Ze as reportInstanceSummary,
1342
1354
  wt as reportPackageResourceDigest,
1343
- Kt as resolveReportTemplatePackage,
1344
- Lt as reviewReportPublication,
1345
- Ht as runLabelStream,
1355
+ Xt as resolveReportTemplatePackage,
1356
+ Ft as reviewReportPublication,
1357
+ Ut as runLabelStream,
1346
1358
  Oe as runReportBatch,
1347
- nr as runnableJob,
1348
- ot as saveAndPublishReportTemplate,
1359
+ sr as runnableJob,
1360
+ at as saveAndPublishReportTemplate,
1349
1361
  P as serializeJobJson,
1350
- sr as snapshotReportBatchCases,
1362
+ or as snapshotReportBatchCases,
1351
1363
  G as snapshotReportInstance,
1352
1364
  ar as validateJobRecord,
1353
- or as validateJobTransition,
1365
+ ir as validateJobTransition,
1354
1366
  Qt as writeReportDocument
1355
1367
  };