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