@feedmepos/mf-report 5.22.1 → 5.22.2-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 (26) hide show
  1. package/dist/{App-BhnYqx70.js → App-kSo0wWAu.js} +40 -40
  2. package/dist/{BaseDialog.vue_vue_type_script_setup_true_lang-CS944KRI.js → BaseDialog.vue_vue_type_script_setup_true_lang-DZ2s2sZN.js} +6 -3
  3. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-BTLp5mIX.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-Bar8cWAx.js} +2 -2
  4. package/dist/{Default.vue_vue_type_script_setup_true_lang-DZ8JG_WH.js → Default.vue_vue_type_script_setup_true_lang-UHSJTVZA.js} +2 -2
  5. package/dist/FilterSelector.vue_vue_type_script_setup_true_lang-DWR6vEwp.js +4312 -0
  6. package/dist/{InsightView-U4O_o2_y.js → InsightView-lue87iV-.js} +6 -6
  7. package/dist/{Integration-C-OHHvQ4.js → Integration-BUoZ0Xs-.js} +3 -3
  8. package/dist/{Integrations-CxjxQTfg.js → Integrations-hOdl7u8Q.js} +3 -3
  9. package/dist/{Layout-BAI_0PKV.js → Layout-B1BdaSQI.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-Dat-JciL.js → MenuTab.vue_vue_type_script_setup_true_lang-Cum4Ci7x.js} +5 -5
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-D8aIe6GT.js → NavigationTab.vue_vue_type_script_setup_true_lang-DfWkcOX3.js} +5 -5
  12. package/dist/{NoData.vue_vue_type_script_setup_true_lang-BEtzyG1m.js → NoData.vue_vue_type_script_setup_true_lang-CU_i5sWL.js} +1 -1
  13. package/dist/{OverviewView-DfFld4mQ.js → OverviewView-DeRBmy8G.js} +5 -5
  14. package/dist/{Report-DU14-nSr.js → Report-CF_I43Sz.js} +4 -4
  15. package/dist/{ReportEditor-zXzi5rOb.js → ReportEditor-BPwcWi6o.js} +6 -6
  16. package/dist/{ReportView-D2GCryAn.js → ReportView-CIfUeKWA.js} +8 -8
  17. package/dist/{SelectComponent.vue_vue_type_script_setup_true_lang-BajnWBFZ.js → SelectComponent.vue_vue_type_script_setup_true_lang-0_S2mHgK.js} +1 -1
  18. package/dist/{Setting-JschL1QJ.js → Setting-Bjjpa5fl.js} +5 -5
  19. package/dist/{TileEditor-r5r6slpk.js → TileEditor-C2uPP95l.js} +1082 -1018
  20. package/dist/{TransitionFade-CW_703Wq.js → TransitionFade-Dj9hkaPu.js} +6 -6
  21. package/dist/{app-BugM9f0P.js → app-X_xk82jB.js} +72 -60
  22. package/dist/app.js +1 -1
  23. package/dist/style.css +1 -1
  24. package/dist/{vue-i18n-Ii--gx_z.js → vue-i18n-CVW4Kgfw.js} +2 -2
  25. package/package.json +1 -1
  26. package/dist/FilterSelector.vue_vue_type_script_setup_true_lang-C6r35Bu3.js +0 -4275
@@ -1,4275 +0,0 @@
1
- import { computed as S, defineComponent as Be, ref as L, onMounted as Ne, onBeforeUnmount as Fa, resolveComponent as Z, createBlock as he, openBlock as X, Transition as Ia, withCtx as ce, createElementBlock as oe, createCommentVNode as Ve, createElementVNode as j, unref as u, normalizeStyle as $e, withModifiers as $t, toDisplayString as Le, createVNode as K, Fragment as ke, renderList as it, normalizeClass as Qe, mergeModels as ze, useModel as He, nextTick as De, watch as pe, renderSlot as Ue, h as Dt, toRaw as Va, markRaw as $a, createTextVNode as qt, onUnmounted as Hn, resolveDynamicComponent as Ba, withDirectives as Ra, vShow as Pa } from "vue";
2
- import { W as Y, e as ct, f as Aa, S as je, v as vt, g as Ma, h as Ot, i as Wn, q as On, R as rt, j as za, D as Oe, c as we, C as Pe, a as Na, b as Ha, _ as Wa } from "./BaseDialog.vue_vue_type_script_setup_true_lang-CS944KRI.js";
3
- import { u as et, b as gt, a as an, h as Oa } from "./vue-i18n-Ii--gx_z.js";
4
- import { d as Xt, _ as Ea, a as Ua, b as qa, c as Xa } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-BTLp5mIX.js";
5
- import { storeToRefs as Ee, defineStore as En } from "pinia";
6
- import { C as Ya } from "./chart-DDDh8zNk.js";
7
- import { detectLocale as Ga } from "@feedmepos/mf-common";
8
- import { t as ja, z as Ka, a as Ja, e as Za, d as st } from "./app-BugM9f0P.js";
9
- import { useBreakpoints as Un, useSnackbar as on, components as Qa } from "@feedmepos/ui-library";
10
- import { _ as eo } from "./SelectComponent.vue_vue_type_script_setup_true_lang-BajnWBFZ.js";
11
- import { r as Ke } from "./i18n-CI_sQ5d_.js";
12
- import { _ as Yt } from "./NoData.vue_vue_type_script_setup_true_lang-BEtzyG1m.js";
13
- var Gt = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(Gt || {}), Ge = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(Ge || {}), jt = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(jt || {}), Kt = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(Kt || {}), Jt = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(Jt || {}), Zt = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(Zt || {}), Qt = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(Qt || {}), _e = /* @__PURE__ */ ((e) => (e.series = "SERIES", e.metric = "METRIC", e.breakdown = "BREAKDOWN", e))(_e || {});
14
- Y.Circular, Y.Table, Y.BarChart, Y.LineChart, Y.StackBarChart, Y.ClusteredStackBarChart, Y.StackLineChart, Y.Scorecard, Y.Spacer;
15
- const to = [
16
- {
17
- type: Y.Circular,
18
- showLabel: !1,
19
- // TODO: temporarily removed show label as it has no function
20
- showDrillDimension: !0,
21
- showRollup: !1,
22
- showSearchBar: !1
23
- },
24
- {
25
- type: Y.Table,
26
- showLabel: !1,
27
- showDrillDimension: !0,
28
- showRollup: !0,
29
- showSearchBar: !0
30
- },
31
- {
32
- type: Y.BarChart,
33
- showLabel: !1,
34
- // TODO: temporarily removed show label as it has no function
35
- showDrillDimension: !0,
36
- showRollup: !1,
37
- showSearchBar: !1
38
- },
39
- {
40
- type: Y.LineChart,
41
- showLabel: !1,
42
- // TODO: temporarily removed show label as it has no function
43
- showDrillDimension: !0,
44
- showRollup: !0,
45
- showSearchBar: !1
46
- },
47
- {
48
- type: Y.StackBarChart,
49
- showLabel: !1,
50
- // TODO: temporarily removed show label as it has no function
51
- showDrillDimension: !0,
52
- showRollup: !0,
53
- showSearchBar: !1
54
- },
55
- {
56
- type: Y.ClusteredStackBarChart,
57
- showLabel: !1,
58
- // TODO: temporarily removed show label as it has no function
59
- showDrillDimension: !0,
60
- showRollup: !0,
61
- showSearchBar: !1
62
- },
63
- {
64
- type: Y.StackLineChart,
65
- showLabel: !1,
66
- // TODO: temporarily removed show label as it has no function
67
- showDrillDimension: !0,
68
- showRollup: !0,
69
- showSearchBar: !1
70
- },
71
- {
72
- type: Y.Scorecard,
73
- showLabel: !1,
74
- showDrillDimension: !1,
75
- showRollup: !1,
76
- showSearchBar: !1
77
- },
78
- {
79
- type: Y.Spacer,
80
- showLabel: !1,
81
- showDrillDimension: !1,
82
- showRollup: !1,
83
- showSearchBar: !1
84
- }
85
- ];
86
- function Et(e) {
87
- const t = [e.schemaName, e.name];
88
- return "option" in e && e.option && t.push(e.option), "aggregation" in e && e.aggregation && t.push(e.aggregation), t.push(e.label.replace(/[^\p{L}\p{N}_]+/gu, "")), t.join("_").toLowerCase();
89
- }
90
- function no(e, t) {
91
- switch (e) {
92
- case Y.BarChart:
93
- case Y.LineChart:
94
- case Y.StackBarChart:
95
- case Y.ClusteredStackBarChart:
96
- case Y.StackLineChart:
97
- return Array.isArray(t == null ? void 0 : t.datasets) && Array.isArray(t == null ? void 0 : t.xAxis) && t.datasets.length > 0 && t.xAxis.length > 0;
98
- case Y.Table:
99
- return Array.isArray(t == null ? void 0 : t.rows) && Array.isArray(t == null ? void 0 : t.columns) && t.rows.length > 0 && t.columns.length > 0;
100
- case Y.Circular:
101
- return Array.isArray(t == null ? void 0 : t.datasets) && t.datasets.length > 0;
102
- case Y.Scorecard:
103
- return !0;
104
- case Y.Spacer:
105
- return !0;
106
- }
107
- }
108
- const Pt = [
109
- "#36A2EB",
110
- "#007BA7",
111
- "#FF5D53",
112
- "#73C8E6",
113
- "#FCA23E",
114
- "#F09BBE",
115
- "#FFD232",
116
- "#50BE9B",
117
- "#8358D4",
118
- "#9B5046"
119
- ], hr = Pt.map(() => "solid");
120
- function ao(e) {
121
- return e === "dashed" || e === "dotted" ? e : "solid";
122
- }
123
- function oo(e, t = !1) {
124
- if (e == null)
125
- return t ? [5, 5] : void 0;
126
- const n = ao(e);
127
- if (n === "dashed")
128
- return [8, 6];
129
- if (n === "dotted")
130
- return [2, 4];
131
- }
132
- function Ae({
133
- datasetIndex: e,
134
- isCompare: t,
135
- metricCount: n,
136
- mode: o
137
- }) {
138
- if (o !== _e.metric)
139
- return e;
140
- const a = Number.isFinite(n) ? Number(n) : 0;
141
- return a <= 0 ? e : t ? e >= a ? (e - a) % a : Math.max(0, (e - 1 + a) % a) : e % a;
142
- }
143
- const lo = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;
144
- function yt(e) {
145
- if (!e)
146
- return null;
147
- const t = e.trim();
148
- if (!lo.test(t))
149
- return null;
150
- if (t.length === 4) {
151
- const [, n, o, a] = t;
152
- return `#${n}${n}${o}${o}${a}${a}`.toUpperCase();
153
- }
154
- return t.toUpperCase();
155
- }
156
- function ro(e) {
157
- const t = yt(e) ?? "#000000";
158
- return {
159
- red: Number.parseInt(t.slice(1, 3), 16),
160
- green: Number.parseInt(t.slice(3, 5), 16),
161
- blue: Number.parseInt(t.slice(5, 7), 16)
162
- };
163
- }
164
- function qn(e) {
165
- return !Array.isArray(e) || e.length === 0 ? Pt : Pt.map((t, n) => yt(e[n]) ?? t);
166
- }
167
- function Xn(e, t) {
168
- const { red: n, green: o, blue: a } = ro(e);
169
- return `rgba(${n}, ${o}, ${a}, ${t})`;
170
- }
171
- function Tn(e, t) {
172
- const n = yt(e) ?? "#000000", o = (a) => {
173
- const r = Number.parseInt(n.slice(a, a + 2), 16);
174
- return Math.round(r + (255 - r) * t).toString(16).padStart(2, "0").toUpperCase();
175
- };
176
- return `#${o(1)}${o(3)}${o(5)}`;
177
- }
178
- function Ln(e) {
179
- return Math.min(0.55 + (e - 1) * 0.18, 0.95);
180
- }
181
- function dt({
182
- index: e,
183
- isCompare: t,
184
- opacity: n,
185
- customColors: o
186
- }) {
187
- const a = qn(o);
188
- let r = typeof n == "number" ? n : 1;
189
- return t && (r = r * 0.6), Xn(a[e % a.length], r);
190
- }
191
- function At({
192
- datasetName: e,
193
- breakdownValues: t,
194
- fallbackIndex: n
195
- }) {
196
- if (!Array.isArray(t) || t.length === 0)
197
- return n;
198
- const o = t.map((d) => typeof d == "string" ? d.trim() : "").filter((d) => d.length > 0);
199
- if (o.length === 0)
200
- return n;
201
- const a = typeof e == "string" ? e.trim() : "", r = a.toLowerCase(), l = " - ", y = a.lastIndexOf(l), k = (y >= 0 ? a.slice(0, y).trim() : a).toLowerCase(), m = o.findIndex(
202
- (d) => d.toLowerCase() === k
203
- );
204
- if (m >= 0)
205
- return m;
206
- const p = o.findIndex((d) => {
207
- const _ = d.toLowerCase();
208
- return r.includes(_) || k.includes(_);
209
- });
210
- if (p >= 0)
211
- return p;
212
- const C = o.findIndex((d) => {
213
- const _ = d.toLowerCase();
214
- return a.split(l).map((F) => F.trim().toLowerCase()).some((F) => F === _);
215
- });
216
- return C >= 0 ? C : n % o.length;
217
- }
218
- function bt({
219
- breakdownIndex: e,
220
- metricIndex: t,
221
- metricCount: n,
222
- isCompare: o,
223
- opacity: a,
224
- breakdownColors: r,
225
- useSecondaryMetricShades: l,
226
- colorMode: y,
227
- customColors: i
228
- }) {
229
- const k = Number.isInteger(n) && Number(n) > 0 ? Number(n) : 1, m = Number.isInteger(t) && Number(t) >= 0 ? Number(t) : 0, p = l !== !1, f = e * k + m, C = y === "clustered" ? Pt : qn(i), d = yt(r == null ? void 0 : r[e * k]) ?? C[e % C.length], _ = p && m > 0 ? Tn(d, Ln(m)) : yt(r == null ? void 0 : r[f]) ?? (m > 0 ? Tn(d, Ln(m)) : d);
230
- let F = typeof a == "number" ? a : 1;
231
- return o && (F = F * 0.6), Xn(_, F);
232
- }
233
- function Yn(e, t, n) {
234
- if (e === "" || t === "")
235
- return null;
236
- let o = (i) => i == null ? void 0 : i.replace(/,/g, "");
237
- n === "ID" && (o = (i) => i == null ? void 0 : i.replace(/\./g, "").replace(/,/g, "."));
238
- const a = Number(o(e)), r = Number(o(t));
239
- if (isNaN(a) || isNaN(r))
240
- return null;
241
- let l = 0;
242
- r === 0 ? a === 0 ? l = 0 : l = 1 : l = (a - r) / r;
243
- const y = so(l);
244
- return {
245
- value: isNaN(l) ? "" : `${(l * 100).toFixed(0)}%`,
246
- icon: y
247
- };
248
- }
249
- function so(e) {
250
- return e > 0 ? {
251
- name: "moving",
252
- color: "#1F7735",
253
- tailwind: "fm-color-system-success-100"
254
- } : e < 0 ? {
255
- name: "trending_down",
256
- color: "#99231D",
257
- tailwind: "fm-color-system-error-100"
258
- } : {
259
- name: "equal",
260
- color: "#C7C7CC",
261
- tailwind: "fm-color-neutral-gray-100"
262
- };
263
- }
264
- function Gn(e) {
265
- return {
266
- mode: "index",
267
- intersect: !1,
268
- axis: e,
269
- backgroundColor: "rgba(255, 255, 255, 0.86)",
270
- titleColor: "#111827",
271
- bodyColor: "#374151",
272
- borderColor: "rgba(255, 255, 255, 0.65)",
273
- borderWidth: 1,
274
- cornerRadius: 10,
275
- padding: {
276
- top: 8,
277
- right: 10,
278
- bottom: 8,
279
- left: 10
280
- },
281
- boxPadding: 3,
282
- bodySpacing: 5,
283
- caretPadding: 6,
284
- caretSize: 5,
285
- titleAlign: "left",
286
- bodyAlign: "left",
287
- multiKeyBackground: "#ffffff",
288
- usePointStyle: !1,
289
- titleFont: {
290
- size: 13,
291
- weight: 600
292
- },
293
- bodyFont: {
294
- size: 12,
295
- weight: 500
296
- },
297
- titleMarginBottom: 6
298
- };
299
- }
300
- function io() {
301
- return {
302
- ...Gn(),
303
- mode: "nearest",
304
- intersect: !0,
305
- usePointStyle: !0,
306
- callbacks: {
307
- label: (e) => {
308
- const t = e.label || "", n = typeof e.parsed == "number" ? e.parsed : 0, a = (Array.isArray(e.dataset.data) ? e.dataset.data : []).reduce((l, y) => l + Number(y || 0), 0), r = a > 0 ? (n / a * 100).toFixed(1) : "0.0";
309
- return `${t}: ${n.toLocaleString()} (${r}%)`;
310
- }
311
- }
312
- };
313
- }
314
- const uo = "rgba(0, 0, 0, 0.3)";
315
- function Dn(e) {
316
- if (typeof document > "u" || typeof window > "u")
317
- return;
318
- const t = String((e == null ? void 0 : e.id) ?? "");
319
- if (!t)
320
- return;
321
- const n = document.querySelector(
322
- `#comparison-tooltip-${t}`
323
- );
324
- n && (n.__onViewportChange && (window.removeEventListener("scroll", n.__onViewportChange, !0), window.removeEventListener("resize", n.__onViewportChange)), n.remove());
325
- }
326
- function Ut(e, t, n, o) {
327
- const { left: a, right: r, top: l, bottom: y } = n;
328
- e.save(), e.beginPath(), e.lineWidth = 1, e.strokeStyle = uo, e.setLineDash([5, 5]), t ? (e.moveTo(a, o), e.lineTo(r, o)) : (e.moveTo(o, l), e.lineTo(o, y)), e.stroke(), e.restore();
329
- }
330
- function co(e, t) {
331
- if (typeof document > "u")
332
- return;
333
- const n = String((e == null ? void 0 : e.id) ?? "");
334
- if (!n)
335
- return;
336
- const o = document.querySelector(
337
- `#comparison-tooltip-${n}`
338
- );
339
- if (!o || o.style.opacity !== "1")
340
- return;
341
- const a = Number(t ? o.dataset.caretY : o.dataset.caretX);
342
- return Number.isFinite(a) ? a : void 0;
343
- }
344
- function mo(e, t, n) {
345
- var d;
346
- if (!n)
347
- return;
348
- const o = ((d = e.options) == null ? void 0 : d.indexAxis) === "y", a = e.tooltip, r = (a == null ? void 0 : a.getActiveElements()) ?? [];
349
- if (r.length === 0) {
350
- const _ = co(e, o);
351
- _ !== void 0 && Ut(e.ctx, o, e.chartArea, _);
352
- return;
353
- }
354
- const l = e.scales.x, y = e.scales.y;
355
- if (!l || !y)
356
- return;
357
- const i = r[0];
358
- if (!i)
359
- return;
360
- if (t === "bar") {
361
- const F = (o ? y : l).getPixelForValue(i.index);
362
- Ut(e.ctx, o, e.chartArea, F);
363
- return;
364
- }
365
- if (!i.element)
366
- return;
367
- const k = i.element, m = o ? y : l, p = o ? k.y : k.x, f = m.getPixelForValue(i.index), C = p ?? f;
368
- Ut(e.ctx, o, e.chartArea, C);
369
- }
370
- function Ct(e) {
371
- let t = !1, n = !1;
372
- return {
373
- id: "crosshair",
374
- afterDatasetsDraw: (o) => {
375
- mo(o, e, n);
376
- },
377
- afterEvent: (o, a) => {
378
- n = a.inChartArea === !0;
379
- },
380
- beforeTooltipDraw: (o) => {
381
- var r;
382
- const a = o.ctx;
383
- (((r = o.tooltip) == null ? void 0 : r.opacity) ?? 0) > 0 && (a.save(), a.shadowColor = "rgba(17, 24, 39, 0.14)", a.shadowBlur = 12, a.shadowOffsetX = 0, a.shadowOffsetY = 4, t = !0);
384
- },
385
- afterTooltipDraw: (o) => {
386
- t && (o.ctx.restore(), t = !1);
387
- },
388
- beforeDestroy: (o) => {
389
- Dn(o);
390
- },
391
- afterDestroy: (o) => {
392
- Dn(o);
393
- }
394
- };
395
- }
396
- const fo = Number.POSITIVE_INFINITY, en = 2, po = 20, ho = 0.2, vo = 120, ht = {
397
- "en-US": Za.report.widget.comparisonTooltip.viewBreakdown,
398
- "zh-CN": Ja.report.widget.comparisonTooltip.viewBreakdown,
399
- "zh-Hant": Ka.report.widget.comparisonTooltip.viewBreakdown,
400
- "th-TH": ja.report.widget.comparisonTooltip.viewBreakdown
401
- };
402
- function jn() {
403
- const e = Ga();
404
- return e in ht ? ht[e] : e.startsWith("zh") ? ht["zh-CN"] : e.startsWith("th") ? ht["th-TH"] : ht["en-US"];
405
- }
406
- function go(e) {
407
- return typeof e != "string" ? [] : e.split("#").map((t) => t.trim()).filter((t) => t.length > 0);
408
- }
409
- function yo(e) {
410
- return Reflect.get(e, "dash") === !0 || Reflect.get(e, "isCompare") === !0;
411
- }
412
- function ln(e, t) {
413
- const n = e.parsed, o = t ? n.x : n.y, a = t ? n.y : n.x, r = o ?? a;
414
- return typeof r == "number" ? r : Number(r);
415
- }
416
- function Kn(e, t) {
417
- const n = Jn(e), o = ln(e, t);
418
- return `${n}: ${o.toLocaleString()}`;
419
- }
420
- function Jn(e) {
421
- const t = Reflect.get(e.dataset, "tooltipLabel");
422
- if (typeof t == "string" && t.trim().length > 0)
423
- return t;
424
- const n = Reflect.get(e.dataset, "label");
425
- return typeof n == "string" ? n : "";
426
- }
427
- function bo(e) {
428
- return e.trim().toLowerCase();
429
- }
430
- function Fn(e) {
431
- return `${e.datasetIndex}-${e.dataIndex}`;
432
- }
433
- function Ft(e, t) {
434
- if (typeof e == "string") return e;
435
- if (Array.isArray(e)) {
436
- const n = e[t];
437
- return typeof n == "string" ? n : void 0;
438
- }
439
- }
440
- function Co(e) {
441
- if (typeof e != "string") return "#9ca3af";
442
- const t = e.trim();
443
- return /^[-#(),.%\sa-zA-Z0-9]+$/.test(t) ? t : "#9ca3af";
444
- }
445
- function wo(e) {
446
- const t = e.replace(/\s+/g, "").toLowerCase();
447
- return !!(t === "transparent" || /^rgba\([^)]*,0(?:\.0+)?\)$/.test(t) || /^hsla\([^)]*,0(?:\.0+)?\)$/.test(t) || t === "#0000" || t === "#00000000");
448
- }
449
- function In(...e) {
450
- for (const t of e) {
451
- if (!t) continue;
452
- const n = Co(t);
453
- if (!wo(n))
454
- return n;
455
- }
456
- return "#9ca3af";
457
- }
458
- function Zn(e) {
459
- var o, a;
460
- const t = e.dataset;
461
- return Reflect.get(t, "type") === "bar" ? !0 : ((a = (o = e.chart) == null ? void 0 : o.config) == null ? void 0 : a.type) === "bar";
462
- }
463
- function xo(e) {
464
- const t = e.dataset, n = typeof e.dataIndex == "number" ? e.dataIndex : 0, o = Ft(Reflect.get(t, "borderColor"), n), a = Ft(Reflect.get(t, "backgroundColor"), n), r = Reflect.get(
465
- e.element,
466
- "options"
467
- ), l = Ft(
468
- Reflect.get(r ?? {}, "borderColor"),
469
- n
470
- ), y = Ft(
471
- Reflect.get(r ?? {}, "backgroundColor"),
472
- n
473
- );
474
- return Zn(e) ? In(a, y, o, l) : In(o, l, a, y);
475
- }
476
- function tn(e) {
477
- return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\"/g, "&quot;").replace(/'/g, "&#39;");
478
- }
479
- function So(e) {
480
- return e === 1 ? "store" : "stores";
481
- }
482
- function _o(e, t) {
483
- return `Others (${t} ${So(t)}): ${e.toLocaleString()}`;
484
- }
485
- function ko(e) {
486
- const t = typeof e == "number" ? e : typeof e == "string" ? Number(e) : Number.NaN;
487
- return Number.isFinite(t) ? Math.max(en, Math.floor(t)) : fo;
488
- }
489
- function rn(e) {
490
- return {
491
- maxTooltipItems: ko(e == null ? void 0 : e.maxTooltipItems)
492
- };
493
- }
494
- function Vn(e) {
495
- return {
496
- text: `${e.datasetLabel}: ${0 .toLocaleString()}`,
497
- color: "#cbd5e1",
498
- isBar: e.isBar,
499
- value: 0,
500
- datasetLabel: e.datasetLabel,
501
- matchingKey: e.matchingKey
502
- };
503
- }
504
- function Mt(e) {
505
- return Object.entries(e).map(([t, n]) => `${t}:${n}`).join(";");
506
- }
507
- const To = Mt({
508
- display: "block",
509
- "margin-top": "8px",
510
- padding: "0",
511
- background: "none",
512
- border: "none",
513
- color: "#2563eb",
514
- "font-size": "12px",
515
- "font-weight": "600",
516
- cursor: "pointer",
517
- "text-align": "left",
518
- "pointer-events": "auto"
519
- }), Lo = {
520
- "font-size": "12px",
521
- "font-weight": "600",
522
- color: "#111827",
523
- "text-align": "left"
524
- }, Do = Mt({
525
- display: "flex",
526
- "align-items": "center",
527
- "font-size": "12px",
528
- "font-weight": "500",
529
- color: "#1f2937",
530
- "text-align": "left",
531
- "line-height": "1.35",
532
- margin: "0 0 3px"
533
- }), Fo = {
534
- display: "inline-block",
535
- width: "10px",
536
- height: "10px",
537
- "border-radius": "2px",
538
- border: "1px solid rgba(17, 24, 39, 0.28)",
539
- "box-sizing": "border-box",
540
- "margin-right": "8px",
541
- flex: "0 0 auto"
542
- }, Io = {
543
- display: "inline-block",
544
- width: "10px",
545
- height: "10px",
546
- "border-radius": "9999px",
547
- border: "1px solid rgba(255, 255, 255, 0.9)",
548
- "box-shadow": "0 0 0 1px rgba(17, 24, 39, 0.28)",
549
- "box-sizing": "border-box",
550
- "margin-right": "8px",
551
- flex: "0 0 auto"
552
- };
553
- function Vo(e) {
554
- return Mt({
555
- ...Lo,
556
- margin: `${e ? "8px" : "0"} 0 4px`
557
- });
558
- }
559
- function $o(e, t) {
560
- return Mt({
561
- ...e ? Fo : Io,
562
- background: t
563
- });
564
- }
565
- function Bo(e) {
566
- return `<button type="button" data-tooltip-full-details="true" style="${To}">${tn(e)}</button>`;
567
- }
568
- function Qn(e, t, n, o, a) {
569
- var x;
570
- const r = (x = e[0]) == null ? void 0 : x.label, l = go(r), y = l[0] ?? (r == null ? "" : String(r)), i = l[1], k = [], m = [];
571
- e.forEach((g) => {
572
- const c = g.dataset ?? {}, v = g.datasetIndex >= 0 && g.dataIndex >= 0 ? {
573
- datasetIndex: g.datasetIndex,
574
- dataIndex: g.dataIndex
575
- } : void 0, $ = Jn(g), B = {
576
- text: Kn(g, t),
577
- color: xo(g),
578
- isBar: Zn(g),
579
- value: ln(g, t),
580
- datasetLabel: $,
581
- matchingKey: bo($),
582
- focusTarget: v
583
- };
584
- if (i && yo(c)) {
585
- m.push(B);
586
- return;
587
- }
588
- k.push(B);
589
- });
590
- const p = k.slice(0, o), f = /* @__PURE__ */ new Map();
591
- m.forEach((g) => {
592
- const c = f.get(g.matchingKey);
593
- if (!c) {
594
- f.set(g.matchingKey, [g]);
595
- return;
596
- }
597
- c.push(g);
598
- });
599
- const C = i ? p.map((g) => {
600
- const c = f.get(g.matchingKey);
601
- return !c || c.length === 0 ? Vn(g) : c.shift() ?? Vn(g);
602
- }) : [], d = k.length > p.length || m.length > C.length, _ = (g, c = !1) => `<div style="${Vo(c)}">${tn(g)}</div>`, F = (g) => {
603
- const c = $o(g.isBar, g.color);
604
- return `<div style="${Do}"><span style="${c}"></span><span>${tn(g.text)}</span></div>`;
605
- };
606
- let R = "";
607
- y.length > 0 && (R += _(y)), R += p.map((g) => F(g)).join(""), i && C.length > 0 && (R += _(i, R.length > 0), R += C.map((g) => F(g)).join("")), a && d && (R += Bo(n));
608
- const b = [
609
- {
610
- title: y,
611
- values: k
612
- },
613
- {
614
- title: i ?? "",
615
- values: m
616
- }
617
- ].filter((g) => g.values.length > 0);
618
- return {
619
- html: R,
620
- detailsPayload: { sections: b },
621
- hasCollapsedValues: d
622
- };
623
- }
624
- function $n(e) {
625
- return e.scrollHeight - e.clientHeight > po;
626
- }
627
- function It(e, t, n, o, a, r) {
628
- const l = Qn(
629
- t,
630
- n,
631
- o,
632
- a,
633
- r
634
- );
635
- return e.innerHTML !== l.html && (e.innerHTML = l.html, qo(e)), l;
636
- }
637
- function Ro(e, t, n, o, a, r) {
638
- if (Number.isFinite(a))
639
- return {
640
- markup: It(
641
- e,
642
- t,
643
- n,
644
- o,
645
- a,
646
- r
647
- ),
648
- maxTooltipItems: a
649
- };
650
- const l = Math.max(en, t.length);
651
- let y = l, i = It(
652
- e,
653
- t,
654
- n,
655
- o,
656
- l,
657
- r
658
- );
659
- if (!$n(e))
660
- return {
661
- markup: i,
662
- maxTooltipItems: l
663
- };
664
- let k = en, m = l;
665
- for (; k <= m; ) {
666
- const f = Math.floor((k + m) / 2), C = It(
667
- e,
668
- t,
669
- n,
670
- o,
671
- f,
672
- r
673
- );
674
- if ($n(e)) {
675
- m = f - 1;
676
- continue;
677
- }
678
- y = f, i = C, k = f + 1;
679
- }
680
- return {
681
- markup: y === l ? i : It(
682
- e,
683
- t,
684
- n,
685
- o,
686
- y,
687
- r
688
- ),
689
- maxTooltipItems: y
690
- };
691
- }
692
- function Bn(e, t) {
693
- const n = Math.max(0, Math.min(1, t)), o = e.trim();
694
- if (o.startsWith("#")) {
695
- const l = o.slice(1), y = l.length === 3 ? `${l[0]}${l[0]}${l[1]}${l[1]}${l[2]}${l[2]}` : l.length === 4 ? `${l[0]}${l[0]}${l[1]}${l[1]}${l[2]}${l[2]}` : l.length >= 6 ? l.slice(0, 6) : "";
696
- if (/^[0-9a-fA-F]{6}$/.test(y)) {
697
- const i = Number.parseInt(y.slice(0, 2), 16), k = Number.parseInt(y.slice(2, 4), 16), m = Number.parseInt(y.slice(4, 6), 16);
698
- return `rgba(${i}, ${k}, ${m}, ${n})`;
699
- }
700
- }
701
- const a = o.match(/^rgba?\(([^)]+)\)$/i);
702
- if (a) {
703
- const l = a[1].split(",").map((y) => y.trim());
704
- if (l.length >= 3) {
705
- const [y, i, k] = l;
706
- return `rgba(${y}, ${i}, ${k}, ${n})`;
707
- }
708
- }
709
- const r = o.match(/^hsla?\(([^)]+)\)$/i);
710
- if (r) {
711
- const l = r[1].split(",").map((y) => y.trim());
712
- if (l.length >= 3) {
713
- const [y, i, k] = l;
714
- return `hsla(${y}, ${i}, ${k}, ${n})`;
715
- }
716
- }
717
- return e;
718
- }
719
- function Vt(e, t) {
720
- return typeof e == "string" ? Bn(e, t) : Array.isArray(e) ? e.map(
721
- (n) => typeof n == "string" ? Bn(n, t) : n
722
- ) : e;
723
- }
724
- function Po(e) {
725
- e.__tooltipOriginalStyle || (e.__tooltipOriginalStyle = {
726
- borderColor: Reflect.get(e, "borderColor"),
727
- backgroundColor: Reflect.get(e, "backgroundColor"),
728
- pointBorderColor: Reflect.get(e, "pointBorderColor"),
729
- pointBackgroundColor: Reflect.get(e, "pointBackgroundColor")
730
- });
731
- }
732
- function Ao(e) {
733
- const t = e.__tooltipOriginalStyle;
734
- t && (Reflect.set(e, "borderColor", t.borderColor), Reflect.set(e, "backgroundColor", t.backgroundColor), Reflect.set(e, "pointBorderColor", t.pointBorderColor), Reflect.set(e, "pointBackgroundColor", t.pointBackgroundColor));
735
- }
736
- function Mo(e, t) {
737
- const n = e.__tooltipOriginalStyle;
738
- n && (Reflect.set(e, "borderColor", Vt(n.borderColor, t)), Reflect.set(e, "backgroundColor", Vt(n.backgroundColor, t)), Reflect.set(e, "pointBorderColor", Vt(n.pointBorderColor, t)), Reflect.set(
739
- e,
740
- "pointBackgroundColor",
741
- Vt(n.pointBackgroundColor, t)
742
- ));
743
- }
744
- function nn(e) {
745
- var o;
746
- if (!e || typeof e != "object")
747
- return !1;
748
- const t = e;
749
- if (t.destroyed === !0 || typeof t.update != "function" || !Array.isArray((o = t.data) == null ? void 0 : o.datasets))
750
- return !1;
751
- const n = t.canvas;
752
- return !(n !== void 0 && (!(n instanceof HTMLCanvasElement) || !n.isConnected || !n.ownerDocument));
753
- }
754
- function Bt(e, t) {
755
- if (!nn(e))
756
- return;
757
- const n = e.data.datasets;
758
- if (n.length !== 0) {
759
- if (n.forEach((o, a) => {
760
- const r = o;
761
- Po(r), !t || a === t.datasetIndex ? Ao(r) : Mo(r, ho);
762
- }), typeof e.setActiveElements == "function")
763
- try {
764
- t ? e.setActiveElements([
765
- {
766
- datasetIndex: t.datasetIndex,
767
- index: t.dataIndex
768
- }
769
- ]) : e.setActiveElements([]);
770
- } catch {
771
- return;
772
- }
773
- try {
774
- e.update("none");
775
- } catch {
776
- return;
777
- }
778
- }
779
- }
780
- function zo(e) {
781
- const t = e, n = t == null ? void 0 : t.chart;
782
- if (nn(n))
783
- return n;
784
- const o = t == null ? void 0 : t.$el;
785
- if (!(o instanceof HTMLElement))
786
- return null;
787
- const a = o.querySelector("canvas");
788
- if (!(a instanceof HTMLCanvasElement))
789
- return null;
790
- const r = Ya.getChart(a);
791
- return nn(r) ? r : null;
792
- }
793
- function No(e) {
794
- const t = window.getComputedStyle(e);
795
- return [t.overflow, t.overflowX, t.overflowY].some((o) => o !== "visible");
796
- }
797
- function sn(e) {
798
- let t = e.parentElement ?? e, n = t;
799
- for (; n && n.parentElement && n.parentElement !== document.body && n.parentElement !== document.documentElement; )
800
- No(n) && (t = n.parentElement), n = n.parentElement;
801
- return window.getComputedStyle(t).position === "static" && (t.style.position = "relative"), t;
802
- }
803
- function un(e, t, n, o, a, r, l = "center", y = !1) {
804
- const i = t.getBoundingClientRect(), k = n.getBoundingClientRect(), m = n.scrollLeft, p = n.scrollTop, f = n.clientWidth, C = n.clientHeight, d = e;
805
- (!Number.isFinite(d.__cachedWidth) || !Number.isFinite(d.__cachedHeight) || d.__measurementHostWidth !== f || d.__measurementHostHeight !== C) && (d.__cachedWidth = e.offsetWidth, d.__cachedHeight = e.offsetHeight, d.__measurementHostWidth = f, d.__measurementHostHeight = C);
806
- const F = d.__cachedWidth ?? e.offsetWidth, R = d.__cachedHeight ?? e.offsetHeight, b = 8, x = i.left - k.left + m + o, g = i.top - k.top + p + a, c = y ? l === "left" ? x - F - b : x + b : l === "left" ? x - F - b : l === "right" ? x + b : x - F / 2, v = y ? g + b : r ? g - R / 2 : g + b, $ = m + b;
807
- let B = p + b;
808
- const D = document.querySelector('[data-menu-tab="true"]');
809
- if (D) {
810
- const G = D.getBoundingClientRect().bottom - k.top + p + b;
811
- B = Math.max(B, G);
812
- }
813
- const z = Math.max(
814
- $,
815
- m + f - F - b
816
- ), P = Math.max(
817
- B,
818
- p + C - R - b
819
- ), I = Math.round(Math.min(Math.max($, c), z)), V = Math.round(Math.min(Math.max(B, v), P));
820
- d.__lastLeftPx === I && d.__lastTopPx === V || (d.__lastLeftPx = I, d.__lastTopPx = V, e.style.left = `${I}px`, e.style.top = `${V}px`);
821
- }
822
- function ea(e) {
823
- return e.dataset.anchorDirection === "left" ? "left" : e.dataset.anchorDirection === "right" ? "right" : "center";
824
- }
825
- function Ho(e, t, n, o, a, r, l) {
826
- const y = t.getBoundingClientRect(), i = o - y.left, k = a - y.top;
827
- !Number.isFinite(i) || !Number.isFinite(k) || (e.dataset.cursorCanvasX = String(i), e.dataset.cursorCanvasY = String(k), e.dataset.caretX = String(i), e.dataset.caretY = String(k), e.dataset.anchorDirection = l, un(
828
- e,
829
- t,
830
- n,
831
- i,
832
- k,
833
- r,
834
- l,
835
- !0
836
- ));
837
- }
838
- function Wo(e) {
839
- const t = document.createElement("div");
840
- return t.id = e, t.dataset.comparisonTooltip = "true", t.style.background = "linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.66))", t.style.border = "1px solid rgba(255, 255, 255, 0.58)", t.style.borderRadius = "10px", t.style.boxShadow = "0 8px 24px rgba(15, 23, 42, 0.18)", t.style.color = "#111827", t.style.left = "0", t.style.opacity = "0", t.style.maxHeight = "calc(100% - 16px)", t.style.maxWidth = "min(360px, calc(100% - 16px))", t.style.overflow = "hidden", t.style.padding = "8px 10px", t.style.pointerEvents = "none", t.style.position = "absolute", t.style.textAlign = "left", t.style.top = "0", t.style.transform = "none", t.style.willChange = "left, top", t.style.whiteSpace = "normal", t.style.wordBreak = "break-word", t.style.zIndex = "10", t;
841
- }
842
- function Oo(e) {
843
- e.__onViewportChange && (window.removeEventListener("scroll", e.__onViewportChange, !0), window.removeEventListener("resize", e.__onViewportChange));
844
- }
845
- function Eo(e, t) {
846
- wt(e), ta(e), Oo(e), e.__onDetailsClick && e.removeEventListener("click", e.__onDetailsClick), e.__onTooltipPointerEnter && e.removeEventListener("pointerenter", e.__onTooltipPointerEnter), e.__onTooltipPointerLeave && e.removeEventListener("pointerleave", e.__onTooltipPointerLeave), t && e.__onCanvasPointerEnter && t.removeEventListener("pointerenter", e.__onCanvasPointerEnter), t && e.__onCanvasPointerMove && t.removeEventListener("pointermove", e.__onCanvasPointerMove), t && e.__onCanvasPointerLeave && t.removeEventListener("pointerleave", e.__onCanvasPointerLeave), t && e.__onCanvasClick && t.removeEventListener("click", e.__onCanvasClick), t && e.__onCanvasPointerUp && t.removeEventListener("pointerup", e.__onCanvasPointerUp), e.remove();
847
- }
848
- function Uo(e, t, n) {
849
- Array.from(
850
- e.querySelectorAll('[data-comparison-tooltip="true"]')
851
- ).forEach((a) => {
852
- a.id !== t && Eo(a, n);
853
- });
854
- }
855
- function wt(e) {
856
- typeof e.__hideTimeoutId == "number" && (window.clearTimeout(e.__hideTimeoutId), e.__hideTimeoutId = void 0);
857
- }
858
- function ta(e) {
859
- typeof e.__cursorRafId == "number" && (window.cancelAnimationFrame(e.__cursorRafId), e.__cursorRafId = void 0);
860
- }
861
- function qo(e) {
862
- e.__cachedWidth = void 0, e.__cachedHeight = void 0, e.__measurementHostWidth = void 0, e.__measurementHostHeight = void 0;
863
- }
864
- function Rn(e, t, n, o, a) {
865
- e.__pendingCursorClientX = o, e.__pendingCursorClientY = a, typeof e.__cursorRafId != "number" && (e.__cursorRafId = window.requestAnimationFrame(() => {
866
- e.__cursorRafId = void 0;
867
- const r = e.__pendingCursorClientX, l = e.__pendingCursorClientY;
868
- if (e.__pendingCursorClientX = void 0, e.__pendingCursorClientY = void 0, !Number.isFinite(r) || !Number.isFinite(l))
869
- return;
870
- const y = sn(t);
871
- e.parentElement !== y && y.appendChild(e), Ho(
872
- e,
873
- t,
874
- y,
875
- r,
876
- l,
877
- n,
878
- ea(e)
879
- );
880
- }));
881
- }
882
- function Ze(e, t) {
883
- wt(e), ta(e), e.__pendingCursorClientX = void 0, e.__pendingCursorClientY = void 0, e.__detailsPayload = void 0, e.__lastLeftPx = void 0, e.__lastTopPx = void 0, delete e.dataset.cursorCanvasX, delete e.dataset.cursorCanvasY, e.__isTooltipHovered = !1, e.style.pointerEvents = "none", e.style.opacity = "0", Bt(t);
884
- }
885
- function Pn(e, t, n = vo) {
886
- e.__isTooltipHovered || (wt(e), e.__hideTimeoutId = window.setTimeout(() => {
887
- e.__isTooltipHovered || Ze(e, t);
888
- }, n));
889
- }
890
- function Xo(e, t, n, o, a) {
891
- const { maxTooltipItems: r } = rn(a);
892
- e.__onCanvasPointerEnter || (e.__onCanvasPointerEnter = (l) => {
893
- if (Rn(
894
- e,
895
- t,
896
- o,
897
- l.clientX,
898
- l.clientY
899
- ), typeof (n == null ? void 0 : n.update) == "function")
900
- try {
901
- n.update("none");
902
- } catch {
903
- return;
904
- }
905
- }, t.addEventListener("pointerenter", e.__onCanvasPointerEnter, {
906
- passive: !0
907
- })), e.__onCanvasPointerMove || (e.__onCanvasPointerMove = (l) => {
908
- Rn(
909
- e,
910
- t,
911
- o,
912
- l.clientX,
913
- l.clientY
914
- );
915
- }, t.addEventListener("pointermove", e.__onCanvasPointerMove, {
916
- passive: !0
917
- })), e.__onCanvasPointerLeave || (e.__onCanvasPointerLeave = () => {
918
- Ze(e, n);
919
- }, t.addEventListener("pointerleave", e.__onCanvasPointerLeave, {
920
- passive: !0
921
- })), e.__onCanvasClick || (e.__onCanvasClick = (l) => {
922
- var F, R;
923
- if (!(a != null && a.onViewFullDetails) || !e.__detailsPayload || e.style.opacity !== "1")
924
- return;
925
- const y = (b) => {
926
- var g;
927
- if (b.length === 0)
928
- return !1;
929
- const x = Qn(
930
- b,
931
- o,
932
- (a == null ? void 0 : a.viewFullDetailsLabel) ?? jn(),
933
- r,
934
- !0
935
- ).detailsPayload;
936
- return (g = a.onViewFullDetails) == null || g.call(a, x, n), Ze(e, n), !0;
937
- }, i = ((F = n == null ? void 0 : n.tooltip) == null ? void 0 : F.dataPoints) ?? [];
938
- if (y(i))
939
- return;
940
- const k = n == null ? void 0 : n.getElementsAtEventForMode;
941
- if (typeof k != "function")
942
- return;
943
- const m = k.call(
944
- n,
945
- l,
946
- "nearest",
947
- { intersect: !0 },
948
- !1
949
- ), p = k.call(
950
- n,
951
- l,
952
- "index",
953
- { intersect: !1 },
954
- !1
955
- ), C = (m.length > 0 ? m : p).filter(
956
- (b) => typeof b.datasetIndex == "number" && typeof b.index == "number"
957
- ).map((b) => ({ datasetIndex: b.datasetIndex, index: b.index }));
958
- if (C.length === 0)
959
- return;
960
- const d = n == null ? void 0 : n.tooltip;
961
- if (typeof (d == null ? void 0 : d.setActiveElements) != "function")
962
- return;
963
- d.setActiveElements(C, {
964
- x: l.offsetX,
965
- y: l.offsetY
966
- });
967
- try {
968
- n.update("none");
969
- } catch {
970
- return;
971
- }
972
- const _ = ((R = n == null ? void 0 : n.tooltip) == null ? void 0 : R.dataPoints) ?? [];
973
- y(_);
974
- }, t.addEventListener("click", e.__onCanvasClick)), e.__onCanvasPointerUp || (e.__onCanvasPointerUp = (l) => {
975
- e.__onCanvasClick && e.__onCanvasClick(l);
976
- }, t.addEventListener("pointerup", e.__onCanvasPointerUp)), a != null && a.onViewFullDetails && (e.__onDetailsClick || (e.__onDetailsClick = (l) => {
977
- var k;
978
- const y = l.target;
979
- y != null && y.closest('[data-tooltip-full-details="true"]') && (l.preventDefault(), l.stopPropagation(), e.__detailsPayload && ((k = a.onViewFullDetails) == null || k.call(a, e.__detailsPayload, n), Ze(e, n)));
980
- }, e.addEventListener("click", e.__onDetailsClick)), e.__onTooltipPointerEnter || (e.__onTooltipPointerEnter = () => {
981
- e.__isTooltipHovered = !0, wt(e);
982
- }, e.addEventListener("pointerenter", e.__onTooltipPointerEnter)), e.__onTooltipPointerLeave || (e.__onTooltipPointerLeave = () => {
983
- e.__isTooltipHovered = !1, Ze(e, n);
984
- }, e.addEventListener("pointerleave", e.__onTooltipPointerLeave)));
985
- }
986
- function Yo(e, t, n) {
987
- e.__onViewportChange || (e.__onViewportChange = () => {
988
- if (e.style.opacity !== "1")
989
- return;
990
- const o = Number(e.dataset.caretX), a = Number(e.dataset.caretY), r = ea(e);
991
- if (!Number.isFinite(o) || !Number.isFinite(a)) {
992
- e.style.opacity = "0";
993
- return;
994
- }
995
- const l = sn(t);
996
- e.parentElement !== l && l.appendChild(e), un(
997
- e,
998
- t,
999
- l,
1000
- o,
1001
- a,
1002
- n,
1003
- r,
1004
- !0
1005
- );
1006
- }, window.addEventListener("scroll", e.__onViewportChange, {
1007
- capture: !0,
1008
- passive: !0
1009
- }), window.addEventListener("resize", e.__onViewportChange, {
1010
- passive: !0
1011
- }));
1012
- }
1013
- function Go(e, t) {
1014
- const { maxTooltipItems: n } = rn(t);
1015
- return ({ chart: o, tooltip: a }) => {
1016
- var D;
1017
- if (typeof document > "u" || typeof window > "u")
1018
- return;
1019
- const r = o == null ? void 0 : o.canvas;
1020
- if (!(r instanceof HTMLCanvasElement))
1021
- return;
1022
- const l = sn(r), y = `comparison-tooltip-${String(o.id)}`;
1023
- Uo(l, y, r);
1024
- let i = document.querySelector(`#${y}`);
1025
- if (i || (i = Wo(y)), i.parentElement !== l && l.appendChild(i), Yo(i, r, e), Xo(i, r, o, e, t), ((a == null ? void 0 : a.opacity) ?? 0) === 0) {
1026
- t != null && t.onViewFullDetails ? Pn(i, o) : Ze(i, o);
1027
- return;
1028
- }
1029
- const k = (a == null ? void 0 : a.dataPoints) ?? [];
1030
- if (k.length === 0) {
1031
- t != null && t.onViewFullDetails ? Pn(i, o) : Ze(i, o);
1032
- return;
1033
- }
1034
- wt(i);
1035
- const m = (t == null ? void 0 : t.viewFullDetailsLabel) ?? jn(), p = !!(t != null && t.onViewFullDetails), {
1036
- markup: { detailsPayload: f, hasCollapsedValues: C }
1037
- } = Ro(
1038
- i,
1039
- k,
1040
- e,
1041
- m,
1042
- n,
1043
- p
1044
- ), d = p && C;
1045
- i.__detailsPayload = d ? f : void 0, i.style.pointerEvents = d ? "auto" : "none";
1046
- const _ = typeof (a == null ? void 0 : a.caretX) == "number" ? a.caretX : 0, F = Number(i.dataset.cursorCanvasX), R = Number(i.dataset.cursorCanvasY);
1047
- if (!(Number.isFinite(F) && Number.isFinite(R))) {
1048
- i.style.opacity = "0";
1049
- return;
1050
- }
1051
- const x = (D = o == null ? void 0 : o.scales) == null ? void 0 : D.x, g = x && typeof x.getPixelForValue == "function" ? x.getPixelForValue(0) : NaN, c = e ? k.reduce((z, P) => {
1052
- const I = P == null ? void 0 : P.element, V = I == null ? void 0 : I.x;
1053
- if (typeof V != "number" || !Number.isFinite(V))
1054
- return z;
1055
- if (!Number.isFinite(z))
1056
- return V;
1057
- const O = Number.isFinite(g) ? g : _, G = Math.abs(z - O);
1058
- return Math.abs(V - O) > G ? V : z;
1059
- }, Number.NaN) : Number.NaN, v = F, $ = R, B = e ? Number.isFinite(g) && Number.isFinite(c) && c < g ? "left" : "right" : "center";
1060
- un(
1061
- i,
1062
- r,
1063
- l,
1064
- v,
1065
- $,
1066
- e,
1067
- B,
1068
- !0
1069
- ), i.dataset.caretX = String(v), i.dataset.caretY = String($), i.dataset.anchorDirection = B, i.style.opacity = "1";
1070
- };
1071
- }
1072
- function jo(e, t) {
1073
- return {
1074
- filter: (n, o, a) => a.length <= t ? !0 : o < t,
1075
- callbacks: {
1076
- title: (n) => {
1077
- var a;
1078
- const o = (a = n[0]) == null ? void 0 : a.label;
1079
- return o == null ? "" : String(o);
1080
- },
1081
- label: (n) => {
1082
- var a, r;
1083
- const o = ((r = (a = n.chart) == null ? void 0 : a.tooltip) == null ? void 0 : r.dataPoints) ?? [];
1084
- if (o.length > t) {
1085
- const l = Fn(n), i = o.slice(0, t).findIndex((k) => Fn(k) === l);
1086
- if (i >= t)
1087
- return "";
1088
- if (i === t - 1) {
1089
- const k = o.slice(t - 1).reduce((p, f) => p + ln(f, e), 0), m = Math.max(0, o.length - (t - 1));
1090
- return _o(k, m);
1091
- }
1092
- }
1093
- return Kn(n, e);
1094
- }
1095
- }
1096
- };
1097
- }
1098
- function mt(e = !1, t = !1, n) {
1099
- const { maxTooltipItems: o } = rn(n), a = Gn(e ? "y" : "x");
1100
- return t ? {
1101
- ...a,
1102
- enabled: !1,
1103
- external: Go(e, n)
1104
- } : {
1105
- ...a,
1106
- ...jo(e, o)
1107
- };
1108
- }
1109
- function ft(e) {
1110
- function t(m, p, f) {
1111
- if (m.measureText(p).width <= f) return p;
1112
- const C = "…";
1113
- let d = 0, _ = p.length;
1114
- for (; d < _; ) {
1115
- const F = Math.floor((d + _) / 2), R = p.slice(0, F) + C;
1116
- m.measureText(R).width <= f ? d = F + 1 : _ = F;
1117
- }
1118
- return p.slice(0, d - 1) + C;
1119
- }
1120
- function n(m) {
1121
- const p = m == null ? "" : String(m), [f] = p.split("#");
1122
- return (f ?? p).trim();
1123
- }
1124
- const o = S(() => ({
1125
- display: e.showLabel,
1126
- align: e.labelAlign,
1127
- anchor: e.labelAnchor,
1128
- rotation: e.labelRotation,
1129
- offset: e.labelOffset,
1130
- font: {
1131
- size: e.labelFontSize
1132
- },
1133
- color: (m) => {
1134
- const p = m.chart.data.datasets[m.datasetIndex];
1135
- return p.borderColor ? Array.isArray(p.borderColor) ? p.borderColor[m.dataIndex] : p.borderColor : p.backgroundColor ? Array.isArray(p.backgroundColor) ? p.backgroundColor[m.dataIndex] : p.backgroundColor : "#000";
1136
- },
1137
- formatter: (m) => m === 0 ? "" : m.toLocaleString("en-US")
1138
- })), a = S(() => ({
1139
- display: e.showX,
1140
- position: e.xPosition,
1141
- grid: {
1142
- display: e.showXGrid
1143
- },
1144
- ticks: {
1145
- display: e.showXTick,
1146
- callback: function(m) {
1147
- if ((e == null ? void 0 : e.isTransposed) === !0) return n(m);
1148
- let f = String(m);
1149
- const C = this;
1150
- C && typeof C.getLabelForValue == "function" && (f = C.getLabelForValue(m)), f = n(f);
1151
- const d = C == null ? void 0 : C.chart, _ = C == null ? void 0 : C.ctx, F = d.height * 0.25;
1152
- if (_ && F > 0) {
1153
- _.save();
1154
- const b = _.measureText(f).width > F ? t(_, f, F) : f;
1155
- return _.restore(), b;
1156
- }
1157
- return f;
1158
- },
1159
- font: {
1160
- size: e.xTickFontSize
1161
- }
1162
- },
1163
- title: {
1164
- display: e.showXTitle,
1165
- text: e.xTitle,
1166
- font: {
1167
- size: e.xTitleFontSize
1168
- }
1169
- },
1170
- afterBuildTicks: (m) => {
1171
- const p = Array.isArray(m == null ? void 0 : m.ticks) ? m.ticks : [];
1172
- if (p.length === 0) return;
1173
- const f = n(m.getLabelForValue(p[0].value)), C = !isNaN(Number(f));
1174
- m.options.ticks.minRotation = C || p.length < 10 ? 0 : 90;
1175
- },
1176
- afterFit: (m) => {
1177
- if (!(e != null && e.isTransposed)) {
1178
- const p = m.chart.height * 0.4;
1179
- m.height > p && (m.height = p);
1180
- }
1181
- }
1182
- })), r = S(() => ({
1183
- display: e.showY,
1184
- position: e.yPosition,
1185
- grid: {
1186
- display: e.showYGrid
1187
- },
1188
- ticks: {
1189
- display: e.showYTick,
1190
- font: {
1191
- size: e.yTickFontSize
1192
- },
1193
- callback: function(m) {
1194
- if (!((e == null ? void 0 : e.isTransposed) === !0)) return n(m);
1195
- let f = String(m);
1196
- const C = this;
1197
- C && typeof C.getLabelForValue == "function" && (f = C.getLabelForValue(m)), f = n(f);
1198
- const d = C == null ? void 0 : C.chart, _ = C == null ? void 0 : C.ctx, F = d.width * 0.4;
1199
- if (_ && F > 0) {
1200
- _.save();
1201
- const b = _.measureText(f).width > F ? t(_, f, F) : f;
1202
- return _.restore(), b;
1203
- }
1204
- return f;
1205
- }
1206
- },
1207
- title: {
1208
- display: e.showYTitle,
1209
- text: e.yTitle,
1210
- font: {
1211
- size: e.yTitleFontSize
1212
- }
1213
- }
1214
- })), l = S(() => ({
1215
- display: e.showLegend,
1216
- position: e.legendPosition,
1217
- usePointStyle: e.usePointStyle,
1218
- maxHeight: e.legendMaxHeight,
1219
- maxWidth: e.legendMaxWidth,
1220
- labels: {
1221
- usePointStyle: e.usePointStyle ?? !0,
1222
- generateLabels: (m) => {
1223
- var f;
1224
- const p = ((f = m == null ? void 0 : m.data) == null ? void 0 : f.datasets) || [];
1225
- if (p.length === 0) return [];
1226
- if (p.length === 1 && Array.isArray(p[0].backgroundColor) && p[0].backgroundColor.length > 1 && Array.isArray(p[0].data)) {
1227
- const C = p[0];
1228
- return m.data.labels.map((_, F) => {
1229
- const R = C.backgroundColor[F];
1230
- return {
1231
- text: _,
1232
- fontColor: "#6b6b6b",
1233
- fillStyle: R,
1234
- strokeStyle: R,
1235
- datasetIndex: 0,
1236
- index: F,
1237
- hidden: m.getDataVisibility ? !m.getDataVisibility(F) : !1
1238
- };
1239
- });
1240
- }
1241
- return m.data.datasets.map((C, d) => {
1242
- const _ = C.borderColor || C.backgroundColor;
1243
- return {
1244
- text: C.label,
1245
- fontColor: "#6b6b6b",
1246
- fillStyle: _,
1247
- strokeStyle: _,
1248
- datasetIndex: d,
1249
- hidden: !m.isDatasetVisible(d)
1250
- };
1251
- });
1252
- }
1253
- }
1254
- })), y = S(() => e.isTransposed), i = S(() => e.chartWidth), k = S(() => e.chartHeight);
1255
- return { datalabels: o, xCfg: a, yCfg: r, isTransposed: y, legend: l, chartWidth: i, chartHeight: k };
1256
- }
1257
- const Ko = {
1258
- key: 0,
1259
- class: "pointer-events-none fixed inset-0 z-[120] flex justify-end"
1260
- }, Jo = ["aria-label"], Zo = { class: "relative z-20 flex shrink-0 items-center bg-fm-color-neutral-white justify-between sm:px-5" }, Qo = { class: "fm-typo-en-title-sm-600 text-fm-color-typo-primary min-w-0 flex-1 truncate pr-3" }, el = { class: "flex items-center gap-1.5" }, tl = {
1261
- key: 0,
1262
- class: "pb-2 fm-typo-en-body-md-600 text-fm-color-typo-secondary"
1263
- }, nl = ["onMouseenter", "onFocus"], al = { class: "min-w-0 flex flex-1 items-center gap-2.5 pr-2" }, ol = { class: "min-w-0 truncate text-fm-color-typo-secondary" }, ll = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary shrink-0 text-right tabular-nums" }, An = 500, rl = 320, xt = /* @__PURE__ */ Be({
1264
- __name: "TooltipDetailSidesheet",
1265
- props: {
1266
- modelValue: { type: Boolean },
1267
- detailsPayload: {}
1268
- },
1269
- emits: ["update:modelValue", "value-hover", "value-leave"],
1270
- setup(e, { emit: t }) {
1271
- const n = e, o = t, { t: a } = et(), r = L(null), l = L(An), y = L(!1), i = S({
1272
- get: () => n.modelValue,
1273
- set: (D) => o("update:modelValue", D)
1274
- }), k = S(() => {
1275
- var D;
1276
- return (((D = n.detailsPayload) == null ? void 0 : D.sections) ?? []).filter((z) => z.values.length > 0);
1277
- }), m = S(() => ({
1278
- width: `${l.value}px`,
1279
- maxWidth: "94vw"
1280
- }));
1281
- function p(D) {
1282
- return D.value.toLocaleString();
1283
- }
1284
- function f(D) {
1285
- const z = `: ${p(D)}`;
1286
- return D.text.endsWith(z) ? D.text.slice(0, -z.length) : D.text;
1287
- }
1288
- function C(D) {
1289
- o("value-hover", D);
1290
- }
1291
- function d() {
1292
- o("value-leave");
1293
- }
1294
- function _() {
1295
- d(), i.value = !1;
1296
- }
1297
- function F() {
1298
- return typeof window > "u" ? An : Math.floor(window.innerWidth * 0.94);
1299
- }
1300
- function R(D) {
1301
- const z = F(), P = Math.min(rl, z);
1302
- return Math.min(z, Math.max(P, Math.floor(D)));
1303
- }
1304
- function b(D) {
1305
- typeof window > "u" || (l.value = R(window.innerWidth - D));
1306
- }
1307
- function x() {
1308
- y.value = !1, document.removeEventListener("pointermove", g), document.removeEventListener("pointerup", x), document.removeEventListener("pointercancel", x);
1309
- }
1310
- function g(D) {
1311
- y.value && b(D.clientX);
1312
- }
1313
- function c(D) {
1314
- i.value && (y.value = !0, b(D.clientX), document.addEventListener("pointermove", g), document.addEventListener("pointerup", x), document.addEventListener("pointercancel", x));
1315
- }
1316
- function v() {
1317
- l.value = R(l.value);
1318
- }
1319
- function $(D) {
1320
- var I;
1321
- if (!i.value)
1322
- return;
1323
- const z = D.target;
1324
- if (!(z instanceof Node))
1325
- return;
1326
- const P = z instanceof Element ? z : null;
1327
- P != null && P.closest('[data-tooltip-full-details="true"]') || (I = r.value) != null && I.contains(z) || _();
1328
- }
1329
- function B(D) {
1330
- i.value && D.key === "Escape" && _();
1331
- }
1332
- return Ne(() => {
1333
- l.value = R(l.value), document.addEventListener("pointerdown", $, !0), document.addEventListener("keydown", B), window.addEventListener("resize", v);
1334
- }), Fa(() => {
1335
- x(), document.removeEventListener("pointerdown", $, !0), document.removeEventListener("keydown", B), window.removeEventListener("resize", v);
1336
- }), (D, z) => {
1337
- const P = Z("FmButton");
1338
- return X(), he(Ia, {
1339
- "enter-active-class": "transform transition duration-200 ease-out",
1340
- "enter-from-class": "translate-x-full opacity-0",
1341
- "enter-to-class": "translate-x-0 opacity-100",
1342
- "leave-active-class": "transform transition duration-150 ease-in",
1343
- "leave-from-class": "translate-x-0 opacity-100",
1344
- "leave-to-class": "translate-x-full opacity-0"
1345
- }, {
1346
- default: ce(() => [
1347
- i.value ? (X(), oe("div", Ko, [
1348
- j("div", {
1349
- ref_key: "panelRef",
1350
- ref: r,
1351
- class: "glassmorphism pointer-events-auto relative ml-auto flex h-full flex-col px-24 py-3 overflow-hidden rounded-l-2xl border border-fm-color-border-secondary bg-fm-color-neutral-white duration-200 ease-out",
1352
- style: $e(m.value),
1353
- role: "dialog",
1354
- "aria-modal": "false",
1355
- "aria-label": u(a)("report.widget.comparisonTooltip.fullBreakdownTitle")
1356
- }, [
1357
- j("div", {
1358
- class: "absolute left-0 top-0 z-40 h-full w-3 -translate-x-1/2 cursor-ew-resize",
1359
- onPointerdown: $t(c, ["prevent"])
1360
- }, null, 32),
1361
- j("div", Zo, [
1362
- j("div", Qo, Le(u(a)("report.widget.comparisonTooltip.fullBreakdownTitle")), 1),
1363
- j("div", el, [
1364
- K(P, {
1365
- class: "relative z-30 h-9 w-9 shrink-0",
1366
- variant: "tertiary",
1367
- icon: "close",
1368
- "aria-label": u(a)("report.dynamic.common.close"),
1369
- onClick: _
1370
- }, null, 8, ["aria-label"])
1371
- ])
1372
- ]),
1373
- j("div", {
1374
- class: "flex flex-1 flex-col gap-4 overflow-y-auto px-4 py-4 sm:px-5",
1375
- onMouseleave: d
1376
- }, [
1377
- (X(!0), oe(ke, null, it(k.value, (I, V) => (X(), oe("div", {
1378
- key: `${I.title || "section"}-${V}`,
1379
- class: "flex flex-col gap-2 rounded-2xl bg-fm-color-neutral-white/45 py-3"
1380
- }, [
1381
- I.title ? (X(), oe("p", tl, Le(I.title), 1)) : Ve("", !0),
1382
- (X(!0), oe(ke, null, it(I.values, (O, G) => (X(), oe("button", {
1383
- key: `${O.text}-${G}`,
1384
- type: "button",
1385
- class: "fm-typo-en-body-md-400 text-fm-color-typo-primary flex w-full items-center justify-between gap-3 bg-transparent px-2 py-1.5 text-left transition-colors hover:bg-fm-color-opacity-sm focus-visible:bg-fm-color-opacity-sm focus-visible:outline-none",
1386
- onMouseenter: (T) => C(O),
1387
- onFocus: (T) => C(O),
1388
- onMouseleave: d,
1389
- onBlur: d
1390
- }, [
1391
- j("span", al, [
1392
- j("span", {
1393
- class: Qe([
1394
- "inline-block h-3 w-3 shrink-0 box-border",
1395
- O.isBar ? "rounded-sm border border-fm-color-neutral-gray-400" : "rounded-full border border-white shadow-[0_0_0_1px_rgba(17,24,39,0.28)]"
1396
- ]),
1397
- style: $e({ backgroundColor: O.color })
1398
- }, null, 6),
1399
- j("span", ol, Le(f(O)), 1)
1400
- ]),
1401
- j("span", ll, Le(p(O)), 1)
1402
- ], 40, nl))), 128))
1403
- ]))), 128))
1404
- ], 32)
1405
- ], 12, Jo)
1406
- ])) : Ve("", !0)
1407
- ]),
1408
- _: 1
1409
- });
1410
- };
1411
- }
1412
- });
1413
- function St(e, t) {
1414
- const { t: n } = et(), o = L(!1), a = L(null), r = L(null);
1415
- function l() {
1416
- return zo(e.value) ?? r.value;
1417
- }
1418
- function y(f) {
1419
- o.value = f, !f && (a.value = null, Bt(l()), r.value = null);
1420
- }
1421
- function i(f, C) {
1422
- a.value = f, r.value = C ?? l(), o.value = !0;
1423
- }
1424
- function k(f) {
1425
- Bt(l(), f.focusTarget);
1426
- }
1427
- function m() {
1428
- Bt(l());
1429
- }
1430
- const p = S(() => ({
1431
- viewFullDetailsLabel: n("report.widget.comparisonTooltip.viewBreakdown"),
1432
- onViewFullDetails: i,
1433
- maxTooltipItems: u(t == null ? void 0 : t.maxTooltipItems)
1434
- }));
1435
- return {
1436
- isTooltipDetailsSheetOpen: o,
1437
- tooltipDetailsPayload: a,
1438
- tooltipOptions: p,
1439
- handleTooltipDetailsSheetVisibility: y,
1440
- handleTooltipDetailsHover: k,
1441
- handleTooltipDetailsLeave: m
1442
- };
1443
- }
1444
- const sl = /* @__PURE__ */ Be({
1445
- __name: "WidgetBarchart",
1446
- props: /* @__PURE__ */ ze({
1447
- tileIndex: {}
1448
- }, {
1449
- modelValue: { required: !0 },
1450
- modelModifiers: {}
1451
- }),
1452
- emits: ["update:modelValue"],
1453
- setup(e) {
1454
- const t = e, n = He(e, "modelValue"), o = L(null), a = S(() => n.value.maxTooltipItems), {
1455
- isTooltipDetailsSheetOpen: r,
1456
- tooltipDetailsPayload: l,
1457
- tooltipOptions: y,
1458
- handleTooltipDetailsSheetVisibility: i,
1459
- handleTooltipDetailsHover: k,
1460
- handleTooltipDetailsLeave: m
1461
- } = St(o, {
1462
- maxTooltipItems: a
1463
- }), p = S(() => {
1464
- var P;
1465
- return ((P = n.value.data) == null ? void 0 : P.datasets) ?? [];
1466
- }), f = S(() => {
1467
- var P;
1468
- return ((P = n.value.data) == null ? void 0 : P.xAxis) ?? [];
1469
- }), C = S(() => f.value.length === 1 && p.value.length > 1 && p.value.every((P) => P.values.length === 1 && P.isCompare !== !0)), d = S(() => C.value ? p.value.map((P) => P.name) : f.value), { datalabels: _, xCfg: F, yCfg: R, isTransposed: b, legend: x, chartWidth: g, chartHeight: c } = ft(
1470
- n.value
1471
- ), v = S(
1472
- () => mt(n.value.isTransposed === !0, !0, y.value)
1473
- ), $ = Ct("bar"), B = S(() => p.value.length > 0 ? [
1474
- ...p.value.map((P, I) => {
1475
- const V = Ae({
1476
- datasetIndex: I,
1477
- isCompare: P.isCompare,
1478
- metricCount: n.value.metricCount,
1479
- mode: n.value.chartColorBinding
1480
- }), O = Ae({
1481
- datasetIndex: I,
1482
- isCompare: P.isCompare,
1483
- metricCount: n.value.metricCount,
1484
- mode: _e.metric
1485
- });
1486
- let G = P.values;
1487
- C.value && (G = p.value.map(
1488
- (N, A) => A === I ? P.values[0] : Number.NaN
1489
- ));
1490
- const T = n.value.chartColorBinding === _e.breakdown, w = At({
1491
- datasetName: P.name,
1492
- breakdownValues: n.value.chartBreakdownDimensionValues,
1493
- fallbackIndex: I
1494
- });
1495
- return {
1496
- label: P.name,
1497
- data: G,
1498
- dash: !!P.isCompare,
1499
- backgroundColor: T ? bt({
1500
- breakdownIndex: w,
1501
- metricIndex: O,
1502
- metricCount: n.value.metricCount,
1503
- isCompare: P.isCompare,
1504
- breakdownColors: n.value.chartBreakdownColors,
1505
- useSecondaryMetricShades: n.value.chartUseSecondaryMetricShades,
1506
- customColors: n.value.chartColors
1507
- }) : dt({
1508
- index: V,
1509
- isCompare: P.isCompare,
1510
- customColors: n.value.chartColors
1511
- })
1512
- };
1513
- })
1514
- ] : []), D = ct();
1515
- function z() {
1516
- return D.extractChartSize(o.value, t.tileIndex) || { width: 0, height: 0 };
1517
- }
1518
- return Ne(() => {
1519
- De(() => {
1520
- z();
1521
- });
1522
- }), pe([B], () => {
1523
- De(() => z());
1524
- }), (P, I) => {
1525
- const V = Z("FmBarChart");
1526
- return X(), oe(ke, null, [
1527
- Ue(P.$slots, "menu"),
1528
- K(V, {
1529
- ref_key: "chartRef",
1530
- ref: o,
1531
- class: "bar-chart",
1532
- datasets: B.value,
1533
- "x-axis": { categories: d.value },
1534
- "x-cfg": u(F),
1535
- "y-cfg": u(R),
1536
- transpose: u(b),
1537
- legend: {
1538
- display: u(x).display ?? !1,
1539
- position: u(x).position,
1540
- maxHeight: u(x).maxHeight,
1541
- maxWidth: u(x).maxWidth,
1542
- labels: u(x).labels
1543
- },
1544
- tooltip: v.value,
1545
- datalabels: u(_),
1546
- plugins: [u($)],
1547
- "maintain-aspect-ratio": !1,
1548
- style: $e({
1549
- "--chart-width": u(g) !== void 0 ? u(g) + "px" : "100%",
1550
- "--chart-height": u(c) !== void 0 ? u(c) + "px" : "calc(100% - 36px)"
1551
- })
1552
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "datalabels", "plugins", "style"]),
1553
- K(xt, {
1554
- "model-value": u(r),
1555
- "details-payload": u(l),
1556
- "onUpdate:modelValue": u(i),
1557
- onValueHover: u(k),
1558
- onValueLeave: u(m)
1559
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
1560
- ], 64);
1561
- };
1562
- }
1563
- }), il = /* @__PURE__ */ Be({
1564
- __name: "WidgetCircular",
1565
- props: /* @__PURE__ */ ze({
1566
- tileIndex: {}
1567
- }, {
1568
- modelValue: { required: !0 },
1569
- modelModifiers: {}
1570
- }),
1571
- emits: ["update:modelValue"],
1572
- setup(e) {
1573
- const t = e, n = He(e, "modelValue"), { breakpoints: o } = Un(), a = L(null), { datalabels: r, legend: l, chartWidth: y, chartHeight: i } = ft(n.value), k = S(() => {
1574
- let _ = [];
1575
- return n.value.data.datasets && n.value.data.metrics && n.value.data.datasets.length > 0 && n.value.data.metrics.length > 0 && (_ = [
1576
- {
1577
- label: n.value.data.metrics[0],
1578
- data: n.value.data.datasets.map((F) => F.value),
1579
- backgroundColor: n.value.data.datasets.map(
1580
- (F, R) => dt({ index: R, customColors: n.value.chartColors })
1581
- )
1582
- }
1583
- ]), _;
1584
- }), m = ct();
1585
- function p() {
1586
- return m.extractChartSize(a.value, t.tileIndex) || { width: 0, height: 0 };
1587
- }
1588
- Ne(() => {
1589
- De(() => {
1590
- p();
1591
- });
1592
- }), pe([k], () => {
1593
- De(() => p());
1594
- });
1595
- const f = S(() => o.value.lg ? 12 : 8), C = S(
1596
- () => ({
1597
- display: l.value.display ?? !0,
1598
- position: l.value.position ?? "top",
1599
- maxHeight: l.value.maxHeight,
1600
- maxWidth: l.value.maxWidth,
1601
- labels: {
1602
- ...l.value.labels,
1603
- font: {
1604
- size: f.value
1605
- }
1606
- }
1607
- })
1608
- ), d = io();
1609
- return (_, F) => {
1610
- const R = Z("FmPieChart");
1611
- return X(), oe(ke, null, [
1612
- Ue(_.$slots, "menu"),
1613
- K(R, {
1614
- ref_key: "chartRef",
1615
- ref: a,
1616
- class: "circular",
1617
- percentage: "70%",
1618
- datasets: k.value,
1619
- metrics: n.value.data.datasets.map((b) => b.name),
1620
- tooltip: u(d),
1621
- variant: "doughnut",
1622
- legend: C.value,
1623
- datalabels: u(r),
1624
- "maintain-aspect-ratio": !1,
1625
- style: $e({
1626
- "--chart-width": u(y) !== void 0 ? u(y) + "px" : "100%",
1627
- "--chart-height": u(i) !== void 0 ? u(i) + "px" : "calc(100% - 36px)"
1628
- })
1629
- }, null, 8, ["datasets", "metrics", "tooltip", "legend", "datalabels", "style"])
1630
- ], 64);
1631
- };
1632
- }
1633
- });
1634
- function Rt(e) {
1635
- if (e == null || e === "")
1636
- return "";
1637
- const t = String(e), n = Number(t);
1638
- if (isNaN(n)) return t;
1639
- const [o, a] = t.split("."), r = new Intl.NumberFormat("en-US").format(Number(o));
1640
- return a !== void 0 ? `${r}.${a}` : r;
1641
- }
1642
- const ul = { class: "flex flex-col gap-1" }, cl = { class: "fm-typo-en-title-md-600" }, dl = { class: "flex gap-2" }, ml = { class: "fm-typo-en-body-md-600 text-fm-color-typo-primary" }, fl = { key: 0 }, pl = { key: 1 }, hl = /* @__PURE__ */ Be({
1643
- __name: "WidgetScorecard",
1644
- props: {
1645
- modelValue: { required: !0 },
1646
- modelModifiers: {}
1647
- },
1648
- emits: ["update:modelValue"],
1649
- setup(e) {
1650
- const t = He(e, "modelValue"), { t: n } = et(), { compareDateRange: o, defaultDateSetting: a } = Ee(gt()), { country: r } = an(), l = S(() => {
1651
- var d;
1652
- return ((d = t.value.data) == null ? void 0 : d.value) || "";
1653
- }), y = S(() => Rt(l.value)), i = S(() => {
1654
- const { data: d } = t.value;
1655
- return d != null && d.comparison ? Yn(l.value, d.comparison, r) : null;
1656
- });
1657
- function k(d) {
1658
- switch (d) {
1659
- case Gt.bar:
1660
- return "bar";
1661
- case Gt.line:
1662
- return "line";
1663
- default:
1664
- return "line";
1665
- }
1666
- }
1667
- const m = S(() => {
1668
- var d;
1669
- return (d = t.value.data) == null ? void 0 : d.sparkline;
1670
- }), p = S(() => ({
1671
- display: !1,
1672
- beginAtZero: !1,
1673
- grace: "20%"
1674
- })), f = S(() => m.value.datasets.map((d) => ({
1675
- label: d.name,
1676
- data: d.values,
1677
- fill: !0,
1678
- color: "#36a2eb"
1679
- }))), C = S(() => mt(!1, !0));
1680
- return (d, _) => {
1681
- const F = Z("FmIcon"), R = Z("FmChip"), b = Z("FmTooltip"), x = Z("FmLineChart");
1682
- return X(), oe("div", ul, [
1683
- Ue(d.$slots, "menu"),
1684
- j("p", cl, Le(y.value), 1),
1685
- j("div", dl, [
1686
- K(b, {
1687
- disabled: i.value === null,
1688
- placement: "right",
1689
- "hide-arrow": "",
1690
- variant: "rich"
1691
- }, {
1692
- content: ce(() => {
1693
- var g;
1694
- return [
1695
- j("span", ml, Le(`vs. ${(g = u(a).defaultCompareType) == null ? void 0 : g.split("_").join(" ")}`), 1)
1696
- ];
1697
- }),
1698
- default: ce(() => [
1699
- i.value ? (X(), he(R, {
1700
- key: 0,
1701
- icon: i.value.icon.name,
1702
- class: Qe(`bg-${i.value.icon.tailwind}`),
1703
- compact: ""
1704
- }, {
1705
- default: ce(() => [
1706
- K(F, {
1707
- name: i.value.icon.name,
1708
- color: i.value.icon.color
1709
- }, null, 8, ["name", "color"]),
1710
- j("p", {
1711
- class: "fm-typo-en-body-md-600",
1712
- style: $e({ color: i.value.icon.color })
1713
- }, Le(i.value.value), 5)
1714
- ]),
1715
- _: 1
1716
- }, 8, ["icon", "class"])) : Ve("", !0),
1717
- u(o).endDate != null && u(o).startDate != null && i.value === null ? (X(), he(R, {
1718
- key: 1,
1719
- class: "invisible pointer-events-none",
1720
- "aria-hidden": "true",
1721
- compact: ""
1722
- }, {
1723
- default: ce(() => [
1724
- K(F, {
1725
- name: "arrow_upward",
1726
- color: "#C7C7CC"
1727
- }),
1728
- _[0] || (_[0] = j("p", { class: "fm-typo-en-body-md-600" }, " ", -1))
1729
- ]),
1730
- _: 1
1731
- })) : Ve("", !0)
1732
- ]),
1733
- _: 1
1734
- }, 8, ["disabled"])
1735
- ]),
1736
- m.value ? (X(), oe("div", fl, [
1737
- k(m.value.type) === "line" ? (X(), he(x, {
1738
- key: 0,
1739
- class: "sparkline",
1740
- datasets: f.value,
1741
- legend: {
1742
- display: !1
1743
- },
1744
- datalabels: { display: !1 },
1745
- "x-axis": { categories: m.value.dimensions },
1746
- "y-cfg": p.value,
1747
- "x-cfg": { display: !1 },
1748
- tooltip: C.value,
1749
- "maintain-aspect-ratio": !1
1750
- }, null, 8, ["datasets", "x-axis", "y-cfg", "tooltip"])) : Ve("", !0)
1751
- ])) : (X(), oe("div", pl, _[1] || (_[1] = [
1752
- j("div", { class: "sparkline" }, [
1753
- j("div", { class: "flex flex-col gap-8" }, [
1754
- j("div"),
1755
- j("div")
1756
- ]),
1757
- j("div", { class: "grow" })
1758
- ], -1)
1759
- ])))
1760
- ]);
1761
- };
1762
- }
1763
- }), vl = {};
1764
- function gl(e, t) {
1765
- const n = Z("FmMenuDivider");
1766
- return X(), he(n);
1767
- }
1768
- const yl = /* @__PURE__ */ eo(vl, [["render", gl]]), bl = "mf-reporttable-dimension", Mn = En(bl, () => {
1769
- const e = L(0), t = L([]), n = L(!1), o = (b, x) => {
1770
- e.value = b, r(b, x);
1771
- }, a = (b, x, g, c) => {
1772
- t[b] = x, t.value = [...t.value], l(b, x, g, c);
1773
- }, r = (b, x) => {
1774
- const g = (x == null ? void 0 : x.querySelectorAll("thead tr")) ?? [], c = (x == null ? void 0 : x.querySelectorAll("tbody tr")) ?? [];
1775
- [...g, ...c].forEach(($) => {
1776
- const B = $;
1777
- B && (B.style.height = `${b}px`);
1778
- });
1779
- }, l = (b, x, g, c = !1) => {
1780
- const v = (g == null ? void 0 : g.querySelectorAll("th")) ?? [];
1781
- if (b === void 0) return;
1782
- const $ = v[b], B = c ? t[b] : x;
1783
- if (!$ || B === void 0) return;
1784
- const D = () => {
1785
- $.style.width = `${B}px`;
1786
- };
1787
- c ? requestAnimationFrame(D) : D();
1788
- }, y = () => {
1789
- const b = document.querySelectorAll("th"), x = document.querySelectorAll("td"), g = document.querySelector("table");
1790
- g == null || g.classList.add("table-fixed"), b.forEach((c) => c.classList.add("toggleEditResize")), x.forEach((c) => c.classList.add("toggleEditResize")), n.value = !0;
1791
- }, i = () => {
1792
- const b = document.querySelectorAll("th"), x = document.querySelectorAll("td"), g = document.querySelectorAll(".col-resize-handle"), c = document.querySelectorAll(".row-resize-handle");
1793
- b.forEach((v) => v.classList.remove("toggleEditResize")), x.forEach((v) => v.classList.remove("toggleEditResize")), g.forEach((v) => v.remove()), c.forEach((v) => v.remove()), n.value = !1;
1794
- }, k = () => {
1795
- e.value = 0, t.value = [];
1796
- }, m = (b, x) => {
1797
- if (x) {
1798
- const g = document.querySelectorAll(`thead th:nth-child(${b + 1})`), c = document.querySelectorAll(`tbody td:nth-child(${b + 1})`);
1799
- [...g, ...c].forEach((v) => {
1800
- v.classList.add("highlight-hover-col");
1801
- });
1802
- } else
1803
- document.querySelectorAll(
1804
- `thead th:nth-child(${b + 1}), tbody td:nth-child(${b + 1})`
1805
- ).forEach((g) => g.classList.add("highlight-col"));
1806
- }, p = (b) => {
1807
- const x = document.querySelectorAll("thead tr"), g = document.querySelectorAll("tbody tr"), c = [...x, ...g];
1808
- for (const v of c)
1809
- b ? v.classList.add("highlight-hover-row") : v.classList.add("highlight-row");
1810
- }, f = (b) => {
1811
- const x = b ? ".highlight-hover-row" : ".highlight-row", g = document.querySelectorAll(x);
1812
- for (const c of g)
1813
- c.classList.remove(x.slice(1));
1814
- }, C = (b) => {
1815
- b ? document.querySelectorAll(".highlight-hover-col").forEach((x) => {
1816
- x.classList.remove("highlight-hover-col");
1817
- }) : document.querySelectorAll(".highlight-col").forEach((x) => x.classList.remove("highlight-col"));
1818
- }, d = (b, x) => {
1819
- const g = b.clientX, c = b.target.closest("table");
1820
- if (!c) return;
1821
- const v = c.querySelectorAll("th")[x];
1822
- if (!v) return;
1823
- const $ = v.getBoundingClientRect().width || 60, B = v.querySelector("button"), D = (B == null ? void 0 : B.querySelector("span")) || v.querySelector("p") || v;
1824
- let z = 60;
1825
- if (D) {
1826
- const T = D.textContent || "", w = window.getComputedStyle(D), N = `${w.fontWeight} ${w.fontSize} ${w.fontFamily}`, W = document.createElement("canvas").getContext("2d");
1827
- if (W) {
1828
- W.font = N;
1829
- const U = W.measureText(T), ee = window.getComputedStyle(v), te = parseFloat(ee.paddingLeft || "0"), ve = parseFloat(ee.paddingRight || "0");
1830
- z = U.width + te + ve;
1831
- }
1832
- }
1833
- m(x, !1);
1834
- let P = null, I = null;
1835
- const V = () => {
1836
- if (I === null) return;
1837
- const T = v;
1838
- T.style.width = `${I}px`;
1839
- let w = 0;
1840
- c.querySelectorAll("th").forEach((A, W) => {
1841
- w += W === x ? I : A.getBoundingClientRect().width;
1842
- }), c.classList.remove("w-full"), c.style.width = `${w}px`, P = null;
1843
- }, O = (T) => {
1844
- const w = T.clientX - g;
1845
- I = Math.max(z, $ + w), P === null && (P = requestAnimationFrame(V));
1846
- }, G = () => {
1847
- P !== null && cancelAnimationFrame(P), I !== null && (v.style.width = `${I}px`);
1848
- const T = c.querySelectorAll("th"), w = [];
1849
- T.forEach((N) => {
1850
- w.push(N.getBoundingClientRect().width);
1851
- }), t.value = w, C(!1), document.removeEventListener("mousemove", O), document.removeEventListener("mouseup", G);
1852
- };
1853
- document.addEventListener("mousemove", O), document.addEventListener("mouseup", G);
1854
- }, _ = (b) => {
1855
- const x = b.clientY, g = b.target.closest("table"), c = e.value || 48;
1856
- p(!1);
1857
- const v = (B) => {
1858
- const D = Math.max(30, c + (B.clientY - x));
1859
- g && o(D, g);
1860
- }, $ = () => {
1861
- f(!1), document.removeEventListener("mousemove", v), document.removeEventListener("mouseup", $);
1862
- };
1863
- document.addEventListener("mousemove", v), document.addEventListener("mouseup", $);
1864
- };
1865
- return {
1866
- rowHeight: e,
1867
- colWidths: t,
1868
- isEditing: n,
1869
- updateRowHeight: o,
1870
- updateColWidth: a,
1871
- setRowHeights: r,
1872
- setColWidths: l,
1873
- enableEditMode: y,
1874
- disableEditMode: i,
1875
- resetStore: k,
1876
- highlightCol: m,
1877
- highlightRows: p,
1878
- removeRowHighlight: f,
1879
- removeColHighlight: C,
1880
- resizeCol: d,
1881
- resizeRow: _,
1882
- enableCellResizing: () => {
1883
- const b = document.querySelector("thead"), x = document.querySelectorAll("thead tr"), g = document.querySelectorAll("tbody tr"), c = [...x, ...g];
1884
- b && b.classList.remove("sticky");
1885
- const v = ($, B) => {
1886
- const D = document.createElement("div");
1887
- return D.className = `${$}-resize-handle`, $ === "col" ? (D.addEventListener("mouseenter", () => m(B, !0)), D.addEventListener("mouseleave", () => C(!0)), D.addEventListener("mousedown", (z) => {
1888
- z.stopPropagation(), d(z, B);
1889
- })) : (D.addEventListener("mouseenter", () => p(!0)), D.addEventListener("mouseleave", () => f(!0)), D.addEventListener("mousedown", (z) => {
1890
- z.stopPropagation(), _(z);
1891
- })), D;
1892
- };
1893
- c.forEach(($) => {
1894
- const B = $.closest("thead") !== null;
1895
- $.querySelectorAll(B ? "th" : "td").forEach((z, P) => {
1896
- const I = v("col", P), V = v("row", P);
1897
- z.appendChild(I), z.appendChild(V);
1898
- });
1899
- }), y();
1900
- },
1901
- cancelResizingChanges: () => {
1902
- i();
1903
- }
1904
- };
1905
- }), Cl = "/assets/processTableData.worker-DrSBAOPU.js", wl = { class: "my-4" }, xl = {
1906
- class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
1907
- style: { backgroundColor: "#f9f9f9" }
1908
- }, Sl = { class: "font-bold" }, _l = { class: "text-fm-color-neutral-gray-300" }, kl = /* @__PURE__ */ Be({
1909
- __name: "WidgetTable",
1910
- props: /* @__PURE__ */ ze({
1911
- tileIndex: {}
1912
- }, {
1913
- modelValue: { required: !0 },
1914
- modelModifiers: {}
1915
- }),
1916
- emits: ["update:modelValue"],
1917
- setup(e) {
1918
- const { t, te: n } = et(), o = He(e, "modelValue"), { country: a } = an(), { clearTileSorts: r, setTileSorts: l } = Aa(), y = on(), i = e, k = L([]), { isEditing: m, colWidths: p, rowHeight: f } = Ee(Mn()), { setColWidths: C, setRowHeights: d, enableCellResizing: _ } = Mn(), F = L(null), R = S(() => {
1919
- var T;
1920
- return ((T = o.value.data) == null ? void 0 : T.columns) || [{ label: "", key: "" }];
1921
- }), b = S(() => {
1922
- var T;
1923
- return ((T = o.value.data) == null ? void 0 : T.rows) || [];
1924
- }), x = S(() => o.value.filterText), g = S(() => {
1925
- var T, w;
1926
- if (!(x.value && x.value.trim().length > 0 || !((T = b.value[0]) != null && T.isRollup) && !((w = b.value[b.value.length - 1]) != null && w.isRollup))) {
1927
- if (o.value.rollupPosition === Ge.top || o.value.rollupPosition === void 0)
1928
- return Ge.top;
1929
- if (o.value.rollupPosition === Ge.bottom)
1930
- return Ge.bottom;
1931
- }
1932
- }), c = S(() => {
1933
- const A = g.value !== void 0 ? 1 : 0, W = (F.value ? F.value.$el.offsetHeight : 0) - 48;
1934
- return Math.floor((W - 34.5 - 32) / 48) - A;
1935
- }), v = S(() => {
1936
- var w, N;
1937
- let T = [];
1938
- switch (g.value) {
1939
- case Ge.top:
1940
- T = [...((w = b.value[0]) == null ? void 0 : w.cells) || []].map((A, W) => {
1941
- var U;
1942
- return {
1943
- main: A,
1944
- comparison: (U = b.value[0]) == null ? void 0 : U.comparisonCells[W],
1945
- rowType: R.value[W].type
1946
- };
1947
- });
1948
- break;
1949
- case Ge.bottom:
1950
- T = [...((N = b.value[b.value.length - 1]) == null ? void 0 : N.cells) || []].map((A, W) => {
1951
- var U;
1952
- return {
1953
- main: A,
1954
- comparison: (U = b.value[0]) == null ? void 0 : U.comparisonCells[W],
1955
- rowType: R.value[W].type
1956
- };
1957
- });
1958
- break;
1959
- }
1960
- return T.length > 0 && T[0].main === "" && (T[0].main = Ke(t, n, "Grand Total", "other")), T;
1961
- });
1962
- function $(T) {
1963
- let w = (T == null ? void 0 : T.main) || "";
1964
- return !T || T.main === "" || !T.comparison ? {
1965
- main: w
1966
- } : (w.includes("#") && !w.startsWith("#") && (w = w.split("#")[0]), {
1967
- main: w,
1968
- comparison: T == null ? void 0 : T.comparison,
1969
- difference: Yn(T.main, T.comparison, a)
1970
- });
1971
- }
1972
- Ne(() => {
1973
- r();
1974
- });
1975
- const B = L([]);
1976
- let D = 0, z;
1977
- function P() {
1978
- var W;
1979
- if (!((W = o.value) != null && W.data)) {
1980
- B.value = [];
1981
- return;
1982
- }
1983
- const T = ++D, w = (o.value.data.rows || []).map((U) => ({
1984
- isRollup: U.isRollup,
1985
- cells: Array.isArray(U.cells) ? [...U.cells] : [],
1986
- comparisonCells: Array.isArray(U.comparisonCells) ? [...U.comparisonCells] : []
1987
- })), N = (o.value.data.columns || []).map((U) => ({
1988
- key: U.key,
1989
- type: U.type,
1990
- label: U.label
1991
- })), A = {
1992
- rows: w,
1993
- columns: N,
1994
- filter: x.value ?? "",
1995
- globalSorts: Va(k.value).map((U) => ({
1996
- key: U.key,
1997
- type: U.type
1998
- })),
1999
- grandTotalPosition: g.value,
2000
- pageSize: c.value
2001
- };
2002
- Ma(Cl, A).then((U) => {
2003
- T === D && (U != null && U.error ? (y.open({ message: "Failed to process table data. Please retry.", type: "error" }), console.log(U.error), B.value = []) : B.value = $a(U.data || []));
2004
- });
2005
- }
2006
- pe(
2007
- () => k.value,
2008
- (T) => {
2009
- i.tileIndex === void 0 || i.tileIndex === null || l(i.tileIndex, T);
2010
- },
2011
- { immediate: !0, deep: !0 }
2012
- );
2013
- const I = S(() => {
2014
- var N, A;
2015
- const T = ((N = o.value.data) == null ? void 0 : N.rows) || [], w = ((A = o.value.data) == null ? void 0 : A.columns) || [];
2016
- return JSON.stringify({
2017
- rowsLength: T.length,
2018
- columns: w.map((W) => ({ key: W.key, type: W.type, label: W.label })),
2019
- filter: x.value ?? "",
2020
- globalSorts: k.value.map((W) => ({ key: W.key, type: W.type })),
2021
- grandTotalPosition: g.value,
2022
- pageSize: c.value
2023
- });
2024
- });
2025
- pe(
2026
- () => I.value,
2027
- () => {
2028
- clearTimeout(z), z = setTimeout(P, 200);
2029
- },
2030
- { immediate: !0 }
2031
- );
2032
- function V(T) {
2033
- const w = k.value.find((N) => N.key === T);
2034
- if (!w) {
2035
- k.value.push({ key: T, type: je.Asc });
2036
- return;
2037
- }
2038
- w.type === je.Asc ? w.type = je.Desc : w.type === je.Desc && (k.value = k.value.filter((N) => N.key !== T));
2039
- }
2040
- const O = S(
2041
- () => {
2042
- var T;
2043
- return (((T = o.value.colWidths) == null ? void 0 : T.length) ?? 0) > 0 || p.value.length > 0;
2044
- }
2045
- ), G = S(() => {
2046
- var T;
2047
- return (T = o.value.data) != null && T.columns ? o.value.data.columns.map((w) => {
2048
- const N = Ke(t, n, w.label, "other"), A = k.value.find((ee) => ee.key === w.key), W = !!A, U = W ? A.type === je.Asc ? "arrow_upward" : "arrow_downward" : "unfold_more";
2049
- return {
2050
- accessorKey: w.key,
2051
- header: () => {
2052
- const ee = Z("FmIcon");
2053
- return Dt(
2054
- "button",
2055
- {
2056
- type: "button",
2057
- class: `w-full flex items-center gap-1 group/select-header select-none ${w.type === "NUMERIC" ? "justify-end" : "justify-start"} ${W ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-400"}`,
2058
- onClick: () => V(w.key)
2059
- },
2060
- [
2061
- Dt(
2062
- "span",
2063
- { class: `${w.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap` },
2064
- N
2065
- ),
2066
- Dt(ee, {
2067
- name: U,
2068
- color: W ? "primary" : "neutral-gray-400",
2069
- size: "sm",
2070
- class: "transition-transform",
2071
- style: U === "arrow_upward" ? "transform: translateY(-1px);" : ""
2072
- })
2073
- ]
2074
- );
2075
- },
2076
- cell: (ee) => {
2077
- var ye, Ie;
2078
- const te = $(ee.getValue()), ve = (Ie = (ye = ee == null ? void 0 : ee.row) == null ? void 0 : ye.original) == null ? void 0 : Ie.isRollup;
2079
- return Dt(
2080
- "div",
2081
- {
2082
- class: [
2083
- ve ? "fm-typo-en-body-md-600 text-fm-color-typo-primary" : "fm-typo-en-body-md-400",
2084
- w.type === "NUMERIC" ? "text-right" : "",
2085
- O.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
2086
- ].join(" ")
2087
- },
2088
- [w.type === "NUMERIC" ? Rt(te.main) : te.main]
2089
- );
2090
- },
2091
- enableSorting: !1
2092
- };
2093
- }) : [];
2094
- });
2095
- return pe(
2096
- () => p.value.length > 0,
2097
- async (T) => {
2098
- T && m.value && (await De(), _());
2099
- }
2100
- ), pe(
2101
- [() => G.value],
2102
- async () => {
2103
- var W;
2104
- await De();
2105
- const T = (W = F.value) == null ? void 0 : W.$el;
2106
- if (!T) return;
2107
- const w = T.querySelector("table");
2108
- if (!w) return;
2109
- w.classList.add(O.value ? "table-fixed" : "table-auto");
2110
- let N, A;
2111
- m.value ? (_(), N = p.value, A = f.value) : (A = o.value.rowHeight, N = o.value.colWidths), typeof A == "number" && d(A, T), N == null || N.forEach((U, ee) => {
2112
- C(ee, U, T);
2113
- });
2114
- },
2115
- { immediate: !0 }
2116
- ), (T, w) => {
2117
- const N = Z("FmTable");
2118
- return X(), oe(ke, null, [
2119
- j("div", wl, [
2120
- Ue(T.$slots, "menu")
2121
- ]),
2122
- K(N, {
2123
- ref_key: "table",
2124
- ref: F,
2125
- "column-defs": G.value,
2126
- "row-data": B.value,
2127
- "search-value": x.value,
2128
- "page-size": c.value,
2129
- "shrink-at": !1,
2130
- "force-mobile-footer": !0,
2131
- class: "scrollbar-hide-table",
2132
- "pin-header-row": !0,
2133
- "auto-reset-page-index": !0
2134
- }, {
2135
- "pin-top": ce(() => [
2136
- j("tbody", null, [
2137
- j("tr", xl, [
2138
- (X(!0), oe(ke, null, it(v.value, (A, W) => (X(), oe("td", {
2139
- key: `${u(vt)()}_${W}`,
2140
- class: "h-[48px] text-fm-color-typo-primary px-16"
2141
- }, [
2142
- j("span", {
2143
- class: Qe([
2144
- "items-center text-fm-color-typo-secondary gap-2",
2145
- A.rowType === "NUMERIC" ? "text-right" : "",
2146
- O.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
2147
- ])
2148
- }, [
2149
- j("p", Sl, Le(A.rowType === "NUMERIC" ? u(Rt)(A.main) : A.main), 1),
2150
- j("p", _l, Le(A.comparison ? A.rowType === "NUMERIC" ? `(${u(Rt)(A.comparison)})` : `(${A.comparison})` : ""), 1)
2151
- ], 2)
2152
- ]))), 128))
2153
- ])
2154
- ])
2155
- ]),
2156
- _: 1
2157
- }, 8, ["column-defs", "row-data", "search-value", "page-size"])
2158
- ], 64);
2159
- };
2160
- }
2161
- }), Tl = /* @__PURE__ */ Be({
2162
- __name: "WidgetStackBarChart",
2163
- props: /* @__PURE__ */ ze({
2164
- tileIndex: {}
2165
- }, {
2166
- modelValue: { required: !0 },
2167
- modelModifiers: {}
2168
- }),
2169
- emits: ["update:modelValue"],
2170
- setup(e) {
2171
- const t = e, n = He(e, "modelValue"), o = L(null), a = S(() => n.value.maxTooltipItems), {
2172
- isTooltipDetailsSheetOpen: r,
2173
- tooltipDetailsPayload: l,
2174
- tooltipOptions: y,
2175
- handleTooltipDetailsSheetVisibility: i,
2176
- handleTooltipDetailsHover: k,
2177
- handleTooltipDetailsLeave: m
2178
- } = St(o, {
2179
- maxTooltipItems: a
2180
- }), p = S(() => {
2181
- var G;
2182
- return ((G = n.value.data) == null ? void 0 : G.xAxis) || [];
2183
- }), f = S(() => {
2184
- var O;
2185
- return ((O = n.value.data) == null ? void 0 : O.datasets) ?? [];
2186
- }), { datalabels: C, xCfg: d, yCfg: _, isTransposed: F, legend: R, chartWidth: b, chartHeight: x } = ft(
2187
- n.value
2188
- ), g = S(
2189
- () => mt(n.value.isTransposed === !0, !0, y.value)
2190
- ), c = Ct("bar"), v = S(() => n.value.stackBarOverlap === !0), $ = S(() => v.value === !1), B = S(() => ({
2191
- ...d.value,
2192
- stacked: $.value
2193
- })), D = S(() => ({
2194
- ..._.value,
2195
- stacked: $.value
2196
- }));
2197
- function z({
2198
- datasetIndex: O,
2199
- colorIndex: G,
2200
- breakdownIndex: T
2201
- }) {
2202
- var W;
2203
- const w = n.value.chartColorBinding === _e.metric ? G : n.value.chartColorBinding === _e.breakdown ? T : O, N = (W = n.value.chartColorLayers) == null ? void 0 : W[w], A = Number(N);
2204
- return Number.isInteger(A) && A > 0 ? A : w + 1;
2205
- }
2206
- const P = S(() => {
2207
- if (f.value.length > 0) {
2208
- let O = 0, G = 0;
2209
- const T = f.value.map((w, N) => {
2210
- const A = n.value.chartColorBinding === _e.metric && (n.value.metricCount ?? 0) > 0 ? w.isCompare ? G++ % Number(n.value.metricCount) : O++ % Number(n.value.metricCount) : Ae({
2211
- datasetIndex: N,
2212
- isCompare: w.isCompare,
2213
- metricCount: n.value.metricCount,
2214
- mode: n.value.chartColorBinding
2215
- }), W = Ae({
2216
- datasetIndex: N,
2217
- isCompare: w.isCompare,
2218
- metricCount: n.value.metricCount,
2219
- mode: _e.metric
2220
- }), U = At({
2221
- datasetName: w.name,
2222
- breakdownValues: n.value.chartBreakdownDimensionValues,
2223
- fallbackIndex: N
2224
- }), ee = z({
2225
- datasetIndex: N,
2226
- colorIndex: A,
2227
- breakdownIndex: U
2228
- });
2229
- let te = w.values;
2230
- return {
2231
- dataset: {
2232
- label: w.name,
2233
- data: te,
2234
- dash: !!w.isCompare,
2235
- grouped: v.value ? !1 : void 0,
2236
- order: v.value ? ee : void 0,
2237
- backgroundColor: n.value.chartColorBinding === _e.breakdown ? bt({
2238
- breakdownIndex: U,
2239
- metricIndex: W,
2240
- metricCount: n.value.metricCount,
2241
- isCompare: w.isCompare,
2242
- breakdownColors: n.value.chartBreakdownColors,
2243
- useSecondaryMetricShades: n.value.chartUseSecondaryMetricShades,
2244
- customColors: n.value.chartColors
2245
- }) : dt({
2246
- index: A,
2247
- isCompare: w.isCompare,
2248
- customColors: n.value.chartColors
2249
- })
2250
- }
2251
- };
2252
- });
2253
- return v.value ? T.map((w) => w.dataset) : T.map((w) => w.dataset);
2254
- } else
2255
- return [];
2256
- }), I = ct();
2257
- function V() {
2258
- return I.extractChartSize(o.value, t.tileIndex) || { width: 0, height: 0 };
2259
- }
2260
- return Ne(() => {
2261
- De(() => {
2262
- V();
2263
- });
2264
- }), pe([P], () => {
2265
- De(() => V());
2266
- }), (O, G) => {
2267
- const T = Z("FmBarChart");
2268
- return X(), oe(ke, null, [
2269
- Ue(O.$slots, "menu"),
2270
- K(T, {
2271
- ref_key: "chartRef",
2272
- ref: o,
2273
- class: "bar-chart",
2274
- datasets: P.value,
2275
- "x-axis": { categories: p.value },
2276
- "x-cfg": B.value,
2277
- "y-cfg": D.value,
2278
- transpose: u(F),
2279
- stacked: $.value,
2280
- legend: {
2281
- display: u(R).display ?? !1,
2282
- position: u(R).position,
2283
- maxHeight: u(R).maxHeight,
2284
- maxWidth: u(R).maxWidth,
2285
- labels: u(R).labels
2286
- },
2287
- tooltip: g.value,
2288
- plugins: [u(c)],
2289
- datalabels: u(C),
2290
- "maintain-aspect-ratio": !1,
2291
- style: $e({
2292
- "--chart-width": u(b) !== void 0 ? u(b) + "px" : "100%",
2293
- "--chart-height": u(x) !== void 0 ? u(x) + "px" : "calc(100% - 36px)"
2294
- })
2295
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "stacked", "legend", "tooltip", "plugins", "datalabels", "style"]),
2296
- K(xt, {
2297
- "model-value": u(r),
2298
- "details-payload": u(l),
2299
- "onUpdate:modelValue": u(i),
2300
- onValueHover: u(k),
2301
- onValueLeave: u(m)
2302
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
2303
- ], 64);
2304
- };
2305
- }
2306
- }), Ll = /* @__PURE__ */ Be({
2307
- __name: "WidgetClusteredStackBarchart",
2308
- props: /* @__PURE__ */ ze({
2309
- tileIndex: {}
2310
- }, {
2311
- modelValue: { required: !0 },
2312
- modelModifiers: {}
2313
- }),
2314
- emits: ["update:modelValue"],
2315
- setup(e) {
2316
- const t = e, n = He(e, "modelValue"), o = L(null), a = S(() => n.value.maxTooltipItems), {
2317
- isTooltipDetailsSheetOpen: r,
2318
- tooltipDetailsPayload: l,
2319
- tooltipOptions: y,
2320
- handleTooltipDetailsSheetVisibility: i,
2321
- handleTooltipDetailsHover: k,
2322
- handleTooltipDetailsLeave: m
2323
- } = St(o, {
2324
- maxTooltipItems: a
2325
- }), p = S(() => {
2326
- var w;
2327
- return ((w = n.value.data) == null ? void 0 : w.xAxis) || [];
2328
- }), f = S(() => {
2329
- var w;
2330
- return ((w = n.value.data) == null ? void 0 : w.datasets) ?? [];
2331
- }), { datalabels: C, xCfg: d, yCfg: _, isTransposed: F, legend: R, chartWidth: b, chartHeight: x } = ft(
2332
- n.value
2333
- ), g = S(
2334
- () => mt(n.value.isTransposed === !0, !0, y.value)
2335
- ), c = Ct("bar"), v = S(() => n.value.stackBarOverlap === !0), $ = S(() => v.value === !1), B = S(() => ({
2336
- ...d.value,
2337
- stacked: $.value
2338
- })), D = S(() => ({
2339
- ..._.value,
2340
- stacked: $.value
2341
- }));
2342
- function z(w) {
2343
- const N = " - ", A = w.lastIndexOf(N);
2344
- return A < 0 ? {
2345
- clusterKey: w,
2346
- metricLabel: w
2347
- } : {
2348
- clusterKey: w.slice(0, A),
2349
- metricLabel: w.slice(A + N.length)
2350
- };
2351
- }
2352
- function P(w, N) {
2353
- if (typeof w == "string") {
2354
- const A = w.trim();
2355
- if (A.length > 0)
2356
- return A;
2357
- }
2358
- return `Series ${N + 1}`;
2359
- }
2360
- function I(w) {
2361
- return Array.isArray(w) ? w.map((N) => {
2362
- const A = Number(N);
2363
- return Number.isFinite(A) ? A : Number.NaN;
2364
- }) : [];
2365
- }
2366
- function V({
2367
- datasetIndex: w,
2368
- colorIndex: N
2369
- }) {
2370
- var ee;
2371
- const A = n.value.chartColorBinding === _e.metric ? N : w, W = (ee = n.value.chartColorLayers) == null ? void 0 : ee[A], U = Number(W);
2372
- return Number.isInteger(U) && U > 0 ? U : A + 1;
2373
- }
2374
- const O = S(() => {
2375
- if (f.value.length === 0)
2376
- return [];
2377
- const w = f.value.map((te, ve) => ({
2378
- source: te,
2379
- index: ve,
2380
- name: P(te == null ? void 0 : te.name, ve),
2381
- values: I(te == null ? void 0 : te.values)
2382
- })), N = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Map();
2383
- for (const te of w) {
2384
- const { clusterKey: ve, metricLabel: ye } = z(te.name);
2385
- A.has(ve) || A.set(ve, A.size), N.has(ye) || N.set(ye, N.size);
2386
- }
2387
- const W = Math.max(N.size, 1), U = n.value.chartColorBinding === _e.breakdown, ee = n.value.chartUseSecondaryMetricShades !== !1;
2388
- return w.map((te) => {
2389
- const ve = Ae({
2390
- datasetIndex: te.index,
2391
- isCompare: te.source.isCompare,
2392
- metricCount: n.value.metricCount,
2393
- mode: n.value.chartColorBinding
2394
- }), { clusterKey: ye, metricLabel: Ie } = z(te.name), s = A.get(ye) ?? 0, H = N.get(Ie) ?? 0, q = U ? bt({
2395
- breakdownIndex: s,
2396
- metricIndex: H,
2397
- metricCount: W,
2398
- isCompare: te.source.isCompare,
2399
- breakdownColors: n.value.chartBreakdownColors,
2400
- useSecondaryMetricShades: ee,
2401
- colorMode: "clustered"
2402
- }) : dt({
2403
- index: ve,
2404
- isCompare: te.source.isCompare,
2405
- customColors: n.value.chartColors
2406
- }), E = V({
2407
- datasetIndex: te.index,
2408
- colorIndex: ve
2409
- });
2410
- return {
2411
- label: Ie,
2412
- tooltipLabel: `${ye} - ${Ie}`,
2413
- data: te.values,
2414
- dash: !!te.source.isCompare,
2415
- grouped: !0,
2416
- order: v.value ? E : void 0,
2417
- stack: te.source.isCompare ? `${ye}__compare` : `${ye}__main`,
2418
- backgroundColor: q
2419
- };
2420
- });
2421
- }), G = ct();
2422
- function T() {
2423
- return G.extractChartSize(o.value, t.tileIndex) || { width: 0, height: 0 };
2424
- }
2425
- return Ne(() => {
2426
- De(() => {
2427
- T();
2428
- });
2429
- }), pe([O], () => {
2430
- De(() => T());
2431
- }), (w, N) => {
2432
- const A = Z("FmBarChart");
2433
- return X(), oe(ke, null, [
2434
- Ue(w.$slots, "menu"),
2435
- K(A, {
2436
- ref_key: "chartRef",
2437
- ref: o,
2438
- class: "bar-chart",
2439
- datasets: O.value,
2440
- "x-axis": { categories: p.value },
2441
- "x-cfg": B.value,
2442
- "y-cfg": D.value,
2443
- transpose: u(F),
2444
- stacked: $.value,
2445
- legend: {
2446
- display: u(R).display ?? !1,
2447
- position: u(R).position,
2448
- maxHeight: u(R).maxHeight,
2449
- maxWidth: u(R).maxWidth,
2450
- labels: u(R).labels
2451
- },
2452
- tooltip: g.value,
2453
- plugins: [u(c)],
2454
- datalabels: u(C),
2455
- "maintain-aspect-ratio": !1,
2456
- style: $e({
2457
- "--chart-width": u(b) !== void 0 ? u(b) + "px" : "100%",
2458
- "--chart-height": u(x) !== void 0 ? u(x) + "px" : "calc(100% - 36px)"
2459
- })
2460
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "stacked", "legend", "tooltip", "plugins", "datalabels", "style"]),
2461
- K(xt, {
2462
- "model-value": u(r),
2463
- "details-payload": u(l),
2464
- "onUpdate:modelValue": u(i),
2465
- onValueHover: u(k),
2466
- onValueLeave: u(m)
2467
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
2468
- ], 64);
2469
- };
2470
- }
2471
- });
2472
- function Dl(e) {
2473
- const t = Reflect.get(e, "lineStyle"), n = Reflect.get(e, "dash") === !0;
2474
- return oo(t, n);
2475
- }
2476
- function na(e = "report-line-style-plugin") {
2477
- return {
2478
- id: e,
2479
- beforeDatasetsUpdate(t) {
2480
- var o;
2481
- (((o = t == null ? void 0 : t.data) == null ? void 0 : o.datasets) ?? []).forEach((a) => {
2482
- const r = a;
2483
- Reflect.set(r, "borderDash", Dl(r));
2484
- });
2485
- }
2486
- };
2487
- }
2488
- const Fl = /* @__PURE__ */ Be({
2489
- __name: "WidgetStackLineChart",
2490
- props: /* @__PURE__ */ ze({
2491
- tileIndex: {}
2492
- }, {
2493
- modelValue: { required: !0 },
2494
- modelModifiers: {}
2495
- }),
2496
- emits: ["update:modelValue"],
2497
- setup(e) {
2498
- const t = e, n = He(e, "modelValue"), o = L(null), a = S(() => n.value.maxTooltipItems), {
2499
- isTooltipDetailsSheetOpen: r,
2500
- tooltipDetailsPayload: l,
2501
- tooltipOptions: y,
2502
- handleTooltipDetailsSheetVisibility: i,
2503
- handleTooltipDetailsHover: k,
2504
- handleTooltipDetailsLeave: m
2505
- } = St(o, {
2506
- maxTooltipItems: a
2507
- }), p = S(() => {
2508
- var I;
2509
- return ((I = n.value.data) == null ? void 0 : I.xAxis) ?? [];
2510
- }), f = S(
2511
- () => p.value.length === 1 && d.value.length > 0 && d.value.every((I) => I.values.length === 1)
2512
- ), C = S(() => f.value ? ["", p.value[0], ""] : p.value), d = S(() => {
2513
- var I;
2514
- return ((I = n.value.data) == null ? void 0 : I.datasets) ?? [];
2515
- }), { datalabels: _, xCfg: F, yCfg: R, isTransposed: b, legend: x, chartWidth: g, chartHeight: c } = ft(
2516
- n.value
2517
- ), v = S(
2518
- () => mt(n.value.isTransposed === !0, !0, y.value)
2519
- ), $ = Ct("line"), B = na("report-line-style-plugin-stack-line"), D = S(() => d.value.length > 0 ? [
2520
- ...d.value.map((I, V) => {
2521
- var ee;
2522
- let O = I.values;
2523
- f.value && (O = [NaN, O[0], NaN]);
2524
- const G = Ae({
2525
- datasetIndex: V,
2526
- isCompare: I.isCompare,
2527
- metricCount: n.value.metricCount,
2528
- mode: n.value.chartColorBinding
2529
- }), T = Ae({
2530
- datasetIndex: V,
2531
- isCompare: I.isCompare,
2532
- metricCount: n.value.metricCount,
2533
- mode: _e.metric
2534
- }), w = Ae({
2535
- datasetIndex: V,
2536
- isCompare: I.isCompare,
2537
- metricCount: n.value.metricCount,
2538
- mode: n.value.lineStyleBinding
2539
- }), N = (ee = n.value.lineStyles) == null ? void 0 : ee[w], A = n.value.chartColorBinding === _e.breakdown, W = At({
2540
- datasetName: I.name,
2541
- breakdownValues: n.value.chartBreakdownDimensionValues,
2542
- fallbackIndex: V
2543
- }), U = A ? bt({
2544
- breakdownIndex: W,
2545
- metricIndex: T,
2546
- metricCount: n.value.metricCount,
2547
- isCompare: I.isCompare,
2548
- breakdownColors: n.value.chartBreakdownColors,
2549
- useSecondaryMetricShades: n.value.chartUseSecondaryMetricShades,
2550
- customColors: n.value.chartColors
2551
- }) : dt({
2552
- index: G,
2553
- isCompare: I.isCompare,
2554
- customColors: n.value.chartColors
2555
- });
2556
- return {
2557
- label: I.name,
2558
- data: O,
2559
- dash: I.isCompare,
2560
- lineStyle: N,
2561
- fill: !0,
2562
- color: U,
2563
- pointRadius: f.value ? 4 : void 0,
2564
- pointHoverRadius: f.value ? 6 : void 0,
2565
- pointBackgroundColor: f.value ? U : void 0,
2566
- pointBorderColor: f.value ? U : void 0,
2567
- pointBorderWidth: f.value ? 2 : void 0
2568
- };
2569
- })
2570
- ] : []), z = ct();
2571
- function P() {
2572
- return z.extractChartSize(o.value, t.tileIndex) || { width: 0, height: 0 };
2573
- }
2574
- return Ne(() => {
2575
- De(() => {
2576
- P();
2577
- });
2578
- }), pe([D], () => {
2579
- De(() => P());
2580
- }), (I, V) => {
2581
- const O = Z("FmLineChart");
2582
- return X(), oe(ke, null, [
2583
- Ue(I.$slots, "menu"),
2584
- K(O, {
2585
- ref_key: "chartRef",
2586
- ref: o,
2587
- class: "line-chart",
2588
- datasets: D.value,
2589
- "x-axis": { categories: C.value },
2590
- "x-cfg": u(F),
2591
- "y-cfg": u(R),
2592
- transpose: u(b),
2593
- legend: {
2594
- display: u(x).display ?? !1,
2595
- position: u(x).position,
2596
- maxHeight: u(x).maxHeight,
2597
- maxWidth: u(x).maxWidth,
2598
- labels: u(x).labels
2599
- },
2600
- tooltip: v.value,
2601
- plugins: [u($), u(B)],
2602
- stacked: !0,
2603
- datalabels: u(_),
2604
- "maintain-aspect-ratio": !1,
2605
- style: $e({
2606
- "--chart-width": u(g) !== void 0 ? u(g) + "px" : "100%",
2607
- "--chart-height": u(c) !== void 0 ? u(c) + "px" : "calc(100% - 36px)"
2608
- })
2609
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "plugins", "datalabels", "style"]),
2610
- K(xt, {
2611
- "model-value": u(r),
2612
- "details-payload": u(l),
2613
- "onUpdate:modelValue": u(i),
2614
- onValueHover: u(k),
2615
- onValueLeave: u(m)
2616
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
2617
- ], 64);
2618
- };
2619
- }
2620
- }), ut = [
2621
- "col-span-1",
2622
- "col-span-2",
2623
- "col-span-3",
2624
- "col-span-4",
2625
- "col-span-5",
2626
- "col-span-6",
2627
- "col-span-7",
2628
- "col-span-8",
2629
- "col-span-9",
2630
- "col-span-10",
2631
- "col-span-11",
2632
- "col-span-12"
2633
- ];
2634
- function Il(e) {
2635
- return e < 12 ? ut[e - 1] : ut[11];
2636
- }
2637
- function Vl(e) {
2638
- return e < 12 ? ut[Math.min(11, e * 2 - 1)] : ut[11];
2639
- }
2640
- function $l(e) {
2641
- return e < 12 ? ut[Math.min(11, e * 3 - 1)] : ut[11];
2642
- }
2643
- const Bl = /* @__PURE__ */ Be({
2644
- __name: "WidgetLinechart",
2645
- props: /* @__PURE__ */ ze({
2646
- tileIndex: {}
2647
- }, {
2648
- modelValue: { required: !0 },
2649
- modelModifiers: {}
2650
- }),
2651
- emits: ["update:modelValue"],
2652
- setup(e) {
2653
- const t = e, n = He(e, "modelValue"), o = L(null), a = S(() => n.value.maxTooltipItems), {
2654
- isTooltipDetailsSheetOpen: r,
2655
- tooltipDetailsPayload: l,
2656
- tooltipOptions: y,
2657
- handleTooltipDetailsSheetVisibility: i,
2658
- handleTooltipDetailsHover: k,
2659
- handleTooltipDetailsLeave: m
2660
- } = St(o, {
2661
- maxTooltipItems: a
2662
- }), p = S(() => {
2663
- var V;
2664
- return ((V = n.value.data) == null ? void 0 : V.datasets) ?? [];
2665
- }), f = S(() => {
2666
- var V;
2667
- return ((V = n.value.data) == null ? void 0 : V.xAxis) ?? [];
2668
- }), C = S(() => f.value.length === 1 && p.value.length > 1 && p.value.every((V) => V.values.length === 1 && V.isCompare !== !0)), d = S(
2669
- () => f.value.length === 1 && p.value.length > 0 && p.value.every((V) => V.values.length === 1)
2670
- ), _ = S(() => C.value ? p.value.map((V) => V.name) : d.value ? ["", f.value[0], ""] : f.value), { datalabels: F, xCfg: R, yCfg: b, isTransposed: x, legend: g, chartWidth: c, chartHeight: v } = ft(
2671
- n.value
2672
- ), $ = S(
2673
- () => mt(n.value.isTransposed === !0, !0, y.value)
2674
- ), B = Ct("line"), D = na("report-line-style-plugin-line"), z = S(() => p.value.length > 0 ? [
2675
- ...p.value.map((V, O) => {
2676
- var ye;
2677
- const G = Ae({
2678
- datasetIndex: O,
2679
- isCompare: V.isCompare,
2680
- metricCount: n.value.metricCount,
2681
- mode: n.value.chartColorBinding
2682
- }), T = Ae({
2683
- datasetIndex: O,
2684
- isCompare: V.isCompare,
2685
- metricCount: n.value.metricCount,
2686
- mode: _e.metric
2687
- }), w = dt({
2688
- index: G,
2689
- isCompare: V.isCompare,
2690
- customColors: n.value.chartColors
2691
- }), N = n.value.chartColorBinding === _e.breakdown, A = At({
2692
- datasetName: V.name,
2693
- breakdownValues: n.value.chartBreakdownDimensionValues,
2694
- fallbackIndex: O
2695
- }), W = N ? bt({
2696
- breakdownIndex: A,
2697
- metricIndex: T,
2698
- metricCount: n.value.metricCount,
2699
- isCompare: V.isCompare,
2700
- breakdownColors: n.value.chartBreakdownColors,
2701
- useSecondaryMetricShades: n.value.chartUseSecondaryMetricShades,
2702
- customColors: n.value.chartColors
2703
- }) : w;
2704
- let U = V.values;
2705
- C.value ? U = p.value.map(
2706
- (Ie, s) => s === O ? V.values[0] : Number.NaN
2707
- ) : d.value && (U = [NaN, U[0], NaN]);
2708
- const ee = d.value || C.value, te = Ae({
2709
- datasetIndex: O,
2710
- isCompare: V.isCompare,
2711
- metricCount: n.value.metricCount,
2712
- mode: n.value.lineStyleBinding
2713
- }), ve = (ye = n.value.lineStyles) == null ? void 0 : ye[te];
2714
- return {
2715
- label: V.name,
2716
- data: U,
2717
- dash: !!V.isCompare,
2718
- lineStyle: ve,
2719
- fill: !1,
2720
- color: W,
2721
- pointRadius: ee ? 4 : void 0,
2722
- pointHoverRadius: ee ? 6 : void 0,
2723
- pointBackgroundColor: ee ? W : void 0,
2724
- pointBorderColor: ee ? W : void 0,
2725
- pointBorderWidth: ee ? 2 : void 0
2726
- };
2727
- })
2728
- ] : []), P = ct();
2729
- function I() {
2730
- return P.extractChartSize(o.value, t.tileIndex) || { width: 0, height: 0 };
2731
- }
2732
- return Ne(() => {
2733
- De(() => {
2734
- I();
2735
- });
2736
- }), pe([z], () => {
2737
- De(() => I());
2738
- }), (V, O) => {
2739
- const G = Z("FmLineChart");
2740
- return X(), oe(ke, null, [
2741
- Ue(V.$slots, "menu"),
2742
- K(G, {
2743
- ref_key: "chartRef",
2744
- ref: o,
2745
- class: "line-chart",
2746
- datasets: z.value,
2747
- "x-axis": { categories: _.value },
2748
- "x-cfg": u(R),
2749
- "y-cfg": u(b),
2750
- transpose: u(x),
2751
- legend: {
2752
- display: u(g).display ?? !1,
2753
- position: u(g).position,
2754
- maxHeight: u(g).maxHeight,
2755
- maxWidth: u(g).maxWidth,
2756
- labels: u(g).labels
2757
- },
2758
- tooltip: $.value,
2759
- datalabels: u(F),
2760
- plugins: [u(B), u(D)],
2761
- "maintain-aspect-ratio": !1,
2762
- style: $e({
2763
- "--chart-width": u(c) !== void 0 ? u(c) + "px" : "100%",
2764
- "--chart-height": u(v) !== void 0 ? u(v) + "px" : "calc(100% - 36px)"
2765
- })
2766
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "legend", "tooltip", "datalabels", "plugins", "style"]),
2767
- K(xt, {
2768
- "model-value": u(r),
2769
- "details-payload": u(l),
2770
- "onUpdate:modelValue": u(i),
2771
- onValueHover: u(k),
2772
- onValueLeave: u(m)
2773
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
2774
- ], 64);
2775
- };
2776
- }
2777
- }), Rl = { class: "flex flex-col gap-16" }, Pl = { class: "flex flex-row" }, Al = /* @__PURE__ */ Be({
2778
- __name: "PdfOrientationDialog",
2779
- props: /* @__PURE__ */ ze({
2780
- reportType: {},
2781
- index: {}
2782
- }, {
2783
- modelValue: { type: Boolean, required: !0 },
2784
- modelModifiers: {}
2785
- }),
2786
- emits: ["update:modelValue"],
2787
- setup(e) {
2788
- const { t } = et(), { FmForm: n } = Qa, o = e, a = L(), r = He(e, "modelValue"), l = L(!0), y = L(!1), i = on(), { selectedLocationIds: k, dateRange: m, timeRange: p } = Ee(gt()), f = L(Ot.PORTRAIT);
2789
- function C() {
2790
- var _;
2791
- (_ = a.value) == null || _.validateInputs();
2792
- }
2793
- async function d() {
2794
- y.value = !0;
2795
- try {
2796
- o.index != null && await Wn({
2797
- reportType: o.reportType,
2798
- index: o.index,
2799
- orientationTypes: [f.value],
2800
- isCombinedLocationLayout: l.value,
2801
- timeRange: p.value,
2802
- dateRange: m.value,
2803
- locationIds: k.value
2804
- });
2805
- } catch (_) {
2806
- i.open({ message: _.message, type: "error" });
2807
- } finally {
2808
- y.value = !1;
2809
- }
2810
- }
2811
- return (_, F) => {
2812
- const R = Z("FmRadio"), b = Z("FmRadioGroup"), x = Z("FmButton"), g = Z("FmDialog");
2813
- return X(), he(g, {
2814
- modelValue: r.value,
2815
- "onUpdate:modelValue": F[2] || (F[2] = (c) => r.value = c),
2816
- overlay: !0,
2817
- "z-index": 10
2818
- }, {
2819
- "dialog-header": ce(() => F[3] || (F[3] = [
2820
- qt("Select Orientation")
2821
- ])),
2822
- default: ce(() => [
2823
- K(u(n), {
2824
- ref_key: "form",
2825
- ref: a,
2826
- onValidationSuccess: d
2827
- }, {
2828
- default: ce(() => [
2829
- j("div", Rl, [
2830
- K(b, {
2831
- modelValue: f.value,
2832
- "onUpdate:modelValue": F[0] || (F[0] = (c) => f.value = c)
2833
- }, {
2834
- default: ce(() => [
2835
- K(R, {
2836
- value: u(Ot).PORTRAIT,
2837
- label: u(t)("report.common.portrait")
2838
- }, null, 8, ["value", "label"]),
2839
- K(R, {
2840
- value: u(Ot).LANDSCAPE,
2841
- label: u(t)("report.common.landscape")
2842
- }, null, 8, ["value", "label"])
2843
- ]),
2844
- _: 1
2845
- }, 8, ["modelValue"])
2846
- ]),
2847
- j("div", Pl, [
2848
- F[4] || (F[4] = j("div", { class: "grow" }, null, -1)),
2849
- K(x, {
2850
- label: u(t)("report.common.cancel"),
2851
- variant: "tertiary",
2852
- onClick: F[1] || (F[1] = (c) => r.value = !1)
2853
- }, null, 8, ["label"]),
2854
- j("div", null, [
2855
- K(x, {
2856
- label: u(t)("report.common.download"),
2857
- loading: y.value,
2858
- onClick: C
2859
- }, null, 8, ["label", "loading"])
2860
- ])
2861
- ])
2862
- ]),
2863
- _: 1
2864
- }, 512)
2865
- ]),
2866
- _: 1
2867
- }, 8, ["modelValue"]);
2868
- };
2869
- }
2870
- });
2871
- function Ml(e) {
2872
- const { containerRef: t, stickyOffset: n = L(0), enabled: o = L(!0) } = e;
2873
- let a = null, r = null, l = null, y = null, i = null, k = null;
2874
- function m() {
2875
- return t.value ? t.value.querySelector("table") : null;
2876
- }
2877
- function p() {
2878
- var v;
2879
- let c = (v = t.value) == null ? void 0 : v.parentElement;
2880
- for (; c; ) {
2881
- const $ = window.getComputedStyle(c);
2882
- if ($.overflowY === "auto" || $.overflowY === "scroll")
2883
- return c;
2884
- c = c.parentElement;
2885
- }
2886
- return null;
2887
- }
2888
- function f() {
2889
- var $;
2890
- const c = [];
2891
- t.value && t.value.querySelectorAll("div,section,main,article,aside").forEach((B) => {
2892
- if (B.scrollWidth > B.clientWidth) {
2893
- const D = window.getComputedStyle(B);
2894
- (D.overflowX === "auto" || D.overflowX === "scroll") && c.push(B);
2895
- }
2896
- });
2897
- let v = ($ = t.value) == null ? void 0 : $.parentElement;
2898
- for (; v; ) {
2899
- if (v.scrollWidth > v.clientWidth) {
2900
- const B = window.getComputedStyle(v);
2901
- (B.overflowX === "auto" || B.overflowX === "scroll") && c.push(v);
2902
- }
2903
- v = v.parentElement;
2904
- }
2905
- return c;
2906
- }
2907
- function C() {
2908
- if (x(), !o.value || !t.value || (r = m(), !r) || (l = r.querySelector("thead"), !l)) return;
2909
- a = document.createElement("div"), a.className = "sticky-header-clone", a.style.cssText = `
2910
- position: fixed;
2911
- top: ${n.value}px;
2912
- left: 0;
2913
- right: 0;
2914
- z-index: 9;
2915
- overflow: hidden;
2916
- pointer-events: none;
2917
- visibility: hidden;
2918
- `;
2919
- const c = document.createElement("table");
2920
- c.className = r.className, c.style.cssText = `
2921
- table-layout: fixed;
2922
- width: ${r.offsetWidth}px;
2923
- margin: 0;
2924
- border-collapse: collapse;
2925
- pointer-events: auto;
2926
- `;
2927
- const v = l.cloneNode(!0);
2928
- v.style.cssText = "pointer-events: auto;", d(l, v), c.appendChild(v), a.appendChild(c), document.body.appendChild(a), F(), R(), b(), _();
2929
- }
2930
- function d(c, v) {
2931
- const $ = c.querySelectorAll("th, td"), B = v.querySelectorAll("th, td");
2932
- $.forEach((D, z) => {
2933
- const P = B[z];
2934
- if (!P) return;
2935
- const I = D, V = window.getComputedStyle(I);
2936
- Object.assign(P.style, {
2937
- width: `${I.offsetWidth}px`,
2938
- minWidth: `${I.offsetWidth}px`,
2939
- maxWidth: `${I.offsetWidth}px`,
2940
- height: `${I.offsetHeight}px`,
2941
- padding: V.padding,
2942
- backgroundColor: V.backgroundColor,
2943
- borderBottom: V.borderBottom,
2944
- fontSize: V.fontSize,
2945
- fontWeight: V.fontWeight,
2946
- textAlign: V.textAlign,
2947
- verticalAlign: V.verticalAlign,
2948
- boxSizing: "border-box",
2949
- cursor: V.cursor || "pointer",
2950
- pointerEvents: "auto"
2951
- }), P.onclick = (O) => {
2952
- O.preventDefault(), O.stopPropagation();
2953
- const G = I.querySelector(
2954
- "button, a, [role='button']"
2955
- );
2956
- G ? G.click() : I.click();
2957
- };
2958
- });
2959
- }
2960
- function _() {
2961
- if (!a || !r || !l || !t.value) return;
2962
- const c = t.value.getBoundingClientRect(), v = r.getBoundingClientRect(), $ = l.getBoundingClientRect(), B = p(), D = B == null ? void 0 : B.getBoundingClientRect(), z = n.value > 0 ? n.value : (D == null ? void 0 : D.top) ?? 0;
2963
- if (!(v.top < z && v.bottom > z + $.height)) {
2964
- a.style.visibility = "hidden";
2965
- return;
2966
- }
2967
- a.style.visibility = "visible", a.style.top = `${z}px`;
2968
- const I = D ?? c, V = Math.max(c.left, I.left), G = Math.min(c.right, I.right) - V;
2969
- a.style.left = `${V}px`, a.style.width = `${G}px`;
2970
- const T = a.querySelector("table");
2971
- T && (T.style.width = `${r.offsetWidth}px`, T.style.marginLeft = `${$.left - V}px`);
2972
- }
2973
- function F() {
2974
- var $;
2975
- i = () => requestAnimationFrame(_), window.addEventListener("scroll", i, { passive: !0 });
2976
- const c = p();
2977
- c && c.addEventListener("scroll", i, { passive: !0 }), f().forEach((B) => {
2978
- i && B.addEventListener("scroll", i, { passive: !0 });
2979
- });
2980
- let v = ($ = t.value) == null ? void 0 : $.parentElement;
2981
- for (; v; )
2982
- v !== c && (v.scrollHeight > v.clientHeight || v.scrollWidth > v.clientWidth) && v.addEventListener("scroll", i, { passive: !0 }), v = v.parentElement;
2983
- }
2984
- function R() {
2985
- y = new ResizeObserver(() => {
2986
- if (l && a) {
2987
- const c = a.querySelector("thead");
2988
- c && d(l, c);
2989
- const v = a.querySelector("table");
2990
- v && r && (v.style.width = `${r.offsetWidth}px`);
2991
- }
2992
- _();
2993
- }), t.value && y.observe(t.value), r && y.observe(r);
2994
- }
2995
- function b() {
2996
- if (!l) return;
2997
- const c = Xt(() => C(), 100), v = () => {
2998
- if (l && a) {
2999
- const $ = a.querySelector("thead");
3000
- $ && d(l, $), _();
3001
- }
3002
- };
3003
- k = new MutationObserver(($) => {
3004
- $.some((D) => D.type === "childList" ? D.addedNodes.length > 0 || D.removedNodes.length > 0 : !1) ? c() : v();
3005
- }), k.observe(l, {
3006
- childList: !0,
3007
- subtree: !0,
3008
- attributes: !0,
3009
- characterData: !0
3010
- });
3011
- }
3012
- function x() {
3013
- var c;
3014
- if (a && (a.remove(), a = null), i) {
3015
- window.removeEventListener("scroll", i);
3016
- const v = p();
3017
- v && v.removeEventListener("scroll", i), f().forEach((B) => {
3018
- i && B.removeEventListener("scroll", i);
3019
- });
3020
- let $ = (c = t.value) == null ? void 0 : c.parentElement;
3021
- for (; $; )
3022
- $.removeEventListener("scroll", i), $ = $.parentElement;
3023
- i = null;
3024
- }
3025
- y && (y.disconnect(), y = null), k && (k.disconnect(), k = null), r = null, l = null;
3026
- }
3027
- function g() {
3028
- C();
3029
- }
3030
- return pe(o, (c) => {
3031
- c ? C() : x();
3032
- }), pe(n, () => {
3033
- a && (a.style.top = `${n.value}px`, _());
3034
- }), pe(t, () => {
3035
- t.value && o.value && setTimeout(C, 100);
3036
- }), Ne(() => {
3037
- o.value && setTimeout(C, 100);
3038
- }), Hn(() => {
3039
- x();
3040
- }), { refresh: g, cleanup: x };
3041
- }
3042
- const zl = {
3043
- key: 1,
3044
- class: "grow"
3045
- }, Nl = {
3046
- key: 2,
3047
- class: "flex"
3048
- }, vr = /* @__PURE__ */ Be({
3049
- __name: "DynamicWidget",
3050
- props: /* @__PURE__ */ ze({
3051
- index: {
3052
- type: Number,
3053
- default: 0
3054
- },
3055
- hideExport: {
3056
- type: Boolean,
3057
- default: !1
3058
- },
3059
- customScreenWidth: {
3060
- type: Number,
3061
- required: !1,
3062
- default: void 0
3063
- },
3064
- stickyHeaderOffset: {
3065
- type: Number,
3066
- default: 0
3067
- },
3068
- isStyleEditing: {
3069
- type: Boolean,
3070
- default: !1
3071
- }
3072
- }, {
3073
- modelValue: { required: !0, default: () => {
3074
- } },
3075
- modelModifiers: {}
3076
- }),
3077
- emits: /* @__PURE__ */ ze(["update:breakdown-dimension-values"], ["update:modelValue"]),
3078
- setup(e, { emit: t }) {
3079
- const n = L(!0), o = He(e, "modelValue"), a = o.value.widget.config, { t: r, te: l, locale: y } = et(), i = e, k = t, m = L(null), p = S(() => i.stickyHeaderOffset), f = S(() => o.value.widget.type === Y.Table), C = S(() => {
3080
- var h;
3081
- return (h = m.value) == null ? void 0 : h.$el;
3082
- }), { refresh: d } = Ml({
3083
- containerRef: C,
3084
- stickyOffset: p,
3085
- enabled: f
3086
- }), _ = L(a.rollup), F = L(vt()), R = L(a.drillDimension), b = S(() => {
3087
- if (Ye.value.length > 0) {
3088
- const h = Ye.value.findIndex(
3089
- (ae) => ae.value === R.value
3090
- );
3091
- return h >= 0 ? h : 0;
3092
- } else
3093
- return -1;
3094
- }), x = S(() => b.value !== 0), g = S(
3095
- () => b.value != Ye.value.length - 1
3096
- ), c = L(a.showTitle ?? !0), v = L(a.titleFontSize ?? 14), $ = L(a.titleBold ?? !1), B = L(a.titleItalic ?? !1), D = L(a.titleUnderline ?? !1), z = L(a.chartWidth ?? void 0), P = L(a.chartHeight ?? void 0), I = L(
3097
- Array.isArray(a.chartColors) ? [...a.chartColors] : void 0
3098
- ), V = L(
3099
- Array.isArray(a.chartColorLayers) ? [...a.chartColorLayers] : void 0
3100
- ), O = L(
3101
- Array.isArray(a.chartBreakdownColors) ? [...a.chartBreakdownColors] : void 0
3102
- ), G = L(
3103
- Array.isArray(a.chartBreakdownDimensionValues) ? [...a.chartBreakdownDimensionValues] : void 0
3104
- ), T = L(a.chartUseSecondaryMetricShades ?? !0), w = L(a.chartColorBinding), N = L(
3105
- Array.isArray(a.lineStyles) ? [...a.lineStyles] : void 0
3106
- ), A = L(a.lineStyleBinding), W = L(a.showLabel ?? !1), U = L(a.labelAlign ?? Kt.center), ee = L(a.labelAnchor ?? jt.center), te = L(a.labelRotation ?? 0), ve = L(a.labelOffset ?? 0), ye = L(a.labelFontSize ?? 12), Ie = S(() => a.showSearchBar), s = L(a.showX ?? !0), H = L(a.xPosition ?? Jt.bottom), q = L(a.showXGrid ?? !1), E = L(a.showXTick ?? !0), ne = L(a.xTickFontSize ?? 12), de = L(a.showXTitle ?? !1), xe = L(a.xTitle ?? ""), be = L(a.xTitleFontSize ?? 12), se = L(a.showY ?? !0), J = L(a.yPosition ?? Zt.left), Q = L(a.showYGrid ?? !1), M = L(a.showYTick ?? !0), le = L(a.yTickFontSize ?? 12), re = L(a.showYTitle ?? !1), ge = L(a.yTitle ?? ""), me = L(a.yTitleFontSize ?? 12), ue = L(a.showLegend ?? void 0), Te = L(a.legendPosition ?? Qt.top), Fe = L(a.usePointStyle ?? !0), qe = L(a.legendMaxHeight), _t = L(a.legendMaxWidth), ie = L(a.maxTooltipItems), cn = L(a.stackBarOverlap ?? !1), dn = L(a.rowHeight ?? 0), mn = L(a.colWidths ?? []), zt = L(!1), Nt = L(""), { breakpoints: tt, getBreakpointsBoundary: pt } = Un(), fn = L(), Se = S(
3107
- () => i.customScreenWidth === void 0 ? window.innerWidth : i.customScreenWidth
3108
- ), oa = S(
3109
- () => (Se == null ? void 0 : Se.value) > pt("xs")[1] && (Se == null ? void 0 : Se.value) <= pt("sm")[1]
3110
- ), la = S(
3111
- () => (Se == null ? void 0 : Se.value) > pt("sm")[1] && (Se == null ? void 0 : Se.value) <= pt("md")[1]
3112
- ), ra = S(() => (Se == null ? void 0 : Se.value) > pt("md")[1]), sa = S(() => {
3113
- const h = o.value.size.width;
3114
- return ra.value || la.value ? Il(h) : oa.value ? Vl(h) : $l(h);
3115
- }), kt = S(
3116
- () => to.find((h) => h.type === o.value.widget.type)
3117
- ), nt = Xt(() => {
3118
- var h;
3119
- fn.value = ba((h = m.value) == null ? void 0 : h.$el.offsetWidth), F.value = vt();
3120
- }), ia = S(() => {
3121
- if (no(fe.value.type, at.value))
3122
- switch (o.value.widget.type) {
3123
- case Y.BarChart:
3124
- return sl;
3125
- case Y.StackBarChart:
3126
- return Tl;
3127
- case Y.ClusteredStackBarChart:
3128
- return Ll;
3129
- case Y.LineChart:
3130
- return Bl;
3131
- case Y.StackLineChart:
3132
- return Fl;
3133
- case Y.Circular:
3134
- return il;
3135
- case Y.Scorecard:
3136
- return hl;
3137
- case Y.Spacer:
3138
- return yl;
3139
- case Y.Table:
3140
- return kl;
3141
- default:
3142
- return Yt;
3143
- }
3144
- else
3145
- return Yt;
3146
- }), at = L(null), {
3147
- selectedLocationIds: Ht,
3148
- dateRange: pn,
3149
- compareDateRange: ua,
3150
- timeRange: hn,
3151
- globalFilters: ca,
3152
- isGlobalFiltersLoading: vn
3153
- } = Ee(gt()), { businessId: da } = Ee(an()), { businessLoadedId: ma, businessDataVersion: Wt } = Ee(gt());
3154
- S(() => ma.value === da.value && Ht.value.length > 0 && !vn.value);
3155
- const fa = L(!0), fe = S(() => {
3156
- const h = JSON.parse(JSON.stringify(o.value.widget));
3157
- return {
3158
- ...h,
3159
- config: {
3160
- ...h.config,
3161
- rollup: _.value,
3162
- drillDimension: R.value,
3163
- showGrandTotal: !1
3164
- }
3165
- };
3166
- }), pa = S(() => {
3167
- var Ce;
3168
- const h = ((Ce = fe.value.config.metrics) == null ? void 0 : Ce.length) ?? 0;
3169
- if (!fe.value.config.isBlend)
3170
- return h;
3171
- const ae = (fe.value.config.joinDatasources ?? []).reduce(
3172
- (Me, Xe) => {
3173
- var Re;
3174
- return Me + (((Re = Xe.metrics) == null ? void 0 : Re.length) ?? 0);
3175
- },
3176
- 0
3177
- );
3178
- return h + ae;
3179
- });
3180
- function ha() {
3181
- return {
3182
- data: at.value,
3183
- showTitle: c.value,
3184
- titleFontSize: v.value,
3185
- titleBold: $.value,
3186
- titleItalic: B.value,
3187
- titleUnderline: D.value,
3188
- chartHeight: P.value,
3189
- chartWidth: z.value,
3190
- chartColors: I.value,
3191
- chartColorLayers: V.value,
3192
- chartBreakdownColors: O.value,
3193
- chartBreakdownDimensionValues: G.value,
3194
- chartUseSecondaryMetricShades: T.value,
3195
- chartColorBinding: w.value,
3196
- metricCount: pa.value,
3197
- lineStyles: N.value,
3198
- lineStyleBinding: A.value,
3199
- showLabel: W.value,
3200
- labelAnchor: ee.value,
3201
- labelAlign: U.value,
3202
- labelRotation: te.value,
3203
- labelOffset: ve.value,
3204
- labelFontSize: ye.value,
3205
- showX: s.value,
3206
- xPosition: H.value,
3207
- showXGrid: q.value,
3208
- showXTick: E.value,
3209
- xTickFontSize: ne.value,
3210
- showXTitle: de.value,
3211
- xTitle: xe.value,
3212
- xTitleFontSize: be.value,
3213
- showY: se.value,
3214
- yPosition: J.value,
3215
- showYGrid: Q.value,
3216
- showYTick: M.value,
3217
- yTitle: ge.value,
3218
- showYTitle: re.value,
3219
- yTitleFontSize: me.value,
3220
- yTickFontSize: le.value,
3221
- isTransposed: fe.value.config.isTransposed,
3222
- showLegend: ue.value,
3223
- legendPosition: Te.value,
3224
- usePointStyle: Fe.value,
3225
- legendMaxHeight: qe.value,
3226
- legendMaxWidth: _t.value,
3227
- maxTooltipItems: ie.value,
3228
- stackBarOverlap: cn.value
3229
- };
3230
- }
3231
- function va() {
3232
- return {
3233
- data: at.value,
3234
- filterText: Nt.value,
3235
- rollupPosition: fe.value.config.rollupPosition,
3236
- rowHeight: dn.value,
3237
- colWidths: mn.value
3238
- };
3239
- }
3240
- const gn = S(() => {
3241
- switch (fe.value.type) {
3242
- case Y.Table:
3243
- return va();
3244
- case Y.BarChart:
3245
- case Y.LineChart:
3246
- case Y.StackBarChart:
3247
- case Y.ClusteredStackBarChart:
3248
- case Y.StackLineChart:
3249
- case Y.Circular:
3250
- return ha();
3251
- default:
3252
- return { data: at.value };
3253
- }
3254
- }), yn = S(() => {
3255
- const { config: h } = o.value.widget;
3256
- if (h.rollup != null) {
3257
- const ae = [...h.dimensions].filter((Ce) => !Ce.hide);
3258
- return ae.sort(
3259
- (Ce, Me) => (h.rowIds || []).indexOf(Et(Ce)) - (h.rowIds || []).indexOf(Et(Me))
3260
- ), [
3261
- { label: Ke(r, l, "None", "other"), value: "none" },
3262
- { label: Ke(r, l, "Grand Total", "other"), value: 0 },
3263
- ...[...ae].slice(0, ae.length - 1).map((Ce, Me) => ({
3264
- label: Ke(r, l, Ce.label, "other"),
3265
- value: Me + 1
3266
- }))
3267
- ];
3268
- }
3269
- return [];
3270
- }), Ye = S(() => {
3271
- const { config: h } = fe.value;
3272
- return h.isDrillable ? h.dimensions.map((ae) => ({
3273
- label: Ke(r, l, ae.label, "other"),
3274
- value: Et(ae)
3275
- })) : [];
3276
- }), ga = S(() => {
3277
- const h = o.value.id;
3278
- return (ca.value || []).filter(
3279
- (ae) => Array.isArray(ae.tileIds) && ae.tileIds.includes(h)
3280
- );
3281
- });
3282
- function ya(h) {
3283
- const ae = h == null ? void 0 : h.datasets;
3284
- if (!Array.isArray(ae) || ae.length === 0)
3285
- return [];
3286
- const Ce = [], Me = /* @__PURE__ */ new Set();
3287
- for (const Xe of ae) {
3288
- const Re = typeof (Xe == null ? void 0 : Xe.name) == "string" ? Xe.name : "";
3289
- if (!Re)
3290
- continue;
3291
- const Lt = Re.lastIndexOf(" - "), ot = Lt >= 0 ? Re.slice(0, Lt) : Re;
3292
- !ot || Me.has(ot) || (Me.add(ot), Ce.push(ot));
3293
- }
3294
- return Ce;
3295
- }
3296
- pe(
3297
- () => o.value.widget.config,
3298
- (h) => {
3299
- _.value = h.rollup, c.value = h.showTitle ?? !0, v.value = h.titleFontSize ?? 14, $.value = h.titleBold ?? !1, B.value = h.titleItalic ?? !1, D.value = h.titleUnderline ?? !1, P.value = h.chartHeight ?? void 0, z.value = h.chartWidth ?? void 0, I.value = Array.isArray(h.chartColors) ? [...h.chartColors] : void 0, V.value = Array.isArray(h.chartColorLayers) ? [...h.chartColorLayers] : void 0, O.value = Array.isArray(h.chartBreakdownColors) ? [...h.chartBreakdownColors] : void 0, G.value = Array.isArray(h.chartBreakdownDimensionValues) ? [...h.chartBreakdownDimensionValues] : void 0, T.value = h.chartUseSecondaryMetricShades ?? !0, w.value = h.chartColorBinding, N.value = Array.isArray(h.lineStyles) ? [...h.lineStyles] : void 0, A.value = h.lineStyleBinding, W.value = h.showLabel ?? !1, U.value = h.labelAlign ?? Kt.center, ee.value = h.labelAnchor ?? jt.center, te.value = h.labelRotation ?? 0, ve.value = h.labelOffset ?? 0, ye.value = h.labelFontSize ?? 12, s.value = h.showX ?? !0, H.value = h.xPosition ?? Jt.bottom, q.value = h.showXGrid ?? !1, E.value = h.showXTick ?? !0, ne.value = h.xTickFontSize ?? 12, de.value = h.showXTitle ?? !1, xe.value = h.xTitle ?? "", be.value = h.xTitleFontSize ?? 12, se.value = h.showY ?? !0, J.value = h.yPosition ?? Zt.left, Q.value = h.showYGrid ?? !1, M.value = h.showYTick ?? !0, le.value = h.yTickFontSize ?? 12, re.value = h.showYTitle ?? !1, ge.value = h.yTitle ?? "", me.value = h.yTitleFontSize ?? 12, ue.value = h.showLegend ?? void 0, Te.value = h.legendPosition ?? Qt.top, Fe.value = h.usePointStyle ?? !0, qe.value = h.legendMaxHeight, _t.value = h.legendMaxWidth, ie.value = h.maxTooltipItems, cn.value = h.stackBarOverlap ?? !1, dn.value = h.rowHeight ?? 0, mn.value = h.colWidths ?? [], F.value = vt();
3300
- },
3301
- { deep: !0 }
3302
- ), pe([() => _.value], () => {
3303
- _.value !== null && (o.value.widget.config.rollup = _.value);
3304
- }), pe(
3305
- [
3306
- () => fe.value,
3307
- () => pn.value,
3308
- () => hn.value,
3309
- () => ua.value,
3310
- () => Ht.value,
3311
- () => ga.value,
3312
- () => Wt.value
3313
- ],
3314
- () => {
3315
- Cn();
3316
- },
3317
- { deep: !0 }
3318
- ), pe(
3319
- [() => o.value.size],
3320
- () => {
3321
- nt();
3322
- },
3323
- { deep: !0 }
3324
- ), Ne(() => {
3325
- nt(), tt.value.sm || tt.value.md || tt.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", nt)) : addEventListener("resize", nt), Cn();
3326
- }), Hn(() => {
3327
- tt.value.sm || tt.value.md || tt.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", nt)) : removeEventListener("resize", nt);
3328
- });
3329
- const bn = on();
3330
- let Tt;
3331
- async function Cn() {
3332
- if (!i.isStyleEditing) {
3333
- if (fe.value.config.schemaNames.length <= 0 && !(fe.value.config.dimensions.length <= 0 || fe.value.config.metrics.length <= 0)) {
3334
- bn.open({
3335
- message: "schema must not be empty and dimension or metrics must have at least 1 column",
3336
- type: "info"
3337
- }), n.value = !1;
3338
- return;
3339
- }
3340
- try {
3341
- n.value = !0, Tt && Tt.abort(), Tt = new AbortController();
3342
- const h = Tt.signal, ae = Wt.value, Ce = await Xt(On, 500)(fe.value, h, o.value.id);
3343
- Wt.value === ae && (at.value = Ce, fe.value.type === Y.ClusteredStackBarChart && k("update:breakdown-dimension-values", ya(Ce)), F.value = vt(), setTimeout(() => d(), 100)), n.value = !1;
3344
- } catch (h) {
3345
- h.code !== "ERR_CANCELED" && (at.value = null, bn.open({ message: `Invalid chart ${fe.value.type}`, type: "error" }), console.log(h), n.value = !1);
3346
- }
3347
- }
3348
- }
3349
- function ba(h) {
3350
- switch (o.value.widget.type) {
3351
- case "SPACER":
3352
- return;
3353
- case "SCORECARD":
3354
- return;
3355
- case "TABLE":
3356
- return `${o.value.size.height * 100 + (Ie.value ? 72 : 0) + 96.5}px`;
3357
- }
3358
- return `${Math.max(h / o.value.size.width, 90) * o.value.size.height}px`;
3359
- }
3360
- function Ca() {
3361
- const h = b.value - 1;
3362
- h >= 0 && (R.value = Ye.value[h].value);
3363
- }
3364
- function wa() {
3365
- const h = b.value + 1;
3366
- h >= 0 && h < Ye.value.length && (R.value = Ye.value[h].value);
3367
- }
3368
- const wn = L(rt.EXCEL), xn = L(), xa = Object.values(rt).map((h) => ({
3369
- label: za(h),
3370
- value: h,
3371
- onClick: async () => {
3372
- h === rt.EXCEL || h === rt.PDFFULLSIZE || h === rt.PDFRECEIPT ? await Wn({
3373
- reportType: h,
3374
- index: i.index,
3375
- isCombinedLocationLayout: fa.value,
3376
- timeRange: hn.value,
3377
- dateRange: pn.value,
3378
- locationIds: Ht.value
3379
- }) : h === rt.PDF && (wn.value = h, xn.value = i.index, zt.value = !0);
3380
- }
3381
- })), Sa = fe.value.type === Y.Spacer ? "flat" : "outlined", _a = fe.value.type === Y.Spacer ? "p-0" : "p-16";
3382
- return (h, ae) => {
3383
- const Ce = Z("FmTooltip"), Me = Z("FmSearch"), Xe = Z("FmCheckbox"), Re = Z("FmButton"), Lt = Z("FmSelect"), ot = Z("FmMenuItem"), ka = Z("FmMenu"), Ta = Z("FmForm"), La = Z("FmCircularProgress"), Da = Z("FmCard");
3384
- return X(), he(Da, {
3385
- ref_key: "tileCard",
3386
- ref: m,
3387
- class: Qe(`${sa.value} ${u(_a)}`),
3388
- variant: u(Sa)
3389
- }, {
3390
- default: ce(() => [
3391
- K(Al, {
3392
- modelValue: zt.value,
3393
- "onUpdate:modelValue": ae[0] || (ae[0] = (lt) => zt.value = lt),
3394
- "report-type": wn.value,
3395
- index: xn.value
3396
- }, null, 8, ["modelValue", "report-type", "index"]),
3397
- !n.value && !u(vn) ? (X(), oe("div", {
3398
- key: 0,
3399
- style: $e({ height: fn.value })
3400
- }, [
3401
- (X(), he(Ba(ia.value), {
3402
- key: F.value,
3403
- modelValue: gn.value,
3404
- "onUpdate:modelValue": ae[4] || (ae[4] = (lt) => gn.value = lt),
3405
- "tile-index": i.index
3406
- }, {
3407
- menu: ce(() => [
3408
- K(Ta, { class: "flex items-center gap-2" }, {
3409
- default: ce(() => {
3410
- var lt, Sn, _n, kn;
3411
- return [
3412
- K(Ce, {
3413
- variant: "plain",
3414
- placement: "right",
3415
- content: fe.value.description,
3416
- "hide-arrow": !0,
3417
- disabled: !fe.value.description,
3418
- "z-index": 99
3419
- }, {
3420
- default: ce(() => [
3421
- c.value !== !1 ? (X(), oe("p", {
3422
- key: 0,
3423
- style: $e({
3424
- fontSize: v.value + "px",
3425
- fontWeight: $.value ? "bold" : "normal",
3426
- fontStyle: B.value ? "italic" : "normal",
3427
- textDecoration: D.value ? "underline" : "none"
3428
- }),
3429
- class: Qe(["text-fm-color-typo-secondary line-clamp-1", [
3430
- v.value <= 18 ? "fm-typo-en-body-md-400" : "",
3431
- fe.value.description ? "border-b-2 border-dashed border-gray-300" : ""
3432
- ]])
3433
- }, Le(u(Ke)(u(r), u(l), fe.value.title, "other")), 7)) : Ve("", !0)
3434
- ]),
3435
- _: 1
3436
- }, 8, ["content", "disabled"]),
3437
- (lt = kt.value) != null && lt.showSearchBar ? (X(), he(Me, {
3438
- key: 0,
3439
- modelValue: Nt.value,
3440
- "onUpdate:modelValue": ae[1] || (ae[1] = (We) => Nt.value = We),
3441
- class: "grow"
3442
- }, null, 8, ["modelValue"])) : (X(), oe("div", zl)),
3443
- Ra(K(Xe, {
3444
- modelValue: W.value,
3445
- "onUpdate:modelValue": ae[2] || (ae[2] = (We) => W.value = We),
3446
- label: "Label",
3447
- value: !1
3448
- }, null, 8, ["modelValue"]), [
3449
- [Pa, (Sn = kt.value) == null ? void 0 : Sn.showLabel]
3450
- ]),
3451
- (_n = kt.value) != null && _n.showDrillDimension && Ye.value.length > 0 ? (X(), oe("div", Nl, [
3452
- K(Re, {
3453
- icon: "arrow_upward",
3454
- variant: "tertiary",
3455
- disabled: !x.value,
3456
- onClick: Ca
3457
- }, null, 8, ["disabled"]),
3458
- K(Re, {
3459
- icon: "arrow_downward",
3460
- variant: "tertiary",
3461
- disabled: !g.value,
3462
- onClick: wa
3463
- }, null, 8, ["disabled"])
3464
- ])) : Ve("", !0),
3465
- (kn = kt.value) != null && kn.showRollup && yn.value.length > 0 ? (X(), he(Lt, {
3466
- key: `rollup-${u(y)}`,
3467
- modelValue: _.value,
3468
- "onUpdate:modelValue": ae[3] || (ae[3] = (We) => _.value = We),
3469
- class: "w-[150px]",
3470
- items: yn.value
3471
- }, null, 8, ["modelValue", "items"])) : Ve("", !0),
3472
- i.hideExport ? Ve("", !0) : (X(), he(ka, {
3473
- key: 4,
3474
- shift: !0
3475
- }, {
3476
- "menu-button": ce(() => [
3477
- K(Re, {
3478
- icon: "more_vert",
3479
- variant: "tertiary"
3480
- })
3481
- ]),
3482
- default: ce(() => [
3483
- (X(!0), oe(ke, null, it(u(xa), (We) => (X(), he(ot, {
3484
- key: We.value,
3485
- label: We.label,
3486
- onClick: We.onClick
3487
- }, null, 8, ["label", "onClick"]))), 128))
3488
- ]),
3489
- _: 1
3490
- }))
3491
- ];
3492
- }),
3493
- _: 1
3494
- })
3495
- ]),
3496
- _: 1
3497
- }, 8, ["modelValue", "tile-index"]))
3498
- ], 4)) : (X(), he(La, { key: 1 }))
3499
- ]),
3500
- _: 1
3501
- }, 8, ["class", "variant"]);
3502
- };
3503
- }
3504
- });
3505
- var Je = /* @__PURE__ */ ((e) => (e.Select = "Select", e.TextField = "TextField", e.Timestamp = "Timestamp", e))(Je || {});
3506
- function Hl(e) {
3507
- let t = !1, n = 1;
3508
- switch (e) {
3509
- case Pe.Equal:
3510
- case Pe.NotEqual:
3511
- case Pe.Like:
3512
- case Pe.NotLike:
3513
- t = !1, n = 1;
3514
- break;
3515
- case Pe.GreaterThan:
3516
- case Pe.GreaterThanOrEqual:
3517
- case Pe.LessThan:
3518
- case Pe.LessThanOrEqual:
3519
- t = !0, n = 1;
3520
- break;
3521
- case Pe.Between:
3522
- t = !0, n = 2;
3523
- break;
3524
- }
3525
- return {
3526
- fixed: t,
3527
- count: n
3528
- };
3529
- }
3530
- function gr({
3531
- operator: e,
3532
- dimensionOption: t,
3533
- dataType: n,
3534
- t: o
3535
- }) {
3536
- const { fixed: a, count: r } = Hl(e);
3537
- switch (n) {
3538
- case Oe.String:
3539
- return {
3540
- type: "TextField",
3541
- fixed: a,
3542
- count: r,
3543
- dataType: void 0,
3544
- default: ""
3545
- };
3546
- case Oe.Numeric:
3547
- return {
3548
- type: "TextField",
3549
- fixed: a,
3550
- count: r,
3551
- dataType: "number",
3552
- default: 0
3553
- };
3554
- case Oe.Bool:
3555
- return {
3556
- type: "Select",
3557
- fixed: a,
3558
- count: r,
3559
- options: [
3560
- { label: o("report.common.yes"), value: !0 },
3561
- { label: o("report.common.no"), value: !1 }
3562
- ],
3563
- default: !0
3564
- };
3565
- case Oe.Timestamp:
3566
- return aa({
3567
- dimensionOption: t,
3568
- fixed: a,
3569
- count: r,
3570
- t: o
3571
- });
3572
- }
3573
- return {
3574
- type: "TextField",
3575
- fixed: a,
3576
- count: r,
3577
- dataType: void 0,
3578
- default: ""
3579
- };
3580
- }
3581
- function yr(e) {
3582
- switch (e) {
3583
- case we.HourOfDay:
3584
- return 0;
3585
- case we.DayOfMonth:
3586
- return 1;
3587
- default:
3588
- return;
3589
- }
3590
- }
3591
- function br(e) {
3592
- switch (e) {
3593
- case we.HourOfDay:
3594
- return 23;
3595
- case we.DayOfMonth:
3596
- return 31;
3597
- default:
3598
- return;
3599
- }
3600
- }
3601
- function aa({
3602
- dimensionOption: e,
3603
- fixed: t,
3604
- count: n,
3605
- t: o
3606
- }) {
3607
- switch (e) {
3608
- case we.HourOfDay:
3609
- return {
3610
- type: Je.Select,
3611
- fixed: t,
3612
- count: n,
3613
- options: Array.from({ length: 24 }, (a, r) => ({
3614
- label: r.toString().padStart(2, "0"),
3615
- value: r.toString()
3616
- })),
3617
- default: "0"
3618
- };
3619
- case we.DayOfWeek:
3620
- return {
3621
- type: Je.Select,
3622
- fixed: t,
3623
- count: n,
3624
- options: [
3625
- { label: o("report.days.sunday"), value: "1" },
3626
- { label: o("report.days.monday"), value: "2" },
3627
- { label: o("report.days.tuesday"), value: "3" },
3628
- { label: o("report.days.wednesday"), value: "4" },
3629
- { label: o("report.days.thursday"), value: "5" },
3630
- { label: o("report.days.friday"), value: "6" },
3631
- { label: o("report.days.saturday"), value: "7" }
3632
- ],
3633
- default: "1"
3634
- };
3635
- case we.DayOfMonth:
3636
- return {
3637
- type: Je.Select,
3638
- fixed: t,
3639
- count: n,
3640
- options: Array.from({ length: 31 }, (a, r) => ({
3641
- label: (r + 1).toString(),
3642
- value: (r + 1).toString()
3643
- })),
3644
- default: "1"
3645
- };
3646
- case we.MonthOfYear:
3647
- return {
3648
- type: Je.Select,
3649
- fixed: t,
3650
- count: n,
3651
- options: [
3652
- { label: o("report.months.january"), value: "1" },
3653
- { label: o("report.months.february"), value: "2" },
3654
- { label: o("report.months.march"), value: "3" },
3655
- { label: o("report.months.april"), value: "4" },
3656
- { label: o("report.months.may"), value: "5" },
3657
- { label: o("report.months.june"), value: "6" },
3658
- { label: o("report.months.july"), value: "7" },
3659
- { label: o("report.months.august"), value: "8" },
3660
- { label: o("report.months.september"), value: "9" },
3661
- { label: o("report.months.october"), value: "10" },
3662
- { label: o("report.months.november"), value: "11" },
3663
- { label: o("report.months.december"), value: "12" }
3664
- ],
3665
- default: "1"
3666
- };
3667
- default:
3668
- return {
3669
- type: Je.Timestamp,
3670
- fixed: t,
3671
- count: n,
3672
- default: (/* @__PURE__ */ new Date()).toISOString()
3673
- };
3674
- }
3675
- }
3676
- function zn({
3677
- dimensionOption: e,
3678
- t
3679
- }) {
3680
- const n = aa({
3681
- dimensionOption: e,
3682
- fixed: !1,
3683
- count: 1,
3684
- t
3685
- });
3686
- return n.type !== Je.Select ? [] : [{ label: t("report.input.unknown"), value: "" }, ...n.options];
3687
- }
3688
- const Wl = "mf-reportglobalFilter";
3689
- function Nn(e, t) {
3690
- var n;
3691
- return [
3692
- t,
3693
- e.schemaName,
3694
- e.name,
3695
- e.operator ?? "",
3696
- e.option ?? "",
3697
- e.dataFormula ?? "",
3698
- ((n = e.tileIds) == null ? void 0 : n.join(",")) ?? ""
3699
- ].join("|");
3700
- }
3701
- const Ol = En(Wl, () => {
3702
- const e = L({}), t = L(!1), n = L(null), o = () => ({
3703
- search: "",
3704
- selectedValues: [],
3705
- keepSelection: !1,
3706
- showAdvanced: !1,
3707
- visibleCount: 50
3708
- });
3709
- function a(f, C) {
3710
- const d = Nn(f, C);
3711
- return e.value[d] || (e.value[d] = o()), e.value[d];
3712
- }
3713
- const r = S(() => e.value), l = (f) => n.value === f;
3714
- function y(f, C, d, _) {
3715
- a(f, C)[d] = _;
3716
- }
3717
- function i(f, C, d = 50) {
3718
- a(f, C).visibleCount += d;
3719
- }
3720
- function k(f) {
3721
- t.value = f;
3722
- }
3723
- function m(f) {
3724
- n.value = f;
3725
- }
3726
- function p() {
3727
- n.value = null;
3728
- }
3729
- return {
3730
- allStates: r,
3731
- includeUnavailable: t,
3732
- openMenuKey: n,
3733
- getGlobalFilter: a,
3734
- isMenuOpen: l,
3735
- setGlobalFilter: y,
3736
- showMore: i,
3737
- setIncludeUnavailable: k,
3738
- openMenu: m,
3739
- closeMenu: p,
3740
- getKey: Nn
3741
- };
3742
- }), El = { class: "flex flex-row flex-wrap gap-2" }, Ul = { class: "inline-flex max-w-[460px]" }, ql = {
3743
- key: 0,
3744
- class: "flex justify-center my-2"
3745
- }, Xl = { class: "px-2 pb-8" }, Yl = { class: "flex-1 overflow-y-auto overflow-x-hidden" }, Gl = { class: "px-2 pb-8" }, jl = { class: "flex items-start w-full" }, Kl = ["onClick"], Jl = { class: "fm-typo-en-body-md-400" }, Zl = { key: 0 }, Ql = { class: "px-12 py-3" }, er = { class: "flex items-center justify-between" }, tr = { class: "text-xs max-w-[200px]" }, nr = { class: "px-4 py-3 flex flex-row justify-end gap-2 bg-white" }, Cr = /* @__PURE__ */ Be({
3746
- __name: "FilterSelector",
3747
- setup(e) {
3748
- const { t, locale: n } = et(), { currentReport: o, editingTile: a } = Ee(Na());
3749
- let { globalFilters: r, isGlobalFiltersLoading: l, timeRange: y, dateRange: i, selectedLocationIds: k, timezone: m } = Ee(gt()), { schemas: p } = Ee(Ha()), { showMore: f, getGlobalFilter: C, setGlobalFilter: d, setIncludeUnavailable: _, getKey: F, isMenuOpen: R } = Ol();
3750
- const b = S(() => t("report.input.unknown"));
3751
- let x = null;
3752
- const g = L(!1), c = S(() => {
3753
- var s;
3754
- return ((s = o.value) == null ? void 0 : s.id) ?? "";
3755
- }), v = L([]);
3756
- function $(s) {
3757
- const q = C(s.filter, c.value).selectedValues;
3758
- s.selectedValues = s.keepSelection ? q : s.options.map((E) => E.value), s.filter.values = [...s.selectedValues], d(s.filter, c.value, "selectedValues", s.selectedValues);
3759
- }
3760
- pe(
3761
- () => ({
3762
- reportId: c.value,
3763
- globalFilters: r.value
3764
- }),
3765
- () => {
3766
- v.value = (r.value || []).map((s, H) => {
3767
- const q = C(s, c.value), E = q.selectedValues.length ? [...q.selectedValues] : [...s.values ?? []];
3768
- return {
3769
- id: `${F(s, c.value)}|${H}`,
3770
- filter: s,
3771
- search: q.search,
3772
- options: [],
3773
- type: B(s),
3774
- selectedValues: E,
3775
- visibleCount: q.visibleCount,
3776
- keepSelection: q.keepSelection,
3777
- showAdvanced: q.showAdvanced
3778
- };
3779
- }), G();
3780
- },
3781
- { immediate: !0 }
3782
- ), pe(
3783
- [y, i, k],
3784
- async () => {
3785
- await G();
3786
- },
3787
- { deep: !0, immediate: !0 }
3788
- ), pe(
3789
- [() => a.value],
3790
- async () => {
3791
- v.value.forEach((s) => {
3792
- s.options = [];
3793
- }), await G();
3794
- },
3795
- { deep: !0 }
3796
- ), pe(
3797
- () => n.value,
3798
- async () => {
3799
- await G(!0);
3800
- }
3801
- );
3802
- function B(s) {
3803
- var q;
3804
- const H = (q = p.value.find((E) => E.name === s.schemaName)) == null ? void 0 : q.fields.find((E) => E.name === s.name);
3805
- return H == null ? void 0 : H.type;
3806
- }
3807
- function D(s) {
3808
- var be;
3809
- if (!o.value && !a.value) return [];
3810
- const H = a.value ? [a.value] : [...((be = o.value) == null ? void 0 : be.tiles) ?? []], { name: q = "", schemaName: E = "" } = s, ne = H.filter((se) => {
3811
- var re, ge;
3812
- const J = (re = se == null ? void 0 : se.widget) == null ? void 0 : re.config;
3813
- if (!J || (ge = s.tileIds) != null && ge.length && !s.tileIds.includes(se.id)) return !1;
3814
- const Q = (J.dimensions ?? []).some(
3815
- (me) => me.schemaName === E && me.name === q
3816
- ), M = (J.joinDatasources ?? []).some(
3817
- (me) => (me.dimensions ?? []).some((ue) => ue.schemaName === E && ue.name === q)
3818
- ), le = (J.schemaNames ?? []).includes(E);
3819
- return Q || M || le;
3820
- });
3821
- if (!ne.length) return [];
3822
- const de = (se, J) => {
3823
- const Q = /* @__PURE__ */ new Map(), M = (le) => {
3824
- const re = `${le.schemaName}:${le.name}:${le.operator}:${le.option ?? ""}:${le.dataFormula ?? ""}`, ge = Q.get(re);
3825
- ge ? [Pe.Like, Pe.NotLike].includes(le.operator) ? ge.values = Array.from(/* @__PURE__ */ new Set([...ge.values ?? [], ...le.values ?? []])) : Q.set(re, { ...le }) : Q.set(re, { ...le });
3826
- };
3827
- return se.forEach(M), J.forEach(M), Array.from(Q.values());
3828
- }, xe = (se) => {
3829
- var Q;
3830
- const J = (Q = se.dimensions) == null ? void 0 : Q.find(
3831
- (M) => M.schemaName === E && M.name === q
3832
- );
3833
- return {
3834
- name: q,
3835
- schemaName: E,
3836
- label: (J == null ? void 0 : J.label) ?? q,
3837
- hide: !1,
3838
- option: s.option ?? null,
3839
- dataFormula: J == null ? void 0 : J.dataFormula
3840
- };
3841
- };
3842
- return ne.map((se) => {
3843
- var me, ue;
3844
- const J = (me = se == null ? void 0 : se.widget) == null ? void 0 : me.config;
3845
- if (!J) return null;
3846
- const Q = xe(J), M = (J.dimensions ?? []).some((Te) => Te.schemaName === E) || (J.schemaNames ?? []).includes(E), le = de(
3847
- J.filters ?? [],
3848
- (s.filters ?? []).filter((Te) => {
3849
- var Fe;
3850
- return (Fe = J.schemaNames) == null ? void 0 : Fe.includes(Te.schemaName);
3851
- })
3852
- ), re = (ue = J.joinDatasources) == null ? void 0 : ue.find(
3853
- (Te) => (Te.schemaNames ?? []).includes(E) || (Te.dimensions ?? []).some((Fe) => Fe.schemaName === E)
3854
- ), ge = de(
3855
- (re == null ? void 0 : re.filters) ?? [],
3856
- (s.filters ?? []).filter((Te) => {
3857
- var Fe;
3858
- return (Fe = re == null ? void 0 : re.schemaNames) == null ? void 0 : Fe.includes(Te.schemaName);
3859
- })
3860
- );
3861
- return {
3862
- type: Y.Table,
3863
- title: "Global Filter",
3864
- config: {
3865
- schemaNames: J.schemaNames,
3866
- schemas: J.schemas,
3867
- dimensions: M ? [Q] : [],
3868
- filters: le,
3869
- sorts: M ? [{ name: q, schemaName: E, type: je.Asc, aggregation: null, dimensionOption: null }] : [],
3870
- joinDatasources: !M && re ? [
3871
- {
3872
- ...re,
3873
- dimensions: [Q],
3874
- sorts: [
3875
- {
3876
- name: q,
3877
- schemaName: E,
3878
- type: je.Asc,
3879
- aggregation: null,
3880
- dimensionOption: null
3881
- }
3882
- ],
3883
- filters: ge
3884
- }
3885
- ] : [],
3886
- rowIds: [],
3887
- metrics: [],
3888
- limit: null,
3889
- rollup: void 0,
3890
- drillDimension: void 0,
3891
- showGrandTotal: !1,
3892
- breakdownDimension: void 0,
3893
- sparklineDimension: void 0,
3894
- isTransposed: !1,
3895
- isDrillable: !1,
3896
- isBlend: !1
3897
- }
3898
- };
3899
- }).filter(Boolean);
3900
- }
3901
- function z(s) {
3902
- return s.options.every((H) => {
3903
- var q;
3904
- return (q = s.selectedValues) == null ? void 0 : q.includes(H.value);
3905
- });
3906
- }
3907
- function P(s) {
3908
- z(s) ? s.selectedValues = ["(EMPTY)"] : s.selectedValues = s.options.map((H) => H.value);
3909
- }
3910
- const I = S(
3911
- () => v.value.map((s) => {
3912
- const H = s.options, q = s.search.toLowerCase() ?? "";
3913
- return H.filter(
3914
- (ne) => ne.label.toLowerCase().includes(q.toLowerCase())
3915
- ).slice(0, s.visibleCount);
3916
- })
3917
- );
3918
- function V(s) {
3919
- s.visibleCount += 50, f(s.filter, c.value, 50);
3920
- }
3921
- async function O(s, H) {
3922
- var q;
3923
- if (!(!s.type && (s.type = B(s.filter), !s.type)))
3924
- switch (s.type) {
3925
- case Oe.String:
3926
- try {
3927
- const E = D(s.filter);
3928
- if (!E.length) {
3929
- s.options = [];
3930
- return;
3931
- }
3932
- const ne = [];
3933
- for (const J of E) {
3934
- const Q = await On(J, H);
3935
- (Q == null ? void 0 : Q.type) === Y.Table && ne.push(...Q.rows.map((M) => {
3936
- var le;
3937
- return ((le = M.cells) == null ? void 0 : le[0]) ?? " ";
3938
- }));
3939
- }
3940
- const de = Array.from(new Set(ne)), xe = (q = C(s.filter, c.value).selectedValues) != null && q.length ? C(s.filter, c.value).selectedValues : s.selectedValues || [], be = s.keepSelection ? Array.from(/* @__PURE__ */ new Set([...de, ...xe])) : de, se = new Set(ne);
3941
- s.options = be.map((J) => ({
3942
- label: String(J).trim() === "" ? b.value : String(J),
3943
- value: J,
3944
- available: s.keepSelection ? se.has(J) : new Set(de).has(J)
3945
- })), $(s);
3946
- } catch (E) {
3947
- if ((E == null ? void 0 : E.code) === "ERR_CANCELED" || (E == null ? void 0 : E.name) === "CanceledError")
3948
- return;
3949
- throw E;
3950
- }
3951
- break;
3952
- case Oe.Bool: {
3953
- s.options = [
3954
- { label: t("report.common.yes"), value: !0 },
3955
- { label: t("report.common.no"), value: !1 }
3956
- ], $(s);
3957
- break;
3958
- }
3959
- case Oe.Timestamp:
3960
- if (s.filter.option !== we.DateTime && s.filter.option !== we.TimeOfDay) {
3961
- const E = s.filter.option;
3962
- s.options = zn({ dimensionOption: E, t }), s.filter.values = s.options.length ? s.options.map((ne) => ne.value) : ["NULL"];
3963
- }
3964
- $(s);
3965
- break;
3966
- case Oe.Numeric:
3967
- break;
3968
- }
3969
- }
3970
- async function G(s = !1) {
3971
- if (!c.value || !v.value.length) return;
3972
- x == null || x.abort();
3973
- const H = new AbortController();
3974
- x = H;
3975
- try {
3976
- s || (l.value = !0), g.value = !0, await Promise.all(
3977
- v.value.map((q) => O(q, H.signal))
3978
- );
3979
- } finally {
3980
- x === H && (s || (l.value = !1), g.value = !1);
3981
- }
3982
- }
3983
- function T(s, H) {
3984
- var E;
3985
- if ((E = s.selectedValues) == null ? void 0 : E.includes(H)) {
3986
- let ne = (s.selectedValues || []).filter((de) => de !== H && de !== "(EMPTY)");
3987
- s.selectedValues = ne.length > 0 ? ne : ["(EMPTY)"];
3988
- } else
3989
- s.selectedValues = [...(s.selectedValues || []).filter((ne) => ne !== "(EMPTY)"), H];
3990
- d(s.filter, c.value, "selectedValues", s.selectedValues);
3991
- }
3992
- function w(s, H) {
3993
- if (H === null)
3994
- s.values = [];
3995
- else {
3996
- const E = st(H.startDate).tz(m.value).startOf("day").utc().toISOString(), ne = st(H.endDate).tz(m.value).endOf("day").utc().toISOString();
3997
- s.values = [E, ne];
3998
- }
3999
- const q = v.value.find((E) => E.filter === s);
4000
- q && (q.keepSelection = H !== null, d(q.filter, c.value, "keepSelection", q.keepSelection));
4001
- }
4002
- function N(s) {
4003
- const H = (s.selectedValues || []).filter((q) => q !== "(EMPTY)");
4004
- return `${t("report.section.filter.selectAll")} (${H.length}/${s.options.length})`;
4005
- }
4006
- function A(s) {
4007
- const H = s.options.length, q = t("report.section.filter.search"), E = t("report.common.results", { count: H });
4008
- return `${q} (${E})`;
4009
- }
4010
- function W(s) {
4011
- var de, xe, be, se, J;
4012
- const H = Oa(s.filter);
4013
- if (s.type === Oe.Timestamp) {
4014
- const Q = ((de = s.filter.values) == null ? void 0 : de.length) === 2;
4015
- if (s.filter.option === we.DateTime)
4016
- return { preview: Q ? `${H} is between ${qa({
4017
- startDate: ((xe = s.filter.values) == null ? void 0 : xe[0]) || null,
4018
- endDate: ((be = s.filter.values) == null ? void 0 : be[1]) || null,
4019
- locale: n.value,
4020
- timezone: m.value
4021
- })}` : H, suffix: "" };
4022
- if (s.filter.option === we.TimeOfDay) {
4023
- const M = (se = s.filter.values) != null && se[0] ? st(s.filter.values[0]).tz(m.value) : null, le = (J = s.filter.values) != null && J[1] ? st(s.filter.values[1]).tz(m.value) : null, re = (me) => me && me.isValid() ? { hour: me.hour(), minute: me.minute() } : null;
4024
- return { preview: Q ? `${H} is between ${Xa({
4025
- startTime: re(M),
4026
- endTime: re(le),
4027
- locale: n.value
4028
- })}` : H, suffix: "" };
4029
- }
4030
- if (s.filter.option !== we.DateTime && s.filter.option !== we.TimeOfDay) {
4031
- const M = zn({
4032
- dimensionOption: s.filter.option,
4033
- t
4034
- }), le = new Map(M.map((ue) => [String(ue.value), ue.label])), ge = (s.selectedValues || []).filter((ue) => ue !== "(EMPTY)").map((ue) => le.get(String(ue)) ?? String(ue)), me = ge.map((ue) => ue.length > 20 ? `${ue.slice(0, 20)}…` : ue).join(", ");
4035
- return ge.length ? {
4036
- preview: `${H}: ${me}`,
4037
- suffix: `(${ge.length} selected)`
4038
- } : { preview: H, suffix: "" };
4039
- }
4040
- }
4041
- const E = (s.selectedValues || []).filter((Q) => Q !== "(EMPTY)").map((Q) => Q === !0 ? t("report.common.yes") || "Yes" : Q === !1 ? t("report.common.no") || "No" : String(Q).trim() === "" ? b.value : String(Q)), ne = E.map((Q) => Q.length > 20 ? `${Q.slice(0, 20)}…` : Q).join(", ");
4042
- return E.length ? {
4043
- preview: `${H}: ${ne}`,
4044
- suffix: `(${E.length} selected)`
4045
- } : { preview: ne, suffix: `${H}` };
4046
- }
4047
- function U(s) {
4048
- s.filter.values = [...s.selectedValues || []], d(s.filter, c.value, "selectedValues", s.selectedValues), document.body.click();
4049
- }
4050
- function ee(s) {
4051
- s.selectedValues = [...s.filter.values || []], d(s.filter, c.value, "selectedValues", s.selectedValues), document.body.click();
4052
- }
4053
- function te(s) {
4054
- s.showAdvanced = !s.showAdvanced, d(s.filter, c.value, "showAdvanced", s.showAdvanced);
4055
- }
4056
- function ve(s) {
4057
- s.keepSelection = !s.keepSelection, _(s.keepSelection), d(s.filter, c.value, "keepSelection", s.keepSelection), s.options = [], G(!0);
4058
- }
4059
- function ye(s, H) {
4060
- return s ? s.length > H ? `${s.slice(0, H)}…` : s : b.value;
4061
- }
4062
- function Ie(s, H) {
4063
- var E, ne, de, xe;
4064
- if (H === null)
4065
- s.values = [];
4066
- else {
4067
- const be = st().tz(m.value).set("hour", Number((E = H.start) == null ? void 0 : E.hour)).set("minute", Number((ne = H.start) == null ? void 0 : ne.minute)).toISOString(), se = st().tz(m.value).set("hour", Number((de = H.end) == null ? void 0 : de.hour)).set("minute", Number((xe = H.end) == null ? void 0 : xe.minute)).toISOString();
4068
- s.values = [be, se];
4069
- }
4070
- const q = v.value.find((be) => be.filter === s);
4071
- q && (q.keepSelection = H !== null, d(q.filter, c.value, "keepSelection", q.keepSelection));
4072
- }
4073
- return (s, H) => {
4074
- const q = Z("FmCircularProgress"), E = Z("FmTextField"), ne = Z("FmMenuItem"), de = Z("FmTooltip"), xe = Z("FmIcon"), be = Z("FmMenuDivider"), se = Z("FmSwitch"), J = Z("FmButton"), Q = Z("FmMenu");
4075
- return X(), oe("div", El, [
4076
- (X(!0), oe(ke, null, it(v.value, (M, le) => {
4077
- var re, ge, me, ue, Te, Fe;
4078
- return X(), oe("div", {
4079
- key: M.id
4080
- }, [
4081
- M.filter.option === u(we).DateTime ? (X(), he(Ea, {
4082
- key: 0,
4083
- "model-value": { startDate: (re = M.filter.values) == null ? void 0 : re[0], endDate: (ge = M.filter.values) == null ? void 0 : ge[1] },
4084
- class: "w-full",
4085
- label: W(M).preview,
4086
- removable: ((me = M.filter.values) == null ? void 0 : me.length) === 2,
4087
- onUpdate: (qe) => w(M.filter, qe),
4088
- onChipClosed: () => w(M.filter, null)
4089
- }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : M.filter.option === u(we).TimeOfDay ? (X(), he(Wa, {
4090
- key: 1,
4091
- "model-value": { start: (ue = M.filter.values) == null ? void 0 : ue[0], end: (Te = M.filter.values) == null ? void 0 : Te[1] },
4092
- class: "w-full",
4093
- label: W(M).preview,
4094
- removable: ((Fe = M.filter.values) == null ? void 0 : Fe.length) === 2,
4095
- onUpdate: (qe) => Ie(M.filter, qe),
4096
- onChipClosed: () => Ie(M.filter, null)
4097
- }, null, 8, ["model-value", "label", "removable", "onUpdate", "onChipClosed"])) : (X(), he(Q, {
4098
- key: 2,
4099
- "close-on-click": !1,
4100
- shift: !0,
4101
- open: u(R)(M.id)
4102
- }, {
4103
- "menu-button": ce(() => [
4104
- j("div", Ul, [
4105
- K(Ua, {
4106
- "left-icon": "filter_alt",
4107
- "trailing-icon": "expand_more",
4108
- label: W(M).preview,
4109
- class: "w-full"
4110
- }, {
4111
- default: ce(() => [
4112
- qt(Le(W(M).suffix), 1)
4113
- ]),
4114
- _: 2
4115
- }, 1032, ["label"])
4116
- ])
4117
- ]),
4118
- "menu-wrapper": ce(({ maxHeight: qe, width: _t }) => [
4119
- j("div", {
4120
- class: "flex flex-col bg-fm-color-neutral-white p-2 rounded-lg shadow-light-300",
4121
- style: $e({ maxHeight: `${qe}px`, width: _t })
4122
- }, [
4123
- g.value ? (X(), oe("div", ql, [
4124
- K(q)
4125
- ])) : M.options.length > 0 && !u(l) ? (X(), oe(ke, { key: 1 }, [
4126
- j("div", Xl, [
4127
- K(E, {
4128
- modelValue: M.search,
4129
- "onUpdate:modelValue": [
4130
- (ie) => M.search = ie,
4131
- (ie) => u(d)(M.filter, c.value, "search", ie)
4132
- ],
4133
- type: "text",
4134
- "prepend-icon": "search",
4135
- placeholder: A(M),
4136
- class: "border px-2 pb-8 text-sm mb-1 rounded"
4137
- }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder"])
4138
- ]),
4139
- j("div", Yl, [
4140
- j("div", Gl, [
4141
- K(ne, {
4142
- label: N(M),
4143
- "has-checkbox": !0,
4144
- "model-value": z(M),
4145
- indeterminate: !0,
4146
- onClick: (ie) => P(M)
4147
- }, null, 8, ["label", "model-value", "onClick"]),
4148
- (X(!0), oe(ke, null, it(I.value[le], (ie) => (X(), oe(ke, {
4149
- key: ie.value
4150
- }, [
4151
- ie.label && ie.label.length > 110 ? (X(), he(de, {
4152
- key: 0,
4153
- placement: "right",
4154
- "hide-arrow": !0,
4155
- "z-index": 2e3
4156
- }, {
4157
- content: ce(() => [
4158
- qt(Le(ie.label), 1)
4159
- ]),
4160
- default: ce(() => [
4161
- j("div", jl, [
4162
- K(ne, {
4163
- label: ye(ie.label, 110),
4164
- "has-checkbox": !0,
4165
- "model-value": M.selectedValues.includes(ie.value),
4166
- class: Qe([
4167
- "flex-1 text-left",
4168
- { "bg-gray-200": ie.available === !1 }
4169
- ]),
4170
- onClick: () => T(M, ie.value)
4171
- }, null, 8, ["label", "model-value", "class", "onClick"])
4172
- ])
4173
- ]),
4174
- _: 2
4175
- }, 1024)) : (X(), he(ne, {
4176
- key: 1,
4177
- label: ie.label,
4178
- "has-checkbox": !0,
4179
- "model-value": M.selectedValues.includes(ie.value),
4180
- class: Qe(["flex-1 text-left", { "bg-gray-100": ie.available === !1 }]),
4181
- onClick: () => T(M, ie.value)
4182
- }, null, 8, ["label", "model-value", "class", "onClick"]))
4183
- ], 64))), 128)),
4184
- I.value[le].length < M.options.length && !M.search ? (X(), he(ne, {
4185
- key: 0,
4186
- class: "fm-typo-en-body-md-400 -ml-2",
4187
- label: u(t)("report.section.filter.loadMore"),
4188
- onClick: $t((ie) => V(M), ["stop"]),
4189
- icon: "autorenew"
4190
- }, null, 8, ["label", "onClick"])) : Ve("", !0)
4191
- ])
4192
- ]),
4193
- j("div", {
4194
- class: "px-12 py-2 flex items-center gap-2 cursor-pointer hover:bg-fm-color-neutral-50 transition-colors",
4195
- onClick: (ie) => te(M)
4196
- }, [
4197
- K(xe, {
4198
- name: M.showAdvanced ? "keyboard_arrow_up" : "keyboard_arrow_down",
4199
- size: "md",
4200
- class: ""
4201
- }, null, 8, ["name"]),
4202
- j("span", Jl, Le(u(t)("report.section.filter.advanced")), 1)
4203
- ], 8, Kl),
4204
- K(be),
4205
- M.showAdvanced ? (X(), oe("div", Zl, [
4206
- j("div", Ql, [
4207
- j("div", er, [
4208
- K(se, {
4209
- "model-value": M.keepSelection,
4210
- label: u(t)("report.section.filter.keepSelection"),
4211
- labelPlacement: "right",
4212
- "onUpdate:modelValue": () => ve(M)
4213
- }, null, 8, ["model-value", "label", "onUpdate:modelValue"]),
4214
- K(de, {
4215
- placement: "top",
4216
- "z-index": 2e3
4217
- }, {
4218
- content: ce(() => [
4219
- j("div", tr, Le(u(t)("report.section.filter.keepSelectionTooltip")), 1)
4220
- ]),
4221
- default: ce(() => [
4222
- K(xe, {
4223
- name: "info",
4224
- size: "md",
4225
- class: "text-fm-color-primary"
4226
- })
4227
- ]),
4228
- _: 1
4229
- })
4230
- ])
4231
- ])
4232
- ])) : Ve("", !0),
4233
- j("div", nr, [
4234
- K(J, {
4235
- variant: "tertiary",
4236
- label: u(t)("report.common.cancel"),
4237
- onClick: $t((ie) => ee(M), ["stop"])
4238
- }, null, 8, ["label", "onClick"]),
4239
- K(J, {
4240
- color: "primary",
4241
- onClick: $t((ie) => U(M), ["stop"]),
4242
- label: u(t)("report.common.apply")
4243
- }, null, 8, ["onClick", "label"])
4244
- ])
4245
- ], 64)) : u(l) ? Ve("", !0) : (X(), he(Yt, { key: 2 }))
4246
- ], 4)
4247
- ]),
4248
- _: 2
4249
- }, 1032, ["open"]))
4250
- ]);
4251
- }), 128)),
4252
- Ue(s.$slots, "default")
4253
- ]);
4254
- };
4255
- }
4256
- });
4257
- export {
4258
- Je as I,
4259
- Kt as L,
4260
- Ge as R,
4261
- _e as S,
4262
- Jt as X,
4263
- Zt as Y,
4264
- vr as _,
4265
- Cr as a,
4266
- jt as b,
4267
- hr as c,
4268
- Pt as d,
4269
- Qt as e,
4270
- yr as f,
4271
- Et as g,
4272
- br as h,
4273
- gr as i,
4274
- Mn as u
4275
- };