@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.
- package/README.md +20 -7
- package/THIRD_PARTY_NOTICES.md +3 -1
- package/dist/ExcelBindingWizard-BKH1nGNS.js +1485 -0
- package/dist/ExcelBindingWizard-Bs43BGNp.cjs +1 -0
- package/dist/ParamEditor-Da4akw6V.cjs +1 -0
- package/dist/ParamEditor-DoAhzJsm.js +594 -0
- package/dist/{ReportBatchPanel-CW2HV9I8.js → ReportBatchPanel-BMf6boMA.js} +39 -39
- package/dist/ReportBatchPanel-wP9m9Pj1.cjs +1 -0
- package/dist/ReportPreview-ChV19HBp.js +4619 -0
- package/dist/ReportPreview-DbLvvOUT.cjs +6 -0
- package/dist/{ReportTemplateLibrary-BZB-XWjj.js → ReportTemplateLibrary-C9wutIiT.js} +1 -1
- package/dist/ReportTemplateLibrary-Sxr3eD0J.cjs +1 -0
- package/dist/RuleEditor-C_Clasvd.js +2037 -0
- package/dist/RuleEditor-XhGHK8DE.cjs +1 -0
- package/dist/TemplateOutlinePanel-D6Bkny59.js +96 -0
- package/dist/TemplateOutlinePanel-JTSR53vJ.cjs +1 -0
- package/dist/TemplateReusePanel-Kx35S0Ql.cjs +1 -0
- package/dist/TemplateReusePanel-rVuK1kTz.js +388 -0
- package/dist/TemplateReviewPanel-B0ar9_zf.js +592 -0
- package/dist/TemplateReviewPanel-Dn6X9UmY.cjs +1 -0
- package/dist/analytics.cjs +1 -1
- package/dist/analytics.d.cts +3 -1
- package/dist/analytics.d.ts +3 -1
- package/dist/analytics.js +154 -60
- package/dist/artifact-integrity.json +135 -0
- package/dist/assets-B9ImAi6_.cjs +1 -0
- package/dist/assets-DEaz4qsp.js +124 -0
- package/dist/batch-BaP6pWDE.cjs +1 -0
- package/dist/batch-BfZHN1do.js +220 -0
- package/dist/batch-CGyt-b2W.js +273 -0
- package/dist/batch-CLpELXBl.cjs +1 -0
- package/dist/capabilities-CAh2Nrue.cjs +1 -0
- package/dist/capabilities-DskCHs3V.js +69 -0
- package/dist/codes.d.cts +2 -0
- package/dist/codes.d.ts +2 -0
- package/dist/{computed-Bvk0W15F.js → computed-C-4C2S5h.js} +3 -3
- package/dist/config-BVsJXSqS.js +842 -0
- package/dist/config-D10us76d.cjs +1 -0
- package/dist/data-explanation-B8MZRYVS.js +16 -0
- package/dist/data-explanation-DE55G30w.cjs +1 -0
- package/dist/designer-2bDlcNXQ.js +5136 -0
- package/dist/designer-BT7XCdbW.cjs +2 -0
- package/dist/designer.cjs +1 -2
- package/dist/designer.d.cts +432 -17
- package/dist/designer.d.ts +432 -17
- package/dist/designer.js +21 -4312
- package/dist/drill-ByJviLXS.js +145 -0
- package/dist/drill-DYTxuL3A.cjs +1 -0
- package/dist/font-loader-B_UkxpzC.cjs +1 -0
- package/dist/font-loader-Q3bQjmrI.js +297 -0
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +239 -5
- package/dist/index.d.ts +239 -5
- package/dist/index.js +939 -893
- package/dist/json-snapshot-DFb2eWkf.js +1416 -0
- package/dist/json-snapshot-WWSGlaHG.cjs +2 -0
- package/dist/licenses/_bwip-js_generic-4.11.4.txt +24 -0
- package/dist/licenses/_fast-csv_format-4.3.5.txt +22 -0
- package/dist/licenses/_fast-csv_parse-4.3.6.txt +22 -0
- package/dist/licenses/_pdf-lib_fontkit-1.1.1.txt +326 -0
- package/dist/licenses/_pdf-lib_standard-fonts-1.0.0.txt +22 -0
- package/dist/licenses/_pdf-lib_upng-1.0.1.txt +22 -0
- package/dist/licenses/_types_node-14.18.63.txt +22 -0
- package/dist/licenses/_types_pako-2.0.3.txt +22 -0
- package/dist/licenses/_types_pegjs-0.10.6.txt +22 -0
- package/dist/licenses/archiver-5.3.2.txt +23 -0
- package/dist/licenses/archiver-utils-2.1.0.txt +23 -0
- package/dist/licenses/archiver-utils-3.0.4.txt +23 -0
- package/dist/licenses/async-3.2.6.txt +20 -0
- package/dist/licenses/balanced-match-1.0.2.txt +22 -0
- package/dist/licenses/base64-js-1.5.1.txt +22 -0
- package/dist/licenses/big-integer-1.6.52.txt +25 -0
- package/dist/licenses/binary-0.3.0.txt +178 -0
- package/dist/licenses/bl-4.1.0.txt +14 -0
- package/dist/licenses/bluebird-3.4.7.txt +22 -0
- package/dist/licenses/brace-expansion-1.1.21.txt +22 -0
- package/dist/licenses/brace-expansion-2.1.7.txt +22 -0
- package/dist/licenses/buffer-5.7.1.txt +22 -0
- package/dist/licenses/buffer-crc32-0.2.13.txt +20 -0
- package/dist/licenses/buffer-indexof-polyfill-1.0.2.txt +23 -0
- package/dist/licenses/buffers-0.1.1.txt +140 -0
- package/dist/licenses/chainsaw-0.1.0.txt +184 -0
- package/dist/licenses/compress-commons-4.1.2.txt +23 -0
- package/dist/licenses/concat-map-0.0.1.txt +19 -0
- package/dist/licenses/core-util-is-1.0.3.txt +20 -0
- package/dist/licenses/crc-32-1.2.2.txt +202 -0
- package/dist/licenses/crc32-stream-4.0.3.txt +23 -0
- package/dist/licenses/dayjs-1.11.23.txt +22 -0
- package/dist/licenses/duplexer2-0.1.4.txt +27 -0
- package/dist/licenses/end-of-stream-1.4.5.txt +22 -0
- package/dist/licenses/exceljs-4.4.0.txt +23 -0
- package/dist/licenses/fast-csv-4.3.6.txt +22 -0
- package/dist/licenses/fast-png-6.4.0.txt +22 -0
- package/dist/licenses/fs-constants-1.0.0.txt +22 -0
- package/dist/licenses/fs.realpath-1.0.0.txt +44 -0
- package/dist/licenses/fstream-1.0.12.txt +16 -0
- package/dist/licenses/glob-7.2.3.txt +22 -0
- package/dist/licenses/graceful-fs-4.2.11.txt +16 -0
- package/dist/licenses/ieee754-1.2.1.txt +12 -0
- package/dist/licenses/immediate-3.0.6.txt +21 -0
- package/dist/licenses/inflight-1.0.6.txt +16 -0
- package/dist/licenses/inherits-2.0.4.txt +17 -0
- package/dist/licenses/iobuffer-5.4.0.txt +23 -0
- package/dist/licenses/isarray-1.0.0.txt +61 -0
- package/dist/licenses/jszip-3.10.2.txt +652 -0
- package/dist/licenses/lazystream-1.0.1.txt +24 -0
- package/dist/licenses/lie-3.3.0.txt +8 -0
- package/dist/licenses/listenercount-1.0.1.txt +6 -0
- package/dist/licenses/lodash.defaults-4.2.0.txt +48 -0
- package/dist/licenses/lodash.difference-4.5.0.txt +48 -0
- package/dist/licenses/lodash.escaperegexp-4.1.2.txt +48 -0
- package/dist/licenses/lodash.flatten-4.4.0.txt +48 -0
- package/dist/licenses/lodash.groupby-4.6.0.txt +48 -0
- package/dist/licenses/lodash.isboolean-3.0.3.txt +23 -0
- package/dist/licenses/lodash.isequal-4.5.0.txt +48 -0
- package/dist/licenses/lodash.isfunction-3.0.9.txt +48 -0
- package/dist/licenses/lodash.isnil-4.0.0.txt +23 -0
- package/dist/licenses/lodash.isplainobject-4.0.6.txt +48 -0
- package/dist/licenses/lodash.isundefined-3.0.1.txt +23 -0
- package/dist/licenses/lodash.union-4.6.0.txt +48 -0
- package/dist/licenses/lodash.uniq-4.5.0.txt +48 -0
- package/dist/licenses/minimatch-3.1.5.txt +16 -0
- package/dist/licenses/minimatch-5.1.9.txt +16 -0
- package/dist/licenses/minimist-1.2.8.txt +19 -0
- package/dist/licenses/mkdirp-0.5.6.txt +22 -0
- package/dist/licenses/node-sql-parser-5.4.0.txt +202 -0
- package/dist/licenses/normalize-path-3.0.0.txt +22 -0
- package/dist/licenses/once-1.4.0.txt +16 -0
- package/dist/licenses/pako-1.0.11.txt +22 -0
- package/dist/licenses/pako-2.2.0.txt +22 -0
- package/dist/licenses/path-is-absolute-1.0.1.txt +22 -0
- package/dist/licenses/pdf-lib-1.17.1.txt +22 -0
- package/dist/licenses/process-nextick-args-2.0.1.txt +20 -0
- package/dist/licenses/readable-stream-2.3.8.txt +48 -0
- package/dist/licenses/readable-stream-3.6.2.txt +48 -0
- package/dist/licenses/readdir-glob-1.1.3.txt +202 -0
- package/dist/licenses/rimraf-2.7.1.txt +16 -0
- package/dist/licenses/safe-buffer-5.1.2.txt +22 -0
- package/dist/licenses/safe-buffer-5.2.1.txt +22 -0
- package/dist/licenses/saxes-5.0.1.txt +397 -0
- package/dist/licenses/setimmediate-1.0.5.txt +21 -0
- package/dist/licenses/string_decoder-1.1.1.txt +49 -0
- package/dist/licenses/string_decoder-1.3.0.txt +49 -0
- package/dist/licenses/tar-stream-2.2.0.txt +22 -0
- package/dist/licenses/tmp-0.2.7.txt +22 -0
- package/dist/licenses/traverse-0.3.9.txt +25 -0
- package/dist/licenses/tslib-1.14.1.txt +13 -0
- package/dist/licenses/unzipper-0.10.14.txt +26 -0
- package/dist/licenses/util-deprecate-1.0.2.txt +25 -0
- package/dist/licenses/uuid-11.1.1.txt +10 -0
- package/dist/licenses/wrappy-1.0.2.txt +16 -0
- package/dist/licenses/xmlchars-2.2.0.txt +19 -0
- package/dist/licenses/zip-stream-4.1.1.txt +23 -0
- package/dist/matrix-CGRGkn5s.js +112 -0
- package/dist/matrix-gEO7ZM_u.cjs +1 -0
- package/dist/media-B7vnpD8k.cjs +1 -0
- package/dist/media-Y90dHK9z.js +70 -0
- package/dist/param-validation-C3HlcLLO.cjs +1 -0
- package/dist/param-validation-Do7Eg8Zv.js +181 -0
- package/dist/pdf-BwNyeGpt.js +36352 -0
- package/dist/pdf-CvvrjPQg.cjs +103 -0
- package/dist/pdf.cjs +1 -101
- package/dist/pdf.d.cts +18 -3
- package/dist/pdf.d.ts +18 -3
- package/dist/pdf.js +9 -36579
- package/dist/plugin-Ca_XZG3l.js +22 -0
- package/dist/{plugin-DzS6pxTA.cjs → plugin-DHO7X8z2.cjs} +1 -1
- package/dist/prepared-CFy9B75C.cjs +1 -0
- package/dist/prepared-ajM-H-9B.js +69 -0
- package/dist/progress-B0ctFpKf.cjs +1 -0
- package/dist/progress-D-OTpEav.js +52 -0
- package/dist/{record-bindings-D-5jQlTj.js → record-bindings-Do_b3h4V.js} +1 -1
- package/dist/{region-binding-workflow-CcUq8W2Q.js → region-binding-workflow-BMhK_TjP.js} +1 -1
- package/dist/{region-binding-workflow-BzfbxRiR.cjs → region-binding-workflow-DIYJdCUr.cjs} +1 -1
- package/dist/{report-params-B44imUd4.js → report-params-B1RzkhJj.js} +1 -1
- package/dist/{report-params-SJfhKgaX.cjs → report-params-WDGrA4oP.cjs} +1 -1
- package/dist/sbom.cdx.json +3982 -0
- package/dist/server/node.d.cts +66 -12
- package/dist/server/node.d.ts +66 -12
- package/dist/server-node.cjs +1 -1
- package/dist/server-node.js +405 -381
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +878 -15
- package/dist/server.d.ts +878 -15
- package/dist/server.js +1034 -534
- package/dist/sha256-ArEYjaTI.cjs +1 -0
- package/dist/sha256-DPEuJ3nh.js +155 -0
- package/dist/style.css +1 -1
- package/dist/template-bindings-C2SpvsMU.js +58 -0
- package/dist/template-bindings-CEtWyiLX.cjs +1 -0
- package/dist/template-catalog-FJE_c9Qe.cjs +1 -0
- package/dist/template-catalog-j2B1MJlL.js +414 -0
- package/dist/template-fragments-BGbQLGlV.js +187 -0
- package/dist/template-fragments-DcKeiylI.cjs +1 -0
- package/dist/template-outline-BwRV_eRo.cjs +1 -0
- package/dist/template-outline-cnWfT_LK.js +88 -0
- package/dist/{template-registry-BjE1VS6g.js → template-registry-BtaKPELV.js} +364 -201
- package/dist/template-registry-Co1zPq5e.cjs +1 -0
- package/dist/textwrap-CWHyzkBH.cjs +4 -0
- package/dist/textwrap-DE1kgcJB.js +110 -0
- package/dist/{tree-CqcQ99NM.js → tree-CjVZLRw7.js} +1 -1
- package/dist/{useLocalDraft-C07SYRnC.js → useLocalDraft-BnhcxXk_.js} +1 -1
- package/dist/{useLocalDraft-Yiw1wFgI.cjs → useLocalDraft-CioIfDb6.cjs} +1 -1
- package/dist/vue/async.d.cts +190 -15
- package/dist/vue/async.d.ts +190 -15
- package/dist/vue/index.d.cts +274 -24
- package/dist/vue/index.d.ts +274 -24
- package/dist/vue-async.cjs +1 -1
- package/dist/vue-async.js +5 -5
- package/dist/vue.cjs +1 -1
- package/dist/vue.js +90 -81
- package/dist/{workbook-session-DNa2RHNG.cjs → workbook-session-Bjv1YCRK.cjs} +18 -18
- package/dist/{workbook-session-BPb3TMnT.js → workbook-session-BvToI-Fd.js} +5440 -5288
- package/dist/worker.cjs +1 -1
- package/dist/worker.d.cts +66 -12
- package/dist/worker.d.ts +66 -12
- package/dist/worker.js +61 -56
- package/dist/xlsx-node.cjs +34 -34
- package/dist/xlsx-node.js +878 -870
- package/dist/xlsx.cjs +3 -4
- package/dist/xlsx.d.cts +22 -10
- package/dist/xlsx.d.ts +22 -10
- package/dist/xlsx.js +261 -253
- package/package.json +2 -2
- package/dist/ExcelBindingWizard-CeAf4QSE.js +0 -1465
- package/dist/ExcelBindingWizard-y0mT-AHR.cjs +0 -1
- package/dist/ParamEditor-BLaE5q5W.js +0 -522
- package/dist/ParamEditor-MBBC7lUE.cjs +0 -1
- package/dist/ReportBatchPanel-Fp1ePFag.cjs +0 -1
- package/dist/ReportPreview-BN6fk7Wz.cjs +0 -6
- package/dist/ReportPreview-D2Jkyh1U.js +0 -4243
- package/dist/ReportTemplateLibrary-5fk5CQBO.cjs +0 -1
- package/dist/RuleEditor-ChRzNQuF.cjs +0 -1
- package/dist/RuleEditor-DzAmW5YH.js +0 -2024
- package/dist/TemplateReviewPanel-BKofGrV9.js +0 -222
- package/dist/TemplateReviewPanel-DwtOcLue.cjs +0 -1
- package/dist/assets-C2U-e-Sz.cjs +0 -4
- package/dist/assets-Q0wUwNrV.js +0 -217
- package/dist/batch-Bt3Fd27Z.cjs +0 -1
- package/dist/batch-mRqhhhjt.js +0 -364
- package/dist/capabilities-CK_7hizc.js +0 -63
- package/dist/capabilities-CsZ-pNHR.cjs +0 -1
- package/dist/config-Bb7RiIO5.cjs +0 -1
- package/dist/config-XVwG87IA.js +0 -529
- package/dist/matrix-DVyWiYsd.cjs +0 -1
- package/dist/matrix-yZsGnldA.js +0 -227
- package/dist/page-window-index-CIuT4BAv.js +0 -43
- package/dist/page-window-index-DEjnM6IB.cjs +0 -1
- package/dist/param-validation-BlHHXs6u.js +0 -153
- package/dist/param-validation-DCK039V1.cjs +0 -1
- package/dist/plugin-D4wizDXB.js +0 -22
- package/dist/progress-7OSZbFok.js +0 -39
- package/dist/progress-BnLiS5eH.cjs +0 -1
- package/dist/task-events-DQ276fn2.cjs +0 -1
- package/dist/task-events-Dpsvf_t2.js +0 -47
- package/dist/template-registry-D3SjENi6.cjs +0 -1
- package/dist/template-review-DGwWOoCv.cjs +0 -2
- package/dist/template-review-PgEe_Wr9.js +0 -1742
- package/dist/validate-BJ5HIWY8.cjs +0 -1
- package/dist/validate-DbgEM1Hh.js +0 -163
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { shallowRef as q, ref as x, computed as M, watch as V, onBeforeUnmount as D, defineComponent as O, openBlock as o, createElementBlock as n, unref as a, createElementVNode as l, toDisplayString as e, createTextVNode as R, withDirectives as z, isRef as B, vModelSelect as P, createCommentVNode as d, Fragment as S, normalizeClass as j, renderList as I, vModelCheckbox as U } from "vue";
|
|
2
|
-
import { reviewReportTemplate as A } from "@agile-team/mach-report";
|
|
3
|
-
import { TEMPLATE_REVIEW_MESSAGES as L } from "./designer.js";
|
|
4
|
-
import { _ as $ } from "./_plugin-vue_export-helper-8SL1F89S.js";
|
|
5
|
-
function F(u) {
|
|
6
|
-
const g = q(), f = x("20"), k = x(!1), t = x(!1), i = x(!1), h = x(""), b = q(), y = M(() => new Set(u.document.template.pages.flatMap((r) => r.components).flatMap((r) => r.kind === "list" && r.tree ? [r.dataset] : []))), w = M(() => y.value.size > 0);
|
|
7
|
-
let p = 0, c;
|
|
8
|
-
function C() {
|
|
9
|
-
p++, clearTimeout(c), t.value = !1, i.value = !!g.value, h.value = "";
|
|
10
|
-
}
|
|
11
|
-
for (const r of [() => u.document, () => u.previous]) V(r, () => {
|
|
12
|
-
k.value = !1, C();
|
|
13
|
-
}, { deep: !0, flush: "sync" });
|
|
14
|
-
for (const r of [() => u.datasets, () => u.dataSchemas, () => u.formats]) V(r, C, { deep: !0, flush: "sync" });
|
|
15
|
-
V([f, k], C, { flush: "sync" }), D(() => {
|
|
16
|
-
p++, clearTimeout(c);
|
|
17
|
-
});
|
|
18
|
-
const T = M(() => g.value?.issues.filter((r) => r.severity === "error").length ?? 0);
|
|
19
|
-
function E() {
|
|
20
|
-
clearTimeout(c);
|
|
21
|
-
const r = p;
|
|
22
|
-
t.value = !0, h.value = "", c = setTimeout(() => {
|
|
23
|
-
if (r !== p) return;
|
|
24
|
-
const m = Number(f.value), v = Object.fromEntries(Object.entries(u.datasets ?? {}).map(([s, _]) => [s, m < 0 || y.value.has(s) ? _ : _.slice(0, m)]));
|
|
25
|
-
try {
|
|
26
|
-
const s = A(u.document, {
|
|
27
|
-
previous: u.previous,
|
|
28
|
-
dataSchemas: u.dataSchemas,
|
|
29
|
-
formats: u.formats,
|
|
30
|
-
allowBreakingChanges: k.value,
|
|
31
|
-
...w.value && m > 0 ? { maxSampleRows: m } : {},
|
|
32
|
-
fixtures: m === 0 ? [] : [{ name: f.value, datasets: v }]
|
|
33
|
-
});
|
|
34
|
-
if (r !== p) return;
|
|
35
|
-
g.value = s, i.value = !1, b.value = { requested: f.value, rows: s.samples.reduce((_, N) => _ + N.rows, 0), datasets: m === 0 ? 0 : Object.keys(v).length, formats: [...u.formats ?? []] };
|
|
36
|
-
} catch (s) {
|
|
37
|
-
h.value = s instanceof Error ? s.message : String(s);
|
|
38
|
-
} finally {
|
|
39
|
-
r === p && (t.value = !1);
|
|
40
|
-
}
|
|
41
|
-
}, 0);
|
|
42
|
-
}
|
|
43
|
-
return { report: g, sampleSize: f, acknowledged: k, running: t, stale: i, failure: h, checkedScope: b, hasTree: w, errors: T, run: E };
|
|
44
|
-
}
|
|
45
|
-
const G = ["aria-label", "aria-busy"], H = ["disabled"], W = { class: "mr-review-controls" }, J = ["aria-label", "disabled"], K = { value: "0" }, Q = { value: "20" }, X = { value: "100" }, Y = { value: "-1" }, Z = {
|
|
46
|
-
key: 0,
|
|
47
|
-
class: "mr-review-note"
|
|
48
|
-
}, ee = {
|
|
49
|
-
key: 1,
|
|
50
|
-
class: "is-error",
|
|
51
|
-
role: "alert"
|
|
52
|
-
}, te = {
|
|
53
|
-
key: 2,
|
|
54
|
-
class: "mr-review-stale",
|
|
55
|
-
role: "status"
|
|
56
|
-
}, se = {
|
|
57
|
-
key: 3,
|
|
58
|
-
class: "mr-review-note"
|
|
59
|
-
}, ae = {
|
|
60
|
-
key: 0,
|
|
61
|
-
class: "mr-review-summary",
|
|
62
|
-
role: "status"
|
|
63
|
-
}, le = {
|
|
64
|
-
key: 0,
|
|
65
|
-
class: "mr-review-note"
|
|
66
|
-
}, oe = {
|
|
67
|
-
key: 1,
|
|
68
|
-
class: "mr-review-note"
|
|
69
|
-
}, ne = {
|
|
70
|
-
key: 2,
|
|
71
|
-
class: "mr-review-list"
|
|
72
|
-
}, re = { key: 0 }, ue = ["onClick"], ie = {
|
|
73
|
-
key: 3,
|
|
74
|
-
class: "mr-review-note"
|
|
75
|
-
}, ce = {
|
|
76
|
-
key: 4,
|
|
77
|
-
class: "mr-review-ack"
|
|
78
|
-
}, ve = {
|
|
79
|
-
key: 0,
|
|
80
|
-
class: "mr-review-note"
|
|
81
|
-
}, de = {
|
|
82
|
-
key: 1,
|
|
83
|
-
class: "mr-review-list"
|
|
84
|
-
}, me = ["onClick"], pe = {
|
|
85
|
-
key: 0,
|
|
86
|
-
class: "mr-review-scope"
|
|
87
|
-
}, fe = { key: 0 }, he = { class: "mr-review-note" }, _e = /* @__PURE__ */ O({
|
|
88
|
-
__name: "TemplateReviewPanel",
|
|
89
|
-
props: {
|
|
90
|
-
document: {},
|
|
91
|
-
previous: {},
|
|
92
|
-
datasets: {},
|
|
93
|
-
dataSchemas: {},
|
|
94
|
-
formats: {},
|
|
95
|
-
messages: {}
|
|
96
|
-
},
|
|
97
|
-
emits: ["locate"],
|
|
98
|
-
setup(u, { emit: g }) {
|
|
99
|
-
const f = u, k = g, t = M(() => ({ ...L, ...f.messages })), { report: i, sampleSize: h, acknowledged: b, running: y, stale: w, failure: p, checkedScope: c, hasTree: C, errors: T, run: E } = F(f);
|
|
100
|
-
function r(m) {
|
|
101
|
-
const v = /\.pages\[(\d+)\]\.components\[(\d+)\]/.exec(m);
|
|
102
|
-
k("locate", { path: m, ...v ? { pageIndex: Number(v[1]), componentIndex: Number(v[2]) } : {} });
|
|
103
|
-
}
|
|
104
|
-
return (m, v) => (o(), n("section", {
|
|
105
|
-
class: "mr-template-review",
|
|
106
|
-
"aria-label": t.value.title,
|
|
107
|
-
"aria-busy": a(y)
|
|
108
|
-
}, [
|
|
109
|
-
l("header", null, [
|
|
110
|
-
l("strong", null, e(t.value.title), 1),
|
|
111
|
-
l("button", {
|
|
112
|
-
type: "button",
|
|
113
|
-
disabled: a(y),
|
|
114
|
-
onClick: v[0] || (v[0] = //@ts-ignore
|
|
115
|
-
(...s) => a(E) && a(E)(...s))
|
|
116
|
-
}, e(a(y) ? t.value.running : t.value.run), 9, H)
|
|
117
|
-
]),
|
|
118
|
-
l("div", W, [
|
|
119
|
-
l("label", null, [
|
|
120
|
-
R(e(t.value.samples), 1),
|
|
121
|
-
z(l("select", {
|
|
122
|
-
"onUpdate:modelValue": v[1] || (v[1] = (s) => B(h) ? h.value = s : null),
|
|
123
|
-
"aria-label": t.value.samples,
|
|
124
|
-
disabled: a(y)
|
|
125
|
-
}, [
|
|
126
|
-
l("option", K, e(t.value.none), 1),
|
|
127
|
-
l("option", Q, e(t.value.first20), 1),
|
|
128
|
-
l("option", X, e(t.value.first100), 1),
|
|
129
|
-
l("option", Y, e(t.value.all), 1)
|
|
130
|
-
], 8, J), [
|
|
131
|
-
[P, a(h)]
|
|
132
|
-
])
|
|
133
|
-
])
|
|
134
|
-
]),
|
|
135
|
-
a(C) ? (o(), n("p", Z, e(t.value.treeHint), 1)) : d("", !0),
|
|
136
|
-
a(p) ? (o(), n("p", ee, e(a(p)), 1)) : d("", !0),
|
|
137
|
-
a(w) ? (o(), n("p", te, e(t.value.stale), 1)) : d("", !0),
|
|
138
|
-
a(i) ? (o(), n(S, { key: 4 }, [
|
|
139
|
-
a(w) ? d("", !0) : (o(), n("div", ae, [
|
|
140
|
-
l("span", {
|
|
141
|
-
class: j({ "is-error": a(T) })
|
|
142
|
-
}, e(a(T)) + " " + e(t.value.errors), 3),
|
|
143
|
-
l("span", null, e(a(i).issues.length - a(T)) + " " + e(t.value.warnings), 1)
|
|
144
|
-
])),
|
|
145
|
-
l("section", null, [
|
|
146
|
-
l("h3", null, [
|
|
147
|
-
R(e(t.value.changes) + " ", 1),
|
|
148
|
-
l("small", null, e(a(i).changes?.totalChanges ?? 0), 1)
|
|
149
|
-
]),
|
|
150
|
-
u.previous ? a(i).changes?.totalChanges ? (o(), n("ol", ne, [
|
|
151
|
-
(o(!0), n(S, null, I(a(i).changes?.changes, (s, _) => (o(), n("li", { key: _ }, [
|
|
152
|
-
l("div", null, [
|
|
153
|
-
l("span", null, e(t.value.categories[s.category]) + " · " + e(t.value.kinds[s.kind]), 1),
|
|
154
|
-
s.breaking ? (o(), n("b", re, e(t.value.breaking), 1)) : d("", !0),
|
|
155
|
-
l("button", {
|
|
156
|
-
type: "button",
|
|
157
|
-
onClick: (N) => r(s.path)
|
|
158
|
-
}, e(t.value.locate), 9, ue)
|
|
159
|
-
]),
|
|
160
|
-
l("code", null, e(s.path), 1),
|
|
161
|
-
l("dl", null, [
|
|
162
|
-
s.before !== void 0 ? (o(), n(S, { key: 0 }, [
|
|
163
|
-
l("dt", null, e(t.value.before), 1),
|
|
164
|
-
l("dd", null, e(s.before), 1)
|
|
165
|
-
], 64)) : d("", !0),
|
|
166
|
-
s.after !== void 0 ? (o(), n(S, { key: 1 }, [
|
|
167
|
-
l("dt", null, e(t.value.after), 1),
|
|
168
|
-
l("dd", null, e(s.after), 1)
|
|
169
|
-
], 64)) : d("", !0)
|
|
170
|
-
])
|
|
171
|
-
]))), 128))
|
|
172
|
-
])) : (o(), n("p", oe, e(t.value.noChanges), 1)) : (o(), n("p", le, e(t.value.baseline), 1)),
|
|
173
|
-
a(i).changes?.truncated ? (o(), n("p", ie, e(t.value.truncated), 1)) : d("", !0),
|
|
174
|
-
a(i).changes?.breakingChanges ? (o(), n("label", ce, [
|
|
175
|
-
z(l("input", {
|
|
176
|
-
"onUpdate:modelValue": v[2] || (v[2] = (s) => B(b) ? b.value = s : null),
|
|
177
|
-
type: "checkbox"
|
|
178
|
-
}, null, 512), [
|
|
179
|
-
[U, a(b)]
|
|
180
|
-
]),
|
|
181
|
-
R(e(t.value.acknowledge), 1)
|
|
182
|
-
])) : d("", !0)
|
|
183
|
-
]),
|
|
184
|
-
l("section", null, [
|
|
185
|
-
l("h3", null, e(t.value.issues), 1),
|
|
186
|
-
a(i).issues.length ? (o(), n("ol", de, [
|
|
187
|
-
(o(!0), n(S, null, I(a(i).issues, (s, _) => (o(), n("li", { key: _ }, [
|
|
188
|
-
l("div", null, [
|
|
189
|
-
l("span", {
|
|
190
|
-
class: j({ "is-error": s.severity === "error" })
|
|
191
|
-
}, e(s.severity === "error" ? t.value.errors : t.value.warnings), 3),
|
|
192
|
-
l("button", {
|
|
193
|
-
type: "button",
|
|
194
|
-
onClick: (N) => k("locate", s)
|
|
195
|
-
}, e(t.value.locate), 9, me)
|
|
196
|
-
]),
|
|
197
|
-
l("p", null, e(s.message), 1),
|
|
198
|
-
l("code", null, e(s.path), 1)
|
|
199
|
-
]))), 128))
|
|
200
|
-
])) : (o(), n("p", ve, e(t.value.noIssues), 1))
|
|
201
|
-
]),
|
|
202
|
-
a(i).samples.length ? (o(), n("section", {
|
|
203
|
-
key: 1,
|
|
204
|
-
class: j({ "is-stale": a(w) })
|
|
205
|
-
}, [
|
|
206
|
-
l("h3", null, e(t.value.results), 1),
|
|
207
|
-
a(c) ? (o(), n("p", pe, [
|
|
208
|
-
R(e(t.value.scope) + " · " + e(a(c).requested === "-1" ? t.value.all : a(c).requested === "0" ? t.value.none : a(c).requested + " " + t.value.rows) + " · " + e(a(c).datasets) + " " + e(t.value.datasets) + " · " + e(a(c).rows) + " " + e(t.value.rows), 1),
|
|
209
|
-
a(c).formats.length ? (o(), n("span", fe, " · " + e(a(c).formats.join(" / ")), 1)) : d("", !0)
|
|
210
|
-
])) : d("", !0),
|
|
211
|
-
(o(!0), n(S, null, I(a(i).samples, (s) => (o(), n("p", {
|
|
212
|
-
key: s.name
|
|
213
|
-
}, e(s.name) + " · " + e(s.rows) + " " + e(t.value.rows) + " · " + e(s.pages) + " " + e(t.value.pages), 1))), 128))
|
|
214
|
-
], 2)) : d("", !0),
|
|
215
|
-
l("p", he, e(t.value.checked), 1)
|
|
216
|
-
], 64)) : (o(), n("p", se, e(t.value.empty), 1))
|
|
217
|
-
], 8, G));
|
|
218
|
-
}
|
|
219
|
-
}), we = /* @__PURE__ */ $(_e, [["__scopeId", "data-v-6d26056b"]]);
|
|
220
|
-
export {
|
|
221
|
-
we as default
|
|
222
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),_=require("@agile-team/mach-report"),B=require("./designer.cjs"),V=require("./_plugin-vue_export-helper-BLmdZLlg.cjs");function D(o){const f=e.shallowRef(),u=e.ref("20"),p=e.ref(!1),t=e.ref(!1),a=e.ref(!1),m=e.ref(""),k=e.shallowRef(),v=e.computed(()=>new Set(o.document.template.pages.flatMap(n=>n.components).flatMap(n=>n.kind==="list"&&n.tree?[n.dataset]:[]))),g=e.computed(()=>v.value.size>0);let i=0,r;function y(){i++,clearTimeout(r),t.value=!1,a.value=!!f.value,m.value=""}for(const n of[()=>o.document,()=>o.previous])e.watch(n,()=>{p.value=!1,y()},{deep:!0,flush:"sync"});for(const n of[()=>o.datasets,()=>o.dataSchemas,()=>o.formats])e.watch(n,y,{deep:!0,flush:"sync"});e.watch([u,p],y,{flush:"sync"}),e.onBeforeUnmount(()=>{i++,clearTimeout(r)});const E=e.computed(()=>f.value?.issues.filter(n=>n.severity==="error").length??0);function S(){clearTimeout(r);const n=i;t.value=!0,m.value="",r=setTimeout(()=>{if(n!==i)return;const c=Number(u.value),s=Object.fromEntries(Object.entries(o.datasets??{}).map(([l,d])=>[l,c<0||v.value.has(l)?d:d.slice(0,c)]));try{const l=_.reviewReportTemplate(o.document,{previous:o.previous,dataSchemas:o.dataSchemas,formats:o.formats,allowBreakingChanges:p.value,...g.value&&c>0?{maxSampleRows:c}:{},fixtures:c===0?[]:[{name:u.value,datasets:s}]});if(n!==i)return;f.value=l,a.value=!1,k.value={requested:u.value,rows:l.samples.reduce((d,h)=>d+h.rows,0),datasets:c===0?0:Object.keys(s).length,formats:[...o.formats??[]]}}catch(l){m.value=l instanceof Error?l.message:String(l)}finally{n===i&&(t.value=!1)}},0)}return{report:f,sampleSize:u,acknowledged:p,running:t,stale:a,failure:m,checkedScope:k,hasTree:g,errors:E,run:S}}const N=["aria-label","aria-busy"],w=["disabled"],b={class:"mr-review-controls"},C=["aria-label","disabled"],T={value:"0"},x={value:"20"},R={value:"100"},q={value:"-1"},M={key:0,class:"mr-review-note"},j={key:1,class:"is-error",role:"alert"},z={key:2,class:"mr-review-stale",role:"status"},F={key:3,class:"mr-review-note"},I={key:0,class:"mr-review-summary",role:"status"},L={key:0,class:"mr-review-note"},O={key:1,class:"mr-review-note"},P={key:2,class:"mr-review-list"},U={key:0},A=["onClick"],H={key:3,class:"mr-review-note"},$={key:4,class:"mr-review-ack"},G={key:0,class:"mr-review-note"},W={key:1,class:"mr-review-list"},J=["onClick"],K={key:0,class:"mr-review-scope"},Q={key:0},X={class:"mr-review-note"},Y=e.defineComponent({__name:"TemplateReviewPanel",props:{document:{},previous:{},datasets:{},dataSchemas:{},formats:{},messages:{}},emits:["locate"],setup(o,{emit:f}){const u=o,p=f,t=e.computed(()=>({...B.TEMPLATE_REVIEW_MESSAGES,...u.messages})),{report:a,sampleSize:m,acknowledged:k,running:v,stale:g,failure:i,checkedScope:r,hasTree:y,errors:E,run:S}=D(u);function n(c){const s=/\.pages\[(\d+)\]\.components\[(\d+)\]/.exec(c);p("locate",{path:c,...s?{pageIndex:Number(s[1]),componentIndex:Number(s[2])}:{}})}return(c,s)=>(e.openBlock(),e.createElementBlock("section",{class:"mr-template-review","aria-label":t.value.title,"aria-busy":e.unref(v)},[e.createElementVNode("header",null,[e.createElementVNode("strong",null,e.toDisplayString(t.value.title),1),e.createElementVNode("button",{type:"button",disabled:e.unref(v),onClick:s[0]||(s[0]=(...l)=>e.unref(S)&&e.unref(S)(...l))},e.toDisplayString(e.unref(v)?t.value.running:t.value.run),9,w)]),e.createElementVNode("div",b,[e.createElementVNode("label",null,[e.createTextVNode(e.toDisplayString(t.value.samples),1),e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":s[1]||(s[1]=l=>e.isRef(m)?m.value=l:null),"aria-label":t.value.samples,disabled:e.unref(v)},[e.createElementVNode("option",T,e.toDisplayString(t.value.none),1),e.createElementVNode("option",x,e.toDisplayString(t.value.first20),1),e.createElementVNode("option",R,e.toDisplayString(t.value.first100),1),e.createElementVNode("option",q,e.toDisplayString(t.value.all),1)],8,C),[[e.vModelSelect,e.unref(m)]])])]),e.unref(y)?(e.openBlock(),e.createElementBlock("p",M,e.toDisplayString(t.value.treeHint),1)):e.createCommentVNode("",!0),e.unref(i)?(e.openBlock(),e.createElementBlock("p",j,e.toDisplayString(e.unref(i)),1)):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("p",z,e.toDisplayString(t.value.stale),1)):e.createCommentVNode("",!0),e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:4},[e.unref(g)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",I,[e.createElementVNode("span",{class:e.normalizeClass({"is-error":e.unref(E)})},e.toDisplayString(e.unref(E))+" "+e.toDisplayString(t.value.errors),3),e.createElementVNode("span",null,e.toDisplayString(e.unref(a).issues.length-e.unref(E))+" "+e.toDisplayString(t.value.warnings),1)])),e.createElementVNode("section",null,[e.createElementVNode("h3",null,[e.createTextVNode(e.toDisplayString(t.value.changes)+" ",1),e.createElementVNode("small",null,e.toDisplayString(e.unref(a).changes?.totalChanges??0),1)]),o.previous?e.unref(a).changes?.totalChanges?(e.openBlock(),e.createElementBlock("ol",P,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).changes?.changes,(l,d)=>(e.openBlock(),e.createElementBlock("li",{key:d},[e.createElementVNode("div",null,[e.createElementVNode("span",null,e.toDisplayString(t.value.categories[l.category])+" · "+e.toDisplayString(t.value.kinds[l.kind]),1),l.breaking?(e.openBlock(),e.createElementBlock("b",U,e.toDisplayString(t.value.breaking),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",onClick:h=>n(l.path)},e.toDisplayString(t.value.locate),9,A)]),e.createElementVNode("code",null,e.toDisplayString(l.path),1),e.createElementVNode("dl",null,[l.before!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("dt",null,e.toDisplayString(t.value.before),1),e.createElementVNode("dd",null,e.toDisplayString(l.before),1)],64)):e.createCommentVNode("",!0),l.after!==void 0?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createElementVNode("dt",null,e.toDisplayString(t.value.after),1),e.createElementVNode("dd",null,e.toDisplayString(l.after),1)],64)):e.createCommentVNode("",!0)])]))),128))])):(e.openBlock(),e.createElementBlock("p",O,e.toDisplayString(t.value.noChanges),1)):(e.openBlock(),e.createElementBlock("p",L,e.toDisplayString(t.value.baseline),1)),e.unref(a).changes?.truncated?(e.openBlock(),e.createElementBlock("p",H,e.toDisplayString(t.value.truncated),1)):e.createCommentVNode("",!0),e.unref(a).changes?.breakingChanges?(e.openBlock(),e.createElementBlock("label",$,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":s[2]||(s[2]=l=>e.isRef(k)?k.value=l:null),type:"checkbox"},null,512),[[e.vModelCheckbox,e.unref(k)]]),e.createTextVNode(e.toDisplayString(t.value.acknowledge),1)])):e.createCommentVNode("",!0)]),e.createElementVNode("section",null,[e.createElementVNode("h3",null,e.toDisplayString(t.value.issues),1),e.unref(a).issues.length?(e.openBlock(),e.createElementBlock("ol",W,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).issues,(l,d)=>(e.openBlock(),e.createElementBlock("li",{key:d},[e.createElementVNode("div",null,[e.createElementVNode("span",{class:e.normalizeClass({"is-error":l.severity==="error"})},e.toDisplayString(l.severity==="error"?t.value.errors:t.value.warnings),3),e.createElementVNode("button",{type:"button",onClick:h=>p("locate",l)},e.toDisplayString(t.value.locate),9,J)]),e.createElementVNode("p",null,e.toDisplayString(l.message),1),e.createElementVNode("code",null,e.toDisplayString(l.path),1)]))),128))])):(e.openBlock(),e.createElementBlock("p",G,e.toDisplayString(t.value.noIssues),1))]),e.unref(a).samples.length?(e.openBlock(),e.createElementBlock("section",{key:1,class:e.normalizeClass({"is-stale":e.unref(g)})},[e.createElementVNode("h3",null,e.toDisplayString(t.value.results),1),e.unref(r)?(e.openBlock(),e.createElementBlock("p",K,[e.createTextVNode(e.toDisplayString(t.value.scope)+" · "+e.toDisplayString(e.unref(r).requested==="-1"?t.value.all:e.unref(r).requested==="0"?t.value.none:e.unref(r).requested+" "+t.value.rows)+" · "+e.toDisplayString(e.unref(r).datasets)+" "+e.toDisplayString(t.value.datasets)+" · "+e.toDisplayString(e.unref(r).rows)+" "+e.toDisplayString(t.value.rows),1),e.unref(r).formats.length?(e.openBlock(),e.createElementBlock("span",Q," · "+e.toDisplayString(e.unref(r).formats.join(" / ")),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).samples,l=>(e.openBlock(),e.createElementBlock("p",{key:l.name},e.toDisplayString(l.name)+" · "+e.toDisplayString(l.rows)+" "+e.toDisplayString(t.value.rows)+" · "+e.toDisplayString(l.pages)+" "+e.toDisplayString(t.value.pages),1))),128))],2)):e.createCommentVNode("",!0),e.createElementVNode("p",X,e.toDisplayString(t.value.checked),1)],64)):(e.openBlock(),e.createElementBlock("p",F,e.toDisplayString(t.value.empty),1))],8,N))}}),Z=V._export_sfc(Y,[["__scopeId","data-v-6d26056b"]]);exports.default=Z;
|
package/dist/assets-C2U-e-Sz.cjs
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
"use strict";const I=require("./defaults-xhmcLLrf.cjs"),b=require("./capabilities-CsZ-pNHR.cjs"),v=require("./progress-BnLiS5eH.cjs"),x=/[\u3000-\u9fff\uff00-\uffef]/,m=new Uint8Array(128);{for(const e of"iljtf.,:;'`|!()[]")m[e.charCodeAt(0)]=1;for(const e of"mwMW@")m[e.charCodeAt(0)]=2;for(let e=48;e<=57;e++)m[e]=3;for(let e=65;e<=90;e++)m[e]=4;m[32]=5}const E=[.54,.26,.95,.59,.67,.3];function M(e){const t=e.charCodeAt(0);return t<128?E[m[t]]:x.test(e)?1:/[A-Z]/.test(e)?.67:.54}const h={measureMm(e,t){const{fontSizePt:r,bold:s=!1,letterSpacingPt:a=0}=t,n=25.4/72;let i=0;for(const u of e)i+=M(u);return s&&(i*=1.04),(i*r+a*Math.max(0,Array.from(e).length-1))*n}};function T(){return h}function k(e,t){return h.measureMm(e,t)}function D(e){let t;return{measureMm(r,s){if(t===void 0&&(t=e()),!t)return h.measureMm(r,s);const a=s.fontSizePt*96/72;t.font=`${s.italic?"italic ":""}${s.bold?"bold ":""}${a}px ${s.fontFamily??I.DEFAULT_FONT_FAMILY}`,"letterSpacing"in t&&(t.letterSpacing="0px");const n=(s.letterSpacingPt??0)*Math.max(0,Array.from(r).length-1);return t.measureText(r).width*25.4/96+n*25.4/72}}}function O(e,t,r){const s=[];let a="";const n=()=>{a&&(s.push({text:a,widthMm:r.measureMm(a,t),cjk:!1}),a="")};for(const i of e){if(i===`
|
|
2
|
-
`){n(),s.push({text:`
|
|
3
|
-
`,widthMm:0,cjk:!1,br:!0});continue}if(i===" "){n(),s.push({text:i,widthMm:r.measureMm(i,t),cjk:!1,space:!0});continue}if(x.test(i)){n(),s.push({text:i,widthMm:r.measureMm(i,t),cjk:!0});continue}a+=i}return n(),s}function P(e,t,r,s=h){if(!e)return[""];e=e.replace(/\r\n?/g,`
|
|
4
|
-
`);const a=[];let n="",i=0;const u=(r.letterSpacingPt??0)*25.4/72,c=()=>{a.push(n),n="",i=0};for(const o of O(e,r,s)){if(o.br){c();continue}const f=n.length>0?u:0;if(i+f+o.widthMm<=t){n+=o.text,i+=f+o.widthMm;continue}if(o.space){c();continue}if(o.cjk){n.length>0&&c(),n=o.text,i=o.widthMm;continue}if(n.length>0&&c(),o.widthMm<=t){n=o.text,i=o.widthMm;continue}for(const d of o.text)s.measureMm(n+d,r)>t&&n.length>0&&c(),n+=d,i=s.measureMm(n,r)}return c(),a}class w extends Error{constructor(t,r){super(t.message),this.name="OutputAssetError",this.diagnostic=t,this.cause=r}}function p(e){if(e.aborted)throw e.reason??new DOMException("The operation was aborted.","AbortError")}function C(e){const t={maxAssets:1e3,maxImageBytes:33554432,maxTotalImageBytes:134217728,maxDurationMs:3e4,...e.assetBudget};for(const[r,s]of Object.entries(t))if(!Number.isSafeInteger(s)||s<=0||s>2147483647)throw new RangeError(`${r} must be a positive safe integer at most 2147483647.`);return t}function S(e){const t=/^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(e);if(!t)throw new TypeError("Asset renderers must return an image data URL.");return t[1]?Math.ceil(t[2].length*3/4):new TextEncoder().encode(decodeURIComponent(t[2])).byteLength}function l(e,t,r,s,a){const n={code:r,message:s,severity:"warning",format:e.options.format??"dom",pageIndex:t.pageIndex,componentIndex:t.componentIndex,componentPath:t.componentPath,kind:t.component.kind,nid:t.component.nid};if(e.diagnostics.push(n),b.notifyOutputDiagnostic(n,{...e.options,signal:e.signal}),e.options.assetFailure!=="placeholder")throw new w(n,a)}async function L(e,t,r){const s=e.options.assetRenderers?.[t.kind];if(t.imageData||!s)return t.imageData;if(++e.rendered>e.budget.maxAssets)return l(e,r,"asset-budget-exceeded","Output exceeded the asset count budget.");let a;try{if(e.active=r,a=await v.waitForOutput(s({...r,signal:e.signal}),e.signal),p(e.signal),a.length>e.budget.maxImageBytes*4+1024)return l(e,r,"asset-budget-exceeded","Output exceeded the image payload byte budget.");const n=S(a);if(n>e.budget.maxImageBytes||e.bytes+n>e.budget.maxTotalImageBytes)return l(e,r,"asset-budget-exceeded","Output exceeded the encoded image byte budget.");e.bytes+=n}catch(n){if(e.signal.aborted||n instanceof w)throw n;return l(e,r,"asset-render-failed",`Asset renderer failed for ${t.kind}; output was not silently omitted.`,n)}return a}function j(e,t){const r=e.active;if(!r){t.abort(new Error("Asset rendering exceeded maxDurationMs."));return}const s={code:"asset-budget-exceeded",message:"Asset rendering exceeded maxDurationMs.",severity:"warning",format:e.options.format??"dom",pageIndex:r.pageIndex,componentIndex:r.componentIndex,componentPath:r.componentPath,kind:r.component.kind,nid:r.component.nid};e.diagnostics.push(s);try{b.notifyOutputDiagnostic(s,{...e.options,signal:e.signal})}catch(a){t.abort(a);return}t.abort(new w(s))}async function B(e,t,r,s,a){if(!t?.children?.length)return t;const n=[];for(const[i,u]of t.children.entries())n.push(await y(e,u,{...r,component:u,componentPath:[...s,i]},a));return n.some((i,u)=>i!==t.children[u])?{...t,children:n}:t}async function y(e,t,r,s){if(p(e.signal),s.has(t))throw new TypeError("Cyclic grid children cannot be rendered.");let a=e.cache.get(t);a||(a=L(e,t,r),e.cache.set(t,a));const n=await a;p(e.signal);let i=t.grid;if(i){const u=new Set(s).add(t),c=[];for(const[o,f]of i.cells.entries()){const d=[];for(const[g,A]of f.entries())d.push(await B(e,A,r,[...r.componentPath,o,g],u));c.push(d)}c.some((o,f)=>o.some((d,g)=>d!==i.cells[f][g]))&&(i={...i,cells:c})}return n!==t.imageData||i!==t.grid?{...t,imageData:n,grid:i}:t}async function R(e,t={}){const r=C(t);if(t.signal?.aborted)throw t.signal.reason??new DOMException("The operation was aborted.","AbortError");const s=new AbortController,a=()=>s.abort(t.signal?.reason);if(t.signal?.addEventListener("abort",a,{once:!0}),!t.assetRenderers||!Object.keys(t.assetRenderers).length)return t.signal?.removeEventListener("abort",a),{plan:e,diagnostics:[]};const n={options:t,signal:s.signal,diagnostics:[],rendered:0,bytes:0,budget:r,cache:new WeakMap},i=setTimeout(()=>j(n,s),r.maxDurationMs);try{const u=[];for(const[c,o]of e.pages.entries()){if(c<(t.start??0)||c>(t.end??e.pages.length-1)){u.push(o);continue}const f=[];for(const[d,g]of o.components.entries())f.push(await y(n,g,{component:g,pageIndex:c,componentIndex:d,componentPath:[]},new Set));u.push(f.some((d,g)=>d!==o.components[g])?{...o,components:f}:o)}return p(n.signal),{plan:u.some((c,o)=>c!==e.pages[o])?{...e,pages:u}:e,diagnostics:n.diagnostics}}finally{clearTimeout(i),t.signal?.removeEventListener("abort",a)}}exports.OutputAssetError=w;exports.charWidthEm=M;exports.createCanvasMeasurer=D;exports.createHeuristicMeasurer=T;exports.heuristicMeasurer=h;exports.measureTextMm=k;exports.resolvePlanAssets=R;exports.wrapText=P;
|
package/dist/assets-Q0wUwNrV.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import { D as A } from "./defaults-DXhiM1ZD.js";
|
|
2
|
-
import { n as b } from "./capabilities-CK_7hizc.js";
|
|
3
|
-
import { w as I } from "./progress-7OSZbFok.js";
|
|
4
|
-
const x = /[\u3000-\u9fff\uff00-\uffef]/, g = new Uint8Array(128);
|
|
5
|
-
{
|
|
6
|
-
for (const e of "iljtf.,:;'`|!()[]") g[e.charCodeAt(0)] = 1;
|
|
7
|
-
for (const e of "mwMW@") g[e.charCodeAt(0)] = 2;
|
|
8
|
-
for (let e = 48; e <= 57; e++) g[e] = 3;
|
|
9
|
-
for (let e = 65; e <= 90; e++) g[e] = 4;
|
|
10
|
-
g[32] = 5;
|
|
11
|
-
}
|
|
12
|
-
const v = [0.54, 0.26, 0.95, 0.59, 0.67, 0.3];
|
|
13
|
-
function E(e) {
|
|
14
|
-
const t = e.charCodeAt(0);
|
|
15
|
-
return t < 128 ? v[g[t]] : x.test(e) ? 1 : /[A-Z]/.test(e) ? 0.67 : 0.54;
|
|
16
|
-
}
|
|
17
|
-
const p = {
|
|
18
|
-
measureMm(e, t) {
|
|
19
|
-
const { fontSizePt: r, bold: s = !1, letterSpacingPt: a = 0 } = t, n = 25.4 / 72;
|
|
20
|
-
let i = 0;
|
|
21
|
-
for (const d of e)
|
|
22
|
-
i += E(d);
|
|
23
|
-
return s && (i *= 1.04), (i * r + a * Math.max(0, Array.from(e).length - 1)) * n;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
function B() {
|
|
27
|
-
return p;
|
|
28
|
-
}
|
|
29
|
-
function R(e, t) {
|
|
30
|
-
return p.measureMm(e, t);
|
|
31
|
-
}
|
|
32
|
-
function $(e) {
|
|
33
|
-
let t;
|
|
34
|
-
return {
|
|
35
|
-
measureMm(r, s) {
|
|
36
|
-
if (t === void 0 && (t = e()), !t) return p.measureMm(r, s);
|
|
37
|
-
const a = s.fontSizePt * 96 / 72;
|
|
38
|
-
t.font = `${s.italic ? "italic " : ""}${s.bold ? "bold " : ""}${a}px ${s.fontFamily ?? A}`, "letterSpacing" in t && (t.letterSpacing = "0px");
|
|
39
|
-
const n = (s.letterSpacingPt ?? 0) * Math.max(0, Array.from(r).length - 1);
|
|
40
|
-
return t.measureText(r).width * 25.4 / 96 + n * 25.4 / 72;
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function T(e, t, r) {
|
|
45
|
-
const s = [];
|
|
46
|
-
let a = "";
|
|
47
|
-
const n = () => {
|
|
48
|
-
a && (s.push({ text: a, widthMm: r.measureMm(a, t), cjk: !1 }), a = "");
|
|
49
|
-
};
|
|
50
|
-
for (const i of e) {
|
|
51
|
-
if (i === `
|
|
52
|
-
`) {
|
|
53
|
-
n(), s.push({ text: `
|
|
54
|
-
`, widthMm: 0, cjk: !1, br: !0 });
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (i === " ") {
|
|
58
|
-
n(), s.push({ text: i, widthMm: r.measureMm(i, t), cjk: !1, space: !0 });
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (x.test(i)) {
|
|
62
|
-
n(), s.push({ text: i, widthMm: r.measureMm(i, t), cjk: !0 });
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
a += i;
|
|
66
|
-
}
|
|
67
|
-
return n(), s;
|
|
68
|
-
}
|
|
69
|
-
function F(e, t, r, s = p) {
|
|
70
|
-
if (!e) return [""];
|
|
71
|
-
e = e.replace(/\r\n?/g, `
|
|
72
|
-
`);
|
|
73
|
-
const a = [];
|
|
74
|
-
let n = "", i = 0;
|
|
75
|
-
const d = (r.letterSpacingPt ?? 0) * 25.4 / 72, c = () => {
|
|
76
|
-
a.push(n), n = "", i = 0;
|
|
77
|
-
};
|
|
78
|
-
for (const o of T(e, r, s)) {
|
|
79
|
-
if (o.br) {
|
|
80
|
-
c();
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
const f = n.length > 0 ? d : 0;
|
|
84
|
-
if (i + f + o.widthMm <= t) {
|
|
85
|
-
n += o.text, i += f + o.widthMm;
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
if (o.space) {
|
|
89
|
-
c();
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
if (o.cjk) {
|
|
93
|
-
n.length > 0 && c(), n = o.text, i = o.widthMm;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (n.length > 0 && c(), o.widthMm <= t) {
|
|
97
|
-
n = o.text, i = o.widthMm;
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
for (const u of o.text)
|
|
101
|
-
s.measureMm(n + u, r) > t && n.length > 0 && c(), n += u, i = s.measureMm(n, r);
|
|
102
|
-
}
|
|
103
|
-
return c(), a;
|
|
104
|
-
}
|
|
105
|
-
class w extends Error {
|
|
106
|
-
constructor(t, r) {
|
|
107
|
-
super(t.message), this.name = "OutputAssetError", this.diagnostic = t, this.cause = r;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function l(e) {
|
|
111
|
-
if (e.aborted) throw e.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
112
|
-
}
|
|
113
|
-
function k(e) {
|
|
114
|
-
const t = { maxAssets: 1e3, maxImageBytes: 33554432, maxTotalImageBytes: 134217728, maxDurationMs: 3e4, ...e.assetBudget };
|
|
115
|
-
for (const [r, s] of Object.entries(t))
|
|
116
|
-
if (!Number.isSafeInteger(s) || s <= 0 || s > 2147483647) throw new RangeError(`${r} must be a positive safe integer at most 2147483647.`);
|
|
117
|
-
return t;
|
|
118
|
-
}
|
|
119
|
-
function D(e) {
|
|
120
|
-
const t = /^data:image\/[a-z0-9.+-]+(;base64)?,(.*)$/is.exec(e);
|
|
121
|
-
if (!t) throw new TypeError("Asset renderers must return an image data URL.");
|
|
122
|
-
return t[1] ? Math.ceil(t[2].length * 3 / 4) : new TextEncoder().encode(decodeURIComponent(t[2])).byteLength;
|
|
123
|
-
}
|
|
124
|
-
function h(e, t, r, s, a) {
|
|
125
|
-
const n = { code: r, message: s, severity: "warning", format: e.options.format ?? "dom", pageIndex: t.pageIndex, componentIndex: t.componentIndex, componentPath: t.componentPath, kind: t.component.kind, nid: t.component.nid };
|
|
126
|
-
if (e.diagnostics.push(n), b(n, { ...e.options, signal: e.signal }), e.options.assetFailure !== "placeholder") throw new w(n, a);
|
|
127
|
-
}
|
|
128
|
-
async function O(e, t, r) {
|
|
129
|
-
const s = e.options.assetRenderers?.[t.kind];
|
|
130
|
-
if (t.imageData || !s) return t.imageData;
|
|
131
|
-
if (++e.rendered > e.budget.maxAssets) return h(e, r, "asset-budget-exceeded", "Output exceeded the asset count budget.");
|
|
132
|
-
let a;
|
|
133
|
-
try {
|
|
134
|
-
if (e.active = r, a = await I(s({ ...r, signal: e.signal }), e.signal), l(e.signal), a.length > e.budget.maxImageBytes * 4 + 1024) return h(e, r, "asset-budget-exceeded", "Output exceeded the image payload byte budget.");
|
|
135
|
-
const n = D(a);
|
|
136
|
-
if (n > e.budget.maxImageBytes || e.bytes + n > e.budget.maxTotalImageBytes) return h(e, r, "asset-budget-exceeded", "Output exceeded the encoded image byte budget.");
|
|
137
|
-
e.bytes += n;
|
|
138
|
-
} catch (n) {
|
|
139
|
-
if (e.signal.aborted || n instanceof w) throw n;
|
|
140
|
-
return h(e, r, "asset-render-failed", `Asset renderer failed for ${t.kind}; output was not silently omitted.`, n);
|
|
141
|
-
}
|
|
142
|
-
return a;
|
|
143
|
-
}
|
|
144
|
-
function P(e, t) {
|
|
145
|
-
const r = e.active;
|
|
146
|
-
if (!r) {
|
|
147
|
-
t.abort(new Error("Asset rendering exceeded maxDurationMs."));
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
const s = { code: "asset-budget-exceeded", message: "Asset rendering exceeded maxDurationMs.", severity: "warning", format: e.options.format ?? "dom", pageIndex: r.pageIndex, componentIndex: r.componentIndex, componentPath: r.componentPath, kind: r.component.kind, nid: r.component.nid };
|
|
151
|
-
e.diagnostics.push(s);
|
|
152
|
-
try {
|
|
153
|
-
b(s, { ...e.options, signal: e.signal });
|
|
154
|
-
} catch (a) {
|
|
155
|
-
t.abort(a);
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
t.abort(new w(s));
|
|
159
|
-
}
|
|
160
|
-
async function S(e, t, r, s, a) {
|
|
161
|
-
if (!t?.children?.length) return t;
|
|
162
|
-
const n = [];
|
|
163
|
-
for (const [i, d] of t.children.entries())
|
|
164
|
-
n.push(await y(e, d, { ...r, component: d, componentPath: [...s, i] }, a));
|
|
165
|
-
return n.some((i, d) => i !== t.children[d]) ? { ...t, children: n } : t;
|
|
166
|
-
}
|
|
167
|
-
async function y(e, t, r, s) {
|
|
168
|
-
if (l(e.signal), s.has(t)) throw new TypeError("Cyclic grid children cannot be rendered.");
|
|
169
|
-
let a = e.cache.get(t);
|
|
170
|
-
a || (a = O(e, t, r), e.cache.set(t, a));
|
|
171
|
-
const n = await a;
|
|
172
|
-
l(e.signal);
|
|
173
|
-
let i = t.grid;
|
|
174
|
-
if (i) {
|
|
175
|
-
const d = new Set(s).add(t), c = [];
|
|
176
|
-
for (const [o, f] of i.cells.entries()) {
|
|
177
|
-
const u = [];
|
|
178
|
-
for (const [m, M] of f.entries()) u.push(await S(e, M, r, [...r.componentPath, o, m], d));
|
|
179
|
-
c.push(u);
|
|
180
|
-
}
|
|
181
|
-
c.some((o, f) => o.some((u, m) => u !== i.cells[f][m])) && (i = { ...i, cells: c });
|
|
182
|
-
}
|
|
183
|
-
return n !== t.imageData || i !== t.grid ? { ...t, imageData: n, grid: i } : t;
|
|
184
|
-
}
|
|
185
|
-
async function W(e, t = {}) {
|
|
186
|
-
const r = k(t);
|
|
187
|
-
if (t.signal?.aborted) throw t.signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
188
|
-
const s = new AbortController(), a = () => s.abort(t.signal?.reason);
|
|
189
|
-
if (t.signal?.addEventListener("abort", a, { once: !0 }), !t.assetRenderers || !Object.keys(t.assetRenderers).length)
|
|
190
|
-
return t.signal?.removeEventListener("abort", a), { plan: e, diagnostics: [] };
|
|
191
|
-
const n = { options: t, signal: s.signal, diagnostics: [], rendered: 0, bytes: 0, budget: r, cache: /* @__PURE__ */ new WeakMap() }, i = setTimeout(() => P(n, s), r.maxDurationMs);
|
|
192
|
-
try {
|
|
193
|
-
const d = [];
|
|
194
|
-
for (const [c, o] of e.pages.entries()) {
|
|
195
|
-
if (c < (t.start ?? 0) || c > (t.end ?? e.pages.length - 1)) {
|
|
196
|
-
d.push(o);
|
|
197
|
-
continue;
|
|
198
|
-
}
|
|
199
|
-
const f = [];
|
|
200
|
-
for (const [u, m] of o.components.entries()) f.push(await y(n, m, { component: m, pageIndex: c, componentIndex: u, componentPath: [] }, /* @__PURE__ */ new Set()));
|
|
201
|
-
d.push(f.some((u, m) => u !== o.components[m]) ? { ...o, components: f } : o);
|
|
202
|
-
}
|
|
203
|
-
return l(n.signal), { plan: d.some((c, o) => c !== e.pages[o]) ? { ...e, pages: d } : e, diagnostics: n.diagnostics };
|
|
204
|
-
} finally {
|
|
205
|
-
clearTimeout(i), t.signal?.removeEventListener("abort", a);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
export {
|
|
209
|
-
w as O,
|
|
210
|
-
$ as a,
|
|
211
|
-
B as b,
|
|
212
|
-
E as c,
|
|
213
|
-
p as h,
|
|
214
|
-
R as m,
|
|
215
|
-
W as r,
|
|
216
|
-
F as w
|
|
217
|
-
};
|
package/dist/batch-Bt3Fd27Z.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";class m extends Error{constructor(t,n,r){super(n),this.code=t,this.path=r,this.name="ReportRuntimeError"}}function x(e){if(!e?.aborted)return;if(e.reason instanceof m)throw e.reason;const t=new Error("报表执行已取消");throw t.name="AbortError",Object.defineProperty(t,"cause",{value:e.reason}),t}function $(e,t,n){if(!Number.isFinite(n)||n<0)throw new m("budget",`${t} 的执行统计无效`,`$.budget.${t}`);const r=e[t];if(r!==void 0&&n>r)throw new m("budget",`${t} 超出预算 ${r}(实际 ${n})`,`$.budget.${t}`)}function q(e){for(const[t,n]of Object.entries(e)){if(n!==void 0&&(!Number.isFinite(n)||n<=0))throw new m("budget",`${t} 应为正有限数字`,`$.budget.${t}`);if(t!=="maxDurationMs"&&n!==void 0&&!Number.isSafeInteger(n))throw new m("budget",`${t} 应为正安全整数`,`$.budget.${t}`);if(t==="maxDurationMs"&&n!==void 0&&n>2147483647)throw new m("budget","maxDurationMs 不能超过 2147483647",`$.budget.${t}`)}}async function T(e,t,n){const r=new AbortController,o=()=>r.abort(e?.reason);e?.addEventListener("abort",o,{once:!0}),e?.aborted&&o();const a=Date.now(),c=t===void 0?void 0:setTimeout(()=>r.abort(new m("timeout",`报表执行超过 ${t}ms`)),t);let d;try{x(r.signal);const g=new Promise((u,i)=>{d=()=>{try{x(r.signal)}catch(h){i(h)}},r.signal.addEventListener("abort",d,{once:!0})}),s=await Promise.race([n(r.signal),g]);if(x(r.signal),t!==void 0&&Date.now()-a>t)throw new m("timeout",`报表执行超过 ${t}ms`);return s}finally{c!==void 0&&clearTimeout(c),d&&r.signal.removeEventListener("abort",d),e?.removeEventListener("abort",o)}}const L=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),y=(e,t)=>e>>>t|e<<32-t;function D(e,t,n){const r=new DataView(e.buffer,e.byteOffset+t,64);for(let o=0;o<16;o++)n[o]=r.getUint32(o*4);for(let o=16;o<64;o++){const a=n[o-15],c=n[o-2],d=y(a,7)^y(a,18)^a>>>3,g=y(c,17)^y(c,19)^c>>>10;n[o]=n[o-16]+d+n[o-7]+g}}function M(e,t){let n=e[0],r=e[1],o=e[2],a=e[3],c=e[4],d=e[5],g=e[6],s=e[7];for(let u=0;u<64;u++){const i=y(c,6)^y(c,11)^y(c,25),h=c&d^~c&g,f=s+i+h+L[u]+t[u]>>>0,b=y(n,2)^y(n,13)^y(n,22),w=n&r^n&o^r&o,S=b+w>>>0;s=g,g=d,d=c,c=a+f>>>0,a=o,o=r,r=n,n=f+S>>>0}e[0]=e[0]+n,e[1]=e[1]+r,e[2]=e[2]+o,e[3]=e[3]+a,e[4]=e[4]+c,e[5]=e[5]+d,e[6]=e[6]+g,e[7]=e[7]+s}function P(e){const t=new Uint8Array(Math.ceil((e.byteLength+9)/64)*64);t.set(e),t[e.byteLength]=128;const n=new DataView(t.buffer);return n.setUint32(t.length-8,Math.floor(e.byteLength/536870912)),n.setUint32(t.length-4,e.byteLength*8>>>0),t}const C=()=>new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),z=e=>Array.from(e,t=>t.toString(16).padStart(8,"0")).join("");async function U(e){const t=P(e),n=C(),r=new Uint32Array(64);for(let o=0;o<t.length;o+=64)o>0&&o%262144===0&&await new Promise(a=>setTimeout(a,0)),D(t,o,r),M(n,r);return z(n)}function _(e={}){const t={maxRecords:e.maxRecords??1e4,maxBytes:e.maxBytes??67108864,maxResultBytes:e.maxResultBytes??262144,controlReserveBytes:e.controlReserveBytes??4096,maxTombstones:e.maxTombstones??1e4,maxTombstoneBytes:e.maxTombstoneBytes??16777216};if(!Object.values(t).every(n=>Number.isSafeInteger(n)&&n>0)||t.controlReserveBytes<4096)throw new l("input","任务容量应为正整数,控制状态预留至少4096字节");return t}function v(e){return new TextEncoder().encode(p(e)).byteLength}function R(e,t){const n={scope:e.scope,id:e.id,revision:1,request:e.request,status:"queued",createdAt:e.createdAt,updatedAt:e.createdAt,attempt:0},r={...e};delete r.result;const o=e.result===void 0?0:v(e.result);if(o>t.maxResultBytes)throw new l("capacity","任务结果超过独立预算,请保存文件引用");return Math.max(v(n)+t.controlReserveBytes,v(r))+o}function N(e){return e.status!=="queued"&&e.status!=="running"}function k(e){const t={...e,tombstoneRetentionMs:e.tombstoneRetentionMs??6048e5,limit:e.limit??100};if(![t.now,t.terminalBefore].every(n=>Number.isSafeInteger(n)&&n>=0)||t.terminalBefore>t.now)throw new l("input","终态清理时间应为不超过当前时间的非负整数");if(![t.tombstoneRetentionMs,t.limit].every(n=>Number.isSafeInteger(n)&&n>0)||!Number.isSafeInteger(t.now+t.tombstoneRetentionMs))throw new l("input","幂等保留期与清理批量应为正整数");return t}async function B(e){const t=new TextEncoder().encode(p(e)),n=globalThis.crypto?.subtle;if(!n)return U(t);const r=await n.digest("SHA-256",t);return Array.from(new Uint8Array(r),o=>o.toString(16).padStart(2,"0")).join("")}async function H(e,t){if(!N(e))throw new l("input","只能归档终态任务");return{scope:e.scope,id:e.id,revision:e.revision,status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,attempt:e.attempt,requestHash:await B(e.request),expiresAt:t}}class l extends Error{constructor(t,n){super(n),this.code=t,this.name="ReportJobError"}}function J(e,t){if(typeof e!="string"||!e.trim()||e.length>256||typeof t!="string"||t!==t.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(t))throw new l("input","任务范围应非空,ID应为1–128位安全标识")}function Z(e){const t=Array.isArray(e),n=Object.getPrototypeOf(e),r=Object.keys(e);if(n!==(t?Array.prototype:Object.prototype)&&!(n===null&&!t))throw new l("input","任务对象应为普通 JSON 对象");if(Object.getOwnPropertySymbols(e).length)throw new l("input","任务不能包含Symbol");if(Object.getOwnPropertyNames(e).filter(a=>!(t&&a==="length")).length!==r.length)throw new l("input","任务不能包含不可枚举属性");if(t&&(r.length!==e.length||r.some(a=>a!==String(Number(a))||!Number.isSafeInteger(Number(a))||Number(a)<0||Number(a)>=e.length)))throw new l("input","任务数组不能稀疏或包含额外属性");return r.sort()}function F(e,t){const n=Object.getOwnPropertyDescriptor(e,t);if(["__proto__","prototype","constructor"].includes(t)||n.get||n.set)throw new l("input","任务不能包含危险键或访问器");return n.value}function p(e,t={}){const n=t.maxNodes??2e4,r=t.maxCharacters??1e6;if(!Number.isSafeInteger(n)||n<1||n>2e4||!Number.isSafeInteger(r)||r<1||r>1e6)throw new l("input","任务JSON预算无效");let o=0,a=0;const c=new Set;function d(s,u){if(++o>n||u>32)throw new l("input","任务数据超过节点或深度预算");if(typeof s=="string"){if(a+=s.length,a>r)throw new l("input","任务文本超过预算");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s))return s;if(!s||typeof s!="object"||c.has(s))throw new l("input","任务只允许无循环的有限 JSON 值");const i=Array.isArray(s),h=Z(s);c.add(s);const f=Object.create(null);for(const b of h){if(a+=b.length,a>r)throw new l("input","任务文本超过预算");f[b]=d(F(s,b),u+1)}return c.delete(s),i?Array.from({length:s.length},(b,w)=>f[String(w)]):f}const g=JSON.stringify(d(e,0));if(g.length>r)throw new l("input","任务序列化数据超过字符预算");return g}function A(e){return JSON.parse(JSON.stringify(e))}function E(e,t,n,r){if(J(t,n),e.scope!==t||e.id!==n||e.revision!==(r??0)+1||!Number.isSafeInteger(e.revision))throw new l("input","任务身份或修订不匹配");if(![e.createdAt,e.updatedAt,e.attempt].every(o=>Number.isSafeInteger(o)&&o>=0)||!["queued","running","completed","failed","cancelled"].includes(e.status))throw new l("input","任务状态无效");if(e.lease&&(!e.lease.owner||!Number.isSafeInteger(e.lease.expiresAt)))throw new l("input","任务租约无效");if(!e.request||typeof e.request.kind!="string"||!e.request.kind.trim()||e.request.kind.length>128)throw new l("input","任务类型无效");p(e.request.payload,{maxNodes:19e3,maxCharacters:75e4}),p(e)}function O(e,t){if(e&&(e.createdAt!==t.createdAt||p(e.request)!==p(t.request)))throw new l("input","任务创建时间与请求不可变更,请使用新任务ID")}function j(e,t){return e.status==="queued"||e.status==="running"&&(e.lease?.expiresAt??0)<=t}function V(e={}){const t=new Map,n=new Map,r=_(e);let o=0,a=0,c=Promise.resolve();const d=(s,u)=>JSON.stringify([s,u]),g=s=>{const u=c.then(s);return c=u.then(()=>{},()=>{}),u};return{read:async(s,u)=>{await c;const i=t.get(d(s,u));return i?A(i):void 0},readTombstone:async(s,u)=>{await c;const i=n.get(d(s,u));return i?A(i):void 0},candidates:async(s,u)=>(await c,Array.from(t.values()).filter(i=>j(i,s)).sort((i,h)=>i.createdAt-h.createdAt).slice(0,u).map(A)),compareAndSwap:async(s,u,i,h)=>{E(h,s,u,i);const f=A(h);return g(async()=>{const b=d(s,u),w=t.get(b);if((w?.revision??null)!==i||n.has(b))return!1;O(w,f);const S=o-(w?R(w,r):0)+R(f,r);if(S>r.maxBytes||!w&&t.size>=r.maxRecords)throw new l("capacity","任务容量已满,请清理终态任务或扩大显式预算");return t.set(b,f),o=S,!0})},prune:async s=>{const u=k(s);return g(async()=>{const i={archived:0,expired:0};for(const[h,f]of n)f.expiresAt>u.now||i.expired>=u.limit||(n.delete(h),a-=v(f),i.expired++);for(const[h,f]of t){if(!N(f)||f.updatedAt>u.terminalBefore||i.archived+i.expired>=u.limit)continue;const b=await H(f,u.now+u.tombstoneRetentionMs),w=v(b);if(n.size>=r.maxTombstones||a+w>r.maxTombstoneBytes)break;n.set(h,b),a+=w,t.delete(h),o-=R(f,r),i.archived++}return i})}}}function I(e,t=100){if(!Number.isSafeInteger(t)||t<1||t>1e3||!Array.isArray(e)||e.length>t)throw new RangeError("批量参数应包含 1–maxCases 条,maxCases 最大为 1000");const n=JSON.parse(p(e)),r=new Set;for(const o of n){if(!o||typeof o.id!="string"||o.id!==o.id.trim()||!/^[a-zA-Z0-9][a-zA-Z0-9_.:-]{0,127}$/.test(o.id)||r.has(o.id))throw new TypeError("批量行 ID 应唯一且为安全标识");if(!o.params||Array.isArray(o.params)||typeof o.params!="object"||Object.values(o.params).some(a=>typeof a!="string"))throw new TypeError("批量参数应为字符串字典");r.add(o.id)}return n}function K(e,t){if(!t)return;const n={completed:0,total:e.length,failed:0,cancelled:0};for(const r of e)r&&(n.completed++,r.status==="failed"&&n.failed++,r.status==="cancelled"&&n.cancelled++);try{t(n)}catch{}}async function W(e,t,n={}){const r=n.concurrency??2;if(!Number.isSafeInteger(r)||r<1||r>16)throw new RangeError("批量并发应为 1–16");if(n.failure!==void 0&&n.failure!=="continue"&&n.failure!=="stop")throw new TypeError("批量失败策略无效");const o=I(e,n.maxCases??100);if(!o.length)throw new RangeError("批量生成至少需要一组参数");const a=Array.from({length:o.length}),c=new AbortController,d=()=>c.abort(n.signal?.reason);n.signal?.addEventListener("abort",d,{once:!0}),n.signal?.aborted&&d();let g=0,s=!1;async function u(){for(;g<o.length;){const i=g++,h=o[i],f={id:h.id,index:i};if(s||c.signal.aborted)a[i]={...f,status:"cancelled"};else try{x(c.signal);const b=await t(h,{index:i,signal:c.signal});a[i]={...f,status:"completed",value:b}}catch(b){c.signal.aborted?a[i]={...f,status:"cancelled"}:(a[i]={...f,status:"failed",error:{name:b instanceof Error?b.name:"Error",message:b instanceof Error?b.message:String(b)}},n.failure==="stop"&&(s=!0))}K(a,n.onProgress)}}try{await Promise.all(Array.from({length:Math.min(r,o.length)},u))}finally{n.signal?.removeEventListener("abort",d)}return a}exports.ReportJobError=l;exports.ReportRuntimeError=m;exports.assertBudget=$;exports.checkJobIdentity=J;exports.cloneJob=A;exports.controlled=T;exports.createMemoryReportJobStore=V;exports.jobByteLength=v;exports.jobRequestHash=B;exports.runReportBatch=W;exports.runnableJob=j;exports.serializeJobJson=p;exports.snapshotReportBatchCases=I;exports.throwIfAborted=x;exports.validateBudget=q;exports.validateJobRecord=E;exports.validateJobTransition=O;
|