@agile-team/mach-report 2.13.0 → 2.15.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 (260) hide show
  1. package/README.md +20 -7
  2. package/THIRD_PARTY_NOTICES.md +3 -1
  3. package/dist/ExcelBindingWizard-BKH1nGNS.js +1485 -0
  4. package/dist/ExcelBindingWizard-Bs43BGNp.cjs +1 -0
  5. package/dist/ParamEditor-Da4akw6V.cjs +1 -0
  6. package/dist/ParamEditor-DoAhzJsm.js +594 -0
  7. package/dist/{ReportBatchPanel-CW2HV9I8.js → ReportBatchPanel-BMf6boMA.js} +39 -39
  8. package/dist/ReportBatchPanel-wP9m9Pj1.cjs +1 -0
  9. package/dist/ReportPreview-ChV19HBp.js +4619 -0
  10. package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
  11. package/dist/{ReportTemplateLibrary-BZB-XWjj.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
  12. package/dist/ReportTemplateLibrary-Sxr3eD0J.cjs +1 -0
  13. package/dist/RuleEditor-C_Clasvd.js +2037 -0
  14. package/dist/RuleEditor-XhGHK8DE.cjs +1 -0
  15. package/dist/TemplateOutlinePanel-D6Bkny59.js +96 -0
  16. package/dist/TemplateOutlinePanel-JTSR53vJ.cjs +1 -0
  17. package/dist/TemplateReusePanel-Kx35S0Ql.cjs +1 -0
  18. package/dist/TemplateReusePanel-rVuK1kTz.js +388 -0
  19. package/dist/TemplateReviewPanel-B0ar9_zf.js +592 -0
  20. package/dist/TemplateReviewPanel-Dn6X9UmY.cjs +1 -0
  21. package/dist/analytics.cjs +1 -1
  22. package/dist/analytics.d.cts +3 -1
  23. package/dist/analytics.d.ts +3 -1
  24. package/dist/analytics.js +154 -60
  25. package/dist/artifact-integrity.json +135 -0
  26. package/dist/assets-B9ImAi6_.cjs +1 -0
  27. package/dist/assets-DEaz4qsp.js +124 -0
  28. package/dist/batch-BaP6pWDE.cjs +1 -0
  29. package/dist/batch-BfZHN1do.js +220 -0
  30. package/dist/batch-CGyt-b2W.js +273 -0
  31. package/dist/batch-CLpELXBl.cjs +1 -0
  32. package/dist/capabilities-CAh2Nrue.cjs +1 -0
  33. package/dist/capabilities-DskCHs3V.js +69 -0
  34. package/dist/codes.d.cts +2 -0
  35. package/dist/codes.d.ts +2 -0
  36. package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
  37. package/dist/config-BVsJXSqS.js +842 -0
  38. package/dist/config-D10us76d.cjs +1 -0
  39. package/dist/data-explanation-B8MZRYVS.js +16 -0
  40. package/dist/data-explanation-DE55G30w.cjs +1 -0
  41. package/dist/designer-2bDlcNXQ.js +5136 -0
  42. package/dist/designer-BT7XCdbW.cjs +2 -0
  43. package/dist/designer.cjs +1 -2
  44. package/dist/designer.d.cts +432 -17
  45. package/dist/designer.d.ts +432 -17
  46. package/dist/designer.js +21 -4312
  47. package/dist/drill-ByJviLXS.js +145 -0
  48. package/dist/drill-DYTxuL3A.cjs +1 -0
  49. package/dist/font-loader-B_UkxpzC.cjs +1 -0
  50. package/dist/font-loader-Q3bQjmrI.js +297 -0
  51. package/dist/index.cjs +8 -8
  52. package/dist/index.d.cts +239 -5
  53. package/dist/index.d.ts +239 -5
  54. package/dist/index.js +939 -893
  55. package/dist/json-snapshot-DFb2eWkf.js +1416 -0
  56. package/dist/json-snapshot-WWSGlaHG.cjs +2 -0
  57. package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
  58. package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
  59. package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
  60. package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
  61. package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
  62. package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
  63. package/dist/licenses/_types_node-14.18.63.txt +22 -0
  64. package/dist/licenses/_types_pako-2.0.3.txt +22 -0
  65. package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
  66. package/dist/licenses/archiver-5.3.2.txt +23 -0
  67. package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
  68. package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
  69. package/dist/licenses/async-3.2.6.txt +20 -0
  70. package/dist/licenses/balanced-match-1.0.2.txt +22 -0
  71. package/dist/licenses/base64-js-1.5.1.txt +22 -0
  72. package/dist/licenses/big-integer-1.6.52.txt +25 -0
  73. package/dist/licenses/binary-0.3.0.txt +178 -0
  74. package/dist/licenses/bl-4.1.0.txt +14 -0
  75. package/dist/licenses/bluebird-3.4.7.txt +22 -0
  76. package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
  77. package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
  78. package/dist/licenses/buffer-5.7.1.txt +22 -0
  79. package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
  80. package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
  81. package/dist/licenses/buffers-0.1.1.txt +140 -0
  82. package/dist/licenses/chainsaw-0.1.0.txt +184 -0
  83. package/dist/licenses/compress-commons-4.1.2.txt +23 -0
  84. package/dist/licenses/concat-map-0.0.1.txt +19 -0
  85. package/dist/licenses/core-util-is-1.0.3.txt +20 -0
  86. package/dist/licenses/crc-32-1.2.2.txt +202 -0
  87. package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
  88. package/dist/licenses/dayjs-1.11.23.txt +22 -0
  89. package/dist/licenses/duplexer2-0.1.4.txt +27 -0
  90. package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
  91. package/dist/licenses/exceljs-4.4.0.txt +23 -0
  92. package/dist/licenses/fast-csv-4.3.6.txt +22 -0
  93. package/dist/licenses/fast-png-6.4.0.txt +22 -0
  94. package/dist/licenses/fs-constants-1.0.0.txt +22 -0
  95. package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
  96. package/dist/licenses/fstream-1.0.12.txt +16 -0
  97. package/dist/licenses/glob-7.2.3.txt +22 -0
  98. package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
  99. package/dist/licenses/ieee754-1.2.1.txt +12 -0
  100. package/dist/licenses/immediate-3.0.6.txt +21 -0
  101. package/dist/licenses/inflight-1.0.6.txt +16 -0
  102. package/dist/licenses/inherits-2.0.4.txt +17 -0
  103. package/dist/licenses/iobuffer-5.4.0.txt +23 -0
  104. package/dist/licenses/isarray-1.0.0.txt +61 -0
  105. package/dist/licenses/jszip-3.10.2.txt +652 -0
  106. package/dist/licenses/lazystream-1.0.1.txt +24 -0
  107. package/dist/licenses/lie-3.3.0.txt +8 -0
  108. package/dist/licenses/listenercount-1.0.1.txt +6 -0
  109. package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
  110. package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
  111. package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
  112. package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
  113. package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
  114. package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
  115. package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
  116. package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
  117. package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
  118. package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
  119. package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
  120. package/dist/licenses/lodash.union-4.6.0.txt +48 -0
  121. package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
  122. package/dist/licenses/minimatch-3.1.5.txt +16 -0
  123. package/dist/licenses/minimatch-5.1.9.txt +16 -0
  124. package/dist/licenses/minimist-1.2.8.txt +19 -0
  125. package/dist/licenses/mkdirp-0.5.6.txt +22 -0
  126. package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
  127. package/dist/licenses/normalize-path-3.0.0.txt +22 -0
  128. package/dist/licenses/once-1.4.0.txt +16 -0
  129. package/dist/licenses/pako-1.0.11.txt +22 -0
  130. package/dist/licenses/pako-2.2.0.txt +22 -0
  131. package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
  132. package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
  133. package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
  134. package/dist/licenses/readable-stream-2.3.8.txt +48 -0
  135. package/dist/licenses/readable-stream-3.6.2.txt +48 -0
  136. package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
  137. package/dist/licenses/rimraf-2.7.1.txt +16 -0
  138. package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
  139. package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
  140. package/dist/licenses/saxes-5.0.1.txt +397 -0
  141. package/dist/licenses/setimmediate-1.0.5.txt +21 -0
  142. package/dist/licenses/string_decoder-1.1.1.txt +49 -0
  143. package/dist/licenses/string_decoder-1.3.0.txt +49 -0
  144. package/dist/licenses/tar-stream-2.2.0.txt +22 -0
  145. package/dist/licenses/tmp-0.2.7.txt +22 -0
  146. package/dist/licenses/traverse-0.3.9.txt +25 -0
  147. package/dist/licenses/tslib-1.14.1.txt +13 -0
  148. package/dist/licenses/unzipper-0.10.14.txt +26 -0
  149. package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
  150. package/dist/licenses/uuid-11.1.1.txt +10 -0
  151. package/dist/licenses/wrappy-1.0.2.txt +16 -0
  152. package/dist/licenses/xmlchars-2.2.0.txt +19 -0
  153. package/dist/licenses/zip-stream-4.1.1.txt +23 -0
  154. package/dist/matrix-CGRGkn5s.js +112 -0
  155. package/dist/matrix-gEO7ZM_u.cjs +1 -0
  156. package/dist/media-B7vnpD8k.cjs +1 -0
  157. package/dist/media-Y90dHK9z.js +70 -0
  158. package/dist/param-validation-C3HlcLLO.cjs +1 -0
  159. package/dist/param-validation-Do7Eg8Zv.js +181 -0
  160. package/dist/pdf-BwNyeGpt.js +36352 -0
  161. package/dist/pdf-CvvrjPQg.cjs +103 -0
  162. package/dist/pdf.cjs +1 -101
  163. package/dist/pdf.d.cts +18 -3
  164. package/dist/pdf.d.ts +18 -3
  165. package/dist/pdf.js +9 -36579
  166. package/dist/plugin-Ca_XZG3l.js +22 -0
  167. package/dist/{plugin-DzS6pxTA.cjs → plugin-DHO7X8z2.cjs} +1 -1
  168. package/dist/prepared-CFy9B75C.cjs +1 -0
  169. package/dist/prepared-ajM-H-9B.js +69 -0
  170. package/dist/progress-B0ctFpKf.cjs +1 -0
  171. package/dist/progress-D-OTpEav.js +52 -0
  172. package/dist/{record-bindings-D-5jQlTj.js → record-bindings-Do_b3h4V.js} +1 -1
  173. package/dist/{region-binding-workflow-CcUq8W2Q.js → region-binding-workflow-BMhK_TjP.js} +1 -1
  174. package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
  175. package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
  176. package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
  177. package/dist/sbom.cdx.json +3982 -0
  178. package/dist/server/node.d.cts +66 -12
  179. package/dist/server/node.d.ts +66 -12
  180. package/dist/server-node.cjs +1 -1
  181. package/dist/server-node.js +405 -381
  182. package/dist/server.cjs +1 -1
  183. package/dist/server.d.cts +878 -15
  184. package/dist/server.d.ts +878 -15
  185. package/dist/server.js +1034 -534
  186. package/dist/sha256-ArEYjaTI.cjs +1 -0
  187. package/dist/sha256-DPEuJ3nh.js +155 -0
  188. package/dist/style.css +1 -1
  189. package/dist/template-bindings-C2SpvsMU.js +58 -0
  190. package/dist/template-bindings-CEtWyiLX.cjs +1 -0
  191. package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
  192. package/dist/template-catalog-j2B1MJlL.js +414 -0
  193. package/dist/template-fragments-BGbQLGlV.js +187 -0
  194. package/dist/template-fragments-DcKeiylI.cjs +1 -0
  195. package/dist/template-outline-BwRV_eRo.cjs +1 -0
  196. package/dist/template-outline-cnWfT_LK.js +88 -0
  197. package/dist/{template-registry-BjE1VS6g.js → template-registry-BtaKPELV.js} +364 -201
  198. package/dist/template-registry-Co1zPq5e.cjs +1 -0
  199. package/dist/textwrap-CWHyzkBH.cjs +4 -0
  200. package/dist/textwrap-DE1kgcJB.js +110 -0
  201. package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
  202. package/dist/{useLocalDraft-C07SYRnC.js → useLocalDraft-BnhcxXk_.js} +1 -1
  203. package/dist/{useLocalDraft-Yiw1wFgI.cjs → useLocalDraft-CioIfDb6.cjs} +1 -1
  204. package/dist/vue/async.d.cts +190 -15
  205. package/dist/vue/async.d.ts +190 -15
  206. package/dist/vue/index.d.cts +274 -24
  207. package/dist/vue/index.d.ts +274 -24
  208. package/dist/vue-async.cjs +1 -1
  209. package/dist/vue-async.js +5 -5
  210. package/dist/vue.cjs +1 -1
  211. package/dist/vue.js +90 -81
  212. package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
  213. package/dist/{workbook-session-BPb3TMnT.js → workbook-session-BvToI-Fd.js} +5440 -5288
  214. package/dist/worker.cjs +1 -1
  215. package/dist/worker.d.cts +66 -12
  216. package/dist/worker.d.ts +66 -12
  217. package/dist/worker.js +61 -56
  218. package/dist/xlsx-node.cjs +34 -34
  219. package/dist/xlsx-node.js +878 -870
  220. package/dist/xlsx.cjs +3 -4
  221. package/dist/xlsx.d.cts +22 -10
  222. package/dist/xlsx.d.ts +22 -10
  223. package/dist/xlsx.js +261 -253
  224. package/package.json +2 -2
  225. package/dist/ExcelBindingWizard-CeAf4QSE.js +0 -1465
  226. package/dist/ExcelBindingWizard-y0mT-AHR.cjs +0 -1
  227. package/dist/ParamEditor-BLaE5q5W.js +0 -522
  228. package/dist/ParamEditor-MBBC7lUE.cjs +0 -1
  229. package/dist/ReportBatchPanel-Fp1ePFag.cjs +0 -1
  230. package/dist/ReportPreview-BN6fk7Wz.cjs +0 -6
  231. package/dist/ReportPreview-D2Jkyh1U.js +0 -4243
  232. package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +0 -1
  233. package/dist/RuleEditor-ChRzNQuF.cjs +0 -1
  234. package/dist/RuleEditor-DzAmW5YH.js +0 -2024
  235. package/dist/TemplateReviewPanel-BKofGrV9.js +0 -222
  236. package/dist/TemplateReviewPanel-DwtOcLue.cjs +0 -1
  237. package/dist/assets-C2U-e-Sz.cjs +0 -4
  238. package/dist/assets-Q0wUwNrV.js +0 -217
  239. package/dist/batch-Bt3Fd27Z.cjs +0 -1
  240. package/dist/batch-mRqhhhjt.js +0 -364
  241. package/dist/capabilities-CK_7hizc.js +0 -63
  242. package/dist/capabilities-CsZ-pNHR.cjs +0 -1
  243. package/dist/config-Bb7RiIO5.cjs +0 -1
  244. package/dist/config-XVwG87IA.js +0 -529
  245. package/dist/matrix-DVyWiYsd.cjs +0 -1
  246. package/dist/matrix-yZsGnldA.js +0 -227
  247. package/dist/page-window-index-CIuT4BAv.js +0 -43
  248. package/dist/page-window-index-DEjnM6IB.cjs +0 -1
  249. package/dist/param-validation-BlHHXs6u.js +0 -153
  250. package/dist/param-validation-DCK039V1.cjs +0 -1
  251. package/dist/plugin-D4wizDXB.js +0 -22
  252. package/dist/progress-7OSZbFok.js +0 -39
  253. package/dist/progress-BnLiS5eH.cjs +0 -1
  254. package/dist/task-events-DQ276fn2.cjs +0 -1
  255. package/dist/task-events-Dpsvf_t2.js +0 -47
  256. package/dist/template-registry-D3SjENi6.cjs +0 -1
  257. package/dist/template-review-DGwWOoCv.cjs +0 -2
  258. package/dist/template-review-PgEe_Wr9.js +0 -1742
  259. package/dist/validate-BJ5HIWY8.cjs +0 -1
  260. package/dist/validate-DbgEM1Hh.js +0 -163
@@ -0,0 +1,4619 @@
1
+ import { computed as D, unref as u, ref as G, onScopeDispose as Ke, watch as de, getCurrentScope as Ka, shallowRef as fe, nextTick as Ge, defineComponent as ye, openBlock as w, createElementBlock as P, createElementVNode as p, createVNode as Q, createTextVNode as ie, toDisplayString as y, Fragment as ge, renderList as be, createCommentVNode as N, withModifiers as pt, withDirectives as Rt, withKeys as ja, vModelText as Mt, createBlock as Se, normalizeClass as Ce, renderSlot as ht, getCurrentInstance as rn, onMounted as ln, onUnmounted as un, createStaticVNode as Ha, isRef as Gn, inject as Ln, provide as Wa, watchEffect as Ua, normalizeStyle as We, createSlots as Va, withCtx as Gt } from "vue";
2
+ import { renderPage as Yn, renderPlanToImages as Ja, calculateReportSelection as Ga, ReportCalculationError as Ya, inspectOutputCapabilities as Za, createReportCellResolver as Et, getReportEditSession as cn, ReportCellEditError as Ae, reportCellEditKey as Je, summarizeReportCellEdits as Nn, createReportCellEditBatch as tn, parseReportCellFieldInput as Xa, applyReportEditResult as Qa, applyReportCellEditBatch as _a, getReportCellContext as at, validateReportCellFieldDefinition as es, parseReportClipboard as ts, formatReportClipboard as ns, resolvePlanAssets as as, paginateTemplate as ss, validateRenderPlan as os, renderPlanToCanvas as rs } from "@agile-team/mach-report";
3
+ import { c as Zn, m as ls, a as qn, R as is } from "./drill-ByJviLXS.js";
4
+ import { f as Xn, a as xe, w as Be, n as Bn, b as us } from "./progress-D-OTpEav.js";
5
+ import { b as cs, s as Qn, p as ds, i as _n, M as ot, u as fs, g as ms, r as gs, j as vs, t as ps, R as hs, n as bs, h as ys } from "./config-BVsJXSqS.js";
6
+ import { i as ws, a as xs } from "./render-plan-Ck6koX9L.js";
7
+ import { a as ae, _ as we } from "./_plugin-vue_export-helper-8SL1F89S.js";
8
+ import { r as dn } from "./grid-geometry-BNptEcMm.js";
9
+ import { b as ks, c as $s, M as Cs } from "./injection-keys-e85udZCp.js";
10
+ function ea(e) {
11
+ return e == null ? [] : Array.isArray(e) ? e.map(String).filter((t) => t !== "") : String(e).split(",").map((t) => t.trim()).filter((t) => t !== "");
12
+ }
13
+ function ku(e) {
14
+ return ea(e).join(",");
15
+ }
16
+ class Yt extends Error {
17
+ constructor(t) {
18
+ super(t), this.name = "PlanLoadError";
19
+ }
20
+ }
21
+ function $u(e = {}) {
22
+ const { baseUrl: t = "", headers: n, credentials: s, timeoutMs: o = 3e4 } = e, a = t.replace(/\/+$/, "");
23
+ return async ({ url: r, method: l, params: i, signal: d }) => {
24
+ let v = `${a}${r}`;
25
+ if (i && Object.keys(i).length > 0) {
26
+ const g = v.indexOf("#"), R = g >= 0 ? v.slice(g) : "", h = g >= 0 ? v.slice(0, g) : v, S = h.indexOf("?"), z = S >= 0 ? h.slice(0, S) : h, F = new URLSearchParams(S >= 0 ? h.slice(S + 1) : "");
27
+ for (const [K, V] of Object.entries(i)) F.set(K, V);
28
+ v = `${z}?${F}${R}`;
29
+ }
30
+ const m = (g, R) => {
31
+ const h = new Yt(g);
32
+ return Object.defineProperty(h, "cause", { value: R, configurable: !0, writable: !0 }), h;
33
+ };
34
+ if (d?.aborted)
35
+ throw m(`请求已取消: ${r}`, d.reason);
36
+ const f = new AbortController();
37
+ let $;
38
+ const k = () => {
39
+ f.signal.aborted || ($ = "external", f.abort(d?.reason));
40
+ };
41
+ d?.addEventListener("abort", k, { once: !0 });
42
+ const b = setTimeout(() => {
43
+ f.signal.aborted || ($ = "timeout", f.abort());
44
+ }, o);
45
+ try {
46
+ const g = await fetch(v, {
47
+ method: l.toUpperCase(),
48
+ headers: { Accept: "application/json", ...n },
49
+ credentials: s,
50
+ signal: f.signal
51
+ });
52
+ if (!g.ok)
53
+ throw new Yt(`HTTP ${g.status} ${r}`);
54
+ return await g.json();
55
+ } catch (g) {
56
+ throw $ === "timeout" ? m(`请求超时(${o}ms): ${r}`, g) : $ === "external" ? m(`请求已取消: ${r}`, g) : g instanceof Yt ? g : m(`请求失败(${r}): ${g instanceof Error ? g.message : String(g)}`, g);
57
+ } finally {
58
+ clearTimeout(b), d?.removeEventListener("abort", k);
59
+ }
60
+ };
61
+ }
62
+ function Es(e, t, n = {}) {
63
+ const s = n.pxPerMm ?? 3.7795275590551185, o = D(() => Math.max(0, u(n.gapPx) ?? 18)), a = G(0), r = G(800), l = D(() => {
64
+ const h = e.value?.pages ?? [];
65
+ return Zn(h.map((S) => S.pageHeightMm * s), o.value);
66
+ }), i = D(() => {
67
+ let h = 0;
68
+ for (const S of e.value?.pages ?? []) h = Math.max(h, S.pageWidthMm * s);
69
+ return { w: h, h: l.value.totalHeightPx };
70
+ }), d = D(() => l.value.window(
71
+ r.value / t.value,
72
+ a.value / t.value,
73
+ u(n.overscan) ?? 1
74
+ )), v = D(() => {
75
+ const h = e.value;
76
+ if (!h) return [];
77
+ const { start: S, end: z } = d.value;
78
+ return h.pages.slice(S, z + 1).map((F, K) => ({ page: F, index: S + K }));
79
+ });
80
+ let m = 0, f = !1, $;
81
+ function k(h) {
82
+ h && (a.value = h.scrollTop, r.value = h.clientHeight || 800);
83
+ }
84
+ function b(h, S) {
85
+ h.scrollTop = l.value.offsetAt(S) * t.value, $ = { top: h.scrollTop, index: S, zoom: t.value, geometry: l.value }, k(h);
86
+ }
87
+ function g(h, S) {
88
+ return (z) => {
89
+ m || f || (m = requestAnimationFrame(() => {
90
+ if (m = 0, f || (k(z), S.value <= 0)) return;
91
+ if ($ && $.top === z.scrollTop && $.zoom === t.value && $.geometry === l.value) {
92
+ h.value = Math.min(S.value, $.index + 1);
93
+ return;
94
+ }
95
+ $ = void 0;
96
+ const F = Math.max(0, z.scrollTop + 32) / t.value;
97
+ h.value = Math.min(S.value, l.value.pageAt(F) + 1);
98
+ }));
99
+ };
100
+ }
101
+ function R() {
102
+ f = !0, m && cancelAnimationFrame(m), m = 0;
103
+ }
104
+ return Ke(R), {
105
+ contentSize: i,
106
+ windowRange: d,
107
+ visiblePages: v,
108
+ makeScrollHandler: g,
109
+ refreshViewport: k,
110
+ scrollToPage: b,
111
+ pageOffsetPx: (h) => l.value.offsetAt(h),
112
+ destroy: R
113
+ };
114
+ }
115
+ const Kn = 96 / 25.4;
116
+ function Is(e) {
117
+ const t = /* @__PURE__ */ new WeakMap(), n = G(0);
118
+ let s, o = 0, a = 0, r = !1;
119
+ function l() {
120
+ o++, a && cancelAnimationFrame(a), a = 0;
121
+ }
122
+ function i(b, g, R, h) {
123
+ return !r && g === o && e.plan.value === R && e.root.value === h && h.contains(b.holder) && Number(b.holder.dataset.page) === b.index + 1;
124
+ }
125
+ function d(b) {
126
+ const { holder: g, page: R } = b;
127
+ t.delete(g), g.style.width = `${R.pageWidthMm * Kn}px`, g.style.height = `${R.pageHeightMm * Kn}px`, g.setAttribute("aria-busy", "true");
128
+ const h = g.ownerDocument.createElement("div");
129
+ h.className = "mrp-page-loading";
130
+ const S = g.ownerDocument.createElement("span");
131
+ S.textContent = e.loading(), S.style.transform = `scale(${1 / Math.max(1e-4, e.zoom())})`, h.append(S), g.replaceChildren(h);
132
+ }
133
+ function v(b) {
134
+ const g = t.get(b.holder);
135
+ return !g || g.page !== b.page || g.element.parentElement !== b.holder ? !1 : (g.query !== e.query() && (e.clear(g.element), e.highlight(g.element), g.query = e.query()), !0);
136
+ }
137
+ function m(b, g, R, h) {
138
+ if (i(b, g, R, h))
139
+ try {
140
+ const S = Yn(b.page, 96, {}, b.holder.ownerDocument);
141
+ if (e.highlight(S), !i(b, g, R, h)) return;
142
+ b.holder.replaceChildren(S), b.holder.removeAttribute("aria-busy"), t.set(b.holder, { page: b.page, element: S, query: e.query() }), e.mounted(b.holder), e.ready();
143
+ } catch (S) {
144
+ if (!i(b, g, R, h)) return;
145
+ b.holder.removeAttribute("aria-busy");
146
+ const z = b.holder.ownerDocument.createElement("div");
147
+ z.className = "mrp-page-render-error", z.setAttribute("role", "alert"), z.textContent = S instanceof Error ? S.message : String(S), b.holder.replaceChildren(z), e.error(S);
148
+ }
149
+ }
150
+ function f(b, g, R, h) {
151
+ b.length && (a = requestAnimationFrame(() => {
152
+ if (g !== o || r) return;
153
+ a = 0;
154
+ const S = b.shift();
155
+ S && m(S, g, R, h), g === o && e.plan.value === R && e.root.value === h && f(b, g, R, h);
156
+ }));
157
+ }
158
+ function $() {
159
+ l();
160
+ const b = e.plan.value, g = e.root.value;
161
+ if (r || !b || !g) {
162
+ s = void 0;
163
+ return;
164
+ }
165
+ const R = o, h = s?.plan === b ? s.index : e.priority();
166
+ s = void 0;
167
+ const S = [];
168
+ g.querySelectorAll(".mrp-page-holder").forEach((K) => {
169
+ const V = Number(K.dataset.page) - 1, ee = b.pages[V];
170
+ if (!ee) return;
171
+ const Z = { holder: K, page: ee, index: V };
172
+ v(Z) || (d(Z), S.push(Z));
173
+ });
174
+ const z = S.findIndex((K) => K.index === h), F = z < 0 ? void 0 : S.splice(z, 1)[0];
175
+ F && m(F, R, b, g), e.ready(), f(S, R, b, g);
176
+ }
177
+ function k(b) {
178
+ r || !e.plan.value || (s = { plan: e.plan.value, index: b }, n.value++);
179
+ }
180
+ return de([e.plan, e.root, e.pages, e.priority, e.focusToken, e.query, e.zoom, e.loading, n], $, { flush: "post", immediate: !0 }), Ke(() => {
181
+ r = !0, s = void 0, l();
182
+ }), { prioritize: k, cancel: l };
183
+ }
184
+ function Ps(e) {
185
+ const t = G(1), n = G("fit");
186
+ let s = 0;
187
+ function o() {
188
+ s && cancelAnimationFrame(s), s = 0;
189
+ }
190
+ function a() {
191
+ o(), s = requestAnimationFrame(() => {
192
+ if (s = 0, n.value !== "fit") return;
193
+ const l = e();
194
+ !l?.viewport || l.viewport.clientWidth <= 48 || !Number.isFinite(l.pageWidthPx) || (t.value = Math.min(1, (l.viewport.clientWidth - 48) / Math.max(1, l.pageWidthPx)));
195
+ });
196
+ }
197
+ function r(l) {
198
+ if (l === "fit")
199
+ n.value = "fit", a();
200
+ else {
201
+ if (!Number.isFinite(l)) return;
202
+ o(), n.value = "raw", t.value = Math.min(3, Math.max(0.3, l / 100));
203
+ }
204
+ }
205
+ return Ka() && Ke(o), { zoom: t, zoomMode: n, applyFitZoom: a, setZoom: r };
206
+ }
207
+ let Ss = 0;
208
+ function jn(e, t) {
209
+ const n = new AbortController();
210
+ let s = { taskId: `mr-output-${Date.now().toString(36)}-${++Ss}`, kind: e, stage: e === "print" ? "print" : "encode", status: "running", cancellable: !0 };
211
+ function o() {
212
+ try {
213
+ t?.(Object.freeze({ ...s }));
214
+ } catch {
215
+ }
216
+ }
217
+ return {
218
+ controller: n,
219
+ get task() {
220
+ return s;
221
+ },
222
+ start: o,
223
+ update(a, r, l) {
224
+ n.signal.aborted || s.status !== "running" || (s = { ...s, stage: a, completed: r, total: l }, o());
225
+ },
226
+ finish(a = "completed") {
227
+ s.status === "running" && (s = { ...s, status: a, cancellable: !1 }, o(), a === "cancelled" && n.abort());
228
+ }
229
+ };
230
+ }
231
+ class Pe extends Error {
232
+ constructor(t, n = "") {
233
+ super(`Print preparation failed: ${t} ${n}`), this.kind = t, this.resource = n, this.code = "print-resource", this.name = "ReportPrintResourceError";
234
+ }
235
+ }
236
+ function ta(e, t) {
237
+ const n = { ...cs, ...t };
238
+ return e instanceof Pe ? e.kind === "timeout" ? n.printPrepareTimeout : e.kind === "image" ? n.printImageFailed.replace("{index}", String(e.resource)) : e.kind === "font" ? n.printFontFailed.replace("{family}", String(e.resource)) : n.printPrepareFailed : n.printPrepareFailed;
239
+ }
240
+ function Rs(e, t) {
241
+ let n;
242
+ try {
243
+ n = new URL(e, t);
244
+ } catch {
245
+ throw new Pe("config");
246
+ }
247
+ if (!["http:", "https:"].includes(n.protocol) || e.length > 16384) throw new Pe("config");
248
+ return n.href;
249
+ }
250
+ async function Ms(e, t, n, s) {
251
+ const o = t.fonts ?? [];
252
+ if (o.length > 8) throw new Pe("config");
253
+ for (const a of o) {
254
+ if (xe(n), typeof a.family != "string" || !a.family.trim() || a.family.length > 256 || typeof a.source != "string") throw new Pe("config");
255
+ const r = e.defaultView?.FontFace;
256
+ if (!r || !e.fonts) throw new Pe("font", a.family);
257
+ try {
258
+ const { loadFontWithCache: l } = await import("./font-loader-Q3bQjmrI.js"), i = await l(Rs(a.source, s), { signal: n });
259
+ if (!i) throw new Pe("font", a.family);
260
+ const d = new r(a.family, i, { weight: a.weight, style: a.style });
261
+ await Be(d.load(), n), e.fonts.add(d);
262
+ } catch (l) {
263
+ throw xe(n), l instanceof Pe ? l : new Pe("font", a.family);
264
+ }
265
+ }
266
+ e.documentElement.getBoundingClientRect(), e.fonts && await Be(e.fonts.ready, n);
267
+ }
268
+ async function Ts(e, t, n) {
269
+ xe(n);
270
+ try {
271
+ if (typeof e.decode == "function" ? await Be(e.decode(), n) : e.complete || await new Promise((s, o) => {
272
+ const a = () => {
273
+ e.removeEventListener("load", r), e.removeEventListener("error", l), n.removeEventListener("abort", i);
274
+ }, r = () => {
275
+ a(), s();
276
+ }, l = () => {
277
+ a(), o(new Pe("image", t));
278
+ }, i = () => {
279
+ a(), o(n.reason);
280
+ };
281
+ e.addEventListener("load", r, { once: !0 }), e.addEventListener("error", l, { once: !0 }), n.addEventListener("abort", i, { once: !0 }), n.aborted ? i() : e.complete && r();
282
+ }), xe(n), e.naturalWidth <= 0 || e.naturalHeight <= 0) throw new Pe("image", t);
283
+ } catch {
284
+ throw xe(n), new Pe("image", t);
285
+ }
286
+ }
287
+ async function na(e, t = {}, n, s = document.baseURI) {
288
+ const o = t.resourceTimeoutMs ?? 15e3;
289
+ if (!Number.isSafeInteger(o) || o < 1 || o > 12e4) throw new Pe("config");
290
+ const a = new AbortController(), r = Xn(n, a), l = setTimeout(() => a.abort(new Pe("timeout")), o);
291
+ try {
292
+ xe(a.signal), await Ms(e, t, a.signal, s);
293
+ const i = e.querySelectorAll("img");
294
+ let d = 0;
295
+ const v = async () => {
296
+ for (; d < i.length; ) {
297
+ const m = d++;
298
+ await Ts(i[m], m + 1, a.signal);
299
+ }
300
+ };
301
+ await Promise.all(Array.from({ length: Math.min(i.length, 4) }, v)), xe(a.signal);
302
+ } finally {
303
+ clearTimeout(l), r(), a.abort();
304
+ }
305
+ }
306
+ const st = 8;
307
+ function vt() {
308
+ return new Promise((e) => setTimeout(e, 0));
309
+ }
310
+ function $t(e) {
311
+ return `p${e.pageWidthMm}x${e.pageHeightMm}`.replace(/[.+]/g, "_");
312
+ }
313
+ function It(e) {
314
+ const t = /* @__PURE__ */ new Map();
315
+ return e.pages.forEach((o) => {
316
+ t.has($t(o)) || t.set($t(o), o);
317
+ }), `<!doctype html><html><head><meta charset="utf-8"><style>${`.mr-page{margin:0 auto;page-break-after:always;}
318
+ .mr-page tr{break-inside:avoid;page-break-inside:avoid;}
319
+ .mr-comp{break-inside:avoid;page-break-inside:avoid;}
320
+ ${[...t.values()].map(
321
+ (o) => `@page ${$t(o)}{size:${o.pageWidthMm}mm ${o.pageHeightMm}mm;margin:0;}`
322
+ ).join(`
323
+ `)}
324
+ body{margin:0;background:#fff;}`}</style></head><body>`;
325
+ }
326
+ function Pt(e, t) {
327
+ const n = Yn(e, 96, {}, document);
328
+ n.style.page = $t(e);
329
+ const s = ds(t);
330
+ if (s.x || s.y) {
331
+ const o = document.createElement("div");
332
+ for (o.style.cssText = `position:absolute;inset:0;transform:translate(${s.x}mm,${s.y}mm);transform-origin:top left`; n.firstChild; ) o.appendChild(n.firstChild);
333
+ n.appendChild(o);
334
+ }
335
+ return n.outerHTML;
336
+ }
337
+ function Os(e, t) {
338
+ return { head: It(e), pageChunks: e.pages.map((n) => Pt(n, t)) };
339
+ }
340
+ async function Ds(e, t = {}) {
341
+ const n = {
342
+ schemaVersion: "mach-report-batch-print",
343
+ pages: e.flatMap((l) => l.pages)
344
+ };
345
+ if (n.pages.length === 0) return;
346
+ const s = Qn(t.printOptions), o = It(n), a = document.createElement("iframe");
347
+ a.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(a);
348
+ let r = !1;
349
+ try {
350
+ const l = a.contentDocument;
351
+ l.open(), l.write(o);
352
+ for (let i = 0; i < n.pages.length; i++)
353
+ xe(t.signal), l.write(Pt(n.pages[i], s)), i % st === st - 1 && (Bn(t, i + 1, n.pages.length), await vt());
354
+ l.write("</body></html>"), l.close(), await vt(), await na(l, s, t.signal), Bn(t, n.pages.length, n.pages.length), a.contentWindow?.focus(), a.contentWindow?.print(), r = !0;
355
+ } catch (l) {
356
+ throw t.signal?.aborted || us(() => t.onError?.(ta(l, t.messages))), l;
357
+ } finally {
358
+ r ? setTimeout(() => a.remove(), 6e4) : a.remove();
359
+ }
360
+ }
361
+ function aa(e) {
362
+ return `<!doctype html><html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head><meta charset="utf-8"><!--[if gte mso 9]><xml><w:WordDocument><w:View>Print</w:View><w:Zoom>100</w:Zoom></w:WordDocument></xml><![endif]-->${e.replace(/^<!doctype html><html><head>/, "")}`;
363
+ }
364
+ function Cu(e) {
365
+ const { head: t, pageChunks: n } = Os(e);
366
+ return {
367
+ html: `${aa(t)}${n.join("")}</body></html>`,
368
+ filename: "mach-report.doc"
369
+ };
370
+ }
371
+ function As(e, t) {
372
+ let n = null, s = !1, o = !1, a = 0, r = 0;
373
+ const l = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Map();
374
+ let d = null;
375
+ const v = /* @__PURE__ */ new Map();
376
+ let m = null, f = null, $ = null, k = null, b = null;
377
+ function g(C, T) {
378
+ return !o && e.value === C && a === T;
379
+ }
380
+ function R() {
381
+ if (o) return;
382
+ const C = [...i.values()].reverse().find((T) => g(T.plan, T.epoch))?.format ?? null;
383
+ C !== m && (m = C, t.onBusy?.(C));
384
+ }
385
+ function h(C, T, H) {
386
+ const j = {};
387
+ return i.set(j, { plan: C, epoch: T, format: H, run: jn("export", t.onTask) }), i.get(j).run.start(), R(), j;
388
+ }
389
+ function S(C) {
390
+ i.get(C)?.run.finish(), i.delete(C), R();
391
+ }
392
+ function z() {
393
+ for (const [C, T] of v)
394
+ g(T.plan, T.epoch) || (C.close(), v.delete(C));
395
+ }
396
+ function F(C = !0) {
397
+ if (C) {
398
+ r++;
399
+ for (const T of l) T.close();
400
+ l.clear();
401
+ }
402
+ for (const T of i.values()) T.run.finish("cancelled");
403
+ d?.finish("cancelled"), a++, V(), R(), z();
404
+ }
405
+ const K = de(e, () => F(!1), { flush: "sync" });
406
+ function V() {
407
+ n?.remove(), n = null;
408
+ }
409
+ function ee() {
410
+ F(), o = !0, a++, K(), V(), z(), i.clear(), t.onPrinting?.(!1);
411
+ }
412
+ function Z(C, T) {
413
+ const H = URL.createObjectURL(C);
414
+ setTimeout(() => URL.revokeObjectURL(H), 1e4);
415
+ const j = document.createElement("a");
416
+ j.href = H, j.download = T, j.click();
417
+ }
418
+ function ne(C, T, H, j, _) {
419
+ H.update("download"), g(C, T) && !H.controller.signal.aborted && Z(j, _);
420
+ }
421
+ async function ce(C, T, H, j, _) {
422
+ const oe = C.contentDocument;
423
+ oe.open(), oe.write(It(T));
424
+ for (let te = 0; te < T.pages.length; te++)
425
+ if (j.controller.signal.aborted || (oe.write(Pt(T.pages[te], _)), j.update("print", te + 1, T.pages.length), te % st === st - 1 && await vt(), C !== n)) return !1;
426
+ return oe.write("</body></html>"), oe.close(), await vt(), await na(oe, _, j.controller.signal), !(!g(T, H) || C !== n);
427
+ }
428
+ function Re() {
429
+ const C = r, T = (j) => j && !o && C === r, H = (j) => (!o && C === r && t.onError(j instanceof Error ? j.message : "报表修改尚未完成", "export"), !1);
430
+ try {
431
+ const j = t.beforeOutput?.() ?? !0;
432
+ return typeof j == "boolean" ? T(j) : j.then(T, H);
433
+ } catch (j) {
434
+ return H(j);
435
+ }
436
+ }
437
+ function ve(C) {
438
+ const T = Re();
439
+ return typeof T == "boolean" ? T ? C() : Promise.resolve() : T.then((H) => H ? C() : void 0);
440
+ }
441
+ function E(C, T, H, j, _) {
442
+ j.finish(j.controller.signal.aborted ? "cancelled" : "failed"), _ === n && V(), g(T, H) && !j.controller.signal.aborted && t.onError(ta(C, t.getPrintMessages?.()), "print");
443
+ }
444
+ async function O() {
445
+ if (s) return;
446
+ const C = e.value;
447
+ if (o || !C || C.pages.length === 0) return;
448
+ const T = a;
449
+ s = !0;
450
+ const H = jn("print", t.onTask);
451
+ d = H, H.start(), t.onPrinting?.(!0), V(), n = document.createElement("iframe"), n.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden;", document.body.appendChild(n);
452
+ const j = n;
453
+ try {
454
+ if (!g(C, T) || H.controller.signal.aborted) {
455
+ V();
456
+ return;
457
+ }
458
+ const _ = Qn(t.getPrintOptions?.());
459
+ if (!await ce(j, C, T, H, _)) return;
460
+ j.contentWindow?.focus(), j.contentWindow?.print();
461
+ } catch (_) {
462
+ E(_, C, T, H, j);
463
+ } finally {
464
+ H.finish(), d === H && (d = null), s = !1, o || t.onPrinting?.(!1);
465
+ }
466
+ }
467
+ function x(C, T, H) {
468
+ return {
469
+ signal: H.controller.signal,
470
+ onDiagnostic: (j) => {
471
+ g(C, T) && !H.controller.signal.aborted && t.onDiagnostic?.(j);
472
+ },
473
+ onProgress: (j, _) => H.update("encode", j, _)
474
+ };
475
+ }
476
+ function M(C, T, H) {
477
+ if (f?.plan === C && f.epoch === T) return f.promise;
478
+ const j = Promise.resolve().then(() => {
479
+ if (!g(C, T)) throw new Error("报表已切换或卸载");
480
+ return Be(t.getPdfExporter()(C, (_) => {
481
+ g(C, T) && t.onWarning?.(_);
482
+ }, H ? x(C, T, H) : void 0), H?.controller.signal);
483
+ }).finally(() => {
484
+ f?.promise === j && (f = null);
485
+ });
486
+ return f = { plan: C, epoch: T, promise: j }, j;
487
+ }
488
+ async function A() {
489
+ const C = e.value;
490
+ if (o || !C || C.pages.length === 0) return;
491
+ const T = a;
492
+ if ($?.plan === C && $.epoch === T) return $.promise;
493
+ const H = h(C, T, "PDF"), j = (async () => {
494
+ try {
495
+ const _ = i.get(H).run, oe = await M(C, T, _);
496
+ if (!g(C, T)) return;
497
+ ne(C, T, _, new Blob([oe], { type: "application/pdf" }), "mach-report.pdf");
498
+ } catch (_) {
499
+ i.get(H)?.run.finish("failed"), g(C, T) && t.onError(_ instanceof Error ? `PDF 导出失败: ${_.message}` : "PDF 导出失败", "pdf");
500
+ } finally {
501
+ S(H), $?.token === H && ($ = null);
502
+ }
503
+ })();
504
+ return $ = { plan: C, epoch: T, promise: j, token: H }, j;
505
+ }
506
+ async function q() {
507
+ const C = e.value;
508
+ if (o || !C || C.pages.length === 0) return;
509
+ const T = a;
510
+ if (k?.plan === C && k.epoch === T) return k.promise;
511
+ const H = { ...t.getXlsxOptions?.() }, j = h(C, T, "Excel"), _ = (async () => {
512
+ try {
513
+ const { renderPlanToXlsx: oe } = await import("@agile-team/mach-report/xlsx");
514
+ if (!g(C, T)) return;
515
+ const te = i.get(j).run, { buffer: Me, warnings: Te } = await Be(oe(C, { ...H, ...x(C, T, te) }), te.controller.signal);
516
+ if (!g(C, T) || (Te.length > 0 && t.onWarning?.(`Excel 导出有 ${Te.length} 条提示:${Te.slice(0, 2).join(";")}`), !g(C, T))) return;
517
+ ne(C, T, te, new Blob([Me], {
518
+ type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
519
+ }), "mach-report.xlsx");
520
+ } catch (oe) {
521
+ i.get(j)?.run.finish("failed"), g(C, T) && t.onError(oe instanceof Error ? `Excel 导出失败: ${oe.message}` : "Excel 导出失败", "export");
522
+ } finally {
523
+ S(j), k?.token === j && (k = null);
524
+ }
525
+ })();
526
+ return k = { plan: C, epoch: T, promise: _, token: j }, _;
527
+ }
528
+ async function J() {
529
+ const C = e.value;
530
+ if (o || !C || C.pages.length === 0) return;
531
+ const T = a;
532
+ if (b?.plan === C && b.epoch === T) return b.promise;
533
+ const H = h(C, T, "图片"), j = (async () => {
534
+ try {
535
+ const _ = i.get(H).run, { blobs: oe } = await Be(Ja(C, {
536
+ ...x(C, T, _),
537
+ dpr: Math.min(2, typeof devicePixelRatio == "number" ? devicePixelRatio : 1)
538
+ }), _.controller.signal);
539
+ if (!g(C, T)) return;
540
+ oe.forEach((te, Me) => {
541
+ ne(C, T, _, te, oe.length > 1 ? `mach-report-page-${Me + 1}.png` : "mach-report.png");
542
+ });
543
+ } catch (_) {
544
+ i.get(H)?.run.finish("failed"), g(C, T) && t.onError(
545
+ _ instanceof Error ? `图片导出失败: ${_.message}` : "图片导出失败",
546
+ "export"
547
+ );
548
+ } finally {
549
+ S(H), b?.token === H && (b = null);
550
+ }
551
+ })();
552
+ return b = { plan: C, epoch: T, promise: j, token: H }, j;
553
+ }
554
+ async function U(C) {
555
+ const T = e.value;
556
+ if (o || !T || !T.pages.length) return;
557
+ const H = a, j = h(T, H, C === "word" ? "Word" : "HTML"), _ = i.get(j).run;
558
+ try {
559
+ const oe = [];
560
+ for (const [Te, Ye] of T.pages.entries()) {
561
+ if (!g(T, H)) return;
562
+ oe.push(Pt(Ye)), _.update("encode", Te + 1, T.pages.length), Te % st === st - 1 && await vt();
563
+ }
564
+ if (!g(T, H)) return;
565
+ const te = It(T), Me = `${C === "word" ? aa(te) : te}${oe.join("")}</body></html>`;
566
+ ne(T, H, _, new Blob([Me], { type: C === "word" ? "application/msword;charset=utf-8" : "text/html;charset=utf-8" }), C === "word" ? "mach-report.doc" : "mach-report.html");
567
+ } catch (oe) {
568
+ _.finish("failed"), g(T, H) && t.onError(oe instanceof Error ? `导出失败: ${oe.message}` : "导出失败", "export");
569
+ } finally {
570
+ S(j);
571
+ }
572
+ }
573
+ async function X() {
574
+ await U("word");
575
+ }
576
+ function Y() {
577
+ return ve(O);
578
+ }
579
+ function se() {
580
+ return ve(J);
581
+ }
582
+ function B() {
583
+ return ve(X);
584
+ }
585
+ async function ke(C) {
586
+ const T = e.value;
587
+ if (!(o || !T || T.pages.length === 0)) {
588
+ if (C === "pdf") {
589
+ await A();
590
+ return;
591
+ }
592
+ if (C === "xlsx" || C === "excel") {
593
+ await q();
594
+ return;
595
+ }
596
+ if (C === "png" || C === "image") {
597
+ await J();
598
+ return;
599
+ }
600
+ if (C === "word" || C === "doc") {
601
+ await X();
602
+ return;
603
+ }
604
+ if (C !== "html") {
605
+ t.onError(`不支持的导出格式:${C}`, "export");
606
+ return;
607
+ }
608
+ await U("html");
609
+ }
610
+ }
611
+ function je(C) {
612
+ return ve(() => ke(C));
613
+ }
614
+ function Fe(C) {
615
+ const T = e.value;
616
+ if (o || !T || !T.pages.length) {
617
+ C.close();
618
+ return;
619
+ }
620
+ const H = a;
621
+ v.set(C, { plan: T, epoch: H });
622
+ const j = h(T, H, "PDF");
623
+ M(T, H, i.get(j).run).then((_) => {
624
+ if (!g(T, H) || C.closed) {
625
+ v.delete(C) && C.close();
626
+ return;
627
+ }
628
+ const oe = URL.createObjectURL(new Blob([_], { type: "application/pdf" }));
629
+ setTimeout(() => URL.revokeObjectURL(oe), 6e4);
630
+ const te = C.document;
631
+ te.title = "PDF 预览", te.documentElement.style.height = "100%", te.body.style.cssText = "margin:0;height:100%;";
632
+ const Me = te.createElement("iframe");
633
+ Me.title = "PDF 预览", Me.style.cssText = "display:block;width:100%;height:100%;border:0;", Me.src = oe, te.body.replaceChildren(Me), v.delete(C);
634
+ }).catch((_) => {
635
+ i.get(j)?.run.finish("failed"), C.close(), v.delete(C), g(T, H) && t.onError(_ instanceof Error ? `PDF 预览失败: ${_.message}` : "PDF 预览失败", "pdf");
636
+ }).finally(() => S(j));
637
+ }
638
+ function Ue() {
639
+ if (o || !e.value?.pages.length) return;
640
+ const C = globalThis.window.open("", "_blank");
641
+ if (!C) {
642
+ t.onError("浏览器拦截了弹窗,请允许弹窗后重试", "pdf");
643
+ return;
644
+ }
645
+ const T = Re();
646
+ if (typeof T == "boolean") {
647
+ T ? Fe(C) : C.close();
648
+ return;
649
+ }
650
+ l.add(C), T.then((H) => {
651
+ const j = l.delete(C);
652
+ if (!H || !j || C.closed) {
653
+ C.close();
654
+ return;
655
+ }
656
+ Fe(C);
657
+ });
658
+ }
659
+ return {
660
+ print: Y,
661
+ exportAs: je,
662
+ exportImages: se,
663
+ exportWord: B,
664
+ openPdfWindow: Ue,
665
+ invalidatePending: F,
666
+ cancel: F,
667
+ releasePrintFrame: V,
668
+ dispose: ee
669
+ };
670
+ }
671
+ const sa = "mrp-hit";
672
+ function Fs(e) {
673
+ e.querySelectorAll(`mark.${sa}`).forEach((n) => {
674
+ const s = n.parentNode;
675
+ if (s) {
676
+ for (; n.firstChild; ) s.insertBefore(n.firstChild, n);
677
+ n.remove(), s.normalize();
678
+ }
679
+ });
680
+ }
681
+ function zs(e, t) {
682
+ const n = t.trim();
683
+ if (!n) return 0;
684
+ const s = n.toLowerCase(), o = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, {
685
+ acceptNode(l) {
686
+ const i = l.parentElement;
687
+ return !i || i.closest("mark") || /^(SCRIPT|STYLE)$/.test(i.tagName) ? NodeFilter.FILTER_REJECT : (l.nodeValue ?? "").toLowerCase().includes(s) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT;
688
+ }
689
+ }), a = [];
690
+ for (let l = o.nextNode(); l; l = o.nextNode()) a.push(l);
691
+ let r = 0;
692
+ for (const l of a) {
693
+ const i = l.nodeValue ?? "", d = i.toLowerCase(), v = l.parentElement;
694
+ if (!v) continue;
695
+ const m = document.createDocumentFragment();
696
+ let f = 0, $ = d.indexOf(s);
697
+ for (; $ >= 0; ) {
698
+ $ > f && m.appendChild(document.createTextNode(i.slice(f, $)));
699
+ const k = document.createElement("mark");
700
+ k.className = sa, k.textContent = i.slice($, $ + n.length), m.appendChild(k), r++, f = $ + n.length, $ = d.indexOf(s, f);
701
+ }
702
+ f < i.length && m.appendChild(document.createTextNode(i.slice(f))), v.replaceChild(m, l);
703
+ }
704
+ return r;
705
+ }
706
+ const Ls = /* @__PURE__ */ new Set(["line", "rect", "ellipse", "chart"]);
707
+ function* Ns(e) {
708
+ for (const t of e.cells ?? [])
709
+ for (const n of t ?? [])
710
+ yield n?.text ?? "", yield* n?.children ?? [];
711
+ }
712
+ function* qs(e) {
713
+ if (xs(e))
714
+ for (const t of e.richParagraphs)
715
+ for (const n of t.segments ?? [])
716
+ yield (n.kind === "field" ? n.field : n.text) ?? "";
717
+ else e.lines?.length ? yield* e.lines : yield e.text ?? "";
718
+ }
719
+ function* Bs(e) {
720
+ const t = [e.values()];
721
+ for (; t.length > 0; ) {
722
+ const n = t[t.length - 1].next();
723
+ if (n.done) {
724
+ t.pop();
725
+ continue;
726
+ }
727
+ const s = n.value;
728
+ if (typeof s == "string") {
729
+ yield s;
730
+ continue;
731
+ }
732
+ yield "", !ws(s) && (s.kind === "text" ? t.push(qs(s)) : s.grid ? t.push(Ns(s.grid)) : Ls.has(s.kind) || (yield s.fallbackText ?? ""));
733
+ }
734
+ }
735
+ function* Ks(e) {
736
+ for (let t = 0; t < e.pages.length; t++) {
737
+ for (const n of Bs(e.pages[t].components)) yield { text: n, pageIndex: t };
738
+ yield { text: "", pageIndex: t };
739
+ }
740
+ }
741
+ function js(e, t) {
742
+ const n = e.toLowerCase();
743
+ let s = 0;
744
+ for (let o = n.indexOf(t); o >= 0; o = n.indexOf(t, o + t.length)) s++;
745
+ return s;
746
+ }
747
+ function Hs(e) {
748
+ const { plan: t, gotoPage: n, highlight: s, clearHighlights: o } = e, a = G(!1), r = G(""), l = G(0), i = G(0), d = G(!1);
749
+ let v = [];
750
+ const m = D(() => {
751
+ if (i.value === 0) return null;
752
+ const z = l.value;
753
+ let F = 0, K = v.length - 1;
754
+ for (; F < K; ) {
755
+ const ee = F + K >>> 1;
756
+ v[ee].cumulative <= z ? F = ee + 1 : K = ee;
757
+ }
758
+ const V = v[F];
759
+ return V ? { pageIndex: V.pageIndex, occurrence: z - (v[F - 1]?.cumulative ?? 0) } : null;
760
+ });
761
+ let f = null, $ = null, k = 0;
762
+ function b() {
763
+ k++, f && clearTimeout(f), $ && clearTimeout($), f = $ = null, d.value = !1;
764
+ }
765
+ function g(z) {
766
+ r.value = z, l.value = 0, i.value = 0, v = [], d.value = !1;
767
+ const F = z.trim().toLowerCase(), K = t.value;
768
+ if (!F || !K) return;
769
+ d.value = !0;
770
+ const V = k, ee = Ks(K), Z = [];
771
+ let ne = 0;
772
+ function ce() {
773
+ if ($ = null, V !== k || K !== t.value) return;
774
+ const Re = performance.now();
775
+ let ve = 0;
776
+ for (; ve < 5e3 && performance.now() - Re < 4; ) {
777
+ const E = ee.next();
778
+ if (E.done) {
779
+ v = Z, i.value = ne, d.value = !1, v[0] && n(v[0].pageIndex + 1);
780
+ return;
781
+ }
782
+ const O = js(E.value.text, F);
783
+ if (O > 0) {
784
+ ne += O;
785
+ const x = Z[Z.length - 1];
786
+ x?.pageIndex === E.value.pageIndex ? x.cumulative = ne : Z.push({ pageIndex: E.value.pageIndex, cumulative: ne });
787
+ }
788
+ ve++;
789
+ }
790
+ $ = setTimeout(ce, 0);
791
+ }
792
+ ce();
793
+ }
794
+ function R(z) {
795
+ if (b(), r.value = z, l.value = i.value = 0, v = [], !z.trim()) {
796
+ g("");
797
+ return;
798
+ }
799
+ d.value = !0, f = setTimeout(() => {
800
+ f = null, g(z);
801
+ }, Math.max(0, u(e.debounceMs) ?? 200));
802
+ }
803
+ function h(z) {
804
+ const F = i.value;
805
+ if (F === 0 || d.value) return;
806
+ l.value = (l.value + z + F) % F;
807
+ const K = m.value;
808
+ K && n(K.pageIndex + 1);
809
+ }
810
+ function S() {
811
+ b(), r.value = "", l.value = i.value = 0, v = [];
812
+ }
813
+ return de(t, S, { flush: "sync" }), Ke(S), {
814
+ visible: a,
815
+ query: r,
816
+ matchIndex: l,
817
+ matchCount: i,
818
+ activeMatch: m,
819
+ searching: d,
820
+ toggle: () => {
821
+ a.value = !a.value;
822
+ },
823
+ onInput: R,
824
+ onNav: h,
825
+ apply: (z) => {
826
+ r.value.trim() && s(z, r.value.trim());
827
+ },
828
+ clear: (z) => {
829
+ o(z);
830
+ },
831
+ reset: S
832
+ };
833
+ }
834
+ function Ws(e, t) {
835
+ const n = D(() => {
836
+ if (e.value) return !0;
837
+ if (typeof location > "u") return !1;
838
+ try {
839
+ return new URLSearchParams(location.search).get("mrp-debug") === "1";
840
+ } catch {
841
+ return !1;
842
+ }
843
+ }), s = D(() => !n.value || !t.plan.value ? 0 : Math.round(JSON.stringify(t.plan.value).length / 1024)), o = D(() => !n.value || !t.plan.value ? null : {
844
+ pages: t.pageCount.value,
845
+ window: `${t.windowRange.value.start}-${t.windowRange.value.end}`,
846
+ zoom: `${Math.round(t.zoom.value * 100)}%`,
847
+ loadMs: `${t.loadMs.value}ms`,
848
+ planKB: s.value
849
+ });
850
+ return { enabled: n, debugStats: o };
851
+ }
852
+ function Us(e, t) {
853
+ const { thumbsRoot: n, visible: s, renderThumbCanvas: o } = t, a = G(0), r = G(800), l = D(() => (e.value?.pages ?? []).map(
854
+ (h) => Math.round(h.pageHeightMm / h.pageWidthMm * 116)
855
+ )), i = D(() => Zn(l.value.map((h) => h + 20), 8)), d = D(() => i.value.window(r.value, a.value, 1)), v = D(() => {
856
+ if (!s.value) return [];
857
+ const { start: h, end: S } = d.value;
858
+ return l.value.slice(h, S + 1).map((z, F) => ({ index: h + F, height: z }));
859
+ });
860
+ let m = 0, f = 0, $ = !1;
861
+ function k() {
862
+ const h = n.value;
863
+ h && (a.value = h.scrollTop, r.value = h.clientHeight || 800);
864
+ }
865
+ function b() {
866
+ $ || f || (f = requestAnimationFrame(() => {
867
+ f = 0, k();
868
+ }));
869
+ }
870
+ function g() {
871
+ if (v.value, m && cancelAnimationFrame(m), m = 0, $ || !s.value || !e.value || !n.value) return;
872
+ k();
873
+ const h = v.value, S = e.value, z = n.value;
874
+ let F = 0;
875
+ function K() {
876
+ if (m = 0, !($ || !s.value || e.value !== S || n.value !== z)) {
877
+ for (let V = 0; F < h.length && V < 2; V++, F++) {
878
+ const ee = h[F].index, Z = z.querySelector(`[data-thumb="${ee + 1}"]`);
879
+ if (!Z || Z.childElementCount > 0) continue;
880
+ const ne = o(ee);
881
+ ne && (ne.style.width = "100%", ne.style.height = "100%", ne.style.display = "block", Z.appendChild(ne));
882
+ }
883
+ F < h.length && (m = requestAnimationFrame(K));
884
+ }
885
+ }
886
+ m = requestAnimationFrame(K);
887
+ }
888
+ function R() {
889
+ $ = !0, m && cancelAnimationFrame(m), f && cancelAnimationFrame(f), m = f = 0;
890
+ }
891
+ return Ke(R), { schedule: g, destroy: R, onScroll: b, windowRange: d, visibleThumbs: v };
892
+ }
893
+ function Vs() {
894
+ const e = fe(0);
895
+ return {
896
+ loadMs: e,
897
+ start() {
898
+ return typeof performance < "u" ? performance.now() : 0;
899
+ },
900
+ end(t) {
901
+ e.value = t ? Math.round(performance.now() - t) : 0;
902
+ }
903
+ };
904
+ }
905
+ function Js(e) {
906
+ const t = G(null), n = G(null);
907
+ function s() {
908
+ t.value?.focus(), t.value?.select();
909
+ }
910
+ de(e.visible, (r) => {
911
+ r && Ge(s);
912
+ });
913
+ function o() {
914
+ e.close(), Ge(() => n.value?.focus());
915
+ }
916
+ function a(r) {
917
+ r.isComposing || r.keyCode === 229 || r.key !== "Enter" && r.key !== "Escape" || (r.preventDefault(), r.stopPropagation(), r.key === "Escape" ? o() : e.navigate(r.shiftKey ? -1 : 1));
918
+ }
919
+ return { input: t, toggle: n, focus: s, close: o, onKeydown: a };
920
+ }
921
+ const Gs = ["disabled", "aria-expanded"], Ys = ["aria-label"], Zs = ["aria-label", "disabled", "onClick"], Xs = { "aria-hidden": "true" }, Qs = /* @__PURE__ */ ye({
922
+ __name: "ReportExportMenu",
923
+ props: {
924
+ messages: {},
925
+ formats: {},
926
+ busy: { type: Boolean }
927
+ },
928
+ emits: ["export"],
929
+ setup(e, { emit: t }) {
930
+ const n = e, s = t, { opened: o, root: a, trigger: r, panel: l, close: i, onKeydown: d } = _n(), v = D(() => [
931
+ { format: "xlsx", label: n.messages.exportExcel, extension: ".xlsx" },
932
+ { format: "pdf", label: n.messages.exportPdf, extension: ".pdf" },
933
+ { format: "png", label: n.messages.exportImage, extension: ".png" },
934
+ { format: "word", label: n.messages.exportWord, extension: ".doc" },
935
+ { format: "html", label: n.messages.exportHtml, extension: ".html" }
936
+ ].filter((k) => !n.formats || n.formats.includes(k.format)));
937
+ de(() => n.busy, (k) => {
938
+ k && i();
939
+ });
940
+ function m(k) {
941
+ n.busy || (s("export", k), i(!0));
942
+ }
943
+ function f(k) {
944
+ k.key !== "ArrowDown" && k.key !== "ArrowUp" || (k.preventDefault(), o.value = !0, k.key === "ArrowUp" && Ge(() => l.value?.querySelector("button:last-child")?.focus()));
945
+ }
946
+ function $(k) {
947
+ if (k.key === "Tab") {
948
+ i();
949
+ return;
950
+ }
951
+ if (!["ArrowDown", "ArrowUp", "Home", "End"].includes(k.key)) return;
952
+ k.preventDefault(), k.stopPropagation();
953
+ const g = [...l.value?.querySelectorAll("button:not(:disabled)") ?? []], R = g.indexOf(document.activeElement), h = k.key === "Home" ? 0 : k.key === "End" ? g.length - 1 : (R + (k.key === "ArrowDown" ? 1 : -1) + g.length) % g.length;
954
+ g[h]?.focus();
955
+ }
956
+ return (k, b) => v.value.length ? (w(), P("div", {
957
+ key: 0,
958
+ ref_key: "root",
959
+ ref: a,
960
+ class: "mrp-export-menu",
961
+ onKeydown: b[1] || (b[1] = //@ts-ignore
962
+ (...g) => u(d) && u(d)(...g))
963
+ }, [
964
+ p("button", {
965
+ ref_key: "trigger",
966
+ ref: r,
967
+ type: "button",
968
+ class: "mrp-nav mrp-export-trigger",
969
+ disabled: e.busy,
970
+ "aria-haspopup": "menu",
971
+ "aria-expanded": u(o),
972
+ onClick: b[0] || (b[0] = (g) => o.value = !u(o)),
973
+ onKeydown: f
974
+ }, [
975
+ Q(ae, { name: "download" }),
976
+ ie(y(e.messages.exportMenu ?? "导出"), 1),
977
+ Q(ae, {
978
+ name: "chevron-down",
979
+ size: 12
980
+ })
981
+ ], 40, Gs),
982
+ u(o) ? (w(), P("div", {
983
+ key: 0,
984
+ ref_key: "panel",
985
+ ref: l,
986
+ class: "mrp-export-panel",
987
+ role: "menu",
988
+ "aria-label": e.messages.exportMenu ?? "导出",
989
+ onKeydown: $
990
+ }, [
991
+ p("p", null, y(e.messages.exportMenuDescription ?? "选择文件格式"), 1),
992
+ (w(!0), P(ge, null, be(v.value, (g) => (w(), P("button", {
993
+ key: g.format,
994
+ type: "button",
995
+ role: "menuitem",
996
+ tabindex: "-1",
997
+ "aria-label": g.label,
998
+ disabled: e.busy,
999
+ onClick: (R) => m(g.format)
1000
+ }, [
1001
+ Q(ae, { name: "file" }),
1002
+ p("span", null, y(g.label), 1),
1003
+ p("small", Xs, y(g.extension), 1)
1004
+ ], 8, Zs))), 128))
1005
+ ], 40, Ys)) : N("", !0)
1006
+ ], 544)) : N("", !0);
1007
+ }
1008
+ }), _s = /* @__PURE__ */ we(Qs, [["__scopeId", "data-v-83a57a3c"]]), eo = ["aria-label"], to = {
1009
+ class: "mrp-pageinfo",
1010
+ "aria-live": "polite"
1011
+ }, no = { class: "mrp-page-buttons" }, ao = ["aria-label", "title", "disabled"], so = ["aria-label", "title", "disabled"], oo = ["aria-label", "title", "aria-invalid", "disabled"], ro = ["aria-label", "disabled"], lo = {
1012
+ key: 1,
1013
+ class: "mrp-page-error",
1014
+ role: "alert"
1015
+ }, io = /* @__PURE__ */ ye({
1016
+ __name: "ReportPagination",
1017
+ props: {
1018
+ pageCount: {},
1019
+ currentPage: {},
1020
+ messages: {},
1021
+ busy: { type: Boolean }
1022
+ },
1023
+ emits: ["goto"],
1024
+ setup(e, { emit: t }) {
1025
+ const n = e, s = t, o = G(String(n.currentPage)), a = G(!1), r = D(() => n.messages.pageInfo.replace("{cur}", String(n.currentPage)).replace("{total}", String(n.pageCount)));
1026
+ de(() => [n.currentPage, n.pageCount], () => {
1027
+ o.value = String(n.currentPage), a.value = !1;
1028
+ });
1029
+ function l() {
1030
+ if (n.busy) return;
1031
+ const i = o.value.trim(), d = Number(i);
1032
+ a.value = !/^\d+$/.test(i) || !Number.isSafeInteger(d) || d < 1 || d > n.pageCount, !a.value && d !== n.currentPage && s("goto", d);
1033
+ }
1034
+ return (i, d) => e.pageCount > 0 ? (w(), P("nav", {
1035
+ key: 0,
1036
+ class: "mrp-pagination",
1037
+ role: "navigation",
1038
+ "aria-label": e.messages.pagination ?? "报表分页"
1039
+ }, [
1040
+ p("span", to, y(r.value), 1),
1041
+ p("div", no, [
1042
+ p("button", {
1043
+ class: "mrp-nav",
1044
+ type: "button",
1045
+ "aria-label": e.messages.prevPage,
1046
+ title: e.messages.prevPage,
1047
+ disabled: e.busy || e.currentPage <= 1,
1048
+ onClick: d[0] || (d[0] = (v) => s("goto", e.currentPage - 1))
1049
+ }, [
1050
+ Q(ae, { name: "chevron-left" })
1051
+ ], 8, ao),
1052
+ p("button", {
1053
+ class: "mrp-nav",
1054
+ type: "button",
1055
+ "aria-label": e.messages.nextPage,
1056
+ title: e.messages.nextPage,
1057
+ disabled: e.busy || e.currentPage >= e.pageCount,
1058
+ onClick: d[1] || (d[1] = (v) => s("goto", e.currentPage + 1))
1059
+ }, [
1060
+ Q(ae, { name: "chevron-right" })
1061
+ ], 8, so)
1062
+ ]),
1063
+ e.pageCount > 1 ? (w(), P("form", {
1064
+ key: 0,
1065
+ class: "mrp-page-jump",
1066
+ onSubmit: pt(l, ["prevent"])
1067
+ }, [
1068
+ p("label", null, [
1069
+ p("span", null, y(e.messages.pageJump ?? "跳至页"), 1),
1070
+ Rt(p("input", {
1071
+ "onUpdate:modelValue": d[2] || (d[2] = (v) => o.value = v),
1072
+ type: "text",
1073
+ inputmode: "numeric",
1074
+ autocomplete: "off",
1075
+ "aria-label": e.messages.pageJump ?? "跳至页",
1076
+ title: e.messages.pageJumpHint ?? "Enter 跳转",
1077
+ "aria-invalid": a.value,
1078
+ disabled: e.busy,
1079
+ onInput: d[3] || (d[3] = (v) => a.value = !1),
1080
+ onKeydown: d[4] || (d[4] = ja((v) => {
1081
+ o.value = String(e.currentPage), a.value = !1;
1082
+ }, ["esc"]))
1083
+ }, null, 40, oo), [
1084
+ [Mt, o.value]
1085
+ ])
1086
+ ]),
1087
+ p("button", {
1088
+ class: "mrp-nav",
1089
+ type: "submit",
1090
+ "aria-label": e.messages.pageJump ?? "跳至页",
1091
+ disabled: e.busy
1092
+ }, [
1093
+ Q(ae, {
1094
+ name: "arrow-right",
1095
+ size: 14
1096
+ })
1097
+ ], 8, ro)
1098
+ ], 32)) : N("", !0),
1099
+ a.value ? (w(), P("span", lo, y(e.messages.pageJumpInvalid ?? "请输入有效页码"), 1)) : N("", !0)
1100
+ ], 8, eo)) : N("", !0);
1101
+ }
1102
+ }), oa = /* @__PURE__ */ we(io, [["__scopeId", "data-v-0db4fbd3"]]), uo = ["aria-label"], co = { class: "mrp-title" }, fo = ["aria-label"], mo = ["aria-label", "aria-pressed"], go = ["aria-pressed"], vo = ["aria-pressed"], po = ["aria-label"], ho = ["aria-pressed"], bo = ["aria-pressed", "onClick"], yo = ["aria-label"], wo = ["disabled"], xo = ["disabled"], ko = ["disabled"], $o = ["aria-label", "aria-expanded"], Co = ["aria-label"], Eo = ["placeholder", "aria-label", "value"], Io = ["aria-label"], Po = {
1103
+ key: 1,
1104
+ class: "mrp-search-count",
1105
+ role: "status",
1106
+ "aria-live": "polite"
1107
+ }, So = ["disabled", "aria-label"], Ro = ["disabled", "aria-label"], Mo = ["aria-label"], To = {
1108
+ class: "mrp-search-hint",
1109
+ role: "status"
1110
+ }, Oo = /* @__PURE__ */ ye({
1111
+ __name: "ReportToolbar",
1112
+ props: {
1113
+ pageCount: {},
1114
+ currentPage: {},
1115
+ zoomMode: {},
1116
+ zoom: {},
1117
+ showExport: { type: Boolean },
1118
+ showPrint: { type: Boolean },
1119
+ showPdfWindow: { type: Boolean },
1120
+ messages: {},
1121
+ search: {},
1122
+ thumbsVisible: { type: Boolean },
1123
+ showImport: { type: Boolean },
1124
+ showSearch: { type: Boolean, default: !0 },
1125
+ showThumbnails: { type: Boolean, default: !0 },
1126
+ showZoom: { type: Boolean, default: !0 },
1127
+ exportFormats: { default: void 0 },
1128
+ showSettings: { type: Boolean },
1129
+ settingsOpen: { type: Boolean },
1130
+ busy: { type: Boolean },
1131
+ showPagination: { type: Boolean }
1132
+ },
1133
+ emits: ["goto", "zoom", "export", "print", "pdf-window", "search-input", "search-nav", "search-toggle", "thumbs-toggle", "import-excel", "settings-toggle"],
1134
+ setup(e, { expose: t, emit: n }) {
1135
+ const s = e, o = n, a = Js({
1136
+ visible: () => s.search.visible,
1137
+ navigate: (v) => {
1138
+ !s.search.searching && s.search.matchCount > 0 && o("search-nav", v);
1139
+ },
1140
+ close: () => {
1141
+ s.search.visible && o("search-toggle");
1142
+ }
1143
+ }), { input: r, toggle: l } = a;
1144
+ t({ focusSearch: a.focus });
1145
+ function i() {
1146
+ const v = s.search.matchCount > 0 ? s.search.matchIndex + 1 : 0;
1147
+ return s.messages.matchInfo.replace("{cur}", String(v)).replace("{total}", String(s.search.matchCount));
1148
+ }
1149
+ function d() {
1150
+ o("search-input", ""), a.focus();
1151
+ }
1152
+ return (v, m) => (w(), P("div", {
1153
+ class: "mrp-toolbar",
1154
+ role: "toolbar",
1155
+ "aria-label": e.messages.title
1156
+ }, [
1157
+ p("span", co, [
1158
+ Q(ae, { name: "file" }),
1159
+ ie(y(e.messages.title), 1)
1160
+ ]),
1161
+ e.showPagination ? (w(), Se(oa, {
1162
+ key: 0,
1163
+ "page-count": e.pageCount,
1164
+ "current-page": e.currentPage,
1165
+ messages: e.messages,
1166
+ busy: e.busy,
1167
+ onGoto: m[0] || (m[0] = (f) => o("goto", f))
1168
+ }, null, 8, ["page-count", "current-page", "messages", "busy"])) : N("", !0),
1169
+ m[15] || (m[15] = p("span", { class: "mrp-spacer" }, null, -1)),
1170
+ e.showSearch !== !1 ? (w(), P("div", {
1171
+ key: 1,
1172
+ class: "mrp-read-tools",
1173
+ role: "group",
1174
+ "aria-label": e.messages.search ?? "内容搜索"
1175
+ }, [
1176
+ p("button", {
1177
+ ref_key: "searchToggleRef",
1178
+ ref: l,
1179
+ class: Ce(["mrp-nav mrp-search-toggle mrp-icon-button", { "mrp-active": e.search.visible }]),
1180
+ type: "button",
1181
+ title: "Ctrl+F",
1182
+ "aria-label": e.messages.search ?? e.messages.searchPlaceholder,
1183
+ "aria-pressed": e.search.visible,
1184
+ onClick: m[1] || (m[1] = (f) => o("search-toggle"))
1185
+ }, [
1186
+ Q(ae, { name: "search" })
1187
+ ], 10, mo),
1188
+ e.showThumbnails !== !1 ? (w(), P("button", {
1189
+ key: 0,
1190
+ class: Ce(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
1191
+ type: "button",
1192
+ "aria-pressed": e.thumbsVisible,
1193
+ onClick: m[2] || (m[2] = (f) => o("thumbs-toggle"))
1194
+ }, [
1195
+ Q(ae, { name: "grid" }),
1196
+ ie(y(e.messages.thumbnails), 1)
1197
+ ], 10, go)) : N("", !0)
1198
+ ], 8, fo)) : e.showThumbnails !== !1 ? (w(), P("button", {
1199
+ key: 2,
1200
+ class: Ce(["mrp-nav", { "mrp-active": e.thumbsVisible }]),
1201
+ type: "button",
1202
+ "aria-pressed": e.thumbsVisible,
1203
+ onClick: m[3] || (m[3] = (f) => o("thumbs-toggle"))
1204
+ }, [
1205
+ Q(ae, { name: "grid" }),
1206
+ ie(y(e.messages.thumbnails), 1)
1207
+ ], 10, vo)) : N("", !0),
1208
+ ht(v.$slots, "navigation", {}, void 0, !0),
1209
+ e.showZoom !== !1 ? (w(), P("div", {
1210
+ key: 3,
1211
+ class: "mrp-zoom-tools",
1212
+ role: "group",
1213
+ "aria-label": e.messages.zoom ?? "缩放工具"
1214
+ }, [
1215
+ p("button", {
1216
+ class: Ce(["mrp-nav", { "mrp-active": e.zoomMode === "fit" }]),
1217
+ "aria-pressed": e.zoomMode === "fit",
1218
+ type: "button",
1219
+ onClick: m[4] || (m[4] = (f) => o("zoom", "fit"))
1220
+ }, [
1221
+ Q(ae, { name: "fit" }),
1222
+ ie(y(e.messages.fitWidth), 1)
1223
+ ], 10, ho),
1224
+ (w(), P(ge, null, be([100, 150], (f) => p("button", {
1225
+ key: f,
1226
+ class: Ce(["mrp-nav", { "mrp-active": e.zoomMode === "raw" && Math.round(e.zoom * 100) === f }]),
1227
+ "aria-pressed": e.zoomMode === "raw" && Math.round(e.zoom * 100) === f,
1228
+ type: "button",
1229
+ onClick: ($) => o("zoom", f)
1230
+ }, y(f) + "%", 11, bo)), 64))
1231
+ ], 8, po)) : N("", !0),
1232
+ e.showImport || e.showExport || e.showPrint || e.showPdfWindow ? (w(), P("div", {
1233
+ key: 4,
1234
+ class: "mrp-output-tools",
1235
+ role: "group",
1236
+ "aria-label": e.messages.settingsExport ?? "导出与打印"
1237
+ }, [
1238
+ e.showImport ? (w(), P("button", {
1239
+ key: 0,
1240
+ class: "mrp-nav mrp-import-excel",
1241
+ type: "button",
1242
+ disabled: e.busy,
1243
+ onClick: m[5] || (m[5] = (f) => o("import-excel"))
1244
+ }, [
1245
+ Q(ae, { name: "upload" }),
1246
+ ie(y(e.messages.importExcel ?? "导入 Excel 模板"), 1)
1247
+ ], 8, wo)) : N("", !0),
1248
+ e.showExport ? (w(), Se(_s, {
1249
+ key: 1,
1250
+ messages: e.messages,
1251
+ formats: e.exportFormats,
1252
+ busy: e.busy,
1253
+ onExport: m[6] || (m[6] = (f) => o("export", f))
1254
+ }, null, 8, ["messages", "formats", "busy"])) : N("", !0),
1255
+ e.showPrint ? (w(), P("button", {
1256
+ key: 2,
1257
+ class: "mrp-nav",
1258
+ type: "button",
1259
+ disabled: e.busy,
1260
+ onClick: m[7] || (m[7] = (f) => o("print"))
1261
+ }, [
1262
+ Q(ae, { name: "print" }),
1263
+ ie(y(e.messages.print), 1)
1264
+ ], 8, xo)) : N("", !0),
1265
+ e.showPdfWindow ? (w(), P("button", {
1266
+ key: 3,
1267
+ class: "mrp-nav",
1268
+ type: "button",
1269
+ disabled: e.busy,
1270
+ onClick: m[8] || (m[8] = (f) => o("pdf-window"))
1271
+ }, [
1272
+ Q(ae, { name: "external" }),
1273
+ ie(y(e.messages.pdfWindow), 1)
1274
+ ], 8, ko)) : N("", !0)
1275
+ ], 8, yo)) : N("", !0),
1276
+ e.showSettings ? (w(), P("button", {
1277
+ key: 5,
1278
+ class: Ce(["mrp-nav mrp-settings-toggle", { "mrp-active": e.settingsOpen }]),
1279
+ type: "button",
1280
+ "aria-label": e.messages.settings ?? "设置",
1281
+ "aria-haspopup": "dialog",
1282
+ "aria-expanded": !!e.settingsOpen,
1283
+ onClick: m[9] || (m[9] = (f) => o("settings-toggle"))
1284
+ }, [
1285
+ Q(ae, { name: "settings" }),
1286
+ ie(y(e.messages.settings ?? "设置"), 1)
1287
+ ], 10, $o)) : N("", !0),
1288
+ e.showSearch !== !1 && e.search.visible ? (w(), P("div", {
1289
+ key: 6,
1290
+ class: "mrp-search-panel",
1291
+ role: "search",
1292
+ "aria-label": e.messages.search ?? "内容搜索"
1293
+ }, [
1294
+ p("div", {
1295
+ class: Ce(["mrp-search", { "mrp-search-no-results": e.search.query && !e.search.searching && !e.search.matchCount }])
1296
+ }, [
1297
+ Q(ae, { name: "search" }),
1298
+ p("input", {
1299
+ ref_key: "searchInputRef",
1300
+ ref: r,
1301
+ class: "mrp-search-input",
1302
+ type: "text",
1303
+ autocomplete: "off",
1304
+ spellcheck: "false",
1305
+ placeholder: e.messages.searchPlaceholder,
1306
+ "aria-label": e.messages.search ?? e.messages.searchPlaceholder,
1307
+ value: e.search.query,
1308
+ onInput: m[10] || (m[10] = (f) => o("search-input", f.target.value)),
1309
+ onKeydown: m[11] || (m[11] = //@ts-ignore
1310
+ (...f) => u(a).onKeydown && u(a).onKeydown(...f))
1311
+ }, null, 40, Eo),
1312
+ e.search.query ? (w(), P("button", {
1313
+ key: 0,
1314
+ class: "mrp-nav mrp-search-clear mrp-icon-button",
1315
+ type: "button",
1316
+ "aria-label": e.messages.clearSearch ?? "清除搜索",
1317
+ onClick: d
1318
+ }, [
1319
+ Q(ae, {
1320
+ name: "close",
1321
+ size: 13
1322
+ })
1323
+ ], 8, Io)) : N("", !0),
1324
+ e.search.query ? (w(), P("span", Po, y(e.search.searching ? e.messages.searching ?? "搜索中…" : i()), 1)) : N("", !0),
1325
+ p("button", {
1326
+ class: "mrp-nav mrp-icon-button",
1327
+ type: "button",
1328
+ disabled: e.search.matchCount === 0 || e.search.searching,
1329
+ "aria-label": e.messages.prevSearchMatch ?? "上一个匹配",
1330
+ onClick: m[12] || (m[12] = (f) => o("search-nav", -1))
1331
+ }, [
1332
+ Q(ae, {
1333
+ name: "chevron-up",
1334
+ size: 14
1335
+ })
1336
+ ], 8, So),
1337
+ p("button", {
1338
+ class: "mrp-nav mrp-icon-button",
1339
+ type: "button",
1340
+ disabled: e.search.matchCount === 0 || e.search.searching,
1341
+ "aria-label": e.messages.nextSearchMatch ?? "下一个匹配",
1342
+ onClick: m[13] || (m[13] = (f) => o("search-nav", 1))
1343
+ }, [
1344
+ Q(ae, {
1345
+ name: "chevron-down",
1346
+ size: 14
1347
+ })
1348
+ ], 8, Ro),
1349
+ p("button", {
1350
+ class: "mrp-nav mrp-search-close mrp-icon-button",
1351
+ type: "button",
1352
+ "aria-label": e.messages.closeSearch ?? "关闭搜索",
1353
+ onClick: m[14] || (m[14] = //@ts-ignore
1354
+ (...f) => u(a).close && u(a).close(...f))
1355
+ }, [
1356
+ Q(ae, {
1357
+ name: "close",
1358
+ size: 14
1359
+ })
1360
+ ], 8, Mo)
1361
+ ], 2),
1362
+ p("span", To, y(e.search.query && !e.search.searching && !e.search.matchCount ? e.messages.searchNoMatches ?? "没有匹配内容" : e.messages.searchHint ?? "Enter 下一个 · Shift+Enter 上一个"), 1)
1363
+ ], 8, Co)) : N("", !0)
1364
+ ], 8, uo));
1365
+ }
1366
+ }), Do = /* @__PURE__ */ we(Oo, [["__scopeId", "data-v-5f4b04d8"]]);
1367
+ function Ao(e) {
1368
+ const t = e.meta?.record;
1369
+ if (!(!t || typeof t != "object" || typeof t.dataset != "string") && [t.rowIndex, t.copyIndex, t.templatePageIndex].every((n) => Number.isSafeInteger(n) && Number(n) >= 0) && !(t.rowKey !== void 0 && typeof t.rowKey != "string" && typeof t.rowKey != "number"))
1370
+ return t;
1371
+ }
1372
+ function Fo(e) {
1373
+ const t = [], n = [];
1374
+ let s;
1375
+ for (const [o, a] of (e?.pages ?? []).entries()) {
1376
+ const r = Ao(a);
1377
+ if (!r) {
1378
+ n.push(-1), s = void 0;
1379
+ continue;
1380
+ }
1381
+ (!s || r.dataset !== s.dataset || r.rowIndex !== s.rowIndex || r.rowKey !== s.rowKey || r.copyIndex === 0 && r.templatePageIndex === 0) && t.push({ page: o + 1, ...r.rowKey === void 0 ? {} : { rowKey: r.rowKey } }), n.push(t.length - 1), s = r;
1382
+ }
1383
+ return { entries: t, pageRecords: n };
1384
+ }
1385
+ const zo = ["aria-label"], Lo = {
1386
+ key: 0,
1387
+ class: "mrp-record-arrows"
1388
+ }, No = ["aria-label", "title", "disabled"], qo = ["aria-label", "title", "disabled"], Bo = {
1389
+ class: "mrp-record-info",
1390
+ "aria-live": "polite"
1391
+ }, Ko = ["title"], jo = ["title"], Ho = /* @__PURE__ */ ye({
1392
+ __name: "ReportRecordNavigation",
1393
+ props: {
1394
+ plan: {},
1395
+ currentPage: {},
1396
+ messages: {},
1397
+ busy: { type: Boolean }
1398
+ },
1399
+ emits: ["goto"],
1400
+ setup(e, { emit: t }) {
1401
+ const n = e, s = t, o = D(() => Fo(n.plan)), a = D(() => o.value.pageRecords[n.currentPage - 1] ?? -1), r = D(() => a.value >= 0 ? o.value.entries[a.value] : void 0), l = D(() => (n.messages.recordInfo ?? "记录 {cur} / {total}").replace("{cur}", String(a.value + 1)).replace("{total}", String(o.value.entries.length))), i = D(() => {
1402
+ const v = n.plan?.pages[n.currentPage - 1]?.meta?.title;
1403
+ return typeof v == "string" ? v : "";
1404
+ });
1405
+ function d(v) {
1406
+ const m = o.value.entries[a.value + v];
1407
+ !n.busy && a.value >= 0 && m && s("goto", m.page);
1408
+ }
1409
+ return (v, m) => r.value ? (w(), P("nav", {
1410
+ key: 0,
1411
+ class: "mrp-record-navigation",
1412
+ "aria-label": e.messages.recordNavigation ?? "标签记录"
1413
+ }, [
1414
+ o.value.entries.length > 1 ? (w(), P("div", Lo, [
1415
+ p("button", {
1416
+ type: "button",
1417
+ "aria-label": e.messages.prevRecord ?? "上一条记录",
1418
+ title: e.messages.prevRecord ?? "上一条记录",
1419
+ disabled: e.busy || a.value <= 0,
1420
+ onClick: m[0] || (m[0] = (f) => d(-1))
1421
+ }, [
1422
+ Q(ae, {
1423
+ name: "chevron-left",
1424
+ size: 13
1425
+ })
1426
+ ], 8, No),
1427
+ p("button", {
1428
+ type: "button",
1429
+ "aria-label": e.messages.nextRecord ?? "下一条记录",
1430
+ title: e.messages.nextRecord ?? "下一条记录",
1431
+ disabled: e.busy || a.value >= o.value.entries.length - 1,
1432
+ onClick: m[1] || (m[1] = (f) => d(1))
1433
+ }, [
1434
+ Q(ae, {
1435
+ name: "chevron-right",
1436
+ size: 13
1437
+ })
1438
+ ], 8, qo)
1439
+ ])) : N("", !0),
1440
+ p("span", Bo, y(l.value), 1),
1441
+ r.value.rowKey !== void 0 ? (w(), P("code", {
1442
+ key: 1,
1443
+ title: String(r.value.rowKey)
1444
+ }, y(r.value.rowKey), 9, Ko)) : N("", !0),
1445
+ i.value ? (w(), P("span", {
1446
+ key: 2,
1447
+ class: "mrp-record-face",
1448
+ title: i.value
1449
+ }, y(i.value), 9, jo)) : N("", !0)
1450
+ ], 8, zo)) : N("", !0);
1451
+ }
1452
+ }), Wo = /* @__PURE__ */ we(Ho, [["__scopeId", "data-v-aa94fa14"]]), Uo = ["aria-label", "aria-busy"], Vo = { class: "mrp-calculation-heading" }, Jo = { class: "mrp-calculation-controls" }, Go = ["aria-label", "value", "disabled"], Yo = ["value"], Zo = { class: "mrp-calculation-precision" }, Xo = ["aria-label", "value", "disabled"], Qo = {
1453
+ key: 0,
1454
+ class: "mrp-calculation-expression"
1455
+ }, _o = ["aria-label", "value", "disabled"], er = { class: "mrp-calculation-actions" }, tr = {
1456
+ key: 1,
1457
+ class: "mrp-calculation-diagnostic",
1458
+ role: "alert"
1459
+ }, nr = {
1460
+ key: 2,
1461
+ class: "mrp-calculation-result",
1462
+ role: "status",
1463
+ "aria-live": "polite"
1464
+ }, ar = { key: 0 }, sr = {
1465
+ key: 3,
1466
+ class: "mrp-calculation-empty"
1467
+ }, or = { class: "mrp-calculation-local" }, rr = /* @__PURE__ */ ye({
1468
+ __name: "ReportCalculationPanel",
1469
+ props: {
1470
+ state: {},
1471
+ messages: {}
1472
+ },
1473
+ setup(e) {
1474
+ const t = e, n = `mrp-calculation-expression-hint-${rn()?.uid ?? 0}`, s = D(() => [
1475
+ ["sum", t.messages.calculationSum],
1476
+ ["average", t.messages.calculationAverage],
1477
+ ["min", t.messages.calculationMin],
1478
+ ["max", t.messages.calculationMax],
1479
+ ["count", t.messages.calculationCount],
1480
+ ["median", t.messages.calculationMedian],
1481
+ ["expression", t.messages.calculationCustom]
1482
+ ]), o = D(() => {
1483
+ const a = t.state.error.value;
1484
+ if (!a) return "";
1485
+ const r = t.messages;
1486
+ return { selection: r.calculationErrorSelection, limit: r.calculationErrorLimit, expression: r.calculationErrorExpression, division: r.calculationErrorDivision, overflow: r.calculationErrorOverflow, precision: r.calculationErrorPrecision }[a];
1487
+ });
1488
+ return (a, r) => (w(), P("section", {
1489
+ class: "mrp-calculation",
1490
+ "aria-label": e.messages.calculationTitle,
1491
+ "aria-busy": e.state.busy.value
1492
+ }, [
1493
+ p("header", Vo, [
1494
+ r[5] || (r[5] = p("span", {
1495
+ class: "mrp-calculation-symbol",
1496
+ "aria-hidden": "true"
1497
+ }, "∑", -1)),
1498
+ p("div", null, [
1499
+ p("strong", null, y(e.messages.calculationTitle), 1),
1500
+ p("p", null, y(e.messages.calculationHint), 1)
1501
+ ])
1502
+ ]),
1503
+ p("div", Jo, [
1504
+ p("label", null, [
1505
+ p("span", null, y(e.messages.calculationFormula), 1),
1506
+ p("select", {
1507
+ "aria-label": e.messages.calculationFormula,
1508
+ value: e.state.operation.value,
1509
+ onChange: r[0] || (r[0] = (l) => e.state.setOperation(l.target.value)),
1510
+ disabled: e.state.busy.value
1511
+ }, [
1512
+ (w(!0), P(ge, null, be(s.value, ([l, i]) => (w(), P("option", {
1513
+ key: l,
1514
+ value: l
1515
+ }, y(i), 9, Yo))), 128))
1516
+ ], 40, Go)
1517
+ ]),
1518
+ p("label", Zo, [
1519
+ p("span", null, y(e.messages.calculationPrecision), 1),
1520
+ p("input", {
1521
+ "aria-label": e.messages.calculationPrecision,
1522
+ value: e.state.precision.value,
1523
+ onChange: r[1] || (r[1] = (l) => e.state.setPrecision(Number(l.target.value))),
1524
+ type: "number",
1525
+ min: "0",
1526
+ max: "12",
1527
+ step: "1",
1528
+ disabled: e.state.busy.value
1529
+ }, null, 40, Xo)
1530
+ ])
1531
+ ]),
1532
+ e.state.operation.value === "expression" ? (w(), P("label", Qo, [
1533
+ p("span", null, y(e.messages.calculationExpression), 1),
1534
+ p("input", {
1535
+ "aria-label": e.messages.calculationExpression,
1536
+ "aria-describedby": n,
1537
+ value: e.state.expression.value,
1538
+ onInput: r[2] || (r[2] = (l) => e.state.setExpression(l.target.value)),
1539
+ type: "text",
1540
+ maxlength: "256",
1541
+ spellcheck: "false",
1542
+ disabled: e.state.busy.value,
1543
+ placeholder: "SUM / COUNT"
1544
+ }, null, 40, _o),
1545
+ p("small", { id: n }, y(e.messages.calculationExpressionHint), 1)
1546
+ ])) : N("", !0),
1547
+ p("div", er, [
1548
+ e.state.busy.value ? (w(), P("button", {
1549
+ key: 0,
1550
+ type: "button",
1551
+ onClick: r[3] || (r[3] = (l) => e.state.cancel())
1552
+ }, y(e.messages.calculationCancel), 1)) : (w(), P("button", {
1553
+ key: 1,
1554
+ class: "mrp-calculation-run",
1555
+ type: "button",
1556
+ onClick: r[4] || (r[4] = (l) => e.state.run())
1557
+ }, y(e.messages.calculationRun), 1))
1558
+ ]),
1559
+ o.value ? (w(), P("p", tr, y(o.value), 1)) : e.state.result.value ? (w(), P("div", nr, [
1560
+ p("span", null, y(e.messages.calculationResult), 1),
1561
+ p("output", null, y(e.state.result.value.formatted), 1),
1562
+ p("small", null, [
1563
+ p("span", null, y(e.messages.calculationIncluded) + " " + y(e.state.result.value.numericCells), 1),
1564
+ p("span", null, y(e.messages.calculationExcluded) + " " + y(e.state.result.value.excludedCells), 1)
1565
+ ]),
1566
+ e.state.result.value.numericCells === 0 ? (w(), P("p", ar, y(e.messages.calculationEmpty), 1)) : N("", !0)
1567
+ ])) : (w(), P("p", sr, y(e.messages.calculationNoSelection), 1)),
1568
+ p("p", or, y(e.messages.calculationLocal), 1)
1569
+ ], 8, Uo));
1570
+ }
1571
+ }), lr = /* @__PURE__ */ we(rr, [["__scopeId", "data-v-ee359251"]]);
1572
+ function ir(e) {
1573
+ const t = G("sum"), n = G("SUM / COUNT"), s = G(2), o = G(!1), a = fe(null), r = G(null);
1574
+ let l = null, i = 0;
1575
+ function d() {
1576
+ i++, l?.abort(), l = null, o.value = !1;
1577
+ }
1578
+ function v() {
1579
+ d(), a.value = null, r.value = null;
1580
+ }
1581
+ async function m() {
1582
+ if (v(), !e.enabled()) return;
1583
+ const b = e.plan.value, g = e.selection.value;
1584
+ if (!b || !g) {
1585
+ r.value = "selection";
1586
+ return;
1587
+ }
1588
+ const R = ++i, h = new AbortController();
1589
+ l = h, o.value = !0;
1590
+ try {
1591
+ const S = await Ga(b, g, { operation: t.value, expression: n.value, precision: s.value, signal: h.signal });
1592
+ R === i && e.plan.value === b && e.selection.value === g && e.enabled() && (a.value = S);
1593
+ } catch (S) {
1594
+ R === i && !h.signal.aborted && (r.value = S instanceof Ya ? S.code : "expression");
1595
+ } finally {
1596
+ R === i && (o.value = !1, l = null);
1597
+ }
1598
+ }
1599
+ de([e.plan, e.selection, () => e.enabled(), t, n, s], v, { flush: "sync" }), Ke(v);
1600
+ function f(b) {
1601
+ t.value = b;
1602
+ }
1603
+ function $(b) {
1604
+ n.value = b;
1605
+ }
1606
+ function k(b) {
1607
+ s.value = b;
1608
+ }
1609
+ return { operation: t, expression: n, precision: s, busy: o, result: a, error: r, run: m, cancel: d, clear: v, setOperation: f, setExpression: $, setPrecision: k };
1610
+ }
1611
+ const ur = ["aria-label"], cr = { class: "mrp-settings-header" }, dr = ["aria-label"], fr = ["aria-label"], mr = ["id", "aria-selected", "aria-controls", "tabindex", "onClick", "onKeydown"], gr = { class: "mrp-settings-content" }, vr = ["id", "aria-labelledby", "hidden"], pr = { key: 0 }, hr = { class: "mrp-settings-option" }, br = ["checked", "disabled"], yr = { class: "mrp-settings-option" }, wr = ["value", "disabled"], xr = ["id", "aria-labelledby", "hidden"], kr = { key: 0 }, $r = ["checked", "disabled", "onChange"], Cr = {
1612
+ key: 0,
1613
+ class: "mrp-settings-note"
1614
+ }, Er = {
1615
+ key: 1,
1616
+ class: "mrp-settings-note"
1617
+ }, Ir = ["id", "aria-labelledby", "hidden"], Pr = { class: "mrp-settings-intro" }, Sr = { class: "mrp-settings-option mrp-settings-feature" }, Rr = ["id"], Mr = ["aria-label", "aria-describedby", "checked", "disabled"], Tr = ["disabled"], Or = /* @__PURE__ */ ye({
1618
+ __name: "ReportSettings",
1619
+ props: {
1620
+ available: {},
1621
+ enabled: {},
1622
+ messages: {},
1623
+ persistedEditing: { type: Boolean },
1624
+ busy: { type: Boolean },
1625
+ interaction: {},
1626
+ section: {}
1627
+ },
1628
+ emits: ["change", "reset", "close", "interaction", "section"],
1629
+ setup(e, { emit: t }) {
1630
+ const n = e, s = t, o = G(null), a = D(() => n.section ?? "general"), r = "mrp-settings-" + rn()?.uid, l = D(() => [
1631
+ { key: "general", label: n.messages.settingsGeneral ?? "常规" },
1632
+ { key: "tools", label: n.messages.settingsTools ?? "工具" },
1633
+ { key: "advanced", label: n.messages.settingsAdvanced ?? "高级" }
1634
+ ]);
1635
+ function i(b, g) {
1636
+ const h = { ArrowRight: (g + 1) % 3, ArrowLeft: (g + 2) % 3, Home: 0, End: 2 }[b.key];
1637
+ h !== void 0 && (b.preventDefault(), s("section", l.value[h].key), o.value?.querySelector("#" + r + "-tab-" + l.value[h].key)?.focus());
1638
+ }
1639
+ const d = G(null);
1640
+ let v = null;
1641
+ const m = D(() => [
1642
+ { label: n.messages.settingsDisplay, tools: [
1643
+ ["search", n.messages.search],
1644
+ ["thumbnails", n.messages.thumbnails],
1645
+ ["zoom", n.messages.zoom]
1646
+ ] },
1647
+ { label: n.messages.settingsExport, tools: [
1648
+ ["html", n.messages.exportHtml],
1649
+ ["pdf", n.messages.exportPdf],
1650
+ ["xlsx", n.messages.exportExcel],
1651
+ ["png", n.messages.exportImage],
1652
+ ["word", n.messages.exportWord],
1653
+ ["print", n.messages.print],
1654
+ ["pdfWindow", n.messages.pdfWindow]
1655
+ ] },
1656
+ { label: n.messages.settingsData, tools: [
1657
+ ["editing", n.messages.editCell],
1658
+ ["import", n.messages.importExcel]
1659
+ ] }
1660
+ ].map((b) => ({ ...b, tools: b.tools.map(([g, R]) => ({ key: g, label: R })) })));
1661
+ function f(b, g) {
1662
+ const R = b.target, h = R.checked;
1663
+ R.checked = n.enabled[g], s("change", g, h);
1664
+ }
1665
+ function $(b) {
1666
+ return !o.value || b.defaultPrevented ? !1 : b.target instanceof Node && o.value.contains(b.target) ? !0 : b.target instanceof Element && b.target.closest('[role="dialog"],dialog[open]') ? !1 : !Array.from(document.querySelectorAll('[aria-modal="true"],dialog[open]')).some((g) => g !== o.value && !o.value.contains(g));
1667
+ }
1668
+ function k(b) {
1669
+ if (!$(b)) return;
1670
+ if (b.key === "Escape") {
1671
+ b.preventDefault(), b.stopPropagation(), s("close");
1672
+ return;
1673
+ }
1674
+ if (b.key !== "Tab") return;
1675
+ const g = Array.from(o.value?.querySelectorAll("a[href],button:not(:disabled),input:not(:disabled),textarea:not(:disabled),select:not(:disabled),[tabindex='0']") ?? []).filter((z) => !z.closest("[hidden]") && z.tabIndex !== -1), R = g?.[0], h = g?.[g.length - 1];
1676
+ (!o.value?.contains(document.activeElement) || b.shiftKey && document.activeElement === R || !b.shiftKey && document.activeElement === h) && (b.preventDefault(), b.stopPropagation(), (b.shiftKey ? h : R)?.focus());
1677
+ }
1678
+ return ln(() => {
1679
+ const b = o.value?.closest(".mach-report-preview")?.querySelector(".mrp-settings-toggle"), g = document.activeElement;
1680
+ v = g instanceof HTMLElement && g !== document.body && !o.value?.contains(g) ? g : b ?? null, d.value?.focus(), document.addEventListener("keydown", k);
1681
+ }), un(() => {
1682
+ document.removeEventListener("keydown", k), v?.isConnected && v.focus();
1683
+ }), (b, g) => (w(), P("div", {
1684
+ class: "mrp-settings-backdrop",
1685
+ onClick: g[5] || (g[5] = pt((R) => b.$emit("close"), ["self"]))
1686
+ }, [
1687
+ p("section", {
1688
+ ref_key: "panel",
1689
+ ref: o,
1690
+ class: "mrp-settings-panel",
1691
+ role: "dialog",
1692
+ "aria-modal": "true",
1693
+ "aria-label": e.messages.settings
1694
+ }, [
1695
+ p("header", cr, [
1696
+ p("div", null, [
1697
+ g[6] || (g[6] = p("span", { class: "mrp-settings-eyebrow" }, "MACH REPORT", -1)),
1698
+ p("strong", null, y(e.messages.settings), 1),
1699
+ p("p", null, y(e.messages.settingsLocal), 1)
1700
+ ]),
1701
+ p("button", {
1702
+ ref_key: "closeButton",
1703
+ ref: d,
1704
+ class: "mrp-settings-close",
1705
+ type: "button",
1706
+ "aria-label": e.messages.settingsClose,
1707
+ onClick: g[0] || (g[0] = (R) => b.$emit("close"))
1708
+ }, [...g[7] || (g[7] = [
1709
+ p("svg", {
1710
+ width: "16",
1711
+ height: "16",
1712
+ viewBox: "0 0 20 20",
1713
+ fill: "none",
1714
+ "aria-hidden": "true"
1715
+ }, [
1716
+ p("path", {
1717
+ d: "m5 5 10 10M15 5 5 15",
1718
+ stroke: "currentColor",
1719
+ "stroke-width": "1.6",
1720
+ "stroke-linecap": "round"
1721
+ })
1722
+ ], -1)
1723
+ ])], 8, dr)
1724
+ ]),
1725
+ p("div", {
1726
+ class: "mrp-settings-tabs",
1727
+ role: "tablist",
1728
+ "aria-label": e.messages.settings
1729
+ }, [
1730
+ (w(!0), P(ge, null, be(l.value, (R, h) => (w(), P("button", {
1731
+ id: r + "-tab-" + R.key,
1732
+ key: R.key,
1733
+ type: "button",
1734
+ role: "tab",
1735
+ "aria-selected": a.value === R.key,
1736
+ "aria-controls": r + "-panel-" + R.key,
1737
+ tabindex: a.value === R.key ? 0 : -1,
1738
+ onClick: (S) => b.$emit("section", R.key),
1739
+ onKeydown: (S) => i(S, h)
1740
+ }, y(R.label), 41, mr))), 128))
1741
+ ], 8, fr),
1742
+ p("div", gr, [
1743
+ p("section", {
1744
+ id: r + "-panel-general",
1745
+ role: "tabpanel",
1746
+ "aria-labelledby": r + "-tab-general",
1747
+ hidden: a.value !== "general"
1748
+ }, [
1749
+ ht(b.$slots, "default", {}, void 0, !0),
1750
+ e.interaction ? (w(), P("fieldset", pr, [
1751
+ p("legend", null, y(e.messages.settingsPanes), 1),
1752
+ p("label", hr, [
1753
+ p("span", null, y(e.messages.freezeHeaders), 1),
1754
+ p("input", {
1755
+ type: "checkbox",
1756
+ checked: e.interaction.freezeHeaders,
1757
+ disabled: e.busy,
1758
+ onChange: g[1] || (g[1] = (R) => b.$emit("interaction", { freezeHeaders: R.target.checked }))
1759
+ }, null, 40, br)
1760
+ ]),
1761
+ p("label", yr, [
1762
+ p("span", null, y(e.messages.frozenColumns), 1),
1763
+ p("input", {
1764
+ class: "mrp-frozen-count",
1765
+ type: "number",
1766
+ min: "0",
1767
+ max: "20",
1768
+ value: e.interaction.frozenColumns ?? 0,
1769
+ disabled: e.busy,
1770
+ onChange: g[2] || (g[2] = (R) => b.$emit("interaction", { frozenColumns: Math.max(0, Math.min(20, Number(R.target.value) || 0)) }))
1771
+ }, null, 40, wr)
1772
+ ])
1773
+ ])) : N("", !0)
1774
+ ], 8, vr),
1775
+ p("section", {
1776
+ id: r + "-panel-tools",
1777
+ role: "tabpanel",
1778
+ "aria-labelledby": r + "-tab-tools",
1779
+ hidden: a.value !== "tools"
1780
+ }, [
1781
+ (w(!0), P(ge, null, be(m.value, (R) => (w(), P("fieldset", {
1782
+ key: R.label
1783
+ }, [
1784
+ p("legend", null, y(R.label), 1),
1785
+ (w(!0), P(ge, null, be(R.tools, (h) => (w(), P("label", {
1786
+ key: h.key,
1787
+ class: Ce(["mrp-settings-option", { "mrp-settings-unavailable": !e.available[h.key] }])
1788
+ }, [
1789
+ p("span", null, [
1790
+ ie(y(h.label), 1),
1791
+ e.available[h.key] ? N("", !0) : (w(), P("small", kr, y(e.messages.settingsUnavailable), 1))
1792
+ ]),
1793
+ p("input", {
1794
+ type: "checkbox",
1795
+ checked: e.enabled[h.key],
1796
+ disabled: e.busy || !e.available[h.key],
1797
+ onChange: (S) => f(S, h.key)
1798
+ }, null, 40, $r)
1799
+ ], 2))), 128))
1800
+ ]))), 128)),
1801
+ e.available.editing ? (w(), P("p", Cr, y(e.persistedEditing ? e.messages.editingSaved : e.messages.editingLocal), 1)) : N("", !0),
1802
+ e.available.import ? (w(), P("p", Er, y(e.messages.importLocal), 1)) : N("", !0)
1803
+ ], 8, xr),
1804
+ p("section", {
1805
+ id: r + "-panel-advanced",
1806
+ role: "tabpanel",
1807
+ "aria-labelledby": r + "-tab-advanced",
1808
+ hidden: a.value !== "advanced"
1809
+ }, [
1810
+ p("p", Pr, y(e.messages.settingsAdvancedDescription), 1),
1811
+ p("label", Sr, [
1812
+ p("span", null, [
1813
+ ie(y(e.messages.settingsCalculations), 1),
1814
+ p("small", {
1815
+ id: r + "-calculation-description"
1816
+ }, y(e.messages.settingsCalculationsDescription), 9, Rr)
1817
+ ]),
1818
+ p("input", {
1819
+ type: "checkbox",
1820
+ "aria-label": e.messages.settingsCalculations,
1821
+ "aria-describedby": r + "-calculation-description",
1822
+ checked: e.interaction?.calculations === !0,
1823
+ disabled: e.busy,
1824
+ onChange: g[3] || (g[3] = (R) => b.$emit("interaction", { calculations: R.target.checked }))
1825
+ }, null, 40, Mr)
1826
+ ]),
1827
+ e.interaction?.calculations ? ht(b.$slots, "advanced", {}, void 0, !0, 0) : N("", !0)
1828
+ ], 8, Ir)
1829
+ ]),
1830
+ p("footer", null, [
1831
+ p("button", {
1832
+ type: "button",
1833
+ disabled: e.busy,
1834
+ onClick: g[4] || (g[4] = (R) => b.$emit("reset"))
1835
+ }, y(e.messages.settingsReset), 9, Tr),
1836
+ p("span", null, y(e.messages.settingsLocal), 1)
1837
+ ])
1838
+ ], 8, ur)
1839
+ ]));
1840
+ }
1841
+ }), Dr = /* @__PURE__ */ we(Or, [["__scopeId", "data-v-36723612"]]), Ar = {
1842
+ class: "mrp-empty",
1843
+ role: "status"
1844
+ }, Fr = { key: 0 }, zr = /* @__PURE__ */ ye({
1845
+ __name: "ReportEmpty",
1846
+ props: {
1847
+ title: {},
1848
+ description: {}
1849
+ },
1850
+ setup(e) {
1851
+ return (t, n) => (w(), P("div", Ar, [
1852
+ n[0] || (n[0] = Ha('<svg class="mrp-empty-art" viewBox="0 0 160 112" fill="none" aria-hidden="true" data-v-3e16b87e><ellipse cx="80" cy="100" rx="54" ry="7" fill="currentColor" opacity=".05" data-v-3e16b87e></ellipse><rect x="34" y="15" width="92" height="78" rx="9" fill="currentColor" opacity=".10" data-v-3e16b87e></rect><rect x="42" y="9" width="76" height="78" rx="7" fill="var(--mrp-toolbar-bg, #fff)" stroke="currentColor" stroke-opacity=".2" stroke-width="1.5" data-v-3e16b87e></rect><path d="M55 27H105M55 42H105M55 57H85M55 72H76M71 27V72M89 27V57" stroke="currentColor" stroke-opacity=".4" stroke-width="1.5" stroke-linecap="round" data-v-3e16b87e></path><circle cx="112" cy="76" r="16" fill="var(--mrp-toolbar-bg, #fff)" stroke="currentColor" stroke-opacity=".35" stroke-width="2" data-v-3e16b87e></circle><path d="M124 88L137 101M106 76H118" stroke="currentColor" stroke-opacity=".45" stroke-width="3" stroke-linecap="round" data-v-3e16b87e></path><circle cx="27" cy="38" r="3" fill="currentColor" opacity=".12" data-v-3e16b87e></circle><circle cx="132" cy="24" r="2" fill="currentColor" opacity=".2" data-v-3e16b87e></circle></svg>', 1)),
1853
+ p("strong", null, y(e.title), 1),
1854
+ e.description ? (w(), P("p", Fr, y(e.description), 1)) : N("", !0)
1855
+ ]));
1856
+ }
1857
+ }), Hn = /* @__PURE__ */ we(zr, [["__scopeId", "data-v-3e16b87e"]]), Lr = ["aria-label"], Nr = /* @__PURE__ */ ye({
1858
+ __name: "ReportDiscardDialog",
1859
+ props: {
1860
+ messages: {}
1861
+ },
1862
+ emits: ["answer"],
1863
+ setup(e, { emit: t }) {
1864
+ const n = t, s = G(null), o = G(null);
1865
+ let a = null;
1866
+ function r(l) {
1867
+ l.key === "Escape" && (l.preventDefault(), n("answer", !1)), l.key === "Tab" && (l.preventDefault(), document.activeElement === s.value ? o.value?.focus() : s.value?.focus());
1868
+ }
1869
+ return ln(() => {
1870
+ a = document.activeElement instanceof HTMLElement ? document.activeElement : null, s.value?.focus();
1871
+ }), un(() => {
1872
+ a?.isConnected && a.focus();
1873
+ }), (l, i) => (w(), P("div", {
1874
+ class: "mrp-discard-backdrop",
1875
+ onKeydown: r,
1876
+ onClick: i[2] || (i[2] = pt((d) => n("answer", !1), ["self"]))
1877
+ }, [
1878
+ p("section", {
1879
+ class: "mrp-discard-dialog",
1880
+ role: "alertdialog",
1881
+ "aria-modal": "true",
1882
+ "aria-label": e.messages.discardTitle
1883
+ }, [
1884
+ p("strong", null, y(e.messages.discardTitle), 1),
1885
+ p("p", null, y(e.messages.discardDescription), 1),
1886
+ p("footer", null, [
1887
+ p("button", {
1888
+ ref_key: "keep",
1889
+ ref: s,
1890
+ type: "button",
1891
+ onClick: i[0] || (i[0] = (d) => n("answer", !1))
1892
+ }, y(e.messages.discardKeep), 513),
1893
+ p("button", {
1894
+ ref_key: "discard",
1895
+ ref: o,
1896
+ type: "button",
1897
+ onClick: i[1] || (i[1] = (d) => n("answer", !0))
1898
+ }, y(e.messages.discardProceed), 513)
1899
+ ])
1900
+ ], 8, Lr)
1901
+ ], 32));
1902
+ }
1903
+ }), qr = /* @__PURE__ */ we(Nr, [["__scopeId", "data-v-f7590294"]]), Br = {
1904
+ key: 0,
1905
+ class: "mrp-task-status",
1906
+ role: "status",
1907
+ "aria-live": "polite"
1908
+ }, Kr = { key: 0 }, jr = ["value", "max", "aria-label"], Hr = /* @__PURE__ */ ye({
1909
+ __name: "ReportTaskStatus",
1910
+ props: {
1911
+ task: {},
1912
+ messages: {}
1913
+ },
1914
+ emits: ["cancel"],
1915
+ setup(e) {
1916
+ const t = e, n = D(() => ({ query: t.messages.taskQuery, validate: t.messages.taskValidate, layout: t.messages.taskLayout, assets: t.messages.taskAssets, import: t.messages.importing, encode: t.messages.taskEncode, download: t.messages.taskDownload, print: t.messages.taskPrint })), s = D(() => t.task?.total === void 0 ? "" : `${t.task.completed ?? 0} / ${t.task.total}`);
1917
+ return (o, a) => e.task && (e.task.status === "running" || e.task.status === "cancelled") ? (w(), P("div", Br, [
1918
+ p("span", null, [
1919
+ ie(y(e.task.status === "cancelled" ? e.messages.taskCancelled : n.value[e.task.stage]) + " ", 1),
1920
+ e.task.status === "running" ? (w(), P("small", Kr, y(s.value), 1)) : N("", !0)
1921
+ ]),
1922
+ e.task.status === "running" && e.task.total !== void 0 ? (w(), P("progress", {
1923
+ key: 0,
1924
+ value: e.task.completed ?? 0,
1925
+ max: e.task.total,
1926
+ "aria-label": n.value[e.task.stage]
1927
+ }, null, 8, jr)) : N("", !0),
1928
+ e.task.status === "running" && e.task.cancellable ? (w(), P("button", {
1929
+ key: 1,
1930
+ type: "button",
1931
+ onClick: a[0] || (a[0] = (r) => o.$emit("cancel"))
1932
+ }, y(e.messages.taskCancel), 1)) : N("", !0)
1933
+ ])) : N("", !0);
1934
+ }
1935
+ }), Wr = /* @__PURE__ */ we(Hr, [["__scopeId", "data-v-657ac599"]]), Ur = {
1936
+ key: 0,
1937
+ class: "mrp-diagnostics"
1938
+ }, Vr = ["aria-label", "placeholder"], Jr = { key: 0 }, Gr = ["onClick"], Yr = { key: 0 }, Zr = /* @__PURE__ */ ye({
1939
+ __name: "ReportDiagnostics",
1940
+ props: {
1941
+ entries: {},
1942
+ messages: {}
1943
+ },
1944
+ emits: ["locate"],
1945
+ setup(e) {
1946
+ const t = e, n = G(""), s = D(() => ({
1947
+ "unsupported-style": t.messages.diagnosticUnsupportedStyle,
1948
+ "missing-image": t.messages.diagnosticMissingImage,
1949
+ "unsupported-component": t.messages.diagnosticUnsupported,
1950
+ "unsupported-image-format": t.messages.diagnosticImageFormat,
1951
+ "rich-text-flattened": t.messages.diagnosticRichText,
1952
+ "nested-components-omitted": t.messages.diagnosticNested,
1953
+ "async-image-required": t.messages.diagnosticImageAsync,
1954
+ "image-decode-failed": t.messages.diagnosticImageDecode,
1955
+ "asset-render-failed": t.messages.diagnosticAssetFailed,
1956
+ "asset-budget-exceeded": t.messages.diagnosticAssetBudget
1957
+ })), o = D(() => {
1958
+ const l = n.value.trim().toLocaleLowerCase();
1959
+ return l ? t.entries.filter((i) => `${i.code} ${i.message} ${s.value[i.code] ?? ""} ${i.path ?? ""} ${r(i)} ${i.format ?? ""}`.toLocaleLowerCase().includes(l)) : t.entries;
1960
+ }), a = D(() => o.value.slice(0, 100));
1961
+ function r(l) {
1962
+ return l.pageIndex === void 0 ? l.path ?? "" : (t.messages.diagnosticsLocation ?? "").replace("{page}", String(l.pageIndex + 1)).replace("{component}", String((l.componentIndex ?? 0) + 1));
1963
+ }
1964
+ return (l, i) => e.entries.length ? (w(), P("details", Ur, [
1965
+ p("summary", null, [
1966
+ ie(y(e.messages.diagnosticsTitle) + " ", 1),
1967
+ p("span", null, y(e.entries.length), 1)
1968
+ ]),
1969
+ Rt(p("input", {
1970
+ "onUpdate:modelValue": i[0] || (i[0] = (d) => n.value = d),
1971
+ type: "search",
1972
+ "aria-label": e.messages.diagnosticsSearch,
1973
+ placeholder: e.messages.diagnosticsSearch
1974
+ }, null, 8, Vr), [
1975
+ [Mt, n.value]
1976
+ ]),
1977
+ p("ol", null, [
1978
+ (w(!0), P(ge, null, be(a.value, (d, v) => (w(), P("li", { key: v }, [
1979
+ p("div", null, [
1980
+ p("b", null, y(d.format?.toUpperCase() ?? d.severity) + " · " + y(d.code), 1),
1981
+ p("p", null, y(s.value[d.code] ?? d.message), 1),
1982
+ s.value[d.code] ? (w(), P("details", Jr, [
1983
+ p("summary", null, y(e.messages.diagnosticsDetails), 1),
1984
+ ie(y(d.message), 1)
1985
+ ])) : N("", !0),
1986
+ p("small", null, y(r(d)), 1)
1987
+ ]),
1988
+ d.pageIndex !== void 0 ? (w(), P("button", {
1989
+ key: 0,
1990
+ type: "button",
1991
+ onClick: (m) => l.$emit("locate", d)
1992
+ }, y(e.messages.diagnosticsLocate), 9, Gr)) : N("", !0)
1993
+ ]))), 128))
1994
+ ]),
1995
+ o.value.length > a.value.length ? (w(), P("small", Yr, y((e.messages.diagnosticsMore ?? "").replace("{count}", String(o.value.length))), 1)) : N("", !0)
1996
+ ])) : N("", !0);
1997
+ }
1998
+ }), Xr = /* @__PURE__ */ we(Zr, [["__scopeId", "data-v-3b7804ce"]]), Qr = {
1999
+ key: 0,
2000
+ class: "mrp-data-explanation"
2001
+ }, _r = { class: "mrp-data-content" }, el = ["aria-label", "placeholder"], tl = { class: "mrp-data-state" }, nl = ["disabled", "onClick"], al = {
2002
+ key: 0,
2003
+ role: "status"
2004
+ }, sl = { key: 1 }, ol = /* @__PURE__ */ ye({
2005
+ __name: "ReportDataExplanation",
2006
+ props: {
2007
+ entries: {},
2008
+ messages: {},
2009
+ busy: { type: Boolean }
2010
+ },
2011
+ emits: ["locate"],
2012
+ setup(e, { emit: t }) {
2013
+ const n = e, s = t, o = G(""), a = D(() => ({ "missing-source": n.messages.dataMissingSource, "not-applicable": n.messages.dataNotApplicable, "not-calculable": n.messages.dataNotCalculable })), r = D(() => {
2014
+ const i = o.value.toLocaleLowerCase().trim().split(/\s+/).filter(Boolean);
2015
+ return n.entries.filter((d) => i.every((v) => `${d.message} ${d.target?.datasetId} ${d.target?.rowKey ?? ""} ${d.target?.field} ${a.value[d.valueState] ?? ""}`.toLocaleLowerCase().includes(v)));
2016
+ }), l = D(() => r.value.slice(0, 100));
2017
+ return (i, d) => e.entries.length ? (w(), P("details", Qr, [
2018
+ p("summary", null, [
2019
+ Q(ae, {
2020
+ name: "file",
2021
+ size: 14
2022
+ }),
2023
+ p("span", null, y(e.messages.dataExplanation), 1),
2024
+ p("b", null, y(e.entries.length), 1),
2025
+ p("small", null, y(e.messages.dataExplanationHint), 1),
2026
+ Q(ae, {
2027
+ name: "chevron-down",
2028
+ size: 12
2029
+ })
2030
+ ]),
2031
+ p("div", _r, [
2032
+ p("label", null, [
2033
+ Q(ae, {
2034
+ name: "search",
2035
+ size: 15
2036
+ }),
2037
+ Rt(p("input", {
2038
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => o.value = v),
2039
+ type: "search",
2040
+ "aria-label": e.messages.dataExplanationSearch,
2041
+ placeholder: e.messages.dataExplanationSearch
2042
+ }, null, 8, el), [
2043
+ [Mt, o.value]
2044
+ ])
2045
+ ]),
2046
+ p("ul", null, [
2047
+ (w(!0), P(ge, null, be(l.value, (v, m) => (w(), P("li", { key: m }, [
2048
+ p("div", null, [
2049
+ p("span", tl, y(a.value[v.valueState]), 1),
2050
+ p("code", null, [
2051
+ ie(y(v.target?.datasetId) + " · " + y(v.target?.field) + " ", 1),
2052
+ v.target?.rowKey !== void 0 ? (w(), P(ge, { key: 0 }, [
2053
+ ie(" · " + y(v.target.rowKey), 1)
2054
+ ], 64)) : N("", !0)
2055
+ ]),
2056
+ p("p", null, y(v.message), 1)
2057
+ ]),
2058
+ v.target ? (w(), P("button", {
2059
+ key: 0,
2060
+ type: "button",
2061
+ disabled: e.busy,
2062
+ onClick: (f) => s("locate", v.target)
2063
+ }, [
2064
+ ie(y(e.messages.diagnosticsLocate), 1),
2065
+ Q(ae, {
2066
+ name: "arrow-right",
2067
+ size: 13
2068
+ })
2069
+ ], 8, nl)) : N("", !0)
2070
+ ]))), 128))
2071
+ ]),
2072
+ r.value.length ? N("", !0) : (w(), P("p", al, y(e.messages.dataExplanationEmpty), 1)),
2073
+ r.value.length > l.value.length ? (w(), P("small", sl, y((e.messages.diagnosticsMore ?? "").replace("{count}", String(r.value.length))), 1)) : N("", !0)
2074
+ ])
2075
+ ])) : N("", !0);
2076
+ }
2077
+ }), rl = /* @__PURE__ */ we(ol, [["__scopeId", "data-v-cb0adb4c"]]), ll = ["aria-label"], il = ["disabled", "title", "onClick"], ul = {
2078
+ key: 0,
2079
+ role: "status"
2080
+ }, cl = {
2081
+ key: 1,
2082
+ role: "alert"
2083
+ }, dl = {
2084
+ key: 2,
2085
+ role: "status"
2086
+ }, fl = /* @__PURE__ */ ye({
2087
+ __name: "ReportDrillActions",
2088
+ props: {
2089
+ entries: {},
2090
+ pending: { type: Boolean },
2091
+ busy: { type: Boolean },
2092
+ error: {},
2093
+ messages: {}
2094
+ },
2095
+ emits: ["open"],
2096
+ setup(e, { emit: t }) {
2097
+ const n = t;
2098
+ return (s, o) => e.entries.length ? (w(), P("div", {
2099
+ key: 0,
2100
+ class: "mrp-drill-actions",
2101
+ role: "group",
2102
+ "aria-label": e.messages.drillActions
2103
+ }, [
2104
+ p("span", null, y(e.messages.drillActions), 1),
2105
+ (w(!0), P(ge, null, be(e.entries, (a) => (w(), P("button", {
2106
+ key: a.action.id,
2107
+ type: "button",
2108
+ disabled: e.busy || e.pending || !!a.reason,
2109
+ title: a.reason,
2110
+ onClick: (r) => n("open", a.action.id)
2111
+ }, [
2112
+ ie(y(a.action.label), 1),
2113
+ Q(ae, {
2114
+ name: "arrow-right",
2115
+ size: 13
2116
+ })
2117
+ ], 8, il))), 128)),
2118
+ e.pending ? (w(), P("small", ul, y(e.messages.drillOpening), 1)) : e.error ? (w(), P("small", cl, y(e.error), 1)) : e.entries.every((a) => a.reason) ? (w(), P("small", dl, y(e.messages.drillMissingValue), 1)) : N("", !0)
2119
+ ], 8, ll)) : N("", !0);
2120
+ }
2121
+ }), ml = /* @__PURE__ */ we(fl, [["__scopeId", "data-v-f9ff8c13"]]);
2122
+ function gl(e) {
2123
+ const t = G(!1), n = G("");
2124
+ let s;
2125
+ const o = D(() => {
2126
+ const l = e.plan.value, i = e.selection.value?.focus, d = e.options();
2127
+ if (!l || !i || !d) return [];
2128
+ try {
2129
+ return ls(l, i, d.actions).map((v) => {
2130
+ try {
2131
+ return qn(l, i, v, e.params()), { action: v };
2132
+ } catch {
2133
+ return { action: v, reason: e.messages().drillMissingValue };
2134
+ }
2135
+ });
2136
+ } catch {
2137
+ return [];
2138
+ }
2139
+ });
2140
+ function a() {
2141
+ s?.abort(), s = void 0, t.value = !1, n.value = "";
2142
+ }
2143
+ de([e.plan, () => e.options()], a), Ke(a);
2144
+ async function r(l) {
2145
+ if (t.value || e.busy()) return;
2146
+ const i = e.plan.value, d = e.selection.value?.focus, v = e.options(), m = v?.actions.find(($) => $.id === l);
2147
+ if (!i || !d || !v || !m) return;
2148
+ const f = new AbortController();
2149
+ s = f, t.value = !0, n.value = "";
2150
+ try {
2151
+ const $ = qn(i, d, m, e.params()), k = Object.freeze(e.view());
2152
+ if (!await e.beforeOpen() || f.signal.aborted || e.plan.value !== i) return;
2153
+ await Be(v.open({ ...$, signal: f.signal, view: k }), f.signal);
2154
+ } catch ($) {
2155
+ f.signal.aborted || (n.value = $ instanceof is ? e.messages().drillMissingValue ?? "" : e.messages().drillFailed ?? "");
2156
+ } finally {
2157
+ s === f && (t.value = !1, s = void 0);
2158
+ }
2159
+ }
2160
+ return { entries: o, pending: t, error: n, open: r };
2161
+ }
2162
+ const vl = { class: "mrp-print-settings" }, pl = ["value", "disabled"], hl = ["value", "disabled"], bl = ["disabled"], yl = /* @__PURE__ */ ye({
2163
+ __name: "ReportPrintSettings",
2164
+ props: {
2165
+ value: {},
2166
+ messages: {},
2167
+ busy: { type: Boolean },
2168
+ canTest: { type: Boolean }
2169
+ },
2170
+ emits: ["change", "test"],
2171
+ setup(e, { emit: t }) {
2172
+ const n = e, s = t;
2173
+ function o(a, r) {
2174
+ const l = r.target, i = Number(l.value);
2175
+ if (!l.value.trim() || !Number.isFinite(i) || Math.abs(i) > 20) {
2176
+ l.value = String(n.value[a] ?? 0);
2177
+ return;
2178
+ }
2179
+ s("change", { ...n.value, [a]: i });
2180
+ }
2181
+ return (a, r) => (w(), P("details", vl, [
2182
+ p("summary", null, y(e.messages.printCalibration), 1),
2183
+ p("p", null, y(e.messages.printCalibrationHint), 1),
2184
+ p("div", null, [
2185
+ p("label", null, [
2186
+ ie(y(e.messages.printOffsetX) + " ", 1),
2187
+ p("input", {
2188
+ type: "number",
2189
+ min: "-20",
2190
+ max: "20",
2191
+ step: ".1",
2192
+ value: e.value.offsetXmm ?? 0,
2193
+ disabled: e.busy,
2194
+ onChange: r[0] || (r[0] = (l) => o("offsetXmm", l))
2195
+ }, null, 40, pl)
2196
+ ]),
2197
+ p("label", null, [
2198
+ ie(y(e.messages.printOffsetY) + " ", 1),
2199
+ p("input", {
2200
+ type: "number",
2201
+ min: "-20",
2202
+ max: "20",
2203
+ step: ".1",
2204
+ value: e.value.offsetYmm ?? 0,
2205
+ disabled: e.busy,
2206
+ onChange: r[1] || (r[1] = (l) => o("offsetYmm", l))
2207
+ }, null, 40, hl)
2208
+ ])
2209
+ ]),
2210
+ p("button", {
2211
+ type: "button",
2212
+ disabled: e.busy || !e.canTest,
2213
+ onClick: r[2] || (r[2] = (l) => s("test"))
2214
+ }, y(e.messages.printCalibrationTest), 9, bl)
2215
+ ]));
2216
+ }
2217
+ }), wl = /* @__PURE__ */ we(yl, [["__scopeId", "data-v-35a0f5ec"]]);
2218
+ function xl(e, t) {
2219
+ if (![e, t].every((r) => Number.isFinite(r) && r >= 25 && r <= 600)) throw new RangeError("Calibration paper must be between 25 and 600 mm");
2220
+ const n = [], s = Math.min(10, e / 5), o = Math.min(10, t / 5), a = Math.min(50, e - s * 2, t - o * 2);
2221
+ n.push({ kind: "rect", leftMm: s, topMm: o, widthMm: a, heightMm: a, style: { borderColor: "#255c8c", lineWidthPt: 0.5 } });
2222
+ for (let r = 0; r <= a; r += 5)
2223
+ n.push({ kind: "line", leftMm: s + r, topMm: o, widthMm: 0, heightMm: r % 10 ? 2 : 3, style: { lineColor: "#255c8c", lineWidthPt: 0.5 } }), n.push({ kind: "line", leftMm: s, topMm: o + r, widthMm: r % 10 ? 2 : 3, heightMm: 0, style: { lineColor: "#255c8c", lineWidthPt: 0.5 } });
2224
+ return n.push({ kind: "text", text: `${a} x ${a} mm`, leftMm: s + 4, topMm: o + a / 2 - 2, widthMm: a - 8, heightMm: 4, style: { fontSize: 7, align: "center", color: "#255c8c" } }), { schemaVersion: "print-calibration", pages: [{ pageWidthMm: e, pageHeightMm: t, components: n }] };
2225
+ }
2226
+ const Wn = /* @__PURE__ */ new Map(), nt = /* @__PURE__ */ new Map(), kl = 15e3;
2227
+ function nn(e, t) {
2228
+ return Object.assign(new Error(e), { cause: t });
2229
+ }
2230
+ function gt(e, t) {
2231
+ return `PDF 字体 ${JSON.stringify(e)}:${t}。请部署支持报表文字的字体文件,并将 pdfFontUrl 配置为可访问的字体 URL;西文报表可设为空串`;
2232
+ }
2233
+ function St(e) {
2234
+ if (e?.reason instanceof Error && e.reason.name === "AbortError") return e.reason;
2235
+ const t = nn("PDF 字体检查已取消", e?.reason);
2236
+ return t.name = "AbortError", t;
2237
+ }
2238
+ async function $l(e, t) {
2239
+ let n = !1;
2240
+ const s = setTimeout(() => {
2241
+ n = !0, t.abort();
2242
+ }, kl);
2243
+ try {
2244
+ const o = await fetch(e, { method: "HEAD", signal: t.signal });
2245
+ if (t.signal.aborted) throw St(t.signal);
2246
+ if (o.status === 405 || o.status === 501 || o.type === "opaque")
2247
+ return {
2248
+ status: "unverified",
2249
+ fontUrl: e,
2250
+ message: `PDF 字体 ${JSON.stringify(e)} 无法通过 HEAD 检查验证;仍可尝试导出,届时会加载并校验字体`
2251
+ };
2252
+ if (!o.ok) {
2253
+ const r = new Error(`字体请求返回 HTTP ${o.status}`);
2254
+ return { status: "error", fontUrl: e, message: gt(e, r.message), cause: r };
2255
+ }
2256
+ const a = o.headers.get("content-type") ?? "";
2257
+ if (/text\/html|application\/xhtml\+xml/i.test(a)) {
2258
+ const r = new Error("字体 URL 返回 HTML 页面(可能是 SPA 路由回退),不是字体文件");
2259
+ return { status: "error", fontUrl: e, message: gt(e, r.message), cause: r };
2260
+ }
2261
+ if (/^text\//i.test(a) || /(?:\/|\+)json(?:\s*;|$)/i.test(a)) {
2262
+ const r = new Error(`字体 URL 返回 ${a} 文本响应,不是字体文件`);
2263
+ return { status: "error", fontUrl: e, message: gt(e, r.message), cause: r };
2264
+ }
2265
+ return {
2266
+ status: "available",
2267
+ fontUrl: e,
2268
+ message: "PDF 字体资源可达;文字覆盖范围将在实际导出时校验"
2269
+ };
2270
+ } catch (o) {
2271
+ if (t.signal.aborted && !n) throw St(t.signal);
2272
+ return {
2273
+ status: "error",
2274
+ fontUrl: e,
2275
+ message: gt(e, n ? "字体检查超时,请检查网络或字体服务" : "字体检查失败,请检查网络、字体服务或跨域访问配置"),
2276
+ cause: o
2277
+ };
2278
+ } finally {
2279
+ clearTimeout(s);
2280
+ }
2281
+ }
2282
+ function Cl(e, t) {
2283
+ if (t?.aborted) return Promise.reject(St(t));
2284
+ if (!e)
2285
+ return Promise.resolve({ status: "disabled", fontUrl: e, message: "已停用自定义 PDF 字体;内置字体用于西文,其他文字会在导出时校验" });
2286
+ const n = Wn.get(e);
2287
+ if (n) return Promise.resolve(n);
2288
+ let s = nt.get(e);
2289
+ if (!s) {
2290
+ const a = new AbortController();
2291
+ s = { controller: a, promise: $l(e, a), subscribers: 0 };
2292
+ const r = s;
2293
+ nt.set(e, r), r.promise = r.promise.then((l) => (!a.signal.aborted && l.status === "available" && Wn.set(e, l), l)).finally(() => {
2294
+ nt.get(e) === r && nt.delete(e);
2295
+ });
2296
+ }
2297
+ const o = s;
2298
+ return o.subscribers++, new Promise((a, r) => {
2299
+ let l = !1;
2300
+ const i = () => l ? !1 : (l = !0, o.subscribers--, t?.removeEventListener("abort", d), !0), d = () => {
2301
+ i() && (o.subscribers === 0 && (nt.get(e) === o && nt.delete(e), o.controller.abort()), r(St(t)));
2302
+ };
2303
+ t?.addEventListener("abort", d, { once: !0 }), o.promise.then(
2304
+ (v) => {
2305
+ i() && a(v);
2306
+ },
2307
+ (v) => {
2308
+ i() && r(v);
2309
+ }
2310
+ ), t?.aborted && d();
2311
+ });
2312
+ }
2313
+ function El(e = { fontUrl: "/simhei.ttf" }) {
2314
+ let t = null;
2315
+ const n = async (s, o, a = {}) => {
2316
+ xe(a.signal), t || (t = await import("@agile-team/mach-report/pdf")), xe(a.signal);
2317
+ let r = null;
2318
+ if (e.fontUrl)
2319
+ try {
2320
+ if (r = await Be(t.loadFontWithCache(e.fontUrl, { strict: !0, signal: a.signal }), a.signal), !r?.byteLength) throw new Error("字体文件为空或加载失败");
2321
+ } catch (f) {
2322
+ const $ = f instanceof Error ? f.message : String(f);
2323
+ throw nn(gt(e.fontUrl, $), f);
2324
+ }
2325
+ let l;
2326
+ try {
2327
+ xe(a.signal), l = await t.renderPlanToPdf(s, { ...a, ...r ? { customFontBytes: r } : {} });
2328
+ } catch (f) {
2329
+ if (!r) throw f;
2330
+ const $ = f instanceof Error ? f.message : String(f);
2331
+ throw nn(`PDF 生成失败:${$}。当前字体 URL 为 ${JSON.stringify(e.fontUrl)};请确认该文件是有效字体,或重新配置 pdfFontUrl`, f);
2332
+ }
2333
+ xe(a.signal), l.diagnostics?.forEach((f) => {
2334
+ try {
2335
+ a.onDiagnostic?.(f);
2336
+ } catch {
2337
+ }
2338
+ });
2339
+ const { bytes: i, unsupportedTextCount: d, pageErrors: v, fidelityWarnings: m } = l;
2340
+ if (d > 0)
2341
+ throw new Error(`PDF 中有 ${d} 行文字无法编码;请部署支持所用文字的字体并配置 pdfFontUrl`);
2342
+ if (v.length > 0)
2343
+ throw new Error(`PDF 有 ${v.length} 页渲染失败:${v[0]}`);
2344
+ return m.length > 0 && o?.(`PDF 有 ${m.length} 处版式降级:${m.slice(0, 2).join(";")}`), i;
2345
+ };
2346
+ return n.checkFont = (s) => Cl(e.fontUrl, s), n;
2347
+ }
2348
+ function Il(e) {
2349
+ const t = fe(Object.freeze({ status: "unchecked", fontUrl: "" }));
2350
+ let n = null, s = null, o = 0, a = null;
2351
+ function r() {
2352
+ if (e.injectedExporter) return e.injectedExporter;
2353
+ const v = e.fontUrl();
2354
+ return (!s || n !== v) && (n = v, s = El({ fontUrl: v })), s;
2355
+ }
2356
+ function l() {
2357
+ o++, a?.abort(), a = null;
2358
+ }
2359
+ async function i() {
2360
+ if (e.destroyed()) throw new ot("config", "报表预览已卸载");
2361
+ l();
2362
+ const v = o, m = new AbortController();
2363
+ a = m;
2364
+ const f = e.fontUrl();
2365
+ t.value = Object.freeze({ status: "checking", fontUrl: f });
2366
+ try {
2367
+ const $ = r(), k = $.checkFont ? await $.checkFont(m.signal) : { status: "unverified", fontUrl: "", message: "自定义 PDF 导出器未提供字体预检查;字体由宿主确认" };
2368
+ return !e.destroyed() && v === o && !m.signal.aborted && (t.value = Object.freeze({ ...k })), k;
2369
+ } catch ($) {
2370
+ if (m.signal.aborted) throw $;
2371
+ const k = { status: "error", fontUrl: f, message: $ instanceof Error ? $.message : "PDF 字体检查失败", cause: $ };
2372
+ return !e.destroyed() && v === o && (t.value = Object.freeze(k)), k;
2373
+ } finally {
2374
+ a === m && (a = null);
2375
+ }
2376
+ }
2377
+ function d() {
2378
+ i().catch(() => {
2379
+ });
2380
+ }
2381
+ return de([e.plan, D(e.fontUrl), D(e.enabled)], () => {
2382
+ const v = t.value.fontUrl === e.fontUrl();
2383
+ v && t.value.status === "available" || (l(), (!v || t.value.status === "checking") && (t.value = Object.freeze({ status: "unchecked", fontUrl: e.fontUrl() })), !e.destroyed() && e.plan.value?.pages.length && e.enabled() && d());
2384
+ }, { immediate: !0 }), { pdfFont: t, getPdfExporter: r, checkPdfFont: i, retryPdfFont: d, cancelFontCheck: l };
2385
+ }
2386
+ function Pl(e) {
2387
+ const t = fe(null), n = fe(!1);
2388
+ let s = 0, o = null;
2389
+ function a(i) {
2390
+ const d = o;
2391
+ o = null, t.value = null, n.value = !1, d?.(i);
2392
+ }
2393
+ function r() {
2394
+ s++, a(!1);
2395
+ }
2396
+ async function l(i) {
2397
+ if (r(), !e.enabled() || !e.pending()) return !0;
2398
+ const d = s, v = [...e.snapshot?.() ?? []];
2399
+ n.value = !0;
2400
+ const m = Object.freeze({ reason: i, reportIds: Object.freeze([...e.reportIds()]), pendingLocalChanges: !0 });
2401
+ try {
2402
+ const f = e.hook(), $ = await new Promise((b) => {
2403
+ if (o = b, !f) {
2404
+ t.value = m;
2405
+ return;
2406
+ }
2407
+ Promise.resolve().then(() => f(m)).then((g) => {
2408
+ d === s && a(g === !0);
2409
+ }, (g) => {
2410
+ if (d === s) {
2411
+ try {
2412
+ e.error(g);
2413
+ } catch {
2414
+ }
2415
+ a(!1);
2416
+ }
2417
+ });
2418
+ }), k = e.snapshot?.() ?? [];
2419
+ return d === s && $ === !0 && k.length === v.length && v.every((b, g) => Object.is(b, k[g]));
2420
+ } catch (f) {
2421
+ if (d === s) {
2422
+ try {
2423
+ e.error(f);
2424
+ } catch {
2425
+ }
2426
+ a(!1);
2427
+ }
2428
+ return !1;
2429
+ }
2430
+ }
2431
+ return { request: t, pending: n, check: l, settle: a, cancel: r };
2432
+ }
2433
+ let Sl = 0;
2434
+ function Rl(e) {
2435
+ const t = fe(null), n = /* @__PURE__ */ new Set();
2436
+ let s = null;
2437
+ function o(i) {
2438
+ t.value = Object.freeze(i);
2439
+ try {
2440
+ e(t.value);
2441
+ } catch {
2442
+ }
2443
+ }
2444
+ function a(i, d, v) {
2445
+ const m = `mr-task-${Date.now().toString(36)}-${++Sl}`;
2446
+ n.add(m), s = v, o({ taskId: m, kind: i, stage: d, status: "running", cancellable: !0 });
2447
+ function f(k, b, g) {
2448
+ t.value?.taskId !== m || t.value.status !== "running" || o({ ...t.value, stage: k, completed: b, total: g });
2449
+ }
2450
+ function $(k = "completed") {
2451
+ t.value?.taskId !== m || t.value.status !== "running" || (s = null, o({ ...t.value, status: k, cancellable: !1 }));
2452
+ }
2453
+ return { taskId: m, update: f, finish: $ };
2454
+ }
2455
+ function r() {
2456
+ if (t.value?.status !== "running") return;
2457
+ const i = s;
2458
+ s = null, o({ ...t.value, status: "cancelled", cancellable: !1 }), i?.();
2459
+ }
2460
+ function l(i, d) {
2461
+ t.value?.taskId !== i.taskId && (i.status !== "running" || n.has(i.taskId)) || (n.add(i.taskId), n.size > 100 && n.delete(n.values().next().value), s = i.status === "running" ? d : null, o({ ...i }));
2462
+ }
2463
+ return { state: t, start: a, cancel: r, receive: l };
2464
+ }
2465
+ function Ml(e) {
2466
+ const t = fe(Object.freeze([])), n = /* @__PURE__ */ new Set();
2467
+ let s = 0;
2468
+ function o() {
2469
+ s++, t.value = Object.freeze([]), n.clear();
2470
+ }
2471
+ function a(i) {
2472
+ const d = s, v = [];
2473
+ for (const m of i) {
2474
+ const f = JSON.stringify([m.code, m.format, m.pageIndex, m.componentIndex, m.componentPath, m.path, m.message, m.valueState, m.target]);
2475
+ if (n.has(f)) continue;
2476
+ n.add(f);
2477
+ const $ = Object.freeze({ ...m, ...m.target ? { target: Object.freeze({ ...m.target }) } : {}, ...m.componentPath ? { componentPath: Object.freeze([...m.componentPath]) } : {} });
2478
+ v.push($);
2479
+ }
2480
+ v.length && (t.value = Object.freeze([...t.value, ...v]));
2481
+ for (const m of v) {
2482
+ if (d !== s) break;
2483
+ try {
2484
+ e(m);
2485
+ } catch {
2486
+ }
2487
+ }
2488
+ }
2489
+ function r(i) {
2490
+ a([i]);
2491
+ }
2492
+ function l(i, d) {
2493
+ const v = Za(i, d);
2494
+ return a(v), v;
2495
+ }
2496
+ return { entries: t, reset: o, add: r, addMany: a, inspect: l };
2497
+ }
2498
+ const Tl = { class: "mrp-edit-bar" }, Ol = ["disabled"], Dl = ["disabled"], Al = { class: "mrp-changes" }, Fl = ["aria-label"], zl = { key: 0 }, Ll = { key: 1 }, Nl = ["onClick"], ql = ["title"], Bl = ["title"], Kl = ["disabled"], jl = {
2499
+ key: 0,
2500
+ role: "status"
2501
+ }, Hl = {
2502
+ key: 1,
2503
+ role: "status"
2504
+ }, Wl = {
2505
+ key: 2,
2506
+ class: "mrp-conflicts",
2507
+ open: ""
2508
+ }, Ul = /* @__PURE__ */ ye({
2509
+ __name: "ReportEditBar",
2510
+ props: {
2511
+ differences: {},
2512
+ conflicts: {},
2513
+ messages: {},
2514
+ saving: { type: Boolean },
2515
+ canUndo: { type: Boolean },
2516
+ canRedo: { type: Boolean },
2517
+ busy: { type: Boolean },
2518
+ persisted: { type: Boolean }
2519
+ },
2520
+ emits: ["undo", "redo", "restore", "locate"],
2521
+ setup(e) {
2522
+ function t(n) {
2523
+ return n.source ? `${n.source.rowKey} · ${n.source.field}` : `${n.address.pageIndex + 1} / ${n.address.rowIndex + 1}:${n.address.columnIndex + 1}`;
2524
+ }
2525
+ return (n, s) => (w(), P("div", Tl, [
2526
+ p("button", {
2527
+ type: "button",
2528
+ disabled: e.busy || e.saving || !e.canUndo,
2529
+ onClick: s[0] || (s[0] = (o) => n.$emit("undo"))
2530
+ }, y(e.messages.undo), 9, Ol),
2531
+ p("button", {
2532
+ type: "button",
2533
+ disabled: e.busy || e.saving || !e.canRedo,
2534
+ onClick: s[1] || (s[1] = (o) => n.$emit("redo"))
2535
+ }, y(e.messages.redo), 9, Dl),
2536
+ p("details", Al, [
2537
+ p("summary", null, y(e.messages.changes) + " · " + y(e.messages.changesCount?.replace("{count}", String(e.differences.length))), 1),
2538
+ p("section", {
2539
+ "aria-label": e.messages.changes
2540
+ }, [
2541
+ e.differences.length ? (w(), P("ol", Ll, [
2542
+ (w(!0), P(ge, null, be(e.differences, (o, a) => (w(), P("li", { key: a }, [
2543
+ p("button", {
2544
+ type: "button",
2545
+ onClick: (r) => n.$emit("locate", o)
2546
+ }, y(t(o)), 9, Nl),
2547
+ p("span", null, [
2548
+ p("s", {
2549
+ title: e.messages.changesBefore
2550
+ }, y(o.previousText || "∅"), 9, ql),
2551
+ s[3] || (s[3] = ie(" → ", -1)),
2552
+ p("strong", {
2553
+ title: e.messages.changesAfter
2554
+ }, y(o.text || "∅"), 9, Bl)
2555
+ ])
2556
+ ]))), 128))
2557
+ ])) : (w(), P("p", zl, y(e.messages.changesEmpty), 1))
2558
+ ], 8, Fl)
2559
+ ]),
2560
+ p("button", {
2561
+ type: "button",
2562
+ disabled: e.busy || e.saving || !e.differences.length,
2563
+ onClick: s[2] || (s[2] = (o) => n.$emit("restore"))
2564
+ }, y(e.messages.restoreChanges), 9, Kl),
2565
+ e.saving ? (w(), P("span", jl, y(e.messages.saving), 1)) : e.differences.length && !e.conflicts.length ? (w(), P("span", Hl, y(e.persisted ? e.messages.editSaved : e.messages.editingLocal), 1)) : N("", !0),
2566
+ e.conflicts.length ? (w(), P("details", Wl, [
2567
+ p("summary", null, y(e.messages.conflicts) + " · " + y(e.conflicts.length), 1),
2568
+ p("ul", null, [
2569
+ (w(!0), P(ge, null, be(e.conflicts, (o, a) => (w(), P("li", { key: a }, y(o.message), 1))), 128))
2570
+ ])
2571
+ ])) : N("", !0)
2572
+ ]));
2573
+ }
2574
+ }), Vl = /* @__PURE__ */ we(Ul, [["__scopeId", "data-v-df1c7b86"]]);
2575
+ function Jl(e) {
2576
+ const t = e.table?.columnKeys ?? [], n = t.map(() => []);
2577
+ if (!e.grid) return t;
2578
+ for (const { ci: s, cell: o } of dn(e.grid, e.widthMm, e.heightMm).cells) {
2579
+ const a = (o.text ?? o.rawText ?? "").trim();
2580
+ if (a)
2581
+ for (let r = s; r < Math.min(t.length, s + (o.colSpan ?? 1)); r++)
2582
+ n[r].includes(a) || n[r].push(a);
2583
+ }
2584
+ return t.map((s, o) => n[o].join(" / ") || s);
2585
+ }
2586
+ function Gl(e, t = []) {
2587
+ const n = /* @__PURE__ */ new Set(), s = [];
2588
+ for (const [o, a] of (e?.pages ?? []).entries())
2589
+ for (const r of a.components) {
2590
+ const l = r.table;
2591
+ if (!l || l.role !== "header" || n.has(l.id)) continue;
2592
+ n.add(l.id);
2593
+ const i = Jl(r), d = t.filter(($) => $.pageIndex <= o), v = d[d.length - 1]?.label, m = l.source?.datasetId, f = [...new Set([v, l.title, m].filter(Boolean))].join(" · ") || l.id;
2594
+ l.columnKeys.forEach(($, k) => {
2595
+ $ && s.push({ key: JSON.stringify([l.id, k]), field: $, label: i[k], group: f, pageIndex: o, tableId: l.id, ...m ? { datasetId: m } : {} });
2596
+ });
2597
+ }
2598
+ return s;
2599
+ }
2600
+ function Yl(e, t) {
2601
+ const n = t.trim().toLocaleLowerCase().split(/\s+/).filter(Boolean);
2602
+ return e.filter((s) => {
2603
+ const o = `${s.label} ${s.field} ${s.group}`.toLocaleLowerCase();
2604
+ return n.every((a) => o.includes(a));
2605
+ });
2606
+ }
2607
+ function Zl(e) {
2608
+ const t = _n(), n = G(""), s = G(0), o = `mrp-column-list-${rn()?.uid ?? 0}`, a = D(() => Gl(e.plan(), e.sections())), r = D(() => Yl(a.value, n.value)), l = D(() => r.value.slice(0, 100)), i = D(() => [...new Set(l.value.map((k) => k.group))].map((k) => ({ label: k, items: l.value.filter((b) => b.group === k) })));
2609
+ de(n, () => {
2610
+ s.value = 0;
2611
+ }), de(e.busy, (k) => {
2612
+ k && t.close();
2613
+ }), de(a, () => {
2614
+ s.value = 0;
2615
+ });
2616
+ function d(k) {
2617
+ e.busy() || (e.locate(k), t.close(!0));
2618
+ }
2619
+ function v() {
2620
+ if (e.busy()) return;
2621
+ const k = l.value[s.value];
2622
+ k ? d(k) : n.value.trim() && (e.locateField(n.value.trim()), t.close(!0));
2623
+ }
2624
+ function m() {
2625
+ n.value = "", t.panel.value?.querySelector("input")?.focus();
2626
+ }
2627
+ function f(k) {
2628
+ if (!(k.isComposing || k.keyCode === 229 || !["ArrowDown", "ArrowUp", "Enter"].includes(k.key))) {
2629
+ if (k.preventDefault(), k.stopPropagation(), k.key === "Enter") {
2630
+ v();
2631
+ return;
2632
+ }
2633
+ l.value.length && (s.value = (s.value + (k.key === "ArrowDown" ? 1 : -1) + l.value.length) % l.value.length, Ge(() => t.panel.value?.querySelector(`[id="${o}-${s.value}"]`)?.scrollIntoView?.({ block: "nearest" })));
2634
+ }
2635
+ }
2636
+ function $(k) {
2637
+ return l.value.findIndex((b) => b.key === k);
2638
+ }
2639
+ return { ...t, field: n, active: s, listId: o, directory: a, matches: r, candidates: l, groups: i, choose: d, submit: v, clear: m, onSearchKeydown: f, candidateIndex: $ };
2640
+ }
2641
+ const Xl = ["aria-label"], Ql = {
2642
+ key: 0,
2643
+ class: "mrp-section-tabs"
2644
+ }, _l = ["aria-current", "disabled", "onClick"], ei = ["aria-expanded", "disabled"], ti = {
2645
+ key: 0,
2646
+ class: "mrp-column-count"
2647
+ }, ni = ["aria-label"], ai = { class: "mrp-column-heading" }, si = ["aria-label"], oi = ["aria-label", "placeholder", "aria-controls", "aria-activedescendant", "disabled"], ri = ["aria-label"], li = ["id", "aria-label"], ii = {
2648
+ key: 0,
2649
+ class: "mrp-column-empty",
2650
+ role: "status"
2651
+ }, ui = ["aria-label"], ci = ["id", "aria-selected", "disabled", "onPointermove", "onClick"], di = ["title"], fi = {
2652
+ class: "mrp-column-help",
2653
+ role: "status"
2654
+ }, mi = /* @__PURE__ */ ye({
2655
+ __name: "ReportNavigation",
2656
+ props: {
2657
+ sections: {},
2658
+ currentPage: {},
2659
+ messages: {},
2660
+ busy: { type: Boolean },
2661
+ plan: {},
2662
+ compact: { type: Boolean }
2663
+ },
2664
+ emits: ["goto", "locate", "locate-target"],
2665
+ setup(e, { emit: t }) {
2666
+ const n = e, s = t, o = Zl({ plan: () => n.plan, sections: () => n.sections, busy: () => n.busy, locate: (z) => s("locate-target", z), locateField: (z) => s("locate", z) }), { root: a, trigger: r, panel: l, opened: i, field: d, active: v, directory: m, matches: f, candidates: $, groups: k, listId: b } = o, g = D(() => m.value.length > 0 || !n.plan || n.plan.pages.some((z) => z.components.some((F) => F.table?.columnKeys.length))), R = D(() => ({ columnDirectory: "字段目录", columnSearch: "搜索列名或字段", columnNoMatches: "未找到匹配字段", columnResults: "匹配字段", ...n.messages })), h = D(() => (n.messages.columnResultsMore ?? "{count} 个匹配字段,显示前 {limit} 个;继续输入可缩小范围").replace("{count}", String(f.value.length)).replace("{limit}", String($.value.length)));
2667
+ function S(z) {
2668
+ const F = n.sections[z];
2669
+ return !!F && n.currentPage >= F.pageIndex + 1 && (!n.sections[z + 1] || n.currentPage <= n.sections[z + 1].pageIndex);
2670
+ }
2671
+ return (z, F) => e.sections.length > 1 || g.value ? (w(), P("nav", {
2672
+ key: 0,
2673
+ class: Ce(["mrp-section-nav", { "mrp-compact": e.compact }]),
2674
+ "aria-label": e.messages.sections ?? "工作表与章节"
2675
+ }, [
2676
+ e.sections.length > 1 ? (w(), P("div", Ql, [
2677
+ (w(!0), P(ge, null, be(e.sections, (K, V) => (w(), P("button", {
2678
+ key: V,
2679
+ type: "button",
2680
+ class: Ce({ active: S(V) }),
2681
+ "aria-current": S(V) ? "page" : void 0,
2682
+ disabled: e.busy,
2683
+ onClick: (ee) => s("goto", K.pageIndex + 1)
2684
+ }, y(K.label), 11, _l))), 128))
2685
+ ])) : N("", !0),
2686
+ g.value ? (w(), P("div", {
2687
+ key: 1,
2688
+ ref_key: "root",
2689
+ ref: a,
2690
+ class: "mrp-column-locator",
2691
+ onKeydown: F[7] || (F[7] = //@ts-ignore
2692
+ (...K) => u(o).onKeydown && u(o).onKeydown(...K))
2693
+ }, [
2694
+ p("button", {
2695
+ ref_key: "trigger",
2696
+ ref: r,
2697
+ type: "button",
2698
+ class: Ce(["mrp-directory-trigger", { active: u(i) }]),
2699
+ "aria-expanded": u(i),
2700
+ "aria-haspopup": "dialog",
2701
+ disabled: e.busy,
2702
+ onClick: F[0] || (F[0] = (K) => i.value = !u(i))
2703
+ }, [
2704
+ Q(ae, { name: "columns" }),
2705
+ p("span", null, y(R.value.columnDirectory), 1),
2706
+ u(m).length ? (w(), P("span", ti, y(u(m).length), 1)) : N("", !0),
2707
+ Q(ae, {
2708
+ name: "chevron-down",
2709
+ size: 12
2710
+ })
2711
+ ], 10, ei),
2712
+ u(i) ? (w(), P("div", {
2713
+ key: 0,
2714
+ ref_key: "panel",
2715
+ ref: l,
2716
+ class: "mrp-column-directory",
2717
+ role: "dialog",
2718
+ "aria-label": R.value.columnDirectory
2719
+ }, [
2720
+ p("div", ai, [
2721
+ p("span", null, [
2722
+ Q(ae, { name: "columns" }),
2723
+ ie(y(R.value.columnDirectory), 1)
2724
+ ]),
2725
+ p("button", {
2726
+ type: "button",
2727
+ class: "mrp-column-close",
2728
+ "aria-label": e.messages.closeColumnDirectory ?? "关闭字段目录",
2729
+ onClick: F[1] || (F[1] = (K) => u(o).close(!0))
2730
+ }, [
2731
+ Q(ae, {
2732
+ name: "close",
2733
+ size: 15
2734
+ })
2735
+ ], 8, si)
2736
+ ]),
2737
+ p("form", {
2738
+ class: "mrp-column-search",
2739
+ onSubmit: F[5] || (F[5] = pt(
2740
+ //@ts-ignore
2741
+ (...K) => u(o).submit && u(o).submit(...K),
2742
+ ["prevent"]
2743
+ ))
2744
+ }, [
2745
+ Q(ae, { name: "search" }),
2746
+ Rt(p("input", {
2747
+ "onUpdate:modelValue": F[2] || (F[2] = (K) => Gn(d) ? d.value = K : null),
2748
+ type: "search",
2749
+ autocomplete: "off",
2750
+ spellcheck: "false",
2751
+ role: "combobox",
2752
+ "aria-label": R.value.columnSearch,
2753
+ placeholder: R.value.columnSearch,
2754
+ "aria-autocomplete": "list",
2755
+ "aria-expanded": "true",
2756
+ "aria-controls": u(b),
2757
+ "aria-activedescendant": u($).length ? `${u(b)}-${u(v)}` : void 0,
2758
+ disabled: e.busy,
2759
+ onKeydown: F[3] || (F[3] = //@ts-ignore
2760
+ (...K) => u(o).onSearchKeydown && u(o).onSearchKeydown(...K))
2761
+ }, null, 40, oi), [
2762
+ [Mt, u(d)]
2763
+ ]),
2764
+ u(d) ? (w(), P("button", {
2765
+ key: 0,
2766
+ class: "mrp-column-clear",
2767
+ type: "button",
2768
+ "aria-label": e.messages.clearSearch ?? "清除搜索",
2769
+ onClick: F[4] || (F[4] = //@ts-ignore
2770
+ (...K) => u(o).clear && u(o).clear(...K))
2771
+ }, [
2772
+ Q(ae, {
2773
+ name: "close",
2774
+ size: 13
2775
+ })
2776
+ ], 8, ri)) : N("", !0)
2777
+ ], 32),
2778
+ p("div", {
2779
+ id: u(b),
2780
+ class: "mrp-column-results",
2781
+ role: "listbox",
2782
+ "aria-label": R.value.columnResults
2783
+ }, [
2784
+ u($).length ? N("", !0) : (w(), P("p", ii, [
2785
+ Q(ae, {
2786
+ name: "search",
2787
+ size: 22
2788
+ }),
2789
+ ie(y(R.value.columnNoMatches), 1)
2790
+ ])),
2791
+ (w(!0), P(ge, null, be(u(k), (K) => (w(), P("section", {
2792
+ key: K.label,
2793
+ role: "group",
2794
+ "aria-label": K.label
2795
+ }, [
2796
+ p("strong", null, y(K.label), 1),
2797
+ (w(!0), P(ge, null, be(K.items, (V) => (w(), P("button", {
2798
+ id: `${u(b)}-${u(o).candidateIndex(V.key)}`,
2799
+ key: V.key,
2800
+ type: "button",
2801
+ role: "option",
2802
+ tabindex: "-1",
2803
+ class: Ce({ "mrp-column-active": u(o).candidateIndex(V.key) === u(v) }),
2804
+ "aria-selected": u(o).candidateIndex(V.key) === u(v),
2805
+ disabled: e.busy,
2806
+ onPointermove: (ee) => v.value = u(o).candidateIndex(V.key),
2807
+ onMousedown: F[6] || (F[6] = pt(() => {
2808
+ }, ["prevent"])),
2809
+ onClick: (ee) => u(o).choose(V)
2810
+ }, [
2811
+ p("span", null, [
2812
+ ie(y(V.label), 1),
2813
+ p("code", {
2814
+ title: V.field
2815
+ }, y(V.field), 9, di)
2816
+ ]),
2817
+ Q(ae, {
2818
+ name: "arrow-right",
2819
+ size: 14
2820
+ })
2821
+ ], 42, ci))), 128))
2822
+ ], 8, ui))), 128))
2823
+ ], 8, li),
2824
+ p("p", fi, y(u(f).length > u($).length ? h.value : e.messages.columnSearchShortcut ?? "↑ ↓ 选择 · Enter 定位"), 1)
2825
+ ], 8, ni)) : N("", !0)
2826
+ ], 544)) : N("", !0)
2827
+ ], 10, Xl)) : N("", !0);
2828
+ }
2829
+ }), Un = /* @__PURE__ */ we(mi, [["__scopeId", "data-v-b772ba8c"]]), gi = { class: "mrp-import-summary" }, vi = { key: 0 }, pi = { key: 0 }, hi = /* @__PURE__ */ ye({
2830
+ __name: "ReportImportSummary",
2831
+ props: {
2832
+ result: {},
2833
+ messages: {}
2834
+ },
2835
+ setup(e) {
2836
+ return (t, n) => (w(), P("details", gi, [
2837
+ p("summary", null, [
2838
+ ie(y(e.messages.importSummary) + " · " + y(e.messages.importPreserved?.replace("{sheets}", String(e.result.sheets.length))) + " ", 1),
2839
+ e.result.warnings.length ? (w(), P("span", vi, " · " + y(e.result.warnings.length) + " " + y(e.messages.importWarnings), 1)) : N("", !0)
2840
+ ]),
2841
+ p("p", null, y(e.messages.importReadOnly), 1),
2842
+ p("ul", null, [
2843
+ (w(!0), P(ge, null, be(e.result.sheets, (s) => (w(), P("li", {
2844
+ key: s.index
2845
+ }, y(s.name) + " · " + y(s.range) + " · " + y(s.rowCount) + " × " + y(s.columnCount), 1))), 128))
2846
+ ]),
2847
+ e.result.warnings.length ? (w(), P("ul", pi, [
2848
+ (w(!0), P(ge, null, be(e.result.warnings, (s, o) => (w(), P("li", { key: o }, y(s), 1))), 128))
2849
+ ])) : N("", !0)
2850
+ ]));
2851
+ }
2852
+ }), bi = /* @__PURE__ */ we(hi, [["__scopeId", "data-v-54f275e8"]]);
2853
+ function Oe(e) {
2854
+ return JSON.parse(JSON.stringify(e));
2855
+ }
2856
+ function ra(e, t) {
2857
+ const n = t.fields;
2858
+ if (typeof n == "function") return n(e);
2859
+ const s = e.source?.field ?? e.table?.columnKey;
2860
+ return s === void 0 || !n || !Object.prototype.hasOwnProperty.call(n, s) ? void 0 : n[s];
2861
+ }
2862
+ function Tt(e, t) {
2863
+ if (e.requiresRecalculation && (!t || !cn(e))) throw new Ae("recalculation");
2864
+ }
2865
+ async function yi(e, t, n, s) {
2866
+ const o = t.edits.every((l) => !!l.source);
2867
+ Tt(e, o);
2868
+ const a = cn(e);
2869
+ if (a && o) return a.prepareHistory(e, t.edits, t.value, n, { signal: s });
2870
+ const r = rt(e);
2871
+ return t.edits.map((l) => {
2872
+ const i = r(l);
2873
+ if (!i) throw new Ae("missing");
2874
+ return { address: i, value: l[t.value] };
2875
+ });
2876
+ }
2877
+ function wi(e, t, n) {
2878
+ const s = t.edits.every((o) => !!o.source);
2879
+ return Tt(e, s), s ? cn(e)?.prepare(e, t, { signal: n }) : void 0;
2880
+ }
2881
+ function xi(e, t) {
2882
+ const n = /* @__PURE__ */ new Map();
2883
+ return e.pages.forEach((s, o) => s.components.forEach((a, r) => {
2884
+ if (a.grid)
2885
+ for (const l of dn(a.grid, a.widthMm, a.heightMm).cells) {
2886
+ const i = t({ pageIndex: o, componentIndex: r, rowIndex: l.ri, columnIndex: l.ci });
2887
+ if (!i?.source) continue;
2888
+ const d = Je(i), v = n.get(d) ?? [];
2889
+ v.push(i), n.set(d, v);
2890
+ }
2891
+ })), n;
2892
+ }
2893
+ function rt(e) {
2894
+ const t = Et(e), n = xi(e, t);
2895
+ function s(a) {
2896
+ if (a.source) return n.get(Je(a)) ?? [];
2897
+ const r = t(a.address);
2898
+ return r ? !a.table || Je(r) === Je(a) ? [r] : [] : [];
2899
+ }
2900
+ const o = (a) => {
2901
+ const r = s(a), l = r.find((i) => i.table?.id === a.table?.id) ?? r[0];
2902
+ return l ? { ...l.address } : null;
2903
+ };
2904
+ return o.all = (a) => s(a).map((r) => ({ ...r.address })), o;
2905
+ }
2906
+ class ki extends Error {
2907
+ constructor(t) {
2908
+ super(t.map((n) => n.message).join(";")), this.conflicts = t, this.name = "ReportEditConflictError";
2909
+ }
2910
+ }
2911
+ function $i() {
2912
+ return globalThis.crypto?.randomUUID?.() ?? `mr-${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
2913
+ }
2914
+ function Ci(e, t, n, s) {
2915
+ return Array.isArray(t) ? { batch: tn(e, t, n) } : yi(e, t, n, s).then((o) => Array.isArray(o) ? { batch: tn(e, o, n) } : o);
2916
+ }
2917
+ function Ei(e) {
2918
+ const t = fe([]), n = fe([]), s = fe([]), o = fe([]), a = fe(!1), r = fe(null), l = fe([]), i = D(() => l.value.length > 0), d = D(() => {
2919
+ const x = Nn(t.value), M = e.plan.value;
2920
+ if (!M || !x.length) return x;
2921
+ const A = rt(M);
2922
+ return x.map((q) => {
2923
+ const J = A(q);
2924
+ return J ? { ...q, address: J } : q;
2925
+ });
2926
+ }), v = D(() => !!e.options.value && !a.value && !e.blocked() && n.value.length > 0), m = D(() => !!e.options.value && !a.value && !e.blocked() && s.value.length > 0);
2927
+ let f = null, $ = null, k = 0, b = null;
2928
+ function g() {
2929
+ f?.abort(), f = null, a.value = !1, $ = null;
2930
+ }
2931
+ function R() {
2932
+ k++, g(), b = null, t.value = [], n.value = [], s.value = [], o.value = [], l.value = [], r.value = null;
2933
+ }
2934
+ function h() {
2935
+ const x = e.options.value;
2936
+ return x ? typeof x == "object" ? x : {} : null;
2937
+ }
2938
+ function S(x, M, A, q) {
2939
+ if (!e.options.value || e.blocked()) throw new Ae("readonly");
2940
+ Tt(x, M.edits.every((X) => !!X.source));
2941
+ const J = Et(x), U = new Map(q?.map((X) => [Je(X), X]));
2942
+ for (const X of M.edits) {
2943
+ const Y = q ? U.get(Je(X)) : J(X.address);
2944
+ if (!Y?.editable || A.canEdit?.(Y) === !1) throw new Ae("readonly");
2945
+ if (A.requireSource && !Y.source) throw new Ae("missing");
2946
+ const se = ra(Y, A);
2947
+ se && Xa(Y, X.value, se);
2948
+ }
2949
+ }
2950
+ async function z(x, M, A) {
2951
+ if (M.saveBatch) return M.saveBatch(Oe(x), A);
2952
+ if (M.save && x.edits.length > 1) throw new Ae("atomic");
2953
+ if (x.edits[0]) return M.save?.(Oe(x.edits[0]), A);
2954
+ }
2955
+ async function F(x, M, A) {
2956
+ for (const q of x.edits) {
2957
+ const J = await M.validate?.(Oe(q), A);
2958
+ if (J) throw new Error(J);
2959
+ if (A.signal.aborted) return;
2960
+ }
2961
+ }
2962
+ function K(x, M, A, q, J, U) {
2963
+ if (e.plan.value = U ? U.commit(A) : Qa(_a(x, M), M, A), t.value = [...t.value, ...M.edits], J) {
2964
+ const Y = new Set(M.edits.map(Je));
2965
+ l.value = l.value.filter((se) => !Y.has(Je(se)));
2966
+ } else l.value = Nn([...l.value, ...M.edits]);
2967
+ q === "edit" && (n.value = [...n.value, M.edits], s.value = []), o.value = [], b = null;
2968
+ const X = k;
2969
+ for (const Y of M.edits) {
2970
+ if (k !== X) break;
2971
+ e.onChange(Oe(Y));
2972
+ }
2973
+ }
2974
+ function V(x, M, A) {
2975
+ const q = JSON.stringify([A, M.edits]);
2976
+ b?.plan === x && b.signature === q ? M.requestId = b.requestId : b = { plan: x, signature: q, requestId: M.requestId };
2977
+ }
2978
+ function ee(x) {
2979
+ r.value = e.errorMessage?.(x) ?? (x instanceof Error ? x.message : "Cell edit failed"), e.onError(r.value, x);
2980
+ }
2981
+ async function Z(x, M) {
2982
+ const A = e.plan.value, q = h();
2983
+ if (!A || !q || e.blocked()) return !1;
2984
+ const J = new AbortController(), U = k;
2985
+ f = J, a.value = !0, r.value = null;
2986
+ const X = () => f === J && !J.signal.aborted && e.plan.value === A && e.options.value !== !1;
2987
+ try {
2988
+ const Y = Ci(A, x, $i(), J.signal), se = Y instanceof Promise ? await Y : Y;
2989
+ if (!X()) return !1;
2990
+ const { batch: B, contexts: ke } = se;
2991
+ if (S(A, B, q, ke), B.edits = B.edits.filter((C) => !Object.is(C.previousValue, C.value)), !B.edits.length) return !0;
2992
+ V(A, B, M), S(A, B, q, ke);
2993
+ const je = { signal: J.signal, requestId: B.requestId, action: M };
2994
+ if (await F(B, q, je), !X()) return !1;
2995
+ S(A, B, q, ke);
2996
+ const Fe = se.prepared ? void 0 : wi(A, B, J.signal);
2997
+ if (Fe && (se.prepared = await Fe), !X()) return !1;
2998
+ S(A, B, q, ke);
2999
+ const Ue = await z(B, q, je);
3000
+ if (!X()) return !1;
3001
+ if (Ue?.conflicts?.length)
3002
+ throw o.value = Oe(Ue.conflicts), new ki(Ue.conflicts);
3003
+ return S(A, B, q, ke), K(A, B, Ue, M, !!(q.save || q.saveBatch), se.prepared), U === k;
3004
+ } catch (Y) {
3005
+ return X() && ee(Y), !1;
3006
+ } finally {
3007
+ f === J && (f = null, a.value = !1);
3008
+ }
3009
+ }
3010
+ async function ne(x, M = "edit") {
3011
+ if ($) return $;
3012
+ const A = Z(x, M);
3013
+ $ = A;
3014
+ const q = await A;
3015
+ return $ === A && ($ = null), q;
3016
+ }
3017
+ async function ce() {
3018
+ const x = k, M = n.value[n.value.length - 1];
3019
+ return !M || a.value || !await ne({ edits: M, value: "previousValue" }, "undo") || x !== k ? !1 : (n.value = n.value.slice(0, -1), s.value = [...s.value, M], !0);
3020
+ }
3021
+ async function Re() {
3022
+ const x = k, M = s.value[s.value.length - 1];
3023
+ return !M || a.value || !await ne({ edits: M, value: "value" }, "redo") || x !== k ? !1 : (s.value = s.value.slice(0, -1), n.value = [...n.value, M], !0);
3024
+ }
3025
+ async function ve() {
3026
+ const x = k;
3027
+ return !d.value.length || a.value || !await ne({ edits: d.value, value: "previousValue" }, "restore") || x !== k ? !1 : (n.value = [], s.value = [], !0);
3028
+ }
3029
+ function E() {
3030
+ if (!$) return !a.value;
3031
+ const x = k;
3032
+ return $.then((M) => M && x === k && !a.value);
3033
+ }
3034
+ function O(x) {
3035
+ return e.plan.value ? rt(e.plan.value)(x) : null;
3036
+ }
3037
+ return { settle: E, resolveAddress: O, changes: t, differences: d, localDifferences: l, hasLocalDrafts: i, lastError: r, conflicts: o, saving: a, canUndo: v, canRedo: m, apply: ne, undo: ce, redo: Re, restore: ve, cancel: g, reset: R };
3038
+ }
3039
+ let Ii = 0;
3040
+ const Pi = "position:absolute;inset:0;width:100%;height:100%;min-height:20px;box-sizing:border-box;z-index:10;resize:none;margin:0;padding:2px 4px;border:2px solid var(--mrp-btn-active-bg,#2563eb);outline:none;background:var(--mrp-toolbar-bg,#fff);color:var(--mrp-toolbar-fg,#111);font:inherit;line-height:1.25;white-space:pre-wrap;";
3041
+ function Si(e) {
3042
+ return e.type === "boolean" ? [{ value: !0, label: e.trueLabel ?? "是" }, { value: !1, label: e.falseLabel ?? "否" }] : e.type === "enum" ? e.options.map((t) => ({ value: t.value, label: t.label ?? String(t.value) })) : [];
3043
+ }
3044
+ function Ri(e, t, n) {
3045
+ const s = e.createElement("select"), o = [{ value: null, label: "—" }, ...Si(t)];
3046
+ if (o.forEach((a, r) => {
3047
+ const l = e.createElement("option");
3048
+ l.value = String(r), l.textContent = a.label, (Object.is(n.value, a.value) || n.value === "" && a.value === null) && (l.selected = !0), s.append(l);
3049
+ }), !o.some((a) => Object.is(n.value, a.value) || n.value === "" && a.value === null)) {
3050
+ const a = e.createElement("option");
3051
+ a.value = "unknown", a.textContent = n.cell.text ?? String(n.value), a.selected = !0, s.append(a);
3052
+ }
3053
+ return { input: s, value: () => s.value === "unknown" ? n.value : o[Number(s.value)]?.value ?? null };
3054
+ }
3055
+ function Mi(e, t, n) {
3056
+ const s = t?.type === "number" || t?.type === "date" ? e.createElement("input") : e.createElement("textarea");
3057
+ return s.value = n.value == null ? "" : String(n.value), s instanceof HTMLInputElement && (s.type = t?.type === "date" ? "date" : "text", t?.type === "number" && (s.inputMode = "decimal"), t?.type === "date" && (t.min && (s.min = t.min), t.max && (s.max = t.max))), { input: s, value: () => t?.type === "date" && s instanceof HTMLInputElement && s.validity.badInput ? "invalid-date" : s.value };
3058
+ }
3059
+ function Ti(e) {
3060
+ if (!e) return "";
3061
+ const t = [e.hint, e.unit];
3062
+ return (e.type === "number" || e.type === "date") && (e.min !== void 0 && t.push(`≥ ${e.min}`), e.max !== void 0 && t.push(`≤ ${e.max}`)), e.type === "number" && e.precision !== void 0 && t.push(`最多 ${e.precision} 位小数`), e.type === "text" && e.maxLength !== void 0 && t.push(`最多 ${e.maxLength} 字符`), t.filter(Boolean).join(" · ");
3063
+ }
3064
+ function Oi(e, t, n, s) {
3065
+ const o = e.ownerDocument, a = s?.type === "boolean" || s?.type === "enum" ? Ri(o, s, n) : Mi(o, s, n), r = a.input, l = o.createElement("span");
3066
+ l.className = "mrp-cell-editor-host", l.style.cssText = "position:absolute;inset:0;z-index:10;", r.className = "mrp-cell-editor", r.style.cssText = Pi, r.setAttribute("aria-label", s?.label ?? t), s?.required && r.setAttribute("aria-required", "true");
3067
+ const i = o.createElement("span");
3068
+ i.id = `mrp-cell-hint-${++Ii}`, i.className = "mrp-cell-editor-hint", i.style.cssText = "position:absolute;top:100%;left:0;min-width:100%;width:max-content;max-width:320px;box-sizing:border-box;padding:4px 8px;white-space:normal;border:1px solid var(--mrp-toolbar-border,#ddd);background:var(--mrp-toolbar-bg,#fff);color:var(--mrp-toolbar-fg,#111);font-size:12px;line-height:1.4;box-shadow:0 3px 10px #0002;z-index:11;";
3069
+ const d = Ti(s);
3070
+ return i.textContent = d, i.hidden = !d, r.setAttribute("aria-describedby", i.id), l.append(r, i), e.append(l), {
3071
+ input: r,
3072
+ root: l,
3073
+ initialInput: r.value,
3074
+ value: a.value,
3075
+ focus: () => {
3076
+ r.focus(), (r instanceof HTMLTextAreaElement || r instanceof HTMLInputElement && r.type !== "date") && r.select();
3077
+ },
3078
+ feedback: (v) => {
3079
+ i.textContent = v ?? d, i.hidden = !i.textContent, r.setAttribute("aria-invalid", v ? "true" : "false");
3080
+ }
3081
+ };
3082
+ }
3083
+ function an(e) {
3084
+ const t = e.closest(".mrp-page-holder"), n = e.closest("[data-mr-component-index]");
3085
+ if (!t || !n) return null;
3086
+ const s = {
3087
+ pageIndex: Number(t.dataset.page) - 1,
3088
+ componentIndex: Number(n.dataset.mrComponentIndex),
3089
+ rowIndex: Number(e.dataset.mrRowIndex),
3090
+ columnIndex: Number(e.dataset.mrColumnIndex)
3091
+ };
3092
+ return Object.values(s).every((o) => Number.isInteger(o) && o >= 0) ? s : null;
3093
+ }
3094
+ function Di(e) {
3095
+ const t = fe(null), n = Ei(e), { saving: s, changes: o } = n, a = fe(!1), r = D(() => a.value || n.hasLocalDrafts.value);
3096
+ let l = null;
3097
+ function i() {
3098
+ const h = t.value;
3099
+ t.value = null, a.value = !1, n.cancel(), l = null, h?.editor.root.remove();
3100
+ }
3101
+ function d() {
3102
+ i(), n.reset();
3103
+ }
3104
+ function v(h) {
3105
+ return t.value === h && e.plan.value === h.plan;
3106
+ }
3107
+ async function m(h) {
3108
+ return await n.apply([{ address: h.address, value: h.editor.value() }]) ? (t.value = null, a.value = !1, h.editor.root.remove(), !0) : (t.value === h && (h.editor.input.disabled = !1, h.editor.feedback(n.lastError.value ?? void 0), h.editor.input.focus()), !1);
3109
+ }
3110
+ async function f() {
3111
+ if (l) return l;
3112
+ const h = t.value;
3113
+ if (!h) return n.settle();
3114
+ if (!v(h))
3115
+ return i(), !1;
3116
+ a.value = h.editor.input.value !== h.editor.initialInput, h.editor.input.disabled = !0;
3117
+ const S = m(h);
3118
+ l = S;
3119
+ const z = await S;
3120
+ return l === S && (l = null), z;
3121
+ }
3122
+ function $() {
3123
+ return t.value || l ? f() : n.settle();
3124
+ }
3125
+ function k(h) {
3126
+ if (h.stopPropagation(), !h.isComposing && (h.key === "Escape" && (h.preventDefault(), i()), h.key === "Enter" && !h.shiftKey || h.key === "Tab")) {
3127
+ h.preventDefault();
3128
+ const S = t.value, z = S && at(S.plan, S.address), F = S && z ? tn(S.plan, [{ address: S.address, value: z.value }], "navigation").edits[0] : void 0;
3129
+ f().then((K) => {
3130
+ if (!K || !S || !e.plan.value) return;
3131
+ const V = e.plan.value === S.plan ? S.address : F && rt(e.plan.value)(F);
3132
+ V && e.onNavigate?.(V, h.key, h.shiftKey);
3133
+ });
3134
+ }
3135
+ }
3136
+ function b(h) {
3137
+ e.onError(e.errorMessage?.(h) ?? (h instanceof Error ? h.message : "无法编辑单元格"), h);
3138
+ }
3139
+ async function g(h) {
3140
+ if (!e.options.value || e.blocked() || !await f() || !h.isConnected) return;
3141
+ const S = e.plan.value, z = an(h);
3142
+ if (!S || !z || !e.options.value || e.blocked()) return;
3143
+ const F = typeof e.options.value == "object" ? e.options.value : {};
3144
+ try {
3145
+ const K = at(S, z);
3146
+ if (!K?.editable || F.canEdit?.(K) === !1) return;
3147
+ if (Tt(S, !!K.source), F.requireSource && !K.source) throw new Ae("missing");
3148
+ const V = ra(K, F);
3149
+ V && es(K, V);
3150
+ const ee = Oi(h, e.label(), K, V), Z = ee.input;
3151
+ t.value = { plan: S, address: z, editor: ee }, a.value = !1, Z.addEventListener("keydown", (ne) => k(ne)), Z.addEventListener("input", () => {
3152
+ a.value = Z.value !== ee.initialInput, ee.feedback();
3153
+ }), Z.addEventListener("change", () => {
3154
+ a.value = Z.value !== ee.initialInput;
3155
+ }), Z.addEventListener("blur", () => {
3156
+ !s.value && !e.suspendBlur?.() && f();
3157
+ }), ee.focus();
3158
+ } catch (K) {
3159
+ b(K);
3160
+ }
3161
+ }
3162
+ async function R(h) {
3163
+ const S = h.target;
3164
+ if (!(S instanceof Element) || S.closest(".mrp-cell-editor")) return;
3165
+ const z = S.closest("td[data-mr-row-index]");
3166
+ z && await g(z);
3167
+ }
3168
+ return de(e.options, (h, S) => {
3169
+ (!h || h !== S) && i();
3170
+ }, { flush: "sync" }), de(e.plan, () => {
3171
+ t.value && e.plan.value !== t.value.plan && (t.value.editor.root.remove(), t.value = null, a.value = !1);
3172
+ }, { flush: "sync" }), Ke(d), {
3173
+ ...n,
3174
+ active: t,
3175
+ saving: s,
3176
+ changes: o,
3177
+ pendingLocalChanges: r,
3178
+ cancel: i,
3179
+ reset: d,
3180
+ commit: f,
3181
+ settle: $,
3182
+ onDoubleClick: R,
3183
+ editCell: g,
3184
+ getChanges: () => Oe(o.value)
3185
+ };
3186
+ }
3187
+ const sn = ["html", "pdf", "xlsx", "png", "word"], Vn = ["search", "thumbnails", "zoom", ...sn, "print", "pdfWindow", "editing", "import"];
3188
+ function Eu(e) {
3189
+ return {
3190
+ load: (t) => JSON.parse(e.getItem(t) ?? "null"),
3191
+ save: (t, n) => e.setItem(t, JSON.stringify(n)),
3192
+ remove: (t) => e.removeItem(t)
3193
+ };
3194
+ }
3195
+ function Ai(e, t, n, s) {
3196
+ const o = G({});
3197
+ let a = 0, r = 0, l = Promise.resolve();
3198
+ const i = D(() => Object.fromEntries(Vn.map((f) => [
3199
+ f,
3200
+ e.value[f] && (o.value[f] ?? t.value[f] ?? !0)
3201
+ ])));
3202
+ function d(f, $) {
3203
+ e.value[f] && (r++, o.value = { ...o.value, [f]: $ }, v());
3204
+ }
3205
+ function v() {
3206
+ const f = n?.value;
3207
+ if (!f) return;
3208
+ const $ = { ...o.value };
3209
+ l = l.then(() => f.adapter.save(f.key, $)).catch((k) => {
3210
+ s?.(k);
3211
+ });
3212
+ }
3213
+ function m() {
3214
+ r++, o.value = {}, v();
3215
+ }
3216
+ return n && de(n, async (f) => {
3217
+ const $ = ++a, k = r;
3218
+ if (o.value = {}, !!f)
3219
+ try {
3220
+ const b = await f.adapter.load(f.key);
3221
+ if ($ !== a || k !== r || !b || typeof b != "object") return;
3222
+ o.value = Object.fromEntries(Vn.flatMap((g) => typeof b[g] == "boolean" ? [[g, b[g]]] : []));
3223
+ } catch (b) {
3224
+ $ === a && s?.(b);
3225
+ }
3226
+ }, { immediate: !0 }), Ke(() => {
3227
+ a++;
3228
+ }), { enabled: i, setEnabled: d, reset: m };
3229
+ }
3230
+ function Fi(e, t, n) {
3231
+ const s = G({}), o = fs(), a = D(() => ms(o.value, e.preset)), r = D(() => ({
3232
+ ...a.value.messages,
3233
+ ...e.messages
3234
+ })), l = D(() => e.showExport ?? a.value.showExport), i = D(() => e.showPrint ?? a.value.showPrint), d = D(() => e.showPdfWindow ?? a.value.showPdfWindow), v = D(() => e.showSettings ?? a.value.showSettings), m = D(() => e.guardChanges ?? a.value.guardChanges), f = D(() => ({ ...a.value.output, ...e.output })), $ = D(() => ({ ...a.value.toolbar, ...e.toolbar })), k = D(() => ({ ...a.value.interaction, ...e.interaction, ...s.value })), b = D(() => e.preferences ?? a.value.preferences), g = D(() => e.assets ?? a.value.assets), R = D(() => e.gapPx ?? (t.value ? 0 : a.value.gapPx)), h = D(() => e.showParams ?? a.value.showParams), S = D(() => e.editable ?? a.value.editable), z = D(() => e.excelImport ?? a.value.excelImport), F = D(() => ({
3235
+ search: $.value.search !== !1,
3236
+ thumbnails: $.value.thumbnails !== !1,
3237
+ zoom: $.value.zoom !== !1,
3238
+ ...Object.fromEntries(sn.map((ve) => [
3239
+ ve,
3240
+ l.value && ($.value.exportFormats?.includes(ve) ?? !0)
3241
+ ])),
3242
+ print: i.value,
3243
+ pdfWindow: d.value,
3244
+ editing: !!S.value,
3245
+ import: !!z.value
3246
+ })), K = Ai(F, D(() => ({
3247
+ editing: $.value.editing,
3248
+ import: $.value.excelImport
3249
+ })), b, () => n(r.value.preferencesError ?? "Preferences storage unavailable")), V = K.enabled, ee = D(() => sn.filter((ve) => V.value[ve])), Z = D(() => V.value.editing ? S.value : !1), ne = D(() => V.value.import ? z.value : !1), ce = D(() => typeof S.value == "object" && (typeof S.value.save == "function" || typeof S.value.saveBatch == "function")), Re = D(() => typeof e.emptyState == "object" ? e.emptyState : {});
3250
+ return { resolved: a, resolvedMessages: r, effectiveShowExport: l, effectiveShowPrint: i, effectiveShowPdfWindow: d, effectiveShowSettings: v, effectiveGuardChanges: m, effectiveOutput: f, effectiveInteraction: k, effectiveAssets: g, effectiveGapPx: R, effectiveShowParams: h, availableTools: F, tools: K, toolState: V, visibleExportFormats: ee, effectiveEditable: Z, effectiveExcelImport: ne, persistedEditing: ce, emptyStateContent: Re, sessionInteraction: s };
3251
+ }
3252
+ function zi(e, t, n, s) {
3253
+ const o = s ?? (e.indexOf(t) === e.lastIndexOf(t) ? e.indexOf(t) : -1), a = o >= 0 && e[o] === t ? o : -1, r = JSON.stringify([a, t]);
3254
+ return n.map((l) => l.target?.reportScope ? { ...l, target: { ...l.target } } : {
3255
+ ...l,
3256
+ ...l.target ? {
3257
+ target: {
3258
+ ...l.target,
3259
+ reportScope: r,
3260
+ ...l.target.tableId ? { tableId: JSON.stringify([a, t, l.target.tableId]) } : {}
3261
+ }
3262
+ } : {}
3263
+ });
3264
+ }
3265
+ function la(e) {
3266
+ return e.table.role === "header" ? -Math.max(1, e.grid?.cells.length ?? 1) : e.table.rowIndex;
3267
+ }
3268
+ function qe(e, t, n = t) {
3269
+ const s = e.pages[t.pageIndex]?.components[t.componentIndex], o = s?.table, a = e.pages[n.pageIndex]?.components[n.componentIndex]?.table;
3270
+ return o && a && o.id === a.id ? {
3271
+ grid: o.id,
3272
+ row: la(s) + t.rowIndex,
3273
+ column: a.columnKeys.indexOf(o.columnKeys[t.columnIndex] ?? "")
3274
+ } : { grid: `${t.pageIndex}:${t.componentIndex}`, row: t.rowIndex, column: t.columnIndex };
3275
+ }
3276
+ function Jn(e, t) {
3277
+ const n = e.pages[t.pageIndex]?.components[t.componentIndex]?.table;
3278
+ if (!n) return (o, a) => ({ ...t, rowIndex: o, columnIndex: a });
3279
+ const s = /* @__PURE__ */ new Map();
3280
+ return e.pages.forEach((o, a) => o.components.forEach((r, l) => {
3281
+ r.table?.id !== n.id || !r.grid || r.grid.cells.forEach((i, d) => {
3282
+ const v = la(r) + d;
3283
+ s.set(v, [...s.get(v) ?? [], { address: { pageIndex: a, componentIndex: l, rowIndex: d, columnIndex: 0 }, keys: r.table.columnKeys }]);
3284
+ });
3285
+ })), (o, a) => {
3286
+ const r = n.columnKeys[a];
3287
+ if (r === void 0) return null;
3288
+ const l = s.get(o)?.find((i) => i.keys.includes(r));
3289
+ return l ? { ...l.address, columnIndex: l.keys.indexOf(r) } : null;
3290
+ };
3291
+ }
3292
+ function Li(e, t) {
3293
+ const n = [...e.ownerDocument.querySelectorAll("a[href],button,input,textarea,select,[tabindex]:not([tabindex='-1'])")].filter((a) => a.tabIndex >= 0 && !a.matches(":disabled,[hidden],input[type='hidden']") && !a.closest("[inert],[aria-hidden='true']") && a.getClientRects().length > 0).map((a, r) => ({ element: a, order: r })).sort((a, r) => (a.element.tabIndex || 1 / 0) - (r.element.tabIndex || 1 / 0) || a.order - r.order), s = n.findIndex(({ element: a }) => a === e);
3294
+ if (s < 0) return !1;
3295
+ const o = n[s + (t ? -1 : 1)]?.element;
3296
+ return o ? (o.focus(), e.ownerDocument.activeElement === o) : !1;
3297
+ }
3298
+ function Ni(e, t) {
3299
+ const n = e?.source;
3300
+ return !qi(e, t.field) || t.tableId !== void 0 && e?.table?.id !== t.tableId || t.datasetId !== void 0 && (n?.datasetId ?? e?.component.table?.source?.datasetId) !== t.datasetId ? !1 : t.rowKey === void 0 || n?.rowKey === t.rowKey;
3301
+ }
3302
+ function qi(e, t) {
3303
+ if ((e?.source?.field ?? e?.table?.columnKey) === t) return !0;
3304
+ if (!e || e.table?.role !== "header") return !1;
3305
+ const n = e.address.columnIndex;
3306
+ return e.component.table?.columnKeys.slice(n, n + (e.cell.colSpan ?? 1)).includes(t) ?? !1;
3307
+ }
3308
+ function Bi(e, t) {
3309
+ return e.pageIndex === t.pageIndex && e.componentIndex === t.componentIndex;
3310
+ }
3311
+ function Ki(e, t) {
3312
+ return Bi(e, t) && e.rowIndex === t.rowIndex && e.columnIndex === t.columnIndex;
3313
+ }
3314
+ function Zt(e) {
3315
+ return `[data-page="${e.pageIndex + 1}"] [data-mr-component-index="${e.componentIndex}"] td[data-mr-row-index="${e.rowIndex}"][data-mr-column-index="${e.columnIndex}"]`;
3316
+ }
3317
+ function on(e) {
3318
+ return `${e.pageIndex}:${e.componentIndex}:${e.rowIndex}:${e.columnIndex}`;
3319
+ }
3320
+ function ji(e, t) {
3321
+ const n = qe(e, t.anchor), s = qe(e, t.focus, t.anchor);
3322
+ return { grid: n.grid, minRow: Math.min(n.row, s.row), maxRow: Math.max(n.row, s.row), minColumn: Math.min(n.column, s.column), maxColumn: Math.max(n.column, s.column), focusKey: on(t.focus), origin: e.pages[t.anchor.pageIndex]?.components[t.anchor.componentIndex]?.table };
3323
+ }
3324
+ function Hi(e, t, n) {
3325
+ const s = t?.table;
3326
+ if (!s || !n.origin || s.id !== n.origin.id) return { grid: `${e.pageIndex}:${e.componentIndex}`, rowOffset: 0, missingColumn: -1 };
3327
+ const o = /* @__PURE__ */ new Map();
3328
+ return n.origin.columnKeys.forEach((a, r) => {
3329
+ o.has(a) || o.set(a, r);
3330
+ }), { grid: s.id, rowOffset: s.role === "header" ? -Math.max(1, t.grid?.cells.length ?? 1) : s.rowIndex, columns: s.columnKeys.map((a) => o.get(a) ?? -1), missingColumn: o.get("") ?? -1 };
3331
+ }
3332
+ function Wi(e, t, n) {
3333
+ if (!n || !t || t.grid !== n.grid) return !1;
3334
+ const s = t.rowOffset + e.row, o = t.columns ? t.columns[e.column] ?? t.missingColumn : e.column;
3335
+ return s >= n.minRow && s <= n.maxRow && o >= n.minColumn && o <= n.maxColumn;
3336
+ }
3337
+ function Ct(e, t, n) {
3338
+ e.getAttribute(t) !== n && e.setAttribute(t, n);
3339
+ }
3340
+ function Xt(e, t, n) {
3341
+ e.classList.contains(t) !== n && e.classList.toggle(t, n);
3342
+ }
3343
+ function Ui(e, t, n, s, o, a) {
3344
+ t.role !== n && (Ct(e, "role", n), t.role = n), t.selected !== s && (Xt(e, "mrp-cell-selected", s), Ct(e, "aria-selected", String(s)), t.selected = s), t.focused !== o && (Xt(e, "mrp-cell-focus", o), Ct(e, "tabindex", o ? "0" : "-1"), t.focused = o), t.modified !== a && (Xt(e, "mrp-cell-modified", a), t.modified = a);
3345
+ }
3346
+ function Vi(e) {
3347
+ const t = () => e.editable?.() ?? e.enabled(), n = fe(null), s = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap();
3348
+ let a = null, r = null, l = /* @__PURE__ */ new Set();
3349
+ function i(E, O) {
3350
+ const x = at(E, O);
3351
+ return !x || E.requiresRecalculation && !x.source ? null : { address: x.address, source: x.source, table: x.table, value: x.value, previousValue: x.value, text: x.cell.text ?? "", previousText: x.cell.text ?? "" };
3352
+ }
3353
+ de(e.plan, (E, O) => {
3354
+ const x = n.value;
3355
+ if (!x) return;
3356
+ if (!E || !O) {
3357
+ n.value = null;
3358
+ return;
3359
+ }
3360
+ const M = i(O, x.anchor), A = i(O, x.focus), q = rt(E), J = M && q(M), U = A && q(A);
3361
+ n.value = J && U ? { anchor: J, focus: U } : null;
3362
+ }, { flush: "sync" });
3363
+ function d(E = e.root.value ?? void 0) {
3364
+ if (!E) return;
3365
+ const O = n.value, x = e.plan.value, M = e.differences();
3366
+ if (M !== a || x !== r) {
3367
+ a = M, r = x;
3368
+ const q = x && M.length ? rt(x) : null;
3369
+ l = new Set(M.flatMap((J) => q ? q.all(J).map(on) : []));
3370
+ }
3371
+ const A = O && x ? ji(x, O) : null;
3372
+ E instanceof HTMLTableElement && f(E, x, A);
3373
+ for (const q of E.querySelectorAll("table")) f(q, x, A);
3374
+ }
3375
+ function v(E) {
3376
+ const O = s.get(E);
3377
+ if (O) return O;
3378
+ const x = E.closest("[data-mr-component-index]"), M = x?.closest(".mrp-page-holder"), A = { pageIndex: Number(M?.dataset.page) - 1, componentIndex: Number(x?.dataset.mrComponentIndex) };
3379
+ return Object.values(A).every((q) => Number.isInteger(q) && q >= 0) ? (s.set(E, A), A) : null;
3380
+ }
3381
+ function m(E, O) {
3382
+ const x = o.get(E);
3383
+ if (x) return x;
3384
+ const M = Number(E.dataset.mrRowIndex), A = Number(E.dataset.mrColumnIndex);
3385
+ if (![M, A].every((J) => Number.isInteger(J) && J >= 0)) return null;
3386
+ const q = { row: M, column: A, key: on({ ...O, rowIndex: M, columnIndex: A }) };
3387
+ return o.set(E, q), q;
3388
+ }
3389
+ function f(E, O, x) {
3390
+ const M = v(E);
3391
+ if (!M) return;
3392
+ const A = O?.pages[M.pageIndex]?.components[M.componentIndex], q = A?.table?.role === "header" ? "columnheader" : "gridcell", J = x ? Hi(M, A, x) : null;
3393
+ Ct(E, "role", "grid");
3394
+ for (const U of E.rows) for (const X of U.cells) {
3395
+ const Y = m(X, M);
3396
+ Y && Ui(X, Y, q, Wi(Y, J, x), x?.focusKey === Y.key, l.size > 0 && l.has(Y.key));
3397
+ }
3398
+ }
3399
+ async function $(E, O = !1) {
3400
+ if (!e.plan.value || !at(e.plan.value, E)) return !1;
3401
+ const x = n.value, M = O && x && qe(e.plan.value, x.anchor).grid === qe(e.plan.value, E, x.anchor).grid;
3402
+ n.value = { anchor: M ? x.anchor : { ...E }, focus: { ...E } }, e.root.value?.querySelector(Zt(E)) || e.gotoPage(E.pageIndex + 1), await Ge(), d();
3403
+ const A = e.root.value?.querySelector(Zt(E));
3404
+ return A?.focus({ preventScroll: !0 }), A?.scrollIntoView?.({ block: "nearest", inline: "nearest" }), !!A;
3405
+ }
3406
+ function k(E) {
3407
+ const O = E.target;
3408
+ if (!(O instanceof Element) || O.closest("textarea,input,button,select")) return;
3409
+ const x = O.closest("td[data-mr-row-index]"), M = x && an(x);
3410
+ if (!M || e.busy() || !e.plan.value || !at(e.plan.value, M)) return;
3411
+ const A = n.value, q = E.shiftKey && A && qe(e.plan.value, A.anchor).grid === qe(e.plan.value, M, A.anchor).grid;
3412
+ n.value = { anchor: q ? A.anchor : { ...M }, focus: { ...M } }, d(), x.focus({ preventScroll: !0 });
3413
+ }
3414
+ function b(E) {
3415
+ const O = e.plan.value?.pages[E.pageIndex]?.components[E.componentIndex];
3416
+ return O?.grid ? dn(O.grid, O.widthMm, O.heightMm).cells.map((x) => ({ ...E, rowIndex: x.ri, columnIndex: x.ci })) : [];
3417
+ }
3418
+ function g(E, O, x) {
3419
+ const M = b(E), A = x ? -1 : 1;
3420
+ if (O === "Tab") return M[M.findIndex((U) => Ki(U, E)) + A];
3421
+ const q = O === "ArrowUp" || O === "ArrowDown" || O === "Enter", J = O === "ArrowUp" || O === "ArrowLeft" ? -1 : A;
3422
+ return M.filter((U) => q ? U.columnIndex === E.columnIndex && (U.rowIndex - E.rowIndex) * J > 0 : U.rowIndex === E.rowIndex && (U.columnIndex - E.columnIndex) * J > 0).sort((U, X) => q ? (U.rowIndex - X.rowIndex) * J : (U.columnIndex - X.columnIndex) * J)[0];
3423
+ }
3424
+ function R(E, O, x) {
3425
+ if (O === "ArrowLeft" || O === "ArrowRight") return;
3426
+ const M = e.plan.value;
3427
+ if (!M.pages[E.pageIndex]?.components[E.componentIndex]?.table) return;
3428
+ const q = O === "ArrowUp" || x ? -1 : 1;
3429
+ for (let J = E.pageIndex; J >= 0 && J < M.pages.length; J += q) {
3430
+ const U = M.pages[J].components, X = J === E.pageIndex ? E.componentIndex + q : q === 1 ? 0 : U.length - 1;
3431
+ for (let Y = X; Y >= 0 && Y < U.length; Y += q) {
3432
+ const se = h(E, { ...E, pageIndex: J, componentIndex: Y }, O, q);
3433
+ if (se) return se;
3434
+ }
3435
+ }
3436
+ }
3437
+ function h(E, O, x, M) {
3438
+ const A = e.plan.value, q = A.pages[E.pageIndex].components[E.componentIndex].table, J = A.pages[O.pageIndex].components[O.componentIndex]?.table;
3439
+ if (J?.id !== q.id || J.role === "header" && q.role !== "header" && (M > 0 || q.rowIndex + E.rowIndex > 0)) return;
3440
+ const U = b(O), X = x === "Tab" ? U : U.filter((Y) => Y.columnIndex === E.columnIndex);
3441
+ return M === 1 ? X[0] : X[X.length - 1];
3442
+ }
3443
+ function S(E, O, x = !1, M = !1, A = !1) {
3444
+ const q = g(E, O, x) ?? R(E, O, x);
3445
+ return q ? ($(q, M), !0) : ((O !== "Tab" || !A) && $(E), !1);
3446
+ }
3447
+ function z(E) {
3448
+ const O = n.value;
3449
+ if (e.busy() || E.target instanceof Element && E.target.closest("textarea,input,select,button,a[href],[contenteditable]")) return !1;
3450
+ if (!O) return V(E);
3451
+ const x = E.key;
3452
+ if (F(E) || K(E, O.focus)) return !0;
3453
+ if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Tab", "Enter"].includes(x)) return !1;
3454
+ const M = S(O.focus, x, x === "Tab" && E.shiftKey, E.shiftKey && x !== "Tab", !0);
3455
+ if (x === "Tab" && !M) {
3456
+ const A = e.root.value?.ownerDocument.activeElement;
3457
+ if (!(A instanceof HTMLElement) || !Li(A, E.shiftKey)) return !1;
3458
+ }
3459
+ return E.preventDefault(), !0;
3460
+ }
3461
+ function F(E) {
3462
+ if (!t() || !(E.ctrlKey || E.metaKey)) return !1;
3463
+ const O = E.key.toLowerCase();
3464
+ return O !== "z" && O !== "y" ? !1 : (E.preventDefault(), O === "y" || E.shiftKey ? e.redo() : e.undo(), !0);
3465
+ }
3466
+ function K(E, O) {
3467
+ if (!t() || !e.plan.value || E.key !== "F2" && !(E.key === "Enter" && at(e.plan.value, O)?.editable)) return !1;
3468
+ const x = e.root.value?.querySelector(Zt(O));
3469
+ return x && (E.preventDefault(), e.edit(x)), !0;
3470
+ }
3471
+ function V(E) {
3472
+ if (!["ArrowDown", "ArrowRight", "ArrowUp", "ArrowLeft", "Enter"].includes(E.key)) return !1;
3473
+ const O = e.root.value?.querySelector("td[data-mr-row-index]"), x = O && an(O);
3474
+ return x ? (E.preventDefault(), $(x), !0) : !1;
3475
+ }
3476
+ function ee() {
3477
+ const E = n.value, O = e.plan.value;
3478
+ if (!E || !O) return "";
3479
+ const x = [], M = qe(O, E.anchor), A = qe(O, E.focus, E.anchor), q = Jn(O, E.anchor), J = Et(O), U = Math.min(M.column, A.column), X = Math.max(M.column, A.column);
3480
+ if ((Math.abs(M.row - A.row) + 1) * (X - U + 1) > 1e4)
3481
+ return e.error(new Ae("limit")), "";
3482
+ for (let Y = Math.min(M.row, A.row); Y <= Math.max(M.row, A.row); Y++) {
3483
+ const se = [];
3484
+ for (let B = U; B <= X; B++) {
3485
+ const ke = q(Y, B);
3486
+ se.push(ke ? J(ke)?.cell.text ?? "" : "");
3487
+ }
3488
+ x.push(se);
3489
+ }
3490
+ return ns(x);
3491
+ }
3492
+ function Z(E) {
3493
+ !n.value || E.target instanceof Element && E.target.closest("textarea,input,select") || (E.clipboardData?.setData("text/plain", ee()), E.preventDefault());
3494
+ }
3495
+ async function ne(E) {
3496
+ const O = n.value;
3497
+ if (!O || !t() || e.busy()) return !1;
3498
+ try {
3499
+ let x;
3500
+ try {
3501
+ x = ts(E);
3502
+ } catch (X) {
3503
+ throw new Ae(X instanceof Error && X.message.includes("limit") ? "limit" : "clipboard");
3504
+ }
3505
+ const M = e.plan.value, A = qe(M, O.anchor), q = qe(M, O.focus, O.anchor), J = Jn(M, O.anchor), U = x.flatMap((X, Y) => X.map((se, B) => {
3506
+ const ke = J(Math.min(A.row, q.row) + Y, Math.min(A.column, q.column) + B);
3507
+ if (!ke) throw new Ae("missing");
3508
+ return { address: ke, value: se };
3509
+ }));
3510
+ return await e.apply(U);
3511
+ } catch (x) {
3512
+ return e.error(x), !1;
3513
+ }
3514
+ }
3515
+ function ce(E) {
3516
+ if (!n.value || !t() || E.target instanceof Element && E.target.closest("textarea,input,select,button,a[href],[contenteditable]") || !E.clipboardData?.types.includes("text/plain")) return;
3517
+ const O = E.clipboardData?.getData("text/plain");
3518
+ O && (E.preventDefault(), ne(O));
3519
+ }
3520
+ async function Re(E) {
3521
+ const O = e.plan.value;
3522
+ if (!O) return !1;
3523
+ const x = Et(O);
3524
+ for (let M = 0; M < O.pages.length; M++) {
3525
+ const A = O.pages[M];
3526
+ if (!(E.reportScope !== void 0 && A.meta?.reportScope !== E.reportScope))
3527
+ for (let q = 0; q < A.components.length; q++)
3528
+ for (const J of b({ pageIndex: M, componentIndex: q, rowIndex: 0, columnIndex: 0 })) {
3529
+ const U = x(J);
3530
+ if (Ni(U, E))
3531
+ return $(J);
3532
+ }
3533
+ }
3534
+ return !1;
3535
+ }
3536
+ function ve() {
3537
+ n.value = null, d();
3538
+ }
3539
+ return { selection: n, refresh: d, reset: ve, focusCell: $, focusField: Re, navigate: S, onClick: k, onKeydown: z, onCopy: Z, onPaste: ce, copySelection: ee, pasteSelection: ne };
3540
+ }
3541
+ function Ji(e) {
3542
+ let t = 0, n = !1;
3543
+ function s() {
3544
+ const a = e.viewport.value, r = e.root.value, l = e.plan.value;
3545
+ if (!a || !r || !l) return;
3546
+ const i = e.options(), d = Math.max(0, Math.min(20, Math.floor(i.frozenColumns ?? 0)));
3547
+ if (!i.freezeHeaders && d === 0 && !n) return;
3548
+ const v = e.zoom.value || 1, m = a.getBoundingClientRect();
3549
+ r.querySelectorAll("[data-mr-component-index]").forEach((f) => {
3550
+ const $ = f.closest("[data-page]"), k = Number($?.dataset.page) - 1, b = l.pages[k]?.components[Number(f.dataset.mrComponentIndex)];
3551
+ if (!b?.grid || !$) return;
3552
+ f.style.transform = "", f.style.zIndex = "";
3553
+ const g = f.getBoundingClientRect(), R = $.getBoundingClientRect().bottom, h = Math.max(0, (m.left - g.left) / v), S = i.freezeHeaders ? Math.max(0, Math.min((m.top - g.top) / v, (R - g.bottom) / v)) : 0;
3554
+ h > 0 && d > 0 && (f.style.zIndex = "1"), b.table?.role === "header" && S > 0 && (f.style.transform = `translateY(${S}px)`, f.style.zIndex = "5"), f.querySelectorAll(".mrp-cell-frozen").forEach((F) => {
3555
+ F.style.transform = "", F.style.zIndex = "", F.classList.remove("mrp-cell-frozen");
3556
+ });
3557
+ const z = Array.from({ length: d }, (F, K) => `td[data-mr-column-index="${K}"]`);
3558
+ !b.table && i.freezeHeaders && z.push('td[data-mr-row-index="0"]'), z.length && f.querySelectorAll(z.join(",")).forEach((F) => {
3559
+ const K = Number(F.dataset.mrColumnIndex) < d, V = !b.table && Number(F.dataset.mrRowIndex) === 0 && !!i.freezeHeaders, ee = K ? h : 0, Z = V ? S : 0;
3560
+ F.style.transform = ee || Z ? `translate(${ee}px, ${Z}px)` : "", F.classList.toggle("mrp-cell-frozen", !!(ee || Z)), F.style.zIndex = ee || Z ? V ? "7" : "6" : "";
3561
+ });
3562
+ }), n = !!i.freezeHeaders || d > 0;
3563
+ }
3564
+ function o() {
3565
+ t || (t = requestAnimationFrame(() => {
3566
+ t = 0, s();
3567
+ }));
3568
+ }
3569
+ return Ke(() => {
3570
+ t && cancelAnimationFrame(t);
3571
+ }), { refresh: s, schedule: o };
3572
+ }
3573
+ async function ia(e, t, n, s) {
3574
+ if (!t?.assetRenderers || !Object.keys(t.assetRenderers).length) return e;
3575
+ try {
3576
+ return (await as(e, { ...t, signal: n, format: "dom", onDiagnostic: (a) => {
3577
+ n.aborted || (t.onDiagnostic?.(a), s(a.message));
3578
+ } })).plan;
3579
+ } catch (o) {
3580
+ throw n.aborted ? o : new ot("render", o instanceof Error ? o.message : "Report asset preparation failed", o);
3581
+ }
3582
+ }
3583
+ function ua(e, t) {
3584
+ const n = os(e);
3585
+ if (!n.ok) throw new ot("validate", `渲染计划校验失败(${n.errors.length} 处): ${n.errors.slice(0, 3).map((s) => `${s.path}: ${s.message}`).join("; ")}`);
3586
+ n.warnings.forEach((s) => t(`${s.path}: ${s.message}`));
3587
+ }
3588
+ async function Gi(e, t, n, s) {
3589
+ const o = await Be(e(t), t.signal);
3590
+ return xe(t.signal), s("validate"), ua(o, t.onWarning ?? (() => {
3591
+ })), xe(t.signal), s("assets"), ia(o, n, t.signal, t.onWarning ?? (() => {
3592
+ }));
3593
+ }
3594
+ async function Yi(e, t, n, s, o, a) {
3595
+ const { importExcelTemplate: r } = await import("@agile-team/mach-report/xlsx");
3596
+ xe(s);
3597
+ const l = await Be(r(e, { ...t, signal: s }), s);
3598
+ a("layout");
3599
+ const i = ss(Oe(l.template), {}).plan;
3600
+ ua(i, o), xe(s), a("assets");
3601
+ const d = await ia(i, n, s, o);
3602
+ return { result: l, plan: d };
3603
+ }
3604
+ const Zi = {
3605
+ key: 7,
3606
+ class: "mrp-edit-hint",
3607
+ role: "status"
3608
+ }, Xi = {
3609
+ key: 9,
3610
+ class: "mrp-export-notice mrp-export-warning",
3611
+ role: "status"
3612
+ }, Qi = { class: "mrp-main" }, _i = {
3613
+ key: 0,
3614
+ class: "mrp-state"
3615
+ }, eu = {
3616
+ key: 1,
3617
+ class: "mrp-state mrp-error"
3618
+ }, tu = ["data-page"], nu = ["aria-label", "aria-current", "onClick"], au = ["data-thumb"], su = { class: "mrp-thumb-no" }, ou = {
3619
+ key: 10,
3620
+ class: "mrp-footer"
3621
+ }, ru = { class: "mrp-footer-context" }, lu = ["aria-label"], iu = { key: 0 }, uu = { class: "mrp-overlay" }, cu = {
3622
+ key: 11,
3623
+ class: "mrp-debug",
3624
+ "aria-hidden": "true"
3625
+ }, Qt = 96 / 25.4, _t = "mach-report:ui", en = "mach-report:ui:wide", du = /* @__PURE__ */ ye({
3626
+ __name: "ReportPreview",
3627
+ props: {
3628
+ drill: { type: Object, default: void 0 },
3629
+ loadParamOptions: { type: Function, default: void 0 },
3630
+ reportId: {
3631
+ type: [String, Array],
3632
+ default: null
3633
+ },
3634
+ params: {
3635
+ type: Object,
3636
+ default: () => ({})
3637
+ },
3638
+ height: { type: String, default: "100vh" },
3639
+ autoLoad: { type: Boolean, default: !0 },
3640
+ /** 以下显隐/间距不传时走配置中心(preset > defaults > 内置缺省) */
3641
+ showExport: { type: Boolean, default: void 0 },
3642
+ showPrint: { type: Boolean, default: void 0 },
3643
+ showPdfWindow: { type: Boolean, default: void 0 },
3644
+ showSettings: { type: Boolean, default: void 0 },
3645
+ toolbar: { type: Object, default: void 0 },
3646
+ interaction: { type: Object, default: void 0 },
3647
+ preferences: { type: Object, default: void 0 },
3648
+ guardChanges: { type: Boolean, default: void 0 },
3649
+ beforeDiscard: { type: Function, default: void 0 },
3650
+ output: { type: Object, default: void 0 },
3651
+ assets: { type: Object, default: void 0 },
3652
+ printOptions: { type: Object, default: void 0 },
3653
+ /** 保留表头的零行业务结果;不改变计划和导出内容。 */
3654
+ emptyState: { type: [Boolean, Object], default: !1 },
3655
+ /** 页间距(px);不传走配置中心 */
3656
+ gapPx: { type: Number, default: void 0 },
3657
+ /** 工具栏/状态文案覆写(不传走配置中心 messages) */
3658
+ messages: { type: Object, default: void 0 },
3659
+ /** 启用的 preset 名(不传用配置中心 defaultPreset) */
3660
+ preset: { type: String, default: void 0 },
3661
+ /** 调试面板(也可用 URL ?mrp-debug=1 开启) */
3662
+ debug: { type: Boolean, default: !1 },
3663
+ /** 参数定义(优先级:prop > 模板 params;有定义且未关闭时显示查询面板) */
3664
+ paramDefs: {
3665
+ type: Array,
3666
+ default: void 0
3667
+ },
3668
+ /** 参数面板显隐(不传走配置中心,缺省 true;有参数定义才渲染) */
3669
+ showParams: { type: Boolean, default: void 0 },
3670
+ editable: { type: [Boolean, Object], default: void 0 },
3671
+ excelImport: { type: [Boolean, Object], default: void 0 },
3672
+ fetcher: {
3673
+ type: Function,
3674
+ default: null
3675
+ }
3676
+ },
3677
+ emits: ["loaded", "task", "diagnostic", "error", "warning", "cell-edit", "template-import", "preferences-change"],
3678
+ setup(e, { expose: t, emit: n }) {
3679
+ const s = e, o = n, a = fe(null), r = G(!1), l = G(""), i = fe(null), d = G(null), v = G(!1), m = G(null), f = G(1), $ = G(null), k = G(null), b = G(null), g = G(!1), R = G(!1), h = G(!1), S = G("general"), z = fe(null), F = G(null), K = G(null), V = Vs();
3680
+ let ee = null, Z = !1;
3681
+ const ne = Rl((c) => o("task", c)), ce = Ml((c) => o("diagnostic", c)), Re = D(() => ce.entries.value.filter((c) => c.valueState && c.target)), ve = D(() => ce.entries.value.filter((c) => !c.valueState)), E = fe(null), O = D(() => !!a.value?.pages.length && a.value.pages.every((c) => c.layout === "wide"));
3682
+ let x = _t;
3683
+ const M = Ln(ks, null), A = Ln($s, null), q = D(() => ea(s.reportId)), J = D(() => s.fetcher ?? M), U = D(() => a.value?.pages.length ?? 0), X = D(() => Object.freeze({
3684
+ loading: r.value,
3685
+ hasPlan: U.value > 0,
3686
+ pageCount: U.value,
3687
+ currentPage: f.value,
3688
+ exporting: d.value,
3689
+ printing: v.value,
3690
+ canExport: !r.value && !R.value && !W.saving.value && U.value > 0 && d.value === null,
3691
+ canPrint: !r.value && !R.value && !W.saving.value && U.value > 0 && !v.value,
3692
+ error: i.value,
3693
+ pdfFont: gn.value,
3694
+ editing: W.active.value !== null,
3695
+ saving: W.saving.value,
3696
+ importing: R.value,
3697
+ dirty: W.differences.value.length > 0,
3698
+ pendingLocalChanges: W.pendingLocalChanges.value,
3699
+ task: ne.state.value,
3700
+ diagnostics: ce.entries.value,
3701
+ reportIds: E.value?.reportIds ?? [],
3702
+ params: E.value?.params ?? {},
3703
+ canUndo: W.canUndo.value,
3704
+ canRedo: W.canRedo.value,
3705
+ changeCount: W.differences.value.length,
3706
+ selection: re.selection.value ? Oe(re.selection.value) : null
3707
+ }));
3708
+ function Y(c, I, L) {
3709
+ i.value = Object.freeze({ message: c, code: I, cause: L }), o("error", c, { code: I, cause: L });
3710
+ }
3711
+ const {
3712
+ resolved: se,
3713
+ resolvedMessages: B,
3714
+ effectiveShowExport: ke,
3715
+ effectiveShowSettings: je,
3716
+ effectiveGuardChanges: Fe,
3717
+ effectiveOutput: Ue,
3718
+ effectiveInteraction: C,
3719
+ effectiveAssets: T,
3720
+ effectiveGapPx: H,
3721
+ effectiveShowParams: j,
3722
+ availableTools: _,
3723
+ tools: oe,
3724
+ toolState: te,
3725
+ visibleExportFormats: Me,
3726
+ effectiveEditable: Te,
3727
+ effectiveExcelImport: Ye,
3728
+ persistedEditing: fn,
3729
+ emptyStateContent: Ot,
3730
+ sessionInteraction: Dt
3731
+ } = Fi(s, O, (c) => o("warning", c)), bt = G(), At = D(() => ({ ...se.value.printOptions, ...s.printOptions, calibration: bt.value ?? { ...se.value.printOptions?.calibration, ...s.printOptions?.calibration } }));
3732
+ de([() => s.printOptions, () => se.value.printOptions], () => {
3733
+ bt.value = void 0;
3734
+ });
3735
+ let lt;
3736
+ const mn = D(() => te.value.pdf || te.value.pdfWindow), Ft = D(() => C.value.calculations === !0), zt = D(() => gs(B.value)), { pdfFont: gn, getPdfExporter: ca, checkPdfFont: da, retryPdfFont: vn, cancelFontCheck: fa } = Il({
3737
+ plan: a,
3738
+ fontUrl: () => se.value.pdfFontUrl,
3739
+ enabled: () => mn.value,
3740
+ injectedExporter: A,
3741
+ destroyed: () => Z
3742
+ });
3743
+ async function ma(c, I) {
3744
+ c === "editing" && !I && !await W.settle() || (oe.setEnabled(c, I), o("preferences-change", Object.freeze({ ...te.value })));
3745
+ }
3746
+ async function ga() {
3747
+ await W.settle() && (oe.reset(), Dt.value = {}, bt.value = void 0, o("preferences-change", Object.freeze({ ...te.value })));
3748
+ }
3749
+ async function pn(c = "general") {
3750
+ if (h.value) {
3751
+ h.value = !1;
3752
+ return;
3753
+ }
3754
+ const I = W.settle();
3755
+ !(typeof I == "boolean" ? I : await I) || Z || !je.value || (S.value = c, h.value = !0);
3756
+ }
3757
+ function hn(c) {
3758
+ return c instanceof Ae ? {
3759
+ number: B.value.editInvalidNumber,
3760
+ boolean: B.value.editInvalidBoolean,
3761
+ conflict: B.value.editConflict,
3762
+ atomic: B.value.editAtomicRequired,
3763
+ limit: B.value.clipboardLimit,
3764
+ readonly: B.value.editReadOnly,
3765
+ missing: B.value.editMissing,
3766
+ recalculation: B.value.editRecalculationUnavailable,
3767
+ duplicate: B.value.editDuplicate,
3768
+ clipboard: B.value.clipboardInvalid
3769
+ }[c.code] ?? c.message : c instanceof Error ? c.message : "单元格保存失败";
3770
+ }
3771
+ const W = Di({
3772
+ plan: a,
3773
+ options: Te,
3774
+ blocked: () => r.value || R.value || d.value !== null || v.value || ze.pending.value,
3775
+ label: () => B.value.editCell ?? "编辑单元格",
3776
+ errorMessage: hn,
3777
+ suspendBlur: () => ze.request.value !== null,
3778
+ onChange: (c) => {
3779
+ i.value = null, m.value = null, o("cell-edit", c);
3780
+ },
3781
+ onError: (c, I) => {
3782
+ m.value = { kind: "error", message: c }, Y(c, "edit", I);
3783
+ },
3784
+ onNavigate: (c, I, L) => re.navigate(c, I, L)
3785
+ }), re = Vi({
3786
+ plan: a,
3787
+ root: $,
3788
+ enabled: () => !!Te.value || Ft.value || !!(s.drill ?? se.value.drill),
3789
+ editable: () => !!Te.value,
3790
+ busy: () => r.value || R.value || W.saving.value || !!d.value || v.value || ze.pending.value,
3791
+ differences: () => W.differences.value,
3792
+ gotoPage: Ee,
3793
+ edit: W.editCell,
3794
+ apply: W.apply,
3795
+ undo: W.undo,
3796
+ redo: W.redo,
3797
+ error: (c) => {
3798
+ const I = hn(c);
3799
+ m.value = { kind: "error", message: I }, Y(I, "edit", c);
3800
+ }
3801
+ }), Lt = ir({ plan: a, selection: re.selection, enabled: () => Ft.value });
3802
+ function va() {
3803
+ pn("advanced");
3804
+ }
3805
+ const ze = Pl({
3806
+ pending: () => W.pendingLocalChanges.value,
3807
+ reportIds: () => E.value?.reportIds ?? q.value,
3808
+ hook: () => s.beforeDiscard ?? se.value.beforeDiscard,
3809
+ enabled: () => Fe.value,
3810
+ snapshot: () => [a.value, W.active.value?.editor.input.value],
3811
+ error: (c) => Y(c instanceof Error ? c.message : "修改保护回调失败", "config", c)
3812
+ });
3813
+ async function bn(c = "leave") {
3814
+ return ze.check(c);
3815
+ }
3816
+ const yt = gl({
3817
+ plan: a,
3818
+ selection: re.selection,
3819
+ options: () => s.drill ?? se.value.drill,
3820
+ params: () => ({ ...E.value?.params }),
3821
+ view: () => ({ zoom: $e.value, scrollTop: $.value?.scrollTop ?? 0, scrollLeft: $.value?.scrollLeft ?? 0 }),
3822
+ messages: () => B.value,
3823
+ busy: () => r.value || R.value || W.saving.value || !!d.value || v.value,
3824
+ beforeOpen: () => bn("leave")
3825
+ });
3826
+ function yn(c) {
3827
+ !Fe.value || !W.pendingLocalChanges.value || (c.preventDefault(), c.returnValue = "");
3828
+ }
3829
+ function wn() {
3830
+ ne.cancel();
3831
+ }
3832
+ function pa(c) {
3833
+ const I = W.resolveAddress(c);
3834
+ I && re.focusCell(I);
3835
+ }
3836
+ async function xn(c) {
3837
+ await re.focusField(c) || (m.value = { kind: "warning", message: B.value.locateFieldMissing ?? "Field not found" });
3838
+ }
3839
+ function ha(c) {
3840
+ if (c.pageIndex === void 0) return;
3841
+ Ee(c.pageIndex + 1);
3842
+ const I = c.componentPath;
3843
+ c.componentIndex !== void 0 && I && I.length === 2 && re.focusCell({ pageIndex: c.pageIndex, componentIndex: c.componentIndex, rowIndex: I[0], columnIndex: I[1] });
3844
+ }
3845
+ function Nt(c) {
3846
+ const I = a.value;
3847
+ if (!I) return !1;
3848
+ const L = { excel: "xlsx", image: "png", doc: "word" }[c] ?? c, me = L === "pdf" ? "pdf" : L === "xlsx" ? "xlsx" : L === "png" ? "canvas" : "dom", le = ce.inspect(I, me);
3849
+ return a.value !== I ? !1 : le.length && Ue.value.fidelity === "strict" ? (m.value = { kind: "error", message: B.value.diagnosticsStrict ?? "输出存在已知降级" }, Y(m.value.message, "export", { diagnostics: le }), !1) : !0;
3850
+ }
3851
+ function ba(c) {
3852
+ return a.value ? ce.inspect(a.value, c) : [];
3853
+ }
3854
+ const wt = D(() => {
3855
+ if (z.value) return z.value.sheets.map((I) => ({ label: I.name, pageIndex: I.pageStart }));
3856
+ const c = /* @__PURE__ */ new Set();
3857
+ return a.value?.pages.flatMap((I, L) => I.components.flatMap((me) => {
3858
+ const le = me.table;
3859
+ return !le?.title || c.has(le.id) ? [] : (c.add(le.id), [{ label: le.title, pageIndex: L }]);
3860
+ })) ?? [];
3861
+ });
3862
+ async function kn(c) {
3863
+ c && !await re.focusField({ field: c }) && (m.value = { kind: "warning", message: B.value.locateFieldMissing ?? "Field not found" });
3864
+ }
3865
+ async function ya(c) {
3866
+ await re.focusField(c) || (m.value = { kind: "warning", message: B.value.locateFieldMissing ?? "Field not found" });
3867
+ }
3868
+ const qt = D(() => {
3869
+ try {
3870
+ return { defs: s.paramDefs ?? J.value?.getParamDefs?.(q.value) ?? [], error: null };
3871
+ } catch (c) {
3872
+ return { defs: [], error: new ot("config", c instanceof Error ? c.message : "查询参数配置无效", c) };
3873
+ }
3874
+ }), Bt = D(() => qt.value.defs), it = vs({ defs: Bt, reportIds: q, params: () => s.params, messages: () => B.value }), { values: ut, attempted: xt, pendingRequired: $n } = it, Cn = G(null);
3875
+ function wa() {
3876
+ xt.value = !0, it.validation.value.ok || Ge(() => Cn.value?.focusInvalid()), Xe();
3877
+ }
3878
+ function xa() {
3879
+ it.reset(), l.value = "", i.value = null;
3880
+ }
3881
+ const ka = D(() => ({
3882
+ height: s.height,
3883
+ "--mrp-page-gap": `${Math.max(0, H.value)}px`,
3884
+ ...ps(se.value.theme)
3885
+ })), { zoom: $e, zoomMode: ct, applyFitZoom: En, setZoom: dt } = Ps(() => ({
3886
+ viewport: k.value,
3887
+ pageWidthPx: Kt.contentSize.value.w || 210 * Qt
3888
+ })), Kt = Es(a, $e, {
3889
+ pxPerMm: Qt,
3890
+ gapPx: H,
3891
+ overscan: D(() => se.value.preview.overscanPages)
3892
+ }), { contentSize: jt, windowRange: ft, visiblePages: In, makeScrollHandler: $a, refreshViewport: Pn } = Kt, Ca = $a(f, U), Ht = Ji({ root: $, viewport: k, plan: a, zoom: $e, options: () => C.value });
3893
+ de([C, $e], () => Ht.schedule(), { flush: "post" });
3894
+ function Wt(c) {
3895
+ dt(c * 100);
3896
+ }
3897
+ function Ze() {
3898
+ lt?.abort(), R.value = !1, W.reset(), re.reset(), z.value = null, Rn(), a.value = null, E.value = null, ce.reset(), f.value = 1, ue.reset();
3899
+ }
3900
+ let pe = 0, he = null;
3901
+ function kt(c, I) {
3902
+ return c === pe && !I.signal.aborted && !Z;
3903
+ }
3904
+ function Sn() {
3905
+ k.value && (k.value.scrollTop = 0, k.value.scrollLeft = 0);
3906
+ }
3907
+ function Ea(c, I) {
3908
+ for (const L of c) {
3909
+ if (I !== pe) return !1;
3910
+ o("warning", L);
3911
+ }
3912
+ return I === pe;
3913
+ }
3914
+ function Ia() {
3915
+ if (qt.value.error) {
3916
+ const I = qt.value.error;
3917
+ return Ze(), l.value = I.message, Y(I.message, I.code, I.cause), null;
3918
+ }
3919
+ const c = it.query();
3920
+ return c.params ? c.params : (Ze(), l.value = c.quiet ? "" : c.error.message, c.quiet || (xt.value = !0, Y(c.error.message, c.error.code, c.error.cause)), null);
3921
+ }
3922
+ async function Xe() {
3923
+ if (Z || Fe.value && W.pendingLocalChanges.value && !await ze.check("reload") || Z) return;
3924
+ const c = ++pe;
3925
+ R.value = !1, he?.abort(), he = null;
3926
+ const I = J.value;
3927
+ if (r.value = !1, i.value = null, q.value.length === 0) {
3928
+ l.value = "缺少报表 ID", Ze(), Y(l.value, "param");
3929
+ return;
3930
+ }
3931
+ if (!I) {
3932
+ l.value = "未提供渲染数据源 fetcher", Ze(), Y(l.value, "config");
3933
+ return;
3934
+ }
3935
+ const L = Ia();
3936
+ if (!L) return;
3937
+ r.value = !0, l.value = "", m.value = null, Ze();
3938
+ const me = V.start(), le = new AbortController();
3939
+ he = le;
3940
+ const Ne = ne.start("query", "query", () => {
3941
+ he === le && (le.abort(), pe++, he = null, r.value = !1);
3942
+ }), mt = [...q.value], De = Object.freeze({ ...L }), He = /* @__PURE__ */ new Set();
3943
+ function et(Ie) {
3944
+ c !== pe || le.signal.aborted || He.has(Ie) || (He.add(Ie), se.value.logger.warn("[mach-report] 报表告警:", Ie), ce.add({ code: "layout", severity: "warning", message: Ie }), o("warning", Ie));
3945
+ }
3946
+ try {
3947
+ const Ie = await Gi(I, {
3948
+ reportIds: mt,
3949
+ params: L,
3950
+ taskId: Ne.taskId,
3951
+ onEvent: (Ve) => {
3952
+ c === pe && !le.signal.aborted && Ne.update(Ve.stage, Ve.completed, Ve.total);
3953
+ },
3954
+ onQueryResult: (Ve, qa, Ba) => {
3955
+ c === pe && !le.signal.aborted && ce.addMany(zi(mt, Ve, qa.diagnostics ?? [], Ba));
3956
+ },
3957
+ signal: le.signal,
3958
+ onWarning: et
3959
+ }, T.value, Ne.update);
3960
+ if (!kt(c, le) || (a.value = Ie, E.value = Object.freeze({ reportIds: Object.freeze(mt), params: De }), ce.inspect(Ie, "dom"), !kt(c, le))) return;
3961
+ Ne.finish(), f.value = 1, V.end(me), Sn();
3962
+ const tt = O.value ? en : _t;
3963
+ tt !== x && (x = tt, Jt()), ct.value === "fit" && En(), o("loaded", Ie.pages.length);
3964
+ } catch (Ie) {
3965
+ if (c !== pe) return;
3966
+ if (le.signal.aborted) {
3967
+ Ne.finish("cancelled");
3968
+ return;
3969
+ }
3970
+ Ne.finish("failed");
3971
+ const tt = bs(Ie);
3972
+ l.value = tt.message;
3973
+ const Ve = ys(tt);
3974
+ Y(tt.message, Ve.code, Ve.cause);
3975
+ } finally {
3976
+ c === pe && (r.value = !1), he === le && (he = null);
3977
+ }
3978
+ }
3979
+ function Ee(c) {
3980
+ if (Z || U.value <= 0) return;
3981
+ const I = Math.max(1, Math.min(U.value, c));
3982
+ f.value = I;
3983
+ const L = k.value;
3984
+ L && (Kt.scrollToPage(L, I - 1), La.prioritize(I - 1));
3985
+ }
3986
+ const Qe = As(a, {
3987
+ getPdfExporter: ca,
3988
+ beforeOutput: () => W.settle(),
3989
+ onTask: (c) => ne.receive(c, () => Qe.cancel()),
3990
+ onDiagnostic: ce.add,
3991
+ getXlsxOptions: () => se.value.xlsx,
3992
+ getPrintOptions: () => At.value,
3993
+ getPrintMessages: () => B.value,
3994
+ onError: (c, I) => {
3995
+ m.value = { kind: "error", message: c }, Y(c, I ?? "print");
3996
+ },
3997
+ onWarning: (c) => {
3998
+ m.value = { kind: "warning", message: c }, ce.add({ code: "output", severity: "warning", message: c }), o("warning", c);
3999
+ },
4000
+ onBusy: (c) => {
4001
+ d.value = c, c ? m.value = {
4002
+ kind: "progress",
4003
+ message: B.value.exporting.replace("{format}", c)
4004
+ } : m.value?.kind === "progress" && (m.value = null);
4005
+ },
4006
+ onPrinting: (c) => {
4007
+ v.value = c;
4008
+ }
4009
+ }), { releasePrintFrame: Rn, dispose: Pa } = Qe, Mn = D(() => {
4010
+ const c = a.value?.pages[0];
4011
+ return !!c && !O.value && [c.pageWidthMm, c.pageHeightMm].every((I) => I >= 25 && I <= 600);
4012
+ });
4013
+ async function Sa() {
4014
+ if (!Mn.value || v.value || r.value || R.value) return;
4015
+ const c = a.value.pages[0];
4016
+ v.value = !0;
4017
+ const I = new AbortController();
4018
+ lt = I;
4019
+ try {
4020
+ await Ds([xl(c.pageWidthMm, c.pageHeightMm)], { printOptions: At.value, signal: I.signal, messages: B.value, onError: (L) => {
4021
+ m.value = { kind: "error", message: L };
4022
+ } });
4023
+ } catch {
4024
+ } finally {
4025
+ lt === I && (v.value = !1, lt = void 0);
4026
+ }
4027
+ }
4028
+ async function Tn() {
4029
+ if (r.value || R.value) return;
4030
+ const c = W.settle();
4031
+ (typeof c == "boolean" ? c : await c) && (i.value = null, Nt("html") && await Qe.print());
4032
+ }
4033
+ async function On(c) {
4034
+ if (r.value || R.value) return;
4035
+ const I = W.settle();
4036
+ (typeof I == "boolean" ? I : await I) && (i.value = null, Nt(c) && await Qe.exportAs(c));
4037
+ }
4038
+ function Dn() {
4039
+ if (r.value || R.value || W.active.value || W.saving.value) {
4040
+ m.value = { kind: "warning", message: B.value.editingHint ?? "请先确认单元格修改" };
4041
+ return;
4042
+ }
4043
+ i.value = null, Nt("pdf") && Qe.openPdfWindow();
4044
+ }
4045
+ async function Ra(c, I = {}) {
4046
+ Z || (ut.value = { ...ut.value, ...c }, I.reload !== !1 && (xt.value = !0, await Xe()));
4047
+ }
4048
+ const An = {
4049
+ reload: Xe,
4050
+ print: Tn,
4051
+ exportAs: On,
4052
+ openPdfWindow: Dn,
4053
+ gotoPage: Ee,
4054
+ setParams: Ra,
4055
+ checkPdfFont: da,
4056
+ importExcel: Fn,
4057
+ getPlan: Ma,
4058
+ cancelTask: wn,
4059
+ confirmDiscard: bn,
4060
+ getOutputDiagnostics: ba,
4061
+ getChanges: W.getChanges,
4062
+ undo: W.undo,
4063
+ redo: W.redo,
4064
+ restoreChanges: W.restore,
4065
+ getDifferences: () => Oe(W.differences.value),
4066
+ getSelection: () => re.selection.value ? Oe(re.selection.value) : null,
4067
+ focusCell: re.focusCell,
4068
+ focusField: re.focusField,
4069
+ copySelection: re.copySelection,
4070
+ pasteSelection: re.pasteSelection,
4071
+ get state() {
4072
+ return X.value;
4073
+ }
4074
+ };
4075
+ Wa(Cs, An);
4076
+ function Ma() {
4077
+ return a.value ? Oe(a.value) : null;
4078
+ }
4079
+ function Ta(c) {
4080
+ const I = typeof Ye.value == "object" ? Ye.value : {};
4081
+ return { ...I, ...c, limits: { ...I.limits, ...c?.limits } };
4082
+ }
4083
+ function Oa(c, I) {
4084
+ W.reset(), re.reset(), Rn(), ue.reset(), a.value = c, E.value = null, ce.reset(), z.value = { sheets: Oe(I.sheets), warnings: [...I.warnings] }, f.value = 1, l.value = "", m.value = I.warnings.length ? { kind: "warning", message: I.warnings.join(";") } : null, Sn(), x = O.value ? en : _t, Jt(), ce.addMany(I.warnings.map((L) => ({ code: "excel-import", severity: "warning", message: L }))), a.value === c && ce.inspect(c, "dom");
4085
+ }
4086
+ async function Fn(c, I) {
4087
+ if (Z) throw new ot("config", "报表预览已卸载");
4088
+ if (Fe.value && W.pendingLocalChanges.value && !await ze.check("import") || Z) return null;
4089
+ const L = ++pe;
4090
+ he?.abort(), he = null, r.value = !1, W.cancel(), Qe.invalidatePending(), R.value = !0;
4091
+ const me = new AbortController();
4092
+ he = me, i.value = null, m.value = { kind: "progress", message: B.value.importing ?? "正在导入 Excel…" };
4093
+ const le = ne.start("import", "import", () => {
4094
+ he === me && (me.abort(), pe++, he = null, R.value = !1, m.value = null);
4095
+ }), Ne = Ta(I), mt = Xn(Ne.signal, me);
4096
+ try {
4097
+ const { result: De, plan: He } = await Yi(c, {
4098
+ ...Ne,
4099
+ onProgress: (et, Ie) => {
4100
+ le.update("import", et, Ie), Ne.onProgress?.(et, Ie);
4101
+ }
4102
+ }, T.value, me.signal, (et) => {
4103
+ L === pe && o("warning", et);
4104
+ }, le.update);
4105
+ return !kt(L, me) || !Ea(De.warnings, L) || (Oa(He, De), !kt(L, me)) ? null : (le.finish(), o("template-import", De), L === pe && o("loaded", He.pages.length), De);
4106
+ } catch (De) {
4107
+ if (L !== pe) return null;
4108
+ if (me.signal.aborted)
4109
+ return le.finish("cancelled"), null;
4110
+ le.finish("failed");
4111
+ const He = new ot("import", De instanceof Error ? De.message : "Excel 模板导入失败", De);
4112
+ throw m.value = { kind: "error", message: He.message }, Y(He.message, "import", De), He;
4113
+ } finally {
4114
+ mt(), L === pe && (R.value = !1), he === me && (he = null);
4115
+ }
4116
+ }
4117
+ function Da(c) {
4118
+ const I = c.target, L = I.files?.[0];
4119
+ I.value = "", L && Fn(L).catch(() => {
4120
+ });
4121
+ }
4122
+ const ue = Hs({
4123
+ plan: a,
4124
+ gotoPage: Ee,
4125
+ debounceMs: D(() => se.value.preview.searchDebounceMs),
4126
+ highlight: zs,
4127
+ clearHighlights: Fs
4128
+ });
4129
+ de(() => te.value.search, (c) => {
4130
+ c || (ue.reset(), ue.visible.value = !1);
4131
+ });
4132
+ function Aa(c) {
4133
+ !c.ctrlKey || !te.value.zoom || (c.preventDefault(), Wt($e.value * (c.deltaY < 0 ? 1.1 : 1 / 1.1)));
4134
+ }
4135
+ function Fa(c) {
4136
+ if (!re.onKeydown(c) && !(c.target instanceof Element && c.target.closest("input,textarea,select,[contenteditable='true']"))) {
4137
+ if (te.value.search && (c.ctrlKey || c.metaKey) && c.key.toLowerCase() === "f") {
4138
+ c.preventDefault(), ue.visible.value || ue.toggle(), Ge(() => K.value?.focusSearch());
4139
+ return;
4140
+ }
4141
+ switch (c.key) {
4142
+ case "PageDown":
4143
+ c.preventDefault(), Ee(f.value + 1);
4144
+ break;
4145
+ case "PageUp":
4146
+ c.preventDefault(), Ee(f.value - 1);
4147
+ break;
4148
+ case "Home":
4149
+ c.preventDefault(), Ee(1);
4150
+ break;
4151
+ case "End":
4152
+ c.preventDefault(), Ee(U.value);
4153
+ break;
4154
+ case "+":
4155
+ case "=":
4156
+ c.preventDefault(), te.value.zoom && Wt($e.value * 1.1);
4157
+ break;
4158
+ case "-":
4159
+ c.preventDefault(), te.value.zoom && Wt($e.value / 1.1);
4160
+ break;
4161
+ }
4162
+ }
4163
+ }
4164
+ function za() {
4165
+ try {
4166
+ localStorage.setItem(
4167
+ x,
4168
+ JSON.stringify({ zoomMode: ct.value === "fit" ? "fit" : Math.round($e.value * 100) })
4169
+ );
4170
+ } catch {
4171
+ }
4172
+ }
4173
+ de([ct, $e], za);
4174
+ let Ut = "";
4175
+ function zn(c = !1) {
4176
+ const I = ue.activeMatch.value;
4177
+ if (!O.value || !I) return;
4178
+ const L = `${ue.query.value}:${ue.matchIndex.value}:${I.pageIndex}`;
4179
+ if (!c && L === Ut) return;
4180
+ const le = $.value?.querySelector(`[data-page="${I.pageIndex + 1}"]`)?.querySelectorAll("mark.mrp-hit")[I.occurrence];
4181
+ le && (le.scrollIntoView?.({ block: "nearest", inline: "nearest" }), Ut = L);
4182
+ }
4183
+ const La = Is({
4184
+ plan: a,
4185
+ root: $,
4186
+ pages: () => In.value,
4187
+ priority: () => ue.activeMatch.value?.pageIndex ?? f.value - 1,
4188
+ focusToken: () => ue.activeMatch.value,
4189
+ query: () => ue.query.value,
4190
+ zoom: () => $e.value,
4191
+ loading: () => B.value.loading,
4192
+ clear: ue.clear,
4193
+ highlight: ue.apply,
4194
+ mounted: (c) => {
4195
+ re.refresh(c), Ht.schedule();
4196
+ },
4197
+ ready: () => {
4198
+ ue.activeMatch.value || (Ut = ""), zn();
4199
+ },
4200
+ error: (c) => {
4201
+ l.value = c instanceof Error ? c.message : String(c), Y(l.value, "render", c);
4202
+ }
4203
+ });
4204
+ de(() => re.selection.value, () => {
4205
+ re.refresh();
4206
+ }, { flush: "post" }), de(() => ue.query.value, (c) => {
4207
+ c || $.value?.querySelectorAll(".mrp-page-holder").forEach((I) => {
4208
+ ue.clear(I);
4209
+ });
4210
+ });
4211
+ const Le = Us(a, {
4212
+ thumbsRoot: b,
4213
+ visible: g,
4214
+ renderThumbCanvas: (c) => {
4215
+ try {
4216
+ const I = a.value.pages[c], L = Math.min(0.2, 116 / Math.max(1, I.pageWidthMm * Qt)), { canvases: me } = rs(a.value, { start: c, end: c, dpr: L });
4217
+ return me[0] ?? null;
4218
+ } catch {
4219
+ return null;
4220
+ }
4221
+ }
4222
+ });
4223
+ Ua(() => {
4224
+ Le.schedule();
4225
+ }, { flush: "post" });
4226
+ const Na = D(() => s.debug), { debugStats: _e } = Ws(Na, {
4227
+ plan: a,
4228
+ pageCount: U,
4229
+ windowRange: ft,
4230
+ zoom: $e,
4231
+ loadMs: V.loadMs
4232
+ });
4233
+ function Vt() {
4234
+ Pn(k.value), Le.schedule(), ct.value === "fit" && En(), zn(!0);
4235
+ }
4236
+ function Jt() {
4237
+ dt(x === en ? 100 : "fit");
4238
+ try {
4239
+ const c = JSON.parse(localStorage.getItem(x) ?? "{}");
4240
+ c.zoomMode === "fit" ? dt("fit") : typeof c.zoomMode == "number" && dt(c.zoomMode);
4241
+ } catch {
4242
+ }
4243
+ }
4244
+ return ln(() => {
4245
+ window.addEventListener("resize", Vt), window.addEventListener("beforeunload", yn), typeof ResizeObserver < "u" && k.value && (ee = new ResizeObserver(Vt), ee.observe(k.value)), Pn(k.value), Jt(), s.autoLoad && Xe();
4246
+ }), un(() => {
4247
+ Z = !0, lt?.abort(), ze.cancel(), ne.cancel(), W.reset(), R.value = !1, fa(), pe++, he?.abort(), he = null, window.removeEventListener("resize", Vt), window.removeEventListener("beforeunload", yn), ee?.disconnect(), ee = null, Le.destroy(), ue.reset(), Pa();
4248
+ }), de(
4249
+ () => [JSON.stringify(q.value), JSON.stringify(s.params), J.value],
4250
+ async () => {
4251
+ if (s.autoLoad) {
4252
+ Xe();
4253
+ return;
4254
+ }
4255
+ !await ze.check("replace") || Z || (pe++, he?.abort(), he = null, r.value = !1, l.value = "", i.value = null, m.value = null, Ze());
4256
+ }
4257
+ ), t({ ...An, state: X }), (c, I) => (w(), P("div", {
4258
+ class: Ce(["mach-report-preview", { "mrp-wide-report": O.value }]),
4259
+ style: We(ka.value)
4260
+ }, [
4261
+ u(j) && Bt.value.length > 0 ? (w(), Se(hs, {
4262
+ key: 0,
4263
+ ref_key: "paramPanelRef",
4264
+ ref: Cn,
4265
+ defs: Bt.value,
4266
+ "load-options": s.loadParamOptions ?? u(se).loadParamOptions,
4267
+ modelValue: u(ut),
4268
+ "onUpdate:modelValue": I[0] || (I[0] = (L) => Gn(ut) ? ut.value = L : null),
4269
+ messages: u(B),
4270
+ attempted: u(xt),
4271
+ issues: u(it).validation.value.issues,
4272
+ onQuery: wa,
4273
+ onReset: xa
4274
+ }, null, 8, ["defs", "load-options", "modelValue", "messages", "attempted", "issues"])) : N("", !0),
4275
+ Q(Do, {
4276
+ ref_key: "toolbarRef",
4277
+ ref: K,
4278
+ "page-count": U.value,
4279
+ "current-page": f.value,
4280
+ "zoom-mode": u(ct),
4281
+ zoom: u($e),
4282
+ "show-export": u(ke),
4283
+ "show-print": u(te).print,
4284
+ "show-pdf-window": u(te).pdfWindow,
4285
+ "show-search": u(te).search,
4286
+ "show-thumbnails": u(te).thumbnails,
4287
+ "show-zoom": u(te).zoom,
4288
+ "export-formats": u(Me),
4289
+ "show-settings": u(je),
4290
+ "settings-open": h.value,
4291
+ messages: u(B),
4292
+ search: { visible: u(ue).visible.value, query: u(ue).query.value, matchIndex: u(ue).matchIndex.value, matchCount: u(ue).matchCount.value, searching: u(ue).searching.value },
4293
+ "thumbs-visible": g.value,
4294
+ "show-import": !!u(Ye),
4295
+ busy: r.value || R.value || u(W).saving.value,
4296
+ onGoto: Ee,
4297
+ onZoom: u(dt),
4298
+ onExport: I[1] || (I[1] = (L) => On(L)),
4299
+ onPrint: Tn,
4300
+ onPdfWindow: Dn,
4301
+ onSearchInput: u(ue).onInput,
4302
+ onSearchNav: u(ue).onNav,
4303
+ onSearchToggle: u(ue).toggle,
4304
+ onThumbsToggle: I[2] || (I[2] = (L) => g.value = !g.value),
4305
+ onImportExcel: I[3] || (I[3] = (L) => F.value?.click()),
4306
+ onSettingsToggle: pn
4307
+ }, Va({ _: 2 }, [
4308
+ wt.value.length <= 1 ? {
4309
+ name: "navigation",
4310
+ fn: Gt(() => [
4311
+ U.value > 0 && u(C).navigation !== !1 ? (w(), Se(Un, {
4312
+ key: 0,
4313
+ plan: a.value,
4314
+ compact: "",
4315
+ sections: wt.value,
4316
+ "current-page": f.value,
4317
+ messages: u(B),
4318
+ busy: r.value || R.value || u(W).saving.value,
4319
+ onLocateTarget: xn,
4320
+ onGoto: Ee,
4321
+ onLocate: kn
4322
+ }, null, 8, ["plan", "sections", "current-page", "messages", "busy"])) : N("", !0)
4323
+ ]),
4324
+ key: "0"
4325
+ } : void 0
4326
+ ]), 1032, ["page-count", "current-page", "zoom-mode", "zoom", "show-export", "show-print", "show-pdf-window", "show-search", "show-thumbnails", "show-zoom", "export-formats", "show-settings", "settings-open", "messages", "search", "thumbs-visible", "show-import", "busy", "onZoom", "onSearchInput", "onSearchNav", "onSearchToggle"]),
4327
+ u(ze).request.value ? (w(), Se(qr, {
4328
+ key: 1,
4329
+ messages: u(B),
4330
+ onAnswer: u(ze).settle
4331
+ }, null, 8, ["messages", "onAnswer"])) : N("", !0),
4332
+ Q(Wr, {
4333
+ task: u(ne).state.value,
4334
+ messages: u(B),
4335
+ onCancel: wn
4336
+ }, null, 8, ["task", "messages"]),
4337
+ Q(Xr, {
4338
+ entries: ve.value,
4339
+ messages: u(B),
4340
+ onLocate: ha
4341
+ }, null, 8, ["entries", "messages"]),
4342
+ Q(rl, {
4343
+ entries: Re.value,
4344
+ messages: u(B),
4345
+ busy: r.value || R.value || u(W).saving.value,
4346
+ onLocate: ya
4347
+ }, null, 8, ["entries", "messages", "busy"]),
4348
+ Q(ml, {
4349
+ entries: u(yt).entries.value,
4350
+ pending: u(yt).pending.value,
4351
+ error: u(yt).error.value,
4352
+ busy: r.value || R.value || u(W).saving.value,
4353
+ messages: u(B),
4354
+ onOpen: u(yt).open
4355
+ }, null, 8, ["entries", "pending", "error", "busy", "messages", "onOpen"]),
4356
+ h.value && u(je) ? (w(), Se(Dr, {
4357
+ key: 2,
4358
+ available: u(_),
4359
+ enabled: u(te),
4360
+ messages: u(B),
4361
+ "persisted-editing": u(fn),
4362
+ interaction: u(C),
4363
+ section: S.value,
4364
+ busy: r.value || R.value || u(W).saving.value || !!d.value || v.value,
4365
+ onSection: I[5] || (I[5] = (L) => S.value = L),
4366
+ onInteraction: I[6] || (I[6] = (L) => Dt.value = { ...u(Dt), ...L }),
4367
+ onChange: ma,
4368
+ onReset: ga,
4369
+ onClose: I[7] || (I[7] = (L) => h.value = !1)
4370
+ }, {
4371
+ advanced: Gt(() => [
4372
+ Q(lr, {
4373
+ state: u(Lt),
4374
+ messages: zt.value
4375
+ }, null, 8, ["state", "messages"])
4376
+ ]),
4377
+ default: Gt(() => [
4378
+ ht(c.$slots, "settings", {}, void 0, !0),
4379
+ u(te).print ? (w(), Se(wl, {
4380
+ key: 0,
4381
+ value: At.value.calibration ?? {},
4382
+ messages: u(B),
4383
+ busy: v.value || r.value || R.value || u(W).saving.value,
4384
+ "can-test": Mn.value,
4385
+ onChange: I[4] || (I[4] = (L) => bt.value = L),
4386
+ onTest: Sa
4387
+ }, null, 8, ["value", "messages", "busy", "can-test"])) : N("", !0)
4388
+ ]),
4389
+ _: 3
4390
+ }, 8, ["available", "enabled", "messages", "persisted-editing", "interaction", "section", "busy"])) : N("", !0),
4391
+ wt.value.length > 1 && U.value > 0 && u(C).navigation !== !1 ? (w(), Se(Un, {
4392
+ key: 3,
4393
+ plan: a.value,
4394
+ onLocateTarget: xn,
4395
+ sections: wt.value,
4396
+ "current-page": f.value,
4397
+ messages: u(B),
4398
+ busy: r.value || R.value || u(W).saving.value,
4399
+ onGoto: Ee,
4400
+ onLocate: kn
4401
+ }, null, 8, ["plan", "sections", "current-page", "messages", "busy"])) : N("", !0),
4402
+ z.value ? (w(), Se(bi, {
4403
+ key: 4,
4404
+ result: z.value,
4405
+ messages: u(B)
4406
+ }, null, 8, ["result", "messages"])) : N("", !0),
4407
+ u(Te) && U.value > 0 ? (w(), Se(Vl, {
4408
+ key: 5,
4409
+ differences: u(W).differences.value,
4410
+ conflicts: u(W).conflicts.value,
4411
+ messages: u(B),
4412
+ saving: u(W).saving.value,
4413
+ "can-undo": u(W).canUndo.value,
4414
+ "can-redo": u(W).canRedo.value,
4415
+ persisted: u(fn),
4416
+ busy: !!d.value || v.value,
4417
+ onUndo: u(W).undo,
4418
+ onRedo: u(W).redo,
4419
+ onRestore: u(W).restore,
4420
+ onLocate: pa
4421
+ }, null, 8, ["differences", "conflicts", "messages", "saving", "can-undo", "can-redo", "persisted", "busy", "onUndo", "onRedo", "onRestore"])) : N("", !0),
4422
+ u(Ye) ? (w(), P("input", {
4423
+ key: 6,
4424
+ ref_key: "importInputRef",
4425
+ ref: F,
4426
+ class: "mrp-import-input",
4427
+ type: "file",
4428
+ accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
4429
+ hidden: "",
4430
+ onChange: Da
4431
+ }, null, 544)) : N("", !0),
4432
+ u(Te) && U.value > 0 ? (w(), P("div", Zi, y(u(W).saving.value ? u(B).saving : u(B).editingHint), 1)) : N("", !0),
4433
+ m.value ? (w(), P("div", {
4434
+ key: 8,
4435
+ class: Ce(["mrp-export-notice", `mrp-export-${m.value.kind}`]),
4436
+ role: "alert"
4437
+ }, y(m.value.message), 3)) : N("", !0),
4438
+ u(gn).status === "error" && mn.value ? (w(), P("div", Xi, [
4439
+ ie(y(u(B).pdfFontUnavailable) + " ", 1),
4440
+ p("button", {
4441
+ type: "button",
4442
+ onClick: I[8] || (I[8] = //@ts-ignore
4443
+ (...L) => u(vn) && u(vn)(...L))
4444
+ }, y(u(B).retry), 1)
4445
+ ])) : N("", !0),
4446
+ p("div", Qi, [
4447
+ p("div", {
4448
+ ref_key: "viewportRef",
4449
+ ref: k,
4450
+ class: "mrp-body",
4451
+ tabindex: "0",
4452
+ onWheel: Aa,
4453
+ onKeydown: Fa,
4454
+ onDblclick: I[9] || (I[9] = //@ts-ignore
4455
+ (...L) => u(W).onDoubleClick && u(W).onDoubleClick(...L)),
4456
+ onClick: I[10] || (I[10] = //@ts-ignore
4457
+ (...L) => u(re).onClick && u(re).onClick(...L)),
4458
+ onCopy: I[11] || (I[11] = //@ts-ignore
4459
+ (...L) => u(re).onCopy && u(re).onCopy(...L)),
4460
+ onPaste: I[12] || (I[12] = //@ts-ignore
4461
+ (...L) => u(re).onPaste && u(re).onPaste(...L)),
4462
+ onScrollPassive: I[13] || (I[13] = (L) => {
4463
+ u(Ca)(L.target), u(Ht).schedule();
4464
+ })
4465
+ }, [
4466
+ r.value ? (w(), P("div", _i, y(u(B).loading), 1)) : l.value ? (w(), P("div", eu, [
4467
+ ie(y(l.value) + " ", 1),
4468
+ p("button", {
4469
+ class: "mrp-retry",
4470
+ type: "button",
4471
+ onClick: Xe
4472
+ }, y(u(B).retry), 1)
4473
+ ])) : !a.value || U.value === 0 ? (w(), Se(Hn, {
4474
+ key: 2,
4475
+ title: u($n) ? u(B).paramPrompt ?? u(B).paramsTitle : u(B).empty,
4476
+ description: u($n) ? u(B).paramPromptDescription : u(Ot).description ?? u(B).emptyDescription
4477
+ }, null, 8, ["title", "description"])) : (w(), P("div", {
4478
+ key: 3,
4479
+ class: "mrp-scale",
4480
+ style: We({ width: `${u(jt).w * u($e)}px`, height: `${u(jt).h * u($e)}px` })
4481
+ }, [
4482
+ p("div", {
4483
+ ref_key: "containerRef",
4484
+ ref: $,
4485
+ class: "mrp-scale-inner",
4486
+ style: We({ transform: `scale(${u($e)})`, transformOrigin: "top left", width: `${u(jt).w}px` })
4487
+ }, [
4488
+ u(ft).padTopPx > 0 ? (w(), P("div", {
4489
+ key: 0,
4490
+ class: "mrp-spacer-top",
4491
+ style: We({ height: `${u(ft).padTopPx}px` }),
4492
+ "aria-hidden": "true"
4493
+ }, null, 4)) : N("", !0),
4494
+ (w(!0), P(ge, null, be(u(In), (L) => (w(), P("div", {
4495
+ key: L.index,
4496
+ class: "mrp-page-holder",
4497
+ "data-page": L.index + 1
4498
+ }, null, 8, tu))), 128)),
4499
+ u(ft).padBottomPx > 0 ? (w(), P("div", {
4500
+ key: 1,
4501
+ class: "mrp-spacer-bottom",
4502
+ style: We({ height: `${u(ft).padBottomPx}px` }),
4503
+ "aria-hidden": "true"
4504
+ }, null, 4)) : N("", !0)
4505
+ ], 4)
4506
+ ], 4)),
4507
+ !r.value && !l.value && a.value && U.value > 0 && e.emptyState ? (w(), Se(Hn, {
4508
+ key: 4,
4509
+ title: u(Ot).title ?? u(B).empty,
4510
+ description: u(Ot).description ?? u(B).emptyDescription
4511
+ }, null, 8, ["title", "description"])) : N("", !0)
4512
+ ], 544),
4513
+ u(te).thumbnails && g.value && U.value > 0 ? (w(), P("aside", {
4514
+ key: 0,
4515
+ ref_key: "thumbsRef",
4516
+ ref: b,
4517
+ class: "mrp-thumbs",
4518
+ onScrollPassive: I[14] || (I[14] = //@ts-ignore
4519
+ (...L) => u(Le).onScroll && u(Le).onScroll(...L))
4520
+ }, [
4521
+ u(Le).windowRange.value.padTopPx > 0 ? (w(), P("div", {
4522
+ key: 0,
4523
+ class: "mrp-thumb-spacer",
4524
+ style: We({ height: `${u(Le).windowRange.value.padTopPx}px` }),
4525
+ "aria-hidden": "true"
4526
+ }, null, 4)) : N("", !0),
4527
+ (w(!0), P(ge, null, be(u(Le).visibleThumbs.value, (L) => (w(), P("button", {
4528
+ key: L.index,
4529
+ class: Ce(["mrp-thumb", { "mrp-thumb-active": L.index + 1 === f.value }]),
4530
+ type: "button",
4531
+ "aria-label": `${u(B).thumbnails} · ${u(B).pageInfo.replace("{cur}", String(L.index + 1)).replace("{total}", String(U.value))}`,
4532
+ "aria-current": L.index + 1 === f.value ? "page" : void 0,
4533
+ style: We({ height: `${L.height + 20}px` }),
4534
+ onClick: (me) => Ee(L.index + 1)
4535
+ }, [
4536
+ p("span", {
4537
+ class: "mrp-thumb-box",
4538
+ "data-thumb": L.index + 1,
4539
+ style: We({ height: `${L.height}px` })
4540
+ }, null, 12, au),
4541
+ p("span", su, y(L.index + 1), 1)
4542
+ ], 14, nu))), 128)),
4543
+ u(Le).windowRange.value.padBottomPx > 0 ? (w(), P("div", {
4544
+ key: 1,
4545
+ class: "mrp-thumb-spacer",
4546
+ style: We({ height: `${u(Le).windowRange.value.padBottomPx}px` }),
4547
+ "aria-hidden": "true"
4548
+ }, null, 4)) : N("", !0)
4549
+ ], 544)) : N("", !0)
4550
+ ]),
4551
+ U.value > 0 ? (w(), P("footer", ou, [
4552
+ p("div", ru, [
4553
+ u(C).navigation !== !1 ? (w(), Se(Wo, {
4554
+ key: 0,
4555
+ plan: a.value,
4556
+ "current-page": f.value,
4557
+ messages: u(B),
4558
+ busy: r.value || R.value || u(W).saving.value,
4559
+ onGoto: Ee
4560
+ }, null, 8, ["plan", "current-page", "messages", "busy"])) : N("", !0),
4561
+ Ft.value && u(je) ? (w(), P("button", {
4562
+ key: 1,
4563
+ class: "mrp-calculation-toggle",
4564
+ type: "button",
4565
+ "aria-label": zt.value.calculationTitle,
4566
+ onClick: va
4567
+ }, [
4568
+ I[15] || (I[15] = p("span", { "aria-hidden": "true" }, "∑", -1)),
4569
+ ie(y(zt.value.calculationTitle), 1),
4570
+ u(Lt).result.value ? (w(), P("strong", iu, y(u(Lt).result.value.formatted), 1)) : N("", !0)
4571
+ ], 8, lu)) : N("", !0)
4572
+ ]),
4573
+ Q(oa, {
4574
+ "page-count": U.value,
4575
+ "current-page": f.value,
4576
+ messages: u(B),
4577
+ busy: r.value || R.value || u(W).saving.value,
4578
+ onGoto: Ee
4579
+ }, null, 8, ["page-count", "current-page", "messages", "busy"])
4580
+ ])) : N("", !0),
4581
+ p("div", uu, [
4582
+ ht(c.$slots, "default", {}, void 0, !0)
4583
+ ]),
4584
+ u(_e) ? (w(), P("div", cu, [
4585
+ I[16] || (I[16] = p("div", null, "mach-report debug", -1)),
4586
+ p("div", null, "pages: " + y(u(_e).pages) + " | window: [" + y(u(_e).window) + "]", 1),
4587
+ p("div", null, "zoom: " + y(u(_e).zoom) + " | load: " + y(u(_e).loadMs), 1),
4588
+ p("div", null, "plan: " + y(u(_e).planKB) + "KB", 1)
4589
+ ])) : N("", !0)
4590
+ ], 6));
4591
+ }
4592
+ }), fu = /* @__PURE__ */ we(du, [["__scopeId", "data-v-f730d664"]]), Iu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4593
+ __proto__: null,
4594
+ default: fu
4595
+ }, Symbol.toStringTag, { value: "Module" }));
4596
+ export {
4597
+ Yt as P,
4598
+ sn as R,
4599
+ Vn as a,
4600
+ oa as b,
4601
+ Oe as c,
4602
+ fu as d,
4603
+ Pe as e,
4604
+ Do as f,
4605
+ Os as g,
4606
+ Cu as h,
4607
+ El as i,
4608
+ $u as j,
4609
+ xl as k,
4610
+ Eu as l,
4611
+ ku as m,
4612
+ ea as n,
4613
+ Ds as o,
4614
+ na as p,
4615
+ As as q,
4616
+ Ps as r,
4617
+ Iu as s,
4618
+ Es as u
4619
+ };