@agile-team/mach-report 2.20.0 → 2.21.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 (112) hide show
  1. package/README.md +6 -2
  2. package/dist/{ExcelBindingWizard-B7aeRg46.cjs → ExcelBindingWizard-B2xXBOJu.cjs} +1 -1
  3. package/dist/{ExcelBindingWizard-Chn6ZC2-.js → ExcelBindingWizard-CixTPQAL.js} +3 -3
  4. package/dist/{ParamEditor-BdFMa1CX.cjs → ParamEditor-DhHlNxai.cjs} +1 -1
  5. package/dist/{ParamEditor-o-7E7WZZ.js → ParamEditor-gKhvEsnr.js} +1 -1
  6. package/dist/{ReportBatchPanel-DVpmB7tG.cjs → ReportBatchPanel-BUdUfTdm.cjs} +1 -1
  7. package/dist/{ReportBatchPanel-CNJ4Useq.js → ReportBatchPanel-D-lyWKyf.js} +1 -1
  8. package/dist/ReportLabelStudio-BcjQt73a.cjs +1 -0
  9. package/dist/ReportLabelStudio-N2w6DdaZ.js +764 -0
  10. package/dist/{ReportPreview-CGcxwkAn.js → ReportPreview-BBJNlu2U.js} +8 -8
  11. package/dist/{ReportPreview-hlwvZ1wf.cjs → ReportPreview-nf4Dk1Jc.cjs} +2 -2
  12. package/dist/{ReportTemplateLibrary-DjjyZnZB.cjs → ReportTemplateLibrary-Cs9WKneQ.cjs} +1 -1
  13. package/dist/{ReportTemplateLibrary-DyIJhJjX.js → ReportTemplateLibrary-WZl-AK-2.js} +1 -1
  14. package/dist/{RuleEditor-BeknHHOD.js → RuleEditor-DGpmjCko.js} +3 -3
  15. package/dist/RuleEditor-Dtcq-7LO.cjs +1 -0
  16. package/dist/{TemplateOutlinePanel-D6TXg1aV.cjs → TemplateOutlinePanel-CkCh506f.cjs} +1 -1
  17. package/dist/{TemplateOutlinePanel-Bv8CxbXS.js → TemplateOutlinePanel-cxp95OT9.js} +1 -1
  18. package/dist/{TemplateReusePanel-CfousvPY.js → TemplateReusePanel-BZ8VTtrO.js} +2 -2
  19. package/dist/{TemplateReusePanel-wrSbd_mr.cjs → TemplateReusePanel-CwttuSta.cjs} +1 -1
  20. package/dist/{TemplateReviewPanel-BKFcSbTh.cjs → TemplateReviewPanel-C2YjiaEC.cjs} +1 -1
  21. package/dist/{TemplateReviewPanel-F2tqWNLO.js → TemplateReviewPanel-C9cTvsRs.js} +1 -1
  22. package/dist/artifact-integrity.json +90 -92
  23. package/dist/{assets-2eC3mOcV.js → assets-CxHunY_9.js} +2 -2
  24. package/dist/{assets-B0Hxn4l6.cjs → assets-vbjAGgk8.cjs} +1 -1
  25. package/dist/{auto-BlchZ1b8.js → auto-BkdGiNtr.js} +4 -4
  26. package/dist/{auto-B0EZFIK1.cjs → auto-Tq7ReIC1.cjs} +1 -1
  27. package/dist/{component-tree-CvW4lzpv.js → component-tree-1_QCiQJX.js} +1 -1
  28. package/dist/component-tree-BjZIp6w9.cjs +1 -0
  29. package/dist/{data-bar-PtjXhMgN.js → data-bar-8baGYEZ9.js} +1 -1
  30. package/dist/{data-bar-Ce38juRZ.cjs → data-bar-YltqGTaC.cjs} +1 -1
  31. package/dist/designer-CDqok4S5.cjs +2 -0
  32. package/dist/designer-CIDHt5xz.js +6869 -0
  33. package/dist/designer.cjs +1 -1
  34. package/dist/designer.d.cts +25 -3
  35. package/dist/designer.d.ts +25 -3
  36. package/dist/designer.js +1 -1
  37. package/dist/{encoding-B--eZpp1.cjs → encoding-B79hW4zq.cjs} +1 -1
  38. package/dist/{encoding-mctOLocI.js → encoding-BSeUwrN7.js} +2 -2
  39. package/dist/{font-loader-DBBJ5KE9.cjs → font-loader-BB372_XN.cjs} +1 -1
  40. package/dist/{font-loader-DW8tIaNp.js → font-loader-Di0lQKFf.js} +1 -1
  41. package/dist/grid-geometry-D3SJgWFv.js +136 -0
  42. package/dist/grid-geometry-D8ReblRV.cjs +1 -0
  43. package/dist/index.cjs +6 -6
  44. package/dist/index.js +194 -195
  45. package/dist/json-snapshot-I5VI84Vp.cjs +2 -0
  46. package/dist/{json-snapshot-By4ZVVUt.js → json-snapshot-Kgn459Oj.js} +895 -879
  47. package/dist/{pdf-DqyxJ96U.cjs → pdf-CARdBcuw.cjs} +45 -45
  48. package/dist/{pdf-CKROKygt.js → pdf-DmlnL5eB.js} +13 -14
  49. package/dist/pdf.cjs +1 -1
  50. package/dist/pdf.js +2 -2
  51. package/dist/{plugin-BMsIIJDh.cjs → plugin-BaRUGORD.cjs} +1 -1
  52. package/dist/{plugin-Co1oKD7T.js → plugin-D4kAxfLG.js} +1 -1
  53. package/dist/{prefill-D7EswyTI.cjs → prefill-Bpyn58AZ.cjs} +1 -1
  54. package/dist/{prefill-B8H9qwE4.js → prefill-CJSazcVY.js} +2 -2
  55. package/dist/{prepared-CGVphji3.cjs → prepared-BiSz_9vN.cjs} +1 -1
  56. package/dist/{prepared-BE-4jfX5.js → prepared-BwjwEzFz.js} +1 -1
  57. package/dist/{protocol-Cr81vFSQ.js → protocol-Bs9-ohHN.js} +3 -3
  58. package/dist/{protocol-ByRVzzQG.cjs → protocol-C8VWF9An.cjs} +1 -1
  59. package/dist/record-bindings-Ct1HkPrc.cjs +1 -0
  60. package/dist/{record-bindings-DEJtmo3p.js → record-bindings-VZGS-Qd8.js} +1 -1
  61. package/dist/{region-binding-workflow-CBg0l_tj.js → region-binding-workflow-Cy4GIOUo.js} +2 -2
  62. package/dist/{region-binding-workflow-D05tOYn3.cjs → region-binding-workflow-JNowHd0A.cjs} +1 -1
  63. package/dist/report-encoding-worker.cjs +1 -1
  64. package/dist/report-encoding-worker.js +1 -1
  65. package/dist/rich-text-layout-K48VHUoW.cjs +3 -0
  66. package/dist/{rich-text-layout-Ct5WrY1g.js → rich-text-layout-wxBhnAS7.js} +1 -1
  67. package/dist/{runtime-CEMvybO7.js → runtime-BDf5x1i1.js} +5 -5
  68. package/dist/runtime-DsJt1PIf.cjs +1 -0
  69. package/dist/sbom.cdx.json +1 -1
  70. package/dist/server-node.cjs +4 -4
  71. package/dist/server-node.js +1272 -1274
  72. package/dist/server.cjs +1 -1
  73. package/dist/server.js +8 -8
  74. package/dist/style.css +1 -1
  75. package/dist/{template-catalog-CmbWOJqy.js → template-catalog-DFwIS9aN.js} +3 -3
  76. package/dist/{template-catalog-Utu4GP09.cjs → template-catalog-D_2jdnkL.cjs} +1 -1
  77. package/dist/template-fragments-DZVUBhuB.cjs +1 -0
  78. package/dist/{template-fragments-DWgo9tlZ.js → template-fragments-Dng-AlHk.js} +11 -11
  79. package/dist/{template-registry-BIhIHOab.js → template-registry-DhBqoD7W.js} +120 -118
  80. package/dist/template-registry-DpLUSLwF.cjs +1 -0
  81. package/dist/{column-visual-BpgQVWwT.js → template-serialization-Cc3h-miv.js} +74 -65
  82. package/dist/{column-visual-CtYxnBCP.cjs → template-serialization-D1R5oAqh.cjs} +1 -1
  83. package/dist/{textwrap-BEIg2w8y.js → textwrap-CkGjRFT3.js} +1 -1
  84. package/dist/textwrap-OTOUMr4f.cjs +4 -0
  85. package/dist/vue-async.cjs +1 -1
  86. package/dist/vue-async.js +3 -3
  87. package/dist/vue.cjs +1 -1
  88. package/dist/vue.js +4 -4
  89. package/dist/{workbook-session-B94EwVa_.cjs → workbook-session-NYv01LHe.cjs} +1 -1
  90. package/dist/{workbook-session-BoScoOg-.js → workbook-session-oinxX3qo.js} +2 -2
  91. package/dist/worker.cjs +1 -1
  92. package/dist/worker.js +4 -4
  93. package/dist/xlsx.cjs +4 -4
  94. package/dist/xlsx.js +204 -205
  95. package/package.json +1 -1
  96. package/dist/ReportLabelStudio-Drsm9sAS.cjs +0 -1
  97. package/dist/ReportLabelStudio-r8VFnhGQ.js +0 -589
  98. package/dist/RuleEditor-BVuRn_OQ.cjs +0 -1
  99. package/dist/component-tree-6TV7W6Yj.cjs +0 -1
  100. package/dist/designer-B52ddmHO.js +0 -6676
  101. package/dist/designer-Dtsw_rh7.cjs +0 -2
  102. package/dist/grid-geometry-BNptEcMm.js +0 -65
  103. package/dist/grid-geometry-CZ_cYB6O.cjs +0 -1
  104. package/dist/json-snapshot-jiXff4lc.cjs +0 -2
  105. package/dist/record-bindings-ehjnCDHt.cjs +0 -1
  106. package/dist/rich-text-layout-ALlMoYOG.cjs +0 -3
  107. package/dist/runtime-CDA6d263.cjs +0 -1
  108. package/dist/style-67OqfNed.js +0 -73
  109. package/dist/style-C22Pbv3T.cjs +0 -1
  110. package/dist/template-fragments-C_zSHJAa.cjs +0 -1
  111. package/dist/template-registry-DzWswQI5.cjs +0 -1
  112. package/dist/textwrap-BI-yJ6Wt.cjs +0 -4
@@ -0,0 +1,764 @@
1
+ import { computed as p, shallowRef as Ce, ref as R, onMounted as st, onScopeDispose as qe, watch as X, defineComponent as ot, markRaw as rt, nextTick as ut, openBlock as S, createElementBlock as M, unref as t, normalizeClass as ze, createElementVNode as r, createVNode as ve, toDisplayString as d, createTextVNode as _, Fragment as be, renderList as Ne, createCommentVNode as N, withDirectives as W, isRef as se, vModelText as Se, vModelSelect as dt, withKeys as ct, withModifiers as ft, createBlock as Ae, withCtx as mt, vModelCheckbox as vt, resolveDynamicComponent as bt, vShow as pt } from "vue";
2
+ import { provideMachReportConfig as gt, ReportPreview as ht } from "@agile-team/mach-report/vue";
3
+ import { a as pe } from "./_plugin-vue_export-helper-8SL1F89S.js";
4
+ import { defineReportTemplate as yt, createLabelTemplate as wt, parseReportTemplate as x, serializeReportTemplate as Me, createReportSource as St, defineLabelReport as Mt, imposeLabelSheets as Ct } from "@agile-team/mach-report";
5
+ import { L as kt, c as _t } from "./designer-CIDHt5xz.js";
6
+ function Lt() {
7
+ let e;
8
+ const s = () => e ??= import("@agile-team/mach-report/codes").then((o) => o.createCodeAssetRenderers()).catch((o) => {
9
+ throw e = void 0, o;
10
+ }), n = (o) => async (u) => {
11
+ u.signal.throwIfAborted();
12
+ const l = await s();
13
+ return u.signal.throwIfAborted(), l[o](u);
14
+ };
15
+ return { assetRenderers: { barcode: n("barcode"), qrcode: n("qrcode") } };
16
+ }
17
+ function Rt(e) {
18
+ const s = e.pages[0];
19
+ if (!s || e.pages.some((u) => u.layout === "wide" || u.widthMm !== s.widthMm || u.heightMm !== s.heightMm)) return;
20
+ const n = Math.floor(190 / (s.widthMm + 4)), o = Math.floor(277 / (s.heightMm + 4));
21
+ if (!(n < 1 || o < 1 || n * o > 1e3))
22
+ return { paper: "a4", columns: n, rows: o, marginMm: 12, gapMm: 4, capacity: n * o };
23
+ }
24
+ const ke = [
25
+ { id: "material", widthMm: 80, heightMm: 55, faces: 1 },
26
+ { id: "paired", widthMm: 80, heightMm: 55, faces: 2 },
27
+ { id: "warehouse", widthMm: 100, heightMm: 60, faces: 1 }
28
+ ];
29
+ function Be(e, s) {
30
+ return s ?? e.fields.find((n) => n.semanticRole === "identifier" && n.field !== e.rowKey)?.field ?? e.rowKey ?? e.fields[0]?.field;
31
+ }
32
+ function Le(e, s, n) {
33
+ const o = e.fields.filter((a) => a.field !== s && a.field !== e.rowKey);
34
+ if (n === void 0)
35
+ return o.map((a, f) => ({ field: a, index: f, priority: Dt(a) })).sort((a, f) => a.priority - f.priority || a.index - f.index).slice(0, 5).map((a) => a.field);
36
+ const u = new Map(o.map((a) => [a.field, a])), l = [...new Set(n)];
37
+ if (l.length > 5) throw new Error("成品标签最多显示 5 个字段,请先精简显示字段");
38
+ return l.map((a) => {
39
+ const f = u.get(a);
40
+ if (!f) throw new Error(`标签显示字段未在业务契约中声明:${a}`);
41
+ return f;
42
+ });
43
+ }
44
+ function Dt(e) {
45
+ return /^(?:name|title|label|category)$/i.test(e.field) || /名称|品名|品类|类别/.test(e.label ?? "") ? 0 : e.semanticRole === "dimension" ? 1 : e.semanticRole === "measure" && e.unit ? 2 : e.semanticRole === "identifier" ? 3 : e.semanticRole === "date" ? 4 : 5;
46
+ }
47
+ function Ft(e = "paired") {
48
+ return ke.find((s) => s.id === e) ?? ke[1];
49
+ }
50
+ const xe = "#173450", Re = "#586c82";
51
+ function H(e, s, n, o, u = 4, l = 7) {
52
+ return {
53
+ kind: "text",
54
+ text: e,
55
+ leftMm: s,
56
+ topMm: n,
57
+ widthMm: o,
58
+ heightMm: u,
59
+ style: { fontSize: l, lineHeight: 1.1, color: xe, verticalAlign: "middle" }
60
+ };
61
+ }
62
+ function Te(e, s) {
63
+ return {
64
+ kind: "line",
65
+ leftMm: 4,
66
+ topMm: e,
67
+ widthMm: s - 8,
68
+ heightMm: 0.2,
69
+ style: { lineColor: "#c9d7e5", lineWidthPt: 0.55 }
70
+ };
71
+ }
72
+ function He(e, s, n) {
73
+ const o = [];
74
+ let u = 4;
75
+ if (n?.logoData) {
76
+ if (!/^data:image\/(?:png|jpeg);base64,/i.test(n.logoData))
77
+ throw new Error("标签Logo须使用PNG或JPEG图片数据");
78
+ o.push({ kind: "image", leftMm: 4, topMm: 3, widthMm: 12, heightMm: 7, imageData: n.logoData, meta: { labelBrandLogo: !0 } }), u = 19;
79
+ }
80
+ return o.push({ ...H(n?.name?.trim() || e, u, 3, s - u - 4, 5, 9), style: { fontSize: 9, color: "#205582" }, meta: { labelStudioRole: "brand-name" } }), n?.tagline?.trim() && o.push({ ...H(n.tagline.trim(), u, 8, s - u - 4, 3, 5.5), style: { fontSize: 5.5, color: Re }, meta: { labelStudioRole: "brand-tagline" } }), o.push(Te(12, s)), o;
81
+ }
82
+ function Ke(e, s, n, o, u = 4.7) {
83
+ return e.flatMap((l, a) => {
84
+ const f = s + a * u;
85
+ return [
86
+ { ...H(l.label ?? l.field, 4, f, n, 4, 6), style: { fontSize: 6, color: Re }, meta: { labelStudioRole: "field-label", labelStudioField: l.field } },
87
+ { ...H("", 4 + n, f, o, 4, 7), binding: { field: l.field, ...l.format ? { format: l.format } : {} }, meta: { labelStudioRole: "field-value", labelStudioField: l.field } }
88
+ ];
89
+ });
90
+ }
91
+ function Nt(e, s) {
92
+ return e ? [{ ...H("", 4, 14, s, 7, 14), binding: { field: e }, style: { fontSize: 14, color: xe } }] : [];
93
+ }
94
+ function Et(e, s, n, o) {
95
+ const u = Le(e, n, o.fields), l = [
96
+ ...He(s, 80, o.brand),
97
+ ...Nt(n, 71),
98
+ ...Ke(u, 23, 21, 27)
99
+ ];
100
+ n && l.push({ kind: "qrcode", leftMm: 55, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: n }, code: { quietZoneModules: 4, errorCorrection: "M" } }), l.push(Te(48, 80));
101
+ const a = e.fields.find((f) => f.field === n)?.label ?? s;
102
+ return l.push({ ...H(a, 4, 49, 71, 3, 5.8), style: { fontSize: 5.8, color: Re } }), l;
103
+ }
104
+ function Je(e, s, n, o, u = 80) {
105
+ const l = He(s, u, o.brand);
106
+ n && (l.push({ ...H("", 4, 14, u - 8, 8, 16), binding: { field: n }, style: { fontSize: 16, align: "center", color: xe } }), l.push({ kind: "qrcode", leftMm: (u - 20) / 2, topMm: 23, widthMm: 20, heightMm: 20, binding: { field: n }, code: { quietZoneModules: 4, errorCorrection: "M" } })), l.push(Te(44, u));
107
+ const a = Le(e, n, o.fields);
108
+ return u === 100 ? a.forEach((f, y) => {
109
+ const g = y % 2 === 0 ? 4 : 52, v = 46 + Math.floor(y / 2) * 4.3;
110
+ l.push({ ...H(f.label ?? f.field, g, v, 19, 3.7, 5.8), style: { fontSize: 5.8, color: Re }, meta: { labelStudioRole: "field-label", labelStudioField: f.field } }), l.push({ ...H("", g + 19, v, 25, 3.7, 6.5), binding: { field: f.field, ...f.format ? { format: f.format } : {} }, meta: { labelStudioRole: "field-value", labelStudioField: f.field } });
111
+ }) : l.push(...Ke(a.slice(0, 1), 46, 24, u - 32, 5)), l;
112
+ }
113
+ function ge(e, s, n, o = {}) {
114
+ const u = Be(e, n), l = Ft(o.preset), a = Object.fromEntries(["name", "tagline"].flatMap((v) => {
115
+ const h = o.brand?.[v];
116
+ return typeof h == "string" ? [[v, h]] : [];
117
+ })), f = { preset: l.id, brand: a, fields: Le(e, u, o.fields).map((v) => v.field) }, y = l.id === "warehouse" ? Je(e, s, u, o, l.widthMm) : Et(e, s, u, o), g = [{ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${s} · 1`, labelStudio: f }, components: y }];
118
+ return l.faces === 2 && g.push({ widthMm: l.widthMm, heightMm: l.heightMm, meta: { title: `${s} · 2`, labelStudio: f }, components: Je(e, s, u, o) }), yt({ id: "record-label", name: s, template: wt({ dataset: "records", rowKey: e.rowKey, pages: g }) });
119
+ }
120
+ const J = (e) => e.meta?.labelStudioRole, Ee = (e) => typeof J(e) == "string";
121
+ function _e(e) {
122
+ const s = { ...e, ...e.meta ? { meta: { ...e.meta } } : {} };
123
+ return s.meta && (delete s.meta.labelStudioRole, delete s.meta.labelStudioField, Object.keys(s.meta).length || delete s.meta), s;
124
+ }
125
+ function xt(e, s) {
126
+ for (const n of s.components.filter(Ee)) {
127
+ if (e.components.some((u) => J(u) === J(n) && u.meta?.labelStudioField === n.meta?.labelStudioField)) continue;
128
+ const o = e.components.find((u) => !Ee(u) && JSON.stringify(_e(u)) === JSON.stringify(_e(n)));
129
+ o && (o.meta = { ...o.meta, ...n.meta });
130
+ }
131
+ }
132
+ function Tt(e, s) {
133
+ const n = e.kind === "list" ? Number.POSITIVE_INFINITY : e.heightMm, o = s.kind === "list" ? Number.POSITIVE_INFINITY : s.heightMm;
134
+ return e.leftMm < s.leftMm + s.widthMm && e.leftMm + e.widthMm > s.leftMm && e.topMm < s.topMm + o && e.topMm + n > s.topMm;
135
+ }
136
+ function Vt(e, s) {
137
+ const n = { ...e, meta: { ...e.meta, ...s.meta } };
138
+ return n.kind === "text" && s.kind === "text" && (n.text = s.text, s.binding ? n.binding = structuredClone(s.binding) : delete n.binding), n;
139
+ }
140
+ function It(e, s, n, o) {
141
+ const u = o.has("field-value");
142
+ xt(e, s);
143
+ const l = new Set(e.components.filter((v) => J(v) === "field-label" || J(v) === "field-value")), a = [...l], f = /* @__PURE__ */ new Map(), y = [];
144
+ for (const v of n.components.filter(Ee)) {
145
+ const h = J(v);
146
+ if (!o.has(String(h))) continue;
147
+ const D = h === "field-label" || h === "field-value" ? a.find((k) => J(k) === h && !f.has(k)) : e.components.find((k) => J(k) === h);
148
+ D ? f.set(D, Vt(D, v)) : y.push(structuredClone(v));
149
+ }
150
+ const g = e.components.filter((v) => (!u || !l.has(v) || f.has(v)) && (!o.has("brand-tagline") || J(v) !== "brand-tagline" || n.components.some((h) => J(h) === "brand-tagline"))).map((v) => f.get(v) ?? v);
151
+ for (const v of y) {
152
+ if (g.some((h) => Tt(h, v))) return !1;
153
+ g.push(v);
154
+ }
155
+ return e.components = g, e.meta = { ...e.meta, labelStudio: n.meta?.labelStudio }, !0;
156
+ }
157
+ function Ot(e, s, n, o, u, l) {
158
+ const a = ge(s, n, o, u), f = ge(s, n, o, l), y = x(e), g = /* @__PURE__ */ new Set();
159
+ JSON.stringify(u.fields) !== JSON.stringify(l.fields) && (g.add("field-label"), g.add("field-value")), (u.brand?.name ?? "").trim() !== (l.brand?.name ?? "").trim() && g.add("brand-name"), (u.brand?.tagline ?? "").trim() !== (l.brand?.tagline ?? "").trim() && g.add("brand-tagline");
160
+ for (const [v, h] of y.template.pages.entries()) {
161
+ const D = a.template.pages[v], k = f.template.pages[v];
162
+ if (D && k && !It(h, D, k, g)) return;
163
+ }
164
+ return y;
165
+ }
166
+ function $t(e, s) {
167
+ const n = e.template.pages, o = s.template.pages;
168
+ return n.length !== o.length || n.some((u, l) => u.components.length !== o[l].components.length) ? !0 : n.some((u, l) => {
169
+ const a = o[l], f = { ...u, meta: void 0, components: void 0 }, y = { ...a, meta: void 0, components: void 0 };
170
+ return JSON.stringify(f) !== JSON.stringify(y) || u.components.some((g, v) => JSON.stringify(_e(g)) !== JSON.stringify(_e(a.components[v])));
171
+ });
172
+ }
173
+ function zt(e, s, n, o, u) {
174
+ const l = { ...e, template: ge(s, n, o, u).template }, a = e.template.repeat;
175
+ return a?.copies !== void 0 && l.template.repeat && (l.template.repeat.copies = a.copies), l;
176
+ }
177
+ function A(e) {
178
+ const s = e.template.pages[0]?.meta?.labelStudio;
179
+ if (!s || typeof s != "object") return;
180
+ const n = s, o = ke.find((f) => f.id === n.preset);
181
+ if (!o) return;
182
+ const u = Array.isArray(n.fields) ? n.fields.filter((f) => typeof f == "string") : void 0;
183
+ if (u && u.length > 5) return;
184
+ const l = n.brand && typeof n.brand == "object" ? n.brand : {}, a = {};
185
+ for (const f of ["name", "tagline", "logoData"])
186
+ typeof l[f] == "string" && (a[f] = l[f]);
187
+ return { preset: o.id, fields: u, brand: a };
188
+ }
189
+ function Pe(e, s, n) {
190
+ const o = new Set(e.fields.filter((l) => l.field !== s && l.field !== e.rowKey).map((l) => l.field)), u = n?.filter((l) => o.has(l));
191
+ return Le(e, s, u).map((l) => l.field);
192
+ }
193
+ function At(e, s) {
194
+ const n = p(() => ({ ...kt, ...e.messages })), o = p(() => e.title ?? n.value.title), u = { preset: e.preset, brand: e.brand, fields: e.fields }, l = Ce(e.modelValue ? x(e.modelValue) : ge(e.schema, o.value, e.identityField, u)), a = Ce(x(l.value)), f = R(!1), y = Ce();
195
+ let g, v;
196
+ st(() => {
197
+ e.modelValue || s(x(l.value));
198
+ });
199
+ const h = R("preview"), D = R("all"), k = R(1), O = R(!1), oe = R(!1), w = R(), K = _t(() => e.beforeDiscard), U = p(() => oe.value || K.pending.value || f.value && !w.value || w.value?.saving === !0 || w.value?.blocked === !0), L = R(""), ee = p(() => Be(e.schema, e.identityField)), $ = R(A(l.value)?.preset ?? (e.modelValue ? void 0 : e.preset ?? "paired")), j = R(A(l.value)?.brand?.name ?? e.brand?.name ?? ""), T = R(A(l.value)?.brand?.tagline ?? e.brand?.tagline ?? ""), F = R(Pe(e.schema, ee.value, A(l.value)?.fields ?? e.fields)), te = R(""), le = p(() => e.schema.fields.filter((i) => i.field !== ee.value && i.field !== e.schema.rowKey)), ae = p(() => F.value.map((i) => ({ field: i, label: e.schema.fields.find((b) => b.field === i)?.label ?? i }))), re = p(() => {
200
+ const i = te.value.trim().toLocaleLowerCase();
201
+ return le.value.filter((b) => `${b.label ?? ""} ${b.field}`.toLocaleLowerCase().includes(i)).slice(0, 30);
202
+ }), G = p(() => {
203
+ const i = l.value.template.pages[0]?.components.find((b) => b.kind === "image" && b.meta?.labelBrandLogo);
204
+ return i?.kind === "image" ? i.imageData : e.brand?.logoData;
205
+ }), ue = p(() => ({
206
+ preset: $.value,
207
+ fields: F.value,
208
+ brand: { ...e.brand, ...G.value ? { logoData: G.value } : {}, name: j.value, tagline: T.value }
209
+ }));
210
+ let de = JSON.stringify(A(l.value));
211
+ const ce = p(() => {
212
+ const i = A(l.value);
213
+ if (!i) return !0;
214
+ try {
215
+ const b = ge(e.schema, o.value, e.identityField, { ...i, brand: { ...i.brand, ...G.value ? { logoData: G.value } : {} } });
216
+ return $t(l.value, b);
217
+ } catch {
218
+ return !0;
219
+ }
220
+ }), P = R(!1), Q = p(() => $.value !== A(l.value)?.preset), Y = () => JSON.stringify({ preset: $.value, fields: F.value, name: j.value, tagline: T.value }), fe = R(Y()), q = p(() => Y() !== fe.value), me = p(() => Me(l.value)), De = p(() => Me(a.value)), ne = p(() => me.value !== De.value), he = p(() => q.value || ne.value || w.value?.pendingLocalChanges === !0);
221
+ function B() {
222
+ P.value = !1;
223
+ const i = A(l.value);
224
+ $.value = i?.preset, F.value = Pe(e.schema, ee.value, i?.fields ?? e.fields), j.value = i?.brand?.name ?? e.brand?.name ?? "", T.value = i?.brand?.tagline ?? e.brand?.tagline ?? "", de = JSON.stringify(i), fe.value = Y();
225
+ }
226
+ function ie(i) {
227
+ const b = A(i), C = JSON.stringify(b);
228
+ C !== de && (de = C, B());
229
+ }
230
+ let V = !1;
231
+ qe(() => {
232
+ V = !0, v?.abort();
233
+ });
234
+ const Z = Lt();
235
+ gt({ get defaults() {
236
+ return { ...e.preview, assets: { ...Z, ...e.preview?.assets, assetRenderers: { ...Z.assetRenderers, ...e.preview?.assets?.assetRenderers } } };
237
+ } }), X(w, (i) => {
238
+ const b = y.value;
239
+ if (!i || !b) return;
240
+ const C = l.value;
241
+ Me(b) !== me.value && i.applyTemplate?.(C.template), y.value = void 0, g = void 0;
242
+ }, { flush: "post" }), X([$, F, j, T], () => {
243
+ P.value = !1;
244
+ }), X(() => e.modelValue, (i) => {
245
+ i && Me(i) !== me.value && (l.value = x(i), a.value = x(i), g = void 0, ie(i));
246
+ }), X(() => e.rows, () => {
247
+ D.value = "all", k.value = 1;
248
+ });
249
+ function I(i) {
250
+ L.value = "", l.value = i, ie(i), s(i);
251
+ }
252
+ function m(i, b) {
253
+ b && F.value.length < 5 && !F.value.includes(i) ? F.value = [...F.value, i] : b || (F.value = F.value.filter((C) => C !== i));
254
+ }
255
+ function c(i = !1) {
256
+ if (U.value || V) return !1;
257
+ if (!$.value)
258
+ return L.value = n.value.choosePreset, !1;
259
+ if (w.value?.canApply === !1)
260
+ return L.value = w.value.saveReason || n.value.applyFirst, !1;
261
+ if (Q.value && !i)
262
+ return P.value = !0, !1;
263
+ try {
264
+ const b = A(l.value);
265
+ let C;
266
+ if (i ? C = zt(l.value, e.schema, o.value, e.identityField, ue.value) : b && (C = Ot(l.value, e.schema, o.value, e.identityField, b, ue.value)), !C)
267
+ return L.value = n.value.contentNeedsDesign, !1;
268
+ if (w.value?.applyTemplate) {
269
+ if (!w.value.applyTemplate(C.template))
270
+ return L.value = n.value.saveFailed, !1;
271
+ } else
272
+ g = x(l.value), I(C);
273
+ return P.value = !1, fe.value = Y(), !0;
274
+ } catch (b) {
275
+ return L.value = b instanceof Error ? b.message : n.value.saveFailed, !1;
276
+ }
277
+ }
278
+ const z = p(() => D.value === "all" ? e.rows : Number.isSafeInteger(k.value) && e.rows[k.value - 1] ? [e.rows[k.value - 1]] : []), ye = p(() => l.value.template.repeat?.dataset ?? "records"), Ue = p(() => ({ [ye.value]: z.value })), je = p(() => ({ [ye.value]: z.value.slice(0, 3) })), Ge = p(() => ({ [ye.value]: e.schema })), Qe = p(() => [{ id: ye.value, label: o.value, rowKey: e.schema.rowKey, fields: e.schema.fields }]), Ye = p(() => l.value.template.pages[0]), Ve = p(() => l.value.template.pages.length), Ze = p(() => {
279
+ const i = l.value.template.repeat?.copies ?? 1;
280
+ return typeof i == "number" ? i : void 0;
281
+ }), We = p(() => {
282
+ const i = l.value.template.repeat?.copies;
283
+ return typeof i == "object" ? i.field : void 0;
284
+ }), Ie = p(() => {
285
+ const i = We.value;
286
+ if (!i) return;
287
+ let b = 0;
288
+ for (const C of z.value) {
289
+ const E = Object.getOwnPropertyDescriptor(C, i)?.value;
290
+ if (typeof E != "number" || !Number.isSafeInteger(E) || E < 1 || E > 1e3) return;
291
+ b += E;
292
+ }
293
+ return b;
294
+ }), Xe = p(() => {
295
+ const i = Ze.value;
296
+ return i !== void 0 ? Number.isSafeInteger(i) && i >= 1 && i <= 1e3 ? z.value.length * i * Ve.value : void 0 : Ie.value === void 0 ? void 0 : Ie.value * Ve.value;
297
+ }), we = p(() => Rt(l.value.template)), et = p(() => {
298
+ const i = we.value;
299
+ return i ? n.value.sheetHint.replace("{columns}", String(i.columns)).replace("{rows}", String(i.rows)).replace("{capacity}", String(i.capacity)) : n.value.sheetUnavailable;
300
+ });
301
+ X(we, (i) => {
302
+ i || (O.value = !1);
303
+ });
304
+ const tt = p(() => {
305
+ const i = St({ labels: Mt({ template: l.value.template, rows: z.value, dataSchema: e.schema }) }), b = O.value ? we.value : void 0;
306
+ return async (C) => {
307
+ const E = await i(C);
308
+ return b ? Ct(E, { ...b, signal: C.signal }) : E;
309
+ };
310
+ }), Oe = async (i, b) => {
311
+ if (V || b.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
312
+ const C = x(i), E = x(e.save ? await e.save(C, b) : C);
313
+ if (E.id !== i.id) throw new Error(n.value.invalidSavedTemplate);
314
+ if (V || b.signal.aborted) throw new DOMException("标签模板保存已取消", "AbortError");
315
+ return a.value = x(E), I(E), E;
316
+ };
317
+ async function $e() {
318
+ if (!(U.value || V)) {
319
+ if (q.value && Q.value) {
320
+ L.value = n.value.applyLayoutFirst;
321
+ return;
322
+ }
323
+ if (!(q.value && !c())) {
324
+ oe.value = !0;
325
+ try {
326
+ if (w.value) {
327
+ if (w.value.canApply === !1) {
328
+ L.value = w.value.saveReason || n.value.applyFirst;
329
+ return;
330
+ }
331
+ if (w.value.pendingLocalChanges && await w.value.save(), w.value.pendingLocalChanges) {
332
+ L.value = n.value.saveFailed;
333
+ return;
334
+ }
335
+ } else ne.value && (v = new AbortController(), await Oe(l.value, { expectedRevision: l.value.revision, signal: v.signal }), g = void 0);
336
+ if (!V)
337
+ return L.value = "", x(l.value);
338
+ } catch (i) {
339
+ V || (L.value = i instanceof Error ? i.message : n.value.saveFailed);
340
+ } finally {
341
+ oe.value = !1, v = void 0;
342
+ }
343
+ }
344
+ }
345
+ }
346
+ async function lt(i) {
347
+ if (!(U.value || i === h.value))
348
+ if (i === "design" && !f.value) {
349
+ if (q.value && Q.value) {
350
+ L.value = n.value.applyLayoutFirst;
351
+ return;
352
+ }
353
+ if (q.value && !c()) return;
354
+ y.value = g, f.value = !0, h.value = i;
355
+ } else await $e() && (h.value = i);
356
+ }
357
+ function at(i) {
358
+ f.value = !1, h.value = "preview", L.value = `${n.value.designLoadFailed} ${i instanceof Error ? i.message : String(i)}`;
359
+ }
360
+ let Fe = !1;
361
+ const nt = (i) => Fe || K.request(i);
362
+ async function it() {
363
+ if (U.value) return !1;
364
+ const i = w.value?.pendingLocalChanges === !0;
365
+ if (!i && !ne.value && !q.value) return !0;
366
+ if (!(i && w.value ? await w.value.guardChanges() : await K.request({ reason: "replace", document: x(l.value), pendingLocalChanges: !0 })) || V) return !1;
367
+ if (i && w.value) {
368
+ Fe = !0;
369
+ try {
370
+ await w.value.reset();
371
+ } finally {
372
+ Fe = !1;
373
+ }
374
+ }
375
+ return I(x(a.value)), g = void 0, B(), !0;
376
+ }
377
+ return { m: n, notice: L, title: o, document: l, mode: h, editorVisited: f, editorInitialDocument: y, failDesignLoad: at, sheetLayout: we, sheetHint: et, rebuilding: P, layoutChanged: Q, record: D, recordIndex: k, sheet: O, busy: U, editor: w, rows: z, datasets: Ue, designDatasets: je, schemas: Ge, bindings: Qe, paper: Ye, labelCount: Xe, fetcher: tt, update: I, save: Oe, navigate: lt, prepare: $e, guardChanges: it, preset: $, presets: ke, brandName: j, brandTagline: T, fields: F, fieldQuery: te, selectedFields: ae, availableFields: re, fieldCount: p(() => le.value.length), configurationDirty: q, pendingLocalChanges: he, custom: ce, toggleField: m, applyConfiguration: c, requestRebuild: () => {
378
+ P.value = !0;
379
+ }, cancelRebuild: () => {
380
+ P.value = !1;
381
+ }, restoreConfiguration: B, beforeDiscard: nt, confirmation: K.confirmation, decideDiscard: K.decide };
382
+ }
383
+ const Jt = ["aria-label"], Pt = { class: "mr-label-context" }, qt = { class: "mr-label-identity" }, Bt = { class: "mr-label-spec" }, Ht = ["disabled"], Kt = ["aria-label"], Ut = ["aria-pressed", "onClick"], jt = { class: "mr-label-fields" }, Gt = {
384
+ key: 0,
385
+ class: "mr-label-selected-fields"
386
+ }, Qt = ["aria-label", "onClick"], Yt = { class: "mr-label-field-search" }, Zt = ["aria-label", "placeholder"], Wt = { class: "mr-label-field-options" }, Xt = ["checked", "disabled", "onChange"], el = { key: 0 }, tl = { key: 1 }, ll = { class: "mr-label-brand" }, al = ["placeholder"], nl = ["disabled"], il = {
387
+ key: 1,
388
+ class: "mr-label-rebuild",
389
+ role: "alert"
390
+ }, sl = {
391
+ key: 3,
392
+ class: "mr-label-reflow-hint"
393
+ }, ol = { class: "mr-label-reflow-hint" }, rl = { class: "mr-label-record" }, ul = ["disabled"], dl = { value: "all" }, cl = { value: "single" }, fl = {
394
+ key: 0,
395
+ class: "mr-label-record-index"
396
+ }, ml = ["max", "aria-label", "disabled"], vl = { class: "mr-label-count" }, bl = { class: "mr-label-help" }, pl = { class: "mr-label-main" }, gl = { class: "mr-label-bar" }, hl = ["aria-label"], yl = ["aria-pressed", "disabled"], wl = ["aria-pressed", "disabled"], Sl = {
397
+ key: 0,
398
+ class: "mr-label-notice",
399
+ role: "status"
400
+ }, Ml = ["aria-label"], Cl = { class: "mr-label-imposition" }, kl = ["disabled"], _l = {
401
+ key: 3,
402
+ class: "mr-label-editor"
403
+ }, Ll = {
404
+ key: 0,
405
+ class: "mr-label-editor-loading",
406
+ role: "status"
407
+ }, xl = /* @__PURE__ */ ot({
408
+ __name: "ReportLabelStudio",
409
+ props: {
410
+ showSave: { type: Boolean, default: !0 },
411
+ rows: {},
412
+ schema: {},
413
+ title: {},
414
+ identityField: {},
415
+ modelValue: {},
416
+ preview: {},
417
+ save: {},
418
+ beforeDiscard: {},
419
+ messages: {},
420
+ preset: {},
421
+ brand: {},
422
+ fields: {}
423
+ },
424
+ emits: ["update:modelValue"],
425
+ setup(e, { expose: s, emit: n }) {
426
+ const o = e, u = n, l = At(o, (I) => u("update:modelValue", I)), { m: a, notice: f, title: y, document: g, mode: v, record: h, recordIndex: D, sheet: k, busy: O, editor: oe, rows: w, designDatasets: K, schemas: U, bindings: L, paper: ee, labelCount: $, fetcher: j, preset: T, presets: F, brandName: te, brandTagline: le, fields: ae, fieldQuery: re, selectedFields: G, availableFields: ue, fieldCount: de, configurationDirty: ce, pendingLocalChanges: P, custom: Q, confirmation: Y, editorVisited: fe, editorInitialDocument: q, sheetLayout: me, sheetHint: De, rebuilding: ne, layoutChanged: he } = l, B = Ce();
427
+ let ie = !1;
428
+ qe(() => {
429
+ ie = !0;
430
+ }), X(l.editorVisited, async (I) => {
431
+ if (!(!I || B.value))
432
+ try {
433
+ const m = await import("./designer-CIDHt5xz.js").then((c) => c.t);
434
+ ie || (B.value = rt(m.default));
435
+ } catch (m) {
436
+ ie || l.failDesignLoad(m);
437
+ }
438
+ });
439
+ const V = R();
440
+ let Z = null;
441
+ return X(Y, async (I) => {
442
+ I ? (Z = window.document.activeElement, await ut(), V.value?.focus()) : Z?.isConnected && (Z.focus(), Z = null);
443
+ }), s({ guardChanges: l.guardChanges, prepare: l.prepare, get busy() {
444
+ return O.value;
445
+ }, get pendingLocalChanges() {
446
+ return P.value;
447
+ } }), (I, m) => (S(), M("section", {
448
+ class: ze(["mr-label-studio", { "is-design": t(v) === "design" }]),
449
+ "aria-label": t(y)
450
+ }, [
451
+ r("aside", Pt, [
452
+ r("div", qt, [
453
+ ve(pe, {
454
+ name: "file",
455
+ size: 18
456
+ }),
457
+ r("strong", null, d(t(y)), 1),
458
+ r("small", null, d(t(Q) ? t(a).customTemplate : t(a).readyTemplate), 1)
459
+ ]),
460
+ r("div", Bt, [
461
+ r("strong", null, [
462
+ _(d(t(ee)?.widthMm) + " ", 1),
463
+ m[16] || (m[16] = r("i", null, "×", -1)),
464
+ _(" " + d(t(ee)?.heightMm), 1)
465
+ ]),
466
+ r("span", null, "mm · " + d(t(g).template.pages.length) + " " + d(t(a).faces), 1)
467
+ ]),
468
+ r("fieldset", {
469
+ class: "mr-label-quick",
470
+ disabled: t(O)
471
+ }, [
472
+ r("legend", null, d(t(a).layout), 1),
473
+ r("div", {
474
+ class: "mr-label-presets",
475
+ "aria-label": t(a).layout
476
+ }, [
477
+ (S(!0), M(be, null, Ne(t(F), (c) => (S(), M("button", {
478
+ key: c.id,
479
+ type: "button",
480
+ "aria-pressed": t(T) === c.id,
481
+ onClick: (z) => T.value = c.id
482
+ }, [
483
+ r("span", {
484
+ class: ze(["mr-label-preset-art", `is-${c.id}`]),
485
+ "aria-hidden": "true"
486
+ }, [...m[17] || (m[17] = [
487
+ r("i", null, null, -1),
488
+ r("i", null, null, -1),
489
+ r("i", null, null, -1)
490
+ ])], 2),
491
+ r("span", null, [
492
+ r("strong", null, d(t(a)[`${c.id}Preset`]), 1),
493
+ r("small", null, d(c.widthMm) + " × " + d(c.heightMm) + " · " + d(c.faces) + " " + d(t(a).faces), 1)
494
+ ])
495
+ ], 8, Ut))), 128))
496
+ ], 8, Kt),
497
+ r("details", jt, [
498
+ r("summary", null, [
499
+ _(d(t(a).fields) + " ", 1),
500
+ r("span", null, d(t(ae).length) + " / 5", 1)
501
+ ]),
502
+ t(G).length ? (S(), M("div", Gt, [
503
+ (S(!0), M(be, null, Ne(t(G), (c) => (S(), M("button", {
504
+ key: c.field,
505
+ type: "button",
506
+ "aria-label": `${t(a).removeField} ${c.label}`,
507
+ onClick: (z) => t(l).toggleField(c.field, !1)
508
+ }, [
509
+ _(d(c.label) + " ", 1),
510
+ m[18] || (m[18] = r("span", { "aria-hidden": "true" }, "×", -1))
511
+ ], 8, Qt))), 128))
512
+ ])) : N("", !0),
513
+ r("label", Yt, [
514
+ ve(pe, {
515
+ name: "search",
516
+ size: 13
517
+ }),
518
+ W(r("input", {
519
+ "onUpdate:modelValue": m[0] || (m[0] = (c) => se(re) ? re.value = c : null),
520
+ type: "search",
521
+ "aria-label": t(a).findField,
522
+ placeholder: t(a).findField
523
+ }, null, 8, Zt), [
524
+ [Se, t(re)]
525
+ ])
526
+ ]),
527
+ r("div", Wt, [
528
+ (S(!0), M(be, null, Ne(t(ue), (c) => (S(), M("label", {
529
+ key: c.field
530
+ }, [
531
+ r("input", {
532
+ type: "checkbox",
533
+ checked: t(ae).includes(c.field),
534
+ disabled: !t(ae).includes(c.field) && t(ae).length >= 5,
535
+ onChange: (z) => t(l).toggleField(c.field, z.target.checked)
536
+ }, null, 40, Xt),
537
+ r("span", null, d(c.label ?? c.field), 1)
538
+ ]))), 128)),
539
+ t(ue).length ? N("", !0) : (S(), M("p", el, d(t(a).noFields), 1))
540
+ ]),
541
+ r("small", null, d(t(a).fieldLimit), 1),
542
+ t(de) > 30 ? (S(), M("small", tl, d(t(a).fieldSearchHint), 1)) : N("", !0)
543
+ ]),
544
+ r("details", ll, [
545
+ r("summary", null, d(t(a).brand), 1),
546
+ r("label", null, [
547
+ _(d(t(a).brandName), 1),
548
+ W(r("input", {
549
+ "onUpdate:modelValue": m[1] || (m[1] = (c) => se(te) ? te.value = c : null),
550
+ maxlength: "80",
551
+ placeholder: t(y)
552
+ }, null, 8, al), [
553
+ [Se, t(te)]
554
+ ])
555
+ ]),
556
+ r("label", null, [
557
+ _(d(t(a).brandTagline), 1),
558
+ W(r("input", {
559
+ "onUpdate:modelValue": m[2] || (m[2] = (c) => se(le) ? le.value = c : null),
560
+ maxlength: "120"
561
+ }, null, 512), [
562
+ [Se, t(le)]
563
+ ])
564
+ ])
565
+ ]),
566
+ r("button", {
567
+ class: "mr-label-apply",
568
+ type: "button",
569
+ disabled: !t(ce) || !t(T),
570
+ onClick: m[3] || (m[3] = (c) => t(l).applyConfiguration())
571
+ }, [
572
+ ve(pe, {
573
+ name: "arrow-right",
574
+ size: 13
575
+ }),
576
+ _(d(t(he) ? t(a).applyLayout : t(a).applyContent), 1)
577
+ ], 8, nl),
578
+ t(Q) && t(T) && !t(ne) ? (S(), M("button", {
579
+ key: 0,
580
+ class: "mr-label-reset-configuration mr-label-rebuild-current",
581
+ type: "button",
582
+ onClick: m[4] || (m[4] = //@ts-ignore
583
+ (...c) => t(l).requestRebuild && t(l).requestRebuild(...c))
584
+ }, d(t(a).rebuildCurrent), 1)) : N("", !0),
585
+ t(ne) ? (S(), M("div", il, [
586
+ r("strong", null, d(t(a).rebuildTitle), 1),
587
+ r("p", null, d(t(a).rebuildDescription), 1),
588
+ r("div", null, [
589
+ r("button", {
590
+ type: "button",
591
+ onClick: m[5] || (m[5] = //@ts-ignore
592
+ (...c) => t(l).cancelRebuild && t(l).cancelRebuild(...c))
593
+ }, d(t(a).cancelRebuild), 1),
594
+ r("button", {
595
+ type: "button",
596
+ onClick: m[6] || (m[6] = (c) => t(l).applyConfiguration(!0))
597
+ }, d(t(a).confirmRebuild), 1)
598
+ ])
599
+ ])) : N("", !0),
600
+ t(ce) ? (S(), M("button", {
601
+ key: 2,
602
+ class: "mr-label-reset-configuration",
603
+ type: "button",
604
+ onClick: m[7] || (m[7] = //@ts-ignore
605
+ (...c) => t(l).restoreConfiguration && t(l).restoreConfiguration(...c))
606
+ }, d(t(a).restoreConfiguration), 1)) : N("", !0),
607
+ t(ce) && !t(T) ? (S(), M("p", sl, d(t(a).choosePreset), 1)) : N("", !0),
608
+ r("p", ol, d(t(he) ? t(a).reflowHint : t(a).contentHint), 1)
609
+ ], 8, Ht),
610
+ r("label", rl, [
611
+ _(d(t(a).records), 1),
612
+ W(r("select", {
613
+ "onUpdate:modelValue": m[8] || (m[8] = (c) => se(h) ? h.value = c : null),
614
+ disabled: t(O) || !o.rows.length
615
+ }, [
616
+ r("option", dl, d(t(a).all) + " · " + d(o.rows.length), 1),
617
+ r("option", cl, d(t(a).single), 1)
618
+ ], 8, ul), [
619
+ [dt, t(h)]
620
+ ])
621
+ ]),
622
+ t(h) === "single" ? (S(), M("label", fl, [
623
+ _(d(t(a).record), 1),
624
+ W(r("input", {
625
+ "onUpdate:modelValue": m[9] || (m[9] = (c) => se(D) ? D.value = c : null),
626
+ type: "number",
627
+ min: "1",
628
+ max: o.rows.length,
629
+ "aria-label": t(a).record,
630
+ disabled: t(O)
631
+ }, null, 8, ml), [
632
+ [
633
+ Se,
634
+ t(D),
635
+ void 0,
636
+ { number: !0 }
637
+ ]
638
+ ]),
639
+ _(" / " + d(o.rows.length), 1)
640
+ ])) : N("", !0),
641
+ r("p", vl, [
642
+ r("strong", null, d(t(w).length), 1),
643
+ _(" " + d(t(a).count) + " ", 1),
644
+ m[19] || (m[19] = r("span", null, "→", -1)),
645
+ m[20] || (m[20] = _()),
646
+ t($) !== void 0 ? (S(), M(be, { key: 0 }, [
647
+ r("strong", null, d(t($)), 1),
648
+ _(" " + d(t(a).labels), 1)
649
+ ], 64)) : (S(), M(be, { key: 1 }, [
650
+ _(d(t(a).invalidCopies), 1)
651
+ ], 64))
652
+ ]),
653
+ r("details", bl, [
654
+ r("summary", null, d(t(a).guide), 1),
655
+ r("p", null, d(t(a).help), 1),
656
+ r("p", null, d(t(a).printHint), 1)
657
+ ])
658
+ ]),
659
+ r("div", pl, [
660
+ r("header", gl, [
661
+ r("nav", { "aria-label": t(y) }, [
662
+ r("button", {
663
+ type: "button",
664
+ "aria-pressed": t(v) === "preview",
665
+ disabled: t(O),
666
+ onClick: m[10] || (m[10] = (c) => t(l).navigate("preview"))
667
+ }, [
668
+ ve(pe, {
669
+ name: "file",
670
+ size: 14
671
+ }),
672
+ _(d(t(a).preview), 1)
673
+ ], 8, yl),
674
+ r("button", {
675
+ type: "button",
676
+ "aria-pressed": t(v) === "design",
677
+ disabled: t(O),
678
+ onClick: m[11] || (m[11] = (c) => t(l).navigate("design"))
679
+ }, [
680
+ ve(pe, {
681
+ name: "settings",
682
+ size: 14
683
+ }),
684
+ _(d(t(a).design), 1)
685
+ ], 8, wl)
686
+ ], 8, hl),
687
+ r("span", null, d(t(v) === "design" ? t(a).designHint : t(a).flow), 1)
688
+ ]),
689
+ t(f) ? (S(), M("p", Sl, d(t(f)), 1)) : N("", !0),
690
+ t(Y) ? (S(), M("div", {
691
+ key: 1,
692
+ class: "mr-label-confirm",
693
+ role: "alertdialog",
694
+ "aria-label": t(a).discardTitle,
695
+ onKeydown: m[14] || (m[14] = ct(ft((c) => t(l).decideDiscard(!1), ["prevent", "stop"]), ["esc"]))
696
+ }, [
697
+ r("div", null, [
698
+ r("strong", null, d(t(a).discardTitle), 1),
699
+ r("p", null, d(t(a).discardDescription), 1)
700
+ ]),
701
+ r("button", {
702
+ ref_key: "keepEditingButton",
703
+ ref: V,
704
+ type: "button",
705
+ onClick: m[12] || (m[12] = (c) => t(l).decideDiscard(!1))
706
+ }, d(t(a).keepEditing), 513),
707
+ r("button", {
708
+ type: "button",
709
+ onClick: m[13] || (m[13] = (c) => t(l).decideDiscard(!0))
710
+ }, d(t(a).discard), 1)
711
+ ], 40, Ml)) : N("", !0),
712
+ t(v) === "preview" ? (S(), Ae(t(ht), {
713
+ key: 2,
714
+ "report-id": "labels",
715
+ fetcher: t(j),
716
+ "show-params": !1,
717
+ height: "100%",
718
+ toolbar: { exportFormats: ["pdf", "png", "html"], editing: !1, excelImport: !1 },
719
+ messages: { title: t(y), empty: t(a).empty }
720
+ }, {
721
+ settings: mt(() => [
722
+ r("label", Cl, [
723
+ W(r("input", {
724
+ "onUpdate:modelValue": m[15] || (m[15] = (c) => se(k) ? k.value = c : null),
725
+ type: "checkbox",
726
+ disabled: !t(me)
727
+ }, null, 8, kl), [
728
+ [vt, t(k)]
729
+ ]),
730
+ _(d(t(a).sheet), 1),
731
+ r("small", null, d(t(De)), 1)
732
+ ])
733
+ ]),
734
+ _: 1
735
+ }, 8, ["fetcher", "messages"])) : N("", !0),
736
+ t(fe) ? W((S(), M("div", _l, [
737
+ B.value ? N("", !0) : (S(), M("p", Ll, d(t(a).designLoading), 1)),
738
+ B.value ? (S(), Ae(bt(B.value), {
739
+ key: 1,
740
+ ref_key: "editor",
741
+ ref: oe,
742
+ "model-value": t(q) ?? t(g),
743
+ mode: "design",
744
+ "show-mode-switch": !1,
745
+ "show-save": e.showSave,
746
+ capabilities: { params: !1 },
747
+ datasets: t(K),
748
+ "data-schemas": t(U),
749
+ "binding-datasets": t(L),
750
+ save: t(l).save,
751
+ "before-discard": t(l).beforeDiscard,
752
+ preview: e.preview,
753
+ "onUpdate:modelValue": t(l).update
754
+ }, null, 8, ["model-value", "show-save", "datasets", "data-schemas", "binding-datasets", "save", "before-discard", "preview", "onUpdate:modelValue"])) : N("", !0)
755
+ ], 512)), [
756
+ [pt, t(v) === "design"]
757
+ ]) : N("", !0)
758
+ ])
759
+ ], 10, Jt));
760
+ }
761
+ });
762
+ export {
763
+ xl as default
764
+ };