@agile-team/mach-report 2.14.0 → 2.16.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 (282) hide show
  1. package/README.md +26 -16
  2. package/THIRD_PARTY_NOTICES.md +3 -1
  3. package/dist/{ExcelBindingWizard-CLT2p7P3.cjs → ExcelBindingWizard-CP6h2x1f.cjs} +1 -1
  4. package/dist/{ExcelBindingWizard-CvsWR8Ga.js → ExcelBindingWizard-HhB3hAJE.js} +3 -3
  5. package/dist/ParamEditor-CUQLgoxa.cjs +1 -0
  6. package/dist/ParamEditor-OKesP_nO.js +594 -0
  7. package/dist/{ReportBatchPanel-DkxTzBkD.cjs → ReportBatchPanel-cZCAMAwH.cjs} +1 -1
  8. package/dist/{ReportBatchPanel-LqVgiqp7.js → ReportBatchPanel-ruxcbfY6.js} +39 -39
  9. package/dist/ReportPreview-BcDKCLiK.js +4834 -0
  10. package/dist/ReportPreview-Bk9nLfO9.cjs +6 -0
  11. package/dist/{ReportTemplateLibrary-cQ1sqNYo.cjs → ReportTemplateLibrary-BDlNT8JN.cjs} +1 -1
  12. package/dist/{ReportTemplateLibrary-MjWEtc7X.js → ReportTemplateLibrary-DcwrH-63.js} +1 -1
  13. package/dist/{RuleEditor-BaR6xUiI.cjs → RuleEditor-BX5S8RSF.cjs} +1 -1
  14. package/dist/{RuleEditor-ChuXMlei.js → RuleEditor-CGl9XY2s.js} +5 -5
  15. package/dist/{TemplateOutlinePanel-BHKP89Xz.cjs → TemplateOutlinePanel-CGrT5DFN.cjs} +1 -1
  16. package/dist/{TemplateOutlinePanel-Dci6aRn1.js → TemplateOutlinePanel-SXCjaPKR.js} +2 -2
  17. package/dist/{TemplateReusePanel-CY5eO2Sh.cjs → TemplateReusePanel-6Z3wRFz8.cjs} +1 -1
  18. package/dist/{TemplateReusePanel-B7Gmyc1z.js → TemplateReusePanel-lHLOS9Wn.js} +2 -2
  19. package/dist/{TemplateReviewPanel-DjlX3xpt.js → TemplateReviewPanel-CJ9PLc48.js} +2 -2
  20. package/dist/{TemplateReviewPanel-JvZe9_4G.cjs → TemplateReviewPanel-Dpk7sLcF.cjs} +1 -1
  21. package/dist/analytics.cjs +1 -1
  22. package/dist/analytics.d.cts +5 -1
  23. package/dist/analytics.d.ts +5 -1
  24. package/dist/analytics.js +154 -60
  25. package/dist/artifact-integrity.json +143 -0
  26. package/dist/assets-CqIbfbTr.js +126 -0
  27. package/dist/assets-e4YSke8n.cjs +1 -0
  28. package/dist/auto-YR7a4BtF.js +240 -0
  29. package/dist/auto-uVBjX1j5.cjs +1 -0
  30. package/dist/batch-WzDIXJAt.js +220 -0
  31. package/dist/batch-z6Aw5GEY.cjs +1 -0
  32. package/dist/capabilities-DDwXr_cA.js +103 -0
  33. package/dist/capabilities-DNLyZdNw.cjs +1 -0
  34. package/dist/codes.d.cts +4 -0
  35. package/dist/codes.d.ts +4 -0
  36. package/dist/component-tree-Ca6YYfHq.js +61 -0
  37. package/dist/component-tree-DkGLEfZC.cjs +1 -0
  38. package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
  39. package/dist/config-Dg_o8e7m.cjs +1 -0
  40. package/dist/config-XQ4qrQ7Q.js +844 -0
  41. package/dist/designer-BfQSahxq.js +5163 -0
  42. package/dist/designer-CPPdeM5_.cjs +2 -0
  43. package/dist/designer.cjs +1 -1
  44. package/dist/designer.d.cts +197 -16
  45. package/dist/designer.d.ts +197 -16
  46. package/dist/designer.js +1 -1
  47. package/dist/diagnostic-notification-B9K9We3h.cjs +1 -0
  48. package/dist/diagnostic-notification-qGAYZdkB.js +7 -0
  49. package/dist/drill-CsdjgkRM.cjs +1 -0
  50. package/dist/drill-DIGsZfyB.js +145 -0
  51. package/dist/encoding-BOGq4qYL.js +21 -0
  52. package/dist/encoding-BYF9ZTl9.cjs +1 -0
  53. package/dist/{font-loader-DHto6Lra.js → font-loader-CzI1GuBc.js} +1 -1
  54. package/dist/{font-loader-vhCT8znW.cjs → font-loader-EKLzOJxf.cjs} +1 -1
  55. package/dist/index.cjs +8 -9
  56. package/dist/index.d.cts +84 -4
  57. package/dist/index.d.ts +84 -4
  58. package/dist/index.js +829 -833
  59. package/dist/json-snapshot-D6ioHth9.js +1702 -0
  60. package/dist/json-snapshot-DknkjvxP.cjs +2 -0
  61. package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
  62. package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
  63. package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
  64. package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
  65. package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
  66. package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
  67. package/dist/licenses/_types_node-14.18.63.txt +22 -0
  68. package/dist/licenses/_types_pako-2.0.3.txt +22 -0
  69. package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
  70. package/dist/licenses/archiver-5.3.2.txt +23 -0
  71. package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
  72. package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
  73. package/dist/licenses/async-3.2.6.txt +20 -0
  74. package/dist/licenses/balanced-match-1.0.2.txt +22 -0
  75. package/dist/licenses/base64-js-1.5.1.txt +22 -0
  76. package/dist/licenses/big-integer-1.6.52.txt +25 -0
  77. package/dist/licenses/binary-0.3.0.txt +178 -0
  78. package/dist/licenses/bl-4.1.0.txt +14 -0
  79. package/dist/licenses/bluebird-3.4.7.txt +22 -0
  80. package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
  81. package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
  82. package/dist/licenses/buffer-5.7.1.txt +22 -0
  83. package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
  84. package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
  85. package/dist/licenses/buffers-0.1.1.txt +140 -0
  86. package/dist/licenses/chainsaw-0.1.0.txt +184 -0
  87. package/dist/licenses/compress-commons-4.1.2.txt +23 -0
  88. package/dist/licenses/concat-map-0.0.1.txt +19 -0
  89. package/dist/licenses/core-util-is-1.0.3.txt +20 -0
  90. package/dist/licenses/crc-32-1.2.2.txt +202 -0
  91. package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
  92. package/dist/licenses/dayjs-1.11.23.txt +22 -0
  93. package/dist/licenses/duplexer2-0.1.4.txt +27 -0
  94. package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
  95. package/dist/licenses/exceljs-4.4.0.txt +23 -0
  96. package/dist/licenses/fast-csv-4.3.6.txt +22 -0
  97. package/dist/licenses/fast-png-6.4.0.txt +22 -0
  98. package/dist/licenses/fs-constants-1.0.0.txt +22 -0
  99. package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
  100. package/dist/licenses/fstream-1.0.12.txt +16 -0
  101. package/dist/licenses/glob-7.2.3.txt +22 -0
  102. package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
  103. package/dist/licenses/ieee754-1.2.1.txt +12 -0
  104. package/dist/licenses/immediate-3.0.6.txt +21 -0
  105. package/dist/licenses/inflight-1.0.6.txt +16 -0
  106. package/dist/licenses/inherits-2.0.4.txt +17 -0
  107. package/dist/licenses/iobuffer-5.4.0.txt +23 -0
  108. package/dist/licenses/isarray-1.0.0.txt +61 -0
  109. package/dist/licenses/jszip-3.10.2.txt +652 -0
  110. package/dist/licenses/lazystream-1.0.1.txt +24 -0
  111. package/dist/licenses/lie-3.3.0.txt +8 -0
  112. package/dist/licenses/listenercount-1.0.1.txt +6 -0
  113. package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
  114. package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
  115. package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
  116. package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
  117. package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
  118. package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
  119. package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
  120. package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
  121. package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
  122. package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
  123. package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
  124. package/dist/licenses/lodash.union-4.6.0.txt +48 -0
  125. package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
  126. package/dist/licenses/minimatch-3.1.5.txt +16 -0
  127. package/dist/licenses/minimatch-5.1.9.txt +16 -0
  128. package/dist/licenses/minimist-1.2.8.txt +19 -0
  129. package/dist/licenses/mkdirp-0.5.6.txt +22 -0
  130. package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
  131. package/dist/licenses/normalize-path-3.0.0.txt +22 -0
  132. package/dist/licenses/once-1.4.0.txt +16 -0
  133. package/dist/licenses/pako-1.0.11.txt +22 -0
  134. package/dist/licenses/pako-2.2.0.txt +22 -0
  135. package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
  136. package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
  137. package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
  138. package/dist/licenses/readable-stream-2.3.8.txt +48 -0
  139. package/dist/licenses/readable-stream-3.6.2.txt +48 -0
  140. package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
  141. package/dist/licenses/rimraf-2.7.1.txt +16 -0
  142. package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
  143. package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
  144. package/dist/licenses/saxes-5.0.1.txt +397 -0
  145. package/dist/licenses/setimmediate-1.0.5.txt +21 -0
  146. package/dist/licenses/string_decoder-1.1.1.txt +49 -0
  147. package/dist/licenses/string_decoder-1.3.0.txt +49 -0
  148. package/dist/licenses/tar-stream-2.2.0.txt +22 -0
  149. package/dist/licenses/tmp-0.2.7.txt +22 -0
  150. package/dist/licenses/traverse-0.3.9.txt +25 -0
  151. package/dist/licenses/tslib-1.14.1.txt +13 -0
  152. package/dist/licenses/unzipper-0.10.14.txt +26 -0
  153. package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
  154. package/dist/licenses/uuid-11.1.1.txt +10 -0
  155. package/dist/licenses/wrappy-1.0.2.txt +16 -0
  156. package/dist/licenses/xmlchars-2.2.0.txt +19 -0
  157. package/dist/licenses/zip-stream-4.1.1.txt +23 -0
  158. package/dist/matrix-CGRGkn5s.js +112 -0
  159. package/dist/matrix-gEO7ZM_u.cjs +1 -0
  160. package/dist/media-B7vnpD8k.cjs +1 -0
  161. package/dist/media-Y90dHK9z.js +70 -0
  162. package/dist/param-validation-C3HlcLLO.cjs +1 -0
  163. package/dist/param-validation-Do7Eg8Zv.js +181 -0
  164. package/dist/{pdf-AyJGb22z.cjs → pdf-ByVCb1i6.cjs} +49 -49
  165. package/dist/{pdf-8UPQebOE.js → pdf-DJ5S6ukC.js} +4924 -4872
  166. package/dist/pdf.cjs +1 -1
  167. package/dist/pdf.d.cts +20 -3
  168. package/dist/pdf.d.ts +20 -3
  169. package/dist/pdf.js +2 -2
  170. package/dist/{plugin-BGKf-Tqg.js → plugin-C2j5_mhx.js} +2 -2
  171. package/dist/{plugin-CktLH_Iy.cjs → plugin-Dr39GBRG.cjs} +1 -1
  172. package/dist/prepared-DdrjLC7L.cjs +1 -0
  173. package/dist/prepared-DqtpvRTn.js +87 -0
  174. package/dist/progress-B0ctFpKf.cjs +1 -0
  175. package/dist/progress-BXzlVbIp.js +29 -0
  176. package/dist/progress-DJBd9Rb9.cjs +1 -0
  177. package/dist/progress-Hc2vxoCs.js +52 -0
  178. package/dist/protocol-BzwMP4Vw.cjs +1 -0
  179. package/dist/protocol-kt4Iy6-3.js +90 -0
  180. package/dist/record-bindings-CZWBJ1fU.js +195 -0
  181. package/dist/record-bindings-DUX1VMlR.cjs +1 -0
  182. package/dist/{region-binding-workflow-DEJbhpCv.js → region-binding-workflow-CWNvIjkV.js} +1 -1
  183. package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-CqSMxQ4p.cjs} +1 -1
  184. package/dist/report-encoding-worker.cjs +1 -0
  185. package/dist/report-encoding-worker.d.ts +1 -0
  186. package/dist/report-encoding-worker.js +2 -0
  187. package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
  188. package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
  189. package/dist/rich-text-layout-ALlMoYOG.cjs +3 -0
  190. package/dist/rich-text-layout-Ct5WrY1g.js +102 -0
  191. package/dist/runtime-BjKBI530.js +168 -0
  192. package/dist/runtime-CBFEPKEs.cjs +1 -0
  193. package/dist/sbom.cdx.json +3982 -0
  194. package/dist/server/node.d.cts +106 -2
  195. package/dist/server/node.d.ts +106 -2
  196. package/dist/server-node.cjs +5 -1
  197. package/dist/server-node.js +4634 -539
  198. package/dist/server.cjs +1 -1
  199. package/dist/server.d.cts +780 -5
  200. package/dist/server.d.ts +780 -5
  201. package/dist/server.js +773 -691
  202. package/dist/sha256-BshdOkCC.cjs +1 -0
  203. package/dist/sha256-DTG-Gq8i.js +157 -0
  204. package/dist/style-67OqfNed.js +73 -0
  205. package/dist/style-C22Pbv3T.cjs +1 -0
  206. package/dist/style.css +1 -1
  207. package/dist/template-bindings-C2SpvsMU.js +58 -0
  208. package/dist/template-bindings-CEtWyiLX.cjs +1 -0
  209. package/dist/template-catalog-BtR2JmCL.js +414 -0
  210. package/dist/template-catalog-C2NLdrwB.cjs +1 -0
  211. package/dist/{template-fragments-DFUpq5QM.cjs → template-fragments-BVsbxs4a.cjs} +1 -1
  212. package/dist/{template-fragments-CLkGo6To.js → template-fragments-By0aZC1D.js} +21 -21
  213. package/dist/{template-outline-B3xVkzSv.cjs → template-outline-BwRV_eRo.cjs} +1 -1
  214. package/dist/{template-outline-CFenM1PV.js → template-outline-cnWfT_LK.js} +3 -3
  215. package/dist/template-registry-C62vpv4a.cjs +1 -0
  216. package/dist/template-registry-Cw3vRTX2.js +801 -0
  217. package/dist/textwrap-BEIg2w8y.js +110 -0
  218. package/dist/textwrap-BI-yJ6Wt.cjs +4 -0
  219. package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
  220. package/dist/vue/async.d.cts +189 -14
  221. package/dist/vue/async.d.ts +189 -14
  222. package/dist/vue/index.d.cts +246 -22
  223. package/dist/vue/index.d.ts +246 -22
  224. package/dist/vue-async.cjs +1 -1
  225. package/dist/vue-async.js +3 -3
  226. package/dist/vue.cjs +1 -1
  227. package/dist/vue.js +80 -78
  228. package/dist/{workbook-session-BfK1yHOO.js → workbook-session-BeSO8PFB.js} +5460 -5295
  229. package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Cbts-22R.cjs} +19 -19
  230. package/dist/worker.cjs +1 -1
  231. package/dist/worker.d.cts +104 -2
  232. package/dist/worker.d.ts +104 -2
  233. package/dist/worker.js +12 -156
  234. package/dist/xlsx-node.cjs +35 -35
  235. package/dist/xlsx-node.js +2138 -2137
  236. package/dist/xlsx.cjs +4 -4
  237. package/dist/xlsx.d.cts +24 -10
  238. package/dist/xlsx.d.ts +24 -10
  239. package/dist/xlsx.js +303 -277
  240. package/package.json +7 -4
  241. package/dist/ParamEditor-CflQV3eQ.js +0 -526
  242. package/dist/ParamEditor-vIDzvpPV.cjs +0 -1
  243. package/dist/ReportPreview-CvbqLUzM.cjs +0 -6
  244. package/dist/ReportPreview-D_ywJ_-H.js +0 -4533
  245. package/dist/assets-C2U-e-Sz.cjs +0 -4
  246. package/dist/assets-Q0wUwNrV.js +0 -217
  247. package/dist/batch-DzaTNLWI.js +0 -371
  248. package/dist/batch-xMkqYiTr.cjs +0 -1
  249. package/dist/capabilities-CK_7hizc.js +0 -63
  250. package/dist/capabilities-CsZ-pNHR.cjs +0 -1
  251. package/dist/config-0UIohTS7.cjs +0 -1
  252. package/dist/config-Dt9NtCPl.js +0 -566
  253. package/dist/data-explanation-BktvER5B.cjs +0 -1
  254. package/dist/data-explanation-C_J6jYNi.js +0 -16
  255. package/dist/defaults-DXhiM1ZD.js +0 -10
  256. package/dist/defaults-xhmcLLrf.cjs +0 -1
  257. package/dist/designer-Ci1LizA9.js +0 -5020
  258. package/dist/designer-rtmVIIdN.cjs +0 -2
  259. package/dist/grid-strokes-Cr7DwUux.cjs +0 -1
  260. package/dist/grid-strokes-DyyG1q_o.js +0 -53
  261. package/dist/json-snapshot-BeFT3Tso.js +0 -1952
  262. package/dist/json-snapshot-D1NTP2oI.cjs +0 -2
  263. package/dist/matrix-DVyWiYsd.cjs +0 -1
  264. package/dist/matrix-yZsGnldA.js +0 -227
  265. package/dist/page-window-index-CIuT4BAv.js +0 -43
  266. package/dist/page-window-index-DEjnM6IB.cjs +0 -1
  267. package/dist/param-validation-BlHHXs6u.js +0 -153
  268. package/dist/param-validation-DCK039V1.cjs +0 -1
  269. package/dist/progress-7OSZbFok.js +0 -39
  270. package/dist/progress-BnLiS5eH.cjs +0 -1
  271. package/dist/render-plan-7xpGrCEl.cjs +0 -1
  272. package/dist/render-plan-Ck6koX9L.js +0 -13
  273. package/dist/style-CQ1PK8ZB.js +0 -67
  274. package/dist/style-UgIJSA1F.cjs +0 -1
  275. package/dist/task-events-DQ276fn2.cjs +0 -1
  276. package/dist/task-events-Dpsvf_t2.js +0 -47
  277. package/dist/template-bindings-BJR4k7qZ.cjs +0 -1
  278. package/dist/template-bindings-Daui7hLF.js +0 -252
  279. package/dist/template-registry-COXDEJEM.js +0 -570
  280. package/dist/template-registry-D3SjENi6.cjs +0 -1
  281. package/dist/validate-BJ5HIWY8.cjs +0 -1
  282. package/dist/validate-CkQBWCeg.js +0 -163
@@ -0,0 +1,801 @@
1
+ import { v as X } from "./matrix-CGRGkn5s.js";
2
+ import { v as Y, c as Q } from "./computed-C-4C2S5h.js";
3
+ import { c as j, r as Z, R as ee } from "./component-tree-Ca6YYfHq.js";
4
+ import { c as te } from "./code-options-BKXXY7NI.js";
5
+ import { v as ie, e as se } from "./param-validation-Do7Eg8Zv.js";
6
+ import { v as ne, a as oe } from "./tree-CjVZLRw7.js";
7
+ function ae(e, i, t) {
8
+ e !== void 0 && (typeof e != "string" || !e.trim() || e.length > 4096) && t.push({ path: i, message: "来源范围应为不超过 4096 字符的非空字符串" });
9
+ }
10
+ function D(e, i, t) {
11
+ e.editable !== void 0 && typeof e.editable != "boolean" && t.push({ path: `${i}.editable`, message: "编辑控制应为布尔值" }), e.valueType !== void 0 && !["text", "number", "boolean"].includes(e.valueType) && t.push({ path: `${i}.valueType`, message: "编辑类型应为 text、number 或 boolean" });
12
+ }
13
+ function fe(e, i, t) {
14
+ D(e, i, t), e.indentMm !== void 0 && (typeof e.indentMm != "number" || !Number.isFinite(e.indentMm) || e.indentMm < 0) && t.push({ path: `${i}.indentMm`, message: "单元格缩进应为有限非负数" }), e.derived !== void 0 && typeof e.derived != "boolean" && t.push({ path: `${i}.derived`, message: "派生结果标记应为布尔值" }), V(e.source, `${i}.source`, t, !0), e.formula !== void 0 && typeof e.formula != "string" && t.push({ path: `${i}.formula`, message: "单元格公式应为字符串" });
15
+ }
16
+ function V(e, i, t, s = !1) {
17
+ if (e === void 0) return;
18
+ if (!e || typeof e != "object" || Array.isArray(e)) {
19
+ t.push({ path: i, message: "业务来源应为对象" });
20
+ return;
21
+ }
22
+ const n = e;
23
+ ae(n.sourceScope, `${i}.sourceScope`, t);
24
+ for (const o of ["datasetId", ...s ? ["field"] : []])
25
+ (typeof n[o] != "string" || !n[o].trim()) && t.push({ path: `${i}.${o}`, message: "业务标识应为非空字符串" });
26
+ for (const o of ["rowKey", "revision"]) {
27
+ const a = n[o];
28
+ a === void 0 && !(s && o === "rowKey") || typeof a != "string" && !(typeof a == "number" && Number.isFinite(a)) && t.push({ path: `${i}.${o}`, message: "业务键及修订号应为字符串或有限数字" });
29
+ }
30
+ n.sourceToken !== void 0 && typeof n.sourceToken != "string" && t.push({ path: `${i}.sourceToken`, message: "来源令牌应为字符串" });
31
+ }
32
+ const re = /* @__PURE__ */ new Set([
33
+ "text",
34
+ "image",
35
+ "barcode",
36
+ "qrcode",
37
+ "chart",
38
+ "line",
39
+ "rect",
40
+ "ellipse"
41
+ ]);
42
+ function g(e) {
43
+ return typeof e == "object" && e !== null && !Array.isArray(e);
44
+ }
45
+ function E(e) {
46
+ return e === null ? "null" : typeof e == "string" ? JSON.stringify(e.slice(0, 120)) : ["number", "boolean", "undefined"].includes(typeof e) ? String(e) : `[${typeof e}]`;
47
+ }
48
+ function de(e, i, t, s) {
49
+ const n = e[i];
50
+ (typeof n != "number" || !Number.isFinite(n)) && s.push({ path: `${t}.${i}`, message: `应为有限数字,实际 ${E(n)}` });
51
+ }
52
+ function ue(e, i, t) {
53
+ if (e !== void 0) {
54
+ const s = `${i}.table`;
55
+ if (!g(e)) t.push({ path: s, message: "逻辑表来源应为对象" });
56
+ else {
57
+ V(e.source, `${s}.source`, t), (typeof e.id != "string" || !e.id.trim()) && t.push({ path: `${s}.id`, message: "逻辑表 ID 应为非空字符串" });
58
+ const n = e.role;
59
+ ["header", "body", "group-header", "subtotal", "grand-total"].includes(n) || t.push({ path: `${s}.role`, message: "未知逻辑表行角色" });
60
+ const o = e.rowIndex;
61
+ (typeof o != "number" || !Number.isInteger(o) || (n === "header" ? o !== -1 : o < 0)) && t.push({ path: `${s}.rowIndex`, message: "表头索引应为 -1,内容行索引应为非负整数" }), (!Array.isArray(e.columnKeys) || e.columnKeys.some((a) => typeof a != "string")) && t.push({ path: `${s}.columnKeys`, message: "逻辑列字段应为字符串数组" }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${s}.layout`, message: "布局应为 page 或 wide" }), e.title !== void 0 && typeof e.title != "string" && t.push({ path: `${s}.title`, message: "逻辑表名称应为字符串" });
62
+ }
63
+ }
64
+ }
65
+ function he(e, i, t, s) {
66
+ if (e !== void 0)
67
+ if (!g(e) || !Array.isArray(e.cells))
68
+ t.push({ path: `${i}.grid.cells`, message: "grid.cells 应为二维数组" });
69
+ else {
70
+ const n = e.paddingMm;
71
+ n !== void 0 && (typeof n != "number" || !Number.isFinite(n) || n < 0) && t.push({ path: `${i}.grid.paddingMm`, message: "单元格内距应为有限非负数" }), e.cells.forEach((o, a) => {
72
+ if (!Array.isArray(o)) {
73
+ t.push({ path: `${i}.grid.cells.${a}`, message: "行应为数组" });
74
+ return;
75
+ }
76
+ o.forEach((f, r) => {
77
+ if (f == null) return;
78
+ const d = `${i}.grid.cells.${a}.${r}`;
79
+ if (!g(f)) {
80
+ t.push({ path: d, message: "网格单元格应为对象或 null" });
81
+ return;
82
+ }
83
+ fe(f, d, t), K(f.richParagraphs, d, t), Array.isArray(f.children) && f.children.forEach((u, p) => {
84
+ I(u, `${i}.grid.cells.${a}.${r}.children.${p}`, t, s);
85
+ });
86
+ });
87
+ });
88
+ }
89
+ }
90
+ function S(e, i, t, s) {
91
+ e !== void 0 && !i.includes(e) && s.push({ path: t, message: "未知富文本属性值" });
92
+ }
93
+ function F(e, i, t, s, n = 0) {
94
+ for (const o of i) {
95
+ const a = e[o];
96
+ a !== void 0 && (typeof a != "number" || !Number.isFinite(a) || a < n) && s.push({ path: `${t}.${o}`, message: "富文本数值应为范围内有限数字" });
97
+ }
98
+ }
99
+ function me(e, i, t) {
100
+ if (e !== void 0) {
101
+ if (!g(e)) {
102
+ t.push({ path: i, message: "富文本样式应为对象" });
103
+ return;
104
+ }
105
+ for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"])
106
+ e[s] !== void 0 && typeof e[s] != "string" && t.push({ path: `${i}.${s}`, message: "富文本样式应为字符串" });
107
+ for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"])
108
+ e[s] !== void 0 && typeof e[s] != "boolean" && t.push({ path: `${i}.${s}`, message: "富文本样式应为布尔值" });
109
+ F(e, ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight", "opacity"], i, t), F(e, ["letterSpacing", "rotateDeg"], i, t, -1 / 0), typeof e.opacity == "number" && e.opacity > 1 && t.push({ path: `${i}.opacity`, message: "透明度不能大于1" }), S(e.align, ["left", "center", "right", "justify"], `${i}.align`, t), S(e.verticalAlign, ["top", "middle", "bottom"], `${i}.verticalAlign`, t);
110
+ }
111
+ }
112
+ function ce(e, i, t) {
113
+ if (!g(e)) {
114
+ t.push({ path: i, message: "富文本片段应为对象" });
115
+ return;
116
+ }
117
+ S(e.kind, ["text", "field"], `${i}.kind`, t);
118
+ for (const s of ["text", "field"])
119
+ e[s] !== void 0 && typeof e[s] != "string" && t.push({ path: `${i}.${s}`, message: "富文本内容应为字符串" });
120
+ me(e.style, `${i}.style`, t);
121
+ }
122
+ function K(e, i, t) {
123
+ if (e !== void 0) {
124
+ if (!Array.isArray(e)) {
125
+ t.push({ path: `${i}.richParagraphs`, message: "richParagraphs 应为数组" });
126
+ return;
127
+ }
128
+ e.forEach((s, n) => {
129
+ const o = `${i}.richParagraphs.${n}`;
130
+ if (!g(s) || !Array.isArray(s.segments)) {
131
+ t.push({ path: o, message: "段落缺少 segments 数组" });
132
+ return;
133
+ }
134
+ S(s.align, ["left", "center", "right", "justify"], `${o}.align`, t), F(s, ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"], o, t), s.segments.forEach((a, f) => ce(a, `${o}.segments.${f}`, t));
135
+ });
136
+ }
137
+ }
138
+ function H(e, i, t, s = []) {
139
+ const n = j([e], i);
140
+ if (n) {
141
+ t.push(n);
142
+ return;
143
+ }
144
+ I(e, i, t, s);
145
+ }
146
+ function I(e, i, t, s = []) {
147
+ if (!g(e)) {
148
+ t.push({ path: i, message: "组件应为对象" });
149
+ return;
150
+ }
151
+ const n = e.kind;
152
+ typeof n != "string" ? t.push({ path: `${i}.kind`, message: "组件缺少 kind 字符串" }) : re.has(n) || s.push({
153
+ path: `${i}.kind`,
154
+ message: `未知组件类型 ${E(n)},将以兜底方式渲染`
155
+ });
156
+ for (const o of ["leftMm", "topMm", "widthMm", "heightMm"])
157
+ de(e, o, i, t);
158
+ typeof e.leftMm == "number" && e.leftMm < -100 && t.push({ path: `${i}.leftMm`, message: "几何数值异常(leftMm<-100)" });
159
+ for (const o of ["widthMm", "heightMm"])
160
+ typeof e[o] == "number" && e[o] < 0 && t.push({ path: `${i}.${o}`, message: "组件尺寸不能为负数" });
161
+ ue(e.table, i, t), ge(e.code, n, i, t), e.pageAnchor !== void 0 && !["header", "footer"].includes(e.pageAnchor) && t.push({ path: `${i}.pageAnchor`, message: "页面锚点应为 header 或 footer" }), e.lineDirection !== void 0 && !["down", "up"].includes(e.lineDirection) && t.push({ path: `${i}.lineDirection`, message: "线段方向应为 down 或 up" }), he(e.grid, i, t, s), K(e.richParagraphs, i, t);
162
+ }
163
+ function ge(e, i, t, s) {
164
+ if (e !== void 0)
165
+ for (const n of te(e, i)) s.push({ path: `${t}.code${n.path ? `.${n.path}` : ""}`, message: n.message });
166
+ }
167
+ function J(e, i, t) {
168
+ if (!g(e)) return;
169
+ e.binding !== void 0 && t.push({ path: `${i}.binding`, message: "渲染计划不允许未解析字段绑定" });
170
+ const s = e.grid;
171
+ !g(s) || !Array.isArray(s.cells) || s.cells.forEach((n, o) => {
172
+ Array.isArray(n) && n.forEach((a, f) => {
173
+ !g(a) || !Array.isArray(a.children) || a.children.forEach((r, d) => J(r, `${i}.grid.cells.${o}.${f}.children.${d}`, t));
174
+ });
175
+ });
176
+ }
177
+ function pe(e, i, t, s = []) {
178
+ if (!g(e)) {
179
+ t.push({ path: i, message: "页应为对象" });
180
+ return;
181
+ }
182
+ const n = e.pageWidthMm, o = e.pageHeightMm;
183
+ (typeof n != "number" || !Number.isFinite(n) || n <= 0) && t.push({ path: `${i}.pageWidthMm`, message: `页宽非法: ${E(n)}` }), (typeof o != "number" || !(o > 0 && o < 5e3)) && t.push({ path: `${i}.pageHeightMm`, message: `页高非法: ${E(o)}` }), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" });
184
+ const a = e.components;
185
+ if (!Array.isArray(a))
186
+ t.push({ path: `${i}.components`, message: "components 应为数组" });
187
+ else if (Array.isArray(a)) {
188
+ const f = j(a, `${i}.components`);
189
+ if (f) {
190
+ t.push(f);
191
+ return;
192
+ }
193
+ a.forEach((r, d) => {
194
+ I(r, `${i}.components.${d}`, t, s), J(r, `${i}.components.${d}`, t);
195
+ });
196
+ }
197
+ }
198
+ function ye(e) {
199
+ const i = [], t = [], s = g(e) ? e.pages : void 0;
200
+ if (g(e) && e.requiresRecalculation !== void 0 && typeof e.requiresRecalculation != "boolean" && i.push({ path: "$.requiresRecalculation", message: "重算能力要求应为布尔值" }), !Array.isArray(s))
201
+ i.push({
202
+ path: "$.pages",
203
+ message: e == null ? "渲染计划为空" : "渲染计划缺少 pages 数组"
204
+ });
205
+ else {
206
+ const n = Z(s);
207
+ if (n) return { ok: !1, errors: [...i, n], warnings: t };
208
+ s.forEach((a, f) => pe(a, `$.pages.${f}`, i, t)), s.length > 2e3 && t.push({
209
+ path: "$.pages",
210
+ message: `页数异常大(${s.length} 页),渲染与打印耗时可能显著增加`
211
+ });
212
+ const o = s.reduce(
213
+ (a, f) => a + (g(f) && Array.isArray(f.components) ? f.components.length : 0),
214
+ 0
215
+ );
216
+ o > 5e4 && t.push({
217
+ path: "$.pages",
218
+ message: `组件总数异常大(${o} 个),可能触发浏览器性能限制`
219
+ });
220
+ }
221
+ return { ok: i.length === 0, errors: i, warnings: t };
222
+ }
223
+ function Qe(e) {
224
+ const i = ye(e);
225
+ if (!i.ok) {
226
+ const t = i.errors.slice(0, 3).map((s) => `${s.path}: ${s.message}`).join("; ");
227
+ throw new Error(`渲染计划校验失败(${i.errors.length} 处): ${t}`);
228
+ }
229
+ return e.pages;
230
+ }
231
+ function O(e) {
232
+ return e.kind === "list" ? e.id : e.nid;
233
+ }
234
+ function le(e) {
235
+ return e.kind === "list" ? !1 : e.pageAnchor !== void 0 || e.kind === "text" && typeof e.text == "string" && /\{(?:page|totalPages)\}/.test(e.text);
236
+ }
237
+ function $e(e, i) {
238
+ const t = e.filter((n) => i.componentIds.includes(O(n) ?? ""));
239
+ if (t.filter((n) => n.kind === "list" && n.cardinality !== "record").length && t.length !== 1) throw new Error("纵向重复区域必须独占流式分段,不能与静态或单记录区域并排");
240
+ for (const n of t) {
241
+ const o = n.kind === "list" ? n.topMm + (n.rowHeightMm ?? 0) : n.topMm + n.heightMm;
242
+ if (n.topMm < i.topMm - 1e-3 || o > i.topMm + i.heightMm + 1e-3) throw new Error("流式分段应完整包含其组件的原始纵向范围");
243
+ }
244
+ }
245
+ function Ze(e, i) {
246
+ if (!i) return e.map((s) => ({ components: [s] }));
247
+ const t = new Map(e.map((s) => [O(s), s]));
248
+ return i.bands.map((s) => ({ band: s, components: s.componentIds.map((n) => {
249
+ const o = t.get(n);
250
+ if (!o) throw new Error(`流式区域引用不存在的组件:${n}`);
251
+ return o;
252
+ }) }));
253
+ }
254
+ function be(e, i) {
255
+ if (!i || !Array.isArray(i.bands) || !i.bands.length || i.bands.length > 1e4) throw new Error("流式排版应包含 1–10000 个区域");
256
+ const t = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
257
+ for (const n of e) {
258
+ if (le(n)) continue;
259
+ const o = O(n);
260
+ if (!o || t.has(o)) throw new Error("流式排版组件应具有唯一标识");
261
+ t.add(o);
262
+ }
263
+ if (Ae(e, i, t, s), s.size !== t.size) throw new Error("流式排版必须显式包含每个非锚点组件");
264
+ }
265
+ function Ae(e, i, t, s) {
266
+ let n = -1 / 0;
267
+ for (const o of i.bands) {
268
+ if (!Number.isFinite(o.topMm) || !Number.isFinite(o.heightMm) || o.topMm < 0 || o.heightMm <= 0 || o.topMm < n - 1e-3) throw new Error("流式区域应按原始位置排序,尺寸有效且不重叠");
269
+ if (!Array.isArray(o.componentIds) || !o.componentIds.length) throw new Error("流式区域不能没有组件");
270
+ for (const a of o.componentIds) {
271
+ if (!t.has(a) || s.has(a)) throw new Error(`流式区域组件缺失、重复或包含页锚点:${a}`);
272
+ s.add(a);
273
+ }
274
+ $e(e, o), n = o.topMm + o.heightMm;
275
+ }
276
+ }
277
+ const we = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
278
+ function l(e) {
279
+ return !!e && typeof e == "object" && !Array.isArray(e);
280
+ }
281
+ function N(e) {
282
+ return typeof e == "string" && !!e.trim() && !we.has(e);
283
+ }
284
+ function v(e, i, t, s) {
285
+ for (const n of Object.keys(e)) i.includes(n) || s.push({ path: `${t}.${n}`, message: "存在未知配置字段" });
286
+ }
287
+ function Me(e, i, t) {
288
+ if (e !== void 0) {
289
+ if (!l(e) || !["number", "percent", "date"].includes(String(e.kind))) {
290
+ t.push({ path: i, message: "绑定格式应为 number、percent 或 date" });
291
+ return;
292
+ }
293
+ v(e, e.kind === "date" ? ["kind", "pattern"] : e.kind === "number" ? ["kind", "digits", "thousands"] : ["kind", "digits"], i, t), e.digits !== void 0 && (!Number.isInteger(e.digits) || Number(e.digits) < 0 || Number(e.digits) > 100) && t.push({ path: `${i}.digits`, message: "精度应为 0..100 整数" }), e.thousands !== void 0 && typeof e.thousands != "boolean" && t.push({ path: `${i}.thousands`, message: "千分位开关应为布尔值" }), e.pattern !== void 0 && typeof e.pattern != "string" && t.push({ path: `${i}.pattern`, message: "日期格式应为字符串" });
294
+ }
295
+ }
296
+ function Ne(e, i, t) {
297
+ const s = e.binding;
298
+ if (s === void 0) return;
299
+ const n = `${i}.binding`;
300
+ if (!l(s)) {
301
+ t.push({ path: n, message: "字段绑定应为对象" });
302
+ return;
303
+ }
304
+ (!["text", "image", "barcode", "qrcode"].includes(String(e.kind)) || e.grid !== void 0) && t.push({ path: n, message: "绑定仅支持独立文本、图片、条码与二维码组件" }), v(s, ["field", "format", "prefix", "suffix", "emptyText"], n, t), N(s.field) || t.push({ path: `${n}.field`, message: "绑定字段应为安全的非空字段名(按字面读取自有字段)" });
305
+ for (const o of ["prefix", "suffix", "emptyText"]) s[o] !== void 0 && typeof s[o] != "string" && t.push({ path: `${n}.${o}`, message: "应为字符串" });
306
+ Me(s.format, `${n}.format`, t), e.kind === "image" && ["format", "prefix", "suffix"].some((o) => s[o] !== void 0) && t.push({ path: n, message: "图片绑定直接读取 PNG/JPEG data URL,不支持文本格式或前后缀" });
307
+ }
308
+ function ke(e, i) {
309
+ if (!l(e)) {
310
+ i.push({ path: "$.repeat", message: "逐记录配置应为对象" });
311
+ return;
312
+ }
313
+ v(e, ["dataset", "rowKey", "copies"], "$.repeat", i), N(e.dataset) || i.push({ path: "$.repeat.dataset", message: "数据集应为安全的非空名称" }), e.rowKey !== void 0 && !N(e.rowKey) && i.push({ path: "$.repeat.rowKey", message: "业务主键应为安全的非空字段名" });
314
+ const t = e.copies;
315
+ t !== void 0 && (l(t) ? (v(t, ["field"], "$.repeat.copies", i), N(t.field) || i.push({ path: "$.repeat.copies.field", message: "复制数字段应为安全的非空字段名" })) : (!Number.isSafeInteger(t) || Number(t) < 1 || Number(t) > 1e3) && i.push({ path: "$.repeat.copies", message: "每条记录复制数应为 1..1000 整数" }));
316
+ }
317
+ function W(e, i, t, s) {
318
+ if (!l(e)) return;
319
+ Ne(e, i, s), e.binding !== void 0 && !t && s.push({ path: `${i}.binding`, message: "字段绑定需要模板 repeat 数据集;普通报表请使用列表字段" }), t && e.kind === "list" && s.push({ path: i, message: "逐记录标签使用固定组件;动态列表请使用普通报表模板" });
320
+ const n = e.grid;
321
+ l(n) && Array.isArray(n.cells) && n.cells.forEach((o, a) => {
322
+ Array.isArray(o) && o.forEach((f, r) => {
323
+ l(f) && Array.isArray(f.children) && f.children.forEach((d, u) => W(d, `${i}.grid.cells.${a}.${r}.children.${u}`, t, s));
324
+ });
325
+ });
326
+ }
327
+ function Ee(e, i) {
328
+ const t = e.repeat !== void 0;
329
+ t && ke(e.repeat, i), Array.isArray(e.pages) && e.pages.forEach((s, n) => {
330
+ if (!l(s)) return;
331
+ const o = `$.pages.${n}`;
332
+ t && (s.layout === "wide" || s.flow !== void 0) && i.push({ path: o, message: "逐记录标签仅支持固定尺寸页面,不支持宽表或流式分区" }), Array.isArray(s.components) && s.components.forEach((a, f) => {
333
+ const r = `${o}.components.${f}`;
334
+ if (W(a, r, t, i), !t || !l(a)) return;
335
+ const { leftMm: d, topMm: u, widthMm: p, heightMm: y } = a;
336
+ [d, u, p, y, s.widthMm, s.heightMm].every((A) => typeof A == "number" && Number.isFinite(A)) && (Number(d) < 0 || Number(u) < 0 || Number(d) + Number(p) > Number(s.widthMm) + 1e-3 || Number(u) + Number(y) > Number(s.heightMm) + 1e-3) && i.push({ path: r, message: "标签组件超出纸张边界,请调整位置或尺寸" });
337
+ });
338
+ });
339
+ }
340
+ function G(e) {
341
+ return !!e && typeof e == "object" && !Array.isArray(e);
342
+ }
343
+ function T(e, i, t) {
344
+ if (e !== void 0) {
345
+ if (!G(e)) {
346
+ t.push({ path: i, message: "条件应为对象" });
347
+ return;
348
+ }
349
+ (typeof e.field != "string" || !e.field.trim()) && t.push({ path: `${i}.field`, message: "条件需要字段" }), e.numeric !== void 0 && e.numeric !== "number" && e.numeric !== "decimal" && t.push({ path: `${i}.numeric`, message: "未知条件数值模式" }), [">", ">=", "<", "<=", "==", "!="].includes(e.op) || t.push({ path: `${i}.op`, message: "未知条件运算符" }), typeof e.value != "string" && !(typeof e.value == "number" && Number.isFinite(e.value)) && t.push({
350
+ path: `${i}.value`,
351
+ message: "条件值应为字符串或有限数字"
352
+ });
353
+ }
354
+ }
355
+ function U(e, i, t) {
356
+ if (e === void 0) return;
357
+ if (!Array.isArray(e) || e.length > 2048) {
358
+ t.push({ path: i, message: "聚合应为数组且最多 2048 项" });
359
+ return;
360
+ }
361
+ const s = /* @__PURE__ */ new Set();
362
+ e.forEach((n, o) => {
363
+ const a = `${i}.${o}`;
364
+ if (!G(n)) {
365
+ t.push({ path: a, message: "聚合应为对象" });
366
+ return;
367
+ }
368
+ const f = n.field;
369
+ typeof f != "string" || !f.trim() || s.has(f) ? t.push({
370
+ path: `${a}.field`,
371
+ message: "聚合输出字段应非空且唯一"
372
+ }) : s.add(f), n.numeric !== void 0 && n.numeric !== "number" && n.numeric !== "decimal" && t.push({
373
+ path: `${a}.numeric`,
374
+ message: "数值模式应为 number 或 decimal"
375
+ }), n.digits !== void 0 && (!Number.isInteger(n.digits) || Number(n.digits) < 0 || Number(n.digits) > 100) && t.push({
376
+ path: `${a}.digits`,
377
+ message: "小数位应为 0–100 的整数"
378
+ });
379
+ try {
380
+ Q({
381
+ ...n,
382
+ field: n.valueField ?? f
383
+ });
384
+ } catch (r) {
385
+ t.push({
386
+ path: a,
387
+ message: r instanceof Error ? r.message : String(r)
388
+ });
389
+ }
390
+ });
391
+ }
392
+ function Se(e, i, t) {
393
+ if (e === void 0) return;
394
+ const s = Y(e);
395
+ for (const n of s.errors) t.push({ path: i, message: n });
396
+ }
397
+ function ve(e, i, t) {
398
+ if (e !== void 0)
399
+ try {
400
+ X(e);
401
+ } catch (s) {
402
+ t.push({
403
+ path: i,
404
+ message: s instanceof Error ? s.message : String(s)
405
+ });
406
+ }
407
+ }
408
+ function xe(e, i, t) {
409
+ if (e.tree === void 0) return;
410
+ const s = `${i}.tree`;
411
+ try {
412
+ ne(e.tree);
413
+ const n = e.tree;
414
+ if (e.matrix || e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.rowVisibleWhen) throw new Error("树形布局不能同时配置普通分组、矩阵、主从或行可见条件");
415
+ if (e.rowKey !== void 0 && e.rowKey !== n.idField) throw new Error("树形 rowKey 应与 idField 一致");
416
+ if (!Array.isArray(e.columns) || !e.columns.some((o) => o && o.field === n.labelField && !o.hidden)) throw new Error("树形布局需要可见的标签列");
417
+ Array.isArray(e.computed) && oe(n, e.computed);
418
+ } catch (n) {
419
+ t.push({ path: s, message: n instanceof Error ? n.message : String(n) });
420
+ }
421
+ }
422
+ const B = "1.0";
423
+ class w extends Error {
424
+ constructor(i) {
425
+ super(`模板校验失败:${i.slice(0, 3).map((t) => `${t.path}: ${t.message}`).join("; ")}`), this.errors = i, this.name = "ReportTemplateError";
426
+ }
427
+ }
428
+ const Re = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]), Fe = /* @__PURE__ */ new Set(["schemaVersion", "id", "name", "revision", "description", "template"]), Te = /* @__PURE__ */ new Set(["left", "center", "right", "justify"]), k = 2e5, Ie = 64, P = 1e7;
429
+ function h(e) {
430
+ return !!e && typeof e == "object" && !Array.isArray(e);
431
+ }
432
+ function Oe(e, i, t) {
433
+ const s = Object.getPrototypeOf(e), n = Array.isArray(e);
434
+ if (n ? s !== Array.prototype : s !== Object.prototype && s !== null)
435
+ return t.push({ path: i, message: "模板对象必须使用普通 JSON 对象原型" }), !1;
436
+ if (n) {
437
+ const o = Object.keys(e);
438
+ if (o.length !== e.length || o.some((a) => !/^(0|[1-9]\d*)$/.test(a) || Number(a) >= e.length))
439
+ return t.push({ path: i, message: "模板数组不能包含空位或额外属性" }), !1;
440
+ }
441
+ return Object.getOwnPropertySymbols(e).length > 0 ? (t.push({ path: i, message: "模板不能包含 Symbol 键" }), !1) : !0;
442
+ }
443
+ function Pe(e, i, t, s) {
444
+ return Re.has(e) ? (s.push({ path: t, message: "模板不能包含可能污染原型的键" }), !1) : i.get || i.set || !i.enumerable ? (s.push({ path: t, message: "模板不能包含访问器或不可枚举字段" }), !1) : !0;
445
+ }
446
+ function Le(e) {
447
+ return e === null || typeof e == "boolean" || typeof e == "number" && Number.isFinite(e);
448
+ }
449
+ function L(e, i) {
450
+ const t = /* @__PURE__ */ new Set();
451
+ let s = 0, n = 0, o = !1;
452
+ const a = (f, r, d) => {
453
+ if (!o) {
454
+ if (++s > k) {
455
+ s === k + 1 && i.push({ path: r, message: "模板超过 JSON 节点安全上限" });
456
+ return;
457
+ }
458
+ if (d > Ie) {
459
+ i.push({ path: r, message: "模板嵌套层级过深" });
460
+ return;
461
+ }
462
+ if (typeof f == "string") {
463
+ n += f.length, n > P && (o = !0, i.push({ path: r, message: "模板文本超过 1000 万字符的安全上限" }));
464
+ return;
465
+ }
466
+ if (!Le(f)) {
467
+ if (!f || typeof f != "object") {
468
+ i.push({ path: r, message: "模板只允许 JSON 值,不允许函数、undefined 或非有限数字" });
469
+ return;
470
+ }
471
+ if (t.has(f)) {
472
+ i.push({ path: r, message: "模板不能包含循环引用" });
473
+ return;
474
+ }
475
+ if (Oe(f, r, i)) {
476
+ t.add(f);
477
+ for (const [u, p] of Object.entries(Object.getOwnPropertyDescriptors(f))) {
478
+ if (Array.isArray(f) && u === "length") continue;
479
+ const y = `${r}.${u}`;
480
+ if (Pe(u, p, y, i) && a(p.value, y, d + 1), s > k || o) break;
481
+ }
482
+ t.delete(f);
483
+ }
484
+ }
485
+ }
486
+ };
487
+ a(e, "$", 0);
488
+ }
489
+ function m(e, i, t, s, n = !1) {
490
+ const o = e[i];
491
+ o === void 0 && !n || (typeof o != "string" || n && !o.trim()) && s.push({ path: `${t}.${i}`, message: n ? "应为非空字符串" : "应为字符串" });
492
+ }
493
+ function c(e, i, t, s, n = 0, o = !1) {
494
+ const a = e[i];
495
+ a === void 0 && !o || (typeof a != "number" || !Number.isFinite(a) || a < n) && s.push({ path: `${t}.${i}`, message: `应为大于等于 ${n} 的有限数字` });
496
+ }
497
+ function b(e, i, t, s) {
498
+ e[i] !== void 0 && typeof e[i] != "boolean" && s.push({ path: `${t}.${i}`, message: "应为布尔值" });
499
+ }
500
+ function M(e, i, t, s = !1) {
501
+ e !== void 0 && !Te.has(e) && !(s && e === "auto") && t.push({ path: i, message: `未知对齐方式${s ? "(支持 auto)" : ""}` });
502
+ }
503
+ function $(e, i, t) {
504
+ if (e !== void 0) {
505
+ if (!h(e)) {
506
+ t.push({ path: i, message: "样式应为对象" });
507
+ return;
508
+ }
509
+ M(e.align, `${i}.align`, t), e.verticalAlign !== void 0 && !["top", "middle", "bottom"].includes(e.verticalAlign) && t.push({ path: `${i}.verticalAlign`, message: "未知垂直对齐方式" });
510
+ for (const s of ["fontSize", "fontSizePx", "lineWidthPt", "lineHeight"]) c(e, s, i, t);
511
+ for (const s of ["letterSpacing", "rotateDeg"]) c(e, s, i, t, -1 / 0);
512
+ c(e, "opacity", i, t), typeof e.opacity == "number" && e.opacity > 1 && t.push({ path: `${i}.opacity`, message: "透明度不能大于 1" });
513
+ for (const s of ["bold", "italic", "underline", "borderTop", "borderRight", "borderBottom", "borderLeft"]) b(e, s, i, t);
514
+ for (const s of ["fontFamily", "color", "backgroundColor", "lineColor", "borderColor"]) m(e, s, i, t);
515
+ }
516
+ }
517
+ function _e(e, i, t) {
518
+ if (e === void 0) return;
519
+ if (!Array.isArray(e)) {
520
+ t.push({ path: i, message: "参数定义应为数组" });
521
+ return;
522
+ }
523
+ const s = /* @__PURE__ */ new Set(), n = t.length;
524
+ e.forEach((o, a) => {
525
+ const f = `${i}.${a}`;
526
+ if (!h(o)) {
527
+ t.push({ path: f, message: "参数定义应为对象" });
528
+ return;
529
+ }
530
+ m(o, "field", f, t, !0), typeof o.field == "string" && (s.has(o.field) && t.push({ path: `${f}.field`, message: "参数名重复" }), s.add(o.field)), o.type !== void 0 && !["text", "number", "date", "month", "year", "dateRange", "select"].includes(o.type) && t.push({ path: `${f}.type`, message: "未知参数类型" });
531
+ for (const r of ["label", "defaultValue", "placeholder"]) m(o, r, f, t);
532
+ b(o, "required", f, t);
533
+ for (const r of ["minLength", "maxLength"]) {
534
+ const d = o[r];
535
+ d !== void 0 && (typeof d != "number" || !Number.isSafeInteger(d) || d < 0) && t.push({ path: `${f}.${r}`, message: "长度边界应为非负整数" });
536
+ }
537
+ Ce(o, f, t), o.options !== void 0 && (Array.isArray(o.options) ? o.options.forEach((r, d) => {
538
+ const u = `${f}.options.${d}`;
539
+ if (!h(r)) t.push({ path: u, message: "选项应为对象" });
540
+ else
541
+ for (const p of ["label", "value"]) typeof r[p] != "string" && t.push({ path: `${u}.${p}`, message: "选项标签与值应为字符串(允许空白选项)" });
542
+ }) : t.push({ path: `${f}.options`, message: "选项应为数组" }));
543
+ }), t.length === n && t.push(...ie(e).map((o) => ({ path: o.path.replace("$.paramDefs", i), message: o.message })));
544
+ }
545
+ function Ce(e, i, t) {
546
+ for (const o of ["min", "max"]) {
547
+ const a = e[o];
548
+ if (a === void 0) continue;
549
+ se(e.type, a) || e.type === "number" && typeof a == "number" && Number.isFinite(a) || t.push({ path: `${i}.${o}`, message: "数字使用有限数字边界,日期/月/年使用对应规范字符串边界" });
550
+ }
551
+ const s = typeof e.min == "number" && typeof e.max == "number" && e.min > e.max, n = typeof e.min == "string" && typeof e.max == "string" && e.min > e.max;
552
+ (s || n) && t.push({ path: i, message: "最小边界不能大于最大边界" }), typeof e.minLength == "number" && typeof e.maxLength == "number" && e.minLength > e.maxLength && t.push({ path: i, message: "最小长度不能大于最大长度" });
553
+ }
554
+ function z(e, i, t) {
555
+ if (!Array.isArray(e) || e.length === 0) {
556
+ t.push({ path: i, message: "列表至少需要一列" });
557
+ return;
558
+ }
559
+ e.every((s) => h(s) && s.hidden === !0) && t.push({ path: i, message: "列表至少需要一列可见列" }), e.forEach((s, n) => {
560
+ const o = `${i}.${n}`;
561
+ if (!h(s)) {
562
+ t.push({ path: o, message: "列应为对象" });
563
+ return;
564
+ }
565
+ if (D(s, o, t), b(s, "hidden", o, t), T(s.visibleWhen, `${o}.visibleWhen`, t), typeof s.header != "string" && t.push({ path: `${o}.header`, message: "表头应为字符串(允许空白表头)" }), m(s, "field", o, t, !0), c(s, "widthMm", o, t, Number.MIN_VALUE, !0), $(s.style, `${o}.style`, t), $(s.headerStyle, `${o}.headerStyle`, t), M(s.align, `${o}.align`, t, !0), M(s.headerAlign, `${o}.headerAlign`, t), s.semanticRole !== void 0 && !["identifier", "dimension", "measure", "date", "text"].includes(s.semanticRole) && t.push({ path: `${o}.semanticRole`, message: "未知列语义" }), s.format !== void 0)
566
+ if (!h(s.format) || !["number", "percent", "date"].includes(s.format.kind))
567
+ t.push({ path: `${o}.format`, message: "未知列格式" });
568
+ else {
569
+ const a = s.format.digits;
570
+ a !== void 0 && (typeof a != "number" || !Number.isInteger(a) || a < 0 || a > 100) && t.push({ path: `${o}.format.digits`, message: "小数位应为 0–100 的整数" }), b(s.format, "thousands", `${o}.format`, t), m(s.format, "pattern", `${o}.format`, t);
571
+ }
572
+ s.rules !== void 0 && (Array.isArray(s.rules) ? s.rules.forEach((a, f) => {
573
+ const r = `${o}.rules.${f}`;
574
+ if (!h(a) || !h(a.when)) {
575
+ t.push({ path: r, message: "条件格式缺少 when 对象" });
576
+ return;
577
+ }
578
+ T(a.when, `${r}.when`, t), m(a.when, "field", `${r}.when`, t, !0), [">", ">=", "<", "<=", "==", "!="].includes(a.when.op) || t.push({ path: `${r}.when.op`, message: "未知条件运算符" }), typeof a.when.value != "number" && typeof a.when.value != "string" && t.push({ path: `${r}.when.value`, message: "条件值应为数字或字符串" }), $(a.style, `${r}.style`, t);
579
+ }) : t.push({ path: `${o}.rules`, message: "条件格式应为数组" }));
580
+ });
581
+ }
582
+ function q(e, i, t) {
583
+ if (e !== void 0) {
584
+ if (!h(e)) {
585
+ t.push({ path: i, message: "分组应为对象" });
586
+ return;
587
+ }
588
+ m(e, "field", i, t, !0);
589
+ for (const s of ["headerTemplate", "subtotalLabel"]) m(e, s, i, t);
590
+ for (const s of ["headerStyle", "subtotalStyle"]) $(e[s], `${i}.${s}`, t);
591
+ b(e, "keepWithNext", i, t), b(e, "repeatHeader", i, t), U(e.aggregates, `${i}.aggregates`, t), e.subtotal !== void 0 && (!Array.isArray(e.subtotal) || e.subtotal.some((s) => typeof s != "string")) && t.push({ path: `${i}.subtotal`, message: "小计字段应为字符串数组" });
592
+ }
593
+ }
594
+ function je(e, i, t) {
595
+ if (!(e === void 0 || typeof e == "boolean")) {
596
+ if (!h(e)) {
597
+ t.push({ path: i, message: "合计应为布尔值或对象" });
598
+ return;
599
+ }
600
+ m(e, "label", i, t), U(e.aggregates, `${i}.aggregates`, t), $(e.style, `${i}.style`, t), e.fields !== void 0 && (!Array.isArray(e.fields) || e.fields.some((s) => typeof s != "string")) && t.push({ path: `${i}.fields`, message: "合计字段应为字符串数组" });
601
+ }
602
+ }
603
+ function De(e, i, t, s) {
604
+ const n = { kind: "rect", leftMm: 0, topMm: 0, widthMm: 1, heightMm: 1, grid: e };
605
+ if (H(n, t, s, []), _(n, t, s), !h(e) || !Array.isArray(e.cells)) return;
606
+ const o = e.cells, a = Array.isArray(i) ? i.length : 0;
607
+ if (o.length * a > k) {
608
+ s.push({ path: t, message: "表头逻辑网格超过 20 万格安全上限" });
609
+ return;
610
+ }
611
+ e.cells.length || s.push({ path: `${t}.cells`, message: "表头至少需要一行" }), Array.isArray(e.colWidthsMm) && e.colWidthsMm.length !== a && s.push({ path: `${t}.colWidthsMm`, message: "表头列宽数量应与列表列数一致" }), Array.isArray(e.rowHeightsMm) && e.rowHeightsMm.length !== e.cells.length && s.push({ path: `${t}.rowHeightsMm`, message: "表头行高数量应与行数一致" }), Ve(o, a, t, s);
612
+ }
613
+ function Ve(e, i, t, s) {
614
+ const n = /* @__PURE__ */ new Set();
615
+ e.forEach((o, a) => {
616
+ if (!Array.isArray(o)) return;
617
+ let f = 0;
618
+ o.forEach((r, d) => {
619
+ for (; n.has(`${a}:${f}`); ) f++;
620
+ const u = h(r) && typeof r.colSpan == "number" ? r.colSpan : 1, p = h(r) && typeof r.rowSpan == "number" ? r.rowSpan : 1;
621
+ (f + u > i || a + p > e.length) && s.push({ path: `${t}.cells.${a}.${d}`, message: "表头合并区域超出表头边界" });
622
+ for (let y = a; y < Math.min(e.length, a + p); y++)
623
+ for (let A = f; A < Math.min(i, f + u); A++)
624
+ n.has(`${y}:${A}`) && s.push({ path: `${t}.cells.${a}.${d}`, message: "表头合并区域重叠" }), n.add(`${y}:${A}`);
625
+ f += u;
626
+ });
627
+ });
628
+ }
629
+ function Ke(e, i, t) {
630
+ if (xe(e, i, t), Se(e.computed, `${i}.computed`, t), ve(e.matrix, `${i}.matrix`, t), e.matrix && (e.detail || e.groupBy || Array.isArray(e.groups) && e.groups.length || e.grandTotal) && t.push({ path: `${i}.matrix`, message: "矩阵请使用自身 totals 汇总,不能同时配置普通分组、总计或主从明细" }), T(e.rowVisibleWhen, `${i}.rowVisibleWhen`, t), e.groups !== void 0 && (!Array.isArray(e.groups) || e.groups.length > 16 ? t.push({ path: `${i}.groups`, message: "分组应为数组,最多 16 级" }) : e.groups.forEach((o, a) => q(o, `${i}.groups.${a}`, t))), e.detail === void 0) return;
631
+ const s = e.detail, n = `${i}.detail`;
632
+ if (!h(s)) {
633
+ t.push({ path: n, message: "主从关联应为对象" });
634
+ return;
635
+ }
636
+ for (const o of ["dataset", "parentKey", "foreignKey"]) m(s, o, n, t, !0);
637
+ for (const o of ["rowKey", "revisionField", "sourceTokenField"]) m(s, o, n, t, s[o] !== void 0);
638
+ m(s, "label", n, t), b(s, "header", n, t), c(s, "rowHeightMm", n, t, Number.MIN_VALUE), z(s.columns, `${n}.columns`, t), s.unmatched !== void 0 && s.unmatched !== "error" && s.unmatched !== "ignore" && t.push({ path: `${n}.unmatched`, message: "未关联明细策略应为 error 或 ignore" });
639
+ }
640
+ function He(e, i, t) {
641
+ for (const s of ["leftMm", "topMm"]) c(e, s, i, t, -1 / 0, !0);
642
+ c(e, "widthMm", i, t, Number.MIN_VALUE, !0), m(e, "dataset", i, t, !0), m(e, "title", i, t);
643
+ for (const s of ["rowKey", "revisionField", "sourceTokenField"]) m(e, s, i, t, e[s] !== void 0);
644
+ e.headerGrid !== void 0 && De(e.headerGrid, e.columns, `${i}.headerGrid`, t), e.layout !== void 0 && e.layout !== "page" && e.layout !== "wide" && t.push({ path: `${i}.layout`, message: "布局应为 page 或 wide" }), z(e.columns, `${i}.columns`, t);
645
+ for (const s of ["fontSizePt", "rowHeightMm"]) c(e, s, i, t, Number.MIN_VALUE);
646
+ c(e, "paddingMm", i, t);
647
+ for (const s of ["header", "headerBold", "headerEveryPage", "border"]) b(e, s, i, t);
648
+ e.cardinality !== void 0 && e.cardinality !== "record" && t.push({ path: `${i}.cardinality`, message: "单记录区域类型应为 record" }), m(e, "headerBackgroundColor", i, t), M(e.align, `${i}.align`, t, !0), M(e.headerAlign, `${i}.headerAlign`, t), $(e.headerStyle, `${i}.headerStyle`, t), Ke(e, i, t), q(e.groupBy, `${i}.groupBy`, t), je(e.grandTotal, `${i}.grandTotal`, t);
649
+ }
650
+ function C(e, i, t) {
651
+ Array.isArray(e.richParagraphs) && e.richParagraphs.forEach((s, n) => {
652
+ if (!h(s)) return;
653
+ const o = `${i}.richParagraphs.${n}`;
654
+ M(s.align, `${o}.align`, t);
655
+ for (const a of ["lineHeight", "spaceBeforeMm", "spaceAfterMm", "indentMm"]) c(s, a, o, t);
656
+ Array.isArray(s.segments) && s.segments.forEach((a, f) => {
657
+ const r = `${o}.segments.${f}`;
658
+ if (!h(a)) {
659
+ t.push({ path: r, message: "富文本片段应为对象" });
660
+ return;
661
+ }
662
+ a.kind !== void 0 && a.kind !== "text" && a.kind !== "field" && t.push({ path: `${r}.kind`, message: "未知富文本片段类型" });
663
+ for (const d of ["text", "field"]) m(a, d, r, t);
664
+ $(a.style, `${r}.style`, t);
665
+ });
666
+ });
667
+ }
668
+ function _(e, i, t) {
669
+ $(e.style, `${i}.style`, t);
670
+ for (const n of ["text", "rawText", "imageData", "fallbackText", "nid", "rkey"]) m(e, n, i, t);
671
+ if (e.lines !== void 0 && (!Array.isArray(e.lines) || e.lines.some((n) => typeof n != "string")) && t.push({ path: `${i}.lines`, message: "文本行应为字符串数组" }), C(e, i, t), !h(e.grid)) return;
672
+ const s = e.grid;
673
+ c(s, "gapMm", `${i}.grid`, t), c(s, "paddingMm", `${i}.grid`, t);
674
+ for (const n of ["colWidthsMm", "rowHeightsMm"]) {
675
+ const o = s[n];
676
+ o !== void 0 && (!Array.isArray(o) || o.some((a) => typeof a != "number" || !Number.isFinite(a) || a < 0)) && t.push({ path: `${i}.grid.${n}`, message: "网格尺寸应为有限非负数字数组" });
677
+ }
678
+ Array.isArray(s.cells) && s.cells.forEach((n, o) => {
679
+ Array.isArray(n) && n.forEach((a, f) => {
680
+ const r = `${i}.grid.cells.${o}.${f}`;
681
+ if (a !== null) {
682
+ if (!h(a)) {
683
+ t.push({ path: r, message: "网格单元格应为对象或 null" });
684
+ return;
685
+ }
686
+ for (const d of ["text", "rawText", "numberFormat"]) m(a, d, r, t);
687
+ for (const d of ["colSpan", "rowSpan"]) {
688
+ const u = a[d];
689
+ u !== void 0 && (typeof u != "number" || !Number.isInteger(u) || u <= 0) && t.push({ path: `${r}.${d}`, message: "跨度应为正整数" });
690
+ }
691
+ a.value !== void 0 && a.value !== null && !["string", "number", "boolean"].includes(typeof a.value) && t.push({ path: `${r}.value`, message: "Excel 原始值应为字符串、数字、布尔值或 null" }), $(a.style, `${r}.style`, t), C(a, r, t), a.children !== void 0 && (Array.isArray(a.children) ? a.children.forEach((d, u) => {
692
+ h(d) && _(d, `${r}.children.${u}`, t);
693
+ }) : t.push({ path: `${r}.children`, message: "嵌套组件应为数组" }));
694
+ }
695
+ });
696
+ });
697
+ }
698
+ function Je(e, i, t) {
699
+ if (!(e.flow === void 0 || !Array.isArray(e.components)))
700
+ try {
701
+ be(e.components, e.flow);
702
+ } catch (s) {
703
+ t.push({ path: `${i}.flow`, message: s instanceof Error ? s.message : String(s) });
704
+ }
705
+ }
706
+ function We(e) {
707
+ const i = [], t = [];
708
+ return L(e, i), i.length ? { ok: !1, errors: i, warnings: t } : (h(e) ? (e.schemaVersion !== void 0 && e.schemaVersion !== ee && i.push({ path: "$.schemaVersion", message: "不支持的模板 schemaVersion" }), _e(e.params, "$.params", i), Ee(e, i), !Array.isArray(e.pages) || e.pages.length === 0 ? i.push({ path: "$.pages", message: "模板至少需要一页" }) : e.pages.forEach((s, n) => {
709
+ const o = `$.pages.${n}`;
710
+ if (!h(s)) {
711
+ i.push({ path: o, message: "页应为对象" });
712
+ return;
713
+ }
714
+ c(s, "widthMm", o, i, Number.MIN_VALUE, !0), c(s, "heightMm", o, i, Number.MIN_VALUE, !0), s.layout !== void 0 && s.layout !== "page" && s.layout !== "wide" && i.push({ path: `${o}.layout`, message: "布局应为 page 或 wide" }), typeof s.heightMm == "number" && s.heightMm >= 5e3 && i.push({ path: `${o}.heightMm`, message: "页高应小于 5000mm" });
715
+ for (const a of ["marginTopMm", "marginBottomMm", "marginLeftMm", "marginRightMm"]) c(s, a, o, i);
716
+ typeof s.widthMm == "number" && Number(s.marginLeftMm ?? 0) + Number(s.marginRightMm ?? 0) >= s.widthMm && i.push({ path: o, message: "横向页边距占满页面" }), typeof s.heightMm == "number" && Number(s.marginTopMm ?? 0) + Number(s.marginBottomMm ?? 0) >= s.heightMm && i.push({ path: o, message: "纵向页边距占满页面" }), Array.isArray(s.components) ? s.components.forEach((a, f) => {
717
+ const r = `${o}.components.${f}`;
718
+ h(a) && a.kind === "list" ? He(a, r, i) : (H(a, r, i, t), h(a) && _(a, r, i));
719
+ }) : i.push({ path: `${o}.components`, message: "组件应为数组" }), Je(s, o, i);
720
+ })) : i.push({ path: "$", message: "模板应为对象" }), { ok: i.length === 0, errors: i, warnings: t });
721
+ }
722
+ function Ge(e) {
723
+ const i = [], t = [];
724
+ if (L(e, i), i.length) return { ok: !1, errors: i, warnings: t };
725
+ if (!h(e)) i.push({ path: "$", message: "模板文档应为对象" });
726
+ else {
727
+ for (const n of Object.keys(e))
728
+ Fe.has(n) || i.push({ path: `$.${n}`, message: "模板文档存在未知字段;只保存模板与描述,不保存取数或业务数据" });
729
+ e.schemaVersion !== B && i.push({ path: "$.schemaVersion", message: "不支持的模板文档版本" });
730
+ for (const n of ["id", "name"]) m(e, n, "$", i, !0);
731
+ for (const n of ["revision", "description"]) m(e, n, "$", i);
732
+ const s = We(e.template);
733
+ i.push(...s.errors.map((n) => ({ ...n, path: `$.template${n.path.slice(1)}` }))), t.push(...s.warnings.map((n) => ({ ...n, path: `$.template${n.path.slice(1)}` })));
734
+ }
735
+ return { ok: i.length === 0, errors: i, warnings: t };
736
+ }
737
+ function R(e) {
738
+ const i = Ge(e);
739
+ if (!i.ok) throw new w(i.errors);
740
+ }
741
+ function et(e) {
742
+ const i = [];
743
+ if (L(e, i), i.length) throw new w(i);
744
+ const t = { ...e, schemaVersion: e.schemaVersion ?? B };
745
+ return R(t), x(t);
746
+ }
747
+ function tt(e) {
748
+ let i = e;
749
+ if (typeof e == "string") {
750
+ if (e.length > P)
751
+ throw new w([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
752
+ try {
753
+ i = JSON.parse(e);
754
+ } catch {
755
+ throw new w([{ path: "$", message: "模板 JSON 语法无效" }]);
756
+ }
757
+ }
758
+ return R(i), x(i);
759
+ }
760
+ function it(e) {
761
+ R(e);
762
+ const i = JSON.stringify(e, null, 2);
763
+ if (i.length > P) throw new w([{ path: "$", message: "模板 JSON 超过 1000 万字符的导出/导入上限" }]);
764
+ return i;
765
+ }
766
+ function x(e) {
767
+ return JSON.parse(JSON.stringify(e));
768
+ }
769
+ function st(e = []) {
770
+ const i = /* @__PURE__ */ new Map(), t = {
771
+ get: (s) => {
772
+ const n = i.get(s);
773
+ return n ? x(n) : void 0;
774
+ },
775
+ list: () => Array.from(i.values(), ({ template: s, ...n }) => ({ ...n })),
776
+ register: (s, n = {}) => {
777
+ if (R(s), i.has(s.id) && !n.replace) throw new w([{ path: "$.id", message: `模板 ID ${s.id} 已注册;更新需显式 replace:true` }]);
778
+ i.set(s.id, x(s));
779
+ },
780
+ remove: (s) => i.delete(s)
781
+ };
782
+ for (const s of e) t.register(s);
783
+ return t;
784
+ }
785
+ export {
786
+ w as R,
787
+ ye as a,
788
+ B as b,
789
+ Qe as c,
790
+ st as d,
791
+ et as e,
792
+ H as f,
793
+ pe as g,
794
+ Ge as h,
795
+ be as i,
796
+ Ee as j,
797
+ tt as p,
798
+ Ze as r,
799
+ it as s,
800
+ We as v
801
+ };