@feedmepos/mf-report 5.26.4 → 5.26.5-beta.0

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