enefit-design-system 0.6.2-alpha.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +7 -1
  2. package/dist/Accordion/Accordion.js +3 -3
  3. package/dist/Autocomplete/Autocomplete.js +3 -3
  4. package/dist/Badge/Badge.js +3 -3
  5. package/dist/Calendar/CalendarHeader.js +3 -3
  6. package/dist/Calendar/Day/CalendarCell.js +3 -3
  7. package/dist/Calendar/Day/CalendarGrid.js +3 -3
  8. package/dist/Calendar/Month/MonthCell.js +3 -3
  9. package/dist/Calendar/Year/YearCell.js +3 -3
  10. package/dist/Chart/Chart.js +150 -126
  11. package/dist/Chart/ChartArea.js +17 -15
  12. package/dist/Chart/ChartAxes.js +74 -0
  13. package/dist/Chart/ChartBar.js +42 -42
  14. package/dist/Chart/ChartLine.js +33 -32
  15. package/dist/Chart/ChartTooltip.js +61 -47
  16. package/dist/Chart/axes.js +66 -0
  17. package/dist/Chart/curve.js +37 -30
  18. package/dist/Chart/utils.js +53 -46
  19. package/dist/Checkbox/Checkbox.js +3 -3
  20. package/dist/CheckboxGroup/CheckboxGroup.js +3 -3
  21. package/dist/Choice/Choice.js +3 -3
  22. package/dist/ChoiceCard/ChoiceCard.js +3 -3
  23. package/dist/DatePicker/DatePicker.js +3 -3
  24. package/dist/DatePicker/DatePickerSegment.js +3 -3
  25. package/dist/InfoHint/InfoHint.js +3 -3
  26. package/dist/Modal/ModalDialog.js +3 -3
  27. package/dist/Notification/Notification.js +3 -3
  28. package/dist/Notification/NotificationDescription.js +3 -3
  29. package/dist/Notification/NotificationTitle.js +3 -3
  30. package/dist/Phone/Phone.js +3 -3
  31. package/dist/Phone/PhoneSelect.js +3 -3
  32. package/dist/Phone/PhoneTrigger.js +3 -3
  33. package/dist/Radio/Radio.js +3 -3
  34. package/dist/RadioGroup/RadioGroup.js +3 -3
  35. package/dist/Searchfield/Searchfield.js +3 -3
  36. package/dist/Select/Select.js +3 -3
  37. package/dist/Select/SelectListOption.js +3 -3
  38. package/dist/Slider/Slider.js +3 -3
  39. package/dist/Slider/SliderThumb.js +3 -3
  40. package/dist/Switch/Switch.js +3 -3
  41. package/dist/SwitchGroup/SwitchGroup.js +3 -3
  42. package/dist/Tab/Tab.js +3 -3
  43. package/dist/Table/TableCell.js +3 -3
  44. package/dist/Table/TableFooterCell.js +3 -3
  45. package/dist/Table/TableHeaderCell.js +3 -3
  46. package/dist/Textarea/Textarea.js +3 -3
  47. package/dist/Textfield/Textfield.js +3 -3
  48. package/dist/Toast/Toast.js +3 -3
  49. package/dist/_virtual/index3.js +2 -2
  50. package/dist/_virtual/index4.js +2 -2
  51. package/dist/external/prop-types/index.js +1 -1
  52. package/dist/external/recharts/es6/context/chartLayoutContext.js +3 -3
  53. package/dist/external/use-sync-external-store/shim/index.js +1 -1
  54. package/dist/index.d.ts +13 -11
  55. package/dist/index.js +1717 -1713
  56. package/dist/llms.txt +2143 -294
  57. package/dist/output/icons/IconCompareSm.js +15 -0
  58. package/dist/output/icons/IconRefreshXs.js +15 -0
  59. package/dist/styles.css +1 -1
  60. package/package.json +1 -2
  61. package/dist/Chart/ChartAxis.js +0 -66
  62. package/dist/Chart/ticks.js +0 -74
  63. /package/dist/{breakpoints2.css → breakpoints.css} +0 -0
  64. /package/dist/output/{variables2/tailwind2.json.js → variables/tailwind.json.js} +0 -0
@@ -1,83 +1,83 @@
1
- import { j as a } from "../external/react/jsx-runtime.js";
2
- import { getYDataKeys as l, getName as B, getChartHide as b, getColor as o, getYDataKey as x, getBarRadius as p } from "./utils.js";
1
+ import { j as t } from "../external/react/jsx-runtime.js";
2
+ import { getYDataKeys as l, getName as b, getChartHide as x, getColor as a, getYAxisId as A, getBarRadius as c } from "./utils.js";
3
3
  import C from "./ChartAnnotation.js";
4
- import { Bar as A } from "../external/recharts/es6/cartesian/Bar.js";
5
- import { Cell as $ } from "../external/recharts/es6/component/Cell.js";
6
- import { Rectangle as c } from "../external/recharts/es6/shape/Rectangle.js";
7
- function D({
4
+ import { Bar as $ } from "../external/recharts/es6/cartesian/Bar.js";
5
+ import { Cell as F } from "../external/recharts/es6/component/Cell.js";
6
+ import { Rectangle as p } from "../external/recharts/es6/shape/Rectangle.js";
7
+ function W({
8
8
  settings: h,
9
9
  dataset: r,
10
10
  data: u,
11
11
  index: s,
12
- active: e = !1
12
+ active: e = !1,
13
+ stack: j = !1
13
14
  }) {
14
- const n = u || [];
15
- return /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
16
- l(r).map((m, i) => /* @__PURE__ */ a.jsx(
17
- A,
15
+ const f = u || [];
16
+ return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
17
+ l(r).map((m, o) => /* @__PURE__ */ t.jsx(
18
+ $,
18
19
  {
19
- id: `${s}-${i}`,
20
+ id: `${s}-${o}`,
20
21
  dataKey: m,
21
- yAxisId: x(r),
22
- stroke: e ? o(r, i).barStrokeFade : o(r, i).barStroke,
22
+ yAxisId: A(r),
23
+ stroke: e ? a(r, o).barStrokeFade : a(r, o).barStroke,
23
24
  strokeWidth: 1,
24
- fill: e ? o(r, i).barBgFade : o(r, i).barBg,
25
+ fill: e ? a(r, o).barBgFade : a(r, o).barBg,
25
26
  isAnimationActive: !1,
26
- hide: b(r),
27
- name: B(r, i),
27
+ hide: x(r),
28
+ name: b(r, o),
28
29
  unit: r.unit,
29
- shape: (t) => /* @__PURE__ */ a.jsx(
30
- c,
30
+ shape: (i) => /* @__PURE__ */ t.jsx(
31
+ p,
31
32
  {
32
- ...t,
33
- radius: p(
33
+ ...i,
34
+ radius: c(
34
35
  l(r),
35
36
  m,
36
- t.payload
37
+ i.payload
37
38
  )
38
39
  }
39
40
  ),
40
- activeBar: (t) => /* @__PURE__ */ a.jsx(
41
- c,
41
+ activeBar: (i) => /* @__PURE__ */ t.jsx(
42
+ p,
42
43
  {
43
- ...t,
44
- stroke: o(r, i).barStroke,
44
+ ...i,
45
+ stroke: a(r, o).barStroke,
45
46
  strokeWidth: 1,
46
- fill: o(r, i).barBg,
47
- radius: p(
47
+ fill: a(r, o).barBg,
48
+ radius: c(
48
49
  l(r),
49
50
  m,
50
- t.payload
51
+ i.payload
51
52
  )
52
53
  }
53
54
  ),
54
- style: { transform: "translateY(-1px)" },
55
- stackId: "stack",
56
- children: n.map((t, j) => {
57
- var f, g;
58
- return /* @__PURE__ */ a.jsx(
59
- $,
55
+ stackId: j ? `stack-${s}` : void 0,
56
+ children: f.map((i, B) => {
57
+ var g, n;
58
+ return /* @__PURE__ */ t.jsx(
59
+ F,
60
60
  {
61
- className: (f = t == null ? void 0 : t._settings) == null ? void 0 : f.className,
62
- style: (g = t == null ? void 0 : t._settings) == null ? void 0 : g.style
61
+ className: (g = i == null ? void 0 : i._settings) == null ? void 0 : g.className,
62
+ style: (n = i == null ? void 0 : i._settings) == null ? void 0 : n.style
63
63
  },
64
- j
64
+ B
65
65
  );
66
66
  })
67
67
  },
68
- `${s}-${i}`
68
+ `${s}-${o}`
69
69
  )),
70
- /* @__PURE__ */ a.jsx(
70
+ /* @__PURE__ */ t.jsx(
71
71
  C,
72
72
  {
73
73
  settings: h,
74
74
  dataset: r,
75
- data: n,
75
+ data: f,
76
76
  index: s
77
77
  }
78
78
  )
79
79
  ] });
80
80
  }
81
81
  export {
82
- D as default
82
+ W as default
83
83
  };
@@ -1,47 +1,48 @@
1
- import { j as i } from "../external/react/jsx-runtime.js";
2
- import { getName as a, getChartHide as u, getColor as l, getYDataKey as o } from "./utils.js";
3
- import f from "./ChartAnnotation.js";
4
- import { Line as x } from "../external/recharts/es6/cartesian/Line.js";
5
- function h({
6
- settings: n,
7
- dataset: r,
8
- data: t,
9
- curve: m = "linear",
10
- index: e
1
+ import { j as r } from "../external/react/jsx-runtime.js";
2
+ import { getYDataKeys as s, getName as u, getChartHide as f, getColor as p, getYAxisId as x } from "./utils.js";
3
+ import d from "./ChartAnnotation.js";
4
+ import { Line as c } from "../external/recharts/es6/cartesian/Line.js";
5
+ function C({
6
+ settings: t,
7
+ dataset: i,
8
+ data: m,
9
+ curve: a = "linear",
10
+ index: o,
11
+ active: l
11
12
  }) {
12
- return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
13
- /* @__PURE__ */ i.jsx(
14
- x,
13
+ return /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
14
+ s(i).map((e, n) => /* @__PURE__ */ r.jsx(
15
+ c,
15
16
  {
16
- id: String(e),
17
- dataKey: o(r),
18
- yAxisId: o(r),
19
- stroke: l(r, e).lineStroke,
17
+ id: `${o}-${e}`,
18
+ dataKey: e,
19
+ yAxisId: x(i),
20
+ stroke: p(i, n).lineStroke,
20
21
  strokeWidth: 3,
21
22
  dot: !1,
22
- activeDot: !0,
23
+ activeDot: l,
23
24
  isAnimationActive: !1,
24
- type: m,
25
- hide: u(r),
25
+ type: a,
26
+ hide: f(i),
26
27
  strokeLinejoin: "round",
27
28
  strokeLinecap: "round",
28
- filter: n.variant !== "card" && "url(#outline)",
29
- name: a(r),
30
- unit: r.unit
29
+ filter: t.variant !== "card" && "url(#outline)",
30
+ name: u(i, n),
31
+ unit: i.unit
31
32
  },
32
- e
33
- ),
34
- /* @__PURE__ */ i.jsx(
35
- f,
33
+ `${o}-${e}`
34
+ )),
35
+ /* @__PURE__ */ r.jsx(
36
+ d,
36
37
  {
37
- settings: n,
38
- dataset: r,
39
- data: t,
40
- index: e
38
+ settings: t,
39
+ dataset: i,
40
+ data: m,
41
+ index: o
41
42
  }
42
43
  )
43
44
  ] });
44
45
  }
45
46
  export {
46
- h as default
47
+ C as default
47
48
  };
@@ -1,66 +1,80 @@
1
- import { j as r } from "../external/react/jsx-runtime.js";
1
+ import { j as i } from "../external/react/jsx-runtime.js";
2
+ import { useState as g, useRef as A, useEffect as C } from "react";
2
3
  /* empty css */
3
- import { getYDataKeysFlipped as m, getYDataKeys as y, getColor as C } from "./utils.js";
4
- import { Tooltip as g } from "../external/recharts/es6/component/Tooltip.js";
5
- function v(n) {
6
- const { active: i, payload: e, label: c, tooltip: d, datasets: u = [] } = n, f = (l, o) => o.map((t) => {
7
- let a = t.value;
8
- return l.forEach((s) => {
9
- m(s).forEach((p) => {
10
- p === t.dataKey && (a = Math.abs(Number(a)));
4
+ import { getYDataKeys as x, getYDataKeysFlipped as E, defaultYAxisFormatter as F, getColor as K } from "./utils.js";
5
+ import { usePlotArea as b } from "../external/recharts/es6/hooks.js";
6
+ import { Tooltip as v } from "../external/recharts/es6/component/Tooltip.js";
7
+ function W(o) {
8
+ const {
9
+ active: e,
10
+ payload: t,
11
+ label: a,
12
+ tooltip: u,
13
+ datasets: h = [],
14
+ onTooltipWidth: p
15
+ } = o, f = A(null);
16
+ C(() => {
17
+ f.current && p && p(f.current.offsetWidth);
18
+ }, [e, t, p]);
19
+ const y = (c, r) => r.map((n) => {
20
+ let l = n.value, s;
21
+ return c.forEach((d) => {
22
+ !s && x(d).includes(n.dataKey) && (s = d), E(d).forEach((m) => {
23
+ m === n.dataKey && (l = Math.abs(Number(l)));
11
24
  });
12
- }), { ...t, value: a };
13
- }), h = (l) => {
14
- let o;
15
- return u.forEach((t, a) => {
16
- const s = y(t);
17
- s.forEach((p, x) => {
18
- if (p === l.dataKey) {
19
- const j = s.length > 1 ? x : a;
20
- o = C(t, j).text;
25
+ }), s != null && s.yAxisFormatter ? l = s.yAxisFormatter(l) : l = F(l), { ...n, value: l };
26
+ }), j = (c) => {
27
+ let r;
28
+ return h.forEach((n, l) => {
29
+ const s = x(n);
30
+ s.forEach((d, m) => {
31
+ if (d === c.dataKey) {
32
+ const T = s.length > 1 ? m : l;
33
+ r = K(n, T).text;
21
34
  }
22
35
  });
23
- }), o;
36
+ }), r;
24
37
  };
25
- if (i && e && e.length) {
26
- const l = f(
27
- u,
28
- e
29
- ).reverse();
30
- return d === "default" ? /* @__PURE__ */ r.jsxs("div", { className: "eds-chart-tooltip", children: [
31
- /* @__PURE__ */ r.jsx("p", { children: c }),
32
- l.map((o, t) => /* @__PURE__ */ r.jsxs("p", { style: { color: h(o) }, children: [
33
- o.name,
38
+ if (e && t && t.length) {
39
+ const c = y(h, t);
40
+ return u === "default" ? /* @__PURE__ */ i.jsxs("div", { ref: f, className: "eds-chart-tooltip", children: [
41
+ /* @__PURE__ */ i.jsx("p", { children: a }),
42
+ c.map((r, n) => /* @__PURE__ */ i.jsxs("p", { style: { color: j(r) }, children: [
43
+ r.name,
34
44
  " ",
35
- o.value,
45
+ r.value,
36
46
  " ",
37
- o.unit
38
- ] }, t))
39
- ] }) : d === "label" ? /* @__PURE__ */ r.jsx("div", { className: "eds-chart-tooltip", children: /* @__PURE__ */ r.jsx("p", { children: c }) }) : /* @__PURE__ */ r.jsx("div", {});
47
+ r.unit
48
+ ] }, n))
49
+ ] }) : u === "label" ? /* @__PURE__ */ i.jsx("div", { ref: f, className: "eds-chart-tooltip", children: /* @__PURE__ */ i.jsx("p", { children: a }) }) : /* @__PURE__ */ i.jsx("div", { ref: f });
40
50
  }
41
51
  return null;
42
52
  }
43
- function N({
44
- settings: n,
45
- datasets: i,
46
- active: e
53
+ function N(o, e, t, a) {
54
+ return o - e / 2 <= t ? o + e / 2 - 10 : o + e / 2 >= a ? o - e / 2 + 10 : o;
55
+ }
56
+ function M({
57
+ settings: o,
58
+ datasets: e,
59
+ active: t
47
60
  }) {
48
- return /* @__PURE__ */ r.jsx(
49
- g,
61
+ const { x: a, width: u } = b(), [h, p] = g(0), f = (t == null ? void 0 : t.x) !== void 0 ? N(t.x, h, a, u) : void 0;
62
+ return t ? /* @__PURE__ */ i.jsx(
63
+ v,
50
64
  {
51
- content: /* @__PURE__ */ r.jsx(
52
- v,
65
+ content: /* @__PURE__ */ i.jsx(
66
+ W,
53
67
  {
54
- tooltip: n.tooltip || "default",
55
- datasets: i
68
+ tooltip: o.tooltip || "default",
69
+ datasets: e,
70
+ onTooltipWidth: p
56
71
  }
57
72
  ),
58
- position: { x: e == null ? void 0 : e.x, y: 0 },
59
- isAnimationActive: !1,
60
- cursor: n.tooltip !== "none"
73
+ position: { x: f, y: 0 },
74
+ isAnimationActive: !1
61
75
  }
62
- );
76
+ ) : null;
63
77
  }
64
78
  export {
65
- N as default
79
+ M as default
66
80
  };
@@ -0,0 +1,66 @@
1
+ import { getYAxisId as b, getYDataKeys as S } from "./utils.js";
2
+ const N = (e) => Number.isFinite(+e) ? +e : NaN, k = (e, y) => {
3
+ const M = S(e), p = Array.isArray(e.yDataKey), i = { min: 1 / 0, max: -1 / 0 }, { min: r, max: s } = y.reduce((t, o) => {
4
+ if (p) {
5
+ let u = 0, x = 0;
6
+ return M.forEach((g) => {
7
+ const c = N(o == null ? void 0 : o[g]);
8
+ Number.isFinite(c) && (c >= 0 ? u += c : x += c);
9
+ }), t.min = Math.min(t.min, x), t.max = Math.max(t.max, u), t;
10
+ }
11
+ return M.forEach((u) => {
12
+ const x = N(o == null ? void 0 : o[u]);
13
+ Number.isFinite(x) && (t.min = Math.min(t.min, x), t.max = Math.max(t.max, x));
14
+ }), t;
15
+ }, i);
16
+ if (!Number.isFinite(r) || !Number.isFinite(s))
17
+ return { min: 0, max: 0 };
18
+ if (r === s) {
19
+ const t = Math.max(1, Math.abs(r) * 0.1);
20
+ return { min: r - t, max: s + t };
21
+ }
22
+ return { min: r, max: s };
23
+ };
24
+ function Y(e, y, M) {
25
+ const p = [...new Set(e.map((n) => b(n)))], i = {}, r = {};
26
+ p.forEach((n) => {
27
+ const a = e.filter((m) => b(m) === n);
28
+ r[n] = a.find((m) => m.show !== !1) ?? a[0];
29
+ const h = a.map((m) => k(m, y)).reduce(
30
+ (m, d) => ({
31
+ min: Math.min(m.min, d.min),
32
+ max: Math.max(m.max, d.max)
33
+ }),
34
+ { min: 1 / 0, max: -1 / 0 }
35
+ );
36
+ i[n] = h.min === 1 / 0 || h.max === -1 / 0 ? { min: 0, max: 0 } : h;
37
+ });
38
+ const s = [...p].sort((n, a) => {
39
+ const f = i[n], h = i[a], m = f.min === 0 && f.max === 0, d = h.min === 0 && h.max === 0;
40
+ return m === d ? 0 : m ? 1 : -1;
41
+ }), t = M - 1, o = s.map((n) => {
42
+ const { min: a, max: f } = i[n];
43
+ return Math.min(
44
+ t,
45
+ Math.max(0, Math.round((0 - a) / (f - a || 1) * t))
46
+ );
47
+ }), u = Math.max(
48
+ ...s.map((n) => i[n].min < 0 ? 1 : 0)
49
+ ), x = Math.min(
50
+ ...s.map((n) => i[n].max > 0 ? t - 1 : t)
51
+ ), g = Math.max(...o), c = Math.max(u, Math.min(g, x));
52
+ return s.map((n) => {
53
+ const a = i[n], f = Math.max(c, a.min < 0 ? 1 : 0), h = Math.max(t - c, a.max > 0 ? 1 : 0), m = Math.max(
54
+ a.min < 0 ? Math.abs(a.min) / f : 0,
55
+ a.max > 0 ? a.max / h : 0,
56
+ 1e-9
57
+ ), I = Math.ceil(m * 10) / 10, A = -c * I, l = Array.from(
58
+ { length: M },
59
+ (D, E) => A + E * I
60
+ ), F = [l[0], l[l.length - 1]];
61
+ return { id: n, ticks: l, domain: F, dataset: r[n] };
62
+ });
63
+ }
64
+ export {
65
+ Y as getAxes
66
+ };
@@ -1,74 +1,81 @@
1
- import { smoothPath as p } from "../external/svg-smoother/dist/index.js";
2
- function d(e, t) {
1
+ import { smoothPath as d } from "../external/svg-smoother/dist/index.js";
2
+ function f(e) {
3
+ return (Math.abs(e) < 1e-9 ? 0 : e).toFixed(3).replace(/\.0+$/, "").replace(/(\.[0-9]*?)0+$/, "$1");
4
+ }
5
+ function m(e, t) {
3
6
  return e.length === 0 ? "" : e.slice(1).reduce(
4
7
  (i, [s, n], c) => {
5
- const [r, o] = e[c], _ = s - r, h = Math.min(t / 2, Math.abs(_) / 2), a = (r + s) / 2, f = a - h, l = a + h;
6
- return i.push(`L ${f} ${o}`, `L ${l} ${n}`, `L ${s} ${n}`), i;
8
+ const [r, o] = e[c], l = s - r, h = Math.min(t / 2, Math.abs(l) / 2), a = (r + s) / 2, _ = a - h, u = a + h;
9
+ return i.push(
10
+ `L ${f(_)} ${f(o)}`,
11
+ `L ${f(u)} ${f(n)}`,
12
+ `L ${f(s)} ${f(n)}`
13
+ ), i;
7
14
  },
8
- [`M ${e[0][0]} ${e[0][1]}`]
15
+ [`M ${f(e[0][0])} ${f(e[0][1])}`]
9
16
  ).join(" ");
10
17
  }
11
- const $ = (e) => e.map(([t, i]) => `${t.toFixed(3)},${i.toFixed(3)}`).join("|"), u = (e, t) => Array.from(
18
+ const C = (e) => e.map(([t, i]) => `${f(t)},${f(i)}`).join("|"), p = (e, t) => Array.from(
12
19
  { length: Math.floor(e.length / t) },
13
20
  (i, s) => e.slice(s * t, s * t + t)
14
21
  );
15
- function M(e) {
22
+ function g(e) {
16
23
  const t = Array.from(e.matchAll(/([MLC])([^MLC]+)/g)).map((o) => ({
17
24
  cmd: o[1],
18
25
  vals: (o[2] || "").trim().split(/[ ,]+/).map(Number)
19
26
  }));
20
27
  let i = NaN, s = NaN;
21
28
  const n = [];
22
- if (t.forEach(({ cmd: o, vals: _ }) => {
29
+ if (t.forEach(({ cmd: o, vals: l }) => {
23
30
  if (o === "M") {
24
- [i, s] = _;
31
+ [i, s] = l;
25
32
  return;
26
33
  }
27
34
  if (o === "L") {
28
- const [h, a] = _;
35
+ const [h, a] = l;
29
36
  n.push([i, s, i, s, h, a, h, a]), i = h, s = a;
30
37
  return;
31
38
  }
32
- o === "C" && u(_, 6).forEach(([h, a, f, l, m, P]) => {
33
- n.push([i, s, h, a, f, l, m, P]), i = m, s = P;
39
+ o === "C" && p(l, 6).forEach(([h, a, _, u, P, $]) => {
40
+ n.push([i, s, h, a, _, u, P, $]), i = P, s = $;
34
41
  });
35
42
  }), !n.length) return e;
36
43
  const [c, r] = n[n.length - 1].slice(6, 8);
37
44
  return [
38
45
  `M ${c} ${r}`,
39
46
  ...n.slice().reverse().map(
40
- ([o, _, h, a, f, l]) => `C ${f} ${l} ${h} ${a} ${o} ${_}`
47
+ ([o, l, h, a, _, u]) => `C ${_} ${u} ${h} ${a} ${o} ${l}`
41
48
  )
42
49
  ].join(" ");
43
50
  }
44
- function C(e, t) {
51
+ function b(e, t) {
45
52
  Array.from(e.matchAll(/([MLCZ])([^MLCZ]*)/g)).map((s) => ({
46
53
  cmd: s[1],
47
54
  nums: (s[2] || "").trim().split(/[ ,]+/).map(Number).filter(Number.isFinite)
48
55
  })).forEach(({ cmd: s, nums: n }) => {
49
56
  if (s === "M") {
50
- u(n, 2).forEach(
57
+ p(n, 2).forEach(
51
58
  ([c, r], o) => (o === 0 ? t.moveTo : t.lineTo).call(t, c, r)
52
59
  );
53
60
  return;
54
61
  }
55
62
  if (s === "L") {
56
- u(n, 2).forEach(([c, r]) => t.lineTo(c, r));
63
+ p(n, 2).forEach(([c, r]) => t.lineTo(c, r));
57
64
  return;
58
65
  }
59
66
  if (s === "C") {
60
- u(n, 6).forEach(
61
- ([c, r, o, _, h, a]) => t.bezierCurveTo(c, r, o, _, h, a)
67
+ p(n, 6).forEach(
68
+ ([c, r, o, l, h, a]) => t.bezierCurveTo(c, r, o, l, h, a)
62
69
  );
63
70
  return;
64
71
  }
65
72
  s === "Z" && t.closePath();
66
73
  });
67
74
  }
68
- function b(e, t, i) {
75
+ function M(e, t, i) {
69
76
  this._context = e, this._offset = t, this._radius = i, this._inArea = !1, this._line = 0, this._points = [], this._topPoints = [], this._topPath = "", this._edgeCache = /* @__PURE__ */ new Map();
70
77
  }
71
- b.prototype = {
78
+ M.prototype = {
72
79
  areaStart() {
73
80
  this._inArea = !0, this._line = 0, this._topPoints = [], this._topPath = "";
74
81
  },
@@ -81,40 +88,40 @@ b.prototype = {
81
88
  lineEnd() {
82
89
  if (this._points.length) {
83
90
  if (!this._inArea) {
84
- const e = d(this._points, this._offset), t = p(e, {
91
+ const e = m(this._points, this._offset), t = d(e, {
85
92
  radius: this._radius,
86
93
  reduceCommands: !1
87
94
  });
88
- C(t, this._context);
95
+ b(t, this._context);
89
96
  return;
90
97
  }
91
98
  if (this._line === 1) {
92
99
  this._topPoints = this._points.slice();
93
- const e = d(this._topPoints, this._offset), t = p(e, {
100
+ const e = m(this._topPoints, this._offset), t = d(e, {
94
101
  radius: this._radius,
95
102
  reduceCommands: !1
96
103
  });
97
- this._edgeCache.set($(this._topPoints), t), this._topPath = t;
104
+ this._edgeCache.set(C(this._topPoints), t), this._topPath = t;
98
105
  return;
99
106
  }
100
107
  if (this._line === 2) {
101
- const t = this._points.slice().slice().reverse(), i = $(t);
108
+ const t = this._points.slice().slice().reverse(), i = C(t);
102
109
  let s = this._edgeCache.get(i);
103
110
  if (!s) {
104
- const o = d(
111
+ const o = m(
105
112
  t,
106
113
  this._offset
107
114
  );
108
- s = p(o, {
115
+ s = d(o, {
109
116
  radius: this._radius,
110
117
  reduceCommands: !1
111
118
  }), this._edgeCache.set(i, s);
112
119
  }
113
- const c = M(s).replace(
120
+ const c = g(s).replace(
114
121
  /^[Mm]\s+(-?\d+(?:\.\d+)?)\s+(-?\d+(?:\.\d+)?)/,
115
122
  "L $1 $2"
116
123
  ), r = `${this._topPath} ${c} Z`;
117
- C(r, this._context), this._topPoints = [], this._topPath = "", this._line = 0;
124
+ b(r, this._context), this._topPoints = [], this._topPath = "", this._line = 0;
118
125
  }
119
126
  }
120
127
  },
@@ -123,7 +130,7 @@ b.prototype = {
123
130
  }
124
131
  };
125
132
  function L(e = 10, t = 5) {
126
- return (i) => new b(i, e, t);
133
+ return (i) => new M(i, e, t);
127
134
  }
128
135
  export {
129
136
  L as curveSloped