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