@adyen/lume 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,27 +1,2783 @@
1
- import { l as s, o as t, L as i, k as o, a as p, p as l, g as h, h as n, i as C, c as B, m as G, e as d, q as g, r as k, n as v, b as A, f as S, d as c, j as f } from "./common/fc36b37b.js";
2
- import "vue";
3
- import "d3-sankey";
4
- import "d3";
5
- import "@popperjs/core";
1
+ import { defineComponent as D, ref as x, isRef as Ye, computed as d, watch as C, toRefs as N, inject as Oe, reactive as ie, onMounted as M, onBeforeUnmount as Ke, watchEffect as Je, useSlots as G, provide as pe, defineAsyncComponent as fe } from "vue";
2
+ import { format as Tt, ticks as Ot, scaleBand as te, scaleLinear as ne, line as Lt, area as xt } from "d3";
3
+ import { createPopper as $t } from "@popperjs/core";
4
+ import { sankeyLinkHorizontal as wt, sankey as It, sankeyJustify as Et } from "d3-sankey";
5
+ const Dt = /* @__PURE__ */ D({
6
+ __name: "lume-tick",
7
+ props: {
8
+ value: {
9
+ type: [String, Number],
10
+ required: !0
11
+ },
12
+ group: {
13
+ type: Object,
14
+ required: !0
15
+ },
16
+ ghost: {
17
+ type: Object,
18
+ required: !0
19
+ },
20
+ label: {
21
+ type: Object,
22
+ required: !0
23
+ },
24
+ gridline: {
25
+ type: Object,
26
+ required: !0
27
+ },
28
+ isHovered: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ isHidden: {
33
+ type: Boolean,
34
+ default: !1
35
+ },
36
+ withGridlines: {
37
+ type: Boolean,
38
+ default: !0
39
+ }
40
+ },
41
+ emits: ["click", "mouseenter"],
42
+ setup(t, { expose: e, emit: r }) {
43
+ const n = x(null);
44
+ return e({ ref: n }), { __sfc: !0, emit: r, labelRef: n };
45
+ }
46
+ });
47
+ function I(t, e, r, n, a, o, l, i) {
48
+ var u = typeof t == "function" ? t.options : t;
49
+ e && (u.render = e, u.staticRenderFns = r, u._compiled = !0), n && (u.functional = !0), o && (u._scopeId = "data-v-" + o);
50
+ var s;
51
+ if (l ? (s = function(p) {
52
+ p = p || // cached call
53
+ this.$vnode && this.$vnode.ssrContext || // stateful
54
+ this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext, !p && typeof __VUE_SSR_CONTEXT__ < "u" && (p = __VUE_SSR_CONTEXT__), a && a.call(this, p), p && p._registeredComponents && p._registeredComponents.add(l);
55
+ }, u._ssrRegister = s) : a && (s = i ? function() {
56
+ a.call(
57
+ this,
58
+ (u.functional ? this.parent : this).$root.$options.shadowRoot
59
+ );
60
+ } : a), s)
61
+ if (u.functional) {
62
+ u._injectStyles = s;
63
+ var c = u.render;
64
+ u.render = function(h, _) {
65
+ return s.call(_), c(h, _);
66
+ };
67
+ } else {
68
+ var v = u.beforeCreate;
69
+ u.beforeCreate = v ? [].concat(v, s) : [s];
70
+ }
71
+ return {
72
+ exports: t,
73
+ options: u
74
+ };
75
+ }
76
+ var Ct = function() {
77
+ var e = this, r = e._self._c, n = e._self._setupProxy;
78
+ return r("g", e._b({ staticClass: "axis__tick", class: {
79
+ "axis__tick--hovered": e.isHovered,
80
+ "axis__tick--hidden": e.isHidden
81
+ }, attrs: { "data-j-axis__tick": "" }, on: { mouseenter: function(a) {
82
+ return n.emit("mouseenter", a);
83
+ }, click: function(a) {
84
+ return n.emit("click", a);
85
+ } } }, "g", e.group, !1), [r("g", { staticClass: "axis__tick-label lume-typography--axis", attrs: { "pointer-events": "all", "data-j-axis__tick-label": "" } }, [r("rect", e._b({ staticClass: "axis__ghost", attrs: { fill: "url(#lume-tick-gradient)" } }, "rect", e.ghost, !1)), r("text", e._b({ ref: "labelRef", staticClass: "axis__label" }, "text", e.label, !1), [e._v(" " + e._s(e.value) + " ")])]), e.withGridlines ? r("line", e._b({ staticClass: "axis__grid-line" }, "line", e.gridline, !1)) : e._e()]);
86
+ }, Ht = [], Nt = /* @__PURE__ */ I(
87
+ Dt,
88
+ Ct,
89
+ Ht,
90
+ !1,
91
+ null,
92
+ "59ddc0a6",
93
+ null,
94
+ null
95
+ );
96
+ const Rt = Nt.exports;
97
+ function Qe() {
98
+ return process.env.NODE_ENV === "production";
99
+ }
100
+ function qe(t) {
101
+ return (t == null ? void 0 : t.map(
102
+ (e) => e.values.map((r) => r == null ? void 0 : r.value).flat()
103
+ ).flat()) || [];
104
+ }
105
+ function Le(t) {
106
+ return t.length === 1;
107
+ }
108
+ function St(t) {
109
+ return !!t && t.every(
110
+ (e) => "color" in e
111
+ );
112
+ }
113
+ function me(t) {
114
+ return !!t && typeof t == "object" && !Array.isArray(t);
115
+ }
116
+ function et(t, e) {
117
+ const r = { ...t };
118
+ return Object.entries(e).forEach(([n, a]) => {
119
+ r[n] = me(t[n]) && me(a) ? et(t[n], a) : a;
120
+ }), r;
121
+ }
122
+ function Bt(t) {
123
+ return t != null && me(t) && "value" in t;
124
+ }
125
+ function U(t) {
126
+ return (t == null ? void 0 : t.bandwidth) !== void 0;
127
+ }
128
+ function xe(t) {
129
+ return U(t) ? t.bandwidth() : Math.max(...t.range()) / Math.max(...t.domain());
130
+ }
131
+ const Pt = (t, e) => {
132
+ if (!t)
133
+ throw new Error("Data is not a valid array");
134
+ if (t.length === 0)
135
+ throw new Error("Cannot get highest value from empty array");
136
+ t.forEach(({ values: r }) => {
137
+ if (r.length - 1 < e)
138
+ throw new Error("Index exceeds length of at least one of the datasets");
139
+ });
140
+ };
141
+ function Gt(t, e) {
142
+ var r;
143
+ return Pt(t, e), ((r = t.reduce(
144
+ (n, a) => {
145
+ var o, l;
146
+ return (((o = n.values[e]) == null ? void 0 : o.value) ?? 0) > (((l = a.values[e]) == null ? void 0 : l.value) ?? 0) ? n : a;
147
+ }
148
+ ).values[e]) == null ? void 0 : r.value) || 0;
149
+ }
150
+ function he(t) {
151
+ const e = Ye(t) ? t.value : t;
152
+ if (!e)
153
+ throw new Error("No empty array can be created from specified data value");
154
+ const r = Math.max(
155
+ ...e.map((n) => n.values.length),
156
+ 0
157
+ );
158
+ return Array(r).fill(null);
159
+ }
160
+ function jt(t) {
161
+ return U(t) ? t.domain().length : Math.max(...t.domain());
162
+ }
163
+ function Ft(t, e) {
164
+ return (r) => Math.round(t * (1 - r) + e * r);
165
+ }
166
+ function Vt(t, e, r) {
167
+ const n = r ? t.length - e : e, a = t.slice(0, n);
168
+ return t.slice(n).concat(a);
169
+ }
170
+ function Y(t) {
171
+ if (t.groups) {
172
+ const e = Object.keys(t);
173
+ return Object.assign(
174
+ {},
175
+ ...e.map((r) => r !== "groups" ? { [r]: t[r] } : {})
176
+ );
177
+ }
178
+ return t;
179
+ }
180
+ const Mt = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce(
181
+ (e, r) => e += (r &= 63) < 36 ? r.toString(36) : r < 62 ? (r - 26).toString(36).toUpperCase() : r > 62 ? "-" : "_",
182
+ ""
183
+ );
184
+ var V = /* @__PURE__ */ ((t) => (t.DatasetLength = `Our guidelines highly recommend not having more than 5 datasets in one chart.
185
+ Learn more: https://lume.design/guidelines/datasets`, t.ColorLoop = "Colors will loop around after the 5th dataset. You can prevent this by setting specific colors for your datasets.", t.Empty = "The dataset(s) provided are empty.", t.InvalidFormat = "The string provided to format is invalid. Please refer to https://github.com/d3/d3-format for valid arguments.", t.NotContainedInSvg = "This component is an `SVGElement`, thus it is required to be inside an `<svg>` container.", t.InvalidHoveredIndex = "The provided hovered index is not valid for the data of this chart.", t.InvalidHoveredElement = "The provided hovered element is not valid for the data of this diagram.", t))(V || {});
186
+ const zt = "[lume] ";
187
+ function Z(t, e = !0) {
188
+ e && Qe() || console.warn(zt + "Warning: " + t);
189
+ }
190
+ const le = (t) => {
191
+ let e = null;
192
+ switch (typeof t) {
193
+ case "string":
194
+ try {
195
+ e = Tt(t);
196
+ } catch {
197
+ Z(V.InvalidFormat), e = null;
198
+ }
199
+ break;
200
+ case "function":
201
+ e = t;
202
+ break;
203
+ default:
204
+ e = null;
205
+ }
206
+ function r(...n) {
207
+ return e ? e(...n) : n[0];
208
+ }
209
+ return r;
210
+ }, ae = () => ({
211
+ options: {
212
+ type: Object,
213
+ default: () => ({})
214
+ }
215
+ });
216
+ function j(t, e) {
217
+ return { allOptions: d(() => {
218
+ const n = Ye(e) ? e == null ? void 0 : e.value : e;
219
+ return n ? et(n, t.value) : t.value;
220
+ }) };
221
+ }
222
+ const Wt = 0.15;
223
+ function Zt(t, e, r) {
224
+ const n = x(), a = d(() => Math.max(...t.value.range())), o = d(() => e.value.length);
225
+ function l() {
226
+ if (!e.value)
227
+ return;
228
+ const u = e.value.reduce(
229
+ (c, v) => c + v.ref.getBoundingClientRect().width,
230
+ 0
231
+ ), s = Math.ceil(u / o.value);
232
+ n.value = s + s * Wt;
233
+ }
234
+ function i(u) {
235
+ if (!e.value)
236
+ return !0;
237
+ const s = e.value.length;
238
+ if (u === 0)
239
+ return !0;
240
+ const c = a.value / s, v = typeof r == "number" && r > 0 && r + 1 || Math.ceil(n.value / c);
241
+ return u % v === 0;
242
+ }
243
+ return C(e, l), { showTick: i };
244
+ }
245
+ var P = /* @__PURE__ */ ((t) => (t.Skyblue = "skyblue", t.Royalblue = "royalblue", t.Violet = "violet", t.Darkteal = "darkteal", t.Gold = "gold", t))(P || {}), tt = /* @__PURE__ */ ((t) => (t.Skyblue10 = "skyblue-10", t.Skyblue20 = "skyblue-20", t.Skyblue30 = "skyblue-30", t.Skyblue40 = "skyblue-40", t.Skyblue50 = "skyblue-50", t.Skyblue60 = "skyblue-60", t.Skyblue70 = "skyblue-70", t.Skyblue80 = "skyblue-80", t.Skyblue90 = "skyblue-90", t.Skyblue100 = "skyblue-100", t.Royalblue10 = "royalblue-10", t.Royalblue20 = "royalblue-20", t.Royalblue30 = "royalblue-30", t.Royalblue40 = "royalblue-40", t.Royalblue50 = "royalblue-50", t.Royalblue60 = "royalblue-60", t.Royalblue70 = "royalblue-70", t.Royalblue80 = "royalblue-80", t.Royalblue90 = "royalblue-90", t.Royalblue100 = "royalblue-100", t.Violet10 = "violet-10", t.Violet20 = "violet-20", t.Violet30 = "violet-30", t.Violet40 = "violet-40", t.Violet50 = "violet-50", t.Violet60 = "violet-60", t.Violet70 = "violet-70", t.Violet80 = "violet-80", t.Violet90 = "violet-90", t.Violet100 = "violet-100", t.Darkteal10 = "darkteal-10", t.Darkteal20 = "darkteal-20", t.Darkteal30 = "darkteal-30", t.Darkteal40 = "darkteal-40", t.Darkteal50 = "darkteal-50", t.Darkteal60 = "darkteal-60", t.Darkteal70 = "darkteal-70", t.Darkteal80 = "darkteal-80", t.Darkteal90 = "darkteal-90", t.Darkteal100 = "darkteal-100", t.Gold10 = "gold-10", t.Gold20 = "gold-20", t.Gold30 = "gold-30", t.Gold40 = "gold-40", t.Gold50 = "gold-50", t.Gold60 = "gold-60", t.Gold70 = "gold-70", t.Gold80 = "gold-80", t.Gold90 = "gold-90", t.Gold100 = "gold-100", t))(tt || {}), $e = /* @__PURE__ */ ((t) => (t.SkyTeal = "skyblue-darkteal", t.VioletRoyal = "violet-royalblue", t.VioletTeal = "violet-darkteal", t.GoldTeal = "gold-darkteal", t.GoldRoyal = "gold-royalblue", t))($e || {}), nt = /* @__PURE__ */ ((t) => (t.Grey = "grey", t.Green = "green", t.Orange = "orange", t.Red = "red", t))(nt || {}), we = /* @__PURE__ */ ((t) => (t["01"] = "01", t["02"] = "02", t["03"] = "03", t["04"] = "04", t["05"] = "05", t["06"] = "06", t["07"] = "07", t["08"] = "08", t["09"] = "09", t))(we || {});
246
+ const L = {
247
+ HORIZONTAL: "horizontal",
248
+ VERTICAL: "vertical"
249
+ }, Xt = {
250
+ SINGLE: "single",
251
+ GROUPED: "grouped",
252
+ STACKED: "stacked"
253
+ }, X = {
254
+ VERTICAL: {
255
+ top: 16,
256
+ right: 0,
257
+ bottom: 28,
258
+ left: 24
259
+ },
260
+ HORIZONTAL: {
261
+ top: 16,
262
+ right: 0,
263
+ bottom: 28,
264
+ left: 24
265
+ }
266
+ }, rt = "No data", Ut = 20, Yt = 0.33, Kt = 0.5, at = 12, ot = 8, Jt = 1, Qt = [
267
+ "auto",
268
+ "auto-start",
269
+ "auto-end",
270
+ "top",
271
+ "top-start",
272
+ "top-end",
273
+ "right",
274
+ "right-start",
275
+ "right-end",
276
+ "bottom",
277
+ "bottom-start",
278
+ "bottom-end",
279
+ "left",
280
+ "left-start",
281
+ "left-end"
282
+ ];
283
+ function se(t) {
284
+ t != null && t.closest("svg") || Z(V.NotContainedInSvg);
285
+ }
286
+ const lt = {
287
+ /** Displays a line for each tick. */
288
+ gridLines: !1,
289
+ /** Displays the axis title. */
290
+ withTitle: !0,
291
+ //
292
+ //// Tick settings
293
+ //
294
+ /** Controls if the tick labels should be displayed. */
295
+ showTicks: !0,
296
+ /** Amount of ticks to display in the axis. */
297
+ tickCount: 10,
298
+ /** Formatting string/function for the tick label. */
299
+ tickFormat: null,
300
+ /** Space between the tick label and the axis line. */
301
+ tickPadding: 8
302
+ }, qt = {
303
+ ...lt,
304
+ withTitle: !1,
305
+ skip: !0
306
+ }, en = {
307
+ ...lt,
308
+ gridLines: !0
309
+ }, tn = function(t, e, r) {
310
+ const n = d(() => t.value.step() * t.value.paddingInner() / 2);
311
+ function a(u, s) {
312
+ return {
313
+ transform: `translate(${(t.value(s) ?? t.value(u)) - n.value}, 0)`
314
+ };
315
+ }
316
+ function o(u) {
317
+ var c;
318
+ const s = Math.max(
319
+ t.value.step(),
320
+ (u ? (c = u.getComputedTextLength) == null ? void 0 : c.call(u) : t.value.step()) + 20
321
+ );
322
+ return {
323
+ x: -(s - t.value.step()) / 2,
324
+ width: s,
325
+ height: r.value.tickPadding + at + ot
326
+ };
327
+ }
328
+ function l() {
329
+ const u = t.value.step() / 2;
330
+ return {
331
+ x1: u,
332
+ x2: u,
333
+ y1: -e.value.height
334
+ // Negative height means it goes from bottom to top
335
+ };
336
+ }
337
+ function i() {
338
+ return {
339
+ x: t.value.step() / 2,
340
+ y: r.value.tickPadding,
341
+ dy: "0.8em",
342
+ "text-anchor": "middle"
343
+ };
344
+ }
345
+ return {
346
+ getGridLinesAttributes: l,
347
+ getTickGhostAttributes: o,
348
+ getTickGroupAttributes: a,
349
+ getTickLabelAttributes: i
350
+ };
351
+ }, nn = function(t, e, r) {
352
+ const n = d(() => t.value.step() * t.value.paddingInner() / 2);
353
+ function a(u, s) {
354
+ return {
355
+ transform: `translate(0, ${(t.value(s) ?? t.value(u)) - n.value})`
356
+ };
357
+ }
358
+ function o(u) {
359
+ var c;
360
+ const s = (u ? (c = u.getComputedTextLength) == null ? void 0 : c.call(u) : 42) + r.value.tickPadding * 2;
361
+ return {
362
+ x: -s,
363
+ width: s,
364
+ height: t.value.step()
365
+ };
366
+ }
367
+ function l() {
368
+ const u = t.value.step() / 2;
369
+ return {
370
+ y1: u,
371
+ y2: u,
372
+ x1: e.value.width
373
+ };
374
+ }
375
+ function i() {
376
+ return {
377
+ x: -r.value.tickPadding,
378
+ y: t.value.step() / 2,
379
+ "text-anchor": "end",
380
+ "alignment-baseline": "middle"
381
+ };
382
+ }
383
+ return {
384
+ getGridLinesAttributes: l,
385
+ getTickGhostAttributes: o,
386
+ getTickGroupAttributes: a,
387
+ getTickLabelAttributes: i
388
+ };
389
+ }, rn = function(t, e, r) {
390
+ const n = d(() => {
391
+ const u = t.value.ticks();
392
+ return u.length > 1 ? t.value(u[1]) - t.value(u[0]) : 0;
393
+ });
394
+ function a(u) {
395
+ return {
396
+ transform: `translate(${t.value(u)}, 0)`
397
+ };
398
+ }
399
+ function o() {
400
+ return {
401
+ height: r.value.tickPadding + at + ot,
402
+ width: n.value,
403
+ x: -(n.value / 2)
404
+ };
405
+ }
406
+ function l() {
407
+ return {
408
+ y1: -e.value.height
409
+ };
410
+ }
411
+ function i() {
412
+ return {
413
+ y: r.value.tickPadding,
414
+ dy: "0.8em",
415
+ "text-anchor": "middle"
416
+ };
417
+ }
418
+ return {
419
+ getGridLinesAttributes: l,
420
+ getTickGhostAttributes: o,
421
+ getTickGroupAttributes: a,
422
+ getTickLabelAttributes: i
423
+ };
424
+ }, an = function(t, e, r) {
425
+ const n = d(() => {
426
+ const u = t.value.ticks();
427
+ return u.length > 1 ? t.value(u[1]) - t.value(u[0]) : 0;
428
+ });
429
+ function a(u) {
430
+ return {
431
+ transform: `translate(0, ${t.value(u)})`
432
+ };
433
+ }
434
+ function o(u) {
435
+ var c;
436
+ const s = (((c = u == null ? void 0 : u.getComputedTextLength) == null ? void 0 : c.call(u)) || 0) + r.value.tickPadding * 2;
437
+ return {
438
+ width: s,
439
+ height: n.value,
440
+ x: -s,
441
+ y: -(n.value / 2)
442
+ };
443
+ }
444
+ function l() {
445
+ return {
446
+ x1: e.value.width
447
+ };
448
+ }
449
+ function i() {
450
+ return {
451
+ x: -r.value.tickPadding,
452
+ dy: "0.4em",
453
+ "text-anchor": "end"
454
+ };
455
+ }
456
+ return {
457
+ getGridLinesAttributes: l,
458
+ getTickGhostAttributes: o,
459
+ getTickGroupAttributes: a,
460
+ getTickLabelAttributes: i
461
+ };
462
+ }, on = {
463
+ "x-band-scale-axis": tn,
464
+ "y-band-scale-axis": nn,
465
+ "x-linear-scale-axis": rn,
466
+ "y-linear-scale-axis": an
467
+ };
468
+ var ge = /* @__PURE__ */ ((t) => (t.bandScale = "band-scale-axis", t.linearScale = "linear-scale-axis", t))(ge || {}), ye = /* @__PURE__ */ ((t) => (t.left = "left", t.bottom = "bottom", t))(ye || {}), oe = /* @__PURE__ */ ((t) => (t.x = "bottom", t.y = "left", t))(oe || {});
469
+ const ln = /* @__PURE__ */ D({
470
+ __name: "lume-axis",
471
+ props: {
472
+ scale: {
473
+ type: Function,
474
+ required: !0
475
+ },
476
+ type: {
477
+ type: String,
478
+ default: void 0,
479
+ validator: (t) => t in oe
480
+ },
481
+ position: {
482
+ type: String,
483
+ default: void 0,
484
+ validator: (t) => t in ye
485
+ },
486
+ containerSize: {
487
+ type: Object,
488
+ default: () => ({ width: 0, height: 0 })
489
+ },
490
+ hoveredIndex: {
491
+ type: Number,
492
+ default: -1
493
+ },
494
+ orientation: {
495
+ type: String,
496
+ default: L.VERTICAL
497
+ },
498
+ ...ae()
499
+ },
500
+ emits: ["mouseenter", "click", "mouseleave"],
501
+ setup(t, { emit: e }) {
502
+ const r = t, { scale: n, containerSize: a, hoveredIndex: o, options: l, orientation: i } = N(r), u = Oe("isEmpty", x(!1)), s = ie({}), c = x(null), v = x(null), p = x(null), h = d(
503
+ () => r.type ? oe[r.type] : r.position
504
+ ), _ = d(
505
+ () => r.type || (h.value === "left" ? "y" : "x")
506
+ ), m = d(
507
+ () => _.value === "x" && i.value === L.VERTICAL || _.value === "y" && i.value === L.HORIZONTAL
508
+ ), { allOptions: A } = j(
509
+ l,
510
+ _.value === "x" ? qt : en
511
+ ), { showTick: f } = Zt(n, c, A.value.skip), T = d(() => {
512
+ var E, H, R, J;
513
+ return _.value === "y" && u.value ? `translate(0, ${((E = a.value) == null ? void 0 : E.height) / 2})` : _.value === "x" && u.value ? `translate(-${((H = a.value) == null ? void 0 : H.width) / 2}, ${(R = a.value) == null ? void 0 : R.height})` : `translate(0, ${_.value === "x" ? (J = a.value) == null ? void 0 : J.height : 0})`;
514
+ }), O = d(() => {
515
+ if (U(n.value))
516
+ return n.value.labels || n.value.domain();
517
+ const { tickCount: E } = A.value, [H, R] = n.value.domain();
518
+ return Ot(H, R, E);
519
+ }), k = d(() => {
520
+ const { tickFormat: E } = A.value;
521
+ return le(E);
522
+ }), g = d(
523
+ () => A.value.withHover && m.value && o.value > -1
524
+ );
525
+ function $(E) {
526
+ const { showTicks: H } = A.value;
527
+ return H === !1 ? "" : k.value(E);
528
+ }
529
+ function b(E, H, R) {
530
+ e("mouseenter", { index: m.value ? E : null, value: H, event: R });
531
+ }
532
+ function w(E, H, R) {
533
+ e("click", { index: E, value: H, event: R });
534
+ }
535
+ function S(E) {
536
+ if (!(!c.value || !c.value.length))
537
+ return c.value[E].ref;
538
+ }
539
+ function F() {
540
+ p.value = O.value.map(
541
+ (E, H) => ({
542
+ value: $(E),
543
+ group: s.getTickGroupAttributes(E, H),
544
+ ghost: s.getTickGhostAttributes(S(H)),
545
+ label: s.getTickLabelAttributes(),
546
+ gridline: s.getGridLinesAttributes()
547
+ })
548
+ );
549
+ }
550
+ function K() {
551
+ const E = n.value.step ? "bandScale" : "linearScale", H = on[`${_.value}-${ge[E]}`];
552
+ Object.entries(H(n, a, A) || []).forEach(
553
+ ([R, J]) => {
554
+ s[R] = J;
555
+ }
556
+ );
557
+ }
558
+ return C(n, K, { flush: "sync", immediate: !0 }), C(n, F, { immediate: !0 }), C(c, F), M(() => se(v.value)), { __sfc: !0, SCALE_MIXIN_MAP: ge, POSITIONS: ye, TYPES: oe, props: r, emit: e, scale: n, containerSize: a, hoveredIndex: o, options: l, orientation: i, isEmpty: u, mixins: s, tickRefs: c, root: v, ticksWithAttributes: p, computedPosition: h, computedType: _, shouldHover: m, allOptions: A, showTick: f, axisTransform: T, ticks: O, tickFormatter: k, isHovering: g, formatTick: $, handleTickMouseenter: b, handleTickClick: w, getTextNode: S, setTicks: F, init: K, LumeTick: Rt };
559
+ }
560
+ });
561
+ var un = function() {
562
+ var e = this, r = e._self._c, n = e._self._setupProxy;
563
+ return n.scale ? r("g", { ref: "root", staticClass: "axis", attrs: { transform: n.axisTransform, "data-j-axis": "" }, on: { mouseleave: function(a) {
564
+ return n.emit("mouseleave", a);
565
+ } } }, [n.computedType === "x" ? r("defs", [r("linearGradient", { attrs: { id: "lume-tick-gradient" } }, [r("stop", { attrs: { offset: "0%", "stop-color": "rgba(255,255,255,0)" } }), r("stop", { attrs: { offset: "10%", "stop-color": "var(--lume-chart-background-color)" } }), r("stop", { attrs: { offset: "90%", "stop-color": "var(--lume-chart-background-color)" } }), r("stop", { attrs: { offset: "100%", "stop-color": "rgba(255,255,255,0)" } })], 1)], 1) : e._e(), e._l(n.ticksWithAttributes, function(a, o) {
566
+ return r(n.LumeTick, e._b({ key: `${a.value}_${o}`, ref: "tickRefs", refInFor: !0, attrs: { "is-hidden": n.allOptions.skip && !n.showTick(o), "with-gridlines": n.allOptions.gridLines }, on: { mouseenter: function(l) {
567
+ return n.handleTickMouseenter(o, a.value, l);
568
+ }, click: function(l) {
569
+ return n.handleTickClick(o, a.value, l);
570
+ } } }, "lume-tick", a, !1));
571
+ }), n.isHovering ? r(n.LumeTick, e._b({ attrs: { "with-gridlines": !1, "is-hovered": "" }, on: { click: function(a) {
572
+ return n.handleTickClick(
573
+ n.hoveredIndex,
574
+ n.ticksWithAttributes[n.hoveredIndex].value,
575
+ a
576
+ );
577
+ } } }, "lume-tick", n.ticksWithAttributes[n.hoveredIndex], !1)) : e._e()], 2) : e._e();
578
+ }, sn = [], cn = /* @__PURE__ */ I(
579
+ ln,
580
+ un,
581
+ sn,
582
+ !1,
583
+ null,
584
+ null,
585
+ null,
586
+ null
587
+ );
588
+ const dn = cn.exports;
589
+ function vn(t, e, r, n) {
590
+ const a = d(() => r.value > 0 && r.value < 1), o = d(
591
+ () => n.value > 0 && n.value < 1
592
+ ), l = d(
593
+ () => a.value ? t.value - 0.5 : t.value
594
+ // draws the 1px bar closer to the axis
595
+ ), i = d(
596
+ () => o.value ? e.value - 0.5 : e.value
597
+ // draws the 1px bar closer to the axis
598
+ );
599
+ return { computedX: l, computedY: i, shouldHaveMinWidth: a, shouldHaveMinHeight: o };
600
+ }
601
+ function _n(t, e, r, n) {
602
+ const a = x(0), o = x(0), l = d(() => `${t.value + r.value / 2}px ${e.value + n.value / 2}px`);
603
+ return M(() => {
604
+ a.value = r.value, o.value = n.value;
605
+ }), C(r, (i) => a.value = i), C(n, (i) => o.value = i), { computedWidth: a, computedHeight: o, transformOrigin: l };
606
+ }
607
+ const pn = /* @__PURE__ */ D({
608
+ __name: "lume-bar",
609
+ props: {
610
+ x: {
611
+ type: Number,
612
+ default: 0
613
+ },
614
+ y: {
615
+ type: Number,
616
+ default: 0
617
+ },
618
+ width: {
619
+ type: Number,
620
+ required: !0
621
+ },
622
+ height: {
623
+ type: Number,
624
+ required: !0
625
+ },
626
+ classList: {
627
+ type: [String, Array],
628
+ default: ""
629
+ },
630
+ isFaded: {
631
+ type: Boolean,
632
+ default: !1
633
+ },
634
+ isNegative: {
635
+ type: Boolean,
636
+ default: !1
637
+ },
638
+ transition: {
639
+ type: [String, Boolean],
640
+ default: !1
641
+ }
642
+ },
643
+ emits: ["click", "mouseover", "mouseleave"],
644
+ setup(t, { emit: e }) {
645
+ const r = t, { x: n, y: a, width: o, height: l, transition: i, classList: u } = N(r), s = x(null), c = d(
646
+ () => typeof u.value == "string" ? [u.value] : u.value
647
+ ), v = d(() => i.value === "width"), p = d(() => i.value === "height"), h = _n(n, a, o, l), { computedX: _, computedY: m, shouldHaveMinWidth: A, shouldHaveMinHeight: f } = vn(n, a, o, l), T = d(() => A.value ? 1 : (v.value ? h.computedWidth : o).value), O = d(() => f.value ? 1 : (p.value ? h.computedHeight : l).value), k = v.value || p.value ? h.transformOrigin : null;
648
+ return M(() => se(s.value)), { __sfc: !0, props: r, emit: e, x: n, y: a, width: o, height: l, transition: i, classList: u, root: s, computedClasses: c, shouldTransitionWidth: v, shouldTransitionHeight: p, transitionProps: h, computedX: _, computedY: m, shouldHaveMinWidth: A, shouldHaveMinHeight: f, computedWidth: T, computedHeight: O, transformOrigin: k };
649
+ }
650
+ });
651
+ var fn = function() {
652
+ var e = this, r = e._self._c, n = e._self._setupProxy;
653
+ return r("rect", { ref: "root", staticClass: "lume-bar", class: [
654
+ {
655
+ "lume-fill--faded": e.isFaded,
656
+ "lume-bar--negative": e.isNegative,
657
+ "lume-bar--transition-width": n.shouldTransitionWidth,
658
+ "lume-bar--transition-height": n.shouldTransitionHeight
659
+ },
660
+ ...n.computedClasses
661
+ ], style: { transformOrigin: n.transformOrigin }, attrs: { x: n.computedX, y: n.computedY, width: n.computedWidth, height: n.computedHeight, "data-j-bar": "" }, on: { click: function(a) {
662
+ return n.emit("click", a);
663
+ }, mouseover: function(a) {
664
+ return n.emit("mouseover", a);
665
+ }, mouseleave: function(a) {
666
+ return n.emit("mouseleave", a);
667
+ } } });
668
+ }, mn = [], hn = /* @__PURE__ */ I(
669
+ pn,
670
+ fn,
671
+ mn,
672
+ !1,
673
+ null,
674
+ "8e8f732a",
675
+ null,
676
+ null
677
+ );
678
+ const Ie = hn.exports;
679
+ function gn() {
680
+ const t = x(), e = ie({
681
+ dimensions: {}
682
+ }), r = new ResizeObserver((n) => {
683
+ n.forEach((a) => {
684
+ e.dimensions = a.contentRect;
685
+ });
686
+ });
687
+ return M(() => {
688
+ r.observe(t.value);
689
+ }), Ke(() => {
690
+ r.unobserve(t.value);
691
+ }), { resizeState: e, resizeRef: t };
692
+ }
693
+ const yn = /* @__PURE__ */ D({
694
+ __name: "lume-chart-container",
695
+ props: {
696
+ margins: {
697
+ type: Object,
698
+ default: () => ({})
699
+ },
700
+ containerSize: {
701
+ type: Object,
702
+ default: () => ({ width: 0, height: 0 })
703
+ },
704
+ transparentBackground: {
705
+ type: Boolean,
706
+ default: !1
707
+ },
708
+ noMinSize: {
709
+ type: Boolean,
710
+ default: !1
711
+ }
712
+ },
713
+ emits: ["click", "mouseenter", "mouseleave", "resize"],
714
+ setup(t, { emit: e }) {
715
+ const r = t, n = {
716
+ left: 0,
717
+ right: 0,
718
+ top: 0,
719
+ bottom: 0
720
+ }, { margins: a, containerSize: o } = N(r), l = x(null), { resizeRef: i, resizeState: u } = gn(), s = d(() => ({
721
+ ...n,
722
+ // Default values
723
+ ...a.value
724
+ // Prop overrides
725
+ })), c = d(
726
+ () => o.value.height + s.value.top + s.value.bottom
727
+ );
728
+ return Je(() => {
729
+ if (!l.value)
730
+ return;
731
+ const { width: v } = u.dimensions, { height: p } = l.value.getBoundingClientRect();
732
+ if (!v || !p)
733
+ return;
734
+ const h = v - s.value.left - s.value.right, _ = p - s.value.top - s.value.bottom, m = {
735
+ width: h > 0 ? h : 0,
736
+ height: _ > 0 ? _ : 0,
737
+ outerWidth: v,
738
+ outerHeight: p
739
+ };
740
+ e("resize", m);
741
+ }), { __sfc: !0, BASE_MARGINS: n, props: r, emit: e, margins: a, containerSize: o, root: l, resizeRef: i, resizeState: u, computedMargins: s, svgHeight: c };
742
+ }
743
+ });
744
+ var bn = function() {
745
+ var e = this, r = e._self._c, n = e._self._setupProxy;
746
+ return r("div", { ref: "resizeRef", staticClass: "lume-chart-container", class: {
747
+ "lume-chart-container--minimum": !e.noMinSize
748
+ }, attrs: { "data-j-chart-container": "" } }, [e._t("header"), r("svg", { ref: "root", staticClass: "lume-chart-container__svg", class: {
749
+ "lume-chart-container__svg--transparent": e.transparentBackground
750
+ }, attrs: { height: n.svgHeight, "data-j-chart-container__root": "" }, on: { click: function(a) {
751
+ return n.emit("click", a);
752
+ }, mouseenter: function(a) {
753
+ return n.emit("mouseenter", a);
754
+ }, mouseleave: function(a) {
755
+ return n.emit("mouseleave", a);
756
+ } } }, [r("g", { staticClass: "lume-chart-container__group", attrs: { transform: `translate(${n.computedMargins.left}, ${n.computedMargins.top})`, "data-j-chart-container__group": "" } }, [e._t("default")], 2)]), e._t("footer"), e._t("extra")], 2);
757
+ }, kn = [], An = /* @__PURE__ */ I(
758
+ yn,
759
+ bn,
760
+ kn,
761
+ !1,
762
+ null,
763
+ "d53fd184",
764
+ null,
765
+ null
766
+ );
767
+ const Tn = An.exports, On = /* @__PURE__ */ D({
768
+ __name: "lume-chart-legend",
769
+ props: {
770
+ data: {
771
+ type: Array,
772
+ validator: St,
773
+ required: !0
774
+ }
775
+ },
776
+ emits: ["click", "mouseenter", "mouseleave"],
777
+ setup(t, { emit: e }) {
778
+ const r = Oe("isEmpty");
779
+ return { __sfc: !0, emit: e, isEmpty: r };
780
+ }
781
+ });
782
+ var Ln = function() {
783
+ var e = this, r = e._self._c, n = e._self._setupProxy;
784
+ return n.isEmpty ? e._e() : r("div", { staticClass: "lume-chart-legend", attrs: { "data-j-chart-legend": "" }, on: { mouseleave: function(a) {
785
+ return n.emit("mouseleave");
786
+ } } }, e._l(e.data, function(a, o) {
787
+ return r("div", { key: `legend-item-${o}`, staticClass: "lume-chart-legend__item lume-typography--body", attrs: { tabindex: "0", "data-j-chart-legend__symbol-wrapper": "" }, on: { click: function(l) {
788
+ return n.emit("click", { index: o, dataset: a, event: l });
789
+ }, mouseenter: function(l) {
790
+ return n.emit("mouseenter", { index: o, dataset: a, event: l });
791
+ } } }, [r("span", { staticClass: "lume-chart-legend__symbol", class: `lume-background-color--${a.color}`, attrs: { "data-j-chart-legend__symbol": "" } }), e._v(" " + e._s(a.label || o) + " ")]);
792
+ }), 0);
793
+ }, xn = [], $n = /* @__PURE__ */ I(
794
+ On,
795
+ Ln,
796
+ xn,
797
+ !1,
798
+ null,
799
+ "4710298b",
800
+ null,
801
+ null
802
+ );
803
+ const wn = $n.exports;
804
+ const In = {};
805
+ var En = function() {
806
+ var e = this, r = e._self._c;
807
+ return r("div", { staticClass: "lume-tooltip__title", attrs: { "data-j-tooltip__title": "" } }, [e._t("default")], 2);
808
+ }, Dn = [], Cn = /* @__PURE__ */ I(
809
+ In,
810
+ En,
811
+ Dn,
812
+ !1,
813
+ null,
814
+ "64d83dca",
815
+ null,
816
+ null
817
+ );
818
+ const Hn = Cn.exports;
819
+ const Nn = {};
820
+ var Rn = function() {
821
+ var e = this, r = e._self._c;
822
+ return r("li", { staticClass: "lume-tooltip__item", attrs: { "data-j-tooltip__summary-item": "" } }, [r("span", [e._t("default")], 2), r("strong", { staticClass: "lume-tooltip__value" }, [e._t("value")], 2)]);
823
+ }, Sn = [], Bn = /* @__PURE__ */ I(
824
+ Nn,
825
+ Rn,
826
+ Sn,
827
+ !1,
828
+ null,
829
+ "ff4ee04e",
830
+ null,
831
+ null
832
+ );
833
+ const Pn = Bn.exports, Gn = /* @__PURE__ */ D({
834
+ __name: "lume-tooltip-item",
835
+ props: {
836
+ color: {
837
+ type: String,
838
+ default: null
839
+ }
840
+ },
841
+ setup(t) {
842
+ return { __sfc: !0 };
843
+ }
844
+ });
845
+ var jn = function() {
846
+ var e = this, r = e._self._c;
847
+ return e._self._setupProxy, r("li", { staticClass: "lume-tooltip__item", attrs: { "data-j-tooltip__item": "" } }, [e.color ? r("span", { staticClass: "lume-tooltip__symbol", class: [`lume-background-color--${e.color}`], attrs: { "data-j-tooltip__item__symbol": "" } }) : e._e(), r("span", { attrs: { "data-j-tooltip__item__label": "" } }, [e._t("label")], 2), r("strong", { staticClass: "lume-tooltip__value", attrs: { "data-j-tooltip__item__value": "" } }, [e._t("value")], 2)]);
848
+ }, Fn = [], Vn = /* @__PURE__ */ I(
849
+ Gn,
850
+ jn,
851
+ Fn,
852
+ !1,
853
+ null,
854
+ "463bdfbf",
855
+ null,
856
+ null
857
+ );
858
+ const Mn = Vn.exports, zn = /* @__PURE__ */ D({
859
+ __name: "lume-tooltip",
860
+ props: {
861
+ targetElement: {
862
+ type: Element,
863
+ default: null
864
+ },
865
+ items: {
866
+ type: Array,
867
+ required: !0
868
+ },
869
+ position: {
870
+ type: String,
871
+ default: "auto",
872
+ validator: (t) => Qt.includes(t)
873
+ },
874
+ fixedPositioning: {
875
+ type: Boolean,
876
+ default: !1
877
+ },
878
+ modifiers: {
879
+ type: Array,
880
+ default: null
881
+ },
882
+ title: {
883
+ type: [String, Number],
884
+ default: null
885
+ },
886
+ summary: {
887
+ type: String,
888
+ default: null
889
+ },
890
+ ...ae()
891
+ },
892
+ emits: ["opened", "moved", "closed"],
893
+ setup(t, { emit: e }) {
894
+ const r = t, n = x(null), { items: a, options: o } = N(r), l = G(), i = x(null), { allOptions: u } = j(o), s = d(
895
+ () => u.value.fixedPositioning ?? r.fixedPositioning
896
+ ), c = d(
897
+ () => s.value ? "fixed" : "absolute"
898
+ ), v = d(() => [
899
+ {
900
+ name: "computeStyles",
901
+ options: {
902
+ adaptive: !1
903
+ // so that we can have smooth transitions
904
+ }
905
+ },
906
+ {
907
+ name: "offset",
908
+ options: { offset: [0, u.value.offset || 8] }
909
+ },
910
+ ...r.modifiers || []
911
+ ]), p = d(
912
+ () => u.value.showTitle !== !1 && r.title != null
913
+ ), h = d(() => le(u.value.valueFormat)), _ = d(() => le(u.value.titleFormat)), m = d(
914
+ () => {
915
+ var k;
916
+ return ((k = a.value) == null ? void 0 : k.find((g) => g.isSummary)) || {
917
+ label: u.value.summary ?? r.summary
918
+ };
919
+ }
920
+ ), A = d(() => l.summary || m.value.label);
921
+ function f() {
922
+ r.targetElement && n.value && (i.value = $t(r.targetElement, n.value, {
923
+ placement: r.position,
924
+ strategy: c.value,
925
+ modifiers: v.value
926
+ }), e("opened", r.targetElement));
927
+ }
928
+ function T() {
929
+ i.value && (i.value.destroy(), e("closed"));
930
+ }
931
+ function O() {
932
+ i.value && (n.value.classList.add("lume-tooltip--animated"), r.targetElement ? function() {
933
+ i.value.state.elements.reference = r.targetElement, i.value.update(), e("moved", r.targetElement);
934
+ }() : T());
935
+ }
936
+ return C(
937
+ () => r.targetElement,
938
+ (k, g) => {
939
+ !g && k ? f() : O();
940
+ }
941
+ ), M(f), Ke(T), { __sfc: !0, props: r, emit: e, root: n, items: a, options: o, slots: l, popper: i, allOptions: u, computedFixedPositioning: s, strategy: c, allModifiers: v, showTitle: p, formatValue: h, formatTitle: _, summaryItem: m, hasSummary: A, initPopper: f, destroyPopper: T, updatePopper: O, LumeTooltipTitle: Hn, LumeTooltipSummary: Pn, LumeTooltipItem: Mn };
942
+ }
943
+ });
944
+ var Wn = function() {
945
+ var e = this, r = e._self._c, n = e._self._setupProxy;
946
+ return r("div", { directives: [{ name: "show", rawName: "v-show", value: e.targetElement, expression: "targetElement" }], ref: "root", staticClass: "lume-tooltip lume-typography--caption", attrs: { "data-j-tooltip": "" } }, [e._t("default", function() {
947
+ return [e._t("title", function() {
948
+ return [n.showTitle ? r(n.LumeTooltipTitle, [e._v(" " + e._s(n.formatTitle(e.title)) + " ")]) : e._e()];
949
+ }), r("ul", { staticClass: "lume-tooltip__items" }, [e._t("summary", function() {
950
+ return [n.hasSummary ? r(n.LumeTooltipSummary, { scopedSlots: e._u([n.summaryItem.value ? { key: "value", fn: function() {
951
+ return [e._v(" " + e._s(n.formatValue(n.summaryItem.value)) + " ")];
952
+ }, proxy: !0 } : null], null, !0) }, [e._v(" " + e._s(n.summaryItem.label) + " ")]) : e._e()];
953
+ }), n.hasSummary ? r("li", { staticClass: "lume-tooltip__break" }, [r("hr")]) : e._e(), e._t("items", function() {
954
+ return e._l(n.items, function(a) {
955
+ return r(n.LumeTooltipItem, { key: a.label, attrs: { color: a.color }, scopedSlots: e._u([{ key: "label", fn: function() {
956
+ return [e._v(" " + e._s(a.label) + " ")];
957
+ }, proxy: !0 }, { key: "value", fn: function() {
958
+ return [e._v(" " + e._s(n.formatValue(a.value)) + " ")];
959
+ }, proxy: !0 }], null, !0) });
960
+ });
961
+ })], 2)];
962
+ })], 2);
963
+ }, Zn = [], Xn = /* @__PURE__ */ I(
964
+ zn,
965
+ Wn,
966
+ Zn,
967
+ !1,
968
+ null,
969
+ "57f370fa",
970
+ null,
971
+ null
972
+ );
973
+ const Un = Xn.exports;
974
+ var W = /* @__PURE__ */ ((t) => (t.Categorical = "categorical", t.Sequential = "sequential", t.Divergent = "divergent", t))(W || {});
975
+ const Yn = W.Categorical, ce = P.Skyblue, Kn = $e.SkyTeal;
976
+ function Jn(t) {
977
+ return t === W.Divergent ? Kn : ce;
978
+ }
979
+ function Qn(t) {
980
+ return Object.values(we).includes(t);
981
+ }
982
+ function Se(t, e) {
983
+ return e === W.Divergent ? Object.values($e).includes(t) : Object.values({
984
+ ...P,
985
+ ...tt,
986
+ ...nt,
987
+ ...we
988
+ }).includes(t);
989
+ }
990
+ function qn(t, e) {
991
+ const r = Object.values(P).indexOf(t);
992
+ return Vt(Object.values(P), r > -1 ? r : 0)[e];
993
+ }
994
+ function er(t, e) {
995
+ const r = 50 + e * 10;
996
+ return `${t}-${r}`;
997
+ }
998
+ function tr(t, e) {
999
+ const r = (e + 1) * 10;
1000
+ return `${t}-${r}`;
1001
+ }
1002
+ function Be(t, e, r) {
1003
+ switch (e) {
1004
+ default:
1005
+ case W.Categorical:
1006
+ return Qn(t) ? t : qn(t, r);
1007
+ case W.Sequential:
1008
+ return er(t, r);
1009
+ case W.Divergent:
1010
+ return tr(t, r);
1011
+ }
1012
+ }
1013
+ function nr(t, e, r = Yn, n) {
1014
+ return Se(t, r) ? t : (n > 4 && (Z(V.ColorLoop), n = n % 5), Se(e, r) ? Be(e, r, n) : Be(Jn(r), r, n));
1015
+ }
1016
+ function rr(t) {
1017
+ return t.map((e) => Bt(e) ? e : { value: e });
1018
+ }
1019
+ function ar(t) {
1020
+ return t.__internal === !0;
1021
+ }
1022
+ const Ee = (t = null) => ({
1023
+ data: {
1024
+ type: Array,
1025
+ required: !0,
1026
+ validator: t || void 0
1027
+ },
1028
+ labels: {
1029
+ type: Array,
1030
+ default: void 0
1031
+ },
1032
+ color: {
1033
+ type: String,
1034
+ default: P.Skyblue
1035
+ },
1036
+ title: {
1037
+ type: String,
1038
+ default: null
1039
+ }
1040
+ });
1041
+ function De(t, e, r, n, a) {
1042
+ const o = ie({
1043
+ width: 0,
1044
+ height: 0
1045
+ }), l = Mt(12), i = d(() => {
1046
+ var c;
1047
+ return t.value.length > 5 && Z(V.DatasetLength), (c = t.value) == null ? void 0 : c.map(
1048
+ (v, p) => {
1049
+ if (ar(v))
1050
+ return v;
1051
+ const h = rr(v.values), _ = nr(
1052
+ v.color,
1053
+ r == null ? void 0 : r.value,
1054
+ n == null ? void 0 : n.value.colorPalette,
1055
+ p
1056
+ );
1057
+ return {
1058
+ ...v,
1059
+ values: h,
1060
+ color: _,
1061
+ __internal: !0
1062
+ };
1063
+ }
1064
+ );
1065
+ }), u = d(() => Array.isArray(e.value) ? e.value : he(t.value).map((c, v) => v));
1066
+ function s(c) {
1067
+ const v = (a == null ? void 0 : a.value) === L.HORIZONTAL && he(t).length * (Ut * 2) || c.height;
1068
+ o.width = c.width, o.height = v;
1069
+ }
1070
+ return {
1071
+ chartID: l,
1072
+ computedLabels: u,
1073
+ containerSize: o,
1074
+ internalData: i,
1075
+ updateSize: s
1076
+ };
1077
+ }
1078
+ const or = () => ({
1079
+ xScale: {
1080
+ type: Function,
1081
+ default: null
1082
+ },
1083
+ yScale: {
1084
+ type: Function,
1085
+ default: null
1086
+ }
1087
+ });
1088
+ function lr(t, e, r, n, a) {
1089
+ const o = x(null), l = x(null);
1090
+ function i() {
1091
+ const { width: u, height: s } = r, c = a.value.padding || a.value.paddingOuter || 0;
1092
+ !u && !s || !e.value || !t.value || (n.value === L.HORIZONTAL ? (o.value = Ge(
1093
+ t.value,
1094
+ u,
1095
+ n.value,
1096
+ a.value.startOnZero
1097
+ ), l.value = Pe({
1098
+ domain: e.value,
1099
+ size: s,
1100
+ paddingOuter: c
1101
+ })) : (o.value = Pe({
1102
+ domain: e.value,
1103
+ size: u,
1104
+ paddingOuter: c
1105
+ }), l.value = Ge(
1106
+ t.value,
1107
+ s,
1108
+ n.value,
1109
+ a.value.startOnZero
1110
+ )));
1111
+ }
1112
+ return Je(i), { xScale: o, yScale: l };
1113
+ }
1114
+ function Pe({
1115
+ domain: t,
1116
+ size: e,
1117
+ paddingOuter: r = 0
1118
+ }) {
1119
+ const n = [0, e];
1120
+ return Object.assign(
1121
+ te().range(n).paddingOuter(r).domain(t.map((a, o) => o)),
1122
+ { labels: t }
1123
+ );
1124
+ }
1125
+ function Ge(t, e, r, n) {
1126
+ const a = qe(t).filter((c) => c != null), o = [0, e];
1127
+ if (a.length === 0)
1128
+ return ne().range(o).domain([0, 0]).nice();
1129
+ const l = Math.min(...a), i = n && l > 0 ? 0 : l, u = Math.max(...a), s = r === L.HORIZONTAL ? [i, u] : [u, i];
1130
+ return ne().range(o).domain(s).nice();
1131
+ }
1132
+ function je(t) {
1133
+ return (t == null ? void 0 : t.range) !== void 0 || (t == null ? void 0 : t.copy) !== void 0;
1134
+ }
1135
+ function be(t, e) {
1136
+ return U(t) ? t.bandwidth() / 2 + t(t.domain()[e]) : t(e);
1137
+ }
1138
+ function ue(t, e, {
1139
+ padding: r,
1140
+ paddingInner: n,
1141
+ paddingOuter: a
1142
+ } = {}) {
1143
+ const o = r ?? (e === L.HORIZONTAL ? Kt : Yt);
1144
+ return t.copy().paddingInner(n ?? o).paddingOuter(a ?? o / 2);
1145
+ }
1146
+ function ut(t) {
1147
+ return Object.values(L).includes(t);
1148
+ }
1149
+ const q = (t, e = !0) => ({
1150
+ ...Ee(t),
1151
+ ...or(),
1152
+ ...ae(),
1153
+ classList: {
1154
+ type: [String, Array],
1155
+ default: () => []
1156
+ },
1157
+ hoveredIndex: {
1158
+ type: Number,
1159
+ default: null
1160
+ },
1161
+ ...e ? {
1162
+ orientation: {
1163
+ type: String,
1164
+ default: L.VERTICAL,
1165
+ validator: ut
1166
+ }
1167
+ } : {}
1168
+ }), ur = (t) => ({
1169
+ ...Ee(t),
1170
+ ...ae(),
1171
+ hoveredElement: {
1172
+ type: [Number, String],
1173
+ default: null
1174
+ }
1175
+ }), de = () => ({
1176
+ data: {
1177
+ type: Array,
1178
+ required: !0
1179
+ },
1180
+ labels: {
1181
+ type: Array,
1182
+ default: () => []
1183
+ },
1184
+ options: {
1185
+ type: Object,
1186
+ default: () => ({})
1187
+ },
1188
+ orientation: {
1189
+ type: String,
1190
+ default: L.VERTICAL,
1191
+ validator: ut
1192
+ },
1193
+ xScale: {
1194
+ type: Function,
1195
+ default: () => null
1196
+ },
1197
+ yScale: {
1198
+ type: Function,
1199
+ default: () => null
1200
+ },
1201
+ hoveredIndex: {
1202
+ type: Number,
1203
+ default: -1
1204
+ },
1205
+ containerSize: {
1206
+ type: Object,
1207
+ default: () => ({ width: 0, height: 0 })
1208
+ },
1209
+ transition: {
1210
+ type: Boolean,
1211
+ default: !0
1212
+ },
1213
+ classList: {
1214
+ type: [String, Array],
1215
+ default: () => []
1216
+ }
1217
+ }), ir = /* @__PURE__ */ D({
1218
+ __name: "lume-overlay-group",
1219
+ props: {
1220
+ ...de(),
1221
+ orientation: {
1222
+ type: String,
1223
+ default: L.VERTICAL
1224
+ }
1225
+ },
1226
+ emits: ["click", "lume__internal--hover", "mouseover"],
1227
+ setup(t, { emit: e }) {
1228
+ const r = t, { data: n, orientation: a, xScale: o, yScale: l } = N(r), i = d(() => he(n));
1229
+ function u(s) {
1230
+ const c = a.value === L.HORIZONTAL ? l.value : o.value, v = c.domain(), p = xe(c), h = U(c) ? c(v[s]) : c(s) - p / 2;
1231
+ return a.value === L.HORIZONTAL ? {
1232
+ width: Math.max(...o.value.range()),
1233
+ height: p,
1234
+ transform: `translate(0, ${h})`
1235
+ } : {
1236
+ width: p,
1237
+ height: Math.max(...l.value.range()),
1238
+ transform: `translate(${h}, 0)`
1239
+ };
1240
+ }
1241
+ return { __sfc: !0, props: r, emit: e, data: n, orientation: a, xScale: o, yScale: l, overlayData: i, getOverlayBarAttributes: u, LumeBar: Ie };
1242
+ }
1243
+ });
1244
+ var sr = function() {
1245
+ var e = this, r = e._self._c, n = e._self._setupProxy;
1246
+ return r("g", { staticClass: "lume-overlay-group" }, e._l(n.overlayData, function(a, o) {
1247
+ return r(n.LumeBar, e._b({ key: `overlay-${o}`, attrs: { "data-j-lume-overlay-group": o, transition: !1, "class-list": "lume-fill--transparent" }, on: { mouseover: function(l) {
1248
+ return n.emit("lume__internal--hover", o);
1249
+ }, click: function(l) {
1250
+ return n.emit("click", { index: o, event: l });
1251
+ } } }, "lume-bar", n.getOverlayBarAttributes(o), !1));
1252
+ }), 1);
1253
+ }, cr = [], dr = /* @__PURE__ */ I(
1254
+ ir,
1255
+ sr,
1256
+ cr,
1257
+ !1,
1258
+ null,
1259
+ null,
1260
+ null,
1261
+ null
1262
+ );
1263
+ const vr = dr.exports;
1264
+ function _r(t) {
1265
+ return { hasNegativeValues: d(
1266
+ () => qe(t.value).some((r) => r < 0)
1267
+ ) };
1268
+ }
1269
+ function pr(t, e, r, n) {
1270
+ const a = d(
1271
+ () => n.value === L.HORIZONTAL
1272
+ ), o = d(
1273
+ () => {
1274
+ var s;
1275
+ return t.height - (a != null && a.value ? 0 : ((s = r.value) == null ? void 0 : s.call(r, 0)) || 0);
1276
+ }
1277
+ ), l = d(
1278
+ () => {
1279
+ var s;
1280
+ return a != null && a.value ? ((s = e.value) == null ? void 0 : s.call(e, 0)) || 0 : t.width;
1281
+ }
1282
+ ), i = d(
1283
+ () => {
1284
+ var s;
1285
+ return a != null && a.value ? "translate(0, 0)" : `translate(0, ${((s = r.value) == null ? void 0 : s.call(r, 0)) || 0})`;
1286
+ }
1287
+ );
1288
+ return { negativeBarAttributes: d(() => ({
1289
+ width: l.value,
1290
+ height: o.value,
1291
+ transform: i.value
1292
+ })) };
1293
+ }
1294
+ function fr(t) {
1295
+ return t.reduce((e, r) => r.values.map((n, a) => e[a] ? n.value > e[a] ? n.value : e[a] : n.value ?? 0), []);
1296
+ }
1297
+ function mr(t) {
1298
+ return t.reduce((e, r) => r.values.map((n, a) => {
1299
+ const o = n.value == null || n.value < 0 ? 0 : n.value;
1300
+ return e[a] ? e[a] + o : o;
1301
+ }), []);
1302
+ }
1303
+ const Fe = {
1304
+ "stacked-bar": mr
1305
+ };
1306
+ function it(t, e, r, n, a, o, l) {
1307
+ const i = d(
1308
+ () => {
1309
+ var s;
1310
+ return e.value.withTooltip !== !1 && !((s = e.value.tooltipOptions) != null && s.targetElement);
1311
+ }
1312
+ );
1313
+ function u(s) {
1314
+ const c = l != null && l.value && Fe[l.value] ? Fe[l.value](s) : fr(s);
1315
+ t.value = c.map((v, p) => ({
1316
+ cx: (a == null ? void 0 : a.value) === L.HORIZONTAL ? r.value(v) : be(r.value, p),
1317
+ cy: (a == null ? void 0 : a.value) === L.HORIZONTAL ? be(n.value, p) : n.value(v)
1318
+ }));
1319
+ }
1320
+ return C(
1321
+ [r, n],
1322
+ () => {
1323
+ r.value && n.value && (o != null && o.value) && i.value && u(o.value);
1324
+ },
1325
+ { immediate: !0 }
1326
+ ), { shouldGenerateTooltipAnchors: i, updateTooltipAnchorAttributes: u };
1327
+ }
1328
+ function hr() {
1329
+ const t = ie({
1330
+ opened: !1,
1331
+ targetElement: null
1332
+ });
1333
+ return { tooltipConfig: t, showTooltip: (n) => {
1334
+ t.opened = !0, t.targetElement = n;
1335
+ }, hideTooltip: () => {
1336
+ t.opened = !1, t.targetElement = null;
1337
+ } };
1338
+ }
1339
+ function gr(t) {
1340
+ return { getTooltipItems: d(
1341
+ () => (r) => t.value.map(({ color: n, label: a, values: o }) => {
1342
+ var l, i, u;
1343
+ return {
1344
+ color: ((l = o[r]) == null ? void 0 : l.color) || n,
1345
+ label: a,
1346
+ value: ((i = o[r]) == null ? void 0 : i.label) ?? ((u = o[r]) == null ? void 0 : u.value) ?? rt
1347
+ };
1348
+ })
1349
+ ) };
1350
+ }
1351
+ const yr = /* @__PURE__ */ D({
1352
+ __name: "lume-chart",
1353
+ props: {
1354
+ ...q(),
1355
+ chartType: {
1356
+ type: String,
1357
+ default: null
1358
+ }
1359
+ },
1360
+ setup(t, { emit: e }) {
1361
+ const r = t, n = G(), { data: a, labels: o, color: l, options: i, orientation: u, chartType: s } = N(r), c = x(-1), v = x(null), p = x(null), h = x([]), { allOptions: _ } = j(i), { internalData: m, computedLabels: A, containerSize: f, updateSize: T, chartID: O } = De(a, o, l, _, u), { xScale: k, yScale: g } = lr(
1362
+ m,
1363
+ A,
1364
+ f,
1365
+ u,
1366
+ _
1367
+ ), $ = d(() => {
1368
+ var y;
1369
+ return r.xScale ? je(r.xScale) ? r.xScale : (y = r.xScale) == null ? void 0 : y.call(r, m.value, o.value, f) : k.value;
1370
+ }), b = d(() => {
1371
+ var y;
1372
+ return r.yScale ? je(r.yScale) ? r.yScale : (y = r.yScale) == null ? void 0 : y.call(r, m.value, o.value, f) : g.value;
1373
+ }), w = d(() => ({
1374
+ ..._.value.xAxisOptions,
1375
+ withHover: u.value === L.VERTICAL
1376
+ })), S = d(() => ({
1377
+ ..._.value.yAxisOptions,
1378
+ withHover: u.value === L.HORIZONTAL
1379
+ })), F = d(() => {
1380
+ var y;
1381
+ return (y = _.value.xAxisOptions) == null ? void 0 : y.title;
1382
+ }), K = d(() => {
1383
+ var y;
1384
+ return (y = _.value.yAxisOptions) == null ? void 0 : y.title;
1385
+ }), E = d(() => {
1386
+ var y;
1387
+ return ((y = _.value.xAxisOptions) == null ? void 0 : y.withTitle) !== !1 && F.value;
1388
+ }), H = d(() => {
1389
+ var y;
1390
+ return ((y = _.value.yAxisOptions) == null ? void 0 : y.withTitle) !== !1 && K.value;
1391
+ }), R = d(
1392
+ () => a.value.every((y) => !y.values.length)
1393
+ ), J = d(() => {
1394
+ const y = [], { noBaseScales: B } = _.value;
1395
+ return B || y.push(() => !!($.value && b.value)), y.every((z) => z() === !0);
1396
+ }), { hasNegativeValues: pt } = _r(m), { negativeBarAttributes: ft } = pr(
1397
+ f,
1398
+ $,
1399
+ b,
1400
+ u
1401
+ ), { shouldGenerateTooltipAnchors: mt } = it(
1402
+ h,
1403
+ _,
1404
+ $,
1405
+ b,
1406
+ u,
1407
+ m,
1408
+ s
1409
+ ), { tooltipConfig: He, showTooltip: Ne, hideTooltip: Re } = hr(), { getTooltipItems: ht } = gr(m), gt = d(
1410
+ () => _.value.withTooltip !== !1 && He.opened
1411
+ ), yt = d(
1412
+ () => {
1413
+ var y;
1414
+ return ((y = _.value.tooltipOptions) == null ? void 0 : y.position) || "top";
1415
+ }
1416
+ );
1417
+ function ve(y) {
1418
+ var B;
1419
+ if (y !== c.value && (_.value.withHover !== !1 && (c.value = y), _.value.withTooltip !== !1)) {
1420
+ const z = (B = _.value.tooltipOptions) != null && B.targetElement ? _.value.tooltipOptions.targetElement === "self" ? p.value.$el : _.value.tooltipOptions.targetElement : v.value[y];
1421
+ Ne(z);
1422
+ }
1423
+ }
1424
+ function _e(y) {
1425
+ if (y > a.value[0].values.length - 1) {
1426
+ Z(V.InvalidHoveredIndex);
1427
+ return;
1428
+ }
1429
+ ve(y);
1430
+ }
1431
+ function bt() {
1432
+ Re(), c.value = -1, e("chart-mouseleave");
1433
+ }
1434
+ function kt({ index: y, value: B, event: z }) {
1435
+ y !== null && ve(y), e("axis-mouseenter", { index: y, value: B, event: z });
1436
+ }
1437
+ function At({ index: y, value: B, event: z }) {
1438
+ e("axis-click", { index: y, value: B, event: z });
1439
+ }
1440
+ return C(
1441
+ a,
1442
+ (y, B) => e("data-changed", { newValue: y, oldValue: B })
1443
+ ), C(
1444
+ o,
1445
+ (y, B) => e("labels-changed", { newValue: y, oldValue: B })
1446
+ ), C(R, (y) => y && Z(V.Empty), { immediate: !0 }), C(() => r.hoveredIndex, _e), C(
1447
+ h,
1448
+ (y) => {
1449
+ y && r.hoveredIndex != null && c.value === -1 && _e(r.hoveredIndex);
1450
+ },
1451
+ { flush: "post" }
1452
+ ), M(() => {
1453
+ e("rendered"), n.groups || console.error('"groups" `<slot>` must have content.');
1454
+ }), pe("chartID", O), pe("isEmpty", R), pe("tooltipAnchorAttributes", h), { __sfc: !0, props: r, slots: n, emit: e, data: a, labels: o, color: l, options: i, orientation: u, chartType: s, internalHoveredIndex: c, tooltipAnchor: v, chartContainer: p, tooltipAnchorAttributes: h, allOptions: _, internalData: m, computedLabels: A, containerSize: f, updateSize: T, chartID: O, xScale: k, yScale: g, computedXScale: $, computedYScale: b, computedXAxisOptions: w, computedYAxisOptions: S, xAxisTitle: F, yAxisTitle: K, showXAxisTitle: E, showYAxisTitle: H, isEmpty: R, isReady: J, hasNegativeValues: pt, negativeBarAttributes: ft, shouldGenerateTooltipAnchors: mt, tooltipConfig: He, showTooltip: Ne, hideTooltip: Re, getTooltipItems: ht, isTooltipOpened: gt, tooltipPosition: yt, handleInternalHover: ve, handleExternalHover: _e, handleMouseleave: bt, handleAxisMouseenter: kt, handleAxisClick: At, LumeAxis: dn, LumeBar: Ie, LumeChartContainer: Tn, LumeChartLegend: wn, LumeTooltip: Un, LumeOverlayGroup: vr, TOOLTIP_ANCHOR_RADIUS: Jt };
1455
+ }
1456
+ });
1457
+ var br = function() {
1458
+ var e = this, r = e._self._c, n = e._self._setupProxy;
1459
+ return r(n.LumeChartContainer, { ref: "chartContainer", attrs: { id: `lume-chart_${n.chartID}`, margins: n.allOptions.margins, "container-size": n.containerSize, "no-min-size": n.allOptions.noMinSize, "transparent-background": n.allOptions.transparentBackground, "data-j-lume-chart": "" }, on: { resize: n.updateSize, click: function(a) {
1460
+ return n.emit("chart-click", a);
1461
+ }, mouseenter: function(a) {
1462
+ return n.emit("chart-mouseenter", a);
1463
+ }, mouseleave: n.handleMouseleave }, scopedSlots: e._u([{ key: "header", fn: function() {
1464
+ return [r("div", { staticClass: "lume-chart__header" }, [r("div", { staticClass: "lume-chart__header-section" }, [e.title ? r("h1", { staticClass: "lume-chart__title lume-chart-title lume-typography--display" }, [e._v(" " + e._s(e.title) + " ")]) : e._e(), r("div", { staticClass: "lume-chart__controls" }, [e._t("controls")], 2)]), r("div", { staticClass: "lume-chart__header-section" }, [n.showYAxisTitle ? r("h3", { staticClass: "lume-chart__axis-title lume-axis-title lume-typography--body" }, [e._v(" " + e._s(n.yAxisTitle) + " ")]) : e._e(), e._t("legend", function() {
1465
+ return [n.allOptions.withLegend !== !1 && n.allOptions.legendPosition !== "bottom" ? r(n.LumeChartLegend, { staticClass: "lume-chart__legend", attrs: { data: n.internalData, "data-j-lume-chart__legend": "" }, on: { click: function(a) {
1466
+ return n.emit("legend-click", a);
1467
+ }, mouseenter: function(a) {
1468
+ return n.emit("legend-mouseenter", a);
1469
+ }, mouseleave: function(a) {
1470
+ return n.emit("legend-mouseleave");
1471
+ } } }) : e._e()];
1472
+ }, { data: n.internalData })], 2)])];
1473
+ }, proxy: !0 }, { key: "footer", fn: function() {
1474
+ return [n.showXAxisTitle ? r("h3", { staticClass: "lume-chart__axis-title lume-chart__axis-title--centered lume-axis-title" }, [e._v(" " + e._s(n.xAxisTitle) + " ")]) : e._e(), n.allOptions.withLegend !== !1 && n.allOptions.legendPosition == "bottom" ? r(n.LumeChartLegend, { staticClass: "lume-chart__legend lume-chart__legend--bottom", attrs: { data: n.internalData, "data-j-lume-chart__legend": "" }, on: { click: function(a) {
1475
+ return n.emit("legend-click", a);
1476
+ }, mouseenter: function(a) {
1477
+ return n.emit("legend-mouseenter", a);
1478
+ }, mouseleave: function(a) {
1479
+ return n.emit("legend-mouseleave");
1480
+ } } }) : e._e()];
1481
+ }, proxy: !0 }, { key: "extra", fn: function() {
1482
+ return [e._t("tooltip", function() {
1483
+ return [n.isTooltipOpened ? r(n.LumeTooltip, e._b({ attrs: { position: n.tooltipPosition, title: n.computedLabels[n.internalHoveredIndex], items: n.getTooltipItems(n.internalHoveredIndex), options: n.allOptions.tooltipOptions, "data-j-lume-chart__tooltip": "" }, on: { opened: function(a) {
1484
+ return n.emit("tooltip-opened", {
1485
+ index: n.internalHoveredIndex,
1486
+ targetElement: a
1487
+ });
1488
+ }, moved: function(a) {
1489
+ return n.emit("tooltip-moved", {
1490
+ index: n.internalHoveredIndex,
1491
+ targetElement: a
1492
+ });
1493
+ }, closed: function(a) {
1494
+ return n.emit("tooltip-closed");
1495
+ } } }, "lume-tooltip", n.tooltipConfig, !1), [e._t("tooltip-content", null, { data: n.internalData, labels: n.computedLabels, hoveredIndex: n.internalHoveredIndex })], 2) : e._e()];
1496
+ }, { data: n.internalData, labels: n.computedLabels, title: n.computedLabels[n.internalHoveredIndex], items: n.getTooltipItems(n.internalHoveredIndex), position: n.tooltipPosition, withTooltip: n.allOptions.withTooltip !== !1, hoveredIndex: n.internalHoveredIndex, options: n.allOptions.tooltipOptions }, n.tooltipConfig)];
1497
+ }, proxy: !0 }], null, !0) }, [n.isReady ? [n.hasNegativeValues ? r(n.LumeBar, e._b({ attrs: { "class-list": "lume-fill--negative", transition: !1, "data-j-lume-chart__negative-values": "" } }, "lume-bar", n.negativeBarAttributes, !1)) : e._e(), n.allOptions.withAxes !== !1 ? e._t("axes", function() {
1498
+ return [r(n.LumeAxis, { attrs: { type: "x", scale: n.computedXScale, "container-size": n.containerSize, options: n.computedXAxisOptions, "hovered-index": n.internalHoveredIndex, orientation: n.orientation, "data-j-lume-chart__x-axis": "" }, on: { click: n.handleAxisClick, mouseenter: n.handleAxisMouseenter, mouseleave: function(a) {
1499
+ return n.emit("axis-mouseleave");
1500
+ } } }), r(n.LumeAxis, { attrs: { type: "y", scale: n.computedYScale, "container-size": n.containerSize, options: n.computedYAxisOptions, "hovered-index": n.internalHoveredIndex, orientation: n.orientation, "data-j-lume-chart__y-axis": "" }, on: { click: n.handleAxisClick, mouseenter: n.handleAxisMouseenter, mouseleave: function(a) {
1501
+ return n.emit("axis-mouseleave");
1502
+ } } })];
1503
+ }, { xScale: n.computedXScale, yScale: n.computedYScale, containerSize: n.containerSize, options: n.allOptions, hoveredIndex: n.internalHoveredIndex }) : e._e(), n.allOptions.withHover !== !1 ? r(n.LumeOverlayGroup, { attrs: { data: n.internalData, orientation: n.orientation, "x-scale": n.computedXScale, "y-scale": n.computedYScale, "data-j-lume-chart__overlay-group": "" }, on: { "lume__internal--hover": n.handleInternalHover } }) : e._e(), n.shouldGenerateTooltipAnchors ? r("g", e._l(n.tooltipAnchorAttributes, function(a, o) {
1504
+ return r("circle", e._b({ key: `anchor_${o}`, ref: "tooltipAnchor", refInFor: !0, staticClass: "lume-fill--transparent", attrs: { r: n.TOOLTIP_ANCHOR_RADIUS } }, "circle", a, !1));
1505
+ }), 0) : e._e(), e._t("groups", null, { data: n.internalData, labels: n.computedLabels, options: n.allOptions, orientation: n.orientation, xScale: n.computedXScale, yScale: n.computedYScale, hoveredIndex: n.internalHoveredIndex, containerSize: n.containerSize, transition: n.allOptions.withTransition !== !1, classList: e.classList })] : e._e()], 2);
1506
+ }, kr = [], Ar = /* @__PURE__ */ I(
1507
+ yr,
1508
+ br,
1509
+ kr,
1510
+ !1,
1511
+ null,
1512
+ "19d7190c",
1513
+ null,
1514
+ null
1515
+ );
1516
+ const ee = Ar.exports;
1517
+ function Ve(t, e) {
1518
+ return {
1519
+ x0: 0 + (e ? e.left : 0),
1520
+ y0: 0 + (e ? e.top : 0),
1521
+ x1: t.width - (e ? e.right : 0),
1522
+ y1: t.height - (e ? e.bottom : 0)
1523
+ };
1524
+ }
1525
+ function Tr(t) {
1526
+ const e = x(Ve(t));
1527
+ function r(n) {
1528
+ e.value = Ve(t, n);
1529
+ }
1530
+ return { extents: e, updateExtents: r };
1531
+ }
1532
+ var st = /* @__PURE__ */ ((t) => (t.GraphProblem = "There was an issue generating your alluvial graph.", t))(st || {});
1533
+ const Or = "[lume] ";
1534
+ function Lr(t, e, r = !0) {
1535
+ r && Qe() || console.error(Or + "Error: " + t, e);
1536
+ }
1537
+ const Me = 8, xr = 8, $r = 20, wr = 200;
1538
+ function Q(t) {
1539
+ return typeof t == "string" || typeof t == "number" ? t : t.id ?? t.label;
1540
+ }
1541
+ function re(t) {
1542
+ return t.source.id + ":" + t.target.id;
1543
+ }
1544
+ function Ir(t, e) {
1545
+ return e.nodes.find((r) => r.id === t);
1546
+ }
1547
+ function Er(t, e) {
1548
+ return e.links.find((r) => re(r) === t);
1549
+ }
1550
+ function ct(t) {
1551
+ return !!(t.sourceLinks && t.targetLinks);
1552
+ }
1553
+ function Dr(t, e) {
1554
+ if (!e)
1555
+ return;
1556
+ const r = t.nodes.filter((l) => l.targetLinks.length === 0).map((l) => `${l.id}`), n = t.nodes.filter((l) => l.sourceLinks.length === 0).map((l) => `${l.id}`), a = e.filter((l) => r.includes(l.dataset.id)).reduce(
1557
+ (l, i) => Math.max(l, i.getBBox().width),
1558
+ -1 / 0
1559
+ ), o = e.filter((l) => n.includes(l.dataset.id)).reduce(
1560
+ (l, i) => Math.max(l, i.getBBox().width),
1561
+ -1 / 0
1562
+ );
1563
+ return {
1564
+ left: a,
1565
+ top: 0,
1566
+ right: o,
1567
+ bottom: 0
1568
+ };
1569
+ }
1570
+ function Cr(t) {
1571
+ return t.map((e) => ({
1572
+ x: e.x0,
1573
+ y: e.y0,
1574
+ width: e.x1 - e.x0,
1575
+ height: e.y1 - e.y0,
1576
+ textTransform: {
1577
+ x: e.depth > 0 ? e.x1 + Me : e.x0 - Me,
1578
+ y: (e.y1 + e.y0) / 2
1579
+ },
1580
+ node: e
1581
+ }));
1582
+ }
1583
+ function Hr(t) {
1584
+ const e = wt();
1585
+ return t.map((r) => {
1586
+ var n;
1587
+ return {
1588
+ id: re(r),
1589
+ color: r.color || ((n = r.source) == null ? void 0 : n.color) || ce,
1590
+ d: e(r),
1591
+ strokeWidth: Math.max(1, r.width),
1592
+ link: r
1593
+ };
1594
+ });
1595
+ }
1596
+ function ze(t, e, r, n, a) {
1597
+ if (n === !1) {
1598
+ t.node = {
1599
+ ...t.node,
1600
+ transitionValue: a ? void 0 : r
1601
+ };
1602
+ return;
1603
+ }
1604
+ const o = Date.now(), l = Ft(e, r), i = () => {
1605
+ let s = (Date.now() - o) / wr;
1606
+ s > 1 && (s = 1), t.node = {
1607
+ ...t.node,
1608
+ transitionValue: a && s === 1 ? void 0 : l(s)
1609
+ }, s < 1 && requestAnimationFrame(i);
1610
+ };
1611
+ requestAnimationFrame(i);
1612
+ }
1613
+ const Nr = {
1614
+ nodes: [],
1615
+ links: []
1616
+ };
1617
+ function Rr(t, e, r) {
1618
+ const n = x(null), a = d(() => {
1619
+ var i;
1620
+ return (i = t.value) == null ? void 0 : i[0].values.map(({ label: u, color: s, value: c }) => ({
1621
+ label: u || c.toString(),
1622
+ color: s,
1623
+ id: c
1624
+ }));
1625
+ }), o = d(() => {
1626
+ var i;
1627
+ return (i = t.value) == null ? void 0 : i[0].values.map(
1628
+ (u) => {
1629
+ var s;
1630
+ return (s = u.targets) == null ? void 0 : s.map(({ node: c, value: v, color: p }) => ({
1631
+ color: p,
1632
+ source: u.value ?? u.label,
1633
+ target: c,
1634
+ value: v
1635
+ }));
1636
+ }
1637
+ ).filter(Boolean).flat();
1638
+ }), l = d(() => It().nodeId(Q).nodeAlign(e.value.nodeAlign).nodePadding(e.value.nodePadding).nodeSort(e.value.nodeSort).nodeWidth(e.value.nodeWidth).linkSort(e.value.linkSort));
1639
+ return C([l, r], () => {
1640
+ try {
1641
+ const { x0: i, y0: u, x1: s, y1: c } = r.value;
1642
+ n.value = l.value.extent([
1643
+ [i, u],
1644
+ [s, c]
1645
+ ])({ nodes: a.value, links: o.value });
1646
+ } catch (i) {
1647
+ Lr(st.GraphProblem, i), n.value = Nr;
1648
+ }
1649
+ }), { graph: n };
1650
+ }
1651
+ function ke(t, e) {
1652
+ return e || (e = {}), t.targetLinks && t.targetLinks.forEach(({ source: r, value: n }) => {
1653
+ e[r.id] = n, ke(r, e);
1654
+ }), e;
1655
+ }
1656
+ function Ae(t, e) {
1657
+ return e || (e = {}), t.sourceLinks && t.sourceLinks.forEach(({ target: r, value: n }) => {
1658
+ e[r.id] = n, Ae(r, e);
1659
+ }), e;
1660
+ }
1661
+ function Sr(t, e) {
1662
+ return e.links.reduce((r, n) => (n.source.id in t && n.target.id in t && r.push(re(n)), r), []);
1663
+ }
1664
+ const Br = (t, e) => {
1665
+ let r;
1666
+ ct(t) ? r = {
1667
+ [t.id]: t.value,
1668
+ ...ke(t),
1669
+ ...Ae(t)
1670
+ } : r = {
1671
+ [t.source.id]: t.source.value,
1672
+ [t.target.id]: t.target.value,
1673
+ ...ke(t.source),
1674
+ ...Ae(t.target)
1675
+ };
1676
+ const n = Sr(r, e);
1677
+ return { nodes: r, links: n };
1678
+ }, Pr = (t) => {
1679
+ if (ct(t)) {
1680
+ const e = [...t.sourceLinks, ...t.targetLinks];
1681
+ return {
1682
+ nodes: e.reduce(
1683
+ (r, { source: n, target: a, value: o }) => n === t ? { ...r, [Q(a)]: o } : { ...r, [Q(n)]: o },
1684
+ { [Q(t)]: t.value }
1685
+ ),
1686
+ links: e.map((r) => re(r))
1687
+ };
1688
+ }
1689
+ return {
1690
+ nodes: {
1691
+ [Q(t.target)]: t.value,
1692
+ [Q(t.source)]: t.source.value
1693
+ },
1694
+ links: [re(t)]
1695
+ };
1696
+ };
1697
+ function Gr(t, e, r) {
1698
+ const n = x(null), a = d(() => n.value ? typeof e.value.highlightedElements == "function" ? e.value.highlightedElements(
1699
+ n.value,
1700
+ r.value
1701
+ ) : e.value.highlightedElements === "closest" ? Pr(n.value, r.value) : Br(n.value, r.value) : { nodes: {}, links: [] });
1702
+ return C(a, (o, l) => {
1703
+ if (o.links.length === 0 && Object.keys(o.nodes).length === 0) {
1704
+ t.value.forEach((i) => {
1705
+ i.node.id in l.nodes && ze(
1706
+ i,
1707
+ l.nodes[i.node.id],
1708
+ i.node.value,
1709
+ e.value.withTransition,
1710
+ !0
1711
+ );
1712
+ });
1713
+ return;
1714
+ }
1715
+ t.value.forEach((i) => {
1716
+ i.node.id in o.nodes && ze(
1717
+ i,
1718
+ i.node.value,
1719
+ o.nodes[i.node.id],
1720
+ e.value.withTransition
1721
+ );
1722
+ });
1723
+ }), { highlightedElements: a, hoveredElement: n };
1724
+ }
1725
+ const jr = /* @__PURE__ */ D({
1726
+ __name: "lume-alluvial-group",
1727
+ props: {
1728
+ ...de(),
1729
+ hoveredElementId: {
1730
+ type: [Number, String],
1731
+ default: null
1732
+ }
1733
+ },
1734
+ emits: ["node-click", "node-mouseenter", "node-mouseleave", "link-click", "link-mouseenter", "link-mouseleave"],
1735
+ setup(t, { emit: e }) {
1736
+ const r = t, { data: n, options: a } = N(r), o = x([]), l = x([]), i = x(null), { extents: u, updateExtents: s } = Tr(r.containerSize), { graph: c } = Rr(n, a, u), { hoveredElement: v, highlightedElements: p } = Gr(
1737
+ o,
1738
+ a,
1739
+ c
1740
+ ), h = d(() => le(a.value.valueFormat)), _ = d(
1741
+ () => Object.keys(p.value.nodes)
1742
+ ), m = d(
1743
+ () => o.value.reduce((b, w) => {
1744
+ const S = w.x + a.value.nodeWidth / 2;
1745
+ return b.includes(S) ? b : [...b, S];
1746
+ }, []).sort((b, w) => b - w)
1747
+ // Make sure positions are sorted in ascending order
1748
+ ), A = d(() => {
1749
+ if (!(!a.value.nodeHeaders || !a.value.nodeHeaders.length))
1750
+ return a.value.nodeHeaders.slice(0, m.value.length).map((b, w) => ({
1751
+ label: b,
1752
+ x: m.value[w]
1753
+ }));
1754
+ }), f = d(
1755
+ () => a.value.nodeHeaderPadding ?? $r
1756
+ );
1757
+ function T(b) {
1758
+ return _.value.length > 0 && !_.value.includes(b.toString());
1759
+ }
1760
+ function O(b) {
1761
+ return p.value.links.length > 0 && !p.value.links.includes(b);
1762
+ }
1763
+ function k(b, w) {
1764
+ b !== v.value && (v.value = b, e("link-mouseenter", { link: b, event: w }));
1765
+ }
1766
+ function g(b) {
1767
+ const w = v.value;
1768
+ v.value = null, e("link-mouseleave", { link: w, event: b });
1769
+ }
1770
+ function $(b) {
1771
+ if (b == null) {
1772
+ v.value = null;
1773
+ return;
1774
+ }
1775
+ const w = Ir(b, c.value) || Er(b, c.value);
1776
+ if (!w) {
1777
+ Z(V.InvalidHoveredElement);
1778
+ return;
1779
+ }
1780
+ v.value = w;
1781
+ }
1782
+ return C(c, (b) => {
1783
+ o.value = Cr(b.nodes), l.value = Hr(b.links).reverse(), v.value == null && r.hoveredElementId != null && $(r.hoveredElementId);
1784
+ }), C([r.containerSize, i], () => {
1785
+ if (r.containerSize.width && r.containerSize.height) {
1786
+ const b = Dr(c.value, i.value);
1787
+ s(b);
1788
+ }
1789
+ }), C(() => r.hoveredElementId, $), { __sfc: !0, props: r, emit: e, data: n, options: a, nodeBlocks: o, linkPaths: l, nodeTextRefs: i, extents: u, updateExtents: s, graph: c, hoveredElement: v, highlightedElements: p, formatValue: h, hoveredNodeIds: _, nodeColumnPositions: m, nodeHeaders: A, computedNodeHeaderPadding: f, isNodeFaded: T, isLinkFaded: O, handleLinkMouseover: k, handleLinkMouseleave: g, handleExternalHover: $, DEFAULT_COLOR: ce, GHOST_STROKE_WIDTH_OFFSET: xr };
1790
+ }
1791
+ });
1792
+ var Fr = function() {
1793
+ var e = this, r = e._self._c, n = e._self._setupProxy;
1794
+ return r("g", { staticClass: "lume-alluvial-group", attrs: { "data-j-alluvial-group": "" } }, [n.nodeHeaders ? r("g", e._l(n.nodeHeaders, function(a) {
1795
+ return r("text", { key: `header_${a.x}`, staticClass: "lume-alluvial-group__node-header lume-typography--caption", attrs: { x: a.x, y: -n.computedNodeHeaderPadding } }, [e._v(" " + e._s(a.label) + " ")]);
1796
+ }), 0) : e._e(), r("g", { staticClass: "lume-alluvial-link-group", on: { mouseleave: n.handleLinkMouseleave } }, [e._l(n.linkPaths, function(a) {
1797
+ return r("path", { key: `link-ghost_${a.id}`, staticClass: "lume-alluvial-group__link", class: [
1798
+ "lume-stroke--transparent",
1799
+ "lume-alluvial-group__link--ghost"
1800
+ ], attrs: { d: a.d, "stroke-width": a.strokeWidth + n.GHOST_STROKE_WIDTH_OFFSET, "data-j-alluvial-ghost": "" }, on: { click: function(o) {
1801
+ return n.emit("link-click", { link: a.link, event: o });
1802
+ }, mouseover: function(o) {
1803
+ return n.handleLinkMouseover(a.link, o);
1804
+ } } });
1805
+ }), e._l(n.linkPaths, function(a) {
1806
+ return r("path", { key: `link_${a.id}`, staticClass: "lume-alluvial-group__link", class: {
1807
+ [`lume-stroke--${a.color}`]: a.color,
1808
+ "lume-alluvial-group__link--faded": n.isLinkFaded(a.id)
1809
+ }, attrs: { d: a.d, "stroke-dasharray": e.containerSize.width, "stroke-dashoffset": e.containerSize.width, "stroke-width": a.strokeWidth, "data-j-alluvial-path": "", "data-id": a.id }, on: { click: function(o) {
1810
+ return n.emit("link-click", { link: a.link, event: o });
1811
+ }, mouseover: function(o) {
1812
+ return n.handleLinkMouseover(a.link, o);
1813
+ } } });
1814
+ })], 2), e._l(n.nodeBlocks, function(a, o) {
1815
+ return r("g", { key: `node-block_${o}`, staticClass: "lume-alluvial-group__node", class: {
1816
+ "lume-alluvial-group__node--faded": n.isNodeFaded(a.node.id)
1817
+ }, attrs: { "data-j-alluvial-group__node-block": "" } }, [r("g", { on: { click: function(l) {
1818
+ return n.emit("node-click", { node: a.node, event: l });
1819
+ }, mouseenter: function(l) {
1820
+ return n.emit("node-mouseenter", { node: a.node, event: l });
1821
+ }, mouseleave: function(l) {
1822
+ return n.emit("node-mouseleave", { node: a.node, event: l });
1823
+ }, mouseover: function(l) {
1824
+ n.hoveredElement = a.node;
1825
+ }, mouseout: function(l) {
1826
+ n.hoveredElement = null;
1827
+ } } }, [r("rect", { class: `lume-alluvial-group__node-block--${a.node.color || n.DEFAULT_COLOR}`, attrs: { x: a.x, y: a.y, height: a.height, width: a.width } }), r("text", { ref: "nodeTextRefs", refInFor: !0, staticClass: "lume-alluvial-group__node-text lume-typography--caption", class: {
1828
+ "lume-alluvial-group__node-text--right": a.node.depth === 0
1829
+ }, attrs: { transform: `translate(${a.textTransform.x},${a.textTransform.y})`, "data-id": a.node.id } }, [r("tspan", { staticClass: "lume-alluvial-group__node-title", domProps: { textContent: e._s(a.node.label) } }), r("tspan", { staticClass: "lume-alluvial-group__node-value", attrs: { x: "0", dy: "1.2em" }, domProps: { textContent: e._s(
1830
+ n.formatValue(
1831
+ a.node.transitionValue || a.node.value,
1832
+ a.node.value
1833
+ )
1834
+ ) } })])])]);
1835
+ })], 2);
1836
+ }, Vr = [], Mr = /* @__PURE__ */ I(
1837
+ jr,
1838
+ Fr,
1839
+ Vr,
1840
+ !1,
1841
+ null,
1842
+ "8ba64716",
1843
+ null,
1844
+ null
1845
+ );
1846
+ const zr = Mr.exports, Wr = {
1847
+ margins: {
1848
+ top: 0,
1849
+ right: 0,
1850
+ bottom: 0,
1851
+ left: 0
1852
+ },
1853
+ withAxes: !1,
1854
+ withTooltip: !1,
1855
+ withHover: !1,
1856
+ withLegend: !1,
1857
+ // Alluvial options
1858
+ highlightedElements: "full",
1859
+ nodePadding: 16,
1860
+ nodeWidth: 16,
1861
+ nodeAlign: Et,
1862
+ valueFormat: (t) => String(t)
1863
+ }, Zr = /* @__PURE__ */ D({
1864
+ __name: "lume-alluvial-diagram",
1865
+ props: {
1866
+ ...ur(Le)
1867
+ },
1868
+ setup(t) {
1869
+ const e = t, r = Y(G()), { options: n } = N(e), { allOptions: a } = j(n, Wr);
1870
+ function o(l) {
1871
+ return {
1872
+ ...l,
1873
+ noBaseScales: !0
1874
+ // Alluvial chart never uses base scales
1875
+ };
1876
+ }
1877
+ return { __sfc: !0, props: e, slots: r, options: n, allOptions: a, getAlluvialDiagramOptions: o, LumeChart: ee, LumeAlluvialGroup: zr };
1878
+ }
1879
+ });
1880
+ var Xr = function() {
1881
+ var e = this, r = e._self._c, n = e._self._setupProxy;
1882
+ return r(n.LumeChart, e._b({ attrs: { options: n.getAlluvialDiagramOptions(n.allOptions), "data-j-alluvial-diagram": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
1883
+ return [r(n.LumeAlluvialGroup, e._b({ attrs: { "hovered-element-id": e.hoveredElement } }, "lume-alluvial-group", a, !1))];
1884
+ } }, e._l(n.slots, function(a, o) {
1885
+ return { key: o, fn: function(l) {
1886
+ return [e._t(o, null, null, l || {})];
1887
+ } };
1888
+ })], null, !0) }, "lume-chart", n.props, !1));
1889
+ }, Ur = [], Yr = /* @__PURE__ */ I(
1890
+ Zr,
1891
+ Xr,
1892
+ Ur,
1893
+ !1,
1894
+ null,
1895
+ null,
1896
+ null,
1897
+ null
1898
+ );
1899
+ const lo = Yr.exports;
1900
+ var Te = /* @__PURE__ */ ((t) => (t.grouped = "grouped", t.stacked = "stacked", t))(Te || {});
1901
+ const Kr = /* @__PURE__ */ D({
1902
+ __name: "lume-bar-chart",
1903
+ props: {
1904
+ ...q(),
1905
+ type: {
1906
+ type: String,
1907
+ default: null,
1908
+ validator: (t) => t in Te || t == null
1909
+ }
1910
+ },
1911
+ setup(t) {
1912
+ const e = t, r = fe(
1913
+ () => import("./common/42f5d2fc.js")
1914
+ ), n = fe(
1915
+ () => import("./common/abc9d23d.js")
1916
+ ), a = fe(
1917
+ () => import("./common/0664fd4d.js")
1918
+ ), o = /* @__PURE__ */ new Map([
1919
+ ["single", r],
1920
+ ["grouped", n],
1921
+ ["stacked", a]
1922
+ ]), l = Y(G());
1923
+ function i(s) {
1924
+ return {
1925
+ ...s,
1926
+ startOnZero: !0,
1927
+ // Bar chart always starts on zero,
1928
+ tooltipOptions: {
1929
+ ...(s == null ? void 0 : s.tooltipOptions) || {},
1930
+ position: e.orientation === L.HORIZONTAL && "right"
1931
+ }
1932
+ };
1933
+ }
1934
+ const u = d(() => {
1935
+ if (e.data) {
1936
+ if (Le(e.data))
1937
+ return o.get("single");
1938
+ if (!e.type)
1939
+ throw new Error("Bar chart needs a type when there's multiple datasets.");
1940
+ return o.get(e.type);
1941
+ }
1942
+ });
1943
+ return { __sfc: !0, TYPES: Te, LumeSingleBarChart: r, LumeGroupedBarChart: n, LumeStackedBarChart: a, COMPONENT_MAP: o, props: e, slots: l, getBarChartOptions: i, component: u };
1944
+ }
1945
+ });
1946
+ var Jr = function() {
1947
+ var e = this, r = e._self._c, n = e._self._setupProxy;
1948
+ return r(n.component, e._b({ tag: "component", attrs: { options: n.getBarChartOptions(e.options) }, scopedSlots: e._u([e._l(n.slots, function(a, o) {
1949
+ return { key: o, fn: function(l) {
1950
+ return [e._t(o, null, null, l || {})];
1951
+ } };
1952
+ })], null, !0) }, "component", { ...n.props, ...e.$attrs }, !1));
1953
+ }, Qr = [], qr = /* @__PURE__ */ I(
1954
+ Kr,
1955
+ Jr,
1956
+ Qr,
1957
+ !1,
1958
+ null,
1959
+ null,
1960
+ null,
1961
+ null
1962
+ );
1963
+ const uo = qr.exports;
1964
+ function ea(t) {
1965
+ return Object.values(Xt).includes(t) || t == null;
1966
+ }
1967
+ function ta(t) {
1968
+ return Object.values(L).includes(t);
1969
+ }
1970
+ const na = (t = !1) => ({
1971
+ type: {
1972
+ type: String,
1973
+ default: null,
1974
+ validator: ea
1975
+ },
1976
+ ...t ? {
1977
+ orientation: {
1978
+ type: String,
1979
+ default: L.VERTICAL,
1980
+ validator: ta
1981
+ }
1982
+ } : {}
1983
+ });
1984
+ function dt(t) {
1985
+ const e = d(() => t.value.map((n) => ({
1986
+ ...n,
1987
+ values: n.values.map((a) => ({
1988
+ ...a,
1989
+ value: (a == null ? void 0 : a.value) || 0
1990
+ }))
1991
+ }))), r = d(() => {
1992
+ var n;
1993
+ return (n = e.value) == null ? void 0 : n.reduce((a, o) => (o.values.forEach((l, i) => {
1994
+ a[i] ? a[i].push(l) : a[i] = [l];
1995
+ }), a), []);
1996
+ });
1997
+ return { multiBarData: e, groupedData: r };
1998
+ }
1999
+ function ra(t, e) {
2000
+ return t.value.length === 1 ? "single" : e.value;
2001
+ }
2002
+ function aa(t, e, r, n) {
2003
+ const a = d(
2004
+ () => n.value === L.HORIZONTAL
2005
+ );
2006
+ function o(u) {
2007
+ Math.min(...u.domain()) > 0 && console.error("Bar linear scale domain cannot start above 0!");
2008
+ }
2009
+ const l = d(() => {
2010
+ const { padding: u, paddingInner: s, paddingOuter: c } = r.value;
2011
+ return a.value ? (() => (o(t.value), t.value))() : ue(
2012
+ t.value,
2013
+ n.value,
2014
+ { padding: u, paddingInner: s, paddingOuter: c }
2015
+ );
2016
+ }), i = d(() => {
2017
+ const { padding: u, paddingInner: s, paddingOuter: c } = r.value;
2018
+ return a.value ? ue(
2019
+ e.value,
2020
+ n.value,
2021
+ { padding: u, paddingInner: s, paddingOuter: c }
2022
+ ) : (() => (o(e.value), e.value))();
2023
+ });
2024
+ return { barXScale: l, barYScale: i };
2025
+ }
2026
+ function oa(t, e, r, n, a, o) {
2027
+ const l = d(
2028
+ () => n.value === L.HORIZONTAL
2029
+ );
2030
+ function i(v, p) {
2031
+ let h, _;
2032
+ return l.value ? (h = v >= 0 ? e.value(0) : e.value(v), _ = r.value(r.value.domain()[p])) : (h = e.value(e.value.domain()[p]), _ = v < 0 ? r.value(0) : r.value(v)), { x: h, y: _ };
2033
+ }
2034
+ function u(v) {
2035
+ return l.value ? v < 0 ? e.value(0) - e.value(v) : e.value(v) - e.value(0) : e.value.bandwidth();
2036
+ }
2037
+ function s(v) {
2038
+ return l.value ? r.value.bandwidth() : v < 0 ? r.value(v) - r.value(0) : r.value(0) - r.value(v);
2039
+ }
2040
+ function c(v, p, h) {
2041
+ const { value: _, color: m } = v, A = m ?? t.value[p].color ?? ce, { x: f, y: T } = i(_, h), O = u(_), k = s(_);
2042
+ return {
2043
+ classList: [`lume-fill--${A}`, ...o],
2044
+ x: f,
2045
+ y: T,
2046
+ width: O,
2047
+ height: k,
2048
+ isFaded: a.value !== -1 && a.value !== h,
2049
+ isNegative: _ < 0
2050
+ };
2051
+ }
2052
+ return { barAttributeGenerator: c };
2053
+ }
2054
+ function la(t, e, r, n, a, o) {
2055
+ const l = d(
2056
+ () => n.value === L.HORIZONTAL
2057
+ ), i = d(() => te().domain(t.value.map((_, m) => m)).range([0, e.value.bandwidth()]).padding(0)), u = d(() => te().domain(t.value.map((_, m) => m)).range([0, r.value.bandwidth()]).padding(0));
2058
+ function s(_, m, A) {
2059
+ if (l.value)
2060
+ return _ >= 0 ? e.value(0) : e.value(_);
2061
+ const f = e.value.domain();
2062
+ return e.value(f[m]) + i.value(A);
2063
+ }
2064
+ function c(_, m, A) {
2065
+ if (l.value) {
2066
+ const f = r.value.domain();
2067
+ return r.value(f[m]) + u.value(A);
2068
+ }
2069
+ return _ < 0 ? r.value(0) : r.value(_);
2070
+ }
2071
+ function v(_) {
2072
+ return l.value ? _ < 0 ? e.value(0) - e.value(_) : e.value(_) - e.value(0) : i.value.bandwidth();
2073
+ }
2074
+ function p(_) {
2075
+ return l.value ? u.value.bandwidth() : _ < 0 ? r.value(_) - r.value(0) : r.value(0) - r.value(_);
2076
+ }
2077
+ function h(_, m, A) {
2078
+ const { value: f, color: T } = _, O = T ?? t.value[m].color ?? Object.values(P)[m], k = s(f, A, m), g = c(f, A, m), $ = v(f), b = p(f);
2079
+ return {
2080
+ classList: [`lume-fill--${O}`, ...o],
2081
+ x: k,
2082
+ y: g,
2083
+ width: $,
2084
+ height: b,
2085
+ isFaded: a.value !== -1 && a.value !== A,
2086
+ isNegative: f < 0
2087
+ };
2088
+ }
2089
+ return { barAttributeGenerator: h };
2090
+ }
2091
+ function ua(t, e) {
2092
+ const r = d(
2093
+ () => e.value === L.HORIZONTAL
2094
+ ), n = d(() => {
2095
+ const i = t.value.map(
2096
+ (u) => u.filter((s) => s.value < 0).reduce((s, c) => s + c.value, 0)
2097
+ );
2098
+ return Math.min(...i);
2099
+ }), a = d(() => {
2100
+ const i = t.value.map(
2101
+ (u) => u.reduce(
2102
+ (s, c) => c.value >= 0 ? s + c.value : s,
2103
+ 0
2104
+ )
2105
+ );
2106
+ return Math.max(...i);
2107
+ });
2108
+ function o(i, u, s) {
2109
+ return r.value ? ne().domain([n.value, a.value]).range([0, s.width]) : Object.assign(
2110
+ ue(
2111
+ te().domain(u.map((c, v) => v)).range([0, s.width])
2112
+ ),
2113
+ { labels: u }
2114
+ );
2115
+ }
2116
+ function l(i, u, s) {
2117
+ return r.value ? Object.assign(
2118
+ ue(
2119
+ te().domain(u.map((c, v) => v)).range([0, s.height])
2120
+ ),
2121
+ { labels: u }
2122
+ ) : ne().domain([a.value, n.value]).range([0, s.height]);
2123
+ }
2124
+ return { stackedXScaleGenerator: o, stackedYScaleGenerator: l };
2125
+ }
2126
+ function ia(t, e, r, n, a, o) {
2127
+ const l = d(
2128
+ () => n.value === L.HORIZONTAL
2129
+ ), i = d(
2130
+ () => l.value ? r.value.domain() : e.value.domain()
2131
+ ), u = d(
2132
+ () => t.value.map((f) => f.values.map((T) => T == null ? void 0 : T.value))
2133
+ );
2134
+ function s(f, T, O) {
2135
+ let k, g;
2136
+ return l.value ? (k = e.value(f >= 0 ? 0 + O : f + O), g = r.value(i.value[T])) : (k = e.value(i.value[T]), g = r.value(f >= 0 ? f + O : 0 + O)), { x: k, y: g };
2137
+ }
2138
+ function c(f) {
2139
+ return l.value ? e.value(f) - e.value(0) : e.value.bandwidth();
2140
+ }
2141
+ function v(f) {
2142
+ return l.value ? e.value(0) - e.value(f) : e.value.bandwidth();
2143
+ }
2144
+ function p(f) {
2145
+ return l.value ? r.value.bandwidth() : r.value(0) - r.value(f);
2146
+ }
2147
+ function h(f) {
2148
+ return l.value ? r.value.bandwidth() : r.value(f) - r.value(0);
2149
+ }
2150
+ function _(f, T) {
2151
+ return f ? u.value.reduce((O, k, g) => (g < f && k[T] >= 0 && (O += k[T]), O), 0) : 0;
2152
+ }
2153
+ function m(f, T) {
2154
+ return f ? u.value.reduce((O, k, g) => (g < f && k[T] < 0 && (O += k[T]), O), 0) : 0;
2155
+ }
2156
+ function A(f, T, O) {
2157
+ const { value: k, color: g } = f, $ = k >= 0 ? c(k) : v(k), b = k >= 0 ? p(k) : h(k), w = k >= 0 ? _(T, O) : m(T, O), { x: S, y: F } = s(k, O, w);
2158
+ return {
2159
+ classList: [`lume-fill--${g ?? t.value[T].color ?? Object.values(P)[T]}`, ...o],
2160
+ width: $,
2161
+ height: b,
2162
+ x: S,
2163
+ y: F,
2164
+ isFaded: a.value !== -1 && a.value !== O,
2165
+ isNegative: k < 0
2166
+ };
2167
+ }
2168
+ return { barAttributeGenerator: A };
2169
+ }
2170
+ const We = {
2171
+ single: oa,
2172
+ grouped: la,
2173
+ stacked: ia
2174
+ }, sa = /* @__PURE__ */ D({
2175
+ __name: "lume-bar-group",
2176
+ props: {
2177
+ ...de(),
2178
+ classList: {
2179
+ type: [String, Array],
2180
+ default: () => []
2181
+ },
2182
+ ...na(!0),
2183
+ transition: {
2184
+ type: Boolean,
2185
+ default: !0
2186
+ }
2187
+ },
2188
+ emits: ["bar-click", "lume__internal--hover"],
2189
+ setup(t, { emit: e }) {
2190
+ const r = t, {
2191
+ data: n,
2192
+ hoveredIndex: a,
2193
+ options: o,
2194
+ orientation: l,
2195
+ transition: i,
2196
+ type: u,
2197
+ xScale: s,
2198
+ yScale: c,
2199
+ classList: v
2200
+ } = N(r), { groupedData: p } = dt(n), { barXScale: h, barYScale: _ } = aa(
2201
+ s,
2202
+ c,
2203
+ o,
2204
+ l
2205
+ ), m = d(() => typeof v.value == "string" ? [v.value] : v.value), A = d(() => {
2206
+ const T = ra(n, u), { barAttributeGenerator: O } = We[T](
2207
+ n,
2208
+ h,
2209
+ _,
2210
+ l,
2211
+ a,
2212
+ m.value
2213
+ );
2214
+ return O;
2215
+ }), f = d(() => {
2216
+ if (i.value)
2217
+ return l.value === L.HORIZONTAL ? "width" : "height";
2218
+ });
2219
+ return { __sfc: !0, MIXIN_MAP: We, props: r, emit: e, data: n, hoveredIndex: a, options: o, orientation: l, transition: i, type: u, xScale: s, yScale: c, classList: v, groupedData: p, barXScale: h, barYScale: _, computedClasses: m, getBarAttributes: A, computedTransition: f, LumeBar: Ie };
2220
+ }
2221
+ });
2222
+ var ca = function() {
2223
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2224
+ return r("g", { staticClass: "lume-bar-group", attrs: { "data-j-bars-group": "" } }, e._l(n.groupedData, function(a, o) {
2225
+ return r("g", { key: o, on: { mouseenter: function(l) {
2226
+ return n.emit("lume__internal--hover", o);
2227
+ } } }, e._l(a, function(l, i) {
2228
+ return r(n.LumeBar, e._b({ key: `bar-${i}`, attrs: { transition: n.computedTransition, "data-j-lume-bar": "" }, on: { click: function(u) {
2229
+ return n.emit("bar-click", {
2230
+ index: o,
2231
+ datasetIndex: i,
2232
+ event: u
2233
+ });
2234
+ } } }, "lume-bar", n.getBarAttributes(l, i, o, a), !1));
2235
+ }), 1);
2236
+ }), 0);
2237
+ }, da = [], va = /* @__PURE__ */ I(
2238
+ sa,
2239
+ ca,
2240
+ da,
2241
+ !1,
2242
+ null,
2243
+ null,
2244
+ null,
2245
+ null
2246
+ );
2247
+ const Ce = va.exports, _a = {
2248
+ [L.VERTICAL]: {
2249
+ withTooltip: !0,
2250
+ xAxisOptions: {},
2251
+ yAxisOptions: { gridLines: !0 },
2252
+ margins: X.VERTICAL
2253
+ },
2254
+ [L.HORIZONTAL]: {
2255
+ withTooltip: !0,
2256
+ xAxisOptions: { gridLines: !0 },
2257
+ yAxisOptions: { gridLines: !1 },
2258
+ margins: X.HORIZONTAL
2259
+ }
2260
+ }, pa = /* @__PURE__ */ D({
2261
+ __name: "lume-single-bar-chart",
2262
+ props: {
2263
+ ...q(Le)
2264
+ },
2265
+ setup(t) {
2266
+ const e = t, r = Y(G()), { orientation: n, options: a } = N(e), o = d(
2267
+ () => _a[n.value || L.VERTICAL]
2268
+ // needs to be computed so that default options are reactive
2269
+ ), { allOptions: l } = j(a, o);
2270
+ return { __sfc: !0, props: e, slots: r, orientation: n, options: a, baseOptions: o, allOptions: l, LumeChart: ee, LumeBarGroup: Ce };
2271
+ }
2272
+ });
2273
+ var fa = function() {
2274
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2275
+ return r(n.LumeChart, e._b({ attrs: { "chart-type": "single-bar", options: n.allOptions, "data-j-single-bar-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2276
+ return [r(n.LumeBarGroup, e._b({ attrs: { orientation: n.orientation } }, "lume-bar-group", a, !1))];
2277
+ } }, e._l(n.slots, function(a, o) {
2278
+ return { key: o, fn: function(l) {
2279
+ return [e._t(o, null, null, l || {})];
2280
+ } };
2281
+ })], null, !0) }, "lume-chart", n.props, !1));
2282
+ }, ma = [], ha = /* @__PURE__ */ I(
2283
+ pa,
2284
+ fa,
2285
+ ma,
2286
+ !1,
2287
+ null,
2288
+ null,
2289
+ null,
2290
+ null
2291
+ );
2292
+ const io = ha.exports, ga = {
2293
+ [L.VERTICAL]: {
2294
+ withTooltip: !0,
2295
+ xAxisOptions: {},
2296
+ yAxisOptions: { gridLines: !0 },
2297
+ margins: X.VERTICAL
2298
+ },
2299
+ [L.HORIZONTAL]: {
2300
+ withTooltip: !0,
2301
+ xAxisOptions: { gridLines: !0 },
2302
+ yAxisOptions: { gridLines: !1 },
2303
+ margins: X.HORIZONTAL,
2304
+ tooltipOptions: { position: "right" }
2305
+ }
2306
+ }, ya = /* @__PURE__ */ D({
2307
+ __name: "lume-grouped-bar-chart",
2308
+ props: {
2309
+ ...q()
2310
+ },
2311
+ setup(t) {
2312
+ const e = t, r = Y(G()), { orientation: n, options: a } = N(e), o = d(
2313
+ () => ga[n.value || L.VERTICAL]
2314
+ // needs to be computed so that default options are reactive
2315
+ ), { allOptions: l } = j(a, o);
2316
+ return { __sfc: !0, props: e, slots: r, orientation: n, options: a, baseOptions: o, allOptions: l, LumeChart: ee, LumeBarGroup: Ce };
2317
+ }
2318
+ });
2319
+ var ba = function() {
2320
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2321
+ return r(n.LumeChart, e._b({ attrs: { "chart-type": "grouped-bar", options: n.allOptions, "data-j-grouped-bar-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2322
+ return [r(n.LumeBarGroup, e._b({ attrs: { type: "grouped" } }, "lume-bar-group", a, !1))];
2323
+ } }, e._l(n.slots, function(a, o) {
2324
+ return { key: o, fn: function(l) {
2325
+ return [e._t(o, null, null, l || {})];
2326
+ } };
2327
+ })], null, !0) }, "lume-chart", n.props, !1));
2328
+ }, ka = [], Aa = /* @__PURE__ */ I(
2329
+ ya,
2330
+ ba,
2331
+ ka,
2332
+ !1,
2333
+ null,
2334
+ null,
2335
+ null,
2336
+ null
2337
+ );
2338
+ const so = Aa.exports, Ta = {
2339
+ [L.VERTICAL]: {
2340
+ withTooltip: !0,
2341
+ xAxisOptions: {},
2342
+ yAxisOptions: { gridLines: !0 },
2343
+ margins: X.VERTICAL
2344
+ },
2345
+ [L.HORIZONTAL]: {
2346
+ withTooltip: !0,
2347
+ xAxisOptions: { gridLines: !0 },
2348
+ yAxisOptions: { gridLines: !1 },
2349
+ margins: X.HORIZONTAL,
2350
+ tooltipOptions: { position: "right" }
2351
+ }
2352
+ }, Oa = /* @__PURE__ */ D({
2353
+ __name: "lume-stacked-bar-chart",
2354
+ props: {
2355
+ ...q()
2356
+ },
2357
+ setup(t) {
2358
+ const e = t, r = Y(G()), { data: n, orientation: a, options: o } = N(e), l = d(
2359
+ () => Ta[a.value || L.VERTICAL]
2360
+ // needs to be computed so that default options are reactive
2361
+ ), { allOptions: i } = j(o, l), { internalData: u } = De(n), { groupedData: s } = dt(u), { stackedXScaleGenerator: c, stackedYScaleGenerator: v } = ua(
2362
+ s,
2363
+ a
2364
+ );
2365
+ return { __sfc: !0, props: e, slots: r, data: n, orientation: a, options: o, baseOptions: l, allOptions: i, internalData: u, groupedData: s, stackedXScaleGenerator: c, stackedYScaleGenerator: v, LumeChart: ee, LumeBarGroup: Ce };
2366
+ }
2367
+ });
2368
+ var La = function() {
2369
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2370
+ return r(n.LumeChart, e._b({ attrs: { "chart-type": "stacked-bar", options: n.allOptions, "x-scale": n.stackedXScaleGenerator, "y-scale": n.stackedYScaleGenerator, "data-j-stacked-bar-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2371
+ return [r(n.LumeBarGroup, e._b({ attrs: { type: "stacked" } }, "lume-bar-group", a, !1))];
2372
+ } }, e._l(n.slots, function(a, o) {
2373
+ return { key: o, fn: function(l) {
2374
+ return [e._t(o, null, null, l || {})];
2375
+ } };
2376
+ })], null, !0) }, "lume-chart", n.props, !1));
2377
+ }, xa = [], $a = /* @__PURE__ */ I(
2378
+ Oa,
2379
+ La,
2380
+ xa,
2381
+ !1,
2382
+ null,
2383
+ null,
2384
+ null,
2385
+ null
2386
+ );
2387
+ const co = $a.exports, Ze = 2, wa = /* @__PURE__ */ D({
2388
+ __name: "lume-line",
2389
+ props: {
2390
+ pathDefinition: {
2391
+ type: String,
2392
+ required: !0
2393
+ },
2394
+ width: {
2395
+ type: Number,
2396
+ default: Ze
2397
+ },
2398
+ color: {
2399
+ type: String,
2400
+ default: P.Skyblue
2401
+ },
2402
+ dashed: {
2403
+ type: Boolean,
2404
+ default: !1
2405
+ },
2406
+ transition: {
2407
+ type: Boolean,
2408
+ default: !0
2409
+ },
2410
+ animationDelay: {
2411
+ type: Number,
2412
+ default: 0
2413
+ },
2414
+ animationDuration: {
2415
+ type: Number,
2416
+ default: 0.2
2417
+ }
2418
+ },
2419
+ emits: ["click"],
2420
+ setup(t, { emit: e }) {
2421
+ const r = x(null);
2422
+ return M(() => se(r.value)), { __sfc: !0, DEFAULT_LINE_WIDTH: Ze, emit: e, root: r };
2423
+ }
2424
+ });
2425
+ var Ia = function() {
2426
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2427
+ return r("path", { ref: "root", staticClass: "lume-line", class: {
2428
+ [`lume-stroke--${e.color}`]: !0,
2429
+ "lume-line--dashed": e.dashed,
2430
+ "lume-line--transition": e.transition
2431
+ }, style: {
2432
+ animationDelay: e.transition && e.animationDelay + "s",
2433
+ animationDuration: e.transition && e.animationDuration + "s"
2434
+ }, attrs: { d: e.pathDefinition, "stroke-width": e.width, "data-j-line": "" }, on: { click: function(a) {
2435
+ return n.emit("click", a);
2436
+ } } });
2437
+ }, Ea = [], Da = /* @__PURE__ */ I(
2438
+ wa,
2439
+ Ia,
2440
+ Ea,
2441
+ !1,
2442
+ null,
2443
+ "08896455",
2444
+ null,
2445
+ null
2446
+ );
2447
+ const Ca = Da.exports, Xe = 4, Ha = /* @__PURE__ */ D({
2448
+ __name: "lume-point",
2449
+ props: {
2450
+ x: { type: Number, required: !0 },
2451
+ y: { type: Number, required: !0 },
2452
+ color: {
2453
+ type: String,
2454
+ default: P.Skyblue
2455
+ },
2456
+ radius: {
2457
+ type: Number,
2458
+ default: Xe
2459
+ },
2460
+ active: {
2461
+ type: Boolean,
2462
+ default: !1
2463
+ }
2464
+ },
2465
+ emits: ["click"],
2466
+ setup(t, { emit: e }) {
2467
+ const r = t, n = x(null), a = d(() => r.radius / 2);
2468
+ return M(() => se(n.value)), { __sfc: !0, DEFAULT_RADIUS: Xe, props: r, emit: e, root: n, strokeWidth: a };
2469
+ }
2470
+ });
2471
+ var Na = function() {
2472
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2473
+ return r("circle", { ref: "root", staticClass: "lume-point", class: `lume-stroke--${e.color}`, attrs: { cx: e.x, cy: e.y, r: e.active ? e.radius : 0, "stroke-width": n.strokeWidth, "data-j-point": "" }, on: { click: function(a) {
2474
+ return n.emit("click", a);
2475
+ } } });
2476
+ }, Ra = [], Sa = /* @__PURE__ */ I(
2477
+ Ha,
2478
+ Na,
2479
+ Ra,
2480
+ !1,
2481
+ null,
2482
+ "9bacbd7d",
2483
+ null,
2484
+ null
2485
+ );
2486
+ const Ba = Sa.exports;
2487
+ function vt(t) {
2488
+ function e(o) {
2489
+ let l = null;
2490
+ return o == null ? void 0 : o.reduce((i, u, s) => (u == null || u.value == null ? (l ? l.push(s) : l = [s], s === (o == null ? void 0 : o.length) - 1 && i.push(l)) : l && (i.push(l), l = null), i), []);
2491
+ }
2492
+ function r(o, l, i, u) {
2493
+ const v = Math.abs(o - l) / (i + 1) * (u + 1);
2494
+ return o > l ? o - v : o + v;
2495
+ }
2496
+ function n(o) {
2497
+ return function(i) {
2498
+ return !!o.find(
2499
+ (u) => u.includes(i) || u.includes(i - 1)
2500
+ );
2501
+ };
2502
+ }
2503
+ return { computedLineData: d(() => t.value.map((o) => {
2504
+ const l = e(o.values);
2505
+ return {
2506
+ ...o,
2507
+ isDashed: n(l),
2508
+ values: o.values.map((i, u) => {
2509
+ var c, v;
2510
+ const s = l.find(
2511
+ (p) => p.includes(u)
2512
+ );
2513
+ if (s) {
2514
+ const p = s[0] - 1, h = s[s.length - 1] + 1;
2515
+ let _ = (c = o.values[p]) == null ? void 0 : c.value, m = (v = o.values[h]) == null ? void 0 : v.value;
2516
+ return _ == null && (_ = m), m == null && (m = _), {
2517
+ value: r(
2518
+ _,
2519
+ m,
2520
+ s.length,
2521
+ s.indexOf(u)
2522
+ ),
2523
+ label: rt
2524
+ };
2525
+ }
2526
+ return i;
2527
+ })
2528
+ };
2529
+ })) };
2530
+ }
2531
+ function Pa(t, e) {
2532
+ const r = xe(t) / 2;
2533
+ return (n, a) => t(t.domain()[e + (a - 1)]) + r;
2534
+ }
2535
+ function Ga(t, e) {
2536
+ return (r, n) => t(e + (n - 1));
2537
+ }
2538
+ function ja(t, e, r, n) {
2539
+ return Lt().x(
2540
+ U(r) ? Pa(r, t) : Ga(r, t)
2541
+ ).y((o) => n(o))(e);
2542
+ }
2543
+ const Ue = 1, Fa = /* @__PURE__ */ D({
2544
+ __name: "lume-line-group",
2545
+ props: {
2546
+ ...de(),
2547
+ withPoints: {
2548
+ type: Boolean,
2549
+ default: !0
2550
+ },
2551
+ transition: {
2552
+ type: Boolean,
2553
+ default: !0
2554
+ }
2555
+ },
2556
+ emits: ["line-click", "point-click", "lume__internal--hover"],
2557
+ setup(t, { emit: e }) {
2558
+ const r = t, { data: n, options: a, xScale: o, yScale: l } = N(r), i = Oe(
2559
+ "tooltipAnchorAttributes",
2560
+ null
2561
+ ), { updateTooltipAnchorAttributes: u } = it(
2562
+ i,
2563
+ a,
2564
+ o,
2565
+ l
2566
+ ), s = d(() => {
2567
+ if (n.value.every(($) => $.isDashed))
2568
+ return n.value;
2569
+ const { computedLineData: g } = vt(n);
2570
+ return a.value.withTooltip !== !1 && (i != null && i.value) && u(g.value), g.value;
2571
+ }), c = d(() => {
2572
+ if (r.hoveredIndex === -1)
2573
+ return;
2574
+ const g = Gt(
2575
+ s.value,
2576
+ r.hoveredIndex
2577
+ );
2578
+ return {
2579
+ d: `M ${be(o.value, r.hoveredIndex)},${l.value.range()[1]}
2580
+ V ${l.value(g)}`
2581
+ // Move to X index, Vertical line to the highest point
2582
+ };
2583
+ }), v = d(
2584
+ () => o.value && Ue / (jt(o.value) - 1)
2585
+ // Subtracting the first line (read below)
2586
+ ), p = d(
2587
+ () => {
2588
+ var g;
2589
+ return ((g = a.value) == null ? void 0 : g.lineWidth) * 2 || void 0;
2590
+ }
2591
+ // If no `lineWidth`, returns NaN which needs to be undefined
2592
+ ), h = d(() => xe(o.value) / 2), _ = d(() => o.value.domain()), m = d(
2593
+ () => a.value.withPoints ?? r.withPoints
2594
+ );
2595
+ function A(g) {
2596
+ return s.value[g].values;
2597
+ }
2598
+ function f(g, $) {
2599
+ var w, S;
2600
+ const b = g === 0 ? [] : [
2601
+ (w = A($)[g - 1]) == null ? void 0 : w.value,
2602
+ (S = A($)[g]) == null ? void 0 : S.value
2603
+ ];
2604
+ return ja(
2605
+ g,
2606
+ b,
2607
+ o.value,
2608
+ l.value
2609
+ ) || "";
2610
+ }
2611
+ function T(g) {
2612
+ return {
2613
+ animationDelay: g < 2 ? 0 : (g - 1) * v.value,
2614
+ animationDuration: v.value
2615
+ };
2616
+ }
2617
+ function O(g, $) {
2618
+ var w;
2619
+ const b = (w = A($)[g]) == null ? void 0 : w.value;
2620
+ return {
2621
+ x: U(o.value) ? r.xScale(_.value[g]) + h.value : r.xScale(g),
2622
+ y: l.value(b)
2623
+ };
2624
+ }
2625
+ function k(g) {
2626
+ return r.hoveredIndex === g;
2627
+ }
2628
+ return { __sfc: !0, LUME_TRANSITION_TIME_FULL: Ue, props: r, emit: e, data: n, options: a, xScale: o, yScale: l, tooltipAnchorAttributes: i, updateTooltipAnchorAttributes: u, computedGroupData: s, overlayLineAttributes: c, animationDuration: v, pointRadius: p, xAxisOffset: h, domain: _, computedWithPoints: m, getValuesFromDataset: A, getPathDefinition: f, getLineTransitionParams: T, getPointPosition: O, isPointActive: k, LumeLine: Ca, LumePoint: Ba };
2629
+ }
2630
+ });
2631
+ var Va = function() {
2632
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2633
+ return r("g", { staticClass: "lume-line-group", attrs: { "data-j-lume-line-group": "" } }, [r("path", e._b({ staticClass: "lume-line-group__overlay-line", attrs: { "data-j-lume-line-group__overlay-line": "" } }, "path", n.overlayLineAttributes, !1)), e._l(n.computedGroupData, function(a, o) {
2634
+ return r("g", { key: a.label, staticClass: "lume-line-group__group" }, [r("g", { staticClass: "lume-line-group__lines" }, e._l(a.values, function(l, i) {
2635
+ return r(n.LumeLine, e._b({ key: `line-${i}`, attrs: { color: a.color, dashed: a.isDashed(i), "path-definition": n.getPathDefinition(i, o), transition: e.transition, width: n.options.lineWidth }, on: { click: function(u) {
2636
+ return n.emit("line-click", { index: i, datasetIndex: o, event: u });
2637
+ } } }, "lume-line", n.getLineTransitionParams(i), !1));
2638
+ }), 1), n.computedWithPoints ? r("g", { staticClass: "lume-line-group__points", attrs: { "data-j-lume-line-group__points": "" } }, e._l(a.values, function(l, i) {
2639
+ return r(n.LumePoint, e._b({ key: `point-${i}`, attrs: { active: n.isPointActive(i), color: a.color, index: i, radius: n.pointRadius }, on: { click: function(u) {
2640
+ return n.emit("point-click", { index: i, datasetIndex: o, event: u });
2641
+ } } }, "lume-point", n.getPointPosition(i, o), !1));
2642
+ }), 1) : e._e()]);
2643
+ })], 2);
2644
+ }, Ma = [], za = /* @__PURE__ */ I(
2645
+ Fa,
2646
+ Va,
2647
+ Ma,
2648
+ !1,
2649
+ null,
2650
+ "299f46e4",
2651
+ null,
2652
+ null
2653
+ );
2654
+ const _t = za.exports, Wa = {
2655
+ margins: X.VERTICAL,
2656
+ startOnZero: !0,
2657
+ withTooltip: !0,
2658
+ xAxisOptions: {},
2659
+ yAxisOptions: { gridLines: !0 }
2660
+ }, Za = /* @__PURE__ */ D({
2661
+ __name: "lume-line-chart",
2662
+ props: {
2663
+ ...q(null, !1)
2664
+ },
2665
+ setup(t) {
2666
+ const e = t, r = Y(G()), { options: n } = N(e), { allOptions: a } = j(n, Wa);
2667
+ return { __sfc: !0, props: e, slots: r, options: n, allOptions: a, LumeChart: ee, LumeLineGroup: _t };
2668
+ }
2669
+ });
2670
+ var Xa = function() {
2671
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2672
+ return r(n.LumeChart, e._b({ attrs: { "chart-type": "line", options: n.allOptions, "data-j-lume-line-chart": "" }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2673
+ return [r(n.LumeLineGroup, e._b({}, "lume-line-group", a, !1))];
2674
+ } }, e._l(n.slots, function(a, o) {
2675
+ return { key: o, fn: function(l) {
2676
+ return [e._t(o, null, null, l || {})];
2677
+ } };
2678
+ })], null, !0) }, "lume-chart", n.props, !1));
2679
+ }, Ua = [], Ya = /* @__PURE__ */ I(
2680
+ Za,
2681
+ Xa,
2682
+ Ua,
2683
+ !1,
2684
+ null,
2685
+ null,
2686
+ null,
2687
+ null
2688
+ );
2689
+ const vo = Ya.exports;
2690
+ function Ka(t) {
2691
+ return { areaPathDefinition: d(
2692
+ () => function(r, n) {
2693
+ if (!r || !n)
2694
+ return;
2695
+ const a = t.value[0].values;
2696
+ return xt().x((o, l) => r(l)).y0(n(Math.min(...n.domain()))).y1((o) => n(o.value))(a);
2697
+ }
2698
+ ) };
2699
+ }
2700
+ const Ja = {
2701
+ margins: {
2702
+ top: 0,
2703
+ right: 0,
2704
+ bottom: 0,
2705
+ left: 0
2706
+ },
2707
+ withAxes: !1,
2708
+ showArea: !0,
2709
+ startOnZero: !0,
2710
+ withLegend: !1,
2711
+ tooltipOptions: {
2712
+ showTitle: !1
2713
+ }
2714
+ }, Qa = /* @__PURE__ */ D({
2715
+ __name: "lume-sparkline-chart",
2716
+ props: {
2717
+ ...Ee(null),
2718
+ ...ae()
2719
+ },
2720
+ setup(t, { expose: e }) {
2721
+ const r = t, n = Y(G()), { data: a, options: o } = N(r), { internalData: l } = De(a), { allOptions: i } = j(o, Ja), { computedLineData: u } = vt(l), { areaPathDefinition: s } = Ka(u), c = d(() => l.value[0].color), v = d(
2722
+ () => a.value[0].areaColor || c.value
2723
+ );
2724
+ function p(_) {
2725
+ return {
2726
+ ..._,
2727
+ noMinSize: !0
2728
+ };
2729
+ }
2730
+ function h(_, m, A) {
2731
+ return ne().range([0, A.width]).domain([0, _[0].values.length - 1]);
2732
+ }
2733
+ return e({
2734
+ areaPathDefinition: s
2735
+ }), { __sfc: !0, props: r, slots: n, data: a, options: o, internalData: l, allOptions: i, computedLineData: u, areaPathDefinition: s, computedColor: c, areaColor: v, getSparklineOptions: p, xScaleGenerator: h, LumeChart: ee, LumeLineGroup: _t };
2736
+ }
2737
+ });
2738
+ var qa = function() {
2739
+ var e = this, r = e._self._c, n = e._self._setupProxy;
2740
+ return r(n.LumeChart, e._b({ attrs: { "chart-type": "line", options: n.getSparklineOptions(n.allOptions), "x-scale": n.xScaleGenerator }, scopedSlots: e._u([{ key: "groups", fn: function(a) {
2741
+ return [n.allOptions.showArea ? r("path", { class: [
2742
+ "sparkline-chart__area",
2743
+ `lume-fill--${n.areaColor || n.computedColor}`,
2744
+ "lume-fill--faded"
2745
+ ], attrs: { d: n.areaPathDefinition(a.xScale, a.yScale), "data-j-sparkline__area": "" } }) : e._e(), r(n.LumeLineGroup, e._b({ attrs: { "with-points": !1 } }, "lume-line-group", a, !1))];
2746
+ } }, e._l(n.slots, function(a, o) {
2747
+ return { key: o, fn: function(l) {
2748
+ return [e._t(o, null, null, l || {})];
2749
+ } };
2750
+ })], null, !0) }, "lume-chart", n.props, !1));
2751
+ }, eo = [], to = /* @__PURE__ */ I(
2752
+ Qa,
2753
+ qa,
2754
+ eo,
2755
+ !1,
2756
+ null,
2757
+ "60a59b77",
2758
+ null,
2759
+ null
2760
+ );
2761
+ const _o = to.exports;
6
2762
  export {
7
- s as LumeAlluvialDiagram,
8
- t as LumeAlluvialGroup,
9
- i as LumeAxis,
10
- o as LumeBar,
11
- p as LumeBarChart,
12
- l as LumeBarGroup,
13
- h as LumeChart,
14
- n as LumeChartContainer,
15
- C as LumeChartLegend,
16
- B as LumeGroupedBarChart,
17
- G as LumeLine,
18
- d as LumeLineChart,
19
- g as LumeLineGroup,
20
- k as LumeOverlayGroup,
21
- v as LumePoint,
22
- A as LumeSingleBarChart,
23
- S as LumeSparklineChart,
24
- c as LumeStackedBarChart,
25
- f as LumeTooltip
2763
+ lo as LumeAlluvialDiagram,
2764
+ zr as LumeAlluvialGroup,
2765
+ dn as LumeAxis,
2766
+ Ie as LumeBar,
2767
+ uo as LumeBarChart,
2768
+ Ce as LumeBarGroup,
2769
+ ee as LumeChart,
2770
+ Tn as LumeChartContainer,
2771
+ wn as LumeChartLegend,
2772
+ so as LumeGroupedBarChart,
2773
+ Ca as LumeLine,
2774
+ vo as LumeLineChart,
2775
+ _t as LumeLineGroup,
2776
+ vr as LumeOverlayGroup,
2777
+ Ba as LumePoint,
2778
+ io as LumeSingleBarChart,
2779
+ _o as LumeSparklineChart,
2780
+ co as LumeStackedBarChart,
2781
+ Un as LumeTooltip
26
2782
  };
27
2783
  //# sourceMappingURL=index.js.map