@tradecanvas/chart 1.59.3 → 1.60.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.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, g as l, h as u, i as ee, l as te, m as ne, n as re, o as ie, p as ae, r as oe, s as se, t as ce, u as le, v as ue, w as de, x as fe, y as pe } from "./LayoutSession-xQgGnpGO.js";
1
+ import { C as e, D as t, E as n, S as r, T as i, _ as a, a as o, b as s, c, g as l, h as u, i as ee, l as te, m as ne, n as re, o as ie, p as ae, r as oe, s as se, t as ce, u as le, v as ue, w as de, x as fe, y as pe } from "./LayoutSession-CXCLFIvS.js";
2
2
  import { CHART_STYLE_KEYS as me, DARK_PRICE_LIMITS as he, DARK_TERMINAL as ge, DARK_THEME as _e, DARK_THEME as ve, DEFAULT_DRAWING_STYLE as ye, DEFAULT_FONT_FAMILY as be, DEFAULT_RECONNECT as xe, DEFAULT_SIGNAL_STYLE as Se, DEFAULT_STREAM_CONFIG as Ce, DEFAULT_TIMEFRAME_FAVORITES as we, DEFAULT_TRADE_ZONE_STYLE as Te, DEFAULT_TRADING_CONFIG as Ee, HNX_SESSIONS as d, HOSE_SESSIONS as f, KRX_SESSIONS as p, KR_COLORS as m, LIGHT_PRICE_LIMITS as h, LIGHT_THEME as g, LIGHT_THEME as _, MARKET_CRYPTO as v, MARKET_HNX as y, MARKET_HOSE as b, MARKET_HOSE_ETF as x, MARKET_KRX as S, MARKET_NXT as C, MARKET_NYSE as w, MARKET_UPBIT_KRW as T, MARKET_UPCOM as E, MARKET_VN30F as D, MS_TIME_THRESHOLD as De, NXT_SESSIONS as Oe, PRICE_SOURCES as ke, SANS_FONT_FAMILY as Ae, TC_PALETTE as je, TC_SERIES_COLORS as Me, TIMEFRAMES_CRYPTO as Ne, TIMEFRAMES_FOREX as Pe, TIMEFRAMES_STOCK as Fe, UPCOM_SESSIONS as Ie, VN30F_SESSIONS as Le, VN_COLORS as Re, VOLUME_ALPHA as ze, barTimeUnit as Be, barsAreDaily as Ve, computePriceLimits as He, contrastRatio as Ue, createMarketTheme as We, createVNTheme as Ge, formatFraction as Ke, formatNumber as qe, formatVND as Je, formatVolumeLoc as Ye, fractionTick as Xe, getCurrentSession as Ze, getLocale as Qe, indicatorSource as $e, inkOn as et, isPriceSource as tt, isTimeFrame as nt, isValidTimeZone as rt, marketStatus as it, normalizeBar as at, normalizeBarTime as ot, offsetAt as st, parseIndicatorSource as ct, parseTimeframe as lt, pickBaseTimeframe as ut, priceFormatterFor as dt, priceStepAt as ft, rankSymbols as pt, readNews as mt, readQuote as ht, readableOn as gt, registerLocale as _t, resampleBars as vt, roundToPriceStep as yt, scaleMarketPrices as bt, setLocale as xt, sourcePrice as St, stepDecimals as Ct, symbolTimeZone as wt, t as Tt, tickBarCount as Et, timeframeBucketStart as Dt, timeframeBucketStart as Ot, timeframeToMs as kt, usesKoreanUnits as At, vn30fContracts as jt, vn30fLastTradingDay as Mt, volumeColor as Nt, wallToUtc as Pt, zoneOffsetMinutes as Ft } from "@tradecanvas/commons";
3
- import { AlertManager as It, Animator as Lt, BarCountdown as Rt, BaseFinanceChart as O, BinanceAdapter as zt, BybitAdapter as Bt, CANDLE_PATTERNS as Vt, ChartLegend as Ht, ChartStateManager as Ut, CoinbaseAdapter as Wt, CompareRenderer as Gt, CrosshairTooltip as Kt, CurrentPriceLine as qt, DEFAULT_LEGEND_CONFIG as Jt, DEFAULT_MAX_WEBGL_CHARTS as Yt, DEFAULT_SESSION_HOURS as Xt, DataExporter as Zt, DrawingBase as Qt, Easing as $t, FinanceCrosshair as k, GROUP_HEADER as en, INDICATOR_CATEGORIES as tn, IndicatorBase as nn, IndicatorValueMap as rn, KEPT_BUCKETS as an, KeyboardHandler as on, KrakenAdapter as sn, MAX_ALERT_BARS as cn, MIN_ALERT_BARS as ln, MockAdapter as un, PaperExecutionAdapter as dn, PollingAdapter as fn, RANGE_PRESETS as pn, ReplayManager as mn, ResamplingAdapter as hn, ReshapeMemo as gn, Screenshot as _n, SessionBreaks as vn, SessionShading as A, SignalMarkerManager as yn, StreamManager as bn, TickAggregator as xn, TickBarAdapter as Sn, TickBarBuilder as Cn, TradeZoneManager as wn, UndoRedoManager as Tn, UpbitAdapter as En, VolumeRenderer as Dn, Watermark as On, WebSocketAdapter as kn, axisTimes as An, barIndexToTime as jn, barIndexToX as Mn, barIndexToX as j, canvasMeasure as Nn, computeBarLayout as Pn, computeCalendarLayout as Fn, computeCounterClockLayout as In, computeDonutLayout as Ln, computeHistogramLayout as Rn, computeMatrixLayout as zn, computeScatterLayout as Bn, correlationMatrix as Vn, counterClockPhase as Hn, counterClockPhase as Un, counterClockPoints as Wn, counterClockPoints as Gn, detectCandlePatterns as Kn, formatTooltipTime as qn, histogramBins as Jn, hitBar as M, hitDay as N, hitMatrixCell as P, hitSlice as F, indicatorCategory as Yn, isPriceLevelAlert as Xn, layoutGroupedTreemap as Zn, layoutSquarifiedTreemap as Qn, layoutUniformGrid as $n, lttbDownsample as er, lttbVisibleIndices as tr, nearestCounterClockPoint as I, nearestPoint as L, niceScale as nr, priceToY as rr, priceToYMapper as ir, priceToYMapper as ar, rangePresetStart as or, renderBarChart as sr, renderCalendar as cr, renderCounterClock as lr, renderDepthChart as ur, renderDonut as dr, renderEquityCurve as fr, renderGauge as pr, renderHeatmap as mr, renderHistogram as hr, renderMatrix as gr, renderScatter as _r, renderSparkline as vr, renderWaterfall as yr, servesTimeframe as br, setMaxWebGLCharts as xr, shownCount as Sr, timeToX as Cr, timestampToBarIndex as wr, timestampToBarIndex as Tr, toHeikinAshi as Er, toKagi as Dr, toLineBreak as Or, toPointAndFigure as kr, toRangeBars as Ar, toRenko as jr, withResampling as Mr, withTickBars as Nr, xToBarIndex as Pr, xToBarIndex as R, xToTime as Fr, yToPrice as Ir, yToPrice as Lr } from "@tradecanvas/core";
3
+ import { AlertManager as It, Animator as Lt, BarCountdown as Rt, BaseFinanceChart as O, BinanceAdapter as zt, BybitAdapter as Bt, CANDLE_PATTERNS as Vt, ChartLegend as Ht, ChartStateManager as Ut, CoinbaseAdapter as Wt, CompareRenderer as Gt, CrosshairTooltip as Kt, CurrentPriceLine as qt, DEFAULT_LEGEND_CONFIG as Jt, DEFAULT_MAX_WEBGL_CHARTS as Yt, DEFAULT_SESSION_HOURS as Xt, DataExporter as Zt, DrawingBase as Qt, Easing as $t, FinanceCrosshair as k, GROUP_HEADER as en, INDICATOR_CATEGORIES as tn, IndicatorBase as nn, IndicatorValueMap as rn, KEPT_BUCKETS as an, KeyboardHandler as on, KrakenAdapter as sn, MAX_ALERT_BARS as cn, MIN_ALERT_BARS as ln, MockAdapter as un, PaperExecutionAdapter as dn, PollingAdapter as fn, RANGE_PRESETS as pn, ReconnectManager as mn, ReplayController as hn, ReplayManager as gn, ResamplingAdapter as _n, ReshapeMemo as vn, Screenshot as A, SessionBreaks as yn, SessionShading as bn, SignalMarkerManager as xn, StreamManager as Sn, TickAggregator as Cn, TickBarAdapter as wn, TickBarBuilder as Tn, TradeZoneManager as En, UndoRedoManager as Dn, UpbitAdapter as On, VolumeRenderer as kn, Watermark as An, WebSocketAdapter as jn, axisTimes as Mn, barIndexToTime as Nn, barIndexToX as Pn, barIndexToX as j, canvasMeasure as Fn, computeBarLayout as In, computeCalendarLayout as Ln, computeCounterClockLayout as Rn, computeDonutLayout as zn, computeHistogramLayout as Bn, computeMatrixLayout as Vn, computeScatterLayout as Hn, correlationMatrix as Un, counterClockPhase as Wn, counterClockPhase as Gn, counterClockPoints as Kn, counterClockPoints as qn, detectCandlePatterns as Jn, formatTooltipTime as Yn, histogramBins as Xn, hitBar as M, hitDay as N, hitMatrixCell as P, hitSlice as F, indicatorCategory as Zn, isPriceLevelAlert as Qn, layoutGroupedTreemap as $n, layoutSquarifiedTreemap as er, layoutUniformGrid as tr, lttbDownsample as nr, lttbVisibleIndices as rr, nearestCounterClockPoint as I, nearestPoint as L, niceScale as ir, priceToY as ar, priceToYMapper as or, priceToYMapper as sr, rangePresetStart as cr, renderBarChart as lr, renderCalendar as ur, renderCounterClock as dr, renderDepthChart as fr, renderDonut as pr, renderEquityCurve as mr, renderGauge as hr, renderHeatmap as gr, renderHistogram as _r, renderMatrix as vr, renderScatter as yr, renderSparkline as br, renderWaterfall as xr, servesTimeframe as Sr, setMaxWebGLCharts as Cr, shownCount as wr, timeToX as Tr, timestampToBarIndex as Er, timestampToBarIndex as Dr, toHeikinAshi as Or, toKagi as kr, toLineBreak as Ar, toPointAndFigure as jr, toRangeBars as Mr, toRenko as Nr, withResampling as Pr, withTickBars as Fr, xToBarIndex as Ir, xToBarIndex as R, xToTime as Lr, yToPrice as Rr, yToPrice as zr } from "@tradecanvas/core";
4
4
  //#region src/frameworks/syncIndicators.ts
5
- function Rr(e) {
5
+ function Br(e) {
6
6
  let { id: t, params: n = {}, position: r = null } = typeof e == "string" ? { id: e } : e;
7
7
  return JSON.stringify([
8
8
  t,
@@ -10,9 +10,9 @@ function Rr(e) {
10
10
  r
11
11
  ]);
12
12
  }
13
- function zr(e, t, n) {
13
+ function Vr(e, t, n) {
14
14
  let r = /* @__PURE__ */ new Map(), i = t.map((e) => {
15
- let t = Rr(e), n = r.get(t) ?? 0;
15
+ let t = Br(e), n = r.get(t) ?? 0;
16
16
  return r.set(t, n + 1), {
17
17
  spec: e,
18
18
  key: `${t}#${n}`
@@ -27,7 +27,7 @@ function zr(e, t, n) {
27
27
  }
28
28
  //#endregion
29
29
  //#region src/frameworks/feedBars.ts
30
- var Br = 3, z = (e) => ({
30
+ var Hr = 3, z = (e) => ({
31
31
  time: e.time,
32
32
  open: e.open,
33
33
  high: e.high,
@@ -35,16 +35,16 @@ var Br = 3, z = (e) => ({
35
35
  close: e.close,
36
36
  volume: e.volume
37
37
  }), B = (e) => e.length > 0 ? e[e.length - 1] : null;
38
- function Vr(e, n, r) {
38
+ function Ur(e, n, r) {
39
39
  for (let i = 0; i < r; i++) if (!t(e[i], n[i])) return !1;
40
40
  return !0;
41
41
  }
42
- function Hr(e, t) {
42
+ function Wr(e, t) {
43
43
  if (e.isReplayActive()) return !0;
44
44
  let n = B(e.getData());
45
45
  return t.inReplay ? n?.time === t.last?.time : n === t.shownBar ? n?.time === t.last?.time || !e.isExtendedHoursVisible() : !1;
46
46
  }
47
- function Ur(e, r, i) {
47
+ function Gr(e, r, i) {
48
48
  let a = [];
49
49
  for (let o = 0; o < r.length; o++) {
50
50
  let s = e[i + o];
@@ -55,16 +55,16 @@ function Ur(e, r, i) {
55
55
  }
56
56
  return a;
57
57
  }
58
- function Wr(e, t) {
58
+ function Kr(e, t) {
59
59
  if (t.length === 0) return !0;
60
60
  if (!e.updateBar) return !1;
61
61
  for (let n of t) if (!e.updateBar(n)) return !1;
62
62
  return !0;
63
63
  }
64
- function Gr(e) {
64
+ function qr(e) {
65
65
  return e.slice(Math.max(1, e.length - 1 - 3), -1).map(z);
66
66
  }
67
- function Kr(e, t) {
67
+ function Jr(e, t) {
68
68
  let r = [];
69
69
  for (let i = t; i < e.length; i++) {
70
70
  if (!n(e[i]) || !(e[i].time > e[i - 1].time)) return null;
@@ -72,42 +72,42 @@ function Kr(e, t) {
72
72
  }
73
73
  return r;
74
74
  }
75
- function qr(e, r, i) {
75
+ function Yr(e, r, i) {
76
76
  let a = i.length;
77
- if (a === 0 || !i.last || !n(i.last) || r.length < a || !Hr(e, i)) return !1;
77
+ if (a === 0 || !i.last || !n(i.last) || r.length < a || !Wr(e, i)) return !1;
78
78
  let o = i.recent ?? [], s = a - 1 - o.length;
79
- if (r !== i.source && (i.source.length !== a || !Vr(i.source, r, s))) return !1;
79
+ if (r !== i.source && (i.source.length !== a || !Ur(i.source, r, s))) return !1;
80
80
  let c = r[a - 1];
81
81
  if (c.time !== i.last.time || !n(c)) return !1;
82
- let l = Ur(r, o, s), u = Kr(r, a);
83
- return !l || !u || !Wr(e, l) ? !1 : (t(c, i.last) || e.updateLastBar(z(c)), u.length === 1 ? e.appendBar(u[0]) : u.length > 1 && e.appendBars(u), !0);
82
+ let l = Gr(r, o, s), u = Jr(r, a);
83
+ return !l || !u || !Kr(e, l) ? !1 : (t(c, i.last) || e.updateLastBar(z(c)), u.length === 1 ? e.appendBar(u[0]) : u.length > 1 && e.appendBars(u), !0);
84
84
  }
85
- function Jr(e, t, n) {
86
- (!n || !qr(e, t, n)) && e.setData(t.map(z));
85
+ function Xr(e, t, n) {
86
+ (!n || !Yr(e, t, n)) && e.setData(t.map(z));
87
87
  let r = t.length > 0 ? z(t[t.length - 1]) : null, i = e.isReplayActive();
88
88
  return {
89
89
  source: t,
90
90
  length: t.length,
91
91
  last: r,
92
- recent: Gr(t),
92
+ recent: qr(t),
93
93
  shownBar: i ? null : B(e.getData()),
94
94
  inReplay: i
95
95
  };
96
96
  }
97
97
  //#endregion
98
98
  //#region src/plugins/overlayScale.ts
99
- function Yr(e) {
100
- let { viewport: t, data: n } = e, r = ar(t), i = n.length - 1, a = Math.max(0, Math.floor(t.visibleRange.from)), o = Math.min(i, Math.ceil(t.visibleRange.to)), s = (e) => n.length > 0 ? Tr(e, n) : e;
99
+ function Zr(e) {
100
+ let { viewport: t, data: n } = e, r = sr(t), i = n.length - 1, a = Math.max(0, Math.floor(t.visibleRange.from)), o = Math.min(i, Math.ceil(t.visibleRange.to)), s = (e) => n.length > 0 ? Dr(e, n) : e;
101
101
  return {
102
102
  timeToX: (e) => j(s(e), t),
103
103
  xToTime: (e) => {
104
104
  let r = R(e, t);
105
- return n.length > 0 ? jn(r, n) : r;
105
+ return n.length > 0 ? Nn(r, n) : r;
106
106
  },
107
107
  indexToX: (e) => j(e, t),
108
108
  xToIndex: (e) => R(e, t),
109
109
  priceToY: r,
110
- yToPrice: (e) => Lr(e, t),
110
+ yToPrice: (e) => zr(e, t),
111
111
  barWidth: t.barWidth,
112
112
  visible: o < a ? {
113
113
  from: 0,
@@ -153,7 +153,7 @@ var V = {
153
153
  cols: 2,
154
154
  rows: 3
155
155
  }
156
- }, Xr = class {
156
+ }, Qr = class {
157
157
  root;
158
158
  cells = [];
159
159
  layout;
@@ -260,13 +260,13 @@ var V = {
260
260
  this.cells = [], this.root.remove();
261
261
  }
262
262
  }
263
- }, Zr = class extends O {
263
+ }, $r = class extends O {
264
264
  options;
265
265
  constructor(e, t) {
266
266
  super(e, t.theme), this.options = t, this.requestRender();
267
267
  }
268
268
  renderChart(e, t, n, r) {
269
- vr(e, t, n, this.options, r);
269
+ br(e, t, n, this.options, r);
270
270
  }
271
271
  update(e) {
272
272
  this.options = {
@@ -280,7 +280,7 @@ var V = {
280
280
  ...e
281
281
  }, this.requestRender();
282
282
  }
283
- }, Qr = class extends O {
283
+ }, ei = class extends O {
284
284
  options;
285
285
  crosshair = null;
286
286
  constructor(e, t) {
@@ -288,7 +288,7 @@ var V = {
288
288
  }
289
289
  renderChart(e, t, n, r) {
290
290
  let i = this.crosshair?.getPosition() ?? null;
291
- ur(e, t, n, this.options, r, i);
291
+ fr(e, t, n, this.options, r, i);
292
292
  }
293
293
  update(e) {
294
294
  this.options = {
@@ -313,7 +313,7 @@ var V = {
313
313
  }
314
314
  renderChart(e, t, n, r) {
315
315
  let i = this.crosshair?.getPosition() ?? null;
316
- fr(e, t, n, this.options, r, i);
316
+ mr(e, t, n, this.options, r, i);
317
317
  }
318
318
  update(e, t) {
319
319
  this.options = {
@@ -360,7 +360,7 @@ var V = {
360
360
  height: this.height
361
361
  }, t = this.options.cellPadding ?? 2;
362
362
  if (this.lastLayoutWidth = this.width, this.lastLayoutHeight = this.height, this.cachedGroups = [], this.options.grouped) {
363
- let { groups: n, cells: r } = Zn(this.currentData.map((e) => ({
363
+ let { groups: n, cells: r } = $n(this.currentData.map((e) => ({
364
364
  id: e.id,
365
365
  weight: e.weight ?? (Math.abs(e.value) || 1),
366
366
  group: e.group,
@@ -372,8 +372,8 @@ var V = {
372
372
  id: e.id,
373
373
  weight: e.weight ?? (Math.abs(e.value) || 1)
374
374
  }));
375
- this.cachedRects = Qn(n, e, t);
376
- } else this.cachedRects = $n(this.currentData.map((e) => ({ id: e.id })), e, t);
375
+ this.cachedRects = er(n, e, t);
376
+ } else this.cachedRects = tr(this.currentData.map((e) => ({ id: e.id })), e, t);
377
377
  }
378
378
  onCanvasClick(e, t) {
379
379
  if (this.options.onCellClick) for (let n of this.cachedRects) {
@@ -388,7 +388,7 @@ var V = {
388
388
  renderChart(e, t, n, r) {
389
389
  (t !== this.lastLayoutWidth || n !== this.lastLayoutHeight) && this.recomputeLayout();
390
390
  let i = this.crosshair?.getPosition() ?? null;
391
- mr(e, t, n, this.currentData, this.cachedRects, this.options, r, i, this.cachedGroups);
391
+ gr(e, t, n, this.currentData, this.cachedRects, this.options, r, i, this.cachedGroups);
392
392
  }
393
393
  update(e) {
394
394
  this.currentData = e, this.options = {
@@ -405,7 +405,7 @@ var V = {
405
405
  destroy() {
406
406
  this.crosshair?.destroy(), this.handleClick && this.canvas.removeEventListener("click", this.handleClick), super.destroy();
407
407
  }
408
- }, $r = class extends O {
408
+ }, ti = class extends O {
409
409
  options;
410
410
  crosshair = null;
411
411
  constructor(e, t) {
@@ -413,7 +413,7 @@ var V = {
413
413
  }
414
414
  renderChart(e, t, n, r) {
415
415
  let i = this.crosshair?.getPosition() ?? null;
416
- yr(e, t, n, this.options, r, i);
416
+ xr(e, t, n, this.options, r, i);
417
417
  }
418
418
  update(e) {
419
419
  this.options = {
@@ -430,12 +430,12 @@ var V = {
430
430
  destroy() {
431
431
  this.crosshair?.destroy(), super.destroy();
432
432
  }
433
- }, ei = 500;
434
- function ti(e) {
433
+ }, ni = 500;
434
+ function ri(e) {
435
435
  let t = 1 - e;
436
436
  return 1 - t * t * t;
437
437
  }
438
- var ni = class extends O {
438
+ var ii = class extends O {
439
439
  options;
440
440
  currentValue;
441
441
  targetValue;
@@ -446,7 +446,7 @@ var ni = class extends O {
446
446
  super(e, t.theme), this.options = t, this.currentValue = t.value, this.targetValue = t.value, this.requestRender();
447
447
  }
448
448
  renderChart(e, t, n, r) {
449
- pr(e, t, n, this.options, r, this.currentValue);
449
+ hr(e, t, n, this.options, r, this.currentValue);
450
450
  }
451
451
  setValue(e) {
452
452
  if (this.options.animate === !1) {
@@ -476,7 +476,7 @@ var ni = class extends O {
476
476
  if (this.animationFrameId !== null) return;
477
477
  let e = () => {
478
478
  if (this.animationFrameId = null, this.animationStart === null) return;
479
- let t = this.options.animationDuration ?? ei, n = performance.now() - this.animationStart, r = Math.min(1, n / Math.max(1, t)), i = ti(r);
479
+ let t = this.options.animationDuration ?? ni, n = performance.now() - this.animationStart, r = Math.min(1, n / Math.max(1, t)), i = ri(r);
480
480
  this.currentValue = this.animationFrom + (this.targetValue - this.animationFrom) * i, this.requestRender(), r < 1 ? this.animationFrameId = requestAnimationFrame(e) : (this.currentValue = this.targetValue, this.animationStart = null);
481
481
  };
482
482
  this.animationFrameId = requestAnimationFrame(e);
@@ -506,7 +506,7 @@ var ni = class extends O {
506
506
  }
507
507
  renderChart(e, t, n, r) {
508
508
  let i = this.options.crosshair === !1 ? null : this.crosshair.getPosition(), a = this.layoutFor;
509
- (!this.layout || !a || a.options !== this.options || a.width !== t || a.height !== n || a.theme !== r) && (this.layout = this.compute(t, n, r, Nn(e, r)), this.layoutFor = {
509
+ (!this.layout || !a || a.options !== this.options || a.width !== t || a.height !== n || a.theme !== r) && (this.layout = this.compute(t, n, r, Fn(e, r)), this.layoutFor = {
510
510
  options: this.options,
511
511
  width: t,
512
512
  height: n,
@@ -525,12 +525,12 @@ var ni = class extends O {
525
525
  destroy() {
526
526
  this.crosshair.destroy(), this.canvas.removeEventListener("click", this.onClick), this.canvas.removeEventListener("pointermove", this.onMove), super.destroy();
527
527
  }
528
- }, ri = class extends W {
528
+ }, ai = class extends W {
529
529
  compute(e, t, n, r) {
530
- return Pn(this.options, e, t, n, r);
530
+ return In(this.options, e, t, n, r);
531
531
  }
532
532
  draw(e, t, n, r, i, a) {
533
- sr(e, t, n, this.options, r, i, a);
533
+ lr(e, t, n, this.options, r, i, a);
534
534
  }
535
535
  describe() {
536
536
  return `Bar chart of ${this.options.series.map((e) => e.name).join(", ")}, ${this.options.categories.length} categories`;
@@ -556,12 +556,12 @@ var ni = class extends O {
556
556
  series: t
557
557
  });
558
558
  }
559
- }, ii = class extends W {
559
+ }, oi = class extends W {
560
560
  compute(e, t, n, r) {
561
- return Ln(this.options, e, t, n, r);
561
+ return zn(this.options, e, t, n, r);
562
562
  }
563
563
  draw(e, t, n, r, i, a) {
564
- dr(e, t, n, this.options, r, i, a);
564
+ pr(e, t, n, this.options, r, i, a);
565
565
  }
566
566
  describe() {
567
567
  let e = this.options.data.filter((e) => Number.isFinite(e.value) && e.value > 0).map((e) => e.label).join(", ");
@@ -580,12 +580,12 @@ var ni = class extends O {
580
580
  update(e) {
581
581
  this.setOptions({ data: e });
582
582
  }
583
- }, ai = class extends W {
583
+ }, si = class extends W {
584
584
  compute(e, t, n, r) {
585
- return Bn(this.options, e, t, n, r);
585
+ return Hn(this.options, e, t, n, r);
586
586
  }
587
587
  draw(e, t, n, r, i, a) {
588
- _r(e, t, n, this.options, r, i, a);
588
+ yr(e, t, n, this.options, r, i, a);
589
589
  }
590
590
  describe() {
591
591
  let e = this.options.series.reduce((e, t) => e + t.points.length, 0);
@@ -604,12 +604,12 @@ var ni = class extends O {
604
604
  update(e) {
605
605
  this.setOptions({ series: e });
606
606
  }
607
- }, oi = class extends W {
607
+ }, ci = class extends W {
608
608
  compute(e, t, n, r) {
609
- return Rn(this.options, e, t, n, r);
609
+ return Bn(this.options, e, t, n, r);
610
610
  }
611
611
  draw(e, t, n, r, i, a) {
612
- hr(e, t, n, this.options, r, i, a);
612
+ _r(e, t, n, this.options, r, i, a);
613
613
  }
614
614
  describe() {
615
615
  return `Histogram of ${this.options.values.length} values`;
@@ -624,12 +624,12 @@ var ni = class extends O {
624
624
  update(e) {
625
625
  this.setOptions({ values: e });
626
626
  }
627
- }, si = class extends W {
627
+ }, li = class extends W {
628
628
  compute(e, t, n, r) {
629
- return Fn(this.options, e, t, n, r);
629
+ return Ln(this.options, e, t, n, r);
630
630
  }
631
631
  draw(e, t, n, r, i, a) {
632
- cr(e, t, n, this.options, r, i, a);
632
+ ur(e, t, n, this.options, r, i, a);
633
633
  }
634
634
  describe() {
635
635
  let e = this.options.data.map((e) => e.date).filter((e) => /^\d{4}-\d{2}-\d{2}$/.test(e)).sort(), t = this.options.from ?? e[0], n = this.options.to ?? e[e.length - 1];
@@ -648,12 +648,12 @@ var ni = class extends O {
648
648
  update(e) {
649
649
  this.setOptions({ data: e });
650
650
  }
651
- }, G = 12, ci = class extends W {
651
+ }, G = 12, ui = class extends W {
652
652
  compute(e, t, n, r) {
653
- return zn(this.options, e, t, n, r);
653
+ return Vn(this.options, e, t, n, r);
654
654
  }
655
655
  draw(e, t, n, r, i, a) {
656
- gr(e, t, n, this.options, r, i, a);
656
+ vr(e, t, n, this.options, r, i, a);
657
657
  }
658
658
  describe() {
659
659
  let { rows: e, columns: t } = this.options;
@@ -672,12 +672,12 @@ var ni = class extends O {
672
672
  update(e) {
673
673
  this.setOptions({ values: e });
674
674
  }
675
- }, li = class extends W {
675
+ }, di = class extends W {
676
676
  compute(e, t, n, r) {
677
- return In(this.options, e, t, n, r);
677
+ return Rn(this.options, e, t, n, r);
678
678
  }
679
679
  draw(e, t, n, r, i, a) {
680
- lr(e, t, n, this.options, r, i, a);
680
+ dr(e, t, n, this.options, r, i, a);
681
681
  }
682
682
  describe() {
683
683
  return `Counter-clock chart of price against volume, ${this.options.period ?? 25}-bar averages`;
@@ -693,12 +693,12 @@ var ni = class extends O {
693
693
  r && this.options.onPointClick?.(r.point);
694
694
  }
695
695
  getPhase() {
696
- return Un(Gn(this.options.data, this.options.period ?? 25, Sr(this.options)));
696
+ return Gn(qn(this.options.data, this.options.period ?? 25, wr(this.options)));
697
697
  }
698
698
  update(e) {
699
699
  this.setOptions({ data: e });
700
700
  }
701
- }, ui = [
701
+ }, fi = [
702
702
  "Jan",
703
703
  "Feb",
704
704
  "Mar",
@@ -746,7 +746,7 @@ function J(e) {
746
746
  let a = new Date(e.key), o = a.getUTCFullYear(), s = a.getUTCMonth();
747
747
  r.push({
748
748
  id: `${o}-${String(s + 1).padStart(2, "0")}`,
749
- label: ui[s],
749
+ label: fi[s],
750
750
  group: String(o),
751
751
  value: i
752
752
  });
@@ -809,7 +809,7 @@ function Q(e) {
809
809
  function $(e) {
810
810
  return !e || e === "dark" ? ve : e === "light" ? _ : e;
811
811
  }
812
- var di = class {
812
+ var pi = class {
813
813
  options;
814
814
  theme;
815
815
  root;
@@ -958,6 +958,6 @@ var di = class {
958
958
  }
959
959
  };
960
960
  //#endregion
961
- export { It as AlertManager, Lt as Animator, ri as BarChart, Rt as BarCountdown, zt as BinanceAdapter, Bt as BybitAdapter, Vt as CANDLE_PATTERNS, me as CHART_STYLE_KEYS, Br as CORRECTABLE_BARS, si as CalendarChart, c as Chart, Xr as ChartGrid, Ht as ChartLegend, Ut as ChartStateManager, Wt as CoinbaseAdapter, Gt as CompareRenderer, li as CounterClockChart, Kt as CrosshairTooltip, qt as CurrentPriceLine, he as DARK_PRICE_LIMITS, ge as DARK_TERMINAL, _e as DARK_THEME, ye as DEFAULT_DRAWING_STYLE, be as DEFAULT_FONT_FAMILY, e as DEFAULT_HISTORY_PAGE_SIZE, Jt as DEFAULT_LEGEND_CONFIG, Yt as DEFAULT_MAX_WEBGL_CHARTS, xe as DEFAULT_RECONNECT, Xt as DEFAULT_SESSION_HOURS, Se as DEFAULT_SIGNAL_STYLE, Ce as DEFAULT_STREAM_CONFIG, we as DEFAULT_TIMEFRAME_FAVORITES, Te as DEFAULT_TRADE_ZONE_STYLE, Ee as DEFAULT_TRADING_CONFIG, Zt as DataExporter, i as DataManager, Qr as DepthChart, ii as DonutChart, ie as DragDropImporter, Qt as DrawingBase, te as EXCHANGE_TIMEZONE, le as EXCHANGE_TIME_ZONE, $t as Easing, H as EquityCurveChart, ni as GaugeChart, de as HISTORY_RETRY_MS, d as HNX_SESSIONS, f as HOSE_SESSIONS, U as HeatmapChart, oi as HistogramChart, tn as INDICATOR_CATEGORIES, nn as IndicatorBase, rn as IndicatorValueMap, an as KEPT_BUCKETS, p as KRX_SESSIONS, m as KR_COLORS, on as KeyboardHandler, sn as KrakenAdapter, h as LIGHT_PRICE_LIMITS, g as LIGHT_THEME, fe as LayoutManager, ce as LayoutSession, v as MARKET_CRYPTO, y as MARKET_HNX, b as MARKET_HOSE, x as MARKET_HOSE_ETF, S as MARKET_KRX, C as MARKET_NXT, w as MARKET_NYSE, T as MARKET_UPBIT_KRW, E as MARKET_UPCOM, D as MARKET_VN30F, cn as MAX_ALERT_BARS, re as MAX_LAYOUT_NAME, ln as MIN_ALERT_BARS, De as MS_TIME_THRESHOLD, ci as MatrixChart, un as MockAdapter, Oe as NXT_SESSIONS, ue as PLUGIN_API_VERSION, ke as PRICE_SOURCES, dn as PaperExecutionAdapter, di as PerformanceDashboard, ae as PluginManager, fn as PollingAdapter, pn as RANGE_PRESETS, mn as ReplayManager, hn as ResamplingAdapter, gn as ReshapeMemo, Ae as SANS_FONT_FAMILY, ai as ScatterChart, _n as Screenshot, vn as SessionBreaks, A as SessionShading, yn as SignalMarkerManager, Zr as SparklineChart, bn as StreamManager, je as TC_PALETTE, Me as TC_SERIES_COLORS, Ne as TIMEFRAMES_CRYPTO, Pe as TIMEFRAMES_FOREX, Fe as TIMEFRAMES_STOCK, r as ThemeManager, xn as TickAggregator, Sn as TickBarAdapter, Cn as TickBarBuilder, wn as TradeZoneManager, Ie as UPCOM_SESSIONS, Tn as UndoRedoManager, En as UpbitAdapter, Le as VN30F_SESSIONS, Re as VN_COLORS, ze as VOLUME_ALPHA, Dn as VolumeRenderer, $r as WaterfallChart, On as Watermark, kn as WebSocketAdapter, An as axisTimes, Mn as barIndexToX, Be as barTimeUnit, Ve as barsAreDaily, oe as cleanLayoutName, ne as clearGlobalPlugins, q as computeDrawdownCurve, J as computeMonthlyReturns, He as computePriceLimits, Ue as contrastRatio, Vn as correlationMatrix, Hn as counterClockPhase, Wn as counterClockPoints, We as createMarketTheme, Ge as createVNTheme, Kn as detectCandlePatterns, Jr as feedBars, Ke as formatFraction, qe as formatNumber, qn as formatTooltipTime, Je as formatVND, Ye as formatVolumeLoc, Xe as fractionTick, Ze as getCurrentSession, u as getGlobalPlugins, Qe as getLocale, Jn as histogramBins, Yn as indicatorCategory, $e as indicatorSource, et as inkOn, Xn as isPriceLevelAlert, tt as isPriceSource, nt as isTimeFrame, rt as isValidTimeZone, ee as localStorageLayouts, er as lttbDownsample, tr as lttbVisibleIndices, it as marketStatus, o as memoryLayouts, nr as niceScale, at as normalizeBar, ot as normalizeBarTime, st as offsetAt, Yr as overlayScale, pe as overlaysForLayer, ct as parseIndicatorSource, se as parseOHLCV, lt as parseTimeframe, ut as pickBaseTimeframe, s as pluginKey, dt as priceFormatterFor, ft as priceStepAt, rr as priceToY, ir as priceToYMapper, or as rangePresetStart, pt as rankSymbols, mt as readNews, ht as readQuote, gt as readableOn, _t as registerLocale, l as registerPlugin, vt as resampleBars, yt as roundToPriceStep, bt as scaleMarketPrices, Q as selectKeyStats, br as servesTimeframe, xt as setLocale, xr as setMaxWebGLCharts, St as sourcePrice, Ct as stepDecimals, wt as symbolTimeZone, zr as syncIndicators, Tt as t, Et as tickBarCount, Cr as timeToX, Dt as timeframeBucketStart, kt as timeframeToMs, wr as timestampToBarIndex, K as toEquityPoints, Er as toHeikinAshi, Dr as toKagi, Or as toLineBreak, kr as toPointAndFigure, Ar as toRangeBars, jr as toRenko, a as unregisterPlugin, At as usesKoreanUnits, jt as vn30fContracts, Mt as vn30fLastTradingDay, Nt as volumeColor, Pt as wallToUtc, Mr as withResampling, Nr as withTickBars, Pr as xToBarIndex, Fr as xToTime, Ir as yToPrice, Ft as zoneOffsetMinutes };
961
+ export { It as AlertManager, Lt as Animator, ai as BarChart, Rt as BarCountdown, zt as BinanceAdapter, Bt as BybitAdapter, Vt as CANDLE_PATTERNS, me as CHART_STYLE_KEYS, Hr as CORRECTABLE_BARS, li as CalendarChart, c as Chart, Qr as ChartGrid, Ht as ChartLegend, Ut as ChartStateManager, Wt as CoinbaseAdapter, Gt as CompareRenderer, di as CounterClockChart, Kt as CrosshairTooltip, qt as CurrentPriceLine, he as DARK_PRICE_LIMITS, ge as DARK_TERMINAL, _e as DARK_THEME, ye as DEFAULT_DRAWING_STYLE, be as DEFAULT_FONT_FAMILY, e as DEFAULT_HISTORY_PAGE_SIZE, Jt as DEFAULT_LEGEND_CONFIG, Yt as DEFAULT_MAX_WEBGL_CHARTS, xe as DEFAULT_RECONNECT, Xt as DEFAULT_SESSION_HOURS, Se as DEFAULT_SIGNAL_STYLE, Ce as DEFAULT_STREAM_CONFIG, we as DEFAULT_TIMEFRAME_FAVORITES, Te as DEFAULT_TRADE_ZONE_STYLE, Ee as DEFAULT_TRADING_CONFIG, Zt as DataExporter, i as DataManager, ei as DepthChart, oi as DonutChart, ie as DragDropImporter, Qt as DrawingBase, te as EXCHANGE_TIMEZONE, le as EXCHANGE_TIME_ZONE, $t as Easing, H as EquityCurveChart, ii as GaugeChart, de as HISTORY_RETRY_MS, d as HNX_SESSIONS, f as HOSE_SESSIONS, U as HeatmapChart, ci as HistogramChart, tn as INDICATOR_CATEGORIES, nn as IndicatorBase, rn as IndicatorValueMap, an as KEPT_BUCKETS, p as KRX_SESSIONS, m as KR_COLORS, on as KeyboardHandler, sn as KrakenAdapter, h as LIGHT_PRICE_LIMITS, g as LIGHT_THEME, fe as LayoutManager, ce as LayoutSession, v as MARKET_CRYPTO, y as MARKET_HNX, b as MARKET_HOSE, x as MARKET_HOSE_ETF, S as MARKET_KRX, C as MARKET_NXT, w as MARKET_NYSE, T as MARKET_UPBIT_KRW, E as MARKET_UPCOM, D as MARKET_VN30F, cn as MAX_ALERT_BARS, re as MAX_LAYOUT_NAME, ln as MIN_ALERT_BARS, De as MS_TIME_THRESHOLD, ui as MatrixChart, un as MockAdapter, Oe as NXT_SESSIONS, ue as PLUGIN_API_VERSION, ke as PRICE_SOURCES, dn as PaperExecutionAdapter, pi as PerformanceDashboard, ae as PluginManager, fn as PollingAdapter, pn as RANGE_PRESETS, mn as ReconnectManager, hn as ReplayController, gn as ReplayManager, _n as ResamplingAdapter, vn as ReshapeMemo, Ae as SANS_FONT_FAMILY, si as ScatterChart, A as Screenshot, yn as SessionBreaks, bn as SessionShading, xn as SignalMarkerManager, $r as SparklineChart, Sn as StreamManager, je as TC_PALETTE, Me as TC_SERIES_COLORS, Ne as TIMEFRAMES_CRYPTO, Pe as TIMEFRAMES_FOREX, Fe as TIMEFRAMES_STOCK, r as ThemeManager, Cn as TickAggregator, wn as TickBarAdapter, Tn as TickBarBuilder, En as TradeZoneManager, Ie as UPCOM_SESSIONS, Dn as UndoRedoManager, On as UpbitAdapter, Le as VN30F_SESSIONS, Re as VN_COLORS, ze as VOLUME_ALPHA, kn as VolumeRenderer, ti as WaterfallChart, An as Watermark, jn as WebSocketAdapter, Mn as axisTimes, Pn as barIndexToX, Be as barTimeUnit, Ve as barsAreDaily, oe as cleanLayoutName, ne as clearGlobalPlugins, q as computeDrawdownCurve, J as computeMonthlyReturns, He as computePriceLimits, Ue as contrastRatio, Un as correlationMatrix, Wn as counterClockPhase, Kn as counterClockPoints, We as createMarketTheme, Ge as createVNTheme, Jn as detectCandlePatterns, Xr as feedBars, Ke as formatFraction, qe as formatNumber, Yn as formatTooltipTime, Je as formatVND, Ye as formatVolumeLoc, Xe as fractionTick, Ze as getCurrentSession, u as getGlobalPlugins, Qe as getLocale, Xn as histogramBins, Zn as indicatorCategory, $e as indicatorSource, et as inkOn, Qn as isPriceLevelAlert, tt as isPriceSource, nt as isTimeFrame, rt as isValidTimeZone, ee as localStorageLayouts, nr as lttbDownsample, rr as lttbVisibleIndices, it as marketStatus, o as memoryLayouts, ir as niceScale, at as normalizeBar, ot as normalizeBarTime, st as offsetAt, Zr as overlayScale, pe as overlaysForLayer, ct as parseIndicatorSource, se as parseOHLCV, lt as parseTimeframe, ut as pickBaseTimeframe, s as pluginKey, dt as priceFormatterFor, ft as priceStepAt, ar as priceToY, or as priceToYMapper, cr as rangePresetStart, pt as rankSymbols, mt as readNews, ht as readQuote, gt as readableOn, _t as registerLocale, l as registerPlugin, vt as resampleBars, yt as roundToPriceStep, bt as scaleMarketPrices, Q as selectKeyStats, Sr as servesTimeframe, xt as setLocale, Cr as setMaxWebGLCharts, St as sourcePrice, Ct as stepDecimals, wt as symbolTimeZone, Vr as syncIndicators, Tt as t, Et as tickBarCount, Tr as timeToX, Dt as timeframeBucketStart, kt as timeframeToMs, Er as timestampToBarIndex, K as toEquityPoints, Or as toHeikinAshi, kr as toKagi, Ar as toLineBreak, jr as toPointAndFigure, Mr as toRangeBars, Nr as toRenko, a as unregisterPlugin, At as usesKoreanUnits, jt as vn30fContracts, Mt as vn30fLastTradingDay, Nt as volumeColor, Pt as wallToUtc, Pr as withResampling, Fr as withTickBars, Ir as xToBarIndex, Lr as xToTime, Rr as yToPrice, Ft as zoneOffsetMinutes };
962
962
 
963
963
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../LayoutSession-D2raE2xW.cjs`),t=require(`../i18n-SIiP0kRx.cjs`);let n=require(`@tradecanvas/commons`),r=require(`@tradecanvas/core`);function i(e,t,r={}){return(0,n.resampleBars)(e,t,{weekStartsOn:r.weekStartsOn??1,timeZone:r.timeZone})}function a(e){if(e.length<2)return 0;let t=[];for(let n=1;n<e.length;n++){let r=e[n].time-e[n-1].time;r>0&&t.push(r)}return t.length===0?0:(t.sort((e,t)=>e-t),t[Math.floor(t.length/2)])}var o=[{zone:`Pacific/Honolulu`,city:`Honolulu`},{zone:`America/Los_Angeles`,city:`Los Angeles`},{zone:`America/Denver`,city:`Denver`},{zone:`America/Chicago`,city:`Chicago`},{zone:`America/New_York`,city:`New York`},{zone:`America/Toronto`,city:`Toronto`},{zone:`America/Sao_Paulo`,city:`São Paulo`},{zone:`UTC`,city:`UTC`},{zone:`Europe/London`,city:`London`},{zone:`Europe/Berlin`,city:`Frankfurt`},{zone:`Europe/Paris`,city:`Paris`},{zone:`Europe/Zurich`,city:`Zurich`},{zone:`Africa/Johannesburg`,city:`Johannesburg`},{zone:`Europe/Istanbul`,city:`Istanbul`},{zone:`Europe/Moscow`,city:`Moscow`},{zone:`Asia/Dubai`,city:`Dubai`},{zone:`Asia/Kolkata`,city:`Mumbai`},{zone:`Asia/Bangkok`,city:`Bangkok`},{zone:`Asia/Ho_Chi_Minh`,city:`Ho Chi Minh City`},{zone:`Asia/Jakarta`,city:`Jakarta`},{zone:`Asia/Singapore`,city:`Singapore`},{zone:`Asia/Hong_Kong`,city:`Hong Kong`},{zone:`Asia/Shanghai`,city:`Shanghai`},{zone:`Asia/Taipei`,city:`Taipei`},{zone:`Asia/Seoul`,city:`Seoul`},{zone:`Asia/Tokyo`,city:`Tokyo`},{zone:`Australia/Sydney`,city:`Sydney`},{zone:`Pacific/Auckland`,city:`Auckland`}],s=/^-?\d+$/,c=840;function l(e){if(!s.test(e))return null;let t=Number(e);return Math.abs(t)<=c?t:null}function u(e){return!e||e===`local`?null:e===`exchange`?`exchange`:s.test(e)?l(e):(0,n.isValidTimeZone)(e)?e:null}function d(e){return e===null?`local`:String(e)}function f(e,t,r,i){let a=(0,n.offsetAt)(null,t),s=o.filter(({zone:e})=>(0,n.isValidTimeZone)(e)).map(({zone:e,city:r})=>{let i=(0,n.offsetAt)(e,t);return{value:e,label:e===`UTC`?`UTC`:`(${(0,n.tzLabel)(i)}) ${r}`,offset:i}}),c=u(e);typeof c==`number`&&s.push({value:e,label:(0,n.tzLabel)(c),offset:c}),s.sort((e,t)=>e.offset-t.offset);let l=[{value:`local`,label:`${r} (${(0,n.tzLabel)(a)})`,offset:a}];if(i){let e=(0,n.offsetAt)(i.zone&&(0,n.isValidTimeZone)(i.zone)?i.zone:`UTC`,t);l.push({value:`exchange`,label:`${i.label} (${(0,n.tzLabel)(e)})`,offset:e})}return[...l,...s]}var p=6,m=8,h=120;function ee(e,t,n=`left`){let r=e.style,i=t.getBoundingClientRect();r.position=`fixed`,r.margin=`0`,r.top=r.bottom=r.left=r.right=``;let a=window.innerHeight-i.bottom-p-m,o=i.top-p-m;e.scrollHeight<=a||a>=o?(r.top=`${i.bottom+p}px`,r.bottom=`auto`,r.maxHeight=`${Math.max(h,a)}px`):(r.top=`auto`,r.bottom=`${window.innerHeight-i.top+p}px`,r.maxHeight=`${Math.max(h,o)}px`);let s=getComputedStyle(t).direction===`rtl`,c=n===`right`!==s,l=e.offsetWidth,u=c?i.right-l:i.left;r.left=`${Math.max(m,Math.min(u,window.innerWidth-l-m))}px`}var te=700,g=class{select=null;panel=null;rows=[];active=-1;typed=``;typedAt=0;onOutside=e=>{let t=e.target;this.panel?.contains(t)||this.select?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.panel?.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.select&&!this.select.isConnected&&this.close(!1)});constructor(e){this.layer=e}isOpenFor(e){return this.select===e}owns(e){return e!==null&&(e===this.select||this.panel?.contains(e)===!0)}open(e){this.close(!1),this.select=e;let t=document.createElement(`div`);t.className=`tcw-dropdown tcw-select-menu`,t.setAttribute(`role`,`listbox`),t.id=`tcw-select-menu-${Math.random().toString(36).slice(2,9)}`;let n=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;n&&t.setAttribute(`aria-label`,n.trim()),t.style.minWidth=`${e.getBoundingClientRect().width}px`,this.rows=[];for(let n of e.children)if(n instanceof HTMLOptGroupElement){let e=document.createElement(`div`);e.className=`tcw-select-group`,e.textContent=n.label,t.appendChild(e);for(let e of n.querySelectorAll(`option`))this.addRow(t,e,n.disabled)}else n instanceof HTMLOptionElement&&this.addRow(t,n,!1);t.addEventListener(`mousedown`,e=>e.preventDefault());let r=e=>this.rows.findIndex(t=>t.el.contains(e.target));t.addEventListener(`click`,e=>{let t=r(e);t>=0&&this.pick(t)}),t.addEventListener(`mousemove`,e=>{let t=r(e);t>=0&&t!==this.active&&this.enabled(t)&&this.setActive(t,!1)}),this.layer().appendChild(t),this.panel=t,ee(t,e),e.setAttribute(`aria-expanded`,`true`),e.setAttribute(`aria-controls`,t.id),this.setActive(this.rows.findIndex(e=>e.option.selected)),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.select;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.panel?.remove(),this.panel=null,this.rows=[],this.select=null,t.setAttribute(`aria-expanded`,`false`),t.removeAttribute(`aria-controls`),t.removeAttribute(`aria-activedescendant`),e&&t.isConnected&&t.focus())}key(e){if(!this.select)return!1;switch(e.key){case`ArrowDown`:return this.step(1),!0;case`ArrowUp`:return this.step(-1),!0;case`Home`:return this.setActive(this.nextEnabled(-1,1)),!0;case`End`:return this.setActive(this.nextEnabled(this.rows.length,-1)),!0;case`PageDown`:return this.step(8),!0;case`PageUp`:return this.step(-8),!0;case` `:return this.typed&&Date.now()-this.typedAt<=te?(this.typeahead(` `),!0):(this.active>=0?this.pick(this.active):this.close(!0),!0);case`Enter`:return this.active>=0?this.pick(this.active):this.close(!0),!0;case`Escape`:return this.close(!0),!0;case`Tab`:return this.close(!1),!1;default:return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey?(this.typeahead(e.key),!0):!1}}destroy(){this.close(!1)}addRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-select-option`,r.id=`${e.id}-${this.rows.length}`,r.setAttribute(`role`,`option`),r.setAttribute(`aria-selected`,String(t.selected)),(t.disabled||n)&&r.setAttribute(`aria-disabled`,`true`);let i=document.createElement(`span`);i.className=`tcw-select-option-text`,i.textContent=t.label||t.textContent||``,t.dir&&(i.dir=t.dir);let a=document.createElement(`span`);a.className=`tcw-select-check`,a.setAttribute(`aria-hidden`,`true`),r.append(a,i),e.appendChild(r),this.rows.push({option:t,el:r})}enabled(e){return this.rows[e]?.el.getAttribute(`aria-disabled`)!==`true`}nextEnabled(e,t){for(let n=e+t;n>=0&&n<this.rows.length;n+=t)if(this.enabled(n))return n;return-1}step(e){let t=e>0?1:-1,n=this.active;for(let r=0;r<Math.abs(e);r++){let e=this.nextEnabled(n,t);if(e<0)break;n=e}n>=0&&this.setActive(n)}setActive(e,t=!0){this.rows[this.active]?.el.classList.remove(`tcw-active`),this.active=e;let n=this.rows[e];n&&(n.el.classList.add(`tcw-active`),this.select?.setAttribute(`aria-activedescendant`,n.el.id),t&&n.el.scrollIntoView?.({block:`nearest`}))}typeahead(e){let t=Date.now();this.typed=t-this.typedAt>te?e.toLowerCase():this.typed+e.toLowerCase(),this.typedAt=t;let n=e=>this.enabled(e)&&(this.rows[e].el.textContent??``).trim().toLowerCase().startsWith(this.typed),r=this.typed.length===1?this.active+1:Math.max(0,this.active);for(let e=0;e<this.rows.length;e++){let t=(r+e)%this.rows.length;if(n(t)){this.setActive(t);return}}}pick(e){let t=this.select,n=this.rows[e];if(!t||!n||!this.enabled(e))return;let r=!n.option.selected;n.option.selected=!0,this.close(!0),r&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},_=42,v=7,y=new Set([`US`,`CA`,`MX`,`BR`,`JP`,`KR`,`TW`,`HK`,`IL`,`PH`,`IN`,`ZA`,`AU`,`TH`,`SA`,`PE`,`CO`]);function b(e){try{let t=new Intl.Locale(e),n=t.getWeekInfo?.()??t.weekInfo;return n?n.firstDay===7?0:1:+!y.has(t.maximize().region??``)}catch{return 1}}function x(e,t,n){let r=(new Date(Date.UTC(e,t,1)).getUTCDay()-n+v)%v,i=[];for(let n=0;n<_;n++){let a=new Date(Date.UTC(e,t,1-r+n));i.push({year:a.getUTCFullYear(),month:a.getUTCMonth(),day:a.getUTCDate()})}return i}var ne=e=>String(e).padStart(2,`0`),S=e=>`${String(e.year).padStart(4,`0`)}-${ne(e.month+1)}-${ne(e.day)}`;function re(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e??``);return t?{year:Number(t[1]),month:Number(t[2])-1,day:Number(t[3])}:null}function ie(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}}function ae(e,t){let n=new Date(Date.UTC(e.year,e.month,e.day+t));return{year:n.getUTCFullYear(),month:n.getUTCMonth(),day:n.getUTCDate()}}var oe=class{element;grid;titleEl;chosen=``;limits={};today=S(ie());view={year:0,month:0};focusDay=ie();constructor(e,t,n){this.locale=t,this.onPick=n;let r=document.createElement(`div`);r.className=`tcw-calendar`;let i=document.createElement(`div`);i.className=`tcw-calendar-head`;let a=document.createElement(`div`);a.className=`tcw-calendar-title`,a.setAttribute(`aria-live`,`polite`),i.append(this.navButton(e.prevMonth,-1),a,this.navButton(e.nextMonth,1));let o=document.createElement(`div`);o.className=`tcw-calendar-weekdays`,o.setAttribute(`aria-hidden`,`true`);let s=b(t),c=new Intl.DateTimeFormat(t,{weekday:`narrow`,timeZone:`UTC`});for(let e=0;e<v;e++){let t=document.createElement(`span`);t.className=`tcw-calendar-weekday`,t.textContent=c.format(new Date(Date.UTC(2023,0,1+(s+e)%v))),o.appendChild(t)}let l=document.createElement(`div`);l.className=`tcw-calendar-grid`,l.setAttribute(`role`,`grid`),l.addEventListener(`keydown`,e=>this.onKey(e)),l.addEventListener(`click`,e=>{let t=e.target.closest(`.tcw-calendar-day`);t&&!t.disabled&&t.dataset.date&&this.pick(t.dataset.date)});let u=document.createElement(`div`);u.className=`tcw-calendar-foot`;let d=document.createElement(`button`);d.type=`button`,d.className=`tcw-calendar-today`,d.textContent=e.today,d.addEventListener(`click`,()=>this.pick(this.today)),u.appendChild(d),r.append(i,o,l,u),this.element=r,this.grid=l,this.titleEl=a}show(e,t={}){this.chosen=e,this.limits=t,this.today=re(t.today)?t.today:S(ie());let n=this.clamp(re(e)??re(this.today));this.focusDay=n,this.view={year:n.year,month:n.month},this.render()}focusGrid(){this.grid.querySelector(`[tabindex="0"]`)?.focus()}navButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-calendar-nav`,n.setAttribute(`aria-label`,e),n.innerHTML=t<0?`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5L5.5 8l4.5 4.5"/></svg>`:`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5L10.5 8 6 12.5"/></svg>`,n.addEventListener(`click`,()=>this.turn(t)),n}turn(e){let t=new Date(Date.UTC(this.view.year,this.view.month+e,1));this.view={year:t.getUTCFullYear(),month:t.getUTCMonth()};let n=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.focusDay=this.clamp({...this.view,day:Math.min(this.focusDay.day,n)}),this.view={year:this.focusDay.year,month:this.focusDay.month},this.render()}clamp(e){let t=S(e),n=re(this.limits.min),r=re(this.limits.max);return n&&t<S(n)?n:r&&t>S(r)?r:e}allowed(e){let{min:t,max:n}=this.limits;return!(t&&e<t)&&!(n&&e>n)}render(){let e=this.locale;this.titleEl.textContent=new Intl.DateTimeFormat(e,{month:`long`,year:`numeric`,timeZone:`UTC`}).format(new Date(Date.UTC(this.view.year,this.view.month,1)));let t=this.today,n=S(this.focusDay),r=new Intl.DateTimeFormat(e,{dateStyle:`full`,timeZone:`UTC`});this.grid.textContent=``;let i=null;for(let[a,o]of x(this.view.year,this.view.month,b(e)).entries()){a%v===0&&(i=document.createElement(`div`),i.className=`tcw-calendar-week`,i.setAttribute(`role`,`row`),this.grid.appendChild(i));let e=S(o),s=document.createElement(`button`);s.type=`button`,s.className=`tcw-calendar-day`,s.dataset.date=e,s.setAttribute(`role`,`gridcell`),s.textContent=String(o.day),s.setAttribute(`aria-label`,r.format(new Date(Date.UTC(o.year,o.month,o.day)))),s.setAttribute(`aria-selected`,String(e===this.chosen)),s.tabIndex=e===n?0:-1,o.month!==this.view.month&&s.classList.add(`tcw-outside`),e===t&&s.classList.add(`tcw-today`),this.allowed(e)||(s.disabled=!0),i?.appendChild(s)}}onKey(e){let t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-v,ArrowDown:v},n=this.element.isConnected&&getComputedStyle(this.element).direction===`rtl`;if(e.key in t){let r=n&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?-t[e.key]:t[e.key];this.moveFocus(ae(this.focusDay,r))}else if(e.key===`PageUp`||e.key===`PageDown`)this.turn(e.key===`PageUp`?-1:1),this.focusGrid();else if(e.key===`Home`||e.key===`End`){let t=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.moveFocus({...this.view,day:e.key===`Home`?1:t})}else if(e.key===`Enter`||e.key===` `)this.pick(S(this.focusDay));else return;e.preventDefault()}moveFocus(e){let t=this.clamp(e);this.focusDay=t,(t.year!==this.view.year||t.month!==this.view.month)&&(this.view={year:t.year,month:t.month}),this.render(),this.focusGrid()}pick(e){this.allowed(e)&&this.onPick(e)}},se=class{input=null;view=null;onOutside=e=>{let t=e.target;this.view?.element.contains(t)||this.input?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.view?.element.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.input&&!this.input.isConnected&&this.close(!1)});constructor(e,t,n){this.layer=e,this.labels=t,this.locale=n}isOpenFor(e){return this.input===e}owns(e){return e!==null&&(e===this.input||this.view?.element.contains(e)===!0)}open(e){this.close(!1),this.input=e;let t=new oe(this.labels(),this.locale(),e=>this.pick(e));t.show(e.value,{min:e.min||void 0,max:e.max||void 0});let n=t.element;n.setAttribute(`role`,`dialog`);let r=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;r&&n.setAttribute(`aria-label`,r.trim()),n.addEventListener(`mousedown`,e=>{e.target.closest(`button`)||e.preventDefault()}),n.addEventListener(`keydown`,e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),this.close(!0))}),this.view=t,this.layer().appendChild(n),ee(n,e),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.input;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.view?.element.remove(),this.view=null,this.input=null,e&&t.isConnected&&t.focus())}focusGrid(){this.view?.focusGrid()}destroy(){this.close(!1)}pick(e){let t=this.input;if(!t)return;let n=t.value!==e;t.value=e,this.close(!0),n&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},ce=()=>typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches,le=()=>typeof CSS>`u`||typeof CSS.supports!=`function`||CSS.supports(`selector(::-webkit-calendar-picker-indicator)`);function ue(e){if(!(e instanceof Element))return null;let t=e.closest(`select`);return!t||t.matches(`:disabled`)||t.multiple||t.size>1?null:t}function de(e){return!(e instanceof HTMLInputElement)||e.type!==`date`||e.dataset.tcwCalendar===`inline`||e.matches(`:disabled`)||e.readOnly?null:e}function fe(e,t){let n=new g(t.layer),r=new se(t.layer,t.labels,t.locale),i=t.native??ce,a=t.calendar??le,o=new WeakSet,s=e=>o.has(e)?!1:(o.add(e),!0),c=e=>{if(e.button!==0||i()||!s(e))return;let t=ue(e.target);if(t){if(e.preventDefault(),n.isOpenFor(t)){n.close(!0);return}t.focus(),n.open(t)}},l=e=>{if(i()||!a()||!s(e))return;let t=de(e.target);t&&(e.preventDefault(),r.isOpenFor(t)||r.open(t))},u=e=>{if(i()||!s(e))return;let t=ue(e.target);if(t){if(n.isOpenFor(t)){n.key(e)&&(e.preventDefault(),e.stopPropagation());return}(e.key===`Enter`||e.key===` `||e.altKey&&(e.key===`ArrowDown`||e.key===`ArrowUp`)||e.key===`F4`)&&(e.preventDefault(),e.stopPropagation(),n.open(t));return}let o=de(e.target);!o||!a()||(e.key===`Escape`&&r.isOpenFor(o)?(e.preventDefault(),e.stopPropagation(),r.close(!0)):(e.altKey&&e.key===`ArrowDown`||e.key===`F4`)&&(e.preventDefault(),r.isOpenFor(o)||r.open(o),r.focusGrid()))},d=e=>{if(!s(e))return;let t=e.target instanceof Node?e.target:null,i=e.relatedTarget instanceof Node?e.relatedTarget:null;n.owns(t)&&!n.owns(i)&&n.close(!1),r.owns(t)&&!r.owns(i)&&r.close(!1)};for(let t of e)t.addEventListener(`mousedown`,c,!0),t.addEventListener(`click`,l,!0),t.addEventListener(`keydown`,u,!0),t.addEventListener(`focusout`,d,!0);return()=>{for(let t of e)t.removeEventListener(`mousedown`,c,!0),t.removeEventListener(`click`,l,!0),t.removeEventListener(`keydown`,u,!0),t.removeEventListener(`focusout`,d,!0);n.destroy(),r.destroy()}}var pe=[{label:`Candlestick`,value:`candlestick`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Bar`,value:`bar`},{label:`Heikin-Ashi`,value:`heikinAshi`},{label:`Hollow Candle`,value:`hollowCandle`},{label:`Baseline`,value:`baseline`},{label:`Volume Candles`,value:`volumeCandles`},{label:`Equivolume`,value:`equivolume`},{label:`HLC Area`,value:`hlcArea`},{label:`Step Line`,value:`stepLine`},{label:`Line + Markers`,value:`lineWithMarkers`},{label:`High-Low`,value:`hiLo`},{label:`Renko`,value:`renko`},{label:`Line Break`,value:`lineBreak`},{label:`Kagi`,value:`kagi`},{label:`Point & Figure`,value:`pointAndFigure`},{label:`Range Bars`,value:`rangeBars`}],me=[{label:`Lines`,section:`lines`,tools:[{label:`Trend Line`,value:`trendLine`},{label:`Ray`,value:`ray`},{label:`Extended Line`,value:`extendedLine`},{label:`Info Line`,value:`infoLine`},{label:`Trend Angle`,value:`trendAngle`}]},{label:`Horizontal/Vertical`,section:`lines`,tools:[{label:`Horizontal Line`,value:`horizontalLine`},{label:`Horizontal Ray`,value:`horizontalRay`},{label:`Vertical Line`,value:`verticalLine`},{label:`Cross Line`,value:`crossLine`}]},{label:`Channels`,section:`lines`,tools:[{label:`Parallel Channel`,value:`parallelChannel`},{label:`Regression Channel`,value:`regressionChannel`}]},{label:`Fibonacci`,section:`fibonacci`,tools:[{label:`Fib Retracement`,value:`fibRetracement`},{label:`Fib Extension`,value:`fibExtension`},{label:`Fib Channel`,value:`fibChannel`},{label:`Fib Time Zones`,value:`fibTimeZones`},{label:`Fib Speed Resistance Fan`,value:`fibSpeedResistanceFan`},{label:`Fib Speed Resistance Arcs`,value:`fibArcs`},{label:`Fib Circles`,value:`fibCircles`},{label:`Fib Spiral`,value:`fibSpiral`},{label:`Fib Wedge`,value:`fibWedge`}]},{label:`Gann & Pitchforks`,section:`fibonacci`,tools:[{label:`Pitchfork`,value:`pitchfork`},{label:`Schiff Pitchfork`,value:`schiffPitchfork`},{label:`Modified Schiff Pitchfork`,value:`modifiedSchiffPitchfork`},{label:`Gann Fan`,value:`gannFan`},{label:`Gann Box`,value:`gannBox`},{label:`Gann Square`,value:`gannSquare`},{label:`Pitchfan`,value:`pitchfan`}]},{label:`Cycles`,section:`fibonacci`,tools:[{label:`Cyclic Lines`,value:`cyclicLines`},{label:`Time Cycles`,value:`timeCycles`},{label:`Sine Line`,value:`sineLine`}]},{label:`Patterns`,section:`patterns`,tools:[{label:`XABCD Pattern`,value:`xabcdPattern`},{label:`ABCD Pattern`,value:`abcdPattern`},{label:`Head and Shoulders`,value:`headAndShoulders`},{label:`Cypher Pattern`,value:`cypherPattern`},{label:`Three Drives Pattern`,value:`threeDrives`}]},{label:`Elliott Waves`,section:`patterns`,tools:[{label:`Elliott Wave`,value:`elliottWave`},{label:`Elliott Impulse Wave`,value:`elliottImpulse`},{label:`Elliott Correction Wave`,value:`elliottCorrection`},{label:`Elliott Triangle Wave`,value:`elliottTriangle`},{label:`Elliott Double Combo Wave`,value:`elliottDoubleCombo`},{label:`Elliott Triple Combo Wave`,value:`elliottTripleCombo`}]},{label:`Forecasting`,section:`forecasting`,tools:[{label:`Long/Short Position`,value:`riskReward`},{label:`Anchored VWAP`,value:`anchoredVWAP`},{label:`Fixed Range Volume Profile`,value:`volumeProfileRange`},{label:`Forecast`,value:`forecast`},{label:`Projection`,value:`projection`},{label:`Bars Pattern`,value:`barsPattern`}]},{label:`Measure`,section:`forecasting`,tools:[{label:`Price Range`,value:`priceRange`},{label:`Date Range`,value:`dateRange`},{label:`Date and Price Range`,value:`dateAndPriceRange`},{label:`Measure`,value:`measure`}]},{label:`Shapes`,section:`annotation`,tools:[{label:`Rectangle`,value:`rectangle`},{label:`Circle`,value:`circle`},{label:`Ellipse`,value:`ellipse`},{label:`Triangle`,value:`triangle`},{label:`Polyline`,value:`polyline`},{label:`Curve`,value:`curve`},{label:`Arc`,value:`arc`}]},{label:`Brushes`,section:`annotation`,tools:[{label:`Brush`,value:`brush`},{label:`Highlighter`,value:`highlighter`},{label:`Path`,value:`path`}]},{label:`Annotation`,section:`annotation`,tools:[{label:`Text`,value:`text`},{label:`Price Label`,value:`priceLabel`},{label:`Arrow`,value:`arrow`},{label:`Note`,value:`note`},{label:`Callout`,value:`callout`},{label:`Flag Mark`,value:`flag`},{label:`Arrow Mark`,value:`arrowMark`},{label:`Icon`,value:`icon`}]}],he=[`BTCUSDT`,`ETHUSDT`,`SOLUSDT`,`BNBUSDT`],ge={gridVisible:!0,volumeVisible:!0,volumeProfileVisible:!1,marketProfileVisible:!1,marketProfileSplit:!1,marketProfileLetters:!1,marketProfileBuckets:48,marketProfileOpacity:.32,depthHeatmapVisible:!1,depthHeatmapOpacity:.7,sessionShadingVisible:!1,pivotMarkersVisible:!1,pivotStrength:5,pivotStructureLabels:!1,periodLevelsVisible:!1,periodLevelsPeriod:`day`,legendVisible:!0,barCountdown:!0,indicatorValueLabels:!1,alignAxisLabels:!0,logScale:!1,scaleMode:`regular`,autoScale:!0,invertScale:!1,leftPriceScale:!1,crosshairMode:`magnet`,numberLocale:`en-US`,timezone:`local`,highLowLines:!1,mainSeriesVisible:!0,extendedHours:!0,chartTypeOptions:{}},C=(e,...t)=>({label:e,keys:t}),w=(e,t,n={})=>({label:e,keys:[t],auto:n}),T=e=>({hint:e}),_e={from:`panes.titleColor`},ve={title:`settings.section.lastPrice`,rows:[C(`settings.priceLine`,`lastPrice.visible`),C(`settings.up`,`lastPrice.upColor`),C(`settings.down`,`lastPrice.downColor`),C(`drawingSettings.lineStyle`,`lastPrice.style`),C(`drawingSettings.lineWidth`,`lastPrice.width`)]},ye={title:`settings.volume`,rows:[C(`settings.up`,`volume.upColor`),C(`settings.down`,`volume.downColor`)]},be={title:`settings.highLowLines`,rows:[w(`drawingSettings.color`,`highLow.color`,_e)]},xe=[ve,ye,be],Se=[C(`settings.legendText`,`legend.textColor`),C(`settings.legendLabels`,`legend.labelColor`)],Ce=[...Se,C(`settings.paneTitles`,`panes.titleColor`)],we=[C(`drawingSettings.text`,`axis.price.textColor`,`axis.time.textColor`),C(`settings.scaleLines`,`axis.price.lineColor`,`axis.time.lineColor`)],Te=[{title:`settings.section.background`,rows:[C(`settings.background`,`background.color`),C(`settings.paneBackground`,`panes.background`),C(`settings.paneSeparator`,`panes.separatorColor`),w(`settings.watermark`,`watermark.color`,_e)]},{title:`settings.gridLines`,rows:[C(`settings.horizontal`,`grid.horizontal.visible`),C(`settings.vertical`,`grid.vertical.visible`),C(`drawingSettings.color`,`grid.horizontal.color`,`grid.vertical.color`),C(`drawingSettings.lineStyle`,`grid.horizontal.style`,`grid.vertical.style`),C(`drawingSettings.lineWidth`,`grid.horizontal.width`,`grid.vertical.width`)]},{title:`settings.crosshairMode`,rows:[C(`settings.horizontal`,`crosshair.horizontal.visible`),C(`settings.vertical`,`crosshair.vertical.visible`),C(`drawingSettings.color`,`crosshair.horizontal.color`,`crosshair.vertical.color`),C(`drawingSettings.lineStyle`,`crosshair.horizontal.style`,`crosshair.vertical.style`),C(`drawingSettings.lineWidth`,`crosshair.horizontal.width`,`crosshair.vertical.width`),C(`settings.labelBackground`,`crosshair.labelBackground`),C(`settings.labelText`,`crosshair.labelTextColor`)]},{title:`settings.sessionBreaks`,rows:[w(`drawingSettings.color`,`sessionBreaks.color`,{from:`axis.price.lineColor`}),w(`drawingSettings.lineStyle`,`sessionBreaks.style`),w(`drawingSettings.lineWidth`,`sessionBreaks.width`)]},{title:`objects.drawings`,rows:[w(`settings.handles`,`drawings.handleColor`,T(`#ffffff`))]}],Ee=[{title:`settings.section.orders`,trading:!0,rows:[w(`ticket.buy`,`trading.buyColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.buy)),w(`ticket.sell`,`trading.sellColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.sell)),w(`settings.profit`,`trading.profitColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.profit)),w(`settings.loss`,`trading.lossColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.loss)),w(`account.entry`,`trading.entryColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.entry))]},{title:`settings.section.signals`,rows:[w(`account.long`,`markers.longColor`,T(n.DEFAULT_SIGNAL_STYLE.longColor)),w(`account.short`,`markers.shortColor`,T(n.DEFAULT_SIGNAL_STYLE.shortColor)),w(`markers.neutral`,`markers.neutralColor`,T(n.DEFAULT_SIGNAL_STYLE.neutralColor))]},{title:`settings.section.tradeZones`,rows:[w(`settings.profit`,`tradeZones.profitColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.profitColor)),w(`settings.loss`,`tradeZones.lossColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.lossColor)),w(`settings.openTrade`,`tradeZones.activeColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.activeColor))]}],De={upColor:`settings.up`,downColor:`settings.down`,wickUpColor:`settings.upWick`,wickDownColor:`settings.downWick`,color:`drawingSettings.color`,lineColor:`drawingSettings.color`,lineWidth:`drawingSettings.lineWidth`,topColor:`settings.areaTop`,bottomColor:`settings.areaBottom`},Oe=new Set([`candlestick`,`heikinAshi`,`volumeCandles`,`equivolume`]);function ke(e){let t=`series.${e}.`;return Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(t)).map(n=>{let r=n.slice(t.length),i=De[r]??`drawingSettings.color`;return Oe.has(e)&&r===`upColor`&&(i=`settings.upBody`),Oe.has(e)&&r===`downColor`&&(i=`settings.downBody`),e===`baseline`&&r===`upColor`&&(i=`settings.aboveBase`),e===`baseline`&&r===`downColor`&&(i=`settings.belowBase`),C(i,n)})}var E=[...new Set([...Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(`series.`)),...[...xe,...Te,...Ee].flatMap(e=>e.rows.flatMap(e=>e.keys)),...[...Ce,...we].flatMap(e=>e.keys)])],Ae=`/* === TradeCanvas Widget — Premium Styles === */
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../LayoutSession-C5qP7hiA.cjs`),t=require(`../i18n-SIiP0kRx.cjs`);let n=require(`@tradecanvas/commons`),r=require(`@tradecanvas/core`);function i(e,t,r={}){return(0,n.resampleBars)(e,t,{weekStartsOn:r.weekStartsOn??1,timeZone:r.timeZone})}function a(e){if(e.length<2)return 0;let t=[];for(let n=1;n<e.length;n++){let r=e[n].time-e[n-1].time;r>0&&t.push(r)}return t.length===0?0:(t.sort((e,t)=>e-t),t[Math.floor(t.length/2)])}var o=[{zone:`Pacific/Honolulu`,city:`Honolulu`},{zone:`America/Los_Angeles`,city:`Los Angeles`},{zone:`America/Denver`,city:`Denver`},{zone:`America/Chicago`,city:`Chicago`},{zone:`America/New_York`,city:`New York`},{zone:`America/Toronto`,city:`Toronto`},{zone:`America/Sao_Paulo`,city:`São Paulo`},{zone:`UTC`,city:`UTC`},{zone:`Europe/London`,city:`London`},{zone:`Europe/Berlin`,city:`Frankfurt`},{zone:`Europe/Paris`,city:`Paris`},{zone:`Europe/Zurich`,city:`Zurich`},{zone:`Africa/Johannesburg`,city:`Johannesburg`},{zone:`Europe/Istanbul`,city:`Istanbul`},{zone:`Europe/Moscow`,city:`Moscow`},{zone:`Asia/Dubai`,city:`Dubai`},{zone:`Asia/Kolkata`,city:`Mumbai`},{zone:`Asia/Bangkok`,city:`Bangkok`},{zone:`Asia/Ho_Chi_Minh`,city:`Ho Chi Minh City`},{zone:`Asia/Jakarta`,city:`Jakarta`},{zone:`Asia/Singapore`,city:`Singapore`},{zone:`Asia/Hong_Kong`,city:`Hong Kong`},{zone:`Asia/Shanghai`,city:`Shanghai`},{zone:`Asia/Taipei`,city:`Taipei`},{zone:`Asia/Seoul`,city:`Seoul`},{zone:`Asia/Tokyo`,city:`Tokyo`},{zone:`Australia/Sydney`,city:`Sydney`},{zone:`Pacific/Auckland`,city:`Auckland`}],s=/^-?\d+$/,c=840;function l(e){if(!s.test(e))return null;let t=Number(e);return Math.abs(t)<=c?t:null}function u(e){return!e||e===`local`?null:e===`exchange`?`exchange`:s.test(e)?l(e):(0,n.isValidTimeZone)(e)?e:null}function d(e){return e===null?`local`:String(e)}function f(e,t,r,i){let a=(0,n.offsetAt)(null,t),s=o.filter(({zone:e})=>(0,n.isValidTimeZone)(e)).map(({zone:e,city:r})=>{let i=(0,n.offsetAt)(e,t);return{value:e,label:e===`UTC`?`UTC`:`(${(0,n.tzLabel)(i)}) ${r}`,offset:i}}),c=u(e);typeof c==`number`&&s.push({value:e,label:(0,n.tzLabel)(c),offset:c}),s.sort((e,t)=>e.offset-t.offset);let l=[{value:`local`,label:`${r} (${(0,n.tzLabel)(a)})`,offset:a}];if(i){let e=(0,n.offsetAt)(i.zone&&(0,n.isValidTimeZone)(i.zone)?i.zone:`UTC`,t);l.push({value:`exchange`,label:`${i.label} (${(0,n.tzLabel)(e)})`,offset:e})}return[...l,...s]}var p=6,m=8,h=120;function ee(e,t,n=`left`){let r=e.style,i=t.getBoundingClientRect();r.position=`fixed`,r.margin=`0`,r.top=r.bottom=r.left=r.right=``;let a=window.innerHeight-i.bottom-p-m,o=i.top-p-m;e.scrollHeight<=a||a>=o?(r.top=`${i.bottom+p}px`,r.bottom=`auto`,r.maxHeight=`${Math.max(h,a)}px`):(r.top=`auto`,r.bottom=`${window.innerHeight-i.top+p}px`,r.maxHeight=`${Math.max(h,o)}px`);let s=getComputedStyle(t).direction===`rtl`,c=n===`right`!==s,l=e.offsetWidth,u=c?i.right-l:i.left;r.left=`${Math.max(m,Math.min(u,window.innerWidth-l-m))}px`}var te=700,g=class{select=null;panel=null;rows=[];active=-1;typed=``;typedAt=0;onOutside=e=>{let t=e.target;this.panel?.contains(t)||this.select?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.panel?.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.select&&!this.select.isConnected&&this.close(!1)});constructor(e){this.layer=e}isOpenFor(e){return this.select===e}owns(e){return e!==null&&(e===this.select||this.panel?.contains(e)===!0)}open(e){this.close(!1),this.select=e;let t=document.createElement(`div`);t.className=`tcw-dropdown tcw-select-menu`,t.setAttribute(`role`,`listbox`),t.id=`tcw-select-menu-${Math.random().toString(36).slice(2,9)}`;let n=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;n&&t.setAttribute(`aria-label`,n.trim()),t.style.minWidth=`${e.getBoundingClientRect().width}px`,this.rows=[];for(let n of e.children)if(n instanceof HTMLOptGroupElement){let e=document.createElement(`div`);e.className=`tcw-select-group`,e.textContent=n.label,t.appendChild(e);for(let e of n.querySelectorAll(`option`))this.addRow(t,e,n.disabled)}else n instanceof HTMLOptionElement&&this.addRow(t,n,!1);t.addEventListener(`mousedown`,e=>e.preventDefault());let r=e=>this.rows.findIndex(t=>t.el.contains(e.target));t.addEventListener(`click`,e=>{let t=r(e);t>=0&&this.pick(t)}),t.addEventListener(`mousemove`,e=>{let t=r(e);t>=0&&t!==this.active&&this.enabled(t)&&this.setActive(t,!1)}),this.layer().appendChild(t),this.panel=t,ee(t,e),e.setAttribute(`aria-expanded`,`true`),e.setAttribute(`aria-controls`,t.id),this.setActive(this.rows.findIndex(e=>e.option.selected)),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.select;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.panel?.remove(),this.panel=null,this.rows=[],this.select=null,t.setAttribute(`aria-expanded`,`false`),t.removeAttribute(`aria-controls`),t.removeAttribute(`aria-activedescendant`),e&&t.isConnected&&t.focus())}key(e){if(!this.select)return!1;switch(e.key){case`ArrowDown`:return this.step(1),!0;case`ArrowUp`:return this.step(-1),!0;case`Home`:return this.setActive(this.nextEnabled(-1,1)),!0;case`End`:return this.setActive(this.nextEnabled(this.rows.length,-1)),!0;case`PageDown`:return this.step(8),!0;case`PageUp`:return this.step(-8),!0;case` `:return this.typed&&Date.now()-this.typedAt<=te?(this.typeahead(` `),!0):(this.active>=0?this.pick(this.active):this.close(!0),!0);case`Enter`:return this.active>=0?this.pick(this.active):this.close(!0),!0;case`Escape`:return this.close(!0),!0;case`Tab`:return this.close(!1),!1;default:return e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey?(this.typeahead(e.key),!0):!1}}destroy(){this.close(!1)}addRow(e,t,n){let r=document.createElement(`div`);r.className=`tcw-select-option`,r.id=`${e.id}-${this.rows.length}`,r.setAttribute(`role`,`option`),r.setAttribute(`aria-selected`,String(t.selected)),(t.disabled||n)&&r.setAttribute(`aria-disabled`,`true`);let i=document.createElement(`span`);i.className=`tcw-select-option-text`,i.textContent=t.label||t.textContent||``,t.dir&&(i.dir=t.dir);let a=document.createElement(`span`);a.className=`tcw-select-check`,a.setAttribute(`aria-hidden`,`true`),r.append(a,i),e.appendChild(r),this.rows.push({option:t,el:r})}enabled(e){return this.rows[e]?.el.getAttribute(`aria-disabled`)!==`true`}nextEnabled(e,t){for(let n=e+t;n>=0&&n<this.rows.length;n+=t)if(this.enabled(n))return n;return-1}step(e){let t=e>0?1:-1,n=this.active;for(let r=0;r<Math.abs(e);r++){let e=this.nextEnabled(n,t);if(e<0)break;n=e}n>=0&&this.setActive(n)}setActive(e,t=!0){this.rows[this.active]?.el.classList.remove(`tcw-active`),this.active=e;let n=this.rows[e];n&&(n.el.classList.add(`tcw-active`),this.select?.setAttribute(`aria-activedescendant`,n.el.id),t&&n.el.scrollIntoView?.({block:`nearest`}))}typeahead(e){let t=Date.now();this.typed=t-this.typedAt>te?e.toLowerCase():this.typed+e.toLowerCase(),this.typedAt=t;let n=e=>this.enabled(e)&&(this.rows[e].el.textContent??``).trim().toLowerCase().startsWith(this.typed),r=this.typed.length===1?this.active+1:Math.max(0,this.active);for(let e=0;e<this.rows.length;e++){let t=(r+e)%this.rows.length;if(n(t)){this.setActive(t);return}}}pick(e){let t=this.select,n=this.rows[e];if(!t||!n||!this.enabled(e))return;let r=!n.option.selected;n.option.selected=!0,this.close(!0),r&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},_=42,v=7,y=new Set([`US`,`CA`,`MX`,`BR`,`JP`,`KR`,`TW`,`HK`,`IL`,`PH`,`IN`,`ZA`,`AU`,`TH`,`SA`,`PE`,`CO`]);function b(e){try{let t=new Intl.Locale(e),n=t.getWeekInfo?.()??t.weekInfo;return n?n.firstDay===7?0:1:+!y.has(t.maximize().region??``)}catch{return 1}}function x(e,t,n){let r=(new Date(Date.UTC(e,t,1)).getUTCDay()-n+v)%v,i=[];for(let n=0;n<_;n++){let a=new Date(Date.UTC(e,t,1-r+n));i.push({year:a.getUTCFullYear(),month:a.getUTCMonth(),day:a.getUTCDate()})}return i}var ne=e=>String(e).padStart(2,`0`),S=e=>`${String(e.year).padStart(4,`0`)}-${ne(e.month+1)}-${ne(e.day)}`;function re(e){let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e??``);return t?{year:Number(t[1]),month:Number(t[2])-1,day:Number(t[3])}:null}function ie(){let e=new Date;return{year:e.getFullYear(),month:e.getMonth(),day:e.getDate()}}function ae(e,t){let n=new Date(Date.UTC(e.year,e.month,e.day+t));return{year:n.getUTCFullYear(),month:n.getUTCMonth(),day:n.getUTCDate()}}var oe=class{element;grid;titleEl;chosen=``;limits={};today=S(ie());view={year:0,month:0};focusDay=ie();constructor(e,t,n){this.locale=t,this.onPick=n;let r=document.createElement(`div`);r.className=`tcw-calendar`;let i=document.createElement(`div`);i.className=`tcw-calendar-head`;let a=document.createElement(`div`);a.className=`tcw-calendar-title`,a.setAttribute(`aria-live`,`polite`),i.append(this.navButton(e.prevMonth,-1),a,this.navButton(e.nextMonth,1));let o=document.createElement(`div`);o.className=`tcw-calendar-weekdays`,o.setAttribute(`aria-hidden`,`true`);let s=b(t),c=new Intl.DateTimeFormat(t,{weekday:`narrow`,timeZone:`UTC`});for(let e=0;e<v;e++){let t=document.createElement(`span`);t.className=`tcw-calendar-weekday`,t.textContent=c.format(new Date(Date.UTC(2023,0,1+(s+e)%v))),o.appendChild(t)}let l=document.createElement(`div`);l.className=`tcw-calendar-grid`,l.setAttribute(`role`,`grid`),l.addEventListener(`keydown`,e=>this.onKey(e)),l.addEventListener(`click`,e=>{let t=e.target.closest(`.tcw-calendar-day`);t&&!t.disabled&&t.dataset.date&&this.pick(t.dataset.date)});let u=document.createElement(`div`);u.className=`tcw-calendar-foot`;let d=document.createElement(`button`);d.type=`button`,d.className=`tcw-calendar-today`,d.textContent=e.today,d.addEventListener(`click`,()=>this.pick(this.today)),u.appendChild(d),r.append(i,o,l,u),this.element=r,this.grid=l,this.titleEl=a}show(e,t={}){this.chosen=e,this.limits=t,this.today=re(t.today)?t.today:S(ie());let n=this.clamp(re(e)??re(this.today));this.focusDay=n,this.view={year:n.year,month:n.month},this.render()}focusGrid(){this.grid.querySelector(`[tabindex="0"]`)?.focus()}navButton(e,t){let n=document.createElement(`button`);return n.type=`button`,n.className=`tcw-calendar-nav`,n.setAttribute(`aria-label`,e),n.innerHTML=t<0?`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M10 3.5L5.5 8l4.5 4.5"/></svg>`:`<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M6 3.5L10.5 8 6 12.5"/></svg>`,n.addEventListener(`click`,()=>this.turn(t)),n}turn(e){let t=new Date(Date.UTC(this.view.year,this.view.month+e,1));this.view={year:t.getUTCFullYear(),month:t.getUTCMonth()};let n=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.focusDay=this.clamp({...this.view,day:Math.min(this.focusDay.day,n)}),this.view={year:this.focusDay.year,month:this.focusDay.month},this.render()}clamp(e){let t=S(e),n=re(this.limits.min),r=re(this.limits.max);return n&&t<S(n)?n:r&&t>S(r)?r:e}allowed(e){let{min:t,max:n}=this.limits;return!(t&&e<t)&&!(n&&e>n)}render(){let e=this.locale;this.titleEl.textContent=new Intl.DateTimeFormat(e,{month:`long`,year:`numeric`,timeZone:`UTC`}).format(new Date(Date.UTC(this.view.year,this.view.month,1)));let t=this.today,n=S(this.focusDay),r=new Intl.DateTimeFormat(e,{dateStyle:`full`,timeZone:`UTC`});this.grid.textContent=``;let i=null;for(let[a,o]of x(this.view.year,this.view.month,b(e)).entries()){a%v===0&&(i=document.createElement(`div`),i.className=`tcw-calendar-week`,i.setAttribute(`role`,`row`),this.grid.appendChild(i));let e=S(o),s=document.createElement(`button`);s.type=`button`,s.className=`tcw-calendar-day`,s.dataset.date=e,s.setAttribute(`role`,`gridcell`),s.textContent=String(o.day),s.setAttribute(`aria-label`,r.format(new Date(Date.UTC(o.year,o.month,o.day)))),s.setAttribute(`aria-selected`,String(e===this.chosen)),s.tabIndex=e===n?0:-1,o.month!==this.view.month&&s.classList.add(`tcw-outside`),e===t&&s.classList.add(`tcw-today`),this.allowed(e)||(s.disabled=!0),i?.appendChild(s)}}onKey(e){let t={ArrowLeft:-1,ArrowRight:1,ArrowUp:-v,ArrowDown:v},n=this.element.isConnected&&getComputedStyle(this.element).direction===`rtl`;if(e.key in t){let r=n&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)?-t[e.key]:t[e.key];this.moveFocus(ae(this.focusDay,r))}else if(e.key===`PageUp`||e.key===`PageDown`)this.turn(e.key===`PageUp`?-1:1),this.focusGrid();else if(e.key===`Home`||e.key===`End`){let t=new Date(Date.UTC(this.view.year,this.view.month+1,0)).getUTCDate();this.moveFocus({...this.view,day:e.key===`Home`?1:t})}else if(e.key===`Enter`||e.key===` `)this.pick(S(this.focusDay));else return;e.preventDefault()}moveFocus(e){let t=this.clamp(e);this.focusDay=t,(t.year!==this.view.year||t.month!==this.view.month)&&(this.view={year:t.year,month:t.month}),this.render(),this.focusGrid()}pick(e){this.allowed(e)&&this.onPick(e)}},se=class{input=null;view=null;onOutside=e=>{let t=e.target;this.view?.element.contains(t)||this.input?.contains(t)||this.close(!1)};onAway=()=>this.close(!1);onScroll=e=>{e.target instanceof Node&&this.view?.element.contains(e.target)||this.close(!1)};watch=new MutationObserver(()=>{this.input&&!this.input.isConnected&&this.close(!1)});constructor(e,t,n){this.layer=e,this.labels=t,this.locale=n}isOpenFor(e){return this.input===e}owns(e){return e!==null&&(e===this.input||this.view?.element.contains(e)===!0)}open(e){this.close(!1),this.input=e;let t=new oe(this.labels(),this.locale(),e=>this.pick(e));t.show(e.value,{min:e.min||void 0,max:e.max||void 0});let n=t.element;n.setAttribute(`role`,`dialog`);let r=e.getAttribute(`aria-label`)??e.labels?.[0]?.textContent??``;r&&n.setAttribute(`aria-label`,r.trim()),n.addEventListener(`mousedown`,e=>{e.target.closest(`button`)||e.preventDefault()}),n.addEventListener(`keydown`,e=>{e.stopPropagation(),e.key===`Escape`&&(e.preventDefault(),this.close(!0))}),this.view=t,this.layer().appendChild(n),ee(n,e),document.addEventListener(`pointerdown`,this.onOutside,!0),window.addEventListener(`resize`,this.onAway),document.addEventListener(`scroll`,this.onScroll,{capture:!0,passive:!0}),this.watch.observe(document.documentElement,{childList:!0,subtree:!0})}close(e){let t=this.input;t&&(document.removeEventListener(`pointerdown`,this.onOutside,!0),window.removeEventListener(`resize`,this.onAway),document.removeEventListener(`scroll`,this.onScroll,{capture:!0}),this.watch.disconnect(),this.view?.element.remove(),this.view=null,this.input=null,e&&t.isConnected&&t.focus())}focusGrid(){this.view?.focusGrid()}destroy(){this.close(!1)}pick(e){let t=this.input;if(!t)return;let n=t.value!==e;t.value=e,this.close(!0),n&&(t.dispatchEvent(new Event(`input`,{bubbles:!0})),t.dispatchEvent(new Event(`change`,{bubbles:!0})))}},ce=()=>typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches,le=()=>typeof CSS>`u`||typeof CSS.supports!=`function`||CSS.supports(`selector(::-webkit-calendar-picker-indicator)`);function ue(e){if(!(e instanceof Element))return null;let t=e.closest(`select`);return!t||t.matches(`:disabled`)||t.multiple||t.size>1?null:t}function de(e){return!(e instanceof HTMLInputElement)||e.type!==`date`||e.dataset.tcwCalendar===`inline`||e.matches(`:disabled`)||e.readOnly?null:e}function fe(e,t){let n=new g(t.layer),r=new se(t.layer,t.labels,t.locale),i=t.native??ce,a=t.calendar??le,o=new WeakSet,s=e=>o.has(e)?!1:(o.add(e),!0),c=e=>{if(e.button!==0||i()||!s(e))return;let t=ue(e.target);if(t){if(e.preventDefault(),n.isOpenFor(t)){n.close(!0);return}t.focus(),n.open(t)}},l=e=>{if(i()||!a()||!s(e))return;let t=de(e.target);t&&(e.preventDefault(),r.isOpenFor(t)||r.open(t))},u=e=>{if(i()||!s(e))return;let t=ue(e.target);if(t){if(n.isOpenFor(t)){n.key(e)&&(e.preventDefault(),e.stopPropagation());return}(e.key===`Enter`||e.key===` `||e.altKey&&(e.key===`ArrowDown`||e.key===`ArrowUp`)||e.key===`F4`)&&(e.preventDefault(),e.stopPropagation(),n.open(t));return}let o=de(e.target);!o||!a()||(e.key===`Escape`&&r.isOpenFor(o)?(e.preventDefault(),e.stopPropagation(),r.close(!0)):(e.altKey&&e.key===`ArrowDown`||e.key===`F4`)&&(e.preventDefault(),r.isOpenFor(o)||r.open(o),r.focusGrid()))},d=e=>{if(!s(e))return;let t=e.target instanceof Node?e.target:null,i=e.relatedTarget instanceof Node?e.relatedTarget:null;n.owns(t)&&!n.owns(i)&&n.close(!1),r.owns(t)&&!r.owns(i)&&r.close(!1)};for(let t of e)t.addEventListener(`mousedown`,c,!0),t.addEventListener(`click`,l,!0),t.addEventListener(`keydown`,u,!0),t.addEventListener(`focusout`,d,!0);return()=>{for(let t of e)t.removeEventListener(`mousedown`,c,!0),t.removeEventListener(`click`,l,!0),t.removeEventListener(`keydown`,u,!0),t.removeEventListener(`focusout`,d,!0);n.destroy(),r.destroy()}}var pe=[{label:`Candlestick`,value:`candlestick`},{label:`Line`,value:`line`},{label:`Area`,value:`area`},{label:`Bar`,value:`bar`},{label:`Heikin-Ashi`,value:`heikinAshi`},{label:`Hollow Candle`,value:`hollowCandle`},{label:`Baseline`,value:`baseline`},{label:`Volume Candles`,value:`volumeCandles`},{label:`Equivolume`,value:`equivolume`},{label:`HLC Area`,value:`hlcArea`},{label:`Step Line`,value:`stepLine`},{label:`Line + Markers`,value:`lineWithMarkers`},{label:`High-Low`,value:`hiLo`},{label:`Renko`,value:`renko`},{label:`Line Break`,value:`lineBreak`},{label:`Kagi`,value:`kagi`},{label:`Point & Figure`,value:`pointAndFigure`},{label:`Range Bars`,value:`rangeBars`}],me=[{label:`Lines`,section:`lines`,tools:[{label:`Trend Line`,value:`trendLine`},{label:`Ray`,value:`ray`},{label:`Extended Line`,value:`extendedLine`},{label:`Info Line`,value:`infoLine`},{label:`Trend Angle`,value:`trendAngle`}]},{label:`Horizontal/Vertical`,section:`lines`,tools:[{label:`Horizontal Line`,value:`horizontalLine`},{label:`Horizontal Ray`,value:`horizontalRay`},{label:`Vertical Line`,value:`verticalLine`},{label:`Cross Line`,value:`crossLine`}]},{label:`Channels`,section:`lines`,tools:[{label:`Parallel Channel`,value:`parallelChannel`},{label:`Regression Channel`,value:`regressionChannel`}]},{label:`Fibonacci`,section:`fibonacci`,tools:[{label:`Fib Retracement`,value:`fibRetracement`},{label:`Fib Extension`,value:`fibExtension`},{label:`Fib Channel`,value:`fibChannel`},{label:`Fib Time Zones`,value:`fibTimeZones`},{label:`Fib Speed Resistance Fan`,value:`fibSpeedResistanceFan`},{label:`Fib Speed Resistance Arcs`,value:`fibArcs`},{label:`Fib Circles`,value:`fibCircles`},{label:`Fib Spiral`,value:`fibSpiral`},{label:`Fib Wedge`,value:`fibWedge`}]},{label:`Gann & Pitchforks`,section:`fibonacci`,tools:[{label:`Pitchfork`,value:`pitchfork`},{label:`Schiff Pitchfork`,value:`schiffPitchfork`},{label:`Modified Schiff Pitchfork`,value:`modifiedSchiffPitchfork`},{label:`Gann Fan`,value:`gannFan`},{label:`Gann Box`,value:`gannBox`},{label:`Gann Square`,value:`gannSquare`},{label:`Pitchfan`,value:`pitchfan`}]},{label:`Cycles`,section:`fibonacci`,tools:[{label:`Cyclic Lines`,value:`cyclicLines`},{label:`Time Cycles`,value:`timeCycles`},{label:`Sine Line`,value:`sineLine`}]},{label:`Patterns`,section:`patterns`,tools:[{label:`XABCD Pattern`,value:`xabcdPattern`},{label:`ABCD Pattern`,value:`abcdPattern`},{label:`Head and Shoulders`,value:`headAndShoulders`},{label:`Cypher Pattern`,value:`cypherPattern`},{label:`Three Drives Pattern`,value:`threeDrives`}]},{label:`Elliott Waves`,section:`patterns`,tools:[{label:`Elliott Wave`,value:`elliottWave`},{label:`Elliott Impulse Wave`,value:`elliottImpulse`},{label:`Elliott Correction Wave`,value:`elliottCorrection`},{label:`Elliott Triangle Wave`,value:`elliottTriangle`},{label:`Elliott Double Combo Wave`,value:`elliottDoubleCombo`},{label:`Elliott Triple Combo Wave`,value:`elliottTripleCombo`}]},{label:`Forecasting`,section:`forecasting`,tools:[{label:`Long/Short Position`,value:`riskReward`},{label:`Anchored VWAP`,value:`anchoredVWAP`},{label:`Fixed Range Volume Profile`,value:`volumeProfileRange`},{label:`Forecast`,value:`forecast`},{label:`Projection`,value:`projection`},{label:`Bars Pattern`,value:`barsPattern`}]},{label:`Measure`,section:`forecasting`,tools:[{label:`Price Range`,value:`priceRange`},{label:`Date Range`,value:`dateRange`},{label:`Date and Price Range`,value:`dateAndPriceRange`},{label:`Measure`,value:`measure`}]},{label:`Shapes`,section:`annotation`,tools:[{label:`Rectangle`,value:`rectangle`},{label:`Circle`,value:`circle`},{label:`Ellipse`,value:`ellipse`},{label:`Triangle`,value:`triangle`},{label:`Polyline`,value:`polyline`},{label:`Curve`,value:`curve`},{label:`Arc`,value:`arc`}]},{label:`Brushes`,section:`annotation`,tools:[{label:`Brush`,value:`brush`},{label:`Highlighter`,value:`highlighter`},{label:`Path`,value:`path`}]},{label:`Annotation`,section:`annotation`,tools:[{label:`Text`,value:`text`},{label:`Price Label`,value:`priceLabel`},{label:`Arrow`,value:`arrow`},{label:`Note`,value:`note`},{label:`Callout`,value:`callout`},{label:`Flag Mark`,value:`flag`},{label:`Arrow Mark`,value:`arrowMark`},{label:`Icon`,value:`icon`}]}],he=[`BTCUSDT`,`ETHUSDT`,`SOLUSDT`,`BNBUSDT`],ge={gridVisible:!0,volumeVisible:!0,volumeProfileVisible:!1,marketProfileVisible:!1,marketProfileSplit:!1,marketProfileLetters:!1,marketProfileBuckets:48,marketProfileOpacity:.32,depthHeatmapVisible:!1,depthHeatmapOpacity:.7,sessionShadingVisible:!1,pivotMarkersVisible:!1,pivotStrength:5,pivotStructureLabels:!1,periodLevelsVisible:!1,periodLevelsPeriod:`day`,legendVisible:!0,barCountdown:!0,indicatorValueLabels:!1,alignAxisLabels:!0,logScale:!1,scaleMode:`regular`,autoScale:!0,invertScale:!1,leftPriceScale:!1,crosshairMode:`magnet`,numberLocale:`en-US`,timezone:`local`,highLowLines:!1,mainSeriesVisible:!0,extendedHours:!0,chartTypeOptions:{}},C=(e,...t)=>({label:e,keys:t}),w=(e,t,n={})=>({label:e,keys:[t],auto:n}),T=e=>({hint:e}),_e={from:`panes.titleColor`},ve={title:`settings.section.lastPrice`,rows:[C(`settings.priceLine`,`lastPrice.visible`),C(`settings.up`,`lastPrice.upColor`),C(`settings.down`,`lastPrice.downColor`),C(`drawingSettings.lineStyle`,`lastPrice.style`),C(`drawingSettings.lineWidth`,`lastPrice.width`)]},ye={title:`settings.volume`,rows:[C(`settings.up`,`volume.upColor`),C(`settings.down`,`volume.downColor`)]},be={title:`settings.highLowLines`,rows:[w(`drawingSettings.color`,`highLow.color`,_e)]},xe=[ve,ye,be],Se=[C(`settings.legendText`,`legend.textColor`),C(`settings.legendLabels`,`legend.labelColor`)],Ce=[...Se,C(`settings.paneTitles`,`panes.titleColor`)],we=[C(`drawingSettings.text`,`axis.price.textColor`,`axis.time.textColor`),C(`settings.scaleLines`,`axis.price.lineColor`,`axis.time.lineColor`)],Te=[{title:`settings.section.background`,rows:[C(`settings.background`,`background.color`),C(`settings.paneBackground`,`panes.background`),C(`settings.paneSeparator`,`panes.separatorColor`),w(`settings.watermark`,`watermark.color`,_e)]},{title:`settings.gridLines`,rows:[C(`settings.horizontal`,`grid.horizontal.visible`),C(`settings.vertical`,`grid.vertical.visible`),C(`drawingSettings.color`,`grid.horizontal.color`,`grid.vertical.color`),C(`drawingSettings.lineStyle`,`grid.horizontal.style`,`grid.vertical.style`),C(`drawingSettings.lineWidth`,`grid.horizontal.width`,`grid.vertical.width`)]},{title:`settings.crosshairMode`,rows:[C(`settings.horizontal`,`crosshair.horizontal.visible`),C(`settings.vertical`,`crosshair.vertical.visible`),C(`drawingSettings.color`,`crosshair.horizontal.color`,`crosshair.vertical.color`),C(`drawingSettings.lineStyle`,`crosshair.horizontal.style`,`crosshair.vertical.style`),C(`drawingSettings.lineWidth`,`crosshair.horizontal.width`,`crosshair.vertical.width`),C(`settings.labelBackground`,`crosshair.labelBackground`),C(`settings.labelText`,`crosshair.labelTextColor`)]},{title:`settings.sessionBreaks`,rows:[w(`drawingSettings.color`,`sessionBreaks.color`,{from:`axis.price.lineColor`}),w(`drawingSettings.lineStyle`,`sessionBreaks.style`),w(`drawingSettings.lineWidth`,`sessionBreaks.width`)]},{title:`objects.drawings`,rows:[w(`settings.handles`,`drawings.handleColor`,T(`#ffffff`))]}],Ee=[{title:`settings.section.orders`,trading:!0,rows:[w(`ticket.buy`,`trading.buyColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.buy)),w(`ticket.sell`,`trading.sellColor`,T(n.DEFAULT_TRADING_CONFIG.orderColors?.sell)),w(`settings.profit`,`trading.profitColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.profit)),w(`settings.loss`,`trading.lossColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.loss)),w(`account.entry`,`trading.entryColor`,T(n.DEFAULT_TRADING_CONFIG.positionColors?.entry))]},{title:`settings.section.signals`,rows:[w(`account.long`,`markers.longColor`,T(n.DEFAULT_SIGNAL_STYLE.longColor)),w(`account.short`,`markers.shortColor`,T(n.DEFAULT_SIGNAL_STYLE.shortColor)),w(`markers.neutral`,`markers.neutralColor`,T(n.DEFAULT_SIGNAL_STYLE.neutralColor))]},{title:`settings.section.tradeZones`,rows:[w(`settings.profit`,`tradeZones.profitColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.profitColor)),w(`settings.loss`,`tradeZones.lossColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.lossColor)),w(`settings.openTrade`,`tradeZones.activeColor`,T(n.DEFAULT_TRADE_ZONE_STYLE.activeColor))]}],De={upColor:`settings.up`,downColor:`settings.down`,wickUpColor:`settings.upWick`,wickDownColor:`settings.downWick`,color:`drawingSettings.color`,lineColor:`drawingSettings.color`,lineWidth:`drawingSettings.lineWidth`,topColor:`settings.areaTop`,bottomColor:`settings.areaBottom`},Oe=new Set([`candlestick`,`heikinAshi`,`volumeCandles`,`equivolume`]);function ke(e){let t=`series.${e}.`;return Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(t)).map(n=>{let r=n.slice(t.length),i=De[r]??`drawingSettings.color`;return Oe.has(e)&&r===`upColor`&&(i=`settings.upBody`),Oe.has(e)&&r===`downColor`&&(i=`settings.downBody`),e===`baseline`&&r===`upColor`&&(i=`settings.aboveBase`),e===`baseline`&&r===`downColor`&&(i=`settings.belowBase`),C(i,n)})}var E=[...new Set([...Object.keys(n.CHART_STYLE_KEYS).filter(e=>e.startsWith(`series.`)),...[...xe,...Te,...Ee].flatMap(e=>e.rows.flatMap(e=>e.keys)),...[...Ce,...we].flatMap(e=>e.keys)])],Ae=`/* === TradeCanvas Widget — Premium Styles === */
2
2
 
3
3
  /*
4
4
  * The HTML \`hidden\` attribute only sets \`display: none\` via the UA stylesheet,
@@ -1,4 +1,4 @@
1
- import { O as e, a as t, c as n, d as r, f as i, i as a, n as o, o as s, r as c, t as l } from "../LayoutSession-xQgGnpGO.js";
1
+ import { O as e, a as t, c as n, d as r, f as i, i as a, n as o, o as s, r as c, t as l } from "../LayoutSession-CXCLFIvS.js";
2
2
  import { a as u, c as d, i as f, n as p, o as m, r as h, s as ee, t as g } from "../i18n-BaJ3lo-i.js";
3
3
  import { CHART_STYLE_KEYS as _, CHART_TYPE_ICONS as v, DARK_THEME as y, DEFAULT_SIGNAL_STYLE as b, DEFAULT_TRADE_ZONE_STYLE as x, DEFAULT_TRADING_CONFIG as S, DRAWING_TOOL_ICONS as te, LIGHT_THEME as ne, PHI as re, PRICE_SOURCES as ie, SANS_FONT_FAMILY as ae, UI_ICONS as oe, barTimeUnit as se, formatPrice as ce, formatVolumeLoc as le, iconSvg as ue, indicatorSource as de, isTimeFrame as fe, isValidTimeZone as pe, marketStatus as me, offsetAt as he, parseIndicatorSource as ge, phiStep as _e, readChartStyleOverrides as ve, readChartTypeOptions as ye, readIndicatorPlotStyles as be, readNews as xe, readQuote as Se, resampleBars as Ce, sanitizeDrawingOptions as we, sanitizeDrawingStyle as Te, stepDecimals as Ee, symbolTimeZone as De, tickBarCount as Oe, timeParts as ke, timeframeFollowsDays as Ae, timeframeToMs as C, tzLabel as je, wallToUtc as Me, zoneOffsetMinutes as Ne, zonedDateFormatter as Pe } from "@tradecanvas/commons";
4
4
  import { ChartStateManager as Fe, INDICATOR_CATEGORIES as Ie, INTERVAL_LIMITS as Le, INTERVAL_UNITS as Re, MAX_ALERT_BARS as ze, MIN_ALERT_BARS as Be, RANGE_PRESETS as Ve, ResamplingAdapter as He, SYMBOL_INDICATOR_IDS as Ue, indicatorCategory as We, indicatorValuePrecision as Ge, isSeriesPalette as Ke, plotColor as qe, plotShown as Je, rangePresetStart as Ye, servesTimeframe as Xe, sourceParam as Ze, withResampling as Qe } from "@tradecanvas/core";
@@ -32,11 +32,11 @@ export interface ChartWidgetOptions {
32
32
  */
33
33
  ui?: import('./widgetUI.js').WidgetUIPreset | import('./widgetUI.js').WidgetUITheme;
34
34
  /**
35
- * UI chrome language (toolbar, watchlist, indicator picker, status bar,
36
- * settings panel, hotkey sheet). A built-in table ('en', the default, or
37
- * 'vi'), layered under `messages` for host overrides/additions. Does not
38
- * translate the data-driven indicator/drawing-tool names from
39
- * `widgetConfig.ts` — see README "Widget i18n".
35
+ * The widget's language: its bars, menus, dialogs, panels and the names of
36
+ * its drawing tools, in one of 30 tables. 'en' (the default) and 'vi' are
37
+ * built in; call `registerWidgetLocales()` from
38
+ * '@tradecanvas/chart/widget/locales' for the others. `messages` overrides
39
+ * or adds single strings. Numbers follow `chartOptions.numberLocale`.
40
40
  */
41
41
  locale?: string;
42
42
  /** Override or add individual UI strings, on top of `locale`'s built-in table. */
@@ -186,6 +186,11 @@ export interface ChartWidgetOptions {
186
186
  historyLimit?: number;
187
187
  /** Bars per request when scrolling back for older bars (adapters with `fetchHistoryBefore`). Default 500. */
188
188
  historyPageSize?: number;
189
+ /**
190
+ * Options for the chart inside the widget, as `new Chart` takes them:
191
+ * `numberLocale`, `features` (`priceAxisAddButton`, `replay`…), `chartType`,
192
+ * `overrides`, `priceFormat` and the rest.
193
+ */
189
194
  chartOptions?: Partial<ChartOptions>;
190
195
  /**
191
196
  * A watchlist, a panel of the dock beside the chart: lists of symbols with