@feedmepos/mf-report 5.25.3 → 5.25.4

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 (24) hide show
  1. package/dist/{App-CnFZJmzp.js → App-zRHXHcPT.js} +4 -4
  2. package/dist/{DateRangeSelect.vue_vue_type_script_setup_true_lang-RUTqJF5H.js → DateRangeSelect.vue_vue_type_script_setup_true_lang-BVdgmiki.js} +1 -1
  3. package/dist/{Default.vue_vue_type_script_setup_true_lang-CcMbnaoi.js → Default.vue_vue_type_script_setup_true_lang-By3S17dA.js} +1 -1
  4. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-nqE6iEkZ.js +4939 -0
  5. package/dist/{GlobalFilterSelect.vue_vue_type_script_setup_true_lang-BY_KN_C1.js → GlobalFilterSelect.vue_vue_type_script_setup_true_lang-CeERNo7f.js} +2 -2
  6. package/dist/{InsightView-DKrfAidQ.js → InsightView-BBhWazOR.js} +4 -4
  7. package/dist/{Integration-BNW5e7Qk.js → Integration-DwrH45Cv.js} +254 -254
  8. package/dist/{Integrations-DItxcgrC.js → Integrations-B2oXCMtI.js} +2 -2
  9. package/dist/{Layout-GLIcaoCe.js → Layout-8K-hl0GX.js} +1 -1
  10. package/dist/{MenuTab.vue_vue_type_script_setup_true_lang-pOrfpYWl.js → MenuTab.vue_vue_type_script_setup_true_lang-Bk13wM8J.js} +4 -4
  11. package/dist/{NavigationTab.vue_vue_type_script_setup_true_lang-CBAiRY5H.js → NavigationTab.vue_vue_type_script_setup_true_lang-DJQmFNyV.js} +6 -6
  12. package/dist/{OverviewView-V-17Kj3C.js → OverviewView-VK-QiYBv.js} +4 -4
  13. package/dist/{Report-Cawu6GrR.js → Report-DjEakQjd.js} +3 -3
  14. package/dist/{ReportEditor-ChZgxHxU.js → ReportEditor-DkDpoEA1.js} +3 -3
  15. package/dist/{ReportView-Dfb_owW8.js → ReportView-D7pPDt9i.js} +6 -6
  16. package/dist/{Setting-bPYUv_iE.js → Setting-Cj8FNkcg.js} +3 -3
  17. package/dist/{TileEditor-CZ_n5OKa.js → TileEditor-DiIeHLZ2.js} +1351 -1317
  18. package/dist/{TransitionFade-DCyLVIwo.js → TransitionFade-D3p2nUld.js} +4 -4
  19. package/dist/{app-AKUT_6m_.js → app-t7VSpu_w.js} +102 -54
  20. package/dist/app.js +1 -1
  21. package/dist/style.css +1 -1
  22. package/dist/{useRestaurantPermission-251v8GZD.js → useRestaurantPermission-ClMBdaFt.js} +1 -1
  23. package/package.json +1 -1
  24. package/dist/DynamicWidget.vue_vue_type_script_setup_true_lang-COXEyuoF.js +0 -4689
@@ -1,4689 +0,0 @@
1
- import { computed as m, defineComponent as Ne, ref as D, onMounted as $e, onBeforeUnmount as Qn, resolveComponent as pe, createBlock as ge, openBlock as Y, Transition as Io, withCtx as Le, createElementBlock as fe, createCommentVNode as be, createElementVNode as Q, unref as r, normalizeStyle as De, withModifiers as en, toDisplayString as Pe, createVNode as he, Fragment as Ve, renderList as zt, normalizeClass as Ie, watch as we, nextTick as Me, mergeModels as Xe, useModel as Ee, renderSlot as nt, h as Jt, createSlots as Mo, resolveDynamicComponent as eo, toRaw as Bo, markRaw as Po, createTextVNode as Fo, onUnmounted as to, withDirectives as Ao, vShow as Ro } from "vue";
2
- import { W as oe, i as kt, j as zo, S as Pt, v as Rt, k as No, l as dn, m as no, d as Vo, q as $o, R as gt, n as Ho } from "./GlobalFilterSelect.vue_vue_type_script_setup_true_lang-BY_KN_C1.js";
3
- import { h as Wo, z as Eo, i as Oo, j as Uo, a as on, u as kn } from "./app-AKUT_6m_.js";
4
- import { d as mn } from "./DateRangeSelect.vue_vue_type_script_setup_true_lang-RUTqJF5H.js";
5
- import { storeToRefs as it, defineStore as Ko } from "pinia";
6
- import { C as pn } from "./chart-DDDh8zNk.js";
7
- import { detectLocale as qo } from "@feedmepos/mf-common";
8
- import { useBreakpoints as rn, useSnackbar as Tn, components as Xo } from "@feedmepos/ui-library";
9
- import { u as ut } 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 st } from "./i18n-CI_sQ5d_.js";
12
- var vn = /* @__PURE__ */ ((e) => (e.line = "LINE", e.bar = "BAR", e))(vn || {}), et = /* @__PURE__ */ ((e) => (e.top = "TOP", e.bottom = "BOTTOM", e))(et || {}), gn = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e))(gn || {}), yn = /* @__PURE__ */ ((e) => (e.start = "start", e.center = "center", e.end = "end", e.left = "left", e.right = "right", e.top = "top", e.bottom = "bottom", e))(yn || {}), bn = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e))(bn || {}), Cn = /* @__PURE__ */ ((e) => (e.right = "right", e.left = "left", e))(Cn || {}), xn = /* @__PURE__ */ ((e) => (e.top = "top", e.bottom = "bottom", e.right = "right", e.left = "left", e.chartArea = "chartArea", e))(xn || {}), _e = /* @__PURE__ */ ((e) => (e.series = "SERIES", e.metric = "METRIC", e.breakdown = "BREAKDOWN", e))(_e || {});
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 fn(e) {
86
- const n = [e.schemaName, e.name];
87
- return "option" in e && e.option && n.push(e.option), "aggregation" in e && e.aggregation && n.push(e.aggregation), n.push(e.label.replace(/[^\p{L}\p{N}_]+/gu, "")), n.join("_").toLowerCase();
88
- }
89
- function 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 an = [
108
- "#36A2EB",
109
- "#007BA7",
110
- "#FF5D53",
111
- "#73C8E6",
112
- "#FCA23E",
113
- "#F09BBE",
114
- "#FFD232",
115
- "#50BE9B",
116
- "#8358D4",
117
- "#9B5046"
118
- ], ul = an.map(() => "solid");
119
- function yt({
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 !== _e.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 Nt(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 = Nt(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 ? an : an.map((n, t) => Nt(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 = Nt(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 wt({
198
- fallbackIndex: e,
199
- metricCount: n
200
- }) {
201
- return Number.isInteger(n) && Number(n) > 0 ? Math.floor(e / Number(n)) : e;
202
- }
203
- function Tt({
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 C = Number.isInteger(t) && Number(t) > 0 ? Number(t) : 1, N = Number.isInteger(n) && Number(n) >= 0 ? Number(n) : 0, $ = l !== !1, F = e * C + N, y = h === "clustered" ? an : ao(c), g = Nt(i == null ? void 0 : i[e * C]) ?? y[e % y.length], I = $ && N > 0 ? Vn(g, $n(N)) : Nt(i == null ? void 0 : i[F]) ?? (N > 0 ? Vn(g, $n(N)) : g);
215
- let T = typeof s == "number" ? s : 1;
216
- return o && (T = T * 0.6), ro(I, T);
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 Vt(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 = Vt({
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 = Vt({
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 = Vt({
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 hn(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 && hn(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 T = (o ? h : l).getPixelForValue(c.index);
405
- hn(e.ctx, o, e.chartArea, T);
406
- return;
407
- }
408
- if (!c.element)
409
- return;
410
- const C = c.element, N = o ? h : l, $ = o ? C.y : C.x, F = N.getPixelForValue(c.index), y = $ ?? F;
411
- hn(e.ctx, o, e.chartArea, y);
412
- }
413
- function $t(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, wn = 2, fa = 1, ha = 0.2, ma = 120, { breakpoints: bt } = rn(), Ln = "report-v5:locationchange";
440
- let Wn = !1;
441
- function En() {
442
- window.dispatchEvent(new Event(Ln));
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 Ft = {
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 Ft ? Ft[e] : e.startsWith("zh") ? Ft["zh-CN"] : e.startsWith("th") ? Ft["th-TH"] : Ft["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 = At(e.borderColor, n) || At(e.color, n), s = At(e.backgroundColor, n), i = At(e.pointBorderColor, n), l = At(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 At(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 Sn(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(wn, Math.floor(n)) : da;
524
- }
525
- function La(e) {
526
- return e <= 0 ? 320 : bt.value.xs || bt.value.sm || e <= 640 ? Math.max(160, Math.floor(e * 0.38)) : bt.value.md || e <= 900 ? Math.max(200, Math.floor(e * 0.46)) : bt.value.lg || e <= 1200 ? Math.max(240, Math.floor(e * 0.54)) : Math.max(280, Math.floor(e * 0.62));
527
- }
528
- function Dn(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 Ct() {
533
- return bt.value.xs || bt.value.sm;
534
- }
535
- function xt(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 Vt({
562
- ...na,
563
- margin: `${e ? "8px" : "0"} 0 4px`
564
- });
565
- }
566
- function Ia(e, n) {
567
- return Vt({
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}">${Sn(e)}</button>`;
574
- }
575
- function fo(e, n, t, o, s, i, l, h) {
576
- var A;
577
- const c = (A = e[0]) == null ? void 0 : A.label, C = va(c), N = (C == null ? void 0 : C[0]) ?? "", $ = C == null ? void 0 : C[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), q = ba(M, l), ee = xa(M, h), G = {
582
- text: Ca(W, q),
583
- color: wa(M, l, ee),
584
- isBar: ee,
585
- value: q,
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), T = /* @__PURE__ */ new Map();
596
- y.forEach((w) => {
597
- const u = T.get(w.matchingKey);
598
- if (!u) {
599
- T.set(w.matchingKey, [w]);
600
- return;
601
- }
602
- u.push(w);
603
- });
604
- const B = $ ? I.map((w) => {
605
- const u = T.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)}">${Sn(w)}</div>`, k = (w) => {
608
- const u = Ia(w.isBar, w.color);
609
- return `<div style="${oa}"><span style="${u}"></span><span style="${aa}">${Sn(w.text)}</span></div>`;
610
- };
611
- let L = "";
612
- N.length > 0 && (L += f(N)), L += I.map((w) => k(w)).join(""), $ && B.length > 0 && (L += f($, L.length > 0), L += B.map((w) => k(w)).join("")), s && v && (L += 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: L,
625
- detailsPayload: { sections: x },
626
- hasCollapsedValues: v
627
- };
628
- }
629
- function Kn(e) {
630
- return e.scrollHeight - e.clientHeight > fa;
631
- }
632
- function Zt(e, n, t, o, s, i, l, h, c) {
633
- const C = fo(
634
- n,
635
- t,
636
- o,
637
- s,
638
- i,
639
- l,
640
- h,
641
- c
642
- );
643
- return e.innerHTML !== C.html && (e.innerHTML = C.html, Ua(e)), C;
644
- }
645
- function Ba(e, n, t, o, s, i, l, h, c) {
646
- if (Number.isFinite(s))
647
- return {
648
- markup: Zt(
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 C = Math.max(wn, n.length);
662
- let N = C, $ = Zt(
663
- e,
664
- n,
665
- t,
666
- o,
667
- C,
668
- i,
669
- l,
670
- h,
671
- c
672
- );
673
- if (!Kn(e))
674
- return {
675
- markup: $,
676
- maxTooltipItems: C
677
- };
678
- let F = wn, y = C;
679
- for (; F <= y; ) {
680
- const I = Math.floor((F + y) / 2), T = Zt(
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, $ = T, F = I + 1;
696
- }
697
- return {
698
- markup: N === C ? $ : Zt(
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), C = Number.parseInt(h.slice(2, 4), 16), N = Number.parseInt(h.slice(4, 6), 16);
718
- return `rgba(${c}, ${C}, ${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, C] = l;
726
- return `rgba(${h}, ${c}, ${C}, ${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, C] = l;
734
- return `hsla(${h}, ${c}, ${C}, ${t})`;
735
- }
736
- }
737
- return e;
738
- }
739
- function Qt(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 Pa(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 Aa(e, n) {
757
- const t = e.__tooltipOriginalStyle;
758
- t && (Reflect.set(e, "borderColor", Qt(t.borderColor, n)), Reflect.set(e, "backgroundColor", Qt(t.backgroundColor, n)), Reflect.set(e, "pointBorderColor", Qt(t.pointBorderColor, n)), Reflect.set(
759
- e,
760
- "pointBackgroundColor",
761
- Qt(t.pointBackgroundColor, n)
762
- ));
763
- }
764
- function _n(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 tn(e, n) {
775
- if (!_n(e))
776
- return;
777
- const t = e.data.datasets;
778
- if (t.length !== 0) {
779
- if (t.forEach((o, s) => {
780
- Pa(o), !n || s === n.datasetIndex ? Fa(o) : Aa(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 (_n(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 = pn.getChart(s);
810
- return _n(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 In(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 Mn(e, n, t, o, s, i, l = "center", h = !1) {
823
- const c = n.getBoundingClientRect(), C = 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 T = g.__cachedWidth ?? e.offsetWidth, B = g.__cachedHeight ?? e.offsetHeight, v = 8, f = c.left - C.left + N + o, k = c.top - C.top + $ + s, L = h ? l === "left" ? f - T - v : f + v : l === "left" ? f - T - v : l === "right" ? f + v : f - T / 2, x = h ? k + v : i ? k - B / 2 : k + v, A = N + v;
826
- let w = $ + v;
827
- const u = document.querySelector('[data-menu-tab="true"]');
828
- if (u) {
829
- const ie = u.getBoundingClientRect().bottom - C.top + $ + v;
830
- w = Math.max(w, ie);
831
- }
832
- const M = Math.max(A, N + F - T - v), W = Math.max(w, $ + y - B - v), q = Math.round(Math.min(Math.max(A, L), M)), ee = Math.round(Math.min(Math.max(w, x), W));
833
- g.__lastLeftPx === q && g.__lastTopPx === ee || (g.__lastLeftPx = q, g.__lastTopPx = ee, e.style.left = `${q}px`, e.style.top = `${ee}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, C = s - h.top;
840
- !Number.isFinite(c) || !Number.isFinite(C) || (e.dataset.cursorCanvasX = String(c), e.dataset.cursorCanvasY = String(C), e.dataset.caretX = String(c), e.dataset.caretY = String(C), e.dataset.anchorDirection = l, Mn(
841
- e,
842
- n,
843
- t,
844
- c,
845
- C,
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", Dn(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(Ln, 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 Bn(e, n) {
865
- St(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
- Bn(e, t);
871
- return;
872
- }
873
- qe(e, n, !0);
874
- }, window.addEventListener(Ln, 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 || Bn(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 && Bn(s, t);
889
- });
890
- }
891
- function St(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 = In(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 qe(e, n, t = !1) {
919
- xt(e) && !t || (St(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", tn(n));
920
- }
921
- function Yn(e, n, t = ma) {
922
- e.__isTooltipHovered || (St(e), e.__hideTimeoutId = window.setTimeout(() => {
923
- e.__isTooltipHovered || qe(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 (!(Ct() && xt(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
- Ct() && xt(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
- Ct() && xt(e) || qe(e, t);
955
- }, n.addEventListener("pointerleave", e.__onCanvasPointerLeave, {
956
- passive: !0
957
- })), e.__onCanvasClick || (e.__onCanvasClick = (l) => {
958
- var T, B;
959
- if (!(s != null && s.onViewFullDetails) || !e.__detailsPayload || e.style.opacity !== "1")
960
- return;
961
- const h = (v) => {
962
- var A, w, u, M;
963
- if (v.length === 0)
964
- return !1;
965
- const f = (A = v.find(
966
- (W) => typeof W.dataIndex == "number"
967
- )) == null ? void 0 : A.dataIndex, k = ((w = t == null ? void 0 : t.data) == null ? void 0 : w.datasets) ?? [], L = (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
- k,
974
- f,
975
- L
976
- ).detailsPayload;
977
- return (M = s.onViewFullDetails) == null || M.call(s, x, t), qe(e, t), !0;
978
- }, c = ((T = t == null ? void 0 : t.tooltip) == null ? void 0 : T.dataPoints) ?? [];
979
- if (h(c))
980
- return;
981
- const C = t == null ? void 0 : t.getElementsAtEventForMode;
982
- if (typeof C != "function")
983
- return;
984
- const N = C.call(
985
- t,
986
- l,
987
- "nearest",
988
- { intersect: !0 },
989
- !1
990
- ), $ = C.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 (Ct()) {
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 C = 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 = (C.length > 0 ? C : 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
- qe(e, t, !0);
1036
- return;
1037
- }
1038
- uo(e, !0), St(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 C;
1052
- const h = l.target;
1053
- h != null && h.closest('[data-tooltip-full-details="true"]') && (l.preventDefault(), l.stopPropagation(), e.__detailsPayload && ((C = s.onViewFullDetails) == null || C.call(s, e.__detailsPayload, t), qe(e, t)));
1054
- }, e.addEventListener("click", e.__onDetailsClick)), e.__onTooltipPointerEnter || (e.__onTooltipPointerEnter = () => {
1055
- e.__isTooltipHovered = !0, St(e);
1056
- }, e.addEventListener("pointerenter", e.__onTooltipPointerEnter)), e.__onTooltipPointerLeave || (e.__onTooltipPointerLeave = () => {
1057
- e.__isTooltipHovered = !1, qe(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 = In(n);
1070
- e.parentElement !== l && l.appendChild(e), Dn(e, l), Mn(
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 q, ee, G, ie;
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 = In(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), Dn(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 (Ct() && xt(c))
1101
- return;
1102
- n != null && n.onViewFullDetails ? Yn(c, o) : qe(c, o);
1103
- return;
1104
- }
1105
- const C = (s == null ? void 0 : s.dataPoints) ?? [];
1106
- if (C.length === 0) {
1107
- if (Ct() && xt(c))
1108
- return;
1109
- n != null && n.onViewFullDetails ? Yn(c, o) : qe(c, o);
1110
- return;
1111
- }
1112
- St(c);
1113
- const N = (n == null ? void 0 : n.viewFullDetailsLabel) ?? io(), $ = !!(n != null && n.onViewFullDetails), F = (q = C.find((J) => typeof J.dataIndex == "number")) == null ? void 0 : q.dataIndex, y = ((ee = o == null ? void 0 : o.data) == null ? void 0 : ee.datasets) ?? [], g = (G = o == null ? void 0 : o.config) == null ? void 0 : G.type, {
1114
- markup: { detailsPayload: I, hasCollapsedValues: T }
1115
- } = Ba(
1116
- c,
1117
- C,
1118
- e,
1119
- N,
1120
- t,
1121
- $,
1122
- y,
1123
- F,
1124
- g
1125
- ), B = $ && T;
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), k = Number(c.dataset.cursorCanvasY);
1128
- if (!(Number.isFinite(f) && Number.isFinite(k))) {
1129
- c.style.opacity = "0";
1130
- return;
1131
- }
1132
- const x = (ie = o == null ? void 0 : o.scales) == null ? void 0 : ie.x, A = x && typeof x.getPixelForValue == "function" ? x.getPixelForValue(0) : NaN, w = e ? C.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(A) ? A : v, P = Math.abs(J - R);
1139
- return Math.abs(z - R) > P ? z : J;
1140
- }, Number.NaN) : Number.NaN, u = f, M = k, W = e ? Number.isFinite(A) && Number.isFinite(w) && w < A ? "left" : "right" : "center";
1141
- Mn(
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 Lt(e = !1, n) {
1154
- return {
1155
- ...so(e ? "y" : "x"),
1156
- enabled: !1,
1157
- external: Xa(e, n)
1158
- };
1159
- }
1160
- function Dt(e) {
1161
- function o(y, g, I) {
1162
- if (y.measureText(g).width <= I) return g;
1163
- const T = "…";
1164
- let B = 0, v = g.length;
1165
- for (; B < v; ) {
1166
- const f = Math.floor((B + v) / 2), k = g.slice(0, f) + T;
1167
- y.measureText(k).width <= I ? B = f + 1 : v = f;
1168
- }
1169
- return g.slice(0, B - 1) + T;
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 T = this;
1205
- T && typeof T.getLabelForValue == "function" && (I = T.getLabelForValue(y)), I = s(I);
1206
- const B = T == null ? void 0 : T.chart, v = T == null ? void 0 : T.ctx, f = B.height * 0.25;
1207
- if (v && f > 0) {
1208
- v.save();
1209
- const L = v.measureText(I).width > f ? o(v, I, f) : I;
1210
- return v.restore(), L;
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)), T = !isNaN(Number(I));
1229
- y.options.ticks.minRotation = T || 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 T = this;
1253
- T && typeof T.getLabelForValue == "function" && (I = T.getLabelForValue(y)), I = s(I);
1254
- const B = T == null ? void 0 : T.chart, v = T == null ? void 0 : T.ctx, f = B.width * 0.4;
1255
- if (v && f > 0) {
1256
- v.save();
1257
- const L = v.measureText(I).width > f ? o(v, I, f) : I;
1258
- return v.restore(), L;
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
- })), C = 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 T;
1284
- const g = e.legendColor ?? "#6b6b6b", I = ((T = y == null ? void 0 : y.data) == null ? void 0 : T.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, k) => {
1289
- const L = B.backgroundColor[k];
1290
- return {
1291
- text: f,
1292
- fontColor: g,
1293
- color: g,
1294
- fillStyle: L,
1295
- strokeStyle: L,
1296
- datasetIndex: 0,
1297
- index: k,
1298
- hidden: y.getDataVisibility ? !y.getDataVisibility(k) : !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: C, 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, Ht = /* @__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 } = ut(), i = D(null), l = D(Gn), h = D(!1), c = m({
1334
- get: () => t.modelValue,
1335
- set: (u) => o("update:modelValue", u)
1336
- }), C = 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 T() {
1360
- return typeof window > "u" ? Gn : Math.floor(window.innerWidth * 0.94);
1361
- }
1362
- function B(u) {
1363
- const M = T(), 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", k), document.removeEventListener("pointerup", f), document.removeEventListener("pointercancel", f);
1371
- }
1372
- function k(u) {
1373
- h.value && v(u.clientX);
1374
- }
1375
- function L(u) {
1376
- c.value && (h.value = !0, v(u.clientX), document.addEventListener("pointermove", k), document.addEventListener("pointerup", f), document.addEventListener("pointercancel", f));
1377
- }
1378
- function x() {
1379
- l.value = B(l.value);
1380
- }
1381
- function A(u) {
1382
- var q;
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"]') || (q = i.value) != null && q.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", A, !0), document.addEventListener("keydown", w), window.addEventListener("resize", x);
1396
- }), Qn(() => {
1397
- f(), document.removeEventListener("pointerdown", A, !0), document.removeEventListener("keydown", w), window.removeEventListener("resize", x);
1398
- }), (u, M) => {
1399
- const W = pe("FmButton");
1400
- return Y(), ge(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: Le(() => [
1409
- c.value ? (Y(), fe("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: De(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: en(L, ["prevent"])
1422
- }, null, 32),
1423
- Q("div", ja, [
1424
- Q("div", Ja, Pe(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), fe(Ve, null, zt(C.value, (q, ee) => (Y(), fe("div", {
1440
- key: `${q.title || "section"}-${ee}`,
1441
- class: "flex flex-col gap-2 rounded-2xl bg-fm-color-neutral-white/45 py-3"
1442
- }, [
1443
- q.title ? (Y(), fe("p", Qa, Pe(q.title), 1)) : be("", !0),
1444
- (Y(!0), fe(Ve, null, zt(q.values, (G, ie) => (Y(), fe("button", {
1445
- key: `${G.text}-${ie}`,
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: Ie([
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: De({ backgroundColor: G.color })
1460
- }, null, 6),
1461
- Q("span", nr, Pe(F(G)), 1)
1462
- ]),
1463
- Q("span", or, Pe($(G)), 1)
1464
- ], 40, er))), 128))
1465
- ]))), 128))
1466
- ], 32)
1467
- ], 12, Ga)
1468
- ])) : be("", !0)
1469
- ]),
1470
- _: 1
1471
- });
1472
- };
1473
- }
1474
- });
1475
- function Wt(e, n) {
1476
- const { t } = ut(), 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, tn(l()), i.value = null);
1482
- }
1483
- function c(F, y) {
1484
- s.value = F, i.value = y ?? l(), o.value = !0;
1485
- }
1486
- function C(F) {
1487
- tn(l(), F.focusTarget);
1488
- }
1489
- function N() {
1490
- tn(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: C,
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
- position: {},
1519
- textColor: {},
1520
- fontSize: {},
1521
- legendUpdateKey: {},
1522
- hiddenDatasetKeys: {},
1523
- hiddenDataPointIndexes: {},
1524
- chartColorBinding: {},
1525
- chartColors: {},
1526
- chartBreakdownColors: {},
1527
- chartUseSecondaryMetricShades: { type: Boolean },
1528
- metricCount: {},
1529
- usePointStyle: { type: Boolean }
1530
- },
1531
- emits: ["toggleDatasetVisibility", "toggleDataPointVisibility"],
1532
- setup(e, { emit: n }) {
1533
- const t = e, o = n, { t: s } = ut(), i = D([]), l = D(0), h = D(!1), c = D(!1), C = D(0), N = D(null), $ = D(null), F = D(null), y = D(null), g = D(!1), I = D(0), T = D(0), B = D(!1), v = D(0), f = D(0), k = m(() => t.enabled !== !1), L = m(() => t.position === "left" || t.position === "right");
1534
- let x = null;
1535
- const A = 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, T.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
- q({ height: a, width: 0 });
1543
- }
1544
- function q({ height: a, width: p }) {
1545
- var b;
1546
- const d = (b = t.chartRef) == null ? void 0 : b.$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 ee() {
1550
- x != null && (window.clearTimeout(x), x = null);
1551
- }
1552
- function G() {
1553
- const a = ho(
1554
- t.chartRef
1555
- );
1556
- if (a)
1557
- return a;
1558
- const p = N.value, d = [p == null ? void 0 : p.parentElement, p == null ? void 0 : p.closest(".h-full"), p];
1559
- for (const b of d) {
1560
- if (!(b instanceof HTMLElement))
1561
- continue;
1562
- const H = b.querySelector("canvas");
1563
- if (!(H instanceof HTMLCanvasElement))
1564
- continue;
1565
- const U = pn.getChart(H);
1566
- if (U)
1567
- return U;
1568
- }
1569
- return null;
1570
- }
1571
- function ie() {
1572
- J();
1573
- }
1574
- function J() {
1575
- var b;
1576
- const a = (b = N.value) == null ? void 0 : b.getBoundingClientRect(), p = Number((a == null ? void 0 : a.height) ?? 0), d = Number((a == null ? void 0 : a.width) ?? 0);
1577
- if (Number.isFinite(p) && p >= 0) {
1578
- q({
1579
- height: L.value ? 0 : p,
1580
- width: L.value && Number.isFinite(d) && d >= 0 ? d : 0
1581
- });
1582
- return;
1583
- }
1584
- q({ height: 0, width: 0 });
1585
- }
1586
- function _() {
1587
- const a = F.value;
1588
- if (!a) {
1589
- g.value = !1, I.value = 0, T.value = 0;
1590
- return;
1591
- }
1592
- const p = a.clientHeight, d = a.scrollHeight, b = a.scrollTop, H = d > p + 1;
1593
- if (g.value = H, !H || p <= 0) {
1594
- I.value = 0, T.value = 0;
1595
- return;
1596
- }
1597
- const U = p, j = Math.max(18, Math.round(p / d * U)), te = Math.max(0, U - j), O = Math.max(1, d - p), de = Math.round(b / O * te);
1598
- I.value = j, T.value = de;
1599
- }
1600
- function E() {
1601
- _();
1602
- }
1603
- function z(a) {
1604
- const p = F.value, d = $.value;
1605
- if (!p || !d || !g.value)
1606
- return;
1607
- const b = d.getBoundingClientRect(), H = a.clientY - b.top, U = Math.max(0, H - I.value / 2), j = Math.max(1, p.clientHeight - I.value), te = Math.min(1, U / j), O = Math.max(0, p.scrollHeight - p.clientHeight);
1608
- p.scrollTop = te * O, _();
1609
- }
1610
- function R(a) {
1611
- g.value && (B.value = !0, v.value = a.clientY, f.value = T.value);
1612
- }
1613
- function P(a) {
1614
- if (!B.value)
1615
- return;
1616
- const p = F.value;
1617
- if (!p)
1618
- return;
1619
- const d = a.clientY - v.value, b = Math.max(1, p.clientHeight - I.value), U = Math.min(b, Math.max(0, f.value + d)) / b, j = Math.max(0, p.scrollHeight - p.clientHeight);
1620
- p.scrollTop = U * j, _();
1621
- }
1622
- function V() {
1623
- B.value && (B.value = !1);
1624
- }
1625
- function ne() {
1626
- var p;
1627
- const a = [(p = t.chartRef) == null ? void 0 : p.$el, N.value];
1628
- for (const d of a) {
1629
- if (!(d instanceof HTMLElement))
1630
- continue;
1631
- const b = d.closest('[class*="fm-card"]');
1632
- if (b)
1633
- return b;
1634
- }
1635
- for (const d of a) {
1636
- if (!(d instanceof HTMLElement))
1637
- continue;
1638
- const b = d.closest(".h-full") ?? d.parentElement;
1639
- if (b)
1640
- return b;
1641
- }
1642
- return null;
1643
- }
1644
- function K() {
1645
- var d, b, H, U;
1646
- const a = (b = (d = N.value) == null ? void 0 : d.closest(".chart-layout")) == null ? void 0 : b.parentElement;
1647
- if (a instanceof HTMLElement)
1648
- return a;
1649
- const p = (H = t.chartRef) == null ? void 0 : H.$el;
1650
- if (p instanceof HTMLElement) {
1651
- const j = (U = p.closest(".chart-layout")) == null ? void 0 : U.parentElement;
1652
- if (j instanceof HTMLElement)
1653
- return j;
1654
- }
1655
- return null;
1656
- }
1657
- function X() {
1658
- var d, b, H, U;
1659
- const a = ((d = N.value) == null ? void 0 : d.closest(".chart-layout")) ?? ((U = (H = (b = t.chartRef) == null ? void 0 : b.$el) == null ? void 0 : H.closest) == null ? void 0 : U.call(H, ".chart-layout")) ?? null;
1660
- if (!(a instanceof HTMLElement))
1661
- return null;
1662
- const p = Number(a.getBoundingClientRect().width);
1663
- return Number.isFinite(p) && p > 0 ? p : null;
1664
- }
1665
- function Z() {
1666
- const a = K();
1667
- if (a) {
1668
- const j = Number(a.getBoundingClientRect().height);
1669
- if (Number.isFinite(j) && j > 0)
1670
- return j;
1671
- }
1672
- const p = ne();
1673
- if (!p)
1674
- return null;
1675
- const d = window.getComputedStyle(p), b = parseFloat(d.paddingTop) || 0, H = parseFloat(d.paddingBottom) || 0, U = p.getBoundingClientRect().height - b - H;
1676
- return Number.isFinite(U) && U > 0 ? U : null;
1677
- }
1678
- function le() {
1679
- const a = K();
1680
- if (a) {
1681
- const j = Number(a.getBoundingClientRect().width);
1682
- if (Number.isFinite(j) && j > 0)
1683
- return j;
1684
- }
1685
- const p = ne();
1686
- if (!p)
1687
- return null;
1688
- const d = window.getComputedStyle(p), b = parseFloat(d.paddingLeft) || 0, H = parseFloat(d.paddingRight) || 0, U = p.getBoundingClientRect().width - b - H;
1689
- return Number.isFinite(U) && U > 0 ? U : null;
1690
- }
1691
- function ue() {
1692
- const a = G(), p = Number(a == null ? void 0 : a.height), d = Z();
1693
- if (L.value)
1694
- return Number.isFinite(p) && p > 0 ? Math.max(0, Math.floor(p - Jn)) : d != null ? Math.max(0, Math.floor(d - Jn)) : 120;
1695
- if (d != null) {
1696
- const b = d * 0.3, H = d - ur, U = Math.min(b, H);
1697
- return Math.max(0, Math.floor(U));
1698
- }
1699
- return Number.isFinite(p) && p > 0 ? Math.max(0, Math.floor(p * 0.3)) : 120;
1700
- }
1701
- function me() {
1702
- var U;
1703
- if (L.value) {
1704
- const j = le();
1705
- if (j != null)
1706
- return Math.max(0, Math.floor(j * 0.3));
1707
- const te = G(), O = Number(te == null ? void 0 : te.width);
1708
- return Number.isFinite(O) && O > 0 ? Math.max(0, Math.floor(O * 0.3)) : 180;
1709
- }
1710
- const a = X();
1711
- if (a != null)
1712
- return Math.max(0, Math.floor(a * 0.3));
1713
- const p = G(), d = Number(p == null ? void 0 : p.width), b = Number(((U = N.value) == null ? void 0 : U.getBoundingClientRect().width) ?? 0);
1714
- if (Number.isFinite(d) && d > 0) {
1715
- const j = d + (Number.isFinite(b) ? b : 0);
1716
- return Math.max(0, Math.floor(j * 0.3));
1717
- }
1718
- const H = le();
1719
- return H != null ? Math.max(0, Math.floor(H * 0.3)) : 180;
1720
- }
1721
- function se(a, p) {
1722
- const d = t.chartColorBinding;
1723
- if (d) {
1724
- const U = 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));
1725
- if (d === _e.breakdown) {
1726
- const O = wt({
1727
- fallbackIndex: U,
1728
- metricCount: j
1729
- }), de = Fe({
1730
- datasetIndex: U,
1731
- metricCount: j,
1732
- mode: _e.metric
1733
- });
1734
- return Tt({
1735
- breakdownIndex: O,
1736
- metricIndex: de,
1737
- metricCount: j,
1738
- breakdownColors: t.chartBreakdownColors,
1739
- useSecondaryMetricShades: t.chartUseSecondaryMetricShades,
1740
- customColors: t.chartColors
1741
- });
1742
- }
1743
- if (d === _e.metric) {
1744
- const O = Fe({
1745
- datasetIndex: U,
1746
- metricCount: j,
1747
- mode: _e.metric
1748
- });
1749
- return tt({ index: O, customColors: t.chartColors });
1750
- }
1751
- const te = typeof a.index == "number" ? a.index : U;
1752
- return tt({ index: te, customColors: t.chartColors });
1753
- }
1754
- const b = a;
1755
- return ce(a.fillStyle) || ce(a.strokeStyle) || ce(b.color) || "#9ca3af";
1756
- }
1757
- function ce(a) {
1758
- 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) ?? "" : "";
1759
- }
1760
- function xe(a) {
1761
- return Array.isArray(t.hiddenDataPointIndexes) ? t.hiddenDataPointIndexes.includes(a) : !1;
1762
- }
1763
- function Be(a) {
1764
- return Array.isArray(a) ? a : [];
1765
- }
1766
- function He(a) {
1767
- if (a.length <= 1)
1768
- return a;
1769
- const p = Number.isInteger(t.metricCount) && Number(t.metricCount) > 0 ? Number(t.metricCount) : 1;
1770
- return [...a.map((b, H) => {
1771
- const U = typeof b.datasetIndex == "number" ? b.datasetIndex : H, j = wt({
1772
- fallbackIndex: U,
1773
- metricCount: p
1774
- });
1775
- return {
1776
- item: b,
1777
- originalIndex: H,
1778
- breakdownIndex: j
1779
- };
1780
- })].sort((b, H) => b.breakdownIndex !== H.breakdownIndex ? b.breakdownIndex - H.breakdownIndex : b.originalIndex - H.originalIndex).map((b) => b.item);
1781
- }
1782
- function We(a) {
1783
- if (a.length <= 1)
1784
- return a;
1785
- const p = /* @__PURE__ */ new Map(), d = [];
1786
- for (const b of a) {
1787
- const H = typeof b.index == "number", U = b.datasetIndex, j = typeof U == "number" && !H, te = typeof b.text == "string" ? b.text.trim() : "";
1788
- if (!j || !te) {
1789
- d.push(b);
1790
- continue;
1791
- }
1792
- const O = te.toLowerCase(), de = p.get(O);
1793
- if (de == null) {
1794
- d.push({
1795
- ...b,
1796
- datasetIndexes: [U],
1797
- datasetKeys: typeof b.datasetKey == "string" && b.datasetKey.trim().length > 0 ? [b.datasetKey] : []
1798
- }), p.set(O, d.length - 1);
1799
- continue;
1800
- }
1801
- const ye = d[de];
1802
- if (!ye)
1803
- continue;
1804
- const Ce = new Set(
1805
- Array.isArray(ye.datasetIndexes) ? ye.datasetIndexes : typeof ye.datasetIndex == "number" ? [ye.datasetIndex] : []
1806
- );
1807
- Ce.add(U);
1808
- const re = new Set(
1809
- Array.isArray(ye.datasetKeys) ? ye.datasetKeys : typeof ye.datasetKey == "string" && ye.datasetKey.trim().length > 0 ? [ye.datasetKey] : []
1810
- );
1811
- typeof b.datasetKey == "string" && b.datasetKey.trim().length > 0 && re.add(b.datasetKey), d[de] = {
1812
- ...ye,
1813
- datasetIndexes: Array.from(Ce).sort((ae, Se) => ae - Se),
1814
- datasetKeys: Array.from(re),
1815
- hidden: ye.hidden === !0 && b.hidden === !0
1816
- };
1817
- }
1818
- return d;
1819
- }
1820
- function Ye(a) {
1821
- var O, de, ye, Ce, re, ae;
1822
- const p = a == null ? void 0 : a.legend;
1823
- if (typeof (p == null ? void 0 : p.buildLabels) == "function")
1824
- try {
1825
- p.buildLabels();
1826
- } catch {
1827
- }
1828
- const d = Be(p == null ? void 0 : p.legendItems);
1829
- if (d.length > 0)
1830
- return d;
1831
- const b = (de = (O = a == null ? void 0 : a.options) == null ? void 0 : O.plugins) == null ? void 0 : de.legend, H = b == null ? void 0 : b.labels, U = H == null ? void 0 : H.generateLabels, j = (ae = (re = (Ce = (ye = pn.defaults) == null ? void 0 : ye.plugins) == null ? void 0 : Ce.legend) == null ? void 0 : re.labels) == null ? void 0 : ae.generateLabels;
1832
- let te = Be(
1833
- typeof U == "function" ? U(a) : []
1834
- );
1835
- return te.length === 0 && typeof j == "function" && (te = Be(j(a))), typeof (H == null ? void 0 : H.filter) == "function" && (te = te.filter((Se) => H.filter(Se, a.data))), typeof (H == null ? void 0 : H.sort) == "function" && (te = [...te].sort((Se, Ae) => H.sort(Se, Ae, a.data))), (b == null ? void 0 : b.reverse) === !0 && (te = [...te].reverse()), te;
1836
- }
1837
- function ct(a) {
1838
- var d;
1839
- return (Array.isArray((d = a == null ? void 0 : a.data) == null ? void 0 : d.datasets) ? a.data.datasets : []).map((b, H) => {
1840
- const U = ce((b == null ? void 0 : b.borderColor) ?? (b == null ? void 0 : b.backgroundColor)), j = yt({
1841
- datasetIndex: H,
1842
- label: b == null ? void 0 : b.label
1843
- });
1844
- return {
1845
- text: ot(b == null ? void 0 : b.label),
1846
- fillStyle: U,
1847
- strokeStyle: U,
1848
- datasetIndex: H,
1849
- datasetKey: j,
1850
- hidden: Array.isArray(t.hiddenDatasetKeys) ? t.hiddenDatasetKeys.includes(j) : typeof a.isDatasetVisible == "function" ? !a.isDatasetVisible(H) : !1
1851
- };
1852
- });
1853
- }
1854
- function ot(a, p) {
1855
- return a == null ? "" : String(a).trim();
1856
- }
1857
- function Ge(a, p) {
1858
- if (!Array.isArray(a) || a.length === 0)
1859
- return [];
1860
- const d = a, b = d[0], H = Array.isArray(b == null ? void 0 : b.labels) ? b.labels : [], U = Array.isArray(p == null ? void 0 : p.metrics) ? p.metrics : [], j = H.length > 0 ? H : U, te = b == null ? void 0 : b.backgroundColor;
1861
- return d.length === 1 && Array.isArray(te) && te.length > 1 ? te.map((O, de) => ({
1862
- text: j[de] == null || String(j[de]).trim().length === 0 ? `Series ${de + 1}` : String(j[de]),
1863
- fillStyle: ce(O),
1864
- strokeStyle: ce(O),
1865
- datasetIndex: 0,
1866
- index: de,
1867
- hidden: xe(de)
1868
- })) : d.map((O, de) => ({
1869
- datasetKey: yt({
1870
- datasetIndex: de,
1871
- label: O == null ? void 0 : O.label
1872
- }),
1873
- text: ot(O == null ? void 0 : O.label),
1874
- fillStyle: ce(
1875
- (O == null ? void 0 : O.color) ?? (O == null ? void 0 : O.borderColor) ?? (O == null ? void 0 : O.backgroundColor) ?? (O == null ? void 0 : O.pointBackgroundColor)
1876
- ),
1877
- strokeStyle: ce(
1878
- (O == null ? void 0 : O.color) ?? (O == null ? void 0 : O.borderColor) ?? (O == null ? void 0 : O.backgroundColor) ?? (O == null ? void 0 : O.pointBorderColor)
1879
- ),
1880
- datasetIndex: de,
1881
- hidden: Array.isArray(t.hiddenDatasetKeys) ? t.hiddenDatasetKeys.includes(
1882
- yt({
1883
- datasetIndex: de,
1884
- label: O == null ? void 0 : O.label
1885
- })
1886
- ) : !!(O != null && O.hidden)
1887
- }));
1888
- }
1889
- function Ot() {
1890
- var p;
1891
- const a = (p = t.chartRef) == null ? void 0 : p.datasets;
1892
- return Array.isArray(a) ? a : [];
1893
- }
1894
- function je(a, p) {
1895
- 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}`;
1896
- }
1897
- function Ut() {
1898
- const a = y.value;
1899
- return a ? Math.ceil(a.getBoundingClientRect().width) : 0;
1900
- }
1901
- function Kt() {
1902
- const a = y.value;
1903
- return a ? Math.ceil(a.getBoundingClientRect().height) : 0;
1904
- }
1905
- function qt(a, p) {
1906
- var Ce;
1907
- const d = F.value;
1908
- if (!d || a.length === 0)
1909
- return 0;
1910
- const b = Math.max(0, p - jn), H = window.getComputedStyle(d);
1911
- if (H.flexDirection.startsWith("column")) {
1912
- const re = Number.parseFloat(H.rowGap || H.gap || "0") || 0, ae = Kt();
1913
- let Se = 0, Ae = 0;
1914
- for (let Oe = 0; Oe < a.length; Oe += 1) {
1915
- const Ue = a[Oe];
1916
- if (!Ue)
1917
- continue;
1918
- const Qe = Se + (Ae > 0 ? re : 0) + Ue.offsetHeight, rt = a.length - (Oe + 1) > 0 ? re + ae : 0;
1919
- if (Qe + rt > b)
1920
- break;
1921
- Se = Qe, Ae += 1;
1922
- }
1923
- return Ae > 0 ? Ae : 1;
1924
- }
1925
- const j = ((Ce = a[0]) == null ? void 0 : Ce.offsetTop) ?? 0, te = a.filter(
1926
- (re) => re.offsetTop - j + re.offsetHeight <= b
1927
- );
1928
- if (te.length === 0)
1929
- return 0;
1930
- if (te.length >= a.length)
1931
- return te.length;
1932
- const O = Ut();
1933
- if (O <= 0)
1934
- return Math.max(1, te.length - 1);
1935
- const de = Number.parseFloat(H.columnGap || H.gap || "0") || 0, ye = d.clientWidth;
1936
- for (let re = te.length; re > 0; re -= 1) {
1937
- const ae = te.slice(0, re), Se = ae[ae.length - 1];
1938
- if (!Se)
1939
- continue;
1940
- if (Se.offsetLeft + Se.offsetWidth + de + O <= ye)
1941
- return re;
1942
- }
1943
- return 1;
1944
- }
1945
- function It() {
1946
- const a = F.value;
1947
- if (!a) {
1948
- c.value = !1, C.value = 0, l.value = 0, ie(), _();
1949
- return;
1950
- }
1951
- const p = Array.from(
1952
- a.querySelectorAll(".chart-legend-item[data-legend-data='true']")
1953
- );
1954
- if (p.length === 0) {
1955
- c.value = !1, C.value = 0, l.value = 0, ie(), _();
1956
- return;
1957
- }
1958
- const d = Array.from(new Set(p.map((re) => re.offsetTop))).sort((re, ae) => re - ae), b = !h.value && i.value.length > p.length, H = !h.value && !b, U = H || C.value <= 0 ? ue() : C.value;
1959
- if ((H || C.value <= 0) && (C.value = U), b) {
1960
- const re = ue();
1961
- if (re > 0 && (C.value = re), window.getComputedStyle(a).flexDirection.startsWith("column") && l.value < i.value.length) {
1962
- const Ae = Math.max(0, C.value - jn), Oe = a.scrollHeight;
1963
- if (Oe + 1 < Ae) {
1964
- const Ue = p.map((ke) => ke.offsetHeight).filter((ke) => Number.isFinite(ke) && ke > 0), Qe = Ue.length > 0 ? Ue.reduce((ke, rt) => ke + rt, 0) / Ue.length : 0;
1965
- if (Qe > 0) {
1966
- const ke = window.getComputedStyle(a), rt = Number.parseFloat(ke.rowGap || ke.gap || "0") || 0, jt = Math.max(1, Qe + rt), mt = Ae - Oe, Bt = Math.floor(mt / jt);
1967
- if (Bt > 0) {
1968
- l.value = Math.min(
1969
- i.value.length,
1970
- l.value + Bt
1971
- ), Je();
1972
- return;
1973
- }
1974
- }
1975
- }
1976
- }
1977
- c.value = !0, ie(), _();
1978
- return;
1979
- }
1980
- const j = d[0] ?? 0, te = d[d.length - 1] ?? j, O = p.filter((re) => re.offsetTop === te), de = Math.max(...O.map((re) => re.offsetHeight), 0), ye = Math.max(0, te - j + de), Ce = qt(p, U);
1981
- (H || l.value <= 0) && (l.value = Math.max(0, Ce)), c.value = ye > U, ie(), _();
1982
- }
1983
- function Je() {
1984
- Me(() => {
1985
- It(), window.requestAnimationFrame(() => {
1986
- It(), J(), _();
1987
- });
1988
- });
1989
- }
1990
- const Xt = m(() => {
1991
- const a = {
1992
- "--legend-text-color": u.value,
1993
- "--legend-font-size": `${M.value}px`
1994
- }, p = ue();
1995
- if (L.value) {
1996
- const d = me();
1997
- return {
1998
- ...a,
1999
- width: "fit-content",
2000
- maxWidth: `${d}px`,
2001
- maxHeight: `${p}px`,
2002
- minWidth: "0",
2003
- flex: "0 1 auto"
2004
- };
2005
- }
2006
- return {
2007
- ...a,
2008
- maxHeight: `${p}px`,
2009
- flex: "0 0 auto"
2010
- };
2011
- }), Yt = m(() => {
2012
- if (h.value || !c.value)
2013
- return i.value;
2014
- const a = Math.max(1, l.value), p = L.value ? a : Math.max(0, a - 1);
2015
- return i.value.slice(0, Math.min(p, i.value.length));
2016
- }), Mt = m(() => k.value ? c.value && h.value ? {
2017
- flex: "1 1 auto",
2018
- minHeight: "0",
2019
- overflowY: "auto"
2020
- } : c.value ? {
2021
- overflow: "hidden"
2022
- } : {} : {});
2023
- function dt() {
2024
- var b;
2025
- if (!k.value) {
2026
- i.value = [], l.value = 0, h.value = !1, c.value = !1, C.value = 0, q({ height: 0, width: 0 });
2027
- return;
2028
- }
2029
- l.value = 0, c.value = !1, C.value = 0;
2030
- const a = G();
2031
- if (!a) {
2032
- i.value = He(
2033
- Ge(t.legendUpdateKey, t.chartRef)
2034
- ), Je();
2035
- return;
2036
- }
2037
- try {
2038
- i.value = Ye(a);
2039
- } catch {
2040
- i.value = [];
2041
- }
2042
- const p = Array.isArray((b = a == null ? void 0 : a.data) == null ? void 0 : b.datasets) ? a.data.datasets : [];
2043
- i.value.length === 0 && (i.value = Ge(t.legendUpdateKey, t.chartRef)), i.value.length === 0 && (i.value = ct(a)), i.value = We(He(i.value));
2044
- const d = Array.isArray(t.legendUpdateKey) && t.legendUpdateKey.length > 0 || !Array.isArray(t.legendUpdateKey) && !!t.legendUpdateKey;
2045
- i.value.length === 0 && !(p.length > 0 || d) && W(0), Je();
2046
- }
2047
- function Ze(a) {
2048
- return Array.isArray(a.datasetIndexes) && a.datasetIndexes.length > 0 ? a.datasetIndexes.filter((p) => Number.isInteger(p)) : typeof a.datasetIndex == "number" ? [a.datasetIndex] : [];
2049
- }
2050
- function at(a, p) {
2051
- 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(
2052
- (d) => yt({
2053
- datasetIndex: d,
2054
- label: a.text
2055
- })
2056
- );
2057
- }
2058
- function ft(a, p) {
2059
- i.value = i.value.map(
2060
- (d) => a(d) ? {
2061
- ...d,
2062
- hidden: p
2063
- } : d
2064
- );
2065
- }
2066
- function Te(a, p, d) {
2067
- var H;
2068
- typeof a.setDatasetVisibility == "function" ? a.setDatasetVisibility(p, d) : d && typeof a.show == "function" ? a.show(p) : !d && typeof a.hide == "function" && a.hide(p);
2069
- const b = Array.isArray((H = a == null ? void 0 : a.data) == null ? void 0 : H.datasets) ? a.data.datasets[p] : null;
2070
- b && typeof b == "object" && (b.hidden = !d);
2071
- }
2072
- function ln(a, p) {
2073
- var j;
2074
- if (typeof a.toggleDataVisibility == "function") {
2075
- a.toggleDataVisibility(p);
2076
- return;
2077
- }
2078
- const d = Array.isArray((j = a == null ? void 0 : a.data) == null ? void 0 : j.datasets) ? a.data.datasets[0] : null, b = Array.isArray(d == null ? void 0 : d.data) ? d.data : [];
2079
- if (p < 0 || p >= b.length)
2080
- return;
2081
- const H = typeof a.getDatasetMeta == "function" ? a.getDatasetMeta(0) : null, U = Array.isArray(H == null ? void 0 : H.data) ? H.data[p] : null;
2082
- U && typeof U.hidden == "boolean" && (U.hidden = !U.hidden);
2083
- }
2084
- function Gt(a = 0) {
2085
- dt();
2086
- const p = G(), d = i.value.length > 0;
2087
- if (p || d || a >= dr) {
2088
- ee();
2089
- return;
2090
- }
2091
- ee(), x = window.setTimeout(() => {
2092
- Gt(a + 1);
2093
- }, cr);
2094
- }
2095
- function sn(a, p) {
2096
- var ye;
2097
- const d = G(), b = String(((ye = d == null ? void 0 : d.config) == null ? void 0 : ye.type) ?? ""), H = b === "pie" || b === "doughnut" || b === "polarArea", U = typeof a.index == "number" ? a.index : typeof p == "number" ? p : null;
2098
- if ((H || typeof a.index == "number") && typeof U == "number") {
2099
- if (Array.isArray(t.hiddenDataPointIndexes)) {
2100
- o("toggleDataPointVisibility", { itemIndex: U });
2101
- return;
2102
- }
2103
- d && (ln(d, U), d.update());
2104
- const Ce = d && typeof d.getDataVisibility == "function" ? !d.getDataVisibility(U) : a.hidden !== !0;
2105
- ft(
2106
- (re) => typeof re.index == "number" ? re.index === U : re.datasetIndex === a.datasetIndex && re.text === a.text,
2107
- Ce
2108
- );
2109
- return;
2110
- }
2111
- const te = Ze(a), O = at(a, te);
2112
- if (Array.isArray(t.hiddenDatasetKeys) && te.length > 0) {
2113
- te.forEach((Ce, re) => {
2114
- o("toggleDatasetVisibility", {
2115
- datasetIndex: Ce,
2116
- datasetKey: O[re] ?? yt({
2117
- datasetIndex: Ce,
2118
- label: a.text
2119
- })
2120
- });
2121
- });
2122
- return;
2123
- }
2124
- const de = Ot();
2125
- if (!d) {
2126
- if (te.length > 0) {
2127
- const Ce = a.hidden !== !0;
2128
- te.forEach((re) => {
2129
- const ae = de[re];
2130
- ae && typeof ae == "object" && (ae.hidden = Ce);
2131
- }), ft(
2132
- (re) => je(re, 0) === je(a, 0),
2133
- Ce
2134
- );
2135
- }
2136
- return;
2137
- }
2138
- if (te.length > 0) {
2139
- const re = !te.every(
2140
- (ae) => typeof d.isDatasetVisible == "function" ? d.isDatasetVisible(ae) : a.hidden !== !0
2141
- );
2142
- te.forEach((ae) => {
2143
- Te(d, ae, re);
2144
- const Se = de[ae];
2145
- Se && typeof Se == "object" && (Se.hidden = !re);
2146
- }), d.update(), ft(
2147
- (ae) => je(ae, 0) === je(a, 0),
2148
- !re
2149
- );
2150
- }
2151
- }
2152
- function un() {
2153
- h.value = !0, Je();
2154
- }
2155
- function ht() {
2156
- h.value = !1, F.value && (F.value.scrollTop = 0), Je();
2157
- }
2158
- return $e(() => {
2159
- Gt(), window.addEventListener("mousemove", P), window.addEventListener("mouseup", V);
2160
- }), we(
2161
- () => [
2162
- t.enabled,
2163
- t.legendUpdateKey,
2164
- t.hiddenDatasetKeys,
2165
- t.hiddenDataPointIndexes
2166
- ],
2167
- () => {
2168
- dt();
2169
- }
2170
- ), Qn(() => {
2171
- B.value = !1, ee(), q({ height: 0, width: 0 }), window.removeEventListener("mousemove", P), window.removeEventListener("mouseup", V);
2172
- }), (a, p) => k.value ? (Y(), fe("div", {
2173
- key: 0,
2174
- ref_key: "legendPanelRef",
2175
- ref: N,
2176
- class: Ie(["chart-legend-panel relative z-[2] flex min-w-0 flex-col overflow-hidden pointer-events-auto", {
2177
- "self-stretch h-full pt-2": L.value,
2178
- "mb-2": !L.value && a.position === "top",
2179
- "mt-2": !L.value && a.position === "bottom"
2180
- }]),
2181
- style: De(Xt.value)
2182
- }, [
2183
- Q("div", {
2184
- ref_key: "legendScrollShellRef",
2185
- ref: $,
2186
- class: "relative z-[2] flex flex-1 min-h-0 flex-col overflow-hidden"
2187
- }, [
2188
- Q("div", {
2189
- ref_key: "legendToggleMeasureRef",
2190
- ref: y,
2191
- class: "absolute invisible pointer-events-none left-0 top-0 z-[2] inline-flex max-w-full select-none"
2192
- }, [
2193
- Q("button", rr, Pe(r(s)("report.widget.legend.viewMore")), 1)
2194
- ], 512),
2195
- Q("ul", {
2196
- ref_key: "legendListRef",
2197
- ref: F,
2198
- class: Ie(["chart-legend-list m-0 flex list-none p-0", [
2199
- L.value ? "flex-row flex-wrap justify-start gap-x-3 gap-y-2 pt-1" : "flex-wrap justify-center gap-x-2 gap-y-1 pt-1"
2200
- ]]),
2201
- style: De(Mt.value),
2202
- onScroll: E
2203
- }, [
2204
- (Y(!0), fe(Ve, null, zt(Yt.value, (d, b) => (Y(), fe("li", {
2205
- key: je(d, b),
2206
- class: Ie(["chart-legend-item relative z-[2] inline-flex max-w-full cursor-pointer select-none pointer-events-auto", {
2207
- "opacity-45": d.hidden
2208
- }]),
2209
- "data-legend-data": "true"
2210
- }, [
2211
- Q("button", {
2212
- type: "button",
2213
- class: Ie(["inline-flex max-w-full items-center gap-1.5 border-none bg-transparent p-0", { "justify-start text-left": L.value }]),
2214
- "aria-pressed": d.hidden === !0 ? "false" : "true",
2215
- onClick: en((H) => sn(d, b), ["stop"])
2216
- }, [
2217
- t.usePointStyle !== !1 ? (Y(), fe("span", {
2218
- key: 0,
2219
- class: "h-5 w-5 shrink-0 rounded-full",
2220
- style: De({ backgroundColor: se(d, b) })
2221
- }, null, 4)) : (Y(), fe("span", {
2222
- key: 1,
2223
- class: "h-5 w-5 shrink-0 rounded-sm border border-solid border-gray-300",
2224
- style: De({
2225
- backgroundColor: se(d, b),
2226
- borderColor: "#c7c7cc"
2227
- })
2228
- }, null, 4)),
2229
- Q("span", {
2230
- class: Ie(["chart-legend-text leading-[1.4]", {
2231
- "max-w-[120px] whitespace-nowrap overflow-hidden text-left": L.value,
2232
- "whitespace-nowrap overflow-hidden": !L.value,
2233
- "line-through": d.hidden
2234
- }]),
2235
- title: d.text ?? ""
2236
- }, Pe(d.text), 11, sr)
2237
- ], 10, lr)
2238
- ], 2))), 128)),
2239
- c.value ? (Y(), fe("li", ir, [
2240
- Q("button", {
2241
- type: "button",
2242
- 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",
2243
- style: { fontSize: "var(--legend-font-size)" },
2244
- onClick: p[0] || (p[0] = en((d) => h.value ? ht() : un(), ["stop"]))
2245
- }, Pe(h.value ? r(s)("report.widget.legend.viewLess") : r(s)("report.widget.legend.viewMore")), 1)
2246
- ])) : be("", !0)
2247
- ], 38),
2248
- A.value ? (Y(), fe("div", {
2249
- key: 0,
2250
- class: "absolute top-0 right-0 h-full w-2 rounded-full bg-transparent",
2251
- onMousedown: z
2252
- }, [
2253
- Q("div", {
2254
- class: "absolute left-0 w-full rounded-full bg-gray-500/60 cursor-pointer hover:bg-gray-500/85",
2255
- style: De(w.value),
2256
- onMousedown: en(R, ["stop"])
2257
- }, null, 36)
2258
- ], 32)) : be("", !0)
2259
- ], 512)
2260
- ], 6)) : be("", !0);
2261
- }
2262
- }), ze = /* @__PURE__ */ oo(fr, [["__scopeId", "data-v-67e9d60c"]]);
2263
- function Et(e) {
2264
- const n = D([]), t = m(() => new Set(n.value));
2265
- function o(l, h) {
2266
- return yt({
2267
- datasetIndex: h,
2268
- label: l == null ? void 0 : l.label
2269
- });
2270
- }
2271
- function s(l, h) {
2272
- return t.value.has(o(l, h));
2273
- }
2274
- function i({ datasetIndex: l, datasetKey: h }) {
2275
- const c = h ?? o(e.value[l], l);
2276
- if (t.value.has(c)) {
2277
- n.value = n.value.filter((C) => C !== c);
2278
- return;
2279
- }
2280
- n.value = [...n.value, c];
2281
- }
2282
- return we(
2283
- e,
2284
- (l) => {
2285
- const h = new Set(
2286
- l.map((C, N) => o(C, N))
2287
- ), c = n.value.filter((C) => h.has(C));
2288
- c.length !== n.value.length && (n.value = c);
2289
- },
2290
- { immediate: !0 }
2291
- ), {
2292
- hiddenDatasetKeys: n,
2293
- isDatasetHidden: s,
2294
- toggleDatasetVisibility: i
2295
- };
2296
- }
2297
- const hr = { class: "widget-content" }, mr = /* @__PURE__ */ Ne({
2298
- __name: "WidgetBarchart",
2299
- props: /* @__PURE__ */ Xe({
2300
- tileIndex: {}
2301
- }, {
2302
- modelValue: { required: !0 },
2303
- modelModifiers: {}
2304
- }),
2305
- emits: ["update:modelValue"],
2306
- setup(e) {
2307
- const n = e, t = Ee(e, "modelValue"), o = D(null), s = m(() => t.value.maxTooltipItems), {
2308
- isTooltipDetailsSheetOpen: i,
2309
- tooltipDetailsPayload: l,
2310
- tooltipOptions: h,
2311
- handleTooltipDetailsSheetVisibility: c,
2312
- handleTooltipDetailsHover: C,
2313
- handleTooltipDetailsLeave: N
2314
- } = Wt(o, {
2315
- maxTooltipItems: s
2316
- }), $ = m(() => {
2317
- var z;
2318
- return ((z = t.value.data) == null ? void 0 : z.datasets) ?? [];
2319
- }), F = m(() => {
2320
- var z;
2321
- return ((z = t.value.data) == null ? void 0 : z.xAxis) ?? [];
2322
- }), 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: T, yCfg: B, isTransposed: v, legend: f, chartWidth: k, chartHeight: L } = Dt(
2323
- t.value
2324
- ), x = m(
2325
- () => Lt(t.value.isTransposed === !0, h.value)
2326
- ), A = $t("bar"), w = m(() => {
2327
- const z = f.value.position;
2328
- return !z || z === "top" || z === "bottom" || z === "left" || z === "right";
2329
- }), u = m(() => f.value.position ?? "top"), M = m(
2330
- () => u.value === "left" || u.value === "right"
2331
- ), W = m(
2332
- () => u.value === "top" || u.value === "left"
2333
- ), q = m(() => $.value.length > 0 ? [
2334
- ...$.value.map((z, R) => {
2335
- const P = Fe({
2336
- datasetIndex: R,
2337
- isCompare: z.isCompare,
2338
- metricCount: t.value.metricCount,
2339
- mode: t.value.chartColorBinding
2340
- }), V = Fe({
2341
- datasetIndex: R,
2342
- isCompare: z.isCompare,
2343
- metricCount: t.value.metricCount,
2344
- mode: _e.metric
2345
- });
2346
- let ne = z.values;
2347
- y.value && (ne = $.value.map(
2348
- (le, ue) => ue === R ? z.values[0] : NaN
2349
- ));
2350
- const K = t.value.chartColorBinding === _e.breakdown, X = wt({
2351
- fallbackIndex: R,
2352
- metricCount: t.value.metricCount
2353
- }), Z = ne.map((le) => le === null ? NaN : Number(le));
2354
- return {
2355
- label: z.name,
2356
- data: Z,
2357
- dash: !!z.isCompare,
2358
- backgroundColor: K ? Tt({
2359
- breakdownIndex: X,
2360
- metricIndex: V,
2361
- metricCount: t.value.metricCount,
2362
- isCompare: z.isCompare,
2363
- breakdownColors: t.value.chartBreakdownColors,
2364
- useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
2365
- customColors: t.value.chartColors
2366
- }) : tt({
2367
- index: P,
2368
- isCompare: z.isCompare,
2369
- customColors: t.value.chartColors
2370
- })
2371
- };
2372
- })
2373
- ] : []), { hiddenDatasetKeys: ee, isDatasetHidden: G, toggleDatasetVisibility: ie } = Et(q), J = m(
2374
- () => q.value.map((z, R) => ({
2375
- ...z,
2376
- hidden: G(z, R)
2377
- }))
2378
- ), _ = kt();
2379
- function E() {
2380
- return _.extractChartSize(o.value, n.tileIndex) || { width: 0, height: 0 };
2381
- }
2382
- return $e(() => {
2383
- Me(() => {
2384
- E();
2385
- });
2386
- }), we([J], () => {
2387
- Me(() => E());
2388
- }), (z, R) => {
2389
- var V, ne, K, X, Z, le;
2390
- const P = pe("FmBarChart");
2391
- return Y(), fe(Ve, null, [
2392
- Q("div", hr, [
2393
- nt(z.$slots, "menu"),
2394
- Q("div", {
2395
- class: Ie(["chart-layout", {
2396
- "chart-layout--side": w.value && (r(f).display ?? !1) && M.value
2397
- }])
2398
- }, [
2399
- w.value && (r(f).display ?? !1) && W.value ? (Y(), ge(ze, {
2400
- key: 0,
2401
- "chart-ref": o.value,
2402
- enabled: r(f).display ?? !1,
2403
- position: u.value,
2404
- "max-width": r(f).maxWidth,
2405
- "text-color": (V = r(f).labels) == null ? void 0 : V.color,
2406
- "font-size": (K = (ne = r(f).labels) == null ? void 0 : ne.font) == null ? void 0 : K.size,
2407
- "legend-update-key": J.value,
2408
- "use-point-style": t.value.usePointStyle ?? !0,
2409
- "chart-color-binding": t.value.chartColorBinding,
2410
- "chart-colors": t.value.chartColors,
2411
- "chart-breakdown-colors": t.value.chartBreakdownColors,
2412
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2413
- "metric-count": t.value.metricCount,
2414
- "hidden-dataset-keys": r(ee),
2415
- onToggleDatasetVisibility: r(ie)
2416
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0),
2417
- he(P, {
2418
- ref_key: "chartRef",
2419
- ref: o,
2420
- class: "bar-chart",
2421
- datasets: J.value,
2422
- "x-axis": { categories: g.value },
2423
- "x-cfg": r(T),
2424
- "y-cfg": r(B),
2425
- transpose: r(v),
2426
- legend: {
2427
- display: !1
2428
- },
2429
- tooltip: x.value,
2430
- datalabels: r(I),
2431
- plugins: [r(A)],
2432
- "maintain-aspect-ratio": !1,
2433
- style: De({
2434
- "--chart-width": w.value && (r(f).display ?? !1) && M.value ? "calc(100% - var(--legend-panel-width, 0px))" : r(k) !== void 0 ? r(k) + "px" : "100%",
2435
- "--chart-height": w.value && (r(f).display ?? !1) && !M.value ? "calc(100% - 36px - var(--legend-panel-height, 0px))" : r(L) !== void 0 ? r(L) + "px" : "100%"
2436
- })
2437
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "tooltip", "datalabels", "plugins", "style"]),
2438
- w.value && (r(f).display ?? !1) && !W.value ? (Y(), ge(ze, {
2439
- key: 1,
2440
- "chart-ref": o.value,
2441
- enabled: r(f).display ?? !1,
2442
- position: u.value,
2443
- "max-width": r(f).maxWidth,
2444
- "text-color": (X = r(f).labels) == null ? void 0 : X.color,
2445
- "font-size": (le = (Z = r(f).labels) == null ? void 0 : Z.font) == null ? void 0 : le.size,
2446
- "legend-update-key": J.value,
2447
- "use-point-style": t.value.usePointStyle ?? !0,
2448
- "chart-color-binding": t.value.chartColorBinding,
2449
- "chart-colors": t.value.chartColors,
2450
- "chart-breakdown-colors": t.value.chartBreakdownColors,
2451
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2452
- "metric-count": t.value.metricCount,
2453
- "hidden-dataset-keys": r(ee),
2454
- onToggleDatasetVisibility: r(ie)
2455
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0)
2456
- ], 2)
2457
- ]),
2458
- he(Ht, {
2459
- "model-value": r(i),
2460
- "details-payload": r(l),
2461
- "onUpdate:modelValue": r(c),
2462
- onValueHover: r(C),
2463
- onValueLeave: r(N)
2464
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
2465
- ], 64);
2466
- };
2467
- }
2468
- }), pr = { class: "widget-content" }, vr = /* @__PURE__ */ Ne({
2469
- __name: "WidgetCircular",
2470
- props: /* @__PURE__ */ Xe({
2471
- tileIndex: {}
2472
- }, {
2473
- modelValue: { required: !0 },
2474
- modelModifiers: {}
2475
- }),
2476
- emits: ["update:modelValue"],
2477
- setup(e) {
2478
- const n = e, t = Ee(e, "modelValue"), { breakpoints: o } = rn(), s = D(null), i = D([]), { datalabels: l, legend: h, chartWidth: c, chartHeight: C } = Dt(t.value), N = m(() => {
2479
- const u = Array.isArray(t.value.data.datasets) ? t.value.data.datasets.map((M) => M.name) : [];
2480
- return u.length > 0 ? u : Array.isArray(t.value.data.metrics) ? t.value.data.metrics.map((M) => String(M)) : [];
2481
- }), $ = m(() => {
2482
- let u = [];
2483
- return Array.isArray(t.value.data.datasets) && t.value.data.datasets.length > 0 && (u = [
2484
- {
2485
- label: N.value[0] ?? (Array.isArray(t.value.data.metrics) && t.value.data.metrics.length > 0 ? String(t.value.data.metrics[0]) : "Series"),
2486
- labels: N.value,
2487
- data: t.value.data.datasets.map(
2488
- (W, q) => i.value.includes(q) ? null : W.value
2489
- ),
2490
- backgroundColor: t.value.data.datasets.map(
2491
- (W, q) => tt({ index: q, customColors: t.value.chartColors })
2492
- )
2493
- }
2494
- ]), u;
2495
- }), F = kt();
2496
- function y() {
2497
- return F.extractChartSize(s.value, n.tileIndex) || { width: 0, height: 0 };
2498
- }
2499
- $e(() => {
2500
- Me(() => {
2501
- y();
2502
- });
2503
- }), we([$], () => {
2504
- Me(() => y());
2505
- }), we(
2506
- () => t.value.data.datasets,
2507
- (u) => {
2508
- const M = new Set(
2509
- Array.isArray(u) ? u.map((W, q) => q) : []
2510
- );
2511
- i.value = i.value.filter(
2512
- (W) => M.has(W)
2513
- );
2514
- },
2515
- { deep: !0 }
2516
- );
2517
- const g = m(() => typeof t.value.legendFontSize == "number" ? t.value.legendFontSize : o.value.lg ? 12 : 8), I = m(() => {
2518
- const u = h.value.position;
2519
- return !u || u === "top" || u === "bottom" || u === "left" || u === "right";
2520
- }), T = m(() => h.value.display !== !1), B = m(() => I.value && T.value), v = m(() => h.value.position ?? "top"), f = m(
2521
- () => v.value === "left" || v.value === "right"
2522
- ), k = m(
2523
- () => v.value === "top" || v.value === "left"
2524
- ), L = m(() => {
2525
- var M;
2526
- const u = (M = h.value.labels) == null ? void 0 : M.color;
2527
- return typeof u == "string" && u.trim().length > 0 ? u : t.value.legendColor ?? "#6b6b6b";
2528
- }), x = m(() => g.value), A = sa();
2529
- function w({ itemIndex: u }) {
2530
- if (i.value.includes(u)) {
2531
- i.value = i.value.filter(
2532
- (M) => M !== u
2533
- );
2534
- return;
2535
- }
2536
- i.value = [...i.value, u];
2537
- }
2538
- return (u, M) => {
2539
- const W = pe("FmPieChart");
2540
- return Y(), fe("div", pr, [
2541
- nt(u.$slots, "menu"),
2542
- Q("div", {
2543
- class: Ie(["chart-layout", {
2544
- "chart-layout--side": B.value && f.value
2545
- }])
2546
- }, [
2547
- B.value && k.value ? (Y(), ge(ze, {
2548
- key: 0,
2549
- "chart-ref": s.value,
2550
- enabled: T.value,
2551
- position: v.value,
2552
- "max-width": r(h).maxWidth,
2553
- "text-color": L.value,
2554
- "font-size": x.value,
2555
- "legend-update-key": $.value,
2556
- "use-point-style": t.value.usePointStyle ?? !0,
2557
- "chart-color-binding": t.value.chartColorBinding,
2558
- "chart-colors": t.value.chartColors,
2559
- "chart-breakdown-colors": t.value.chartBreakdownColors,
2560
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2561
- "metric-count": t.value.metricCount,
2562
- "hidden-data-point-indexes": i.value,
2563
- onToggleDataPointVisibility: w
2564
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-data-point-indexes"])) : be("", !0),
2565
- he(W, {
2566
- ref_key: "chartRef",
2567
- ref: s,
2568
- class: "circular",
2569
- percentage: "70%",
2570
- datasets: $.value,
2571
- metrics: N.value,
2572
- tooltip: r(A),
2573
- variant: "doughnut",
2574
- legend: {
2575
- display: !1
2576
- },
2577
- datalabels: r(l),
2578
- "maintain-aspect-ratio": !1,
2579
- style: De({
2580
- "--chart-width": B.value && f.value ? "calc(100% - var(--legend-panel-width, 0px))" : r(c) !== void 0 ? r(c) + "px" : "100%",
2581
- "--chart-height": B.value && !f.value ? "calc(100% - var(--legend-panel-height, 0px))" : r(C) !== void 0 ? r(C) + "px" : "100%"
2582
- })
2583
- }, null, 8, ["datasets", "metrics", "tooltip", "datalabels", "style"]),
2584
- B.value && !k.value ? (Y(), ge(ze, {
2585
- key: 1,
2586
- "chart-ref": s.value,
2587
- enabled: T.value,
2588
- position: v.value,
2589
- "max-width": r(h).maxWidth,
2590
- "text-color": L.value,
2591
- "font-size": x.value,
2592
- "legend-update-key": $.value,
2593
- "use-point-style": t.value.usePointStyle ?? !0,
2594
- "chart-color-binding": t.value.chartColorBinding,
2595
- "chart-colors": t.value.chartColors,
2596
- "chart-breakdown-colors": t.value.chartBreakdownColors,
2597
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
2598
- "metric-count": t.value.metricCount,
2599
- "hidden-data-point-indexes": i.value,
2600
- onToggleDataPointVisibility: w
2601
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-data-point-indexes"])) : be("", !0)
2602
- ], 2)
2603
- ]);
2604
- };
2605
- }
2606
- });
2607
- function nn(e) {
2608
- if (e == null || e === "")
2609
- return "";
2610
- const n = String(e), t = Number(n);
2611
- if (isNaN(t)) return n;
2612
- const [o, s] = n.split("."), i = new Intl.NumberFormat("en-US").format(Number(o));
2613
- return s !== void 0 ? `${i}.${s}` : i;
2614
- }
2615
- 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({
2616
- __name: "WidgetScorecard",
2617
- props: {
2618
- modelValue: { required: !0 },
2619
- modelModifiers: {}
2620
- },
2621
- emits: ["update:modelValue"],
2622
- setup(e) {
2623
- const n = Ee(e, "modelValue"), { t } = ut(), { compareDateRange: o, defaultDateSetting: s } = it(on()), { country: i } = kn(), l = m(() => {
2624
- var g;
2625
- return ((g = n.value.data) == null ? void 0 : g.value) || "";
2626
- }), h = m(() => nn(l.value)), c = m(() => {
2627
- const { data: g } = n.value;
2628
- return g != null && g.comparison ? lo(l.value, g.comparison, i) : null;
2629
- });
2630
- function C(g) {
2631
- switch (g) {
2632
- case vn.bar:
2633
- return "bar";
2634
- case vn.line:
2635
- return "line";
2636
- default:
2637
- return "line";
2638
- }
2639
- }
2640
- const N = m(() => {
2641
- var g;
2642
- return (g = n.value.data) == null ? void 0 : g.sparkline;
2643
- }), $ = m(() => ({
2644
- display: !1,
2645
- beginAtZero: !1,
2646
- grace: "20%"
2647
- })), F = m(() => N.value.datasets.map((g) => ({
2648
- label: g.name,
2649
- data: g.values,
2650
- fill: !0,
2651
- color: "#36a2eb"
2652
- }))), y = m(() => Lt(!1));
2653
- return (g, I) => {
2654
- const T = pe("FmIcon"), B = pe("FmChip"), v = pe("FmTooltip"), f = pe("FmLineChart");
2655
- return Y(), fe("div", gr, [
2656
- nt(g.$slots, "menu"),
2657
- Q("p", yr, Pe(h.value), 1),
2658
- Q("div", br, [
2659
- he(v, {
2660
- disabled: c.value === null,
2661
- placement: "right",
2662
- "hide-arrow": "",
2663
- variant: "rich"
2664
- }, {
2665
- content: Le(() => {
2666
- var k;
2667
- return [
2668
- Q("span", Cr, Pe(`vs. ${(k = r(s).defaultCompareType) == null ? void 0 : k.split("_").join(" ")}`), 1)
2669
- ];
2670
- }),
2671
- default: Le(() => [
2672
- c.value ? (Y(), ge(B, {
2673
- key: 0,
2674
- icon: c.value.icon.name,
2675
- class: Ie(`bg-${c.value.icon.tailwind}`),
2676
- compact: ""
2677
- }, {
2678
- default: Le(() => [
2679
- he(T, {
2680
- name: c.value.icon.name,
2681
- color: c.value.icon.color
2682
- }, null, 8, ["name", "color"]),
2683
- Q("p", {
2684
- class: "fm-typo-en-body-md-600",
2685
- style: De({ color: c.value.icon.color })
2686
- }, Pe(c.value.value), 5)
2687
- ]),
2688
- _: 1
2689
- }, 8, ["icon", "class"])) : be("", !0),
2690
- r(o).endDate != null && r(o).startDate != null && c.value === null ? (Y(), ge(B, {
2691
- key: 1,
2692
- class: "invisible pointer-events-none",
2693
- "aria-hidden": "true",
2694
- compact: ""
2695
- }, {
2696
- default: Le(() => [
2697
- he(T, {
2698
- name: "arrow_upward",
2699
- color: "#C7C7CC"
2700
- }),
2701
- I[0] || (I[0] = Q("p", { class: "fm-typo-en-body-md-600" }, " ", -1))
2702
- ]),
2703
- _: 1
2704
- })) : be("", !0)
2705
- ]),
2706
- _: 1
2707
- }, 8, ["disabled"])
2708
- ]),
2709
- N.value ? (Y(), fe("div", xr, [
2710
- C(N.value.type) === "line" ? (Y(), ge(f, {
2711
- key: 0,
2712
- class: "sparkline",
2713
- datasets: F.value,
2714
- legend: {
2715
- display: !1
2716
- },
2717
- datalabels: { display: !1 },
2718
- "x-axis": { categories: N.value.dimensions },
2719
- "y-cfg": $.value,
2720
- "x-cfg": { display: !1 },
2721
- tooltip: y.value,
2722
- "maintain-aspect-ratio": !1
2723
- }, null, 8, ["datasets", "x-axis", "y-cfg", "tooltip"])) : be("", !0)
2724
- ])) : (Y(), fe("div", wr, I[1] || (I[1] = [
2725
- Q("div", { class: "sparkline" }, [
2726
- Q("div", { class: "flex flex-col gap-8" }, [
2727
- Q("div"),
2728
- Q("div")
2729
- ]),
2730
- Q("div", { class: "grow" })
2731
- ], -1)
2732
- ])))
2733
- ]);
2734
- };
2735
- }
2736
- }), _r = {};
2737
- function kr(e, n) {
2738
- const t = pe("FmMenuDivider");
2739
- return Y(), ge(t);
2740
- }
2741
- const Tr = /* @__PURE__ */ oo(_r, [["render", kr]]), Lr = "mf-reporttable-dimension", Zn = Ko(Lr, () => {
2742
- const e = D(0), n = D([]), t = D(!1), o = (v, f) => {
2743
- e.value = v, i(v, f);
2744
- }, s = (v, f, k, L) => {
2745
- n[v] = f, n.value = [...n.value], l(v, f, k, L);
2746
- }, i = (v, f) => {
2747
- const k = (f == null ? void 0 : f.querySelectorAll("thead tr")) ?? [], L = (f == null ? void 0 : f.querySelectorAll("tbody tr")) ?? [];
2748
- [...k, ...L].forEach((A) => {
2749
- const w = A;
2750
- w && (w.style.height = `${v}px`);
2751
- });
2752
- }, l = (v, f, k, L = !1) => {
2753
- const x = (k == null ? void 0 : k.querySelectorAll("th")) ?? [];
2754
- if (v === void 0) return;
2755
- const A = x[v], w = L ? n[v] : f;
2756
- if (!A || w === void 0) return;
2757
- const u = () => {
2758
- A.style.width = `${w}px`;
2759
- };
2760
- L ? requestAnimationFrame(u) : u();
2761
- }, h = () => {
2762
- const v = document.querySelectorAll("th"), f = document.querySelectorAll("td"), k = document.querySelector("table");
2763
- k == null || k.classList.add("table-fixed"), v.forEach((L) => L.classList.add("toggleEditResize")), f.forEach((L) => L.classList.add("toggleEditResize")), t.value = !0;
2764
- }, c = () => {
2765
- const v = document.querySelectorAll("th"), f = document.querySelectorAll("td"), k = document.querySelectorAll(".col-resize-handle"), L = document.querySelectorAll(".row-resize-handle");
2766
- v.forEach((x) => x.classList.remove("toggleEditResize")), f.forEach((x) => x.classList.remove("toggleEditResize")), k.forEach((x) => x.remove()), L.forEach((x) => x.remove()), t.value = !1;
2767
- }, C = () => {
2768
- e.value = 0, n.value = [];
2769
- }, N = (v, f) => {
2770
- if (f) {
2771
- const k = document.querySelectorAll(`thead th:nth-child(${v + 1})`), L = document.querySelectorAll(`tbody td:nth-child(${v + 1})`);
2772
- [...k, ...L].forEach((x) => {
2773
- x.classList.add("highlight-hover-col");
2774
- });
2775
- } else
2776
- document.querySelectorAll(
2777
- `thead th:nth-child(${v + 1}), tbody td:nth-child(${v + 1})`
2778
- ).forEach((k) => k.classList.add("highlight-col"));
2779
- }, $ = (v) => {
2780
- const f = document.querySelectorAll("thead tr"), k = document.querySelectorAll("tbody tr"), L = [...f, ...k];
2781
- for (const x of L)
2782
- v ? x.classList.add("highlight-hover-row") : x.classList.add("highlight-row");
2783
- }, F = (v) => {
2784
- const f = v ? ".highlight-hover-row" : ".highlight-row", k = document.querySelectorAll(f);
2785
- for (const L of k)
2786
- L.classList.remove(f.slice(1));
2787
- }, y = (v) => {
2788
- v ? document.querySelectorAll(".highlight-hover-col").forEach((f) => {
2789
- f.classList.remove("highlight-hover-col");
2790
- }) : document.querySelectorAll(".highlight-col").forEach((f) => f.classList.remove("highlight-col"));
2791
- }, g = (v, f) => {
2792
- const k = v.clientX, L = v.target.closest("table");
2793
- if (!L) return;
2794
- const x = L.querySelectorAll("th")[f];
2795
- if (!x) return;
2796
- const A = x.getBoundingClientRect().width || 60, w = x.querySelector("button"), u = (w == null ? void 0 : w.querySelector("span")) || x.querySelector("p") || x;
2797
- let M = 60;
2798
- if (u) {
2799
- const J = u.textContent || "", _ = window.getComputedStyle(u), E = `${_.fontWeight} ${_.fontSize} ${_.fontFamily}`, R = document.createElement("canvas").getContext("2d");
2800
- if (R) {
2801
- R.font = E;
2802
- const P = R.measureText(J), V = window.getComputedStyle(x), ne = parseFloat(V.paddingLeft || "0"), K = parseFloat(V.paddingRight || "0");
2803
- M = P.width + ne + K;
2804
- }
2805
- }
2806
- N(f, !1);
2807
- let W = null, q = null;
2808
- const ee = () => {
2809
- if (q === null) return;
2810
- const J = x;
2811
- J.style.width = `${q}px`;
2812
- let _ = 0;
2813
- L.querySelectorAll("th").forEach((z, R) => {
2814
- _ += R === f ? q : z.getBoundingClientRect().width;
2815
- }), L.classList.remove("w-full"), L.style.width = `${_}px`, W = null;
2816
- }, G = (J) => {
2817
- const _ = J.clientX - k;
2818
- q = Math.max(M, A + _), W === null && (W = requestAnimationFrame(ee));
2819
- }, ie = () => {
2820
- W !== null && cancelAnimationFrame(W), q !== null && (x.style.width = `${q}px`);
2821
- const J = L.querySelectorAll("th"), _ = [];
2822
- J.forEach((E) => {
2823
- _.push(E.getBoundingClientRect().width);
2824
- }), n.value = _, y(!1), document.removeEventListener("mousemove", G), document.removeEventListener("mouseup", ie);
2825
- };
2826
- document.addEventListener("mousemove", G), document.addEventListener("mouseup", ie);
2827
- }, I = (v) => {
2828
- const f = v.clientY, k = v.target.closest("table"), L = e.value || 48;
2829
- $(!1);
2830
- const x = (w) => {
2831
- const u = Math.max(30, L + (w.clientY - f));
2832
- k && o(u, k);
2833
- }, A = () => {
2834
- F(!1), document.removeEventListener("mousemove", x), document.removeEventListener("mouseup", A);
2835
- };
2836
- document.addEventListener("mousemove", x), document.addEventListener("mouseup", A);
2837
- };
2838
- return {
2839
- rowHeight: e,
2840
- colWidths: n,
2841
- isEditing: t,
2842
- updateRowHeight: o,
2843
- updateColWidth: s,
2844
- setRowHeights: i,
2845
- setColWidths: l,
2846
- enableEditMode: h,
2847
- disableEditMode: c,
2848
- resetStore: C,
2849
- highlightCol: N,
2850
- highlightRows: $,
2851
- removeRowHighlight: F,
2852
- removeColHighlight: y,
2853
- resizeCol: g,
2854
- resizeRow: I,
2855
- enableCellResizing: () => {
2856
- const v = document.querySelector("thead"), f = document.querySelectorAll("thead tr"), k = document.querySelectorAll("tbody tr"), L = [...f, ...k];
2857
- v && v.classList.remove("sticky");
2858
- const x = (A, w) => {
2859
- const u = document.createElement("div");
2860
- return u.className = `${A}-resize-handle`, A === "col" ? (u.addEventListener("mouseenter", () => N(w, !0)), u.addEventListener("mouseleave", () => y(!0)), u.addEventListener("mousedown", (M) => {
2861
- M.stopPropagation(), g(M, w);
2862
- })) : (u.addEventListener("mouseenter", () => $(!0)), u.addEventListener("mouseleave", () => F(!0)), u.addEventListener("mousedown", (M) => {
2863
- M.stopPropagation(), I(M);
2864
- })), u;
2865
- };
2866
- L.forEach((A) => {
2867
- const w = A.closest("thead") !== null;
2868
- A.querySelectorAll(w ? "th" : "td").forEach((M, W) => {
2869
- const q = x("col", W), ee = x("row", W);
2870
- M.appendChild(q), M.appendChild(ee);
2871
- });
2872
- }), h();
2873
- },
2874
- cancelResizingChanges: () => {
2875
- c();
2876
- }
2877
- };
2878
- }), Dr = "/assets/processTableData.worker-CNwOO2hz.js", Ir = { class: "my-4" }, Mr = {
2879
- class: "border-b border-fm-color-neutral-gray-100 hover:bg-fm-color-opacity-sm",
2880
- style: { backgroundColor: "#f9f9f9" }
2881
- }, Br = { class: "font-bold" }, Pr = { class: "text-fm-color-neutral-gray-300" }, Fr = /* @__PURE__ */ Ne({
2882
- __name: "WidgetTable",
2883
- props: /* @__PURE__ */ Xe({
2884
- tileIndex: {}
2885
- }, {
2886
- modelValue: { required: !0 },
2887
- modelModifiers: {}
2888
- }),
2889
- emits: ["update:modelValue"],
2890
- setup(e) {
2891
- const { t: n, te: t } = ut(), o = Ee(e, "modelValue"), { country: s } = kn(), { clearTileSorts: i, setTileSorts: l } = zo(), h = Tn(), c = e, C = D([]), { isEditing: N, colWidths: $, rowHeight: F } = it(Zn()), { setColWidths: y, setRowHeights: g, enableCellResizing: I } = Zn(), T = D(null), B = m(() => {
2892
- var _;
2893
- return ((_ = o.value.data) == null ? void 0 : _.columns) || [{ label: "", key: "" }];
2894
- }), v = m(() => {
2895
- var _;
2896
- return ((_ = o.value.data) == null ? void 0 : _.rows) || [];
2897
- }), f = m(() => o.value.filterText), k = m(() => {
2898
- var E;
2899
- const _ = (E = o.value.grandTotalLabel) == null ? void 0 : E.trim();
2900
- return _ && _.length > 0 ? _ : st(n, t, "Grand total", "other");
2901
- }), L = m(() => {
2902
- var _, E;
2903
- if (!(f.value && f.value.trim().length > 0 || !((_ = v.value[0]) != null && _.isRollup) && !((E = v.value[v.value.length - 1]) != null && E.isRollup))) {
2904
- if (o.value.rollupPosition === et.top || o.value.rollupPosition === void 0)
2905
- return et.top;
2906
- if (o.value.rollupPosition === et.bottom)
2907
- return et.bottom;
2908
- }
2909
- }), x = m(() => {
2910
- const R = L.value !== void 0 ? 1 : 0, P = (T.value ? T.value.$el.offsetHeight : 0) - 48;
2911
- return Math.floor((P - 34.5 - 32) / 48) - R;
2912
- }), A = m(() => {
2913
- var E, z;
2914
- let _ = [];
2915
- switch (L.value) {
2916
- case et.top:
2917
- _ = [...((E = v.value[0]) == null ? void 0 : E.cells) || []].map((R, P) => {
2918
- var V;
2919
- return {
2920
- main: R,
2921
- comparison: (V = v.value[0]) == null ? void 0 : V.comparisonCells[P],
2922
- rowType: B.value[P].type
2923
- };
2924
- });
2925
- break;
2926
- case et.bottom:
2927
- _ = [...((z = v.value[v.value.length - 1]) == null ? void 0 : z.cells) || []].map((R, P) => {
2928
- var V;
2929
- return {
2930
- main: R,
2931
- comparison: (V = v.value[v.value.length - 1]) == null ? void 0 : V.comparisonCells[P],
2932
- rowType: B.value[P].type
2933
- };
2934
- });
2935
- break;
2936
- }
2937
- return _.length > 0 && _[0].main === "" && (_[0].main = k.value), _;
2938
- });
2939
- function w(_) {
2940
- let E = (_ == null ? void 0 : _.main) || "";
2941
- return !_ || _.main === "" || !_.comparison ? {
2942
- main: E
2943
- } : (E.includes("#") && !E.startsWith("#") && (E = E.split("#")[0]), {
2944
- main: E,
2945
- comparison: _ == null ? void 0 : _.comparison,
2946
- difference: lo(_.main, _.comparison, s)
2947
- });
2948
- }
2949
- $e(() => {
2950
- i();
2951
- });
2952
- const u = D([]);
2953
- let M = 0, W;
2954
- function q() {
2955
- var P;
2956
- if (!((P = o.value) != null && P.data)) {
2957
- u.value = [];
2958
- return;
2959
- }
2960
- const _ = ++M, E = (o.value.data.rows || []).map((V) => ({
2961
- isRollup: V.isRollup,
2962
- cells: Array.isArray(V.cells) ? [...V.cells] : [],
2963
- comparisonCells: Array.isArray(V.comparisonCells) ? [...V.comparisonCells] : []
2964
- })), z = (o.value.data.columns || []).map((V) => ({
2965
- key: V.key,
2966
- type: V.type,
2967
- label: V.label
2968
- })), R = {
2969
- rows: E,
2970
- columns: z,
2971
- filter: f.value ?? "",
2972
- globalSorts: Bo(C.value).map((V) => ({
2973
- key: V.key,
2974
- type: V.type
2975
- })),
2976
- grandTotalPosition: L.value,
2977
- pageSize: x.value
2978
- };
2979
- No(Dr, R).then((V) => {
2980
- _ === 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 = Po(V.data || []));
2981
- });
2982
- }
2983
- we(
2984
- () => C.value,
2985
- (_) => {
2986
- c.tileIndex === void 0 || c.tileIndex === null || l(c.tileIndex, _);
2987
- },
2988
- { immediate: !0, deep: !0 }
2989
- );
2990
- const ee = m(() => {
2991
- var z, R;
2992
- const _ = ((z = o.value.data) == null ? void 0 : z.rows) || [], E = ((R = o.value.data) == null ? void 0 : R.columns) || [];
2993
- return JSON.stringify({
2994
- rowsLength: _.length,
2995
- columns: E.map((P) => ({ key: P.key, type: P.type, label: P.label })),
2996
- filter: f.value ?? "",
2997
- globalSorts: C.value.map((P) => ({ key: P.key, type: P.type })),
2998
- grandTotalPosition: L.value,
2999
- pageSize: x.value
3000
- });
3001
- });
3002
- we(
3003
- () => ee.value,
3004
- () => {
3005
- clearTimeout(W), W = setTimeout(q, 200);
3006
- },
3007
- { immediate: !0 }
3008
- );
3009
- function G(_) {
3010
- const E = C.value.find((z) => z.key === _);
3011
- if (!E) {
3012
- C.value.push({ key: _, type: Pt.Asc });
3013
- return;
3014
- }
3015
- E.type === Pt.Asc ? E.type = Pt.Desc : E.type === Pt.Desc && (C.value = C.value.filter((z) => z.key !== _));
3016
- }
3017
- const ie = m(
3018
- () => {
3019
- var _;
3020
- return (((_ = o.value.colWidths) == null ? void 0 : _.length) ?? 0) > 0 || $.value.length > 0;
3021
- }
3022
- ), J = m(() => {
3023
- var _;
3024
- return (_ = o.value.data) != null && _.columns ? o.value.data.columns.map((E) => {
3025
- const z = st(n, t, E.label, "other"), R = C.value.find((ne) => ne.key === E.key), P = !!R, V = P ? R.type === Pt.Asc ? "arrow_upward" : "arrow_downward" : "unfold_more";
3026
- return {
3027
- accessorKey: E.key,
3028
- header: () => {
3029
- const ne = pe("FmIcon");
3030
- return Jt(
3031
- "button",
3032
- {
3033
- type: "button",
3034
- class: `w-full flex items-center gap-1 group/select-header select-none ${E.type === "NUMERIC" ? "justify-end" : "justify-start"} ${P ? "text-fm-color-typo-primary" : "text-fm-color-neutral-gray-400"}`,
3035
- onClick: () => G(E.key)
3036
- },
3037
- [
3038
- Jt(
3039
- "span",
3040
- { class: `${E.type === "NUMERIC" ? "text-right" : ""} whitespace-nowrap` },
3041
- z
3042
- ),
3043
- Jt(ne, {
3044
- name: V,
3045
- color: P ? "primary" : "neutral-gray-400",
3046
- size: "sm",
3047
- class: "transition-transform",
3048
- style: V === "arrow_upward" ? "transform: translateY(-1px);" : ""
3049
- })
3050
- ]
3051
- );
3052
- },
3053
- cell: (ne) => {
3054
- var Z, le;
3055
- const K = w(ne.getValue()), X = (le = (Z = ne == null ? void 0 : ne.row) == null ? void 0 : Z.original) == null ? void 0 : le.isRollup;
3056
- return Jt(
3057
- "div",
3058
- {
3059
- class: [
3060
- X ? "fm-typo-en-body-md-600 text-fm-color-typo-primary" : "fm-typo-en-body-md-400",
3061
- E.type === "NUMERIC" ? "text-right" : "",
3062
- ie.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
3063
- ].join(" ")
3064
- },
3065
- [E.type === "NUMERIC" ? nn(K.main) : K.main]
3066
- );
3067
- },
3068
- enableSorting: !1
3069
- };
3070
- }) : [];
3071
- });
3072
- return we(
3073
- () => $.value.length > 0,
3074
- async (_) => {
3075
- _ && N.value && (await Me(), I());
3076
- }
3077
- ), we(
3078
- [() => J.value],
3079
- async () => {
3080
- var P;
3081
- await Me();
3082
- const _ = (P = T.value) == null ? void 0 : P.$el;
3083
- if (!_) return;
3084
- const E = _.querySelector("table");
3085
- if (!E) return;
3086
- E.classList.add(ie.value ? "table-fixed" : "table-auto");
3087
- let z, R;
3088
- 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) => {
3089
- y(ne, V, _);
3090
- });
3091
- },
3092
- { immediate: !0 }
3093
- ), (_, E) => {
3094
- const z = pe("FmTable");
3095
- return Y(), fe(Ve, null, [
3096
- Q("div", Ir, [
3097
- nt(_.$slots, "menu")
3098
- ]),
3099
- he(z, {
3100
- ref_key: "table",
3101
- ref: T,
3102
- "column-defs": J.value,
3103
- "row-data": u.value,
3104
- "search-value": f.value,
3105
- "page-size": x.value,
3106
- "shrink-at": !1,
3107
- "force-mobile-footer": !0,
3108
- class: "scrollbar-hide-table",
3109
- "pin-header-row": !0,
3110
- "auto-reset-page-index": !0
3111
- }, Mo({ _: 2 }, [
3112
- L.value ? {
3113
- name: "pin-top",
3114
- fn: Le(() => [
3115
- (Y(), ge(eo(L.value === r(et).bottom ? "tfoot" : "tbody"), null, {
3116
- default: Le(() => [
3117
- Q("tr", Mr, [
3118
- (Y(!0), fe(Ve, null, zt(A.value, (R, P) => (Y(), fe("td", {
3119
- key: `${r(Rt)()}_${P}`,
3120
- class: "h-[48px] text-fm-color-typo-primary px-16"
3121
- }, [
3122
- Q("span", {
3123
- class: Ie([
3124
- "items-center text-fm-color-typo-secondary gap-2",
3125
- R.rowType === "NUMERIC" ? "text-right" : "",
3126
- ie.value ? "whitespace-normal break-words line-clamp-6" : "whitespace-nowrap"
3127
- ])
3128
- }, [
3129
- Q("p", Br, Pe(R.rowType === "NUMERIC" ? r(nn)(R.main) : R.main), 1),
3130
- Q("p", Pr, Pe(R.comparison ? R.rowType === "NUMERIC" ? `(${r(nn)(R.comparison)})` : `(${R.comparison})` : ""), 1)
3131
- ], 2)
3132
- ]))), 128))
3133
- ])
3134
- ]),
3135
- _: 1
3136
- }))
3137
- ]),
3138
- key: "0"
3139
- } : void 0
3140
- ]), 1032, ["column-defs", "row-data", "search-value", "page-size"])
3141
- ], 64);
3142
- };
3143
- }
3144
- }), Ar = { class: "widget-content" }, Rr = /* @__PURE__ */ Ne({
3145
- __name: "WidgetStackBarChart",
3146
- props: /* @__PURE__ */ Xe({
3147
- tileIndex: {}
3148
- }, {
3149
- modelValue: { required: !0 },
3150
- modelModifiers: {}
3151
- }),
3152
- emits: ["update:modelValue"],
3153
- setup(e) {
3154
- const n = e, t = Ee(e, "modelValue"), o = D(null), s = m(() => t.value.maxTooltipItems), {
3155
- isTooltipDetailsSheetOpen: i,
3156
- tooltipDetailsPayload: l,
3157
- tooltipOptions: h,
3158
- handleTooltipDetailsSheetVisibility: c,
3159
- handleTooltipDetailsHover: C,
3160
- handleTooltipDetailsLeave: N
3161
- } = Wt(o, {
3162
- maxTooltipItems: s
3163
- }), $ = m(() => {
3164
- var ne;
3165
- return ((ne = t.value.data) == null ? void 0 : ne.xAxis) || [];
3166
- }), F = m(() => {
3167
- var V;
3168
- return ((V = t.value.data) == null ? void 0 : V.datasets) ?? [];
3169
- }), { datalabels: y, xCfg: g, yCfg: I, isTransposed: T, legend: B, chartWidth: v, chartHeight: f } = Dt(
3170
- t.value
3171
- ), k = m(
3172
- () => Lt(t.value.isTransposed === !0, h.value)
3173
- ), L = $t("bar"), x = m(() => t.value.stackBarOverlap === !0), A = m(() => x.value === !1), w = m(() => {
3174
- const V = B.value.position;
3175
- return !V || V === "top" || V === "bottom" || V === "left" || V === "right";
3176
- }), u = m(() => B.value.position ?? "top"), M = m(
3177
- () => u.value === "left" || u.value === "right"
3178
- ), W = m(
3179
- () => u.value === "top" || u.value === "left"
3180
- ), q = m(() => ({
3181
- ...g.value,
3182
- stacked: A.value
3183
- })), ee = m(() => ({
3184
- ...I.value,
3185
- stacked: A.value
3186
- }));
3187
- function G({
3188
- datasetIndex: V,
3189
- colorIndex: ne,
3190
- breakdownIndex: K
3191
- }) {
3192
- var ue;
3193
- const X = t.value.chartColorBinding === _e.metric ? ne : t.value.chartColorBinding === _e.breakdown ? K : V, Z = (ue = t.value.chartColorLayers) == null ? void 0 : ue[X], le = Number(Z);
3194
- return Number.isInteger(le) && le > 0 ? le : X + 1;
3195
- }
3196
- const ie = m(() => {
3197
- if (F.value.length > 0) {
3198
- let V = 0, ne = 0;
3199
- const K = F.value.map((X, Z) => {
3200
- const le = t.value.chartColorBinding === _e.metric && (t.value.metricCount ?? 0) > 0 ? X.isCompare ? ne++ % Number(t.value.metricCount) : V++ % Number(t.value.metricCount) : Fe({
3201
- datasetIndex: Z,
3202
- isCompare: X.isCompare,
3203
- metricCount: t.value.metricCount,
3204
- mode: t.value.chartColorBinding
3205
- }), ue = Fe({
3206
- datasetIndex: Z,
3207
- isCompare: X.isCompare,
3208
- metricCount: t.value.metricCount,
3209
- mode: _e.metric
3210
- }), me = wt({
3211
- fallbackIndex: Z,
3212
- metricCount: t.value.metricCount
3213
- }), se = G({
3214
- datasetIndex: Z,
3215
- colorIndex: le,
3216
- breakdownIndex: me
3217
- }), xe = X.values.map((Be) => Be === null ? NaN : Number(Be));
3218
- return {
3219
- dataset: {
3220
- label: X.name,
3221
- data: xe,
3222
- dash: !!X.isCompare,
3223
- grouped: x.value ? !1 : void 0,
3224
- order: x.value ? se : void 0,
3225
- backgroundColor: t.value.chartColorBinding === _e.breakdown ? Tt({
3226
- breakdownIndex: me,
3227
- metricIndex: ue,
3228
- metricCount: t.value.metricCount,
3229
- isCompare: X.isCompare,
3230
- breakdownColors: t.value.chartBreakdownColors,
3231
- useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
3232
- customColors: t.value.chartColors
3233
- }) : tt({
3234
- index: le,
3235
- isCompare: X.isCompare,
3236
- customColors: t.value.chartColors
3237
- })
3238
- }
3239
- };
3240
- });
3241
- return x.value ? K.map((X) => X.dataset) : K.map((X) => X.dataset);
3242
- } else
3243
- return [];
3244
- }), { hiddenDatasetKeys: J, isDatasetHidden: _, toggleDatasetVisibility: E } = Et(ie), z = m(
3245
- () => ie.value.map((V, ne) => ({
3246
- ...V,
3247
- hidden: _(V, ne)
3248
- }))
3249
- ), R = kt();
3250
- function P() {
3251
- return R.extractChartSize(o.value, n.tileIndex) || { width: 0, height: 0 };
3252
- }
3253
- return $e(() => {
3254
- Me(() => {
3255
- P();
3256
- });
3257
- }), we([z], () => {
3258
- Me(() => P());
3259
- }), (V, ne) => {
3260
- var X, Z, le, ue, me, se;
3261
- const K = pe("FmBarChart");
3262
- return Y(), fe(Ve, null, [
3263
- Q("div", Ar, [
3264
- nt(V.$slots, "menu"),
3265
- Q("div", {
3266
- class: Ie(["chart-layout", {
3267
- "chart-layout--side": w.value && (r(B).display ?? !1) && M.value
3268
- }])
3269
- }, [
3270
- w.value && (r(B).display ?? !1) && W.value ? (Y(), ge(ze, {
3271
- key: 0,
3272
- "chart-ref": o.value,
3273
- enabled: r(B).display ?? !1,
3274
- position: u.value,
3275
- "max-width": r(B).maxWidth,
3276
- "text-color": (X = r(B).labels) == null ? void 0 : X.color,
3277
- "font-size": (le = (Z = r(B).labels) == null ? void 0 : Z.font) == null ? void 0 : le.size,
3278
- "legend-update-key": z.value,
3279
- "use-point-style": t.value.usePointStyle ?? !0,
3280
- "chart-color-binding": t.value.chartColorBinding,
3281
- "chart-colors": t.value.chartColors,
3282
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3283
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3284
- "metric-count": t.value.metricCount,
3285
- "hidden-dataset-keys": r(J),
3286
- onToggleDatasetVisibility: r(E)
3287
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0),
3288
- he(K, {
3289
- ref_key: "chartRef",
3290
- ref: o,
3291
- class: "bar-chart",
3292
- datasets: z.value,
3293
- "x-axis": { categories: $.value },
3294
- "x-cfg": q.value,
3295
- "y-cfg": ee.value,
3296
- transpose: r(T),
3297
- stacked: A.value,
3298
- legend: {
3299
- display: !1
3300
- },
3301
- tooltip: k.value,
3302
- plugins: [r(L)],
3303
- datalabels: r(y),
3304
- "maintain-aspect-ratio": !1,
3305
- style: De({
3306
- "--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%",
3307
- "--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%"
3308
- })
3309
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "stacked", "tooltip", "plugins", "datalabels", "style"]),
3310
- w.value && (r(B).display ?? !1) && !W.value ? (Y(), ge(ze, {
3311
- key: 1,
3312
- "chart-ref": o.value,
3313
- enabled: r(B).display ?? !1,
3314
- position: u.value,
3315
- "max-width": r(B).maxWidth,
3316
- "text-color": (ue = r(B).labels) == null ? void 0 : ue.color,
3317
- "font-size": (se = (me = r(B).labels) == null ? void 0 : me.font) == null ? void 0 : se.size,
3318
- "legend-update-key": z.value,
3319
- "use-point-style": t.value.usePointStyle ?? !0,
3320
- "chart-color-binding": t.value.chartColorBinding,
3321
- "chart-colors": t.value.chartColors,
3322
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3323
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3324
- "metric-count": t.value.metricCount,
3325
- "hidden-dataset-keys": r(J),
3326
- onToggleDatasetVisibility: r(E)
3327
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0)
3328
- ], 2)
3329
- ]),
3330
- he(Ht, {
3331
- "model-value": r(i),
3332
- "details-payload": r(l),
3333
- "onUpdate:modelValue": r(c),
3334
- onValueHover: r(C),
3335
- onValueLeave: r(N)
3336
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
3337
- ], 64);
3338
- };
3339
- }
3340
- }), zr = { class: "widget-content" }, Nr = /* @__PURE__ */ Ne({
3341
- __name: "WidgetClusteredStackBarchart",
3342
- props: /* @__PURE__ */ Xe({
3343
- tileIndex: {}
3344
- }, {
3345
- modelValue: { required: !0 },
3346
- modelModifiers: {}
3347
- }),
3348
- emits: ["update:modelValue"],
3349
- setup(e) {
3350
- const n = e, t = Ee(e, "modelValue"), o = D(null), s = m(() => t.value.maxTooltipItems), {
3351
- isTooltipDetailsSheetOpen: i,
3352
- tooltipDetailsPayload: l,
3353
- tooltipOptions: h,
3354
- handleTooltipDetailsSheetVisibility: c,
3355
- handleTooltipDetailsHover: C,
3356
- handleTooltipDetailsLeave: N
3357
- } = Wt(o, {
3358
- maxTooltipItems: s
3359
- }), $ = m(() => {
3360
- var K;
3361
- return ((K = t.value.data) == null ? void 0 : K.xAxis) || [];
3362
- }), F = m(() => {
3363
- var K;
3364
- return ((K = t.value.data) == null ? void 0 : K.datasets) ?? [];
3365
- }), { datalabels: y, xCfg: g, yCfg: I, isTransposed: T, legend: B, chartWidth: v, chartHeight: f } = Dt(
3366
- t.value
3367
- ), k = m(
3368
- () => Lt(t.value.isTransposed === !0, h.value)
3369
- ), L = $t("bar"), x = m(() => t.value.stackBarOverlap === !0), A = m(() => x.value === !1), w = m(() => {
3370
- const K = B.value.position;
3371
- return !K || K === "top" || K === "bottom" || K === "left" || K === "right";
3372
- }), u = m(() => B.value.position ?? "top"), M = m(
3373
- () => u.value === "left" || u.value === "right"
3374
- ), W = m(
3375
- () => u.value === "top" || u.value === "left"
3376
- ), q = m(() => ({
3377
- ...g.value,
3378
- stacked: A.value
3379
- })), ee = m(() => ({
3380
- ...I.value,
3381
- stacked: A.value
3382
- }));
3383
- function G(K) {
3384
- const X = " - ", Z = K.lastIndexOf(X);
3385
- return Z < 0 ? {
3386
- clusterKey: K,
3387
- metricLabel: K
3388
- } : {
3389
- clusterKey: K.slice(0, Z),
3390
- metricLabel: K.slice(Z + X.length)
3391
- };
3392
- }
3393
- function ie(K, X) {
3394
- if (typeof K == "string") {
3395
- const Z = K.trim();
3396
- if (Z.length > 0)
3397
- return Z;
3398
- }
3399
- return `Series ${X + 1}`;
3400
- }
3401
- function J({
3402
- datasetIndex: K,
3403
- colorIndex: X
3404
- }) {
3405
- var me;
3406
- const Z = t.value.chartColorBinding === _e.metric ? X : K, le = (me = t.value.chartColorLayers) == null ? void 0 : me[Z], ue = Number(le);
3407
- return Number.isInteger(ue) && ue > 0 ? ue : Z + 1;
3408
- }
3409
- const _ = m(() => {
3410
- if (F.value.length === 0)
3411
- return [];
3412
- const K = F.value.map((se, ce) => ({
3413
- source: se,
3414
- index: ce,
3415
- name: ie(se == null ? void 0 : se.name, ce),
3416
- values: (se == null ? void 0 : se.values) ?? []
3417
- })), X = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map();
3418
- for (const se of K) {
3419
- const { clusterKey: ce, metricLabel: xe } = G(se.name);
3420
- Z.has(ce) || Z.set(ce, Z.size), X.has(xe) || X.set(xe, X.size);
3421
- }
3422
- const le = Math.max(X.size, 1), ue = t.value.chartColorBinding === _e.breakdown, me = t.value.chartUseSecondaryMetricShades !== !1;
3423
- return K.map((se) => {
3424
- const ce = Fe({
3425
- datasetIndex: se.index,
3426
- isCompare: se.source.isCompare,
3427
- metricCount: t.value.metricCount,
3428
- mode: t.value.chartColorBinding
3429
- }), { clusterKey: xe, metricLabel: Be } = G(se.name), He = Z.get(xe) ?? 0, We = X.get(Be) ?? 0, Ye = ue ? Tt({
3430
- breakdownIndex: He,
3431
- metricIndex: We,
3432
- metricCount: le,
3433
- isCompare: se.source.isCompare,
3434
- breakdownColors: t.value.chartBreakdownColors,
3435
- useSecondaryMetricShades: me,
3436
- colorMode: "clustered"
3437
- }) : tt({
3438
- index: ce,
3439
- isCompare: se.source.isCompare,
3440
- customColors: t.value.chartColors
3441
- }), ct = J({
3442
- datasetIndex: se.index,
3443
- colorIndex: ce
3444
- }), ot = se.values.map((Ge) => Ge === null ? NaN : Number(Ge));
3445
- return {
3446
- label: se.name,
3447
- tooltipLabel: `${xe} - ${Be}`,
3448
- data: ot,
3449
- dash: !!se.source.isCompare,
3450
- grouped: !0,
3451
- order: x.value ? ct : void 0,
3452
- stack: se.source.isCompare ? `${xe}__compare` : `${xe}__main`,
3453
- backgroundColor: Ye
3454
- };
3455
- });
3456
- }), { hiddenDatasetKeys: E, isDatasetHidden: z, toggleDatasetVisibility: R } = Et(_), P = m(
3457
- () => _.value.map((K, X) => ({
3458
- ...K,
3459
- hidden: z(K, X)
3460
- }))
3461
- ), V = kt();
3462
- function ne() {
3463
- return V.extractChartSize(o.value, n.tileIndex) || { width: 0, height: 0 };
3464
- }
3465
- return $e(() => {
3466
- Me(() => {
3467
- ne();
3468
- });
3469
- }), we([P], () => {
3470
- Me(() => ne());
3471
- }), (K, X) => {
3472
- var le, ue, me, se, ce, xe;
3473
- const Z = pe("FmBarChart");
3474
- return Y(), fe(Ve, null, [
3475
- Q("div", zr, [
3476
- nt(K.$slots, "menu"),
3477
- Q("div", {
3478
- class: Ie(["chart-layout", {
3479
- "chart-layout--side": w.value && (r(B).display ?? !1) && M.value
3480
- }])
3481
- }, [
3482
- w.value && (r(B).display ?? !1) && W.value ? (Y(), ge(ze, {
3483
- key: 0,
3484
- "chart-ref": o.value,
3485
- enabled: r(B).display ?? !1,
3486
- position: u.value,
3487
- "max-width": r(B).maxWidth,
3488
- "text-color": (le = r(B).labels) == null ? void 0 : le.color,
3489
- "font-size": (me = (ue = r(B).labels) == null ? void 0 : ue.font) == null ? void 0 : me.size,
3490
- "legend-update-key": P.value,
3491
- "use-point-style": t.value.usePointStyle ?? !0,
3492
- "chart-color-binding": t.value.chartColorBinding,
3493
- "chart-colors": t.value.chartColors,
3494
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3495
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3496
- "metric-count": t.value.metricCount,
3497
- "hidden-dataset-keys": r(E),
3498
- onToggleDatasetVisibility: r(R)
3499
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0),
3500
- he(Z, {
3501
- ref_key: "chartRef",
3502
- ref: o,
3503
- class: "bar-chart",
3504
- datasets: P.value,
3505
- "x-axis": { categories: $.value },
3506
- "x-cfg": q.value,
3507
- "y-cfg": ee.value,
3508
- transpose: r(T),
3509
- stacked: A.value,
3510
- legend: {
3511
- display: !1
3512
- },
3513
- tooltip: k.value,
3514
- plugins: [r(L)],
3515
- datalabels: r(y),
3516
- "maintain-aspect-ratio": !1,
3517
- style: De({
3518
- "--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%",
3519
- "--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%"
3520
- })
3521
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "stacked", "tooltip", "plugins", "datalabels", "style"]),
3522
- w.value && (r(B).display ?? !1) && !W.value ? (Y(), ge(ze, {
3523
- key: 1,
3524
- "chart-ref": o.value,
3525
- enabled: r(B).display ?? !1,
3526
- position: u.value,
3527
- "max-width": r(B).maxWidth,
3528
- "text-color": (se = r(B).labels) == null ? void 0 : se.color,
3529
- "font-size": (xe = (ce = r(B).labels) == null ? void 0 : ce.font) == null ? void 0 : xe.size,
3530
- "legend-update-key": P.value,
3531
- "use-point-style": t.value.usePointStyle ?? !0,
3532
- "chart-color-binding": t.value.chartColorBinding,
3533
- "chart-colors": t.value.chartColors,
3534
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3535
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3536
- "metric-count": t.value.metricCount,
3537
- "hidden-dataset-keys": r(E),
3538
- onToggleDatasetVisibility: r(R)
3539
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0)
3540
- ], 2)
3541
- ]),
3542
- he(Ht, {
3543
- "model-value": r(i),
3544
- "details-payload": r(l),
3545
- "onUpdate:modelValue": r(c),
3546
- onValueHover: r(C),
3547
- onValueLeave: r(N)
3548
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
3549
- ], 64);
3550
- };
3551
- }
3552
- });
3553
- function Vr(e) {
3554
- const n = Reflect.get(e, "lineStyle"), t = Reflect.get(e, "dash") === !0;
3555
- return Jo(n, t);
3556
- }
3557
- function vo(e = "report-line-style-plugin") {
3558
- return {
3559
- id: e,
3560
- beforeDatasetsUpdate(n) {
3561
- var o;
3562
- (((o = n == null ? void 0 : n.data) == null ? void 0 : o.datasets) ?? []).forEach((s) => {
3563
- const i = s;
3564
- Reflect.set(i, "borderDash", Vr(i));
3565
- });
3566
- }
3567
- };
3568
- }
3569
- const $r = { class: "widget-content" }, Hr = /* @__PURE__ */ Ne({
3570
- __name: "WidgetStackLineChart",
3571
- props: /* @__PURE__ */ Xe({
3572
- tileIndex: {}
3573
- }, {
3574
- modelValue: { required: !0 },
3575
- modelModifiers: {}
3576
- }),
3577
- emits: ["update:modelValue"],
3578
- setup(e) {
3579
- const n = e, t = Ee(e, "modelValue"), o = D(null), s = m(() => t.value.maxTooltipItems), {
3580
- isTooltipDetailsSheetOpen: i,
3581
- tooltipDetailsPayload: l,
3582
- tooltipOptions: h,
3583
- handleTooltipDetailsSheetVisibility: c,
3584
- handleTooltipDetailsHover: C,
3585
- handleTooltipDetailsLeave: N
3586
- } = Wt(o, {
3587
- maxTooltipItems: s
3588
- }), $ = m(() => {
3589
- var R;
3590
- return ((R = t.value.data) == null ? void 0 : R.xAxis) ?? [];
3591
- }), F = m(
3592
- () => $.value.length === 1 && g.value.length > 0 && g.value.every((R) => R.values.length === 1)
3593
- ), y = m(() => F.value ? ["", $.value[0], ""] : $.value), g = m(() => {
3594
- var R;
3595
- return ((R = t.value.data) == null ? void 0 : R.datasets) ?? [];
3596
- }), { datalabels: I, xCfg: T, yCfg: B, isTransposed: v, legend: f, chartWidth: k, chartHeight: L } = Dt(
3597
- t.value
3598
- ), x = m(
3599
- () => Lt(t.value.isTransposed === !0, h.value)
3600
- ), A = $t("line"), w = vo("report-line-style-plugin-stack-line"), u = m(() => {
3601
- const R = f.value.position;
3602
- return !R || R === "top" || R === "bottom" || R === "left" || R === "right";
3603
- }), M = m(() => f.value.position ?? "top"), W = m(
3604
- () => M.value === "left" || M.value === "right"
3605
- ), q = m(
3606
- () => M.value === "top" || M.value === "left"
3607
- ), ee = m(() => g.value.length > 0 ? [
3608
- ...g.value.map((R, P) => {
3609
- var ce;
3610
- let V = R.values;
3611
- F.value && (V = [NaN, V[0], NaN]);
3612
- const ne = V.map((xe) => xe === null ? NaN : Number(xe)), K = Fe({
3613
- datasetIndex: P,
3614
- isCompare: R.isCompare,
3615
- metricCount: t.value.metricCount,
3616
- mode: t.value.chartColorBinding
3617
- }), X = Fe({
3618
- datasetIndex: P,
3619
- isCompare: R.isCompare,
3620
- metricCount: t.value.metricCount,
3621
- mode: _e.metric
3622
- }), Z = Fe({
3623
- datasetIndex: P,
3624
- isCompare: R.isCompare,
3625
- metricCount: t.value.metricCount,
3626
- mode: t.value.lineStyleBinding
3627
- }), le = (ce = t.value.lineStyles) == null ? void 0 : ce[Z], ue = t.value.chartColorBinding === _e.breakdown, me = wt({
3628
- fallbackIndex: P,
3629
- metricCount: t.value.metricCount
3630
- }), se = ue ? Tt({
3631
- breakdownIndex: me,
3632
- metricIndex: X,
3633
- metricCount: t.value.metricCount,
3634
- isCompare: R.isCompare,
3635
- breakdownColors: t.value.chartBreakdownColors,
3636
- useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
3637
- customColors: t.value.chartColors
3638
- }) : tt({
3639
- index: K,
3640
- isCompare: R.isCompare,
3641
- customColors: t.value.chartColors
3642
- });
3643
- return {
3644
- label: R.name,
3645
- data: ne,
3646
- dash: R.isCompare,
3647
- lineStyle: le,
3648
- fill: !0,
3649
- color: se,
3650
- pointRadius: F.value ? 4 : void 0,
3651
- pointHoverRadius: F.value ? 6 : void 0,
3652
- pointBackgroundColor: F.value ? se : void 0,
3653
- pointBorderColor: F.value ? se : void 0,
3654
- pointBorderWidth: F.value ? 2 : void 0
3655
- };
3656
- })
3657
- ] : []), { hiddenDatasetKeys: G, isDatasetHidden: ie, toggleDatasetVisibility: J } = Et(ee), _ = m(
3658
- () => ee.value.map((R, P) => ({
3659
- ...R,
3660
- hidden: ie(R, P)
3661
- }))
3662
- ), E = kt();
3663
- function z() {
3664
- return E.extractChartSize(o.value, n.tileIndex) || { width: 0, height: 0 };
3665
- }
3666
- return $e(() => {
3667
- Me(() => {
3668
- z();
3669
- });
3670
- }), we([_], () => {
3671
- Me(() => z());
3672
- }), (R, P) => {
3673
- var ne, K, X, Z, le, ue;
3674
- const V = pe("FmLineChart");
3675
- return Y(), fe(Ve, null, [
3676
- Q("div", $r, [
3677
- nt(R.$slots, "menu"),
3678
- Q("div", {
3679
- class: Ie(["chart-layout", {
3680
- "chart-layout--side": u.value && (r(f).display ?? !1) && W.value
3681
- }])
3682
- }, [
3683
- u.value && (r(f).display ?? !1) && q.value ? (Y(), ge(ze, {
3684
- key: 0,
3685
- "chart-ref": o.value,
3686
- enabled: r(f).display ?? !1,
3687
- position: M.value,
3688
- "max-width": r(f).maxWidth,
3689
- "text-color": (ne = r(f).labels) == null ? void 0 : ne.color,
3690
- "font-size": (X = (K = r(f).labels) == null ? void 0 : K.font) == null ? void 0 : X.size,
3691
- "legend-update-key": _.value,
3692
- "use-point-style": t.value.usePointStyle ?? !0,
3693
- "chart-color-binding": t.value.chartColorBinding,
3694
- "chart-colors": t.value.chartColors,
3695
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3696
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3697
- "metric-count": t.value.metricCount,
3698
- "hidden-dataset-keys": r(G),
3699
- onToggleDatasetVisibility: r(J)
3700
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0),
3701
- he(V, {
3702
- ref_key: "chartRef",
3703
- ref: o,
3704
- class: "line-chart",
3705
- datasets: _.value,
3706
- "x-axis": { categories: y.value },
3707
- "x-cfg": r(T),
3708
- "y-cfg": r(B),
3709
- transpose: r(v),
3710
- legend: {
3711
- display: !1
3712
- },
3713
- tooltip: x.value,
3714
- plugins: [r(A), r(w)],
3715
- stacked: !0,
3716
- datalabels: r(I),
3717
- "maintain-aspect-ratio": !1,
3718
- style: De({
3719
- "--chart-width": u.value && (r(f).display ?? !1) && W.value ? "calc(100% - var(--legend-panel-width, 0px))" : r(k) !== void 0 ? r(k) + "px" : "100%",
3720
- "--chart-height": u.value && (r(f).display ?? !1) && !W.value ? "calc(100% - var(--legend-panel-height, 0px))" : r(L) !== void 0 ? r(L) + "px" : "100%"
3721
- })
3722
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "tooltip", "plugins", "datalabels", "style"]),
3723
- u.value && (r(f).display ?? !1) && !q.value ? (Y(), ge(ze, {
3724
- key: 1,
3725
- "chart-ref": o.value,
3726
- enabled: r(f).display ?? !1,
3727
- position: M.value,
3728
- "max-width": r(f).maxWidth,
3729
- "text-color": (Z = r(f).labels) == null ? void 0 : Z.color,
3730
- "font-size": (ue = (le = r(f).labels) == null ? void 0 : le.font) == null ? void 0 : ue.size,
3731
- "legend-update-key": _.value,
3732
- "use-point-style": t.value.usePointStyle ?? !0,
3733
- "chart-color-binding": t.value.chartColorBinding,
3734
- "chart-colors": t.value.chartColors,
3735
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3736
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3737
- "metric-count": t.value.metricCount,
3738
- "hidden-dataset-keys": r(G),
3739
- onToggleDatasetVisibility: r(J)
3740
- }, null, 8, ["chart-ref", "enabled", "position", "max-width", "text-color", "font-size", "legend-update-key", "use-point-style", "chart-color-binding", "chart-colors", "chart-breakdown-colors", "chart-use-secondary-metric-shades", "metric-count", "hidden-dataset-keys", "onToggleDatasetVisibility"])) : be("", !0)
3741
- ], 2)
3742
- ]),
3743
- he(Ht, {
3744
- "model-value": r(i),
3745
- "details-payload": r(l),
3746
- "onUpdate:modelValue": r(c),
3747
- onValueHover: r(C),
3748
- onValueLeave: r(N)
3749
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
3750
- ], 64);
3751
- };
3752
- }
3753
- }), _t = [
3754
- "col-span-1",
3755
- "col-span-2",
3756
- "col-span-3",
3757
- "col-span-4",
3758
- "col-span-5",
3759
- "col-span-6",
3760
- "col-span-7",
3761
- "col-span-8",
3762
- "col-span-9",
3763
- "col-span-10",
3764
- "col-span-11",
3765
- "col-span-12"
3766
- ];
3767
- function Wr(e) {
3768
- return e < 12 ? _t[e - 1] : _t[11];
3769
- }
3770
- function Er(e) {
3771
- return e < 12 ? _t[Math.min(11, e * 2 - 1)] : _t[11];
3772
- }
3773
- function Or(e) {
3774
- return e < 12 ? _t[Math.min(11, e * 3 - 1)] : _t[11];
3775
- }
3776
- const Ur = { class: "widget-content" }, Kr = /* @__PURE__ */ Ne({
3777
- __name: "WidgetLinechart",
3778
- props: /* @__PURE__ */ Xe({
3779
- tileIndex: {}
3780
- }, {
3781
- modelValue: { required: !0 },
3782
- modelModifiers: {}
3783
- }),
3784
- emits: ["update:modelValue"],
3785
- setup(e) {
3786
- const n = e, t = Ee(e, "modelValue"), o = D(null), s = m(() => t.value.maxTooltipItems), {
3787
- isTooltipDetailsSheetOpen: i,
3788
- tooltipDetailsPayload: l,
3789
- tooltipOptions: h,
3790
- handleTooltipDetailsSheetVisibility: c,
3791
- handleTooltipDetailsHover: C,
3792
- handleTooltipDetailsLeave: N
3793
- } = Wt(o, {
3794
- maxTooltipItems: s
3795
- }), $ = m(() => {
3796
- var P;
3797
- return ((P = t.value.data) == null ? void 0 : P.datasets) ?? [];
3798
- }), F = m(() => {
3799
- var P;
3800
- return ((P = t.value.data) == null ? void 0 : P.xAxis) ?? [];
3801
- }), y = m(() => F.value.length === 1 && $.value.length > 1 && $.value.every((P) => P.values.length === 1 && P.isCompare !== !0)), g = m(
3802
- () => F.value.length === 1 && $.value.length > 0 && $.value.every((P) => P.values.length === 1)
3803
- ), I = m(() => y.value ? $.value.map((P) => P.name) : g.value ? ["", F.value[0], ""] : F.value), { datalabels: T, xCfg: B, yCfg: v, isTransposed: f, legend: k, chartWidth: L, chartHeight: x } = Dt(
3804
- t.value
3805
- ), A = m(
3806
- () => Lt(t.value.isTransposed === !0, h.value)
3807
- ), w = $t("line"), u = vo("report-line-style-plugin-line"), M = m(() => {
3808
- const P = k.value.position;
3809
- return !P || P === "top" || P === "bottom" || P === "left" || P === "right";
3810
- }), W = m(() => k.value.position ?? "top"), q = m(
3811
- () => W.value === "left" || W.value === "right"
3812
- ), ee = m(
3813
- () => W.value === "top" || W.value === "left"
3814
- ), G = m(() => $.value.length > 0 ? [
3815
- ...$.value.map((P, V) => {
3816
- var He;
3817
- const ne = Fe({
3818
- datasetIndex: V,
3819
- isCompare: P.isCompare,
3820
- metricCount: t.value.metricCount,
3821
- mode: t.value.chartColorBinding
3822
- }), K = Fe({
3823
- datasetIndex: V,
3824
- isCompare: P.isCompare,
3825
- metricCount: t.value.metricCount,
3826
- mode: _e.metric
3827
- }), X = tt({
3828
- index: ne,
3829
- isCompare: P.isCompare,
3830
- customColors: t.value.chartColors
3831
- }), Z = t.value.chartColorBinding === _e.breakdown, le = wt({
3832
- fallbackIndex: V,
3833
- metricCount: t.value.metricCount
3834
- }), ue = Z ? Tt({
3835
- breakdownIndex: le,
3836
- metricIndex: K,
3837
- metricCount: t.value.metricCount,
3838
- isCompare: P.isCompare,
3839
- breakdownColors: t.value.chartBreakdownColors,
3840
- useSecondaryMetricShades: t.value.chartUseSecondaryMetricShades,
3841
- customColors: t.value.chartColors
3842
- }) : X;
3843
- let me = P.values;
3844
- y.value ? me = $.value.map(
3845
- (We, Ye) => Ye === V ? P.values[0] : NaN
3846
- ) : g.value && (me = [NaN, me[0], NaN]);
3847
- const se = me.map((We) => We === null ? NaN : Number(We)), ce = g.value || y.value, xe = Fe({
3848
- datasetIndex: V,
3849
- isCompare: P.isCompare,
3850
- metricCount: t.value.metricCount,
3851
- mode: t.value.lineStyleBinding
3852
- }), Be = (He = t.value.lineStyles) == null ? void 0 : He[xe];
3853
- return {
3854
- label: P.name,
3855
- data: se,
3856
- dash: !!P.isCompare,
3857
- lineStyle: Be,
3858
- fill: !1,
3859
- color: ue,
3860
- pointRadius: ce ? 4 : void 0,
3861
- pointHoverRadius: ce ? 6 : void 0,
3862
- pointBackgroundColor: ce ? ue : void 0,
3863
- pointBorderColor: ce ? ue : void 0,
3864
- pointBorderWidth: ce ? 2 : void 0
3865
- };
3866
- })
3867
- ] : []), { hiddenDatasetKeys: ie, isDatasetHidden: J, toggleDatasetVisibility: _ } = Et(G), E = m(
3868
- () => G.value.map((P, V) => ({
3869
- ...P,
3870
- hidden: J(P, V)
3871
- }))
3872
- ), z = kt();
3873
- function R() {
3874
- return z.extractChartSize(o.value, n.tileIndex) || { width: 0, height: 0 };
3875
- }
3876
- return $e(() => {
3877
- Me(() => {
3878
- R();
3879
- });
3880
- }), we([E], () => {
3881
- Me(() => R());
3882
- }), (P, V) => {
3883
- var K, X, Z, le, ue, me;
3884
- const ne = pe("FmLineChart");
3885
- return Y(), fe(Ve, null, [
3886
- Q("div", Ur, [
3887
- nt(P.$slots, "menu"),
3888
- Q("div", {
3889
- class: Ie(["chart-layout", {
3890
- "chart-layout--side": M.value && (r(k).display ?? !1) && q.value
3891
- }])
3892
- }, [
3893
- M.value && (r(k).display ?? !1) && ee.value ? (Y(), ge(ze, {
3894
- key: 0,
3895
- "chart-ref": o.value,
3896
- enabled: r(k).display ?? !1,
3897
- position: W.value,
3898
- "max-width": r(k).maxWidth,
3899
- "text-color": (K = r(k).labels) == null ? void 0 : K.color,
3900
- "font-size": (Z = (X = r(k).labels) == null ? void 0 : X.font) == null ? void 0 : Z.size,
3901
- "legend-update-key": E.value,
3902
- "chart-color-binding": t.value.chartColorBinding,
3903
- "chart-colors": t.value.chartColors,
3904
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3905
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3906
- "metric-count": t.value.metricCount,
3907
- "hidden-dataset-keys": r(ie),
3908
- "use-point-style": t.value.usePointStyle ?? !0,
3909
- onToggleDatasetVisibility: r(_)
3910
- }, 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", "use-point-style", "onToggleDatasetVisibility"])) : be("", !0),
3911
- he(ne, {
3912
- ref_key: "chartRef",
3913
- ref: o,
3914
- class: "line-chart",
3915
- datasets: E.value,
3916
- "x-axis": { categories: I.value },
3917
- "x-cfg": r(B),
3918
- "y-cfg": r(v),
3919
- transpose: r(f),
3920
- legend: {
3921
- display: !1
3922
- },
3923
- tooltip: A.value,
3924
- datalabels: r(T),
3925
- plugins: [r(w), r(u)],
3926
- "maintain-aspect-ratio": !1,
3927
- style: De({
3928
- "--chart-width": M.value && (r(k).display ?? !1) && q.value ? "calc(100% - var(--legend-panel-width, 0px))" : r(L) !== void 0 ? r(L) + "px" : "100%",
3929
- "--chart-height": M.value && (r(k).display ?? !1) && !q.value ? "calc(100% - var(--legend-panel-height, 0px))" : r(x) !== void 0 ? r(x) + "px" : "100%"
3930
- })
3931
- }, null, 8, ["datasets", "x-axis", "x-cfg", "y-cfg", "transpose", "tooltip", "datalabels", "plugins", "style"]),
3932
- M.value && (r(k).display ?? !1) && !ee.value ? (Y(), ge(ze, {
3933
- key: 1,
3934
- "chart-ref": o.value,
3935
- enabled: r(k).display ?? !1,
3936
- position: W.value,
3937
- "max-width": r(k).maxWidth,
3938
- "text-color": (le = r(k).labels) == null ? void 0 : le.color,
3939
- "font-size": (me = (ue = r(k).labels) == null ? void 0 : ue.font) == null ? void 0 : me.size,
3940
- "legend-update-key": E.value,
3941
- "chart-color-binding": t.value.chartColorBinding,
3942
- "chart-colors": t.value.chartColors,
3943
- "chart-breakdown-colors": t.value.chartBreakdownColors,
3944
- "chart-use-secondary-metric-shades": t.value.chartUseSecondaryMetricShades,
3945
- "metric-count": t.value.metricCount,
3946
- "hidden-dataset-keys": r(ie),
3947
- "use-point-style": t.value.usePointStyle ?? !0,
3948
- onToggleDatasetVisibility: r(_)
3949
- }, 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", "use-point-style", "onToggleDatasetVisibility"])) : be("", !0)
3950
- ], 2)
3951
- ]),
3952
- he(Ht, {
3953
- "model-value": r(i),
3954
- "details-payload": r(l),
3955
- "onUpdate:modelValue": r(c),
3956
- onValueHover: r(C),
3957
- onValueLeave: r(N)
3958
- }, null, 8, ["model-value", "details-payload", "onUpdate:modelValue", "onValueHover", "onValueLeave"])
3959
- ], 64);
3960
- };
3961
- }
3962
- }), qr = { class: "flex flex-col gap-16" }, Xr = { class: "flex flex-row" }, Yr = /* @__PURE__ */ Ne({
3963
- __name: "PdfOrientationDialog",
3964
- props: /* @__PURE__ */ Xe({
3965
- reportType: {},
3966
- index: {}
3967
- }, {
3968
- modelValue: { type: Boolean, required: !0 },
3969
- modelModifiers: {}
3970
- }),
3971
- emits: ["update:modelValue"],
3972
- setup(e) {
3973
- const { t: n } = ut(), { FmForm: t } = Xo, o = e, s = D(), i = Ee(e, "modelValue"), l = D(!0), h = D(!1), c = Tn(), { selectedLocationIds: C, dateRange: N, timeRange: $ } = it(on()), F = D(dn.PORTRAIT);
3974
- function y() {
3975
- var I;
3976
- (I = s.value) == null || I.validateInputs();
3977
- }
3978
- async function g() {
3979
- h.value = !0;
3980
- try {
3981
- o.index != null && await no({
3982
- reportType: o.reportType,
3983
- index: o.index,
3984
- orientationTypes: [F.value],
3985
- isCombinedLocationLayout: l.value,
3986
- timeRange: $.value,
3987
- dateRange: N.value,
3988
- locationIds: C.value
3989
- });
3990
- } catch (I) {
3991
- c.open({ message: I.message, type: "error" });
3992
- } finally {
3993
- h.value = !1;
3994
- }
3995
- }
3996
- return (I, T) => {
3997
- const B = pe("FmRadio"), v = pe("FmRadioGroup"), f = pe("FmButton"), k = pe("FmDialog");
3998
- return Y(), ge(k, {
3999
- modelValue: i.value,
4000
- "onUpdate:modelValue": T[2] || (T[2] = (L) => i.value = L),
4001
- overlay: !0,
4002
- "z-index": 10
4003
- }, {
4004
- "dialog-header": Le(() => T[3] || (T[3] = [
4005
- Fo("Select Orientation")
4006
- ])),
4007
- default: Le(() => [
4008
- he(r(t), {
4009
- ref_key: "form",
4010
- ref: s,
4011
- onValidationSuccess: g
4012
- }, {
4013
- default: Le(() => [
4014
- Q("div", qr, [
4015
- he(v, {
4016
- modelValue: F.value,
4017
- "onUpdate:modelValue": T[0] || (T[0] = (L) => F.value = L)
4018
- }, {
4019
- default: Le(() => [
4020
- he(B, {
4021
- value: r(dn).PORTRAIT,
4022
- label: r(n)("report.common.portrait")
4023
- }, null, 8, ["value", "label"]),
4024
- he(B, {
4025
- value: r(dn).LANDSCAPE,
4026
- label: r(n)("report.common.landscape")
4027
- }, null, 8, ["value", "label"])
4028
- ]),
4029
- _: 1
4030
- }, 8, ["modelValue"])
4031
- ]),
4032
- Q("div", Xr, [
4033
- T[4] || (T[4] = Q("div", { class: "grow" }, null, -1)),
4034
- he(f, {
4035
- label: r(n)("report.common.cancel"),
4036
- variant: "tertiary",
4037
- onClick: T[1] || (T[1] = (L) => i.value = !1)
4038
- }, null, 8, ["label"]),
4039
- Q("div", null, [
4040
- he(f, {
4041
- label: r(n)("report.common.download"),
4042
- loading: h.value,
4043
- onClick: y
4044
- }, null, 8, ["label", "loading"])
4045
- ])
4046
- ])
4047
- ]),
4048
- _: 1
4049
- }, 512)
4050
- ]),
4051
- _: 1
4052
- }, 8, ["modelValue"]);
4053
- };
4054
- }
4055
- });
4056
- function Gr(e) {
4057
- const { breakpoints: n } = rn(), { containerRef: t, isTable: o = D(!0) } = e;
4058
- let s = D(1), i = null, l = null, h = null, c = null, C = null, N = null;
4059
- function $() {
4060
- return t.value ? t.value.querySelector("table") : null;
4061
- }
4062
- function F() {
4063
- var w;
4064
- const x = [];
4065
- t.value && t.value.querySelectorAll("div,section,main,article,aside").forEach((u) => {
4066
- if (u.scrollWidth > u.clientWidth) {
4067
- const M = window.getComputedStyle(u);
4068
- (M.overflowX === "auto" || M.overflowX === "scroll") && x.push(u);
4069
- }
4070
- });
4071
- let A = (w = t.value) == null ? void 0 : w.parentElement;
4072
- for (; A; ) {
4073
- if (A.scrollWidth > A.clientWidth) {
4074
- const u = window.getComputedStyle(A);
4075
- (u.overflowX === "auto" || u.overflowX === "scroll") && x.push(A);
4076
- }
4077
- A = A.parentElement;
4078
- }
4079
- return x;
4080
- }
4081
- function y() {
4082
- if (k(), !o.value || !t.value || (l = $(), !l) || (h = l.querySelector("thead"), !h)) return;
4083
- i = document.createElement("div"), i.className = "sticky-header-clone", i.style.cssText = `
4084
- position: fixed;
4085
- top: ${s.value}px;
4086
- left: 0;
4087
- right: 0;
4088
- z-index: 9;
4089
- overflow: hidden;
4090
- pointer-events: none;
4091
- visibility: hidden;
4092
- `;
4093
- const x = document.createElement("table");
4094
- x.className = l.className, x.style.cssText = `
4095
- table-layout: fixed;
4096
- width: ${l.offsetWidth}px;
4097
- margin: 0;
4098
- border-collapse: collapse;
4099
- pointer-events: auto;
4100
- `;
4101
- const A = h.cloneNode(!0);
4102
- A.style.cssText = "pointer-events: auto;", g(h, A), x.appendChild(A), i.appendChild(x), document.body.appendChild(i), B(), v(), f(), T();
4103
- }
4104
- function g(x, A) {
4105
- const w = x.querySelectorAll("th, td"), u = A.querySelectorAll("th, td");
4106
- w.forEach((M, W) => {
4107
- const q = u[W];
4108
- if (!q) return;
4109
- const ee = M, G = window.getComputedStyle(ee);
4110
- Object.assign(q.style, {
4111
- width: `${ee.offsetWidth}px`,
4112
- minWidth: `${ee.offsetWidth}px`,
4113
- maxWidth: `${ee.offsetWidth}px`,
4114
- height: `${ee.offsetHeight}px`,
4115
- padding: G.padding,
4116
- backgroundColor: G.backgroundColor,
4117
- borderBottom: G.borderBottom,
4118
- fontSize: G.fontSize,
4119
- fontWeight: G.fontWeight,
4120
- textAlign: G.textAlign,
4121
- verticalAlign: G.verticalAlign,
4122
- boxSizing: "border-box",
4123
- cursor: G.cursor || "pointer",
4124
- pointerEvents: "auto"
4125
- }), q.onclick = (ie) => {
4126
- ie.preventDefault(), ie.stopPropagation();
4127
- const J = ee.querySelector(
4128
- "button, a, [role='button']"
4129
- );
4130
- J ? J.click() : ee.click();
4131
- };
4132
- });
4133
- }
4134
- function I() {
4135
- const x = n.value.xs || n.value.sm, A = document.querySelector('[data-editor-header="true"]'), w = document.querySelector('[data-menu-tab="true"]');
4136
- if (x && !A)
4137
- return 1;
4138
- if (A)
4139
- return A.getBoundingClientRect().bottom;
4140
- if (w) {
4141
- let u = w;
4142
- for (; u; ) {
4143
- if (window.getComputedStyle(u).position === "sticky")
4144
- return u.getBoundingClientRect().bottom;
4145
- u = u.parentElement;
4146
- }
4147
- return w.getBoundingClientRect().bottom;
4148
- }
4149
- return s.value;
4150
- }
4151
- function T() {
4152
- if (!i || !l || !h || !t.value) return;
4153
- const x = t.value.getBoundingClientRect(), A = l.getBoundingClientRect(), w = h.getBoundingClientRect(), u = I();
4154
- if (!(A.top <= u && A.bottom >= u + w.height)) {
4155
- i.style.visibility = "hidden";
4156
- return;
4157
- }
4158
- i.style.visibility = "visible", i.style.top = `${u}px`;
4159
- const W = window.getComputedStyle(t.value), q = parseFloat(W.paddingLeft) || 0, ee = parseFloat(W.paddingRight) || 0, G = x.left + q, ie = x.right - ee, J = Math.max(G, x.left), _ = Math.min(ie, x.right), E = Math.max(0, _ - J);
4160
- if (E <= 0) {
4161
- i.style.visibility = "hidden";
4162
- return;
4163
- }
4164
- i.style.left = `${J}px`, i.style.width = `${E}px`;
4165
- const z = i.querySelector("table");
4166
- z && (z.style.width = `${l.offsetWidth}px`, z.style.marginLeft = `${w.left - J}px`);
4167
- }
4168
- function B() {
4169
- var A;
4170
- C = () => requestAnimationFrame(T), window.addEventListener("scroll", C, { passive: !0 }), F().forEach((w) => {
4171
- C && w.addEventListener("scroll", C, { passive: !0 });
4172
- });
4173
- let x = (A = t.value) == null ? void 0 : A.parentElement;
4174
- for (; x; )
4175
- x !== document.body && (x.scrollHeight > x.clientHeight || x.scrollWidth > x.clientWidth) && x.addEventListener("scroll", C, { passive: !0 }), x = x.parentElement;
4176
- }
4177
- function v() {
4178
- c = new ResizeObserver(() => {
4179
- if (h && i) {
4180
- const x = i.querySelector("thead");
4181
- x && g(h, x);
4182
- const A = i.querySelector("table");
4183
- A && l && (A.style.width = `${l.offsetWidth}px`);
4184
- }
4185
- T();
4186
- }), t.value && c.observe(t.value), l && c.observe(l);
4187
- }
4188
- function f() {
4189
- if (!h) return;
4190
- const x = mn(() => y(), 100), A = () => {
4191
- if (h && i) {
4192
- const w = i.querySelector("thead");
4193
- w && g(h, w), T();
4194
- }
4195
- };
4196
- N = new MutationObserver((w) => {
4197
- w.some((M) => M.type === "childList" ? M.addedNodes.length > 0 || M.removedNodes.length > 0 : !1) ? x() : A();
4198
- }), N.observe(h, {
4199
- childList: !0,
4200
- subtree: !0,
4201
- attributes: !0,
4202
- characterData: !0
4203
- });
4204
- }
4205
- function k() {
4206
- var x;
4207
- if (i && (i.remove(), i = null), C) {
4208
- window.removeEventListener("scroll", C), F().forEach((w) => {
4209
- C && w.removeEventListener("scroll", C);
4210
- });
4211
- let A = (x = t.value) == null ? void 0 : x.parentElement;
4212
- for (; A; )
4213
- A.removeEventListener("scroll", C), A = A.parentElement;
4214
- C = null;
4215
- }
4216
- c && (c.disconnect(), c = null), N && (N.disconnect(), N = null), l = null, h = null;
4217
- }
4218
- function L() {
4219
- y();
4220
- }
4221
- return we(o, (x) => {
4222
- x ? y() : k();
4223
- }), we(s, () => {
4224
- i && (i.style.top = `${s.value}px`, T());
4225
- }), we(t, () => {
4226
- t.value && o.value && setTimeout(y, 100);
4227
- }), $e(() => {
4228
- o.value && setTimeout(y, 100);
4229
- }), to(() => {
4230
- k();
4231
- }), { refresh: L, cleanup: k };
4232
- }
4233
- const jr = {
4234
- key: 1,
4235
- class: "grow"
4236
- }, Jr = {
4237
- key: 2,
4238
- class: "flex"
4239
- }, cl = /* @__PURE__ */ Ne({
4240
- __name: "DynamicWidget",
4241
- props: /* @__PURE__ */ Xe({
4242
- index: {
4243
- type: Number,
4244
- default: 0
4245
- },
4246
- hideExport: {
4247
- type: Boolean,
4248
- default: !1
4249
- },
4250
- customScreenWidth: {
4251
- type: Number,
4252
- required: !1,
4253
- default: void 0
4254
- },
4255
- isStyleEditing: {
4256
- type: Boolean,
4257
- default: !1
4258
- }
4259
- }, {
4260
- modelValue: { required: !0, default: () => {
4261
- } },
4262
- modelModifiers: {}
4263
- }),
4264
- emits: ["update:modelValue"],
4265
- setup(e) {
4266
- const n = D(!0), t = Ee(e, "modelValue"), o = t.value.widget.config, { t: s, te: i, locale: l } = ut(), h = e, c = D(null), C = m(() => t.value.widget.type === oe.Table), N = m(() => {
4267
- var S;
4268
- return (S = c.value) == null ? void 0 : S.$el;
4269
- }), { refresh: $ } = Gr({
4270
- containerRef: N,
4271
- isTable: C
4272
- }), F = D(o.rollup), y = D(Rt()), g = D(o.drillDimension), I = m(() => {
4273
- if (ke.value.length > 0) {
4274
- const S = ke.value.findIndex(
4275
- (ve) => ve.value === g.value
4276
- );
4277
- return S >= 0 ? S : 0;
4278
- } else
4279
- return -1;
4280
- }), T = m(() => I.value !== 0), B = m(
4281
- () => I.value != ke.value.length - 1
4282
- ), v = D(o.showTitle ?? !0), f = D(o.titleFontSize ?? 14), k = D(o.titleBold ?? !1), L = D(o.titleItalic ?? !1), x = D(o.titleUnderline ?? !1), A = D(o.chartWidth ?? void 0), w = D(o.chartHeight ?? void 0), u = D(
4283
- Array.isArray(o.chartColors) ? [...o.chartColors] : void 0
4284
- ), M = D(
4285
- Array.isArray(o.chartColorLayers) ? [...o.chartColorLayers] : void 0
4286
- ), W = D(
4287
- Array.isArray(o.chartBreakdownColors) ? [...o.chartBreakdownColors] : void 0
4288
- ), q = D(o.chartUseSecondaryMetricShades ?? !0), ee = D(o.chartColorBinding), G = D(
4289
- Array.isArray(o.lineStyles) ? [...o.lineStyles] : void 0
4290
- ), ie = D(o.lineStyleBinding), J = D(o.showLabel ?? !1), _ = D(o.labelAlign ?? yn.center), E = D(o.labelAnchor ?? gn.center), z = D(o.labelRotation ?? 0), R = D(o.labelOffset ?? 0), P = D(o.labelFontSize ?? 12), V = m(() => o.showSearchBar), ne = D(o.showX ?? !0), K = D(o.xPosition ?? bn.bottom), X = D(o.showXGrid ?? !1), Z = D(o.showXTick ?? !0), le = D(o.xTickFontSize ?? 12), ue = D(o.showXTitle ?? !1), me = D(o.xTitle ?? ""), se = D(o.xTitleFontSize ?? 12), ce = D(o.showY ?? !0), xe = D(o.yPosition ?? Cn.left), Be = D(o.showYGrid ?? !1), He = D(o.showYTick ?? !0), We = D(o.yTickFontSize ?? 12), Ye = D(o.showYTitle ?? !1), ct = D(o.yTitle ?? ""), ot = D(o.yTitleFontSize ?? 12), Ge = D(o.showLegend ?? void 0), Ot = D(o.legendPosition ?? xn.top), je = D(o.usePointStyle ?? !0), Ut = D(o.legendFontSize), Kt = D(o.legendColor ?? "#6b6b6b"), qt = D(o.legendMaxWidth), It = D(o.maxTooltipItems), Je = D(o.stackBarOverlap ?? !1), Xt = D(o.rowHeight ?? 0), Yt = D(o.colWidths ?? []), Mt = D(!1), dt = D(""), { breakpoints: Ze, getBreakpointsBoundary: at } = rn(), ft = D(), Te = m(
4291
- () => h.customScreenWidth === void 0 ? window.innerWidth : h.customScreenWidth
4292
- ), ln = m(
4293
- () => (Te == null ? void 0 : Te.value) > at("xs")[1] && (Te == null ? void 0 : Te.value) <= at("sm")[1]
4294
- ), Gt = m(
4295
- () => (Te == null ? void 0 : Te.value) > at("sm")[1] && (Te == null ? void 0 : Te.value) <= at("md")[1]
4296
- ), sn = m(() => (Te == null ? void 0 : Te.value) > at("md")[1]), un = m(() => {
4297
- const S = t.value.size.width;
4298
- return sn.value || Gt.value ? Wr(S) : ln.value ? Er(S) : Or(S);
4299
- }), ht = m(
4300
- () => Yo.find((S) => S.type === t.value.widget.type)
4301
- ), a = mn(() => {
4302
- var S;
4303
- ft.value = go((S = c.value) == null ? void 0 : S.$el.offsetWidth), y.value = Rt();
4304
- }), p = m(() => {
4305
- if (Go(ae.value.type, d.value))
4306
- switch (t.value.widget.type) {
4307
- case oe.BarChart:
4308
- return mr;
4309
- case oe.StackBarChart:
4310
- return Rr;
4311
- case oe.ClusteredStackBarChart:
4312
- return Nr;
4313
- case oe.LineChart:
4314
- return Kr;
4315
- case oe.StackLineChart:
4316
- return Hr;
4317
- case oe.Circular:
4318
- return vr;
4319
- case oe.Scorecard:
4320
- return Sr;
4321
- case oe.Spacer:
4322
- return Tr;
4323
- case oe.Table:
4324
- return Fr;
4325
- default:
4326
- return Nn;
4327
- }
4328
- else
4329
- return Nn;
4330
- }), d = D(null), { selectedLocationIds: b, dateRange: H, compareDateRange: U, timeRange: j } = it(on()), { globalFilters: te, isGlobalFiltersLoading: O } = it(Vo()), { businessId: de } = it(kn()), { businessLoadedId: ye, businessDataVersion: Ce } = it(on());
4331
- m(() => ye.value === de.value && b.value.length > 0 && !O.value);
4332
- const re = D(!0), ae = m(() => {
4333
- const S = JSON.parse(JSON.stringify(t.value.widget));
4334
- return {
4335
- ...S,
4336
- config: {
4337
- ...S.config,
4338
- rollup: F.value,
4339
- drillDimension: g.value,
4340
- showGrandTotal: !1
4341
- }
4342
- };
4343
- }), Se = m(() => {
4344
- var Re;
4345
- const S = ((Re = ae.value.config.metrics) == null ? void 0 : Re.length) ?? 0;
4346
- if (!ae.value.config.isBlend)
4347
- return S;
4348
- const ve = (ae.value.config.joinDatasources ?? []).reduce(
4349
- (lt, cn) => {
4350
- var pt;
4351
- return lt + (((pt = cn.metrics) == null ? void 0 : pt.length) ?? 0);
4352
- },
4353
- 0
4354
- );
4355
- return S + ve;
4356
- });
4357
- function Ae() {
4358
- return {
4359
- data: d.value,
4360
- showTitle: v.value,
4361
- titleFontSize: f.value,
4362
- titleBold: k.value,
4363
- titleItalic: L.value,
4364
- titleUnderline: x.value,
4365
- chartHeight: w.value,
4366
- chartWidth: A.value,
4367
- chartColors: u.value,
4368
- chartColorLayers: M.value,
4369
- chartBreakdownColors: W.value,
4370
- chartUseSecondaryMetricShades: q.value,
4371
- chartColorBinding: ee.value,
4372
- metricCount: Se.value,
4373
- lineStyles: G.value,
4374
- lineStyleBinding: ie.value,
4375
- showLabel: J.value,
4376
- labelAnchor: E.value,
4377
- labelAlign: _.value,
4378
- labelRotation: z.value,
4379
- labelOffset: R.value,
4380
- labelFontSize: P.value,
4381
- showX: ne.value,
4382
- xPosition: K.value,
4383
- showXGrid: X.value,
4384
- showXTick: Z.value,
4385
- xTickFontSize: le.value,
4386
- showXTitle: ue.value,
4387
- xTitle: me.value,
4388
- xTitleFontSize: se.value,
4389
- showY: ce.value,
4390
- yPosition: xe.value,
4391
- showYGrid: Be.value,
4392
- showYTick: He.value,
4393
- yTitle: ct.value,
4394
- showYTitle: Ye.value,
4395
- yTitleFontSize: ot.value,
4396
- yTickFontSize: We.value,
4397
- isTransposed: ae.value.config.isTransposed,
4398
- showLegend: Ge.value,
4399
- legendPosition: Ot.value,
4400
- usePointStyle: je.value,
4401
- legendFontSize: Ut.value,
4402
- legendColor: Kt.value,
4403
- legendMaxWidth: qt.value,
4404
- maxTooltipItems: It.value,
4405
- stackBarOverlap: Je.value
4406
- };
4407
- }
4408
- function Oe() {
4409
- return {
4410
- data: d.value,
4411
- filterText: dt.value,
4412
- rollupPosition: ae.value.config.rollupPosition,
4413
- grandTotalLabel: ae.value.config.grandTotalLabel,
4414
- rowHeight: Xt.value,
4415
- colWidths: Yt.value
4416
- };
4417
- }
4418
- const Ue = m(() => {
4419
- switch (ae.value.type) {
4420
- case oe.Table:
4421
- return Oe();
4422
- case oe.BarChart:
4423
- case oe.LineChart:
4424
- case oe.StackBarChart:
4425
- case oe.ClusteredStackBarChart:
4426
- case oe.StackLineChart:
4427
- case oe.Circular:
4428
- return Ae();
4429
- default:
4430
- return { data: d.value };
4431
- }
4432
- }), Qe = m(() => {
4433
- const { config: S } = t.value.widget;
4434
- if (S.rollup != null) {
4435
- const ve = [...S.dimensions].filter((Re) => !Re.hide);
4436
- return ve.sort(
4437
- (Re, lt) => (S.rowIds || []).indexOf(fn(Re)) - (S.rowIds || []).indexOf(fn(lt))
4438
- ), [
4439
- { label: st(s, i, "None", "other"), value: "none" },
4440
- { label: st(s, i, "Grand Total", "other"), value: 0 },
4441
- ...[...ve].slice(0, ve.length - 1).map((Re, lt) => ({
4442
- label: st(s, i, Re.label, "other"),
4443
- value: lt + 1
4444
- }))
4445
- ];
4446
- }
4447
- return [];
4448
- }), ke = m(() => {
4449
- const { config: S } = ae.value;
4450
- return S.isDrillable ? S.dimensions.map((ve) => ({
4451
- label: st(s, i, ve.label, "other"),
4452
- value: fn(ve)
4453
- })) : [];
4454
- }), rt = m(() => {
4455
- const S = t.value.id;
4456
- return (te.value || []).filter(
4457
- (ve) => Array.isArray(ve.tileIds) && ve.tileIds.includes(S)
4458
- );
4459
- });
4460
- we(
4461
- () => t.value.widget.config,
4462
- (S) => {
4463
- F.value = S.rollup, v.value = S.showTitle ?? !0, f.value = S.titleFontSize ?? 14, k.value = S.titleBold ?? !1, L.value = S.titleItalic ?? !1, x.value = S.titleUnderline ?? !1, w.value = S.chartHeight ?? void 0, A.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, q.value = S.chartUseSecondaryMetricShades ?? !0, ee.value = S.chartColorBinding, G.value = Array.isArray(S.lineStyles) ? [...S.lineStyles] : void 0, ie.value = S.lineStyleBinding, J.value = S.showLabel ?? !1, _.value = S.labelAlign ?? yn.center, E.value = S.labelAnchor ?? gn.center, z.value = S.labelRotation ?? 0, R.value = S.labelOffset ?? 0, P.value = S.labelFontSize ?? 12, ne.value = S.showX ?? !0, K.value = S.xPosition ?? bn.bottom, X.value = S.showXGrid ?? !1, Z.value = S.showXTick ?? !0, le.value = S.xTickFontSize ?? 12, ue.value = S.showXTitle ?? !1, me.value = S.xTitle ?? "", se.value = S.xTitleFontSize ?? 12, ce.value = S.showY ?? !0, xe.value = S.yPosition ?? Cn.left, Be.value = S.showYGrid ?? !1, He.value = S.showYTick ?? !0, We.value = S.yTickFontSize ?? 12, Ye.value = S.showYTitle ?? !1, ct.value = S.yTitle ?? "", ot.value = S.yTitleFontSize ?? 12, Ge.value = S.showLegend ?? void 0, Ot.value = S.legendPosition ?? xn.top, je.value = S.usePointStyle ?? !0, Ut.value = S.legendFontSize, Kt.value = S.legendColor ?? "#6b6b6b", qt.value = S.legendMaxWidth, It.value = S.maxTooltipItems, Je.value = S.stackBarOverlap ?? !1, Xt.value = S.rowHeight ?? 0, Yt.value = S.colWidths ?? [], y.value = Rt();
4464
- },
4465
- { deep: !0 }
4466
- ), we([() => F.value], () => {
4467
- F.value !== null && (t.value.widget.config.rollup = F.value);
4468
- }), we(
4469
- [
4470
- () => ae.value,
4471
- () => H.value,
4472
- () => j.value,
4473
- () => U.value,
4474
- () => b.value,
4475
- () => rt.value,
4476
- () => Ce.value
4477
- ],
4478
- () => {
4479
- Bt();
4480
- },
4481
- { deep: !0 }
4482
- ), we(
4483
- [() => t.value.size],
4484
- () => {
4485
- a();
4486
- },
4487
- { deep: !0 }
4488
- ), $e(() => {
4489
- a(), Ze.value.sm || Ze.value.md || Ze.value.xs ? (console.log("Ignoring resize event due to keyboard"), addEventListener("change", a)) : addEventListener("resize", a), Bt();
4490
- }), to(() => {
4491
- Ze.value.sm || Ze.value.md || Ze.value.xs ? (console.log("Ignoring resize event due to keyboard"), removeEventListener("change", a)) : removeEventListener("resize", a);
4492
- });
4493
- const jt = Tn();
4494
- let mt;
4495
- async function Bt() {
4496
- if (!h.isStyleEditing) {
4497
- if (ae.value.config.schemaNames.length <= 0 && !(ae.value.config.dimensions.length <= 0 || ae.value.config.metrics.length <= 0)) {
4498
- jt.open({
4499
- message: "schema must not be empty and dimension or metrics must have at least 1 column",
4500
- type: "info"
4501
- }), n.value = !1;
4502
- return;
4503
- }
4504
- try {
4505
- n.value = !0, mt && mt.abort(), mt = new AbortController();
4506
- const S = mt.signal, ve = Ce.value, Re = await mn(
4507
- $o,
4508
- 500
4509
- )({
4510
- widget: ae.value,
4511
- signal: S,
4512
- tileId: t.value.id
4513
- });
4514
- Ce.value === ve && (d.value = Re, y.value = Rt(), setTimeout(() => $(), 100)), n.value = !1;
4515
- } catch (S) {
4516
- S.code !== "ERR_CANCELED" && (d.value = null, jt.open({ message: `Invalid chart ${ae.value.type}`, type: "error" }), console.log(S), n.value = !1);
4517
- }
4518
- }
4519
- }
4520
- function go(S) {
4521
- switch (t.value.widget.type) {
4522
- case "SPACER":
4523
- return;
4524
- case "SCORECARD":
4525
- return;
4526
- case "TABLE":
4527
- return `${t.value.size.height * 100 + (V.value ? 72 : 0) + 96.5}px`;
4528
- }
4529
- return `${Math.max(S / t.value.size.width, 90) * t.value.size.height}px`;
4530
- }
4531
- function yo() {
4532
- const S = I.value - 1;
4533
- S >= 0 && (g.value = ke.value[S].value);
4534
- }
4535
- function bo() {
4536
- const S = I.value + 1;
4537
- S >= 0 && S < ke.value.length && (g.value = ke.value[S].value);
4538
- }
4539
- const Pn = D(gt.EXCEL), Fn = D(), Co = Object.values(gt).map((S) => ({
4540
- label: Ho(S),
4541
- value: S,
4542
- onClick: async () => {
4543
- S === gt.EXCEL || S === gt.PDFFULLSIZE || S === gt.PDFRECEIPT ? await no({
4544
- reportType: S,
4545
- index: h.index,
4546
- isCombinedLocationLayout: re.value,
4547
- timeRange: j.value,
4548
- dateRange: H.value,
4549
- locationIds: b.value
4550
- }) : S === gt.PDF && (Pn.value = S, Fn.value = h.index, Mt.value = !0);
4551
- }
4552
- })), xo = ae.value.type === oe.Spacer ? "flat" : "outlined", wo = ae.value.type === oe.Spacer ? "p-0" : "p-16";
4553
- return (S, ve) => {
4554
- const Re = pe("FmTooltip"), lt = pe("FmSearch"), cn = pe("FmCheckbox"), pt = pe("FmButton"), So = pe("FmSelect"), _o = pe("FmMenuItem"), ko = pe("FmMenu"), To = pe("FmForm"), Lo = pe("FmCircularProgress"), Do = pe("FmCard");
4555
- return Y(), ge(Do, {
4556
- ref_key: "tileCard",
4557
- ref: c,
4558
- class: Ie(`${un.value} ${r(wo)}`),
4559
- variant: r(xo)
4560
- }, {
4561
- default: Le(() => [
4562
- he(Yr, {
4563
- modelValue: Mt.value,
4564
- "onUpdate:modelValue": ve[0] || (ve[0] = (vt) => Mt.value = vt),
4565
- "report-type": Pn.value,
4566
- index: Fn.value
4567
- }, null, 8, ["modelValue", "report-type", "index"]),
4568
- !n.value && !r(O) ? (Y(), fe("div", {
4569
- key: 0,
4570
- style: De({ height: ft.value })
4571
- }, [
4572
- (Y(), ge(eo(p.value), {
4573
- key: y.value,
4574
- modelValue: Ue.value,
4575
- "onUpdate:modelValue": ve[4] || (ve[4] = (vt) => Ue.value = vt),
4576
- "tile-index": h.index
4577
- }, {
4578
- menu: Le(() => [
4579
- he(To, { class: "flex items-center gap-2" }, {
4580
- default: Le(() => {
4581
- var vt, An, Rn, zn;
4582
- return [
4583
- he(Re, {
4584
- variant: "plain",
4585
- placement: "right",
4586
- content: ae.value.description,
4587
- "hide-arrow": !0,
4588
- disabled: !ae.value.description,
4589
- "z-index": 99
4590
- }, {
4591
- default: Le(() => [
4592
- v.value !== !1 ? (Y(), fe("p", {
4593
- key: 0,
4594
- style: De({
4595
- fontSize: f.value + "px",
4596
- fontWeight: k.value ? "bold" : "normal",
4597
- fontStyle: L.value ? "italic" : "normal",
4598
- textDecoration: x.value ? "underline" : "none"
4599
- }),
4600
- class: Ie(["text-fm-color-typo-secondary line-clamp-1", [
4601
- f.value <= 18 ? "fm-typo-en-body-md-400" : "",
4602
- ae.value.description ? "border-b-2 border-dashed border-gray-300" : ""
4603
- ]])
4604
- }, Pe(r(st)(r(s), r(i), ae.value.title, "other")), 7)) : be("", !0)
4605
- ]),
4606
- _: 1
4607
- }, 8, ["content", "disabled"]),
4608
- (vt = ht.value) != null && vt.showSearchBar ? (Y(), ge(lt, {
4609
- key: 0,
4610
- modelValue: dt.value,
4611
- "onUpdate:modelValue": ve[1] || (ve[1] = (Ke) => dt.value = Ke),
4612
- class: "grow"
4613
- }, null, 8, ["modelValue"])) : (Y(), fe("div", jr)),
4614
- Ao(he(cn, {
4615
- modelValue: J.value,
4616
- "onUpdate:modelValue": ve[2] || (ve[2] = (Ke) => J.value = Ke),
4617
- label: "Label",
4618
- value: !1
4619
- }, null, 8, ["modelValue"]), [
4620
- [Ro, (An = ht.value) == null ? void 0 : An.showLabel]
4621
- ]),
4622
- (Rn = ht.value) != null && Rn.showDrillDimension && ke.value.length > 0 ? (Y(), fe("div", Jr, [
4623
- he(pt, {
4624
- icon: "arrow_upward",
4625
- variant: "tertiary",
4626
- disabled: !T.value,
4627
- onClick: yo
4628
- }, null, 8, ["disabled"]),
4629
- he(pt, {
4630
- icon: "arrow_downward",
4631
- variant: "tertiary",
4632
- disabled: !B.value,
4633
- onClick: bo
4634
- }, null, 8, ["disabled"])
4635
- ])) : be("", !0),
4636
- (zn = ht.value) != null && zn.showRollup && Qe.value.length > 0 ? (Y(), ge(So, {
4637
- key: `rollup-${r(l)}`,
4638
- modelValue: F.value,
4639
- "onUpdate:modelValue": ve[3] || (ve[3] = (Ke) => F.value = Ke),
4640
- class: "w-[150px]",
4641
- items: Qe.value
4642
- }, null, 8, ["modelValue", "items"])) : be("", !0),
4643
- h.hideExport ? be("", !0) : (Y(), ge(ko, {
4644
- key: 4,
4645
- shift: !0
4646
- }, {
4647
- "menu-button": Le(() => [
4648
- he(pt, {
4649
- icon: "more_vert",
4650
- variant: "tertiary"
4651
- })
4652
- ]),
4653
- default: Le(() => [
4654
- (Y(!0), fe(Ve, null, zt(r(Co), (Ke) => (Y(), ge(_o, {
4655
- key: Ke.value,
4656
- label: Ke.label,
4657
- onClick: Ke.onClick
4658
- }, null, 8, ["label", "onClick"]))), 128))
4659
- ]),
4660
- _: 1
4661
- }))
4662
- ];
4663
- }),
4664
- _: 1
4665
- })
4666
- ]),
4667
- _: 1
4668
- }, 8, ["modelValue", "tile-index"]))
4669
- ], 4)) : (Y(), ge(Lo, { key: 1 }))
4670
- ]),
4671
- _: 1
4672
- }, 8, ["class", "variant"]);
4673
- };
4674
- }
4675
- });
4676
- export {
4677
- yn as L,
4678
- et as R,
4679
- _e as S,
4680
- bn as X,
4681
- Cn as Y,
4682
- cl as _,
4683
- gn as a,
4684
- ul as b,
4685
- xn as c,
4686
- an as d,
4687
- fn as g,
4688
- Zn as u
4689
- };