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