@agile-team/mach-report 2.9.1 → 2.11.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 (115) hide show
  1. package/README.md +11 -7
  2. package/dist/ExcelBindingWizard-CjIiVox-.cjs +1 -0
  3. package/dist/ExcelBindingWizard-Dxm-K5HL.js +1240 -0
  4. package/dist/ParamEditor-D-Hf5xfO.cjs +1 -0
  5. package/dist/ParamEditor-DRGxzxeO.js +381 -0
  6. package/dist/ReportBatchPanel-BYgg0EDB.cjs +1 -0
  7. package/dist/ReportBatchPanel-Bby5yLzU.js +287 -0
  8. package/dist/ReportPreview-DWXROHBP.cjs +6 -0
  9. package/dist/ReportPreview-DiNXhQI0.js +4138 -0
  10. package/dist/ReportTemplateLibrary-C6CO7YCT.cjs +1 -0
  11. package/dist/ReportTemplateLibrary-DfzDXRvr.js +260 -0
  12. package/dist/RuleEditor-C2QsOHOs.cjs +1 -0
  13. package/dist/RuleEditor-D9wQHrkf.js +2024 -0
  14. package/dist/TemplateReviewPanel-BKofGrV9.js +222 -0
  15. package/dist/TemplateReviewPanel-DwtOcLue.cjs +1 -0
  16. package/dist/analytics.cjs +1 -1
  17. package/dist/analytics.d.cts +4 -0
  18. package/dist/analytics.d.ts +4 -0
  19. package/dist/analytics.js +40 -39
  20. package/dist/{assets-ahTRUXRk.cjs → assets-Bu6UohJx.cjs} +1 -1
  21. package/dist/{assets-DDsfEi8R.js → assets-DegqDNqY.js} +1 -1
  22. package/dist/batch-Bt3Fd27Z.cjs +1 -0
  23. package/dist/batch-mRqhhhjt.js +364 -0
  24. package/dist/{capabilities-Cm9hZ3uV.js → capabilities-CK_7hizc.js} +16 -16
  25. package/dist/capabilities-CsZ-pNHR.cjs +1 -0
  26. package/dist/computed-Bvk0W15F.js +521 -0
  27. package/dist/computed-CGV2a809.cjs +1 -0
  28. package/dist/config-B612mw0x.js +525 -0
  29. package/dist/config-BRoLo2oj.cjs +1 -0
  30. package/dist/designer.cjs +2 -2
  31. package/dist/designer.d.cts +695 -50
  32. package/dist/designer.d.ts +695 -50
  33. package/dist/designer.js +2213 -1748
  34. package/dist/index.cjs +8 -8
  35. package/dist/index.d.cts +205 -6
  36. package/dist/index.d.ts +205 -6
  37. package/dist/index.js +808 -1033
  38. package/dist/injection-keys-Db_DyLkm.cjs +1 -0
  39. package/dist/injection-keys-e85udZCp.js +7 -0
  40. package/dist/list-cell-BuYn4tGF.cjs +1 -0
  41. package/dist/list-cell-ClFra1zS.js +173 -0
  42. package/dist/matrix-DVyWiYsd.cjs +1 -0
  43. package/dist/matrix-yZsGnldA.js +227 -0
  44. package/dist/param-validation-BlHHXs6u.js +153 -0
  45. package/dist/param-validation-DCK039V1.cjs +1 -0
  46. package/dist/pdf.cjs +49 -49
  47. package/dist/pdf.d.cts +31 -1
  48. package/dist/pdf.d.ts +31 -1
  49. package/dist/pdf.js +4797 -4650
  50. package/dist/plugin-BDTU4D94.cjs +1 -0
  51. package/dist/plugin-Cd5G2QQn.js +22 -0
  52. package/dist/region-binding-workflow-CXDmt9Bs.js +977 -0
  53. package/dist/region-binding-workflow-DhQvu1co.cjs +3 -0
  54. package/dist/{report-params-B_VCihAh.js → report-params-B44imUd4.js} +1 -1
  55. package/dist/{report-params-CjWrjPl6.cjs → report-params-SJfhKgaX.cjs} +1 -1
  56. package/dist/server/node.d.cts +48 -5
  57. package/dist/server/node.d.ts +48 -5
  58. package/dist/server-node.cjs +1 -1
  59. package/dist/server-node.js +503 -317
  60. package/dist/server.cjs +1 -1
  61. package/dist/server.d.cts +252 -4
  62. package/dist/server.d.ts +252 -4
  63. package/dist/server.js +567 -469
  64. package/dist/style.css +1 -1
  65. package/dist/template-registry-WNXdkiET.js +506 -0
  66. package/dist/template-registry-ukBGlm8N.cjs +1 -0
  67. package/dist/template-review-BXp2oyqg.cjs +1 -0
  68. package/dist/template-review-BdcXSYbx.js +1616 -0
  69. package/dist/tree-BX380Rr7.cjs +1 -0
  70. package/dist/tree-CqcQ99NM.js +172 -0
  71. package/dist/useLocalDraft-C07SYRnC.js +11 -0
  72. package/dist/useLocalDraft-Yiw1wFgI.cjs +1 -0
  73. package/dist/{validate-DWPF7icl.js → validate-7s0yn6ii.js} +26 -26
  74. package/dist/validate-DsRiNw8h.cjs +1 -0
  75. package/dist/vue/async.d.cts +118 -6
  76. package/dist/vue/async.d.ts +118 -6
  77. package/dist/vue/index.d.cts +177 -11
  78. package/dist/vue/index.d.ts +177 -11
  79. package/dist/vue-async.cjs +1 -1
  80. package/dist/vue-async.js +5 -5
  81. package/dist/vue.cjs +1 -1
  82. package/dist/vue.js +116 -113
  83. package/dist/{import-template-CNMLJSQw.js → workbook-session-BKOTwcoq.js} +4290 -4227
  84. package/dist/{import-template-CpxunKVp.cjs → workbook-session-CLYLhZWu.cjs} +17 -17
  85. package/dist/worker.cjs +1 -1
  86. package/dist/worker.d.cts +9 -2
  87. package/dist/worker.d.ts +9 -2
  88. package/dist/worker.js +1 -1
  89. package/dist/xlsx.cjs +4 -2
  90. package/dist/xlsx.d.cts +159 -3
  91. package/dist/xlsx.d.ts +159 -3
  92. package/dist/xlsx.js +354 -192
  93. package/package.json +1 -1
  94. package/dist/ExcelBindingWizard-DiaxvWpQ.cjs +0 -1
  95. package/dist/ExcelBindingWizard-RLJIXKKG.js +0 -816
  96. package/dist/ReportPreview-B5ZNEasW.js +0 -4439
  97. package/dist/ReportPreview-DRtVPUYo.cjs +0 -6
  98. package/dist/RuleEditor-CskN5Fr3.cjs +0 -1
  99. package/dist/RuleEditor-CtJFzKuY.js +0 -1578
  100. package/dist/TemplateReviewPanel-C_Lmzis6.cjs +0 -1
  101. package/dist/TemplateReviewPanel-Cn32OY4_.js +0 -173
  102. package/dist/binding-preview-B5834rml.cjs +0 -2
  103. package/dist/binding-preview-ChXjN5L5.js +0 -649
  104. package/dist/capabilities-DYzWL7KS.cjs +0 -1
  105. package/dist/matrix-CNPDJxED.js +0 -745
  106. package/dist/matrix-Div9Ilh3.cjs +0 -1
  107. package/dist/param-validation-BWNjLcN0.js +0 -116
  108. package/dist/param-validation-CiTxFeZ8.cjs +0 -1
  109. package/dist/plugin-BWwIgZXV.js +0 -25
  110. package/dist/plugin-Dg-J1Rbm.cjs +0 -1
  111. package/dist/template-registry-CHMYZ7SD.cjs +0 -1
  112. package/dist/template-registry-R61AMCr0.js +0 -433
  113. package/dist/template-review-hvWWQFsi.js +0 -1027
  114. package/dist/template-review-jEcOfmGr.cjs +0 -1
  115. package/dist/validate-BDiMqkJC.cjs +0 -1
@@ -0,0 +1,1240 @@
1
+ import { defineComponent as xe, ref as M, computed as E, openBlock as r, createElementBlock as u, createElementVNode as t, createTextVNode as D, toDisplayString as n, createVNode as P, Fragment as A, renderList as W, normalizeClass as be, unref as e, withDirectives as ae, vModelSelect as fe, createCommentVNode as S, vModelText as Re, shallowRef as Ae, watch as de, onBeforeUnmount as Ie, normalizeStyle as Ne, createBlock as Pe, vShow as We } from "vue";
2
+ import { a as V } from "./_plugin-vue_export-helper-8SL1F89S.js";
3
+ import { o as he, q as Me, f as Ve, n as Te, m as He, h as Oe, k as Ue, v as Je, i as qe, p as je, d as Ge, c as Xe, e as Qe, a as Ye, g as Ze } from "./region-binding-workflow-CXDmt9Bs.js";
4
+ import { u as et } from "./useLocalDraft-C07SYRnC.js";
5
+ import { EXCEL_BINDING_MESSAGES as tt } from "./designer.js";
6
+ const lt = ["aria-label"], at = { class: "mr-binding-group" }, nt = { class: "mr-binding-note" }, ot = ["disabled"], st = {
7
+ class: "mr-binding-region-list",
8
+ role: "list"
9
+ }, it = ["aria-pressed", "onClick"], rt = ["aria-label", "disabled", "onClick"], ut = ["disabled"], dt = {
10
+ key: 0,
11
+ class: "mr-binding-group"
12
+ }, ct = { class: "mr-binding-label" }, vt = ["value", "aria-label"], gt = { class: "mr-binding-label" }, mt = ["aria-label"], bt = { value: "record" }, ft = { value: "repeat" }, ht = { class: "mr-binding-note" }, yt = { class: "mr-binding-label" }, pt = ["value", "aria-label"], wt = { value: "" }, kt = ["value"], $t = {
13
+ key: 0,
14
+ class: "mr-binding-label"
15
+ }, Ct = ["aria-label"], xt = { value: "" }, Rt = ["value"], Mt = { class: "mr-binding-region-tools" }, St = ["disabled"], Et = ["aria-label"], Kt = {
16
+ key: 1,
17
+ class: "mr-binding-mappings"
18
+ }, Dt = { class: "mr-binding-field-search" }, Ft = ["placeholder", "aria-label"], _t = {
19
+ key: 0,
20
+ class: "mr-binding-note"
21
+ }, Bt = ["onUpdate:modelValue", "aria-label"], zt = { value: "" }, Lt = ["value"], At = { key: 0 }, It = {
22
+ key: 2,
23
+ class: "mr-binding-map-pages"
24
+ }, Nt = ["disabled", "aria-label"], Pt = ["disabled", "aria-label"], Wt = {
25
+ key: 3,
26
+ class: "mr-binding-concurrency"
27
+ }, Vt = ["value", "onChange"], Tt = { value: "" }, Ht = ["value"], Ot = { class: "mr-binding-group" }, Ut = { class: "mr-binding-note" }, Jt = { class: "mr-binding-region-tools" }, qt = ["disabled"], jt = ["aria-label"], Gt = /* @__PURE__ */ xe({
28
+ __name: "ExcelRegionBindingPanel",
29
+ props: {
30
+ controller: {},
31
+ datasets: {},
32
+ disabled: { type: Boolean },
33
+ messages: {}
34
+ },
35
+ setup(l) {
36
+ const U = l, f = M(0), y = M(""), v = U.controller.active, c = E(() => U.datasets.find(($) => $.id === v.value?.dataset)), x = E(() => {
37
+ if (!v.value) return [];
38
+ let $ = 1;
39
+ try {
40
+ $ = he(v.value.range).left;
41
+ } catch {
42
+ }
43
+ return v.value.fields.slice(f.value * 12, f.value * 12 + 12).map((h, i) => ({ field: h, index: f.value * 12 + i, physical: Me($ + f.value * 12 + i) }));
44
+ }), w = E(() => Math.max(1, Math.ceil((v.value?.fields.length ?? 0) / 12))), K = E(() => {
45
+ const $ = y.value.trim().toLocaleLowerCase(), h = c.value?.fields ?? [], i = h.filter((F) => [F.field, F.label, F.unit].some((j) => j?.toLocaleLowerCase().includes($))).slice(0, 64), k = new Set(x.value.map((F) => F.field));
46
+ return [...i, ...h.filter((F) => k.has(F.field) && !i.includes(F))];
47
+ });
48
+ function B($) {
49
+ return $.target.value;
50
+ }
51
+ function q($) {
52
+ U.controller.setActive($), f.value = 0, y.value = "";
53
+ }
54
+ function Y($) {
55
+ if (!(!v.value || U.disabled)) {
56
+ v.value.range = B($);
57
+ try {
58
+ const h = he(v.value.range), i = h.right - h.left + 1;
59
+ i <= 2048 && (v.value.fields = Array.from({ length: i }, (k, F) => v.value.fields[F] ?? ""));
60
+ } catch {
61
+ }
62
+ }
63
+ }
64
+ return ($, h) => (r(), u("section", {
65
+ class: "mr-binding-multi",
66
+ "aria-label": l.messages.multiRegions
67
+ }, [
68
+ t("div", at, [
69
+ t("h3", null, [
70
+ D(n(l.messages.multiRegions), 1),
71
+ t("span", null, n(l.controller.recipe.value.regions.length) + "/128", 1)
72
+ ]),
73
+ t("p", nt, n(l.messages.multiHint), 1),
74
+ t("button", {
75
+ type: "button",
76
+ class: "mr-binding-add-region",
77
+ disabled: l.disabled || !l.controller.selection.value || l.controller.recipe.value.regions.length >= 128,
78
+ onClick: h[0] || (h[0] = //@ts-ignore
79
+ (...i) => l.controller.add && l.controller.add(...i))
80
+ }, [
81
+ P(V, {
82
+ name: "grid",
83
+ size: 13
84
+ }),
85
+ D(n(l.messages.addRegion), 1),
86
+ t("code", null, n(l.controller.selection.value || "—"), 1)
87
+ ], 8, ot),
88
+ t("div", st, [
89
+ (r(!0), u(A, null, W(l.controller.recipe.value.regions, (i) => (r(), u("div", {
90
+ key: i.id,
91
+ class: be(["mr-binding-region-entry", { "is-active": i.id === l.controller.activeId.value }])
92
+ }, [
93
+ t("button", {
94
+ type: "button",
95
+ "aria-pressed": i.id === l.controller.activeId.value,
96
+ onClick: (k) => q(i.id)
97
+ }, [
98
+ t("strong", null, n(i.id), 1),
99
+ t("code", null, n(i.range), 1),
100
+ t("small", null, n(i.mode === "record" ? l.messages.recordMode : l.messages.repeatMode) + " · " + n(i.dataset || l.messages.chooseDataset), 1)
101
+ ], 8, it),
102
+ t("button", {
103
+ type: "button",
104
+ "aria-label": `${l.messages.removeRegion} ${i.id}`,
105
+ disabled: l.disabled,
106
+ onClick: (k) => l.controller.remove(i.id)
107
+ }, [
108
+ P(V, {
109
+ name: "close",
110
+ size: 12
111
+ })
112
+ ], 8, rt)
113
+ ], 2))), 128))
114
+ ])
115
+ ]),
116
+ t("fieldset", {
117
+ disabled: l.disabled,
118
+ class: "mr-binding-region-editor"
119
+ }, [
120
+ e(v) ? (r(), u("section", dt, [
121
+ t("h3", null, [
122
+ D(n(l.messages.regionProperties), 1),
123
+ t("code", null, n(e(v).id), 1)
124
+ ]),
125
+ t("label", ct, [
126
+ D(n(l.messages.regionCoordinates), 1),
127
+ t("input", {
128
+ value: e(v).range,
129
+ "aria-label": l.messages.regionCoordinates,
130
+ onChange: Y
131
+ }, null, 40, vt)
132
+ ]),
133
+ t("label", gt, [
134
+ D(n(l.messages.regionMode), 1),
135
+ ae(t("select", {
136
+ "onUpdate:modelValue": h[1] || (h[1] = (i) => e(v).mode = i),
137
+ "aria-label": l.messages.regionMode
138
+ }, [
139
+ t("option", bt, n(l.messages.recordMode), 1),
140
+ t("option", ft, n(l.messages.repeatMode), 1)
141
+ ], 8, mt), [
142
+ [fe, e(v).mode]
143
+ ])
144
+ ]),
145
+ t("p", ht, n(e(v).mode === "record" ? l.messages.recordHint : l.messages.repeatHint), 1),
146
+ t("label", yt, [
147
+ D(n(l.messages.dataset), 1),
148
+ t("select", {
149
+ value: e(v).dataset,
150
+ "aria-label": l.messages.dataset,
151
+ onChange: h[2] || (h[2] = (i) => l.controller.dataset(B(i)))
152
+ }, [
153
+ t("option", wt, n(l.messages.chooseDataset), 1),
154
+ (r(!0), u(A, null, W(l.datasets, (i) => (r(), u("option", {
155
+ key: i.id,
156
+ value: i.id
157
+ }, n(i.label || i.id), 9, kt))), 128))
158
+ ], 40, pt)
159
+ ]),
160
+ c.value ? (r(), u("label", $t, [
161
+ D(n(l.messages.rowKey), 1),
162
+ ae(t("select", {
163
+ "onUpdate:modelValue": h[3] || (h[3] = (i) => e(v).rowKey = i),
164
+ "aria-label": l.messages.rowKey
165
+ }, [
166
+ t("option", xt, n(l.messages.chooseRowKey), 1),
167
+ (r(!0), u(A, null, W(c.value.fields.filter((i) => i.type !== "boolean"), (i) => (r(), u("option", {
168
+ key: i.field,
169
+ value: i.field
170
+ }, n(i.label || i.field), 9, Rt))), 128))
171
+ ], 8, Ct), [
172
+ [fe, e(v).rowKey]
173
+ ])
174
+ ])) : S("", !0),
175
+ t("div", Mt, [
176
+ t("button", {
177
+ type: "button",
178
+ disabled: !l.controller.selection.value,
179
+ onClick: h[4] || (h[4] = //@ts-ignore
180
+ (...i) => l.controller.header && l.controller.header(...i))
181
+ }, n(l.messages.bindRegionHeader), 9, St),
182
+ t("code", null, n(e(v).headerRange || l.messages.noRegionHeader), 1),
183
+ e(v).headerRange ? (r(), u("button", {
184
+ key: 0,
185
+ type: "button",
186
+ "aria-label": l.messages.clearHeader,
187
+ onClick: h[5] || (h[5] = (i) => delete e(v).headerRange)
188
+ }, [
189
+ P(V, {
190
+ name: "close",
191
+ size: 11
192
+ })
193
+ ], 8, Et)) : S("", !0)
194
+ ]),
195
+ c.value ? (r(), u("div", Kt, [
196
+ t("label", Dt, [
197
+ P(V, {
198
+ name: "search",
199
+ size: 13
200
+ }),
201
+ ae(t("input", {
202
+ "onUpdate:modelValue": h[6] || (h[6] = (i) => y.value = i),
203
+ type: "search",
204
+ placeholder: l.messages.searchFields,
205
+ "aria-label": l.messages.searchFields
206
+ }, null, 8, Ft), [
207
+ [Re, y.value]
208
+ ])
209
+ ]),
210
+ c.value.fields.length > 64 ? (r(), u("small", _t, n(l.messages.fieldLimit), 1)) : S("", !0),
211
+ (r(!0), u(A, null, W(x.value, (i) => (r(), u("label", {
212
+ key: i.index,
213
+ class: "mr-binding-map"
214
+ }, [
215
+ t("span", null, n(i.physical), 1),
216
+ t("div", null, [
217
+ ae(t("select", {
218
+ "onUpdate:modelValue": (k) => e(v).fields[i.index] = k,
219
+ "aria-label": `${l.messages.physical} ${i.physical} · ${l.messages.business}`
220
+ }, [
221
+ t("option", zt, n(l.messages.chooseField), 1),
222
+ (r(!0), u(A, null, W(K.value, (k) => (r(), u("option", {
223
+ key: k.field,
224
+ value: k.field
225
+ }, n(k.label || k.field) + " · " + n(k.field), 9, Lt))), 128))
226
+ ], 8, Bt), [
227
+ [fe, e(v).fields[i.index]]
228
+ ]),
229
+ i.field ? (r(), u("small", At, n(c.value.fields.find((k) => k.field === i.field)?.type) + " · " + n(c.value.fields.find((k) => k.field === i.field)?.unit || "—"), 1)) : S("", !0)
230
+ ])
231
+ ]))), 128))
232
+ ])) : S("", !0),
233
+ w.value > 1 ? (r(), u("div", It, [
234
+ t("button", {
235
+ type: "button",
236
+ disabled: f.value <= 0,
237
+ "aria-label": l.messages.previousColumns,
238
+ onClick: h[7] || (h[7] = (i) => f.value--)
239
+ }, [
240
+ P(V, {
241
+ name: "chevron-left",
242
+ size: 13
243
+ })
244
+ ], 8, Nt),
245
+ t("span", null, n(f.value + 1) + "/" + n(w.value), 1),
246
+ t("button", {
247
+ type: "button",
248
+ disabled: f.value + 1 >= w.value,
249
+ "aria-label": l.messages.nextColumns,
250
+ onClick: h[8] || (h[8] = (i) => f.value++)
251
+ }, [
252
+ P(V, {
253
+ name: "chevron-right",
254
+ size: 13
255
+ })
256
+ ], 8, Pt)
257
+ ])) : S("", !0),
258
+ c.value ? (r(), u("details", Wt, [
259
+ t("summary", null, n(l.messages.concurrency), 1),
260
+ (r(), u(A, null, W(["revisionField", "sourceTokenField"], (i) => t("label", {
261
+ key: i,
262
+ class: "mr-binding-label"
263
+ }, [
264
+ D(n(i === "revisionField" ? l.messages.revisionField : l.messages.sourceTokenField), 1),
265
+ t("select", {
266
+ value: e(v)[i] || "",
267
+ onChange: (k) => B(k) ? e(v)[i] = B(k) : delete e(v)[i]
268
+ }, [
269
+ t("option", Tt, n(l.messages.optional), 1),
270
+ (r(!0), u(A, null, W(c.value.fields, (k) => (r(), u("option", {
271
+ key: k.field,
272
+ value: k.field
273
+ }, n(k.label || k.field), 9, Ht))), 128))
274
+ ], 40, Vt)
275
+ ])), 64))
276
+ ])) : S("", !0)
277
+ ])) : S("", !0),
278
+ t("section", Ot, [
279
+ t("h3", null, n(l.messages.flowFooter), 1),
280
+ t("p", Ut, n(l.messages.flowFooterHint), 1),
281
+ t("div", Jt, [
282
+ t("button", {
283
+ type: "button",
284
+ disabled: !l.controller.selection.value,
285
+ onClick: h[9] || (h[9] = //@ts-ignore
286
+ (...i) => l.controller.footer && l.controller.footer(...i))
287
+ }, n(l.messages.bindFooter), 9, qt),
288
+ t("code", null, n(l.controller.recipe.value.footerRange || "—"), 1),
289
+ l.controller.recipe.value.footerRange ? (r(), u("button", {
290
+ key: 0,
291
+ type: "button",
292
+ "aria-label": l.messages.clearFooter,
293
+ onClick: h[10] || (h[10] = //@ts-ignore
294
+ (...i) => l.controller.clearFooter && l.controller.clearFooter(...i))
295
+ }, [
296
+ P(V, {
297
+ name: "close",
298
+ size: 11
299
+ })
300
+ ], 8, jt)) : S("", !0)
301
+ ])
302
+ ])
303
+ ], 8, ut)
304
+ ], 8, lt));
305
+ }
306
+ });
307
+ function Ce(l = "") {
308
+ return { version: "2.0", sheet: l, regions: [] };
309
+ }
310
+ function Xt(l, U, f, y) {
311
+ const v = M(Ce()), c = M(""), x = M(), w = M(), K = E(() => !l.value || !x.value || !w.value ? "" : Ve(l.value, U.value, x.value, w.value)), B = E(() => ({ ...v.value, regions: v.value.regions.map((m) => ({ ...m, fields: [] })) })), q = E(() => l.value ? Te(l.value, B.value) : []), Y = E(() => {
312
+ const m = He(v.value, y()), R = [...q.value, ...m.issues];
313
+ return { ...m, ok: !R.length, issues: R };
314
+ }), $ = E(() => v.value.regions.find((m) => m.id === c.value));
315
+ function h(m = Ce(U.value)) {
316
+ v.value = JSON.parse(JSON.stringify(m)), c.value = v.value.regions[0]?.id ?? "", x.value = void 0, w.value = void 0;
317
+ }
318
+ function i(m, R, C) {
319
+ f.value || ((!C || !x.value) && (x.value = { row: m, column: R }), w.value = { row: m, column: R });
320
+ }
321
+ function k() {
322
+ if (f.value || !K.value || v.value.regions.length >= 128) return;
323
+ let m = 1;
324
+ for (; v.value.regions.some((z) => z.id === `region-${m}`); ) m++;
325
+ const R = `region-${m}`, C = Math.abs(w.value.column - x.value.column) + 1;
326
+ v.value.regions.push({ id: R, range: K.value, mode: "repeat", dataset: "", fields: Array.from({ length: C }, () => ""), rowKey: "" }), c.value = R;
327
+ }
328
+ function F(m) {
329
+ f.value || (v.value.regions = v.value.regions.filter((R) => R.id !== m), c.value === m && (c.value = v.value.regions[0]?.id ?? ""));
330
+ }
331
+ function j(m) {
332
+ !f.value && $.value && ($.value.dataset = m, $.value.rowKey = "", $.value.fields.fill(""), delete $.value.revisionField, delete $.value.sourceTokenField);
333
+ }
334
+ function X() {
335
+ !f.value && $.value && K.value && ($.value.headerRange = K.value);
336
+ }
337
+ function J() {
338
+ !f.value && K.value && (v.value.footerRange = K.value);
339
+ }
340
+ function s() {
341
+ f.value || delete v.value.footerRange;
342
+ }
343
+ function _(m) {
344
+ v.value.regions.some((R) => R.id === m) && (c.value = m);
345
+ }
346
+ function H(m, R) {
347
+ return !!x.value && !!w.value && m >= Math.min(x.value.row, w.value.row) && m <= Math.max(x.value.row, w.value.row) && R >= Math.min(x.value.column, w.value.column) && R <= Math.max(x.value.column, w.value.column);
348
+ }
349
+ return { recipe: v, activeId: c, active: $, selection: K, validation: Y, reset: h, select: i, add: k, remove: F, dataset: j, header: X, footer: J, clearFooter: s, setActive: _, selected: H };
350
+ }
351
+ function ue(l = "", U = 0) {
352
+ return {
353
+ version: "1.0",
354
+ sheet: l,
355
+ dataset: "",
356
+ regions: { header: "", detail: "" },
357
+ fields: Array.from({ length: U }, () => ""),
358
+ rowKey: ""
359
+ };
360
+ }
361
+ function me(l) {
362
+ return l instanceof Error ? l.message : String(l);
363
+ }
364
+ function Qt(l, U) {
365
+ const f = Ae(), y = M(ue()), v = M("table"), c = Xt(f, E(() => y.value.sheet), E(() => I.value), () => l.datasets), x = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), K = M({ table: [], regions: [] });
366
+ function B() {
367
+ x.clear(), w.clear(), K.value = { table: [], regions: [] };
368
+ }
369
+ function q() {
370
+ y.value.sheet && (x.set(y.value.sheet, Y(y.value)), w.set(y.value.sheet, JSON.parse(JSON.stringify(c.recipe.value))), K.value = { table: [...x.values()], regions: [...w.values()] });
371
+ }
372
+ const Y = (d) => JSON.parse(JSON.stringify(d));
373
+ function $(d, p) {
374
+ return Y(x.get(d) ?? ue(d, p));
375
+ }
376
+ const h = M({
377
+ id: l.identity?.id ?? "excel-template",
378
+ name: l.identity?.name ?? "Excel 业务模板"
379
+ }), i = M(""), k = M(0), F = et(() => ({ source: k.value, recipe: y.value, mode: v.value, regions: c.recipe.value, cached: K.value, identity: h.value })), j = M([]);
380
+ let X;
381
+ function J() {
382
+ X?.dispose(), X = void 0;
383
+ }
384
+ const s = M(""), _ = M(!1), H = M(!1), m = M(!1), R = M(!1), C = M(1), z = M(1), Z = M(), ee = M(), T = M(0), te = E(() => ({ ...tt, ...l.messages })), I = E(() => !!l.readonly || _.value || R.value), le = E(
385
+ () => f.value?.sheets.find((d) => d.name === y.value.sheet)
386
+ ), O = E(
387
+ () => le.value ? he(le.value.range) : void 0
388
+ ), ne = E(
389
+ () => l.datasets.find((d) => d.id === y.value.dataset)
390
+ ), oe = E(
391
+ () => f.value && le.value ? Oe(f.value, le.value.name, {
392
+ row: C.value,
393
+ column: z.value
394
+ }) : void 0
395
+ ), ye = E(
396
+ () => f.value ? Ue(f.value, y.value) : []
397
+ ), pe = E(() => {
398
+ if (!f.value) return { ok: !1, issues: [], mapped: 0, total: 0 };
399
+ const d = Je(
400
+ f.value,
401
+ y.value,
402
+ l.datasets
403
+ ), p = [...ye.value, ...d.issues];
404
+ return { ...d, ok: p.length === 0, issues: p };
405
+ }), ce = E(() => v.value === "regions" ? c.validation.value : pe.value), we = E(
406
+ () => y.value.fields.slice(T.value * 12, (T.value + 1) * 12).map((d, p) => ({
407
+ index: T.value * 12 + p,
408
+ field: d,
409
+ physical: Me(
410
+ (O.value?.left ?? 1) + T.value * 12 + p
411
+ )
412
+ }))
413
+ ), ke = E(
414
+ () => ne.value?.fields.filter((d) => d.type !== "boolean") ?? []
415
+ ), se = E(
416
+ () => Z.value !== void 0 && ee.value !== void 0 ? {
417
+ top: Math.min(Z.value, ee.value),
418
+ bottom: Math.max(Z.value, ee.value)
419
+ } : void 0
420
+ );
421
+ let G, g = 0;
422
+ function o() {
423
+ g++, G?.abort(), G = void 0, _.value = !1;
424
+ }
425
+ function a() {
426
+ C.value = O.value?.top ?? 1, z.value = O.value?.left ?? 1, Z.value = void 0, ee.value = void 0, T.value = 0, H.value = !1, m.value = !1;
427
+ }
428
+ function b(d) {
429
+ o();
430
+ try {
431
+ const p = d.version === "2.0" ? qe(d) : je(d);
432
+ o(), J(), j.value = p.source.sheets.map((L) => ({
433
+ name: L.name,
434
+ index: L.index
435
+ })), f.value = p.source, B(), p.version === "2.0" ? (y.value = ue(p.recipe.sheet, p.source.sheets.find((L) => L.name === p.recipe.sheet).columnCount), c.reset(p.recipe), v.value = "regions") : (y.value = p.recipe, c.reset(), v.value = "table"), h.value = { ...p.identity, ...l.lockId && l.identity ? { id: l.identity.id } : {} }, i.value = p.recipe.sheet, s.value = "", a(), k.value++, F.accept();
436
+ } catch (p) {
437
+ s.value = me(p);
438
+ }
439
+ }
440
+ de(
441
+ () => l.session,
442
+ (d) => {
443
+ d && b(d);
444
+ },
445
+ { immediate: !0 }
446
+ ), de(
447
+ () => l.readonly,
448
+ (d) => {
449
+ d && (o(), J());
450
+ }
451
+ ), de(
452
+ [y, h, v, c.recipe],
453
+ () => {
454
+ H.value = !1, m.value = !1;
455
+ },
456
+ { deep: !0, flush: "sync" }
457
+ ), de(
458
+ () => l.datasets,
459
+ () => {
460
+ H.value = !1, m.value = !1;
461
+ }
462
+ ), Ie(() => {
463
+ o(), J();
464
+ });
465
+ async function Q(d) {
466
+ if (l.readonly) return;
467
+ if (o(), !/\.xlsx$/i.test(d.name)) {
468
+ s.value = te.value.invalidFile;
469
+ return;
470
+ }
471
+ const p = ++g;
472
+ G = new AbortController(), _.value = !0, s.value = "";
473
+ let L;
474
+ try {
475
+ const { openExcelWorkbook: N } = await import("./workbook-session-BKOTwcoq.js").then((ie) => ie.w);
476
+ if (p !== g || l.readonly || (L = await N(d, { ...l.importOptions, signal: G.signal }), p !== g || l.readonly)) return;
477
+ const re = L.inspect().sheets.filter((ie) => ie.visible);
478
+ if (!re.length) throw new Error("Excel 中没有可导入的可见工作表");
479
+ const $e = await L.importTemplate({ sheets: [re[0].name], signal: G.signal });
480
+ if (p !== g || l.readonly) return;
481
+ J(), X = L, L = void 0, f.value = $e, k.value++, i.value = d.name, j.value = re.map((ie) => ({
482
+ name: ie.name,
483
+ index: ie.index
484
+ })), B(), y.value = ue(
485
+ $e.sheets[0].name,
486
+ $e.sheets[0].columnCount
487
+ ), c.reset(), a();
488
+ } catch (N) {
489
+ p === g && (s.value = me(N));
490
+ } finally {
491
+ L?.dispose(), p === g && (_.value = !1, G = void 0);
492
+ }
493
+ }
494
+ async function ve(d) {
495
+ if (I.value || !j.value.some((N) => N.name === d) || y.value.sheet === d)
496
+ return;
497
+ q();
498
+ const p = f.value?.sheets.find((N) => N.name === d);
499
+ if (p) {
500
+ y.value = $(d, p.columnCount), c.reset(w.get(d)), s.value = "", a();
501
+ return;
502
+ }
503
+ if (!X || X.disposed) return;
504
+ o();
505
+ const L = ++g;
506
+ G = new AbortController(), _.value = !0, s.value = "";
507
+ try {
508
+ const N = await X.importTemplate({ sheets: [d], signal: G.signal });
509
+ if (L !== g || l.readonly) return;
510
+ f.value = N, y.value = $(d, N.sheets[0].columnCount), c.reset(w.get(d)), a();
511
+ } catch (N) {
512
+ L === g && (s.value = me(N));
513
+ } finally {
514
+ L === g && (_.value = !1, G = void 0);
515
+ }
516
+ }
517
+ function ge(d) {
518
+ I.value || (y.value.dataset = d, y.value.rowKey = "", y.value.fields.fill(""), H.value = !1, m.value = !1);
519
+ }
520
+ function Se(d, p) {
521
+ I.value || !O.value || d < O.value.top || d > O.value.bottom || ((!p || Z.value === void 0) && (Z.value = d), ee.value = d);
522
+ }
523
+ function Ee(d) {
524
+ if (I.value || !f.value || !se.value) {
525
+ I.value || (s.value = te.value.emptySelection);
526
+ return;
527
+ }
528
+ y.value.regions[d] = Ze(
529
+ f.value,
530
+ y.value.sheet,
531
+ se.value.top,
532
+ se.value.bottom
533
+ ), H.value = !1, m.value = !1, s.value = "";
534
+ }
535
+ function Ke(d) {
536
+ I.value || (delete y.value.regions[d], H.value = !1, m.value = !1);
537
+ }
538
+ function De(d, p) {
539
+ !I.value && d >= 0 && d < y.value.fields.length && (y.value.fields[d] = p, H.value = !1, m.value = !1);
540
+ }
541
+ function Fe(d) {
542
+ for (const p of ["title", "header", "detail", "footer"]) {
543
+ const L = y.value.regions[p];
544
+ if (!L) continue;
545
+ const N = he(L);
546
+ if (d >= N.top && d <= N.bottom) return p;
547
+ }
548
+ }
549
+ function _e(d, p) {
550
+ O.value && (d === "row" ? C.value = Math.max(
551
+ O.value.top,
552
+ Math.min(O.value.bottom, C.value + p)
553
+ ) : z.value = Math.max(
554
+ O.value.left,
555
+ Math.min(O.value.right, z.value + p)
556
+ ));
557
+ }
558
+ function Be() {
559
+ if (!l.readonly) {
560
+ if (l.session) {
561
+ b(l.session);
562
+ return;
563
+ }
564
+ o(), J(), f.value = void 0, j.value = [], i.value = "", B(), y.value = ue(), h.value = { id: l.identity?.id ?? "excel-template", name: l.identity?.name ?? "Excel 业务模板" }, c.reset(), v.value = "table", a(), k.value++, F.accept(), s.value = "";
565
+ }
566
+ }
567
+ function ze() {
568
+ H.value = !0, s.value = "";
569
+ }
570
+ async function Le() {
571
+ if (!(I.value || !f.value) && (H.value = !0, s.value = "", !!ce.value.ok)) {
572
+ R.value = !0;
573
+ try {
574
+ const d = { ...h.value, ...l.lockId && l.identity ? { id: l.identity.id } : {} }, p = v.value === "regions" ? Ge(f.value, c.recipe.value, l.datasets, d) : Xe(f.value, y.value, l.datasets, d), L = v.value === "regions" ? Qe(f.value, c.recipe.value, d) : Ye(f.value, y.value, d), N = { ...p, session: L }, re = F.snapshot();
575
+ if (l.accept && !await l.accept(N) || l.readonly || re !== F.snapshot() && F.pending.value) return;
576
+ l.accept || U(N), B(), F.accept(), m.value = !0;
577
+ } catch (d) {
578
+ s.value = me(d);
579
+ } finally {
580
+ R.value = !1;
581
+ }
582
+ }
583
+ }
584
+ return {
585
+ imported: f,
586
+ mode: v,
587
+ regionBindings: c,
588
+ pendingLocalChanges: F.pending,
589
+ recipe: y,
590
+ identity: h,
591
+ sourceName: i,
592
+ sheetChoices: j,
593
+ error: s,
594
+ loading: _,
595
+ checked: H,
596
+ applied: m,
597
+ row: C,
598
+ column: z,
599
+ mappingPage: T,
600
+ m: te,
601
+ disabled: I,
602
+ sheet: le,
603
+ sourceRange: O,
604
+ dataset: ne,
605
+ window: oe,
606
+ validation: ce,
607
+ mappings: we,
608
+ rowKeys: ke,
609
+ selection: se,
610
+ cancel: o,
611
+ importFile: Q,
612
+ chooseSheet: ve,
613
+ chooseDataset: ge,
614
+ chooseRow: Se,
615
+ markRegion: Ee,
616
+ clearRegion: Ke,
617
+ setMapping: De,
618
+ regionAt: Fe,
619
+ moveWindow: _e,
620
+ check: ze,
621
+ restoreDraft: Be,
622
+ apply: Le
623
+ };
624
+ }
625
+ const Yt = ["aria-label", "aria-busy"], Zt = { class: "mr-binding-bar" }, el = { class: "mr-binding-heading" }, tl = ["aria-label", "disabled"], ll = ["disabled"], al = {
626
+ key: 0,
627
+ class: "mr-binding-error",
628
+ role: "alert"
629
+ }, nl = {
630
+ key: 1,
631
+ class: "mr-binding-placeholder",
632
+ role: "status"
633
+ }, ol = {
634
+ key: 2,
635
+ class: "mr-binding-placeholder"
636
+ }, sl = ["disabled"], il = { class: "mr-binding-sourcebar" }, rl = ["value", "aria-label", "disabled"], ul = ["value"], dl = ["aria-label"], cl = ["aria-pressed", "disabled"], vl = ["aria-pressed", "disabled"], gl = { class: "mr-binding-range" }, ml = { class: "mr-binding-sample-note" }, bl = { class: "mr-binding-layout" }, fl = { class: "mr-binding-source" }, hl = { class: "mr-binding-grid-heading" }, yl = ["aria-label"], pl = { class: "mr-binding-grid" }, wl = ["data-region"], kl = { scope: "row" }, $l = ["data-source-row", "aria-label", "aria-pressed", "disabled", "onPointerdown", "onPointerenter", "onKeydown"], Cl = ["rowspan", "colspan", "title", "data-source-cell", "tabindex", "aria-label", "aria-selected", "onPointerdown", "onPointerenter", "onKeydown"], xl = {
637
+ key: 1,
638
+ class: "mr-binding-grid-footer"
639
+ }, Rl = { class: "mr-binding-window" }, Ml = ["aria-label", "disabled"], Sl = ["min", "max", "value"], El = ["aria-label", "disabled"], Kl = { class: "mr-binding-window" }, Dl = ["aria-label", "disabled"], Fl = ["min", "max", "value"], _l = ["aria-label", "disabled"], Bl = { class: "mr-binding-inspector" }, zl = ["disabled"], Ll = { class: "mr-binding-group" }, Al = ["data-role"], Il = { key: 0 }, Nl = ["aria-label", "disabled", "onClick"], Pl = ["aria-label", "onClick"], Wl = {
640
+ key: 0,
641
+ class: "mr-binding-note"
642
+ }, Vl = { class: "mr-binding-group" }, Tl = { class: "mr-binding-label" }, Hl = ["value", "aria-label"], Ol = { value: "" }, Ul = ["value"], Jl = {
643
+ key: 0,
644
+ class: "mr-binding-note"
645
+ }, ql = {
646
+ key: 1,
647
+ class: "mr-binding-label"
648
+ }, jl = ["aria-label"], Gl = { value: "" }, Xl = ["value"], Ql = {
649
+ key: 2,
650
+ class: "mr-binding-mappings"
651
+ }, Yl = ["aria-label", "value", "onChange"], Zl = { value: "" }, ea = ["value"], ta = { key: 0 }, la = {
652
+ key: 3,
653
+ class: "mr-binding-map-pages"
654
+ }, aa = ["disabled", "aria-label"], na = ["disabled", "aria-label"], oa = ["disabled"], sa = { class: "mr-binding-group" }, ia = { class: "mr-binding-label" }, ra = ["value", "readonly"], ua = { class: "mr-binding-label" }, da = {
655
+ key: 0,
656
+ class: "mr-binding-issues",
657
+ role: "alert"
658
+ }, ca = { key: 0 }, va = {
659
+ key: 1,
660
+ class: "mr-binding-warnings"
661
+ }, ga = { class: "mr-binding-actions" }, ma = ["disabled"], ba = ["disabled"], fa = ["disabled"], $a = /* @__PURE__ */ xe({
662
+ __name: "ExcelBindingWizard",
663
+ props: {
664
+ datasets: {},
665
+ accept: { type: Function },
666
+ session: {},
667
+ identity: {},
668
+ lockId: { type: Boolean },
669
+ readonly: { type: Boolean },
670
+ importOptions: {},
671
+ messages: {}
672
+ },
673
+ emits: ["apply", "dirty"],
674
+ setup(l, { expose: U, emit: f }) {
675
+ const y = l, v = f, c = Qt(y, (g) => v("apply", g)), {
676
+ imported: x,
677
+ mode: w,
678
+ regionBindings: K,
679
+ recipe: B,
680
+ identity: q,
681
+ sourceName: Y,
682
+ sheetChoices: $,
683
+ error: h,
684
+ loading: i,
685
+ checked: k,
686
+ applied: F,
687
+ row: j,
688
+ column: X,
689
+ mappingPage: J,
690
+ m: s,
691
+ disabled: _,
692
+ sheet: H,
693
+ sourceRange: m,
694
+ dataset: R,
695
+ window: C,
696
+ validation: z,
697
+ mappings: Z,
698
+ rowKeys: ee,
699
+ selection: T
700
+ } = c;
701
+ de([c.pendingLocalChanges, B, q], () => v("dirty", c.pendingLocalChanges.value), { immediate: !0, deep: !0, flush: "sync" });
702
+ const te = M(), I = M(!1), le = ["title", "header", "detail", "footer"], O = E(() => ({
703
+ title: s.value.titleRegion,
704
+ header: s.value.headerRegion,
705
+ detail: s.value.detailRegion,
706
+ footer: s.value.footerRegion
707
+ })), ne = E(
708
+ () => Math.max(1, Math.ceil(B.value.fields.length / 12))
709
+ );
710
+ function oe(g) {
711
+ return g.target.value;
712
+ }
713
+ function ye(g) {
714
+ const o = g.target, a = o.files?.[0];
715
+ a && c.importFile(a), o.value = "";
716
+ }
717
+ function pe(g, o) {
718
+ g.button !== 0 || _.value || (g.preventDefault(), I.value = !0, c.chooseRow(o, g.shiftKey), w.value === "regions" && m.value && (K.select(o, m.value.left, !1), K.select(o, m.value.right, !0)), g.currentTarget.focus());
719
+ }
720
+ function ce(g, o, a) {
721
+ w.value !== "regions" || g.button !== 0 || _.value || (g.preventDefault(), I.value = !0, K.select(o, a, g.shiftKey), g.currentTarget.focus());
722
+ }
723
+ function we(g, o, a) {
724
+ if (w.value !== "regions") return;
725
+ (g.key === " " || g.key === "Enter") && (g.preventDefault(), K.select(o, a, g.shiftKey));
726
+ const Q = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1] }[g.key];
727
+ if (!Q || !m.value) return;
728
+ g.preventDefault();
729
+ const ve = Math.max(m.value.top, Math.min(m.value.bottom, o + Q[0])), ge = Math.max(m.value.left, Math.min(m.value.right, a + Q[1]));
730
+ g.shiftKey && K.select(ve, ge, !0), g.currentTarget.closest("table")?.querySelector(`td[data-source-cell="${ve}:${ge}"]`)?.focus();
731
+ }
732
+ function ke(g, o) {
733
+ if ((g.key === " " || g.key === "Enter") && (g.preventDefault(), c.chooseRow(o, g.shiftKey)), g.key === "ArrowDown" || g.key === "ArrowUp") {
734
+ g.preventDefault();
735
+ const a = o + (g.key === "ArrowDown" ? 1 : -1);
736
+ g.shiftKey && c.chooseRow(a, !0), g.currentTarget.closest("table")?.querySelector(`button[data-source-row="${a}"]`)?.focus();
737
+ }
738
+ }
739
+ function se(g) {
740
+ const o = R.value?.fields.find((a) => a.field === g);
741
+ return o ? [
742
+ o.type,
743
+ o.unit,
744
+ o.digits === void 0 ? void 0 : `${o.digits}${s.value.precision}`,
745
+ o.sample === void 0 ? void 0 : `${s.value.sample}: ${String(o.sample)}`
746
+ ].filter((a) => a !== void 0 && a !== "").join(" · ") : "";
747
+ }
748
+ function G(g, o) {
749
+ const a = Number(oe(g));
750
+ !Number.isInteger(a) || !m.value || (o === "row" ? j.value = Math.max(
751
+ m.value.top,
752
+ Math.min(m.value.bottom, a)
753
+ ) : X.value = Math.max(
754
+ m.value.left,
755
+ Math.min(m.value.right, a)
756
+ ));
757
+ }
758
+ return U({
759
+ get pendingLocalChanges() {
760
+ return c.pendingLocalChanges.value;
761
+ },
762
+ importFile: c.importFile,
763
+ apply: c.apply,
764
+ cancel: c.cancel
765
+ }), (g, o) => (r(), u("section", {
766
+ class: "mr-binding",
767
+ "aria-label": e(s).title,
768
+ "aria-busy": e(i),
769
+ onPointerup: o[21] || (o[21] = (a) => I.value = !1),
770
+ onPointercancel: o[22] || (o[22] = (a) => I.value = !1),
771
+ onPointerleave: o[23] || (o[23] = (a) => I.value = !1)
772
+ }, [
773
+ t("header", Zt, [
774
+ t("div", el, [
775
+ P(V, {
776
+ name: "file",
777
+ size: 17
778
+ }),
779
+ t("strong", null, n(e(s).title), 1),
780
+ t("span", null, n(e(Y) || e(s).intro), 1)
781
+ ]),
782
+ t("input", {
783
+ ref_key: "input",
784
+ ref: te,
785
+ type: "file",
786
+ accept: ".xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
787
+ "aria-label": e(s).upload,
788
+ class: "mr-binding-file",
789
+ disabled: l.readonly,
790
+ onChange: ye
791
+ }, null, 40, tl),
792
+ e(i) ? (r(), u("button", {
793
+ key: 0,
794
+ type: "button",
795
+ onClick: o[0] || (o[0] = //@ts-ignore
796
+ (...a) => e(c).cancel && e(c).cancel(...a))
797
+ }, n(e(s).cancel), 1)) : (r(), u("button", {
798
+ key: 1,
799
+ type: "button",
800
+ disabled: l.readonly,
801
+ onClick: o[1] || (o[1] = (a) => te.value?.click())
802
+ }, [
803
+ P(V, {
804
+ name: "upload",
805
+ size: 14
806
+ }),
807
+ D(n(e(x) ? e(s).replace : e(s).upload), 1)
808
+ ], 8, ll))
809
+ ]),
810
+ e(h) ? (r(), u("div", al, n(e(h)), 1)) : S("", !0),
811
+ e(i) ? (r(), u("div", nl, [
812
+ o[24] || (o[24] = t("span", { class: "mr-binding-loader" }, null, -1)),
813
+ D(n(e(s).loading), 1)
814
+ ])) : e(x) ? (r(), u(A, { key: 3 }, [
815
+ t("div", il, [
816
+ t("label", null, [
817
+ D(n(e(s).sheet), 1),
818
+ t("select", {
819
+ value: e(B).sheet,
820
+ "aria-label": e(s).sheet,
821
+ disabled: e(_),
822
+ onChange: o[3] || (o[3] = (a) => e(c).chooseSheet(oe(a)))
823
+ }, [
824
+ (r(!0), u(A, null, W(e($), (a) => (r(), u("option", {
825
+ key: a.name,
826
+ value: a.name
827
+ }, n(a.name), 9, ul))), 128))
828
+ ], 40, rl)
829
+ ]),
830
+ t("div", {
831
+ class: "mr-binding-mode",
832
+ role: "group",
833
+ "aria-label": e(s).regionMode
834
+ }, [
835
+ t("button", {
836
+ type: "button",
837
+ "aria-pressed": e(w) === "table",
838
+ disabled: e(_),
839
+ onClick: o[4] || (o[4] = (a) => w.value = "table")
840
+ }, n(e(s).tableMode), 9, cl),
841
+ t("button", {
842
+ type: "button",
843
+ "aria-pressed": e(w) === "regions",
844
+ disabled: e(_),
845
+ onClick: o[5] || (o[5] = (a) => w.value = "regions")
846
+ }, [
847
+ P(V, {
848
+ name: "grid",
849
+ size: 12
850
+ }),
851
+ D(n(e(s).multiRegions), 1)
852
+ ], 8, vl)
853
+ ], 8, dl),
854
+ t("span", gl, n(e(H)?.range) + " · " + n(e(H)?.rowCount) + " × " + n(e(H)?.columnCount), 1),
855
+ t("span", ml, n(e(s).sourceOnly), 1)
856
+ ]),
857
+ t("div", bl, [
858
+ t("div", fl, [
859
+ t("div", hl, [
860
+ t("strong", null, n(e(s).source), 1),
861
+ t("span", null, n(e(w) === "regions" ? e(s).multiHint : e(s).sourceHint), 1)
862
+ ]),
863
+ e(C) ? (r(), u("div", {
864
+ key: 0,
865
+ class: "mr-binding-grid-scroll",
866
+ "aria-label": e(s).source
867
+ }, [
868
+ t("table", pl, [
869
+ t("thead", null, [
870
+ t("tr", null, [
871
+ o[26] || (o[26] = t("th", {
872
+ class: "mr-binding-corner",
873
+ "aria-label": "#"
874
+ }, "#", -1)),
875
+ (r(!0), u(A, null, W(e(C).columns, (a) => (r(), u("th", {
876
+ key: a.column,
877
+ scope: "col"
878
+ }, n(a.name), 1))), 128))
879
+ ])
880
+ ]),
881
+ t("tbody", null, [
882
+ (r(!0), u(A, null, W(e(C).rows, (a) => (r(), u("tr", {
883
+ key: a.row,
884
+ "data-region": e(c).regionAt(a.row),
885
+ class: be({
886
+ "is-selected": e(T) && a.row >= e(T).top && a.row <= e(T).bottom
887
+ })
888
+ }, [
889
+ t("th", kl, [
890
+ t("button", {
891
+ type: "button",
892
+ "data-source-row": a.row,
893
+ "aria-label": `${e(s).selectionLabel} ${a.row}`,
894
+ "aria-pressed": !!e(T) && a.row >= e(T).top && a.row <= e(T).bottom,
895
+ disabled: e(_),
896
+ onPointerdown: (b) => pe(b, a.row),
897
+ onPointerenter: (b) => I.value && e(c).chooseRow(a.row, !0),
898
+ onKeydown: (b) => ke(b, a.row)
899
+ }, n(a.row), 41, $l)
900
+ ]),
901
+ (r(!0), u(A, null, W(a.cells, (b) => (r(), u("td", {
902
+ key: b.column,
903
+ rowspan: b.rowSpan,
904
+ colspan: b.colSpan,
905
+ title: `${b.address} · ${b.text}`,
906
+ "data-source-cell": `${b.row}:${b.column}`,
907
+ tabindex: e(w) === "regions" ? 0 : void 0,
908
+ "aria-label": e(w) === "regions" ? `${e(s).selectionCellLabel} ${b.address}` : void 0,
909
+ "aria-selected": e(w) === "regions" ? e(K).selected(b.row, b.column) : void 0,
910
+ class: be({ "is-continued": b.continued, "is-cell-selected": e(w) === "regions" && e(K).selected(b.row, b.column) }),
911
+ onPointerdown: (Q) => ce(Q, b.row, b.column),
912
+ onPointerenter: (Q) => e(w) === "regions" && I.value && e(K).select(b.row, b.column, !0),
913
+ onKeydown: (Q) => we(Q, b.row, b.column),
914
+ style: Ne({
915
+ textAlign: b.style?.align,
916
+ fontWeight: b.style?.bold ? "600" : void 0
917
+ })
918
+ }, [
919
+ t("span", null, n(b.text), 1)
920
+ ], 46, Cl))), 128))
921
+ ], 10, wl))), 128))
922
+ ])
923
+ ])
924
+ ], 8, yl)) : S("", !0),
925
+ e(C) ? (r(), u("footer", xl, [
926
+ t("span", null, [
927
+ D(n(e(s).selected) + " ", 1),
928
+ t("strong", null, n(e(w) === "regions" ? e(K).selection.value || "—" : e(T) ? `${e(T).top}–${e(T).bottom}` : "—"), 1)
929
+ ]),
930
+ t("div", Rl, [
931
+ t("button", {
932
+ type: "button",
933
+ "aria-label": e(s).previousRows,
934
+ disabled: e(C).top <= e(C).source.top,
935
+ onClick: o[6] || (o[6] = (a) => e(c).moveWindow("row", -24))
936
+ }, [
937
+ P(V, {
938
+ name: "chevron-left",
939
+ size: 13
940
+ })
941
+ ], 8, Ml),
942
+ t("label", null, [
943
+ D(n(e(s).rowStart), 1),
944
+ t("input", {
945
+ type: "number",
946
+ min: e(C).source.top,
947
+ max: e(C).source.bottom,
948
+ value: e(j),
949
+ onChange: o[7] || (o[7] = (a) => G(a, "row"))
950
+ }, null, 40, Sl)
951
+ ]),
952
+ t("button", {
953
+ type: "button",
954
+ "aria-label": e(s).nextRows,
955
+ disabled: e(C).bottom >= e(C).source.bottom,
956
+ onClick: o[8] || (o[8] = (a) => e(c).moveWindow("row", 24))
957
+ }, [
958
+ P(V, {
959
+ name: "chevron-right",
960
+ size: 13
961
+ })
962
+ ], 8, El)
963
+ ]),
964
+ t("div", Kl, [
965
+ t("button", {
966
+ type: "button",
967
+ "aria-label": e(s).previousColumns,
968
+ disabled: e(C).left <= e(C).source.left,
969
+ onClick: o[9] || (o[9] = (a) => e(c).moveWindow("column", -12))
970
+ }, [
971
+ P(V, {
972
+ name: "chevron-left",
973
+ size: 13
974
+ })
975
+ ], 8, Dl),
976
+ t("label", null, [
977
+ D(n(e(s).columnStart), 1),
978
+ t("input", {
979
+ type: "number",
980
+ min: e(C).source.left,
981
+ max: e(C).source.right,
982
+ value: e(X),
983
+ onChange: o[10] || (o[10] = (a) => G(a, "column"))
984
+ }, null, 40, Fl)
985
+ ]),
986
+ t("button", {
987
+ type: "button",
988
+ "aria-label": e(s).nextColumns,
989
+ disabled: e(C).right >= e(C).source.right,
990
+ onClick: o[11] || (o[11] = (a) => e(c).moveWindow("column", 12))
991
+ }, [
992
+ P(V, {
993
+ name: "chevron-right",
994
+ size: 13
995
+ })
996
+ ], 8, _l)
997
+ ])
998
+ ])) : S("", !0)
999
+ ]),
1000
+ t("div", Bl, [
1001
+ e(w) === "regions" ? (r(), Pe(Gt, {
1002
+ key: 0,
1003
+ controller: e(K),
1004
+ datasets: l.datasets,
1005
+ disabled: e(_),
1006
+ messages: e(s)
1007
+ }, null, 8, ["controller", "datasets", "disabled", "messages"])) : S("", !0),
1008
+ ae(t("fieldset", { disabled: e(_) }, [
1009
+ t("section", Ll, [
1010
+ t("h3", null, [
1011
+ o[27] || (o[27] = t("b", null, "1", -1)),
1012
+ D(n(e(s).regionLegend), 1)
1013
+ ]),
1014
+ (r(), u(A, null, W(le, (a) => t("div", {
1015
+ key: a,
1016
+ class: "mr-binding-region",
1017
+ "data-role": a
1018
+ }, [
1019
+ t("div", null, [
1020
+ t("strong", null, [
1021
+ D(n(O.value[a]), 1),
1022
+ a === "title" || a === "footer" ? (r(), u("small", Il, n(e(s).optional), 1)) : S("", !0)
1023
+ ]),
1024
+ t("code", null, n(e(B).regions[a] || e(s).unnamed), 1)
1025
+ ]),
1026
+ t("button", {
1027
+ type: "button",
1028
+ "aria-label": `${e(s).selectRegion} · ${O.value[a]}`,
1029
+ disabled: !e(T),
1030
+ onClick: (b) => e(c).markRegion(a)
1031
+ }, [
1032
+ P(V, {
1033
+ name: "arrow-right",
1034
+ size: 13
1035
+ })
1036
+ ], 8, Nl),
1037
+ (a === "title" || a === "footer") && e(B).regions[a] ? (r(), u("button", {
1038
+ key: 0,
1039
+ type: "button",
1040
+ "aria-label": `${e(s).clear} · ${O.value[a]}`,
1041
+ onClick: (b) => e(c).clearRegion(a)
1042
+ }, [
1043
+ P(V, {
1044
+ name: "close",
1045
+ size: 13
1046
+ })
1047
+ ], 8, Pl)) : S("", !0)
1048
+ ], 8, Al)), 64)),
1049
+ e(B).regions.footer ? (r(), u("p", Wl, n(e(s).footerHint), 1)) : S("", !0)
1050
+ ]),
1051
+ t("section", Vl, [
1052
+ t("h3", null, [
1053
+ o[28] || (o[28] = t("b", null, "2", -1)),
1054
+ D(n(e(s).mapping), 1),
1055
+ t("span", null, n(e(z).mapped) + "/" + n(e(z).total), 1)
1056
+ ]),
1057
+ t("label", Tl, [
1058
+ D(n(e(s).dataset), 1),
1059
+ t("select", {
1060
+ value: e(B).dataset,
1061
+ "aria-label": e(s).dataset,
1062
+ onChange: o[12] || (o[12] = (a) => e(c).chooseDataset(oe(a)))
1063
+ }, [
1064
+ t("option", Ol, n(e(s).chooseDataset), 1),
1065
+ (r(!0), u(A, null, W(l.datasets, (a) => (r(), u("option", {
1066
+ key: a.id,
1067
+ value: a.id
1068
+ }, n(a.label || a.id), 9, Ul))), 128))
1069
+ ], 40, Hl)
1070
+ ]),
1071
+ l.datasets.length ? S("", !0) : (r(), u("p", Jl, n(e(s).noContract), 1)),
1072
+ e(R) ? (r(), u("label", ql, [
1073
+ D(n(e(s).rowKey), 1),
1074
+ ae(t("select", {
1075
+ "onUpdate:modelValue": o[13] || (o[13] = (a) => e(B).rowKey = a),
1076
+ "aria-label": e(s).rowKey
1077
+ }, [
1078
+ t("option", Gl, n(e(s).chooseRowKey), 1),
1079
+ (r(!0), u(A, null, W(e(ee), (a) => (r(), u("option", {
1080
+ key: a.field,
1081
+ value: a.field
1082
+ }, n(a.label || a.field) + " · " + n(a.field), 9, Xl))), 128))
1083
+ ], 8, jl), [
1084
+ [fe, e(B).rowKey]
1085
+ ])
1086
+ ])) : S("", !0),
1087
+ e(R) ? (r(), u("div", Ql, [
1088
+ (r(!0), u(A, null, W(e(Z), (a) => (r(), u("label", {
1089
+ key: a.index,
1090
+ class: "mr-binding-map"
1091
+ }, [
1092
+ t("span", null, n(a.physical), 1),
1093
+ t("div", null, [
1094
+ t("select", {
1095
+ "aria-label": `${e(s).physical} ${a.physical} · ${e(s).business}`,
1096
+ value: a.field,
1097
+ onChange: (b) => e(c).setMapping(a.index, oe(b))
1098
+ }, [
1099
+ t("option", Zl, n(e(s).chooseField), 1),
1100
+ (r(!0), u(A, null, W(e(R).fields, (b) => (r(), u("option", {
1101
+ key: b.field,
1102
+ value: b.field
1103
+ }, n(b.label || b.field) + " · " + n(b.field), 9, ea))), 128))
1104
+ ], 40, Yl),
1105
+ a.field ? (r(), u("small", ta, n(se(a.field)), 1)) : S("", !0)
1106
+ ])
1107
+ ]))), 128))
1108
+ ])) : S("", !0),
1109
+ e(R) && ne.value > 1 ? (r(), u("div", la, [
1110
+ t("button", {
1111
+ type: "button",
1112
+ disabled: e(J) <= 0,
1113
+ "aria-label": e(s).previousColumns,
1114
+ onClick: o[14] || (o[14] = (a) => J.value--)
1115
+ }, [
1116
+ P(V, {
1117
+ name: "chevron-left",
1118
+ size: 13
1119
+ })
1120
+ ], 8, aa),
1121
+ t("span", null, n(e(J) + 1) + " / " + n(ne.value), 1),
1122
+ t("button", {
1123
+ type: "button",
1124
+ disabled: e(J) + 1 >= ne.value,
1125
+ "aria-label": e(s).nextColumns,
1126
+ onClick: o[15] || (o[15] = (a) => J.value++)
1127
+ }, [
1128
+ P(V, {
1129
+ name: "chevron-right",
1130
+ size: 13
1131
+ })
1132
+ ], 8, na)
1133
+ ])) : S("", !0)
1134
+ ])
1135
+ ], 8, zl), [
1136
+ [We, e(w) === "table"]
1137
+ ]),
1138
+ t("fieldset", { disabled: e(_) }, [
1139
+ t("section", sa, [
1140
+ t("h3", null, n(e(s).identity), 1),
1141
+ t("label", ia, [
1142
+ D(n(e(s).templateId), 1),
1143
+ t("input", {
1144
+ value: l.lockId ? y.identity?.id ?? e(q).id : e(q).id,
1145
+ autocomplete: "off",
1146
+ readonly: l.lockId,
1147
+ onInput: o[16] || (o[16] = (a) => e(q).id = a.target.value)
1148
+ }, null, 40, ra)
1149
+ ]),
1150
+ t("label", ua, [
1151
+ D(n(e(s).templateName), 1),
1152
+ ae(t("input", {
1153
+ "onUpdate:modelValue": o[17] || (o[17] = (a) => e(q).name = a),
1154
+ autocomplete: "off"
1155
+ }, null, 512), [
1156
+ [Re, e(q).name]
1157
+ ])
1158
+ ])
1159
+ ])
1160
+ ], 8, oa)
1161
+ ])
1162
+ ]),
1163
+ e(k) && e(z).issues.length ? (r(), u("div", da, [
1164
+ t("strong", null, n(e(s).issues) + " · " + n(e(z).issues.length) + " " + n(e(s).errors), 1),
1165
+ t("ul", null, [
1166
+ (r(!0), u(A, null, W(e(z).issues.slice(0, 12), (a, b) => (r(), u("li", { key: b }, [
1167
+ t("code", null, n(a.path), 1),
1168
+ D(n(a.message), 1)
1169
+ ]))), 128))
1170
+ ]),
1171
+ e(z).issues.length > 12 ? (r(), u("span", ca, "+ " + n(e(z).issues.length - 12), 1)) : S("", !0)
1172
+ ])) : S("", !0),
1173
+ e(x).warnings.length ? (r(), u("details", va, [
1174
+ t("summary", null, n(e(s).inspectWarning) + " · " + n(e(x).warnings.length), 1),
1175
+ t("ul", null, [
1176
+ (r(!0), u(A, null, W(e(x).warnings, (a, b) => (r(), u("li", { key: b }, n(a), 1))), 128))
1177
+ ])
1178
+ ])) : S("", !0),
1179
+ t("footer", ga, [
1180
+ t("span", {
1181
+ class: be({ "is-ready": e(z).ok }),
1182
+ role: "status"
1183
+ }, n(l.readonly ? e(s).readonly : e(F) ? e(s).applied : e(z).ok ? e(s).ready : `${e(s).coverage} ${e(z).mapped}/${e(z).total}`), 3),
1184
+ e(c).pendingLocalChanges.value ? (r(), u("button", {
1185
+ key: 0,
1186
+ type: "button",
1187
+ disabled: e(_),
1188
+ onClick: o[18] || (o[18] = //@ts-ignore
1189
+ (...a) => e(c).restoreDraft && e(c).restoreDraft(...a))
1190
+ }, n(e(s).restoreDraft), 9, ma)) : S("", !0),
1191
+ t("button", {
1192
+ type: "button",
1193
+ disabled: e(_),
1194
+ onClick: o[19] || (o[19] = //@ts-ignore
1195
+ (...a) => e(c).check && e(c).check(...a))
1196
+ }, n(e(s).check), 9, ba),
1197
+ t("button", {
1198
+ type: "button",
1199
+ class: "mr-binding-primary",
1200
+ disabled: e(_) || !e(z).ok,
1201
+ onClick: o[20] || (o[20] = //@ts-ignore
1202
+ (...a) => e(c).apply && e(c).apply(...a))
1203
+ }, n(e(s).apply), 9, fa)
1204
+ ])
1205
+ ], 64)) : (r(), u("div", ol, [
1206
+ o[25] || (o[25] = t("svg", {
1207
+ viewBox: "0 0 80 80",
1208
+ fill: "none",
1209
+ "aria-hidden": "true"
1210
+ }, [
1211
+ t("rect", {
1212
+ x: "15",
1213
+ y: "10",
1214
+ width: "50",
1215
+ height: "60",
1216
+ rx: "8",
1217
+ fill: "#eff6ff",
1218
+ stroke: "#bfdbfe"
1219
+ }),
1220
+ t("path", {
1221
+ d: "M25 25h30M25 35h30M25 45h30M35 25v30M45 25v30M25 55h30",
1222
+ stroke: "#93c5fd",
1223
+ "stroke-width": "1.5"
1224
+ })
1225
+ ], -1)),
1226
+ t("strong", null, n(e(s).noSource), 1),
1227
+ t("span", null, n(e(s).sourceOnly), 1),
1228
+ t("button", {
1229
+ type: "button",
1230
+ class: "mr-binding-primary",
1231
+ disabled: l.readonly,
1232
+ onClick: o[2] || (o[2] = (a) => te.value?.click())
1233
+ }, n(e(s).upload), 9, sl)
1234
+ ]))
1235
+ ], 40, Yt));
1236
+ }
1237
+ });
1238
+ export {
1239
+ $a as default
1240
+ };