@agile-team/mach-report 2.23.0 → 2.24.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 (162) hide show
  1. package/README.md +9 -2
  2. package/dist/ExcelBindingWizard-BV12hGiK.cjs +1 -0
  3. package/dist/ExcelBindingWizard-Cy_lPjWV.js +1486 -0
  4. package/dist/ParamEditor-DenKjvKu.cjs +1 -0
  5. package/dist/ParamEditor-PyOqHzzw.js +750 -0
  6. package/dist/ReportBatchPanel-8EFtMrKk.js +351 -0
  7. package/dist/ReportBatchPanel-pQ6d0yqJ.cjs +1 -0
  8. package/dist/ReportLabelStudio-B_KF3Zc_.cjs +1 -0
  9. package/dist/ReportLabelStudio-HUeo2TsU.js +784 -0
  10. package/dist/ReportParamPanel-8xR85nz-.cjs +1 -0
  11. package/dist/{ReportParamPanel-Dgmqro1Y.js → ReportParamPanel-DA-YpkvC.js} +342 -307
  12. package/dist/ReportPreview-CyUXJSVX.cjs +6 -0
  13. package/dist/ReportPreview-_wTJnsG1.js +7120 -0
  14. package/dist/ReportTemplateLibrary-CjArKxRG.cjs +1 -0
  15. package/dist/ReportTemplateLibrary-DH8jl9IF.js +312 -0
  16. package/dist/RuleEditor-Bmj98oC4.cjs +1 -0
  17. package/dist/RuleEditor-GDydlEHz.js +2354 -0
  18. package/dist/TemplateOutlinePanel-B554_qk1.cjs +1 -0
  19. package/dist/TemplateOutlinePanel-DjPqzU9h.js +97 -0
  20. package/dist/TemplateReusePanel-D0628OYc.cjs +1 -0
  21. package/dist/TemplateReusePanel-DtYbCN7U.js +389 -0
  22. package/dist/TemplateReviewPanel-CSwvCz3f.cjs +1 -0
  23. package/dist/TemplateReviewPanel-D_FR4ISq.js +602 -0
  24. package/dist/artifact-integrity.json +94 -94
  25. package/dist/assets-B4AJIOTB.cjs +1 -0
  26. package/dist/assets-D0FbszhB.js +137 -0
  27. package/dist/{auto-CTIJ6PnR.js → auto-BksreoKc.js} +5 -5
  28. package/dist/auto-C3mGqzJ8.cjs +1 -0
  29. package/dist/capabilities-CTwlcl8q.cjs +1 -0
  30. package/dist/capabilities-lqDEZSq5.js +121 -0
  31. package/dist/data-bar-2NLRzOCQ.cjs +1 -0
  32. package/dist/{data-bar-IkI6VvMQ.js → data-bar-BnGtnJ82.js} +1 -1
  33. package/dist/designer-BNf7NWd6.js +7589 -0
  34. package/dist/designer-DWnZZ_ej.cjs +2 -0
  35. package/dist/designer.cjs +1 -1
  36. package/dist/designer.d.cts +144 -4
  37. package/dist/designer.d.ts +144 -4
  38. package/dist/designer.js +6 -6
  39. package/dist/diagnostic-collector-1sqd7DQP.js +355 -0
  40. package/dist/diagnostic-collector-D3rlvxm3.cjs +1 -0
  41. package/dist/{dom-JWrchIre.js → dom-C90cTM6Y.js} +4 -4
  42. package/dist/dom-CxOkm_Sy.cjs +1 -0
  43. package/dist/{encoding-BefcaHdp.cjs → encoding-CkziAnZI.cjs} +1 -1
  44. package/dist/{encoding-CL6rXEkR.js → encoding-DSc9zv2F.js} +2 -2
  45. package/dist/{font-loader-Ga51c2VC.cjs → font-loader-D-znWNWS.cjs} +1 -1
  46. package/dist/{font-loader-BT5baV-o.js → font-loader-i7lZbqH_.js} +1 -1
  47. package/dist/{grid-strokes-EoY66L2f.js → grid-strokes-BPiV1WHe.js} +1 -1
  48. package/dist/grid-strokes-DYf-6DMl.cjs +1 -0
  49. package/dist/index.cjs +5 -5
  50. package/dist/index.d.cts +46 -7
  51. package/dist/index.d.ts +46 -7
  52. package/dist/index.js +69 -68
  53. package/dist/{json-snapshot-OqkPyUk5.js → json-snapshot-BJWZNryO.js} +919 -791
  54. package/dist/json-snapshot-C7QZrRBf.cjs +2 -0
  55. package/dist/{pdf-aobetCsy.js → pdf-0_5XiTCx.js} +2499 -2492
  56. package/dist/{pdf-HiEeXe9H.cjs → pdf-DWuq6uxx.cjs} +31 -31
  57. package/dist/pdf.cjs +1 -1
  58. package/dist/pdf.d.cts +18 -0
  59. package/dist/pdf.d.ts +18 -0
  60. package/dist/pdf.js +2 -2
  61. package/dist/{plugin-DeYYAL6F.js → plugin-B1ydqEmS.js} +1 -1
  62. package/dist/{plugin-BFANt-i8.cjs → plugin-BQBz2vLG.cjs} +1 -1
  63. package/dist/prefill-2p9wrpn9.cjs +1 -0
  64. package/dist/{prefill-Dk4C6S5R.js → prefill-Cuzh1wxf.js} +13 -13
  65. package/dist/prepared-CVbgO9KR.js +128 -0
  66. package/dist/prepared-DAwe8Il2.cjs +1 -0
  67. package/dist/protocol-BOri9qJL.js +105 -0
  68. package/dist/protocol-DD5dHSz-.cjs +1 -0
  69. package/dist/record-bindings-CAyM5tGg.cjs +1 -0
  70. package/dist/{record-bindings-DatJZv_e.js → record-bindings-fhav-NLG.js} +1 -1
  71. package/dist/{region-binding-workflow-DjrXuR1q.js → region-binding-workflow-Cm4mqhih.js} +2 -2
  72. package/dist/{region-binding-workflow-l7NGfagJ.cjs → region-binding-workflow-DWCUgjZl.cjs} +1 -1
  73. package/dist/report-encoding-worker.cjs +1 -1
  74. package/dist/report-encoding-worker.js +1 -1
  75. package/dist/rich-text-layout-X9YOz1JD.cjs +3 -0
  76. package/dist/{rich-text-layout-Ciwa6D2o.js → rich-text-layout-YJHtCWQI.js} +1 -1
  77. package/dist/runtime-BpSAgOw1.js +201 -0
  78. package/dist/runtime-Cd2UTnwe.cjs +1 -0
  79. package/dist/sbom.cdx.json +1 -1
  80. package/dist/server/node.d.cts +55 -7
  81. package/dist/server/node.d.ts +55 -7
  82. package/dist/server-node.cjs +5 -5
  83. package/dist/server-node.js +2710 -2418
  84. package/dist/server.cjs +1 -1
  85. package/dist/server.d.cts +47 -12
  86. package/dist/server.d.ts +47 -12
  87. package/dist/server.js +8 -8
  88. package/dist/style.css +1 -1
  89. package/dist/{template-catalog-CoT7jm_6.cjs → template-catalog--yBX169M.cjs} +1 -1
  90. package/dist/{template-catalog--cjxzgH7.js → template-catalog-Bu7s7ReF.js} +3 -3
  91. package/dist/template-fragments-5EzVn7bm.cjs +1 -0
  92. package/dist/{template-fragments-CPpGpQoz.js → template-fragments-Di2vDFnx.js} +2 -2
  93. package/dist/{template-registry-O0hNIOfB.js → template-registry-BCBF2b8j.js} +10 -10
  94. package/dist/template-registry-Bnh5aEYf.cjs +1 -0
  95. package/dist/textwrap-BPFxhpOw.cjs +4 -0
  96. package/dist/textwrap-CmVkhMhx.js +111 -0
  97. package/dist/vue/async.d.cts +104 -18
  98. package/dist/vue/async.d.ts +104 -18
  99. package/dist/vue/index.d.cts +134 -28
  100. package/dist/vue/index.d.ts +134 -28
  101. package/dist/vue-async.cjs +1 -1
  102. package/dist/vue-async.js +3 -3
  103. package/dist/vue.cjs +1 -1
  104. package/dist/vue.js +192 -162
  105. package/dist/{workbook-session-C9ZmCBwY.js → workbook-session-B6P_-5a4.js} +2 -2
  106. package/dist/{workbook-session-C6-SrnCT.cjs → workbook-session-BnPK3T58.cjs} +1 -1
  107. package/dist/worker.cjs +1 -1
  108. package/dist/worker.d.cts +55 -7
  109. package/dist/worker.d.ts +55 -7
  110. package/dist/worker.js +4 -4
  111. package/dist/xlsx.cjs +4 -4
  112. package/dist/xlsx.d.cts +18 -1
  113. package/dist/xlsx.d.ts +18 -1
  114. package/dist/xlsx.js +279 -272
  115. package/package.json +1 -1
  116. package/dist/ExcelBindingWizard-D4FLind-.js +0 -1485
  117. package/dist/ExcelBindingWizard-D4RS5Bpg.cjs +0 -1
  118. package/dist/ParamEditor-C-6C9rd2.cjs +0 -1
  119. package/dist/ParamEditor-CASZt-Ma.js +0 -732
  120. package/dist/ReportBatchPanel-Bq7t8a5r.js +0 -350
  121. package/dist/ReportBatchPanel-YVj5IO5y.cjs +0 -1
  122. package/dist/ReportLabelStudio-Cqhita1b.cjs +0 -1
  123. package/dist/ReportLabelStudio-Dj7GXhuv.js +0 -783
  124. package/dist/ReportParamPanel-DZbFVmDL.cjs +0 -1
  125. package/dist/ReportPreview-DeWzG8jQ.js +0 -6257
  126. package/dist/ReportPreview-FFIryrIr.cjs +0 -6
  127. package/dist/ReportTemplateLibrary-BaWodmpm.cjs +0 -1
  128. package/dist/ReportTemplateLibrary-DdAAAD2I.js +0 -311
  129. package/dist/RuleEditor-D2UwQGF6.js +0 -2341
  130. package/dist/RuleEditor-DcT9xI1v.cjs +0 -1
  131. package/dist/TemplateOutlinePanel-CUHFFiNM.cjs +0 -1
  132. package/dist/TemplateOutlinePanel-DrT7XN0m.js +0 -96
  133. package/dist/TemplateReusePanel-4eejkNqi.js +0 -388
  134. package/dist/TemplateReusePanel-DZMyiX5I.cjs +0 -1
  135. package/dist/TemplateReviewPanel-BIhNLeNw.js +0 -592
  136. package/dist/TemplateReviewPanel-DnYImiXu.cjs +0 -1
  137. package/dist/assets-D2gHc4Mz.cjs +0 -1
  138. package/dist/assets-T_gDeFaz.js +0 -132
  139. package/dist/auto-4pK9HePf.cjs +0 -1
  140. package/dist/capabilities-DiBj4Qgl.cjs +0 -1
  141. package/dist/capabilities-pg7j7VLT.js +0 -106
  142. package/dist/data-bar-CeZuFmYl.cjs +0 -1
  143. package/dist/designer-DhrE7jzw.js +0 -7169
  144. package/dist/designer-IAZu6kBX.cjs +0 -2
  145. package/dist/dom-ChE5D-L-.cjs +0 -1
  146. package/dist/grid-strokes-Be24LGuV.cjs +0 -1
  147. package/dist/json-snapshot-1tvQNzQE.cjs +0 -2
  148. package/dist/prefill-DsUD5OoK.cjs +0 -1
  149. package/dist/prepared-DCIxhKFo.js +0 -94
  150. package/dist/prepared-Dv-XM3i1.cjs +0 -1
  151. package/dist/progress-ByiOxUD3.js +0 -250
  152. package/dist/progress-WomPRP3B.cjs +0 -1
  153. package/dist/protocol-B9YgfQ_d.cjs +0 -1
  154. package/dist/protocol-DxeUKGYG.js +0 -90
  155. package/dist/record-bindings-MBxbeBsi.cjs +0 -1
  156. package/dist/rich-text-layout-DK7A_a5r.cjs +0 -3
  157. package/dist/runtime-75Y5Oq5B.js +0 -171
  158. package/dist/runtime-DKlGd_D4.cjs +0 -1
  159. package/dist/template-fragments-GVjpew_q.cjs +0 -1
  160. package/dist/template-registry-DI59PXVK.cjs +0 -1
  161. package/dist/textwrap-BIjtEWmq.js +0 -110
  162. package/dist/textwrap-Cy7o1hIR.cjs +0 -4
@@ -0,0 +1,2354 @@
1
+ import { ref as G, computed as z, defineComponent as be, resolveComponent as ke, openBlock as i, createElementBlock as s, normalizeClass as fe, createElementVNode as a, createTextVNode as $, toDisplayString as t, createCommentVNode as N, Fragment as C, renderList as M, createVNode as ve, watch as te, withDirectives as F, isRef as ce, vModelCheckbox as re, unref as l, vModelSelect as O, vModelText as X, createBlock as $e, nextTick as Ee, normalizeStyle as Te, vShow as Ke } from "vue";
2
+ import { a as Ve, D as Le, u as Be, b as Oe, f as Ae } from "./designer-BNf7NWd6.js";
3
+ import { r as Ie, j as ye, v as We, e as Ge } from "./computed-f3pOqWLX.js";
4
+ import { _ as ge } from "./_plugin-vue_export-helper-8SL1F89S.js";
5
+ import { u as me } from "./useLocalDraft-BnhcxXk_.js";
6
+ import { c as Je } from "./matrix-C6e_r_vp.js";
7
+ import { v as we } from "./template-registry-BCBF2b8j.js";
8
+ import { c as je } from "./template-serialization-CWmHq7lX.js";
9
+ function Ce(e, W = /* @__PURE__ */ new Set()) {
10
+ return typeof e == "string" || ("field" in e && e.field && W.add(e.field), "weightField" in e && e.weightField && W.add(e.weightField), "args" in e && e.condition && Ie(e.condition).forEach((V) => W.add(V)), "args" in e && e.args.forEach((V) => Ce(V, W))), W;
11
+ }
12
+ function Ue(e, W) {
13
+ return typeof e == "string" ? e : "value" in e ? e.value === null ? W.null : String(e.value) : "aggregate" in e ? `${W[e.aggregate]}(${e.field ?? W.allRows})` : "field" in e ? e.field : `${W[e.op]}(${e.args.map((V) => Ue(V, W)).join(", ")})`;
14
+ }
15
+ function He(e, W, V) {
16
+ const j = G("");
17
+ function w(T) {
18
+ const y = e.list.columns.find((L) => L.field === T)?.format;
19
+ return y && "digits" in y && y.digits !== void 0 ? `${y.digits} ${V.value.digits}` : void 0;
20
+ }
21
+ const U = z(() => {
22
+ const T = /* @__PURE__ */ new Map();
23
+ for (const y of e.datasetSchema?.fields ?? []) T.set(y.field, {
24
+ field: y.field,
25
+ label: y.label ?? y.field,
26
+ meta: [y.type, y.unit, w(y.field)].filter(Boolean).join(" · ")
27
+ });
28
+ for (const y of e.list.columns) T.has(y.field) || T.set(y.field, { field: y.field, label: y.header || y.field, meta: y.semanticRole ?? "" });
29
+ return [...T.values()];
30
+ }), r = z(() => {
31
+ const T = j.value.trim().toLocaleLowerCase();
32
+ return U.value.filter((y) => `${y.field} ${y.label} ${y.meta}`.toLocaleLowerCase().includes(T));
33
+ }), d = z(() => Ue(W.value.expression, V.value)), b = z(() => {
34
+ const T = [...Ce(W.value.expression)];
35
+ return (e.datasets?.[e.list.dataset] ?? []).slice(0, 5).map((y, L) => ({
36
+ row: L + 1,
37
+ values: T.map((x) => `${x} = ${y[x] == null ? V.value.null : String(y[x])}`).join(" · ")
38
+ }));
39
+ });
40
+ return { query: j, matches: r, fieldWindow: z(() => r.value.slice(0, 50)), expression: d, sources: b };
41
+ }
42
+ const Pe = { class: "mr-predicate__mode" }, ze = ["aria-label", "value", "disabled"], qe = { value: "comparison" }, Ze = {
43
+ key: 0,
44
+ value: "all"
45
+ }, Qe = {
46
+ key: 1,
47
+ value: "any"
48
+ }, Xe = {
49
+ key: 2,
50
+ value: "not"
51
+ }, Ye = { class: "mr-predicate__pair" }, pe = ["aria-label", "value", "disabled"], _e = ["value"], el = ["aria-label", "value", "disabled"], ll = ["value"], al = ["value"], tl = ["aria-label", "value", "disabled"], nl = { value: "text" }, il = { value: "number" }, sl = { value: "decimal" }, dl = { value: "date" }, ol = { value: "boolean" }, ul = {
52
+ key: 0,
53
+ class: "mr-predicate__pair"
54
+ }, rl = ["value", "disabled"], cl = ["value", "disabled"], ml = ["aria-label", "value", "disabled"], vl = { value: "value" }, bl = { value: "field" }, gl = ["value", "aria-label", "disabled"], fl = ["value"], yl = ["value", "aria-label", "disabled"], hl = ["aria-label", "disabled", "onClick"], kl = ["disabled"], $l = /* @__PURE__ */ be({
55
+ __name: "ReportPredicateEditor",
56
+ props: {
57
+ modelValue: {},
58
+ fields: {},
59
+ messages: {},
60
+ readonly: { type: Boolean },
61
+ depth: {}
62
+ },
63
+ emits: ["update:modelValue"],
64
+ setup(e, { emit: W }) {
65
+ const V = e, j = W, w = z(() => "all" in V.modelValue ? "all" : "any" in V.modelValue ? "any" : "not" in V.modelValue ? "not" : "comparison"), U = z(() => "all" in V.modelValue ? V.modelValue.all : "any" in V.modelValue ? V.modelValue.any : "not" in V.modelValue ? [V.modelValue.not] : []), r = z(() => "field" in V.modelValue ? V.modelValue : void 0);
66
+ function d(n) {
67
+ V.readonly || j("update:modelValue", n);
68
+ }
69
+ function b() {
70
+ return { field: V.fields[0]?.field ?? "", op: ">", value: 0, valueType: "number" };
71
+ }
72
+ function T(n) {
73
+ const v = V.modelValue;
74
+ d(n === "all" ? { all: [v] } : n === "any" ? { any: [v] } : n === "not" ? { not: v } : b());
75
+ }
76
+ function y(n, v) {
77
+ const o = [...U.value];
78
+ v ? o[n] = v : o.splice(n, 1), d(w.value === "all" ? { all: o } : w.value === "any" ? { any: o } : { not: o[0] });
79
+ }
80
+ function L() {
81
+ const n = [...U.value, b()];
82
+ d(w.value === "all" ? { all: n } : { any: n });
83
+ }
84
+ function x(n) {
85
+ r.value && d({ ...r.value, ...n });
86
+ }
87
+ function K(n) {
88
+ if (!r.value) return;
89
+ const v = { ...r.value, op: n };
90
+ delete v.right, delete v.values, n === "between" ? (v.values = [0, 1], delete v.value) : n === "isNull" || n === "isNotNull" ? delete v.value : v.value = n === "contains" ? "" : 0, d(v);
91
+ }
92
+ function H(n) {
93
+ const v = r.value?.valueType ?? r.value?.numeric;
94
+ return v === "number" && n.trim() && Number.isFinite(Number(n)) ? Number(n) : v === "boolean" ? n === "true" : n;
95
+ }
96
+ function J(n, v) {
97
+ if (r.value)
98
+ if (v !== void 0) {
99
+ const o = [...r.value.values ?? [0, 1]];
100
+ o[v] = H(n), x({ values: o });
101
+ } else x({ value: H(n), right: void 0 });
102
+ }
103
+ function c(n) {
104
+ x(n === "field" ? { value: void 0, right: { field: V.fields[0]?.field ?? "" } } : { value: 0, right: void 0 });
105
+ }
106
+ return (n, v) => {
107
+ const o = ke("ReportPredicateEditor", !0);
108
+ return i(), s("div", {
109
+ class: fe(["mr-predicate", { "is-nested": (e.depth ?? 0) > 0 }])
110
+ }, [
111
+ a("label", Pe, [
112
+ $(t(e.messages.conditionGroup), 1),
113
+ a("select", {
114
+ "aria-label": e.messages.conditionGroup,
115
+ value: w.value,
116
+ disabled: e.readonly,
117
+ onChange: v[0] || (v[0] = (h) => T(h.target.value))
118
+ }, [
119
+ a("option", qe, t(e.messages.comparison), 1),
120
+ (e.depth ?? 0) < 8 ? (i(), s("option", Ze, t(e.messages.all), 1)) : N("", !0),
121
+ (e.depth ?? 0) < 8 ? (i(), s("option", Qe, t(e.messages.any), 1)) : N("", !0),
122
+ (e.depth ?? 0) < 8 ? (i(), s("option", Xe, t(e.messages.not), 1)) : N("", !0)
123
+ ], 40, ze)
124
+ ]),
125
+ r.value ? (i(), s(C, { key: 0 }, [
126
+ a("div", Ye, [
127
+ a("label", null, [
128
+ $(t(e.messages.field), 1),
129
+ a("select", {
130
+ "aria-label": e.messages.condition,
131
+ value: r.value.field,
132
+ disabled: e.readonly,
133
+ onChange: v[1] || (v[1] = (h) => x({ field: h.target.value }))
134
+ }, [
135
+ (i(!0), s(C, null, M(e.fields, (h) => (i(), s("option", {
136
+ key: h.field,
137
+ value: h.field
138
+ }, t(h.label), 9, _e))), 128))
139
+ ], 40, pe)
140
+ ]),
141
+ a("label", null, [
142
+ $(t(e.messages.comparison), 1),
143
+ a("select", {
144
+ "aria-label": e.messages.comparison,
145
+ value: r.value.op,
146
+ disabled: e.readonly,
147
+ onChange: v[2] || (v[2] = (h) => K(h.target.value))
148
+ }, [
149
+ (i(), s(C, null, M([">", ">=", "<", "<=", "==", "!="], (h) => a("option", {
150
+ key: h,
151
+ value: h
152
+ }, t(h), 9, ll)), 64)),
153
+ (i(), s(C, null, M(["between", "contains", "isNull", "isNotNull"], (h) => a("option", {
154
+ key: h,
155
+ value: h
156
+ }, t(e.messages[h]), 9, al)), 64))
157
+ ], 40, el)
158
+ ])
159
+ ]),
160
+ ["isNull", "isNotNull"].includes(r.value.op) ? N("", !0) : (i(), s(C, { key: 0 }, [
161
+ a("label", null, [
162
+ $(t(e.messages.valueKind), 1),
163
+ a("select", {
164
+ "aria-label": e.messages.valueKind,
165
+ value: r.value.valueType ?? r.value.numeric ?? (typeof r.value.value == "number" ? "number" : "text"),
166
+ disabled: e.readonly,
167
+ onChange: v[3] || (v[3] = (h) => x({ valueType: h.target.value }))
168
+ }, [
169
+ a("option", nl, t(e.messages.text), 1),
170
+ a("option", il, t(e.messages.number), 1),
171
+ a("option", sl, t(e.messages.decimal), 1),
172
+ a("option", dl, t(e.messages.calendarDate), 1),
173
+ a("option", ol, t(e.messages.boolean), 1)
174
+ ], 40, tl)
175
+ ]),
176
+ r.value.op === "between" ? (i(), s("div", ul, [
177
+ a("label", null, [
178
+ $(t(e.messages.lowerBound), 1),
179
+ a("input", {
180
+ value: r.value.values?.[0],
181
+ disabled: e.readonly,
182
+ onInput: v[4] || (v[4] = (h) => J(h.target.value, 0))
183
+ }, null, 40, rl)
184
+ ]),
185
+ a("label", null, [
186
+ $(t(e.messages.upperBound), 1),
187
+ a("input", {
188
+ value: r.value.values?.[1],
189
+ disabled: e.readonly,
190
+ onInput: v[5] || (v[5] = (h) => J(h.target.value, 1))
191
+ }, null, 40, cl)
192
+ ])
193
+ ])) : (i(), s(C, { key: 1 }, [
194
+ a("label", null, [
195
+ $(t(e.messages.threshold), 1),
196
+ a("select", {
197
+ "aria-label": e.messages.threshold,
198
+ value: r.value.right && "field" in r.value.right ? "field" : "value",
199
+ disabled: e.readonly,
200
+ onChange: v[6] || (v[6] = (h) => c(h.target.value))
201
+ }, [
202
+ a("option", vl, t(e.messages.compareValue), 1),
203
+ a("option", bl, t(e.messages.compareField), 1)
204
+ ], 40, ml)
205
+ ]),
206
+ r.value.right && "field" in r.value.right ? (i(), s("select", {
207
+ key: 0,
208
+ value: r.value.right.field,
209
+ "aria-label": e.messages.compareField,
210
+ disabled: e.readonly,
211
+ onChange: v[7] || (v[7] = (h) => x({ right: { field: h.target.value } }))
212
+ }, [
213
+ (i(!0), s(C, null, M(e.fields, (h) => (i(), s("option", {
214
+ key: h.field,
215
+ value: h.field
216
+ }, t(h.label), 9, fl))), 128))
217
+ ], 40, gl)) : (i(), s("input", {
218
+ key: 1,
219
+ value: r.value.right && "value" in r.value.right ? r.value.right.value : r.value.value,
220
+ "aria-label": e.messages.compareValue,
221
+ disabled: e.readonly,
222
+ onInput: v[8] || (v[8] = (h) => J(h.target.value))
223
+ }, null, 40, yl))
224
+ ], 64))
225
+ ], 64))
226
+ ], 64)) : (i(), s(C, { key: 1 }, [
227
+ (i(!0), s(C, null, M(U.value, (h, A) => (i(), s("div", {
228
+ key: A,
229
+ class: "mr-predicate__child"
230
+ }, [
231
+ ve(o, {
232
+ "model-value": h,
233
+ fields: e.fields,
234
+ messages: e.messages,
235
+ readonly: e.readonly,
236
+ depth: (e.depth ?? 0) + 1,
237
+ "onUpdate:modelValue": (Q) => y(A, Q)
238
+ }, null, 8, ["model-value", "fields", "messages", "readonly", "depth", "onUpdate:modelValue"]),
239
+ U.value.length > 1 ? (i(), s("button", {
240
+ key: 0,
241
+ type: "button",
242
+ "aria-label": e.messages.removeCondition,
243
+ disabled: e.readonly,
244
+ onClick: (Q) => y(A)
245
+ }, "×", 8, hl)) : N("", !0)
246
+ ]))), 128)),
247
+ w.value !== "not" && U.value.length < 8 ? (i(), s("button", {
248
+ key: 0,
249
+ type: "button",
250
+ disabled: e.readonly,
251
+ onClick: L
252
+ }, "+ " + t(e.messages.addCondition), 9, kl)) : N("", !0)
253
+ ], 64))
254
+ ], 2);
255
+ };
256
+ }
257
+ }), Fe = /* @__PURE__ */ ge($l, [["__scopeId", "data-v-22a42478"]]), oe = (e) => JSON.parse(JSON.stringify(e));
258
+ function Vl(e, W) {
259
+ const V = G(!1), j = G(""), w = G({
260
+ dataset: "",
261
+ parentKey: "",
262
+ foreignKey: "",
263
+ columns: []
264
+ }), U = G({
265
+ rowFields: [],
266
+ columnFields: [],
267
+ measures: []
268
+ }), r = G({ input: "flat", idField: "id", parentField: "parentId", labelField: "", parentValues: "source" }), d = me(() => ({ enabled: V.value, detail: w.value, matrix: U.value, tree: r.value }));
269
+ let b;
270
+ const T = G(), y = z(() => [
271
+ .../* @__PURE__ */ new Set([
272
+ ...Object.keys(e.datasets ?? {}),
273
+ ...Object.keys(e.datasetSchemas ?? {})
274
+ ])
275
+ ]), L = z(
276
+ () => K(e.list.dataset, e.datasetSchema)
277
+ ), x = z(() => K(w.value.dataset));
278
+ function K(m, S) {
279
+ const R = /* @__PURE__ */ new Map();
280
+ for (const E of (S ?? e.datasetSchemas?.[m])?.fields ?? [])
281
+ R.set(E.field, E.label ?? E.field);
282
+ const D = e.datasets?.[m]?.[0];
283
+ for (const E of Object.keys(D ?? {}))
284
+ R.has(E) || R.set(E, E);
285
+ if (m === e.list.dataset)
286
+ for (const E of e.list.columns)
287
+ R.has(E.field) || R.set(E.field, E.header || E.field);
288
+ return [...R].map(([E, ae]) => ({ field: E, label: ae }));
289
+ }
290
+ function H() {
291
+ if (b === JSON.stringify(e.list)) {
292
+ b = void 0;
293
+ return;
294
+ }
295
+ V.value = !!e.list[e.mode];
296
+ const m = y.value.find((S) => S !== e.list.dataset) ?? "";
297
+ w.value = oe(
298
+ e.list.detail ?? {
299
+ dataset: m,
300
+ parentKey: e.list.rowKey ?? e.datasetSchema?.rowKey ?? L.value[0]?.field ?? "",
301
+ foreignKey: "",
302
+ columns: [],
303
+ header: !0,
304
+ unmatched: "error"
305
+ }
306
+ ), U.value = oe(
307
+ e.list.matrix ?? {
308
+ rowFields: [],
309
+ columnFields: [],
310
+ measures: [],
311
+ totals: !0
312
+ }
313
+ ), U.value.measures = U.value.measures.map((S) => ({ ...S, numeric: S.numeric ?? "number" })), r.value = oe(e.list.tree ?? { input: "flat", idField: e.list.rowKey ?? "id", parentField: "parentId", childrenField: "children", labelField: e.list.columns[0]?.field ?? "", parentValues: "source", orphan: "error", indentMm: 3, maxRows: 1e5, maxDepth: 64 }), j.value = "", T.value = void 0, d.accept();
314
+ }
315
+ te(() => [e.mode, e.list.dataset, e.list[e.mode]], H, { immediate: !0 });
316
+ function J(m) {
317
+ w.value.dataset = m, w.value.columns = [], w.value.foreignKey = x.value[0]?.field ?? "", w.value.rowKey = e.datasetSchemas?.[m]?.rowKey;
318
+ }
319
+ function c(m, S) {
320
+ if (S && !w.value.columns.some((R) => R.field === m)) {
321
+ const R = e.datasetSchemas?.[w.value.dataset]?.fields.find((D) => D.field === m);
322
+ w.value.columns.push({
323
+ field: m,
324
+ header: x.value.find((D) => D.field === m)?.label ?? m,
325
+ widthMm: 30,
326
+ align: "auto",
327
+ semanticRole: R?.semanticRole,
328
+ editable: !1
329
+ });
330
+ } else S || (w.value.columns = w.value.columns.filter(
331
+ (R) => R.field !== m
332
+ ));
333
+ }
334
+ function n(m, S, R) {
335
+ if (e.readonly) return;
336
+ const D = U.value[m];
337
+ v(m, R ? [.../* @__PURE__ */ new Set([...D, S])] : D.filter((E) => E !== S));
338
+ }
339
+ function v(m, S) {
340
+ const R = U.value[m];
341
+ U.value[m] = S;
342
+ const D = U.value.hierarchy?.[m === "rowFields" ? "row" : "column"];
343
+ D && (D.sort && (D.sort = S.map((E) => D.sort?.[R.indexOf(E)] ?? "source")), D.labels && (D.labels = S.map((E) => D.labels?.[R.indexOf(E)] ?? E)), D.subtotals && (D.subtotals = D.subtotals.map((E) => S.indexOf(R[E - 1]) + 1).filter((E) => E > 0 && E < S.length)));
344
+ }
345
+ function o(m, S, R) {
346
+ const D = [...U.value[m]], E = S + R;
347
+ e.readonly || S < 0 || S >= D.length || E < 0 || E >= D.length || ([D[S], D[E]] = [D[E], D[S]], v(m, D));
348
+ }
349
+ function h() {
350
+ U.value.measures = [
351
+ ...U.value.measures,
352
+ { field: L.value[0]?.field ?? "", op: "sum", numeric: "number" }
353
+ ];
354
+ }
355
+ function A(m) {
356
+ U.value.measures = U.value.measures.filter(
357
+ (S, R) => R !== m
358
+ );
359
+ }
360
+ function Q(m) {
361
+ e.readonly || (m ? U.value.hierarchy ??= {} : delete U.value.hierarchy);
362
+ }
363
+ function p(m, S, R) {
364
+ if (e.readonly || !U.value.hierarchy) return;
365
+ const D = U.value.hierarchy[m] ??= {}, ae = (m === "row" ? U.value.rowFields : U.value.columnFields).map((P, k) => D.sort?.[k] ?? "source");
366
+ ae[S] = R, D.sort = ae;
367
+ }
368
+ function ee(m, S, R) {
369
+ if (e.readonly || !U.value.hierarchy) return;
370
+ const D = U.value.hierarchy[m] ??= {};
371
+ D.subtotals = [...new Set(R ? [...D.subtotals ?? [], S] : (D.subtotals ?? []).filter((E) => E !== S))];
372
+ }
373
+ function le() {
374
+ r.value.aggregates = [...r.value.aggregates ?? [], { field: L.value.find((m) => m.field !== r.value.labelField && m.field !== r.value.idField)?.field ?? "", op: "sum", numeric: "number" }];
375
+ }
376
+ function ne(m) {
377
+ r.value.aggregates = r.value.aggregates?.filter((S, R) => R !== m);
378
+ }
379
+ function _() {
380
+ j.value = "", T.value = void 0;
381
+ try {
382
+ const m = e.datasets?.[e.list.dataset] ?? [];
383
+ if (!m.length) throw new Error(e.messages.noData);
384
+ if (m.length > 1e3) throw new Error(e.messages.treeBudget);
385
+ const S = je(m, { ...r.value, aggregates: r.value.parentValues === "leaf-aggregate" ? r.value.aggregates : void 0, maxRows: 1e3 }), R = e.list.columns.slice(0, 5);
386
+ T.value = { columns: R.map((D) => D.header), rows: S.entries.slice(0, 8).map((D) => R.map((E) => E.field === r.value.labelField ? `${" ".repeat(Math.min(6, D.depth))}${D.row[E.field] ?? ""}` : D.row[E.field])) };
387
+ } catch (m) {
388
+ j.value = m instanceof Error ? m.message : String(m);
389
+ }
390
+ }
391
+ function ie(m) {
392
+ if (!V.value) {
393
+ delete m.tree;
394
+ return;
395
+ }
396
+ m.tree = oe(r.value), m.tree.parentValues !== "leaf-aggregate" && delete m.tree.aggregates, m.rowKey = m.tree.idField, delete m.detail, delete m.matrix, delete m.groupBy, delete m.groups, delete m.rowVisibleWhen;
397
+ }
398
+ function de() {
399
+ j.value = "", T.value = void 0;
400
+ try {
401
+ const m = e.datasets?.[e.list.dataset] ?? [];
402
+ if (!m.length) throw new Error(e.messages.noData);
403
+ const S = Je(m.slice(0, 1e3), {
404
+ ...U.value,
405
+ maxInputRows: 1e3
406
+ });
407
+ T.value = {
408
+ columns: S.columns.slice(0, 5).map((R) => R.header),
409
+ rows: S.rows.slice(0, 5).map(
410
+ (R) => S.columns.slice(0, 5).map((D) => R[D.field])
411
+ )
412
+ };
413
+ } catch (m) {
414
+ j.value = m instanceof Error ? m.message : String(m);
415
+ }
416
+ }
417
+ function se() {
418
+ if (e.readonly) return;
419
+ const m = oe(e.list);
420
+ e.mode === "tree" ? ie(m) : e.mode === "detail" ? V.value ? (m.detail = oe(w.value), delete m.matrix, delete m.tree) : delete m.detail : V.value ? (m.matrix = oe(U.value), delete m.detail, delete m.tree, delete m.groups, delete m.groupBy, delete m.grandTotal) : delete m.matrix;
421
+ const S = we({ pages: [{ widthMm: Math.max(1, m.leftMm + m.widthMm), heightMm: 297, components: [m] }] });
422
+ if (!S.ok) {
423
+ j.value = S.errors.slice(0, 3).map((R) => R.message).join(";");
424
+ return;
425
+ }
426
+ e.accept && !e.accept(m) || (b = JSON.stringify(m), e.accept || W(m), d.accept());
427
+ }
428
+ return Ve({ key: () => `${e.recoveryKey ?? "rules:0:0"}:${e.mode}`, baseline: () => JSON.stringify(e.list[e.mode]), pending: () => d.pending.value, reset: () => {
429
+ b = void 0, H();
430
+ }, snapshot: () => JSON.stringify({ enabled: V.value, detail: w.value, matrix: U.value, tree: r.value, baseline: d.baseline.value }), restore(m) {
431
+ const S = JSON.parse(m);
432
+ V.value = S.enabled, w.value = S.detail, U.value = S.matrix, r.value = S.tree, d.baseline.value = S.baseline;
433
+ } }), {
434
+ enabled: V,
435
+ pendingLocalChanges: d.pending,
436
+ detail: w,
437
+ matrix: U,
438
+ tree: r,
439
+ datasets: y,
440
+ sourceFields: L,
441
+ childFields: x,
442
+ error: j,
443
+ preview: T,
444
+ chooseDataset: J,
445
+ toggleChildColumn: c,
446
+ toggleDimension: n,
447
+ moveDimension: o,
448
+ addMeasure: h,
449
+ removeMeasure: A,
450
+ checkMatrix: de,
451
+ toggleHierarchy: Q,
452
+ setDimensionSort: p,
453
+ toggleMatrixSubtotal: ee,
454
+ addTreeAggregate: le,
455
+ removeTreeAggregate: ne,
456
+ checkTree: _,
457
+ apply: se
458
+ };
459
+ }
460
+ const wl = { class: "mr-data-layout" }, Cl = { class: "mr-data-layout__check" }, Ul = ["disabled"], Fl = { class: "mr-data-layout__hint" }, Sl = ["aria-label", "value", "disabled"], Ml = {
461
+ value: "",
462
+ disabled: ""
463
+ }, xl = ["value"], Dl = { class: "mr-data-layout__pair" }, Nl = ["aria-label", "disabled"], Rl = ["value"], El = ["aria-label", "disabled"], Tl = {
464
+ value: "",
465
+ disabled: ""
466
+ }, Kl = ["value"], Ll = ["aria-label", "disabled"], Bl = { value: void 0 }, Ol = ["value"], Al = { class: "mr-data-layout__choices" }, Il = ["checked", "disabled", "onChange"], Wl = ["aria-label", "disabled"], Gl = { class: "mr-data-layout__pair" }, Jl = ["aria-label", "disabled"], jl = { value: "error" }, Hl = { value: "ignore" }, Pl = { class: "mr-data-layout__check" }, zl = ["disabled"], ql = { class: "mr-data-layout__hint" }, Zl = { class: "mr-data-layout__pair" }, Ql = ["aria-label", "disabled"], Xl = { value: "flat" }, Yl = { value: "nested" }, pl = ["aria-label", "disabled"], _l = ["value"], ea = { class: "mr-data-layout__pair" }, la = { key: 0 }, aa = ["aria-label", "disabled"], ta = ["value"], na = { key: 1 }, ia = ["aria-label", "disabled"], sa = ["aria-label", "disabled"], da = ["value"], oa = { class: "mr-data-layout__pair" }, ua = ["aria-label", "disabled"], ra = { key: 0 }, ca = ["aria-label", "disabled"], ma = { value: "error" }, va = { value: "root" }, ba = ["aria-label", "disabled"], ga = { value: "source" }, fa = { value: "leaf-aggregate" }, ya = { class: "mr-data-layout__pair" }, ha = ["onUpdate:modelValue", "aria-label", "disabled"], ka = ["value"], $a = ["onUpdate:modelValue", "aria-label", "disabled"], Va = ["value"], wa = { key: 0 }, Ca = ["onUpdate:modelValue", "aria-label", "disabled"], Ua = ["value"], Fa = { class: "mr-data-layout__pair" }, Sa = ["onUpdate:modelValue", "aria-label", "disabled"], Ma = { value: "number" }, xa = { value: "decimal" }, Da = ["onUpdate:modelValue", "aria-label", "disabled"], Na = ["disabled", "onClick"], Ra = ["disabled"], Ea = { class: "mr-data-layout__pair" }, Ta = ["aria-label", "disabled"], Ka = ["aria-label", "disabled"], La = { class: "mr-data-layout__hint" }, Ba = { class: "mr-data-layout__hint" }, Oa = ["checked", "disabled", "onChange"], Aa = { class: "mr-data-layout__pair" }, Ia = ["aria-label", "onUpdate:modelValue", "disabled"], Wa = ["value"], Ga = ["aria-label", "onUpdate:modelValue", "disabled"], Ja = ["value"], ja = ["aria-label", "onUpdate:modelValue", "disabled", "placeholder"], Ha = { key: 0 }, Pa = ["aria-label", "onUpdate:modelValue", "disabled"], za = ["value"], qa = { class: "mr-data-layout__pair" }, Za = ["aria-label", "onUpdate:modelValue", "disabled"], Qa = { value: "number" }, Xa = { value: "decimal" }, Ya = ["aria-label", "onUpdate:modelValue", "disabled"], pa = ["disabled", "onClick"], _a = ["disabled"], et = { class: "mr-data-layout__check" }, lt = ["disabled"], at = { class: "mr-data-layout__check" }, tt = ["checked", "disabled"], nt = { class: "mr-data-layout__hint" }, it = ["aria-label", "disabled"], st = ["aria-label", "value", "disabled", "onChange"], dt = { value: "source" }, ot = { value: "asc" }, ut = { value: "desc" }, rt = ["aria-label", "disabled", "onClick"], ct = ["aria-label", "disabled", "onClick"], mt = {
467
+ key: 0,
468
+ class: "mr-data-layout__check"
469
+ }, vt = ["checked", "disabled", "onChange"], bt = { class: "mr-data-layout__pair" }, gt = ["disabled"], ft = ["disabled"], yt = { class: "mr-data-layout__actions" }, ht = ["disabled"], kt = ["disabled"], $t = ["disabled"], Vt = {
470
+ key: 3,
471
+ class: "mr-data-layout__preview"
472
+ }, wt = {
473
+ key: 4,
474
+ class: "mr-data-layout__error",
475
+ role: "alert"
476
+ }, Ct = /* @__PURE__ */ be({
477
+ __name: "RuleDataLayout",
478
+ props: {
479
+ recoveryKey: {},
480
+ list: {},
481
+ accept: { type: Function },
482
+ mode: {},
483
+ datasets: {},
484
+ datasetSchema: {},
485
+ datasetSchemas: {},
486
+ readonly: { type: Boolean },
487
+ messages: {}
488
+ },
489
+ emits: ["change", "dirty"],
490
+ setup(e, { emit: W }) {
491
+ const V = e, j = W, w = Vl(V, (J) => j("change", J)), {
492
+ enabled: U,
493
+ detail: r,
494
+ matrix: d,
495
+ tree: b,
496
+ datasets: T,
497
+ sourceFields: y,
498
+ childFields: L,
499
+ error: x,
500
+ preview: K
501
+ } = w;
502
+ te([w.pendingLocalChanges, U, r, d, b], () => j("dirty", w.pendingLocalChanges.value), { immediate: !0, deep: !0, flush: "sync" });
503
+ const H = ye();
504
+ return (J, c) => (i(), s("div", wl, [
505
+ a("label", Cl, [
506
+ F(a("input", {
507
+ "onUpdate:modelValue": c[0] || (c[0] = (n) => ce(U) ? U.value = n : null),
508
+ type: "checkbox",
509
+ disabled: e.readonly
510
+ }, null, 8, Ul), [
511
+ [re, l(U)]
512
+ ]),
513
+ $(t(e.messages.enabled) + t(e.messages[e.mode]), 1)
514
+ ]),
515
+ l(U) && e.mode === "detail" ? (i(), s(C, { key: 0 }, [
516
+ a("p", Fl, t(e.messages.detailHint), 1),
517
+ a("label", null, [
518
+ $(t(e.messages.childDataset), 1),
519
+ a("select", {
520
+ "aria-label": e.messages.childDataset,
521
+ value: l(r).dataset,
522
+ disabled: e.readonly,
523
+ onChange: c[1] || (c[1] = (n) => l(w).chooseDataset(n.target.value))
524
+ }, [
525
+ a("option", Ml, t(e.messages.select), 1),
526
+ (i(!0), s(C, null, M(l(T), (n) => (i(), s("option", {
527
+ key: n,
528
+ value: n
529
+ }, t(n), 9, xl))), 128))
530
+ ], 40, Sl)
531
+ ]),
532
+ a("div", Dl, [
533
+ a("label", null, [
534
+ $(t(e.messages.parentKey), 1),
535
+ F(a("select", {
536
+ "aria-label": e.messages.parentKey,
537
+ "onUpdate:modelValue": c[2] || (c[2] = (n) => l(r).parentKey = n),
538
+ disabled: e.readonly
539
+ }, [
540
+ (i(!0), s(C, null, M(l(y), (n) => (i(), s("option", {
541
+ key: n.field,
542
+ value: n.field
543
+ }, t(n.label), 9, Rl))), 128))
544
+ ], 8, Nl), [
545
+ [O, l(r).parentKey]
546
+ ])
547
+ ]),
548
+ a("label", null, [
549
+ $(t(e.messages.foreignKey), 1),
550
+ F(a("select", {
551
+ "aria-label": e.messages.foreignKey,
552
+ "onUpdate:modelValue": c[3] || (c[3] = (n) => l(r).foreignKey = n),
553
+ disabled: e.readonly
554
+ }, [
555
+ a("option", Tl, t(e.messages.select), 1),
556
+ (i(!0), s(C, null, M(l(L), (n) => (i(), s("option", {
557
+ key: n.field,
558
+ value: n.field
559
+ }, t(n.label), 9, Kl))), 128))
560
+ ], 8, El), [
561
+ [O, l(r).foreignKey]
562
+ ])
563
+ ])
564
+ ]),
565
+ a("label", null, [
566
+ $(t(e.messages.rowKey), 1),
567
+ F(a("select", {
568
+ "aria-label": e.messages.rowKey,
569
+ "onUpdate:modelValue": c[4] || (c[4] = (n) => l(r).rowKey = n),
570
+ disabled: e.readonly
571
+ }, [
572
+ a("option", Bl, t(e.messages.noRowKey), 1),
573
+ (i(!0), s(C, null, M(l(L), (n) => (i(), s("option", {
574
+ key: n.field,
575
+ value: n.field
576
+ }, t(n.label), 9, Ol))), 128))
577
+ ], 8, Ll), [
578
+ [O, l(r).rowKey]
579
+ ])
580
+ ]),
581
+ a("fieldset", Al, [
582
+ a("legend", null, t(e.messages.childColumns), 1),
583
+ (i(!0), s(C, null, M(l(L), (n) => (i(), s("label", {
584
+ key: n.field
585
+ }, [
586
+ a("input", {
587
+ type: "checkbox",
588
+ checked: l(r).columns.some((v) => v.field === n.field),
589
+ disabled: e.readonly,
590
+ onChange: (v) => l(w).toggleChildColumn(
591
+ n.field,
592
+ v.target.checked
593
+ )
594
+ }, null, 40, Il),
595
+ $(t(n.label), 1)
596
+ ]))), 128))
597
+ ]),
598
+ a("label", null, [
599
+ $(t(e.messages.title), 1),
600
+ F(a("input", {
601
+ "aria-label": e.messages.title,
602
+ "onUpdate:modelValue": c[5] || (c[5] = (n) => l(r).label = n),
603
+ disabled: e.readonly
604
+ }, null, 8, Wl), [
605
+ [X, l(r).label]
606
+ ])
607
+ ]),
608
+ a("div", Gl, [
609
+ a("label", null, [
610
+ $(t(e.messages.unmatched), 1),
611
+ F(a("select", {
612
+ "aria-label": e.messages.unmatched,
613
+ "onUpdate:modelValue": c[6] || (c[6] = (n) => l(r).unmatched = n),
614
+ disabled: e.readonly
615
+ }, [
616
+ a("option", jl, t(e.messages.error), 1),
617
+ a("option", Hl, t(e.messages.ignore), 1)
618
+ ], 8, Jl), [
619
+ [O, l(r).unmatched]
620
+ ])
621
+ ]),
622
+ a("label", Pl, [
623
+ F(a("input", {
624
+ "onUpdate:modelValue": c[7] || (c[7] = (n) => l(r).header = n),
625
+ type: "checkbox",
626
+ disabled: e.readonly
627
+ }, null, 8, zl), [
628
+ [re, l(r).header]
629
+ ]),
630
+ $(t(e.messages.childHeader), 1)
631
+ ])
632
+ ])
633
+ ], 64)) : l(U) && e.mode === "tree" ? (i(), s(C, { key: 1 }, [
634
+ a("p", ql, t(e.messages.treeHint), 1),
635
+ a("div", Zl, [
636
+ a("label", null, [
637
+ $(t(e.messages.treeInput), 1),
638
+ F(a("select", {
639
+ "onUpdate:modelValue": c[8] || (c[8] = (n) => l(b).input = n),
640
+ "aria-label": e.messages.treeInput,
641
+ disabled: e.readonly
642
+ }, [
643
+ a("option", Xl, t(e.messages.treeFlat), 1),
644
+ a("option", Yl, t(e.messages.treeNested), 1)
645
+ ], 8, Ql), [
646
+ [O, l(b).input]
647
+ ])
648
+ ]),
649
+ a("label", null, [
650
+ $(t(e.messages.treeId), 1),
651
+ F(a("select", {
652
+ "onUpdate:modelValue": c[9] || (c[9] = (n) => l(b).idField = n),
653
+ "aria-label": e.messages.treeId,
654
+ disabled: e.readonly
655
+ }, [
656
+ (i(!0), s(C, null, M(l(y), (n) => (i(), s("option", {
657
+ key: n.field,
658
+ value: n.field
659
+ }, t(n.label), 9, _l))), 128))
660
+ ], 8, pl), [
661
+ [O, l(b).idField]
662
+ ])
663
+ ])
664
+ ]),
665
+ a("div", ea, [
666
+ l(b).input === "flat" ? (i(), s("label", la, [
667
+ $(t(e.messages.treeParent), 1),
668
+ F(a("select", {
669
+ "onUpdate:modelValue": c[10] || (c[10] = (n) => l(b).parentField = n),
670
+ "aria-label": e.messages.treeParent,
671
+ disabled: e.readonly
672
+ }, [
673
+ (i(!0), s(C, null, M(l(y), (n) => (i(), s("option", {
674
+ key: n.field,
675
+ value: n.field
676
+ }, t(n.label), 9, ta))), 128))
677
+ ], 8, aa), [
678
+ [O, l(b).parentField]
679
+ ])
680
+ ])) : (i(), s("label", na, [
681
+ $(t(e.messages.treeChildren), 1),
682
+ F(a("input", {
683
+ "onUpdate:modelValue": c[11] || (c[11] = (n) => l(b).childrenField = n),
684
+ "aria-label": e.messages.treeChildren,
685
+ disabled: e.readonly,
686
+ placeholder: "children"
687
+ }, null, 8, ia), [
688
+ [X, l(b).childrenField]
689
+ ])
690
+ ])),
691
+ a("label", null, [
692
+ $(t(e.messages.treeLabel), 1),
693
+ F(a("select", {
694
+ "onUpdate:modelValue": c[12] || (c[12] = (n) => l(b).labelField = n),
695
+ "aria-label": e.messages.treeLabel,
696
+ disabled: e.readonly
697
+ }, [
698
+ (i(!0), s(C, null, M(e.list.columns.filter((n) => !n.hidden), (n) => (i(), s("option", {
699
+ key: n.field,
700
+ value: n.field
701
+ }, t(n.header), 9, da))), 128))
702
+ ], 8, sa), [
703
+ [O, l(b).labelField]
704
+ ])
705
+ ])
706
+ ]),
707
+ a("div", oa, [
708
+ a("label", null, [
709
+ $(t(e.messages.treeIndent), 1),
710
+ F(a("input", {
711
+ "onUpdate:modelValue": c[13] || (c[13] = (n) => l(b).indentMm = n),
712
+ "aria-label": e.messages.treeIndent,
713
+ type: "number",
714
+ min: "0",
715
+ max: "20",
716
+ step: "0.5",
717
+ disabled: e.readonly
718
+ }, null, 8, ua), [
719
+ [
720
+ X,
721
+ l(b).indentMm,
722
+ void 0,
723
+ { number: !0 }
724
+ ]
725
+ ])
726
+ ]),
727
+ l(b).input === "flat" ? (i(), s("label", ra, [
728
+ $(t(e.messages.treeOrphan), 1),
729
+ F(a("select", {
730
+ "onUpdate:modelValue": c[14] || (c[14] = (n) => l(b).orphan = n),
731
+ "aria-label": e.messages.treeOrphan,
732
+ disabled: e.readonly
733
+ }, [
734
+ a("option", ma, t(e.messages.error), 1),
735
+ a("option", va, t(e.messages.treeAsRoot), 1)
736
+ ], 8, ca), [
737
+ [O, l(b).orphan]
738
+ ])
739
+ ])) : N("", !0)
740
+ ]),
741
+ a("label", null, [
742
+ $(t(e.messages.treeValues), 1),
743
+ F(a("select", {
744
+ "onUpdate:modelValue": c[15] || (c[15] = (n) => l(b).parentValues = n),
745
+ "aria-label": e.messages.treeValues,
746
+ disabled: e.readonly
747
+ }, [
748
+ a("option", ga, t(e.messages.treeSource), 1),
749
+ a("option", fa, t(e.messages.treeLeaves), 1)
750
+ ], 8, ba), [
751
+ [O, l(b).parentValues]
752
+ ])
753
+ ]),
754
+ l(b).parentValues === "leaf-aggregate" ? (i(), s(C, { key: 0 }, [
755
+ (i(!0), s(C, null, M(l(b).aggregates, (n, v) => (i(), s("div", {
756
+ key: v,
757
+ class: "mr-data-layout__measure"
758
+ }, [
759
+ a("div", ya, [
760
+ a("label", null, [
761
+ $(t(e.messages.measure), 1),
762
+ F(a("select", {
763
+ "onUpdate:modelValue": (o) => n.field = o,
764
+ "aria-label": e.messages.measure,
765
+ disabled: e.readonly
766
+ }, [
767
+ (i(!0), s(C, null, M(l(y), (o) => (i(), s("option", {
768
+ key: o.field,
769
+ value: o.field
770
+ }, t(o.label), 9, ka))), 128))
771
+ ], 8, ha), [
772
+ [O, n.field]
773
+ ])
774
+ ]),
775
+ a("label", null, [
776
+ $(t(e.messages.aggregate), 1),
777
+ F(a("select", {
778
+ "onUpdate:modelValue": (o) => n.op = o,
779
+ "aria-label": e.messages.aggregate,
780
+ disabled: e.readonly
781
+ }, [
782
+ (i(!0), s(C, null, M(l(H).aggregates, (o) => (i(), s("option", {
783
+ key: o,
784
+ value: o
785
+ }, t(e.messages[o]), 9, Va))), 128))
786
+ ], 8, $a), [
787
+ [O, n.op]
788
+ ])
789
+ ])
790
+ ]),
791
+ n.op === "weightedAvg" ? (i(), s("label", wa, [
792
+ $(t(e.messages.weight), 1),
793
+ F(a("select", {
794
+ "onUpdate:modelValue": (o) => n.weightField = o,
795
+ "aria-label": e.messages.weight,
796
+ disabled: e.readonly
797
+ }, [
798
+ (i(!0), s(C, null, M(l(y), (o) => (i(), s("option", {
799
+ key: o.field,
800
+ value: o.field
801
+ }, t(o.label), 9, Ua))), 128))
802
+ ], 8, Ca), [
803
+ [O, n.weightField]
804
+ ])
805
+ ])) : N("", !0),
806
+ a("div", Fa, [
807
+ a("label", null, [
808
+ $(t(e.messages.numeric), 1),
809
+ F(a("select", {
810
+ "onUpdate:modelValue": (o) => n.numeric = o,
811
+ "aria-label": e.messages.numeric,
812
+ disabled: e.readonly
813
+ }, [
814
+ a("option", Ma, t(e.messages.number), 1),
815
+ a("option", xa, t(e.messages.decimal), 1)
816
+ ], 8, Sa), [
817
+ [O, n.numeric]
818
+ ])
819
+ ]),
820
+ a("label", null, [
821
+ $(t(e.messages.digits), 1),
822
+ F(a("input", {
823
+ "onUpdate:modelValue": (o) => n.digits = o,
824
+ "aria-label": e.messages.digits,
825
+ type: "number",
826
+ min: "0",
827
+ max: "100",
828
+ disabled: e.readonly
829
+ }, null, 8, Da), [
830
+ [
831
+ X,
832
+ n.digits,
833
+ void 0,
834
+ { number: !0 }
835
+ ]
836
+ ])
837
+ ])
838
+ ]),
839
+ a("button", {
840
+ type: "button",
841
+ disabled: e.readonly,
842
+ onClick: (o) => l(w).removeTreeAggregate(v)
843
+ }, t(e.messages.remove), 9, Na)
844
+ ]))), 128)),
845
+ a("button", {
846
+ type: "button",
847
+ disabled: e.readonly || (l(b).aggregates?.length ?? 0) >= 32,
848
+ onClick: c[16] || (c[16] = //@ts-ignore
849
+ (...n) => l(w).addTreeAggregate && l(w).addTreeAggregate(...n))
850
+ }, "+ " + t(e.messages.addAggregate), 9, Ra)
851
+ ], 64)) : N("", !0),
852
+ a("details", null, [
853
+ a("summary", null, t(e.messages.advanced), 1),
854
+ a("div", Ea, [
855
+ a("label", null, [
856
+ $(t(e.messages.treeRows), 1),
857
+ F(a("input", {
858
+ "onUpdate:modelValue": c[17] || (c[17] = (n) => l(b).maxRows = n),
859
+ "aria-label": e.messages.treeRows,
860
+ type: "number",
861
+ min: "1",
862
+ max: "1000000",
863
+ disabled: e.readonly
864
+ }, null, 8, Ta), [
865
+ [
866
+ X,
867
+ l(b).maxRows,
868
+ void 0,
869
+ { number: !0 }
870
+ ]
871
+ ])
872
+ ]),
873
+ a("label", null, [
874
+ $(t(e.messages.treeDepth), 1),
875
+ F(a("input", {
876
+ "onUpdate:modelValue": c[18] || (c[18] = (n) => l(b).maxDepth = n),
877
+ "aria-label": e.messages.treeDepth,
878
+ type: "number",
879
+ min: "1",
880
+ max: "256",
881
+ disabled: e.readonly
882
+ }, null, 8, Ka), [
883
+ [
884
+ X,
885
+ l(b).maxDepth,
886
+ void 0,
887
+ { number: !0 }
888
+ ]
889
+ ])
890
+ ])
891
+ ])
892
+ ]),
893
+ a("p", La, t(e.messages.treeReadonly), 1)
894
+ ], 64)) : l(U) ? (i(), s(C, { key: 2 }, [
895
+ a("p", Ba, t(e.messages.matrixHint), 1),
896
+ (i(), s(C, null, M(["rowFields", "columnFields"], (n) => a("fieldset", {
897
+ key: n,
898
+ class: "mr-data-layout__choices"
899
+ }, [
900
+ a("legend", null, t(e.messages[n]), 1),
901
+ (i(!0), s(C, null, M(l(y), (v) => (i(), s("label", {
902
+ key: v.field
903
+ }, [
904
+ a("input", {
905
+ type: "checkbox",
906
+ checked: l(d)[n].includes(v.field),
907
+ disabled: e.readonly,
908
+ onChange: (o) => l(w).toggleDimension(
909
+ n,
910
+ v.field,
911
+ o.target.checked
912
+ )
913
+ }, null, 40, Oa),
914
+ $(t(v.label), 1)
915
+ ]))), 128))
916
+ ])), 64)),
917
+ (i(!0), s(C, null, M(l(d).measures, (n, v) => (i(), s("div", {
918
+ key: v,
919
+ class: "mr-data-layout__measure"
920
+ }, [
921
+ a("div", Aa, [
922
+ a("label", null, [
923
+ $(t(e.messages.measure), 1),
924
+ F(a("select", {
925
+ "aria-label": e.messages.measure,
926
+ "onUpdate:modelValue": (o) => n.field = o,
927
+ disabled: e.readonly
928
+ }, [
929
+ (i(!0), s(C, null, M(l(y), (o) => (i(), s("option", {
930
+ key: o.field,
931
+ value: o.field
932
+ }, t(o.label), 9, Wa))), 128))
933
+ ], 8, Ia), [
934
+ [O, n.field]
935
+ ])
936
+ ]),
937
+ a("label", null, [
938
+ $(t(e.messages.aggregate), 1),
939
+ F(a("select", {
940
+ "aria-label": e.messages.aggregate,
941
+ "onUpdate:modelValue": (o) => n.op = o,
942
+ disabled: e.readonly
943
+ }, [
944
+ (i(!0), s(C, null, M(l(H).aggregates, (o) => (i(), s("option", {
945
+ key: o,
946
+ value: o
947
+ }, t(e.messages[o]), 9, Ja))), 128))
948
+ ], 8, Ga), [
949
+ [O, n.op]
950
+ ])
951
+ ])
952
+ ]),
953
+ a("label", null, [
954
+ $(t(e.messages.measureLabel), 1),
955
+ F(a("input", {
956
+ "aria-label": e.messages.measureLabel,
957
+ "onUpdate:modelValue": (o) => n.label = o,
958
+ disabled: e.readonly,
959
+ placeholder: n.field
960
+ }, null, 8, ja), [
961
+ [X, n.label]
962
+ ])
963
+ ]),
964
+ n.op === "weightedAvg" ? (i(), s("label", Ha, [
965
+ $(t(e.messages.weight), 1),
966
+ F(a("select", {
967
+ "aria-label": e.messages.weight,
968
+ "onUpdate:modelValue": (o) => n.weightField = o,
969
+ disabled: e.readonly
970
+ }, [
971
+ (i(!0), s(C, null, M(l(y), (o) => (i(), s("option", {
972
+ key: o.field,
973
+ value: o.field
974
+ }, t(o.label), 9, za))), 128))
975
+ ], 8, Pa), [
976
+ [O, n.weightField]
977
+ ])
978
+ ])) : N("", !0),
979
+ a("div", qa, [
980
+ a("label", null, [
981
+ $(t(e.messages.numeric), 1),
982
+ F(a("select", {
983
+ "aria-label": e.messages.numeric,
984
+ "onUpdate:modelValue": (o) => n.numeric = o,
985
+ disabled: e.readonly
986
+ }, [
987
+ a("option", Qa, t(e.messages.number), 1),
988
+ a("option", Xa, t(e.messages.decimal), 1)
989
+ ], 8, Za), [
990
+ [O, n.numeric]
991
+ ])
992
+ ]),
993
+ a("label", null, [
994
+ $(t(e.messages.digits), 1),
995
+ F(a("input", {
996
+ "aria-label": e.messages.digits,
997
+ "onUpdate:modelValue": (o) => n.digits = o,
998
+ type: "number",
999
+ min: "0",
1000
+ max: "100",
1001
+ disabled: e.readonly
1002
+ }, null, 8, Ya), [
1003
+ [
1004
+ X,
1005
+ n.digits,
1006
+ void 0,
1007
+ { number: !0 }
1008
+ ]
1009
+ ])
1010
+ ])
1011
+ ]),
1012
+ a("button", {
1013
+ type: "button",
1014
+ disabled: e.readonly,
1015
+ onClick: (o) => l(w).removeMeasure(v)
1016
+ }, t(e.messages.remove), 9, pa)
1017
+ ]))), 128)),
1018
+ a("button", {
1019
+ type: "button",
1020
+ disabled: e.readonly || l(d).measures.length >= 32,
1021
+ onClick: c[19] || (c[19] = //@ts-ignore
1022
+ (...n) => l(w).addMeasure && l(w).addMeasure(...n))
1023
+ }, " + " + t(e.messages.addAggregate), 9, _a),
1024
+ a("label", et, [
1025
+ F(a("input", {
1026
+ "onUpdate:modelValue": c[20] || (c[20] = (n) => l(d).totals = n),
1027
+ type: "checkbox",
1028
+ disabled: e.readonly
1029
+ }, null, 8, lt), [
1030
+ [re, l(d).totals]
1031
+ ]),
1032
+ $(t(e.messages.totals), 1)
1033
+ ]),
1034
+ a("details", null, [
1035
+ a("summary", null, t(e.messages.matrixHierarchy), 1),
1036
+ a("label", at, [
1037
+ a("input", {
1038
+ type: "checkbox",
1039
+ checked: !!l(d).hierarchy,
1040
+ disabled: e.readonly,
1041
+ onChange: c[21] || (c[21] = (n) => l(w).toggleHierarchy(n.target.checked))
1042
+ }, null, 40, tt),
1043
+ $(t(e.messages.enabled), 1)
1044
+ ]),
1045
+ l(d).hierarchy ? (i(), s(C, { key: 0 }, [
1046
+ a("p", nt, t(e.messages.matrixHierarchyHint), 1),
1047
+ a("label", null, [
1048
+ $(t(e.messages.matrixEmptyLabel), 1),
1049
+ F(a("input", {
1050
+ "onUpdate:modelValue": c[22] || (c[22] = (n) => l(d).hierarchy.emptyLabel = n),
1051
+ "aria-label": e.messages.matrixEmptyLabel,
1052
+ disabled: e.readonly,
1053
+ placeholder: "(空)"
1054
+ }, null, 8, it), [
1055
+ [X, l(d).hierarchy.emptyLabel]
1056
+ ])
1057
+ ]),
1058
+ (i(), s(C, null, M(["row", "column"], (n) => a("fieldset", {
1059
+ key: n,
1060
+ class: "mr-data-layout__choices"
1061
+ }, [
1062
+ a("legend", null, t(n === "row" ? e.messages.rowFields : e.messages.columnFields), 1),
1063
+ (i(!0), s(C, null, M(l(d)[n === "row" ? "rowFields" : "columnFields"], (v, o) => (i(), s("div", {
1064
+ key: v,
1065
+ class: "mr-data-layout__pair"
1066
+ }, [
1067
+ a("label", null, [
1068
+ $(t(v), 1),
1069
+ a("select", {
1070
+ "aria-label": `${v} · ${e.messages.matrixSort}`,
1071
+ value: l(d).hierarchy[n]?.sort?.[o] ?? "source",
1072
+ disabled: e.readonly,
1073
+ onChange: (h) => l(w).setDimensionSort(n, o, h.target.value)
1074
+ }, [
1075
+ a("option", dt, t(e.messages.matrixSourceOrder), 1),
1076
+ a("option", ot, t(e.messages.matrixAscending), 1),
1077
+ a("option", ut, t(e.messages.matrixDescending), 1)
1078
+ ], 40, st)
1079
+ ]),
1080
+ a("div", null, [
1081
+ a("button", {
1082
+ type: "button",
1083
+ "aria-label": `${v} · ${e.messages.moveUp}`,
1084
+ disabled: e.readonly || o === 0,
1085
+ onClick: (h) => l(w).moveDimension(n === "row" ? "rowFields" : "columnFields", o, -1)
1086
+ }, "↑", 8, rt),
1087
+ a("button", {
1088
+ type: "button",
1089
+ "aria-label": `${v} · ${e.messages.moveDown}`,
1090
+ disabled: e.readonly || o === l(d)[n === "row" ? "rowFields" : "columnFields"].length - 1,
1091
+ onClick: (h) => l(w).moveDimension(n === "row" ? "rowFields" : "columnFields", o, 1)
1092
+ }, "↓", 8, ct)
1093
+ ]),
1094
+ o < l(d)[n === "row" ? "rowFields" : "columnFields"].length - 1 ? (i(), s("label", mt, [
1095
+ a("input", {
1096
+ type: "checkbox",
1097
+ checked: l(d).hierarchy[n]?.subtotals?.includes(o + 1) ?? !1,
1098
+ disabled: e.readonly,
1099
+ onChange: (h) => l(w).toggleMatrixSubtotal(n, o + 1, h.target.checked)
1100
+ }, null, 40, vt),
1101
+ $(t(e.messages.matrixPrefixSubtotal), 1)
1102
+ ])) : N("", !0)
1103
+ ]))), 128))
1104
+ ])), 64))
1105
+ ], 64)) : N("", !0)
1106
+ ]),
1107
+ a("details", null, [
1108
+ a("summary", null, t(e.messages.widthSettings), 1),
1109
+ a("div", bt, [
1110
+ a("label", null, [
1111
+ $(t(e.messages.dimensionWidth), 1),
1112
+ F(a("input", {
1113
+ "onUpdate:modelValue": c[23] || (c[23] = (n) => l(d).rowWidthMm = n),
1114
+ type: "number",
1115
+ min: "1",
1116
+ disabled: e.readonly,
1117
+ placeholder: "40"
1118
+ }, null, 8, gt), [
1119
+ [
1120
+ X,
1121
+ l(d).rowWidthMm,
1122
+ void 0,
1123
+ { number: !0 }
1124
+ ]
1125
+ ])
1126
+ ]),
1127
+ a("label", null, [
1128
+ $(t(e.messages.measureWidth), 1),
1129
+ F(a("input", {
1130
+ "onUpdate:modelValue": c[24] || (c[24] = (n) => l(d).columnWidthMm = n),
1131
+ type: "number",
1132
+ min: "1",
1133
+ disabled: e.readonly,
1134
+ placeholder: "28"
1135
+ }, null, 8, ft), [
1136
+ [
1137
+ X,
1138
+ l(d).columnWidthMm,
1139
+ void 0,
1140
+ { number: !0 }
1141
+ ]
1142
+ ])
1143
+ ])
1144
+ ])
1145
+ ])
1146
+ ], 64)) : N("", !0),
1147
+ a("div", yt, [
1148
+ l(U) && e.mode === "matrix" ? (i(), s("button", {
1149
+ key: 0,
1150
+ type: "button",
1151
+ disabled: e.readonly,
1152
+ onClick: c[25] || (c[25] = //@ts-ignore
1153
+ (...n) => l(w).checkMatrix && l(w).checkMatrix(...n))
1154
+ }, t(e.messages.check), 9, ht)) : N("", !0),
1155
+ l(U) && e.mode === "tree" ? (i(), s("button", {
1156
+ key: 1,
1157
+ type: "button",
1158
+ disabled: e.readonly,
1159
+ onClick: c[26] || (c[26] = //@ts-ignore
1160
+ (...n) => l(w).checkTree && l(w).checkTree(...n))
1161
+ }, t(e.messages.check), 9, kt)) : N("", !0),
1162
+ a("button", {
1163
+ type: "button",
1164
+ class: "mr-data-layout__primary",
1165
+ disabled: e.readonly,
1166
+ onClick: c[27] || (c[27] = //@ts-ignore
1167
+ (...n) => l(w).apply && l(w).apply(...n))
1168
+ }, t(e.messages.apply), 9, $t)
1169
+ ]),
1170
+ l(K) ? (i(), s("div", Vt, [
1171
+ a("p", null, t(e.messages.sample), 1),
1172
+ a("table", null, [
1173
+ a("thead", null, [
1174
+ a("tr", null, [
1175
+ (i(!0), s(C, null, M(l(K).columns, (n, v) => (i(), s("th", { key: v }, t(n), 1))), 128))
1176
+ ])
1177
+ ]),
1178
+ a("tbody", null, [
1179
+ (i(!0), s(C, null, M(l(K).rows, (n, v) => (i(), s("tr", { key: v }, [
1180
+ (i(!0), s(C, null, M(n, (o, h) => (i(), s("td", { key: h }, t(o ?? "—"), 1))), 128))
1181
+ ]))), 128))
1182
+ ])
1183
+ ])
1184
+ ])) : N("", !0),
1185
+ l(x) ? (i(), s("p", wt, t(l(x)), 1)) : N("", !0)
1186
+ ]));
1187
+ }
1188
+ }), Ut = /* @__PURE__ */ ge(Ct, [["__scopeId", "data-v-61513558"]]), Ft = { class: "mr-expression__row" }, St = ["value", "disabled", "aria-label"], Mt = { value: "field" }, xt = { value: "constant" }, Dt = {
1189
+ key: 0,
1190
+ value: "operation"
1191
+ }, Nt = { value: "aggregate" }, Rt = ["value", "disabled", "aria-label"], Et = ["value"], Tt = ["value", "disabled", "aria-label"], Kt = ["value"], Lt = ["value", "disabled", "aria-label"], Bt = ["value"], Ot = ["value", "disabled", "aria-label"], At = { value: "text" }, It = { value: "number" }, Wt = { value: "boolean" }, Gt = { value: "null" }, Jt = ["value", "disabled", "aria-label"], jt = {
1192
+ key: 0,
1193
+ value: ""
1194
+ }, Ht = ["value"], Pt = ["value", "disabled", "aria-label"], zt = {
1195
+ value: "",
1196
+ disabled: ""
1197
+ }, qt = ["value"], Zt = ["value", "disabled", "aria-label"], Qt = { value: "true" }, Xt = { value: "false" }, Yt = ["type", "value", "disabled", "aria-label"], pt = { class: "mr-expression__help" }, _t = ["disabled", "aria-label", "onClick"], en = ["disabled"], ln = /* @__PURE__ */ be({
1198
+ __name: "ReportExpressionEditor",
1199
+ props: {
1200
+ modelValue: {},
1201
+ fields: {},
1202
+ messages: {},
1203
+ readonly: { type: Boolean },
1204
+ depth: {}
1205
+ },
1206
+ emits: ["update:modelValue"],
1207
+ setup(e, { emit: W }) {
1208
+ const V = e, j = W, w = ye(), U = z(() => "op" in V.modelValue ? w.functions.find((c) => c.name === V.modelValue.op) : void 0), r = z(
1209
+ () => "aggregate" in V.modelValue ? "aggregate" : "field" in V.modelValue ? "field" : "value" in V.modelValue ? "constant" : "operation"
1210
+ ), d = G("text");
1211
+ te(
1212
+ () => V.modelValue,
1213
+ (c) => {
1214
+ "value" in c && (d.value = c.value === null ? "null" : typeof c.value == "string" ? "text" : typeof c.value);
1215
+ },
1216
+ { immediate: !0 }
1217
+ );
1218
+ function b(c) {
1219
+ V.readonly || j("update:modelValue", c);
1220
+ }
1221
+ function T(c) {
1222
+ b(c === "aggregate" ? { aggregate: "sum", field: V.fields[0]?.field ?? "" } : c === "field" ? { field: V.fields[0]?.field ?? "" } : c === "constant" ? { value: "" } : {
1223
+ op: "add",
1224
+ args: [{ field: V.fields[0]?.field ?? "" }, { value: 0 }]
1225
+ });
1226
+ }
1227
+ function y(c) {
1228
+ const n = c, v = "args" in V.modelValue ? V.modelValue.args : [{ value: 0 }, { value: 0 }], o = w.functions.find((A) => A.name === n), h = [...v.slice(0, o.maxArgs)];
1229
+ for (; h.length < o.minArgs; ) h.push({ value: 0 });
1230
+ b({ op: n, args: h, ...n === "if" ? { condition: "args" in V.modelValue && V.modelValue.condition ? V.modelValue.condition : { field: V.fields[0]?.field ?? "", op: ">", value: 0 } } : {} });
1231
+ }
1232
+ function L(c, n) {
1233
+ "args" in V.modelValue && b({
1234
+ ...V.modelValue,
1235
+ args: V.modelValue.args.map(
1236
+ (v, o) => o === c ? n : v
1237
+ )
1238
+ });
1239
+ }
1240
+ function x(c) {
1241
+ if (!("args" in V.modelValue)) return;
1242
+ const n = c === void 0 ? [...V.modelValue.args, { value: 0 }] : V.modelValue.args.filter((v, o) => o !== c);
1243
+ b({ ...V.modelValue, args: n });
1244
+ }
1245
+ function K(c) {
1246
+ d.value = c, b({
1247
+ value: c === "null" ? null : c === "boolean" ? !1 : c === "number" ? 0 : ""
1248
+ });
1249
+ }
1250
+ function H(c) {
1251
+ d.value === "number" ? c.trim() && Number.isFinite(Number(c)) && b({ value: Number(c) }) : b({ value: c });
1252
+ }
1253
+ function J(c, n) {
1254
+ if (!("aggregate" in V.modelValue)) return;
1255
+ const v = { ...V.modelValue, [c]: n };
1256
+ c === "aggregate" && (v.aggregate = n), c === "field" && !n && delete v.field, b(v);
1257
+ }
1258
+ return (c, n) => {
1259
+ const v = ke("ReportExpressionEditor", !0);
1260
+ return i(), s("div", {
1261
+ class: fe(["mr-expression", { "mr-expression--nested": (e.depth ?? 0) > 0 }])
1262
+ }, [
1263
+ a("div", Ft, [
1264
+ a("select", {
1265
+ value: r.value,
1266
+ disabled: e.readonly,
1267
+ "aria-label": e.messages.argument,
1268
+ onChange: n[0] || (n[0] = (o) => T(o.target.value))
1269
+ }, [
1270
+ a("option", Mt, t(e.messages.field), 1),
1271
+ a("option", xt, t(e.messages.constant), 1),
1272
+ (e.depth ?? 0) < 12 ? (i(), s("option", Dt, t(e.messages.operation), 1)) : N("", !0),
1273
+ a("option", Nt, t(e.messages.aggregate), 1)
1274
+ ], 40, St),
1275
+ "field" in e.modelValue && !("aggregate" in e.modelValue) ? (i(), s("select", {
1276
+ key: 0,
1277
+ value: e.modelValue.field,
1278
+ disabled: e.readonly,
1279
+ "aria-label": e.messages.field,
1280
+ onChange: n[1] || (n[1] = (o) => b({ field: o.target.value }))
1281
+ }, [
1282
+ (i(!0), s(C, null, M(e.fields, (o) => (i(), s("option", {
1283
+ key: o.field,
1284
+ value: o.field
1285
+ }, t(o.label), 9, Et))), 128))
1286
+ ], 40, Rt)) : "op" in e.modelValue ? (i(), s("select", {
1287
+ key: 1,
1288
+ value: e.modelValue.op,
1289
+ disabled: e.readonly,
1290
+ "aria-label": e.messages.operation,
1291
+ onChange: n[2] || (n[2] = (o) => y(o.target.value))
1292
+ }, [
1293
+ (i(!0), s(C, null, M(l(w).operations, (o) => (i(), s("option", {
1294
+ key: o,
1295
+ value: o
1296
+ }, t(e.messages[o]), 9, Kt))), 128))
1297
+ ], 40, Tt)) : "aggregate" in e.modelValue ? (i(), s("select", {
1298
+ key: 2,
1299
+ value: e.modelValue.aggregate,
1300
+ disabled: e.readonly,
1301
+ "aria-label": e.messages.aggregate,
1302
+ onChange: n[3] || (n[3] = (o) => J("aggregate", o.target.value))
1303
+ }, [
1304
+ (i(!0), s(C, null, M(l(w).aggregates, (o) => (i(), s("option", {
1305
+ key: o,
1306
+ value: o
1307
+ }, t(e.messages[o]), 9, Bt))), 128))
1308
+ ], 40, Lt)) : (i(), s("select", {
1309
+ key: 3,
1310
+ value: d.value,
1311
+ disabled: e.readonly,
1312
+ "aria-label": e.messages.resultType,
1313
+ onChange: n[4] || (n[4] = (o) => K(o.target.value))
1314
+ }, [
1315
+ a("option", At, t(e.messages.text), 1),
1316
+ a("option", It, t(e.messages.number), 1),
1317
+ a("option", Wt, t(e.messages.boolean), 1),
1318
+ a("option", Gt, t(e.messages.null), 1)
1319
+ ], 40, Ot))
1320
+ ]),
1321
+ "aggregate" in e.modelValue ? (i(), s(C, { key: 0 }, [
1322
+ a("select", {
1323
+ value: e.modelValue.field ?? "",
1324
+ disabled: e.readonly,
1325
+ "aria-label": e.messages.measure,
1326
+ onChange: n[5] || (n[5] = (o) => J("field", o.target.value))
1327
+ }, [
1328
+ e.modelValue.aggregate === "count" ? (i(), s("option", jt, t(e.messages.allRows), 1)) : N("", !0),
1329
+ (i(!0), s(C, null, M(e.fields, (o) => (i(), s("option", {
1330
+ key: o.field,
1331
+ value: o.field
1332
+ }, t(o.label), 9, Ht))), 128))
1333
+ ], 40, Jt),
1334
+ e.modelValue.aggregate === "weightedAvg" ? (i(), s("select", {
1335
+ key: 0,
1336
+ value: e.modelValue.weightField ?? "",
1337
+ disabled: e.readonly,
1338
+ "aria-label": e.messages.weight,
1339
+ onChange: n[6] || (n[6] = (o) => J(
1340
+ "weightField",
1341
+ o.target.value
1342
+ ))
1343
+ }, [
1344
+ a("option", zt, t(e.messages.weight), 1),
1345
+ (i(!0), s(C, null, M(e.fields, (o) => (i(), s("option", {
1346
+ key: o.field,
1347
+ value: o.field
1348
+ }, t(o.label), 9, qt))), 128))
1349
+ ], 40, Pt)) : N("", !0)
1350
+ ], 64)) : "value" in e.modelValue ? (i(), s(C, { key: 1 }, [
1351
+ d.value === "boolean" ? (i(), s("select", {
1352
+ key: 0,
1353
+ value: String(e.modelValue.value),
1354
+ disabled: e.readonly,
1355
+ "aria-label": e.messages.constant,
1356
+ onChange: n[7] || (n[7] = (o) => b({
1357
+ value: o.target.value === "true"
1358
+ }))
1359
+ }, [
1360
+ a("option", Qt, t(e.messages.true), 1),
1361
+ a("option", Xt, t(e.messages.false), 1)
1362
+ ], 40, Zt)) : d.value !== "null" ? (i(), s("input", {
1363
+ key: 1,
1364
+ type: d.value === "number" ? "number" : "text",
1365
+ value: e.modelValue.value ?? "",
1366
+ disabled: e.readonly,
1367
+ "aria-label": e.messages.constant,
1368
+ onInput: n[8] || (n[8] = (o) => H(o.target.value))
1369
+ }, null, 40, Yt)) : N("", !0)
1370
+ ], 64)) : "args" in e.modelValue ? (i(), s(C, { key: 2 }, [
1371
+ e.modelValue.op === "if" && e.modelValue.condition ? (i(), $e(Fe, {
1372
+ key: 0,
1373
+ "model-value": e.modelValue.condition,
1374
+ fields: e.fields,
1375
+ messages: e.messages,
1376
+ readonly: e.readonly,
1377
+ "onUpdate:modelValue": n[9] || (n[9] = (o) => b({ ...e.modelValue, condition: o }))
1378
+ }, null, 8, ["model-value", "fields", "messages", "readonly"])) : N("", !0),
1379
+ a("small", pt, t(U.value?.example), 1),
1380
+ (i(!0), s(C, null, M(e.modelValue.args, (o, h) => (i(), s("div", {
1381
+ key: h,
1382
+ class: "mr-expression__argument"
1383
+ }, [
1384
+ ve(v, {
1385
+ "model-value": o,
1386
+ fields: e.fields,
1387
+ messages: e.messages,
1388
+ readonly: e.readonly,
1389
+ depth: (e.depth ?? 0) + 1,
1390
+ "onUpdate:modelValue": (A) => L(h, A)
1391
+ }, null, 8, ["model-value", "fields", "messages", "readonly", "depth", "onUpdate:modelValue"]),
1392
+ e.modelValue.args.length > (U.value?.minArgs ?? 2) ? (i(), s("button", {
1393
+ key: 0,
1394
+ type: "button",
1395
+ disabled: e.readonly,
1396
+ "aria-label": `${e.messages.remove} ${e.messages.argument} ${h + 1}`,
1397
+ onClick: (A) => x(h)
1398
+ }, " × ", 8, _t)) : N("", !0)
1399
+ ]))), 128)),
1400
+ e.modelValue.args.length < Math.min(16, U.value?.maxArgs ?? 16) ? (i(), s("button", {
1401
+ key: 1,
1402
+ type: "button",
1403
+ disabled: e.readonly,
1404
+ onClick: n[10] || (n[10] = (o) => x())
1405
+ }, " + " + t(e.messages.addArgument), 9, en)) : N("", !0)
1406
+ ], 64)) : N("", !0)
1407
+ ], 2);
1408
+ };
1409
+ }
1410
+ }), an = /* @__PURE__ */ ge(ln, [["__scopeId", "data-v-e610e9c4"]]), Z = (e) => JSON.parse(JSON.stringify(e));
1411
+ function tn(e, W) {
1412
+ const V = z(() => ({
1413
+ ...Le,
1414
+ ...e.messages
1415
+ })), j = G("computations"), w = G(""), U = G(""), r = G({
1416
+ field: "",
1417
+ expression: { field: "" },
1418
+ scope: "row"
1419
+ }), d = G([]), b = G(0), T = G(""), y = G(-1), L = G("style"), x = G({ field: "", op: ">", value: 0 }), K = G(null), H = z(() => K.value ?? x.value), J = G({
1420
+ color: "#b91c1c",
1421
+ backgroundColor: "#fff1f2",
1422
+ bold: !1
1423
+ }), c = G([]), n = me(() => r.value), v = me(() => d.value), o = me(() => ({ when: x.value, composedWhen: K.value, style: J.value })), h = G(/* @__PURE__ */ new Map()), A = G(/* @__PURE__ */ new Map());
1424
+ let Q = "", p = !1;
1425
+ const ee = z(() => n.pending.value || v.pending.value || o.pending.value || h.value.size > 0 || A.value.size > 0);
1426
+ let le;
1427
+ const ne = z(() => {
1428
+ const g = /* @__PURE__ */ new Map();
1429
+ for (const f of e.datasetSchema?.fields ?? [])
1430
+ g.set(f.field, f.label ?? f.field);
1431
+ for (const f of e.list.columns)
1432
+ g.has(f.field) || g.set(f.field, f.header || f.field);
1433
+ for (const f of Object.keys(
1434
+ e.datasets?.[e.list.dataset]?.[0] ?? {}
1435
+ ))
1436
+ g.has(f) || g.set(f, f);
1437
+ return [...g].map(([f, B]) => ({ field: f, label: B }));
1438
+ }), _ = z(() => d.value[b.value]), ie = z(
1439
+ () => e.list.columns.find((g) => g.field === T.value)
1440
+ ), de = z(() => We(S()));
1441
+ function se() {
1442
+ if (le === JSON.stringify(e.list)) {
1443
+ le = void 0;
1444
+ return;
1445
+ }
1446
+ p = !0, h.value = /* @__PURE__ */ new Map(), A.value = /* @__PURE__ */ new Map(), d.value = Z(
1447
+ e.list.groups ?? (e.list.groupBy ? [e.list.groupBy] : [])
1448
+ );
1449
+ for (const g of d.value) for (const f of g.aggregates ?? []) f.numeric ??= "number";
1450
+ e.list.columns.some((g) => g.field === T.value) || (T.value = e.list.columns[0]?.field ?? ""), w.value = "", c.value = [], m(U.value), he(-1), v.accept(), p = !1;
1451
+ }
1452
+ te(() => e.list, se, { immediate: !0 }), te(r, () => {
1453
+ c.value = [];
1454
+ }, { deep: !0 }), te(() => e.datasets, () => {
1455
+ c.value = [];
1456
+ }, { deep: !0 });
1457
+ function m(g) {
1458
+ !p && n.pending.value && (h.value = new Map(h.value).set(U.value, Z(r.value))), U.value = g, r.value = Z(
1459
+ e.list.computed?.find((B) => B.field === g) ?? {
1460
+ field: "",
1461
+ expression: { field: ne.value[0]?.field ?? "" },
1462
+ scope: "row"
1463
+ }
1464
+ ), r.value.numeric ??= "number", c.value = [], w.value = "", n.accept();
1465
+ const f = h.value.get(g);
1466
+ if (f) {
1467
+ r.value = Z(f);
1468
+ const B = new Map(h.value);
1469
+ B.delete(g), h.value = B;
1470
+ }
1471
+ }
1472
+ function S() {
1473
+ return [
1474
+ ...(e.list.computed ?? []).filter((f) => f.field !== U.value),
1475
+ Z(r.value)
1476
+ ];
1477
+ }
1478
+ function R(g) {
1479
+ if (e.readonly) return !1;
1480
+ const f = we({
1481
+ pages: [
1482
+ {
1483
+ widthMm: Math.max(1, g.leftMm + g.widthMm),
1484
+ heightMm: 297,
1485
+ components: [g]
1486
+ }
1487
+ ]
1488
+ });
1489
+ return f.ok ? (w.value = "", le = JSON.stringify(g), W(g), !0) : (w.value = f.errors.map((B) => B.message).slice(0, 3).join(";"), !1);
1490
+ }
1491
+ function D() {
1492
+ if (!r.value.field.trim()) {
1493
+ w.value = V.value.missingTarget;
1494
+ return;
1495
+ }
1496
+ const g = Z(e.list);
1497
+ if (g.computed = S(), g.columns.some((f) => f.field === r.value.field) || g.columns.push({
1498
+ field: r.value.field,
1499
+ header: r.value.field,
1500
+ widthMm: 30,
1501
+ semanticRole: "measure",
1502
+ align: "right",
1503
+ editable: !1,
1504
+ format: {
1505
+ kind: "number",
1506
+ ...r.value.digits === void 0 ? {} : { digits: r.value.digits }
1507
+ }
1508
+ }), R(g)) {
1509
+ const f = new Map(h.value);
1510
+ f.delete(U.value), f.delete(r.value.field), h.value = f, U.value = r.value.field, n.accept();
1511
+ }
1512
+ }
1513
+ function E() {
1514
+ if (!U.value) return;
1515
+ const g = Z(e.list);
1516
+ if (g.computed = (g.computed ?? []).filter(
1517
+ (f) => f.field !== U.value
1518
+ ), R(g)) {
1519
+ const f = new Map(h.value);
1520
+ f.delete(U.value), h.value = f, n.accept(), m("");
1521
+ }
1522
+ }
1523
+ function ae() {
1524
+ c.value = [], w.value = "";
1525
+ const g = e.datasets?.[e.list.dataset];
1526
+ if (!g?.length) {
1527
+ w.value = V.value.noData;
1528
+ return;
1529
+ }
1530
+ try {
1531
+ const f = Ge(g.slice(0, 1e3), {
1532
+ fields: S(),
1533
+ maxRows: 1e3,
1534
+ maxCells: 2e6
1535
+ });
1536
+ c.value = f.rows.slice(0, 5).map((B, Y) => ({
1537
+ row: Y + 1,
1538
+ value: B[r.value.field]
1539
+ }));
1540
+ } catch (f) {
1541
+ w.value = f instanceof Error ? f.message : String(f);
1542
+ }
1543
+ }
1544
+ function P(g) {
1545
+ r.value.expression = g;
1546
+ }
1547
+ function k(g, f) {
1548
+ r.value.groupBy = f ? [...r.value.groupBy ?? [], g] : (r.value.groupBy ?? []).filter((B) => B !== g);
1549
+ }
1550
+ function u() {
1551
+ d.value.push({
1552
+ field: ne.value[0]?.field ?? "",
1553
+ headerTemplate: "{value}",
1554
+ subtotalLabel: V.value.subtotalLabel,
1555
+ aggregates: [],
1556
+ keepWithNext: !0
1557
+ }), b.value = d.value.length - 1;
1558
+ }
1559
+ function q(g) {
1560
+ const f = b.value, B = f + g;
1561
+ B < 0 || B >= d.value.length || ([d.value[f], d.value[B]] = [
1562
+ d.value[B],
1563
+ d.value[f]
1564
+ ], b.value = B);
1565
+ }
1566
+ function I() {
1567
+ d.value.splice(b.value, 1), b.value = Math.max(
1568
+ 0,
1569
+ Math.min(b.value, d.value.length - 1)
1570
+ );
1571
+ }
1572
+ function Se() {
1573
+ _.value && (_.value.aggregates ??= []).push({
1574
+ field: ne.value[0]?.field ?? "",
1575
+ op: "sum",
1576
+ numeric: "number"
1577
+ });
1578
+ }
1579
+ function Me() {
1580
+ const g = Z(e.list);
1581
+ g.groups = Z(d.value), delete g.groupBy, R(g) && v.accept();
1582
+ }
1583
+ function xe(g) {
1584
+ K.value = g && !("field" in g) ? Z(g) : null, x.value = Z(g && "field" in g ? g : { field: T.value, op: ">", value: 0 });
1585
+ }
1586
+ function he(g) {
1587
+ !p && o.pending.value && (A.value = new Map(A.value).set(Q, { when: Z(x.value), composedWhen: Z(K.value), style: { ...J.value } })), Q = `${T.value}|${L.value}|${g}`, y.value = g;
1588
+ const f = L.value === "cell" ? ie.value?.visibleWhen : L.value === "rowVisibility" ? e.list.rowVisibleWhen : ie.value?.rules?.[g]?.when;
1589
+ xe(f);
1590
+ const B = ie.value?.rules?.[g]?.style;
1591
+ J.value = {
1592
+ color: String(B?.color ?? "#b91c1c"),
1593
+ backgroundColor: String(B?.backgroundColor ?? "#fff1f2"),
1594
+ bold: B?.bold === !0
1595
+ }, o.accept();
1596
+ const Y = A.value.get(Q);
1597
+ if (Y) {
1598
+ x.value = Z(Y.when), K.value = Z(Y.composedWhen), J.value = { ...Y.style };
1599
+ const ue = new Map(A.value);
1600
+ ue.delete(Q), A.value = ue;
1601
+ }
1602
+ }
1603
+ function De(g) {
1604
+ const f = e.datasetSchema?.fields.find(
1605
+ (ue) => ue.field === x.value.field
1606
+ ), B = e.datasets?.[e.list.dataset]?.find(
1607
+ (ue) => ue[x.value.field] != null
1608
+ )?.[x.value.field], Y = f?.type === "number" || !f && typeof B == "number";
1609
+ f?.type === "decimal" ? x.value.numeric = "decimal" : Y ? x.value.numeric = "number" : delete x.value.numeric, x.value.value = Y && g.trim() && Number.isFinite(Number(g)) ? Number(g) : g;
1610
+ }
1611
+ function Ne(g = !1) {
1612
+ const f = Z(e.list), B = f.columns.find((Y) => Y.field === T.value);
1613
+ if (!B) {
1614
+ w.value = V.value.noSelection;
1615
+ return;
1616
+ }
1617
+ if (L.value === "rowVisibility")
1618
+ g ? delete f.rowVisibleWhen : f.rowVisibleWhen = Z(H.value);
1619
+ else if (L.value === "cell")
1620
+ g ? delete B.visibleWhen : B.visibleWhen = Z(H.value);
1621
+ else if (B.rules ??= [], g && y.value >= 0)
1622
+ B.rules.splice(y.value, 1);
1623
+ else {
1624
+ if (g) return;
1625
+ y.value < 0 ? B.rules.push({
1626
+ when: Z(H.value),
1627
+ style: { ...J.value }
1628
+ }) : B.rules[y.value] = {
1629
+ when: Z(H.value),
1630
+ style: { ...J.value }
1631
+ };
1632
+ }
1633
+ if (R(f)) {
1634
+ const Y = new Map(A.value);
1635
+ Y.delete(Q), A.value = Y, o.accept();
1636
+ }
1637
+ }
1638
+ Ve({ key: () => e.recoveryKey ?? "rules:0:0", baseline: () => JSON.stringify(e.list), pending: () => ee.value, reset: () => {
1639
+ le = void 0, se();
1640
+ }, snapshot: () => JSON.stringify(Re()), restore(g) {
1641
+ const f = JSON.parse(g);
1642
+ r.value = f.formula, d.value = f.groups, x.value = f.when, K.value = f.composedWhen, J.value = f.style, U.value = f.selectedComputed, T.value = f.column, y.value = f.conditionIndex, Q = f.conditionKey, L.value = f.effect, j.value = f.tab, h.value = new Map(f.computedDrafts), A.value = new Map(f.conditionDrafts), n.baseline.value = f.formulaBaseline, v.baseline.value = f.groupBaseline, o.baseline.value = f.conditionBaseline;
1643
+ } });
1644
+ function Re() {
1645
+ return { formula: r.value, groups: d.value, when: x.value, composedWhen: K.value, style: J.value, selectedComputed: U.value, column: T.value, conditionIndex: y.value, conditionKey: Q, effect: L.value, tab: j.value, computedDrafts: [...h.value], conditionDrafts: [...A.value], formulaBaseline: n.baseline.value, groupBaseline: v.baseline.value, conditionBaseline: o.baseline.value };
1646
+ }
1647
+ return {
1648
+ m: V,
1649
+ pendingLocalChanges: ee,
1650
+ draftSnapshot: () => JSON.stringify({ formula: r.value, groups: d.value, when: x.value, composedWhen: K.value, style: J.value, computedDrafts: [...h.value], conditionDrafts: [...A.value] }),
1651
+ tab: j,
1652
+ fields: ne,
1653
+ formula: r,
1654
+ groups: d,
1655
+ groupIndex: b,
1656
+ currentGroup: _,
1657
+ column: T,
1658
+ currentColumn: ie,
1659
+ conditionIndex: y,
1660
+ effect: L,
1661
+ when: x,
1662
+ condition: H,
1663
+ setCondition(g) {
1664
+ "field" in g ? (x.value = g, K.value = null) : K.value = g;
1665
+ },
1666
+ style: J,
1667
+ error: w,
1668
+ preview: c,
1669
+ diagnostics: de,
1670
+ selectedComputed: U,
1671
+ loadComputed: m,
1672
+ applyComputed: D,
1673
+ removeComputed: E,
1674
+ check: ae,
1675
+ setExpression: P,
1676
+ toggleGroupField: k,
1677
+ addGroup: u,
1678
+ moveGroup: q,
1679
+ removeGroup: I,
1680
+ addAggregate: Se,
1681
+ applyGroups: Me,
1682
+ loadCondition: he,
1683
+ setThreshold: De,
1684
+ applyCondition: Ne,
1685
+ applyLayout: R,
1686
+ resetDraft: () => {
1687
+ le = void 0, se();
1688
+ }
1689
+ };
1690
+ }
1691
+ const nn = ["aria-label"], sn = { class: "mr-rule-editor__directory" }, dn = ["aria-label"], on = ["aria-selected", "onClick"], un = { key: 0 }, rn = { key: 1 }, cn = { class: "mr-rule-editor__catalog" }, mn = ["disabled"], vn = ["aria-label"], bn = { class: "mr-rule-editor__field-list" }, gn = ["disabled", "title", "onClick"], fn = { key: 1 }, yn = {
1692
+ key: 0,
1693
+ class: "mr-rule-editor__panel"
1694
+ }, hn = ["aria-label", "value", "disabled"], kn = { value: "" }, $n = ["value"], Vn = ["aria-label", "disabled"], wn = { class: "mr-rule-editor__pair" }, Cn = ["aria-label", "disabled"], Un = ["value"], Fn = ["aria-label", "disabled"], Sn = { value: "number" }, Mn = { value: "decimal" }, xn = {
1695
+ key: 0,
1696
+ class: "mr-rule-editor__checks"
1697
+ }, Dn = ["checked", "disabled", "onChange"], Nn = {
1698
+ key: 2,
1699
+ class: "mr-rule-editor__hint"
1700
+ }, Rn = { class: "mr-rule-editor__advanced" }, En = ["aria-label", "disabled"], Tn = ["aria-label", "disabled"], Kn = { value: "propagate" }, Ln = { value: "error" }, Bn = ["aria-label", "disabled"], On = { value: "error" }, An = { value: "null" }, In = {
1701
+ key: 3,
1702
+ class: "mr-rule-editor__hint"
1703
+ }, Wn = {
1704
+ key: 4,
1705
+ class: "mr-rule-editor__diagnostic"
1706
+ }, Gn = { class: "mr-rule-editor__actions" }, Jn = ["disabled"], jn = ["disabled"], Hn = ["disabled"], Pn = {
1707
+ key: 5,
1708
+ class: "mr-rule-editor__error"
1709
+ }, zn = {
1710
+ key: 1,
1711
+ class: "mr-rule-editor__panel"
1712
+ }, qn = { class: "mr-rule-editor__pair" }, Zn = ["aria-label"], Qn = ["value"], Xn = {
1713
+ key: 0,
1714
+ value: 0
1715
+ }, Yn = ["disabled"], pn = ["aria-label", "disabled"], _n = ["value"], ei = { class: "mr-rule-editor__pair" }, li = ["aria-label", "disabled"], ai = ["aria-label", "disabled"], ti = { class: "mr-rule-editor__checks" }, ni = ["disabled"], ii = ["disabled"], si = { class: "mr-rule-editor__pair" }, di = ["aria-label", "onUpdate:modelValue", "disabled"], oi = ["value"], ui = ["aria-label", "onUpdate:modelValue", "disabled"], ri = ["value"], ci = ["aria-label", "onUpdate:modelValue", "disabled"], mi = { value: void 0 }, vi = ["value"], bi = { key: 0 }, gi = ["aria-label", "onUpdate:modelValue", "disabled"], fi = ["value"], yi = { class: "mr-rule-editor__pair" }, hi = ["onUpdate:modelValue", "disabled", "aria-label"], ki = { value: "number" }, $i = { value: "decimal" }, Vi = ["disabled", "onClick"], wi = ["disabled"], Ci = { class: "mr-rule-editor__actions" }, Ui = ["disabled", "aria-label"], Fi = ["disabled", "aria-label"], Si = ["disabled"], Mi = ["disabled"], xi = {
1716
+ key: 2,
1717
+ class: "mr-rule-editor__panel"
1718
+ }, Di = ["aria-label", "disabled"], Ni = ["value"], Ri = ["aria-label", "disabled"], Ei = { value: "style" }, Ti = { value: "cell" }, Ki = { value: "rowVisibility" }, Li = { key: 0 }, Bi = ["aria-label", "value", "disabled"], Oi = { value: -1 }, Ai = ["value"], Ii = { class: "mr-rule-editor__pair" }, Wi = ["disabled"], Gi = ["disabled"], Ji = { class: "mr-rule-editor__check" }, ji = ["disabled"], Hi = { class: "mr-rule-editor__actions" }, Pi = ["disabled"], zi = ["disabled"], qi = { class: "mr-rule-editor__explanation" }, Zi = { key: 0 }, Qi = { class: "mr-rule-editor__results" }, Xi = { key: 0 }, Yi = { key: 1 }, pi = {
1719
+ key: 1,
1720
+ class: "mr-rule-editor__error",
1721
+ role: "alert"
1722
+ }, _i = /* @__PURE__ */ be({
1723
+ __name: "RuleEditor",
1724
+ props: {
1725
+ location: {},
1726
+ recoveryKey: {},
1727
+ list: {},
1728
+ datasets: {},
1729
+ datasetSchema: {},
1730
+ datasetSchemas: {},
1731
+ readonly: { type: Boolean },
1732
+ messages: {}
1733
+ },
1734
+ emits: ["change", "dirty"],
1735
+ setup(e, { expose: W, emit: V }) {
1736
+ const j = Be(), w = e, U = V, r = tn(w, (P) => U("change", P)), {
1737
+ m: d,
1738
+ tab: b,
1739
+ fields: T,
1740
+ formula: y,
1741
+ groups: L,
1742
+ groupIndex: x,
1743
+ currentGroup: K,
1744
+ column: H,
1745
+ currentColumn: J,
1746
+ conditionIndex: c,
1747
+ effect: n,
1748
+ condition: v,
1749
+ style: o,
1750
+ error: h,
1751
+ preview: A,
1752
+ diagnostics: Q,
1753
+ selectedComputed: p
1754
+ } = r, ee = G({}), le = G(0);
1755
+ function ne() {
1756
+ r.resetDraft(), ee.value = {}, le.value++;
1757
+ }
1758
+ const _ = z(() => r.pendingLocalChanges.value || Object.values(ee.value).some(Boolean));
1759
+ te([_, r.draftSnapshot, ee], () => U("dirty", _.value), { immediate: !0, deep: !0, flush: "sync" }), W({ get pendingLocalChanges() {
1760
+ return _.value;
1761
+ } });
1762
+ const ie = He(w, r.formula, d), { query: de, matches: se, fieldWindow: m, expression: S, sources: R } = ie, D = ye(), E = Oe();
1763
+ E && te([b, p, x, H, c, n], () => {
1764
+ const P = { tab: b.value, field: b.value === "computations" ? p.value : H.value, index: b.value === "groups" ? x.value : c.value, effect: n.value };
1765
+ E.value = { ...E.value, rule: { key: w.recoveryKey ?? "rules:0:0", target: P } };
1766
+ }, { immediate: !0 });
1767
+ const ae = G();
1768
+ return te(() => w.location, async (P) => {
1769
+ if (!P || (b.value = P.tab, P.tab === "computations" && P.field && r.loadComputed(P.field), P.tab === "groups" && (x.value = Math.max(0, Math.min(P.index ?? 0, L.value.length - 1))), P.tab === "conditions" && (P.field && (H.value = P.field), n.value = P.effect ?? "style", r.loadCondition(P.index ?? -1)), await Ee(), w.location !== P)) return;
1770
+ const k = ae.value?.querySelector(".mr-rule-editor__panel");
1771
+ Ae(k);
1772
+ }, { immediate: !0 }), (P, k) => (i(), s("section", {
1773
+ ref_key: "root",
1774
+ ref: ae,
1775
+ class: "mr-rule-editor",
1776
+ style: Te(l(j)),
1777
+ "aria-label": l(d).settings
1778
+ }, [
1779
+ a("aside", sn, [
1780
+ a("div", {
1781
+ class: "mr-rule-editor__tabs",
1782
+ role: "tablist",
1783
+ "aria-label": l(d).settings
1784
+ }, [
1785
+ (i(), s(C, null, M([
1786
+ "computations",
1787
+ "groups",
1788
+ "conditions",
1789
+ "detail",
1790
+ "matrix",
1791
+ "tree"
1792
+ ], (u) => a("button", {
1793
+ key: u,
1794
+ type: "button",
1795
+ role: "tab",
1796
+ "aria-selected": l(b) === u,
1797
+ class: fe({ "is-active": l(b) === u }),
1798
+ onClick: (q) => b.value = u
1799
+ }, [
1800
+ $(t(l(d)[u]), 1),
1801
+ u === "computations" && e.list.computed?.length ? (i(), s("span", un, t(e.list.computed.length), 1)) : N("", !0),
1802
+ u === "groups" && l(L).length ? (i(), s("span", rn, t(l(L).length), 1)) : N("", !0)
1803
+ ], 10, on)), 64))
1804
+ ], 8, dn),
1805
+ a("div", cn, [
1806
+ a("strong", null, t(l(d).catalog), 1),
1807
+ _.value ? (i(), s("button", {
1808
+ key: 0,
1809
+ type: "button",
1810
+ disabled: e.readonly,
1811
+ onClick: ne
1812
+ }, t(l(d).restoreDraft), 9, mn)) : N("", !0),
1813
+ a("label", null, [
1814
+ $(t(l(d).searchFields), 1),
1815
+ F(a("input", {
1816
+ "onUpdate:modelValue": k[0] || (k[0] = (u) => ce(de) ? de.value = u : null),
1817
+ type: "search",
1818
+ "aria-label": l(d).searchFields
1819
+ }, null, 8, vn), [
1820
+ [X, l(de)]
1821
+ ])
1822
+ ]),
1823
+ a("div", bn, [
1824
+ (i(!0), s(C, null, M(l(m), (u) => (i(), s("button", {
1825
+ key: u.field,
1826
+ type: "button",
1827
+ disabled: e.readonly || l(b) !== "computations",
1828
+ title: l(d).useField,
1829
+ onClick: (q) => l(r).setExpression({ field: u.field })
1830
+ }, [
1831
+ a("strong", null, t(u.label), 1),
1832
+ a("code", null, t(u.field), 1),
1833
+ a("small", null, t(u.meta), 1)
1834
+ ], 8, gn))), 128))
1835
+ ]),
1836
+ l(se).length > 50 ? (i(), s("small", fn, t(l(d).shown) + " 50 / " + t(l(se).length), 1)) : N("", !0)
1837
+ ])
1838
+ ]),
1839
+ l(b) === "computations" ? (i(), s("div", yn, [
1840
+ a("label", null, [
1841
+ $(t(l(d).existing), 1),
1842
+ a("select", {
1843
+ "aria-label": l(d).existing,
1844
+ value: l(p),
1845
+ disabled: e.readonly,
1846
+ onChange: k[1] || (k[1] = (u) => l(r).loadComputed(u.target.value))
1847
+ }, [
1848
+ a("option", kn, "+ " + t(l(d).newField), 1),
1849
+ (i(!0), s(C, null, M(e.list.computed, (u) => (i(), s("option", {
1850
+ key: u.field,
1851
+ value: u.field
1852
+ }, t(u.field), 9, $n))), 128))
1853
+ ], 40, hn)
1854
+ ]),
1855
+ a("label", null, [
1856
+ $(t(l(d).target), 1),
1857
+ F(a("input", {
1858
+ "aria-label": l(d).target,
1859
+ "onUpdate:modelValue": k[2] || (k[2] = (u) => l(y).field = u),
1860
+ disabled: e.readonly,
1861
+ autocomplete: "off"
1862
+ }, null, 8, Vn), [
1863
+ [X, l(y).field]
1864
+ ])
1865
+ ]),
1866
+ a("div", wn, [
1867
+ a("label", null, [
1868
+ $(t(l(d).scope), 1),
1869
+ F(a("select", {
1870
+ "aria-label": l(d).scope,
1871
+ "onUpdate:modelValue": k[3] || (k[3] = (u) => l(y).scope = u),
1872
+ disabled: e.readonly
1873
+ }, [
1874
+ (i(!0), s(C, null, M(l(D).scopes, (u) => (i(), s("option", {
1875
+ key: u,
1876
+ value: u
1877
+ }, t(l(d)[u]), 9, Un))), 128))
1878
+ ], 8, Cn), [
1879
+ [O, l(y).scope]
1880
+ ])
1881
+ ]),
1882
+ a("label", null, [
1883
+ $(t(l(d).numeric), 1),
1884
+ F(a("select", {
1885
+ "aria-label": l(d).numeric,
1886
+ "onUpdate:modelValue": k[4] || (k[4] = (u) => l(y).numeric = u),
1887
+ disabled: e.readonly
1888
+ }, [
1889
+ a("option", Sn, t(l(d).number), 1),
1890
+ a("option", Mn, t(l(d).decimal), 1)
1891
+ ], 8, Fn), [
1892
+ [O, l(y).numeric]
1893
+ ])
1894
+ ])
1895
+ ]),
1896
+ l(y).scope === "group" ? (i(), s("fieldset", xn, [
1897
+ a("legend", null, t(l(d).groupFields), 1),
1898
+ (i(!0), s(C, null, M(l(T), (u) => (i(), s("label", {
1899
+ key: u.field
1900
+ }, [
1901
+ a("input", {
1902
+ type: "checkbox",
1903
+ checked: l(y).groupBy?.includes(u.field),
1904
+ disabled: e.readonly,
1905
+ onChange: (q) => l(r).toggleGroupField(
1906
+ u.field,
1907
+ q.target.checked
1908
+ )
1909
+ }, null, 40, Dn),
1910
+ $(t(u.label), 1)
1911
+ ]))), 128))
1912
+ ])) : N("", !0),
1913
+ typeof l(y).expression != "string" ? (i(), $e(an, {
1914
+ key: 1,
1915
+ "model-value": l(y).expression,
1916
+ fields: l(T),
1917
+ messages: l(d),
1918
+ readonly: e.readonly,
1919
+ "onUpdate:modelValue": l(r).setExpression
1920
+ }, null, 8, ["model-value", "fields", "messages", "readonly", "onUpdate:modelValue"])) : (i(), s("p", Nn, t(l(y).expression), 1)),
1921
+ a("details", null, [
1922
+ a("summary", null, t(l(d).advanced), 1),
1923
+ a("div", Rn, [
1924
+ a("label", null, [
1925
+ $(t(l(d).digits), 1),
1926
+ F(a("input", {
1927
+ "aria-label": l(d).digits,
1928
+ "onUpdate:modelValue": k[5] || (k[5] = (u) => l(y).digits = u),
1929
+ type: "number",
1930
+ min: "0",
1931
+ max: "100",
1932
+ disabled: e.readonly
1933
+ }, null, 8, En), [
1934
+ [
1935
+ X,
1936
+ l(y).digits,
1937
+ void 0,
1938
+ { number: !0 }
1939
+ ]
1940
+ ])
1941
+ ]),
1942
+ a("label", null, [
1943
+ $(t(l(d).nulls), 1),
1944
+ F(a("select", {
1945
+ "aria-label": l(d).nulls,
1946
+ "onUpdate:modelValue": k[6] || (k[6] = (u) => l(y).nulls = u),
1947
+ disabled: e.readonly
1948
+ }, [
1949
+ a("option", Kn, t(l(d).propagate), 1),
1950
+ a("option", Ln, t(l(d).error), 1)
1951
+ ], 8, Tn), [
1952
+ [O, l(y).nulls]
1953
+ ])
1954
+ ]),
1955
+ a("label", null, [
1956
+ $(t(l(d).division), 1),
1957
+ F(a("select", {
1958
+ "aria-label": l(d).division,
1959
+ "onUpdate:modelValue": k[7] || (k[7] = (u) => l(y).divisionByZero = u),
1960
+ disabled: e.readonly
1961
+ }, [
1962
+ a("option", On, t(l(d).error), 1),
1963
+ a("option", An, t(l(d).propagate), 1)
1964
+ ], 8, Bn), [
1965
+ [O, l(y).divisionByZero]
1966
+ ])
1967
+ ])
1968
+ ])
1969
+ ]),
1970
+ l(y).numeric === "decimal" ? (i(), s("p", In, t(l(d).decimalHint), 1)) : N("", !0),
1971
+ l(Q).valid && l(y).field ? (i(), s("div", Wn, [
1972
+ $(t(l(d).dependencies), 1),
1973
+ a("strong", null, t(l(Q).order.join(" → ")), 1)
1974
+ ])) : N("", !0),
1975
+ a("div", Gn, [
1976
+ a("button", {
1977
+ type: "button",
1978
+ disabled: e.readonly,
1979
+ onClick: k[8] || (k[8] = //@ts-ignore
1980
+ (...u) => l(r).check && l(r).check(...u))
1981
+ }, t(l(d).check), 9, Jn),
1982
+ a("button", {
1983
+ type: "button",
1984
+ class: "mr-rule-editor__primary",
1985
+ disabled: e.readonly || !l(Q).valid,
1986
+ onClick: k[9] || (k[9] = //@ts-ignore
1987
+ (...u) => l(r).applyComputed && l(r).applyComputed(...u))
1988
+ }, t(l(d).apply), 9, jn),
1989
+ l(p) ? (i(), s("button", {
1990
+ key: 0,
1991
+ type: "button",
1992
+ disabled: e.readonly,
1993
+ onClick: k[10] || (k[10] = //@ts-ignore
1994
+ (...u) => l(r).removeComputed && l(r).removeComputed(...u))
1995
+ }, t(l(d).remove), 9, Hn)) : N("", !0)
1996
+ ]),
1997
+ !l(Q).valid && l(y).field ? (i(), s("p", Pn, t(l(Q).errors.join(";")), 1)) : N("", !0)
1998
+ ])) : l(b) === "groups" ? (i(), s("div", zn, [
1999
+ a("div", qn, [
2000
+ F(a("select", {
2001
+ "onUpdate:modelValue": k[11] || (k[11] = (u) => ce(x) ? x.value = u : null),
2002
+ "aria-label": l(d).groups
2003
+ }, [
2004
+ (i(!0), s(C, null, M(l(L), (u, q) => (i(), s("option", {
2005
+ key: q,
2006
+ value: q
2007
+ }, t(q + 1) + " · " + t(u.field), 9, Qn))), 128)),
2008
+ l(L).length ? N("", !0) : (i(), s("option", Xn, t(l(d).noGroups), 1))
2009
+ ], 8, Zn), [
2010
+ [
2011
+ O,
2012
+ l(x),
2013
+ void 0,
2014
+ { number: !0 }
2015
+ ]
2016
+ ]),
2017
+ a("button", {
2018
+ type: "button",
2019
+ disabled: e.readonly || l(L).length >= 16,
2020
+ onClick: k[12] || (k[12] = //@ts-ignore
2021
+ (...u) => l(r).addGroup && l(r).addGroup(...u))
2022
+ }, " + " + t(l(d).addGroup), 9, Yn)
2023
+ ]),
2024
+ l(K) ? (i(), s(C, { key: 0 }, [
2025
+ a("label", null, [
2026
+ $(t(l(d).field), 1),
2027
+ F(a("select", {
2028
+ "aria-label": l(d).field,
2029
+ "onUpdate:modelValue": k[13] || (k[13] = (u) => l(K).field = u),
2030
+ disabled: e.readonly
2031
+ }, [
2032
+ (i(!0), s(C, null, M(l(T), (u) => (i(), s("option", {
2033
+ key: u.field,
2034
+ value: u.field
2035
+ }, t(u.label), 9, _n))), 128))
2036
+ ], 8, pn), [
2037
+ [O, l(K).field]
2038
+ ])
2039
+ ]),
2040
+ a("div", ei, [
2041
+ a("label", null, [
2042
+ $(t(l(d).header), 1),
2043
+ F(a("input", {
2044
+ "aria-label": l(d).header,
2045
+ "onUpdate:modelValue": k[14] || (k[14] = (u) => l(K).headerTemplate = u),
2046
+ disabled: e.readonly,
2047
+ placeholder: "{value}"
2048
+ }, null, 8, li), [
2049
+ [X, l(K).headerTemplate]
2050
+ ])
2051
+ ]),
2052
+ a("label", null, [
2053
+ $(t(l(d).footer), 1),
2054
+ F(a("input", {
2055
+ "aria-label": l(d).footer,
2056
+ "onUpdate:modelValue": k[15] || (k[15] = (u) => l(K).subtotalLabel = u),
2057
+ disabled: e.readonly
2058
+ }, null, 8, ai), [
2059
+ [X, l(K).subtotalLabel]
2060
+ ])
2061
+ ])
2062
+ ]),
2063
+ a("div", ti, [
2064
+ a("label", null, [
2065
+ F(a("input", {
2066
+ "onUpdate:modelValue": k[16] || (k[16] = (u) => l(K).keepWithNext = u),
2067
+ type: "checkbox",
2068
+ disabled: e.readonly
2069
+ }, null, 8, ni), [
2070
+ [re, l(K).keepWithNext]
2071
+ ]),
2072
+ $(t(l(d).orphan), 1)
2073
+ ]),
2074
+ a("label", null, [
2075
+ F(a("input", {
2076
+ "onUpdate:modelValue": k[17] || (k[17] = (u) => l(K).repeatHeader = u),
2077
+ type: "checkbox",
2078
+ disabled: e.readonly
2079
+ }, null, 8, ii), [
2080
+ [re, l(K).repeatHeader]
2081
+ ]),
2082
+ $(t(l(d).repeat), 1)
2083
+ ])
2084
+ ]),
2085
+ (i(!0), s(C, null, M(l(K).aggregates, (u, q) => (i(), s("div", {
2086
+ key: q,
2087
+ class: "mr-rule-editor__aggregate"
2088
+ }, [
2089
+ a("div", si, [
2090
+ a("label", null, [
2091
+ $(t(l(d).output), 1),
2092
+ F(a("select", {
2093
+ "aria-label": l(d).output,
2094
+ "onUpdate:modelValue": (I) => u.field = I,
2095
+ disabled: e.readonly
2096
+ }, [
2097
+ (i(!0), s(C, null, M(l(T), (I) => (i(), s("option", {
2098
+ key: I.field,
2099
+ value: I.field
2100
+ }, t(I.label), 9, oi))), 128))
2101
+ ], 8, di), [
2102
+ [O, u.field]
2103
+ ])
2104
+ ]),
2105
+ a("label", null, [
2106
+ $(t(l(d).aggregate), 1),
2107
+ F(a("select", {
2108
+ "aria-label": l(d).aggregate,
2109
+ "onUpdate:modelValue": (I) => u.op = I,
2110
+ disabled: e.readonly
2111
+ }, [
2112
+ (i(!0), s(C, null, M(l(D).aggregates, (I) => (i(), s("option", {
2113
+ key: I,
2114
+ value: I
2115
+ }, t(l(d)[I]), 9, ri))), 128))
2116
+ ], 8, ui), [
2117
+ [O, u.op]
2118
+ ])
2119
+ ])
2120
+ ]),
2121
+ a("label", null, [
2122
+ $(t(l(d).measure), 1),
2123
+ F(a("select", {
2124
+ "aria-label": l(d).measure,
2125
+ "onUpdate:modelValue": (I) => u.valueField = I,
2126
+ disabled: e.readonly
2127
+ }, [
2128
+ a("option", mi, t(u.field), 1),
2129
+ (i(!0), s(C, null, M(l(T), (I) => (i(), s("option", {
2130
+ key: I.field,
2131
+ value: I.field
2132
+ }, t(I.label), 9, vi))), 128))
2133
+ ], 8, ci), [
2134
+ [O, u.valueField]
2135
+ ])
2136
+ ]),
2137
+ u.op === "weightedAvg" ? (i(), s("label", bi, [
2138
+ $(t(l(d).weight), 1),
2139
+ F(a("select", {
2140
+ "aria-label": l(d).weight,
2141
+ "onUpdate:modelValue": (I) => u.weightField = I,
2142
+ disabled: e.readonly
2143
+ }, [
2144
+ (i(!0), s(C, null, M(l(T), (I) => (i(), s("option", {
2145
+ key: I.field,
2146
+ value: I.field
2147
+ }, t(I.label), 9, fi))), 128))
2148
+ ], 8, gi), [
2149
+ [O, u.weightField]
2150
+ ])
2151
+ ])) : N("", !0),
2152
+ a("div", yi, [
2153
+ F(a("select", {
2154
+ "onUpdate:modelValue": (I) => u.numeric = I,
2155
+ disabled: e.readonly,
2156
+ "aria-label": l(d).numeric
2157
+ }, [
2158
+ a("option", ki, t(l(d).number), 1),
2159
+ a("option", $i, t(l(d).decimal), 1)
2160
+ ], 8, hi), [
2161
+ [O, u.numeric]
2162
+ ]),
2163
+ a("button", {
2164
+ type: "button",
2165
+ disabled: e.readonly,
2166
+ onClick: (I) => l(K).aggregates?.splice(q, 1)
2167
+ }, t(l(d).remove), 9, Vi)
2168
+ ])
2169
+ ]))), 128)),
2170
+ a("button", {
2171
+ type: "button",
2172
+ disabled: e.readonly,
2173
+ onClick: k[18] || (k[18] = //@ts-ignore
2174
+ (...u) => l(r).addAggregate && l(r).addAggregate(...u))
2175
+ }, " + " + t(l(d).addAggregate), 9, wi),
2176
+ a("div", Ci, [
2177
+ a("button", {
2178
+ type: "button",
2179
+ disabled: e.readonly || l(x) === 0,
2180
+ "aria-label": l(d).moveUp,
2181
+ onClick: k[19] || (k[19] = (u) => l(r).moveGroup(-1))
2182
+ }, " ↑ " + t(l(d).outer), 9, Ui),
2183
+ a("button", {
2184
+ type: "button",
2185
+ disabled: e.readonly || l(x) >= l(L).length - 1,
2186
+ "aria-label": l(d).moveDown,
2187
+ onClick: k[20] || (k[20] = (u) => l(r).moveGroup(1))
2188
+ }, " ↓ " + t(l(d).inner), 9, Fi),
2189
+ a("button", {
2190
+ type: "button",
2191
+ disabled: e.readonly,
2192
+ onClick: k[21] || (k[21] = //@ts-ignore
2193
+ (...u) => l(r).removeGroup && l(r).removeGroup(...u))
2194
+ }, t(l(d).remove), 9, Si)
2195
+ ])
2196
+ ], 64)) : N("", !0),
2197
+ a("button", {
2198
+ type: "button",
2199
+ class: "mr-rule-editor__primary",
2200
+ disabled: e.readonly,
2201
+ onClick: k[22] || (k[22] = //@ts-ignore
2202
+ (...u) => l(r).applyGroups && l(r).applyGroups(...u))
2203
+ }, t(l(d).apply), 9, Mi)
2204
+ ])) : l(b) === "conditions" ? (i(), s("div", xi, [
2205
+ a("label", null, [
2206
+ $(t(l(d).column), 1),
2207
+ F(a("select", {
2208
+ "aria-label": l(d).column,
2209
+ "onUpdate:modelValue": k[23] || (k[23] = (u) => ce(H) ? H.value = u : null),
2210
+ disabled: e.readonly,
2211
+ onChange: k[24] || (k[24] = (u) => l(r).loadCondition(-1))
2212
+ }, [
2213
+ (i(!0), s(C, null, M(e.list.columns, (u) => (i(), s("option", {
2214
+ key: u.field,
2215
+ value: u.field
2216
+ }, t(u.header || u.field), 9, Ni))), 128))
2217
+ ], 40, Di), [
2218
+ [O, l(H)]
2219
+ ])
2220
+ ]),
2221
+ a("label", null, [
2222
+ $(t(l(d).effect), 1),
2223
+ F(a("select", {
2224
+ "aria-label": l(d).effect,
2225
+ "onUpdate:modelValue": k[25] || (k[25] = (u) => ce(n) ? n.value = u : null),
2226
+ disabled: e.readonly,
2227
+ onChange: k[26] || (k[26] = (u) => l(r).loadCondition(-1))
2228
+ }, [
2229
+ a("option", Ei, t(l(d).style), 1),
2230
+ a("option", Ti, t(l(d).cell), 1),
2231
+ a("option", Ki, t(l(d).rowVisibility), 1)
2232
+ ], 40, Ri), [
2233
+ [O, l(n)]
2234
+ ])
2235
+ ]),
2236
+ l(n) === "style" ? (i(), s("label", Li, [
2237
+ $(t(l(d).existing), 1),
2238
+ a("select", {
2239
+ "aria-label": l(d).existing,
2240
+ value: l(c),
2241
+ disabled: e.readonly,
2242
+ onChange: k[27] || (k[27] = (u) => l(r).loadCondition(
2243
+ Number(u.target.value)
2244
+ ))
2245
+ }, [
2246
+ a("option", Oi, "+ " + t(l(d).newCondition), 1),
2247
+ (i(!0), s(C, null, M(l(J)?.rules, (u, q) => (i(), s("option", {
2248
+ key: q,
2249
+ value: q
2250
+ }, t(q + 1) + " · " + t("field" in u.when ? u.when.field : l(d).conditionGroup), 9, Ai))), 128))
2251
+ ], 40, Bi)
2252
+ ])) : N("", !0),
2253
+ ve(Fe, {
2254
+ "model-value": l(v),
2255
+ fields: l(T),
2256
+ messages: l(d),
2257
+ readonly: e.readonly,
2258
+ "onUpdate:modelValue": l(r).setCondition
2259
+ }, null, 8, ["model-value", "fields", "messages", "readonly", "onUpdate:modelValue"]),
2260
+ l(n) === "style" ? (i(), s(C, { key: 1 }, [
2261
+ a("div", Ii, [
2262
+ a("label", null, [
2263
+ $(t(l(d).color), 1),
2264
+ F(a("input", {
2265
+ "onUpdate:modelValue": k[28] || (k[28] = (u) => l(o).color = u),
2266
+ type: "color",
2267
+ disabled: e.readonly
2268
+ }, null, 8, Wi), [
2269
+ [X, l(o).color]
2270
+ ])
2271
+ ]),
2272
+ a("label", null, [
2273
+ $(t(l(d).background), 1),
2274
+ F(a("input", {
2275
+ "onUpdate:modelValue": k[29] || (k[29] = (u) => l(o).backgroundColor = u),
2276
+ type: "color",
2277
+ disabled: e.readonly
2278
+ }, null, 8, Gi), [
2279
+ [X, l(o).backgroundColor]
2280
+ ])
2281
+ ])
2282
+ ]),
2283
+ a("label", Ji, [
2284
+ F(a("input", {
2285
+ "onUpdate:modelValue": k[30] || (k[30] = (u) => l(o).bold = u),
2286
+ type: "checkbox",
2287
+ disabled: e.readonly
2288
+ }, null, 8, ji), [
2289
+ [re, l(o).bold]
2290
+ ]),
2291
+ $(t(l(d).bold), 1)
2292
+ ])
2293
+ ], 64)) : N("", !0),
2294
+ a("div", Hi, [
2295
+ a("button", {
2296
+ type: "button",
2297
+ class: "mr-rule-editor__primary",
2298
+ disabled: e.readonly,
2299
+ onClick: k[31] || (k[31] = (u) => l(r).applyCondition())
2300
+ }, t(l(d).apply), 9, Pi),
2301
+ l(c) >= 0 || l(n) !== "style" ? (i(), s("button", {
2302
+ key: 0,
2303
+ type: "button",
2304
+ disabled: e.readonly,
2305
+ onClick: k[32] || (k[32] = (u) => l(r).applyCondition(!0))
2306
+ }, t(l(d).removeCondition), 9, zi)) : N("", !0)
2307
+ ])
2308
+ ])) : N("", !0),
2309
+ (i(), s(C, null, M(["detail", "matrix", "tree"], (u) => F(ve(Ut, {
2310
+ key: `${u}-${le.value}`,
2311
+ list: e.list,
2312
+ "recovery-key": e.recoveryKey,
2313
+ mode: u,
2314
+ datasets: e.datasets,
2315
+ "dataset-schema": e.datasetSchema,
2316
+ "dataset-schemas": e.datasetSchemas,
2317
+ readonly: e.readonly,
2318
+ messages: l(d),
2319
+ accept: l(r).applyLayout,
2320
+ onDirty: (q) => ee.value = { ...ee.value, [u]: q }
2321
+ }, null, 8, ["list", "recovery-key", "mode", "datasets", "dataset-schema", "dataset-schemas", "readonly", "messages", "accept", "onDirty"]), [
2322
+ [Ke, l(b) === u]
2323
+ ])), 64)),
2324
+ a("aside", qi, [
2325
+ a("header", null, [
2326
+ a("strong", null, t(l(d).explanation), 1),
2327
+ _.value ? (i(), s("span", Zi, t(l(d).pending), 1)) : N("", !0)
2328
+ ]),
2329
+ a("p", null, t(l(d).sourceHint), 1),
2330
+ l(b) === "computations" ? (i(), s(C, { key: 0 }, [
2331
+ a("h4", null, t(l(d).expression), 1),
2332
+ a("code", null, t(l(S)), 1),
2333
+ a("div", Qi, [
2334
+ a("h4", null, t(l(d).sourceValues) + " → " + t(l(d).result), 1),
2335
+ (i(!0), s(C, null, M(l(R), (u) => (i(), s("div", {
2336
+ key: u.row,
2337
+ class: "mr-rule-editor__trace"
2338
+ }, [
2339
+ a("small", null, "#" + t(u.row), 1),
2340
+ a("code", null, t(u.values), 1),
2341
+ a("strong", null, t(l(A).find((q) => q.row === u.row)?.value ?? (l(A).length ? "—" : l(d).notChecked)), 1)
2342
+ ]))), 128)),
2343
+ l(A).some((u) => u.value == null) ? (i(), s("p", Xi, t(l(d).nullReason), 1)) : N("", !0),
2344
+ l(A).length ? (i(), s("p", Yi, t(l(d).sample), 1)) : N("", !0)
2345
+ ])
2346
+ ], 64)) : N("", !0),
2347
+ l(h) ? (i(), s("p", pi, t(l(h)), 1)) : N("", !0)
2348
+ ])
2349
+ ], 12, nn));
2350
+ }
2351
+ }), us = /* @__PURE__ */ ge(_i, [["__scopeId", "data-v-eba44d9b"]]);
2352
+ export {
2353
+ us as default
2354
+ };