candleview 2.9.1 → 2.9.3

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
@@ -191,7 +191,7 @@ React keys must be passed directly to JSX without using spread:
191
191
  .subchart-scrollbar::-webkit-scrollbar-thumb:hover {
192
192
  background: ${r?.layout?.textColor||"#000000"}80;
193
193
  }
194
- `,Z={position:"fixed",left:`${h.x}px`,top:`${h.y}px`,background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"8px",padding:"0",width:"450px",maxWidth:"90vw",height:"500px",maxHeight:"80vh",zIndex:1e4,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",cursor:g?"grabbing":"default",userSelect:g?"none":"auto",display:"flex",flexDirection:"column"},lt={padding:"16px 16px 12px 16px",borderBottom:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,cursor:"grab",userSelect:"none",flexShrink:0},ut={fontSize:"14px",fontWeight:"bold",color:r?.layout?.textColor||"#000000",margin:0},x={padding:"16px",flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},j={marginBottom:"16px",flex:1,overflowY:"auto",overflowX:"hidden",...J},nt={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px",padding:"8px",background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px"},ct={fontSize:"12px",color:r?.layout?.textColor||"#000000",minWidth:"80px",fontWeight:"bold"},it={width:"80px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},B={width:"60px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},q={display:"flex",alignItems:"center",gap:"4px",position:"relative"},st={width:"24px",height:"24px",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",cursor:"pointer"},ht={position:"absolute",top:0,left:0,width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",opacity:0},gt={background:"transparent",border:"none",fontSize:"16px",cursor:"pointer",padding:"0",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",color:r?.chart?.downColor||"#ff4d4f"},ft={...gt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed"},Tt={width:"100%",background:"transparent",color:r?.chart?.lineColor||"#2962FF",border:`2px dashed ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"8px 16px",fontSize:"12px",cursor:"pointer",marginBottom:"16px",flexShrink:0},kt={...Tt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed",borderColor:`${r?.toolbar?.border||"#d9d9d9"}`},xt={display:"flex",justifyContent:"flex-end",gap:"8px",flexShrink:0},Et={background:"transparent",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},yt={background:r?.toolbar?.button?.active||"#2962FF",color:r?.toolbar?.button?.activeTextColor||"#ffffff",border:"none",borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},Rt={fontSize:"10px",color:`${r?.layout?.textColor||"#000000"}80`,marginTop:"8px",textAlign:"center",flexShrink:0},jt={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,background:"transparent"};if(!f||!o)return null;const z=et(s);return ge.createPortal(m.jsxs(y.Fragment,{children:[m.jsx("style",{children:O}),m.jsx("div",{style:jt,onClick:at,children:m.jsxs("div",{ref:M,style:Z,onClick:H=>H.stopPropagation(),onMouseDown:L,onKeyDown:$,children:[m.jsx("div",{ref:k,style:lt,onMouseDown:H=>{H.target===k.current&&H.preventDefault()},children:m.jsxs("div",{style:ut,children:[P()," ",n.systemSettings?.setting||"设置"]})}),m.jsxs("div",{style:x,children:[m.jsx("div",{style:j,className:"subchart-scrollbar",children:o.map((H,Q)=>m.jsxs("div",{style:nt,children:[m.jsx("div",{style:ct,children:H.paramName}),m.jsx("input",{type:"text",style:it,value:H.paramName,onChange:tt=>C(Q,tt.target.value),onClick:tt=>tt.stopPropagation(),placeholder:n.modal?.parameterName||"参数名"}),m.jsx("input",{type:"number",style:it,value:H.paramValue,onChange:tt=>v(Q,Number(tt.target.value)),onClick:tt=>tt.stopPropagation(),min:"1",max:"100",placeholder:n.modal?.parameterValue||"数值"}),m.jsxs("select",{style:B,value:H.lineWidth,onChange:tt=>R(Q,Number(tt.target.value)),onClick:tt=>tt.stopPropagation(),children:[m.jsx("option",{value:1,children:"1px"}),m.jsx("option",{value:2,children:"2px"}),m.jsx("option",{value:3,children:"3px"}),m.jsx("option",{value:4,children:"4px"}),m.jsx("option",{value:5,children:"5px"})]}),m.jsxs("div",{style:q,children:[m.jsx("div",{style:{...st,backgroundColor:H.lineColor},onClick:tt=>{tt.currentTarget.nextSibling?.click()}}),m.jsx("input",{type:"color",style:ht,value:H.lineColor,onChange:tt=>A(Q,tt.target.value),onClick:tt=>tt.stopPropagation()})]}),z.allowDelete&&m.jsx("button",{onClick:()=>_(Q),style:o.length<=z.minParams?ft:gt,disabled:o.length<=z.minParams,type:"button",title:o.length<=z.minParams?`${n.modal?.keepAtLeastOne||"至少保留"}${z.minParams}${n.modal?.parameterName||"个参数"}`:n.modal?.deleteParameter||"删除",children:"×"})]},`${H.paramName}-${Q}`))}),m.jsx("button",{onClick:S,style:o.length>=z.maxParams||!z.allowAdd?kt:Tt,disabled:o.length>=z.maxParams||!z.allowAdd,type:"button",title:o.length>=z.maxParams?`${n.modal?.maximumParameters||"最多允许"}${z.maxParams}${n.modal?.parameterName||"个参数"}`:z.allowAdd?n.modal?.addParameter||"添加参数":n.modal?.keepAtLeastOne||"不允许添加参数",children:o.length>=z.maxParams?`${n.modal?.maximumParameters||"已达到最大参数数量"}(${z.maxParams}${n.modal?.parameterName||"个"})`:z.allowAdd?`+ ${n.modal?.addParameter||"添加参数"}`:n.modal?.keepAtLeastOne||"不允许添加参数"}),m.jsxs("div",{style:xt,children:[m.jsx("button",{onClick:N,style:Et,type:"button",children:n.systemSettings?.cancel||"取消"}),m.jsx("button",{onClick:I,style:yt,type:"button",children:n.systemSettings?.confirm||"确定"})]}),m.jsxs("div",{style:Rt,children:[n.tooltips?.ctrlEnterToConfirm||"Ctrl+Enter: 确认",", ",n.tooltips?.escToCancel||"Esc: 取消",", ",n.modal?.dragToMove||"拖动标题栏移动"]})]})]})})]}),document.body)};class Fi{constructor(t){this.volumeSeries=null,this.refreshData=e=>{if(!this.volumeSeries)return;const i=e.props.chartData.map(r=>r.isVirtual?{time:r.time,value:r.volume,color:"rgba(0, 0, 0, 0)"}:{time:r.time,value:r.volume,color:r.close>=r.open?"rgba(38, 166, 154, 0.8)":"rgba(239, 83, 80, 0.8)"});i.length>0&&this.volumeSeries&&setTimeout(()=>{this.volumeSeries.setData(i)},0)},this.volumeSeries=t.props.chart.addSeries(rt.HistogramSeries,{priceScaleId:"volume_bottom",color:"#26a69a"}),t.props.chart.priceScale("volume_bottom").applyOptions({scaleMargins:{top:.9,bottom:0}})}destroy(t){if(this.volumeSeries&&t.props.chart){try{t.props.chart.removeSeries(this.volumeSeries)}catch{}this.volumeSeries=null}}}class Ei{constructor(t,e){this.candleSeries=null,this.refreshData=r=>{if(!this.candleSeries)return;const a=this.transformToCandlestickData(r.props.chartData);a.length>0&&setTimeout(()=>{this.candleSeries.setData(a)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{if(!this.candleSeries)return;if(!r||!r.props||!r.props.chart){this.candleSeries=null;return}const a=this.candleSeries;this.candleSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.candleSeries=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToCandlestickData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToCandlestickData(t){return t.map(e=>e.isVirtual?{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)"}:{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close})}getSeries(){return this.candleSeries}}class Fo{constructor(t,e){this.barSeries=null,this.theme=null,this.refreshData=r=>{if(!this.barSeries)return;const a=this.transformToBarData(r.props.chartData);a.length>0&&setTimeout(()=>{this.barSeries.setData(a)},0)},this.updateStyle=r=>{this.barSeries&&this.barSeries.applyOptions(r)},this.destroy=r=>{if(!this.barSeries)return;if(!r||!r.props||!r.props.chart){this.barSeries=null;return}const a=this.barSeries;this.barSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.barSeries=t.props.chart.addSeries(rt.BarSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",thinBars:!0,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBarData(t.props.chartData);i.length>0&&this.barSeries&&setTimeout(()=>{this.barSeries.setData(i)},0)}transformToBarData(t){return t.map(e=>{const i={time:e.time,open:Number(e.open),high:Number(e.high),low:Number(e.low),close:Number(e.close)};return e.isVirtual?{...i,color:"transparent",borderColor:"transparent"}:i})}getSeries(){return this.barSeries}}class Eo{constructor(t,e){this.lineSeries=null,this._lineWidht=2,this.refreshData=r=>{if(!this.lineSeries)return;const a=this.transformToLineData(r.props.chartData);a.length>0&&setTimeout(()=>{this.lineSeries.setData(a)},0)},this.updateStyle=r=>{this.lineSeries&&this.lineSeries.applyOptions(r)},this.destroy=r=>{if(!this.lineSeries)return;if(!r||!r.props||!r.props.chart){this.lineSeries=null;return}const a=this.lineSeries;this.lineSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.lineSeries=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidht,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToLineData(t.props.chartData);i.length>0&&this.lineSeries&&setTimeout(()=>{this.lineSeries.setData(i)},0)}transformToLineData(t){return t.filter(e=>!e.isVirtual).map(e=>({time:e.time,value:e.close}))}getSeries(){return this.lineSeries}}class yo{constructor(t,e){this.areaSeries=null,this.theme=null,this.refreshData=r=>{if(!this.areaSeries)return;const a=this.transformToAreaData(r.props.chartData);a.length>0&&setTimeout(()=>{this.areaSeries.setData(a)},0)},this.updateStyle=r=>{this.areaSeries&&this.areaSeries.applyOptions(r)},this.destroy=r=>{if(!this.areaSeries)return;if(!r||!r.props||!r.props.chart){this.areaSeries=null;return}const a=this.areaSeries;this.areaSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.areaSeries=t.props.chart.addSeries(rt.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToAreaData(t.props.chartData);i.length>0&&this.areaSeries&&setTimeout(()=>{this.areaSeries.setData(i)},0)}transformToAreaData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent",lineColor:"transparent",topColor:"transparent",bottomColor:"transparent"}:i})}getSeries(){return this.areaSeries}}class Ro{constructor(t,e){this.stepLineSeries=null,this.refreshData=r=>{if(!this.stepLineSeries)return;const a=this.transformToStepLineData(r.props.chartData);a.length>0&&setTimeout(()=>{this.stepLineSeries.setData(a)},0)},this.updateStyle=r=>{if(this.stepLineSeries){const a={...r,lineType:1};this.stepLineSeries.applyOptions(a)}},this.destroy=r=>{if(!this.stepLineSeries)return;if(!r||!r.props||!r.props.chart){this.stepLineSeries=null;return}const a=this.stepLineSeries;this.stepLineSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.stepLineSeries=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.stepLineColor||"#9C27B0",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.stepLineSeries.applyOptions({lineType:1}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToStepLineData(t.props.chartData);i.length>0&&this.stepLineSeries&&setTimeout(()=>{this.stepLineSeries.setData(i)},0)}transformToStepLineData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:i})}getSeries(){return this.stepLineSeries}}class Bo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.filter(o=>!o.isVirtual),s=a.length>0?a.reduce((o,l)=>o+l.close,0)/a.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const n=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,a)=>r+a.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Uo{constructor(t,e){this.series=null,this.theme=null,this.refreshData=r=>{if(!this.series)return;const a=this.transformToHistogramData(r.props.chartData);a.length>0&&setTimeout(()=>{this.series.setData(a)},0)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.HistogramSeries,{color:e.chart.histogramColor||"#4CAF50",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHistogramData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHistogramData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:{...i,color:e.close>=(e.open||0)?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.series}}class Io{constructor(t,e){this.series=null,this.theme=null,this.refreshData=r=>{if(!this.series)return;const a=this.transformToHollowCandlestickData(r.props.chartData);a.length>0&&setTimeout(()=>{this.series.setData(a)},0)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:"transparent",downColor:"transparent",borderUpColor:e.chart.candleUpColor||"#26a69a",borderDownColor:e.chart.candleDownColor||"#ef5350",wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHollowCandlestickData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHollowCandlestickData(t){return t.map(e=>{const i=e.close>e.open,r={time:e.time,open:e.open,high:e.high,low:e.low,close:e.close};return e.isVirtual?{...r,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:{...r,borderColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor,wickColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.series}}class Lo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=this.transformToHeikinAshiData(r.props.chartData);a.length>0&&setTimeout(()=>{this.series.setData(a)},0)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHeikinAshiData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHeikinAshiData(t){if(t.length===0)return[];const e=[];let i=null;for(let r=0;r<t.length;r++){const a=t[r];if(a.isVirtual){e.push({time:a.time,open:a.open,high:a.high,low:a.low,close:a.close,color:"rgba(0, 0, 0, 0)"});continue}let s,n,o,l;i===null?(s=(a.open+a.close)/2,l=(a.open+a.high+a.low+a.close)/4,n=a.high,o=a.low):(s=(i.open+i.close)/2,l=(a.open+a.high+a.low+a.close)/4,n=Math.max(a.high,s,l),o=Math.min(a.low,s,l));const h={time:a.time,open:s,high:n,low:o,close:l};e.push(h),i={open:s,close:l}}return e}getSeries(){return this.series}}class Ho{constructor(t,e){this.series=null,this.lineCount=3,this.globalChartData=[],this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,color:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.globalChartData=t.props.chartData;const i=this.generateLineBreakData(this.globalChartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}generateLineBreakData(t){if(t.length===0)return[];const e=[];let i=[];for(let r=0;r<t.length;r++){const a=t[r].close;if(e.length===0){e.push({time:t[r].time,value:a}),i.push(a);continue}(a>Math.max(...i)||a<Math.min(...i))&&(e.push({time:t[r].time,value:a}),i.push(a),i.length>this.lineCount&&i.shift())}return e}getSeries(){return this.series}setLineCount(t){this.lineCount=t}}class Ko{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToMountainData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToMountainData(t){return t.map(e=>({time:e.time,value:e.close,...e.isVirtual&&{lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Oo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.map(s=>{if(s.isVirtual)return{time:s.time,open:s.open,high:s.high,low:s.low,close:s.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const n=s.close>=s.open,o=n?s.close:s.open,l=n?s.open:s.close;return{time:s.time,open:l,high:s.high,low:s.low,close:o,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHighLowData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHighLowData(t){return t.map(e=>{if(e.isVirtual)return{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const i=e.close>=e.open,r=i?e.close:e.open,a=i?e.open:e.close;return{time:e.time,open:a,high:e.high,low:e.low,close:r,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}})}getSeries(){return this.series}}class jo{constructor(t,e){this.series=null,this._chart=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this.channelWidthPercent=.3,this._timeScale=null,this._lineWidth=2,this.refreshData=r=>{if(!this.series)return;this._chartData=r.props.chartData||[];const a=this.transformToBaselineData(r.props.chartData);a.length>0&&this.series.setData(a),this.requestUpdate()},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this._chartData=t.props.chartData||[],this._chart=t.props.chart,this._timeScale=this._chart.timeScale(),this.series=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidth,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.attachChannelRenderer(t),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i),this.requestUpdate()},0)}attachChannelRenderer(t){t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0)}transformToBaselineData(t){return t.filter(i=>!i.isVirtual).map(i=>({time:i.time,value:i.close}))}attached(t){this._chart=t.chart,this.requestUpdate()}updateAllViews(){this.requestUpdate()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&this.drawChannel(e)}}),[{renderer:()=>this._renderer}]}drawChannel(t){if(!this.series||!this._timeScale)return;const e=this._timeScale.getVisibleRange();if(!e)return;const i=this._chartData.filter(o=>!o.isVirtual&&o.time>=e.from&&o.time<=e.to);if(i.length<2)return;const r=i.map(o=>o.close),a=5,s=[];for(let o=0;o<r.length;o++){const l=Math.max(0,o-a+1),h=o+1,d=r.slice(l,h);s.push(d.reduce((g,c)=>g+c,0)/d.length)}const n=(Math.max(...s)-Math.min(...s))*this.channelWidthPercent;this.drawChannelLines(t,i,n)}drawChannelLines(t,e,i){t.save(),t.beginPath(),t.strokeStyle="#26a69a",t.lineWidth=this._lineWidth,t.setLineDash([]);let r=!0;for(const s of e){const n=this._timeScale.timeToCoordinate(s.time),o=s.close+i,l=this.series.priceToCoordinate(o);n===null||l===null||(r?(t.moveTo(n,l),r=!1):t.lineTo(n,l))}t.stroke(),t.restore(),t.save(),t.beginPath(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.lineWidth=this._lineWidth,t.setLineDash([]);let a=!0;for(const s of e){const n=this._timeScale.timeToCoordinate(s.time),o=s.close-i,l=this.series.priceToCoordinate(o);n===null||l===null||(a?(t.moveTo(n,l),a=!1):t.lineTo(n,l))}t.stroke(),t.restore(),this.drawChannelFill(t,e,i)}drawChannelFill(t,e,i){if(!(e.length<2)){t.save(),t.beginPath();for(let r=0;r<e.length;r++){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=a.close+i,o=this.series.priceToCoordinate(n);s===null||o===null||(r===0?t.moveTo(s,o):t.lineTo(s,o))}for(let r=e.length-1;r>=0;r--){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=this.series.priceToCoordinate(a.close);s===null||n===null||t.lineTo(s,n)}t.closePath(),t.fillStyle="rgba(38, 166, 154, 0.3)",t.fill(),t.restore(),t.save(),t.beginPath();for(let r=0;r<e.length;r++){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=this.series.priceToCoordinate(a.close);s===null||n===null||(r===0?t.moveTo(s,n):t.lineTo(s,n))}for(let r=e.length-1;r>=0;r--){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=a.close-i,o=this.series.priceToCoordinate(n);s===null||o===null||t.lineTo(s,o)}t.closePath(),t.fillStyle="rgba(239, 83, 80, 0.3)",t.fill(),t.restore()}}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate()}catch{}}getSeries(){return this.series}setChannelWidth(t){this.channelWidthPercent=Math.max(.01,Math.min(1,t)),this.requestUpdate()}getChannelWidth(){return this.channelWidthPercent}}class Wo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.filter(o=>!o.isVirtual),s=a.length>0?a.reduce((o,l)=>o+l.close,0)/a.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const n=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,a)=>r+a.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class No{constructor(t,e){this.currentChart=null,this.currentType=null,this.chartLayer=t,this.theme=e}switchChartType(t){if(!(this.currentType===t&&this.currentChart))switch(this.destroyCurrentChart(),this.currentType=t,t){case G.Candle:this.currentChart=new Ei(this.chartLayer,this.theme);break;case G.HollowCandle:this.currentChart=new Io(this.chartLayer,this.theme);break;case G.Bar:this.currentChart=new Fo(this.chartLayer,this.theme);break;case G.Line:this.currentChart=new Eo(this.chartLayer,this.theme);break;case G.Area:this.currentChart=new yo(this.chartLayer,this.theme);break;case G.StepLine:this.currentChart=new Ro(this.chartLayer,this.theme);break;case G.BaseLine:this.currentChart=new Bo(this.chartLayer,this.theme);break;case G.Histogram:this.currentChart=new Uo(this.chartLayer,this.theme);break;case G.HeikinAshi:this.currentChart=new Lo(this.chartLayer,this.theme);break;case G.LineBreak:this.currentChart=new Ho(this.chartLayer,this.theme);break;case G.Mountain:this.currentChart=new Ko(this.chartLayer,this.theme);break;case G.BaselineArea:this.currentChart=new Wo(this.chartLayer,this.theme);break;case G.HighLow:this.currentChart=new Oo(this.chartLayer,this.theme);break;case G.HLCArea:this.currentChart=new jo(this.chartLayer,this.theme);break;default:console.warn(`Unknown chart type: ${t}`),this.currentChart=new Ei(this.chartLayer,this.theme);break}}refreshData(){this.currentChart&&this.currentChart.refreshData(this.chartLayer)}updateStyle(t){this.currentChart&&this.currentChart.updateStyle(t)}getCurrentSeries(){return this.currentChart?this.currentChart.getSeries():null}getCurrentType(){return this.currentType}destroyCurrentChart(){this.currentChart&&(this.currentChart.destroy(this.chartLayer),this.currentChart=null)}destroy(){this.destroyCurrentChart(),this.currentType=null}}class Xo{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._menu=null,this._heatMapRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=a=>{this._chartData=a.props.chartData||[],this.requestUpdate()},this._closeCallBack=r,this.initializeHeatMap(t,e,i)}initializeHeatMap(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInHeatMapArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateHeatMapRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInHeatMapArea(t,e){return this.updateHeatMapRect(),t>=this._heatMapRect.x&&t<=this._heatMapRect.x+this._heatMapRect.width&&e>=this._heatMapRect.y&&e<=this._heatMapRect.y+this._heatMapRect.height}updateHeatMapRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*.25,r=e.width-i;this._heatMapRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateHeatMapRect(),0)}updateAllViews(){this.requestUpdate(),this.updateHeatMapRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawHeatMap(e),this.updateHeatMapRect())}}),[{renderer:()=>this._renderer}]}drawHeatMap(t){const e=this._chartData;if(!e||e.length===0)return;const i=e.filter(u=>!u.isVirtual&&u.volume);if(i.length===0)return;const r=Math.min(...i.map(u=>u.low)),s=Math.max(...i.map(u=>u.high))-r;if(s<=0)return;const n=this._width*.25,o=this._width-n,l=Math.min(200,Math.floor(this._height/2)),h=new Array(l).fill(0);i.forEach(u=>{const p=Math.min(l-1,Math.max(0,Math.floor((u.high-r)/s*l))),M=Math.min(l-1,Math.max(0,Math.floor((u.low-r)/s*l))),k=Math.max(1,p-M+1),P=u.volume/k;for(let S=M;S<=p;S++)h[S]+=P});const d=Math.max(...h);if(d===0)return;const g=2,c=this._height/l;t.save();for(let u=0;u<l;u++){const p=h[u];if(p===0)continue;const M=p/d,P=Math.max(M,.01),S=Math.max(g,n*P),_=Math.pow(P,.5);let C,v,A;if(_<.5){const L=_*2;C=Math.floor(0),v=Math.floor(165*L),A=Math.floor(255*(1-L)+255*L)}else{const L=(_-.5)*2;C=Math.floor(255*L),v=Math.floor(255*(1-L)),A=Math.floor(255*(1-L))}const R=.4+_*.6,U=`rgba(${C}, ${v}, ${A}, ${R})`,I=o+(n-S),N=this._height-(u+1)*c;t.fillStyle=U,t.fillRect(I,N,S,c)}t.restore()}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class Yo{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._cachedProfile=null,this._lastDataHash="",this._widthProportion=.35,this._menu=null,this._profileRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=a=>{this._chartData=a.props.chartData||[],this._cachedProfile=null,this.requestUpdate()},this._closeCallBack=r,this._config={profileWidth:.15,timeSlotMinutes:30,valueAreaPercent:.7,tickSize:.01,showInitialBalance:!0,showValueArea:!0,maxPriceLevels:80,simplifyTPO:!0},this.initializeMarketProfile(t,e,i)}initializeMarketProfile(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInProfileArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateProfileRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInProfileArea(t,e){return this.updateProfileRect(),t>=this._profileRect.x&&t<=this._profileRect.x+this._profileRect.width&&e>=this._profileRect.y&&e<=this._profileRect.y+this._profileRect.height}updateProfileRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*this._widthProportion,r=0;this._profileRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateProfileRect(),0)}updateAllViews(){this.requestUpdate(),this.updateProfileRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawMarketProfile(e),this.updateProfileRect())}}),[{renderer:()=>this._renderer}]}drawMarketProfile(t){const e=this._chartData;if(!e||e.length===0)return;const i=this.getDataHash(e);if((!this._cachedProfile||this._lastDataHash!==i)&&(this._cachedProfile=this.calculateProfile(e),this._lastDataHash=i),!this._cachedProfile)return;const r=this._width*this._widthProportion;t.clearRect(0,0,r,this._height),this.drawProfileBars(t,this._cachedProfile,r),this._config.showValueArea&&this.drawValueArea(t,this._cachedProfile,r)}getDataHash(t){return t.length===0?"empty":`${t.length}_${t[0].time}_${t[t.length-1].time}`}calculateProfile(t){if(t.length===0)return null;const e=t.filter(g=>!g.isVirtual);if(e.length===0)return null;const i=Math.min(...e.map(g=>g.low)),r=Math.max(...e.map(g=>g.high)),a=r-i;if(a<=0)return null;const s=Math.min(this._config.maxPriceLevels,Math.floor(this._height/3)),n=a/s,o=[];for(let g=0;g<=s;g++)o.push({price:i+g*n,count:0,volume:0});e.forEach(g=>{const c=this.findPriceLevel(o,g.high),u=this.findPriceLevel(o,g.low);for(let p=u;p<=c;p++)o[p].count++,o[p].volume+=g.volume||0});const l=Math.max(...o.map(g=>g.count)),h=o.find(g=>g.count===l),d=this.calculateSimpleValueArea(o,this._config.valueAreaPercent);return{levels:o,minPrice:i,maxPrice:r,priceRange:a,poc:h?h.price:i+a/2,valueAreaHigh:d.high,valueAreaLow:d.low,maxCount:l}}findPriceLevel(t,e){const i=t[0].price,r=t[t.length-1].price,a=r-i;return e<=i?0:e>=r?t.length-1:Math.min(t.length-1,Math.max(0,Math.floor((e-i)/a*t.length)))}calculateSimpleValueArea(t,e){const r=t.reduce((h,d)=>h+d.count,0)*e,a=Math.max(...t.map(h=>h.count)),s=t.findIndex(h=>h.count===a);let n=0,o=s,l=s;for(;n<r&&(o<t.length-1||l>0);){let h=o<t.length-1?t[o+1].count:0,d=l>0?t[l-1].count:0;if(h>=d&&o<t.length-1)o++,n+=t[o].count;else if(l>0)l--,n+=t[l].count;else break}return{high:t[o].price,low:t[l].price}}drawProfileBars(t,e,i){const{levels:r,minPrice:a,maxPrice:s,priceRange:n,maxCount:o}=e;if(n<=0)return;t.save();const l=i,h=this._height/r.length;r.forEach(d=>{if(d.count===0)return;const g=(d.price-a)/n,c=this._height-g*this._height,u=d.count/o,p=h,M=this.getProfileColor(u);t.fillStyle=M;const k=Math.max(2,l*u*.8);t.fillRect(0,c-p/2,k,p)}),t.restore()}drawValueArea(t,e,i){const{valueAreaHigh:r,valueAreaLow:a,minPrice:s,maxPrice:n,priceRange:o,poc:l}=e;if(o<=0)return;const h=(r-s)/o,d=(a-s)/o,g=(l-s)/o,c=this._height-h*this._height,u=this._height-d*this._height,p=this._height-g*this._height;t.save(),t.fillStyle="rgba(255, 215, 0, 0.1)",t.fillRect(0,c,i,u-c),t.strokeStyle="rgba(255, 215, 0, 0.6)",t.lineWidth=1,t.setLineDash([3,2]),t.beginPath(),t.moveTo(0,c),t.lineTo(i,c),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.setLineDash([]),t.lineWidth=1,t.beginPath(),t.moveTo(0,p),t.lineTo(i,p),t.stroke(),t.restore()}getProfileColor(t){return t<.3?"rgba(100, 150, 255, 0.4)":t<.6?"rgba(50, 100, 200, 0.6)":"rgba(0, 50, 150, 0.8)"}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class Vo extends y.Component{constructor(t){super(t),this.canvasRef=y.createRef(),this.containerRef=y.createRef(),this.allDrawings=[],this.doubleClickTimeout=null,this.chartEventManager=null,this.originalChartOptions=null,this.currentMarkSettingsStyle=null,this.chartMarkManager=null,this.chartMarkTextEditManager=null,this.mainChartTechnicalIndicatorManager=null,this.staticMarkManager=null,this.volume=null,this.volumeHeatMap=null,this.marketProfile=null,this.mainChartManager=null,this.executeEventMarksScriptForChartData=()=>{const{chartData:e}=this.props,{isIncrement:i}=this.state;if(!i||!e||!Array.isArray(e)||e.length===0)return;const r=e.filter(s=>s&&s.isVirtual===!1);if(r.length===0)return;r.slice(-1).forEach(s=>{if(!s)return;const{open:n,high:o,low:l,close:h,time:d}=s;h!==void 0&&this.chartMarkManager?.priceEventMarkManager?.executeScriptAtPrice(n,o,l,h),d!==void 0&&this.chartMarkManager?.timeEventMarkManager?.executeScriptAtTime(d)})},this.swtichMainChartType=()=>{this.mainChartManager?.switchChartType(this.props.currentMainChartType),this.mainChartManager?.refreshData(),this.updateStaticMark()},this.setCursorType=e=>{e&&this.setState({cursorType:e})},this.initializeMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager)return;const{selectedMainChartIndicator:e}=this.props;e&&this.updateSelectedMainChartIndicators()},this.updateAllMainChartIndicatorData=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&this.mainChartTechnicalIndicatorManager?.updateAllMainChartIndicatorData(this,i)})},this.updateMainChartIndicators=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&(this.mainChartTechnicalIndicatorManager?.removeIndicator(this.props.chart,i.type),this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,i))})},this.updateSelectedMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager||!this.props.chartData)return;const{selectedMainChartIndicator:e}=this.props;e&&(D.HEATMAP===e.type||D.MARKETPROFILE===e.type||this.setState(i=>{const r=i.selectedMainChartIndicators.some(o=>o.type===e.type);let a;r?a=i.selectedMainChartIndicators.map(o=>o.type===e.type?e:o):a=[...i.selectedMainChartIndicators,e];const s=a.map(o=>o.type).filter(o=>o!==null),n=Yt().map(o=>{if(o.type&&s.includes(o.type)){const l=a.find(h=>h.type===o.type);return{...o,visible:!0,params:l?.params||o.params}}return{...o,visible:!1}});return{selectedMainChartIndicators:a,selectedMainChartIndicatorTypes:s,modalConfirmChartInfoIndicators:n}},()=>{this.updateMainChartIndicators()}))},this.handleOpenIndicatorSettings=e=>{e.type&&this.setState({modalEditingChartInfoIndicator:e,isMainChartIndicatorsModalOpen:!0})},this.handleMainChartIndicatorsSettingConfirm=e=>{e.params&&(e.params=e.params.filter(i=>i.paramValue!==0));try{this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.map(r=>r.type===e.type?e:r)})),this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}catch{this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}},this.handleRemoveIndicator=e=>{if(!(!e||!this.mainChartTechnicalIndicatorManager||!this.props.chart)){if(e===D.HEATMAP){setTimeout(()=>{this.volumeHeatMap&&(this.volumeHeatMap.destroy(),this.volumeHeatMap=null)},0);return}if(e===D.MARKETPROFILE){setTimeout(()=>{this.marketProfile&&(this.marketProfile.destroy(),this.marketProfile=null)},0);return}this.mainChartTechnicalIndicatorManager.removeIndicator(this.props.chart,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.filter(r=>r.type!==e),selectedMainChartIndicatorTypes:i.selectedMainChartIndicatorTypes.filter(r=>r!==e)})),this.props.onMainChartIndicatorChange&&this.props.selectedMainChartIndicator?.type===e&&this.props.onMainChartIndicatorChange(null),this.props.onToolSelect&&this.props.selectedMainChartIndicator?.type===e&&this.props.onToolSelect("")}},this.setPriceEventMode=()=>{this.chartMarkManager?.setPriceEventMode(this)},this.setTimeEventMode=()=>{this.chartMarkManager?.setTimeEventMode(this)},this.setMockKLineMarkMode=()=>{this.chartMarkManager?.setMockKLineMarkMode(this)},this.initializeGraphManager=()=>{this.chartMarkManager?.initializeMarkManager(this)},this.initializeGraphManagerProps=()=>{this.chartMarkManager?.initializeMarkManagerProps(this)},this.destroyGraphManager=()=>{this.chartMarkManager?.destroyMarkManager()},this.setTimeEventScriptById=(e,i)=>{this.chartMarkManager?.timeEventMarkManager?.setScriptById(e,i)},this.setPriceEventScriptById=(e,i)=>{this.chartMarkManager?.priceEventMarkManager?.setScriptById(e,i)},this.showAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.showAllMarks()},this.hideAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.hideAllMarks()},this.clearAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.deleteAllMark()},this.setSchiffPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSchiffPitchforkMode(this)},this.setHeatMapMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeatMapMode(this)},this.setTextEditMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTextEditMarkMode(this)},this.setBubbleBoxMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBubbleBoxMarkMode(this)},this.setPinMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPinMarkMode(this)},this.setEmojiMarkMode=e=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEmojiMarkMode(this,e)},this.setSignpostMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSignpostMarkMode(this)},this.setPriceNoteMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceNoteMarkMode(this)},this.setFlagMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFlagMarkMode(this)},this.setPriceLabelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceLabelMode(this)},this.setShortPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setShortPositionMarkMode(this)},this.setLongPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLongPositionMarkMode(this)},this.setThickArrowLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setThickArrowLineMode(this)},this.setEraserMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEraserMode(this)},this.setMarkerPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setMarkerPenMode(this)},this.setBrushMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBrushMode(this)},this.setPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPenMode(this)},this.setPencilMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPencilMode(this)},this.setTimePriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimePriceRangeMarkMode(this)},this.setPriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceRangeMarkMode(this)},this.setTimeRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimeRangeMarkMode(this)},this.setElliottTripleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTripleCombinationMode(this)},this.setElliottDoubleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottDoubleCombinationMode(this)},this.setElliottTriangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTriangleMode(this)},this.setElliottCorrectiveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottCorrectiveMode(this)},this.setElliottImpulseMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottImpulseMode(this)},this.setTriangleABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleABCDMode(this)},this.setABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setABCDMode(this)},this.setHeadAndShouldersMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeadAndShouldersMode(this)},this.setXABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setXABCDMode(this)},this.setDoubleCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDoubleCurveMode(this)},this.setCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCurveMode(this)},this.setSectorMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSectorMode(this)},this.setFibonacciExtensionBaseTimeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBaseTimeMode(this)},this.setFibonacciExtensionBasePriceMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBasePriceMode(this)},this.setFibonacciChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciChannelMode(this)},this.setFibonacciFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciFanMode(this)},this.setFibonacciWedgeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciWedgeMode(this)},this.setFibonacciSpiralMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciSpiralMode(this)},this.setFibonacciCircleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciCircleMode(this)},this.setFibonacciArcMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciArcMode(this)},this.setFibonacciRetracementMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciRetracementMode(this)},this.setFibonacciTimeZoonMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciTimeZoonMode(this)},this.setGannRectangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannRectangleMode(this)},this.setGannBoxMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannBoxMode(this)},this.setGannFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannFanMode(this)},this.setTriangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleMarkMode(this)},this.setEllipseMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEllipseMarkMode(this)},this.setCircleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCircleMarkMode(this)},this.setRectangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setRectangleMarkMode(this)},this.setEnhancedAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEnhancedAndrewPitchforkMode(this)},this.setAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setAndrewPitchforkMode(this)},this.setDisjointChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDisjointChannelMarkMode(this)},this.setEquidistantChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEquidistantChannelMarkMode(this)},this.setLinearRegressionChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLinearRegressionChannelMode(this)},this.setLineSegmentMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLineSegmentMarkMode(this)},this.setHorizontalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHorizontalLineMode(this)},this.setVerticalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setVerticalLineMode(this)},this.setArrowLineMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setArrowLineMarkMode(this)},this.setParallelChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setParallelChannelMarkMode(this)},this.showGraphMarkToolBar=e=>{if(this.state.selectedGraphMark&&this.state.selectedGraphMark.id===e.id||this.state.selectedGraphMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedGraphMark:e,markToolBarPosition:i,showGraphMarkToolBar:!0})},this.closeGraphMarkToolBar=()=>{this.setState({showGraphMarkToolBar:!1})},this.showTableMarkToolBar=e=>{if(this.state.selectedTableMark&&this.state.selectedTableMark.id===e.id||this.state.selectedTableMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedTableMark:e,markToolBarPosition:i,showTableMarkToolBar:!0})},this.closeTableMarkToolBar=()=>{this.setState({showTableMarkToolBar:!1})},this.showTextEditMarkToolBar=(e,i)=>{if(this.state.selectedTextEditMark&&this.state.selectedTextEditMark.id===e.id||this.state.selectedTextEditMark)return;let r={x:20,y:20};if(e.points.length>0){const a=e.points[0];r={x:Math.max(10,a.x-150),y:Math.max(10,a.y-80)}}this.setState({selectedTextEditMark:e,markToolBarPosition:r,showTextMarkToolBar:!0,isShowGrapTool:i})},this.closeTextMarkToolBar=()=>{this.setState({showTextMarkToolBar:!1})},this.handleMouseDown=e=>{this.chartEventManager?.mouseDown(this,e)},this.handleMouseUp=e=>{this.chartEventManager?.mouseUp(this,e)},this.handleMouseMove=e=>{this.chartEventManager?.mouseMove(this,e)},this.handleViewportShiftLeft=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("left")},this.handleViewportShiftRight=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("right")},this.handleZoomIn=()=>{this.props.viewportManager&&this.props.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.props.viewportManager&&this.props.viewportManager.zoomOut()},this.openIndicatorsModal=()=>{this.setState({isMainChartIndicatorsModalOpen:!0})},this.handleToggleIndicator=e=>{e&&(this.mainChartTechnicalIndicatorManager?.isVisible(e)?this.mainChartTechnicalIndicatorManager?.hideIndicator(e):this.mainChartTechnicalIndicatorManager?.showIndicator(e))},this.renderChartInfo=()=>{const{currentTheme:e,title:i}=this.props,{currentOHLC:r,mousePosition:a,showOHLC:s,maIndicatorValues:n,emaIndicatorValues:o,bollingerBandsValues:l,ichimokuValues:h,donchianChannelValues:d,envelopeValues:g,vwapValue:c,selectedMainChartIndicators:u}=this.state;return m.jsx(to,{currentTheme:e,title:i,currentOHLC:r,mousePosition:a,showOHLC:s,onToggleOHLC:this.toggleOHLCVisibility,onOpenIndicatorsModal:this.openIndicatorsModal,onOpenIndicatorSettings:this.handleOpenIndicatorSettings,onRemoveIndicator:this.handleRemoveIndicator,onToggleIndicator:this.handleToggleIndicator,visibleIndicatorTypes:this.state.selectedMainChartIndicatorTypes,indicators:u,maIndicatorValues:n,emaIndicatorValues:o,bollingerBandsValues:l,ichimokuValues:h,donchianChannelValues:d,envelopeValues:g,vwapValue:c,i18n:this.props.i18n})},this.handleIndicatorsClose=()=>{this.setState({isMainChartIndicatorsModalOpen:!1})},this.setImageMarkMode=()=>{this.chartMarkManager?.imageMarkManager&&this.setState({isImageUploadModalOpen:!0})},this.handleImageConfirm=e=>{if(this.setSelectedImageUrl(e),this.setState({isImageUploadModalOpen:!1}),this.chartMarkManager?.imageMarkManager){this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e);const i=this.chartMarkManager?.imageMarkManager.startImageMarkMode();this.setState({isImageMarkMode:i.isImageMarkMode,imageMarkStartPoint:i.imageMarkStartPoint,currentImageMark:i.currentImageMark,currentMarkMode:w.Image})}},this.handleImageUploadClose=()=>{this.setState({isImageUploadModalOpen:!1}),this.props.onCloseDrawing&&this.props.onCloseDrawing()},this.setSelectedImageUrl=e=>{this.chartMarkManager?.imageMarkManager&&this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e),this.setState({selectedImageUrl:e})},this.handleChangeTextMarkFontColor=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeTextMarkStyle=e=>{let i=e.isBold,r=e.isItalic;this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({isBold:i,isItalic:r})},this.handleChangeTextMarkFontSize=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({fontSize:e})},this.handleChangeTextMarkGraphColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphColor:e})},this.handleChangeTextMarkGraphLineStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineStyle:e})},this.handleChangeTextMarkGraphLineWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineWidth:e})},this.handleDeleteTextEditMark=()=>{if(!this.state.selectedTextEditMark)return;const e=this.state.selectedTextEditMark,i=e.markType;this.chartMarkManager?.deleteMark(i,e.properties.originalMark),this.setState({selectedTextEditMark:null,markToolBarPosition:{x:20,y:20}})},this.handleTextMarkEditorSave=(e,i,r,a,s)=>{if(this.setState({isTextMarkEditorOpen:!1}),!!this.state.selectedTextEditMark&&(i&&this.handleChangeTextMarkFontColor(i),r&&this.handleChangeTextMarkFontSize(r),a&&this.handleChangeTextMarkStyle({isBold:a}),s&&this.handleChangeTextMarkStyle({isItalic:s}),e))switch(this.state.selectedTextEditMark.markType){case w.TextEdit:this.state.selectedTextEditMark.mark.updateText(e);break;case w.BubbleBox:this.state.selectedTextEditMark.mark.updateText(e);break;case w.Pin:this.state.selectedTextEditMark.mark.updateText(e);break;case w.SignPost:this.state.selectedTextEditMark.mark.updateText(e);break}},this.handleTextMarkEditorCancel=()=>{this.setState({isTextMarkEditorOpen:!1}),this.state.selectedTextEditMark},this.handleDeleteGraphMark=()=>{if(!this.state.selectedGraphMark)return;const e=this.state.selectedGraphMark;e.properties?.originalMark&&this.chartMarkManager?.deleteMark(e.markType,e.properties.originalMark),this.closeGraphMarkToolBar()},this.handleChangeGraphMarkColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeGraphMarkStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineStyle:e})},this.handleChangeGraphMarkWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineWidth:e})},this.handleGraphToolbarDrag=e=>{this.setState({isGraphMarkToolbarDragging:!0,graphMarkToolbarDragStartPoint:e});const i=a=>{if(this.state.isGraphMarkToolbarDragging&&this.state.graphMarkToolbarDragStartPoint){const s=a.clientX-this.state.graphMarkToolbarDragStartPoint.x,n=a.clientY-this.state.graphMarkToolbarDragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+n)},graphMarkToolbarDragStartPoint:{x:a.clientX,y:a.clientY}}))}},r=()=>{this.setState({isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.handleKeyDown=e=>{this.chartEventManager?.handleKeyDown(this,e)},this.handleDocumentMouseUp=e=>{this.chartEventManager?.documentMouseUp(this,e)},this.handleDocumentMouseDown=e=>{this.chartEventManager?.documentMouseDown(this,e)},this.handleDocumentMouseMove=e=>{this.chartEventManager?.documentMouseMove(this,e)},this.handleDocumentMouseWheel=e=>{this.chartEventManager?.documentMouseWheel(this,e)},this.handleTextMarkToolBarDrag=e=>{this.setState({isTextMarkToolbar:!0,dragStartPoint:e});const i=a=>{if(this.state.isTextMarkToolbar&&this.state.dragStartPoint){const s=a.clientX-this.state.dragStartPoint.x,n=a.clientY-this.state.dragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+n)},dragStartPoint:{x:a.clientX,y:a.clientY}}))}},r=()=>{this.setState({isTextMarkToolbar:!1,dragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.getToolName=e=>"",this.toggleOHLCVisibility=()=>{this.setState(e=>({showOHLC:!e.showOHLC}))},this.renderMainChart=()=>m.jsx("canvas",{ref:this.canvasRef,style:{position:"absolute",top:0,left:0,width:"calc(100% - 60px)",height:"calc(100% - 60px)",pointerEvents:"none",zIndex:1}}),this.showSubChartSettingModal=(e=[],i)=>{this.setState({isSubChartIndicatorsSettingModalOpen:!0,subChartIndicatorsSettingModalParams:e,currentSubChartIndicatorType:i})},this.handleSubChartSettingClose=()=>{this.setState({isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null})},this.handleSubChartSettingConfirm=e=>{this.state.currentSubChartIndicatorType&&this.chartPanesManager?.updateSettingsBySubChartIndicatorType(this.props.chartData,e,this.state.currentSubChartIndicatorType),this.handleSubChartSettingClose()},this.state={isDrawing:!1,drawingPoints:[],currentDrawing:null,drawingStartPoint:null,drawings:[],selectedTextEditMark:null,selectedTableMark:null,selectedGraphMark:null,markToolBarPosition:{x:20,y:20},isTextMarkToolbar:!1,dragStartPoint:null,history:[],historyIndex:-1,isDragging:!1,isResizing:!1,isRotating:!1,resizeHandle:null,isTextInputActive:!1,textInputPosition:null,textInputValue:"",textInputCursorVisible:!0,textInputCursorTimer:null,activePanel:null,editingTextId:null,isFirstTimeTextMode:!1,isEmojiInputActive:!1,emojiInputPosition:null,editingEmojiId:null,mousePosition:null,currentOHLC:null,showOHLC:!0,pendingEmojiMark:null,isTextMarkEditorOpen:!1,textMarkEditorPosition:{x:0,y:0},textMarkEditorInitialData:{text:"",color:"#000000",fontSize:14,isBold:!1,isItalic:!1},lineSegmentMarkStartPoint:null,arrowLineMarkStartPoint:null,parallelChannelMarkStartPoint:null,currentLineSegmentMark:null,currentArrowLineMark:null,currentParallelChannelMark:null,currentMarkMode:null,showGraphMarkToolBar:!1,showTableMarkToolBar:!1,showTextMarkToolBar:!1,isShowGrapTool:!1,isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null,linearRegressionChannelStartPoint:null,currentLinearRegressionChannel:null,equidistantChannelMarkStartPoint:null,currentEquidistantChannelMark:null,disjointChannelMarkStartPoint:null,currentDisjointChannelMark:null,andrewPitchforkHandlePoint:null,andrewPitchforkBaseStartPoint:null,currentAndrewPitchfork:null,enhancedAndrewPitchforkHandlePoint:null,enhancedAndrewPitchforkBaseStartPoint:null,currentEnhancedAndrewPitchfork:null,rectangleMarkStartPoint:null,currentRectangleMark:null,circleMarkStartPoint:null,currentCircleMark:null,ellipseMarkStartPoint:null,currentEllipseMark:null,triangleMarkStartPoint:null,currentTriangleMark:null,gannFanStartPoint:null,currentGannFan:null,gannBoxStartPoint:null,currentGannBox:null,gannRectangleStartPoint:null,currentGannRectangle:null,fibonacciTimeZoonStartPoint:null,currentFibonacciTimeZoon:null,fibonacciRetracementStartPoint:null,currentFibonacciRetracement:null,fibonacciArcStartPoint:null,currentFibonacciArc:null,fibonacciCircleCenterPoint:null,currentFibonacciCircle:null,fibonacciSpiralCenterPoint:null,currentFibonacciSpiral:null,fibonacciWedgeCenterPoint:null,currentFibonacciWedge:null,fibonacciWedgeDrawingStep:0,fibonacciWedgePoints:[],fibonacciFanStartPoint:null,currentFibonacciFan:null,currentFibonacciChannel:null,isFibonacciChannelMode:!1,fibonacciChannelDrawingStep:0,fibonacciExtensionBasePricePoints:[],currentFibonacciExtensionBasePrice:null,fibonacciExtensionBaseTimePoints:[],currentFibonacciExtensionBaseTime:null,sectorPoints:[],currentSector:null,curveMarkStartPoint:null,currentCurveMark:null,doubleCurveMarkStartPoint:null,currentDoubleCurveMark:null,xabcdPoints:[],currentXABCDMark:null,headAndShouldersPoints:[],currentHeadAndShouldersMark:null,abcdPoints:[],currentABCDMark:null,triangleABCDPoints:[],currentTriangleABCDMark:null,elliottImpulsePoints:[],currentElliottImpulseMark:null,elliottCorrectivePoints:[],currentElliottCorrectiveMark:null,elliottTrianglePoints:[],currentElliottTriangleMark:null,elliottDoubleCombinationPoints:[],currentElliottDoubleCombinationMark:null,elliottTripleCombinationPoints:[],currentElliottTripleCombinationMark:null,timeRangeMarkStartPoint:null,currentTimeRangeMark:null,isTimeRangeMarkMode:!1,priceRangeMarkStartPoint:null,currentPriceRangeMark:null,isPriceRangeMarkMode:!1,timePriceRangeMarkStartPoint:null,currentTimePriceRangeMark:null,isTimePriceRangeMarkMode:!1,isPencilMode:!1,isPencilDrawing:!1,currentPencilMark:null,pencilPoints:[],isPenMode:!1,isPenDrawing:!1,currentPenMark:null,penPoints:[],isBrushMode:!1,isBrushDrawing:!1,currentBrushMark:null,brushPoints:[],isMarkerPenMode:!1,isMarkerPenDrawing:!1,currentMarkerPen:null,markerPenPoints:[],isEraserMode:!1,isErasing:!1,eraserHoveredMark:null,thickArrowLineMarkStartPoint:null,currentThickArrowLineMark:null,isImageMarkMode:!1,imageMarkStartPoint:null,currentImageMark:null,showImageModal:!1,selectedImageUrl:"",isImageUploadModalOpen:!1,isLongPositionMarkMode:!1,longPositionMarkStartPoint:null,currentLongPositionMark:null,longPositionDrawingPhase:"none",isLongPositionDragging:!1,dragTarget:null,dragPoint:null,adjustingMode:null,adjustStartData:null,isShortPositionMarkMode:!1,shortPositionMarkStartPoint:null,currentShortPositionMark:null,shortPositionDrawingPhase:"none",isShortPositionDragging:!1,shortPositionDragTarget:null,shortPositionDragPoint:null,shortPositionAdjustingMode:null,shortPositionAdjustStartData:null,isPriceLabelMarkMode:!1,priceLabelMarkPoint:null,currentPriceLabelMark:null,isPriceLabelDragging:!1,priceLabelDragTarget:null,isFlagMarkMode:!1,flagMarkPoint:null,currentFlagMark:null,isFlagDragging:!1,flagDragTarget:null,isPriceNoteMarkMode:!1,priceNoteMarkStartPoint:null,currentPriceNoteMark:null,isPriceNoteDragging:!1,priceNoteDragTarget:null,priceNoteDragPoint:null,isSignpostMarkMode:!1,signpostMarkPoint:null,currentSignpostMark:null,isSignpostDragging:!1,signpostDragTarget:null,isEmojiMarkMode:!1,emojiMarkStartPoint:null,currentEmojiMark:null,isEmojiDragging:!1,emojiDragTarget:null,emojiDragPoint:null,isPinMarkMode:!1,pinMarkPoint:null,currentPinMark:null,isPinDragging:!1,pinDragTarget:null,isBubbleBoxMarkMode:!1,bubbleBoxMarkPoints:null,currentBubbleBoxMark:null,isBubbleBoxDragging:!1,bubbleBoxDragTarget:null,bubbleBoxDragType:null,isTextEditMarkMode:!1,isTextEditDragging:!1,textEditDragTarget:null,isMainChartIndicatorsModalOpen:!1,selectedMainChartIndicators:[],selectedMainChartIndicatorTypes:[],modalEditingChartInfoIndicator:null,modalConfirmChartInfoIndicators:Yt(),maIndicatorValues:{},emaIndicatorValues:{},bollingerBandsValues:{},ichimokuValues:{},donchianChannelValues:{},envelopeValues:{},vwapValue:null,isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null,isMockKLineMarkMode:!1,mockKLineMarkStartPoint:null,currentMockKLineMark:null,isMockKLineDragging:!1,mockKLineDragTarget:null,mockKLineDragPoint:null,isHeatMapMode:!1,heatMapStartPoint:null,currentHeatMap:null,isHeatMapDragging:!1,heatMapDragTarget:null,heatMapDragPoint:null,heatMapDrawingPhase:"none",heatMapAdjustingMode:null,isSchiffPitchforkMode:!1,schiffPitchforkHandlePoint:null,schiffPitchforkBaseStartPoint:null,currentSchiffPitchfork:null,isSchiffPitchforkDragging:!1,schiffPitchforkDragTarget:null,schiffPitchforkDragPoint:null,schiffPitchforkDrawingPhase:"none",schiffPitchforkAdjustingMode:null,cursorType:St.Crosshair,ai:this.props.ai||!1,aiconfigs:this.props.aiconfigs||[],currentAIFunctionType:this.props.currentAIFunctionType||null,isTimeEventMode:!1,isTimeEventDragging:!1,timeEventDragTarget:null,currentTimeEventMark:null,isPriceEventMode:!1,isPriceEventDragging:!1,priceEventDragTarget:null,currentPriceEventMark:null,isIncrement:!1},this.chartEventManager=new Ni,this.chartMarkManager=new ea,this.chartMarkTextEditManager=new ia,this.mainChartTechnicalIndicatorManager=new Zn(this.props.currentTheme),this.initializeGraphManager(),this.staticMarkManager=new so,this.chartPanesManager=new Ao,this.mainChartManager=new No(this,this.props.currentTheme)}componentDidMount(){this.setupCanvas(),this.setupAllDocumentEvents(),this.setupAllContainerEvents(),this.initializeMainChartIndicators(),this.chartMarkTextEditManager?.setupBubbleBoxMarkEvents(this),this.chartMarkTextEditManager?.setupSignPostMarkEvents(this),this.chartMarkTextEditManager?.setupPinMarkEvents(this),this.chartMarkTextEditManager?.setupTextEditMarkEvents(this),this.initStaticMark(),this.props.chart?this.chartEventManager?.registerCrosshairMoveEvent(this):setTimeout(()=>{this.props.chart&&this.chartEventManager?.registerCrosshairMoveEvent(this)},100),setTimeout(()=>{this.mainChartManager?.switchChartType(G.Candle),this.volume=new Fi(this),this.props.chart&&this.chartPanesManager?.setChartInstance(this.props.chart)},50)}componentDidUpdate(t){(t.chartSeries!==this.props.chartSeries||t.chart!==this.props.chart)&&this.initializeGraphManagerProps(),t.isIncrement!==this.props.isIncrement&&this.setState({isIncrement:this.props.isIncrement}),t.i18n!==this.props.i18n&&(this.volumeHeatMap?.updateI18n(this.props.i18n),this.marketProfile?.updateI18n(this.props.i18n)),t.currentTheme!==this.props.currentTheme&&(this.volumeHeatMap?.updateTheme(this.props.currentTheme),this.marketProfile?.updateTheme(this.props.currentTheme)),t.ai!==this.props.ai&&this.props.ai&&this.setState({ai:this.props.ai}),t.aiconfigs!==this.props.aiconfigs&&this.props.aiconfigs&&this.setState({aiconfigs:this.props.aiconfigs}),t.currentAIFunctionType!==this.props.currentAIFunctionType&&this.props.currentAIFunctionType&&this.setState({currentAIFunctionType:this.props.currentAIFunctionType}),(t.timeframe!==this.props.timeframe||t.timezone!==this.props.timezone)&&this.volume&&(this.volume.destroy(this),this.volume=new Fi(this),this.volume.refreshData(this)),this.hasChartDataChanged(t.chartData,this.props.chartData)?(setTimeout(()=>{this.updateStaticMark()},0),this.handleUpdateMainChartMaps(),this.updateAllMainChartIndicatorData(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData(),this.volumeHeatMap?.refreshData(this),this.executeEventMarksScriptForChartData()):this.hasMainChartIndicatorChanged(t.selectedMainChartIndicator,this.props.selectedMainChartIndicator)&&(this.handleInitMainChartMaps(),this.updateSelectedMainChartIndicators(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData(),this.executeEventMarksScriptForChartData()),t.currentMainChartType!==this.props.currentMainChartType&&this.swtichMainChartType(),t.markData!==this.props.markData&&(this.staticMarkManager?.clearAllMarks(),this.updateStaticMark()),t.currentTheme!==this.props.currentTheme&&this.chartPanesManager?.updateAllPaneTheme(this.props.currentTheme),t.selectedSubChartIndicators!==this.props.selectedSubChartIndicators&&(this.chartPanesManager?.removeAllPane(),setTimeout(()=>{this.props.selectedSubChartIndicators.forEach(e=>{this.chartPanesManager?.addSubChart(this,e,i=>{this.showSubChartSettingModal(this.chartPanesManager?.getParamsByIndicatorType(i),i)},i=>{this.chartPanesManager?.removePaneBySubChartIndicatorType(i),this.props.handleRemoveSubChartIndicator&&this.props.handleRemoveSubChartIndicator(i)})})},0))}componentWillUnmount(){this.cleanupAllDocumentEvents(),document.removeEventListener("keydown",this.handleKeyDown),this.doubleClickTimeout&&clearTimeout(this.doubleClickTimeout),this.cleanupAllContainerEvents(),this.destroyGraphManager(),this.chartMarkTextEditManager?.cleanupBubbleBoxMarkEvents(),this.chartMarkTextEditManager?.cleanupSignPostMarkEvents(),this.chartMarkTextEditManager?.cleanupPinMarkEvents(),this.chartMarkTextEditManager?.cleanupTextEditMarkEvents(),this.volumeHeatMap?.destroy(),this.marketProfile?.destroy(),this.mainChartManager?.destroy(),this.volume?.destroy(this)}handleInitMainChartMaps(){this.props.selectedMainChartIndicator&&(this.props.selectedMainChartIndicator.type===D.HEATMAP&&(this.volumeHeatMap||(this.volumeHeatMap=new Xo(this,this.props.i18n,this.props.currentTheme,()=>{this.volumeHeatMap=null}),this.volumeHeatMap?.refreshData(this))),this.props.selectedMainChartIndicator.type===D.MARKETPROFILE&&(this.marketProfile||(this.marketProfile=new Yo(this,this.props.i18n,this.props.currentTheme,()=>{this.marketProfile=null}),this.marketProfile?.refreshData(this))))}handleUpdateMainChartMaps(){this.props.selectedMainChartIndicator&&(this.volumeHeatMap&&this.volumeHeatMap?.refreshData(this),this.marketProfile&&this.marketProfile?.refreshData(this))}hasChartDataChanged(t,e){if(t===e)return!1;if(!t||!e||t.length!==e.length)return!0;const i=Math.min(t.length,e.length,5);for(let r=0;r<i;r++)if(t[r].time!==e[r].time)return!0;return!1}hasMainChartIndicatorChanged(t,e){return t===e?!1:!t||!e?!0:t.type!==e.type||t.nonce!==e.nonce||JSON.stringify(t.params)!==JSON.stringify(e.params)}initStaticMark(){setTimeout(()=>{this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})},200)}updateStaticMark(){this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})}setupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseup",this.handleMouseUp)}cleanupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseup",this.handleMouseUp)}setupAllDocumentEvents(){document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("mousemove",this.handleDocumentMouseMove),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("mouseup",this.handleDocumentMouseUp),document.addEventListener("wheel",this.handleDocumentMouseWheel)}cleanupAllDocumentEvents(){document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("mousemove",this.handleDocumentMouseMove),document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("mouseup",this.handleDocumentMouseUp),document.removeEventListener("wheel",this.handleDocumentMouseWheel)}serializeDrawings(){return JSON.stringify(this.allDrawings)}setupCanvas(){const t=this.canvasRef.current,e=this.containerRef.current;if(!t||!e)return;const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height}getDrawingLayerElementsPosition(){const t=[];return this.containerRef.current&&(this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(r=>{const a=r.getAttribute("data-text-id");if(a){const s=r,n=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:a,type:"text",position:{x:n.left-o.left,y:n.top-o.top},element:s})}}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(r=>{const a=r.getAttribute("data-emoji-id");if(a){const s=r,n=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:a,type:"emoji",position:{x:n.left-o.left,y:n.top-o.top},element:s})}})),t}setDrawingLayerElementsPosition(t){this.containerRef.current&&t.forEach(e=>{let i=null;if(e.type==="text"?i=this.containerRef.current.querySelector(`[data-text-id="${e.id}"]`):e.type==="emoji"&&(i=this.containerRef.current.querySelector(`[data-emoji-id="${e.id}"]`)),i){i.style.position="absolute",i.style.left=`${e.position.x}px`,i.style.top=`${e.position.y}px`;const r=this.allDrawings.findIndex(a=>a.id===e.id);r!==-1&&this.allDrawings[r].points.length>0&&(this.allDrawings[r].points[0]={...e.position})}})}moveDrawingLayerElements(t,e){if(!this.containerRef.current)return;this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(a=>{const s=a,n=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${n+t}px`,s.style.top=`${o+e}px`}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(a=>{const s=a,n=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${n+t}px`,s.style.top=`${o+e}px`}),this.allDrawings.forEach(a=>{(a.type==="text"||a.type==="emoji")&&a.points.length>0&&(a.points[0].x+=t,a.points[0].y+=e)})}getDrawingLayerElementsByType(t){const e=[];if(!this.containerRef.current)return e;const i=t==="text"?".drawing-text-element":".drawing-emoji-element",r=t==="text"?"data-text-id":"data-emoji-id";return this.containerRef.current.querySelectorAll(i).forEach(s=>{const n=s,o=n.getAttribute(r);if(o){const l=n.getBoundingClientRect(),h=this.containerRef.current.getBoundingClientRect();e.push({id:o,position:{x:l.left-h.left,y:l.top-h.top},element:n})}}),e}disableChartMovement(){this.props.chart&&(this.originalChartOptions=this.props.chart.options(),this.props.chart.applyOptions({handleScroll:!1,handleScale:!1}))}enableChartMovement(){this.props.chart.applyOptions({handleScroll:!0,handleScale:!0})}render(){const{activeTool:t,currentTheme:e,showInfoLayer:i=!0}=this.props,{isTextMarkToolbar:r,showGraphMarkToolBar:a,showTableMarkToolBar:s,markToolBarPosition:n,showTextMarkToolBar:o,selectedTextEditMark:l,selectedTableMark:h,selectedGraphMark:d,isMainChartIndicatorsModalOpen:g,isSubChartIndicatorsSettingModalOpen:c,subChartIndicatorsSettingModalParams:u,currentSubChartIndicatorType:p}=this.state;return m.jsx("div",{style:{width:"100%"},children:m.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:t?"auto":"none",opacity:1,display:"block"},children:[i&&m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderChartInfo()}),m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderMainChart()}),m.jsxs("div",{ref:this.containerRef,style:{position:"absolute",width:"100%",height:"100%",minHeight:"300px"},children:[this.state.isTextMarkEditorOpen&&m.jsx(Rr,{isOpen:this.state.isTextMarkEditorOpen,position:this.state.textMarkEditorPosition,theme:this.props.currentTheme,initialText:this.state.textMarkEditorInitialData.text,initialColor:this.state.textMarkEditorInitialData.color,initialFontSize:this.state.textMarkEditorInitialData.fontSize,initialIsBold:this.state.textMarkEditorInitialData.isBold,initialIsItalic:this.state.textMarkEditorInitialData.isItalic,onSave:this.handleTextMarkEditorSave,onCancel:this.handleTextMarkEditorCancel,i18n:this.props.i18n}),c&&m.jsx(Do,{isOpen:c,onClose:this.handleSubChartSettingClose,onConfirm:this.handleSubChartSettingConfirm,initialParams:u,theme:e,parentRef:this.containerRef,indicatorType:p,i18n:this.props.i18n}),this.state.isImageUploadModalOpen&&m.jsx(Br,{isOpen:this.state.isImageUploadModalOpen,onClose:this.handleImageUploadClose,onConfirm:this.handleImageConfirm,theme:e,i18n:this.props.i18n}),g&&m.jsx(eo,{isOpen:g,onClose:this.handleIndicatorsClose,onConfirm:this.handleMainChartIndicatorsSettingConfirm,initialIndicator:this.state.modalEditingChartInfoIndicator,theme:e,parentRef:this.containerRef,indicatorType:this.state.modalEditingChartInfoIndicator?.type||null,i18n:this.props.i18n}),o&&m.jsx($n,{position:n,selectedDrawing:l,theme:e,onClose:this.closeTextMarkToolBar,onDelete:this.handleDeleteTextEditMark,onChangeTextColor:this.handleChangeTextMarkFontColor,onChangeTextStyle:this.handleChangeTextMarkStyle,onChangeTextSize:this.handleChangeTextMarkFontSize,onDragStart:this.handleTextMarkToolBarDrag,isDragging:r,getToolName:this.getToolName,isShowGrapTool:this.state.isShowGrapTool,onChangeGraphColor:this.handleChangeTextMarkGraphColor,onChangeGraphStyle:this.handleChangeTextMarkGraphLineStyle,onChangeGraphLineWidth:this.handleChangeTextMarkGraphLineWidth,i18n:this.props.i18n}),a&&m.jsx(Jn,{position:n,selectedDrawing:d,theme:e,onClose:this.closeGraphMarkToolBar,onDelete:this.handleDeleteGraphMark,onChangeColor:this.handleChangeGraphMarkColor,onChangeStyle:this.handleChangeGraphMarkStyle,onChangeWidth:this.handleChangeGraphMarkWidth,onDragStart:this.handleGraphToolbarDrag,isDragging:!1,getToolName:this.getToolName,i18n:this.props.i18n})]})]})})}}class qo{constructor(t,e,i,r,a="en"){this.series=null,this.locale=a,this.chart=rt.createChart(t,{width:e,height:i,layout:r.layout,grid:{vertLines:{color:r.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:r.grid.horzLines.color+"30",style:1,visible:!0}},crosshair:{mode:0},timeScale:{timeVisible:!0,secondsVisible:!1,borderColor:r.grid.vertLines.color},rightPriceScale:{borderColor:r.grid.horzLines.color,scaleMargins:{top:.1,bottom:.1},entireTextOnly:!1},handleScale:{axisPressedMouseMove:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0},localization:{locale:this.locale}})}getChart(){return this.chart}getSeries(){return this.series}getLocale(){return this.locale}}const ot={Indicators:"Indicators",mainChartIndicators:"Main Chart Indicators",subChartIndicators:"Sub Chart Indicators",chartMaps:"Maps",close:"Close",searchIndicators:"Search indicators...",searchChartTypes:"Search chart types...",theme:"Theme",light:"Light",dark:"Dark",timeframe:"Time Frame",chartType:"Chart Type",toolBar:{color:"Color",lineSize:"Line Size",lineStyle:"Line Style",delete:"Delete",close:"Close",fontSize:"Font Size",bold:"Bold",italic:"Italic",selectColor:"Select Color",colorPicker:"Color Picker",solid:"Solid",dashed:"Dashed",dotted:"Dotted",currentColor:"Current Color"},timeframeSections:{second:"Second",minute:"Minute",hour:"Hour",day:"Day",week:"Week",month:"Month"},chartTypes:{candle:"Candlestick",line:"Line",area:"Area",baseline:"Baseline",hollowCandle:"Hollow Candle",heikinAshi:"Heikin Ashi",column:"Column",lineWithMarkers:"Line with Markers",stepLine:"Step Line",bar:"Bar",histogram:"Histogram",pointandfigure:"PointAndFigure",kagi:"Kagi",linebreak:"LineBreak",mountain:"Mountain",baselinearea:"BaseLineArea",highlow:"HighLow",equivolume:"EquiVolume",threelinebreak:"ThreeLineBreak",hlcarea:"HLCArea"},toolbarButtons:{hint:"Hint",replay:"Replay",fullScreen:"Full Screen",screenshot:"Screenshot",contrast:"Contrast"},indicators:{ma:"Moving Average",ema:"Exponential Moving Average",bollinger:"Bollinger Bands",ichimoku:"Ichimoku Cloud",donchian:"Donchian Channel",envelope:"Envelope",vwap:"VWAP",rsi:"RSI",macd:"MACD",volume:"Volume",sar:"Parabolic SAR",kdj:"KDJ",atr:"ATR",stochastic:"Stochastic",cci:"CCI",bbwidth:"BB Width",adx:"ADX",obv:"OBV"},mainIndicators:{ma:"Moving Average (MA)",ema:"Exponential Moving Average (EMA)",bollinger:"Bollinger Bands",ichimoku:"Ichimoku Cloud",donchian:"Donchian Channel",envelope:"Envelope",vwap:"Volume Weighted Average Price (VWAP)"},mainChartMaps:{heatmap:"Heat Map",marketProfile:"Market Profile"},subChartIndicatorName:{rsi:"Relative Strength Index (RSI)",macd:"MACD",volume:"Volume",sar:"Parabolic SAR (SAR)",kdj:"KDJ",atr:"Average True Range (ATR)",stochastic:"Stochastic Oscillator",cci:"Commodity Channel Index (CCI)",bbwidth:"Bollinger Bands Width",adx:"Average Directional Index (ADX)",obv:"On Balance Volume (OBV)"},modal:{parameterSettings:"Parameter Settings",parameterName:"Parameter Name",parameterValue:"Value",lineWidth:"Line Width",lineColor:"Color",addParameter:"Add Parameter",deleteParameter:"Delete",keepAtLeastOne:"Keep at least one parameter",maximumParameters:"Maximum 5 parameters allowed",dragToMove:"Drag header to move"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: Confirm",escToCancel:"Esc: Cancel",clickToSelectColor:"Click to select color"},emoji:{categories:{smileys:"Smileys & Emotion",people:"People & Body",animals:"Animals & Nature",food:"Food & Drink",activities:"Activities",travel:"Travel & Places",objects:"Objects",symbols:"Symbols",flags:"Flags"},searchPlaceholder:"Search emojis...",selectedEmoji:"Selected",clickToPlace:"Click chart to place emoji"},leftPanel:{scriptTools:"Script Tools",timeEvent:"Time Event",timeEventDesc:"Time-based script event",priceEvent:"Price Event",priceEventDesc:"Price-based script event",cursorCrosshair:"Crosshair",cursorCrosshairDesc:"Crosshair cursor with space",cursorCircle:"Cursor",cursorCircleDesc:"Cursor",cursorDot:"Dot Cursor",cursorDotDesc:"Round dot cursor style",cursorArrow:"Arrow Cursor",cursorArrowDesc:"Arrow pointer style",cursorSparkle:"Sparkle",cursorSparkleDesc:"Sparkle effect cursor",cursorEmoji:"Emoji Cursor",cursorEmojiDesc:"Emoji symbol cursor",pencil:"Pencil",pencilDesc:"Thin line drawing tool",pen:"Pen",penDesc:"Smooth line drawing",brush:"Brush",brushDesc:"Soft brush effect",markerPen:"Marker",markerPenDesc:"Bold marker pen",eraser:"Eraser",eraserDesc:"Erase drawing content",heatMap:"Heat Map",lineTools:"Lines",arrowTools:"Arrows",channelTools:"Channels",pitchforkTools:"Pitchforks",penTools:"Pens",gannTools:"Gann Tools",fibonacciTools:"Fibonacci Tools",technicalPatterns:"Technical Patterns",elliottWave:"Elliott Wave",regularShapes:"Regular Shapes",rangeTools:"Ranges",positionTools:"Positions",simulationTools:"Simulation",textTools:"Text",contentTools:"Content",lineSegment:"Line Segment",lineSegmentDesc:"Draw line segment",horizontalLine:"Horizontal Line",horizontalLineDesc:"Draw horizontal line marker",verticalLine:"Vertical Line",verticalLineDesc:"Draw vertical line marker",arrowLine:"Arrow Line",arrowLineDesc:"Draw arrow line marker",thickArrowLine:"Thick Arrow Line",thickArrowLineDesc:"Draw thick arrow line marker",parallelChannel:"Parallel Channel",parallelChannelDesc:"Draw parallel channel",linearRegressionChannel:"Linear Regression Channel",linearRegressionChannelDesc:"Draw regression channel",equidistantChannel:"Equidistant Channel",equidistantChannelDesc:"Draw equidistant channel",disjointChannel:"Disjoint Channel",disjointChannelDesc:"Draw disjoint channel",andrewPitchfork:"Andrew's Pitchfork",andrewPitchforkDesc:"Draw Andrew's pitchfork",enhancedAndrewPitchfork:"Enhanced Andrew Pitchfork",enhancedAndrewPitchforkDesc:"Draw enhanced pitchfork",schiffPitchfork:"Schiff Pitchfork",schiffPitchforkDesc:"Draw Schiff pitchfork",internalPitchfork:"Internal Pitchfork Lines",internalPitchforkDesc:"Draw internal pitchfork lines",wavePitchfork:"Wave Pitchfork",wavePitchforkDesc:"Draw wave pitchfork",gannFan:"Gann Fan",gannFanDesc:"Gann fan analysis tool",gannBox:"Gann Box",gannBoxDesc:"Gann box analysis tool",gannRectangle:"Gann Rectangle",gannRectangleDesc:"Gann Rectangle analysis",fibonacciTimeZones:"Fibonacci Time Zones",fibonacciTimeZonesDesc:"Fibonacci time zones analysis",fibonacciRetracement:"Fibonacci Retracement",fibonacciRetracementDesc:"Draw Fibonacci retracement lines",fibonacciArc:"Fibonacci Arc",fibonacciArcDesc:"Draw Fibonacci arcs",fibonacciCircle:"Fibonacci Circle",fibonacciCircleDesc:"Fibonacci circle analysis",fibonacciSpiral:"Fibonacci Spiral",fibonacciSpiralDesc:"Fibonacci spiral analysis",fibonacciWedge:"Fibonacci Wedge",fibonacciWedgeDesc:"Fibonacci wedge analysis",fibonacciFan:"Fibonacci Fan",fibonacciFanDesc:"Fibonacci fan analysis",fibonacciChannel:"Fibonacci Channel",fibonacciChannelDesc:"Fibonacci channel analysis",fibonacciExtensionPrice:"Fibonacci Extension (Price)",fibonacciExtensionPriceDesc:"Draw Fibonacci extension lines",fibonacciExtensionTime:"Fibonacci Extension (Time)",fibonacciExtensionTimeDesc:"Draw Fibonacci extension lines",xabcdPattern:"XABCD Pattern",xabcdPatternDesc:"Draw XABCD pattern",headAndShoulders:"Head and Shoulders",headAndShouldersDesc:"Draw head and shoulders pattern",abcdPattern:"ABCD Pattern",abcdPatternDesc:"Draw ABCD pattern",triangleAbcd:"ABCD Triangle",triangleAbcdDesc:"Draw ABCD triangle pattern",elliottImpulse:"Elliott Impulse Wave",elliottImpulseDesc:"Draw Elliott impulse wave",elliottCorrective:"Elliott Corrective Wave",elliottCorrectiveDesc:"Draw Elliott corrective wave",elliottTriangle:"Elliott Triangle Wave",elliottTriangleDesc:"Draw Elliott triangle wave",elliottDoubleCombo:"Elliott Double Combo",elliottDoubleComboDesc:"Draw Elliott double combo wave",elliottTripleCombo:"Elliott Triple Combo",elliottTripleComboDesc:"Draw Elliott triple combo wave",rectangle:"Rectangle",rectangleDesc:"Draw rectangular area",circle:"Circle",circleDesc:"Draw circular area",ellipse:"Ellipse",ellipseDesc:"Draw elliptical area",triangle:"Triangle",triangleDesc:"Draw triangle",sector:"Sector",sectorDesc:"Draw sector",curve:"Curve",curveDesc:"Draw curve",doubleCurve:"Double Curve",doubleCurveDesc:"Draw double curve",timeRange:"Time Range",timeRangeDesc:"Draw time range",priceRange:"Price Range",priceRangeDesc:"Draw price range",timePriceRange:"Time-Price Range",timePriceRangeDesc:"Draw time-price range",longPosition:"Long Position",longPositionDesc:"Long position marker",shortPosition:"Short Position",shortPositionDesc:"Short position marker",mockKline:"Mock K-line",mockKlineDesc:"Simulate K-line data",text:"Text",textDesc:"Text annotation",priceNote:"Price Note",priceNoteDesc:"Price annotation",bubbleBox:"Bubble Box",bubbleBoxDesc:"Bubble annotation box",pin:"Pin",pinDesc:"Pin marker",signpost:"Signpost",signpostDesc:"Signpost marker",priceLabel:"Price Label",priceLabelDesc:"Price label marker",flagMark:"Flag Mark",flagMarkDesc:"Flag marker",image:"Image",imageDesc:"Image annotation",video:"Video",videoDesc:"Video annotation",audio:"Audio",audioDesc:"Audio annotation",idea:"Idea",ideaDesc:"Idea annotation",mouseCursor:"Mouse Cursor",drawingTools:"Drawing Tools",fibonacciToolsTitle:"Fibonacci Tools",projectInfoTools:"Project Info Tools",shapeTools:"Shape Tools",brushTitle:"Brush",textMark:"Text Mark",emojiMark:"Emoji Mark",deleteTool:"Delete Tool",setting:"Setting",selectedTool:"Selected",clickToStartDrawing:"Click chart to start drawing",selectEmoji:"Select Emoji",selectedEmoji:"Selected",clickToPlaceEmoji:"Click chart to place emoji",aiTools:"AI Tools",aiModelSelection:"AI Models",aiFunctions:"AI Functions",openai:"OpenAI",openaiDesc:"GPT-4, GPT-3.5",gemini:"Gemini",geminiDesc:"Google AI",claude:"Claude",claudeDesc:"Anthropic AI",deepseek:"DeepSeek",deepseekDesc:"Chinese AI Model",describeChart:"Describe Chart",describeChartDesc:"Describe chart patterns in natural language",predictTrend:"Predict Trend",predictTrendDesc:"Predict future trends based on historical data"},systemSettings:{title:"System Settings",general:"General",appearance:"Appearance",chart:"Chart",performance:"Performance",shortcuts:"Shortcuts",saveSettings:"Save Settings",cancel:"Cancel",confirm:"Confirm",language:"Language",timezone:"Timezone",autoSave:"Auto Save",themeMode:"Theme Mode",fontSize:"Font Size",animations:"Animations",defaultTimeframe:"Default Timeframe",pricePrecision:"Price Precision",showGrid:"Show Grid",hardwareAcceleration:"Hardware Acceleration",dataPointLimit:"Data Point Limit",realtimeUpdates:"Real-time Updates",shortcutsTitle:"Keyboard Shortcuts",zoomIn:"Zoom In",zoomOut:"Zoom Out",resetZoom:"Reset Zoom",saveChart:"Save Chart",undo:"Undo",redo:"Redo",setting:"Setting"},settingsDescriptions:{language:"Select interface display language",timezone:"Set timezone for displayed times",autoSave:"Automatically save chart settings and drawings",themeMode:"Choose light or dark theme",fontSize:"Set interface font size",animations:"Enable interface animation effects",defaultTimeframe:"Set default chart display timeframe",pricePrecision:"Set number of decimal places for price display",showGrid:"Display grid lines in chart",hardwareAcceleration:"Enable GPU accelerated rendering (recommended)",dataPointLimit:"Set maximum number of data points to display in chart",realtimeUpdates:"Enable real-time data stream updates"},options:{light:"Light Mode",dark:"Dark Mode",auto:"Follow System",small:"Small",medium:"Medium",large:"Large",zhCN:"Simplified Chinese",enUS:"English",jaJP:"Japanese",beijing:"Beijing Time (UTC+8)",newYork:"New York Time (UTC-5)",london:"London Time (UTC+0)",chicago:"Chicago Time (UTC-6)",denver:"Denver Time (UTC-7)",losAngeles:"Los Angeles Time (UTC-8)",toronto:"Toronto Time (UTC-5)",paris:"Paris Time (UTC+1)",frankfurt:"Frankfurt Time (UTC+1)",zurich:"Zurich Time (UTC+1)",moscow:"Moscow Time (UTC+3)",dubai:"Dubai Time (UTC+4)",karachi:"Karachi Time (UTC+5)",kolkata:"Kolkata Time (UTC+5:30)",shanghai:"Shanghai Time (UTC+8)",hongKong:"Hong Kong Time (UTC+8)",singapore:"Singapore Time (UTC+8)",tokyo:"Tokyo Time (UTC+9)",seoul:"Seoul Time (UTC+9)",sydney:"Sydney Time (UTC+10)",auckland:"Auckland Time (UTC+12)",utc:"UTC Time"},timeframes:{"1s":"1 Second","5s":"5 Seconds","15s":"15 Seconds","30s":"30 Seconds","1m":"1 Minute","3m":"3 Minutes","5m":"5 Minutes","15m":"15 Minutes","30m":"30 Minutes","45m":"45 Minutes","1H":"1 Hour","2H":"2 Hours","3H":"3 Hours","4H":"4 Hours","6H":"6 Hours","8H":"8 Hours","12H":"12 Hours","1D":"1 Day","3D":"3 Days","1W":"1 Week","2W":"2 Weeks","1M":"1 Month","3M":"3 Months","6M":"6 Months"},timezone:"Timezone",timeFormat:"Time Format",closeTime:"Close Time",tradingDay:"Trading Day",searchTimezones:"Search timezones...",timeFormatOptions:{twentyFourHour:"24-Hour Format",twelveHour:"12-Hour Format"},closeTimeOptions:{custom:"Custom Time"},tradingDayOptions:{tradingSession:"Trading Session",calendarDay:"Calendar Day",exchangeHours:"Exchange Hours"},terminal:{isEn:"en",placeholderText:"Enter command..."},ai:{aliyun:"Aliyun"}},zo={Indicators:"技术指标",mainChartIndicators:"主图指标",subChartIndicators:"副图指标",chartMaps:"图",close:"关闭",searchIndicators:"搜索指标...",searchChartTypes:"搜索图表类型...",theme:"主题",light:"浅色",dark:"深色",timeframe:"时间框架",chartType:"图表类型",toolBar:{color:"颜色",lineSize:"线条尺寸",lineStyle:"线条样式",delete:"删除",close:"关闭",fontSize:"字体大小",bold:"粗体",italic:"斜体",selectColor:"选择颜色",colorPicker:"拾色器",solid:"实线",dashed:"虚线",dotted:"点状线",currentColor:"当前颜色"},timeframeSections:{second:"秒",minute:"分钟",hour:"小时",day:"天",week:"周",month:"月"},chartTypes:{candle:"蜡烛图",line:"线图",area:"面积图",baseline:"基线图",hollowCandle:"空心蜡烛图",heikinAshi:"平均K线图",column:"柱状图",lineWithMarkers:"带标记线图",stepLine:"阶梯线图",bar:"美国线",histogram:"直方图",pointandfigure:"点线图",kagi:"卡吉图",linebreak:"新价线",mountain:"山脉图",baselinearea:"基准面积图",highlow:"高低图",equivolume:"等量图",threelinebreak:"三线反转图",hlcarea:"HLC区域"},toolbarButtons:{hint:"提示",replay:"回放",fullScreen:"全屏",screenshot:"截图",contrast:"对比"},indicators:{ma:"移动平均线",ema:"指数移动平均线",bollinger:"布林带",ichimoku:"一目均衡表",donchian:"唐奇安通道",envelope:"包络线",vwap:"成交量加权平均价",rsi:"RSI",macd:"MACD",volume:"成交量",sar:"抛物线转向",kdj:"KDJ",atr:"ATR",stochastic:"随机指标",cci:"CCI",bbwidth:"布林带宽度",adx:"ADX",obv:"能量潮"},mainIndicators:{ma:"移动平均线 (MA)",ema:"指数移动平均线 (EMA)",bollinger:"布林带",ichimoku:"一目均衡表",donchian:"唐奇安通道",envelope:"包络线",vwap:"成交量加权平均价 (VWAP)"},mainChartMaps:{heatmap:"热力图",marketProfile:"市场轮廓图"},subChartIndicatorName:{rsi:"相对强弱指数 (RSI)",macd:"MACD",volume:"成交量",sar:"抛物线转向指标 (SAR)",kdj:"KDJ",atr:"平均真实波幅 (ATR)",stochastic:"随机指标",cci:"顺势指标 (CCI)",bbwidth:"布林带宽度",adx:"平均趋向指数 (ADX)",obv:"能量潮 (OBV)"},modal:{parameterSettings:"参数设置",parameterName:"参数名称",parameterValue:"数值",lineWidth:"线宽",lineColor:"颜色",addParameter:"添加参数",deleteParameter:"删除",keepAtLeastOne:"至少保留一个参数",maximumParameters:"最多允许5个参数",dragToMove:"拖动标题栏移动"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: 确认",escToCancel:"Esc: 取消",clickToSelectColor:"点击选择颜色"},emoji:{categories:{smileys:"表情与情感",people:"人物与身体",animals:"动物与自然",food:"食物与饮品",activities:"活动",travel:"旅行与地点",objects:"物品",symbols:"符号",flags:"旗帜"},searchPlaceholder:"搜索表情...",selectedEmoji:"已选择",clickToPlace:"点击图表放置表情"},leftPanel:{scriptTools:"脚本工具",timeEvent:"时间事件",timeEventDesc:"基于时间的脚本事件",priceEvent:"价格事件",priceEventDesc:"基于价格的脚本事件",cursorCrosshair:"十字准星",cursorCrosshairDesc:"带空格的十字准星",cursorCircle:"圆形光标",cursorCircleDesc:"圆形光标",cursorDot:"点状光标",cursorDotDesc:"圆点光标样式",cursorArrow:"箭头光标",cursorArrowDesc:"箭头指示样式",cursorSparkle:"烟花棒",cursorSparkleDesc:"烟花效果光标",cursorEmoji:"表情光标",cursorEmojiDesc:"表情符号光标",pencil:"铅笔",pencilDesc:"细线绘制工具",pen:"钢笔",penDesc:"流畅线条绘制",brush:"刷子",brushDesc:"柔和笔刷效果",markerPen:"马克笔",markerPenDesc:"粗体标记笔",eraser:"橡皮擦",eraserDesc:"擦除绘制内容",lineTools:"线",arrowTools:"箭头",channelTools:"通道",pitchforkTools:"叉",penTools:"画笔",gannTools:"江恩分析工具",fibonacciTools:"斐波那契工具",technicalPatterns:"技术图形",elliottWave:"艾略特波浪",regularShapes:"规则图形",rangeTools:"区间",positionTools:"标尺",simulationTools:"模拟",heatMap:"热力图",textTools:"文本",contentTools:"内容",lineSegment:"线段",lineSegmentDesc:"绘制线段",horizontalLine:"水平线",horizontalLineDesc:"绘制水平线标记",verticalLine:"垂直线",verticalLineDesc:"绘制垂直线标记",arrowLine:"箭头线",arrowLineDesc:"绘制箭头线标记",thickArrowLine:"粗箭头线",thickArrowLineDesc:"绘制箭头线标记",parallelChannel:"并行通道",parallelChannelDesc:"绘制并行通道",linearRegressionChannel:"线性回归通道",linearRegressionChannelDesc:"绘制回归通道",equidistantChannel:"等距通道",equidistantChannelDesc:"绘制等距通道",disjointChannel:"不相交通道",disjointChannelDesc:"绘制不相交通道",andrewPitchfork:"安德鲁干草叉",andrewPitchforkDesc:"绘制安德鲁干草叉",enhancedAndrewPitchfork:"改良安德鲁干草叉",enhancedAndrewPitchforkDesc:"绘制叉子",schiffPitchfork:"希夫干草叉",schiffPitchforkDesc:"绘制希夫干草叉",internalPitchfork:"内部干草叉线",internalPitchforkDesc:"绘制内部干草叉线",wavePitchfork:"波浪干草叉",wavePitchforkDesc:"绘制波浪干草叉",gannFan:"江恩扇",gannFanDesc:"江恩扇形线分析工具",gannBox:"江恩箱",gannBoxDesc:"江恩箱体分析工具",gannRectangle:"江恩正方体",gannRectangleDesc:"江恩正方体分析",fibonacciTimeZones:"斐波那契时间周期",fibonacciTimeZonesDesc:"斐波那契时间周期线分析",fibonacciRetracement:"斐波那契回调",fibonacciRetracementDesc:"绘制斐波那契回调线",fibonacciArc:"斐波那契弧线",fibonacciArcDesc:"绘制斐波那契弧线",fibonacciCircle:"斐波那契圆",fibonacciCircleDesc:"斐波那契圆线分析",fibonacciSpiral:"斐波那契螺旋",fibonacciSpiralDesc:"斐波那契螺旋线分析",fibonacciWedge:"斐波那契楔形",fibonacciWedgeDesc:"斐波那契楔形线分析",fibonacciFan:"斐波那契扇形",fibonacciFanDesc:"斐波那契扇形线分析",fibonacciChannel:"斐波那契通道",fibonacciChannelDesc:"斐波那契通道线分析",fibonacciExtensionPrice:"斐波那契扩展(基于价格)",fibonacciExtensionPriceDesc:"绘制斐波那契扩展线",fibonacciExtensionTime:"斐波那契扩展(基于时间)",fibonacciExtensionTimeDesc:"绘制斐波那契扩展线",xabcdPattern:"XABCD图形",xabcdPatternDesc:"绘制XABCD图形",headAndShoulders:"头肩图形",headAndShouldersDesc:"绘制头肩图形",abcdPattern:"ABCD图形",abcdPatternDesc:"绘制ABCD图形",triangleAbcd:"ABCD三角图形",triangleAbcdDesc:"绘制ABCD三角图形",elliottImpulse:"艾略特脉冲波",elliottImpulseDesc:"绘制艾略特脉冲波",elliottCorrective:"艾略特修正浪",elliottCorrectiveDesc:"绘制艾略特修正浪",elliottTriangle:"艾略特三角波",elliottTriangleDesc:"绘制艾略特三角波",elliottDoubleCombo:"艾略特双重组合波",elliottDoubleComboDesc:"绘制艾略特双重组合波",elliottTripleCombo:"艾略特三重组合波",elliottTripleComboDesc:"绘制艾略特三重组合波",rectangle:"矩形",rectangleDesc:"绘制矩形区域",circle:"圆形",circleDesc:"绘制圆形区域",ellipse:"椭圆",ellipseDesc:"绘制椭圆区域",triangle:"三角形",triangleDesc:"绘制三角形",sector:"扇形",sectorDesc:"绘制扇形",curve:"曲线",curveDesc:"绘制曲线",doubleCurve:"双曲线",doubleCurveDesc:"绘制双曲线",timeRange:"时间区间",timeRangeDesc:"绘制时间区间",priceRange:"价格区间",priceRangeDesc:"绘制价格区间",timePriceRange:"时间价格区间",timePriceRangeDesc:"绘制时间价格区间",longPosition:"多头",longPositionDesc:"多头标记",shortPosition:"空头",shortPositionDesc:"空头标记",mockKline:"模拟K线",mockKlineDesc:"模拟K线数据",text:"文本",textDesc:"文本标注",priceNote:"价格标记",priceNoteDesc:"价格标注",bubbleBox:"气泡框",bubbleBoxDesc:"气泡标注框",pin:"定位",pinDesc:"定位标记",signpost:"路标",signpostDesc:"路标标记",priceLabel:"价格标签",priceLabelDesc:"价格标签标记",flagMark:"旗标",flagMarkDesc:"旗标标记",image:"图片",imageDesc:"图片标注",video:"视频",videoDesc:"视频标注",audio:"音频",audioDesc:"音频标注",idea:"点子",ideaDesc:"点子标注",mouseCursor:"鼠标光标",drawingTools:"绘图工具",fibonacciToolsTitle:"斐波那契工具",projectInfoTools:"项目信息工具",shapeTools:"图形工具",brushTitle:"画笔",textMark:"文字标记",emojiMark:"表情标记",deleteTool:"删除工具",setting:"设置",selectedTool:"已选择",clickToStartDrawing:"点击图表开始绘制",selectEmoji:"选择表情",selectedEmoji:"已选择",clickToPlaceEmoji:"点击图表放置表情",aiTools:"AI工具",aiModelSelection:"AI模型",aiFunctions:"AI功能",openai:"OpenAI",openaiDesc:"GPT-4, GPT-3.5",gemini:"Gemini",geminiDesc:"谷歌AI",claude:"Claude",claudeDesc:"Anthropic AI",deepseek:"DeepSeek",deepseekDesc:"国产AI模型",describeChart:"图表分析",describeChartDesc:"用自然语言分析图表走势",predictTrend:"趋势预测",predictTrendDesc:"基于历史数据预测未来趋势"},systemSettings:{title:"系统设置",general:"通用设置",appearance:"外观设置",chart:"图表设置",performance:"性能设置",shortcuts:"快捷键",saveSettings:"保存设置",cancel:"取消",confirm:"确认",language:"语言",timezone:"时区",autoSave:"自动保存",themeMode:"主题模式",fontSize:"字体大小",animations:"动画效果",defaultTimeframe:"默认时间周期",pricePrecision:"价格精度",showGrid:"显示网格",hardwareAcceleration:"硬件加速",dataPointLimit:"数据点限制",realtimeUpdates:"实时数据更新",shortcutsTitle:"键盘快捷键",zoomIn:"放大图表",zoomOut:"缩小图表",resetZoom:"重置缩放",saveChart:"保存图表",undo:"撤销操作",redo:"重做操作",setting:"设置"},settingsDescriptions:{language:"选择界面显示语言",timezone:"设置显示时间的时区",autoSave:"自动保存图表设置和绘图",themeMode:"选择浅色或深色主题",fontSize:"设置界面字体大小",animations:"启用界面动画效果",defaultTimeframe:"设置图表默认显示的时间周期",pricePrecision:"设置价格显示的小数位数",showGrid:"在图表中显示网格线",hardwareAcceleration:"启用GPU加速渲染(推荐)",dataPointLimit:"设置图表显示的最大数据点数量",realtimeUpdates:"启用实时数据流更新"},options:{light:"浅色模式",dark:"深色模式",auto:"跟随系统",small:"小",medium:"中",large:"大",zhCN:"简体中文",enUS:"English",jaJP:"日本語",beijing:"北京时间 (UTC+8)",newYork:"纽约时间 (UTC-5)",london:"伦敦时间 (UTC+0)",chicago:"芝加哥时间 (UTC-6)",denver:"丹佛时间 (UTC-7)",losAngeles:"洛杉矶时间 (UTC-8)",toronto:"多伦多时间 (UTC-5)",paris:"巴黎时间 (UTC+1)",frankfurt:"法兰克福时间 (UTC+1)",zurich:"苏黎世时间 (UTC+1)",moscow:"莫斯科时间 (UTC+3)",dubai:"迪拜时间 (UTC+4)",karachi:"卡拉奇时间 (UTC+5)",kolkata:"加尔各答时间 (UTC+5:30)",shanghai:"上海时间 (UTC+8)",hongKong:"香港时间 (UTC+8)",singapore:"新加坡时间 (UTC+8)",tokyo:"东京时间 (UTC+9)",seoul:"首尔时间 (UTC+9)",sydney:"悉尼时间 (UTC+10)",auckland:"奥克兰时间 (UTC+12)",utc:"UTC时间"},timeframes:{"1s":"1秒","5s":"5秒","15s":"15秒","30s":"30秒","1m":"1分钟","3m":"3分钟","5m":"5分钟","15m":"15分钟","30m":"30分钟","45m":"45分钟","1H":"1小时","2H":"2小时","3H":"3小时","4H":"4小时","6H":"6小时","8H":"8小时","12H":"12小时","1D":"1天","3D":"3天","1W":"1周","2W":"2周","1M":"1月","3M":"3月","6M":"6月"},timezone:"时区",timeFormat:"时间格式",closeTime:"收盘时间",tradingDay:"交易日",searchTimezones:"搜索时区...",timeFormatOptions:{twentyFourHour:"24小时制",twelveHour:"12小时制"},closeTimeOptions:{custom:"自定义时间"},tradingDayOptions:{tradingSession:"交易时段",calendarDay:"日历日",exchangeHours:"交易时间"},terminal:{isEn:"中文",placeholderText:"输入命令..."},ai:{aliyun:"阿里云"}};async function Me(f,t){const e=f.candleViewRef.current;if(!e){const i={success:!1,error:"Container not found",width:0,height:0,timestamp:Date.now()};return t?.(i),i}try{const i=document.createElement("canvas"),r=i.getContext("2d");if(!r){const g={success:!1,error:"Canvas context not available",width:0,height:0,timestamp:Date.now()};return t?.(g),g}const{width:a,height:s}=e.getBoundingClientRect();i.width=a,i.height=s,r.fillStyle=f.state.currentTheme.layout.background.color,r.fillRect(0,0,a,s);const n=e.querySelectorAll("canvas");Array.from(n).sort((g,c)=>{const u=parseInt(window.getComputedStyle(g).zIndex)||0,p=parseInt(window.getComputedStyle(c).zIndex)||0;return u-p}).forEach(g=>{try{const c=g.getBoundingClientRect(),u=e.getBoundingClientRect(),p=c.left-u.left,M=c.top-u.top;r.drawImage(g,p,M,c.width,c.height)}catch{}}),Go(f,e,r,a,s),Qo(r,a,s,f.state.currentTheme);const l=i.toDataURL("image/png"),h=await new Promise(g=>{i.toBlob(c=>{g(c)},"image/png")}),d={success:!0,dataUrl:l,blob:h,width:a,height:s,timestamp:Date.now()};if(t)t(d);else{const g=document.createElement("a");g.download=`chart-screenshot-${new Date().getTime()}.png`,g.href=l,g.click()}return d}catch(i){const r={success:!1,error:i instanceof Error?i.message:"Unknown error",width:0,height:0,timestamp:Date.now()};return t?.(r),r}}function Qo(f,t,e,i){f.save();const a=i.layout.background.color==="#0F1116"?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.25)";f.fillStyle=a,f.font="bold 60px Arial, sans-serif",f.textAlign="center",f.textBaseline="middle";const s=t/2,n=e/2;f.fillText("CandleView",s,n),f.restore()}function Go(f,t,e,i,r){Array.from(t.querySelectorAll('.chart-info-panel, .toolbar, [candleview-container] > div:not([style*="position: absolute"])')).forEach(s=>{$o(f,s,e,t)})}function $o(f,t,e,i){const r=t.getBoundingClientRect(),a=i.getBoundingClientRect(),s=r.left-a.left,n=r.top-a.top,o=document.createElement("canvas"),l=o.getContext("2d");l&&(o.width=r.width,o.height=r.height,Jo(f,t,l,r.width,r.height),e.drawImage(o,s,n,r.width,r.height))}function Jo(f,t,e,i,r){const a=t.textContent||"";a.trim()&&(e.fillStyle=f.state.currentTheme.layout.textColor,e.font="12px Arial",e.textAlign="left",e.textBaseline="top",Zo(f,e,a,i-20).forEach((n,o)=>{e.fillText(n,10,10+o*16)}))}function Zo(f,t,e,i){const r=e.split(" "),a=[];let s=r[0];for(let n=1;n<r.length;n++){const o=r[n];t.measureText(s+" "+o).width<i?s+=" "+o:(a.push(s),s=o)}return a.push(s),a}function tl(f){return f&&{"1s":E.ONE_SECOND,"5s":E.FIVE_SECONDS,"15s":E.FIFTEEN_SECONDS,"30s":E.THIRTY_SECONDS,"1m":E.ONE_MINUTE,"3m":E.THREE_MINUTES,"5m":E.FIVE_MINUTES,"15m":E.FIFTEEN_MINUTES,"30m":E.THIRTY_MINUTES,"45m":E.FORTY_FIVE_MINUTES,"1h":E.ONE_HOUR,"2h":E.TWO_HOURS,"3h":E.THREE_HOURS,"4h":E.FOUR_HOURS,"6h":E.SIX_HOURS,"8h":E.EIGHT_HOURS,"12h":E.TWELVE_HOURS,"1d":E.ONE_DAY,"3d":E.THREE_DAYS,"1w":E.ONE_WEEK,"2w":E.TWO_WEEKS,"1M":E.ONE_MONTH,"3M":E.THREE_MONTHS,"6M":E.SIX_MONTHS}[f]||null}function el(f){return f&&{"America/New_York":W.NEW_YORK,"America/Chicago":W.CHICAGO,"America/Denver":W.DENVER,"America/Los_Angeles":W.LOS_ANGELES,"America/Toronto":W.TORONTO,"Europe/London":W.LONDON,"Europe/Paris":W.PARIS,"Europe/Frankfurt":W.FRANKFURT,"Europe/Zurich":W.ZURICH,"Europe/Moscow":W.MOSCOW,"Asia/Dubai":W.DUBAI,"Asia/Karachi":W.KARACHI,"Asia/Kolkata":W.KOLKATA,"Asia/Shanghai":W.SHANGHAI,"Asia/Hong_Kong":W.HONG_KONG,"Asia/Singapore":W.SINGAPORE,"Asia/Tokyo":W.TOKYO,"Asia/Seoul":W.SEOUL,"Australia/Sydney":W.SYDNEY,"Pacific/Auckland":W.AUCKLAND,UTC:W.UTC}[f]||null}const zi={[E.ONE_SECOND]:{seconds:1,groupBy:"second"},[E.FIVE_SECONDS]:{seconds:5,groupBy:"second"},[E.FIFTEEN_SECONDS]:{seconds:15,groupBy:"second"},[E.THIRTY_SECONDS]:{seconds:30,groupBy:"second"},[E.ONE_MINUTE]:{seconds:60,groupBy:"minute"},[E.THREE_MINUTES]:{seconds:180,groupBy:"minute"},[E.FIVE_MINUTES]:{seconds:300,groupBy:"minute"},[E.FIFTEEN_MINUTES]:{seconds:900,groupBy:"minute"},[E.THIRTY_MINUTES]:{seconds:1800,groupBy:"minute"},[E.FORTY_FIVE_MINUTES]:{seconds:2700,groupBy:"minute"},[E.ONE_HOUR]:{seconds:3600,groupBy:"hour"},[E.TWO_HOURS]:{seconds:7200,groupBy:"hour"},[E.THREE_HOURS]:{seconds:10800,groupBy:"hour"},[E.FOUR_HOURS]:{seconds:14400,groupBy:"hour"},[E.SIX_HOURS]:{seconds:21600,groupBy:"hour"},[E.EIGHT_HOURS]:{seconds:28800,groupBy:"hour"},[E.TWELVE_HOURS]:{seconds:43200,groupBy:"hour"},[E.ONE_DAY]:{seconds:86400,groupBy:"day"},[E.THREE_DAYS]:{seconds:259200,groupBy:"day"},[E.ONE_WEEK]:{seconds:604800,groupBy:"week"},[E.TWO_WEEKS]:{seconds:1209600,groupBy:"week"},[E.ONE_MONTH]:{seconds:2592e3,groupBy:"month"},[E.THREE_MONTHS]:{seconds:7776e3,groupBy:"month"},[E.SIX_MONTHS]:{seconds:15552e3,groupBy:"month"}};function il(f,t){return t&&f in t.timeframes?t.timeframes[f]:yi(f)}function yi(f){return{[E.ONE_SECOND]:"1 Second",[E.FIVE_SECONDS]:"5 Seconds",[E.FIFTEEN_SECONDS]:"15 Seconds",[E.THIRTY_SECONDS]:"30 Seconds",[E.ONE_MINUTE]:"1 Minute",[E.THREE_MINUTES]:"3 Minutes",[E.FIVE_MINUTES]:"5 Minutes",[E.FIFTEEN_MINUTES]:"15 Minutes",[E.THIRTY_MINUTES]:"30 Minutes",[E.FORTY_FIVE_MINUTES]:"45 Minutes",[E.ONE_HOUR]:"1 Hour",[E.TWO_HOURS]:"2 Hours",[E.THREE_HOURS]:"3 Hours",[E.FOUR_HOURS]:"4 Hours",[E.SIX_HOURS]:"6 Hours",[E.EIGHT_HOURS]:"8 Hours",[E.TWELVE_HOURS]:"12 Hours",[E.ONE_DAY]:"1 Day",[E.THREE_DAYS]:"3 Days",[E.ONE_WEEK]:"1 Week",[E.TWO_WEEKS]:"2 Weeks",[E.ONE_MONTH]:"1 Month",[E.THREE_MONTHS]:"3 Months",[E.SIX_MONTHS]:"6 Months"}[f]||f}function rl(f,t,e,i=E.ONE_DAY){if(!f||f.length===0)return[];const r=zi[i],a=r?r.seconds:86400,s=[],n=f[0],o=f[f.length-1],l=f.reduce((M,k)=>M+k.close,0)/f.length,h=typeof n.time=="string"?new Date(n.time).getTime()/1e3:n.time,d=typeof o.time=="string"?new Date(o.time).getTime()/1e3:o.time,g=1e4,c=Math.min(t,g),u=Math.min(e,g);let p=h;for(let M=c;M>0;M--){p-=a;const k={time:p,open:l,high:l,low:l,close:l,volume:-1,isVirtual:!0};s.unshift(k)}s.push(...f),p=d;for(let M=0;M<u;M++){p+=a;const k={time:p,open:l,high:l,low:l,close:l,volume:-1,isVirtual:!0};s.push(k)}return s}function Ri(f,t){if(!f||f.length===0)return f;const e=sl[t];return e?f.map(i=>{const r=i.time;let a;typeof r=="string"?a=new Date(r).getTime()/1e3:a=r;const s=e.offset.match(/^([+-])(\d{2}):(\d{2})$/);if(!s)return{...i,time:a};const n=s[1],o=parseInt(s[2],10),l=parseInt(s[3],10);let h=o*3600+l*60;n==="-"&&(h=-h);const c=-new Date(a*1e3).getTimezoneOffset()*60,u=h-c,p=a+u;return{...i,time:p}}):f}const sl={[W.NEW_YORK]:{name:"America/New_York",offset:"-05:00",displayName:"New York"},[W.CHICAGO]:{name:"America/Chicago",offset:"-06:00",displayName:"Chicago"},[W.DENVER]:{name:"America/Denver",offset:"-07:00",displayName:"Denver"},[W.LOS_ANGELES]:{name:"America/Los_Angeles",offset:"-08:00",displayName:"Los Angeles"},[W.TORONTO]:{name:"America/Toronto",offset:"-05:00",displayName:"Toronto"},[W.LONDON]:{name:"Europe/London",offset:"+00:00",displayName:"London"},[W.PARIS]:{name:"Europe/Paris",offset:"+01:00",displayName:"Paris"},[W.FRANKFURT]:{name:"Europe/Frankfurt",offset:"+01:00",displayName:"Frankfurt"},[W.ZURICH]:{name:"Europe/Zurich",offset:"+01:00",displayName:"Zurich"},[W.MOSCOW]:{name:"Europe/Moscow",offset:"+03:00",displayName:"Moscow"},[W.DUBAI]:{name:"Asia/Dubai",offset:"+04:00",displayName:"Dubai"},[W.KARACHI]:{name:"Asia/Karachi",offset:"+05:00",displayName:"Karachi"},[W.KOLKATA]:{name:"Asia/Kolkata",offset:"+05:30",displayName:"Kolkata"},[W.SHANGHAI]:{name:"Asia/Shanghai",offset:"+08:00",displayName:"Shanghai"},[W.HONG_KONG]:{name:"Asia/Hong_Kong",offset:"+08:00",displayName:"Hong Kong"},[W.SINGAPORE]:{name:"Asia/Singapore",offset:"+08:00",displayName:"Singapore"},[W.TOKYO]:{name:"Asia/Tokyo",offset:"+09:00",displayName:"Tokyo"},[W.SEOUL]:{name:"Asia/Seoul",offset:"+09:00",displayName:"Seoul"},[W.SYDNEY]:{name:"Australia/Sydney",offset:"+10:00",displayName:"Sydney"},[W.AUCKLAND]:{name:"Pacific/Auckland",offset:"+12:00",displayName:"Auckland"},[W.UTC]:{name:"UTC",offset:"+00:00",displayName:"UTC"}};function al(f,t){if(!f||f.length===0)return[];try{const e=nl(t);if(e<=0)return[...f];const i=[];let r=[],a=0;for(let s=0;s<f.length;s++){const n=f[s],o=typeof n.time=="string"?new Date(n.time).getTime()/1e3:n.time,l=Math.floor(o/e)*e;if(r.length===0)r.push(n),a=l;else if(l===a)r.push(n);else{if(r.length>0){const h=Bi(r);i.push(h)}r=[n],a=l}}if(r.length>0){const s=Bi(r);i.push(s)}return i}catch{return f}}function nl(f){switch(f){case E.ONE_SECOND:return 1;case E.FIVE_SECONDS:return 5;case E.FIFTEEN_SECONDS:return 15;case E.THIRTY_SECONDS:return 30;case E.ONE_MINUTE:return 60;case E.THREE_MINUTES:return 180;case E.FIVE_MINUTES:return 300;case E.FIFTEEN_MINUTES:return 900;case E.THIRTY_MINUTES:return 1800;case E.FORTY_FIVE_MINUTES:return 2700;case E.ONE_HOUR:return 3600;case E.TWO_HOURS:return 7200;case E.THREE_HOURS:return 10800;case E.FOUR_HOURS:return 14400;case E.SIX_HOURS:return 360*60;case E.EIGHT_HOURS:return 480*60;case E.TWELVE_HOURS:return 720*60;case E.ONE_DAY:return 1440*60;case E.THREE_DAYS:return 4320*60;case E.ONE_WEEK:return 10080*60;case E.TWO_WEEKS:return 336*60*60;case E.ONE_MONTH:return 720*60*60;case E.THREE_MONTHS:return 2160*60*60;case E.SIX_MONTHS:return 4320*60*60;default:return 0}}function Bi(f){if(f.length===1)return{...f[0]};const t=f[0].open,e=f[f.length-1].close;let i=-1/0,r=1/0,a=0;for(const s of f)i=Math.max(i,s.high),r=Math.min(r,s.low),a+=s.volume||0;return{time:f[0].time,open:t,high:i,low:r,close:e,volume:a,isVirtual:f.some(s=>s.isVirtual)}}function me(f,t,e,i){return{timeframe:f.timeframe||E.ONE_DAY,timezone:f.timezone||W.SHANGHAI,shouldExtendVirtualData:!0,virtualDataBeforeCount:e||0,virtualDataAfterCount:i||0,chartType:t}}class ke{static handleData(t,e,i,r){if(!t||t.length===0)return[];try{var a=[];if(r){const s=Ri(t,e.timezone);a=e.shouldExtendVirtualData?this.extendWithVirtualData(s,e):s}else{const s=Ri(t,e.timezone),n=al(s,e.timeframe);a=e.shouldExtendVirtualData?this.extendWithVirtualData(n,e):n}return a}catch{return t}}static extendWithVirtualData(t,e){const i=e.virtualDataBeforeCount??this.calculateOptimalVirtualDataCount(e.timeframe,"before"),r=e.virtualDataAfterCount??this.calculateOptimalVirtualDataCount(e.timeframe,"after");return rl(t,i,r,e.timeframe)}static calculateOptimalVirtualDataCount(t,e){const r=[E.ONE_SECOND,E.FIVE_SECONDS,E.FIFTEEN_SECONDS,E.THIRTY_SECONDS].includes(t),a=[E.ONE_MINUTE,E.THREE_MINUTES,E.FIVE_MINUTES,E.FIFTEEN_MINUTES,E.THIRTY_MINUTES,E.FORTY_FIVE_MINUTES].includes(t),s=[E.ONE_HOUR,E.TWO_HOURS,E.THREE_HOURS,E.FOUR_HOURS,E.SIX_HOURS,E.EIGHT_HOURS,E.TWELVE_HOURS].includes(t),n=[E.ONE_DAY,E.THREE_DAYS].includes(t),o=[E.ONE_WEEK,E.TWO_WEEKS].includes(t),l=[E.ONE_MONTH,E.THREE_MONTHS,E.SIX_MONTHS].includes(t);return r?Math.min(100,50):a?Math.min(100,80):s?100:n?200:o?300:l?400:100}static handleChartDisplayData(t,e){if(!t||t.length===0)return[];let i=[];try{return e===G.Candle||e===G.HollowCandle||e===G.Bar?i=t.map((r,a)=>{const s={time:r.time,open:Number(r.open),high:Number(r.high),low:Number(r.low),close:Number(r.close),volume:Number(r.volume)};return r.isVirtual?{...s,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:s}):e===G.BaseLine?i=t.map(r=>{const a=r.isVirtual||r.volume===-1,s={time:r.time,value:Number(r.close)};return a?{...s,color:"transparent"}:s}):e===G.Line||e===G.Area||e===G.StepLine?i=t.map(r=>{const a=r.isVirtual||r.volume===-1,s={time:r.time,value:Number(r.close)};return a?{...s,color:"transparent"}:s}):e===G.Histogram?i=t.map(r=>{const a=r.isVirtual||r.volume===-1,s={time:r.time,value:r.volume||0};return a?{...s,color:"transparent"}:{...s,color:(r.volume||0)>100?"#26a69a":"#ef5350"}}):i=t.map(r=>{const a=r.isVirtual||r.volume===-1;return{time:r.time,value:Number(r.close),...a&&{color:"transparent"}}}),i}catch{return[]}}static filterRealData(t){return t.filter(e=>!e.isVirtual&&e.volume!==-1&&e.volume!==0)}static getTimeframeConfig(t){return zi[t]}static validateData(t){return!t||!Array.isArray(t)?!1:t.every(e=>e.time!==void 0&&e.open!==void 0&&e.high!==void 0&&e.low!==void 0&&e.close!==void 0)}static sampleData(t,e=1){if(e>=1||t.length<=1e3)return t;const i=[],r=Math.floor(1/e);for(let a=0;a<t.length;a+=r)a<t.length&&i.push(t[a]);return i}}const At=class At{static getRealDataRange(t){if(t.length===0)return null;let e=-1,i=-1;for(let r=0;r<t.length;r++)if(!t[r].isVirtual){e=r;break}for(let r=t.length-1;r>=0;r--)if(!t[r].isVirtual){i=r;break}return{firstIndex:e,lastIndex:i}}static checkDataPointPositions(t,e,i){if(!t||!e)return;const{firstIndex:r,lastIndex:a}=e,{from:s,to:n}=t,o=r>=s&&r<=n,l=a>=s&&a<=n,h=r<s,d=r>n,g=a<s,c=a>n,p=(n-s)*.1,M=r>=n-p&&r<=n,k=a>=s&&a<=s+p;!this.lastFirstRealDataLeftViewport&&h&&i.onFirstRealDataExitLeftViewport?.(),!this.lastFirstRealDataRightViewport&&d&&i.onFirstRealDataExitRightViewport?.(),!this.lastLastRealDataLeftViewport&&g&&i.onLastRealDataExitLeftViewport?.(),!this.lastLastRealDataRightViewport&&c&&i.onLastRealDataExitRightViewport?.(),this.lastFirstRealDataLeftViewport&&!h&&o&&i.onFirstRealDataEnterLeftViewport?.(),!this.lastFirstRealDataNearRightViewport&&M&&i.onFirstRealDataNearRightViewport?.(),!this.lastLastRealDataNearLeftViewport&&k&&i.onLastRealDataNearLeftViewport?.(),this.lastFirstRealDataNearRightViewport&&!M&&i.onFirstRealDataLeaveNearRightViewport?.(),this.lastLastRealDataNearLeftViewport&&!k&&i.onLastRealDataLeaveNearLeftViewport?.(),this.lastFirstRealDataInViewport&&!o&&i.onFirstRealDataExitViewport?.(),this.lastLastRealDataInViewport&&!l&&i.onLastRealDataExitViewport?.(),this.lastFirstRealDataInViewport=o,this.lastLastRealDataInViewport=l,this.lastFirstRealDataLeftViewport=h,this.lastFirstRealDataRightViewport=d,this.lastLastRealDataLeftViewport=g,this.lastLastRealDataRightViewport=c,this.lastFirstRealDataNearRightViewport=M,this.lastLastRealDataNearLeftViewport=k}static reset(){this.lastFirstRealDataInViewport=!0,this.lastLastRealDataInViewport=!0,this.lastFirstRealDataLeftViewport=!1,this.lastFirstRealDataRightViewport=!1,this.lastLastRealDataLeftViewport=!1,this.lastLastRealDataRightViewport=!1,this.lastFirstRealDataNearRightViewport=!1,this.lastLastRealDataNearLeftViewport=!1}static getCurrentState(){return{lastFirstRealDataInViewport:this.lastFirstRealDataInViewport,lastLastRealDataInViewport:this.lastLastRealDataInViewport,lastFirstRealDataLeftViewport:this.lastFirstRealDataLeftViewport,lastFirstRealDataRightViewport:this.lastFirstRealDataRightViewport,lastLastRealDataLeftViewport:this.lastLastRealDataLeftViewport,lastLastRealDataRightViewport:this.lastLastRealDataRightViewport,lastFirstRealDataNearRightViewport:this.lastFirstRealDataNearRightViewport,lastLastRealDataNearLeftViewport:this.lastLastRealDataNearLeftViewport}}};At.lastFirstRealDataInViewport=!0,At.lastLastRealDataInViewport=!0,At.lastFirstRealDataLeftViewport=!1,At.lastFirstRealDataRightViewport=!1,At.lastLastRealDataLeftViewport=!1,At.lastLastRealDataRightViewport=!1,At.lastFirstRealDataNearRightViewport=!1,At.lastLastRealDataNearLeftViewport=!1;let Ce=At;class ol{constructor(t,e){this.chart=null,this.currentSeries=null,this.beforeViewPortBuffer=100,this.afterViewPortBuffer=0,this.getViewportDataPoints=(i,r)=>{if(!r||r.length===0)return[];const a=i.from-this.beforeViewPortBuffer,s=i.to-this.afterViewPortBuffer;return r.filter(o=>o.time>=a&&o.time<=s)},this.scrollLockState={isScrollLocked:!1,lockDirection:null,safeVisibleRange:null},this.chart=t,this.currentSeries=e}zoomIn(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const a=(e.to-e.from)*.8,s=(e.from+e.to)/2;t.setVisibleRange({from:s-a/2,to:s+a/2})}zoomOut(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const a=(e.to-e.from)*1.2,s=(e.from+e.to)/2;t.setVisibleRange({from:s-a/2,to:s+a/2})}scrollChart(t){if(!this.chart)return;const e=this.chart.timeScale(),i=e.getVisibleRange();if(!i)return;const a=(i.to-i.from)*.2;t==="left"?e.setVisibleRange({from:i.from-a,to:i.to-a}):e.setVisibleRange({from:i.from+a,to:i.to+a})}positionChart(){this.setOptimalBarSpacing(),this.scrollToRealData()}getVisibleTimeRange(){if(!this.chart)return null;try{const e=this.chart.timeScale().getVisibleRange();return e?{from:e.from,to:e.to}:null}catch(t){return console.error(t),null}}setVisibleTimeRange(t){if(!this.chart||!t)return;const e=this.chart.timeScale();try{e.setVisibleRange({from:t.from,to:t.to})}catch(i){console.error(i),this.scrollToRealData()}}scrollToRealData(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{firstIndex:i,lastIndex:r,virtualAfterCount:a}=this.getRealDataRange();if(i===-1||r===-1){t.fitContent();return}const s=Math.min(100,r-i+1+10),n=Math.max(0,i-5),o=Math.min(e.length-1,r+Math.min(10,a));t.setVisibleLogicalRange({from:n,to:o})}catch(t){console.error(t),this.scrollToStablePosition()}}scrollToStablePosition(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{lastIndex:i}=this.getRealDataRange();if(i===-1)t.setVisibleLogicalRange({from:Math.max(0,e.length-50),to:e.length-1});else{const a=Math.max(0,i-50+1),s=Math.min(e.length-1,i+5);t.setVisibleLogicalRange({from:a,to:s})}}catch(t){console.error(t),this.chart&&this.chart.timeScale().fitContent()}}getRealDataRange(){const t=this.currentSeries?.series?.data||[];let e=-1,i=-1,r=0,a=0,s=0;for(let n=0;n<t.length;n++){const o=t[n];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){e=n,a=n;break}}for(let n=t.length-1;n>=0;n--){const o=t[n];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){i=n,s=t.length-1-n;break}}if(e!==-1&&i!==-1)for(let n=e;n<=i;n++){const o=t[n];!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0&&r++}return{firstIndex:e,lastIndex:i,realDataCount:r,virtualBeforeCount:a,virtualAfterCount:s}}setOptimalBarSpacing(){if(!this.chart)return;const t=this.chart.timeScale(),i=t.options().barSpacing||10,r=10;let a=r;Math.abs(i-r)>2&&(a=i);try{t.applyOptions({barSpacing:a,minBarSpacing:.5,maxBarSpacing:50})}catch(s){console.error(s)}}handleChartScrollLock(t,e){const i=this.chart.timeScale(),r=Ce.getRealDataRange(e);if(!r)return;const{firstIndex:a,lastIndex:s}=r;if(a!==-1&&s!==-1&&e.length>0){const n=i.getVisibleLogicalRange();if(n){const{from:o,to:l}=n,h=a>=l-1,d=s<=o+1;if(this.scrollLockState.isScrollLocked&&this.scrollLockState.safeVisibleRange&&(this.scrollLockState.lockDirection==="right"?t.from>this.scrollLockState.safeVisibleRange.from+2&&!h&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null):this.scrollLockState.lockDirection==="left"&&t.from<this.scrollLockState.safeVisibleRange.from-2&&!d&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null),this.scrollLockState.isScrollLocked)){i.setVisibleRange(this.scrollLockState.safeVisibleRange);return}this.scrollLockState.isScrollLocked||(h?(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="right",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)):d&&(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="left",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)))}}}}const ll=new Map([["qwen-turbo",{name:"qwen-turbo",displayName:"Qwen-Turbo",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions","https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation"],format:"openai",description:"Lightweight version, fast response speed, suitable for general conversation scenarios",maxTokens:2e3,contextLength:8e3,capabilities:["text-generation","chat"]}],["qwen-plus",{name:"qwen-plus",displayName:"Qwen-Plus",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"],format:"openai",description:"Enhanced version, suitable for complex tasks and long text processing",maxTokens:6e3,contextLength:32e3,capabilities:["text-generation","chat","reasoning"]}],["qwen-max",{name:"qwen-max",displayName:"Qwen-Max",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"],format:"openai",description:"Maximum version, strongest capabilities, suitable for high-demand professional tasks",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","chat","reasoning","coding","analysis"]}],["qwen-max-longcontext",{name:"qwen-max-longcontext",displayName:"Qwen-Max-LongContext",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"],format:"openai",description:"Supports 128K long context, suitable for long document processing",maxTokens:8e3,contextLength:128e3,capabilities:["text-generation","chat","document-analysis"]}],["qwen2.5-0.5b",{name:"qwen2.5-0.5b",displayName:"Qwen2.5-0.5B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Ultra-lightweight 0.5B parameter model for edge devices",maxTokens:4e3,contextLength:32e3,capabilities:["text-generation","chat"]}],["qwen2.5-0.5b-instruct",{name:"qwen2.5-0.5b-instruct",displayName:"Qwen2.5-0.5B-Instruct",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Instruction-tuned 0.5B model for specific tasks",maxTokens:4e3,contextLength:32e3,capabilities:["instruction-following","chat"]}],["qwen2.5-7b",{name:"qwen2.5-7b",displayName:"Qwen2.5-7B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"7B parameter base model, balanced performance and efficiency",maxTokens:6e3,contextLength:32e3,capabilities:["text-generation","reasoning"]}],["qwen2.5-7b-instruct",{name:"qwen2.5-7b-instruct",displayName:"Qwen2.5-7B-Instruct",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Instruction-tuned 7B model for chat and tasks",maxTokens:6e3,contextLength:32e3,capabilities:["chat","instruction-following","coding"]}],["qwen2.5-14b",{name:"qwen2.5-14b",displayName:"Qwen2.5-14B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"14B parameter model with enhanced capabilities",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","analysis","reasoning"]}],["qwen2.5-32b",{name:"qwen2.5-32b",displayName:"Qwen2.5-32B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"32B parameter high-performance model",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","complex-reasoning","analysis"]}],["qwen2.5-72b",{name:"qwen2.5-72b",displayName:"Qwen2.5-72B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"72B parameter state-of-the-art model",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","expert-analysis","research"]}],["qwen2.5-coder",{name:"qwen2.5-coder",displayName:"Qwen2.5-Coder",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized code generation model",maxTokens:8e3,contextLength:32e3,capabilities:["code-generation","code-explanation","debugging"]}],["qwen2.5-coder-7b",{name:"qwen2.5-coder-7b",displayName:"Qwen2.5-Coder-7B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"7B parameter code generation model",maxTokens:8e3,contextLength:32e3,capabilities:["code-generation","programming"]}],["qwen2.5-coder-14b",{name:"qwen2.5-coder-14b",displayName:"Qwen2.5-Coder-14B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"14B parameter advanced code generation model",maxTokens:8e3,contextLength:32e3,capabilities:["code-generation","code-review","optimization"]}],["qwen-vl-lite",{name:"qwen-vl-lite",displayName:"Qwen-VL-Lite",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Lightweight vision-language model for basic image understanding",maxTokens:2e3,contextLength:8e3,capabilities:["image-understanding","visual-qa"]}],["qwen-vl-plus",{name:"qwen-vl-plus",displayName:"Qwen-VL-Plus",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Vision-language model supporting image understanding",maxTokens:4e3,contextLength:32e3,capabilities:["image-understanding","document-analysis","visual-reasoning"]}],["qwen-vl-max",{name:"qwen-vl-max",displayName:"Qwen-VL-Max",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Most powerful vision-language model",maxTokens:8e3,contextLength:32e3,capabilities:["image-understanding","video-analysis","multimodal-reasoning"]}],["qwen-audio-turbo",{name:"qwen-audio-turbo",displayName:"Qwen-Audio-Turbo",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Fast audio processing and speech-to-text model",maxTokens:2e3,contextLength:8e3,capabilities:["speech-recognition","audio-analysis"]}],["qwen-audio-chat",{name:"qwen-audio-chat",displayName:"Qwen-Audio-Chat",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Audio conversation and processing model",maxTokens:4e3,contextLength:32e3,capabilities:["audio-chat","voice-assistant","speech-synthesis"]}],["qwen-math-7b",{name:"qwen-math-7b",displayName:"Qwen-Math-7B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized for mathematical reasoning and problem solving",maxTokens:4e3,contextLength:32e3,capabilities:["mathematical-reasoning","problem-solving"]}],["llama2-7b-chat-v2",{name:"llama2-7b-chat-v2",displayName:"LLaMA2-7B-Chat",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Meta's LLaMA2-7B model",maxTokens:2e3,contextLength:8e3,capabilities:["chat","text-generation"]}],["baichuan2-7b-chat-v1",{name:"baichuan2-7b-chat-v1",displayName:"Baichuan2-7B-Chat",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Baichuan AI's Baichuan2-7B model",maxTokens:2e3,contextLength:8e3,capabilities:["chat","chinese-nlp"]}],["qwen-financial",{name:"qwen-financial",displayName:"Qwen-Financial",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized for financial analysis and market insights",maxTokens:6e3,contextLength:32e3,capabilities:["financial-analysis","market-prediction","risk-assessment"]}],["qwen-medical",{name:"qwen-medical",displayName:"Qwen-Medical",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized for medical consultation and health analysis",maxTokens:6e3,contextLength:32e3,capabilities:["medical-consultation","health-analysis","diagnostic-support"]}],["qwen-omni",{name:"qwen-omni",displayName:"Qwen-Omni",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Omnidirectional multimodal model supporting text, image, audio",maxTokens:8e3,contextLength:64e3,capabilities:["text-generation","image-understanding","audio-processing","multimodal"]}],["qwen-omni-pro",{name:"qwen-omni-pro",displayName:"Qwen-Omni-Pro",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Professional omnidirectional multimodal model with advanced capabilities",maxTokens:16e3,contextLength:128e3,capabilities:["text-generation","multimodal","complex-reasoning","expert-analysis"]}]]);function hl(){return Array.from(ll.keys())}const cl=new Map([["deepseek-chat",{name:"deepseek-chat",displayName:"DeepSeek Chat",endpoint:"https://api.deepseek.com/v1/chat/completions",endpoints:["https://api.deepseek.com/v1/chat/completions"],format:"openai",description:"General purpose chat model for everyday conversations and tasks",maxTokens:4096,contextLength:16e3,capabilities:["chat","text-generation","reasoning"],version:"2025-01"}],["deepseek-chat-lite",{name:"deepseek-chat-lite",displayName:"DeepSeek Chat Lite",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Lightweight chat model optimized for speed and efficiency",maxTokens:2048,contextLength:8e3,capabilities:["chat","text-generation"],version:"2025-01"}],["deepseek-chat-pro",{name:"deepseek-chat-pro",displayName:"DeepSeek Chat Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Professional chat model with enhanced reasoning capabilities",maxTokens:8192,contextLength:32e3,capabilities:["chat","text-generation","complex-reasoning","analysis"],version:"2025-01"}],["deepseek-chat-max",{name:"deepseek-chat-max",displayName:"DeepSeek Chat Max",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Maximum capability chat model for most demanding tasks",maxTokens:16384,contextLength:64e3,capabilities:["chat","text-generation","expert-analysis","research"],version:"2025-01"}],["deepseek-coder",{name:"deepseek-coder",displayName:"DeepSeek Coder",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized model for code generation and programming tasks",maxTokens:16384,contextLength:64e3,capabilities:["code-generation","programming","debugging","code-review"],version:"2025-01"}],["deepseek-coder-lite",{name:"deepseek-coder-lite",displayName:"DeepSeek Coder Lite",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Lightweight code generation model",maxTokens:4096,contextLength:16e3,capabilities:["code-generation","programming"],version:"2025-01"}],["deepseek-coder-pro",{name:"deepseek-coder-pro",displayName:"DeepSeek Coder Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Professional code generation model with advanced features",maxTokens:32768,contextLength:128e3,capabilities:["code-generation","programming","system-design","architecture"],version:"2025-01"}],["deepseek-math",{name:"deepseek-math",displayName:"DeepSeek Math",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized model for mathematical reasoning and problem solving",maxTokens:8192,contextLength:32e3,capabilities:["mathematical-reasoning","problem-solving","calculations"],version:"2025-01"}],["deepseek-math-pro",{name:"deepseek-math-pro",displayName:"DeepSeek Math Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Advanced mathematical reasoning model for complex problems",maxTokens:16384,contextLength:64e3,capabilities:["mathematical-reasoning","advanced-calculus","statistics"],version:"2025-01"}],["deepseek-reasoner",{name:"deepseek-reasoner",displayName:"DeepSeek Reasoner",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Dedicated reasoning model for logical analysis",maxTokens:8192,contextLength:32e3,capabilities:["logical-reasoning","analysis","decision-making"],version:"2025-01"}],["deepseek-reasoner-pro",{name:"deepseek-reasoner-pro",displayName:"DeepSeek Reasoner Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Advanced reasoning model for complex logical problems",maxTokens:16384,contextLength:64e3,capabilities:["complex-reasoning","scientific-analysis","research"],version:"2025-01"}],["deepseek-vision",{name:"deepseek-vision",displayName:"DeepSeek Vision",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Vision model for image understanding and analysis",maxTokens:4096,contextLength:16e3,capabilities:["image-understanding","visual-qa","document-analysis"],version:"2025-01"}],["deepseek-vision-pro",{name:"deepseek-vision-pro",displayName:"DeepSeek Vision Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Advanced vision model for complex visual tasks",maxTokens:8192,contextLength:32e3,capabilities:["image-understanding","video-analysis","visual-reasoning"],version:"2025-01"}],["deepseek-finance",{name:"deepseek-finance",displayName:"DeepSeek Finance",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for financial analysis, market prediction, and investment insights",maxTokens:8192,contextLength:32e3,capabilities:["financial-analysis","market-prediction","risk-assessment","investment-advice"],version:"2025-01"}],["deepseek-law",{name:"deepseek-law",displayName:"DeepSeek Law",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for legal analysis, contract review, and legal research",maxTokens:16384,contextLength:64e3,capabilities:["legal-analysis","contract-review","legal-research"],version:"2025-01"}],["deepseek-medical",{name:"deepseek-medical",displayName:"DeepSeek Medical",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for medical consultation, diagnosis support, and health analysis",maxTokens:8192,contextLength:32e3,capabilities:["medical-consultation","diagnostic-support","health-analysis"],version:"2025-01"}],["deepseek-research",{name:"deepseek-research",displayName:"DeepSeek Research",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for academic research and scientific analysis",maxTokens:32768,contextLength:128e3,capabilities:["academic-research","scientific-analysis","paper-writing"],version:"2025-01"}],["deepseek-omni",{name:"deepseek-omni",displayName:"DeepSeek Omni",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Multimodal model supporting text, image, and audio",maxTokens:16384,contextLength:64e3,capabilities:["text-generation","image-understanding","audio-processing","multimodal"],version:"2025-01"}],["deepseek-omni-pro",{name:"deepseek-omni-pro",displayName:"DeepSeek Omni Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Professional multimodal model with advanced capabilities",maxTokens:32768,contextLength:128e3,capabilities:["text-generation","multimodal","complex-reasoning","expert-analysis"],version:"2025-01"}],["deepseek-llm",{name:"deepseek-llm",displayName:"DeepSeek LLM",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Base large language model",maxTokens:4096,contextLength:16e3,capabilities:["text-generation"],version:"2024-12"}]]);function dl(){return Array.from(cl.keys())}const ul=new Map([["gpt-4",{name:"gpt-4",displayName:"GPT-4",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Powerful multi-purpose model for complex tasks",maxTokens:8192,contextLength:8192,capabilities:["chat","text-generation","reasoning","analysis"],inputCostPer1KTokens:.03,outputCostPer1KTokens:.06,supportedFeatures:["chat","function-calling"]}],["gpt-4-turbo",{name:"gpt-4-turbo",displayName:"GPT-4 Turbo",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Enhanced GPT-4 with 128K context, knowledge cutoff April 2023",maxTokens:4096,contextLength:128e3,capabilities:["chat","text-generation","reasoning","analysis","vision"],inputCostPer1KTokens:.01,outputCostPer1KTokens:.03,supportedFeatures:["chat","function-calling","vision","json-mode"]}],["gpt-4o",{name:"gpt-4o",displayName:"GPT-4o",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Versatile model supporting text, images, audio with fast response",maxTokens:4096,contextLength:128e3,capabilities:["chat","text-generation","vision","audio-processing","multimodal"],inputCostPer1KTokens:.005,outputCostPer1KTokens:.015,supportedFeatures:["chat","function-calling","vision","audio","json-mode"]}],["gpt-4o-mini",{name:"gpt-4o-mini",displayName:"GPT-4o Mini",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Compact and efficient version of GPT-4o with lower cost",maxTokens:16384,contextLength:128e3,capabilities:["chat","text-generation","vision"],inputCostPer1KTokens:15e-5,outputCostPer1KTokens:6e-4,supportedFeatures:["chat","function-calling","vision","json-mode"]}],["gpt-3.5-turbo",{name:"gpt-3.5-turbo",displayName:"GPT-3.5 Turbo",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Fast and cost-effective, suitable for most conversational tasks",maxTokens:4096,contextLength:16385,capabilities:["chat","text-generation","code-generation"],inputCostPer1KTokens:5e-4,outputCostPer1KTokens:.0015,supportedFeatures:["chat","function-calling"]}],["gpt-3.5-turbo-instruct",{name:"gpt-3.5-turbo-instruct",displayName:"GPT-3.5 Turbo Instruct",endpoint:"https://api.openai.com/v1/completions",format:"openai",description:"Instruction-tuned version for text completion tasks",maxTokens:4096,contextLength:4097,capabilities:["text-completion","instruction-following"],inputCostPer1KTokens:.0015,outputCostPer1KTokens:.002,supportedFeatures:["completions"]}],["text-embedding-ada-002",{name:"text-embedding-ada-002",displayName:"Text Embedding Ada 002",endpoint:"https://api.openai.com/v1/embeddings",format:"openai",description:"Text embedding model, 1536 dimensions, suitable for retrieval and similarity",contextLength:8191,capabilities:["embeddings","semantic-search"],inputCostPer1KTokens:1e-4,supportedFeatures:["embeddings"]}],["text-embedding-3-small",{name:"text-embedding-3-small",displayName:"Text Embedding 3 Small",endpoint:"https://api.openai.com/v1/embeddings",format:"openai",description:"Small text embedding model, 1536 dimensions, balance of performance and cost",contextLength:8191,capabilities:["embeddings","semantic-search"],inputCostPer1KTokens:2e-5,supportedFeatures:["embeddings"]}],["dall-e-3",{name:"dall-e-3",displayName:"DALL-E 3",endpoint:"https://api.openai.com/v1/images/generations",format:"openai",description:"Advanced image generation model producing high-quality, high-resolution images",capabilities:["image-generation","creative-design"],inputCostPer1KTokens:.04,supportedFeatures:["image-generation","variations","edits"]}],["whisper-1",{name:"whisper-1",displayName:"Whisper",endpoint:"https://api.openai.com/v1/audio/transcriptions",format:"openai",description:"Speech recognition model supporting multilingual transcription and translation",capabilities:["speech-recognition","audio-transcription","translation"],inputCostPer1KTokens:.006,supportedFeatures:["transcriptions","translations"]}],["tts-1-hd",{name:"tts-1-hd",displayName:"TTS-1 HD",endpoint:"https://api.openai.com/v1/audio/speech",format:"openai",description:"High-quality text-to-speech with multiple voice options",capabilities:["speech-synthesis","text-to-speech"],inputCostPer1KTokens:.015,supportedFeatures:["speech","voice-selection"]}],["text-moderation-latest",{name:"text-moderation-latest",displayName:"Moderation Latest",endpoint:"https://api.openai.com/v1/moderations",format:"openai",description:"Content moderation model for detecting harmful content",capabilities:["content-moderation","safety"],inputCostPer1KTokens:1e-4,supportedFeatures:["moderation"]}]]);function gl(){return Array.from(ul.keys())}var Qi=(f=>(f.AnalyzeOHLCV="/analyzeOHLCV",f))(Qi||{}),_t=(f=>(f.Aliyun="aliyun",f.OpenAI="openai",f.DeepSeek="deepseek",f.Claude="claude",f.Gemini="gemini",f))(_t||{});const pl={aliyun:"https://cdn.simpleicons.org/alibabacloud/FF6A00",openai:"https://cdn.simpleicons.org/openai/412991",deepseek:"https://www.deepseek.com/favicon.ico",claude:"https://cdn.simpleicons.org/anthropic/FF6B35",gemini:"https://cdn.simpleicons.org/google/4285F4"},Ui={aliyun:"Aliyun",openai:"OpenAI",deepseek:"DeepSeek",claude:"Claude",gemini:"Gemini"};function fl(f){switch(f){case"openai":return gl();case"aliyun":return hl();case"deepseek":return dl();case"claude":return[];case"gemini":return[];default:return[]}}var Pt=(f=>(f.OpenaiChart="openai-chart",f.OpenaiPredict="openai-predict",f.AliyunChart="aliyun-chart",f.AliyunPredict="aliyun-predict",f.DeepseekChart="deepseek-chart",f.DeepseekPredict="deepseek-predict",f.ClaudeChart="claude-chart",f.ClaudePredict="claude-predict",f.GeminiChart="gemini-chart",f.GeminiPredict="gemini-predict",f))(Pt||{});class Ml{isChartType(t){const e=this.aiToolIdToFunctionType(t);return!!(e&&(e===Pt.ClaudeChart||e===Pt.DeepseekChart||e===Pt.AliyunChart||e===Pt.GeminiChart||e===Pt.OpenaiChart))}aiToolIdToFunctionType(t){return Object.values(Pt).includes(t)?t:null}getAITypeFromFunctionType(t){if(!t)return null;const e={openai:_t.OpenAI,aliyun:_t.Aliyun,deepseek:_t.DeepSeek,claude:_t.Claude,gemini:_t.Gemini},i=t.split("-")[0].toLowerCase(),r=e[i];return r!==void 0?r:null}}const ml=["clear","cls","help","theme","history","open","close"],kl=[...Object.values(D).map(f=>f.toLowerCase().replace(/_/g," ")),...Object.values(X).map(f=>f.toLowerCase().replace(/_/g," "))],Pl=({currentTheme:f,i18n:t,onCommand:e,placeholder:i="",disabled:r=!1,autoFocus:a=!1,showToolbar:s=!0,initialShow:n=!0,chartLayerRef:o,candleView:l})=>{const[h,d]=y.useState(""),[g,c]=y.useState([]),[u,p]=y.useState(-1),[M,k]=y.useState(!1),[P,S]=y.useState(0),[_,C]=y.useState(n),[v,A]=y.useState([]),[R,U]=y.useState(!1),I=y.useRef(null),N=y.useRef(null),L=t.terminal.isEn==="en",[et,at]=y.useState([]),[$,J]=y.useState(-1),[O,Z]=y.useState(!1);y.useEffect(()=>{A([L?`🕯️ Welcome to CandleView Terminal v1.0 Type 'help' to see available commands
194
+ `,Z={position:"fixed",left:`${h.x}px`,top:`${h.y}px`,background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"8px",padding:"0",width:"450px",maxWidth:"90vw",height:"500px",maxHeight:"80vh",zIndex:1e4,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",cursor:g?"grabbing":"default",userSelect:g?"none":"auto",display:"flex",flexDirection:"column"},lt={padding:"16px 16px 12px 16px",borderBottom:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,cursor:"grab",userSelect:"none",flexShrink:0},ut={fontSize:"14px",fontWeight:"bold",color:r?.layout?.textColor||"#000000",margin:0},x={padding:"16px",flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},j={marginBottom:"16px",flex:1,overflowY:"auto",overflowX:"hidden",...J},nt={display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px",padding:"8px",background:r?.toolbar?.background||"#fafafa",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px"},ct={fontSize:"12px",color:r?.layout?.textColor||"#000000",minWidth:"80px",fontWeight:"bold"},it={width:"80px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},B={width:"60px",padding:"4px 8px",background:r?.toolbar?.background||"#fafafa",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",fontSize:"12px"},q={display:"flex",alignItems:"center",gap:"4px",position:"relative"},st={width:"24px",height:"24px",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",cursor:"pointer"},ht={position:"absolute",top:0,left:0,width:"24px",height:"24px",border:"none",background:"transparent",cursor:"pointer",opacity:0},gt={background:"transparent",border:"none",fontSize:"16px",cursor:"pointer",padding:"0",width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",color:r?.chart?.downColor||"#ff4d4f"},ft={...gt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed"},Tt={width:"100%",background:"transparent",color:r?.chart?.lineColor||"#2962FF",border:`2px dashed ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"8px 16px",fontSize:"12px",cursor:"pointer",marginBottom:"16px",flexShrink:0},kt={...Tt,color:`${r?.toolbar?.border||"#d9d9d9"}`,cursor:"not-allowed",borderColor:`${r?.toolbar?.border||"#d9d9d9"}`},xt={display:"flex",justifyContent:"flex-end",gap:"8px",flexShrink:0},Et={background:"transparent",color:r?.layout?.textColor||"#000000",border:`1px solid ${r?.toolbar?.border||"#d9d9d9"}`,borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},yt={background:r?.toolbar?.button?.active||"#2962FF",color:r?.toolbar?.button?.activeTextColor||"#ffffff",border:"none",borderRadius:"4px",padding:"6px 12px",fontSize:"12px",cursor:"pointer"},Rt={fontSize:"10px",color:`${r?.layout?.textColor||"#000000"}80`,marginTop:"8px",textAlign:"center",flexShrink:0},jt={position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:9999,background:"transparent"};if(!f||!o)return null;const z=et(s);return ge.createPortal(m.jsxs(y.Fragment,{children:[m.jsx("style",{children:O}),m.jsx("div",{style:jt,onClick:at,children:m.jsxs("div",{ref:M,style:Z,onClick:H=>H.stopPropagation(),onMouseDown:L,onKeyDown:$,children:[m.jsx("div",{ref:k,style:lt,onMouseDown:H=>{H.target===k.current&&H.preventDefault()},children:m.jsxs("div",{style:ut,children:[P()," ",n.systemSettings?.setting||"设置"]})}),m.jsxs("div",{style:x,children:[m.jsx("div",{style:j,className:"subchart-scrollbar",children:o.map((H,Q)=>m.jsxs("div",{style:nt,children:[m.jsx("div",{style:ct,children:H.paramName}),m.jsx("input",{type:"text",style:it,value:H.paramName,onChange:tt=>C(Q,tt.target.value),onClick:tt=>tt.stopPropagation(),placeholder:n.modal?.parameterName||"参数名"}),m.jsx("input",{type:"number",style:it,value:H.paramValue,onChange:tt=>v(Q,Number(tt.target.value)),onClick:tt=>tt.stopPropagation(),min:"1",max:"100",placeholder:n.modal?.parameterValue||"数值"}),m.jsxs("select",{style:B,value:H.lineWidth,onChange:tt=>R(Q,Number(tt.target.value)),onClick:tt=>tt.stopPropagation(),children:[m.jsx("option",{value:1,children:"1px"}),m.jsx("option",{value:2,children:"2px"}),m.jsx("option",{value:3,children:"3px"}),m.jsx("option",{value:4,children:"4px"}),m.jsx("option",{value:5,children:"5px"})]}),m.jsxs("div",{style:q,children:[m.jsx("div",{style:{...st,backgroundColor:H.lineColor},onClick:tt=>{tt.currentTarget.nextSibling?.click()}}),m.jsx("input",{type:"color",style:ht,value:H.lineColor,onChange:tt=>A(Q,tt.target.value),onClick:tt=>tt.stopPropagation()})]}),z.allowDelete&&m.jsx("button",{onClick:()=>_(Q),style:o.length<=z.minParams?ft:gt,disabled:o.length<=z.minParams,type:"button",title:o.length<=z.minParams?`${n.modal?.keepAtLeastOne||"至少保留"}${z.minParams}${n.modal?.parameterName||"个参数"}`:n.modal?.deleteParameter||"删除",children:"×"})]},`${H.paramName}-${Q}`))}),m.jsx("button",{onClick:S,style:o.length>=z.maxParams||!z.allowAdd?kt:Tt,disabled:o.length>=z.maxParams||!z.allowAdd,type:"button",title:o.length>=z.maxParams?`${n.modal?.maximumParameters||"最多允许"}${z.maxParams}${n.modal?.parameterName||"个参数"}`:z.allowAdd?n.modal?.addParameter||"添加参数":n.modal?.keepAtLeastOne||"不允许添加参数",children:o.length>=z.maxParams?`${n.modal?.maximumParameters||"已达到最大参数数量"}(${z.maxParams}${n.modal?.parameterName||"个"})`:z.allowAdd?`+ ${n.modal?.addParameter||"添加参数"}`:n.modal?.keepAtLeastOne||"不允许添加参数"}),m.jsxs("div",{style:xt,children:[m.jsx("button",{onClick:N,style:Et,type:"button",children:n.systemSettings?.cancel||"取消"}),m.jsx("button",{onClick:I,style:yt,type:"button",children:n.systemSettings?.confirm||"确定"})]}),m.jsxs("div",{style:Rt,children:[n.tooltips?.ctrlEnterToConfirm||"Ctrl+Enter: 确认",", ",n.tooltips?.escToCancel||"Esc: 取消",", ",n.modal?.dragToMove||"拖动标题栏移动"]})]})]})})]}),document.body)};class Fi{constructor(t){this.volumeSeries=null,this.refreshData=e=>{if(!this.volumeSeries)return;const i=e.props.chartData.map(r=>r.isVirtual?{time:r.time,value:r.volume,color:"rgba(0, 0, 0, 0)"}:{time:r.time,value:r.volume,color:r.close>=r.open?"rgba(38, 166, 154, 0.8)":"rgba(239, 83, 80, 0.8)"});i.length>0&&this.volumeSeries&&setTimeout(()=>{this.volumeSeries.setData(i)},0)},this.volumeSeries=t.props.chart.addSeries(rt.HistogramSeries,{priceScaleId:"volume_bottom",color:"#26a69a"}),t.props.chart.priceScale("volume_bottom").applyOptions({scaleMargins:{top:.9,bottom:0}})}destroy(t){if(this.volumeSeries&&t.props.chart){try{t.props.chart.removeSeries(this.volumeSeries)}catch{}this.volumeSeries=null}}}class Ei{constructor(t,e){this.candleSeries=null,this.refreshData=r=>{if(!this.candleSeries)return;const a=this.transformToCandlestickData(r.props.chartData);a.length>0&&setTimeout(()=>{this.candleSeries.setData(a)},0)},this.updateStyle=r=>{this.candleSeries&&this.candleSeries.applyOptions(r)},this.destroy=r=>{if(!this.candleSeries)return;if(!r||!r.props||!r.props.chart){this.candleSeries=null;return}const a=this.candleSeries;this.candleSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.candleSeries=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToCandlestickData(t.props.chartData);i.length>0&&this.candleSeries&&setTimeout(()=>{this.candleSeries.setData(i)},0)}transformToCandlestickData(t){return t.map(e=>e.isVirtual?{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)"}:{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close})}getSeries(){return this.candleSeries}}class Fo{constructor(t,e){this.barSeries=null,this.theme=null,this.refreshData=r=>{if(!this.barSeries)return;const a=this.transformToBarData(r.props.chartData);a.length>0&&setTimeout(()=>{this.barSeries.setData(a)},0)},this.updateStyle=r=>{this.barSeries&&this.barSeries.applyOptions(r)},this.destroy=r=>{if(!this.barSeries)return;if(!r||!r.props||!r.props.chart){this.barSeries=null;return}const a=this.barSeries;this.barSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.barSeries=t.props.chart.addSeries(rt.BarSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",thinBars:!0,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBarData(t.props.chartData);i.length>0&&this.barSeries&&setTimeout(()=>{this.barSeries.setData(i)},0)}transformToBarData(t){return t.map(e=>{const i={time:e.time,open:Number(e.open),high:Number(e.high),low:Number(e.low),close:Number(e.close)};return e.isVirtual?{...i,color:"transparent",borderColor:"transparent"}:i})}getSeries(){return this.barSeries}}class Eo{constructor(t,e){this.lineSeries=null,this._lineWidht=2,this.refreshData=r=>{if(!this.lineSeries)return;const a=this.transformToLineData(r.props.chartData);a.length>0&&setTimeout(()=>{this.lineSeries.setData(a)},0)},this.updateStyle=r=>{this.lineSeries&&this.lineSeries.applyOptions(r)},this.destroy=r=>{if(!this.lineSeries)return;if(!r||!r.props||!r.props.chart){this.lineSeries=null;return}const a=this.lineSeries;this.lineSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.lineSeries=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidht,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToLineData(t.props.chartData);i.length>0&&this.lineSeries&&setTimeout(()=>{this.lineSeries.setData(i)},0)}transformToLineData(t){return t.filter(e=>!e.isVirtual).map(e=>({time:e.time,value:e.close}))}getSeries(){return this.lineSeries}}class yo{constructor(t,e){this.areaSeries=null,this.theme=null,this.refreshData=r=>{if(!this.areaSeries)return;const a=this.transformToAreaData(r.props.chartData);a.length>0&&setTimeout(()=>{this.areaSeries.setData(a)},0)},this.updateStyle=r=>{this.areaSeries&&this.areaSeries.applyOptions(r)},this.destroy=r=>{if(!this.areaSeries)return;if(!r||!r.props||!r.props.chart){this.areaSeries=null;return}const a=this.areaSeries;this.areaSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.areaSeries=t.props.chart.addSeries(rt.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToAreaData(t.props.chartData);i.length>0&&this.areaSeries&&setTimeout(()=>{this.areaSeries.setData(i)},0)}transformToAreaData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent",lineColor:"transparent",topColor:"transparent",bottomColor:"transparent"}:i})}getSeries(){return this.areaSeries}}class Ro{constructor(t,e){this.stepLineSeries=null,this.refreshData=r=>{if(!this.stepLineSeries)return;const a=this.transformToStepLineData(r.props.chartData);a.length>0&&setTimeout(()=>{this.stepLineSeries.setData(a)},0)},this.updateStyle=r=>{if(this.stepLineSeries){const a={...r,lineType:1};this.stepLineSeries.applyOptions(a)}},this.destroy=r=>{if(!this.stepLineSeries)return;if(!r||!r.props||!r.props.chart){this.stepLineSeries=null;return}const a=this.stepLineSeries;this.stepLineSeries=null;try{r.props.chart.removeSeries(a)}catch{}},this.stepLineSeries=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.stepLineColor||"#9C27B0",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.stepLineSeries.applyOptions({lineType:1}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToStepLineData(t.props.chartData);i.length>0&&this.stepLineSeries&&setTimeout(()=>{this.stepLineSeries.setData(i)},0)}transformToStepLineData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:i})}getSeries(){return this.stepLineSeries}}class Bo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.filter(o=>!o.isVirtual),s=a.length>0?a.reduce((o,l)=>o+l.close,0)/a.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const n=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,a)=>r+a.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Uo{constructor(t,e){this.series=null,this.theme=null,this.refreshData=r=>{if(!this.series)return;const a=this.transformToHistogramData(r.props.chartData);a.length>0&&setTimeout(()=>{this.series.setData(a)},0)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.HistogramSeries,{color:e.chart.histogramColor||"#4CAF50",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.theme=e,t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHistogramData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHistogramData(t){return t.map(e=>{const i={time:e.time,value:e.close};return e.isVirtual?{...i,color:"transparent"}:{...i,color:e.close>=(e.open||0)?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.series}}class Io{constructor(t,e){this.series=null,this.theme=null,this.refreshData=r=>{if(!this.series)return;const a=this.transformToHollowCandlestickData(r.props.chartData);a.length>0&&setTimeout(()=>{this.series.setData(a)},0)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:"transparent",downColor:"transparent",borderUpColor:e.chart.candleUpColor||"#26a69a",borderDownColor:e.chart.candleDownColor||"#ef5350",wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHollowCandlestickData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHollowCandlestickData(t){return t.map(e=>{const i=e.close>e.open,r={time:e.time,open:e.open,high:e.high,low:e.low,close:e.close};return e.isVirtual?{...r,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:{...r,borderColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor,wickColor:i?this.theme?.chart.candleUpColor:this.theme?.chart.candleDownColor}})}getSeries(){return this.series}}class Lo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=this.transformToHeikinAshiData(r.props.chartData);a.length>0&&setTimeout(()=>{this.series.setData(a)},0)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:e.chart.candleUpColor||"#26a69a",wickDownColor:e.chart.candleDownColor||"#ef5350",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHeikinAshiData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHeikinAshiData(t){if(t.length===0)return[];const e=[];let i=null;for(let r=0;r<t.length;r++){const a=t[r];if(a.isVirtual){e.push({time:a.time,open:a.open,high:a.high,low:a.low,close:a.close,color:"rgba(0, 0, 0, 0)"});continue}let s,n,o,l;i===null?(s=(a.open+a.close)/2,l=(a.open+a.high+a.low+a.close)/4,n=a.high,o=a.low):(s=(i.open+i.close)/2,l=(a.open+a.high+a.low+a.close)/4,n=Math.max(a.high,s,l),o=Math.min(a.low,s,l));const h={time:a.time,open:s,high:n,low:o,close:l};e.push(h),i={open:s,close:l}}return e}getSeries(){return this.series}}class Ho{constructor(t,e){this.series=null,this.lineCount=3,this.globalChartData=[],this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,color:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.globalChartData=t.props.chartData;const i=this.generateLineBreakData(this.globalChartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}generateLineBreakData(t){if(t.length===0)return[];const e=[];let i=[];for(let r=0;r<t.length;r++){const a=t[r].close;if(e.length===0){e.push({time:t[r].time,value:a}),i.push(a);continue}(a>Math.max(...i)||a<Math.min(...i))&&(e.push({time:t[r].time,value:a}),i.push(a),i.length>this.lineCount&&i.shift())}return e}getSeries(){return this.series}setLineCount(t){this.lineCount=t}}class Ko{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.map(s=>s.isVirtual?{time:s.time,value:s.close,lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}:{time:s.time,value:s.close});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.AreaSeries,{topColor:e.chart.areaTopColor||"rgba(33, 150, 243, 0.4)",bottomColor:e.chart.areaBottomColor||"rgba(33, 150, 243, 0)",lineColor:e.chart.areaLineColor||"#2196F3",lineWidth:2,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToMountainData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToMountainData(t){return t.map(e=>({time:e.time,value:e.close,...e.isVirtual&&{lineColor:"rgba(0, 0, 0, 0)",topColor:"rgba(0, 0, 0, 0)",bottomColor:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class Oo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.map(s=>{if(s.isVirtual)return{time:s.time,open:s.open,high:s.high,low:s.low,close:s.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const n=s.close>=s.open,o=n?s.close:s.open,l=n?s.open:s.close;return{time:s.time,open:l,high:s.high,low:s.low,close:o,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}});a.length>0&&this.series.setData(a)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.CandlestickSeries,{upColor:e.chart.candleUpColor||"#26a69a",downColor:e.chart.candleDownColor||"#ef5350",borderVisible:!1,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToHighLowData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToHighLowData(t){return t.map(e=>{if(e.isVirtual)return{time:e.time,open:e.open,high:e.high,low:e.low,close:e.close,color:"rgba(0, 0, 0, 0)",wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderColor:"rgba(0, 0, 0, 0)"};{const i=e.close>=e.open,r=i?e.close:e.open,a=i?e.open:e.close;return{time:e.time,open:a,high:e.high,low:e.low,close:r,wickUpColor:"rgba(0, 0, 0, 0)",wickDownColor:"rgba(0, 0, 0, 0)",borderVisible:!1}}})}getSeries(){return this.series}}class jo{constructor(t,e){this.series=null,this._chart=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this.channelWidthPercent=.3,this._timeScale=null,this._lineWidth=2,this.refreshData=r=>{if(!this.series)return;this._chartData=r.props.chartData||[];const a=this.transformToBaselineData(r.props.chartData);a.length>0&&this.series.setData(a),this.requestUpdate()},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this._chartData=t.props.chartData||[],this._chart=t.props.chart,this._timeScale=this._chart.timeScale(),this.series=t.props.chart.addSeries(rt.LineSeries,{color:e.chart.lineColor||"#2196F3",lineWidth:this._lineWidth,priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),this.attachChannelRenderer(t),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i),this.requestUpdate()},0)}attachChannelRenderer(t){t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0)}transformToBaselineData(t){return t.filter(i=>!i.isVirtual).map(i=>({time:i.time,value:i.close}))}attached(t){this._chart=t.chart,this.requestUpdate()}updateAllViews(){this.requestUpdate()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&this.drawChannel(e)}}),[{renderer:()=>this._renderer}]}drawChannel(t){if(!this.series||!this._timeScale)return;const e=this._timeScale.getVisibleRange();if(!e)return;const i=this._chartData.filter(o=>!o.isVirtual&&o.time>=e.from&&o.time<=e.to);if(i.length<2)return;const r=i.map(o=>o.close),a=5,s=[];for(let o=0;o<r.length;o++){const l=Math.max(0,o-a+1),h=o+1,d=r.slice(l,h);s.push(d.reduce((g,c)=>g+c,0)/d.length)}const n=(Math.max(...s)-Math.min(...s))*this.channelWidthPercent;this.drawChannelLines(t,i,n)}drawChannelLines(t,e,i){t.save(),t.beginPath(),t.strokeStyle="#26a69a",t.lineWidth=this._lineWidth,t.setLineDash([]);let r=!0;for(const s of e){const n=this._timeScale.timeToCoordinate(s.time),o=s.close+i,l=this.series.priceToCoordinate(o);n===null||l===null||(r?(t.moveTo(n,l),r=!1):t.lineTo(n,l))}t.stroke(),t.restore(),t.save(),t.beginPath(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.lineWidth=this._lineWidth,t.setLineDash([]);let a=!0;for(const s of e){const n=this._timeScale.timeToCoordinate(s.time),o=s.close-i,l=this.series.priceToCoordinate(o);n===null||l===null||(a?(t.moveTo(n,l),a=!1):t.lineTo(n,l))}t.stroke(),t.restore(),this.drawChannelFill(t,e,i)}drawChannelFill(t,e,i){if(!(e.length<2)){t.save(),t.beginPath();for(let r=0;r<e.length;r++){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=a.close+i,o=this.series.priceToCoordinate(n);s===null||o===null||(r===0?t.moveTo(s,o):t.lineTo(s,o))}for(let r=e.length-1;r>=0;r--){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=this.series.priceToCoordinate(a.close);s===null||n===null||t.lineTo(s,n)}t.closePath(),t.fillStyle="rgba(38, 166, 154, 0.3)",t.fill(),t.restore(),t.save(),t.beginPath();for(let r=0;r<e.length;r++){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=this.series.priceToCoordinate(a.close);s===null||n===null||(r===0?t.moveTo(s,n):t.lineTo(s,n))}for(let r=e.length-1;r>=0;r--){const a=e[r],s=this._timeScale.timeToCoordinate(a.time),n=a.close-i,o=this.series.priceToCoordinate(n);s===null||o===null||t.lineTo(s,o)}t.closePath(),t.fillStyle="rgba(239, 83, 80, 0.3)",t.fill(),t.restore()}}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate()}catch{}}getSeries(){return this.series}setChannelWidth(t){this.channelWidthPercent=Math.max(.01,Math.min(1,t)),this.requestUpdate()}getChannelWidth(){return this.channelWidthPercent}}class Wo{constructor(t,e){this.series=null,this.refreshData=r=>{if(!this.series)return;const a=r.props.chartData.filter(o=>!o.isVirtual),s=a.length>0?a.reduce((o,l)=>o+l.close,0)/a.length:0;this.series.applyOptions({baseValue:{type:"price",price:s}});const n=r.props.chartData.map(o=>o.isVirtual?{time:o.time,value:o.close,topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}:{time:o.time,value:o.close});n.length>0&&this.series.setData(n)},this.updateStyle=r=>{this.series&&this.series.applyOptions(r)},this.destroy=r=>{if(!this.series)return;if(!r||!r.props||!r.props.chart){this.series=null;return}const a=this.series;this.series=null;try{r.props.chart.removeSeries(a)}catch{}},this.series=t.props.chart.addSeries(rt.BaselineSeries,{baseValue:{type:"price",price:0},topLineColor:e.chart.candleUpColor||"#26a69a",topFillColor1:"rgba(38, 166, 154, 0.28)",topFillColor2:"rgba(38, 166, 154, 0.05)",bottomLineColor:e.chart.candleDownColor||"#ef5350",bottomFillColor1:"rgba(239, 83, 80, 0.05)",bottomFillColor2:"rgba(239, 83, 80, 0.28)",priceLineVisible:!0,lastValueVisible:!0,priceFormat:{type:"price",precision:2,minMove:.01}}),t.props.chart.priceScale("right").applyOptions({scaleMargins:{top:.05,bottom:.1}});const i=this.transformToBaselineData(t.props.chartData);i.length>0&&this.series&&setTimeout(()=>{this.series.setData(i)},0)}transformToBaselineData(t){const e=t.filter(r=>!r.isVirtual),i=e.length>0?e.reduce((r,a)=>r+a.close,0)/e.length:0;return this.series&&this.series.applyOptions({baseValue:{type:"price",price:i}}),t.map(r=>({time:r.time,value:r.close,...r.isVirtual&&{topLineColor:"rgba(0, 0, 0, 0)",topFillColor1:"rgba(0, 0, 0, 0)",topFillColor2:"rgba(0, 0, 0, 0)",bottomLineColor:"rgba(0, 0, 0, 0)",bottomFillColor1:"rgba(0, 0, 0, 0)",bottomFillColor2:"rgba(0, 0, 0, 0)"}}))}getSeries(){return this.series}}class No{constructor(t,e){this.currentChart=null,this.currentType=null,this.chartLayer=t,this.theme=e}switchChartType(t){if(!(this.currentType===t&&this.currentChart))switch(this.destroyCurrentChart(),this.currentType=t,t){case G.Candle:this.currentChart=new Ei(this.chartLayer,this.theme);break;case G.HollowCandle:this.currentChart=new Io(this.chartLayer,this.theme);break;case G.Bar:this.currentChart=new Fo(this.chartLayer,this.theme);break;case G.Line:this.currentChart=new Eo(this.chartLayer,this.theme);break;case G.Area:this.currentChart=new yo(this.chartLayer,this.theme);break;case G.StepLine:this.currentChart=new Ro(this.chartLayer,this.theme);break;case G.BaseLine:this.currentChart=new Bo(this.chartLayer,this.theme);break;case G.Histogram:this.currentChart=new Uo(this.chartLayer,this.theme);break;case G.HeikinAshi:this.currentChart=new Lo(this.chartLayer,this.theme);break;case G.LineBreak:this.currentChart=new Ho(this.chartLayer,this.theme);break;case G.Mountain:this.currentChart=new Ko(this.chartLayer,this.theme);break;case G.BaselineArea:this.currentChart=new Wo(this.chartLayer,this.theme);break;case G.HighLow:this.currentChart=new Oo(this.chartLayer,this.theme);break;case G.HLCArea:this.currentChart=new jo(this.chartLayer,this.theme);break;default:console.warn(`Unknown chart type: ${t}`),this.currentChart=new Ei(this.chartLayer,this.theme);break}}refreshData(){this.currentChart&&this.currentChart.refreshData(this.chartLayer)}updateStyle(t){this.currentChart&&this.currentChart.updateStyle(t)}getCurrentSeries(){return this.currentChart?this.currentChart.getSeries():null}getCurrentType(){return this.currentType}destroyCurrentChart(){this.currentChart&&(this.currentChart.destroy(this.chartLayer),this.currentChart=null)}destroy(){this.destroyCurrentChart(),this.currentType=null}}class Xo{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._menu=null,this._heatMapRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=a=>{this._chartData=a.props.chartData||[],this.requestUpdate()},this._closeCallBack=r,this.initializeHeatMap(t,e,i)}initializeHeatMap(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInHeatMapArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateHeatMapRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInHeatMapArea(t,e){return this.updateHeatMapRect(),t>=this._heatMapRect.x&&t<=this._heatMapRect.x+this._heatMapRect.width&&e>=this._heatMapRect.y&&e<=this._heatMapRect.y+this._heatMapRect.height}updateHeatMapRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*.25,r=e.width-i;this._heatMapRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateHeatMapRect(),0)}updateAllViews(){this.requestUpdate(),this.updateHeatMapRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawHeatMap(e),this.updateHeatMapRect())}}),[{renderer:()=>this._renderer}]}drawHeatMap(t){const e=this._chartData;if(!e||e.length===0)return;const i=e.filter(u=>!u.isVirtual&&u.volume);if(i.length===0)return;const r=Math.min(...i.map(u=>u.low)),s=Math.max(...i.map(u=>u.high))-r;if(s<=0)return;const n=this._width*.25,o=this._width-n,l=Math.min(200,Math.floor(this._height/2)),h=new Array(l).fill(0);i.forEach(u=>{const p=Math.min(l-1,Math.max(0,Math.floor((u.high-r)/s*l))),M=Math.min(l-1,Math.max(0,Math.floor((u.low-r)/s*l))),k=Math.max(1,p-M+1),P=u.volume/k;for(let S=M;S<=p;S++)h[S]+=P});const d=Math.max(...h);if(d===0)return;const g=2,c=this._height/l;t.save();for(let u=0;u<l;u++){const p=h[u];if(p===0)continue;const M=p/d,P=Math.max(M,.01),S=Math.max(g,n*P),_=Math.pow(P,.5);let C,v,A;if(_<.5){const L=_*2;C=Math.floor(0),v=Math.floor(165*L),A=Math.floor(255*(1-L)+255*L)}else{const L=(_-.5)*2;C=Math.floor(255*L),v=Math.floor(255*(1-L)),A=Math.floor(255*(1-L))}const R=.4+_*.6,U=`rgba(${C}, ${v}, ${A}, ${R})`,I=o+(n-S),N=this._height-(u+1)*c;t.fillStyle=U,t.fillRect(I,N,S,c)}t.restore()}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class Yo{constructor(t,e,i,r){this._chart=null,this._series=null,this._renderer=null,this._chartData=[],this._width=0,this._height=0,this._isAttached=!1,this._cachedProfile=null,this._lastDataHash="",this._widthProportion=.35,this._menu=null,this._profileRect={x:0,y:0,width:0,height:0},this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this.refreshData=a=>{this._chartData=a.props.chartData||[],this._cachedProfile=null,this.requestUpdate()},this._closeCallBack=r,this._config={profileWidth:.15,timeSlotMinutes:30,valueAreaPercent:.7,tickSize:.01,showInitialBalance:!0,showValueArea:!0,maxPriceLevels:80,simplifyTPO:!0},this.initializeMarketProfile(t,e,i)}initializeMarketProfile(t,e,i){this._chartData=t.props.chartData||[],this._i18n=e,this._theme=i,t.props.chartSeries&&t.props.chartSeries.series&&(this.attached({chart:t.props.chart,series:t.props.chartSeries.series}),t.props.chartSeries.series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(t.props.chart))}bindContextMenu(t){const e=t.chartElement();e&&(this._contextMenuHandler=i=>{this.isInProfileArea(i.offsetX,i.offsetY)&&(i.preventDefault(),this.showContextMenu(i.clientX,i.clientY))},this._clickHandler=i=>{this._menu&&!this._menu.contains(i.target)&&this.hideContextMenu()},this._resizeHandler=()=>this.updateProfileRect(),e.addEventListener("contextmenu",this._contextMenuHandler),document.addEventListener("click",this._clickHandler),window.addEventListener("resize",this._resizeHandler))}isInProfileArea(t,e){return this.updateProfileRect(),t>=this._profileRect.x&&t<=this._profileRect.x+this._profileRect.width&&e>=this._profileRect.y&&e<=this._profileRect.y+this._profileRect.height}updateProfileRect(){if(!this._chart)return;const t=this._chart.chartElement();if(!t)return;const e=t.getBoundingClientRect(),i=e.width*this._widthProportion,r=0;this._profileRect={x:r,y:0,width:i,height:e.height-29}}showContextMenu(t,e){this.hideContextMenu(),this._menu=document.createElement("div"),this._menu.style.position="fixed",this._menu.style.left=`${t}px`,this._menu.style.top=`${e}px`,this._menu.style.background=this._theme?.panel.backgroundColor||"#FFFFFF",this._menu.style.border=`1px solid ${this._theme?.panel.borderColor||"#E1E5E9"}`,this._menu.style.borderRadius="4px",this._menu.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)",this._menu.style.zIndex="1000",this._menu.style.padding="4px 0",this._menu.style.minWidth="120px",this._menu.style.fontFamily="Arial, sans-serif",this._menu.style.fontSize="14px";const i=document.createElement("button");i.textContent=this._i18n?.close||"Close",i.style.background="none",i.style.border="none",i.style.padding="6px 12px",i.style.width="100%",i.style.textAlign="left",i.style.cursor="pointer",i.style.color=this._theme?.modal.textColor||"#2D323D",i.style.transition="background-color 0.2s",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=this._theme?.toolbar.button.hover||"#2D323D"}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="transparent"}),i.addEventListener("click",()=>{this.destroy(),this.hideContextMenu()}),this._menu.appendChild(i),document.body.appendChild(this._menu)}hideContextMenu(){this._menu&&(document.body.removeChild(this._menu),this._menu=null)}attached(t){this._chart=t.chart,this._series=t.series,this.requestUpdate(),setTimeout(()=>this.updateProfileRect(),0)}updateAllViews(){this.requestUpdate(),this.updateProfileRect()}time(){return this._chartData.length>0?this._chartData[0].time:0}priceValue(){return this._chartData.length>0?this._chartData[0].close:0}updateI18n(t){this._i18n=t}updateTheme(t){this._theme=t}paneViews(){return this._renderer||(this._renderer={draw:t=>{const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement();if(!i)return;const r=i.getBoundingClientRect();this._width=r.width,this._height=r.height-29,!(this._width<=0||this._height<=0)&&(this.drawMarketProfile(e),this.updateProfileRect())}}),[{renderer:()=>this._renderer}]}drawMarketProfile(t){const e=this._chartData;if(!e||e.length===0)return;const i=this.getDataHash(e);if((!this._cachedProfile||this._lastDataHash!==i)&&(this._cachedProfile=this.calculateProfile(e),this._lastDataHash=i),!this._cachedProfile)return;const r=this._width*this._widthProportion;t.clearRect(0,0,r,this._height),this.drawProfileBars(t,this._cachedProfile,r),this._config.showValueArea&&this.drawValueArea(t,this._cachedProfile,r)}getDataHash(t){return t.length===0?"empty":`${t.length}_${t[0].time}_${t[t.length-1].time}`}calculateProfile(t){if(t.length===0)return null;const e=t.filter(g=>!g.isVirtual);if(e.length===0)return null;const i=Math.min(...e.map(g=>g.low)),r=Math.max(...e.map(g=>g.high)),a=r-i;if(a<=0)return null;const s=Math.min(this._config.maxPriceLevels,Math.floor(this._height/3)),n=a/s,o=[];for(let g=0;g<=s;g++)o.push({price:i+g*n,count:0,volume:0});e.forEach(g=>{const c=this.findPriceLevel(o,g.high),u=this.findPriceLevel(o,g.low);for(let p=u;p<=c;p++)o[p].count++,o[p].volume+=g.volume||0});const l=Math.max(...o.map(g=>g.count)),h=o.find(g=>g.count===l),d=this.calculateSimpleValueArea(o,this._config.valueAreaPercent);return{levels:o,minPrice:i,maxPrice:r,priceRange:a,poc:h?h.price:i+a/2,valueAreaHigh:d.high,valueAreaLow:d.low,maxCount:l}}findPriceLevel(t,e){const i=t[0].price,r=t[t.length-1].price,a=r-i;return e<=i?0:e>=r?t.length-1:Math.min(t.length-1,Math.max(0,Math.floor((e-i)/a*t.length)))}calculateSimpleValueArea(t,e){const r=t.reduce((h,d)=>h+d.count,0)*e,a=Math.max(...t.map(h=>h.count)),s=t.findIndex(h=>h.count===a);let n=0,o=s,l=s;for(;n<r&&(o<t.length-1||l>0);){let h=o<t.length-1?t[o+1].count:0,d=l>0?t[l-1].count:0;if(h>=d&&o<t.length-1)o++,n+=t[o].count;else if(l>0)l--,n+=t[l].count;else break}return{high:t[o].price,low:t[l].price}}drawProfileBars(t,e,i){const{levels:r,minPrice:a,maxPrice:s,priceRange:n,maxCount:o}=e;if(n<=0)return;t.save();const l=i,h=this._height/r.length;r.forEach(d=>{if(d.count===0)return;const g=(d.price-a)/n,c=this._height-g*this._height,u=d.count/o,p=h,M=this.getProfileColor(u);t.fillStyle=M;const k=Math.max(2,l*u*.8);t.fillRect(0,c-p/2,k,p)}),t.restore()}drawValueArea(t,e,i){const{valueAreaHigh:r,valueAreaLow:a,minPrice:s,maxPrice:n,priceRange:o,poc:l}=e;if(o<=0)return;const h=(r-s)/o,d=(a-s)/o,g=(l-s)/o,c=this._height-h*this._height,u=this._height-d*this._height,p=this._height-g*this._height;t.save(),t.fillStyle="rgba(255, 215, 0, 0.1)",t.fillRect(0,c,i,u-c),t.strokeStyle="rgba(255, 215, 0, 0.6)",t.lineWidth=1,t.setLineDash([3,2]),t.beginPath(),t.moveTo(0,c),t.lineTo(i,c),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.strokeStyle="rgba(255, 0, 0, 0.8)",t.setLineDash([]),t.lineWidth=1,t.beginPath(),t.moveTo(0,p),t.lineTo(i,p),t.stroke(),t.restore()}getProfileColor(t){return t<.3?"rgba(100, 150, 255, 0.4)":t<.6?"rgba(50, 100, 200, 0.6)":"rgba(0, 50, 150, 0.8)"}requestUpdate(){if(this._chart&&this._isAttached)try{this._chart._internal__paneUpdate&&this._chart._internal__paneUpdate(),this._series&&this._series._internal__dataChanged&&this._series._internal__dataChanged()}catch{}}destroy(){const t=this._chart?.chartElement();if(t&&this._contextMenuHandler&&t.removeEventListener("contextmenu",this._contextMenuHandler),this._clickHandler&&document.removeEventListener("click",this._clickHandler),this._resizeHandler&&window.removeEventListener("resize",this._resizeHandler),this._series&&this._isAttached)try{this._series.detachPrimitive(this),this._isAttached=!1}catch{}this.hideContextMenu(),this._renderer=null,this._isAttached=!1,this._menu=null,this._contextMenuHandler=null,this._clickHandler=null,this._resizeHandler=null,this._closeCallBack?.()}reactivate(){if(this._chart&&this._series&&!this._isAttached)try{this._series.attachPrimitive(this),this._isAttached=!0,this.bindContextMenu(this._chart),this.requestUpdate()}catch{}}}class Vo extends y.Component{constructor(t){super(t),this.canvasRef=y.createRef(),this.containerRef=y.createRef(),this.allDrawings=[],this.doubleClickTimeout=null,this.chartEventManager=null,this.originalChartOptions=null,this.currentMarkSettingsStyle=null,this.chartMarkManager=null,this.chartMarkTextEditManager=null,this.mainChartTechnicalIndicatorManager=null,this.staticMarkManager=null,this.volume=null,this.volumeHeatMap=null,this.marketProfile=null,this.mainChartManager=null,this.executeEventMarksScriptForChartData=()=>{const{chartData:e}=this.props,{isIncrement:i}=this.state;if(!i||!e||!Array.isArray(e)||e.length===0)return;const r=e.filter(s=>s&&s.isVirtual===!1);if(r.length===0)return;r.slice(-1).forEach(s=>{if(!s)return;const{open:n,high:o,low:l,close:h,time:d}=s;h!==void 0&&this.chartMarkManager?.priceEventMarkManager?.executeScriptAtPrice(n,o,l,h),d!==void 0&&this.chartMarkManager?.timeEventMarkManager?.executeScriptAtTime(d)})},this.swtichMainChartType=()=>{this.mainChartManager?.switchChartType(this.props.currentMainChartType),this.mainChartManager?.refreshData(),this.updateStaticMark()},this.setCursorType=e=>{e&&this.setState({cursorType:e})},this.initializeMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager)return;const{selectedMainChartIndicator:e}=this.props;e&&this.updateSelectedMainChartIndicators()},this.updateAllMainChartIndicatorData=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&this.mainChartTechnicalIndicatorManager?.updateAllMainChartIndicatorData(this,i)})},this.updateMainChartIndicators=()=>{const{selectedMainChartIndicators:e}=this.state;e.forEach(i=>{i.type!==null&&(this.mainChartTechnicalIndicatorManager?.removeIndicator(this.props.chart,i.type),this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,i))})},this.updateSelectedMainChartIndicators=()=>{if(!this.mainChartTechnicalIndicatorManager||!this.props.chartData)return;const{selectedMainChartIndicator:e}=this.props;e&&(D.HEATMAP===e.type||D.MARKETPROFILE===e.type||this.setState(i=>{const r=i.selectedMainChartIndicators.some(o=>o.type===e.type);let a;r?a=i.selectedMainChartIndicators.map(o=>o.type===e.type?e:o):a=[...i.selectedMainChartIndicators,e];const s=a.map(o=>o.type).filter(o=>o!==null),n=Yt().map(o=>{if(o.type&&s.includes(o.type)){const l=a.find(h=>h.type===o.type);return{...o,visible:!0,params:l?.params||o.params}}return{...o,visible:!1}});return{selectedMainChartIndicators:a,selectedMainChartIndicatorTypes:s,modalConfirmChartInfoIndicators:n}},()=>{this.updateMainChartIndicators()}))},this.handleOpenIndicatorSettings=e=>{e.type&&this.setState({modalEditingChartInfoIndicator:e,isMainChartIndicatorsModalOpen:!0})},this.handleMainChartIndicatorsSettingConfirm=e=>{e.params&&(e.params=e.params.filter(i=>i.paramValue!==0));try{this.mainChartTechnicalIndicatorManager?.updateMainChartIndicator(this,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.map(r=>r.type===e.type?e:r)})),this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}catch{this.setState({isMainChartIndicatorsModalOpen:!1,modalEditingChartInfoIndicator:null})}},this.handleRemoveIndicator=e=>{if(!(!e||!this.mainChartTechnicalIndicatorManager||!this.props.chart)){if(e===D.HEATMAP){setTimeout(()=>{this.volumeHeatMap&&(this.volumeHeatMap.destroy(),this.volumeHeatMap=null)},0);return}if(e===D.MARKETPROFILE){setTimeout(()=>{this.marketProfile&&(this.marketProfile.destroy(),this.marketProfile=null)},0);return}this.mainChartTechnicalIndicatorManager.removeIndicator(this.props.chart,e),this.setState(i=>({selectedMainChartIndicators:i.selectedMainChartIndicators.filter(r=>r.type!==e),selectedMainChartIndicatorTypes:i.selectedMainChartIndicatorTypes.filter(r=>r!==e)})),this.props.onMainChartIndicatorChange&&this.props.selectedMainChartIndicator?.type===e&&this.props.onMainChartIndicatorChange(null),this.props.onToolSelect&&this.props.selectedMainChartIndicator?.type===e&&this.props.onToolSelect("")}},this.setPriceEventMode=()=>{this.chartMarkManager?.setPriceEventMode(this)},this.setTimeEventMode=()=>{this.chartMarkManager?.setTimeEventMode(this)},this.setMockKLineMarkMode=()=>{this.chartMarkManager?.setMockKLineMarkMode(this)},this.initializeGraphManager=()=>{this.chartMarkManager?.initializeMarkManager(this)},this.initializeGraphManagerProps=()=>{this.chartMarkManager?.initializeMarkManagerProps(this)},this.destroyGraphManager=()=>{this.chartMarkManager?.destroyMarkManager()},this.setTimeEventScriptById=(e,i)=>{this.chartMarkManager?.timeEventMarkManager?.setScriptById(e,i)},this.setPriceEventScriptById=(e,i)=>{this.chartMarkManager?.priceEventMarkManager?.setScriptById(e,i)},this.showAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.showAllMarks()},this.hideAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.hideAllMarks()},this.clearAllMark=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.deleteAllMark()},this.setSchiffPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSchiffPitchforkMode(this)},this.setHeatMapMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeatMapMode(this)},this.setTextEditMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTextEditMarkMode(this)},this.setBubbleBoxMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBubbleBoxMarkMode(this)},this.setPinMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPinMarkMode(this)},this.setEmojiMarkMode=e=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEmojiMarkMode(this,e)},this.setSignpostMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSignpostMarkMode(this)},this.setPriceNoteMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceNoteMarkMode(this)},this.setFlagMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFlagMarkMode(this)},this.setPriceLabelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceLabelMode(this)},this.setShortPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setShortPositionMarkMode(this)},this.setLongPositionMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLongPositionMarkMode(this)},this.setThickArrowLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setThickArrowLineMode(this)},this.setEraserMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEraserMode(this)},this.setMarkerPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setMarkerPenMode(this)},this.setBrushMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setBrushMode(this)},this.setPenMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPenMode(this)},this.setPencilMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPencilMode(this)},this.setTimePriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimePriceRangeMarkMode(this)},this.setPriceRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setPriceRangeMarkMode(this)},this.setTimeRangeMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTimeRangeMarkMode(this)},this.setElliottTripleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTripleCombinationMode(this)},this.setElliottDoubleCombinationMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottDoubleCombinationMode(this)},this.setElliottTriangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottTriangleMode(this)},this.setElliottCorrectiveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottCorrectiveMode(this)},this.setElliottImpulseMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setElliottImpulseMode(this)},this.setTriangleABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleABCDMode(this)},this.setABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setABCDMode(this)},this.setHeadAndShouldersMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHeadAndShouldersMode(this)},this.setXABCDMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setXABCDMode(this)},this.setDoubleCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDoubleCurveMode(this)},this.setCurveMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCurveMode(this)},this.setSectorMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setSectorMode(this)},this.setFibonacciExtensionBaseTimeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBaseTimeMode(this)},this.setFibonacciExtensionBasePriceMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciExtensionBasePriceMode(this)},this.setFibonacciChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciChannelMode(this)},this.setFibonacciFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciFanMode(this)},this.setFibonacciWedgeMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciWedgeMode(this)},this.setFibonacciSpiralMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciSpiralMode(this)},this.setFibonacciCircleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciCircleMode(this)},this.setFibonacciArcMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciArcMode(this)},this.setFibonacciRetracementMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciRetracementMode(this)},this.setFibonacciTimeZoonMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setFibonacciTimeZoonMode(this)},this.setGannRectangleMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannRectangleMode(this)},this.setGannBoxMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannBoxMode(this)},this.setGannFanMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setGannFanMode(this)},this.setTriangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setTriangleMarkMode(this)},this.setEllipseMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEllipseMarkMode(this)},this.setCircleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setCircleMarkMode(this)},this.setRectangleMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setRectangleMarkMode(this)},this.setEnhancedAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEnhancedAndrewPitchforkMode(this)},this.setAndrewPitchforkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setAndrewPitchforkMode(this)},this.setDisjointChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setDisjointChannelMarkMode(this)},this.setEquidistantChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setEquidistantChannelMarkMode(this)},this.setLinearRegressionChannelMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLinearRegressionChannelMode(this)},this.setLineSegmentMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setLineSegmentMarkMode(this)},this.setHorizontalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setHorizontalLineMode(this)},this.setVerticalLineMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setVerticalLineMode(this)},this.setArrowLineMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setArrowLineMarkMode(this)},this.setParallelChannelMarkMode=()=>{this.chartMarkManager?.closeAllBrushTools(this),this.chartMarkManager?.setParallelChannelMarkMode(this)},this.showGraphMarkToolBar=e=>{if(this.state.selectedGraphMark&&this.state.selectedGraphMark.id===e.id||this.state.selectedGraphMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedGraphMark:e,markToolBarPosition:i,showGraphMarkToolBar:!0})},this.closeGraphMarkToolBar=()=>{this.setState({showGraphMarkToolBar:!1})},this.showTableMarkToolBar=e=>{if(this.state.selectedTableMark&&this.state.selectedTableMark.id===e.id||this.state.selectedTableMark)return;let i={x:20,y:20};if(e.points.length>0){const r=e.points[0];i={x:Math.max(10,r.x-150),y:Math.max(10,r.y-80)}}this.setState({selectedTableMark:e,markToolBarPosition:i,showTableMarkToolBar:!0})},this.closeTableMarkToolBar=()=>{this.setState({showTableMarkToolBar:!1})},this.showTextEditMarkToolBar=(e,i)=>{if(this.state.selectedTextEditMark&&this.state.selectedTextEditMark.id===e.id||this.state.selectedTextEditMark)return;let r={x:20,y:20};if(e.points.length>0){const a=e.points[0];r={x:Math.max(10,a.x-150),y:Math.max(10,a.y-80)}}this.setState({selectedTextEditMark:e,markToolBarPosition:r,showTextMarkToolBar:!0,isShowGrapTool:i})},this.closeTextMarkToolBar=()=>{this.setState({showTextMarkToolBar:!1})},this.handleMouseDown=e=>{this.chartEventManager?.mouseDown(this,e)},this.handleMouseUp=e=>{this.chartEventManager?.mouseUp(this,e)},this.handleMouseMove=e=>{this.chartEventManager?.mouseMove(this,e)},this.handleViewportShiftLeft=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("left")},this.handleViewportShiftRight=()=>{this.props.chart&&this.props.viewportManager&&this.props.viewportManager.scrollChart("right")},this.handleZoomIn=()=>{this.props.viewportManager&&this.props.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.props.viewportManager&&this.props.viewportManager.zoomOut()},this.openIndicatorsModal=()=>{this.setState({isMainChartIndicatorsModalOpen:!0})},this.handleToggleIndicator=e=>{e&&(this.mainChartTechnicalIndicatorManager?.isVisible(e)?this.mainChartTechnicalIndicatorManager?.hideIndicator(e):this.mainChartTechnicalIndicatorManager?.showIndicator(e))},this.renderChartInfo=()=>{const{currentTheme:e,title:i}=this.props,{currentOHLC:r,mousePosition:a,showOHLC:s,maIndicatorValues:n,emaIndicatorValues:o,bollingerBandsValues:l,ichimokuValues:h,donchianChannelValues:d,envelopeValues:g,vwapValue:c,selectedMainChartIndicators:u}=this.state;return m.jsx(to,{currentTheme:e,title:i,currentOHLC:r,mousePosition:a,showOHLC:s,onToggleOHLC:this.toggleOHLCVisibility,onOpenIndicatorsModal:this.openIndicatorsModal,onOpenIndicatorSettings:this.handleOpenIndicatorSettings,onRemoveIndicator:this.handleRemoveIndicator,onToggleIndicator:this.handleToggleIndicator,visibleIndicatorTypes:this.state.selectedMainChartIndicatorTypes,indicators:u,maIndicatorValues:n,emaIndicatorValues:o,bollingerBandsValues:l,ichimokuValues:h,donchianChannelValues:d,envelopeValues:g,vwapValue:c,i18n:this.props.i18n})},this.handleIndicatorsClose=()=>{this.setState({isMainChartIndicatorsModalOpen:!1})},this.setImageMarkMode=()=>{this.chartMarkManager?.imageMarkManager&&this.setState({isImageUploadModalOpen:!0})},this.handleImageConfirm=e=>{if(this.setSelectedImageUrl(e),this.setState({isImageUploadModalOpen:!1}),this.chartMarkManager?.imageMarkManager){this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e);const i=this.chartMarkManager?.imageMarkManager.startImageMarkMode();this.setState({isImageMarkMode:i.isImageMarkMode,imageMarkStartPoint:i.imageMarkStartPoint,currentImageMark:i.currentImageMark,currentMarkMode:w.Image})}},this.handleImageUploadClose=()=>{this.setState({isImageUploadModalOpen:!1}),this.props.onCloseDrawing&&this.props.onCloseDrawing()},this.setSelectedImageUrl=e=>{this.chartMarkManager?.imageMarkManager&&this.chartMarkManager?.imageMarkManager.setSelectedImageUrl(e),this.setState({selectedImageUrl:e})},this.handleChangeTextMarkFontColor=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeTextMarkStyle=e=>{let i=e.isBold,r=e.isItalic;this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({isBold:i,isItalic:r})},this.handleChangeTextMarkFontSize=e=>{this.state.selectedTextEditMark&&this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({fontSize:e})},this.handleChangeTextMarkGraphColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphColor:e})},this.handleChangeTextMarkGraphLineStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineStyle:e})},this.handleChangeTextMarkGraphLineWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({graphLineWidth:e})},this.handleDeleteTextEditMark=()=>{if(!this.state.selectedTextEditMark)return;const e=this.state.selectedTextEditMark,i=e.markType;this.chartMarkManager?.deleteMark(i,e.properties.originalMark),this.setState({selectedTextEditMark:null,markToolBarPosition:{x:20,y:20}})},this.handleTextMarkEditorSave=(e,i,r,a,s)=>{if(this.setState({isTextMarkEditorOpen:!1}),!!this.state.selectedTextEditMark&&(i&&this.handleChangeTextMarkFontColor(i),r&&this.handleChangeTextMarkFontSize(r),a&&this.handleChangeTextMarkStyle({isBold:a}),s&&this.handleChangeTextMarkStyle({isItalic:s}),e))switch(this.state.selectedTextEditMark.markType){case w.TextEdit:this.state.selectedTextEditMark.mark.updateText(e);break;case w.BubbleBox:this.state.selectedTextEditMark.mark.updateText(e);break;case w.Pin:this.state.selectedTextEditMark.mark.updateText(e);break;case w.SignPost:this.state.selectedTextEditMark.mark.updateText(e);break}},this.handleTextMarkEditorCancel=()=>{this.setState({isTextMarkEditorOpen:!1}),this.state.selectedTextEditMark},this.handleDeleteGraphMark=()=>{if(!this.state.selectedGraphMark)return;const e=this.state.selectedGraphMark;e.properties?.originalMark&&this.chartMarkManager?.deleteMark(e.markType,e.properties.originalMark),this.closeGraphMarkToolBar()},this.handleChangeGraphMarkColor=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({color:e})},this.handleChangeGraphMarkStyle=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineStyle:e})},this.handleChangeGraphMarkWidth=e=>{this.currentMarkSettingsStyle&&this.currentMarkSettingsStyle.updateStyles({lineWidth:e})},this.handleGraphToolbarDrag=e=>{this.setState({isGraphMarkToolbarDragging:!0,graphMarkToolbarDragStartPoint:e});const i=a=>{if(this.state.isGraphMarkToolbarDragging&&this.state.graphMarkToolbarDragStartPoint){const s=a.clientX-this.state.graphMarkToolbarDragStartPoint.x,n=a.clientY-this.state.graphMarkToolbarDragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+n)},graphMarkToolbarDragStartPoint:{x:a.clientX,y:a.clientY}}))}},r=()=>{this.setState({isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.handleKeyDown=e=>{this.chartEventManager?.handleKeyDown(this,e)},this.handleDocumentMouseUp=e=>{this.chartEventManager?.documentMouseUp(this,e)},this.handleDocumentMouseDown=e=>{this.chartEventManager?.documentMouseDown(this,e)},this.handleDocumentMouseMove=e=>{this.chartEventManager?.documentMouseMove(this,e)},this.handleDocumentMouseWheel=e=>{this.chartEventManager?.documentMouseWheel(this,e)},this.handleTextMarkToolBarDrag=e=>{this.setState({isTextMarkToolbar:!0,dragStartPoint:e});const i=a=>{if(this.state.isTextMarkToolbar&&this.state.dragStartPoint){const s=a.clientX-this.state.dragStartPoint.x,n=a.clientY-this.state.dragStartPoint.y;this.setState(o=>({markToolBarPosition:{x:Math.max(0,o.markToolBarPosition.x+s),y:Math.max(0,o.markToolBarPosition.y+n)},dragStartPoint:{x:a.clientX,y:a.clientY}}))}},r=()=>{this.setState({isTextMarkToolbar:!1,dragStartPoint:null}),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",i),document.addEventListener("mouseup",r)},this.getToolName=e=>"",this.toggleOHLCVisibility=()=>{this.setState(e=>({showOHLC:!e.showOHLC}))},this.renderMainChart=()=>m.jsx("canvas",{ref:this.canvasRef,style:{position:"absolute",top:0,left:0,width:"calc(100% - 60px)",height:"calc(100% - 60px)",pointerEvents:"none",zIndex:1}}),this.showSubChartSettingModal=(e=[],i)=>{this.setState({isSubChartIndicatorsSettingModalOpen:!0,subChartIndicatorsSettingModalParams:e,currentSubChartIndicatorType:i})},this.handleSubChartSettingClose=()=>{this.setState({isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null})},this.handleSubChartSettingConfirm=e=>{this.state.currentSubChartIndicatorType&&this.chartPanesManager?.updateSettingsBySubChartIndicatorType(this.props.chartData,e,this.state.currentSubChartIndicatorType),this.handleSubChartSettingClose()},this.state={isDrawing:!1,drawingPoints:[],currentDrawing:null,drawingStartPoint:null,drawings:[],selectedTextEditMark:null,selectedTableMark:null,selectedGraphMark:null,markToolBarPosition:{x:20,y:20},isTextMarkToolbar:!1,dragStartPoint:null,history:[],historyIndex:-1,isDragging:!1,isResizing:!1,isRotating:!1,resizeHandle:null,isTextInputActive:!1,textInputPosition:null,textInputValue:"",textInputCursorVisible:!0,textInputCursorTimer:null,activePanel:null,editingTextId:null,isFirstTimeTextMode:!1,isEmojiInputActive:!1,emojiInputPosition:null,editingEmojiId:null,mousePosition:null,currentOHLC:null,showOHLC:!0,pendingEmojiMark:null,isTextMarkEditorOpen:!1,textMarkEditorPosition:{x:0,y:0},textMarkEditorInitialData:{text:"",color:"#000000",fontSize:14,isBold:!1,isItalic:!1},lineSegmentMarkStartPoint:null,arrowLineMarkStartPoint:null,parallelChannelMarkStartPoint:null,currentLineSegmentMark:null,currentArrowLineMark:null,currentParallelChannelMark:null,currentMarkMode:null,showGraphMarkToolBar:!1,showTableMarkToolBar:!1,showTextMarkToolBar:!1,isShowGrapTool:!1,isGraphMarkToolbarDragging:!1,graphMarkToolbarDragStartPoint:null,linearRegressionChannelStartPoint:null,currentLinearRegressionChannel:null,equidistantChannelMarkStartPoint:null,currentEquidistantChannelMark:null,disjointChannelMarkStartPoint:null,currentDisjointChannelMark:null,andrewPitchforkHandlePoint:null,andrewPitchforkBaseStartPoint:null,currentAndrewPitchfork:null,enhancedAndrewPitchforkHandlePoint:null,enhancedAndrewPitchforkBaseStartPoint:null,currentEnhancedAndrewPitchfork:null,rectangleMarkStartPoint:null,currentRectangleMark:null,circleMarkStartPoint:null,currentCircleMark:null,ellipseMarkStartPoint:null,currentEllipseMark:null,triangleMarkStartPoint:null,currentTriangleMark:null,gannFanStartPoint:null,currentGannFan:null,gannBoxStartPoint:null,currentGannBox:null,gannRectangleStartPoint:null,currentGannRectangle:null,fibonacciTimeZoonStartPoint:null,currentFibonacciTimeZoon:null,fibonacciRetracementStartPoint:null,currentFibonacciRetracement:null,fibonacciArcStartPoint:null,currentFibonacciArc:null,fibonacciCircleCenterPoint:null,currentFibonacciCircle:null,fibonacciSpiralCenterPoint:null,currentFibonacciSpiral:null,fibonacciWedgeCenterPoint:null,currentFibonacciWedge:null,fibonacciWedgeDrawingStep:0,fibonacciWedgePoints:[],fibonacciFanStartPoint:null,currentFibonacciFan:null,currentFibonacciChannel:null,isFibonacciChannelMode:!1,fibonacciChannelDrawingStep:0,fibonacciExtensionBasePricePoints:[],currentFibonacciExtensionBasePrice:null,fibonacciExtensionBaseTimePoints:[],currentFibonacciExtensionBaseTime:null,sectorPoints:[],currentSector:null,curveMarkStartPoint:null,currentCurveMark:null,doubleCurveMarkStartPoint:null,currentDoubleCurveMark:null,xabcdPoints:[],currentXABCDMark:null,headAndShouldersPoints:[],currentHeadAndShouldersMark:null,abcdPoints:[],currentABCDMark:null,triangleABCDPoints:[],currentTriangleABCDMark:null,elliottImpulsePoints:[],currentElliottImpulseMark:null,elliottCorrectivePoints:[],currentElliottCorrectiveMark:null,elliottTrianglePoints:[],currentElliottTriangleMark:null,elliottDoubleCombinationPoints:[],currentElliottDoubleCombinationMark:null,elliottTripleCombinationPoints:[],currentElliottTripleCombinationMark:null,timeRangeMarkStartPoint:null,currentTimeRangeMark:null,isTimeRangeMarkMode:!1,priceRangeMarkStartPoint:null,currentPriceRangeMark:null,isPriceRangeMarkMode:!1,timePriceRangeMarkStartPoint:null,currentTimePriceRangeMark:null,isTimePriceRangeMarkMode:!1,isPencilMode:!1,isPencilDrawing:!1,currentPencilMark:null,pencilPoints:[],isPenMode:!1,isPenDrawing:!1,currentPenMark:null,penPoints:[],isBrushMode:!1,isBrushDrawing:!1,currentBrushMark:null,brushPoints:[],isMarkerPenMode:!1,isMarkerPenDrawing:!1,currentMarkerPen:null,markerPenPoints:[],isEraserMode:!1,isErasing:!1,eraserHoveredMark:null,thickArrowLineMarkStartPoint:null,currentThickArrowLineMark:null,isImageMarkMode:!1,imageMarkStartPoint:null,currentImageMark:null,showImageModal:!1,selectedImageUrl:"",isImageUploadModalOpen:!1,isLongPositionMarkMode:!1,longPositionMarkStartPoint:null,currentLongPositionMark:null,longPositionDrawingPhase:"none",isLongPositionDragging:!1,dragTarget:null,dragPoint:null,adjustingMode:null,adjustStartData:null,isShortPositionMarkMode:!1,shortPositionMarkStartPoint:null,currentShortPositionMark:null,shortPositionDrawingPhase:"none",isShortPositionDragging:!1,shortPositionDragTarget:null,shortPositionDragPoint:null,shortPositionAdjustingMode:null,shortPositionAdjustStartData:null,isPriceLabelMarkMode:!1,priceLabelMarkPoint:null,currentPriceLabelMark:null,isPriceLabelDragging:!1,priceLabelDragTarget:null,isFlagMarkMode:!1,flagMarkPoint:null,currentFlagMark:null,isFlagDragging:!1,flagDragTarget:null,isPriceNoteMarkMode:!1,priceNoteMarkStartPoint:null,currentPriceNoteMark:null,isPriceNoteDragging:!1,priceNoteDragTarget:null,priceNoteDragPoint:null,isSignpostMarkMode:!1,signpostMarkPoint:null,currentSignpostMark:null,isSignpostDragging:!1,signpostDragTarget:null,isEmojiMarkMode:!1,emojiMarkStartPoint:null,currentEmojiMark:null,isEmojiDragging:!1,emojiDragTarget:null,emojiDragPoint:null,isPinMarkMode:!1,pinMarkPoint:null,currentPinMark:null,isPinDragging:!1,pinDragTarget:null,isBubbleBoxMarkMode:!1,bubbleBoxMarkPoints:null,currentBubbleBoxMark:null,isBubbleBoxDragging:!1,bubbleBoxDragTarget:null,bubbleBoxDragType:null,isTextEditMarkMode:!1,isTextEditDragging:!1,textEditDragTarget:null,isMainChartIndicatorsModalOpen:!1,selectedMainChartIndicators:[],selectedMainChartIndicatorTypes:[],modalEditingChartInfoIndicator:null,modalConfirmChartInfoIndicators:Yt(),maIndicatorValues:{},emaIndicatorValues:{},bollingerBandsValues:{},ichimokuValues:{},donchianChannelValues:{},envelopeValues:{},vwapValue:null,isSubChartIndicatorsSettingModalOpen:!1,subChartIndicatorsSettingModalParams:[],currentSubChartIndicatorType:null,isMockKLineMarkMode:!1,mockKLineMarkStartPoint:null,currentMockKLineMark:null,isMockKLineDragging:!1,mockKLineDragTarget:null,mockKLineDragPoint:null,isHeatMapMode:!1,heatMapStartPoint:null,currentHeatMap:null,isHeatMapDragging:!1,heatMapDragTarget:null,heatMapDragPoint:null,heatMapDrawingPhase:"none",heatMapAdjustingMode:null,isSchiffPitchforkMode:!1,schiffPitchforkHandlePoint:null,schiffPitchforkBaseStartPoint:null,currentSchiffPitchfork:null,isSchiffPitchforkDragging:!1,schiffPitchforkDragTarget:null,schiffPitchforkDragPoint:null,schiffPitchforkDrawingPhase:"none",schiffPitchforkAdjustingMode:null,cursorType:St.Crosshair,ai:this.props.ai||!1,aiconfigs:this.props.aiconfigs||[],currentAIFunctionType:this.props.currentAIFunctionType||null,isTimeEventMode:!1,isTimeEventDragging:!1,timeEventDragTarget:null,currentTimeEventMark:null,isPriceEventMode:!1,isPriceEventDragging:!1,priceEventDragTarget:null,currentPriceEventMark:null,isIncrement:!1},this.chartEventManager=new Ni,this.chartMarkManager=new ea,this.chartMarkTextEditManager=new ia,this.mainChartTechnicalIndicatorManager=new Zn(this.props.currentTheme),this.initializeGraphManager(),this.staticMarkManager=new so,this.chartPanesManager=new Ao,this.mainChartManager=new No(this,this.props.currentTheme)}componentDidMount(){this.setupCanvas(),this.setupAllDocumentEvents(),this.setupAllContainerEvents(),this.initializeMainChartIndicators(),this.chartMarkTextEditManager?.setupBubbleBoxMarkEvents(this),this.chartMarkTextEditManager?.setupSignPostMarkEvents(this),this.chartMarkTextEditManager?.setupPinMarkEvents(this),this.chartMarkTextEditManager?.setupTextEditMarkEvents(this),this.initStaticMark(),this.props.chart?this.chartEventManager?.registerCrosshairMoveEvent(this):setTimeout(()=>{this.props.chart&&this.chartEventManager?.registerCrosshairMoveEvent(this)},100),setTimeout(()=>{this.mainChartManager?.switchChartType(G.Candle),this.volume=new Fi(this),this.props.chart&&this.chartPanesManager?.setChartInstance(this.props.chart)},50)}componentDidUpdate(t){(t.chartSeries!==this.props.chartSeries||t.chart!==this.props.chart)&&this.initializeGraphManagerProps(),t.isIncrement!==this.props.isIncrement&&this.setState({isIncrement:this.props.isIncrement}),t.i18n!==this.props.i18n&&(this.volumeHeatMap?.updateI18n(this.props.i18n),this.marketProfile?.updateI18n(this.props.i18n)),t.currentTheme!==this.props.currentTheme&&(this.volumeHeatMap?.updateTheme(this.props.currentTheme),this.marketProfile?.updateTheme(this.props.currentTheme)),t.ai!==this.props.ai&&this.props.ai&&this.setState({ai:this.props.ai}),t.aiconfigs!==this.props.aiconfigs&&this.props.aiconfigs&&this.setState({aiconfigs:this.props.aiconfigs}),t.currentAIFunctionType!==this.props.currentAIFunctionType&&this.props.currentAIFunctionType&&this.setState({currentAIFunctionType:this.props.currentAIFunctionType}),(t.timeframe!==this.props.timeframe||t.timezone!==this.props.timezone)&&this.volume&&(this.volume.destroy(this),this.volume=new Fi(this),this.volume.refreshData(this)),this.hasChartDataChanged(t.chartData,this.props.chartData)?(setTimeout(()=>{this.updateStaticMark()},0),this.handleUpdateMainChartMaps(),this.updateAllMainChartIndicatorData(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData(),this.volumeHeatMap?.refreshData(this),this.executeEventMarksScriptForChartData()):this.hasMainChartIndicatorChanged(t.selectedMainChartIndicator,this.props.selectedMainChartIndicator)&&(this.handleInitMainChartMaps(),this.updateSelectedMainChartIndicators(),this.chartPanesManager?.updateAllPaneData(this.props.chartData),this.volume?.refreshData(this),this.mainChartManager?.refreshData(),this.executeEventMarksScriptForChartData()),t.currentMainChartType!==this.props.currentMainChartType&&this.swtichMainChartType(),t.markData!==this.props.markData&&(this.staticMarkManager?.clearAllMarks(),this.updateStaticMark()),t.currentTheme!==this.props.currentTheme&&this.chartPanesManager?.updateAllPaneTheme(this.props.currentTheme),t.selectedSubChartIndicators!==this.props.selectedSubChartIndicators&&(this.chartPanesManager?.removeAllPane(),setTimeout(()=>{this.props.selectedSubChartIndicators.forEach(e=>{this.chartPanesManager?.addSubChart(this,e,i=>{this.showSubChartSettingModal(this.chartPanesManager?.getParamsByIndicatorType(i),i)},i=>{this.chartPanesManager?.removePaneBySubChartIndicatorType(i),this.props.handleRemoveSubChartIndicator&&this.props.handleRemoveSubChartIndicator(i)})})},0))}componentWillUnmount(){this.cleanupAllDocumentEvents(),document.removeEventListener("keydown",this.handleKeyDown),this.doubleClickTimeout&&clearTimeout(this.doubleClickTimeout),this.cleanupAllContainerEvents(),this.destroyGraphManager(),this.chartMarkTextEditManager?.cleanupBubbleBoxMarkEvents(),this.chartMarkTextEditManager?.cleanupSignPostMarkEvents(),this.chartMarkTextEditManager?.cleanupPinMarkEvents(),this.chartMarkTextEditManager?.cleanupTextEditMarkEvents(),this.volumeHeatMap?.destroy(),this.marketProfile?.destroy(),this.mainChartManager?.destroy(),this.volume?.destroy(this)}handleInitMainChartMaps(){this.props.selectedMainChartIndicator&&(this.props.selectedMainChartIndicator.type===D.HEATMAP&&(this.volumeHeatMap||(this.volumeHeatMap=new Xo(this,this.props.i18n,this.props.currentTheme,()=>{this.volumeHeatMap=null}),this.volumeHeatMap?.refreshData(this))),this.props.selectedMainChartIndicator.type===D.MARKETPROFILE&&(this.marketProfile||(this.marketProfile=new Yo(this,this.props.i18n,this.props.currentTheme,()=>{this.marketProfile=null}),this.marketProfile?.refreshData(this))))}handleUpdateMainChartMaps(){this.props.selectedMainChartIndicator&&(this.volumeHeatMap&&this.volumeHeatMap?.refreshData(this),this.marketProfile&&this.marketProfile?.refreshData(this))}hasChartDataChanged(t,e){if(t===e)return!1;if(!t||!e||t.length!==e.length)return!0;const i=Math.min(t.length,e.length,5);for(let r=0;r<i;r++)if(t[r].time!==e[r].time)return!0;return!1}hasMainChartIndicatorChanged(t,e){return t===e?!1:!t||!e?!0:t.type!==e.type||t.nonce!==e.nonce||JSON.stringify(t.params)!==JSON.stringify(e.params)}initStaticMark(){setTimeout(()=>{this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})},200)}updateStaticMark(){this.props.markData&&this.staticMarkManager?.addMark(this.props.markData,{series:this.mainChartManager?.getCurrentSeries(),type:"mark"})}setupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.addEventListener("mousedown",this.handleMouseDown),t.addEventListener("mousemove",this.handleMouseMove),t.addEventListener("mouseup",this.handleMouseUp)}cleanupAllContainerEvents(){if(!this.containerRef.current)return;const t=this.containerRef.current;t.removeEventListener("mousedown",this.handleMouseDown),t.removeEventListener("mousemove",this.handleMouseMove),t.removeEventListener("mouseup",this.handleMouseUp)}setupAllDocumentEvents(){document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("mousemove",this.handleDocumentMouseMove),document.addEventListener("mousedown",this.handleDocumentMouseDown),document.addEventListener("mouseup",this.handleDocumentMouseUp),document.addEventListener("wheel",this.handleDocumentMouseWheel)}cleanupAllDocumentEvents(){document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("mousemove",this.handleDocumentMouseMove),document.removeEventListener("mousedown",this.handleDocumentMouseDown),document.removeEventListener("mouseup",this.handleDocumentMouseUp),document.removeEventListener("wheel",this.handleDocumentMouseWheel)}serializeDrawings(){return JSON.stringify(this.allDrawings)}setupCanvas(){const t=this.canvasRef.current,e=this.containerRef.current;if(!t||!e)return;const i=e.getBoundingClientRect();t.width=i.width,t.height=i.height}getDrawingLayerElementsPosition(){const t=[];return this.containerRef.current&&(this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(r=>{const a=r.getAttribute("data-text-id");if(a){const s=r,n=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:a,type:"text",position:{x:n.left-o.left,y:n.top-o.top},element:s})}}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(r=>{const a=r.getAttribute("data-emoji-id");if(a){const s=r,n=s.getBoundingClientRect(),o=this.containerRef.current.getBoundingClientRect();t.push({id:a,type:"emoji",position:{x:n.left-o.left,y:n.top-o.top},element:s})}})),t}setDrawingLayerElementsPosition(t){this.containerRef.current&&t.forEach(e=>{let i=null;if(e.type==="text"?i=this.containerRef.current.querySelector(`[data-text-id="${e.id}"]`):e.type==="emoji"&&(i=this.containerRef.current.querySelector(`[data-emoji-id="${e.id}"]`)),i){i.style.position="absolute",i.style.left=`${e.position.x}px`,i.style.top=`${e.position.y}px`;const r=this.allDrawings.findIndex(a=>a.id===e.id);r!==-1&&this.allDrawings[r].points.length>0&&(this.allDrawings[r].points[0]={...e.position})}})}moveDrawingLayerElements(t,e){if(!this.containerRef.current)return;this.containerRef.current.querySelectorAll(".drawing-text-element").forEach(a=>{const s=a,n=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${n+t}px`,s.style.top=`${o+e}px`}),this.containerRef.current.querySelectorAll(".drawing-emoji-element").forEach(a=>{const s=a,n=parseInt(s.style.left)||0,o=parseInt(s.style.top)||0;s.style.left=`${n+t}px`,s.style.top=`${o+e}px`}),this.allDrawings.forEach(a=>{(a.type==="text"||a.type==="emoji")&&a.points.length>0&&(a.points[0].x+=t,a.points[0].y+=e)})}getDrawingLayerElementsByType(t){const e=[];if(!this.containerRef.current)return e;const i=t==="text"?".drawing-text-element":".drawing-emoji-element",r=t==="text"?"data-text-id":"data-emoji-id";return this.containerRef.current.querySelectorAll(i).forEach(s=>{const n=s,o=n.getAttribute(r);if(o){const l=n.getBoundingClientRect(),h=this.containerRef.current.getBoundingClientRect();e.push({id:o,position:{x:l.left-h.left,y:l.top-h.top},element:n})}}),e}disableChartMovement(){this.props.chart&&(this.originalChartOptions=this.props.chart.options(),this.props.chart.applyOptions({handleScroll:!1,handleScale:!1}))}enableChartMovement(){this.props.chart.applyOptions({handleScroll:!0,handleScale:!0})}render(){const{activeTool:t,currentTheme:e,showInfoLayer:i=!0}=this.props,{isTextMarkToolbar:r,showGraphMarkToolBar:a,showTableMarkToolBar:s,markToolBarPosition:n,showTextMarkToolBar:o,selectedTextEditMark:l,selectedTableMark:h,selectedGraphMark:d,isMainChartIndicatorsModalOpen:g,isSubChartIndicatorsSettingModalOpen:c,subChartIndicatorsSettingModalParams:u,currentSubChartIndicatorType:p}=this.state;return m.jsx("div",{style:{width:"100%"},children:m.jsxs("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:t?"auto":"none",opacity:1,display:"block"},children:[i&&m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderChartInfo()}),m.jsx("div",{style:{position:"absolute",width:"100%",height:"100%"},children:this.renderMainChart()}),m.jsxs("div",{ref:this.containerRef,style:{position:"absolute",width:"100%",height:"100%",minHeight:"300px"},children:[this.state.isTextMarkEditorOpen&&m.jsx(Rr,{isOpen:this.state.isTextMarkEditorOpen,position:this.state.textMarkEditorPosition,theme:this.props.currentTheme,initialText:this.state.textMarkEditorInitialData.text,initialColor:this.state.textMarkEditorInitialData.color,initialFontSize:this.state.textMarkEditorInitialData.fontSize,initialIsBold:this.state.textMarkEditorInitialData.isBold,initialIsItalic:this.state.textMarkEditorInitialData.isItalic,onSave:this.handleTextMarkEditorSave,onCancel:this.handleTextMarkEditorCancel,i18n:this.props.i18n}),c&&m.jsx(Do,{isOpen:c,onClose:this.handleSubChartSettingClose,onConfirm:this.handleSubChartSettingConfirm,initialParams:u,theme:e,parentRef:this.containerRef,indicatorType:p,i18n:this.props.i18n}),this.state.isImageUploadModalOpen&&m.jsx(Br,{isOpen:this.state.isImageUploadModalOpen,onClose:this.handleImageUploadClose,onConfirm:this.handleImageConfirm,theme:e,i18n:this.props.i18n}),g&&m.jsx(eo,{isOpen:g,onClose:this.handleIndicatorsClose,onConfirm:this.handleMainChartIndicatorsSettingConfirm,initialIndicator:this.state.modalEditingChartInfoIndicator,theme:e,parentRef:this.containerRef,indicatorType:this.state.modalEditingChartInfoIndicator?.type||null,i18n:this.props.i18n}),o&&m.jsx($n,{position:n,selectedDrawing:l,theme:e,onClose:this.closeTextMarkToolBar,onDelete:this.handleDeleteTextEditMark,onChangeTextColor:this.handleChangeTextMarkFontColor,onChangeTextStyle:this.handleChangeTextMarkStyle,onChangeTextSize:this.handleChangeTextMarkFontSize,onDragStart:this.handleTextMarkToolBarDrag,isDragging:r,getToolName:this.getToolName,isShowGrapTool:this.state.isShowGrapTool,onChangeGraphColor:this.handleChangeTextMarkGraphColor,onChangeGraphStyle:this.handleChangeTextMarkGraphLineStyle,onChangeGraphLineWidth:this.handleChangeTextMarkGraphLineWidth,i18n:this.props.i18n}),a&&m.jsx(Jn,{position:n,selectedDrawing:d,theme:e,onClose:this.closeGraphMarkToolBar,onDelete:this.handleDeleteGraphMark,onChangeColor:this.handleChangeGraphMarkColor,onChangeStyle:this.handleChangeGraphMarkStyle,onChangeWidth:this.handleChangeGraphMarkWidth,onDragStart:this.handleGraphToolbarDrag,isDragging:!1,getToolName:this.getToolName,i18n:this.props.i18n})]})]})})}}class qo{constructor(t,e,i,r,a="en"){this.series=null,this.locale=a,this.chart=rt.createChart(t,{width:e,height:i,layout:r.layout,grid:{vertLines:{color:r.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:r.grid.horzLines.color+"30",style:1,visible:!0}},crosshair:{mode:0},timeScale:{timeVisible:!0,secondsVisible:!1,borderColor:r.grid.vertLines.color},rightPriceScale:{borderColor:r.grid.horzLines.color,scaleMargins:{top:.1,bottom:.1},entireTextOnly:!1},handleScale:{axisPressedMouseMove:!0},handleScroll:{mouseWheel:!0,pressedMouseMove:!0},localization:{locale:this.locale}})}getChart(){return this.chart}getSeries(){return this.series}getLocale(){return this.locale}}const ot={Indicators:"Indicators",mainChartIndicators:"Main Chart Indicators",subChartIndicators:"Sub Chart Indicators",chartMaps:"Maps",close:"Close",searchIndicators:"Search indicators...",searchChartTypes:"Search chart types...",theme:"Theme",light:"Light",dark:"Dark",timeframe:"Time Frame",chartType:"Chart Type",toolBar:{color:"Color",lineSize:"Line Size",lineStyle:"Line Style",delete:"Delete",close:"Close",fontSize:"Font Size",bold:"Bold",italic:"Italic",selectColor:"Select Color",colorPicker:"Color Picker",solid:"Solid",dashed:"Dashed",dotted:"Dotted",currentColor:"Current Color"},timeframeSections:{second:"Second",minute:"Minute",hour:"Hour",day:"Day",week:"Week",month:"Month"},chartTypes:{candle:"Candlestick",line:"Line",area:"Area",baseline:"Baseline",hollowCandle:"Hollow Candle",heikinAshi:"Heikin Ashi",column:"Column",lineWithMarkers:"Line with Markers",stepLine:"Step Line",bar:"Bar",histogram:"Histogram",pointandfigure:"PointAndFigure",kagi:"Kagi",linebreak:"LineBreak",mountain:"Mountain",baselinearea:"BaseLineArea",highlow:"HighLow",equivolume:"EquiVolume",threelinebreak:"ThreeLineBreak",hlcarea:"HLCArea"},toolbarButtons:{hint:"Hint",replay:"Replay",fullScreen:"Full Screen",screenshot:"Screenshot",contrast:"Contrast"},indicators:{ma:"Moving Average",ema:"Exponential Moving Average",bollinger:"Bollinger Bands",ichimoku:"Ichimoku Cloud",donchian:"Donchian Channel",envelope:"Envelope",vwap:"VWAP",rsi:"RSI",macd:"MACD",volume:"Volume",sar:"Parabolic SAR",kdj:"KDJ",atr:"ATR",stochastic:"Stochastic",cci:"CCI",bbwidth:"BB Width",adx:"ADX",obv:"OBV"},mainIndicators:{ma:"Moving Average (MA)",ema:"Exponential Moving Average (EMA)",bollinger:"Bollinger Bands",ichimoku:"Ichimoku Cloud",donchian:"Donchian Channel",envelope:"Envelope",vwap:"Volume Weighted Average Price (VWAP)"},mainChartMaps:{heatmap:"Heat Map",marketProfile:"Market Profile"},subChartIndicatorName:{rsi:"Relative Strength Index (RSI)",macd:"MACD",volume:"Volume",sar:"Parabolic SAR (SAR)",kdj:"KDJ",atr:"Average True Range (ATR)",stochastic:"Stochastic Oscillator",cci:"Commodity Channel Index (CCI)",bbwidth:"Bollinger Bands Width",adx:"Average Directional Index (ADX)",obv:"On Balance Volume (OBV)"},modal:{parameterSettings:"Parameter Settings",parameterName:"Parameter Name",parameterValue:"Value",lineWidth:"Line Width",lineColor:"Color",addParameter:"Add Parameter",deleteParameter:"Delete",keepAtLeastOne:"Keep at least one parameter",maximumParameters:"Maximum 5 parameters allowed",dragToMove:"Drag header to move"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: Confirm",escToCancel:"Esc: Cancel",clickToSelectColor:"Click to select color"},emoji:{categories:{smileys:"Smileys & Emotion",people:"People & Body",animals:"Animals & Nature",food:"Food & Drink",activities:"Activities",travel:"Travel & Places",objects:"Objects",symbols:"Symbols",flags:"Flags"},searchPlaceholder:"Search emojis...",selectedEmoji:"Selected",clickToPlace:"Click chart to place emoji"},leftPanel:{scriptTools:"Script Tools",timeEvent:"Time Event",timeEventDesc:"Time-based script event",priceEvent:"Price Event",priceEventDesc:"Price-based script event",cursorCrosshair:"Crosshair",cursorCrosshairDesc:"Crosshair cursor with space",cursorCircle:"Cursor",cursorCircleDesc:"Cursor",cursorDot:"Dot Cursor",cursorDotDesc:"Round dot cursor style",cursorArrow:"Arrow Cursor",cursorArrowDesc:"Arrow pointer style",cursorSparkle:"Sparkle",cursorSparkleDesc:"Sparkle effect cursor",cursorEmoji:"Emoji Cursor",cursorEmojiDesc:"Emoji symbol cursor",pencil:"Pencil",pencilDesc:"Thin line drawing tool",pen:"Pen",penDesc:"Smooth line drawing",brush:"Brush",brushDesc:"Soft brush effect",markerPen:"Marker",markerPenDesc:"Bold marker pen",eraser:"Eraser",eraserDesc:"Erase drawing content",heatMap:"Heat Map",lineTools:"Lines",arrowTools:"Arrows",channelTools:"Channels",pitchforkTools:"Pitchforks",penTools:"Pens",gannTools:"Gann Tools",fibonacciTools:"Fibonacci Tools",technicalPatterns:"Technical Patterns",elliottWave:"Elliott Wave",regularShapes:"Regular Shapes",rangeTools:"Ranges",positionTools:"Positions",simulationTools:"Simulation",textTools:"Text",contentTools:"Content",lineSegment:"Line Segment",lineSegmentDesc:"Draw line segment",horizontalLine:"Horizontal Line",horizontalLineDesc:"Draw horizontal line marker",verticalLine:"Vertical Line",verticalLineDesc:"Draw vertical line marker",arrowLine:"Arrow Line",arrowLineDesc:"Draw arrow line marker",thickArrowLine:"Thick Arrow Line",thickArrowLineDesc:"Draw thick arrow line marker",parallelChannel:"Parallel Channel",parallelChannelDesc:"Draw parallel channel",linearRegressionChannel:"Linear Regression Channel",linearRegressionChannelDesc:"Draw regression channel",equidistantChannel:"Equidistant Channel",equidistantChannelDesc:"Draw equidistant channel",disjointChannel:"Disjoint Channel",disjointChannelDesc:"Draw disjoint channel",andrewPitchfork:"Andrew's Pitchfork",andrewPitchforkDesc:"Draw Andrew's pitchfork",enhancedAndrewPitchfork:"Enhanced Andrew Pitchfork",enhancedAndrewPitchforkDesc:"Draw enhanced pitchfork",schiffPitchfork:"Schiff Pitchfork",schiffPitchforkDesc:"Draw Schiff pitchfork",internalPitchfork:"Internal Pitchfork Lines",internalPitchforkDesc:"Draw internal pitchfork lines",wavePitchfork:"Wave Pitchfork",wavePitchforkDesc:"Draw wave pitchfork",gannFan:"Gann Fan",gannFanDesc:"Gann fan analysis tool",gannBox:"Gann Box",gannBoxDesc:"Gann box analysis tool",gannRectangle:"Gann Rectangle",gannRectangleDesc:"Gann Rectangle analysis",fibonacciTimeZones:"Fibonacci Time Zones",fibonacciTimeZonesDesc:"Fibonacci time zones analysis",fibonacciRetracement:"Fibonacci Retracement",fibonacciRetracementDesc:"Draw Fibonacci retracement lines",fibonacciArc:"Fibonacci Arc",fibonacciArcDesc:"Draw Fibonacci arcs",fibonacciCircle:"Fibonacci Circle",fibonacciCircleDesc:"Fibonacci circle analysis",fibonacciSpiral:"Fibonacci Spiral",fibonacciSpiralDesc:"Fibonacci spiral analysis",fibonacciWedge:"Fibonacci Wedge",fibonacciWedgeDesc:"Fibonacci wedge analysis",fibonacciFan:"Fibonacci Fan",fibonacciFanDesc:"Fibonacci fan analysis",fibonacciChannel:"Fibonacci Channel",fibonacciChannelDesc:"Fibonacci channel analysis",fibonacciExtensionPrice:"Fibonacci Extension (Price)",fibonacciExtensionPriceDesc:"Draw Fibonacci extension lines",fibonacciExtensionTime:"Fibonacci Extension (Time)",fibonacciExtensionTimeDesc:"Draw Fibonacci extension lines",xabcdPattern:"XABCD Pattern",xabcdPatternDesc:"Draw XABCD pattern",headAndShoulders:"Head and Shoulders",headAndShouldersDesc:"Draw head and shoulders pattern",abcdPattern:"ABCD Pattern",abcdPatternDesc:"Draw ABCD pattern",triangleAbcd:"ABCD Triangle",triangleAbcdDesc:"Draw ABCD triangle pattern",elliottImpulse:"Elliott Impulse Wave",elliottImpulseDesc:"Draw Elliott impulse wave",elliottCorrective:"Elliott Corrective Wave",elliottCorrectiveDesc:"Draw Elliott corrective wave",elliottTriangle:"Elliott Triangle Wave",elliottTriangleDesc:"Draw Elliott triangle wave",elliottDoubleCombo:"Elliott Double Combo",elliottDoubleComboDesc:"Draw Elliott double combo wave",elliottTripleCombo:"Elliott Triple Combo",elliottTripleComboDesc:"Draw Elliott triple combo wave",rectangle:"Rectangle",rectangleDesc:"Draw rectangular area",circle:"Circle",circleDesc:"Draw circular area",ellipse:"Ellipse",ellipseDesc:"Draw elliptical area",triangle:"Triangle",triangleDesc:"Draw triangle",sector:"Sector",sectorDesc:"Draw sector",curve:"Curve",curveDesc:"Draw curve",doubleCurve:"Double Curve",doubleCurveDesc:"Draw double curve",timeRange:"Time Range",timeRangeDesc:"Draw time range",priceRange:"Price Range",priceRangeDesc:"Draw price range",timePriceRange:"Time-Price Range",timePriceRangeDesc:"Draw time-price range",longPosition:"Long Position",longPositionDesc:"Long position marker",shortPosition:"Short Position",shortPositionDesc:"Short position marker",mockKline:"Mock K-line",mockKlineDesc:"Simulate K-line data",text:"Text",textDesc:"Text annotation",priceNote:"Price Note",priceNoteDesc:"Price annotation",bubbleBox:"Bubble Box",bubbleBoxDesc:"Bubble annotation box",pin:"Pin",pinDesc:"Pin marker",signpost:"Signpost",signpostDesc:"Signpost marker",priceLabel:"Price Label",priceLabelDesc:"Price label marker",flagMark:"Flag Mark",flagMarkDesc:"Flag marker",image:"Image",imageDesc:"Image annotation",video:"Video",videoDesc:"Video annotation",audio:"Audio",audioDesc:"Audio annotation",idea:"Idea",ideaDesc:"Idea annotation",mouseCursor:"Mouse Cursor",drawingTools:"Drawing Tools",fibonacciToolsTitle:"Fibonacci Tools",projectInfoTools:"Project Info Tools",shapeTools:"Shape Tools",brushTitle:"Brush",textMark:"Text Mark",emojiMark:"Emoji Mark",deleteTool:"Delete Tool",setting:"Setting",selectedTool:"Selected",clickToStartDrawing:"Click chart to start drawing",selectEmoji:"Select Emoji",selectedEmoji:"Selected",clickToPlaceEmoji:"Click chart to place emoji",aiTools:"AI Tools",aiModelSelection:"AI Models",aiFunctions:"AI Functions",openai:"OpenAI",openaiDesc:"GPT-4, GPT-3.5",gemini:"Gemini",geminiDesc:"Google AI",claude:"Claude",claudeDesc:"Anthropic AI",deepseek:"DeepSeek",deepseekDesc:"Chinese AI Model",describeChart:"Describe Chart",describeChartDesc:"Describe chart patterns in natural language",predictTrend:"Predict Trend",predictTrendDesc:"Predict future trends based on historical data"},systemSettings:{title:"System Settings",general:"General",appearance:"Appearance",chart:"Chart",performance:"Performance",shortcuts:"Shortcuts",saveSettings:"Save Settings",cancel:"Cancel",confirm:"Confirm",language:"Language",timezone:"Timezone",autoSave:"Auto Save",themeMode:"Theme Mode",fontSize:"Font Size",animations:"Animations",defaultTimeframe:"Default Timeframe",pricePrecision:"Price Precision",showGrid:"Show Grid",hardwareAcceleration:"Hardware Acceleration",dataPointLimit:"Data Point Limit",realtimeUpdates:"Real-time Updates",shortcutsTitle:"Keyboard Shortcuts",zoomIn:"Zoom In",zoomOut:"Zoom Out",resetZoom:"Reset Zoom",saveChart:"Save Chart",undo:"Undo",redo:"Redo",setting:"Setting"},settingsDescriptions:{language:"Select interface display language",timezone:"Set timezone for displayed times",autoSave:"Automatically save chart settings and drawings",themeMode:"Choose light or dark theme",fontSize:"Set interface font size",animations:"Enable interface animation effects",defaultTimeframe:"Set default chart display timeframe",pricePrecision:"Set number of decimal places for price display",showGrid:"Display grid lines in chart",hardwareAcceleration:"Enable GPU accelerated rendering (recommended)",dataPointLimit:"Set maximum number of data points to display in chart",realtimeUpdates:"Enable real-time data stream updates"},options:{light:"Light Mode",dark:"Dark Mode",auto:"Follow System",small:"Small",medium:"Medium",large:"Large",zhCN:"Simplified Chinese",enUS:"English",jaJP:"Japanese",beijing:"Beijing Time (UTC+8)",newYork:"New York Time (UTC-5)",london:"London Time (UTC+0)",chicago:"Chicago Time (UTC-6)",denver:"Denver Time (UTC-7)",losAngeles:"Los Angeles Time (UTC-8)",toronto:"Toronto Time (UTC-5)",paris:"Paris Time (UTC+1)",frankfurt:"Frankfurt Time (UTC+1)",zurich:"Zurich Time (UTC+1)",moscow:"Moscow Time (UTC+3)",dubai:"Dubai Time (UTC+4)",karachi:"Karachi Time (UTC+5)",kolkata:"Kolkata Time (UTC+5:30)",shanghai:"Shanghai Time (UTC+8)",hongKong:"Hong Kong Time (UTC+8)",singapore:"Singapore Time (UTC+8)",tokyo:"Tokyo Time (UTC+9)",seoul:"Seoul Time (UTC+9)",sydney:"Sydney Time (UTC+10)",auckland:"Auckland Time (UTC+12)",utc:"UTC Time"},timeframes:{"1s":"1 Second","5s":"5 Seconds","15s":"15 Seconds","30s":"30 Seconds","1m":"1 Minute","3m":"3 Minutes","5m":"5 Minutes","15m":"15 Minutes","30m":"30 Minutes","45m":"45 Minutes","1H":"1 Hour","2H":"2 Hours","3H":"3 Hours","4H":"4 Hours","6H":"6 Hours","8H":"8 Hours","12H":"12 Hours","1D":"1 Day","3D":"3 Days","1W":"1 Week","2W":"2 Weeks","1M":"1 Month","3M":"3 Months","6M":"6 Months"},timezone:"Timezone",timeFormat:"Time Format",closeTime:"Close Time",tradingDay:"Trading Day",searchTimezones:"Search timezones...",timeFormatOptions:{twentyFourHour:"24-Hour Format",twelveHour:"12-Hour Format"},closeTimeOptions:{custom:"Custom Time"},tradingDayOptions:{tradingSession:"Trading Session",calendarDay:"Calendar Day",exchangeHours:"Exchange Hours"},terminal:{isEn:"en",placeholderText:"Enter command..."},ai:{aliyun:"Aliyun"}},zo={Indicators:"技术指标",mainChartIndicators:"主图指标",subChartIndicators:"副图指标",chartMaps:"图",close:"关闭",searchIndicators:"搜索指标...",searchChartTypes:"搜索图表类型...",theme:"主题",light:"浅色",dark:"深色",timeframe:"时间框架",chartType:"图表类型",toolBar:{color:"颜色",lineSize:"线条尺寸",lineStyle:"线条样式",delete:"删除",close:"关闭",fontSize:"字体大小",bold:"粗体",italic:"斜体",selectColor:"选择颜色",colorPicker:"拾色器",solid:"实线",dashed:"虚线",dotted:"点状线",currentColor:"当前颜色"},timeframeSections:{second:"秒",minute:"分钟",hour:"小时",day:"天",week:"周",month:"月"},chartTypes:{candle:"蜡烛图",line:"线图",area:"面积图",baseline:"基线图",hollowCandle:"空心蜡烛图",heikinAshi:"平均K线图",column:"柱状图",lineWithMarkers:"带标记线图",stepLine:"阶梯线图",bar:"美国线",histogram:"直方图",pointandfigure:"点线图",kagi:"卡吉图",linebreak:"新价线",mountain:"山脉图",baselinearea:"基准面积图",highlow:"高低图",equivolume:"等量图",threelinebreak:"三线反转图",hlcarea:"HLC区域"},toolbarButtons:{hint:"提示",replay:"回放",fullScreen:"全屏",screenshot:"截图",contrast:"对比"},indicators:{ma:"移动平均线",ema:"指数移动平均线",bollinger:"布林带",ichimoku:"一目均衡表",donchian:"唐奇安通道",envelope:"包络线",vwap:"成交量加权平均价",rsi:"RSI",macd:"MACD",volume:"成交量",sar:"抛物线转向",kdj:"KDJ",atr:"ATR",stochastic:"随机指标",cci:"CCI",bbwidth:"布林带宽度",adx:"ADX",obv:"能量潮"},mainIndicators:{ma:"移动平均线 (MA)",ema:"指数移动平均线 (EMA)",bollinger:"布林带",ichimoku:"一目均衡表",donchian:"唐奇安通道",envelope:"包络线",vwap:"成交量加权平均价 (VWAP)"},mainChartMaps:{heatmap:"热力图",marketProfile:"市场轮廓图"},subChartIndicatorName:{rsi:"相对强弱指数 (RSI)",macd:"MACD",volume:"成交量",sar:"抛物线转向指标 (SAR)",kdj:"KDJ",atr:"平均真实波幅 (ATR)",stochastic:"随机指标",cci:"顺势指标 (CCI)",bbwidth:"布林带宽度",adx:"平均趋向指数 (ADX)",obv:"能量潮 (OBV)"},modal:{parameterSettings:"参数设置",parameterName:"参数名称",parameterValue:"数值",lineWidth:"线宽",lineColor:"颜色",addParameter:"添加参数",deleteParameter:"删除",keepAtLeastOne:"至少保留一个参数",maximumParameters:"最多允许5个参数",dragToMove:"拖动标题栏移动"},tooltips:{ctrlEnterToConfirm:"Ctrl+Enter: 确认",escToCancel:"Esc: 取消",clickToSelectColor:"点击选择颜色"},emoji:{categories:{smileys:"表情与情感",people:"人物与身体",animals:"动物与自然",food:"食物与饮品",activities:"活动",travel:"旅行与地点",objects:"物品",symbols:"符号",flags:"旗帜"},searchPlaceholder:"搜索表情...",selectedEmoji:"已选择",clickToPlace:"点击图表放置表情"},leftPanel:{scriptTools:"脚本工具",timeEvent:"时间事件",timeEventDesc:"基于时间的脚本事件",priceEvent:"价格事件",priceEventDesc:"基于价格的脚本事件",cursorCrosshair:"十字准星",cursorCrosshairDesc:"带空格的十字准星",cursorCircle:"圆形光标",cursorCircleDesc:"圆形光标",cursorDot:"点状光标",cursorDotDesc:"圆点光标样式",cursorArrow:"箭头光标",cursorArrowDesc:"箭头指示样式",cursorSparkle:"烟花棒",cursorSparkleDesc:"烟花效果光标",cursorEmoji:"表情光标",cursorEmojiDesc:"表情符号光标",pencil:"铅笔",pencilDesc:"细线绘制工具",pen:"钢笔",penDesc:"流畅线条绘制",brush:"刷子",brushDesc:"柔和笔刷效果",markerPen:"马克笔",markerPenDesc:"粗体标记笔",eraser:"橡皮擦",eraserDesc:"擦除绘制内容",lineTools:"线",arrowTools:"箭头",channelTools:"通道",pitchforkTools:"叉",penTools:"画笔",gannTools:"江恩分析工具",fibonacciTools:"斐波那契工具",technicalPatterns:"技术图形",elliottWave:"艾略特波浪",regularShapes:"规则图形",rangeTools:"区间",positionTools:"标尺",simulationTools:"模拟",heatMap:"热力图",textTools:"文本",contentTools:"内容",lineSegment:"线段",lineSegmentDesc:"绘制线段",horizontalLine:"水平线",horizontalLineDesc:"绘制水平线标记",verticalLine:"垂直线",verticalLineDesc:"绘制垂直线标记",arrowLine:"箭头线",arrowLineDesc:"绘制箭头线标记",thickArrowLine:"粗箭头线",thickArrowLineDesc:"绘制箭头线标记",parallelChannel:"并行通道",parallelChannelDesc:"绘制并行通道",linearRegressionChannel:"线性回归通道",linearRegressionChannelDesc:"绘制回归通道",equidistantChannel:"等距通道",equidistantChannelDesc:"绘制等距通道",disjointChannel:"不相交通道",disjointChannelDesc:"绘制不相交通道",andrewPitchfork:"安德鲁干草叉",andrewPitchforkDesc:"绘制安德鲁干草叉",enhancedAndrewPitchfork:"改良安德鲁干草叉",enhancedAndrewPitchforkDesc:"绘制叉子",schiffPitchfork:"希夫干草叉",schiffPitchforkDesc:"绘制希夫干草叉",internalPitchfork:"内部干草叉线",internalPitchforkDesc:"绘制内部干草叉线",wavePitchfork:"波浪干草叉",wavePitchforkDesc:"绘制波浪干草叉",gannFan:"江恩扇",gannFanDesc:"江恩扇形线分析工具",gannBox:"江恩箱",gannBoxDesc:"江恩箱体分析工具",gannRectangle:"江恩正方体",gannRectangleDesc:"江恩正方体分析",fibonacciTimeZones:"斐波那契时间周期",fibonacciTimeZonesDesc:"斐波那契时间周期线分析",fibonacciRetracement:"斐波那契回调",fibonacciRetracementDesc:"绘制斐波那契回调线",fibonacciArc:"斐波那契弧线",fibonacciArcDesc:"绘制斐波那契弧线",fibonacciCircle:"斐波那契圆",fibonacciCircleDesc:"斐波那契圆线分析",fibonacciSpiral:"斐波那契螺旋",fibonacciSpiralDesc:"斐波那契螺旋线分析",fibonacciWedge:"斐波那契楔形",fibonacciWedgeDesc:"斐波那契楔形线分析",fibonacciFan:"斐波那契扇形",fibonacciFanDesc:"斐波那契扇形线分析",fibonacciChannel:"斐波那契通道",fibonacciChannelDesc:"斐波那契通道线分析",fibonacciExtensionPrice:"斐波那契扩展(基于价格)",fibonacciExtensionPriceDesc:"绘制斐波那契扩展线",fibonacciExtensionTime:"斐波那契扩展(基于时间)",fibonacciExtensionTimeDesc:"绘制斐波那契扩展线",xabcdPattern:"XABCD图形",xabcdPatternDesc:"绘制XABCD图形",headAndShoulders:"头肩图形",headAndShouldersDesc:"绘制头肩图形",abcdPattern:"ABCD图形",abcdPatternDesc:"绘制ABCD图形",triangleAbcd:"ABCD三角图形",triangleAbcdDesc:"绘制ABCD三角图形",elliottImpulse:"艾略特脉冲波",elliottImpulseDesc:"绘制艾略特脉冲波",elliottCorrective:"艾略特修正浪",elliottCorrectiveDesc:"绘制艾略特修正浪",elliottTriangle:"艾略特三角波",elliottTriangleDesc:"绘制艾略特三角波",elliottDoubleCombo:"艾略特双重组合波",elliottDoubleComboDesc:"绘制艾略特双重组合波",elliottTripleCombo:"艾略特三重组合波",elliottTripleComboDesc:"绘制艾略特三重组合波",rectangle:"矩形",rectangleDesc:"绘制矩形区域",circle:"圆形",circleDesc:"绘制圆形区域",ellipse:"椭圆",ellipseDesc:"绘制椭圆区域",triangle:"三角形",triangleDesc:"绘制三角形",sector:"扇形",sectorDesc:"绘制扇形",curve:"曲线",curveDesc:"绘制曲线",doubleCurve:"双曲线",doubleCurveDesc:"绘制双曲线",timeRange:"时间区间",timeRangeDesc:"绘制时间区间",priceRange:"价格区间",priceRangeDesc:"绘制价格区间",timePriceRange:"时间价格区间",timePriceRangeDesc:"绘制时间价格区间",longPosition:"多头",longPositionDesc:"多头标记",shortPosition:"空头",shortPositionDesc:"空头标记",mockKline:"模拟K线",mockKlineDesc:"模拟K线数据",text:"文本",textDesc:"文本标注",priceNote:"价格标记",priceNoteDesc:"价格标注",bubbleBox:"气泡框",bubbleBoxDesc:"气泡标注框",pin:"定位",pinDesc:"定位标记",signpost:"路标",signpostDesc:"路标标记",priceLabel:"价格标签",priceLabelDesc:"价格标签标记",flagMark:"旗标",flagMarkDesc:"旗标标记",image:"图片",imageDesc:"图片标注",video:"视频",videoDesc:"视频标注",audio:"音频",audioDesc:"音频标注",idea:"点子",ideaDesc:"点子标注",mouseCursor:"鼠标光标",drawingTools:"绘图工具",fibonacciToolsTitle:"斐波那契工具",projectInfoTools:"项目信息工具",shapeTools:"图形工具",brushTitle:"画笔",textMark:"文字标记",emojiMark:"表情标记",deleteTool:"删除工具",setting:"设置",selectedTool:"已选择",clickToStartDrawing:"点击图表开始绘制",selectEmoji:"选择表情",selectedEmoji:"已选择",clickToPlaceEmoji:"点击图表放置表情",aiTools:"AI工具",aiModelSelection:"AI模型",aiFunctions:"AI功能",openai:"OpenAI",openaiDesc:"GPT-4, GPT-3.5",gemini:"Gemini",geminiDesc:"谷歌AI",claude:"Claude",claudeDesc:"Anthropic AI",deepseek:"DeepSeek",deepseekDesc:"国产AI模型",describeChart:"图表分析",describeChartDesc:"用自然语言分析图表走势",predictTrend:"趋势预测",predictTrendDesc:"基于历史数据预测未来趋势"},systemSettings:{title:"系统设置",general:"通用设置",appearance:"外观设置",chart:"图表设置",performance:"性能设置",shortcuts:"快捷键",saveSettings:"保存设置",cancel:"取消",confirm:"确认",language:"语言",timezone:"时区",autoSave:"自动保存",themeMode:"主题模式",fontSize:"字体大小",animations:"动画效果",defaultTimeframe:"默认时间周期",pricePrecision:"价格精度",showGrid:"显示网格",hardwareAcceleration:"硬件加速",dataPointLimit:"数据点限制",realtimeUpdates:"实时数据更新",shortcutsTitle:"键盘快捷键",zoomIn:"放大图表",zoomOut:"缩小图表",resetZoom:"重置缩放",saveChart:"保存图表",undo:"撤销操作",redo:"重做操作",setting:"设置"},settingsDescriptions:{language:"选择界面显示语言",timezone:"设置显示时间的时区",autoSave:"自动保存图表设置和绘图",themeMode:"选择浅色或深色主题",fontSize:"设置界面字体大小",animations:"启用界面动画效果",defaultTimeframe:"设置图表默认显示的时间周期",pricePrecision:"设置价格显示的小数位数",showGrid:"在图表中显示网格线",hardwareAcceleration:"启用GPU加速渲染(推荐)",dataPointLimit:"设置图表显示的最大数据点数量",realtimeUpdates:"启用实时数据流更新"},options:{light:"浅色模式",dark:"深色模式",auto:"跟随系统",small:"小",medium:"中",large:"大",zhCN:"简体中文",enUS:"English",jaJP:"日本語",beijing:"北京时间 (UTC+8)",newYork:"纽约时间 (UTC-5)",london:"伦敦时间 (UTC+0)",chicago:"芝加哥时间 (UTC-6)",denver:"丹佛时间 (UTC-7)",losAngeles:"洛杉矶时间 (UTC-8)",toronto:"多伦多时间 (UTC-5)",paris:"巴黎时间 (UTC+1)",frankfurt:"法兰克福时间 (UTC+1)",zurich:"苏黎世时间 (UTC+1)",moscow:"莫斯科时间 (UTC+3)",dubai:"迪拜时间 (UTC+4)",karachi:"卡拉奇时间 (UTC+5)",kolkata:"加尔各答时间 (UTC+5:30)",shanghai:"上海时间 (UTC+8)",hongKong:"香港时间 (UTC+8)",singapore:"新加坡时间 (UTC+8)",tokyo:"东京时间 (UTC+9)",seoul:"首尔时间 (UTC+9)",sydney:"悉尼时间 (UTC+10)",auckland:"奥克兰时间 (UTC+12)",utc:"UTC时间"},timeframes:{"1s":"1秒","5s":"5秒","15s":"15秒","30s":"30秒","1m":"1分钟","3m":"3分钟","5m":"5分钟","15m":"15分钟","30m":"30分钟","45m":"45分钟","1H":"1小时","2H":"2小时","3H":"3小时","4H":"4小时","6H":"6小时","8H":"8小时","12H":"12小时","1D":"1天","3D":"3天","1W":"1周","2W":"2周","1M":"1月","3M":"3月","6M":"6月"},timezone:"时区",timeFormat:"时间格式",closeTime:"收盘时间",tradingDay:"交易日",searchTimezones:"搜索时区...",timeFormatOptions:{twentyFourHour:"24小时制",twelveHour:"12小时制"},closeTimeOptions:{custom:"自定义时间"},tradingDayOptions:{tradingSession:"交易时段",calendarDay:"日历日",exchangeHours:"交易时间"},terminal:{isEn:"中文",placeholderText:"输入命令..."},ai:{aliyun:"阿里云"}};async function Me(f,t){const e=f.chartContainerRef.current;if(!e){const i={success:!1,error:"Chart container not found",width:0,height:0,timestamp:Date.now()};return t?.(i),i}try{const i=document.createElement("canvas"),r=i.getContext("2d");if(!r){const g={success:!1,error:"Canvas context not available",width:0,height:0,timestamp:Date.now()};return t?.(g),g}const{width:a,height:s}=e.getBoundingClientRect();i.width=a,i.height=s,r.fillStyle=f.state.currentTheme.layout.background.color,r.fillRect(0,0,a,s);const n=e.querySelectorAll("canvas");Array.from(n).sort((g,c)=>{const u=parseInt(window.getComputedStyle(g).zIndex)||0,p=parseInt(window.getComputedStyle(c).zIndex)||0;return u-p}).forEach(g=>{try{const c=g.getBoundingClientRect(),u=e.getBoundingClientRect(),p=c.left-u.left,M=c.top-u.top;r.drawImage(g,p,M,c.width,c.height)}catch{}}),Qo(r,a,s,f.state.currentTheme);const l=i.toDataURL("image/png"),h=await new Promise(g=>{i.toBlob(c=>{g(c)},"image/png")}),d={success:!0,dataUrl:l,blob:h,width:a,height:s,timestamp:Date.now()};if(t)t(d);else{const g=document.createElement("a");g.download=`chart-screenshot-${new Date().getTime()}.png`,g.href=l,g.click()}return d}catch(i){const r={success:!1,error:i instanceof Error?i.message:"Unknown error",width:0,height:0,timestamp:Date.now()};return t?.(r),r}}function Qo(f,t,e,i){f.save();const a=i.layout.background.color==="#0F1116"?"rgba(255, 255, 255, 0.25)":"rgba(0, 0, 0, 0.25)";f.fillStyle=a,f.font="bold 60px Arial, sans-serif",f.textAlign="center",f.textBaseline="middle";const s=t/2,n=e/2;f.fillText("CandleView",s,n),f.restore()}function Go(f){return f&&{"1s":E.ONE_SECOND,"5s":E.FIVE_SECONDS,"15s":E.FIFTEEN_SECONDS,"30s":E.THIRTY_SECONDS,"1m":E.ONE_MINUTE,"3m":E.THREE_MINUTES,"5m":E.FIVE_MINUTES,"15m":E.FIFTEEN_MINUTES,"30m":E.THIRTY_MINUTES,"45m":E.FORTY_FIVE_MINUTES,"1h":E.ONE_HOUR,"2h":E.TWO_HOURS,"3h":E.THREE_HOURS,"4h":E.FOUR_HOURS,"6h":E.SIX_HOURS,"8h":E.EIGHT_HOURS,"12h":E.TWELVE_HOURS,"1d":E.ONE_DAY,"3d":E.THREE_DAYS,"1w":E.ONE_WEEK,"2w":E.TWO_WEEKS,"1M":E.ONE_MONTH,"3M":E.THREE_MONTHS,"6M":E.SIX_MONTHS}[f]||null}function $o(f){return f&&{"America/New_York":W.NEW_YORK,"America/Chicago":W.CHICAGO,"America/Denver":W.DENVER,"America/Los_Angeles":W.LOS_ANGELES,"America/Toronto":W.TORONTO,"Europe/London":W.LONDON,"Europe/Paris":W.PARIS,"Europe/Frankfurt":W.FRANKFURT,"Europe/Zurich":W.ZURICH,"Europe/Moscow":W.MOSCOW,"Asia/Dubai":W.DUBAI,"Asia/Karachi":W.KARACHI,"Asia/Kolkata":W.KOLKATA,"Asia/Shanghai":W.SHANGHAI,"Asia/Hong_Kong":W.HONG_KONG,"Asia/Singapore":W.SINGAPORE,"Asia/Tokyo":W.TOKYO,"Asia/Seoul":W.SEOUL,"Australia/Sydney":W.SYDNEY,"Pacific/Auckland":W.AUCKLAND,UTC:W.UTC}[f]||null}const zi={[E.ONE_SECOND]:{seconds:1,groupBy:"second"},[E.FIVE_SECONDS]:{seconds:5,groupBy:"second"},[E.FIFTEEN_SECONDS]:{seconds:15,groupBy:"second"},[E.THIRTY_SECONDS]:{seconds:30,groupBy:"second"},[E.ONE_MINUTE]:{seconds:60,groupBy:"minute"},[E.THREE_MINUTES]:{seconds:180,groupBy:"minute"},[E.FIVE_MINUTES]:{seconds:300,groupBy:"minute"},[E.FIFTEEN_MINUTES]:{seconds:900,groupBy:"minute"},[E.THIRTY_MINUTES]:{seconds:1800,groupBy:"minute"},[E.FORTY_FIVE_MINUTES]:{seconds:2700,groupBy:"minute"},[E.ONE_HOUR]:{seconds:3600,groupBy:"hour"},[E.TWO_HOURS]:{seconds:7200,groupBy:"hour"},[E.THREE_HOURS]:{seconds:10800,groupBy:"hour"},[E.FOUR_HOURS]:{seconds:14400,groupBy:"hour"},[E.SIX_HOURS]:{seconds:21600,groupBy:"hour"},[E.EIGHT_HOURS]:{seconds:28800,groupBy:"hour"},[E.TWELVE_HOURS]:{seconds:43200,groupBy:"hour"},[E.ONE_DAY]:{seconds:86400,groupBy:"day"},[E.THREE_DAYS]:{seconds:259200,groupBy:"day"},[E.ONE_WEEK]:{seconds:604800,groupBy:"week"},[E.TWO_WEEKS]:{seconds:1209600,groupBy:"week"},[E.ONE_MONTH]:{seconds:2592e3,groupBy:"month"},[E.THREE_MONTHS]:{seconds:7776e3,groupBy:"month"},[E.SIX_MONTHS]:{seconds:15552e3,groupBy:"month"}};function Jo(f,t){return t&&f in t.timeframes?t.timeframes[f]:yi(f)}function yi(f){return{[E.ONE_SECOND]:"1 Second",[E.FIVE_SECONDS]:"5 Seconds",[E.FIFTEEN_SECONDS]:"15 Seconds",[E.THIRTY_SECONDS]:"30 Seconds",[E.ONE_MINUTE]:"1 Minute",[E.THREE_MINUTES]:"3 Minutes",[E.FIVE_MINUTES]:"5 Minutes",[E.FIFTEEN_MINUTES]:"15 Minutes",[E.THIRTY_MINUTES]:"30 Minutes",[E.FORTY_FIVE_MINUTES]:"45 Minutes",[E.ONE_HOUR]:"1 Hour",[E.TWO_HOURS]:"2 Hours",[E.THREE_HOURS]:"3 Hours",[E.FOUR_HOURS]:"4 Hours",[E.SIX_HOURS]:"6 Hours",[E.EIGHT_HOURS]:"8 Hours",[E.TWELVE_HOURS]:"12 Hours",[E.ONE_DAY]:"1 Day",[E.THREE_DAYS]:"3 Days",[E.ONE_WEEK]:"1 Week",[E.TWO_WEEKS]:"2 Weeks",[E.ONE_MONTH]:"1 Month",[E.THREE_MONTHS]:"3 Months",[E.SIX_MONTHS]:"6 Months"}[f]||f}function Zo(f,t,e,i=E.ONE_DAY){if(!f||f.length===0)return[];const r=zi[i],a=r?r.seconds:86400,s=[],n=f[0],o=f[f.length-1],l=f.reduce((M,k)=>M+k.close,0)/f.length,h=typeof n.time=="string"?new Date(n.time).getTime()/1e3:n.time,d=typeof o.time=="string"?new Date(o.time).getTime()/1e3:o.time,g=1e4,c=Math.min(t,g),u=Math.min(e,g);let p=h;for(let M=c;M>0;M--){p-=a;const k={time:p,open:l,high:l,low:l,close:l,volume:-1,isVirtual:!0};s.unshift(k)}s.push(...f),p=d;for(let M=0;M<u;M++){p+=a;const k={time:p,open:l,high:l,low:l,close:l,volume:-1,isVirtual:!0};s.push(k)}return s}function Ri(f,t){if(!f||f.length===0)return f;const e=tl[t];return e?f.map(i=>{const r=i.time;let a;typeof r=="string"?a=new Date(r).getTime()/1e3:a=r;const s=e.offset.match(/^([+-])(\d{2}):(\d{2})$/);if(!s)return{...i,time:a};const n=s[1],o=parseInt(s[2],10),l=parseInt(s[3],10);let h=o*3600+l*60;n==="-"&&(h=-h);const c=-new Date(a*1e3).getTimezoneOffset()*60,u=h-c,p=a+u;return{...i,time:p}}):f}const tl={[W.NEW_YORK]:{name:"America/New_York",offset:"-05:00",displayName:"New York"},[W.CHICAGO]:{name:"America/Chicago",offset:"-06:00",displayName:"Chicago"},[W.DENVER]:{name:"America/Denver",offset:"-07:00",displayName:"Denver"},[W.LOS_ANGELES]:{name:"America/Los_Angeles",offset:"-08:00",displayName:"Los Angeles"},[W.TORONTO]:{name:"America/Toronto",offset:"-05:00",displayName:"Toronto"},[W.LONDON]:{name:"Europe/London",offset:"+00:00",displayName:"London"},[W.PARIS]:{name:"Europe/Paris",offset:"+01:00",displayName:"Paris"},[W.FRANKFURT]:{name:"Europe/Frankfurt",offset:"+01:00",displayName:"Frankfurt"},[W.ZURICH]:{name:"Europe/Zurich",offset:"+01:00",displayName:"Zurich"},[W.MOSCOW]:{name:"Europe/Moscow",offset:"+03:00",displayName:"Moscow"},[W.DUBAI]:{name:"Asia/Dubai",offset:"+04:00",displayName:"Dubai"},[W.KARACHI]:{name:"Asia/Karachi",offset:"+05:00",displayName:"Karachi"},[W.KOLKATA]:{name:"Asia/Kolkata",offset:"+05:30",displayName:"Kolkata"},[W.SHANGHAI]:{name:"Asia/Shanghai",offset:"+08:00",displayName:"Shanghai"},[W.HONG_KONG]:{name:"Asia/Hong_Kong",offset:"+08:00",displayName:"Hong Kong"},[W.SINGAPORE]:{name:"Asia/Singapore",offset:"+08:00",displayName:"Singapore"},[W.TOKYO]:{name:"Asia/Tokyo",offset:"+09:00",displayName:"Tokyo"},[W.SEOUL]:{name:"Asia/Seoul",offset:"+09:00",displayName:"Seoul"},[W.SYDNEY]:{name:"Australia/Sydney",offset:"+10:00",displayName:"Sydney"},[W.AUCKLAND]:{name:"Pacific/Auckland",offset:"+12:00",displayName:"Auckland"},[W.UTC]:{name:"UTC",offset:"+00:00",displayName:"UTC"}};function el(f,t){if(!f||f.length===0)return[];try{const e=il(t);if(e<=0)return[...f];const i=[];let r=[],a=0;for(let s=0;s<f.length;s++){const n=f[s],o=typeof n.time=="string"?new Date(n.time).getTime()/1e3:n.time,l=Math.floor(o/e)*e;if(r.length===0)r.push(n),a=l;else if(l===a)r.push(n);else{if(r.length>0){const h=Bi(r);i.push(h)}r=[n],a=l}}if(r.length>0){const s=Bi(r);i.push(s)}return i}catch{return f}}function il(f){switch(f){case E.ONE_SECOND:return 1;case E.FIVE_SECONDS:return 5;case E.FIFTEEN_SECONDS:return 15;case E.THIRTY_SECONDS:return 30;case E.ONE_MINUTE:return 60;case E.THREE_MINUTES:return 180;case E.FIVE_MINUTES:return 300;case E.FIFTEEN_MINUTES:return 900;case E.THIRTY_MINUTES:return 1800;case E.FORTY_FIVE_MINUTES:return 2700;case E.ONE_HOUR:return 3600;case E.TWO_HOURS:return 7200;case E.THREE_HOURS:return 10800;case E.FOUR_HOURS:return 14400;case E.SIX_HOURS:return 360*60;case E.EIGHT_HOURS:return 480*60;case E.TWELVE_HOURS:return 720*60;case E.ONE_DAY:return 1440*60;case E.THREE_DAYS:return 4320*60;case E.ONE_WEEK:return 10080*60;case E.TWO_WEEKS:return 336*60*60;case E.ONE_MONTH:return 720*60*60;case E.THREE_MONTHS:return 2160*60*60;case E.SIX_MONTHS:return 4320*60*60;default:return 0}}function Bi(f){if(f.length===1)return{...f[0]};const t=f[0].open,e=f[f.length-1].close;let i=-1/0,r=1/0,a=0;for(const s of f)i=Math.max(i,s.high),r=Math.min(r,s.low),a+=s.volume||0;return{time:f[0].time,open:t,high:i,low:r,close:e,volume:a,isVirtual:f.some(s=>s.isVirtual)}}function me(f,t,e,i){return{timeframe:f.timeframe||E.ONE_DAY,timezone:f.timezone||W.SHANGHAI,shouldExtendVirtualData:!0,virtualDataBeforeCount:e||0,virtualDataAfterCount:i||0,chartType:t}}class ke{static handleData(t,e,i,r){if(!t||t.length===0)return[];try{var a=[];if(r){const s=Ri(t,e.timezone);a=e.shouldExtendVirtualData?this.extendWithVirtualData(s,e):s}else{const s=Ri(t,e.timezone),n=el(s,e.timeframe);a=e.shouldExtendVirtualData?this.extendWithVirtualData(n,e):n}return a}catch{return t}}static extendWithVirtualData(t,e){const i=e.virtualDataBeforeCount??this.calculateOptimalVirtualDataCount(e.timeframe,"before"),r=e.virtualDataAfterCount??this.calculateOptimalVirtualDataCount(e.timeframe,"after");return Zo(t,i,r,e.timeframe)}static calculateOptimalVirtualDataCount(t,e){const r=[E.ONE_SECOND,E.FIVE_SECONDS,E.FIFTEEN_SECONDS,E.THIRTY_SECONDS].includes(t),a=[E.ONE_MINUTE,E.THREE_MINUTES,E.FIVE_MINUTES,E.FIFTEEN_MINUTES,E.THIRTY_MINUTES,E.FORTY_FIVE_MINUTES].includes(t),s=[E.ONE_HOUR,E.TWO_HOURS,E.THREE_HOURS,E.FOUR_HOURS,E.SIX_HOURS,E.EIGHT_HOURS,E.TWELVE_HOURS].includes(t),n=[E.ONE_DAY,E.THREE_DAYS].includes(t),o=[E.ONE_WEEK,E.TWO_WEEKS].includes(t),l=[E.ONE_MONTH,E.THREE_MONTHS,E.SIX_MONTHS].includes(t);return r?Math.min(100,50):a?Math.min(100,80):s?100:n?200:o?300:l?400:100}static handleChartDisplayData(t,e){if(!t||t.length===0)return[];let i=[];try{return e===G.Candle||e===G.HollowCandle||e===G.Bar?i=t.map((r,a)=>{const s={time:r.time,open:Number(r.open),high:Number(r.high),low:Number(r.low),close:Number(r.close),volume:Number(r.volume)};return r.isVirtual?{...s,color:"transparent",borderColor:"transparent",wickColor:"transparent"}:s}):e===G.BaseLine?i=t.map(r=>{const a=r.isVirtual||r.volume===-1,s={time:r.time,value:Number(r.close)};return a?{...s,color:"transparent"}:s}):e===G.Line||e===G.Area||e===G.StepLine?i=t.map(r=>{const a=r.isVirtual||r.volume===-1,s={time:r.time,value:Number(r.close)};return a?{...s,color:"transparent"}:s}):e===G.Histogram?i=t.map(r=>{const a=r.isVirtual||r.volume===-1,s={time:r.time,value:r.volume||0};return a?{...s,color:"transparent"}:{...s,color:(r.volume||0)>100?"#26a69a":"#ef5350"}}):i=t.map(r=>{const a=r.isVirtual||r.volume===-1;return{time:r.time,value:Number(r.close),...a&&{color:"transparent"}}}),i}catch{return[]}}static filterRealData(t){return t.filter(e=>!e.isVirtual&&e.volume!==-1&&e.volume!==0)}static getTimeframeConfig(t){return zi[t]}static validateData(t){return!t||!Array.isArray(t)?!1:t.every(e=>e.time!==void 0&&e.open!==void 0&&e.high!==void 0&&e.low!==void 0&&e.close!==void 0)}static sampleData(t,e=1){if(e>=1||t.length<=1e3)return t;const i=[],r=Math.floor(1/e);for(let a=0;a<t.length;a+=r)a<t.length&&i.push(t[a]);return i}}const At=class At{static getRealDataRange(t){if(t.length===0)return null;let e=-1,i=-1;for(let r=0;r<t.length;r++)if(!t[r].isVirtual){e=r;break}for(let r=t.length-1;r>=0;r--)if(!t[r].isVirtual){i=r;break}return{firstIndex:e,lastIndex:i}}static checkDataPointPositions(t,e,i){if(!t||!e)return;const{firstIndex:r,lastIndex:a}=e,{from:s,to:n}=t,o=r>=s&&r<=n,l=a>=s&&a<=n,h=r<s,d=r>n,g=a<s,c=a>n,p=(n-s)*.1,M=r>=n-p&&r<=n,k=a>=s&&a<=s+p;!this.lastFirstRealDataLeftViewport&&h&&i.onFirstRealDataExitLeftViewport?.(),!this.lastFirstRealDataRightViewport&&d&&i.onFirstRealDataExitRightViewport?.(),!this.lastLastRealDataLeftViewport&&g&&i.onLastRealDataExitLeftViewport?.(),!this.lastLastRealDataRightViewport&&c&&i.onLastRealDataExitRightViewport?.(),this.lastFirstRealDataLeftViewport&&!h&&o&&i.onFirstRealDataEnterLeftViewport?.(),!this.lastFirstRealDataNearRightViewport&&M&&i.onFirstRealDataNearRightViewport?.(),!this.lastLastRealDataNearLeftViewport&&k&&i.onLastRealDataNearLeftViewport?.(),this.lastFirstRealDataNearRightViewport&&!M&&i.onFirstRealDataLeaveNearRightViewport?.(),this.lastLastRealDataNearLeftViewport&&!k&&i.onLastRealDataLeaveNearLeftViewport?.(),this.lastFirstRealDataInViewport&&!o&&i.onFirstRealDataExitViewport?.(),this.lastLastRealDataInViewport&&!l&&i.onLastRealDataExitViewport?.(),this.lastFirstRealDataInViewport=o,this.lastLastRealDataInViewport=l,this.lastFirstRealDataLeftViewport=h,this.lastFirstRealDataRightViewport=d,this.lastLastRealDataLeftViewport=g,this.lastLastRealDataRightViewport=c,this.lastFirstRealDataNearRightViewport=M,this.lastLastRealDataNearLeftViewport=k}static reset(){this.lastFirstRealDataInViewport=!0,this.lastLastRealDataInViewport=!0,this.lastFirstRealDataLeftViewport=!1,this.lastFirstRealDataRightViewport=!1,this.lastLastRealDataLeftViewport=!1,this.lastLastRealDataRightViewport=!1,this.lastFirstRealDataNearRightViewport=!1,this.lastLastRealDataNearLeftViewport=!1}static getCurrentState(){return{lastFirstRealDataInViewport:this.lastFirstRealDataInViewport,lastLastRealDataInViewport:this.lastLastRealDataInViewport,lastFirstRealDataLeftViewport:this.lastFirstRealDataLeftViewport,lastFirstRealDataRightViewport:this.lastFirstRealDataRightViewport,lastLastRealDataLeftViewport:this.lastLastRealDataLeftViewport,lastLastRealDataRightViewport:this.lastLastRealDataRightViewport,lastFirstRealDataNearRightViewport:this.lastFirstRealDataNearRightViewport,lastLastRealDataNearLeftViewport:this.lastLastRealDataNearLeftViewport}}};At.lastFirstRealDataInViewport=!0,At.lastLastRealDataInViewport=!0,At.lastFirstRealDataLeftViewport=!1,At.lastFirstRealDataRightViewport=!1,At.lastLastRealDataLeftViewport=!1,At.lastLastRealDataRightViewport=!1,At.lastFirstRealDataNearRightViewport=!1,At.lastLastRealDataNearLeftViewport=!1;let Ce=At;class rl{constructor(t,e){this.chart=null,this.currentSeries=null,this.beforeViewPortBuffer=100,this.afterViewPortBuffer=0,this.getViewportDataPoints=(i,r)=>{if(!r||r.length===0)return[];const a=i.from-this.beforeViewPortBuffer,s=i.to-this.afterViewPortBuffer;return r.filter(o=>o.time>=a&&o.time<=s)},this.scrollLockState={isScrollLocked:!1,lockDirection:null,safeVisibleRange:null},this.chart=t,this.currentSeries=e}zoomIn(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const a=(e.to-e.from)*.8,s=(e.from+e.to)/2;t.setVisibleRange({from:s-a/2,to:s+a/2})}zoomOut(){if(!this.chart)return;const t=this.chart.timeScale(),e=t.getVisibleRange();if(!e)return;const a=(e.to-e.from)*1.2,s=(e.from+e.to)/2;t.setVisibleRange({from:s-a/2,to:s+a/2})}scrollChart(t){if(!this.chart)return;const e=this.chart.timeScale(),i=e.getVisibleRange();if(!i)return;const a=(i.to-i.from)*.2;t==="left"?e.setVisibleRange({from:i.from-a,to:i.to-a}):e.setVisibleRange({from:i.from+a,to:i.to+a})}positionChart(){this.setOptimalBarSpacing(),this.scrollToRealData()}getVisibleTimeRange(){if(!this.chart)return null;try{const e=this.chart.timeScale().getVisibleRange();return e?{from:e.from,to:e.to}:null}catch(t){return console.error(t),null}}setVisibleTimeRange(t){if(!this.chart||!t)return;const e=this.chart.timeScale();try{e.setVisibleRange({from:t.from,to:t.to})}catch(i){console.error(i),this.scrollToRealData()}}scrollToRealData(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{firstIndex:i,lastIndex:r,virtualAfterCount:a}=this.getRealDataRange();if(i===-1||r===-1){t.fitContent();return}const s=Math.min(100,r-i+1+10),n=Math.max(0,i-5),o=Math.min(e.length-1,r+Math.min(10,a));t.setVisibleLogicalRange({from:n,to:o})}catch(t){console.error(t),this.scrollToStablePosition()}}scrollToStablePosition(){if(this.chart)try{const t=this.chart.timeScale(),e=this.currentSeries?.series?.data||[];if(e.length===0){t.fitContent();return}const{lastIndex:i}=this.getRealDataRange();if(i===-1)t.setVisibleLogicalRange({from:Math.max(0,e.length-50),to:e.length-1});else{const a=Math.max(0,i-50+1),s=Math.min(e.length-1,i+5);t.setVisibleLogicalRange({from:a,to:s})}}catch(t){console.error(t),this.chart&&this.chart.timeScale().fitContent()}}getRealDataRange(){const t=this.currentSeries?.series?.data||[];let e=-1,i=-1,r=0,a=0,s=0;for(let n=0;n<t.length;n++){const o=t[n];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){e=n,a=n;break}}for(let n=t.length-1;n>=0;n--){const o=t[n];if(!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0){i=n,s=t.length-1-n;break}}if(e!==-1&&i!==-1)for(let n=e;n<=i;n++){const o=t[n];!o.isVirtual&&o.volume!==-1&&o.volume!==0&&o.open!==void 0&&o.high!==void 0&&o.low!==void 0&&o.close!==void 0&&r++}return{firstIndex:e,lastIndex:i,realDataCount:r,virtualBeforeCount:a,virtualAfterCount:s}}setOptimalBarSpacing(){if(!this.chart)return;const t=this.chart.timeScale(),i=t.options().barSpacing||10,r=10;let a=r;Math.abs(i-r)>2&&(a=i);try{t.applyOptions({barSpacing:a,minBarSpacing:.5,maxBarSpacing:50})}catch(s){console.error(s)}}handleChartScrollLock(t,e){const i=this.chart.timeScale(),r=Ce.getRealDataRange(e);if(!r)return;const{firstIndex:a,lastIndex:s}=r;if(a!==-1&&s!==-1&&e.length>0){const n=i.getVisibleLogicalRange();if(n){const{from:o,to:l}=n,h=a>=l-1,d=s<=o+1;if(this.scrollLockState.isScrollLocked&&this.scrollLockState.safeVisibleRange&&(this.scrollLockState.lockDirection==="right"?t.from>this.scrollLockState.safeVisibleRange.from+2&&!h&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null):this.scrollLockState.lockDirection==="left"&&t.from<this.scrollLockState.safeVisibleRange.from-2&&!d&&(this.scrollLockState.isScrollLocked=!1,this.scrollLockState.lockDirection=null,this.scrollLockState.safeVisibleRange=null),this.scrollLockState.isScrollLocked)){i.setVisibleRange(this.scrollLockState.safeVisibleRange);return}this.scrollLockState.isScrollLocked||(h?(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="right",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)):d&&(this.scrollLockState.isScrollLocked=!0,this.scrollLockState.lockDirection="left",this.scrollLockState.safeVisibleRange={...t},i.setVisibleRange(this.scrollLockState.safeVisibleRange)))}}}}const sl=new Map([["qwen-turbo",{name:"qwen-turbo",displayName:"Qwen-Turbo",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions","https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation"],format:"openai",description:"Lightweight version, fast response speed, suitable for general conversation scenarios",maxTokens:2e3,contextLength:8e3,capabilities:["text-generation","chat"]}],["qwen-plus",{name:"qwen-plus",displayName:"Qwen-Plus",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"],format:"openai",description:"Enhanced version, suitable for complex tasks and long text processing",maxTokens:6e3,contextLength:32e3,capabilities:["text-generation","chat","reasoning"]}],["qwen-max",{name:"qwen-max",displayName:"Qwen-Max",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"],format:"openai",description:"Maximum version, strongest capabilities, suitable for high-demand professional tasks",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","chat","reasoning","coding","analysis"]}],["qwen-max-longcontext",{name:"qwen-max-longcontext",displayName:"Qwen-Max-LongContext",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",endpoints:["https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions"],format:"openai",description:"Supports 128K long context, suitable for long document processing",maxTokens:8e3,contextLength:128e3,capabilities:["text-generation","chat","document-analysis"]}],["qwen2.5-0.5b",{name:"qwen2.5-0.5b",displayName:"Qwen2.5-0.5B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Ultra-lightweight 0.5B parameter model for edge devices",maxTokens:4e3,contextLength:32e3,capabilities:["text-generation","chat"]}],["qwen2.5-0.5b-instruct",{name:"qwen2.5-0.5b-instruct",displayName:"Qwen2.5-0.5B-Instruct",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Instruction-tuned 0.5B model for specific tasks",maxTokens:4e3,contextLength:32e3,capabilities:["instruction-following","chat"]}],["qwen2.5-7b",{name:"qwen2.5-7b",displayName:"Qwen2.5-7B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"7B parameter base model, balanced performance and efficiency",maxTokens:6e3,contextLength:32e3,capabilities:["text-generation","reasoning"]}],["qwen2.5-7b-instruct",{name:"qwen2.5-7b-instruct",displayName:"Qwen2.5-7B-Instruct",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Instruction-tuned 7B model for chat and tasks",maxTokens:6e3,contextLength:32e3,capabilities:["chat","instruction-following","coding"]}],["qwen2.5-14b",{name:"qwen2.5-14b",displayName:"Qwen2.5-14B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"14B parameter model with enhanced capabilities",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","analysis","reasoning"]}],["qwen2.5-32b",{name:"qwen2.5-32b",displayName:"Qwen2.5-32B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"32B parameter high-performance model",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","complex-reasoning","analysis"]}],["qwen2.5-72b",{name:"qwen2.5-72b",displayName:"Qwen2.5-72B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"72B parameter state-of-the-art model",maxTokens:8e3,contextLength:32e3,capabilities:["text-generation","expert-analysis","research"]}],["qwen2.5-coder",{name:"qwen2.5-coder",displayName:"Qwen2.5-Coder",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized code generation model",maxTokens:8e3,contextLength:32e3,capabilities:["code-generation","code-explanation","debugging"]}],["qwen2.5-coder-7b",{name:"qwen2.5-coder-7b",displayName:"Qwen2.5-Coder-7B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"7B parameter code generation model",maxTokens:8e3,contextLength:32e3,capabilities:["code-generation","programming"]}],["qwen2.5-coder-14b",{name:"qwen2.5-coder-14b",displayName:"Qwen2.5-Coder-14B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"14B parameter advanced code generation model",maxTokens:8e3,contextLength:32e3,capabilities:["code-generation","code-review","optimization"]}],["qwen-vl-lite",{name:"qwen-vl-lite",displayName:"Qwen-VL-Lite",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Lightweight vision-language model for basic image understanding",maxTokens:2e3,contextLength:8e3,capabilities:["image-understanding","visual-qa"]}],["qwen-vl-plus",{name:"qwen-vl-plus",displayName:"Qwen-VL-Plus",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Vision-language model supporting image understanding",maxTokens:4e3,contextLength:32e3,capabilities:["image-understanding","document-analysis","visual-reasoning"]}],["qwen-vl-max",{name:"qwen-vl-max",displayName:"Qwen-VL-Max",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Most powerful vision-language model",maxTokens:8e3,contextLength:32e3,capabilities:["image-understanding","video-analysis","multimodal-reasoning"]}],["qwen-audio-turbo",{name:"qwen-audio-turbo",displayName:"Qwen-Audio-Turbo",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Fast audio processing and speech-to-text model",maxTokens:2e3,contextLength:8e3,capabilities:["speech-recognition","audio-analysis"]}],["qwen-audio-chat",{name:"qwen-audio-chat",displayName:"Qwen-Audio-Chat",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Audio conversation and processing model",maxTokens:4e3,contextLength:32e3,capabilities:["audio-chat","voice-assistant","speech-synthesis"]}],["qwen-math-7b",{name:"qwen-math-7b",displayName:"Qwen-Math-7B",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized for mathematical reasoning and problem solving",maxTokens:4e3,contextLength:32e3,capabilities:["mathematical-reasoning","problem-solving"]}],["llama2-7b-chat-v2",{name:"llama2-7b-chat-v2",displayName:"LLaMA2-7B-Chat",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Meta's LLaMA2-7B model",maxTokens:2e3,contextLength:8e3,capabilities:["chat","text-generation"]}],["baichuan2-7b-chat-v1",{name:"baichuan2-7b-chat-v1",displayName:"Baichuan2-7B-Chat",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Baichuan AI's Baichuan2-7B model",maxTokens:2e3,contextLength:8e3,capabilities:["chat","chinese-nlp"]}],["qwen-financial",{name:"qwen-financial",displayName:"Qwen-Financial",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized for financial analysis and market insights",maxTokens:6e3,contextLength:32e3,capabilities:["financial-analysis","market-prediction","risk-assessment"]}],["qwen-medical",{name:"qwen-medical",displayName:"Qwen-Medical",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Specialized for medical consultation and health analysis",maxTokens:6e3,contextLength:32e3,capabilities:["medical-consultation","health-analysis","diagnostic-support"]}],["qwen-omni",{name:"qwen-omni",displayName:"Qwen-Omni",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Omnidirectional multimodal model supporting text, image, audio",maxTokens:8e3,contextLength:64e3,capabilities:["text-generation","image-understanding","audio-processing","multimodal"]}],["qwen-omni-pro",{name:"qwen-omni-pro",displayName:"Qwen-Omni-Pro",endpoint:"https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",format:"openai",description:"Professional omnidirectional multimodal model with advanced capabilities",maxTokens:16e3,contextLength:128e3,capabilities:["text-generation","multimodal","complex-reasoning","expert-analysis"]}]]);function al(){return Array.from(sl.keys())}const nl=new Map([["deepseek-chat",{name:"deepseek-chat",displayName:"DeepSeek Chat",endpoint:"https://api.deepseek.com/v1/chat/completions",endpoints:["https://api.deepseek.com/v1/chat/completions"],format:"openai",description:"General purpose chat model for everyday conversations and tasks",maxTokens:4096,contextLength:16e3,capabilities:["chat","text-generation","reasoning"],version:"2025-01"}],["deepseek-chat-lite",{name:"deepseek-chat-lite",displayName:"DeepSeek Chat Lite",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Lightweight chat model optimized for speed and efficiency",maxTokens:2048,contextLength:8e3,capabilities:["chat","text-generation"],version:"2025-01"}],["deepseek-chat-pro",{name:"deepseek-chat-pro",displayName:"DeepSeek Chat Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Professional chat model with enhanced reasoning capabilities",maxTokens:8192,contextLength:32e3,capabilities:["chat","text-generation","complex-reasoning","analysis"],version:"2025-01"}],["deepseek-chat-max",{name:"deepseek-chat-max",displayName:"DeepSeek Chat Max",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Maximum capability chat model for most demanding tasks",maxTokens:16384,contextLength:64e3,capabilities:["chat","text-generation","expert-analysis","research"],version:"2025-01"}],["deepseek-coder",{name:"deepseek-coder",displayName:"DeepSeek Coder",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized model for code generation and programming tasks",maxTokens:16384,contextLength:64e3,capabilities:["code-generation","programming","debugging","code-review"],version:"2025-01"}],["deepseek-coder-lite",{name:"deepseek-coder-lite",displayName:"DeepSeek Coder Lite",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Lightweight code generation model",maxTokens:4096,contextLength:16e3,capabilities:["code-generation","programming"],version:"2025-01"}],["deepseek-coder-pro",{name:"deepseek-coder-pro",displayName:"DeepSeek Coder Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Professional code generation model with advanced features",maxTokens:32768,contextLength:128e3,capabilities:["code-generation","programming","system-design","architecture"],version:"2025-01"}],["deepseek-math",{name:"deepseek-math",displayName:"DeepSeek Math",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized model for mathematical reasoning and problem solving",maxTokens:8192,contextLength:32e3,capabilities:["mathematical-reasoning","problem-solving","calculations"],version:"2025-01"}],["deepseek-math-pro",{name:"deepseek-math-pro",displayName:"DeepSeek Math Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Advanced mathematical reasoning model for complex problems",maxTokens:16384,contextLength:64e3,capabilities:["mathematical-reasoning","advanced-calculus","statistics"],version:"2025-01"}],["deepseek-reasoner",{name:"deepseek-reasoner",displayName:"DeepSeek Reasoner",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Dedicated reasoning model for logical analysis",maxTokens:8192,contextLength:32e3,capabilities:["logical-reasoning","analysis","decision-making"],version:"2025-01"}],["deepseek-reasoner-pro",{name:"deepseek-reasoner-pro",displayName:"DeepSeek Reasoner Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Advanced reasoning model for complex logical problems",maxTokens:16384,contextLength:64e3,capabilities:["complex-reasoning","scientific-analysis","research"],version:"2025-01"}],["deepseek-vision",{name:"deepseek-vision",displayName:"DeepSeek Vision",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Vision model for image understanding and analysis",maxTokens:4096,contextLength:16e3,capabilities:["image-understanding","visual-qa","document-analysis"],version:"2025-01"}],["deepseek-vision-pro",{name:"deepseek-vision-pro",displayName:"DeepSeek Vision Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Advanced vision model for complex visual tasks",maxTokens:8192,contextLength:32e3,capabilities:["image-understanding","video-analysis","visual-reasoning"],version:"2025-01"}],["deepseek-finance",{name:"deepseek-finance",displayName:"DeepSeek Finance",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for financial analysis, market prediction, and investment insights",maxTokens:8192,contextLength:32e3,capabilities:["financial-analysis","market-prediction","risk-assessment","investment-advice"],version:"2025-01"}],["deepseek-law",{name:"deepseek-law",displayName:"DeepSeek Law",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for legal analysis, contract review, and legal research",maxTokens:16384,contextLength:64e3,capabilities:["legal-analysis","contract-review","legal-research"],version:"2025-01"}],["deepseek-medical",{name:"deepseek-medical",displayName:"DeepSeek Medical",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for medical consultation, diagnosis support, and health analysis",maxTokens:8192,contextLength:32e3,capabilities:["medical-consultation","diagnostic-support","health-analysis"],version:"2025-01"}],["deepseek-research",{name:"deepseek-research",displayName:"DeepSeek Research",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Specialized for academic research and scientific analysis",maxTokens:32768,contextLength:128e3,capabilities:["academic-research","scientific-analysis","paper-writing"],version:"2025-01"}],["deepseek-omni",{name:"deepseek-omni",displayName:"DeepSeek Omni",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Multimodal model supporting text, image, and audio",maxTokens:16384,contextLength:64e3,capabilities:["text-generation","image-understanding","audio-processing","multimodal"],version:"2025-01"}],["deepseek-omni-pro",{name:"deepseek-omni-pro",displayName:"DeepSeek Omni Pro",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Professional multimodal model with advanced capabilities",maxTokens:32768,contextLength:128e3,capabilities:["text-generation","multimodal","complex-reasoning","expert-analysis"],version:"2025-01"}],["deepseek-llm",{name:"deepseek-llm",displayName:"DeepSeek LLM",endpoint:"https://api.deepseek.com/v1/chat/completions",format:"openai",description:"Base large language model",maxTokens:4096,contextLength:16e3,capabilities:["text-generation"],version:"2024-12"}]]);function ol(){return Array.from(nl.keys())}const ll=new Map([["gpt-4",{name:"gpt-4",displayName:"GPT-4",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Powerful multi-purpose model for complex tasks",maxTokens:8192,contextLength:8192,capabilities:["chat","text-generation","reasoning","analysis"],inputCostPer1KTokens:.03,outputCostPer1KTokens:.06,supportedFeatures:["chat","function-calling"]}],["gpt-4-turbo",{name:"gpt-4-turbo",displayName:"GPT-4 Turbo",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Enhanced GPT-4 with 128K context, knowledge cutoff April 2023",maxTokens:4096,contextLength:128e3,capabilities:["chat","text-generation","reasoning","analysis","vision"],inputCostPer1KTokens:.01,outputCostPer1KTokens:.03,supportedFeatures:["chat","function-calling","vision","json-mode"]}],["gpt-4o",{name:"gpt-4o",displayName:"GPT-4o",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Versatile model supporting text, images, audio with fast response",maxTokens:4096,contextLength:128e3,capabilities:["chat","text-generation","vision","audio-processing","multimodal"],inputCostPer1KTokens:.005,outputCostPer1KTokens:.015,supportedFeatures:["chat","function-calling","vision","audio","json-mode"]}],["gpt-4o-mini",{name:"gpt-4o-mini",displayName:"GPT-4o Mini",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Compact and efficient version of GPT-4o with lower cost",maxTokens:16384,contextLength:128e3,capabilities:["chat","text-generation","vision"],inputCostPer1KTokens:15e-5,outputCostPer1KTokens:6e-4,supportedFeatures:["chat","function-calling","vision","json-mode"]}],["gpt-3.5-turbo",{name:"gpt-3.5-turbo",displayName:"GPT-3.5 Turbo",endpoint:"https://api.openai.com/v1/chat/completions",format:"openai",description:"Fast and cost-effective, suitable for most conversational tasks",maxTokens:4096,contextLength:16385,capabilities:["chat","text-generation","code-generation"],inputCostPer1KTokens:5e-4,outputCostPer1KTokens:.0015,supportedFeatures:["chat","function-calling"]}],["gpt-3.5-turbo-instruct",{name:"gpt-3.5-turbo-instruct",displayName:"GPT-3.5 Turbo Instruct",endpoint:"https://api.openai.com/v1/completions",format:"openai",description:"Instruction-tuned version for text completion tasks",maxTokens:4096,contextLength:4097,capabilities:["text-completion","instruction-following"],inputCostPer1KTokens:.0015,outputCostPer1KTokens:.002,supportedFeatures:["completions"]}],["text-embedding-ada-002",{name:"text-embedding-ada-002",displayName:"Text Embedding Ada 002",endpoint:"https://api.openai.com/v1/embeddings",format:"openai",description:"Text embedding model, 1536 dimensions, suitable for retrieval and similarity",contextLength:8191,capabilities:["embeddings","semantic-search"],inputCostPer1KTokens:1e-4,supportedFeatures:["embeddings"]}],["text-embedding-3-small",{name:"text-embedding-3-small",displayName:"Text Embedding 3 Small",endpoint:"https://api.openai.com/v1/embeddings",format:"openai",description:"Small text embedding model, 1536 dimensions, balance of performance and cost",contextLength:8191,capabilities:["embeddings","semantic-search"],inputCostPer1KTokens:2e-5,supportedFeatures:["embeddings"]}],["dall-e-3",{name:"dall-e-3",displayName:"DALL-E 3",endpoint:"https://api.openai.com/v1/images/generations",format:"openai",description:"Advanced image generation model producing high-quality, high-resolution images",capabilities:["image-generation","creative-design"],inputCostPer1KTokens:.04,supportedFeatures:["image-generation","variations","edits"]}],["whisper-1",{name:"whisper-1",displayName:"Whisper",endpoint:"https://api.openai.com/v1/audio/transcriptions",format:"openai",description:"Speech recognition model supporting multilingual transcription and translation",capabilities:["speech-recognition","audio-transcription","translation"],inputCostPer1KTokens:.006,supportedFeatures:["transcriptions","translations"]}],["tts-1-hd",{name:"tts-1-hd",displayName:"TTS-1 HD",endpoint:"https://api.openai.com/v1/audio/speech",format:"openai",description:"High-quality text-to-speech with multiple voice options",capabilities:["speech-synthesis","text-to-speech"],inputCostPer1KTokens:.015,supportedFeatures:["speech","voice-selection"]}],["text-moderation-latest",{name:"text-moderation-latest",displayName:"Moderation Latest",endpoint:"https://api.openai.com/v1/moderations",format:"openai",description:"Content moderation model for detecting harmful content",capabilities:["content-moderation","safety"],inputCostPer1KTokens:1e-4,supportedFeatures:["moderation"]}]]);function hl(){return Array.from(ll.keys())}var Qi=(f=>(f.AnalyzeOHLCV="/analyzeOHLCV",f))(Qi||{}),_t=(f=>(f.Aliyun="aliyun",f.OpenAI="openai",f.DeepSeek="deepseek",f.Claude="claude",f.Gemini="gemini",f))(_t||{});const cl={aliyun:"https://cdn.simpleicons.org/alibabacloud/FF6A00",openai:"https://cdn.simpleicons.org/openai/412991",deepseek:"https://www.deepseek.com/favicon.ico",claude:"https://cdn.simpleicons.org/anthropic/FF6B35",gemini:"https://cdn.simpleicons.org/google/4285F4"},Ui={aliyun:"Aliyun",openai:"OpenAI",deepseek:"DeepSeek",claude:"Claude",gemini:"Gemini"};function dl(f){switch(f){case"openai":return hl();case"aliyun":return al();case"deepseek":return ol();case"claude":return[];case"gemini":return[];default:return[]}}var Pt=(f=>(f.OpenaiChart="openai-chart",f.OpenaiPredict="openai-predict",f.AliyunChart="aliyun-chart",f.AliyunPredict="aliyun-predict",f.DeepseekChart="deepseek-chart",f.DeepseekPredict="deepseek-predict",f.ClaudeChart="claude-chart",f.ClaudePredict="claude-predict",f.GeminiChart="gemini-chart",f.GeminiPredict="gemini-predict",f))(Pt||{});class ul{isChartType(t){const e=this.aiToolIdToFunctionType(t);return!!(e&&(e===Pt.ClaudeChart||e===Pt.DeepseekChart||e===Pt.AliyunChart||e===Pt.GeminiChart||e===Pt.OpenaiChart))}aiToolIdToFunctionType(t){return Object.values(Pt).includes(t)?t:null}getAITypeFromFunctionType(t){if(!t)return null;const e={openai:_t.OpenAI,aliyun:_t.Aliyun,deepseek:_t.DeepSeek,claude:_t.Claude,gemini:_t.Gemini},i=t.split("-")[0].toLowerCase(),r=e[i];return r!==void 0?r:null}}const gl=["clear","cls","help","theme","history","open","close"],pl=[...Object.values(D).map(f=>f.toLowerCase().replace(/_/g," ")),...Object.values(X).map(f=>f.toLowerCase().replace(/_/g," "))],fl=({currentTheme:f,i18n:t,onCommand:e,placeholder:i="",disabled:r=!1,autoFocus:a=!1,showToolbar:s=!0,initialShow:n=!0,chartLayerRef:o,candleView:l})=>{const[h,d]=y.useState(""),[g,c]=y.useState([]),[u,p]=y.useState(-1),[M,k]=y.useState(!1),[P,S]=y.useState(0),[_,C]=y.useState(n),[v,A]=y.useState([]),[R,U]=y.useState(!1),I=y.useRef(null),N=y.useRef(null),L=t.terminal.isEn==="en",[et,at]=y.useState([]),[$,J]=y.useState(-1),[O,Z]=y.useState(!1);y.useEffect(()=>{A([L?`🕯️ Welcome to CandleView Terminal v1.0 Type 'help' to see available commands
195
195
  This software is licensed under AGPL 3.0
196
196
  Author: <a href="https://github.com/0xhappyboy" target="_blank" rel="noopener noreferrer">GitHub</a> · <a href="https://x.com/0xhappyboy_" target="_blank" rel="noopener noreferrer">X</a> · <a href="mailto:superhappyboy1995@gmail.com" target="_blank" rel="noopener noreferrer">Email</a>
197
197
  GitHub: <a href="https://github.com/0xhappyboy/candleview" target="_blank" rel="noopener noreferrer">https://github.com/0xhappyboy/candleview</a>
@@ -201,7 +201,7 @@ Npm: <a href="https://www.npmjs.com/package/candleview" target="_blank" rel="noo
201
201
  作者: <a href="https://github.com/0xhappyboy" target="_blank" rel="noopener noreferrer">GitHub</a> · <a href="https://x.com/0xhappyboy_" target="_blank" rel="noopener noreferrer">X</a> · <a href="mailto:superhappyboy1995@gmail.com" target="_blank" rel="noopener noreferrer">superhappyboy1995@gmail.com</a>
202
202
  GitHub: <a href="https://github.com/0xhappyboy/candleview" target="_blank" rel="noopener noreferrer">https://github.com/0xhappyboy/candleview</a>
203
203
  开源许可: <a href="https://github.com/0xhappyboy/candleview/blob/main/LICENSE" target="_blank" rel="noopener noreferrer">https://github.com/0xhappyboy/candleview/blob/main/LICENSE</a>
204
- Npm: <a href="https://www.npmjs.com/package/candleview" target="_blank" rel="noopener noreferrer">https://www.npmjs.com/package/candleview</a>`])},[L]),y.useEffect(()=>{if(!h.trim()){at([]),Z(!1);return}const K=h.toLowerCase().trim().split(" "),V=K[K.length-1];let dt=[];if(K.length===1)dt=ml.filter(Mt=>Mt.startsWith(V));else if(K.length===2){const Mt=K[0];Mt==="open"||Mt==="close"?dt=kl.filter(It=>It.startsWith(V)):Mt==="theme"&&(dt=["light","dark"].filter(It=>It.startsWith(V)))}dt=dt.slice(0,5),at(dt),Z(dt.length>0),J(-1)},[h]),y.useEffect(()=>{a&&!r&&_&&I.current?.focus()},[a,r,_]),y.useEffect(()=>{const F=localStorage.getItem("terminal_command_history");if(F)try{const K=JSON.parse(F);c(Array.isArray(K)?K.slice(-50):[])}catch{c([])}},[]);const lt=F=>{const K=h.split(" ");if(K.length===0)return;K[K.length-1]=F;const V=K.join(" ");d(V),Z(!1),J(-1),setTimeout(()=>{I.current&&(I.current.selectionStart=V.length,I.current.selectionEnd=V.length,S(V.length))},0)},ut=F=>{if(!F.trim())return;const K={command:F,timestamp:Date.now()},V=[...g,K].slice(-100);c(V);try{localStorage.setItem("terminal_command_history",JSON.stringify(V))}catch{}},x=F=>{A(K=>[...K,`$ ${F}`])},j=F=>{A(K=>[...K,F])};y.useEffect(()=>{const F=document.querySelector(".terminal-scrollbar");F&&(F.scrollTop=F.scrollHeight)},[v]);const nt=F=>{F.preventDefault();const K=h.trim();K&&(x(K),e&&e(K),Ct(K),ut(K),d(""),p(-1),at([]),Z(!1),J(-1),setTimeout(()=>{const V=document.querySelector(".terminal-scrollbar");V&&(V.scrollTop=V.scrollHeight)},50),!r&&_&&(I.current?.focus(),S(0)))},ct=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...we,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.MA),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Moving Average (MA) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}移动平均线(MA)指标`)},it=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...ve,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.EMA),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Exponential Moving Average (EMA) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}指数移动平均线(EMA)指标`)},B=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...xe,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.BOLLINGER),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Bollinger Bands indicator`:`[<span style="color: #52c41a">信息</span>] ${K}布林带(Bollinger)指标`)},q=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...Ae,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.ICHIMOKU),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Ichimoku Cloud indicator`:`[<span style="color: #52c41a">信息</span>] ${K}一目均衡表(Ichimoku)指标`)},st=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...De,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.BOLLINGER),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Donchian Channel indicator`:`[<span style="color: #52c41a">信息</span>] ${K}唐奇安通道(Donchian)指标`)},ht=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...Fe,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.ENVELOPE),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Envelope indicator`:`[<span style="color: #52c41a">信息</span>] ${K}包络线(Envelope)指标`)},gt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator){const dt={...Ee,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.VWAP),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Volume Weighted Average Price (VWAP) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}成交量加权平均价(VWAP)指标`)},ft=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator){const dt={...ye,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.HEATMAP),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Heatmap indicator`:`[<span style="color: #52c41a">信息</span>] ${K}热力图(Heatmap)指标`)},Tt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator){const dt={...Re,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.MARKETPROFILE),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Market Profile indicator`:`[<span style="color: #52c41a">信息</span>] ${K}市场概况(Market Profile)指标`)},kt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.RSI),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.RSI),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Relative Strength Index (RSI) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}相对强弱指数(RSI)指标`)},xt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.MACD),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.MACD),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Moving Average Convergence Divergence (MACD) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}指数平滑异同移动平均线(MACD)指标`)},Et=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.VOLUME),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.VOLUME),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Volume indicator`:`[<span style="color: #52c41a">信息</span>] ${K}成交量(Volume)指标`)},yt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.SAR),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.SAR),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Parabolic SAR indicator`:`[<span style="color: #52c41a">信息</span>] ${K}抛物线转向(SAR)指标`)},Rt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.KDJ),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.KDJ),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} KDJ indicator`:`[<span style="color: #52c41a">信息</span>] ${K}随机指标(KDJ)`)},jt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.ATR),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.ATR),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Average True Range (ATR) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}平均真实波幅(ATR)指标`)},z=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.STOCHASTIC),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.STOCHASTIC),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Stochastic Oscillator indicator`:`[<span style="color: #52c41a">信息</span>] ${K}随机震荡指标(Stochastic)`)},H=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.CCI),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.CCI),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Commodity Channel Index (CCI) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}商品通道指数(CCI)指标`)},Q=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.BBWIDTH),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.BBWIDTH),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Bollinger Bands Width (BBWIDTH) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}布林带宽度(BBWIDTH)指标`)},tt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.ADX),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.ADX),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Average Directional Index (ADX) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}平均趋向指数(ADX)指标`)},bt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.OBV),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.OBV),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} On Balance Volume (OBV) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}能量潮(OBV)指标`)},Ct=F=>{const K=F.toLowerCase().trim();if(K.startsWith("open ")||K.startsWith("close ")){const[V,...dt]=K.split(" "),Mt=dt.join(" ").toUpperCase(),It=Object.values(D).includes(Mt),Ue=Object.values(X).includes(Mt);if(!It&&!Ue){const Vt=Object.values(D).map(Wt=>Wt.toLowerCase().replace(/_/g," ")).join(", "),Ft=Object.values(X).map(Wt=>Wt.toLowerCase().replace(/_/g," ")).join(", ");j(L?`[<span style="color: #c41a1aff">ERROR</span>] Invalid indicator: "${Mt}".
204
+ Npm: <a href="https://www.npmjs.com/package/candleview" target="_blank" rel="noopener noreferrer">https://www.npmjs.com/package/candleview</a>`])},[L]),y.useEffect(()=>{if(!h.trim()){at([]),Z(!1);return}const K=h.toLowerCase().trim().split(" "),V=K[K.length-1];let dt=[];if(K.length===1)dt=gl.filter(Mt=>Mt.startsWith(V));else if(K.length===2){const Mt=K[0];Mt==="open"||Mt==="close"?dt=pl.filter(It=>It.startsWith(V)):Mt==="theme"&&(dt=["light","dark"].filter(It=>It.startsWith(V)))}dt=dt.slice(0,5),at(dt),Z(dt.length>0),J(-1)},[h]),y.useEffect(()=>{a&&!r&&_&&I.current?.focus()},[a,r,_]),y.useEffect(()=>{const F=localStorage.getItem("terminal_command_history");if(F)try{const K=JSON.parse(F);c(Array.isArray(K)?K.slice(-50):[])}catch{c([])}},[]);const lt=F=>{const K=h.split(" ");if(K.length===0)return;K[K.length-1]=F;const V=K.join(" ");d(V),Z(!1),J(-1),setTimeout(()=>{I.current&&(I.current.selectionStart=V.length,I.current.selectionEnd=V.length,S(V.length))},0)},ut=F=>{if(!F.trim())return;const K={command:F,timestamp:Date.now()},V=[...g,K].slice(-100);c(V);try{localStorage.setItem("terminal_command_history",JSON.stringify(V))}catch{}},x=F=>{A(K=>[...K,`$ ${F}`])},j=F=>{A(K=>[...K,F])};y.useEffect(()=>{const F=document.querySelector(".terminal-scrollbar");F&&(F.scrollTop=F.scrollHeight)},[v]);const nt=F=>{F.preventDefault();const K=h.trim();K&&(x(K),e&&e(K),Ct(K),ut(K),d(""),p(-1),at([]),Z(!1),J(-1),setTimeout(()=>{const V=document.querySelector(".terminal-scrollbar");V&&(V.scrollTop=V.scrollHeight)},50),!r&&_&&(I.current?.focus(),S(0)))},ct=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...we,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.MA),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Moving Average (MA) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}移动平均线(MA)指标`)},it=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...ve,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.EMA),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Exponential Moving Average (EMA) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}指数移动平均线(EMA)指标`)},B=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...xe,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.BOLLINGER),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Bollinger Bands indicator`:`[<span style="color: #52c41a">信息</span>] ${K}布林带(Bollinger)指标`)},q=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...Ae,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.ICHIMOKU),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Ichimoku Cloud indicator`:`[<span style="color: #52c41a">信息</span>] ${K}一目均衡表(Ichimoku)指标`)},st=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...De,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.BOLLINGER),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Donchian Channel indicator`:`[<span style="color: #52c41a">信息</span>] ${K}唐奇安通道(Donchian)指标`)},ht=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator&&F){const dt={...Fe,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.ENVELOPE),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Envelope indicator`:`[<span style="color: #52c41a">信息</span>] ${K}包络线(Envelope)指标`)},gt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator){const dt={...Ee,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.VWAP),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Volume Weighted Average Price (VWAP) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}成交量加权平均价(VWAP)指标`)},ft=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator){const dt={...ye,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.HEATMAP),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Heatmap indicator`:`[<span style="color: #52c41a">信息</span>] ${K}热力图(Heatmap)指标`)},Tt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";if(l?.handleSelectedMainChartIndicator){const dt={...Re,nonce:Date.now()};l.handleSelectedMainChartIndicator(dt)}o?.current&&!F&&o?.current.handleRemoveIndicator&&o?.current.handleRemoveIndicator(D.MARKETPROFILE),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Market Profile indicator`:`[<span style="color: #52c41a">信息</span>] ${K}市场概况(Market Profile)指标`)},kt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.RSI),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.RSI),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Relative Strength Index (RSI) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}相对强弱指数(RSI)指标`)},xt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.MACD),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.MACD),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Moving Average Convergence Divergence (MACD) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}指数平滑异同移动平均线(MACD)指标`)},Et=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.VOLUME),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.VOLUME),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Volume indicator`:`[<span style="color: #52c41a">信息</span>] ${K}成交量(Volume)指标`)},yt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.SAR),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.SAR),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Parabolic SAR indicator`:`[<span style="color: #52c41a">信息</span>] ${K}抛物线转向(SAR)指标`)},Rt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.KDJ),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.KDJ),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} KDJ indicator`:`[<span style="color: #52c41a">信息</span>] ${K}随机指标(KDJ)`)},jt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.ATR),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.ATR),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Average True Range (ATR) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}平均真实波幅(ATR)指标`)},z=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.STOCHASTIC),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.STOCHASTIC),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Stochastic Oscillator indicator`:`[<span style="color: #52c41a">信息</span>] ${K}随机震荡指标(Stochastic)`)},H=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.CCI),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.CCI),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Commodity Channel Index (CCI) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}商品通道指数(CCI)指标`)},Q=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.BBWIDTH),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.BBWIDTH),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Bollinger Bands Width (BBWIDTH) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}布林带宽度(BBWIDTH)指标`)},tt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.ADX),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.ADX),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} Average Directional Index (ADX) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}平均趋向指数(ADX)指标`)},bt=F=>{const K=F?"开启":"关闭",V=F?"Opening":"Closing";l?.handleExternalSelectedSubChartIndicator&&F&&l.handleExternalSelectedSubChartIndicator(X.OBV),l?.handleRemoveSubChartIndicator&&!F&&l.handleRemoveSubChartIndicator(X.OBV),j(L?`[<span style="color: #52c41a">INFO</span>] ${V} On Balance Volume (OBV) indicator`:`[<span style="color: #52c41a">信息</span>] ${K}能量潮(OBV)指标`)},Ct=F=>{const K=F.toLowerCase().trim();if(K.startsWith("open ")||K.startsWith("close ")){const[V,...dt]=K.split(" "),Mt=dt.join(" ").toUpperCase(),It=Object.values(D).includes(Mt),Ue=Object.values(X).includes(Mt);if(!It&&!Ue){const Vt=Object.values(D).map(Wt=>Wt.toLowerCase().replace(/_/g," ")).join(", "),Ft=Object.values(X).map(Wt=>Wt.toLowerCase().replace(/_/g," ")).join(", ");j(L?`[<span style="color: #c41a1aff">ERROR</span>] Invalid indicator: "${Mt}".
205
205
  Main chart indicators: ${Vt}
206
206
  Sub chart indicators: ${Ft}`:`[<span style="color: #c41a1aff">错误</span>] 无效的指标: "${Mt}"。
207
207
  主图指标: ${Vt}
@@ -256,7 +256,7 @@ ${V}`)}else j(L?`Command executed: ${F}`:`命令已执行: ${F}`)},Dt=F=>{if(!r)
256
256
  .terminal-scrollbar a:hover {
257
257
  text-decoration: underline;
258
258
  }
259
- `})]})},Sl=f=>[{id:"smileys",name:f?.emoji?.categories?.smileys||"表情",getName:t=>t?.emoji?.categories?.smileys||"表情"},{id:"people",name:f?.emoji?.categories?.people||"人物",getName:t=>t?.emoji?.categories?.people||"人物"},{id:"animals",name:f?.emoji?.categories?.animals||"动物",getName:t=>t?.emoji?.categories?.animals||"动物"},{id:"food",name:f?.emoji?.categories?.food||"食物",getName:t=>t?.emoji?.categories?.food||"食物"},{id:"activities",name:f?.emoji?.categories?.activities||"活动",getName:t=>t?.emoji?.categories?.activities||"活动"},{id:"travel",name:f?.emoji?.categories?.travel||"旅行",getName:t=>t?.emoji?.categories?.travel||"旅行"},{id:"objects",name:f?.emoji?.categories?.objects||"物品",getName:t=>t?.emoji?.categories?.objects||"物品"},{id:"symbols",name:f?.emoji?.categories?.symbols||"符号",getName:t=>t?.emoji?.categories?.symbols||"符号"},{id:"flags",name:f?.emoji?.categories?.flags||"旗帜",getName:t=>t?.emoji?.categories?.flags||"旗帜"}],_l=[{character:"😀",name:"笑脸",category:"smileys"},{character:"😃",name:"大笑",category:"smileys"},{character:"😄",name:"微笑",category:"smileys"},{character:"😁",name:"笑嘻嘻",category:"smileys"},{character:"😆",name:"哈哈笑",category:"smileys"},{character:"😅",name:"流汗笑",category:"smileys"},{character:"😂",name:"笑哭",category:"smileys"},{character:"🤣",name:"打滚笑",category:"smileys"},{character:"😊",name:"微笑脸",category:"smileys"},{character:"😇",name:"天使",category:"smileys"},{character:"🙂",name:"微微笑",category:"smileys"},{character:"🙃",name:"倒脸",category:"smileys"},{character:"😉",name:"眨眼",category:"smileys"},{character:"😍",name:"爱心眼",category:"smileys"},{character:"🥰",name:"微笑爱心",category:"smileys"},{character:"😘",name:"飞吻",category:"smileys"},{character:"😋",name:"美味",category:"smileys"},{character:"😎",name:"墨镜",category:"smileys"},{character:"🤩",name:"星星眼",category:"smileys"},{character:"🥳",name:"派对",category:"smileys"},{character:"😏",name:"得意",category:"smileys"},{character:"😢",name:"哭泣",category:"smileys"},{character:"😭",name:"大哭",category:"smileys"},{character:"😡",name:"愤怒",category:"smileys"},{character:"🤯",name:"爆炸头",category:"smileys"},{character:"🥺",name:"恳求脸",category:"smileys"},{character:"😱",name:"尖叫",category:"smileys"},{character:"🤔",name:"思考",category:"smileys"},{character:"😴",name:"睡觉",category:"smileys"},{character:"😷",name:"口罩",category:"smileys"},{character:"🤒",name:"生病",category:"smileys"},{character:"🤕",name:"受伤",category:"smileys"},{character:"🥶",name:"冷脸",category:"smileys"},{character:"🥵",name:"热脸",category:"smileys"},{character:"😈",name:"小恶魔",category:"smileys"},{character:"👿",name:"恶魔",category:"smileys"},{character:"💀",name:"骷髅",category:"smileys"},{character:"👻",name:"鬼魂",category:"smileys"},{character:"👽",name:"外星人",category:"smileys"},{character:"🤖",name:"机器人",category:"smileys"},{character:"👶",name:"婴儿",category:"people"},{character:"👧",name:"女孩",category:"people"},{character:"👦",name:"男孩",category:"people"},{character:"👩",name:"女人",category:"people"},{character:"👨",name:"男人",category:"people"},{character:"👵",name:"老奶奶",category:"people"},{character:"👴",name:"老爷爷",category:"people"},{character:"👮‍♀️",name:"女警察",category:"people"},{character:"👮‍♂️",name:"男警察",category:"people"},{character:"👷‍♀️",name:"女建筑工人",category:"people"},{character:"👷‍♂️",name:"男建筑工人",category:"people"},{character:"👩‍⚕️",name:"女医生",category:"people"},{character:"👨‍⚕️",name:"男医生",category:"people"},{character:"👩‍🍳",name:"女厨师",category:"people"},{character:"👨‍🍳",name:"男厨师",category:"people"},{character:"👩‍🎓",name:"女学生",category:"people"},{character:"👨‍🎓",name:"男学生",category:"people"},{character:"👸",name:"公主",category:"people"},{character:"🤴",name:"王子",category:"people"},{character:"🦸‍♀️",name:"女超级英雄",category:"people"},{character:"🦸‍♂️",name:"男超级英雄",category:"people"},{character:"🦹‍♀️",name:"女超级反派",category:"people"},{character:"🦹‍♂️",name:"男超级反派",category:"people"},{character:"🧙‍♀️",name:"女法师",category:"people"},{character:"🧙‍♂️",name:"男法师",category:"people"},{character:"🧚‍♀️",name:"仙女",category:"people"},{character:"🧚‍♂️",name:"精灵",category:"people"},{character:"🧛‍♀️",name:"女吸血鬼",category:"people"},{character:"🧛‍♂️",name:"男吸血鬼",category:"people"},{character:"🧜‍♀️",name:"美人鱼",category:"people"},{character:"🧜‍♂️",name:"男人鱼",category:"people"},{character:"🧝‍♀️",name:"女精灵",category:"people"},{character:"🧝‍♂️",name:"男精灵",category:"people"},{character:"👼",name:"天使宝宝",category:"people"},{character:"💁‍♀️",name:"女信息台",category:"people"},{character:"💁‍♂️",name:"男信息台",category:"people"},{character:"🙅‍♀️",name:"女禁止",category:"people"},{character:"🙅‍♂️",name:"男禁止",category:"people"},{character:"💆‍♀️",name:"女按摩",category:"people"},{character:"💆‍♂️",name:"男按摩",category:"people"},{character:"🐵",name:"猴脸",category:"animals"},{character:"🐒",name:"猴子",category:"animals"},{character:"🐶",name:"狗脸",category:"animals"},{character:"🐕",name:"狗",category:"animals"},{character:"🐩",name:"贵宾犬",category:"animals"},{character:"🐺",name:"狼",category:"animals"},{character:"🦊",name:"狐狸",category:"animals"},{character:"🐱",name:"猫脸",category:"animals"},{character:"🐈",name:"猫",category:"animals"},{character:"🦁",name:"狮子",category:"animals"},{character:"🐯",name:"老虎脸",category:"animals"},{character:"🐴",name:"马脸",category:"animals"},{character:"🦄",name:"独角兽",category:"animals"},{character:"🦓",name:"斑马",category:"animals"},{character:"🐮",name:"牛脸",category:"animals"},{character:"🐷",name:"猪脸",category:"animals"},{character:"🐭",name:"老鼠脸",category:"animals"},{character:"🐹",name:"仓鼠",category:"animals"},{character:"🐰",name:"兔子脸",category:"animals"},{character:"🐻",name:"熊",category:"animals"},{character:"🐨",name:"考拉",category:"animals"},{character:"🐼",name:"熊猫",category:"animals"},{character:"🐔",name:"鸡",category:"animals"},{character:"🐦",name:"鸟",category:"animals"},{character:"🐧",name:"企鹅",category:"animals"},{character:"🦅",name:"鹰",category:"animals"},{character:"🦆",name:"鸭",category:"animals"},{character:"🦉",name:"猫头鹰",category:"animals"},{character:"🦇",name:"蝙蝠",category:"animals"},{character:"🐸",name:"青蛙",category:"animals"},{character:"🐢",name:"乌龟",category:"animals"},{character:"🐍",name:"蛇",category:"animals"},{character:"🐊",name:"鳄鱼",category:"animals"},{character:"🦖",name:"霸王龙",category:"animals"},{character:"🦕",name:"蜥脚类恐龙",category:"animals"},{character:"🐬",name:"海豚",category:"animals"},{character:"🐳",name:"鲸鱼",category:"animals"},{character:"🦭",name:"海豹",category:"animals"},{character:"🐙",name:"章鱼",category:"animals"},{character:"🦑",name:"乌贼",category:"animals"},{character:"🦐",name:"虾",category:"animals"},{character:"🍎",name:"红苹果",category:"food"},{character:"🍐",name:"梨",category:"food"},{character:"🍊",name:"橙子",category:"food"},{character:"🍋",name:"柠檬",category:"food"},{character:"🍌",name:"香蕉",category:"food"},{character:"🍉",name:"西瓜",category:"food"},{character:"🍇",name:"葡萄",category:"food"},{character:"🍓",name:"草莓",category:"food"},{character:"🍑",name:"桃子",category:"food"},{character:"🍍",name:"菠萝",category:"food"},{character:"🥭",name:"芒果",category:"food"},{character:"🥥",name:"椰子",category:"food"},{character:"🥑",name:"牛油果",category:"food"},{character:"🍅",name:"番茄",category:"food"},{character:"🍆",name:"茄子",category:"food"},{character:"🥦",name:"西兰花",category:"food"},{character:"🥕",name:"胡萝卜",category:"food"},{character:"🌽",name:"玉米",category:"food"},{character:"🍞",name:"面包",category:"food"},{character:"🥐",name:"牛角包",category:"food"},{character:"🧀",name:"奶酪",category:"food"},{character:"🍗",name:"鸡腿",category:"food"},{character:"🍔",name:"汉堡",category:"food"},{character:"🍕",name:"披萨",category:"food"},{character:"🌭",name:"热狗",category:"food"},{character:"🥪",name:"三明治",category:"food"},{character:"🌮",name:"墨西哥卷饼",category:"food"},{character:"🌯",name:"墨西哥卷",category:"food"},{character:"🥗",name:"沙拉",category:"food"},{character:"🍲",name:"火锅",category:"food"},{character:"🥣",name:"碗和勺子",category:"food"},{character:"🍛",name:"咖喱饭",category:"food"},{character:"🍜",name:"面条",category:"food"},{character:"🍝",name:"意大利面",category:"food"},{character:"🍣",name:"寿司",category:"food"},{character:"🍤",name:"炸虾",category:"food"},{character:"🍙",name:"饭团",category:"food"},{character:"🍚",name:"米饭",category:"food"},{character:"🍦",name:"冰淇淋",category:"food"},{character:"🍧",name:"刨冰",category:"food"},{character:"⚽",name:"足球",category:"activities"},{character:"🏀",name:"篮球",category:"activities"},{character:"🏈",name:"美式足球",category:"activities"},{character:"⚾",name:"棒球",category:"activities"},{character:"🎾",name:"网球",category:"activities"},{character:"🏐",name:"排球",category:"activities"},{character:"🎱",name:"台球",category:"activities"},{character:"🏓",name:"乒乓球",category:"activities"},{character:"🏸",name:"羽毛球",category:"activities"},{character:"🥊",name:"拳击手套",category:"activities"},{character:"🎯",name:"射箭靶",category:"activities"},{character:"🎳",name:"保龄球",category:"activities"},{character:"🏹",name:"弓和箭",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"⛸️",name:"溜冰鞋",category:"activities"},{character:"🎿",name:"滑雪",category:"activities"},{character:"🏒",name:"冰球",category:"activities"},{character:"🏏",name:"板球",category:"activities"},{character:"🏆",name:"奖杯",category:"activities"},{character:"🥇",name:"金牌",category:"activities"},{character:"🥈",name:"银牌",category:"activities"},{character:"🥉",name:"铜牌",category:"activities"},{character:"🎖️",name:"军奖章",category:"activities"},{character:"🏅",name:"运动奖牌",category:"activities"},{character:"🤿",name:"潜水装备",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"🎪",name:"马戏团帐篷",category:"activities"},{character:"🎭",name:"表演艺术",category:"activities"},{character:"🎨",name:"艺术家调色板",category:"activities"},{character:"🎬",name:"场记板",category:"activities"},{character:"🎤",name:"麦克风",category:"activities"},{character:"🎧",name:"耳机",category:"activities"},{character:"🎼",name:"乐谱",category:"activities"},{character:"🎹",name:"电子琴",category:"activities"},{character:"🥁",name:"鼓",category:"activities"},{character:"🎷",name:"萨克斯",category:"activities"},{character:"🎺",name:"小号",category:"activities"},{character:"🎸",name:"吉他",category:"activities"},{character:"🪕",name:"班卓琴",category:"activities"},{character:"🎻",name:"小提琴",category:"activities"},{character:"🚗",name:"汽车",category:"travel"},{character:"🚕",name:"出租车",category:"travel"},{character:"🚙",name:"SUV",category:"travel"},{character:"🚌",name:"巴士",category:"travel"},{character:"🚎",name:"电车",category:"travel"},{character:"🏎️",name:"赛车",category:"travel"},{character:"🚓",name:"警车",category:"travel"},{character:"🚑",name:"救护车",category:"travel"},{character:"🚒",name:"消防车",category:"travel"},{character:"🚐",name:"小巴",category:"travel"},{character:"🚚",name:"卡车",category:"travel"},{character:"🚛",name:"铰接式卡车",category:"travel"},{character:"🚲",name:"自行车",category:"travel"},{character:"🛴",name:"滑板车",category:"travel"},{character:"🚁",name:"直升机",category:"travel"},{character:"✈️",name:"飞机",category:"travel"},{character:"🛩️",name:"小飞机",category:"travel"},{character:"🛫",name:"飞机起飞",category:"travel"},{character:"🛬",name:"飞机降落",category:"travel"},{character:"🚀",name:"火箭",category:"travel"},{character:"🛸",name:"飞碟",category:"travel"},{character:"🚂",name:"火车头",category:"travel"},{character:"🚃",name:"火车车厢",category:"travel"},{character:"🚄",name:"高速列车",category:"travel"},{character:"🚅",name:"子弹头列车",category:"travel"},{character:"🚆",name:"火车",category:"travel"},{character:"🚇",name:"地铁",category:"travel"},{character:"🚈",name:"轻轨",category:"travel"},{character:"🚉",name:"车站",category:"travel"},{character:"🚊",name:"电车",category:"travel"},{character:"🚝",name:"单轨铁路",category:"travel"},{character:"🚞",name:"山区铁路",category:"travel"},{character:"🚋",name:"有轨电车",category:"travel"},{character:"🚠",name:"缆车",category:"travel"},{character:"🚡",name:"空中缆车",category:"travel"},{character:"🚢",name:"船",category:"travel"},{character:"⛵",name:"帆船",category:"travel"},{character:"🛶",name:"独木舟",category:"travel"},{character:"🚤",name:"快艇",category:"travel"},{character:"⛴️",name:"渡轮",category:"travel"},{character:"⌚",name:"手表",category:"objects"},{character:"📱",name:"手机",category:"objects"},{character:"📲",name:"手机箭头",category:"objects"},{character:"💻",name:"笔记本电脑",category:"objects"},{character:"⌨️",name:"键盘",category:"objects"},{character:"🖥️",name:"台式电脑",category:"objects"},{character:"🖨️",name:"打印机",category:"objects"},{character:"🖱️",name:"电脑鼠标",category:"objects"},{character:"🕹️",name:"游戏摇杆",category:"objects"},{character:"📷",name:"相机",category:"objects"},{character:"📹",name:"摄像机",category:"objects"},{character:"🎥",name:"电影摄像机",category:"objects"},{character:"📺",name:"电视",category:"objects"},{character:"📻",name:"收音机",category:"objects"},{character:"🎙️",name:"录音麦克风",category:"objects"},{character:"🎚️",name:"音量滑块",category:"objects"},{character:"🎛️",name:"控制旋钮",category:"objects"},{character:"📞",name:"电话听筒",category:"objects"},{character:"📟",name:"寻呼机",category:"objects"},{character:"📠",name:"传真机",category:"objects"},{character:"🔦",name:"手电筒",category:"objects"},{character:"🕯️",name:"蜡烛",category:"objects"},{character:"💡",name:"灯泡",category:"objects"},{character:"🔌",name:"电源插头",category:"objects"},{character:"🔋",name:"电池",category:"objects"},{character:"🪫",name:"低电量",category:"objects"},{character:"💰",name:"钱袋",category:"objects"},{character:"💎",name:"宝石",category:"objects"},{character:"💳",name:"信用卡",category:"objects"},{character:"🧮",name:"算盘",category:"objects"},{character:"📿",name:"念珠",category:"objects"},{character:"🧷",name:"安全别针",category:"objects"},{character:"🔑",name:"钥匙",category:"objects"},{character:"🗝️",name:"老钥匙",category:"objects"},{character:"🛡️",name:"盾牌",category:"objects"},{character:"💊",name:"药丸",category:"objects"},{character:"🧴",name:"乳液瓶",category:"objects"},{character:"🧹",name:"扫帚",category:"objects"},{character:"🧺",name:"篮子",category:"objects"},{character:"🪣",name:"桶",category:"objects"},{character:"❤️",name:"红心",category:"symbols"},{character:"🧡",name:"橙心",category:"symbols"},{character:"💛",name:"黄心",category:"symbols"},{character:"💚",name:"绿心",category:"symbols"},{character:"💙",name:"蓝心",category:"symbols"},{character:"💜",name:"紫心",category:"symbols"},{character:"🖤",name:"黑心",category:"symbols"},{character:"💔",name:"破碎的心",category:"symbols"},{character:"❣️",name:"心叹号",category:"symbols"},{character:"💕",name:"两颗心",category:"symbols"},{character:"💞",name:"旋转的心",category:"symbols"},{character:"💓",name:"跳动的心",category:"symbols"},{character:"💗",name:"长大的心",category:"symbols"},{character:"💖",name:"闪亮的心",category:"symbols"},{character:"💘",name:"箭穿心",category:"symbols"},{character:"💝",name:"丝带心",category:"symbols"},{character:"💟",name:"心形装饰",category:"symbols"},{character:"☮️",name:"和平符号",category:"symbols"},{character:"✝️",name:"拉丁十字架",category:"symbols"},{character:"☪️",name:"星月",category:"symbols"},{character:"🕉️",name:"奥姆符号",category:"symbols"},{character:"✡️",name:"大卫之星",category:"symbols"},{character:"🔯",name:"六角星",category:"symbols"},{character:"🪬",name:"手掌法蒂玛",category:"symbols"},{character:"♈",name:"白羊座",category:"symbols"},{character:"♉",name:"金牛座",category:"symbols"},{character:"♊",name:"双子座",category:"symbols"},{character:"♋",name:"巨蟹座",category:"symbols"},{character:"♌",name:"狮子座",category:"symbols"},{character:"♍",name:"处女座",category:"symbols"},{character:"♎",name:"天秤座",category:"symbols"},{character:"♏",name:"天蝎座",category:"symbols"},{character:"♐",name:"射手座",category:"symbols"},{character:"♑",name:"摩羯座",category:"symbols"},{character:"♒",name:"水瓶座",category:"symbols"},{character:"♓",name:"双鱼座",category:"symbols"},{character:"⛎",name:"蛇夫座",category:"symbols"},{character:"🔀",name:"随机播放",category:"symbols"},{character:"🔁",name:"重复",category:"symbols"},{character:"🔂",name:"重复一次",category:"symbols"},{character:"🏁",name:"方格旗",category:"flags"},{character:"🚩",name:"三角旗",category:"flags"},{character:"🎌",name:"交叉旗",category:"flags"},{character:"🏴",name:"黑旗",category:"flags"},{character:"🏳️",name:"白旗",category:"flags"},{character:"🏳️‍🌈",name:"彩虹旗",category:"flags"},{character:"🏴‍☠️",name:"海盗旗",category:"flags"},{character:"🇺🇳",name:"联合国",category:"flags"},{character:"🇺🇸",name:"美国",category:"flags"},{character:"🇬🇧",name:"英国",category:"flags"},{character:"🇨🇳",name:"中国",category:"flags"},{character:"🇯🇵",name:"日本",category:"flags"},{character:"🇰🇷",name:"韩国",category:"flags"},{character:"🇩🇪",name:"德国",category:"flags"},{character:"🇫🇷",name:"法国",category:"flags"},{character:"🇮🇹",name:"意大利",category:"flags"},{character:"🇷🇺",name:"俄罗斯",category:"flags"},{character:"🇨🇦",name:"加拿大",category:"flags"},{character:"🇦🇺",name:"澳大利亚",category:"flags"},{character:"🇧🇷",name:"巴西",category:"flags"},{character:"🇮🇳",name:"印度",category:"flags"},{character:"🇪🇸",name:"西班牙",category:"flags"},{character:"🇲🇽",name:"墨西哥",category:"flags"},{character:"🇮🇩",name:"印度尼西亚",category:"flags"},{character:"🇳🇱",name:"荷兰",category:"flags"},{character:"🇨🇭",name:"瑞士",category:"flags"},{character:"🇸🇪",name:"瑞典",category:"flags"},{character:"🇳🇴",name:"挪威",category:"flags"},{character:"🇩🇰",name:"丹麦",category:"flags"},{character:"🇫🇮",name:"芬兰",category:"flags"},{character:"🇵🇱",name:"波兰",category:"flags"},{character:"🇹🇷",name:"土耳其",category:"flags"},{character:"🇸🇦",name:"沙特阿拉伯",category:"flags"},{character:"🇿🇦",name:"南非",category:"flags"},{character:"🇪🇬",name:"埃及",category:"flags"},{character:"🇳🇬",name:"尼日利亚",category:"flags"},{character:"🇦🇷",name:"阿根廷",category:"flags"},{character:"🇨🇱",name:"智利",category:"flags"},{character:"🇵🇪",name:"秘鲁",category:"flags"},{character:"🇻🇪",name:"委内瑞拉",category:"flags"}],Gi=f=>({cursorStyles:[{id:"default",name:f.leftPanel.cursorArrow,description:f.leftPanel.cursorArrowDesc,icon:ka},{id:"crosshair",name:f.leftPanel.cursorCrosshair,description:f.leftPanel.cursorCrosshairDesc,icon:fa},{id:"circle",name:f.leftPanel.cursorCircle,description:f.leftPanel.cursorCircleDesc,icon:Ma},{id:"dot",name:f.leftPanel.cursorDot,description:f.leftPanel.cursorDotDesc,icon:ma},{id:"sparkle",name:f.leftPanel.cursorSparkle,description:f.leftPanel.cursorSparkleDesc,icon:Pa},{id:"emoji",name:f.leftPanel.cursorEmoji,description:f.leftPanel.cursorEmojiDesc,icon:Sa}],penTools:[{title:f.leftPanel.penTools,tools:[{id:"pencil",name:f.leftPanel.pencil,description:f.leftPanel.pencilDesc,icon:Yi},{id:"pen",name:f.leftPanel.pen,description:f.leftPanel.penDesc,icon:On},{id:"brush",name:f.leftPanel.brush,description:f.leftPanel.brushDesc,icon:Vi},{id:"marker-pen",name:f.leftPanel.markerPen,description:f.leftPanel.markerPenDesc,icon:jn},{id:"eraser",name:f.leftPanel.eraser,description:f.leftPanel.eraserDesc,icon:Wn}]}],drawingTools:[{title:f.leftPanel.lineTools,tools:[{id:"line-segment",name:f.leftPanel.lineSegment,description:f.leftPanel.lineSegmentDesc,icon:tn},{id:"horizontal-line",name:f.leftPanel.horizontalLine,description:f.leftPanel.horizontalLineDesc,icon:en},{id:"vertical-line",name:f.leftPanel.verticalLine,description:f.leftPanel.verticalLineDesc,icon:rn}]},{title:f.leftPanel.arrowTools,tools:[{id:"arrow-line",name:f.leftPanel.arrowLine,description:f.leftPanel.arrowLineDesc,icon:sn},{id:"thick-arrow-line",name:f.leftPanel.thickArrowLine,description:f.leftPanel.thickArrowLineDesc,icon:an}]},{title:f.leftPanel.channelTools,tools:[{id:"parallel-channel",name:f.leftPanel.parallelChannel,description:f.leftPanel.parallelChannelDesc,icon:nn},{id:"linear-regression-channel",name:f.leftPanel.linearRegressionChannel,description:f.leftPanel.linearRegressionChannelDesc,icon:on},{id:"equidistant-channel",name:f.leftPanel.equidistantChannel,description:f.leftPanel.equidistantChannelDesc,icon:ln},{id:"disjoint-channel",name:f.leftPanel.disjointChannel,description:f.leftPanel.disjointChannelDesc,icon:hn}]},{title:f.leftPanel.pitchforkTools,tools:[{id:"andrew-pitchfork",name:f.leftPanel.andrewPitchfork,description:f.leftPanel.andrewPitchforkDesc,icon:dn},{id:"enhanced-andrew-pitch-fork",name:f.leftPanel.enhancedAndrewPitchfork,description:f.leftPanel.enhancedAndrewPitchforkDesc,icon:cn},{id:"schiff-pitch-fork",name:f.leftPanel.schiffPitchfork,description:f.leftPanel.schiffPitchforkDesc,icon:un}]}],gannAndFibonacciTools:[{title:f.leftPanel.gannTools,tools:[{id:"gann-fan",name:f.leftPanel.gannFan,description:f.leftPanel.gannFanDesc,icon:la},{id:"gann-box",name:f.leftPanel.gannBox,description:f.leftPanel.gannBoxDesc,icon:ca},{id:"gann-rectang",name:f.leftPanel.gannRectangle,description:f.leftPanel.gannRectangleDesc,icon:xa}]},{title:f.leftPanel.fibonacciTools,tools:[{id:"fibonacci-time-zoon",name:f.leftPanel.fibonacciTimeZones,description:f.leftPanel.fibonacciTimeZonesDesc,icon:_a},{id:"fibonacci-retracement",name:f.leftPanel.fibonacciRetracement,description:f.leftPanel.fibonacciRetracementDesc,icon:Xi},{id:"fibonacci-arc",name:f.leftPanel.fibonacciArc,description:f.leftPanel.fibonacciArcDesc,icon:Ca},{id:"fibonacci-circle",name:f.leftPanel.fibonacciCircle,description:f.leftPanel.fibonacciCircleDesc,icon:Aa},{id:"fibonacci-spiral",name:f.leftPanel.fibonacciSpiral,description:f.leftPanel.fibonacciSpiralDesc,icon:Ta},{id:"fibonacci-wedge",name:f.leftPanel.fibonacciWedge,description:f.leftPanel.fibonacciWedgeDesc,icon:ba},{id:"fibonacci-fan",name:f.leftPanel.fibonacciFan,description:f.leftPanel.fibonacciFanDesc,icon:Da},{id:"fibonacci-channel",name:f.leftPanel.fibonacciChannel,description:f.leftPanel.fibonacciChannelDesc,icon:wa},{id:"fibonacci-extension-base-price",name:f.leftPanel.fibonacciExtensionPrice,description:f.leftPanel.fibonacciExtensionPriceDesc,icon:Bn},{id:"fibonacci-extension-base-time",name:f.leftPanel.fibonacciExtensionTime,description:f.leftPanel.fibonacciExtensionTimeDesc,icon:Rn}]}],irregularShapeTools:[{title:f.leftPanel.technicalPatterns,tools:[{id:"xabcd",name:f.leftPanel.xabcdPattern,description:f.leftPanel.xabcdPatternDesc,icon:Fa},{id:"head-and-shoulders",name:f.leftPanel.headAndShoulders,description:f.leftPanel.headAndShouldersDesc,icon:Ea},{id:"abcd",name:f.leftPanel.abcdPattern,description:f.leftPanel.abcdPatternDesc,icon:ya},{id:"triangle-abcd",name:f.leftPanel.triangleAbcd,description:f.leftPanel.triangleAbcdDesc,icon:Ra}]},{title:f.leftPanel.elliottWave,tools:[{id:"elliott-lmpulse",name:f.leftPanel.elliottImpulse,description:f.leftPanel.elliottImpulseDesc,icon:Ba},{id:"elliott-corrective",name:f.leftPanel.elliottCorrective,description:f.leftPanel.elliottCorrectiveDesc,icon:Ua},{id:"elliott-triangle",name:f.leftPanel.elliottTriangle,description:f.leftPanel.elliottTriangleDesc,icon:Ia},{id:"elliott-double-combo",name:f.leftPanel.elliottDoubleCombo,description:f.leftPanel.elliottDoubleComboDesc,icon:La},{id:"elliott-triple-combo",name:f.leftPanel.elliottTripleCombo,description:f.leftPanel.elliottTripleComboDesc,icon:Ha}]},{title:f.leftPanel.regularShapes,tools:[{id:"rectangle",name:f.leftPanel.rectangle,description:f.leftPanel.rectangleDesc,icon:sa},{id:"circle",name:f.leftPanel.circle,description:f.leftPanel.circleDesc,icon:na},{id:"ellipse",name:f.leftPanel.ellipse,description:f.leftPanel.ellipseDesc,icon:da},{id:"triangle",name:f.leftPanel.triangle,description:f.leftPanel.triangleDesc,icon:oa},{id:"sector",name:f.leftPanel.sector,description:f.leftPanel.sectorDesc,icon:Un},{id:"curve",name:f.leftPanel.curve,description:f.leftPanel.curveDesc,icon:Ka},{id:"double-curve",name:f.leftPanel.doubleCurve,description:f.leftPanel.doubleCurveDesc,icon:Oa}]}],projectInfoTools:[{title:f.leftPanel.rangeTools,tools:[{id:"time-range",name:f.leftPanel.timeRange,description:f.leftPanel.timeRangeDesc,icon:Wa},{id:"price-range",name:f.leftPanel.priceRange,description:f.leftPanel.priceRangeDesc,icon:ja},{id:"time-price-range",name:f.leftPanel.timePriceRange,description:f.leftPanel.timePriceRangeDesc,icon:Na},{id:"heat-map",name:f.leftPanel.heatMap,description:f.leftPanel.heatMap,icon:gn}]},{title:f.leftPanel.positionTools,tools:[{id:"long-position",name:f.leftPanel.longPosition,description:f.leftPanel.longPositionDesc,icon:Xa},{id:"short-position",name:f.leftPanel.shortPosition,description:f.leftPanel.shortPositionDesc,icon:Ya}]},{title:f.leftPanel.simulationTools,tools:[{id:"mock-kline",name:f.leftPanel.mockKline,description:f.leftPanel.mockKlineDesc,icon:Va}]}],textTools:[{title:f.leftPanel.textTools,tools:[{id:"text",name:f.leftPanel.text,description:f.leftPanel.textDesc,icon:be},{id:"price-note",name:f.leftPanel.priceNote,description:f.leftPanel.priceNoteDesc,icon:qa},{id:"bubble-box",name:f.leftPanel.bubbleBox,description:f.leftPanel.bubbleBoxDesc,icon:za},{id:"pin",name:f.leftPanel.pin,description:f.leftPanel.pinDesc,icon:Qa},{id:"signpost",name:f.leftPanel.signpost,description:f.leftPanel.signpostDesc,icon:Ga},{id:"price-label",name:f.leftPanel.priceLabel,description:f.leftPanel.priceLabelDesc,icon:$a},{id:"flag-mark",name:f.leftPanel.flagMark,description:f.leftPanel.flagMarkDesc,icon:Ja}]},{title:f.leftPanel.contentTools,tools:[{id:"image",name:f.leftPanel.image,description:f.leftPanel.imageDesc,icon:Za}]}],aiTools:[{title:"OpenAI",tools:[{id:Pt.OpenaiChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.OpenaiPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"Aliyun",tools:[{id:Pt.AliyunChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.AliyunPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"DeepSeek",tools:[{id:Pt.DeepseekChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.AliyunPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"Claude",tools:[{id:Pt.ClaudeChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.ClaudePredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"Gemini",tools:[{id:Pt.GeminiChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.GeminiPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]}],scriptTools:[{title:f.leftPanel.scriptTools||"脚本工具",tools:[{id:"price-event",name:f.leftPanel.priceEvent||"价格事件",description:f.leftPanel.priceEventDesc||"基于价格的脚本事件",icon:zn}]}]});class Ii{constructor(){this.handleDrawingToolSelect=(t,e)=>{t.setState({isDrawingModalOpen:!t.state.isDrawingModalOpen,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isIrregularShapeModalOpen:!1,isProjectInfoModalOpen:!1}),!t.state.isMarkLocked&&(e==="price-event"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setPriceEventMode&&t.props.chartLayerRef.current.setPriceEventMode():e==="time-event"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setTimeEventMode&&t.props.chartLayerRef.current.setTimeEventMode():e==="line-segment"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setLineSegmentMarkMode&&t.props.chartLayerRef.current.setLineSegmentMarkMode():e==="arrow-line"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setArrowLineMarkMode&&t.props.chartLayerRef.current.setArrowLineMarkMode():e==="thick-arrow-line"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setThickArrowLineMode&&t.props.chartLayerRef.current.setThickArrowLineMode():e==="horizontal-line"?t.props.chartLayerRef?.current?.setHorizontalLineMode&&t.props.chartLayerRef.current.setHorizontalLineMode():e==="vertical-line"?t.props.chartLayerRef?.current?.setVerticalLineMode&&t.props.chartLayerRef.current.setVerticalLineMode():e==="parallel-channel"?t.props.chartLayerRef?.current?.setParallelChannelMarkMode&&t.props.chartLayerRef.current.setParallelChannelMarkMode():e==="linear-regression-channel"?t.props.chartLayerRef?.current?.setLinearRegressionChannelMode&&t.props.chartLayerRef.current.setLinearRegressionChannelMode():e==="equidistant-channel"?t.props.chartLayerRef?.current?.setEquidistantChannelMarkMode&&t.props.chartLayerRef.current.setEquidistantChannelMarkMode():e==="disjoint-channel"?t.props.chartLayerRef?.current?.setDisjointChannelMarkMode&&t.props.chartLayerRef.current.setDisjointChannelMarkMode():e==="pitch-fork"?t.props.chartLayerRef?.current?.setPitchforkMode&&t.props.chartLayerRef.current.setPitchforkMode():e==="andrew-pitchfork"?t.props.chartLayerRef?.current?.setAndrewPitchforkMode&&t.props.chartLayerRef.current.setAndrewPitchforkMode():e==="enhanced-andrew-pitch-fork"?t.props.chartLayerRef?.current?.setEnhancedAndrewPitchforkMode&&t.props.chartLayerRef.current.setEnhancedAndrewPitchforkMode():e==="rectangle"?t.props.chartLayerRef?.current?.setRectangleMarkMode&&t.props.chartLayerRef.current.setRectangleMarkMode():e==="circle"?t.props.chartLayerRef?.current?.setCircleMarkMode&&t.props.chartLayerRef.current.setCircleMarkMode():e==="ellipse"?t.props.chartLayerRef?.current?.setEllipseMarkMode&&t.props.chartLayerRef.current.setEllipseMarkMode():e==="triangle"?t.props.chartLayerRef?.current?.setTriangleMarkMode&&t.props.chartLayerRef.current.setTriangleMarkMode():e==="gann-fan"?t.props.chartLayerRef?.current?.setGannFanMode&&t.props.chartLayerRef.current.setGannFanMode():e==="gann-box"?t.props.chartLayerRef?.current?.setGannBoxMode&&t.props.chartLayerRef.current.setGannBoxMode():e==="gann-rectang"?t.props.chartLayerRef?.current?.setGannRectangleMode&&t.props.chartLayerRef.current.setGannRectangleMode():e==="fibonacci-time-zoon"?t.props.chartLayerRef?.current?.setFibonacciTimeZoonMode&&t.props.chartLayerRef.current.setFibonacciTimeZoonMode():e==="fibonacci-retracement"?t.props.chartLayerRef?.current?.setFibonacciRetracementMode&&t.props.chartLayerRef.current.setFibonacciRetracementMode():e==="fibonacci-arc"?t.props.chartLayerRef?.current?.setFibonacciArcMode&&t.props.chartLayerRef.current.setFibonacciArcMode():e==="fibonacci-circle"?t.props.chartLayerRef?.current?.setFibonacciCircleMode&&t.props.chartLayerRef.current.setFibonacciCircleMode():e==="fibonacci-spiral"?t.props.chartLayerRef?.current?.setFibonacciSpiralMode&&t.props.chartLayerRef.current.setFibonacciSpiralMode():e==="fibonacci-wedge"?t.props.chartLayerRef?.current?.setFibonacciWedgeMode&&t.props.chartLayerRef.current.setFibonacciWedgeMode():e==="fibonacci-fan"?t.props.chartLayerRef?.current?.setFibonacciFanMode&&t.props.chartLayerRef.current.setFibonacciFanMode():e==="fibonacci-channel"?t.props.chartLayerRef?.current?.setFibonacciChannelMode&&t.props.chartLayerRef.current.setFibonacciChannelMode():e==="fibonacci-extension-base-price"?t.props.chartLayerRef?.current?.setFibonacciExtensionBasePriceMode&&t.props.chartLayerRef.current.setFibonacciExtensionBasePriceMode():e==="fibonacci-extension-base-time"?t.props.chartLayerRef?.current?.setFibonacciExtensionBaseTimeMode&&t.props.chartLayerRef.current.setFibonacciExtensionBaseTimeMode():e==="sector"?t.props.chartLayerRef?.current?.setSectorMode&&t.props.chartLayerRef.current.setSectorMode():e==="curve"?t.props.chartLayerRef?.current?.setCurveMode&&t.props.chartLayerRef.current.setCurveMode():e==="double-curve"?t.props.chartLayerRef?.current?.setDoubleCurveMode&&t.props.chartLayerRef.current.setDoubleCurveMode():e==="xabcd"?t.props.chartLayerRef?.current?.setXABCDMode&&t.props.chartLayerRef.current.setXABCDMode():e==="head-and-shoulders"?t.props.chartLayerRef?.current?.setHeadAndShouldersMode&&t.props.chartLayerRef.current.setHeadAndShouldersMode():e==="abcd"?t.props.chartLayerRef?.current?.setABCDMode&&t.props.chartLayerRef.current.setABCDMode():e==="triangle-abcd"?t.props.chartLayerRef?.current?.setTriangleABCDMode&&t.props.chartLayerRef.current.setTriangleABCDMode():e==="elliott-lmpulse"?t.props.chartLayerRef?.current?.setElliottImpulseMode&&t.props.chartLayerRef.current.setElliottImpulseMode():e==="elliott-corrective"?t.props.chartLayerRef?.current?.setElliottCorrectiveMode&&t.props.chartLayerRef.current.setElliottCorrectiveMode():e==="elliott-triangle"?t.props.chartLayerRef?.current?.setElliottTriangleMode&&t.props.chartLayerRef.current.setElliottTriangleMode():e==="elliott-double-combo"?t.props.chartLayerRef?.current?.setElliottDoubleCombinationMode&&t.props.chartLayerRef.current.setElliottDoubleCombinationMode():e==="elliott-triple-combo"?t.props.chartLayerRef?.current?.setElliottTripleCombinationMode&&t.props.chartLayerRef.current.setElliottTripleCombinationMode():e==="time-range"?t.props.chartLayerRef?.current?.setTimeRangeMarkMode&&t.props.chartLayerRef.current.setTimeRangeMarkMode():e==="price-range"?t.props.chartLayerRef?.current?.setPriceRangeMarkMode&&t.props.chartLayerRef.current.setPriceRangeMarkMode():e==="time-price-range"?t.props.chartLayerRef?.current?.setTimePriceRangeMarkMode&&t.props.chartLayerRef.current.setTimePriceRangeMarkMode():e==="text"?t.props.chartLayerRef?.current?.setTextEditMarkMode&&t.props.chartLayerRef.current.setTextEditMarkMode():e==="pencil"?t.props.chartLayerRef?.current?.setPencilMode&&t.props.chartLayerRef.current.setPencilMode():e==="pen"?t.props.chartLayerRef?.current?.setPenMode&&t.props.chartLayerRef.current.setPenMode():e==="brush"?t.props.chartLayerRef?.current?.setBrushMode&&t.props.chartLayerRef.current.setBrushMode():e==="marker-pen"?t.props.chartLayerRef?.current?.setMarkerPenMode&&t.props.chartLayerRef.current.setMarkerPenMode():e==="eraser"?t.props.chartLayerRef?.current?.setEraserMode&&t.props.chartLayerRef.current.setEraserMode():e==="image"?t.props.chartLayerRef?.current?.setImageMarkMode&&t.props.chartLayerRef.current.setImageMarkMode():e==="table"?t.props.chartLayerRef?.current?.setTableMarkMode&&t.props.chartLayerRef.current.setTableMarkMode():e==="long-position"?t.props.chartLayerRef?.current?.setLongPositionMarkMode&&t.props.chartLayerRef.current.setLongPositionMarkMode():e==="short-position"?t.props.chartLayerRef?.current?.setShortPositionMarkMode&&t.props.chartLayerRef.current.setShortPositionMarkMode():e==="price-label"?t.props.chartLayerRef?.current?.setPriceLabelMode&&t.props.chartLayerRef.current.setPriceLabelMode():e==="flag-mark"?t.props.chartLayerRef?.current?.setFlagMarkMode&&t.props.chartLayerRef.current.setFlagMarkMode():e==="price-note"?t.props.chartLayerRef?.current?.setPriceNoteMarkMode&&t.props.chartLayerRef.current.setPriceNoteMarkMode():e==="signpost"?t.props.chartLayerRef?.current?.setSignpostMarkMode&&t.props.chartLayerRef.current.setSignpostMarkMode():e==="pin"?t.props.chartLayerRef?.current?.setPinMarkMode&&t.props.chartLayerRef.current.setPinMarkMode():e==="bubble-box"?t.props.chartLayerRef?.current?.setBubbleBoxMarkMode&&t.props.chartLayerRef.current.setBubbleBoxMarkMode():e==="emoji"?t.props.chartLayerRef?.current?.selectedEmoji&&t.props.chartLayerRef.current.selectedEmoji():e==="mock-kline"?t.props.chartLayerRef?.current?.setMockKLineMarkMode&&t.props.chartLayerRef.current.setMockKLineMarkMode():e==="heat-map"?t.props.chartLayerRef?.current?.setHeatMapMode&&t.props.chartLayerRef.current.setHeatMapMode():e==="schiff-pitch-fork"&&t.props.chartLayerRef?.current?.setSchiffPitchforkMode&&t.props.chartLayerRef.current.setSchiffPitchforkMode(),t.props.onToolSelect(e),t.setState({isDrawingModalOpen:!1}))}}}class Cl extends y.Component{constructor(t){super(t),this.scriptModalRef=y.createRef(),this.drawingModalRef=y.createRef(),this.emojiPickerRef=y.createRef(),this.cursorModalRef=y.createRef(),this.brushModalRef=y.createRef(),this.rulerModalRef=y.createRef(),this.fibonacciModalRef=y.createRef(),this.gannModalRef=y.createRef(),this.projectInfoModalRef=y.createRef(),this.irregularShapeModalRef=y.createRef(),this.aiModalRef=y.createRef(),this.toolManager=new Ii,this.functionPopUpWidth="200px",this.emojiSelectPopUpWidth="315px",this.containerRef=y.createRef(),this.scrollContainerRef=y.createRef(),this.checkScrollPosition=()=>{const e=this.scrollContainerRef.current;if(e){const{scrollTop:i,scrollHeight:r,clientHeight:a}=e;this.setState({scrollButtonVisibility:{showTop:i>10,showBottom:i<r-a-10}})}},this.scrollToTop=()=>{this.scrollContainerRef.current&&(this.scrollContainerRef.current.scrollTop=0,this.checkScrollPosition())},this.scrollToBottom=()=>{if(this.scrollContainerRef.current){const e=this.scrollContainerRef.current;e.scrollTop=e.scrollHeight,this.checkScrollPosition()}},this.updateContainerHeight=()=>{if(this.containerRef.current){const e=this.containerRef.current.clientHeight;this.setState({containerHeight:e})}},this.exeAI=e=>{this.props.handleAIFunctionSelect(e)},this.handleToolAction=(e,i)=>{const{lastSelectedTools:r}=this.state;this.closeAllModals();const a={arrowButtonStates:{}};switch(e){case"toggle-script":a.isScriptModalOpen=!this.state.isScriptModalOpen,a.arrowButtonStates={script:!this.state.isScriptModalOpen};break;case"select-script":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,script:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"toggle-drawing":a.isDrawingModalOpen=!this.state.isDrawingModalOpen,a.arrowButtonStates={drawing:!this.state.isDrawingModalOpen};break;case"toggle-emoji":a.isEmojiSelectPopUpOpen=!this.state.isEmojiSelectPopUpOpen,a.arrowButtonStates={emoji:!this.state.isEmojiSelectPopUpOpen};break;case"toggle-brush":a.isBrushModalOpen=!this.state.isBrushModalOpen,a.arrowButtonStates={brush:!this.state.isBrushModalOpen};break;case"toggle-cursor":a.isCursorModalOpen=!this.state.isCursorModalOpen,a.arrowButtonStates={cursor:!this.state.isCursorModalOpen};break;case"toggle-text":a.isTextToolModalOpen=!this.state.isTextToolModalOpen,a.arrowButtonStates={text:!this.state.isTextToolModalOpen};break;case"toggle-fibonacci":a.isFibonacciModalOpen=!this.state.isFibonacciModalOpen,a.arrowButtonStates={fibonacci:!this.state.isFibonacciModalOpen};break;case"toggle-project-info":a.isProjectInfoModalOpen=!this.state.isProjectInfoModalOpen,a.arrowButtonStates={"project-info":!this.state.isProjectInfoModalOpen};break;case"toggle-irregular-shape":a.isIrregularShapeModalOpen=!this.state.isIrregularShapeModalOpen,a.arrowButtonStates={"irregular-shape":!this.state.isIrregularShapeModalOpen};break;case"toggle-ai-tools":a.isAIToolsModalOpen=!this.state.isAIToolsModalOpen,a.arrowButtonStates={ai:!this.state.isAIToolsModalOpen};break;case"select-drawing":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,drawing:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-cursor":i&&(this.setState(s=>({selectedCursor:i,lastSelectedTools:{...s.lastSelectedTools,cursor:i}})),this.handleCursorStyleSelect(i));break;case"select-brush":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,brush:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-text":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,textTool:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-fibonacci":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,fibonacci:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-project-info":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,projectInfo:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-irregular-shape":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,irregularShape:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-ai":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,ai:i}})),this.exeAI(i));break;case"activate-tool":if(i){const s=i,n=r[s];this.handleDirectToolActivation(s,n)}break}Object.keys(a).length>0&&this.setState(a)},this.handleDirectToolActivation=(e,i)=>{switch(this.closeAllModals(),e){case"drawing":this.handleToolAction("select-drawing",i);break;case"brush":this.handleToolAction("select-brush",i);break;case"cursor":this.handleToolAction("select-cursor",i);break;case"fibonacci":this.handleToolAction("select-fibonacci",i);break;case"projectInfo":this.handleToolAction("select-project-info",i);break;case"irregularShape":this.handleToolAction("select-irregular-shape",i);break;case"textTool":this.handleToolAction("select-text",i);break;case"aiTools":this.handleToolAction("select-ai-function",i);break}},this.handleClickOutside=e=>{const i=e.target;if(i.closest(".arrow-button"))return;const a={arrowButtonStates:{}};this.state.isScriptModalOpen&&this.scriptModalRef.current&&!this.scriptModalRef.current.contains(i)&&!i.closest(".script-button")&&(a.isScriptModalOpen=!1,a.arrowButtonStates.script=!1),this.state.isAIToolsModalOpen&&this.aiModalRef.current&&!this.aiModalRef.current.contains(i)&&!i.closest(".ai-tools-button")&&(a.isAIToolsModalOpen=!1,a.arrowButtonStates.aiTools=!1),this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(a.isEmojiSelectPopUpOpen=!1,a.arrowButtonStates.emoji=!1),this.state.isTextToolModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(a.isTextToolModalOpen=!1,a.arrowButtonStates.text=!1),this.state.isRulerModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(a.isRulerModalOpen=!1,a.arrowButtonStates.ruler=!1),this.state.isDrawingModalOpen&&this.drawingModalRef.current&&!this.drawingModalRef.current.contains(i)&&!i.closest(".drawing-button")&&(a.isDrawingModalOpen=!1,a.arrowButtonStates.drawing=!1),this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(a.isEmojiSelectPopUpOpen=!1),this.state.isBrushModalOpen&&this.brushModalRef.current&&!this.brushModalRef.current.contains(i)&&!i.closest(".brush-button")&&(a.isBrushModalOpen=!1,a.arrowButtonStates.brush=!1),this.state.isCursorModalOpen&&this.cursorModalRef.current&&!this.cursorModalRef.current.contains(i)&&!i.closest(".cursor-button")&&(a.isCursorModalOpen=!1,a.arrowButtonStates.cursor=!1),this.state.isFibonacciModalOpen&&this.fibonacciModalRef.current&&!this.fibonacciModalRef.current.contains(i)&&!i.closest(".fibonacci-button")&&(a.isFibonacciModalOpen=!1,a.arrowButtonStates.fibonacci=!1),this.state.isGannModalOpen&&this.gannModalRef.current&&!this.gannModalRef.current.contains(i)&&!i.closest(".gann-button")&&(a.isGannModalOpen=!1,a.arrowButtonStates.gann=!1),this.state.isProjectInfoModalOpen&&this.projectInfoModalRef.current&&!this.projectInfoModalRef.current.contains(i)&&!i.closest(".project-info-button")&&(a.isProjectInfoModalOpen=!1,a.arrowButtonStates["project-info"]=!1),this.state.isIrregularShapeModalOpen&&this.irregularShapeModalRef.current&&!this.irregularShapeModalRef.current.contains(i)&&!i.closest(".irregular-shape-button")&&(a.isIrregularShapeModalOpen=!1,a.arrowButtonStates["irregular-shape"]=!1),Object.keys(a).length>1&&this.setState(a)},this.handleCursorStyleSelect=e=>{switch(e){case"default":this.props.chartLayerRef?.current.setCursorType(St.Default);break;case"crosshair":this.props.chartLayerRef?.current.setCursorType(St.Crosshair);break;case"circle":this.props.chartLayerRef?.current.setCursorType(St.Circle);break;case"dot":this.props.chartLayerRef?.current.setCursorType(St.Dot);break;case"sparkle":this.props.chartLayerRef?.current.setCursorType(St.Crosshair);break;case"emoji":this.props.chartLayerRef?.current.setCursorType(St.Crosshair);break}},this.handleEmojiSelect=e=>{this.setState({isEmojiSelectPopUpOpen:!1}),!this.state.isMarkLocked&&(this.setState({selectedEmoji:e}),this.props.onEmojiSelect&&this.props.onEmojiSelect(e),this.props.chartLayerRef&&this.props.chartLayerRef.current&&this.props.chartLayerRef.current.setEmojiMarkMode&&this.props.chartLayerRef.current.setEmojiMarkMode(e),this.props.onToolSelect("emoji"))},this.handleCategorySelect=e=>{this.setState({selectedEmojiCategory:e})},this.getCandleViewHeight=()=>this.props.candleViewRef&&this.props.candleViewRef.current?this.props.candleViewRef.current.clientHeight||0:window.innerHeight*.7,this.calculateModalHeight=()=>this.getCandleViewHeight()*.8,this.renderCursorModal=()=>{const{currentTheme:e,activeTool:i,i18n:r,isMobileMode:a}=this.props,{isCursorModalOpen:s}=this.state,{cursorStyles:n}=this.getToolConfig();if(!s)return null;if(a)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isCursorModalOpen:!1}),children:m.jsx("div",{ref:this.cursorModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:h=>h.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:m.jsx(mt,{title:r.leftPanel.mouseCursor,tools:n,currentTheme:e,activeTool:i,onToolSelect:h=>this.handleToolAction("select-cursor",h),defaultOpen:!0})})})});const o=this.calculateModalHeight(),l=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.cursorModalRef,style:{position:"absolute",top:`${l}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${o}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:m.jsx(mt,{title:r.leftPanel.mouseCursor,tools:n,currentTheme:e,activeTool:i,onToolSelect:h=>this.handleToolAction("select-cursor",h),defaultOpen:!0})})})},this.renderCursorTools=()=>{const{cursorStyles:e}=this.getToolConfig(),i=e[0],r={id:"cursor",icon:i?.icon||pa,className:"cursor-button",onMainClick:()=>this.handleToolAction("activate-tool","cursor"),onArrowClick:()=>this.handleToolAction("toggle-cursor")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(r,r.onMainClick,r.onArrowClick,!0,i?.icon)})},this.renderBrushModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isBrushModalOpen:a}=this.state,{penTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isBrushModalOpen:!1}),children:m.jsx("div",{ref:this.brushModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-brush",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.brushModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-brush",d),defaultOpen:!0},l.title))})})},this.renderTextToolModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isTextToolModalOpen:a}=this.state,{textTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isTextToolModalOpen:!1}),children:m.jsx("div",{ref:this.rulerModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-text",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.rulerModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-text",d),defaultOpen:!0},l.title))})})},this.renderEmojiSelectPopUp=()=>{const{currentTheme:e,isMobileMode:i}=this.props,{isEmojiSelectPopUpOpen:r,selectedEmojiCategory:a}=this.state,s=Sl(this.props.i18n),n=_l.filter(c=>c.category===a);if(!r)return null;if(i){const c=this.calculateModalHeight(),p=Math.ceil(s.length/4)*40+20,M=Math.max(c-p-70,100);return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),children:m.jsxs("div",{ref:this.emojiPickerRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px 0px",width:"95%",maxWidth:"500px",maxHeight:"85vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:k=>k.stopPropagation(),children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,height:"50px",boxSizing:"border-box"},children:[m.jsx("h3",{style:{margin:0,color:e.layout.textColor,fontSize:"16px",fontWeight:"600"},children:this.props.i18n.leftPanel.selectEmoji}),m.jsx("button",{onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),style:{background:"transparent",border:"none",color:e.layout.textColor,cursor:"pointer",fontSize:"24px",padding:"2px 12px",borderRadius:"4px",transition:"background-color 0.2s"},onMouseEnter:k=>{k.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:"×"})]}),m.jsx("div",{style:{display:"flex",flexWrap:"wrap",padding:"10px 12px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,gap:"6px",minHeight:`${p}px`,boxSizing:"border-box",overflow:"visible"},children:s.map(k=>m.jsx("button",{onClick:()=>this.handleCategorySelect(k.id),style:{background:a===k.id?e.toolbar.button.active:"transparent",border:`1px solid ${a===k.id?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"8px",padding:"8px 12px",fontSize:"12px",cursor:"pointer",color:e.layout.textColor,whiteSpace:"nowrap",transition:"all 0.2s ease",flexShrink:0,height:"36px",boxSizing:"border-box",flexBasis:"calc(25% - 6px)"},children:k.getName?k.getName(this.props.i18n):k.name},k.id))}),m.jsx("div",{style:{overflowY:"auto",padding:"16px",height:`${M}px`,boxSizing:"border-box"},className:"custom-scrollbar",children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"10px",justifyItems:"center"},children:n.map((k,P)=>m.jsx("button",{onClick:()=>this.handleEmojiSelect(k.character),style:{background:"transparent",border:"1px solid transparent",borderRadius:"8px",padding:"10px",fontSize:"26px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"48px",minWidth:"48px",width:"100%",boxSizing:"border-box"},title:k.getName?k.getName(this.props.i18n):k.name,children:k.character},P))})})]})})}const o=this.calculateModalHeight(),l=this.getCandleViewHeight()*.01,d=Math.ceil(s.length/4)*40+20,g=Math.max(o-d-70,100);return m.jsxs("div",{ref:this.emojiPickerRef,style:{position:"absolute",top:`${l}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.emojiSelectPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${o}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,height:"50px",boxSizing:"border-box"},children:[m.jsx("h3",{style:{margin:0,color:e.layout.textColor,fontSize:"14px",fontWeight:"600"},children:this.props.i18n.leftPanel.selectEmoji}),m.jsx("button",{onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),style:{background:"transparent",border:"none",color:e.layout.textColor,cursor:"pointer",fontSize:"16px",padding:"2px 8px",borderRadius:"4px",transition:"background-color 0.2s"},onMouseEnter:c=>{c.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"×"})]}),m.jsx("div",{style:{display:"flex",flexWrap:"wrap",padding:"10px 12px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,gap:"6px",minHeight:`${d}px`,boxSizing:"border-box",overflow:"visible"},children:s.map(c=>m.jsx("button",{onClick:()=>this.handleCategorySelect(c.id),style:{background:a===c.id?e.toolbar.button.active:"transparent",border:`1px solid ${a===c.id?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"6px",padding:"6px 10px",fontSize:"11px",cursor:"pointer",color:e.layout.textColor,whiteSpace:"nowrap",transition:"all 0.2s ease",flexShrink:0,height:"30px",boxSizing:"border-box",flexBasis:"calc(25% - 6px)"},onMouseEnter:u=>{a!==c.id&&(u.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:u=>{a!==c.id&&(u.currentTarget.style.background="transparent")},children:c.getName?c.getName(this.props.i18n):c.name},c.id))}),m.jsx("div",{style:{overflowY:"auto",padding:"12px",height:`${g}px`,boxSizing:"border-box"},className:"custom-scrollbar",children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"8px",justifyItems:"center"},children:n.map((c,u)=>m.jsx("button",{onClick:()=>this.handleEmojiSelect(c.character),style:{background:"transparent",border:"1px solid transparent",borderRadius:"6px",padding:"8px",fontSize:"22px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"40px",minWidth:"40px",width:"100%",boxSizing:"border-box"},onMouseEnter:p=>{p.currentTarget.style.background=e.toolbar.button.hover,p.currentTarget.style.borderColor=e.toolbar.border,p.currentTarget.style.transform="scale(1.1)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent",p.currentTarget.style.borderColor="transparent",p.currentTarget.style.transform="scale(1)"},title:c.getName?c.getName(this.props.i18n):c.name,children:c.character},u))})})]})},this.renderAIToolsModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isAIToolsModalOpen:a}=this.state,{aiTools:s}=this.getToolConfig();if(!a)return null;const n=s.filter(h=>this.state.aiconfigs.some(g=>g.brand===h.title.toLowerCase()));if(r)return this.calculateModalHeight(),this.getCandleViewHeight()*.01,m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isAIToolsModalOpen:!1}),children:m.jsx("div",{ref:this.aiModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:h=>h.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((h,d)=>m.jsx(mt,{title:h.title,tools:h.tools,currentTheme:e,activeTool:i,onToolSelect:g=>this.handleToolAction("select-ai",g),defaultOpen:!0},h.title))})})});const o=this.calculateModalHeight(),l=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.aiModalRef,style:{position:"absolute",top:`${l}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${o}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((h,d)=>m.jsx(mt,{title:h.title,tools:h.tools,currentTheme:e,activeTool:i,onToolSelect:g=>this.handleToolAction("select-ai",g),defaultOpen:!0},h.title))})})},this.renderScriptModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isScriptModalOpen:a}=this.state,{scriptTools:s}=this.getToolConfig();if(!a)return null;if(s[0]?.title,r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isScriptModalOpen:!1}),children:m.jsx("div",{ref:this.scriptModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-script",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.scriptModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-script",d),defaultOpen:!0},l.title))})})},this.renderDrawingModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isDrawingModalOpen:a}=this.state,{drawingTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isDrawingModalOpen:!1}),children:m.jsx("div",{ref:this.drawingModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-drawing",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.drawingModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-drawing",d),defaultOpen:!0},l.title))})})},this.renderToolButton=(e,i,r,a=!1,s)=>{const{currentTheme:n}=this.props,o=s||e.icon,l=this.state.arrowButtonStates[e.id]||!1,h=this.state.toolHoverStates[e.id]||!1;return m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",width:"100%",background:"transparent",transition:"all 0.2s ease"},className:"tool-button-container",onMouseEnter:()=>this.setState(d=>({toolHoverStates:{...d.toolHoverStates,[e.id]:!0}})),onMouseLeave:()=>this.setState(d=>({toolHoverStates:{...d.toolHoverStates,[e.id]:!1}})),children:[m.jsx("button",{title:e.title,onClick:i,className:e.className||"",style:{background:"transparent",border:"none",borderRadius:"0px",padding:"0px",cursor:"pointer",color:n.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:a?"35px":"100%",flex:"none"},onMouseEnter:d=>{d.currentTarget.style.background=n.toolbar.button.hover},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:m.jsx(o,{size:23,color:n.toolbar.button.color})},e.id),a&&h&&m.jsx("button",{onClick:d=>{d.stopPropagation(),r()},className:"arrow-button",style:{background:"transparent",border:"none",borderRadius:"0px",cursor:"pointer",color:n.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:"13px",flex:"none",fontSize:"12px",fontWeight:"bold",position:"absolute",paddingLeft:"8px",marginLeft:"30px"},onMouseEnter:d=>{d.currentTarget.style.background=n.toolbar.button.hover},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},onMouseDown:d=>{d.currentTarget.style.background=n.toolbar.button.active},onMouseUp:d=>{d.currentTarget.style.background=n.toolbar.button.hover},children:m.jsx("span",{style:{fontSize:"18px"},children:l?"‹":"›"})})]})},this.closeAllModals=()=>{this.setState({isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,isAIToolsModalOpen:!1,isScriptModalOpen:!1,arrowButtonStates:{}})},this.renderLineTools=()=>{const{drawingTools:e}=this.getToolConfig(),{lastSelectedTools:i}=this.state,r=this.findToolInGroups(e,i.drawing),a={id:"drawing",icon:r?.icon||ha,className:"drawing-button",onMainClick:()=>this.handleToolAction("activate-tool","drawing"),onArrowClick:()=>this.handleToolAction("toggle-drawing")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px",width:"100%"},children:this.renderToolButton(a,a.onMainClick,a.onArrowClick,!0,r?.icon)})},this.renderFibonacciModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isFibonacciModalOpen:a}=this.state,{gannAndFibonacciTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isFibonacciModalOpen:!1}),children:m.jsx("div",{ref:this.fibonacciModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-fibonacci",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.fibonacciModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-fibonacci",d),defaultOpen:!0},l.title))})})},this.renderProjectInfoModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isProjectInfoModalOpen:a}=this.state,{projectInfoTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isProjectInfoModalOpen:!1}),children:m.jsx("div",{ref:this.projectInfoModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-project-info",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.projectInfoModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-project-info",d),defaultOpen:!0},l.title))})})},this.renderIrregularShapeModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isIrregularShapeModalOpen:a}=this.state,{irregularShapeTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isIrregularShapeModalOpen:!1}),children:m.jsx("div",{ref:this.irregularShapeModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-irregular-shape",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.irregularShapeModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-irregular-shape",d),defaultOpen:!0},l.title))})})},this.renderTecGraphTools=()=>{const{lastSelectedTools:e}=this.state,{irregularShapeTools:i,gannAndFibonacciTools:r,projectInfoTools:a}=this.getToolConfig(),s=this.findToolInGroups(r,e.fibonacci),n=this.findToolInGroups(a,e.projectInfo),o=this.findToolInGroups(i,e.irregularShape),l=[{id:"fibonacci",icon:s?.icon||Xi,className:"fibonacci-button",onMainClick:()=>this.handleToolAction("activate-tool","fibonacci"),onArrowClick:()=>this.handleToolAction("toggle-fibonacci")},{id:"project-info",icon:n?.icon||ua,className:"project-info-button",onMainClick:()=>this.handleToolAction("activate-tool","projectInfo"),onArrowClick:()=>this.handleToolAction("toggle-project-info")},{id:"irregular-shape",icon:o?.icon||Yi,className:"irregular-shape-button",onMainClick:()=>this.handleToolAction("activate-tool","irregularShape"),onArrowClick:()=>this.handleToolAction("toggle-irregular-shape")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:l.map(h=>this.renderToolButton(h,h.onMainClick,h.onArrowClick,!0,h.id==="fibonacci"?s?.icon:h.id==="project-info"?n?.icon:o?.icon))})},this.renderTrash=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),a=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),n=[{id:"clear-all-mark",icon:ga,className:"trash-button",hasArrow:!1,onMainClick:()=>{this.props.chartLayerRef?.current?.clearAllMark&&this.props.chartLayerRef.current.clearAllMark()},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?a?.icon:o.id==="text"?s?.icon:void 0))})},this.renderMarkTools=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),a=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),n=[{id:"brush",icon:a?.icon||Vi,className:"brush-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","brush"),onArrowClick:()=>this.handleToolAction("toggle-brush")},{id:"text",icon:s?.icon||be,className:"text-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","textTool"),onArrowClick:()=>this.handleToolAction("toggle-text")},{id:"script",icon:qn,className:"script-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("toggle-script"),onArrowClick:()=>this.handleToolAction("toggle-script")},{id:"emoji",icon:aa,className:"emoji-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","emoji"),onArrowClick:()=>this.handleToolAction("toggle-emoji")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?a?.icon:o.id==="text"?s?.icon:void 0))})},this.renderTerminalButton=()=>{const e={id:"terminal",icon:Xn,className:"terminal-button",onMainClick:()=>{this.props.candleView?.openTerminal()},onArrowClick:()=>{}};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(e,e.onMainClick,e.onArrowClick,!1)})},this.renderAITools=()=>{const{aiTools:e}=this.getToolConfig(),{lastSelectedTools:i}=this.state;let r=null;for(const s of e){const n=s.tools.find(o=>o.id===i.aiTools);if(n){r=n;break}}const a={id:"ai",icon:r?.icon||wt,className:"ai-tools-button",onMainClick:()=>{this.handleToolAction("toggle-ai-tools")},onArrowClick:()=>{this.handleToolAction("toggle-ai-tools")}};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(a,a.onMainClick,a.onArrowClick,!0,r?.icon)})},this.renderOtherTools=()=>{const{isMarkLocked:e,isMarkVisibility:i}=this.state,r=[{id:"lock",icon:e?In:Ln,className:"lock-button",onMainClick:()=>{this.setState({isMarkLocked:!e})},onArrowClick:()=>{}},{id:"eye",icon:i?Hn:Kn,className:"eye-button",onMainClick:()=>{const a=!i;this.setState({isMarkVisibility:a}),this.props.chartLayerRef&&this.props.chartLayerRef.current&&(a?this.props.chartLayerRef.current.showAllMark&&this.props.chartLayerRef.current.showAllMark():this.props.chartLayerRef.current.hideAllMark&&this.props.chartLayerRef.current.hideAllMark())},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:r.map(a=>this.renderToolButton(a,a.onMainClick,a.onArrowClick,!1,void 0))})},this.state={isDrawingModalOpen:!1,isScriptModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,selectedEmoji:t.selectedEmoji||"😀",selectedEmojiCategory:"smileys",selectedCursor:"cursor-crosshair",isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,isAIToolsModalOpen:!1,selectedAIBrand:"openai",selectedAIFunction:"describe-chart",lastSelectedTools:{drawing:"line-segment",brush:"pencil",ruler:"pencil",cursor:"cursor-crosshair",fibonacci:"fibonacci-retracement",projectInfo:"time-range",irregularShape:"rectangle",textTool:"text",aiTools:"describe-chart"},arrowButtonStates:{},toolHoverStates:{},systemSettings:{language:"zh-CN",themeMode:"light",autoSave:!0,showGrid:!0,hardwareAcceleration:!0},isMarkLocked:!1,isMarkVisibility:!0,containerHeight:0,ai:this.props.ai||!1,aiconfigs:this.props.aiconfigs||[],scrollButtonVisibility:{showTop:!1,showBottom:!1}},this.toolManager=new Ii}componentDidMount(){document.addEventListener("mousedown",t=>this.handleClickOutside(t),!0),document.addEventListener("touchstart",this.handleClickOutside,!0),this.updateContainerHeight(),window.addEventListener("resize",this.updateContainerHeight),this.checkScrollPosition()}componentWillUnmount(){document.removeEventListener("mousedown",t=>this.handleClickOutside(t),!0),window.removeEventListener("resize",this.updateContainerHeight)}componentDidUpdate(t){t.ai!==this.props.ai&&this.props.ai&&this.setState({ai:this.props.ai}),t.aiconfigs!==this.props.aiconfigs&&this.props.aiconfigs&&this.setState({aiconfigs:this.props.aiconfigs}),t.selectedEmoji!==this.props.selectedEmoji&&this.props.selectedEmoji&&this.setState({selectedEmoji:this.props.selectedEmoji})}getToolConfig(){return Gi(this.props.i18n)}findToolInGroups(t,e){for(const i of t){const r=i.tools.find(a=>a.id===e);if(r)return r}return null}render(){const{currentTheme:t}=this.props,{scrollButtonVisibility:e}=this.state;return m.jsxs("div",{ref:this.containerRef,style:{position:"relative",height:"100%"},children:[m.jsx("div",{style:{background:t.panel.backgroundColor,borderRight:`1px solid ${t.panel.borderColor}`,display:"flex",flexDirection:"column",width:"50px",boxSizing:"border-box",height:"100%",overflow:"hidden"},children:m.jsxs("div",{style:{flex:1,overflow:"hidden",position:"relative"},children:[m.jsxs("div",{ref:this.scrollContainerRef,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowY:"auto",overflowX:"hidden",padding:"12px 6px",display:"flex",flexDirection:"column",gap:"0px",scrollbarWidth:"none",msOverflowStyle:"none"},onScroll:this.checkScrollPosition,children:[m.jsx("style",{children:`
259
+ `})]})},Ml=f=>[{id:"smileys",name:f?.emoji?.categories?.smileys||"表情",getName:t=>t?.emoji?.categories?.smileys||"表情"},{id:"people",name:f?.emoji?.categories?.people||"人物",getName:t=>t?.emoji?.categories?.people||"人物"},{id:"animals",name:f?.emoji?.categories?.animals||"动物",getName:t=>t?.emoji?.categories?.animals||"动物"},{id:"food",name:f?.emoji?.categories?.food||"食物",getName:t=>t?.emoji?.categories?.food||"食物"},{id:"activities",name:f?.emoji?.categories?.activities||"活动",getName:t=>t?.emoji?.categories?.activities||"活动"},{id:"travel",name:f?.emoji?.categories?.travel||"旅行",getName:t=>t?.emoji?.categories?.travel||"旅行"},{id:"objects",name:f?.emoji?.categories?.objects||"物品",getName:t=>t?.emoji?.categories?.objects||"物品"},{id:"symbols",name:f?.emoji?.categories?.symbols||"符号",getName:t=>t?.emoji?.categories?.symbols||"符号"},{id:"flags",name:f?.emoji?.categories?.flags||"旗帜",getName:t=>t?.emoji?.categories?.flags||"旗帜"}],ml=[{character:"😀",name:"笑脸",category:"smileys"},{character:"😃",name:"大笑",category:"smileys"},{character:"😄",name:"微笑",category:"smileys"},{character:"😁",name:"笑嘻嘻",category:"smileys"},{character:"😆",name:"哈哈笑",category:"smileys"},{character:"😅",name:"流汗笑",category:"smileys"},{character:"😂",name:"笑哭",category:"smileys"},{character:"🤣",name:"打滚笑",category:"smileys"},{character:"😊",name:"微笑脸",category:"smileys"},{character:"😇",name:"天使",category:"smileys"},{character:"🙂",name:"微微笑",category:"smileys"},{character:"🙃",name:"倒脸",category:"smileys"},{character:"😉",name:"眨眼",category:"smileys"},{character:"😍",name:"爱心眼",category:"smileys"},{character:"🥰",name:"微笑爱心",category:"smileys"},{character:"😘",name:"飞吻",category:"smileys"},{character:"😋",name:"美味",category:"smileys"},{character:"😎",name:"墨镜",category:"smileys"},{character:"🤩",name:"星星眼",category:"smileys"},{character:"🥳",name:"派对",category:"smileys"},{character:"😏",name:"得意",category:"smileys"},{character:"😢",name:"哭泣",category:"smileys"},{character:"😭",name:"大哭",category:"smileys"},{character:"😡",name:"愤怒",category:"smileys"},{character:"🤯",name:"爆炸头",category:"smileys"},{character:"🥺",name:"恳求脸",category:"smileys"},{character:"😱",name:"尖叫",category:"smileys"},{character:"🤔",name:"思考",category:"smileys"},{character:"😴",name:"睡觉",category:"smileys"},{character:"😷",name:"口罩",category:"smileys"},{character:"🤒",name:"生病",category:"smileys"},{character:"🤕",name:"受伤",category:"smileys"},{character:"🥶",name:"冷脸",category:"smileys"},{character:"🥵",name:"热脸",category:"smileys"},{character:"😈",name:"小恶魔",category:"smileys"},{character:"👿",name:"恶魔",category:"smileys"},{character:"💀",name:"骷髅",category:"smileys"},{character:"👻",name:"鬼魂",category:"smileys"},{character:"👽",name:"外星人",category:"smileys"},{character:"🤖",name:"机器人",category:"smileys"},{character:"👶",name:"婴儿",category:"people"},{character:"👧",name:"女孩",category:"people"},{character:"👦",name:"男孩",category:"people"},{character:"👩",name:"女人",category:"people"},{character:"👨",name:"男人",category:"people"},{character:"👵",name:"老奶奶",category:"people"},{character:"👴",name:"老爷爷",category:"people"},{character:"👮‍♀️",name:"女警察",category:"people"},{character:"👮‍♂️",name:"男警察",category:"people"},{character:"👷‍♀️",name:"女建筑工人",category:"people"},{character:"👷‍♂️",name:"男建筑工人",category:"people"},{character:"👩‍⚕️",name:"女医生",category:"people"},{character:"👨‍⚕️",name:"男医生",category:"people"},{character:"👩‍🍳",name:"女厨师",category:"people"},{character:"👨‍🍳",name:"男厨师",category:"people"},{character:"👩‍🎓",name:"女学生",category:"people"},{character:"👨‍🎓",name:"男学生",category:"people"},{character:"👸",name:"公主",category:"people"},{character:"🤴",name:"王子",category:"people"},{character:"🦸‍♀️",name:"女超级英雄",category:"people"},{character:"🦸‍♂️",name:"男超级英雄",category:"people"},{character:"🦹‍♀️",name:"女超级反派",category:"people"},{character:"🦹‍♂️",name:"男超级反派",category:"people"},{character:"🧙‍♀️",name:"女法师",category:"people"},{character:"🧙‍♂️",name:"男法师",category:"people"},{character:"🧚‍♀️",name:"仙女",category:"people"},{character:"🧚‍♂️",name:"精灵",category:"people"},{character:"🧛‍♀️",name:"女吸血鬼",category:"people"},{character:"🧛‍♂️",name:"男吸血鬼",category:"people"},{character:"🧜‍♀️",name:"美人鱼",category:"people"},{character:"🧜‍♂️",name:"男人鱼",category:"people"},{character:"🧝‍♀️",name:"女精灵",category:"people"},{character:"🧝‍♂️",name:"男精灵",category:"people"},{character:"👼",name:"天使宝宝",category:"people"},{character:"💁‍♀️",name:"女信息台",category:"people"},{character:"💁‍♂️",name:"男信息台",category:"people"},{character:"🙅‍♀️",name:"女禁止",category:"people"},{character:"🙅‍♂️",name:"男禁止",category:"people"},{character:"💆‍♀️",name:"女按摩",category:"people"},{character:"💆‍♂️",name:"男按摩",category:"people"},{character:"🐵",name:"猴脸",category:"animals"},{character:"🐒",name:"猴子",category:"animals"},{character:"🐶",name:"狗脸",category:"animals"},{character:"🐕",name:"狗",category:"animals"},{character:"🐩",name:"贵宾犬",category:"animals"},{character:"🐺",name:"狼",category:"animals"},{character:"🦊",name:"狐狸",category:"animals"},{character:"🐱",name:"猫脸",category:"animals"},{character:"🐈",name:"猫",category:"animals"},{character:"🦁",name:"狮子",category:"animals"},{character:"🐯",name:"老虎脸",category:"animals"},{character:"🐴",name:"马脸",category:"animals"},{character:"🦄",name:"独角兽",category:"animals"},{character:"🦓",name:"斑马",category:"animals"},{character:"🐮",name:"牛脸",category:"animals"},{character:"🐷",name:"猪脸",category:"animals"},{character:"🐭",name:"老鼠脸",category:"animals"},{character:"🐹",name:"仓鼠",category:"animals"},{character:"🐰",name:"兔子脸",category:"animals"},{character:"🐻",name:"熊",category:"animals"},{character:"🐨",name:"考拉",category:"animals"},{character:"🐼",name:"熊猫",category:"animals"},{character:"🐔",name:"鸡",category:"animals"},{character:"🐦",name:"鸟",category:"animals"},{character:"🐧",name:"企鹅",category:"animals"},{character:"🦅",name:"鹰",category:"animals"},{character:"🦆",name:"鸭",category:"animals"},{character:"🦉",name:"猫头鹰",category:"animals"},{character:"🦇",name:"蝙蝠",category:"animals"},{character:"🐸",name:"青蛙",category:"animals"},{character:"🐢",name:"乌龟",category:"animals"},{character:"🐍",name:"蛇",category:"animals"},{character:"🐊",name:"鳄鱼",category:"animals"},{character:"🦖",name:"霸王龙",category:"animals"},{character:"🦕",name:"蜥脚类恐龙",category:"animals"},{character:"🐬",name:"海豚",category:"animals"},{character:"🐳",name:"鲸鱼",category:"animals"},{character:"🦭",name:"海豹",category:"animals"},{character:"🐙",name:"章鱼",category:"animals"},{character:"🦑",name:"乌贼",category:"animals"},{character:"🦐",name:"虾",category:"animals"},{character:"🍎",name:"红苹果",category:"food"},{character:"🍐",name:"梨",category:"food"},{character:"🍊",name:"橙子",category:"food"},{character:"🍋",name:"柠檬",category:"food"},{character:"🍌",name:"香蕉",category:"food"},{character:"🍉",name:"西瓜",category:"food"},{character:"🍇",name:"葡萄",category:"food"},{character:"🍓",name:"草莓",category:"food"},{character:"🍑",name:"桃子",category:"food"},{character:"🍍",name:"菠萝",category:"food"},{character:"🥭",name:"芒果",category:"food"},{character:"🥥",name:"椰子",category:"food"},{character:"🥑",name:"牛油果",category:"food"},{character:"🍅",name:"番茄",category:"food"},{character:"🍆",name:"茄子",category:"food"},{character:"🥦",name:"西兰花",category:"food"},{character:"🥕",name:"胡萝卜",category:"food"},{character:"🌽",name:"玉米",category:"food"},{character:"🍞",name:"面包",category:"food"},{character:"🥐",name:"牛角包",category:"food"},{character:"🧀",name:"奶酪",category:"food"},{character:"🍗",name:"鸡腿",category:"food"},{character:"🍔",name:"汉堡",category:"food"},{character:"🍕",name:"披萨",category:"food"},{character:"🌭",name:"热狗",category:"food"},{character:"🥪",name:"三明治",category:"food"},{character:"🌮",name:"墨西哥卷饼",category:"food"},{character:"🌯",name:"墨西哥卷",category:"food"},{character:"🥗",name:"沙拉",category:"food"},{character:"🍲",name:"火锅",category:"food"},{character:"🥣",name:"碗和勺子",category:"food"},{character:"🍛",name:"咖喱饭",category:"food"},{character:"🍜",name:"面条",category:"food"},{character:"🍝",name:"意大利面",category:"food"},{character:"🍣",name:"寿司",category:"food"},{character:"🍤",name:"炸虾",category:"food"},{character:"🍙",name:"饭团",category:"food"},{character:"🍚",name:"米饭",category:"food"},{character:"🍦",name:"冰淇淋",category:"food"},{character:"🍧",name:"刨冰",category:"food"},{character:"⚽",name:"足球",category:"activities"},{character:"🏀",name:"篮球",category:"activities"},{character:"🏈",name:"美式足球",category:"activities"},{character:"⚾",name:"棒球",category:"activities"},{character:"🎾",name:"网球",category:"activities"},{character:"🏐",name:"排球",category:"activities"},{character:"🎱",name:"台球",category:"activities"},{character:"🏓",name:"乒乓球",category:"activities"},{character:"🏸",name:"羽毛球",category:"activities"},{character:"🥊",name:"拳击手套",category:"activities"},{character:"🎯",name:"射箭靶",category:"activities"},{character:"🎳",name:"保龄球",category:"activities"},{character:"🏹",name:"弓和箭",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"⛸️",name:"溜冰鞋",category:"activities"},{character:"🎿",name:"滑雪",category:"activities"},{character:"🏒",name:"冰球",category:"activities"},{character:"🏏",name:"板球",category:"activities"},{character:"🏆",name:"奖杯",category:"activities"},{character:"🥇",name:"金牌",category:"activities"},{character:"🥈",name:"银牌",category:"activities"},{character:"🥉",name:"铜牌",category:"activities"},{character:"🎖️",name:"军奖章",category:"activities"},{character:"🏅",name:"运动奖牌",category:"activities"},{character:"🤿",name:"潜水装备",category:"activities"},{character:"🎣",name:"钓鱼竿",category:"activities"},{character:"🎪",name:"马戏团帐篷",category:"activities"},{character:"🎭",name:"表演艺术",category:"activities"},{character:"🎨",name:"艺术家调色板",category:"activities"},{character:"🎬",name:"场记板",category:"activities"},{character:"🎤",name:"麦克风",category:"activities"},{character:"🎧",name:"耳机",category:"activities"},{character:"🎼",name:"乐谱",category:"activities"},{character:"🎹",name:"电子琴",category:"activities"},{character:"🥁",name:"鼓",category:"activities"},{character:"🎷",name:"萨克斯",category:"activities"},{character:"🎺",name:"小号",category:"activities"},{character:"🎸",name:"吉他",category:"activities"},{character:"🪕",name:"班卓琴",category:"activities"},{character:"🎻",name:"小提琴",category:"activities"},{character:"🚗",name:"汽车",category:"travel"},{character:"🚕",name:"出租车",category:"travel"},{character:"🚙",name:"SUV",category:"travel"},{character:"🚌",name:"巴士",category:"travel"},{character:"🚎",name:"电车",category:"travel"},{character:"🏎️",name:"赛车",category:"travel"},{character:"🚓",name:"警车",category:"travel"},{character:"🚑",name:"救护车",category:"travel"},{character:"🚒",name:"消防车",category:"travel"},{character:"🚐",name:"小巴",category:"travel"},{character:"🚚",name:"卡车",category:"travel"},{character:"🚛",name:"铰接式卡车",category:"travel"},{character:"🚲",name:"自行车",category:"travel"},{character:"🛴",name:"滑板车",category:"travel"},{character:"🚁",name:"直升机",category:"travel"},{character:"✈️",name:"飞机",category:"travel"},{character:"🛩️",name:"小飞机",category:"travel"},{character:"🛫",name:"飞机起飞",category:"travel"},{character:"🛬",name:"飞机降落",category:"travel"},{character:"🚀",name:"火箭",category:"travel"},{character:"🛸",name:"飞碟",category:"travel"},{character:"🚂",name:"火车头",category:"travel"},{character:"🚃",name:"火车车厢",category:"travel"},{character:"🚄",name:"高速列车",category:"travel"},{character:"🚅",name:"子弹头列车",category:"travel"},{character:"🚆",name:"火车",category:"travel"},{character:"🚇",name:"地铁",category:"travel"},{character:"🚈",name:"轻轨",category:"travel"},{character:"🚉",name:"车站",category:"travel"},{character:"🚊",name:"电车",category:"travel"},{character:"🚝",name:"单轨铁路",category:"travel"},{character:"🚞",name:"山区铁路",category:"travel"},{character:"🚋",name:"有轨电车",category:"travel"},{character:"🚠",name:"缆车",category:"travel"},{character:"🚡",name:"空中缆车",category:"travel"},{character:"🚢",name:"船",category:"travel"},{character:"⛵",name:"帆船",category:"travel"},{character:"🛶",name:"独木舟",category:"travel"},{character:"🚤",name:"快艇",category:"travel"},{character:"⛴️",name:"渡轮",category:"travel"},{character:"⌚",name:"手表",category:"objects"},{character:"📱",name:"手机",category:"objects"},{character:"📲",name:"手机箭头",category:"objects"},{character:"💻",name:"笔记本电脑",category:"objects"},{character:"⌨️",name:"键盘",category:"objects"},{character:"🖥️",name:"台式电脑",category:"objects"},{character:"🖨️",name:"打印机",category:"objects"},{character:"🖱️",name:"电脑鼠标",category:"objects"},{character:"🕹️",name:"游戏摇杆",category:"objects"},{character:"📷",name:"相机",category:"objects"},{character:"📹",name:"摄像机",category:"objects"},{character:"🎥",name:"电影摄像机",category:"objects"},{character:"📺",name:"电视",category:"objects"},{character:"📻",name:"收音机",category:"objects"},{character:"🎙️",name:"录音麦克风",category:"objects"},{character:"🎚️",name:"音量滑块",category:"objects"},{character:"🎛️",name:"控制旋钮",category:"objects"},{character:"📞",name:"电话听筒",category:"objects"},{character:"📟",name:"寻呼机",category:"objects"},{character:"📠",name:"传真机",category:"objects"},{character:"🔦",name:"手电筒",category:"objects"},{character:"🕯️",name:"蜡烛",category:"objects"},{character:"💡",name:"灯泡",category:"objects"},{character:"🔌",name:"电源插头",category:"objects"},{character:"🔋",name:"电池",category:"objects"},{character:"🪫",name:"低电量",category:"objects"},{character:"💰",name:"钱袋",category:"objects"},{character:"💎",name:"宝石",category:"objects"},{character:"💳",name:"信用卡",category:"objects"},{character:"🧮",name:"算盘",category:"objects"},{character:"📿",name:"念珠",category:"objects"},{character:"🧷",name:"安全别针",category:"objects"},{character:"🔑",name:"钥匙",category:"objects"},{character:"🗝️",name:"老钥匙",category:"objects"},{character:"🛡️",name:"盾牌",category:"objects"},{character:"💊",name:"药丸",category:"objects"},{character:"🧴",name:"乳液瓶",category:"objects"},{character:"🧹",name:"扫帚",category:"objects"},{character:"🧺",name:"篮子",category:"objects"},{character:"🪣",name:"桶",category:"objects"},{character:"❤️",name:"红心",category:"symbols"},{character:"🧡",name:"橙心",category:"symbols"},{character:"💛",name:"黄心",category:"symbols"},{character:"💚",name:"绿心",category:"symbols"},{character:"💙",name:"蓝心",category:"symbols"},{character:"💜",name:"紫心",category:"symbols"},{character:"🖤",name:"黑心",category:"symbols"},{character:"💔",name:"破碎的心",category:"symbols"},{character:"❣️",name:"心叹号",category:"symbols"},{character:"💕",name:"两颗心",category:"symbols"},{character:"💞",name:"旋转的心",category:"symbols"},{character:"💓",name:"跳动的心",category:"symbols"},{character:"💗",name:"长大的心",category:"symbols"},{character:"💖",name:"闪亮的心",category:"symbols"},{character:"💘",name:"箭穿心",category:"symbols"},{character:"💝",name:"丝带心",category:"symbols"},{character:"💟",name:"心形装饰",category:"symbols"},{character:"☮️",name:"和平符号",category:"symbols"},{character:"✝️",name:"拉丁十字架",category:"symbols"},{character:"☪️",name:"星月",category:"symbols"},{character:"🕉️",name:"奥姆符号",category:"symbols"},{character:"✡️",name:"大卫之星",category:"symbols"},{character:"🔯",name:"六角星",category:"symbols"},{character:"🪬",name:"手掌法蒂玛",category:"symbols"},{character:"♈",name:"白羊座",category:"symbols"},{character:"♉",name:"金牛座",category:"symbols"},{character:"♊",name:"双子座",category:"symbols"},{character:"♋",name:"巨蟹座",category:"symbols"},{character:"♌",name:"狮子座",category:"symbols"},{character:"♍",name:"处女座",category:"symbols"},{character:"♎",name:"天秤座",category:"symbols"},{character:"♏",name:"天蝎座",category:"symbols"},{character:"♐",name:"射手座",category:"symbols"},{character:"♑",name:"摩羯座",category:"symbols"},{character:"♒",name:"水瓶座",category:"symbols"},{character:"♓",name:"双鱼座",category:"symbols"},{character:"⛎",name:"蛇夫座",category:"symbols"},{character:"🔀",name:"随机播放",category:"symbols"},{character:"🔁",name:"重复",category:"symbols"},{character:"🔂",name:"重复一次",category:"symbols"},{character:"🏁",name:"方格旗",category:"flags"},{character:"🚩",name:"三角旗",category:"flags"},{character:"🎌",name:"交叉旗",category:"flags"},{character:"🏴",name:"黑旗",category:"flags"},{character:"🏳️",name:"白旗",category:"flags"},{character:"🏳️‍🌈",name:"彩虹旗",category:"flags"},{character:"🏴‍☠️",name:"海盗旗",category:"flags"},{character:"🇺🇳",name:"联合国",category:"flags"},{character:"🇺🇸",name:"美国",category:"flags"},{character:"🇬🇧",name:"英国",category:"flags"},{character:"🇨🇳",name:"中国",category:"flags"},{character:"🇯🇵",name:"日本",category:"flags"},{character:"🇰🇷",name:"韩国",category:"flags"},{character:"🇩🇪",name:"德国",category:"flags"},{character:"🇫🇷",name:"法国",category:"flags"},{character:"🇮🇹",name:"意大利",category:"flags"},{character:"🇷🇺",name:"俄罗斯",category:"flags"},{character:"🇨🇦",name:"加拿大",category:"flags"},{character:"🇦🇺",name:"澳大利亚",category:"flags"},{character:"🇧🇷",name:"巴西",category:"flags"},{character:"🇮🇳",name:"印度",category:"flags"},{character:"🇪🇸",name:"西班牙",category:"flags"},{character:"🇲🇽",name:"墨西哥",category:"flags"},{character:"🇮🇩",name:"印度尼西亚",category:"flags"},{character:"🇳🇱",name:"荷兰",category:"flags"},{character:"🇨🇭",name:"瑞士",category:"flags"},{character:"🇸🇪",name:"瑞典",category:"flags"},{character:"🇳🇴",name:"挪威",category:"flags"},{character:"🇩🇰",name:"丹麦",category:"flags"},{character:"🇫🇮",name:"芬兰",category:"flags"},{character:"🇵🇱",name:"波兰",category:"flags"},{character:"🇹🇷",name:"土耳其",category:"flags"},{character:"🇸🇦",name:"沙特阿拉伯",category:"flags"},{character:"🇿🇦",name:"南非",category:"flags"},{character:"🇪🇬",name:"埃及",category:"flags"},{character:"🇳🇬",name:"尼日利亚",category:"flags"},{character:"🇦🇷",name:"阿根廷",category:"flags"},{character:"🇨🇱",name:"智利",category:"flags"},{character:"🇵🇪",name:"秘鲁",category:"flags"},{character:"🇻🇪",name:"委内瑞拉",category:"flags"}],Gi=f=>({cursorStyles:[{id:"default",name:f.leftPanel.cursorArrow,description:f.leftPanel.cursorArrowDesc,icon:ka},{id:"crosshair",name:f.leftPanel.cursorCrosshair,description:f.leftPanel.cursorCrosshairDesc,icon:fa},{id:"circle",name:f.leftPanel.cursorCircle,description:f.leftPanel.cursorCircleDesc,icon:Ma},{id:"dot",name:f.leftPanel.cursorDot,description:f.leftPanel.cursorDotDesc,icon:ma},{id:"sparkle",name:f.leftPanel.cursorSparkle,description:f.leftPanel.cursorSparkleDesc,icon:Pa},{id:"emoji",name:f.leftPanel.cursorEmoji,description:f.leftPanel.cursorEmojiDesc,icon:Sa}],penTools:[{title:f.leftPanel.penTools,tools:[{id:"pencil",name:f.leftPanel.pencil,description:f.leftPanel.pencilDesc,icon:Yi},{id:"pen",name:f.leftPanel.pen,description:f.leftPanel.penDesc,icon:On},{id:"brush",name:f.leftPanel.brush,description:f.leftPanel.brushDesc,icon:Vi},{id:"marker-pen",name:f.leftPanel.markerPen,description:f.leftPanel.markerPenDesc,icon:jn},{id:"eraser",name:f.leftPanel.eraser,description:f.leftPanel.eraserDesc,icon:Wn}]}],drawingTools:[{title:f.leftPanel.lineTools,tools:[{id:"line-segment",name:f.leftPanel.lineSegment,description:f.leftPanel.lineSegmentDesc,icon:tn},{id:"horizontal-line",name:f.leftPanel.horizontalLine,description:f.leftPanel.horizontalLineDesc,icon:en},{id:"vertical-line",name:f.leftPanel.verticalLine,description:f.leftPanel.verticalLineDesc,icon:rn}]},{title:f.leftPanel.arrowTools,tools:[{id:"arrow-line",name:f.leftPanel.arrowLine,description:f.leftPanel.arrowLineDesc,icon:sn},{id:"thick-arrow-line",name:f.leftPanel.thickArrowLine,description:f.leftPanel.thickArrowLineDesc,icon:an}]},{title:f.leftPanel.channelTools,tools:[{id:"parallel-channel",name:f.leftPanel.parallelChannel,description:f.leftPanel.parallelChannelDesc,icon:nn},{id:"linear-regression-channel",name:f.leftPanel.linearRegressionChannel,description:f.leftPanel.linearRegressionChannelDesc,icon:on},{id:"equidistant-channel",name:f.leftPanel.equidistantChannel,description:f.leftPanel.equidistantChannelDesc,icon:ln},{id:"disjoint-channel",name:f.leftPanel.disjointChannel,description:f.leftPanel.disjointChannelDesc,icon:hn}]},{title:f.leftPanel.pitchforkTools,tools:[{id:"andrew-pitchfork",name:f.leftPanel.andrewPitchfork,description:f.leftPanel.andrewPitchforkDesc,icon:dn},{id:"enhanced-andrew-pitch-fork",name:f.leftPanel.enhancedAndrewPitchfork,description:f.leftPanel.enhancedAndrewPitchforkDesc,icon:cn},{id:"schiff-pitch-fork",name:f.leftPanel.schiffPitchfork,description:f.leftPanel.schiffPitchforkDesc,icon:un}]}],gannAndFibonacciTools:[{title:f.leftPanel.gannTools,tools:[{id:"gann-fan",name:f.leftPanel.gannFan,description:f.leftPanel.gannFanDesc,icon:la},{id:"gann-box",name:f.leftPanel.gannBox,description:f.leftPanel.gannBoxDesc,icon:ca},{id:"gann-rectang",name:f.leftPanel.gannRectangle,description:f.leftPanel.gannRectangleDesc,icon:xa}]},{title:f.leftPanel.fibonacciTools,tools:[{id:"fibonacci-time-zoon",name:f.leftPanel.fibonacciTimeZones,description:f.leftPanel.fibonacciTimeZonesDesc,icon:_a},{id:"fibonacci-retracement",name:f.leftPanel.fibonacciRetracement,description:f.leftPanel.fibonacciRetracementDesc,icon:Xi},{id:"fibonacci-arc",name:f.leftPanel.fibonacciArc,description:f.leftPanel.fibonacciArcDesc,icon:Ca},{id:"fibonacci-circle",name:f.leftPanel.fibonacciCircle,description:f.leftPanel.fibonacciCircleDesc,icon:Aa},{id:"fibonacci-spiral",name:f.leftPanel.fibonacciSpiral,description:f.leftPanel.fibonacciSpiralDesc,icon:Ta},{id:"fibonacci-wedge",name:f.leftPanel.fibonacciWedge,description:f.leftPanel.fibonacciWedgeDesc,icon:ba},{id:"fibonacci-fan",name:f.leftPanel.fibonacciFan,description:f.leftPanel.fibonacciFanDesc,icon:Da},{id:"fibonacci-channel",name:f.leftPanel.fibonacciChannel,description:f.leftPanel.fibonacciChannelDesc,icon:wa},{id:"fibonacci-extension-base-price",name:f.leftPanel.fibonacciExtensionPrice,description:f.leftPanel.fibonacciExtensionPriceDesc,icon:Bn},{id:"fibonacci-extension-base-time",name:f.leftPanel.fibonacciExtensionTime,description:f.leftPanel.fibonacciExtensionTimeDesc,icon:Rn}]}],irregularShapeTools:[{title:f.leftPanel.technicalPatterns,tools:[{id:"xabcd",name:f.leftPanel.xabcdPattern,description:f.leftPanel.xabcdPatternDesc,icon:Fa},{id:"head-and-shoulders",name:f.leftPanel.headAndShoulders,description:f.leftPanel.headAndShouldersDesc,icon:Ea},{id:"abcd",name:f.leftPanel.abcdPattern,description:f.leftPanel.abcdPatternDesc,icon:ya},{id:"triangle-abcd",name:f.leftPanel.triangleAbcd,description:f.leftPanel.triangleAbcdDesc,icon:Ra}]},{title:f.leftPanel.elliottWave,tools:[{id:"elliott-lmpulse",name:f.leftPanel.elliottImpulse,description:f.leftPanel.elliottImpulseDesc,icon:Ba},{id:"elliott-corrective",name:f.leftPanel.elliottCorrective,description:f.leftPanel.elliottCorrectiveDesc,icon:Ua},{id:"elliott-triangle",name:f.leftPanel.elliottTriangle,description:f.leftPanel.elliottTriangleDesc,icon:Ia},{id:"elliott-double-combo",name:f.leftPanel.elliottDoubleCombo,description:f.leftPanel.elliottDoubleComboDesc,icon:La},{id:"elliott-triple-combo",name:f.leftPanel.elliottTripleCombo,description:f.leftPanel.elliottTripleComboDesc,icon:Ha}]},{title:f.leftPanel.regularShapes,tools:[{id:"rectangle",name:f.leftPanel.rectangle,description:f.leftPanel.rectangleDesc,icon:sa},{id:"circle",name:f.leftPanel.circle,description:f.leftPanel.circleDesc,icon:na},{id:"ellipse",name:f.leftPanel.ellipse,description:f.leftPanel.ellipseDesc,icon:da},{id:"triangle",name:f.leftPanel.triangle,description:f.leftPanel.triangleDesc,icon:oa},{id:"sector",name:f.leftPanel.sector,description:f.leftPanel.sectorDesc,icon:Un},{id:"curve",name:f.leftPanel.curve,description:f.leftPanel.curveDesc,icon:Ka},{id:"double-curve",name:f.leftPanel.doubleCurve,description:f.leftPanel.doubleCurveDesc,icon:Oa}]}],projectInfoTools:[{title:f.leftPanel.rangeTools,tools:[{id:"time-range",name:f.leftPanel.timeRange,description:f.leftPanel.timeRangeDesc,icon:Wa},{id:"price-range",name:f.leftPanel.priceRange,description:f.leftPanel.priceRangeDesc,icon:ja},{id:"time-price-range",name:f.leftPanel.timePriceRange,description:f.leftPanel.timePriceRangeDesc,icon:Na},{id:"heat-map",name:f.leftPanel.heatMap,description:f.leftPanel.heatMap,icon:gn}]},{title:f.leftPanel.positionTools,tools:[{id:"long-position",name:f.leftPanel.longPosition,description:f.leftPanel.longPositionDesc,icon:Xa},{id:"short-position",name:f.leftPanel.shortPosition,description:f.leftPanel.shortPositionDesc,icon:Ya}]},{title:f.leftPanel.simulationTools,tools:[{id:"mock-kline",name:f.leftPanel.mockKline,description:f.leftPanel.mockKlineDesc,icon:Va}]}],textTools:[{title:f.leftPanel.textTools,tools:[{id:"text",name:f.leftPanel.text,description:f.leftPanel.textDesc,icon:be},{id:"price-note",name:f.leftPanel.priceNote,description:f.leftPanel.priceNoteDesc,icon:qa},{id:"bubble-box",name:f.leftPanel.bubbleBox,description:f.leftPanel.bubbleBoxDesc,icon:za},{id:"pin",name:f.leftPanel.pin,description:f.leftPanel.pinDesc,icon:Qa},{id:"signpost",name:f.leftPanel.signpost,description:f.leftPanel.signpostDesc,icon:Ga},{id:"price-label",name:f.leftPanel.priceLabel,description:f.leftPanel.priceLabelDesc,icon:$a},{id:"flag-mark",name:f.leftPanel.flagMark,description:f.leftPanel.flagMarkDesc,icon:Ja}]},{title:f.leftPanel.contentTools,tools:[{id:"image",name:f.leftPanel.image,description:f.leftPanel.imageDesc,icon:Za}]}],aiTools:[{title:"OpenAI",tools:[{id:Pt.OpenaiChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.OpenaiPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"Aliyun",tools:[{id:Pt.AliyunChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.AliyunPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"DeepSeek",tools:[{id:Pt.DeepseekChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.AliyunPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"Claude",tools:[{id:Pt.ClaudeChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.ClaudePredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]},{title:"Gemini",tools:[{id:Pt.GeminiChart,name:f.leftPanel.describeChart,description:f.leftPanel.describeChartDesc,icon:wt},{id:Pt.GeminiPredict,name:f.leftPanel.predictTrend,description:f.leftPanel.predictTrendDesc,icon:wt}]}],scriptTools:[{title:f.leftPanel.scriptTools||"脚本工具",tools:[{id:"price-event",name:f.leftPanel.priceEvent||"价格事件",description:f.leftPanel.priceEventDesc||"基于价格的脚本事件",icon:zn}]}]});class Ii{constructor(){this.handleDrawingToolSelect=(t,e)=>{t.setState({isDrawingModalOpen:!t.state.isDrawingModalOpen,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isIrregularShapeModalOpen:!1,isProjectInfoModalOpen:!1}),!t.state.isMarkLocked&&(e==="price-event"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setPriceEventMode&&t.props.chartLayerRef.current.setPriceEventMode():e==="time-event"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setTimeEventMode&&t.props.chartLayerRef.current.setTimeEventMode():e==="line-segment"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setLineSegmentMarkMode&&t.props.chartLayerRef.current.setLineSegmentMarkMode():e==="arrow-line"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setArrowLineMarkMode&&t.props.chartLayerRef.current.setArrowLineMarkMode():e==="thick-arrow-line"?t.props.chartLayerRef&&t.props.chartLayerRef.current&&t.props.chartLayerRef.current.setThickArrowLineMode&&t.props.chartLayerRef.current.setThickArrowLineMode():e==="horizontal-line"?t.props.chartLayerRef?.current?.setHorizontalLineMode&&t.props.chartLayerRef.current.setHorizontalLineMode():e==="vertical-line"?t.props.chartLayerRef?.current?.setVerticalLineMode&&t.props.chartLayerRef.current.setVerticalLineMode():e==="parallel-channel"?t.props.chartLayerRef?.current?.setParallelChannelMarkMode&&t.props.chartLayerRef.current.setParallelChannelMarkMode():e==="linear-regression-channel"?t.props.chartLayerRef?.current?.setLinearRegressionChannelMode&&t.props.chartLayerRef.current.setLinearRegressionChannelMode():e==="equidistant-channel"?t.props.chartLayerRef?.current?.setEquidistantChannelMarkMode&&t.props.chartLayerRef.current.setEquidistantChannelMarkMode():e==="disjoint-channel"?t.props.chartLayerRef?.current?.setDisjointChannelMarkMode&&t.props.chartLayerRef.current.setDisjointChannelMarkMode():e==="pitch-fork"?t.props.chartLayerRef?.current?.setPitchforkMode&&t.props.chartLayerRef.current.setPitchforkMode():e==="andrew-pitchfork"?t.props.chartLayerRef?.current?.setAndrewPitchforkMode&&t.props.chartLayerRef.current.setAndrewPitchforkMode():e==="enhanced-andrew-pitch-fork"?t.props.chartLayerRef?.current?.setEnhancedAndrewPitchforkMode&&t.props.chartLayerRef.current.setEnhancedAndrewPitchforkMode():e==="rectangle"?t.props.chartLayerRef?.current?.setRectangleMarkMode&&t.props.chartLayerRef.current.setRectangleMarkMode():e==="circle"?t.props.chartLayerRef?.current?.setCircleMarkMode&&t.props.chartLayerRef.current.setCircleMarkMode():e==="ellipse"?t.props.chartLayerRef?.current?.setEllipseMarkMode&&t.props.chartLayerRef.current.setEllipseMarkMode():e==="triangle"?t.props.chartLayerRef?.current?.setTriangleMarkMode&&t.props.chartLayerRef.current.setTriangleMarkMode():e==="gann-fan"?t.props.chartLayerRef?.current?.setGannFanMode&&t.props.chartLayerRef.current.setGannFanMode():e==="gann-box"?t.props.chartLayerRef?.current?.setGannBoxMode&&t.props.chartLayerRef.current.setGannBoxMode():e==="gann-rectang"?t.props.chartLayerRef?.current?.setGannRectangleMode&&t.props.chartLayerRef.current.setGannRectangleMode():e==="fibonacci-time-zoon"?t.props.chartLayerRef?.current?.setFibonacciTimeZoonMode&&t.props.chartLayerRef.current.setFibonacciTimeZoonMode():e==="fibonacci-retracement"?t.props.chartLayerRef?.current?.setFibonacciRetracementMode&&t.props.chartLayerRef.current.setFibonacciRetracementMode():e==="fibonacci-arc"?t.props.chartLayerRef?.current?.setFibonacciArcMode&&t.props.chartLayerRef.current.setFibonacciArcMode():e==="fibonacci-circle"?t.props.chartLayerRef?.current?.setFibonacciCircleMode&&t.props.chartLayerRef.current.setFibonacciCircleMode():e==="fibonacci-spiral"?t.props.chartLayerRef?.current?.setFibonacciSpiralMode&&t.props.chartLayerRef.current.setFibonacciSpiralMode():e==="fibonacci-wedge"?t.props.chartLayerRef?.current?.setFibonacciWedgeMode&&t.props.chartLayerRef.current.setFibonacciWedgeMode():e==="fibonacci-fan"?t.props.chartLayerRef?.current?.setFibonacciFanMode&&t.props.chartLayerRef.current.setFibonacciFanMode():e==="fibonacci-channel"?t.props.chartLayerRef?.current?.setFibonacciChannelMode&&t.props.chartLayerRef.current.setFibonacciChannelMode():e==="fibonacci-extension-base-price"?t.props.chartLayerRef?.current?.setFibonacciExtensionBasePriceMode&&t.props.chartLayerRef.current.setFibonacciExtensionBasePriceMode():e==="fibonacci-extension-base-time"?t.props.chartLayerRef?.current?.setFibonacciExtensionBaseTimeMode&&t.props.chartLayerRef.current.setFibonacciExtensionBaseTimeMode():e==="sector"?t.props.chartLayerRef?.current?.setSectorMode&&t.props.chartLayerRef.current.setSectorMode():e==="curve"?t.props.chartLayerRef?.current?.setCurveMode&&t.props.chartLayerRef.current.setCurveMode():e==="double-curve"?t.props.chartLayerRef?.current?.setDoubleCurveMode&&t.props.chartLayerRef.current.setDoubleCurveMode():e==="xabcd"?t.props.chartLayerRef?.current?.setXABCDMode&&t.props.chartLayerRef.current.setXABCDMode():e==="head-and-shoulders"?t.props.chartLayerRef?.current?.setHeadAndShouldersMode&&t.props.chartLayerRef.current.setHeadAndShouldersMode():e==="abcd"?t.props.chartLayerRef?.current?.setABCDMode&&t.props.chartLayerRef.current.setABCDMode():e==="triangle-abcd"?t.props.chartLayerRef?.current?.setTriangleABCDMode&&t.props.chartLayerRef.current.setTriangleABCDMode():e==="elliott-lmpulse"?t.props.chartLayerRef?.current?.setElliottImpulseMode&&t.props.chartLayerRef.current.setElliottImpulseMode():e==="elliott-corrective"?t.props.chartLayerRef?.current?.setElliottCorrectiveMode&&t.props.chartLayerRef.current.setElliottCorrectiveMode():e==="elliott-triangle"?t.props.chartLayerRef?.current?.setElliottTriangleMode&&t.props.chartLayerRef.current.setElliottTriangleMode():e==="elliott-double-combo"?t.props.chartLayerRef?.current?.setElliottDoubleCombinationMode&&t.props.chartLayerRef.current.setElliottDoubleCombinationMode():e==="elliott-triple-combo"?t.props.chartLayerRef?.current?.setElliottTripleCombinationMode&&t.props.chartLayerRef.current.setElliottTripleCombinationMode():e==="time-range"?t.props.chartLayerRef?.current?.setTimeRangeMarkMode&&t.props.chartLayerRef.current.setTimeRangeMarkMode():e==="price-range"?t.props.chartLayerRef?.current?.setPriceRangeMarkMode&&t.props.chartLayerRef.current.setPriceRangeMarkMode():e==="time-price-range"?t.props.chartLayerRef?.current?.setTimePriceRangeMarkMode&&t.props.chartLayerRef.current.setTimePriceRangeMarkMode():e==="text"?t.props.chartLayerRef?.current?.setTextEditMarkMode&&t.props.chartLayerRef.current.setTextEditMarkMode():e==="pencil"?t.props.chartLayerRef?.current?.setPencilMode&&t.props.chartLayerRef.current.setPencilMode():e==="pen"?t.props.chartLayerRef?.current?.setPenMode&&t.props.chartLayerRef.current.setPenMode():e==="brush"?t.props.chartLayerRef?.current?.setBrushMode&&t.props.chartLayerRef.current.setBrushMode():e==="marker-pen"?t.props.chartLayerRef?.current?.setMarkerPenMode&&t.props.chartLayerRef.current.setMarkerPenMode():e==="eraser"?t.props.chartLayerRef?.current?.setEraserMode&&t.props.chartLayerRef.current.setEraserMode():e==="image"?t.props.chartLayerRef?.current?.setImageMarkMode&&t.props.chartLayerRef.current.setImageMarkMode():e==="table"?t.props.chartLayerRef?.current?.setTableMarkMode&&t.props.chartLayerRef.current.setTableMarkMode():e==="long-position"?t.props.chartLayerRef?.current?.setLongPositionMarkMode&&t.props.chartLayerRef.current.setLongPositionMarkMode():e==="short-position"?t.props.chartLayerRef?.current?.setShortPositionMarkMode&&t.props.chartLayerRef.current.setShortPositionMarkMode():e==="price-label"?t.props.chartLayerRef?.current?.setPriceLabelMode&&t.props.chartLayerRef.current.setPriceLabelMode():e==="flag-mark"?t.props.chartLayerRef?.current?.setFlagMarkMode&&t.props.chartLayerRef.current.setFlagMarkMode():e==="price-note"?t.props.chartLayerRef?.current?.setPriceNoteMarkMode&&t.props.chartLayerRef.current.setPriceNoteMarkMode():e==="signpost"?t.props.chartLayerRef?.current?.setSignpostMarkMode&&t.props.chartLayerRef.current.setSignpostMarkMode():e==="pin"?t.props.chartLayerRef?.current?.setPinMarkMode&&t.props.chartLayerRef.current.setPinMarkMode():e==="bubble-box"?t.props.chartLayerRef?.current?.setBubbleBoxMarkMode&&t.props.chartLayerRef.current.setBubbleBoxMarkMode():e==="emoji"?t.props.chartLayerRef?.current?.selectedEmoji&&t.props.chartLayerRef.current.selectedEmoji():e==="mock-kline"?t.props.chartLayerRef?.current?.setMockKLineMarkMode&&t.props.chartLayerRef.current.setMockKLineMarkMode():e==="heat-map"?t.props.chartLayerRef?.current?.setHeatMapMode&&t.props.chartLayerRef.current.setHeatMapMode():e==="schiff-pitch-fork"&&t.props.chartLayerRef?.current?.setSchiffPitchforkMode&&t.props.chartLayerRef.current.setSchiffPitchforkMode(),t.props.onToolSelect(e),t.setState({isDrawingModalOpen:!1}))}}}class kl extends y.Component{constructor(t){super(t),this.scriptModalRef=y.createRef(),this.drawingModalRef=y.createRef(),this.emojiPickerRef=y.createRef(),this.cursorModalRef=y.createRef(),this.brushModalRef=y.createRef(),this.rulerModalRef=y.createRef(),this.fibonacciModalRef=y.createRef(),this.gannModalRef=y.createRef(),this.projectInfoModalRef=y.createRef(),this.irregularShapeModalRef=y.createRef(),this.aiModalRef=y.createRef(),this.toolManager=new Ii,this.functionPopUpWidth="200px",this.emojiSelectPopUpWidth="315px",this.containerRef=y.createRef(),this.scrollContainerRef=y.createRef(),this.checkScrollPosition=()=>{const e=this.scrollContainerRef.current;if(e){const{scrollTop:i,scrollHeight:r,clientHeight:a}=e;this.setState({scrollButtonVisibility:{showTop:i>10,showBottom:i<r-a-10}})}},this.scrollToTop=()=>{this.scrollContainerRef.current&&(this.scrollContainerRef.current.scrollTop=0,this.checkScrollPosition())},this.scrollToBottom=()=>{if(this.scrollContainerRef.current){const e=this.scrollContainerRef.current;e.scrollTop=e.scrollHeight,this.checkScrollPosition()}},this.updateContainerHeight=()=>{if(this.containerRef.current){const e=this.containerRef.current.clientHeight;this.setState({containerHeight:e})}},this.exeAI=e=>{this.props.handleAIFunctionSelect(e)},this.handleToolAction=(e,i)=>{const{lastSelectedTools:r}=this.state;this.closeAllModals();const a={arrowButtonStates:{}};switch(e){case"toggle-script":a.isScriptModalOpen=!this.state.isScriptModalOpen,a.arrowButtonStates={script:!this.state.isScriptModalOpen};break;case"select-script":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,script:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"toggle-drawing":a.isDrawingModalOpen=!this.state.isDrawingModalOpen,a.arrowButtonStates={drawing:!this.state.isDrawingModalOpen};break;case"toggle-emoji":a.isEmojiSelectPopUpOpen=!this.state.isEmojiSelectPopUpOpen,a.arrowButtonStates={emoji:!this.state.isEmojiSelectPopUpOpen};break;case"toggle-brush":a.isBrushModalOpen=!this.state.isBrushModalOpen,a.arrowButtonStates={brush:!this.state.isBrushModalOpen};break;case"toggle-cursor":a.isCursorModalOpen=!this.state.isCursorModalOpen,a.arrowButtonStates={cursor:!this.state.isCursorModalOpen};break;case"toggle-text":a.isTextToolModalOpen=!this.state.isTextToolModalOpen,a.arrowButtonStates={text:!this.state.isTextToolModalOpen};break;case"toggle-fibonacci":a.isFibonacciModalOpen=!this.state.isFibonacciModalOpen,a.arrowButtonStates={fibonacci:!this.state.isFibonacciModalOpen};break;case"toggle-project-info":a.isProjectInfoModalOpen=!this.state.isProjectInfoModalOpen,a.arrowButtonStates={"project-info":!this.state.isProjectInfoModalOpen};break;case"toggle-irregular-shape":a.isIrregularShapeModalOpen=!this.state.isIrregularShapeModalOpen,a.arrowButtonStates={"irregular-shape":!this.state.isIrregularShapeModalOpen};break;case"toggle-ai-tools":a.isAIToolsModalOpen=!this.state.isAIToolsModalOpen,a.arrowButtonStates={ai:!this.state.isAIToolsModalOpen};break;case"select-drawing":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,drawing:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-cursor":i&&(this.setState(s=>({selectedCursor:i,lastSelectedTools:{...s.lastSelectedTools,cursor:i}})),this.handleCursorStyleSelect(i));break;case"select-brush":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,brush:i}})),this.toolManager?.handleDrawingToolSelect(this,i),this.props.onToolSelect(i));break;case"select-text":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,textTool:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-fibonacci":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,fibonacci:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-project-info":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,projectInfo:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-irregular-shape":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,irregularShape:i}})),this.toolManager?.handleDrawingToolSelect(this,i));break;case"select-ai":i&&(this.setState(s=>({lastSelectedTools:{...s.lastSelectedTools,ai:i}})),this.exeAI(i));break;case"activate-tool":if(i){const s=i,n=r[s];this.handleDirectToolActivation(s,n)}break}Object.keys(a).length>0&&this.setState(a)},this.handleDirectToolActivation=(e,i)=>{switch(this.closeAllModals(),e){case"drawing":this.handleToolAction("select-drawing",i);break;case"brush":this.handleToolAction("select-brush",i);break;case"cursor":this.handleToolAction("select-cursor",i);break;case"fibonacci":this.handleToolAction("select-fibonacci",i);break;case"projectInfo":this.handleToolAction("select-project-info",i);break;case"irregularShape":this.handleToolAction("select-irregular-shape",i);break;case"textTool":this.handleToolAction("select-text",i);break;case"aiTools":this.handleToolAction("select-ai-function",i);break}},this.handleClickOutside=e=>{const i=e.target;if(i.closest(".arrow-button"))return;const a={arrowButtonStates:{}};this.state.isScriptModalOpen&&this.scriptModalRef.current&&!this.scriptModalRef.current.contains(i)&&!i.closest(".script-button")&&(a.isScriptModalOpen=!1,a.arrowButtonStates.script=!1),this.state.isAIToolsModalOpen&&this.aiModalRef.current&&!this.aiModalRef.current.contains(i)&&!i.closest(".ai-tools-button")&&(a.isAIToolsModalOpen=!1,a.arrowButtonStates.aiTools=!1),this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(a.isEmojiSelectPopUpOpen=!1,a.arrowButtonStates.emoji=!1),this.state.isTextToolModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(a.isTextToolModalOpen=!1,a.arrowButtonStates.text=!1),this.state.isRulerModalOpen&&this.rulerModalRef.current&&!this.rulerModalRef.current.contains(i)&&!i.closest(".ruler-button")&&(a.isRulerModalOpen=!1,a.arrowButtonStates.ruler=!1),this.state.isDrawingModalOpen&&this.drawingModalRef.current&&!this.drawingModalRef.current.contains(i)&&!i.closest(".drawing-button")&&(a.isDrawingModalOpen=!1,a.arrowButtonStates.drawing=!1),this.state.isEmojiSelectPopUpOpen&&this.emojiPickerRef.current&&!this.emojiPickerRef.current.contains(i)&&!i.closest(".emoji-button")&&(a.isEmojiSelectPopUpOpen=!1),this.state.isBrushModalOpen&&this.brushModalRef.current&&!this.brushModalRef.current.contains(i)&&!i.closest(".brush-button")&&(a.isBrushModalOpen=!1,a.arrowButtonStates.brush=!1),this.state.isCursorModalOpen&&this.cursorModalRef.current&&!this.cursorModalRef.current.contains(i)&&!i.closest(".cursor-button")&&(a.isCursorModalOpen=!1,a.arrowButtonStates.cursor=!1),this.state.isFibonacciModalOpen&&this.fibonacciModalRef.current&&!this.fibonacciModalRef.current.contains(i)&&!i.closest(".fibonacci-button")&&(a.isFibonacciModalOpen=!1,a.arrowButtonStates.fibonacci=!1),this.state.isGannModalOpen&&this.gannModalRef.current&&!this.gannModalRef.current.contains(i)&&!i.closest(".gann-button")&&(a.isGannModalOpen=!1,a.arrowButtonStates.gann=!1),this.state.isProjectInfoModalOpen&&this.projectInfoModalRef.current&&!this.projectInfoModalRef.current.contains(i)&&!i.closest(".project-info-button")&&(a.isProjectInfoModalOpen=!1,a.arrowButtonStates["project-info"]=!1),this.state.isIrregularShapeModalOpen&&this.irregularShapeModalRef.current&&!this.irregularShapeModalRef.current.contains(i)&&!i.closest(".irregular-shape-button")&&(a.isIrregularShapeModalOpen=!1,a.arrowButtonStates["irregular-shape"]=!1),Object.keys(a).length>1&&this.setState(a)},this.handleCursorStyleSelect=e=>{switch(e){case"default":this.props.chartLayerRef?.current.setCursorType(St.Default);break;case"crosshair":this.props.chartLayerRef?.current.setCursorType(St.Crosshair);break;case"circle":this.props.chartLayerRef?.current.setCursorType(St.Circle);break;case"dot":this.props.chartLayerRef?.current.setCursorType(St.Dot);break;case"sparkle":this.props.chartLayerRef?.current.setCursorType(St.Crosshair);break;case"emoji":this.props.chartLayerRef?.current.setCursorType(St.Crosshair);break}},this.handleEmojiSelect=e=>{this.setState({isEmojiSelectPopUpOpen:!1}),!this.state.isMarkLocked&&(this.setState({selectedEmoji:e}),this.props.onEmojiSelect&&this.props.onEmojiSelect(e),this.props.chartLayerRef&&this.props.chartLayerRef.current&&this.props.chartLayerRef.current.setEmojiMarkMode&&this.props.chartLayerRef.current.setEmojiMarkMode(e),this.props.onToolSelect("emoji"))},this.handleCategorySelect=e=>{this.setState({selectedEmojiCategory:e})},this.getCandleViewHeight=()=>this.props.candleViewRef&&this.props.candleViewRef.current?this.props.candleViewRef.current.clientHeight||0:window.innerHeight*.7,this.calculateModalHeight=()=>this.getCandleViewHeight()*.8,this.renderCursorModal=()=>{const{currentTheme:e,activeTool:i,i18n:r,isMobileMode:a}=this.props,{isCursorModalOpen:s}=this.state,{cursorStyles:n}=this.getToolConfig();if(!s)return null;if(a)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isCursorModalOpen:!1}),children:m.jsx("div",{ref:this.cursorModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:h=>h.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:m.jsx(mt,{title:r.leftPanel.mouseCursor,tools:n,currentTheme:e,activeTool:i,onToolSelect:h=>this.handleToolAction("select-cursor",h),defaultOpen:!0})})})});const o=this.calculateModalHeight(),l=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.cursorModalRef,style:{position:"absolute",top:`${l}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${o}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:m.jsx(mt,{title:r.leftPanel.mouseCursor,tools:n,currentTheme:e,activeTool:i,onToolSelect:h=>this.handleToolAction("select-cursor",h),defaultOpen:!0})})})},this.renderCursorTools=()=>{const{cursorStyles:e}=this.getToolConfig(),i=e[0],r={id:"cursor",icon:i?.icon||pa,className:"cursor-button",onMainClick:()=>this.handleToolAction("activate-tool","cursor"),onArrowClick:()=>this.handleToolAction("toggle-cursor")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(r,r.onMainClick,r.onArrowClick,!0,i?.icon)})},this.renderBrushModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isBrushModalOpen:a}=this.state,{penTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isBrushModalOpen:!1}),children:m.jsx("div",{ref:this.brushModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-brush",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.brushModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-brush",d),defaultOpen:!0},l.title))})})},this.renderTextToolModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isTextToolModalOpen:a}=this.state,{textTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isTextToolModalOpen:!1}),children:m.jsx("div",{ref:this.rulerModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-text",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.rulerModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-text",d),defaultOpen:!0},l.title))})})},this.renderEmojiSelectPopUp=()=>{const{currentTheme:e,isMobileMode:i}=this.props,{isEmojiSelectPopUpOpen:r,selectedEmojiCategory:a}=this.state,s=Ml(this.props.i18n),n=ml.filter(c=>c.category===a);if(!r)return null;if(i){const c=this.calculateModalHeight(),p=Math.ceil(s.length/4)*40+20,M=Math.max(c-p-70,100);return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),children:m.jsxs("div",{ref:this.emojiPickerRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px 0px",width:"95%",maxWidth:"500px",maxHeight:"85vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:k=>k.stopPropagation(),children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,height:"50px",boxSizing:"border-box"},children:[m.jsx("h3",{style:{margin:0,color:e.layout.textColor,fontSize:"16px",fontWeight:"600"},children:this.props.i18n.leftPanel.selectEmoji}),m.jsx("button",{onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),style:{background:"transparent",border:"none",color:e.layout.textColor,cursor:"pointer",fontSize:"24px",padding:"2px 12px",borderRadius:"4px",transition:"background-color 0.2s"},onMouseEnter:k=>{k.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:"×"})]}),m.jsx("div",{style:{display:"flex",flexWrap:"wrap",padding:"10px 12px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,gap:"6px",minHeight:`${p}px`,boxSizing:"border-box",overflow:"visible"},children:s.map(k=>m.jsx("button",{onClick:()=>this.handleCategorySelect(k.id),style:{background:a===k.id?e.toolbar.button.active:"transparent",border:`1px solid ${a===k.id?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"8px",padding:"8px 12px",fontSize:"12px",cursor:"pointer",color:e.layout.textColor,whiteSpace:"nowrap",transition:"all 0.2s ease",flexShrink:0,height:"36px",boxSizing:"border-box",flexBasis:"calc(25% - 6px)"},children:k.getName?k.getName(this.props.i18n):k.name},k.id))}),m.jsx("div",{style:{overflowY:"auto",padding:"16px",height:`${M}px`,boxSizing:"border-box"},className:"custom-scrollbar",children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"10px",justifyItems:"center"},children:n.map((k,P)=>m.jsx("button",{onClick:()=>this.handleEmojiSelect(k.character),style:{background:"transparent",border:"1px solid transparent",borderRadius:"8px",padding:"10px",fontSize:"26px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"48px",minWidth:"48px",width:"100%",boxSizing:"border-box"},title:k.getName?k.getName(this.props.i18n):k.name,children:k.character},P))})})]})})}const o=this.calculateModalHeight(),l=this.getCandleViewHeight()*.01,d=Math.ceil(s.length/4)*40+20,g=Math.max(o-d-70,100);return m.jsxs("div",{ref:this.emojiPickerRef,style:{position:"absolute",top:`${l}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.emojiSelectPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${o}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:[m.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 16px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,height:"50px",boxSizing:"border-box"},children:[m.jsx("h3",{style:{margin:0,color:e.layout.textColor,fontSize:"14px",fontWeight:"600"},children:this.props.i18n.leftPanel.selectEmoji}),m.jsx("button",{onClick:()=>this.setState({isEmojiSelectPopUpOpen:!1}),style:{background:"transparent",border:"none",color:e.layout.textColor,cursor:"pointer",fontSize:"16px",padding:"2px 8px",borderRadius:"4px",transition:"background-color 0.2s"},onMouseEnter:c=>{c.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:c=>{c.currentTarget.style.background="transparent"},children:"×"})]}),m.jsx("div",{style:{display:"flex",flexWrap:"wrap",padding:"10px 12px",borderBottom:`1px solid ${e.toolbar.border}`,background:e.toolbar.background,flexShrink:0,gap:"6px",minHeight:`${d}px`,boxSizing:"border-box",overflow:"visible"},children:s.map(c=>m.jsx("button",{onClick:()=>this.handleCategorySelect(c.id),style:{background:a===c.id?e.toolbar.button.active:"transparent",border:`1px solid ${a===c.id?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"6px",padding:"6px 10px",fontSize:"11px",cursor:"pointer",color:e.layout.textColor,whiteSpace:"nowrap",transition:"all 0.2s ease",flexShrink:0,height:"30px",boxSizing:"border-box",flexBasis:"calc(25% - 6px)"},onMouseEnter:u=>{a!==c.id&&(u.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:u=>{a!==c.id&&(u.currentTarget.style.background="transparent")},children:c.getName?c.getName(this.props.i18n):c.name},c.id))}),m.jsx("div",{style:{overflowY:"auto",padding:"12px",height:`${g}px`,boxSizing:"border-box"},className:"custom-scrollbar",children:m.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(6, 1fr)",gap:"8px",justifyItems:"center"},children:n.map((c,u)=>m.jsx("button",{onClick:()=>this.handleEmojiSelect(c.character),style:{background:"transparent",border:"1px solid transparent",borderRadius:"6px",padding:"8px",fontSize:"22px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"40px",minWidth:"40px",width:"100%",boxSizing:"border-box"},onMouseEnter:p=>{p.currentTarget.style.background=e.toolbar.button.hover,p.currentTarget.style.borderColor=e.toolbar.border,p.currentTarget.style.transform="scale(1.1)"},onMouseLeave:p=>{p.currentTarget.style.background="transparent",p.currentTarget.style.borderColor="transparent",p.currentTarget.style.transform="scale(1)"},title:c.getName?c.getName(this.props.i18n):c.name,children:c.character},u))})})]})},this.renderAIToolsModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isAIToolsModalOpen:a}=this.state,{aiTools:s}=this.getToolConfig();if(!a)return null;const n=s.filter(h=>this.state.aiconfigs.some(g=>g.brand===h.title.toLowerCase()));if(r)return this.calculateModalHeight(),this.getCandleViewHeight()*.01,m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isAIToolsModalOpen:!1}),children:m.jsx("div",{ref:this.aiModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:h=>h.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((h,d)=>m.jsx(mt,{title:h.title,tools:h.tools,currentTheme:e,activeTool:i,onToolSelect:g=>this.handleToolAction("select-ai",g),defaultOpen:!0},h.title))})})});const o=this.calculateModalHeight(),l=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.aiModalRef,style:{position:"absolute",top:`${l}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${o}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map((h,d)=>m.jsx(mt,{title:h.title,tools:h.tools,currentTheme:e,activeTool:i,onToolSelect:g=>this.handleToolAction("select-ai",g),defaultOpen:!0},h.title))})})},this.renderScriptModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isScriptModalOpen:a}=this.state,{scriptTools:s}=this.getToolConfig();if(!a)return null;if(s[0]?.title,r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isScriptModalOpen:!1}),children:m.jsx("div",{ref:this.scriptModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-script",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.scriptModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-script",d),defaultOpen:!0},l.title))})})},this.renderDrawingModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isDrawingModalOpen:a}=this.state,{drawingTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isDrawingModalOpen:!1}),children:m.jsx("div",{ref:this.drawingModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-drawing",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.drawingModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-drawing",d),defaultOpen:!0},l.title))})})},this.renderToolButton=(e,i,r,a=!1,s)=>{const{currentTheme:n}=this.props,o=s||e.icon,l=this.state.arrowButtonStates[e.id]||!1,h=this.state.toolHoverStates[e.id]||!1;return m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center",width:"100%",background:"transparent",transition:"all 0.2s ease"},className:"tool-button-container",onMouseEnter:()=>this.setState(d=>({toolHoverStates:{...d.toolHoverStates,[e.id]:!0}})),onMouseLeave:()=>this.setState(d=>({toolHoverStates:{...d.toolHoverStates,[e.id]:!1}})),children:[m.jsx("button",{title:e.title,onClick:i,className:e.className||"",style:{background:"transparent",border:"none",borderRadius:"0px",padding:"0px",cursor:"pointer",color:n.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:a?"35px":"100%",flex:"none"},onMouseEnter:d=>{d.currentTarget.style.background=n.toolbar.button.hover},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},children:m.jsx(o,{size:23,color:n.toolbar.button.color})},e.id),a&&h&&m.jsx("button",{onClick:d=>{d.stopPropagation(),r()},className:"arrow-button",style:{background:"transparent",border:"none",borderRadius:"0px",cursor:"pointer",color:n.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"35px",width:"13px",flex:"none",fontSize:"12px",fontWeight:"bold",position:"absolute",paddingLeft:"8px",marginLeft:"30px"},onMouseEnter:d=>{d.currentTarget.style.background=n.toolbar.button.hover},onMouseLeave:d=>{d.currentTarget.style.background="transparent"},onMouseDown:d=>{d.currentTarget.style.background=n.toolbar.button.active},onMouseUp:d=>{d.currentTarget.style.background=n.toolbar.button.hover},children:m.jsx("span",{style:{fontSize:"18px"},children:l?"‹":"›"})})]})},this.closeAllModals=()=>{this.setState({isDrawingModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,isAIToolsModalOpen:!1,isScriptModalOpen:!1,arrowButtonStates:{}})},this.renderLineTools=()=>{const{drawingTools:e}=this.getToolConfig(),{lastSelectedTools:i}=this.state,r=this.findToolInGroups(e,i.drawing),a={id:"drawing",icon:r?.icon||ha,className:"drawing-button",onMainClick:()=>this.handleToolAction("activate-tool","drawing"),onArrowClick:()=>this.handleToolAction("toggle-drawing")};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px",width:"100%"},children:this.renderToolButton(a,a.onMainClick,a.onArrowClick,!0,r?.icon)})},this.renderFibonacciModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isFibonacciModalOpen:a}=this.state,{gannAndFibonacciTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isFibonacciModalOpen:!1}),children:m.jsx("div",{ref:this.fibonacciModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-fibonacci",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.fibonacciModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-fibonacci",d),defaultOpen:!0},l.title))})})},this.renderProjectInfoModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isProjectInfoModalOpen:a}=this.state,{projectInfoTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isProjectInfoModalOpen:!1}),children:m.jsx("div",{ref:this.projectInfoModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-project-info",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.projectInfoModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-project-info",d),defaultOpen:!0},l.title))})})},this.renderIrregularShapeModal=()=>{const{currentTheme:e,activeTool:i,isMobileMode:r}=this.props,{isIrregularShapeModalOpen:a}=this.state,{irregularShapeTools:s}=this.getToolConfig();if(!a)return null;if(r)return m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1e4,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},onClick:()=>this.setState({isIrregularShapeModalOpen:!1}),children:m.jsx("div",{ref:this.irregularShapeModalRef,style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,padding:"0px",width:"90%",maxWidth:"400px",maxHeight:"80vh",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.3)",overflowY:"auto"},className:"modal-scrollbar",onClick:l=>l.stopPropagation(),children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-irregular-shape",d),defaultOpen:!0},l.title))})})});const n=this.calculateModalHeight(),o=this.getCandleViewHeight()*.01;return m.jsx("div",{ref:this.irregularShapeModalRef,style:{position:"absolute",top:`${o}px`,left:"60px",zIndex:1e3,background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0px 0px",width:`${this.functionPopUpWidth}`,boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",height:`${n}px`,overflowY:"auto",paddingBottom:"0px"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:s.map((l,h)=>m.jsx(mt,{title:l.title,tools:l.tools,currentTheme:e,activeTool:i,onToolSelect:d=>this.handleToolAction("select-irregular-shape",d),defaultOpen:!0},l.title))})})},this.renderTecGraphTools=()=>{const{lastSelectedTools:e}=this.state,{irregularShapeTools:i,gannAndFibonacciTools:r,projectInfoTools:a}=this.getToolConfig(),s=this.findToolInGroups(r,e.fibonacci),n=this.findToolInGroups(a,e.projectInfo),o=this.findToolInGroups(i,e.irregularShape),l=[{id:"fibonacci",icon:s?.icon||Xi,className:"fibonacci-button",onMainClick:()=>this.handleToolAction("activate-tool","fibonacci"),onArrowClick:()=>this.handleToolAction("toggle-fibonacci")},{id:"project-info",icon:n?.icon||ua,className:"project-info-button",onMainClick:()=>this.handleToolAction("activate-tool","projectInfo"),onArrowClick:()=>this.handleToolAction("toggle-project-info")},{id:"irregular-shape",icon:o?.icon||Yi,className:"irregular-shape-button",onMainClick:()=>this.handleToolAction("activate-tool","irregularShape"),onArrowClick:()=>this.handleToolAction("toggle-irregular-shape")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:l.map(h=>this.renderToolButton(h,h.onMainClick,h.onArrowClick,!0,h.id==="fibonacci"?s?.icon:h.id==="project-info"?n?.icon:o?.icon))})},this.renderTrash=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),a=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),n=[{id:"clear-all-mark",icon:ga,className:"trash-button",hasArrow:!1,onMainClick:()=>{this.props.chartLayerRef?.current?.clearAllMark&&this.props.chartLayerRef.current.clearAllMark()},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?a?.icon:o.id==="text"?s?.icon:void 0))})},this.renderMarkTools=()=>{const{lastSelectedTools:e}=this.state,{penTools:i,textTools:r}=this.getToolConfig(),a=this.findToolInGroups(i,e.brush),s=this.findToolInGroups(r,e.textTool),n=[{id:"brush",icon:a?.icon||Vi,className:"brush-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","brush"),onArrowClick:()=>this.handleToolAction("toggle-brush")},{id:"text",icon:s?.icon||be,className:"text-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","textTool"),onArrowClick:()=>this.handleToolAction("toggle-text")},{id:"script",icon:qn,className:"script-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("toggle-script"),onArrowClick:()=>this.handleToolAction("toggle-script")},{id:"emoji",icon:aa,className:"emoji-button",hasArrow:!0,onMainClick:()=>this.handleToolAction("activate-tool","emoji"),onArrowClick:()=>this.handleToolAction("toggle-emoji")}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:n.map(o=>this.renderToolButton(o,o.onMainClick,o.onArrowClick,o.hasArrow,o.id==="brush"?a?.icon:o.id==="text"?s?.icon:void 0))})},this.renderTerminalButton=()=>{const e={id:"terminal",icon:Xn,className:"terminal-button",onMainClick:()=>{this.props.candleView?.openTerminal()},onArrowClick:()=>{}};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(e,e.onMainClick,e.onArrowClick,!1)})},this.renderAITools=()=>{const{aiTools:e}=this.getToolConfig(),{lastSelectedTools:i}=this.state;let r=null;for(const s of e){const n=s.tools.find(o=>o.id===i.aiTools);if(n){r=n;break}}const a={id:"ai",icon:r?.icon||wt,className:"ai-tools-button",onMainClick:()=>{this.handleToolAction("toggle-ai-tools")},onArrowClick:()=>{this.handleToolAction("toggle-ai-tools")}};return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:this.renderToolButton(a,a.onMainClick,a.onArrowClick,!0,r?.icon)})},this.renderOtherTools=()=>{const{isMarkLocked:e,isMarkVisibility:i}=this.state,r=[{id:"lock",icon:e?In:Ln,className:"lock-button",onMainClick:()=>{this.setState({isMarkLocked:!e})},onArrowClick:()=>{}},{id:"eye",icon:i?Hn:Kn,className:"eye-button",onMainClick:()=>{const a=!i;this.setState({isMarkVisibility:a}),this.props.chartLayerRef&&this.props.chartLayerRef.current&&(a?this.props.chartLayerRef.current.showAllMark&&this.props.chartLayerRef.current.showAllMark():this.props.chartLayerRef.current.hideAllMark&&this.props.chartLayerRef.current.hideAllMark())},onArrowClick:()=>{}}];return m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:r.map(a=>this.renderToolButton(a,a.onMainClick,a.onArrowClick,!1,void 0))})},this.state={isDrawingModalOpen:!1,isScriptModalOpen:!1,isEmojiSelectPopUpOpen:!1,isBrushModalOpen:!1,isRulerModalOpen:!1,isCursorModalOpen:!1,selectedEmoji:t.selectedEmoji||"😀",selectedEmojiCategory:"smileys",selectedCursor:"cursor-crosshair",isFibonacciModalOpen:!1,isGannModalOpen:!1,isProjectInfoModalOpen:!1,isIrregularShapeModalOpen:!1,isTextToolModalOpen:!1,isAIToolsModalOpen:!1,selectedAIBrand:"openai",selectedAIFunction:"describe-chart",lastSelectedTools:{drawing:"line-segment",brush:"pencil",ruler:"pencil",cursor:"cursor-crosshair",fibonacci:"fibonacci-retracement",projectInfo:"time-range",irregularShape:"rectangle",textTool:"text",aiTools:"describe-chart"},arrowButtonStates:{},toolHoverStates:{},systemSettings:{language:"zh-CN",themeMode:"light",autoSave:!0,showGrid:!0,hardwareAcceleration:!0},isMarkLocked:!1,isMarkVisibility:!0,containerHeight:0,ai:this.props.ai||!1,aiconfigs:this.props.aiconfigs||[],scrollButtonVisibility:{showTop:!1,showBottom:!1}},this.toolManager=new Ii}componentDidMount(){document.addEventListener("mousedown",t=>this.handleClickOutside(t),!0),document.addEventListener("touchstart",this.handleClickOutside,!0),this.updateContainerHeight(),window.addEventListener("resize",this.updateContainerHeight),this.checkScrollPosition()}componentWillUnmount(){document.removeEventListener("mousedown",t=>this.handleClickOutside(t),!0),window.removeEventListener("resize",this.updateContainerHeight)}componentDidUpdate(t){t.ai!==this.props.ai&&this.props.ai&&this.setState({ai:this.props.ai}),t.aiconfigs!==this.props.aiconfigs&&this.props.aiconfigs&&this.setState({aiconfigs:this.props.aiconfigs}),t.selectedEmoji!==this.props.selectedEmoji&&this.props.selectedEmoji&&this.setState({selectedEmoji:this.props.selectedEmoji})}getToolConfig(){return Gi(this.props.i18n)}findToolInGroups(t,e){for(const i of t){const r=i.tools.find(a=>a.id===e);if(r)return r}return null}render(){const{currentTheme:t}=this.props,{scrollButtonVisibility:e}=this.state;return m.jsxs("div",{ref:this.containerRef,style:{position:"relative",height:"100%"},children:[m.jsx("div",{style:{background:t.panel.backgroundColor,borderRight:`1px solid ${t.panel.borderColor}`,display:"flex",flexDirection:"column",width:"50px",boxSizing:"border-box",height:"100%",overflow:"hidden"},children:m.jsxs("div",{style:{flex:1,overflow:"hidden",position:"relative"},children:[m.jsxs("div",{ref:this.scrollContainerRef,style:{position:"absolute",top:0,left:0,right:0,bottom:0,overflowY:"auto",overflowX:"hidden",padding:"12px 6px",display:"flex",flexDirection:"column",gap:"0px",scrollbarWidth:"none",msOverflowStyle:"none"},onScroll:this.checkScrollPosition,children:[m.jsx("style",{children:`
260
260
  [style*="overflowY: auto"]::-webkit-scrollbar {
261
261
  width: 0px;
262
262
  height: 0px;
@@ -268,7 +268,7 @@ ${V}`)}else j(L?`Command executed: ${F}`:`命令已执行: ${F}`)},Dt=F=>{if(!r)
268
268
  [style*="overflowY: auto"]::-webkit-scrollbar-track {
269
269
  background: transparent;
270
270
  }
271
- `}),this.renderCursorTools(),this.renderLineTools(),this.renderTecGraphTools(),this.renderMarkTools(),m.jsx("div",{style:{height:"1px",background:t.toolbar.border,margin:"10px 0",flexShrink:0}}),this.props.ai&&this.props.aiconfigs.length>0&&this.renderAITools(),this.renderTerminalButton(),m.jsx("div",{style:{height:"1px",background:t.toolbar.border,margin:"10px 0",flexShrink:0}}),this.renderOtherTools(),m.jsx("div",{style:{height:"1px",background:t.toolbar.border,margin:"10px 0",flexShrink:0}}),this.renderTrash()]}),e.showTop&&m.jsx("button",{onClick:this.scrollToTop,style:{position:"absolute",top:"0px",left:"0px",right:"0px",zIndex:10,background:"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"30px",width:"100%",margin:"0",boxShadow:"none"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.5)",i.currentTarget.style.color="rgba(255, 255, 255, 1)"},onMouseLeave:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.3)",i.currentTarget.style.color="rgba(255, 255, 255, 0.9)"},children:m.jsx(Yn,{size:16,color:"currentColor"})}),e.showBottom&&m.jsx("button",{onClick:this.scrollToBottom,style:{position:"absolute",bottom:"0px",left:"0px",right:"0px",zIndex:10,background:"rgba(0, 0, 0, 0.1)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderTop:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"30px",width:"100%",margin:"0",boxShadow:"none"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.5)",i.currentTarget.style.color="rgba(255, 255, 255, 1)"},onMouseLeave:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.3)",i.currentTarget.style.color="rgba(255, 255, 255, 0.9)"},children:m.jsx(Vn,{size:16,color:"currentColor"})})]})}),this.renderDrawingModal(),this.renderBrushModal(),this.renderCursorModal(),this.renderEmojiSelectPopUp(),this.renderFibonacciModal(),this.renderProjectInfoModal(),this.renderIrregularShapeModal(),this.renderTextToolModal(),this.renderScriptModal(),this.props.ai&&this.props.aiconfigs.length>0&&this.renderAIToolsModal()]})}}class mt extends y.Component{constructor(t){super(t),this.toggleOpen=()=>{this.setState(e=>({isOpen:!e.isOpen}))},this.state={isOpen:t.defaultOpen||!1}}render(){const{title:t,tools:e,currentTheme:i,activeTool:r,onToolSelect:a}=this.props,{isOpen:s}=this.state;return m.jsxs("div",{style:{borderBottom:`1px solid ${i.toolbar.border}`},children:[m.jsxs("button",{onClick:this.toggleOpen,style:{width:"100%",background:"transparent",border:"none",padding:"12px 12px",color:i.layout.textColor,cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px",fontWeight:"600",transition:"background-color 0.2s"},onMouseEnter:n=>{n.currentTarget.style.background=i.toolbar.button.hover},onMouseLeave:n=>{n.currentTarget.style.background="transparent"},children:[m.jsx("span",{children:t}),m.jsx("span",{style:{transform:s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",fontSize:"12px"},children:"▼"})]}),s&&m.jsx("div",{style:{padding:"0px",background:i.toolbar.background},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:e.map(n=>{const o=n.icon,l=r===n.id;return m.jsxs("button",{onClick:()=>a(n.id),style:{background:l?i.toolbar.button.active:"transparent",border:l?`2px solid ${i.toolbar.button.active}`:"2px solid transparent",padding:"10px 10px",borderRadius:"0px",color:l?i.toolbar.button.activeTextColor||"#FFFFFF":i.layout.textColor,textAlign:"left",cursor:"pointer",fontSize:"12px",fontWeight:"500",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"0px",width:"100%"},onMouseEnter:h=>{l||(h.currentTarget.style.background=i.toolbar.button.hover)},onMouseLeave:h=>{l||(h.currentTarget.style.background="transparent")},children:[m.jsx(o,{size:24,color:l?i.toolbar.button.activeTextColor||i.layout.textColor:i.toolbar.button.color}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,paddingLeft:"5px"},children:[m.jsx("div",{style:{fontWeight:"600",fontSize:"12px",lineHeight:"1.2"},children:n.name}),m.jsx("div",{style:{fontSize:"10px",opacity:.7,lineHeight:"1.2",marginTop:"2px",textAlign:"left"},children:n.description})]})]},n.id)})})})]})}}const $i=f=>[{id:"ma",name:f.mainIndicators.ma,type:D.MA},{id:"ema",name:f.mainIndicators.ema,type:D.EMA},{id:"bollinger",name:f.mainIndicators.bollinger,type:D.BOLLINGER},{id:"ichimoku",name:f.mainIndicators.ichimoku,type:D.ICHIMOKU},{id:"donchian",name:f.mainIndicators.donchian,type:D.DONCHIAN},{id:"envelope",name:f.mainIndicators.envelope,type:D.ENVELOPE},{id:"vwap",name:f.mainIndicators.vwap,type:D.VWAP}],Ji=f=>[{id:"heatmap",name:f.mainChartMaps.heatmap,type:D.HEATMAP},{id:"market-profile",name:f.mainChartMaps.marketProfile,type:D.MARKETPROFILE}],bl=f=>[{id:"rsi",name:f.subChartIndicatorName.rsi,type:X.RSI},{id:"macd",name:f.subChartIndicatorName.macd,type:X.MACD},{id:"volume",name:f.subChartIndicatorName.volume,type:X.VOLUME},{id:"sar",name:f.subChartIndicatorName.sar,type:X.SAR},{id:"kdj",name:f.subChartIndicatorName.kdj,type:X.KDJ},{id:"atr",name:f.subChartIndicatorName.atr,type:X.ATR},{id:"stochastic",name:f.subChartIndicatorName.stochastic,type:X.STOCHASTIC},{id:"cci",name:f.subChartIndicatorName.cci,type:X.CCI},{id:"bbwidth",name:f.subChartIndicatorName.bbwidth,type:X.BBWIDTH},{id:"adx",name:f.subChartIndicatorName.adx,type:X.ADX},{id:"obv",name:f.subChartIndicatorName.obv,type:X.OBV}];function Tl(f){return[{type:f.timeframeSections.second,sectionKey:"Second",values:[E.ONE_SECOND,E.FIVE_SECONDS,E.FIFTEEN_SECONDS,E.THIRTY_SECONDS]},{type:f.timeframeSections.minute,sectionKey:"Minute",values:[E.ONE_MINUTE,E.THREE_MINUTES,E.FIVE_MINUTES,E.FIFTEEN_MINUTES,E.THIRTY_MINUTES,E.FORTY_FIVE_MINUTES]},{type:f.timeframeSections.hour,sectionKey:"Hour",values:[E.ONE_HOUR,E.TWO_HOURS,E.THREE_HOURS,E.FOUR_HOURS,E.SIX_HOURS,E.EIGHT_HOURS,E.TWELVE_HOURS]},{type:f.timeframeSections.day,sectionKey:"Day",values:[E.ONE_DAY,E.THREE_DAYS]},{type:f.timeframeSections.week,sectionKey:"Week",values:[E.ONE_WEEK,E.TWO_WEEKS]},{type:f.timeframeSections.month,sectionKey:"Month",values:[E.ONE_MONTH,E.THREE_MONTHS,E.SIX_MONTHS]}]}function wl(f,t){const{i18n:e}=f.props,i=$i(e),r=Ji(e);var a=i.find(n=>n.id===t);a||(a=r.find(n=>n.id===t));let s;switch(a?.type){case D.MA:s={...we,nonce:Date.now()};break;case D.EMA:s={...ve,nonce:Date.now()};break;case D.BOLLINGER:s={...xe,nonce:Date.now()};break;case D.ICHIMOKU:s={...Ae,nonce:Date.now()};break;case D.DONCHIAN:s={...De,nonce:Date.now()};break;case D.ENVELOPE:s={...Fe,nonce:Date.now()};break;case D.VWAP:s={...Ee,nonce:Date.now()};break;case D.HEATMAP:s={...ye,nonce:Date.now()};break;case D.MARKETPROFILE:s={...Re,nonce:Date.now()};break;default:s=null;break}s&&(f.setState({selectedMainIndicator:s}),f.props.handleSelectedMainChartIndicator(s))}function vl(f,t){f.setState(e=>{const i=e.selectedSubChartIndicators.includes(t);let r;return i?r=e.selectedSubChartIndicators.filter(a=>a!==t):r=[...e.selectedSubChartIndicators,t],f.props.handleSelectedSubChartIndicator&&f.props.handleSelectedSubChartIndicator(r),{selectedSubChartIndicators:r}})}class xl extends y.Component{constructor(){super(...arguments),this.timeframeModalRef=y.createRef(),this.chartTypeModalRef=y.createRef(),this.indicatorModalRef=y.createRef(),this.timezoneModalRef=y.createRef(),this.scrollContainerRef=y.createRef(),this.aiModalRef=y.createRef(),this.state={aiSearch:"",mainIndicatorsSearch:"",subChartIndicatorsSearch:"",chartTypeSearch:"",selectedMainIndicator:null,selectedSubChartIndicators:[],timeframeSections:{Second:!0,Minute:!0,Hour:!0,Day:!0,Week:!0,Month:!0},timezoneSearch:"",indicatorSections:{technicalIndicators:!0,chart:!0,subChartIndicators:!0},scrollButtonVisibility:{showLeft:!1,showRight:!1},aiSections:{}},this.checkScrollPosition=()=>{const t=this.scrollContainerRef.current;if(t){const{scrollLeft:e,scrollWidth:i,clientWidth:r}=t;this.setState({scrollButtonVisibility:{showLeft:e>10,showRight:e<i-r-10}})}},this.scrollToLeft=()=>{this.scrollContainerRef.current&&(this.scrollContainerRef.current.scrollLeft=0,this.checkScrollPosition())},this.scrollToRight=()=>{if(this.scrollContainerRef.current){const t=this.scrollContainerRef.current;t.scrollLeft=t.scrollWidth,this.checkScrollPosition()}},this.handleClickOutside=t=>{const e=t.target,i=e.closest("[data-timeframe-modal]")||e.closest("[data-chart-type-modal]")||e.closest("[data-indicator-modal]")||e.closest("[data-timezone-modal]")||e.closest("[data-ai-modal]")||e.closest("[data-mobile-menu-modal]"),r=e.closest(".timeframe-button")||e.closest(".chart-type-button")||e.closest(".indicator-button")||e.closest(".timezone-button")||e.closest(".ai-button")||e.closest(".mobile-menu-button");if(i||r)return;const{isTimeframeModalOpen:a,isChartTypeModalOpen:s,isIndicatorModalOpen:n,isTimezoneModalOpen:o,isMobileMenuOpen:l,isAIModalOpen:h}=this.props;(a||s||n||o||l||h)&&this.props.onCloseModals&&this.props.onCloseModals()},this.handleTimeframeSelect=t=>{this.props.onTimeframeSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleChartTypeSelect=t=>{this.props.onChartTypeSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleTimezoneSelect=t=>{this.props.onTimezoneSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleAIToolSelect=t=>{this.props.handleAIFunctionSelect&&this.props.handleAIFunctionSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleMainIndicatorsSearch=t=>{this.setState({mainIndicatorsSearch:t.target.value})},this.handleTimezoneSearch=t=>{this.setState({timezoneSearch:t.target.value})},this.filteredMaps=()=>{const{mainIndicatorsSearch:t}=this.state,{i18n:e}=this.props,i=Ji(e);return t?i.filter(r=>r.name.toLowerCase().includes(t.toLowerCase())):i},this.filteredMainIndicators=()=>{const{mainIndicatorsSearch:t}=this.state,{i18n:e}=this.props,i=$i(e);return t?i.filter(r=>r.name.toLowerCase().includes(t.toLowerCase())):i},this.filteredSubChartIndicators=()=>{const{subChartIndicatorsSearch:t}=this.state,{i18n:e}=this.props,i=bl(e);return t?i.filter(r=>r.name.toLowerCase().includes(t.toLowerCase())):i},this.toggleTimeframeSection=t=>{this.setState(e=>({timeframeSections:{...e.timeframeSections,[t]:!e.timeframeSections[t]}}))},this.toggleIndicatorSection=t=>{this.setState(e=>({indicatorSections:{...e.indicatorSections,[t]:!e.indicatorSections[t]}}))},this.getChartTypeLabel=t=>{const{i18n:e}=this.props;switch(t){case G.Candle:return e.chartTypes.candle;case G.HollowCandle:return e.chartTypes.hollowCandle;case G.Bar:return e.chartTypes.bar;case G.BaseLine:return e.chartTypes.baseline;case G.Line:return e.chartTypes.line;case G.Area:return e.chartTypes.area;case G.StepLine:return e.chartTypes.stepLine;case G.HeikinAshi:return e.chartTypes.heikinAshi;case G.Histogram:return e.chartTypes.histogram;case G.LineBreak:return e.chartTypes.linebreak;case G.Mountain:return e.chartTypes.mountain;case G.BaselineArea:return e.chartTypes.baselinearea;case G.HighLow:return e.chartTypes.highlow;case G.HLCArea:return e.chartTypes.hlcarea;default:return""}},this.getCandleViewHeight=()=>this.props.candleViewRef&&this.props.candleViewRef.current?this.props.candleViewRef.current.clientHeight||0:window.innerHeight*.7,this.calculateModalHeight=()=>{const t=this.getCandleViewHeight();return Math.min(t*.8,400)},this.calculateModalTop=()=>`${this.getCandleViewHeight()*.045}px`,this.calculateModalPosition=(t,e=280)=>{const i=this.scrollContainerRef.current;if(!i)return{left:t};const r=i.getBoundingClientRect(),a=r.left,s=r.right;r.width;const n=parseFloat(t);if(a+n+e>s){const l=s-a;if(l>e)return{left:`${l-e}px`};{const h=l-20;return{left:"10px",width:Math.max(200,h)}}}return{left:t}},this.handleChartTypeSearch=t=>{this.setState({chartTypeSearch:t.target.value})},this.renderChartTypeModal=()=>{const{isChartTypeModalOpen:t,currentTheme:e,activeMainChartType:i,i18n:r,isMobileMode:a}=this.props,{chartTypeSearch:s}=this.state;if(!t)return null;const n=s?Se.filter(c=>this.getChartTypeLabel(c.type).toLowerCase().includes(s.toLowerCase())):Se,o=this.calculateModalHeight(),l=this.calculateModalTop(),d=this.calculateModalPosition("138px",200),g=m.jsxs("div",{ref:this.chartTypeModalRef,"data-chart-type-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"200px",width:a?"100%":d.width?`${d.width}px`:"180px",maxWidth:a?"400px":"none",maxHeight:a?"80vh":`${o}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${e.toolbar.border}`,flexShrink:0},children:m.jsxs("div",{style:{position:"relative",width:"100%"},children:[m.jsx("input",{type:"text",placeholder:r.searchChartTypes,value:s,onChange:this.handleChartTypeSearch,style:{width:"100%",background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"8px 32px 8px 12px",color:e.layout.textColor,fontSize:"13px",outline:"none",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=e.toolbar.button.active},onBlur:c=>{c.target.style.borderColor=e.toolbar.border}}),s&&m.jsx("button",{onClick:()=>this.setState({chartTypeSearch:""}),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",borderRadius:"50%",width:"18px",height:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:e.toolbar.button.color,opacity:.6,transition:"all 0.2s ease",fontSize:"12px",padding:0},onMouseEnter:c=>{c.currentTarget.style.background=e.toolbar.button.hover,c.currentTarget.style.opacity="1"},onMouseLeave:c=>{c.currentTarget.style.background="transparent",c.currentTarget.style.opacity="0.6"},children:m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",flex:1,padding:"8px",maxHeight:a?"calc(80vh - 73px)":`calc(${o}px - 73px)`},className:"modal-scrollbar",children:n.map(c=>{const u=i===c.type;return m.jsxs("button",{onClick:()=>this.handleChartTypeSelect(c.type),style:{background:u?e.toolbar.button.active:"transparent",border:"none",borderRadius:"0px",padding:"6px 8px",cursor:"pointer",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"12px",minHeight:"32px",width:"100%"},onMouseEnter:p=>{u||(p.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:p=>{u||(p.currentTarget.style.background="transparent")},children:[m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:0},children:xi(c.type,{size:30})}),m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,flex:1,textAlign:"left"},children:this.getChartTypeLabel(c.type)})]},c.type)})})]});return a?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:g})]}):m.jsx("div",{style:{position:"absolute",top:l,left:d.left,zIndex:1e3},children:g})},this.renderIndicatorModal=()=>{const{isIndicatorModalOpen:t,currentTheme:e,i18n:i,isMobileMode:r}=this.props,{mainIndicatorsSearch:a,indicatorSections:s}=this.state,n=this.filteredMainIndicators(),o=this.filteredMaps(),l=this.filteredSubChartIndicators();if(!t)return null;const h=[{type:i.mainChartIndicators||"技术指标",sectionKey:"technicalIndicators",values:n},{type:i.subChartIndicators||"副图指标",sectionKey:"subChartIndicators",values:l},{type:i.chartMaps||"图",sectionKey:"chart",values:o}],d=this.calculateModalHeight(),g=this.calculateModalTop(),u=this.calculateModalPosition("185px",280),p=m.jsxs("div",{ref:this.indicatorModalRef,"data-indicator-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"280px",width:r?"100%":u.width?`${u.width}px`:"180px",maxWidth:r?"400px":"none",maxHeight:r?"80vh":`${d}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${e.toolbar.border}`,flexShrink:0},children:m.jsxs("div",{style:{position:"relative",width:"100%"},children:[m.jsx("input",{type:"text",placeholder:i.searchIndicators,value:a,onChange:this.handleMainIndicatorsSearch,style:{width:"100%",background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"8px 32px 8px 12px",color:e.layout.textColor,fontSize:"13px",outline:"none",boxSizing:"border-box"},onFocus:M=>{M.target.style.borderColor=e.toolbar.button.active},onBlur:M=>{M.target.style.borderColor=e.toolbar.border}}),a&&m.jsx("button",{onClick:()=>this.setState({mainIndicatorsSearch:""}),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",borderRadius:"50%",width:"18px",height:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:e.toolbar.button.color,opacity:.6,transition:"all 0.2s ease",fontSize:"12px",padding:0},onMouseEnter:M=>{M.currentTarget.style.background=e.toolbar.button.hover,M.currentTarget.style.opacity="1"},onMouseLeave:M=>{M.currentTarget.style.background="transparent",M.currentTarget.style.opacity="0.6"},children:m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px",overflowY:"auto",flex:1,padding:"8px",maxHeight:r?"calc(80vh - 73px)":`calc(${d}px - 73px)`},className:"modal-scrollbar",children:h.map(M=>{const k=s[M.sectionKey],P=M.sectionKey==="subChartIndicators";return m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>this.toggleIndicatorSection(M.sectionKey),style:{background:"transparent",border:"none",borderRadius:"0px",padding:"12px 10px",cursor:"pointer",color:e.layout.textColor,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",minHeight:"32px"},onMouseEnter:S=>{S.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:S=>{S.currentTarget.style.background="transparent"},children:[m.jsx("div",{style:{fontSize:"12px",fontWeight:"600",opacity:.8,textTransform:"uppercase"},children:M.type}),m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",transition:"transform 0.2s ease",transform:k?"rotate(180deg)":"rotate(0deg)"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),k&&m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:M.values.map(S=>{const _=P?this.state.selectedSubChartIndicators.includes(S.type):!1;return m.jsxs("button",{onClick:()=>{P?vl(this,S.type):wl(this,S.id)},style:{background:"transparent",border:"none",padding:"6px 8px",borderRadius:"0px",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.2s ease",minHeight:"32px",width:"100%",textAlign:"left"},onMouseEnter:C=>{C.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:[P?m.jsx(y.Fragment,{children:m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",border:`2px solid ${_?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"3px",marginRight:"10px",background:_?e.toolbar.button.active:"transparent",transition:"all 0.2s ease",flexShrink:0,position:"relative"},children:_&&m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#ffffff",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},children:m.jsx("polyline",{points:"20 6 9 17 4 12"})})})}):null,m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:e.layout.textColor,textAlign:"left",flex:1,lineHeight:"1.4"},children:S.name})]},S.id)})})]},M.type)})})]});return r?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:p})]}):m.jsx("div",{style:{position:"absolute",top:g,left:u.left,zIndex:1e3},children:p})}}componentDidMount(){typeof window<"u"&&document.addEventListener("mousedown",this.handleClickOutside,!0),document.addEventListener("touchstart",this.handleClickOutside,!0),this.checkScrollPosition(),window.addEventListener("resize",this.checkScrollPosition)}componentWillUnmount(){typeof window<"u"&&document.removeEventListener("mousedown",this.handleClickOutside,!0),window.removeEventListener("resize",this.checkScrollPosition)}componentDidUpdate(t){t.selectedSubChartIndicators!==this.props.selectedSubChartIndicators&&this.setState({selectedSubChartIndicators:this.props.selectedSubChartIndicators||[]})}getCurrentTimezoneDisplayName(){const{i18n:t}=this.props,e={[W.NEW_YORK]:t.options.newYork.split(" ")[0],[W.CHICAGO]:t.options.chicago.split(" ")[0],[W.DENVER]:t.options.denver.split(" ")[0],[W.LOS_ANGELES]:t.options.losAngeles.split(" ")[0],[W.TORONTO]:t.options.toronto.split(" ")[0],[W.LONDON]:t.options.london.split(" ")[0],[W.PARIS]:t.options.paris.split(" ")[0],[W.FRANKFURT]:t.options.frankfurt.split(" ")[0],[W.ZURICH]:t.options.zurich.split(" ")[0],[W.MOSCOW]:t.options.moscow.split(" ")[0],[W.DUBAI]:t.options.dubai.split(" ")[0],[W.KARACHI]:t.options.karachi.split(" ")[0],[W.KOLKATA]:t.options.kolkata.split(" ")[0],[W.SHANGHAI]:t.options.shanghai.split(" ")[0],[W.HONG_KONG]:t.options.hongKong.split(" ")[0],[W.SINGAPORE]:t.options.singapore.split(" ")[0],[W.TOKYO]:t.options.tokyo.split(" ")[0],[W.SEOUL]:t.options.seoul.split(" ")[0],[W.SYDNEY]:t.options.sydney.split(" ")[0],[W.AUCKLAND]:t.options.auckland.split(" ")[0],[W.UTC]:"UTC"},i=this.props.timezone||this.props.currentTimezone;return e[i]||i.split("/").pop()||i}renderAIModal(){const{currentTheme:t,isMobileMode:e,ai:i,aiconfigs:r,isAIModalOpen:a,i18n:s}=this.props;if(!a||!i||!r||r.length===0)return null;const{aiSections:n}=this.state,{aiTools:o}=Gi(this.props.i18n),l=o.filter(p=>r.some(k=>k.brand===p.title.toLowerCase()));if(l.length===0)return null;const h=this.calculateModalHeight(),d=this.calculateModalTop(),c=this.calculateModalPosition("225px",280),u=m.jsx("div",{ref:this.aiModalRef,"data-ai-modal":"true",style:{background:t.toolbar.background,border:`1px solid ${t.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"280px",width:e?"100%":c.width?`${c.width}px`:"280px",maxWidth:e?"400px":"none",maxHeight:e?"80vh":`${h}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px",overflowY:"auto",flex:1,padding:"8px",maxHeight:e?"80vh":`${h}px`},className:"modal-scrollbar",children:l.map(p=>{const M=p.title,k=n[M]!==void 0?n[M]:!0,P=S=>{this.setState(_=>({aiSections:{..._.aiSections,[S]:!(_.aiSections[S]===void 0||_.aiSections[S])}}))};return m.jsxs("div",{style:{borderBottom:`1px solid ${t.toolbar.border}`},children:[m.jsxs("button",{onClick:()=>P(M),style:{width:"100%",background:"transparent",border:"none",padding:"12px 12px",color:t.layout.textColor,cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px",fontWeight:"600",transition:"background-color 0.2s"},onMouseEnter:S=>{S.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:S=>{S.currentTarget.style.background="transparent"},children:[m.jsx("span",{children:M.toUpperCase()}),m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",transition:"transform 0.2s ease",transform:k?"rotate(180deg)":"rotate(0deg)"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),k&&m.jsx("div",{style:{padding:"0px",background:t.toolbar.background},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:p.tools.map(S=>{const _=S.icon;return m.jsx("button",{onClick:()=>this.handleAIToolSelect(S.id),style:{background:"transparent",border:"none",padding:"6px 15px",cursor:"pointer",color:t.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",minHeight:"32px",width:"100%"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsxs("div",{style:{fontSize:"13px",fontWeight:"500",color:t.layout.textColor,flex:1,textAlign:"left",display:"flex",alignItems:"center",gap:"10px"},children:[m.jsx(_,{size:20,color:t.toolbar.button.color,style:{flexShrink:0}}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1},children:[m.jsx("div",{style:{fontSize:"13px",fontWeight:"500"},children:S.name}),m.jsx("div",{style:{fontSize:"11px",fontWeight:"400",color:t.toolbar.button.color,opacity:.7,marginTop:"2px"},children:S.description})]})]})},S.id)})})})]},M)})})});return e?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:u})]}):m.jsx("div",{style:{position:"absolute",top:d,left:c.left,zIndex:1e3},children:u})}renderTimeframeModal(){const{isTimeframeModalOpen:t,currentTheme:e,activeTimeframe:i,timeframeCallbacks:r,isCloseInternalTimeFrameCalculation:a,isMobileMode:s}=this.props,{timeframeSections:n}=this.state;if(!t)return null;const o=Tl(this.props.i18n);let l=o;if(a&&r){const p=Object.keys(r);l=o.map(M=>({...M,values:M.values.filter(k=>p.includes(k))})).filter(M=>M.values.length>0)}const h=this.calculateModalHeight(),d=this.calculateModalTop(),c=this.calculateModalPosition("13px",180),u=m.jsx("div",{ref:this.timeframeModalRef,"data-timeframe-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"180px",width:s?"100%":c.width?`${c.width}px`:"180px",maxWidth:s?"400px":"none",maxHeight:s?"80vh":`${h}px`,overflowY:"auto",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(p=>{const M=n[p.sectionKey];return m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>this.toggleTimeframeSection(p.sectionKey),style:{background:"transparent",border:"none",borderRadius:"0px",padding:"12px 10px",cursor:"pointer",color:e.layout.textColor,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",minHeight:"32px"},onMouseEnter:k=>{k.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:[m.jsx("div",{style:{fontSize:"12px",fontWeight:"600",opacity:.8,textTransform:"uppercase"},children:p.type}),m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",transition:"transform 0.2s ease",transform:M?"rotate(180deg)":"rotate(0deg)"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),M&&m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:p.values.map(k=>{const P=i===k;return m.jsx("button",{onClick:()=>this.handleTimeframeSelect(k),style:{background:P?e.toolbar.button.active:"transparent",border:"none",borderRadius:"0px",padding:"6px 15px",cursor:"pointer",color:P?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",minHeight:"32px",width:"100%"},onMouseEnter:S=>{P||(S.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:S=>{P||(S.currentTarget.style.background="transparent")},children:m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:P?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,flex:1,textAlign:"left"},children:il(k,this.props.i18n)})},k)})})]},p.type)})})});return s?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:u})]}):m.jsx("div",{style:{position:"absolute",top:d,left:c.left,zIndex:1e3},children:u})}renderTimezoneModal(){const{isTimezoneModalOpen:t,currentTheme:e,i18n:i,isMobileMode:r}=this.props,{timezoneSearch:a}=this.state;if(!t)return null;const s=[{id:W.NEW_YORK,name:i.options.newYork,offset:"-05:00/-04:00"},{id:W.CHICAGO,name:i.options.chicago,offset:"-06:00/-05:00"},{id:W.DENVER,name:i.options.denver,offset:"-07:00/-06:00"},{id:W.LOS_ANGELES,name:i.options.losAngeles,offset:"-08:00/-07:00"},{id:W.TORONTO,name:i.options.toronto,offset:"-05:00/-04:00"},{id:W.LONDON,name:i.options.london,offset:"+00:00/+01:00"},{id:W.PARIS,name:i.options.paris,offset:"+01:00/+02:00"},{id:W.FRANKFURT,name:i.options.frankfurt,offset:"+01:00/+02:00"},{id:W.ZURICH,name:i.options.zurich,offset:"+01:00/+02:00"},{id:W.MOSCOW,name:i.options.moscow,offset:"+03:00"},{id:W.DUBAI,name:i.options.dubai,offset:"+04:00"},{id:W.KARACHI,name:i.options.karachi,offset:"+05:00"},{id:W.KOLKATA,name:i.options.kolkata,offset:"+05:30"},{id:W.SHANGHAI,name:i.options.shanghai,offset:"+08:00"},{id:W.HONG_KONG,name:i.options.hongKong,offset:"+08:00"},{id:W.SINGAPORE,name:i.options.singapore,offset:"+08:00"},{id:W.TOKYO,name:i.options.tokyo,offset:"+09:00"},{id:W.SEOUL,name:i.options.seoul,offset:"+09:00"},{id:W.SYDNEY,name:i.options.sydney,offset:"+10:00/+11:00"},{id:W.AUCKLAND,name:i.options.auckland,offset:"+12:00/+13:00"},{id:W.UTC,name:i.options.utc,offset:"+00:00"}],n=a?s.filter(c=>c.name.toLowerCase().includes(a.toLowerCase())||c.id.toLowerCase().includes(a.toLowerCase())):s,o=this.calculateModalHeight(),l=this.calculateModalTop(),d=this.calculateModalPosition("60px",300),g=m.jsxs("div",{ref:this.timezoneModalRef,"data-timezone-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"300px",width:r?"100%":d.width?`${d.width}px`:"180px",maxWidth:r?"400px":"none",maxHeight:r?"80vh":`${o}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${e.toolbar.border}`,flexShrink:0},children:m.jsxs("div",{style:{position:"relative",width:"100%"},children:[m.jsx("input",{type:"text",placeholder:i.searchTimezones,value:a,onChange:this.handleTimezoneSearch,style:{width:"100%",background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"8px 32px 8px 12px",color:e.layout.textColor,fontSize:"13px",outline:"none",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=e.toolbar.button.active},onBlur:c=>{c.target.style.borderColor=e.toolbar.border}}),a&&m.jsx("button",{onClick:()=>this.setState({timezoneSearch:""}),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",borderRadius:"50%",width:"18px",height:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:e.toolbar.button.color,opacity:.6,transition:"all 0.2s ease",fontSize:"12px",padding:0},onMouseEnter:c=>{c.currentTarget.style.background=e.toolbar.button.hover,c.currentTarget.style.opacity="1"},onMouseLeave:c=>{c.currentTarget.style.background="transparent",c.currentTarget.style.opacity="0.6"},children:m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",flex:1,padding:"8px",maxHeight:r?"calc(80vh - 73px)":`calc(${o}px - 73px)`},className:"modal-scrollbar",children:n.map(c=>{const u=this.props.currentTimezone===c.id;return m.jsxs("button",{onClick:()=>this.handleTimezoneSelect(c.id),style:{background:u?e.toolbar.button.active:"transparent",border:"none",borderRadius:"0px",padding:"8px 12px",cursor:"pointer",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",flexDirection:"column",gap:"2px",minHeight:"48px",width:"100%"},onMouseEnter:p=>{u||(p.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:p=>{u||(p.currentTarget.style.background="transparent")},children:[m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:u&&e.toolbar.button.activeTextColor||e.layout.textColor,textAlign:"left"},children:c.name}),m.jsxs("div",{style:{fontSize:"11px",fontWeight:"400",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,opacity:.7,textAlign:"left"},children:[c.id," • UTC",c.offset]})]},c.id)})})]});return r?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:g})]}):m.jsx("div",{style:{position:"absolute",top:l,left:d.left,zIndex:1e3},children:g})}render(){const{currentTheme:t,activeTimeframe:e,activeMainChartType:i,isDarkTheme:r,isTimeframeModalOpen:a,isIndicatorModalOpen:s,isChartTypeModalOpen:n,isTimezoneModalOpen:o,onThemeToggle:l,onTimeframeClick:h,onIndicatorClick:d,onChartTypeClick:g,onFullscreenClick:c,onTimezoneClick:u,onCameraClick:p,i18n:M,ai:k,aiconfigs:P,onAIClick:S}=this.props,{scrollButtonVisibility:_}=this.state;return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{background:t.panel.backgroundColor,borderBottom:`1px solid ${t.panel.borderColor}`,padding:"9px 0",display:"flex",alignItems:"center",justifyContent:"flex-start",height:"43px",boxSizing:"border-box",gap:"0",position:"relative",overflow:"hidden"},children:[_.showLeft&&m.jsx("button",{onClick:this.scrollToLeft,style:{position:"absolute",left:"0",top:"0",bottom:"0",zIndex:10,background:"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderRight:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"0 6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",width:"30px",height:"100%",boxShadow:"none"},onMouseEnter:C=>{C.currentTarget.style.background="rgba(0, 0, 0, 0.5)",C.currentTarget.style.color="rgba(255, 255, 255, 1)"},onMouseLeave:C=>{C.currentTarget.style.background="rgba(0, 0, 0, 0.3)",C.currentTarget.style.color="rgba(255, 255, 255, 0.9)"},children:m.jsx("span",{style:{fontSize:"16px"},children:"‹"})}),m.jsxs("div",{ref:this.scrollContainerRef,style:{flex:1,overflowX:"auto",overflowY:"hidden",display:"flex",alignItems:"center",gap:"0",padding:"0 13px",scrollbarWidth:"none",msOverflowStyle:"none"},onScroll:this.checkScrollPosition,children:[m.jsx("style",{children:`
271
+ `}),this.renderCursorTools(),this.renderLineTools(),this.renderTecGraphTools(),this.renderMarkTools(),m.jsx("div",{style:{height:"1px",background:t.toolbar.border,margin:"10px 0",flexShrink:0}}),this.props.ai&&this.props.aiconfigs.length>0&&this.renderAITools(),this.renderTerminalButton(),m.jsx("div",{style:{height:"1px",background:t.toolbar.border,margin:"10px 0",flexShrink:0}}),this.renderOtherTools(),m.jsx("div",{style:{height:"1px",background:t.toolbar.border,margin:"10px 0",flexShrink:0}}),this.renderTrash()]}),e.showTop&&m.jsx("button",{onClick:this.scrollToTop,style:{position:"absolute",top:"0px",left:"0px",right:"0px",zIndex:10,background:"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderBottom:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"30px",width:"100%",margin:"0",boxShadow:"none"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.5)",i.currentTarget.style.color="rgba(255, 255, 255, 1)"},onMouseLeave:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.3)",i.currentTarget.style.color="rgba(255, 255, 255, 0.9)"},children:m.jsx(Yn,{size:16,color:"currentColor"})}),e.showBottom&&m.jsx("button",{onClick:this.scrollToBottom,style:{position:"absolute",bottom:"0px",left:"0px",right:"0px",zIndex:10,background:"rgba(0, 0, 0, 0.1)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderTop:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",height:"30px",width:"100%",margin:"0",boxShadow:"none"},onMouseEnter:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.5)",i.currentTarget.style.color="rgba(255, 255, 255, 1)"},onMouseLeave:i=>{i.currentTarget.style.background="rgba(0, 0, 0, 0.3)",i.currentTarget.style.color="rgba(255, 255, 255, 0.9)"},children:m.jsx(Vn,{size:16,color:"currentColor"})})]})}),this.renderDrawingModal(),this.renderBrushModal(),this.renderCursorModal(),this.renderEmojiSelectPopUp(),this.renderFibonacciModal(),this.renderProjectInfoModal(),this.renderIrregularShapeModal(),this.renderTextToolModal(),this.renderScriptModal(),this.props.ai&&this.props.aiconfigs.length>0&&this.renderAIToolsModal()]})}}class mt extends y.Component{constructor(t){super(t),this.toggleOpen=()=>{this.setState(e=>({isOpen:!e.isOpen}))},this.state={isOpen:t.defaultOpen||!1}}render(){const{title:t,tools:e,currentTheme:i,activeTool:r,onToolSelect:a}=this.props,{isOpen:s}=this.state;return m.jsxs("div",{style:{borderBottom:`1px solid ${i.toolbar.border}`},children:[m.jsxs("button",{onClick:this.toggleOpen,style:{width:"100%",background:"transparent",border:"none",padding:"12px 12px",color:i.layout.textColor,cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px",fontWeight:"600",transition:"background-color 0.2s"},onMouseEnter:n=>{n.currentTarget.style.background=i.toolbar.button.hover},onMouseLeave:n=>{n.currentTarget.style.background="transparent"},children:[m.jsx("span",{children:t}),m.jsx("span",{style:{transform:s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s",fontSize:"12px"},children:"▼"})]}),s&&m.jsx("div",{style:{padding:"0px",background:i.toolbar.background},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:e.map(n=>{const o=n.icon,l=r===n.id;return m.jsxs("button",{onClick:()=>a(n.id),style:{background:l?i.toolbar.button.active:"transparent",border:l?`2px solid ${i.toolbar.button.active}`:"2px solid transparent",padding:"10px 10px",borderRadius:"0px",color:l?i.toolbar.button.activeTextColor||"#FFFFFF":i.layout.textColor,textAlign:"left",cursor:"pointer",fontSize:"12px",fontWeight:"500",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"0px",width:"100%"},onMouseEnter:h=>{l||(h.currentTarget.style.background=i.toolbar.button.hover)},onMouseLeave:h=>{l||(h.currentTarget.style.background="transparent")},children:[m.jsx(o,{size:24,color:l?i.toolbar.button.activeTextColor||i.layout.textColor:i.toolbar.button.color}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1,paddingLeft:"5px"},children:[m.jsx("div",{style:{fontWeight:"600",fontSize:"12px",lineHeight:"1.2"},children:n.name}),m.jsx("div",{style:{fontSize:"10px",opacity:.7,lineHeight:"1.2",marginTop:"2px",textAlign:"left"},children:n.description})]})]},n.id)})})})]})}}const $i=f=>[{id:"ma",name:f.mainIndicators.ma,type:D.MA},{id:"ema",name:f.mainIndicators.ema,type:D.EMA},{id:"bollinger",name:f.mainIndicators.bollinger,type:D.BOLLINGER},{id:"ichimoku",name:f.mainIndicators.ichimoku,type:D.ICHIMOKU},{id:"donchian",name:f.mainIndicators.donchian,type:D.DONCHIAN},{id:"envelope",name:f.mainIndicators.envelope,type:D.ENVELOPE},{id:"vwap",name:f.mainIndicators.vwap,type:D.VWAP}],Ji=f=>[{id:"heatmap",name:f.mainChartMaps.heatmap,type:D.HEATMAP},{id:"market-profile",name:f.mainChartMaps.marketProfile,type:D.MARKETPROFILE}],Pl=f=>[{id:"rsi",name:f.subChartIndicatorName.rsi,type:X.RSI},{id:"macd",name:f.subChartIndicatorName.macd,type:X.MACD},{id:"volume",name:f.subChartIndicatorName.volume,type:X.VOLUME},{id:"sar",name:f.subChartIndicatorName.sar,type:X.SAR},{id:"kdj",name:f.subChartIndicatorName.kdj,type:X.KDJ},{id:"atr",name:f.subChartIndicatorName.atr,type:X.ATR},{id:"stochastic",name:f.subChartIndicatorName.stochastic,type:X.STOCHASTIC},{id:"cci",name:f.subChartIndicatorName.cci,type:X.CCI},{id:"bbwidth",name:f.subChartIndicatorName.bbwidth,type:X.BBWIDTH},{id:"adx",name:f.subChartIndicatorName.adx,type:X.ADX},{id:"obv",name:f.subChartIndicatorName.obv,type:X.OBV}];function Sl(f){return[{type:f.timeframeSections.second,sectionKey:"Second",values:[E.ONE_SECOND,E.FIVE_SECONDS,E.FIFTEEN_SECONDS,E.THIRTY_SECONDS]},{type:f.timeframeSections.minute,sectionKey:"Minute",values:[E.ONE_MINUTE,E.THREE_MINUTES,E.FIVE_MINUTES,E.FIFTEEN_MINUTES,E.THIRTY_MINUTES,E.FORTY_FIVE_MINUTES]},{type:f.timeframeSections.hour,sectionKey:"Hour",values:[E.ONE_HOUR,E.TWO_HOURS,E.THREE_HOURS,E.FOUR_HOURS,E.SIX_HOURS,E.EIGHT_HOURS,E.TWELVE_HOURS]},{type:f.timeframeSections.day,sectionKey:"Day",values:[E.ONE_DAY,E.THREE_DAYS]},{type:f.timeframeSections.week,sectionKey:"Week",values:[E.ONE_WEEK,E.TWO_WEEKS]},{type:f.timeframeSections.month,sectionKey:"Month",values:[E.ONE_MONTH,E.THREE_MONTHS,E.SIX_MONTHS]}]}function _l(f,t){const{i18n:e}=f.props,i=$i(e),r=Ji(e);var a=i.find(n=>n.id===t);a||(a=r.find(n=>n.id===t));let s;switch(a?.type){case D.MA:s={...we,nonce:Date.now()};break;case D.EMA:s={...ve,nonce:Date.now()};break;case D.BOLLINGER:s={...xe,nonce:Date.now()};break;case D.ICHIMOKU:s={...Ae,nonce:Date.now()};break;case D.DONCHIAN:s={...De,nonce:Date.now()};break;case D.ENVELOPE:s={...Fe,nonce:Date.now()};break;case D.VWAP:s={...Ee,nonce:Date.now()};break;case D.HEATMAP:s={...ye,nonce:Date.now()};break;case D.MARKETPROFILE:s={...Re,nonce:Date.now()};break;default:s=null;break}s&&(f.setState({selectedMainIndicator:s}),f.props.handleSelectedMainChartIndicator(s))}function Cl(f,t){f.setState(e=>{const i=e.selectedSubChartIndicators.includes(t);let r;return i?r=e.selectedSubChartIndicators.filter(a=>a!==t):r=[...e.selectedSubChartIndicators,t],f.props.handleSelectedSubChartIndicator&&f.props.handleSelectedSubChartIndicator(r),{selectedSubChartIndicators:r}})}class bl extends y.Component{constructor(){super(...arguments),this.timeframeModalRef=y.createRef(),this.chartTypeModalRef=y.createRef(),this.indicatorModalRef=y.createRef(),this.timezoneModalRef=y.createRef(),this.scrollContainerRef=y.createRef(),this.aiModalRef=y.createRef(),this.state={aiSearch:"",mainIndicatorsSearch:"",subChartIndicatorsSearch:"",chartTypeSearch:"",selectedMainIndicator:null,selectedSubChartIndicators:[],timeframeSections:{Second:!0,Minute:!0,Hour:!0,Day:!0,Week:!0,Month:!0},timezoneSearch:"",indicatorSections:{technicalIndicators:!0,chart:!0,subChartIndicators:!0},scrollButtonVisibility:{showLeft:!1,showRight:!1},aiSections:{}},this.checkScrollPosition=()=>{const t=this.scrollContainerRef.current;if(t){const{scrollLeft:e,scrollWidth:i,clientWidth:r}=t;this.setState({scrollButtonVisibility:{showLeft:e>10,showRight:e<i-r-10}})}},this.scrollToLeft=()=>{this.scrollContainerRef.current&&(this.scrollContainerRef.current.scrollLeft=0,this.checkScrollPosition())},this.scrollToRight=()=>{if(this.scrollContainerRef.current){const t=this.scrollContainerRef.current;t.scrollLeft=t.scrollWidth,this.checkScrollPosition()}},this.handleClickOutside=t=>{const e=t.target,i=e.closest("[data-timeframe-modal]")||e.closest("[data-chart-type-modal]")||e.closest("[data-indicator-modal]")||e.closest("[data-timezone-modal]")||e.closest("[data-ai-modal]")||e.closest("[data-mobile-menu-modal]"),r=e.closest(".timeframe-button")||e.closest(".chart-type-button")||e.closest(".indicator-button")||e.closest(".timezone-button")||e.closest(".ai-button")||e.closest(".mobile-menu-button");if(i||r)return;const{isTimeframeModalOpen:a,isChartTypeModalOpen:s,isIndicatorModalOpen:n,isTimezoneModalOpen:o,isMobileMenuOpen:l,isAIModalOpen:h}=this.props;(a||s||n||o||l||h)&&this.props.onCloseModals&&this.props.onCloseModals()},this.handleTimeframeSelect=t=>{this.props.onTimeframeSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleChartTypeSelect=t=>{this.props.onChartTypeSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleTimezoneSelect=t=>{this.props.onTimezoneSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleAIToolSelect=t=>{this.props.handleAIFunctionSelect&&this.props.handleAIFunctionSelect(t),this.props.onCloseModals&&this.props.onCloseModals()},this.handleMainIndicatorsSearch=t=>{this.setState({mainIndicatorsSearch:t.target.value})},this.handleTimezoneSearch=t=>{this.setState({timezoneSearch:t.target.value})},this.filteredMaps=()=>{const{mainIndicatorsSearch:t}=this.state,{i18n:e}=this.props,i=Ji(e);return t?i.filter(r=>r.name.toLowerCase().includes(t.toLowerCase())):i},this.filteredMainIndicators=()=>{const{mainIndicatorsSearch:t}=this.state,{i18n:e}=this.props,i=$i(e);return t?i.filter(r=>r.name.toLowerCase().includes(t.toLowerCase())):i},this.filteredSubChartIndicators=()=>{const{subChartIndicatorsSearch:t}=this.state,{i18n:e}=this.props,i=Pl(e);return t?i.filter(r=>r.name.toLowerCase().includes(t.toLowerCase())):i},this.toggleTimeframeSection=t=>{this.setState(e=>({timeframeSections:{...e.timeframeSections,[t]:!e.timeframeSections[t]}}))},this.toggleIndicatorSection=t=>{this.setState(e=>({indicatorSections:{...e.indicatorSections,[t]:!e.indicatorSections[t]}}))},this.getChartTypeLabel=t=>{const{i18n:e}=this.props;switch(t){case G.Candle:return e.chartTypes.candle;case G.HollowCandle:return e.chartTypes.hollowCandle;case G.Bar:return e.chartTypes.bar;case G.BaseLine:return e.chartTypes.baseline;case G.Line:return e.chartTypes.line;case G.Area:return e.chartTypes.area;case G.StepLine:return e.chartTypes.stepLine;case G.HeikinAshi:return e.chartTypes.heikinAshi;case G.Histogram:return e.chartTypes.histogram;case G.LineBreak:return e.chartTypes.linebreak;case G.Mountain:return e.chartTypes.mountain;case G.BaselineArea:return e.chartTypes.baselinearea;case G.HighLow:return e.chartTypes.highlow;case G.HLCArea:return e.chartTypes.hlcarea;default:return""}},this.getCandleViewHeight=()=>this.props.candleViewRef&&this.props.candleViewRef.current?this.props.candleViewRef.current.clientHeight||0:window.innerHeight*.7,this.calculateModalHeight=()=>{const t=this.getCandleViewHeight();return Math.min(t*.8,400)},this.calculateModalTop=()=>`${this.getCandleViewHeight()*.045}px`,this.calculateModalPosition=(t,e=280)=>{const i=this.scrollContainerRef.current;if(!i)return{left:t};const r=i.getBoundingClientRect(),a=r.left,s=r.right;r.width;const n=parseFloat(t);if(a+n+e>s){const l=s-a;if(l>e)return{left:`${l-e}px`};{const h=l-20;return{left:"10px",width:Math.max(200,h)}}}return{left:t}},this.handleChartTypeSearch=t=>{this.setState({chartTypeSearch:t.target.value})},this.renderChartTypeModal=()=>{const{isChartTypeModalOpen:t,currentTheme:e,activeMainChartType:i,i18n:r,isMobileMode:a}=this.props,{chartTypeSearch:s}=this.state;if(!t)return null;const n=s?Se.filter(c=>this.getChartTypeLabel(c.type).toLowerCase().includes(s.toLowerCase())):Se,o=this.calculateModalHeight(),l=this.calculateModalTop(),d=this.calculateModalPosition("138px",200),g=m.jsxs("div",{ref:this.chartTypeModalRef,"data-chart-type-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"200px",width:a?"100%":d.width?`${d.width}px`:"180px",maxWidth:a?"400px":"none",maxHeight:a?"80vh":`${o}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${e.toolbar.border}`,flexShrink:0},children:m.jsxs("div",{style:{position:"relative",width:"100%"},children:[m.jsx("input",{type:"text",placeholder:r.searchChartTypes,value:s,onChange:this.handleChartTypeSearch,style:{width:"100%",background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"8px 32px 8px 12px",color:e.layout.textColor,fontSize:"13px",outline:"none",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=e.toolbar.button.active},onBlur:c=>{c.target.style.borderColor=e.toolbar.border}}),s&&m.jsx("button",{onClick:()=>this.setState({chartTypeSearch:""}),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",borderRadius:"50%",width:"18px",height:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:e.toolbar.button.color,opacity:.6,transition:"all 0.2s ease",fontSize:"12px",padding:0},onMouseEnter:c=>{c.currentTarget.style.background=e.toolbar.button.hover,c.currentTarget.style.opacity="1"},onMouseLeave:c=>{c.currentTarget.style.background="transparent",c.currentTarget.style.opacity="0.6"},children:m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",flex:1,padding:"8px",maxHeight:a?"calc(80vh - 73px)":`calc(${o}px - 73px)`},className:"modal-scrollbar",children:n.map(c=>{const u=i===c.type;return m.jsxs("button",{onClick:()=>this.handleChartTypeSelect(c.type),style:{background:u?e.toolbar.button.active:"transparent",border:"none",borderRadius:"0px",padding:"6px 8px",cursor:"pointer",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",gap:"12px",minHeight:"32px",width:"100%"},onMouseEnter:p=>{u||(p.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:p=>{u||(p.currentTarget.style.background="transparent")},children:[m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"20px",height:"20px",flexShrink:0},children:xi(c.type,{size:30})}),m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,flex:1,textAlign:"left"},children:this.getChartTypeLabel(c.type)})]},c.type)})})]});return a?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:g})]}):m.jsx("div",{style:{position:"absolute",top:l,left:d.left,zIndex:1e3},children:g})},this.renderIndicatorModal=()=>{const{isIndicatorModalOpen:t,currentTheme:e,i18n:i,isMobileMode:r}=this.props,{mainIndicatorsSearch:a,indicatorSections:s}=this.state,n=this.filteredMainIndicators(),o=this.filteredMaps(),l=this.filteredSubChartIndicators();if(!t)return null;const h=[{type:i.mainChartIndicators||"技术指标",sectionKey:"technicalIndicators",values:n},{type:i.subChartIndicators||"副图指标",sectionKey:"subChartIndicators",values:l},{type:i.chartMaps||"图",sectionKey:"chart",values:o}],d=this.calculateModalHeight(),g=this.calculateModalTop(),u=this.calculateModalPosition("185px",280),p=m.jsxs("div",{ref:this.indicatorModalRef,"data-indicator-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"280px",width:r?"100%":u.width?`${u.width}px`:"180px",maxWidth:r?"400px":"none",maxHeight:r?"80vh":`${d}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${e.toolbar.border}`,flexShrink:0},children:m.jsxs("div",{style:{position:"relative",width:"100%"},children:[m.jsx("input",{type:"text",placeholder:i.searchIndicators,value:a,onChange:this.handleMainIndicatorsSearch,style:{width:"100%",background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"8px 32px 8px 12px",color:e.layout.textColor,fontSize:"13px",outline:"none",boxSizing:"border-box"},onFocus:M=>{M.target.style.borderColor=e.toolbar.button.active},onBlur:M=>{M.target.style.borderColor=e.toolbar.border}}),a&&m.jsx("button",{onClick:()=>this.setState({mainIndicatorsSearch:""}),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",borderRadius:"50%",width:"18px",height:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:e.toolbar.button.color,opacity:.6,transition:"all 0.2s ease",fontSize:"12px",padding:0},onMouseEnter:M=>{M.currentTarget.style.background=e.toolbar.button.hover,M.currentTarget.style.opacity="1"},onMouseLeave:M=>{M.currentTarget.style.background="transparent",M.currentTarget.style.opacity="0.6"},children:m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px",overflowY:"auto",flex:1,padding:"8px",maxHeight:r?"calc(80vh - 73px)":`calc(${d}px - 73px)`},className:"modal-scrollbar",children:h.map(M=>{const k=s[M.sectionKey],P=M.sectionKey==="subChartIndicators";return m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>this.toggleIndicatorSection(M.sectionKey),style:{background:"transparent",border:"none",borderRadius:"0px",padding:"12px 10px",cursor:"pointer",color:e.layout.textColor,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",minHeight:"32px"},onMouseEnter:S=>{S.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:S=>{S.currentTarget.style.background="transparent"},children:[m.jsx("div",{style:{fontSize:"12px",fontWeight:"600",opacity:.8,textTransform:"uppercase"},children:M.type}),m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",transition:"transform 0.2s ease",transform:k?"rotate(180deg)":"rotate(0deg)"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),k&&m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:M.values.map(S=>{const _=P?this.state.selectedSubChartIndicators.includes(S.type):!1;return m.jsxs("button",{onClick:()=>{P?Cl(this,S.type):_l(this,S.id)},style:{background:"transparent",border:"none",padding:"6px 8px",borderRadius:"0px",cursor:"pointer",display:"flex",alignItems:"center",transition:"all 0.2s ease",minHeight:"32px",width:"100%",textAlign:"left"},onMouseEnter:C=>{C.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:[P?m.jsx(y.Fragment,{children:m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",border:`2px solid ${_?e.toolbar.button.active:e.toolbar.border}`,borderRadius:"3px",marginRight:"10px",background:_?e.toolbar.button.active:"transparent",transition:"all 0.2s ease",flexShrink:0,position:"relative"},children:_&&m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#ffffff",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"},children:m.jsx("polyline",{points:"20 6 9 17 4 12"})})})}):null,m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:e.layout.textColor,textAlign:"left",flex:1,lineHeight:"1.4"},children:S.name})]},S.id)})})]},M.type)})})]});return r?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:p})]}):m.jsx("div",{style:{position:"absolute",top:g,left:u.left,zIndex:1e3},children:p})}}componentDidMount(){typeof window<"u"&&document.addEventListener("mousedown",this.handleClickOutside,!0),document.addEventListener("touchstart",this.handleClickOutside,!0),this.checkScrollPosition(),window.addEventListener("resize",this.checkScrollPosition)}componentWillUnmount(){typeof window<"u"&&document.removeEventListener("mousedown",this.handleClickOutside,!0),window.removeEventListener("resize",this.checkScrollPosition)}componentDidUpdate(t){t.selectedSubChartIndicators!==this.props.selectedSubChartIndicators&&this.setState({selectedSubChartIndicators:this.props.selectedSubChartIndicators||[]})}getCurrentTimezoneDisplayName(){const{i18n:t}=this.props,e={[W.NEW_YORK]:t.options.newYork.split(" ")[0],[W.CHICAGO]:t.options.chicago.split(" ")[0],[W.DENVER]:t.options.denver.split(" ")[0],[W.LOS_ANGELES]:t.options.losAngeles.split(" ")[0],[W.TORONTO]:t.options.toronto.split(" ")[0],[W.LONDON]:t.options.london.split(" ")[0],[W.PARIS]:t.options.paris.split(" ")[0],[W.FRANKFURT]:t.options.frankfurt.split(" ")[0],[W.ZURICH]:t.options.zurich.split(" ")[0],[W.MOSCOW]:t.options.moscow.split(" ")[0],[W.DUBAI]:t.options.dubai.split(" ")[0],[W.KARACHI]:t.options.karachi.split(" ")[0],[W.KOLKATA]:t.options.kolkata.split(" ")[0],[W.SHANGHAI]:t.options.shanghai.split(" ")[0],[W.HONG_KONG]:t.options.hongKong.split(" ")[0],[W.SINGAPORE]:t.options.singapore.split(" ")[0],[W.TOKYO]:t.options.tokyo.split(" ")[0],[W.SEOUL]:t.options.seoul.split(" ")[0],[W.SYDNEY]:t.options.sydney.split(" ")[0],[W.AUCKLAND]:t.options.auckland.split(" ")[0],[W.UTC]:"UTC"},i=this.props.timezone||this.props.currentTimezone;return e[i]||i.split("/").pop()||i}renderAIModal(){const{currentTheme:t,isMobileMode:e,ai:i,aiconfigs:r,isAIModalOpen:a,i18n:s}=this.props;if(!a||!i||!r||r.length===0)return null;const{aiSections:n}=this.state,{aiTools:o}=Gi(this.props.i18n),l=o.filter(p=>r.some(k=>k.brand===p.title.toLowerCase()));if(l.length===0)return null;const h=this.calculateModalHeight(),d=this.calculateModalTop(),c=this.calculateModalPosition("225px",280),u=m.jsx("div",{ref:this.aiModalRef,"data-ai-modal":"true",style:{background:t.toolbar.background,border:`1px solid ${t.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"280px",width:e?"100%":c.width?`${c.width}px`:"280px",maxWidth:e?"400px":"none",maxHeight:e?"80vh":`${h}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px",overflowY:"auto",flex:1,padding:"8px",maxHeight:e?"80vh":`${h}px`},className:"modal-scrollbar",children:l.map(p=>{const M=p.title,k=n[M]!==void 0?n[M]:!0,P=S=>{this.setState(_=>({aiSections:{..._.aiSections,[S]:!(_.aiSections[S]===void 0||_.aiSections[S])}}))};return m.jsxs("div",{style:{borderBottom:`1px solid ${t.toolbar.border}`},children:[m.jsxs("button",{onClick:()=>P(M),style:{width:"100%",background:"transparent",border:"none",padding:"12px 12px",color:t.layout.textColor,cursor:"pointer",display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"13px",fontWeight:"600",transition:"background-color 0.2s"},onMouseEnter:S=>{S.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:S=>{S.currentTarget.style.background="transparent"},children:[m.jsx("span",{children:M.toUpperCase()}),m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",transition:"transform 0.2s ease",transform:k?"rotate(180deg)":"rotate(0deg)"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),k&&m.jsx("div",{style:{padding:"0px",background:t.toolbar.background},children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0px"},children:p.tools.map(S=>{const _=S.icon;return m.jsx("button",{onClick:()=>this.handleAIToolSelect(S.id),style:{background:"transparent",border:"none",padding:"6px 15px",cursor:"pointer",color:t.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",minHeight:"32px",width:"100%"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsxs("div",{style:{fontSize:"13px",fontWeight:"500",color:t.layout.textColor,flex:1,textAlign:"left",display:"flex",alignItems:"center",gap:"10px"},children:[m.jsx(_,{size:20,color:t.toolbar.button.color,style:{flexShrink:0}}),m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-start",flex:1},children:[m.jsx("div",{style:{fontSize:"13px",fontWeight:"500"},children:S.name}),m.jsx("div",{style:{fontSize:"11px",fontWeight:"400",color:t.toolbar.button.color,opacity:.7,marginTop:"2px"},children:S.description})]})]})},S.id)})})})]},M)})})});return e?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:u})]}):m.jsx("div",{style:{position:"absolute",top:d,left:c.left,zIndex:1e3},children:u})}renderTimeframeModal(){const{isTimeframeModalOpen:t,currentTheme:e,activeTimeframe:i,timeframeCallbacks:r,isCloseInternalTimeFrameCalculation:a,isMobileMode:s}=this.props,{timeframeSections:n}=this.state;if(!t)return null;const o=Sl(this.props.i18n);let l=o;if(a&&r){const p=Object.keys(r);l=o.map(M=>({...M,values:M.values.filter(k=>p.includes(k))})).filter(M=>M.values.length>0)}const h=this.calculateModalHeight(),d=this.calculateModalTop(),c=this.calculateModalPosition("13px",180),u=m.jsx("div",{ref:this.timeframeModalRef,"data-timeframe-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"180px",width:s?"100%":c.width?`${c.width}px`:"180px",maxWidth:s?"400px":"none",maxHeight:s?"80vh":`${h}px`,overflowY:"auto",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)"},className:"modal-scrollbar",children:m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:l.map(p=>{const M=n[p.sectionKey];return m.jsxs("div",{children:[m.jsxs("button",{onClick:()=>this.toggleTimeframeSection(p.sectionKey),style:{background:"transparent",border:"none",borderRadius:"0px",padding:"12px 10px",cursor:"pointer",color:e.layout.textColor,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",minHeight:"32px"},onMouseEnter:k=>{k.currentTarget.style.background=e.toolbar.button.hover},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},children:[m.jsx("div",{style:{fontSize:"12px",fontWeight:"600",opacity:.8,textTransform:"uppercase"},children:p.type}),m.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",transition:"transform 0.2s ease",transform:M?"rotate(180deg)":"rotate(0deg)"},children:m.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),M&&m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px"},children:p.values.map(k=>{const P=i===k;return m.jsx("button",{onClick:()=>this.handleTimeframeSelect(k),style:{background:P?e.toolbar.button.active:"transparent",border:"none",borderRadius:"0px",padding:"6px 15px",cursor:"pointer",color:P?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",alignItems:"center",minHeight:"32px",width:"100%"},onMouseEnter:S=>{P||(S.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:S=>{P||(S.currentTarget.style.background="transparent")},children:m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:P?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,flex:1,textAlign:"left"},children:Jo(k,this.props.i18n)})},k)})})]},p.type)})})});return s?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:u})]}):m.jsx("div",{style:{position:"absolute",top:d,left:c.left,zIndex:1e3},children:u})}renderTimezoneModal(){const{isTimezoneModalOpen:t,currentTheme:e,i18n:i,isMobileMode:r}=this.props,{timezoneSearch:a}=this.state;if(!t)return null;const s=[{id:W.NEW_YORK,name:i.options.newYork,offset:"-05:00/-04:00"},{id:W.CHICAGO,name:i.options.chicago,offset:"-06:00/-05:00"},{id:W.DENVER,name:i.options.denver,offset:"-07:00/-06:00"},{id:W.LOS_ANGELES,name:i.options.losAngeles,offset:"-08:00/-07:00"},{id:W.TORONTO,name:i.options.toronto,offset:"-05:00/-04:00"},{id:W.LONDON,name:i.options.london,offset:"+00:00/+01:00"},{id:W.PARIS,name:i.options.paris,offset:"+01:00/+02:00"},{id:W.FRANKFURT,name:i.options.frankfurt,offset:"+01:00/+02:00"},{id:W.ZURICH,name:i.options.zurich,offset:"+01:00/+02:00"},{id:W.MOSCOW,name:i.options.moscow,offset:"+03:00"},{id:W.DUBAI,name:i.options.dubai,offset:"+04:00"},{id:W.KARACHI,name:i.options.karachi,offset:"+05:00"},{id:W.KOLKATA,name:i.options.kolkata,offset:"+05:30"},{id:W.SHANGHAI,name:i.options.shanghai,offset:"+08:00"},{id:W.HONG_KONG,name:i.options.hongKong,offset:"+08:00"},{id:W.SINGAPORE,name:i.options.singapore,offset:"+08:00"},{id:W.TOKYO,name:i.options.tokyo,offset:"+09:00"},{id:W.SEOUL,name:i.options.seoul,offset:"+09:00"},{id:W.SYDNEY,name:i.options.sydney,offset:"+10:00/+11:00"},{id:W.AUCKLAND,name:i.options.auckland,offset:"+12:00/+13:00"},{id:W.UTC,name:i.options.utc,offset:"+00:00"}],n=a?s.filter(c=>c.name.toLowerCase().includes(a.toLowerCase())||c.id.toLowerCase().includes(a.toLowerCase())):s,o=this.calculateModalHeight(),l=this.calculateModalTop(),d=this.calculateModalPosition("60px",300),g=m.jsxs("div",{ref:this.timezoneModalRef,"data-timezone-modal":"true",style:{background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"0",minWidth:"300px",width:r?"100%":d.width?`${d.width}px`:"180px",maxWidth:r?"400px":"none",maxHeight:r?"80vh":`${o}px`,overflow:"hidden",boxShadow:"0 8px 24px rgba(0, 0, 0, 0.3)",display:"flex",flexDirection:"column"},children:[m.jsx("div",{style:{padding:"8px",borderBottom:`1px solid ${e.toolbar.border}`,flexShrink:0},children:m.jsxs("div",{style:{position:"relative",width:"100%"},children:[m.jsx("input",{type:"text",placeholder:i.searchTimezones,value:a,onChange:this.handleTimezoneSearch,style:{width:"100%",background:e.toolbar.background,border:`1px solid ${e.toolbar.border}`,borderRadius:"0px",padding:"8px 32px 8px 12px",color:e.layout.textColor,fontSize:"13px",outline:"none",boxSizing:"border-box"},onFocus:c=>{c.target.style.borderColor=e.toolbar.button.active},onBlur:c=>{c.target.style.borderColor=e.toolbar.border}}),a&&m.jsx("button",{onClick:()=>this.setState({timezoneSearch:""}),style:{position:"absolute",right:"8px",top:"50%",transform:"translateY(-50%)",background:"transparent",border:"none",borderRadius:"50%",width:"18px",height:"18px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:e.toolbar.button.color,opacity:.6,transition:"all 0.2s ease",fontSize:"12px",padding:0},onMouseEnter:c=>{c.currentTarget.style.background=e.toolbar.button.hover,c.currentTarget.style.opacity="1"},onMouseLeave:c=>{c.currentTarget.style.background="transparent",c.currentTarget.style.opacity="0.6"},children:m.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",children:[m.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),m.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),m.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"2px",overflowY:"auto",flex:1,padding:"8px",maxHeight:r?"calc(80vh - 73px)":`calc(${o}px - 73px)`},className:"modal-scrollbar",children:n.map(c=>{const u=this.props.currentTimezone===c.id;return m.jsxs("button",{onClick:()=>this.handleTimezoneSelect(c.id),style:{background:u?e.toolbar.button.active:"transparent",border:"none",borderRadius:"0px",padding:"8px 12px",cursor:"pointer",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,textAlign:"left",transition:"all 0.2s ease",display:"flex",flexDirection:"column",gap:"2px",minHeight:"48px",width:"100%"},onMouseEnter:p=>{u||(p.currentTarget.style.background=e.toolbar.button.hover)},onMouseLeave:p=>{u||(p.currentTarget.style.background="transparent")},children:[m.jsx("div",{style:{fontSize:"13px",fontWeight:"500",color:u&&e.toolbar.button.activeTextColor||e.layout.textColor,textAlign:"left"},children:c.name}),m.jsxs("div",{style:{fontSize:"11px",fontWeight:"400",color:u?e.toolbar.button.activeTextColor||e.layout.textColor:e.toolbar.button.color,opacity:.7,textAlign:"left"},children:[c.id," • UTC",c.offset]})]},c.id)})})]});return r?m.jsxs(m.Fragment,{children:[m.jsx("div",{style:{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:999,background:"rgba(0, 0, 0, 0.5)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:this.props.onCloseModals}),m.jsx("div",{style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,width:"90%",maxWidth:"400px",maxHeight:"80vh",display:"flex",justifyContent:"center",alignItems:"center"},children:g})]}):m.jsx("div",{style:{position:"absolute",top:l,left:d.left,zIndex:1e3},children:g})}render(){const{currentTheme:t,activeTimeframe:e,activeMainChartType:i,isDarkTheme:r,isTimeframeModalOpen:a,isIndicatorModalOpen:s,isChartTypeModalOpen:n,isTimezoneModalOpen:o,onThemeToggle:l,onTimeframeClick:h,onIndicatorClick:d,onChartTypeClick:g,onFullscreenClick:c,onTimezoneClick:u,onCameraClick:p,i18n:M,ai:k,aiconfigs:P,onAIClick:S}=this.props,{scrollButtonVisibility:_}=this.state;return m.jsxs(m.Fragment,{children:[m.jsxs("div",{style:{background:t.panel.backgroundColor,borderBottom:`1px solid ${t.panel.borderColor}`,padding:"9px 0",display:"flex",alignItems:"center",justifyContent:"flex-start",height:"43px",boxSizing:"border-box",gap:"0",position:"relative",overflow:"hidden"},children:[_.showLeft&&m.jsx("button",{onClick:this.scrollToLeft,style:{position:"absolute",left:"0",top:"0",bottom:"0",zIndex:10,background:"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderRight:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"0 6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",width:"30px",height:"100%",boxShadow:"none"},onMouseEnter:C=>{C.currentTarget.style.background="rgba(0, 0, 0, 0.5)",C.currentTarget.style.color="rgba(255, 255, 255, 1)"},onMouseLeave:C=>{C.currentTarget.style.background="rgba(0, 0, 0, 0.3)",C.currentTarget.style.color="rgba(255, 255, 255, 0.9)"},children:m.jsx("span",{style:{fontSize:"16px"},children:"‹"})}),m.jsxs("div",{ref:this.scrollContainerRef,style:{flex:1,overflowX:"auto",overflowY:"hidden",display:"flex",alignItems:"center",gap:"0",padding:"0 13px",scrollbarWidth:"none",msOverflowStyle:"none"},onScroll:this.checkScrollPosition,children:[m.jsx("style",{children:`
272
272
  [style*="overflowX: auto"]::-webkit-scrollbar {
273
273
  height: 0px;
274
274
  background: transparent;
@@ -279,7 +279,7 @@ ${V}`)}else j(L?`Command executed: ${F}`:`命令已执行: ${F}`)},Dt=F=>{if(!r)
279
279
  [style*="overflowX: auto"]::-webkit-scrollbar-track {
280
280
  background: transparent;
281
281
  }
282
- `}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsx("button",{onClick:h,className:"timeframe-button",style:{background:a?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"7px 11px",cursor:"pointer",color:a?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{a||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{a||(C.currentTarget.style.background="transparent")},children:this.props.timeframe||e}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsxs("button",{onClick:u,className:"timezone-button",style:{background:o?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"7px 11px",cursor:"pointer",color:o?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{o||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{o||(C.currentTarget.style.background="transparent")},children:[m.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("polyline",{points:"12 6 12 12 16 14"})]}),this.getCurrentTimezoneDisplayName()]}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsx("button",{onClick:g,className:"chart-type-button",style:{background:n?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"7px 11px",cursor:"pointer",color:n?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{n||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{n||(C.currentTarget.style.background="transparent")},children:xi(i,{size:17})}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsxs("button",{onClick:d,className:"indicator-button",style:{background:s?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"3px 11px",cursor:"pointer",color:s?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{s||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{s||(C.currentTarget.style.background="transparent")},children:[m.jsx(pn,{size:25,color:s?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color}),M.Indicators]}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),!this.props.isMobileMode&&m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0"},children:[this.props.candleView.props.isFullScreen&&m.jsxs(m.Fragment,{children:[m.jsx("button",{title:M.toolbarButtons.fullScreen,onClick:c,style:{background:"transparent",border:"none",borderRadius:"0",padding:"7px",cursor:"pointer",color:t.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"31px",minWidth:"31px"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsx(ra,{size:17,color:t.toolbar.button.color})}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),this.props.candleView.props.isScreenshot&&m.jsxs(m.Fragment,{children:[m.jsx("button",{title:M.toolbarButtons.screenshot,onClick:p,style:{background:"transparent",border:"none",borderRadius:"0",padding:"7px",cursor:"pointer",color:t.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"31px",minWidth:"31px"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsx(va,{size:17,color:t.toolbar.button.color})}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]})]}),m.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:this.props.candleView.props.isThemeSelection&&m.jsx("button",{onClick:l,style:{background:"transparent",border:"none",borderRadius:"20px",padding:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:r?"flex-end":"flex-start",width:"44px",height:"24px",transition:"all 0.3s ease",position:"relative"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"50%",background:r?t.toolbar.button.active:t.toolbar.button.color,transition:"all 0.3s ease",display:"flex",alignItems:"center",justifyContent:"center"},children:r?m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):m.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"5"}),m.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),m.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),m.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),m.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"4.22"}),m.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),m.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),m.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),m.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})})})})]}),_.showRight&&m.jsx("button",{onClick:this.scrollToRight,style:{position:"absolute",right:"0",top:"0",bottom:"0",zIndex:10,background:"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderLeft:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"0 6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",width:"30px",height:"100%",boxShadow:"none"},children:m.jsx("span",{style:{fontSize:"16px"},children:"›"})})]}),this.renderTimeframeModal(),this.renderTimezoneModal(),this.renderChartTypeModal(),this.renderIndicatorModal(),this.renderAIModal()]})}}class Al{constructor(t){this._image=null,this._isLoaded=!1,this._options={size:100,opacity:.3,offsetX:20,offsetY:20,borderColor:"rgba(128, 128, 128, 0.2)",borderWidth:2,borderRadius:50,...t},this._loadImage()}getMarkType(){throw new Error("Method not implemented.")}attached(t){this._chart=t.chart,this.requestUpdate()}updateAllViews(){}requestUpdate(){if(this._chart)try{this._chart.timeScale().applyOptions({})}catch{}}_loadImage(){this._image=new Image,this._image.crossOrigin="anonymous",this._options.src.startsWith("data:image")?this._image.src=this._options.src:this._image.src=this._options.src,this._image.onload=()=>{this._isLoaded=!0,this.requestUpdate()},this._image.onerror=t=>{console.error("Failed to load watermark image:",t),this._isLoaded=!1}}time(){return Date.now()}priceValue(){return 0}paneViews(){return this._renderer||(this._renderer={draw:t=>{if(!this._isLoaded||!this._image)return;const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement()?.querySelector("canvas");if(!i)return;const r=i.width,a=i.height,s=this._options.size||100,n=this._options.offsetX||20,o=this._options.offsetY||20,l=this._options.borderRadius||50,h=r-s-n,d=a-s-o;e.save(),e.globalAlpha=this._options.opacity||.3,e.beginPath();const g=s/2*(l/50);e.arc(h+s/2,d+s/2,g,0,Math.PI*2),e.closePath(),e.clip(),e.drawImage(this._image,h,d,s,s),this._options.borderWidth&&this._options.borderWidth>0&&(e.beginPath(),e.arc(h+s/2,d+s/2,g,0,Math.PI*2),e.strokeStyle=this._options.borderColor||"rgba(128, 128, 128, 0.2)",e.lineWidth=this._options.borderWidth,e.stroke()),e.restore()}}),[{renderer:()=>this._renderer}]}updateImage(t){this._options.src=t,this._isLoaded=!1,this._loadImage(),this.requestUpdate()}updateOptions(t){this._options={...this._options,...t},t.src&&t.src!==this._options.src&&(this._isLoaded=!1,this._loadImage()),this.requestUpdate()}getOptions(){return{...this._options}}isImageLoaded(){return this._isLoaded}}class Dl{constructor(t){this.watermark=null,this.isVisible=!0,this.props=t}addWatermark(t){const{chartSeries:e}=this.props;return!e||this.watermark?Promise.resolve(!1):(this.watermark=new Al(t),e.series.attachPrimitive(this.watermark),this.isVisible=!0,new Promise(i=>{const r=()=>{this.watermark?.isImageLoaded()?i(!0):setTimeout(r,100)};setTimeout(r,100)}))}updateWatermarkImage(t){this.watermark&&this.watermark.updateImage(t)}updateWatermarkOptions(t){this.watermark&&this.watermark.updateOptions(t)}setVisible(t){const{chartSeries:e}=this.props;!e||!this.watermark||(t&&!this.isVisible?(e.series.attachPrimitive(this.watermark),this.isVisible=!0):!t&&this.isVisible&&(e.series.detachPrimitive(this.watermark),this.isVisible=!1))}toggleVisibility(){return this.setVisible(!this.isVisible),this.isVisible}removeWatermark(){const{chartSeries:t}=this.props;t&&this.watermark&&(t.series.detachPrimitive(this.watermark),this.watermark=null,this.isVisible=!1)}getWatermarkOptions(){return this.watermark?this.watermark.getOptions():null}isWatermarkVisible(){return this.isVisible}isImageLoaded(){return this.watermark?this.watermark.isImageLoaded():!1}updateProps(t){this.props={...this.props,...t}}destroy(){this.removeWatermark()}static async imageToBase64(t){return new Promise((e,i)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const a=document.createElement("canvas");a.width=r.width,a.height=r.height;const s=a.getContext("2d");if(!s){i(new Error("Could not get canvas context"));return}s.drawImage(r,0,0),e(a.toDataURL("image/png"))},r.onerror=()=>{i(new Error("Failed to load image"))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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/eHBhY2tldCBlbmQ9InciPz7/7QAsUGhvdG9zaG9wIDMuMAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgD6APoAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A+f6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoopaAEopaSgAooooAKWkooAKKKWgBKKKKACiiigAooooAKKWigBKMUUUAFFLSUAFFLSUAFFFFABRRRQAUUtJQAUUUUAFFFFABRRS0AJRRRQAUUUUAFFFFAC0lLRQAlFLSUALSUtFACUUd6KACiiigAooooAKKKKACiiloASiiigAooooAKKKKACiiigAooooAKKKKACiiloASiiloASiiigAooooAKKKKACiiigAooooAKKKKACiiigAopaKAEopaSgAopaKAEooooAKKKWgBKKKWgBKKKWgBKKKKACiiigApaKSgAopaKAEoopaAEopaSgBaSiigAooopgLSUUUgCiiigAooooAKKKWgBKWikoAKKKKACiiigAooooAWiiigApKWkoAKKKKACiiigAooooAKWkooAKKKWgApKWigBKKWkoAWkoopgLSUUUgCiiigAooopgLRSUUgClpKWgBKKKKACiiigApaSigBaSiigApaKKACkopaACkpaSgBaSiigAooooAKKWkoAKWiigBKKKKACiiloASilpKACilpKAClopKAClpKKAFpKKKYBS0lFIAooooAWkpaSmAUUUUgCiiigApaSigBaSiigAooooAKKWkpgFFFFIAoopaACkpaSgBaKSlpgJS0lFAC0lKaSkAUtJRQAtJS0lABS0UlAC0lLRQAlFLSUAFLRRTAKKKKAEooopAFFFFABRRRQAUUUUALRRSUAFLSUUAFFFFABRRRQAUUUUAFFFFAC0lLRQAlFFFABRRRQAtFJRQAUUUUAFFLSUALSUUUwClpKWkAlLRSUALRSUUAFFFFMAooopALRSUtACUUUtMApKWkpALSUUUwCloopAFFJS0wEooopAFFFLQAlFFFAC0UlLQAlFLSUALRSUUAFFFFABS0lFABS0lFABS0UlABRRRTAKKKKAFpKKKAFpKKKQBRRRQAUtJRQAUUUUAFFFFABRRRQAUUUUwCiiigAooooAKWkopALRSUtACUUUUwCiiigBaKKKAEoopaQBRSUUAFLSUUAFFFFMAooooAKKKKQBRRS0AFFFFMBKKKKQBRRRQAUUUUALSUUUALRRSUAFFLSUAFFFLQAlFLRQAlFLRQAlFFFABRRRQAClpKKAClopKAFpKWkoAKKKKAClpKWgBKKKKYBRRRQAUUUUALRRRSASiiimAUUUUgFpKWkoAKWkooAKKKWgBKKWkpgLSUtFIAopKKYBS0UlIApaKKAEopaSgAopaSmAtFJS0gCkopaAEooooAKKKKYBRS0lAC0lLSUAFFLSUALSUtJSAKKKKYBS0lFIApaKSgAooooAKKKKAClpKWgBKWkopgFFFFAC0lFLSASiiimAUtFJSAWkoooAKKKWgBKWkpaACiiimIKSiigYUUUtIBKKKKYBRRRQAUUtFIApKKKAFopKWgAopKWmAlFFLSASiiigAooooAKKKKYBS0lFABRS0lIAopaKAEooooAKWkpaAEooopgFFFFAC0lLSUgFpKWigApKKWgBKKKKAFpKKKYBRRRQAUUUUAFFLSUAFLSUtIBKKWkoAWkoooAKKWkoAKKWkoAKKKKYBS0UUgCkoooAKKKWgBKKWkpgFFFFAC0lFLSAKSiimAtFJS0AFJS0UAJRS0UgCkpaKAEooopgFFFFABRRRQAUUUUgClpKWgAopKKAClopKAFoopKAFpKKKACiiloASiiloASiiigAooopgFFFLQAlFFFIBaSlpKAFpKKKAFoopKYC0UUUAJRRRQAUUUtIAopKWgBKKKWmAlFLSUgFpKKKACiilpgFFJS0AJRRRSAKKKKACiiigAooopgFFFFABRS0UAFJRRSAKKKKAFpKKWgBKKKKYBRRRQAUtJS0gCikpaAEooopgFFFFAC0lFFABRRRQAUUUUAFFFFABRRS0AFFJRSAWiikoAKKKKACiiigAoopaAEooooAKKWkoAWikpaAEoopaAEoopaAEopaSgAooopgLSUtFACUUUUALRSUtIBKKKKACiiigAooooAKKKKACiiimAUUUtIBKWikoAKWkooAWikooAKKKKAFpKKKAClpKWgAopKKAFpKKKYBR2opaAEooopAFFFLTASiiigBaSiikAtJRS0wEooopAFLRSUALSUUtACUtJS0AJRRRQAUtJS0wEpaSloAKSlpKACiiikAUUUUAFFFFABRRRQAUUUtMBKKKKAFpKKWkAlFLRQAUlFFMApaSlpAJRRRTAKKKKACiiigBaSlpKQC0UUlAC0UlLTASloooASiiigAopaKACiiigBKWiikAlFFFABRRRQAUUtJQAUtJRQAtJRRTAKWkopALSUUtMBKKKKAClpKKQC0lFFABRS0lAC0lFFMApaSigApaSigBaKKSgBaKSigAooooAKWikpAFLR2pKACloopgJS0lFAC0lFLSASlpKKAClpKWgBKKWkpgLRRRQAUlFFAC0lFFABRRRQAUUtFACUUUUAFFFFABS0lFABRRRQAUUUUgFpKWigApKWkpgFFFFABRRRQAUUUUgCloopgFJS0lABS0lLSASiiigAooooAKKKKAFopKKACiiigAoopaAEopaKAEopaKAEopaKACkpaSgAooopgFLSUtABSUtJQAtFFJQAtJS0lIApaKSgBaKSlpgFFFJQAtJRRQAtJS0lIAooopgFFFFABRRS0AFJRRQAUUUUAFFFFABRRRQAtJS0lABRRS0AFFJRSAKKKKYC0lFFAC0UlFABRS0lABS0lLQAlFLSUAFLSUUgCiiigBaSiigAopaSmAUUtGaQCUtJRQAUtJRQAUUUUAFLRSUALRSUtMBKKWkoAKKKKACiiigBaSlooASilooASlpKWkAlFFFMAooooAWkoopAFFFLTAKSlpKQC0lFLTASiiigApaSikAUtFFMAopKWgBKKKDSAKKKKACiiigAooooAKKKKACiiigAopaKACkoopgFFLRSASilopgJRRRQAUUUUgCiilpgJS0lFAC0lFFABRRRQAUUUUgClpKWgAooooAKKKSgAooopgFFFFABRRRQAUtFFAhKKKKBhS0lFABRRRQAtFJRQAUtFFACUtJS0AFFFFACUUUUAFFFFABRRRQAUUUUAFFFFABRS0lABRRRSAKKWkoAKKWkoAWkopaYCUtJRQAUtJRSAKKWkoAKWkooAKKKWgBKKKKYBRRRQAtJRRQAUtJS0gEpaKSmAtJS0lABRRRQAUUUUAFFFFABR1oopAFFLSUAFFFFABRRRQAUUUUwCiiikAtFJS0wCkpaSgApaSikAUUUUAFFFFABS0lFABS0lLQAlFLSUwCiilpAJRRRTAO1FLRSASlpKWmAlFLSUAFFFFABS0lLQAUlFFIBaSilpgFFFJ3oAKWkooAKKWkpALRSUUwFpKKKAFoopKACiiigAooooAKKKWgBKWkopAFLRSUwFpKWkoAKKKKAFpKKKACiiloASilooASilpKAFpKKKQBRRRTAKO9FFAC0UlFIAooopgFLSUtABRSUtIBKKWigAooooASilpKYBRRS0gEopaKYCUUUUALRSUUgFopKKAClpKKYBRRRQAtFJS0AJRS0lIBaKKKACkpaSgAooopgFFFFABRRRQAUUUUAFFFFIApaSimAUUtFACUUUUALSUUUALSUUUAFFFLSASiiigAooooADRRS0AFJRRTAWkpaSgAooooAWkoopAFFFFABS0lFABRRRTAKKKKAFpKKKACilpKQBRRS0wCkoooAKKKKAFpKKKQBRS0lAC0UlLTAKKSloASiiigAooooAKKKKQBRRRQAUUUtACUUUUALSUtFACUUtJQAUtJS0wCikooAWkopaQCUUUUAFFFLQAlFFLTAKSlooAKSlpKACilooASlpKWgBKWikpAFFLRTAKSiikAUtJRQAUUUUwFpKKKAClpKKQBQaKKACilpKACiiimAtJRRQAtFJRSAKKWimAUlFFABRRRQAtJRRSAKKKKYBRS0lABRRRSAKKKKAClpKKYC0lFFABS0lLQAlLRRQAlFFFIAooooAKKKKAClpKWgApKKKACiiloAKSlooASilopgJRRRQAUUUUAFLSUUAFFFFIAooopgFFFFABS0lFABRRRQAUUUUAFFFFABRRS0AJRS0UAJRRRQAUUUUAFFLRQAlFFFIAooooAKKKKACiiloAKSiigAooopgFFLRQAUlFFABRRRSAKKKKAClpKKAFopKWmAUUUlABS0lFAC0UUUAFFFFABRSUtABRRSUALSUtJQAUUUUAFFFFABRRRQAUUUUgCiiigAooopgFFFFABRRRQAUUUUAFLSUUAFFFFABRS0lAC0lLSUgA0UUUwCiiigApaKSkAd6KKKYC0UUUAJS0UUAJS0UUAFFFFACUUUtIBKKKKACiiigAooooAKWiimAUlLRSAKKKKACkopaAEoopaYBSUUUAFFFFABS0lFABRRRQAUUUUAFFFFABRRRQAUtJRSAKKWkpgFFLSUAFFFFAC0lLSUAFFFFAC0UlFAC0UlFIApaSimAUtJS0AJRRRQAUUUUAFFLSUgCiiigAopaSmAUUUUAFFFFABRS0lABS0lFIBaKSigBaSlpKYBS0lFABS0lFABRRRQAUtJRQAUUUUAFLSUUAFFFFAC0lFFABRRRSAKWkopgFFLSUAFFFFABRS0UgEopaSgApaKSgAooopgLSUUUAFLSUtACUtJS0AJRRRQAUUUUAFFFLQAUUlLQAlLSUtABRRRQAUlFFABRRS0gEooooAKKWkoAKKKKAFopKWmAlFFFAC0neilpAFFFFABRRSUAFFLRQAlFFLTASilpKAClpKWkAlFFFAC0lFFMAooooAWikpaAEooooAKKKWkAlLSUUAFFFLTASlpKKACilpKACilpKQBS0lFMAopaSgBaKKKAEopaSgAooooAKKWkpAFFFFABRRRTAKKKKACiiigBaSlopAJRRRQAUUUUAFFFFMAooooAKKKKACiiloASilpKACiiigAoopaAEooooAKWkpaQCUUtJQAUUtFACUUtJQAUUUUAFFFFABRS0UAJRS0lABRRRTAWiiigApKKKACilooASlpKWgBKKKKACiiigAooooAKKKKACiiikAUtJRQAUUUUAFLSUtACUUUUwFopKKACilpKACiiikAUUUtABRRRQAUUlLQAUUlFABRRRTAWkpaKAEopaSgAopaSgAooooAKKKWgBKKKKACiiigBaSlpKQC0lFLTASilpKQBS0lLQAUlLRQAlLSUUALSUUUwCiiigApaSigAooopALRSUUALSUtFACUUtFACUUUUwCilpKACilopAFFJS0AJRS0UAJRRS0AFJS0UAJRRRTAKWkooAWiikoAWkoooAKKKKACiiigAooooAKKKWgBKKWkpALSUUUAFLSUUwCiiikAUUtJQAtFFJQAtFFFMApKWigBKKKKACilopAJS0lLQAUUlFAC0UlFMAooooAKKKWgApKKKQBRRRQAUUUUAFFFFABRRRQAUUtJTAWkoopAFFFFMApaSikAUtFFABSUtJQAUUUUwCiiigBaKSigApaSigBaSiikAUUUtMAooopAJRRRTAKKKKACiiikAUUUUwCiiikAtJRRQAUUtJQAUUUUAFFFFMAooooAKKKKACiiikAUtFJQAUtJRQAUUUUAFFFFABRRRQAUUUUwClpKWkAlFFFABRRRQAUUUUAFFFFMAopaS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c1nVJ9a1q81O5bdNdTNKx9yc17b8ZPinpGu+GYdH8P332gXEm65ZVIwq8gc+p/lXglABRRRQAtJRRQAtJRRQAtJRRQAtJRRQAtJS0UAJRS0UwCkoopAFFFLQAlFLSUAFFFFMAopaKQCUUUUwFpKKKACiiikAUUUUAFFFFABS0lFAC0UUUwCiiigAooooAKKKKAEpaSigAooooAKKKKAFpKKKACiiigAooooAKKKKACiiigAooopALSUtJQAUUUUALRRSUALRSUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAuaSiigAooooAKKKKACiiigBaKSigAooooAKKKKACjNFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFLQAlFFLQAlFFFABRRRQAUUUUAFFFFABRRRQAUtJRQAUtJS0AJRRRTAWkpaSkAtJS0UAFFJRTAKWkpaACkoooAWikopAFLSUtACUtJS0wCiiigBKKKKACilooASlpKKQBRRRQAUUUUALRSUUALRRRTAKSiigBaKKSgBaKSloASiiigApaSloASiiigAopaSkAUUUtMBKKKKACiiigAooooAWkopaAEooooAKKWkoAWiikpAFLSUUAFLSUUABooopgFFFFIAooooAKWkooAKKKKYBRS0UgEpaSigAooopgFFFFAC0lFFIAooopgFFLSUAFLSUtIApKWkoAKWkpaAEoopaAEpaKSgAooooAKKKKAClpKKAClpKKYC0UlLSASiiigApaSloAKSiigAooooAKKWkoAKKKKACiiimAUUtJQAtJRRQAtJRRQAUtFFIBKWkooAKWikpgFFFFABS0lFIApaSimAtJRRQAUUUtABRSUUgCiiigAooooAKKKKAClpKKAFpKKKYBRRRQAUUUUAFFFFABRRRQAUUUUgCiiigAooFFABRS0lMAopaSgAooooAKWikpAFFFLQAlFFFMAooooAKKKKQBRRS0AJRRRTAKKKKAClpKKQBRRRQAUtJS0AJRRRQAUUUUAFFFFABRRRTAKKWkoAKKWkoAKKKKQBRRS0wEooopALSUUUAFFFFMAoopaQCUUtJQAtJS0lABRRRQAUUtJQAUUUUwCiiloASiiigAopaSkAUUUUwCiiigAooooAKWkopAFFFFMAooooAKKKKACiiikAUUUUALRSUUALSUUUwCilpKACiilpAJRRRTAKKKWgBKKWkpAFFLSUAFFFFABRRRQAUUUUAFLSUUAFLRRTAKSlpKACiiigAoopaQCUUUUwFpKKKAFpKKKACiiikAUtJS0AJS0UlMApaKKACkpaSkAUtJRQAUtJRTAWkoooAWikpaQBRSUUwCiiikAUUUUwCiiigAooooAKWkpaQCUUUUwCilpKACilpKACiiikAUtJS0AJRRRTAKKKKAFpKWkoAKWkpaQBSUtJQAUUtJTAKWko7UgCiiigAooooAKKKKACilooASiiimAUtFJQAUUUtIBKKKKACiiloASiiimAtFJRSAKKKKYBRRRQAUtFFACUUtJSAKKWkoAWkopaYCUtFFACUUUUALSUUUAFLSUUAFFFFABS0lFABRRRSAKKWigBKKKKACiiigAooooAKWkpaAEooopgFLSUUAFFFFIAooooAKKKKACiiimAUUUUALSUtJSAKWkpaAEooooAKWikoAWikooAKKKWgAopKKYC0lFFAC0UlFABRRRQAUUUUAFFFFABRRRSAKKKKYBRRRQAUtJRQAUtFFABSUUUAFFFFIApaSigAooopgFFFFABRRRQAUUUUgCiiigAooooAKKKWgBKWkooAKKKKACiiloASiiimAUUUUAFFFFAC0lFLSASlpKKACiiigAooopgFFLSUAFFFFABS0lLQAUlFFABRRRQAtJRRQAClopKAClpKKACiiigApaSloASlpKKACiiloASiilpAFFJS0AFJS0lABRRRQAUUUUAFFFFABS0lFABS0lFABRS0lABRRS0AHakoooAKKWkoAWikooAKKWkpgFFFFIBaKKKAEopaSmAtJS0lAC0UlFIBaKKKAEooopgFFFFABRRRQAtJRRQAUUtJQAUdaKWgBKWikoAKKKKAFpKKKACiiikAUUUUwCiiigAooooAKKWigBKKWkoAKWkooAWkoooAKKKKAFpKKKQBRRRQAYopaSgApaSigAopaSgBaSiloASiiimAUtJRQAUUUtACUUtJQAUUtFIBKKWigBKKKKYC0UlFABRRRQAUUUUgFpKKWgBKKKWgBKKKKYBS0lFABRRS0AJRRS0AJRS0lABS0UUAFFFJQAUtFJSAKKKWmAUUUUAJS0lFABRRRSAKKKKACiiigAooooAKKWkoAKWkpaYCUUtJQAUtJS0gCkopaYBRRSUAFLSUUAFLSUooAKKKSkAUtJRTAWikooAKKKKACilpKQBS0lFABS0lFABS0lLQAUlFFABS0lFMAooooAKWkooAKKKKAClpKKQBRRRQAUUtFMApKWkoAKKKKACiiloASiiigAooooAKKKKQC0UlFABS0lFABRR3oxQAUUUUAFFFFABRRS0AJS0UUAJRRRTAKKKWgBKWiigBKWkpaQCUtFJTAKKWigBKKWkoAKKKKQBRRRQAtJRRQAtJRRQAUUUUwCiiigAooopAFHelpKAFpKKKACilooASiiimAUUUUALSUtFIApKKKYC0UlFABRRRSAKKKKACiiigApaSigAopaKAE70UUUwCiiloASlpKKAClopKACilooASilooASilooAKSilpAJS0UUAJRRS0AFJS0lAC0lFFABRS0UAFJS0lABRRRQAUUtFACUUUUwFopKWkAlFFFABRS0lABRRRQAUtJRQAUtJRTAWkoopAFFFFABS0lGKYBRRRQAUUUUALRSUUgCiiigApaSigBaSiloASiiimAUUtJSAKWkooAWkpaKAEooopgFLRRQAUUlFABS0lFABRRRQAUtJRQAtJRS0AFFJRSAKKWkoAKKKWgBKKWkoAKKKKYBS0lFABRRRQAUUUtIBKKWigAooopgJRRRQAUUUUAFFFFIBaSiigApaKSgAooooAKKWigBKKKKACiiigAooooAWkoo70ALSUtFACUUUUAFFFFAC0lFFABRRRTAWikpaACkpaKQBRSUUALRSUtACUUUtACUtJS0AJRRRQAUUtJQAUUUUALRSUUAFLSUUwCilpKACiiikAUUUtACUUtJQAUUUUwFpKKO9ABRRS0AJRS0UgEooopgLSUUUgCiiimAUUUtABRSUtIBKKKKAFopKKAFpKKWgBKWkooAWiikoAWkpaKAEooooAKKKKYBRS0lABRRRQAUtFJQAUUUUALSUUUAFFFFAC0UlFIAooopgFFFFIAooopgLSUtJSAKWkooAWikooAKWkopgLRRRQAlFFFABRS0lABRRRQAUtFFIBKKKKACiiigApaSloASiiloAKKSloASlpKKACiiigAoopaAEooooAKWkooAKKKWgApKKKACiiigBaSiigAooooAKKKWgAoopKACjtRS0wEpaSikAUUtJQAUUUUAFFFFMAopaSgApaSigBaSiikAUUUUALRSUtACUUtJQAUUUUAFFFLQAUlFFABRRS0AJRRRTAKWkooAWikopAFFLRQAlLRSUAFFFFABRRS0AJRRRTAKWkopALRRRQAlLSUUALSUUtMBKKKKAClpKKACiiigAopaSgAooooAWkoooAKKKKACiiigBaKSlpAFJS0lABRRRQAUUUUALRRRQAUUUUAJRRS0AJRRRQAtJRRTAKKKKACiiigAooopAFFFFABS0lFABS0lFAC0UUlABRRRQAUUtJQAUUUtABSUtJQAUUtJQAUUtJTAKWkpaQCUUUUAFFFFABRRRQAUUtFACUUtJQAUUUUwCiilpAJRRRQAUUUtACUUUUAFLSUtMBKKKWgBKKWikAlFLSUAFFFFABS0lFAC0lLRTASlpKKQBRS0lABS0lFABRS0lABRS0UwEoopaAEpaSikAUUtJQAUUUUwCilooASiilpAFFJRQAtFFFACUUUtMApKKKQBRRRQAtJRRQAUUUUwCiiigAooooAKKKKACiiigAooooAKKKKAFopKKQBRRRQAUUtJQAUtJRQAtJRRQAtFJRQAUUUUAFFFFMAooooAKWkooAKKKWkAlFFFABRRRQAUtFJTAKWkooAWkpaSkAtFJRQAtJRRQAtJRRQAtJS0lMApaKKACkpaSkAUtFJQAUUtJQAUUUUAFLSUUALSUUUAFFFFAC0lFFABRS0lAC0UlFABRRRQAUUUtMBKWkpaACkpaSgAopaSgAooooAKKKKAClpKKACiiigApaSigBaSiikAUUUUAFFFFMBaKSigAooooAKKWkoAKKKKAFpKWikAUUlFABRS0UwCiiigApKWkoAKKKWgBKKKKACiiigAooooAKKWkpAFFFLQAlFFFMAoopaACkoopALSUUUAFFFLQAUUUUwEoopaQBRRRQAUUlFAC0UlFAC0UUUAFJS0UAFFFFMBKKKKACiiikAUUUUAFFFFAC0lFFABS0UlABRS0UAJRRS0AJRRRQAtFJRQAUtJRQAUtJRTAWkoopAFLSUUALSUUUALSUUUAFFFFABRRRQAtJS0UAJS0lFAC0lFFAC0UlFABS0lLQAlFFFMBaKSigBaKSigAooopALSUtJQAUUtJTAKKKWkAlFFLTASlpKKACiiigAopaSgAooooAKKKKQBRRRQAUtJRQAUUUUALRSUtABSUUtACUUtJQAtFFFMAopKKACilopAFJRRTAKKKKACiiigBaSlopAJS0lFAC0lLRQAlFFFMAooopAFFFFABRS0AUAFGKdijFADaKdRQA2inUYoAZRT8UYoAZRT8UYoAZRT6KAGUU+jFADKKfijFADaSn4oxQAyilNJQAUUUUAFFFFAC0UlFABS0UUwCkpaSkAUUUUALSUUtACUUUUAFFLSUALRSUUALSUUtACUUUtABSUZpaAEooooAKWkpaYCUUUUALRSUUgFpKWkoAKKKWgBKWkpaAEopaSgApaKSgBaSiimAUUUUgFpKWkoAWiikoAKWiimAlLRRSASlpKWmAlFFLQAlLSUUgClpKWgBKKKWmAlFLSUAFLSUUAFFLSUgCiiloAKKSimAUUUUgFpKWkoAWkoopgFLSUtIBKWkooAWikooAKKWkoAKWikpgLRRSUgClpKKYBRS0lAC0lFFABRRRSAKKWigAoFJThQAtFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUANakpWpKACiiigAooooAWkoooAKWkpaYBRRSUALSUtJSAWkpaSmAtJRRQAtJRRSAKKWkoAWkoooAKKKKACiiigApaSloASiiigAopaSgAooooAWkoooAWikooAWkoooAKKKKACiiloASiilpgFJS0lIAooooAKKKBQAtJS0UAJS0lFABRRS0wEooooAKKKKQBRRRQAUtJRQAUtJRQAUUUUwClopKQBRR3ooAKKKKYC0lFFABRRS0gEpaKSgAoopaYCUUUtIBKKKKACiiloASiiimAUtJRQAtJRS0gCikooAKKWkoAKKWigBKKKKACnCm04UALS0UlABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUANakpTSUAFFFFABRRRQAUCiigBaSiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigApaSigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKWkooAKKKKAClpKKACiiigAooooAKWkooAWkoooAKKKKADNFFFABRRRQAUUUUAFFFFABRRRQAtHSkpaAF3UmaSigB2aTdSUUALmjNJRQA7NJmkooAXNGaSigBc0ZpKKAFzRmkooAXNGaSigBc0ZpKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=";function El(f){return f.endsWith("/")?f.slice(0,-1):f}async function yl(f,t,e,i,r,a){const s=r.map(h=>({open:h.open,high:h.high,low:h.low,close:h.close,volume:h.volume})),n={provider:e,data:s,i18n:f===ot?"en":"cn",modelType:i,analysisType:"comprehensive",message:a,options:{temperature:.5,maxTokens:1e3}},l=`${El(t)}${Qi.AnalyzeOHLCV}`;try{const h=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!h.ok){const g=await h.text();throw new Error(`HTTP error! status: ${h.status}`)}const d=await h.json();if(d.success)return d.analysis;throw new Error(d.error||"Unknown error from AI service")}catch(h){throw new Error(`AI service error: ${h.message||"Network error"}`)}}const Rl=({currentTheme:f,i18n:t,currentAIFunctionType:e,aiconfigs:i,onClose:r,onSendMessage:a,isLoading:s=!1,initialMessage:n="",currentAIBrandType:o,onModelChange:l,data:h})=>{const[d,g]=y.useState(""),[c,u]=y.useState([]),[p,M]=y.useState(!1),[k,P]=y.useState(""),[S,_]=y.useState([]),[C,v]=y.useState(!1),A=y.useRef(null),R=y.useRef(null),U=y.useRef(null),[I,N]=y.useState(10),L=10,et=y.useRef(!1),at=y.useRef(0),$=y.useRef(0);y.useEffect(()=>{const B=q=>{C&&U.current&&!U.current.contains(q.target)&&v(!1)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[C]),y.useEffect(()=>{if(o&&k){const B=i.find(q=>q.brand===o&&q.model===k);N(B?.maxAnalyzeData??L)}else N(L)},[o,k,i]);const J=()=>h.length>I?h.slice(-I):h,O=()=>{if(!A.current)return;const B=A.current;!Z()&&!et.current||requestAnimationFrame(()=>{B&&(B.scrollTop=B.scrollHeight,et.current=!1)})},Z=(B=50)=>{if(!A.current)return!0;const q=A.current;return q.scrollHeight-q.scrollTop-q.clientHeight<=B},lt=(B,q)=>{const st=[];return q.forEach(ht=>{let gt=!1;for(const ft of B)if(ft.toString()===ht){gt=!0;break}if(gt)st.push(ht);else{const ft=ht.toLowerCase();B.find(kt=>kt.toString().toLowerCase()===ft)&&st.push(ht)}}),st.filter((ht,gt,ft)=>ft.indexOf(ht)===gt)};y.useEffect(()=>{if(o!=null)try{const B=fl(o),q=i.filter(ht=>ht.brand===o).map(ht=>ht.model),st=lt(B,q);if(_(st),st.length>0){if(!st.includes(k)){const ht=st[0];P(ht),l&&l(ht)}}else P(""),l&&l("")}catch{_([]),P("")}else _([]),P("")},[o,i,l,k]),y.useEffect(()=>{et.current=!0,O()},[c]),y.useEffect(()=>{const B=A.current;if(!B)return;const q=()=>{B&&($.current=B.scrollTop,at.current=B.scrollHeight)};return B.addEventListener("scroll",q),()=>B.removeEventListener("scroll",q)},[]),y.useEffect(()=>{const B=R.current;B&&setTimeout(()=>{B.style.height="auto";const st=Math.max(B.scrollHeight,60);B.style.height=`${st}px`},100)},[]),y.useEffect(()=>{u([{id:"welcome",content:t===ot?"Welcome to AI analysis. How can I help you?":"欢迎使用AI分析。有什么可以帮助您的?",sender:"ai",timestamp:new Date}])},[e,t]),y.useEffect(()=>{const B=R.current;if(!B)return;const q=60;B.style.height="auto";const st=Math.max(B.scrollHeight,q);B.style.height=`${st}px`},[d]),y.useEffect(()=>{if(o!=null)try{const q=i.filter(st=>st.brand===o).map(st=>st.model).filter((st,ht,gt)=>gt.indexOf(st)===ht);if(_(q),q.length>0){if(!q.includes(k)){const st=q[0];P(st),l&&l(st)}}else P(""),l&&l("")}catch{_([]),P("")}else _([]),P("")},[o,i,l]);const ut=B=>{g(B.target.value)},x=B=>{P(B),v(!1),l&&l(B)},j=()=>!o||!k?null:i.find(q=>q.brand===o&&q.model===k)?.proxyUrl||null,nt=async()=>{if(!d.trim()||p)return;const B=d.trim(),q={id:Date.now().toString(),content:B,sender:"user",timestamp:new Date};u(ht=>[...ht,q]),g(""),M(!0);const st={id:`loading-${Date.now()}`,content:t===ot?"Analyzing data...":"分析数据中...",sender:"ai",timestamp:new Date,isLoading:!0};u(ht=>[...ht,st]);try{if(!o||!k)throw new Error(t===ot?"Please select an AI brand and model.":"请选择AI品牌和模型。");if(!i.find(xt=>xt.brand===o&&xt.model===k))throw new Error(t===ot?`No configuration found for ${it()}.`:`未找到${it()}的配置。`);const gt=j();if(!gt)throw new Error(t===ot?`Proxy URL not configured for ${it()}. Please add configuration.`:`未配置${it()}的代理URL。请添加配置。`);const ft=J();let Tt,kt;switch(o){case _t.Aliyun:kt="aliyun";break;case _t.OpenAI:kt="openai";break;case _t.DeepSeek:kt="deepseek";break;case _t.Claude:kt="claude";break;case _t.Gemini:kt="gemini";break;default:throw new Error(t===ot?`Unsupported AI brand: ${o}`:`不支持的AI品牌:${o}`)}Tt=await yl(t,gt,kt,k,ft,B),u(xt=>{const Et=xt.filter(Rt=>Rt.id!==st.id),yt={id:(Date.now()+1).toString(),content:Tt,sender:"ai",timestamp:new Date};return[...Et,yt]})}catch(ht){u(gt=>{const ft=gt.filter(kt=>kt.id!==st.id),Tt={id:(Date.now()+2).toString(),content:t===ot?`Sorry, there was an error: ${ht.message}`:`抱歉,出现错误:${ht.message}`,sender:"ai",timestamp:new Date};return[...ft,Tt]})}finally{M(!1),setTimeout(()=>{R.current?.focus()},100)}},ct=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),nt())},it=()=>o&&{[_t.OpenAI]:"OpenAI",[_t.Aliyun]:t.ai.aliyun,[_t.DeepSeek]:"DeepSeek",[_t.Claude]:"Claude",[_t.Gemini]:"Gemini"}[o]||"";return m.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",background:f.layout.background.color,border:`1px solid ${f.toolbar.border}30`,borderRadius:"8px",overflow:"hidden"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",background:f.toolbar.background,borderBottom:`1px solid ${f.toolbar.border}30`,flexWrap:"wrap",gap:"12px"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:f.chart.candleUpColor}}),m.jsx("span",{style:{color:f.layout.textColor,fontSize:"14px",fontWeight:"600"},children:it()})]}),o!=null&&S.length>0&&m.jsxs("div",{ref:U,style:{position:"relative",flex:1,minWidth:"150px",maxWidth:"250px"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",borderRadius:"6px",border:`1px solid ${f.toolbar.border}50`,background:f.layout.background.color,color:f.layout.textColor,fontSize:"13px",cursor:"pointer",transition:"all 0.2s",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>v(!C),onMouseEnter:B=>{B.currentTarget.style.borderColor=f.toolbar.button.dropdown.borderActive},onMouseLeave:B=>{C||(B.currentTarget.style.borderColor=f.toolbar.border+"50")},children:[m.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k||(t===ot?"Select Model":"选择模型")}),m.jsx("svg",{style:{width:"16px",height:"16px",marginLeft:"8px",flexShrink:0,transform:C?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),C&&m.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",borderRadius:"6px",border:`1px solid ${f.toolbar.border}50`,background:f.layout.background.color,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",zIndex:1e3,maxHeight:"200px",overflowY:"auto",overflowX:"hidden"},className:"model-dropdown",children:S.map((B,q)=>m.jsx("div",{style:{padding:"8px 12px",fontSize:"13px",color:f.layout.textColor,cursor:"pointer",transition:"background-color 0.2s",backgroundColor:B===k?f.toolbar.button.dropdown.selected:"transparent",borderBottom:q<S.length-1?`1px solid ${f.toolbar.border}20`:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>x(B),onMouseEnter:st=>{st.currentTarget.style.backgroundColor=B===k?f.toolbar.button.dropdown.selected:f.toolbar.button.dropdown.hover},onMouseLeave:st=>{st.currentTarget.style.backgroundColor=B===k?f.toolbar.button.dropdown.selected:"transparent"},children:B},q))})]}),m.jsx("button",{onClick:r,style:{width:"28px",height:"28px",borderRadius:"4px",border:"none",background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:f.toolbar.button.color,transition:"background-color 0.2s"},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=f.toolbar.button.hover},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent"},children:m.jsx(Te,{size:18})})]}),o!==void 0&&m.jsxs("div",{style:{padding:"4px 16px",background:f.toolbar.background+"80",borderBottom:`1px solid ${f.toolbar.border}20`,fontSize:"12px",color:f.layout.textColor,opacity:.8,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx("span",{children:it()}),m.jsxs("span",{style:{fontSize:"11px",opacity:.6},children:[t===ot?"Selected Model":"已选模型",": ",k]})]}),m.jsx("div",{ref:A,style:{flex:1,overflow:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"},className:"modal-scrollbar",children:c.length===0?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:f.toolbar.button.color,opacity:.7,textAlign:"center",padding:"20px"},children:[m.jsx("div",{style:{width:"48px",height:"48px",marginBottom:"16px",opacity:.5},children:m.jsx("div",{style:{width:"100%",height:"100%",borderRadius:"50%",background:f.toolbar.button.active,display:"flex",alignItems:"center",justifyContent:"center",color:f.layout.background.color,fontSize:"24px"},children:"AI"})}),m.jsx("div",{style:{fontSize:"14px",marginBottom:"4px"},children:t===ot?"Select an AI function to start":"选择AI功能开始对话"}),m.jsx("div",{style:{fontSize:"12px",opacity:.6},children:t===ot?"Choose from the left panel":"从左侧面板选择"})]}):m.jsxs(m.Fragment,{children:[c.map(B=>m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:B.sender==="user"?"flex-end":"flex-start"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",maxWidth:"85%",flexDirection:B.sender==="user"?"row-reverse":"row"},children:[m.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:B.sender==="user"?f.chart.candleUpColor:o?"transparent":f.toolbar.button.active,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:f.layout.background.color,fontSize:"12px",fontWeight:"bold",overflow:"hidden"},children:B.sender==="user"?"U":o?m.jsx("img",{src:pl[o],alt:it(),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):"AI"}),m.jsxs("div",{style:{padding:"10px 14px",borderRadius:"12px",background:B.sender==="user"?f.chart.candleUpColor+"20":f.toolbar.background,border:`1px solid ${B.sender==="user"?f.chart.candleUpColor+"30":f.toolbar.border+"30"}`,color:f.layout.textColor,fontSize:"14px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word",animation:B.isLoading?"pulse 1.5s infinite":"none"},children:[B.content,B.isLoading&&m.jsxs("span",{style:{display:"inline-block",marginLeft:"4px"},children:[m.jsx("span",{style:{animationDelay:"0s"},children:"."}),m.jsx("span",{style:{animationDelay:"0.2s"},children:"."}),m.jsx("span",{style:{animationDelay:"0.4s"},children:"."})]})]})]}),m.jsx("div",{style:{fontSize:"11px",color:f.toolbar.button.color,opacity:.6,marginTop:"4px",marginLeft:B.sender==="user"?"0":"36px",marginRight:B.sender==="user"?"36px":"0"},children:B.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]},B.id)),m.jsx("div",{})]})}),m.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${f.toolbar.border}30`,background:f.layout.background.color},children:[m.jsxs("div",{style:{position:"relative"},children:[m.jsx("textarea",{ref:R,value:d,onChange:ut,onKeyDown:ct,placeholder:t===ot?"Ask about analysis... (Shift+Enter for new line)":"输入关于V分析的问题... (Shift+Enter换行)",disabled:p,style:{width:"100%",height:"60px",minHeight:"60px",maxHeight:"200px",padding:"12px 48px 12px 12px",borderRadius:"8px",border:`1px solid ${f.toolbar.border}50`,background:f.toolbar.background,color:f.layout.textColor,fontSize:"14px",lineHeight:"1.5",resize:"none",fontFamily:"inherit",outline:"none",transition:"border-color 0.2s, height 0.2s",boxSizing:"border-box",overflowY:"auto"},onFocus:B=>{B.target.style.borderColor=f.toolbar.button.inputFocus},onBlur:B=>{B.target.style.borderColor=f.toolbar.border+"50"}}),m.jsx("button",{onClick:nt,disabled:!d.trim()||p,style:{position:"absolute",right:"12px",bottom:"12px",width:"32px",height:"32px",borderRadius:"6px",border:"none",background:d.trim()&&!p?f.toolbar.button.sendButton.normal:f.toolbar.button.sendButton.disabled,display:"flex",alignItems:"center",justifyContent:"center",cursor:d.trim()&&!p?"pointer":"not-allowed",opacity:d.trim()&&!p?1:.5,transition:"all 0.2s"},onMouseEnter:B=>{d.trim()&&!p&&(B.currentTarget.style.background=f.toolbar.button.sendButton.hover,B.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:B=>{d.trim()&&!p&&(B.currentTarget.style.background=f.toolbar.button.sendButton.normal,B.currentTarget.style.transform="translateY(0)")},children:m.jsx(Nn,{size:18,color:d.trim()&&!p?f.layout.background.color:f.toolbar.button.color})})]}),m.jsxs("div",{style:{fontSize:"11px",color:f.toolbar.button.color,opacity:.6,marginTop:"8px",textAlign:"center"},children:[o?t===ot?`Powered by ${Ui[o]}`:`由 ${Ui[o]} 提供支持`:null,k&&` - ${k}`]})]}),m.jsx("style",{children:`
282
+ `}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsx("button",{onClick:h,className:"timeframe-button",style:{background:a?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"7px 11px",cursor:"pointer",color:a?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{a||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{a||(C.currentTarget.style.background="transparent")},children:this.props.timeframe||e}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsxs("button",{onClick:u,className:"timezone-button",style:{background:o?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"7px 11px",cursor:"pointer",color:o?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{o||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{o||(C.currentTarget.style.background="transparent")},children:[m.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"10"}),m.jsx("polyline",{points:"12 6 12 12 16 14"})]}),this.getCurrentTimezoneDisplayName()]}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsx("button",{onClick:g,className:"chart-type-button",style:{background:n?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"7px 11px",cursor:"pointer",color:n?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{n||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{n||(C.currentTarget.style.background="transparent")},children:xi(i,{size:17})}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),m.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[m.jsxs("button",{onClick:d,className:"indicator-button",style:{background:s?t.toolbar.button.active:"transparent",border:"none",borderRadius:"0",padding:"3px 11px",cursor:"pointer",color:s?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color,fontSize:"12px",fontWeight:"500",display:"flex",alignItems:"center",gap:"7px",transition:"all 0.2s ease",minHeight:"31px"},onMouseEnter:C=>{s||(C.currentTarget.style.background=t.toolbar.button.hover)},onMouseLeave:C=>{s||(C.currentTarget.style.background="transparent")},children:[m.jsx(pn,{size:25,color:s?t.toolbar.button.activeTextColor||t.layout.textColor:t.toolbar.button.color}),M.Indicators]}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),!this.props.isMobileMode&&m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0"},children:[this.props.candleView.props.isFullScreen&&m.jsxs(m.Fragment,{children:[m.jsx("button",{title:M.toolbarButtons.fullScreen,onClick:c,style:{background:"transparent",border:"none",borderRadius:"0",padding:"7px",cursor:"pointer",color:t.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"31px",minWidth:"31px"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsx(ra,{size:17,color:t.toolbar.button.color})}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]}),this.props.candleView.props.isScreenshot&&m.jsxs(m.Fragment,{children:[m.jsx("button",{title:M.toolbarButtons.screenshot,onClick:p,style:{background:"transparent",border:"none",borderRadius:"0",padding:"7px",cursor:"pointer",color:t.toolbar.button.color,display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",minHeight:"31px",minWidth:"31px"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsx(va,{size:17,color:t.toolbar.button.color})}),m.jsx("div",{style:{width:"1px",height:"16px",background:t.toolbar.border,margin:"0 4px"}})]})]}),m.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:this.props.candleView.props.isThemeSelection&&m.jsx("button",{onClick:l,style:{background:"transparent",border:"none",borderRadius:"20px",padding:"4px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:r?"flex-end":"flex-start",width:"44px",height:"24px",transition:"all 0.3s ease",position:"relative"},onMouseEnter:C=>{C.currentTarget.style.background=t.toolbar.button.hover},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},children:m.jsx("div",{style:{width:"16px",height:"16px",borderRadius:"50%",background:r?t.toolbar.button.active:t.toolbar.button.color,transition:"all 0.3s ease",display:"flex",alignItems:"center",justifyContent:"center"},children:r?m.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):m.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[m.jsx("circle",{cx:"12",cy:"12",r:"5"}),m.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),m.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),m.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),m.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"4.22"}),m.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),m.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),m.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),m.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})})})})]}),_.showRight&&m.jsx("button",{onClick:this.scrollToRight,style:{position:"absolute",right:"0",top:"0",bottom:"0",zIndex:10,background:"rgba(0, 0, 0, 0.3)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",border:"none",borderLeft:"1px solid rgba(255, 255, 255, 0.1)",borderRadius:"0px",padding:"0 6px",cursor:"pointer",color:"rgba(255, 255, 255, 0.9)",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s ease",width:"30px",height:"100%",boxShadow:"none"},children:m.jsx("span",{style:{fontSize:"16px"},children:"›"})})]}),this.renderTimeframeModal(),this.renderTimezoneModal(),this.renderChartTypeModal(),this.renderIndicatorModal(),this.renderAIModal()]})}}class Tl{constructor(t){this._image=null,this._isLoaded=!1,this._options={size:100,opacity:.3,offsetX:20,offsetY:20,borderColor:"rgba(128, 128, 128, 0.2)",borderWidth:2,borderRadius:50,...t},this._loadImage()}getMarkType(){throw new Error("Method not implemented.")}attached(t){this._chart=t.chart,this.requestUpdate()}updateAllViews(){}requestUpdate(){if(this._chart)try{this._chart.timeScale().applyOptions({})}catch{}}_loadImage(){this._image=new Image,this._image.crossOrigin="anonymous",this._options.src.startsWith("data:image")?this._image.src=this._options.src:this._image.src=this._options.src,this._image.onload=()=>{this._isLoaded=!0,this.requestUpdate()},this._image.onerror=t=>{console.error("Failed to load watermark image:",t),this._isLoaded=!1}}time(){return Date.now()}priceValue(){return 0}paneViews(){return this._renderer||(this._renderer={draw:t=>{if(!this._isLoaded||!this._image)return;const e=t.context??t._context;if(!e||!this._chart)return;const i=this._chart.chartElement()?.querySelector("canvas");if(!i)return;const r=i.width,a=i.height,s=this._options.size||100,n=this._options.offsetX||20,o=this._options.offsetY||20,l=this._options.borderRadius||50,h=r-s-n,d=a-s-o;e.save(),e.globalAlpha=this._options.opacity||.3,e.beginPath();const g=s/2*(l/50);e.arc(h+s/2,d+s/2,g,0,Math.PI*2),e.closePath(),e.clip(),e.drawImage(this._image,h,d,s,s),this._options.borderWidth&&this._options.borderWidth>0&&(e.beginPath(),e.arc(h+s/2,d+s/2,g,0,Math.PI*2),e.strokeStyle=this._options.borderColor||"rgba(128, 128, 128, 0.2)",e.lineWidth=this._options.borderWidth,e.stroke()),e.restore()}}),[{renderer:()=>this._renderer}]}updateImage(t){this._options.src=t,this._isLoaded=!1,this._loadImage(),this.requestUpdate()}updateOptions(t){this._options={...this._options,...t},t.src&&t.src!==this._options.src&&(this._isLoaded=!1,this._loadImage()),this.requestUpdate()}getOptions(){return{...this._options}}isImageLoaded(){return this._isLoaded}}class wl{constructor(t){this.watermark=null,this.isVisible=!0,this.props=t}addWatermark(t){const{chartSeries:e}=this.props;return!e||this.watermark?Promise.resolve(!1):(this.watermark=new Tl(t),e.series.attachPrimitive(this.watermark),this.isVisible=!0,new Promise(i=>{const r=()=>{this.watermark?.isImageLoaded()?i(!0):setTimeout(r,100)};setTimeout(r,100)}))}updateWatermarkImage(t){this.watermark&&this.watermark.updateImage(t)}updateWatermarkOptions(t){this.watermark&&this.watermark.updateOptions(t)}setVisible(t){const{chartSeries:e}=this.props;!e||!this.watermark||(t&&!this.isVisible?(e.series.attachPrimitive(this.watermark),this.isVisible=!0):!t&&this.isVisible&&(e.series.detachPrimitive(this.watermark),this.isVisible=!1))}toggleVisibility(){return this.setVisible(!this.isVisible),this.isVisible}removeWatermark(){const{chartSeries:t}=this.props;t&&this.watermark&&(t.series.detachPrimitive(this.watermark),this.watermark=null,this.isVisible=!1)}getWatermarkOptions(){return this.watermark?this.watermark.getOptions():null}isWatermarkVisible(){return this.isVisible}isImageLoaded(){return this.watermark?this.watermark.isImageLoaded():!1}updateProps(t){this.props={...this.props,...t}}destroy(){this.removeWatermark()}static async imageToBase64(t){return new Promise((e,i)=>{const r=new Image;r.crossOrigin="anonymous",r.onload=()=>{const a=document.createElement("canvas");a.width=r.width,a.height=r.height;const s=a.getContext("2d");if(!s){i(new Error("Could not get canvas context"));return}s.drawImage(r,0,0),e(a.toDataURL("image/png"))},r.onerror=()=>{i(new Error("Failed to load image"))},r.src=t})}}const vl="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QrVaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJFeGVtcGkgKyBYTVAgQ29yZSA2LjAuMCI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOkFJR0M9Imh0dHA6Ly9ucy5hZG9iZS5jb20vQUlHQy8xLjAvIiBBSUdDOkFJR0M9InsmcXVvdDtMYWJlbCZxdW90OzogJnF1b3Q7MiZxdW90OywgJnF1b3Q7Q29udGVudFByb2R1Y2VyJnF1b3Q7OiAmcXVvdDswMDExOTExMTAwMDA4MDIxMDA0MzNCMTAwMDUmcXVvdDssICZxdW90O1Byb2R1Y2VJRCZxdW90OzogJnF1b3Q7MTIxNTMxMTg1OTk2OTc2NTAxMiZxdW90OywgJnF1b3Q7UmVzZXJ2ZWRDb2RlMSZxdW90OzogJnF1b3Q7JnF1b3Q7LCAmcXVvdDtDb250ZW50UHJvcGFnYXRvciZxdW90OzogJnF1b3Q7MDAxMTkxMTEwMDAwODAyMTAwNDMzQjEwMDA1JnF1b3Q7LCAmcXVvdDtQcm9wYWdhdGVJRCZxdW90OzogJnF1b3Q7MTIxNTMxMTg1OTk2OTc2NTAxMiZxdW90OywgJnF1b3Q7UmVzZXJ2ZWRDb2RlMiZxdW90OzogJnF1b3Q7JnF1b3Q7fSIvPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDw/eHBhY2tldCBlbmQ9InciPz7/7QAsUGhvdG9zaG9wIDMuMAA4QklNBCUAAAAAABDUHYzZjwCyBOmACZjs+EJ+/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgD6APoAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A+f6KKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAoopaAEopaSgAooooAKWkooAKKKWgBKKKKACiiigAooooAKKWigBKMUUUAFFLSUAFFLSUAFFFFABRRRQAUUtJQAUUUUAFFFFABRRS0AJRRRQAUUUUAFFFFAC0lLRQAlFLSUALSUtFACUUd6KACiiigAooooAKKKKACiiloASiiigAooooAKKKKACiiigAooooAKKKKACiiloASiiloASiiigAooooAKKKKACiiigAooooAKKKKACiiigAopaKAEopaSgAopaKAEooooAKKKWgBKKKWgBKKKWgBKKKKACiiigApaKSgAopaKAEoopaAEopaSgBaSiigAooopgLSUUUgCiiigAooooAKKKWgBKWikoAKKKKACiiigAooooAWiiigApKWkoAKKKKACiiigAooooAKWkooAKKKWgApKWigBKKWkoAWkoopgLSUUUgCiiigAooopgLRSUUgClpKWgBKKKKACiiigApaSigBaSiigApaKKACkopaACkpaSgBaSiigAooooAKKWkoAKWiigBKKKKACiiloASilpKACilpKAClopKAClpKKAFpKKKYBS0lFIAooooAWkpaSmAUUUUgCiiigApaSigBaSiigAooooAKKWkpgFFFFIAoopaACkpaSgBaKSlpgJS0lFAC0lKaSkAUtJRQAtJS0lABS0UlAC0lLRQAlFLSUAFLRRTAKKKKAEooopAFFFFABRRRQAUUUUALRRSUAFLSUUAFFFFABRRRQAUUUUAFFFFAC0lLRQAlFFFABRRRQAtFJRQAUUUUAFFLSUALSUUUwClpKWkAlLRSUALRSUUAFFFFMAooopALRSUtACUUUtMApKWkpALSUUUwCloopAFFJS0wEooopAFFFLQAlFFFAC0UlLQAlFLSUALRSUUAFFFFABS0lFABS0lFABS0UlABRRRTAKKKKAFpKKKAFpKKKQBRRRQAUtJRQAUUUUAFFFFABRRRQAUUUUwCiiigAooooAKWkopALRSUtACUUUUwCiiigBaKKKAEoopaQBRSUUAFLSUUAFFFFMAooooAKKKKQBRRS0AFFFFMBKKKKQBRRRQAUUUUALSUUUALRRSUAFFLSUAFFFLQAlFLRQAlFLRQAlFFFABRRRQAClpKKAClopKAFpKWkoAKKKKAClpKWgBKKKKYBRRRQAUUUUALRRRSASiiimAUUUUgFpKWkoAKWkooAKKKWgBKKWkpgLSUtFIAopKKYBS0UlIApaKKAEopaSgAopaSmAtFJS0gCkopaAEooooAKKKKYBRS0lAC0lLSUAFFLSUALSUtJSAKKKKYBS0lFIApaKSgAooooAKKKKAClpKWgBKWkopgFFFFAC0lFLSASiiimAUtFJSAWkoooAKKKWgBKWkpaACiiimIKSiigYUUUtIBKKKKYBRRRQAUUtFIApKKKAFopKWgAopKWmAlFFLSASiiigAooooAKKKKYBS0lFABRS0lIAopaKAEooooAKWkpaAEooopgFFFFAC0lLSUgFpKWigApKKWgBKKKKAFpKKKYBRRRQAUUUUAFFLSUAFLSUtIBKKWkoAWkoooAKKWkoAKKWkoAKKKKYBS0UUgCkoooAKKKWgBKKWkpgFFFFAC0lFLSAKSiimAtFJS0AFJS0UAJRS0UgCkpaKAEooopgFFFFABRRRQAUUUUgClpKWgAopKKAClopKAFoopKAFpKKKACiiloASiiloASiiigAooopgFFFLQAlFFFIBaSlpKAFpKKKAFoopKYC0UUUAJRRRQAUUUtIAopKWgBKKKWmAlFLSUgFpKKKACiilpgFFJS0AJRRRSAKKKKACiiigAooopgFFFFABRS0UAFJRRSAKKKKAFpKKWgBKKKKYBRRRQAUtJS0gCikpaAEooopgFFFFAC0lFFABRRRQAUUUUAFFFFABRRS0AFFJRSAWiikoAKKKKACiiigAoopaAEooooAKKWkoAWikpaAEoopaAEoopaAEopaSgAooopgLSUtFACUUUUALRSUtIBKKKKACiiigAooooAKKKKACiiimAUUUtIBKWikoAKWkooAWikooAKKKKAFpKKKAClpKWgAopKKAFpKKKYBR2opaAEooopAFFFLTASiiigBaSiikAtJRS0wEooopAFLRSUALSUUtACUtJS0AJRRRQAUtJS0wEpaSloAKSlpKACiiikAUUUUAFFFFABRRRQAUUUtMBKKKKAFpKKWkAlFLRQAUlFFMApaSlpAJRRRTAKKKKACiiigBaSlpKQC0UUlAC0UlLTASloooASiiigAopaKACiiigBKWiikAlFFFABRRRQAUUtJQAUtJRQAtJRRTAKWkopALSUUtMBKKKKAClpKKQC0lFFABRS0lAC0lFFMApaSigApaSigBaKKSgBaKSigAooooAKWikpAFLR2pKACloopgJS0lFAC0lFLSASlpKKAClpKWgBKKWkpgLRRRQAUlFFAC0lFFABRRRQAUUtFACUUUUAFFFFABS0lFABRRRQAUUUUgFpKWigApKWkpgFFFFABRRRQAUUUUgCloopgFJS0lABS0lLSASiiigAooooAKKKKAFopKKACiiigAoopaAEopaKAEopaKAEopaKACkpaSgAooopgFLSUtABSUtJQAtFFJQAtJS0lIApaKSgBaKSlpgFFFJQAtJRRQAtJS0lIAooopgFFFFABRRS0AFJRRQAUUUUAFFFFABRRRQAtJS0lABRRS0AFFJRSAKKKKYC0lFFAC0UlFABRS0lABS0lLQAlFLSUAFLSUUgCiiigBaSiigAopaSmAUUtGaQCUtJRQAUtJRQAUUUUAFLRSUALRSUtMBKKWkoAKKKKACiiigBaSlooASilooASlpKWkAlFFFMAooooAWkoopAFFFLTAKSlpKQC0lFLTASiiigApaSikAUtFFMAopKWgBKKKDSAKKKKACiiigAooooAKKKKACiiigAopaKACkoopgFFLRSASilopgJRRRQAUUUUgCiilpgJS0lFAC0lFFABRRRQAUUUUgClpKWgAooooAKKKSgAooopgFFFFABRRRQAUtFFAhKKKKBhS0lFABRRRQAtFJRQAUtFFACUtJS0AFFFFACUUUUAFFFFABRRRQAUUUUAFFFFABRS0lABRRRSAKKWkoAKKWkoAWkopaYCUtJRQAUtJRSAKKWkoAKWkooAKKKWgBKKKKYBRRRQAtJRRQAUtJS0gEpaKSmAtJS0lABRRRQAUUUUAFFFFABR1oopAFFLSUAFFFFABRRRQAUUUUwCiiikAtFJS0wCkpaSgApaSikAUUUUAFFFFABS0lFABS0lLQAlFLSUwCiilpAJRRRTAO1FLRSASlpKWmAlFLSUAFFFFABS0lLQAUlFFIBaSilpgFFFJ3oAKWkooAKKWkpALRSUUwFpKKKAFoopKACiiigAooooAKKKWgBKWkopAFLRSUwFpKWkoAKKKKAFpKKKACiiloASilooASilpKAFpKKKQBRRRTAKO9FFAC0UlFIAooopgFLSUtABRSUtIBKKWigAooooASilpKYBRRS0gEopaKYCUUUUALRSUUgFopKKAClpKKYBRRRQAtFJS0AJRS0lIBaKKKACkpaSgAooopgFFFFABRRRQAUUUUAFFFFIApaSimAUUtFACUUUUALSUUUALSUUUAFFFLSASiiigAooooADRRS0AFJRRTAWkpaSgAooooAWkoopAFFFFABS0lFABRRRTAKKKKAFpKKKACilpKQBRRS0wCkoooAKKKKAFpKKKQBRS0lAC0UlLTAKKSloASiiigAooooAKKKKQBRRRQAUUUtACUUUUALSUtFACUUtJQAUtJS0wCikooAWkopaQCUUUUAFFFLQAlFFLTAKSlooAKSlpKACilooASlpKWgBKWikpAFFLRTAKSiikAUtJRQAUUUUwFpKKKAClpKKQBQaKKACilpKACiiimAtJRRQAtFJRSAKKWimAUlFFABRRRQAtJRRSAKKKKYBRS0lABRRRSAKKKKAClpKKYC0lFFABS0lLQAlLRRQAlFFFIAooooAKKKKAClpKWgApKKKACiiloAKSlooASilopgJRRRQAUUUUAFLSUUAFFFFIAooopgFFFFABS0lFABRRRQAUUUUAFFFFABRRS0AJRS0UAJRRRQAUUUUAFFLRQAlFFFIAooooAKKKKACiiloAKSiigAooopgFFLRQAUlFFABRRRSAKKKKAClpKKAFopKWmAUUUlABS0lFAC0UUUAFFFFABRSUtABRRSUALSUtJQAUUUUAFFFFABRRRQAUUUUgCiiigAooopgFFFFABRRRQAUUUUAFLSUUAFFFFABRS0lAC0lLSUgA0UUUwCiiigApaKSkAd6KKKYC0UUUAJS0UUAJS0UUAFFFFACUUUtIBKKKKACiiigAooooAKWiimAUlLRSAKKKKACkopaAEoopaYBSUUUAFFFFABS0lFABRRRQAUUUUAFFFFABRRRQAUtJRSAKKWkpgFFLSUAFFFFAC0lLSUAFFFFAC0UlFAC0UlFIApaSimAUtJS0AJRRRQAUUUUAFFLSUgCiiigAopaSmAUUUUAFFFFABRS0lABS0lFIBaKSigBaSlpKYBS0lFABS0lFABRRRQAUtJRQAUUUUAFLSUUAFFFFAC0lFFABRRRSAKWkopgFFLSUAFFFFABRS0UgEopaSgApaKSgAooopgLSUUUAFLSUtACUtJS0AJRRRQAUUUUAFFFLQAUUlLQAlLSUtABRRRQAUlFFABRRS0gEooooAKKWkoAKKKKAFopKWmAlFFFAC0neilpAFFFFABRRSUAFFLRQAlFFLTASilpKAClpKWkAlFFFAC0lFFMAooooAWikpaAEooooAKKKWkAlLSUUAFFFLTASlpKKACilpKACilpKQBS0lFMAopaSgBaKKKAEopaSgAooooAKKWkpAFFFFABRRRTAKKKKACiiigBaSlopAJRRRQAUUUUAFFFFMAooooAKKKKACiiloASilpKACiiigAoopaAEooooAKWkpaQCUUtJQAUUtFACUUtJQAUUUUAFFFFABRS0UAJRS0lABRRRTAWiiigApKKKACilooASlpKWgBKKKKACiiigAooooAKKKKACiiikAUtJRQAUUUUAFLSUtACUUUUwFopKKACilpKACiiikAUUUtABRRRQAUUlLQAUUlFABRRRTAWkpaKAEopaSgAopaSgAooooAKKKWgBKKKKACiiigBaSlpKQC0lFLTASilpKQBS0lLQAUlLRQAlLSUUALSUUUwCiiigApaSigAooopALRSUUALSUtFACUUtFACUUUUwCilpKACilopAFFJS0AJRS0UAJRRS0AFJS0UAJRRRTAKWkooAWiikoAWkoooAKKKKACiiigAooooAKKKWgBKKWkpALSUUUAFLSUUwCiiikAUUtJQAtFFJQAtFFFMApKWigBKKKKACilopAJS0lLQAUUlFAC0UlFMAooooAKKKWgApKKKQBRRRQAUUUUAFFFFABRRRQAUUtJTAWkoopAFFFFMApaSikAUtFFABSUtJQAUUUUwCiiigBaKSigApaSigBaSiikAUUUtMAooopAJRRRTAKKKKACiiikAUUUUwCiiikAtJRRQAUUtJQAUUUUAFFFFMAooooAKKKKACiiikAUtFJQAUtJRQAUUUUAFFFFABRRRQAUUUUwClpKWkAlFFFABRRRQAUUUUAFFFFMAopaSgApaSigAooooAKKWkpALSUtJQAUUUUALSUUUALSUtJQAUUUUAFFFFAC0lFLQAlFLRQAlFFFAC0lFFMBaSlpKACiiikAUtJRQAUUUUwCiiigBaSiikAtFFFACUUUUwClpKKQBRRRQAUUUUAFFFLQAlFFFABRRRTAWkoopAFFFFMAoopaQBSUUUALRSUtMApKWigBKKKKACiiloAKSiigAooooAKKKKACilopAJR3oooAKKKKACiiigAooooAKKKKACiiigApaSigBaKSigAooopgLRRRSASl7UUlABRRRQAtJRRQAtJRRQAUtJRQAUUUUAFFFFAC0lFFAC0UlFAC0lFFABRRRQAtFJRQAUUUUAFLRRQAlFFFMAooooAWkoooAWkoooAWikopALSUUtACUUtJQAUUtJQAUUUUAFLSUUALSUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFAC0UlFAC0lFFABRRRTAKKKKAClpKKQBRRRQAUUUtABRSUtACUUUUwFpKKKQC0lFLTATvRRS0gCkoooAWikpaYCUUtFACUUUUAFLRSUgClpKKACiiloAKSiigBe1JV3T9I1HVZhDp9lPcyHosUZb+Vd5o3wN8aartaazisIz/ABXMmCP+AjJ/SgDzaivonR/2b7JNraxrU0p7x2sYUf8AfRz/ACruNN+DPgbTQCNHFy4/juZWc/lkD9KAPj8KW6KT9Kv2eg6vqBAs9LvLjP8AzygZv5Cvtu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SloAKSiigAooooAKKWkoAKKKKACiiimAUUtJQAtJRRQAtJRRQAUtFFIBKWkooAKWikpgFFFFABS0lFIApaSimAtJRRQAUUUtABRSUUgCiiigAooooAKKKKAClpKKAFpKKKYBRRRQAUUUUAFFFFABRRRQAUUUUgCiiigAooFFABRS0lMAopaSgAooooAKWikpAFFFLQAlFFFMAooooAKKKKQBRRS0AJRRRTAKKKKAClpKKQBRRRQAUtJS0AJRRRQAUUUUAFFFFABRRRTAKKWkoAKKWkoAKKKKQBRRS0wEooopALSUUUAFFFFMAoopaQCUUtJQAtJS0lABRRRQAUUtJQAUUUUwCiiloASiiigAopaSkAUUUUwCiiigAooooAKWkopAFFFFMAooooAKKKKACiiikAUUUUALRSUUALSUUUwCilpKACiilpAJRRRTAKKKWgBKKWkpAFFLSUAFFFFABRRRQAUUUUAFLSUUAFLRRTAKSlpKACiiigAoopaQCUUUUwFpKKKAFpKKKACiiikAUtJS0AJS0UlMApaKKACkpaSkAUtJRQAUtJRTAWkoooAWikpaQBRSUUwCiiikAUUUUwCiiigAooooAKWkpaQCUUUUwCilpKACilpKACiiikAUtJS0AJRRRTAKKKKAFpKWkoAKWkpaQBSUtJQAUUtJTAKWko7UgCiiigAooooAKKKKACilooASiiimAUtFJQAUUUtIBKKKKACiiloASiiimAtFJRSAKKKKYBRRRQAUtFFACUUtJSAKKWkoAWkopaYCUtFFACUUUUALSUUUAFLSUUAFFFFABS0lFABRRRSAKKWigBKKKKACiiigAooooAKWkpaAEooopgFLSUUAFFFFIAooooAKKKKACiiimAUUUUALSUtJSAKWkpaAEooooAKWikoAWikooAKKKWgAopKKYC0lFFAC0UlFABRRRQAUUUUAFFFFABRRRSAKKKKYBRRRQAUtJRQAUtFFABSUUUAFFFFIApaSigAooopgFFFFABRRRQAUUUUgCiiigAooooAKKKWgBKWkooAKKKKACiiloASiiimAUUUUAFFFFAC0lFLSASlpKKACiiigAooopgFFLSUAFFFFABS0lLQAUlFFABRRRQAtJRRQAClopKAClpKKACiiigApaSloASlpKKACiiloASiilpAFFJS0AFJS0lABRRRQAUUUUAFFFFABS0lFABS0lFABRS0lABRRS0AHakoooAKKWkoAWikooAKKWkpgFFFFIBaKKKAEopaSmAtJS0lAC0UlFIBaKKKAEooopgFFFFABRRRQAtJRRQAUUtJQAUdaKWgBKWikoAKKKKAFpKKKACiiikAUUUUwCiiigAooooAKKWigBKKWkoAKWkooAWkoooAKKKKAFpKKKQBRRRQAYopaSgApaSigAopaSgBaSiloASiiimAUtJRQAUUUtACUUtJQAUUtFIBKKWigBKKKKYC0UlFABRRRQAUUUUgFpKKWgBKKKWgBKKKKYBS0lFABRRS0AJRRS0AJRS0lABS0UUAFFFJQAUtFJSAKKKWmAUUUUAJS0lFABRRRSAKKKKACiiigAooooAKKWkoAKWkpaYCUUtJQAUtJS0gCkopaYBRRSUAFLSUUAFLSUooAKKKSkAUtJRTAWikooAKKKKACilpKQBS0lFABS0lFABS0lLQAUlFFABS0lFMAooooAKWkooAKKKKAClpKKQBRRRQAUUtFMApKWkoAKKKKACiiloASiiigAooooAKKKKQC0UlFABS0lFABRR3oxQAUUUUAFFFFABRRS0AJS0UUAJRRRTAKKKWgBKWiigBKWkpaQCUtFJTAKKWigBKKWkoAKKKKQBRRRQAtJRRQAtJRRQAUUUUwCiiigAooopAFHelpKAFpKKKACilooASiiimAUUUUALSUtFIApKKKYC0UlFABRRRSAKKKKACiiigApaSigAopaKAE70UUUwCiiloASlpKKAClopKACilooASilooASilooAKSilpAJS0UUAJRRS0AFJS0lAC0lFFABRS0UAFJS0lABRRRQAUUtFACUUUUwFopKWkAlFFFABRS0lABRRRQAUtJRQAUtJRTAWkoopAFFFFABS0lGKYBRRRQAUUUUALRSUUgCiiigApaSigBaSiloASiiimAUUtJSAKWkooAWkpaKAEooopgFLRRQAUUlFABS0lFABRRRQAUtJRQAtJRS0AFFJRSAKKWkoAKKKWgBKKWkoAKKKKYBS0lFABRRRQAUUUtIBKKWigAooopgJRRRQAUUUUAFFFFIBaSiigApaKSgAooooAKKWigBKKKKACiiigAooooAWkoo70ALSUtFACUUUUAFFFFAC0lFFABRRRTAWikpaACkpaKQBRSUUALRSUtACUUUtACUtJS0AJRRRQAUUtJQAUUUUALRSUUAFLSUUwCilpKACiiikAUUUtACUUtJQAUUUUwFpKKO9ABRRS0AJRS0UgEooopgLSUUUgCiiimAUUUtABRSUtIBKKKKAFopKKAFpKKWgBKWkooAWiikoAWkpaKAEooooAKKKKYBRS0lABRRRQAUtFJQAUUUUALSUUUAFFFFAC0UlFIAooopgFFFFIAooopgLSUtJSAKWkooAWikooAKWkopgLRRRQAlFFFABRS0lABRRRQAUtFFIBKKKKACiiigApaSloASiiloAKKSloASlpKKACiiigAoopaAEooooAKWkooAKKKWgApKKKACiiigBaSiigAooooAKKKWgAoopKACjtRS0wEpaSikAUUtJQAUUUUAFFFFMAopaSgApaSigBaSiikAUUUUALRSUtACUUtJQAUUUUAFFFLQAUlFFABRRS0AJRRRTAKWkooAWikopAFFLRQAlLRSUAFFFFABRRS0AJRRRTAKWkopALRRRQAlLSUUALSUUtMBKKKKAClpKKACiiigAopaSgAooooAWkoooAKKKKACiiigBaKSlpAFJS0lABRRRQAUUUUALRRRQAUUUUAJRRS0AJRRRQAtJRRTAKKKKACiiigAooopAFFFFABS0lFABS0lFAC0UUlABRRRQAUUtJQAUUUtABSUtJQAUUtJQAUUtJTAKWkpaQCUUUUAFFFFABRRRQAUUtFACUUtJQAUUUUwCiilpAJRRRQAUUUtACUUUUAFLSUtMBKKKWgBKKWikAlFLSUAFFFFABS0lFAC0lLRTASlpKKQBRS0lABS0lFABRS0lABRS0UwEoopaAEpaSikAUUtJQAUUUUwCilooASiilpAFFJRQAtFFFACUUUtMApKKKQBRRRQAtJRRQAUUUUwCiiigAooooAKKKKACiiigAooooAKKKKAFopKKQBRRRQAUUtJQAUtJRQAtJRRQAtFJRQAUUUUAFFFFMAooooAKWkooAKKKWkAlFFFABRRRQAUtFJTAKWkooAWkpaSkAtFJRQAtJRRQAtJRRQAtJS0lMApaKKACkpaSkAUtFJQAUUtJQAUUUUAFLSUUALSUUUAFFFFAC0lFFABRS0lAC0UlFABRRRQAUUUtMBKWkpaACkpaSgAopaSgAooooAKKKKAClpKKACiiigApaSigBaSiikAUUUUAFFFFMBaKSigAooooAKKWkoAKKKKAFpKWikAUUlFABRS0UwCiiigApKWkoAKKKWgBKKKKACiiigAooooAKKWkpAFFFLQAlFFFMAoopaACkoopALSUUUAFFFLQAUUUUwEoopaQBRRRQAUUlFAC0UlFAC0UUUAFJS0UAFFFFMBKKKKACiiikAUUUUAFFFFAC0lFFABS0UlABRS0UAJRRS0AJRRRQAtFJRQAUtJRQAUtJRTAWkoopAFLSUUALSUUUALSUUUAFFFFABRRRQAtJS0UAJS0lFAC0lFFAC0UlFABS0lLQAlFFFMBaKSigBaKSigAooopALSUtJQAUUtJTAKKKWkAlFFLTASlpKKACiiigAopaSgAooooAKKKKQBRRRQAUtJRQAUUUUALRSUtABSUUtACUUtJQAtFFFMAopKKACilopAFJRRTAKKKKACiiigBaSlopAJS0lFAC0lLRQAlFFFMAooopAFFFFABRS0AUAFGKdijFADaKdRQA2inUYoAZRT8UYoAZRT8UYoAZRT6KAGUU+jFADKKfijFADaSn4oxQAyilNJQAUUUUAFFFFAC0UlFABS0UUwCkpaSkAUUUUALSUUtACUUUUAFFLSUALRSUUALSUUtACUUUtABSUZpaAEooooAKWkpaYCUUUUALRSUUgFpKWkoAKKKWgBKWkpaAEopaSgApaKSgBaSiimAUUUUgFpKWkoAWiikoAKWiimAlLRRSASlpKWmAlFFLQAlLSUUgClpKWgBKKKWmAlFLSUAFLSUUAFFLSUgCiiloAKKSimAUUUUgFpKWkoAWkoopgFLSUtIBKWkooAWikooAKKWkoAKWikpgLRRSUgClpKKYBRS0lAC0lFFABRRRSAKKWigAoFJThQAtFFFABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUANakpWpKACiiigAooooAWkoooAKWkpaYBRRSUALSUtJSAWkpaSmAtJRRQAtJRRSAKKWkoAWkoooAKKKKACiiigApaSloASiiigAopaSgAooooAWkoooAWikooAWkoooAKKKKACiiloASiilpgFJS0lIAooooAKKKBQAtJS0UAJS0lFABRRS0wEooooAKKKKQBRRRQAUtJRQAUtJRQAUUUUwClopKQBRR3ooAKKKKYC0lFFABRRS0gEpaKSgAoopaYCUUUtIBKKKKACiiloASiiimAUtJRQAtJRS0gCikooAKKWkoAKKWigBKKKKACnCm04UALS0UlABRRRQAUUUUAFFFFABRRRQAUUUUAFFFFABRRRQAUUUUANakpTSUAFFFFABRRRQAUCiigBaSiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigApaSigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKWkooAKKKKAClpKKACiiigAooooAKWkooAWkoooAKKKKADNFFFABRRRQAUUUUAFFFFABRRRQAtHSkpaAF3UmaSigB2aTdSUUALmjNJRQA7NJmkooAXNGaSigBc0ZpKKAFzRmkooAXNGaSigBc0ZpKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=";function xl(f){return f.endsWith("/")?f.slice(0,-1):f}async function Al(f,t,e,i,r,a){const s=r.map(h=>({open:h.open,high:h.high,low:h.low,close:h.close,volume:h.volume})),n={provider:e,data:s,i18n:f===ot?"en":"cn",modelType:i,analysisType:"comprehensive",message:a,options:{temperature:.5,maxTokens:1e3}},l=`${xl(t)}${Qi.AnalyzeOHLCV}`;try{const h=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!h.ok){const g=await h.text();throw new Error(`HTTP error! status: ${h.status}`)}const d=await h.json();if(d.success)return d.analysis;throw new Error(d.error||"Unknown error from AI service")}catch(h){throw new Error(`AI service error: ${h.message||"Network error"}`)}}const Dl=({currentTheme:f,i18n:t,currentAIFunctionType:e,aiconfigs:i,onClose:r,onSendMessage:a,isLoading:s=!1,initialMessage:n="",currentAIBrandType:o,onModelChange:l,data:h})=>{const[d,g]=y.useState(""),[c,u]=y.useState([]),[p,M]=y.useState(!1),[k,P]=y.useState(""),[S,_]=y.useState([]),[C,v]=y.useState(!1),A=y.useRef(null),R=y.useRef(null),U=y.useRef(null),[I,N]=y.useState(10),L=10,et=y.useRef(!1),at=y.useRef(0),$=y.useRef(0);y.useEffect(()=>{const B=q=>{C&&U.current&&!U.current.contains(q.target)&&v(!1)};return document.addEventListener("mousedown",B),()=>{document.removeEventListener("mousedown",B)}},[C]),y.useEffect(()=>{if(o&&k){const B=i.find(q=>q.brand===o&&q.model===k);N(B?.maxAnalyzeData??L)}else N(L)},[o,k,i]);const J=()=>h.length>I?h.slice(-I):h,O=()=>{if(!A.current)return;const B=A.current;!Z()&&!et.current||requestAnimationFrame(()=>{B&&(B.scrollTop=B.scrollHeight,et.current=!1)})},Z=(B=50)=>{if(!A.current)return!0;const q=A.current;return q.scrollHeight-q.scrollTop-q.clientHeight<=B},lt=(B,q)=>{const st=[];return q.forEach(ht=>{let gt=!1;for(const ft of B)if(ft.toString()===ht){gt=!0;break}if(gt)st.push(ht);else{const ft=ht.toLowerCase();B.find(kt=>kt.toString().toLowerCase()===ft)&&st.push(ht)}}),st.filter((ht,gt,ft)=>ft.indexOf(ht)===gt)};y.useEffect(()=>{if(o!=null)try{const B=dl(o),q=i.filter(ht=>ht.brand===o).map(ht=>ht.model),st=lt(B,q);if(_(st),st.length>0){if(!st.includes(k)){const ht=st[0];P(ht),l&&l(ht)}}else P(""),l&&l("")}catch{_([]),P("")}else _([]),P("")},[o,i,l,k]),y.useEffect(()=>{et.current=!0,O()},[c]),y.useEffect(()=>{const B=A.current;if(!B)return;const q=()=>{B&&($.current=B.scrollTop,at.current=B.scrollHeight)};return B.addEventListener("scroll",q),()=>B.removeEventListener("scroll",q)},[]),y.useEffect(()=>{const B=R.current;B&&setTimeout(()=>{B.style.height="auto";const st=Math.max(B.scrollHeight,60);B.style.height=`${st}px`},100)},[]),y.useEffect(()=>{u([{id:"welcome",content:t===ot?"Welcome to AI analysis. How can I help you?":"欢迎使用AI分析。有什么可以帮助您的?",sender:"ai",timestamp:new Date}])},[e,t]),y.useEffect(()=>{const B=R.current;if(!B)return;const q=60;B.style.height="auto";const st=Math.max(B.scrollHeight,q);B.style.height=`${st}px`},[d]),y.useEffect(()=>{if(o!=null)try{const q=i.filter(st=>st.brand===o).map(st=>st.model).filter((st,ht,gt)=>gt.indexOf(st)===ht);if(_(q),q.length>0){if(!q.includes(k)){const st=q[0];P(st),l&&l(st)}}else P(""),l&&l("")}catch{_([]),P("")}else _([]),P("")},[o,i,l]);const ut=B=>{g(B.target.value)},x=B=>{P(B),v(!1),l&&l(B)},j=()=>!o||!k?null:i.find(q=>q.brand===o&&q.model===k)?.proxyUrl||null,nt=async()=>{if(!d.trim()||p)return;const B=d.trim(),q={id:Date.now().toString(),content:B,sender:"user",timestamp:new Date};u(ht=>[...ht,q]),g(""),M(!0);const st={id:`loading-${Date.now()}`,content:t===ot?"Analyzing data...":"分析数据中...",sender:"ai",timestamp:new Date,isLoading:!0};u(ht=>[...ht,st]);try{if(!o||!k)throw new Error(t===ot?"Please select an AI brand and model.":"请选择AI品牌和模型。");if(!i.find(xt=>xt.brand===o&&xt.model===k))throw new Error(t===ot?`No configuration found for ${it()}.`:`未找到${it()}的配置。`);const gt=j();if(!gt)throw new Error(t===ot?`Proxy URL not configured for ${it()}. Please add configuration.`:`未配置${it()}的代理URL。请添加配置。`);const ft=J();let Tt,kt;switch(o){case _t.Aliyun:kt="aliyun";break;case _t.OpenAI:kt="openai";break;case _t.DeepSeek:kt="deepseek";break;case _t.Claude:kt="claude";break;case _t.Gemini:kt="gemini";break;default:throw new Error(t===ot?`Unsupported AI brand: ${o}`:`不支持的AI品牌:${o}`)}Tt=await Al(t,gt,kt,k,ft,B),u(xt=>{const Et=xt.filter(Rt=>Rt.id!==st.id),yt={id:(Date.now()+1).toString(),content:Tt,sender:"ai",timestamp:new Date};return[...Et,yt]})}catch(ht){u(gt=>{const ft=gt.filter(kt=>kt.id!==st.id),Tt={id:(Date.now()+2).toString(),content:t===ot?`Sorry, there was an error: ${ht.message}`:`抱歉,出现错误:${ht.message}`,sender:"ai",timestamp:new Date};return[...ft,Tt]})}finally{M(!1),setTimeout(()=>{R.current?.focus()},100)}},ct=B=>{B.key==="Enter"&&!B.shiftKey&&(B.preventDefault(),nt())},it=()=>o&&{[_t.OpenAI]:"OpenAI",[_t.Aliyun]:t.ai.aliyun,[_t.DeepSeek]:"DeepSeek",[_t.Claude]:"Claude",[_t.Gemini]:"Gemini"}[o]||"";return m.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",background:f.layout.background.color,border:`1px solid ${f.toolbar.border}30`,borderRadius:"8px",overflow:"hidden"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",background:f.toolbar.background,borderBottom:`1px solid ${f.toolbar.border}30`,flexWrap:"wrap",gap:"12px"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:f.chart.candleUpColor}}),m.jsx("span",{style:{color:f.layout.textColor,fontSize:"14px",fontWeight:"600"},children:it()})]}),o!=null&&S.length>0&&m.jsxs("div",{ref:U,style:{position:"relative",flex:1,minWidth:"150px",maxWidth:"250px"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"6px 12px",borderRadius:"6px",border:`1px solid ${f.toolbar.border}50`,background:f.layout.background.color,color:f.layout.textColor,fontSize:"13px",cursor:"pointer",transition:"all 0.2s",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>v(!C),onMouseEnter:B=>{B.currentTarget.style.borderColor=f.toolbar.button.dropdown.borderActive},onMouseLeave:B=>{C||(B.currentTarget.style.borderColor=f.toolbar.border+"50")},children:[m.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:k||(t===ot?"Select Model":"选择模型")}),m.jsx("svg",{style:{width:"16px",height:"16px",marginLeft:"8px",flexShrink:0,transform:C?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:m.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),C&&m.jsx("div",{style:{position:"absolute",top:"100%",left:0,right:0,marginTop:"4px",borderRadius:"6px",border:`1px solid ${f.toolbar.border}50`,background:f.layout.background.color,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.1)",zIndex:1e3,maxHeight:"200px",overflowY:"auto",overflowX:"hidden"},className:"model-dropdown",children:S.map((B,q)=>m.jsx("div",{style:{padding:"8px 12px",fontSize:"13px",color:f.layout.textColor,cursor:"pointer",transition:"background-color 0.2s",backgroundColor:B===k?f.toolbar.button.dropdown.selected:"transparent",borderBottom:q<S.length-1?`1px solid ${f.toolbar.border}20`:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onClick:()=>x(B),onMouseEnter:st=>{st.currentTarget.style.backgroundColor=B===k?f.toolbar.button.dropdown.selected:f.toolbar.button.dropdown.hover},onMouseLeave:st=>{st.currentTarget.style.backgroundColor=B===k?f.toolbar.button.dropdown.selected:"transparent"},children:B},q))})]}),m.jsx("button",{onClick:r,style:{width:"28px",height:"28px",borderRadius:"4px",border:"none",background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:f.toolbar.button.color,transition:"background-color 0.2s"},onMouseEnter:B=>{B.currentTarget.style.backgroundColor=f.toolbar.button.hover},onMouseLeave:B=>{B.currentTarget.style.backgroundColor="transparent"},children:m.jsx(Te,{size:18})})]}),o!==void 0&&m.jsxs("div",{style:{padding:"4px 16px",background:f.toolbar.background+"80",borderBottom:`1px solid ${f.toolbar.border}20`,fontSize:"12px",color:f.layout.textColor,opacity:.8,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx("span",{children:it()}),m.jsxs("span",{style:{fontSize:"11px",opacity:.6},children:[t===ot?"Selected Model":"已选模型",": ",k]})]}),m.jsx("div",{ref:A,style:{flex:1,overflow:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px"},className:"modal-scrollbar",children:c.length===0?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",color:f.toolbar.button.color,opacity:.7,textAlign:"center",padding:"20px"},children:[m.jsx("div",{style:{width:"48px",height:"48px",marginBottom:"16px",opacity:.5},children:m.jsx("div",{style:{width:"100%",height:"100%",borderRadius:"50%",background:f.toolbar.button.active,display:"flex",alignItems:"center",justifyContent:"center",color:f.layout.background.color,fontSize:"24px"},children:"AI"})}),m.jsx("div",{style:{fontSize:"14px",marginBottom:"4px"},children:t===ot?"Select an AI function to start":"选择AI功能开始对话"}),m.jsx("div",{style:{fontSize:"12px",opacity:.6},children:t===ot?"Choose from the left panel":"从左侧面板选择"})]}):m.jsxs(m.Fragment,{children:[c.map(B=>m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:B.sender==="user"?"flex-end":"flex-start"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:"8px",maxWidth:"85%",flexDirection:B.sender==="user"?"row-reverse":"row"},children:[m.jsx("div",{style:{width:"28px",height:"28px",borderRadius:"50%",background:B.sender==="user"?f.chart.candleUpColor:o?"transparent":f.toolbar.button.active,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,color:f.layout.background.color,fontSize:"12px",fontWeight:"bold",overflow:"hidden"},children:B.sender==="user"?"U":o?m.jsx("img",{src:cl[o],alt:it(),style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):"AI"}),m.jsxs("div",{style:{padding:"10px 14px",borderRadius:"12px",background:B.sender==="user"?f.chart.candleUpColor+"20":f.toolbar.background,border:`1px solid ${B.sender==="user"?f.chart.candleUpColor+"30":f.toolbar.border+"30"}`,color:f.layout.textColor,fontSize:"14px",lineHeight:"1.5",whiteSpace:"pre-wrap",wordBreak:"break-word",animation:B.isLoading?"pulse 1.5s infinite":"none"},children:[B.content,B.isLoading&&m.jsxs("span",{style:{display:"inline-block",marginLeft:"4px"},children:[m.jsx("span",{style:{animationDelay:"0s"},children:"."}),m.jsx("span",{style:{animationDelay:"0.2s"},children:"."}),m.jsx("span",{style:{animationDelay:"0.4s"},children:"."})]})]})]}),m.jsx("div",{style:{fontSize:"11px",color:f.toolbar.button.color,opacity:.6,marginTop:"4px",marginLeft:B.sender==="user"?"0":"36px",marginRight:B.sender==="user"?"36px":"0"},children:B.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]},B.id)),m.jsx("div",{})]})}),m.jsxs("div",{style:{padding:"16px",borderTop:`1px solid ${f.toolbar.border}30`,background:f.layout.background.color},children:[m.jsxs("div",{style:{position:"relative"},children:[m.jsx("textarea",{ref:R,value:d,onChange:ut,onKeyDown:ct,placeholder:t===ot?"Ask about analysis... (Shift+Enter for new line)":"输入关于V分析的问题... (Shift+Enter换行)",disabled:p,style:{width:"100%",height:"60px",minHeight:"60px",maxHeight:"200px",padding:"12px 48px 12px 12px",borderRadius:"8px",border:`1px solid ${f.toolbar.border}50`,background:f.toolbar.background,color:f.layout.textColor,fontSize:"14px",lineHeight:"1.5",resize:"none",fontFamily:"inherit",outline:"none",transition:"border-color 0.2s, height 0.2s",boxSizing:"border-box",overflowY:"auto"},onFocus:B=>{B.target.style.borderColor=f.toolbar.button.inputFocus},onBlur:B=>{B.target.style.borderColor=f.toolbar.border+"50"}}),m.jsx("button",{onClick:nt,disabled:!d.trim()||p,style:{position:"absolute",right:"12px",bottom:"12px",width:"32px",height:"32px",borderRadius:"6px",border:"none",background:d.trim()&&!p?f.toolbar.button.sendButton.normal:f.toolbar.button.sendButton.disabled,display:"flex",alignItems:"center",justifyContent:"center",cursor:d.trim()&&!p?"pointer":"not-allowed",opacity:d.trim()&&!p?1:.5,transition:"all 0.2s"},onMouseEnter:B=>{d.trim()&&!p&&(B.currentTarget.style.background=f.toolbar.button.sendButton.hover,B.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:B=>{d.trim()&&!p&&(B.currentTarget.style.background=f.toolbar.button.sendButton.normal,B.currentTarget.style.transform="translateY(0)")},children:m.jsx(Nn,{size:18,color:d.trim()&&!p?f.layout.background.color:f.toolbar.button.color})})]}),m.jsxs("div",{style:{fontSize:"11px",color:f.toolbar.button.color,opacity:.6,marginTop:"8px",textAlign:"center"},children:[o?t===ot?`Powered by ${Ui[o]}`:`由 ${Ui[o]} 提供支持`:null,k&&` - ${k}`]})]}),m.jsx("style",{children:`
283
283
  .model-dropdown::-webkit-scrollbar { width: 8px; }
284
284
  .model-dropdown::-webkit-scrollbar-track { background: ${f.toolbar.background}; border-radius: 4px; margin: 4px 0; }
285
285
  .model-dropdown::-webkit-scrollbar-thumb {
@@ -320,7 +320,7 @@ ${V}`)}else j(L?`Command executed: ${F}`:`命令已执行: ${F}`)},Dt=F=>{if(!r)
320
320
  textarea::-webkit-scrollbar-track { background: ${f.toolbar.background}; border-radius: 4px; }
321
321
  textarea::-webkit-scrollbar-thumb { background: ${f.toolbar.button.color}40; border-radius: 4px; }
322
322
  textarea::-webkit-scrollbar-thumb:hover { background: ${f.toolbar.button.color}60; }
323
- `})]})};class Bl{constructor(t){this.entries=[],this.entryId=0,this.onLogCallback=t}addEntry(t,...e){const i=e.map(a=>{if(typeof a=="object")try{return JSON.stringify(a,null,2)}catch{return String(a)}return String(a)}).join(" "),r={id:++this.entryId,type:t,content:i,timestamp:new Date};this.entries.push(r),this.onLogCallback(r)}log(...t){this.addEntry("log",...t)}info(...t){this.addEntry("info",...t)}warn(...t){this.addEntry("warn",...t)}error(...t){this.addEntry("error",...t)}clear(){this.entries=[]}getEntries(){return[...this.entries]}}const Ul=({currentTheme:f,i18n:t,initialScript:e="",onClose:i,onSave:r,onRun:a,isLoading:s=!1,scriptName:n="Untitled",scriptContext:o={}})=>{const[l,h]=y.useState(e),[d,g]=y.useState(!1),[c,u]=y.useState(!1),[p,M]=y.useState(.7),[k,P]=y.useState(!1),[S,_]=y.useState([]),C=y.useRef(null),v=y.useRef(null),A=y.useRef(null),R=y.useRef(null);y.useEffect(()=>{const x=j=>{j.stopPropagation()};return document.addEventListener("keydown",x,!0),()=>{document.removeEventListener("keydown",x,!0)}},[]),y.useEffect(()=>{R.current=new Bl(x=>{_(j=>[...j,x])})},[]);const U=x=>{h(x.target.value)},I=async()=>{if(!(!l.trim()||d)){g(!0);try{await r(l)}catch(x){at(t===ot?`Save failed: ${x.message}`:`保存失败: ${x.message}`)}finally{g(!1)}}},N=async()=>{if(!(!l.trim()||c)){u(!0),$();try{a?await a(l):new Function(l)()}catch(x){at(t===ot?`Execution failed: ${x.message}`:`执行失败: ${x.message}`)}finally{u(!1)}}},L=x=>{x.stopPropagation(),(x.ctrlKey||x.metaKey)&&x.key==="s"&&(x.preventDefault(),I()),(x.ctrlKey||x.metaKey)&&x.key==="Enter"&&(x.preventDefault(),N())},et=y.useRef(0),at=x=>{const j={id:++et.current,type:"error",content:x,timestamp:new Date};_(nt=>[...nt,j])},$=()=>{_([]),R.current?.clear()},J=x=>{x.preventDefault(),P(!0)};y.useEffect(()=>{const x=nt=>{if(!k||!v.current)return;const ct=v.current.getBoundingClientRect(),it=ct.height,B=nt.clientY-ct.top,q=Math.max(.2,Math.min(.8,B/it));M(q)},j=()=>{P(!1)};return k&&(document.addEventListener("mousemove",x),document.addEventListener("mouseup",j),document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",j),document.body.style.userSelect=""}},[k]),y.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[S]);const O=`${p*100}%`,Z=`${(1-p)*100}%`,lt=x=>{switch(x){case"log":return{color:f.layout.textColor};case"info":return{color:"#3498db"};case"warn":return{color:"#f39c12",fontWeight:"500"};case"error":return{color:"#e74c3c",fontWeight:"500"};case"system":return{color:f.chart.candleUpColor,fontWeight:"600",backgroundColor:f.chart.candleUpColor+"10",padding:"4px 8px",borderRadius:"4px",margin:"4px 0"};case"result":return{color:f.toolbar.button.active,fontWeight:"500",backgroundColor:f.toolbar.button.active+"10",padding:"4px 8px",borderRadius:"4px",margin:"4px 0"};default:return{color:f.layout.textColor}}},ut=x=>x.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3});return m.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",background:f.layout.background.color,border:`1px solid ${f.toolbar.border}30`,borderRadius:"8px",overflow:"hidden"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",background:f.toolbar.background,borderBottom:`1px solid ${f.toolbar.border}30`,flexWrap:"wrap",gap:"12px"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:f.chart.candleUpColor}}),m.jsx("span",{style:{color:f.layout.textColor,fontSize:"14px",fontWeight:"600"},children:n})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a?m.jsxs("button",{onClick:()=>{if(!(!l.trim()||c)){u(!0),_([]);try{const x={log:console.log,info:console.info,warn:console.warn,error:console.error},j=new Proxy(x,{get(it,B){return B==="log"?(...q)=>{R.current?.log(...q),x.log(...q)}:B==="info"?(...q)=>{R.current?.info(...q),x.info(...q)}:B==="warn"?(...q)=>{R.current?.warn(...q),x.warn(...q)}:B==="error"?(...q)=>{R.current?.error(...q),x.error(...q)}:it[B]}}),nt=window.console;window.console=j,new Function(l)(),window.console=nt}catch(x){window.console=window.console,R.current?.error(t===ot?`❌ Error: ${x.message}`:`❌ 错误: ${x.message}`)}finally{u(!1)}}},disabled:!l.trim()||c,style:{padding:"6px 12px",borderRadius:"6px",border:"none",background:f.toolbar.button.active,color:f.layout.background.color,fontSize:"13px",fontWeight:"500",cursor:l.trim()&&!c?"pointer":"not-allowed",opacity:l.trim()&&!c?1:.6,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},children:[m.jsx(Ai,{size:14}),c?t===ot?"Running...":"运行中...":t===ot?"Run":"运行"]}):m.jsxs("button",{onClick:N,disabled:!l.trim()||c,style:{padding:"6px 12px",borderRadius:"6px",border:"none",background:f.toolbar.button.active,color:f.layout.background.color,fontSize:"13px",fontWeight:"500",cursor:l.trim()&&!c?"pointer":"not-allowed",opacity:l.trim()&&!c?1:.6,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},onMouseEnter:x=>{l.trim()&&!c&&(x.currentTarget.style.opacity="0.9",x.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:x=>{l.trim()&&!c&&(x.currentTarget.style.opacity="1",x.currentTarget.style.transform="translateY(0)")},children:[m.jsx(Ai,{size:14}),c?t===ot?"Running...":"运行中...":t===ot?"Run":"运行"]}),m.jsxs("button",{onClick:I,disabled:!l.trim()||d,style:{padding:"6px 12px",borderRadius:"6px",border:"none",background:f.chart.candleUpColor,color:f.layout.background.color,fontSize:"13px",fontWeight:"500",cursor:l.trim()&&!d?"pointer":"not-allowed",opacity:l.trim()&&!d?1:.6,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},onMouseEnter:x=>{l.trim()&&!d&&(x.currentTarget.style.opacity="0.9",x.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:x=>{l.trim()&&!d&&(x.currentTarget.style.opacity="1",x.currentTarget.style.transform="translateY(0)")},children:[m.jsx(Qn,{size:14}),d?t===ot?"Saving...":"保存中...":t===ot?"Save":"保存"]}),m.jsx("button",{onClick:i,style:{width:"28px",height:"28px",borderRadius:"4px",border:"none",background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:f.toolbar.button.color,transition:"background-color 0.2s"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=f.toolbar.button.hover},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent"},children:m.jsx(Te,{size:18})})]})]}),m.jsxs("div",{style:{padding:"4px 16px",background:f.toolbar.background+"80",borderBottom:`1px solid ${f.toolbar.border}20`,fontSize:"12px",color:f.layout.textColor,opacity:.8,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx("span",{children:t===ot?"JavaScript Editor":"JavaScript 编辑器"}),m.jsxs("span",{style:{fontSize:"11px",opacity:.6},children:[l.split(`
323
+ `})]})};class Fl{constructor(t){this.entries=[],this.entryId=0,this.onLogCallback=t}addEntry(t,...e){const i=e.map(a=>{if(typeof a=="object")try{return JSON.stringify(a,null,2)}catch{return String(a)}return String(a)}).join(" "),r={id:++this.entryId,type:t,content:i,timestamp:new Date};this.entries.push(r),this.onLogCallback(r)}log(...t){this.addEntry("log",...t)}info(...t){this.addEntry("info",...t)}warn(...t){this.addEntry("warn",...t)}error(...t){this.addEntry("error",...t)}clear(){this.entries=[]}getEntries(){return[...this.entries]}}const El=({currentTheme:f,i18n:t,initialScript:e="",onClose:i,onSave:r,onRun:a,isLoading:s=!1,scriptName:n="Untitled",scriptContext:o={}})=>{const[l,h]=y.useState(e),[d,g]=y.useState(!1),[c,u]=y.useState(!1),[p,M]=y.useState(.7),[k,P]=y.useState(!1),[S,_]=y.useState([]),C=y.useRef(null),v=y.useRef(null),A=y.useRef(null),R=y.useRef(null);y.useEffect(()=>{const x=j=>{j.stopPropagation()};return document.addEventListener("keydown",x,!0),()=>{document.removeEventListener("keydown",x,!0)}},[]),y.useEffect(()=>{R.current=new Fl(x=>{_(j=>[...j,x])})},[]);const U=x=>{h(x.target.value)},I=async()=>{if(!(!l.trim()||d)){g(!0);try{await r(l)}catch(x){at(t===ot?`Save failed: ${x.message}`:`保存失败: ${x.message}`)}finally{g(!1)}}},N=async()=>{if(!(!l.trim()||c)){u(!0),$();try{a?await a(l):new Function(l)()}catch(x){at(t===ot?`Execution failed: ${x.message}`:`执行失败: ${x.message}`)}finally{u(!1)}}},L=x=>{x.stopPropagation(),(x.ctrlKey||x.metaKey)&&x.key==="s"&&(x.preventDefault(),I()),(x.ctrlKey||x.metaKey)&&x.key==="Enter"&&(x.preventDefault(),N())},et=y.useRef(0),at=x=>{const j={id:++et.current,type:"error",content:x,timestamp:new Date};_(nt=>[...nt,j])},$=()=>{_([]),R.current?.clear()},J=x=>{x.preventDefault(),P(!0)};y.useEffect(()=>{const x=nt=>{if(!k||!v.current)return;const ct=v.current.getBoundingClientRect(),it=ct.height,B=nt.clientY-ct.top,q=Math.max(.2,Math.min(.8,B/it));M(q)},j=()=>{P(!1)};return k&&(document.addEventListener("mousemove",x),document.addEventListener("mouseup",j),document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",j),document.body.style.userSelect=""}},[k]),y.useEffect(()=>{A.current&&(A.current.scrollTop=A.current.scrollHeight)},[S]);const O=`${p*100}%`,Z=`${(1-p)*100}%`,lt=x=>{switch(x){case"log":return{color:f.layout.textColor};case"info":return{color:"#3498db"};case"warn":return{color:"#f39c12",fontWeight:"500"};case"error":return{color:"#e74c3c",fontWeight:"500"};case"system":return{color:f.chart.candleUpColor,fontWeight:"600",backgroundColor:f.chart.candleUpColor+"10",padding:"4px 8px",borderRadius:"4px",margin:"4px 0"};case"result":return{color:f.toolbar.button.active,fontWeight:"500",backgroundColor:f.toolbar.button.active+"10",padding:"4px 8px",borderRadius:"4px",margin:"4px 0"};default:return{color:f.layout.textColor}}},ut=x=>x.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit",fractionalSecondDigits:3});return m.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",background:f.layout.background.color,border:`1px solid ${f.toolbar.border}30`,borderRadius:"8px",overflow:"hidden"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",background:f.toolbar.background,borderBottom:`1px solid ${f.toolbar.border}30`,flexWrap:"wrap",gap:"12px"},children:[m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[m.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",background:f.chart.candleUpColor}}),m.jsx("span",{style:{color:f.layout.textColor,fontSize:"14px",fontWeight:"600"},children:n})]}),m.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a?m.jsxs("button",{onClick:()=>{if(!(!l.trim()||c)){u(!0),_([]);try{const x={log:console.log,info:console.info,warn:console.warn,error:console.error},j=new Proxy(x,{get(it,B){return B==="log"?(...q)=>{R.current?.log(...q),x.log(...q)}:B==="info"?(...q)=>{R.current?.info(...q),x.info(...q)}:B==="warn"?(...q)=>{R.current?.warn(...q),x.warn(...q)}:B==="error"?(...q)=>{R.current?.error(...q),x.error(...q)}:it[B]}}),nt=window.console;window.console=j,new Function(l)(),window.console=nt}catch(x){window.console=window.console,R.current?.error(t===ot?`❌ Error: ${x.message}`:`❌ 错误: ${x.message}`)}finally{u(!1)}}},disabled:!l.trim()||c,style:{padding:"6px 12px",borderRadius:"6px",border:"none",background:f.toolbar.button.active,color:f.layout.background.color,fontSize:"13px",fontWeight:"500",cursor:l.trim()&&!c?"pointer":"not-allowed",opacity:l.trim()&&!c?1:.6,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},children:[m.jsx(Ai,{size:14}),c?t===ot?"Running...":"运行中...":t===ot?"Run":"运行"]}):m.jsxs("button",{onClick:N,disabled:!l.trim()||c,style:{padding:"6px 12px",borderRadius:"6px",border:"none",background:f.toolbar.button.active,color:f.layout.background.color,fontSize:"13px",fontWeight:"500",cursor:l.trim()&&!c?"pointer":"not-allowed",opacity:l.trim()&&!c?1:.6,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},onMouseEnter:x=>{l.trim()&&!c&&(x.currentTarget.style.opacity="0.9",x.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:x=>{l.trim()&&!c&&(x.currentTarget.style.opacity="1",x.currentTarget.style.transform="translateY(0)")},children:[m.jsx(Ai,{size:14}),c?t===ot?"Running...":"运行中...":t===ot?"Run":"运行"]}),m.jsxs("button",{onClick:I,disabled:!l.trim()||d,style:{padding:"6px 12px",borderRadius:"6px",border:"none",background:f.chart.candleUpColor,color:f.layout.background.color,fontSize:"13px",fontWeight:"500",cursor:l.trim()&&!d?"pointer":"not-allowed",opacity:l.trim()&&!d?1:.6,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s"},onMouseEnter:x=>{l.trim()&&!d&&(x.currentTarget.style.opacity="0.9",x.currentTarget.style.transform="translateY(-1px)")},onMouseLeave:x=>{l.trim()&&!d&&(x.currentTarget.style.opacity="1",x.currentTarget.style.transform="translateY(0)")},children:[m.jsx(Qn,{size:14}),d?t===ot?"Saving...":"保存中...":t===ot?"Save":"保存"]}),m.jsx("button",{onClick:i,style:{width:"28px",height:"28px",borderRadius:"4px",border:"none",background:"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:f.toolbar.button.color,transition:"background-color 0.2s"},onMouseEnter:x=>{x.currentTarget.style.backgroundColor=f.toolbar.button.hover},onMouseLeave:x=>{x.currentTarget.style.backgroundColor="transparent"},children:m.jsx(Te,{size:18})})]})]}),m.jsxs("div",{style:{padding:"4px 16px",background:f.toolbar.background+"80",borderBottom:`1px solid ${f.toolbar.border}20`,fontSize:"12px",color:f.layout.textColor,opacity:.8,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[m.jsx("span",{children:t===ot?"JavaScript Editor":"JavaScript 编辑器"}),m.jsxs("span",{style:{fontSize:"11px",opacity:.6},children:[l.split(`
324
324
  `).length," ",t===ot?"lines":"行"," |",l.length," ",t===ot?"chars":"字符"]})]}),m.jsxs("div",{ref:v,style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},children:[m.jsx("div",{style:{height:O,overflow:"hidden",position:"relative"},children:m.jsx("textarea",{ref:C,value:l,onChange:U,onKeyDown:L,placeholder:t===ot?`// Write JavaScript code here...
325
325
  // Use console.log() for output
326
326
  // Example:
@@ -388,7 +388,7 @@ console.log("结果:", x);
388
388
  -webkit-user-select: none;
389
389
  cursor: row-resize !important;
390
390
  }
391
- `})]})};class Be{constructor(){Be.standardizedDPI()}static standardizedDPI(){Object.defineProperty(window,"devicePixelRatio",{get:()=>1,configurable:!0});const t=document.createElement.bind(document);document.createElement=function(r,a){const s=t(r,a);if(r.toLowerCase()==="canvas"){const n=()=>{if(s.parentElement){const l=s.getBoundingClientRect();if(l.width>0&&l.height>0){const h=s;(h.width!==l.width||h.height!==l.height)&&(h.width=l.width,h.height=l.height)}}};setTimeout(n,0);const o=new ResizeObserver(()=>{n()});setTimeout(()=>{s.parentElement&&o.observe(s)},100),s.addEventListener("DOMNodeRemoved",()=>{o.disconnect()})}return s};const e=()=>{document.querySelectorAll("canvas").forEach(r=>{const a=r.getBoundingClientRect();if(a.width>0&&a.height>0){const s=r;(s.width!==a.width||s.height!==a.height)&&(s.width=a.width,s.height=a.height)}})};setTimeout(e,0),setTimeout(e,100),setTimeout(e,300),new MutationObserver(r=>{let a=!1;r.forEach(s=>{s.addedNodes.forEach(n=>{n.nodeName==="CANVAS"&&(a=!0)})}),a&&setTimeout(e,50)}).observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("resize",()=>{setTimeout(e,100)})}static forceFixCanvas(){document.querySelectorAll("canvas").forEach(t=>{const e=t.getBoundingClientRect();if(e.width>0&&e.height>0){const i=t;i.width=e.width,i.height=e.height}})}}class Zi extends y.Component{constructor(t){super(t),this.candleViewRef=y.createRef(),this.chartRef=y.createRef(),this.chartContainerRef=y.createRef(),this.chartLayerRef=y.createRef(),this.chart=null,this.resizeObserver=null,this.realTimeInterval=null,this.currentSeries=null,this.chartManager=null,this.updateTimeout=null,this.viewportManager=null,this.chartEventManager=null,this.aiPanelResizeRef=y.createRef(),this.isDragging=!1,this.startX=0,this.startChartWidth=0,this.containerWidth=0,this.terminalResizeRef=y.createRef(),this.isDraggingTerminal=!1,this.startY=0,this.startTerminalHeightRatio=0,this.aiMobilePanelResizeRef=y.createRef(),this.isDraggingAiMobilePanel=!1,this.startAiMobileY=0,this.startAiMobileHeightRatio=0,this.preparedData=[],this.originalData=[],this.aiManager=null,this.initializeMainChartIndicators=s=>{this.setState({selectedMainChartIndicator:null}),this.chartLayerRef.current&&Object.values(D).forEach(n=>{this.chartLayerRef.current?.handleRemoveIndicator&&this.chartLayerRef.current.handleRemoveIndicator(n)}),s.forEach(n=>{const o=n.toUpperCase();if(Object.values(D).includes(o)){let l=null;switch(o){case D.MA:l={...we,nonce:Date.now()};break;case D.EMA:l={...ve,nonce:Date.now()};break;case D.BOLLINGER:l={...xe,nonce:Date.now()};break;case D.ICHIMOKU:l={...Ae,nonce:Date.now()};break;case D.DONCHIAN:l={...De,nonce:Date.now()};break;case D.ENVELOPE:l={...Fe,nonce:Date.now()};break;case D.VWAP:l={...Ee,nonce:Date.now()};break;case D.HEATMAP:l={...ye,nonce:Date.now()};break;case D.MARKETPROFILE:l={...Re,nonce:Date.now()};break}l&&(this.setState({selectedMainChartIndicator:l}),this.chart&&this.currentSeries&&this.chartLayerRef.current&&this.chartLayerRef.current.handleMainChartIndicatorChange&&this.chartLayerRef.current.handleMainChartIndicatorChange(l))}})},this.initializeSubChartIndicators=s=>{this.setState({selectedSubChartIndicators:[]}),this.chartLayerRef.current&&this.state.selectedSubChartIndicators.forEach(o=>{this.chartLayerRef.current?.handleRemoveSubChartIndicator&&this.chartLayerRef.current.handleRemoveSubChartIndicator(o)});const n=[];s.forEach(o=>{const l=o.toUpperCase();Object.values(X).includes(l)&&(n.push(l),this.chartLayerRef.current&&this.handleExternalSelectedSubChartIndicator(l))}),this.setState({selectedSubChartIndicators:n})},this.handleAiMobileMouseMove=s=>{if(!this.isDraggingAiMobilePanel)return;const n=this.candleViewRef.current;if(!n)return;const o=n.clientHeight;if(o<=0)return;const l=this.startAiMobileY-s.clientY,h=this.startAiMobileHeightRatio+l/o,d=Math.max(.1,Math.min(.7,h));this.setState({mobileAiPanelHeightRatio:d})},this.handleAiMobileMouseUp=()=>{this.isDraggingAiMobilePanel&&(this.isDraggingAiMobilePanel=!1,this.setState({isResizingAiPanel:!1}),document.body.style.cursor="",document.body.style.userSelect="")},this.handleTerminalResizeMouseDown=s=>{s.preventDefault(),this.isDraggingTerminal=!0,this.setState({isResizingTerminal:!0}),this.candleViewRef.current&&(this.startY=s.clientY,this.startTerminalHeightRatio=this.state.terminalHeightRatio),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},this.handleTerminalMouseMove=s=>{if(!this.isDraggingTerminal)return;const n=this.candleViewRef.current;if(!n)return;const o=n.clientHeight;if(o<=0)return;const l=this.startY-s.clientY,h=this.startTerminalHeightRatio+l/o,d=Math.max(.2,Math.min(.5,h));this.setState({terminalHeightRatio:d})},this.handleTerminalMouseUp=()=>{this.isDraggingTerminal&&(this.isDraggingTerminal=!1,this.setState({isResizingTerminal:!1}),document.body.style.cursor="",document.body.style.userSelect="")},this.handleResizeMouseDown=s=>{s.preventDefault(),this.isDragging=!0,this.setState({isResizingAiPanel:!0}),this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.dragging);const n=this.candleViewRef.current;n&&(this.containerWidth=n.clientWidth,this.startX=s.clientX,this.startChartWidth=this.state.aiPanelWidthRatio),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},this.handleMouseMove=s=>{if(!this.isDragging||!this.containerWidth)return;const n=s.clientX-this.startX;if(!this.state.ai)return;const o=Math.max(.3,Math.min(.9,this.startChartWidth+n/this.containerWidth));this.setState({aiPanelWidthRatio:o},()=>{if(this.chart){const l=this.chartContainerRef.current;if(l){const h=l.clientWidth,d=l.clientHeight;h>0&&d>0&&this.chart.applyOptions({width:h,height:d})}}})},this.handleMouseUp=()=>{this.isDragging&&(this.isDragging=!1,this.setState({isResizingAiPanel:!1}),this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.normal),document.body.style.cursor="",document.body.style.userSelect="")},this.loadDataAsync=s=>{this.setState({dataLoadProgress:0,isDataLoading:!0}),this.loadExternalData().then(()=>(this.setState({dataLoadProgress:30}),this.loadInternalData())).then(()=>{this.setState({dataLoadProgress:70}),this.setState({dataLoadProgress:100,isDataLoading:!1,loadError:null},()=>{s&&s()})}).catch(n=>{this.setState({isDataLoading:!1,loadError:n.message})})},this.loadExternalData=async()=>(this.clearOriginalData(),new Promise((s,n)=>{try{this.setState({dataLoadProgress:10});const o=this.props.data||[];this.originalData=o,this.setState({dataLoadProgress:30}),s()}catch(o){n(o)}})),this.loadInternalData=async()=>new Promise(s=>{this.setState({dataLoadProgress:40}),this.clearChart(()=>{const n=ke.handleData(this.originalData,me({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType,this.props.isCloseInternalTimeFrameCalculation||!1);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=n,this.setState({dataLoadProgress:60}),this.setState({displayData:n,dataLoadProgress:70},()=>{s()})},50)})}),this.handleTimeFormatClick=()=>{this.setState({isTimeFormatModalOpen:!0})},this.handleCloseTimeClick=()=>{this.setState({isCloseTimeModalOpen:!0})},this.handleTradingDayClick=()=>{this.setState({isTradingDayModalOpen:!0})},this.handleTimezoneClick=()=>{this.setState({isTimezoneModalOpen:!0})},this.handleCloseModals=()=>{this.setState({isTimeframeModalOpen:!1,isIndicatorModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isTimezoneModalOpen:!1,isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,isMobileMenuOpen:!1,isAIModalOpen:!1})},this.handleTimezoneSelect=s=>{this.clearChart(),this.setState({currentTimezone:s,timezone:s,isTimezoneModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:20}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:70}),this.initChart(),this.viewportManager?.positionChart(),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},50)})},this.handleTimeframeSelect=s=>{if(this.clearChart(),this.props.isCloseInternalTimeFrameCalculation){const n=s;this.setState({activeTimeframe:n,timeframe:n},()=>{if(this.props.timeframeCallbacks){const o=this.props.timeframeCallbacks[n];o&&o()}})}else{const n=s;this.setState({activeTimeframe:n,timeframe:n,isTimeframeModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:10}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:60}),this.initChart(),this.viewportManager?.positionChart(),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},500)})}},this.loadInternalDataAsync=s=>new Promise(n=>{this.state.isDataLoading||this.setState({isDataLoading:!0}),this.setState({dataLoadProgress:10}),setTimeout(()=>{setTimeout(()=>{this.setState({dataLoadProgress:30});const h=ke.handleData(this.originalData,me({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType,this.props.isCloseInternalTimeFrameCalculation||!1);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=h,this.setState({displayData:h,dataLoadProgress:60},()=>{s&&s(),n()})},50)},0)},0)}),this.initChart=()=>{if(!(!this.currentSeries||!this.currentSeries.series))try{this.state.isDataLoading&&this.setState({dataLoadProgress:80}),this.currentSeries.series.setData(this.preparedData),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:90})},50)}catch{this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.refreshChart=()=>{if(!(!this.state.displayData||this.state.displayData.length===0||!this.currentSeries||!this.currentSeries.series||!this.chart))try{const s=this.chart.timeScale(),n=s.getVisibleRange();this.state.isDataLoading&&this.setState({dataLoadProgress:85}),this.currentSeries.series.setData(this.state.displayData),n&&setTimeout(()=>{try{s.setVisibleRange(n),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:95})},50)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},10)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.handleExternalSelectedSubChartIndicator=s=>{this.setState(n=>{const o=n.selectedSubChartIndicators.includes(s);let l;return o?l=n.selectedSubChartIndicators.filter(h=>h!==s):l=[...n.selectedSubChartIndicators,s],{selectedSubChartIndicators:l}})},this.handleSelectedSubChartIndicator=s=>{this.setState({selectedSubChartIndicators:s,isSubChartModalOpen:!1})},this.handleRemoveSubChartIndicator=s=>{this.setState(n=>({selectedSubChartIndicators:n.selectedSubChartIndicators.filter(l=>l!==s)}))},this.handleCameraClick=()=>{const{handleScreenshotCapture:s}=this.props;s?Me(this,n=>{n.success&&n.dataUrl&&n.blob?s({dataUrl:n.dataUrl,blob:n.blob,width:n.width,height:n.height,timestamp:n.timestamp}):this.fallbackToDownload(n.dataUrl)}):Me(this)},this.fallbackToDownload=s=>{if(s){const n=document.createElement("a");n.download=`chart-screenshot-${new Date().getTime()}.png`,n.href=s,n.click()}else Me(this)},this.serializeDrawings=()=>this.chartLayerRef.current?this.chartLayerRef.current.serializeDrawings():"[]",this.handleSubChartClick=()=>{this.setState({isSubChartModalOpen:!this.state.isSubChartModalOpen})},this.deserializeDrawings=s=>{this.chartLayerRef.current&&this.chartLayerRef.current.deserializeDrawings(s)},this.clearAllDrawings=()=>{this.chartLayerRef.current&&this.chartLayerRef.current.clearAllDrawings()},this.viewportDataBufferSize=500,this.handleVisibleTimeRangeChange=s=>{if(!s)return;s.from>this.viewportDataBufferSize&&(s.from=s.from-this.viewportDataBufferSize);const n=this.props.isOpenViewportSegmentation?this.viewportManager?.getViewportDataPoints(s,this.preparedData)||[]:this.preparedData;this.setState({displayData:n})},this.handleEmojiSelect=s=>{this.setState({selectedEmoji:s})},this.handleThemeToggle=()=>{this.setState(s=>{const n=!s.isDarkTheme,o=n?"dark":"light";return{isDarkTheme:n,currentTheme:this.getThemeConfig(o)}},()=>{this.updateChartTheme()})},this.handleMobileMenuToggle=()=>{this.setState(s=>({isMobileMenuOpen:!s.isMobileMenuOpen}))},this.handleClickOutside=s=>{const n=s.target,o=this.state.isMobileMenuOpen&&!n.closest(".mobile-menu-button")&&!n.closest("[data-mobile-menu-modal]"),l=this.state.isTimeFormatModalOpen&&!n.closest(".time-format-button")&&!n.closest("[data-timeformat-modal]"),h=this.state.isCloseTimeModalOpen&&!n.closest(".close-time-button")&&!n.closest("[data-close-time-modal]"),d=this.state.isTradingDayModalOpen&&!n.closest(".trading-day-button")&&!n.closest("[data-trading-day-modal]"),g=this.state.isTimezoneModalOpen&&!n.closest(".timezone-button")&&!n.closest("[data-timezone-modal]"),c=this.state.isTimeframeModalOpen&&!n.closest(".timeframe-button")&&!n.closest("[data-timeframe-modal]"),u=this.state.isIndicatorModalOpen&&!n.closest(".indicator-button")&&!n.closest("[data-indicator-modal]"),p=this.state.isTradeModalOpen&&!n.closest(".trade-button")&&!n.closest("[data-trade-modal]"),M=this.state.isChartTypeModalOpen&&!n.closest(".chart-type-button")&&!n.closest("[data-chart-type-modal]"),k=this.state.isSubChartModalOpen&&!n.closest(".subchart-button")&&!n.closest("[data-subchart-modal]");this.state.isAIModalOpen&&!n.closest(".ai-button")&&!n.closest("[data-ai-modal]")&&this.setState({isAIModalOpen:!1}),o&&this.setState({isMobileMenuOpen:!1}),k&&this.setState({isSubChartModalOpen:!1}),c&&this.setState({isTimeframeModalOpen:!1}),u&&this.setState({isIndicatorModalOpen:!1}),p&&this.setState({isTradeModalOpen:!1}),M&&this.setState({isChartTypeModalOpen:!1}),g&&this.setState({isTimezoneModalOpen:!1}),l&&this.setState({isTimeFormatModalOpen:!1}),h&&this.setState({isCloseTimeModalOpen:!1}),d&&this.setState({isTradingDayModalOpen:!1})},this.handleToolSelect=s=>{this.setState({activeTool:s})},this.handleChartTypeSelect=s=>{this.setState({currentMainChartType:s,isChartTypeModalOpen:!1})},this.handleCloseChartTypeModal=()=>{this.setState({isChartTypeModalOpen:!1})},this.handleCloseDrawing=()=>{this.setState({activeTool:null})},this.handleTimeframeClick=()=>{this.setState({isTimeframeModalOpen:!this.state.isTimeframeModalOpen})},this.handleAIClick=()=>{this.setState({isAIModalOpen:!this.state.isAIModalOpen})},this.handleChartTypeClick=()=>{this.setState({isChartTypeModalOpen:!this.state.isChartTypeModalOpen})},this.handleIndicatorClick=()=>{this.setState({isIndicatorModalOpen:!this.state.isIndicatorModalOpen})},this.handleTradeClick=()=>{this.setState({isTradeModalOpen:!this.state.isTradeModalOpen})},this.handleSelectedMainChartIndicator=s=>{this.setState({selectedMainChartIndicator:s,isIndicatorModalOpen:!1})},this.handleMainChartIndicatorChange=s=>{this.setState({selectedMainChartIndicator:s})},this.handleCloseIndicatorModal=()=>{this.setState({isIndicatorModalOpen:!1})},this.handleCloseTimeframeModal=()=>{this.setState({isTimeframeModalOpen:!1})},this.handleCloseTradeModal=()=>{this.setState({isTradeModalOpen:!1})},this.handleTradeAction=s=>{this.setState({isTradeModalOpen:!1})},this.handleFullscreen=()=>{const s=this.chartContainerRef.current;s&&(document.fullscreenElement?document.exitFullscreen?.():s.requestFullscreen?.())},this.handleCompareClick=()=>{},this.handleReplayClick=()=>{},this.stopRealTimeDataSimulation=()=>{this.realTimeInterval&&(clearInterval(this.realTimeInterval),this.realTimeInterval=null)},this.handleContextMenu=s=>{s.preventDefault(),s.stopPropagation()},this.handleLeftArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("left")},this.handleRightArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("right")},this.handleRefreshClick=()=>{this.setState({isDataLoading:!0,dataLoadProgress:0}),setTimeout(()=>{this.setState({dataLoadProgress:20}),this.refreshExternalData(()=>{this.setState({dataLoadProgress:50}),this.refreshInternalData(()=>{this.setState({dataLoadProgress:80}),this.refreshChart(),this.viewportManager?.positionChart(),this.setState({isDataLoading:!1,dataLoadProgress:100})})})},100)},this.handleZoomIn=()=>{this.viewportManager&&this.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.viewportManager&&this.viewportManager.zoomOut()},this.handleOpenScriptEditor=(s,n,o,l)=>{this.setState({isScriptEditorOpen:!0,currentScript:o||"",scriptName:s||"Untitled",openAiChat:!1,aiPanelWidthRatio:.7,currentScriptType:n,currentScriptMarkId:s})},this.handleCloseScriptEditor=()=>{this.setState({isScriptEditorOpen:!1,currentScript:"",aiPanelWidthRatio:1,currentAIFunctionType:null,currentAIBrandType:null})},this.handleSaveScript=async s=>{const{currentScriptType:n,currentScriptMarkId:o}=this.state;Kt.Time===n?this.chartLayerRef.current.setTimeEventScriptById(o,s):Kt.Price===n&&this.chartLayerRef.current.setPriceEventScriptById(o,s),this.handleCloseScriptEditor()},this.handleRunScript=async s=>Promise.resolve(),this.handleAIFunctionSelect=s=>{const n=this.aiManager?.aiToolIdToFunctionType(s);if(s==="script-editor"){this.setState({isScriptEditorOpen:!0,openAiChat:!1,currentAIFunctionType:null,currentAIBrandType:null,aiPanelWidthRatio:.7});return}if(n){this.setState({currentAIFunctionType:n,isScriptEditorOpen:!1},()=>{}),this.setState({openAiChat:this.aiManager?.isChartType(s)||!1},()=>{});const o=this.aiManager?.getAITypeFromFunctionType(n);o&&this.setState({currentAIBrandType:o},()=>{})}},this.handleTerminalCommand=s=>{this.setState({terminalCommand:s})},this.openTerminal=()=>{this.setState({terminal:!0})},this.closeTerminal=()=>{this.setState({terminal:!1})};const e=1,i=.3,r=.3,a=tl(t.timeframe)||E.FIFTEEN_MINUTES;this.state={isIndicatorModalOpen:!1,isTimeframeModalOpen:!1,isTradeModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isMobileMenuOpen:!1,isAIModalOpen:!1,activeTool:null,currentMainChartType:G.Candle,currentTheme:this.getThemeConfig(t.theme||"dark"),currentI18N:this.getI18nConfig(t.i18n||"zh-cn"),chartInitialized:!1,isDarkTheme:t.theme!=="light",selectedEmoji:"😀",selectedSubChartIndicators:[],selectedMainChartIndicator:null,subChartPanelHeight:200,isResizing:!1,showInfoLayer:!0,isTimezoneModalOpen:!1,currentTimezone:"Asia/Shanghai",isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,activeTimeframe:a,timeframe:a,timezone:el(t.timezone)||W.SHANGHAI,savedVisibleRange:null,virtualDataBeforeCount:500,virtualDataAfterCount:500,displayData:[],isDataLoading:!1,dataLoadProgress:0,loadError:null,toppanel:t.toppanel||!1,leftpanel:t.leftpanel||!1,ai:t.ai||!1,aiconfigs:t.aiconfigs||[],openAiChat:!1,currentAIFunctionType:null,currentAIBrandType:null,aiPanelWidthRatio:e,isResizingAiPanel:!1,terminalCommand:"",terminal:this.props.terminal||!1,terminalHeightRatio:i,mobileAiPanelHeightRatio:r,isResizingTerminal:!1,markData:this.props.markData||[],isScriptEditorOpen:!1,currentScript:"",scriptName:"Untitled",currentScriptType:Kt.None,currentScriptMarkId:"",isIncrement:!1},this.chartEventManager=new Ni,this.aiManager=new Ml}componentDidMount(){this.chart||(this.setState({isDataLoading:!0}),this.loadDataAsync(()=>{setTimeout(()=>{this.initializeChart(),this.props.mainChartIndicators&&this.props.mainChartIndicators.length>0&&setTimeout(()=>{this.initializeMainChartIndicators(this.props.mainChartIndicators||[])},100),this.props.subChartIndicators&&this.props.subChartIndicators.length>0&&setTimeout(()=>{this.initializeSubChartIndicators(this.props.subChartIndicators||[])},150)},50)}),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("mousemove",this.handleTerminalMouseMove),document.addEventListener("mouseup",this.handleTerminalMouseUp),document.addEventListener("mousemove",this.handleAiMobileMouseMove),document.addEventListener("mouseup",this.handleAiMobileMouseUp),document.addEventListener("touchstart",this.handleClickOutside,!0))}componentDidUpdate(t,e){if(Be.standardizedDPI(),t.theme!==this.props.theme){const r=this.props.theme||"dark";this.setState({currentTheme:this.getThemeConfig(r)}),this.handleThemeToggle()}if(t.data!==this.props.data){this.isIncrementalDataUpdate(t.data,this.props.data)&&this.chart&&this.currentSeries&&this.props.data?(this.setState({isIncrement:!0}),this.originalData=this.props.data,this.refreshInternalData(()=>{this.refreshChart()})):(this.clearStaticMarks(),this.setState({isDataLoading:!0,dataLoadProgress:0}),this.loadDataAsync(()=>{this.refreshChart()}));return}t.mainChartIndicators!==this.props.mainChartIndicators&&(this.props.mainChartIndicators?this.initializeMainChartIndicators(this.props.mainChartIndicators):(this.setState({selectedMainChartIndicator:null}),this.chartLayerRef.current&&Object.values(D).forEach(r=>{this.chartLayerRef.current?.handleRemoveIndicator&&this.chartLayerRef.current.handleRemoveIndicator(r)}))),t.subChartIndicators!==this.props.subChartIndicators&&(this.props.subChartIndicators?this.initializeSubChartIndicators(this.props.subChartIndicators):(this.setState({selectedSubChartIndicators:[]}),this.chartLayerRef.current&&this.state.selectedSubChartIndicators.forEach(r=>{this.chartLayerRef.current?.handleRemoveSubChartIndicator&&this.chartLayerRef.current.handleRemoveSubChartIndicator(r)}))),t.markData!==this.props.markData&&this.props.markData&&this.setState({markData:this.props.markData}),t.terminal!==this.props.terminal&&this.props.terminal&&this.setState({terminal:this.props.terminal}),e.openAiChat!==this.state.openAiChat&&this.setState({aiPanelWidthRatio:this.state.openAiChat?.7:1}),t.aiconfigs!==this.props.aiconfigs&&this.props.aiconfigs&&this.setState({aiconfigs:this.props.aiconfigs}),t.i18n!==this.props.i18n&&(this.setState({currentI18N:this.getI18nConfig(this.props.i18n||"en")}),this.updateChartI18n(this.props.i18n||"en"))}componentWillUnmount(){const t=this.viewportManager?.getVisibleTimeRange();if(t)try{localStorage.setItem("candleView_visibleRange",JSON.stringify(t))}catch{}this.updateTimeout&&clearTimeout(this.updateTimeout),this.resizeObserver&&this.chartContainerRef.current&&(this.resizeObserver.unobserve(this.chartContainerRef.current),this.resizeObserver.disconnect()),this.chart&&this.chart.remove(),this.realTimeInterval&&clearInterval(this.realTimeInterval),document.removeEventListener("mousedown",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("mousemove",this.handleTerminalMouseMove),document.removeEventListener("mouseup",this.handleTerminalMouseUp),document.removeEventListener("mousemove",this.handleAiMobileMouseMove),document.removeEventListener("mouseup",this.handleAiMobileMouseUp)}clearStaticMarks(){this.chartLayerRef&&this.chartLayerRef.current&&this.chartLayerRef.current.staticMarkManager&&this.chartLayerRef.current.staticMarkManager.clearAllMarks&&this.chartLayerRef.current.staticMarkManager.clearAllMarks()}isIncrementalDataUpdate(t,e){if(!t||!e||t.length===0||e.length===0)return!1;if(e.length>t.length){const i=Math.min(t.length,10);for(let r=0;r<i;r++){const a=typeof t[r].time=="string"?new Date(t[r].time).getTime():t[r].time,s=typeof e[r].time=="string"?new Date(e[r].time).getTime():e[r].time;if(a!==s)return!1}return!0}if(t.length===e.length){const i=t[t.length-1],r=e[e.length-1],a=typeof i.time=="string"?new Date(i.time).getTime():i.time,s=typeof r.time=="string"?new Date(r.time).getTime():r.time;if(a===s)return!0;const n=t[0],o=e[0],l=typeof n.time=="string"?new Date(n.time).getTime():n.time,h=typeof o.time=="string"?new Date(o.time).getTime():o.time;return l===h}return!1}clearOriginalData(){this.originalData=[]}clearChart(t){this.currentSeries&&this.currentSeries.series&&this.currentSeries.series.setData([]),this.preparedData=[],this.setState({displayData:[]},()=>{t?.()})}initializeChart(){if(!this.chartRef.current||!this.chartContainerRef.current)return;const t=this.chartContainerRef.current,{currentTheme:e,chartInitialized:i}=this.state,r=t.clientWidth,a=t.clientHeight;if(!(r===0||a===0)&&!i)try{this.setState({dataLoadProgress:75}),this.chart&&(this.chart.remove(),this.currentSeries=null),this.chartManager=new qo(this.chartRef.current,r,a,e,this.props.i18n),this.chart=this.chartManager.getChart(),this.setState({dataLoadProgress:80}),this.viewportManager=new ol(this.chart,this.currentSeries),this.chartEventManager?.registerVisibleTimeRangeChangeEvent(this.chart,n=>{this.handleVisibleTimeRangeChange(n)}),this.currentSeries=Cr(this.chart,e),new Dl({chartSeries:this.currentSeries,chart:this.chart}).addWatermark({src:Fl,size:40,opacity:2,offsetX:20,offsetY:45}),this.state.displayData&&this.state.displayData.length>0&&(this.setState({dataLoadProgress:85}),this.refreshInternalData(()=>{this.initChart(),this.viewportManager?.positionChart(),this.setState({dataLoadProgress:90}),this.setupResizeObserver(),this.setState({chartInitialized:!0,dataLoadProgress:95}),setTimeout(()=>{this.setState({dataLoadProgress:100})},50)}))}catch{this.setState({chartInitialized:!1,dataLoadProgress:100})}}refreshExternalData(t){const e=this.props.data||[];this.originalData=e,t?.()}refreshInternalData(t){const e=ke.handleData(this.originalData,me({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType,this.props.isCloseInternalTimeFrameCalculation||!1);this.preparedData=e,this.setState({displayData:e},()=>{t?.()})}setupResizeObserver(){this.chartContainerRef.current&&(this.resizeObserver=new _r(t=>{for(const e of t)if(e.target===this.chartContainerRef.current&&this.chart){const{width:i,height:r}=e.contentRect,a=Math.max(i,100),s=Math.max(r,100);requestAnimationFrame(()=>{try{if(this.chart){const n=this.chart.timeScale(),o=n.getVisibleRange();this.chart.applyOptions({width:a,height:s}),o&&setTimeout(()=>{try{n.setVisibleRange(o)}catch{}},10)}}catch{}})}}),this.resizeObserver.observe(this.chartContainerRef.current))}updateChartI18n(t){this.chart&&this.chart.applyOptions({localization:{locale:t}})}updateChartTheme(){const{currentTheme:t}=this.state;if(this.chart)try{this.chart.applyOptions({layout:t.layout,grid:{vertLines:{color:t.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:t.grid.horzLines.color+"30",style:1,visible:!0}}}),this.chart.applyOptions({timeScale:{borderColor:t.grid.vertLines.color},rightPriceScale:{borderColor:t.grid.horzLines.color}})}catch{}this.currentSeries&&Er(this.currentSeries,t)}getThemeConfig(t){return t==="light"?yr:Wi}getI18nConfig(t){return t==="en"?ot:zo}render(){const{currentTheme:t,isDataLoading:e,ai:i,openAiChat:r,terminal:a,terminalHeightRatio:s}=this.state,{height:n="100%",width:o="100%"}=this.props,l=i?this.state.aiPanelWidthRatio:1,h=i?1-this.state.aiPanelWidthRatio:0,d=`
391
+ `})]})};class Be{constructor(){Be.standardizedDPI()}static standardizedDPI(){Object.defineProperty(window,"devicePixelRatio",{get:()=>1,configurable:!0});const t=document.createElement.bind(document);document.createElement=function(r,a){const s=t(r,a);if(r.toLowerCase()==="canvas"){const n=()=>{if(s.parentElement){const l=s.getBoundingClientRect();if(l.width>0&&l.height>0){const h=s;(h.width!==l.width||h.height!==l.height)&&(h.width=l.width,h.height=l.height)}}};setTimeout(n,0);const o=new ResizeObserver(()=>{n()});setTimeout(()=>{s.parentElement&&o.observe(s)},100),s.addEventListener("DOMNodeRemoved",()=>{o.disconnect()})}return s};const e=()=>{document.querySelectorAll("canvas").forEach(r=>{const a=r.getBoundingClientRect();if(a.width>0&&a.height>0){const s=r;(s.width!==a.width||s.height!==a.height)&&(s.width=a.width,s.height=a.height)}})};setTimeout(e,0),setTimeout(e,100),setTimeout(e,300),new MutationObserver(r=>{let a=!1;r.forEach(s=>{s.addedNodes.forEach(n=>{n.nodeName==="CANVAS"&&(a=!0)})}),a&&setTimeout(e,50)}).observe(document.body,{childList:!0,subtree:!0}),window.addEventListener("resize",()=>{setTimeout(e,100)})}static forceFixCanvas(){document.querySelectorAll("canvas").forEach(t=>{const e=t.getBoundingClientRect();if(e.width>0&&e.height>0){const i=t;i.width=e.width,i.height=e.height}})}}class yl{constructor(t){this.danmakus=[],this.activeDanmakus=[],this.canvas=null,this.ctx=null,this.animationFrameId=null,this.lastUpdateTime=0,this.isPlaying=!1,this.containerWidth=0,this.containerHeight=0,this.danmakuPool=[],this.config={maxConcurrent:10,defaultStyle:{color:"#FFFFFF",fontSize:16,speed:60,opacity:.9,yPosition:.5},fontFamily:"Arial, sans-serif",lineHeight:1.2,autoStart:!0,...t}}initialize(t){this.canvas=t,this.ctx=t.getContext("2d"),this.ctx&&(this.ctx.textBaseline="middle"),this.updateCanvasSize(),this.config.autoStart&&this.start()}updateCanvasSize(){this.canvas&&(this.containerWidth=this.canvas.width,this.containerHeight=this.canvas.height)}setDanmakus(t){this.danmakus=[...t]}addDanmaku(t){this.danmakus.push(t)}addDanmakus(t){this.danmakus.push(...t)}start(){this.isPlaying||(this.isPlaying=!0,this.lastUpdateTime=performance.now(),this.animate())}stop(){this.isPlaying=!1,this.animationFrameId&&(cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null)}clear(){this.danmakus=[],this.activeDanmakus=[],this.ctx&&this.canvas&&this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}getActiveCount(){return this.activeDanmakus.length}getPendingCount(){return this.danmakus.length}destroy(){this.stop(),this.clear(),this.canvas=null,this.ctx=null,this.danmakuPool=[]}getDanmakuItem(t){if(this.danmakuPool.length>0){const e=this.danmakuPool.pop();return e.text=t,e.isVisible=!0,e.startTime=performance.now(),e}return{id:`danmaku_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,text:t,x:0,y:0,width:0,style:this.getRandomStyle(),startTime:performance.now(),isVisible:!0}}recycleDanmakuItem(t){t.isVisible=!1,this.danmakuPool.push(t)}getRandomStyle(){const t=["#FFFFFF","#FF6B6B","#4ECDC4","#FFD166","#06D6A0","#118AB2","#EF476F","#073B4C","#7209B7","#F72585"],e=[14,16,18],i=[50,60,70,80];return{color:t[Math.floor(Math.random()*t.length)],fontSize:e[Math.floor(Math.random()*e.length)],speed:i[Math.floor(Math.random()*i.length)],opacity:.8+Math.random()*.2,yPosition:.1+Math.random()*.8}}measureTextWidth(t,e){if(!this.ctx)return 100;this.ctx.save(),this.ctx.font=`${e}px ${this.config.fontFamily}`;const i=this.ctx.measureText(t).width;return this.ctx.restore(),i}spawnDanmaku(){if(this.activeDanmakus.length>=this.config.maxConcurrent||this.danmakus.length===0)return;const t=this.danmakus.shift(),e=this.getDanmakuItem(t);e.width=this.measureTextWidth(t,e.style.fontSize),e.x=this.containerWidth,e.y=e.style.yPosition*this.containerHeight,this.activeDanmakus.push(e)}updateDanmakus(t){for(let e=this.activeDanmakus.length-1;e>=0;e--){const i=this.activeDanmakus[e];i.x-=i.style.speed*(t/1e3),i.x+i.width<0&&(this.recycleDanmakuItem(i),this.activeDanmakus.splice(e,1))}this.spawnDanmaku()}renderDanmakus(){!this.ctx||!this.canvas||(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.activeDanmakus.forEach(t=>{this.ctx.save(),this.ctx.font=`${t.style.fontSize}px ${this.config.fontFamily}`,this.ctx.fillStyle=t.style.color,this.ctx.globalAlpha=t.style.opacity,this.ctx.shadowColor="rgba(0, 0, 0, 0.5)",this.ctx.shadowBlur=2,this.ctx.shadowOffsetX=1,this.ctx.shadowOffsetY=1,this.ctx.fillText(t.text,t.x,t.y),this.ctx.restore()}))}animate(){if(!this.isPlaying)return;const t=performance.now(),e=t-this.lastUpdateTime;this.lastUpdateTime=t,this.updateDanmakus(e),this.renderDanmakus(),this.animationFrameId=requestAnimationFrame(()=>this.animate())}}class Zi extends y.Component{constructor(t){super(t),this.candleViewRef=y.createRef(),this.chartRef=y.createRef(),this.chartContainerRef=y.createRef(),this.chartLayerRef=y.createRef(),this.chart=null,this.resizeObserver=null,this.realTimeInterval=null,this.currentSeries=null,this.chartManager=null,this.updateTimeout=null,this.viewportManager=null,this.chartEventManager=null,this.aiPanelResizeRef=y.createRef(),this.isDragging=!1,this.startX=0,this.startChartWidth=0,this.containerWidth=0,this.terminalResizeRef=y.createRef(),this.isDraggingTerminal=!1,this.startY=0,this.startTerminalHeightRatio=0,this.aiMobilePanelResizeRef=y.createRef(),this.isDraggingAiMobilePanel=!1,this.startAiMobileY=0,this.startAiMobileHeightRatio=0,this.preparedData=[],this.originalData=[],this.aiManager=null,this.danmakuManager=null,this.danmakuCanvasRef=y.createRef(),this.danmakuContainerRef=y.createRef(),this.initializeDanmaku=s=>{if(!s||s.length===0)return;if(!this.danmakuContainerRef.current||!this.danmakuCanvasRef.current){setTimeout(()=>this.initializeDanmaku(s),100);return}this.clearDanmaku(),this.danmakuManager=new yl({maxConcurrent:8,defaultStyle:{color:"#FFFFFF",fontSize:14,speed:60,opacity:.85,yPosition:.5},fontFamily:"Arial, sans-serif",autoStart:!0});const n=this.danmakuCanvasRef.current,o=this.danmakuContainerRef.current;n&&o&&(n.width=o.clientWidth,n.height=o.clientHeight,this.danmakuManager.initialize(n),this.danmakuManager.setDanmakus([...s]),this.danmakuManager.start())},this.clearDanmaku=()=>{this.danmakuManager&&(this.danmakuManager.stop(),this.danmakuManager.clear(),this.danmakuManager=null)},this.handleDanmakuResize=()=>{if(this.danmakuCanvasRef.current&&this.danmakuContainerRef.current){const s=this.danmakuCanvasRef.current,n=this.danmakuContainerRef.current;s.width=n.clientWidth,s.height=n.clientHeight,this.danmakuManager&&this.danmakuManager.updateCanvasSize()}},this.initializeMainChartIndicators=s=>{this.setState({selectedMainChartIndicator:null}),this.chartLayerRef.current&&Object.values(D).forEach(n=>{this.chartLayerRef.current?.handleRemoveIndicator&&this.chartLayerRef.current.handleRemoveIndicator(n)}),s.forEach(n=>{const o=n.toUpperCase();if(Object.values(D).includes(o)){let l=null;switch(o){case D.MA:l={...we,nonce:Date.now()};break;case D.EMA:l={...ve,nonce:Date.now()};break;case D.BOLLINGER:l={...xe,nonce:Date.now()};break;case D.ICHIMOKU:l={...Ae,nonce:Date.now()};break;case D.DONCHIAN:l={...De,nonce:Date.now()};break;case D.ENVELOPE:l={...Fe,nonce:Date.now()};break;case D.VWAP:l={...Ee,nonce:Date.now()};break;case D.HEATMAP:l={...ye,nonce:Date.now()};break;case D.MARKETPROFILE:l={...Re,nonce:Date.now()};break}l&&(this.setState({selectedMainChartIndicator:l}),this.chart&&this.currentSeries&&this.chartLayerRef.current&&this.chartLayerRef.current.handleMainChartIndicatorChange&&this.chartLayerRef.current.handleMainChartIndicatorChange(l))}})},this.initializeSubChartIndicators=s=>{this.setState({selectedSubChartIndicators:[]}),this.chartLayerRef.current&&this.state.selectedSubChartIndicators.forEach(o=>{this.chartLayerRef.current?.handleRemoveSubChartIndicator&&this.chartLayerRef.current.handleRemoveSubChartIndicator(o)});const n=[];s.forEach(o=>{const l=o.toUpperCase();Object.values(X).includes(l)&&(n.push(l),this.chartLayerRef.current&&this.handleExternalSelectedSubChartIndicator(l))}),this.setState({selectedSubChartIndicators:n})},this.handleAiMobileMouseMove=s=>{if(!this.isDraggingAiMobilePanel)return;const n=this.candleViewRef.current;if(!n)return;const o=n.clientHeight;if(o<=0)return;const l=this.startAiMobileY-s.clientY,h=this.startAiMobileHeightRatio+l/o,d=Math.max(.1,Math.min(.7,h));this.setState({mobileAiPanelHeightRatio:d})},this.handleAiMobileMouseUp=()=>{this.isDraggingAiMobilePanel&&(this.isDraggingAiMobilePanel=!1,this.setState({isResizingAiPanel:!1}),document.body.style.cursor="",document.body.style.userSelect="")},this.handleTerminalResizeMouseDown=s=>{s.preventDefault(),this.isDraggingTerminal=!0,this.setState({isResizingTerminal:!0}),this.candleViewRef.current&&(this.startY=s.clientY,this.startTerminalHeightRatio=this.state.terminalHeightRatio),document.body.style.cursor="row-resize",document.body.style.userSelect="none"},this.handleTerminalMouseMove=s=>{if(!this.isDraggingTerminal)return;const n=this.candleViewRef.current;if(!n)return;const o=n.clientHeight;if(o<=0)return;const l=this.startY-s.clientY,h=this.startTerminalHeightRatio+l/o,d=Math.max(.2,Math.min(.5,h));this.setState({terminalHeightRatio:d})},this.handleTerminalMouseUp=()=>{this.isDraggingTerminal&&(this.isDraggingTerminal=!1,this.setState({isResizingTerminal:!1}),document.body.style.cursor="",document.body.style.userSelect="")},this.handleResizeMouseDown=s=>{s.preventDefault(),this.isDragging=!0,this.setState({isResizingAiPanel:!0}),this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.dragging);const n=this.candleViewRef.current;n&&(this.containerWidth=n.clientWidth,this.startX=s.clientX,this.startChartWidth=this.state.aiPanelWidthRatio),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},this.handleMouseMove=s=>{if(!this.isDragging||!this.containerWidth)return;const n=s.clientX-this.startX;if(!this.state.ai)return;const o=Math.max(.3,Math.min(.9,this.startChartWidth+n/this.containerWidth));this.setState({aiPanelWidthRatio:o},()=>{if(this.chart){const l=this.chartContainerRef.current;if(l){const h=l.clientWidth,d=l.clientHeight;h>0&&d>0&&this.chart.applyOptions({width:h,height:d})}}})},this.handleMouseUp=()=>{this.isDragging&&(this.isDragging=!1,this.setState({isResizingAiPanel:!1}),this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.normal),document.body.style.cursor="",document.body.style.userSelect="")},this.loadDataAsync=s=>{this.setState({dataLoadProgress:0,isDataLoading:!0}),this.loadExternalData().then(()=>(this.setState({dataLoadProgress:30}),this.loadInternalData())).then(()=>{this.setState({dataLoadProgress:70}),this.setState({dataLoadProgress:100,isDataLoading:!1,loadError:null},()=>{s&&s()})}).catch(n=>{this.setState({isDataLoading:!1,loadError:n.message})})},this.loadExternalData=async()=>(this.clearOriginalData(),new Promise((s,n)=>{try{this.setState({dataLoadProgress:10});const o=this.props.data||[];this.originalData=o,this.setState({dataLoadProgress:30}),s()}catch(o){n(o)}})),this.loadInternalData=async()=>new Promise(s=>{this.setState({dataLoadProgress:40}),this.clearChart(()=>{const n=ke.handleData(this.originalData,me({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType,this.props.isCloseInternalTimeFrameCalculation||!1);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=n,this.setState({dataLoadProgress:60}),this.setState({displayData:n,dataLoadProgress:70},()=>{s()})},50)})}),this.handleTimeFormatClick=()=>{this.setState({isTimeFormatModalOpen:!0})},this.handleCloseTimeClick=()=>{this.setState({isCloseTimeModalOpen:!0})},this.handleTradingDayClick=()=>{this.setState({isTradingDayModalOpen:!0})},this.handleTimezoneClick=()=>{this.setState({isTimezoneModalOpen:!0})},this.handleCloseModals=()=>{this.setState({isTimeframeModalOpen:!1,isIndicatorModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isTimezoneModalOpen:!1,isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,isMobileMenuOpen:!1,isAIModalOpen:!1})},this.handleTimezoneSelect=s=>{this.clearChart(),this.setState({currentTimezone:s,timezone:s,isTimezoneModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:20}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:70}),this.initChart(),this.viewportManager?.positionChart(),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},50)})},this.handleTimeframeSelect=s=>{if(this.clearChart(),this.props.isCloseInternalTimeFrameCalculation){const n=s;this.setState({activeTimeframe:n,timeframe:n},()=>{if(this.props.timeframeCallbacks){const o=this.props.timeframeCallbacks[n];o&&o()}})}else{const n=s;this.setState({activeTimeframe:n,timeframe:n,isTimeframeModalOpen:!1,isDataLoading:!0,dataLoadProgress:0},()=>{setTimeout(()=>{this.setState({dataLoadProgress:10}),this.loadInternalDataAsync(()=>{this.setState({dataLoadProgress:60}),this.initChart(),this.viewportManager?.positionChart(),setTimeout(()=>{this.setState({isDataLoading:!1,dataLoadProgress:100})},50)})},500)})}},this.loadInternalDataAsync=s=>new Promise(n=>{this.state.isDataLoading||this.setState({isDataLoading:!0}),this.setState({dataLoadProgress:10}),setTimeout(()=>{setTimeout(()=>{this.setState({dataLoadProgress:30});const h=ke.handleData(this.originalData,me({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType,this.props.isCloseInternalTimeFrameCalculation||!1);this.setState({dataLoadProgress:50}),setTimeout(()=>{this.preparedData=h,this.setState({displayData:h,dataLoadProgress:60},()=>{s&&s(),n()})},50)},0)},0)}),this.initChart=()=>{if(!(!this.currentSeries||!this.currentSeries.series))try{this.state.isDataLoading&&this.setState({dataLoadProgress:80}),this.currentSeries.series.setData(this.preparedData),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:90})},50)}catch{this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.refreshChart=()=>{if(!(!this.state.displayData||this.state.displayData.length===0||!this.currentSeries||!this.currentSeries.series||!this.chart))try{const s=this.chart.timeScale(),n=s.getVisibleRange();this.state.isDataLoading&&this.setState({dataLoadProgress:85}),this.currentSeries.series.setData(this.state.displayData),n&&setTimeout(()=>{try{s.setVisibleRange(n),this.state.isDataLoading&&setTimeout(()=>{this.setState({dataLoadProgress:95})},50)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},10)}catch{this.state.isDataLoading&&this.setState({isDataLoading:!1,dataLoadProgress:100})}},this.handleExternalSelectedSubChartIndicator=s=>{this.setState(n=>{const o=n.selectedSubChartIndicators.includes(s);let l;return o?l=n.selectedSubChartIndicators.filter(h=>h!==s):l=[...n.selectedSubChartIndicators,s],{selectedSubChartIndicators:l}})},this.handleSelectedSubChartIndicator=s=>{this.setState({selectedSubChartIndicators:s,isSubChartModalOpen:!1})},this.handleRemoveSubChartIndicator=s=>{this.setState(n=>({selectedSubChartIndicators:n.selectedSubChartIndicators.filter(l=>l!==s)}))},this.handleCameraClick=()=>{const{handleScreenshotCapture:s}=this.props;s?Me(this,n=>{n.success&&n.dataUrl&&n.blob?s({dataUrl:n.dataUrl,blob:n.blob,width:n.width,height:n.height,timestamp:n.timestamp}):this.fallbackToDownload(n.dataUrl)}):Me(this)},this.fallbackToDownload=s=>{if(s){const n=document.createElement("a");n.download=`chart-screenshot-${new Date().getTime()}.png`,n.href=s,n.click()}else Me(this)},this.serializeDrawings=()=>this.chartLayerRef.current?this.chartLayerRef.current.serializeDrawings():"[]",this.handleSubChartClick=()=>{this.setState({isSubChartModalOpen:!this.state.isSubChartModalOpen})},this.deserializeDrawings=s=>{this.chartLayerRef.current&&this.chartLayerRef.current.deserializeDrawings(s)},this.clearAllDrawings=()=>{this.chartLayerRef.current&&this.chartLayerRef.current.clearAllDrawings()},this.viewportDataBufferSize=500,this.handleVisibleTimeRangeChange=s=>{if(!s)return;s.from>this.viewportDataBufferSize&&(s.from=s.from-this.viewportDataBufferSize);const n=this.props.isOpenViewportSegmentation?this.viewportManager?.getViewportDataPoints(s,this.preparedData)||[]:this.preparedData;this.setState({displayData:n})},this.handleEmojiSelect=s=>{this.setState({selectedEmoji:s})},this.handleThemeToggle=()=>{this.setState(s=>{const n=!s.isDarkTheme,o=n?"dark":"light";return{isDarkTheme:n,currentTheme:this.getThemeConfig(o)}},()=>{this.updateChartTheme()})},this.handleMobileMenuToggle=()=>{this.setState(s=>({isMobileMenuOpen:!s.isMobileMenuOpen}))},this.handleClickOutside=s=>{const n=s.target,o=this.state.isMobileMenuOpen&&!n.closest(".mobile-menu-button")&&!n.closest("[data-mobile-menu-modal]"),l=this.state.isTimeFormatModalOpen&&!n.closest(".time-format-button")&&!n.closest("[data-timeformat-modal]"),h=this.state.isCloseTimeModalOpen&&!n.closest(".close-time-button")&&!n.closest("[data-close-time-modal]"),d=this.state.isTradingDayModalOpen&&!n.closest(".trading-day-button")&&!n.closest("[data-trading-day-modal]"),g=this.state.isTimezoneModalOpen&&!n.closest(".timezone-button")&&!n.closest("[data-timezone-modal]"),c=this.state.isTimeframeModalOpen&&!n.closest(".timeframe-button")&&!n.closest("[data-timeframe-modal]"),u=this.state.isIndicatorModalOpen&&!n.closest(".indicator-button")&&!n.closest("[data-indicator-modal]"),p=this.state.isTradeModalOpen&&!n.closest(".trade-button")&&!n.closest("[data-trade-modal]"),M=this.state.isChartTypeModalOpen&&!n.closest(".chart-type-button")&&!n.closest("[data-chart-type-modal]"),k=this.state.isSubChartModalOpen&&!n.closest(".subchart-button")&&!n.closest("[data-subchart-modal]");this.state.isAIModalOpen&&!n.closest(".ai-button")&&!n.closest("[data-ai-modal]")&&this.setState({isAIModalOpen:!1}),o&&this.setState({isMobileMenuOpen:!1}),k&&this.setState({isSubChartModalOpen:!1}),c&&this.setState({isTimeframeModalOpen:!1}),u&&this.setState({isIndicatorModalOpen:!1}),p&&this.setState({isTradeModalOpen:!1}),M&&this.setState({isChartTypeModalOpen:!1}),g&&this.setState({isTimezoneModalOpen:!1}),l&&this.setState({isTimeFormatModalOpen:!1}),h&&this.setState({isCloseTimeModalOpen:!1}),d&&this.setState({isTradingDayModalOpen:!1})},this.handleToolSelect=s=>{this.setState({activeTool:s})},this.handleChartTypeSelect=s=>{this.setState({currentMainChartType:s,isChartTypeModalOpen:!1})},this.handleCloseChartTypeModal=()=>{this.setState({isChartTypeModalOpen:!1})},this.handleCloseDrawing=()=>{this.setState({activeTool:null})},this.handleTimeframeClick=()=>{this.setState({isTimeframeModalOpen:!this.state.isTimeframeModalOpen})},this.handleAIClick=()=>{this.setState({isAIModalOpen:!this.state.isAIModalOpen})},this.handleChartTypeClick=()=>{this.setState({isChartTypeModalOpen:!this.state.isChartTypeModalOpen})},this.handleIndicatorClick=()=>{this.setState({isIndicatorModalOpen:!this.state.isIndicatorModalOpen})},this.handleTradeClick=()=>{this.setState({isTradeModalOpen:!this.state.isTradeModalOpen})},this.handleSelectedMainChartIndicator=s=>{this.setState({selectedMainChartIndicator:s,isIndicatorModalOpen:!1})},this.handleMainChartIndicatorChange=s=>{this.setState({selectedMainChartIndicator:s})},this.handleCloseIndicatorModal=()=>{this.setState({isIndicatorModalOpen:!1})},this.handleCloseTimeframeModal=()=>{this.setState({isTimeframeModalOpen:!1})},this.handleCloseTradeModal=()=>{this.setState({isTradeModalOpen:!1})},this.handleTradeAction=s=>{this.setState({isTradeModalOpen:!1})},this.handleFullscreen=()=>{const s=this.chartContainerRef.current;s&&(document.fullscreenElement?document.exitFullscreen?.():s.requestFullscreen?.())},this.handleCompareClick=()=>{},this.handleReplayClick=()=>{},this.stopRealTimeDataSimulation=()=>{this.realTimeInterval&&(clearInterval(this.realTimeInterval),this.realTimeInterval=null)},this.handleContextMenu=s=>{s.preventDefault(),s.stopPropagation()},this.handleLeftArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("left")},this.handleRightArrowClick=()=>{this.chart&&this.viewportManager&&this.viewportManager.scrollChart("right")},this.handleRefreshClick=()=>{this.setState({isDataLoading:!0,dataLoadProgress:0}),setTimeout(()=>{this.setState({dataLoadProgress:20}),this.refreshExternalData(()=>{this.setState({dataLoadProgress:50}),this.refreshInternalData(()=>{this.setState({dataLoadProgress:80}),this.refreshChart(),this.viewportManager?.positionChart(),this.setState({isDataLoading:!1,dataLoadProgress:100})})})},100)},this.handleZoomIn=()=>{this.viewportManager&&this.viewportManager.zoomIn()},this.handleZoomOut=()=>{this.viewportManager&&this.viewportManager.zoomOut()},this.handleOpenScriptEditor=(s,n,o,l)=>{this.setState({isScriptEditorOpen:!0,currentScript:o||"",scriptName:s||"Untitled",openAiChat:!1,aiPanelWidthRatio:.7,currentScriptType:n,currentScriptMarkId:s})},this.handleCloseScriptEditor=()=>{this.setState({isScriptEditorOpen:!1,currentScript:"",aiPanelWidthRatio:1,currentAIFunctionType:null,currentAIBrandType:null})},this.handleSaveScript=async s=>{const{currentScriptType:n,currentScriptMarkId:o}=this.state;Kt.Time===n?this.chartLayerRef.current.setTimeEventScriptById(o,s):Kt.Price===n&&this.chartLayerRef.current.setPriceEventScriptById(o,s),this.handleCloseScriptEditor()},this.handleRunScript=async s=>Promise.resolve(),this.handleAIFunctionSelect=s=>{const n=this.aiManager?.aiToolIdToFunctionType(s);if(s==="script-editor"){this.setState({isScriptEditorOpen:!0,openAiChat:!1,currentAIFunctionType:null,currentAIBrandType:null,aiPanelWidthRatio:.7});return}if(n){this.setState({currentAIFunctionType:n,isScriptEditorOpen:!1},()=>{}),this.setState({openAiChat:this.aiManager?.isChartType(s)||!1},()=>{});const o=this.aiManager?.getAITypeFromFunctionType(n);o&&this.setState({currentAIBrandType:o},()=>{})}},this.handleTerminalCommand=s=>{this.setState({terminalCommand:s})},this.openTerminal=()=>{this.setState({terminal:!0})},this.closeTerminal=()=>{this.setState({terminal:!1})};const e=1,i=.3,r=.3,a=Go(t.timeframe)||E.FIFTEEN_MINUTES;this.state={isIndicatorModalOpen:!1,isTimeframeModalOpen:!1,isTradeModalOpen:!1,isChartTypeModalOpen:!1,isSubChartModalOpen:!1,isMobileMenuOpen:!1,isAIModalOpen:!1,activeTool:null,currentMainChartType:G.Candle,currentTheme:this.getThemeConfig(t.theme||"dark"),currentI18N:this.getI18nConfig(t.i18n||"zh-cn"),chartInitialized:!1,isDarkTheme:t.theme!=="light",selectedEmoji:"😀",selectedSubChartIndicators:[],selectedMainChartIndicator:null,subChartPanelHeight:200,isResizing:!1,showInfoLayer:!0,isTimezoneModalOpen:!1,currentTimezone:"Asia/Shanghai",isTimeFormatModalOpen:!1,isCloseTimeModalOpen:!1,isTradingDayModalOpen:!1,activeTimeframe:a,timeframe:a,timezone:$o(t.timezone)||W.SHANGHAI,savedVisibleRange:null,virtualDataBeforeCount:500,virtualDataAfterCount:500,displayData:[],isDataLoading:!1,dataLoadProgress:0,loadError:null,toppanel:t.toppanel||!1,leftpanel:t.leftpanel||!1,ai:t.ai||!1,aiconfigs:t.aiconfigs||[],openAiChat:!1,currentAIFunctionType:null,currentAIBrandType:null,aiPanelWidthRatio:e,isResizingAiPanel:!1,terminalCommand:"",terminal:this.props.terminal||!1,terminalHeightRatio:i,mobileAiPanelHeightRatio:r,isResizingTerminal:!1,markData:this.props.markData||[],isScriptEditorOpen:!1,currentScript:"",scriptName:"Untitled",currentScriptType:Kt.None,currentScriptMarkId:"",isIncrement:!1},this.chartEventManager=new Ni,this.aiManager=new ul}componentDidMount(){if(this.chart)return;const{danmakus:t}=this.props;this.setState({isDataLoading:!0}),this.loadDataAsync(()=>{setTimeout(()=>{this.initializeChart(),this.props.mainChartIndicators&&this.props.mainChartIndicators.length>0&&setTimeout(()=>{this.initializeMainChartIndicators(this.props.mainChartIndicators||[])},100),this.props.subChartIndicators&&this.props.subChartIndicators.length>0&&setTimeout(()=>{this.initializeSubChartIndicators(this.props.subChartIndicators||[])},150)},50)}),t&&this.initializeDanmaku(t),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("mousemove",this.handleTerminalMouseMove),document.addEventListener("mouseup",this.handleTerminalMouseUp),document.addEventListener("mousemove",this.handleAiMobileMouseMove),document.addEventListener("mouseup",this.handleAiMobileMouseUp),document.addEventListener("touchstart",this.handleClickOutside,!0)}componentDidUpdate(t,e){if(Be.standardizedDPI(),t.theme!==this.props.theme){const r=this.props.theme||"dark";this.setState({currentTheme:this.getThemeConfig(r)}),this.handleThemeToggle()}if(t.data!==this.props.data){this.isIncrementalDataUpdate(t.data,this.props.data)&&this.chart&&this.currentSeries&&this.props.data?(this.setState({isIncrement:!0}),this.originalData=this.props.data,this.refreshInternalData(()=>{this.refreshChart()})):(this.clearStaticMarks(),this.setState({isDataLoading:!0,dataLoadProgress:0}),this.loadDataAsync(()=>{this.refreshChart()}));return}t.danmakus!==this.props.danmakus&&(this.props.danmakus?this.initializeDanmaku(this.props.danmakus):this.clearDanmaku()),t.mainChartIndicators!==this.props.mainChartIndicators&&(this.props.mainChartIndicators?this.initializeMainChartIndicators(this.props.mainChartIndicators):(this.setState({selectedMainChartIndicator:null}),this.chartLayerRef.current&&Object.values(D).forEach(r=>{this.chartLayerRef.current?.handleRemoveIndicator&&this.chartLayerRef.current.handleRemoveIndicator(r)}))),t.subChartIndicators!==this.props.subChartIndicators&&(this.props.subChartIndicators?this.initializeSubChartIndicators(this.props.subChartIndicators):(this.setState({selectedSubChartIndicators:[]}),this.chartLayerRef.current&&this.state.selectedSubChartIndicators.forEach(r=>{this.chartLayerRef.current?.handleRemoveSubChartIndicator&&this.chartLayerRef.current.handleRemoveSubChartIndicator(r)}))),t.markData!==this.props.markData&&this.props.markData&&this.setState({markData:this.props.markData}),t.terminal!==this.props.terminal&&this.props.terminal&&this.setState({terminal:this.props.terminal}),e.openAiChat!==this.state.openAiChat&&this.setState({aiPanelWidthRatio:this.state.openAiChat?.7:1}),t.aiconfigs!==this.props.aiconfigs&&this.props.aiconfigs&&this.setState({aiconfigs:this.props.aiconfigs}),t.i18n!==this.props.i18n&&(this.setState({currentI18N:this.getI18nConfig(this.props.i18n||"en")}),this.updateChartI18n(this.props.i18n||"en"))}componentWillUnmount(){const t=this.viewportManager?.getVisibleTimeRange();if(t)try{localStorage.setItem("candleView_visibleRange",JSON.stringify(t))}catch{}this.updateTimeout&&clearTimeout(this.updateTimeout),this.resizeObserver&&this.chartContainerRef.current&&(this.resizeObserver.unobserve(this.chartContainerRef.current),this.resizeObserver.disconnect()),this.chart&&this.chart.remove(),this.realTimeInterval&&clearInterval(this.realTimeInterval),this.clearDanmaku(),document.removeEventListener("mousedown",this.handleClickOutside,!0),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("mousemove",this.handleTerminalMouseMove),document.removeEventListener("mouseup",this.handleTerminalMouseUp),document.removeEventListener("mousemove",this.handleAiMobileMouseMove),document.removeEventListener("mouseup",this.handleAiMobileMouseUp)}clearStaticMarks(){this.chartLayerRef&&this.chartLayerRef.current&&this.chartLayerRef.current.staticMarkManager&&this.chartLayerRef.current.staticMarkManager.clearAllMarks&&this.chartLayerRef.current.staticMarkManager.clearAllMarks()}isIncrementalDataUpdate(t,e){if(!t||!e||t.length===0||e.length===0)return!1;if(e.length>t.length){const i=Math.min(t.length,10);for(let r=0;r<i;r++){const a=typeof t[r].time=="string"?new Date(t[r].time).getTime():t[r].time,s=typeof e[r].time=="string"?new Date(e[r].time).getTime():e[r].time;if(a!==s)return!1}return!0}if(t.length===e.length){const i=t[t.length-1],r=e[e.length-1],a=typeof i.time=="string"?new Date(i.time).getTime():i.time,s=typeof r.time=="string"?new Date(r.time).getTime():r.time;if(a===s)return!0;const n=t[0],o=e[0],l=typeof n.time=="string"?new Date(n.time).getTime():n.time,h=typeof o.time=="string"?new Date(o.time).getTime():o.time;return l===h}return!1}clearOriginalData(){this.originalData=[]}clearChart(t){this.currentSeries&&this.currentSeries.series&&this.currentSeries.series.setData([]),this.preparedData=[],this.setState({displayData:[]},()=>{t?.()})}initializeChart(){if(!this.chartRef.current||!this.chartContainerRef.current)return;const t=this.chartContainerRef.current,{currentTheme:e,chartInitialized:i}=this.state,r=t.clientWidth,a=t.clientHeight;if(!(r===0||a===0)&&!i)try{this.setState({dataLoadProgress:75}),this.chart&&(this.chart.remove(),this.currentSeries=null),this.chartManager=new qo(this.chartRef.current,r,a,e,this.props.i18n),this.chart=this.chartManager.getChart(),this.setState({dataLoadProgress:80}),this.viewportManager=new rl(this.chart,this.currentSeries),this.chartEventManager?.registerVisibleTimeRangeChangeEvent(this.chart,n=>{this.handleVisibleTimeRangeChange(n)}),this.currentSeries=Cr(this.chart,e),new wl({chartSeries:this.currentSeries,chart:this.chart}).addWatermark({src:vl,size:40,opacity:2,offsetX:20,offsetY:45}),this.state.displayData&&this.state.displayData.length>0&&(this.setState({dataLoadProgress:85}),this.refreshInternalData(()=>{this.initChart(),this.viewportManager?.positionChart(),this.setState({dataLoadProgress:90}),this.setupResizeObserver(),this.setState({chartInitialized:!0,dataLoadProgress:95}),setTimeout(()=>{this.setState({dataLoadProgress:100})},50)}))}catch{this.setState({chartInitialized:!1,dataLoadProgress:100})}}refreshExternalData(t){const e=this.props.data||[];this.originalData=e,t?.()}refreshInternalData(t){const e=ke.handleData(this.originalData,me({timeframe:this.state.timeframe,timezone:this.state.timezone},this.state.currentMainChartType,this.state.virtualDataBeforeCount,this.state.virtualDataAfterCount),this.state.currentMainChartType,this.props.isCloseInternalTimeFrameCalculation||!1);this.preparedData=e,this.setState({displayData:e},()=>{t?.()})}setupResizeObserver(){this.chartContainerRef.current&&(this.resizeObserver=new _r(t=>{for(const e of t)if(e.target===this.chartContainerRef.current&&this.chart){const{width:i,height:r}=e.contentRect,a=Math.max(i,100),s=Math.max(r,100);requestAnimationFrame(()=>{try{if(this.chart){const n=this.chart.timeScale(),o=n.getVisibleRange();this.chart.applyOptions({width:a,height:s}),o&&setTimeout(()=>{try{n.setVisibleRange(o)}catch{}},10)}}catch{}})}}),this.resizeObserver.observe(this.chartContainerRef.current))}updateChartI18n(t){this.chart&&this.chart.applyOptions({localization:{locale:t}})}updateChartTheme(){const{currentTheme:t}=this.state;if(this.chart)try{this.chart.applyOptions({layout:t.layout,grid:{vertLines:{color:t.grid.vertLines.color+"30",style:1,visible:!0},horzLines:{color:t.grid.horzLines.color+"30",style:1,visible:!0}}}),this.chart.applyOptions({timeScale:{borderColor:t.grid.vertLines.color},rightPriceScale:{borderColor:t.grid.horzLines.color}})}catch{}this.currentSeries&&Er(this.currentSeries,t)}getThemeConfig(t){return t==="light"?yr:Wi}getI18nConfig(t){return t==="en"?ot:zo}render(){const{currentTheme:t,isDataLoading:e,ai:i,openAiChat:r,terminal:a,terminalHeightRatio:s}=this.state,{height:n="100%",width:o="100%"}=this.props,l=i?this.state.aiPanelWidthRatio:1,h=i?1-this.state.aiPanelWidthRatio:0,d=`
392
392
  .custom-scrollbar::-webkit-scrollbar {
393
393
  width: 6px;
394
394
  }
@@ -432,4 +432,4 @@ console.log("结果:", x);
432
432
  0% { transform: rotate(0deg); }
433
433
  100% { transform: rotate(360deg); }
434
434
  }
435
- `}),g&&m.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:2,background:"transparent"},onClick:this.handleCloseModals}),this.state.toppanel&&m.jsx(xl,{candleViewRef:this.candleViewRef,currentTheme:t,activeTimeframe:this.state.activeTimeframe,activeMainChartType:this.state.currentMainChartType,isDarkTheme:this.state.isDarkTheme,isTimeframeModalOpen:this.state.isTimeframeModalOpen,isIndicatorModalOpen:this.state.isIndicatorModalOpen,isChartTypeModalOpen:this.state.isChartTypeModalOpen,isSubChartModalOpen:this.state.isSubChartModalOpen,isTimezoneModalOpen:this.state.isTimezoneModalOpen,isAIModalOpen:this.state.isAIModalOpen,onThemeToggle:this.handleThemeToggle,onAIClick:this.handleAIClick,onTimeframeClick:this.handleTimeframeClick,onIndicatorClick:this.handleIndicatorClick,onChartTypeClick:this.handleChartTypeClick,onCompareClick:this.handleCompareClick,onFullscreenClick:this.handleFullscreen,onReplayClick:this.handleReplayClick,onTimezoneClick:this.handleTimezoneClick,onTimeframeSelect:this.handleTimeframeSelect,onChartTypeSelect:this.handleChartTypeSelect,onTimezoneSelect:this.handleTimezoneSelect,handleSelectedSubChartIndicator:this.handleSelectedSubChartIndicator,handleSelectedMainChartIndicator:this.handleSelectedMainChartIndicator,onCloseModals:this.handleCloseModals,onSubChartClick:this.handleSubChartClick,selectedSubChartIndicators:this.state.selectedSubChartIndicators,onCameraClick:this.handleCameraClick,i18n:this.state.currentI18N,currentTimezone:this.state.currentTimezone,isTimeFormatModalOpen:this.state.isTimeFormatModalOpen,isCloseTimeModalOpen:this.state.isCloseTimeModalOpen,isTradingDayModalOpen:this.state.isTradingDayModalOpen,onTimeFormatClick:this.handleTimeFormatClick,onCloseTimeClick:this.handleCloseTimeClick,onTradingDayClick:this.handleTradingDayClick,isMobileMenuOpen:this.state.isMobileMenuOpen,onMobileMenuToggle:this.handleMobileMenuToggle,timeframe:this.state.timeframe,timezone:this.state.timezone,isCloseInternalTimeFrameCalculation:this.props.isCloseInternalTimeFrameCalculation||!1,timeframeCallbacks:this.props.timeframeCallbacks||{},isMobileMode:this.props.isMobileMode||!1,candleView:this,ai:this.state.ai,aiconfigs:this.state.aiconfigs,handleAIFunctionSelect:this.handleAIFunctionSelect}),m.jsxs("div",{style:{display:"flex",flex:this.props.isMobileMode&&r?`calc(100% - ${this.state.mobileAiPanelHeightRatio*100}% - ${a&&!r?s*100:0}%)`:a&&!(this.props.isMobileMode&&r)?`calc(100% - ${s*100}%)`:"100%",minHeight:0,position:"relative"},children:[this.state.leftpanel&&!this.props.isMobileMode&&m.jsx(Cl,{currentTheme:t,activeTool:this.state.activeTool,onToolSelect:this.handleToolSelect,onTradeClick:this.handleTradeClick,chartLayerRef:this.chartLayerRef,selectedEmoji:this.state.selectedEmoji,onEmojiSelect:this.handleEmojiSelect,i18n:this.state.currentI18N,candleViewRef:this.candleViewRef,ai:this.state.ai,aiconfigs:this.state.aiconfigs,handleAIFunctionSelect:this.handleAIFunctionSelect,candleView:this,isMobileMode:this.props.isMobileMode||!1}),m.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"row",minWidth:0,minHeight:0,position:"relative"},children:[m.jsx("div",{style:{flex:this.props.isMobileMode?1:l,display:"flex",flexDirection:"column",minWidth:0,minHeight:0,position:"relative"},children:m.jsxs("div",{ref:this.chartContainerRef,style:{flex:1,position:"relative",minHeight:"100px"},children:[m.jsx("div",{ref:this.chartRef,style:{width:"100%",height:"100%"}}),this.state.chartInitialized&&m.jsx(Vo,{candleView:this,ref:this.chartLayerRef,chart:this.chart,chartSeries:this.currentSeries,currentTheme:t,activeTool:this.state.activeTool,onCloseDrawing:this.handleCloseDrawing,onTextClick:this.handleToolSelect,onEmojiClick:this.handleToolSelect,selectedEmoji:this.state.selectedEmoji,chartData:this.state.displayData,title:this.props.title,selectedMainChartIndicator:this.state.selectedMainChartIndicator,selectedSubChartIndicators:this.state.selectedSubChartIndicators,showInfoLayer:this.state.showInfoLayer,i18n:this.state.currentI18N,markData:this.state.markData,onMainChartIndicatorChange:this.handleMainChartIndicatorChange,handleRemoveSubChartIndicator:this.handleRemoveSubChartIndicator,currentMainChartType:this.state.currentMainChartType,viewportManager:this.viewportManager,ai:this.state.ai,aiconfigs:this.state.aiconfigs,currentAIFunctionType:this.state.currentAIFunctionType,timeframe:this.state.timeframe,timezone:this.state.timezone,isIncrement:this.state.isIncrement}),m.jsxs("div",{style:{position:"absolute",bottom:"80px",left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"15px",zIndex:3,opacity:0,transition:"opacity 0.3s ease",pointerEvents:"auto"},onMouseEnter:p=>{p.currentTarget.style.opacity="1",p.stopPropagation()},onMouseLeave:p=>{p.currentTarget.style.opacity="0",p.stopPropagation()},children:[m.jsx("button",{onClick:this.handleZoomOut,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(yn,{size:14,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleLeftArrowClick,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(An,{size:14,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleRefreshClick,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(Fn,{size:16,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleRightArrowClick,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(Dn,{size:14,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleZoomIn,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(En,{size:14,color:t.toolbar.button.iconColor})})]})]})}),!this.props.isMobileMode&&(r||this.state.isScriptEditorOpen)&&m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:this.aiPanelResizeRef,style:{width:"8px",cursor:"col-resize",backgroundColor:this.state.currentTheme.divider.normal,display:"flex",alignItems:"center",justifyContent:"center",position:"relative",transition:"background-color 0.2s"},onMouseDown:this.handleResizeMouseDown,onMouseEnter:()=>{this.isDragging||this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.hover)},onMouseLeave:()=>{this.isDragging||this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.normal)},children:m.jsx("div",{style:{width:"2px",height:"40px",backgroundColor:this.state.currentTheme.toolbar.button.color+"60",borderRadius:"1px"}})}),m.jsxs("div",{style:{flex:h,minWidth:"200px",display:"flex",flexDirection:"column",backgroundColor:t.layout.background.color,borderLeft:`1px solid ${t.toolbar.border}30`,overflow:"hidden"},children:[r&&m.jsx(Rl,{currentTheme:t,i18n:this.state.currentI18N,currentAIFunctionType:this.state.currentAIFunctionType,aiconfigs:this.state.aiconfigs,currentAIBrandType:this.state.currentAIBrandType,onClose:()=>{this.setState({openAiChat:!1,currentAIFunctionType:null,currentAIBrandType:null,aiPanelWidthRatio:1})},onSendMessage:async p=>new Promise(M=>{setTimeout(()=>{M()},1e3)}),data:this.originalData}),this.state.isScriptEditorOpen&&m.jsx(Ul,{currentTheme:t,i18n:this.state.currentI18N,initialScript:this.state.currentScript,scriptName:this.state.scriptName,onClose:this.handleCloseScriptEditor,onSave:this.handleSaveScript,onRun:this.handleRunScript,isLoading:!1})]})]})]})]}),a&&!this.props.isMobileMode&&m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:this.terminalResizeRef,style:{height:"8px",cursor:"row-resize",backgroundColor:this.state.isResizingTerminal?t.divider.dragging:t.divider.normal,display:"flex",alignItems:"center",justifyContent:"center",position:"relative",transition:"background-color 0.2s"},onMouseDown:this.handleTerminalResizeMouseDown,onMouseEnter:()=>{this.isDraggingTerminal||this.terminalResizeRef.current&&(this.terminalResizeRef.current.style.backgroundColor=t.divider.hover)},onMouseLeave:()=>{this.isDraggingTerminal||this.terminalResizeRef.current&&(this.terminalResizeRef.current.style.backgroundColor=t.divider.normal)},children:m.jsx("div",{style:{width:"40px",height:"2px",backgroundColor:t.toolbar.button.color+"60",borderRadius:"1px"}})}),m.jsx("div",{style:{flex:a?`${s*100}%`:"0",minHeight:"100px",display:"flex",flexDirection:"column",backgroundColor:t.layout.background.color,borderTop:`1px solid ${t.toolbar.border}30`,overflow:"hidden"},children:m.jsx(Pl,{currentTheme:t,i18n:this.state.currentI18N,placeholder:this.state.currentI18N===ot?"Enter command (e.g., 'help', 'clear', 'theme light')...":"输入命令 (例如: 'help', 'clear', 'theme light')...",onCommand:this.handleTerminalCommand,autoFocus:!1,candleView:this,chartLayerRef:this.chartLayerRef})})]})]})}}exports.CandleView=Zi;exports.default=Zi;
435
+ `}),g&&m.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:2,background:"transparent"},onClick:this.handleCloseModals}),this.state.toppanel&&m.jsx(bl,{candleViewRef:this.candleViewRef,currentTheme:t,activeTimeframe:this.state.activeTimeframe,activeMainChartType:this.state.currentMainChartType,isDarkTheme:this.state.isDarkTheme,isTimeframeModalOpen:this.state.isTimeframeModalOpen,isIndicatorModalOpen:this.state.isIndicatorModalOpen,isChartTypeModalOpen:this.state.isChartTypeModalOpen,isSubChartModalOpen:this.state.isSubChartModalOpen,isTimezoneModalOpen:this.state.isTimezoneModalOpen,isAIModalOpen:this.state.isAIModalOpen,onThemeToggle:this.handleThemeToggle,onAIClick:this.handleAIClick,onTimeframeClick:this.handleTimeframeClick,onIndicatorClick:this.handleIndicatorClick,onChartTypeClick:this.handleChartTypeClick,onCompareClick:this.handleCompareClick,onFullscreenClick:this.handleFullscreen,onReplayClick:this.handleReplayClick,onTimezoneClick:this.handleTimezoneClick,onTimeframeSelect:this.handleTimeframeSelect,onChartTypeSelect:this.handleChartTypeSelect,onTimezoneSelect:this.handleTimezoneSelect,handleSelectedSubChartIndicator:this.handleSelectedSubChartIndicator,handleSelectedMainChartIndicator:this.handleSelectedMainChartIndicator,onCloseModals:this.handleCloseModals,onSubChartClick:this.handleSubChartClick,selectedSubChartIndicators:this.state.selectedSubChartIndicators,onCameraClick:this.handleCameraClick,i18n:this.state.currentI18N,currentTimezone:this.state.currentTimezone,isTimeFormatModalOpen:this.state.isTimeFormatModalOpen,isCloseTimeModalOpen:this.state.isCloseTimeModalOpen,isTradingDayModalOpen:this.state.isTradingDayModalOpen,onTimeFormatClick:this.handleTimeFormatClick,onCloseTimeClick:this.handleCloseTimeClick,onTradingDayClick:this.handleTradingDayClick,isMobileMenuOpen:this.state.isMobileMenuOpen,onMobileMenuToggle:this.handleMobileMenuToggle,timeframe:this.state.timeframe,timezone:this.state.timezone,isCloseInternalTimeFrameCalculation:this.props.isCloseInternalTimeFrameCalculation||!1,timeframeCallbacks:this.props.timeframeCallbacks||{},isMobileMode:this.props.isMobileMode||!1,candleView:this,ai:this.state.ai,aiconfigs:this.state.aiconfigs,handleAIFunctionSelect:this.handleAIFunctionSelect}),m.jsxs("div",{style:{display:"flex",flex:this.props.isMobileMode&&r?`calc(100% - ${this.state.mobileAiPanelHeightRatio*100}% - ${a&&!r?s*100:0}%)`:a&&!(this.props.isMobileMode&&r)?`calc(100% - ${s*100}%)`:"100%",minHeight:0,position:"relative"},children:[this.state.leftpanel&&!this.props.isMobileMode&&m.jsx(kl,{currentTheme:t,activeTool:this.state.activeTool,onToolSelect:this.handleToolSelect,onTradeClick:this.handleTradeClick,chartLayerRef:this.chartLayerRef,selectedEmoji:this.state.selectedEmoji,onEmojiSelect:this.handleEmojiSelect,i18n:this.state.currentI18N,candleViewRef:this.candleViewRef,ai:this.state.ai,aiconfigs:this.state.aiconfigs,handleAIFunctionSelect:this.handleAIFunctionSelect,candleView:this,isMobileMode:this.props.isMobileMode||!1}),m.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"row",minWidth:0,minHeight:0,position:"relative"},children:[m.jsx("div",{style:{flex:this.props.isMobileMode?1:l,display:"flex",flexDirection:"column",minWidth:0,minHeight:0,position:"relative"},children:m.jsxs("div",{ref:this.chartContainerRef,style:{flex:1,position:"relative",minHeight:"100px"},children:[m.jsx("div",{ref:this.chartRef,style:{width:"100%",height:"100%"}}),m.jsx("div",{ref:this.danmakuContainerRef,style:{position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:1,pointerEvents:"none",overflow:"hidden"},children:m.jsx("canvas",{ref:this.danmakuCanvasRef,style:{width:"100%",height:"100%",display:this.props.danmakus&&this.props.danmakus.length>0?"block":"none"}})}),this.state.chartInitialized&&m.jsx(Vo,{candleView:this,ref:this.chartLayerRef,chart:this.chart,chartSeries:this.currentSeries,currentTheme:t,activeTool:this.state.activeTool,onCloseDrawing:this.handleCloseDrawing,onTextClick:this.handleToolSelect,onEmojiClick:this.handleToolSelect,selectedEmoji:this.state.selectedEmoji,chartData:this.state.displayData,title:this.props.title,selectedMainChartIndicator:this.state.selectedMainChartIndicator,selectedSubChartIndicators:this.state.selectedSubChartIndicators,showInfoLayer:this.state.showInfoLayer,i18n:this.state.currentI18N,markData:this.state.markData,onMainChartIndicatorChange:this.handleMainChartIndicatorChange,handleRemoveSubChartIndicator:this.handleRemoveSubChartIndicator,currentMainChartType:this.state.currentMainChartType,viewportManager:this.viewportManager,ai:this.state.ai,aiconfigs:this.state.aiconfigs,currentAIFunctionType:this.state.currentAIFunctionType,timeframe:this.state.timeframe,timezone:this.state.timezone,isIncrement:this.state.isIncrement}),m.jsxs("div",{style:{position:"absolute",bottom:"80px",left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"15px",zIndex:3,opacity:0,transition:"opacity 0.3s ease",pointerEvents:"auto"},onMouseEnter:p=>{p.currentTarget.style.opacity="1",p.stopPropagation()},onMouseLeave:p=>{p.currentTarget.style.opacity="0",p.stopPropagation()},children:[m.jsx("button",{onClick:this.handleZoomOut,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(yn,{size:14,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleLeftArrowClick,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(An,{size:14,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleRefreshClick,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(Fn,{size:16,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleRightArrowClick,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(Dn,{size:14,color:t.toolbar.button.iconColor})}),m.jsx("button",{onClick:this.handleZoomIn,style:{width:"25px",height:"25px",borderRadius:"6px",border:"none",background:t.toolbar.button.backgroundColor,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",boxShadow:t.toolbar.button.boxShadow,pointerEvents:"auto"},onMouseDown:p=>p.stopPropagation(),children:m.jsx(En,{size:14,color:t.toolbar.button.iconColor})})]})]})}),!this.props.isMobileMode&&(r||this.state.isScriptEditorOpen)&&m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:this.aiPanelResizeRef,style:{width:"8px",cursor:"col-resize",backgroundColor:this.state.currentTheme.divider.normal,display:"flex",alignItems:"center",justifyContent:"center",position:"relative",transition:"background-color 0.2s"},onMouseDown:this.handleResizeMouseDown,onMouseEnter:()=>{this.isDragging||this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.hover)},onMouseLeave:()=>{this.isDragging||this.aiPanelResizeRef.current&&(this.aiPanelResizeRef.current.style.backgroundColor=this.state.currentTheme.divider.normal)},children:m.jsx("div",{style:{width:"2px",height:"40px",backgroundColor:this.state.currentTheme.toolbar.button.color+"60",borderRadius:"1px"}})}),m.jsxs("div",{style:{flex:h,minWidth:"200px",display:"flex",flexDirection:"column",backgroundColor:t.layout.background.color,borderLeft:`1px solid ${t.toolbar.border}30`,overflow:"hidden"},children:[r&&m.jsx(Dl,{currentTheme:t,i18n:this.state.currentI18N,currentAIFunctionType:this.state.currentAIFunctionType,aiconfigs:this.state.aiconfigs,currentAIBrandType:this.state.currentAIBrandType,onClose:()=>{this.setState({openAiChat:!1,currentAIFunctionType:null,currentAIBrandType:null,aiPanelWidthRatio:1})},onSendMessage:async p=>new Promise(M=>{setTimeout(()=>{M()},1e3)}),data:this.originalData}),this.state.isScriptEditorOpen&&m.jsx(El,{currentTheme:t,i18n:this.state.currentI18N,initialScript:this.state.currentScript,scriptName:this.state.scriptName,onClose:this.handleCloseScriptEditor,onSave:this.handleSaveScript,onRun:this.handleRunScript,isLoading:!1})]})]})]})]}),a&&!this.props.isMobileMode&&m.jsxs(m.Fragment,{children:[m.jsx("div",{ref:this.terminalResizeRef,style:{height:"8px",cursor:"row-resize",backgroundColor:this.state.isResizingTerminal?t.divider.dragging:t.divider.normal,display:"flex",alignItems:"center",justifyContent:"center",position:"relative",transition:"background-color 0.2s"},onMouseDown:this.handleTerminalResizeMouseDown,onMouseEnter:()=>{this.isDraggingTerminal||this.terminalResizeRef.current&&(this.terminalResizeRef.current.style.backgroundColor=t.divider.hover)},onMouseLeave:()=>{this.isDraggingTerminal||this.terminalResizeRef.current&&(this.terminalResizeRef.current.style.backgroundColor=t.divider.normal)},children:m.jsx("div",{style:{width:"40px",height:"2px",backgroundColor:t.toolbar.button.color+"60",borderRadius:"1px"}})}),m.jsx("div",{style:{flex:a?`${s*100}%`:"0",minHeight:"100px",display:"flex",flexDirection:"column",backgroundColor:t.layout.background.color,borderTop:`1px solid ${t.toolbar.border}30`,overflow:"hidden"},children:m.jsx(fl,{currentTheme:t,i18n:this.state.currentI18N,placeholder:this.state.currentI18N===ot?"Enter command (e.g., 'help', 'clear', 'theme light')...":"输入命令 (例如: 'help', 'clear', 'theme light')...",onCommand:this.handleTerminalCommand,autoFocus:!1,candleView:this,chartLayerRef:this.chartLayerRef})})]})]})}}exports.CandleView=Zi;exports.default=Zi;