@wick-charts/vue 0.7.0 → 0.8.1

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.
@@ -2,20 +2,20 @@ import { Animator as nt } from "../animation/animator.js";
2
2
  import { DEFAULT_HISTORY_REVEAL as it, DEFAULT_CANDLESTICK_INTRO as et, DEFAULT_CANDLESTICK_SMOOTH as ot, DEFAULT_CANDLESTICK_ENTRY as st } from "../animation/config.js";
3
3
  import { easeOutCubic as at } from "../animation/easing.js";
4
4
  import { IntroWave as U } from "../animation/intro-wave.js";
5
- import { ScalarSpring as $ } from "../animation/scalar-spring.js";
5
+ import { ScalarSpring as H } from "../animation/scalar-spring.js";
6
6
  import { decimateOHLCData as rt } from "../data/decimation.js";
7
7
  import { TimeSeriesStore as lt } from "../data/store.js";
8
- import { resolveCandlestickBodyColor as I } from "../theme/resolve.js";
8
+ import { resolveCandlestickBodyColor as N } from "../theme/resolve.js";
9
9
  import { hexToRgba as K, mixColors as G } from "../utils/color.js";
10
10
  import { clamp as F, lerp as z } from "../utils/math.js";
11
- import { isPoisonedNumber as N, reportPoisonedData as ht } from "../utils/poisoned-data-reporter.js";
12
- import { normalizeOHLCArray as J, normalizeTime as Q } from "../utils/time.js";
11
+ import { isPoisonedNumber as $, reportPoisonedData as ht } from "../utils/poisoned-data-reporter.js";
12
+ import { normalizeOHLCArray as J, normalizeTime as Q, sliceSample as mt } from "../utils/time.js";
13
13
  import { candleUnfoldIntro as ct } from "./candlestick-intro.js";
14
14
  import { fillRoundedRect as Z } from "./painters/canvas-path.js";
15
- import { resolveCandlePainter as mt } from "./painters/resolve.js";
16
- import { fadeIntro as pt } from "./wave-intro.js";
17
- const ut = 0.15, dt = 5e-3;
18
- class ft {
15
+ import { resolveCandlePainter as pt } from "./painters/resolve.js";
16
+ import { fadeIntro as ut } from "./wave-intro.js";
17
+ const dt = 0.15, ft = 5e-3;
18
+ class bt {
19
19
  #t;
20
20
  #i;
21
21
  #s;
@@ -27,7 +27,7 @@ class ft {
27
27
  // volume-less and the histogram keeps skipping it.
28
28
  #l;
29
29
  constructor(t) {
30
- this.#t = new $(t.open), this.#i = new $(t.high), this.#s = new $(t.low), this.#r = new $(t.close), this.#e = new $(t.volume ?? 0), this.#n = t.time, this.#l = t.volume !== void 0;
30
+ this.#t = new H(t.open), this.#i = new H(t.high), this.#s = new H(t.low), this.#r = new H(t.close), this.#e = new H(t.volume ?? 0), this.#n = t.time, this.#l = t.volume !== void 0;
31
31
  }
32
32
  retarget(t, i = {}) {
33
33
  this.#n = t.time, t.volume !== void 0 && (this.#l = !0), this.#t.retarget(t.open, i), this.#i.retarget(t.high, i), this.#s.retarget(t.low, i), this.#r.retarget(t.close, i), this.#e.retarget(t.volume ?? 0, i);
@@ -47,11 +47,11 @@ class ft {
47
47
  return this.#l && (t.volume = this.#e.current), t;
48
48
  }
49
49
  }
50
- const _ = 2, bt = { tl: !0, tr: !0, br: !0, bl: !0 }, j = { tl: !0, tr: !0, br: !1, bl: !1 }, Yt = ct(), gt = pt(), yt = {
50
+ const O = 2, Yt = { tl: !0, tr: !0, br: !0, bl: !0 }, j = { tl: !0, tr: !0, br: !1, bl: !1 }, gt = ct(), xt = ut(), yt = {
51
51
  up: { body: "#26a69a", wick: "#26a69a" },
52
52
  down: { body: "#ef5350", wick: "#ef5350" },
53
53
  bodyWidthRatio: 0.6,
54
- cornerRadius: _,
54
+ cornerRadius: O,
55
55
  entryMs: st,
56
56
  smoothMs: ot,
57
57
  introMs: et,
@@ -69,7 +69,7 @@ function tt(a) {
69
69
  historyRevealMs: a.historyRevealMs === !1 ? 0 : a.historyRevealMs ?? it
70
70
  };
71
71
  }
72
- class xt {
72
+ class vt {
73
73
  kind = "candlestick";
74
74
  store;
75
75
  options;
@@ -120,11 +120,11 @@ class xt {
120
120
  * they were measured against) — mapped into bitmap space each frame and
121
121
  * exposed to the reveal fn as {@link CandleIntroFrame.placeholders}.
122
122
  * Cleared once the reveal settles. */
123
- #c = null;
123
+ #m = null;
124
124
  /** Body gradients keyed by `top|bottom|height` — built once at y=0..h and
125
125
  * positioned per candle via `ctx.translate`, instead of a fresh
126
126
  * `createLinearGradient` for every body on every frame. */
127
- #m = /* @__PURE__ */ new Map();
127
+ #c = /* @__PURE__ */ new Map();
128
128
  constructor(t, i) {
129
129
  this.store = t, this.options = tt({ ...yt, ...i }), this.displayedLast = t.last() ?? null;
130
130
  }
@@ -135,14 +135,14 @@ class xt {
135
135
  this.options = tt({ ...this.options, ...t });
136
136
  }
137
137
  getColor() {
138
- return I(this.options.up.body);
138
+ return N(this.options.up.body);
139
139
  }
140
140
  // --- SeriesRenderer interface implementation ------------------------------
141
141
  setData(t) {
142
142
  const i = this.store.length > 0;
143
143
  this.store.setData(J(t ?? [])), !i && this.store.length > 0 && this.introWave.arm(this.options.introMs);
144
144
  const e = this.store.last();
145
- this.displayedLast = e ?? null, this.#t = null, this.entries.clear(), this.#i = null, this.#o.finish(), this.#a = null, this.#c = null;
145
+ this.displayedLast = e ?? null, this.#t = null, this.entries.clear(), this.#i = null, this.#o.finish(), this.#a = null, this.#m = null;
146
146
  }
147
147
  appendPoint(t) {
148
148
  const i = t, e = Q(i.time), o = { ...i, time: e };
@@ -172,7 +172,7 @@ class xt {
172
172
  }
173
173
  setHistoryHandoff(t) {
174
174
  const i = this.store.first()?.time;
175
- i !== void 0 && (this.#c = { bars: t, anchorTime: i });
175
+ i !== void 0 && (this.#m = { bars: t, anchorTime: i });
176
176
  }
177
177
  updateLastPoint(t) {
178
178
  const i = t, e = Q(i.time), o = { ...i, time: e };
@@ -185,7 +185,7 @@ class xt {
185
185
  let n = this.#t;
186
186
  if (n === null) {
187
187
  const l = this.displayedLast ?? o;
188
- n = new ft(l), this.#t = n;
188
+ n = new bt(l), this.#t = n;
189
189
  }
190
190
  n.retarget(o, { settleMs: h });
191
191
  }
@@ -203,7 +203,7 @@ class xt {
203
203
  return !0;
204
204
  }
205
205
  getLayerColors() {
206
- return [I(this.options.up.body)];
206
+ return [N(this.options.up.body)];
207
207
  }
208
208
  applyTheme(t, i) {
209
209
  this.updateOptions({
@@ -223,7 +223,7 @@ class xt {
223
223
  * fully-settled entrance entries. Called from `render()` once per frame.
224
224
  */
225
225
  tickAnimations(t) {
226
- this.introWave.tick(t), this.#o.tick(t), this.#o.active || (this.#c = null), this.#e.tick(t);
226
+ this.introWave.tick(t), this.#o.tick(t), this.#o.active || (this.#m = null), this.#e.tick(t);
227
227
  const i = this.#t;
228
228
  if (i !== null) {
229
229
  const o = i.tick(t);
@@ -276,8 +276,8 @@ class xt {
276
276
  const t = this.store.getAll();
277
277
  return t.length >= 2 ? t[t.length - 2] : null;
278
278
  }
279
- sampleTimes(t) {
280
- return this.store.getAll().slice(0, t).map((i) => i.time);
279
+ sampleTimes(t, i = "start") {
280
+ return mt(this.store.getAll(), { maxCount: t, from: i }).map((e) => e.time);
281
281
  }
282
282
  getVisibleDataPoints(t, i) {
283
283
  return this.store.getVisibleData(t, i);
@@ -292,16 +292,16 @@ class xt {
292
292
  render(t) {
293
293
  this.tickAnimations(performance.now());
294
294
  const { scope: i, timeScale: e, yScale: o, dataInterval: h } = t, { context: n, horizontalPixelRatio: l } = i, p = e.getRange();
295
- let m = this.store.getVisibleData(p.from, p.to);
296
- const Y = i.mediaSize.width, M = m.length > Y * 2;
297
- if (M && (m = rt(m, Math.round(Y * 1.5))), o.getTransform() !== null && (m = m.filter((r) => q(r, (c) => o.isPlottable(c)))), m.length === 0) return;
295
+ let c = this.store.getVisibleData(p.from, p.to);
296
+ const Y = i.mediaSize.width, M = c.length > Y * 2;
297
+ if (M && (c = rt(c, Math.round(Y * 1.5))), o.getTransform() !== null && (c = c.filter((r) => q(r, (m) => o.isPlottable(m)))), c.length === 0) return;
298
298
  const S = this.displayedLast;
299
299
  if (!M && S !== null) {
300
- const r = m.length - 1;
301
- m[r].time === S.time && (m = [...m.slice(0, r), S]);
300
+ const r = c.length - 1;
301
+ c[r].time === S.time && (c = [...c.slice(0, r), S]);
302
302
  }
303
303
  if (this.#n = null, this.#l = null, this.introWave.active) {
304
- const r = this.options.introAnimation ?? Yt;
304
+ const r = this.options.introAnimation ?? gt;
305
305
  this.#l = p, this.#n = r({
306
306
  progress: this.introWave.linear(),
307
307
  // Plot-area extent, not the canvas bitmap — the canvas also carries
@@ -310,19 +310,19 @@ class xt {
310
310
  width: e.getMediaWidth() * i.horizontalPixelRatio,
311
311
  height: o.getMediaHeight() * i.verticalPixelRatio,
312
312
  range: p,
313
- timeToX: (c) => e.timeToBitmapX(c)
313
+ timeToX: (m) => e.timeToBitmapX(m)
314
314
  });
315
315
  }
316
316
  this.#h = null;
317
317
  const u = this.#a;
318
318
  if (this.#o.active && u !== null) {
319
- const r = this.options.historyReveal ?? gt;
319
+ const r = this.options.historyReveal ?? xt;
320
320
  if (r !== "none") {
321
- let c;
322
- const x = this.#c;
323
- if (x !== null && x.bars.length > 0) {
324
- const P = e.timeToBitmapX(x.anchorTime);
325
- c = x.bars.map((k) => ({
321
+ let m;
322
+ const y = this.#m;
323
+ if (y !== null && y.bars.length > 0) {
324
+ const P = e.timeToBitmapX(y.anchorTime);
325
+ m = y.bars.map((k) => ({
326
326
  x: P - k.offsetX * i.horizontalPixelRatio,
327
327
  y: k.y * i.verticalPixelRatio,
328
328
  halfHeight: k.halfHeight * i.verticalPixelRatio,
@@ -335,68 +335,68 @@ class xt {
335
335
  height: o.getMediaHeight() * i.verticalPixelRatio,
336
336
  range: u,
337
337
  timeToX: (P) => e.timeToBitmapX(P),
338
- placeholders: c
338
+ placeholders: m
339
339
  });
340
340
  }
341
341
  }
342
342
  let W = null;
343
343
  if (this.entries.size > 0) {
344
- const r = this.options.entryMs, c = performance.now();
345
- for (const x of m) {
346
- const P = this.entries.get(x.time);
344
+ const r = this.options.entryMs, m = performance.now();
345
+ for (const y of c) {
346
+ const P = this.entries.get(y.time);
347
347
  if (P === void 0 || r <= 0) continue;
348
- const k = c - P.startTime, V = Math.min(1, Math.max(0, k / r));
349
- V >= 1 || (W === null && (W = /* @__PURE__ */ new Map()), W.set(x.time, at(V)));
348
+ const k = m - P.startTime, V = Math.min(1, Math.max(0, k / r));
349
+ V >= 1 || (W === null && (W = /* @__PURE__ */ new Map()), W.set(y.time, at(V)));
350
350
  }
351
351
  }
352
- const X = e.barWidthBitmap(h), b = Math.round(30 * l), w = m.length <= 2 ? Math.min(b, X) : X, f = Math.max(1, Math.round(l));
352
+ const X = e.barWidthBitmap(h), b = Math.round(30 * l), w = c.length <= 2 ? Math.min(b, X) : X, f = Math.max(1, Math.round(l));
353
353
  let g = Math.max(1, Math.round(w * this.options.bodyWidthRatio) - 2);
354
354
  (g & 1) !== (f & 1) && (g = g > 1 ? g - 1 : 2);
355
355
  const R = Math.floor(g / 2), v = this.#n?.clip;
356
356
  if (v !== void 0) {
357
- const r = v.fromX ?? 0, c = v.toX ?? i.bitmapSize.width;
358
- n.save(), n.beginPath(), n.rect(r, 0, Math.max(0, c - r), i.bitmapSize.height), n.clip();
357
+ const r = v.fromX ?? 0, m = v.toX ?? i.bitmapSize.width;
358
+ n.save(), n.beginPath(), n.rect(r, 0, Math.max(0, m - r), i.bitmapSize.height), n.clip();
359
359
  }
360
360
  const T = this.#h?.clip;
361
361
  let A = !1;
362
362
  if (T !== void 0 && u !== null) {
363
- const r = e.timeToBitmapX(u.to), c = Math.abs(r - e.timeToBitmapX(u.from)), x = w, P = T.fromX ?? 0, k = T.toX ?? c;
364
- n.save(), n.beginPath(), n.rect(r - k - x, 0, Math.max(0, k - P + x), i.bitmapSize.height), n.rect(r, 0, Math.max(0, i.bitmapSize.width - r), i.bitmapSize.height), n.clip(), A = !0;
363
+ const r = e.timeToBitmapX(u.to), m = Math.abs(r - e.timeToBitmapX(u.from)), y = w, P = T.fromX ?? 0, k = T.toX ?? m;
364
+ n.save(), n.beginPath(), n.rect(r - k - y, 0, Math.max(0, k - P + y), i.bitmapSize.height), n.rect(r, 0, Math.max(0, i.bitmapSize.width - r), i.bitmapSize.height), n.clip(), A = !0;
365
365
  }
366
366
  const s = M !== this.#r;
367
367
  this.#r = M;
368
368
  const d = Math.round(o.getMediaHeight() * i.verticalPixelRatio);
369
369
  this.drawVolume({
370
370
  ctx: n,
371
- data: m,
371
+ data: c,
372
372
  timeScale: e,
373
373
  chartHeight: d,
374
374
  barWidth: w,
375
375
  wickWidth: f,
376
376
  entranceByTime: W,
377
377
  snapVolScale: s,
378
- radius: (this.options.cornerRadius ?? _) * l
378
+ radius: (this.options.cornerRadius ?? O) * l
379
379
  });
380
- const y = [], L = [], B = [];
381
- let C = null;
382
- for (let r = 0; r < m.length; r++) {
383
- const c = m[r];
384
- if (N(c.open) || N(c.close) || N(c.high) || N(c.low)) {
385
- B.push(r), C === null && (C = c);
380
+ const x = [], C = [], B = [];
381
+ let L = null;
382
+ for (let r = 0; r < c.length; r++) {
383
+ const m = c[r];
384
+ if ($(m.open) || $(m.close) || $(m.high) || $(m.low)) {
385
+ B.push(r), L === null && (L = m);
386
386
  continue;
387
387
  }
388
- c.close >= c.open ? y.push(c) : L.push(c);
388
+ m.close >= m.open ? x.push(m) : C.push(m);
389
389
  }
390
- C !== null && ht(this, "candlestick", B, `time ${C.time}`);
390
+ L !== null && ht(this, "candlestick", B, `time ${L.time}`);
391
391
  const E = {
392
- painter: mt(this.options.candlePainter),
392
+ painter: pt(this.options.candlePainter),
393
393
  env: {
394
394
  ctx: n,
395
395
  theme: t.theme,
396
396
  horizontalPixelRatio: l,
397
397
  verticalPixelRatio: i.verticalPixelRatio
398
398
  },
399
- radius: (this.options.cornerRadius ?? _) * l
399
+ radius: (this.options.cornerRadius ?? O) * l
400
400
  }, D = {
401
401
  ctx: n,
402
402
  timeScale: e,
@@ -409,12 +409,12 @@ class xt {
409
409
  };
410
410
  this.drawCandles({
411
411
  ...D,
412
- candles: y,
412
+ candles: x,
413
413
  body: this.options.up.body,
414
414
  wickColor: this.options.up.wick
415
415
  }), this.drawCandles({
416
416
  ...D,
417
- candles: L,
417
+ candles: C,
418
418
  body: this.options.down.body,
419
419
  wickColor: this.options.down.wick
420
420
  }), A && n.restore(), v !== void 0 && n.restore();
@@ -427,7 +427,7 @@ class xt {
427
427
  introTransform(t) {
428
428
  const i = this.#h?.element, e = this.#a;
429
429
  if (i !== void 0 && e !== null && t.time < e.to) {
430
- const m = e.to - e.from, Y = m > 0 ? F((e.to - t.time) / m, 0, 1) : 0, M = i({ ...t, position: Y, progress: this.#o.progressAt(Y) });
430
+ const c = e.to - e.from, Y = c > 0 ? F((e.to - t.time) / c, 0, 1) : 0, M = i({ ...t, position: Y, progress: this.#o.progressAt(Y) });
431
431
  return this.#p(M, t);
432
432
  }
433
433
  const o = this.#n?.element, h = this.#l;
@@ -458,7 +458,7 @@ class xt {
458
458
  wickWidth: n,
459
459
  entranceByTime: l,
460
460
  snapVolScale: p,
461
- radius: m
461
+ radius: c
462
462
  }) {
463
463
  let Y = 0;
464
464
  for (const f of i)
@@ -467,11 +467,11 @@ class xt {
467
467
  this.#i = null, this.#s = !0;
468
468
  return;
469
469
  }
470
- this.#i === null || p ? this.#i = Y : this.#i += (Y - this.#i) * ut, this.#s = Math.abs(Y - this.#i) <= Y * dt;
470
+ this.#i === null || p ? this.#i = Y : this.#i += (Y - this.#i) * dt, this.#s = Math.abs(Y - this.#i) <= Y * ft;
471
471
  const M = this.#i, S = o * 0.2;
472
472
  let u = Math.max(1, h - 2);
473
473
  (u & 1) !== (n & 1) && (u = u > 1 ? u - 1 : 2);
474
- const W = Math.floor(u / 2), X = K(I(this.options.up.body), 0.2), b = K(I(this.options.down.body), 0.2), w = this.options.entryAnimation ?? "unfold";
474
+ const W = Math.floor(u / 2), X = K(N(this.options.up.body), 0.2), b = K(N(this.options.down.body), 0.2), w = this.options.entryAnimation ?? "unfold";
475
475
  for (const f of i) {
476
476
  if (!Number.isFinite(f.volume) || f.volume <= 0) continue;
477
477
  const g = f.volume, R = e.timeToBitmapX(f.time), v = Math.min(S, Math.max(1, g / M * S)), T = f.close >= f.open;
@@ -479,14 +479,14 @@ class xt {
479
479
  const A = l?.get(f.time) ?? 1;
480
480
  let s = { x: R - W, topY: o - v, bottomY: o, alpha: 1 };
481
481
  if (A < 1 && w !== "none") {
482
- const y = O(A, w, {
482
+ const x = _(A, w, {
483
483
  x: s.x,
484
484
  barWidth: u,
485
485
  anchorY: o,
486
486
  topY: s.topY,
487
487
  bottomY: s.bottomY
488
488
  });
489
- s = { x: y.x, topY: y.topY, bottomY: y.bottomY, alpha: y.alpha };
489
+ s = { x: x.x, topY: x.topY, bottomY: x.bottomY, alpha: x.alpha };
490
490
  }
491
491
  const d = this.introTransform({
492
492
  element: "volume",
@@ -503,7 +503,7 @@ class xt {
503
503
  y: s.topY,
504
504
  width: u,
505
505
  height: Math.max(1, s.bottomY - s.topY),
506
- radius: m,
506
+ radius: c,
507
507
  corners: j
508
508
  });
509
509
  continue;
@@ -513,7 +513,7 @@ class xt {
513
513
  y: s.topY,
514
514
  width: u,
515
515
  height: Math.max(1, s.bottomY - s.topY),
516
- radius: m,
516
+ radius: c,
517
517
  corners: j
518
518
  }), t.restore();
519
519
  }
@@ -527,25 +527,25 @@ class xt {
527
527
  bodyWidth: n,
528
528
  wickWidth: l,
529
529
  body: p,
530
- wickColor: m,
530
+ wickColor: c,
531
531
  entranceByTime: Y,
532
532
  candlePass: M
533
533
  }) {
534
534
  if (i.length === 0) return;
535
535
  const S = this.options.entryAnimation ?? "unfold", u = n + 2, W = M.env.theme.axis.textColor ?? "#787b86";
536
- t.fillStyle = m;
536
+ t.fillStyle = c;
537
537
  for (const b of i) {
538
538
  const w = Y?.get(b.time) ?? 1, f = e.timeToBitmapX(b.time), g = o.valueToBitmapY(b.open), R = o.valueToBitmapY(b.high), v = o.valueToBitmapY(b.low), T = f - Math.floor(l / 2);
539
539
  let A = !1, s = { x: T, topY: R, bottomY: v, alpha: 1 };
540
540
  if (w < 1 && S !== "none") {
541
- const L = O(w, S, {
541
+ const C = _(w, S, {
542
542
  x: T,
543
543
  barWidth: u,
544
544
  anchorY: g,
545
545
  topY: R,
546
546
  bottomY: v
547
547
  });
548
- s = { x: L.x, topY: L.topY, bottomY: L.bottomY, alpha: L.alpha }, A = !0;
548
+ s = { x: C.x, topY: C.topY, bottomY: C.bottomY, alpha: C.alpha }, A = !0;
549
549
  }
550
550
  const d = this.introTransform({
551
551
  element: "wick",
@@ -556,52 +556,52 @@ class xt {
556
556
  anchorY: g,
557
557
  barWidth: u
558
558
  });
559
- let y = 0;
560
- if (d !== null && (s = { x: d.x, topY: d.topY, bottomY: d.bottomY, alpha: s.alpha * d.alpha }, y = d.tint ?? 0, A = !0), !A) {
559
+ let x = 0;
560
+ if (d !== null && (s = { x: d.x, topY: d.topY, bottomY: d.bottomY, alpha: s.alpha * d.alpha }, x = d.tint ?? 0, A = !0), !A) {
561
561
  t.fillRect(T, R, l, v - R);
562
562
  continue;
563
563
  }
564
- t.save(), t.globalAlpha = s.alpha, y > 0 && (t.fillStyle = G(m, W, y)), t.fillRect(s.x, s.topY, l, Math.max(1, s.bottomY - s.topY)), t.restore();
564
+ t.save(), t.globalAlpha = s.alpha, x > 0 && (t.fillStyle = G(c, W, x)), t.fillRect(s.x, s.topY, l, Math.max(1, s.bottomY - s.topY)), t.restore();
565
565
  }
566
566
  const X = Array.isArray(p);
567
567
  for (const b of i) {
568
568
  const w = Y?.get(b.time) ?? 1, f = e.timeToBitmapX(b.time), g = o.valueToBitmapY(b.open), R = o.valueToBitmapY(b.close), v = Math.min(g, R), T = Math.max(g, R), A = Math.max(1, T - v);
569
- let s = f - h, d = v, y = T, L = 1, B = !1;
569
+ let s = f - h, d = v, x = T, C = 1, B = !1;
570
570
  if (w < 1 && S !== "none") {
571
- const H = O(w, S, {
571
+ const I = _(w, S, {
572
572
  x: s,
573
573
  barWidth: u,
574
574
  anchorY: g,
575
575
  topY: v,
576
576
  bottomY: T
577
577
  });
578
- s = H.x, d = H.topY, y = H.bottomY, L = H.alpha, B = !0;
578
+ s = I.x, d = I.topY, x = I.bottomY, C = I.alpha, B = !0;
579
579
  }
580
- const C = this.introTransform({
580
+ const L = this.introTransform({
581
581
  element: "body",
582
582
  time: b.time,
583
583
  x: s,
584
584
  topY: d,
585
- bottomY: y,
585
+ bottomY: x,
586
586
  anchorY: g,
587
587
  barWidth: u
588
588
  });
589
589
  let E = 0;
590
- C !== null && (s = C.x, d = C.topY, y = C.bottomY, L *= C.alpha, E = C.tint ?? 0, B = !0);
591
- const D = B ? Math.max(1, y - d) : A;
590
+ L !== null && (s = L.x, d = L.topY, x = L.bottomY, C *= L.alpha, E = L.tint ?? 0, B = !0);
591
+ const D = B ? Math.max(1, x - d) : A;
592
592
  B && t.save();
593
- const r = Array.isArray(p) ? p[0] : p, c = E > 0 ? G(r, W, E) : r, x = X && D > 2 && E <= 0, P = x ? this.#d(t, p, D) : c;
594
- t.fillStyle = P, B && (t.globalAlpha = L), x && t.translate(0, d);
595
- const k = x ? 0 : d, V = F(M.radius, 0, Math.min(n, D) / 2);
593
+ const r = Array.isArray(p) ? p[0] : p, m = E > 0 ? G(r, W, E) : r, y = X && D > 2 && E <= 0, P = y ? this.#d(t, p, D) : m;
594
+ t.fillStyle = P, B && (t.globalAlpha = C), y && t.translate(0, d);
595
+ const k = y ? 0 : d, V = F(M.radius, 0, Math.min(n, D) / 2);
596
596
  V < 1 && !this.options.candlePainter ? t.fillRect(s, k, n, D) : M.painter(M.env, {
597
597
  geom: { x: s, y: k, width: n, height: D },
598
598
  fillStyle: P,
599
- color: c,
600
- corners: bt,
599
+ color: m,
600
+ corners: Yt,
601
601
  radius: V,
602
602
  progress: w,
603
603
  isBullish: b.close >= b.open
604
- }), x && t.translate(0, -d), B && t.restore();
604
+ }), y && t.translate(0, -d), B && t.restore();
605
605
  }
606
606
  }
607
607
  /**
@@ -612,14 +612,14 @@ class xt {
612
612
  * continuously, and a full clear is cheaper than an eviction policy.
613
613
  */
614
614
  #d(t, i, e) {
615
- const o = Math.max(3, Math.round(e)), h = `${i[0]}|${i[1]}|${o}`, n = this.#m.get(h);
615
+ const o = Math.max(3, Math.round(e)), h = `${i[0]}|${i[1]}|${o}`, n = this.#c.get(h);
616
616
  if (n !== void 0) return n;
617
- this.#m.size >= 512 && this.#m.clear();
617
+ this.#c.size >= 512 && this.#c.clear();
618
618
  const l = t.createLinearGradient(0, 0, 0, o);
619
- return l.addColorStop(0, i[0]), l.addColorStop(1, i[1]), this.#m.set(h, l), l;
619
+ return l.addColorStop(0, i[0]), l.addColorStop(1, i[1]), this.#c.set(h, l), l;
620
620
  }
621
621
  }
622
- function O(a, t, i) {
622
+ function _(a, t, i) {
623
623
  switch (t) {
624
624
  case "none":
625
625
  return { x: i.x, topY: i.topY, bottomY: i.bottomY, alpha: 1 };
@@ -648,16 +648,16 @@ function O(a, t, i) {
648
648
  };
649
649
  }
650
650
  }
651
- const zt = {
651
+ const Vt = {
652
652
  type: "candlestick",
653
653
  xTypes: ["time"],
654
- create: ({ theme: a }, t) => new xt(new lt(), {
654
+ create: ({ theme: a }, t) => new vt(new lt(), {
655
655
  up: { ...a.candlestick.up },
656
656
  down: { ...a.candlestick.down },
657
657
  ...t
658
658
  })
659
659
  };
660
660
  export {
661
- xt as CandlestickRenderer,
662
- zt as CandlestickSeriesDef
661
+ vt as CandlestickRenderer,
662
+ Vt as CandlestickSeriesDef
663
663
  };