@cfasim-ui/charts 0.3.3 → 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,75 +103,99 @@ 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
+ }
113
+ //#endregion
114
+ //#region src/tooltip-position.ts
115
+ var R = 16, z = 8;
116
+ function pe(e, t, n, r, i, a) {
117
+ if (i === "none") return {
118
+ left: e + R,
119
+ top: t
120
+ };
121
+ let o = i === "chart" && a ? {
122
+ left: a.left,
123
+ right: a.right,
124
+ top: a.top,
125
+ bottom: a.bottom
126
+ } : {
127
+ left: 0,
128
+ right: window.innerWidth,
129
+ top: 0,
130
+ bottom: window.innerHeight
131
+ }, s = e + R + n > o.right - z ? e - R - n : e + R, c = r / 2;
132
+ return {
133
+ left: s,
134
+ top: Math.min(Math.max(t, o.top + z + c), o.bottom - z - c)
135
+ };
112
136
  }
113
137
  //#endregion
114
138
  //#region src/LineChart/LineChart.vue?vue&type=script&setup=true&lang.ts
115
- var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
139
+ var B = ["width", "height"], me = ["x"], he = { key: 1 }, V = [
116
140
  "x1",
117
141
  "y1",
118
142
  "x2",
119
143
  "y2",
120
144
  "stroke",
121
145
  "stroke-dasharray"
122
- ], pe = [
146
+ ], H = [
123
147
  "cx",
124
148
  "cy",
125
149
  "fill",
126
150
  "fill-opacity",
127
151
  "stroke"
128
- ], H = ["x", "y"], U = [
152
+ ], ge = ["x", "y"], _e = [
129
153
  "x1",
130
154
  "y1",
131
155
  "x2",
132
156
  "y2"
133
- ], me = [
157
+ ], ve = [
134
158
  "x1",
135
159
  "y1",
136
160
  "x2",
137
161
  "y2"
138
- ], he = [
162
+ ], ye = [
139
163
  "x1",
140
164
  "y1",
141
165
  "x2",
142
166
  "y2"
143
- ], ge = [
167
+ ], be = [
144
168
  "x1",
145
169
  "y1",
146
170
  "x2",
147
171
  "y2"
148
- ], _e = ["x", "y"], ve = ["transform"], ye = ["x", "y"], be = ["x", "y"], W = [
172
+ ], xe = ["x", "y"], Se = ["transform"], U = ["x", "y"], W = ["x", "y"], Ce = [
149
173
  "d",
150
174
  "fill",
151
175
  "fill-opacity"
152
- ], G = [
176
+ ], we = [
153
177
  "d",
154
178
  "stroke",
155
179
  "stroke-width",
156
180
  "stroke-opacity",
157
181
  "stroke-dasharray"
158
- ], xe = [
182
+ ], Te = [
159
183
  "cx",
160
184
  "cy",
161
185
  "r",
162
186
  "fill",
163
187
  "fill-opacity",
164
188
  "stroke"
165
- ], Se = [
189
+ ], Ee = [
166
190
  "d",
167
191
  "fill",
168
192
  "fill-opacity"
169
- ], Ce = [
193
+ ], De = [
170
194
  "d",
171
195
  "stroke",
172
196
  "stroke-width",
173
197
  "stroke-dasharray"
174
- ], we = [
198
+ ], Oe = [
175
199
  "x1",
176
200
  "y1",
177
201
  "x2",
@@ -179,7 +203,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
179
203
  "stroke",
180
204
  "stroke-width",
181
205
  "stroke-dasharray"
182
- ], Te = [
206
+ ], G = [
183
207
  "x1",
184
208
  "y1",
185
209
  "x2",
@@ -187,44 +211,44 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
187
211
  "stroke",
188
212
  "stroke-width",
189
213
  "stroke-dasharray"
190
- ], Ee = [
214
+ ], ke = [
191
215
  "x1",
192
216
  "y1",
193
217
  "x2",
194
218
  "y2"
195
- ], K = [
219
+ ], Ae = [
196
220
  "x1",
197
221
  "y1",
198
222
  "x2",
199
223
  "y2"
200
- ], De = [
224
+ ], je = [
201
225
  "x1",
202
226
  "y1",
203
227
  "x2",
204
228
  "y2"
205
- ], Oe = [
229
+ ], Me = [
206
230
  "cx",
207
231
  "cy",
208
232
  "fill"
209
- ], ke = [
233
+ ], Ne = [
210
234
  "x",
211
235
  "y",
212
236
  "width",
213
237
  "height"
214
- ], Ae = [
238
+ ], Pe = [
215
239
  "cx",
216
240
  "cy",
217
241
  "fill",
218
242
  "fill-opacity",
219
243
  "stroke"
220
- ], je = [
244
+ ], Fe = [
221
245
  "x",
222
246
  "y",
223
247
  "fill"
224
- ], Me = ["x", "y"], Ne = { class: "line-chart-tooltip" }, q = {
248
+ ], Ie = ["x", "y"], Le = { class: "line-chart-tooltip" }, Re = {
225
249
  key: 0,
226
250
  class: "line-chart-tooltip-label"
227
- }, Pe = ["href", "download"], J = 20, Y = 36, Fe = 12, X = 7, Ie = 16, Le = 50, Re = /* @__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({
228
252
  __name: "LineChart",
229
253
  props: {
230
254
  data: {},
@@ -249,37 +273,38 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
249
273
  yGrid: { type: Boolean },
250
274
  tooltipData: {},
251
275
  tooltipTrigger: {},
276
+ tooltipClamp: { default: "chart" },
252
277
  csv: {},
253
278
  filename: {},
254
279
  downloadLink: { type: [Boolean, String] }
255
280
  },
256
281
  emits: ["hover"],
257
282
  setup(s, { emit: c }) {
258
- 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;
259
284
  p(() => {
260
- b.value && (S.value = b.value.clientWidth, C = new ResizeObserver((e) => {
285
+ b.value && (S.value = b.value.clientWidth, w = new ResizeObserver((e) => {
261
286
  let t = e[0];
262
287
  t && (u.debounce ? (T && clearTimeout(T), T = setTimeout(() => {
263
288
  S.value = t.contentRect.width;
264
289
  }, u.debounce)) : S.value = t.contentRect.width);
265
- }), C.observe(b.value));
290
+ }), w.observe(b.value));
266
291
  }), ee(() => {
267
- C?.disconnect(), T && clearTimeout(T);
292
+ w?.disconnect(), T && clearTimeout(T);
268
293
  });
269
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(() => ({
270
- top: (u.title ? 30 : 10) + (O.value ? J : 0),
295
+ top: (u.title ? 30 : 10) + (O.value ? K : 0),
271
296
  right: 10,
272
297
  bottom: u.xLabel ? 46 : 30,
273
298
  left: u.yLabel ? 66 : 50
274
- })), 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(() => {
275
300
  let e = 0;
276
301
  for (let t of M.value) t.data.length > e && (e = t.data.length);
277
- 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);
278
303
  return e;
279
- }), F = t(() => {
304
+ }), P = t(() => {
280
305
  let e = Infinity, t = -Infinity;
281
306
  for (let n of M.value) for (let r of n.data) isFinite(r) && (r < e && (e = r), r > t && (t = r));
282
- for (let n of N.value) {
307
+ for (let n of ne.value) {
283
308
  for (let r of n.upper) isFinite(r) && (r < e && (e = r), r > t && (t = r));
284
309
  for (let r of n.lower) isFinite(r) && (r < e && (e = r), r > t && (t = r));
285
310
  }
@@ -293,9 +318,9 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
293
318
  range: 1
294
319
  };
295
320
  });
296
- function te(e) {
321
+ function re(e) {
297
322
  if (e.length === 0) return "";
298
- 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;
299
324
  for (let n = 0; n < e.length; n++) {
300
325
  if (!isFinite(e[n])) {
301
326
  c = !1;
@@ -306,18 +331,18 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
306
331
  }
307
332
  return s;
308
333
  }
309
- function ne(e) {
310
- 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 = [];
311
336
  for (let n = 0; n < e.length; n++) isFinite(e[n]) && s.push({
312
337
  x: k.value.left + n * i,
313
338
  y: o - (e[n] - t) * a
314
339
  });
315
340
  return s;
316
341
  }
317
- function re(e, t) {
342
+ function ae(e, t) {
318
343
  let n = Math.min(e.length, t.length);
319
344
  if (n === 0) return "";
320
- 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 = [];
321
346
  for (let r = 0; r < n; r++) isFinite(e[r]) && isFinite(t[r]) ? f.push(r) : f.length && (d.push(f), f = []);
322
347
  f.length && d.push(f);
323
348
  let p = "";
@@ -329,30 +354,30 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
329
354
  }
330
355
  return p;
331
356
  }
332
- function ie(e, t = !0) {
333
- 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;
334
359
  if (e.seriesIndex == null) {
335
360
  let t = Math.max(0, e.startIndex), r = Math.min(n - 1, e.endIndex);
336
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`;
337
362
  }
338
363
  let o = M.value[e.seriesIndex];
339
364
  if (!o) return "";
340
- 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);
341
366
  if (d > f) return "";
342
367
  let p = `M${a(d)},${u(o.data[d])}`;
343
368
  for (let e = d + 1; e <= f; e++) isFinite(o.data[e]) && (p += `L${a(e)},${u(o.data[e])}`);
344
369
  return t && (p += `L${a(f)},${i}`, p += `L${a(d)},${i}`, p += "Z"), p;
345
370
  }
346
- let ae = t(() => {
371
+ let F = t(() => {
347
372
  let e = u.areaSections;
348
373
  if (!e?.length) return {
349
374
  labels: [],
350
375
  extraHeight: 0
351
376
  };
352
- let t = P.value, n = A.value / (t - 1 || 1), r = [];
377
+ let t = N.value, n = A.value / (t - 1 || 1), r = [];
353
378
  for (let t of e) {
354
379
  if (!t.label && !t.description || t.legend === "inline" || t.legend === !1) continue;
355
- let e = k.value.left + (t.startIndex + t.endIndex) / 2 * n, i = t.label ?? "", a = t.description ?? "", o = Math.max(i.length, a.length) * X, 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");
356
381
  r.push({
357
382
  cx: e,
358
383
  labelText: i,
@@ -367,7 +392,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
367
392
  let i = [];
368
393
  for (let e of r) {
369
394
  let t = e.cx - e.textWidth / 2, n = 0;
370
- for (; n < i.length && !(t >= i[n] + Ie);) n++;
395
+ for (; n < i.length && !(t >= i[n] + He);) n++;
371
396
  e.row = n;
372
397
  let r = e.cx + e.textWidth / 2;
373
398
  i[n] = Math.max(i[n] ?? -Infinity, r);
@@ -377,9 +402,9 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
377
402
  extraHeight: 0
378
403
  } : {
379
404
  labels: r,
380
- extraHeight: (Math.max(...r.map((e) => e.row)) + 1) * Y + Fe
405
+ extraHeight: (Math.max(...r.map((e) => e.row)) + 1) * q + Be
381
406
  };
382
- }), I = t(() => {
407
+ }), se = t(() => {
383
408
  let e = [];
384
409
  for (let t of M.value) t.legend && e.push({
385
410
  label: t.legend,
@@ -399,64 +424,64 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
399
424
  });
400
425
  }
401
426
  return e;
402
- }), oe = t(() => D.value + ae.value.extraHeight), L = t(() => k.value.top + j.value + k.value.bottom + Fe);
403
- 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) {
404
429
  let n = e / t, r = 10 ** Math.floor(Math.log10(n)), i = n / r, a;
405
430
  return a = i <= 1.5 ? 1 : i <= 3 ? 2 : i <= 7 ? 5 : 10, a * r;
406
431
  }
407
- function z(e) {
432
+ function R(e) {
408
433
  return Math.round(e) + .5;
409
434
  }
410
- let Re = new Intl.NumberFormat();
411
- function Z(e) {
412
- return Math.abs(e) >= 1e3 ? Re.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);
413
438
  }
414
- let ze = t(() => {
415
- let { min: e, max: t } = F.value;
439
+ let We = t(() => {
440
+ let { min: e, max: t } = P.value;
416
441
  if (e === t) return [{
417
- value: Z(e),
418
- y: z(k.value.top + j.value / 2)
442
+ value: J(e),
443
+ y: R(k.value.top + j.value / 2)
419
444
  }];
420
- 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 = [];
421
446
  for (let n = i; n <= t; n += r) a.push({
422
- value: Z(n),
423
- 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)
424
449
  });
425
450
  return a;
426
- }), Be = t(() => {
427
- let e = P.value;
451
+ }), Ge = t(() => {
452
+ let e = N.value;
428
453
  if (e <= 1) return [];
429
454
  let t = u.xLabels;
430
455
  if (t && t.length === e) {
431
456
  let n = Math.max(3, Math.floor(A.value / 80)), r = Math.max(1, Math.round((e - 1) / n)), i = [];
432
457
  for (let n = 0; n < e; n += r) i.push({
433
458
  value: t[n],
434
- x: z(k.value.left + n / (e - 1) * A.value)
459
+ x: R(k.value.left + n / (e - 1) * A.value)
435
460
  });
436
461
  return i;
437
462
  }
438
- 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 = [];
439
464
  for (let t = 0; t <= e - 1; t += i) {
440
465
  let r = Math.round(t);
441
466
  a.push({
442
- value: Z(r + n),
443
- 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)
444
469
  });
445
470
  }
446
471
  return a;
447
472
  });
448
- function Ve() {
473
+ function Ke() {
449
474
  return u.filename ? u.filename : typeof u.menu == "string" ? u.menu : "chart";
450
475
  }
451
- function He() {
476
+ function qe() {
452
477
  return x.value;
453
478
  }
454
- function Ue() {
479
+ function Je() {
455
480
  if (typeof u.csv == "function") return u.csv();
456
481
  if (typeof u.csv == "string") return u.csv;
457
482
  let e = M.value;
458
483
  if (e.length === 0) return "";
459
- 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(",")];
460
485
  for (let r = 0; r < t; r++) {
461
486
  let t = [r.toString()];
462
487
  for (let n of e) t.push(r < n.data.length ? String(n.data[r]) : "");
@@ -464,21 +489,21 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
464
489
  }
465
490
  return n.join("\n");
466
491
  }
467
- let Q = h(null), We = h(!1), Ge = h(null), Ke = t(() => !!u.tooltipData || !!u.tooltipTrigger), qe = t(() => {
468
- if (Q.value === null) return 0;
469
- let e = P.value, t = A.value / (e - 1 || 1);
470
- return k.value.left + Q.value * t;
471
- }), Je = t(() => {
472
- 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;
473
498
  if (e === null) return [];
474
- 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;
475
500
  return M.value.filter((t) => e < t.data.length && isFinite(t.data[e])).map((n) => ({
476
- x: qe.value,
501
+ x: Qe.value,
477
502
  y: i - (n.data[e] - t) * r,
478
503
  color: n.color ?? "currentColor"
479
504
  }));
480
- }), $ = t(() => {
481
- let e = Q.value;
505
+ }), Q = t(() => {
506
+ let e = Y.value;
482
507
  return e === null ? null : {
483
508
  index: e,
484
509
  xLabel: u.xLabels?.[e],
@@ -490,68 +515,78 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
490
515
  data: u.tooltipData?.[e] ?? null
491
516
  };
492
517
  });
493
- function Ye(e) {
518
+ function et(e) {
494
519
  return "touches" in e ? e.touches[0] ?? null : e;
495
520
  }
496
- function Xe(e) {
521
+ function tt(e) {
497
522
  let t = b.value?.getBoundingClientRect();
498
523
  if (!t) return null;
499
- let n = P.value;
524
+ let n = N.value;
500
525
  if (n <= 1) return null;
501
526
  let r = e - t.left, i = A.value / (n - 1 || 1), a = (r - k.value.left) / i;
502
527
  return Math.round(Math.max(0, Math.min(n - 1, a)));
503
528
  }
504
- function Ze(e, t) {
505
- let n = Ge.value;
506
- if (!n) return;
507
- let r = b.value.getBoundingClientRect(), i = We.value ? Le : 0, a = e - r.left, o = Math.max(0, t - r.top - i);
508
- n.style.left = `${a + 16}px`, n.style.top = `${o}px`;
509
- }
510
- function Qe(e) {
511
- let t = Ye(e);
529
+ function $(e) {
530
+ let t = et(e);
512
531
  if (!t) return;
513
- let n = Xe(t.clientX);
514
- n !== null && (Q.value = n, Ze(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 }));
515
537
  }
516
- function $e(e) {
517
- Qe(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);
518
553
  }
519
- function et() {
520
- u.tooltipTrigger !== "click" && (Q.value = null, y("hover", null));
554
+ function rt() {
555
+ u.tooltipTrigger !== "click" && (Y.value = null, y("hover", null));
521
556
  }
522
- function tt(e) {
557
+ function it(e) {
523
558
  if (u.tooltipTrigger !== "click") return;
524
- let t = Ye(e);
559
+ let t = et(e);
525
560
  if (!t) return;
526
- let n = Xe(t.clientX);
527
- 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 }));
528
563
  }
529
- function nt(e) {
530
- We.value = !0, Qe(e);
564
+ function at(e) {
565
+ Ye.value = !0, $(e);
531
566
  }
532
- function rt(e) {
533
- Qe(e);
567
+ function ot(e) {
568
+ $(e);
534
569
  }
535
- function it() {
536
- We.value = !1, Q.value = null, y("hover", null);
570
+ function st() {
571
+ Ye.value = !1, Y.value = null, y("hover", null);
537
572
  }
538
- let at = t(() => u.downloadLink ? typeof u.downloadLink == "string" ? u.downloadLink : "Download data (CSV)" : null), ot = t(() => u.downloadLink ? `data:text/csv;charset=utf-8,${encodeURIComponent(Ue())}` : null), st = t(() => {
539
- let e = Ve(), 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 = [{
540
575
  label: "Save as SVG",
541
576
  action: () => {
542
- let t = He();
543
- t && ce(t, e);
577
+ let t = qe();
578
+ t && ue(t, e);
544
579
  }
545
580
  }, {
546
581
  label: "Save as PNG",
547
582
  action: () => {
548
- let t = He();
549
- t && le(t, e);
583
+ let t = qe();
584
+ t && de(t, e);
550
585
  }
551
586
  }];
552
587
  return u.downloadLink || t.push({
553
588
  label: "Download CSV",
554
- action: () => B(Ue(), e)
589
+ action: () => fe(Je(), e)
555
590
  }), t;
556
591
  });
557
592
  return (t, c) => (m(), i("div", {
@@ -559,15 +594,15 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
559
594
  ref: b,
560
595
  class: "line-chart-wrapper"
561
596
  }, [
562
- s.menu ? (m(), n(se, {
597
+ s.menu ? (m(), n(le, {
563
598
  key: 0,
564
- items: st.value
599
+ items: ut.value
565
600
  }, null, 8, ["items"])) : r("", !0),
566
601
  (m(), i("svg", {
567
602
  ref_key: "svgRef",
568
603
  ref: x,
569
604
  width: E.value,
570
- height: oe.value
605
+ height: ce.value
571
606
  }, [
572
607
  s.title ? (m(), i("text", {
573
608
  key: 0,
@@ -577,48 +612,48 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
577
612
  "font-size": "14",
578
613
  "font-weight": "600",
579
614
  fill: "currentColor"
580
- }, v(s.title), 9, de)) : r("", !0),
581
- I.value.length > 0 ? (m(), i("g", V, [(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", {
582
617
  key: 0,
583
618
  x1: k.value.left + n * 120,
584
- y1: k.value.top - J / 2,
619
+ y1: k.value.top - K / 2,
585
620
  x2: k.value.left + n * 120 + 12,
586
- y2: k.value.top - J / 2,
621
+ y2: k.value.top - K / 2,
587
622
  stroke: t.color,
588
623
  "stroke-width": "2",
589
624
  "stroke-dasharray": t.dashed ? "4 2" : void 0
590
- }, null, 8, fe)) : (m(), i("circle", {
625
+ }, null, 8, V)) : (m(), i("circle", {
591
626
  key: 1,
592
627
  cx: k.value.left + n * 120 + 4,
593
- cy: k.value.top - J / 2,
628
+ cy: k.value.top - K / 2,
594
629
  r: "4",
595
630
  fill: t.color,
596
631
  "fill-opacity": t.fillOpacity,
597
632
  stroke: t.color,
598
633
  "stroke-width": "1.5"
599
- }, null, 8, pe)), a("text", {
634
+ }, null, 8, H)), a("text", {
600
635
  x: k.value.left + n * 120 + 18,
601
- y: k.value.top - J / 2 + 4,
636
+ y: k.value.top - K / 2 + 4,
602
637
  "font-size": "11",
603
638
  fill: "currentColor"
604
- }, v(t.label), 9, H)], 64))), 128))])) : r("", !0),
639
+ }, v(t.label), 9, ge)], 64))), 128))])) : r("", !0),
605
640
  a("line", {
606
- x1: z(k.value.left),
607
- y1: z(k.value.top),
608
- x2: z(k.value.left),
609
- 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),
610
645
  stroke: "currentColor",
611
646
  "stroke-opacity": "0.3"
612
- }, null, 8, U),
647
+ }, null, 8, _e),
613
648
  a("line", {
614
- x1: z(k.value.left),
615
- y1: z(k.value.top + j.value),
616
- x2: z(k.value.left + A.value),
617
- 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),
618
653
  stroke: "currentColor",
619
654
  "stroke-opacity": "0.3"
620
- }, null, 8, me),
621
- s.yGrid ? (m(!0), i(e, { key: 2 }, g(ze.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", {
622
657
  key: "yg" + t,
623
658
  x1: k.value.left,
624
659
  y1: e.y,
@@ -626,8 +661,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
626
661
  y2: e.y,
627
662
  stroke: "currentColor",
628
663
  "stroke-opacity": "0.1"
629
- }, null, 8, he))), 128)) : r("", !0),
630
- s.xGrid ? (m(!0), i(e, { key: 3 }, g(Be.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", {
631
666
  key: "xg" + t,
632
667
  x1: e.x,
633
668
  y1: k.value.top,
@@ -635,8 +670,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
635
670
  y2: k.value.top + j.value,
636
671
  stroke: "currentColor",
637
672
  "stroke-opacity": "0.1"
638
- }, null, 8, ge))), 128)) : r("", !0),
639
- (m(!0), i(e, null, g(ze.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", {
640
675
  key: "y" + t,
641
676
  x: k.value.left - 6,
642
677
  y: e.y,
@@ -645,7 +680,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
645
680
  "font-size": "10",
646
681
  fill: "currentColor",
647
682
  "fill-opacity": "0.6"
648
- }, v(e.value), 9, _e))), 128)),
683
+ }, v(e.value), 9, xe))), 128)),
649
684
  s.yLabel ? (m(), i("text", {
650
685
  key: 4,
651
686
  x: 0,
@@ -654,8 +689,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
654
689
  "text-anchor": "middle",
655
690
  "font-size": "13",
656
691
  fill: "currentColor"
657
- }, v(s.yLabel), 9, ve)) : r("", !0),
658
- (m(!0), i(e, null, g(Be.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", {
659
694
  key: "x" + t,
660
695
  x: e.x,
661
696
  y: k.value.top + j.value + 16,
@@ -663,7 +698,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
663
698
  "font-size": "10",
664
699
  fill: "currentColor",
665
700
  "fill-opacity": "0.6"
666
- }, v(e.value), 9, ye))), 128)),
701
+ }, v(e.value), 9, U))), 128)),
667
702
  s.xLabel ? (m(), i("text", {
668
703
  key: 5,
669
704
  x: k.value.left + A.value / 2,
@@ -671,23 +706,23 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
671
706
  "text-anchor": "middle",
672
707
  "font-size": "13",
673
708
  fill: "currentColor"
674
- }, v(s.xLabel), 9, be)) : r("", !0),
675
- (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", {
676
711
  key: "area" + t,
677
- d: re(e.upper, e.lower),
712
+ d: ae(e.upper, e.lower),
678
713
  fill: e.color ?? "currentColor",
679
714
  "fill-opacity": e.opacity ?? .2,
680
715
  stroke: "none"
681
- }, null, 8, W))), 128)),
716
+ }, null, 8, Ce))), 128)),
682
717
  (m(!0), i(e, null, g(M.value, (t, n) => (m(), i(e, { key: n }, [t.line === !1 ? r("", !0) : (m(), i("path", {
683
718
  key: 0,
684
- d: te(t.data),
719
+ d: re(t.data),
685
720
  fill: "none",
686
721
  stroke: t.color ?? "currentColor",
687
722
  "stroke-width": t.strokeWidth ?? 1.5,
688
723
  "stroke-opacity": t.lineOpacity ?? t.opacity ?? s.lineOpacity,
689
724
  "stroke-dasharray": t.dashed ? "6 3" : void 0
690
- }, null, 8, G)), 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", {
691
726
  key: n,
692
727
  cx: e.x,
693
728
  cy: e.y,
@@ -695,68 +730,68 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
695
730
  fill: t.dotFill ?? t.color ?? "currentColor",
696
731
  "fill-opacity": t.dotOpacity ?? t.opacity ?? s.lineOpacity,
697
732
  stroke: t.dotStroke ?? "none"
698
- }, null, 8, xe))), 128)) : r("", !0)], 64))), 128)),
733
+ }, null, 8, Te))), 128)) : r("", !0)], 64))), 128)),
699
734
  (m(!0), i(e, null, g(s.areaSections ?? [], (t, n) => (m(), i(e, { key: "areasec" + n }, [
700
735
  a("path", {
701
- d: ie(t),
736
+ d: oe(t),
702
737
  fill: t.color ?? (t.seriesIndex == null ? "#999" : M.value[t.seriesIndex]?.color ?? "currentColor"),
703
738
  "fill-opacity": t.opacity ?? .15,
704
739
  stroke: "none"
705
- }, null, 8, Se),
740
+ }, null, 8, Ee),
706
741
  t.seriesIndex == null ? r("", !0) : (m(), i("path", {
707
742
  key: 0,
708
- d: ie(t, !1),
743
+ d: oe(t, !1),
709
744
  fill: "none",
710
745
  stroke: t.color ?? M.value[t.seriesIndex]?.color ?? "currentColor",
711
746
  "stroke-width": t.strokeWidth ?? 2,
712
747
  "stroke-dasharray": t.dashed ? "6 3" : void 0
713
- }, null, 8, Ce)),
748
+ }, null, 8, De)),
714
749
  t.seriesIndex == null ? (m(), i(e, { key: 1 }, [a("line", {
715
- 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))),
716
751
  y1: k.value.top,
717
- 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))),
718
753
  y2: k.value.top + j.value,
719
754
  stroke: t.color ?? "#999",
720
755
  "stroke-width": t.strokeWidth ?? 2,
721
756
  "stroke-dasharray": t.dashed ? "6 3" : void 0
722
- }, null, 8, we), a("line", {
723
- 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))),
724
759
  y1: k.value.top,
725
- 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))),
726
761
  y2: k.value.top + j.value,
727
762
  stroke: t.color ?? "#999",
728
763
  "stroke-width": t.strokeWidth ?? 2,
729
764
  "stroke-dasharray": t.dashed ? "6 3" : void 0
730
- }, null, 8, Te)], 64)) : r("", !0),
765
+ }, null, 8, G)], 64)) : r("", !0),
731
766
  a("line", {
732
- 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))),
733
768
  y1: k.value.top + j.value - 4,
734
- 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))),
735
770
  y2: k.value.top + j.value + 4,
736
771
  stroke: "currentColor",
737
772
  "stroke-opacity": "0.4"
738
- }, null, 8, Ee),
773
+ }, null, 8, ke),
739
774
  a("line", {
740
- 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))),
741
776
  y1: k.value.top + j.value - 4,
742
- 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))),
743
778
  y2: k.value.top + j.value + 4,
744
779
  stroke: "currentColor",
745
780
  "stroke-opacity": "0.4"
746
- }, null, 8, K)
781
+ }, null, 8, Ae)
747
782
  ], 64))), 128)),
748
- Ke.value && Q.value !== null ? (m(), i("line", {
783
+ Ze.value && Y.value !== null ? (m(), i("line", {
749
784
  key: 6,
750
- x1: z(qe.value),
785
+ x1: R(Qe.value),
751
786
  y1: k.value.top,
752
- x2: z(qe.value),
787
+ x2: R(Qe.value),
753
788
  y2: k.value.top + j.value,
754
789
  stroke: "currentColor",
755
790
  "stroke-opacity": "0.3",
756
791
  "stroke-dasharray": "4 2",
757
792
  "pointer-events": "none"
758
- }, null, 8, De)) : r("", !0),
759
- (m(!0), i(e, null, g(Je.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", {
760
795
  key: "hd" + t,
761
796
  cx: e.x,
762
797
  cy: e.y,
@@ -765,8 +800,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
765
800
  stroke: "var(--color-bg-0, #fff)",
766
801
  "stroke-width": "2",
767
802
  "pointer-events": "none"
768
- }, null, 8, Oe))), 128)),
769
- Ke.value ? (m(), i("rect", {
803
+ }, null, 8, Me))), 128)),
804
+ Ze.value ? (m(), i("rect", {
770
805
  key: 7,
771
806
  x: k.value.left,
772
807
  y: k.value.top,
@@ -777,66 +812,70 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
777
812
  cursor: "crosshair",
778
813
  "touch-action": "none"
779
814
  },
780
- onMousemove: $e,
781
- onMouseleave: et,
782
- onClick: tt,
783
- onTouchstart: w(nt, ["prevent"]),
784
- onTouchmove: w(rt, ["prevent"]),
785
- onTouchend: it
786
- }, null, 40, ke)) : r("", !0),
787
- (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 }, [
788
823
  a("circle", {
789
824
  cx: e.cx - e.textWidth / 2 - 2,
790
- cy: L.value + e.row * Y + 4,
825
+ cy: I.value + e.row * q + 4,
791
826
  r: "4",
792
827
  fill: e.color,
793
828
  "fill-opacity": e.fillOpacity,
794
829
  stroke: e.color,
795
830
  "stroke-width": "1.5"
796
- }, null, 8, Ae),
831
+ }, null, 8, Pe),
797
832
  e.labelText ? (m(), i("text", {
798
833
  key: 0,
799
834
  x: e.cx - e.textWidth / 2 + 8,
800
- y: L.value + e.row * Y + 8,
835
+ y: I.value + e.row * q + 8,
801
836
  "font-size": "11",
802
837
  "font-weight": "600",
803
838
  fill: e.color
804
- }, v(e.labelText), 9, je)) : r("", !0),
839
+ }, v(e.labelText), 9, Fe)) : r("", !0),
805
840
  e.descText ? (m(), i("text", {
806
841
  key: 1,
807
842
  x: e.cx - e.textWidth / 2 + 8,
808
- y: L.value + e.row * Y + 22,
843
+ y: I.value + e.row * q + 22,
809
844
  "font-size": "11",
810
845
  fill: "currentColor",
811
846
  "fill-opacity": "0.6"
812
- }, v(e.descText), 9, Me)) : r("", !0)
847
+ }, v(e.descText), 9, Ie)) : r("", !0)
813
848
  ]))), 128))
814
- ], 8, ue)),
815
- Ke.value && Q.value !== null && $.value ? (m(), i("div", {
849
+ ], 8, B)),
850
+ Ze.value && Y.value !== null && Q.value ? (m(), i("div", {
816
851
  key: 1,
817
852
  ref_key: "tooltipRef",
818
- ref: Ge,
853
+ ref: Xe,
819
854
  class: "chart-tooltip-content",
820
- style: {
855
+ style: f({
821
856
  position: "absolute",
822
- transform: "translateY(-50%)"
823
- }
824
- }, [_(t.$slots, "tooltip", d(l($.value)), () => [a("div", Ne, [$.value.xLabel ? (m(), i("div", q, 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", {
825
864
  key: e.seriesIndex,
826
865
  class: "line-chart-tooltip-row"
827
866
  }, [a("span", {
828
867
  class: "line-chart-tooltip-swatch",
829
868
  style: f({ background: e.color })
830
- }, null, 4), o(" " + v(isFinite(e.value) ? Z(e.value) : "—"), 1)]))), 128))])], !0)], 512)) : r("", !0),
831
- at.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", {
832
871
  key: 2,
833
872
  class: "line-chart-download-link",
834
- href: ot.value,
835
- download: `${Ve()}.csv`
836
- }, v(at.value), 9, Pe)) : r("", !0)
873
+ href: lt.value,
874
+ download: `${Ke()}.csv`
875
+ }, v(ct.value), 9, ze)) : r("", !0)
837
876
  ], 512));
838
877
  }
839
- }), [["__scopeId", "data-v-24787fb7"]]), Z = {
878
+ }), [["__scopeId", "data-v-eb7e46c4"]]), We = {
840
879
  "01013": "010259",
841
880
  "01015": "010177",
842
881
  "01029": "010177",
@@ -3997,7 +4036,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
3997
4036
  51019: "510014",
3998
4037
  "02158": "020820",
3999
4038
  46102: "460957"
4000
- }, ze = {
4039
+ }, Ge = {
4001
4040
  "010259": "Butler, AL",
4002
4041
  "010177": "Calhoun (Anniston), AL - Cleburne, AL",
4003
4042
  "010172": "Chambers, AL - Randolph, AL",
@@ -4947,25 +4986,25 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
4947
4986
  560775: "Teton, WY - Lincoln, WY",
4948
4987
  560792: "Uinta, WY",
4949
4988
  560804: "Weston, WY"
4950
- }, Be = ["width", "height"], Ve = [
4989
+ }, Ke = ["width", "height"], qe = [
4951
4990
  "data-feat-id",
4952
4991
  "d",
4953
4992
  "fill",
4954
4993
  "stroke",
4955
4994
  "stroke-width"
4956
- ], He = { key: 0 }, Ue = ["d", "stroke"], Q = ["transform"], We = {
4995
+ ], Je = { key: 0 }, Y = ["d", "stroke"], Ye = ["transform"], Xe = {
4957
4996
  key: 0,
4958
4997
  y: 5,
4959
4998
  "font-size": "13",
4960
4999
  "font-weight": "600",
4961
5000
  fill: "currentColor"
4962
- }, Ge = ["x", "fill"], Ke = ["x"], qe = {
5001
+ }, X = ["x", "fill"], Z = ["x"], Ze = {
4963
5002
  key: 0,
4964
5003
  y: 5,
4965
5004
  "font-size": "13",
4966
5005
  "font-weight": "600",
4967
5006
  fill: "currentColor"
4968
- }, Je = ["offset", "stop-color"], $ = ["x", "fill"], Ye = ["x"], Xe = ["x"], Ze = /* @__PURE__ */ R(/* @__PURE__ */ c({
5007
+ }, Qe = ["offset", "stop-color"], $e = ["x", "fill"], Q = ["x"], et = ["x"], tt = /* @__PURE__ */ I(/* @__PURE__ */ c({
4969
5008
  __name: "ChoroplethMap",
4970
5009
  props: {
4971
5010
  topology: {},
@@ -4996,84 +5035,85 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
4996
5035
  default: !1
4997
5036
  },
4998
5037
  tooltipTrigger: {},
4999
- tooltipFormat: {}
5038
+ tooltipFormat: {},
5039
+ tooltipClamp: { default: "chart" }
5000
5040
  },
5001
5041
  emits: ["stateClick", "stateHover"],
5002
5042
  setup(o, { emit: s }) {
5003
- 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;
5004
- function A() {
5005
- 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;
5006
5046
  let e = b.value;
5007
- e && (e.addEventListener("click", K), e.addEventListener("mouseover", K), e.addEventListener("mousemove", De), e.addEventListener("mouseout", Oe));
5047
+ e && (e.addEventListener("click", G), e.addEventListener("mouseover", G), e.addEventListener("mousemove", ke), e.addEventListener("mouseout", Ae));
5008
5048
  }
5009
- function j() {
5049
+ function A() {
5010
5050
  let e = b.value;
5011
- e && (e.removeEventListener("click", K), e.removeEventListener("mouseover", K), e.removeEventListener("mousemove", De), e.removeEventListener("mouseout", Oe));
5051
+ e && (e.removeEventListener("click", G), e.removeEventListener("mouseover", G), e.removeEventListener("mousemove", ke), e.removeEventListener("mouseout", Ae));
5012
5052
  }
5013
5053
  p(() => {
5014
- f.value && (C.value = f.value.clientWidth, O = new ResizeObserver((e) => {
5054
+ f.value && (S.value = f.value.clientWidth, D = new ResizeObserver((e) => {
5015
5055
  let t = e[0];
5016
- t && (C.value = t.contentRect.width);
5017
- }), O.observe(f.value)), M(), A();
5056
+ t && (S.value = t.contentRect.width);
5057
+ }), D.observe(f.value)), j(), k();
5018
5058
  }), ee(() => {
5019
- O?.disconnect(), N(), j(), we();
5059
+ D?.disconnect(), M(), A(), Ee();
5020
5060
  });
5021
- function M() {
5061
+ function j() {
5022
5062
  if (!_.value || !b.value || !c.zoom && !c.pan) return;
5023
- let e = ne(_.value);
5024
- k = te().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
5025
- E = !0, Ee();
5063
+ let e = re(_.value);
5064
+ O = P().scaleExtent(c.zoom ? [1, 12] : [1, 1]).on("start", () => {
5065
+ T = !0, Oe();
5026
5066
  }).on("zoom", (e) => {
5027
5067
  b.value && b.value.setAttribute("transform", e.transform);
5028
5068
  }).on("end", () => {
5029
- E = !1;
5030
- }), 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);
5031
5071
  }
5032
- function N() {
5033
- _.value && k && (ne(_.value).on(".zoom", null), k = null);
5072
+ function M() {
5073
+ _.value && O && (re(_.value).on(".zoom", null), O = null);
5034
5074
  }
5035
- S(() => [c.zoom, c.pan], () => {
5036
- N(), j(), M(), A();
5075
+ te(() => [c.zoom, c.pan], () => {
5076
+ M(), A(), j(), k();
5037
5077
  });
5038
- 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(() => {
5039
5079
  let e = y(c.topology), t = e.objects.counties.geometries, n = /* @__PURE__ */ new Map();
5040
5080
  for (let e of t) {
5041
- let t = Z[String(e.id).padStart(5, "0")];
5081
+ let t = We[String(e.id).padStart(5, "0")];
5042
5082
  t && (n.has(t) || n.set(t, []), n.get(t).push(e));
5043
5083
  }
5044
5084
  let r = [];
5045
5085
  for (let [t, i] of n) r.push({
5046
5086
  type: "Feature",
5047
5087
  id: t,
5048
- properties: { name: ze[t] ?? t },
5049
- geometry: ie(e, i)
5088
+ properties: { name: Ge[t] ?? t },
5089
+ geometry: ae(e, i)
5050
5090
  });
5051
5091
  return {
5052
5092
  type: "FeatureCollection",
5053
5093
  features: r
5054
5094
  };
5055
- }), z = t(() => {
5056
- if (c.geoType === "hsas") return R.value;
5095
+ }), L = t(() => {
5096
+ if (c.geoType === "hsas") return I.value;
5057
5097
  if (c.geoType === "counties") {
5058
5098
  let e = y(c.topology);
5059
- return re(e, e.objects.counties);
5099
+ return ie(e, e.objects.counties);
5060
5100
  }
5061
5101
  let e = y(c.topology);
5062
- return re(e, e.objects.states);
5063
- }), B = t(() => {
5102
+ return ie(e, e.objects.states);
5103
+ }), fe = t(() => {
5064
5104
  if (c.geoType !== "counties" && c.geoType !== "hsas") return null;
5065
5105
  let e = y(c.topology);
5066
- return ae(e, e.objects.states, (e, t) => e !== t);
5067
- }), ue = t(() => P().fitExtent([[0, q.value], [I.value, L.value + q.value]], z.value)), de = t(() => F(ue.value)), V = t(() => c.geoType === "counties" || c.geoType === "hsas" ? c.strokeWidth * .5 : c.strokeWidth), fe = 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(() => {
5068
5108
  let e = /* @__PURE__ */ new Map();
5069
5109
  if (!c.data) return e;
5070
5110
  for (let t of c.data) {
5071
5111
  e.set(t.id, t.value);
5072
- 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);
5073
5113
  n?.id != null && e.set(String(n.id), t.value);
5074
5114
  }
5075
5115
  return e;
5076
- }), pe = t(() => {
5116
+ }), he = t(() => {
5077
5117
  if (!c.data || c.data.length === 0) return {
5078
5118
  min: 0,
5079
5119
  max: 1
@@ -5090,8 +5130,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5090
5130
  min: 0,
5091
5131
  max: 1
5092
5132
  };
5093
- }), H = t(() => Array.isArray(c.colorScale) && c.colorScale.length > 0 && "value" in c.colorScale[0]), U = t(() => Array.isArray(c.colorScale) && !H.value), me = t(() => U.value ? "" : c.colorScale?.min ?? "#e5f0fa"), he = t(() => U.value ? "" : c.colorScale?.max ?? "#08519c");
5094
- function ge(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) {
5095
5135
  let t = e.replace("#", "");
5096
5136
  return [
5097
5137
  parseInt(t.slice(0, 2), 16),
@@ -5099,101 +5139,103 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5099
5139
  parseInt(t.slice(4, 6), 16)
5100
5140
  ];
5101
5141
  }
5102
- function _e(e) {
5103
- let [t, n, r] = ge(me.value), [i, a, o] = ge(he.value);
5142
+ function ye(e) {
5143
+ let [t, n, r] = ve(ge.value), [i, a, o] = ve(_e.value);
5104
5144
  return `rgb(${Math.round(t + (i - t) * e)},${Math.round(n + (a - n) * e)},${Math.round(r + (o - r) * e)})`;
5105
5145
  }
5106
- function ve(e) {
5146
+ function be(e) {
5107
5147
  let t = c.colorScale.slice().sort((e, t) => t.min - e.min);
5108
5148
  for (let n of t) if (e >= n.min) return n.color;
5109
5149
  return c.noDataColor;
5110
5150
  }
5111
- function ye(e) {
5151
+ function xe(e) {
5112
5152
  let t = c.colorScale.find((t) => t.value === String(e));
5113
5153
  return t ? t.color : c.noDataColor;
5114
5154
  }
5115
- function be(e) {
5116
- let t = fe.value.get(String(e));
5155
+ function Se(e) {
5156
+ let t = me.value.get(String(e));
5117
5157
  if (t == null) return c.noDataColor;
5118
- if (H.value) return ye(t);
5119
- if (U.value) return ve(t);
5120
- let { min: n, max: r } = pe.value;
5121
- return _e((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));
5122
5162
  }
5123
- function W(e) {
5163
+ function U(e) {
5124
5164
  return e.properties?.name ?? String(e.id);
5125
5165
  }
5126
- function G(e) {
5127
- return fe.value.get(String(e.id));
5166
+ function W(e) {
5167
+ return me.value.get(String(e.id));
5128
5168
  }
5129
- let xe = t(() => {
5169
+ let Ce = t(() => {
5130
5170
  let e = /* @__PURE__ */ new Map();
5131
- 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);
5132
5172
  return e;
5133
5173
  });
5134
- function Se(e) {
5174
+ function we(e) {
5135
5175
  let t = e;
5136
5176
  for (; t && !t.dataset?.featId;) t = t.parentElement;
5137
5177
  if (!t) return null;
5138
- let n = xe.value.get(t.dataset.featId);
5178
+ let n = Ce.value.get(t.dataset.featId);
5139
5179
  return n ? {
5140
5180
  pathEl: t,
5141
5181
  feat: n
5142
5182
  } : null;
5143
5183
  }
5144
- function Ce(e, t, n) {
5145
- T || (T = document.createElement("div"), T.className = "chart-tooltip-content", T.style.position = "fixed", T.style.transform = "translateY(-50%)", document.body.appendChild(T));
5146
- let r = W(e), i = G(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 = {
5147
5187
  id: String(e.id),
5148
5188
  name: r,
5149
5189
  value: i
5150
5190
  };
5151
- c.tooltipFormat ? T.innerHTML = c.tooltipFormat(a) : T.textContent = i == null ? r : `${r}: ${i}`, T.style.left = `${t + 16}px`, T.style.top = `${n}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`;
5152
5194
  }
5153
- function we() {
5154
- T &&= (T.remove(), null);
5195
+ function Ee() {
5196
+ w &&= (w.remove(), null);
5155
5197
  }
5156
- function Te(e, t) {
5157
- w && w !== e && (w.setAttribute("stroke-width", String(V.value)), w.setAttribute("stroke", c.strokeColor)), w = e, e.parentNode?.appendChild(e), e.setAttribute("stroke-width", String(V.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");
5158
5200
  }
5159
- function Ee() {
5160
- w && (w.setAttribute("stroke-width", String(V.value)), w.setAttribute("stroke", c.strokeColor), w = null, l("stateHover", null)), we();
5201
+ function Oe() {
5202
+ C && (C.setAttribute("stroke-width", String(B.value)), C.setAttribute("stroke", c.strokeColor), C = null, l("stateHover", null)), Ee();
5161
5203
  }
5162
- function K(e) {
5163
- if (E) return;
5164
- let t = e, n = Se(t.target);
5204
+ function G(e) {
5205
+ if (T) return;
5206
+ let t = e, n = we(t.target);
5165
5207
  n && (e.type === "click" ? l("stateClick", {
5166
5208
  id: String(n.feat.id),
5167
- name: W(n.feat),
5168
- value: G(n.feat)
5169
- }) : e.type === "mouseover" && (Te(n.pathEl, n.feat), c.tooltipTrigger && Ce(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", {
5170
5212
  id: String(n.feat.id),
5171
- name: W(n.feat),
5172
- value: G(n.feat)
5213
+ name: U(n.feat),
5214
+ value: W(n.feat)
5173
5215
  })));
5174
5216
  }
5175
- function De(e) {
5176
- 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`);
5177
5219
  }
5178
- function Oe(e) {
5220
+ function Ae(e) {
5179
5221
  let t = e.relatedTarget;
5180
- t && b.value?.contains(t) || Ee();
5222
+ t && b.value?.contains(t) || Oe();
5181
5223
  }
5182
- function ke() {
5224
+ function je() {
5183
5225
  return typeof c.menu == "string" ? c.menu : "choropleth";
5184
5226
  }
5185
- let Ae = t(() => c.legend && (H.value || U.value || c.data)), je = t(() => c.colorScale.slice().sort((e, t) => e.min - t.min)), Me = t(() => c.title ? 24 : 0), Ne = t(() => Ae.value ? 28 : 0), q = t(() => Me.value + Ne.value), Pe = t(() => L.value + q.value), J = t(() => Me.value + 18), Y = 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(() => {
5186
5228
  let e = [];
5187
5229
  for (let t = 0; t <= 10; t++) {
5188
5230
  let n = t / 10;
5189
5231
  e.push({
5190
5232
  offset: `${(n * 100).toFixed(0)}%`,
5191
- color: _e(n)
5233
+ color: ye(n)
5192
5234
  });
5193
5235
  }
5194
5236
  return e;
5195
- }), Fe = t(() => {
5196
- let { min: e, max: t } = pe.value, n = t - e, r = [];
5237
+ }), K = t(() => {
5238
+ let { min: e, max: t } = he.value, n = t - e, r = [];
5197
5239
  for (let t = 1; t <= 3; t++) {
5198
5240
  let i = t / 4, a = e + n * i, o = Number.isInteger(a) ? String(a) : a.toFixed(1).replace(/\.0$/, "");
5199
5241
  r.push({
@@ -5202,44 +5244,44 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5202
5244
  });
5203
5245
  }
5204
5246
  return r;
5205
- }), X = t(() => {
5247
+ }), q = t(() => {
5206
5248
  let e = [];
5207
- if (H.value) for (let t of c.colorScale) e.push({
5249
+ if (V.value) for (let t of c.colorScale) e.push({
5208
5250
  key: t.value,
5209
5251
  color: t.color,
5210
5252
  label: t.value
5211
5253
  });
5212
- else if (U.value) for (let t of je.value) e.push({
5254
+ else if (H.value) for (let t of Ne.value) e.push({
5213
5255
  key: String(t.min),
5214
5256
  color: t.color,
5215
5257
  label: t.label ?? String(t.min)
5216
5258
  });
5217
5259
  return e;
5218
- }), Ie = t(() => {
5260
+ }), Be = t(() => {
5219
5261
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5220
- for (let t of X.value) e += 16 + t.label.length * 7 + 12;
5221
- return e - (X.value.length > 0 ? 12 : 0);
5222
- }), 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(() => {
5223
5265
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5224
- return X.value.map((t) => {
5266
+ return q.value.map((t) => {
5225
5267
  let n = e;
5226
5268
  return e += 16 + t.label.length * 7 + 12, n;
5227
5269
  });
5228
- }), Re = t(() => {
5229
- if (H.value || U.value) return (I.value - Ie.value) / 2;
5270
+ }), He = t(() => {
5271
+ if (V.value || H.value) return (F.value - Be.value) / 2;
5230
5272
  let e = c.legendTitle ? c.legendTitle.length * 8 + 12 : 0;
5231
- return (I.value - e - 160) / 2;
5232
- }), Ze = t(() => {
5233
- let e = ke();
5273
+ return (F.value - e - 160) / 2;
5274
+ }), Ue = t(() => {
5275
+ let e = je();
5234
5276
  return [{
5235
5277
  label: "Save as SVG",
5236
5278
  action: () => {
5237
- _.value && ce(_.value, e);
5279
+ _.value && ue(_.value, e);
5238
5280
  }
5239
5281
  }, {
5240
5282
  label: "Save as PNG",
5241
5283
  action: () => {
5242
- _.value && le(_.value, e);
5284
+ _.value && de(_.value, e);
5243
5285
  }
5244
5286
  }];
5245
5287
  });
@@ -5247,64 +5289,64 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5247
5289
  ref_key: "containerRef",
5248
5290
  ref: f,
5249
5291
  class: u(["choropleth-wrapper", { pannable: o.pan }])
5250
- }, [o.menu ? (m(), n(se, {
5292
+ }, [o.menu ? (m(), n(le, {
5251
5293
  key: 0,
5252
- items: Ze.value
5294
+ items: Ue.value
5253
5295
  }, null, 8, ["items"])) : r("", !0), (m(), i("svg", {
5254
5296
  ref_key: "svgRef",
5255
5297
  ref: _,
5256
- width: I.value,
5257
- height: Pe.value
5298
+ width: F.value,
5299
+ height: Le.value
5258
5300
  }, [
5259
5301
  a("g", {
5260
5302
  ref_key: "mapGroupRef",
5261
5303
  ref: b
5262
- }, [(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", {
5263
5305
  key: String(e.id),
5264
5306
  "data-feat-id": String(e.id),
5265
- d: de.value(e) ?? void 0,
5266
- fill: be(e.id),
5307
+ d: z.value(e) ?? void 0,
5308
+ fill: Se(e.id),
5267
5309
  stroke: o.strokeColor,
5268
- "stroke-width": V.value,
5310
+ "stroke-width": B.value,
5269
5311
  class: "state-path"
5270
- }, [o.tooltipTrigger ? r("", !0) : (m(), i("title", He, v(W(e)) + v(G(e) == null ? "" : `: ${G(e)}`), 1))], 8, Ve))), 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", {
5271
5313
  key: 0,
5272
- d: de.value(B.value) ?? void 0,
5314
+ d: z.value(fe.value) ?? void 0,
5273
5315
  fill: "none",
5274
5316
  stroke: o.strokeColor,
5275
5317
  "stroke-width": 1,
5276
5318
  "stroke-linejoin": "round",
5277
5319
  "pointer-events": "none"
5278
- }, null, 8, Ue)) : r("", !0)], 512),
5279
- Ae.value ? (m(), i("g", {
5320
+ }, null, 8, Y)) : r("", !0)], 512),
5321
+ Me.value ? (m(), i("g", {
5280
5322
  key: 0,
5281
5323
  class: "choropleth-legend",
5282
- transform: `translate(${Re.value},${J.value})`
5283
- }, [H.value || U.value ? (m(), i(e, { key: 0 }, [o.legendTitle ? (m(), i("text", We, v(o.legendTitle), 1)) : r("", !0), (m(!0), i(e, null, g(X.value, (t, n) => (m(), i(e, { key: t.key }, [a("rect", {
5284
- 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],
5285
5327
  y: -5,
5286
5328
  width: "12",
5287
5329
  height: "12",
5288
5330
  rx: "3",
5289
5331
  fill: t.color
5290
- }, null, 8, Ge), a("text", {
5291
- x: Le.value[n] + 16,
5332
+ }, null, 8, X), a("text", {
5333
+ x: Ve.value[n] + 16,
5292
5334
  y: 5,
5293
5335
  "font-size": "13",
5294
5336
  fill: "currentColor"
5295
- }, v(t.label), 9, Ke)], 64))), 128))], 64)) : (m(), i(e, { key: 1 }, [
5296
- o.legendTitle ? (m(), i("text", qe, 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),
5297
5339
  a("defs", null, [a("linearGradient", {
5298
5340
  id: d,
5299
5341
  x1: "0",
5300
5342
  x2: "1",
5301
5343
  y1: "0",
5302
5344
  y2: "0"
5303
- }, [(m(!0), i(e, null, g(Y.value, (e) => (m(), i("stop", {
5345
+ }, [(m(!0), i(e, null, g(ze.value, (e) => (m(), i("stop", {
5304
5346
  key: e.offset,
5305
5347
  offset: e.offset,
5306
5348
  "stop-color": e.color
5307
- }, null, 8, Je))), 128))])]),
5349
+ }, null, 8, Qe))), 128))])]),
5308
5350
  a("rect", {
5309
5351
  x: o.legendTitle ? o.legendTitle.length * 8 + 12 : 0,
5310
5352
  y: -6,
@@ -5312,8 +5354,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5312
5354
  height: 12,
5313
5355
  rx: "2",
5314
5356
  fill: `url(#${d})`
5315
- }, null, 8, $),
5316
- (m(!0), i(e, null, g(Fe.value, (e) => (m(), i("text", {
5357
+ }, null, 8, $e),
5358
+ (m(!0), i(e, null, g(K.value, (e) => (m(), i("text", {
5317
5359
  key: e.value,
5318
5360
  x: (o.legendTitle ? o.legendTitle.length * 8 + 12 : 0) + e.pct / 100 * 160,
5319
5361
  y: 20,
@@ -5321,20 +5363,20 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5321
5363
  fill: "currentColor",
5322
5364
  opacity: "0.7",
5323
5365
  "text-anchor": "middle"
5324
- }, v(e.value), 9, Ye))), 128))
5325
- ], 64))], 8, Q)) : r("", !0),
5366
+ }, v(e.value), 9, Q))), 128))
5367
+ ], 64))], 8, Ye)) : r("", !0),
5326
5368
  o.title ? (m(), i("text", {
5327
5369
  key: 1,
5328
- x: I.value / 2,
5370
+ x: F.value / 2,
5329
5371
  y: 18,
5330
5372
  "text-anchor": "middle",
5331
5373
  "font-size": "14",
5332
5374
  "font-weight": "600",
5333
5375
  fill: "currentColor"
5334
- }, v(o.title), 9, Xe)) : r("", !0)
5335
- ], 8, Be))], 2));
5376
+ }, v(o.title), 9, et)) : r("", !0)
5377
+ ], 8, Ke))], 2));
5336
5378
  }
5337
- }), [["__scopeId", "data-v-ffaf1671"]]), Qe = /* @__PURE__ */ R(/* @__PURE__ */ c({
5379
+ }), [["__scopeId", "data-v-25a20d5b"]]), $ = /* @__PURE__ */ I(/* @__PURE__ */ c({
5338
5380
  __name: "ChartTooltip",
5339
5381
  props: {
5340
5382
  x: {},
@@ -5354,12 +5396,12 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5354
5396
  top: `${e.y}px`,
5355
5397
  transform: "translateY(-50%)"
5356
5398
  })
5357
- }, [_(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), {
5358
5400
  key: 1,
5359
5401
  open: e.open
5360
5402
  }, {
5361
- default: C(() => [s(b(A), { "as-child": "" }, {
5362
- default: C(() => [a("div", {
5403
+ default: S(() => [s(b(k), { "as-child": "" }, {
5404
+ default: S(() => [a("div", {
5363
5405
  class: "chart-tooltip-anchor",
5364
5406
  style: f({
5365
5407
  left: `${e.x}px`,
@@ -5367,8 +5409,8 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5367
5409
  })
5368
5410
  }, null, 4)]),
5369
5411
  _: 1
5370
- }), s(b(M), null, {
5371
- default: C(() => [e.open ? (m(), n(b(j), {
5412
+ }), s(b(j), null, {
5413
+ default: S(() => [e.open ? (m(), n(b(A), {
5372
5414
  key: 0,
5373
5415
  class: "chart-tooltip-content",
5374
5416
  side: "right",
@@ -5377,7 +5419,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5377
5419
  onPointerDownOutside: o[0] ||= (e) => t.$emit("close"),
5378
5420
  onEscapeKeyDown: o[1] ||= (e) => t.$emit("close")
5379
5421
  }, {
5380
- default: C(() => [_(t.$slots, "default", {}, void 0, !0)]),
5422
+ default: S(() => [_(t.$slots, "default", {}, void 0, !0)]),
5381
5423
  _: 3
5382
5424
  }, 8, ["side-offset"])) : r("", !0)]),
5383
5425
  _: 3
@@ -5385,7 +5427,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5385
5427
  _: 3
5386
5428
  }, 8, ["open"])) : r("", !0);
5387
5429
  }
5388
- }), [["__scopeId", "data-v-44377f70"]]), $e = { class: "TableWrapper" }, et = { class: "Table" }, tt = ["href", "download"], nt = /* @__PURE__ */ R(/* @__PURE__ */ c({
5430
+ }), [["__scopeId", "data-v-44377f70"]]), nt = { class: "TableWrapper" }, rt = { class: "Table" }, it = ["href", "download"], at = /* @__PURE__ */ I(/* @__PURE__ */ c({
5389
5431
  __name: "DataTable",
5390
5432
  props: {
5391
5433
  data: {},
@@ -5451,7 +5493,7 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5451
5493
  function x(e) {
5452
5494
  return e.includes(",") || e.includes("\"") || e.includes("\n") ? `"${e.replace(/"/g, "\"\"")}"` : e;
5453
5495
  }
5454
- function S() {
5496
+ function te() {
5455
5497
  if (typeof c.csv == "function") return c.csv();
5456
5498
  if (typeof c.csv == "string") return c.csv;
5457
5499
  let e = h.value, t = _.value, n = [e.map((e) => x(l(e.name))).join(",")];
@@ -5461,16 +5503,16 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5461
5503
  }
5462
5504
  return n.join("\n");
5463
5505
  }
5464
- let C = t(() => c.downloadLink ? [] : [{
5506
+ let S = t(() => c.downloadLink ? [] : [{
5465
5507
  label: "Download CSV",
5466
- action: () => B(S(), b())
5467
- }]), 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);
5468
- return (t, s) => (m(), i("div", { class: u(["TableOuter", { "has-menu": E.value }]) }, [
5469
- 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, {
5470
5512
  key: 0,
5471
- items: C.value
5513
+ items: S.value
5472
5514
  }, null, 8, ["items"])) : r("", !0),
5473
- a("div", $e, [a("table", et, [
5515
+ a("div", nt, [a("table", rt, [
5474
5516
  a("colgroup", null, [(m(!0), i(e, null, g(h.value, (e) => (m(), i("col", {
5475
5517
  key: e.name,
5476
5518
  style: f(d(e.name))
@@ -5485,14 +5527,14 @@ var ue = ["width", "height"], de = ["x"], V = { key: 1 }, fe = [
5485
5527
  style: f(p(e.name))
5486
5528
  }, v(y(e, t - 1)), 7))), 128))]))), 128))])
5487
5529
  ])]),
5488
- w.value ? (m(), i("a", {
5530
+ C.value ? (m(), i("a", {
5489
5531
  key: 1,
5490
5532
  class: "data-table-download-link",
5491
- href: T.value,
5533
+ href: w.value,
5492
5534
  download: `${b()}.csv`
5493
- }, v(w.value), 9, tt)) : r("", !0)
5535
+ }, v(C.value), 9, it)) : r("", !0)
5494
5536
  ], 2));
5495
5537
  }
5496
5538
  }), [["__scopeId", "data-v-505e2187"]]);
5497
5539
  //#endregion
5498
- export { Qe as ChartTooltip, Ze as ChoroplethMap, nt as DataTable, Re as LineChart };
5540
+ export { $ as ChartTooltip, tt as ChoroplethMap, at as DataTable, J as LineChart };