dipping-charts 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +216 -0
  3. package/dist/__tests__/FullFeaturedChart.test.d.ts +2 -0
  4. package/dist/__tests__/FullFeaturedChart.test.d.ts.map +1 -0
  5. package/dist/__tests__/indicators-accuracy.test.d.ts +2 -0
  6. package/dist/__tests__/indicators-accuracy.test.d.ts.map +1 -0
  7. package/dist/__tests__/indicators.test.d.ts +2 -0
  8. package/dist/__tests__/indicators.test.d.ts.map +1 -0
  9. package/dist/__tests__/setup.d.ts +1 -0
  10. package/dist/__tests__/setup.d.ts.map +1 -0
  11. package/dist/__tests__/validateCandle.test.d.ts +2 -0
  12. package/dist/__tests__/validateCandle.test.d.ts.map +1 -0
  13. package/dist/chart/index.d.ts +2 -0
  14. package/dist/chart/index.js +5 -0
  15. package/dist/chart/index.js.map +1 -0
  16. package/dist/components/TradingChart.d.ts +24 -0
  17. package/dist/components/TradingChart.d.ts.map +1 -0
  18. package/dist/components/TradingChart.js +100 -0
  19. package/dist/components/TradingChart.js.map +1 -0
  20. package/dist/components/index.d.ts +3 -0
  21. package/dist/components/index.d.ts.map +1 -0
  22. package/dist/dipping-charts.css +1 -0
  23. package/dist/index.d.ts +5 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +28 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/indicators/atr.d.ts +15 -0
  28. package/dist/indicators/atr.d.ts.map +1 -0
  29. package/dist/indicators/atr.js +30 -0
  30. package/dist/indicators/atr.js.map +1 -0
  31. package/dist/indicators/bollingerBands.d.ts +11 -0
  32. package/dist/indicators/bollingerBands.d.ts.map +1 -0
  33. package/dist/indicators/bollingerBands.js +39 -0
  34. package/dist/indicators/bollingerBands.js.map +1 -0
  35. package/dist/indicators/currencyStrength.d.ts +43 -0
  36. package/dist/indicators/currencyStrength.d.ts.map +1 -0
  37. package/dist/indicators/currencyStrength.js +53 -0
  38. package/dist/indicators/currencyStrength.js.map +1 -0
  39. package/dist/indicators/ema.d.ts +11 -0
  40. package/dist/indicators/ema.d.ts.map +1 -0
  41. package/dist/indicators/ema.js +24 -0
  42. package/dist/indicators/ema.js.map +1 -0
  43. package/dist/indicators/index.d.ts +19 -0
  44. package/dist/indicators/index.d.ts.map +1 -0
  45. package/dist/indicators/index.js +23 -0
  46. package/dist/indicators/index.js.map +1 -0
  47. package/dist/indicators/macd.d.ts +11 -0
  48. package/dist/indicators/macd.d.ts.map +1 -0
  49. package/dist/indicators/macd.js +52 -0
  50. package/dist/indicators/macd.js.map +1 -0
  51. package/dist/indicators/rsi.d.ts +11 -0
  52. package/dist/indicators/rsi.d.ts.map +1 -0
  53. package/dist/indicators/rsi.js +29 -0
  54. package/dist/indicators/rsi.js.map +1 -0
  55. package/dist/indicators/sma.d.ts +13 -0
  56. package/dist/indicators/sma.d.ts.map +1 -0
  57. package/dist/indicators/sma.js +22 -0
  58. package/dist/indicators/sma.js.map +1 -0
  59. package/dist/indicators/stochastic.d.ts +15 -0
  60. package/dist/indicators/stochastic.d.ts.map +1 -0
  61. package/dist/indicators/stochastic.js +34 -0
  62. package/dist/indicators/stochastic.js.map +1 -0
  63. package/dist/indicators/types.d.ts +102 -0
  64. package/dist/indicators/types.d.ts.map +1 -0
  65. package/dist/indicators/vwap.d.ts +14 -0
  66. package/dist/indicators/vwap.d.ts.map +1 -0
  67. package/dist/indicators/vwap.js +17 -0
  68. package/dist/indicators/vwap.js.map +1 -0
  69. package/dist/indicators/williamsR.d.ts +17 -0
  70. package/dist/indicators/williamsR.d.ts.map +1 -0
  71. package/dist/indicators/williamsR.js +19 -0
  72. package/dist/indicators/williamsR.js.map +1 -0
  73. package/dist/react/FullFeaturedChart.d.ts +3 -0
  74. package/dist/react/FullFeaturedChart.d.ts.map +1 -0
  75. package/dist/react/FullFeaturedChart.js +640 -0
  76. package/dist/react/FullFeaturedChart.js.map +1 -0
  77. package/dist/react/components/IndicatorSettings.d.ts +20 -0
  78. package/dist/react/components/IndicatorSettings.d.ts.map +1 -0
  79. package/dist/react/components/IndicatorSettings.js +748 -0
  80. package/dist/react/components/IndicatorSettings.js.map +1 -0
  81. package/dist/react/hooks/useChart.d.ts +15 -0
  82. package/dist/react/hooks/useChart.d.ts.map +1 -0
  83. package/dist/react/hooks/useChart.js +155 -0
  84. package/dist/react/hooks/useChart.js.map +1 -0
  85. package/dist/react/hooks/useIndicators.d.ts +10 -0
  86. package/dist/react/hooks/useIndicators.d.ts.map +1 -0
  87. package/dist/react/hooks/useIndicators.js +264 -0
  88. package/dist/react/hooks/useIndicators.js.map +1 -0
  89. package/dist/react/hooks/useLineTools.d.ts +26 -0
  90. package/dist/react/hooks/useLineTools.d.ts.map +1 -0
  91. package/dist/react/hooks/useLineTools.js +189 -0
  92. package/dist/react/hooks/useLineTools.js.map +1 -0
  93. package/dist/react/hooks/useShiftSnap.d.ts +12 -0
  94. package/dist/react/hooks/useShiftSnap.d.ts.map +1 -0
  95. package/dist/react/hooks/useShiftSnap.js +54 -0
  96. package/dist/react/hooks/useShiftSnap.js.map +1 -0
  97. package/dist/react/index.d.ts +14 -0
  98. package/dist/react/index.d.ts.map +1 -0
  99. package/dist/react/index.js +18 -0
  100. package/dist/react/index.js.map +1 -0
  101. package/dist/react/loadLightweightCharts.d.ts +18 -0
  102. package/dist/react/loadLightweightCharts.d.ts.map +1 -0
  103. package/dist/react/loadLightweightCharts.js +32 -0
  104. package/dist/react/loadLightweightCharts.js.map +1 -0
  105. package/dist/react/locale.d.ts +79 -0
  106. package/dist/react/locale.d.ts.map +1 -0
  107. package/dist/react/locale.js +158 -0
  108. package/dist/react/locale.js.map +1 -0
  109. package/dist/react/types.d.ts +130 -0
  110. package/dist/react/types.d.ts.map +1 -0
  111. package/dist/types/index.d.ts +24 -0
  112. package/dist/types/index.d.ts.map +1 -0
  113. package/dist/utils/getToolId.d.ts +9 -0
  114. package/dist/utils/getToolId.d.ts.map +1 -0
  115. package/dist/utils/getToolId.js +12 -0
  116. package/dist/utils/getToolId.js.map +1 -0
  117. package/dist/utils/mockData.d.ts +10 -0
  118. package/dist/utils/mockData.d.ts.map +1 -0
  119. package/dist/utils/mockData.js +61 -0
  120. package/dist/utils/mockData.js.map +1 -0
  121. package/dist/utils/snapCrosshair.d.ts +25 -0
  122. package/dist/utils/snapCrosshair.d.ts.map +1 -0
  123. package/dist/utils/validateCandle.d.ts +30 -0
  124. package/dist/utils/validateCandle.d.ts.map +1 -0
  125. package/dist/utils/validateCandle.js +21 -0
  126. package/dist/utils/validateCandle.js.map +1 -0
  127. package/examples/css/base.css +209 -0
  128. package/examples/css/chart.css +282 -0
  129. package/examples/css/indicators.css +255 -0
  130. package/examples/index.html +163 -0
  131. package/examples/js/chart.js +370 -0
  132. package/examples/js/indicators.js +27 -0
  133. package/examples/js/main.js +6 -0
  134. package/examples/js/ui.js +1641 -0
  135. package/lib/lightweight-charts.standalone.production.js +7 -0
  136. package/package.json +106 -0
  137. package/src/react/FullFeaturedChart.css +1007 -0
@@ -0,0 +1,640 @@
1
+ import { jsxs as c, jsx as t, Fragment as Ce } from "react/jsx-runtime";
2
+ import { useState as i, useEffect as v, useCallback as F, useRef as E } from "react";
3
+ import { useChart as Be } from "./hooks/useChart.js";
4
+ import { useIndicators as je } from "./hooks/useIndicators.js";
5
+ import { useLineTools as Ge } from "./hooks/useLineTools.js";
6
+ import { useShiftSnap as Je } from "./hooks/useShiftSnap.js";
7
+ import { IndicatorSettings as Ke } from "./components/IndicatorSettings.js";
8
+ import { filterValidCandles as qe, isValidCandle as le } from "../utils/validateCandle.js";
9
+ import { getLocaleStrings as Qe } from "./locale.js";
10
+ /* empty css */
11
+ const L = ["#26a69a", "#ef5350", "#2196f3", "#ff6f00", "#ab47bc", "#66bb6a", "#ffa726", "#42a5f5"], Ze = [
12
+ { value: "1m", key: "tf_1m" },
13
+ { value: "5m", key: "tf_5m" },
14
+ { value: "15m", key: "tf_15m" },
15
+ { value: "30m", key: "tf_30m" },
16
+ { value: "1h", key: "tf_1h" },
17
+ { value: "1d", key: "tf_1d" },
18
+ { value: "1w", key: "tf_1w" },
19
+ { value: "1M", key: "tf_1M" }
20
+ ], et = {
21
+ enabled: ["1m", "5m", "15m", "30m", "1h", "1d", "1w", "1M"],
22
+ disabled: [],
23
+ currentSession: "regular"
24
+ };
25
+ function tt(u, r) {
26
+ const h = `tool_${r}`, N = u[h];
27
+ return typeof N == "string" ? N : r;
28
+ }
29
+ function ot(u, r, h, N) {
30
+ try {
31
+ localStorage.setItem(u, JSON.stringify({
32
+ configs: r,
33
+ checked: Array.from(h),
34
+ macdColors: N
35
+ }));
36
+ } catch {
37
+ }
38
+ }
39
+ function st(u) {
40
+ try {
41
+ const r = localStorage.getItem(u);
42
+ if (!r) return null;
43
+ const h = JSON.parse(r);
44
+ return {
45
+ configs: h.configs,
46
+ checked: new Set(h.checked),
47
+ macdColors: h.macdColors
48
+ };
49
+ } catch {
50
+ return null;
51
+ }
52
+ }
53
+ function ge(u, r, h = 280, N = 50) {
54
+ return {
55
+ x: Math.max(8, Math.min(u, window.innerWidth - h - 8)),
56
+ y: Math.max(8, Math.min(r, window.innerHeight - N - 8))
57
+ };
58
+ }
59
+ function vt({
60
+ locale: u = "en",
61
+ data: r,
62
+ width: h,
63
+ height: N = 600,
64
+ className: B = "",
65
+ enableTimeframes: ye = !0,
66
+ enableIndicators: Te = !0,
67
+ enableDrawingTools: j = !0,
68
+ defaultTimeframe: xe = "5m",
69
+ timeframeAvailability: G = et,
70
+ onTimeframeChange: V,
71
+ realtimeCandle: T,
72
+ loading: ae = !1,
73
+ error: J = null,
74
+ symbol: nt,
75
+ statusBadge: Fe,
76
+ priceLines: W,
77
+ initialLineTools: Me,
78
+ onLineToolsChange: _e,
79
+ onDrawingToolClick: ie,
80
+ showVolume: re = !0,
81
+ indicatorStorageKey: R,
82
+ initialIndicatorState: p,
83
+ onIndicatorStateChange: K
84
+ }) {
85
+ const l = Qe(u), [P, De] = i(xe), [C, de] = i([]), [S, q] = i(!1), [U, k] = i(!1), [Q, g] = i(!1), [Y, $] = i(""), [me, Z] = i("add"), [O, A] = i(!1), [H, ee] = i({ x: 0, y: 0 }), [te, he] = i(!1), [oe, Ee] = i({ x: 0, y: 0 }), [X, z] = i(!1), b = R ? st(R) : null, Le = { ...{ sma: [], ema: [], rsi: [], macd: [], bbands: [], stochastic: [], atr: [], vwap: [], williamsR: [] }, ...(p == null ? void 0 : p.configs) || (b == null ? void 0 : b.configs) || {} }, Re = p != null && p.checked ? new Set(p.checked) : (b == null ? void 0 : b.checked) || /* @__PURE__ */ new Set(), Pe = (p == null ? void 0 : p.macdColors) || (b == null ? void 0 : b.macdColors) || { line: "#2962FF", signal: "#FF6D00" }, [M, f] = i(Le), [d, $e] = i(Re), [m, a] = i(null), [_, Oe] = i(Pe), { chartRef: Ae, chart: D, candleSeries: y, volumeSeries: se, setData: ue } = Be({ width: h, height: N }), { applyIndicators: pe } = je(D, C);
86
+ v(() => {
87
+ if (se)
88
+ try {
89
+ se.applyOptions({
90
+ visible: re
91
+ });
92
+ } catch {
93
+ }
94
+ }, [se, re]);
95
+ const Ie = F((e) => {
96
+ if (ne.current) {
97
+ const o = ne.current.getBoundingClientRect(), s = ge(o.left + o.width / 2, o.top + o.height / 2);
98
+ ee(s), A(!0);
99
+ }
100
+ }, []), n = Ge(D, {
101
+ onToolFinished: Ie,
102
+ onToolsChange: _e,
103
+ initialTools: Me
104
+ });
105
+ Je(D, y, C);
106
+ const fe = E([]), ne = E(null), Ve = F((e) => {
107
+ G.disabled.includes(e) || (De(e), V == null || V(e));
108
+ }, [G.disabled, V]);
109
+ v(() => {
110
+ if (r && r.length > 0) {
111
+ const e = qe(r, "FullFeaturedChart");
112
+ de(e);
113
+ }
114
+ }, [r]), v(() => {
115
+ if (T && C.length > 0) {
116
+ if (!le(T)) {
117
+ console.warn("[FullFeaturedChart] Skipping realtime candle with invalid values:", T);
118
+ return;
119
+ }
120
+ de((e) => {
121
+ const o = e[e.length - 1];
122
+ return (o && o.time === T.time ? [...e.slice(0, -1), T] : [...e, T]).filter(le);
123
+ });
124
+ }
125
+ }, [T]);
126
+ const ve = E(!0), ke = E(P);
127
+ v(() => {
128
+ if (C.length > 0) {
129
+ const e = ve.current || ke.current !== P;
130
+ try {
131
+ const o = C.filter(le);
132
+ o.length > 0 ? ue(o, e) : console.warn("[FullFeaturedChart] No valid data to display after final validation");
133
+ } catch (o) {
134
+ console.error("[FullFeaturedChart] Error setting chart data:", o);
135
+ }
136
+ ve.current = !1, ke.current = P;
137
+ }
138
+ }, [C, ue, P]), v(() => {
139
+ pe(M, _);
140
+ }, [M, C, pe, _]);
141
+ const be = E(!1);
142
+ v(() => {
143
+ if (!be.current) {
144
+ be.current = !0;
145
+ return;
146
+ }
147
+ R && ot(R, M, d, _), K && K({
148
+ configs: M,
149
+ checked: Array.from(d),
150
+ macdColors: _
151
+ });
152
+ }, [M, d, _, R, K]);
153
+ const I = E([]);
154
+ v(() => {
155
+ if (y)
156
+ return I.current.forEach((e) => {
157
+ try {
158
+ y.removePriceLine(e);
159
+ } catch {
160
+ }
161
+ }), I.current = [], W && W.length > 0 && W.forEach((e) => {
162
+ const o = {
163
+ solid: 0,
164
+ // LineStyle.Solid
165
+ dashed: 1,
166
+ // LineStyle.Dashed
167
+ dotted: 3
168
+ // LineStyle.Dotted
169
+ }, s = y.createPriceLine({
170
+ price: e.price,
171
+ color: e.color || "#FF9800",
172
+ lineWidth: e.lineWidth || 2,
173
+ lineStyle: o[e.lineStyle || "dashed"] || 1,
174
+ lineVisible: !0,
175
+ axisLabelVisible: e.axisLabelVisible !== !1,
176
+ title: e.label || ""
177
+ });
178
+ I.current.push(s);
179
+ }), () => {
180
+ const e = [...I.current];
181
+ I.current = [], e.forEach((o) => {
182
+ try {
183
+ y && typeof y.options == "function" && y.removePriceLine(o);
184
+ } catch {
185
+ }
186
+ });
187
+ };
188
+ }, [y, W]);
189
+ const w = F((e) => {
190
+ const o = new Set(d);
191
+ if (o.has(e))
192
+ o.delete(e), f((s) => ({ ...s, [e]: [] }));
193
+ else if (o.add(e), e === "sma" || e === "ema") {
194
+ const s = [5, 20, 60, 120], x = [2, 2, 1, 1], ze = s.map((ce, Ne) => ({
195
+ color: L[Ne % L.length],
196
+ thickness: x[Ne] || 1,
197
+ source: "close",
198
+ value: ce
199
+ }));
200
+ f((ce) => ({ ...ce, [e]: ze }));
201
+ } else f(e === "bbands" ? (s) => ({
202
+ ...s,
203
+ bbands: [{
204
+ color: L[0],
205
+ thickness: 2,
206
+ source: "close",
207
+ value: 20,
208
+ upperColor: "#F23645",
209
+ middleColor: "#2962FF",
210
+ lowerColor: "#089981",
211
+ stdDev: 2
212
+ }]
213
+ }) : e === "macd" ? (s) => ({
214
+ ...s,
215
+ macd: [{
216
+ fastPeriod: 12,
217
+ slowPeriod: 26,
218
+ signalPeriod: 9,
219
+ thickness: 2
220
+ }]
221
+ }) : e === "stochastic" ? (s) => ({
222
+ ...s,
223
+ stochastic: [{
224
+ kPeriod: 14,
225
+ dPeriod: 3,
226
+ smooth: 3,
227
+ kColor: "#2962FF",
228
+ dColor: "#FF6D00",
229
+ thickness: 2
230
+ }]
231
+ }) : e === "vwap" ? (s) => ({
232
+ ...s,
233
+ vwap: [{
234
+ color: "#E040FB",
235
+ thickness: 2
236
+ }]
237
+ }) : e === "atr" ? (s) => ({
238
+ ...s,
239
+ atr: [{
240
+ color: L[0],
241
+ thickness: 2,
242
+ source: "close",
243
+ value: 14
244
+ }]
245
+ }) : e === "williamsR" ? (s) => ({
246
+ ...s,
247
+ williamsR: [{
248
+ color: L[0],
249
+ thickness: 2,
250
+ source: "close",
251
+ value: 14
252
+ }]
253
+ }) : (s) => ({
254
+ ...s,
255
+ [e]: [{
256
+ color: L[0],
257
+ thickness: 2,
258
+ source: "close",
259
+ value: 14
260
+ }]
261
+ }));
262
+ $e(o);
263
+ }, [d]), We = F((e) => {
264
+ if (e.preventDefault(), n.selectedToolId) {
265
+ const o = ge(e.clientX, e.clientY);
266
+ ee(o), A(!0);
267
+ }
268
+ }, [n.selectedToolId]);
269
+ v(() => {
270
+ const e = (o) => {
271
+ const s = o.target.tagName;
272
+ if (!(s === "INPUT" || s === "TEXTAREA" || s === "SELECT")) {
273
+ if (o.key === "Escape") {
274
+ if (Q) {
275
+ g(!1);
276
+ return;
277
+ }
278
+ O && n.selectedToolId ? (n.removeSelectedTool(), A(!1)) : n.activeToolType && n.activateTool(n.activeToolType);
279
+ }
280
+ if ((o.ctrlKey || o.metaKey) && o.key === "z" && !o.shiftKey) {
281
+ const x = fe.current.pop();
282
+ x && D && D.addLineTool(x.toolType, x.points, x.options);
283
+ }
284
+ }
285
+ };
286
+ return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
287
+ }, [O, n, Q, D]);
288
+ const Se = () => {
289
+ $("Label"), Z("add"), g(!0);
290
+ }, we = () => {
291
+ Y && (me === "edit" ? n.updateText(Y) : n.addTextTool(Y)), g(!1), $("");
292
+ }, Ue = F(() => {
293
+ var e, o;
294
+ ((e = n.selectedTool) == null ? void 0 : e.toolType) === "Text" && ($(((o = n.selectedTool.options.text) == null ? void 0 : o.value) || ""), Z("edit"), g(!0));
295
+ }, [n.selectedTool]), Ye = (e) => {
296
+ e.target.closest(".context-menu-btn") || e.target.closest(".color-picker-dropdown") || (he(!0), Ee({
297
+ x: e.clientX - H.x,
298
+ y: e.clientY - H.y
299
+ }), e.preventDefault());
300
+ };
301
+ v(() => {
302
+ if (!te) return;
303
+ const e = (s) => {
304
+ ee({
305
+ x: s.clientX - oe.x,
306
+ y: s.clientY - oe.y
307
+ });
308
+ }, o = () => {
309
+ he(!1);
310
+ };
311
+ return window.addEventListener("mousemove", e), window.addEventListener("mouseup", o), () => {
312
+ window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", o);
313
+ };
314
+ }, [te, oe]);
315
+ const He = F((e) => {
316
+ var o;
317
+ n.selectedTool && n.selectedTool.toolType === "Text" && ($(((o = n.selectedTool.options.text) == null ? void 0 : o.value) || ""), Z("edit"), g(!0));
318
+ }, [n]), Xe = F(() => {
319
+ n.selectedTool && fe.current.push({
320
+ toolType: n.selectedTool.toolType,
321
+ points: n.selectedTool.points,
322
+ options: n.selectedTool.options
323
+ }), n.removeSelectedTool(), A(!1);
324
+ }, [n]);
325
+ return v(() => {
326
+ const e = (o) => {
327
+ const s = o.target;
328
+ s.closest(".color-palette-popup") || (S && !s.closest(".dropdown") && q(!1), U && !s.closest(".dropdown") && k(!1), O && !s.closest(".context-menu") && (A(!1), z(!1)), X && !s.closest(".color-picker-dropdown") && z(!1));
329
+ };
330
+ return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
331
+ }, [S, U, O, X]), /* @__PURE__ */ c(
332
+ "div",
333
+ {
334
+ className: `container ${B}`,
335
+ ref: ne,
336
+ style: { display: "flex", flexDirection: "column", height: "100%" },
337
+ children: [
338
+ /* @__PURE__ */ c("div", { className: "header", children: [
339
+ /* @__PURE__ */ c("div", { className: "header-left", children: [
340
+ ye && /* @__PURE__ */ t("div", { className: "timeframe-group", children: Ze.map(({ value: e, key: o }) => {
341
+ const s = G.disabled.includes(e);
342
+ return /* @__PURE__ */ t(
343
+ "button",
344
+ {
345
+ className: `btn-timeframe ${P === e ? "active" : ""} ${s ? "disabled" : ""}`,
346
+ onClick: () => Ve(e),
347
+ disabled: s,
348
+ title: s ? l.tf_unavailable : void 0,
349
+ children: l[o]
350
+ },
351
+ e
352
+ );
353
+ }) }),
354
+ Fe
355
+ ] }),
356
+ /* @__PURE__ */ c("div", { className: "header-right", children: [
357
+ j && n.activeToolType && /* @__PURE__ */ c("div", { className: "active-tool-badge", children: [
358
+ tt(l, n.activeToolType),
359
+ " ",
360
+ l.tool_drawing
361
+ ] }),
362
+ Te && /* @__PURE__ */ c("div", { className: "dropdown", children: [
363
+ /* @__PURE__ */ t("button", { className: "btn-text", onClick: () => {
364
+ q(!S), k(!1);
365
+ }, children: l.btn_indicators }),
366
+ S && /* @__PURE__ */ t("div", { className: "dropdown-menu show", id: "indicatorMenu", children: /* @__PURE__ */ c("div", { className: "indicator-menu-layout", children: [
367
+ /* @__PURE__ */ c("div", { className: "indicator-list-side", children: [
368
+ /* @__PURE__ */ t("div", { className: "indicator-category", children: l.cat_overlay }),
369
+ /* @__PURE__ */ c(
370
+ "div",
371
+ {
372
+ className: `indicator-item ${d.has("sma") ? "checked" : ""} ${m === "sma" ? "selected" : ""}`,
373
+ onClick: () => a("sma"),
374
+ children: [
375
+ /* @__PURE__ */ t("span", { children: l.ind_sma }),
376
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
377
+ e.stopPropagation(), w("sma"), a("sma");
378
+ } })
379
+ ]
380
+ }
381
+ ),
382
+ /* @__PURE__ */ c(
383
+ "div",
384
+ {
385
+ className: `indicator-item ${d.has("ema") ? "checked" : ""} ${m === "ema" ? "selected" : ""}`,
386
+ onClick: () => a("ema"),
387
+ children: [
388
+ /* @__PURE__ */ t("span", { children: l.ind_ema }),
389
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
390
+ e.stopPropagation(), w("ema"), a("ema");
391
+ } })
392
+ ]
393
+ }
394
+ ),
395
+ /* @__PURE__ */ c(
396
+ "div",
397
+ {
398
+ className: `indicator-item ${d.has("bbands") ? "checked" : ""} ${m === "bbands" ? "selected" : ""}`,
399
+ onClick: () => a("bbands"),
400
+ children: [
401
+ /* @__PURE__ */ t("span", { children: l.ind_bbands }),
402
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
403
+ e.stopPropagation(), w("bbands"), a("bbands");
404
+ } })
405
+ ]
406
+ }
407
+ ),
408
+ /* @__PURE__ */ c(
409
+ "div",
410
+ {
411
+ className: `indicator-item ${d.has("vwap") ? "checked" : ""} ${m === "vwap" ? "selected" : ""}`,
412
+ onClick: () => a("vwap"),
413
+ children: [
414
+ /* @__PURE__ */ t("span", { children: l.ind_vwap }),
415
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
416
+ e.stopPropagation(), w("vwap"), a("vwap");
417
+ } })
418
+ ]
419
+ }
420
+ ),
421
+ /* @__PURE__ */ t("div", { className: "indicator-category", children: l.cat_oscillator }),
422
+ /* @__PURE__ */ c(
423
+ "div",
424
+ {
425
+ className: `indicator-item ${d.has("rsi") ? "checked" : ""} ${m === "rsi" ? "selected" : ""}`,
426
+ onClick: () => a("rsi"),
427
+ children: [
428
+ /* @__PURE__ */ t("span", { children: l.ind_rsi }),
429
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
430
+ e.stopPropagation(), w("rsi"), a("rsi");
431
+ } })
432
+ ]
433
+ }
434
+ ),
435
+ /* @__PURE__ */ c(
436
+ "div",
437
+ {
438
+ className: `indicator-item ${d.has("macd") ? "checked" : ""} ${m === "macd" ? "selected" : ""}`,
439
+ onClick: () => a("macd"),
440
+ children: [
441
+ /* @__PURE__ */ t("span", { children: l.ind_macd }),
442
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
443
+ e.stopPropagation(), w("macd"), a("macd");
444
+ } })
445
+ ]
446
+ }
447
+ ),
448
+ /* @__PURE__ */ c(
449
+ "div",
450
+ {
451
+ className: `indicator-item ${d.has("stochastic") ? "checked" : ""} ${m === "stochastic" ? "selected" : ""}`,
452
+ onClick: () => a("stochastic"),
453
+ children: [
454
+ /* @__PURE__ */ t("span", { children: l.ind_stochastic }),
455
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
456
+ e.stopPropagation(), w("stochastic"), a("stochastic");
457
+ } })
458
+ ]
459
+ }
460
+ ),
461
+ /* @__PURE__ */ c(
462
+ "div",
463
+ {
464
+ className: `indicator-item ${d.has("atr") ? "checked" : ""} ${m === "atr" ? "selected" : ""}`,
465
+ onClick: () => a("atr"),
466
+ children: [
467
+ /* @__PURE__ */ t("span", { children: l.ind_atr }),
468
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
469
+ e.stopPropagation(), w("atr"), a("atr");
470
+ } })
471
+ ]
472
+ }
473
+ ),
474
+ /* @__PURE__ */ c(
475
+ "div",
476
+ {
477
+ className: `indicator-item ${d.has("williamsR") ? "checked" : ""} ${m === "williamsR" ? "selected" : ""}`,
478
+ onClick: () => a("williamsR"),
479
+ children: [
480
+ /* @__PURE__ */ t("span", { children: l.ind_williamsR }),
481
+ /* @__PURE__ */ t("div", { className: "indicator-checkbox", onClick: (e) => {
482
+ e.stopPropagation(), w("williamsR"), a("williamsR");
483
+ } })
484
+ ]
485
+ }
486
+ )
487
+ ] }),
488
+ /* @__PURE__ */ t("div", { className: "indicator-settings-side", children: m ? /* @__PURE__ */ t(
489
+ Ke,
490
+ {
491
+ indicator: m,
492
+ configs: M,
493
+ isChecked: d.has(m),
494
+ onConfigChange: (e, o) => {
495
+ f((s) => ({ ...s, [e]: o }));
496
+ },
497
+ macdColors: _,
498
+ onMacdColorsChange: Oe,
499
+ locale: u
500
+ }
501
+ ) : /* @__PURE__ */ t("div", { className: "indicator-empty-state", children: l.selectIndicator }) })
502
+ ] }) })
503
+ ] }),
504
+ j && /* @__PURE__ */ c("div", { className: "dropdown", children: [
505
+ /* @__PURE__ */ t("button", { className: "btn-text", onClick: () => {
506
+ ie && !ie() || (k(!U), q(!1));
507
+ }, children: l.btn_draw }),
508
+ U && /* @__PURE__ */ c("div", { className: "dropdown-menu show", children: [
509
+ /* @__PURE__ */ c("button", { className: "dropdown-item", onClick: () => {
510
+ n.activateTool("TrendLine"), k(!1);
511
+ }, children: [
512
+ /* @__PURE__ */ t("span", { className: "item-icon tossface", children: "📏" }),
513
+ /* @__PURE__ */ t("span", { children: l.tool_TrendLine })
514
+ ] }),
515
+ /* @__PURE__ */ c("button", { className: "dropdown-item", onClick: () => {
516
+ n.activateTool("HorizontalLine"), k(!1);
517
+ }, children: [
518
+ /* @__PURE__ */ t("span", { className: "item-icon tossface", children: "➖" }),
519
+ /* @__PURE__ */ t("span", { children: l.tool_HorizontalLine })
520
+ ] }),
521
+ /* @__PURE__ */ c("button", { className: "dropdown-item", onClick: () => {
522
+ n.activateTool("VerticalLine"), k(!1);
523
+ }, children: [
524
+ /* @__PURE__ */ t("span", { className: "item-icon", children: "|" }),
525
+ /* @__PURE__ */ t("span", { children: l.tool_VerticalLine })
526
+ ] }),
527
+ /* @__PURE__ */ c("button", { className: "dropdown-item", onClick: () => {
528
+ n.activateTool("Rectangle"), k(!1);
529
+ }, children: [
530
+ /* @__PURE__ */ t("span", { className: "item-icon tossface", children: "▭" }),
531
+ /* @__PURE__ */ t("span", { children: l.tool_Rectangle })
532
+ ] }),
533
+ /* @__PURE__ */ c("button", { className: "dropdown-item", onClick: () => {
534
+ n.activateTool("FibRetracement"), k(!1);
535
+ }, children: [
536
+ /* @__PURE__ */ t("span", { className: "item-icon", children: "Φ" }),
537
+ /* @__PURE__ */ t("span", { children: l.tool_FibRetracement })
538
+ ] }),
539
+ /* @__PURE__ */ c("button", { className: "dropdown-item", onClick: () => {
540
+ Se(), k(!1);
541
+ }, children: [
542
+ /* @__PURE__ */ t("span", { className: "item-icon", children: "T" }),
543
+ /* @__PURE__ */ t("span", { children: l.tool_Text })
544
+ ] })
545
+ ] })
546
+ ] }),
547
+ j && /* @__PURE__ */ c(Ce, { children: [
548
+ /* @__PURE__ */ t("div", { className: "separator" }),
549
+ /* @__PURE__ */ t("button", { className: "btn-delete", onClick: n.removeAllTools, children: l.btn_clearAll })
550
+ ] })
551
+ ] })
552
+ ] }),
553
+ /* @__PURE__ */ c("div", { className: "chart-wrapper", style: { position: "relative", flex: 1, minHeight: 0 }, children: [
554
+ /* @__PURE__ */ t(
555
+ "div",
556
+ {
557
+ ref: Ae,
558
+ style: { width: "100%", height: "100%" },
559
+ onContextMenu: We,
560
+ onDoubleClick: He
561
+ }
562
+ ),
563
+ ae && /* @__PURE__ */ c("div", { className: "chart-overlay loading-overlay", children: [
564
+ /* @__PURE__ */ t("div", { className: "loading-spinner" }),
565
+ /* @__PURE__ */ t("span", { children: l.loading })
566
+ ] }),
567
+ J && /* @__PURE__ */ c("div", { className: "chart-overlay error-overlay", children: [
568
+ /* @__PURE__ */ t("span", { className: "error-icon", children: "⚠️" }),
569
+ /* @__PURE__ */ t("span", { children: J })
570
+ ] }),
571
+ !ae && !J && C.length === 0 && /* @__PURE__ */ t("div", { className: "chart-overlay empty-overlay", children: /* @__PURE__ */ t("span", { children: l.noData }) })
572
+ ] }),
573
+ Q && /* @__PURE__ */ t("div", { className: "modal-overlay show", onClick: () => g(!1), children: /* @__PURE__ */ c("div", { className: "modal-content", onClick: (e) => e.stopPropagation(), children: [
574
+ /* @__PURE__ */ t("div", { className: "modal-title", children: me === "edit" ? l.textEdit : l.textAdd }),
575
+ /* @__PURE__ */ t(
576
+ "input",
577
+ {
578
+ type: "text",
579
+ className: "modal-input",
580
+ value: Y,
581
+ onChange: (e) => $(e.target.value),
582
+ onKeyDown: (e) => {
583
+ e.key === "Enter" && we(), e.key === "Escape" && g(!1);
584
+ },
585
+ placeholder: l.textPlaceholder,
586
+ autoFocus: !0
587
+ }
588
+ ),
589
+ /* @__PURE__ */ c("div", { className: "modal-buttons", children: [
590
+ /* @__PURE__ */ t("button", { className: "modal-btn modal-btn-cancel", onClick: () => g(!1), children: l.cancel }),
591
+ /* @__PURE__ */ t("button", { className: "modal-btn modal-btn-confirm", onClick: we, children: l.confirm })
592
+ ] })
593
+ ] }) }),
594
+ O && n.selectedTool && /* @__PURE__ */ c(
595
+ "div",
596
+ {
597
+ className: "context-menu show",
598
+ style: {
599
+ left: H.x,
600
+ top: H.y,
601
+ cursor: te ? "grabbing" : "grab"
602
+ },
603
+ onClick: (e) => e.stopPropagation(),
604
+ onMouseDown: Ye,
605
+ children: [
606
+ /* @__PURE__ */ t("button", { className: "context-menu-btn", onClick: () => n.updateLineWidth(Math.max(1, n.currentWidth - 1)), children: "−" }),
607
+ /* @__PURE__ */ t("div", { className: "width-display", children: n.currentWidth }),
608
+ /* @__PURE__ */ t("button", { className: "context-menu-btn", onClick: () => n.updateLineWidth(Math.min(10, n.currentWidth + 1)), children: "+" }),
609
+ /* @__PURE__ */ t("div", { className: "context-menu-separator" }),
610
+ /* @__PURE__ */ c("div", { className: "color-picker-dropdown", children: [
611
+ /* @__PURE__ */ t("button", { className: "color-current-btn", onClick: () => z(!X), children: /* @__PURE__ */ t("div", { className: "color-current-display", style: { background: n.currentColor } }) }),
612
+ X && /* @__PURE__ */ t("div", { className: "color-palette show", children: ["#000000", "#ef4444", "#2962FF", "#22c55e", "#eab308", "#a855f7", "#f97316"].map((e) => /* @__PURE__ */ t(
613
+ "button",
614
+ {
615
+ className: "color-option",
616
+ style: { background: e },
617
+ onClick: () => {
618
+ n.updateColor(e), z(!1);
619
+ }
620
+ },
621
+ e
622
+ )) })
623
+ ] }),
624
+ n.selectedTool.toolType === "Text" && /* @__PURE__ */ c(Ce, { children: [
625
+ /* @__PURE__ */ t("div", { className: "context-menu-separator" }),
626
+ /* @__PURE__ */ t("button", { className: "context-menu-btn", onClick: Ue, children: "T" })
627
+ ] }),
628
+ /* @__PURE__ */ t("div", { className: "context-menu-separator" }),
629
+ /* @__PURE__ */ t("button", { className: "context-menu-btn danger", onClick: Xe, children: "🗑️" })
630
+ ]
631
+ }
632
+ )
633
+ ]
634
+ }
635
+ );
636
+ }
637
+ export {
638
+ vt as FullFeaturedChart
639
+ };
640
+ //# sourceMappingURL=FullFeaturedChart.js.map