@feedmepos/mf-report 5.19.14-beta.0 → 5.19.15-beta.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 (29) hide show
  1. package/dist/{App-DjQm3gtj.js → App-DaWS5CoM.js} +4 -4
  2. package/dist/BaseDialog.vue_vue_type_script_setup_true_lang-lOdt7NC7.js +19641 -0
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-BjCJYhtZ.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-BVi8DNni.js} +2 -2
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-BNoroDNa.js → Default.vue_vue_type_script_setup_true_lang-Chyv0-HU.js} +2 -2
  5. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-D7I6fnJ3.js +1669 -0
  6. package/dist/{InsightView-CearPkTu.js → InsightView-B28BJ1MA.js} +5 -5
  7. package/dist/{Integration-Crm_siri.js → Integration-B58qXrEi.js} +2 -2
  8. package/dist/{Integrations-DAOeCNIk.js → Integrations-D4ju0l38.js} +3 -3
  9. package/dist/{Layout-BQSqYC_C.js → Layout-lJXJCHED.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-BWwja8hz.js → MenuTab.vue_vue_type_script_setup_true_lang-CGD_v4oS.js} +6 -6
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang--ggpx78f.js → NavigationTab.vue_vue_type_script_setup_true_lang-BuWxAL_6.js} +7015 -7009
  12. package/dist/{NoData.vue_vue_type_script_setup_true_lang-BCtqN6Qb.js → NoData.vue_vue_type_script_setup_true_lang-DX1We5Q0.js} +1 -1
  13. package/dist/{OverviewView-LrGkWl5T.js → OverviewView-BKQm4JJJ.js} +5 -5
  14. package/dist/{Report-Cf5NKwXY.js → Report-DL0olJk2.js} +4 -4
  15. package/dist/{ReportEditor-D9SWS64W.js → ReportEditor-BFDiTB14.js} +6 -6
  16. package/dist/{ReportView-B4FSYhz9.js → ReportView-BrIUqNUG.js} +7 -7
  17. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-DQaq02mG.js → SelectComponent.vue_vue_type_script_setup_true_lang-DYOjRnAy.js} +1 -1
  18. package/dist/{Setting-DL1MBR5L.js → Setting-T8R9CvmF.js} +4 -4
  19. package/dist/{TileEditor-BSZe7gPL.js → TileEditor-CfJ_AkZJ.js} +7 -7
  20. package/dist/{TransitionFade-D6W7oE4P.js → TransitionFade-CikcE2a-.js} +92 -92
  21. package/dist/app.js +11 -11
  22. package/dist/assets/formatChartData.worker-BzZtU5fj.js +134 -0
  23. package/dist/assets/processTableData.worker-D-lgWpiT.js +134 -0
  24. package/dist/{helper-DKVVGDb2.js → helper-CLGnwM-X.js} +1 -1
  25. package/dist/{vue-i18n-BU70cPPB.js → vue-i18n-DsnU36hZ.js} +176 -176
  26. package/package.json +2 -3
  27. package/dist/BaseDialog.vue_vue_type_script_setup_true_lang-CCQrh2Cm.js +0 -11209
  28. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-B7Q3QXOi.js +0 -1626
  29. package/dist/assets/formatChartData.worker-2gP9DT2G.js +0 -8
@@ -0,0 +1,1669 @@
1
+ import { computed as f, defineComponent as se, mergeModels as me, useModel as re, ref as u, onMounted as we, nextTick as J, watch as G, resolveComponent as H, createElementBlock as O, openBlock as A, Fragment as de, renderSlot as xe, createVNode as I, normalizeStyle as he, unref as o, createElementVNode as M, toDisplayString as Ee, withCtx as Y, createBlock as j, createCommentVNode as be, normalizeClass as Me, h as Be, renderList as Ft, toRaw as aa, markRaw as la, createTextVNode as oa, onUnmounted as na, resolveDynamicComponent as sa, withDirectives as ra, vShow as ia } from "vue";
2
+ import { W as _, d as Ve, e as ca, S as Ae, v as Ie, f as ua, g as Je, h as Rt, q as da, R as Fe, i as ha } from "./BaseDialog.vue_vue_type_script_setup_true_lang-lOdt7NC7.js";
3
+ import { u as qe, b as Ne, a as nt } from "./vue-i18n-DsnU36hZ.js";
4
+ import { a as St } from "./helper-CLGnwM-X.js";
5
+ import { storeToRefs as Le, defineStore as ma } from "pinia";
6
+ import { useBreakpoints as Lt, useSnackbar as st, components as pa } from "@feedmepos/ui-library";
7
+ import { a as fa } from "./SelectComponent.vue_vue_type_script_setup_true_lang-DYOjRnAy.js";
8
+ import { r as Re } from "./i18n-Cif1I9J2.js";
9
+ import { _ as kt } from "./NoData.vue_vue_type_script_setup_true_lang-DX1We5Q0.js";
10
+ var Qe = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(Qe || {}), ye = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(ye || {}), et = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(et || {}), tt = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(tt || {}), at = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(at || {}), lt = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(lt || {}), ot = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(ot || {});
11
+ _.Circular, _.Table, _.BarChart, _.LineChart, _.StackBarChart, _.StackLineChart, _.Scorecard, _.Spacer;
12
+ const va = [
13
+ {
14
+ type: _.Circular,
15
+ showLabel: !1,
16
+ // TODO: temporarily removed show label as it has no function
17
+ showDrillDimension: !0,
18
+ showRollup: !1,
19
+ showSearchBar: !1
20
+ },
21
+ {
22
+ type: _.Table,
23
+ showLabel: !1,
24
+ showDrillDimension: !0,
25
+ showRollup: !0,
26
+ showSearchBar: !0
27
+ },
28
+ {
29
+ type: _.BarChart,
30
+ showLabel: !1,
31
+ // TODO: temporarily removed show label as it has no function
32
+ showDrillDimension: !0,
33
+ showRollup: !1,
34
+ showSearchBar: !1
35
+ },
36
+ {
37
+ type: _.LineChart,
38
+ showLabel: !1,
39
+ // TODO: temporarily removed show label as it has no function
40
+ showDrillDimension: !0,
41
+ showRollup: !0,
42
+ showSearchBar: !1
43
+ },
44
+ {
45
+ type: _.StackBarChart,
46
+ showLabel: !1,
47
+ // TODO: temporarily removed show label as it has no function
48
+ showDrillDimension: !0,
49
+ showRollup: !0,
50
+ showSearchBar: !1
51
+ },
52
+ {
53
+ type: _.StackLineChart,
54
+ showLabel: !1,
55
+ // TODO: temporarily removed show label as it has no function
56
+ showDrillDimension: !0,
57
+ showRollup: !0,
58
+ showSearchBar: !1
59
+ },
60
+ {
61
+ type: _.Scorecard,
62
+ showLabel: !1,
63
+ showDrillDimension: !1,
64
+ showRollup: !1,
65
+ showSearchBar: !1
66
+ },
67
+ {
68
+ type: _.Spacer,
69
+ showLabel: !1,
70
+ showDrillDimension: !1,
71
+ showRollup: !1,
72
+ showSearchBar: !1
73
+ }
74
+ ];
75
+ function Ke(e) {
76
+ const n = [e.schemaName, e.name];
77
+ return "option" in e && e.option && n.push(e.option), "aggregation" in e && e.aggregation && n.push(e.aggregation), n.push(e.label.replace(/[^a-zA-Z0-9]/g, "")), n.join("_").toLowerCase();
78
+ }
79
+ function ga(e, n) {
80
+ switch (e) {
81
+ case _.BarChart:
82
+ case _.LineChart:
83
+ case _.StackBarChart:
84
+ case _.StackLineChart:
85
+ return Array.isArray(n == null ? void 0 : n.datasets) && Array.isArray(n == null ? void 0 : n.xAxis) && n.datasets.length > 0 && n.xAxis.length > 0;
86
+ case _.Table:
87
+ return Array.isArray(n == null ? void 0 : n.rows) && Array.isArray(n == null ? void 0 : n.columns) && n.rows.length > 0 && n.columns.length > 0;
88
+ case _.Circular:
89
+ return Array.isArray(n == null ? void 0 : n.datasets) && n.datasets.length > 0;
90
+ case _.Scorecard:
91
+ return !0;
92
+ case _.Spacer:
93
+ return !0;
94
+ }
95
+ }
96
+ const Tt = [
97
+ "54, 162, 235",
98
+ //8CE6D7
99
+ "0, 123, 167",
100
+ //007BA7
101
+ "255, 93, 83",
102
+ //FF5D53
103
+ "115, 200, 230",
104
+ //73C8E6
105
+ "252, 162, 62",
106
+ //FCA23E
107
+ "240, 155, 190",
108
+ //F09BBE
109
+ "255, 210, 50",
110
+ //FFD232
111
+ "80, 190, 155",
112
+ //50BE9B
113
+ "131, 88, 212",
114
+ //8358D4
115
+ "155, 80, 70"
116
+ //9B5046
117
+ ];
118
+ function ne({
119
+ index: e,
120
+ isCompare: n,
121
+ opacity: m
122
+ }) {
123
+ let t = typeof m == "number" ? m : 1;
124
+ return n && (t = t * 0.6), `rgba(${Tt[e % Tt.length]}, ${t})`;
125
+ }
126
+ function zt(e, n, m) {
127
+ if (e === "" || n === "")
128
+ return null;
129
+ let t = (F) => F == null ? void 0 : F.replace(/,/g, "");
130
+ m === "ID" && (t = (F) => F == null ? void 0 : F.replace(/\./g, "").replace(/,/g, "."));
131
+ const w = Number(t(e)), R = Number(t(n));
132
+ if (isNaN(w) || isNaN(R))
133
+ return null;
134
+ let C = 0;
135
+ R === 0 ? w === 0 ? C = 0 : C = 1 : C = (w - R) / R;
136
+ const S = ya(C);
137
+ return {
138
+ value: isNaN(C) ? "" : `${(C * 100).toFixed(0)}%`,
139
+ icon: S
140
+ };
141
+ }
142
+ function ya(e) {
143
+ return e > 0 ? {
144
+ name: "moving",
145
+ color: "#1F7735",
146
+ tailwind: "fm-color-system-success-100"
147
+ } : e < 0 ? {
148
+ name: "trending_down",
149
+ color: "#99231D",
150
+ tailwind: "fm-color-system-error-100"
151
+ } : {
152
+ name: "equal",
153
+ color: "#C7C7CC",
154
+ tailwind: "fm-color-neutral-gray-100"
155
+ };
156
+ }
157
+ function He(e) {
158
+ function n(s, c, i) {
159
+ if (s.measureText(c).width <= i) return c;
160
+ const r = "…";
161
+ let x = 0, b = c.length;
162
+ for (; x < b; ) {
163
+ const v = Math.floor((x + b) / 2), h = c.slice(0, v) + r;
164
+ s.measureText(h).width <= i ? x = v + 1 : b = v;
165
+ }
166
+ return c.slice(0, x - 1) + r;
167
+ }
168
+ const m = f(() => ({
169
+ display: e.showLabel,
170
+ align: e.labelAlign,
171
+ anchor: e.labelAnchor,
172
+ rotation: e.labelRotation,
173
+ offset: e.labelOffset,
174
+ font: {
175
+ size: e.labelFontSize
176
+ },
177
+ color: (s) => {
178
+ const c = s.chart.data.datasets[s.datasetIndex];
179
+ return c.borderColor ? Array.isArray(c.borderColor) ? c.borderColor[s.dataIndex] : c.borderColor : c.backgroundColor ? Array.isArray(c.backgroundColor) ? c.backgroundColor[s.dataIndex] : c.backgroundColor : "#000";
180
+ },
181
+ formatter: (s) => s === 0 ? "" : s.toLocaleString("en-US")
182
+ })), t = f(() => ({
183
+ display: e.showX,
184
+ position: e.xPosition,
185
+ grid: {
186
+ display: e.showXGrid
187
+ },
188
+ ticks: {
189
+ display: e.showXTick,
190
+ callback: function(s) {
191
+ if ((e == null ? void 0 : e.isTransposed) === !0) return String(s);
192
+ let i = String(s);
193
+ const r = this;
194
+ r && typeof r.getLabelForValue == "function" && (i = r.getLabelForValue(s));
195
+ const x = r == null ? void 0 : r.chart, b = r == null ? void 0 : r.ctx, v = x.height * 0.25;
196
+ if (b && v > 0) {
197
+ b.save();
198
+ const z = b.measureText(i).width > v ? n(b, i, v) : i;
199
+ return b.restore(), z;
200
+ }
201
+ return i;
202
+ },
203
+ font: {
204
+ size: e.xTickFontSize
205
+ }
206
+ },
207
+ title: {
208
+ display: e.showXTitle,
209
+ text: e.xTitle,
210
+ font: {
211
+ size: e.xTitleFontSize
212
+ }
213
+ },
214
+ afterBuildTicks: (s) => {
215
+ const c = Array.isArray(s == null ? void 0 : s.ticks) ? s.ticks : [];
216
+ if (c.length === 0) return;
217
+ const i = s.getLabelForValue(c[0].value), r = !isNaN(Number(i));
218
+ s.options.ticks.minRotation = r || c.length < 10 ? 0 : 90;
219
+ },
220
+ afterFit: (s) => {
221
+ if (!(e != null && e.isTransposed)) {
222
+ const c = s.chart.height * 0.4;
223
+ s.height > c && (s.height = c);
224
+ }
225
+ }
226
+ })), w = f(() => ({
227
+ display: e.showY,
228
+ position: e.yPosition,
229
+ grid: {
230
+ display: e.showYGrid
231
+ },
232
+ ticks: {
233
+ display: e.showYTick,
234
+ font: {
235
+ size: e.yTickFontSize
236
+ },
237
+ callback: function(s) {
238
+ if (!((e == null ? void 0 : e.isTransposed) === !0)) return String(s);
239
+ let i = String(s);
240
+ const r = this;
241
+ r && typeof r.getLabelForValue == "function" && (i = r.getLabelForValue(s));
242
+ const x = r == null ? void 0 : r.chart, b = r == null ? void 0 : r.ctx, v = x.width * 0.4;
243
+ if (b && v > 0) {
244
+ b.save();
245
+ const z = b.measureText(i).width > v ? n(b, i, v) : i;
246
+ return b.restore(), z;
247
+ }
248
+ return i;
249
+ }
250
+ },
251
+ title: {
252
+ display: e.showYTitle,
253
+ text: e.yTitle,
254
+ font: {
255
+ size: e.yTitleFontSize
256
+ }
257
+ }
258
+ })), R = f(() => ({
259
+ display: e.showLegend,
260
+ position: e.legendPosition,
261
+ usePointStyle: e.usePointStyle,
262
+ maxHeight: e.legendMaxHeight,
263
+ maxWidth: e.legendMaxWidth,
264
+ labels: {
265
+ usePointStyle: e.usePointStyle ?? !0,
266
+ generateLabels: (s) => {
267
+ var i;
268
+ const c = ((i = s == null ? void 0 : s.data) == null ? void 0 : i.datasets) || [];
269
+ if (c.length === 0) return [];
270
+ if (c.length === 1 && Array.isArray(c[0].backgroundColor) && c[0].backgroundColor.length > 1 && Array.isArray(c[0].data)) {
271
+ const r = c[0];
272
+ return s.data.labels.map((b, v) => {
273
+ const h = r.backgroundColor[v];
274
+ return {
275
+ text: b,
276
+ fontColor: "#6b6b6b",
277
+ fillStyle: h,
278
+ strokeStyle: h,
279
+ datasetIndex: 0,
280
+ index: v,
281
+ hidden: s.getDataVisibility ? !s.getDataVisibility(v) : !1
282
+ };
283
+ });
284
+ }
285
+ return s.data.datasets.map((r, x) => {
286
+ const b = r.borderColor || r.backgroundColor;
287
+ return {
288
+ text: r.label,
289
+ fontColor: "#6b6b6b",
290
+ fillStyle: b,
291
+ strokeStyle: b,
292
+ datasetIndex: x,
293
+ hidden: !s.isDatasetVisible(x)
294
+ };
295
+ });
296
+ }
297
+ }
298
+ })), C = f(() => e.isTransposed), S = f(() => e.chartWidth), F = f(() => e.chartHeight);
299
+ return { datalabels: m, xCfg: t, yCfg: w, isTransposed: C, legend: R, chartWidth: S, chartHeight: F };
300
+ }
301
+ const ba = /* @__PURE__ */ se({
302
+ __name: "WidgetBarchart",
303
+ props: /* @__PURE__ */ me({
304
+ tileIndex: {}
305
+ }, {
306
+ modelValue: { required: !0 },
307
+ modelModifiers: {}
308
+ }),
309
+ emits: ["update:modelValue"],
310
+ setup(e) {
311
+ const n = e, m = re(e, "modelValue"), t = u(null), w = f(() => {
312
+ var h;
313
+ return ((h = m.value.data) == null ? void 0 : h.xAxis) ?? [];
314
+ }), R = f(() => {
315
+ var h;
316
+ return ((h = m.value.data) == null ? void 0 : h.datasets) ?? [];
317
+ }), { datalabels: C, xCfg: S, yCfg: F, isTransposed: s, legend: c, chartWidth: i, chartHeight: r } = He(
318
+ m.value
319
+ ), x = f(() => R.value.length > 0 ? [
320
+ ...R.value.map((h, z) => ({
321
+ label: h.name,
322
+ data: h.values,
323
+ dash: !!h.isCompare,
324
+ backgroundColor: ne({ index: z, isCompare: h.isCompare })
325
+ }))
326
+ ] : []), b = Ve();
327
+ function v() {
328
+ return b.extractChartSize(t.value, n.tileIndex) || { width: 0, height: 0 };
329
+ }
330
+ return we(() => {
331
+ J(() => {
332
+ v();
333
+ });
334
+ }), G([x], () => {
335
+ J(() => v());
336
+ }), (h, z) => {
337
+ const d = H("FmBarChart");
338
+ return A(), O(de, null, [
339
+ xe(h.$slots, "menu"),
340
+ I(d, {
341
+ ref_key: "chartRef",
342
+ ref: t,
343
+ class: "bar-chart",
344
+ datasets: x.value,
345
+ "x-axis": { categories: w.value },
346
+ "x-cfg": o(S),
347
+ "y-cfg": o(F),
348
+ transpose: o(s),
349
+ legend: {
350
+ display: o(c).display ?? !1,
351
+ position: o(c).position,
352
+ maxHeight: o(c).maxHeight,
353
+ maxWidth: o(c).maxWidth,
354
+ labels: o(c).labels
355
+ },
356
+ datalabels: o(C),
357
+ "maintain-aspect-ratio": !1,
358
+ style: he({
359
+ "--chart-width": o(i) !== void 0 ? o(i) + "px" : "100%",
360
+ "--chart-height": o(r) !== void 0 ? o(r) + "px" : "calc(100% - 36px)"
361
+ })
362
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
363
+ ], 64);
364
+ };
365
+ }
366
+ }), wa = /* @__PURE__ */ se({
367
+ __name: "WidgetCircular",
368
+ props: /* @__PURE__ */ me({
369
+ tileIndex: {}
370
+ }, {
371
+ modelValue: { required: !0 },
372
+ modelModifiers: {}
373
+ }),
374
+ emits: ["update:modelValue"],
375
+ setup(e) {
376
+ const n = e, m = re(e, "modelValue"), { breakpoints: t } = Lt(), w = u(null), { datalabels: R, legend: C, chartWidth: S, chartHeight: F } = He(m.value), s = f(() => {
377
+ let x = [];
378
+ return m.value.data.datasets && m.value.data.metrics && m.value.data.datasets.length > 0 && m.value.data.metrics.length > 0 && (x = [
379
+ {
380
+ label: m.value.data.metrics[0],
381
+ data: m.value.data.datasets.map((b) => b.value),
382
+ backgroundColor: m.value.data.datasets.map((b, v) => ne({ index: v }))
383
+ }
384
+ ]), x;
385
+ }), c = Ve();
386
+ function i() {
387
+ return c.extractChartSize(w.value, n.tileIndex) || { width: 0, height: 0 };
388
+ }
389
+ we(() => {
390
+ J(() => {
391
+ i();
392
+ });
393
+ }), G([s], () => {
394
+ J(() => i());
395
+ });
396
+ const r = f(() => t.value.lg ? 12 : 8);
397
+ return (x, b) => {
398
+ const v = H("FmPieChart");
399
+ return A(), O(de, null, [
400
+ xe(x.$slots, "menu"),
401
+ I(v, {
402
+ ref_key: "chartRef",
403
+ ref: w,
404
+ class: "circular",
405
+ percentage: "70%",
406
+ datasets: s.value,
407
+ metrics: m.value.data.datasets.map((h) => h.name),
408
+ variant: "doughnut",
409
+ legend: {
410
+ display: o(C).display ?? !0,
411
+ position: o(C).position ?? "top",
412
+ maxHeight: o(C).maxHeight,
413
+ maxWidth: o(C).maxWidth,
414
+ labels: {
415
+ ...o(C).labels,
416
+ font: {
417
+ size: r.value
418
+ }
419
+ }
420
+ },
421
+ datalabels: o(R),
422
+ "maintain-aspect-ratio": !1,
423
+ style: he({
424
+ "--chart-width": o(S) !== void 0 ? o(S) + "px" : "100%",
425
+ "--chart-height": o(F) !== void 0 ? o(F) + "px" : "calc(100% - 36px)"
426
+ })
427
+ }, null, 8, ["datasets", "metrics", "legend", "datalabels", "style"])
428
+ ], 64);
429
+ };
430
+ }
431
+ }), xa = { class: "flex flex-col gap-1" }, Ca = { class: "fm-typo-en-title-sm-600" }, Sa = { class: "flex gap-2" }, ka = { key: 0 }, Ta = { key: 1 }, _a = /* @__PURE__ */ se({
432
+ __name: "WidgetScorecard",
433
+ props: {
434
+ modelValue: { required: !0 },
435
+ modelModifiers: {}
436
+ },
437
+ emits: ["update:modelValue"],
438
+ setup(e) {
439
+ const n = re(e, "modelValue"), { t: m } = qe(), { compareDateRange: t, defaultDateSetting: w } = Le(Ne()), { country: R } = nt(), C = f(() => {
440
+ var i;
441
+ return ((i = n.value.data) == null ? void 0 : i.value) || "";
442
+ }), S = f(() => {
443
+ const { data: i } = n.value;
444
+ return i != null && i.comparison ? zt(C.value, i.comparison, R) : null;
445
+ });
446
+ function F(i) {
447
+ switch (i) {
448
+ case Qe.bar:
449
+ return "bar";
450
+ case Qe.line:
451
+ return "line";
452
+ default:
453
+ return "line";
454
+ }
455
+ }
456
+ const s = f(() => {
457
+ var i;
458
+ return (i = n.value.data) == null ? void 0 : i.sparkline;
459
+ }), c = f(() => s.value.datasets.map((i) => ({
460
+ label: i.name,
461
+ data: i.values,
462
+ fill: !0,
463
+ color: "#36a2eb"
464
+ })));
465
+ return (i, r) => {
466
+ var z;
467
+ const x = H("FmIcon"), b = H("FmChip"), v = H("FmTooltip"), h = H("FmLineChart");
468
+ return A(), O("div", xa, [
469
+ xe(i.$slots, "menu"),
470
+ M("p", Ca, Ee(C.value), 1),
471
+ M("div", Sa, [
472
+ I(v, {
473
+ content: `vs. ${(z = o(w).defaultCompareType) == null ? void 0 : z.split("_").join(" ")}`,
474
+ placement: "right",
475
+ "hide-arrow": "",
476
+ variant: "plain"
477
+ }, {
478
+ default: Y(() => [
479
+ S.value ? (A(), j(b, {
480
+ key: 0,
481
+ icon: S.value.icon.name,
482
+ class: Me(`bg-${S.value.icon.tailwind}`),
483
+ compact: ""
484
+ }, {
485
+ default: Y(() => [
486
+ I(x, {
487
+ name: S.value.icon.name,
488
+ color: S.value.icon.color
489
+ }, null, 8, ["name", "color"]),
490
+ M("p", {
491
+ class: "fm-typo-en-body-md-600",
492
+ style: he({ color: S.value.icon.color })
493
+ }, Ee(S.value.value), 5)
494
+ ]),
495
+ _: 1
496
+ }, 8, ["icon", "class"])) : be("", !0),
497
+ o(t).endDate !== null && o(t).startDate !== null && S.value === null ? (A(), j(b, {
498
+ key: 1,
499
+ compact: ""
500
+ }, {
501
+ default: Y(() => [
502
+ I(x, {
503
+ name: "arrow_upward",
504
+ color: "#C7C7CC"
505
+ }),
506
+ r[0] || (r[0] = M("p", { class: "fm-typo-en-body-md-600 text-fm-color-typo-disabled" }, "N/A", -1))
507
+ ]),
508
+ _: 1
509
+ })) : be("", !0)
510
+ ]),
511
+ _: 1
512
+ }, 8, ["content"])
513
+ ]),
514
+ s.value ? (A(), O("div", ka, [
515
+ F(s.value.type) === "line" ? (A(), j(h, {
516
+ key: 0,
517
+ class: "sparkline",
518
+ datasets: c.value,
519
+ legend: {
520
+ display: !1
521
+ },
522
+ datalabels: { display: !1 },
523
+ "x-axis": { categories: s.value.dimensions },
524
+ "y-cfg": { display: !1 },
525
+ "x-cfg": { display: !1 },
526
+ "maintain-aspect-ratio": !1
527
+ }, null, 8, ["datasets", "x-axis"])) : be("", !0)
528
+ ])) : (A(), O("div", Ta, r[1] || (r[1] = [
529
+ M("div", { class: "sparkline" }, [
530
+ M("div", { class: "flex flex-col gap-8" }, [
531
+ M("div"),
532
+ M("div")
533
+ ]),
534
+ M("div", { class: "grow" })
535
+ ], -1)
536
+ ])))
537
+ ]);
538
+ };
539
+ }
540
+ }), Fa = {};
541
+ function Ra(e, n) {
542
+ const m = H("FmMenuDivider");
543
+ return A(), j(m);
544
+ }
545
+ const La = /* @__PURE__ */ fa(Fa, [["render", Ra]]), za = "mf-reporttable-dimension", _t = ma(za, () => {
546
+ const e = u(0), n = u([]), m = u(!1), t = (d, l) => {
547
+ e.value = d, R(d, l);
548
+ }, w = (d, l, y, g) => {
549
+ n[d] = l, n.value = [...n.value], C(d, l, y, g);
550
+ }, R = (d, l) => {
551
+ const y = (l == null ? void 0 : l.querySelectorAll("thead tr")) ?? [], g = (l == null ? void 0 : l.querySelectorAll("tbody tr")) ?? [];
552
+ [...y, ...g].forEach((V) => {
553
+ const $ = V;
554
+ $ && ($.style.height = `${d}px`);
555
+ });
556
+ }, C = (d, l, y, g = !1) => {
557
+ const k = (y == null ? void 0 : y.querySelectorAll("th")) ?? [];
558
+ if (d === void 0) return;
559
+ const V = k[d], $ = g ? n[d] : l;
560
+ if (!V || $ === void 0) return;
561
+ const P = () => {
562
+ V.style.width = `${$}px`;
563
+ };
564
+ g ? requestAnimationFrame(P) : P();
565
+ }, S = () => {
566
+ const d = document.querySelectorAll("th"), l = document.querySelectorAll("td"), y = document.querySelector("table");
567
+ y == null || y.classList.add("table-fixed"), d.forEach((g) => g.classList.add("toggleEditResize")), l.forEach((g) => g.classList.add("toggleEditResize")), m.value = !0;
568
+ }, F = () => {
569
+ const d = document.querySelectorAll("th"), l = document.querySelectorAll("td"), y = document.querySelectorAll(".col-resize-handle"), g = document.querySelectorAll(".row-resize-handle");
570
+ d.forEach((k) => k.classList.remove("toggleEditResize")), l.forEach((k) => k.classList.remove("toggleEditResize")), y.forEach((k) => k.remove()), g.forEach((k) => k.remove()), m.value = !1;
571
+ }, s = () => {
572
+ e.value = 0, n.value = [];
573
+ }, c = (d, l) => {
574
+ if (l) {
575
+ const y = document.querySelectorAll(`thead th:nth-child(${d + 1})`), g = document.querySelectorAll(`tbody td:nth-child(${d + 1})`);
576
+ [...y, ...g].forEach((k) => {
577
+ k.classList.add("highlight-hover-col");
578
+ });
579
+ } else
580
+ document.querySelectorAll(
581
+ `thead th:nth-child(${d + 1}), tbody td:nth-child(${d + 1})`
582
+ ).forEach((y) => y.classList.add("highlight-col"));
583
+ }, i = (d) => {
584
+ const l = document.querySelectorAll("thead tr"), y = document.querySelectorAll("tbody tr"), g = [...l, ...y];
585
+ for (const k of g)
586
+ d ? k.classList.add("highlight-hover-row") : k.classList.add("highlight-row");
587
+ }, r = (d) => {
588
+ const l = d ? ".highlight-hover-row" : ".highlight-row", y = document.querySelectorAll(l);
589
+ for (const g of y)
590
+ g.classList.remove(l.slice(1));
591
+ }, x = (d) => {
592
+ d ? document.querySelectorAll(".highlight-hover-col").forEach((l) => {
593
+ l.classList.remove("highlight-hover-col");
594
+ }) : document.querySelectorAll(".highlight-col").forEach((l) => l.classList.remove("highlight-col"));
595
+ }, b = (d, l) => {
596
+ const y = /* @__PURE__ */ new Map(), g = d.clientX, k = d.target.closest("table"), V = k == null ? void 0 : k.querySelectorAll("th")[l], $ = V == null ? void 0 : V.getBoundingClientRect().width, P = y.get(l) ? n[l.toString()] || 60 : (y.set(l, !0), $ || n[l.toString()] || 60), N = V == null ? void 0 : V.querySelector("p");
597
+ if (!N) return;
598
+ const ie = N.textContent || "", Z = window.getComputedStyle(N), ce = `${Z.fontWeight} ${Z.fontSize} ${Z.fontFamily}`, ee = document.createElement("canvas").getContext("2d");
599
+ if (!ee) return;
600
+ ee.font = ce;
601
+ const p = ee.measureText(ie), T = window.getComputedStyle(V), E = parseFloat(T.paddingLeft || "0"), D = parseFloat(T.paddingRight || "0"), W = p.width + E + D;
602
+ c(l, !1);
603
+ const L = (te) => {
604
+ const ae = te.clientX - g, Q = Math.max(W, P + ae);
605
+ if (k) {
606
+ w(l, Q, k, !0);
607
+ let K = 0;
608
+ k.querySelectorAll("th").forEach((fe, ve) => {
609
+ K += ve === l ? Q : n[ve] || fe.getBoundingClientRect().width;
610
+ }), k.classList.remove("w-full"), k.style.width = `${K}px`;
611
+ const ue = k == null ? void 0 : k.parentElement;
612
+ if (ue) {
613
+ const fe = ue.scrollWidth, ve = ue.scrollLeft;
614
+ ue.offsetWidth + ve >= fe - 100 && (ue.scrollLeft = fe);
615
+ }
616
+ }
617
+ }, U = () => {
618
+ const te = (k == null ? void 0 : k.querySelectorAll("th")) ?? [], ae = [...n.value];
619
+ te.forEach((Q, K) => {
620
+ const Ce = Q.getBoundingClientRect().width;
621
+ n[K] = Ce, ae[K] = Ce;
622
+ }), n.value = ae, x(!1), document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", U);
623
+ };
624
+ document.addEventListener("mousemove", L), document.addEventListener("mouseup", U);
625
+ }, v = (d) => {
626
+ const l = d.clientY, y = d.target.closest("table"), g = e.value || 48;
627
+ i(!1);
628
+ const k = ($) => {
629
+ const P = Math.max(30, g + ($.clientY - l));
630
+ y && t(P, y);
631
+ }, V = () => {
632
+ r(!1), document.removeEventListener("mousemove", k), document.removeEventListener("mouseup", V);
633
+ };
634
+ document.addEventListener("mousemove", k), document.addEventListener("mouseup", V);
635
+ };
636
+ return {
637
+ rowHeight: e,
638
+ colWidths: n,
639
+ isEditing: m,
640
+ updateRowHeight: t,
641
+ updateColWidth: w,
642
+ setRowHeights: R,
643
+ setColWidths: C,
644
+ enableEditMode: S,
645
+ disableEditMode: F,
646
+ resetStore: s,
647
+ highlightCol: c,
648
+ highlightRows: i,
649
+ removeRowHighlight: r,
650
+ removeColHighlight: x,
651
+ resizeCol: b,
652
+ resizeRow: v,
653
+ enableCellResizing: () => {
654
+ const d = document.querySelector("thead"), l = document.querySelectorAll("thead tr"), y = document.querySelectorAll("tbody tr"), g = [...l, ...y];
655
+ d && d.classList.remove("sticky");
656
+ const k = (V, $) => {
657
+ const P = document.createElement("div");
658
+ return P.className = `${V}-resize-handle`, V === "col" ? (P.addEventListener("mouseenter", () => c($, !0)), P.addEventListener("mouseleave", () => x(!0)), P.addEventListener("mousedown", (N) => {
659
+ N.stopPropagation(), b(N, $);
660
+ })) : (P.addEventListener("mouseenter", () => i(!0)), P.addEventListener("mouseleave", () => r(!0)), P.addEventListener("mousedown", (N) => {
661
+ N.stopPropagation(), v(N);
662
+ })), P;
663
+ };
664
+ g.forEach((V) => {
665
+ const $ = V.closest("thead") !== null;
666
+ V.querySelectorAll($ ? "th" : "td").forEach((N, ie) => {
667
+ const Z = k("col", ie), ce = k("row", ie);
668
+ N.appendChild(Z), N.appendChild(ce);
669
+ });
670
+ }), S();
671
+ },
672
+ cancelResizingChanges: () => {
673
+ F();
674
+ }
675
+ };
676
+ });
677
+ function Ze(e) {
678
+ if (e == null || e === "")
679
+ return "";
680
+ const n = String(e), m = Number(n);
681
+ if (isNaN(m)) return n;
682
+ const [t, w] = n.split("."), R = new Intl.NumberFormat("en-US").format(Number(t));
683
+ return w !== void 0 ? `${R}.${w}` : R;
684
+ }
685
+ const Da = "/assets/processTableData.worker-D-lgWpiT.js", Wa = { class: "my-4" }, Aa = {
686
+ class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
687
+ style: { backgroundColor: "#f9f9f9" }
688
+ }, Ea = { class: "font-bold" }, Va = { class: "text-fm-color-neutral-gray-300" }, Ha = /* @__PURE__ */ se({
689
+ __name: "WidgetTable",
690
+ props: /* @__PURE__ */ me({
691
+ tileIndex: {}
692
+ }, {
693
+ modelValue: { required: !0 },
694
+ modelModifiers: {}
695
+ }),
696
+ emits: ["update:modelValue"],
697
+ setup(e) {
698
+ const { t: n, te: m } = qe(), t = re(e, "modelValue"), { country: w } = nt(), { clearTileSorts: R, setTileSorts: C } = ca(), S = st(), F = e, s = u([]), { isEditing: c, colWidths: i, rowHeight: r } = Le(_t()), { setColWidths: x, setRowHeights: b, enableCellResizing: v } = _t(), h = u(null), z = f(() => {
699
+ var p;
700
+ return ((p = t.value.data) == null ? void 0 : p.columns) || [{ label: "", key: "" }];
701
+ }), d = f(() => {
702
+ var p;
703
+ return ((p = t.value.data) == null ? void 0 : p.rows) || [];
704
+ }), l = f(() => t.value.filterText), y = f(() => {
705
+ var p, T;
706
+ if (!(l.value && l.value.trim().length > 0 || !((p = d.value[0]) != null && p.isRollup) && !((T = d.value[d.value.length - 1]) != null && T.isRollup))) {
707
+ if (t.value.rollupPosition === ye.top || t.value.rollupPosition === void 0)
708
+ return ye.top;
709
+ if (t.value.rollupPosition === ye.bottom)
710
+ return ye.bottom;
711
+ }
712
+ }), g = f(() => {
713
+ const D = y.value !== void 0 ? 1 : 0, W = (h.value ? h.value.$el.offsetHeight : 0) - 48;
714
+ return Math.floor((W - 34.5 - 32) / 48) - D;
715
+ }), k = f(() => {
716
+ var T, E;
717
+ let p = [];
718
+ switch (y.value) {
719
+ case ye.top:
720
+ p = [...((T = d.value[0]) == null ? void 0 : T.cells) || []].map((D, W) => {
721
+ var L;
722
+ return {
723
+ main: D,
724
+ comparison: (L = d.value[0]) == null ? void 0 : L.comparisonCells[W],
725
+ rowType: z.value[W].type
726
+ };
727
+ });
728
+ break;
729
+ case ye.bottom:
730
+ p = [...((E = d.value[d.value.length - 1]) == null ? void 0 : E.cells) || []].map((D, W) => {
731
+ var L;
732
+ return {
733
+ main: D,
734
+ comparison: (L = d.value[0]) == null ? void 0 : L.comparisonCells[W],
735
+ rowType: z.value[W].type
736
+ };
737
+ });
738
+ break;
739
+ }
740
+ return p.length > 0 && p[0].main === "" && (p[0].main = "Grand total"), p;
741
+ });
742
+ function V(p) {
743
+ let T = (p == null ? void 0 : p.main) || "";
744
+ return T.includes("#") && !T.startsWith("#") && (T = T.split("#")[0]), !p || p.main === "" || p.comparison === "" ? {
745
+ main: T
746
+ } : {
747
+ main: T,
748
+ comparison: p == null ? void 0 : p.comparison,
749
+ difference: zt(p.main, p.comparison, w)
750
+ };
751
+ }
752
+ we(() => {
753
+ R();
754
+ });
755
+ const $ = u([]);
756
+ let P = 0, N;
757
+ function ie() {
758
+ var W;
759
+ if (!((W = t.value) != null && W.data)) {
760
+ $.value = [];
761
+ return;
762
+ }
763
+ const p = ++P, T = (t.value.data.rows || []).map((L) => ({
764
+ isRollup: L.isRollup,
765
+ cells: Array.isArray(L.cells) ? [...L.cells] : [],
766
+ comparisonCells: Array.isArray(L.comparisonCells) ? [...L.comparisonCells] : []
767
+ })), E = (t.value.data.columns || []).map((L) => ({
768
+ key: L.key,
769
+ type: L.type,
770
+ label: L.label
771
+ })), D = {
772
+ rows: T,
773
+ columns: E,
774
+ filter: l.value ?? "",
775
+ globalSorts: aa(s.value).map((L) => ({
776
+ key: L.key,
777
+ type: L.type
778
+ })),
779
+ grandTotalPosition: y.value,
780
+ pageSize: g.value
781
+ };
782
+ ua(Da, D).then((L) => {
783
+ p === P && (L != null && L.error ? (S.open({ message: "Failed to process table data. Please retry.", type: "error" }), console.log(L.error), $.value = []) : $.value = la(L.data || []));
784
+ });
785
+ }
786
+ G(
787
+ () => s.value,
788
+ (p) => {
789
+ F.tileIndex === void 0 || F.tileIndex === null || C(F.tileIndex, p);
790
+ },
791
+ { immediate: !0, deep: !0 }
792
+ );
793
+ const Z = f(() => {
794
+ var E, D;
795
+ const p = ((E = t.value.data) == null ? void 0 : E.rows) || [], T = ((D = t.value.data) == null ? void 0 : D.columns) || [];
796
+ return JSON.stringify({
797
+ rowsLength: p.length,
798
+ columns: T.map((W) => ({ key: W.key, type: W.type, label: W.label })),
799
+ filter: l.value ?? "",
800
+ globalSorts: s.value.map((W) => ({ key: W.key, type: W.type })),
801
+ grandTotalPosition: y.value,
802
+ pageSize: g.value
803
+ });
804
+ });
805
+ G(
806
+ () => Z.value,
807
+ () => {
808
+ clearTimeout(N), N = setTimeout(ie, 200);
809
+ },
810
+ { immediate: !0 }
811
+ );
812
+ function ce(p) {
813
+ const T = s.value.find((E) => E.key === p);
814
+ if (!T) {
815
+ s.value.push({ key: p, type: Ae.Asc });
816
+ return;
817
+ }
818
+ T.type === Ae.Asc ? T.type = Ae.Desc : T.type === Ae.Desc && (s.value = s.value.filter((E) => E.key !== p));
819
+ }
820
+ const pe = f(
821
+ () => {
822
+ var p;
823
+ return (((p = t.value.colWidths) == null ? void 0 : p.length) ?? 0) > 0 || i.value.length > 0;
824
+ }
825
+ ), ee = f(() => {
826
+ var p;
827
+ return (p = t.value.data) != null && p.columns ? t.value.data.columns.map((T) => {
828
+ const E = Re(n, m, T.label, "other"), D = s.value.find((U) => U.key === T.key), W = !!D, L = W ? D.type === Ae.Asc ? "arrow_upward" : "arrow_downward" : "unfold_more";
829
+ return {
830
+ accessorKey: T.key,
831
+ header: () => {
832
+ const U = H("FmIcon");
833
+ return Be(
834
+ "button",
835
+ {
836
+ type: "button",
837
+ class: `w-full flex items-center gap-1 group/select-header select-none ${T.type === "NUMERIC" ? "justify-end" : "justify-start"} ${W ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-400"}`,
838
+ onClick: () => ce(T.key)
839
+ },
840
+ [
841
+ Be(
842
+ "span",
843
+ { class: `${T.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap` },
844
+ E
845
+ ),
846
+ Be(U, {
847
+ name: L,
848
+ color: W ? "primary" : "neutral-gray-400",
849
+ size: "sm",
850
+ class: "transition-transform",
851
+ style: L === "arrow_upward" ? "transform: translateY(-1px);" : ""
852
+ })
853
+ ]
854
+ );
855
+ },
856
+ cell: (U) => {
857
+ var Q, K;
858
+ const te = V(U.getValue()), ae = (K = (Q = U == null ? void 0 : U.row) == null ? void 0 : Q.original) == null ? void 0 : K.isRollup;
859
+ return Be(
860
+ "div",
861
+ {
862
+ class: [
863
+ ae ? "fm-typo-en-body-md-600 text-fm-color-typo-secondary" : "fm-typo-en-body-md-400",
864
+ T.type === "NUMERIC" ? "text-right" : "",
865
+ pe.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
866
+ ].join(" ")
867
+ },
868
+ [T.type === "NUMERIC" ? Ze(te.main) : te.main]
869
+ );
870
+ },
871
+ enableSorting: !1
872
+ };
873
+ }) : [];
874
+ });
875
+ return G(
876
+ () => i.value.length > 0,
877
+ async (p) => {
878
+ p && c.value && (await J(), v());
879
+ }
880
+ ), G(
881
+ [() => ee.value],
882
+ async () => {
883
+ var W;
884
+ await J();
885
+ const p = (W = h.value) == null ? void 0 : W.$el;
886
+ if (!p) return;
887
+ const T = p.querySelector("table");
888
+ if (!T) return;
889
+ T.classList.add(pe.value ? "table-fixed" : "table-auto");
890
+ let E, D;
891
+ c.value ? (v(), E = i.value, D = r.value) : (D = t.value.rowHeight, E = t.value.colWidths), typeof D == "number" && b(D, p), E == null || E.forEach((L, U) => {
892
+ x(U, L, p);
893
+ });
894
+ },
895
+ { immediate: !0 }
896
+ ), (p, T) => {
897
+ const E = H("FmTable");
898
+ return A(), O(de, null, [
899
+ M("div", Wa, [
900
+ xe(p.$slots, "menu")
901
+ ]),
902
+ I(E, {
903
+ ref_key: "table",
904
+ ref: h,
905
+ "column-defs": ee.value,
906
+ "row-data": $.value,
907
+ "search-value": l.value,
908
+ "page-size": g.value,
909
+ "shrink-at": !1,
910
+ "force-mobile-footer": !0,
911
+ class: "scrollbar-hide-table"
912
+ }, {
913
+ "pin-top": Y(() => [
914
+ M("tbody", null, [
915
+ M("tr", Aa, [
916
+ (A(!0), O(de, null, Ft(k.value, (D, W) => (A(), O("td", {
917
+ key: `${o(Ie)()}_${W}`,
918
+ class: "h-[48px] text-fm-color-typo-primary px-16"
919
+ }, [
920
+ M("span", {
921
+ class: Me([
922
+ "items-center text-fm-color-typo-secondary gap-2",
923
+ D.rowType === "NUMERIC" ? "text-right" : "",
924
+ pe.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
925
+ ])
926
+ }, [
927
+ M("p", Ea, Ee(D.rowType === "NUMERIC" ? o(Ze)(D.main) : D.main), 1),
928
+ M("p", Va, Ee(D.comparison ? D.rowType === "NUMERIC" ? `(${o(Ze)(D.comparison)})` : `(${D.comparison})` : ""), 1)
929
+ ], 2)
930
+ ]))), 128))
931
+ ])
932
+ ])
933
+ ]),
934
+ _: 1
935
+ }, 8, ["column-defs", "row-data", "search-value", "page-size"])
936
+ ], 64);
937
+ };
938
+ }
939
+ }), $a = /* @__PURE__ */ se({
940
+ __name: "WidgetStackBarChart",
941
+ props: /* @__PURE__ */ me({
942
+ tileIndex: {}
943
+ }, {
944
+ modelValue: { required: !0 },
945
+ modelModifiers: {}
946
+ }),
947
+ emits: ["update:modelValue"],
948
+ setup(e) {
949
+ const n = e, m = re(e, "modelValue"), t = u(null), w = f(() => {
950
+ var z;
951
+ return ((z = m.value.data) == null ? void 0 : z.xAxis) || [];
952
+ }), R = f(() => {
953
+ var h;
954
+ return ((h = m.value.data) == null ? void 0 : h.datasets) ?? [];
955
+ }), { datalabels: C, xCfg: S, yCfg: F, isTransposed: s, legend: c, chartWidth: i, chartHeight: r } = He(
956
+ m.value
957
+ ), x = f(() => R.value.length > 0 ? [
958
+ ...R.value.map((h, z) => {
959
+ let d = h.values;
960
+ return {
961
+ label: h.name,
962
+ data: d,
963
+ dash: !!h.isCompare,
964
+ backgroundColor: ne({ index: z, isCompare: h.isCompare })
965
+ };
966
+ })
967
+ ] : []), b = Ve();
968
+ function v() {
969
+ return b.extractChartSize(t.value, n.tileIndex) || { width: 0, height: 0 };
970
+ }
971
+ return we(() => {
972
+ J(() => {
973
+ v();
974
+ });
975
+ }), G([x], () => {
976
+ J(() => v());
977
+ }), (h, z) => {
978
+ const d = H("FmBarChart");
979
+ return A(), O(de, null, [
980
+ xe(h.$slots, "menu"),
981
+ I(d, {
982
+ ref_key: "chartRef",
983
+ ref: t,
984
+ class: "bar-chart",
985
+ datasets: x.value,
986
+ "x-axis": { categories: w.value },
987
+ "x-cfg": o(S),
988
+ "y-cfg": o(F),
989
+ transpose: o(s),
990
+ stacked: !0,
991
+ legend: {
992
+ display: o(c).display ?? !1,
993
+ position: o(c).position,
994
+ maxHeight: o(c).maxHeight,
995
+ maxWidth: o(c).maxWidth,
996
+ labels: o(c).labels
997
+ },
998
+ datalabels: o(C),
999
+ "maintain-aspect-ratio": !1,
1000
+ style: he({
1001
+ "--chart-width": o(i) !== void 0 ? o(i) + "px" : "100%",
1002
+ "--chart-height": o(r) !== void 0 ? o(r) + "px" : "calc(100% - 36px)"
1003
+ })
1004
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1005
+ ], 64);
1006
+ };
1007
+ }
1008
+ }), Pa = /* @__PURE__ */ se({
1009
+ __name: "WidgetStackLineChart",
1010
+ props: /* @__PURE__ */ me({
1011
+ tileIndex: {}
1012
+ }, {
1013
+ modelValue: { required: !0 },
1014
+ modelModifiers: {}
1015
+ }),
1016
+ emits: ["update:modelValue"],
1017
+ setup(e) {
1018
+ var d;
1019
+ const n = e, m = re(e, "modelValue"), t = ((d = m.value.data) == null ? void 0 : d.xAxis) ?? [], w = f(
1020
+ () => t.length === 1 && S.value.length > 0 && S.value.every((l) => l.values.length === 1)
1021
+ ), R = f(() => w.value ? ["", t[0], ""] : t), C = u(null), S = f(() => {
1022
+ var l;
1023
+ return ((l = m.value.data) == null ? void 0 : l.datasets) ?? [];
1024
+ }), { datalabels: F, xCfg: s, yCfg: c, isTransposed: i, legend: r, chartWidth: x, chartHeight: b } = He(
1025
+ m.value
1026
+ ), v = f(() => S.value.length > 0 ? [
1027
+ ...S.value.map((l, y) => {
1028
+ let g = l.values;
1029
+ return w.value && (g = [NaN, g[0], NaN]), {
1030
+ label: l.name,
1031
+ data: g,
1032
+ dash: l.isCompare,
1033
+ fill: !1,
1034
+ color: ne({ index: y, isCompare: l.isCompare }),
1035
+ pointRadius: w.value ? 4 : void 0,
1036
+ pointHoverRadius: w.value ? 6 : void 0,
1037
+ pointBackgroundColor: w.value ? ne({ index: y, isCompare: l.isCompare }) : void 0,
1038
+ pointBorderColor: w.value ? ne({ index: y, isCompare: l.isCompare }) : void 0,
1039
+ pointBorderWidth: w.value ? 2 : void 0
1040
+ };
1041
+ })
1042
+ ] : []), h = Ve();
1043
+ function z() {
1044
+ return h.extractChartSize(C.value, n.tileIndex) || { width: 0, height: 0 };
1045
+ }
1046
+ return we(() => {
1047
+ J(() => {
1048
+ z();
1049
+ });
1050
+ }), G([v], () => {
1051
+ J(() => z());
1052
+ }), (l, y) => {
1053
+ const g = H("FmLineChart");
1054
+ return A(), O(de, null, [
1055
+ xe(l.$slots, "menu"),
1056
+ I(g, {
1057
+ ref_key: "chartRef",
1058
+ ref: C,
1059
+ class: "line-chart",
1060
+ datasets: v.value,
1061
+ "x-axis": { categories: R.value },
1062
+ "x-cfg": o(s),
1063
+ "y-cfg": o(c),
1064
+ transpose: o(i),
1065
+ legend: {
1066
+ display: o(r).display ?? !1,
1067
+ position: o(r).position,
1068
+ maxHeight: o(r).maxHeight,
1069
+ maxWidth: o(r).maxWidth,
1070
+ labels: o(r).labels
1071
+ },
1072
+ stacked: !0,
1073
+ datalabels: o(F),
1074
+ "maintain-aspect-ratio": !1,
1075
+ style: he({
1076
+ "--chart-width": o(x) !== void 0 ? o(x) + "px" : "100%",
1077
+ "--chart-height": o(b) !== void 0 ? o(b) + "px" : "calc(100% - 36px)"
1078
+ })
1079
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1080
+ ], 64);
1081
+ };
1082
+ }
1083
+ }), ze = [
1084
+ "col-span-1",
1085
+ "col-span-2",
1086
+ "col-span-3",
1087
+ "col-span-4",
1088
+ "col-span-5",
1089
+ "col-span-6",
1090
+ "col-span-7",
1091
+ "col-span-8",
1092
+ "col-span-9",
1093
+ "col-span-10",
1094
+ "col-span-11",
1095
+ "col-span-12"
1096
+ ];
1097
+ function Ba(e) {
1098
+ return e < 12 ? ze[e - 1] : ze[11];
1099
+ }
1100
+ function Ia(e) {
1101
+ return e < 12 ? ze[Math.min(11, e * 2 - 1)] : ze[11];
1102
+ }
1103
+ function Ma(e) {
1104
+ return e < 12 ? ze[Math.min(11, e * 3 - 1)] : ze[11];
1105
+ }
1106
+ const Na = /* @__PURE__ */ se({
1107
+ __name: "WidgetLinechart",
1108
+ props: /* @__PURE__ */ me({
1109
+ tileIndex: {}
1110
+ }, {
1111
+ modelValue: { required: !0 },
1112
+ modelModifiers: {}
1113
+ }),
1114
+ emits: ["update:modelValue"],
1115
+ setup(e) {
1116
+ var d;
1117
+ const n = e, m = re(e, "modelValue"), t = ((d = m.value.data) == null ? void 0 : d.xAxis) ?? [], w = f(
1118
+ () => t.length === 1 && S.value.length > 0 && S.value.every((l) => l.values.length === 1)
1119
+ ), R = f(() => w.value ? ["", t[0], ""] : t), C = u(null), S = f(() => {
1120
+ var l;
1121
+ return ((l = m.value.data) == null ? void 0 : l.datasets) ?? [];
1122
+ }), { datalabels: F, xCfg: s, yCfg: c, isTransposed: i, legend: r, chartWidth: x, chartHeight: b } = He(
1123
+ m.value
1124
+ ), v = f(() => S.value.length > 0 ? [
1125
+ ...S.value.map((l, y) => {
1126
+ let g = l.values;
1127
+ return w.value && (g = [NaN, g[0], NaN]), {
1128
+ label: l.name,
1129
+ data: g,
1130
+ dash: !!l.isCompare,
1131
+ fill: !1,
1132
+ color: ne({ index: y, isCompare: l.isCompare }),
1133
+ pointRadius: w.value ? 4 : void 0,
1134
+ pointHoverRadius: w.value ? 6 : void 0,
1135
+ pointBackgroundColor: w.value ? ne({ index: y, isCompare: l.isCompare }) : void 0,
1136
+ pointBorderColor: w.value ? ne({ index: y, isCompare: l.isCompare }) : void 0,
1137
+ pointBorderWidth: w.value ? 2 : void 0
1138
+ };
1139
+ })
1140
+ ] : []), h = Ve();
1141
+ function z() {
1142
+ return h.extractChartSize(C.value, n.tileIndex) || { width: 0, height: 0 };
1143
+ }
1144
+ return we(() => {
1145
+ J(() => {
1146
+ z();
1147
+ });
1148
+ }), G([v], () => {
1149
+ J(() => z());
1150
+ }), (l, y) => {
1151
+ const g = H("FmLineChart");
1152
+ return A(), O(de, null, [
1153
+ xe(l.$slots, "menu"),
1154
+ I(g, {
1155
+ ref_key: "chartRef",
1156
+ ref: C,
1157
+ class: "line-chart",
1158
+ datasets: v.value,
1159
+ "x-axis": { categories: R.value },
1160
+ "x-cfg": o(s),
1161
+ "y-cfg": o(c),
1162
+ transpose: o(i),
1163
+ legend: {
1164
+ display: o(r).display ?? !1,
1165
+ position: o(r).position,
1166
+ maxHeight: o(r).maxHeight,
1167
+ maxWidth: o(r).maxWidth,
1168
+ labels: o(r).labels
1169
+ },
1170
+ datalabels: o(F),
1171
+ "maintain-aspect-ratio": !1,
1172
+ style: he({
1173
+ "--chart-width": o(x) !== void 0 ? o(x) + "px" : "100%",
1174
+ "--chart-height": o(b) !== void 0 ? o(b) + "px" : "calc(100% - 36px)"
1175
+ })
1176
+ }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "datalabels", "style"])
1177
+ ], 64);
1178
+ };
1179
+ }
1180
+ }), qa = { class: "flex flex-col gap-16" }, Ua = { class: "flex flex-row" }, Oa = /* @__PURE__ */ se({
1181
+ __name: "PdfOrientationDialog",
1182
+ props: /* @__PURE__ */ me({
1183
+ reportType: {},
1184
+ index: {}
1185
+ }, {
1186
+ modelValue: { type: Boolean, required: !0 },
1187
+ modelModifiers: {}
1188
+ }),
1189
+ emits: ["update:modelValue"],
1190
+ setup(e) {
1191
+ const { t: n } = qe(), { FmForm: m } = pa, t = e, w = u(), R = re(e, "modelValue"), C = u(!0), S = u(!1), F = st(), { selectedLocationIds: s, dateRange: c, timeRange: i } = Le(Ne()), r = u(Je.PORTRAIT);
1192
+ function x() {
1193
+ var v;
1194
+ (v = w.value) == null || v.validateInputs();
1195
+ }
1196
+ async function b() {
1197
+ S.value = !0;
1198
+ try {
1199
+ t.index != null && await Rt({
1200
+ reportType: t.reportType,
1201
+ index: t.index,
1202
+ orientationTypes: [r.value],
1203
+ isCombinedLocationLayout: C.value,
1204
+ timeRange: i.value,
1205
+ dateRange: c.value,
1206
+ locationIds: s.value
1207
+ });
1208
+ } catch (v) {
1209
+ F.open({ message: v.message, type: "error" });
1210
+ } finally {
1211
+ S.value = !1;
1212
+ }
1213
+ }
1214
+ return (v, h) => {
1215
+ const z = H("FmRadio"), d = H("FmRadioGroup"), l = H("FmButton"), y = H("FmDialog");
1216
+ return A(), j(y, {
1217
+ modelValue: R.value,
1218
+ "onUpdate:modelValue": h[2] || (h[2] = (g) => R.value = g),
1219
+ overlay: !0,
1220
+ "z-index": 10
1221
+ }, {
1222
+ "dialog-header": Y(() => h[3] || (h[3] = [
1223
+ oa("Select Orientation")
1224
+ ])),
1225
+ default: Y(() => [
1226
+ I(o(m), {
1227
+ ref_key: "form",
1228
+ ref: w,
1229
+ onValidationSuccess: b
1230
+ }, {
1231
+ default: Y(() => [
1232
+ M("div", qa, [
1233
+ I(d, {
1234
+ modelValue: r.value,
1235
+ "onUpdate:modelValue": h[0] || (h[0] = (g) => r.value = g)
1236
+ }, {
1237
+ default: Y(() => [
1238
+ I(z, {
1239
+ value: o(Je).PORTRAIT,
1240
+ label: o(n)("report.common.portrait")
1241
+ }, null, 8, ["value", "label"]),
1242
+ I(z, {
1243
+ value: o(Je).LANDSCAPE,
1244
+ label: o(n)("report.common.landscape")
1245
+ }, null, 8, ["value", "label"])
1246
+ ]),
1247
+ _: 1
1248
+ }, 8, ["modelValue"])
1249
+ ]),
1250
+ M("div", Ua, [
1251
+ h[4] || (h[4] = M("div", { class: "grow" }, null, -1)),
1252
+ I(l, {
1253
+ label: o(n)("report.common.cancel"),
1254
+ variant: "tertiary",
1255
+ onClick: h[1] || (h[1] = (g) => R.value = !1)
1256
+ }, null, 8, ["label"]),
1257
+ M("div", null, [
1258
+ I(l, {
1259
+ label: o(n)("report.common.download"),
1260
+ loading: S.value,
1261
+ onClick: x
1262
+ }, null, 8, ["label", "loading"])
1263
+ ])
1264
+ ])
1265
+ ]),
1266
+ _: 1
1267
+ }, 512)
1268
+ ]),
1269
+ _: 1
1270
+ }, 8, ["modelValue"]);
1271
+ };
1272
+ }
1273
+ }), Xa = {
1274
+ key: 1,
1275
+ class: "grow"
1276
+ }, Ya = {
1277
+ key: 2,
1278
+ class: "flex"
1279
+ }, ll = /* @__PURE__ */ se({
1280
+ __name: "DynamicWidget",
1281
+ props: /* @__PURE__ */ me({
1282
+ index: {
1283
+ type: Number,
1284
+ default: 0
1285
+ },
1286
+ hideExport: {
1287
+ type: Boolean,
1288
+ default: !1
1289
+ },
1290
+ customScreenWidth: {
1291
+ type: Number,
1292
+ required: !1,
1293
+ default: void 0
1294
+ }
1295
+ }, {
1296
+ modelValue: { required: !0, default: () => {
1297
+ } },
1298
+ modelModifiers: {}
1299
+ }),
1300
+ emits: ["update:modelValue"],
1301
+ setup(e) {
1302
+ const n = u(!0), m = re(e, "modelValue"), t = m.value.widget.config, { t: w, te: R } = qe(), C = e, S = u(null), F = u(t.rollup), s = u(Ie()), c = u(t.drillDimension), i = f(() => {
1303
+ if (ge.value.length > 0) {
1304
+ const a = ge.value.findIndex(
1305
+ (B) => B.value === c.value
1306
+ );
1307
+ return a >= 0 ? a : 0;
1308
+ } else
1309
+ return -1;
1310
+ }), r = f(() => i.value !== 0), x = f(
1311
+ () => i.value != ge.value.length - 1
1312
+ ), b = u(t.showTitle ?? !0), v = u(t.titleFontSize ?? 14), h = u(t.titleBold ?? !1), z = u(t.titleItalic ?? !1), d = u(t.titleUnderline ?? !1), l = u(t.chartWidth ?? void 0), y = u(t.chartHeight ?? void 0), g = u(t.showLabel ?? !1), k = u(t.labelAlign ?? tt.center), V = u(t.labelAnchor ?? et.center), $ = u(t.labelRotation ?? 0), P = u(t.labelOffset ?? 0), N = u(t.labelFontSize ?? 12), ie = f(() => t.showSearchBar), Z = u(t.showX ?? !0), ce = u(t.xPosition ?? at.bottom), pe = u(t.showXGrid ?? !1), ee = u(t.showXTick ?? !0), p = u(t.xTickFontSize ?? 12), T = u(t.showXTitle ?? !1), E = u(t.xTitle ?? ""), D = u(t.xTitleFontSize ?? 12), W = u(t.showY ?? !0), L = u(t.yPosition ?? lt.left), U = u(t.showYGrid ?? !1), te = u(t.showYTick ?? !0), ae = u(t.yTickFontSize ?? 12), Q = u(t.showYTitle ?? !1), K = u(t.yTitle ?? ""), Ce = u(t.yTitleFontSize ?? 12), ue = u(t.showLegend ?? void 0), fe = u(t.legendPosition ?? ot.top), ve = u(t.usePointStyle ?? !0), Ue = u(t.legendMaxHeight), rt = u(t.legendMaxWidth), it = u(t.rowHeight ?? 0), ct = u(t.colWidths ?? []), Oe = u(!1), Xe = u(""), { breakpoints: Se, getBreakpointsBoundary: De } = Lt(), ut = u(), X = f(
1313
+ () => C.customScreenWidth === void 0 ? window.innerWidth : C.customScreenWidth
1314
+ ), Dt = f(
1315
+ () => (X == null ? void 0 : X.value) > De("xs")[1] && (X == null ? void 0 : X.value) <= De("sm")[1]
1316
+ ), Wt = f(
1317
+ () => (X == null ? void 0 : X.value) > De("sm")[1] && (X == null ? void 0 : X.value) <= De("md")[1]
1318
+ ), At = f(() => (X == null ? void 0 : X.value) > De("md")[1]), Et = f(() => {
1319
+ const a = m.value.size.width;
1320
+ return At.value || Wt.value ? Ba(a) : Dt.value ? Ia(a) : Ma(a);
1321
+ }), $e = f(
1322
+ () => va.find((a) => a.type === m.value.widget.type)
1323
+ ), ke = St(() => {
1324
+ var a;
1325
+ ut.value = qt((a = S.value) == null ? void 0 : a.$el.offsetWidth), s.value = Ie();
1326
+ }), Vt = f(() => {
1327
+ if (ga(q.value.type, Te.value))
1328
+ switch (m.value.widget.type) {
1329
+ case _.BarChart:
1330
+ return ba;
1331
+ case _.StackBarChart:
1332
+ return $a;
1333
+ case _.LineChart:
1334
+ return Na;
1335
+ case _.StackLineChart:
1336
+ return Pa;
1337
+ case _.Circular:
1338
+ return wa;
1339
+ case _.Scorecard:
1340
+ return _a;
1341
+ case _.Spacer:
1342
+ return La;
1343
+ case _.Table:
1344
+ return Ha;
1345
+ default:
1346
+ return kt;
1347
+ }
1348
+ else
1349
+ return kt;
1350
+ }), Te = u(null), {
1351
+ selectedLocationIds: Ye,
1352
+ dateRange: dt,
1353
+ compareDateRange: Ht,
1354
+ timeRange: ht,
1355
+ globalFilters: $t,
1356
+ isGlobalFiltersLoading: mt
1357
+ } = Le(Ne()), { businessId: Pt } = Le(nt()), { businessLoadedId: Bt, businessDataVersion: Ge } = Le(Ne());
1358
+ f(() => Bt.value === Pt.value && Ye.value.length > 0 && !mt.value);
1359
+ const It = u(!0), q = f(() => {
1360
+ const a = JSON.parse(JSON.stringify(m.value.widget));
1361
+ return {
1362
+ ...a,
1363
+ config: {
1364
+ ...a.config,
1365
+ rollup: F.value,
1366
+ drillDimension: c.value,
1367
+ showGrandTotal: !1
1368
+ }
1369
+ };
1370
+ });
1371
+ function Mt() {
1372
+ return {
1373
+ data: Te.value,
1374
+ showTitle: b.value,
1375
+ titleFontSize: v.value,
1376
+ titleBold: h.value,
1377
+ titleItalic: z.value,
1378
+ titleUnderline: d.value,
1379
+ chartHeight: y.value,
1380
+ chartWidth: l.value,
1381
+ showLabel: g.value,
1382
+ labelAnchor: V.value,
1383
+ labelAlign: k.value,
1384
+ labelRotation: $.value,
1385
+ labelOffset: P.value,
1386
+ labelFontSize: N.value,
1387
+ showX: Z.value,
1388
+ xPosition: ce.value,
1389
+ showXGrid: pe.value,
1390
+ showXTick: ee.value,
1391
+ xTickFontSize: p.value,
1392
+ showXTitle: T.value,
1393
+ xTitle: E.value,
1394
+ xTitleFontSize: D.value,
1395
+ showY: W.value,
1396
+ yPosition: L.value,
1397
+ showYGrid: U.value,
1398
+ showYTick: te.value,
1399
+ yTitle: K.value,
1400
+ showYTitle: Q.value,
1401
+ yTitleFontSize: Ce.value,
1402
+ yTickFontSize: ae.value,
1403
+ isTransposed: q.value.config.isTransposed,
1404
+ showLegend: ue.value,
1405
+ legendPosition: fe.value,
1406
+ usePointStyle: ve.value,
1407
+ legendMaxHeight: Ue.value,
1408
+ legendMaxWidth: rt.value
1409
+ };
1410
+ }
1411
+ function Nt() {
1412
+ return {
1413
+ data: Te.value,
1414
+ filterText: Xe.value,
1415
+ rollupPosition: q.value.config.rollupPosition,
1416
+ rowHeight: it.value,
1417
+ colWidths: ct.value
1418
+ };
1419
+ }
1420
+ const pt = f(() => {
1421
+ switch (q.value.type) {
1422
+ case _.Table:
1423
+ return Nt();
1424
+ case _.BarChart:
1425
+ case _.LineChart:
1426
+ case _.StackBarChart:
1427
+ case _.StackLineChart:
1428
+ case _.Circular:
1429
+ return Mt();
1430
+ default:
1431
+ return { data: Te.value };
1432
+ }
1433
+ }), ft = f(() => {
1434
+ const { config: a } = m.value.widget;
1435
+ if (a.rollup != null) {
1436
+ const B = [...a.dimensions].filter((le) => !le.hide);
1437
+ return B.sort(
1438
+ (le, We) => (a.rowIds || []).indexOf(Ke(le)) - (a.rowIds || []).indexOf(Ke(We))
1439
+ ), [
1440
+ { label: Re(w, R, "None", "other"), value: "none" },
1441
+ { label: Re(w, R, "Grand Total", "other"), value: 0 },
1442
+ ...[...B].slice(0, B.length - 1).map((le, We) => ({
1443
+ label: Re(w, R, le.label, "other"),
1444
+ value: We + 1
1445
+ }))
1446
+ ];
1447
+ }
1448
+ return [];
1449
+ }), ge = f(() => {
1450
+ const { config: a } = q.value;
1451
+ return a.isDrillable ? a.dimensions.map((B) => ({
1452
+ label: Re(w, R, B.label, "other"),
1453
+ value: Ke(B)
1454
+ })) : [];
1455
+ });
1456
+ G(
1457
+ () => m.value.widget.config,
1458
+ (a) => {
1459
+ F.value = a.rollup, b.value = a.showTitle ?? !0, v.value = a.titleFontSize ?? 14, h.value = a.titleBold ?? !1, z.value = a.titleItalic ?? !1, d.value = a.titleUnderline ?? !1, y.value = a.chartHeight ?? void 0, l.value = a.chartWidth ?? void 0, g.value = a.showLabel ?? !1, k.value = a.labelAlign ?? tt.center, V.value = a.labelAnchor ?? et.center, $.value = a.labelRotation ?? 0, P.value = a.labelOffset ?? 0, N.value = a.labelFontSize ?? 12, Z.value = a.showX ?? !0, ce.value = a.xPosition ?? at.bottom, pe.value = a.showXGrid ?? !1, ee.value = a.showXTick ?? !0, p.value = a.xTickFontSize ?? 12, T.value = a.showXTitle ?? !1, E.value = a.xTitle ?? "", D.value = a.xTitleFontSize ?? 12, W.value = a.showY ?? !0, L.value = a.yPosition ?? lt.left, U.value = a.showYGrid ?? !1, te.value = a.showYTick ?? !0, ae.value = a.yTickFontSize ?? 12, Q.value = a.showYTitle ?? !1, K.value = a.yTitle ?? "", Ce.value = a.yTitleFontSize ?? 12, ue.value = a.showLegend ?? void 0, fe.value = a.legendPosition ?? ot.top, ve.value = a.usePointStyle ?? !0, Ue.value = a.legendMaxHeight, rt.value = a.legendMaxWidth, it.value = a.rowHeight ?? 0, ct.value = a.colWidths ?? [];
1460
+ },
1461
+ { deep: !0 }
1462
+ ), G([() => F.value], () => {
1463
+ F.value !== null && (m.value.widget.config.rollup = F.value);
1464
+ }), G(
1465
+ [
1466
+ () => q.value,
1467
+ () => dt.value,
1468
+ () => ht.value,
1469
+ () => Ht.value,
1470
+ () => Ye.value,
1471
+ () => $t.value,
1472
+ () => Ge.value
1473
+ ],
1474
+ () => {
1475
+ gt();
1476
+ },
1477
+ { deep: !0 }
1478
+ ), G(
1479
+ [() => m.value.size],
1480
+ () => {
1481
+ ke();
1482
+ },
1483
+ { deep: !0 }
1484
+ ), we(() => {
1485
+ ke(), Se.value.sm || Se.value.md || Se.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", ke)) : addEventListener("resize", ke), gt();
1486
+ }), na(() => {
1487
+ Se.value.sm || Se.value.md || Se.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", ke)) : removeEventListener("resize", ke);
1488
+ });
1489
+ const vt = st();
1490
+ let Pe;
1491
+ async function gt() {
1492
+ if (q.value.config.schemaNames.length <= 0 && !(q.value.config.dimensions.length <= 0 || q.value.config.metrics.length <= 0)) {
1493
+ vt.open({
1494
+ message: "schema must not be empty and dimension or metrics must have at least 1 column",
1495
+ type: "info"
1496
+ }), n.value = !1;
1497
+ return;
1498
+ }
1499
+ try {
1500
+ n.value = !0, Pe && Pe.abort(), Pe = new AbortController();
1501
+ const a = Pe.signal, B = Ge.value, le = await St(da, 500)(q.value, a, m.value.id);
1502
+ Ge.value === B && (Te.value = le, s.value = Ie()), n.value = !1;
1503
+ } catch (a) {
1504
+ a.code !== "ERR_CANCELED" && (Te.value = null, vt.open({ message: `Invalid chart ${q.value.type}`, type: "error" }), console.log(a), n.value = !1);
1505
+ }
1506
+ }
1507
+ function qt(a) {
1508
+ switch (m.value.widget.type) {
1509
+ case "SPACER":
1510
+ return;
1511
+ case "SCORECARD":
1512
+ return;
1513
+ case "TABLE":
1514
+ return `${m.value.size.height * 100 + (ie.value ? 72 : 0) + 96.5}px`;
1515
+ }
1516
+ return `${Math.max(a / m.value.size.width, 90) * m.value.size.height}px`;
1517
+ }
1518
+ function Ut() {
1519
+ const a = i.value - 1;
1520
+ a >= 0 && (c.value = ge.value[a].value);
1521
+ }
1522
+ function Ot() {
1523
+ const a = i.value + 1;
1524
+ a >= 0 && a < ge.value.length && (c.value = ge.value[a].value);
1525
+ }
1526
+ const yt = u(Fe.EXCEL), bt = u(), Xt = Object.values(Fe).map((a) => ({
1527
+ label: ha(a),
1528
+ value: a,
1529
+ onClick: async () => {
1530
+ a === Fe.EXCEL || a === Fe.PDFFULLSIZE || a === Fe.PDFRECEIPT ? await Rt({
1531
+ reportType: a,
1532
+ index: C.index,
1533
+ isCombinedLocationLayout: It.value,
1534
+ timeRange: ht.value,
1535
+ dateRange: dt.value,
1536
+ locationIds: Ye.value
1537
+ }) : a === Fe.PDF && (yt.value = a, bt.value = C.index, Oe.value = !0);
1538
+ }
1539
+ })), Yt = q.value.type === _.Spacer ? "flat" : "outlined", Gt = q.value.type === _.Spacer ? "p-0" : "p-16";
1540
+ return (a, B) => {
1541
+ const le = H("FmTooltip"), We = H("FmSearch"), jt = H("FmCheckbox"), je = H("FmButton"), Jt = H("FmSelect"), Kt = H("FmMenuItem"), Zt = H("FmMenu"), Qt = H("FmForm"), ea = H("FmCircularProgress"), ta = H("FmCard");
1542
+ return A(), j(ta, {
1543
+ ref_key: "tileCard",
1544
+ ref: S,
1545
+ class: Me(`${Et.value} ${o(Gt)}`),
1546
+ variant: o(Yt)
1547
+ }, {
1548
+ default: Y(() => [
1549
+ I(Oa, {
1550
+ modelValue: Oe.value,
1551
+ "onUpdate:modelValue": B[0] || (B[0] = (_e) => Oe.value = _e),
1552
+ "report-type": yt.value,
1553
+ index: bt.value
1554
+ }, null, 8, ["modelValue", "report-type", "index"]),
1555
+ !n.value && !o(mt) ? (A(), O("div", {
1556
+ key: 0,
1557
+ style: he({ height: ut.value })
1558
+ }, [
1559
+ (A(), j(sa(Vt.value), {
1560
+ key: s.value,
1561
+ modelValue: pt.value,
1562
+ "onUpdate:modelValue": B[4] || (B[4] = (_e) => pt.value = _e),
1563
+ "tile-index": C.index
1564
+ }, {
1565
+ menu: Y(() => [
1566
+ I(Qt, { class: "flex items-center gap-2" }, {
1567
+ default: Y(() => {
1568
+ var _e, wt, xt, Ct;
1569
+ return [
1570
+ I(le, {
1571
+ variant: "plain",
1572
+ placement: "right",
1573
+ content: q.value.description,
1574
+ "hide-arrow": !0,
1575
+ disabled: !q.value.description
1576
+ }, {
1577
+ default: Y(() => [
1578
+ b.value !== !1 ? (A(), O("p", {
1579
+ key: 0,
1580
+ style: he({
1581
+ fontSize: v.value + "px",
1582
+ fontWeight: h.value ? "bold" : "normal",
1583
+ fontStyle: z.value ? "italic" : "normal",
1584
+ textDecoration: d.value ? "underline" : "none"
1585
+ }),
1586
+ class: Me(["text-fm-color-typo-secondary line-clamp-1", [
1587
+ v.value <= 18 ? "fm-typo-en-body-md-400" : "",
1588
+ q.value.description ? "border-b-2 border-dashed border-gray-300" : ""
1589
+ ]])
1590
+ }, Ee(o(Re)(o(w), o(R), q.value.title, "other")), 7)) : be("", !0)
1591
+ ]),
1592
+ _: 1
1593
+ }, 8, ["content", "disabled"]),
1594
+ (_e = $e.value) != null && _e.showSearchBar ? (A(), j(We, {
1595
+ key: 0,
1596
+ modelValue: Xe.value,
1597
+ "onUpdate:modelValue": B[1] || (B[1] = (oe) => Xe.value = oe),
1598
+ class: "grow"
1599
+ }, null, 8, ["modelValue"])) : (A(), O("div", Xa)),
1600
+ ra(I(jt, {
1601
+ modelValue: g.value,
1602
+ "onUpdate:modelValue": B[2] || (B[2] = (oe) => g.value = oe),
1603
+ label: "Label",
1604
+ value: !1
1605
+ }, null, 8, ["modelValue"]), [
1606
+ [ia, (wt = $e.value) == null ? void 0 : wt.showLabel]
1607
+ ]),
1608
+ (xt = $e.value) != null && xt.showDrillDimension && ge.value.length > 0 ? (A(), O("div", Ya, [
1609
+ I(je, {
1610
+ icon: "arrow_upward",
1611
+ variant: "tertiary",
1612
+ disabled: !r.value,
1613
+ onClick: Ut
1614
+ }, null, 8, ["disabled"]),
1615
+ I(je, {
1616
+ icon: "arrow_downward",
1617
+ variant: "tertiary",
1618
+ disabled: !x.value,
1619
+ onClick: Ot
1620
+ }, null, 8, ["disabled"])
1621
+ ])) : be("", !0),
1622
+ (Ct = $e.value) != null && Ct.showRollup && ft.value.length > 0 ? (A(), j(Jt, {
1623
+ key: 3,
1624
+ modelValue: F.value,
1625
+ "onUpdate:modelValue": B[3] || (B[3] = (oe) => F.value = oe),
1626
+ class: "w-[150px]",
1627
+ items: ft.value
1628
+ }, null, 8, ["modelValue", "items"])) : be("", !0),
1629
+ C.hideExport ? be("", !0) : (A(), j(Zt, {
1630
+ key: 4,
1631
+ shift: !0
1632
+ }, {
1633
+ "menu-button": Y(() => [
1634
+ I(je, {
1635
+ icon: "more_vert",
1636
+ variant: "tertiary"
1637
+ })
1638
+ ]),
1639
+ default: Y(() => [
1640
+ (A(!0), O(de, null, Ft(o(Xt), (oe) => (A(), j(Kt, {
1641
+ key: oe.value,
1642
+ label: oe.label,
1643
+ onClick: oe.onClick
1644
+ }, null, 8, ["label", "onClick"]))), 128))
1645
+ ]),
1646
+ _: 1
1647
+ }))
1648
+ ];
1649
+ }),
1650
+ _: 1
1651
+ })
1652
+ ]),
1653
+ _: 1
1654
+ }, 8, ["modelValue", "tile-index"]))
1655
+ ], 4)) : (A(), j(ea, { key: 1 }))
1656
+ ]),
1657
+ _: 1
1658
+ }, 8, ["class", "variant"]);
1659
+ };
1660
+ }
1661
+ });
1662
+ export {
1663
+ tt as L,
1664
+ ye as R,
1665
+ ll as _,
1666
+ et as a,
1667
+ Ke as g,
1668
+ _t as u
1669
+ };