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