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