@cfasim-ui/charts 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, normalizeClass as u, normalizeProps as d, normalizeStyle as f, onMounted as p, onUnmounted as ee, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, toRaw as y, unref as b, useId as x, watch as S, withCtx as C, withModifiers as w } from "vue";
2
- import { DropdownMenuContent as T, DropdownMenuItem as E, DropdownMenuPortal as D, DropdownMenuRoot as O, DropdownMenuTrigger as k, PopoverAnchor as A, PopoverContent as j, PopoverPortal as M, PopoverRoot as N } from "reka-ui";
3
- import { geoAlbersUsa as P, geoPath as F } from "d3-geo";
4
- import { zoom as te } from "d3-zoom";
5
- import { select as ne } from "d3-selection";
6
- import { feature as re, merge as ie, mesh as ae } from "topojson-client";
1
+ import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, normalizeClass as u, normalizeProps as d, normalizeStyle as f, onMounted as p, onUnmounted as ee, openBlock as m, ref as h, renderList as g, renderSlot as _, toDisplayString as v, toRaw as y, unref as b, useId as x, watch as te, withCtx as S, withModifiers as C } from "vue";
2
+ import { DropdownMenuContent as w, DropdownMenuItem as T, DropdownMenuPortal as E, DropdownMenuRoot as D, DropdownMenuTrigger as O, PopoverAnchor as k, PopoverContent as A, PopoverPortal as j, PopoverRoot as M } from "reka-ui";
3
+ import { geoAlbersUsa as ne, geoPath as N } from "d3-geo";
4
+ import { zoom as P } from "d3-zoom";
5
+ import { select as re } from "d3-selection";
6
+ import { feature as ie, merge as ae, mesh as oe } from "topojson-client";
7
7
  //#region src/ChartMenu/ChartMenu.vue?vue&type=script&setup=true&lang.ts
8
- var I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__PURE__ */ c({
8
+ var F = { class: "chart-menu-trigger-area" }, se = ["aria-label"], ce = /* @__PURE__ */ c({
9
9
  __name: "ChartMenu",
10
10
  props: { items: {} },
11
11
  setup(t) {
12
- return (r, c) => (m(), i("div", I, [t.items.length === 1 ? (m(), i("button", {
12
+ return (r, c) => (m(), i("div", F, [t.items.length === 1 ? (m(), i("button", {
13
13
  key: 0,
14
14
  class: "chart-menu-button chart-menu-single",
15
15
  "aria-label": t.items[0].label,
@@ -24,15 +24,15 @@ var I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__PUR
24
24
  "stroke-linecap": "round",
25
25
  "stroke-linejoin": "round",
26
26
  "aria-hidden": "true"
27
- }, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8, oe)) : (m(), n(b(O), {
27
+ }, [a("path", { d: "M7 1v8M3 6l4 4 4-4M2 13h10" })], -1)]], 8, se)) : (m(), n(b(D), {
28
28
  key: 1,
29
29
  modal: !1
30
30
  }, {
31
- default: C(() => [s(b(k), {
31
+ default: S(() => [s(b(O), {
32
32
  class: "chart-menu-button",
33
33
  "aria-label": "Chart options"
34
34
  }, {
35
- default: C(() => [...c[2] ||= [a("svg", {
35
+ default: S(() => [...c[2] ||= [a("svg", {
36
36
  width: "16",
37
37
  height: "16",
38
38
  viewBox: "0 0 16 16",
@@ -56,18 +56,18 @@ var I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__PUR
56
56
  })
57
57
  ], -1)]]),
58
58
  _: 1
59
- }), s(b(D), null, {
60
- default: C(() => [s(b(T), {
59
+ }), s(b(E), null, {
60
+ default: S(() => [s(b(w), {
61
61
  class: "chart-menu-content",
62
62
  "side-offset": 4,
63
63
  align: "end"
64
64
  }, {
65
- default: C(() => [(m(!0), i(e, null, g(t.items, (e) => (m(), n(b(E), {
65
+ default: S(() => [(m(!0), i(e, null, g(t.items, (e) => (m(), n(b(T), {
66
66
  key: e.label,
67
67
  class: "chart-menu-item",
68
68
  onSelect: e.action
69
69
  }, {
70
- default: C(() => [o(v(e.label), 1)]),
70
+ default: S(() => [o(v(e.label), 1)]),
71
71
  _: 2
72
72
  }, 1032, ["onSelect"]))), 128))]),
73
73
  _: 1
@@ -77,24 +77,24 @@ var I = { class: "chart-menu-trigger-area" }, oe = ["aria-label"], L = /* @__PUR
77
77
  _: 1
78
78
  }))]));
79
79
  }
80
- }), R = (e, t) => {
80
+ }), I = (e, t) => {
81
81
  let n = e.__vccOpts || e;
82
82
  for (let [e, r] of t) n[e] = r;
83
83
  return n;
84
- }, se = /* @__PURE__ */ R(L, [["__scopeId", "data-v-fe2f6904"]]);
84
+ }, le = /* @__PURE__ */ I(ce, [["__scopeId", "data-v-fe2f6904"]]);
85
85
  //#endregion
86
86
  //#region src/ChartMenu/download.ts
87
- function z(e, t) {
87
+ function L(e, t) {
88
88
  let n = URL.createObjectURL(e), r = document.createElement("a");
89
89
  r.href = n, r.download = t, r.click(), URL.revokeObjectURL(n);
90
90
  }
91
- function ce(e, t) {
91
+ function ue(e, t) {
92
92
  let n = e.cloneNode(!0);
93
93
  n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
94
94
  let r = new XMLSerializer().serializeToString(n);
95
- z(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
95
+ L(new Blob([r], { type: "image/svg+xml" }), `${t}.svg`);
96
96
  }
97
- function le(e, t) {
97
+ function de(e, t) {
98
98
  let n = e.cloneNode(!0);
99
99
  n.setAttribute("xmlns", "http://www.w3.org/2000/svg");
100
100
  let r = new XMLSerializer().serializeToString(n), i = new Blob([r], { type: "image/svg+xml;charset=utf-8" }), a = URL.createObjectURL(i), o = new Image(), s = e.width.baseVal.value || e.clientWidth, c = e.height.baseVal.value || e.clientHeight;
@@ -103,19 +103,19 @@ function le(e, t) {
103
103
  e.width = s * 2, e.height = c * 2;
104
104
  let n = e.getContext("2d");
105
105
  n.scale(2, 2), n.drawImage(o, 0, 0, s, c), e.toBlob((e) => {
106
- e && z(e, `${t}.png`);
106
+ e && L(e, `${t}.png`);
107
107
  }), URL.revokeObjectURL(a);
108
108
  }, o.src = a;
109
109
  }
110
- function B(e, t) {
111
- z(new Blob([e], { type: "text/csv" }), `${t}.csv`);
110
+ function fe(e, t) {
111
+ L(new Blob([e], { type: "text/csv" }), `${t}.csv`);
112
112
  }
113
113
  //#endregion
114
114
  //#region src/tooltip-position.ts
115
- var V = 16, H = 8;
116
- function ue(e, t, n, r, i, a) {
115
+ var R = 16, z = 8;
116
+ function pe(e, t, n, r, i, a) {
117
117
  if (i === "none") return {
118
- left: e + V,
118
+ left: e + R,
119
119
  top: t
120
120
  };
121
121
  let o = i === "chart" && a ? {
@@ -128,74 +128,74 @@ function ue(e, t, n, r, i, a) {
128
128
  right: window.innerWidth,
129
129
  top: 0,
130
130
  bottom: window.innerHeight
131
- }, s = e + V + n > o.right - H ? e - V - n : e + V, c = r / 2;
131
+ }, s = e + R + n > o.right - z ? e - R - n : e + R, c = r / 2;
132
132
  return {
133
133
  left: s,
134
- top: Math.min(Math.max(t, o.top + H + c), o.bottom - H - c)
134
+ top: Math.min(Math.max(t, o.top + z + c), o.bottom - z - c)
135
135
  };
136
136
  }
137
137
  //#endregion
138
138
  //#region src/LineChart/LineChart.vue?vue&type=script&setup=true&lang.ts
139
- var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
139
+ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
140
140
  "x1",
141
141
  "y1",
142
142
  "x2",
143
143
  "y2",
144
144
  "stroke",
145
145
  "stroke-dasharray"
146
- ], G = [
146
+ ], H = [
147
147
  "cx",
148
148
  "cy",
149
149
  "fill",
150
150
  "fill-opacity",
151
151
  "stroke"
152
- ], pe = ["x", "y"], me = [
152
+ ], ge = ["x", "y"], _e = [
153
153
  "x1",
154
154
  "y1",
155
155
  "x2",
156
156
  "y2"
157
- ], he = [
157
+ ], ve = [
158
158
  "x1",
159
159
  "y1",
160
160
  "x2",
161
161
  "y2"
162
- ], ge = [
162
+ ], ye = [
163
163
  "x1",
164
164
  "y1",
165
165
  "x2",
166
166
  "y2"
167
- ], _e = [
167
+ ], be = [
168
168
  "x1",
169
169
  "y1",
170
170
  "x2",
171
171
  "y2"
172
- ], ve = ["x", "y"], ye = ["transform"], K = ["x", "y"], q = ["x", "y"], be = [
172
+ ], xe = ["x", "y"], Se = ["transform"], U = ["x", "y"], W = ["x", "y"], Ce = [
173
173
  "d",
174
174
  "fill",
175
175
  "fill-opacity"
176
- ], xe = [
176
+ ], we = [
177
177
  "d",
178
178
  "stroke",
179
179
  "stroke-width",
180
180
  "stroke-opacity",
181
181
  "stroke-dasharray"
182
- ], Se = [
182
+ ], Te = [
183
183
  "cx",
184
184
  "cy",
185
185
  "r",
186
186
  "fill",
187
187
  "fill-opacity",
188
188
  "stroke"
189
- ], Ce = [
189
+ ], Ee = [
190
190
  "d",
191
191
  "fill",
192
192
  "fill-opacity"
193
- ], we = [
193
+ ], De = [
194
194
  "d",
195
195
  "stroke",
196
196
  "stroke-width",
197
197
  "stroke-dasharray"
198
- ], Te = [
198
+ ], Oe = [
199
199
  "x1",
200
200
  "y1",
201
201
  "x2",
@@ -203,7 +203,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
203
203
  "stroke",
204
204
  "stroke-width",
205
205
  "stroke-dasharray"
206
- ], J = [
206
+ ], G = [
207
207
  "x1",
208
208
  "y1",
209
209
  "x2",
@@ -211,44 +211,44 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
211
211
  "stroke",
212
212
  "stroke-width",
213
213
  "stroke-dasharray"
214
- ], Ee = [
214
+ ], ke = [
215
215
  "x1",
216
216
  "y1",
217
217
  "x2",
218
218
  "y2"
219
- ], De = [
219
+ ], Ae = [
220
220
  "x1",
221
221
  "y1",
222
222
  "x2",
223
223
  "y2"
224
- ], Oe = [
224
+ ], je = [
225
225
  "x1",
226
226
  "y1",
227
227
  "x2",
228
228
  "y2"
229
- ], ke = [
229
+ ], Me = [
230
230
  "cx",
231
231
  "cy",
232
232
  "fill"
233
- ], Ae = [
233
+ ], Ne = [
234
234
  "x",
235
235
  "y",
236
236
  "width",
237
237
  "height"
238
- ], je = [
238
+ ], Pe = [
239
239
  "cx",
240
240
  "cy",
241
241
  "fill",
242
242
  "fill-opacity",
243
243
  "stroke"
244
- ], Me = [
244
+ ], Fe = [
245
245
  "x",
246
246
  "y",
247
247
  "fill"
248
- ], Y = ["x", "y"], Ne = { class: "line-chart-tooltip" }, Pe = {
248
+ ], Ie = ["x", "y"], Le = { class: "line-chart-tooltip" }, Re = {
249
249
  key: 0,
250
250
  class: "line-chart-tooltip-label"
251
- }, Fe = ["href", "download"], X = 20, Z = 36, Ie = 12, Le = 7, Re = 16, ze = 50, Be = /* @__PURE__ */ R(/* @__PURE__ */ c({
251
+ }, ze = ["href", "download"], K = 20, q = 36, Be = 12, Ve = 7, He = 16, Ue = 50, J = /* @__PURE__ */ I(/* @__PURE__ */ c({
252
252
  __name: "LineChart",
253
253
  props: {
254
254
  data: {},
@@ -280,31 +280,31 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
280
280
  },
281
281
  emits: ["hover"],
282
282
  setup(s, { emit: c }) {
283
- let u = s, y = c, b = h(null), x = h(null), S = h(0), C = null, T = null;
283
+ let u = s, y = c, b = h(null), x = h(null), S = h(0), w = null, T = null;
284
284
  p(() => {
285
- b.value && (S.value = b.value.clientWidth, C = new ResizeObserver((e) => {
285
+ b.value && (S.value = b.value.clientWidth, w = new ResizeObserver((e) => {
286
286
  let t = e[0];
287
287
  t && (u.debounce ? (T && clearTimeout(T), T = setTimeout(() => {
288
288
  S.value = t.contentRect.width;
289
289
  }, u.debounce)) : S.value = t.contentRect.width);
290
- }), C.observe(b.value));
290
+ }), w.observe(b.value));
291
291
  }), ee(() => {
292
- C?.disconnect(), T && clearTimeout(T);
292
+ w?.disconnect(), T && clearTimeout(T);
293
293
  });
294
294
  let E = t(() => u.width ?? (S.value || 400)), D = t(() => u.height ?? 200), O = t(() => M.value.some((e) => e.legend) || u.areaSections?.some((e) => e.legend === "inline" && (e.label || e.description))), k = t(() => ({
295
- top: (u.title ? 30 : 10) + (O.value ? X : 0),
295
+ top: (u.title ? 30 : 10) + (O.value ? K : 0),
296
296
  right: 10,
297
297
  bottom: u.xLabel ? 46 : 30,
298
298
  left: u.yLabel ? 66 : 50
299
- })), A = t(() => E.value - k.value.left - k.value.right), j = t(() => D.value - k.value.top - k.value.bottom), M = t(() => u.series && u.series.length > 0 ? u.series : u.data ? [{ data: u.data }] : []), N = t(() => u.areas ?? []), P = t(() => {
299
+ })), A = t(() => E.value - k.value.left - k.value.right), j = t(() => D.value - k.value.top - k.value.bottom), M = t(() => u.series && u.series.length > 0 ? u.series : u.data ? [{ data: u.data }] : []), ne = t(() => u.areas ?? []), N = t(() => {
300
300
  let e = 0;
301
301
  for (let t of M.value) t.data.length > e && (e = t.data.length);
302
- for (let t of N.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
302
+ for (let t of ne.value) t.upper.length > e && (e = t.upper.length), t.lower.length > e && (e = t.lower.length);
303
303
  return e;
304
- }), F = t(() => {
304
+ }), P = t(() => {
305
305
  let e = Infinity, t = -Infinity;
306
306
  for (let n of M.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
307
- for (let n of N.value) {
307
+ for (let n of ne.value) {
308
308
  for (let r of n.upper) isFinite(r) && (r < e && (e = r), r > t && (t = r));
309
309
  for (let r of n.lower) isFinite(r) && (r < e && (e = r), r > t && (t = r));
310
310
  }
@@ -318,9 +318,9 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
318
318
  range: 1
319
319
  };
320
320
  });
321
- function te(e) {
321
+ function re(e) {
322
322
  if (e.length === 0) return "";
323
- let { min: t, range: n } = F.value, r = P.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = "", c = !1;
323
+ let { min: t, range: n } = P.value, r = N.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = "", c = !1;
324
324
  for (let n = 0; n < e.length; n++) {
325
325
  if (!isFinite(e[n])) {
326
326
  c = !1;
@@ -331,18 +331,18 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
331
331
  }
332
332
  return s;
333
333
  }
334
- function ne(e) {
335
- let { min: t, range: n } = F.value, r = P.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = [];
334
+ function ie(e) {
335
+ let { min: t, range: n } = P.value, r = N.value, i = A.value / (r - 1 || 1), a = j.value / n, o = k.value.top + j.value, s = [];
336
336
  for (let n = 0; n < e.length; n++) isFinite(e[n]) && s.push({
337
337
  x: k.value.left + n * i,
338
338
  y: o - (e[n] - t) * a
339
339
  });
340
340
  return s;
341
341
  }
342
- function re(e, t) {
342
+ function ae(e, t) {
343
343
  let n = Math.min(e.length, t.length);
344
344
  if (n === 0) return "";
345
- let { min: r, range: i } = F.value, a = P.value, o = A.value / (a - 1 || 1), s = j.value / i, c = k.value.top + j.value, l = (e) => k.value.left + e * o, u = (e) => c - (e - r) * s, d = [], f = [];
345
+ let { min: r, range: i } = P.value, a = N.value, o = A.value / (a - 1 || 1), s = j.value / i, c = k.value.top + j.value, l = (e) => k.value.left + e * o, u = (e) => c - (e - r) * s, d = [], f = [];
346
346
  for (let r = 0; r < n; r++) isFinite(e[r]) && isFinite(t[r]) ? f.push(r) : f.length && (d.push(f), f = []);
347
347
  f.length && d.push(f);
348
348
  let p = "";
@@ -354,30 +354,30 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
354
354
  }
355
355
  return p;
356
356
  }
357
- function ie(e, t = !0) {
358
- let n = P.value, r = A.value / (n - 1 || 1), i = k.value.top + j.value, a = (e) => k.value.left + e * r;
357
+ function oe(e, t = !0) {
358
+ let n = N.value, r = A.value / (n - 1 || 1), i = k.value.top + j.value, a = (e) => k.value.left + e * r;
359
359
  if (e.seriesIndex == null) {
360
360
  let t = Math.max(0, e.startIndex), r = Math.min(n - 1, e.endIndex);
361
361
  return t > r ? "" : `M${a(t)},${k.value.top}L${a(r)},${k.value.top}L${a(r)},${i}L${a(t)},${i}Z`;
362
362
  }
363
363
  let o = M.value[e.seriesIndex];
364
364
  if (!o) return "";
365
- let { min: s, range: c } = F.value, l = j.value / c, u = (e) => i - (e - s) * l, d = Math.max(0, e.startIndex), f = Math.min(o.data.length - 1, e.endIndex);
365
+ let { min: s, range: c } = P.value, l = j.value / c, u = (e) => i - (e - s) * l, d = Math.max(0, e.startIndex), f = Math.min(o.data.length - 1, e.endIndex);
366
366
  if (d > f) return "";
367
367
  let p = `M${a(d)},${u(o.data[d])}`;
368
368
  for (let e = d + 1; e <= f; e++) isFinite(o.data[e]) && (p += `L${a(e)},${u(o.data[e])}`);
369
369
  return t && (p += `L${a(f)},${i}`, p += `L${a(d)},${i}`, p += "Z"), p;
370
370
  }
371
- let ae = t(() => {
371
+ let F = t(() => {
372
372
  let e = u.areaSections;
373
373
  if (!e?.length) return {
374
374
  labels: [],
375
375
  extraHeight: 0
376
376
  };
377
- let t = P.value, n = A.value / (t - 1 || 1), r = [];
377
+ let t = N.value, n = A.value / (t - 1 || 1), r = [];
378
378
  for (let t of e) {
379
379
  if (!t.label && !t.description || t.legend === "inline" || t.legend === !1) continue;
380
- let e = k.value.left + (t.startIndex + t.endIndex) / 2 * n, i = t.label ?? "", a = t.description ?? "", o = Math.max(i.length, a.length) * Le, s = t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor");
380
+ let e = k.value.left + (t.startIndex + t.endIndex) / 2 * n, i = t.label ?? "", a = t.description ?? "", o = Math.max(i.length, a.length) * Ve, s = t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor");
381
381
  r.push({
382
382
  cx: e,
383
383
  labelText: i,
@@ -392,7 +392,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
392
392
  let i = [];
393
393
  for (let e of r) {
394
394
  let t = e.cx - e.textWidth / 2, n = 0;
395
- for (; n < i.length && !(t >= i[n] + Re);) n++;
395
+ for (; n < i.length && !(t >= i[n] + He);) n++;
396
396
  e.row = n;
397
397
  let r = e.cx + e.textWidth / 2;
398
398
  i[n] = Math.max(i[n] ?? -Infinity, r);
@@ -402,9 +402,9 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
402
402
  extraHeight: 0
403
403
  } : {
404
404
  labels: r,
405
- extraHeight: (Math.max(...r.map((e) => e.row)) + 1) * Z + Ie
405
+ extraHeight: (Math.max(...r.map((e) => e.row)) + 1) * q + Be
406
406
  };
407
- }), I = t(() => {
407
+ }), se = t(() => {
408
408
  let e = [];
409
409
  for (let t of M.value) t.legend && e.push({
410
410
  label: t.legend,
@@ -424,64 +424,64 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
424
424
  });
425
425
  }
426
426
  return e;
427
- }), oe = t(() => D.value + ae.value.extraHeight), L = t(() => k.value.top + j.value + k.value.bottom + Ie);
428
- function R(e, t) {
427
+ }), ce = t(() => D.value + F.value.extraHeight), I = t(() => k.value.top + j.value + k.value.bottom + Be);
428
+ function L(e, t) {
429
429
  let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r, a;
430
430
  return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
431
431
  }
432
- function z(e) {
432
+ function R(e) {
433
433
  return Math.round(e) + .5;
434
434
  }
435
- let V = new Intl.NumberFormat();
436
- function H(e) {
437
- return Math.abs(e) >= 1e3 ? V.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
435
+ let z = new Intl.NumberFormat();
436
+ function J(e) {
437
+ return Math.abs(e) >= 1e3 ? z.format(e) : Number.isInteger(e) ? e.toString() : e.toFixed(1);
438
438
  }
439
- let Be = t(() => {
440
- let { min: e, max: t } = F.value;
439
+ let We = t(() => {
440
+ let { min: e, max: t } = P.value;
441
441
  if (e === t) return [{
442
- value: H(e),
443
- y: z(k.value.top + j.value / 2)
442
+ value: J(e),
443
+ y: R(k.value.top + j.value / 2)
444
444
  }];
445
- let n = Math.max(3, Math.floor(j.value / 50)), r = R(t - e, n), i = Math.ceil(e / r) * r, a = [];
445
+ let n = Math.max(3, Math.floor(j.value / 50)), r = L(t - e, n), i = Math.ceil(e / r) * r, a = [];
446
446
  for (let n = i; n <= t; n += r) a.push({
447
- value: H(n),
448
- y: z(k.value.top + j.value - (n - e) / F.value.range * j.value)
447
+ value: J(n),
448
+ y: R(k.value.top + j.value - (n - e) / P.value.range * j.value)
449
449
  });
450
450
  return a;
451
- }), Ve = t(() => {
452
- let e = P.value;
451
+ }), Ge = t(() => {
452
+ let e = N.value;
453
453
  if (e <= 1) return [];
454
454
  let t = u.xLabels;
455
455
  if (t && t.length === e) {
456
456
  let n = Math.max(3, Math.floor(A.value / 80)), r = Math.max(1, Math.round((e - 1) / n)), i = [];
457
457
  for (let n = 0; n < e; n += r) i.push({
458
458
  value: t[n],
459
- x: z(k.value.left + n / (e - 1) * A.value)
459
+ x: R(k.value.left + n / (e - 1) * A.value)
460
460
  });
461
461
  return i;
462
462
  }
463
- let n = u.xMin ?? 0, r = Math.max(3, Math.floor(A.value / 80)), i = R(e - 1, r), a = [];
463
+ let n = u.xMin ?? 0, r = Math.max(3, Math.floor(A.value / 80)), i = L(e - 1, r), a = [];
464
464
  for (let t = 0; t <= e - 1; t += i) {
465
465
  let r = Math.round(t);
466
466
  a.push({
467
- value: H(r + n),
468
- x: z(k.value.left + r / (e - 1) * A.value)
467
+ value: J(r + n),
468
+ x: R(k.value.left + r / (e - 1) * A.value)
469
469
  });
470
470
  }
471
471
  return a;
472
472
  });
473
- function He() {
473
+ function Ke() {
474
474
  return u.filename ? u.filename : typeof u.menu == "string" ? u.menu : "chart";
475
475
  }
476
- function Ue() {
476
+ function qe() {
477
477
  return x.value;
478
478
  }
479
- function We() {
479
+ function Je() {
480
480
  if (typeof u.csv == "function") return u.csv();
481
481
  if (typeof u.csv == "string") return u.csv;
482
482
  let e = M.value;
483
483
  if (e.length === 0) return "";
484
- let t = P.value, n = [(e.length === 1 ? ["index", "value"] : ["index", ...e.map((e, t) => `series_${t}`)]).join(",")];
484
+ let t = N.value, n = [(e.length === 1 ? ["index", "value"] : ["index", ...e.map((e, t) => `series_${t}`)]).join(",")];
485
485
  for (let r = 0; r < t; r++) {
486
486
  let t = [r.toString()];
487
487
  for (let n of e) t.push(r < n.data.length ? String(n.data[r]) : "");
@@ -489,21 +489,21 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
489
489
  }
490
490
  return n.join("\n");
491
491
  }
492
- let Q = h(null), Ge = h(!1), Ke = h(null), qe = t(() => !!u.tooltipData || !!u.tooltipTrigger), Je = t(() => {
493
- if (Q.value === null) return 0;
494
- let e = P.value, t = A.value / (e - 1 || 1);
495
- return k.value.left + Q.value * t;
496
- }), Ye = t(() => {
497
- let e = Q.value;
492
+ let Y = h(null), Ye = h(!1), Xe = h(null), X = h(null), Z = h(null), Ze = t(() => !!u.tooltipData || !!u.tooltipTrigger), Qe = t(() => {
493
+ if (Y.value === null) return 0;
494
+ let e = N.value, t = A.value / (e - 1 || 1);
495
+ return k.value.left + Y.value * t;
496
+ }), $e = t(() => {
497
+ let e = Y.value;
498
498
  if (e === null) return [];
499
- let { min: t, range: n } = F.value, r = j.value / n, i = k.value.top + j.value;
499
+ let { min: t, range: n } = P.value, r = j.value / n, i = k.value.top + j.value;
500
500
  return M.value.filter((t) => e < t.data.length && isFinite(t.data[e])).map((n) => ({
501
- x: Je.value,
501
+ x: Qe.value,
502
502
  y: i - (n.data[e] - t) * r,
503
503
  color: n.color ?? "currentColor"
504
504
  }));
505
- }), $ = t(() => {
506
- let e = Q.value;
505
+ }), Q = t(() => {
506
+ let e = Y.value;
507
507
  return e === null ? null : {
508
508
  index: e,
509
509
  xLabel: u.xLabels?.[e],
@@ -515,68 +515,78 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
515
515
  data: u.tooltipData?.[e] ?? null
516
516
  };
517
517
  });
518
- function Xe(e) {
518
+ function et(e) {
519
519
  return "touches" in e ? e.touches[0] ?? null : e;
520
520
  }
521
- function Ze(e) {
521
+ function tt(e) {
522
522
  let t = b.value?.getBoundingClientRect();
523
523
  if (!t) return null;
524
- let n = P.value;
524
+ let n = N.value;
525
525
  if (n <= 1) return null;
526
526
  let r = e - t.left, i = A.value / (n - 1 || 1), a = (r - k.value.left) / i;
527
527
  return Math.round(Math.max(0, Math.min(n - 1, a)));
528
528
  }
529
- function Qe(e, t) {
530
- let n = Ke.value;
531
- if (!n) return;
532
- let r = b.value.getBoundingClientRect(), { left: i, top: a } = ue(e, t - (Ge.value ? ze : 0), n.offsetWidth, n.offsetHeight, u.tooltipClamp, r);
533
- n.style.left = `${i - r.left}px`, n.style.top = `${a - r.top}px`;
534
- }
535
- function $e(e) {
536
- let t = Xe(e);
529
+ function $(e) {
530
+ let t = et(e);
537
531
  if (!t) return;
538
- let n = Ze(t.clientX);
539
- n !== null && (Q.value = n, Qe(t.clientX, t.clientY), y("hover", { index: n }));
532
+ let n = tt(t.clientX);
533
+ n !== null && (Y.value = n, X.value = {
534
+ clientX: t.clientX,
535
+ clientY: t.clientY
536
+ }, y("hover", { index: n }));
540
537
  }
541
- function et(e) {
542
- $e(e);
538
+ te([X, Y], () => {
539
+ if (Y.value === null || !X.value) {
540
+ Z.value = null;
541
+ return;
542
+ }
543
+ let e = Xe.value, t = b.value;
544
+ if (!e || !t) return;
545
+ let n = t.getBoundingClientRect(), r = Ye.value ? Ue : 0, { left: i, top: a } = pe(X.value.clientX, X.value.clientY - r, e.offsetWidth, e.offsetHeight, u.tooltipClamp, n);
546
+ Z.value = {
547
+ left: i - n.left,
548
+ top: a - n.top
549
+ };
550
+ }, { flush: "post" });
551
+ function nt(e) {
552
+ $(e);
543
553
  }
544
- function tt() {
545
- u.tooltipTrigger !== "click" && (Q.value = null, y("hover", null));
554
+ function rt() {
555
+ u.tooltipTrigger !== "click" && (Y.value = null, y("hover", null));
546
556
  }
547
- function nt(e) {
557
+ function it(e) {
548
558
  if (u.tooltipTrigger !== "click") return;
549
- let t = Xe(e);
559
+ let t = et(e);
550
560
  if (!t) return;
551
- let n = Ze(t.clientX);
552
- n !== null && (Q.value = Q.value === n ? null : n, y("hover", Q.value === null ? null : { index: n }));
561
+ let n = tt(t.clientX);
562
+ n !== null && (Y.value = Y.value === n ? null : n, y("hover", Y.value === null ? null : { index: n }));
553
563
  }
554
- function rt(e) {
555
- Ge.value = !0, $e(e);
564
+ function at(e) {
565
+ Ye.value = !0, $(e);
556
566
  }
557
- function it(e) {
558
- $e(e);
567
+ function ot(e) {
568
+ $(e);
559
569
  }
560
- function at() {
561
- Ge.value = !1, Q.value = null, y("hover", null);
570
+ function st() {
571
+ Ye.value = !1, Y.value = null, y("hover", null);
562
572
  }
563
- let ot = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), st = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(We())}` : null), ct = t(() => {
564
- let e = He(), t = [{
573
+ let ct = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), lt = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(Je())}` : null), ut = t(() => {
574
+ let e = Ke(), t = [{
565
575
  label: "Save as SVG",
566
576
  action: () => {
567
- let t = Ue();
568
- t && ce(t, e);
577
+ let t = qe();
578
+ t && ue(t, e);
569
579
  }
570
580
  }, {
571
581
  label: "Save as PNG",
572
582
  action: () => {
573
- let t = Ue();
574
- t && le(t, e);
583
+ let t = qe();
584
+ t && de(t, e);
575
585
  }
576
586
  }];
577
587
  return u.downloadLink || t.push({
578
588
  label: "Download CSV",
579
- action: () => B(We(), e)
589
+ action: () => fe(Je(), e)
580
590
  }), t;
581
591
  });
582
592
  return (t, c) => (m(), i("div", {
@@ -584,15 +594,15 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
584
594
  ref: b,
585
595
  class: "line-chart-wrapper"
586
596
  }, [
587
- s.menu ? (m(), n(se, {
597
+ s.menu ? (m(), n(le, {
588
598
  key: 0,
589
- items: ct.value
599
+ items: ut.value
590
600
  }, null, 8, ["items"])) : r("", !0),
591
601
  (m(), i("svg", {
592
602
  ref_key: "svgRef",
593
603
  ref: x,
594
604
  width: E.value,
595
- height: oe.value
605
+ height: ce.value
596
606
  }, [
597
607
  s.title ? (m(), i("text", {
598
608
  key: 0,
@@ -602,48 +612,48 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
602
612
  "font-size": "14",
603
613
  "font-weight": "600",
604
614
  fill: "currentColor"
605
- }, v(s.title), 9, de)) : r("", !0),
606
- I.value.length > 0 ? (m(), i("g", fe, [(m(!0), i(e, null, g(I.value, (t, n) => (m(), i(e, { key: "ileg" + n }, [t.type === "series" ? (m(), i("line", {
615
+ }, v(s.title), 9, me)) : r("", !0),
616
+ se.value.length > 0 ? (m(), i("g", he, [(m(!0), i(e, null, g(se.value, (t, n) => (m(), i(e, { key: "ileg" + n }, [t.type === "series" ? (m(), i("line", {
607
617
  key: 0,
608
618
  x1: k.value.left + n * 120,
609
- y1: k.value.top - X / 2,
619
+ y1: k.value.top - K / 2,
610
620
  x2: k.value.left + n * 120 + 12,
611
- y2: k.value.top - X / 2,
621
+ y2: k.value.top - K / 2,
612
622
  stroke: t.color,
613
623
  "stroke-width": "2",
614
624
  "stroke-dasharray": t.dashed ? "4 2" : void 0
615
- }, null, 8, W)) : (m(), i("circle", {
625
+ }, null, 8, V)) : (m(), i("circle", {
616
626
  key: 1,
617
627
  cx: k.value.left + n * 120 + 4,
618
- cy: k.value.top - X / 2,
628
+ cy: k.value.top - K / 2,
619
629
  r: "4",
620
630
  fill: t.color,
621
631
  "fill-opacity": t.fillOpacity,
622
632
  stroke: t.color,
623
633
  "stroke-width": "1.5"
624
- }, null, 8, G)), a("text", {
634
+ }, null, 8, H)), a("text", {
625
635
  x: k.value.left + n * 120 + 18,
626
- y: k.value.top - X / 2 + 4,
636
+ y: k.value.top - K / 2 + 4,
627
637
  "font-size": "11",
628
638
  fill: "currentColor"
629
- }, v(t.label), 9, pe)], 64))), 128))])) : r("", !0),
639
+ }, v(t.label), 9, ge)], 64))), 128))])) : r("", !0),
630
640
  a("line", {
631
- x1: z(k.value.left),
632
- y1: z(k.value.top),
633
- x2: z(k.value.left),
634
- y2: z(k.value.top + j.value),
641
+ x1: R(k.value.left),
642
+ y1: R(k.value.top),
643
+ x2: R(k.value.left),
644
+ y2: R(k.value.top + j.value),
635
645
  stroke: "currentColor",
636
646
  "stroke-opacity": "0.3"
637
- }, null, 8, me),
647
+ }, null, 8, _e),
638
648
  a("line", {
639
- x1: z(k.value.left),
640
- y1: z(k.value.top + j.value),
641
- x2: z(k.value.left + A.value),
642
- y2: z(k.value.top + j.value),
649
+ x1: R(k.value.left),
650
+ y1: R(k.value.top + j.value),
651
+ x2: R(k.value.left + A.value),
652
+ y2: R(k.value.top + j.value),
643
653
  stroke: "currentColor",
644
654
  "stroke-opacity": "0.3"
645
- }, null, 8, he),
646
- s.yGrid ? (m(!0), i(e, { key: 2 }, g(Be.value, (e, t) => (m(), i("line", {
655
+ }, null, 8, ve),
656
+ s.yGrid ? (m(!0), i(e, { key: 2 }, g(We.value, (e, t) => (m(), i("line", {
647
657
  key: "yg" + t,
648
658
  x1: k.value.left,
649
659
  y1: e.y,
@@ -651,8 +661,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
651
661
  y2: e.y,
652
662
  stroke: "currentColor",
653
663
  "stroke-opacity": "0.1"
654
- }, null, 8, ge))), 128)) : r("", !0),
655
- s.xGrid ? (m(!0), i(e, { key: 3 }, g(Ve.value, (e, t) => (m(), i("line", {
664
+ }, null, 8, ye))), 128)) : r("", !0),
665
+ s.xGrid ? (m(!0), i(e, { key: 3 }, g(Ge.value, (e, t) => (m(), i("line", {
656
666
  key: "xg" + t,
657
667
  x1: e.x,
658
668
  y1: k.value.top,
@@ -660,8 +670,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
660
670
  y2: k.value.top + j.value,
661
671
  stroke: "currentColor",
662
672
  "stroke-opacity": "0.1"
663
- }, null, 8, _e))), 128)) : r("", !0),
664
- (m(!0), i(e, null, g(Be.value, (e, t) => (m(), i("text", {
673
+ }, null, 8, be))), 128)) : r("", !0),
674
+ (m(!0), i(e, null, g(We.value, (e, t) => (m(), i("text", {
665
675
  key: "y" + t,
666
676
  x: k.value.left - 6,
667
677
  y: e.y,
@@ -670,7 +680,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
670
680
  "font-size": "10",
671
681
  fill: "currentColor",
672
682
  "fill-opacity": "0.6"
673
- }, v(e.value), 9, ve))), 128)),
683
+ }, v(e.value), 9, xe))), 128)),
674
684
  s.yLabel ? (m(), i("text", {
675
685
  key: 4,
676
686
  x: 0,
@@ -679,8 +689,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
679
689
  "text-anchor": "middle",
680
690
  "font-size": "13",
681
691
  fill: "currentColor"
682
- }, v(s.yLabel), 9, ye)) : r("", !0),
683
- (m(!0), i(e, null, g(Ve.value, (e, t) => (m(), i("text", {
692
+ }, v(s.yLabel), 9, Se)) : r("", !0),
693
+ (m(!0), i(e, null, g(Ge.value, (e, t) => (m(), i("text", {
684
694
  key: "x" + t,
685
695
  x: e.x,
686
696
  y: k.value.top + j.value + 16,
@@ -688,7 +698,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
688
698
  "font-size": "10",
689
699
  fill: "currentColor",
690
700
  "fill-opacity": "0.6"
691
- }, v(e.value), 9, K))), 128)),
701
+ }, v(e.value), 9, U))), 128)),
692
702
  s.xLabel ? (m(), i("text", {
693
703
  key: 5,
694
704
  x: k.value.left + A.value / 2,
@@ -696,23 +706,23 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
696
706
  "text-anchor": "middle",
697
707
  "font-size": "13",
698
708
  fill: "currentColor"
699
- }, v(s.xLabel), 9, q)) : r("", !0),
700
- (m(!0), i(e, null, g(N.value, (e, t) => (m(), i("path", {
709
+ }, v(s.xLabel), 9, W)) : r("", !0),
710
+ (m(!0), i(e, null, g(ne.value, (e, t) => (m(), i("path", {
701
711
  key: "area" + t,
702
- d: re(e.upper, e.lower),
712
+ d: ae(e.upper, e.lower),
703
713
  fill: e.color ?? "currentColor",
704
714
  "fill-opacity": e.opacity ?? .2,
705
715
  stroke: "none"
706
- }, null, 8, be))), 128)),
716
+ }, null, 8, Ce))), 128)),
707
717
  (m(!0), i(e, null, g(M.value, (t, n) => (m(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (m(), i("path", {
708
718
  key: 0,
709
- d: te(t.data),
719
+ d: re(t.data),
710
720
  fill: "none",
711
721
  stroke: t.color ?? "currentColor",
712
722
  "stroke-width": t.strokeWidth ?? 1.5,
713
723
  "stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
714
724
  "stroke-dasharray": t.dashed ? "6 3" : void 0
715
- }, null, 8, xe)), t.dots ? (m(!0), i(e, { key: 1 }, g(ne(t.data), (e, n) => (m(), i("circle", {
725
+ }, null, 8, we)), t.dots ? (m(!0), i(e, { key: 1 }, g(ie(t.data), (e, n) => (m(), i("circle", {
716
726
  key: n,
717
727
  cx: e.x,
718
728
  cy: e.y,
@@ -720,68 +730,68 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
720
730
  fill: t.dotFill ?? t.color ?? "currentColor",
721
731
  "fill-opacity": t.dotOpacity ?? t.opacity ?? s.lineOpacity,
722
732
  stroke: t.dotStroke ?? "none"
723
- }, null, 8, Se))), 128)) : r("", !0)], 64))), 128)),
733
+ }, null, 8, Te))), 128)) : r("", !0)], 64))), 128)),
724
734
  (m(!0), i(e, null, g(s.areaSections ?? [], (t, n) => (m(), i(e, { key: "areasec" + n }, [
725
735
  a("path", {
726
- d: ie(t),
736
+ d: oe(t),
727
737
  fill: t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor"),
728
738
  "fill-opacity": t.opacity ?? .15,
729
739
  stroke: "none"
730
- }, null, 8, Ce),
740
+ }, null, 8, Ee),
731
741
  t.seriesIndex == null ? r("", !0) : (m(), i("path", {
732
742
  key: 0,
733
- d: ie(t, !1),
743
+ d: oe(t, !1),
734
744
  fill: "none",
735
745
  stroke: t.color ?? M.value[t.seriesIndex]?.color ?? "currentColor",
736
746
  "stroke-width": t.strokeWidth ?? 2,
737
747
  "stroke-dasharray": t.dashed ? "6 3" : void 0
738
- }, null, 8, we)),
748
+ }, null, 8, De)),
739
749
  t.seriesIndex == null ? (m(), i(e, { key: 1 }, [a("line", {
740
- x1: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
750
+ x1: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
741
751
  y1: k.value.top,
742
- x2: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
752
+ x2: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
743
753
  y2: k.value.top + j.value,
744
754
  stroke: t.color ?? "#999",
745
755
  "stroke-width": t.strokeWidth ?? 2,
746
756
  "stroke-dasharray": t.dashed ? "6 3" : void 0
747
- }, null, 8, Te), a("line", {
748
- x1: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
757
+ }, null, 8, Oe), a("line", {
758
+ x1: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
749
759
  y1: k.value.top,
750
- x2: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
760
+ x2: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
751
761
  y2: k.value.top + j.value,
752
762
  stroke: t.color ?? "#999",
753
763
  "stroke-width": t.strokeWidth ?? 2,
754
764
  "stroke-dasharray": t.dashed ? "6 3" : void 0
755
- }, null, 8, J)], 64)) : r("", !0),
765
+ }, null, 8, G)], 64)) : r("", !0),
756
766
  a("line", {
757
- x1: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
767
+ x1: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
758
768
  y1: k.value.top + j.value - 4,
759
- x2: z(k.value.left + t.startIndex * (A.value / (P.value - 1 || 1))),
769
+ x2: R(k.value.left + t.startIndex * (A.value / (N.value - 1 || 1))),
760
770
  y2: k.value.top + j.value + 4,
761
771
  stroke: "currentColor",
762
772
  "stroke-opacity": "0.4"
763
- }, null, 8, Ee),
773
+ }, null, 8, ke),
764
774
  a("line", {
765
- x1: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
775
+ x1: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
766
776
  y1: k.value.top + j.value - 4,
767
- x2: z(k.value.left + t.endIndex * (A.value / (P.value - 1 || 1))),
777
+ x2: R(k.value.left + t.endIndex * (A.value / (N.value - 1 || 1))),
768
778
  y2: k.value.top + j.value + 4,
769
779
  stroke: "currentColor",
770
780
  "stroke-opacity": "0.4"
771
- }, null, 8, De)
781
+ }, null, 8, Ae)
772
782
  ], 64))), 128)),
773
- qe.value && Q.value !== null ? (m(), i("line", {
783
+ Ze.value && Y.value !== null ? (m(), i("line", {
774
784
  key: 6,
775
- x1: z(Je.value),
785
+ x1: R(Qe.value),
776
786
  y1: k.value.top,
777
- x2: z(Je.value),
787
+ x2: R(Qe.value),
778
788
  y2: k.value.top + j.value,
779
789
  stroke: "currentColor",
780
790
  "stroke-opacity": "0.3",
781
791
  "stroke-dasharray": "4 2",
782
792
  "pointer-events": "none"
783
- }, null, 8, Oe)) : r("", !0),
784
- (m(!0), i(e, null, g(Ye.value, (e, t) => (m(), i("circle", {
793
+ }, null, 8, je)) : r("", !0),
794
+ (m(!0), i(e, null, g($e.value, (e, t) => (m(), i("circle", {
785
795
  key: "hd" + t,
786
796
  cx: e.x,
787
797
  cy: e.y,
@@ -790,8 +800,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
790
800
  stroke: "var(--color-bg-0, #fff)",
791
801
  "stroke-width": "2",
792
802
  "pointer-events": "none"
793
- }, null, 8, ke))), 128)),
794
- qe.value ? (m(), i("rect", {
803
+ }, null, 8, Me))), 128)),
804
+ Ze.value ? (m(), i("rect", {
795
805
  key: 7,
796
806
  x: k.value.left,
797
807
  y: k.value.top,
@@ -802,66 +812,70 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
802
812
  cursor: "crosshair",
803
813
  "touch-action": "none"
804
814
  },
805
- onMousemove: et,
806
- onMouseleave: tt,
807
- onClick: nt,
808
- onTouchstart: w(rt, ["prevent"]),
809
- onTouchmove: w(it, ["prevent"]),
810
- onTouchend: at
811
- }, null, 40, Ae)) : r("", !0),
812
- (m(!0), i(e, null, g(ae.value.labels, (e, t) => (m(), i("g", { key: "seclab" + t }, [
815
+ onMousemove: nt,
816
+ onMouseleave: rt,
817
+ onClick: it,
818
+ onTouchstart: C(at, ["prevent"]),
819
+ onTouchmove: C(ot, ["prevent"]),
820
+ onTouchend: st
821
+ }, null, 40, Ne)) : r("", !0),
822
+ (m(!0), i(e, null, g(F.value.labels, (e, t) => (m(), i("g", { key: "seclab" + t }, [
813
823
  a("circle", {
814
824
  cx: e.cx - e.textWidth / 2 - 2,
815
- cy: L.value + e.row * Z + 4,
825
+ cy: I.value + e.row * q + 4,
816
826
  r: "4",
817
827
  fill: e.color,
818
828
  "fill-opacity": e.fillOpacity,
819
829
  stroke: e.color,
820
830
  "stroke-width": "1.5"
821
- }, null, 8, je),
831
+ }, null, 8, Pe),
822
832
  e.labelText ? (m(), i("text", {
823
833
  key: 0,
824
834
  x: e.cx - e.textWidth / 2 + 8,
825
- y: L.value + e.row * Z + 8,
835
+ y: I.value + e.row * q + 8,
826
836
  "font-size": "11",
827
837
  "font-weight": "600",
828
838
  fill: e.color
829
- }, v(e.labelText), 9, Me)) : r("", !0),
839
+ }, v(e.labelText), 9, Fe)) : r("", !0),
830
840
  e.descText ? (m(), i("text", {
831
841
  key: 1,
832
842
  x: e.cx - e.textWidth / 2 + 8,
833
- y: L.value + e.row * Z + 22,
843
+ y: I.value + e.row * q + 22,
834
844
  "font-size": "11",
835
845
  fill: "currentColor",
836
846
  "fill-opacity": "0.6"
837
- }, v(e.descText), 9, Y)) : r("", !0)
847
+ }, v(e.descText), 9, Ie)) : r("", !0)
838
848
  ]))), 128))
839
- ], 8, U)),
840
- qe.value && Q.value !== null && $.value ? (m(), i("div", {
849
+ ], 8, B)),
850
+ Ze.value && Y.value !== null && Q.value ? (m(), i("div", {
841
851
  key: 1,
842
852
  ref_key: "tooltipRef",
843
- ref: Ke,
853
+ ref: Xe,
844
854
  class: "chart-tooltip-content",
845
- style: {
855
+ style: f({
846
856
  position: "absolute",
847
- transform: "translateY(-50%)"
848
- }
849
- }, [_(t.$slots, "tooltip", d(l($.value)), () => [a("div", Ne, [$.value.xLabel ? (m(), i("div", Pe, v($.value.xLabel), 1)) : r("", !0), (m(!0), i(e, null, g($.value.values, (e) => (m(), i("div", {
857
+ top: "0",
858
+ left: "0",
859
+ willChange: "transform",
860
+ transform: Z.value ? `translate3d(${Z.value.left}px, ${Z.value.top}px, 0) translateY(-50%)` : "translateY(-50%)",
861
+ visibility: Z.value ? "visible" : "hidden"
862
+ })
863
+ }, [_(t.$slots, "tooltip", d(l(Q.value)), () => [a("div", Le, [Q.value.xLabel ? (m(), i("div", Re, v(Q.value.xLabel), 1)) : r("", !0), (m(!0), i(e, null, g(Q.value.values, (e) => (m(), i("div", {
850
864
  key: e.seriesIndex,
851
865
  class: "line-chart-tooltip-row"
852
866
  }, [a("span", {
853
867
  class: "line-chart-tooltip-swatch",
854
868
  style: f({ background: e.color })
855
- }, null, 4), o(" " + v(isFinite(e.value) ? H(e.value) : "—"), 1)]))), 128))])], !0)], 512)) : r("", !0),
856
- ot.value ? (m(), i("a", {
869
+ }, null, 4), o(" " + v(isFinite(e.value) ? J(e.value) : "—"), 1)]))), 128))])], !0)], 4)) : r("", !0),
870
+ ct.value ? (m(), i("a", {
857
871
  key: 2,
858
872
  class: "line-chart-download-link",
859
- href: st.value,
860
- download: `${He()}.csv`
861
- }, v(ot.value), 9, Fe)) : r("", !0)
873
+ href: lt.value,
874
+ download: `${Ke()}.csv`
875
+ }, v(ct.value), 9, ze)) : r("", !0)
862
876
  ], 512));
863
877
  }
864
- }), [["__scopeId", "data-v-d1434a63"]]), Ve = {
878
+ }), [["__scopeId", "data-v-eb7e46c4"]]), We = {
865
879
  "01013": "010259",
866
880
  "01015": "010177",
867
881
  "01029": "010177",
@@ -4022,7 +4036,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
4022
4036
  51019: "510014",
4023
4037
  "02158": "020820",
4024
4038
  46102: "460957"
4025
- }, He = {
4039
+ }, Ge = {
4026
4040
  "010259": "Butler, AL",
4027
4041
  "010177": "Calhoun (Anniston), AL - Cleburne, AL",
4028
4042
  "010172": "Chambers, AL - Randolph, AL",
@@ -4972,25 +4986,25 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
4972
4986
  560775: "Teton, WY - Lincoln, WY",
4973
4987
  560792: "Uinta, WY",
4974
4988
  560804: "Weston, WY"
4975
- }, Ue = ["width", "height"], We = [
4989
+ }, Ke = ["width", "height"], qe = [
4976
4990
  "data-feat-id",
4977
4991
  "d",
4978
4992
  "fill",
4979
4993
  "stroke",
4980
4994
  "stroke-width"
4981
- ], Q = { key: 0 }, Ge = ["d", "stroke"], Ke = ["transform"], qe = {
4995
+ ], Je = { key: 0 }, Y = ["d", "stroke"], Ye = ["transform"], Xe = {
4982
4996
  key: 0,
4983
4997
  y: 5,
4984
4998
  "font-size": "13",
4985
4999
  "font-weight": "600",
4986
5000
  fill: "currentColor"
4987
- }, Je = ["x", "fill"], Ye = ["x"], $ = {
5001
+ }, X = ["x", "fill"], Z = ["x"], Ze = {
4988
5002
  key: 0,
4989
5003
  y: 5,
4990
5004
  "font-size": "13",
4991
5005
  "font-weight": "600",
4992
5006
  fill: "currentColor"
4993
- }, Xe = ["offset", "stop-color"], Ze = ["x", "fill"], Qe = ["x"], $e = ["x"], et = /* @__PURE__ */ R(/* @__PURE__ */ c({
5007
+ }, Qe = ["offset", "stop-color"], $e = ["x", "fill"], Q = ["x"], et = ["x"], tt = /* @__PURE__ */ I(/* @__PURE__ */ c({
4994
5008
  __name: "ChoroplethMap",
4995
5009
  props: {
4996
5010
  topology: {},
@@ -5026,80 +5040,80 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5026
5040
  },
5027
5041
  emits: ["stateClick", "stateHover"],
5028
5042
  setup(o, { emit: s }) {
5029
- let c = o, l = s, d = `choropleth-gradient-${x()}`, f = h(null), _ = h(null), b = h(null), C = h(0), w = null, T = null, E = !1, D = typeof window < "u" && "ontouchstart" in window, O = null, k = null;
5030
- function A() {
5031
- if (D) return;
5043
+ let c = o, l = s, d = `choropleth-gradient-${x()}`, f = h(null), _ = h(null), b = h(null), S = h(0), C = null, w = null, T = !1, E = typeof window < "u" && "ontouchstart" in window, D = null, O = null;
5044
+ function k() {
5045
+ if (E) return;
5032
5046
  let e = b.value;
5033
- e && (e.addEventListener("click", J), e.addEventListener("mouseover", J), e.addEventListener("mousemove", Ee), e.addEventListener("mouseout", De));
5047
+ e && (e.addEventListener("click", G), e.addEventListener("mouseover", G), e.addEventListener("mousemove", ke), e.addEventListener("mouseout", Ae));
5034
5048
  }
5035
- function j() {
5049
+ function A() {
5036
5050
  let e = b.value;
5037
- e && (e.removeEventListener("click", J), e.removeEventListener("mouseover", J), e.removeEventListener("mousemove", Ee), e.removeEventListener("mouseout", De));
5051
+ e && (e.removeEventListener("click", G), e.removeEventListener("mouseover", G), e.removeEventListener("mousemove", ke), e.removeEventListener("mouseout", Ae));
5038
5052
  }
5039
5053
  p(() => {
5040
- f.value && (C.value = f.value.clientWidth, O = new ResizeObserver((e) => {
5054
+ f.value && (S.value = f.value.clientWidth, D = new ResizeObserver((e) => {
5041
5055
  let t = e[0];
5042
- t && (C.value = t.contentRect.width);
5043
- }), O.observe(f.value)), M(), A();
5056
+ t && (S.value = t.contentRect.width);
5057
+ }), D.observe(f.value)), j(), k();
5044
5058
  }), ee(() => {
5045
- O?.disconnect(), N(), j(), Ce();
5059
+ D?.disconnect(), M(), A(), Ee();
5046
5060
  });
5047
- function M() {
5061
+ function j() {
5048
5062
  if (!_.value || !b.value || !c.zoom && !c.pan) return;
5049
- let e = ne(_.value);
5050
- k = te().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
5051
- E = !0, Te();
5063
+ let e = re(_.value);
5064
+ O = P().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
5065
+ T = !0, Oe();
5052
5066
  }).on("zoom", (e) => {
5053
5067
  b.value && b.value.setAttribute("transform", e.transform);
5054
5068
  }).on("end", () => {
5055
- E = !1;
5056
- }), c.pan || k.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(k);
5069
+ T = !1;
5070
+ }), c.pan || O.filter((e) => e.type === "wheel" || e.type === "dblclick"), e.call(O);
5057
5071
  }
5058
- function N() {
5059
- _.value && k && (ne(_.value).on(".zoom", null), k = null);
5072
+ function M() {
5073
+ _.value && O && (re(_.value).on(".zoom", null), O = null);
5060
5074
  }
5061
- S(() => [c.zoom, c.pan], () => {
5062
- N(), j(), M(), A();
5075
+ te(() => [c.zoom, c.pan], () => {
5076
+ M(), A(), j(), k();
5063
5077
  });
5064
- let I = t(() => c.width ?? (C.value || 600)), oe = t(() => c.width && c.height ? c.height / c.width : .625), L = t(() => I.value * oe.value), R = t(() => {
5078
+ let F = t(() => c.width ?? (S.value || 600)), se = t(() => c.width && c.height ? c.height / c.width : .625), ce = t(() => F.value * se.value), I = t(() => {
5065
5079
  let e = y(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
5066
5080
  for (let e of t) {
5067
- let t = Ve[String(e.id).padStart(5, "0")];
5081
+ let t = We[String(e.id).padStart(5, "0")];
5068
5082
  t && (n.has(t) || n.set(t, []), n.get(t).push(e));
5069
5083
  }
5070
5084
  let r = [];
5071
5085
  for (let [t, i] of n) r.push({
5072
5086
  type: "Feature",
5073
5087
  id: t,
5074
- properties: { name: He[t] ?? t },
5075
- geometry: ie(e, i)
5088
+ properties: { name: Ge[t] ?? t },
5089
+ geometry: ae(e, i)
5076
5090
  });
5077
5091
  return {
5078
5092
  type: "FeatureCollection",
5079
5093
  features: r
5080
5094
  };
5081
- }), z = t(() => {
5082
- if (c.geoType === "hsas") return R.value;
5095
+ }), L = t(() => {
5096
+ if (c.geoType === "hsas") return I.value;
5083
5097
  if (c.geoType === "counties") {
5084
5098
  let e = y(c.topology);
5085
- return re(e, e.objects.counties);
5099
+ return ie(e, e.objects.counties);
5086
5100
  }
5087
5101
  let e = y(c.topology);
5088
- return re(e, e.objects.states);
5089
- }), B = t(() => {
5102
+ return ie(e, e.objects.states);
5103
+ }), fe = t(() => {
5090
5104
  if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
5091
5105
  let e = y(c.topology);
5092
- return ae(e, e.objects.states, (e, t) => e !== t);
5093
- }), V = t(() => P().fitExtent([[0, Y.value], [I.value, L.value + Y.value]], z.value)), H = t(() => F(V.value)), U = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), de = t(() => {
5106
+ return oe(e, e.objects.states, (e, t) => e !== t);
5107
+ }), R = t(() => ne().fitExtent([[0, Ie.value], [F.value, ce.value + Ie.value]], L.value)), z = t(() => N(R.value)), B = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), me = t(() => {
5094
5108
  let e = /* @__PURE__ */ new Map();
5095
5109
  if (!c.data) return e;
5096
5110
  for (let t of c.data) {
5097
5111
  e.set(t.id, t.value);
5098
- let n = z.value.features.find((e) => e.properties?.name === t.id);
5112
+ let n = L.value.features.find((e) => e.properties?.name === t.id);
5099
5113
  n?.id != null && e.set(String(n.id), t.value);
5100
5114
  }
5101
5115
  return e;
5102
- }), fe = t(() => {
5116
+ }), he = t(() => {
5103
5117
  if (!c.data || c.data.length === 0) return {
5104
5118
  min: 0,
5105
5119
  max: 1
@@ -5116,8 +5130,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5116
5130
  min: 0,
5117
5131
  max: 1
5118
5132
  };
5119
- }), W = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), G = t(() => Array.isArray(c.colorScale) && !W.value), pe = t(() => G.value ? "" : c.colorScale?.min ?? "#e5f0fa"), me = t(() => G.value ? "" : c.colorScale?.max ?? "#08519c");
5120
- function he(e) {
5133
+ }), V = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), H = t(() => Array.isArray(c.colorScale) && !V.value), ge = t(() => H.value ? "" : c.colorScale?.min ?? "#e5f0fa"), _e = t(() => H.value ? "" : c.colorScale?.max ?? "#08519c");
5134
+ function ve(e) {
5121
5135
  let t = e.replace("#", "");
5122
5136
  return [
5123
5137
  parseInt(t.slice(0, 2), 16),
@@ -5125,103 +5139,103 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5125
5139
  parseInt(t.slice(4, 6), 16)
5126
5140
  ];
5127
5141
  }
5128
- function ge(e) {
5129
- let [t, n, r] = he(pe.value), [i, a, o] = he(me.value);
5142
+ function ye(e) {
5143
+ let [t, n, r] = ve(ge.value), [i, a, o] = ve(_e.value);
5130
5144
  return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
5131
5145
  }
5132
- function _e(e) {
5146
+ function be(e) {
5133
5147
  let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
5134
5148
  for (let n of t) if (e >= n.min) return n.color;
5135
5149
  return c.noDataColor;
5136
5150
  }
5137
- function ve(e) {
5151
+ function xe(e) {
5138
5152
  let t = c.colorScale.find((t) => t.value === String(e));
5139
5153
  return t ? t.color : c.noDataColor;
5140
5154
  }
5141
- function ye(e) {
5142
- let t = de.value.get(String(e));
5155
+ function Se(e) {
5156
+ let t = me.value.get(String(e));
5143
5157
  if (t == null) return c.noDataColor;
5144
- if (W.value) return ve(t);
5145
- if (G.value) return _e(t);
5146
- let { min: n, max: r } = fe.value;
5147
- return ge((t - n) / (r - n));
5158
+ if (V.value) return xe(t);
5159
+ if (H.value) return be(t);
5160
+ let { min: n, max: r } = he.value;
5161
+ return ye((t - n) / (r - n));
5148
5162
  }
5149
- function K(e) {
5163
+ function U(e) {
5150
5164
  return e.properties?.name ?? String(e.id);
5151
5165
  }
5152
- function q(e) {
5153
- return de.value.get(String(e.id));
5166
+ function W(e) {
5167
+ return me.value.get(String(e.id));
5154
5168
  }
5155
- let be = t(() => {
5169
+ let Ce = t(() => {
5156
5170
  let e = /* @__PURE__ */ new Map();
5157
- for (let t of z.value.features) e.set(String(t.id), t);
5171
+ for (let t of L.value.features) e.set(String(t.id), t);
5158
5172
  return e;
5159
5173
  });
5160
- function xe(e) {
5174
+ function we(e) {
5161
5175
  let t = e;
5162
5176
  for (; t && !t.dataset?.featId;) t = t.parentElement;
5163
5177
  if (!t) return null;
5164
- let n = be.value.get(t.dataset.featId);
5178
+ let n = Ce.value.get(t.dataset.featId);
5165
5179
  return n ? {
5166
5180
  pathEl: t,
5167
5181
  feat: n
5168
5182
  } : null;
5169
5183
  }
5170
- function Se(e, t, n) {
5171
- T || (T = document.createElement("div"), T.className = "chart-tooltip-content", T.style.position = "fixed", T.style.transform = "translateY(-50%)", document.body.appendChild(T));
5172
- let r = K(e), i = q(e), a = {
5184
+ function Te(e, t, n) {
5185
+ w || (w = document.createElement("div"), w.className = "chart-tooltip-content", w.style.position = "fixed", w.style.transform = "translateY(-50%)", document.body.appendChild(w));
5186
+ let r = U(e), i = W(e), a = {
5173
5187
  id: String(e.id),
5174
5188
  name: r,
5175
5189
  value: i
5176
5190
  };
5177
- c.tooltipFormat ? T.innerHTML = c.tooltipFormat(a) : T.textContent = i == null ? r : `${r}: ${i}`;
5178
- let o = f.value?.getBoundingClientRect(), { left: s, top: l } = ue(t, n, T.offsetWidth, T.offsetHeight, c.tooltipClamp, o);
5179
- T.style.left = `${s}px`, T.style.top = `${l}px`;
5191
+ c.tooltipFormat ? w.innerHTML = c.tooltipFormat(a) : w.textContent = i == null ? r : `${r}: ${i}`;
5192
+ let o = f.value?.getBoundingClientRect(), { left: s, top: l } = pe(t, n, w.offsetWidth, w.offsetHeight, c.tooltipClamp, o);
5193
+ w.style.left = `${s}px`, w.style.top = `${l}px`;
5180
5194
  }
5181
- function Ce() {
5182
- T &&= (T.remove(), null);
5195
+ function Ee() {
5196
+ w &&= (w.remove(), null);
5183
5197
  }
5184
- function we(e, t) {
5185
- w && w !== e && (w.setAttribute("stroke-width", String(U.value)), w.setAttribute("stroke", c.strokeColor)), w = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(U.value + 1)), e.setAttribute("stroke", "#555");
5198
+ function De(e, t) {
5199
+ C && C !== e && (C.setAttribute("stroke-width", String(B.value)), C.setAttribute("stroke", c.strokeColor)), C = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(B.value + 1)), e.setAttribute("stroke", "#555");
5186
5200
  }
5187
- function Te() {
5188
- w && (w.setAttribute("stroke-width", String(U.value)), w.setAttribute("stroke", c.strokeColor), w = null, l("stateHover", null)), Ce();
5201
+ function Oe() {
5202
+ C && (C.setAttribute("stroke-width", String(B.value)), C.setAttribute("stroke", c.strokeColor), C = null, l("stateHover", null)), Ee();
5189
5203
  }
5190
- function J(e) {
5191
- if (E) return;
5192
- let t = e, n = xe(t.target);
5204
+ function G(e) {
5205
+ if (T) return;
5206
+ let t = e, n = we(t.target);
5193
5207
  n && (e.type === "click" ? l("stateClick", {
5194
5208
  id: String(n.feat.id),
5195
- name: K(n.feat),
5196
- value: q(n.feat)
5197
- }) : e.type === "mouseover" && (we(n.pathEl, n.feat), c.tooltipTrigger && Se(n.feat, t.clientX, t.clientY), l("stateHover", {
5209
+ name: U(n.feat),
5210
+ value: W(n.feat)
5211
+ }) : e.type === "mouseover" && (De(n.pathEl, n.feat), c.tooltipTrigger && Te(n.feat, t.clientX, t.clientY), l("stateHover", {
5198
5212
  id: String(n.feat.id),
5199
- name: K(n.feat),
5200
- value: q(n.feat)
5213
+ name: U(n.feat),
5214
+ value: W(n.feat)
5201
5215
  })));
5202
5216
  }
5203
- function Ee(e) {
5204
- E || !T || (T.style.left = `${e.clientX + 16}px`, T.style.top = `${e.clientY}px`);
5217
+ function ke(e) {
5218
+ T || !w || (w.style.left = `${e.clientX + 16}px`, w.style.top = `${e.clientY}px`);
5205
5219
  }
5206
- function De(e) {
5220
+ function Ae(e) {
5207
5221
  let t = e.relatedTarget;
5208
- t && b.value?.contains(t) || Te();
5222
+ t && b.value?.contains(t) || Oe();
5209
5223
  }
5210
- function Oe() {
5224
+ function je() {
5211
5225
  return typeof c.menu == "string" ? c.menu : "choropleth";
5212
5226
  }
5213
- let ke = t(() => c.legend && (W.value || G.value || c.data)), Ae = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), je = t(() => c.title ? 24 : 0), Me = t(() => ke.value ? 28 : 0), Y = t(() => je.value + Me.value), Ne = t(() => L.value + Y.value), Pe = t(() => je.value + 18), Fe = t(() => {
5227
+ let Me = t(() => c.legend && (V.value || H.value || c.data)), Ne = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), Pe = t(() => c.title ? 24 : 0), Fe = t(() => Me.value ? 28 : 0), Ie = t(() => Pe.value + Fe.value), Le = t(() => ce.value + Ie.value), Re = t(() => Pe.value + 18), ze = t(() => {
5214
5228
  let e = [];
5215
5229
  for (let t = 0; t <= 10; t++) {
5216
5230
  let n = t / 10;
5217
5231
  e.push({
5218
5232
  offset: `${(n * 100).toFixed(0)}%`,
5219
- color: ge(n)
5233
+ color: ye(n)
5220
5234
  });
5221
5235
  }
5222
5236
  return e;
5223
- }), X = t(() => {
5224
- let { min: e, max: t } = fe.value, n = t - e, r = [];
5237
+ }), K = t(() => {
5238
+ let { min: e, max: t } = he.value, n = t - e, r = [];
5225
5239
  for (let t = 1; t <= 3; t++) {
5226
5240
  let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
5227
5241
  r.push({
@@ -5230,44 +5244,44 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5230
5244
  });
5231
5245
  }
5232
5246
  return r;
5233
- }), Z = t(() => {
5247
+ }), q = t(() => {
5234
5248
  let e = [];
5235
- if (W.value) for (let t of c.colorScale) e.push({
5249
+ if (V.value) for (let t of c.colorScale) e.push({
5236
5250
  key: t.value,
5237
5251
  color: t.color,
5238
5252
  label: t.value
5239
5253
  });
5240
- else if (G.value) for (let t of Ae.value) e.push({
5254
+ else if (H.value) for (let t of Ne.value) e.push({
5241
5255
  key: String(t.min),
5242
5256
  color: t.color,
5243
5257
  label: t.label ?? String(t.min)
5244
5258
  });
5245
5259
  return e;
5246
- }), Ie = t(() => {
5260
+ }), Be = t(() => {
5247
5261
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5248
- for (let t of Z.value) e += 16 + t.label.length * 7 + 12;
5249
- return e - (Z.value.length > 0 ? 12 : 0);
5250
- }), Le = t(() => {
5262
+ for (let t of q.value) e += 16 + t.label.length * 7 + 12;
5263
+ return e - (q.value.length > 0 ? 12 : 0);
5264
+ }), Ve = t(() => {
5251
5265
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5252
- return Z.value.map((t) => {
5266
+ return q.value.map((t) => {
5253
5267
  let n = e;
5254
5268
  return e += 16 + t.label.length * 7 + 12, n;
5255
5269
  });
5256
- }), Re = t(() => {
5257
- if (W.value || G.value) return (I.value - Ie.value) / 2;
5270
+ }), He = t(() => {
5271
+ if (V.value || H.value) return (F.value - Be.value) / 2;
5258
5272
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5259
- return (I.value - e - 160) / 2;
5260
- }), ze = t(() => {
5261
- let e = Oe();
5273
+ return (F.value - e - 160) / 2;
5274
+ }), Ue = t(() => {
5275
+ let e = je();
5262
5276
  return [{
5263
5277
  label: "Save as SVG",
5264
5278
  action: () => {
5265
- _.value && ce(_.value, e);
5279
+ _.value && ue(_.value, e);
5266
5280
  }
5267
5281
  }, {
5268
5282
  label: "Save as PNG",
5269
5283
  action: () => {
5270
- _.value && le(_.value, e);
5284
+ _.value && de(_.value, e);
5271
5285
  }
5272
5286
  }];
5273
5287
  });
@@ -5275,64 +5289,64 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5275
5289
  ref_key: "containerRef",
5276
5290
  ref: f,
5277
5291
  class: u(["choropleth-wrapper", { pannable: o.pan }])
5278
- }, [o.menu ? (m(), n(se, {
5292
+ }, [o.menu ? (m(), n(le, {
5279
5293
  key: 0,
5280
- items: ze.value
5294
+ items: Ue.value
5281
5295
  }, null, 8, ["items"])) : r("", !0), (m(), i("svg", {
5282
5296
  ref_key: "svgRef",
5283
5297
  ref: _,
5284
- width: I.value,
5285
- height: Ne.value
5298
+ width: F.value,
5299
+ height: Le.value
5286
5300
  }, [
5287
5301
  a("g", {
5288
5302
  ref_key: "mapGroupRef",
5289
5303
  ref: b
5290
- }, [(m(!0), i(e, null, g(z.value.features, (e) => (m(), i("path", {
5304
+ }, [(m(!0), i(e, null, g(L.value.features, (e) => (m(), i("path", {
5291
5305
  key: String(e.id),
5292
5306
  "data-feat-id": String(e.id),
5293
- d: H.value(e) ?? void 0,
5294
- fill: ye(e.id),
5307
+ d: z.value(e) ?? void 0,
5308
+ fill: Se(e.id),
5295
5309
  stroke: o.strokeColor,
5296
- "stroke-width": U.value,
5310
+ "stroke-width": B.value,
5297
5311
  class: "state-path"
5298
- }, [o.tooltipTrigger ? r("", !0) : (m(), i("title", Q, v(K(e)) + v(q(e) == null ? "" : `: ${q(e)}`), 1))], 8, We))), 128)), B.value ? (m(), i("path", {
5312
+ }, [o.tooltipTrigger ? r("", !0) : (m(), i("title", Je, v(U(e)) + v(W(e) == null ? "" : `: ${W(e)}`), 1))], 8, qe))), 128)), fe.value ? (m(), i("path", {
5299
5313
  key: 0,
5300
- d: H.value(B.value) ?? void 0,
5314
+ d: z.value(fe.value) ?? void 0,
5301
5315
  fill: "none",
5302
5316
  stroke: o.strokeColor,
5303
5317
  "stroke-width": 1,
5304
5318
  "stroke-linejoin": "round",
5305
5319
  "pointer-events": "none"
5306
- }, null, 8, Ge)) : r("", !0)], 512),
5307
- ke.value ? (m(), i("g", {
5320
+ }, null, 8, Y)) : r("", !0)], 512),
5321
+ Me.value ? (m(), i("g", {
5308
5322
  key: 0,
5309
5323
  class: "choropleth-legend",
5310
- transform: `translate(${Re.value},${Pe.value})`
5311
- }, [W.value || G.value ? (m(), i(e, { key: 0 }, [o.legendTitle ? (m(), i("text", qe, v(o.legendTitle), 1)) : r("", !0), (m(!0), i(e, null, g(Z.value, (t, n) => (m(), i(e, { key: t.key }, [a("rect", {
5312
- x: Le.value[n],
5324
+ transform: `translate(${He.value},${Re.value})`
5325
+ }, [V.value || H.value ? (m(), i(e, { key: 0 }, [o.legendTitle ? (m(), i("text", Xe, v(o.legendTitle), 1)) : r("", !0), (m(!0), i(e, null, g(q.value, (t, n) => (m(), i(e, { key: t.key }, [a("rect", {
5326
+ x: Ve.value[n],
5313
5327
  y: -5,
5314
5328
  width: "12",
5315
5329
  height: "12",
5316
5330
  rx: "3",
5317
5331
  fill: t.color
5318
- }, null, 8, Je), a("text", {
5319
- x: Le.value[n] + 16,
5332
+ }, null, 8, X), a("text", {
5333
+ x: Ve.value[n] + 16,
5320
5334
  y: 5,
5321
5335
  "font-size": "13",
5322
5336
  fill: "currentColor"
5323
- }, v(t.label), 9, Ye)], 64))), 128))], 64)) : (m(), i(e, { key: 1 }, [
5324
- o.legendTitle ? (m(), i("text", $, v(o.legendTitle), 1)) : r("", !0),
5337
+ }, v(t.label), 9, Z)], 64))), 128))], 64)) : (m(), i(e, { key: 1 }, [
5338
+ o.legendTitle ? (m(), i("text", Ze, v(o.legendTitle), 1)) : r("", !0),
5325
5339
  a("defs", null, [a("linearGradient", {
5326
5340
  id: d,
5327
5341
  x1: "0",
5328
5342
  x2: "1",
5329
5343
  y1: "0",
5330
5344
  y2: "0"
5331
- }, [(m(!0), i(e, null, g(Fe.value, (e) => (m(), i("stop", {
5345
+ }, [(m(!0), i(e, null, g(ze.value, (e) => (m(), i("stop", {
5332
5346
  key: e.offset,
5333
5347
  offset: e.offset,
5334
5348
  "stop-color": e.color
5335
- }, null, 8, Xe))), 128))])]),
5349
+ }, null, 8, Qe))), 128))])]),
5336
5350
  a("rect", {
5337
5351
  x: o.legendTitle ? o.legendTitle.length * 8 + 12 : 0,
5338
5352
  y: -6,
@@ -5340,8 +5354,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5340
5354
  height: 12,
5341
5355
  rx: "2",
5342
5356
  fill: `url(#${d})`
5343
- }, null, 8, Ze),
5344
- (m(!0), i(e, null, g(X.value, (e) => (m(), i("text", {
5357
+ }, null, 8, $e),
5358
+ (m(!0), i(e, null, g(K.value, (e) => (m(), i("text", {
5345
5359
  key: e.value,
5346
5360
  x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
5347
5361
  y: 20,
@@ -5349,20 +5363,20 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5349
5363
  fill: "currentColor",
5350
5364
  opacity: "0.7",
5351
5365
  "text-anchor": "middle"
5352
- }, v(e.value), 9, Qe))), 128))
5353
- ], 64))], 8, Ke)) : r("", !0),
5366
+ }, v(e.value), 9, Q))), 128))
5367
+ ], 64))], 8, Ye)) : r("", !0),
5354
5368
  o.title ? (m(), i("text", {
5355
5369
  key: 1,
5356
- x: I.value / 2,
5370
+ x: F.value / 2,
5357
5371
  y: 18,
5358
5372
  "text-anchor": "middle",
5359
5373
  "font-size": "14",
5360
5374
  "font-weight": "600",
5361
5375
  fill: "currentColor"
5362
- }, v(o.title), 9, $e)) : r("", !0)
5363
- ], 8, Ue))], 2));
5376
+ }, v(o.title), 9, et)) : r("", !0)
5377
+ ], 8, Ke))], 2));
5364
5378
  }
5365
- }), [["__scopeId", "data-v-25a20d5b"]]), tt = /* @__PURE__ */ R(/* @__PURE__ */ c({
5379
+ }), [["__scopeId", "data-v-25a20d5b"]]), $ = /* @__PURE__ */ I(/* @__PURE__ */ c({
5366
5380
  __name: "ChartTooltip",
5367
5381
  props: {
5368
5382
  x: {},
@@ -5382,12 +5396,12 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5382
5396
  top: `${e.y}px`,
5383
5397
  transform: "translateY(-50%)"
5384
5398
  })
5385
- }, [_(t.$slots, "default", {}, void 0, !0)], 4)) : e.mode === "click" ? (m(), n(b(N), {
5399
+ }, [_(t.$slots, "default", {}, void 0, !0)], 4)) : e.mode === "click" ? (m(), n(b(M), {
5386
5400
  key: 1,
5387
5401
  open: e.open
5388
5402
  }, {
5389
- default: C(() => [s(b(A), { "as-child": "" }, {
5390
- default: C(() => [a("div", {
5403
+ default: S(() => [s(b(k), { "as-child": "" }, {
5404
+ default: S(() => [a("div", {
5391
5405
  class: "chart-tooltip-anchor",
5392
5406
  style: f({
5393
5407
  left: `${e.x}px`,
@@ -5395,8 +5409,8 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5395
5409
  })
5396
5410
  }, null, 4)]),
5397
5411
  _: 1
5398
- }), s(b(M), null, {
5399
- default: C(() => [e.open ? (m(), n(b(j), {
5412
+ }), s(b(j), null, {
5413
+ default: S(() => [e.open ? (m(), n(b(A), {
5400
5414
  key: 0,
5401
5415
  class: "chart-tooltip-content",
5402
5416
  side: "right",
@@ -5405,7 +5419,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5405
5419
  onPointerDownOutside: o[0] ||= (e) => t.$emit("close"),
5406
5420
  onEscapeKeyDown: o[1] ||= (e) => t.$emit("close")
5407
5421
  }, {
5408
- default: C(() => [_(t.$slots, "default", {}, void 0, !0)]),
5422
+ default: S(() => [_(t.$slots, "default", {}, void 0, !0)]),
5409
5423
  _: 3
5410
5424
  }, 8, ["side-offset"])) : r("", !0)]),
5411
5425
  _: 3
@@ -5413,7 +5427,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5413
5427
  _: 3
5414
5428
  }, 8, ["open"])) : r("", !0);
5415
5429
  }
5416
- }), [["__scopeId", "data-v-44377f70"]]), nt = { class: "TableWrapper" }, rt = { class: "Table" }, it = ["href", "download"], at = /* @__PURE__ */ R(/* @__PURE__ */ c({
5430
+ }), [["__scopeId", "data-v-44377f70"]]), nt = { class: "TableWrapper" }, rt = { class: "Table" }, it = ["href", "download"], at = /* @__PURE__ */ I(/* @__PURE__ */ c({
5417
5431
  __name: "DataTable",
5418
5432
  props: {
5419
5433
  data: {},
@@ -5479,7 +5493,7 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5479
5493
  function x(e) {
5480
5494
  return e.includes(",") || e.includes("\"") || e.includes("\n") ? `"${e.replace(/"/g, "\"\"")}"` : e;
5481
5495
  }
5482
- function S() {
5496
+ function te() {
5483
5497
  if (typeof c.csv == "function") return c.csv();
5484
5498
  if (typeof c.csv == "string") return c.csv;
5485
5499
  let e = h.value, t = _.value, n = [e.map((e) => x(l(e.name))).join(",")];
@@ -5489,14 +5503,14 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5489
5503
  }
5490
5504
  return n.join("\n");
5491
5505
  }
5492
- let C = t(() => c.downloadLink ? [] : [{
5506
+ let S = t(() => c.downloadLink ? [] : [{
5493
5507
  label: "Download CSV",
5494
- action: () => B(S(), b())
5495
- }]), w = t(() => c.downloadLink ? typeof c.downloadLink == "string" ? c.downloadLink : "Download data (CSV)" : null), T = t(() => c.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(S())}` : null), E = t(() => c.menu && C.value.length > 0);
5496
- return (t, s) => (m(), i("div", { class: u(["TableOuter", { "has-menu": E.value }]) }, [
5497
- E.value ? (m(), n(se, {
5508
+ action: () => fe(te(), b())
5509
+ }]), C = t(() => c.downloadLink ? typeof c.downloadLink == "string" ? c.downloadLink : "Download data (CSV)" : null), w = t(() => c.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(te())}` : null), T = t(() => c.menu && S.value.length > 0);
5510
+ return (t, s) => (m(), i("div", { class: u(["TableOuter", { "has-menu": T.value }]) }, [
5511
+ T.value ? (m(), n(le, {
5498
5512
  key: 0,
5499
- items: C.value
5513
+ items: S.value
5500
5514
  }, null, 8, ["items"])) : r("", !0),
5501
5515
  a("div", nt, [a("table", rt, [
5502
5516
  a("colgroup", null, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("col", {
@@ -5513,14 +5527,14 @@ var U = ["width", "height"], de = ["x"], fe = { key: 1 }, W = [
5513
5527
  style: f(p(e.name))
5514
5528
  }, v(y(e, t - 1)), 7))), 128))]))), 128))])
5515
5529
  ])]),
5516
- w.value ? (m(), i("a", {
5530
+ C.value ? (m(), i("a", {
5517
5531
  key: 1,
5518
5532
  class: "data-table-download-link",
5519
- href: T.value,
5533
+ href: w.value,
5520
5534
  download: `${b()}.csv`
5521
- }, v(w.value), 9, it)) : r("", !0)
5535
+ }, v(C.value), 9, it)) : r("", !0)
5522
5536
  ], 2));
5523
5537
  }
5524
5538
  }), [["__scopeId", "data-v-505e2187"]]);
5525
5539
  //#endregion
5526
- export { tt as ChartTooltip, et as ChoroplethMap, at as DataTable, Be as LineChart };
5540
+ export { $ as ChartTooltip, tt as ChoroplethMap, at as DataTable, J as LineChart };