@lilt-ui/charts 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/activity-ring.d.ts +3 -1
  3. package/dist/cards/activity-ring-card.d.ts +3 -1
  4. package/dist/cards/bar-chart-card.d.ts +5 -2
  5. package/dist/cards/box-plot-card.d.ts +3 -1
  6. package/dist/cards/cartesian-card.d.ts +15 -3
  7. package/dist/cards/combo-chart-card.d.ts +4 -2
  8. package/dist/cards/funnel-chart-card.d.ts +26 -2
  9. package/dist/cards/heatmap-chart-card.d.ts +6 -1
  10. package/dist/cards/horizontal-bar-chart-card.d.ts +7 -3
  11. package/dist/cards/progress-card.d.ts +6 -1
  12. package/dist/cards/radar-chart-card.d.ts +9 -2
  13. package/dist/cards/radial-chart-card.d.ts +14 -5
  14. package/dist/cards/range-chart-card.d.ts +3 -1
  15. package/dist/cards/sankey-chart-card.d.ts +6 -1
  16. package/dist/cards/scatter-chart-card.d.ts +11 -2
  17. package/dist/cards/slope-chart-card.d.ts +6 -1
  18. package/dist/cards/stat-card.d.ts +7 -2
  19. package/dist/{cartesian-card-Cj1o38DC.js → cartesian-card-7DAiMU3w.js} +2023 -1604
  20. package/dist/engine/depth.d.ts +42 -0
  21. package/dist/engine/isometric-bars.d.ts +25 -0
  22. package/dist/engine/ranges.d.ts +31 -0
  23. package/dist/finance/candle-geometry.d.ts +13 -2
  24. package/dist/finance/candles.d.ts +5 -0
  25. package/dist/finance/cards/candlestick-chart-card.d.ts +6 -1
  26. package/dist/finance/cards/depth-chart-card.d.ts +3 -1
  27. package/dist/finance/order-book.d.ts +4 -2
  28. package/dist/finance.js +492 -447
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.js +2276 -1765
  31. package/dist/interaction/legend-meter.d.ts +11 -0
  32. package/dist/interaction/value-legend.d.ts +8 -2
  33. package/dist/marks/use-range-mark.d.ts +8 -0
  34. package/dist/primitives/depth-paint.d.ts +103 -0
  35. package/dist/primitives/isometric-bar.d.ts +18 -0
  36. package/dist/styles.css +1 -1
  37. package/dist/types.d.ts +30 -4
  38. package/package.json +1 -1
package/dist/finance.js CHANGED
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { A as e, D as t, J as n, M as r, _ as i, b as a, d as o, g as s, h as c, i as l, j as u, k as d, l as f, m as p, p as m, r as h, t as g, v as _, w as v, x as y, y as b, z as x } from "./cartesian-card-Cj1o38DC.js";
3
- import { S, d as C, g as w, h as T, p as E, u as D } from "./report-context-Cz0AYdV2.js";
4
- import { useEffect as O, useMemo as k, useRef as A, useState as j } from "react";
5
- import { Fragment as M, jsx as N, jsxs as P } from "react/jsx-runtime";
2
+ import { C as e, F as t, I as n, L as r, N as i, R as a, S as o, U as s, Z as c, _ as l, b as u, d, dt as f, g as p, i as m, k as h, l as g, nt as _, q as v, r as y, t as b, v as x, w as S, x as C, y as w } from "./cartesian-card-7DAiMU3w.js";
3
+ import { S as T, d as E, g as D, h as O, p as k, u as A } from "./report-context-Cz0AYdV2.js";
4
+ import { useEffect as ee, useMemo as j, useRef as te, useState as M } from "react";
5
+ import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
6
6
  //#region src/finance/candle-geometry.ts
7
- var F = "var(--lilt-candle-up)", I = "var(--lilt-candle-down)";
8
- function L(e) {
7
+ var I = "var(--lilt-candle-up)", L = "var(--lilt-candle-down)";
8
+ function R(e) {
9
9
  return Math.round(e * 100) / 100;
10
10
  }
11
- function R(e, t, n) {
11
+ function z(e, t, n) {
12
12
  let r = e.fields[t], i = r?.[n.open], a = r?.[n.high], o = r?.[n.low], s = e.values[t];
13
13
  return i == null || a == null || o == null || s == null ? null : {
14
14
  open: i,
@@ -18,70 +18,84 @@ function R(e, t, n) {
18
18
  up: s >= i
19
19
  };
20
20
  }
21
- function z(e, t, n) {
21
+ function B(e, t, n) {
22
22
  for (let r of e) {
23
- let e = R(r, t, n);
23
+ let e = z(r, t, n);
24
24
  if (!e) continue;
25
25
  let i = Math.max(e.open, e.close), a = Math.min(e.open, e.close);
26
26
  if (e.high < i || e.low > a) throw Error(`Lilt Candles on series "${t}" expects low ≤ open, close ≤ high at row ${r.sourceIndex + 1}.`);
27
27
  }
28
28
  }
29
- function B(e, n, r, i) {
30
- let a = Math.max(1, r.columnWidth), o = a / 2, s = L(e), c = L(r.y(n.high)), l = L(r.y(n.low));
31
- if (i === "ohlc") {
32
- let t = L(r.y(n.open)), i = L(r.y(n.close)), a = L(Math.max(2, o));
29
+ function V(e, t, n, r, a = !1) {
30
+ let o = Math.max(1, n.columnWidth), s = o / 2, l = R(e), u = R(n.y(t.high)), d = R(n.y(t.low));
31
+ if (r === "ohlc") {
32
+ let r = R(n.y(t.open)), i = R(n.y(t.close)), a = R(Math.max(2, s));
33
33
  return {
34
34
  body: null,
35
35
  hollow: null,
36
- stroke: `M${s},${c}V${l}M${L(e - a)},${t}H${s}M${s},${i}H${L(e + a)}`
36
+ stroke: `M${l},${u}V${d}M${R(e - a)},${r}H${l}M${l},${i}H${R(e + a)}`,
37
+ side: null,
38
+ top: null
37
39
  };
38
40
  }
39
- let u = r.y(Math.max(n.open, n.close)), d = r.y(Math.min(n.open, n.close));
40
- if (d - u < 1) {
41
- let e = (u + d) / 2;
42
- u = e - .5, d = e + .5;
41
+ let f = n.y(Math.max(t.open, t.close)), p = n.y(Math.min(t.open, t.close));
42
+ if (p - f < 1) {
43
+ let e = (f + p) / 2;
44
+ f = e - .5, p = e + .5;
43
45
  }
44
- let f = i === "hollow" && n.up && a >= 3, p = f ? .5 : 0, m = t(e - o + p, u + p, Math.max(1, a - p * 2), Math.max(1, d - u - p * 2), a >= 6 ? 1.5 : 0), h = (c < u ? `M${s},${c}V${L(u)}` : "") + (l > d ? `M${s},${L(d)}V${l}` : "");
46
+ let m = r === "hollow" && t.up && o >= 3, h = m ? .5 : 0, g = a ? c(e, f, o, p - f) : null, _ = g ? e - g.frontWidth / 2 : e - s, v = i(_ + h, f + h, Math.max(1, (g ? g.frontWidth : o) - h * 2), Math.max(1, p - f - h * 2), !g && o >= 6 ? 1.5 : 0), y = (u < f ? `M${l},${u}V${R(f)}` : "") + (d > p ? `M${l},${R(p)}V${d}` : "");
45
47
  return {
46
- body: f ? null : m,
47
- hollow: f ? m : null,
48
- stroke: h
48
+ body: m ? null : v,
49
+ hollow: m ? v : null,
50
+ stroke: y,
51
+ side: g?.side ?? null,
52
+ top: g?.top ?? null
49
53
  };
50
54
  }
51
- function V(e, t, n, r, i, a) {
52
- let o = new y(), s = new y(), c = new y();
53
- for (let { row: l, cx: u } of v(e, r)) {
54
- let e = R(l, t, n);
55
+ function H(e, t, n, r, i, a, o = !1) {
56
+ let s = new S(), c = new S(), l = new S(), u = new S(), d = new S();
57
+ for (let { row: f, cx: p } of h(e, r)) {
58
+ let e = z(f, t, n);
55
59
  if (!e) continue;
56
- let d = a(l, e), f = B(u, e, r, i);
57
- f.body && o.add(d, f.body), f.hollow && s.add(d, f.hollow), f.stroke && c.add(d, f.stroke);
60
+ let m = a(f, e), h = V(p, e, r, i, o);
61
+ h.side && u.add(m, h.side), h.top && d.add(m, h.top), h.body && s.add(m, h.body), h.hollow && c.add(m, h.hollow), h.stroke && l.add(m, h.stroke);
58
62
  }
59
63
  return {
60
- bodies: o.entries(),
61
- hollow: s.entries(),
62
- strokes: c.entries()
64
+ bodies: s.entries(),
65
+ hollow: c.entries(),
66
+ strokes: l.entries(),
67
+ sides: u.entries(),
68
+ tops: d.entries()
63
69
  };
64
70
  }
65
71
  //#endregion
66
72
  //#region src/finance/candles.tsx
67
- function H(e, t, n) {
68
- return r(e, t, n.up ? F : I);
73
+ function U(e, t, n) {
74
+ return a(e, t, n.up ? I : L);
69
75
  }
70
- function U({ paths: e, display: t }) {
76
+ function W({ paths: e, display: t }) {
71
77
  let n = t === "ohlc" ? 1.5 : 1;
72
- return /* @__PURE__ */ P(M, { children: [
73
- e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */ N("path", {
78
+ return /* @__PURE__ */ F(N, { children: [
79
+ e.strokes.map(({ color: e, d: r }) => /* @__PURE__ */ P("path", {
74
80
  d: r,
75
81
  fill: "none",
76
82
  strokeWidth: n,
77
83
  strokeLinecap: t === "ohlc" ? "round" : "butt",
78
84
  style: { stroke: e }
79
85
  }, `stroke-${e}`)),
80
- e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */ N("path", {
86
+ e.sides.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
87
+ d: t,
88
+ style: { fill: v(e).side }
89
+ }, `side-${e}`)),
90
+ e.tops.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
91
+ d: t,
92
+ style: { fill: v(e).top }
93
+ }, `top-${e}`)),
94
+ e.bodies.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
81
95
  d: t,
82
96
  style: { fill: e }
83
97
  }, `body-${e}`)),
84
- e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */ N("path", {
98
+ e.hollow.map(({ color: e, d: t }) => /* @__PURE__ */ P("path", {
85
99
  d: t,
86
100
  strokeWidth: 1,
87
101
  style: {
@@ -91,43 +105,44 @@ function U({ paths: e, display: t }) {
91
105
  }, `hollow-${e}`))
92
106
  ] });
93
107
  }
94
- var W = u(function({ series: e, open: t, high: n, low: r, display: i = "candle", className: o }) {
95
- let s = a("Candles", e, [
96
- t,
108
+ var G = r(function({ series: t, open: n, high: r, low: i, display: a = "candle", depth: o = !1, className: c }) {
109
+ let l = e("Candles", t, [
97
110
  n,
98
- r
99
- ], "column"), { snapshot: c, descriptor: l, scales: u } = s, d = k(() => {
100
- let a = {
101
- open: t,
102
- high: n,
103
- low: r
111
+ r,
112
+ i
113
+ ], "column"), { snapshot: u, descriptor: d, scales: f } = l, p = j(() => {
114
+ let e = {
115
+ open: n,
116
+ high: r,
117
+ low: i
104
118
  };
105
- return z(c.data.rows, e, a), V(c.data.rows, e, a, u, i, (e, t) => H(l, e, t));
119
+ return B(u.data.rows, t, e), H(u.data.rows, t, e, f, a, (e, t) => U(d, e, t), o);
106
120
  }, [
107
- c,
108
- e,
121
+ u,
109
122
  t,
110
123
  n,
111
124
  r,
112
- u,
113
125
  i,
114
- l
126
+ f,
127
+ a,
128
+ d,
129
+ o
115
130
  ]);
116
- return /* @__PURE__ */ N("g", {
131
+ return /* @__PURE__ */ F("g", {
117
132
  "aria-hidden": "true",
118
- className: ["lilt-chart__candles", o].filter(Boolean).join(" "),
119
- "data-series": e,
120
- "data-display": i,
121
- clipPath: s.clipPath,
122
- mask: s.mask,
133
+ className: ["lilt-chart__candles", c].filter(Boolean).join(" "),
134
+ "data-series": t,
135
+ "data-display": a,
136
+ clipPath: o ? `url(#${l.depthClip.id})` : l.clipPath,
137
+ mask: l.mask,
123
138
  style: {
124
- opacity: s.opacity,
125
- transition: s.reducedMotion ? void 0 : "opacity 160ms ease-out"
139
+ opacity: l.opacity,
140
+ transition: l.reducedMotion ? void 0 : "opacity 160ms ease-out"
126
141
  },
127
- children: /* @__PURE__ */ N(U, {
128
- paths: d,
129
- display: i
130
- })
142
+ children: [o ? /* @__PURE__ */ P(s, { clip: l.depthClip }) : null, /* @__PURE__ */ P(W, {
143
+ paths: p,
144
+ display: a
145
+ })]
131
146
  });
132
147
  }, {
133
148
  layout: "column",
@@ -138,25 +153,33 @@ var W = u(function({ series: e, open: t, high: n, low: r, display: i = "candle",
138
153
  e.low
139
154
  ],
140
155
  highlight: (e, { row: t, snapshot: n, descriptor: r }) => {
141
- let i = R(t, e.series, e);
156
+ let i = z(t, e.series, e);
142
157
  if (!i) return null;
143
- let a = e.display ?? "candle", o = b(n, e.series), s = B(o.x(t.x), i, o, a), c = H(r, t, i);
144
- return /* @__PURE__ */ N("g", {
158
+ let a = e.display ?? "candle", s = o(n, e.series), c = V(s.x(t.x), i, s, a, e.depth), l = U(r, t, i);
159
+ return /* @__PURE__ */ P("g", {
145
160
  className: "lilt-chart__candle-highlight",
146
- children: /* @__PURE__ */ N(U, {
161
+ children: /* @__PURE__ */ P(W, {
147
162
  display: a,
148
163
  paths: {
149
- bodies: s.body ? [{
150
- color: c,
151
- d: s.body
164
+ bodies: c.body ? [{
165
+ color: l,
166
+ d: c.body
167
+ }] : [],
168
+ hollow: c.hollow ? [{
169
+ color: l,
170
+ d: c.hollow
152
171
  }] : [],
153
- hollow: s.hollow ? [{
154
- color: c,
155
- d: s.hollow
172
+ strokes: c.stroke ? [{
173
+ color: l,
174
+ d: c.stroke
156
175
  }] : [],
157
- strokes: s.stroke ? [{
158
- color: c,
159
- d: s.stroke
176
+ sides: c.side ? [{
177
+ color: l,
178
+ d: c.side
179
+ }] : [],
180
+ tops: c.top ? [{
181
+ color: l,
182
+ d: c.top
160
183
  }] : []
161
184
  }
162
185
  })
@@ -165,132 +188,134 @@ var W = u(function({ series: e, open: t, high: n, low: r, display: i = "candle",
165
188
  });
166
189
  //#endregion
167
190
  //#region src/finance/cards/pane.tsx
168
- function G({ context: t, label: r, caption: i, readout: a, series: o, height: s, y: c, bars: l, xAxis: u = !1, children: d }) {
169
- let [f, p] = j(null), h = f ?? t.data.at(-1) ?? null;
170
- return /* @__PURE__ */ P("div", {
191
+ function K({ context: e, label: t, caption: r, readout: i, series: a, height: o, y: s, bars: c, xAxis: l = !1, children: u }) {
192
+ let [d, m] = M(null), h = d ?? e.data.at(-1) ?? null;
193
+ return /* @__PURE__ */ F("div", {
171
194
  className: "lilt-card__pane",
172
- children: [i ? /* @__PURE__ */ P("span", {
195
+ children: [r ? /* @__PURE__ */ F("span", {
173
196
  className: "lilt-card__pane-caption",
174
197
  "aria-hidden": "true",
175
- children: [/* @__PURE__ */ N("span", {
198
+ children: [/* @__PURE__ */ P("span", {
176
199
  className: "lilt-card__pane-name",
177
- children: i
178
- }), a && h && !t.loading ? a(h) : null]
179
- }) : null, /* @__PURE__ */ N(n, {
200
+ children: r
201
+ }), i && h && !e.loading ? i(h) : null]
202
+ }) : null, /* @__PURE__ */ P(f, {
180
203
  className: "lilt-card__chart",
181
- "aria-label": r,
182
- data: t.data,
183
- x: t.x,
184
- y: c,
185
- series: o,
186
- controller: t.controller,
187
- onSelectionChange: a ? (e) => p(e?.row ?? null) : void 0,
188
- motion: t.motion,
189
- status: t.loading ? "loading" : "ready",
190
- children: /* @__PURE__ */ P(e, {
191
- height: s,
204
+ "aria-label": t,
205
+ data: e.data,
206
+ x: e.x,
207
+ y: s,
208
+ series: a,
209
+ controller: e.controller,
210
+ onSelectionChange: i ? (e) => m(e?.row ?? null) : void 0,
211
+ motion: e.motion,
212
+ status: e.loading ? "loading" : "ready",
213
+ children: /* @__PURE__ */ F(n, {
214
+ height: o,
192
215
  margins: {
193
- ...t.margins,
216
+ ...e.margins,
194
217
  top: 6,
195
- bottom: u ? 28 : 4
218
+ bottom: l ? 28 : 4
196
219
  },
197
- axis: t.axis,
198
- pill: t.hoverStyle,
199
- axisInset: t.axisInset,
200
- slots: t.slots || !!l,
201
- bars: l,
220
+ axis: e.axis,
221
+ pill: e.hoverStyle,
222
+ axisInset: e.axisInset,
223
+ slots: e.slots || !!c,
224
+ bars: c,
202
225
  background: "none",
203
- children: [d, u ? /* @__PURE__ */ N(m, { labels: "fit" }) : null]
226
+ children: [u, l ? /* @__PURE__ */ P(p, { labels: "fit" }) : null]
204
227
  })
205
228
  })]
206
229
  });
207
230
  }
208
231
  //#endregion
209
232
  //#region src/finance/cards/candlestick-chart-card.tsx
210
- function K(e, t) {
233
+ function q(e, t) {
211
234
  let n = e[t];
212
235
  return typeof n == "number" && Number.isFinite(n) ? n : null;
213
236
  }
214
- function q(e, t, n) {
215
- let r = e.length ? K(e[0], t) : null, i = e.length ? K(e.at(-1), n) : null;
237
+ function J(e, t, n) {
238
+ let r = e.length ? q(e[0], t) : null, i = e.length ? q(e.at(-1), n) : null;
216
239
  return r && i !== null ? i / r - 1 : void 0;
217
240
  }
218
- function ee(e) {
241
+ function ne(e) {
219
242
  return (t) => {
220
243
  let n = t.series[0]?.fields;
221
244
  return !n?.length || n.some((e) => e.value === null) ? null : n.map((t) => `${t.label[0]} ${e(t.value)}`).join(" ");
222
245
  };
223
246
  }
224
- var te = {
247
+ var re = {
225
248
  minimumFractionDigits: 2,
226
249
  maximumFractionDigits: 2
227
250
  };
228
- function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candle", scale: c = "linear", label: l = "Price", live: u = !1, data: f, ranges: p, delta: m, valueFormat: _ = te, locale: v = "en-US", volumeHeight: y = 64, ...b }) {
229
- let x = k(() => h(v, _).full, [v, JSON.stringify(_)]), S = k(() => h(v).compact, [v]), C = k(() => p?.map((t) => ({
251
+ function ie({ open: e, high: n, low: r, close: i, volume: a, display: o = "candle", depth: s = !1, scale: c = "linear", label: l = "Price", live: d = !1, data: f, ranges: p, delta: m, valueFormat: h = re, locale: g = "en-US", volumeHeight: _ = 64, ...v }) {
252
+ let x = j(() => y(g, h).full, [g, JSON.stringify(h)]), S = j(() => y(g).compact, [g]), C = j(() => p?.map((t) => ({
230
253
  ...t,
231
- delta: t.delta ?? q(t.data, e, r)
254
+ delta: t.delta ?? J(t.data, e, i)
232
255
  })), [
233
256
  p,
234
257
  e,
235
- r
236
- ]), w = (q(f ?? p?.[0]?.data ?? [], e, r) ?? 0) >= 0, T = (t) => (K(t, r) ?? 0) >= (K(t, e) ?? 0), E = o === "area", D = {
258
+ i
259
+ ]), T = (J(f ?? p?.[0]?.data ?? [], e, i) ?? 0) >= 0, E = (t) => (q(t, i) ?? 0) >= (q(t, e) ?? 0), D = o === "area", O = {
237
260
  open: {
238
261
  label: "Open",
239
- accessor: (t) => K(t, e)
262
+ accessor: (t) => q(t, e)
240
263
  },
241
264
  high: {
242
265
  label: "High",
243
- accessor: (e) => K(e, t)
266
+ accessor: (e) => q(e, n)
244
267
  },
245
268
  low: {
246
269
  label: "Low",
247
- accessor: (e) => K(e, n)
270
+ accessor: (e) => q(e, r)
248
271
  }
249
272
  };
250
- return /* @__PURE__ */ N(g, {
251
- ...b,
273
+ return /* @__PURE__ */ P(b, {
274
+ ...v,
275
+ depth: s,
252
276
  data: f,
253
277
  ranges: C,
254
- delta: m ?? (f ? q(f, e, r) : void 0),
255
- valueFormat: _,
256
- locale: v,
278
+ delta: m ?? (f ? J(f, e, i) : void 0),
279
+ valueFormat: h,
280
+ locale: g,
257
281
  aggregate: "last",
258
282
  tiles: !1,
259
- live: u,
283
+ live: d,
260
284
  series: [{
261
- key: r,
285
+ key: i,
262
286
  label: l,
263
- color: E ? w ? F : I : void 0
287
+ color: D ? T ? I : L : void 0
264
288
  }],
265
289
  shape: {
266
290
  kind: "marks",
267
- id: `candles:${o}:${c}:${e}:${t}:${n}:${!!a}`,
291
+ id: `candles:${o}:${s}:${c}:${e}:${n}:${r}:${!!a}`,
268
292
  includeZero: !1,
269
293
  scale: c,
270
294
  slots: !0,
271
295
  xAxis: !a,
272
- series: () => E ? {
273
- fields: D,
296
+ series: () => D ? {
297
+ fields: O,
274
298
  area: { treatment: "fade" },
275
299
  curve: "linear"
276
300
  } : {
277
- fields: D,
301
+ fields: O,
278
302
  line: { showInspectionPoint: !1 }
279
303
  },
280
- describe: ee(x),
281
- draw: (e) => e.map((e) => E ? [/* @__PURE__ */ N(d, { series: e }, `area-${e}`), /* @__PURE__ */ N(i, { series: e }, `line-${e}`)] : /* @__PURE__ */ N(W, {
304
+ describe: ne(x),
305
+ draw: (e) => e.map((e) => D ? [/* @__PURE__ */ P(t, { series: e }, `area-${e}`), /* @__PURE__ */ P(u, { series: e }, `line-${e}`)] : /* @__PURE__ */ P(G, {
282
306
  series: e,
283
307
  open: "open",
284
308
  high: "high",
285
309
  low: "low",
286
- display: o
310
+ display: o,
311
+ depth: s
287
312
  }, e))
288
313
  },
289
- panes: a ? (e) => /* @__PURE__ */ N(G, {
314
+ panes: a ? (e) => /* @__PURE__ */ P(K, {
290
315
  context: e,
291
- label: `${b.title} volume`,
316
+ label: `${v.title} volume`,
292
317
  caption: "Volume",
293
- height: y,
318
+ height: _,
294
319
  xAxis: !0,
295
320
  y: {
296
321
  includeZero: !0,
@@ -301,39 +326,39 @@ function ne({ open: e, high: t, low: n, close: r, volume: a, display: o = "candl
301
326
  series: [{
302
327
  id: "volume",
303
328
  label: "Volume",
304
- accessor: (e) => K(e, a),
329
+ accessor: (e) => q(e, a),
305
330
  formatValue: S,
306
- colorAt: (e) => T(e) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
331
+ colorAt: (e) => E(e) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
307
332
  bar: { radius: 1 }
308
333
  }],
309
- children: /* @__PURE__ */ N(s, { series: "volume" })
334
+ children: /* @__PURE__ */ P(w, { series: "volume" })
310
335
  }) : void 0
311
336
  });
312
337
  }
313
338
  //#endregion
314
339
  //#region src/finance/indicators.ts
315
- function J(e) {
340
+ function Y(e) {
316
341
  return typeof e == "number" && Number.isFinite(e);
317
342
  }
318
- function Y(e, t) {
343
+ function ae(e, t) {
319
344
  if (!Number.isInteger(t) || t < 1) throw Error(`Lilt ${e} period must be a positive integer; received ${t}.`);
320
345
  }
321
- function X(e, t) {
322
- Y("sma", t);
346
+ function oe(e, t) {
347
+ ae("sma", t);
323
348
  let n = [], r = 0, i = 0;
324
349
  for (let a = 0; a < e.length; a += 1) {
325
350
  let o = e[a];
326
- J(o) && (r += o, i += 1);
351
+ Y(o) && (r += o, i += 1);
327
352
  let s = a - t >= 0 ? e[a - t] : void 0;
328
- a - t >= 0 && J(s) && (r -= s, --i), n.push(a >= t - 1 && i === t ? r / t : null);
353
+ a - t >= 0 && Y(s) && (r -= s, --i), n.push(a >= t - 1 && i === t ? r / t : null);
329
354
  }
330
355
  return n;
331
356
  }
332
- function Z(e, t) {
333
- Y("ema", t);
357
+ function X(e, t) {
358
+ ae("ema", t);
334
359
  let n = 2 / (t + 1), r = [], i = null, a = [];
335
360
  for (let o of e) {
336
- if (!J(o)) {
361
+ if (!Y(o)) {
337
362
  r.push(null);
338
363
  continue;
339
364
  }
@@ -345,11 +370,11 @@ function Z(e, t) {
345
370
  }
346
371
  return r;
347
372
  }
348
- function re(e, t = 14) {
349
- Y("rsi", t);
373
+ function se(e, t = 14) {
374
+ ae("rsi", t);
350
375
  let n = e.map(() => null), r = null, i = 0, a = 0, o = 0, s = 0, c = 0;
351
376
  return e.forEach((e, l) => {
352
- if (!J(e)) return;
377
+ if (!Y(e)) return;
353
378
  if (r === null) {
354
379
  r = e;
355
380
  return;
@@ -364,12 +389,12 @@ function re(e, t = 14) {
364
389
  n[l] = c === 0 ? s === 0 ? 50 : 100 : 100 - 100 / (1 + s / c);
365
390
  }), n;
366
391
  }
367
- function ie(e, t = 12, n = 26, r = 9) {
392
+ function ce(e, t = 12, n = 26, r = 9) {
368
393
  if (t >= n) throw Error("Lilt macd needs a fast period shorter than the slow period.");
369
- let i = Z(e, t), a = Z(e, n), o = e.map((e, t) => {
394
+ let i = X(e, t), a = X(e, n), o = e.map((e, t) => {
370
395
  let n = i[t], r = a[t];
371
396
  return n === null || r === null ? null : n - r;
372
- }), s = Z(o, r);
397
+ }), s = X(o, r);
373
398
  return {
374
399
  macd: o,
375
400
  signal: s,
@@ -379,8 +404,8 @@ function ie(e, t = 12, n = 26, r = 9) {
379
404
  })
380
405
  };
381
406
  }
382
- function ae(e, t = 20, n = 2) {
383
- let r = X(e, t), i = [], a = [];
407
+ function le(e, t = 20, n = 2) {
408
+ let r = oe(e, t), i = [], a = [];
384
409
  return r.forEach((r, o) => {
385
410
  if (r === null) {
386
411
  i.push(null), a.push(null);
@@ -396,19 +421,19 @@ function ae(e, t = 20, n = 2) {
396
421
  lower: a
397
422
  };
398
423
  }
399
- function oe(e) {
424
+ function ue(e) {
400
425
  let t = -Infinity;
401
- return e.map((e) => J(e) ? (t = Math.max(t, e), t > 0 ? e / t - 1 : 0) : null);
426
+ return e.map((e) => Y(e) ? (t = Math.max(t, e), t > 0 ? e / t - 1 : 0) : null);
402
427
  }
403
- function se(e) {
404
- let t = e.find(J);
405
- return e.map((e) => J(e) && t !== void 0 && t !== 0 ? e / t - 1 : null);
428
+ function de(e) {
429
+ let t = e.find(Y);
430
+ return e.map((e) => Y(e) && t !== void 0 && t !== 0 ? e / t - 1 : null);
406
431
  }
407
- function ce(e, t) {
408
- for (let n of t) if (!J(n.price) || !J(n.size) || n.size < 0) throw Error(`Lilt order book ${e} need finite prices and non-negative sizes; received ${n.price} × ${n.size}.`);
432
+ function fe(e, t) {
433
+ for (let n of t) if (!Y(n.price) || !Y(n.size) || n.size < 0) throw Error(`Lilt order book ${e} need finite prices and non-negative sizes; received ${n.price} × ${n.size}.`);
409
434
  }
410
- function le(e, t) {
411
- ce("bids", e), ce("asks", t);
435
+ function pe(e, t) {
436
+ fe("bids", e), fe("asks", t);
412
437
  let n = (e) => {
413
438
  let t = /* @__PURE__ */ new Map();
414
439
  for (let n of e) t.set(n.price, (t.get(n.price) ?? 0) + n.size);
@@ -443,7 +468,7 @@ function le(e, t) {
443
468
  }
444
469
  //#endregion
445
470
  //#region src/finance/cards/indicator-chart-card.tsx
446
- function ue(e) {
471
+ function me(e) {
447
472
  return e.map((e, t) => {
448
473
  let n = typeof e == "string" ? { kind: e } : e, r = "period" in n && n.period !== void 0 ? n.period : (n.kind, 20), i = "deviations" in n && n.deviations !== void 0 ? n.deviations : 2, a = n.kind === "bollinger" ? "BB" : n.kind.toUpperCase();
449
474
  return {
@@ -455,7 +480,7 @@ function ue(e) {
455
480
  };
456
481
  });
457
482
  }
458
- function de(e) {
483
+ function he(e) {
459
484
  return e.map((e, t) => {
460
485
  let n = typeof e == "string" ? { kind: e } : e;
461
486
  return {
@@ -468,105 +493,105 @@ function de(e) {
468
493
  };
469
494
  });
470
495
  }
471
- function Q(e, t) {
496
+ function Z(e, t) {
472
497
  if (!t) return null;
473
498
  let n = e[t];
474
499
  return typeof n == "number" && Number.isFinite(n) ? n : null;
475
500
  }
476
- function fe(e, t, n, r) {
477
- let i = e.map((e) => Q(e, t)), a = e.map((e) => ({ ...e })), o = (e, t) => t.forEach((t, n) => a[n][e] = t);
501
+ function ge(e, t, n, r) {
502
+ let i = e.map((e) => Z(e, t)), a = e.map((e) => ({ ...e })), o = (e, t) => t.forEach((t, n) => a[n][e] = t);
478
503
  for (let e of n) if (e.kind === "bollinger") {
479
- let t = ae(i, e.period, e.deviations);
504
+ let t = le(i, e.period, e.deviations);
480
505
  o(e.id, t.middle), o(`${e.id}Upper`, t.upper), o(`${e.id}Lower`, t.lower);
481
- } else o(e.id, (e.kind === "sma" ? X : Z)(i, e.period));
482
- for (let e of r) if (e.kind === "rsi" && o(e.id, re(i, e.period)), e.kind === "macd") {
483
- let t = ie(i, e.fast, e.slow, e.signal);
506
+ } else o(e.id, (e.kind === "sma" ? oe : X)(i, e.period));
507
+ for (let e of r) if (e.kind === "rsi" && o(e.id, se(i, e.period)), e.kind === "macd") {
508
+ let t = ce(i, e.fast, e.slow, e.signal);
484
509
  o(`${e.id}Macd`, t.macd), o(`${e.id}Signal`, t.signal), o(`${e.id}Histogram`, t.histogram);
485
510
  }
486
511
  return a;
487
512
  }
488
- var pe = {
513
+ var _e = {
489
514
  minimumFractionDigits: 2,
490
515
  maximumFractionDigits: 2
491
- }, me = [
516
+ }, ve = [
492
517
  "var(--lilt-series-4)",
493
518
  "var(--lilt-series-3)",
494
519
  "var(--lilt-series-5)"
495
520
  ];
496
- function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlays: l = [], panes: u = ["rsi", "macd"], label: d = "Price", scale: p = "linear", live: m = !1, data: v, ranges: y, delta: b, valueFormat: x = pe, locale: S = "en-US", paneHeight: C = 72, ...w }) {
497
- let T = !!(t && n && r), E = c ?? (T ? "candle" : "line");
521
+ function ye({ close: e, open: t, high: n, low: r, volume: i, display: a, overlays: o = [], panes: s = ["rsi", "macd"], label: c = "Price", scale: l = "linear", live: f = !1, data: p, ranges: m, delta: h, valueFormat: _ = _e, locale: v = "en-US", paneHeight: x = 72, ...S }) {
522
+ let T = !!(t && n && r), E = a ?? (T ? "candle" : "line");
498
523
  if (E !== "line" && !T) throw Error("Lilt IndicatorChartCard candles need open, high and low fields.");
499
- let D = JSON.stringify(l), O = JSON.stringify(u), A = k(() => ue(l), [D]), j = k(() => de(u), [O]);
500
- if (j.some((e) => e.kind === "volume") && !a) throw Error("Lilt IndicatorChartCard needs a `volume` field for a volume pane.");
501
- let L = k(() => v ? fe(v, e, A, j) : void 0, [
502
- v,
524
+ let D = JSON.stringify(o), O = JSON.stringify(s), k = j(() => me(o), [D]), A = j(() => he(s), [O]);
525
+ if (A.some((e) => e.kind === "volume") && !i) throw Error("Lilt IndicatorChartCard needs a `volume` field for a volume pane.");
526
+ let ee = j(() => p ? ge(p, e, k, A) : void 0, [
527
+ p,
503
528
  e,
504
- A,
505
- j
506
- ]), R = k(() => y?.map((n) => ({
529
+ k,
530
+ A
531
+ ]), te = j(() => m?.map((n) => ({
507
532
  ...n,
508
- data: fe(n.data, e, A, j),
509
- delta: n.delta ?? (t ? q(n.data, t, e) : void 0)
533
+ data: ge(n.data, e, k, A),
534
+ delta: n.delta ?? (t ? J(n.data, t, e) : void 0)
510
535
  })), [
511
- y,
536
+ m,
512
537
  e,
513
538
  t,
514
- A,
515
- j
516
- ]), z = k(() => h(S, x).full, [S, JSON.stringify(x)]), B = k(() => h(S, { maximumFractionDigits: 2 }).full, [S]), V = k(() => h(S).compact, [S]), H = T ? {
539
+ k,
540
+ A
541
+ ]), M = j(() => y(v, _).full, [v, JSON.stringify(_)]), R = j(() => y(v, { maximumFractionDigits: 2 }).full, [v]), z = j(() => y(v).compact, [v]), B = T ? {
517
542
  open: {
518
543
  label: "Open",
519
- accessor: (e) => Q(e, t)
544
+ accessor: (e) => Z(e, t)
520
545
  },
521
546
  high: {
522
547
  label: "High",
523
- accessor: (e) => Q(e, n)
548
+ accessor: (e) => Z(e, n)
524
549
  },
525
550
  low: {
526
551
  label: "Low",
527
- accessor: (e) => Q(e, r)
552
+ accessor: (e) => Z(e, r)
528
553
  }
529
- } : void 0, U = new Map(A.map((e) => [e.id, e])), K = v?.length ? Q(v[0], e) : null, te = v?.length ? Q(v.at(-1), e) : null, ne = K === null || te === null || te >= K, J = j.at(-1)?.id, Y = (n, r) => {
530
- let c = n.id === J, l = (e) => (t) => Q(t, e), u = (e, t, n) => {
531
- let r = Q(e, t);
532
- return /* @__PURE__ */ P("span", {
554
+ } : void 0, V = new Map(k.map((e) => [e.id, e])), H = p?.length ? Z(p[0], e) : null, U = p?.length ? Z(p.at(-1), e) : null, W = H === null || U === null || U >= H, q = A.at(-1)?.id, re = (n, r) => {
555
+ let a = n.id === q, o = (e) => (t) => Z(t, e), s = (e, t, n) => {
556
+ let r = Z(e, t);
557
+ return /* @__PURE__ */ F("span", {
533
558
  className: "lilt-card__pane-value",
534
- children: [n ? `${n} ` : "", r === null ? "—" : B(r)]
559
+ children: [n ? `${n} ` : "", r === null ? "—" : R(r)]
535
560
  }, t);
536
561
  };
537
- if (n.kind === "volume") return /* @__PURE__ */ N(G, {
562
+ if (n.kind === "volume") return /* @__PURE__ */ P(K, {
538
563
  context: r,
539
- label: `${w.title} volume`,
564
+ label: `${S.title} volume`,
540
565
  caption: "Volume",
541
- readout: (e) => /* @__PURE__ */ N("span", {
566
+ readout: (e) => /* @__PURE__ */ P("span", {
542
567
  className: "lilt-card__pane-value",
543
- children: Q(e, a) === null ? "—" : V(Q(e, a))
568
+ children: Z(e, i) === null ? "—" : z(Z(e, i))
544
569
  }),
545
- height: C,
546
- xAxis: c,
570
+ height: x,
571
+ xAxis: a,
547
572
  y: {
548
573
  includeZero: !0,
549
574
  ticks: 2,
550
- format: V
575
+ format: z
551
576
  },
552
577
  bars: { series: ["volume"] },
553
578
  series: [{
554
579
  id: "volume",
555
580
  label: "Volume",
556
- accessor: l(a),
557
- formatValue: V,
558
- colorAt: (n) => (Q(n, e) ?? 0) >= (Q(n, t) ?? Q(n, e) ?? 0) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
581
+ accessor: o(i),
582
+ formatValue: z,
583
+ colorAt: (n) => (Z(n, e) ?? 0) >= (Z(n, t) ?? Z(n, e) ?? 0) ? "color-mix(in srgb, var(--lilt-candle-up) 42%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 42%, transparent)",
559
584
  bar: { radius: 1 }
560
585
  }],
561
- children: /* @__PURE__ */ N(s, { series: "volume" })
586
+ children: /* @__PURE__ */ P(w, { series: "volume" })
562
587
  }, n.id);
563
- if (n.kind === "rsi") return /* @__PURE__ */ P(G, {
588
+ if (n.kind === "rsi") return /* @__PURE__ */ F(K, {
564
589
  context: r,
565
- label: `${w.title} RSI ${n.period}`,
590
+ label: `${S.title} RSI ${n.period}`,
566
591
  caption: `RSI ${n.period}`,
567
- readout: (e) => u(e, n.id),
568
- height: C,
569
- xAxis: c,
592
+ readout: (e) => s(e, n.id),
593
+ height: x,
594
+ xAxis: a,
570
595
  y: {
571
596
  domain: [0, 100],
572
597
  ticks: 2,
@@ -575,66 +600,72 @@ function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlay
575
600
  series: [{
576
601
  id: n.id,
577
602
  label: `RSI ${n.period}`,
578
- accessor: l(n.id),
603
+ accessor: o(n.id),
579
604
  color: "var(--lilt-series-1)",
580
- formatValue: B,
581
- line: { width: 1.5 }
605
+ formatValue: R,
606
+ line: {
607
+ width: 1.5,
608
+ depth: S.depth
609
+ }
582
610
  }],
583
611
  children: [
584
- /* @__PURE__ */ N(o, {
612
+ /* @__PURE__ */ P(d, {
585
613
  axis: "y",
586
614
  from: 30,
587
615
  to: 70,
588
616
  color: "var(--lilt-series-1)"
589
617
  }),
590
- /* @__PURE__ */ N(f, {
618
+ /* @__PURE__ */ P(g, {
591
619
  value: 70,
592
620
  color: "var(--lilt-muted)"
593
621
  }),
594
- /* @__PURE__ */ N(f, {
622
+ /* @__PURE__ */ P(g, {
595
623
  value: 30,
596
624
  color: "var(--lilt-muted)"
597
625
  }),
598
- /* @__PURE__ */ N(i, { series: n.id })
626
+ /* @__PURE__ */ P(u, { series: n.id })
599
627
  ]
600
628
  }, n.id);
601
- let d = `${n.id}Macd`, p = `${n.id}Signal`, m = `${n.id}Histogram`;
602
- return /* @__PURE__ */ P(G, {
629
+ let c = `${n.id}Macd`, l = `${n.id}Signal`, f = `${n.id}Histogram`;
630
+ return /* @__PURE__ */ F(K, {
603
631
  context: r,
604
- label: `${w.title} MACD`,
632
+ label: `${S.title} MACD`,
605
633
  caption: `MACD ${n.fast} · ${n.slow} · ${n.signal}`,
606
- readout: (e) => [u(e, d), u(e, p, "Signal")],
607
- height: C,
608
- xAxis: c,
634
+ readout: (e) => [s(e, c), s(e, l, "Signal")],
635
+ height: x,
636
+ xAxis: a,
609
637
  y: {
610
638
  includeZero: !0,
611
639
  ticks: 2,
612
- format: B
640
+ format: R
613
641
  },
614
- bars: { series: [m] },
642
+ bars: { series: [f] },
615
643
  series: [
616
644
  {
617
- id: m,
645
+ id: f,
618
646
  label: "Histogram",
619
- accessor: l(m),
620
- formatValue: B,
621
- colorAt: (e) => (Q(e, m) ?? 0) >= 0 ? "color-mix(in srgb, var(--lilt-candle-up) 55%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 55%, transparent)",
647
+ accessor: o(f),
648
+ formatValue: R,
649
+ colorAt: (e) => (Z(e, f) ?? 0) >= 0 ? "color-mix(in srgb, var(--lilt-candle-up) 55%, transparent)" : "color-mix(in srgb, var(--lilt-candle-down) 55%, transparent)",
622
650
  bar: { radius: 1 }
623
651
  },
624
652
  {
625
- id: d,
653
+ id: c,
626
654
  label: "MACD",
627
- accessor: l(d),
655
+ accessor: o(c),
628
656
  color: "var(--lilt-series-4)",
629
- formatValue: B,
630
- line: { width: 1.5 }
657
+ formatValue: R,
658
+ line: {
659
+ width: 1.5,
660
+ depth: S.depth
661
+ }
631
662
  },
632
663
  {
633
- id: p,
664
+ id: l,
634
665
  label: "Signal",
635
- accessor: l(p),
666
+ accessor: o(l),
636
667
  color: "var(--lilt-series-3)",
637
- formatValue: B,
668
+ formatValue: R,
638
669
  line: {
639
670
  width: 1.5,
640
671
  dasharray: "3 3"
@@ -642,72 +673,76 @@ function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlay
642
673
  }
643
674
  ],
644
675
  children: [
645
- /* @__PURE__ */ N(s, { series: m }),
646
- /* @__PURE__ */ N(i, { series: d }),
647
- /* @__PURE__ */ N(i, { series: p })
676
+ /* @__PURE__ */ P(w, { series: f }),
677
+ /* @__PURE__ */ P(u, { series: c }),
678
+ /* @__PURE__ */ P(u, { series: l })
648
679
  ]
649
680
  }, n.id);
650
681
  };
651
- return /* @__PURE__ */ N(g, {
652
- ...w,
653
- data: L,
654
- ranges: R,
655
- delta: b ?? (v && t ? q(v, t, e) : void 0),
656
- valueFormat: x,
657
- locale: S,
682
+ return /* @__PURE__ */ P(b, {
683
+ ...S,
684
+ data: ee,
685
+ ranges: te,
686
+ delta: h ?? (p && t ? J(p, t, e) : void 0),
687
+ valueFormat: _,
688
+ locale: v,
658
689
  aggregate: "last",
659
690
  headlineSeries: e,
660
691
  pillSeries: e,
661
692
  tiles: !1,
662
- live: m,
693
+ live: f,
663
694
  series: [{
664
695
  key: e,
665
- label: d,
666
- color: E === "line" ? ne ? F : I : void 0
667
- }, ...A.map((e, t) => ({
696
+ label: c,
697
+ color: E === "line" ? W ? I : L : void 0
698
+ }, ...k.map((e, t) => ({
668
699
  key: e.id,
669
700
  label: e.label,
670
- color: me[t % me.length]
701
+ color: ve[t % ve.length]
671
702
  }))],
672
703
  shape: {
673
704
  kind: "marks",
674
- id: `indicator:${E}:${p}:${t}:${n}:${r}:${D}:${O}`,
705
+ id: `indicator:${E}:${l}:${t}:${n}:${r}:${D}:${O}`,
675
706
  includeZero: !1,
676
- scale: p,
707
+ scale: l,
677
708
  slots: !0,
678
- xAxis: j.length === 0,
709
+ xAxis: A.length === 0,
679
710
  series: (e) => {
680
- let t = U.get(e);
711
+ let t = V.get(e);
681
712
  return t ? {
682
713
  curve: "monotone",
683
714
  line: {
684
715
  width: 1.5,
685
- showInspectionPoint: !1
716
+ showInspectionPoint: !1,
717
+ depth: S.depth
686
718
  },
687
719
  ...t.kind === "bollinger" ? { fields: {
688
720
  upper: {
689
721
  label: "Upper",
690
- accessor: (e) => Q(e, `${t.id}Upper`)
722
+ accessor: (e) => Z(e, `${t.id}Upper`)
691
723
  },
692
724
  lower: {
693
725
  label: "Lower",
694
- accessor: (e) => Q(e, `${t.id}Lower`)
726
+ accessor: (e) => Z(e, `${t.id}Lower`)
695
727
  }
696
728
  } } : {}
697
729
  } : E === "line" ? {
698
- fields: H,
730
+ fields: B,
699
731
  curve: "linear",
700
- line: { width: 2 }
701
- } : { fields: H };
732
+ line: {
733
+ width: 2,
734
+ depth: S.depth
735
+ }
736
+ } : { fields: B };
702
737
  },
703
- describe: T ? ee(z) : void 0,
738
+ describe: T ? ne(M) : void 0,
704
739
  draw: (e) => e.map((e) => {
705
- let t = U.get(e);
706
- return t ? t.kind === "bollinger" ? [/* @__PURE__ */ N(_, {
740
+ let t = V.get(e);
741
+ return t ? t.kind === "bollinger" ? [/* @__PURE__ */ P(C, {
707
742
  series: e,
708
743
  lower: "lower",
709
744
  upper: "upper"
710
- }, `band-${e}`), /* @__PURE__ */ N(i, { series: e }, `line-${e}`)] : /* @__PURE__ */ N(i, { series: e }, e) : E === "line" ? /* @__PURE__ */ N(i, { series: e }, e) : /* @__PURE__ */ N(W, {
745
+ }, `band-${e}`), /* @__PURE__ */ P(u, { series: e }, `line-${e}`)] : /* @__PURE__ */ P(u, { series: e }, e) : E === "line" ? /* @__PURE__ */ P(u, { series: e }, e) : /* @__PURE__ */ P(G, {
711
746
  series: e,
712
747
  open: "open",
713
748
  high: "high",
@@ -716,26 +751,26 @@ function he({ close: e, open: t, high: n, low: r, volume: a, display: c, overlay
716
751
  }, e);
717
752
  })
718
753
  },
719
- panes: j.length ? (e) => /* @__PURE__ */ N(M, { children: j.map((t) => Y(t, e)) }) : void 0
754
+ panes: A.length ? (e) => /* @__PURE__ */ P(N, { children: A.map((t) => re(t, e)) }) : void 0
720
755
  });
721
756
  }
722
757
  //#endregion
723
758
  //#region src/finance/cards/depth-chart-card.tsx
724
- function ge({ price: e, label: t }) {
725
- let { snapshot: n } = x();
759
+ function be({ price: e, label: t }) {
760
+ let { snapshot: n } = _();
726
761
  if (e < n.xDomain[0] || e > n.xDomain[1]) return null;
727
762
  let r = n.xToPixel(e);
728
- return /* @__PURE__ */ P("g", {
763
+ return /* @__PURE__ */ F("g", {
729
764
  className: "lilt-card__depth-mid",
730
765
  "aria-hidden": "true",
731
- children: [/* @__PURE__ */ N("line", {
766
+ children: [/* @__PURE__ */ P("line", {
732
767
  x1: r,
733
768
  x2: r,
734
769
  y1: n.plot.top + 18,
735
770
  y2: n.plot.bottom,
736
771
  strokeDasharray: "2 4",
737
772
  vectorEffect: "non-scaling-stroke"
738
- }), /* @__PURE__ */ N("text", {
773
+ }), /* @__PURE__ */ P("text", {
739
774
  x: r,
740
775
  y: n.plot.top + 10,
741
776
  textAnchor: "middle",
@@ -743,94 +778,100 @@ function ge({ price: e, label: t }) {
743
778
  })]
744
779
  });
745
780
  }
746
- var _e = {
781
+ var xe = {
747
782
  style: "currency",
748
783
  currency: "USD",
749
784
  minimumFractionDigits: 2,
750
785
  maximumFractionDigits: 2
751
786
  };
752
- function ve({ title: t, bids: r, asks: a, valueFormat: o = _e, sizeFormat: s, locale: l = "en-US", height: u = 220, axis: f = "minimal", background: g = "dots", hoverStyle: _ = "soft", surface: v, numberStyle: y, loading: b = !1, motion: x, className: S, style: O }) {
753
- let A = k(() => le(r, a), [r, a]), M = JSON.stringify(o), L = JSON.stringify(s ?? null), R = k(() => h(l, o), [l, M]), z = k(() => h(l, s), [l, L]), B = k(() => h(l, {
787
+ function Se({ title: e, bids: r, asks: i, valueFormat: a = xe, sizeFormat: o, locale: s = "en-US", height: c = 220, axis: d = "minimal", background: m = "dots", hoverStyle: h = "soft", surface: g, numberStyle: _, loading: v = !1, motion: b, className: S, style: C, depth: w = !1 }) {
788
+ let T = j(() => pe(r, i), [r, i]), ee = JSON.stringify(a), te = JSON.stringify(o ?? null), N = j(() => y(s, a), [s, ee]), R = j(() => y(s, o), [s, te]), z = j(() => y(s, {
754
789
  style: "percent",
755
790
  maximumFractionDigits: 3
756
- }).full, [l]), [V, H] = j(null), U = k(() => [{
791
+ }).full, [s]), [B, V] = M(null), H = j(() => [{
757
792
  id: "bid",
758
793
  label: "Bids",
759
794
  accessor: (e) => e.bid,
760
- color: F,
795
+ color: I,
761
796
  curve: "step-before",
762
797
  area: { treatment: "fade" },
763
- line: { width: 1.5 },
764
- formatValue: z.full
798
+ line: {
799
+ width: 1.5,
800
+ depth: w
801
+ },
802
+ formatValue: R.full
765
803
  }, {
766
804
  id: "ask",
767
805
  label: "Asks",
768
806
  accessor: (e) => e.ask,
769
- color: I,
807
+ color: L,
770
808
  curve: "step-after",
771
809
  area: { treatment: "fade" },
772
- line: { width: 1.5 },
773
- formatValue: z.full
774
- }], [z]), W = A.spread !== null && A.mid ? `${R.full(A.spread)} (${B(A.spread / A.mid)})` : "—", G = V ? V.bid ?? V.ask : null;
775
- return /* @__PURE__ */ P(D, {
776
- "aria-label": t,
777
- surface: v,
778
- numberStyle: y,
779
- motion: x,
810
+ line: {
811
+ width: 1.5,
812
+ depth: w
813
+ },
814
+ formatValue: R.full
815
+ }], [R, w]), U = T.spread !== null && T.mid ? `${N.full(T.spread)} (${z(T.spread / T.mid)})` : "—", W = B ? B.bid ?? B.ask : null;
816
+ return /* @__PURE__ */ F(A, {
817
+ "aria-label": e,
818
+ surface: g,
819
+ numberStyle: _,
820
+ motion: b,
780
821
  className: ["lilt-card--depth", S].filter(Boolean).join(" "),
781
- style: O,
822
+ style: C,
782
823
  children: [
783
- /* @__PURE__ */ P(E, { children: [/* @__PURE__ */ N(T, { children: t }), /* @__PURE__ */ N(w, {
784
- value: A.mid,
785
- format: R.full,
786
- loading: b,
787
- motion: x,
788
- children: b ? null : V && G !== null ? /* @__PURE__ */ P(C, { children: [
789
- z.full(G),
824
+ /* @__PURE__ */ F(k, { children: [/* @__PURE__ */ P(O, { children: e }), /* @__PURE__ */ P(D, {
825
+ value: T.mid,
826
+ format: N.full,
827
+ loading: v,
828
+ motion: b,
829
+ children: v ? null : B && W !== null ? /* @__PURE__ */ F(E, { children: [
830
+ R.full(W),
790
831
  " ",
791
- V.side === "bid" ? "bid" : "ask",
832
+ B.side === "bid" ? "bid" : "ask",
792
833
  " depth at",
793
834
  " ",
794
- R.full(V.price)
795
- ] }) : /* @__PURE__ */ N(C, { children: "Mid price" })
835
+ N.full(B.price)
836
+ ] }) : /* @__PURE__ */ P(E, { children: "Mid price" })
796
837
  })] }),
797
- /* @__PURE__ */ P("dl", {
838
+ /* @__PURE__ */ F("dl", {
798
839
  className: "lilt-card__stats",
799
840
  children: [
800
- /* @__PURE__ */ P("div", { children: [/* @__PURE__ */ N("dt", { children: "Spread" }), /* @__PURE__ */ N("dd", { children: b ? "—" : W })] }),
801
- /* @__PURE__ */ P("div", {
841
+ /* @__PURE__ */ F("div", { children: [/* @__PURE__ */ P("dt", { children: "Spread" }), /* @__PURE__ */ P("dd", { children: v ? "—" : U })] }),
842
+ /* @__PURE__ */ F("div", {
802
843
  "data-side": "bid",
803
- children: [/* @__PURE__ */ N("dt", { children: "Bid depth" }), /* @__PURE__ */ N("dd", { children: b ? "—" : z.compact(A.bidDepth) })]
844
+ children: [/* @__PURE__ */ P("dt", { children: "Bid depth" }), /* @__PURE__ */ P("dd", { children: v ? "—" : R.compact(T.bidDepth) })]
804
845
  }),
805
- /* @__PURE__ */ P("div", {
846
+ /* @__PURE__ */ F("div", {
806
847
  "data-side": "ask",
807
- children: [/* @__PURE__ */ N("dt", { children: "Ask depth" }), /* @__PURE__ */ N("dd", { children: b ? "—" : z.compact(A.askDepth) })]
848
+ children: [/* @__PURE__ */ P("dt", { children: "Ask depth" }), /* @__PURE__ */ P("dd", { children: v ? "—" : R.compact(T.askDepth) })]
808
849
  })
809
850
  ]
810
851
  }),
811
- /* @__PURE__ */ N(n, {
852
+ /* @__PURE__ */ P(f, {
812
853
  className: "lilt-card__chart",
813
- "aria-label": `${t} depth by price`,
814
- data: A.levels,
854
+ "aria-label": `${e} depth by price`,
855
+ data: T.levels,
815
856
  x: {
816
857
  type: "number",
817
858
  accessor: (e) => e.price,
818
- format: R.full
859
+ format: N.full
819
860
  },
820
861
  y: {
821
862
  includeZero: !0,
822
863
  ticks: 3,
823
- format: z.compact
864
+ format: R.compact
824
865
  },
825
- series: U,
826
- onSelectionChange: (e) => H(e?.row ?? null),
827
- motion: x,
828
- status: b ? "loading" : "ready",
829
- children: /* @__PURE__ */ P(e, {
830
- height: u,
831
- axis: f,
832
- background: g,
833
- pill: _,
866
+ series: H,
867
+ onSelectionChange: (e) => V(e?.row ?? null),
868
+ motion: b,
869
+ status: v ? "loading" : "ready",
870
+ children: /* @__PURE__ */ F(n, {
871
+ height: c,
872
+ axis: d,
873
+ background: m,
874
+ pill: h,
834
875
  margins: {
835
876
  top: 8,
836
877
  right: 4,
@@ -838,17 +879,17 @@ function ve({ title: t, bids: r, asks: a, valueFormat: o = _e, sizeFormat: s, lo
838
879
  left: 4
839
880
  },
840
881
  children: [
841
- /* @__PURE__ */ N(c, { pattern: "lines" }),
842
- /* @__PURE__ */ N(d, { series: "bid" }),
843
- /* @__PURE__ */ N(d, { series: "ask" }),
844
- /* @__PURE__ */ N(i, { series: "bid" }),
845
- /* @__PURE__ */ N(i, { series: "ask" }),
846
- A.mid === null ? null : /* @__PURE__ */ N(ge, {
847
- price: A.mid,
848
- label: `Mid ${R.full(A.mid)}`
882
+ /* @__PURE__ */ P(x, { pattern: "lines" }),
883
+ /* @__PURE__ */ P(t, { series: "bid" }),
884
+ /* @__PURE__ */ P(t, { series: "ask" }),
885
+ /* @__PURE__ */ P(u, { series: "bid" }),
886
+ /* @__PURE__ */ P(u, { series: "ask" }),
887
+ T.mid === null ? null : /* @__PURE__ */ P(be, {
888
+ price: T.mid,
889
+ label: `Mid ${N.full(T.mid)}`
849
890
  }),
850
- /* @__PURE__ */ N(m, { labels: "fit" }),
851
- /* @__PURE__ */ N(p, {})
891
+ /* @__PURE__ */ P(p, { labels: "fit" }),
892
+ /* @__PURE__ */ P(l, {})
852
893
  ]
853
894
  })
854
895
  })
@@ -857,76 +898,76 @@ function ve({ title: t, bids: r, asks: a, valueFormat: o = _e, sizeFormat: s, lo
857
898
  }
858
899
  //#endregion
859
900
  //#region src/finance/cards/portfolio-chart-card.tsx
860
- function $(e, t) {
901
+ function Q(e, t) {
861
902
  if (!t) return null;
862
903
  let n = e[t];
863
904
  return typeof n == "number" && Number.isFinite(n) ? n : null;
864
905
  }
865
- function ye(e, t, n) {
866
- let r = e.at(-1), i = $(r, t), a = $(r, n);
906
+ function Ce(e, t, n) {
907
+ let r = e.at(-1), i = Q(r, t), a = Q(r, n);
867
908
  return i !== null && a ? i / a - 1 : void 0;
868
909
  }
869
- function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale: l = "en-US", ...u }) {
870
- let f = o ?? s?.[0]?.data ?? [], p = k(() => s?.map((n) => ({
871
- ...n,
872
- delta: n.delta ?? ye(n.data, e, t)
910
+ function we({ value: e, basis: n, label: r = "Value", drawdown: i = !0, drawdownHeight: a = 64, data: o, ranges: s, delta: c, locale: l = "en-US", ...d }) {
911
+ let f = o ?? s?.[0]?.data ?? [], p = j(() => s?.map((t) => ({
912
+ ...t,
913
+ delta: t.delta ?? Ce(t.data, e, n)
873
914
  })), [
874
915
  s,
875
916
  e,
876
- t
877
- ]), m = k(() => h(l, {
917
+ n
918
+ ]), m = j(() => y(l, {
878
919
  style: "percent",
879
920
  minimumFractionDigits: 1,
880
921
  maximumFractionDigits: 1
881
- }).full, [l]), _ = k(() => {
882
- let t = oe(f.map((t) => $(t, e))).filter((e) => e !== null);
922
+ }).full, [l]), h = j(() => {
923
+ let t = ue(f.map((t) => Q(t, e))).filter((e) => e !== null);
883
924
  return t.length ? Math.min(...t) : null;
884
925
  }, [f, e]);
885
- return /* @__PURE__ */ N(g, {
886
- ...u,
926
+ return /* @__PURE__ */ P(b, {
927
+ ...d,
887
928
  data: o,
888
929
  ranges: p,
889
- delta: c ?? (o ? ye(o, e, t) : void 0),
930
+ delta: c ?? (o ? Ce(o, e, n) : void 0),
890
931
  locale: l,
891
932
  aggregate: "last",
892
933
  headlineSeries: e,
893
934
  pillSeries: e,
894
935
  tiles: !1,
895
- restCaption: t ? () => "over basis" : void 0,
936
+ restCaption: n ? () => "over basis" : void 0,
896
937
  series: [{
897
938
  key: e,
898
- label: n
899
- }, ...t ? [{
900
- key: t,
939
+ label: r
940
+ }, ...n ? [{
941
+ key: n,
901
942
  label: "Basis",
902
943
  dashed: !0
903
944
  }] : []],
904
945
  shape: {
905
946
  kind: "marks",
906
- id: `portfolio:${e}:${t}:${r}`,
947
+ id: `portfolio:${e}:${n}:${i}`,
907
948
  includeZero: !1,
908
- xAxis: !r,
909
- series: (e) => e === t ? {
949
+ xAxis: !i,
950
+ series: (e) => e === n ? {
910
951
  curve: "step-after",
911
952
  color: "var(--lilt-muted)"
912
953
  } : {
913
954
  area: { treatment: "fade" },
914
955
  curve: "monotone"
915
956
  },
916
- draw: (e) => e.map((e) => [/* @__PURE__ */ N(d, { series: e }, `area-${e}`), /* @__PURE__ */ N(i, { series: e }, e)])
957
+ draw: (e) => e.map((e) => [/* @__PURE__ */ P(t, { series: e }, `area-${e}`), /* @__PURE__ */ P(u, { series: e }, e)])
917
958
  },
918
- panes: r ? (t) => {
919
- let n = oe(t.data.map((t) => $(t, e))), r = new Map(t.data.map((e, t) => [e, n[t] ?? null]));
920
- return /* @__PURE__ */ P(G, {
921
- context: t,
922
- label: `${u.title} drawdown`,
959
+ panes: i ? (n) => {
960
+ let r = ue(n.data.map((t) => Q(t, e))), i = new Map(n.data.map((e, t) => [e, r[t] ?? null]));
961
+ return /* @__PURE__ */ F(K, {
962
+ context: n,
963
+ label: `${d.title} drawdown`,
923
964
  caption: "Drawdown",
924
- readout: (e) => /* @__PURE__ */ P(M, { children: [/* @__PURE__ */ N("span", {
965
+ readout: (e) => /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("span", {
925
966
  className: "lilt-card__pane-value",
926
- children: r.get(e) == null ? "—" : m(r.get(e))
927
- }), _ === null ? null : /* @__PURE__ */ P("span", {
967
+ children: i.get(e) == null ? "—" : m(i.get(e))
968
+ }), h === null ? null : /* @__PURE__ */ F("span", {
928
969
  className: "lilt-card__pane-value",
929
- children: ["Max ", m(_)]
970
+ children: ["Max ", m(h)]
930
971
  })] }),
931
972
  height: a,
932
973
  xAxis: !0,
@@ -938,125 +979,125 @@ function be({ value: e, basis: t, label: n = "Value", drawdown: r = !0, drawdown
938
979
  series: [{
939
980
  id: "drawdown",
940
981
  label: "Drawdown",
941
- accessor: (e) => r.get(e) ?? null,
982
+ accessor: (e) => i.get(e) ?? null,
942
983
  color: "var(--lilt-candle-down)",
943
984
  formatValue: m,
944
985
  area: { treatment: "fade" },
945
986
  line: { width: 1.5 },
946
987
  curve: "monotone"
947
988
  }],
948
- children: [/* @__PURE__ */ N(d, { series: "drawdown" }), /* @__PURE__ */ N(i, { series: "drawdown" })]
989
+ children: [/* @__PURE__ */ P(t, { series: "drawdown" }), /* @__PURE__ */ P(u, { series: "drawdown" })]
949
990
  });
950
991
  } : void 0
951
992
  });
952
993
  }
953
994
  //#endregion
954
995
  //#region src/finance/cards/price-chart-card.tsx
955
- function xe(e, t) {
996
+ function Te(e, t) {
956
997
  let n = e[t];
957
998
  return typeof n == "number" && Number.isFinite(n) ? n : null;
958
999
  }
959
- function Se(e, t) {
960
- let n = e.map((e) => xe(e, t)).filter((e) => e !== null);
1000
+ function $(e, t) {
1001
+ let n = e.map((e) => Te(e, t)).filter((e) => e !== null);
961
1002
  return n.length > 1 ? {
962
1003
  first: n[0],
963
1004
  last: n.at(-1)
964
1005
  } : null;
965
1006
  }
966
- function Ce(e, t) {
1007
+ function Ee(e, t) {
967
1008
  let n = e.map((e) => ({ ...e }));
968
- for (let r of t) se(e.map((e) => xe(e, r))).forEach((e, t) => n[t][`__rebased${r}`] = e);
1009
+ for (let r of t) de(e.map((e) => Te(e, r))).forEach((e, t) => n[t][`__rebased${r}`] = e);
969
1010
  return n;
970
1011
  }
971
- var we = {
1012
+ var De = {
972
1013
  style: "currency",
973
1014
  currency: "USD",
974
1015
  minimumFractionDigits: 2,
975
1016
  maximumFractionDigits: 2
976
1017
  };
977
- function Te({ price: e, symbol: t, name: n, icon: r, display: a = "area", versus: o, data: s, ranges: c, delta: u, valueFormat: f = we, locale: p = "en-US", title: m, ..._ }) {
978
- let v = !!o?.length, y = k(() => [e, ...(o ?? []).map((e) => e.key)], [e, o]), b = k(() => s ? v ? Ce(s, y) : s : void 0, [
1018
+ function Oe({ price: e, symbol: n, name: r, icon: i, display: a = "area", versus: o, data: s, ranges: c, delta: l, valueFormat: d = De, locale: f = "en-US", title: p, ...h }) {
1019
+ let g = !!o?.length, _ = j(() => [e, ...(o ?? []).map((e) => e.key)], [e, o]), v = j(() => s ? g ? Ee(s, _) : s : void 0, [
979
1020
  s,
980
- v,
981
- y
982
- ]), x = k(() => c?.map((t) => {
983
- let n = Se(t.data, e);
1021
+ g,
1022
+ _
1023
+ ]), x = j(() => c?.map((t) => {
1024
+ let n = $(t.data, e);
984
1025
  return {
985
1026
  ...t,
986
- data: v ? Ce(t.data, y) : t.data,
1027
+ data: g ? Ee(t.data, _) : t.data,
987
1028
  delta: t.delta ?? (n && n.first ? n.last / n.first - 1 : void 0)
988
1029
  };
989
1030
  }), [
990
1031
  c,
991
- v,
992
- y,
1032
+ g,
1033
+ _,
993
1034
  e
994
- ]), S = Se(s ?? c?.[0]?.data ?? [], e), C = !S || S.last >= S.first, w = k(() => h(p, f).full, [p, JSON.stringify(f)]), T = k(() => h(p, {
1035
+ ]), S = $(s ?? c?.[0]?.data ?? [], e), C = !S || S.last >= S.first, w = j(() => y(f, d).full, [f, JSON.stringify(d)]), T = j(() => y(f, {
995
1036
  style: "percent",
996
1037
  minimumFractionDigits: 1,
997
1038
  maximumFractionDigits: 1
998
- }).full, [p]), E = (e) => v ? `__rebased${e}` : e, D = /* @__PURE__ */ P("span", {
1039
+ }).full, [f]), E = (e) => g ? `__rebased${e}` : e, D = /* @__PURE__ */ F("span", {
999
1040
  className: "lilt-card__ticker",
1000
1041
  children: [
1001
- r ? /* @__PURE__ */ N("span", {
1042
+ i ? /* @__PURE__ */ P("span", {
1002
1043
  className: "lilt-card__ticker-icon",
1003
- children: r
1044
+ children: i
1004
1045
  }) : null,
1005
- /* @__PURE__ */ N("span", {
1046
+ /* @__PURE__ */ P("span", {
1006
1047
  className: "lilt-card__ticker-symbol",
1007
- children: t ?? m
1048
+ children: n ?? p
1008
1049
  }),
1009
- n ? /* @__PURE__ */ N("span", {
1050
+ r ? /* @__PURE__ */ P("span", {
1010
1051
  className: "lilt-card__ticker-name",
1011
- children: n
1052
+ children: r
1012
1053
  }) : null
1013
1054
  ]
1014
1055
  });
1015
- return /* @__PURE__ */ N(g, {
1016
- ..._,
1017
- title: m,
1056
+ return /* @__PURE__ */ P(b, {
1057
+ ...h,
1058
+ title: p,
1018
1059
  heading: D,
1019
- data: b,
1060
+ data: v,
1020
1061
  ranges: x,
1021
- delta: v ? void 0 : u ?? (s && S && S.first ? S.last / S.first - 1 : void 0),
1022
- valueFormat: v ? {
1062
+ delta: g ? void 0 : l ?? (s && S && S.first ? S.last / S.first - 1 : void 0),
1063
+ valueFormat: g ? {
1023
1064
  style: "percent",
1024
1065
  maximumFractionDigits: 1
1025
- } : f,
1026
- formatValue: v ? (e) => l(T)(e) : void 0,
1027
- locale: p,
1066
+ } : d,
1067
+ formatValue: g ? (e) => m(T)(e) : void 0,
1068
+ locale: f,
1028
1069
  aggregate: "last",
1029
1070
  headlineSeries: E(e),
1030
- pillSeries: v ? "nearest" : E(e),
1031
- tiles: v,
1032
- restCaption: v ? void 0 : (t) => {
1033
- let n = Se(t, e);
1034
- return n ? l(w)(n.last - n.first) : null;
1071
+ pillSeries: g ? "nearest" : E(e),
1072
+ tiles: g,
1073
+ restCaption: g ? void 0 : (t) => {
1074
+ let n = $(t, e);
1075
+ return n ? m(w)(n.last - n.first) : null;
1035
1076
  },
1036
1077
  series: [{
1037
1078
  key: E(e),
1038
- label: t ?? m,
1039
- color: v ? void 0 : C ? F : I
1079
+ label: n ?? p,
1080
+ color: g ? void 0 : C ? I : L
1040
1081
  }, ...(o ?? []).map((e) => ({
1041
1082
  ...e,
1042
1083
  key: E(e.key)
1043
1084
  }))],
1044
1085
  shape: {
1045
1086
  kind: "marks",
1046
- id: `price:${a}:${y.join()}:${v}`,
1047
- includeZero: v,
1048
- series: () => a === "area" && !v ? {
1087
+ id: `price:${a}:${_.join()}:${g}`,
1088
+ includeZero: g,
1089
+ series: () => a === "area" && !g ? {
1049
1090
  area: { treatment: "fade" },
1050
1091
  curve: "monotone"
1051
1092
  } : { curve: "monotone" },
1052
- draw: (e) => e.map((e) => a === "area" && !v ? [/* @__PURE__ */ N(d, { series: e }, `area-${e}`), /* @__PURE__ */ N(i, { series: e }, e)] : /* @__PURE__ */ N(i, { series: e }, e))
1093
+ draw: (e) => e.map((e) => a === "area" && !g ? [/* @__PURE__ */ P(t, { series: e }, `area-${e}`), /* @__PURE__ */ P(u, { series: e }, e)] : /* @__PURE__ */ P(u, { series: e }, e))
1053
1094
  },
1054
- bleed: _.bleed ?? !0
1095
+ bleed: h.bleed ?? !0
1055
1096
  });
1056
1097
  }
1057
1098
  //#endregion
1058
1099
  //#region src/finance/order-book.tsx
1059
- function Ee(e, t, n) {
1100
+ function ke(e, t, n) {
1060
1101
  let r = /* @__PURE__ */ new Map();
1061
1102
  for (let t of e) Number.isFinite(t.price) && Number.isFinite(t.size) && t.size > 0 && r.set(t.price, (r.get(t.price) ?? 0) + t.size);
1062
1103
  let i = [...r].map(([e, t]) => ({
@@ -1069,9 +1110,9 @@ function Ee(e, t, n) {
1069
1110
  side: t
1070
1111
  }));
1071
1112
  }
1072
- function De(e, t) {
1073
- let n = A(null), [r, i] = j(/* @__PURE__ */ new Set());
1074
- return O(() => {
1113
+ function Ae(e, t) {
1114
+ let n = te(null), [r, i] = M(/* @__PURE__ */ new Set());
1115
+ return ee(() => {
1075
1116
  let r = new Map(e.map((e) => [`${e.side}:${e.price}`, e.size])), a = n.current;
1076
1117
  if (n.current = r, !t || !a) return;
1077
1118
  let o = new Set([...r].filter(([e, t]) => a.get(e) !== t).map(([e]) => e));
@@ -1081,78 +1122,82 @@ function De(e, t) {
1081
1122
  return () => window.clearTimeout(s);
1082
1123
  }, [e, t]), r;
1083
1124
  }
1084
- function Oe({ title: e, bids: t, asks: n, depth: r = 8, valueFormat: i = {
1125
+ function je({ title: e, bids: t, asks: n, levels: r = 8, depth: i = !1, valueFormat: a = {
1085
1126
  minimumFractionDigits: 2,
1086
1127
  maximumFractionDigits: 2
1087
- }, sizeFormat: a, locale: o = "en-US", flash: s = !0, surface: c, motion: l, className: u, style: d }) {
1088
- let f = S(l ?? "auto"), p = JSON.stringify(i), m = JSON.stringify(a ?? null), g = k(() => h(o, i).full, [o, p]), _ = k(() => h(o, a).compact, [o, m]), v = k(() => h(o, {
1128
+ }, sizeFormat: o, locale: s = "en-US", flash: c = !0, surface: l, motion: u, className: d, style: f }) {
1129
+ let p = T(u ?? "auto"), m = JSON.stringify(a), h = JSON.stringify(o ?? null), g = j(() => y(s, a).full, [s, m]), _ = j(() => y(s, o).compact, [s, h]), v = j(() => y(s, {
1089
1130
  style: "percent",
1090
1131
  maximumFractionDigits: 3
1091
- }).full, [o]), y = k(() => Ee(t, "bid", r), [t, r]), b = k(() => Ee(n, "ask", r), [n, r]), x = De(k(() => [...b, ...y], [b, y]), s && !f), C = Math.max(1, b.at(-1)?.total ?? 0, y.at(-1)?.total ?? 0), w = y[0]?.price, T = b[0]?.price, E = w !== void 0 && T !== void 0 ? {
1092
- value: T - w,
1093
- mid: (T + w) / 2
1094
- } : null, O = (e) => /* @__PURE__ */ P("tr", {
1132
+ }).full, [s]), b = j(() => ke(t, "bid", r), [t, r]), x = j(() => ke(n, "ask", r), [n, r]), S = Ae(j(() => [...x, ...b], [x, b]), c && !p), C = Math.max(1, x.at(-1)?.total ?? 0, b.at(-1)?.total ?? 0), w = b[0]?.price, E = x[0]?.price, D = w !== void 0 && E !== void 0 ? {
1133
+ value: E - w,
1134
+ mid: (E + w) / 2
1135
+ } : null, O = (e) => /* @__PURE__ */ F("tr", {
1095
1136
  className: "lilt-order-book__level",
1096
1137
  "data-side": e.side,
1097
- "data-flash": x.has(`${e.side}:${e.price}`) || void 0,
1138
+ "data-flash": S.has(`${e.side}:${e.price}`) || void 0,
1098
1139
  style: { "--lilt-depth": `${e.total / C * 100}%` },
1099
1140
  children: [
1100
- /* @__PURE__ */ N("th", {
1141
+ /* @__PURE__ */ F("th", {
1101
1142
  scope: "row",
1102
- children: g(e.price)
1143
+ children: [i ? /* @__PURE__ */ P("span", {
1144
+ className: "lilt-order-book__bar",
1145
+ "aria-hidden": "true"
1146
+ }) : null, g(e.price)]
1103
1147
  }),
1104
- /* @__PURE__ */ N("td", { children: _(e.size) }),
1105
- /* @__PURE__ */ N("td", { children: _(e.total) })
1148
+ /* @__PURE__ */ P("td", { children: _(e.size) }),
1149
+ /* @__PURE__ */ P("td", { children: _(e.total) })
1106
1150
  ]
1107
1151
  }, `${e.side}:${e.price}`);
1108
- return /* @__PURE__ */ N(D, {
1152
+ return /* @__PURE__ */ P(A, {
1109
1153
  "aria-label": e,
1110
- surface: c,
1111
- motion: l,
1112
- className: ["lilt-card--order-book", u].filter(Boolean).join(" "),
1113
- style: d,
1114
- children: /* @__PURE__ */ P("table", {
1154
+ surface: l,
1155
+ motion: u,
1156
+ className: ["lilt-card--order-book", d].filter(Boolean).join(" "),
1157
+ style: f,
1158
+ children: /* @__PURE__ */ F("table", {
1115
1159
  className: "lilt-order-book",
1160
+ "data-depth": i || void 0,
1116
1161
  children: [
1117
- /* @__PURE__ */ N("caption", { children: e }),
1118
- /* @__PURE__ */ N("thead", { children: /* @__PURE__ */ P("tr", { children: [
1119
- /* @__PURE__ */ N("th", {
1162
+ /* @__PURE__ */ P("caption", { children: e }),
1163
+ /* @__PURE__ */ P("thead", { children: /* @__PURE__ */ F("tr", { children: [
1164
+ /* @__PURE__ */ P("th", {
1120
1165
  scope: "col",
1121
1166
  children: "Price"
1122
1167
  }),
1123
- /* @__PURE__ */ N("th", {
1168
+ /* @__PURE__ */ P("th", {
1124
1169
  scope: "col",
1125
1170
  children: "Size"
1126
1171
  }),
1127
- /* @__PURE__ */ N("th", {
1172
+ /* @__PURE__ */ P("th", {
1128
1173
  scope: "col",
1129
1174
  children: "Total"
1130
1175
  })
1131
1176
  ] }) }),
1132
- /* @__PURE__ */ N("tbody", {
1177
+ /* @__PURE__ */ P("tbody", {
1133
1178
  "aria-label": "Asks",
1134
- children: [...b].reverse().map(O)
1179
+ children: [...x].reverse().map(O)
1135
1180
  }),
1136
- /* @__PURE__ */ N("tbody", {
1181
+ /* @__PURE__ */ P("tbody", {
1137
1182
  "aria-label": "Spread",
1138
- children: /* @__PURE__ */ P("tr", {
1183
+ children: /* @__PURE__ */ F("tr", {
1139
1184
  className: "lilt-order-book__spread",
1140
- children: [/* @__PURE__ */ N("th", {
1185
+ children: [/* @__PURE__ */ P("th", {
1141
1186
  scope: "row",
1142
- children: E ? g(E.mid) : "—"
1143
- }), /* @__PURE__ */ N("td", {
1187
+ children: D ? g(D.mid) : "—"
1188
+ }), /* @__PURE__ */ P("td", {
1144
1189
  colSpan: 2,
1145
- children: E ? `Spread ${g(E.value)} · ${v(E.value / E.mid)}` : "No spread"
1190
+ children: D ? `Spread ${g(D.value)} · ${v(D.value / D.mid)}` : "No spread"
1146
1191
  })]
1147
1192
  })
1148
1193
  }),
1149
- /* @__PURE__ */ N("tbody", {
1194
+ /* @__PURE__ */ P("tbody", {
1150
1195
  "aria-label": "Bids",
1151
- children: y.map(O)
1196
+ children: b.map(O)
1152
1197
  })
1153
1198
  ]
1154
1199
  })
1155
1200
  });
1156
1201
  }
1157
1202
  //#endregion
1158
- export { W as Candles, ne as CandlestickChartCard, ve as DepthChartCard, he as IndicatorChartCard, Oe as OrderBook, be as PortfolioChartCard, Te as PriceChartCard, ae as bollinger, le as depthLevels, oe as drawdown, Z as ema, ie as macd, se as rebase, re as rsi, X as sma };
1203
+ export { G as Candles, ie as CandlestickChartCard, Se as DepthChartCard, ye as IndicatorChartCard, je as OrderBook, we as PortfolioChartCard, Oe as PriceChartCard, le as bollinger, pe as depthLevels, ue as drawdown, X as ema, ce as macd, de as rebase, se as rsi, oe as sma };